vite 6.0.0-alpha.23 → 6.0.0-alpha.24
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-Crhy8pEa.js → dep-ByEd0NXO.js} +133 -143
- package/dist/node/chunks/{dep-DuPPQ7KX.js → dep-hyosMzMD.js} +1 -1
- package/dist/node/chunks/{dep-M7bVrye1.js → dep-yUJ1DpJ5.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/index.d.ts +41 -45
- package/dist/node/index.js +2 -2
- package/dist/node/module-runner.d.ts +0 -1
- package/dist/node/module-runner.js +0 -10
- package/dist/node-cjs/publicUtils.cjs +3 -2
- package/index.cjs +27 -2
- package/package.json +4 -4
@@ -18284,8 +18284,8 @@ function pattern2regex(resolvedPattern, allowJs) {
|
|
18284
18284
|
function replaceTokens(tsconfig, configDir) {
|
18285
18285
|
return JSON.parse(
|
18286
18286
|
JSON.stringify(tsconfig)
|
18287
|
-
// replace ${configDir}
|
18288
|
-
.replaceAll(/"
|
18287
|
+
// replace ${configDir}
|
18288
|
+
.replaceAll(/"\${configDir}/g, `"${native2posix(configDir)}`)
|
18289
18289
|
);
|
18290
18290
|
}
|
18291
18291
|
|
@@ -18879,7 +18879,7 @@ function rebaseRelative(key, value, prependPath) {
|
|
18879
18879
|
* @returns {string}
|
18880
18880
|
*/
|
18881
18881
|
function rebasePath(value, prependPath) {
|
18882
|
-
if (path$n.isAbsolute(value)) {
|
18882
|
+
if (path$n.isAbsolute(value) || value.startsWith('${configDir}')) {
|
18883
18883
|
return value;
|
18884
18884
|
} else {
|
18885
18885
|
// relative paths use posix syntax in tsconfig
|
@@ -20272,7 +20272,8 @@ function assetPlugin(config) {
|
|
20272
20272
|
code: `export default ${JSON.stringify(encodeURIPath(url))}`,
|
20273
20273
|
// Force rollup to keep this module from being shared between other entry points if it's an entrypoint.
|
20274
20274
|
// If the resulting chunk is empty, it will be removed in generateBundle.
|
20275
|
-
moduleSideEffects: config.command === "build" && this.getModuleInfo(id)?.isEntry ? "no-treeshake" : false
|
20275
|
+
moduleSideEffects: config.command === "build" && this.getModuleInfo(id)?.isEntry ? "no-treeshake" : false,
|
20276
|
+
meta: config.command === "build" ? { "vite:asset": true } : void 0
|
20276
20277
|
};
|
20277
20278
|
},
|
20278
20279
|
renderChunk(code, chunk, opts) {
|
@@ -20289,7 +20290,7 @@ function assetPlugin(config) {
|
|
20289
20290
|
generateBundle(_, bundle) {
|
20290
20291
|
for (const file in bundle) {
|
20291
20292
|
const chunk = bundle[file];
|
20292
|
-
if (chunk.type === "chunk" && chunk.isEntry && chunk.moduleIds.length === 1 && config.assetsInclude(chunk.moduleIds[0])) {
|
20293
|
+
if (chunk.type === "chunk" && chunk.isEntry && chunk.moduleIds.length === 1 && config.assetsInclude(chunk.moduleIds[0]) && this.getModuleInfo(chunk.moduleIds[0])?.meta["vite:asset"]) {
|
20293
20294
|
delete bundle[file];
|
20294
20295
|
}
|
20295
20296
|
}
|
@@ -35884,6 +35885,12 @@ function esbuildCjsExternalPlugin(externals, platform) {
|
|
35884
35885
|
};
|
35885
35886
|
}
|
35886
35887
|
|
35888
|
+
const environmentColors = [
|
35889
|
+
colors$1.blue,
|
35890
|
+
colors$1.magenta,
|
35891
|
+
colors$1.green,
|
35892
|
+
colors$1.gray
|
35893
|
+
];
|
35887
35894
|
class PartialEnvironment {
|
35888
35895
|
name;
|
35889
35896
|
getTopLevelConfig() {
|
@@ -35983,12 +35990,6 @@ class BaseEnvironment extends PartialEnvironment {
|
|
35983
35990
|
super(name, config, options);
|
35984
35991
|
}
|
35985
35992
|
}
|
35986
|
-
const environmentColors = [
|
35987
|
-
colors$1.blue,
|
35988
|
-
colors$1.magenta,
|
35989
|
-
colors$1.green,
|
35990
|
-
colors$1.gray
|
35991
|
-
];
|
35992
35993
|
|
35993
35994
|
// Copyright 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Simon Lydell
|
35994
35995
|
// License: MIT.
|
@@ -38124,8 +38125,8 @@ async function extractExportsData(environment, filePath) {
|
|
38124
38125
|
};
|
38125
38126
|
return exportsData;
|
38126
38127
|
}
|
38127
|
-
function needsInterop(
|
38128
|
-
if (
|
38128
|
+
function needsInterop(environment, id, exportsData, output) {
|
38129
|
+
if (environment.config.dev.optimizeDeps?.needsInterop?.includes(id)) {
|
38129
38130
|
return true;
|
38130
38131
|
}
|
38131
38132
|
const { hasModuleSyntax, exports } = exportsData;
|
@@ -39028,26 +39029,24 @@ function resolveEnvPrefix({
|
|
39028
39029
|
|
39029
39030
|
const docsURL = "https://deploy-preview-16471--vite-docs-main.netlify.app";
|
39030
39031
|
const deprecationCode = {
|
39031
|
-
|
39032
|
-
|
39033
|
-
|
39034
|
-
|
39035
|
-
|
39036
|
-
|
39032
|
+
removePluginHookSsrArgument: "changes/this-environment-in-hooks",
|
39033
|
+
removePluginHookHandleHotUpdate: "changes/hotupdate-hook",
|
39034
|
+
removeServerModuleGraph: "changes/per-environment-apis",
|
39035
|
+
removeServerHot: "changes/per-environment-apis",
|
39036
|
+
removeServerTransformRequest: "changes/per-environment-apis",
|
39037
|
+
removeSsrLoadModule: "changes/ssr-using-modulerunner"
|
39037
39038
|
};
|
39038
39039
|
const deprecationMessages = {
|
39039
|
-
|
39040
|
-
|
39041
|
-
|
39042
|
-
|
39043
|
-
|
39044
|
-
|
39040
|
+
removePluginHookSsrArgument: "Plugin hook `options.ssr` is replaced with `this.environment.config.consumer === 'server'`.",
|
39041
|
+
removePluginHookHandleHotUpdate: "Plugin hook `handleHotUpdate()` is replaced with `hotUpdate()`.",
|
39042
|
+
removeServerModuleGraph: "The `server.moduleGraph` is replaced with `this.environment.moduleGraph`.",
|
39043
|
+
removeServerHot: "The `server.hot` is replaced with `this.environment.hot`.",
|
39044
|
+
removeServerTransformRequest: "The `server.transformRequest` is replaced with `this.environment.transformRequest`.",
|
39045
|
+
removeSsrLoadModule: "The `server.ssrLoadModule` is replaced with Environment Runner."
|
39045
39046
|
};
|
39046
39047
|
let _ignoreDeprecationWarnings = false;
|
39047
39048
|
function warnFutureDeprecation(config, type, extraMessage, stacktrace = true) {
|
39048
|
-
if (_ignoreDeprecationWarnings)
|
39049
|
-
if (!config.future?.deprecationWarnings) return;
|
39050
|
-
if (config.future.deprecationWarnings !== true && !config.future.deprecationWarnings[type])
|
39049
|
+
if (_ignoreDeprecationWarnings || !config.future || config.future[type] !== "warn")
|
39051
39050
|
return;
|
39052
39051
|
let msg = `[vite future] ${deprecationMessages[type]}`;
|
39053
39052
|
if (extraMessage) {
|
@@ -46464,45 +46463,6 @@ Object.defineProperty(${ssrModuleExportsKey}, "default", { enumerable: true, con
|
|
46464
46463
|
dynamicDeps: [...dynamicDeps]
|
46465
46464
|
};
|
46466
46465
|
}
|
46467
|
-
async function ssrParseImports(url, code) {
|
46468
|
-
let ast;
|
46469
|
-
try {
|
46470
|
-
ast = await parseAstAsync(code);
|
46471
|
-
} catch (err) {
|
46472
|
-
if (!err.loc || !err.loc.line) throw err;
|
46473
|
-
const line = err.loc.line;
|
46474
|
-
throw new Error(
|
46475
|
-
`Parse failure: ${err.message}
|
46476
|
-
At file: ${url}
|
46477
|
-
Contents of line ${line}: ${code.split("\n")[line - 1]}`
|
46478
|
-
);
|
46479
|
-
}
|
46480
|
-
const imports = [];
|
46481
|
-
walk$1(ast, {
|
46482
|
-
enter(_n, parent) {
|
46483
|
-
if (_n.type !== "Identifier") return;
|
46484
|
-
const node = _n;
|
46485
|
-
const isStaticImport = node.name === ssrImportKey;
|
46486
|
-
const isDynamicImport = node.name === ssrDynamicImportKey;
|
46487
|
-
if (isStaticImport || isDynamicImport) {
|
46488
|
-
const importExpression = parent;
|
46489
|
-
const importLiteral = importExpression.arguments[0];
|
46490
|
-
imports.push({
|
46491
|
-
n: importLiteral.value,
|
46492
|
-
s: importLiteral.start,
|
46493
|
-
e: importLiteral.end,
|
46494
|
-
se: importExpression.start,
|
46495
|
-
ss: importExpression.end,
|
46496
|
-
t: isStaticImport ? 2 : 1,
|
46497
|
-
d: isDynamicImport ? importLiteral.start : -1,
|
46498
|
-
a: -1
|
46499
|
-
// not used
|
46500
|
-
});
|
46501
|
-
}
|
46502
|
-
}
|
46503
|
-
});
|
46504
|
-
return imports;
|
46505
|
-
}
|
46506
46466
|
const isNodeInPatternWeakSet = /* @__PURE__ */ new WeakSet();
|
46507
46467
|
const setIsNodeInPattern = (node) => isNodeInPatternWeakSet.add(node);
|
46508
46468
|
const isNodeInPattern = (node) => isNodeInPatternWeakSet.has(node);
|
@@ -55690,7 +55650,8 @@ function servePublicMiddleware(server, publicFiles) {
|
|
55690
55650
|
return normalizePath$3(filePath);
|
55691
55651
|
};
|
55692
55652
|
return function viteServePublicMiddleware(req, res, next) {
|
55693
|
-
if (publicFiles && !publicFiles.has(toFilePath(req.url)) || isImportRequest(req.url) || isInternalRequest(req.url)
|
55653
|
+
if (publicFiles && !publicFiles.has(toFilePath(req.url)) || isImportRequest(req.url) || isInternalRequest(req.url) || // for `/public-file.js?url` to be transformed
|
55654
|
+
urlRE.test(req.url)) {
|
55694
55655
|
return next();
|
55695
55656
|
}
|
55696
55657
|
serve(req, res, next);
|
@@ -55766,8 +55727,9 @@ function serveRawFsMiddleware(server) {
|
|
55766
55727
|
}
|
55767
55728
|
};
|
55768
55729
|
}
|
55769
|
-
function isFileServingAllowed(
|
55770
|
-
const
|
55730
|
+
function isFileServingAllowed(configOrUrl, urlOrServer) {
|
55731
|
+
const config = typeof urlOrServer === "string" ? configOrUrl : urlOrServer.config;
|
55732
|
+
const url = typeof urlOrServer === "string" ? urlOrServer : configOrUrl;
|
55771
55733
|
if (!config.server.fs.strict) return true;
|
55772
55734
|
const filePath = fsPathFromUrl(url);
|
55773
55735
|
return isFileLoadingAllowed(config, filePath);
|
@@ -56059,15 +56021,13 @@ async function handleModuleSoftInvalidation(environment, mod, timestamp) {
|
|
56059
56021
|
);
|
56060
56022
|
}
|
56061
56023
|
let result;
|
56062
|
-
if (
|
56024
|
+
if (transformResult.ssr) {
|
56063
56025
|
result = transformResult;
|
56064
56026
|
} else {
|
56027
|
+
await init;
|
56065
56028
|
const source = transformResult.code;
|
56066
56029
|
const s = new MagicString(source);
|
56067
|
-
const imports =
|
56068
|
-
await init;
|
56069
|
-
return parse$d(source, mod.id || void 0)[0];
|
56070
|
-
})();
|
56030
|
+
const [imports] = parse$d(source, mod.id || void 0);
|
56071
56031
|
for (const imp of imports) {
|
56072
56032
|
let rawUrl = source.slice(imp.s, imp.e);
|
56073
56033
|
if (rawUrl === "import.meta") continue;
|
@@ -56247,6 +56207,9 @@ function nodeIsElement(node) {
|
|
56247
56207
|
return node.nodeName[0] !== "#";
|
56248
56208
|
}
|
56249
56209
|
function traverseNodes(node, visitor) {
|
56210
|
+
if (node.nodeName === "template") {
|
56211
|
+
node = node.content;
|
56212
|
+
}
|
56250
56213
|
visitor(node);
|
56251
56214
|
if (nodeIsElement(node) || node.nodeName === "#document" || node.nodeName === "#document-fragment") {
|
56252
56215
|
node.childNodes.forEach((childNode) => traverseNodes(childNode, visitor));
|
@@ -58437,7 +58400,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
58437
58400
|
environments,
|
58438
58401
|
pluginContainer,
|
58439
58402
|
get moduleGraph() {
|
58440
|
-
warnFutureDeprecation(config, "
|
58403
|
+
warnFutureDeprecation(config, "removeServerModuleGraph");
|
58441
58404
|
return moduleGraph;
|
58442
58405
|
},
|
58443
58406
|
set moduleGraph(graph) {
|
@@ -58456,7 +58419,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
58456
58419
|
transformRequest(url, options2) {
|
58457
58420
|
warnFutureDeprecation(
|
58458
58421
|
config,
|
58459
|
-
"
|
58422
|
+
"removeServerTransformRequest",
|
58460
58423
|
"server.transformRequest() is deprecated. Use environment.transformRequest() instead."
|
58461
58424
|
);
|
58462
58425
|
const environment = server.environments[options2?.ssr ? "ssr" : "client"];
|
@@ -58480,7 +58443,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
58480
58443
|
return devHtmlTransformFn(server, url, html, originalUrl);
|
58481
58444
|
},
|
58482
58445
|
async ssrLoadModule(url, opts) {
|
58483
|
-
warnFutureDeprecation(config, "
|
58446
|
+
warnFutureDeprecation(config, "removeSsrLoadModule");
|
58484
58447
|
return ssrLoadModule(url, server, opts?.fixStacktrace);
|
58485
58448
|
},
|
58486
58449
|
ssrFixStacktrace(e) {
|
@@ -58500,16 +58463,6 @@ async function _createServer(inlineConfig = {}, options) {
|
|
58500
58463
|
);
|
58501
58464
|
}
|
58502
58465
|
},
|
58503
|
-
async reloadEnvironmentModule(module) {
|
58504
|
-
if (serverConfig.hmr !== false && module.file) {
|
58505
|
-
updateModules(
|
58506
|
-
environments[module.environment],
|
58507
|
-
module.file,
|
58508
|
-
[module],
|
58509
|
-
Date.now()
|
58510
|
-
);
|
58511
|
-
}
|
58512
|
-
},
|
58513
58466
|
async listen(port, isRestart) {
|
58514
58467
|
await startServer(server, port);
|
58515
58468
|
if (httpServer) {
|
@@ -59072,7 +59025,7 @@ async function handleHMRUpdate(type, file, server) {
|
|
59072
59025
|
} else if (type === "update") {
|
59073
59026
|
warnFutureDeprecation(
|
59074
59027
|
config,
|
59075
|
-
"
|
59028
|
+
"removePluginHookHandleHotUpdate",
|
59076
59029
|
`Used in plugin "${plugin.name}".`,
|
59077
59030
|
false
|
59078
59031
|
);
|
@@ -60165,6 +60118,25 @@ const templateLiteralRE = /^\s*`(.*)`\s*$/;
|
|
60165
60118
|
function isExplicitImportRequired(url) {
|
60166
60119
|
return !isJSRequest(url) && !isCSSRequest(url);
|
60167
60120
|
}
|
60121
|
+
function normalizeResolvedIdToUrl(environment, url, resolved) {
|
60122
|
+
const root = environment.config.root;
|
60123
|
+
const depsOptimizer = environment.depsOptimizer;
|
60124
|
+
const fsUtils = getFsUtils(environment.getTopLevelConfig());
|
60125
|
+
if (resolved.id.startsWith(withTrailingSlash(root))) {
|
60126
|
+
url = resolved.id.slice(root.length);
|
60127
|
+
} else if (depsOptimizer?.isOptimizedDepFile(resolved.id) || // vite-plugin-react isn't following the leading \0 virtual module convention.
|
60128
|
+
// This is a temporary hack to avoid expensive fs checks for React apps.
|
60129
|
+
// We'll remove this as soon we're able to fix the react plugins.
|
60130
|
+
resolved.id !== "/@react-refresh" && path$n.isAbsolute(resolved.id) && fsUtils.existsSync(cleanUrl(resolved.id))) {
|
60131
|
+
url = path$n.posix.join(FS_PREFIX, resolved.id);
|
60132
|
+
} else {
|
60133
|
+
url = resolved.id;
|
60134
|
+
}
|
60135
|
+
if (url[0] !== "." && url[0] !== "/") {
|
60136
|
+
url = wrapId$1(resolved.id);
|
60137
|
+
}
|
60138
|
+
return url;
|
60139
|
+
}
|
60168
60140
|
function extractImportedBindings(id, source, importSpec, importedBindings) {
|
60169
60141
|
let bindings = importedBindings.get(id);
|
60170
60142
|
if (!bindings) {
|
@@ -60209,7 +60181,6 @@ function extractImportedBindings(id, source, importSpec, importedBindings) {
|
|
60209
60181
|
}
|
60210
60182
|
function importAnalysisPlugin(config) {
|
60211
60183
|
const { root, base } = config;
|
60212
|
-
const fsUtils = getFsUtils(config);
|
60213
60184
|
const clientPublicPath = path$n.posix.join(base, CLIENT_PUBLIC_PATH);
|
60214
60185
|
const enablePartialAccept = config.experimental?.hmrPartialAccept;
|
60215
60186
|
const matchAlias = getAliasPatternMatcher(config.resolve.alias);
|
@@ -60316,20 +60287,8 @@ function importAnalysisPlugin(config) {
|
|
60316
60287
|
}
|
60317
60288
|
const isRelative = url[0] === ".";
|
60318
60289
|
const isSelfImport = !isRelative && cleanUrl(url) === cleanUrl(importer);
|
60319
|
-
|
60320
|
-
|
60321
|
-
} else if (depsOptimizer?.isOptimizedDepFile(resolved.id) || // vite-plugin-react isn't following the leading \0 virtual module convention.
|
60322
|
-
// This is a temporary hack to avoid expensive fs checks for React apps.
|
60323
|
-
// We'll remove this as soon we're able to fix the react plugins.
|
60324
|
-
resolved.id !== "/@react-refresh" && path$n.isAbsolute(resolved.id) && fsUtils.existsSync(cleanUrl(resolved.id))) {
|
60325
|
-
url = path$n.posix.join(FS_PREFIX, resolved.id);
|
60326
|
-
} else {
|
60327
|
-
url = resolved.id;
|
60328
|
-
}
|
60329
|
-
if (url[0] !== "." && url[0] !== "/") {
|
60330
|
-
url = wrapId$1(resolved.id);
|
60331
|
-
}
|
60332
|
-
if (environment.config.injectInvalidationTimestamp) {
|
60290
|
+
url = normalizeResolvedIdToUrl(environment, url, resolved);
|
60291
|
+
if (environment.config.consumer === "client") {
|
60333
60292
|
if (isExplicitImportRequired(url)) {
|
60334
60293
|
url = injectQuery(url, "import");
|
60335
60294
|
} else if ((isRelative || isSelfImport) && !DEP_VERSION_RE.test(url)) {
|
@@ -63006,12 +62965,8 @@ function createCSSResolvers(config) {
|
|
63006
62965
|
preferRelative: true
|
63007
62966
|
});
|
63008
62967
|
sassResolve = async (...args) => {
|
63009
|
-
|
63010
|
-
|
63011
|
-
const fileUrl = new URL(id);
|
63012
|
-
if (fs__default.existsSync(fileUrl)) {
|
63013
|
-
return fileURLToPath(fileUrl);
|
63014
|
-
}
|
62968
|
+
if (args[1].startsWith("file://")) {
|
62969
|
+
args[1] = fileURLToPath(args[1]);
|
63015
62970
|
}
|
63016
62971
|
return resolver(...args);
|
63017
62972
|
};
|
@@ -63326,8 +63281,8 @@ function createCachedImport(imp) {
|
|
63326
63281
|
return cached;
|
63327
63282
|
};
|
63328
63283
|
}
|
63329
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
63330
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
63284
|
+
const importPostcssImport = createCachedImport(() => import('./dep-hyosMzMD.js').then(function (n) { return n.i; }));
|
63285
|
+
const importPostcssModules = createCachedImport(() => import('./dep-yUJ1DpJ5.js').then(function (n) { return n.i; }));
|
63331
63286
|
const importPostcss = createCachedImport(() => import('postcss'));
|
63332
63287
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
63333
63288
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -63678,7 +63633,7 @@ function fixScssBugImportValue(data) {
|
|
63678
63633
|
}
|
63679
63634
|
return data;
|
63680
63635
|
}
|
63681
|
-
const makeScssWorker = (environment, resolvers, alias, maxWorkers) => {
|
63636
|
+
const makeScssWorker = (environment, resolvers, alias, maxWorkers, packageName) => {
|
63682
63637
|
const internalImporter = async (url, importer, filename) => {
|
63683
63638
|
importer = cleanScssBugUrl(importer);
|
63684
63639
|
const resolved = await resolvers.sass(environment, url, importer);
|
@@ -63692,6 +63647,9 @@ const makeScssWorker = (environment, resolvers, alias, maxWorkers) => {
|
|
63692
63647
|
"$",
|
63693
63648
|
resolvers.sass
|
63694
63649
|
);
|
63650
|
+
if (packageName === "sass-embedded") {
|
63651
|
+
return data;
|
63652
|
+
}
|
63695
63653
|
return fixScssBugImportValue(data);
|
63696
63654
|
} catch (data) {
|
63697
63655
|
return data;
|
@@ -63912,7 +63870,8 @@ const scssProcessor = (maxWorkers) => {
|
|
63912
63870
|
environment,
|
63913
63871
|
resolvers,
|
63914
63872
|
options.alias,
|
63915
|
-
maxWorkers
|
63873
|
+
maxWorkers,
|
63874
|
+
sassPackage.name
|
63916
63875
|
)
|
63917
63876
|
);
|
63918
63877
|
}
|
@@ -63935,6 +63894,11 @@ const scssProcessor = (maxWorkers) => {
|
|
63935
63894
|
);
|
63936
63895
|
const deps = result.stats.includedFiles.map((f) => cleanScssBugUrl(f));
|
63937
63896
|
const map2 = result.map ? JSON.parse(result.map.toString()) : void 0;
|
63897
|
+
if (map2) {
|
63898
|
+
map2.sources = map2.sources.map(
|
63899
|
+
(url) => url.startsWith("file://") ? normalizePath$3(fileURLToPath(url)) : url
|
63900
|
+
);
|
63901
|
+
}
|
63938
63902
|
return {
|
63939
63903
|
code: result.css.toString(),
|
63940
63904
|
map: map2,
|
@@ -64509,8 +64473,8 @@ function preload(baseModule, deps, importerUrl) {
|
|
64509
64473
|
link.rel = isCss ? "stylesheet" : scriptRel;
|
64510
64474
|
if (!isCss) {
|
64511
64475
|
link.as = "script";
|
64512
|
-
link.crossOrigin = "";
|
64513
64476
|
}
|
64477
|
+
link.crossOrigin = "";
|
64514
64478
|
link.href = dep;
|
64515
64479
|
if (cspNonce) {
|
64516
64480
|
link.setAttribute("nonce", cspNonce);
|
@@ -65029,7 +64993,7 @@ function ssrManifestPlugin() {
|
|
65029
64993
|
|
65030
64994
|
function buildLoadFallbackPlugin() {
|
65031
64995
|
return {
|
65032
|
-
name: "vite:
|
64996
|
+
name: "vite:load-fallback",
|
65033
64997
|
async load(id) {
|
65034
64998
|
try {
|
65035
64999
|
const cleanedId = cleanUrl(id);
|
@@ -65963,7 +65927,7 @@ async function fetchModule(environment, url, importer, options = {}) {
|
|
65963
65927
|
if (isExternalUrl(url)) {
|
65964
65928
|
return { externalize: url, type: "network" };
|
65965
65929
|
}
|
65966
|
-
if (url[0] !== "." && url[0] !== "/") {
|
65930
|
+
if (importer && url[0] !== "." && url[0] !== "/") {
|
65967
65931
|
const { isProduction, root } = environment.config;
|
65968
65932
|
const { externalConditions, dedupe, preserveSymlinks } = environment.config.resolve;
|
65969
65933
|
const resolved = tryNodeResolve(
|
@@ -66004,6 +65968,13 @@ async function fetchModule(environment, url, importer, options = {}) {
|
|
66004
65968
|
const type = isFilePathESM(resolved.id, environment.config.packageCache) ? "module" : "commonjs";
|
66005
65969
|
return { externalize: file, type };
|
66006
65970
|
}
|
65971
|
+
if (!importer) {
|
65972
|
+
const resolved = await environment.pluginContainer.resolveId(url);
|
65973
|
+
if (!resolved) {
|
65974
|
+
throw new Error(`[vite] cannot find entry point module '${url}'.`);
|
65975
|
+
}
|
65976
|
+
url = normalizeResolvedIdToUrl(environment, url, resolved);
|
65977
|
+
}
|
66007
65978
|
url = unwrapId$1(url);
|
66008
65979
|
let mod = await environment.moduleGraph.getModuleByUrl(url);
|
66009
65980
|
const cached = !!mod?.transformResult;
|
@@ -67008,11 +66979,18 @@ class DevEnvironment extends BaseEnvironment {
|
|
67008
66979
|
...options
|
67009
66980
|
});
|
67010
66981
|
}
|
66982
|
+
async reloadModule(module) {
|
66983
|
+
if (this.config.server.hmr !== false && module.file) {
|
66984
|
+
updateModules(this, module.file, [module], Date.now());
|
66985
|
+
}
|
66986
|
+
}
|
67011
66987
|
transformRequest(url) {
|
67012
66988
|
return transformRequest(this, url);
|
67013
66989
|
}
|
67014
66990
|
async warmupRequest(url) {
|
67015
|
-
|
66991
|
+
try {
|
66992
|
+
await this.transformRequest(url);
|
66993
|
+
} catch (e) {
|
67016
66994
|
if (e?.code === ERR_OUTDATED_OPTIMIZED_DEP || e?.code === ERR_CLOSED_SERVER) {
|
67017
66995
|
return;
|
67018
66996
|
}
|
@@ -67020,7 +66998,7 @@ class DevEnvironment extends BaseEnvironment {
|
|
67020
66998
|
error: e,
|
67021
66999
|
timestamp: true
|
67022
67000
|
});
|
67023
|
-
}
|
67001
|
+
}
|
67024
67002
|
}
|
67025
67003
|
async close() {
|
67026
67004
|
this._closing = true;
|
@@ -67112,14 +67090,14 @@ function setupOnCrawlEnd(onCrawlEnd) {
|
|
67112
67090
|
if (ignoredId) {
|
67113
67091
|
seenIds.add(ignoredId);
|
67114
67092
|
markIdAsDone(ignoredId);
|
67093
|
+
} else {
|
67094
|
+
checkIfCrawlEndAfterTimeout();
|
67115
67095
|
}
|
67116
67096
|
return onCrawlEndPromiseWithResolvers.promise;
|
67117
67097
|
}
|
67118
67098
|
function markIdAsDone(id) {
|
67119
|
-
|
67120
|
-
|
67121
|
-
checkIfCrawlEndAfterTimeout();
|
67122
|
-
}
|
67099
|
+
registeredIds.delete(id);
|
67100
|
+
checkIfCrawlEndAfterTimeout();
|
67123
67101
|
}
|
67124
67102
|
function checkIfCrawlEndAfterTimeout() {
|
67125
67103
|
if (cancelled || registeredIds.size > 0) return;
|
@@ -67141,6 +67119,11 @@ function setupOnCrawlEnd(onCrawlEnd) {
|
|
67141
67119
|
}
|
67142
67120
|
|
67143
67121
|
function createNodeDevEnvironment(name, config, context) {
|
67122
|
+
if (context.hot == null) {
|
67123
|
+
throw new Error(
|
67124
|
+
"`hot` is a required option. Either explicitly opt out of HMR by setting `hot: false` or provide a hot channel."
|
67125
|
+
);
|
67126
|
+
}
|
67144
67127
|
return new DevEnvironment(name, config, {
|
67145
67128
|
...context,
|
67146
67129
|
runner: {
|
@@ -67463,15 +67446,19 @@ function resolveDevEnvironmentOptions(dev, preserverSymlinks, environmentName, c
|
|
67463
67446
|
moduleRunnerTransform: dev?.moduleRunnerTransform ?? (skipSsrTransform !== void 0 && consumer === "server" ? skipSsrTransform : consumer === "server")
|
67464
67447
|
};
|
67465
67448
|
}
|
67466
|
-
function resolveEnvironmentOptions(options, resolvedRoot, logger, environmentName, skipSsrTransform) {
|
67467
|
-
const resolve = resolveEnvironmentResolveOptions(
|
67449
|
+
function resolveEnvironmentOptions(options, resolvedRoot, alias, preserveSymlinks, logger, environmentName, skipSsrTransform) {
|
67450
|
+
const resolve = resolveEnvironmentResolveOptions(
|
67451
|
+
options.resolve,
|
67452
|
+
alias,
|
67453
|
+
preserveSymlinks,
|
67454
|
+
logger
|
67455
|
+
);
|
67468
67456
|
const isClientEnvironment = environmentName === "client";
|
67469
67457
|
const consumer = options.consumer ?? isClientEnvironment ? "client" : "server";
|
67470
67458
|
return {
|
67471
67459
|
resolve,
|
67472
67460
|
consumer,
|
67473
67461
|
webCompatible: options.webCompatible ?? consumer === "client",
|
67474
|
-
injectInvalidationTimestamp: options.injectInvalidationTimestamp ?? consumer === "client",
|
67475
67462
|
dev: resolveDevEnvironmentOptions(
|
67476
67463
|
options.dev,
|
67477
67464
|
resolve.preserveSymlinks,
|
@@ -67501,7 +67488,6 @@ function getDefaultResolvedEnvironmentOptions(config) {
|
|
67501
67488
|
resolve: config.resolve,
|
67502
67489
|
consumer: "server",
|
67503
67490
|
webCompatible: false,
|
67504
|
-
injectInvalidationTimestamp: false,
|
67505
67491
|
dev: config.dev,
|
67506
67492
|
build: config.build
|
67507
67493
|
};
|
@@ -67536,10 +67522,7 @@ const clientAlias = [
|
|
67536
67522
|
replacement: path$n.posix.join(FS_PREFIX, normalizePath$3(CLIENT_ENTRY))
|
67537
67523
|
}
|
67538
67524
|
];
|
67539
|
-
function resolveEnvironmentResolveOptions(resolve, logger) {
|
67540
|
-
const resolvedAlias = normalizeAlias(
|
67541
|
-
mergeAlias(clientAlias, resolve?.alias || [])
|
67542
|
-
);
|
67525
|
+
function resolveEnvironmentResolveOptions(resolve, alias, preserveSymlinks, logger) {
|
67543
67526
|
const resolvedResolve = {
|
67544
67527
|
mainFields: resolve?.mainFields ?? DEFAULT_MAIN_FIELDS,
|
67545
67528
|
conditions: resolve?.conditions ?? [],
|
@@ -67548,8 +67531,8 @@ function resolveEnvironmentResolveOptions(resolve, logger) {
|
|
67548
67531
|
noExternal: resolve?.noExternal ?? [],
|
67549
67532
|
extensions: resolve?.extensions ?? DEFAULT_EXTENSIONS,
|
67550
67533
|
dedupe: resolve?.dedupe ?? [],
|
67551
|
-
preserveSymlinks
|
67552
|
-
alias
|
67534
|
+
preserveSymlinks,
|
67535
|
+
alias
|
67553
67536
|
};
|
67554
67537
|
if (
|
67555
67538
|
// @ts-expect-error removed field
|
@@ -67563,6 +67546,16 @@ function resolveEnvironmentResolveOptions(resolve, logger) {
|
|
67563
67546
|
}
|
67564
67547
|
return resolvedResolve;
|
67565
67548
|
}
|
67549
|
+
function resolveResolveOptions(resolve, logger) {
|
67550
|
+
const alias = normalizeAlias(mergeAlias(clientAlias, resolve?.alias || []));
|
67551
|
+
const preserveSymlinks = resolve?.preserveSymlinks ?? false;
|
67552
|
+
return resolveEnvironmentResolveOptions(
|
67553
|
+
resolve,
|
67554
|
+
alias,
|
67555
|
+
preserveSymlinks,
|
67556
|
+
logger
|
67557
|
+
);
|
67558
|
+
}
|
67566
67559
|
function resolveDepOptimizationOptions(optimizeDeps, preserveSymlinks, consumer) {
|
67567
67560
|
optimizeDeps ??= {};
|
67568
67561
|
return {
|
@@ -67574,7 +67567,6 @@ function resolveDepOptimizationOptions(optimizeDeps, preserveSymlinks, consumer)
|
|
67574
67567
|
holdUntilCrawlEnd: optimizeDeps.holdUntilCrawlEnd ?? true,
|
67575
67568
|
esbuildOptions: {
|
67576
67569
|
preserveSymlinks,
|
67577
|
-
// TODO: ?
|
67578
67570
|
...optimizeDeps.esbuildOptions
|
67579
67571
|
},
|
67580
67572
|
disabled: optimizeDeps.disabled,
|
@@ -67695,24 +67687,23 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
67695
67687
|
);
|
67696
67688
|
}
|
67697
67689
|
await runConfigEnvironmentHook(config.environments, userPlugins, configEnv);
|
67690
|
+
const resolvedDefaultResolve = resolveResolveOptions(config.resolve, logger);
|
67698
67691
|
const resolvedEnvironments = {};
|
67699
67692
|
for (const environmentName of Object.keys(config.environments)) {
|
67700
67693
|
resolvedEnvironments[environmentName] = resolveEnvironmentOptions(
|
67701
67694
|
config.environments[environmentName],
|
67702
67695
|
resolvedRoot,
|
67696
|
+
resolvedDefaultResolve.alias,
|
67697
|
+
resolvedDefaultResolve.preserveSymlinks,
|
67703
67698
|
logger,
|
67704
67699
|
environmentName,
|
67705
67700
|
config.experimental?.skipSsrTransform
|
67706
67701
|
);
|
67707
67702
|
}
|
67708
|
-
const resolvedDefaultEnvironmentResolve = resolveEnvironmentResolveOptions(
|
67709
|
-
config.resolve,
|
67710
|
-
logger
|
67711
|
-
);
|
67712
67703
|
const backwardCompatibleOptimizeDeps = resolvedEnvironments.client.dev.optimizeDeps;
|
67713
67704
|
const resolvedDevEnvironmentOptions = resolveDevEnvironmentOptions(
|
67714
67705
|
config.dev,
|
67715
|
-
|
67706
|
+
resolvedDefaultResolve.preserveSymlinks,
|
67716
67707
|
// default environment options
|
67717
67708
|
void 0,
|
67718
67709
|
void 0
|
@@ -67736,7 +67727,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
67736
67727
|
};
|
67737
67728
|
const ssr = resolveSSROptions(
|
67738
67729
|
patchedConfigSsr,
|
67739
|
-
|
67730
|
+
resolvedDefaultResolve.preserveSymlinks
|
67740
67731
|
);
|
67741
67732
|
const envDir = config.envDir ? normalizePath$3(path$n.resolve(resolvedRoot, config.envDir)) : resolvedRoot;
|
67742
67733
|
const userEnv = inlineConfig.envFile !== false && loadEnv(mode, envDir, resolveEnvPrefix(config));
|
@@ -67869,8 +67860,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
67869
67860
|
// Backward compatibility, users should use environment.config.dev.optimizeDeps
|
67870
67861
|
optimizeDeps: backwardCompatibleOptimizeDeps,
|
67871
67862
|
ssr,
|
67872
|
-
|
67873
|
-
resolve: resolvedDefaultEnvironmentResolve,
|
67863
|
+
resolve: resolvedDefaultResolve,
|
67874
67864
|
dev: resolvedDevEnvironmentOptions,
|
67875
67865
|
build: resolvedBuildOptions,
|
67876
67866
|
environments: resolvedEnvironments,
|
@@ -68291,4 +68281,4 @@ function optimizeDepsDisabledBackwardCompatibility(resolved, optimizeDeps, optim
|
|
68291
68281
|
}
|
68292
68282
|
}
|
68293
68283
|
|
68294
|
-
export {
|
68284
|
+
export { send$1 as A, BuildEnvironment as B, createLogger as C, DevEnvironment as D, searchForWorkspaceRoot as E, isFileServingAllowed as F, isFileLoadingAllowed as G, loadEnv as H, resolveEnvPrefix as I, colors$1 as J, getDefaultExportFromCjs as K, commonjsGlobal as L, index$1 as M, index as N, build$1 as O, preview$1 as P, ServerHMRConnector as S, arraify as a, build as b, createServer as c, defineConfig as d, createBuilder as e, createIdResolver as f, formatPostcssSourceMap as g, preprocessCSS as h, isInNodeModules$1 as i, buildErrorMessage as j, createNodeDevEnvironment as k, loadConfigFromFile as l, fetchModule as m, createServerModuleRunner as n, optimizeDeps as o, preview as p, createServerHotChannel as q, resolveConfig as r, sortUserPlugins as s, transformWithEsbuild as t, ssrTransform as u, normalizePath$3 as v, mergeConfig as w, mergeAlias as x, createFilter as y, rollupVersion as z };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { L as commonjsGlobal, K as getDefaultExportFromCjs } from './dep-ByEd0NXO.js';
|
2
2
|
import require$$0__default from 'fs';
|
3
3
|
import require$$0 from 'postcss';
|
4
4
|
import require$$0$1 from 'path';
|
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 {
|
5
|
+
import { J as colors, C as createLogger, r as resolveConfig } from './chunks/dep-ByEd0NXO.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
@@ -736,7 +736,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
736
736
|
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
737
737
|
).action(async (root, options) => {
|
738
738
|
filterDuplicateOptions(options);
|
739
|
-
const { createServer } = await import('./chunks/dep-
|
739
|
+
const { createServer } = await import('./chunks/dep-ByEd0NXO.js').then(function (n) { return n.N; });
|
740
740
|
try {
|
741
741
|
const server = await createServer({
|
742
742
|
root,
|
@@ -829,7 +829,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
829
829
|
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as builder.entireApp`).action(
|
830
830
|
async (root, options) => {
|
831
831
|
filterDuplicateOptions(options);
|
832
|
-
const build = await import('./chunks/dep-
|
832
|
+
const build = await import('./chunks/dep-ByEd0NXO.js').then(function (n) { return n.O; });
|
833
833
|
const buildOptions = cleanGlobalCLIOptions(
|
834
834
|
cleanBuilderCLIOptions(options)
|
835
835
|
);
|
@@ -884,7 +884,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
|
|
884
884
|
).action(
|
885
885
|
async (root, options) => {
|
886
886
|
filterDuplicateOptions(options);
|
887
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
887
|
+
const { optimizeDeps } = await import('./chunks/dep-ByEd0NXO.js').then(function (n) { return n.M; });
|
888
888
|
try {
|
889
889
|
const config = await resolveConfig(
|
890
890
|
{
|
@@ -910,7 +910,7 @@ ${e.stack}`),
|
|
910
910
|
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(
|
911
911
|
async (root, options) => {
|
912
912
|
filterDuplicateOptions(options);
|
913
|
-
const { preview } = await import('./chunks/dep-
|
913
|
+
const { preview } = await import('./chunks/dep-ByEd0NXO.js').then(function (n) { return n.P; });
|
914
914
|
try {
|
915
915
|
const server = await preview({
|
916
916
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -807,11 +807,19 @@ declare class BaseEnvironment extends PartialEnvironment {
|
|
807
807
|
constructor(name: string, config: ResolvedConfig, options?: ResolvedEnvironmentOptions);
|
808
808
|
}
|
809
809
|
/**
|
810
|
-
* This
|
811
|
-
*
|
810
|
+
* This class discourages users from inversely checking the `mode`
|
811
|
+
* to determine the type of environment, e.g.
|
812
|
+
*
|
813
|
+
* ```js
|
814
|
+
* const isDev = environment.mode !== 'build' // bad
|
815
|
+
* const isDev = environment.mode === 'dev' // good
|
816
|
+
* ```
|
817
|
+
*
|
818
|
+
* You should also not check against `"unknown"` specfically. It's
|
819
|
+
* a placeholder for more possible environment types.
|
812
820
|
*/
|
813
|
-
declare class
|
814
|
-
mode: "
|
821
|
+
declare class UnknownEnvironment extends BaseEnvironment {
|
822
|
+
mode: "unknown";
|
815
823
|
}
|
816
824
|
|
817
825
|
interface FetchModuleOptions {
|
@@ -1233,6 +1241,7 @@ interface ServerHotChannel extends HotChannel {
|
|
1233
1241
|
}
|
1234
1242
|
/** @deprecated use `ServerHotChannel` instead */
|
1235
1243
|
type ServerHMRChannel = ServerHotChannel;
|
1244
|
+
declare function createServerHotChannel(): ServerHotChannel;
|
1236
1245
|
/** @deprecated use `environment.hot` instead */
|
1237
1246
|
interface HotBroadcaster extends HotChannel {
|
1238
1247
|
readonly channels: HotChannel[];
|
@@ -1281,6 +1290,7 @@ declare class DevEnvironment extends BaseEnvironment {
|
|
1281
1290
|
watcher?: FSWatcher;
|
1282
1291
|
}): Promise<void>;
|
1283
1292
|
fetchModule(id: string, importer?: string, options?: FetchFunctionOptions): Promise<FetchResult>;
|
1293
|
+
reloadModule(module: EnvironmentModuleNode): Promise<void>;
|
1284
1294
|
transformRequest(url: string): Promise<TransformResult | null>;
|
1285
1295
|
warmupRequest(url: string): Promise<void>;
|
1286
1296
|
close(): Promise<void>;
|
@@ -2078,7 +2088,7 @@ type ResolvedBuilderOptions = Required<BuilderOptions>;
|
|
2078
2088
|
*/
|
2079
2089
|
declare function createBuilder(inlineConfig?: InlineConfig): Promise<ViteBuilder>;
|
2080
2090
|
|
2081
|
-
type Environment = DevEnvironment | BuildEnvironment |
|
2091
|
+
type Environment = DevEnvironment | BuildEnvironment | UnknownEnvironment;
|
2082
2092
|
|
2083
2093
|
declare class EnvironmentPluginContainer {
|
2084
2094
|
environment: Environment;
|
@@ -2940,11 +2950,6 @@ interface ViteDevServer {
|
|
2940
2950
|
* API to retrieve the module to be reloaded. If `hmr` is false, this is a no-op.
|
2941
2951
|
*/
|
2942
2952
|
reloadModule(module: ModuleNode): Promise<void>;
|
2943
|
-
/**
|
2944
|
-
* Triggers HMR for an environment module in the module graph.
|
2945
|
-
* If `hmr` is false, this is a no-op.
|
2946
|
-
*/
|
2947
|
-
reloadEnvironmentModule(module: EnvironmentModuleNode): Promise<void>;
|
2948
2953
|
/**
|
2949
2954
|
* Start the server.
|
2950
2955
|
*/
|
@@ -3011,7 +3016,7 @@ interface FsUtils {
|
|
3011
3016
|
initWatcher?: (watcher: FSWatcher) => void;
|
3012
3017
|
}
|
3013
3018
|
|
3014
|
-
interface
|
3019
|
+
interface EnvironmentResolveOptions {
|
3015
3020
|
/**
|
3016
3021
|
* @default ['browser', 'module', 'jsnext:main', 'jsnext']
|
3017
3022
|
*/
|
@@ -3023,10 +3028,6 @@ interface ResolveOptions {
|
|
3023
3028
|
*/
|
3024
3029
|
extensions?: string[];
|
3025
3030
|
dedupe?: string[];
|
3026
|
-
/**
|
3027
|
-
* @default false
|
3028
|
-
*/
|
3029
|
-
preserveSymlinks?: boolean;
|
3030
3031
|
/**
|
3031
3032
|
* external/noExternal logic, this only works for certain environments
|
3032
3033
|
* Previously this was ssr.external/ssr.noExternal
|
@@ -3035,6 +3036,12 @@ interface ResolveOptions {
|
|
3035
3036
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
3036
3037
|
external?: string[] | true;
|
3037
3038
|
}
|
3039
|
+
interface ResolveOptions extends EnvironmentResolveOptions {
|
3040
|
+
/**
|
3041
|
+
* @default false
|
3042
|
+
*/
|
3043
|
+
preserveSymlinks?: boolean;
|
3044
|
+
}
|
3038
3045
|
interface ResolvePluginOptions {
|
3039
3046
|
root: string;
|
3040
3047
|
isBuild: boolean;
|
@@ -3507,15 +3514,6 @@ interface ResolvedSSROptions extends SSROptions {
|
|
3507
3514
|
optimizeDeps: SsrDepOptimizationConfig;
|
3508
3515
|
}
|
3509
3516
|
|
3510
|
-
interface FutureDeprecationWarningsOptions {
|
3511
|
-
pluginHookHandleHotUpdate?: boolean;
|
3512
|
-
pluginHookSsrArgument?: boolean;
|
3513
|
-
serverModuleGraph?: boolean;
|
3514
|
-
serverHot?: boolean;
|
3515
|
-
serverTransformRequest?: boolean;
|
3516
|
-
ssrLoadModule?: boolean;
|
3517
|
-
}
|
3518
|
-
|
3519
3517
|
interface ConfigEnv {
|
3520
3518
|
/**
|
3521
3519
|
* 'serve': during dev (`vite` command)
|
@@ -3601,7 +3599,7 @@ interface DevEnvironmentOptions {
|
|
3601
3599
|
moduleRunnerTransform?: boolean;
|
3602
3600
|
}
|
3603
3601
|
type ResolvedDevEnvironmentOptions = Required<DevEnvironmentOptions>;
|
3604
|
-
type
|
3602
|
+
type AllResolveOptions = ResolveOptions & {
|
3605
3603
|
alias?: AliasOptions;
|
3606
3604
|
};
|
3607
3605
|
interface SharedEnvironmentOptions {
|
@@ -3624,13 +3622,6 @@ interface SharedEnvironmentOptions {
|
|
3624
3622
|
* Temporal options, we should remove these in favor of fine-grained control
|
3625
3623
|
*/
|
3626
3624
|
webCompatible?: boolean;
|
3627
|
-
/**
|
3628
|
-
* Should Vite inject timestamp if module is invalidated
|
3629
|
-
* Disabling this will break built-in HMR support
|
3630
|
-
* @experimental
|
3631
|
-
* @default true
|
3632
|
-
*/
|
3633
|
-
injectInvalidationTimestamp?: boolean;
|
3634
3625
|
}
|
3635
3626
|
interface EnvironmentOptions extends SharedEnvironmentOptions {
|
3636
3627
|
/**
|
@@ -3642,18 +3633,17 @@ interface EnvironmentOptions extends SharedEnvironmentOptions {
|
|
3642
3633
|
*/
|
3643
3634
|
build?: BuildEnvironmentOptions;
|
3644
3635
|
}
|
3645
|
-
type
|
3636
|
+
type ResolvedResolveOptions = Required<ResolveOptions>;
|
3646
3637
|
type ResolvedEnvironmentOptions = {
|
3647
3638
|
define?: Record<string, any>;
|
3648
|
-
resolve:
|
3639
|
+
resolve: ResolvedResolveOptions;
|
3649
3640
|
consumer: 'client' | 'server';
|
3650
3641
|
webCompatible: boolean;
|
3651
|
-
injectInvalidationTimestamp: boolean;
|
3652
3642
|
dev: ResolvedDevEnvironmentOptions;
|
3653
3643
|
build: ResolvedBuildEnvironmentOptions;
|
3654
3644
|
};
|
3655
|
-
type DefaultEnvironmentOptions = Omit<EnvironmentOptions, '
|
3656
|
-
|
3645
|
+
type DefaultEnvironmentOptions = Omit<EnvironmentOptions, 'consumer' | 'webCompatible' | 'resolve'> & {
|
3646
|
+
resolve?: AllResolveOptions;
|
3657
3647
|
};
|
3658
3648
|
interface UserConfig extends DefaultEnvironmentOptions {
|
3659
3649
|
/**
|
@@ -3822,12 +3812,12 @@ interface HTMLOptions {
|
|
3822
3812
|
cspNonce?: string;
|
3823
3813
|
}
|
3824
3814
|
interface FutureOptions {
|
3825
|
-
|
3826
|
-
|
3827
|
-
|
3828
|
-
|
3829
|
-
|
3830
|
-
|
3815
|
+
removePluginHookHandleHotUpdate?: 'warn';
|
3816
|
+
removePluginHookSsrArgument?: 'warn';
|
3817
|
+
removeServerModuleGraph?: 'warn';
|
3818
|
+
removeServerHot?: 'warn';
|
3819
|
+
removeServerTransformRequest?: 'warn';
|
3820
|
+
removeSsrLoadModule?: 'warn';
|
3831
3821
|
}
|
3832
3822
|
interface ExperimentalOptions {
|
3833
3823
|
/**
|
@@ -3924,7 +3914,9 @@ interface PluginHookUtils {
|
|
3924
3914
|
getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[];
|
3925
3915
|
}
|
3926
3916
|
type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
|
3927
|
-
declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean,
|
3917
|
+
declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean,
|
3918
|
+
|
3919
|
+
): Promise<ResolvedConfig>;
|
3928
3920
|
declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
|
3929
3921
|
declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger): Promise<{
|
3930
3922
|
path: string;
|
@@ -4041,6 +4033,10 @@ declare function searchForWorkspaceRoot(current: string, root?: string): string;
|
|
4041
4033
|
/**
|
4042
4034
|
* Check if the url is allowed to be served, via the `server.fs` config.
|
4043
4035
|
*/
|
4036
|
+
declare function isFileServingAllowed(config: ResolvedConfig, url: string): boolean;
|
4037
|
+
/**
|
4038
|
+
* @deprecated Use the `isFileServingAllowed(config, url)` signature instead.
|
4039
|
+
*/
|
4044
4040
|
declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
|
4045
4041
|
declare function isFileLoadingAllowed(config: ResolvedConfig, filePath: string): boolean;
|
4046
4042
|
|
@@ -4060,4 +4056,4 @@ interface ManifestChunk {
|
|
4060
4056
|
dynamicImports?: string[];
|
4061
4057
|
}
|
4062
4058
|
|
4063
|
-
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESBuildTransformResult, type Environment, EnvironmentModuleGraph, EnvironmentModuleNode, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotUpdateOptions, type HtmlTagDescriptor, HttpProxy, type HttpServer, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type OptimizedDepInfo, type Plugin, PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, RemoteEnvironmentTransport, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationConfig, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteBuilder, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createLogger, createNodeDevEnvironment, createServer, createServerModuleRunner, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
4059
|
+
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESBuildTransformResult, type Environment, EnvironmentModuleGraph, EnvironmentModuleNode, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotUpdateOptions, type HtmlTagDescriptor, HttpProxy, type HttpServer, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type OptimizedDepInfo, type Plugin, PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, RemoteEnvironmentTransport, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationConfig, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteBuilder, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createLogger, createNodeDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
|
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 BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, j as buildErrorMessage, e as createBuilder,
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-ByEd0NXO.js';
|
3
|
+
export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, j as buildErrorMessage, e as createBuilder, y as createFilter, f as createIdResolver, C as createLogger, k as createNodeDevEnvironment, c as createServer, q as createServerHotChannel, n as createServerModuleRunner, d as defineConfig, m as fetchModule, g as formatPostcssSourceMap, G as isFileLoadingAllowed, F as isFileServingAllowed, l as loadConfigFromFile, H as loadEnv, x as mergeAlias, w as mergeConfig, u as moduleRunnerTransform, v as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, I as resolveEnvPrefix, z as rollupVersion, E as searchForWorkspaceRoot, A as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-ByEd0NXO.js';
|
4
4
|
export { VERSION as version } from './constants.js';
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
6
|
import 'node:fs';
|
@@ -143,7 +143,6 @@ declare class ModuleRunner {
|
|
143
143
|
* Returns `true` if the runtime has been destroyed by calling `destroy()` method.
|
144
144
|
*/
|
145
145
|
isDestroyed(): boolean;
|
146
|
-
private normalizeEntryUrl;
|
147
146
|
private processImport;
|
148
147
|
private isCircularModule;
|
149
148
|
private isCircularImport;
|
@@ -2,9 +2,6 @@ const VALID_ID_PREFIX = "/@id/", NULL_BYTE_PLACEHOLDER = "__x00__";
|
|
2
2
|
let SOURCEMAPPING_URL = "sourceMa";
|
3
3
|
SOURCEMAPPING_URL += "ppingURL";
|
4
4
|
const isWindows = typeof process < "u" && process.platform === "win32";
|
5
|
-
function wrapId(id) {
|
6
|
-
return id.startsWith(VALID_ID_PREFIX) ? id : VALID_ID_PREFIX + id.replace("\0", NULL_BYTE_PLACEHOLDER);
|
7
|
-
}
|
8
5
|
function unwrapId(id) {
|
9
6
|
return id.startsWith(VALID_ID_PREFIX) ? id.slice(VALID_ID_PREFIX.length).replace(NULL_BYTE_PLACEHOLDER, "\0") : id;
|
10
7
|
}
|
@@ -881,7 +878,6 @@ class ModuleRunner {
|
|
881
878
|
* URL to execute. Accepts file path, server path or id relative to the root.
|
882
879
|
*/
|
883
880
|
async import(url) {
|
884
|
-
url = this.normalizeEntryUrl(url);
|
885
881
|
const fetchedModule = await this.cachedModule(url);
|
886
882
|
return await this.cachedRequest(url, fetchedModule);
|
887
883
|
}
|
@@ -904,12 +900,6 @@ class ModuleRunner {
|
|
904
900
|
isDestroyed() {
|
905
901
|
return this.destroyed;
|
906
902
|
}
|
907
|
-
// we don't use moduleCache.normalize because this URL doesn't have to follow the same rules
|
908
|
-
// this URL is something that user passes down manually, and is later resolved by fetchModule
|
909
|
-
// moduleCache.normalize is used on resolved "file" property
|
910
|
-
normalizeEntryUrl(url) {
|
911
|
-
return url[0] === "." ? url : (url = normalizeAbsoluteUrl(url, this.root), url[0] === "/" ? url : wrapId(url));
|
912
|
-
}
|
913
903
|
processImport(exports, fetchResult, metadata) {
|
914
904
|
if (!("externalize" in fetchResult))
|
915
905
|
return exports;
|
@@ -5542,8 +5542,9 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
|
5542
5542
|
return searchForWorkspaceRoot(dir, root);
|
5543
5543
|
}
|
5544
5544
|
|
5545
|
-
function isFileServingAllowed(
|
5546
|
-
const
|
5545
|
+
function isFileServingAllowed(configOrUrl, urlOrServer) {
|
5546
|
+
const config = typeof urlOrServer === "string" ? configOrUrl : urlOrServer.config;
|
5547
|
+
const url = typeof urlOrServer === "string" ? urlOrServer : configOrUrl;
|
5547
5548
|
if (!config.server.fs.strict) return true;
|
5548
5549
|
const filePath = fsPathFromUrl(url);
|
5549
5550
|
return isFileLoadingAllowed(config, filePath);
|
package/index.cjs
CHANGED
@@ -25,11 +25,36 @@ asyncFunctions.forEach((name) => {
|
|
25
25
|
|
26
26
|
function warnCjsUsage() {
|
27
27
|
if (process.env.VITE_CJS_IGNORE_WARNING) return
|
28
|
+
const logLevelIndex = process.argv.findIndex((arg) =>
|
29
|
+
/^(?:-l|--logLevel)/.test(arg),
|
30
|
+
)
|
31
|
+
if (logLevelIndex > 0) {
|
32
|
+
const logLevelValue = process.argv[logLevelIndex + 1]
|
33
|
+
if (logLevelValue === 'silent' || logLevelValue === 'error') {
|
34
|
+
return
|
35
|
+
}
|
36
|
+
if (/silent|error/.test(process.argv[logLevelIndex])) {
|
37
|
+
return
|
38
|
+
}
|
39
|
+
}
|
28
40
|
const yellow = (str) => `\u001b[33m${str}\u001b[39m`
|
29
|
-
|
30
|
-
log(
|
41
|
+
console.warn(
|
31
42
|
yellow(
|
32
43
|
`The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.`,
|
33
44
|
),
|
34
45
|
)
|
46
|
+
if (process.env.VITE_CJS_TRACE) {
|
47
|
+
const e = {}
|
48
|
+
const stackTraceLimit = Error.stackTraceLimit
|
49
|
+
Error.stackTraceLimit = 100
|
50
|
+
Error.captureStackTrace(e)
|
51
|
+
Error.stackTraceLimit = stackTraceLimit
|
52
|
+
console.log(
|
53
|
+
e.stack
|
54
|
+
.split('\n')
|
55
|
+
.slice(1)
|
56
|
+
.filter((line) => !line.includes('(node:'))
|
57
|
+
.join('\n'),
|
58
|
+
)
|
59
|
+
}
|
35
60
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite",
|
3
|
-
"version": "6.0.0-alpha.
|
3
|
+
"version": "6.0.0-alpha.24",
|
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.43",
|
77
77
|
"rollup": "^4.20.0"
|
78
78
|
},
|
79
79
|
"optionalDependencies": {
|
@@ -81,7 +81,7 @@
|
|
81
81
|
},
|
82
82
|
"devDependencies": {
|
83
83
|
"@ampproject/remapping": "^2.3.0",
|
84
|
-
"@babel/parser": "^7.25.
|
84
|
+
"@babel/parser": "^7.25.6",
|
85
85
|
"@jridgewell/trace-mapping": "^0.3.25",
|
86
86
|
"@polka/compression": "^1.0.0-next.25",
|
87
87
|
"@rollup/plugin-alias": "^5.1.0",
|
@@ -135,7 +135,7 @@
|
|
135
135
|
"source-map-support": "^0.5.21",
|
136
136
|
"strip-ansi": "^7.1.0",
|
137
137
|
"strip-literal": "^2.1.0",
|
138
|
-
"tsconfck": "^3.1.
|
138
|
+
"tsconfck": "^3.1.3",
|
139
139
|
"tslib": "^2.7.0",
|
140
140
|
"types": "link:./types",
|
141
141
|
"ufo": "^1.5.4",
|