@vue/compiler-sfc 3.6.0-alpha.1 → 3.6.0-alpha.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-sfc v3.6.0-alpha.1
2
+ * @vue/compiler-sfc v3.6.0-alpha.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -21612,7 +21612,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
21612
21612
  return generator.toJSON();
21613
21613
  }
21614
21614
 
21615
- const version = "3.6.0-alpha.1";
21615
+ const version = "3.6.0-alpha.2";
21616
21616
  const parseCache = parseCache$1;
21617
21617
  const errorMessages = {
21618
21618
  ...CompilerDOM.errorMessages,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.6.0-alpha.1
2
+ * @vue/compiler-sfc v3.6.0-alpha.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -44147,18 +44147,26 @@ function genFor(oper, context) {
44147
44147
  keyProp,
44148
44148
  idMap
44149
44149
  );
44150
- const patternFrag = [];
44150
+ const selectorDeclarations = [];
44151
+ const selectorSetup = [];
44151
44152
  for (let i = 0; i < selectorPatterns.length; i++) {
44152
44153
  const { selector } = selectorPatterns[i];
44153
44154
  const selectorName = `_selector${id}_${i}`;
44154
- patternFrag.push(
44155
+ selectorDeclarations.push(`let ${selectorName}`, NEWLINE);
44156
+ if (i === 0) {
44157
+ selectorSetup.push(`({ createSelector }) => {`, INDENT_START);
44158
+ }
44159
+ selectorSetup.push(
44155
44160
  NEWLINE,
44156
- `const ${selectorName} = `,
44157
- ...genCall(`n${id}.useSelector`, [
44161
+ `${selectorName} = `,
44162
+ ...genCall(`createSelector`, [
44158
44163
  `() => `,
44159
44164
  ...genExpression(selector, context)
44160
44165
  ])
44161
44166
  );
44167
+ if (i === selectorPatterns.length - 1) {
44168
+ selectorSetup.push(INDENT_END, NEWLINE, "}");
44169
+ }
44162
44170
  }
44163
44171
  const blockFn = context.withId(() => {
44164
44172
  const frag = [];
@@ -44166,25 +44174,25 @@ function genFor(oper, context) {
44166
44174
  if (selectorPatterns.length || keyOnlyBindingPatterns.length) {
44167
44175
  frag.push(
44168
44176
  ...genBlockContent(render, context, false, () => {
44169
- const patternFrag2 = [];
44177
+ const patternFrag = [];
44170
44178
  for (let i = 0; i < selectorPatterns.length; i++) {
44171
44179
  const { effect } = selectorPatterns[i];
44172
- patternFrag2.push(
44180
+ patternFrag.push(
44173
44181
  NEWLINE,
44174
44182
  `_selector${id}_${i}(() => {`,
44175
44183
  INDENT_START
44176
44184
  );
44177
44185
  for (const oper2 of effect.operations) {
44178
- patternFrag2.push(...genOperation(oper2, context));
44186
+ patternFrag.push(...genOperation(oper2, context));
44179
44187
  }
44180
- patternFrag2.push(INDENT_END, NEWLINE, `})`);
44188
+ patternFrag.push(INDENT_END, NEWLINE, `})`);
44181
44189
  }
44182
44190
  for (const { effect } of keyOnlyBindingPatterns) {
44183
44191
  for (const oper2 of effect.operations) {
44184
- patternFrag2.push(...genOperation(oper2, context));
44192
+ patternFrag.push(...genOperation(oper2, context));
44185
44193
  }
44186
44194
  }
44187
- return patternFrag2;
44195
+ return patternFrag;
44188
44196
  })
44189
44197
  );
44190
44198
  } else {
@@ -44206,16 +44214,17 @@ function genFor(oper, context) {
44206
44214
  }
44207
44215
  return [
44208
44216
  NEWLINE,
44217
+ ...selectorDeclarations,
44209
44218
  `const n${id} = `,
44210
44219
  ...genCall(
44211
- helper("createFor"),
44220
+ [helper("createFor"), "undefined"],
44212
44221
  sourceExpr,
44213
44222
  blockFn,
44214
44223
  genCallback(keyProp),
44215
- flags ? String(flags) : void 0
44224
+ flags ? String(flags) : void 0,
44225
+ selectorSetup.length ? selectorSetup : void 0
44216
44226
  // todo: hydrationNode
44217
- ),
44218
- ...patternFrag
44227
+ )
44219
44228
  ];
44220
44229
  function parseValueDestructure() {
44221
44230
  const map = /* @__PURE__ */ new Map();
@@ -44853,6 +44862,7 @@ function genCreateComponent(operation, context) {
44853
44862
  }
44854
44863
  function getUniqueHandlerName(context, name) {
44855
44864
  const { seenInlineHandlerNames } = context;
44865
+ name = genVarName(name);
44856
44866
  const count = seenInlineHandlerNames[name] || 0;
44857
44867
  seenInlineHandlerNames[name] = count + 1;
44858
44868
  return count === 0 ? name : `${name}${count}`;
@@ -46140,7 +46150,8 @@ const transformText = (node, context) => {
46140
46150
  }
46141
46151
  };
46142
46152
  function processInterpolation(context) {
46143
- const children = context.parent.node.children;
46153
+ const parentNode = context.parent.node;
46154
+ const children = parentNode.children;
46144
46155
  const nexts = children.slice(context.index);
46145
46156
  const idx = nexts.findIndex((n) => !isTextLike(n));
46146
46157
  const nodes = idx > -1 ? nexts.slice(0, idx) : nexts;
@@ -46148,9 +46159,15 @@ function processInterpolation(context) {
46148
46159
  if (prev && prev.type === 2) {
46149
46160
  nodes.unshift(prev);
46150
46161
  }
46162
+ const values = processTextLikeChildren(nodes, context);
46163
+ if (values.length === 0 && parentNode.type !== 0) {
46164
+ return;
46165
+ }
46151
46166
  context.template += " ";
46152
46167
  const id = context.reference();
46153
- const values = nodes.map((node) => createTextLikeExpression(node, context));
46168
+ if (values.length === 0) {
46169
+ return;
46170
+ }
46154
46171
  const nonConstantExps = values.filter((v) => !isConstantExpression(v));
46155
46172
  const isStatic = !nonConstantExps.length || nonConstantExps.every(
46156
46173
  (e) => isStaticExpression(e, context.options.bindingMetadata)
@@ -46170,7 +46187,7 @@ function processInterpolation(context) {
46170
46187
  }
46171
46188
  }
46172
46189
  function processTextContainer(children, context) {
46173
- const values = children.map((child) => createTextLikeExpression(child, context));
46190
+ const values = processTextLikeChildren(children, context);
46174
46191
  const literals = values.map(getLiteralExpressionValue);
46175
46192
  if (literals.every((l) => l != null)) {
46176
46193
  context.childrenTemplate = literals.map((l) => String(l));
@@ -46189,13 +46206,19 @@ function processTextContainer(children, context) {
46189
46206
  });
46190
46207
  }
46191
46208
  }
46192
- function createTextLikeExpression(node, context) {
46193
- markNonTemplate(node, context);
46194
- if (node.type === 2) {
46195
- return createSimpleExpression(node.content, true, node.loc);
46196
- } else {
46197
- return node.content;
46209
+ function processTextLikeChildren(nodes, context) {
46210
+ const exps = [];
46211
+ for (const node of nodes) {
46212
+ let exp;
46213
+ markNonTemplate(node, context);
46214
+ if (node.type === 2) {
46215
+ exp = createSimpleExpression(node.content, true, node.loc);
46216
+ } else {
46217
+ exp = node.content;
46218
+ }
46219
+ if (exp.content) exps.push(exp);
46198
46220
  }
46221
+ return exps;
46199
46222
  }
46200
46223
  function isTextLike(node) {
46201
46224
  return node.type === 5 || node.type === 2;
@@ -65512,7 +65535,7 @@ var __spreadValues = (a, b) => {
65512
65535
  }
65513
65536
  return a;
65514
65537
  };
65515
- const version = "3.6.0-alpha.1";
65538
+ const version = "3.6.0-alpha.2";
65516
65539
  const parseCache = parseCache$1;
65517
65540
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
65518
65541
  const walk = walk$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.6.0-alpha.1",
3
+ "version": "3.6.0-alpha.2",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -47,11 +47,11 @@
47
47
  "magic-string": "^0.30.17",
48
48
  "postcss": "^8.5.6",
49
49
  "source-map-js": "^1.2.1",
50
- "@vue/compiler-core": "3.6.0-alpha.1",
51
- "@vue/compiler-dom": "3.6.0-alpha.1",
52
- "@vue/compiler-ssr": "3.6.0-alpha.1",
53
- "@vue/compiler-vapor": "3.6.0-alpha.1",
54
- "@vue/shared": "3.6.0-alpha.1"
50
+ "@vue/compiler-core": "3.6.0-alpha.2",
51
+ "@vue/compiler-ssr": "3.6.0-alpha.2",
52
+ "@vue/compiler-dom": "3.6.0-alpha.2",
53
+ "@vue/compiler-vapor": "3.6.0-alpha.2",
54
+ "@vue/shared": "3.6.0-alpha.2"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@babel/types": "^7.27.6",