vite 2.7.9 → 2.7.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vite might be problematic. Click here for more details.
- package/CHANGELOG.md +45 -0
- package/dist/node/chunks/{dep-0cbbc772.js → dep-4e5ae969.js} +2 -2
- package/dist/node/chunks/{dep-0cbbc772.js.map → dep-4e5ae969.js.map} +1 -1
- package/dist/node/chunks/{dep-37807119.js → dep-61b103b4.js} +2 -2
- package/dist/node/chunks/{dep-37807119.js.map → dep-61b103b4.js.map} +1 -1
- package/dist/node/chunks/{dep-6e9ef787.js → dep-9fc73d70.js} +2 -2
- package/dist/node/chunks/{dep-6e9ef787.js.map → dep-9fc73d70.js.map} +1 -1
- package/dist/node/chunks/{dep-4b9dfa16.js → dep-f5552faa.js} +109 -77
- package/dist/node/chunks/{dep-4b9dfa16.js.map → dep-f5552faa.js.map} +1 -1
- package/dist/node/cli.js +4 -4
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.js +1 -1
- package/dist/node/server/index.d.ts +7 -0
- package/package.json +1 -1
|
@@ -20397,7 +20397,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
20397
20397
|
replacer: urlReplacer
|
|
20398
20398
|
}));
|
|
20399
20399
|
if (isModule) {
|
|
20400
|
-
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-
|
|
20400
|
+
postcssPlugins.unshift((await Promise.resolve().then(function () { return require('./dep-61b103b4.js'); }).then(function (n) { return n.index; })).default({
|
|
20401
20401
|
...modulesOptions,
|
|
20402
20402
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
20403
20403
|
modules = _modules;
|
|
@@ -21402,7 +21402,7 @@ const assetAttrsConfig = {
|
|
|
21402
21402
|
const isAsyncScriptMap = new WeakMap();
|
|
21403
21403
|
async function traverseHtml(html, filePath, visitor) {
|
|
21404
21404
|
// lazy load compiler
|
|
21405
|
-
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-
|
|
21405
|
+
const { parse, transform } = await Promise.resolve().then(function () { return require('./dep-4e5ae969.js'); }).then(function (n) { return n.compilerDom_cjs; });
|
|
21406
21406
|
// @vue/compiler-core doesn't like lowercase doctypes
|
|
21407
21407
|
html = html.replace(/<!doctype\s/i, '<!DOCTYPE ');
|
|
21408
21408
|
try {
|
|
@@ -43719,7 +43719,7 @@ function readFileIfExists(value) {
|
|
|
43719
43719
|
* https://github.com/webpack/webpack-dev-server/blob/master/LICENSE
|
|
43720
43720
|
*/
|
|
43721
43721
|
async function createCertificate() {
|
|
43722
|
-
const { generate } = await Promise.resolve().then(function () { return require('./dep-
|
|
43722
|
+
const { generate } = await Promise.resolve().then(function () { return require('./dep-9fc73d70.js'); }).then(function (n) { return n.index; });
|
|
43723
43723
|
const pems = generate(null, {
|
|
43724
43724
|
algorithm: 'sha256',
|
|
43725
43725
|
days: 30,
|
|
@@ -50943,6 +50943,37 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
|
|
|
50943
50943
|
function isInScope(name, parents) {
|
|
50944
50944
|
return parents.some((node) => { var _a; return node && ((_a = scopeMap.get(node)) === null || _a === void 0 ? void 0 : _a.has(name)); });
|
|
50945
50945
|
}
|
|
50946
|
+
function handlePattern(p, parentFunction) {
|
|
50947
|
+
if (p.type === 'Identifier') {
|
|
50948
|
+
setScope(parentFunction, p.name);
|
|
50949
|
+
}
|
|
50950
|
+
else if (p.type === 'RestElement') {
|
|
50951
|
+
handlePattern(p.argument, parentFunction);
|
|
50952
|
+
}
|
|
50953
|
+
else if (p.type === 'ObjectPattern') {
|
|
50954
|
+
p.properties.forEach((property) => {
|
|
50955
|
+
if (property.type === 'RestElement') {
|
|
50956
|
+
setScope(parentFunction, property.argument.name);
|
|
50957
|
+
}
|
|
50958
|
+
else {
|
|
50959
|
+
handlePattern(property.value, parentFunction);
|
|
50960
|
+
}
|
|
50961
|
+
});
|
|
50962
|
+
}
|
|
50963
|
+
else if (p.type === 'ArrayPattern') {
|
|
50964
|
+
p.elements.forEach((element) => {
|
|
50965
|
+
if (element) {
|
|
50966
|
+
handlePattern(element, parentFunction);
|
|
50967
|
+
}
|
|
50968
|
+
});
|
|
50969
|
+
}
|
|
50970
|
+
else if (p.type === 'AssignmentPattern') {
|
|
50971
|
+
handlePattern(p.left, parentFunction);
|
|
50972
|
+
}
|
|
50973
|
+
else {
|
|
50974
|
+
setScope(parentFunction, p.name);
|
|
50975
|
+
}
|
|
50976
|
+
}
|
|
50946
50977
|
walk$1(root, {
|
|
50947
50978
|
enter(node, parent) {
|
|
50948
50979
|
if (node.type === 'ImportDeclaration') {
|
|
@@ -50973,25 +51004,34 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
|
|
|
50973
51004
|
}
|
|
50974
51005
|
// walk function expressions and add its arguments to known identifiers
|
|
50975
51006
|
// so that we don't prefix them
|
|
50976
|
-
node.params.forEach((p) =>
|
|
50977
|
-
|
|
50978
|
-
|
|
50979
|
-
|
|
50980
|
-
|
|
50981
|
-
|
|
50982
|
-
|
|
50983
|
-
|
|
50984
|
-
|
|
50985
|
-
|
|
50986
|
-
|
|
50987
|
-
|
|
51007
|
+
node.params.forEach((p) => {
|
|
51008
|
+
if (p.type === 'ObjectPattern' || p.type === 'ArrayPattern') {
|
|
51009
|
+
handlePattern(p, node);
|
|
51010
|
+
return;
|
|
51011
|
+
}
|
|
51012
|
+
walk$1(p.type === 'AssignmentPattern' ? p.left : p, {
|
|
51013
|
+
enter(child, parent) {
|
|
51014
|
+
// skip params default value of destructure
|
|
51015
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.type) === 'AssignmentPattern' &&
|
|
51016
|
+
(parent === null || parent === void 0 ? void 0 : parent.right) === child) {
|
|
51017
|
+
return this.skip();
|
|
51018
|
+
}
|
|
51019
|
+
if (child.type !== 'Identifier')
|
|
51020
|
+
return;
|
|
51021
|
+
// do not record as scope variable if is a destructuring keyword
|
|
51022
|
+
if (isStaticPropertyKey(child, parent))
|
|
51023
|
+
return;
|
|
51024
|
+
// do not record if this is a default value
|
|
51025
|
+
// assignment of a destructuring variable
|
|
51026
|
+
if (((parent === null || parent === void 0 ? void 0 : parent.type) === 'TemplateLiteral' &&
|
|
50988
51027
|
(parent === null || parent === void 0 ? void 0 : parent.expressions.includes(child))) ||
|
|
50989
|
-
|
|
50990
|
-
|
|
51028
|
+
((parent === null || parent === void 0 ? void 0 : parent.type) === 'CallExpression' && (parent === null || parent === void 0 ? void 0 : parent.callee) === child)) {
|
|
51029
|
+
return;
|
|
51030
|
+
}
|
|
51031
|
+
setScope(node, child.name);
|
|
50991
51032
|
}
|
|
50992
|
-
|
|
50993
|
-
|
|
50994
|
-
}));
|
|
51033
|
+
});
|
|
51034
|
+
});
|
|
50995
51035
|
}
|
|
50996
51036
|
else if (node.type === 'Property' && parent.type === 'ObjectPattern') {
|
|
50997
51037
|
node.inPattern = true;
|
|
@@ -50999,36 +51039,7 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport }) {
|
|
|
50999
51039
|
else if (node.type === 'VariableDeclarator') {
|
|
51000
51040
|
const parentFunction = findParentFunction(parentStack);
|
|
51001
51041
|
if (parentFunction) {
|
|
51002
|
-
|
|
51003
|
-
if (p.type === 'Identifier') {
|
|
51004
|
-
setScope(parentFunction, p.name);
|
|
51005
|
-
}
|
|
51006
|
-
else if (p.type === 'RestElement') {
|
|
51007
|
-
handlePattern(p.argument);
|
|
51008
|
-
}
|
|
51009
|
-
else if (p.type === 'ObjectPattern') {
|
|
51010
|
-
p.properties.forEach((property) => {
|
|
51011
|
-
if (property.type === 'RestElement') {
|
|
51012
|
-
setScope(parentFunction, property.argument.name);
|
|
51013
|
-
}
|
|
51014
|
-
else
|
|
51015
|
-
handlePattern(property.value);
|
|
51016
|
-
});
|
|
51017
|
-
}
|
|
51018
|
-
else if (p.type === 'ArrayPattern') {
|
|
51019
|
-
p.elements.forEach((element) => {
|
|
51020
|
-
if (element)
|
|
51021
|
-
handlePattern(element);
|
|
51022
|
-
});
|
|
51023
|
-
}
|
|
51024
|
-
else if (p.type === 'AssignmentPattern') {
|
|
51025
|
-
handlePattern(p.left);
|
|
51026
|
-
}
|
|
51027
|
-
else {
|
|
51028
|
-
setScope(parentFunction, p.name);
|
|
51029
|
-
}
|
|
51030
|
-
};
|
|
51031
|
-
handlePattern(node.id);
|
|
51042
|
+
handlePattern(node.id, parentFunction);
|
|
51032
51043
|
}
|
|
51033
51044
|
}
|
|
51034
51045
|
},
|
|
@@ -59940,7 +59951,8 @@ function ssrRequireHookPlugin(config) {
|
|
|
59940
59951
|
return {
|
|
59941
59952
|
code: s.toString(),
|
|
59942
59953
|
map: s.generateMap({
|
|
59943
|
-
source: id
|
|
59954
|
+
source: id,
|
|
59955
|
+
hires: true
|
|
59944
59956
|
})
|
|
59945
59957
|
};
|
|
59946
59958
|
}
|
|
@@ -60125,7 +60137,13 @@ async function nodeImport(id, importer, resolveOptions) {
|
|
|
60125
60137
|
return nodeResolve(id, parent, isMain, options);
|
|
60126
60138
|
}
|
|
60127
60139
|
if (parent) {
|
|
60128
|
-
|
|
60140
|
+
let resolved = viteResolve(id, parent.id);
|
|
60141
|
+
if (resolved) {
|
|
60142
|
+
// hookNodeResolve must use platform-specific path.normalize
|
|
60143
|
+
// to be compatible with dynamicImport (#6080)
|
|
60144
|
+
resolved = path__default.normalize(resolved);
|
|
60145
|
+
}
|
|
60146
|
+
return resolved;
|
|
60129
60147
|
}
|
|
60130
60148
|
// Importing a CJS module from an ESM module. In this case, the import
|
|
60131
60149
|
// specifier is already an absolute path, so this is a no-op.
|
|
@@ -60638,7 +60656,10 @@ function resolvedAllowDir(root, dir) {
|
|
|
60638
60656
|
}
|
|
60639
60657
|
function resolveServerOptions(root, raw) {
|
|
60640
60658
|
var _a, _b, _c, _d;
|
|
60641
|
-
const server =
|
|
60659
|
+
const server = {
|
|
60660
|
+
preTransformRequests: true,
|
|
60661
|
+
...raw
|
|
60662
|
+
};
|
|
60642
60663
|
let allowDirs = (_a = server.fs) === null || _a === void 0 ? void 0 : _a.allow;
|
|
60643
60664
|
const deny = ((_b = server.fs) === null || _b === void 0 ? void 0 : _b.deny) || ['.env', '.env.*', '*.{crt,pem}'];
|
|
60644
60665
|
if (!allowDirs) {
|
|
@@ -73940,7 +73961,7 @@ function importAnalysisPlugin(config) {
|
|
|
73940
73961
|
isDebug &&
|
|
73941
73962
|
debug$1(`${timeFrom(start)} ${source.dim(`[${importedUrls.size} imports rewritten] ${prettyImporter}`)}`);
|
|
73942
73963
|
// pre-transform known direct imports
|
|
73943
|
-
if (staticImportedUrls.size) {
|
|
73964
|
+
if (config.server.preTransformRequests && staticImportedUrls.size) {
|
|
73944
73965
|
staticImportedUrls.forEach((url) => {
|
|
73945
73966
|
transformRequest(unwrapId$1(removeImportQuery(url)), server, { ssr });
|
|
73946
73967
|
});
|
|
@@ -74414,7 +74435,6 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
|
74414
74435
|
ssrConfig: config.ssr,
|
|
74415
74436
|
asSrc: true
|
|
74416
74437
|
}),
|
|
74417
|
-
config.build.ssr ? ssrRequireHookPlugin(config) : null,
|
|
74418
74438
|
htmlInlineScriptProxyPlugin(config),
|
|
74419
74439
|
cssPlugin(config),
|
|
74420
74440
|
config.esbuild !== false ? esbuildPlugin(config.esbuild) : null,
|
|
@@ -74428,6 +74448,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
|
74428
74448
|
...normalPlugins,
|
|
74429
74449
|
definePlugin(config),
|
|
74430
74450
|
cssPostPlugin(config),
|
|
74451
|
+
config.build.ssr ? ssrRequireHookPlugin(config) : null,
|
|
74431
74452
|
...buildPlugins.pre,
|
|
74432
74453
|
...postPlugins,
|
|
74433
74454
|
...buildPlugins.post,
|
|
@@ -74680,10 +74701,10 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
|
|
|
74680
74701
|
{ find: /^[\/]?@vite\/client/, replacement: () => CLIENT_ENTRY }
|
|
74681
74702
|
];
|
|
74682
74703
|
// resolve alias with internal client alias
|
|
74683
|
-
const resolvedAlias = mergeAlias(
|
|
74704
|
+
const resolvedAlias = normalizeAlias(mergeAlias(
|
|
74684
74705
|
// @ts-ignore because @rollup/plugin-alias' type doesn't allow function
|
|
74685
74706
|
// replacement, but its implementation does work with function values.
|
|
74686
|
-
clientAlias, ((_a = config.resolve) === null || _a === void 0 ? void 0 : _a.alias) || config.alias || []);
|
|
74707
|
+
clientAlias, ((_a = config.resolve) === null || _a === void 0 ? void 0 : _a.alias) || config.alias || []));
|
|
74687
74708
|
const resolveOptions = {
|
|
74688
74709
|
dedupe: config.dedupe,
|
|
74689
74710
|
...config.resolve,
|
|
@@ -74917,28 +74938,30 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
|
74917
74938
|
continue;
|
|
74918
74939
|
}
|
|
74919
74940
|
const existing = merged[key];
|
|
74920
|
-
if (
|
|
74921
|
-
merged[key] =
|
|
74941
|
+
if (existing == null) {
|
|
74942
|
+
merged[key] = value;
|
|
74943
|
+
continue;
|
|
74944
|
+
}
|
|
74945
|
+
// fields that require special handling
|
|
74946
|
+
if (key === 'alias' && (rootPath === 'resolve' || rootPath === '')) {
|
|
74947
|
+
merged[key] = mergeAlias(existing, value);
|
|
74948
|
+
continue;
|
|
74949
|
+
}
|
|
74950
|
+
else if (key === 'assetsInclude' && rootPath === '') {
|
|
74951
|
+
merged[key] = [].concat(existing, value);
|
|
74952
|
+
continue;
|
|
74953
|
+
}
|
|
74954
|
+
else if (key === 'noExternal' && existing === true) {
|
|
74955
|
+
continue;
|
|
74956
|
+
}
|
|
74957
|
+
if (Array.isArray(existing) || Array.isArray(value)) {
|
|
74958
|
+
merged[key] = [...arraify(existing !== null && existing !== void 0 ? existing : []), ...arraify(value !== null && value !== void 0 ? value : [])];
|
|
74922
74959
|
continue;
|
|
74923
74960
|
}
|
|
74924
74961
|
if (isObject$3(existing) && isObject$3(value)) {
|
|
74925
74962
|
merged[key] = mergeConfigRecursively(existing, value, rootPath ? `${rootPath}.${key}` : key);
|
|
74926
74963
|
continue;
|
|
74927
74964
|
}
|
|
74928
|
-
// fields that require special handling
|
|
74929
|
-
if (existing != null) {
|
|
74930
|
-
if (key === 'alias' && (rootPath === 'resolve' || rootPath === '')) {
|
|
74931
|
-
merged[key] = mergeAlias(existing, value);
|
|
74932
|
-
continue;
|
|
74933
|
-
}
|
|
74934
|
-
else if (key === 'assetsInclude' && rootPath === '') {
|
|
74935
|
-
merged[key] = [].concat(existing, value);
|
|
74936
|
-
continue;
|
|
74937
|
-
}
|
|
74938
|
-
else if (key === 'noExternal' && existing === true) {
|
|
74939
|
-
continue;
|
|
74940
|
-
}
|
|
74941
|
-
}
|
|
74942
74965
|
merged[key] = value;
|
|
74943
74966
|
}
|
|
74944
74967
|
return merged;
|
|
@@ -74946,10 +74969,19 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
|
|
|
74946
74969
|
function mergeConfig(defaults, overrides, isRoot = true) {
|
|
74947
74970
|
return mergeConfigRecursively(defaults, overrides, isRoot ? '' : '.');
|
|
74948
74971
|
}
|
|
74949
|
-
function mergeAlias(a
|
|
74950
|
-
|
|
74972
|
+
function mergeAlias(a, b) {
|
|
74973
|
+
if (!a)
|
|
74974
|
+
return b;
|
|
74975
|
+
if (!b)
|
|
74976
|
+
return a;
|
|
74977
|
+
if (isObject$3(a) && isObject$3(b)) {
|
|
74978
|
+
return { ...a, ...b };
|
|
74979
|
+
}
|
|
74980
|
+
// the order is flipped because the alias is resolved from top-down,
|
|
74981
|
+
// where the later should have higher priority
|
|
74982
|
+
return [...normalizeAlias(b), ...normalizeAlias(a)];
|
|
74951
74983
|
}
|
|
74952
|
-
function normalizeAlias(o) {
|
|
74984
|
+
function normalizeAlias(o = []) {
|
|
74953
74985
|
return Array.isArray(o)
|
|
74954
74986
|
? o.map(normalizeSingleAlias)
|
|
74955
74987
|
: Object.keys(o).map((find) => normalizeSingleAlias({
|
|
@@ -75230,4 +75262,4 @@ exports.send = send$1;
|
|
|
75230
75262
|
exports.sortUserPlugins = sortUserPlugins;
|
|
75231
75263
|
exports.source = source;
|
|
75232
75264
|
exports.transformWithEsbuild = transformWithEsbuild;
|
|
75233
|
-
//# sourceMappingURL=dep-
|
|
75265
|
+
//# sourceMappingURL=dep-f5552faa.js.map
|