@vue/compiler-sfc 3.5.41 → 3.5.43

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.5.41
2
+ * @vue/compiler-sfc v3.5.43
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -157,7 +157,7 @@ function parseCssVars(sfc) {
157
157
  const vars = [];
158
158
  sfc.styles.forEach((style) => {
159
159
  let match;
160
- const content = style.content.replace(/\/\*([\s\S]*?)\*\/|\/\/.*/g, "");
160
+ const content = stripComments$2(style.content);
161
161
  while (match = vBindRE.exec(content)) {
162
162
  const start = match.index + match[0].length;
163
163
  const end = lexBinding(content, start);
@@ -171,6 +171,80 @@ function parseCssVars(sfc) {
171
171
  });
172
172
  return vars;
173
173
  }
174
+ const cssSpecialRE = /[/"'\\(]/g;
175
+ function stripComments$2(content) {
176
+ const len = content.length;
177
+ let out = "";
178
+ let last = 0;
179
+ let i = 0;
180
+ cssSpecialRE.lastIndex = 0;
181
+ while (cssSpecialRE.test(content)) {
182
+ i = cssSpecialRE.lastIndex - 1;
183
+ const c = content.charCodeAt(i);
184
+ if (c === 47) {
185
+ const next = content.charCodeAt(i + 1);
186
+ if (next === 42 /* Asterisk */) {
187
+ out += content.slice(last, i);
188
+ const end = content.indexOf("*/", i + 2);
189
+ i = last = end === -1 ? len : end + 2;
190
+ } else if (next === 47) {
191
+ out += content.slice(last, i);
192
+ i += 2;
193
+ while (i < len && !isNewline(content.charCodeAt(i))) i++;
194
+ last = i;
195
+ } else {
196
+ i++;
197
+ }
198
+ } else if (c === 34 || c === 39) {
199
+ i = skipString(content, i + 1, c);
200
+ } else if (c === 92 /* Backslash */) {
201
+ i += 2;
202
+ } else if (isUrlFunction(content, i)) {
203
+ i = skipUrl(content, i + 1);
204
+ } else {
205
+ i++;
206
+ }
207
+ cssSpecialRE.lastIndex = i;
208
+ }
209
+ return last === 0 ? content : out + content.slice(last);
210
+ }
211
+ function skipString(s, i, quote) {
212
+ while (i < s.length) {
213
+ const c = s.charCodeAt(i);
214
+ if (c === quote) return i + 1;
215
+ if (isNewline(c)) return i;
216
+ if (c === 92 /* Backslash */) {
217
+ i += s.charCodeAt(i + 1) === 13 && s.charCodeAt(i + 2) === 10 ? 3 : 2;
218
+ } else {
219
+ i++;
220
+ }
221
+ }
222
+ return i;
223
+ }
224
+ function isUrlFunction(s, i) {
225
+ const prev = s.charCodeAt(i - 4);
226
+ return (s.charCodeAt(i - 3) | 32) === 117 /* LowerU */ && (s.charCodeAt(i - 2) | 32) === 114 /* LowerR */ && (s.charCodeAt(i - 1) | 32) === 108 /* LowerL */ && prev !== 92 /* Backslash */ && !isIdentChar(prev);
227
+ }
228
+ function skipUrl(s, i) {
229
+ while (isWhitespace(s.charCodeAt(i))) i++;
230
+ const c = s.charCodeAt(i);
231
+ if (c === 34 || c === 39) return i;
232
+ while (i < s.length) {
233
+ const c2 = s.charCodeAt(i);
234
+ if (c2 === 41 /* RightParen */) return i + 1;
235
+ i += c2 === 92 /* Backslash */ ? 2 : 1;
236
+ }
237
+ return i;
238
+ }
239
+ function isIdentChar(c) {
240
+ return c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 45 || c === 95 /* Underscore */ || c >= 128;
241
+ }
242
+ function isNewline(c) {
243
+ return c === 10 || c === 13;
244
+ }
245
+ function isWhitespace(c) {
246
+ return c === 32 || c === 9 || c === 12 || isNewline(c);
247
+ }
174
248
  function lexBinding(content, start) {
175
249
  let state = 0 /* inParens */;
176
250
  let parenDepth = 0;
@@ -250,12 +324,7 @@ function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd, defaultVar) {
250
324
  return `
251
325
  import { ${CSS_VARS_HELPER} as _${CSS_VARS_HELPER} } from 'vue'
252
326
  const __injectCSSVars__ = () => {
253
- ${genCssVarsCode(
254
- cssVars,
255
- bindings,
256
- id,
257
- isProd
258
- )}}
327
+ ${genCssVarsCode(cssVars, bindings, id, isProd)}}
259
328
  const __setup__ = ${defaultVar}.setup
260
329
  ${defaultVar}.setup = __setup__
261
330
  ? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }
@@ -7093,8 +7162,9 @@ function requireParser$2 () {
7093
7162
  return indexes;
7094
7163
  }
7095
7164
  function uniqs() {
7096
- var list = Array.prototype.concat.apply([], arguments);
7097
- return list.filter(function (item, i) { return i === list.indexOf(item); });
7165
+ // A Set keeps the first-occurrence order the previous filter/indexOf pass
7166
+ // produced, without its quadratic cost on long index lists.
7167
+ return Array.from(new Set(Array.prototype.concat.apply([], arguments)));
7098
7168
  }
7099
7169
  var Parser = /** @class */ (function () {
7100
7170
  function Parser(rule, options) {
@@ -7139,6 +7209,11 @@ function requireParser$2 () {
7139
7209
  attr.push(this.currToken);
7140
7210
  this.position++;
7141
7211
  }
7212
+ if (!this.currToken) {
7213
+ // Ran off the end of the token stream: the attribute was never closed.
7214
+ // Point at the opening bracket, which is where the author needs to look.
7215
+ return this.expected("closing square bracket", startingToken[tokenize_1.FIELDS.START_POS]);
7216
+ }
7142
7217
  if (this.currToken[tokenize_1.FIELDS.TYPE] !== tokens.closeSquare) {
7143
7218
  return this.expected("closing square bracket", this.currToken[tokenize_1.FIELDS.START_POS]);
7144
7219
  }
@@ -7199,7 +7274,7 @@ function requireParser$2 () {
7199
7274
  }
7200
7275
  if (commentBefore) {
7201
7276
  (0, util_1.ensureObject)(node, "raws", "spaces", "attribute");
7202
- node.raws.spaces.attribute.before = spaceBefore;
7277
+ node.raws.spaces.attribute.before = commentBefore;
7203
7278
  commentBefore = "";
7204
7279
  }
7205
7280
  node.namespace = (node.namespace || "") + content;
@@ -7623,7 +7698,21 @@ function requireParser$2 () {
7623
7698
  return this.error("Unexpected '|'.", this.currToken[tokenize_1.FIELDS.START_POS]);
7624
7699
  };
7625
7700
  Parser.prototype.namespace = function () {
7626
- var before = (this.prevToken && this.content(this.prevToken)) || true;
7701
+ var prev = this.prevToken;
7702
+ // Only treat the previous token as a namespace prefix when it can actually
7703
+ // be one (a type/word or the universal `*`). A comment, comma, combinator
7704
+ // or whitespace before `|` means an empty namespace, not a prefix.
7705
+ var before = prev &&
7706
+ (prev[tokenize_1.FIELDS.TYPE] === tokens.word ||
7707
+ prev[tokenize_1.FIELDS.TYPE] === tokens.asterisk ||
7708
+ prev[tokenize_1.FIELDS.TYPE] === tokens.ampersand)
7709
+ ? this.content(prev)
7710
+ : true;
7711
+ if (!this.nextToken) {
7712
+ // A trailing `|` with nothing after it. `unexpectedPipe` reports against
7713
+ // `currToken`, which is the pipe itself and always present here.
7714
+ return this.unexpectedPipe();
7715
+ }
7627
7716
  if (this.nextToken[tokenize_1.FIELDS.TYPE] === tokens.word) {
7628
7717
  this.position++;
7629
7718
  return this.word(before);
@@ -7653,6 +7742,7 @@ function requireParser$2 () {
7653
7742
  Parser.prototype.parentheses = function () {
7654
7743
  var last = this.current.last;
7655
7744
  var unbalanced = 1;
7745
+ var openingToken = this.currToken;
7656
7746
  this.position++;
7657
7747
  if (last && last.type === types.PSEUDO) {
7658
7748
  var selector = new selector_1.default({
@@ -7722,7 +7812,9 @@ function requireParser$2 () {
7722
7812
  }
7723
7813
  }
7724
7814
  if (unbalanced) {
7725
- return this.expected("closing parenthesis", this.currToken[tokenize_1.FIELDS.START_POS]);
7815
+ // `currToken` is undefined when the token stream ran out before the
7816
+ // parenthesis was closed; fall back to the opening one.
7817
+ return this.expected("closing parenthesis", (this.currToken || openingToken)[tokenize_1.FIELDS.START_POS]);
7726
7818
  }
7727
7819
  };
7728
7820
  Parser.prototype.pseudo = function () {
@@ -7827,8 +7919,14 @@ function requireParser$2 () {
7827
7919
  // Eliminate Sass interpolations from the list of id indexes
7828
7920
  var interpolations = indexesOf(word, "#{");
7829
7921
  if (interpolations.length) {
7830
- hasId = hasId.filter(function (hashIndex) { return !~interpolations.indexOf(hashIndex); });
7922
+ var interpolationIndexes_1 = new Set(interpolations);
7923
+ hasId = hasId.filter(function (hashIndex) { return !interpolationIndexes_1.has(hashIndex); });
7831
7924
  }
7925
+ // Membership tests are built once. Scanning the arrays per index would make
7926
+ // a flat selector such as `.a.a.a...` quadratic in its number of class/id
7927
+ // indexes, which is enough to pin a CPU core on attacker-supplied input.
7928
+ var classIndexes = new Set(hasClass);
7929
+ var idIndexes = new Set(hasId);
7832
7930
  var indices = (0, sortAscending_1.default)(uniqs(__spreadArray(__spreadArray([0], __read(hasClass), false), __read(hasId), false)));
7833
7931
  indices.forEach(function (ind, i) {
7834
7932
  var index = indices[i + 1] || word.length;
@@ -7840,7 +7938,7 @@ function requireParser$2 () {
7840
7938
  var current = _this.currToken;
7841
7939
  var sourceIndex = current[tokenize_1.FIELDS.START_POS] + indices[i];
7842
7940
  var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
7843
- if (~hasClass.indexOf(ind)) {
7941
+ if (classIndexes.has(ind)) {
7844
7942
  var classNameOpts = {
7845
7943
  value: value.slice(1),
7846
7944
  source: source,
@@ -7848,7 +7946,7 @@ function requireParser$2 () {
7848
7946
  };
7849
7947
  node = new className_1.default(unescapeProp(classNameOpts, "value"));
7850
7948
  }
7851
- else if (~hasId.indexOf(ind)) {
7949
+ else if (idIndexes.has(ind)) {
7852
7950
  var idOpts = {
7853
7951
  value: value.slice(1),
7854
7952
  source: source,
@@ -23666,6 +23764,7 @@ function resolveExt(filename, fs) {
23666
23764
  }
23667
23765
  const tsConfigCache = createCache();
23668
23766
  const tsConfigRefMap = /* @__PURE__ */ new Map();
23767
+ const extendedConfigCache = /* @__PURE__ */ new Map();
23669
23768
  function resolveWithTS(containingFile, source, ts2, fs) {
23670
23769
  var _a, _b;
23671
23770
  const configPath = ts2.findConfigFile(containingFile, fs.fileExists);
@@ -23739,7 +23838,10 @@ function loadTSConfig(configPath, ts2, fs, visited = /* @__PURE__ */ new Set())
23739
23838
  parseConfigHost,
23740
23839
  path$1.dirname(configPath),
23741
23840
  void 0,
23742
- configPath
23841
+ configPath,
23842
+ void 0,
23843
+ void 0,
23844
+ extendedConfigCache
23743
23845
  );
23744
23846
  const res = [config];
23745
23847
  visited.add(configPath);
@@ -23762,6 +23864,10 @@ function invalidateTypeCache(filename) {
23762
23864
  fileToScopeCache.delete(filename);
23763
23865
  fileToGlobalScopeCache.delete(filename);
23764
23866
  tsConfigCache.delete(filename);
23867
+ if (filename.endsWith(".json")) {
23868
+ extendedConfigCache.clear();
23869
+ tsConfigCache.clear();
23870
+ }
23765
23871
  const affectedConfig = tsConfigRefMap.get(filename);
23766
23872
  if (affectedConfig) tsConfigCache.delete(affectedConfig);
23767
23873
  }
@@ -25714,6 +25820,8 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
25714
25820
  }
25715
25821
  if (child.type === "BlockStatement") {
25716
25822
  scope.push(child.body);
25823
+ } else if (child.type === "SwitchCase") {
25824
+ scope.push(child.consequent);
25717
25825
  }
25718
25826
  if (child.type === "AwaitExpression") {
25719
25827
  hasAwait = true;
@@ -25729,8 +25837,10 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
25729
25837
  );
25730
25838
  }
25731
25839
  },
25732
- exit(node2) {
25733
- if (node2.type === "BlockStatement") scope.pop();
25840
+ leave(node2) {
25841
+ if (node2.type === "BlockStatement" || node2.type === "SwitchCase") {
25842
+ scope.pop();
25843
+ }
25734
25844
  }
25735
25845
  });
25736
25846
  }
@@ -26261,7 +26371,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
26261
26371
  return generator.toJSON();
26262
26372
  }
26263
26373
 
26264
- const version = "3.5.41";
26374
+ const version = "3.5.43";
26265
26375
  const parseCache = parseCache$1;
26266
26376
  const errorMessages = {
26267
26377
  ...CompilerDOM.errorMessages,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.5.41
2
+ * @vue/compiler-sfc v3.5.43
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -160,10 +160,10 @@ function normalizeStyle(value) {
160
160
  }
161
161
  const listDelimiterRE = /;(?![^(]*\))/g;
162
162
  const propertyDelimiterRE = /:([^]+)/;
163
- const styleCommentRE = /\/\*[^]*?\*\//g;
163
+ const styleCommentRE = /"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;
164
164
  function parseStringStyle(cssText) {
165
165
  const ret = {};
166
- cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
166
+ cssText.replace(styleCommentRE, (match) => match.startsWith("/*") ? "" : match).split(listDelimiterRE).forEach((item) => {
167
167
  if (item) {
168
168
  const tmp = item.split(propertyDelimiterRE);
169
169
  tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
@@ -221,7 +221,7 @@ const isBooleanAttr = /* @__PURE__ */ makeMap(
221
221
  function includeBooleanAttr(value) {
222
222
  return !!value || value === "";
223
223
  }
224
- const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
224
+ const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u000d\u0020]/;
225
225
  const attrValidationCache = {};
226
226
  function isSSRSafeAttrName(name) {
227
227
  if (attrValidationCache.hasOwnProperty(name)) {
@@ -3347,11 +3347,11 @@ const defaultDelimitersClose = new Uint8Array([125, 125]);
3347
3347
  function isTagStartChar(c) {
3348
3348
  return c >= 97 && c <= 122 || c >= 65 && c <= 90;
3349
3349
  }
3350
- function isWhitespace(c) {
3350
+ function isWhitespace$1(c) {
3351
3351
  return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
3352
3352
  }
3353
3353
  function isEndOfTagSection(c) {
3354
- return c === 47 || c === 62 || isWhitespace(c);
3354
+ return c === 47 || c === 62 || isWhitespace$1(c);
3355
3355
  }
3356
3356
  function toCharCodes(str) {
3357
3357
  const ret = new Uint8Array(str.length);
@@ -3562,7 +3562,7 @@ class Tokenizer {
3562
3562
  /** Look for an end tag. For <title> and <textarea>, also decode entities. */
3563
3563
  stateInRCDATA(c) {
3564
3564
  if (this.sequenceIndex === this.currentSequence.length) {
3565
- if (c === 62 || isWhitespace(c)) {
3565
+ if (c === 62 || isWhitespace$1(c)) {
3566
3566
  const endOfText = this.index - this.currentSequence.length;
3567
3567
  if (this.sectionStart < endOfText) {
3568
3568
  const actualIndex = this.index;
@@ -3715,7 +3715,7 @@ class Tokenizer {
3715
3715
  this.stateBeforeAttrName(c);
3716
3716
  }
3717
3717
  stateBeforeClosingTagName(c) {
3718
- if (isWhitespace(c)) ; else if (c === 62) {
3718
+ if (isWhitespace$1(c)) ; else if (c === 62) {
3719
3719
  {
3720
3720
  this.cbs.onerr(14, this.index);
3721
3721
  }
@@ -3727,7 +3727,7 @@ class Tokenizer {
3727
3727
  }
3728
3728
  }
3729
3729
  stateInClosingTagName(c) {
3730
- if (c === 62 || isWhitespace(c)) {
3730
+ if (c === 62 || isWhitespace$1(c)) {
3731
3731
  this.cbs.onclosetag(this.sectionStart, this.index);
3732
3732
  this.sectionStart = -1;
3733
3733
  this.state = 10;
@@ -3758,7 +3758,7 @@ class Tokenizer {
3758
3758
  this.cbs.onopentagend(this.index);
3759
3759
  this.state = 5;
3760
3760
  this.sectionStart = this.index;
3761
- } else if (!isWhitespace(c)) {
3761
+ } else if (!isWhitespace$1(c)) {
3762
3762
  if (c === 61) {
3763
3763
  this.cbs.onerr(
3764
3764
  19,
@@ -3787,7 +3787,7 @@ class Tokenizer {
3787
3787
  this.state = 1;
3788
3788
  this.sectionStart = this.index + 1;
3789
3789
  this.inRCDATA = false;
3790
- } else if (!isWhitespace(c)) {
3790
+ } else if (!isWhitespace$1(c)) {
3791
3791
  this.state = 11;
3792
3792
  this.stateBeforeAttrName(c);
3793
3793
  }
@@ -3866,7 +3866,7 @@ class Tokenizer {
3866
3866
  this.sectionStart = -1;
3867
3867
  this.state = 11;
3868
3868
  this.stateBeforeAttrName(c);
3869
- } else if (!isWhitespace(c)) {
3869
+ } else if (!isWhitespace$1(c)) {
3870
3870
  this.cbs.onattribend(0, this.sectionStart);
3871
3871
  this.handleAttrStart(c);
3872
3872
  }
@@ -3878,7 +3878,7 @@ class Tokenizer {
3878
3878
  } else if (c === 39) {
3879
3879
  this.state = 20;
3880
3880
  this.sectionStart = this.index + 1;
3881
- } else if (!isWhitespace(c)) {
3881
+ } else if (!isWhitespace$1(c)) {
3882
3882
  this.sectionStart = this.index;
3883
3883
  this.state = 21;
3884
3884
  this.stateInAttrValueNoQuotes(c);
@@ -3904,7 +3904,7 @@ class Tokenizer {
3904
3904
  this.handleInAttrValue(c, 39);
3905
3905
  }
3906
3906
  stateInAttrValueNoQuotes(c) {
3907
- if (isWhitespace(c) || c === 62) {
3907
+ if (isWhitespace$1(c) || c === 62) {
3908
3908
  this.cbs.onattribdata(this.sectionStart, this.index);
3909
3909
  this.sectionStart = -1;
3910
3910
  this.cbs.onattribend(1, this.index);
@@ -20089,7 +20089,7 @@ function getMemoedVNodeCall(node) {
20089
20089
  const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
20090
20090
  function isAllWhitespace(str) {
20091
20091
  for (let i = 0; i < str.length; i++) {
20092
- if (!isWhitespace(str.charCodeAt(i))) {
20092
+ if (!isWhitespace$1(str.charCodeAt(i))) {
20093
20093
  return false;
20094
20094
  }
20095
20095
  }
@@ -20142,10 +20142,10 @@ const tokenizer = new Tokenizer(stack, {
20142
20142
  }
20143
20143
  let innerStart = start + tokenizer.delimiterOpen.length;
20144
20144
  let innerEnd = end - tokenizer.delimiterClose.length;
20145
- while (isWhitespace(currentInput.charCodeAt(innerStart))) {
20145
+ while (isWhitespace$1(currentInput.charCodeAt(innerStart))) {
20146
20146
  innerStart++;
20147
20147
  }
20148
- while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
20148
+ while (isWhitespace$1(currentInput.charCodeAt(innerEnd - 1))) {
20149
20149
  innerEnd--;
20150
20150
  }
20151
20151
  let exp = getSlice(innerStart, innerEnd);
@@ -20650,7 +20650,7 @@ function condense(str) {
20650
20650
  let ret = "";
20651
20651
  let prevCharIsWhitespace = false;
20652
20652
  for (let i = 0; i < str.length; i++) {
20653
- if (isWhitespace(str.charCodeAt(i))) {
20653
+ if (isWhitespace$1(str.charCodeAt(i))) {
20654
20654
  if (!prevCharIsWhitespace) {
20655
20655
  ret += " ";
20656
20656
  prevCharIsWhitespace = true;
@@ -28876,7 +28876,7 @@ function parseCssVars(sfc) {
28876
28876
  const vars = [];
28877
28877
  sfc.styles.forEach((style) => {
28878
28878
  let match;
28879
- const content = style.content.replace(/\/\*([\s\S]*?)\*\/|\/\/.*/g, "");
28879
+ const content = stripComments$1(style.content);
28880
28880
  while (match = vBindRE.exec(content)) {
28881
28881
  const start = match.index + match[0].length;
28882
28882
  const end = lexBinding(content, start);
@@ -28890,6 +28890,80 @@ function parseCssVars(sfc) {
28890
28890
  });
28891
28891
  return vars;
28892
28892
  }
28893
+ const cssSpecialRE = /[/"'\\(]/g;
28894
+ function stripComments$1(content) {
28895
+ const len = content.length;
28896
+ let out = "";
28897
+ let last = 0;
28898
+ let i = 0;
28899
+ cssSpecialRE.lastIndex = 0;
28900
+ while (cssSpecialRE.test(content)) {
28901
+ i = cssSpecialRE.lastIndex - 1;
28902
+ const c = content.charCodeAt(i);
28903
+ if (c === 47) {
28904
+ const next = content.charCodeAt(i + 1);
28905
+ if (next === 42 /* Asterisk */) {
28906
+ out += content.slice(last, i);
28907
+ const end = content.indexOf("*/", i + 2);
28908
+ i = last = end === -1 ? len : end + 2;
28909
+ } else if (next === 47) {
28910
+ out += content.slice(last, i);
28911
+ i += 2;
28912
+ while (i < len && !isNewline(content.charCodeAt(i))) i++;
28913
+ last = i;
28914
+ } else {
28915
+ i++;
28916
+ }
28917
+ } else if (c === 34 || c === 39) {
28918
+ i = skipString(content, i + 1, c);
28919
+ } else if (c === 92 /* Backslash */) {
28920
+ i += 2;
28921
+ } else if (isUrlFunction(content, i)) {
28922
+ i = skipUrl(content, i + 1);
28923
+ } else {
28924
+ i++;
28925
+ }
28926
+ cssSpecialRE.lastIndex = i;
28927
+ }
28928
+ return last === 0 ? content : out + content.slice(last);
28929
+ }
28930
+ function skipString(s, i, quote) {
28931
+ while (i < s.length) {
28932
+ const c = s.charCodeAt(i);
28933
+ if (c === quote) return i + 1;
28934
+ if (isNewline(c)) return i;
28935
+ if (c === 92 /* Backslash */) {
28936
+ i += s.charCodeAt(i + 1) === 13 && s.charCodeAt(i + 2) === 10 ? 3 : 2;
28937
+ } else {
28938
+ i++;
28939
+ }
28940
+ }
28941
+ return i;
28942
+ }
28943
+ function isUrlFunction(s, i) {
28944
+ const prev = s.charCodeAt(i - 4);
28945
+ return (s.charCodeAt(i - 3) | 32) === 117 /* LowerU */ && (s.charCodeAt(i - 2) | 32) === 114 /* LowerR */ && (s.charCodeAt(i - 1) | 32) === 108 /* LowerL */ && prev !== 92 /* Backslash */ && !isIdentChar(prev);
28946
+ }
28947
+ function skipUrl(s, i) {
28948
+ while (isWhitespace(s.charCodeAt(i))) i++;
28949
+ const c = s.charCodeAt(i);
28950
+ if (c === 34 || c === 39) return i;
28951
+ while (i < s.length) {
28952
+ const c2 = s.charCodeAt(i);
28953
+ if (c2 === 41 /* RightParen */) return i + 1;
28954
+ i += c2 === 92 /* Backslash */ ? 2 : 1;
28955
+ }
28956
+ return i;
28957
+ }
28958
+ function isIdentChar(c) {
28959
+ return c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 45 || c === 95 /* Underscore */ || c >= 128;
28960
+ }
28961
+ function isNewline(c) {
28962
+ return c === 10 || c === 13;
28963
+ }
28964
+ function isWhitespace(c) {
28965
+ return c === 32 || c === 9 || c === 12 || isNewline(c);
28966
+ }
28893
28967
  function lexBinding(content, start) {
28894
28968
  let state = 0 /* inParens */;
28895
28969
  let parenDepth = 0;
@@ -28969,12 +29043,7 @@ function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd, defaultVar) {
28969
29043
  return `
28970
29044
  import { ${CSS_VARS_HELPER} as _${CSS_VARS_HELPER} } from 'vue'
28971
29045
  const __injectCSSVars__ = () => {
28972
- ${genCssVarsCode(
28973
- cssVars,
28974
- bindings,
28975
- id,
28976
- isProd
28977
- )}}
29046
+ ${genCssVarsCode(cssVars, bindings, id, isProd)}}
28978
29047
  const __setup__ = ${defaultVar}.setup
28979
29048
  ${defaultVar}.setup = __setup__
28980
29049
  ? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }
@@ -34442,6 +34511,14 @@ function requireStringifier () {
34442
34511
  return name + afterName + params
34443
34512
  }
34444
34513
 
34514
+ // `*--x` is not a custom property: the parser checks the first token, and the
34515
+ // `*`/`_` hack prefix moves from `prop` into `before` only after that.
34516
+ function isCustomProperty(node) {
34517
+ if (!node.prop.startsWith('--')) return false
34518
+ let before = node.raws.before;
34519
+ return typeof before === 'undefined' || !/\S$/.test(before)
34520
+ }
34521
+
34445
34522
  function pushBody(str, stack, node) {
34446
34523
  let nodes = node.nodes;
34447
34524
  let last = nodes.length - 1;
@@ -34463,7 +34540,7 @@ function requireStringifier () {
34463
34540
  !childSemicolon &&
34464
34541
  i < nodes.length - 1 &&
34465
34542
  ((child.type === 'atrule' && !child.nodes) ||
34466
- (child.type === 'decl' && child.prop.startsWith('--')))
34543
+ (child.type === 'decl' && isCustomProperty(child)))
34467
34544
  ) {
34468
34545
  childSemicolon = true;
34469
34546
  }
@@ -34817,6 +34894,9 @@ function requireStringifier () {
34817
34894
  }
34818
34895
 
34819
34896
  root(node) {
34897
+ if (node.source && node.source.input.hasBOM) {
34898
+ this.builder('\uFEFF', node, 'start');
34899
+ }
34820
34900
  this.body(node);
34821
34901
  if (node.raws.after) {
34822
34902
  let after = node.raws.after;
@@ -36058,10 +36138,20 @@ function requirePreviousMap () {
36058
36138
  if (hasRequiredPreviousMap) return previousMap;
36059
36139
  hasRequiredPreviousMap = 1;
36060
36140
 
36061
- let { existsSync, readFileSync } = require$$0$1;
36141
+ let { existsSync, readFileSync, realpathSync } = require$$0$1;
36062
36142
  let { dirname, isAbsolute, join, relative, sep } = require$$1;
36063
36143
  let { SourceMapConsumer, SourceMapGenerator } = /*@__PURE__*/ requireSourceMap$1();
36064
36144
 
36145
+ function realPath(path) {
36146
+ try {
36147
+ return realpathSync(path)
36148
+ } catch {
36149
+ // Missing or dangling: keep the literal path. The existsSync() check below
36150
+ // still gates the read, and a path that does not exist cannot escape.
36151
+ return path
36152
+ }
36153
+ }
36154
+
36065
36155
  function fromBase64(str) {
36066
36156
  if (Buffer$1) {
36067
36157
  return Buffer$1.from(str, 'base64').toString()
@@ -36147,7 +36237,9 @@ function requirePreviousMap () {
36147
36237
  if (!/\.map$/i.test(path)) return undefined
36148
36238
  if (!cssFile) return undefined
36149
36239
 
36150
- let rel = relative(dirname(cssFile), path);
36240
+ // Compare *resolved* paths: relative() is textual, so without this a
36241
+ // symlink at or below the CSS file's directory points the map outside it.
36242
+ let rel = relative(realPath(dirname(cssFile)), realPath(path));
36151
36243
  if (rel === '..' || rel.startsWith('..' + sep) || isAbsolute(rel)) {
36152
36244
  return undefined
36153
36245
  }
@@ -36615,6 +36707,7 @@ function requireList () {
36615
36707
  },
36616
36708
 
36617
36709
  split(string, separators, last) {
36710
+ if (typeof string !== 'string') return []
36618
36711
  let array = [];
36619
36712
  let current = '';
36620
36713
  let split = false;
@@ -36645,7 +36738,8 @@ function requireList () {
36645
36738
  }
36646
36739
 
36647
36740
  if (split) {
36648
- if (current !== '') array.push(current.trim());
36741
+ let value = current.trim();
36742
+ if (last || value !== '') array.push(value);
36649
36743
  current = '';
36650
36744
  split = false;
36651
36745
  } else {
@@ -36653,7 +36747,8 @@ function requireList () {
36653
36747
  }
36654
36748
  }
36655
36749
 
36656
- if (last || current !== '') array.push(current.trim());
36750
+ let value = current.trim();
36751
+ if (last || value !== '') array.push(value);
36657
36752
  return array
36658
36753
  }
36659
36754
  };
@@ -36895,9 +36990,10 @@ function requireMapGenerator () {
36895
36990
  }
36896
36991
  }
36897
36992
  } else if (this.css) {
36993
+ let annotation = '/*# sourceMappingURL=';
36898
36994
  let startIndex;
36899
- while ((startIndex = this.css.lastIndexOf('/*#')) !== -1) {
36900
- let endIndex = this.css.indexOf('*/', startIndex + 3);
36995
+ while ((startIndex = this.css.lastIndexOf(annotation)) !== -1) {
36996
+ let endIndex = this.css.indexOf('*/', startIndex + annotation.length);
36901
36997
  if (endIndex === -1) break
36902
36998
  while (startIndex > 0 && this.css[startIndex - 1] === '\n') {
36903
36999
  startIndex--;
@@ -37558,8 +37654,11 @@ function requireParser$1 () {
37558
37654
  if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {
37559
37655
  prev.raws.ownSemicolon = this.spaces;
37560
37656
  this.spaces = '';
37657
+ // `ownSemicolon` also holds the spaces before the semicolon, but
37658
+ // the position above is the semicolon itself, so the node ends
37659
+ // right after it.
37561
37660
  prev.source.end = this.getPosition(token[2]);
37562
- prev.source.end.offset += prev.raws.ownSemicolon.length;
37661
+ prev.source.end.offset++;
37563
37662
  }
37564
37663
  }
37565
37664
  }
@@ -38510,14 +38609,24 @@ function requireLazyResult () {
38510
38609
 
38511
38610
  if (visit.iterator !== 0) {
38512
38611
  let iterator = visit.iterator;
38612
+ // Advance past the child we just finished visiting. Like
38613
+ // `Container#each`, the index is incremented only after a child has
38614
+ // been fully processed, so a node inserted right after the current
38615
+ // child is not skipped by the `existIndex < index` adjustment in
38616
+ // `Container#insertAfter()` (which would fire exit events too early).
38617
+ if (visit.descending) {
38618
+ visit.descending = false;
38619
+ node.indexes[iterator] += 1;
38620
+ }
38513
38621
  let child;
38514
38622
  while ((child = node.nodes[node.indexes[iterator]])) {
38515
- node.indexes[iterator] += 1;
38516
38623
  if (!child[isClean]) {
38517
38624
  child[isClean] = true;
38625
+ visit.descending = true;
38518
38626
  stack.push(toStack(child));
38519
38627
  return
38520
38628
  }
38629
+ node.indexes[iterator] += 1;
38521
38630
  }
38522
38631
  visit.iterator = 0;
38523
38632
  delete node.indexes[iterator];
@@ -38555,12 +38664,22 @@ function requireLazyResult () {
38555
38664
 
38556
38665
  if (visit.iterator !== 0) {
38557
38666
  let iterator = visit.iterator;
38667
+ // Advance past the child we just finished visiting. Like
38668
+ // `Container#each`, the index is incremented only after a child has
38669
+ // been fully processed. Incrementing before (as this loop used to)
38670
+ // makes a node inserted right after the current child get skipped by
38671
+ // the `existIndex < index` adjustment in `Container#insertAfter()`,
38672
+ // which fires exit events before those new siblings are visited.
38673
+ if (visit.descending) {
38674
+ visit.descending = false;
38675
+ visitNode.indexes[iterator] += 1;
38676
+ }
38558
38677
  let child;
38559
38678
  let descended = false;
38560
38679
  while ((child = visitNode.nodes[visitNode.indexes[iterator]])) {
38561
- visitNode.indexes[iterator] += 1;
38562
38680
  if (!child[isClean]) {
38563
38681
  child[isClean] = true;
38682
+ visit.descending = true;
38564
38683
  stack.push({
38565
38684
  eventIndex: 0,
38566
38685
  events: getEvents(child),
@@ -38570,6 +38689,7 @@ function requireLazyResult () {
38570
38689
  descended = true;
38571
38690
  break
38572
38691
  }
38692
+ visitNode.indexes[iterator] += 1;
38573
38693
  }
38574
38694
  if (descended) continue
38575
38695
  visit.iterator = 0;
@@ -38772,7 +38892,7 @@ function requireProcessor$1 () {
38772
38892
 
38773
38893
  class Processor {
38774
38894
  constructor(plugins = []) {
38775
- this.version = '8.5.23';
38895
+ this.version = '8.5.28';
38776
38896
  this.plugins = this.normalize(plugins);
38777
38897
  }
38778
38898
 
@@ -38878,7 +38998,7 @@ function requirePostcss () {
38878
38998
  ': postcss.plugin was deprecated. Migration guide:\n' +
38879
38999
  'https://evilmartians.com/chronicles/postcss-8-plugin-migration'
38880
39000
  );
38881
- if (browser$1.env.LANG && browser$1.env.LANG.startsWith('cn')) {
39001
+ if (browser$1.env.LANG && browser$1.env.LANG.startsWith('zh')) {
38882
39002
  /* c8 ignore next 7 */
38883
39003
  // eslint-disable-next-line no-console
38884
39004
  console.warn(
@@ -41636,8 +41756,9 @@ function requireParser () {
41636
41756
  return indexes;
41637
41757
  }
41638
41758
  function uniqs() {
41639
- var list = Array.prototype.concat.apply([], arguments);
41640
- return list.filter(function (item, i) { return i === list.indexOf(item); });
41759
+ // A Set keeps the first-occurrence order the previous filter/indexOf pass
41760
+ // produced, without its quadratic cost on long index lists.
41761
+ return Array.from(new Set(Array.prototype.concat.apply([], arguments)));
41641
41762
  }
41642
41763
  var Parser = /** @class */ (function () {
41643
41764
  function Parser(rule, options) {
@@ -41682,6 +41803,11 @@ function requireParser () {
41682
41803
  attr.push(this.currToken);
41683
41804
  this.position++;
41684
41805
  }
41806
+ if (!this.currToken) {
41807
+ // Ran off the end of the token stream: the attribute was never closed.
41808
+ // Point at the opening bracket, which is where the author needs to look.
41809
+ return this.expected("closing square bracket", startingToken[tokenize_1.FIELDS.START_POS]);
41810
+ }
41685
41811
  if (this.currToken[tokenize_1.FIELDS.TYPE] !== tokens.closeSquare) {
41686
41812
  return this.expected("closing square bracket", this.currToken[tokenize_1.FIELDS.START_POS]);
41687
41813
  }
@@ -41742,7 +41868,7 @@ function requireParser () {
41742
41868
  }
41743
41869
  if (commentBefore) {
41744
41870
  (0, util_1.ensureObject)(node, "raws", "spaces", "attribute");
41745
- node.raws.spaces.attribute.before = spaceBefore;
41871
+ node.raws.spaces.attribute.before = commentBefore;
41746
41872
  commentBefore = "";
41747
41873
  }
41748
41874
  node.namespace = (node.namespace || "") + content;
@@ -42166,7 +42292,21 @@ function requireParser () {
42166
42292
  return this.error("Unexpected '|'.", this.currToken[tokenize_1.FIELDS.START_POS]);
42167
42293
  };
42168
42294
  Parser.prototype.namespace = function () {
42169
- var before = (this.prevToken && this.content(this.prevToken)) || true;
42295
+ var prev = this.prevToken;
42296
+ // Only treat the previous token as a namespace prefix when it can actually
42297
+ // be one (a type/word or the universal `*`). A comment, comma, combinator
42298
+ // or whitespace before `|` means an empty namespace, not a prefix.
42299
+ var before = prev &&
42300
+ (prev[tokenize_1.FIELDS.TYPE] === tokens.word ||
42301
+ prev[tokenize_1.FIELDS.TYPE] === tokens.asterisk ||
42302
+ prev[tokenize_1.FIELDS.TYPE] === tokens.ampersand)
42303
+ ? this.content(prev)
42304
+ : true;
42305
+ if (!this.nextToken) {
42306
+ // A trailing `|` with nothing after it. `unexpectedPipe` reports against
42307
+ // `currToken`, which is the pipe itself and always present here.
42308
+ return this.unexpectedPipe();
42309
+ }
42170
42310
  if (this.nextToken[tokenize_1.FIELDS.TYPE] === tokens.word) {
42171
42311
  this.position++;
42172
42312
  return this.word(before);
@@ -42196,6 +42336,7 @@ function requireParser () {
42196
42336
  Parser.prototype.parentheses = function () {
42197
42337
  var last = this.current.last;
42198
42338
  var unbalanced = 1;
42339
+ var openingToken = this.currToken;
42199
42340
  this.position++;
42200
42341
  if (last && last.type === types.PSEUDO) {
42201
42342
  var selector = new selector_1.default({
@@ -42265,7 +42406,9 @@ function requireParser () {
42265
42406
  }
42266
42407
  }
42267
42408
  if (unbalanced) {
42268
- return this.expected("closing parenthesis", this.currToken[tokenize_1.FIELDS.START_POS]);
42409
+ // `currToken` is undefined when the token stream ran out before the
42410
+ // parenthesis was closed; fall back to the opening one.
42411
+ return this.expected("closing parenthesis", (this.currToken || openingToken)[tokenize_1.FIELDS.START_POS]);
42269
42412
  }
42270
42413
  };
42271
42414
  Parser.prototype.pseudo = function () {
@@ -42370,8 +42513,14 @@ function requireParser () {
42370
42513
  // Eliminate Sass interpolations from the list of id indexes
42371
42514
  var interpolations = indexesOf(word, "#{");
42372
42515
  if (interpolations.length) {
42373
- hasId = hasId.filter(function (hashIndex) { return !~interpolations.indexOf(hashIndex); });
42374
- }
42516
+ var interpolationIndexes_1 = new Set(interpolations);
42517
+ hasId = hasId.filter(function (hashIndex) { return !interpolationIndexes_1.has(hashIndex); });
42518
+ }
42519
+ // Membership tests are built once. Scanning the arrays per index would make
42520
+ // a flat selector such as `.a.a.a...` quadratic in its number of class/id
42521
+ // indexes, which is enough to pin a CPU core on attacker-supplied input.
42522
+ var classIndexes = new Set(hasClass);
42523
+ var idIndexes = new Set(hasId);
42375
42524
  var indices = (0, sortAscending_1.default)(uniqs(__spreadArray(__spreadArray([0], __read(hasClass), false), __read(hasId), false)));
42376
42525
  indices.forEach(function (ind, i) {
42377
42526
  var index = indices[i + 1] || word.length;
@@ -42383,7 +42532,7 @@ function requireParser () {
42383
42532
  var current = _this.currToken;
42384
42533
  var sourceIndex = current[tokenize_1.FIELDS.START_POS] + indices[i];
42385
42534
  var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1));
42386
- if (~hasClass.indexOf(ind)) {
42535
+ if (classIndexes.has(ind)) {
42387
42536
  var classNameOpts = {
42388
42537
  value: value.slice(1),
42389
42538
  source: source,
@@ -42391,7 +42540,7 @@ function requireParser () {
42391
42540
  };
42392
42541
  node = new className_1.default(unescapeProp(classNameOpts, "value"));
42393
42542
  }
42394
- else if (~hasId.indexOf(ind)) {
42543
+ else if (idIndexes.has(ind)) {
42395
42544
  var idOpts = {
42396
42545
  value: value.slice(1),
42397
42546
  source: source,
@@ -49337,6 +49486,7 @@ function resolveExt(filename, fs) {
49337
49486
  }
49338
49487
  const tsConfigCache = createCache();
49339
49488
  const tsConfigRefMap = /* @__PURE__ */ new Map();
49489
+ const extendedConfigCache = /* @__PURE__ */ new Map();
49340
49490
  function resolveWithTS(containingFile, source, ts2, fs) {
49341
49491
  return;
49342
49492
  }
@@ -49347,6 +49497,10 @@ function invalidateTypeCache(filename) {
49347
49497
  fileToScopeCache.delete(filename);
49348
49498
  fileToGlobalScopeCache.delete(filename);
49349
49499
  tsConfigCache.delete(filename);
49500
+ if (filename.endsWith(".json")) {
49501
+ extendedConfigCache.clear();
49502
+ tsConfigCache.clear();
49503
+ }
49350
49504
  const affectedConfig = tsConfigRefMap.get(filename);
49351
49505
  if (affectedConfig) tsConfigCache.delete(affectedConfig);
49352
49506
  }
@@ -51318,6 +51472,8 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
51318
51472
  }
51319
51473
  if (child.type === "BlockStatement") {
51320
51474
  scope.push(child.body);
51475
+ } else if (child.type === "SwitchCase") {
51476
+ scope.push(child.consequent);
51321
51477
  }
51322
51478
  if (child.type === "AwaitExpression") {
51323
51479
  hasAwait = true;
@@ -51333,8 +51489,10 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
51333
51489
  );
51334
51490
  }
51335
51491
  },
51336
- exit(node2) {
51337
- if (node2.type === "BlockStatement") scope.pop();
51492
+ leave(node2) {
51493
+ if (node2.type === "BlockStatement" || node2.type === "SwitchCase") {
51494
+ scope.pop();
51495
+ }
51338
51496
  }
51339
51497
  });
51340
51498
  }
@@ -51876,7 +52034,7 @@ var __spreadValues = (a, b) => {
51876
52034
  }
51877
52035
  return a;
51878
52036
  };
51879
- const version = "3.5.41";
52037
+ const version = "3.5.43";
51880
52038
  const parseCache = parseCache$1;
51881
52039
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
51882
52040
  const walk = walk$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.5.41",
3
+ "version": "3.5.43",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -43,14 +43,14 @@
43
43
  "homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
44
44
  "dependencies": {
45
45
  "@babel/parser": "^7.29.8",
46
+ "@vue/compiler-core": "3.5.43",
47
+ "@vue/compiler-dom": "3.5.43",
48
+ "@vue/compiler-ssr": "3.5.43",
49
+ "@vue/shared": "3.5.43",
46
50
  "estree-walker": "^2.0.2",
47
51
  "magic-string": "^0.30.21",
48
- "postcss": "^8.5.19",
49
- "source-map-js": "^1.2.1",
50
- "@vue/compiler-core": "3.5.41",
51
- "@vue/shared": "3.5.41",
52
- "@vue/compiler-dom": "3.5.41",
53
- "@vue/compiler-ssr": "3.5.41"
52
+ "postcss": "^8.5.28",
53
+ "source-map-js": "^1.2.1"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/types": "^7.29.8",
@@ -60,8 +60,8 @@
60
60
  "merge-source-map": "^1.1.0",
61
61
  "minimatch": "~10.2.6",
62
62
  "postcss-modules": "^6.0.1",
63
- "postcss-selector-parser": "^7.1.4",
63
+ "postcss-selector-parser": "^7.1.6",
64
64
  "pug": "^3.0.4",
65
- "sass": "^1.102.0"
65
+ "sass": "^1.104.1"
66
66
  }
67
67
  }