vite 6.0.0-alpha.22 → 6.0.0-alpha.23
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-Crhy8pEa.js} +198 -212
- package/dist/node/chunks/{dep-BzHfSPcV.js → dep-DuPPQ7KX.js} +1 -1
- package/dist/node/chunks/{dep-DGaPvi2R.js → dep-M7bVrye1.js} +1 -1
- package/dist/node/cli.js +6 -6
- package/dist/node/index.d.ts +5 -2
- package/dist/node/index.js +2 -2
- package/dist/node/module-runner.d.ts +2 -2
- package/dist/node/module-runner.js +12 -10
- package/package.json +1 -1
@@ -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;
|
@@ -33917,6 +33831,92 @@ var src$1 = rc;
|
|
33917
33831
|
|
33918
33832
|
var postcssrc = /*@__PURE__*/getDefaultExportFromCjs(src$1);
|
33919
33833
|
|
33834
|
+
function matches$1(pattern, importee) {
|
33835
|
+
if (pattern instanceof RegExp) {
|
33836
|
+
return pattern.test(importee);
|
33837
|
+
}
|
33838
|
+
if (importee.length < pattern.length) {
|
33839
|
+
return false;
|
33840
|
+
}
|
33841
|
+
if (importee === pattern) {
|
33842
|
+
return true;
|
33843
|
+
}
|
33844
|
+
// eslint-disable-next-line prefer-template
|
33845
|
+
return importee.startsWith(pattern + '/');
|
33846
|
+
}
|
33847
|
+
function getEntries({ entries, customResolver }) {
|
33848
|
+
if (!entries) {
|
33849
|
+
return [];
|
33850
|
+
}
|
33851
|
+
const resolverFunctionFromOptions = resolveCustomResolver(customResolver);
|
33852
|
+
if (Array.isArray(entries)) {
|
33853
|
+
return entries.map((entry) => {
|
33854
|
+
return {
|
33855
|
+
find: entry.find,
|
33856
|
+
replacement: entry.replacement,
|
33857
|
+
resolverFunction: resolveCustomResolver(entry.customResolver) || resolverFunctionFromOptions
|
33858
|
+
};
|
33859
|
+
});
|
33860
|
+
}
|
33861
|
+
return Object.entries(entries).map(([key, value]) => {
|
33862
|
+
return { find: key, replacement: value, resolverFunction: resolverFunctionFromOptions };
|
33863
|
+
});
|
33864
|
+
}
|
33865
|
+
function getHookFunction(hook) {
|
33866
|
+
if (typeof hook === 'function') {
|
33867
|
+
return hook;
|
33868
|
+
}
|
33869
|
+
if (hook && 'handler' in hook && typeof hook.handler === 'function') {
|
33870
|
+
return hook.handler;
|
33871
|
+
}
|
33872
|
+
return null;
|
33873
|
+
}
|
33874
|
+
function resolveCustomResolver(customResolver) {
|
33875
|
+
if (typeof customResolver === 'function') {
|
33876
|
+
return customResolver;
|
33877
|
+
}
|
33878
|
+
if (customResolver) {
|
33879
|
+
return getHookFunction(customResolver.resolveId);
|
33880
|
+
}
|
33881
|
+
return null;
|
33882
|
+
}
|
33883
|
+
function alias$1(options = {}) {
|
33884
|
+
const entries = getEntries(options);
|
33885
|
+
if (entries.length === 0) {
|
33886
|
+
return {
|
33887
|
+
name: 'alias',
|
33888
|
+
resolveId: () => null
|
33889
|
+
};
|
33890
|
+
}
|
33891
|
+
return {
|
33892
|
+
name: 'alias',
|
33893
|
+
async buildStart(inputOptions) {
|
33894
|
+
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)); }));
|
33895
|
+
},
|
33896
|
+
resolveId(importee, importer, resolveOptions) {
|
33897
|
+
// First match is supposed to be the correct one
|
33898
|
+
const matchedEntry = entries.find((entry) => matches$1(entry.find, importee));
|
33899
|
+
if (!matchedEntry) {
|
33900
|
+
return null;
|
33901
|
+
}
|
33902
|
+
const updatedId = importee.replace(matchedEntry.find, matchedEntry.replacement);
|
33903
|
+
if (matchedEntry.resolverFunction) {
|
33904
|
+
return matchedEntry.resolverFunction.call(this, updatedId, importer, resolveOptions);
|
33905
|
+
}
|
33906
|
+
return this.resolve(updatedId, importer, Object.assign({ skipSelf: true }, resolveOptions)).then((resolved) => {
|
33907
|
+
if (resolved)
|
33908
|
+
return resolved;
|
33909
|
+
if (!require$$0$4.isAbsolute(updatedId)) {
|
33910
|
+
this.warn(`rewrote ${importee} to ${updatedId} but was not an abolute path and was not handled by other plugins. ` +
|
33911
|
+
`This will lead to duplicated modules for the same path. ` +
|
33912
|
+
`To avoid duplicating modules, you should resolve to an absolute path.`);
|
33913
|
+
}
|
33914
|
+
return { id: updatedId };
|
33915
|
+
});
|
33916
|
+
}
|
33917
|
+
};
|
33918
|
+
}
|
33919
|
+
|
33920
33920
|
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
33921
|
|
33922
33922
|
const HASH_RE = /#/g;
|
@@ -35659,17 +35659,20 @@ function esbuildDepPlugin(environment, qualified, external) {
|
|
35659
35659
|
const allExternalTypes = extensions ? externalTypes.filter((type) => !extensions?.includes("." + type)) : externalTypes;
|
35660
35660
|
const esmPackageCache = /* @__PURE__ */ new Map();
|
35661
35661
|
const cjsPackageCache = /* @__PURE__ */ new Map();
|
35662
|
-
const _resolve =
|
35662
|
+
const _resolve = createBackCompatIdResolver(environment.getTopLevelConfig(), {
|
35663
35663
|
asSrc: false,
|
35664
35664
|
scan: true,
|
35665
35665
|
packageCache: esmPackageCache
|
35666
35666
|
});
|
35667
|
-
const _resolveRequire =
|
35668
|
-
|
35669
|
-
|
35670
|
-
|
35671
|
-
|
35672
|
-
|
35667
|
+
const _resolveRequire = createBackCompatIdResolver(
|
35668
|
+
environment.getTopLevelConfig(),
|
35669
|
+
{
|
35670
|
+
asSrc: false,
|
35671
|
+
isRequire: true,
|
35672
|
+
scan: true,
|
35673
|
+
packageCache: cjsPackageCache
|
35674
|
+
}
|
35675
|
+
);
|
35673
35676
|
const resolve = (id, importer, kind, resolveDir) => {
|
35674
35677
|
let _importer;
|
35675
35678
|
{
|
@@ -35921,7 +35924,7 @@ class PartialEnvironment {
|
|
35921
35924
|
}
|
35922
35925
|
);
|
35923
35926
|
const environment = colors$1.dim(`(${this.name})`);
|
35924
|
-
const colorIndex = [...
|
35927
|
+
const colorIndex = [...this.name].reduce((acc, c) => acc + c.charCodeAt(0), 0) % environmentColors.length;
|
35925
35928
|
const infoColor = environmentColors[colorIndex || 0];
|
35926
35929
|
this.logger = {
|
35927
35930
|
get hasWarned() {
|
@@ -35980,9 +35983,6 @@ class BaseEnvironment extends PartialEnvironment {
|
|
35980
35983
|
super(name, config, options);
|
35981
35984
|
}
|
35982
35985
|
}
|
35983
|
-
class FutureCompatEnvironment extends BaseEnvironment {
|
35984
|
-
mode = "futureCompat";
|
35985
|
-
}
|
35986
35986
|
const environmentColors = [
|
35987
35987
|
colors$1.blue,
|
35988
35988
|
colors$1.magenta,
|
@@ -37397,7 +37397,7 @@ function isScannable(id, extensions) {
|
|
37397
37397
|
|
37398
37398
|
function createOptimizeDepsIncludeResolver(environment) {
|
37399
37399
|
const topLevelConfig = environment.getTopLevelConfig();
|
37400
|
-
const resolve =
|
37400
|
+
const resolve = createBackCompatIdResolver(topLevelConfig, {
|
37401
37401
|
asSrc: false,
|
37402
37402
|
scan: true,
|
37403
37403
|
ssrOptimizeCheck: environment.config.consumer === "server",
|
@@ -45888,15 +45888,20 @@ function createServerModuleRunner(environment, options = {}) {
|
|
45888
45888
|
}
|
45889
45889
|
|
45890
45890
|
async function ssrLoadModule(url, server, fixStacktrace) {
|
45891
|
-
|
45891
|
+
server._ssrCompatModuleRunner ||= createServerModuleRunner(
|
45892
45892
|
server.environments.ssr,
|
45893
45893
|
{
|
45894
45894
|
sourcemapInterceptor: false,
|
45895
45895
|
hmr: false
|
45896
45896
|
}
|
45897
|
-
)
|
45897
|
+
);
|
45898
45898
|
url = unwrapId$1(url);
|
45899
|
-
return instantiateModule(
|
45899
|
+
return instantiateModule(
|
45900
|
+
url,
|
45901
|
+
server._ssrCompatModuleRunner,
|
45902
|
+
server,
|
45903
|
+
fixStacktrace
|
45904
|
+
);
|
45900
45905
|
}
|
45901
45906
|
async function instantiateModule(url, runner, server, fixStacktrace) {
|
45902
45907
|
const environment = server.environments.ssr;
|
@@ -56352,7 +56357,6 @@ function buildHtmlPlugin(config) {
|
|
56352
56357
|
name: "vite:build-html",
|
56353
56358
|
async transform(html, id) {
|
56354
56359
|
if (id.endsWith(".html")) {
|
56355
|
-
const { modulePreload } = this.environment.config.build;
|
56356
56360
|
id = normalizePath$3(id);
|
56357
56361
|
const relativeUrlPath = normalizePath$3(path$n.relative(config.root, id));
|
56358
56362
|
const publicPath = `/${relativeUrlPath}`;
|
@@ -56615,6 +56619,7 @@ import ${JSON.stringify(url)}`;
|
|
56615
56619
|
}
|
56616
56620
|
}
|
56617
56621
|
processedHtml.set(id, s.toString());
|
56622
|
+
const { modulePreload } = this.environment.config.build;
|
56618
56623
|
if (modulePreload !== false && modulePreload.polyfill && (someScriptsAreAsync || someScriptsAreDefer)) {
|
56619
56624
|
js = `import "${modulePreloadPolyfillId}";
|
56620
56625
|
${js}`;
|
@@ -56623,7 +56628,6 @@ ${js}`;
|
|
56623
56628
|
}
|
56624
56629
|
},
|
56625
56630
|
async generateBundle(options, bundle) {
|
56626
|
-
const { modulePreload } = this.environment.config.build;
|
56627
56631
|
const analyzedChunk = /* @__PURE__ */ new Map();
|
56628
56632
|
const inlineEntryChunk = /* @__PURE__ */ new Set();
|
56629
56633
|
const getImportedChunks = (chunk, seen = /* @__PURE__ */ new Set()) => {
|
@@ -56725,6 +56729,7 @@ ${js}`;
|
|
56725
56729
|
(chunk2) => toScriptTag(chunk2, toOutputAssetFilePath, isAsync)
|
56726
56730
|
);
|
56727
56731
|
} else {
|
56732
|
+
const { modulePreload } = this.environment.config.build;
|
56728
56733
|
assetTags = [toScriptTag(chunk, toOutputAssetFilePath, isAsync)];
|
56729
56734
|
if (modulePreload !== false) {
|
56730
56735
|
const resolveDependencies = typeof modulePreload === "object" && modulePreload.resolveDependencies;
|
@@ -56743,7 +56748,7 @@ ${js}`;
|
|
56743
56748
|
assetTags.push(...getCssTagsForChunk(chunk, toOutputAssetFilePath));
|
56744
56749
|
result = injectToHead(result, assetTags);
|
56745
56750
|
}
|
56746
|
-
if (this.environment.config.build.cssCodeSplit
|
56751
|
+
if (!this.environment.config.build.cssCodeSplit) {
|
56747
56752
|
const cssChunk = Object.values(bundle).find(
|
56748
56753
|
(chunk2) => chunk2.type === "asset" && chunk2.name === "style.css"
|
56749
56754
|
);
|
@@ -59050,13 +59055,13 @@ async function handleHMRUpdate(type, file, server) {
|
|
59050
59055
|
if (filteredModules) {
|
59051
59056
|
clientHotUpdateOptions.modules = filteredModules;
|
59052
59057
|
mixedHmrContext.modules = mixedHmrContext.modules.filter(
|
59053
|
-
(mixedMod) => filteredModules.
|
59058
|
+
(mixedMod) => filteredModules.some((mod) => mixedMod.id === mod.id) || ssrHotUpdateOptions?.modules.some(
|
59054
59059
|
(ssrMod) => ssrMod.id === mixedMod.id
|
59055
59060
|
)
|
59056
59061
|
);
|
59057
59062
|
mixedHmrContext.modules.push(
|
59058
59063
|
...filteredModules.filter(
|
59059
|
-
(mod) => !mixedHmrContext.modules.
|
59064
|
+
(mod) => !mixedHmrContext.modules.some(
|
59060
59065
|
(mixedMod) => mixedMod.id === mod.id
|
59061
59066
|
)
|
59062
59067
|
).map(
|
@@ -59077,22 +59082,22 @@ async function handleHMRUpdate(type, file, server) {
|
|
59077
59082
|
if (filteredModules) {
|
59078
59083
|
mixedHmrContext.modules = filteredModules;
|
59079
59084
|
clientHotUpdateOptions.modules = clientHotUpdateOptions.modules.filter(
|
59080
|
-
(mod) => filteredModules.
|
59085
|
+
(mod) => filteredModules.some((mixedMod) => mod.id === mixedMod.id)
|
59081
59086
|
);
|
59082
59087
|
clientHotUpdateOptions.modules.push(
|
59083
59088
|
...filteredModules.filter(
|
59084
|
-
(mixedMod) => !clientHotUpdateOptions.modules.
|
59089
|
+
(mixedMod) => !clientHotUpdateOptions.modules.some(
|
59085
59090
|
(mod) => mod.id === mixedMod.id
|
59086
59091
|
)
|
59087
59092
|
).map((mixedMod) => mixedMod._clientModule).filter(Boolean)
|
59088
59093
|
);
|
59089
59094
|
if (ssrHotUpdateOptions) {
|
59090
59095
|
ssrHotUpdateOptions.modules = ssrHotUpdateOptions.modules.filter(
|
59091
|
-
(mod) => filteredModules.
|
59096
|
+
(mod) => filteredModules.some((mixedMod) => mod.id === mixedMod.id)
|
59092
59097
|
);
|
59093
59098
|
ssrHotUpdateOptions.modules.push(
|
59094
59099
|
...filteredModules.filter(
|
59095
|
-
(mixedMod) => !ssrHotUpdateOptions.modules.
|
59100
|
+
(mixedMod) => !ssrHotUpdateOptions.modules.some(
|
59096
59101
|
(mod) => mod.id === mixedMod.id
|
59097
59102
|
)
|
59098
59103
|
).map((mixedMod) => mixedMod._ssrModule).filter(Boolean)
|
@@ -60079,7 +60084,7 @@ function preAliasPlugin(config) {
|
|
60079
60084
|
const { environment } = this;
|
60080
60085
|
const ssr = options?.ssr === true;
|
60081
60086
|
const depsOptimizer = environment.mode === "dev" ? environment.depsOptimizer : void 0;
|
60082
|
-
if (
|
60087
|
+
if (importer && depsOptimizer && bareImportRE.test(id) && !options?.scan && id !== "@vite/client" && id !== "@vite/env") {
|
60083
60088
|
if (findPatterns.find((pattern) => matches(pattern, id))) {
|
60084
60089
|
const optimizedId = await tryOptimizedResolve(
|
60085
60090
|
depsOptimizer,
|
@@ -61005,7 +61010,7 @@ function workerImportMetaUrlPlugin(config) {
|
|
61005
61010
|
file = path$n.resolve(path$n.dirname(id), url);
|
61006
61011
|
file = tryFsResolve(file, fsResolveOptions) ?? file;
|
61007
61012
|
} else {
|
61008
|
-
workerResolver ??=
|
61013
|
+
workerResolver ??= createBackCompatIdResolver(config, {
|
61009
61014
|
extensions: [],
|
61010
61015
|
tryIndex: false,
|
61011
61016
|
preferRelative: true
|
@@ -61103,7 +61108,7 @@ function assetImportMetaUrlPlugin(config) {
|
|
61103
61108
|
file = slash$1(path$n.resolve(path$n.dirname(id), url));
|
61104
61109
|
file = tryFsResolve(file, fsResolveOptions) ?? file;
|
61105
61110
|
} else {
|
61106
|
-
assetResolver ??=
|
61111
|
+
assetResolver ??= createBackCompatIdResolver(config, {
|
61107
61112
|
extensions: [],
|
61108
61113
|
mainFields: [],
|
61109
61114
|
tryIndex: false,
|
@@ -61429,7 +61434,7 @@ async function transformDynamicImport(importSource, importer, resolve, root) {
|
|
61429
61434
|
};
|
61430
61435
|
}
|
61431
61436
|
function dynamicImportVarsPlugin(config) {
|
61432
|
-
const resolve =
|
61437
|
+
const resolve = createBackCompatIdResolver(config, {
|
61433
61438
|
preferRelative: true,
|
61434
61439
|
tryIndex: false,
|
61435
61440
|
extensions: []
|
@@ -61700,6 +61705,7 @@ class EnvironmentPluginContainer {
|
|
61700
61705
|
watchFiles = /* @__PURE__ */ new Set();
|
61701
61706
|
minimalContext;
|
61702
61707
|
_started = false;
|
61708
|
+
_buildStartPromise;
|
61703
61709
|
_closed = false;
|
61704
61710
|
_updateModuleLoadAddedImports(id, addedImports) {
|
61705
61711
|
const module = this.moduleGraph?.getModuleById(id);
|
@@ -61711,6 +61717,33 @@ class EnvironmentPluginContainer {
|
|
61711
61717
|
const module = this.moduleGraph?.getModuleById(id);
|
61712
61718
|
return module ? this._moduleNodeToLoadAddedImports.get(module) || null : null;
|
61713
61719
|
}
|
61720
|
+
getModuleInfo(id) {
|
61721
|
+
const module = this.moduleGraph?.getModuleById(id);
|
61722
|
+
if (!module) {
|
61723
|
+
return null;
|
61724
|
+
}
|
61725
|
+
if (!module.info) {
|
61726
|
+
module.info = new Proxy(
|
61727
|
+
{ id, meta: module.meta || EMPTY_OBJECT },
|
61728
|
+
// throw when an unsupported ModuleInfo property is accessed,
|
61729
|
+
// so that incompatible plugins fail in a non-cryptic way.
|
61730
|
+
{
|
61731
|
+
get(info, key) {
|
61732
|
+
if (key in info) {
|
61733
|
+
return info[key];
|
61734
|
+
}
|
61735
|
+
if (key === "then") {
|
61736
|
+
return void 0;
|
61737
|
+
}
|
61738
|
+
throw Error(
|
61739
|
+
`[vite] The "${key}" property of ModuleInfo is not supported.`
|
61740
|
+
);
|
61741
|
+
}
|
61742
|
+
}
|
61743
|
+
);
|
61744
|
+
}
|
61745
|
+
return module.info ?? null;
|
61746
|
+
}
|
61714
61747
|
// keeps track of hook promises so that we can wait for them all to finish upon closing the server
|
61715
61748
|
handleHookPromise(maybePromise) {
|
61716
61749
|
if (!maybePromise?.then) {
|
@@ -61764,10 +61797,13 @@ class EnvironmentPluginContainer {
|
|
61764
61797
|
}
|
61765
61798
|
async buildStart(_options) {
|
61766
61799
|
if (this._started) {
|
61767
|
-
|
61800
|
+
if (this._buildStartPromise) {
|
61801
|
+
await this._buildStartPromise;
|
61802
|
+
}
|
61768
61803
|
return;
|
61769
61804
|
}
|
61770
|
-
this._started =
|
61805
|
+
this._started = true;
|
61806
|
+
this._buildStartPromise = this.handleHookPromise(
|
61771
61807
|
this.hookParallel(
|
61772
61808
|
"buildStart",
|
61773
61809
|
(plugin) => this._getPluginContext(plugin),
|
@@ -61775,8 +61811,8 @@ class EnvironmentPluginContainer {
|
|
61775
61811
|
(plugin) => this.environment.name === "client" || plugin.perEnvironmentStartEndDuringDev === true
|
61776
61812
|
)
|
61777
61813
|
);
|
61778
|
-
await this.
|
61779
|
-
this.
|
61814
|
+
await this._buildStartPromise;
|
61815
|
+
this._buildStartPromise = void 0;
|
61780
61816
|
}
|
61781
61817
|
async resolveId(rawId, importer = join$2(
|
61782
61818
|
this.environment.config.root,
|
@@ -61784,9 +61820,7 @@ class EnvironmentPluginContainer {
|
|
61784
61820
|
), options) {
|
61785
61821
|
if (!this._started) {
|
61786
61822
|
this.buildStart();
|
61787
|
-
|
61788
|
-
if (this._started !== true) {
|
61789
|
-
await this._started;
|
61823
|
+
await this._buildStartPromise;
|
61790
61824
|
}
|
61791
61825
|
const skip = options?.skip;
|
61792
61826
|
const scan = !!options?.scan;
|
@@ -61985,31 +62019,7 @@ class PluginContext {
|
|
61985
62019
|
return moduleInfo;
|
61986
62020
|
}
|
61987
62021
|
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;
|
62022
|
+
return this._container.getModuleInfo(id);
|
62013
62023
|
}
|
62014
62024
|
_updateModuleInfo(id, { meta }) {
|
62015
62025
|
if (meta) {
|
@@ -62271,6 +62281,11 @@ class PluginContainer {
|
|
62271
62281
|
_getPluginContainer(options) {
|
62272
62282
|
return this._getEnvironment(options).pluginContainer;
|
62273
62283
|
}
|
62284
|
+
getModuleInfo(id) {
|
62285
|
+
return this.environments.client.pluginContainer.getModuleInfo(id) || this.environments.ssr.pluginContainer.getModuleInfo(
|
62286
|
+
id
|
62287
|
+
);
|
62288
|
+
}
|
62274
62289
|
get options() {
|
62275
62290
|
return this.environments.client.pluginContainer.options;
|
62276
62291
|
}
|
@@ -62303,6 +62318,17 @@ function createPluginContainer(environments) {
|
|
62303
62318
|
return new PluginContainer(environments);
|
62304
62319
|
}
|
62305
62320
|
|
62321
|
+
function createBackCompatIdResolver(config, options) {
|
62322
|
+
const compatResolve = config.createResolver(options);
|
62323
|
+
let resolve;
|
62324
|
+
return async (environment, id, importer, aliasOnly) => {
|
62325
|
+
if (environment.name === "client" || environment.name === "ssr") {
|
62326
|
+
return compatResolve(id, importer, aliasOnly, environment.name === "ssr");
|
62327
|
+
}
|
62328
|
+
resolve ??= createIdResolver(config, options);
|
62329
|
+
return resolve(environment, id, importer, aliasOnly);
|
62330
|
+
};
|
62331
|
+
}
|
62306
62332
|
function createIdResolver(config, options) {
|
62307
62333
|
const scan = options?.scan;
|
62308
62334
|
const pluginContainerMap = /* @__PURE__ */ new Map();
|
@@ -62389,7 +62415,7 @@ const cssUrlAssetRE = /__VITE_CSS_URL__([\da-f]+)__/g;
|
|
62389
62415
|
function cssPlugin(config) {
|
62390
62416
|
const isBuild = config.command === "build";
|
62391
62417
|
let moduleCache;
|
62392
|
-
const idResolver =
|
62418
|
+
const idResolver = createBackCompatIdResolver(config, {
|
62393
62419
|
preferRelative: true,
|
62394
62420
|
tryIndex: false,
|
62395
62421
|
extensions: []
|
@@ -62907,9 +62933,8 @@ function cssAnalysisPlugin(config) {
|
|
62907
62933
|
if (!isCSSRequest(id) || commonjsProxyRE.test(id) || SPECIAL_QUERY_RE.test(id)) {
|
62908
62934
|
return;
|
62909
62935
|
}
|
62910
|
-
const
|
62911
|
-
const
|
62912
|
-
const thisModule = moduleGraph?.getModuleById(id);
|
62936
|
+
const { moduleGraph } = this.environment;
|
62937
|
+
const thisModule = moduleGraph.getModuleById(id);
|
62913
62938
|
if (thisModule) {
|
62914
62939
|
const isSelfAccepting = !cssModulesCache.get(config)?.get(id) && !inlineRE.test(id) && !htmlProxyRE.test(id);
|
62915
62940
|
const pluginImports = this._addedImports;
|
@@ -62962,7 +62987,7 @@ function createCSSResolvers(config) {
|
|
62962
62987
|
let lessResolve;
|
62963
62988
|
return {
|
62964
62989
|
get css() {
|
62965
|
-
return cssResolve ??=
|
62990
|
+
return cssResolve ??= createBackCompatIdResolver(config, {
|
62966
62991
|
extensions: [".css"],
|
62967
62992
|
mainFields: ["style"],
|
62968
62993
|
conditions: ["style"],
|
@@ -62972,7 +62997,7 @@ function createCSSResolvers(config) {
|
|
62972
62997
|
},
|
62973
62998
|
get sass() {
|
62974
62999
|
if (!sassResolve) {
|
62975
|
-
const resolver =
|
63000
|
+
const resolver = createBackCompatIdResolver(config, {
|
62976
63001
|
extensions: [".scss", ".sass", ".css"],
|
62977
63002
|
mainFields: ["sass", "style"],
|
62978
63003
|
conditions: ["sass", "style"],
|
@@ -62994,7 +63019,7 @@ function createCSSResolvers(config) {
|
|
62994
63019
|
return sassResolve;
|
62995
63020
|
},
|
62996
63021
|
get less() {
|
62997
|
-
return lessResolve ??=
|
63022
|
+
return lessResolve ??= createBackCompatIdResolver(config, {
|
62998
63023
|
extensions: [".less", ".css"],
|
62999
63024
|
mainFields: ["less", "style"],
|
63000
63025
|
conditions: ["less", "style"],
|
@@ -63301,8 +63326,8 @@ function createCachedImport(imp) {
|
|
63301
63326
|
return cached;
|
63302
63327
|
};
|
63303
63328
|
}
|
63304
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
63305
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
63329
|
+
const importPostcssImport = createCachedImport(() => import('./dep-DuPPQ7KX.js').then(function (n) { return n.i; }));
|
63330
|
+
const importPostcssModules = createCachedImport(() => import('./dep-M7bVrye1.js').then(function (n) { return n.i; }));
|
63306
63331
|
const importPostcss = createCachedImport(() => import('postcss'));
|
63307
63332
|
const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
|
63308
63333
|
let alwaysFakeWorkerWorkerControllerCache;
|
@@ -64528,9 +64553,8 @@ function buildImportAnalysisPlugin(config) {
|
|
64528
64553
|
}
|
64529
64554
|
},
|
64530
64555
|
load(id) {
|
64531
|
-
|
64532
|
-
|
64533
|
-
const { modulePreload } = environment.config.build;
|
64556
|
+
if (id === preloadHelperId) {
|
64557
|
+
const { modulePreload } = this.environment.config.build;
|
64534
64558
|
const scriptRel2 = modulePreload && modulePreload.polyfill ? `'modulepreload'` : `(${detectScriptRel.toString()})()`;
|
64535
64559
|
const assetsURL2 = renderBuiltUrl || isRelativeBase ? (
|
64536
64560
|
// If `experimental.renderBuiltUrl` is used, the dependencies might be relative to the current chunk.
|
@@ -64547,7 +64571,6 @@ function buildImportAnalysisPlugin(config) {
|
|
64547
64571
|
}
|
64548
64572
|
},
|
64549
64573
|
async transform(source, importer) {
|
64550
|
-
const { environment } = this;
|
64551
64574
|
if (isInNodeModules$1(importer) && !dynamicImportPrefixRE.test(source)) {
|
64552
64575
|
return;
|
64553
64576
|
}
|
@@ -64630,16 +64653,15 @@ function buildImportAnalysisPlugin(config) {
|
|
64630
64653
|
if (s) {
|
64631
64654
|
return {
|
64632
64655
|
code: s.toString(),
|
64633
|
-
map: environment.config.build.sourcemap ? s.generateMap({ hires: "boundary" }) : null
|
64656
|
+
map: this.environment.config.build.sourcemap ? s.generateMap({ hires: "boundary" }) : null
|
64634
64657
|
};
|
64635
64658
|
}
|
64636
64659
|
},
|
64637
64660
|
renderChunk(code, _, { format }) {
|
64638
|
-
|
64639
|
-
if (environment && code.indexOf(isModernFlag) > -1) {
|
64661
|
+
if (code.indexOf(isModernFlag) > -1) {
|
64640
64662
|
const re = new RegExp(isModernFlag, "g");
|
64641
64663
|
const isModern = String(format === "es");
|
64642
|
-
if (environment.config.build.sourcemap) {
|
64664
|
+
if (this.environment.config.build.sourcemap) {
|
64643
64665
|
const s = new MagicString(code);
|
64644
64666
|
let match;
|
64645
64667
|
while (match = re.exec(code)) {
|
@@ -67862,56 +67884,20 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
67862
67884
|
* optimizer & handling css @imports
|
67863
67885
|
*/
|
67864
67886
|
createResolver(options) {
|
67865
|
-
const
|
67866
|
-
const
|
67867
|
-
|
67868
|
-
|
67869
|
-
|
67870
|
-
|
67871
|
-
|
67872
|
-
|
67887
|
+
const resolve = createIdResolver(this, options);
|
67888
|
+
const clientEnvironment = new PartialEnvironment("client", this);
|
67889
|
+
let ssrEnvironment;
|
67890
|
+
return async (id, importer, aliasOnly, ssr2) => {
|
67891
|
+
if (ssr2) {
|
67892
|
+
ssrEnvironment ??= new PartialEnvironment("ssr", this);
|
67893
|
+
}
|
67894
|
+
return await resolve(
|
67895
|
+
ssr2 ? ssrEnvironment : clientEnvironment,
|
67896
|
+
id,
|
67897
|
+
importer,
|
67898
|
+
aliasOnly
|
67873
67899
|
);
|
67874
|
-
await pluginContainer.buildStart({});
|
67875
|
-
return pluginContainer;
|
67876
67900
|
};
|
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
67901
|
},
|
67916
67902
|
fsDenyGlob: picomatch$4(
|
67917
67903
|
// matchBase: true does not work as it's documented
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { K as commonjsGlobal, J as getDefaultExportFromCjs } from './dep-
|
1
|
+
import { K as commonjsGlobal, J as getDefaultExportFromCjs } from './dep-Crhy8pEa.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,15 +2,15 @@ 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 { I as colors, A as createLogger, r as resolveConfig } from './chunks/dep-
|
5
|
+
import { I as colors, A as createLogger, r as resolveConfig } from './chunks/dep-Crhy8pEa.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
9
9
|
import 'node:util';
|
10
10
|
import 'node:module';
|
11
11
|
import 'tty';
|
12
|
-
import 'path';
|
13
12
|
import 'esbuild';
|
13
|
+
import 'path';
|
14
14
|
import 'fs';
|
15
15
|
import 'node:events';
|
16
16
|
import 'node:stream';
|
@@ -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-Crhy8pEa.js').then(function (n) { return n.M; });
|
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-Crhy8pEa.js').then(function (n) { return n.N; });
|
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-Crhy8pEa.js').then(function (n) { return n.L; });
|
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-Crhy8pEa.js').then(function (n) { return n.O; });
|
914
914
|
try {
|
915
915
|
const server = await preview({
|
916
916
|
root,
|
package/dist/node/index.d.ts
CHANGED
@@ -2095,9 +2095,11 @@ declare class EnvironmentPluginContainer {
|
|
2095
2095
|
watchFiles: Set<string>;
|
2096
2096
|
minimalContext: MinimalPluginContext;
|
2097
2097
|
private _started;
|
2098
|
+
private _buildStartPromise;
|
2098
2099
|
private _closed;
|
2099
2100
|
private _updateModuleLoadAddedImports;
|
2100
2101
|
private _getAddedImports;
|
2102
|
+
getModuleInfo(id: string): ModuleInfo | null;
|
2101
2103
|
private handleHookPromise;
|
2102
2104
|
get options(): InputOptions;
|
2103
2105
|
resolveRollupOptions(): Promise<InputOptions>;
|
@@ -2129,6 +2131,7 @@ declare class PluginContainer {
|
|
2129
2131
|
constructor(environments: Record<string, Environment>);
|
2130
2132
|
private _getEnvironment;
|
2131
2133
|
private _getPluginContainer;
|
2134
|
+
getModuleInfo(id: string): ModuleInfo | null;
|
2132
2135
|
get options(): InputOptions;
|
2133
2136
|
buildStart(_options?: InputOptions): Promise<void>;
|
2134
2137
|
watchChange(id: string, change: {
|
@@ -2886,7 +2889,7 @@ interface ViteDevServer {
|
|
2886
2889
|
/**
|
2887
2890
|
* Module execution environments attached to the Vite server.
|
2888
2891
|
*/
|
2889
|
-
environments: Record<'client' | 'ssr' | (string &
|
2892
|
+
environments: Record<'client' | 'ssr' | (string & {}), DevEnvironment>;
|
2890
2893
|
/**
|
2891
2894
|
* Module graph that tracks the import relationships, url to file mapping
|
2892
2895
|
* and hmr state.
|
@@ -3934,7 +3937,7 @@ type ResolveIdFn = (environment: PartialEnvironment, id: string, importer?: stri
|
|
3934
3937
|
* Create an internal resolver to be used in special scenarios, e.g.
|
3935
3938
|
* optimizer and handling css @imports
|
3936
3939
|
*/
|
3937
|
-
declare function createIdResolver(config: ResolvedConfig, options
|
3940
|
+
declare function createIdResolver(config: ResolvedConfig, options?: Partial<InternalResolveOptions>): ResolveIdFn;
|
3938
3941
|
|
3939
3942
|
declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
|
3940
3943
|
|
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, x as createFilter, f as createIdResolver, A as createLogger, k as createNodeDevEnvironment, c as createServer, n as createServerModuleRunner, d as defineConfig, m as fetchModule, g as formatPostcssSourceMap, F as isFileLoadingAllowed, E as isFileServingAllowed, l as loadConfigFromFile, G as loadEnv, w as mergeAlias, v as mergeConfig, q as moduleRunnerTransform, u as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, H as resolveEnvPrefix, y as rollupVersion, C as searchForWorkspaceRoot, z as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
2
|
+
import { i as isInNodeModules, a as arraify } from './chunks/dep-Crhy8pEa.js';
|
3
|
+
export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, j as buildErrorMessage, e as createBuilder, x as createFilter, f as createIdResolver, A as createLogger, k as createNodeDevEnvironment, c as createServer, n as createServerModuleRunner, d as defineConfig, m as fetchModule, g as formatPostcssSourceMap, F as isFileLoadingAllowed, E as isFileServingAllowed, l as loadConfigFromFile, G as loadEnv, w as mergeAlias, v as mergeConfig, q as moduleRunnerTransform, u as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, H as resolveEnvPrefix, y as rollupVersion, C as searchForWorkspaceRoot, z as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-Crhy8pEa.js';
|
4
4
|
export { VERSION as version } from './constants.js';
|
5
5
|
export { version as esbuildVersion } from 'esbuild';
|
6
6
|
import 'node:fs';
|
@@ -94,7 +94,7 @@ interface DefineImportMetadata {
|
|
94
94
|
*/
|
95
95
|
importedNames?: string[];
|
96
96
|
}
|
97
|
-
interface
|
97
|
+
interface SSRImportMetadata extends DefineImportMetadata {
|
98
98
|
isDynamicImport?: boolean;
|
99
99
|
}
|
100
100
|
|
@@ -348,4 +348,4 @@ declare class ESModulesEvaluator implements ModuleEvaluator {
|
|
348
348
|
runExternalModule(filepath: string): Promise<any>;
|
349
349
|
}
|
350
350
|
|
351
|
-
export { ESModulesEvaluator, type FetchFunction, type FetchFunctionOptions, type FetchResult, type HMRConnection, type HMRLogger, type ModuleCache, ModuleCacheMap, type ModuleEvaluator, ModuleRunner, type ModuleRunnerContext, type ModuleRunnerHMRConnection, type ModuleRunnerHmr, type ModuleRunnerImportMeta, type ModuleRunnerOptions, RemoteRunnerTransport, type ResolvedResult, type RunnerTransport, type
|
351
|
+
export { ESModulesEvaluator, type FetchFunction, type FetchFunctionOptions, type FetchResult, type HMRConnection, type HMRLogger, type ModuleCache, ModuleCacheMap, type ModuleEvaluator, ModuleRunner, type ModuleRunnerContext, type ModuleRunnerHMRConnection, type ModuleRunnerHmr, type ModuleRunnerImportMeta, type ModuleRunnerOptions, RemoteRunnerTransport, type ResolvedResult, type RunnerTransport, type SSRImportMetadata, ssrDynamicImportKey, ssrExportAllKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
|
@@ -960,19 +960,21 @@ ${getStack()}`
|
|
960
960
|
}
|
961
961
|
}
|
962
962
|
async cachedModule(url, importer) {
|
963
|
-
|
964
|
-
let cached = this.moduleInfoCache.get(cacheKey);
|
965
|
-
return cached || (cached = this.getModuleInformation(url, importer).finally(() => {
|
966
|
-
this.moduleInfoCache.delete(cacheKey);
|
967
|
-
}), this.moduleInfoCache.set(cacheKey, cached)), cached;
|
968
|
-
}
|
969
|
-
async getModuleInformation(url, importer) {
|
970
|
-
if (this.destroyed)
|
971
|
-
throw new Error("Vite module runner has been destroyed.");
|
972
|
-
this.debug?.("[module runner] fetching", url), url = normalizeAbsoluteUrl(url, this.root);
|
963
|
+
url = normalizeAbsoluteUrl(url, this.root);
|
973
964
|
const normalized = this.urlToIdMap.get(url);
|
974
965
|
let cachedModule = normalized && this.moduleCache.getByModuleId(normalized);
|
975
966
|
cachedModule || (cachedModule = this.moduleCache.getByModuleId(url));
|
967
|
+
let cached = this.moduleInfoCache.get(url);
|
968
|
+
return cached ? this.debug?.("[module runner] using cached module info for", url) : (cached = this.getModuleInformation(url, importer, cachedModule).finally(
|
969
|
+
() => {
|
970
|
+
this.moduleInfoCache.delete(url);
|
971
|
+
}
|
972
|
+
), this.moduleInfoCache.set(url, cached)), cached;
|
973
|
+
}
|
974
|
+
async getModuleInformation(url, importer, cachedModule) {
|
975
|
+
if (this.destroyed)
|
976
|
+
throw new Error("Vite module runner has been destroyed.");
|
977
|
+
this.debug?.("[module runner] fetching", url);
|
976
978
|
const isCached = !!(typeof cachedModule == "object" && cachedModule.meta), fetchedModule = (
|
977
979
|
// fast return for established externalized pattern
|
978
980
|
url.startsWith("data:") ? { externalize: url, type: "builtin" } : await this.transport.fetchModule(url, importer, {
|