vite 2.6.0-beta.0 → 2.6.0-beta.4
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 +66 -0
- package/LICENSE.md +161 -3011
- package/bin/vite.js +2 -1
- package/dist/node/chunks/{dep-91aa74e8.js → dep-1e0a75a8.js} +58 -32
- package/dist/node/chunks/dep-1e0a75a8.js.map +1 -0
- package/dist/node/chunks/{dep-e36486f6.js → dep-ac1b4bf9.js} +1 -1
- package/dist/node/chunks/dep-ac1b4bf9.js.map +1 -0
- package/dist/node/chunks/{dep-c7e510f9.js → dep-ba6b30a0.js} +27538 -4953
- package/dist/node/chunks/dep-ba6b30a0.js.map +1 -0
- package/dist/node/chunks/{dep-11213a75.js → dep-c4cf6e92.js} +19 -6
- package/dist/node/chunks/dep-c4cf6e92.js.map +1 -0
- package/dist/node/chunks/{dep-eb6ef720.js → dep-d574094c.js} +18 -5
- package/dist/node/chunks/dep-d574094c.js.map +1 -0
- package/dist/node/chunks/{dep-0d2f9464.js → dep-e39b05d6.js} +18 -5
- package/dist/node/chunks/dep-e39b05d6.js.map +1 -0
- package/dist/node/cli.js +60 -23992
- package/dist/node/cli.js.map +1 -1
- package/dist/node/index.d.ts +26 -8
- package/dist/node/index.js +18 -15
- package/dist/node/index.js.map +1 -1
- package/dist/node/terser.js +102 -55
- package/package.json +28 -13
- package/types/package.json +3 -0
- package/api-extractor.json +0 -54
- package/dist/node/chunks/dep-0d2f9464.js.map +0 -1
- package/dist/node/chunks/dep-11213a75.js.map +0 -1
- package/dist/node/chunks/dep-91aa74e8.js.map +0 -1
- package/dist/node/chunks/dep-c7e510f9.js.map +0 -1
- package/dist/node/chunks/dep-e36486f6.js.map +0 -1
- package/dist/node/chunks/dep-eb6ef720.js.map +0 -1
- package/dist/node/terser.js.map +0 -1
- package/rollup.config.js +0 -389
- package/scripts/patchTypes.js +0 -70
- package/src/node/__tests__/asset.spec.ts +0 -156
- package/src/node/__tests__/build.spec.ts +0 -67
- package/src/node/__tests__/config.spec.ts +0 -166
- package/src/node/__tests__/packages/name/package.json +0 -3
- package/src/node/__tests__/packages/noname/package.json +0 -1
- package/src/node/__tests__/plugins/css.spec.ts +0 -116
- package/src/node/__tests__/scan.spec.ts +0 -118
- package/src/node/__tests__/utils.spec.ts +0 -40
- package/src/node/build.ts +0 -783
- package/src/node/cli.ts +0 -239
- package/src/node/config.ts +0 -1033
- package/src/node/constants.ts +0 -87
- package/src/node/importGlob.ts +0 -173
- package/src/node/index.ts +0 -88
- package/src/node/logger.ts +0 -167
- package/src/node/optimizer/esbuildDepPlugin.ts +0 -216
- package/src/node/optimizer/index.ts +0 -410
- package/src/node/optimizer/registerMissing.ts +0 -102
- package/src/node/optimizer/scan.ts +0 -457
- package/src/node/plugin.ts +0 -138
- package/src/node/plugins/asset.ts +0 -365
- package/src/node/plugins/assetImportMetaUrl.ts +0 -99
- package/src/node/plugins/clientInjections.ts +0 -72
- package/src/node/plugins/css.ts +0 -1279
- package/src/node/plugins/dataUri.ts +0 -64
- package/src/node/plugins/define.ts +0 -107
- package/src/node/plugins/esbuild.ts +0 -280
- package/src/node/plugins/html.ts +0 -673
- package/src/node/plugins/importAnalysis.ts +0 -614
- package/src/node/plugins/importAnalysisBuild.ts +0 -334
- package/src/node/plugins/index.ts +0 -69
- package/src/node/plugins/json.ts +0 -75
- package/src/node/plugins/loadFallback.ts +0 -19
- package/src/node/plugins/manifest.ts +0 -123
- package/src/node/plugins/modulePreloadPolyfill.ts +0 -100
- package/src/node/plugins/preAlias.ts +0 -22
- package/src/node/plugins/reporter.ts +0 -244
- package/src/node/plugins/resolve.ts +0 -925
- package/src/node/plugins/terser.ts +0 -40
- package/src/node/plugins/wasm.ts +0 -72
- package/src/node/plugins/worker.ts +0 -117
- package/src/node/preview.ts +0 -82
- package/src/node/server/__tests__/fixtures/none/nested/package.json +0 -3
- package/src/node/server/__tests__/fixtures/pnpm/nested/package.json +0 -3
- package/src/node/server/__tests__/fixtures/pnpm/package.json +0 -3
- package/src/node/server/__tests__/fixtures/pnpm/pnpm-workspace.yaml +0 -0
- package/src/node/server/__tests__/fixtures/yarn/nested/package.json +0 -3
- package/src/node/server/__tests__/fixtures/yarn/package.json +0 -6
- package/src/node/server/__tests__/search-root.spec.ts +0 -31
- package/src/node/server/hmr.ts +0 -489
- package/src/node/server/http.ts +0 -198
- package/src/node/server/index.ts +0 -705
- package/src/node/server/middlewares/base.ts +0 -52
- package/src/node/server/middlewares/error.ts +0 -98
- package/src/node/server/middlewares/indexHtml.ts +0 -170
- package/src/node/server/middlewares/proxy.ts +0 -124
- package/src/node/server/middlewares/spaFallback.ts +0 -32
- package/src/node/server/middlewares/static.ts +0 -153
- package/src/node/server/middlewares/time.ts +0 -18
- package/src/node/server/middlewares/transform.ts +0 -196
- package/src/node/server/moduleGraph.ts +0 -200
- package/src/node/server/openBrowser.ts +0 -101
- package/src/node/server/pluginContainer.ts +0 -546
- package/src/node/server/searchRoot.ts +0 -70
- package/src/node/server/send.ts +0 -54
- package/src/node/server/sourcemap.ts +0 -54
- package/src/node/server/transformRequest.ts +0 -168
- package/src/node/server/ws.ts +0 -131
- package/src/node/ssr/__tests__/ssrTransform.spec.ts +0 -309
- package/src/node/ssr/ssrExternal.ts +0 -161
- package/src/node/ssr/ssrManifestPlugin.ts +0 -53
- package/src/node/ssr/ssrModuleLoader.ts +0 -214
- package/src/node/ssr/ssrStacktrace.ts +0 -75
- package/src/node/ssr/ssrTransform.ts +0 -452
- package/src/node/tsconfig.json +0 -14
- package/src/node/utils.ts +0 -565
- package/tsconfig.base.json +0 -11
package/bin/vite.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
const { performance } = require('perf_hooks')
|
|
2
3
|
|
|
3
4
|
if (!__dirname.includes('node_modules')) {
|
|
4
5
|
try {
|
|
@@ -7,7 +8,7 @@ if (!__dirname.includes('node_modules')) {
|
|
|
7
8
|
} catch (e) {}
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
global.__vite_start_time =
|
|
11
|
+
global.__vite_start_time = performance.now()
|
|
11
12
|
|
|
12
13
|
// check debug mode first before requiring the CLI.
|
|
13
14
|
const debugIndex = process.argv.findIndex((arg) => /^(?:-d|--debug)$/.test(arg))
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var build = require('./dep-
|
|
3
|
+
var build = require('./dep-ba6b30a0.js');
|
|
4
|
+
|
|
5
|
+
function _mergeNamespaces(n, m) {
|
|
6
|
+
for (var i = 0; i < m.length; i++) {
|
|
7
|
+
var e = m[i];
|
|
8
|
+
for (var k in e) {
|
|
9
|
+
if (k !== 'default' && !(k in n)) {
|
|
10
|
+
n[k] = e[k];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return n;
|
|
15
|
+
}
|
|
4
16
|
|
|
5
17
|
var compilerDom_cjs$2 = {};
|
|
6
18
|
|
|
@@ -698,7 +710,7 @@ const errorMessages = {
|
|
|
698
710
|
// transform errors
|
|
699
711
|
[28 /* X_V_IF_NO_EXPRESSION */]: `v-if/v-else-if is missing expression.`,
|
|
700
712
|
[29 /* X_V_IF_SAME_KEY */]: `v-if/else branches must use unique keys.`,
|
|
701
|
-
[30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if.`,
|
|
713
|
+
[30 /* X_V_ELSE_NO_ADJACENT_IF */]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
702
714
|
[31 /* X_V_FOR_NO_EXPRESSION */]: `v-for is missing expression.`,
|
|
703
715
|
[32 /* X_V_FOR_MALFORMED_EXPRESSION */]: `v-for has invalid expression.`,
|
|
704
716
|
[33 /* X_V_FOR_TEMPLATE_KEY_PLACEMENT */]: `<template v-for> key should be placed on the <template> tag.`,
|
|
@@ -722,7 +734,7 @@ const errorMessages = {
|
|
|
722
734
|
[47 /* X_MODULE_MODE_NOT_SUPPORTED */]: `ES module mode is not supported in this build of compiler.`,
|
|
723
735
|
[48 /* X_CACHE_HANDLER_NOT_SUPPORTED */]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
724
736
|
[49 /* X_SCOPE_ID_NOT_SUPPORTED */]: `"scopeId" option is only supported in module mode.`,
|
|
725
|
-
// just to
|
|
737
|
+
// just to fulfill types
|
|
726
738
|
[50 /* __EXTEND_POINT__ */]: ``
|
|
727
739
|
};
|
|
728
740
|
|
|
@@ -1023,7 +1035,7 @@ const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
|
|
|
1023
1035
|
* inside square brackets), but it's ok since these are only used on template
|
|
1024
1036
|
* expressions and false positives are invalid expressions in the first place.
|
|
1025
1037
|
*/
|
|
1026
|
-
const
|
|
1038
|
+
const isMemberExpressionBrowser = (path) => {
|
|
1027
1039
|
// remove whitespaces around . or [ first
|
|
1028
1040
|
path = path.trim().replace(whitespaceRE, s => s.trim());
|
|
1029
1041
|
let state = 0 /* inMemberExp */;
|
|
@@ -1093,6 +1105,10 @@ const isMemberExpression = (path) => {
|
|
|
1093
1105
|
}
|
|
1094
1106
|
return !currentOpenBracketCount && !currentOpenParensCount;
|
|
1095
1107
|
};
|
|
1108
|
+
const isMemberExpressionNode = NOOP
|
|
1109
|
+
;
|
|
1110
|
+
const isMemberExpression = isMemberExpressionBrowser
|
|
1111
|
+
;
|
|
1096
1112
|
function getInnerRange(loc, offset, length) {
|
|
1097
1113
|
const source = loc.source.substr(offset, length);
|
|
1098
1114
|
const newLoc = {
|
|
@@ -2285,7 +2301,7 @@ function walk(node, context, doNotHoistNode = false) {
|
|
|
2285
2301
|
// This is only a concern for pre-stringification (via transformHoist by
|
|
2286
2302
|
// @vue/compiler-dom), but doing it here allows us to perform only one full
|
|
2287
2303
|
// walk of the AST and allow `stringifyStatic` to stop walking as soon as its
|
|
2288
|
-
//
|
|
2304
|
+
// stringification threshold is met.
|
|
2289
2305
|
let canStringify = true;
|
|
2290
2306
|
const { children } = node;
|
|
2291
2307
|
const originalCount = children.length;
|
|
@@ -2532,7 +2548,7 @@ function getGeneratedPropsConstantType(node, context) {
|
|
|
2532
2548
|
else if (value.type === 14 /* JS_CALL_EXPRESSION */) {
|
|
2533
2549
|
// some helper calls can be hoisted,
|
|
2534
2550
|
// such as the `normalizeProps` generated by the compiler for pre-normalize class,
|
|
2535
|
-
// in this case we need to respect the
|
|
2551
|
+
// in this case we need to respect the ConstantType of the helper's argments
|
|
2536
2552
|
valueType = getConstantTypeOfHelperCall(value, context);
|
|
2537
2553
|
}
|
|
2538
2554
|
else {
|
|
@@ -2851,7 +2867,7 @@ function createStructuralDirectiveTransform(name, fn) {
|
|
|
2851
2867
|
}
|
|
2852
2868
|
|
|
2853
2869
|
const PURE_ANNOTATION = `/*#__PURE__*/`;
|
|
2854
|
-
function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssr = false, isTS = false, inSSR = false }) {
|
|
2870
|
+
function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssrRuntimeModuleName = 'vue/server-renderer', ssr = false, isTS = false, inSSR = false }) {
|
|
2855
2871
|
const context = {
|
|
2856
2872
|
mode,
|
|
2857
2873
|
prefixIdentifiers,
|
|
@@ -2861,6 +2877,7 @@ function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode
|
|
|
2861
2877
|
optimizeImports,
|
|
2862
2878
|
runtimeGlobalName,
|
|
2863
2879
|
runtimeModuleName,
|
|
2880
|
+
ssrRuntimeModuleName,
|
|
2864
2881
|
ssr,
|
|
2865
2882
|
isTS,
|
|
2866
2883
|
inSSR,
|
|
@@ -2986,7 +3003,7 @@ function generate(ast, options = {}) {
|
|
|
2986
3003
|
};
|
|
2987
3004
|
}
|
|
2988
3005
|
function genFunctionPreamble(ast, context) {
|
|
2989
|
-
const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName } = context;
|
|
3006
|
+
const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName, ssrRuntimeModuleName } = context;
|
|
2990
3007
|
const VueBinding = runtimeGlobalName;
|
|
2991
3008
|
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
2992
3009
|
// Generate const declaration for helpers
|
|
@@ -3046,13 +3063,14 @@ function genHoists(hoists, context) {
|
|
|
3046
3063
|
context.pure = true;
|
|
3047
3064
|
const { push, newline, helper, scopeId, mode } = context;
|
|
3048
3065
|
newline();
|
|
3049
|
-
hoists.
|
|
3066
|
+
for (let i = 0; i < hoists.length; i++) {
|
|
3067
|
+
const exp = hoists[i];
|
|
3050
3068
|
if (exp) {
|
|
3051
|
-
push(`const _hoisted_${i + 1} = `);
|
|
3069
|
+
push(`const _hoisted_${i + 1} = ${``}`);
|
|
3052
3070
|
genNode(exp, context);
|
|
3053
3071
|
newline();
|
|
3054
3072
|
}
|
|
3055
|
-
}
|
|
3073
|
+
}
|
|
3056
3074
|
context.pure = false;
|
|
3057
3075
|
}
|
|
3058
3076
|
function isText$1(n) {
|
|
@@ -3658,6 +3676,11 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
3658
3676
|
continue;
|
|
3659
3677
|
}
|
|
3660
3678
|
if (sibling && sibling.type === 9 /* IF */) {
|
|
3679
|
+
// Check if v-else was followed by v-else-if
|
|
3680
|
+
if (dir.name === 'else-if' &&
|
|
3681
|
+
sibling.branches[sibling.branches.length - 1].condition === undefined) {
|
|
3682
|
+
context.onError(createCompilerError(30 /* X_V_ELSE_NO_ADJACENT_IF */, node.loc));
|
|
3683
|
+
}
|
|
3661
3684
|
// move the node to the if node's branches
|
|
3662
3685
|
context.removeNode();
|
|
3663
3686
|
const branch = createIfBranch(node, dir);
|
|
@@ -4776,7 +4799,7 @@ function dedupeProperties(properties) {
|
|
|
4776
4799
|
const name = prop.key.content;
|
|
4777
4800
|
const existing = knownProps.get(name);
|
|
4778
4801
|
if (existing) {
|
|
4779
|
-
if (name === 'style' || name === 'class' || name
|
|
4802
|
+
if (name === 'style' || name === 'class' || isOn(name)) {
|
|
4780
4803
|
mergeAsArray(existing, prop);
|
|
4781
4804
|
}
|
|
4782
4805
|
// unexpected duplicate, should have emitted error during parse
|
|
@@ -4870,26 +4893,24 @@ const transformSlotOutlet = (node, context) => {
|
|
|
4870
4893
|
const { slotName, slotProps } = processSlotOutlet(node, context);
|
|
4871
4894
|
const slotArgs = [
|
|
4872
4895
|
context.prefixIdentifiers ? `_ctx.$slots` : `$slots`,
|
|
4873
|
-
slotName
|
|
4896
|
+
slotName,
|
|
4897
|
+
'{}',
|
|
4898
|
+
'undefined',
|
|
4899
|
+
'true'
|
|
4874
4900
|
];
|
|
4901
|
+
let expectedLen = 2;
|
|
4875
4902
|
if (slotProps) {
|
|
4876
|
-
slotArgs
|
|
4903
|
+
slotArgs[2] = slotProps;
|
|
4904
|
+
expectedLen = 3;
|
|
4877
4905
|
}
|
|
4878
4906
|
if (children.length) {
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
}
|
|
4882
|
-
slotArgs.push(createFunctionExpression([], children, false, false, loc));
|
|
4907
|
+
slotArgs[3] = createFunctionExpression([], children, false, false, loc);
|
|
4908
|
+
expectedLen = 4;
|
|
4883
4909
|
}
|
|
4884
4910
|
if (context.scopeId && !context.slotted) {
|
|
4885
|
-
|
|
4886
|
-
slotArgs.push(`{}`);
|
|
4887
|
-
}
|
|
4888
|
-
if (!children.length) {
|
|
4889
|
-
slotArgs.push(`undefined`);
|
|
4890
|
-
}
|
|
4891
|
-
slotArgs.push(`true`);
|
|
4911
|
+
expectedLen = 5;
|
|
4892
4912
|
}
|
|
4913
|
+
slotArgs.splice(expectedLen); // remove unused arguments
|
|
4893
4914
|
node.codegenNode = createCallExpression(context.helper(RENDER_SLOT), slotArgs, loc);
|
|
4894
4915
|
}
|
|
4895
4916
|
};
|
|
@@ -5188,7 +5209,8 @@ const transformModel = (dir, node, context) => {
|
|
|
5188
5209
|
const rawExp = exp.loc.source;
|
|
5189
5210
|
const expString = exp.type === 4 /* SIMPLE_EXPRESSION */ ? exp.content : rawExp;
|
|
5190
5211
|
const maybeRef = !true /* SETUP_CONST */;
|
|
5191
|
-
if (!expString.trim() ||
|
|
5212
|
+
if (!expString.trim() ||
|
|
5213
|
+
(!isMemberExpression(expString) && !maybeRef)) {
|
|
5192
5214
|
context.onError(createCompilerError(42 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
|
|
5193
5215
|
return createTransformProps();
|
|
5194
5216
|
}
|
|
@@ -5202,9 +5224,9 @@ const transformModel = (dir, node, context) => {
|
|
|
5202
5224
|
const eventArg = context.isTS ? `($event: any)` : `$event`;
|
|
5203
5225
|
{
|
|
5204
5226
|
assignmentExp = createCompoundExpression([
|
|
5205
|
-
`${eventArg} => (`,
|
|
5227
|
+
`${eventArg} => ((`,
|
|
5206
5228
|
exp,
|
|
5207
|
-
` = $event)`
|
|
5229
|
+
`) = $event)`
|
|
5208
5230
|
]);
|
|
5209
5231
|
}
|
|
5210
5232
|
const props = [
|
|
@@ -5576,6 +5598,8 @@ var compilerCore_esmBundler = {
|
|
|
5576
5598
|
isFunctionType: isFunctionType,
|
|
5577
5599
|
isInDestructureAssignment: isInDestructureAssignment,
|
|
5578
5600
|
isMemberExpression: isMemberExpression,
|
|
5601
|
+
isMemberExpressionBrowser: isMemberExpressionBrowser,
|
|
5602
|
+
isMemberExpressionNode: isMemberExpressionNode,
|
|
5579
5603
|
isReferencedIdentifier: isReferencedIdentifier,
|
|
5580
5604
|
isSimpleIdentifier: isSimpleIdentifier,
|
|
5581
5605
|
isSlotOutlet: isSlotOutlet,
|
|
@@ -8372,7 +8396,8 @@ const warnTransitionChildren = (node, context) => {
|
|
|
8372
8396
|
};
|
|
8373
8397
|
function hasMultipleChildren(node) {
|
|
8374
8398
|
// #1352 filter out potential comment nodes.
|
|
8375
|
-
const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */
|
|
8399
|
+
const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */ &&
|
|
8400
|
+
!(c.type === 2 /* TEXT */ && !c.content.trim())));
|
|
8376
8401
|
const child = children[0];
|
|
8377
8402
|
return (children.length !== 1 ||
|
|
8378
8403
|
child.type === 11 /* FOR */ ||
|
|
@@ -8700,9 +8725,10 @@ exports.transformStyle = transformStyle;
|
|
|
8700
8725
|
|
|
8701
8726
|
var compilerDom_cjs = /*@__PURE__*/build.getDefaultExportFromCjs(compilerDom_cjs$2);
|
|
8702
8727
|
|
|
8703
|
-
var compilerDom_cjs$1 = /*#__PURE__*/
|
|
8728
|
+
var compilerDom_cjs$1 = /*#__PURE__*/_mergeNamespaces({
|
|
8729
|
+
__proto__: null,
|
|
8704
8730
|
'default': compilerDom_cjs
|
|
8705
|
-
});
|
|
8731
|
+
}, [compilerDom_cjs$2]);
|
|
8706
8732
|
|
|
8707
8733
|
exports.compilerDom_cjs = compilerDom_cjs$1;
|
|
8708
|
-
//# sourceMappingURL=dep-
|
|
8734
|
+
//# sourceMappingURL=dep-1e0a75a8.js.map
|