@vue/compiler-sfc 3.4.20 → 3.4.22

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.4.20
2
+ * @vue/compiler-sfc v3.4.22
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1783,6 +1783,8 @@ function resolveTemplateUsedIdentifiers(sfc) {
1783
1783
  extractIdentifiers(ids, prop.forParseResult.source);
1784
1784
  } else if (prop.exp) {
1785
1785
  extractIdentifiers(ids, prop.exp);
1786
+ } else if (prop.name === "bind" && !prop.exp) {
1787
+ ids.add(prop.arg.content);
1786
1788
  }
1787
1789
  }
1788
1790
  if (prop.type === 6 && prop.name === "ref" && ((_a = prop.value) == null ? void 0 : _a.content)) {
@@ -2040,7 +2042,6 @@ function generateSourceMap(filename, source, generated, sourceRoot, lineOffset,
2040
2042
  generatedLine,
2041
2043
  generatedColumn: i,
2042
2044
  source: filename,
2043
- // @ts-expect-error
2044
2045
  name: null
2045
2046
  });
2046
2047
  }
@@ -7940,7 +7941,29 @@ function rewriteSelector(id, selector, selectorRoot, slotted = false) {
7940
7941
  return false;
7941
7942
  }
7942
7943
  }
7943
- if (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where")) {
7944
+ if (n.type === "universal") {
7945
+ const prev = selector.at(selector.index(n) - 1);
7946
+ const next = selector.at(selector.index(n) + 1);
7947
+ if (!prev) {
7948
+ if (next) {
7949
+ if (next.type === "combinator" && next.value === " ") {
7950
+ selector.removeChild(next);
7951
+ }
7952
+ selector.removeChild(n);
7953
+ return;
7954
+ } else {
7955
+ node = selectorParser$2.combinator({
7956
+ value: ""
7957
+ });
7958
+ selector.insertBefore(n, node);
7959
+ selector.removeChild(n);
7960
+ return false;
7961
+ }
7962
+ }
7963
+ if (node)
7964
+ return;
7965
+ }
7966
+ if (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where") && !node) {
7944
7967
  node = n;
7945
7968
  }
7946
7969
  });
@@ -16525,6 +16548,9 @@ class AST {
16525
16548
  _glob: glob,
16526
16549
  });
16527
16550
  }
16551
+ get options() {
16552
+ return this.#options;
16553
+ }
16528
16554
  // returns the string match, the regexp source, whether there's magic
16529
16555
  // in the regexp (so a regular expression is required) and whether or
16530
16556
  // not the uflag is needed for the regular expression (for posix classes)
@@ -17120,6 +17146,7 @@ class Minimatch {
17120
17146
  globParts = this.levelOneOptimize(globParts);
17121
17147
  }
17122
17148
  else {
17149
+ // just collapse multiple ** portions into one
17123
17150
  globParts = this.adjascentGlobstarOptimize(globParts);
17124
17151
  }
17125
17152
  return globParts;
@@ -17609,7 +17636,11 @@ class Minimatch {
17609
17636
  fastTest = dotStarTest;
17610
17637
  }
17611
17638
  const re = AST.fromGlob(pattern, this.options).toMMPattern();
17612
- return fastTest ? Object.assign(re, { test: fastTest }) : re;
17639
+ if (fastTest && typeof re === 'object') {
17640
+ // Avoids overriding in frozen environments
17641
+ Reflect.defineProperty(re, 'test', { value: fastTest });
17642
+ }
17643
+ return re;
17613
17644
  }
