vite 3.0.0-alpha.3 → 3.0.0-alpha.6

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.
Files changed (82) hide show
  1. package/dist/node/chunks/{dep-24157481.js → dep-17430d09.js} +0 -0
  2. package/dist/node/chunks/{dep-6f5ac69c.js → dep-52974b5a.js} +33902 -33579
  3. package/dist/node/chunks/{dep-b1fc04c1.js → dep-8bed6f50.js} +1 -1
  4. package/dist/node/chunks/{dep-5eede05c.js → dep-a4f17494.js} +1 -1
  5. package/dist/node/chunks/{dep-da8244f4.js → dep-b4474709.js} +100 -47
  6. package/dist/node/cli.js +7 -5
  7. package/dist/node/constants.js +1 -1
  8. package/dist/node/index.d.ts +117 -13
  9. package/dist/node/index.js +1 -1
  10. package/dist/node-cjs/publicUtils.cjs +0 -11
  11. package/package.json +11 -9
  12. package/types/es-module-lexer.d.ts +90 -0
  13. package/dist/node/build.d.ts +0 -178
  14. package/dist/node/certificate.d.ts +0 -2
  15. package/dist/node/cli.d.ts +0 -1
  16. package/dist/node/config.d.ts +0 -240
  17. package/dist/node/constants.d.ts +0 -35
  18. package/dist/node/env.d.ts +0 -3
  19. package/dist/node/http.d.ts +0 -88
  20. package/dist/node/logger.d.ts +0 -31
  21. package/dist/node/optimizer/esbuildDepPlugin.d.ts +0 -4
  22. package/dist/node/optimizer/index.d.ts +0 -154
  23. package/dist/node/optimizer/registerMissing.d.ts +0 -3
  24. package/dist/node/optimizer/scan.d.ts +0 -8
  25. package/dist/node/packages.d.ts +0 -27
  26. package/dist/node/plugin.d.ts +0 -129
  27. package/dist/node/plugins/asset.d.ts +0 -68
  28. package/dist/node/plugins/assetImportMetaUrl.d.ts +0 -13
  29. package/dist/node/plugins/clientInjections.d.ts +0 -7
  30. package/dist/node/plugins/css.d.ts +0 -86
  31. package/dist/node/plugins/dataUri.d.ts +0 -5
  32. package/dist/node/plugins/define.d.ts +0 -3
  33. package/dist/node/plugins/dynamicImportVars.d.ts +0 -9
  34. package/dist/node/plugins/ensureWatch.d.ts +0 -5
  35. package/dist/node/plugins/esbuild.d.ts +0 -15
  36. package/dist/node/plugins/html.d.ts +0 -120
  37. package/dist/node/plugins/importAnalysis.d.ts +0 -47
  38. package/dist/node/plugins/importAnalysisBuild.d.ts +0 -16
  39. package/dist/node/plugins/importMetaGlob.d.ts +0 -34
  40. package/dist/node/plugins/index.d.ts +0 -3
  41. package/dist/node/plugins/json.d.ts +0 -23
  42. package/dist/node/plugins/loadFallback.d.ts +0 -5
  43. package/dist/node/plugins/manifest.d.ts +0 -14
  44. package/dist/node/plugins/metadata.d.ts +0 -9
  45. package/dist/node/plugins/modulePreloadPolyfill.d.ts +0 -4
  46. package/dist/node/plugins/optimizedDeps.d.ts +0 -4
  47. package/dist/node/plugins/preAlias.d.ts +0 -5
  48. package/dist/node/plugins/reporter.d.ts +0 -3
  49. package/dist/node/plugins/resolve.d.ts +0 -39
  50. package/dist/node/plugins/splitVendorChunk.d.ts +0 -12
  51. package/dist/node/plugins/ssrRequireHook.d.ts +0 -12
  52. package/dist/node/plugins/terser.d.ts +0 -3
  53. package/dist/node/plugins/wasm.d.ts +0 -4
  54. package/dist/node/plugins/worker.d.ts +0 -9
  55. package/dist/node/plugins/workerImportMetaUrl.d.ts +0 -3
  56. package/dist/node/preview.d.ts +0 -33
  57. package/dist/node/publicUtils.d.ts +0 -11
  58. package/dist/node/server/hmr.d.ts +0 -39
  59. package/dist/node/server/index.d.ts +0 -198
  60. package/dist/node/server/middlewares/base.d.ts +0 -3
  61. package/dist/node/server/middlewares/compression.d.ts +0 -1
  62. package/dist/node/server/middlewares/error.d.ts +0 -8
  63. package/dist/node/server/middlewares/indexHtml.d.ts +0 -4
  64. package/dist/node/server/middlewares/proxy.d.ts +0 -20
  65. package/dist/node/server/middlewares/spaFallback.d.ts +0 -2
  66. package/dist/node/server/middlewares/static.d.ts +0 -6
  67. package/dist/node/server/middlewares/time.d.ts +0 -2
  68. package/dist/node/server/middlewares/transform.d.ts +0 -3
  69. package/dist/node/server/moduleGraph.d.ts +0 -55
  70. package/dist/node/server/openBrowser.d.ts +0 -15
  71. package/dist/node/server/pluginContainer.d.ts +0 -41
  72. package/dist/node/server/searchRoot.d.ts +0 -8
  73. package/dist/node/server/send.d.ts +0 -10
  74. package/dist/node/server/sourcemap.d.ts +0 -11
  75. package/dist/node/server/transformRequest.d.ts +0 -14
  76. package/dist/node/server/ws.d.ts +0 -55
  77. package/dist/node/ssr/ssrExternal.d.ts +0 -11
  78. package/dist/node/ssr/ssrManifestPlugin.d.ts +0 -3
  79. package/dist/node/ssr/ssrModuleLoader.d.ts +0 -7
  80. package/dist/node/ssr/ssrStacktrace.d.ts +0 -3
  81. package/dist/node/ssr/ssrTransform.d.ts +0 -14
  82. package/dist/node/utils.d.ts +0 -144
