vite 3.2.3 → 3.2.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/LICENSE.md +51 -7
- package/dist/client/client.mjs +1 -0
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-7591464a.js → dep-4d50f047.js} +5438 -5403
- package/dist/node/chunks/{dep-51c4f80a.js → dep-5605cfa4.js} +356 -48
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +1 -1
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +1 -1
- package/dist/node-cjs/publicUtils.cjs +1 -1
- package/index.cjs +2 -1
- package/package.json +3 -2
|
@@ -12299,12 +12299,15 @@ function getHash(text) {
|
|
|
12299
12299
|
return createHash$2('sha256').update(text).digest('hex').substring(0, 8);
|
|
12300
12300
|
}
|
|
12301
12301
|
const requireResolveFromRootWithFallback = (root, id) => {
|
|
12302
|
+
const paths = _require$4.resolve.paths?.(id) || [];
|
|
12302
12303
|
// Search in the root directory first, and fallback to the default require paths.
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12304
|
+
paths.unshift(root);
|
|
12305
|
+
// Use `resolve` package to check existence first, so if the package is not found,
|
|
12306
|
+
// it won't be cached by nodejs, since there isn't a way to invalidate them:
|
|
12307
|
+
// https://github.com/nodejs/node/issues/44663
|
|
12308
|
+
resolve$5.sync(id, { basedir: root, paths });
|
|
12309
|
+
// Use `require.resolve` again as the `resolve` package doesn't support the `exports` field
|
|
12310
|
+
return _require$4.resolve(id, { paths });
|
|
12308
12311
|
};
|
|
12309
12312
|
// Based on node-graceful-fs
|
|
12310
12313
|
// The ISC License
|
|
@@ -13370,9 +13373,10 @@ async function transformWithEsbuild(code, filename, options, inMap) {
|
|
|
13370
13373
|
]);
|
|
13371
13374
|
}
|
|
13372
13375
|
else {
|
|
13373
|
-
map =
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
+
map =
|
|
13377
|
+
resolvedOptions.sourcemap && resolvedOptions.sourcemap !== 'inline'
|
|
13378
|
+
? JSON.parse(result.map)
|
|
13379
|
+
: { mappings: '' };
|
|
13376
13380
|
}
|
|
13377
13381
|
if (Array.isArray(map.sources)) {
|
|
13378
13382
|
map.sources = map.sources.map((it) => toUpperCaseDriveLetter(it));
|
|
@@ -32299,6 +32303,7 @@ function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
|
|
|
32299
32303
|
// Urls added in CSS that is imported in JS end up like
|
|
32300
32304
|
// var inlined = ".inlined{color:green;background:url(__VITE_ASSET__5aa0ddc0__)}\n";
|
|
32301
32305
|
// In both cases, the wrapping should already be fine
|
|
32306
|
+
assetUrlRE.lastIndex = 0;
|
|
32302
32307
|
while ((match = assetUrlRE.exec(code))) {
|
|
32303
32308
|
s || (s = new MagicString(code));
|
|
32304
32309
|
const [full, hash, postfix = ''] = match;
|
|
@@ -32315,6 +32320,7 @@ function renderAssetUrlInJS(ctx, config, chunk, opts, code) {
|
|
|
32315
32320
|
}
|
|
32316
32321
|
// Replace __VITE_PUBLIC_ASSET__5aa0ddc0__ with absolute paths
|
|
32317
32322
|
const publicAssetUrlMap = publicAssetUrlCache.get(config);
|
|
32323
|
+
publicAssetUrlRE.lastIndex = 0;
|
|
32318
32324
|
while ((match = publicAssetUrlRE.exec(code))) {
|
|
32319
32325
|
s || (s = new MagicString(code));
|
|
32320
32326
|
const [full, hash] = match;
|
|
@@ -33388,6 +33394,7 @@ function webWorkerPlugin(config) {
|
|
|
33388
33394
|
const toRelativeRuntime = createToImportMetaURLBasedRelativeRuntime(outputOptions.format);
|
|
33389
33395
|
let match;
|
|
33390
33396
|
s = new MagicString(code);
|
|
33397
|
+
workerAssetUrlRE.lastIndex = 0;
|
|
33391
33398
|
// Replace "__VITE_WORKER_ASSET__5aa0ddc0__" using relative paths
|
|
33392
33399
|
const workerMap = workerCache.get(config.mainConfig || config);
|
|
33393
33400
|
const { fileNameHash } = workerMap;
|
|
@@ -33802,20 +33809,21 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr, ex
|
|
|
33802
33809
|
if (!pkg || !nearestPkg) {
|
|
33803
33810
|
// if import can't be found, check if it's an optional peer dep.
|
|
33804
33811
|
// if so, we can resolve to a special id that errors only when imported.
|
|
33805
|
-
if (
|
|
33806
|
-
|
|
33807
|
-
!
|
|
33808
|
-
|
|
33812
|
+
if (!options.isHookNodeResolve &&
|
|
33813
|
+
basedir !== root && // root has no peer dep
|
|
33814
|
+
!isBuiltin(nestedPath) &&
|
|
33815
|
+
!nestedPath.includes('\0') &&
|
|
33816
|
+
bareImportRE.test(nestedPath)) {
|
|
33809
33817
|
// find package.json with `name` as main
|
|
33810
33818
|
const mainPackageJson = lookupFile(basedir, ['package.json'], {
|
|
33811
33819
|
predicate: (content) => !!JSON.parse(content).name
|
|
33812
33820
|
});
|
|
33813
33821
|
if (mainPackageJson) {
|
|
33814
33822
|
const mainPkg = JSON.parse(mainPackageJson);
|
|
33815
|
-
if (mainPkg.peerDependencies?.[
|
|
33816
|
-
mainPkg.peerDependenciesMeta?.[
|
|
33823
|
+
if (mainPkg.peerDependencies?.[nestedPath] &&
|
|
33824
|
+
mainPkg.peerDependenciesMeta?.[nestedPath]?.optional) {
|
|
33817
33825
|
return {
|
|
33818
|
-
id: `${optionalPeerDepId}:${
|
|
33826
|
+
id: `${optionalPeerDepId}:${nestedPath}:${mainPkg.name}`
|
|
33819
33827
|
};
|
|
33820
33828
|
}
|
|
33821
33829
|
}
|
|
@@ -33899,18 +33907,21 @@ function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr, ex
|
|
|
33899
33907
|
? isOptimizable(resolved, depsOptimizer.options)
|
|
33900
33908
|
: OPTIMIZABLE_ENTRY_RE.test(resolved);
|
|
33901
33909
|
let exclude = depsOptimizer?.options.exclude;
|
|
33902
|
-
let include = depsOptimizer?.options.
|
|
33910
|
+
let include = depsOptimizer?.options.include;
|
|
33903
33911
|
if (options.ssrOptimizeCheck) {
|
|
33904
33912
|
// we don't have the depsOptimizer
|
|
33905
33913
|
exclude = options.ssrConfig?.optimizeDeps?.exclude;
|
|
33906
|
-
include = options.ssrConfig?.optimizeDeps?.
|
|
33914
|
+
include = options.ssrConfig?.optimizeDeps?.include;
|
|
33907
33915
|
}
|
|
33908
33916
|
const skipOptimization = !isJsType ||
|
|
33909
33917
|
importer?.includes('node_modules') ||
|
|
33910
33918
|
exclude?.includes(pkgId) ||
|
|
33911
33919
|
exclude?.includes(nestedPath) ||
|
|
33912
33920
|
SPECIAL_QUERY_RE.test(resolved) ||
|
|
33913
|
-
|
|
33921
|
+
// During dev SSR, we don't have a way to reload the module graph if
|
|
33922
|
+
// a non-optimized dep is found. So we need to skip optimization here.
|
|
33923
|
+
// The only optimized deps are the ones explicitly listed in the config.
|
|
33924
|
+
(!options.ssrOptimizeCheck && !isBuild && ssr) ||
|
|
33914
33925
|
// Only optimize non-external CJS deps during SSR by default
|
|
33915
33926
|
(ssr &&
|
|
33916
33927
|
!isCJS &&
|
|
@@ -34946,6 +34957,305 @@ function throwOutdatedRequest(id) {
|
|
|
34946
34957
|
throw err;
|
|
34947
34958
|
}
|
|
34948
34959
|
|
|
34960
|
+
// AST walker module for Mozilla Parser API compatible trees
|
|
34961
|
+
|
|
34962
|
+
function makeTest(test) {
|
|
34963
|
+
if (typeof test === "string")
|
|
34964
|
+
{ return function (type) { return type === test; } }
|
|
34965
|
+
else if (!test)
|
|
34966
|
+
{ return function () { return true; } }
|
|
34967
|
+
else
|
|
34968
|
+
{ return test }
|
|
34969
|
+
}
|
|
34970
|
+
|
|
34971
|
+
var Found = function Found(node, state) { this.node = node; this.state = state; };
|
|
34972
|
+
|
|
34973
|
+
// Find a node with a given start, end, and type (all are optional,
|
|
34974
|
+
// null can be used as wildcard). Returns a {node, state} object, or
|
|
34975
|
+
// undefined when it doesn't find a matching node.
|
|
34976
|
+
function findNodeAt(node, start, end, test, baseVisitor, state) {
|
|
34977
|
+
if (!baseVisitor) { baseVisitor = base; }
|
|
34978
|
+
test = makeTest(test);
|
|
34979
|
+
try {
|
|
34980
|
+
(function c(node, st, override) {
|
|
34981
|
+
var type = override || node.type;
|
|
34982
|
+
if ((start == null || node.start <= start) &&
|
|
34983
|
+
(end == null || node.end >= end))
|
|
34984
|
+
{ baseVisitor[type](node, st, c); }
|
|
34985
|
+
if ((start == null || node.start === start) &&
|
|
34986
|
+
(end == null || node.end === end) &&
|
|
34987
|
+
test(type, node))
|
|
34988
|
+
{ throw new Found(node, st) }
|
|
34989
|
+
})(node, state);
|
|
34990
|
+
} catch (e) {
|
|
34991
|
+
if (e instanceof Found) { return e }
|
|
34992
|
+
throw e
|
|
34993
|
+
}
|
|
34994
|
+
}
|
|
34995
|
+
|
|
34996
|
+
function skipThrough(node, st, c) { c(node, st); }
|
|
34997
|
+
function ignore(_node, _st, _c) {}
|
|
34998
|
+
|
|
34999
|
+
// Node walkers.
|
|
35000
|
+
|
|
35001
|
+
var base = {};
|
|
35002
|
+
|
|
35003
|
+
base.Program = base.BlockStatement = base.StaticBlock = function (node, st, c) {
|
|
35004
|
+
for (var i = 0, list = node.body; i < list.length; i += 1)
|
|
35005
|
+
{
|
|
35006
|
+
var stmt = list[i];
|
|
35007
|
+
|
|
35008
|
+
c(stmt, st, "Statement");
|
|
35009
|
+
}
|
|
35010
|
+
};
|
|
35011
|
+
base.Statement = skipThrough;
|
|
35012
|
+
base.EmptyStatement = ignore;
|
|
35013
|
+
base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression =
|
|
35014
|
+
function (node, st, c) { return c(node.expression, st, "Expression"); };
|
|
35015
|
+
base.IfStatement = function (node, st, c) {
|
|
35016
|
+
c(node.test, st, "Expression");
|
|
35017
|
+
c(node.consequent, st, "Statement");
|
|
35018
|
+
if (node.alternate) { c(node.alternate, st, "Statement"); }
|
|
35019
|
+
};
|
|
35020
|
+
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); };
|
|
35021
|
+
base.BreakStatement = base.ContinueStatement = ignore;
|
|
35022
|
+
base.WithStatement = function (node, st, c) {
|
|
35023
|
+
c(node.object, st, "Expression");
|
|
35024
|
+
c(node.body, st, "Statement");
|
|
35025
|
+
};
|
|
35026
|
+
base.SwitchStatement = function (node, st, c) {
|
|
35027
|
+
c(node.discriminant, st, "Expression");
|
|
35028
|
+
for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
|
|
35029
|
+
var cs = list$1[i$1];
|
|
35030
|
+
|
|
35031
|
+
if (cs.test) { c(cs.test, st, "Expression"); }
|
|
35032
|
+
for (var i = 0, list = cs.consequent; i < list.length; i += 1)
|
|
35033
|
+
{
|
|
35034
|
+
var cons = list[i];
|
|
35035
|
+
|
|
35036
|
+
c(cons, st, "Statement");
|
|
35037
|
+
}
|
|
35038
|
+
}
|
|
35039
|
+
};
|
|
35040
|
+
base.SwitchCase = function (node, st, c) {
|
|
35041
|
+
if (node.test) { c(node.test, st, "Expression"); }
|
|
35042
|
+
for (var i = 0, list = node.consequent; i < list.length; i += 1)
|
|
35043
|
+
{
|
|
35044
|
+
var cons = list[i];
|
|
35045
|
+
|
|
35046
|
+
c(cons, st, "Statement");
|
|
35047
|
+
}
|
|
35048
|
+
};
|
|
35049
|
+
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) {
|
|
35050
|
+
if (node.argument) { c(node.argument, st, "Expression"); }
|
|
35051
|
+
};
|
|
35052
|
+
base.ThrowStatement = base.SpreadElement =
|
|
35053
|
+
function (node, st, c) { return c(node.argument, st, "Expression"); };
|
|
35054
|
+
base.TryStatement = function (node, st, c) {
|
|
35055
|
+
c(node.block, st, "Statement");
|
|
35056
|
+
if (node.handler) { c(node.handler, st); }
|
|
35057
|
+
if (node.finalizer) { c(node.finalizer, st, "Statement"); }
|
|
35058
|
+
};
|
|
35059
|
+
base.CatchClause = function (node, st, c) {
|
|
35060
|
+
if (node.param) { c(node.param, st, "Pattern"); }
|
|
35061
|
+
c(node.body, st, "Statement");
|
|
35062
|
+
};
|
|
35063
|
+
base.WhileStatement = base.DoWhileStatement = function (node, st, c) {
|
|
35064
|
+
c(node.test, st, "Expression");
|
|
35065
|
+
c(node.body, st, "Statement");
|
|
35066
|
+
};
|
|
35067
|
+
base.ForStatement = function (node, st, c) {
|
|
35068
|
+
if (node.init) { c(node.init, st, "ForInit"); }
|
|
35069
|
+
if (node.test) { c(node.test, st, "Expression"); }
|
|
35070
|
+
if (node.update) { c(node.update, st, "Expression"); }
|
|
35071
|
+
c(node.body, st, "Statement");
|
|
35072
|
+
};
|
|
35073
|
+
base.ForInStatement = base.ForOfStatement = function (node, st, c) {
|
|
35074
|
+
c(node.left, st, "ForInit");
|
|
35075
|
+
c(node.right, st, "Expression");
|
|
35076
|
+
c(node.body, st, "Statement");
|
|
35077
|
+
};
|
|
35078
|
+
base.ForInit = function (node, st, c) {
|
|
35079
|
+
if (node.type === "VariableDeclaration") { c(node, st); }
|
|
35080
|
+
else { c(node, st, "Expression"); }
|
|
35081
|
+
};
|
|
35082
|
+
base.DebuggerStatement = ignore;
|
|
35083
|
+
|
|
35084
|
+
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); };
|
|
35085
|
+
base.VariableDeclaration = function (node, st, c) {
|
|
35086
|
+
for (var i = 0, list = node.declarations; i < list.length; i += 1)
|
|
35087
|
+
{
|
|
35088
|
+
var decl = list[i];
|
|
35089
|
+
|
|
35090
|
+
c(decl, st);
|
|
35091
|
+
}
|
|
35092
|
+
};
|
|
35093
|
+
base.VariableDeclarator = function (node, st, c) {
|
|
35094
|
+
c(node.id, st, "Pattern");
|
|
35095
|
+
if (node.init) { c(node.init, st, "Expression"); }
|
|
35096
|
+
};
|
|
35097
|
+
|
|
35098
|
+
base.Function = function (node, st, c) {
|
|
35099
|
+
if (node.id) { c(node.id, st, "Pattern"); }
|
|
35100
|
+
for (var i = 0, list = node.params; i < list.length; i += 1)
|
|
35101
|
+
{
|
|
35102
|
+
var param = list[i];
|
|
35103
|
+
|
|
35104
|
+
c(param, st, "Pattern");
|
|
35105
|
+
}
|
|
35106
|
+
c(node.body, st, node.expression ? "Expression" : "Statement");
|
|
35107
|
+
};
|
|
35108
|
+
|
|
35109
|
+
base.Pattern = function (node, st, c) {
|
|
35110
|
+
if (node.type === "Identifier")
|
|
35111
|
+
{ c(node, st, "VariablePattern"); }
|
|
35112
|
+
else if (node.type === "MemberExpression")
|
|
35113
|
+
{ c(node, st, "MemberPattern"); }
|
|
35114
|
+
else
|
|
35115
|
+
{ c(node, st); }
|
|
35116
|
+
};
|
|
35117
|
+
base.VariablePattern = ignore;
|
|
35118
|
+
base.MemberPattern = skipThrough;
|
|
35119
|
+
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); };
|
|
35120
|
+
base.ArrayPattern = function (node, st, c) {
|
|
35121
|
+
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
|
35122
|
+
var elt = list[i];
|
|
35123
|
+
|
|
35124
|
+
if (elt) { c(elt, st, "Pattern"); }
|
|
35125
|
+
}
|
|
35126
|
+
};
|
|
35127
|
+
base.ObjectPattern = function (node, st, c) {
|
|
35128
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
|
35129
|
+
var prop = list[i];
|
|
35130
|
+
|
|
35131
|
+
if (prop.type === "Property") {
|
|
35132
|
+
if (prop.computed) { c(prop.key, st, "Expression"); }
|
|
35133
|
+
c(prop.value, st, "Pattern");
|
|
35134
|
+
} else if (prop.type === "RestElement") {
|
|
35135
|
+
c(prop.argument, st, "Pattern");
|
|
35136
|
+
}
|
|
35137
|
+
}
|
|
35138
|
+
};
|
|
35139
|
+
|
|
35140
|
+
base.Expression = skipThrough;
|
|
35141
|
+
base.ThisExpression = base.Super = base.MetaProperty = ignore;
|
|
35142
|
+
base.ArrayExpression = function (node, st, c) {
|
|
35143
|
+
for (var i = 0, list = node.elements; i < list.length; i += 1) {
|
|
35144
|
+
var elt = list[i];
|
|
35145
|
+
|
|
35146
|
+
if (elt) { c(elt, st, "Expression"); }
|
|
35147
|
+
}
|
|
35148
|
+
};
|
|
35149
|
+
base.ObjectExpression = function (node, st, c) {
|
|
35150
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
|
35151
|
+
{
|
|
35152
|
+
var prop = list[i];
|
|
35153
|
+
|
|
35154
|
+
c(prop, st);
|
|
35155
|
+
}
|
|
35156
|
+
};
|
|
35157
|
+
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration;
|
|
35158
|
+
base.SequenceExpression = function (node, st, c) {
|
|
35159
|
+
for (var i = 0, list = node.expressions; i < list.length; i += 1)
|
|
35160
|
+
{
|
|
35161
|
+
var expr = list[i];
|
|
35162
|
+
|
|
35163
|
+
c(expr, st, "Expression");
|
|
35164
|
+
}
|
|
35165
|
+
};
|
|
35166
|
+
base.TemplateLiteral = function (node, st, c) {
|
|
35167
|
+
for (var i = 0, list = node.quasis; i < list.length; i += 1)
|
|
35168
|
+
{
|
|
35169
|
+
var quasi = list[i];
|
|
35170
|
+
|
|
35171
|
+
c(quasi, st);
|
|
35172
|
+
}
|
|
35173
|
+
|
|
35174
|
+
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1)
|
|
35175
|
+
{
|
|
35176
|
+
var expr = list$1[i$1];
|
|
35177
|
+
|
|
35178
|
+
c(expr, st, "Expression");
|
|
35179
|
+
}
|
|
35180
|
+
};
|
|
35181
|
+
base.TemplateElement = ignore;
|
|
35182
|
+
base.UnaryExpression = base.UpdateExpression = function (node, st, c) {
|
|
35183
|
+
c(node.argument, st, "Expression");
|
|
35184
|
+
};
|
|
35185
|
+
base.BinaryExpression = base.LogicalExpression = function (node, st, c) {
|
|
35186
|
+
c(node.left, st, "Expression");
|
|
35187
|
+
c(node.right, st, "Expression");
|
|
35188
|
+
};
|
|
35189
|
+
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) {
|
|
35190
|
+
c(node.left, st, "Pattern");
|
|
35191
|
+
c(node.right, st, "Expression");
|
|
35192
|
+
};
|
|
35193
|
+
base.ConditionalExpression = function (node, st, c) {
|
|
35194
|
+
c(node.test, st, "Expression");
|
|
35195
|
+
c(node.consequent, st, "Expression");
|
|
35196
|
+
c(node.alternate, st, "Expression");
|
|
35197
|
+
};
|
|
35198
|
+
base.NewExpression = base.CallExpression = function (node, st, c) {
|
|
35199
|
+
c(node.callee, st, "Expression");
|
|
35200
|
+
if (node.arguments)
|
|
35201
|
+
{ for (var i = 0, list = node.arguments; i < list.length; i += 1)
|
|
35202
|
+
{
|
|
35203
|
+
var arg = list[i];
|
|
35204
|
+
|
|
35205
|
+
c(arg, st, "Expression");
|
|
35206
|
+
} }
|
|
35207
|
+
};
|
|
35208
|
+
base.MemberExpression = function (node, st, c) {
|
|
35209
|
+
c(node.object, st, "Expression");
|
|
35210
|
+
if (node.computed) { c(node.property, st, "Expression"); }
|
|
35211
|
+
};
|
|
35212
|
+
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) {
|
|
35213
|
+
if (node.declaration)
|
|
35214
|
+
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); }
|
|
35215
|
+
if (node.source) { c(node.source, st, "Expression"); }
|
|
35216
|
+
};
|
|
35217
|
+
base.ExportAllDeclaration = function (node, st, c) {
|
|
35218
|
+
if (node.exported)
|
|
35219
|
+
{ c(node.exported, st); }
|
|
35220
|
+
c(node.source, st, "Expression");
|
|
35221
|
+
};
|
|
35222
|
+
base.ImportDeclaration = function (node, st, c) {
|
|
35223
|
+
for (var i = 0, list = node.specifiers; i < list.length; i += 1)
|
|
35224
|
+
{
|
|
35225
|
+
var spec = list[i];
|
|
35226
|
+
|
|
35227
|
+
c(spec, st);
|
|
35228
|
+
}
|
|
35229
|
+
c(node.source, st, "Expression");
|
|
35230
|
+
};
|
|
35231
|
+
base.ImportExpression = function (node, st, c) {
|
|
35232
|
+
c(node.source, st, "Expression");
|
|
35233
|
+
};
|
|
35234
|
+
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore;
|
|
35235
|
+
|
|
35236
|
+
base.TaggedTemplateExpression = function (node, st, c) {
|
|
35237
|
+
c(node.tag, st, "Expression");
|
|
35238
|
+
c(node.quasi, st, "Expression");
|
|
35239
|
+
};
|
|
35240
|
+
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); };
|
|
35241
|
+
base.Class = function (node, st, c) {
|
|
35242
|
+
if (node.id) { c(node.id, st, "Pattern"); }
|
|
35243
|
+
if (node.superClass) { c(node.superClass, st, "Expression"); }
|
|
35244
|
+
c(node.body, st);
|
|
35245
|
+
};
|
|
35246
|
+
base.ClassBody = function (node, st, c) {
|
|
35247
|
+
for (var i = 0, list = node.body; i < list.length; i += 1)
|
|
35248
|
+
{
|
|
35249
|
+
var elt = list[i];
|
|
35250
|
+
|
|
35251
|
+
c(elt, st);
|
|
35252
|
+
}
|
|
35253
|
+
};
|
|
35254
|
+
base.MethodDefinition = base.PropertyDefinition = base.Property = function (node, st, c) {
|
|
35255
|
+
if (node.computed) { c(node.key, st, "Expression"); }
|
|
35256
|
+
if (node.value) { c(node.value, st, "Expression"); }
|
|
35257
|
+
};
|
|
35258
|
+
|
|
34949
35259
|
const { isMatch: isMatch$1, scan } = micromatch_1;
|
|
34950
35260
|
function getAffectedGlobModules(file, server) {
|
|
34951
35261
|
const modules = [];
|
|
@@ -35040,14 +35350,10 @@ async function parseImportGlob(code, importer, root, resolveId) {
|
|
|
35040
35350
|
throw _e;
|
|
35041
35351
|
}
|
|
35042
35352
|
}
|
|
35043
|
-
|
|
35044
|
-
|
|
35045
|
-
// immediate property access, call expression is nested
|
|
35046
|
-
// import.meta.glob(...)['prop']
|
|
35047
|
-
if (ast.type === 'MemberExpression')
|
|
35048
|
-
ast = ast.object;
|
|
35049
|
-
if (ast.type !== 'CallExpression')
|
|
35353
|
+
const found = findNodeAt(ast, start, undefined, 'CallExpression');
|
|
35354
|
+
if (!found)
|
|
35050
35355
|
throw err(`Expect CallExpression, got ${ast.type}`);
|
|
35356
|
+
ast = found.node;
|
|
35051
35357
|
if (ast.arguments.length < 1 || ast.arguments.length > 2)
|
|
35052
35358
|
throw err(`Expected 1-2 arguments, but got ${ast.arguments.length}`);
|
|
35053
35359
|
const arg1 = ast.arguments[0];
|
|
@@ -35250,7 +35556,11 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
|
|
|
35250
35556
|
}
|
|
35251
35557
|
});
|
|
35252
35558
|
files.forEach((i) => matchedFiles.add(i));
|
|
35253
|
-
const
|
|
35559
|
+
const originalLineBreakCount = code.slice(start, end).match(/\n/g)?.length ?? 0;
|
|
35560
|
+
const lineBreaks = originalLineBreakCount > 0
|
|
35561
|
+
? '\n'.repeat(originalLineBreakCount)
|
|
35562
|
+
: '';
|
|
35563
|
+
const replacement = `/* #__PURE__ */ Object.assign({${objectProps.join(',')}${lineBreaks}})`;
|
|
35254
35564
|
s.overwrite(start, end, replacement);
|
|
35255
35565
|
return staticImports;
|
|
35256
35566
|
}))).flat();
|
|
@@ -37559,7 +37869,7 @@ function definePlugin(config) {
|
|
|
37559
37869
|
.join('|') +
|
|
37560
37870
|
// Mustn't be followed by a char that can be part of an identifier
|
|
37561
37871
|
// or an assignment (but allow equality operators)
|
|
37562
|
-
')(?![\\p{L}\\p{N}_$]|\\s*?=[^=])', 'gu')
|
|
37872
|
+
')(?:(?<=\\.)|(?![\\p{L}\\p{N}_$]|\\s*?=[^=]))', 'gu')
|
|
37563
37873
|
: null;
|
|
37564
37874
|
return [replacements, pattern];
|
|
37565
37875
|
}
|
|
@@ -40663,11 +40973,8 @@ function extractImportPaths(code) {
|
|
|
40663
40973
|
.replace(singlelineCommentsRE$1, '');
|
|
40664
40974
|
let js = '';
|
|
40665
40975
|
let m;
|
|
40976
|
+
importsRE.lastIndex = 0;
|
|
40666
40977
|
while ((m = importsRE.exec(code)) != null) {
|
|
40667
|
-
// This is necessary to avoid infinite loops with zero-width matches
|
|
40668
|
-
if (m.index === importsRE.lastIndex) {
|
|
40669
|
-
importsRE.lastIndex++;
|
|
40670
|
-
}
|
|
40671
40978
|
js += `\nimport ${m[1]}`;
|
|
40672
40979
|
}
|
|
40673
40980
|
return js;
|
|
@@ -41591,7 +41898,8 @@ async function addManuallyIncludedOptimizeDeps(deps, config, ssr, extra = [], fi
|
|
|
41591
41898
|
const resolve = config.createResolver({
|
|
41592
41899
|
asSrc: false,
|
|
41593
41900
|
scan: true,
|
|
41594
|
-
ssrOptimizeCheck: ssr
|
|
41901
|
+
ssrOptimizeCheck: ssr,
|
|
41902
|
+
ssrConfig: config.ssr
|
|
41595
41903
|
});
|
|
41596
41904
|
for (const id of [...optimizeDepsInclude, ...extra]) {
|
|
41597
41905
|
// normalize 'foo >bar` as 'foo > bar' to prevent same id being added
|
|
@@ -42702,6 +43010,7 @@ function buildHtmlPlugin(config) {
|
|
|
42702
43010
|
const scriptNode = node.childNodes.pop();
|
|
42703
43011
|
const cleanCode = stripLiteral(scriptNode.value);
|
|
42704
43012
|
let match;
|
|
43013
|
+
inlineImportRE.lastIndex = 0;
|
|
42705
43014
|
while ((match = inlineImportRE.exec(cleanCode))) {
|
|
42706
43015
|
const { 1: url, index } = match;
|
|
42707
43016
|
const startUrl = cleanCode.indexOf(url, index);
|
|
@@ -42985,6 +43294,7 @@ function buildHtmlPlugin(config) {
|
|
|
42985
43294
|
// no use assets plugin because it will emit file
|
|
42986
43295
|
let match;
|
|
42987
43296
|
let s;
|
|
43297
|
+
inlineCSSRE$1.lastIndex = 0;
|
|
42988
43298
|
while ((match = inlineCSSRE$1.exec(result))) {
|
|
42989
43299
|
s || (s = new MagicString(result));
|
|
42990
43300
|
const { 0: full, 1: scopedName } = match;
|
|
@@ -43782,7 +44092,7 @@ async function compileCSS(id, code, config, urlReplacer) {
|
|
|
43782
44092
|
}));
|
|
43783
44093
|
}
|
|
43784
44094
|
if (isModule) {
|
|
43785
|
-
postcssPlugins.unshift((await import('./dep-
|
|
44095
|
+
postcssPlugins.unshift((await import('./dep-4d50f047.js').then(function (n) { return n.i; })).default({
|
|
43786
44096
|
...modulesOptions,
|
|
43787
44097
|
// TODO: convert null to undefined (`null` should be removed from `CSSModulesOptions.localsConvention`)
|
|
43788
44098
|
localsConvention: modulesOptions?.localsConvention ?? undefined,
|
|
@@ -43792,9 +44102,9 @@ async function compileCSS(id, code, config, urlReplacer) {
|
|
|
43792
44102
|
modulesOptions.getJSON(cssFileName, _modules, outputFileName);
|
|
43793
44103
|
}
|
|
43794
44104
|
},
|
|
43795
|
-
async resolve(id) {
|
|
44105
|
+
async resolve(id, importer) {
|
|
43796
44106
|
for (const key of getCssResolversKeys(atImportResolvers)) {
|
|
43797
|
-
const resolved = await atImportResolvers[key](id);
|
|
44107
|
+
const resolved = await atImportResolvers[key](id, importer);
|
|
43798
44108
|
if (resolved) {
|
|
43799
44109
|
return path$o.resolve(resolved);
|
|
43800
44110
|
}
|
|
@@ -52997,7 +53307,8 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
|
|
|
52997
53307
|
isBuild: true,
|
|
52998
53308
|
isProduction,
|
|
52999
53309
|
isRequire: true,
|
|
53000
|
-
root
|
|
53310
|
+
root,
|
|
53311
|
+
isHookNodeResolve: true
|
|
53001
53312
|
};
|
|
53002
53313
|
// Since dynamic imports can happen in parallel, we need to
|
|
53003
53314
|
// account for multiple pending deps and duplicate imports.
|
|
@@ -59941,16 +60252,12 @@ function htmlFallbackMiddleware(root, spaFallback) {
|
|
|
59941
60252
|
rewrites: [
|
|
59942
60253
|
{
|
|
59943
60254
|
from: /\/$/,
|
|
59944
|
-
to({ parsedUrl }) {
|
|
60255
|
+
to({ parsedUrl, request }) {
|
|
59945
60256
|
const rewritten = decodeURIComponent(parsedUrl.pathname) + 'index.html';
|
|
59946
60257
|
if (fs$l.existsSync(path$o.join(root, rewritten))) {
|
|
59947
60258
|
return rewritten;
|
|
59948
60259
|
}
|
|
59949
|
-
|
|
59950
|
-
if (spaFallback) {
|
|
59951
|
-
return `/index.html`;
|
|
59952
|
-
}
|
|
59953
|
-
}
|
|
60260
|
+
return spaFallback ? `/index.html` : request.url;
|
|
59954
60261
|
}
|
|
59955
60262
|
}
|
|
59956
60263
|
]
|
|
@@ -62340,11 +62647,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
|
|
|
62340
62647
|
configFileDependencies = loadResult.dependencies;
|
|
62341
62648
|
}
|
|
62342
62649
|
}
|
|
62343
|
-
// Define logger
|
|
62344
|
-
const logger = createLogger(config.logLevel, {
|
|
62345
|
-
allowClearScreen: config.clearScreen,
|
|
62346
|
-
customLogger: config.customLogger
|
|
62347
|
-
});
|
|
62348
62650
|
// user config may provide an alternative mode. But --mode has a higher priority
|
|
62349
62651
|
mode = inlineConfig.mode || config.mode || mode;
|
|
62350
62652
|
configEnv.mode = mode;
|
|
@@ -62380,6 +62682,11 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
|
|
|
62380
62682
|
config.build ?? (config.build = {});
|
|
62381
62683
|
config.build.commonjsOptions = { include: [] };
|
|
62382
62684
|
}
|
|
62685
|
+
// Define logger
|
|
62686
|
+
const logger = createLogger(config.logLevel, {
|
|
62687
|
+
allowClearScreen: config.clearScreen,
|
|
62688
|
+
customLogger: config.customLogger
|
|
62689
|
+
});
|
|
62383
62690
|
// resolve root
|
|
62384
62691
|
const resolvedRoot = normalizePath$3(config.root ? path$o.resolve(config.root) : process.cwd());
|
|
62385
62692
|
const clientAlias = [
|
|
@@ -62434,7 +62741,8 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
|
|
|
62434
62741
|
: pkgPath
|
|
62435
62742
|
? path$o.join(path$o.dirname(pkgPath), `node_modules/.vite`)
|
|
62436
62743
|
: path$o.join(resolvedRoot, `.vite`);
|
|
62437
|
-
const assetsFilter = config.assetsInclude
|
|
62744
|
+
const assetsFilter = config.assetsInclude &&
|
|
62745
|
+
(!(config.assetsInclude instanceof Array) || config.assetsInclude.length)
|
|
62438
62746
|
? createFilter(config.assetsInclude)
|
|
62439
62747
|
: () => false;
|
|
62440
62748
|
// create an internal resolver to be used in special scenarios, e.g.
|
package/dist/node/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-
|
|
3
|
+
import { z as picocolors, v as createLogger, g as resolveConfig } from './chunks/dep-5605cfa4.js';
|
|
4
4
|
import { VERSION } from './constants.js';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:path';
|
|
@@ -702,7 +702,7 @@ cli
|
|
|
702
702
|
filterDuplicateOptions(options);
|
|
703
703
|
// output structure is preserved even after bundling so require()
|
|
704
704
|
// is ok here
|
|
705
|
-
const { createServer } = await import('./chunks/dep-
|
|
705
|
+
const { createServer } = await import('./chunks/dep-5605cfa4.js').then(function (n) { return n.D; });
|
|
706
706
|
try {
|
|
707
707
|
const server = await createServer({
|
|
708
708
|
root,
|
|
@@ -750,7 +750,7 @@ cli
|
|
|
750
750
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
751
751
|
.action(async (root, options) => {
|
|
752
752
|
filterDuplicateOptions(options);
|
|
753
|
-
const { build } = await import('./chunks/dep-
|
|
753
|
+
const { build } = await import('./chunks/dep-5605cfa4.js').then(function (n) { return n.C; });
|
|
754
754
|
const buildOptions = cleanOptions(options);
|
|
755
755
|
try {
|
|
756
756
|
await build({
|
|
@@ -775,7 +775,7 @@ cli
|
|
|
775
775
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
776
776
|
.action(async (root, options) => {
|
|
777
777
|
filterDuplicateOptions(options);
|
|
778
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
778
|
+
const { optimizeDeps } = await import('./chunks/dep-5605cfa4.js').then(function (n) { return n.B; });
|
|
779
779
|
try {
|
|
780
780
|
const config = await resolveConfig({
|
|
781
781
|
root,
|
|
@@ -800,7 +800,7 @@ cli
|
|
|
800
800
|
.option('--outDir <dir>', `[string] output directory (default: dist)`)
|
|
801
801
|
.action(async (root, options) => {
|
|
802
802
|
filterDuplicateOptions(options);
|
|
803
|
-
const { preview } = await import('./chunks/dep-
|
|
803
|
+
const { preview } = await import('./chunks/dep-5605cfa4.js').then(function (n) { return n.E; });
|
|
804
804
|
try {
|
|
805
805
|
const server = await preview({
|
|
806
806
|
root,
|
package/dist/node/constants.js
CHANGED
package/dist/node/index.d.ts
CHANGED
|
@@ -1151,6 +1151,7 @@ export declare interface InternalResolveOptions extends Required<ResolveOptions>
|
|
|
1151
1151
|
ssrOptimizeCheck?: boolean;
|
|
1152
1152
|
getDepsOptimizer?: (ssr: boolean) => DepsOptimizer | undefined;
|
|
1153
1153
|
shouldExternalize?: (id: string) => boolean | undefined;
|
|
1154
|
+
isHookNodeResolve?: boolean;
|
|
1154
1155
|
}
|
|
1155
1156
|
|
|
1156
1157
|
export { InvalidatePayload }
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build, q as createFilter, v as createLogger, c as createServer, e as defineConfig, f as formatPostcssSourceMap, i as getDepOptimizationConfig, j as isDepsOptimizerEnabled, l as loadConfigFromFile, x as loadEnv, k as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, h as resolveBaseUrl, g as resolveConfig, y as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-
|
|
1
|
+
export { b as build, q as createFilter, v as createLogger, c as createServer, e as defineConfig, f as formatPostcssSourceMap, i as getDepOptimizationConfig, j as isDepsOptimizerEnabled, l as loadConfigFromFile, x as loadEnv, k as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, h as resolveBaseUrl, g as resolveConfig, y as resolveEnvPrefix, d as resolvePackageData, r as resolvePackageEntry, w as searchForWorkspaceRoot, u as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-5605cfa4.js';
|
|
2
2
|
export { VERSION as version } from './constants.js';
|
|
3
3
|
export { version as esbuildVersion } from 'esbuild';
|
|
4
4
|
export { VERSION as rollupVersion } from 'rollup';
|
|
@@ -31,7 +31,7 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
|
|
31
31
|
var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
|
|
32
32
|
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
33
33
|
|
|
34
|
-
var version = "3.2.
|
|
34
|
+
var version = "3.2.5";
|
|
35
35
|
|
|
36
36
|
const VERSION = version;
|
|
37
37
|
const VITE_PACKAGE_DIR = path$3.resolve(
|
package/index.cjs
CHANGED