@vue/compiler-sfc 3.5.29 → 3.5.30

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.29
2
+ * @vue/compiler-sfc v3.5.30
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -19708,7 +19708,7 @@ function getObjectOrArrayExpressionKeys(value) {
19708
19708
  return [];
19709
19709
  }
19710
19710
 
19711
- var _a, _b;
19711
+ var _a$1, _b;
19712
19712
  class ScriptCompileContext {
19713
19713
  constructor(descriptor, options) {
19714
19714
  this.descriptor = descriptor;
@@ -19717,7 +19717,7 @@ class ScriptCompileContext {
19717
19717
  this.source = this.descriptor.source;
19718
19718
  this.filename = this.descriptor.filename;
19719
19719
  this.s = new MagicString(this.source);
19720
- this.startOffset = (_a = this.descriptor.scriptSetup) == null ? void 0 : _a.loc.start.offset;
19720
+ this.startOffset = (_a$1 = this.descriptor.scriptSetup) == null ? void 0 : _a$1.loc.start.offset;
19721
19721
  this.endOffset = (_b = this.descriptor.scriptSetup) == null ? void 0 : _b.loc.end.offset;
19722
19722
  this.userImports = /* @__PURE__ */ Object.create(null);
19723
19723
  // macros presence check
@@ -20024,7 +20024,7 @@ const slashPattern = /\\\\/g;
20024
20024
  const openPattern = /\\{/g;
20025
20025
  const closePattern = /\\}/g;
20026
20026
  const commaPattern = /\\,/g;
20027
- const periodPattern = /\\./g;
20027
+ const periodPattern = /\\\./g;
20028
20028
  const EXPANSION_MAX = 100_000;
20029
20029
  function numeric(str) {
20030
20030
  return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
@@ -20394,8 +20394,110 @@ const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true, } = {
20394
20394
  };
20395
20395
 
20396
20396
  // parse a single path portion
20397
+ var _a;
20397
20398
  const types = new Set(['!', '?', '+', '*', '@']);
20398
20399
  const isExtglobType = (c) => types.has(c);
20400
+ const isExtglobAST = (c) => isExtglobType(c.type);
20401
+ // Map of which extglob types can adopt the children of a nested extglob
20402
+ //
20403
+ // anything but ! can adopt a matching type:
20404
+ // +(a|+(b|c)|d) => +(a|b|c|d)
20405
+ // *(a|*(b|c)|d) => *(a|b|c|d)
20406
+ // @(a|@(b|c)|d) => @(a|b|c|d)
20407
+ // ?(a|?(b|c)|d) => ?(a|b|c|d)
20408
+ //
20409
+ // * can adopt anything, because 0 or repetition is allowed
20410
+ // *(a|?(b|c)|d) => *(a|b|c|d)
20411
+ // *(a|+(b|c)|d) => *(a|b|c|d)
20412
+ // *(a|@(b|c)|d) => *(a|b|c|d)
20413
+ //
20414
+ // + can adopt @, because 1 or repetition is allowed
20415
+ // +(a|@(b|c)|d) => +(a|b|c|d)
20416
+ //
20417
+ // + and @ CANNOT adopt *, because 0 would be allowed
20418
+ // +(a|*(b|c)|d) => would match "", on *(b|c)
20419
+ // @(a|*(b|c)|d) => would match "", on *(b|c)
20420
+ //
20421
+ // + and @ CANNOT adopt ?, because 0 would be allowed
20422
+ // +(a|?(b|c)|d) => would match "", on ?(b|c)
20423
+ // @(a|?(b|c)|d) => would match "", on ?(b|c)
20424
+ //
20425
+ // ? can adopt @, because 0 or 1 is allowed
20426
+ // ?(a|@(b|c)|d) => ?(a|b|c|d)
20427
+ //
20428
+ // ? and @ CANNOT adopt * or +, because >1 would be allowed
20429
+ // ?(a|*(b|c)|d) => would match bbb on *(b|c)
20430
+ // @(a|*(b|c)|d) => would match bbb on *(b|c)
20431
+ // ?(a|+(b|c)|d) => would match bbb on +(b|c)
20432
+ // @(a|+(b|c)|d) => would match bbb on +(b|c)
20433
+ //
20434
+ // ! CANNOT adopt ! (nothing else can either)
20435
+ // !(a|!(b|c)|d) => !(a|b|c|d) would fail to match on b (not not b|c)
20436
+ //
20437
+ // ! can adopt @
20438
+ // !(a|@(b|c)|d) => !(a|b|c|d)
20439
+ //
20440
+ // ! CANNOT adopt *
20441
+ // !(a|*(b|c)|d) => !(a|b|c|d) would match on bbb, not allowed
20442
+ //
20443
+ // ! CANNOT adopt +
20444
+ // !(a|+(b|c)|d) => !(a|b|c|d) would match on bbb, not allowed
20445
+ //
20446
+ // ! CANNOT adopt ?
20447
+ // x!(a|?(b|c)|d) => x!(a|b|c|d) would fail to match "x"
20448
+ const adoptionMap = new Map([
20449
+ ['!', ['@']],
20450
+ ['?', ['?', '@']],
20451
+ ['@', ['@']],
20452
+ ['*', ['*', '+', '?', '@']],
20453
+ ['+', ['+', '@']],
20454
+ ]);
20455
+ // nested extglobs that can be adopted in, but with the addition of
20456
+ // a blank '' element.
20457
+ const adoptionWithSpaceMap = new Map([
20458
+ ['!', ['?']],
20459
+ ['@', ['?']],
20460
+ ['+', ['?', '*']],
20461
+ ]);
20462
+ // union of the previous two maps
20463
+ const adoptionAnyMap = new Map([
20464
+ ['!', ['?', '@']],
20465
+ ['?', ['?', '@']],
20466
+ ['@', ['?', '@']],
20467
+ ['*', ['*', '+', '?', '@']],
20468
+ ['+', ['+', '@', '?', '*']],
20469
+ ]);
20470
+ // Extglobs that can take over their parent if they are the only child
20471
+ // the key is parent, value maps child to resulting extglob parent type
20472
+ // '@' is omitted because it's a special case. An `@` extglob with a single
20473
+ // member can always be usurped by that subpattern.
20474
+ const usurpMap = new Map([
20475
+ ['!', new Map([['!', '@']])],
20476
+ [
20477
+ '?',
20478
+ new Map([
20479
+ ['*', '*'],
20480
+ ['+', '*'],
20481
+ ]),
20482
+ ],
20483
+ [
20484
+ '@',
20485
+ new Map([
20486
+ ['!', '!'],
20487
+ ['?', '?'],
20488
+ ['@', '@'],
20489
+ ['*', '*'],
20490
+ ['+', '+'],
20491
+ ]),
20492
+ ],
20493
+ [
20494
+ '+',
20495
+ new Map([
20496
+ ['?', '*'],
20497
+ ['*', '*'],
20498
+ ]),
20499
+ ],
20500
+ ]);
20399
20501
  // Patterns that get prepended to bind to the start of either the
20400
20502
  // entire string, or just a single path portion, to prevent dots
20401
20503
  // and/or traversal patterns, when needed.
@@ -20419,6 +20521,7 @@ const star$1 = qmark$1 + '*?';
20419
20521
  const starNoEmpty = qmark$1 + '+?';
20420
20522
  // remove the \ chars that we added if we end up doing a nonmagic compare
20421
20523
  // const deslash = (s: string) => s.replace(/\\(.)/g, '$1')
20524
+ let ID = 0;
20422
20525
  class AST {
20423
20526
  type;
20424
20527
  #root;
@@ -20434,6 +20537,22 @@ class AST {
20434
20537
  // set to true if it's an extglob with no children
20435
20538
  // (which really means one child of '')
20436
20539
  #emptyExt = false;
20540
+ id = ++ID;
20541
+ get depth() {
20542
+ return (this.#parent?.depth ?? -1) + 1;
20543
+ }
20544
+ [Symbol.for('nodejs.util.inspect.custom')]() {
20545
+ return {
20546
+ '@@type': 'AST',
20547
+ id: this.id,
20548
+ type: this.type,
20549
+ root: this.#root.id,
20550
+ parent: this.#parent?.id,
20551
+ depth: this.depth,
20552
+ partsLength: this.#parts.length,
20553
+ parts: this.#parts,
20554
+ };
20555
+ }
20437
20556
  constructor(type, parent, options = {}) {
20438
20557
  this.type = type;
20439
20558
  // extglobs are inherently magical
@@ -20513,7 +20632,7 @@ class AST {
20513
20632
  continue;
20514
20633
  /* c8 ignore start */
20515
20634
  if (typeof p !== 'string' &&
20516
- !(p instanceof AST && p.#parent === this)) {
20635
+ !(p instanceof _a && p.#parent === this)) {
20517
20636
  throw new Error('invalid part: ' + p);
20518
20637
  }
20519
20638
  /* c8 ignore stop */
@@ -20547,7 +20666,7 @@ class AST {
20547
20666
  const p = this.#parent;
20548
20667
  for (let i = 0; i < this.#parentIndex; i++) {
20549
20668
  const pp = p.#parts[i];
20550
- if (!(pp instanceof AST && pp.type === '!')) {
20669
+ if (!(pp instanceof _a && pp.type === '!')) {
20551
20670
  return false;
20552
20671
  }
20553
20672
  }
@@ -20575,13 +20694,14 @@ class AST {
20575
20694
  this.push(part.clone(this));
20576
20695
  }
20577
20696
  clone(parent) {
20578
- const c = new AST(this.type, parent);
20697
+ const c = new _a(this.type, parent);
20579
20698
  for (const p of this.#parts) {
20580
20699
  c.copyIn(p);
20581
20700
  }
20582
20701
  return c;
20583
20702
  }
20584
- static #parseAST(str, ast, pos, opt) {
20703
+ static #parseAST(str, ast, pos, opt, extDepth) {
20704
+ const maxDepth = opt.maxExtglobRecursion ?? 2;
20585
20705
  let escaping = false;
20586
20706
  let inBrace = false;
20587
20707
  let braceStart = -1;
@@ -20618,11 +20738,17 @@ class AST {
20618
20738
  acc += c;
20619
20739
  continue;
20620
20740
  }
20621
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {
20741
+ // we don't have to check for adoption here, because that's
20742
+ // done at the other recursion point.
20743
+ const doRecurse = !opt.noext &&
20744
+ isExtglobType(c) &&
20745
+ str.charAt(i) === '(' &&
20746
+ extDepth <= maxDepth;
20747
+ if (doRecurse) {
20622
20748
  ast.push(acc);
20623
20749
  acc = '';
20624
- const ext = new AST(c, ast);
20625
- i = AST.#parseAST(str, ext, i, opt);
20750
+ const ext = new _a(c, ast);
20751
+ i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
20626
20752
  ast.push(ext);
20627
20753
  continue;
20628
20754
  }
@@ -20634,7 +20760,7 @@ class AST {
20634
20760
  // some kind of extglob, pos is at the (
20635
20761
  // find the next | or )
20636
20762
  let i = pos + 1;
20637
- let part = new AST(null, ast);
20763
+ let part = new _a(null, ast);
20638
20764
  const parts = [];
20639
20765
  let acc = '';
20640
20766
  while (i < str.length) {
@@ -20665,19 +20791,26 @@ class AST {
20665
20791
  acc += c;
20666
20792
  continue;
20667
20793
  }
20668
- if (isExtglobType(c) && str.charAt(i) === '(') {
20794
+ const doRecurse = !opt.noext &&
20795
+ isExtglobType(c) &&
20796
+ str.charAt(i) === '(' &&
20797
+ /* c8 ignore start - the maxDepth is sufficient here */
20798
+ (extDepth <= maxDepth || (ast && ast.#canAdoptType(c)));
20799
+ /* c8 ignore stop */
20800
+ if (doRecurse) {
20801
+ const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
20669
20802
  part.push(acc);
20670
20803
  acc = '';
20671
- const ext = new AST(c, part);
20804
+ const ext = new _a(c, part);
20672
20805
  part.push(ext);
20673
- i = AST.#parseAST(str, ext, i, opt);
20806
+ i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
20674
20807
  continue;
20675
20808
  }
20676
20809
  if (c === '|') {
20677
20810
  part.push(acc);
20678
20811
  acc = '';
20679
20812
  parts.push(part);
20680
- part = new AST(null, ast);
20813
+ part = new _a(null, ast);
20681
20814
  continue;
20682
20815
  }
20683
20816
  if (c === ')') {
@@ -20699,9 +20832,82 @@ class AST {
20699
20832
  ast.#parts = [str.substring(pos - 1)];
20700
20833
  return i;
20701
20834
  }
20835
+ #canAdoptWithSpace(child) {
20836
+ return this.#canAdopt(child, adoptionWithSpaceMap);
20837
+ }
20838
+ #canAdopt(child, map = adoptionMap) {
20839
+ if (!child ||
20840
+ typeof child !== 'object' ||
20841
+ child.type !== null ||
20842
+ child.#parts.length !== 1 ||
20843
+ this.type === null) {
20844
+ return false;
20845
+ }
20846
+ const gc = child.#parts[0];
20847
+ if (!gc || typeof gc !== 'object' || gc.type === null) {
20848
+ return false;
20849
+ }
20850
+ return this.#canAdoptType(gc.type, map);
20851
+ }
20852
+ #canAdoptType(c, map = adoptionAnyMap) {
20853
+ return !!map.get(this.type)?.includes(c);
20854
+ }
20855
+ #adoptWithSpace(child, index) {
20856
+ const gc = child.#parts[0];
20857
+ const blank = new _a(null, gc, this.options);
20858
+ blank.#parts.push('');
20859
+ gc.push(blank);
20860
+ this.#adopt(child, index);
20861
+ }
20862
+ #adopt(child, index) {
20863
+ const gc = child.#parts[0];
20864
+ this.#parts.splice(index, 1, ...gc.#parts);
20865
+ for (const p of gc.#parts) {
20866
+ if (typeof p === 'object')
20867
+ p.#parent = this;
20868
+ }
20869
+ this.#toString = undefined;
20870
+ }
20871
+ #canUsurpType(c) {
20872
+ const m = usurpMap.get(this.type);
20873
+ return !!(m?.has(c));
20874
+ }
20875
+ #canUsurp(child) {
20876
+ if (!child ||
20877
+ typeof child !== 'object' ||
20878
+ child.type !== null ||
20879
+ child.#parts.length !== 1 ||
20880
+ this.type === null ||
20881
+ this.#parts.length !== 1) {
20882
+ return false;
20883
+ }
20884
+ const gc = child.#parts[0];
20885
+ if (!gc || typeof gc !== 'object' || gc.type === null) {
20886
+ return false;
20887
+ }
20888
+ return this.#canUsurpType(gc.type);
20889
+ }
20890
+ #usurp(child) {
20891
+ const m = usurpMap.get(this.type);
20892
+ const gc = child.#parts[0];
20893
+ const nt = m?.get(gc.type);
20894
+ /* c8 ignore start - impossible */
20895
+ if (!nt)
20896
+ return false;
20897
+ /* c8 ignore stop */
20898
+ this.#parts = gc.#parts;
20899
+ for (const p of this.#parts) {
20900
+ if (typeof p === 'object') {
20901
+ p.#parent = this;
20902
+ }
20903
+ }
20904
+ this.type = nt;
20905
+ this.#toString = undefined;
20906
+ this.#emptyExt = false;
20907
+ }
20702
20908
  static fromGlob(pattern, options = {}) {
20703
- const ast = new AST(null, undefined, options);
20704
- AST.#parseAST(pattern, ast, 0, options);
20909
+ const ast = new _a(null, undefined, options);
20910
+ _a.#parseAST(pattern, ast, 0, options, 0);
20705
20911
  return ast;
20706
20912
  }
20707
20913
  // returns the regular expression if there's magic, or the unescaped
@@ -20805,16 +21011,18 @@ class AST {
20805
21011
  // or start or whatever) and prepend ^ or / at the Regexp construction.
20806
21012
  toRegExpSource(allowDot) {
20807
21013
  const dot = allowDot ?? !!this.#options.dot;
20808
- if (this.#root === this)
21014
+ if (this.#root === this) {
21015
+ this.#flatten();
20809
21016
  this.#fillNegs();
20810
- if (!this.type) {
21017
+ }
21018
+ if (!isExtglobAST(this)) {
20811
21019
  const noEmpty = this.isStart() &&
20812
21020
  this.isEnd() &&
20813
21021
  !this.#parts.some(s => typeof s !== 'string');
20814
21022
  const src = this.#parts
20815
21023
  .map(p => {
20816
21024
  const [re, _, hasMagic, uflag] = typeof p === 'string' ?
20817
- AST.#parseGlob(p, this.#hasMagic, noEmpty)
21025
+ _a.#parseGlob(p, this.#hasMagic, noEmpty)
20818
21026
  : p.toRegExpSource(allowDot);
20819
21027
  this.#hasMagic = this.#hasMagic || hasMagic;
20820
21028
  this.#uflag = this.#uflag || uflag;
@@ -20876,12 +21084,12 @@ class AST {
20876
21084
  // invalid extglob, has to at least be *something* present, if it's
20877
21085
  // the entire path portion.
20878
21086
  const s = this.toString();
20879
- this.#parts = [s];
20880
- this.type = null;
20881
- this.#hasMagic = undefined;
21087
+ const me = this;
21088
+ me.#parts = [s];
21089
+ me.type = null;
21090
+ me.#hasMagic = undefined;
20882
21091
  return [s, unescape(this.toString()), false, false];
20883
21092
  }
20884
- // XXX abstract out this map method
20885
21093
  let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ?
20886
21094
  ''
20887
21095
  : this.#partsToRegExp(true);
@@ -20917,6 +21125,42 @@ class AST {
20917
21125
  this.#uflag,
20918
21126
  ];
20919
21127
  }
21128
+ #flatten() {
21129
+ if (!isExtglobAST(this)) {
21130
+ for (const p of this.#parts) {
21131
+ if (typeof p === 'object') {
21132
+ p.#flatten();
21133
+ }
21134
+ }
21135
+ }
21136
+ else {
21137
+ // do up to 10 passes to flatten as much as possible
21138
+ let iterations = 0;
21139
+ let done = false;
21140
+ do {
21141
+ done = true;
21142
+ for (let i = 0; i < this.#parts.length; i++) {
21143
+ const c = this.#parts[i];
21144
+ if (typeof c === 'object') {
21145
+ c.#flatten();
21146
+ if (this.#canAdopt(c)) {
21147
+ done = false;
21148
+ this.#adopt(c, i);
21149
+ }
21150
+ else if (this.#canAdoptWithSpace(c)) {
21151
+ done = false;
21152
+ this.#adoptWithSpace(c, i);
21153
+ }
21154
+ else if (this.#canUsurp(c)) {
21155
+ done = false;
21156
+ this.#usurp(c);
21157
+ }
21158
+ }
21159
+ }
21160
+ } while (!done && ++iterations < 10);
21161
+ }
21162
+ this.#toString = undefined;
21163
+ }
20920
21164
  #partsToRegExp(dot) {
20921
21165
  return this.#parts
20922
21166
  .map(p => {
@@ -20987,6 +21231,7 @@ class AST {
20987
21231
  return [re, unescape(glob), !!hasMagic, uflag];
20988
21232
  }
20989
21233
  }
21234
+ _a = AST;
20990
21235
 
20991
21236
  /**
20992
21237
  * Escape all magic characters in a glob pattern.
@@ -21204,11 +21449,13 @@ class Minimatch {
21204
21449
  isWindows;
21205
21450
  platform;
21206
21451
  windowsNoMagicRoot;
21452
+ maxGlobstarRecursion;
21207
21453
  regexp;
21208
21454
  constructor(pattern, options = {}) {
21209
21455
  assertValidPattern(pattern);
21210
21456
  options = options || {};
21211
21457
  this.options = options;
21458
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
21212
21459
  this.pattern = pattern;
21213
21460
  this.platform = options.platform || defaultPlatform;
21214
21461
  this.isWindows = this.platform === 'win32';
@@ -21613,7 +21860,8 @@ class Minimatch {
21613
21860
  // out of pattern, then that's fine, as long as all
21614
21861
  // the parts match.
21615
21862
  matchOne(file, pattern, partial = false) {
21616
- const options = this.options;
21863
+ let fileStartIndex = 0;
21864
+ let patternStartIndex = 0;
21617
21865
  // UNC paths like //?/X:/... can match X:/... and vice versa
21618
21866
  // Drive letters in absolute drive or unc paths are always compared
21619
21867
  // case-insensitively.
@@ -21642,14 +21890,11 @@ class Minimatch {
21642
21890
  file[fdi],
21643
21891
  pattern[pdi],
21644
21892
  ];
21893
+ // start matching at the drive letter index of each
21645
21894
  if (fd.toLowerCase() === pd.toLowerCase()) {
21646
21895
  pattern[pdi] = fd;
21647
- if (pdi > fdi) {
21648
- pattern = pattern.slice(pdi);
21649
- }
21650
- else if (fdi > pdi) {
21651
- file = file.slice(fdi);
21652
- }
21896
+ patternStartIndex = pdi;
21897
+ fileStartIndex = fdi;
21653
21898
  }
21654
21899
  }
21655
21900
  }
@@ -21659,99 +21904,185 @@ class Minimatch {
21659
21904
  if (optimizationLevel >= 2) {
21660
21905
  file = this.levelTwoFileOptimize(file);
21661
21906
  }
21662
- this.debug('matchOne', this, { file, pattern });
21663
- this.debug('matchOne', file.length, pattern.length);
21664
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
21907
+ if (pattern.includes(GLOBSTAR)) {
21908
+ return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
21909
+ }
21910
+ return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
21911
+ }
21912
+ #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
21913
+ // split the pattern into head, tail, and middle of ** delimited parts
21914
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
21915
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
21916
+ // split the pattern up into globstar-delimited sections
21917
+ // the tail has to be at the end, and the others just have
21918
+ // to be found in order from the head.
21919
+ const [head, body, tail] = partial ? [
21920
+ pattern.slice(patternIndex, firstgs),
21921
+ pattern.slice(firstgs + 1),
21922
+ [],
21923
+ ] : [
21924
+ pattern.slice(patternIndex, firstgs),
21925
+ pattern.slice(firstgs + 1, lastgs),
21926
+ pattern.slice(lastgs + 1),
21927
+ ];
21928
+ // check the head, from the current file/pattern index.
21929
+ if (head.length) {
21930
+ const fileHead = file.slice(fileIndex, fileIndex + head.length);
21931
+ if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
21932
+ return false;
21933
+ }
21934
+ fileIndex += head.length;
21935
+ patternIndex += head.length;
21936
+ }
21937
+ // now we know the head matches!
21938
+ // if the last portion is not empty, it MUST match the end
21939
+ // check the tail
21940
+ let fileTailMatch = 0;
21941
+ if (tail.length) {
21942
+ // if head + tail > file, then we cannot possibly match
21943
+ if (tail.length + fileIndex > file.length)
21944
+ return false;
21945
+ // try to match the tail
21946
+ let tailStart = file.length - tail.length;
21947
+ if (this.#matchOne(file, tail, partial, tailStart, 0)) {
21948
+ fileTailMatch = tail.length;
21949
+ }
21950
+ else {
21951
+ // affordance for stuff like a/**/* matching a/b/
21952
+ // if the last file portion is '', and there's more to the pattern
21953
+ // then try without the '' bit.
21954
+ if (file[file.length - 1] !== '' ||
21955
+ fileIndex + tail.length === file.length) {
21956
+ return false;
21957
+ }
21958
+ tailStart--;
21959
+ if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
21960
+ return false;
21961
+ }
21962
+ fileTailMatch = tail.length + 1;
21963
+ }
21964
+ }
21965
+ // now we know the tail matches!
21966
+ // the middle is zero or more portions wrapped in **, possibly
21967
+ // containing more ** sections.
21968
+ // so a/**/b/**/c/**/d has become **/b/**/c/**
21969
+ // if it's empty, it means a/**/b, just verify we have no bad dots
21970
+ // if there's no tail, so it ends on /**, then we must have *something*
21971
+ // after the head, or it's not a matc
21972
+ if (!body.length) {
21973
+ let sawSome = !!fileTailMatch;
21974
+ for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
21975
+ const f = String(file[i]);
21976
+ sawSome = true;
21977
+ if (f === '.' ||
21978
+ f === '..' ||
21979
+ (!this.options.dot && f.startsWith('.'))) {
21980
+ return false;
21981
+ }
21982
+ }
21983
+ // in partial mode, we just need to get past all file parts
21984
+ return partial || sawSome;
21985
+ }
21986
+ // now we know that there's one or more body sections, which can
21987
+ // be matched anywhere from the 0 index (because the head was pruned)
21988
+ // through to the length-fileTailMatch index.
21989
+ // split the body up into sections, and note the minimum index it can
21990
+ // be found at (start with the length of all previous segments)
21991
+ // [section, before, after]
21992
+ const bodySegments = [[[], 0]];
21993
+ let currentBody = bodySegments[0];
21994
+ let nonGsParts = 0;
21995
+ const nonGsPartsSums = [0];
21996
+ for (const b of body) {
21997
+ if (b === GLOBSTAR) {
21998
+ nonGsPartsSums.push(nonGsParts);
21999
+ currentBody = [[], 0];
22000
+ bodySegments.push(currentBody);
22001
+ }
22002
+ else {
22003
+ currentBody[0].push(b);
22004
+ nonGsParts++;
22005
+ }
22006
+ }
22007
+ let i = bodySegments.length - 1;
22008
+ const fileLength = file.length - fileTailMatch;
22009
+ for (const b of bodySegments) {
22010
+ b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
22011
+ }
22012
+ return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
22013
+ }
22014
+ // return false for "nope, not matching"
22015
+ // return null for "not matching, cannot keep trying"
22016
+ #matchGlobStarBodySections(file,
22017
+ // pattern section, last possible position for it
22018
+ bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
22019
+ // take the first body segment, and walk from fileIndex to its "after"
22020
+ // value at the end
22021
+ // If it doesn't match at that position, we increment, until we hit
22022
+ // that final possible position, and give up.
22023
+ // If it does match, then advance and try to rest.
22024
+ // If any of them fail we keep walking forward.
22025
+ // this is still a bit recursively painful, but it's more constrained
22026
+ // than previous implementations, because we never test something that
22027
+ // can't possibly be a valid matching condition.
22028
+ const bs = bodySegments[bodyIndex];
22029
+ if (!bs) {
22030
+ // just make sure that there's no bad dots
22031
+ for (let i = fileIndex; i < file.length; i++) {
22032
+ sawTail = true;
22033
+ const f = file[i];
22034
+ if (f === '.' ||
22035
+ f === '..' ||
22036
+ (!this.options.dot && f.startsWith('.'))) {
22037
+ return false;
22038
+ }
22039
+ }
22040
+ return sawTail;
22041
+ }
22042
+ // have a non-globstar body section to test
22043
+ const [body, after] = bs;
22044
+ while (fileIndex <= after) {
22045
+ const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
22046
+ // if limit exceeded, no match. intentional false negative,
22047
+ // acceptable break in correctness for security.
22048
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
22049
+ // match! see if the rest match. if so, we're done!
22050
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
22051
+ if (sub !== false) {
22052
+ return sub;
22053
+ }
22054
+ }
22055
+ const f = file[fileIndex];
22056
+ if (f === '.' ||
22057
+ f === '..' ||
22058
+ (!this.options.dot && f.startsWith('.'))) {
22059
+ return false;
22060
+ }
22061
+ fileIndex++;
22062
+ }
22063
+ // walked off. no point continuing
22064
+ return partial || null;
22065
+ }
22066
+ #matchOne(file, pattern, partial, fileIndex, patternIndex) {
22067
+ let fi;
22068
+ let pi;
22069
+ let pl;
22070
+ let fl;
22071
+ for (fi = fileIndex,
22072
+ pi = patternIndex,
22073
+ fl = file.length,
22074
+ pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
21665
22075
  this.debug('matchOne loop');
21666
- var p = pattern[pi];
21667
- var f = file[fi];
22076
+ let p = pattern[pi];
22077
+ let f = file[fi];
21668
22078
  this.debug(pattern, p, f);
21669
22079
  // should be impossible.
21670
22080
  // some invalid regexp stuff in the set.
21671
22081
  /* c8 ignore start */
21672
- if (p === false) {
22082
+ if (p === false || p === GLOBSTAR) {
21673
22083
  return false;
21674
22084
  }
21675
22085
  /* c8 ignore stop */
21676
- if (p === GLOBSTAR) {
21677
- this.debug('GLOBSTAR', [pattern, p, f]);
21678
- // "**"
21679
- // a/**/b/**/c would match the following:
21680
- // a/b/x/y/z/c
21681
- // a/x/y/z/b/c
21682
- // a/b/x/b/x/c
21683
- // a/b/c
21684
- // To do this, take the rest of the pattern after
21685
- // the **, and see if it would match the file remainder.
21686
- // If so, return success.
21687
- // If not, the ** "swallows" a segment, and try again.
21688
- // This is recursively awful.
21689
- //
21690
- // a/**/b/**/c matching a/b/x/y/z/c
21691
- // - a matches a
21692
- // - doublestar
21693
- // - matchOne(b/x/y/z/c, b/**/c)
21694
- // - b matches b
21695
- // - doublestar
21696
- // - matchOne(x/y/z/c, c) -> no
21697
- // - matchOne(y/z/c, c) -> no
21698
- // - matchOne(z/c, c) -> no
21699
- // - matchOne(c, c) yes, hit
21700
- var fr = fi;
21701
- var pr = pi + 1;
21702
- if (pr === pl) {
21703
- this.debug('** at the end');
21704
- // a ** at the end will just swallow the rest.
21705
- // We have found a match.
21706
- // however, it will not swallow /.x, unless
21707
- // options.dot is set.
21708
- // . and .. are *never* matched by **, for explosively
21709
- // exponential reasons.
21710
- for (; fi < fl; fi++) {
21711
- if (file[fi] === '.' ||
21712
- file[fi] === '..' ||
21713
- (!options.dot && file[fi].charAt(0) === '.'))
21714
- return false;
21715
- }
21716
- return true;
21717
- }
21718
- // ok, let's see if we can swallow whatever we can.
21719
- while (fr < fl) {
21720
- var swallowee = file[fr];
21721
- this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
21722
- // XXX remove this slice. Just pass the start index.
21723
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
21724
- this.debug('globstar found match!', fr, fl, swallowee);
21725
- // found a match.
21726
- return true;
21727
- }
21728
- else {
21729
- // can't swallow "." or ".." ever.
21730
- // can only swallow ".foo" when explicitly asked.
21731
- if (swallowee === '.' ||
21732
- swallowee === '..' ||
21733
- (!options.dot && swallowee.charAt(0) === '.')) {
21734
- this.debug('dot detected!', file, fr, pattern, pr);
21735
- break;
21736
- }
21737
- // ** swallows a segment, and continue.
21738
- this.debug('globstar swallow a segment, and continue');
21739
- fr++;
21740
- }
21741
- }
21742
- // no match was found.
21743
- // However, in partial mode, we can't say this is necessarily over.
21744
- /* c8 ignore start */
21745
- if (partial) {
21746
- // ran out of file
21747
- this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
21748
- if (fr === fl) {
21749
- return true;
21750
- }
21751
- }
21752
- /* c8 ignore stop */
21753
- return false;
21754
- }
21755
22086
  // something other than **
21756
22087
  // non-magic patterns just have to match exactly
21757
22088
  // patterns with magic have been turned into regexps.
@@ -25213,7 +25544,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
25213
25544
  return generator.toJSON();
25214
25545
  }
25215
25546
 
25216
- const version = "3.5.29";
25547
+ const version = "3.5.30";
25217
25548
  const parseCache = parseCache$1;
25218
25549
  const errorMessages = {
25219
25550
  ...CompilerDOM.errorMessages,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.5.29
2
+ * @vue/compiler-sfc v3.5.30
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -36442,7 +36442,15 @@ function requireMapGenerator () {
36442
36442
  }
36443
36443
  }
36444
36444
  } else if (this.css) {
36445
- this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, '');
36445
+ let startIndex;
36446
+ while ((startIndex = this.css.lastIndexOf('/*#')) !== -1) {
36447
+ let endIndex = this.css.indexOf('*/', startIndex + 3);
36448
+ if (endIndex === -1) break
36449
+ while (startIndex > 0 && this.css[startIndex - 1] === '\n') {
36450
+ startIndex--;
36451
+ }
36452
+ this.css = this.css.slice(0, startIndex) + this.css.slice(endIndex + 2);
36453
+ }
36446
36454
  }
36447
36455
  }
36448
36456
 
@@ -36919,7 +36927,7 @@ function requireParser$1 () {
36919
36927
  node.source.end.offset++;
36920
36928
 
36921
36929
  let text = token[1].slice(2, -2);
36922
- if (/^\s*$/.test(text)) {
36930
+ if (!text.trim()) {
36923
36931
  node.text = '';
36924
36932
  node.raws.left = text;
36925
36933
  node.raws.right = '';
@@ -38152,10 +38160,9 @@ function requireNoWorkResult () {
38152
38160
  this._css = css;
38153
38161
  this._opts = opts;
38154
38162
  this._map = undefined;
38155
- let root;
38156
38163
 
38157
38164
  let str = stringify;
38158
- this.result = new Result(this._processor, root, this._opts);
38165
+ this.result = new Result(this._processor, undefined, this._opts);
38159
38166
  this.result.css = css;
38160
38167
 
38161
38168
  let self = this;
@@ -38165,7 +38172,7 @@ function requireNoWorkResult () {
38165
38172
  }
38166
38173
  });
38167
38174
 
38168
- let map = new MapGenerator(str, root, this._opts, css);
38175
+ let map = new MapGenerator(str, undefined, this._opts, css);
38169
38176
  if (map.isMap()) {
38170
38177
  let [generatedCSS, generatedMap] = map.generate();
38171
38178
  if (generatedCSS) {
@@ -38240,7 +38247,7 @@ function requireProcessor$1 () {
38240
38247
 
38241
38248
  class Processor {
38242
38249
  constructor(plugins = []) {
38243
- this.version = '8.5.6';
38250
+ this.version = '8.5.8';
38244
38251
  this.plugins = this.normalize(plugins);
38245
38252
  }
38246
38253
 
@@ -50778,7 +50785,7 @@ var __spreadValues = (a, b) => {
50778
50785
  }
50779
50786
  return a;
50780
50787
  };
50781
- const version = "3.5.29";
50788
+ const version = "3.5.30";
50782
50789
  const parseCache = parseCache$1;
50783
50790
  const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
50784
50791
  const walk = walk$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "3.5.29",
3
+ "version": "3.5.30",
4
4
  "description": "@vue/compiler-sfc",
5
5
  "main": "dist/compiler-sfc.cjs.js",
6
6
  "module": "dist/compiler-sfc.esm-browser.js",
@@ -45,12 +45,12 @@
45
45
  "@babel/parser": "^7.29.0",
46
46
  "estree-walker": "^2.0.2",
47
47
  "magic-string": "^0.30.21",
48
- "postcss": "^8.5.6",
48
+ "postcss": "^8.5.8",
49
49
  "source-map-js": "^1.2.1",
50
- "@vue/shared": "3.5.29",
51
- "@vue/compiler-ssr": "3.5.29",
52
- "@vue/compiler-core": "3.5.29",
53
- "@vue/compiler-dom": "3.5.29"
50
+ "@vue/compiler-dom": "3.5.30",
51
+ "@vue/compiler-core": "3.5.30",
52
+ "@vue/compiler-ssr": "3.5.30",
53
+ "@vue/shared": "3.5.30"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/types": "^7.29.0",
@@ -58,7 +58,7 @@
58
58
  "hash-sum": "^2.0.0",
59
59
  "lru-cache": "10.1.0",
60
60
  "merge-source-map": "^1.1.0",
61
- "minimatch": "~10.2.0",
61
+ "minimatch": "~10.2.4",
62
62
  "postcss-modules": "^6.0.1",
63
63
  "postcss-selector-parser": "^7.1.1",
64
64
  "pug": "^3.0.3",