vite 5.3.2 → 5.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/chunks/{dep-MsRcieA4.js → dep-CCo80PNg.js} +1 -1
- package/dist/node/chunks/{dep-Cti1d3iP.js → dep-CMeK12d_.js} +1 -1
- package/dist/node/chunks/{dep-C1-ZB6nQ.js → dep-D8YhmIY-.js} +25 -18
- package/dist/node/cli.js +5 -5
- package/dist/node/index.d.ts +18 -5
- package/dist/node/index.js +2 -2
- package/package.json +2 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { C as commonjsGlobal, B as getDefaultExportFromCjs } from './dep-D8YhmIY-.js';
|
2
2
|
import require$$0__default from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
@@ -36034,8 +36034,10 @@ function cssPostPlugin(config) {
|
|
36034
36034
|
source: content
|
36035
36035
|
});
|
36036
36036
|
generatedAssets.get(config).set(referenceId, { originalName: originalFilename });
|
36037
|
+
const filename = this.getFileName(referenceId);
|
36038
|
+
chunk.viteMetadata.importedAssets.add(cleanUrl(filename));
|
36037
36039
|
const replacement = toOutputFilePathInJS(
|
36038
|
-
|
36040
|
+
filename,
|
36039
36041
|
"asset",
|
36040
36042
|
chunk.fileName,
|
36041
36043
|
"js",
|
@@ -36576,8 +36578,8 @@ function createCachedImport(imp) {
|
|
36576
36578
|
return cached;
|
36577
36579
|
};
|
36578
36580
|
}
|
36579
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
36580
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
36581
|
+
const importPostcssImport = createCachedImport(() => import('./dep-CMeK12d_.js').then(function (n) { return n.i; }));
|
36582
|
+
const importPostcssModules = createCachedImport(() => import('./dep-CCo80PNg.js').then(function (n) { return n.i; }));
|
36581
36583
|
const importPostcss = createCachedImport(() => import('postcss'));
|
36582
36584
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
36583
36585
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -48309,18 +48311,18 @@ function webWorkerPlugin(config) {
|
|
48309
48311
|
// Using blob URL for SharedWorker results in multiple instances of a same worker
|
48310
48312
|
workerConstructor === "Worker" ? `${encodedJs}
|
48311
48313
|
const decodeBase64 = (base64) => Uint8Array.from(atob(base64), c => c.charCodeAt(0));
|
48312
|
-
const blob = typeof
|
48314
|
+
const blob = typeof self !== "undefined" && self.Blob && new Blob([${workerType === "classic" ? "" : (
|
48313
48315
|
// `URL` is always available, in `Worker[type="module"]`
|
48314
48316
|
`'URL.revokeObjectURL(import.meta.url);',`
|
48315
48317
|
)}decodeBase64(encodedJs)], { type: "text/javascript;charset=utf-8" });
|
48316
48318
|
export default function WorkerWrapper(options) {
|
48317
48319
|
let objURL;
|
48318
48320
|
try {
|
48319
|
-
objURL = blob && (
|
48321
|
+
objURL = blob && (self.URL || self.webkitURL).createObjectURL(blob);
|
48320
48322
|
if (!objURL) throw ''
|
48321
48323
|
const worker = new ${workerConstructor}(objURL, ${workerTypeOption});
|
48322
48324
|
worker.addEventListener("error", () => {
|
48323
|
-
(
|
48325
|
+
(self.URL || self.webkitURL).revokeObjectURL(objURL);
|
48324
48326
|
});
|
48325
48327
|
return worker;
|
48326
48328
|
} catch(e) {
|
@@ -48331,7 +48333,7 @@ function webWorkerPlugin(config) {
|
|
48331
48333
|
}${// For module workers, we should not revoke the URL until the worker runs,
|
48332
48334
|
// otherwise the worker fails to run
|
48333
48335
|
workerType === "classic" ? ` finally {
|
48334
|
-
objURL && (
|
48336
|
+
objURL && (self.URL || self.webkitURL).revokeObjectURL(objURL);
|
48335
48337
|
}` : ""}
|
48336
48338
|
}` : `${encodedJs}
|
48337
48339
|
export default function WorkerWrapper(options) {
|
@@ -48566,7 +48568,7 @@ function getWorkerType(raw, clean, i) {
|
|
48566
48568
|
return "classic";
|
48567
48569
|
}
|
48568
48570
|
const workerOpts = parseWorkerOptions(workerOptString, commaIndex + 1);
|
48569
|
-
if (workerOpts.type &&
|
48571
|
+
if (workerOpts.type && (workerOpts.type === "module" || workerOpts.type === "classic")) {
|
48570
48572
|
return workerOpts.type;
|
48571
48573
|
}
|
48572
48574
|
return "classic";
|
@@ -61826,9 +61828,17 @@ var httpProxy = httpProxy$2;
|
|
61826
61828
|
var httpProxy$1 = /*@__PURE__*/getDefaultExportFromCjs(httpProxy);
|
61827
61829
|
|
61828
61830
|
const debug$4 = createDebugger("vite:proxy");
|
61829
|
-
const
|
61830
|
-
if (options.
|
61831
|
+
const rewriteOriginHeader = (proxyReq, options, config) => {
|
61832
|
+
if (options.rewriteWsOrigin) {
|
61831
61833
|
const { target } = options;
|
61834
|
+
if (proxyReq.headersSent) {
|
61835
|
+
config.logger.warn(
|
61836
|
+
colors$1.yellow(
|
61837
|
+
`Unable to rewrite Origin header as headers are already sent.`
|
61838
|
+
)
|
61839
|
+
);
|
61840
|
+
return;
|
61841
|
+
}
|
61832
61842
|
if (proxyReq.getHeader("origin") && target) {
|
61833
61843
|
const changedOrigin = typeof target === "object" ? `${target.protocol}//${target.host}` : target;
|
61834
61844
|
proxyReq.setHeader("origin", changedOrigin);
|
@@ -61883,11 +61893,8 @@ ${err.stack}`, {
|
|
61883
61893
|
res.end();
|
61884
61894
|
}
|
61885
61895
|
});
|
61886
|
-
proxy.on("proxyReq", (proxyReq, req, res, options2) => {
|
61887
|
-
setOriginHeader(proxyReq, options2);
|
61888
|
-
});
|
61889
61896
|
proxy.on("proxyReqWs", (proxyReq, req, socket, options2, head) => {
|
61890
|
-
|
61897
|
+
rewriteOriginHeader(proxyReq, options2, config);
|
61891
61898
|
socket.on("error", (err) => {
|
61892
61899
|
config.logger.error(
|
61893
61900
|
`${colors$1.red(`ws proxy socket error:`)}
|
@@ -64803,7 +64810,7 @@ const preloadMarker = `__VITE_PRELOAD__`;
|
|
64803
64810
|
const preloadHelperId = "\0vite/preload-helper.js";
|
64804
64811
|
const preloadMarkerRE = new RegExp(preloadMarker, "g");
|
64805
64812
|
const dynamicImportPrefixRE = /import\s*\(/;
|
64806
|
-
const dynamicImportTreeshakenRE = /((?:\bconst\s+|\blet\s+|\bvar\s+|,\s*)(\{[^}.=]+\})\s*=\s*await\s+import\([^)]+\))|(\(\s*await\s+import\([^)]+\)\s*\)(\??\.[\w$]+))|\bimport\([^)]+\)(\s*\.then\(\s*(?:function\s*)?\(\s*\{([^}.=]+)\}\))/g;
|
64813
|
+
const dynamicImportTreeshakenRE = /((?:\bconst\s+|\blet\s+|\bvar\s+|,\s*)(\{[^{}.=]+\})\s*=\s*await\s+import\([^)]+\))|(\(\s*await\s+import\([^)]+\)\s*\)(\??\.[\w$]+))|\bimport\([^)]+\)(\s*\.then\(\s*(?:function\s*)?\(\s*\{([^{}.=]+)\}\))/g;
|
64807
64814
|
function toRelativePath(filename, importer) {
|
64808
64815
|
const relPath = path$m.posix.relative(path$m.posix.dirname(importer), filename);
|
64809
64816
|
return relPath[0] === "." ? relPath : `./${relPath}`;
|
@@ -65025,7 +65032,7 @@ function buildImportAnalysisPlugin(config) {
|
|
65025
65032
|
if (format !== "es") {
|
65026
65033
|
return;
|
65027
65034
|
}
|
65028
|
-
if (
|
65035
|
+
if (!insertPreload) {
|
65029
65036
|
const removedPureCssFiles = removedPureCssFilesCache.get(config);
|
65030
65037
|
if (removedPureCssFiles && removedPureCssFiles.size > 0) {
|
65031
65038
|
for (const file in bundle) {
|
@@ -65231,7 +65238,7 @@ function buildImportAnalysisPlugin(config) {
|
|
65231
65238
|
const fileDepsCode = `[${fileDeps.map(
|
65232
65239
|
(fileDep) => fileDep.runtime ? fileDep.url : JSON.stringify(fileDep.url)
|
65233
65240
|
).join(",")}]`;
|
65234
|
-
const mapDepsCode = `const
|
65241
|
+
const mapDepsCode = `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=${fileDepsCode})))=>i.map(i=>d[i]);
|
65235
65242
|
`;
|
65236
65243
|
if (code.startsWith("#!")) {
|
65237
65244
|
s.prependLeft(code.indexOf("\n") + 1, mapDepsCode);
|
@@ -65839,7 +65846,7 @@ function resolveBuildOutputs(outputs, libOptions, logger) {
|
|
65839
65846
|
);
|
65840
65847
|
}
|
65841
65848
|
outputs.forEach((output) => {
|
65842
|
-
if (
|
65849
|
+
if ((output.format === "umd" || output.format === "iife") && !output.name) {
|
65843
65850
|
throw new Error(
|
65844
65851
|
'Entries in "build.rollupOptions.output" must specify "name" when the format is "umd" or "iife".'
|
65845
65852
|
);
|
package/dist/node/cli.js
CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|
2
2
|
import fs__default from 'node:fs';
|
3
3
|
import { performance } from 'node:perf_hooks';
|
4
4
|
import { EventEmitter } from 'events';
|
5
|
-
import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-
|
5
|
+
import { A as colors, v as createLogger, r as resolveConfig } from './chunks/dep-D8YhmIY-.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -730,7 +730,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
730
730
|
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
731
731
|
).action(async (root, options) => {
|
732
732
|
filterDuplicateOptions(options);
|
733
|
-
const { createServer } = await import('./chunks/dep-
|
733
|
+
const { createServer } = await import('./chunks/dep-D8YhmIY-.js').then(function (n) { return n.E; });
|
734
734
|
try {
|
735
735
|
const server = await createServer({
|
736
736
|
root,
|
@@ -822,7 +822,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
822
822
|
`[boolean] force empty outDir when it's outside of root`
|
823
823
|
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).action(async (root, options) => {
|
824
824
|
filterDuplicateOptions(options);
|
825
|
-
const { build } = await import('./chunks/dep-
|
825
|
+
const { build } = await import('./chunks/dep-D8YhmIY-.js').then(function (n) { return n.F; });
|
826
826
|
const buildOptions = cleanOptions(options);
|
827
827
|
try {
|
828
828
|
await build({
|
@@ -851,7 +851,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
|
|
851
851
|
).action(
|
852
852
|
async (root, options) => {
|
853
853
|
filterDuplicateOptions(options);
|
854
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
854
|
+
const { optimizeDeps } = await import('./chunks/dep-D8YhmIY-.js').then(function (n) { return n.D; });
|
855
855
|
try {
|
856
856
|
const config = await resolveConfig(
|
857
857
|
{
|
@@ -877,7 +877,7 @@ ${e.stack}`),
|
|
877
877
|
cli.command("preview [root]", "locally preview production build").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--open [path]", `[boolean | string] open browser on startup`).option("--outDir <dir>", `[string] output directory (default: dist)`).action(
|
878
878
|
async (root, options) => {
|
879
879
|
filterDuplicateOptions(options);
|
880
|
-
const { preview } = await import('./chunks/dep-
|
880
|
+
const { preview } = await import('./chunks/dep-D8YhmIY-.js').then(function (n) { return n.G; });
|
881
881
|
try {
|
882
882
|
const server = await preview({
|
883
883
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -414,6 +414,7 @@ declare namespace HttpProxy {
|
|
414
414
|
* @param req - Client request.
|
415
415
|
* @param res - Client response.
|
416
416
|
* @param options - Additional options.
|
417
|
+
* @param callback - Error callback.
|
417
418
|
*/
|
418
419
|
web(
|
419
420
|
req: http.IncomingMessage,
|
@@ -428,6 +429,7 @@ declare namespace HttpProxy {
|
|
428
429
|
* @param socket - Client socket.
|
429
430
|
* @param head - Client head.
|
430
431
|
* @param options - Additional options.
|
432
|
+
* @param callback - Error callback.
|
431
433
|
*/
|
432
434
|
ws(
|
433
435
|
req: http.IncomingMessage,
|
@@ -618,6 +620,12 @@ interface ProxyOptions extends HttpProxy.ServerOptions {
|
|
618
620
|
* webpack-dev-server style bypass function
|
619
621
|
*/
|
620
622
|
bypass?: (req: http.IncomingMessage, res: http.ServerResponse, options: ProxyOptions) => void | null | undefined | false | string;
|
623
|
+
/**
|
624
|
+
* rewrite the Origin header of a WebSocket request to match the the target
|
625
|
+
*
|
626
|
+
* **Exercise caution as rewriting the Origin can leave the proxying open to [CSRF attacks](https://owasp.org/www-community/attacks/csrf).**
|
627
|
+
*/
|
628
|
+
rewriteWsOrigin?: boolean | undefined;
|
621
629
|
}
|
622
630
|
|
623
631
|
type LogType = 'error' | 'warn' | 'info';
|
@@ -2090,6 +2098,9 @@ interface RollupDynamicImportVarsOptions {
|
|
2090
2098
|
declare namespace Terser {
|
2091
2099
|
export type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
|
2092
2100
|
|
2101
|
+
export type ConsoleProperty = keyof typeof console
|
2102
|
+
type DropConsoleOption = boolean | ConsoleProperty[]
|
2103
|
+
|
2093
2104
|
export interface ParseOptions {
|
2094
2105
|
bare_returns?: boolean
|
2095
2106
|
/** @deprecated legacy option. Currently, all supported EcmaScript is valid to parse. */
|
@@ -2110,7 +2121,7 @@ declare namespace Terser {
|
|
2110
2121
|
dead_code?: boolean
|
2111
2122
|
defaults?: boolean
|
2112
2123
|
directives?: boolean
|
2113
|
-
drop_console?:
|
2124
|
+
drop_console?: DropConsoleOption
|
2114
2125
|
drop_debugger?: boolean
|
2115
2126
|
ecma?: ECMA
|
2116
2127
|
evaluate?: boolean
|
@@ -2133,6 +2144,7 @@ declare namespace Terser {
|
|
2133
2144
|
passes?: number
|
2134
2145
|
properties?: boolean
|
2135
2146
|
pure_funcs?: string[]
|
2147
|
+
pure_new?: boolean
|
2136
2148
|
pure_getters?: boolean | 'strict'
|
2137
2149
|
reduce_funcs?: boolean
|
2138
2150
|
reduce_vars?: boolean
|
@@ -2182,7 +2194,7 @@ declare namespace Terser {
|
|
2182
2194
|
* Obtains the nth most favored (usually shortest) identifier to rename a variable to.
|
2183
2195
|
* The mangler will increment n and retry until the return value is not in use in scope, and is not a reserved word.
|
2184
2196
|
* This function is expected to be stable; Evaluating get(n) === get(n) should always return true.
|
2185
|
-
* @param n
|
2197
|
+
* @param n The ordinal of the identifier.
|
2186
2198
|
*/
|
2187
2199
|
get(n: number): string
|
2188
2200
|
}
|
@@ -2194,8 +2206,8 @@ declare namespace Terser {
|
|
2194
2206
|
/**
|
2195
2207
|
* Modifies the internal weighting of the input characters by the specified delta.
|
2196
2208
|
* Will be invoked on the entire printed AST, and then deduct mangleable identifiers.
|
2197
|
-
* @param chars
|
2198
|
-
* @param delta
|
2209
|
+
* @param chars The characters to modify the weighting of.
|
2210
|
+
* @param delta The numeric weight to add to the characters.
|
2199
2211
|
*/
|
2200
2212
|
consider(chars: string, delta: number): number
|
2201
2213
|
/**
|
@@ -2278,7 +2290,7 @@ declare namespace Terser {
|
|
2278
2290
|
module?: boolean
|
2279
2291
|
nameCache?: object
|
2280
2292
|
format?: FormatOptions
|
2281
|
-
/** @deprecated
|
2293
|
+
/** @deprecated */
|
2282
2294
|
output?: FormatOptions
|
2283
2295
|
parse?: ParseOptions
|
2284
2296
|
safari10?: boolean
|
@@ -2298,6 +2310,7 @@ declare namespace Terser {
|
|
2298
2310
|
includeSources?: boolean
|
2299
2311
|
filename?: string
|
2300
2312
|
root?: string
|
2313
|
+
asObject?: boolean
|
2301
2314
|
url?: string | 'inline'
|
2302
2315
|
}
|
2303
2316
|
}
|
package/dist/node/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { parseAst, parseAstAsync } from 'rollup/parseAst';
|
2
|
-
import { i as isInNodeModules, a as arraify } from './chunks/dep-
|
3
|
-
export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-D8YhmIY-.js';
|
3
|
+
export { b as build, g as buildErrorMessage, k as createFilter, v as createLogger, c as createServer, d as defineConfig, h as fetchModule, f as formatPostcssSourceMap, x as isFileServingAllowed, l as loadConfigFromFile, y as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, e as preprocessCSS, p as preview, r as resolveConfig, z as resolveEnvPrefix, q as rollupVersion, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-D8YhmIY-.js';
|
4
4
|
export { VERSION as version } from './constants.js';
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
6
|
import { existsSync, readFileSync } from 'node:fs';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite",
|
3
|
-
"version": "5.3.
|
3
|
+
"version": "5.3.4",
|
4
4
|
"type": "module",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Evan You",
|
@@ -73,7 +73,7 @@
|
|
73
73
|
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
74
74
|
"dependencies": {
|
75
75
|
"esbuild": "^0.21.3",
|
76
|
-
"postcss": "^8.4.
|
76
|
+
"postcss": "^8.4.39",
|
77
77
|
"rollup": "^4.13.0"
|
78
78
|
},
|
79
79
|
"optionalDependencies": {
|