17614
17645
  makeRe() {
17615
17646
  if (this.regexp || this.regexp === false)
@@ -18432,7 +18463,7 @@ function resolveExt(filename, fs) {
18432
18463
  if (fs.fileExists(filename2))
18433
18464
  return filename2;
18434
18465
  };
18435
- return tryResolve(filename) || tryResolve(filename + `.ts`) || tryResolve(filename + `.d.ts`) || tryResolve(joinPaths(filename, `index.ts`)) || tryResolve(joinPaths(filename, `index.d.ts`));
18466
+ 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`));
18436
18467
  }
18437
18468
  const tsConfigCache = createCache();
18438
18469
  const tsConfigRefMap = /* @__PURE__ */ new Map();
@@ -19167,13 +19198,14 @@ function genModelProps(ctx) {
19167
19198
  let skipCheck = false;
19168
19199
  let runtimeTypes = type && inferRuntimeType(ctx, type);
19169
19200
  if (runtimeTypes) {
19201
+ const hasBoolean = runtimeTypes.includes("Boolean");
19170
19202
  const hasUnknownType = runtimeTypes.includes(UNKNOWN_TYPE);
19171
- runtimeTypes = runtimeTypes.filter((el) => {
19172
- if (el === UNKNOWN_TYPE)
19173
- return false;
19174
- return isProd ? el === "Boolean" || el === "Function" && options : true;
19175
- });
19176
- skipCheck = !isProd && hasUnknownType && runtimeTypes.length > 0;
19203
+ if (isProd || hasUnknownType) {
19204
+ runtimeTypes = runtimeTypes.filter(
19205
+ (t) => t === "Boolean" || hasBoolean && t === "String" || t === "Function" && options
19206
+ );
19207
+ skipCheck = !isProd && hasUnknownType && runtimeTypes.length > 0;
19208
+ }
19177
19209
  }
19178
19210
  let runtimeType = runtimeTypes && runtimeTypes.length > 0 && toRuntimeTypeString(runtimeTypes) || void 0;
19179
19211
  const codegenOptions = concatStrings([
@@ -19827,7 +19859,7 @@ function processAwait(ctx, node, needSemi, isStatement) {
19827
19859
  }
19828
19860
 
19829
19861
  function compileScript(sfc, options) {
19830
- var _a;
19862
+ var _a, _b, _c;
19831
19863
  if (!options.id) {
19832
19864
  warnOnce(
19833
19865
  `compileScript now requires passing the \`id\` option.
@@ -20431,8 +20463,10 @@ ${exposeCall}`
20431
20463
  }
20432
20464
  }
