@vue/compiler-sfc 3.6.0-beta.5 → 3.6.0-beta.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.6.0-beta.5
2
+ * @vue/compiler-sfc v3.6.0-beta.6
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -204,38 +204,38 @@ function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd, defaultVar) {
204
204
  }
205
205
 
206
206
  //#endregion
207
- //#region \0@oxc-project+runtime@0.111.0/helpers/checkPrivateRedeclaration.js
207
+ //#region \0@oxc-project+runtime@0.112.0/helpers/checkPrivateRedeclaration.js
208
208
  function _checkPrivateRedeclaration(e, t) {
209
209
  if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
210
210
  }
211
211
 
212
212
  //#endregion
213
- //#region \0@oxc-project+runtime@0.111.0/helpers/classPrivateMethodInitSpec.js
213
+ //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateMethodInitSpec.js
214
214
  function _classPrivateMethodInitSpec(e, a) {
215
215
  _checkPrivateRedeclaration(e, a), a.add(e);
216
216
  }
217
217
 
218
218
  //#endregion
219
- //#region \0@oxc-project+runtime@0.111.0/helpers/classPrivateFieldInitSpec.js
219
+ //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldInitSpec.js
220
220
  function _classPrivateFieldInitSpec(e, t, a) {
221
221
  _checkPrivateRedeclaration(e, t), t.set(e, a);
222
222
  }
223
223
 
224
224
  //#endregion
225
- //#region \0@oxc-project+runtime@0.111.0/helpers/assertClassBrand.js
225
+ //#region \0@oxc-project+runtime@0.112.0/helpers/assertClassBrand.js
226
226
  function _assertClassBrand(e, t, n) {
227
227
  if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
228
228
  throw new TypeError("Private element is not present on this object");
229
229
  }
230
230
 
231
231
  //#endregion
232
- //#region \0@oxc-project+runtime@0.111.0/helpers/classPrivateFieldGet2.js
232
+ //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldGet2.js
233
233
  function _classPrivateFieldGet2(s, a) {
234
234
  return s.get(_assertClassBrand(s, a));
235
235
  }
236
236
 
237
237
  //#endregion
238
- //#region \0@oxc-project+runtime@0.111.0/helpers/classPrivateFieldSet2.js
238
+ //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldSet2.js
239
239
  function _classPrivateFieldSet2(s, a, r) {
240
240
  return s.set(_assertClassBrand(s, a), r), r;
241
241
  }
@@ -3316,7 +3316,6 @@ const trimPlugin = () => {
3316
3316
  };
3317
3317
  };
3318
3318
  trimPlugin.postcss = true;
3319
- var pluginTrim_default = trimPlugin;
3320
3319
 
3321
3320
  //#endregion
3322
3321
  //#region node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/util/unesc.js
@@ -6553,7 +6552,6 @@ function extractAndWrapNodes(parentNode) {
6553
6552
  }
6554
6553
  }
6555
6554
  scopedPlugin.postcss = true;
6556
- var pluginScoped_default = scopedPlugin;
6557
6555
 
6558
6556
  //#endregion
6559
6557
  //#region node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/base64.js
@@ -11587,8 +11585,8 @@ function doCompileStyle(options) {
11587
11585
  id: shortId,
11588
11586
  isProd
11589
11587
  }));
11590
- if (trim) plugins.push(pluginTrim_default());
11591
- if (scoped) plugins.push(pluginScoped_default(longId));
11588
+ if (trim) plugins.push(trimPlugin());
11589
+ if (scoped) plugins.push(scopedPlugin(longId));
11592
11590
  let cssModules;
