@vue/compiler-sfc 3.3.8 → 3.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **Note: as of 3.2.13+, this package is included as a dependency of the main `vue` package and can be accessed as `vue/compiler-sfc`. This means you no longer need to explicitly install this package and ensure its version match that of `vue`'s. Just use the main `vue/compiler-sfc` deep import instead.**
6
6
 
7
- This package contains lower level utilities that you can use if you are writing a plugin / transform for a bundler or module system that compiles Vue Single File Components (SFCs) into JavaScript. It is used in [vue-loader](https://github.com/vuejs/vue-loader), [rollup-plugin-vue](https://github.com/vuejs/rollup-plugin-vue) and [vite](https://github.com/vitejs/vite).
7
+ This package contains lower level utilities that you can use if you are writing a plugin / transform for a bundler or module system that compiles Vue Single File Components (SFCs) into JavaScript. It is used in [vue-loader](https://github.com/vuejs/vue-loader) and [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue).
8
8
 
9
9
  ## API
10
10
 
@@ -77,4 +77,4 @@ export default script
77
77
 
78
78
  Options needed for these APIs can be passed via the query string.
79
79
 
80
- For detailed API references and options, check out the source type definitions. For actual usage of these APIs, check out [rollup-plugin-vue](https://github.com/vuejs/rollup-plugin-vue/tree/next) or [vue-loader](https://github.com/vuejs/vue-loader/tree/next).
80
+ For detailed API references and options, check out the source type definitions. For actual usage of these APIs, check out [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue) or [vue-loader](https://github.com/vuejs/vue-loader/tree/next).
@@ -16,6 +16,7 @@ var require$$0$1 = require('postcss');
16
16
  var estreeWalker = require('estree-walker');
17
17
  var reactivityTransform = require('@vue/reactivity-transform');
18
18
  var MagicString = require('magic-string');
19
+ var process$1 = require('process');
19
20
 
20
21
  function _interopNamespaceDefault(e) {
21
22
  var n = Object.create(null);
@@ -30,6 +31,7 @@ function _interopNamespaceDefault(e) {
30
31
 
31
32
  var CompilerDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(CompilerDOM);
32
33
  var CompilerSSR__namespace = /*#__PURE__*/_interopNamespaceDefault(CompilerSSR);
34
+ var process__namespace = /*#__PURE__*/_interopNamespaceDefault(process$1);
33
35
 
34
36
  const UNKNOWN_TYPE = "Unknown";
35
37
  function resolveObjectKey(node, computed) {
@@ -87,9 +89,13 @@ function normalizePath(p) {
87
89
  return normalize(p.replace(windowsSlashRE, "/"));
88
90
  }
89
91
  const joinPaths = (path$3.posix || path$3).join;
90
- const escapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
91
- function getEscapedKey(key) {
92
- return escapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
92
+ const propNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~\-]/;
93
+ function getEscapedPropName(key) {
94
+ return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
95
+ }
96
+ const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
97
+ function getEscapedCssVarName(key) {
98
+ return key.replace(cssVarNameEscapeSymbolsRE, (s) => `\\${s}`);
93
99
  }
94
100
 
95
101
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -180,7 +186,7 @@ function genVarName(id, raw, isProd) {
180
186
  if (isProd) {
181
187
  return hash$1(id + raw);
182
188
  } else {
183
- return `${id}-${raw.replace(escapeSymbolsRE, (s) => `\\${s}`)}`;
189
+ return `${id}-${getEscapedCssVarName(raw)}`;
184
190
  }
185
191
  }
186
192
  function normalizeExpression(exp) {
@@ -734,6 +740,9 @@ class LRUCache {
734
740
  if (ttls[index]) {
735
741
  const ttl = ttls[index];
736
742
  const start = starts[index];
743
+ /* c8 ignore next */
744
+ if (!ttl || !start)
745
+ return;
737
746
  status.ttl = ttl;
738
747
  status.start = start;
739
748
  status.now = cachedNow || getNow();
@@ -765,16 +774,16 @@ class LRUCache {
765
774
  }
766
775
  const ttl = ttls[index];
767
776
  const start = starts[index];
768
- if (ttl === 0 || start === 0) {
777
+ if (!ttl || !start) {
769
778
  return Infinity;
770
779
  }
771
780
  const age = (cachedNow || getNow()) - start;
772
781
  return ttl - age;
773
782
  };
774
783
  this.#isStale = index => {
775
- return (ttls[index] !== 0 &&
776
- starts[index] !== 0 &&
777
- (cachedNow || getNow()) - starts[index] > ttls[index]);
784
+ const s = starts[index];
785
+ const t = ttls[index];
786
+ return !!t && !!s && (cachedNow || getNow()) - s > t;
778
787
  };
779
788
  }
780
789
  // conditionally set private methods related to TTL
@@ -1298,12 +1307,13 @@ class LRUCache {
1298
1307
  peek(k, peekOptions = {}) {
1299
1308
  const { allowStale = this.allowStale } = peekOptions;
1300
1309
  const index = this.#keyMap.get(k);
1301
- if (index !== undefined &&
1302
- (allowStale || !this.#isStale(index))) {
1303
- const v = this.#valList[index];
1304
- // either stale and allowed, or forcing a refresh of non-stale value
1305
- return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
1310
+ if (index === undefined ||
1311
+ (!allowStale && this.#isStale(index))) {
1312
+ return;
1306
1313
  }
1314
+ const v = this.#valList[index];
1315
+ // either stale and allowed, or forcing a refresh of non-stale value
1316
+ return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
1307
1317
  }
1308
1318
  #backgroundFetch(k, index, options, context) {
1309
1319
  const v = index === undefined ? undefined : this.#valList[index];
@@ -1639,8 +1649,10 @@ class LRUCache {
1639
1649
  this.#head = this.#next[index];
1640
1650
  }
1641
1651
  else {
1642
- this.#next[this.#prev[index]] = this.#next[index];
1643
- this.#prev[this.#next[index]] = this.#prev[index];
1652
+ const pi = this.#prev[index];
1653
+ this.#next[pi] = this.#next[index];
1654
+ const ni = this.#next[index];
1655
+ this.#prev[ni] = this.#prev[index];
1644
1656
  }
1645
1657
  this.#size--;
1646
1658
  this.#free.push(index);
@@ -1761,7 +1773,6 @@ function resolveTemplateUsageCheckString(sfc) {
1761
1773
  templateUsageCheckCache.set(content, code);
1762
1774
  return code;
1763
1775
  }
1764
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
1765
1776
  function processExp(exp, dir) {
1766
1777
  if (/ as\s+\w|<.*>|:/.test(exp)) {
1767
1778
  if (dir === "slot") {
@@ -1769,7 +1780,7 @@ function processExp(exp, dir) {
1769
1780
  } else if (dir === "on") {
1770
1781
  exp = `()=>{return ${exp}}`;
1771
1782
  } else if (dir === "for") {
1772
- const inMatch = exp.match(forAliasRE);
1783
+ const inMatch = exp.match(CompilerDOM.forAliasRE);
1773
1784
  if (inMatch) {
1774
1785
  let [, LHS, RHS] = inMatch;
1775
1786
  LHS = LHS.trim().replace(/^\(|\)$/g, "");
@@ -7901,6 +7912,10 @@ function rewriteSelector(id, selector, selectorRoot, slotted = false) {
7901
7912
  if (n.type !== "pseudo" && n.type !== "combinator") {
7902
7913
  node = n;
7903
7914
  }
7915
+ if (n.type === "pseudo" && (n.value === ":is" || n.value === ":where")) {
7916
+ rewriteSelector(id, n.nodes[0], selectorRoot, slotted);
7917
+ shouldInject = false;
7918
+ }
7904
7919
  });
7905
7920
  if (node) {
7906
7921
  node.spaces.after = "";
@@ -15673,7 +15688,7 @@ function resolveParserPlugins(lang, userPlugins, dts = false) {
15673
15688
  }
15674
15689
  if (lang === "ts" || lang === "tsx") {
15675
15690
  plugins.push(["typescript", { dts }]);
15676
- if (!plugins.includes("decorators")) {
15691
+ if (!userPlugins || !userPlugins.includes("decorators")) {
15677
15692
  plugins.push("decorators-legacy");
15678
15693
  }
15679
15694
  }
@@ -17907,12 +17922,16 @@ function resolveInterfaceMembers(ctx, node, scope) {
17907
17922
  continue;
17908
17923
  }
17909
17924
  try {
17910
- const { props } = resolveTypeElements(ctx, ext, scope);
17925
+ const { props, calls } = resolveTypeElements(ctx, ext, scope);
17911
17926
  for (const key in props) {
17912
17927
  if (!shared.hasOwn(base.props, key)) {
17913
17928
  base.props[key] = props[key];
17914
17929
  }
17915
17930
  }
17931
+ if (calls) {
17932
+ ;
17933
+ (base.calls || (base.calls = [])).push(...calls);
17934
+ }
17916
17935
  } catch (e) {
17917
17936
  ctx.error(
17918
17937
  `Failed to resolve extends base type.
@@ -18244,7 +18263,11 @@ function importSourceToScope(ctx, node, scope, source) {
18244
18263
  }
18245
18264
  let resolved = scope.resolvedImportSources[source];
18246
18265
  if (!resolved) {
18247
- if (source.startsWith(".")) {
18266
+ if (source.startsWith("..")) {
18267
+ const osSpecificJoinFn = process__namespace.platform === "win32" ? path$3.join : joinPaths;
18268
+ const filename = osSpecificJoinFn(path$3.dirname(scope.filename), source);
18269
+ resolved = resolveExt(filename, fs);
18270
+ } else if (source.startsWith(".")) {
18248
18271
  const filename = joinPaths(path$3.dirname(scope.filename), source);
18249
18272
  resolved = resolveExt(filename, fs);
18250
18273
  } else {
@@ -18325,7 +18348,7 @@ function resolveWithTS(containingFile, source, ts2, fs) {
18325
18348
  }
18326
18349
  tsCompilerOptions = matchedConfig.config.options;
18327
18350
  tsResolveCache = matchedConfig.cache || (matchedConfig.cache = ts2.createModuleResolutionCache(
18328
- process.cwd(),
18351
+ process__namespace.cwd(),
18329
18352
  createGetCanonicalFileName(ts2.sys.useCaseSensitiveFileNames),
18330
18353
  tsCompilerOptions
18331
18354
  ));
@@ -19111,7 +19134,7 @@ function genRuntimeProps(ctx) {
19111
19134
  const defaults = [];
19112
19135
  for (const key in ctx.propsDestructuredBindings) {
19113
19136
  const d = genDestructuredDefaultValue(ctx, key);
19114
- const finalKey = getEscapedKey(key);
19137
+ const finalKey = getEscapedPropName(key);
19115
19138
  if (d)
19116
19139
  defaults.push(
19117
19140
  `${finalKey}: ${d.valueString}${d.needSkipFactory ? `, __skip_${finalKey}: true` : ``}`
@@ -19203,7 +19226,7 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
19203
19226
  }
19204
19227
  }
19205
19228
  }
19206
- const finalKey = getEscapedKey(key);
19229
+ const finalKey = getEscapedPropName(key);
19207
19230
  if (!ctx.options.isProd) {
19208
19231
  return `${finalKey}: { ${concatStrings([
19209
19232
  `type: ${toRuntimeTypeString(type)}`,
@@ -20461,7 +20484,7 @@ function isStaticNode(node) {
20461
20484
  return false;
20462
20485
  }
20463
20486
 
20464
- const version = "3.3.8";
20487
+ const version = "3.3.9";
20465
20488
  const parseCache = parseCache$1;
20466
20489
  const walk = estreeWalker.walk;
20467
20490
 
@@ -66,7 +66,7 @@ const PatchFlagNames = {
66
66
  [4]: `STYLE`,
67
67
  [8]: `PROPS`,
68
68
  [16]: `FULL_PROPS`,
69
- [32]: `HYDRATE_EVENTS`,
69
+ [32]: `NEED_HYDRATION`,
70
70
  [64]: `STABLE_FRAGMENT`,
71
71
  [128]: `KEYED_FRAGMENT`,
72
72
  [256]: `UNKEYED_FRAGMENT`,
@@ -4162,11 +4162,6 @@ function newAsyncArrowScope() {
4162
4162
  function newExpressionScope() {
4163
4163
  return new ExpressionScope();
4164
4164
  }
4165
- const PARAM = 0b0000,
4166
- PARAM_YIELD = 0b0001,
4167
- PARAM_AWAIT = 0b0010,
4168
- PARAM_RETURN = 0b0100,
4169
- PARAM_IN = 0b1000;
4170
4165
  class ProductionParameterHandler {
4171
4166
  constructor() {
4172
4167
  this.stacks = [];
@@ -4181,20 +4176,20 @@ class ProductionParameterHandler {
4181
4176
  return this.stacks[this.stacks.length - 1];
4182
4177
  }
4183
4178
  get hasAwait() {
4184
- return (this.currentFlags() & PARAM_AWAIT) > 0;
4179
+ return (this.currentFlags() & 2) > 0;
4185
4180
  }
4186
4181
  get hasYield() {
4187
- return (this.currentFlags() & PARAM_YIELD) > 0;
4182
+ return (this.currentFlags() & 1) > 0;
4188
4183
  }
4189
4184
  get hasReturn() {
4190
- return (this.currentFlags() & PARAM_RETURN) > 0;
4185
+ return (this.currentFlags() & 4) > 0;
4191
4186
  }
4192
4187
  get hasIn() {
4193
- return (this.currentFlags() & PARAM_IN) > 0;
4188
+ return (this.currentFlags() & 8) > 0;
4194
4189
  }
4195
4190
  }
4196
4191
  function functionFlags(isAsync, isGenerator) {
4197
- return (isAsync ? PARAM_AWAIT : 0) | (isGenerator ? PARAM_YIELD : 0);
4192
+ return (isAsync ? 2 : 0) | (isGenerator ? 1 : 0);
4198
4193
  }
4199
4194
  class UtilParser extends Tokenizer {
4200
4195
  addExtra(node, key, value, enumerable = true) {
@@ -4391,9 +4386,9 @@ class UtilParser extends Tokenizer {
4391
4386
  };
4392
4387
  }
4393
4388
  enterInitialScopes() {
4394
- let paramFlags = PARAM;
4389
+ let paramFlags = 0;
4395
4390
  if (this.inModule) {
4396
- paramFlags |= PARAM_AWAIT;
4391
+ paramFlags |= 2;
4397
4392
  }
4398
4393
  this.scope.enter(1);
4399
4394
  this.prodParam.enter(paramFlags);
@@ -9436,7 +9431,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
9436
9431
  node.body = inner;
9437
9432
  } else {
9438
9433
  this.scope.enter(256);
9439
- this.prodParam.enter(PARAM);
9434
+ this.prodParam.enter(0);
9440
9435
  node.body = this.tsParseModuleBlock();
9441
9436
  this.prodParam.exit();
9442
9437
  this.scope.exit();
@@ -9454,7 +9449,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
9454
9449
  }
9455
9450
  if (this.match(5)) {
9456
9451
  this.scope.enter(256);
9457
- this.prodParam.enter(PARAM);
9452
+ this.prodParam.enter(0);
9458
9453
  node.body = this.tsParseModuleBlock();
9459
9454
  this.prodParam.exit();
9460
9455
  this.scope.exit();
@@ -9581,7 +9576,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
9581
9576
  case "global":
9582
9577
  if (this.match(5)) {
9583
9578
  this.scope.enter(256);
9584
- this.prodParam.enter(PARAM);
9579
+ this.prodParam.enter(0);
9585
9580
  const mod = node;
9586
9581
  mod.global = true;
9587
9582
  mod.id = expr;
@@ -12012,7 +12007,7 @@ class ExpressionParser extends LValParser {
12012
12007
  const oldLabels = this.state.labels;
12013
12008
  this.state.labels = [];
12014
12009
  if (isAsync) {
12015
- this.prodParam.enter(PARAM_AWAIT);
12010
+ this.prodParam.enter(2);
12016
12011
  node.body = this.parseBlock();
12017
12012
  this.prodParam.exit();
12018
12013
  } else {
@@ -12576,7 +12571,7 @@ class ExpressionParser extends LValParser {
12576
12571
  this.scope.enter(2 | 4);
12577
12572
  let flags = functionFlags(isAsync, false);
12578
12573
  if (!this.match(5) && this.prodParam.hasIn) {
12579
- flags |= PARAM_IN;
12574
+ flags |= 8;
12580
12575
  }
12581
12576
  this.prodParam.enter(flags);
12582
12577
  this.initFunction(node, isAsync);
@@ -12610,7 +12605,7 @@ class ExpressionParser extends LValParser {
12610
12605
  const oldStrict = this.state.strict;
12611
12606
  const oldLabels = this.state.labels;
12612
12607
  this.state.labels = [];
12613
- this.prodParam.enter(this.prodParam.currentFlags() | PARAM_RETURN);
12608
+ this.prodParam.enter(this.prodParam.currentFlags() | 4);
12614
12609
  node.body = this.parseBlock(true, false, hasStrictModeDirective => {
12615
12610
  const nonSimple = !this.isSimpleParamList(node.params);
12616
12611
  if (hasStrictModeDirective && nonSimple) {
@@ -12951,9 +12946,9 @@ class ExpressionParser extends LValParser {
12951
12946
  }
12952
12947
  allowInAnd(callback) {
12953
12948
  const flags = this.prodParam.currentFlags();
12954
- const prodParamToSet = PARAM_IN & ~flags;
12949
+ const prodParamToSet = 8 & ~flags;
12955
12950
  if (prodParamToSet) {
12956
- this.prodParam.enter(flags | PARAM_IN);
12951
+ this.prodParam.enter(flags | 8);
12957
12952
  try {
12958
12953
  return callback();
12959
12954
  } finally {
@@ -12964,9 +12959,9 @@ class ExpressionParser extends LValParser {
12964
12959
  }
12965
12960
  disallowInAnd(callback) {
12966
12961
  const flags = this.prodParam.currentFlags();
12967
- const prodParamToClear = PARAM_IN & flags;
12962
+ const prodParamToClear = 8 & flags;
12968
12963
  if (prodParamToClear) {
12969
- this.prodParam.enter(flags & ~PARAM_IN);
12964
+ this.prodParam.enter(flags & ~8);
12970
12965
  try {
12971
12966
  return callback();
12972
12967
  } finally {
@@ -13881,7 +13876,7 @@ class StatementParser extends ExpressionParser {
13881
13876
  }
13882
13877
  body.push(stmt);
13883
13878
  }
13884
- afterBlockParse == null ? void 0 : afterBlockParse.call(this, hasStrictModeDirective);
13879
+ afterBlockParse == null || afterBlockParse.call(this, hasStrictModeDirective);
13885
13880
  if (!oldStrict) {
13886
13881
  this.setStrict(false);
13887
13882
  }
@@ -14257,7 +14252,7 @@ class StatementParser extends ExpressionParser {
14257
14252
  this.scope.enter(64 | 128 | 16);
14258
14253
  const oldLabels = this.state.labels;
14259
14254
  this.state.labels = [];
14260
- this.prodParam.enter(PARAM);
14255
+ this.prodParam.enter(0);
14261
14256
  const body = member.body = [];
14262
14257
  this.parseBlockOrModuleBlockBody(body, undefined, false, 8);
14263
14258
  this.prodParam.exit();
@@ -14329,7 +14324,7 @@ class StatementParser extends ExpressionParser {
14329
14324
  parseInitializer(node) {
14330
14325
  this.scope.enter(64 | 16);
14331
14326
  this.expressionScope.enter(newExpressionScope());
14332
- this.prodParam.enter(PARAM);
14327
+ this.prodParam.enter(0);
14333
14328
  node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null;
14334
14329
  this.expressionScope.exit();
14335
14330
  this.prodParam.exit();
@@ -15450,6 +15445,7 @@ function getMemoedVNodeCall(node) {
15450
15445
  return node;
15451
15446
  }
15452
15447
  }
15448
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
15453
15449
 
15454
15450
  const deprecationData = {
15455
15451
  ["COMPILER_IS_ON_ELEMENT"]: {
@@ -21124,6 +21120,15 @@ function walkBlockDeclarations(block, onIdent) {
21124
21120
  if (stmt.declare || !stmt.id)
21125
21121
  continue;
21126
21122
  onIdent(stmt.id);
21123
+ } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
21124
+ const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
21125
+ if (variable && variable.type === "VariableDeclaration") {
21126
+ for (const decl of variable.declarations) {
21127
+ for (const id of extractIdentifiers(decl.id)) {
21128
+ onIdent(id);
21129
+ }
21130
+ }
21131
+ }
21127
21132
  }
21128
21133
  }
21129
21134
  }
@@ -21911,13 +21916,12 @@ function processFor(node, dir, context, processCodegen) {
21911
21916
  onExit();
21912
21917
  };
21913
21918
  }
21914
- const forAliasRE$1 = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
21915
21919
  const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
21916
21920
  const stripParensRE = /^\(|\)$/g;
21917
21921
  function parseForExpression(input, context) {
21918
21922
  const loc = input.loc;
21919
21923
  const exp = input.content;
21920
- const inMatch = exp.match(forAliasRE$1);
21924
+ const inMatch = exp.match(forAliasRE);
21921
21925
  if (!inMatch)
21922
21926
  return;
21923
21927
  const [, LHS, RHS] = inMatch;
@@ -22584,7 +22588,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
22584
22588
  )
22585
22589
  );
22586
22590
  } else {
22587
- const { name, arg, exp, loc } = prop;
22591
+ const { name, arg, exp, loc, modifiers } = prop;
22588
22592
  const isVBind = name === "bind";
22589
22593
  const isVOn = name === "on";
22590
22594
  if (name === "slot") {
@@ -22644,6 +22648,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
22644
22648
  }
22645
22649
  continue;
22646
22650
  }
22651
+ if (isVBind && modifiers.includes("prop")) {
22652
+ patchFlag |= 32;
22653
+ }
22647
22654
  const directiveTransform = context.directiveTransforms[name];
22648
22655
  if (directiveTransform) {
22649
22656
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);
@@ -25906,8 +25913,8 @@ const transformModel = (dir, node, context) => {
25906
25913
  );
25907
25914
  }
25908
25915
  function checkDuplicatedValue() {
25909
- const value = findProp(node, "value");
25910
- if (value) {
25916
+ const value = findDir(node, "bind");
25917
+ if (value && isStaticArgOf(value.arg, "value")) {
25911
25918
  context.onError(
25912
25919
  createDOMCompilerError(
25913
25920
  60,
@@ -26477,6 +26484,7 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
26477
26484
  extractIdentifiers: extractIdentifiers,
26478
26485
  findDir: findDir,
26479
26486
  findProp: findProp,
26487
+ forAliasRE: forAliasRE,
26480
26488
  generate: generate,
26481
26489
  generateCodeFrame: generateCodeFrame,
26482
26490
  getBaseTransformPreset: getBaseTransformPreset,
@@ -26829,9 +26837,13 @@ function normalizePath(p) {
26829
26837
  return normalize(p.replace(windowsSlashRE, "/"));
26830
26838
  }
26831
26839
  const joinPaths = (path.posix || path).join;
26832
- const escapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
26833
- function getEscapedKey(key) {
26834
- return escapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
26840
+ const propNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~\-]/;
26841
+ function getEscapedPropName(key) {
26842
+ return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key;
26843
+ }
26844
+ const cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
26845
+ function getEscapedCssVarName(key) {
26846
+ return key.replace(cssVarNameEscapeSymbolsRE, (s) => `\\${s}`);
26835
26847
  }
26836
26848
 
26837
26849
  function pad$1 (hash, len) {
@@ -26916,7 +26928,7 @@ function genVarName(id, raw, isProd) {
26916
26928
  if (isProd) {
26917
26929
  return hash(id + raw);
26918
26930
  } else {
26919
- return `${id}-${raw.replace(escapeSymbolsRE, (s) => `\\${s}`)}`;
26931
+ return `${id}-${getEscapedCssVarName(raw)}`;
26920
26932
  }
26921
26933
  }
26922
26934
  function normalizeExpression(exp) {
@@ -27326,7 +27338,6 @@ function resolveTemplateUsageCheckString(sfc) {
27326
27338
  templateUsageCheckCache.set(content, code);
27327
27339
  return code;
27328
27340
  }
27329
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
27330
27341
  function processExp(exp, dir) {
27331
27342
  if (/ as\s+\w|<.*>|:/.test(exp)) {
27332
27343
  if (dir === "slot") {
@@ -33189,7 +33200,7 @@ function compile(template, options = {}) {
33189
33200
  // reusing core v-bind
33190
33201
  bind: transformBind,
33191
33202
  on: transformOn$1,
33192
- // model and show has dedicated SSR handling
33203
+ // model and show have dedicated SSR handling
33193
33204
  model: ssrTransformModel,
33194
33205
  show: ssrTransformShow,
33195
33206
  // the following are ignored during SSR
@@ -41386,6 +41397,10 @@ function rewriteSelector(id, selector, selectorRoot, slotted = false) {
41386
41397
  if (n.type !== "pseudo" && n.type !== "combinator") {
41387
41398
  node = n;
41388
41399
  }
41400
+ if (n.type === "pseudo" && (n.value === ":is" || n.value === ":where")) {
41401
+ rewriteSelector(id, n.nodes[0], selectorRoot, slotted);
41402
+ shouldInject = false;
41403
+ }
41389
41404
  });
41390
41405
  if (node) {
41391
41406
  node.spaces.after = "";
@@ -47073,7 +47088,7 @@ function resolveParserPlugins(lang, userPlugins, dts = false) {
47073
47088
  }
47074
47089
  if (lang === "ts" || lang === "tsx") {
47075
47090
  plugins.push(["typescript", { dts }]);
47076
- if (!plugins.includes("decorators")) {
47091
+ if (!userPlugins || !userPlugins.includes("decorators")) {
47077
47092
  plugins.push("decorators-legacy");
47078
47093
  }
47079
47094
  }
@@ -47294,12 +47309,16 @@ function resolveInterfaceMembers(ctx, node, scope) {
47294
47309
  continue;
47295
47310
  }
47296
47311
  try {
47297
- const { props } = resolveTypeElements(ctx, ext, scope);
47312
+ const { props, calls } = resolveTypeElements(ctx, ext, scope);
47298
47313
  for (const key in props) {
47299
47314
  if (!hasOwn(base.props, key)) {
47300
47315
  base.props[key] = props[key];
47301
47316
  }
47302
47317
  }
47318
+ if (calls) {
47319
+ ;
47320
+ (base.calls || (base.calls = [])).push(...calls);
47321
+ }
47303
47322
  } catch (e) {
47304
47323
  ctx.error(
47305
47324
  `Failed to resolve extends base type.
@@ -47630,7 +47649,11 @@ function importSourceToScope(ctx, node, scope, source) {
47630
47649
  }
47631
47650
  let resolved = scope.resolvedImportSources[source];
47632
47651
  if (!resolved) {
47633
- if (source.startsWith(".")) {
47652
+ if (source.startsWith("..")) {
47653
+ const osSpecificJoinFn = joinPaths;
47654
+ const filename = osSpecificJoinFn(dirname$2(scope.filename), source);
47655
+ resolved = resolveExt(filename, fs);
47656
+ } else if (source.startsWith(".")) {
47634
47657
  const filename = joinPaths(dirname$2(scope.filename), source);
47635
47658
  resolved = resolveExt(filename, fs);
47636
47659
  } else {
@@ -48413,7 +48436,7 @@ function genRuntimeProps(ctx) {
48413
48436
  const defaults = [];
48414
48437
  for (const key in ctx.propsDestructuredBindings) {
48415
48438
  const d = genDestructuredDefaultValue(ctx, key);
48416
- const finalKey = getEscapedKey(key);
48439
+ const finalKey = getEscapedPropName(key);
48417
48440
  if (d)
48418
48441
  defaults.push(
48419
48442
  `${finalKey}: ${d.valueString}${d.needSkipFactory ? `, __skip_${finalKey}: true` : ``}`
@@ -48505,7 +48528,7 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
48505
48528
  }
48506
48529
  }
48507
48530
  }
48508
- const finalKey = getEscapedKey(key);
48531
+ const finalKey = getEscapedPropName(key);
48509
48532
  if (!ctx.options.isProd) {
48510
48533
  return `${finalKey}: { ${concatStrings([
48511
48534
  `type: ${toRuntimeTypeString(type)}`,
@@ -49777,7 +49800,7 @@ function isStaticNode(node) {
49777
49800
  return false;
49778
49801
  }
49779
49802
 
49780
- const version = "3.3.8";
49803
+ const version = "3.3.9";
49781
49804
  const parseCache = parseCache$1;
49782
49805
  const walk = walk$1;
49783
49806
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.3.8",
3
+ "version": "3.3.9",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -32,22 +32,22 @@
32
32
  },
33
33
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
34
34
  "dependencies": {
35
- "@babel/parser": "^7.23.0",
36
- "@vue/compiler-core": "3.3.8",
37
- "@vue/compiler-dom": "3.3.8",
38
- "@vue/compiler-ssr": "3.3.8",
39
- "@vue/reactivity-transform": "3.3.8",
40
- "@vue/shared": "3.3.8",
35
+ "@babel/parser": "^7.23.3",
41
36
  "estree-walker": "^2.0.2",
42
37
  "magic-string": "^0.30.5",
43
38
  "postcss": "^8.4.31",
44
- "source-map-js": "^1.0.2"
39
+ "source-map-js": "^1.0.2",
40
+ "@vue/compiler-core": "3.3.9",
41
+ "@vue/compiler-dom": "3.3.9",
42
+ "@vue/reactivity-transform": "3.3.9",
43
+ "@vue/shared": "3.3.9",
44
+ "@vue/compiler-ssr": "3.3.9"
45
45
  },
46
46
  "devDependencies": {
47
- "@babel/types": "^7.23.0",
47
+ "@babel/types": "^7.23.3",
48
48
  "@vue/consolidate": "^0.17.3",
49
49
  "hash-sum": "^2.0.0",
50
- "lru-cache": "^10.0.1",
50
+ "lru-cache": "^10.0.3",
51
51
  "merge-source-map": "^1.1.0",
52
52
  "minimatch": "^9.0.3",
53
53
  "postcss-modules": "^4.3.1",