From 642d528b7b403eb91c67ff809ffa0fb99a1ff56e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 22:00:00 +0900 Subject: [PATCH] chore(deps): update dependency dotenv-expand to v11 (#15875) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: bluwy --- package.json | 1 - packages/vite/package.json | 2 +- packages/vite/src/node/env.ts | 9 +++++---- patches/dotenv-expand@10.0.0.patch | 18 ------------------ pnpm-lock.yaml | 14 ++++++-------- 5 files changed, 12 insertions(+), 32 deletions(-) delete mode 100644 patches/dotenv-expand@10.0.0.patch diff --git a/package.json b/package.json index 1f758bec1eaacf..7b6d67ee69eb96 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,6 @@ }, "patchedDependencies": { "chokidar@3.6.0": "patches/chokidar@3.6.0.patch", - "dotenv-expand@10.0.0": "patches/dotenv-expand@10.0.0.patch", "sirv@2.0.4": "patches/sirv@2.0.4.patch" }, "peerDependencyRules": { diff --git a/packages/vite/package.json b/packages/vite/package.json index eb82d124945117..bccb4fb885affd 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -117,7 +117,7 @@ "debug": "^4.3.4", "dep-types": "link:./src/types", "dotenv": "^16.4.2", - "dotenv-expand": "^10.0.0", + "dotenv-expand": "^11.0.3", "es-module-lexer": "^1.4.1", "escape-html": "^1.0.3", "estree-walker": "^3.0.3", diff --git a/packages/vite/src/node/env.ts b/packages/vite/src/node/env.ts index 1052f894ec8c2d..897524612f3c7d 100644 --- a/packages/vite/src/node/env.ts +++ b/packages/vite/src/node/env.ts @@ -1,7 +1,7 @@ import fs from 'node:fs' import path from 'node:path' import { parse } from 'dotenv' -import { expand } from 'dotenv-expand' +import { type DotenvPopulateInput, expand } from 'dotenv-expand' import { arraify, normalizePath, tryStatSync } from './utils' import type { UserConfig } from './config' @@ -49,9 +49,10 @@ export function loadEnv( process.env.BROWSER_ARGS = parsed.BROWSER_ARGS } - // let environment variables use each other - // `expand` patched in patches/dotenv-expand@9.0.0.patch - expand({ parsed }) + // let environment variables use each other. make a copy of `process.env` so that `dotenv-expand` + // doesn't re-assign the expanded values to the global `process.env`. + const processEnv = { ...process.env } as DotenvPopulateInput + expand({ parsed, processEnv }) // only keys that start with prefix are exposed to client for (const [key, value] of Object.entries(parsed)) { diff --git a/patches/dotenv-expand@10.0.0.patch b/patches/dotenv-expand@10.0.0.patch deleted file mode 100644 index ae483e0f3d3c7c..00000000000000 --- a/patches/dotenv-expand@10.0.0.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/lib/main.js b/lib/main.js -index 79d973c22f06403bfee45ff122bd384841c30da8..9392de262140f8f336146bef2419794532e4170f 100644 ---- a/lib/main.js -+++ b/lib/main.js -@@ -69,9 +69,10 @@ function expand (config) { - ) - } - -- for (const processKey in config.parsed) { -- environment[processKey] = config.parsed[processKey] -- } -+ // PATCH: don't write to process.env -+ // for (const processKey in config.parsed) { -+ // environment[processKey] = config.parsed[processKey] -+ // } - - return config - } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b11b2a263ce6d0..0bcfb23744d3f8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,9 +13,6 @@ patchedDependencies: chokidar@3.6.0: hash: bckcfsslxcffppz65mxcq6naau path: patches/chokidar@3.6.0.patch - dotenv-expand@10.0.0: - hash: weuqf2vlv5b5g6cikeo4slurbm - path: patches/dotenv-expand@10.0.0.patch sirv@2.0.4: hash: amdes53ifqfntejkflpaq5ifce path: patches/sirv@2.0.4.patch @@ -319,8 +316,8 @@ importers: specifier: ^16.4.2 version: 16.4.2 dotenv-expand: - specifier: ^10.0.0 - version: 10.0.0(patch_hash=weuqf2vlv5b5g6cikeo4slurbm) + specifier: ^11.0.3 + version: 11.0.3 es-module-lexer: specifier: ^1.4.1 version: 1.4.1 @@ -5592,11 +5589,12 @@ packages: is-obj: 2.0.0 dev: true - /dotenv-expand@10.0.0(patch_hash=weuqf2vlv5b5g6cikeo4slurbm): - resolution: {integrity: sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==} + /dotenv-expand@11.0.3: + resolution: {integrity: sha512-qkK+MLTvZ86oq4sjMqGpUN/38SQ/J37mny88CsEUFFjb2MBVz06a809ri0QeVDXpxkvZkXzqjGUb0M1R6n3OGw==} engines: {node: '>=12'} + dependencies: + dotenv: 16.4.2 dev: true - patched: true /dotenv@16.4.2: resolution: {integrity: sha512-rZSSFxke7d9nYQ5NeMIwp5PP+f8wXgKNljpOb7KtH6SKW1cEqcXAz9VSJYVLKe7Jhup/gUYOkaeSVyK8GJ+nBg==}