11593
11591
  if (modules) {
11594
11592
  if (!options.isAsync) throw new Error("[@vue/compiler-sfc] `modules` option can only be used with compileStyleAsync().");
@@ -11841,7 +11839,7 @@ function resolveParserPlugins(lang, userPlugins, dts = false) {
11841
11839
  if (!userPlugins || !userPlugins.some((p) => p === "importAssertions" || p === "importAttributes" || (0, _vue_shared.isArray)(p) && p[0] === "importAttributes")) plugins.push("importAttributes");
11842
11840
  if (lang === "jsx" || lang === "tsx" || lang === "mtsx") plugins.push("jsx");
11843
11841
  else if (userPlugins) userPlugins = userPlugins.filter((p) => p !== "jsx");
11844
- if (lang === "ts" || lang === "mts" || lang === "tsx" || lang === "mtsx") {
11842
+ if (lang === "ts" || lang === "mts" || lang === "tsx" || lang === "cts" || lang === "mtsx") {
11845
11843
  plugins.push(["typescript", { dts }], "explicitResourceManagement");
11846
11844
  if (!userPlugins || !userPlugins.includes("decorators")) plugins.push("decorators-legacy");
11847
11845
  }
@@ -11997,7 +11995,7 @@ const range = (a, b, str) => {
11997
11995
  };
11998
11996
 
11999
11997
  //#endregion
12000
- //#region node_modules/.pnpm/@isaacs+brace-expansion@5.0.0/node_modules/@isaacs/brace-expansion/dist/esm/index.js
11998
+ //#region node_modules/.pnpm/@isaacs+brace-expansion@5.0.1/node_modules/@isaacs/brace-expansion/dist/esm/index.js
12001
11999
  const escSlash = "\0SLASH" + Math.random() + "\0";
12002
12000
  const escOpen = "\0OPEN" + Math.random() + "\0";
12003
12001
  const escClose = "\0CLOSE" + Math.random() + "\0";
@@ -12013,6 +12011,7 @@ const openPattern = /\\{/g;
12013
12011
  const closePattern = /\\}/g;
12014
12012
  const commaPattern = /\\,/g;
12015
12013
  const periodPattern = /\\./g;
12014
+ const EXPANSION_MAX = 1e5;
12016
12015
  function numeric(str) {
12017
12016
  return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
12018
12017
  }
@@ -12043,10 +12042,11 @@ function parseCommaParts(str) {
12043
12042
  parts.push.apply(parts, p);
12044
12043
  return parts;
12045
12044
  }
12046
- function expand(str) {
12045
+ function expand(str, options = {}) {
12047
12046
  if (!str) return [];
12047
+ const { max = EXPANSION_MAX } = options;
12048
12048
  if (str.slice(0, 2) === "{}") str = "\\{\\}" + str.slice(2);
12049
- return expand_(escapeBraces(str), true).map(unescapeBraces);
12049
+ return expand_(escapeBraces(str), max, true).map(unescapeBraces);
12050
12050
  }
12051
12051
  function embrace(str) {
12052
12052
  return "{" + str + "}";
@@ -12060,14 +12060,14 @@ function lte(i, y) {
12060
12060
  function gte(i, y) {
12061
12061
  return i >= y;
12062
12062
  }
12063
- function expand_(str, isTop) {
12063
+ function expand_(str, max, isTop) {
12064
12064
  /** @type {string[]} */
12065
12065
  const expansions = [];
12066
12066
  const m = balanced("{", "}", str);
12067
12067
  if (!m) return [str];
12068
12068
  const pre = m.pre;
12069
- const post = m.post.length ? expand_(m.post, false) : [""];
12070
- if (/\$$/.test(m.pre)) for (let k = 0; k < post.length; k++) {
12069
+ const post = m.post.length ? expand_(m.post, max, false) : [""];
12070
+ if (/\$$/.test(m.pre)) for (let k = 0; k < post.length && k < max; k++) {
12071
12071
  const expansion = pre + "{" + m.body + "}" + post[k];
12072
12072
  expansions.push(expansion);
12073
12073
  }
@@ -12079,7 +12079,7 @@ function expand_(str, isTop) {
12079
12079
  if (!isSequence && !isOptions) {
12080
12080
  if (m.post.match(/,(?!,).*\}/)) {
12081
12081
  str = m.pre + "{" + m.body + escClose + m.post;
12082
- return expand_(str);
12082
+ return expand_(str, max, true);
12083
12083
  }
12084
12084
  return [str];
12085
12085
  }
@@ -12088,7 +12088,7 @@ function expand_(str, isTop) {
12088
12088
  else {
12089
12089
  n = parseCommaParts(m.body);
12090
12090
  if (n.length === 1 && n[0] !== void 0) {
12091
- n = expand_(n[0], false).map(embrace);
12091
+ n = expand_(n[0], max, false).map(embrace);
12092
12092
  /* c8 ignore start */
12093
12093
  if (n.length === 1) return post.map((p) => m.pre + n[0] + p);
12094
12094
  }
@@ -12126,9 +12126,9 @@ function expand_(str, isTop) {
12126
12126
  }
12127
12127
  } else {
12128
12128
  N = [];
12129
- for (let j = 0; j < n.length; j++) N.push.apply(N, expand_(n[j], false));
12129
+ for (let j = 0; j < n.length; j++) N.push.apply(N, expand_(n[j], max, false));
12130
12130
  }
12131
- for (let j = 0; j < N.length; j++) for (let k = 0; k < post.length; k++) {
12131
+ for (let j = 0; j < N.length; j++) for (let k = 0; k < post.length && expansions.length < max; k++) {
12132
12132
  const expansion = pre + N[j] + post[k];
12133
12133
  if (!isTop || isSequence || expansion) expansions.push(expansion);
12134
12134
  }
@@ -12137,7 +12137,7 @@ function expand_(str, isTop) {
12137
12137
  }
12138
12138
 
12139
12139
  //#endregion
12140
- //#region node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/assert-valid-pattern.js
12140
+ //#region node_modules/.pnpm/minimatch@10.1.2/node_modules/minimatch/dist/esm/assert-valid-pattern.js
12141
12141
  const MAX_PATTERN_LENGTH = 1024 * 64;
12142
12142
  const assertValidPattern = (pattern) => {
12143
12143
  if (typeof pattern !== "string") throw new TypeError("invalid pattern");
@@ -12145,7 +12145,7 @@ const assertValidPattern = (pattern) => {
12145
12145
  };
12146
12146
 
12147
12147
  //#endregion
12148
- //#region node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/brace-expressions.js
12148
+ //#region node_modules/.pnpm/minimatch@10.1.2/node_modules/minimatch/dist/esm/brace-expressions.js
12149
12149
  const posixClasses = {
12150
12150
  "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
12151
12151
  "[:alpha:]": ["\\p{L}\\p{Nl}", true],
@@ -12267,7 +12267,7 @@ const parseClass = (glob, position) => {
12267
12267
  };
12268
12268
 
12269
12269
  //#endregion
12270
- //#region node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/unescape.js
12270
+ //#region node_modules/.pnpm/minimatch@10.1.2/node_modules/minimatch/dist/esm/unescape.js
12271
12271
  /**
12272
12272
  * Un-escape a string that has been escaped with {@link escape}.
12273
12273
  *
@@ -12293,7 +12293,7 @@ const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}
12293
12293
  };
12294
12294
 
12295
12295
  //#endregion
12296
- //#region node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/ast.js
12296
+ //#region node_modules/.pnpm/minimatch@10.1.2/node_modules/minimatch/dist/esm/ast.js
12297
12297
  var _AST;
12298
12298
  const types = new Set([
12299
12299
  "!",
@@ -12672,7 +12672,7 @@ function _parseGlob(glob, hasMagic, noEmpty = false) {
12672
12672
  }
12673
12673
 
12674
12674
  //#endregion
12675
- //#region node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/escape.js
12675
+ //#region node_modules/.pnpm/minimatch@10.1.2/node_modules/minimatch/dist/esm/escape.js
12676
12676
  /**
12677
12677
  * Escape all magic characters in a glob pattern.
12678
12678
  *
@@ -12691,7 +12691,7 @@ const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {})
12691
12691
  };
12692
12692
 
12693
12693
  //#endregion
12694
- //#region node_modules/.pnpm/minimatch@10.1.1/node_modules/minimatch/dist/esm/index.js
12694
+ //#region node_modules/.pnpm/minimatch@10.1.2/node_modules/minimatch/dist/esm/index.js
12695
12695
  const minimatch = (p, pattern, options = {}) => {
12696
12696
  assertValidPattern(pattern);
12697
12697
  if (!options.nocomment && pattern.charAt(0) === "#") return false;
@@ -13648,11 +13648,17 @@ function importSourceToScope(ctx, node, scope, source) {
13648
13648
  } else return ctx.error(`Failed to resolve import source ${JSON.stringify(source)}.`, node, scope);
13649
13649
  }
13650
13650
  function resolveExt(filename, fs) {
13651
- filename = filename.replace(/\.js$/, "");
13651
+ let moduleType = "u";
13652
+ if (filename.endsWith(".mjs")) moduleType = "m";
13653
+ else if (filename.endsWith(".cjs")) moduleType = "c";
13654
+ filename = filename.replace(/\.[cm]?jsx?$/, "");
13652
13655
  const tryResolve = (filename) => {
13653
13656
  if (fs.fileExists(filename)) return filename;
13654
13657
  };
13655
- return tryResolve(filename) || tryResolve(filename + `.ts`) || tryResolve(filename + `.tsx`) || tryResolve(filename + `.d.ts`) || tryResolve(joinPaths(filename, `index.ts`)) || tryResolve(joinPaths(filename, `index.tsx`)) || tryResolve(joinPaths(filename, `index.d.ts`));
13658
+ const resolveTs = () => tryResolve(filename + `.ts`) || tryResolve(filename + `.tsx`) || tryResolve(filename + `.d.ts`);
13659
+ const resolveMts = () => tryResolve(filename + `.mts`) || tryResolve(filename + `.d.mts`);
13660
+ const resolveCts = () => tryResolve(filename + `.cts`) || tryResolve(filename + `.d.cts`);
13661
+ return tryResolve(filename) || (moduleType === "m" ? resolveMts() || resolveTs() : moduleType === "c" ? resolveCts() || resolveTs() : resolveTs() || resolveMts() || resolveCts()) || tryResolve(joinPaths(filename, `index.ts`)) || tryResolve(joinPaths(filename, `index.tsx`)) || tryResolve(joinPaths(filename, `index.d.ts`));
13656
13662
  }
13657
13663
  const tsConfigCache = createCache();
13658
13664
  const tsConfigRefMap = /* @__PURE__ */ new Map();
@@ -13736,8 +13742,8 @@ function fileToScope(ctx, filename, asGlobal = false) {
13736
13742
  }
13737
13743
  function parseFile(filename, content, fs, parserPlugins) {
13738
13744
  const ext = (0, path.extname)(filename);
13739
- if (ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".mtsx") return (0, _babel_parser.parse)(content, {
13740
- plugins: resolveParserPlugins(ext.slice(1), parserPlugins, /\.d\.m?ts$/.test(filename)),
13745
+ if (ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".cts" || ext === ".mtsx") return (0, _babel_parser.parse)(content, {
13746
+ plugins: resolveParserPlugins(ext.slice(1), parserPlugins, /\.d\.[cm]?ts$/.test(filename)),
13741
13747
  sourceType: "module"
13742
13748
  }).program.body;
13743
13749
  const isUnknownTypeSource = !/\.[cm]?[tj]sx?$/.test(filename);
@@ -14367,7 +14373,18 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
14367
14373
  return resolveObjectKey(node.key, node.computed) === key;
14368
14374
  });
14369
14375
  if (prop) if (prop.type === "ObjectProperty") defaultString = `default: ${ctx.getString(prop.value)}`;
14370
- else defaultString = `${prop.async ? "async " : ""}${prop.kind !== "method" ? `${prop.kind} ` : ""}default() ${ctx.getString(prop.body)}`;
14376
+ else {
14377
+ let paramsString = "";
14378
+ if (prop.params.length) {
14379
+ const start = prop.params[0].start;
14380
+ const end = prop.params[prop.params.length - 1].end;
14381
+ paramsString = ctx.getString({
14382
+ start,
14383
+ end
14384
+ });
14385
+ }
14386
+ defaultString = `${prop.async ? "async " : ""}${prop.kind !== "method" ? `${prop.kind} ` : ""}default(${paramsString}) ${ctx.getString(prop.body)}`;
14387
+ }
14371
14388
  }
14372
14389
  const finalKey = getEscapedPropName(key);
14373
14390
  if (!ctx.options.isProd) return `${finalKey}: { ${concatStrings([
@@ -15228,7 +15245,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
15228
15245
 
15229
15246
  //#endregion
15230
15247
  //#region packages/compiler-sfc/src/index.ts
15231
- const version = "3.6.0-beta.5";
15248
+ const version = "3.6.0-beta.6";
15232
15249
  const parseCache = parseCache$1;
15233
15250
  const errorMessages = {
15234
15251
  ..._vue_compiler_dom.errorMessages,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.6.0-beta.5
2
+ * @vue/compiler-sfc v3.6.0-beta.6
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -50,7 +50,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
50
50
  });
51
51
 
52
52
  //#endregion
53
- //#region \0@oxc-project+runtime@0.111.0/helpers/typeof.js
53
+ //#region \0@oxc-project+runtime@0.112.0/helpers/typeof.js
54
54
  function _typeof(o) {
55
55
  "@babel/helpers - typeof";
56
56
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -62,7 +62,7 @@ function _typeof(o) {
62
62
  var init_typeof = __esmMin((() => {}));
63
63
 
64
64
  //#endregion
65
- //#region \0@oxc-project+runtime@0.111.0/helpers/toPrimitive.js
65
+ //#region \0@oxc-project+runtime@0.112.0/helpers/toPrimitive.js
66
66
  function toPrimitive(t, r) {
67
67
  if ("object" != _typeof(t) || !t) return t;
68
68
  var e = t[Symbol.toPrimitive];
@@ -78,7 +78,7 @@ var init_toPrimitive = __esmMin((() => {
78
78
  }));
79
79
 
80
80
  //#endregion
81
- //#region \0@oxc-project+runtime@0.111.0/helpers/toPropertyKey.js
81
+ //#region \0@oxc-project+runtime@0.112.0/helpers/toPropertyKey.js
82
82
  function toPropertyKey(t) {
83
83
  var i = toPrimitive(t, "string");
84
84
  return "symbol" == _typeof(i) ? i : i + "";
@@ -89,7 +89,7 @@ var init_toPropertyKey = __esmMin((() => {
89
89
  }));
90
90
 
91
91
  //#endregion
92
- //#region \0@oxc-project+runtime@0.111.0/helpers/defineProperty.js
92
+ //#region \0@oxc-project+runtime@0.112.0/helpers/defineProperty.js
93
93
  function _defineProperty(e, r, t) {
94
94
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
95
95
  value: t,
@@ -103,7 +103,7 @@ var init_defineProperty = __esmMin((() => {
103
103
  }));
104
104
 
105
105
  //#endregion
106
- //#region \0@oxc-project+runtime@0.111.0/helpers/objectSpread2.js
106
+ //#region \0@oxc-project+runtime@0.112.0/helpers/objectSpread2.js
107
107
  function ownKeys(e, r) {
108
108
  var t = Object.keys(e);
109
109
  if (Object.getOwnPropertySymbols) {
@@ -3649,7 +3649,7 @@ const errorMessages$1 = {
3649
3649
  };
3650
3650
 
3651
3651
  //#endregion
3652
- //#region node_modules/.pnpm/@babel+parser@7.28.6/node_modules/@babel/parser/lib/index.js
3652
+ //#region node_modules/.pnpm/@babel+parser@7.29.0/node_modules/@babel/parser/lib/index.js
3653
3653
  var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
3654
3654
  Object.defineProperty(exports, "__esModule", { value: true });
3655
3655
  function _objectWithoutPropertiesLoose(r, e) {
@@ -12081,7 +12081,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
12081
12081
  return this.finishCallExpression(node, state.optionalChainMember);
12082
12082
  }
12083
12083
  const tokenType = this.state.type;
12084
- if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) return;
12084
+ if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenType !== 93 && tokenType !== 120 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) return;
12085
12085
  const node = this.startNodeAt(startLoc);
12086
12086
  node.expression = base;
12087
12087
  node.typeParameters = typeArguments;
@@ -12441,7 +12441,17 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
12441
12441
  }
12442
12442
  parseClassSuper(node) {
12443
12443
  super.parseClassSuper(node);
12444
- if (node.superClass && (this.match(47) || this.match(51))) node.superTypeParameters = this.tsParseTypeArgumentsInExpression();
12444
+ if (node.superClass) {
12445
+ if (node.superClass.type === "TSInstantiationExpression") {
12446
+ const tsInstantiationExpression = node.superClass;
12447
+ const superClass = tsInstantiationExpression.expression;
12448
+ this.takeSurroundingComments(superClass, superClass.start, superClass.end);
12449
+ const superTypeArguments = tsInstantiationExpression.typeParameters;
12450
+ this.takeSurroundingComments(superTypeArguments, superTypeArguments.start, superTypeArguments.end);
12451
+ node.superClass = superClass;
12452
+ node.superTypeParameters = superTypeArguments;
12453
+ } else if (this.match(47) || this.match(51)) node.superTypeParameters = this.tsParseTypeArgumentsInExpression();
12454
+ }
12445
12455
  if (this.eatContextual(113)) node.implements = this.tsParseHeritageClause("implements");
12446
12456
  }
12447
12457
  parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
@@ -16213,7 +16223,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
16213
16223
  }));
16214
16224
 
16215
16225
  //#endregion
16216
- //#region \0@oxc-project+runtime@0.111.0/helpers/asyncToGenerator.js
16226
+ //#region \0@oxc-project+runtime@0.112.0/helpers/asyncToGenerator.js
16217
16227
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
16218
16228
  try {
16219
16229
  var i = n[a](c), u = i.value;
@@ -24680,7 +24690,7 @@ function wrapTemplate(node, dirs) {
24680
24690
  const reserved = [];
24681
24691
  const pass = [];
24682
24692
  node.props.forEach((prop) => {
24683
- if (prop.type === 7 && dirs.includes(prop.name)) reserved.push(prop);
24693
+ if (prop.type === 7 && (dirs.includes(prop.name) || prop.name === "bind" && prop.arg && prop.arg.type === 4 && prop.arg.content === "key" && dirs.includes("key"))) reserved.push(prop);
24684
24694
  else pass.push(prop);
24685
24695
  });
24686
24696
  return extend({}, node, {
@@ -24738,13 +24748,6 @@ function getLiteralExpressionValue(exp, excludeNumber) {
24738
24748
  }
24739
24749
  return exp.isStatic ? exp.content : null;
24740
24750
  }
24741
- function isInTransition(context) {
24742
- const parentNode = context.parent && context.parent.node;
24743
- return !!(parentNode && isTransitionNode(parentNode));
24744
- }
24745
- function isTransitionNode(node) {
24746
- return node.type === 1 && isTransitionTag(node.tag);
24747
- }
24748
24751
  function isTransitionTag(tag) {
24749
24752
  tag = tag.toLowerCase();
24750
24753
  return tag === "transition" || tag === "vaportransition";
@@ -25201,8 +25204,10 @@ const IRNodeTypes = {
25201
25204
  "14": "IF",
25202
25205
  "FOR": 15,
25203
25206
  "15": "FOR",
25204
- "GET_TEXT_CHILD": 16,
25205
- "16": "GET_TEXT_CHILD"
25207
+ "KEY": 16,
25208
+ "16": "KEY",
25209
+ "GET_TEXT_CHILD": 17,
25210
+ "17": "GET_TEXT_CHILD"
25206
25211
  };
25207
25212
  const DynamicFlag = {
25208
25213
  "NONE": 0,
@@ -25216,7 +25221,7 @@ const DynamicFlag = {
25216
25221
  };
25217
25222
  function isBlockOperation(op) {
25218
25223
  const type = op.type;
25219
- return type === 11 || type === 12 || type === 14 || type === 15;
25224
+ return type === 11 || type === 12 || type === 14 || type === 16 || type === 15;
25220
25225
  }
25221
25226
 
25222
25227
  //#endregion
@@ -26036,18 +26041,19 @@ function genPropValue(values, context) {
26036
26041
  }
26037
26042
  function getRuntimeHelper(tag, key, modifier) {
26038
26043
  const tagName = tag.toUpperCase();
26039
- if (isSVGTag(tag)) return extend({ isSVG: true }, helpers.setAttr);
26040
- if (modifier) if (modifier === ".") return getSpecialHelper(key, tagName) || helpers.setDOMProp;
26041
- else return helpers.setAttr;
26042
- const helper = getSpecialHelper(key, tagName);
26044
+ const isSVG = isSVGTag(tag);
26045
+ if (modifier) if (modifier === ".") return getSpecialHelper(key, tagName, isSVG) || helpers.setDOMProp;
26046
+ else return isSVG ? extend({ isSVG: true }, helpers.setAttr) : helpers.setAttr;
26047
+ const helper = getSpecialHelper(key, tagName, isSVG);
26043
26048
  if (helper) return helper;
26044
26049
  if (/aria[A-Z]/.test(key)) return helpers.setDOMProp;
26050
+ if (isSVG) return extend({ isSVG: true }, helpers.setAttr);
26045
26051
  if (shouldSetAsAttr(tagName, key) || key.includes("-")) return helpers.setAttr;
26046
26052
  return helpers.setProp;
26047
26053
  }
26048
- function getSpecialHelper(keyName, tagName) {
26054
+ function getSpecialHelper(keyName, tagName, isSVG) {
26049
26055
  if (keyName === "value" && canSetValueDirectly(tagName)) return helpers.setValue;
26050
- else if (keyName === "class") return helpers.setClass;
26056
+ else if (keyName === "class") return extend({ isSVG }, helpers.setClass);
26051
26057
  else if (keyName === "style") return helpers.setStyle;
26052
26058
  else if (keyName === "innerHTML") return helpers.setHtml;
26053
26059
  else if (keyName === "textContent") return helpers.setText;
@@ -26461,7 +26467,7 @@ function genSlotBlockWithProps(oper, context) {
26461
26467
  let propsName;
26462
26468
  let exitScope;
26463
26469
  let depth;
26464
- const { props, key, node } = oper;
26470
+ const { props, node } = oper;
26465
26471
  const idToPathMap = props ? parseValueDestructure(props, context) : /* @__PURE__ */ new Map();
26466
26472
  if (props) if (props.ast) {
26467
26473
  [depth, exitScope] = context.enterScope();
@@ -26471,16 +26477,6 @@ function genSlotBlockWithProps(oper, context) {
26471
26477
  if (propsName) idMap[propsName] = null;
26472
26478
  let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
26473
26479
  exitScope && exitScope();
26474
- if (key) blockFn = [
26475
- `() => {`,
26476
- INDENT_START,
26477
- NEWLINE,
26478
- `return `,
26479
- ...genCall(context.helper("createKeyedFragment"), [`() => `, ...genExpression(key, context)], blockFn),
26480
- INDENT_END,
26481
- NEWLINE,
26482
- `}`
26483
- ];
26484
26480
  if (node.type === 1) {
26485
26481
  if (needsVaporCtx(oper)) blockFn = [
26486
26482
  `${context.helper("withVaporCtx")}(`,
@@ -26554,6 +26550,20 @@ function genSlotOutlet(oper, context) {
26554
26550
  return frag;
26555
26551
  }
26556
26552
 
26553
+ //#endregion
26554
+ //#region packages/compiler-vapor/src/generators/key.ts
26555
+ function genKey(oper, context) {
26556
+ const { id, value, block } = oper;
26557
+ const [frag, push] = buildCodeFragment();
26558
+ const blockFn = genBlock(block, context);
26559
+ push(NEWLINE, `const n${id} = `, ...genCall(context.helper("createKeyedFragment"), [
26560
+ `() => (`,
26561
+ ...genExpression(value, context),
26562
+ ")"
26563
+ ], blockFn));
26564
+ return frag;
26565
+ }
26566
+
26557
26567
  //#endregion
26558
26568
  //#region packages/compiler-vapor/src/generators/operation.ts
26559
26569
  function genOperations(opers, context) {
@@ -26580,10 +26590,11 @@ function genOperation(oper, context) {
26580
26590
  case 10: return genPrependNode(oper, context);
26581
26591
  case 14: return genIf(oper, context);
26582
26592
  case 15: return genFor(oper, context);
26593
+ case 16: return genKey(oper, context);
26583
26594
  case 11: return genCreateComponent(oper, context);
26584
26595
  case 12: return genSlotOutlet(oper, context);
26585
26596
  case 13: return genBuiltinDirective(oper, context);
26586
- case 16: return genGetTextChild(oper, context);
26597
+ case 17: return genGetTextChild(oper, context);
26587
26598
  default:
26588
26599
  const exhaustiveCheck = oper;
26589
26600
  throw new Error(`Unhandled operation type in genOperation: ${exhaustiveCheck}`);
@@ -26660,6 +26671,10 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`) {
26660
26671
  let prev;
26661
26672
  for (const [index, child] of children.entries()) {
26662
26673
  if (child.flags & 2) offset--;
26674
+ if (child.flags & 4 && child.template != null) {
26675
+ push(...genSelf(child, context));
26676
+ continue;
26677
+ }
26663
26678
  const id = child.flags & 1 ? child.flags & 4 ? child.anchor : child.id : void 0;
26664
26679
  if (id === void 0 && !child.hasDynamicChild) {
26665
26680
  push(...genSelf(child, context));
@@ -27257,7 +27272,7 @@ const transformVText = (dir, node, context) => {
27257
27272
  context.childrenTemplate = [" "];
27258
27273
  const isComponent = node.tagType === 1;
27259
27274
  if (!isComponent) context.registerOperation({
27260
- type: 16,
27275
+ type: 17,
27261
27276
  parent: context.reference()
27262
27277
  });
27263
27278
  context.registerEffect([exp], {
@@ -27450,9 +27465,16 @@ function processInterpolation(context) {
27450
27465
  if (prev && prev.type === 2) nodes.unshift(prev);
27451
27466
  const values = processTextLikeChildren(nodes, context);
27452
27467
  if (values.length === 0 && parentNode.type !== 0) return;
27468
+ const literalValues = values.map((v) => getLiteralExpressionValue(v));
27469
+ if (literalValues.every((v) => v != null) && parentNode.type !== 0) {
27470
+ const text = literalValues.join("");
27471
+ const isElementChild = parentNode.type === 1 && parentNode.tagType === 0;
27472
+ context.template += isElementChild ? escapeHtml(text) : text;
27473
+ return;
27474
+ }
27453
27475
  context.template += " ";
27454
27476
  const id = context.reference();
27455
- if (values.length === 0 || values.every((v) => getLiteralExpressionValue(v) != null) && parentNode.type !== 0) return;
27477
+ if (values.length === 0) return;
27456
27478
  context.registerEffect(values, {
27457
27479
  type: 4,
27458
27480
  element: id,
@@ -27466,7 +27488,7 @@ function processTextContainer(children, context) {
27466
27488
  else {
27467
27489
  context.childrenTemplate = [" "];
27468
27490
  context.registerOperation({
27469
- type: 16,
27491
+ type: 17,
27470
27492
  parent: context.reference()
27471
27493
  });
27472
27494
  context.registerEffect(values, {
@@ -27607,7 +27629,7 @@ function processIf(node, dir, context) {
27607
27629
  id,
27608
27630
  condition: dir.exp,
27609
27631
  positive: branch,
27610
- index: isInTransition(context) ? context.root.nextIfIndex() : void 0,
27632
+ index: context.root.nextIfIndex(),
27611
27633
  once: context.inVOnce || isStaticExpression(dir.exp, context.options.bindingMetadata)
27612
27634
  };
27613
27635
  };
@@ -27640,7 +27662,7 @@ function processIf(node, dir, context) {
27640
27662
  id: -1,
27641
27663
  condition: dir.exp,
27642
27664
  positive: branch,
27643
- index: isInTransition(context) ? context.root.nextIfIndex() : void 0,
27665
+ index: context.root.nextIfIndex(),
27644
27666
  once: context.inVOnce || isStaticExpression(dir.exp, context.options.bindingMetadata)
27645
27667
  };
27646
27668
  return () => onExit();
@@ -27675,7 +27697,7 @@ function processFor(node, dir, context) {
27675
27697
  const keyProp = findProp(node, "key");
27676
27698
  const keyProperty = keyProp && propToExpression(keyProp);
27677
27699
  const isComponent = node.tagType === 1 || isTemplateWithSingleComponent(node);
27678
- context.node = node = wrapTemplate(node, ["for"]);
27700
+ context.node = node = wrapTemplate(node, ["for", "key"]);
27679
27701
  context.dynamic.flags |= 6;
27680
27702
  const id = context.reference();
27681
27703
  const render = newBlock(node);
@@ -27789,13 +27811,6 @@ function transformComponentSlot(node, dir, context) {
27789
27811
  markNonTemplate(n, context);
27790
27812
  });
27791
27813
  const [block, onExit] = createSlotBlock(node, dir, context);
27792
- if (isTransitionNode(node) && nonSlotTemplateChildren.length) {
27793
- const nonCommentChild = nonSlotTemplateChildren.find((n) => !isCommentOrWhitespace(n));
27794
- if (nonCommentChild) {
27795
- const keyProp = findProp(nonCommentChild, "key");
27796
- if (keyProp) block.key = keyProp.exp;
27797
- }
27798
- }
27799
27814
  const { slots } = context;
27800
27815
  return () => {
27801
27816
  onExit();
@@ -27914,6 +27929,31 @@ function hasMultipleChildren(node) {
27914
27929
  return children.length > 1;
27915
27930
  }
27916
27931
 
27932
+ //#endregion
27933
+ //#region packages/compiler-vapor/src/transforms/transformKey.ts
27934
+ const transformKey = (node, context) => {
27935
+ if (node.type !== 1 || context.inVOnce || findDir(node, "for")) return;
27936
+ const dir = findProp(node, "key", true, true);
27937
+ if (!dir || dir.type === 6) return;
27938
+ let value;
27939
+ value = dir.exp || normalizeBindShorthand(dir.arg, context);
27940
+ if (isStaticExpression(value, context.options.bindingMetadata)) return;
27941
+ let id = context.reference();
27942
+ context.dynamic.flags |= 6;
27943
+ context.node = node = wrapTemplate(node, ["key"]);
27944
+ const block = newBlock(node);
27945
+ const exitBlock = context.enterBlock(block);
27946
+ return () => {
27947
+ exitBlock();
27948
+ context.dynamic.operation = {
27949
+ type: 16,
27950
+ id,
27951
+ value,
27952
+ block
27953
+ };
27954
+ };
27955
+ };
27956
+
27917
27957
  //#endregion
27918
27958
  //#region packages/compiler-vapor/src/compile.ts
27919
27959
  function compile$1(source, options = {}) {
@@ -27938,6 +27978,7 @@ function getBaseTransformPreset() {
27938
27978
  transformVOnce,
27939
27979
  transformVIf,
27940
27980
  transformVFor,
27981
+ transformKey,
27941
27982
  transformSlotOutlet,
27942
27983
  transformTemplateRef,
27943
27984
  transformElement,
@@ -27995,6 +28036,7 @@ var src_exports$1 = /* @__PURE__ */ __exportAll({
27995
28036
  transformChildren: () => transformChildren,
27996
28037
  transformComment: () => transformComment,
27997
28038
  transformElement: () => transformElement,
28039
+ transformKey: () => transformKey,
27998
28040
  transformSlotOutlet: () => transformSlotOutlet,
27999
28041
  transformTemplateRef: () => transformTemplateRef,
28000
28042
  transformText: () => transformText,
@@ -30120,7 +30162,7 @@ var require_document = /* @__PURE__ */ __commonJSMin(((exports, module) => {
30120
30162
  }));
30121
30163
 
30122
30164
  //#endregion
30123
- //#region \0@oxc-project+runtime@0.111.0/helpers/objectWithoutPropertiesLoose.js
30165
+ //#region \0@oxc-project+runtime@0.112.0/helpers/objectWithoutPropertiesLoose.js
30124
30166
  function _objectWithoutPropertiesLoose(r, e) {
30125
30167
  if (null == r) return {};
30126
30168
  var t = {};
@@ -30133,7 +30175,7 @@ function _objectWithoutPropertiesLoose(r, e) {
30133
30175
  var init_objectWithoutPropertiesLoose = __esmMin((() => {}));
30134
30176
 
30135
30177
  //#endregion
30136
- //#region \0@oxc-project+runtime@0.111.0/helpers/objectWithoutProperties.js
30178
+ //#region \0@oxc-project+runtime@0.112.0/helpers/objectWithoutProperties.js
30137
30179
  function _objectWithoutProperties(e, t) {
30138
30180
  if (null == e) return {};
30139
30181
  var o, r, i = _objectWithoutPropertiesLoose(e, t);
@@ -32332,7 +32374,6 @@ const trimPlugin = () => {
32332
32374
  };
32333
32375
  };
32334
32376
  trimPlugin.postcss = true;
32335
- var pluginTrim_default = trimPlugin;
32336
32377
 
32337
32378
  //#endregion
32338
32379
  //#region node_modules/.pnpm/postcss-selector-parser@7.1.1/node_modules/postcss-selector-parser/dist/util/unesc.js
@@ -35618,7 +35659,6 @@ function extractAndWrapNodes(parentNode) {
35618
35659
  }
35619
35660
  }
35620
35661
  scopedPlugin.postcss = true;
35621
- var pluginScoped_default = scopedPlugin;
35622
35662
 
35623
35663
  //#endregion
35624
35664
  //#region node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/base64.js
@@ -37807,8 +37847,8 @@ function doCompileStyle(options) {
37807
37847
  id: shortId,
37808
37848
  isProd
37809
37849
  }));
37810
- if (trim) plugins.push(pluginTrim_default());
37811
- if (scoped) plugins.push(pluginScoped_default(longId));
37850
+ if (trim) plugins.push(trimPlugin());
37851
+ if (scoped) plugins.push(scopedPlugin(longId));
37812
37852
  let cssModules;
37813
37853
  if (modules) throw new Error("[@vue/compiler-sfc] `modules` option is not supported in the browser build.");
37814
37854
  const postCSSOptions = _objectSpread2(_objectSpread2({}, postcssOptions), {}, {
@@ -39049,7 +39089,7 @@ function resolveParserPlugins(lang, userPlugins, dts = false) {
39049
39089
  if (!userPlugins || !userPlugins.some((p) => p === "importAssertions" || p === "importAttributes" || isArray$3(p) && p[0] === "importAttributes")) plugins.push("importAttributes");
39050
39090
  if (lang === "jsx" || lang === "tsx" || lang === "mtsx") plugins.push("jsx");
39051
39091
  else if (userPlugins) userPlugins = userPlugins.filter((p) => p !== "jsx");
39052
- if (lang === "ts" || lang === "mts" || lang === "tsx" || lang === "mtsx") {
39092
+ if (lang === "ts" || lang === "mts" || lang === "tsx" || lang === "cts" || lang === "mtsx") {
39053
39093
  plugins.push(["typescript", { dts }], "explicitResourceManagement");
39054
39094
  if (!userPlugins || !userPlugins.includes("decorators")) plugins.push("decorators-legacy");
39055
39095
  }
@@ -39542,11 +39582,17 @@ function importSourceToScope(ctx, node, scope, source) {
39542
39582
  } else return ctx.error(`Failed to resolve import source ${JSON.stringify(source)}.`, node, scope);
39543
39583
  }
39544
39584
  function resolveExt(filename, fs) {
39545
- filename = filename.replace(/\.js$/, "");
39585
+ let moduleType = "u";
39586
+ if (filename.endsWith(".mjs")) moduleType = "m";
39587
+ else if (filename.endsWith(".cjs")) moduleType = "c";
39588
+ filename = filename.replace(/\.[cm]?jsx?$/, "");
39546
39589
  const tryResolve = (filename) => {
39547
39590
  if (fs.fileExists(filename)) return filename;
39548
39591
  };
39549
- return tryResolve(filename) || tryResolve(filename + `.ts`) || tryResolve(filename + `.tsx`) || tryResolve(filename + `.d.ts`) || tryResolve(joinPaths(filename, `index.ts`)) || tryResolve(joinPaths(filename, `index.tsx`)) || tryResolve(joinPaths(filename, `index.d.ts`));
39592
+ const resolveTs = () => tryResolve(filename + `.ts`) || tryResolve(filename + `.tsx`) || tryResolve(filename + `.d.ts`);
39593
+ const resolveMts = () => tryResolve(filename + `.mts`) || tryResolve(filename + `.d.mts`);
39594
+ const resolveCts = () => tryResolve(filename + `.cts`) || tryResolve(filename + `.d.cts`);
39595
+ return tryResolve(filename) || (moduleType === "m" ? resolveMts() || resolveTs() : moduleType === "c" ? resolveCts() || resolveTs() : resolveTs() || resolveMts() || resolveCts()) || tryResolve(joinPaths(filename, `index.ts`)) || tryResolve(joinPaths(filename, `index.tsx`)) || tryResolve(joinPaths(filename, `index.d.ts`));
39550
39596
  }
39551
39597
  const tsConfigCache = createCache();
39552
39598
  const tsConfigRefMap = /* @__PURE__ */ new Map();
@@ -39574,8 +39620,8 @@ function fileToScope(ctx, filename, asGlobal = false) {
39574
39620
  }
39575
39621
  function parseFile(filename, content, fs, parserPlugins) {
39576
39622
  const ext = extname(filename);
39577
- if (ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".mtsx") return (0, import_lib.parse)(content, {
39578
- plugins: resolveParserPlugins(ext.slice(1), parserPlugins, /\.d\.m?ts$/.test(filename)),
39623
+ if (ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".cts" || ext === ".mtsx") return (0, import_lib.parse)(content, {
39624
+ plugins: resolveParserPlugins(ext.slice(1), parserPlugins, /\.d\.[cm]?ts$/.test(filename)),
39579
39625
  sourceType: "module"
39580
39626
  }).program.body;
39581
39627
  const isUnknownTypeSource = !/\.[cm]?[tj]sx?$/.test(filename);
@@ -40205,7 +40251,18 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
40205
40251
  return resolveObjectKey(node.key, node.computed) === key;
40206
40252
  });
40207
40253
  if (prop) if (prop.type === "ObjectProperty") defaultString = `default: ${ctx.getString(prop.value)}`;
40208
- else defaultString = `${prop.async ? "async " : ""}${prop.kind !== "method" ? `${prop.kind} ` : ""}default() ${ctx.getString(prop.body)}`;
40254
+ else {
40255
+ let paramsString = "";
40256
+ if (prop.params.length) {
40257
+ const start = prop.params[0].start;
40258
+ const end = prop.params[prop.params.length - 1].end;
40259
+ paramsString = ctx.getString({
40260
+ start,
40261
+ end
40262
+ });
40263
+ }
40264
+ defaultString = `${prop.async ? "async " : ""}${prop.kind !== "method" ? `${prop.kind} ` : ""}default(${paramsString}) ${ctx.getString(prop.body)}`;
40265
+ }
40209
40266
  }
40210
40267
  const finalKey = getEscapedPropName(key);
40211
40268
  if (!ctx.options.isProd) return `${finalKey}: { ${concatStrings([
@@ -41063,7 +41120,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
41063
41120
  //#endregion
41064
41121
  //#region packages/compiler-sfc/src/index.ts
41065
41122
  init_objectSpread2();
41066
- const version = "3.6.0-beta.5";
41123
+ const version = "3.6.0-beta.6";
41067
41124
  const parseCache = parseCache$1;
41068
41125
  const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
41069
41126
  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-beta.5",
3
+ "version": "3.6.0-beta.6",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -42,24 +42,24 @@
42
42
  },
43
43
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
44
44
  "dependencies": {
45
- "@babel/parser": "^7.28.6",
45
+ "@babel/parser": "^7.29.0",
46
46
  "estree-walker": "^2.0.2",
47
47
  "magic-string": "^0.30.21",
48
48
  "postcss": "^8.5.6",
49
49
  "source-map-js": "^1.2.1",
50
- "@vue/compiler-core": "3.6.0-beta.5",
51
- "@vue/compiler-ssr": "3.6.0-beta.5",
52
- "@vue/compiler-vapor": "3.6.0-beta.5",
53
- "@vue/compiler-dom": "3.6.0-beta.5",
54
- "@vue/shared": "3.6.0-beta.5"
50
+ "@vue/compiler-core": "3.6.0-beta.6",
51
+ "@vue/compiler-dom": "3.6.0-beta.6",
52
+ "@vue/compiler-ssr": "3.6.0-beta.6",
53
+ "@vue/compiler-vapor": "3.6.0-beta.6",
54
+ "@vue/shared": "3.6.0-beta.6"
55
55
  },
56
56
  "devDependencies": {
57
- "@babel/types": "^7.28.6",
57
+ "@babel/types": "^7.29.0",
58
58
  "@vue/consolidate": "^1.0.0",
59
59
  "hash-sum": "^2.0.0",
60
60
  "lru-cache": "10.1.0",
61
61
  "merge-source-map": "^1.1.0",
62
- "minimatch": "~10.1.1",
62
+ "minimatch": "~10.1.2",
63
63
  "postcss-modules": "^6.0.1",
64
64
  "postcss-selector-parser": "^7.1.1",
65
65
  "pug": "^3.0.3",