vite 2.9.12 → 3.0.0-alpha.10
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 +29 -1
- package/bin/vite.js +5 -5
- package/client.d.ts +4 -3
- package/dist/client/client.mjs +28 -30
- package/dist/client/client.mjs.map +1 -1
- package/dist/client/env.mjs.map +1 -1
- package/dist/node/chunks/{dep-8f5c9290.js → dep-134b43f1.js} +50519 -52177
- package/dist/node/chunks/{dep-a9015192.js → dep-17430d09.js} +20 -20
- package/dist/node/chunks/{dep-b27bdd3c.js → dep-5e48add3.js} +28 -30
- package/dist/node/chunks/{dep-ad22985c.js → dep-6f128771.js} +40 -37
- package/dist/node/chunks/{dep-985abbbd.js → dep-8176918d.js} +111 -52
- package/dist/node/chunks/{dep-2056ae8a.js → dep-e8ca8d40.js} +9 -3
- package/dist/node/cli.js +45 -48
- package/dist/node/constants.js +82 -0
- package/dist/node/index.d.ts +308 -174
- package/dist/node/index.js +37 -61
- package/dist/node-cjs/publicUtils.cjs +2040 -0
- package/index.cjs +33 -0
- package/package.json +45 -39
- package/src/client/client.ts +27 -29
- package/src/client/tsconfig.json +1 -1
- package/types/chokidar.d.ts +4 -2
- package/types/hot.d.ts +0 -6
- package/types/importGlob.d.ts +87 -0
- package/types/importMeta.d.ts +5 -15
- package/types/shims.d.ts +5 -8
- package/types/terser.d.ts +0 -2
- package/dist/node/terser.js +0 -32876
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { x as getAugmentedNamespace, y as getDefaultExportFromCjs } from './dep-134b43f1.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { fileURLToPath as __cjs_fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __cjs_dirname } from 'path';
|
|
5
|
+
import { createRequire as __cjs_createRequire } from 'module';
|
|
4
6
|
|
|
7
|
+
const __filename = __cjs_fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = __cjs_dirname(__filename);
|
|
9
|
+
const require = __cjs_createRequire(import.meta.url);
|
|
10
|
+
const __require = require;
|
|
5
11
|
function _mergeNamespaces(n, m) {
|
|
6
12
|
for (var i = 0; i < m.length; i++) {
|
|
7
13
|
var e = m[i];
|
|
@@ -418,6 +424,11 @@ function looseEqual(a, b) {
|
|
|
418
424
|
if (aValidType || bValidType) {
|
|
419
425
|
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
|
420
426
|
}
|
|
427
|
+
aValidType = isSymbol(a);
|
|
428
|
+
bValidType = isSymbol(b);
|
|
429
|
+
if (aValidType || bValidType) {
|
|
430
|
+
return a === b;
|
|
431
|
+
}
|
|
421
432
|
aValidType = isArray(a);
|
|
422
433
|
bValidType = isArray(b);
|
|
423
434
|
if (aValidType || bValidType) {
|
|
@@ -514,7 +525,7 @@ const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
|
514
525
|
const isArray = Array.isArray;
|
|
515
526
|
const isMap = (val) => toTypeString(val) === '[object Map]';
|
|
516
527
|
const isSet = (val) => toTypeString(val) === '[object Set]';
|
|
517
|
-
const isDate = (val) => val
|
|
528
|
+
const isDate = (val) => toTypeString(val) === '[object Date]';
|
|
518
529
|
const isFunction = (val) => typeof val === 'function';
|
|
519
530
|
const isString = (val) => typeof val === 'string';
|
|
520
531
|
const isSymbol = (val) => typeof val === 'symbol';
|
|
@@ -598,7 +609,13 @@ const getGlobalThis = () => {
|
|
|
598
609
|
: typeof global !== 'undefined'
|
|
599
610
|
? global
|
|
600
611
|
: {}));
|
|
601
|
-
};
|
|
612
|
+
};
|
|
613
|
+
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
614
|
+
function genPropsAccessExp(name) {
|
|
615
|
+
return identRE.test(name)
|
|
616
|
+
? `__props.${name}`
|
|
617
|
+
: `__props[${JSON.stringify(name)}]`;
|
|
618
|
+
}
|
|
602
619
|
|
|
603
620
|
var shared_esmBundler = {
|
|
604
621
|
__proto__: null,
|
|
@@ -613,6 +630,7 @@ var shared_esmBundler = {
|
|
|
613
630
|
escapeHtml: escapeHtml,
|
|
614
631
|
escapeHtmlComment: escapeHtmlComment,
|
|
615
632
|
extend: extend,
|
|
633
|
+
genPropsAccessExp: genPropsAccessExp,
|
|
616
634
|
generateCodeFrame: generateCodeFrame,
|
|
617
635
|
getGlobalThis: getGlobalThis,
|
|
618
636
|
hasChanged: hasChanged,
|
|
@@ -2446,6 +2464,14 @@ function getConstantType(node, context) {
|
|
|
2446
2464
|
// static then they don't need to be blocks since there will be no
|
|
2447
2465
|
// nested updates.
|
|
2448
2466
|
if (codegenNode.isBlock) {
|
|
2467
|
+
// except set custom directives.
|
|
2468
|
+
for (let i = 0; i < node.props.length; i++) {
|
|
2469
|
+
const p = node.props[i];
|
|
2470
|
+
if (p.type === 7 /* DIRECTIVE */) {
|
|
2471
|
+
constantCache.set(node, 0 /* NOT_CONSTANT */);
|
|
2472
|
+
return 0 /* NOT_CONSTANT */;
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2449
2475
|
context.removeHelper(OPEN_BLOCK);
|
|
2450
2476
|
context.removeHelper(getVNodeBlockHelper(context.inSSR, codegenNode.isComponent));
|
|
2451
2477
|
codegenNode.isBlock = false;
|
|
@@ -2852,6 +2878,7 @@ function createStructuralDirectiveTransform(name, fn) {
|
|
|
2852
2878
|
}
|
|
2853
2879
|
|
|
2854
2880
|
const PURE_ANNOTATION = `/*#__PURE__*/`;
|
|
2881
|
+
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
2855
2882
|
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 }) {
|
|
2856
2883
|
const context = {
|
|
2857
2884
|
mode,
|
|
@@ -2928,9 +2955,7 @@ function generate(ast, options = {}) {
|
|
|
2928
2955
|
// function mode const declarations should be inside with block
|
|
2929
2956
|
// also they should be renamed to avoid collision with user properties
|
|
2930
2957
|
if (hasHelpers) {
|
|
2931
|
-
push(`const { ${ast.helpers
|
|
2932
|
-
.map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
|
|
2933
|
-
.join(', ')} } = _Vue`);
|
|
2958
|
+
push(`const { ${ast.helpers.map(aliasHelper).join(', ')} } = _Vue`);
|
|
2934
2959
|
push(`\n`);
|
|
2935
2960
|
newline();
|
|
2936
2961
|
}
|
|
@@ -2990,7 +3015,6 @@ function generate(ast, options = {}) {
|
|
|
2990
3015
|
function genFunctionPreamble(ast, context) {
|
|
2991
3016
|
const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName, ssrRuntimeModuleName } = context;
|
|
2992
3017
|
const VueBinding = runtimeGlobalName;
|
|
2993
|
-
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
2994
3018
|
// Generate const declaration for helpers
|
|
2995
3019
|
// In prefix mode, we place the const declaration at top so it's done
|
|
2996
3020
|
// only once; But if we not prefixing, we place the declaration inside the
|
|
@@ -3708,14 +3732,14 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
3708
3732
|
}
|
|
3709
3733
|
}
|
|
3710
3734
|
function createIfBranch(node, dir) {
|
|
3735
|
+
const isTemplateIf = node.tagType === 3 /* TEMPLATE */;
|
|
3711
3736
|
return {
|
|
3712
3737
|
type: 10 /* IF_BRANCH */,
|
|
3713
3738
|
loc: node.loc,
|
|
3714
3739
|
condition: dir.name === 'else' ? undefined : dir.exp,
|
|
3715
|
-
children:
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
userKey: findProp(node, `key`)
|
|
3740
|
+
children: isTemplateIf && !findDir(node, 'for') ? node.children : [node],
|
|
3741
|
+
userKey: findProp(node, `key`),
|
|
3742
|
+
isTemplateIf
|
|
3719
3743
|
};
|
|
3720
3744
|
}
|
|
3721
3745
|
function createCodegenNodeForBranch(branch, keyIndex, context) {
|
|
@@ -3751,6 +3775,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
3751
3775
|
// check if the fragment actually contains a single valid child with
|
|
3752
3776
|
// the rest being comments
|
|
3753
3777
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
3778
|
+
!branch.isTemplateIf &&
|
|
3754
3779
|
children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
|
|
3755
3780
|
patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
|
|
3756
3781
|
patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
|
|
@@ -4327,7 +4352,7 @@ const transformElement = (node, context) => {
|
|
|
4327
4352
|
(tag === 'svg' || tag === 'foreignObject'));
|
|
4328
4353
|
// props
|
|
4329
4354
|
if (props.length > 0) {
|
|
4330
|
-
const propsBuildResult = buildProps(node, context);
|
|
4355
|
+
const propsBuildResult = buildProps(node, context, undefined, isComponent, isDynamicComponent);
|
|
4331
4356
|
vnodeProps = propsBuildResult.props;
|
|
4332
4357
|
patchFlag = propsBuildResult.patchFlag;
|
|
4333
4358
|
dynamicPropNames = propsBuildResult.dynamicPropNames;
|
|
@@ -4469,9 +4494,8 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
4469
4494
|
context.components.add(tag);
|
|
4470
4495
|
return toValidAssetId(tag, `component`);
|
|
4471
4496
|
}
|
|
4472
|
-
function buildProps(node, context, props = node.props, ssr = false) {
|
|
4497
|
+
function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
|
|
4473
4498
|
const { tag, loc: elementLoc, children } = node;
|
|
4474
|
-
const isComponent = node.tagType === 1 /* COMPONENT */;
|
|
4475
4499
|
let properties = [];
|
|
4476
4500
|
const mergeArgs = [];
|
|
4477
4501
|
const runtimeDirectives = [];
|
|
@@ -4490,8 +4514,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4490
4514
|
if (isStaticExp(key)) {
|
|
4491
4515
|
const name = key.content;
|
|
4492
4516
|
const isEventHandler = isOn(name);
|
|
4493
|
-
if (
|
|
4494
|
-
|
|
4517
|
+
if (isEventHandler &&
|
|
4518
|
+
(!isComponent || isDynamicComponent) &&
|
|
4495
4519
|
// omit the flag for click handlers because hydration gives click
|
|
4496
4520
|
// dedicated fast path.
|
|
4497
4521
|
name.toLowerCase() !== 'onclick' &&
|
|
@@ -4746,10 +4770,11 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4746
4770
|
classProp.value = createCallExpression(context.helper(NORMALIZE_CLASS), [classProp.value]);
|
|
4747
4771
|
}
|
|
4748
4772
|
if (styleProp &&
|
|
4749
|
-
!isStaticExp(styleProp.value) &&
|
|
4750
4773
|
// the static style is compiled into an object,
|
|
4751
4774
|
// so use `hasStyleBinding` to ensure that it is a dynamic style binding
|
|
4752
4775
|
(hasStyleBinding ||
|
|
4776
|
+
(styleProp.value.type === 4 /* SIMPLE_EXPRESSION */ &&
|
|
4777
|
+
styleProp.value.content.trim()[0] === `[`) ||
|
|
4753
4778
|
// v-bind:style and style both exist,
|
|
4754
4779
|
// v-bind:style with static literal object
|
|
4755
4780
|
styleProp.value.type === 17 /* JS_ARRAY_EXPRESSION */)) {
|
|
@@ -4947,7 +4972,7 @@ function processSlotOutlet(node, context) {
|
|
|
4947
4972
|
}
|
|
4948
4973
|
}
|
|
4949
4974
|
if (nonNameProps.length > 0) {
|
|
4950
|
-
const { props, directives } = buildProps(node, context, nonNameProps);
|
|
4975
|
+
const { props, directives } = buildProps(node, context, nonNameProps, false, false);
|
|
4951
4976
|
slotProps = props;
|
|
4952
4977
|
if (directives.length) {
|
|
4953
4978
|
context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
|
|
@@ -5118,11 +5143,7 @@ const transformText = (node, context) => {
|
|
|
5118
5143
|
const next = children[j];
|
|
5119
5144
|
if (isText(next)) {
|
|
5120
5145
|
if (!currentContainer) {
|
|
5121
|
-
currentContainer = children[i] =
|
|
5122
|
-
type: 8 /* COMPOUND_EXPRESSION */,
|
|
5123
|
-
loc: child.loc,
|
|
5124
|
-
children: [child]
|
|
5125
|
-
};
|
|
5146
|
+
currentContainer = children[i] = createCompoundExpression([child], child.loc);
|
|
5126
5147
|
}
|
|
5127
5148
|
// merge adjacent text node into current
|
|
5128
5149
|
currentContainer.children.push(` + `, next);
|
|
@@ -5591,6 +5612,7 @@ var compilerCore_esmBundler = {
|
|
|
5591
5612
|
findProp: findProp,
|
|
5592
5613
|
generate: generate,
|
|
5593
5614
|
getBaseTransformPreset: getBaseTransformPreset,
|
|
5615
|
+
getConstantType: getConstantType,
|
|
5594
5616
|
getInnerRange: getInnerRange,
|
|
5595
5617
|
getMemoedVNodeCall: getMemoedVNodeCall,
|
|
5596
5618
|
getVNodeBlockHelper: getVNodeBlockHelper,
|
|
@@ -5642,9 +5664,9 @@ var compilerCore_esmBundler = {
|
|
|
5642
5664
|
generateCodeFrame: generateCodeFrame
|
|
5643
5665
|
};
|
|
5644
5666
|
|
|
5645
|
-
var require$$0 = /*@__PURE__*/
|
|
5667
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(compilerCore_esmBundler);
|
|
5646
5668
|
|
|
5647
|
-
var require$$1 = /*@__PURE__*/
|
|
5669
|
+
var require$$1 = /*@__PURE__*/getAugmentedNamespace(shared_esmBundler);
|
|
5648
5670
|
|
|
5649
5671
|
(function (exports) {
|
|
5650
5672
|
|
|
@@ -8172,7 +8194,9 @@ const transformVText = (dir, node, context) => {
|
|
|
8172
8194
|
return {
|
|
8173
8195
|
props: [
|
|
8174
8196
|
compilerCore.createObjectProperty(compilerCore.createSimpleExpression(`textContent`, true), exp
|
|
8175
|
-
? compilerCore.
|
|
8197
|
+
? compilerCore.getConstantType(exp, context) > 0
|
|
8198
|
+
? exp
|
|
8199
|
+
: compilerCore.createCallExpression(context.helperString(compilerCore.TO_DISPLAY_STRING), [exp], loc)
|
|
8176
8200
|
: compilerCore.createSimpleExpression('', true))
|
|
8177
8201
|
]
|
|
8178
8202
|
};
|
|
@@ -8384,19 +8408,38 @@ const transformShow = (dir, node, context) => {
|
|
|
8384
8408
|
};
|
|
8385
8409
|
};
|
|
8386
8410
|
|
|
8387
|
-
const
|
|
8411
|
+
const transformTransition = (node, context) => {
|
|
8388
8412
|
if (node.type === 1 /* ELEMENT */ &&
|
|
8389
8413
|
node.tagType === 1 /* COMPONENT */) {
|
|
8390
8414
|
const component = context.isBuiltInComponent(node.tag);
|
|
8391
8415
|
if (component === TRANSITION) {
|
|
8392
8416
|
return () => {
|
|
8393
|
-
if (node.children.length
|
|
8417
|
+
if (!node.children.length) {
|
|
8418
|
+
return;
|
|
8419
|
+
}
|
|
8420
|
+
// warn multiple transition children
|
|
8421
|
+
if (hasMultipleChildren(node)) {
|
|
8394
8422
|
context.onError(createDOMCompilerError(59 /* X_TRANSITION_INVALID_CHILDREN */, {
|
|
8395
8423
|
start: node.children[0].loc.start,
|
|
8396
8424
|
end: node.children[node.children.length - 1].loc.end,
|
|
8397
8425
|
source: ''
|
|
8398
8426
|
}));
|
|
8399
8427
|
}
|
|
8428
|
+
// check if it's s single child w/ v-show
|
|
8429
|
+
// if yes, inject "persisted: true" to the transition props
|
|
8430
|
+
const child = node.children[0];
|
|
8431
|
+
if (child.type === 1 /* ELEMENT */) {
|
|
8432
|
+
for (const p of child.props) {
|
|
8433
|
+
if (p.type === 7 /* DIRECTIVE */ && p.name === 'show') {
|
|
8434
|
+
node.props.push({
|
|
8435
|
+
type: 6 /* ATTRIBUTE */,
|
|
8436
|
+
name: 'persisted',
|
|
8437
|
+
value: undefined,
|
|
8438
|
+
loc: node.loc
|
|
8439
|
+
});
|
|
8440
|
+
}
|
|
8441
|
+
}
|
|
8442
|
+
}
|
|
8400
8443
|
};
|
|
8401
8444
|
}
|
|
8402
8445
|
}
|
|
@@ -8612,6 +8655,7 @@ function stringifyNode(node, context) {
|
|
|
8612
8655
|
}
|
|
8613
8656
|
function stringifyElement(node, context) {
|
|
8614
8657
|
let res = `<${node.tag}`;
|
|
8658
|
+
let innerHTML = '';
|
|
8615
8659
|
for (let i = 0; i < node.props.length; i++) {
|
|
8616
8660
|
const p = node.props[i];
|
|
8617
8661
|
if (p.type === 6 /* ATTRIBUTE */) {
|
|
@@ -8620,25 +8664,35 @@ function stringifyElement(node, context) {
|
|
|
8620
8664
|
res += `="${shared.escapeHtml(p.value.content)}"`;
|
|
8621
8665
|
}
|
|
8622
8666
|
}
|
|
8623
|
-
else if (p.type === 7 /* DIRECTIVE */
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
// constant v-bind, e.g. :foo="1"
|
|
8632
|
-
let evaluated = evaluateConstant(exp);
|
|
8633
|
-
if (evaluated != null) {
|
|
8634
|
-
const arg = p.arg && p.arg.content;
|
|
8635
|
-
if (arg === 'class') {
|
|
8636
|
-
evaluated = shared.normalizeClass(evaluated);
|
|
8667
|
+
else if (p.type === 7 /* DIRECTIVE */) {
|
|
8668
|
+
if (p.name === 'bind') {
|
|
8669
|
+
const exp = p.exp;
|
|
8670
|
+
if (exp.content[0] === '_') {
|
|
8671
|
+
// internally generated string constant references
|
|
8672
|
+
// e.g. imported URL strings via compiler-sfc transformAssetUrl plugin
|
|
8673
|
+
res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
|
|
8674
|
+
continue;
|
|
8637
8675
|
}
|
|
8638
|
-
|
|
8639
|
-
|
|
8676
|
+
// constant v-bind, e.g. :foo="1"
|
|
8677
|
+
let evaluated = evaluateConstant(exp);
|
|
8678
|
+
if (evaluated != null) {
|
|
8679
|
+
const arg = p.arg && p.arg.content;
|
|
8680
|
+
if (arg === 'class') {
|
|
8681
|
+
evaluated = shared.normalizeClass(evaluated);
|
|
8682
|
+
}
|
|
8683
|
+
else if (arg === 'style') {
|
|
8684
|
+
evaluated = shared.stringifyStyle(shared.normalizeStyle(evaluated));
|
|
8685
|
+
}
|
|
8686
|
+
res += ` ${p.arg.content}="${shared.escapeHtml(evaluated)}"`;
|
|
8640
8687
|
}
|
|
8641
|
-
|
|
8688
|
+
}
|
|
8689
|
+
else if (p.name === 'html') {
|
|
8690
|
+
// #5439 v-html with constant value
|
|
8691
|
+
// not sure why would anyone do this but it can happen
|
|
8692
|
+
innerHTML = evaluateConstant(p.exp);
|
|
8693
|
+
}
|
|
8694
|
+
else if (p.name === 'text') {
|
|
8695
|
+
innerHTML = shared.escapeHtml(shared.toDisplayString(evaluateConstant(p.exp)));
|
|
8642
8696
|
}
|
|
8643
8697
|
}
|
|
8644
8698
|
}
|
|
@@ -8646,8 +8700,13 @@ function stringifyElement(node, context) {
|
|
|
8646
8700
|
res += ` ${context.scopeId}`;
|
|
8647
8701
|
}
|
|
8648
8702
|
res += `>`;
|
|
8649
|
-
|
|
8650
|
-
res +=
|
|
8703
|
+
if (innerHTML) {
|
|
8704
|
+
res += innerHTML;
|
|
8705
|
+
}
|
|
8706
|
+
else {
|
|
8707
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
8708
|
+
res += stringifyNode(node.children[i], context);
|
|
8709
|
+
}
|
|
8651
8710
|
}
|
|
8652
8711
|
if (!shared.isVoidTag(node.tag)) {
|
|
8653
8712
|
res += `</${node.tag}>`;
|
|
@@ -8660,7 +8719,7 @@ function stringifyElement(node, context) {
|
|
|
8660
8719
|
// here, e.g. `{{ 1 }}` or `{{ 'foo' }}`
|
|
8661
8720
|
// in addition, constant exps bail on presence of parens so you can't even
|
|
8662
8721
|
// run JSFuck in here. But we mark it unsafe for security review purposes.
|
|
8663
|
-
// (see compiler-core/src/
|
|
8722
|
+
// (see compiler-core/src/transforms/transformExpression)
|
|
8664
8723
|
function evaluateConstant(exp) {
|
|
8665
8724
|
if (exp.type === 4 /* SIMPLE_EXPRESSION */) {
|
|
8666
8725
|
return new Function(`return ${exp.content}`)();
|
|
@@ -8697,7 +8756,7 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
8697
8756
|
|
|
8698
8757
|
const DOMNodeTransforms = [
|
|
8699
8758
|
transformStyle,
|
|
8700
|
-
...([
|
|
8759
|
+
...([transformTransition] )
|
|
8701
8760
|
];
|
|
8702
8761
|
const DOMDirectiveTransforms = {
|
|
8703
8762
|
cloak: compilerCore.noopDirectiveTransform,
|
|
@@ -8747,11 +8806,11 @@ exports.parserOptions = parserOptions;
|
|
|
8747
8806
|
exports.transformStyle = transformStyle;
|
|
8748
8807
|
}(compilerDom_cjs$2));
|
|
8749
8808
|
|
|
8750
|
-
var compilerDom_cjs = /*@__PURE__*/
|
|
8809
|
+
var compilerDom_cjs = /*@__PURE__*/getDefaultExportFromCjs(compilerDom_cjs$2);
|
|
8751
8810
|
|
|
8752
8811
|
var compilerDom_cjs$1 = /*#__PURE__*/_mergeNamespaces({
|
|
8753
8812
|
__proto__: null,
|
|
8754
8813
|
'default': compilerDom_cjs
|
|
8755
8814
|
}, [compilerDom_cjs$2]);
|
|
8756
8815
|
|
|
8757
|
-
|
|
8816
|
+
export { compilerDom_cjs$1 as c };
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { fileURLToPath as __cjs_fileURLToPath } from 'url';
|
|
2
|
+
import { dirname as __cjs_dirname } from 'path';
|
|
3
|
+
import { createRequire as __cjs_createRequire } from 'module';
|
|
4
|
+
|
|
5
|
+
const __filename = __cjs_fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __cjs_dirname(__filename);
|
|
7
|
+
const require = __cjs_createRequire(import.meta.url);
|
|
8
|
+
const __require = require;
|
|
3
9
|
var openParentheses = "(".charCodeAt(0);
|
|
4
10
|
var closeParentheses = ")".charCodeAt(0);
|
|
5
11
|
var singleQuote = "'".charCodeAt(0);
|
|
@@ -544,4 +550,4 @@ ValueParser.stringify = stringify;
|
|
|
544
550
|
|
|
545
551
|
var lib = ValueParser;
|
|
546
552
|
|
|
547
|
-
|
|
553
|
+
export { lib as l };
|
package/dist/node/cli.js
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
require('readline');
|
|
1
|
+
import { performance } from 'perf_hooks';
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { v as colors, j as createLogger, e as resolveConfig } from './chunks/dep-134b43f1.js';
|
|
4
|
+
import { VERSION } from './constants.js';
|
|
5
|
+
import 'fs';
|
|
6
|
+
import 'path';
|
|
7
|
+
import 'url';
|
|
8
|
+
import 'module';
|
|
9
|
+
import 'tty';
|
|
10
|
+
import 'esbuild';
|
|
11
|
+
import 'assert';
|
|
12
|
+
import 'resolve';
|
|
13
|
+
import 'util';
|
|
14
|
+
import 'net';
|
|
15
|
+
import 'http';
|
|
16
|
+
import 'stream';
|
|
17
|
+
import 'os';
|
|
18
|
+
import 'child_process';
|
|
19
|
+
import 'crypto';
|
|
20
|
+
import 'buffer';
|
|
21
|
+
import 'querystring';
|
|
22
|
+
import 'zlib';
|
|
23
|
+
import 'https';
|
|
24
|
+
import 'tls';
|
|
25
|
+
import 'worker_threads';
|
|
26
|
+
import 'readline';
|
|
28
27
|
|
|
29
28
|
function toArr(any) {
|
|
30
29
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -449,7 +448,7 @@ class GlobalCommand extends Command {
|
|
|
449
448
|
}
|
|
450
449
|
|
|
451
450
|
var __assign = Object.assign;
|
|
452
|
-
class CAC extends
|
|
451
|
+
class CAC extends EventEmitter {
|
|
453
452
|
constructor(name = "") {
|
|
454
453
|
super();
|
|
455
454
|
this.name = name;
|
|
@@ -683,7 +682,7 @@ cli
|
|
|
683
682
|
.action(async (root, options) => {
|
|
684
683
|
// output structure is preserved even after bundling so require()
|
|
685
684
|
// is ok here
|
|
686
|
-
const { createServer } = await
|
|
685
|
+
const { createServer } = await import('./chunks/dep-134b43f1.js').then(function (n) { return n.B; });
|
|
687
686
|
try {
|
|
688
687
|
const server = await createServer({
|
|
689
688
|
root,
|
|
@@ -699,20 +698,16 @@ cli
|
|
|
699
698
|
}
|
|
700
699
|
await server.listen();
|
|
701
700
|
const info = server.config.logger.info;
|
|
702
|
-
info(index.colors.cyan(`\n vite v${require('vite/package.json').version}`) +
|
|
703
|
-
index.colors.green(` dev server running at:\n`), {
|
|
704
|
-
clear: !server.config.logger.hasWarned
|
|
705
|
-
});
|
|
706
|
-
server.printUrls();
|
|
707
701
|
// @ts-ignore
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
}
|
|
702
|
+
const viteStartTime = global.__vite_start_time ?? false;
|
|
703
|
+
const startupDurationString = viteStartTime
|
|
704
|
+
? colors.dim(`ready in ${colors.white(colors.bold(Math.ceil(performance.now() - viteStartTime)))} ms`)
|
|
705
|
+
: '';
|
|
706
|
+
info(`\n ${colors.green(`${colors.bold('VITE')} v${VERSION}`)} ${startupDurationString}\n`, { clear: !server.config.logger.hasWarned });
|
|
707
|
+
server.printUrls();
|
|
713
708
|
}
|
|
714
709
|
catch (e) {
|
|
715
|
-
|
|
710
|
+
createLogger(options.logLevel).error(colors.red(`error when starting dev server:\n${e.stack}`), { error: e });
|
|
716
711
|
process.exit(1);
|
|
717
712
|
}
|
|
718
713
|
});
|
|
@@ -729,10 +724,11 @@ cli
|
|
|
729
724
|
`or specify minifier to use (default: esbuild)`)
|
|
730
725
|
.option('--manifest [name]', `[boolean | string] emit build manifest json`)
|
|
731
726
|
.option('--ssrManifest [name]', `[boolean | string] emit ssr manifest json`)
|
|
727
|
+
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle (experimental)`)
|
|
732
728
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
733
729
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
734
730
|
.action(async (root, options) => {
|
|
735
|
-
const { build } = await
|
|
731
|
+
const { build } = await import('./chunks/dep-134b43f1.js').then(function (n) { return n.A; });
|
|
736
732
|
const buildOptions = cleanOptions(options);
|
|
737
733
|
try {
|
|
738
734
|
await build({
|
|
@@ -742,11 +738,12 @@ cli
|
|
|
742
738
|
configFile: options.config,
|
|
743
739
|
logLevel: options.logLevel,
|
|
744
740
|
clearScreen: options.clearScreen,
|
|
741
|
+
force: options.force,
|
|
745
742
|
build: buildOptions
|
|
746
743
|
});
|
|
747
744
|
}
|
|
748
745
|
catch (e) {
|
|
749
|
-
|
|
746
|
+
createLogger(options.logLevel).error(colors.red(`error during build:\n${e.stack}`), { error: e });
|
|
750
747
|
process.exit(1);
|
|
751
748
|
}
|
|
752
749
|
});
|
|
@@ -755,9 +752,9 @@ cli
|
|
|
755
752
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
756
753
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
757
754
|
.action(async (root, options) => {
|
|
758
|
-
const { optimizeDeps } = await
|
|
755
|
+
const { optimizeDeps } = await import('./chunks/dep-134b43f1.js').then(function (n) { return n.z; });
|
|
759
756
|
try {
|
|
760
|
-
const config = await
|
|
757
|
+
const config = await resolveConfig({
|
|
761
758
|
root,
|
|
762
759
|
base: options.base,
|
|
763
760
|
configFile: options.config,
|
|
@@ -766,7 +763,7 @@ cli
|
|
|
766
763
|
await optimizeDeps(config, options.force, true);
|
|
767
764
|
}
|
|
768
765
|
catch (e) {
|
|
769
|
-
|
|
766
|
+
createLogger(options.logLevel).error(colors.red(`error when optimizing deps:\n${e.stack}`), { error: e });
|
|
770
767
|
process.exit(1);
|
|
771
768
|
}
|
|
772
769
|
});
|
|
@@ -778,7 +775,7 @@ cli
|
|
|
778
775
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
779
776
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
780
777
|
.action(async (root, options) => {
|
|
781
|
-
const { preview } = await
|
|
778
|
+
const { preview } = await import('./chunks/dep-134b43f1.js').then(function (n) { return n.C; });
|
|
782
779
|
try {
|
|
783
780
|
const server = await preview({
|
|
784
781
|
root,
|
|
@@ -797,10 +794,10 @@ cli
|
|
|
797
794
|
server.printUrls();
|
|
798
795
|
}
|
|
799
796
|
catch (e) {
|
|
800
|
-
|
|
797
|
+
createLogger(options.logLevel).error(colors.red(`error when starting preview server:\n${e.stack}`), { error: e });
|
|
801
798
|
process.exit(1);
|
|
802
799
|
}
|
|
803
800
|
});
|
|
804
801
|
cli.help();
|
|
805
|
-
cli.version(
|
|
802
|
+
cli.version(VERSION);
|
|
806
803
|
cli.parse();
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import path, { resolve } from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
|
|
4
|
+
var version = "3.0.0-alpha.10";
|
|
5
|
+
|
|
6
|
+
const VERSION = version;
|
|
7
|
+
const DEFAULT_MAIN_FIELDS = [
|
|
8
|
+
'module',
|
|
9
|
+
'jsnext:main',
|
|
10
|
+
'jsnext'
|
|
11
|
+
];
|
|
12
|
+
const DEFAULT_EXTENSIONS = [
|
|
13
|
+
'.mjs',
|
|
14
|
+
'.js',
|
|
15
|
+
'.ts',
|
|
16
|
+
'.jsx',
|
|
17
|
+
'.tsx',
|
|
18
|
+
'.json'
|
|
19
|
+
];
|
|
20
|
+
const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
|
|
21
|
+
const OPTIMIZABLE_ENTRY_RE = /\.(?:m?js|ts)$/;
|
|
22
|
+
const SPECIAL_QUERY_RE = /[\?&](?:worker|sharedworker|raw|url)\b/;
|
|
23
|
+
/**
|
|
24
|
+
* Prefix for resolved fs paths, since windows paths may not be valid as URLs.
|
|
25
|
+
*/
|
|
26
|
+
const FS_PREFIX = `/@fs/`;
|
|
27
|
+
/**
|
|
28
|
+
* Prefix for resolved Ids that are not valid browser import specifiers
|
|
29
|
+
*/
|
|
30
|
+
const VALID_ID_PREFIX = `/@id/`;
|
|
31
|
+
/**
|
|
32
|
+
* Plugins that use 'virtual modules' (e.g. for helper functions), prefix the
|
|
33
|
+
* module ID with `\0`, a convention from the rollup ecosystem.
|
|
34
|
+
* This prevents other plugins from trying to process the id (like node resolution),
|
|
35
|
+
* and core features like sourcemaps can use this info to differentiate between
|
|
36
|
+
* virtual modules and regular files.
|
|
37
|
+
* `\0` is not a permitted char in import URLs so we have to replace them during
|
|
38
|
+
* import analysis. The id will be decoded back before entering the plugins pipeline.
|
|
39
|
+
* These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual
|
|
40
|
+
* modules in the browser end up encoded as `/@id/__x00__{id}`
|
|
41
|
+
*/
|
|
42
|
+
const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
|
43
|
+
const CLIENT_PUBLIC_PATH = `/@vite/client`;
|
|
44
|
+
const ENV_PUBLIC_PATH = `/@vite/env`;
|
|
45
|
+
const VITE_PACKAGE_DIR = resolve(fileURLToPath(import.meta.url), '../../..');
|
|
46
|
+
const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
|
|
47
|
+
const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
|
48
|
+
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
49
|
+
// ** READ THIS ** before editing `KNOWN_ASSET_TYPES`.
|
|
50
|
+
// If you add an asset to `KNOWN_ASSET_TYPES`, make sure to also add it
|
|
51
|
+
// to the TypeScript declaration file `packages/vite/client.d.ts`.
|
|
52
|
+
const KNOWN_ASSET_TYPES = [
|
|
53
|
+
// images
|
|
54
|
+
'png',
|
|
55
|
+
'jpe?g',
|
|
56
|
+
'gif',
|
|
57
|
+
'svg',
|
|
58
|
+
'ico',
|
|
59
|
+
'webp',
|
|
60
|
+
'avif',
|
|
61
|
+
// media
|
|
62
|
+
'mp4',
|
|
63
|
+
'webm',
|
|
64
|
+
'ogg',
|
|
65
|
+
'mp3',
|
|
66
|
+
'wav',
|
|
67
|
+
'flac',
|
|
68
|
+
'aac',
|
|
69
|
+
// fonts
|
|
70
|
+
'woff2?',
|
|
71
|
+
'eot',
|
|
72
|
+
'ttf',
|
|
73
|
+
'otf',
|
|
74
|
+
// other
|
|
75
|
+
'webmanifest',
|
|
76
|
+
'pdf',
|
|
77
|
+
'txt'
|
|
78
|
+
];
|
|
79
|
+
const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
|
|
80
|
+
const DEP_VERSION_RE = /[\?&](v=[\w\.-]+)\b/;
|
|
81
|
+
|
|
82
|
+
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, DEFAULT_ASSETS_RE, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR };
|