vite 2.9.12 → 2.9.15
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.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
- package/dist/node/chunks/{dep-985abbbd.js → dep-0fd6fea3.js} +1 -1
- package/dist/node/chunks/{dep-ad22985c.js → dep-24755698.js} +1 -1
- package/dist/node/chunks/{dep-8f5c9290.js → dep-689425f3.js} +330 -287
- package/dist/node/chunks/{dep-b27bdd3c.js → dep-aa4ab47b.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/index.js +1 -1
- package/package.json +2 -2
|
@@ -22715,239 +22715,6 @@ const JSON5 = {
|
|
|
22715
22715
|
|
|
22716
22716
|
var lib$2 = JSON5;
|
|
22717
22717
|
|
|
22718
|
-
function formatGlobRelativePattern(base, pattern) {
|
|
22719
|
-
let parentDepth = 0;
|
|
22720
|
-
while (pattern.startsWith('../')) {
|
|
22721
|
-
pattern = pattern.slice(3);
|
|
22722
|
-
base = path__default.resolve(base, '../');
|
|
22723
|
-
parentDepth++;
|
|
22724
|
-
}
|
|
22725
|
-
if (pattern.startsWith('./')) {
|
|
22726
|
-
pattern = pattern.slice(2);
|
|
22727
|
-
}
|
|
22728
|
-
return { base, pattern, parentDepth, isAbsolute: false };
|
|
22729
|
-
}
|
|
22730
|
-
async function transformImportGlob(source, pos, importer, importIndex, root, logger, normalizeUrl, resolve, preload = true) {
|
|
22731
|
-
var _a;
|
|
22732
|
-
const isEager = source.slice(pos, pos + 21) === 'import.meta.globEager';
|
|
22733
|
-
const isEagerDefault = isEager && source.slice(pos + 21, pos + 28) === 'Default';
|
|
22734
|
-
const err = (msg) => {
|
|
22735
|
-
const e = new Error(`Invalid glob import syntax: ${msg}`);
|
|
22736
|
-
e.pos = pos;
|
|
22737
|
-
return e;
|
|
22738
|
-
};
|
|
22739
|
-
importer = cleanUrl(importer);
|
|
22740
|
-
const importerBasename = path__default.basename(importer);
|
|
22741
|
-
const [userPattern, options, endIndex] = lexGlobPattern(source, pos);
|
|
22742
|
-
let globParams = null;
|
|
22743
|
-
if (userPattern.startsWith('/')) {
|
|
22744
|
-
globParams = {
|
|
22745
|
-
isAbsolute: true,
|
|
22746
|
-
base: path__default.resolve(root),
|
|
22747
|
-
pattern: userPattern.slice(1),
|
|
22748
|
-
parentDepth: 0
|
|
22749
|
-
};
|
|
22750
|
-
}
|
|
22751
|
-
else if (userPattern.startsWith('.')) {
|
|
22752
|
-
globParams = formatGlobRelativePattern(path__default.dirname(importer), userPattern);
|
|
22753
|
-
}
|
|
22754
|
-
else if (resolve) {
|
|
22755
|
-
const resolvedId = await resolve(userPattern, importer);
|
|
22756
|
-
if (resolvedId) {
|
|
22757
|
-
const importerDirname = path__default.dirname(importer);
|
|
22758
|
-
globParams = formatGlobRelativePattern(importerDirname, normalizePath$3(path__default.relative(importerDirname, resolvedId)));
|
|
22759
|
-
}
|
|
22760
|
-
}
|
|
22761
|
-
if (!globParams) {
|
|
22762
|
-
throw err(`pattern must start with "." or "/" (relative to project root) or alias path`);
|
|
22763
|
-
}
|
|
22764
|
-
const { base, parentDepth, isAbsolute, pattern } = globParams;
|
|
22765
|
-
const files = out.sync(pattern, {
|
|
22766
|
-
cwd: base,
|
|
22767
|
-
// Ignore node_modules by default unless explicitly indicated in the pattern
|
|
22768
|
-
ignore: /(^|\/)node_modules\//.test(pattern) ? [] : ['**/node_modules/**']
|
|
22769
|
-
});
|
|
22770
|
-
const imports = [];
|
|
22771
|
-
let importsString = ``;
|
|
22772
|
-
let entries = ``;
|
|
22773
|
-
for (let i = 0; i < files.length; i++) {
|
|
22774
|
-
// skip importer itself
|
|
22775
|
-
if (files[i] === importerBasename)
|
|
22776
|
-
continue;
|
|
22777
|
-
const file = isAbsolute
|
|
22778
|
-
? `/${files[i]}`
|
|
22779
|
-
: parentDepth
|
|
22780
|
-
? `${'../'.repeat(parentDepth)}${files[i]}`
|
|
22781
|
-
: `./${files[i]}`;
|
|
22782
|
-
let importee = file;
|
|
22783
|
-
if (normalizeUrl) {
|
|
22784
|
-
[importee] = await normalizeUrl(file, pos);
|
|
22785
|
-
}
|
|
22786
|
-
imports.push(importee);
|
|
22787
|
-
// TODO remove assert syntax for the Vite 3.0 release.
|
|
22788
|
-
const isRawAssert = ((_a = options === null || options === void 0 ? void 0 : options.assert) === null || _a === void 0 ? void 0 : _a.type) === 'raw';
|
|
22789
|
-
const isRawType = (options === null || options === void 0 ? void 0 : options.as) === 'raw';
|
|
22790
|
-
if (isRawType || isRawAssert) {
|
|
22791
|
-
if (isRawAssert) {
|
|
22792
|
-
logger.warn(colors$1.yellow(colors$1.bold("(!) import.meta.glob('...', { assert: { type: 'raw' }}) is deprecated. Use import.meta.glob('...', { as: 'raw' }) instead.")));
|
|
22793
|
-
}
|
|
22794
|
-
entries += ` ${JSON.stringify(file)}: ${JSON.stringify(await fs$n.promises.readFile(path__default.join(base, files[i]), 'utf-8'))},`;
|
|
22795
|
-
}
|
|
22796
|
-
else {
|
|
22797
|
-
if (isEager) {
|
|
22798
|
-
const identifier = `__glob_${importIndex}_${i}`;
|
|
22799
|
-
importsString += `import ${isEagerDefault ? `` : `* as `}${identifier} from ${JSON.stringify(importee)};`;
|
|
22800
|
-
entries += ` ${JSON.stringify(file)}: ${identifier},`;
|
|
22801
|
-
}
|
|
22802
|
-
else {
|
|
22803
|
-
let imp = `import(${JSON.stringify(importee)})`;
|
|
22804
|
-
if (!normalizeUrl && preload) {
|
|
22805
|
-
imp =
|
|
22806
|
-
`(${isModernFlag}` +
|
|
22807
|
-
`? ${preloadMethod}(()=>${imp},"${preloadMarker}")` +
|
|
22808
|
-
`: ${imp})`;
|
|
22809
|
-
}
|
|
22810
|
-
entries += ` ${JSON.stringify(file)}: () => ${imp},`;
|
|
22811
|
-
}
|
|
22812
|
-
}
|
|
22813
|
-
}
|
|
22814
|
-
return {
|
|
22815
|
-
imports,
|
|
22816
|
-
importsString,
|
|
22817
|
-
exp: `{${entries}}`,
|
|
22818
|
-
endIndex,
|
|
22819
|
-
isEager,
|
|
22820
|
-
pattern,
|
|
22821
|
-
base
|
|
22822
|
-
};
|
|
22823
|
-
}
|
|
22824
|
-
function lexGlobPattern(code, pos) {
|
|
22825
|
-
let state = 0 /* inCall */;
|
|
22826
|
-
let pattern = '';
|
|
22827
|
-
let i = code.indexOf(`(`, pos) + 1;
|
|
22828
|
-
outer: for (; i < code.length; i++) {
|
|
22829
|
-
const char = code.charAt(i);
|
|
22830
|
-
switch (state) {
|
|
22831
|
-
case 0 /* inCall */:
|
|
22832
|
-
if (char === `'`) {
|
|
22833
|
-
state = 1 /* inSingleQuoteString */;
|
|
22834
|
-
}
|
|
22835
|
-
else if (char === `"`) {
|
|
22836
|
-
state = 2 /* inDoubleQuoteString */;
|
|
22837
|
-
}
|
|
22838
|
-
else if (char === '`') {
|
|
22839
|
-
state = 3 /* inTemplateString */;
|
|
22840
|
-
}
|
|
22841
|
-
else if (/\s/.test(char)) {
|
|
22842
|
-
continue;
|
|
22843
|
-
}
|
|
22844
|
-
else {
|
|
22845
|
-
error$2(i);
|
|
22846
|
-
}
|
|
22847
|
-
break;
|
|
22848
|
-
case 1 /* inSingleQuoteString */:
|
|
22849
|
-
if (char === `'`) {
|
|
22850
|
-
break outer;
|
|
22851
|
-
}
|
|
22852
|
-
else {
|
|
22853
|
-
pattern += char;
|
|
22854
|
-
}
|
|
22855
|
-
break;
|
|
22856
|
-
case 2 /* inDoubleQuoteString */:
|
|
22857
|
-
if (char === `"`) {
|
|
22858
|
-
break outer;
|
|
22859
|
-
}
|
|
22860
|
-
else {
|
|
22861
|
-
pattern += char;
|
|
22862
|
-
}
|
|
22863
|
-
break;
|
|
22864
|
-
case 3 /* inTemplateString */:
|
|
22865
|
-
if (char === '`') {
|
|
22866
|
-
break outer;
|
|
22867
|
-
}
|
|
22868
|
-
else {
|
|
22869
|
-
pattern += char;
|
|
22870
|
-
}
|
|
22871
|
-
break;
|
|
22872
|
-
default:
|
|
22873
|
-
throw new Error('unknown import.meta.glob lexer state');
|
|
22874
|
-
}
|
|
22875
|
-
}
|
|
22876
|
-
const noCommentCode = code
|
|
22877
|
-
.slice(i + 1)
|
|
22878
|
-
.replace(singlelineCommentsRE, blankReplacer)
|
|
22879
|
-
.replace(multilineCommentsRE, blankReplacer);
|
|
22880
|
-
const endIndex = noCommentCode.indexOf(')');
|
|
22881
|
-
const optionString = noCommentCode.substring(0, endIndex);
|
|
22882
|
-
const commaIndex = optionString.indexOf(',');
|
|
22883
|
-
let options = {};
|
|
22884
|
-
if (commaIndex > -1) {
|
|
22885
|
-
options = lib$2.parse(optionString.substring(commaIndex + 1));
|
|
22886
|
-
}
|
|
22887
|
-
return [pattern, options, endIndex + i + 2];
|
|
22888
|
-
}
|
|
22889
|
-
function error$2(pos) {
|
|
22890
|
-
const err = new Error(`import.meta.glob() can only accept string literals.`);
|
|
22891
|
-
err.pos = pos;
|
|
22892
|
-
throw err;
|
|
22893
|
-
}
|
|
22894
|
-
|
|
22895
|
-
const isDebug$6 = !!process.env.DEBUG;
|
|
22896
|
-
const debug$e = createDebugger('vite:sourcemap', {
|
|
22897
|
-
onlyWhenFocused: true
|
|
22898
|
-
});
|
|
22899
|
-
// Virtual modules should be prefixed with a null byte to avoid a
|
|
22900
|
-
// false positive "missing source" warning. We also check for certain
|
|
22901
|
-
// prefixes used for special handling in esbuildDepPlugin.
|
|
22902
|
-
const virtualSourceRE = /^(\0|dep:|browser-external:)/;
|
|
22903
|
-
async function injectSourcesContent(map, file, logger) {
|
|
22904
|
-
let sourceRoot;
|
|
22905
|
-
try {
|
|
22906
|
-
// The source root is undefined for virtual modules and permission errors.
|
|
22907
|
-
sourceRoot = await fs$n.promises.realpath(path__default.resolve(path__default.dirname(file), map.sourceRoot || ''));
|
|
22908
|
-
}
|
|
22909
|
-
catch { }
|
|
22910
|
-
const missingSources = [];
|
|
22911
|
-
map.sourcesContent = await Promise.all(map.sources.map((sourcePath) => {
|
|
22912
|
-
if (sourcePath && !virtualSourceRE.test(sourcePath)) {
|
|
22913
|
-
sourcePath = decodeURI(sourcePath);
|
|
22914
|
-
if (sourceRoot) {
|
|
22915
|
-
sourcePath = path__default.resolve(sourceRoot, sourcePath);
|
|
22916
|
-
}
|
|
22917
|
-
return fs$n.promises.readFile(sourcePath, 'utf-8').catch(() => {
|
|
22918
|
-
missingSources.push(sourcePath);
|
|
22919
|
-
return null;
|
|
22920
|
-
});
|
|
22921
|
-
}
|
|
22922
|
-
return null;
|
|
22923
|
-
}));
|
|
22924
|
-
// Use this command…
|
|
22925
|
-
// DEBUG="vite:sourcemap" vite build
|
|
22926
|
-
// …to log the missing sources.
|
|
22927
|
-
if (missingSources.length) {
|
|
22928
|
-
logger.warnOnce(`Sourcemap for "${file}" points to missing source files`);
|
|
22929
|
-
isDebug$6 && debug$e(`Missing sources:\n ` + missingSources.join(`\n `));
|
|
22930
|
-
}
|
|
22931
|
-
}
|
|
22932
|
-
function genSourceMapUrl(map) {
|
|
22933
|
-
if (typeof map !== 'string') {
|
|
22934
|
-
map = JSON.stringify(map);
|
|
22935
|
-
}
|
|
22936
|
-
return `data:application/json;base64,${Buffer.from(map).toString('base64')}`;
|
|
22937
|
-
}
|
|
22938
|
-
function getCodeWithSourcemap(type, code, map) {
|
|
22939
|
-
if (isDebug$6) {
|
|
22940
|
-
code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`;
|
|
22941
|
-
}
|
|
22942
|
-
if (type === 'js') {
|
|
22943
|
-
code += `\n//# sourceMappingURL=${genSourceMapUrl(map !== null && map !== void 0 ? map : undefined)}`;
|
|
22944
|
-
}
|
|
22945
|
-
else if (type === 'css') {
|
|
22946
|
-
code += `\n/*# sourceMappingURL=${genSourceMapUrl(map !== null && map !== void 0 ? map : undefined)} */`;
|
|
22947
|
-
}
|
|
22948
|
-
return code;
|
|
22949
|
-
}
|
|
22950
|
-
|
|
22951
22718
|
var dist$1 = {};
|
|
22952
22719
|
|
|
22953
22720
|
(function (exports) {
|
|
@@ -30103,6 +29870,62 @@ rc.sync = withTypeScriptLoader((ctx, path, options) => {
|
|
|
30103
29870
|
*/
|
|
30104
29871
|
var src$1 = rc;
|
|
30105
29872
|
|
|
29873
|
+
const isDebug$6 = !!process.env.DEBUG;
|
|
29874
|
+
const debug$e = createDebugger('vite:sourcemap', {
|
|
29875
|
+
onlyWhenFocused: true
|
|
29876
|
+
});
|
|
29877
|
+
// Virtual modules should be prefixed with a null byte to avoid a
|
|
29878
|
+
// false positive "missing source" warning. We also check for certain
|
|
29879
|
+
// prefixes used for special handling in esbuildDepPlugin.
|
|
29880
|
+
const virtualSourceRE = /^(\0|dep:|browser-external:)/;
|
|
29881
|
+
async function injectSourcesContent(map, file, logger) {
|
|
29882
|
+
let sourceRoot;
|
|
29883
|
+
try {
|
|
29884
|
+
// The source root is undefined for virtual modules and permission errors.
|
|
29885
|
+
sourceRoot = await fs$n.promises.realpath(path__default.resolve(path__default.dirname(file), map.sourceRoot || ''));
|
|
29886
|
+
}
|
|
29887
|
+
catch { }
|
|
29888
|
+
const missingSources = [];
|
|
29889
|
+
map.sourcesContent = await Promise.all(map.sources.map((sourcePath) => {
|
|
29890
|
+
if (sourcePath && !virtualSourceRE.test(sourcePath)) {
|
|
29891
|
+
sourcePath = decodeURI(sourcePath);
|
|
29892
|
+
if (sourceRoot) {
|
|
29893
|
+
sourcePath = path__default.resolve(sourceRoot, sourcePath);
|
|
29894
|
+
}
|
|
29895
|
+
return fs$n.promises.readFile(sourcePath, 'utf-8').catch(() => {
|
|
29896
|
+
missingSources.push(sourcePath);
|
|
29897
|
+
return null;
|
|
29898
|
+
});
|
|
29899
|
+
}
|
|
29900
|
+
return null;
|
|
29901
|
+
}));
|
|
29902
|
+
// Use this command…
|
|
29903
|
+
// DEBUG="vite:sourcemap" vite build
|
|
29904
|
+
// …to log the missing sources.
|
|
29905
|
+
if (missingSources.length) {
|
|
29906
|
+
logger.warnOnce(`Sourcemap for "${file}" points to missing source files`);
|
|
29907
|
+
isDebug$6 && debug$e(`Missing sources:\n ` + missingSources.join(`\n `));
|
|
29908
|
+
}
|
|
29909
|
+
}
|
|
29910
|
+
function genSourceMapUrl(map) {
|
|
29911
|
+
if (typeof map !== 'string') {
|
|
29912
|
+
map = JSON.stringify(map);
|
|
29913
|
+
}
|
|
29914
|
+
return `data:application/json;base64,${Buffer.from(map).toString('base64')}`;
|
|
29915
|
+
}
|
|
29916
|
+
function getCodeWithSourcemap(type, code, map) {
|
|
29917
|
+
if (isDebug$6) {
|
|
29918
|
+
code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`;
|
|
29919
|
+
}
|
|
29920
|
+
if (type === 'js') {
|
|
29921
|
+
code += `\n//# sourceMappingURL=${genSourceMapUrl(map !== null && map !== void 0 ? map : undefined)}`;
|
|
29922
|
+
}
|
|
29923
|
+
else if (type === 'css') {
|
|
29924
|
+
code += `\n/*# sourceMappingURL=${genSourceMapUrl(map !== null && map !== void 0 ? map : undefined)} */`;
|
|
29925
|
+
}
|
|
29926
|
+
return code;
|
|
29927
|
+
}
|
|
29928
|
+
|
|
30106
29929
|
// This file was generated. Do not modify manually!
|
|
30107
29930
|
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
30108
29931
|
|
|
@@ -36554,7 +36377,7 @@ const assetAttrsConfig = {
|
|
|
36554
36377
|
const isAsyncScriptMap = new WeakMap();
|
|
36555
36378
|
async function traverseHtml(html, filePath, visitor) {
|
|
36556
36379
|
// lazy load compiler
|
|
36557
|
-
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-
|
|
36380
|
+
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-0fd6fea3.js'); }).then(function (n) { return n.compilerDom_cjs; });
|
|
36558
36381
|
// @vue/compiler-core doesn't like lowercase doctypes
|
|
36559
36382
|
html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
|
|
36560
36383
|
try {
|
|
@@ -37135,6 +36958,7 @@ const htmlProxyRE = /(\?|&)html-proxy\b/;
|
|
|
37135
36958
|
const commonjsProxyRE = /\?commonjs-proxy/;
|
|
37136
36959
|
const inlineRE = /(\?|&)inline\b/;
|
|
37137
36960
|
const inlineCSSRE = /(\?|&)inline-css\b/;
|
|
36961
|
+
const usedRE = /(\?|&)used\b/;
|
|
37138
36962
|
const varRE = /^var\(/i;
|
|
37139
36963
|
const isCSSRequest = (request) => cssLangRE.test(request);
|
|
37140
36964
|
const isDirectCSSRequest = (request) => cssLangRE.test(request) && directRequestRE.test(request);
|
|
@@ -37310,18 +37134,24 @@ function cssPostPlugin(config) {
|
|
|
37310
37134
|
styles.set(id, css);
|
|
37311
37135
|
}
|
|
37312
37136
|
let code;
|
|
37313
|
-
if (
|
|
37314
|
-
|
|
37137
|
+
if (usedRE.test(id)) {
|
|
37138
|
+
if (modulesCode) {
|
|
37139
|
+
code = modulesCode;
|
|
37140
|
+
}
|
|
37141
|
+
else {
|
|
37142
|
+
let content = css;
|
|
37143
|
+
if (config.build.minify) {
|
|
37144
|
+
content = await minifyCSS(content, config);
|
|
37145
|
+
}
|
|
37146
|
+
code = `export default ${JSON.stringify(content)}`;
|
|
37147
|
+
}
|
|
37315
37148
|
}
|
|
37316
37149
|
else {
|
|
37317
|
-
|
|
37318
|
-
|
|
37319
|
-
|
|
37320
|
-
|
|
37321
|
-
|
|
37322
|
-
// but the module itself is still treated as a non tree-shakable module
|
|
37323
|
-
// because moduleSideEffects is 'no-treeshake'
|
|
37324
|
-
code = `export default /* #__PURE__ */ (() => ${JSON.stringify(content)})()`;
|
|
37150
|
+
// if moduleCode exists return it **even if** it does not have `?used`
|
|
37151
|
+
// this will disable tree-shake to work with `import './foo.module.css'` but this usually does not happen
|
|
37152
|
+
// this is a limitation of the current approach by `?used` to make tree-shake work
|
|
37153
|
+
// See #8936 for more details
|
|
37154
|
+
code = modulesCode || `export default ''`;
|
|
37325
37155
|
}
|
|
37326
37156
|
return {
|
|
37327
37157
|
code,
|
|
@@ -37604,7 +37434,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
37604
37434
|
replacer: urlReplacer
|
|
37605
37435
|
}));
|
|
37606
37436
|
if (isModule) {
|
|
37607
|
-
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-
|
|
37437
|
+
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-aa4ab47b.js'); }).then(function (n) { return n.index; })).default({
|
|
37608
37438
|
...modulesOptions,
|
|
37609
37439
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
37610
37440
|
modules = _modules;
|
|
@@ -38253,6 +38083,185 @@ function isPreProcessor(lang) {
|
|
|
38253
38083
|
return lang && lang in preProcessors;
|
|
38254
38084
|
}
|
|
38255
38085
|
|
|
38086
|
+
function formatGlobRelativePattern(base, pattern) {
|
|
38087
|
+
let parentDepth = 0;
|
|
38088
|
+
while (pattern.startsWith('../')) {
|
|
38089
|
+
pattern = pattern.slice(3);
|
|
38090
|
+
base = path__default.resolve(base, '../');
|
|
38091
|
+
parentDepth++;
|
|
38092
|
+
}
|
|
38093
|
+
if (pattern.startsWith('./')) {
|
|
38094
|
+
pattern = pattern.slice(2);
|
|
38095
|
+
}
|
|
38096
|
+
return { base, pattern, parentDepth, isAbsolute: false };
|
|
38097
|
+
}
|
|
38098
|
+
async function transformImportGlob(source, pos, importer, importIndex, root, logger, normalizeUrl, resolve, preload = true) {
|
|
38099
|
+
var _a;
|
|
38100
|
+
const isEager = source.slice(pos, pos + 21) === 'import.meta.globEager';
|
|
38101
|
+
const isEagerDefault = isEager && source.slice(pos + 21, pos + 28) === 'Default';
|
|
38102
|
+
const err = (msg) => {
|
|
38103
|
+
const e = new Error(`Invalid glob import syntax: ${msg}`);
|
|
38104
|
+
e.pos = pos;
|
|
38105
|
+
return e;
|
|
38106
|
+
};
|
|
38107
|
+
importer = cleanUrl(importer);
|
|
38108
|
+
const importerBasename = path__default.basename(importer);
|
|
38109
|
+
const [userPattern, options, endIndex] = lexGlobPattern(source, pos);
|
|
38110
|
+
let globParams = null;
|
|
38111
|
+
if (userPattern.startsWith('/')) {
|
|
38112
|
+
globParams = {
|
|
38113
|
+
isAbsolute: true,
|
|
38114
|
+
base: path__default.resolve(root),
|
|
38115
|
+
pattern: userPattern.slice(1),
|
|
38116
|
+
parentDepth: 0
|
|
38117
|
+
};
|
|
38118
|
+
}
|
|
38119
|
+
else if (userPattern.startsWith('.')) {
|
|
38120
|
+
globParams = formatGlobRelativePattern(path__default.dirname(importer), userPattern);
|
|
38121
|
+
}
|
|
38122
|
+
else if (resolve) {
|
|
38123
|
+
const resolvedId = await resolve(userPattern, importer);
|
|
38124
|
+
if (resolvedId) {
|
|
38125
|
+
const importerDirname = path__default.dirname(importer);
|
|
38126
|
+
globParams = formatGlobRelativePattern(importerDirname, normalizePath$3(path__default.relative(importerDirname, resolvedId)));
|
|
38127
|
+
}
|
|
38128
|
+
}
|
|
38129
|
+
if (!globParams) {
|
|
38130
|
+
throw err(`pattern must start with "." or "/" (relative to project root) or alias path`);
|
|
38131
|
+
}
|
|
38132
|
+
const { base, parentDepth, isAbsolute, pattern } = globParams;
|
|
38133
|
+
const files = out.sync(pattern, {
|
|
38134
|
+
cwd: base,
|
|
38135
|
+
// Ignore node_modules by default unless explicitly indicated in the pattern
|
|
38136
|
+
ignore: /(^|\/)node_modules\//.test(pattern) ? [] : ['**/node_modules/**']
|
|
38137
|
+
});
|
|
38138
|
+
const imports = [];
|
|
38139
|
+
let importsString = ``;
|
|
38140
|
+
let entries = ``;
|
|
38141
|
+
for (let i = 0; i < files.length; i++) {
|
|
38142
|
+
// skip importer itself
|
|
38143
|
+
if (files[i] === importerBasename)
|
|
38144
|
+
continue;
|
|
38145
|
+
const file = isAbsolute
|
|
38146
|
+
? `/${files[i]}`
|
|
38147
|
+
: parentDepth
|
|
38148
|
+
? `${'../'.repeat(parentDepth)}${files[i]}`
|
|
38149
|
+
: `./${files[i]}`;
|
|
38150
|
+
let importee = file;
|
|
38151
|
+
if (normalizeUrl) {
|
|
38152
|
+
[importee] = await normalizeUrl(file, pos);
|
|
38153
|
+
}
|
|
38154
|
+
imports.push(importee);
|
|
38155
|
+
// TODO remove assert syntax for the Vite 3.0 release.
|
|
38156
|
+
const isRawAssert = ((_a = options === null || options === void 0 ? void 0 : options.assert) === null || _a === void 0 ? void 0 : _a.type) === 'raw';
|
|
38157
|
+
const isRawType = (options === null || options === void 0 ? void 0 : options.as) === 'raw';
|
|
38158
|
+
if (isRawType || isRawAssert) {
|
|
38159
|
+
if (isRawAssert) {
|
|
38160
|
+
logger.warn(colors$1.yellow(colors$1.bold("(!) import.meta.glob('...', { assert: { type: 'raw' }}) is deprecated. Use import.meta.glob('...', { as: 'raw' }) instead.")));
|
|
38161
|
+
}
|
|
38162
|
+
entries += ` ${JSON.stringify(file)}: ${JSON.stringify(await fs$n.promises.readFile(path__default.join(base, files[i]), 'utf-8'))},`;
|
|
38163
|
+
}
|
|
38164
|
+
else {
|
|
38165
|
+
const importeeUrl = isCSSRequest(importee) ? `${importee}?used` : importee;
|
|
38166
|
+
if (isEager) {
|
|
38167
|
+
const identifier = `__glob_${importIndex}_${i}`;
|
|
38168
|
+
// css imports injecting a ?used query to export the css string
|
|
38169
|
+
importsString += `import ${isEagerDefault ? `` : `* as `}${identifier} from ${JSON.stringify(importeeUrl)};`;
|
|
38170
|
+
entries += ` ${JSON.stringify(file)}: ${identifier},`;
|
|
38171
|
+
}
|
|
38172
|
+
else {
|
|
38173
|
+
let imp = `import(${JSON.stringify(importeeUrl)})`;
|
|
38174
|
+
if (!normalizeUrl && preload) {
|
|
38175
|
+
imp =
|
|
38176
|
+
`(${isModernFlag}` +
|
|
38177
|
+
`? ${preloadMethod}(()=>${imp},"${preloadMarker}")` +
|
|
38178
|
+
`: ${imp})`;
|
|
38179
|
+
}
|
|
38180
|
+
entries += ` ${JSON.stringify(file)}: () => ${imp},`;
|
|
38181
|
+
}
|
|
38182
|
+
}
|
|
38183
|
+
}
|
|
38184
|
+
return {
|
|
38185
|
+
imports,
|
|
38186
|
+
importsString,
|
|
38187
|
+
exp: `{${entries}}`,
|
|
38188
|
+
endIndex,
|
|
38189
|
+
isEager,
|
|
38190
|
+
pattern,
|
|
38191
|
+
base
|
|
38192
|
+
};
|
|
38193
|
+
}
|
|
38194
|
+
function lexGlobPattern(code, pos) {
|
|
38195
|
+
let state = 0 /* inCall */;
|
|
38196
|
+
let pattern = '';
|
|
38197
|
+
let i = code.indexOf(`(`, pos) + 1;
|
|
38198
|
+
outer: for (; i < code.length; i++) {
|
|
38199
|
+
const char = code.charAt(i);
|
|
38200
|
+
switch (state) {
|
|
38201
|
+
case 0 /* inCall */:
|
|
38202
|
+
if (char === `'`) {
|
|
38203
|
+
state = 1 /* inSingleQuoteString */;
|
|
38204
|
+
}
|
|
38205
|
+
else if (char === `"`) {
|
|
38206
|
+
state = 2 /* inDoubleQuoteString */;
|
|
38207
|
+
}
|
|
38208
|
+
else if (char === '`') {
|
|
38209
|
+
state = 3 /* inTemplateString */;
|
|
38210
|
+
}
|
|
38211
|
+
else if (/\s/.test(char)) {
|
|
38212
|
+
continue;
|
|
38213
|
+
}
|
|
38214
|
+
else {
|
|
38215
|
+
error$2(i);
|
|
38216
|
+
}
|
|
38217
|
+
break;
|
|
38218
|
+
case 1 /* inSingleQuoteString */:
|
|
38219
|
+
if (char === `'`) {
|
|
38220
|
+
break outer;
|
|
38221
|
+
}
|
|
38222
|
+
else {
|
|
38223
|
+
pattern += char;
|
|
38224
|
+
}
|
|
38225
|
+
break;
|
|
38226
|
+
case 2 /* inDoubleQuoteString */:
|
|
38227
|
+
if (char === `"`) {
|
|
38228
|
+
break outer;
|
|
38229
|
+
}
|
|
38230
|
+
else {
|
|
38231
|
+
pattern += char;
|
|
38232
|
+
}
|
|
38233
|
+
break;
|
|
38234
|
+
case 3 /* inTemplateString */:
|
|
38235
|
+
if (char === '`') {
|
|
38236
|
+
break outer;
|
|
38237
|
+
}
|
|
38238
|
+
else {
|
|
38239
|
+
pattern += char;
|
|
38240
|
+
}
|
|
38241
|
+
break;
|
|
38242
|
+
default:
|
|
38243
|
+
throw new Error('unknown import.meta.glob lexer state');
|
|
38244
|
+
}
|
|
38245
|
+
}
|
|
38246
|
+
const noCommentCode = code
|
|
38247
|
+
.slice(i + 1)
|
|
38248
|
+
.replace(singlelineCommentsRE, blankReplacer)
|
|
38249
|
+
.replace(multilineCommentsRE, blankReplacer);
|
|
38250
|
+
const endIndex = noCommentCode.indexOf(')');
|
|
38251
|
+
const optionString = noCommentCode.substring(0, endIndex);
|
|
38252
|
+
const commaIndex = optionString.indexOf(',');
|
|
38253
|
+
let options = {};
|
|
38254
|
+
if (commaIndex > -1) {
|
|
38255
|
+
options = lib$2.parse(optionString.substring(commaIndex + 1));
|
|
38256
|
+
}
|
|
38257
|
+
return [pattern, options, endIndex + i + 2];
|
|
38258
|
+
}
|
|
38259
|
+
function error$2(pos) {
|
|
38260
|
+
const err = new Error(`import.meta.glob() can only accept string literals.`);
|
|
38261
|
+
err.pos = pos;
|
|
38262
|
+
throw err;
|
|
38263
|
+
}
|
|
38264
|
+
|
|
38256
38265
|
/**
|
|
38257
38266
|
* A flag for injected helpers. This flag will be set to `false` if the output
|
|
38258
38267
|
* target is not native es - so that injected helper logic can be conditionally
|
|
@@ -38364,7 +38373,8 @@ function buildImportAnalysisPlugin(config) {
|
|
|
38364
38373
|
const str = () => s || (s = new MagicString(source));
|
|
38365
38374
|
let needPreloadHelper = false;
|
|
38366
38375
|
for (let index = 0; index < imports.length; index++) {
|
|
38367
|
-
const { s: start, e: end, ss: expStart, se: expEnd, d: dynamicIndex } = imports[index];
|
|
38376
|
+
const { s: start, e: end, ss: expStart, se: expEnd, n: specifier, d: dynamicIndex } = imports[index];
|
|
38377
|
+
const isDynamic = dynamicIndex > -1;
|
|
38368
38378
|
// import.meta.glob
|
|
38369
38379
|
if (source.slice(start, end) === 'import.meta' &&
|
|
38370
38380
|
source.slice(end, end + 5) === '.glob') {
|
|
@@ -38383,11 +38393,26 @@ function buildImportAnalysisPlugin(config) {
|
|
|
38383
38393
|
}
|
|
38384
38394
|
continue;
|
|
38385
38395
|
}
|
|
38386
|
-
if (
|
|
38396
|
+
if (isDynamic && insertPreload) {
|
|
38387
38397
|
needPreloadHelper = true;
|
|
38388
|
-
|
|
38389
|
-
|
|
38390
|
-
|
|
38398
|
+
str().prependLeft(expStart, `${preloadMethod}(() => `);
|
|
38399
|
+
str().appendRight(expEnd, `,${isModernFlag}?"${preloadMarker}":void 0)`);
|
|
38400
|
+
}
|
|
38401
|
+
// Differentiate CSS imports that use the default export from those that
|
|
38402
|
+
// do not by injecting a ?used query - this allows us to avoid including
|
|
38403
|
+
// the CSS string when unnecessary (esbuild has trouble tree-shaking
|
|
38404
|
+
// them)
|
|
38405
|
+
if (specifier &&
|
|
38406
|
+
isCSSRequest(specifier) &&
|
|
38407
|
+
// always inject ?used query when it is a dynamic import
|
|
38408
|
+
// because there is no way to check whether the default export is used
|
|
38409
|
+
(source.slice(expStart, start).includes('from') || isDynamic) &&
|
|
38410
|
+
// edge case for package names ending with .css (e.g normalize.css)
|
|
38411
|
+
!(bareImportRE.test(specifier) && !specifier.includes('/'))) {
|
|
38412
|
+
const url = specifier.replace(/\?|$/, (m) => `?used${m ? '&' : ''}`);
|
|
38413
|
+
str().overwrite(start, end, isDynamic ? `'${url}'` : url, {
|
|
38414
|
+
contentOnly: true
|
|
38415
|
+
});
|
|
38391
38416
|
}
|
|
38392
38417
|
}
|
|
38393
38418
|
if (needPreloadHelper &&
|
|
@@ -41258,7 +41283,7 @@ function ssrManifestPlugin(config) {
|
|
|
41258
41283
|
const code = chunk.code;
|
|
41259
41284
|
let imports;
|
|
41260
41285
|
try {
|
|
41261
|
-
imports = parse$e(code)[0].filter((i) => i.d > -1);
|
|
41286
|
+
imports = parse$e(code)[0].filter((i) => i.n && i.d > -1);
|
|
41262
41287
|
}
|
|
41263
41288
|
catch (e) {
|
|
41264
41289
|
this.error(e, e.idx);
|
|
@@ -48163,7 +48188,7 @@ async function getCertificate(cacheDir) {
|
|
|
48163
48188
|
return content;
|
|
48164
48189
|
}
|
|
48165
48190
|
catch {
|
|
48166
|
-
const content = (await Promise.resolve().then(function () { return require('./dep-
|
|
48191
|
+
const content = (await Promise.resolve().then(function () { return require('./dep-24755698.js'); })).createCertificate();
|
|
48167
48192
|
fs$n.promises
|
|
48168
48193
|
.mkdir(cacheDir, { recursive: true })
|
|
48169
48194
|
.then(() => fs$n.promises.writeFile(cachePath, content))
|
|
@@ -49750,32 +49775,36 @@ function serveStaticMiddleware(dir, server) {
|
|
|
49750
49775
|
isInternalRequest(req.url)) {
|
|
49751
49776
|
return next();
|
|
49752
49777
|
}
|
|
49753
|
-
const url =
|
|
49778
|
+
const url = new URL(req.url, 'http://example.com');
|
|
49779
|
+
const pathname = decodeURIComponent(url.pathname);
|
|
49754
49780
|
// apply aliases to static requests as well
|
|
49755
|
-
let
|
|
49781
|
+
let redirectedPathname;
|
|
49756
49782
|
for (const { find, replacement } of server.config.resolve.alias) {
|
|
49757
|
-
const matches = typeof find === 'string'
|
|
49783
|
+
const matches = typeof find === 'string'
|
|
49784
|
+
? pathname.startsWith(find)
|
|
49785
|
+
: find.test(pathname);
|
|
49758
49786
|
if (matches) {
|
|
49759
|
-
|
|
49787
|
+
redirectedPathname = pathname.replace(find, replacement);
|
|
49760
49788
|
break;
|
|
49761
49789
|
}
|
|
49762
49790
|
}
|
|
49763
|
-
if (
|
|
49791
|
+
if (redirectedPathname) {
|
|
49764
49792
|
// dir is pre-normalized to posix style
|
|
49765
|
-
if (
|
|
49766
|
-
|
|
49793
|
+
if (redirectedPathname.startsWith(dir)) {
|
|
49794
|
+
redirectedPathname = redirectedPathname.slice(dir.length);
|
|
49767
49795
|
}
|
|
49768
49796
|
}
|
|
49769
|
-
const
|
|
49770
|
-
let fileUrl = path__default.resolve(dir,
|
|
49771
|
-
if (
|
|
49797
|
+
const resolvedPathname = redirectedPathname || pathname;
|
|
49798
|
+
let fileUrl = path__default.resolve(dir, resolvedPathname.replace(/^\//, ''));
|
|
49799
|
+
if (resolvedPathname.endsWith('/') && !fileUrl.endsWith('/')) {
|
|
49772
49800
|
fileUrl = fileUrl + '/';
|
|
49773
49801
|
}
|
|
49774
49802
|
if (!ensureServingAccess(fileUrl, server, res, next)) {
|
|
49775
49803
|
return;
|
|
49776
49804
|
}
|
|
49777
|
-
if (
|
|
49778
|
-
|
|
49805
|
+
if (redirectedPathname) {
|
|
49806
|
+
url.pathname = encodeURIComponent(redirectedPathname);
|
|
49807
|
+
req.url = url.href.slice(url.origin.length);
|
|
49779
49808
|
}
|
|
49780
49809
|
serve(req, res, next);
|
|
49781
49810
|
};
|
|
@@ -49784,20 +49813,22 @@ function serveRawFsMiddleware(server) {
|
|
|
49784
49813
|
const serveFromRoot = sirv('/', sirvOptions(server.config.server.headers));
|
|
49785
49814
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
|
49786
49815
|
return function viteServeRawFsMiddleware(req, res, next) {
|
|
49787
|
-
|
|
49816
|
+
const url = new URL(req.url, 'http://example.com');
|
|
49788
49817
|
// In some cases (e.g. linked monorepos) files outside of root will
|
|
49789
49818
|
// reference assets that are also out of served root. In such cases
|
|
49790
49819
|
// the paths are rewritten to `/@fs/` prefixed paths and must be served by
|
|
49791
49820
|
// searching based from fs root.
|
|
49792
|
-
if (url.startsWith(FS_PREFIX)) {
|
|
49821
|
+
if (url.pathname.startsWith(FS_PREFIX)) {
|
|
49822
|
+
const pathname = decodeURIComponent(url.pathname);
|
|
49793
49823
|
// restrict files outside of `fs.allow`
|
|
49794
|
-
if (!ensureServingAccess(slash(path__default.resolve(fsPathFromId(
|
|
49824
|
+
if (!ensureServingAccess(slash(path__default.resolve(fsPathFromId(pathname))), server, res, next)) {
|
|
49795
49825
|
return;
|
|
49796
49826
|
}
|
|
49797
|
-
|
|
49827
|
+
let newPathname = pathname.slice(FS_PREFIX.length);
|
|
49798
49828
|
if (isWindows$3)
|
|
49799
|
-
|
|
49800
|
-
|
|
49829
|
+
newPathname = newPathname.replace(/^[A-Z]:/i, '');
|
|
49830
|
+
url.pathname = encodeURIComponent(newPathname);
|
|
49831
|
+
req.url = url.href.slice(url.origin.length);
|
|
49801
49832
|
serveFromRoot(req, res, next);
|
|
49802
49833
|
}
|
|
49803
49834
|
else {
|
|
@@ -53068,7 +53099,7 @@ const http$3 = require$$1__default$1;
|
|
|
53068
53099
|
const net = require$$3__default;
|
|
53069
53100
|
const tls = require$$4__default;
|
|
53070
53101
|
const { randomBytes, createHash: createHash$1 } = require$$1__default$2;
|
|
53071
|
-
const { URL: URL$
|
|
53102
|
+
const { URL: URL$2 } = require$$0__default$5;
|
|
53072
53103
|
|
|
53073
53104
|
const PerMessageDeflate$1 = permessageDeflate;
|
|
53074
53105
|
const Receiver = receiver;
|
|
@@ -53722,12 +53753,12 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
53722
53753
|
|
|
53723
53754
|
let parsedUrl;
|
|
53724
53755
|
|
|
53725
|
-
if (address instanceof URL$
|
|
53756
|
+
if (address instanceof URL$2) {
|
|
53726
53757
|
parsedUrl = address;
|
|
53727
53758
|
websocket._url = address.href;
|
|
53728
53759
|
} else {
|
|
53729
53760
|
try {
|
|
53730
|
-
parsedUrl = new URL$
|
|
53761
|
+
parsedUrl = new URL$2(address);
|
|
53731
53762
|
} catch (e) {
|
|
53732
53763
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
53733
53764
|
}
|
|
@@ -53920,7 +53951,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
53920
53951
|
let addr;
|
|
53921
53952
|
|
|
53922
53953
|
try {
|
|
53923
|
-
addr = new URL$
|
|
53954
|
+
addr = new URL$2(location, address);
|
|
53924
53955
|
} catch (e) {
|
|
53925
53956
|
const err = new SyntaxError(`Invalid URL: ${location}`);
|
|
53926
53957
|
emitErrorAndClose(websocket, err);
|
|
@@ -55923,7 +55954,7 @@ var debug_1 = function () {
|
|
|
55923
55954
|
};
|
|
55924
55955
|
|
|
55925
55956
|
var url = require$$0__default$5;
|
|
55926
|
-
var URL = url.URL;
|
|
55957
|
+
var URL$1 = url.URL;
|
|
55927
55958
|
var http$1 = require$$1__default$1;
|
|
55928
55959
|
var https$1 = require$$1__default$3;
|
|
55929
55960
|
var Writable = require$$0__default$3.Writable;
|
|
@@ -56374,14 +56405,14 @@ function wrap(protocols) {
|
|
|
56374
56405
|
if (typeof input === "string") {
|
|
56375
56406
|
var urlStr = input;
|
|
56376
56407
|
try {
|
|
56377
|
-
input = urlToOptions(new URL(urlStr));
|
|
56408
|
+
input = urlToOptions(new URL$1(urlStr));
|
|
56378
56409
|
}
|
|
56379
56410
|
catch (err) {
|
|
56380
56411
|
/* istanbul ignore next */
|
|
56381
56412
|
input = url.parse(urlStr);
|
|
56382
56413
|
}
|
|
56383
56414
|
}
|
|
56384
|
-
else if (URL && (input instanceof URL)) {
|
|
56415
|
+
else if (URL$1 && (input instanceof URL$1)) {
|
|
56385
56416
|
input = urlToOptions(input);
|
|
56386
56417
|
}
|
|
56387
56418
|
else {
|
|
@@ -60803,11 +60834,21 @@ const wasmHelperId = '/__vite-wasm-helper';
|
|
|
60803
60834
|
const wasmHelper = async (opts = {}, url) => {
|
|
60804
60835
|
let result;
|
|
60805
60836
|
if (url.startsWith('data:')) {
|
|
60806
|
-
|
|
60807
|
-
|
|
60808
|
-
|
|
60809
|
-
|
|
60810
|
-
|
|
60837
|
+
const urlContent = url.replace(/^data:.*?base64,/, '');
|
|
60838
|
+
let bytes;
|
|
60839
|
+
if (typeof Buffer === 'function' && typeof Buffer.from === 'function') {
|
|
60840
|
+
bytes = Buffer.from(urlContent, 'base64');
|
|
60841
|
+
}
|
|
60842
|
+
else if (typeof atob === 'function') {
|
|
60843
|
+
// @ts-ignore
|
|
60844
|
+
const binaryString = atob(urlContent);
|
|
60845
|
+
bytes = new Uint8Array(binaryString.length);
|
|
60846
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
60847
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
60848
|
+
}
|
|
60849
|
+
}
|
|
60850
|
+
else {
|
|
60851
|
+
throw new Error('Failed to decode base64-encoded data URL, Buffer and atob are not supported');
|
|
60811
60852
|
}
|
|
60812
60853
|
// @ts-ignore
|
|
60813
60854
|
result = await WebAssembly.instantiate(bytes, opts);
|
|
@@ -61861,7 +61902,6 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
|
61861
61902
|
try {
|
|
61862
61903
|
let userConfig;
|
|
61863
61904
|
if (isESM) {
|
|
61864
|
-
const fileUrl = require('url').pathToFileURL(resolvedPath);
|
|
61865
61905
|
const bundled = await bundleConfigFile(resolvedPath, true);
|
|
61866
61906
|
dependencies = bundled.dependencies;
|
|
61867
61907
|
if (isTS) {
|
|
@@ -61869,13 +61909,16 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
|
|
|
61869
61909
|
// with --experimental-loader themselves, we have to do a hack here:
|
|
61870
61910
|
// bundle the config file w/ ts transforms first, write it to disk,
|
|
61871
61911
|
// load it with native Node ESM, then delete the file.
|
|
61872
|
-
|
|
61873
|
-
|
|
61874
|
-
|
|
61875
|
-
fs__default.
|
|
61912
|
+
const fileBase = `${resolvedPath}.timestamp-${Date.now()}`;
|
|
61913
|
+
const fileNameTmp = `${fileBase}.js`;
|
|
61914
|
+
const fileUrl = `${require('url').pathToFileURL(fileBase)}.js`;
|
|
61915
|
+
fs__default.writeFileSync(fileNameTmp, bundled.code);
|
|
61916
|
+
userConfig = (await dynamicImport(fileUrl)).default;
|
|
61917
|
+
fs__default.unlinkSync(fileNameTmp);
|
|
61876
61918
|
debug(`TS + native esm config loaded in ${getTime()}`, fileUrl);
|
|
61877
61919
|
}
|
|
61878
61920
|
else {
|
|
61921
|
+
const fileUrl = require('url').pathToFileURL(resolvedPath);
|
|
61879
61922
|
// using Function to avoid this from being compiled away by TS/Rollup
|
|
61880
61923
|
// append a query so that we force reload fresh config in case of
|
|
61881
61924
|
// server restart
|
package/dist/node/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var perf_hooks = require('perf_hooks');
|
|
4
4
|
var require$$0 = require('events');
|
|
5
|
-
var index = require('./chunks/dep-
|
|
5
|
+
var index = require('./chunks/dep-689425f3.js');
|
|
6
6
|
require('fs');
|
|
7
7
|
require('path');
|
|
8
8
|
require('url');
|
|
@@ -683,7 +683,7 @@ cli
|
|
|
683
683
|
.action(async (root, options) => {
|
|
684
684
|
// output structure is preserved even after bundling so require()
|
|
685
685
|
// is ok here
|
|
686
|
-
const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
686
|
+
const { createServer } = await Promise.resolve().then(function () { return require('./chunks/dep-689425f3.js'); }).then(function (n) { return n.index$1; });
|
|
687
687
|
try {
|
|
688
688
|
const server = await createServer({
|
|
689
689
|
root,
|
|
@@ -732,7 +732,7 @@ cli
|
|
|
732
732
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
733
733
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
734
734
|
.action(async (root, options) => {
|
|
735
|
-
const { build } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
735
|
+
const { build } = await Promise.resolve().then(function () { return require('./chunks/dep-689425f3.js'); }).then(function (n) { return n.build$1; });
|
|
736
736
|
const buildOptions = cleanOptions(options);
|
|
737
737
|
try {
|
|
738
738
|
await build({
|
|
@@ -755,7 +755,7 @@ cli
|
|
|
755
755
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
756
756
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
757
757
|
.action(async (root, options) => {
|
|
758
|
-
const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
758
|
+
const { optimizeDeps } = await Promise.resolve().then(function () { return require('./chunks/dep-689425f3.js'); }).then(function (n) { return n.index; });
|
|
759
759
|
try {
|
|
760
760
|
const config = await index.resolveConfig({
|
|
761
761
|
root,
|
|
@@ -778,7 +778,7 @@ cli
|
|
|
778
778
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
779
779
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
780
780
|
.action(async (root, options) => {
|
|
781
|
-
const { preview } = await Promise.resolve().then(function () { return require('./chunks/dep-
|
|
781
|
+
const { preview } = await Promise.resolve().then(function () { return require('./chunks/dep-689425f3.js'); }).then(function (n) { return n.preview$1; });
|
|
782
782
|
try {
|
|
783
783
|
const server = await preview({
|
|
784
784
|
root,
|
package/dist/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Evan You",
|
|
6
6
|
"description": "Native-ESM powered web dev build tool",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"esbuild": "^0.14.27",
|
|
47
47
|
"postcss": "^8.4.13",
|
|
48
48
|
"resolve": "^1.22.0",
|
|
49
|
-
"rollup": "
|
|
49
|
+
"rollup": ">=2.59.0 <2.78.0"
|
|
50
50
|
},
|
|
51
51
|
"optionalDependencies": {
|
|
52
52
|
"fsevents": "~2.3.2"
|