vite 3.0.4 → 3.0.5
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-3811dadb.js → dep-0f192b10.js} +1 -1
- package/dist/node/chunks/{dep-71eb12cb.js → dep-5cb728cb.js} +240 -142
- package/dist/node/chunks/{dep-41eb528c.js → dep-94c1417a.js} +0 -0
- package/dist/node/chunks/{dep-f135d593.js → dep-b58adab6.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 +9 -9
- 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
|
@@ -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
|
|
|
@@ -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
|
}
|
|
@@ -35665,7 +35671,7 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
|
|
|
35665
35671
|
}
|
|
35666
35672
|
});
|
|
35667
35673
|
files.forEach((i) => matchedFiles.add(i));
|
|
35668
|
-
const replacement =
|
|
35674
|
+
const replacement = `/* #__PURE__ */ Object.assign({${objectProps.join(',')}})`;
|
|
35669
35675
|
s.overwrite(start, end, replacement);
|
|
35670
35676
|
return staticImports;
|
|
35671
35677
|
}))).flat();
|
|
@@ -37377,79 +37383,97 @@ function matchAll(regex, string, addition) {
|
|
|
37377
37383
|
return matches;
|
|
37378
37384
|
}
|
|
37379
37385
|
|
|
37380
|
-
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;
|
|
37381
|
-
function findStaticImports(code) {
|
|
37382
|
-
return matchAll(ESM_STATIC_IMPORT_RE, code, { type: "static" });
|
|
37383
|
-
}
|
|
37384
|
-
function parseStaticImport(matched) {
|
|
37385
|
-
const cleanedImports = (matched.imports || "").replace(/(\/\/[^\n]*\n|\/\*.*\*\/)/g, "").replace(/\s+/g, " ");
|
|
37386
|
-
const namedImports = {};
|
|
37387
|
-
for (const namedImport of cleanedImports.match(/\{([^}]*)\}/)?.[1]?.split(",") || []) {
|
|
37388
|
-
const [, source = namedImport.trim(), importName = source] = namedImport.match(/^\s*([^\s]*) as ([^\s]*)\s*$/) || [];
|
|
37389
|
-
if (source) {
|
|
37390
|
-
namedImports[source] = importName;
|
|
37391
|
-
}
|
|
37392
|
-
}
|
|
37393
|
-
const topLevelImports = cleanedImports.replace(/\{([^}]*)\}/, "");
|
|
37394
|
-
const namespacedImport = topLevelImports.match(/\* as \s*([^\s]*)/)?.[1];
|
|
37395
|
-
const defaultImport = topLevelImports.split(",").find((i) => !i.match(/[*{}]/))?.trim() || void 0;
|
|
37396
|
-
return {
|
|
37397
|
-
...matched,
|
|
37398
|
-
defaultImport,
|
|
37399
|
-
namespacedImport,
|
|
37400
|
-
namedImports
|
|
37401
|
-
};
|
|
37402
|
-
}
|
|
37403
|
-
|
|
37404
37386
|
const isWindows$3 = process.platform === "win32";
|
|
37405
37387
|
const own$1 = {}.hasOwnProperty;
|
|
37406
37388
|
const messages = /* @__PURE__ */ new Map();
|
|
37407
37389
|
const nodeInternalPrefix = "__node_internal_";
|
|
37408
37390
|
let userStackTraceLimit;
|
|
37409
|
-
createError(
|
|
37410
|
-
|
|
37411
|
-
|
|
37412
|
-
|
|
37413
|
-
|
|
37414
|
-
|
|
37415
|
-
|
|
37416
|
-
|
|
37417
|
-
|
|
37418
|
-
|
|
37419
|
-
return `Invalid
|
|
37420
|
-
}
|
|
37421
|
-
|
|
37422
|
-
|
|
37423
|
-
createError(
|
|
37424
|
-
|
|
37425
|
-
|
|
37426
|
-
|
|
37427
|
-
|
|
37428
|
-
|
|
37429
|
-
|
|
37430
|
-
|
|
37431
|
-
return `
|
|
37432
|
-
|
|
37433
|
-
|
|
37434
|
-
},
|
|
37435
|
-
|
|
37436
|
-
|
|
37437
|
-
createError(
|
|
37438
|
-
|
|
37439
|
-
|
|
37440
|
-
|
|
37441
|
-
}
|
|
37442
|
-
|
|
37443
|
-
|
|
37444
|
-
|
|
37445
|
-
|
|
37446
|
-
|
|
37447
|
-
|
|
37448
|
-
|
|
37449
|
-
|
|
37450
|
-
|
|
37451
|
-
|
|
37452
|
-
|
|
37391
|
+
createError(
|
|
37392
|
+
"ERR_INVALID_MODULE_SPECIFIER",
|
|
37393
|
+
(request, reason, base = void 0) => {
|
|
37394
|
+
return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
|
|
37395
|
+
},
|
|
37396
|
+
TypeError
|
|
37397
|
+
);
|
|
37398
|
+
createError(
|
|
37399
|
+
"ERR_INVALID_PACKAGE_CONFIG",
|
|
37400
|
+
(path, base, message) => {
|
|
37401
|
+
return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
37402
|
+
},
|
|
37403
|
+
Error
|
|
37404
|
+
);
|
|
37405
|
+
createError(
|
|
37406
|
+
"ERR_INVALID_PACKAGE_TARGET",
|
|
37407
|
+
(pkgPath, key, target, isImport = false, base = void 0) => {
|
|
37408
|
+
const relError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
37409
|
+
if (key === ".") {
|
|
37410
|
+
assert$1(isImport === false);
|
|
37411
|
+
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 "./"' : ""}`;
|
|
37412
|
+
}
|
|
37413
|
+
return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
|
|
37414
|
+
target
|
|
37415
|
+
)} defined for '${key}' in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`;
|
|
37416
|
+
},
|
|
37417
|
+
Error
|
|
37418
|
+
);
|
|
37419
|
+
createError(
|
|
37420
|
+
"ERR_MODULE_NOT_FOUND",
|
|
37421
|
+
(path, base, type = "package") => {
|
|
37422
|
+
return `Cannot find ${type} '${path}' imported from ${base}`;
|
|
37423
|
+
},
|
|
37424
|
+
Error
|
|
37425
|
+
);
|
|
37426
|
+
createError(
|
|
37427
|
+
"ERR_PACKAGE_IMPORT_NOT_DEFINED",
|
|
37428
|
+
(specifier, packagePath, base) => {
|
|
37429
|
+
return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`;
|
|
37430
|
+
},
|
|
37431
|
+
TypeError
|
|
37432
|
+
);
|
|
37433
|
+
createError(
|
|
37434
|
+
"ERR_PACKAGE_PATH_NOT_EXPORTED",
|
|
37435
|
+
(pkgPath, subpath, base = void 0) => {
|
|
37436
|
+
if (subpath === ".") {
|
|
37437
|
+
return `No "exports" main defined in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
37438
|
+
}
|
|
37439
|
+
return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
37440
|
+
},
|
|
37441
|
+
Error
|
|
37442
|
+
);
|
|
37443
|
+
createError(
|
|
37444
|
+
"ERR_UNSUPPORTED_DIR_IMPORT",
|
|
37445
|
+
"Directory import '%s' is not supported resolving ES modules imported from %s",
|
|
37446
|
+
Error
|
|
37447
|
+
);
|
|
37448
|
+
createError(
|
|
37449
|
+
"ERR_UNKNOWN_FILE_EXTENSION",
|
|
37450
|
+
'Unknown file extension "%s" for %s',
|
|
37451
|
+
TypeError
|
|
37452
|
+
);
|
|
37453
|
+
createError(
|
|
37454
|
+
"ERR_INVALID_ARG_VALUE",
|
|
37455
|
+
(name, value, reason = "is invalid") => {
|
|
37456
|
+
let inspected = inspect(value);
|
|
37457
|
+
if (inspected.length > 128) {
|
|
37458
|
+
inspected = `${inspected.slice(0, 128)}...`;
|
|
37459
|
+
}
|
|
37460
|
+
const type = name.includes(".") ? "property" : "argument";
|
|
37461
|
+
return `The ${type} '${name}' ${reason}. Received ${inspected}`;
|
|
37462
|
+
},
|
|
37463
|
+
TypeError
|
|
37464
|
+
);
|
|
37465
|
+
createError(
|
|
37466
|
+
"ERR_UNSUPPORTED_ESM_URL_SCHEME",
|
|
37467
|
+
(url) => {
|
|
37468
|
+
let message = "Only file and data URLs are supported by the default ESM loader";
|
|
37469
|
+
if (isWindows$3 && url.protocol.length === 2) {
|
|
37470
|
+
message += ". On Windows, absolute paths must be valid file:// URLs";
|
|
37471
|
+
}
|
|
37472
|
+
message += `. Received protocol '${url.protocol}'`;
|
|
37473
|
+
return message;
|
|
37474
|
+
},
|
|
37475
|
+
Error
|
|
37476
|
+
);
|
|
37453
37477
|
function createError(sym, value, def) {
|
|
37454
37478
|
messages.set(sym, value);
|
|
37455
37479
|
return makeNodeErrorWithCode(def, sym);
|
|
@@ -37485,20 +37509,22 @@ function makeNodeErrorWithCode(Base, key) {
|
|
|
37485
37509
|
return error;
|
|
37486
37510
|
}
|
|
37487
37511
|
}
|
|
37488
|
-
const addCodeToName = hideStackFrames(
|
|
37489
|
-
error
|
|
37490
|
-
|
|
37491
|
-
|
|
37492
|
-
|
|
37493
|
-
|
|
37494
|
-
|
|
37495
|
-
|
|
37496
|
-
|
|
37497
|
-
|
|
37498
|
-
|
|
37499
|
-
|
|
37512
|
+
const addCodeToName = hideStackFrames(
|
|
37513
|
+
function(error, name, code) {
|
|
37514
|
+
error = captureLargerStackTrace(error);
|
|
37515
|
+
error.name = `${name} [${code}]`;
|
|
37516
|
+
if (name === "SystemError") {
|
|
37517
|
+
Object.defineProperty(error, "name", {
|
|
37518
|
+
value: name,
|
|
37519
|
+
enumerable: false,
|
|
37520
|
+
writable: true,
|
|
37521
|
+
configurable: true
|
|
37522
|
+
});
|
|
37523
|
+
} else {
|
|
37524
|
+
delete error.name;
|
|
37525
|
+
}
|
|
37500
37526
|
}
|
|
37501
|
-
|
|
37527
|
+
);
|
|
37502
37528
|
function isErrorStackTraceLimitWritable() {
|
|
37503
37529
|
const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
37504
37530
|
if (desc === void 0) {
|
|
@@ -37511,26 +37537,34 @@ function hideStackFrames(fn) {
|
|
|
37511
37537
|
Object.defineProperty(fn, "name", { value: hidden });
|
|
37512
37538
|
return fn;
|
|
37513
37539
|
}
|
|
37514
|
-
const captureLargerStackTrace = hideStackFrames(
|
|
37515
|
-
|
|
37516
|
-
|
|
37517
|
-
|
|
37518
|
-
|
|
37519
|
-
|
|
37520
|
-
|
|
37521
|
-
|
|
37522
|
-
|
|
37540
|
+
const captureLargerStackTrace = hideStackFrames(
|
|
37541
|
+
function(error) {
|
|
37542
|
+
const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
37543
|
+
if (stackTraceLimitIsWritable) {
|
|
37544
|
+
userStackTraceLimit = Error.stackTraceLimit;
|
|
37545
|
+
Error.stackTraceLimit = Number.POSITIVE_INFINITY;
|
|
37546
|
+
}
|
|
37547
|
+
Error.captureStackTrace(error);
|
|
37548
|
+
if (stackTraceLimitIsWritable) {
|
|
37549
|
+
Error.stackTraceLimit = userStackTraceLimit;
|
|
37550
|
+
}
|
|
37551
|
+
return error;
|
|
37523
37552
|
}
|
|
37524
|
-
|
|
37525
|
-
});
|
|
37553
|
+
);
|
|
37526
37554
|
function getMessage(key, args, self) {
|
|
37527
37555
|
const message = messages.get(key);
|
|
37528
37556
|
if (typeof message === "function") {
|
|
37529
|
-
assert$1(
|
|
37557
|
+
assert$1(
|
|
37558
|
+
message.length <= args.length,
|
|
37559
|
+
`Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${message.length}).`
|
|
37560
|
+
);
|
|
37530
37561
|
return Reflect.apply(message, self, args);
|
|
37531
37562
|
}
|
|
37532
37563
|
const expectedLength = (message.match(/%[dfijoOs]/g) || []).length;
|
|
37533
|
-
assert$1(
|
|
37564
|
+
assert$1(
|
|
37565
|
+
expectedLength === args.length,
|
|
37566
|
+
`Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`
|
|
37567
|
+
);
|
|
37534
37568
|
if (args.length === 0) {
|
|
37535
37569
|
return message;
|
|
37536
37570
|
}
|
|
@@ -37540,6 +37574,30 @@ function getMessage(key, args, self) {
|
|
|
37540
37574
|
Object.freeze(["node", "import"]);
|
|
37541
37575
|
pathToFileURL$1(process.cwd());
|
|
37542
37576
|
|
|
37577
|
+
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;
|
|
37578
|
+
function findStaticImports(code) {
|
|
37579
|
+
return matchAll(ESM_STATIC_IMPORT_RE, code, { type: "static" });
|
|
37580
|
+
}
|
|
37581
|
+
function parseStaticImport(matched) {
|
|
37582
|
+
const cleanedImports = (matched.imports || "").replace(/(\/\/[^\n]*\n|\/\*.*\*\/)/g, "").replace(/\s+/g, " ");
|
|
37583
|
+
const namedImports = {};
|
|
37584
|
+
for (const namedImport of cleanedImports.match(/\{([^}]*)\}/)?.[1]?.split(",") || []) {
|
|
37585
|
+
const [, source = namedImport.trim(), importName = source] = namedImport.match(/^\s*([^\s]*) as ([^\s]*)\s*$/) || [];
|
|
37586
|
+
if (source) {
|
|
37587
|
+
namedImports[source] = importName;
|
|
37588
|
+
}
|
|
37589
|
+
}
|
|
37590
|
+
const topLevelImports = cleanedImports.replace(/\{([^}]*)\}/, "");
|
|
37591
|
+
const namespacedImport = topLevelImports.match(/\* as \s*([^\s]*)/)?.[1];
|
|
37592
|
+
const defaultImport = topLevelImports.split(",").find((i) => !i.match(/[*{}]/))?.trim() || void 0;
|
|
37593
|
+
return {
|
|
37594
|
+
...matched,
|
|
37595
|
+
defaultImport,
|
|
37596
|
+
namespacedImport,
|
|
37597
|
+
namedImports
|
|
37598
|
+
};
|
|
37599
|
+
}
|
|
37600
|
+
|
|
37543
37601
|
const debugHmr = createDebugger('vite:hmr');
|
|
37544
37602
|
const normalizedClientDir = normalizePath$3(CLIENT_DIR);
|
|
37545
37603
|
function getShortName(file, root) {
|
|
@@ -38019,6 +38077,7 @@ function createIsConfiguredAsSsrExternal(config) {
|
|
|
38019
38077
|
!!configuredAsExternal)?.external;
|
|
38020
38078
|
}
|
|
38021
38079
|
catch (e) {
|
|
38080
|
+
debug$9(`Failed to node resolve "${id}". Skipping externalizing it by default.`);
|
|
38022
38081
|
// may be an invalid import that's resolved by a plugin
|
|
38023
38082
|
return false;
|
|
38024
38083
|
}
|
|
@@ -38885,7 +38944,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
38885
38944
|
function defineImport(node, source) {
|
|
38886
38945
|
deps.add(source);
|
|
38887
38946
|
const importId = `__vite_ssr_import_${uid++}__`;
|
|
38888
|
-
s.
|
|
38947
|
+
s.appendRight(node.start, `const ${importId} = await ${ssrImportKey}(${JSON.stringify(source)});\n`);
|
|
38889
38948
|
return importId;
|
|
38890
38949
|
}
|
|
38891
38950
|
function defineExport(position, name, local = name) {
|
|
@@ -38898,6 +38957,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
38898
38957
|
// import { baz } from 'foo' --> baz -> __import_foo__.baz
|
|
38899
38958
|
// import * as ok from 'foo' --> ok -> __import_foo__
|
|
38900
38959
|
if (node.type === 'ImportDeclaration') {
|
|
38960
|
+
s.remove(node.start, node.end);
|
|
38901
38961
|
const importId = defineImport(node, node.source.value);
|
|
38902
38962
|
for (const spec of node.specifiers) {
|
|
38903
38963
|
if (spec.type === 'ImportSpecifier') {
|
|
@@ -38911,7 +38971,6 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
38911
38971
|
idToImportMap.set(spec.local.name, importId);
|
|
38912
38972
|
}
|
|
38913
38973
|
}
|
|
38914
|
-
s.remove(node.start, node.end);
|
|
38915
38974
|
}
|
|
38916
38975
|
}
|
|
38917
38976
|
// 2. check all export statements and define exports
|
|
@@ -38975,14 +39034,12 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
38975
39034
|
}
|
|
38976
39035
|
// export * from './foo'
|
|
38977
39036
|
if (node.type === 'ExportAllDeclaration') {
|
|
39037
|
+
s.remove(node.start, node.end);
|
|
39038
|
+
const importId = defineImport(node, node.source.value);
|
|
38978
39039
|
if (node.exported) {
|
|
38979
|
-
const importId = defineImport(node, node.source.value);
|
|
38980
|
-
s.remove(node.start, node.end);
|
|
38981
39040
|
defineExport(node.end, node.exported.name, `${importId}`);
|
|
38982
39041
|
}
|
|
38983
39042
|
else {
|
|
38984
|
-
const importId = defineImport(node, node.source.value);
|
|
38985
|
-
s.remove(node.start, node.end);
|
|
38986
39043
|
s.appendLeft(node.end, `${ssrExportAllKey}(${importId});`);
|
|
38987
39044
|
}
|
|
38988
39045
|
}
|
|
@@ -40854,7 +40911,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
40854
40911
|
// dynamic import to constant json may get inlined.
|
|
40855
40912
|
if (chunk.type === 'chunk' && chunk.code.indexOf(preloadMarker) > -1) {
|
|
40856
40913
|
const code = chunk.code;
|
|
40857
|
-
let imports;
|
|
40914
|
+
let imports = [];
|
|
40858
40915
|
try {
|
|
40859
40916
|
imports = parse$b(code)[0].filter((i) => i.d > -1);
|
|
40860
40917
|
}
|
|
@@ -40981,8 +41038,7 @@ function modulePreloadPolyfillPlugin(config) {
|
|
|
40981
41038
|
return '';
|
|
40982
41039
|
}
|
|
40983
41040
|
if (!polyfillString) {
|
|
40984
|
-
polyfillString =
|
|
40985
|
-
`const p = ${polyfill.toString()};` + `${isModernFlag}&&p();`;
|
|
41041
|
+
polyfillString = `${isModernFlag}&&(${polyfill.toString()}());`;
|
|
40986
41042
|
}
|
|
40987
41043
|
return polyfillString;
|
|
40988
41044
|
}
|
|
@@ -41099,7 +41155,7 @@ const assetAttrsConfig = {
|
|
|
41099
41155
|
const isAsyncScriptMap = new WeakMap();
|
|
41100
41156
|
async function traverseHtml(html, filePath, visitor) {
|
|
41101
41157
|
// lazy load compiler
|
|
41102
|
-
const { parse, transform } = await import('./dep-
|
|
41158
|
+
const { parse, transform } = await import('./dep-b58adab6.js').then(function (n) { return n.c; });
|
|
41103
41159
|
// @vue/compiler-core doesn't like lowercase doctypes
|
|
41104
41160
|
html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
|
|
41105
41161
|
try {
|
|
@@ -41529,7 +41585,7 @@ function buildHtmlPlugin(config) {
|
|
|
41529
41585
|
// all imports from entry have been inlined to html, prevent rollup from outputting it
|
|
41530
41586
|
delete bundle[chunk.fileName];
|
|
41531
41587
|
}
|
|
41532
|
-
const shortEmitName = path$n.relative(config.root, id);
|
|
41588
|
+
const shortEmitName = normalizePath$3(path$n.relative(config.root, id));
|
|
41533
41589
|
this.emitFile({
|
|
41534
41590
|
type: 'asset',
|
|
41535
41591
|
fileName: shortEmitName,
|
|
@@ -42218,7 +42274,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
42218
42274
|
const postcssOptions = (postcssConfig && postcssConfig.options) || {};
|
|
42219
42275
|
const postcssPlugins = postcssConfig && postcssConfig.plugins ? postcssConfig.plugins.slice() : [];
|
|
42220
42276
|
if (needInlineImport) {
|
|
42221
|
-
postcssPlugins.unshift((await import('./dep-
|
|
42277
|
+
postcssPlugins.unshift((await import('./dep-94c1417a.js').then(function (n) { return n.i; })).default({
|
|
42222
42278
|
async resolve(id, basedir) {
|
|
42223
42279
|
const publicFile = checkPublicFile(id, config);
|
|
42224
42280
|
if (publicFile) {
|
|
@@ -42237,7 +42293,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
42237
42293
|
logger: config.logger
|
|
42238
42294
|
}));
|
|
42239
42295
|
if (isModule) {
|
|
42240
|
-
postcssPlugins.unshift((await import('./dep-
|
|
42296
|
+
postcssPlugins.unshift((await import('./dep-0f192b10.js').then(function (n) { return n.i; })).default({
|
|
42241
42297
|
...modulesOptions,
|
|
42242
42298
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
42243
42299
|
modules = _modules;
|
|
@@ -49783,30 +49839,44 @@ var guess = function guessEditor (specifiedEditor) {
|
|
|
49783
49839
|
try {
|
|
49784
49840
|
if (process.platform === 'darwin') {
|
|
49785
49841
|
const output = childProcess$2
|
|
49786
|
-
.execSync('ps x', {
|
|
49842
|
+
.execSync('ps x -o comm=', {
|
|
49787
49843
|
stdio: ['pipe', 'pipe', 'ignore']
|
|
49788
49844
|
})
|
|
49789
49845
|
.toString();
|
|
49790
49846
|
const processNames = Object.keys(COMMON_EDITORS_OSX);
|
|
49847
|
+
const processList = output.split('\n');
|
|
49791
49848
|
for (let i = 0; i < processNames.length; i++) {
|
|
49792
49849
|
const processName = processNames[i];
|
|
49850
|
+
// Find editor by exact match.
|
|
49793
49851
|
if (output.indexOf(processName) !== -1) {
|
|
49794
49852
|
return [COMMON_EDITORS_OSX[processName]]
|
|
49795
49853
|
}
|
|
49854
|
+
const processNameWithoutApplications = processName.replace('/Applications', '');
|
|
49855
|
+
// Find editor installation not in /Applications.
|
|
49856
|
+
if (output.indexOf(processNameWithoutApplications) !== -1) {
|
|
49857
|
+
// Use the CLI command if one is specified
|
|
49858
|
+
if (processName !== COMMON_EDITORS_OSX[processName]) {
|
|
49859
|
+
return [COMMON_EDITORS_OSX[processName]]
|
|
49860
|
+
}
|
|
49861
|
+
// Use a partial match to find the running process path. If one is found, use the
|
|
49862
|
+
// existing path since it can be running from anywhere.
|
|
49863
|
+
const runningProcess = processList.find((procName) => procName.endsWith(processNameWithoutApplications));
|
|
49864
|
+
if (runningProcess !== undefined) {
|
|
49865
|
+
return [runningProcess]
|
|
49866
|
+
}
|
|
49867
|
+
}
|
|
49796
49868
|
}
|
|
49797
49869
|
} else if (process.platform === 'win32') {
|
|
49798
49870
|
const output = childProcess$2
|
|
49799
|
-
.execSync(
|
|
49800
|
-
|
|
49801
|
-
|
|
49871
|
+
.execSync(
|
|
49872
|
+
'powershell -NoProfile -Command "Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"',
|
|
49873
|
+
{
|
|
49874
|
+
stdio: ['pipe', 'pipe', 'ignore']
|
|
49875
|
+
}
|
|
49876
|
+
)
|
|
49802
49877
|
.toString();
|
|
49803
49878
|
const runningProcesses = output.split('\r\n');
|
|
49804
49879
|
for (let i = 0; i < runningProcesses.length; i++) {
|
|
49805
|
-
// `Get-Process` sometimes returns empty lines
|
|
49806
|
-
if (!runningProcesses[i]) {
|
|
49807
|
-
continue
|
|
49808
|
-
}
|
|
49809
|
-
|
|
49810
49880
|
const fullProcessPath = runningProcesses[i].trim();
|
|
49811
49881
|
const shortProcessName = path$8.basename(fullProcessPath);
|
|
49812
49882
|
|
|
@@ -49882,6 +49952,7 @@ var getArgs = function getArgumentsForPosition (
|
|
|
49882
49952
|
case 'code':
|
|
49883
49953
|
case 'code-insiders':
|
|
49884
49954
|
case 'Code':
|
|
49955
|
+
case 'codium':
|
|
49885
49956
|
return ['-r', '-g', `${fileName}:${lineNumber}:${columnNumber}`]
|
|
49886
49957
|
case 'appcode':
|
|
49887
49958
|
case 'clion':
|
|
@@ -49896,7 +49967,7 @@ var getArgs = function getArgumentsForPosition (
|
|
|
49896
49967
|
case 'rubymine64':
|
|
49897
49968
|
case 'webstorm':
|
|
49898
49969
|
case 'webstorm64':
|
|
49899
|
-
return ['--line', lineNumber, fileName]
|
|
49970
|
+
return ['--line', lineNumber, '--column', columnNumber, fileName]
|
|
49900
49971
|
}
|
|
49901
49972
|
|
|
49902
49973
|
// For all others, drop the lineNumber until we have
|
|
@@ -50075,16 +50146,16 @@ var launchEditorMiddleware = (specifiedEditor, srcRoot, onErrorCallback) => {
|
|
|
50075
50146
|
|
|
50076
50147
|
async function resolveHttpServer({ proxy }, app, httpsOptions) {
|
|
50077
50148
|
if (!httpsOptions) {
|
|
50078
|
-
const { createServer } = await import('http');
|
|
50149
|
+
const { createServer } = await import('node:http');
|
|
50079
50150
|
return createServer(app);
|
|
50080
50151
|
}
|
|
50081
50152
|
// #484 fallback to http1 when proxy is needed.
|
|
50082
50153
|
if (proxy) {
|
|
50083
|
-
const { createServer } = await import('https');
|
|
50154
|
+
const { createServer } = await import('node:https');
|
|
50084
50155
|
return createServer(httpsOptions, app);
|
|
50085
50156
|
}
|
|
50086
50157
|
else {
|
|
50087
|
-
const { createSecureServer } = await import('http2');
|
|
50158
|
+
const { createSecureServer } = await import('node:http2');
|
|
50088
50159
|
return createSecureServer({
|
|
50089
50160
|
// Manually increase the session memory to prevent 502 ENHANCE_YOUR_CALM
|
|
50090
50161
|
// errors on large numbers of requests
|
|
@@ -50182,7 +50253,7 @@ function ssrRequireHookPlugin(config) {
|
|
|
50182
50253
|
/** Respect the `resolve.dedupe` option in production SSR. */
|
|
50183
50254
|
function dedupeRequire(dedupe) {
|
|
50184
50255
|
// eslint-disable-next-line no-restricted-globals
|
|
50185
|
-
const Module = require('module');
|
|
50256
|
+
const Module = require('node:module');
|
|
50186
50257
|
const resolveFilename = Module._resolveFilename;
|
|
50187
50258
|
Module._resolveFilename = function (request, parent, isMain, options) {
|
|
50188
50259
|
if (request[0] !== '.' && request[0] !== '/') {
|
|
@@ -61842,11 +61913,28 @@ function expressionToGlob(node) {
|
|
|
61842
61913
|
}
|
|
61843
61914
|
}
|
|
61844
61915
|
|
|
61916
|
+
const defaultProtocol = 'file:';
|
|
61917
|
+
const ignoredProtocols = ['data:', 'http:', 'https:'];
|
|
61918
|
+
|
|
61919
|
+
function shouldIgnore(glob) {
|
|
61920
|
+
const containsAsterisk = glob.includes('*');
|
|
61921
|
+
|
|
61922
|
+
const globURL = new URL(glob, defaultProtocol);
|
|
61923
|
+
|
|
61924
|
+
const containsIgnoredProtocol = ignoredProtocols.some(
|
|
61925
|
+
(ignoredProtocol) => ignoredProtocol === globURL.protocol
|
|
61926
|
+
);
|
|
61927
|
+
|
|
61928
|
+
return !containsAsterisk || containsIgnoredProtocol;
|
|
61929
|
+
}
|
|
61930
|
+
|
|
61845
61931
|
function dynamicImportToGlob(node, sourceString) {
|
|
61846
61932
|
let glob = expressionToGlob(node);
|
|
61847
|
-
|
|
61933
|
+
|
|
61934
|
+
if (shouldIgnore(glob)) {
|
|
61848
61935
|
return null;
|
|
61849
61936
|
}
|
|
61937
|
+
|
|
61850
61938
|
glob = glob.replace(/\*\*/g, '*');
|
|
61851
61939
|
|
|
61852
61940
|
if (glob.startsWith('*')) {
|
|
@@ -62663,7 +62751,11 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
|
|
|
62663
62751
|
if (process.env.DEBUG) {
|
|
62664
62752
|
debug(`using resolved config: %O`, {
|
|
62665
62753
|
...resolved,
|
|
62666
|
-
plugins: resolved.plugins.map((p) => p.name)
|
|
62754
|
+
plugins: resolved.plugins.map((p) => p.name),
|
|
62755
|
+
worker: {
|
|
62756
|
+
...resolved.worker,
|
|
62757
|
+
plugins: resolved.worker.plugins.map((p) => p.name)
|
|
62758
|
+
}
|
|
62667
62759
|
});
|
|
62668
62760
|
}
|
|
62669
62761
|
if (config.build?.terserOptions && config.build.minify !== 'terser') {
|
|
@@ -62805,6 +62897,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
62805
62897
|
entryPoints: [fileName],
|
|
62806
62898
|
outfile: 'out.js',
|
|
62807
62899
|
write: false,
|
|
62900
|
+
target: ['node14.18', 'node16'],
|
|
62808
62901
|
platform: 'node',
|
|
62809
62902
|
bundle: true,
|
|
62810
62903
|
format: isESM ? 'esm' : 'cjs',
|
|
@@ -62848,7 +62941,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
62848
62941
|
if (path$n.relative(idPkgDir, fileName).startsWith('..')) {
|
|
62849
62942
|
return {
|
|
62850
62943
|
// normalize actual import after bundled as a single vite config
|
|
62851
|
-
path: idFsPath,
|
|
62944
|
+
path: pathToFileURL(idFsPath).href,
|
|
62852
62945
|
external: true
|
|
62853
62946
|
};
|
|
62854
62947
|
}
|
|
@@ -62893,7 +62986,12 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
|
|
|
62893
62986
|
return (await dynamicImport(fileUrl)).default;
|
|
62894
62987
|
}
|
|
62895
62988
|
finally {
|
|
62896
|
-
|
|
62989
|
+
try {
|
|
62990
|
+
fs$l.unlinkSync(fileNameTmp);
|
|
62991
|
+
}
|
|
62992
|
+
catch {
|
|
62993
|
+
// already removed if this function is called twice simultaneously
|
|
62994
|
+
}
|
|
62897
62995
|
}
|
|
62898
62996
|
}
|
|
62899
62997
|
// for cjs, we can register a custom loader via `_require.extensions`
|