20433
20465
  if (ctx.helperImports.size > 0) {
20466
+ const runtimeModuleName = (_c = (_b = options.templateOptions) == null ? void 0 : _b.compilerOptions) == null ? void 0 : _c.runtimeModuleName;
20467
+ const importSrc = runtimeModuleName ? JSON.stringify(runtimeModuleName) : `'vue'`;
20434
20468
  ctx.s.prepend(
20435
- `import { ${[...ctx.helperImports].map((h) => `${h} as _${h}`).join(", ")} } from 'vue'
20469
+ `import { ${[...ctx.helperImports].map((h) => `${h} as _${h}`).join(", ")} } from ${importSrc}
20436
20470
  `
20437
20471
  );
20438
20472
  }
@@ -20607,7 +20641,7 @@ function isStaticNode(node) {
20607
20641
  return false;
20608
20642
  }
20609
20643
 
20610
- const version = "3.4.20";
20644
+ const version = "3.4.22";
20611
20645
  const parseCache = parseCache$1;
20612
20646
  const errorMessages = {
20613
20647
  ...CompilerDOM.errorMessages,
@@ -1,8 +1,7 @@
1
1
  import * as _babel_types from '@babel/types';
2
2
  import { Statement, Expression, TSType, Node, Program, CallExpression, ObjectPattern, TSModuleDeclaration, TSPropertySignature, TSMethodSignature, TSCallSignatureDeclaration, TSFunctionType } from '@babel/types';
3
- import { RootNode, CompilerOptions, CodegenResult, ParserOptions, CompilerError, SourceLocation, BindingMetadata as BindingMetadata$1 } from '@vue/compiler-core';
3
+ import { RootNode, CompilerOptions, CodegenResult, ParserOptions, CompilerError, RawSourceMap, SourceLocation, BindingMetadata as BindingMetadata$1 } from '@vue/compiler-core';
4
4
  export { BindingMetadata, CompilerError, CompilerOptions, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers } from '@vue/compiler-core';
5
- import { RawSourceMap } from 'source-map-js';
6
5
  import { ParserPlugin } from '@babel/parser';
7
6
  export { parse as babelParse } from '@babel/parser';
8
7
  import { Result, LazyResult } from 'postcss';
@@ -1,8 +1,10 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.4.20
2
+ * @vue/compiler-sfc v3.4.22
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
+ /*! #__NO_SIDE_EFFECTS__ */
7
+ // @__NO_SIDE_EFFECTS__
6
8
  function makeMap(str, expectsLowerCase) {
7
9
  const set = new Set(str.split(","));
8
10
  return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
@@ -15,8 +17,8 @@ const NO = () => false;
15
17
  const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
16
18
  (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
17
19
  const extend = Object.assign;
18
- const hasOwnProperty$3 = Object.prototype.hasOwnProperty;
19
- const hasOwn = (val, key) => hasOwnProperty$3.call(val, key);
20
+ const hasOwnProperty$4 = Object.prototype.hasOwnProperty;
21
+ const hasOwn = (val, key) => hasOwnProperty$4.call(val, key);
20
22
  const isArray$3 = Array.isArray;
21
23
  const isMap = (val) => toTypeString(val) === "[object Map]";
22
24
  const isSet = (val) => toTypeString(val) === "[object Set]";
@@ -299,7 +301,11 @@ const replacer = (_key, val) => {
299
301
  };
300
302
  const stringifySymbol = (v, i = "") => {
301
303
  var _a;
302
- return isSymbol$1(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
304
+ return (
305
+ // Symbol.description in es2019+ so we need to cast here to pass
306
+ // the lib: es2016 check
307
+ isSymbol$1(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v
308
+ );
303
309
  };
304
310
 
305
311
  const FRAGMENT = Symbol(`Fragment` );
@@ -9353,7 +9359,7 @@ class TypeScriptScopeHandler extends ScopeHandler {
9353
9359
  super.checkLocalExport(id);
9354
9360
  }
9355
9361
  }
9356
- const getOwn$1 = (object, key) => Object.hasOwnProperty.call(object, key) && object[key];
9362
+ const getOwn$1 = (object, key) => hasOwnProperty.call(object, key) && object[key];
9357
9363
  const unwrapParenthesizedExpression = node => {
9358
9364
  return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
9359
9365
  };
@@ -9732,7 +9738,7 @@ class LValParser extends NodeUtils {
9732
9738
  return true;
9733
9739
  }
9734
9740
  }
9735
- const getOwn = (object, key) => Object.hasOwnProperty.call(object, key) && object[key];
9741
+ const getOwn = (object, key) => hasOwnProperty.call(object, key) && object[key];
9736
9742
  function nonNull(x) {
9737
9743
  if (x == null) {
9738
9744
  throw new Error(`Unexpected ${x} value.`);
@@ -9962,7 +9968,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
9962
9968
  modified[modifier] = true;
9963
9969
  enforceOrder(startLoc, modifier, "in", "out");
9964
9970
  } else {
9965
- if (Object.hasOwnProperty.call(modified, modifier)) {
9971
+ if (hasOwnProperty.call(modified, modifier)) {
9966
9972
  this.raise(TSErrors.DuplicateModifier, startLoc, {
9967
9973
  modifier
9968
9974
  });
@@ -10060,6 +10066,16 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
10060
10066
  this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
10061
10067
  }
10062
10068
  node.argument = super.parseExprAtom();
10069
+ if (this.hasPlugin("importAttributes") || this.hasPlugin("importAssertions")) {
10070
+ node.options = null;
10071
+ }
10072
+ if (this.eat(12)) {
10073
+ this.expectImportAttributesPlugin();
10074
+ if (!this.match(11)) {
10075
+ node.options = super.parseMaybeAssignAllowIn();
10076
+ this.eat(12);
10077
+ }
10078
+ }
10063
10079
  this.expect(11);
10064
10080
  if (this.eat(16)) {
10065
10081
  node.qualifier = this.tsParseEntityName();
@@ -17559,7 +17575,7 @@ function onCloseTag(el, end, isImplied = false) {
17559
17575
  if (isImplied) {
17560
17576
  setLocEnd(el.loc, backTrack(end, 60));
17561
17577
  } else {
17562
- setLocEnd(el.loc, end + 1);
17578
+ setLocEnd(el.loc, lookAhead(end, 62) + 1);
17563
17579
  }
17564
17580
  if (tokenizer$2.inSFCRoot) {
17565
17581
  if (el.children.length) {
@@ -17596,6 +17612,12 @@ function onCloseTag(el, end, isImplied = false) {
17596
17612
  tokenizer$2.inXML = false;
17597
17613
  }
17598
17614
  }
17615
+ function lookAhead(index, c) {
17616
+ let i = index;
17617
+ while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
17618
+ i++;
17619
+ return i;
17620
+ }
17599
17621
  function backTrack(index, c) {
17600
17622
  let i = index;
17601
17623
  while (currentInput.charCodeAt(i) !== c && i >= 0)
@@ -19433,6 +19455,7 @@ function SourceMapGenerator$8(aArgs) {
19433
19455
  this._file = util$9.getArg(aArgs, 'file', null);
19434
19456
  this._sourceRoot = util$9.getArg(aArgs, 'sourceRoot', null);
19435
19457
  this._skipValidation = util$9.getArg(aArgs, 'skipValidation', false);
19458
+ this._ignoreInvalidMapping = util$9.getArg(aArgs, 'ignoreInvalidMapping', false);
19436
19459
  this._sources = new ArraySet$4();
19437
19460
  this._names = new ArraySet$4();
19438
19461
  this._mappings = new MappingList$2();
@@ -19447,12 +19470,12 @@ SourceMapGenerator$8.prototype._version = 3;
19447
19470
  * @param aSourceMapConsumer The SourceMap.
19448
19471
  */
19449
19472
  SourceMapGenerator$8.fromSourceMap =
19450
- function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
19473
+ function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) {
19451
19474
  var sourceRoot = aSourceMapConsumer.sourceRoot;
19452
- var generator = new SourceMapGenerator$8({
19475
+ var generator = new SourceMapGenerator$8(Object.assign(generatorOps || {}, {
19453
19476
  file: aSourceMapConsumer.file,
19454
19477
  sourceRoot: sourceRoot
19455
- });
19478
+ }));
19456
19479
  aSourceMapConsumer.eachMapping(function (mapping) {
19457
19480
  var newMapping = {
19458
19481
  generated: {
@@ -19515,7 +19538,9 @@ SourceMapGenerator$8.prototype.addMapping =
19515
19538
  var name = util$9.getArg(aArgs, 'name', null);
19516
19539
 
19517
19540
  if (!this._skipValidation) {
19518
- this._validateMapping(generated, original, source, name);
19541
+ if (this._validateMapping(generated, original, source, name) === false) {
19542
+ return;
19543
+ }
19519
19544
  }
19520
19545
 
19521
19546
  if (source != null) {
@@ -19681,11 +19706,18 @@ SourceMapGenerator$8.prototype._validateMapping =
19681
19706
  // specific error message to try to guide them the right way.
19682
19707
  // For example: https://github.com/Polymer/polymer-bundler/pull/519
19683
19708
  if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
19684
- throw new Error(
19685
- 'original.line and original.column are not numbers -- you probably meant to omit ' +
19686
- 'the original mapping entirely and only map the generated position. If so, pass ' +
19687
- 'null for the original mapping instead of an object with empty or null values.'
19688
- );
19709
+ var message = 'original.line and original.column are not numbers -- you probably meant to omit ' +
19710
+ 'the original mapping entirely and only map the generated position. If so, pass ' +
19711
+ 'null for the original mapping instead of an object with empty or null values.';
19712
+
19713
+ if (this._ignoreInvalidMapping) {
19714
+ if (typeof console !== 'undefined' && console.warn) {
19715
+ console.warn(message);
19716
+ }
19717
+ return false;
19718
+ } else {
19719
+ throw new Error(message);
19720
+ }
19689
19721
  }
19690
19722
 
19691
19723
  if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
@@ -19703,12 +19735,21 @@ SourceMapGenerator$8.prototype._validateMapping =
19703
19735
  return;
19704
19736
  }
19705
19737
  else {
19706
- throw new Error('Invalid mapping: ' + JSON.stringify({
19738
+ var message = 'Invalid mapping: ' + JSON.stringify({
19707
19739
  generated: aGenerated,
19708
19740
  source: aSource,
19709
19741
  original: aOriginal,
19710
19742
  name: aName
19711
- }));
19743
+ });
19744
+
19745
+ if (this._ignoreInvalidMapping) {
19746
+ if (typeof console !== 'undefined' && console.warn) {
19747
+ console.warn(message);
19748
+ }
19749
+ return false;
19750
+ } else {
19751
+ throw new Error(message)
19752
+ }
19712
19753
  }
19713
19754
  };
19714
19755
 
@@ -21155,7 +21196,7 @@ IndexedSourceMapConsumer$1.prototype.sourceContentFor =
21155
21196
  var section = this._sections[i];
21156
21197
 
21157
21198
  var content = section.consumer.sourceContentFor(aSource, true);
21158
- if (content) {
21199
+ if (content || content === '') {
21159
21200
  return content;
21160
21201
  }
21161
21202
  }
@@ -21799,7 +21840,6 @@ function createCodegenContext(ast, {
21799
21840
  generatedLine: context.line,
21800
21841
  generatedColumn: context.column - 1,
21801
21842
  source: filename,
21802
- // @ts-expect-error it is possible to be null
21803
21843
  name
21804
21844
  });
21805
21845
  }
@@ -23546,10 +23586,27 @@ const transformElement = (node, context) => {
23546
23586
  function resolveComponentType(node, context, ssr = false) {
23547
23587
  let { tag } = node;
23548
23588
  const isExplicitDynamic = isComponentTag(tag);
23549
- const isProp = findProp(node, "is");
23589
+ const isProp = findProp(
23590
+ node,
23591
+ "is",
23592
+ false,
23593
+ true
23594
+ /* allow empty */
23595
+ );
23550
23596
  if (isProp) {
23551
23597
  if (isExplicitDynamic || false) {
23552
- const exp = isProp.type === 6 ? isProp.value && createSimpleExpression(isProp.value.content, true) : isProp.exp;
23598
+ let exp;
23599
+ if (isProp.type === 6) {
23600
+ exp = isProp.value && createSimpleExpression(isProp.value.content, true);
23601
+ } else {
23602
+ exp = isProp.exp;
23603
+ if (!exp) {
23604
+ exp = createSimpleExpression(`is`, false, isProp.loc);
23605
+ {
23606
+ exp = isProp.exp = processExpression(exp, context);
23607
+ }
23608
+ }
23609
+ }
23553
23610
  if (exp) {
23554
23611
  return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
23555
23612
  exp
@@ -26177,6 +26234,8 @@ function resolveTemplateUsedIdentifiers(sfc) {
26177
26234
  extractIdentifiers(ids, prop.forParseResult.source);
26178
26235
  } else if (prop.exp) {
26179
26236
  extractIdentifiers(ids, prop.exp);
26237
+ } else if (prop.name === "bind" && !prop.exp) {
26238
+ ids.add(prop.arg.content);
26180
26239
  }
26181
26240
  }
26182
26241
  if (prop.type === 6 && prop.name === "ref" && ((_a = prop.value) == null ? void 0 : _a.content)) {
@@ -26452,7 +26511,6 @@ function generateSourceMap(filename, source, generated, sourceRoot, lineOffset,
26452
26511
  generatedLine,
26453
26512
  generatedColumn: i,
26454
26513
  source: filename,
26455
- // @ts-expect-error
26456
26514
  name: null
26457
26515
  });
26458
26516
  }
@@ -29145,7 +29203,7 @@ function formatError(value) {
29145
29203
  function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
29146
29204
  var output = [];
29147
29205
  for (var i = 0, l = value.length; i < l; ++i) {
29148
- if (hasOwnProperty$2(value, String(i))) {
29206
+ if (hasOwnProperty$3(value, String(i))) {
29149
29207
  output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
29150
29208
  String(i), true));
29151
29209
  } else {
@@ -29176,7 +29234,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
29176
29234
  str = ctx.stylize('[Setter]', 'special');
29177
29235
  }
29178
29236
  }
29179
- if (!hasOwnProperty$2(visibleKeys, key)) {
29237
+ if (!hasOwnProperty$3(visibleKeys, key)) {
29180
29238
  name = '[' + key + ']';
29181
29239
  }
29182
29240
  if (!str) {
@@ -29347,7 +29405,7 @@ function _extend(origin, add) {
29347
29405
  }
29348
29406
  return origin;
29349
29407
  }
29350
- function hasOwnProperty$2(obj, prop) {
29408
+ function hasOwnProperty$3(obj, prop) {
29351
29409
  return Object.prototype.hasOwnProperty.call(obj, prop);
29352
29410
  }
29353
29411
 
@@ -29537,7 +29595,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
29537
29595
  // If obj.hasOwnProperty has been overridden, then calling
29538
29596
  // obj.hasOwnProperty(prop) will break.
29539
29597
  // See: https://github.com/joyent/node/issues/1707
29540
- function hasOwnProperty$1(obj, prop) {
29598
+ function hasOwnProperty$2(obj, prop) {
29541
29599
  return Object.prototype.hasOwnProperty.call(obj, prop);
29542
29600
  }
29543
29601
  var isArray = Array.isArray || function (xs) {
@@ -29640,7 +29698,7 @@ function parse$6(qs, sep, eq, options) {
29640
29698
  k = decodeURIComponent(kstr);
29641
29699
  v = decodeURIComponent(vstr);
29642
29700
 
29643
- if (!hasOwnProperty$1(obj, k)) {
29701
+ if (!hasOwnProperty$2(obj, k)) {
29644
29702
  obj[k] = v;
29645
29703
  } else if (isArray(obj[k])) {
29646
29704
  obj[k].push(v);
@@ -30729,7 +30787,7 @@ const ssrTransformIf = createStructuralDirectiveTransform(
30729
30787
  /^(if|else|else-if)$/,
30730
30788
  processIf
30731
30789
  );
30732
- function ssrProcessIf(node, context, disableNestedFragments = false) {
30790
+ function ssrProcessIf(node, context, disableNestedFragments = false, disableCommentAsIfAlternate = false) {
30733
30791
  const [rootBranch] = node.branches;
30734
30792
  const ifStatement = createIfStatement(
30735
30793
  rootBranch.condition,
@@ -30753,7 +30811,7 @@ function ssrProcessIf(node, context, disableNestedFragments = false) {
30753
30811
  currentIf.alternate = branchBlockStatement;
30754
30812
  }
30755
30813
  }
30756
- if (!currentIf.alternate) {
30814
+ if (!currentIf.alternate && !disableCommentAsIfAlternate) {
30757
30815
  currentIf.alternate = createBlockStatement([
30758
30816
  createCallExpression(`_push`, ["`<!---->`"])
30759
30817
  ]);
@@ -31290,6 +31348,13 @@ function ssrProcessTransitionGroup(node, context) {
31290
31348
  * be patched using the same key map) so we need to account for that here
31291
31349
  * by disabling nested fragment wrappers from being generated.
31292
31350
  */
31351
+ true,
31352
+ /**
31353
+ * TransitionGroup filters out comment children at runtime and thus
31354
+ * doesn't expect comments to be present during hydration. We need to
31355
+ * account for that by disabling the empty comment that is otherwise
31356
+ * rendered for a falsy v-if that has no v-else specified. (#6715)
31357
+ */
31293
31358
  true
31294
31359
  );
31295
31360
  context.pushStringPart(`</`);
@@ -31308,7 +31373,7 @@ function ssrProcessTransitionGroup(node, context) {
31308
31373
  context.pushStringPart(`</${tag.value.content}>`);
31309
31374
  }
31310
31375
  } else {
31311
- processChildren(node, context, true, true);
31376
+ processChildren(node, context, true, true, true);
31312
31377
  }
31313
31378
  }
31314
31379
 
@@ -31638,7 +31703,7 @@ function createChildContext(parent, withSlotScopeId = parent.withSlotScopeId) {
31638
31703
  withSlotScopeId
31639
31704
  );
31640
31705
  }
31641
- function processChildren(parent, context, asFragment = false, disableNestedFragments = false) {
31706
+ function processChildren(parent, context, asFragment = false, disableNestedFragments = false, disableCommentAsIfAlternate = false) {
31642
31707
  if (asFragment) {
31643
31708
  context.pushStringPart(`<!--[-->`);
31644
31709
  }
@@ -31684,7 +31749,12 @@ function processChildren(parent, context, asFragment = false, disableNestedFragm
31684
31749
  );
31685
31750
  break;
31686
31751
  case 9:
31687
- ssrProcessIf(child, context, disableNestedFragments);
31752
+ ssrProcessIf(
31753
+ child,
31754
+ context,
31755
+ disableNestedFragments,
31756
+ disableCommentAsIfAlternate
31757
+ );
31688
31758
  break;
31689
31759
  case 11:
31690
31760
  ssrProcessFor(child, context, disableNestedFragments);
@@ -33449,7 +33519,7 @@ let Node$4 = class Node {
33449
33519
  column: opts.end.column,
33450
33520
  line: opts.end.line
33451
33521
  };
33452
- } else if (opts.endIndex) {
33522
+ } else if (typeof opts.endIndex === 'number') {
33453
33523
  end = this.positionInside(opts.endIndex);
33454
33524
  } else if (opts.index) {
33455
33525
  end = this.positionInside(opts.index + 1);
@@ -34121,9 +34191,14 @@ let MapGenerator$2 = class MapGenerator {
34121
34191
  } else if (this.previous().length === 1) {
34122
34192
  let prev = this.previous()[0].consumer();
34123
34193
  prev.file = this.outputFile();
34124
- this.map = SourceMapGenerator$3.fromSourceMap(prev);
34194
+ this.map = SourceMapGenerator$3.fromSourceMap(prev, {
34195
+ ignoreInvalidMapping: true
34196
+ });
34125
34197
  } else {
34126
- this.map = new SourceMapGenerator$3({ file: this.outputFile() });
34198
+ this.map = new SourceMapGenerator$3({
34199
+ file: this.outputFile(),
34200
+ ignoreInvalidMapping: true
34201
+ });
34127
34202
  this.map.addMapping({
34128
34203
  generated: { column: 0, line: 1 },
34129
34204
  original: { column: 0, line: 1 },
@@ -34146,7 +34221,10 @@ let MapGenerator$2 = class MapGenerator {
34146
34221
 
34147
34222
  generateString() {
34148
34223
  this.css = '';
34149
- this.map = new SourceMapGenerator$3({ file: this.outputFile() });
34224
+ this.map = new SourceMapGenerator$3({
34225
+ file: this.outputFile(),
34226
+ ignoreInvalidMapping: true
34227
+ });
34150
34228
 
34151
34229
  let line = 1;
34152
34230
  let column = 1;
@@ -36464,7 +36542,7 @@ let Root$2 = root$2;
36464
36542
 
36465
36543
  let Processor$1 = class Processor {
36466
36544
  constructor(plugins = []) {
36467
- this.version = '8.4.35';
36545
+ this.version = '8.4.38';
36468
36546
  this.plugins = this.normalize(plugins);
36469
36547
  }
36470
36548
 
@@ -37521,7 +37599,7 @@ var className$1 = {exports: {}};
37521
37599
  /*! https://mths.be/cssesc v3.0.0 by @mathias */
37522
37600
 
37523
37601
  var object = {};
37524
- var hasOwnProperty = object.hasOwnProperty;
37602
+ var hasOwnProperty$1 = object.hasOwnProperty;
37525
37603
  var merge$2 = function merge(options, defaults) {
37526
37604
  if (!options) {
37527
37605
  return defaults;
@@ -37530,7 +37608,7 @@ var merge$2 = function merge(options, defaults) {
37530
37608
  for (var key in defaults) {
37531
37609
  // `if (defaults.hasOwnProperty(key) { … }` is not needed here, since
37532
37610
  // only recognized option names are used.
37533
- result[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key];
37611
+ result[key] = hasOwnProperty$1.call(options, key) ? options[key] : defaults[key];
37534
37612
  }
37535
37613
  return result;
37536
37614
  };
@@ -40255,7 +40333,29 @@ function rewriteSelector(id, selector, selectorRoot, slotted = false) {
40255
40333
  return false;
40256
40334
  }
40257
40335
  }
40258
- if (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where")) {
40336
+ if (n.type === "universal") {
40337
+ const prev = selector.at(selector.index(n) - 1);
40338
+ const next = selector.at(selector.index(n) + 1);
40339
+ if (!prev) {
40340
+ if (next) {
40341
+ if (next.type === "combinator" && next.value === " ") {
40342
+ selector.removeChild(next);
40343
+ }
40344
+ selector.removeChild(n);
40345
+ return;
40346
+ } else {
40347
+ node = selectorParser.combinator({
40348
+ value: ""
40349
+ });
40350
+ selector.insertBefore(n, node);
40351
+ selector.removeChild(n);
40352
+ return false;
40353
+ }
40354
+ }
40355
+ if (node)
40356
+ return;
40357
+ }
40358
+ if (n.type !== "pseudo" && n.type !== "combinator" || n.type === "pseudo" && (n.value === ":is" || n.value === ":where") && !node) {
40259
40359
  node = n;
40260
40360
  }
40261
40361
  });
@@ -44258,9 +44358,12 @@ class Mappings {
44258
44358
 
44259
44359
  addEdit(sourceIndex, content, loc, nameIndex) {
44260
44360
  if (content.length) {
44361
+ const contentLengthMinusOne = content.length - 1;
44261
44362
  let contentLineEnd = content.indexOf('\n', 0);
44262
44363
  let previousContentLineEnd = -1;
44263
- while (contentLineEnd >= 0) {
44364
+ // Loop through each line in the content and add a segment, but stop if the last line is empty,
44365
+ // else code afterwards would fill one line too many
44366
+ while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
44264
44367
  const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
44265
44368
  if (nameIndex >= 0) {
44266
44369
  segment.push(nameIndex);
@@ -46102,7 +46205,7 @@ function resolveExt(filename, fs) {
46102
46205
  if (fs.fileExists(filename2))
46103
46206
  return filename2;
46104
46207
  };
46105
- return tryResolve(filename) || tryResolve(filename + `.ts`) || tryResolve(filename + `.d.ts`) || tryResolve(joinPaths(filename, `index.ts`)) || tryResolve(joinPaths(filename, `index.d.ts`));
46208
+ 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`));
46106
46209
  }
46107
46210
  const tsConfigCache = createCache();
46108
46211
  const tsConfigRefMap = /* @__PURE__ */ new Map();
@@ -46758,13 +46861,14 @@ function genModelProps(ctx) {
46758
46861
  let skipCheck = false;
46759
46862
  let runtimeTypes = type && inferRuntimeType(ctx, type);
46760
46863
  if (runtimeTypes) {
46864
+ const hasBoolean = runtimeTypes.includes("Boolean");
46761
46865
  const hasUnknownType = runtimeTypes.includes(UNKNOWN_TYPE);
46762
- runtimeTypes = runtimeTypes.filter((el) => {
46763
- if (el === UNKNOWN_TYPE)
46764
- return false;
46765
- return isProd ? el === "Boolean" || el === "Function" && options : true;
46766
- });
46767
- skipCheck = !isProd && hasUnknownType && runtimeTypes.length > 0;
46866
+ if (isProd || hasUnknownType) {
46867
+ runtimeTypes = runtimeTypes.filter(
46868
+ (t) => t === "Boolean" || hasBoolean && t === "String" || t === "Function" && options
46869
+ );
46870
+ skipCheck = !isProd && hasUnknownType && runtimeTypes.length > 0;
46871
+ }
46768
46872
  }
46769
46873
  let runtimeType = runtimeTypes && runtimeTypes.length > 0 && toRuntimeTypeString(runtimeTypes) || void 0;
46770
46874
  const codegenOptions = concatStrings([
@@ -47437,7 +47541,7 @@ var __spreadValues$1 = (a, b) => {
47437
47541
  };
47438
47542
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
47439
47543
  function compileScript(sfc, options) {
47440
- var _a;
47544
+ var _a, _b, _c;
47441
47545
  if (!options.id) {
47442
47546
  warnOnce$3(
47443
47547
  `compileScript now requires passing the \`id\` option.
@@ -48037,8 +48141,10 @@ ${exposeCall}`
48037
48141
  }
48038
48142
  }
48039
48143
  if (ctx.helperImports.size > 0) {
48144
+ const runtimeModuleName = (_c = (_b = options.templateOptions) == null ? void 0 : _b.compilerOptions) == null ? void 0 : _c.runtimeModuleName;
48145
+ const importSrc = runtimeModuleName ? JSON.stringify(runtimeModuleName) : `'vue'`;
48040
48146
  ctx.s.prepend(
48041
- `import { ${[...ctx.helperImports].map((h) => `${h} as _${h}`).join(", ")} } from 'vue'
48147
+ `import { ${[...ctx.helperImports].map((h) => `${h} as _${h}`).join(", ")} } from ${importSrc}
48042
48148
  `
48043
48149
  );
48044
48150
  }
@@ -48228,7 +48334,7 @@ var __spreadValues = (a, b) => {
48228
48334
  }
48229
48335
  return a;
48230
48336
  };
48231
- const version = "3.4.20";
48337
+ const version = "3.4.22";
48232
48338
  const parseCache = parseCache$1;
48233
48339
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
48234
48340
  const walk = walk$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.4.20",
3
+ "version": "3.4.22",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -42,26 +42,26 @@
42
42
  },
43
43
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
44
44
  "dependencies": {
45
- "@babel/parser": "^7.23.9",
45
+ "@babel/parser": "^7.24.1",
46
46
  "estree-walker": "^2.0.2",
47
- "magic-string": "^0.30.7",
48
- "postcss": "^8.4.35",
49
- "source-map-js": "^1.0.2",
50
- "@vue/compiler-core": "3.4.20",
51
- "@vue/compiler-dom": "3.4.20",
52
- "@vue/compiler-ssr": "3.4.20",
53
- "@vue/shared": "3.4.20"
47
+ "magic-string": "^0.30.8",
48
+ "postcss": "^8.4.38",
49
+ "source-map-js": "^1.2.0",
50
+ "@vue/compiler-core": "3.4.22",
51
+ "@vue/compiler-ssr": "3.4.22",
52
+ "@vue/compiler-dom": "3.4.22",
53
+ "@vue/shared": "3.4.22"
54
54
  },
55
55
  "devDependencies": {
56
- "@babel/types": "^7.23.9",
56
+ "@babel/types": "^7.24.0",
57
57
  "@vue/consolidate": "^1.0.0",
58
58
  "hash-sum": "^2.0.0",
59
59
  "lru-cache": "10.1.0",
60
60
  "merge-source-map": "^1.1.0",
61
- "minimatch": "^9.0.3",
61
+ "minimatch": "^9.0.4",
62
62
  "postcss-modules": "^6.0.0",
63
- "postcss-selector-parser": "^6.0.15",
63
+ "postcss-selector-parser": "^6.0.16",
64
64
  "pug": "^3.0.2",
65
- "sass": "^1.71.1"
65
+ "sass": "^1.74.1"
66
66
  }
67
67
  }