Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"@vercel/detect-agent": "^1.2.3",
"@vitejs/devtools": "^0.3.3",
"@vitest/utils": "4.1.8",
"@voidzero-dev/vite-task-client": "^0.1.1",
"@voidzero-dev/vite-task-client": "^0.2.0",
"artichokie": "^0.4.3",
"baseline-browser-mapping": "^2.10.37",
"cac": "^7.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/vite/src/node/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ export function loadEnv(
}

// Vite Task may know prefixed envs not present here; fetch them and let
// the runner record each glob in the build's cache key.
// the runner record each prefix in the build's cache key.
for (const prefix of prefixes) {
Object.assign(env, getEnvs(`${prefix}*`))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using prefix, should we escape * like FOO\*BAR* (prefix is FOO*BAR in this case)?
That would be more expressive and can support suffix or wildcard in the middle.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered escaping on the Vite side, but that would require Vite to be aware of the full glob syntax supported by Vite Task (currently it's https://docs.rs/globset/0.4.18/globset/#syntax) and escape all the metacharacters correctly.

I think it's better to just let Vite express the intent here ("getting envs with this prefix"). Then Vite Task can handle the escaping internally alongside the glob implementation. That also leaves room for Vite Task to change the underlying matcher later, for example escaping to regex instead of glob, without breaking anything.

Object.assign(env, getEnvs({ prefix }))
}

// check if there are actual env variables starting with VITE_*
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.