@vue/compiler-dom 3.5.0-alpha.5 → 3.5.0-beta.2

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-dom v3.5.0-alpha.5
2
+ * @vue/compiler-dom v3.5.0-beta.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -39,16 +39,20 @@ var VueCompilerDOM = (function (exports) {
39
39
  };
40
40
  };
41
41
  const camelizeRE = /-(\w)/g;
42
- const camelize = cacheStringFunction((str) => {
43
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
44
- });
42
+ const camelize = cacheStringFunction(
43
+ (str) => {
44
+ return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
45
+ }
46
+ );
45
47
  const capitalize = cacheStringFunction((str) => {
46
48
  return str.charAt(0).toUpperCase() + str.slice(1);
47
49
  });
48
- const toHandlerKey = cacheStringFunction((str) => {
49
- const s = str ? `on${capitalize(str)}` : ``;
50
- return s;
51
- });
50
+ const toHandlerKey = cacheStringFunction(
51
+ (str) => {
52
+ const s = str ? `on${capitalize(str)}` : ``;
53
+ return s;
54
+ }
55
+ );
52
56
 
53
57
  const PatchFlagNames = {
54
58
  [1]: `TEXT`,
@@ -142,36 +146,70 @@ var VueCompilerDOM = (function (exports) {
142
146
  const TELEPORT = Symbol(`Teleport` );
143
147
  const SUSPENSE = Symbol(`Suspense` );
144
148
  const KEEP_ALIVE = Symbol(`KeepAlive` );
145
- const BASE_TRANSITION = Symbol(`BaseTransition` );
149
+ const BASE_TRANSITION = Symbol(
150
+ `BaseTransition`
151
+ );
146
152
  const OPEN_BLOCK = Symbol(`openBlock` );
147
153
  const CREATE_BLOCK = Symbol(`createBlock` );
148
- const CREATE_ELEMENT_BLOCK = Symbol(`createElementBlock` );
154
+ const CREATE_ELEMENT_BLOCK = Symbol(
155
+ `createElementBlock`
156
+ );
149
157
  const CREATE_VNODE = Symbol(`createVNode` );
150
- const CREATE_ELEMENT_VNODE = Symbol(`createElementVNode` );
151
- const CREATE_COMMENT = Symbol(`createCommentVNode` );
152
- const CREATE_TEXT = Symbol(`createTextVNode` );
153
- const CREATE_STATIC = Symbol(`createStaticVNode` );
154
- const RESOLVE_COMPONENT = Symbol(`resolveComponent` );
158
+ const CREATE_ELEMENT_VNODE = Symbol(
159
+ `createElementVNode`
160
+ );
161
+ const CREATE_COMMENT = Symbol(
162
+ `createCommentVNode`
163
+ );
164
+ const CREATE_TEXT = Symbol(
165
+ `createTextVNode`
166
+ );
167
+ const CREATE_STATIC = Symbol(
168
+ `createStaticVNode`
169
+ );
170
+ const RESOLVE_COMPONENT = Symbol(
171
+ `resolveComponent`
172
+ );
155
173
  const RESOLVE_DYNAMIC_COMPONENT = Symbol(
156
174
  `resolveDynamicComponent`
157
175
  );
158
- const RESOLVE_DIRECTIVE = Symbol(`resolveDirective` );
159
- const RESOLVE_FILTER = Symbol(`resolveFilter` );
160
- const WITH_DIRECTIVES = Symbol(`withDirectives` );
176
+ const RESOLVE_DIRECTIVE = Symbol(
177
+ `resolveDirective`
178
+ );
179
+ const RESOLVE_FILTER = Symbol(
180
+ `resolveFilter`
181
+ );
182
+ const WITH_DIRECTIVES = Symbol(
183
+ `withDirectives`
184
+ );
161
185
  const RENDER_LIST = Symbol(`renderList` );
162
186
  const RENDER_SLOT = Symbol(`renderSlot` );
163
187
  const CREATE_SLOTS = Symbol(`createSlots` );
164
- const TO_DISPLAY_STRING = Symbol(`toDisplayString` );
188
+ const TO_DISPLAY_STRING = Symbol(
189
+ `toDisplayString`
190
+ );
165
191
  const MERGE_PROPS = Symbol(`mergeProps` );
166
- const NORMALIZE_CLASS = Symbol(`normalizeClass` );
167
- const NORMALIZE_STYLE = Symbol(`normalizeStyle` );
168
- const NORMALIZE_PROPS = Symbol(`normalizeProps` );
169
- const GUARD_REACTIVE_PROPS = Symbol(`guardReactiveProps` );
192
+ const NORMALIZE_CLASS = Symbol(
193
+ `normalizeClass`
194
+ );
195
+ const NORMALIZE_STYLE = Symbol(
196
+ `normalizeStyle`
197
+ );
198
+ const NORMALIZE_PROPS = Symbol(
199
+ `normalizeProps`
200
+ );
201
+ const GUARD_REACTIVE_PROPS = Symbol(
202
+ `guardReactiveProps`
203
+ );
170
204
  const TO_HANDLERS = Symbol(`toHandlers` );
171
205
  const CAMELIZE = Symbol(`camelize` );
172
206
  const CAPITALIZE = Symbol(`capitalize` );
173
- const TO_HANDLER_KEY = Symbol(`toHandlerKey` );
174
- const SET_BLOCK_TRACKING = Symbol(`setBlockTracking` );
207
+ const TO_HANDLER_KEY = Symbol(
208
+ `toHandlerKey`
209
+ );
210
+ const SET_BLOCK_TRACKING = Symbol(
211
+ `setBlockTracking`
212
+ );
175
213
  const PUSH_SCOPE_ID = Symbol(`pushScopeId` );
176
214
  const POP_SCOPE_ID = Symbol(`popScopeId` );
177
215
  const WITH_CTX = Symbol(`withCtx` );
@@ -1622,14 +1660,20 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
1622
1660
  } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
1623
1661
  if (stmt.declare || !stmt.id) continue;
1624
1662
  onIdent(stmt.id);
1625
- } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
1626
- const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
1627
- if (variable && variable.type === "VariableDeclaration") {
1628
- for (const decl of variable.declarations) {
1629
- for (const id of extractIdentifiers(decl.id)) {
1630
- onIdent(id);
1631
- }
1632
- }
1663
+ } else if (isForStatement(stmt)) {
1664
+ walkForStatement(stmt, true, onIdent);
1665
+ }
1666
+ }
1667
+ }
1668
+ function isForStatement(stmt) {
1669
+ return stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement";
1670
+ }
1671
+ function walkForStatement(stmt, isVar, onIdent) {
1672
+ const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
1673
+ if (variable && variable.type === "VariableDeclaration" && (variable.kind === "var" ? isVar : !isVar)) {
1674
+ for (const decl of variable.declarations) {
1675
+ for (const id of extractIdentifiers(decl.id)) {
1676
+ onIdent(id);
1633
1677
  }
1634
1678
  }
1635
1679
  }
@@ -1716,8 +1760,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
1716
1760
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
1717
1761
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
1718
1762
  const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
1719
- const isMemberExpressionBrowser = (path) => {
1720
- path = path.trim().replace(whitespaceRE, (s) => s.trim());
1763
+ const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
1764
+ const isMemberExpressionBrowser = (exp) => {
1765
+ const path = getExpSource(exp).trim().replace(whitespaceRE, (s) => s.trim());
1721
1766
  let state = 0 /* inMemberExp */;
1722
1767
  let stateStack = [];
1723
1768
  let currentOpenBracketCount = 0;
@@ -1780,6 +1825,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
1780
1825
  };
1781
1826
  const isMemberExpressionNode = NOOP ;
1782
1827
  const isMemberExpression = isMemberExpressionBrowser ;
1828
+ const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
1829
+ const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
1830
+ const isFnExpressionNode = NOOP ;
1831
+ const isFnExpression = isFnExpressionBrowser ;
1783
1832
  function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
1784
1833
  return advancePositionWithMutation(
1785
1834
  {
@@ -4863,7 +4912,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
4863
4912
  } else {
4864
4913
  exp = isProp.exp;
4865
4914
  if (!exp) {
4866
- exp = createSimpleExpression(`is`, false, isProp.loc);
4915
+ exp = createSimpleExpression(`is`, false, isProp.arg.loc);
4867
4916
  }
4868
4917
  }
4869
4918
  if (exp) {
@@ -5367,7 +5416,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5367
5416
  };
5368
5417
  }
5369
5418
 
5370
- const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
5371
5419
  const transformOn$1 = (dir, node, context, augmentor) => {
5372
5420
  const { loc, modifiers, arg } = dir;
5373
5421
  if (!dir.exp && !modifiers.length) {
@@ -5411,8 +5459,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5411
5459
  }
5412
5460
  let shouldCache = context.cacheHandlers && !exp && !context.inVOnce;
5413
5461
  if (exp) {
5414
- const isMemberExp = isMemberExpression(exp.content);
5415
- const isInlineStatement = !(isMemberExp || fnExpRE.test(exp.content));
5462
+ const isMemberExp = isMemberExpression(exp);
5463
+ const isInlineStatement = !(isMemberExp || isFnExpression(exp));
5416
5464
  const hasMultipleStatements = exp.content.includes(`;`);
5417
5465
  {
5418
5466
  validateBrowserExpression(
@@ -5560,7 +5608,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5560
5608
  return createTransformProps();
5561
5609
  }
5562
5610
  const maybeRef = false;
5563
- if (!expString.trim() || !isMemberExpression(expString) && !maybeRef) {
5611
+ if (!expString.trim() || !isMemberExpression(exp) && !maybeRef) {
5564
5612
  context.onError(
5565
5613
  createCompilerError(42, exp.loc)
5566
5614
  );
@@ -5849,15 +5897,27 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
5849
5897
  const noopDirectiveTransform = () => ({ props: [] });
5850
5898
 
5851
5899
  const V_MODEL_RADIO = Symbol(`vModelRadio` );
5852
- const V_MODEL_CHECKBOX = Symbol(`vModelCheckbox` );
5900
+ const V_MODEL_CHECKBOX = Symbol(
5901
+ `vModelCheckbox`
5902
+ );
5853
5903
  const V_MODEL_TEXT = Symbol(`vModelText` );
5854
- const V_MODEL_SELECT = Symbol(`vModelSelect` );
5855
- const V_MODEL_DYNAMIC = Symbol(`vModelDynamic` );
5856
- const V_ON_WITH_MODIFIERS = Symbol(`vOnModifiersGuard` );
5857
- const V_ON_WITH_KEYS = Symbol(`vOnKeysGuard` );
5904
+ const V_MODEL_SELECT = Symbol(
5905
+ `vModelSelect`
5906
+ );
5907
+ const V_MODEL_DYNAMIC = Symbol(
5908
+ `vModelDynamic`
5909
+ );
5910
+ const V_ON_WITH_MODIFIERS = Symbol(
5911
+ `vOnModifiersGuard`
5912
+ );
5913
+ const V_ON_WITH_KEYS = Symbol(
5914
+ `vOnKeysGuard`
5915
+ );
5858
5916
  const V_SHOW = Symbol(`vShow` );
5859
5917
  const TRANSITION = Symbol(`Transition` );
5860
- const TRANSITION_GROUP = Symbol(`TransitionGroup` );
5918
+ const TRANSITION_GROUP = Symbol(
5919
+ `TransitionGroup`
5920
+ );
5861
5921
  registerRuntimeHelpers({
5862
5922
  [V_MODEL_RADIO]: `vModelRadio`,
5863
5923
  [V_MODEL_CHECKBOX]: `vModelCheckbox`,
@@ -6627,6 +6687,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
6627
6687
  exports.helperNameMap = helperNameMap;
6628
6688
  exports.injectProp = injectProp;
6629
6689
  exports.isCoreComponent = isCoreComponent;
6690
+ exports.isFnExpression = isFnExpression;
6691
+ exports.isFnExpressionBrowser = isFnExpressionBrowser;
6692
+ exports.isFnExpressionNode = isFnExpressionNode;
6630
6693
  exports.isFunctionType = isFunctionType;
6631
6694
  exports.isInDestructureAssignment = isInDestructureAssignment;
6632
6695
  exports.isInNewExpression = isInNewExpression;