@@ -1,5 +1,5 @@
1
1
  import require$$0 from 'postcss';
2
- import { v as commonjsGlobal } from './dep-6f5ac69c.js';
2
+ import { w as commonjsGlobal } from './dep-52974b5a.js';
3
3
  import path$2 from 'path';
4
4
  import require$$1 from 'crypto';
5
5
  import fs__default from 'fs';
@@ -1,4 +1,4 @@
1
- import { v as commonjsGlobal } from './dep-6f5ac69c.js';
1
+ import { w as commonjsGlobal } from './dep-52974b5a.js';
2
2
  import require$$1 from 'crypto';
3
3
  import 'fs';
4
4
  import 'path';
@@ -1,4 +1,4 @@
1
- import { w as getAugmentedNamespace, x as getDefaultExportFromCjs } from './dep-6f5ac69c.js';
1
+ import { x as getAugmentedNamespace, y as getDefaultExportFromCjs } from './dep-52974b5a.js';
2
2
 
3
3
  import { fileURLToPath as __cjs_fileURLToPath } from 'url';
4
4
  import { dirname as __cjs_dirname } from 'path';
@@ -424,6 +424,11 @@ function looseEqual(a, b) {
424
424
  if (aValidType || bValidType) {
425
425
  return aValidType && bValidType ? a.getTime() === b.getTime() : false;
426
426
  }
427
+ aValidType = isSymbol(a);
428
+ bValidType = isSymbol(b);
429
+ if (aValidType || bValidType) {
430
+ return a === b;
431
+ }
427
432
  aValidType = isArray(a);
428
433
  bValidType = isArray(b);
429
434
  if (aValidType || bValidType) {
@@ -520,7 +525,7 @@ const hasOwn = (val, key) => hasOwnProperty.call(val, key);
520
525
  const isArray = Array.isArray;
521
526
  const isMap = (val) => toTypeString(val) === '[object Map]';
522
527
  const isSet = (val) => toTypeString(val) === '[object Set]';
523
- const isDate = (val) => val instanceof Date;
528
+ const isDate = (val) => toTypeString(val) === '[object Date]';
524
529
  const isFunction = (val) => typeof val === 'function';
525
530
  const isString = (val) => typeof val === 'string';
526
531
  const isSymbol = (val) => typeof val === 'symbol';
@@ -604,7 +609,13 @@ const getGlobalThis = () => {
604
609
  : typeof global !== 'undefined'
605
610
  ? global
606
611
  : {}));
607
- };
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
+ }
608
619
 
