vite 6.0.0-alpha.22 → 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-1C5gbBiU.js → dep-ByEd0NXO.js} +329 -353
- package/dist/node/chunks/{dep-BzHfSPcV.js → dep-hyosMzMD.js} +1 -1
- package/dist/node/chunks/{dep-DGaPvi2R.js → dep-yUJ1DpJ5.js} +1 -1
- package/dist/node/cli.js +6 -6
- package/dist/node/index.d.ts +46 -47
- package/dist/node/index.js +2 -2
- package/dist/node/module-runner.d.ts +2 -3
- package/dist/node/module-runner.js +12 -20
- package/dist/node-cjs/publicUtils.cjs +3 -2
- package/index.cjs +27 -2
- package/package.json +4 -4
@@ -7,8 +7,8 @@ import { promisify as promisify$4, format as format$2, inspect } from 'node:util
|
|
7
7
|
import { performance as performance$1 } from 'node:perf_hooks';
|
8
8
|
import { createRequire as createRequire$1, builtinModules } from 'node:module';
|
9
9
|
import require$$0$3 from 'tty';
|
10
|
-
import require$$0$4, { win32, posix, isAbsolute, resolve as resolve$3, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join as join$1, sep as sep$1, normalize as normalize$1 } from 'path';
|
11
10
|
import esbuild, { transform as transform$1, formatMessages, build as build$3 } from 'esbuild';
|
11
|
+
import require$$0$4, { win32, posix, isAbsolute, resolve as resolve$3, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join as join$1, sep as sep$1, normalize as normalize$1 } from 'path';
|
12
12
|
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, wildcardHosts, loopbackHosts, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_ASSETS_INLINE_LIMIT, ENV_ENTRY, SPECIAL_QUERY_RE, DEP_VERSION_RE, DEFAULT_MAIN_FIELDS, DEFAULT_EXTENSIONS, KNOWN_ASSET_TYPES, JS_TYPES_RE, CSS_LANGS_RE, METADATA_FILENAME, ESBUILD_MODULES_TARGET, VITE_PACKAGE_DIR, CLIENT_DIR, DEFAULT_DEV_PORT, VERSION, ROLLUP_HOOKS, DEFAULT_PREVIEW_PORT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
13
13
|
import * as require$$0$2 from 'fs';
|
14
14
|
import require$$0__default, { lstatSync, readdir as readdir$4, readdirSync, readlinkSync, realpathSync as realpathSync$1, existsSync, readFileSync, statSync as statSync$1 } from 'fs';
|
@@ -160,92 +160,6 @@ picocolors.exports.createColors = createColors;
|
|
160
160
|
var picocolorsExports = picocolors.exports;
|
161
161
|
var colors$1 = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
|
162
162
|
|
163
|
-
function matches$1(pattern, importee) {
|
164
|
-
if (pattern instanceof RegExp) {
|
165
|
-
return pattern.test(importee);
|
166
|
-
}
|
167
|
-
if (importee.length < pattern.length) {
|
168
|
-
return false;
|
169
|
-
}
|
170
|
-
if (importee === pattern) {
|
171
|
-
return true;
|
172
|
-
}
|
173
|
-
// eslint-disable-next-line prefer-template
|
174
|
-
return importee.startsWith(pattern + '/');
|
175
|
-
}
|
176
|
-
function getEntries({ entries, customResolver }) {
|
177
|
-
if (!entries) {
|
178
|
-
return [];
|
179
|
-
}
|
180
|
-
const resolverFunctionFromOptions = resolveCustomResolver(customResolver);
|
181
|
-
if (Array.isArray(entries)) {
|
182
|
-
return entries.map((entry) => {
|
183
|
-
return {
|
184
|
-
find: entry.find,
|
185
|
-
replacement: entry.replacement,
|
186
|
-
resolverFunction: resolveCustomResolver(entry.customResolver) || resolverFunctionFromOptions
|
187
|
-
};
|
188
|
-
});
|
189
|
-
}
|
190
|
-
return Object.entries(entries).map(([key, value]) => {
|
191
|
-
return { find: key, replacement: value, resolverFunction: resolverFunctionFromOptions };
|
192
|
-
});
|
193
|
-
}
|
194
|
-
function getHookFunction(hook) {
|
195
|
-
if (typeof hook === 'function') {
|
196
|
-
return hook;
|
197
|
-
}
|
198
|
-
if (hook && 'handler' in hook && typeof hook.handler === 'function') {
|
199
|
-
return hook.handler;
|
200
|
-
}
|
201
|
-
return null;
|
202
|
-
}
|
203
|
-
function resolveCustomResolver(customResolver) {
|
204
|
-
if (typeof customResolver === 'function') {
|
205
|
-
return customResolver;
|
206
|
-
}
|
207
|
-
if (customResolver) {
|
208
|
-
return getHookFunction(customResolver.resolveId);
|
209
|
-
}
|
210
|
-
return null;
|
211
|
-
}
|
212
|
-
function alias$1(options = {}) {
|
213
|
-
const entries = getEntries(options);
|
214
|
-
if (entries.length === 0) {
|
215
|
-
return {
|
216
|
-
name: 'alias',
|
217
|
-
resolveId: () => null
|
218
|
-
};
|
219
|
-
}
|
220
|
-
return {
|
221
|
-
name: 'alias',
|
222
|
-
async buildStart(inputOptions) {
|
223
|
-
await Promise.all([...(Array.isArray(options.entries) ? options.entries : []), options].map(({ customResolver }) => { var _a; return customResolver && ((_a = getHookFunction(customResolver.buildStart)) === null || _a === void 0 ? void 0 : _a.call(this, inputOptions)); }));
|
224
|
-
},
|
225
|
-
resolveId(importee, importer, resolveOptions) {
|
226
|
-
// First match is supposed to be the correct one
|
227
|
-
const matchedEntry = entries.find((entry) => matches$1(entry.find, importee));
|
228
|
-
if (!matchedEntry) {
|
229
|
-
return null;
|
230
|
-
}
|
231
|
-
const updatedId = importee.replace(matchedEntry.find, matchedEntry.replacement);
|
232
|
-
if (matchedEntry.resolverFunction) {
|
233
|
-
return matchedEntry.resolverFunction.call(this, updatedId, importer, resolveOptions);
|
234
|
-
}
|
235
|
-
return this.resolve(updatedId, importer, Object.assign({ skipSelf: true }, resolveOptions)).then((resolved) => {
|
236
|
-
if (resolved)
|
237
|
-
return resolved;
|
238
|
-
if (!require$$0$4.isAbsolute(updatedId)) {
|
239
|
-
this.warn(`rewrote ${importee} to ${updatedId} but was not an abolute path and was not handled by other plugins. ` +
|
240
|
-
`This will lead to duplicated modules for the same path. ` +
|
241
|
-
`To avoid duplicating modules, you should resolve to an absolute path.`);
|
242
|
-
}
|
243
|
-
return { id: updatedId };
|
244
|
-
});
|
245
|
-
}
|
246
|
-
};
|
247
|
-
}
|
248
|
-
|
249
163
|
var utils$k = {};
|
250
164
|
|
251
165
|
const path$m = require$$0$4;
|
@@ -18370,8 +18284,8 @@ function pattern2regex(resolvedPattern, allowJs) {
|
|
18370
18284
|
function replaceTokens(tsconfig, configDir) {
|
18371
18285
|
return JSON.parse(
|
18372
18286
|
JSON.stringify(tsconfig)
|
18373
|
-
// replace ${configDir}
|
18374
|
-
.replaceAll(/"
|
18287
|
+
// replace ${configDir}
|
18288
|
+
.replaceAll(/"\${configDir}/g, `"${native2posix(configDir)}`)
|
18375
18289
|
);
|
18376
18290
|
}
|
18377
18291
|
|
@@ -18965,7 +18879,7 @@ function rebaseRelative(key, value, prependPath) {
|
|
18965
18879
|
* @returns {string}
|
18966
18880
|
*/
|
18967
18881
|
function rebasePath(value, prependPath) {
|
18968
|
-
if (path$n.isAbsolute(value)) {
|
18882
|
+
if (path$n.isAbsolute(value) || value.startsWith('${configDir}')) {
|
18969
18883
|
return value;
|
18970
18884
|
} else {
|
18971
18885
|
// relative paths use posix syntax in tsconfig
|
@@ -20358,7 +20272,8 @@ function assetPlugin(config) {
|
|
20358
20272
|
code: `export default ${JSON.stringify(encodeURIPath(url))}`,
|
20359
20273
|
// Force rollup to keep this module from being shared between other entry points if it's an entrypoint.
|
20360
20274
|
// If the resulting chunk is empty, it will be removed in generateBundle.
|
20361
|
-
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
|
20362
20277
|
};
|
20363
20278
|
},
|
20364
20279
|
renderChunk(code, chunk, opts) {
|
@@ -20375,7 +20290,7 @@ function assetPlugin(config) {
|
|
20375
20290
|
generateBundle(_, bundle) {
|
20376
20291
|
for (const file in bundle) {
|
20377
20292
|
const chunk = bundle[file];
|
20378
|
-
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"]) {
|
20379
20294
|
delete bundle[file];
|
20380
20295
|
}
|
20381
20296
|
}
|
@@ -33917,6 +33832,92 @@ var src$1 = rc;
|
|
33917
33832
|
|
33918
33833
|
var postcssrc = /*@__PURE__*/getDefaultExportFromCjs(src$1);
|
33919
33834
|
|
33835
|
+
function matches$1(pattern, importee) {
|
33836
|
+
if (pattern instanceof RegExp) {
|
33837
|
+
return pattern.test(importee);
|
33838
|
+
}
|
33839
|
+
if (importee.length < pattern.length) {
|
33840
|
+
return false;
|
33841
|
+
}
|
33842
|
+
if (importee === pattern) {
|
33843
|
+
return true;
|
33844
|
+
}
|
33845
|
+
// eslint-disable-next-line prefer-template
|
33846
|
+
return importee.startsWith(pattern + '/');
|
33847
|
+
}
|
33848
|
+
function getEntries({ entries, customResolver }) {
|
33849
|
+
if (!entries) {
|
33850
|
+
return [];
|
33851
|
+
}
|
33852
|
+
const resolverFunctionFromOptions = resolveCustomResolver(customResolver);
|
33853
|
+
if (Array.isArray(entries)) {
|
33854
|
+
return entries.map((entry) => {
|
33855
|
+
return {
|
33856
|
+
find: entry.find,
|
33857
|
+
replacement: entry.replacement,
|
33858
|
+
resolverFunction: resolveCustomResolver(entry.customResolver) || resolverFunctionFromOptions
|
33859
|
+
};
|
33860
|
+
});
|
33861
|
+
}
|
33862
|
+
return Object.entries(entries).map(([key, value]) => {
|
33863
|
+
return { find: key, replacement: value, resolverFunction: resolverFunctionFromOptions };
|
33864
|
+
});
|
33865
|
+
}
|
33866
|
+
function getHookFunction(hook) {
|
33867
|
+
if (typeof hook === 'function') {
|
33868
|
+
return hook;
|
33869
|
+
}
|
33870
|
+
if (hook && 'handler' in hook && typeof hook.handler === 'function') {
|
33871
|
+
return hook.handler;
|
33872
|
+
}
|
33873
|
+
return null;
|
33874
|
+
}
|
33875
|
+
function resolveCustomResolver(customResolver) {
|
33876
|
+
if (typeof customResolver === 'function') {
|
33877
|
+
return customResolver;
|
33878
|
+
}
|
33879
|
+
if (customResolver) {
|
33880
|
+
return getHookFunction(customResolver.resolveId);
|
33881
|
+
}
|
33882
|
+
return null;
|
33883
|
+
}
|
33884
|
+
function alias$1(options = {}) {
|
33885
|
+
const entries = getEntries(options);
|
33886
|
+
if (entries.length === 0) {
|
33887
|
+
return {
|
33888
|
+
name: 'alias',
|
33889
|
+
resolveId: () => null
|
33890
|
+
};
|
33891
|
+
}
|
33892
|
+
return {
|
33893
|
+
name: 'alias',
|
33894
|
+
async buildStart(inputOptions) {
|
33895
|
+
await Promise.all([...(Array.isArray(options.entries) ? options.entries : []), options].map(({ customResolver }) => { var _a; return customResolver && ((_a = getHookFunction(customResolver.buildStart)) === null || _a === void 0 ? void 0 : _a.call(this, inputOptions)); }));
|
33896
|
+
},
|
33897
|
+
resolveId(importee, importer, resolveOptions) {
|
33898
|
+
// First match is supposed to be the correct one
|
33899
|
+
const matchedEntry = entries.find((entry) => matches$1(entry.find, importee));
|
33900
|
+
if (!matchedEntry) {
|
33901
|
+
return null;
|
33902
|
+
}
|
33903
|
+
const updatedId = importee.replace(matchedEntry.find, matchedEntry.replacement);
|
33904
|
+
if (matchedEntry.resolverFunction) {
|
33905
|
+
return matchedEntry.resolverFunction.call(this, updatedId, importer, resolveOptions);
|
33906
|
+
}
|
33907
|
+
return this.resolve(updatedId, importer, Object.assign({ skipSelf: true }, resolveOptions)).then((resolved) => {
|
33908
|
+
if (resolved)
|
33909
|
+
return resolved;
|
33910
|
+
if (!require$$0$4.isAbsolute(updatedId)) {
|
33911
|
+
this.warn(`rewrote ${importee} to ${updatedId} but was not an abolute path and was not handled by other plugins. ` +
|
33912
|
+
`This will lead to duplicated modules for the same path. ` +
|
33913
|
+
`To avoid duplicating modules, you should resolve to an absolute path.`);
|
33914
|
+
}
|
33915
|
+
return { id: updatedId };
|
33916
|
+
});
|
33917
|
+
}
|
33918
|
+
};
|
33919
|
+
}
|
33920
|
+
|
33920
33921
|
function e(e,n,r){throw new Error(r?`No known conditions for "${n}" specifier in "${e}" package`:`Missing "${n}" specifier in "${e}" package`)}function n(n,i,o,f){let s,u,l=r(n,o),c=function(e){let n=new Set(["default",...e.conditions||[]]);return e.unsafe||n.add(e.require?"require":"import"),e.unsafe||n.add(e.browser?"browser":"node"),n}(f||{}),a=i[l];if(void 0===a){let e,n,r,t;for(t in i)n&&t.length<n.length||("/"===t[t.length-1]&&l.startsWith(t)?(u=l.substring(t.length),n=t):t.length>1&&(r=t.indexOf("*",1),~r&&(e=RegExp("^"+t.substring(0,r)+"(.*)"+t.substring(1+r)).exec(l),e&&e[1]&&(u=e[1],n=t))));a=i[n];}return a||e(n,l),s=t(a,c),s||e(n,l,1),u&&function(e,n){let r,t=0,i=e.length,o=/[*]/g,f=/[/]$/;for(;t<i;t++)e[t]=o.test(r=e[t])?r.replace(o,n):f.test(r)?r+n:r;}(s,u),s}function r(e,n,r){if(e===n||"."===n)return ".";let t=e+"/",i=t.length,o=n.slice(0,i)===t,f=o?n.slice(i):n;return "#"===f[0]?f:o||!r?"./"===f.slice(0,2)?f:"./"+f:f}function t(e,n,r){if(e){if("string"==typeof e)return r&&r.add(e),[e];let i,o;if(Array.isArray(e)){for(o=r||new Set,i=0;i<e.length;i++)t(e[i],n,o);if(!r&&o.size)return [...o]}else for(i in e)if(n.has(i))return t(e[i],n,r)}}function o(e,r,t){let i,o=e.exports;if(o){if("string"==typeof o)o={".":o};else for(i in o){"."!==i[0]&&(o={".":o});break}return n(e.name,o,r||".",t)}}function f(e,r,t){if(e.imports)return n(e.name,e.imports,r,t)}
|
33921
33922
|
|
33922
33923
|
const HASH_RE = /#/g;
|
@@ -35659,17 +35660,20 @@ function esbuildDepPlugin(environment, qualified, external) {
|
|
35659
35660
|
const allExternalTypes = extensions ? externalTypes.filter((type) => !extensions?.includes("." + type)) : externalTypes;
|
35660
35661
|
const esmPackageCache = /* @__PURE__ */ new Map();
|
35661
35662
|
const cjsPackageCache = /* @__PURE__ */ new Map();
|
35662
|
-
const _resolve =
|
35663
|
+
const _resolve = createBackCompatIdResolver(environment.getTopLevelConfig(), {
|
35663
35664
|
asSrc: false,
|
35664
35665
|
scan: true,
|
35665
35666
|
packageCache: esmPackageCache
|
35666
35667
|
});
|
35667
|
-
const _resolveRequire =
|
35668
|
-
|
35669
|
-
|
35670
|
-
|
35671
|
-
|
35672
|
-
|
35668
|
+
const _resolveRequire = createBackCompatIdResolver(
|
35669
|
+
environment.getTopLevelConfig(),
|
35670
|
+
{
|
35671
|
+
asSrc: false,
|
35672
|
+
isRequire: true,
|
35673
|
+
scan: true,
|
35674
|
+
packageCache: cjsPackageCache
|
35675
|
+
}
|
35676
|
+
);
|
35673
35677
|
const resolve = (id, importer, kind, resolveDir) => {
|
35674
35678
|
let _importer;
|
35675
35679
|
{
|
@@ -35881,6 +35885,12 @@ function esbuildCjsExternalPlugin(externals, platform) {
|
|
35881
35885
|
};
|
35882
35886
|
}
|
35883
35887
|
|
35888
|
+
const environmentColors = [
|
35889
|
+
colors$1.blue,
|
35890
|
+
colors$1.magenta,
|
35891
|
+
colors$1.green,
|
35892
|
+
colors$1.gray
|
35893
|
+
];
|
35884
35894
|
class PartialEnvironment {
|
35885
35895
|
name;
|
35886
35896
|
getTopLevelConfig() {
|
@@ -35921,7 +35931,7 @@ class PartialEnvironment {
|
|
35921
35931
|
}
|
35922
35932
|
);
|
35923
35933
|
const environment = colors$1.dim(`(${this.name})`);
|
35924
|
-
const colorIndex = [...
|
35934
|
+
const colorIndex = [...this.name].reduce((acc, c) => acc + c.charCodeAt(0), 0) % environmentColors.length;
|
35925
35935
|
const infoColor = environmentColors[colorIndex || 0];
|
35926
35936
|
this.logger = {
|
35927
35937
|
get hasWarned() {
|
@@ -35980,15 +35990,6 @@ class BaseEnvironment extends PartialEnvironment {
|
|
35980
35990
|
super(name, config, options);
|
35981
35991
|
}
|
35982
35992
|
}
|
35983
|
-
class FutureCompatEnvironment extends BaseEnvironment {
|
35984
|
-
mode = "futureCompat";
|
35985
|
-
}
|
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.
|
@@ -37397,7 +37398,7 @@ function isScannable(id, extensions) {
|
|
37397
37398
|
|
37398
37399
|
function createOptimizeDepsIncludeResolver(environment) {
|
37399
37400
|
const topLevelConfig = environment.getTopLevelConfig();
|
37400
|
-
const resolve =
|
37401
|
+
const resolve = createBackCompatIdResolver(topLevelConfig, {
|
37401
37402
|
asSrc: false,
|
37402
37403
|
scan: true,
|
37403
37404
|
ssrOptimizeCheck: environment.config.consumer === "server",
|
@@ -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) {
|
@@ -45888,15 +45887,20 @@ function createServerModuleRunner(environment, options = {}) {
|
|
45888
45887
|
}
|
45889
45888
|
|
45890
45889
|
async function ssrLoadModule(url, server, fixStacktrace) {
|
45891
|
-
|
45890
|
+
server._ssrCompatModuleRunner ||= createServerModuleRunner(
|
45892
45891
|
server.environments.ssr,
|
45893
45892
|
{
|
45894
45893
|
sourcemapInterceptor: false,
|
45895
45894
|
hmr: false
|
45896
45895
|
}
|
45897
|
-
)
|
45896
|
+
);
|
45898
45897
|
url = unwrapId$1(url);
|
45899
|
-
return instantiateModule(
|
45898
|
+
return instantiateModule(
|
45899
|
+
url,
|
45900
|
+
server._ssrCompatModuleRunner,
|
45901
|
+
server,
|
45902
|
+
fixStacktrace
|
45903
|
+
);
|
45900
45904
|
}
|
45901
45905
|
async function instantiateModule(url, runner, server, fixStacktrace) {
|
45902
45906
|
const environment = server.environments.ssr;
|
@@ -46459,45 +46463,6 @@ Object.defineProperty(${ssrModuleExportsKey}, "default", { enumerable: true, con
|
|
46459
46463
|
dynamicDeps: [...dynamicDeps]
|
46460
46464
|
};
|
46461
46465
|
}
|
46462
|
-
async function ssrParseImports(url, code) {
|
46463
|
-
let ast;
|
46464
|
-
try {
|
46465
|
-
ast = await parseAstAsync(code);
|
46466
|
-
} catch (err) {
|
46467
|
-
if (!err.loc || !err.loc.line) throw err;
|
46468
|
-
const line = err.loc.line;
|
46469
|
-
throw new Error(
|
46470
|
-
`Parse failure: ${err.message}
|
46471
|
-
At file: ${url}
|
46472
|
-
Contents of line ${line}: ${code.split("\n")[line - 1]}`
|
46473
|
-
);
|
46474
|
-
}
|
46475
|
-
const imports = [];
|
46476
|
-
walk$1(ast, {
|
46477
|
-
enter(_n, parent) {
|
46478
|
-
if (_n.type !== "Identifier") return;
|
46479
|
-
const node = _n;
|
46480
|
-
const isStaticImport = node.name === ssrImportKey;
|
46481
|
-
const isDynamicImport = node.name === ssrDynamicImportKey;
|
46482
|
-
if (isStaticImport || isDynamicImport) {
|
46483
|
-
const importExpression = parent;
|
46484
|
-
const importLiteral = importExpression.arguments[0];
|
46485
|
-
imports.push({
|
46486
|
-
n: importLiteral.value,
|
46487
|
-
s: importLiteral.start,
|
46488
|
-
e: importLiteral.end,
|
46489
|
-
se: importExpression.start,
|
46490
|
-
ss: importExpression.end,
|
46491
|
-
t: isStaticImport ? 2 : 1,
|
46492
|
-
d: isDynamicImport ? importLiteral.start : -1,
|
46493
|
-
a: -1
|
46494
|
-
// not used
|
46495
|
-
});
|
46496
|
-
}
|
46497
|
-
}
|
46498
|
-
});
|
46499
|
-
return imports;
|
46500
|
-
}
|
46501
46466
|
const isNodeInPatternWeakSet = /* @__PURE__ */ new WeakSet();
|
46502
46467
|
const setIsNodeInPattern = (node) => isNodeInPatternWeakSet.add(node);
|
46503
46468
|
const isNodeInPattern = (node) => isNodeInPatternWeakSet.has(node);
|
@@ -55685,7 +55650,8 @@ function servePublicMiddleware(server, publicFiles) {
|
|
55685
55650
|
return normalizePath$3(filePath);
|
55686
55651
|
};
|
55687
55652
|
return function viteServePublicMiddleware(req, res, next) {
|
55688
|
-
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)) {
|
55689
55655
|
return next();
|
55690
55656
|
}
|
55691
55657
|
serve(req, res, next);
|
@@ -55761,8 +55727,9 @@ function serveRawFsMiddleware(server) {
|
|
55761
55727
|
}
|
55762
55728
|
};
|
55763
55729
|
}
|
55764
|
-
function isFileServingAllowed(
|
55765
|
-
const
|
55730
|
+
function isFileServingAllowed(configOrUrl, urlOrServer) {
|
55731
|
+
const config = typeof urlOrServer === "string" ? configOrUrl : urlOrServer.config;
|
55732
|
+
const url = typeof urlOrServer === "string" ? urlOrServer : configOrUrl;
|
55766
55733
|
if (!config.server.fs.strict) return true;
|
55767
55734
|
const filePath = fsPathFromUrl(url);
|
55768
55735
|
return isFileLoadingAllowed(config, filePath);
|
@@ -56054,15 +56021,13 @@ async function handleModuleSoftInvalidation(environment, mod, timestamp) {
|
|
56054
56021
|
);
|
56055
56022
|
}
|
56056
56023
|
let result;
|
56057
|
-
if (
|
56024
|
+
if (transformResult.ssr) {
|
56058
56025
|
result = transformResult;
|
56059
56026
|
} else {
|
56027
|
+
await init;
|
56060
56028
|
const source = transformResult.code;
|
56061
56029
|
const s = new MagicString(source);
|
56062
|
-
const imports =
|
56063
|
-
await init;
|
56064
|
-
return parse$d(source, mod.id || void 0)[0];
|
56065
|
-
})();
|
56030
|
+
const [imports] = parse$d(source, mod.id || void 0);
|
56066
56031
|
for (const imp of imports) {
|
56067
56032
|
let rawUrl = source.slice(imp.s, imp.e);
|
56068
56033
|
if (rawUrl === "import.meta") continue;
|
@@ -56242,6 +56207,9 @@ function nodeIsElement(node) {
|
|
56242
56207
|
return node.nodeName[0] !== "#";
|
56243
56208
|
}
|
56244
56209
|
function traverseNodes(node, visitor) {
|
56210
|
+
if (node.nodeName === "template") {
|
56211
|
+
node = node.content;
|
56212
|
+
}
|
56245
56213
|
visitor(node);
|
56246
56214
|
if (nodeIsElement(node) || node.nodeName === "#document" || node.nodeName === "#document-fragment") {
|
56247
56215
|
node.childNodes.forEach((childNode) => traverseNodes(childNode, visitor));
|
@@ -56352,7 +56320,6 @@ function buildHtmlPlugin(config) {
|
|
56352
56320
|
name: "vite:build-html",
|
56353
56321
|
async transform(html, id) {
|
56354
56322
|
if (id.endsWith(".html")) {
|
56355
|
-
const { modulePreload } = this.environment.config.build;
|
56356
56323
|
id = normalizePath$3(id);
|
56357
56324
|
const relativeUrlPath = normalizePath$3(path$n.relative(config.root, id));
|
56358
56325
|
const publicPath = `/${relativeUrlPath}`;
|
@@ -56615,6 +56582,7 @@ import ${JSON.stringify(url)}`;
|
|
56615
56582
|
}
|
56616
56583
|
}
|
56617
56584
|
processedHtml.set(id, s.toString());
|
56585
|
+
const { modulePreload } = this.environment.config.build;
|
56618
56586
|
if (modulePreload !== false && modulePreload.polyfill && (someScriptsAreAsync || someScriptsAreDefer)) {
|
56619
56587
|
js = `import "${modulePreloadPolyfillId}";
|
56620
56588
|
${js}`;
|
@@ -56623,7 +56591,6 @@ ${js}`;
|
|
56623
56591
|
}
|
56624
56592
|
},
|
56625
56593
|
async generateBundle(options, bundle) {
|
56626
|
-
const { modulePreload } = this.environment.config.build;
|
56627
56594
|
const analyzedChunk = /* @__PURE__ */ new Map();
|
56628
56595
|
const inlineEntryChunk = /* @__PURE__ */ new Set();
|
56629
56596
|
const getImportedChunks = (chunk, seen = /* @__PURE__ */ new Set()) => {
|
@@ -56725,6 +56692,7 @@ ${js}`;
|
|
56725
56692
|
(chunk2) => toScriptTag(chunk2, toOutputAssetFilePath, isAsync)
|
56726
56693
|
);
|
56727
56694
|
} else {
|
56695
|
+
const { modulePreload } = this.environment.config.build;
|
56728
56696
|
assetTags = [toScriptTag(chunk, toOutputAssetFilePath, isAsync)];
|
56729
56697
|
if (modulePreload !== false) {
|
56730
56698
|
const resolveDependencies = typeof modulePreload === "object" && modulePreload.resolveDependencies;
|
@@ -56743,7 +56711,7 @@ ${js}`;
|
|
56743
56711
|
assetTags.push(...getCssTagsForChunk(chunk, toOutputAssetFilePath));
|
56744
56712
|
result = injectToHead(result, assetTags);
|
56745
56713
|
}
|
56746
|
-
if (this.environment.config.build.cssCodeSplit
|
56714
|
+
if (!this.environment.config.build.cssCodeSplit) {
|
56747
56715
|
const cssChunk = Object.values(bundle).find(
|
56748
56716
|
(chunk2) => chunk2.type === "asset" && chunk2.name === "style.css"
|
56749
56717
|
);
|
@@ -58432,7 +58400,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
58432
58400
|
environments,
|
58433
58401
|
pluginContainer,
|
58434
58402
|
get moduleGraph() {
|
58435
|
-
warnFutureDeprecation(config, "
|
58403
|
+
warnFutureDeprecation(config, "removeServerModuleGraph");
|
58436
58404
|
return moduleGraph;
|
58437
58405
|
},
|
58438
58406
|
set moduleGraph(graph) {
|
@@ -58451,7 +58419,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
58451
58419
|
transformRequest(url, options2) {
|
58452
58420
|
warnFutureDeprecation(
|
58453
58421
|
config,
|
58454
|
-
"
|
58422
|
+
"removeServerTransformRequest",
|
58455
58423
|
"server.transformRequest() is deprecated. Use environment.transformRequest() instead."
|
58456
58424
|
);
|
58457
58425
|
const environment = server.environments[options2?.ssr ? "ssr" : "client"];
|
@@ -58475,7 +58443,7 @@ async function _createServer(inlineConfig = {}, options) {
|
|
58475
58443
|
return devHtmlTransformFn(server, url, html, originalUrl);
|
58476
58444
|
},
|
58477
58445
|
async ssrLoadModule(url, opts) {
|
58478
|
-
warnFutureDeprecation(config, "
|
58446
|
+
warnFutureDeprecation(config, "removeSsrLoadModule");
|
58479
58447
|
return ssrLoadModule(url, server, opts?.fixStacktrace);
|
58480
58448
|
},
|
58481
58449
|
ssrFixStacktrace(e) {
|
@@ -58495,16 +58463,6 @@ async function _createServer(inlineConfig = {}, options) {
|
|
58495
58463
|
);
|
58496
58464
|
}
|
58497
58465
|
},
|
58498
|
-
async reloadEnvironmentModule(module) {
|
58499
|
-
if (serverConfig.hmr !== false && module.file) {
|
58500
|
-
updateModules(
|
58501
|
-
environments[module.environment],
|
58502
|
-
module.file,
|
58503
|
-
[module],
|
58504
|
-
Date.now()
|
58505
|
-
);
|
58506
|
-
}
|
58507
|
-
},
|
58508
58466
|
async listen(port, isRestart) {
|
58509
58467
|
await startServer(server, port);
|
58510
58468
|
if (httpServer) {
|
@@ -59050,13 +59008,13 @@ async function handleHMRUpdate(type, file, server) {
|
|
59050
59008
|
if (filteredModules) {
|
59051
59009
|
clientHotUpdateOptions.modules = filteredModules;
|
59052
59010
|
mixedHmrContext.modules = mixedHmrContext.modules.filter(
|
59053
|
-
(mixedMod) => filteredModules.
|
59011
|
+
(mixedMod) => filteredModules.some((mod) => mixedMod.id === mod.id) || ssrHotUpdateOptions?.modules.some(
|
59054
59012
|
(ssrMod) => ssrMod.id === mixedMod.id
|
59055
59013
|
)
|
59056
59014
|
);
|
59057
59015
|
mixedHmrContext.modules.push(
|
59058
59016
|
...filteredModules.filter(
|
59059
|
-
(mod) => !mixedHmrContext.modules.
|
59017
|
+
(mod) => !mixedHmrContext.modules.some(
|
59060
59018
|
(mixedMod) => mixedMod.id === mod.id
|
59061
59019
|
)
|
59062
59020
|
).map(
|
@@ -59067,7 +59025,7 @@ async function handleHMRUpdate(type, file, server) {
|
|
59067
59025
|
} else if (type === "update") {
|
59068
59026
|
warnFutureDeprecation(
|
59069
59027
|
config,
|
59070
|
-
"
|
59028
|
+
"removePluginHookHandleHotUpdate",
|
59071
59029
|
`Used in plugin "${plugin.name}".`,
|
59072
59030
|
false
|
59073
59031
|
);
|
@@ -59077,22 +59035,22 @@ async function handleHMRUpdate(type, file, server) {
|
|
59077
59035
|
if (filteredModules) {
|
59078
59036
|
mixedHmrContext.modules = filteredModules;
|
59079
59037
|
clientHotUpdateOptions.modules = clientHotUpdateOptions.modules.filter(
|
59080
|
-
(mod) => filteredModules.
|
59038
|
+
(mod) => filteredModules.some((mixedMod) => mod.id === mixedMod.id)
|
59081
59039
|
);
|
59082
59040
|
clientHotUpdateOptions.modules.push(
|
59083
59041
|
...filteredModules.filter(
|
59084
|
-
(mixedMod) => !clientHotUpdateOptions.modules.
|
59042
|
+
(mixedMod) => !clientHotUpdateOptions.modules.some(
|
59085
59043
|
(mod) => mod.id === mixedMod.id
|
59086
59044
|
)
|
59087
59045
|
).map((mixedMod) => mixedMod._clientModule).filter(Boolean)
|
59088
59046
|
);
|
59089
59047
|
if (ssrHotUpdateOptions) {
|
59090
59048
|
ssrHotUpdateOptions.modules = ssrHotUpdateOptions.modules.filter(
|
59091
|
-
(mod) => filteredModules.
|
59049
|
+
(mod) => filteredModules.some((mixedMod) => mod.id === mixedMod.id)
|
59092
59050
|
);
|
59093
59051
|
ssrHotUpdateOptions.modules.push(
|
59094
59052
|
...filteredModules.filter(
|
59095
|
-
(mixedMod) => !ssrHotUpdateOptions.modules.
|
59053
|
+
(mixedMod) => !ssrHotUpdateOptions.modules.some(
|
59096
59054
|
(mod) => mod.id === mixedMod.id
|
59097
59055
|
)
|
59098
59056
|
).map((mixedMod) => mixedMod._ssrModule).filter(Boolean)
|
@@ -60079,7 +60037,7 @@ function preAliasPlugin(config) {
|
|
60079
60037
|
const { environment } = this;
|
60080
60038
|
const ssr = options?.ssr === true;
|
60081
60039
|
const depsOptimizer = environment.mode === "dev" ? environment.depsOptimizer : void 0;
|
60082
|
-
if (
|
60040
|
+
if (importer && depsOptimizer && bareImportRE.test(id) && !options?.scan && id !== "@vite/client" && id !== "@vite/env") {
|
60083
60041
|
if (findPatterns.find((pattern) => matches(pattern, id))) {
|
60084
60042
|
const optimizedId = await tryOptimizedResolve(
|
60085
60043
|
depsOptimizer,
|
@@ -60160,6 +60118,25 @@ const templateLiteralRE = /^\s*`(.*)`\s*$/;
|
|
60160
60118
|
function isExplicitImportRequired(url) {
|
60161
60119
|
return !isJSRequest(url) && !isCSSRequest(url);
|
60162
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
|
+
}
|
60163
60140
|
function extractImportedBindings(id, source, importSpec, importedBindings) {
|
60164
60141
|
let bindings = importedBindings.get(id);
|
60165
60142
|
if (!bindings) {
|
@@ -60204,7 +60181,6 @@ function extractImportedBindings(id, source, importSpec, importedBindings) {
|
|
60204
60181
|
}
|
60205
60182
|
function importAnalysisPlugin(config) {
|
60206
60183
|
const { root, base } = config;
|
60207
|
-
const fsUtils = getFsUtils(config);
|
60208
60184
|
const clientPublicPath = path$n.posix.join(base, CLIENT_PUBLIC_PATH);
|
60209
60185
|
const enablePartialAccept = config.experimental?.hmrPartialAccept;
|
60210
60186
|
const matchAlias = getAliasPatternMatcher(config.resolve.alias);
|
@@ -60311,20 +60287,8 @@ function importAnalysisPlugin(config) {
|
|
60311
60287
|
}
|
60312
60288
|
const isRelative = url[0] === ".";
|
60313
60289
|
const isSelfImport = !isRelative && cleanUrl(url) === cleanUrl(importer);
|
60314
|
-
|
60315
|
-
|
60316
|
-
} else if (depsOptimizer?.isOptimizedDepFile(resolved.id) || // vite-plugin-react isn't following the leading \0 virtual module convention.
|
60317
|
-
// This is a temporary hack to avoid expensive fs checks for React apps.
|
60318
|
-
// We'll remove this as soon we're able to fix the react plugins.
|
60319
|
-
resolved.id !== "/@react-refresh" && path$n.isAbsolute(resolved.id) && fsUtils.existsSync(cleanUrl(resolved.id))) {
|
60320
|
-
url = path$n.posix.join(FS_PREFIX, resolved.id);
|
60321
|
-
} else {
|
60322
|
-
url = resolved.id;
|
60323
|
-
}
|
60324
|
-
if (url[0] !== "." && url[0] !== "/") {
|
60325
|
-
url = wrapId$1(resolved.id);
|
60326
|
-
}
|
60327
|
-
if (environment.config.injectInvalidationTimestamp) {
|
60290
|
+
url = normalizeResolvedIdToUrl(environment, url, resolved);
|
60291
|
+
if (environment.config.consumer === "client") {
|
60328
60292
|
if (isExplicitImportRequired(url)) {
|
60329
60293
|
url = injectQuery(url, "import");
|
60330
60294
|
} else if ((isRelative || isSelfImport) && !DEP_VERSION_RE.test(url)) {
|
@@ -61005,7 +60969,7 @@ function workerImportMetaUrlPlugin(config) {
|
|
61005
60969
|
file = path$n.resolve(path$n.dirname(id), url);
|
61006
60970
|
file = tryFsResolve(file, fsResolveOptions) ?? file;
|
61007
60971
|
} else {
|
61008
|
-
workerResolver ??=
|
60972
|
+
workerResolver ??= createBackCompatIdResolver(config, {
|
61009
60973
|
extensions: [],
|
61010
60974
|
tryIndex: false,
|
61011
60975
|
preferRelative: true
|
@@ -61103,7 +61067,7 @@ function assetImportMetaUrlPlugin(config) {
|
|
61103
61067
|
file = slash$1(path$n.resolve(path$n.dirname(id), url));
|
61104
61068
|
file = tryFsResolve(file, fsResolveOptions) ?? file;
|
61105
61069
|
} else {
|
61106
|
-
assetResolver ??=
|
61070
|
+
assetResolver ??= createBackCompatIdResolver(config, {
|
61107
61071
|
extensions: [],
|
61108
61072
|
mainFields: [],
|
61109
61073
|
tryIndex: false,
|
@@ -61429,7 +61393,7 @@ async function transformDynamicImport(importSource, importer, resolve, root) {
|
|
61429
61393
|
};
|
61430
61394
|
}
|
61431
61395
|
function dynamicImportVarsPlugin(config) {
|
61432
|
-
const resolve =
|
61396
|
+
const resolve = createBackCompatIdResolver(config, {
|
61433
61397
|
preferRelative: true,
|
61434
61398
|
tryIndex: false,
|
61435
61399
|
extensions: []
|
@@ -61700,6 +61664,7 @@ class EnvironmentPluginContainer {
|
|
61700
61664
|
watchFiles = /* @__PURE__ */ new Set();
|
61701
61665
|
minimalContext;
|
61702
61666
|
_started = false;
|
61667
|
+
_buildStartPromise;
|
61703
61668
|
_closed = false;
|
61704
61669
|
_updateModuleLoadAddedImports(id, addedImports) {
|
61705
61670
|
const module = this.moduleGraph?.getModuleById(id);
|
@@ -61711,6 +61676,33 @@ class EnvironmentPluginContainer {
|
|
61711
61676
|
const module = this.moduleGraph?.getModuleById(id);
|
61712
61677
|
return module ? this._moduleNodeToLoadAddedImports.get(module) || null : null;
|
61713
61678
|
}
|
61679
|
+
getModuleInfo(id) {
|
61680
|
+
const module = this.moduleGraph?.getModuleById(id);
|
61681
|
+
if (!module) {
|
61682
|
+
return null;
|
61683
|
+
}
|
61684
|
+
if (!module.info) {
|
61685
|
+
module.info = new Proxy(
|
61686
|
+
{ id, meta: module.meta || EMPTY_OBJECT },
|
61687
|
+
// throw when an unsupported ModuleInfo property is accessed,
|
61688
|
+
// so that incompatible plugins fail in a non-cryptic way.
|
61689
|
+
{
|
61690
|
+
get(info, key) {
|
61691
|
+
if (key in info) {
|
61692
|
+
return info[key];
|
61693
|
+
}
|
61694
|
+
if (key === "then") {
|
61695
|
+
return void 0;
|
61696
|
+
}
|
61697
|
+
throw Error(
|
61698
|
+
`[vite] The "${key}" property of ModuleInfo is not supported.`
|
61699
|
+
);
|
61700
|
+
}
|
61701
|
+
}
|
61702
|
+
);
|
61703
|
+
}
|
61704
|
+
return module.info ?? null;
|
61705
|
+
}
|
61714
61706
|
// keeps track of hook promises so that we can wait for them all to finish upon closing the server
|
61715
61707
|
handleHookPromise(maybePromise) {
|
61716
61708
|
if (!maybePromise?.then) {
|
@@ -61764,10 +61756,13 @@ class EnvironmentPluginContainer {
|
|
61764
61756
|
}
|
61765
61757
|
async buildStart(_options) {
|
61766
61758
|
if (this._started) {
|
61767
|
-
|
61759
|
+
if (this._buildStartPromise) {
|
61760
|
+
await this._buildStartPromise;
|
61761
|
+
}
|
61768
61762
|
return;
|
61769
61763
|
}
|
61770
|
-
this._started =
|
61764
|
+
this._started = true;
|
61765
|
+
this._buildStartPromise = this.handleHookPromise(
|
61771
61766
|
this.hookParallel(
|
61772
61767
|
"buildStart",
|
61773
61768
|
(plugin) => this._getPluginContext(plugin),
|
@@ -61775,8 +61770,8 @@ class EnvironmentPluginContainer {
|
|
61775
61770
|
(plugin) => this.environment.name === "client" || plugin.perEnvironmentStartEndDuringDev === true
|
61776
61771
|
)
|
61777
61772
|
);
|
61778
|
-
await this.
|
61779
|
-
this.
|
61773
|
+
await this._buildStartPromise;
|
61774
|
+
this._buildStartPromise = void 0;
|
61780
61775
|
}
|
61781
61776
|
async resolveId(rawId, importer = join$2(
|
61782
61777
|
this.environment.config.root,
|
@@ -61784,9 +61779,7 @@ class EnvironmentPluginContainer {
|
|
61784
61779
|
), options) {
|
61785
61780
|
if (!this._started) {
|
61786
61781
|
this.buildStart();
|
61787
|
-
|
61788
|
-
if (this._started !== true) {
|
61789
|
-
await this._started;
|
61782
|
+
await this._buildStartPromise;
|
61790
61783
|
}
|
61791
61784
|
const skip = options?.skip;
|
61792
61785
|
const scan = !!options?.scan;
|
@@ -61985,31 +61978,7 @@ class PluginContext {
|
|
61985
61978
|
return moduleInfo;
|
61986
61979
|
}
|
61987
61980
|
getModuleInfo(id) {
|
61988
|
-
|
61989
|
-
if (!module) {
|
61990
|
-
return null;
|
61991
|
-
}
|
61992
|
-
if (!module.info) {
|
61993
|
-
module.info = new Proxy(
|
61994
|
-
{ id, meta: module.meta || EMPTY_OBJECT },
|
61995
|
-
// throw when an unsupported ModuleInfo property is accessed,
|
61996
|
-
// so that incompatible plugins fail in a non-cryptic way.
|
61997
|
-
{
|
61998
|
-
get(info, key) {
|
61999
|
-
if (key in info) {
|
62000
|
-
return info[key];
|
62001
|
-
}
|
62002
|
-
if (key === "then") {
|
62003
|
-
return void 0;
|
62004
|
-
}
|
62005
|
-
throw Error(
|
62006
|
-
`[vite] The "${key}" property of ModuleInfo is not supported.`
|
62007
|
-
);
|
62008
|
-
}
|
62009
|
-
}
|
62010
|
-
);
|
62011
|
-
}
|
62012
|
-
return module.info ?? null;
|
61981
|
+
return this._container.getModuleInfo(id);
|
62013
61982
|
}
|
62014
61983
|
_updateModuleInfo(id, { meta }) {
|
62015
61984
|
if (meta) {
|
@@ -62271,6 +62240,11 @@ class PluginContainer {
|
|
62271
62240
|
_getPluginContainer(options) {
|
62272
62241
|
return this._getEnvironment(options).pluginContainer;
|
62273
62242
|
}
|
62243
|
+
getModuleInfo(id) {
|
62244
|
+
return this.environments.client.pluginContainer.getModuleInfo(id) || this.environments.ssr.pluginContainer.getModuleInfo(
|
62245
|
+
id
|
62246
|
+
);
|
62247
|
+
}
|
62274
62248
|
get options() {
|
62275
62249
|
return this.environments.client.pluginContainer.options;
|
62276
62250
|
}
|
@@ -62303,6 +62277,17 @@ function createPluginContainer(environments) {
|
|
62303
62277
|
return new PluginContainer(environments);
|
62304
62278
|
}
|
62305
62279
|
|
62280
|
+
function createBackCompatIdResolver(config, options) {
|
62281
|
+
const compatResolve = config.createResolver(options);
|
62282
|
+
let resolve;
|
62283
|
+
return async (environment, id, importer, aliasOnly) => {
|
62284
|
+
if (environment.name === "client" || environment.name === "ssr") {
|
62285
|
+
return compatResolve(id, importer, aliasOnly, environment.name === "ssr");
|
62286
|
+
}
|
62287
|
+
resolve ??= createIdResolver(config, options);
|
62288
|
+
return resolve(environment, id, importer, aliasOnly);
|
62289
|
+
};
|
62290
|
+
}
|
62306
62291
|
function createIdResolver(config, options) {
|
62307
62292
|
const scan = options?.scan;
|
62308
62293
|
const pluginContainerMap = /* @__PURE__ */ new Map();
|
@@ -62389,7 +62374,7 @@ const cssUrlAssetRE = /__VITE_CSS_URL__([\da-f]+)__/g;
|
|
62389
62374
|
function cssPlugin(config) {
|
62390
62375
|
const isBuild = config.command === "build";
|
62391
62376
|
let moduleCache;
|
62392
|
-
const idResolver =
|
62377
|
+
const idResolver = createBackCompatIdResolver(config, {
|
62393
62378
|
preferRelative: true,
|
62394
62379
|
tryIndex: false,
|
62395
62380
|
extensions: []
|
@@ -62907,9 +62892,8 @@ function cssAnalysisPlugin(config) {
|
|
62907
62892
|
if (!isCSSRequest(id) || commonjsProxyRE.test(id) || SPECIAL_QUERY_RE.test(id)) {
|
62908
62893
|
return;
|
62909
62894
|
}
|
62910
|
-
const
|
62911
|
-
const
|
62912
|
-
const thisModule = moduleGraph?.getModuleById(id);
|
62895
|
+
const { moduleGraph } = this.environment;
|
62896
|
+
const thisModule = moduleGraph.getModuleById(id);
|
62913
62897
|
if (thisModule) {
|
62914
62898
|
const isSelfAccepting = !cssModulesCache.get(config)?.get(id) && !inlineRE.test(id) && !htmlProxyRE.test(id);
|
62915
62899
|
const pluginImports = this._addedImports;
|
@@ -62962,7 +62946,7 @@ function createCSSResolvers(config) {
|
|
62962
62946
|
let lessResolve;
|
62963
62947
|
return {
|
62964
62948
|
get css() {
|
62965
|
-
return cssResolve ??=
|
62949
|
+
return cssResolve ??= createBackCompatIdResolver(config, {
|
62966
62950
|
extensions: [".css"],
|
62967
62951
|
mainFields: ["style"],
|
62968
62952
|
conditions: ["style"],
|
@@ -62972,7 +62956,7 @@ function createCSSResolvers(config) {
|
|
62972
62956
|
},
|
62973
62957
|
get sass() {
|
62974
62958
|
if (!sassResolve) {
|
62975
|
-
const resolver =
|
62959
|
+
const resolver = createBackCompatIdResolver(config, {
|
62976
62960
|
extensions: [".scss", ".sass", ".css"],
|
62977
62961
|
mainFields: ["sass", "style"],
|
62978
62962
|
conditions: ["sass", "style"],
|
@@ -62981,12 +62965,8 @@ function createCSSResolvers(config) {
|
|
62981
62965
|
preferRelative: true
|
62982
62966
|
});
|
62983
62967
|
sassResolve = async (...args) => {
|
62984
|
-
|
62985
|
-
|
62986
|
-
const fileUrl = new URL(id);
|
62987
|
-
if (fs__default.existsSync(fileUrl)) {
|
62988
|
-
return fileURLToPath(fileUrl);
|
62989
|
-
}
|
62968
|
+
if (args[1].startsWith("file://")) {
|
62969
|
+
args[1] = fileURLToPath(args[1]);
|
62990
62970
|
}
|
62991
62971
|
return resolver(...args);
|
62992
62972
|
};
|
@@ -62994,7 +62974,7 @@ function createCSSResolvers(config) {
|
|
62994
62974
|
return sassResolve;
|
62995
62975
|
},
|
62996
62976
|
get less() {
|
62997
|
-
return lessResolve ??=
|
62977
|
+
return lessResolve ??= createBackCompatIdResolver(config, {
|
62998
62978
|
extensions: [".less", ".css"],
|
62999
62979
|
mainFields: ["less", "style"],
|
63000
62980
|
conditions: ["less", "style"],
|
@@ -63301,8 +63281,8 @@ function createCachedImport(imp) {
|
|
63301
63281
|
return cached;
|
63302
63282
|
};
|
63303
63283
|
}
|
63304
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
63305
|
-
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; }));
|
63306
63286
|
const importPostcss = createCachedImport(() => import('postcss'));
|
63307
63287
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
63308
63288
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -63653,7 +63633,7 @@ function fixScssBugImportValue(data) {
|
|
63653
63633
|
}
|
63654
63634
|
return data;
|
63655
63635
|
}
|
63656
|
-
const makeScssWorker = (environment, resolvers, alias, maxWorkers) => {
|
63636
|
+
const makeScssWorker = (environment, resolvers, alias, maxWorkers, packageName) => {
|
63657
63637
|
const internalImporter = async (url, importer, filename) => {
|
63658
63638
|
importer = cleanScssBugUrl(importer);
|
63659
63639
|
const resolved = await resolvers.sass(environment, url, importer);
|
@@ -63667,6 +63647,9 @@ const makeScssWorker = (environment, resolvers, alias, maxWorkers) => {
|
|
63667
63647
|
"$",
|
63668
63648
|
resolvers.sass
|
63669
63649
|
);
|
63650
|
+
if (packageName === "sass-embedded") {
|
63651
|
+
return data;
|
63652
|
+
}
|
63670
63653
|
return fixScssBugImportValue(data);
|
63671
63654
|
} catch (data) {
|
63672
63655
|
return data;
|
@@ -63887,7 +63870,8 @@ const scssProcessor = (maxWorkers) => {
|
|
63887
63870
|
environment,
|
63888
63871
|
resolvers,
|
63889
63872
|
options.alias,
|
63890
|
-
maxWorkers
|
63873
|
+
maxWorkers,
|
63874
|
+
sassPackage.name
|
63891
63875
|
)
|
63892
63876
|
);
|
63893
63877
|
}
|
@@ -63910,6 +63894,11 @@ const scssProcessor = (maxWorkers) => {
|
|
63910
63894
|
);
|
63911
63895
|
const deps = result.stats.includedFiles.map((f) => cleanScssBugUrl(f));
|
63912
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
|
+
}
|
63913
63902
|
return {
|
63914
63903
|
code: result.css.toString(),
|
63915
63904
|
map: map2,
|
@@ -64484,8 +64473,8 @@ function preload(baseModule, deps, importerUrl) {
|
|
64484
64473
|
link.rel = isCss ? "stylesheet" : scriptRel;
|
64485
64474
|
if (!isCss) {
|
64486
64475
|
link.as = "script";
|
64487
|
-
link.crossOrigin = "";
|
64488
64476
|
}
|
64477
|
+
link.crossOrigin = "";
|
64489
64478
|
link.href = dep;
|
64490
64479
|
if (cspNonce) {
|
64491
64480
|
link.setAttribute("nonce", cspNonce);
|
@@ -64528,9 +64517,8 @@ function buildImportAnalysisPlugin(config) {
|
|
64528
64517
|
}
|
64529
64518
|
},
|
64530
64519
|
load(id) {
|
64531
|
-
|
64532
|
-
|
64533
|
-
const { modulePreload } = environment.config.build;
|
64520
|
+
if (id === preloadHelperId) {
|
64521
|
+
const { modulePreload } = this.environment.config.build;
|
64534
64522
|
const scriptRel2 = modulePreload && modulePreload.polyfill ? `'modulepreload'` : `(${detectScriptRel.toString()})()`;
|
64535
64523
|
const assetsURL2 = renderBuiltUrl || isRelativeBase ? (
|
64536
64524
|
// If `experimental.renderBuiltUrl` is used, the dependencies might be relative to the current chunk.
|
@@ -64547,7 +64535,6 @@ function buildImportAnalysisPlugin(config) {
|
|
64547
64535
|
}
|
64548
64536
|
},
|
64549
64537
|
async transform(source, importer) {
|
64550
|
-
const { environment } = this;
|
64551
64538
|
if (isInNodeModules$1(importer) && !dynamicImportPrefixRE.test(source)) {
|
64552
64539
|
return;
|
64553
64540
|
}
|
@@ -64630,16 +64617,15 @@ function buildImportAnalysisPlugin(config) {
|
|
64630
64617
|
if (s) {
|
64631
64618
|
return {
|
64632
64619
|
code: s.toString(),
|
64633
|
-
map: environment.config.build.sourcemap ? s.generateMap({ hires: "boundary" }) : null
|
64620
|
+
map: this.environment.config.build.sourcemap ? s.generateMap({ hires: "boundary" }) : null
|
64634
64621
|
};
|
64635
64622
|
}
|
64636
64623
|
},
|
64637
64624
|
renderChunk(code, _, { format }) {
|
64638
|
-
|
64639
|
-
if (environment && code.indexOf(isModernFlag) > -1) {
|
64625
|
+
if (code.indexOf(isModernFlag) > -1) {
|
64640
64626
|
const re = new RegExp(isModernFlag, "g");
|
64641
64627
|
const isModern = String(format === "es");
|
64642
|
-
if (environment.config.build.sourcemap) {
|
64628
|
+
if (this.environment.config.build.sourcemap) {
|
64643
64629
|
const s = new MagicString(code);
|
64644
64630
|
let match;
|
64645
64631
|
while (match = re.exec(code)) {
|
@@ -65007,7 +64993,7 @@ function ssrManifestPlugin() {
|
|
65007
64993
|
|
65008
64994
|
function buildLoadFallbackPlugin() {
|
65009
64995
|
return {
|
65010
|
-
name: "vite:
|
64996
|
+
name: "vite:load-fallback",
|
65011
64997
|
async load(id) {
|
65012
64998
|
try {
|
65013
64999
|
const cleanedId = cleanUrl(id);
|
@@ -65941,7 +65927,7 @@ async function fetchModule(environment, url, importer, options = {}) {
|
|
65941
65927
|
if (isExternalUrl(url)) {
|
65942
65928
|
return { externalize: url, type: "network" };
|
65943
65929
|
}
|
65944
|
-
if (url[0] !== "." && url[0] !== "/") {
|
65930
|
+
if (importer && url[0] !== "." && url[0] !== "/") {
|
65945
65931
|
const { isProduction, root } = environment.config;
|
65946
65932
|
const { externalConditions, dedupe, preserveSymlinks } = environment.config.resolve;
|
65947
65933
|
const resolved = tryNodeResolve(
|
@@ -65982,6 +65968,13 @@ async function fetchModule(environment, url, importer, options = {}) {
|
|
65982
65968
|
const type = isFilePathESM(resolved.id, environment.config.packageCache) ? "module" : "commonjs";
|
65983
65969
|
return { externalize: file, type };
|
65984
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
|
+
}
|
65985
65978
|
url = unwrapId$1(url);
|
65986
65979
|
let mod = await environment.moduleGraph.getModuleByUrl(url);
|
65987
65980
|
const cached = !!mod?.transformResult;
|
@@ -66986,11 +66979,18 @@ class DevEnvironment extends BaseEnvironment {
|
|
66986
66979
|
...options
|
66987
66980
|
});
|
66988
66981
|
}
|
66982
|
+
async reloadModule(module) {
|
66983
|
+
if (this.config.server.hmr !== false && module.file) {
|
66984
|
+
updateModules(this, module.file, [module], Date.now());
|
66985
|
+
}
|
66986
|
+
}
|
66989
66987
|
transformRequest(url) {
|
66990
66988
|
return transformRequest(this, url);
|
66991
66989
|
}
|
66992
66990
|
async warmupRequest(url) {
|
66993
|
-
|
66991
|
+
try {
|
66992
|
+
await this.transformRequest(url);
|
66993
|
+
} catch (e) {
|
66994
66994
|
if (e?.code === ERR_OUTDATED_OPTIMIZED_DEP || e?.code === ERR_CLOSED_SERVER) {
|
66995
66995
|
return;
|
66996
66996
|
}
|
@@ -66998,7 +66998,7 @@ class DevEnvironment extends BaseEnvironment {
|
|
66998
66998
|
error: e,
|
66999
66999
|
timestamp: true
|
67000
67000
|
});
|
67001
|
-
}
|
67001
|
+
}
|
67002
67002
|
}
|
67003
67003
|
async close() {
|
67004
67004
|
this._closing = true;
|
@@ -67090,14 +67090,14 @@ function setupOnCrawlEnd(onCrawlEnd) {
|
|
67090
67090
|
if (ignoredId) {
|
67091
67091
|
seenIds.add(ignoredId);
|
67092
67092
|
markIdAsDone(ignoredId);
|
67093
|
+
} else {
|
67094
|
+
checkIfCrawlEndAfterTimeout();
|
67093
67095
|
}
|
67094
67096
|
return onCrawlEndPromiseWithResolvers.promise;
|
67095
67097
|
}
|
67096
67098
|
function markIdAsDone(id) {
|
67097
|
-
|
67098
|
-
|
67099
|
-
checkIfCrawlEndAfterTimeout();
|
67100
|
-
}
|
67099
|
+
registeredIds.delete(id);
|
67100
|
+
checkIfCrawlEndAfterTimeout();
|
67101
67101
|
}
|
67102
67102
|
function checkIfCrawlEndAfterTimeout() {
|
67103
67103
|
if (cancelled || registeredIds.size > 0) return;
|
@@ -67119,6 +67119,11 @@ function setupOnCrawlEnd(onCrawlEnd) {
|
|
67119
67119
|
}
|
67120
67120
|
|
67121
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
|
+
}
|
67122
67127
|
return new DevEnvironment(name, config, {
|
67123
67128
|
...context,
|
67124
67129
|
runner: {
|
@@ -67441,15 +67446,19 @@ function resolveDevEnvironmentOptions(dev, preserverSymlinks, environmentName, c
|
|
67441
67446
|
moduleRunnerTransform: dev?.moduleRunnerTransform ?? (skipSsrTransform !== void 0 && consumer === "server" ? skipSsrTransform : consumer === "server")
|
67442
67447
|
};
|
67443
67448
|
}
|
67444
|
-
function resolveEnvironmentOptions(options, resolvedRoot, logger, environmentName, skipSsrTransform) {
|
67445
|
-
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
|
+
);
|
67446
67456
|
const isClientEnvironment = environmentName === "client";
|
67447
67457
|
const consumer = options.consumer ?? isClientEnvironment ? "client" : "server";
|
67448
67458
|
return {
|
67449
67459
|
resolve,
|
67450
67460
|
consumer,
|
67451
67461
|
webCompatible: options.webCompatible ?? consumer === "client",
|
67452
|
-
injectInvalidationTimestamp: options.injectInvalidationTimestamp ?? consumer === "client",
|
67453
67462
|
dev: resolveDevEnvironmentOptions(
|
67454
67463
|
options.dev,
|
67455
67464
|
resolve.preserveSymlinks,
|
@@ -67479,7 +67488,6 @@ function getDefaultResolvedEnvironmentOptions(config) {
|
|
67479
67488
|
resolve: config.resolve,
|
67480
67489
|
consumer: "server",
|
67481
67490
|
webCompatible: false,
|
67482
|
-
injectInvalidationTimestamp: false,
|
67483
67491
|
dev: config.dev,
|
67484
67492
|
build: config.build
|
67485
67493
|
};
|
@@ -67514,10 +67522,7 @@ const clientAlias = [
|
|
67514
67522
|
replacement: path$n.posix.join(FS_PREFIX, normalizePath$3(CLIENT_ENTRY))
|
67515
67523
|
}
|
67516
67524
|
];
|
67517
|
-
function resolveEnvironmentResolveOptions(resolve, logger) {
|
67518
|
-
const resolvedAlias = normalizeAlias(
|
67519
|
-
mergeAlias(clientAlias, resolve?.alias || [])
|
67520
|
-
);
|
67525
|
+
function resolveEnvironmentResolveOptions(resolve, alias, preserveSymlinks, logger) {
|
67521
67526
|
const resolvedResolve = {
|
67522
67527
|
mainFields: resolve?.mainFields ?? DEFAULT_MAIN_FIELDS,
|
67523
67528
|
conditions: resolve?.conditions ?? [],
|
@@ -67526,8 +67531,8 @@ function resolveEnvironmentResolveOptions(resolve, logger) {
|
|
67526
67531
|
noExternal: resolve?.noExternal ?? [],
|
67527
67532
|
extensions: resolve?.extensions ?? DEFAULT_EXTENSIONS,
|
67528
67533
|
dedupe: resolve?.dedupe ?? [],
|
67529
|
-
preserveSymlinks
|
67530
|
-
alias
|
67534
|
+
preserveSymlinks,
|
67535
|
+
alias
|
67531
67536
|
};
|
67532
67537
|
if (
|
67533
67538
|
// @ts-expect-error removed field
|
@@ -67541,6 +67546,16 @@ function resolveEnvironmentResolveOptions(resolve, logger) {
|
|
67541
67546
|
}
|
67542
67547
|
return resolvedResolve;
|
67543
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
|
+
}
|
67544
67559
|
function resolveDepOptimizationOptions(optimizeDeps, preserveSymlinks, consumer) {
|
67545
67560
|
optimizeDeps ??= {};
|
67546
67561
|
return {
|
@@ -67552,7 +67567,6 @@ function resolveDepOptimizationOptions(optimizeDeps, preserveSymlinks, consumer)
|
|
67552
67567
|
holdUntilCrawlEnd: optimizeDeps.holdUntilCrawlEnd ?? true,
|
67553
67568
|
esbuildOptions: {
|
67554
67569
|
preserveSymlinks,
|
67555
|
-
// TODO: ?
|
67556
67570
|
...optimizeDeps.esbuildOptions
|
67557
67571
|
},
|
67558
67572
|
disabled: optimizeDeps.disabled,
|
@@ -67673,24 +67687,23 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
67673
67687
|
);
|
67674
67688
|
}
|
67675
67689
|
await runConfigEnvironmentHook(config.environments, userPlugins, configEnv);
|
67690
|
+
const resolvedDefaultResolve = resolveResolveOptions(config.resolve, logger);
|
67676
67691
|
const resolvedEnvironments = {};
|
67677
67692
|
for (const environmentName of Object.keys(config.environments)) {
|
67678
67693
|
resolvedEnvironments[environmentName] = resolveEnvironmentOptions(
|
67679
67694
|
config.environments[environmentName],
|
67680
67695
|
resolvedRoot,
|
67696
|
+
resolvedDefaultResolve.alias,
|
67697
|
+
resolvedDefaultResolve.preserveSymlinks,
|
67681
67698
|
logger,
|
67682
67699
|
environmentName,
|
67683
67700
|
config.experimental?.skipSsrTransform
|
67684
67701
|
);
|
67685
67702
|
}
|
67686
|
-
const resolvedDefaultEnvironmentResolve = resolveEnvironmentResolveOptions(
|
67687
|
-
config.resolve,
|
67688
|
-
logger
|
67689
|
-
);
|
67690
67703
|
const backwardCompatibleOptimizeDeps = resolvedEnvironments.client.dev.optimizeDeps;
|
67691
67704
|
const resolvedDevEnvironmentOptions = resolveDevEnvironmentOptions(
|
67692
67705
|
config.dev,
|
67693
|
-
|
67706
|
+
resolvedDefaultResolve.preserveSymlinks,
|
67694
67707
|
// default environment options
|
67695
67708
|
void 0,
|
67696
67709
|
void 0
|
@@ -67714,7 +67727,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
67714
67727
|
};
|
67715
67728
|
const ssr = resolveSSROptions(
|
67716
67729
|
patchedConfigSsr,
|
67717
|
-
|
67730
|
+
resolvedDefaultResolve.preserveSymlinks
|
67718
67731
|
);
|
67719
67732
|
const envDir = config.envDir ? normalizePath$3(path$n.resolve(resolvedRoot, config.envDir)) : resolvedRoot;
|
67720
67733
|
const userEnv = inlineConfig.envFile !== false && loadEnv(mode, envDir, resolveEnvPrefix(config));
|
@@ -67847,8 +67860,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
67847
67860
|
// Backward compatibility, users should use environment.config.dev.optimizeDeps
|
67848
67861
|
optimizeDeps: backwardCompatibleOptimizeDeps,
|
67849
67862
|
ssr,
|
67850
|
-
|
67851
|
-
resolve: resolvedDefaultEnvironmentResolve,
|
67863
|
+
resolve: resolvedDefaultResolve,
|
67852
67864
|
dev: resolvedDevEnvironmentOptions,
|
67853
67865
|
build: resolvedBuildOptions,
|
67854
67866
|
environments: resolvedEnvironments,
|
@@ -67862,56 +67874,20 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
67862
67874
|
* optimizer & handling css @imports
|
67863
67875
|
*/
|
67864
67876
|
createResolver(options) {
|
67865
|
-
const
|
67866
|
-
const
|
67867
|
-
|
67868
|
-
|
67869
|
-
|
67870
|
-
|
67871
|
-
|
67872
|
-
|
67877
|
+
const resolve = createIdResolver(this, options);
|
67878
|
+
const clientEnvironment = new PartialEnvironment("client", this);
|
67879
|
+
let ssrEnvironment;
|
67880
|
+
return async (id, importer, aliasOnly, ssr2) => {
|
67881
|
+
if (ssr2) {
|
67882
|
+
ssrEnvironment ??= new PartialEnvironment("ssr", this);
|
67883
|
+
}
|
67884
|
+
return await resolve(
|
67885
|
+
ssr2 ? ssrEnvironment : clientEnvironment,
|
67886
|
+
id,
|
67887
|
+
importer,
|
67888
|
+
aliasOnly
|
67873
67889
|
);
|
67874
|
-
await pluginContainer.buildStart({});
|
67875
|
-
return pluginContainer;
|
67876
67890
|
};
|
67877
|
-
async function resolve(id, importer, aliasOnly, ssr2) {
|
67878
|
-
const environmentName = ssr2 ? "ssr" : "client";
|
67879
|
-
let container;
|
67880
|
-
if (aliasOnly) {
|
67881
|
-
let aliasContainer = alias[environmentName];
|
67882
|
-
if (!aliasContainer) {
|
67883
|
-
aliasContainer = alias[environmentName] = await createPluginContainer(environmentName, [
|
67884
|
-
alias$1({ entries: resolved.resolve.alias })
|
67885
|
-
]);
|
67886
|
-
}
|
67887
|
-
container = aliasContainer;
|
67888
|
-
} else {
|
67889
|
-
let resolverContainer = resolver[environmentName];
|
67890
|
-
if (!resolverContainer) {
|
67891
|
-
resolverContainer = resolver[environmentName] = await createPluginContainer(environmentName, [
|
67892
|
-
alias$1({ entries: resolved.resolve.alias }),
|
67893
|
-
resolvePlugin(
|
67894
|
-
{
|
67895
|
-
...resolved.resolve,
|
67896
|
-
root: resolvedRoot,
|
67897
|
-
isProduction,
|
67898
|
-
isBuild: command === "build",
|
67899
|
-
asSrc: true,
|
67900
|
-
preferRelative: false,
|
67901
|
-
tryIndex: true,
|
67902
|
-
...options,
|
67903
|
-
idOnly: true,
|
67904
|
-
fsUtils: getFsUtils(resolved)
|
67905
|
-
},
|
67906
|
-
environments
|
67907
|
-
)
|
67908
|
-
]);
|
67909
|
-
}
|
67910
|
-
container = resolverContainer;
|
67911
|
-
}
|
67912
|
-
return await container.resolveId(id, importer, { scan: options?.scan });
|
67913
|
-
}
|
67914
|
-
return async (id, importer, aliasOnly, ssr2) => (await resolve(id, importer, aliasOnly, ssr2))?.id;
|
67915
67891
|
},
|
67916
67892
|
fsDenyGlob: picomatch$4(
|
67917
67893
|
// matchBase: true does not work as it's documented
|
@@ -68305,4 +68281,4 @@ function optimizeDepsDisabledBackwardCompatibility(resolved, optimizeDeps, optim
|
|
68305
68281
|
}
|
68306
68282
|
}
|
68307
68283
|
|
68308
|
-
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 };
|