@vue/compiler-sfc 3.5.28 → 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.
- package/README.md +1 -1
- package/dist/compiler-sfc.cjs.js +530 -185
- package/dist/compiler-sfc.esm-browser.js +15 -8
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Lower level utilities for compiling Vue Single File Components
|
|
4
4
|
|
|
5
|
-
**Note: as of 3.2.13+, this package is included as a dependency of the main `vue` package and can be accessed as `vue/compiler-sfc`. This means you no longer need to explicitly install this package and ensure its version
|
|
5
|
+
**Note: as of 3.2.13+, this package is included as a dependency of the main `vue` package and can be accessed as `vue/compiler-sfc`. This means you no longer need to explicitly install this package and ensure its version matches that of `vue`'s. Just use the main `vue/compiler-sfc` deep import instead.**
|
|
6
6
|
|
|
7
7
|
This package contains lower level utilities that you can use if you are writing a plugin / transform for a bundler or module system that compiles Vue Single File Components (SFCs) into JavaScript. It is used in [vue-loader](https://github.com/vuejs/vue-loader) and [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue).
|
|
8
8
|
|
package/dist/compiler-sfc.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.5.
|
|
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 =
|
|
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);
|
|
@@ -20353,10 +20353,8 @@ const parseClass = (glob, position) => {
|
|
|
20353
20353
|
}
|
|
20354
20354
|
const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']';
|
|
20355
20355
|
const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']';
|
|
20356
|
-
const comb = ranges.length && negs.length
|
|
20357
|
-
|
|
20358
|
-
: ranges.length
|
|
20359
|
-
? sranges
|
|
20356
|
+
const comb = ranges.length && negs.length ? '(' + sranges + '|' + snegs + ')'
|
|
20357
|
+
: ranges.length ? sranges
|
|
20360
20358
|
: snegs;
|
|
20361
20359
|
return [comb, uflag, endPos - pos, true];
|
|
20362
20360
|
};
|
|
@@ -20382,22 +20380,124 @@ const parseClass = (glob, position) => {
|
|
|
20382
20380
|
*/
|
|
20383
20381
|
const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true, } = {}) => {
|
|
20384
20382
|
if (magicalBraces) {
|
|
20385
|
-
return windowsPathsNoEscape
|
|
20386
|
-
|
|
20383
|
+
return windowsPathsNoEscape ?
|
|
20384
|
+
s.replace(/\[([^\/\\])\]/g, '$1')
|
|
20387
20385
|
: s
|
|
20388
20386
|
.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2')
|
|
20389
20387
|
.replace(/\\([^\/])/g, '$1');
|
|
20390
20388
|
}
|
|
20391
|
-
return windowsPathsNoEscape
|
|
20392
|
-
|
|
20389
|
+
return windowsPathsNoEscape ?
|
|
20390
|
+
s.replace(/\[([^\/\\{}])\]/g, '$1')
|
|
20393
20391
|
: s
|
|
20394
20392
|
.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, '$1$2')
|
|
20395
20393
|
.replace(/\\([^\/{}])/g, '$1');
|
|
20396
20394
|
};
|
|
20397
20395
|
|
|
20398
20396
|
// parse a single path portion
|
|
20397
|
+
var _a;
|
|
20399
20398
|
const types = new Set(['!', '?', '+', '*', '@']);
|
|
20400
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
|
+
]);
|
|
20401
20501
|
// Patterns that get prepended to bind to the start of either the
|
|
20402
20502
|
// entire string, or just a single path portion, to prevent dots
|
|
20403
20503
|
// and/or traversal patterns, when needed.
|
|
@@ -20421,6 +20521,7 @@ const star$1 = qmark$1 + '*?';
|
|
|
20421
20521
|
const starNoEmpty = qmark$1 + '+?';
|
|
20422
20522
|
// remove the \ chars that we added if we end up doing a nonmagic compare
|
|
20423
20523
|
// const deslash = (s: string) => s.replace(/\\(.)/g, '$1')
|
|
20524
|
+
let ID = 0;
|
|
20424
20525
|
class AST {
|
|
20425
20526
|
type;
|
|
20426
20527
|
#root;
|
|
@@ -20436,6 +20537,22 @@ class AST {
|
|
|
20436
20537
|
// set to true if it's an extglob with no children
|
|
20437
20538
|
// (which really means one child of '')
|
|
20438
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
|
+
}
|
|
20439
20556
|
constructor(type, parent, options = {}) {
|
|
20440
20557
|
this.type = type;
|
|
20441
20558
|
// extglobs are inherently magical
|
|
@@ -20514,7 +20631,8 @@ class AST {
|
|
|
20514
20631
|
if (p === '')
|
|
20515
20632
|
continue;
|
|
20516
20633
|
/* c8 ignore start */
|
|
20517
|
-
if (typeof p !== 'string' &&
|
|
20634
|
+
if (typeof p !== 'string' &&
|
|
20635
|
+
!(p instanceof _a && p.#parent === this)) {
|
|
20518
20636
|
throw new Error('invalid part: ' + p);
|
|
20519
20637
|
}
|
|
20520
20638
|
/* c8 ignore stop */
|
|
@@ -20522,8 +20640,10 @@ class AST {
|
|
|
20522
20640
|
}
|
|
20523
20641
|
}
|
|
20524
20642
|
toJSON() {
|
|
20525
|
-
const ret = this.type === null
|
|
20526
|
-
|
|
20643
|
+
const ret = this.type === null ?
|
|
20644
|
+
this.#parts
|
|
20645
|
+
.slice()
|
|
20646
|
+
.map(p => (typeof p === 'string' ? p : p.toJSON()))
|
|
20527
20647
|
: [this.type, ...this.#parts.map(p => p.toJSON())];
|
|
20528
20648
|
if (this.isStart() && !this.type)
|
|
20529
20649
|
ret.unshift([]);
|
|
@@ -20546,7 +20666,7 @@ class AST {
|
|
|
20546
20666
|
const p = this.#parent;
|
|
20547
20667
|
for (let i = 0; i < this.#parentIndex; i++) {
|
|
20548
20668
|
const pp = p.#parts[i];
|
|
20549
|
-
if (!(pp instanceof
|
|
20669
|
+
if (!(pp instanceof _a && pp.type === '!')) {
|
|
20550
20670
|
return false;
|
|
20551
20671
|
}
|
|
20552
20672
|
}
|
|
@@ -20574,13 +20694,14 @@ class AST {
|
|
|
20574
20694
|
this.push(part.clone(this));
|
|
20575
20695
|
}
|
|
20576
20696
|
clone(parent) {
|
|
20577
|
-
const c = new
|
|
20697
|
+
const c = new _a(this.type, parent);
|
|
20578
20698
|
for (const p of this.#parts) {
|
|
20579
20699
|
c.copyIn(p);
|
|
20580
20700
|
}
|
|
20581
20701
|
return c;
|
|
20582
20702
|
}
|
|
20583
|
-
static #parseAST(str, ast, pos, opt) {
|
|
20703
|
+
static #parseAST(str, ast, pos, opt, extDepth) {
|
|
20704
|
+
const maxDepth = opt.maxExtglobRecursion ?? 2;
|
|
20584
20705
|
let escaping = false;
|
|
20585
20706
|
let inBrace = false;
|
|
20586
20707
|
let braceStart = -1;
|
|
@@ -20617,11 +20738,17 @@ class AST {
|
|
|
20617
20738
|
acc += c;
|
|
20618
20739
|
continue;
|
|
20619
20740
|
}
|
|
20620
|
-
|
|
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) {
|
|
20621
20748
|
ast.push(acc);
|
|
20622
20749
|
acc = '';
|
|
20623
|
-
const ext = new
|
|
20624
|
-
i =
|
|
20750
|
+
const ext = new _a(c, ast);
|
|
20751
|
+
i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
|
|
20625
20752
|
ast.push(ext);
|
|
20626
20753
|
continue;
|
|
20627
20754
|
}
|
|
@@ -20633,7 +20760,7 @@ class AST {
|
|
|
20633
20760
|
// some kind of extglob, pos is at the (
|
|
20634
20761
|
// find the next | or )
|
|
20635
20762
|
let i = pos + 1;
|
|
20636
|
-
let part = new
|
|
20763
|
+
let part = new _a(null, ast);
|
|
20637
20764
|
const parts = [];
|
|
20638
20765
|
let acc = '';
|
|
20639
20766
|
while (i < str.length) {
|
|
@@ -20664,19 +20791,26 @@ class AST {
|
|
|
20664
20791
|
acc += c;
|
|
20665
20792
|
continue;
|
|
20666
20793
|
}
|
|
20667
|
-
|
|
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;
|
|
20668
20802
|
part.push(acc);
|
|
20669
20803
|
acc = '';
|
|
20670
|
-
const ext = new
|
|
20804
|
+
const ext = new _a(c, part);
|
|
20671
20805
|
part.push(ext);
|
|
20672
|
-
i =
|
|
20806
|
+
i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
|
|
20673
20807
|
continue;
|
|
20674
20808
|
}
|
|
20675
20809
|
if (c === '|') {
|
|
20676
20810
|
part.push(acc);
|
|
20677
20811
|
acc = '';
|
|
20678
20812
|
parts.push(part);
|
|
20679
|
-
part = new
|
|
20813
|
+
part = new _a(null, ast);
|
|
20680
20814
|
continue;
|
|
20681
20815
|
}
|
|
20682
20816
|
if (c === ')') {
|
|
@@ -20698,9 +20832,82 @@ class AST {
|
|
|
20698
20832
|
ast.#parts = [str.substring(pos - 1)];
|
|
20699
20833
|
return i;
|
|
20700
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
|
+
}
|
|
20701
20908
|
static fromGlob(pattern, options = {}) {
|
|
20702
|
-
const ast = new
|
|
20703
|
-
|
|
20909
|
+
const ast = new _a(null, undefined, options);
|
|
20910
|
+
_a.#parseAST(pattern, ast, 0, options, 0);
|
|
20704
20911
|
return ast;
|
|
20705
20912
|
}
|
|
20706
20913
|
// returns the regular expression if there's magic, or the unescaped
|
|
@@ -20804,16 +21011,18 @@ class AST {
|
|
|
20804
21011
|
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
20805
21012
|
toRegExpSource(allowDot) {
|
|
20806
21013
|
const dot = allowDot ?? !!this.#options.dot;
|
|
20807
|
-
if (this.#root === this)
|
|
21014
|
+
if (this.#root === this) {
|
|
21015
|
+
this.#flatten();
|
|
20808
21016
|
this.#fillNegs();
|
|
20809
|
-
|
|
21017
|
+
}
|
|
21018
|
+
if (!isExtglobAST(this)) {
|
|
20810
21019
|
const noEmpty = this.isStart() &&
|
|
20811
21020
|
this.isEnd() &&
|
|
20812
21021
|
!this.#parts.some(s => typeof s !== 'string');
|
|
20813
21022
|
const src = this.#parts
|
|
20814
21023
|
.map(p => {
|
|
20815
|
-
const [re, _, hasMagic, uflag] = typeof p === 'string'
|
|
20816
|
-
|
|
21024
|
+
const [re, _, hasMagic, uflag] = typeof p === 'string' ?
|
|
21025
|
+
_a.#parseGlob(p, this.#hasMagic, noEmpty)
|
|
20817
21026
|
: p.toRegExpSource(allowDot);
|
|
20818
21027
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
20819
21028
|
this.#uflag = this.#uflag || uflag;
|
|
@@ -20842,7 +21051,10 @@ class AST {
|
|
|
20842
21051
|
// no need to prevent dots if it can't match a dot, or if a
|
|
20843
21052
|
// sub-pattern will be preventing it anyway.
|
|
20844
21053
|
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
20845
|
-
start =
|
|
21054
|
+
start =
|
|
21055
|
+
needNoTrav ? startNoTraversal
|
|
21056
|
+
: needNoDot ? startNoDot
|
|
21057
|
+
: '';
|
|
20846
21058
|
}
|
|
20847
21059
|
}
|
|
20848
21060
|
}
|
|
@@ -20872,14 +21084,14 @@ class AST {
|
|
|
20872
21084
|
// invalid extglob, has to at least be *something* present, if it's
|
|
20873
21085
|
// the entire path portion.
|
|
20874
21086
|
const s = this.toString();
|
|
20875
|
-
|
|
20876
|
-
|
|
20877
|
-
|
|
21087
|
+
const me = this;
|
|
21088
|
+
me.#parts = [s];
|
|
21089
|
+
me.type = null;
|
|
21090
|
+
me.#hasMagic = undefined;
|
|
20878
21091
|
return [s, unescape(this.toString()), false, false];
|
|
20879
21092
|
}
|
|
20880
|
-
|
|
20881
|
-
|
|
20882
|
-
? ''
|
|
21093
|
+
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ?
|
|
21094
|
+
''
|
|
20883
21095
|
: this.#partsToRegExp(true);
|
|
20884
21096
|
if (bodyDotAllowed === body) {
|
|
20885
21097
|
bodyDotAllowed = '';
|
|
@@ -20893,20 +21105,16 @@ class AST {
|
|
|
20893
21105
|
final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty;
|
|
20894
21106
|
}
|
|
20895
21107
|
else {
|
|
20896
|
-
const close = this.type === '!'
|
|
20897
|
-
|
|
20898
|
-
|
|
20899
|
-
|
|
20900
|
-
|
|
20901
|
-
|
|
20902
|
-
: this.type === '@'
|
|
20903
|
-
? ')'
|
|
20904
|
-
|
|
20905
|
-
|
|
20906
|
-
: this.type === '+' && bodyDotAllowed
|
|
20907
|
-
? ')'
|
|
20908
|
-
: this.type === '*' && bodyDotAllowed
|
|
20909
|
-
? `)?`
|
|
21108
|
+
const close = this.type === '!' ?
|
|
21109
|
+
// !() must match something,but !(x) can match ''
|
|
21110
|
+
'))' +
|
|
21111
|
+
(this.isStart() && !dot && !allowDot ? startNoDot : '') +
|
|
21112
|
+
star$1 +
|
|
21113
|
+
')'
|
|
21114
|
+
: this.type === '@' ? ')'
|
|
21115
|
+
: this.type === '?' ? ')?'
|
|
21116
|
+
: this.type === '+' && bodyDotAllowed ? ')'
|
|
21117
|
+
: this.type === '*' && bodyDotAllowed ? `)?`
|
|
20910
21118
|
: `)${this.type}`;
|
|
20911
21119
|
final = start + body + close;
|
|
20912
21120
|
}
|
|
@@ -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 => {
|
|
@@ -20938,6 +21182,8 @@ class AST {
|
|
|
20938
21182
|
let escaping = false;
|
|
20939
21183
|
let re = '';
|
|
20940
21184
|
let uflag = false;
|
|
21185
|
+
// multiple stars that aren't globstars coalesce into one *
|
|
21186
|
+
let inStar = false;
|
|
20941
21187
|
for (let i = 0; i < glob.length; i++) {
|
|
20942
21188
|
const c = glob.charAt(i);
|
|
20943
21189
|
if (escaping) {
|
|
@@ -20945,6 +21191,17 @@ class AST {
|
|
|
20945
21191
|
re += (reSpecials.has(c) ? '\\' : '') + c;
|
|
20946
21192
|
continue;
|
|
20947
21193
|
}
|
|
21194
|
+
if (c === '*') {
|
|
21195
|
+
if (inStar)
|
|
21196
|
+
continue;
|
|
21197
|
+
inStar = true;
|
|
21198
|
+
re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star$1;
|
|
21199
|
+
hasMagic = true;
|
|
21200
|
+
continue;
|
|
21201
|
+
}
|
|
21202
|
+
else {
|
|
21203
|
+
inStar = false;
|
|
21204
|
+
}
|
|
20948
21205
|
if (c === '\\') {
|
|
20949
21206
|
if (i === glob.length - 1) {
|
|
20950
21207
|
re += '\\\\';
|
|
@@ -20964,11 +21221,6 @@ class AST {
|
|
|
20964
21221
|
continue;
|
|
20965
21222
|
}
|
|
20966
21223
|
}
|
|
20967
|
-
if (c === '*') {
|
|
20968
|
-
re += noEmpty && glob === '*' ? starNoEmpty : star$1;
|
|
20969
|
-
hasMagic = true;
|
|
20970
|
-
continue;
|
|
20971
|
-
}
|
|
20972
21224
|
if (c === '?') {
|
|
20973
21225
|
re += qmark$1;
|
|
20974
21226
|
hasMagic = true;
|
|
@@ -20979,6 +21231,7 @@ class AST {
|
|
|
20979
21231
|
return [re, unescape(glob), !!hasMagic, uflag];
|
|
20980
21232
|
}
|
|
20981
21233
|
}
|
|
21234
|
+
_a = AST;
|
|
20982
21235
|
|
|
20983
21236
|
/**
|
|
20984
21237
|
* Escape all magic characters in a glob pattern.
|
|
@@ -20997,12 +21250,12 @@ const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false, } = {}
|
|
|
20997
21250
|
// that make those magic, and escaping ! as [!] isn't valid,
|
|
20998
21251
|
// because [!]] is a valid glob class meaning not ']'.
|
|
20999
21252
|
if (magicalBraces) {
|
|
21000
|
-
return windowsPathsNoEscape
|
|
21001
|
-
|
|
21253
|
+
return windowsPathsNoEscape ?
|
|
21254
|
+
s.replace(/[?*()[\]{}]/g, '[$&]')
|
|
21002
21255
|
: s.replace(/[?*()[\]\\{}]/g, '\\$&');
|
|
21003
21256
|
}
|
|
21004
|
-
return windowsPathsNoEscape
|
|
21005
|
-
|
|
21257
|
+
return windowsPathsNoEscape ?
|
|
21258
|
+
s.replace(/[?*()[\]]/g, '[$&]')
|
|
21006
21259
|
: s.replace(/[?*()[\]\\]/g, '\\$&');
|
|
21007
21260
|
};
|
|
21008
21261
|
|
|
@@ -21066,8 +21319,8 @@ const qmarksTestNoExtDot = ([$0]) => {
|
|
|
21066
21319
|
return (f) => f.length === len && f !== '.' && f !== '..';
|
|
21067
21320
|
};
|
|
21068
21321
|
/* c8 ignore start */
|
|
21069
|
-
const defaultPlatform = (typeof process === 'object' && process
|
|
21070
|
-
|
|
21322
|
+
const defaultPlatform = (typeof process === 'object' && process ?
|
|
21323
|
+
(typeof process.env === 'object' &&
|
|
21071
21324
|
process.env &&
|
|
21072
21325
|
process.env.__MINIMATCH_TESTING_PLATFORM__) ||
|
|
21073
21326
|
process.platform
|
|
@@ -21151,7 +21404,7 @@ const braceExpand = (pattern, options = {}) => {
|
|
|
21151
21404
|
// shortcut. no need to expand.
|
|
21152
21405
|
return [pattern];
|
|
21153
21406
|
}
|
|
21154
|
-
return expand(pattern);
|
|
21407
|
+
return expand(pattern, { max: options.braceExpandMax });
|
|
21155
21408
|
};
|
|
21156
21409
|
minimatch.braceExpand = braceExpand;
|
|
21157
21410
|
// parse a component of the expanded set.
|
|
@@ -21196,16 +21449,20 @@ class Minimatch {
|
|
|
21196
21449
|
isWindows;
|
|
21197
21450
|
platform;
|
|
21198
21451
|
windowsNoMagicRoot;
|
|
21452
|
+
maxGlobstarRecursion;
|
|
21199
21453
|
regexp;
|
|
21200
21454
|
constructor(pattern, options = {}) {
|
|
21201
21455
|
assertValidPattern(pattern);
|
|
21202
21456
|
options = options || {};
|
|
21203
21457
|
this.options = options;
|
|
21458
|
+
this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
|
|
21204
21459
|
this.pattern = pattern;
|
|
21205
21460
|
this.platform = options.platform || defaultPlatform;
|
|
21206
21461
|
this.isWindows = this.platform === 'win32';
|
|
21462
|
+
// avoid the annoying deprecation flag lol
|
|
21463
|
+
const awe = ('allowWindow' + 'sEscape');
|
|
21207
21464
|
this.windowsPathsNoEscape =
|
|
21208
|
-
!!options.windowsPathsNoEscape || options
|
|
21465
|
+
!!options.windowsPathsNoEscape || options[awe] === false;
|
|
21209
21466
|
if (this.windowsPathsNoEscape) {
|
|
21210
21467
|
this.pattern = this.pattern.replace(/\\/g, '/');
|
|
21211
21468
|
}
|
|
@@ -21218,8 +21475,8 @@ class Minimatch {
|
|
|
21218
21475
|
this.partial = !!options.partial;
|
|
21219
21476
|
this.nocase = !!this.options.nocase;
|
|
21220
21477
|
this.windowsNoMagicRoot =
|
|
21221
|
-
options.windowsNoMagicRoot !== undefined
|
|
21222
|
-
|
|
21478
|
+
options.windowsNoMagicRoot !== undefined ?
|
|
21479
|
+
options.windowsNoMagicRoot
|
|
21223
21480
|
: !!(this.isWindows && this.nocase);
|
|
21224
21481
|
this.globSet = [];
|
|
21225
21482
|
this.globParts = [];
|
|
@@ -21282,7 +21539,10 @@ class Minimatch {
|
|
|
21282
21539
|
!globMagic.test(s[3]);
|
|
21283
21540
|
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
21284
21541
|
if (isUNC) {
|
|
21285
|
-
return [
|
|
21542
|
+
return [
|
|
21543
|
+
...s.slice(0, 4),
|
|
21544
|
+
...s.slice(4).map(ss => this.parse(ss)),
|
|
21545
|
+
];
|
|
21286
21546
|
}
|
|
21287
21547
|
else if (isDrive) {
|
|
21288
21548
|
return [s[0], ...s.slice(1).map(ss => this.parse(ss))];
|
|
@@ -21314,7 +21574,7 @@ class Minimatch {
|
|
|
21314
21574
|
// to the right as possible, even if it increases the number
|
|
21315
21575
|
// of patterns that we have to process.
|
|
21316
21576
|
preprocess(globParts) {
|
|
21317
|
-
// if we're not in globstar mode, then turn
|
|
21577
|
+
// if we're not in globstar mode, then turn ** into *
|
|
21318
21578
|
if (this.options.noglobstar) {
|
|
21319
21579
|
for (let i = 0; i < globParts.length; i++) {
|
|
21320
21580
|
for (let j = 0; j < globParts[i].length; j++) {
|
|
@@ -21600,7 +21860,8 @@ class Minimatch {
|
|
|
21600
21860
|
// out of pattern, then that's fine, as long as all
|
|
21601
21861
|
// the parts match.
|
|
21602
21862
|
matchOne(file, pattern, partial = false) {
|
|
21603
|
-
|
|
21863
|
+
let fileStartIndex = 0;
|
|
21864
|
+
let patternStartIndex = 0;
|
|
21604
21865
|
// UNC paths like //?/X:/... can match X:/... and vice versa
|
|
21605
21866
|
// Drive letters in absolute drive or unc paths are always compared
|
|
21606
21867
|
// case-insensitively.
|
|
@@ -21618,18 +21879,22 @@ class Minimatch {
|
|
|
21618
21879
|
pattern[2] === '?' &&
|
|
21619
21880
|
typeof pattern[3] === 'string' &&
|
|
21620
21881
|
/^[a-z]:$/i.test(pattern[3]);
|
|
21621
|
-
const fdi = fileUNC ? 3
|
|
21622
|
-
|
|
21882
|
+
const fdi = fileUNC ? 3
|
|
21883
|
+
: fileDrive ? 0
|
|
21884
|
+
: undefined;
|
|
21885
|
+
const pdi = patternUNC ? 3
|
|
21886
|
+
: patternDrive ? 0
|
|
21887
|
+
: undefined;
|
|
21623
21888
|
if (typeof fdi === 'number' && typeof pdi === 'number') {
|
|
21624
|
-
const [fd, pd] = [
|
|
21889
|
+
const [fd, pd] = [
|
|
21890
|
+
file[fdi],
|
|
21891
|
+
pattern[pdi],
|
|
21892
|
+
];
|
|
21893
|
+
// start matching at the drive letter index of each
|
|
21625
21894
|
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
21626
21895
|
pattern[pdi] = fd;
|
|
21627
|
-
|
|
21628
|
-
|
|
21629
|
-
}
|
|
21630
|
-
else if (fdi > pdi) {
|
|
21631
|
-
file = file.slice(fdi);
|
|
21632
|
-
}
|
|
21896
|
+
patternStartIndex = pdi;
|
|
21897
|
+
fileStartIndex = fdi;
|
|
21633
21898
|
}
|
|
21634
21899
|
}
|
|
21635
21900
|
}
|
|
@@ -21639,99 +21904,185 @@ class Minimatch {
|
|
|
21639
21904
|
if (optimizationLevel >= 2) {
|
|
21640
21905
|
file = this.levelTwoFileOptimize(file);
|
|
21641
21906
|
}
|
|
21642
|
-
|
|
21643
|
-
|
|
21644
|
-
|
|
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++) {
|
|
21645
22075
|
this.debug('matchOne loop');
|
|
21646
|
-
|
|
21647
|
-
|
|
22076
|
+
let p = pattern[pi];
|
|
22077
|
+
let f = file[fi];
|
|
21648
22078
|
this.debug(pattern, p, f);
|
|
21649
22079
|
// should be impossible.
|
|
21650
22080
|
// some invalid regexp stuff in the set.
|
|
21651
22081
|
/* c8 ignore start */
|
|
21652
|
-
if (p === false) {
|
|
22082
|
+
if (p === false || p === GLOBSTAR) {
|
|
21653
22083
|
return false;
|
|
21654
22084
|
}
|
|
21655
22085
|
/* c8 ignore stop */
|
|
21656
|
-
if (p === GLOBSTAR) {
|
|
21657
|
-
this.debug('GLOBSTAR', [pattern, p, f]);
|
|
21658
|
-
// "**"
|
|
21659
|
-
// a/**/b/**/c would match the following:
|
|
21660
|
-
// a/b/x/y/z/c
|
|
21661
|
-
// a/x/y/z/b/c
|
|
21662
|
-
// a/b/x/b/x/c
|
|
21663
|
-
// a/b/c
|
|
21664
|
-
// To do this, take the rest of the pattern after
|
|
21665
|
-
// the **, and see if it would match the file remainder.
|
|
21666
|
-
// If so, return success.
|
|
21667
|
-
// If not, the ** "swallows" a segment, and try again.
|
|
21668
|
-
// This is recursively awful.
|
|
21669
|
-
//
|
|
21670
|
-
// a/**/b/**/c matching a/b/x/y/z/c
|
|
21671
|
-
// - a matches a
|
|
21672
|
-
// - doublestar
|
|
21673
|
-
// - matchOne(b/x/y/z/c, b/**/c)
|
|
21674
|
-
// - b matches b
|
|
21675
|
-
// - doublestar
|
|
21676
|
-
// - matchOne(x/y/z/c, c) -> no
|
|
21677
|
-
// - matchOne(y/z/c, c) -> no
|
|
21678
|
-
// - matchOne(z/c, c) -> no
|
|
21679
|
-
// - matchOne(c, c) yes, hit
|
|
21680
|
-
var fr = fi;
|
|
21681
|
-
var pr = pi + 1;
|
|
21682
|
-
if (pr === pl) {
|
|
21683
|
-
this.debug('** at the end');
|
|
21684
|
-
// a ** at the end will just swallow the rest.
|
|
21685
|
-
// We have found a match.
|
|
21686
|
-
// however, it will not swallow /.x, unless
|
|
21687
|
-
// options.dot is set.
|
|
21688
|
-
// . and .. are *never* matched by **, for explosively
|
|
21689
|
-
// exponential reasons.
|
|
21690
|
-
for (; fi < fl; fi++) {
|
|
21691
|
-
if (file[fi] === '.' ||
|
|
21692
|
-
file[fi] === '..' ||
|
|
21693
|
-
(!options.dot && file[fi].charAt(0) === '.'))
|
|
21694
|
-
return false;
|
|
21695
|
-
}
|
|
21696
|
-
return true;
|
|
21697
|
-
}
|
|
21698
|
-
// ok, let's see if we can swallow whatever we can.
|
|
21699
|
-
while (fr < fl) {
|
|
21700
|
-
var swallowee = file[fr];
|
|
21701
|
-
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
|
|
21702
|
-
// XXX remove this slice. Just pass the start index.
|
|
21703
|
-
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
21704
|
-
this.debug('globstar found match!', fr, fl, swallowee);
|
|
21705
|
-
// found a match.
|
|
21706
|
-
return true;
|
|
21707
|
-
}
|
|
21708
|
-
else {
|
|
21709
|
-
// can't swallow "." or ".." ever.
|
|
21710
|
-
// can only swallow ".foo" when explicitly asked.
|
|
21711
|
-
if (swallowee === '.' ||
|
|
21712
|
-
swallowee === '..' ||
|
|
21713
|
-
(!options.dot && swallowee.charAt(0) === '.')) {
|
|
21714
|
-
this.debug('dot detected!', file, fr, pattern, pr);
|
|
21715
|
-
break;
|
|
21716
|
-
}
|
|
21717
|
-
// ** swallows a segment, and continue.
|
|
21718
|
-
this.debug('globstar swallow a segment, and continue');
|
|
21719
|
-
fr++;
|
|
21720
|
-
}
|
|
21721
|
-
}
|
|
21722
|
-
// no match was found.
|
|
21723
|
-
// However, in partial mode, we can't say this is necessarily over.
|
|
21724
|
-
/* c8 ignore start */
|
|
21725
|
-
if (partial) {
|
|
21726
|
-
// ran out of file
|
|
21727
|
-
this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
|
|
21728
|
-
if (fr === fl) {
|
|
21729
|
-
return true;
|
|
21730
|
-
}
|
|
21731
|
-
}
|
|
21732
|
-
/* c8 ignore stop */
|
|
21733
|
-
return false;
|
|
21734
|
-
}
|
|
21735
22086
|
// something other than **
|
|
21736
22087
|
// non-magic patterns just have to match exactly
|
|
21737
22088
|
// patterns with magic have been turned into regexps.
|
|
@@ -21802,21 +22153,19 @@ class Minimatch {
|
|
|
21802
22153
|
fastTest = options.dot ? starTestDot : starTest;
|
|
21803
22154
|
}
|
|
21804
22155
|
else if ((m = pattern.match(starDotExtRE))) {
|
|
21805
|
-
fastTest = (options.nocase
|
|
21806
|
-
|
|
21807
|
-
|
|
22156
|
+
fastTest = (options.nocase ?
|
|
22157
|
+
options.dot ?
|
|
22158
|
+
starDotExtTestNocaseDot
|
|
21808
22159
|
: starDotExtTestNocase
|
|
21809
|
-
: options.dot
|
|
21810
|
-
? starDotExtTestDot
|
|
22160
|
+
: options.dot ? starDotExtTestDot
|
|
21811
22161
|
: starDotExtTest)(m[1]);
|
|
21812
22162
|
}
|
|
21813
22163
|
else if ((m = pattern.match(qmarksRE))) {
|
|
21814
|
-
fastTest = (options.nocase
|
|
21815
|
-
|
|
21816
|
-
|
|
22164
|
+
fastTest = (options.nocase ?
|
|
22165
|
+
options.dot ?
|
|
22166
|
+
qmarksTestNocaseDot
|
|
21817
22167
|
: qmarksTestNocase
|
|
21818
|
-
: options.dot
|
|
21819
|
-
? qmarksTestDot
|
|
22168
|
+
: options.dot ? qmarksTestDot
|
|
21820
22169
|
: qmarksTest)(m);
|
|
21821
22170
|
}
|
|
21822
22171
|
else if ((m = pattern.match(starDotStarRE))) {
|
|
@@ -21847,10 +22196,8 @@ class Minimatch {
|
|
|
21847
22196
|
return this.regexp;
|
|
21848
22197
|
}
|
|
21849
22198
|
const options = this.options;
|
|
21850
|
-
const twoStar = options.noglobstar
|
|
21851
|
-
?
|
|
21852
|
-
: options.dot
|
|
21853
|
-
? twoStarDot
|
|
22199
|
+
const twoStar = options.noglobstar ? star
|
|
22200
|
+
: options.dot ? twoStarDot
|
|
21854
22201
|
: twoStarNoDot;
|
|
21855
22202
|
const flags = new Set(options.nocase ? ['i'] : []);
|
|
21856
22203
|
// regexpify non-globstar patterns
|
|
@@ -21866,11 +22213,9 @@ class Minimatch {
|
|
|
21866
22213
|
for (const f of p.flags.split(''))
|
|
21867
22214
|
flags.add(f);
|
|
21868
22215
|
}
|
|
21869
|
-
return typeof p === 'string'
|
|
21870
|
-
?
|
|
21871
|
-
|
|
21872
|
-
? GLOBSTAR
|
|
21873
|
-
: p._src;
|
|
22216
|
+
return (typeof p === 'string' ? regExpEscape(p)
|
|
22217
|
+
: p === GLOBSTAR ? GLOBSTAR
|
|
22218
|
+
: p._src);
|
|
21874
22219
|
});
|
|
21875
22220
|
pp.forEach((p, i) => {
|
|
21876
22221
|
const next = pp[i + 1];
|
|
@@ -25199,7 +25544,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
25199
25544
|
return generator.toJSON();
|
|
25200
25545
|
}
|
|
25201
25546
|
|
|
25202
|
-
const version = "3.5.
|
|
25547
|
+
const version = "3.5.30";
|
|
25203
25548
|
const parseCache = parseCache$1;
|
|
25204
25549
|
const errorMessages = {
|
|
25205
25550
|
...CompilerDOM.errorMessages,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.5.
|
|
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
|
-
|
|
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 (
|
|
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,
|
|
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,
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
48
|
+
"postcss": "^8.5.8",
|
|
49
49
|
"source-map-js": "^1.2.1",
|
|
50
|
-
"@vue/compiler-
|
|
51
|
-
"@vue/compiler-
|
|
52
|
-
"@vue/compiler-ssr": "3.5.
|
|
53
|
-
"@vue/shared": "3.5.
|
|
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.
|
|
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",
|