609
620
  var shared_esmBundler = {
610
621
  __proto__: null,
@@ -619,6 +630,7 @@ var shared_esmBundler = {
619
630
  escapeHtml: escapeHtml,
620
631
  escapeHtmlComment: escapeHtmlComment,
621
632
  extend: extend,
633
+ genPropsAccessExp: genPropsAccessExp,
622
634
  generateCodeFrame: generateCodeFrame,
623
635
  getGlobalThis: getGlobalThis,
624
636
  hasChanged: hasChanged,
@@ -2452,6 +2464,14 @@ function getConstantType(node, context) {
2452
2464
  // static then they don't need to be blocks since there will be no
2453
2465
  // nested updates.
2454
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
+ }
2455
2475
  context.removeHelper(OPEN_BLOCK);
2456
2476
  context.removeHelper(getVNodeBlockHelper(context.inSSR, codegenNode.isComponent));
2457
2477
  codegenNode.isBlock = false;
@@ -2858,6 +2878,7 @@ function createStructuralDirectiveTransform(name, fn) {
2858
2878
  }
2859
2879
 
2860
2880
  const PURE_ANNOTATION = `/*#__PURE__*/`;
2881
+ const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
2861
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 }) {
2862
2883
  const context = {
2863
2884
  mode,
@@ -2934,9 +2955,7 @@ function generate(ast, options = {}) {
2934
2955
  // function mode const declarations should be inside with block
2935
2956
  // also they should be renamed to avoid collision with user properties
2936
2957
  if (hasHelpers) {
2937
- push(`const { ${ast.helpers
2938
- .map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
2939
- .join(', ')} } = _Vue`);
2958
+ push(`const { ${ast.helpers.map(aliasHelper).join(', ')} } = _Vue`);
2940
2959
  push(`\n`);
2941
2960
  newline();
2942
2961
  }
@@ -2996,7 +3015,6 @@ function generate(ast, options = {}) {
2996
3015
  function genFunctionPreamble(ast, context) {
2997
3016
  const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName, ssrRuntimeModuleName } = context;
2998
3017
  const VueBinding = runtimeGlobalName;
2999
- const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
3000
3018
  // Generate const declaration for helpers
3001
3019
  // In prefix mode, we place the const declaration at top so it's done
3002
3020
  // only once; But if we not prefixing, we place the declaration inside the
@@ -3714,14 +3732,14 @@ function processIf(node, dir, context, processCodegen) {
3714
3732
  }
3715
3733
  }
3716
3734
  function createIfBranch(node, dir) {
3735
+ const isTemplateIf = node.tagType === 3 /* TEMPLATE */;
3717
3736
  return {
3718
3737
  type: 10 /* IF_BRANCH */,
3719
3738
  loc: node.loc,
3720
3739
  condition: dir.name === 'else' ? undefined : dir.exp,
3721
- children: node.tagType === 3 /* TEMPLATE */ && !findDir(node, 'for')
3722
- ? node.children
3723
- : [node],
3724
- userKey: findProp(node, `key`)
3740
+ children: isTemplateIf && !findDir(node, 'for') ? node.children : [node],
3741
+ userKey: findProp(node, `key`),
3742
+ isTemplateIf
3725
3743
  };
3726
3744
  }
3727
3745
  function createCodegenNodeForBranch(branch, keyIndex, context) {
@@ -3757,6 +3775,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
3757
3775
  // check if the fragment actually contains a single valid child with
3758
3776
  // the rest being comments
3759
3777
  if ((process.env.NODE_ENV !== 'production') &&
3778
+ !branch.isTemplateIf &&
3760
3779
  children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
3761
3780
  patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
3762
3781
  patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
@@ -4333,7 +4352,7 @@ const transformElement = (node, context) => {
4333
4352
  (tag === 'svg' || tag === 'foreignObject'));
4334
4353
  // props
4335
4354
  if (props.length > 0) {
4336
- const propsBuildResult = buildProps(node, context);
4355
+ const propsBuildResult = buildProps(node, context, undefined, isComponent, isDynamicComponent);
4337
4356
  vnodeProps = propsBuildResult.props;
4338
4357
  patchFlag = propsBuildResult.patchFlag;
4339
4358
  dynamicPropNames = propsBuildResult.dynamicPropNames;
@@ -4475,9 +4494,8 @@ function resolveComponentType(node, context, ssr = false) {
4475
4494
  context.components.add(tag);
4476
4495
  return toValidAssetId(tag, `component`);
4477
4496
  }
4478
- function buildProps(node, context, props = node.props, ssr = false) {
4497
+ function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
4479
4498
  const { tag, loc: elementLoc, children } = node;
4480
- const isComponent = node.tagType === 1 /* COMPONENT */;
4481
4499
  let properties = [];
4482
4500
  const mergeArgs = [];
4483
4501
  const runtimeDirectives = [];
@@ -4496,8 +4514,8 @@ function buildProps(node, context, props = node.props, ssr = false) {
4496
4514
  if (isStaticExp(key)) {
4497
4515
  const name = key.content;
4498
4516
  const isEventHandler = isOn(name);
4499
- if (!isComponent &&
4500
- isEventHandler &&
4517
+ if (isEventHandler &&
4518
+ (!isComponent || isDynamicComponent) &&
4501
4519
  // omit the flag for click handlers because hydration gives click
4502
4520
  // dedicated fast path.
4503
4521
  name.toLowerCase() !== 'onclick' &&
@@ -4752,10 +4770,11 @@ function buildProps(node, context, props = node.props, ssr = false) {
4752
4770
  classProp.value = createCallExpression(context.helper(NORMALIZE_CLASS), [classProp.value]);
4753
4771
  }
4754
4772
  if (styleProp &&
4755
- !isStaticExp(styleProp.value) &&
4756
4773
  // the static style is compiled into an object,
4757
4774
  // so use `hasStyleBinding` to ensure that it is a dynamic style binding
4758
4775
  (hasStyleBinding ||
4776
+ (styleProp.value.type === 4 /* SIMPLE_EXPRESSION */ &&
4777
+ styleProp.value.content.trim()[0] === `[`) ||
4759
4778
  // v-bind:style and style both exist,
4760
4779
  // v-bind:style with static literal object
4761
4780
  styleProp.value.type === 17 /* JS_ARRAY_EXPRESSION */)) {
@@ -4953,7 +4972,7 @@ function processSlotOutlet(node, context) {
4953
4972
  }
4954
4973
  }
4955
4974
  if (nonNameProps.length > 0) {
4956
- const { props, directives } = buildProps(node, context, nonNameProps);
4975
+ const { props, directives } = buildProps(node, context, nonNameProps, false, false);
4957
4976
  slotProps = props;
4958
4977
  if (directives.length) {
4959
4978
  context.onError(createCompilerError(36 /* X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET */, directives[0].loc));
@@ -5124,11 +5143,7 @@ const transformText = (node, context) => {
5124
5143
  const next = children[j];
5125
5144
  if (isText(next)) {
5126
5145
  if (!currentContainer) {
5127
- currentContainer = children[i] = {
5128
- type: 8 /* COMPOUND_EXPRESSION */,
5129
- loc: child.loc,
5130
- children: [child]
5131
- };
5146
+ currentContainer = children[i] = createCompoundExpression([child], child.loc);
5132
5147
  }
5133
5148
  // merge adjacent text node into current
5134
5149
  currentContainer.children.push(` + `, next);
@@ -5597,6 +5612,7 @@ var compilerCore_esmBundler = {
5597
5612
  findProp: findProp,
5598
5613
  generate: generate,
5599
5614
  getBaseTransformPreset: getBaseTransformPreset,
5615
+ getConstantType: getConstantType,
5600
5616
  getInnerRange: getInnerRange,
5601
5617
  getMemoedVNodeCall: getMemoedVNodeCall,
5602
5618
  getVNodeBlockHelper: getVNodeBlockHelper,
@@ -8178,7 +8194,9 @@ const transformVText = (dir, node, context) => {
8178
8194
  return {
8179
8195
  props: [
8180
8196
  compilerCore.createObjectProperty(compilerCore.createSimpleExpression(`textContent`, true), exp
8181
- ? compilerCore.createCallExpression(context.helperString(compilerCore.TO_DISPLAY_STRING), [exp], loc)
8197
+ ? compilerCore.getConstantType(exp, context) > 0
8198
+ ? exp
8199
+ : compilerCore.createCallExpression(context.helperString(compilerCore.TO_DISPLAY_STRING), [exp], loc)
8182
8200
  : compilerCore.createSimpleExpression('', true))
8183
8201
  ]
8184
8202
  };
@@ -8390,19 +8408,38 @@ const transformShow = (dir, node, context) => {
8390
8408
  };
8391
8409
  };
8392
8410
 
8393
- const warnTransitionChildren = (node, context) => {
8411
+ const transformTransition = (node, context) => {
8394
8412
  if (node.type === 1 /* ELEMENT */ &&
8395
8413
  node.tagType === 1 /* COMPONENT */) {
8396
8414
  const component = context.isBuiltInComponent(node.tag);
8397
8415
  if (component === TRANSITION) {
8398
8416
  return () => {
8399
- if (node.children.length && hasMultipleChildren(node)) {
8417
+ if (!node.children.length) {
8418
+ return;
8419
+ }
8420
+ // warn multiple transition children
8421
+ if (hasMultipleChildren(node)) {
8400
8422
  context.onError(createDOMCompilerError(59 /* X_TRANSITION_INVALID_CHILDREN */, {
8401
8423
  start: node.children[0].loc.start,
8402
8424
  end: node.children[node.children.length - 1].loc.end,
8403
8425
  source: ''
8404
8426
  }));
8405
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
+ }
8406
8443
  };
8407
8444
  }
8408
8445
  }
@@ -8618,6 +8655,7 @@ function stringifyNode(node, context) {
8618
8655
  }
8619
8656
  function stringifyElement(node, context) {
8620
8657
  let res = `<${node.tag}`;
8658
+ let innerHTML = '';
8621
8659
  for (let i = 0; i < node.props.length; i++) {
8622
8660
  const p = node.props[i];
8623
8661
  if (p.type === 6 /* ATTRIBUTE */) {
@@ -8626,25 +8664,35 @@ function stringifyElement(node, context) {
8626
8664
  res += `="${shared.escapeHtml(p.value.content)}"`;
8627
8665
  }
8628
8666
  }
8629
- else if (p.type === 7 /* DIRECTIVE */ && p.name === 'bind') {
8630
- const exp = p.exp;
8631
- if (exp.content[0] === '_') {
8632
- // internally generated string constant references
8633
- // e.g. imported URL strings via compiler-sfc transformAssetUrl plugin
8634
- res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
8635
- continue;
8636
- }
8637
- // constant v-bind, e.g. :foo="1"
8638
- let evaluated = evaluateConstant(exp);
8639
- if (evaluated != null) {
8640
- const arg = p.arg && p.arg.content;
8641
- if (arg === 'class') {
8642
- 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;
8643
8675
  }
8644
- else if (arg === 'style') {
8645
- evaluated = shared.stringifyStyle(shared.normalizeStyle(evaluated));
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)}"`;
8646
8687
  }
8647
- res += ` ${p.arg.content}="${shared.escapeHtml(evaluated)}"`;
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)));
8648
8696
  }
8649
8697
  }
8650
8698
  }
@@ -8652,8 +8700,13 @@ function stringifyElement(node, context) {
8652
8700
  res += ` ${context.scopeId}`;
8653
8701
  }
8654
8702
  res += `>`;
8655
- for (let i = 0; i < node.children.length; i++) {
8656
- res += stringifyNode(node.children[i], context);
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
+ }
8657
8710
  }
8658
8711
  if (!shared.isVoidTag(node.tag)) {
8659
8712
  res += `</${node.tag}>`;
@@ -8666,7 +8719,7 @@ function stringifyElement(node, context) {
8666
8719
  // here, e.g. `{{ 1 }}` or `{{ 'foo' }}`
8667
8720
  // in addition, constant exps bail on presence of parens so you can't even
8668
8721
  // run JSFuck in here. But we mark it unsafe for security review purposes.
8669
- // (see compiler-core/src/transformExpressions)
8722
+ // (see compiler-core/src/transforms/transformExpression)
8670
8723
  function evaluateConstant(exp) {
8671
8724
  if (exp.type === 4 /* SIMPLE_EXPRESSION */) {
8672
8725
  return new Function(`return ${exp.content}`)();
@@ -8703,7 +8756,7 @@ const ignoreSideEffectTags = (node, context) => {
8703
8756
 
8704
8757
  const DOMNodeTransforms = [
8705
8758
  transformStyle,
8706
- ...([warnTransitionChildren] )
8759
+ ...([transformTransition] )
8707
8760
  ];
8708
8761
  const DOMDirectiveTransforms = {
8709
8762
  cloak: compilerCore.noopDirectiveTransform,
package/dist/node/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { performance } from 'perf_hooks';
2
2
  import { EventEmitter } from 'events';
3
- import { u as colors, i as createLogger, e as resolveConfig } from './chunks/dep-6f5ac69c.js';
3
+ import { v as colors, j as createLogger, e as resolveConfig } from './chunks/dep-52974b5a.js';
4
4
  import { VERSION } from './constants.js';
5
5
  import 'fs';
6
6
  import 'path';
@@ -682,7 +682,7 @@ cli
682
682
  .action(async (root, options) => {
683
683
  // output structure is preserved even after bundling so require()
684
684
  // is ok here
685
- const { createServer } = await import('./chunks/dep-6f5ac69c.js').then(function (n) { return n.A; });
685
+ const { createServer } = await import('./chunks/dep-52974b5a.js').then(function (n) { return n.B; });
686
686
  try {
687
687
  const server = await createServer({
688
688
  root,
@@ -724,10 +724,11 @@ cli
724
724
  `or specify minifier to use (default: esbuild)`)
725
725
  .option('--manifest [name]', `[boolean | string] emit build manifest json`)
726
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)`)
727
728
  .option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
728
729
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
729
730
  .action(async (root, options) => {
730
- const { build } = await import('./chunks/dep-6f5ac69c.js').then(function (n) { return n.z; });
731
+ const { build } = await import('./chunks/dep-52974b5a.js').then(function (n) { return n.A; });
731
732
  const buildOptions = cleanOptions(options);
732
733
  try {
733
734
  await build({
@@ -737,6 +738,7 @@ cli
737
738
  configFile: options.config,
738
739
  logLevel: options.logLevel,
739
740
  clearScreen: options.clearScreen,
741
+ force: options.force,
740
742
  build: buildOptions
741
743
  });
742
744
  }
@@ -750,7 +752,7 @@ cli
750
752
  .command('optimize [root]', 'pre-bundle dependencies')
751
753
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
752
754
  .action(async (root, options) => {
753
- const { optimizeDeps } = await import('./chunks/dep-6f5ac69c.js').then(function (n) { return n.y; });
755
+ const { optimizeDeps } = await import('./chunks/dep-52974b5a.js').then(function (n) { return n.z; });
754
756
  try {
755
757
  const config = await resolveConfig({
756
758
  root,
@@ -773,7 +775,7 @@ cli
773
775
  .option('--https', `[boolean] use TLS + HTTP/2`)
774
776
  .option('--open [path]', `[boolean | string] open browser on startup`)
775
777
  .action(async (root, options) => {
776
- const { preview } = await import('./chunks/dep-6f5ac69c.js').then(function (n) { return n.B; });
778
+ const { preview } = await import('./chunks/dep-52974b5a.js').then(function (n) { return n.C; });
777
779
  try {
778
780
  const server = await preview({
779
781
  root,
@@ -1,7 +1,7 @@
1
1
  import path, { resolve } from 'path';
2
2
  import { fileURLToPath } from 'url';
3
3
 
4
- var version = "3.0.0-alpha.3";
4
+ var version = "3.0.0-alpha.6";
5
5
 
6
6
  const VERSION = version;
7
7
  const DEFAULT_MAIN_FIELDS = [
@@ -533,6 +533,13 @@ export declare interface DepOptimizationOptions {
533
533
  * vite project root. This will overwrite default entries inference.
534
534
  */
535
535
  entries?: string | string[];
536
+ /**
537
+ * Enable esbuild based scan phase, to get back to the optimized deps discovery
538
+ * strategy used in Vite v2
539
+ * @default false
540
+ * @experimental
541
+ */
542
+ devScan?: boolean;
536
543
  /**
537
544
  * Force optimize listed dependencies (must be resolvable import paths,
538
545
  * cannot be globs).
@@ -543,6 +550,12 @@ export declare interface DepOptimizationOptions {
543
550
  * cannot be globs).
544
551
  */
545
552
  exclude?: string[];
553
+ /**
554
+ * Force ESM interop when importing for these dependencies. Some legacy
555
+ * packages advertise themselves as ESM but use `require` internally
556
+ * @experimental
557
+ */
558
+ needsInterop?: string[];
546
559
  /**
547
560
  * Options to pass to esbuild during the dep scanning and optimization
548
561
  *
@@ -566,11 +579,13 @@ export declare interface DepOptimizationOptions {
566
579
  */
567
580
  extensions?: string[];
568
581
  /**
569
- * Disables dependencies optimizations
582
+ * Disables dependencies optimizations, true disables the optimizer during
583
+ * build and dev. Pass 'build' or 'dev' to only disable the optimizer in
584
+ * one of the modes. Deps optimization is enabled by default in both
570
585
  * @default false
571
586
  * @experimental
572
587
  */
573
- disabled?: boolean;
588
+ disabled?: boolean | 'build' | 'dev';
574
589
  }
575
590
 
576
591
  export declare interface DepOptimizationProcessing {
@@ -589,6 +604,17 @@ export declare interface DepOptimizationResult {
589
604
  cancel: () => void;
590
605
  }
591
606
 
607
+ export declare interface DepsOptimizer {
608
+ metadata: DepOptimizationMetadata;
609
+ scanProcessing?: Promise<void>;
610
+ registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
611
+ run: () => void;
612
+ isOptimizedDepFile: (id: string) => boolean;
613
+ isOptimizedDepUrl: (url: string) => boolean;
614
+ getOptimizedDepId: (depInfo: OptimizedDepInfo) => string;
615
+ options: DepOptimizationOptions;
616
+ }
617
+
592
618
  export declare interface ErrorPayload {
593
619
  type: 'error'
594
620
  err: {
@@ -619,6 +645,77 @@ export declare type ESBuildTransformResult = Omit<TransformResult_3, 'map'> & {
619
645
  map: SourceMap;
620
646
  };
621
647
 
648
+ export declare interface EsModuleLexerImportSpecifier {
649
+ /**
650
+ * Module name
651
+ *
652
+ * To handle escape sequences in specifier strings, the .n field of imported specifiers will be provided where possible.
653
+ *
654
+ * For dynamic import expressions, this field will be empty if not a valid JS string.
655
+ *
656
+ * @example
657
+ * const [imports1, exports1] = parse(String.raw`import './\u0061\u0062.js'`);
658
+ * imports1[0].n;
659
+ * // Returns "./ab.js"
660
+ *
661
+ * const [imports2, exports2] = parse(`import("./ab.js")`);
662
+ * imports2[0].n;
663
+ * // Returns "./ab.js"
664
+ *
665
+ * const [imports3, exports3] = parse(`import("./" + "ab.js")`);
666
+ * imports3[0].n;
667
+ * // Returns undefined
668
+ */
669
+ readonly n: string | undefined
670
+ /**
671
+ * Start of module specifier
672
+ *
673
+ * @example
674
+ * const source = `import { a } from 'asdf'`;
675
+ * const [imports, exports] = parse(source);
676
+ * source.substring(imports[0].s, imports[0].e);
677
+ * // Returns "asdf"
678
+ */
679
+ readonly s: number
680
+ /**
681
+ * End of module specifier
682
+ */
683
+ readonly e: number
684
+
685
+ /**
686
+ * Start of import statement
687
+ *
688
+ * @example
689
+ * const source = `import { a } from 'asdf'`;
690
+ * const [imports, exports] = parse(source);
691
+ * source.substring(imports[0].ss, imports[0].se);
692
+ * // Returns `"import { a } from 'asdf';"`
693
+ */
694
+ readonly ss: number
695
+ /**
696
+ * End of import statement
697
+ */
698
+ readonly se: number
699
+
700
+ /**
701
+ * If this import statement is a dynamic import, this is the start value.
702
+ * Otherwise this is `-1`.
703
+ */
704
+ readonly d: number
705
+
706
+ /**
707
+ * If this import has an import assertion, this is the start value.
708
+ * Otherwise this is `-1`.
709
+ */
710
+ readonly a: number
711
+ }
712
+
713
+ export declare type EsModuleLexerParseReturnType = readonly [
714
+ imports: ReadonlyArray<EsModuleLexerImportSpecifier>,
715
+ exports: ReadonlyArray<string>,
716
+ facade: boolean
717
+ ];
718
+
622
719
  export declare interface ExperimentalOptions {
623
720
  /**
624
721
  * Append fake `&lang.(ext)` when queries are specified, to preseve the file extension for following plugins to process.
@@ -629,6 +726,11 @@ export declare interface ExperimentalOptions {
629
726
  importGlobRestoreExtension?: boolean;
630
727
  }
631
728
 
729
+ export declare type ExportsData = EsModuleLexerParseReturnType & {
730
+ hasReExports?: true;
731
+ jsxLoader?: true;
732
+ };
733
+
632
734
  export declare interface FileSystemServeOptions {
633
735
  /**
634
736
  * Strictly restrict file accessing outside of allowing paths.
@@ -1130,8 +1232,11 @@ export declare interface InternalResolveOptions extends ResolveOptions {
1130
1232
  isFromTsImporter?: boolean;
1131
1233
  tryEsmOnly?: boolean;
1132
1234
  scan?: boolean;
1235
+ getDepsOptimizer?: () => DepsOptimizer | undefined;
1133
1236
  }
1134
1237
 
1238
+ export declare function isDepsOptimizerEnabled(config: ResolvedConfig): boolean;
1239
+
1135
1240
  export declare interface JsonOptions {
1136
1241
  /**
1137
1242
  * Generate a named export for every property of the JSON object
@@ -1281,12 +1386,11 @@ export declare interface OptimizedDepInfo {
1281
1386
  * but the bundles may not yet be saved to disk
1282
1387
  */
1283
1388
  processing?: Promise<void>;
1284
- }
1285
-
1286
- export declare interface OptimizedDeps {
1287
- metadata: DepOptimizationMetadata;
1288
- scanProcessing?: Promise<void>;
1289
- registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
1389
+ /**
1390
+ * ExportData cache, discovered deps will parse the src entry to get exports
1391
+ * data used both to define if interop is needed and when pre-bundling
1392
+ */
1393
+ exportsData?: Promise<ExportsData>;
1290
1394
  }
1291
1395
 
1292
1396
  /**
@@ -1800,10 +1904,6 @@ export declare interface SendOptions {
1800
1904
  export declare type ServerHook = (server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
1801
1905
 
1802
1906
  export declare interface ServerOptions extends CommonServerOptions {
1803
- /**
1804
- * Force dep pre-optimization regardless of whether deps have changed.
1805
- */
1806
- force?: boolean;
1807
1907
  /**
1808
1908
  * Configure HMR-specific options (port, host, path & protocol)
1809
1909
  */
@@ -2145,6 +2245,11 @@ export declare interface UserConfig {
2145
2245
  * Preview specific options, e.g. host, port, https...
2146
2246
  */
2147
2247
  preview?: PreviewOptions;
2248
+ /**
2249
+ * Force dep pre-optimization regardless of whether deps have changed.
2250
+ * @experimental
2251
+ */
2252
+ force?: boolean;
2148
2253
  /**
2149
2254
  * Dep optimization options
2150
2255
  */
@@ -2297,7 +2402,6 @@ export declare interface ViteDevServer {
2297
2402
  * @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
2298
2403
  */
2299
2404
  restart(forceOptimize?: boolean): Promise<void>;
2300
- /* Excluded from this release type: _optimizedDeps */
2301
2405
  /* Excluded from this release type: _importGlobMap */
2302
2406
  /* Excluded from this release type: _ssrExternals */
2303
2407
  /* Excluded from this release type: _restartPromise */
@@ -1,4 +1,4 @@
1
- export { b as build, i as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, l as loadConfigFromFile, k as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, e as resolveConfig, q as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, j as searchForWorkspaceRoot, h as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-6f5ac69c.js';
1
+ export { b as build, j as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, i as isDepsOptimizerEnabled, l as loadConfigFromFile, q as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, e as resolveConfig, u as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, k as searchForWorkspaceRoot, h as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-52974b5a.js';
2
2
  import 'fs';
3
3
  import 'path';
4
4
  import 'url';
@@ -136,17 +136,6 @@ for (let i = 0; i < chars.length; i++) {
136
136
  charToInt[c] = i;
137
137
  }
138
138
 
139
- Object.freeze({
140
- source: null,
141
- line: null,
142
- column: null,
143
- name: null,
144
- });
145
- Object.freeze({
146
- line: null,
147
- column: null,
148
- });
149
-
150
139
  var picocolors = {exports: {}};
151
140
 
152
141
  let tty = require$$0__default;