vite 3.0.3 → 3.0.6
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/bin/vite.js +1 -1
- package/dist/node/chunks/{dep-676c6c22.js → dep-2274fed5.js} +1 -1
- package/dist/node/chunks/{dep-c6273c7a.js → dep-88cc3a4f.js} +386 -223
- package/dist/node/chunks/{dep-41eb528c.js → dep-94c1417a.js} +0 -0
- package/dist/node/chunks/{dep-7f3e64a3.js → dep-c7c58113.js} +1 -1
- package/dist/node/cli.js +6 -6
- package/dist/node/constants.js +1 -1
- package/dist/node/index.d.ts +148 -49
- package/dist/node/index.js +2 -2
- package/dist/node-cjs/publicUtils.cjs +2 -2
- package/package.json +11 -11
- package/types/commonjs.d.ts +61 -13
- package/types/connect.d.ts +1 -1
- package/types/http-proxy.d.ts +41 -33
- package/types/terser.d.ts +43 -0
- package/types/ws.d.ts +1 -1
|
@@ -7,7 +7,7 @@ import require$$0$3 from 'tty';
|
|
|
7
7
|
import { transform as transform$2, build as build$3, formatMessages } from 'esbuild';
|
|
8
8
|
import require$$0$4, { sep, resolve as resolve$4, posix as posix$1, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join as join$1, win32 as win32$1, isAbsolute as isAbsolute$1, normalize } from 'path';
|
|
9
9
|
import * as require$$0$2 from 'fs';
|
|
10
|
-
import require$$0__default, { statSync as statSync$1,
|
|
10
|
+
import require$$0__default, { existsSync, readFileSync, statSync as statSync$1, promises as promises$1, readdirSync } from 'fs';
|
|
11
11
|
import require$$0$5 from 'events';
|
|
12
12
|
import assert$1 from 'assert';
|
|
13
13
|
import require$$0$6, { format as format$2, inspect } from 'util';
|
|
@@ -22,7 +22,7 @@ import { createHash as createHash$2 } from 'node:crypto';
|
|
|
22
22
|
import { promisify as promisify$4 } from 'node:util';
|
|
23
23
|
import { promises } from 'node:dns';
|
|
24
24
|
import resolve$5 from 'resolve';
|
|
25
|
-
import { CLIENT_ENTRY, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1,
|
|
25
|
+
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, SPECIAL_QUERY_RE, KNOWN_ASSET_TYPES, JS_TYPES_RE, ESBUILD_MODULES_TARGET, CLIENT_DIR, NULL_BYTE_PLACEHOLDER, VERSION, VITE_PACKAGE_DIR, ENV_ENTRY, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
|
26
26
|
import require$$5 from 'crypto';
|
|
27
27
|
import require$$0$a from 'buffer';
|
|
28
28
|
import require$$0$8, { createRequire as createRequire$2 } from 'module';
|
|
@@ -33,7 +33,7 @@ import { STATUS_CODES } from 'node:http';
|
|
|
33
33
|
import { createServer as createServer$2 } from 'node:https';
|
|
34
34
|
import require$$1$1 from 'worker_threads';
|
|
35
35
|
import * as qs from 'querystring';
|
|
36
|
-
import readline from 'readline';
|
|
36
|
+
import readline from 'node:readline';
|
|
37
37
|
import { execSync } from 'node:child_process';
|
|
38
38
|
import zlib$1, { gzip } from 'node:zlib';
|
|
39
39
|
|
|
@@ -7255,7 +7255,7 @@ function isReference(node, parent) {
|
|
|
7255
7255
|
return false;
|
|
7256
7256
|
}
|
|
7257
7257
|
|
|
7258
|
-
var version$1 = "22.0.
|
|
7258
|
+
var version$1 = "22.0.2";
|
|
7259
7259
|
var peerDependencies = {
|
|
7260
7260
|
rollup: "^2.68.0"
|
|
7261
7261
|
};
|
|
@@ -8213,7 +8213,7 @@ function hasDefineEsmProperty(node) {
|
|
|
8213
8213
|
});
|
|
8214
8214
|
}
|
|
8215
8215
|
|
|
8216
|
-
function wrapCode(magicString, uses, moduleName, exportsName) {
|
|
8216
|
+
function wrapCode(magicString, uses, moduleName, exportsName, indentExclusionRanges) {
|
|
8217
8217
|
const args = [];
|
|
8218
8218
|
const passedArgs = [];
|
|
8219
8219
|
if (uses.module) {
|
|
@@ -8226,7 +8226,7 @@ function wrapCode(magicString, uses, moduleName, exportsName) {
|
|
|
8226
8226
|
}
|
|
8227
8227
|
magicString
|
|
8228
8228
|
.trim()
|
|
8229
|
-
.indent('\t')
|
|
8229
|
+
.indent('\t', { exclude: indentExclusionRanges })
|
|
8230
8230
|
.prepend(`(function (${args.join(', ')}) {\n`)
|
|
8231
8231
|
.append(`\n} (${passedArgs.join(', ')}));`);
|
|
8232
8232
|
}
|
|
@@ -8724,6 +8724,7 @@ async function transformCommonjs(
|
|
|
8724
8724
|
const replacedGlobal = [];
|
|
8725
8725
|
const replacedDynamicRequires = [];
|
|
8726
8726
|
const importedVariables = new Set();
|
|
8727
|
+
const indentExclusionRanges = [];
|
|
8727
8728
|
|
|
8728
8729
|
walk$3(ast, {
|
|
8729
8730
|
enter(node, parent) {
|
|
@@ -9022,6 +9023,11 @@ async function transformCommonjs(
|
|
|
9022
9023
|
if (!scope.parent) {
|
|
9023
9024
|
topLevelDeclarations.push(node);
|
|
9024
9025
|
}
|
|
9026
|
+
return;
|
|
9027
|
+
case 'TemplateElement':
|
|
9028
|
+
if (node.value.raw.includes('\n')) {
|
|
9029
|
+
indentExclusionRanges.push([node.start, node.end]);
|
|
9030
|
+
}
|
|
9025
9031
|
}
|
|
9026
9032
|
},
|
|
9027
9033
|
|
|
@@ -9154,11 +9160,13 @@ async function transformCommonjs(
|
|
|
9154
9160
|
);
|
|
9155
9161
|
|
|
9156
9162
|
if (shouldWrap) {
|
|
9157
|
-
wrapCode(magicString, uses, moduleName, exportsName);
|
|
9163
|
+
wrapCode(magicString, uses, moduleName, exportsName, indentExclusionRanges);
|
|
9158
9164
|
}
|
|
9159
9165
|
|
|
9160
9166
|
if (usesRequireWrapper) {
|
|
9161
|
-
magicString.trim().indent('\t'
|
|
9167
|
+
magicString.trim().indent('\t', {
|
|
9168
|
+
exclude: indentExclusionRanges
|
|
9169
|
+
});
|
|
9162
9170
|
magicString.prepend(
|
|
9163
9171
|
`var ${isRequiredName};
|
|
9164
9172
|
|
|
@@ -27484,10 +27492,10 @@ function getLineInfo(input, offset) {
|
|
|
27484
27492
|
var defaultOptions = {
|
|
27485
27493
|
// `ecmaVersion` indicates the ECMAScript version to parse. Must be
|
|
27486
27494
|
// either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
|
|
27487
|
-
// (2019), 11 (2020), 12 (2021), 13 (2022), or `"latest"`
|
|
27488
|
-
// latest version the library supports). This influences
|
|
27489
|
-
// for strict mode, the set of reserved words, and support
|
|
27490
|
-
// new syntax features.
|
|
27495
|
+
// (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"`
|
|
27496
|
+
// (the latest version the library supports). This influences
|
|
27497
|
+
// support for strict mode, the set of reserved words, and support
|
|
27498
|
+
// for new syntax features.
|
|
27491
27499
|
ecmaVersion: null,
|
|
27492
27500
|
// `sourceType` indicates the mode the code should be parsed in.
|
|
27493
27501
|
// Can be either `"script"` or `"module"`. This influences global
|
|
@@ -27521,8 +27529,9 @@ var defaultOptions = {
|
|
|
27521
27529
|
// When enabled, super identifiers are not constrained to
|
|
27522
27530
|
// appearing in methods and do not raise an error when they appear elsewhere.
|
|
27523
27531
|
allowSuperOutsideMethod: null,
|
|
27524
|
-
// When enabled, hashbang directive in the beginning of file
|
|
27525
|
-
//
|
|
27532
|
+
// When enabled, hashbang directive in the beginning of file is
|
|
27533
|
+
// allowed and treated as a line comment. Enabled by default when
|
|
27534
|
+
// `ecmaVersion` >= 2023.
|
|
27526
27535
|
allowHashBang: false,
|
|
27527
27536
|
// When `locations` is on, `loc` properties holding objects with
|
|
27528
27537
|
// `start` and `end` properties in `{line, column}` form (with
|
|
@@ -27597,6 +27606,9 @@ function getOptions(opts) {
|
|
|
27597
27606
|
if (options.allowReserved == null)
|
|
27598
27607
|
{ options.allowReserved = options.ecmaVersion < 5; }
|
|
27599
27608
|
|
|
27609
|
+
if (opts.allowHashBang == null)
|
|
27610
|
+
{ options.allowHashBang = options.ecmaVersion >= 14; }
|
|
27611
|
+
|
|
27600
27612
|
if (isArray(options.onToken)) {
|
|
27601
27613
|
var tokens = options.onToken;
|
|
27602
27614
|
options.onToken = function (token) { return tokens.push(token); };
|
|
@@ -27927,7 +27939,7 @@ pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
|
27927
27939
|
if (refDestructuringErrors.trailingComma > -1)
|
|
27928
27940
|
{ this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
|
|
27929
27941
|
var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
|
|
27930
|
-
if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
|
|
27942
|
+
if (parens > -1) { this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern"); }
|
|
27931
27943
|
};
|
|
27932
27944
|
|
|
27933
27945
|
pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
@@ -29023,6 +29035,7 @@ pp$8.adaptDirectivePrologue = function(statements) {
|
|
|
29023
29035
|
};
|
|
29024
29036
|
pp$8.isDirectiveCandidate = function(statement) {
|
|
29025
29037
|
return (
|
|
29038
|
+
this.options.ecmaVersion >= 5 &&
|
|
29026
29039
|
statement.type === "ExpressionStatement" &&
|
|
29027
29040
|
statement.expression.type === "Literal" &&
|
|
29028
29041
|
typeof statement.expression.value === "string" &&
|
|
@@ -29433,7 +29446,8 @@ pp$6.updateContext = function(prevType) {
|
|
|
29433
29446
|
{ this.exprAllowed = type.beforeExpr; }
|
|
29434
29447
|
};
|
|
29435
29448
|
|
|
29436
|
-
// Used to handle egde
|
|
29449
|
+
// Used to handle egde cases when token context could not be inferred correctly during tokenization phase
|
|
29450
|
+
|
|
29437
29451
|
pp$6.overrideContext = function(tokenCtx) {
|
|
29438
29452
|
if (this.curContext() !== tokenCtx) {
|
|
29439
29453
|
this.context[this.context.length - 1] = tokenCtx;
|
|
@@ -30249,15 +30263,6 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
30249
30263
|
}
|
|
30250
30264
|
return this.finishNode(prop, "RestElement")
|
|
30251
30265
|
}
|
|
30252
|
-
// To disallow parenthesized identifier via `this.toAssignable()`.
|
|
30253
|
-
if (this.type === types$1.parenL && refDestructuringErrors) {
|
|
30254
|
-
if (refDestructuringErrors.parenthesizedAssign < 0) {
|
|
30255
|
-
refDestructuringErrors.parenthesizedAssign = this.start;
|
|
30256
|
-
}
|
|
30257
|
-
if (refDestructuringErrors.parenthesizedBind < 0) {
|
|
30258
|
-
refDestructuringErrors.parenthesizedBind = this.start;
|
|
30259
|
-
}
|
|
30260
|
-
}
|
|
30261
30266
|
// Parse argument.
|
|
30262
30267
|
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
30263
30268
|
// To disallow trailing comma via `this.toAssignable()`.
|
|
@@ -32687,7 +32692,7 @@ pp.readWord = function() {
|
|
|
32687
32692
|
|
|
32688
32693
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
32689
32694
|
|
|
32690
|
-
var version = "8.
|
|
32695
|
+
var version = "8.8.0";
|
|
32691
32696
|
|
|
32692
32697
|
Parser.acorn = {
|
|
32693
32698
|
Parser: Parser,
|
|
@@ -33303,7 +33308,7 @@ function assetPlugin(config) {
|
|
|
33303
33308
|
const url = await fileToUrl(id, config, this);
|
|
33304
33309
|
return `export default ${JSON.stringify(url)}`;
|
|
33305
33310
|
},
|
|
33306
|
-
renderChunk(code, chunk) {
|
|
33311
|
+
renderChunk(code, chunk, outputOptions) {
|
|
33307
33312
|
let match;
|
|
33308
33313
|
let s;
|
|
33309
33314
|
// Urls added with JS using e.g.
|
|
@@ -33319,7 +33324,7 @@ function assetPlugin(config) {
|
|
|
33319
33324
|
const file = getAssetFilename(hash, config) || this.getFileName(hash);
|
|
33320
33325
|
chunk.viteMetadata.importedAssets.add(cleanUrl(file));
|
|
33321
33326
|
const filename = file + postfix;
|
|
33322
|
-
const replacement = toOutputFilePathInString(filename, 'asset', chunk.fileName, 'js', config);
|
|
33327
|
+
const replacement = toOutputFilePathInString(filename, 'asset', chunk.fileName, 'js', config, outputOptions.format);
|
|
33323
33328
|
const replacementString = typeof replacement === 'string'
|
|
33324
33329
|
? JSON.stringify(replacement).slice(1, -1)
|
|
33325
33330
|
: `"+${replacement.runtime}+"`;
|
|
@@ -33333,7 +33338,7 @@ function assetPlugin(config) {
|
|
|
33333
33338
|
s = s || (s = new MagicString(code));
|
|
33334
33339
|
const [full, hash] = match;
|
|
33335
33340
|
const publicUrl = publicAssetUrlMap.get(hash).slice(1);
|
|
33336
|
-
const replacement = toOutputFilePathInString(publicUrl, 'public', chunk.fileName, 'js', config);
|
|
33341
|
+
const replacement = toOutputFilePathInString(publicUrl, 'public', chunk.fileName, 'js', config, outputOptions.format);
|
|
33337
33342
|
const replacementString = typeof replacement === 'string'
|
|
33338
33343
|
? JSON.stringify(replacement).slice(1, -1)
|
|
33339
33344
|
: `"+${replacement.runtime}+"`;
|
|
@@ -33408,6 +33413,9 @@ function fileToDevUrl(id, config) {
|
|
|
33408
33413
|
function getAssetFilename(hash, config) {
|
|
33409
33414
|
return assetHashToFilenameMap.get(config)?.get(hash);
|
|
33410
33415
|
}
|
|
33416
|
+
function getPublicAssetFilename(hash, config) {
|
|
33417
|
+
return publicAssetUrlCache.get(config)?.get(hash);
|
|
33418
|
+
}
|
|
33411
33419
|
function resolveAssetFileNames(config) {
|
|
33412
33420
|
const output = config.build?.rollupOptions?.output;
|
|
33413
33421
|
const defaultAssetFileNames = path$n.posix.join(config.build.assetsDir, '[name].[hash][extname]');
|
|
@@ -33822,10 +33830,6 @@ function resolvePlugin(resolveOptions) {
|
|
|
33822
33830
|
if (id.startsWith(browserExternalId)) {
|
|
33823
33831
|
return id;
|
|
33824
33832
|
}
|
|
33825
|
-
// fast path for commonjs proxy modules
|
|
33826
|
-
if (/\?commonjs/.test(id) || id === 'commonjsHelpers.js') {
|
|
33827
|
-
return;
|
|
33828
|
-
}
|
|
33829
33833
|
const targetWeb = !ssr || ssrTarget === 'webworker';
|
|
33830
33834
|
// this is passed by @rollup/plugin-commonjs
|
|
33831
33835
|
const isRequire = resolveOpts?.custom?.['node-resolve']?.isRequire ?? false;
|
|
@@ -34180,18 +34184,20 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr, ex
|
|
|
34180
34184
|
if (!externalize) {
|
|
34181
34185
|
return resolved;
|
|
34182
34186
|
}
|
|
34183
|
-
//
|
|
34187
|
+
// don't external symlink packages
|
|
34184
34188
|
if (!allowLinkedExternal && !resolved.id.includes('node_modules')) {
|
|
34185
34189
|
return resolved;
|
|
34186
34190
|
}
|
|
34187
34191
|
const resolvedExt = path$n.extname(resolved.id);
|
|
34192
|
+
// don't external non-js imports
|
|
34193
|
+
if (resolvedExt &&
|
|
34194
|
+
resolvedExt !== '.js' &&
|
|
34195
|
+
resolvedExt !== '.mjs' &&
|
|
34196
|
+
resolvedExt !== '.cjs') {
|
|
34197
|
+
return resolved;
|
|
34198
|
+
}
|
|
34188
34199
|
let resolvedId = id;
|
|
34189
34200
|
if (isDeepImport) {
|
|
34190
|
-
// check ext before externalizing - only externalize
|
|
34191
|
-
// extension-less imports and explicit .js imports
|
|
34192
|
-
if (resolvedExt && !resolved.id.match(/(.js|.mjs|.cjs)$/)) {
|
|
34193
|
-
return resolved;
|
|
34194
|
-
}
|
|
34195
34201
|
if (!pkg?.data.exports && path$n.extname(id) !== resolvedExt) {
|
|
34196
34202
|
resolvedId += resolvedExt;
|
|
34197
34203
|
}
|
|
@@ -34358,6 +34364,9 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
|
|
|
34358
34364
|
// likely UMD or CJS(!!! e.g. firebase 7.x), prefer module
|
|
34359
34365
|
entryPoint = data.module;
|
|
34360
34366
|
}
|
|
34367
|
+
else {
|
|
34368
|
+
entryPoint = browserEntry;
|
|
34369
|
+
}
|
|
34361
34370
|
}
|
|
34362
34371
|
}
|
|
34363
34372
|
else {
|
|
@@ -35390,10 +35399,6 @@ function importGlobPlugin(config) {
|
|
|
35390
35399
|
if (server) {
|
|
35391
35400
|
const allGlobs = result.matches.map((i) => i.globsResolved);
|
|
35392
35401
|
server._importGlobMap.set(id, allGlobs);
|
|
35393
|
-
result.files.forEach((file) => {
|
|
35394
|
-
// update watcher
|
|
35395
|
-
server.watcher.add(dirname(file));
|
|
35396
|
-
});
|
|
35397
35402
|
}
|
|
35398
35403
|
return transformStableResult(result.s, id, config);
|
|
35399
35404
|
}
|
|
@@ -35472,24 +35477,31 @@ async function parseImportGlob(code, importer, root, resolveId) {
|
|
|
35472
35477
|
const arg1 = ast.arguments[0];
|
|
35473
35478
|
const arg2 = ast.arguments[1];
|
|
35474
35479
|
const globs = [];
|
|
35475
|
-
|
|
35476
|
-
|
|
35477
|
-
|
|
35478
|
-
|
|
35479
|
-
if (element.type !== 'Literal')
|
|
35480
|
-
throw err('Could only use literals');
|
|
35480
|
+
const validateLiteral = (element) => {
|
|
35481
|
+
if (!element)
|
|
35482
|
+
return;
|
|
35483
|
+
if (element.type === 'Literal') {
|
|
35481
35484
|
if (typeof element.value !== 'string')
|
|
35482
35485
|
throw err(`Expected glob to be a string, but got "${typeof element.value}"`);
|
|
35483
35486
|
globs.push(element.value);
|
|
35484
35487
|
}
|
|
35485
|
-
|
|
35486
|
-
|
|
35487
|
-
|
|
35488
|
-
|
|
35489
|
-
|
|
35488
|
+
else if (element.type === 'TemplateLiteral') {
|
|
35489
|
+
if (element.expressions.length !== 0) {
|
|
35490
|
+
throw err(`Expected glob to be a string, but got dynamic template literal`);
|
|
35491
|
+
}
|
|
35492
|
+
globs.push(element.quasis[0].value.raw);
|
|
35493
|
+
}
|
|
35494
|
+
else {
|
|
35495
|
+
throw err('Could only use literals');
|
|
35496
|
+
}
|
|
35497
|
+
};
|
|
35498
|
+
if (arg1.type === 'ArrayExpression') {
|
|
35499
|
+
for (const element of arg1.elements) {
|
|
35500
|
+
validateLiteral(element);
|
|
35501
|
+
}
|
|
35490
35502
|
}
|
|
35491
35503
|
else {
|
|
35492
|
-
|
|
35504
|
+
validateLiteral(arg1);
|
|
35493
35505
|
}
|
|
35494
35506
|
// arg2
|
|
35495
35507
|
const options = {};
|
|
@@ -35662,7 +35674,7 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
|
|
|
35662
35674
|
}
|
|
35663
35675
|
});
|
|
35664
35676
|
files.forEach((i) => matchedFiles.add(i));
|
|
35665
|
-
const replacement =
|
|
35677
|
+
const replacement = `/* #__PURE__ */ Object.assign({${objectProps.join(',')}})`;
|
|
35666
35678
|
s.overwrite(start, end, replacement);
|
|
35667
35679
|
return staticImports;
|
|
35668
35680
|
}))).flat();
|
|
@@ -35815,7 +35827,8 @@ function globEntries(pattern, config) {
|
|
|
35815
35827
|
? []
|
|
35816
35828
|
: [`**/__tests__/**`, `**/coverage/**`])
|
|
35817
35829
|
],
|
|
35818
|
-
absolute: true
|
|
35830
|
+
absolute: true,
|
|
35831
|
+
suppressErrors: true // suppress EACCES errors
|
|
35819
35832
|
});
|
|
35820
35833
|
}
|
|
35821
35834
|
const scriptModuleRE = /(<script\b[^>]*type\s*=\s*(?:"module"|'module')[^>]*>)(.*?)<\/script>/gims;
|
|
@@ -37374,79 +37387,97 @@ function matchAll(regex, string, addition) {
|
|
|
37374
37387
|
return matches;
|
|
37375
37388
|
}
|
|
37376
37389
|
|
|
37377
|
-
const ESM_STATIC_IMPORT_RE = /(?<=\s|^|;)import\s*(["'\s]*(?<imports>[\w*${}\n\r\t, /]+)from\s*)?["']\s*(?<specifier>(?<="\s*)[^"]*[^"\s](?=\s*")|(?<='\s*)[^']*[^'\s](?=\s*'))\s*["'][\s;]*/gm;
|
|
37378
|
-
function findStaticImports(code) {
|
|
37379
|
-
return matchAll(ESM_STATIC_IMPORT_RE, code, { type: "static" });
|
|
37380
|
-
}
|
|
37381
|
-
function parseStaticImport(matched) {
|
|
37382
|
-
const cleanedImports = (matched.imports || "").replace(/(\/\/[^\n]*\n|\/\*.*\*\/)/g, "").replace(/\s+/g, " ");
|
|
37383
|
-
const namedImports = {};
|
|
37384
|
-
for (const namedImport of cleanedImports.match(/\{([^}]*)\}/)?.[1]?.split(",") || []) {
|
|
37385
|
-
const [, source = namedImport.trim(), importName = source] = namedImport.match(/^\s*([^\s]*) as ([^\s]*)\s*$/) || [];
|
|
37386
|
-
if (source) {
|
|
37387
|
-
namedImports[source] = importName;
|
|
37388
|
-
}
|
|
37389
|
-
}
|
|
37390
|
-
const topLevelImports = cleanedImports.replace(/\{([^}]*)\}/, "");
|
|
37391
|
-
const namespacedImport = topLevelImports.match(/\* as \s*([^\s]*)/)?.[1];
|
|
37392
|
-
const defaultImport = topLevelImports.split(",").find((i) => !i.match(/[*{}]/))?.trim() || void 0;
|
|
37393
|
-
return {
|
|
37394
|
-
...matched,
|
|
37395
|
-
defaultImport,
|
|
37396
|
-
namespacedImport,
|
|
37397
|
-
namedImports
|
|
37398
|
-
};
|
|
37399
|
-
}
|
|
37400
|
-
|
|
37401
37390
|
const isWindows$3 = process.platform === "win32";
|
|
37402
37391
|
const own$1 = {}.hasOwnProperty;
|
|
37403
37392
|
const messages = /* @__PURE__ */ new Map();
|
|
37404
37393
|
const nodeInternalPrefix = "__node_internal_";
|
|
37405
37394
|
let userStackTraceLimit;
|
|
37406
|
-
createError(
|
|
37407
|
-
|
|
37408
|
-
|
|
37409
|
-
|
|
37410
|
-
|
|
37411
|
-
|
|
37412
|
-
|
|
37413
|
-
|
|
37414
|
-
|
|
37415
|
-
|
|
37416
|
-
return `Invalid
|
|
37417
|
-
}
|
|
37418
|
-
|
|
37419
|
-
|
|
37420
|
-
createError(
|
|
37421
|
-
|
|
37422
|
-
|
|
37423
|
-
|
|
37424
|
-
|
|
37425
|
-
|
|
37426
|
-
|
|
37427
|
-
|
|
37428
|
-
return `
|
|
37429
|
-
|
|
37430
|
-
|
|
37431
|
-
},
|
|
37432
|
-
|
|
37433
|
-
|
|
37434
|
-
createError(
|
|
37435
|
-
|
|
37436
|
-
|
|
37437
|
-
|
|
37438
|
-
}
|
|
37439
|
-
|
|
37440
|
-
|
|
37441
|
-
|
|
37442
|
-
|
|
37443
|
-
|
|
37444
|
-
|
|
37445
|
-
|
|
37446
|
-
|
|
37447
|
-
|
|
37448
|
-
|
|
37449
|
-
|
|
37395
|
+
createError(
|
|
37396
|
+
"ERR_INVALID_MODULE_SPECIFIER",
|
|
37397
|
+
(request, reason, base = void 0) => {
|
|
37398
|
+
return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
|
|
37399
|
+
},
|
|
37400
|
+
TypeError
|
|
37401
|
+
);
|
|
37402
|
+
createError(
|
|
37403
|
+
"ERR_INVALID_PACKAGE_CONFIG",
|
|
37404
|
+
(path, base, message) => {
|
|
37405
|
+
return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
37406
|
+
},
|
|
37407
|
+
Error
|
|
37408
|
+
);
|
|
37409
|
+
createError(
|
|
37410
|
+
"ERR_INVALID_PACKAGE_TARGET",
|
|
37411
|
+
(pkgPath, key, target, isImport = false, base = void 0) => {
|
|
37412
|
+
const relError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
37413
|
+
if (key === ".") {
|
|
37414
|
+
assert$1(isImport === false);
|
|
37415
|
+
return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`;
|
|
37416
|
+
}
|
|
37417
|
+
return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
|
|
37418
|
+
target
|
|
37419
|
+
)} defined for '${key}' in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`;
|
|
37420
|
+
},
|
|
37421
|
+
Error
|
|
37422
|
+
);
|
|
37423
|
+
createError(
|
|
37424
|
+
"ERR_MODULE_NOT_FOUND",
|
|
37425
|
+
(path, base, type = "package") => {
|
|
37426
|
+
return `Cannot find ${type} '${path}' imported from ${base}`;
|
|
37427
|
+
},
|
|
37428
|
+
Error
|
|
37429
|
+
);
|
|
37430
|
+
createError(
|
|
37431
|
+
"ERR_PACKAGE_IMPORT_NOT_DEFINED",
|
|
37432
|
+
(specifier, packagePath, base) => {
|
|
37433
|
+
return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`;
|
|
37434
|
+
},
|
|
37435
|
+
TypeError
|
|
37436
|
+
);
|
|
37437
|
+
createError(
|
|
37438
|
+
"ERR_PACKAGE_PATH_NOT_EXPORTED",
|
|
37439
|
+
(pkgPath, subpath, base = void 0) => {
|
|
37440
|
+
if (subpath === ".") {
|
|
37441
|
+
return `No "exports" main defined in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
37442
|
+
}
|
|
37443
|
+
return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
37444
|
+
},
|
|
37445
|
+
Error
|
|
37446
|
+
);
|
|
37447
|
+
createError(
|
|
37448
|
+
"ERR_UNSUPPORTED_DIR_IMPORT",
|
|
37449
|
+
"Directory import '%s' is not supported resolving ES modules imported from %s",
|
|
37450
|
+
Error
|
|
37451
|
+
);
|
|
37452
|
+
createError(
|
|
37453
|
+
"ERR_UNKNOWN_FILE_EXTENSION",
|
|
37454
|
+
'Unknown file extension "%s" for %s',
|
|
37455
|
+
TypeError
|
|
37456
|
+
);
|
|
37457
|
+
createError(
|
|
37458
|
+
"ERR_INVALID_ARG_VALUE",
|
|
37459
|
+
(name, value, reason = "is invalid") => {
|
|
37460
|
+
let inspected = inspect(value);
|
|
37461
|
+
if (inspected.length > 128) {
|
|
37462
|
+
inspected = `${inspected.slice(0, 128)}...`;
|
|
37463
|
+
}
|
|
37464
|
+
const type = name.includes(".") ? "property" : "argument";
|
|
37465
|
+
return `The ${type} '${name}' ${reason}. Received ${inspected}`;
|
|
37466
|
+
},
|
|
37467
|
+
TypeError
|
|
37468
|
+
);
|
|
37469
|
+
createError(
|
|
37470
|
+
"ERR_UNSUPPORTED_ESM_URL_SCHEME",
|
|
37471
|
+
(url) => {
|
|
37472
|
+
let message = "Only file and data URLs are supported by the default ESM loader";
|
|
37473
|
+
if (isWindows$3 && url.protocol.length === 2) {
|
|
37474
|
+
message += ". On Windows, absolute paths must be valid file:// URLs";
|
|
37475
|
+
}
|
|
37476
|
+
message += `. Received protocol '${url.protocol}'`;
|
|
37477
|
+
return message;
|
|
37478
|
+
},
|
|
37479
|
+
Error
|
|
37480
|
+
);
|
|
37450
37481
|
function createError(sym, value, def) {
|
|
37451
37482
|
messages.set(sym, value);
|
|
37452
37483
|
return makeNodeErrorWithCode(def, sym);
|
|
@@ -37482,20 +37513,22 @@ function makeNodeErrorWithCode(Base, key) {
|
|
|
37482
37513
|
return error;
|
|
37483
37514
|
}
|
|
37484
37515
|
}
|
|
37485
|
-
const addCodeToName = hideStackFrames(
|
|
37486
|
-
error
|
|
37487
|
-
|
|
37488
|
-
|
|
37489
|
-
|
|
37490
|
-
|
|
37491
|
-
|
|
37492
|
-
|
|
37493
|
-
|
|
37494
|
-
|
|
37495
|
-
|
|
37496
|
-
|
|
37516
|
+
const addCodeToName = hideStackFrames(
|
|
37517
|
+
function(error, name, code) {
|
|
37518
|
+
error = captureLargerStackTrace(error);
|
|
37519
|
+
error.name = `${name} [${code}]`;
|
|
37520
|
+
if (name === "SystemError") {
|
|
37521
|
+
Object.defineProperty(error, "name", {
|
|
37522
|
+
value: name,
|
|
37523
|
+
enumerable: false,
|
|
37524
|
+
writable: true,
|
|
37525
|
+
configurable: true
|
|
37526
|
+
});
|
|
37527
|
+
} else {
|
|
37528
|
+
delete error.name;
|
|
37529
|
+
}
|
|
37497
37530
|
}
|
|
37498
|
-
|
|
37531
|
+
);
|
|
37499
37532
|
function isErrorStackTraceLimitWritable() {
|
|
37500
37533
|
const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
37501
37534
|
if (desc === void 0) {
|
|
@@ -37508,26 +37541,34 @@ function hideStackFrames(fn) {
|
|
|
37508
37541
|
Object.defineProperty(fn, "name", { value: hidden });
|
|
37509
37542
|
return fn;
|
|
37510
37543
|
}
|
|
37511
|
-
const captureLargerStackTrace = hideStackFrames(
|
|
37512
|
-
|
|
37513
|
-
|
|
37514
|
-
|
|
37515
|
-
|
|
37516
|
-
|
|
37517
|
-
|
|
37518
|
-
|
|
37519
|
-
|
|
37544
|
+
const captureLargerStackTrace = hideStackFrames(
|
|
37545
|
+
function(error) {
|
|
37546
|
+
const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
37547
|
+
if (stackTraceLimitIsWritable) {
|
|
37548
|
+
userStackTraceLimit = Error.stackTraceLimit;
|
|
37549
|
+
Error.stackTraceLimit = Number.POSITIVE_INFINITY;
|
|
37550
|
+
}
|
|
37551
|
+
Error.captureStackTrace(error);
|
|
37552
|
+
if (stackTraceLimitIsWritable) {
|
|
37553
|
+
Error.stackTraceLimit = userStackTraceLimit;
|
|
37554
|
+
}
|
|
37555
|
+
return error;
|
|
37520
37556
|
}
|
|
37521
|
-
|
|
37522
|
-
});
|
|
37557
|
+
);
|
|
37523
37558
|
function getMessage(key, args, self) {
|
|
37524
37559
|
const message = messages.get(key);
|
|
37525
37560
|
if (typeof message === "function") {
|
|
37526
|
-
assert$1(
|
|
37561
|
+
assert$1(
|
|
37562
|
+
message.length <= args.length,
|
|
37563
|
+
`Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${message.length}).`
|
|
37564
|
+
);
|
|
37527
37565
|
return Reflect.apply(message, self, args);
|
|
37528
37566
|
}
|
|
37529
37567
|
const expectedLength = (message.match(/%[dfijoOs]/g) || []).length;
|
|
37530
|
-
assert$1(
|
|
37568
|
+
assert$1(
|
|
37569
|
+
expectedLength === args.length,
|
|
37570
|
+
`Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`
|
|
37571
|
+
);
|
|
37531
37572
|
if (args.length === 0) {
|
|
37532
37573
|
return message;
|
|
37533
37574
|
}
|
|
@@ -37537,6 +37578,30 @@ function getMessage(key, args, self) {
|
|
|
37537
37578
|
Object.freeze(["node", "import"]);
|
|
37538
37579
|
pathToFileURL$1(process.cwd());
|
|
37539
37580
|
|
|
37581
|
+
const ESM_STATIC_IMPORT_RE = /(?<=\s|^|;)import\s*(["'\s]*(?<imports>[\w*${}\n\r\t, /]+)from\s*)?["']\s*(?<specifier>(?<="\s*)[^"]*[^"\s](?=\s*")|(?<='\s*)[^']*[^'\s](?=\s*'))\s*["'][\s;]*/gm;
|
|
37582
|
+
function findStaticImports(code) {
|
|
37583
|
+
return matchAll(ESM_STATIC_IMPORT_RE, code, { type: "static" });
|
|
37584
|
+
}
|
|
37585
|
+
function parseStaticImport(matched) {
|
|
37586
|
+
const cleanedImports = (matched.imports || "").replace(/(\/\/[^\n]*\n|\/\*.*\*\/)/g, "").replace(/\s+/g, " ");
|
|
37587
|
+
const namedImports = {};
|
|
37588
|
+
for (const namedImport of cleanedImports.match(/\{([^}]*)\}/)?.[1]?.split(",") || []) {
|
|
37589
|
+
const [, source = namedImport.trim(), importName = source] = namedImport.match(/^\s*([^\s]*) as ([^\s]*)\s*$/) || [];
|
|
37590
|
+
if (source) {
|
|
37591
|
+
namedImports[source] = importName;
|
|
37592
|
+
}
|
|
37593
|
+
}
|
|
37594
|
+
const topLevelImports = cleanedImports.replace(/\{([^}]*)\}/, "");
|
|
37595
|
+
const namespacedImport = topLevelImports.match(/\* as \s*([^\s]*)/)?.[1];
|
|
37596
|
+
const defaultImport = topLevelImports.split(",").find((i) => !i.match(/[*{}]/))?.trim() || void 0;
|
|
37597
|
+
return {
|
|
37598
|
+
...matched,
|
|
37599
|
+
defaultImport,
|
|
37600
|
+
namespacedImport,
|
|
37601
|
+
namedImports
|
|
37602
|
+
};
|
|
37603
|
+
}
|
|
37604
|
+
|
|
37540
37605
|
const debugHmr = createDebugger('vite:hmr');
|
|
37541
37606
|
const normalizedClientDir = normalizePath$3(CLIENT_DIR);
|
|
37542
37607
|
function getShortName(file, root) {
|
|
@@ -37675,6 +37740,7 @@ function propagateUpdate(node, boundaries, currentChain = [node]) {
|
|
|
37675
37740
|
// if the imports of `node` have not been analyzed, then `node` has not
|
|
37676
37741
|
// been loaded in the browser and we should stop propagation.
|
|
37677
37742
|
if (node.id && node.isSelfAccepting === undefined) {
|
|
37743
|
+
debugHmr(`[propagate update] stop propagation because not analyzed: ${picocolors.exports.dim(node.id)}`);
|
|
37678
37744
|
return false;
|
|
37679
37745
|
}
|
|
37680
37746
|
if (node.isSelfAccepting) {
|
|
@@ -38006,13 +38072,20 @@ function createIsConfiguredAsSsrExternal(config) {
|
|
|
38006
38072
|
if (!bareImportRE.test(id) || id.includes('\0')) {
|
|
38007
38073
|
return false;
|
|
38008
38074
|
}
|
|
38009
|
-
|
|
38010
|
-
|
|
38011
|
-
|
|
38012
|
-
|
|
38013
|
-
|
|
38014
|
-
|
|
38015
|
-
|
|
38075
|
+
try {
|
|
38076
|
+
return !!tryNodeResolve(id, undefined, resolveOptions, ssr?.target === 'webworker', undefined, true,
|
|
38077
|
+
// try to externalize, will return undefined or an object without
|
|
38078
|
+
// a external flag if it isn't externalizable
|
|
38079
|
+
true,
|
|
38080
|
+
// Allow linked packages to be externalized if they are explicitly
|
|
38081
|
+
// configured as external
|
|
38082
|
+
!!configuredAsExternal)?.external;
|
|
38083
|
+
}
|
|
38084
|
+
catch (e) {
|
|
38085
|
+
debug$9(`Failed to node resolve "${id}". Skipping externalizing it by default.`);
|
|
38086
|
+
// may be an invalid import that's resolved by a plugin
|
|
38087
|
+
return false;
|
|
38088
|
+
}
|
|
38016
38089
|
};
|
|
38017
38090
|
// Returns true if it is configured as external, false if it is filtered
|
|
38018
38091
|
// by noExternal and undefined if it isn't affected by the explicit config
|
|
@@ -38876,7 +38949,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
38876
38949
|
function defineImport(node, source) {
|
|
38877
38950
|
deps.add(source);
|
|
38878
38951
|
const importId = `__vite_ssr_import_${uid++}__`;
|
|
38879
|
-
s.
|
|
38952
|
+
s.appendRight(node.start, `const ${importId} = await ${ssrImportKey}(${JSON.stringify(source)});\n`);
|
|
38880
38953
|
return importId;
|
|
38881
38954
|
}
|
|
38882
38955
|
function defineExport(position, name, local = name) {
|
|
@@ -38889,6 +38962,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
38889
38962
|
// import { baz } from 'foo' --> baz -> __import_foo__.baz
|
|
38890
38963
|
// import * as ok from 'foo' --> ok -> __import_foo__
|
|
38891
38964
|
if (node.type === 'ImportDeclaration') {
|
|
38965
|
+
s.remove(node.start, node.end);
|
|
38892
38966
|
const importId = defineImport(node, node.source.value);
|
|
38893
38967
|
for (const spec of node.specifiers) {
|
|
38894
38968
|
if (spec.type === 'ImportSpecifier') {
|
|
@@ -38902,7 +38976,6 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
38902
38976
|
idToImportMap.set(spec.local.name, importId);
|
|
38903
38977
|
}
|
|
38904
38978
|
}
|
|
38905
|
-
s.remove(node.start, node.end);
|
|
38906
38979
|
}
|
|
38907
38980
|
}
|
|
38908
38981
|
// 2. check all export statements and define exports
|
|
@@ -38966,14 +39039,12 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
38966
39039
|
}
|
|
38967
39040
|
// export * from './foo'
|
|
38968
39041
|
if (node.type === 'ExportAllDeclaration') {
|
|
39042
|
+
s.remove(node.start, node.end);
|
|
39043
|
+
const importId = defineImport(node, node.source.value);
|
|
38969
39044
|
if (node.exported) {
|
|
38970
|
-
const importId = defineImport(node, node.source.value);
|
|
38971
|
-
s.remove(node.start, node.end);
|
|
38972
39045
|
defineExport(node.end, node.exported.name, `${importId}`);
|
|
38973
39046
|
}
|
|
38974
39047
|
else {
|
|
38975
|
-
const importId = defineImport(node, node.source.value);
|
|
38976
|
-
s.remove(node.start, node.end);
|
|
38977
39048
|
s.appendLeft(node.end, `${ssrExportAllKey}(${importId});`);
|
|
38978
39049
|
}
|
|
38979
39050
|
}
|
|
@@ -38990,7 +39061,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
38990
39061
|
// let binding used in a property shorthand
|
|
38991
39062
|
// { foo } -> { foo: __import_x__.foo }
|
|
38992
39063
|
// skip for destructuring patterns
|
|
38993
|
-
if (!
|
|
39064
|
+
if (!isNodeInPattern(parent) ||
|
|
38994
39065
|
isInDestructuringAssignment(parent, parentStack)) {
|
|
38995
39066
|
s.appendLeft(id.end, `: ${binding}`);
|
|
38996
39067
|
}
|
|
@@ -39045,7 +39116,9 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
39045
39116
|
dynamicDeps: [...dynamicDeps]
|
|
39046
39117
|
};
|
|
39047
39118
|
}
|
|
39048
|
-
const
|
|
39119
|
+
const isNodeInPatternWeakSet = new WeakSet();
|
|
39120
|
+
const setIsNodeInPattern = (node) => isNodeInPatternWeakSet.add(node);
|
|
39121
|
+
const isNodeInPattern = (node) => isNodeInPatternWeakSet.has(node);
|
|
39049
39122
|
/**
|
|
39050
39123
|
* Same logic from \@vue/compiler-core & \@vue/compiler-sfc
|
|
39051
39124
|
* Except this is using acorn AST
|
|
@@ -39160,7 +39233,7 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
|
|
|
39160
39233
|
}
|
|
39161
39234
|
else if (node.type === 'Property' && parent.type === 'ObjectPattern') {
|
|
39162
39235
|
// mark property in destructuring pattern
|
|
39163
|
-
|
|
39236
|
+
setIsNodeInPattern(node);
|
|
39164
39237
|
}
|
|
39165
39238
|
else if (node.type === 'VariableDeclarator') {
|
|
39166
39239
|
const parentFunction = findParentFunction(parentStack);
|
|
@@ -39203,8 +39276,11 @@ function isRefIdentifier(id, parent, parentStack) {
|
|
|
39203
39276
|
return false;
|
|
39204
39277
|
}
|
|
39205
39278
|
// property key
|
|
39206
|
-
|
|
39207
|
-
|
|
39279
|
+
if (isStaticPropertyKey(id, parent)) {
|
|
39280
|
+
return false;
|
|
39281
|
+
}
|
|
39282
|
+
// object destructuring pattern
|
|
39283
|
+
if (isNodeInPattern(parent) && parent.value === id) {
|
|
39208
39284
|
return false;
|
|
39209
39285
|
}
|
|
39210
39286
|
// non-assignment array destructuring pattern
|
|
@@ -39990,7 +40066,7 @@ function throwOutdatedRequest(id) {
|
|
|
39990
40066
|
const isDebug$1 = !!process.env.DEBUG;
|
|
39991
40067
|
const debug$7 = createDebugger('vite:import-analysis');
|
|
39992
40068
|
const clientDir = normalizePath$3(CLIENT_DIR);
|
|
39993
|
-
const skipRE = /\.(map|json)
|
|
40069
|
+
const skipRE = /\.(map|json)($|\?)/;
|
|
39994
40070
|
const canSkipImportAnalysis = (id) => skipRE.test(id) || isDirectCSSRequest(id);
|
|
39995
40071
|
const optimizedDepChunkRE$1 = /\/chunk-[A-Z0-9]{8}\.js/;
|
|
39996
40072
|
const optimizedDepDynamicRE$1 = /-[A-Z0-9]{8}\.js/;
|
|
@@ -40845,7 +40921,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
40845
40921
|
// dynamic import to constant json may get inlined.
|
|
40846
40922
|
if (chunk.type === 'chunk' && chunk.code.indexOf(preloadMarker) > -1) {
|
|
40847
40923
|
const code = chunk.code;
|
|
40848
|
-
let imports;
|
|
40924
|
+
let imports = [];
|
|
40849
40925
|
try {
|
|
40850
40926
|
imports = parse$b(code)[0].filter((i) => i.d > -1);
|
|
40851
40927
|
}
|
|
@@ -40972,8 +41048,7 @@ function modulePreloadPolyfillPlugin(config) {
|
|
|
40972
41048
|
return '';
|
|
40973
41049
|
}
|
|
40974
41050
|
if (!polyfillString) {
|
|
40975
|
-
polyfillString =
|
|
40976
|
-
`const p = ${polyfill.toString()};` + `${isModernFlag}&&p();`;
|
|
41051
|
+
polyfillString = `${isModernFlag}&&(${polyfill.toString()}());`;
|
|
40977
41052
|
}
|
|
40978
41053
|
return polyfillString;
|
|
40979
41054
|
}
|
|
@@ -41090,7 +41165,7 @@ const assetAttrsConfig = {
|
|
|
41090
41165
|
const isAsyncScriptMap = new WeakMap();
|
|
41091
41166
|
async function traverseHtml(html, filePath, visitor) {
|
|
41092
41167
|
// lazy load compiler
|
|
41093
|
-
const { parse, transform } = await import('./dep-
|
|
41168
|
+
const { parse, transform } = await import('./dep-c7c58113.js').then(function (n) { return n.c; });
|
|
41094
41169
|
// @vue/compiler-core doesn't like lowercase doctypes
|
|
41095
41170
|
html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
|
|
41096
41171
|
try {
|
|
@@ -41252,7 +41327,10 @@ function buildHtmlPlugin(config) {
|
|
|
41252
41327
|
// assetsUrl may be encodeURI
|
|
41253
41328
|
const url = decodeURI(p.value.content);
|
|
41254
41329
|
if (!isExcludedUrl(url)) {
|
|
41255
|
-
if (node.tag === 'link' &&
|
|
41330
|
+
if (node.tag === 'link' &&
|
|
41331
|
+
isCSSRequest(url) &&
|
|
41332
|
+
// should not be converted if following attributes are present (#6748)
|
|
41333
|
+
!node.props.some((p) => p.name === 'media' || p.name === 'disabled')) {
|
|
41256
41334
|
// CSS references, convert to import
|
|
41257
41335
|
const importExpression = `\nimport ${JSON.stringify(url)}`;
|
|
41258
41336
|
styleUrls.push({
|
|
@@ -41436,14 +41514,16 @@ function buildHtmlPlugin(config) {
|
|
|
41436
41514
|
for (const [id, html] of processedHtml) {
|
|
41437
41515
|
const relativeUrlPath = path$n.posix.relative(config.root, id);
|
|
41438
41516
|
const assetsBase = getBaseInHTML(relativeUrlPath, config);
|
|
41439
|
-
const
|
|
41517
|
+
const toOutputFilePath = (filename, type) => {
|
|
41440
41518
|
if (isExternalUrl(filename)) {
|
|
41441
41519
|
return filename;
|
|
41442
41520
|
}
|
|
41443
41521
|
else {
|
|
41444
|
-
return toOutputFilePathInHtml(filename,
|
|
41522
|
+
return toOutputFilePathInHtml(filename, type, relativeUrlPath, 'html', config, (filename, importer) => assetsBase + filename);
|
|
41445
41523
|
}
|
|
41446
41524
|
};
|
|
41525
|
+
const toOutputAssetFilePath = (filename) => toOutputFilePath(filename, 'asset');
|
|
41526
|
+
const toOutputPublicAssetFilePath = (filename) => toOutputFilePath(filename, 'public');
|
|
41447
41527
|
const isAsync = isAsyncScriptMap.get(config).get(id);
|
|
41448
41528
|
let result = html;
|
|
41449
41529
|
// find corresponding entry chunk
|
|
@@ -41508,11 +41588,14 @@ function buildHtmlPlugin(config) {
|
|
|
41508
41588
|
result = result.replace(assetUrlRE, (_, fileHash, postfix = '') => {
|
|
41509
41589
|
return (toOutputAssetFilePath(getAssetFilename(fileHash, config)) + postfix);
|
|
41510
41590
|
});
|
|
41591
|
+
result = result.replace(publicAssetUrlRE, (_, fileHash) => {
|
|
41592
|
+
return normalizePath$3(toOutputPublicAssetFilePath(getPublicAssetFilename(fileHash, config)));
|
|
41593
|
+
});
|
|
41511
41594
|
if (chunk && canInlineEntry) {
|
|
41512
41595
|
// all imports from entry have been inlined to html, prevent rollup from outputting it
|
|
41513
41596
|
delete bundle[chunk.fileName];
|
|
41514
41597
|
}
|
|
41515
|
-
const shortEmitName = path$n.relative(config.root, id);
|
|
41598
|
+
const shortEmitName = normalizePath$3(path$n.relative(config.root, id));
|
|
41516
41599
|
this.emitFile({
|
|
41517
41600
|
type: 'asset',
|
|
41518
41601
|
fileName: shortEmitName,
|
|
@@ -41766,7 +41849,7 @@ function cssPlugin(config) {
|
|
|
41766
41849
|
}
|
|
41767
41850
|
return url;
|
|
41768
41851
|
};
|
|
41769
|
-
const { code: css, modules, deps, map } = await compileCSS(id, raw, config, urlReplacer, atImportResolvers
|
|
41852
|
+
const { code: css, modules, deps, map } = await compileCSS(id, raw, config, urlReplacer, atImportResolvers);
|
|
41770
41853
|
if (modules) {
|
|
41771
41854
|
moduleCache.set(id, modules);
|
|
41772
41855
|
}
|
|
@@ -41990,7 +42073,7 @@ function cssPostPlugin(config) {
|
|
|
41990
42073
|
return chunkCSS;
|
|
41991
42074
|
}
|
|
41992
42075
|
function ensureFileExt(name, ext) {
|
|
41993
|
-
return path$n.format({ ...path$n.parse(name), base: undefined, ext });
|
|
42076
|
+
return normalizePath$3(path$n.format({ ...path$n.parse(name), base: undefined, ext }));
|
|
41994
42077
|
}
|
|
41995
42078
|
if (config.build.cssCodeSplit) {
|
|
41996
42079
|
if (isPureCssChunk) {
|
|
@@ -42201,7 +42284,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
42201
42284
|
const postcssOptions = (postcssConfig && postcssConfig.options) || {};
|
|
42202
42285
|
const postcssPlugins = postcssConfig && postcssConfig.plugins ? postcssConfig.plugins.slice() : [];
|
|
42203
42286
|
if (needInlineImport) {
|
|
42204
|
-
postcssPlugins.unshift((await import('./dep-
|
|
42287
|
+
postcssPlugins.unshift((await import('./dep-94c1417a.js').then(function (n) { return n.i; })).default({
|
|
42205
42288
|
async resolve(id, basedir) {
|
|
42206
42289
|
const publicFile = checkPublicFile(id, config);
|
|
42207
42290
|
if (publicFile) {
|
|
@@ -42220,7 +42303,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
42220
42303
|
logger: config.logger
|
|
42221
42304
|
}));
|
|
42222
42305
|
if (isModule) {
|
|
42223
|
-
postcssPlugins.unshift((await import('./dep-
|
|
42306
|
+
postcssPlugins.unshift((await import('./dep-2274fed5.js').then(function (n) { return n.i; })).default({
|
|
42224
42307
|
...modulesOptions,
|
|
42225
42308
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
42226
42309
|
modules = _modules;
|
|
@@ -43156,7 +43239,7 @@ function assetImportMetaUrlPlugin(config) {
|
|
|
43156
43239
|
// target so we use the global location here. It can be
|
|
43157
43240
|
// window.location or self.location in case it is used in a Web Worker.
|
|
43158
43241
|
// @see https://developer.mozilla.org/en-US/docs/Web/API/Window/self
|
|
43159
|
-
s.overwrite(index, index + exp.length, `new URL((import.meta.glob(${pattern}, { eager: true, import: 'default' }))[${rawUrl}], self.location)`, { contentOnly: true });
|
|
43242
|
+
s.overwrite(index, index + exp.length, `new URL((import.meta.glob(${pattern}, { eager: true, import: 'default', as: 'url' }))[${rawUrl}], self.location)`, { contentOnly: true });
|
|
43160
43243
|
continue;
|
|
43161
43244
|
}
|
|
43162
43245
|
}
|
|
@@ -43401,10 +43484,11 @@ async function doBuild(inlineConfig = {}) {
|
|
|
43401
43484
|
`This is deprecated and will override all Vite.js default output options. ` +
|
|
43402
43485
|
`Please use "rollupOptions.output" instead.`);
|
|
43403
43486
|
}
|
|
43404
|
-
const
|
|
43405
|
-
const
|
|
43487
|
+
const ssrNodeBuild = ssr && config.ssr.target === 'node';
|
|
43488
|
+
const ssrWorkerBuild = ssr && config.ssr.target === 'webworker';
|
|
43489
|
+
const cjsSsrBuild = ssr && config.ssr.format === 'cjs';
|
|
43406
43490
|
const format = output.format || (cjsSsrBuild ? 'cjs' : 'es');
|
|
43407
|
-
const jsExt =
|
|
43491
|
+
const jsExt = ssrNodeBuild || libOptions
|
|
43408
43492
|
? resolveOutputJsExtension(format, getPkgJson(config.root)?.type)
|
|
43409
43493
|
: 'js';
|
|
43410
43494
|
return {
|
|
@@ -43689,7 +43773,32 @@ function wrapSsrTransform(fn) {
|
|
|
43689
43773
|
function injectSsrFlag(options) {
|
|
43690
43774
|
return { ...(options ?? {}), ssr: true };
|
|
43691
43775
|
}
|
|
43692
|
-
|
|
43776
|
+
/*
|
|
43777
|
+
The following functions are copied from rollup
|
|
43778
|
+
https://github.com/rollup/rollup/blob/c5269747cd3dd14c4b306e8cea36f248d9c1aa01/src/ast/nodes/MetaProperty.ts#L189-L232
|
|
43779
|
+
|
|
43780
|
+
https://github.com/rollup/rollup
|
|
43781
|
+
The MIT License (MIT)
|
|
43782
|
+
Copyright (c) 2017 [these people](https://github.com/rollup/rollup/graphs/contributors)
|
|
43783
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
43784
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
43785
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
43786
|
+
*/
|
|
43787
|
+
const getResolveUrl = (path, URL = 'URL') => `new ${URL}(${path}).href`;
|
|
43788
|
+
const getRelativeUrlFromDocument = (relativePath, umd = false) => getResolveUrl(`'${relativePath}', ${umd ? `typeof document === 'undefined' ? location.href : ` : ''}document.currentScript && document.currentScript.src || document.baseURI`);
|
|
43789
|
+
const relativeUrlMechanisms = {
|
|
43790
|
+
amd: (relativePath) => {
|
|
43791
|
+
if (relativePath[0] !== '.')
|
|
43792
|
+
relativePath = './' + relativePath;
|
|
43793
|
+
return getResolveUrl(`require.toUrl('${relativePath}'), document.baseURI`);
|
|
43794
|
+
},
|
|
43795
|
+
cjs: (relativePath) => `(typeof document === 'undefined' ? ${getResolveUrl(`'file:' + __dirname + '/${relativePath}'`, `(require('u' + 'rl').URL)`)} : ${getRelativeUrlFromDocument(relativePath)})`,
|
|
43796
|
+
es: (relativePath) => getResolveUrl(`'${relativePath}', import.meta.url`),
|
|
43797
|
+
iife: (relativePath) => getRelativeUrlFromDocument(relativePath),
|
|
43798
|
+
system: (relativePath) => getResolveUrl(`'${relativePath}', module.meta.url`),
|
|
43799
|
+
umd: (relativePath) => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getResolveUrl(`'file:' + __dirname + '/${relativePath}'`, `(require('u' + 'rl').URL)`)} : ${getRelativeUrlFromDocument(relativePath, true)})`
|
|
43800
|
+
};
|
|
43801
|
+
function toOutputFilePathInString(filename, type, hostId, hostType, config, format, toRelative = getToImportMetaURLBasedRelativePath(format)) {
|
|
43693
43802
|
const { renderBuiltUrl } = config.experimental;
|
|
43694
43803
|
let relative = config.base === '' || config.base === './';
|
|
43695
43804
|
if (renderBuiltUrl) {
|
|
@@ -43716,10 +43825,11 @@ function toOutputFilePathInString(filename, type, hostId, hostType, config, toRe
|
|
|
43716
43825
|
}
|
|
43717
43826
|
return config.base + filename;
|
|
43718
43827
|
}
|
|
43719
|
-
function
|
|
43720
|
-
|
|
43721
|
-
|
|
43722
|
-
|
|
43828
|
+
function getToImportMetaURLBasedRelativePath(format) {
|
|
43829
|
+
const toRelativePath = relativeUrlMechanisms[format];
|
|
43830
|
+
return (filename, importer) => ({
|
|
43831
|
+
runtime: toRelativePath(path$n.posix.relative(path$n.dirname(importer), filename))
|
|
43832
|
+
});
|
|
43723
43833
|
}
|
|
43724
43834
|
function toOutputFilePathWithoutRuntime(filename, type, hostId, hostType, config, toRelative) {
|
|
43725
43835
|
const { renderBuiltUrl } = config.experimental;
|
|
@@ -49765,30 +49875,44 @@ var guess = function guessEditor (specifiedEditor) {
|
|
|
49765
49875
|
try {
|
|
49766
49876
|
if (process.platform === 'darwin') {
|
|
49767
49877
|
const output = childProcess$2
|
|
49768
|
-
.execSync('ps x', {
|
|
49878
|
+
.execSync('ps x -o comm=', {
|
|
49769
49879
|
stdio: ['pipe', 'pipe', 'ignore']
|
|
49770
49880
|
})
|
|
49771
49881
|
.toString();
|
|
49772
49882
|
const processNames = Object.keys(COMMON_EDITORS_OSX);
|
|
49883
|
+
const processList = output.split('\n');
|
|
49773
49884
|
for (let i = 0; i < processNames.length; i++) {
|
|
49774
49885
|
const processName = processNames[i];
|
|
49886
|
+
// Find editor by exact match.
|
|
49775
49887
|
if (output.indexOf(processName) !== -1) {
|
|
49776
49888
|
return [COMMON_EDITORS_OSX[processName]]
|
|
49777
49889
|
}
|
|
49890
|
+
const processNameWithoutApplications = processName.replace('/Applications', '');
|
|
49891
|
+
// Find editor installation not in /Applications.
|
|
49892
|
+
if (output.indexOf(processNameWithoutApplications) !== -1) {
|
|
49893
|
+
// Use the CLI command if one is specified
|
|
49894
|
+
if (processName !== COMMON_EDITORS_OSX[processName]) {
|
|
49895
|
+
return [COMMON_EDITORS_OSX[processName]]
|
|
49896
|
+
}
|
|
49897
|
+
// Use a partial match to find the running process path. If one is found, use the
|
|
49898
|
+
// existing path since it can be running from anywhere.
|
|
49899
|
+
const runningProcess = processList.find((procName) => procName.endsWith(processNameWithoutApplications));
|
|
49900
|
+
if (runningProcess !== undefined) {
|
|
49901
|
+
return [runningProcess]
|
|
49902
|
+
}
|
|
49903
|
+
}
|
|
49778
49904
|
}
|
|
49779
49905
|
} else if (process.platform === 'win32') {
|
|
49780
49906
|
const output = childProcess$2
|
|
49781
|
-
.execSync(
|
|
49782
|
-
|
|
49783
|
-
|
|
49907
|
+
.execSync(
|
|
49908
|
+
'powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"',
|
|
49909
|
+
{
|
|
49910
|
+
stdio: ['pipe', 'pipe', 'ignore']
|
|
49911
|
+
}
|
|
49912
|
+
)
|
|
49784
49913
|
.toString();
|
|
49785
49914
|
const runningProcesses = output.split('\r\n');
|
|
49786
49915
|
for (let i = 0; i < runningProcesses.length; i++) {
|
|
49787
|
-
// `Get-Process` sometimes returns empty lines
|
|
49788
|
-
if (!runningProcesses[i]) {
|
|
49789
|
-
continue
|
|
49790
|
-
}
|
|
49791
|
-
|
|
49792
49916
|
const fullProcessPath = runningProcesses[i].trim();
|
|
49793
49917
|
const shortProcessName = path$8.basename(fullProcessPath);
|
|
49794
49918
|
|
|
@@ -49864,6 +49988,7 @@ var getArgs = function getArgumentsForPosition (
|
|
|
49864
49988
|
case 'code':
|
|
49865
49989
|
case 'code-insiders':
|
|
49866
49990
|
case 'Code':
|
|
49991
|
+
case 'codium':
|
|
49867
49992
|
return ['-r', '-g', `${fileName}:${lineNumber}:${columnNumber}`]
|
|
49868
49993
|
case 'appcode':
|
|
49869
49994
|
case 'clion':
|
|
@@ -49878,7 +50003,7 @@ var getArgs = function getArgumentsForPosition (
|
|
|
49878
50003
|
case 'rubymine64':
|
|
49879
50004
|
case 'webstorm':
|
|
49880
50005
|
case 'webstorm64':
|
|
49881
|
-
return ['--line', lineNumber, fileName]
|
|
50006
|
+
return ['--line', lineNumber, '--column', columnNumber, fileName]
|
|
49882
50007
|
}
|
|
49883
50008
|
|
|
49884
50009
|
// For all others, drop the lineNumber until we have
|
|
@@ -50057,16 +50182,16 @@ var launchEditorMiddleware = (specifiedEditor, srcRoot, onErrorCallback) => {
|
|
|
50057
50182
|
|
|
50058
50183
|
async function resolveHttpServer({ proxy }, app, httpsOptions) {
|
|
50059
50184
|
if (!httpsOptions) {
|
|
50060
|
-
const { createServer } = await import('http');
|
|
50185
|
+
const { createServer } = await import('node:http');
|
|
50061
50186
|
return createServer(app);
|
|
50062
50187
|
}
|
|
50063
50188
|
// #484 fallback to http1 when proxy is needed.
|
|
50064
50189
|
if (proxy) {
|
|
50065
|
-
const { createServer } = await import('https');
|
|
50190
|
+
const { createServer } = await import('node:https');
|
|
50066
50191
|
return createServer(httpsOptions, app);
|
|
50067
50192
|
}
|
|
50068
50193
|
else {
|
|
50069
|
-
const { createSecureServer } = await import('http2');
|
|
50194
|
+
const { createSecureServer } = await import('node:http2');
|
|
50070
50195
|
return createSecureServer({
|
|
50071
50196
|
// Manually increase the session memory to prevent 502 ENHANCE_YOUR_CALM
|
|
50072
50197
|
// errors on large numbers of requests
|
|
@@ -50128,6 +50253,14 @@ async function httpServerStart(httpServer, serverOptions) {
|
|
|
50128
50253
|
});
|
|
50129
50254
|
});
|
|
50130
50255
|
}
|
|
50256
|
+
function setClientErrorHandler(server, logger) {
|
|
50257
|
+
server.on('clientError', (err, socket) => {
|
|
50258
|
+
if (err.code === 'HPE_HEADER_OVERFLOW') {
|
|
50259
|
+
logger.warn(picocolors.exports.yellow('Server responded with status code 431. ' +
|
|
50260
|
+
'See https://vitejs.dev/guide/troubleshooting.html#_431-request-header-fields-too-large.'));
|
|
50261
|
+
}
|
|
50262
|
+
});
|
|
50263
|
+
}
|
|
50131
50264
|
|
|
50132
50265
|
/**
|
|
50133
50266
|
* This plugin hooks into Node's module resolution algorithm at runtime,
|
|
@@ -50164,7 +50297,7 @@ function ssrRequireHookPlugin(config) {
|
|
|
50164
50297
|
/** Respect the `resolve.dedupe` option in production SSR. */
|
|
50165
50298
|
function dedupeRequire(dedupe) {
|
|
50166
50299
|
// eslint-disable-next-line no-restricted-globals
|
|
50167
|
-
const Module = require('module');
|
|
50300
|
+
const Module = require('node:module');
|
|
50168
50301
|
const resolveFilename = Module._resolveFilename;
|
|
50169
50302
|
Module._resolveFilename = function (request, parent, isMain, options) {
|
|
50170
50303
|
if (request[0] !== '.' && request[0] !== '/') {
|
|
@@ -59006,6 +59139,9 @@ async function createServer(inlineConfig = {}) {
|
|
|
59006
59139
|
? null
|
|
59007
59140
|
: await resolveHttpServer(serverConfig, middlewares, httpsOptions);
|
|
59008
59141
|
const ws = createWebSocketServer(httpServer, config, httpsOptions);
|
|
59142
|
+
if (httpServer) {
|
|
59143
|
+
setClientErrorHandler(httpServer, config.logger);
|
|
59144
|
+
}
|
|
59009
59145
|
const { ignored = [], ...watchOptions } = serverConfig.watch || {};
|
|
59010
59146
|
const watcher = chokidar.watch(path$n.resolve(root), {
|
|
59011
59147
|
ignored: [
|
|
@@ -59564,6 +59700,7 @@ async function preview(inlineConfig = {}) {
|
|
|
59564
59700
|
const config = await resolveConfig(inlineConfig, 'serve', 'production');
|
|
59565
59701
|
const app = connect();
|
|
59566
59702
|
const httpServer = await resolveHttpServer(config.preview, app, await resolveHttpsConfig(config.preview?.https));
|
|
59703
|
+
setClientErrorHandler(httpServer, config.logger);
|
|
59567
59704
|
// apply server hooks from plugins
|
|
59568
59705
|
const postHooks = [];
|
|
59569
59706
|
for (const plugin of config.plugins) {
|
|
@@ -60007,7 +60144,7 @@ function webWorkerPlugin(config) {
|
|
|
60007
60144
|
map: { mappings: '' } // Empty sourcemap to suppress Rollup warning
|
|
60008
60145
|
};
|
|
60009
60146
|
},
|
|
60010
|
-
renderChunk(code, chunk) {
|
|
60147
|
+
renderChunk(code, chunk, outputOptions) {
|
|
60011
60148
|
let s;
|
|
60012
60149
|
const result = () => {
|
|
60013
60150
|
return (s && {
|
|
@@ -60024,7 +60161,7 @@ function webWorkerPlugin(config) {
|
|
|
60024
60161
|
while ((match = workerAssetUrlRE.exec(code))) {
|
|
60025
60162
|
const [full, hash] = match;
|
|
60026
60163
|
const filename = fileNameHash.get(hash);
|
|
60027
|
-
const replacement = toOutputFilePathInString(filename, 'asset', chunk.fileName, 'js', config);
|
|
60164
|
+
const replacement = toOutputFilePathInString(filename, 'asset', chunk.fileName, 'js', config, outputOptions.format);
|
|
60028
60165
|
const replacementString = typeof replacement === 'string'
|
|
60029
60166
|
? JSON.stringify(replacement).slice(1, -1)
|
|
60030
60167
|
: `"+${replacement.runtime}+"`;
|
|
@@ -60032,20 +60169,19 @@ function webWorkerPlugin(config) {
|
|
|
60032
60169
|
contentOnly: true
|
|
60033
60170
|
});
|
|
60034
60171
|
}
|
|
60035
|
-
// TODO: check if this should be removed
|
|
60036
|
-
if (config.isWorker) {
|
|
60037
|
-
s = s.replace('import.meta.url', 'self.location.href');
|
|
60038
|
-
return result();
|
|
60039
|
-
}
|
|
60040
|
-
}
|
|
60041
|
-
if (!isWorker) {
|
|
60042
|
-
const workerMap = workerCache.get(config);
|
|
60043
|
-
workerMap.assets.forEach((asset) => {
|
|
60044
|
-
this.emitFile(asset);
|
|
60045
|
-
workerMap.assets.delete(asset.fileName);
|
|
60046
|
-
});
|
|
60047
60172
|
}
|
|
60048
60173
|
return result();
|
|
60174
|
+
},
|
|
60175
|
+
generateBundle(opts) {
|
|
60176
|
+
// @ts-ignore asset emits are skipped in legacy bundle
|
|
60177
|
+
if (opts.__vite_skip_asset_emit__ || isWorker) {
|
|
60178
|
+
return;
|
|
60179
|
+
}
|
|
60180
|
+
const workerMap = workerCache.get(config);
|
|
60181
|
+
workerMap.assets.forEach((asset) => {
|
|
60182
|
+
this.emitFile(asset);
|
|
60183
|
+
workerMap.assets.delete(asset.fileName);
|
|
60184
|
+
});
|
|
60049
60185
|
}
|
|
60050
60186
|
};
|
|
60051
60187
|
}
|
|
@@ -61824,11 +61960,28 @@ function expressionToGlob(node) {
|
|
|
61824
61960
|
}
|
|
61825
61961
|
}
|
|
61826
61962
|
|
|
61963
|
+
const defaultProtocol = 'file:';
|
|
61964
|
+
const ignoredProtocols = ['data:', 'http:', 'https:'];
|
|
61965
|
+
|
|
61966
|
+
function shouldIgnore(glob) {
|
|
61967
|
+
const containsAsterisk = glob.includes('*');
|
|
61968
|
+
|
|
61969
|
+
const globURL = new URL(glob, defaultProtocol);
|
|
61970
|
+
|
|
61971
|
+
const containsIgnoredProtocol = ignoredProtocols.some(
|
|
61972
|
+
(ignoredProtocol) => ignoredProtocol === globURL.protocol
|
|
61973
|
+
);
|
|
61974
|
+
|
|
61975
|
+
return !containsAsterisk || containsIgnoredProtocol;
|
|
61976
|
+
}
|
|
61977
|
+
|
|
61827
61978
|
function dynamicImportToGlob(node, sourceString) {
|
|
61828
61979
|
let glob = expressionToGlob(node);
|
|
61829
|
-
|
|
61980
|
+
|
|
61981
|
+
if (shouldIgnore(glob)) {
|
|
61830
61982
|
return null;
|
|
61831
61983
|
}
|
|
61984
|
+
|
|
61832
61985
|
glob = glob.replace(/\*\*/g, '*');
|
|
61833
61986
|
|
|
61834
61987
|
if (glob.startsWith('*')) {
|
|
@@ -62645,7 +62798,11 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
|
|
|
62645
62798
|
if (process.env.DEBUG) {
|
|
62646
62799
|
debug(`using resolved config: %O`, {
|
|
62647
62800
|
...resolved,
|
|
62648
|
-
plugins: resolved.plugins.map((p) => p.name)
|
|
62801
|
+
plugins: resolved.plugins.map((p) => p.name),
|
|
62802
|
+
worker: {
|
|
62803
|
+
...resolved.worker,
|
|
62804
|
+
plugins: resolved.worker.plugins.map((p) => p.name)
|
|
62805
|
+
}
|
|
62649
62806
|
});
|
|
62650
62807
|
}
|
|
62651
62808
|
if (config.build?.terserOptions && config.build.minify !== 'terser') {
|
|
@@ -62787,6 +62944,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
62787
62944
|
entryPoints: [fileName],
|
|
62788
62945
|
outfile: 'out.js',
|
|
62789
62946
|
write: false,
|
|
62947
|
+
target: ['node14.18', 'node16'],
|
|
62790
62948
|
platform: 'node',
|
|
62791
62949
|
bundle: true,
|
|
62792
62950
|
format: isESM ? 'esm' : 'cjs',
|
|
@@ -62830,7 +62988,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
62830
62988
|
if (path$n.relative(idPkgDir, fileName).startsWith('..')) {
|
|
62831
62989
|
return {
|
|
62832
62990
|
// normalize actual import after bundled as a single vite config
|
|
62833
|
-
path: idFsPath,
|
|
62991
|
+
path: pathToFileURL(idFsPath).href,
|
|
62834
62992
|
external: true
|
|
62835
62993
|
};
|
|
62836
62994
|
}
|
|
@@ -62875,7 +63033,12 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
|
|
|
62875
63033
|
return (await dynamicImport(fileUrl)).default;
|
|
62876
63034
|
}
|
|
62877
63035
|
finally {
|
|
62878
|
-
|
|
63036
|
+
try {
|
|
63037
|
+
fs$l.unlinkSync(fileNameTmp);
|
|
63038
|
+
}
|
|
63039
|
+
catch {
|
|
63040
|
+
// already removed if this function is called twice simultaneously
|
|
63041
|
+
}
|
|
62879
63042
|
}
|
|
62880
63043
|
}
|
|
62881
63044
|
// for cjs, we can register a custom loader via `_require.extensions`
|