@vercel/build-utils 3.1.1-canary.2 → 4.0.1-canary.0
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/dist/detect-builders.js +8 -11
- package/dist/detect-file-system-api.js +5 -5
- package/dist/fs/get-glob-fs.d.ts +6 -0
- package/dist/fs/get-glob-fs.js +71 -0
- package/dist/fs/run-user-scripts.js +24 -13
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1446 -181
- package/dist/lambda.js +1 -1
- package/dist/types.d.ts +4 -3
- package/dist/workspaces/get-workspace-package-paths.d.ts +11 -0
- package/dist/workspaces/get-workspace-package-paths.js +62 -0
- package/package.json +5 -5
package/dist/index.js
CHANGED
@@ -2672,7 +2672,6 @@ function range(a, b, str) {
|
|
2672
2672
|
/***/ 3197:
|
2673
2673
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
2674
2674
|
|
2675
|
-
var concatMap = __webpack_require__(4527);
|
2676
2675
|
var balanced = __webpack_require__(3353);
|
2677
2676
|
|
2678
2677
|
module.exports = expandTop;
|
@@ -2753,10 +2752,6 @@ function expandTop(str) {
|
|
2753
2752
|
return expand(escapeBraces(str), true).map(unescapeBraces);
|
2754
2753
|
}
|
2755
2754
|
|
2756
|
-
function identity(e) {
|
2757
|
-
return e;
|
2758
|
-
}
|
2759
|
-
|
2760
2755
|
function embrace(str) {
|
2761
2756
|
return '{' + str + '}';
|
2762
2757
|
}
|
@@ -2775,42 +2770,7 @@ function expand(str, isTop) {
|
|
2775
2770
|
var expansions = [];
|
2776
2771
|
|
2777
2772
|
var m = balanced('{', '}', str);
|
2778
|
-
if (!m
|
2779
|
-
|
2780
|
-
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
2781
|
-
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
2782
|
-
var isSequence = isNumericSequence || isAlphaSequence;
|
2783
|
-
var isOptions = m.body.indexOf(',') >= 0;
|
2784
|
-
if (!isSequence && !isOptions) {
|
2785
|
-
// {a},b}
|
2786
|
-
if (m.post.match(/,.*\}/)) {
|
2787
|
-
str = m.pre + '{' + m.body + escClose + m.post;
|
2788
|
-
return expand(str);
|
2789
|
-
}
|
2790
|
-
return [str];
|
2791
|
-
}
|
2792
|
-
|
2793
|
-
var n;
|
2794
|
-
if (isSequence) {
|
2795
|
-
n = m.body.split(/\.\./);
|
2796
|
-
} else {
|
2797
|
-
n = parseCommaParts(m.body);
|
2798
|
-
if (n.length === 1) {
|
2799
|
-
// x{{a,b}}y ==> x{a}y x{b}y
|
2800
|
-
n = expand(n[0], false).map(embrace);
|
2801
|
-
if (n.length === 1) {
|
2802
|
-
var post = m.post.length
|
2803
|
-
? expand(m.post, false)
|
2804
|
-
: [''];
|
2805
|
-
return post.map(function(p) {
|
2806
|
-
return m.pre + n[0] + p;
|
2807
|
-
});
|
2808
|
-
}
|
2809
|
-
}
|
2810
|
-
}
|
2811
|
-
|
2812
|
-
// at this point, n is the parts, and we know it's not a comma set
|
2813
|
-
// with a single entry.
|
2773
|
+
if (!m) return [str];
|
2814
2774
|
|
2815
2775
|
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
2816
2776
|
var pre = m.pre;
|
@@ -2818,55 +2778,97 @@ function expand(str, isTop) {
|
|
2818
2778
|
? expand(m.post, false)
|
2819
2779
|
: [''];
|
2820
2780
|
|
2821
|
-
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2825
|
-
var y = numeric(n[1]);
|
2826
|
-
var width = Math.max(n[0].length, n[1].length)
|
2827
|
-
var incr = n.length == 3
|
2828
|
-
? Math.abs(numeric(n[2]))
|
2829
|
-
: 1;
|
2830
|
-
var test = lte;
|
2831
|
-
var reverse = y < x;
|
2832
|
-
if (reverse) {
|
2833
|
-
incr *= -1;
|
2834
|
-
test = gte;
|
2781
|
+
if (/\$$/.test(m.pre)) {
|
2782
|
+
for (var k = 0; k < post.length; k++) {
|
2783
|
+
var expansion = pre+ '{' + m.body + '}' + post[k];
|
2784
|
+
expansions.push(expansion);
|
2835
2785
|
}
|
2836
|
-
|
2837
|
-
|
2838
|
-
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
|
2843
|
-
|
2844
|
-
|
2845
|
-
|
2846
|
-
}
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2855
|
-
|
2786
|
+
} else {
|
2787
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
2788
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
2789
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
2790
|
+
var isOptions = m.body.indexOf(',') >= 0;
|
2791
|
+
if (!isSequence && !isOptions) {
|
2792
|
+
// {a},b}
|
2793
|
+
if (m.post.match(/,.*\}/)) {
|
2794
|
+
str = m.pre + '{' + m.body + escClose + m.post;
|
2795
|
+
return expand(str);
|
2796
|
+
}
|
2797
|
+
return [str];
|
2798
|
+
}
|
2799
|
+
|
2800
|
+
var n;
|
2801
|
+
if (isSequence) {
|
2802
|
+
n = m.body.split(/\.\./);
|
2803
|
+
} else {
|
2804
|
+
n = parseCommaParts(m.body);
|
2805
|
+
if (n.length === 1) {
|
2806
|
+
// x{{a,b}}y ==> x{a}y x{b}y
|
2807
|
+
n = expand(n[0], false).map(embrace);
|
2808
|
+
if (n.length === 1) {
|
2809
|
+
return post.map(function(p) {
|
2810
|
+
return m.pre + n[0] + p;
|
2811
|
+
});
|
2812
|
+
}
|
2813
|
+
}
|
2814
|
+
}
|
2815
|
+
|
2816
|
+
// at this point, n is the parts, and we know it's not a comma set
|
2817
|
+
// with a single entry.
|
2818
|
+
var N;
|
2819
|
+
|
2820
|
+
if (isSequence) {
|
2821
|
+
var x = numeric(n[0]);
|
2822
|
+
var y = numeric(n[1]);
|
2823
|
+
var width = Math.max(n[0].length, n[1].length)
|
2824
|
+
var incr = n.length == 3
|
2825
|
+
? Math.abs(numeric(n[2]))
|
2826
|
+
: 1;
|
2827
|
+
var test = lte;
|
2828
|
+
var reverse = y < x;
|
2829
|
+
if (reverse) {
|
2830
|
+
incr *= -1;
|
2831
|
+
test = gte;
|
2832
|
+
}
|
2833
|
+
var pad = n.some(isPadded);
|
2834
|
+
|
2835
|
+
N = [];
|
2836
|
+
|
2837
|
+
for (var i = x; test(i, y); i += incr) {
|
2838
|
+
var c;
|
2839
|
+
if (isAlphaSequence) {
|
2840
|
+
c = String.fromCharCode(i);
|
2841
|
+
if (c === '\\')
|
2842
|
+
c = '';
|
2843
|
+
} else {
|
2844
|
+
c = String(i);
|
2845
|
+
if (pad) {
|
2846
|
+
var need = width - c.length;
|
2847
|
+
if (need > 0) {
|
2848
|
+
var z = new Array(need + 1).join('0');
|
2849
|
+
if (i < 0)
|
2850
|
+
c = '-' + z + c.slice(1);
|
2851
|
+
else
|
2852
|
+
c = z + c;
|
2853
|
+
}
|
2856
2854
|
}
|
2857
2855
|
}
|
2856
|
+
N.push(c);
|
2857
|
+
}
|
2858
|
+
} else {
|
2859
|
+
N = [];
|
2860
|
+
|
2861
|
+
for (var j = 0; j < n.length; j++) {
|
2862
|
+
N.push.apply(N, expand(n[j], false));
|
2858
2863
|
}
|
2859
|
-
N.push(c);
|
2860
2864
|
}
|
2861
|
-
} else {
|
2862
|
-
N = concatMap(n, function(el) { return expand(el, false) });
|
2863
|
-
}
|
2864
2865
|
|
2865
|
-
|
2866
|
-
|
2867
|
-
|
2868
|
-
|
2869
|
-
|
2866
|
+
for (var j = 0; j < N.length; j++) {
|
2867
|
+
for (var k = 0; k < post.length; k++) {
|
2868
|
+
var expansion = pre + N[j] + post[k];
|
2869
|
+
if (!isTop || isSequence || expansion)
|
2870
|
+
expansions.push(expansion);
|
2871
|
+
}
|
2870
2872
|
}
|
2871
2873
|
}
|
2872
2874
|
|
@@ -8680,7 +8682,7 @@ try {
|
|
8680
8682
|
} catch (er) {}
|
8681
8683
|
|
8682
8684
|
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
|
8683
|
-
var expand = __webpack_require__(
|
8685
|
+
var expand = __webpack_require__(1561)
|
8684
8686
|
|
8685
8687
|
var plTypes = {
|
8686
8688
|
'!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
|
@@ -9596,6 +9598,214 @@ function regExpEscape (s) {
|
|
9596
9598
|
}
|
9597
9599
|
|
9598
9600
|
|
9601
|
+
/***/ }),
|
9602
|
+
|
9603
|
+
/***/ 1561:
|
9604
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
9605
|
+
|
9606
|
+
var concatMap = __webpack_require__(4527);
|
9607
|
+
var balanced = __webpack_require__(3353);
|
9608
|
+
|
9609
|
+
module.exports = expandTop;
|
9610
|
+
|
9611
|
+
var escSlash = '\0SLASH'+Math.random()+'\0';
|
9612
|
+
var escOpen = '\0OPEN'+Math.random()+'\0';
|
9613
|
+
var escClose = '\0CLOSE'+Math.random()+'\0';
|
9614
|
+
var escComma = '\0COMMA'+Math.random()+'\0';
|
9615
|
+
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
9616
|
+
|
9617
|
+
function numeric(str) {
|
9618
|
+
return parseInt(str, 10) == str
|
9619
|
+
? parseInt(str, 10)
|
9620
|
+
: str.charCodeAt(0);
|
9621
|
+
}
|
9622
|
+
|
9623
|
+
function escapeBraces(str) {
|
9624
|
+
return str.split('\\\\').join(escSlash)
|
9625
|
+
.split('\\{').join(escOpen)
|
9626
|
+
.split('\\}').join(escClose)
|
9627
|
+
.split('\\,').join(escComma)
|
9628
|
+
.split('\\.').join(escPeriod);
|
9629
|
+
}
|
9630
|
+
|
9631
|
+
function unescapeBraces(str) {
|
9632
|
+
return str.split(escSlash).join('\\')
|
9633
|
+
.split(escOpen).join('{')
|
9634
|
+
.split(escClose).join('}')
|
9635
|
+
.split(escComma).join(',')
|
9636
|
+
.split(escPeriod).join('.');
|
9637
|
+
}
|
9638
|
+
|
9639
|
+
|
9640
|
+
// Basically just str.split(","), but handling cases
|
9641
|
+
// where we have nested braced sections, which should be
|
9642
|
+
// treated as individual members, like {a,{b,c},d}
|
9643
|
+
function parseCommaParts(str) {
|
9644
|
+
if (!str)
|
9645
|
+
return [''];
|
9646
|
+
|
9647
|
+
var parts = [];
|
9648
|
+
var m = balanced('{', '}', str);
|
9649
|
+
|
9650
|
+
if (!m)
|
9651
|
+
return str.split(',');
|
9652
|
+
|
9653
|
+
var pre = m.pre;
|
9654
|
+
var body = m.body;
|
9655
|
+
var post = m.post;
|
9656
|
+
var p = pre.split(',');
|
9657
|
+
|
9658
|
+
p[p.length-1] += '{' + body + '}';
|
9659
|
+
var postParts = parseCommaParts(post);
|
9660
|
+
if (post.length) {
|
9661
|
+
p[p.length-1] += postParts.shift();
|
9662
|
+
p.push.apply(p, postParts);
|
9663
|
+
}
|
9664
|
+
|
9665
|
+
parts.push.apply(parts, p);
|
9666
|
+
|
9667
|
+
return parts;
|
9668
|
+
}
|
9669
|
+
|
9670
|
+
function expandTop(str) {
|
9671
|
+
if (!str)
|
9672
|
+
return [];
|
9673
|
+
|
9674
|
+
// I don't know why Bash 4.3 does this, but it does.
|
9675
|
+
// Anything starting with {} will have the first two bytes preserved
|
9676
|
+
// but *only* at the top level, so {},a}b will not expand to anything,
|
9677
|
+
// but a{},b}c will be expanded to [a}c,abc].
|
9678
|
+
// One could argue that this is a bug in Bash, but since the goal of
|
9679
|
+
// this module is to match Bash's rules, we escape a leading {}
|
9680
|
+
if (str.substr(0, 2) === '{}') {
|
9681
|
+
str = '\\{\\}' + str.substr(2);
|
9682
|
+
}
|
9683
|
+
|
9684
|
+
return expand(escapeBraces(str), true).map(unescapeBraces);
|
9685
|
+
}
|
9686
|
+
|
9687
|
+
function identity(e) {
|
9688
|
+
return e;
|
9689
|
+
}
|
9690
|
+
|
9691
|
+
function embrace(str) {
|
9692
|
+
return '{' + str + '}';
|
9693
|
+
}
|
9694
|
+
function isPadded(el) {
|
9695
|
+
return /^-?0\d/.test(el);
|
9696
|
+
}
|
9697
|
+
|
9698
|
+
function lte(i, y) {
|
9699
|
+
return i <= y;
|
9700
|
+
}
|
9701
|
+
function gte(i, y) {
|
9702
|
+
return i >= y;
|
9703
|
+
}
|
9704
|
+
|
9705
|
+
function expand(str, isTop) {
|
9706
|
+
var expansions = [];
|
9707
|
+
|
9708
|
+
var m = balanced('{', '}', str);
|
9709
|
+
if (!m || /\$$/.test(m.pre)) return [str];
|
9710
|
+
|
9711
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
9712
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
9713
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
9714
|
+
var isOptions = m.body.indexOf(',') >= 0;
|
9715
|
+
if (!isSequence && !isOptions) {
|
9716
|
+
// {a},b}
|
9717
|
+
if (m.post.match(/,.*\}/)) {
|
9718
|
+
str = m.pre + '{' + m.body + escClose + m.post;
|
9719
|
+
return expand(str);
|
9720
|
+
}
|
9721
|
+
return [str];
|
9722
|
+
}
|
9723
|
+
|
9724
|
+
var n;
|
9725
|
+
if (isSequence) {
|
9726
|
+
n = m.body.split(/\.\./);
|
9727
|
+
} else {
|
9728
|
+
n = parseCommaParts(m.body);
|
9729
|
+
if (n.length === 1) {
|
9730
|
+
// x{{a,b}}y ==> x{a}y x{b}y
|
9731
|
+
n = expand(n[0], false).map(embrace);
|
9732
|
+
if (n.length === 1) {
|
9733
|
+
var post = m.post.length
|
9734
|
+
? expand(m.post, false)
|
9735
|
+
: [''];
|
9736
|
+
return post.map(function(p) {
|
9737
|
+
return m.pre + n[0] + p;
|
9738
|
+
});
|
9739
|
+
}
|
9740
|
+
}
|
9741
|
+
}
|
9742
|
+
|
9743
|
+
// at this point, n is the parts, and we know it's not a comma set
|
9744
|
+
// with a single entry.
|
9745
|
+
|
9746
|
+
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
9747
|
+
var pre = m.pre;
|
9748
|
+
var post = m.post.length
|
9749
|
+
? expand(m.post, false)
|
9750
|
+
: [''];
|
9751
|
+
|
9752
|
+
var N;
|
9753
|
+
|
9754
|
+
if (isSequence) {
|
9755
|
+
var x = numeric(n[0]);
|
9756
|
+
var y = numeric(n[1]);
|
9757
|
+
var width = Math.max(n[0].length, n[1].length)
|
9758
|
+
var incr = n.length == 3
|
9759
|
+
? Math.abs(numeric(n[2]))
|
9760
|
+
: 1;
|
9761
|
+
var test = lte;
|
9762
|
+
var reverse = y < x;
|
9763
|
+
if (reverse) {
|
9764
|
+
incr *= -1;
|
9765
|
+
test = gte;
|
9766
|
+
}
|
9767
|
+
var pad = n.some(isPadded);
|
9768
|
+
|
9769
|
+
N = [];
|
9770
|
+
|
9771
|
+
for (var i = x; test(i, y); i += incr) {
|
9772
|
+
var c;
|
9773
|
+
if (isAlphaSequence) {
|
9774
|
+
c = String.fromCharCode(i);
|
9775
|
+
if (c === '\\')
|
9776
|
+
c = '';
|
9777
|
+
} else {
|
9778
|
+
c = String(i);
|
9779
|
+
if (pad) {
|
9780
|
+
var need = width - c.length;
|
9781
|
+
if (need > 0) {
|
9782
|
+
var z = new Array(need + 1).join('0');
|
9783
|
+
if (i < 0)
|
9784
|
+
c = '-' + z + c.slice(1);
|
9785
|
+
else
|
9786
|
+
c = z + c;
|
9787
|
+
}
|
9788
|
+
}
|
9789
|
+
}
|
9790
|
+
N.push(c);
|
9791
|
+
}
|
9792
|
+
} else {
|
9793
|
+
N = concatMap(n, function(el) { return expand(el, false) });
|
9794
|
+
}
|
9795
|
+
|
9796
|
+
for (var j = 0; j < N.length; j++) {
|
9797
|
+
for (var k = 0; k < post.length; k++) {
|
9798
|
+
var expansion = pre + N[j] + post[k];
|
9799
|
+
if (!isTop || isSequence || expansion)
|
9800
|
+
expansions.push(expansion);
|
9801
|
+
}
|
9802
|
+
}
|
9803
|
+
|
9804
|
+
return expansions;
|
9805
|
+
}
|
9806
|
+
|
9807
|
+
|
9808
|
+
|
9599
9809
|
/***/ }),
|
9600
9810
|
|
9601
9811
|
/***/ 8179:
|
@@ -11503,34 +11713,6 @@ module.exports = isPromise;
|
|
11503
11713
|
module.exports.default = isPromise;
|
11504
11714
|
|
11505
11715
|
|
11506
|
-
/***/ }),
|
11507
|
-
|
11508
|
-
/***/ 1323:
|
11509
|
-
/***/ ((module) => {
|
11510
|
-
|
11511
|
-
"use strict";
|
11512
|
-
|
11513
|
-
|
11514
|
-
function posix(path) {
|
11515
|
-
return path.charAt(0) === '/';
|
11516
|
-
}
|
11517
|
-
|
11518
|
-
function win32(path) {
|
11519
|
-
// https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
|
11520
|
-
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
11521
|
-
var result = splitDeviceRe.exec(path);
|
11522
|
-
var device = result[1] || '';
|
11523
|
-
var isUnc = Boolean(device && device.charAt(1) !== ':');
|
11524
|
-
|
11525
|
-
// UNC paths are always absolute
|
11526
|
-
return Boolean(result[2] || isUnc);
|
11527
|
-
}
|
11528
|
-
|
11529
|
-
module.exports = process.platform === 'win32' ? win32 : posix;
|
11530
|
-
module.exports.posix = posix;
|
11531
|
-
module.exports.win32 = win32;
|
11532
|
-
|
11533
|
-
|
11534
11716
|
/***/ }),
|
11535
11717
|
|
11536
11718
|
/***/ 7843:
|
@@ -19416,8 +19598,6 @@ module.exports = {
|
|
19416
19598
|
/***/ 9686:
|
19417
19599
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
19418
19600
|
|
19419
|
-
exports.alphasort = alphasort
|
19420
|
-
exports.alphasorti = alphasorti
|
19421
19601
|
exports.setopts = setopts
|
19422
19602
|
exports.ownProp = ownProp
|
19423
19603
|
exports.makeAbs = makeAbs
|
@@ -19430,17 +19610,14 @@ function ownProp (obj, field) {
|
|
19430
19610
|
return Object.prototype.hasOwnProperty.call(obj, field)
|
19431
19611
|
}
|
19432
19612
|
|
19613
|
+
var fs = __webpack_require__(5747)
|
19433
19614
|
var path = __webpack_require__(5622)
|
19434
|
-
var minimatch = __webpack_require__(
|
19435
|
-
var isAbsolute = __webpack_require__(
|
19615
|
+
var minimatch = __webpack_require__(949)
|
19616
|
+
var isAbsolute = __webpack_require__(5622).isAbsolute
|
19436
19617
|
var Minimatch = minimatch.Minimatch
|
19437
19618
|
|
19438
|
-
function alphasorti (a, b) {
|
19439
|
-
return a.toLowerCase().localeCompare(b.toLowerCase())
|
19440
|
-
}
|
19441
|
-
|
19442
19619
|
function alphasort (a, b) {
|
19443
|
-
return a.localeCompare(b)
|
19620
|
+
return a.localeCompare(b, 'en')
|
19444
19621
|
}
|
19445
19622
|
|
19446
19623
|
function setupIgnores (self, options) {
|
@@ -19499,6 +19676,7 @@ function setopts (self, pattern, options) {
|
|
19499
19676
|
self.stat = !!options.stat
|
19500
19677
|
self.noprocess = !!options.noprocess
|
19501
19678
|
self.absolute = !!options.absolute
|
19679
|
+
self.fs = options.fs || fs
|
19502
19680
|
|
19503
19681
|
self.maxLength = options.maxLength || Infinity
|
19504
19682
|
self.cache = options.cache || Object.create(null)
|
@@ -19510,7 +19688,7 @@ function setopts (self, pattern, options) {
|
|
19510
19688
|
self.changedCwd = false
|
19511
19689
|
var cwd = process.cwd()
|
19512
19690
|
if (!ownProp(options, "cwd"))
|
19513
|
-
self.cwd = cwd
|
19691
|
+
self.cwd = path.resolve(cwd)
|
19514
19692
|
else {
|
19515
19693
|
self.cwd = path.resolve(options.cwd)
|
19516
19694
|
self.changedCwd = self.cwd !== cwd
|
@@ -19518,20 +19696,24 @@ function setopts (self, pattern, options) {
|
|
19518
19696
|
|
19519
19697
|
self.root = options.root || path.resolve(self.cwd, "/")
|
19520
19698
|
self.root = path.resolve(self.root)
|
19521
|
-
if (process.platform === "win32")
|
19522
|
-
self.root = self.root.replace(/\\/g, "/")
|
19523
19699
|
|
19524
19700
|
// TODO: is an absolute `cwd` supposed to be resolved against `root`?
|
19525
19701
|
// e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
|
19526
19702
|
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
|
19527
|
-
if (process.platform === "win32")
|
19528
|
-
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
|
19529
19703
|
self.nomount = !!options.nomount
|
19530
19704
|
|
19705
|
+
if (process.platform === "win32") {
|
19706
|
+
self.root = self.root.replace(/\\/g, "/")
|
19707
|
+
self.cwd = self.cwd.replace(/\\/g, "/")
|
19708
|
+
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
|
19709
|
+
}
|
19710
|
+
|
19531
19711
|
// disable comments and negation in Minimatch.
|
19532
19712
|
// Note that they are not supported in Glob itself anyway.
|
19533
19713
|
options.nonegate = true
|
19534
19714
|
options.nocomment = true
|
19715
|
+
// always treat \ in patterns as escapes, not path separators
|
19716
|
+
options.allowWindowsEscape = true
|
19535
19717
|
|
19536
19718
|
self.minimatch = new Minimatch(pattern, options)
|
19537
19719
|
self.options = self.minimatch.options
|
@@ -19568,7 +19750,7 @@ function finish (self) {
|
|
19568
19750
|
all = Object.keys(all)
|
19569
19751
|
|
19570
19752
|
if (!self.nosort)
|
19571
|
-
all = all.sort(
|
19753
|
+
all = all.sort(alphasort)
|
19572
19754
|
|
19573
19755
|
// at *some* point we statted all of these
|
19574
19756
|
if (self.mark) {
|
@@ -19705,19 +19887,16 @@ function childrenIgnored (self, path) {
|
|
19705
19887
|
|
19706
19888
|
module.exports = glob
|
19707
19889
|
|
19708
|
-
var fs = __webpack_require__(5747)
|
19709
19890
|
var rp = __webpack_require__(8945)
|
19710
|
-
var minimatch = __webpack_require__(
|
19891
|
+
var minimatch = __webpack_require__(949)
|
19711
19892
|
var Minimatch = minimatch.Minimatch
|
19712
19893
|
var inherits = __webpack_require__(6919)
|
19713
19894
|
var EE = __webpack_require__(8614).EventEmitter
|
19714
19895
|
var path = __webpack_require__(5622)
|
19715
19896
|
var assert = __webpack_require__(2357)
|
19716
|
-
var isAbsolute = __webpack_require__(
|
19897
|
+
var isAbsolute = __webpack_require__(5622).isAbsolute
|
19717
19898
|
var globSync = __webpack_require__(2231)
|
19718
19899
|
var common = __webpack_require__(9686)
|
19719
|
-
var alphasort = common.alphasort
|
19720
|
-
var alphasorti = common.alphasorti
|
19721
19900
|
var setopts = common.setopts
|
19722
19901
|
var ownProp = common.ownProp
|
19723
19902
|
var inflight = __webpack_require__(9442)
|
@@ -20010,7 +20189,10 @@ Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
|
|
20010
20189
|
var read
|
20011
20190
|
if (prefix === null)
|
20012
20191
|
read = '.'
|
20013
|
-
else if (isAbsolute(prefix) ||
|
20192
|
+
else if (isAbsolute(prefix) ||
|
20193
|
+
isAbsolute(pattern.map(function (p) {
|
20194
|
+
return typeof p === 'string' ? p : '[*]'
|
20195
|
+
}).join('/'))) {
|
20014
20196
|
if (!prefix || !isAbsolute(prefix))
|
20015
20197
|
prefix = '/' + prefix
|
20016
20198
|
read = prefix
|
@@ -20168,7 +20350,7 @@ Glob.prototype._readdirInGlobStar = function (abs, cb) {
|
|
20168
20350
|
var lstatcb = inflight(lstatkey, lstatcb_)
|
20169
20351
|
|
20170
20352
|
if (lstatcb)
|
20171
|
-
fs.lstat(abs, lstatcb)
|
20353
|
+
self.fs.lstat(abs, lstatcb)
|
20172
20354
|
|
20173
20355
|
function lstatcb_ (er, lstat) {
|
20174
20356
|
if (er && er.code === 'ENOENT')
|
@@ -20209,7 +20391,7 @@ Glob.prototype._readdir = function (abs, inGlobStar, cb) {
|
|
20209
20391
|
}
|
20210
20392
|
|
20211
20393
|
var self = this
|
20212
|
-
fs.readdir(abs, readdirCb(this, abs, cb))
|
20394
|
+
self.fs.readdir(abs, readdirCb(this, abs, cb))
|
20213
20395
|
}
|
20214
20396
|
|
20215
20397
|
function readdirCb (self, abs, cb) {
|
@@ -20413,13 +20595,13 @@ Glob.prototype._stat = function (f, cb) {
|
|
20413
20595
|
var self = this
|
20414
20596
|
var statcb = inflight('stat\0' + abs, lstatcb_)
|
20415
20597
|
if (statcb)
|
20416
|
-
fs.lstat(abs, statcb)
|
20598
|
+
self.fs.lstat(abs, statcb)
|
20417
20599
|
|
20418
20600
|
function lstatcb_ (er, lstat) {
|
20419
20601
|
if (lstat && lstat.isSymbolicLink()) {
|
20420
20602
|
// If it's a symlink, then treat it as the target, unless
|
20421
20603
|
// the target does not exist, then treat it as a file.
|
20422
|
-
return fs.stat(abs, function (er, stat) {
|
20604
|
+
return self.fs.stat(abs, function (er, stat) {
|
20423
20605
|
if (er)
|
20424
20606
|
self._stat2(f, abs, null, lstat, cb)
|
20425
20607
|
else
|
@@ -20455,6 +20637,930 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
|
|
20455
20637
|
}
|
20456
20638
|
|
20457
20639
|
|
20640
|
+
/***/ }),
|
20641
|
+
|
20642
|
+
/***/ 7581:
|
20643
|
+
/***/ ((module) => {
|
20644
|
+
|
20645
|
+
const isWindows = typeof process === 'object' &&
|
20646
|
+
process &&
|
20647
|
+
process.platform === 'win32'
|
20648
|
+
module.exports = isWindows ? { sep: '\\' } : { sep: '/' }
|
20649
|
+
|
20650
|
+
|
20651
|
+
/***/ }),
|
20652
|
+
|
20653
|
+
/***/ 949:
|
20654
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
20655
|
+
|
20656
|
+
const minimatch = module.exports = (p, pattern, options = {}) => {
|
20657
|
+
assertValidPattern(pattern)
|
20658
|
+
|
20659
|
+
// shortcut: comments match nothing.
|
20660
|
+
if (!options.nocomment && pattern.charAt(0) === '#') {
|
20661
|
+
return false
|
20662
|
+
}
|
20663
|
+
|
20664
|
+
return new Minimatch(pattern, options).match(p)
|
20665
|
+
}
|
20666
|
+
|
20667
|
+
module.exports = minimatch
|
20668
|
+
|
20669
|
+
const path = __webpack_require__(7581)
|
20670
|
+
minimatch.sep = path.sep
|
20671
|
+
|
20672
|
+
const GLOBSTAR = Symbol('globstar **')
|
20673
|
+
minimatch.GLOBSTAR = GLOBSTAR
|
20674
|
+
const expand = __webpack_require__(3197)
|
20675
|
+
|
20676
|
+
const plTypes = {
|
20677
|
+
'!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
|
20678
|
+
'?': { open: '(?:', close: ')?' },
|
20679
|
+
'+': { open: '(?:', close: ')+' },
|
20680
|
+
'*': { open: '(?:', close: ')*' },
|
20681
|
+
'@': { open: '(?:', close: ')' }
|
20682
|
+
}
|
20683
|
+
|
20684
|
+
// any single thing other than /
|
20685
|
+
// don't need to escape / when using new RegExp()
|
20686
|
+
const qmark = '[^/]'
|
20687
|
+
|
20688
|
+
// * => any number of characters
|
20689
|
+
const star = qmark + '*?'
|
20690
|
+
|
20691
|
+
// ** when dots are allowed. Anything goes, except .. and .
|
20692
|
+
// not (^ or / followed by one or two dots followed by $ or /),
|
20693
|
+
// followed by anything, any number of times.
|
20694
|
+
const twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
|
20695
|
+
|
20696
|
+
// not a ^ or / followed by a dot,
|
20697
|
+
// followed by anything, any number of times.
|
20698
|
+
const twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
|
20699
|
+
|
20700
|
+
// "abc" -> { a:true, b:true, c:true }
|
20701
|
+
const charSet = s => s.split('').reduce((set, c) => {
|
20702
|
+
set[c] = true
|
20703
|
+
return set
|
20704
|
+
}, {})
|
20705
|
+
|
20706
|
+
// characters that need to be escaped in RegExp.
|
20707
|
+
const reSpecials = charSet('().*{}+?[]^$\\!')
|
20708
|
+
|
20709
|
+
// characters that indicate we have to add the pattern start
|
20710
|
+
const addPatternStartSet = charSet('[.(')
|
20711
|
+
|
20712
|
+
// normalizes slashes.
|
20713
|
+
const slashSplit = /\/+/
|
20714
|
+
|
20715
|
+
minimatch.filter = (pattern, options = {}) =>
|
20716
|
+
(p, i, list) => minimatch(p, pattern, options)
|
20717
|
+
|
20718
|
+
const ext = (a, b = {}) => {
|
20719
|
+
const t = {}
|
20720
|
+
Object.keys(a).forEach(k => t[k] = a[k])
|
20721
|
+
Object.keys(b).forEach(k => t[k] = b[k])
|
20722
|
+
return t
|
20723
|
+
}
|
20724
|
+
|
20725
|
+
minimatch.defaults = def => {
|
20726
|
+
if (!def || typeof def !== 'object' || !Object.keys(def).length) {
|
20727
|
+
return minimatch
|
20728
|
+
}
|
20729
|
+
|
20730
|
+
const orig = minimatch
|
20731
|
+
|
20732
|
+
const m = (p, pattern, options) => orig(p, pattern, ext(def, options))
|
20733
|
+
m.Minimatch = class Minimatch extends orig.Minimatch {
|
20734
|
+
constructor (pattern, options) {
|
20735
|
+
super(pattern, ext(def, options))
|
20736
|
+
}
|
20737
|
+
}
|
20738
|
+
m.Minimatch.defaults = options => orig.defaults(ext(def, options)).Minimatch
|
20739
|
+
m.filter = (pattern, options) => orig.filter(pattern, ext(def, options))
|
20740
|
+
m.defaults = options => orig.defaults(ext(def, options))
|
20741
|
+
m.makeRe = (pattern, options) => orig.makeRe(pattern, ext(def, options))
|
20742
|
+
m.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext(def, options))
|
20743
|
+
m.match = (list, pattern, options) => orig.match(list, pattern, ext(def, options))
|
20744
|
+
|
20745
|
+
return m
|
20746
|
+
}
|
20747
|
+
|
20748
|
+
|
20749
|
+
|
20750
|
+
|
20751
|
+
|
20752
|
+
// Brace expansion:
|
20753
|
+
// a{b,c}d -> abd acd
|
20754
|
+
// a{b,}c -> abc ac
|
20755
|
+
// a{0..3}d -> a0d a1d a2d a3d
|
20756
|
+
// a{b,c{d,e}f}g -> abg acdfg acefg
|
20757
|
+
// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
|
20758
|
+
//
|
20759
|
+
// Invalid sets are not expanded.
|
20760
|
+
// a{2..}b -> a{2..}b
|
20761
|
+
// a{b}c -> a{b}c
|
20762
|
+
minimatch.braceExpand = (pattern, options) => braceExpand(pattern, options)
|
20763
|
+
|
20764
|
+
const braceExpand = (pattern, options = {}) => {
|
20765
|
+
assertValidPattern(pattern)
|
20766
|
+
|
20767
|
+
// Thanks to Yeting Li <https://github.com/yetingli> for
|
20768
|
+
// improving this regexp to avoid a ReDOS vulnerability.
|
20769
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
20770
|
+
// shortcut. no need to expand.
|
20771
|
+
return [pattern]
|
20772
|
+
}
|
20773
|
+
|
20774
|
+
return expand(pattern)
|
20775
|
+
}
|
20776
|
+
|
20777
|
+
const MAX_PATTERN_LENGTH = 1024 * 64
|
20778
|
+
const assertValidPattern = pattern => {
|
20779
|
+
if (typeof pattern !== 'string') {
|
20780
|
+
throw new TypeError('invalid pattern')
|
20781
|
+
}
|
20782
|
+
|
20783
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
20784
|
+
throw new TypeError('pattern is too long')
|
20785
|
+
}
|
20786
|
+
}
|
20787
|
+
|
20788
|
+
// parse a component of the expanded set.
|
20789
|
+
// At this point, no pattern may contain "/" in it
|
20790
|
+
// so we're going to return a 2d array, where each entry is the full
|
20791
|
+
// pattern, split on '/', and then turned into a regular expression.
|
20792
|
+
// A regexp is made at the end which joins each array with an
|
20793
|
+
// escaped /, and another full one which joins each regexp with |.
|
20794
|
+
//
|
20795
|
+
// Following the lead of Bash 4.1, note that "**" only has special meaning
|
20796
|
+
// when it is the *only* thing in a path portion. Otherwise, any series
|
20797
|
+
// of * is equivalent to a single *. Globstar behavior is enabled by
|
20798
|
+
// default, and can be disabled by setting options.noglobstar.
|
20799
|
+
const SUBPARSE = Symbol('subparse')
|
20800
|
+
|
20801
|
+
minimatch.makeRe = (pattern, options) =>
|
20802
|
+
new Minimatch(pattern, options || {}).makeRe()
|
20803
|
+
|
20804
|
+
minimatch.match = (list, pattern, options = {}) => {
|
20805
|
+
const mm = new Minimatch(pattern, options)
|
20806
|
+
list = list.filter(f => mm.match(f))
|
20807
|
+
if (mm.options.nonull && !list.length) {
|
20808
|
+
list.push(pattern)
|
20809
|
+
}
|
20810
|
+
return list
|
20811
|
+
}
|
20812
|
+
|
20813
|
+
// replace stuff like \* with *
|
20814
|
+
const globUnescape = s => s.replace(/\\(.)/g, '$1')
|
20815
|
+
const regExpEscape = s => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
|
20816
|
+
|
20817
|
+
class Minimatch {
|
20818
|
+
constructor (pattern, options) {
|
20819
|
+
assertValidPattern(pattern)
|
20820
|
+
|
20821
|
+
if (!options) options = {}
|
20822
|
+
|
20823
|
+
this.options = options
|
20824
|
+
this.set = []
|
20825
|
+
this.pattern = pattern
|
20826
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape ||
|
20827
|
+
options.allowWindowsEscape === false
|
20828
|
+
if (this.windowsPathsNoEscape) {
|
20829
|
+
this.pattern = this.pattern.replace(/\\/g, '/')
|
20830
|
+
}
|
20831
|
+
this.regexp = null
|
20832
|
+
this.negate = false
|
20833
|
+
this.comment = false
|
20834
|
+
this.empty = false
|
20835
|
+
this.partial = !!options.partial
|
20836
|
+
|
20837
|
+
// make the set of regexps etc.
|
20838
|
+
this.make()
|
20839
|
+
}
|
20840
|
+
|
20841
|
+
debug () {}
|
20842
|
+
|
20843
|
+
make () {
|
20844
|
+
const pattern = this.pattern
|
20845
|
+
const options = this.options
|
20846
|
+
|
20847
|
+
// empty patterns and comments match nothing.
|
20848
|
+
if (!options.nocomment && pattern.charAt(0) === '#') {
|
20849
|
+
this.comment = true
|
20850
|
+
return
|
20851
|
+
}
|
20852
|
+
if (!pattern) {
|
20853
|
+
this.empty = true
|
20854
|
+
return
|
20855
|
+
}
|
20856
|
+
|
20857
|
+
// step 1: figure out negation, etc.
|
20858
|
+
this.parseNegate()
|
20859
|
+
|
20860
|
+
// step 2: expand braces
|
20861
|
+
let set = this.globSet = this.braceExpand()
|
20862
|
+
|
20863
|
+
if (options.debug) this.debug = (...args) => console.error(...args)
|
20864
|
+
|
20865
|
+
this.debug(this.pattern, set)
|
20866
|
+
|
20867
|
+
// step 3: now we have a set, so turn each one into a series of path-portion
|
20868
|
+
// matching patterns.
|
20869
|
+
// These will be regexps, except in the case of "**", which is
|
20870
|
+
// set to the GLOBSTAR object for globstar behavior,
|
20871
|
+
// and will not contain any / characters
|
20872
|
+
set = this.globParts = set.map(s => s.split(slashSplit))
|
20873
|
+
|
20874
|
+
this.debug(this.pattern, set)
|
20875
|
+
|
20876
|
+
// glob --> regexps
|
20877
|
+
set = set.map((s, si, set) => s.map(this.parse, this))
|
20878
|
+
|
20879
|
+
this.debug(this.pattern, set)
|
20880
|
+
|
20881
|
+
// filter out everything that didn't compile properly.
|
20882
|
+
set = set.filter(s => s.indexOf(false) === -1)
|
20883
|
+
|
20884
|
+
this.debug(this.pattern, set)
|
20885
|
+
|
20886
|
+
this.set = set
|
20887
|
+
}
|
20888
|
+
|
20889
|
+
parseNegate () {
|
20890
|
+
if (this.options.nonegate) return
|
20891
|
+
|
20892
|
+
const pattern = this.pattern
|
20893
|
+
let negate = false
|
20894
|
+
let negateOffset = 0
|
20895
|
+
|
20896
|
+
for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) {
|
20897
|
+
negate = !negate
|
20898
|
+
negateOffset++
|
20899
|
+
}
|
20900
|
+
|
20901
|
+
if (negateOffset) this.pattern = pattern.substr(negateOffset)
|
20902
|
+
this.negate = negate
|
20903
|
+
}
|
20904
|
+
|
20905
|
+
// set partial to true to test if, for example,
|
20906
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
20907
|
+
// Partial means, if you run out of file before you run
|
20908
|
+
// out of pattern, then that's fine, as long as all
|
20909
|
+
// the parts match.
|
20910
|
+
matchOne (file, pattern, partial) {
|
20911
|
+
var options = this.options
|
20912
|
+
|
20913
|
+
this.debug('matchOne',
|
20914
|
+
{ 'this': this, file: file, pattern: pattern })
|
20915
|
+
|
20916
|
+
this.debug('matchOne', file.length, pattern.length)
|
20917
|
+
|
20918
|
+
for (var fi = 0,
|
20919
|
+
pi = 0,
|
20920
|
+
fl = file.length,
|
20921
|
+
pl = pattern.length
|
20922
|
+
; (fi < fl) && (pi < pl)
|
20923
|
+
; fi++, pi++) {
|
20924
|
+
this.debug('matchOne loop')
|
20925
|
+
var p = pattern[pi]
|
20926
|
+
var f = file[fi]
|
20927
|
+
|
20928
|
+
this.debug(pattern, p, f)
|
20929
|
+
|
20930
|
+
// should be impossible.
|
20931
|
+
// some invalid regexp stuff in the set.
|
20932
|
+
/* istanbul ignore if */
|
20933
|
+
if (p === false) return false
|
20934
|
+
|
20935
|
+
if (p === GLOBSTAR) {
|
20936
|
+
this.debug('GLOBSTAR', [pattern, p, f])
|
20937
|
+
|
20938
|
+
// "**"
|
20939
|
+
// a/**/b/**/c would match the following:
|
20940
|
+
// a/b/x/y/z/c
|
20941
|
+
// a/x/y/z/b/c
|
20942
|
+
// a/b/x/b/x/c
|
20943
|
+
// a/b/c
|
20944
|
+
// To do this, take the rest of the pattern after
|
20945
|
+
// the **, and see if it would match the file remainder.
|
20946
|
+
// If so, return success.
|
20947
|
+
// If not, the ** "swallows" a segment, and try again.
|
20948
|
+
// This is recursively awful.
|
20949
|
+
//
|
20950
|
+
// a/**/b/**/c matching a/b/x/y/z/c
|
20951
|
+
// - a matches a
|
20952
|
+
// - doublestar
|
20953
|
+
// - matchOne(b/x/y/z/c, b/**/c)
|
20954
|
+
// - b matches b
|
20955
|
+
// - doublestar
|
20956
|
+
// - matchOne(x/y/z/c, c) -> no
|
20957
|
+
// - matchOne(y/z/c, c) -> no
|
20958
|
+
// - matchOne(z/c, c) -> no
|
20959
|
+
// - matchOne(c, c) yes, hit
|
20960
|
+
var fr = fi
|
20961
|
+
var pr = pi + 1
|
20962
|
+
if (pr === pl) {
|
20963
|
+
this.debug('** at the end')
|
20964
|
+
// a ** at the end will just swallow the rest.
|
20965
|
+
// We have found a match.
|
20966
|
+
// however, it will not swallow /.x, unless
|
20967
|
+
// options.dot is set.
|
20968
|
+
// . and .. are *never* matched by **, for explosively
|
20969
|
+
// exponential reasons.
|
20970
|
+
for (; fi < fl; fi++) {
|
20971
|
+
if (file[fi] === '.' || file[fi] === '..' ||
|
20972
|
+
(!options.dot && file[fi].charAt(0) === '.')) return false
|
20973
|
+
}
|
20974
|
+
return true
|
20975
|
+
}
|
20976
|
+
|
20977
|
+
// ok, let's see if we can swallow whatever we can.
|
20978
|
+
while (fr < fl) {
|
20979
|
+
var swallowee = file[fr]
|
20980
|
+
|
20981
|
+
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
|
20982
|
+
|
20983
|
+
// XXX remove this slice. Just pass the start index.
|
20984
|
+
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
20985
|
+
this.debug('globstar found match!', fr, fl, swallowee)
|
20986
|
+
// found a match.
|
20987
|
+
return true
|
20988
|
+
} else {
|
20989
|
+
// can't swallow "." or ".." ever.
|
20990
|
+
// can only swallow ".foo" when explicitly asked.
|
20991
|
+
if (swallowee === '.' || swallowee === '..' ||
|
20992
|
+
(!options.dot && swallowee.charAt(0) === '.')) {
|
20993
|
+
this.debug('dot detected!', file, fr, pattern, pr)
|
20994
|
+
break
|
20995
|
+
}
|
20996
|
+
|
20997
|
+
// ** swallows a segment, and continue.
|
20998
|
+
this.debug('globstar swallow a segment, and continue')
|
20999
|
+
fr++
|
21000
|
+
}
|
21001
|
+
}
|
21002
|
+
|
21003
|
+
// no match was found.
|
21004
|
+
// However, in partial mode, we can't say this is necessarily over.
|
21005
|
+
// If there's more *pattern* left, then
|
21006
|
+
/* istanbul ignore if */
|
21007
|
+
if (partial) {
|
21008
|
+
// ran out of file
|
21009
|
+
this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
|
21010
|
+
if (fr === fl) return true
|
21011
|
+
}
|
21012
|
+
return false
|
21013
|
+
}
|
21014
|
+
|
21015
|
+
// something other than **
|
21016
|
+
// non-magic patterns just have to match exactly
|
21017
|
+
// patterns with magic have been turned into regexps.
|
21018
|
+
var hit
|
21019
|
+
if (typeof p === 'string') {
|
21020
|
+
hit = f === p
|
21021
|
+
this.debug('string match', p, f, hit)
|
21022
|
+
} else {
|
21023
|
+
hit = f.match(p)
|
21024
|
+
this.debug('pattern match', p, f, hit)
|
21025
|
+
}
|
21026
|
+
|
21027
|
+
if (!hit) return false
|
21028
|
+
}
|
21029
|
+
|
21030
|
+
// Note: ending in / means that we'll get a final ""
|
21031
|
+
// at the end of the pattern. This can only match a
|
21032
|
+
// corresponding "" at the end of the file.
|
21033
|
+
// If the file ends in /, then it can only match a
|
21034
|
+
// a pattern that ends in /, unless the pattern just
|
21035
|
+
// doesn't have any more for it. But, a/b/ should *not*
|
21036
|
+
// match "a/b/*", even though "" matches against the
|
21037
|
+
// [^/]*? pattern, except in partial mode, where it might
|
21038
|
+
// simply not be reached yet.
|
21039
|
+
// However, a/b/ should still satisfy a/*
|
21040
|
+
|
21041
|
+
// now either we fell off the end of the pattern, or we're done.
|
21042
|
+
if (fi === fl && pi === pl) {
|
21043
|
+
// ran out of pattern and filename at the same time.
|
21044
|
+
// an exact hit!
|
21045
|
+
return true
|
21046
|
+
} else if (fi === fl) {
|
21047
|
+
// ran out of file, but still had pattern left.
|
21048
|
+
// this is ok if we're doing the match as part of
|
21049
|
+
// a glob fs traversal.
|
21050
|
+
return partial
|
21051
|
+
} else /* istanbul ignore else */ if (pi === pl) {
|
21052
|
+
// ran out of pattern, still have file left.
|
21053
|
+
// this is only acceptable if we're on the very last
|
21054
|
+
// empty segment of a file with a trailing slash.
|
21055
|
+
// a/* should match a/b/
|
21056
|
+
return (fi === fl - 1) && (file[fi] === '')
|
21057
|
+
}
|
21058
|
+
|
21059
|
+
// should be unreachable.
|
21060
|
+
/* istanbul ignore next */
|
21061
|
+
throw new Error('wtf?')
|
21062
|
+
}
|
21063
|
+
|
21064
|
+
braceExpand () {
|
21065
|
+
return braceExpand(this.pattern, this.options)
|
21066
|
+
}
|
21067
|
+
|
21068
|
+
parse (pattern, isSub) {
|
21069
|
+
assertValidPattern(pattern)
|
21070
|
+
|
21071
|
+
const options = this.options
|
21072
|
+
|
21073
|
+
// shortcuts
|
21074
|
+
if (pattern === '**') {
|
21075
|
+
if (!options.noglobstar)
|
21076
|
+
return GLOBSTAR
|
21077
|
+
else
|
21078
|
+
pattern = '*'
|
21079
|
+
}
|
21080
|
+
if (pattern === '') return ''
|
21081
|
+
|
21082
|
+
let re = ''
|
21083
|
+
let hasMagic = !!options.nocase
|
21084
|
+
let escaping = false
|
21085
|
+
// ? => one single character
|
21086
|
+
const patternListStack = []
|
21087
|
+
const negativeLists = []
|
21088
|
+
let stateChar
|
21089
|
+
let inClass = false
|
21090
|
+
let reClassStart = -1
|
21091
|
+
let classStart = -1
|
21092
|
+
let cs
|
21093
|
+
let pl
|
21094
|
+
let sp
|
21095
|
+
// . and .. never match anything that doesn't start with .,
|
21096
|
+
// even when options.dot is set.
|
21097
|
+
const patternStart = pattern.charAt(0) === '.' ? '' // anything
|
21098
|
+
// not (start or / followed by . or .. followed by / or end)
|
21099
|
+
: options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
|
21100
|
+
: '(?!\\.)'
|
21101
|
+
|
21102
|
+
const clearStateChar = () => {
|
21103
|
+
if (stateChar) {
|
21104
|
+
// we had some state-tracking character
|
21105
|
+
// that wasn't consumed by this pass.
|
21106
|
+
switch (stateChar) {
|
21107
|
+
case '*':
|
21108
|
+
re += star
|
21109
|
+
hasMagic = true
|
21110
|
+
break
|
21111
|
+
case '?':
|
21112
|
+
re += qmark
|
21113
|
+
hasMagic = true
|
21114
|
+
break
|
21115
|
+
default:
|
21116
|
+
re += '\\' + stateChar
|
21117
|
+
break
|
21118
|
+
}
|
21119
|
+
this.debug('clearStateChar %j %j', stateChar, re)
|
21120
|
+
stateChar = false
|
21121
|
+
}
|
21122
|
+
}
|
21123
|
+
|
21124
|
+
for (let i = 0, c; (i < pattern.length) && (c = pattern.charAt(i)); i++) {
|
21125
|
+
this.debug('%s\t%s %s %j', pattern, i, re, c)
|
21126
|
+
|
21127
|
+
// skip over any that are escaped.
|
21128
|
+
if (escaping) {
|
21129
|
+
/* istanbul ignore next - completely not allowed, even escaped. */
|
21130
|
+
if (c === '/') {
|
21131
|
+
return false
|
21132
|
+
}
|
21133
|
+
|
21134
|
+
if (reSpecials[c]) {
|
21135
|
+
re += '\\'
|
21136
|
+
}
|
21137
|
+
re += c
|
21138
|
+
escaping = false
|
21139
|
+
continue
|
21140
|
+
}
|
21141
|
+
|
21142
|
+
switch (c) {
|
21143
|
+
/* istanbul ignore next */
|
21144
|
+
case '/': {
|
21145
|
+
// Should already be path-split by now.
|
21146
|
+
return false
|
21147
|
+
}
|
21148
|
+
|
21149
|
+
case '\\':
|
21150
|
+
clearStateChar()
|
21151
|
+
escaping = true
|
21152
|
+
continue
|
21153
|
+
|
21154
|
+
// the various stateChar values
|
21155
|
+
// for the "extglob" stuff.
|
21156
|
+
case '?':
|
21157
|
+
case '*':
|
21158
|
+
case '+':
|
21159
|
+
case '@':
|
21160
|
+
case '!':
|
21161
|
+
this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
|
21162
|
+
|
21163
|
+
// all of those are literals inside a class, except that
|
21164
|
+
// the glob [!a] means [^a] in regexp
|
21165
|
+
if (inClass) {
|
21166
|
+
this.debug(' in class')
|
21167
|
+
if (c === '!' && i === classStart + 1) c = '^'
|
21168
|
+
re += c
|
21169
|
+
continue
|
21170
|
+
}
|
21171
|
+
|
21172
|
+
// if we already have a stateChar, then it means
|
21173
|
+
// that there was something like ** or +? in there.
|
21174
|
+
// Handle the stateChar, then proceed with this one.
|
21175
|
+
this.debug('call clearStateChar %j', stateChar)
|
21176
|
+
clearStateChar()
|
21177
|
+
stateChar = c
|
21178
|
+
// if extglob is disabled, then +(asdf|foo) isn't a thing.
|
21179
|
+
// just clear the statechar *now*, rather than even diving into
|
21180
|
+
// the patternList stuff.
|
21181
|
+
if (options.noext) clearStateChar()
|
21182
|
+
continue
|
21183
|
+
|
21184
|
+
case '(':
|
21185
|
+
if (inClass) {
|
21186
|
+
re += '('
|
21187
|
+
continue
|
21188
|
+
}
|
21189
|
+
|
21190
|
+
if (!stateChar) {
|
21191
|
+
re += '\\('
|
21192
|
+
continue
|
21193
|
+
}
|
21194
|
+
|
21195
|
+
patternListStack.push({
|
21196
|
+
type: stateChar,
|
21197
|
+
start: i - 1,
|
21198
|
+
reStart: re.length,
|
21199
|
+
open: plTypes[stateChar].open,
|
21200
|
+
close: plTypes[stateChar].close
|
21201
|
+
})
|
21202
|
+
// negation is (?:(?!js)[^/]*)
|
21203
|
+
re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
|
21204
|
+
this.debug('plType %j %j', stateChar, re)
|
21205
|
+
stateChar = false
|
21206
|
+
continue
|
21207
|
+
|
21208
|
+
case ')':
|
21209
|
+
if (inClass || !patternListStack.length) {
|
21210
|
+
re += '\\)'
|
21211
|
+
continue
|
21212
|
+
}
|
21213
|
+
|
21214
|
+
clearStateChar()
|
21215
|
+
hasMagic = true
|
21216
|
+
pl = patternListStack.pop()
|
21217
|
+
// negation is (?:(?!js)[^/]*)
|
21218
|
+
// The others are (?:<pattern>)<type>
|
21219
|
+
re += pl.close
|
21220
|
+
if (pl.type === '!') {
|
21221
|
+
negativeLists.push(pl)
|
21222
|
+
}
|
21223
|
+
pl.reEnd = re.length
|
21224
|
+
continue
|
21225
|
+
|
21226
|
+
case '|':
|
21227
|
+
if (inClass || !patternListStack.length) {
|
21228
|
+
re += '\\|'
|
21229
|
+
continue
|
21230
|
+
}
|
21231
|
+
|
21232
|
+
clearStateChar()
|
21233
|
+
re += '|'
|
21234
|
+
continue
|
21235
|
+
|
21236
|
+
// these are mostly the same in regexp and glob
|
21237
|
+
case '[':
|
21238
|
+
// swallow any state-tracking char before the [
|
21239
|
+
clearStateChar()
|
21240
|
+
|
21241
|
+
if (inClass) {
|
21242
|
+
re += '\\' + c
|
21243
|
+
continue
|
21244
|
+
}
|
21245
|
+
|
21246
|
+
inClass = true
|
21247
|
+
classStart = i
|
21248
|
+
reClassStart = re.length
|
21249
|
+
re += c
|
21250
|
+
continue
|
21251
|
+
|
21252
|
+
case ']':
|
21253
|
+
// a right bracket shall lose its special
|
21254
|
+
// meaning and represent itself in
|
21255
|
+
// a bracket expression if it occurs
|
21256
|
+
// first in the list. -- POSIX.2 2.8.3.2
|
21257
|
+
if (i === classStart + 1 || !inClass) {
|
21258
|
+
re += '\\' + c
|
21259
|
+
continue
|
21260
|
+
}
|
21261
|
+
|
21262
|
+
// handle the case where we left a class open.
|
21263
|
+
// "[z-a]" is valid, equivalent to "\[z-a\]"
|
21264
|
+
// split where the last [ was, make sure we don't have
|
21265
|
+
// an invalid re. if so, re-walk the contents of the
|
21266
|
+
// would-be class to re-translate any characters that
|
21267
|
+
// were passed through as-is
|
21268
|
+
// TODO: It would probably be faster to determine this
|
21269
|
+
// without a try/catch and a new RegExp, but it's tricky
|
21270
|
+
// to do safely. For now, this is safe and works.
|
21271
|
+
cs = pattern.substring(classStart + 1, i)
|
21272
|
+
try {
|
21273
|
+
RegExp('[' + cs + ']')
|
21274
|
+
} catch (er) {
|
21275
|
+
// not a valid class!
|
21276
|
+
sp = this.parse(cs, SUBPARSE)
|
21277
|
+
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
|
21278
|
+
hasMagic = hasMagic || sp[1]
|
21279
|
+
inClass = false
|
21280
|
+
continue
|
21281
|
+
}
|
21282
|
+
|
21283
|
+
// finish up the class.
|
21284
|
+
hasMagic = true
|
21285
|
+
inClass = false
|
21286
|
+
re += c
|
21287
|
+
continue
|
21288
|
+
|
21289
|
+
default:
|
21290
|
+
// swallow any state char that wasn't consumed
|
21291
|
+
clearStateChar()
|
21292
|
+
|
21293
|
+
if (reSpecials[c] && !(c === '^' && inClass)) {
|
21294
|
+
re += '\\'
|
21295
|
+
}
|
21296
|
+
|
21297
|
+
re += c
|
21298
|
+
break
|
21299
|
+
|
21300
|
+
} // switch
|
21301
|
+
} // for
|
21302
|
+
|
21303
|
+
// handle the case where we left a class open.
|
21304
|
+
// "[abc" is valid, equivalent to "\[abc"
|
21305
|
+
if (inClass) {
|
21306
|
+
// split where the last [ was, and escape it
|
21307
|
+
// this is a huge pita. We now have to re-walk
|
21308
|
+
// the contents of the would-be class to re-translate
|
21309
|
+
// any characters that were passed through as-is
|
21310
|
+
cs = pattern.substr(classStart + 1)
|
21311
|
+
sp = this.parse(cs, SUBPARSE)
|
21312
|
+
re = re.substr(0, reClassStart) + '\\[' + sp[0]
|
21313
|
+
hasMagic = hasMagic || sp[1]
|
21314
|
+
}
|
21315
|
+
|
21316
|
+
// handle the case where we had a +( thing at the *end*
|
21317
|
+
// of the pattern.
|
21318
|
+
// each pattern list stack adds 3 chars, and we need to go through
|
21319
|
+
// and escape any | chars that were passed through as-is for the regexp.
|
21320
|
+
// Go through and escape them, taking care not to double-escape any
|
21321
|
+
// | chars that were already escaped.
|
21322
|
+
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
21323
|
+
let tail
|
21324
|
+
tail = re.slice(pl.reStart + pl.open.length)
|
21325
|
+
this.debug('setting tail', re, pl)
|
21326
|
+
// maybe some even number of \, then maybe 1 \, followed by a |
|
21327
|
+
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, (_, $1, $2) => {
|
21328
|
+
/* istanbul ignore else - should already be done */
|
21329
|
+
if (!$2) {
|
21330
|
+
// the | isn't already escaped, so escape it.
|
21331
|
+
$2 = '\\'
|
21332
|
+
}
|
21333
|
+
|
21334
|
+
// need to escape all those slashes *again*, without escaping the
|
21335
|
+
// one that we need for escaping the | character. As it works out,
|
21336
|
+
// escaping an even number of slashes can be done by simply repeating
|
21337
|
+
// it exactly after itself. That's why this trick works.
|
21338
|
+
//
|
21339
|
+
// I am sorry that you have to see this.
|
21340
|
+
return $1 + $1 + $2 + '|'
|
21341
|
+
})
|
21342
|
+
|
21343
|
+
this.debug('tail=%j\n %s', tail, tail, pl, re)
|
21344
|
+
const t = pl.type === '*' ? star
|
21345
|
+
: pl.type === '?' ? qmark
|
21346
|
+
: '\\' + pl.type
|
21347
|
+
|
21348
|
+
hasMagic = true
|
21349
|
+
re = re.slice(0, pl.reStart) + t + '\\(' + tail
|
21350
|
+
}
|
21351
|
+
|
21352
|
+
// handle trailing things that only matter at the very end.
|
21353
|
+
clearStateChar()
|
21354
|
+
if (escaping) {
|
21355
|
+
// trailing \\
|
21356
|
+
re += '\\\\'
|
21357
|
+
}
|
21358
|
+
|
21359
|
+
// only need to apply the nodot start if the re starts with
|
21360
|
+
// something that could conceivably capture a dot
|
21361
|
+
const addPatternStart = addPatternStartSet[re.charAt(0)]
|
21362
|
+
|
21363
|
+
// Hack to work around lack of negative lookbehind in JS
|
21364
|
+
// A pattern like: *.!(x).!(y|z) needs to ensure that a name
|
21365
|
+
// like 'a.xyz.yz' doesn't match. So, the first negative
|
21366
|
+
// lookahead, has to look ALL the way ahead, to the end of
|
21367
|
+
// the pattern.
|
21368
|
+
for (let n = negativeLists.length - 1; n > -1; n--) {
|
21369
|
+
const nl = negativeLists[n]
|
21370
|
+
|
21371
|
+
const nlBefore = re.slice(0, nl.reStart)
|
21372
|
+
const nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
|
21373
|
+
let nlAfter = re.slice(nl.reEnd)
|
21374
|
+
const nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + nlAfter
|
21375
|
+
|
21376
|
+
// Handle nested stuff like *(*.js|!(*.json)), where open parens
|
21377
|
+
// mean that we should *not* include the ) in the bit that is considered
|
21378
|
+
// "after" the negated section.
|
21379
|
+
const openParensBefore = nlBefore.split('(').length - 1
|
21380
|
+
let cleanAfter = nlAfter
|
21381
|
+
for (let i = 0; i < openParensBefore; i++) {
|
21382
|
+
cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
|
21383
|
+
}
|
21384
|
+
nlAfter = cleanAfter
|
21385
|
+
|
21386
|
+
const dollar = nlAfter === '' && isSub !== SUBPARSE ? '$' : ''
|
21387
|
+
re = nlBefore + nlFirst + nlAfter + dollar + nlLast
|
21388
|
+
}
|
21389
|
+
|
21390
|
+
// if the re is not "" at this point, then we need to make sure
|
21391
|
+
// it doesn't match against an empty path part.
|
21392
|
+
// Otherwise a/* will match a/, which it should not.
|
21393
|
+
if (re !== '' && hasMagic) {
|
21394
|
+
re = '(?=.)' + re
|
21395
|
+
}
|
21396
|
+
|
21397
|
+
if (addPatternStart) {
|
21398
|
+
re = patternStart + re
|
21399
|
+
}
|
21400
|
+
|
21401
|
+
// parsing just a piece of a larger pattern.
|
21402
|
+
if (isSub === SUBPARSE) {
|
21403
|
+
return [re, hasMagic]
|
21404
|
+
}
|
21405
|
+
|
21406
|
+
// skip the regexp for non-magical patterns
|
21407
|
+
// unescape anything in it, though, so that it'll be
|
21408
|
+
// an exact match against a file etc.
|
21409
|
+
if (!hasMagic) {
|
21410
|
+
return globUnescape(pattern)
|
21411
|
+
}
|
21412
|
+
|
21413
|
+
const flags = options.nocase ? 'i' : ''
|
21414
|
+
try {
|
21415
|
+
return Object.assign(new RegExp('^' + re + '$', flags), {
|
21416
|
+
_glob: pattern,
|
21417
|
+
_src: re,
|
21418
|
+
})
|
21419
|
+
} catch (er) /* istanbul ignore next - should be impossible */ {
|
21420
|
+
// If it was an invalid regular expression, then it can't match
|
21421
|
+
// anything. This trick looks for a character after the end of
|
21422
|
+
// the string, which is of course impossible, except in multi-line
|
21423
|
+
// mode, but it's not a /m regex.
|
21424
|
+
return new RegExp('$.')
|
21425
|
+
}
|
21426
|
+
}
|
21427
|
+
|
21428
|
+
makeRe () {
|
21429
|
+
if (this.regexp || this.regexp === false) return this.regexp
|
21430
|
+
|
21431
|
+
// at this point, this.set is a 2d array of partial
|
21432
|
+
// pattern strings, or "**".
|
21433
|
+
//
|
21434
|
+
// It's better to use .match(). This function shouldn't
|
21435
|
+
// be used, really, but it's pretty convenient sometimes,
|
21436
|
+
// when you just want to work with a regex.
|
21437
|
+
const set = this.set
|
21438
|
+
|
21439
|
+
if (!set.length) {
|
21440
|
+
this.regexp = false
|
21441
|
+
return this.regexp
|
21442
|
+
}
|
21443
|
+
const options = this.options
|
21444
|
+
|
21445
|
+
const twoStar = options.noglobstar ? star
|
21446
|
+
: options.dot ? twoStarDot
|
21447
|
+
: twoStarNoDot
|
21448
|
+
const flags = options.nocase ? 'i' : ''
|
21449
|
+
|
21450
|
+
// coalesce globstars and regexpify non-globstar patterns
|
21451
|
+
// if it's the only item, then we just do one twoStar
|
21452
|
+
// if it's the first, and there are more, prepend (\/|twoStar\/)? to next
|
21453
|
+
// if it's the last, append (\/twoStar|) to previous
|
21454
|
+
// if it's in the middle, append (\/|\/twoStar\/) to previous
|
21455
|
+
// then filter out GLOBSTAR symbols
|
21456
|
+
let re = set.map(pattern => {
|
21457
|
+
pattern = pattern.map(p =>
|
21458
|
+
typeof p === 'string' ? regExpEscape(p)
|
21459
|
+
: p === GLOBSTAR ? GLOBSTAR
|
21460
|
+
: p._src
|
21461
|
+
).reduce((set, p) => {
|
21462
|
+
if (!(set[set.length - 1] === GLOBSTAR && p === GLOBSTAR)) {
|
21463
|
+
set.push(p)
|
21464
|
+
}
|
21465
|
+
return set
|
21466
|
+
}, [])
|
21467
|
+
pattern.forEach((p, i) => {
|
21468
|
+
if (p !== GLOBSTAR || pattern[i-1] === GLOBSTAR) {
|
21469
|
+
return
|
21470
|
+
}
|
21471
|
+
if (i === 0) {
|
21472
|
+
if (pattern.length > 1) {
|
21473
|
+
pattern[i+1] = '(?:\\\/|' + twoStar + '\\\/)?' + pattern[i+1]
|
21474
|
+
} else {
|
21475
|
+
pattern[i] = twoStar
|
21476
|
+
}
|
21477
|
+
} else if (i === pattern.length - 1) {
|
21478
|
+
pattern[i-1] += '(?:\\\/|' + twoStar + ')?'
|
21479
|
+
} else {
|
21480
|
+
pattern[i-1] += '(?:\\\/|\\\/' + twoStar + '\\\/)' + pattern[i+1]
|
21481
|
+
pattern[i+1] = GLOBSTAR
|
21482
|
+
}
|
21483
|
+
})
|
21484
|
+
return pattern.filter(p => p !== GLOBSTAR).join('/')
|
21485
|
+
}).join('|')
|
21486
|
+
|
21487
|
+
// must match entire pattern
|
21488
|
+
// ending in a * or ** will make it less strict.
|
21489
|
+
re = '^(?:' + re + ')$'
|
21490
|
+
|
21491
|
+
// can match anything, as long as it's not this.
|
21492
|
+
if (this.negate) re = '^(?!' + re + ').*$'
|
21493
|
+
|
21494
|
+
try {
|
21495
|
+
this.regexp = new RegExp(re, flags)
|
21496
|
+
} catch (ex) /* istanbul ignore next - should be impossible */ {
|
21497
|
+
this.regexp = false
|
21498
|
+
}
|
21499
|
+
return this.regexp
|
21500
|
+
}
|
21501
|
+
|
21502
|
+
match (f, partial = this.partial) {
|
21503
|
+
this.debug('match', f, this.pattern)
|
21504
|
+
// short-circuit in the case of busted things.
|
21505
|
+
// comments, etc.
|
21506
|
+
if (this.comment) return false
|
21507
|
+
if (this.empty) return f === ''
|
21508
|
+
|
21509
|
+
if (f === '/' && partial) return true
|
21510
|
+
|
21511
|
+
const options = this.options
|
21512
|
+
|
21513
|
+
// windows: need to use /, not \
|
21514
|
+
if (path.sep !== '/') {
|
21515
|
+
f = f.split(path.sep).join('/')
|
21516
|
+
}
|
21517
|
+
|
21518
|
+
// treat the test path as a set of pathparts.
|
21519
|
+
f = f.split(slashSplit)
|
21520
|
+
this.debug(this.pattern, 'split', f)
|
21521
|
+
|
21522
|
+
// just ONE of the pattern sets in this.set needs to match
|
21523
|
+
// in order for it to be valid. If negating, then just one
|
21524
|
+
// match means that we have failed.
|
21525
|
+
// Either way, return on the first hit.
|
21526
|
+
|
21527
|
+
const set = this.set
|
21528
|
+
this.debug(this.pattern, 'set', set)
|
21529
|
+
|
21530
|
+
// Find the basename of the path by looking for the last non-empty segment
|
21531
|
+
let filename
|
21532
|
+
for (let i = f.length - 1; i >= 0; i--) {
|
21533
|
+
filename = f[i]
|
21534
|
+
if (filename) break
|
21535
|
+
}
|
21536
|
+
|
21537
|
+
for (let i = 0; i < set.length; i++) {
|
21538
|
+
const pattern = set[i]
|
21539
|
+
let file = f
|
21540
|
+
if (options.matchBase && pattern.length === 1) {
|
21541
|
+
file = [filename]
|
21542
|
+
}
|
21543
|
+
const hit = this.matchOne(file, pattern, partial)
|
21544
|
+
if (hit) {
|
21545
|
+
if (options.flipNegate) return true
|
21546
|
+
return !this.negate
|
21547
|
+
}
|
21548
|
+
}
|
21549
|
+
|
21550
|
+
// didn't get any hits. this is success if it's a negative
|
21551
|
+
// pattern, failure otherwise.
|
21552
|
+
if (options.flipNegate) return false
|
21553
|
+
return this.negate
|
21554
|
+
}
|
21555
|
+
|
21556
|
+
static defaults (def) {
|
21557
|
+
return minimatch.defaults(def).Minimatch
|
21558
|
+
}
|
21559
|
+
}
|
21560
|
+
|
21561
|
+
minimatch.Minimatch = Minimatch
|
21562
|
+
|
21563
|
+
|
20458
21564
|
/***/ }),
|
20459
21565
|
|
20460
21566
|
/***/ 2231:
|
@@ -20463,18 +21569,15 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
|
|
20463
21569
|
module.exports = globSync
|
20464
21570
|
globSync.GlobSync = GlobSync
|
20465
21571
|
|
20466
|
-
var fs = __webpack_require__(5747)
|
20467
21572
|
var rp = __webpack_require__(8945)
|
20468
|
-
var minimatch = __webpack_require__(
|
21573
|
+
var minimatch = __webpack_require__(949)
|
20469
21574
|
var Minimatch = minimatch.Minimatch
|
20470
21575
|
var Glob = __webpack_require__(1104).Glob
|
20471
21576
|
var util = __webpack_require__(1669)
|
20472
21577
|
var path = __webpack_require__(5622)
|
20473
21578
|
var assert = __webpack_require__(2357)
|
20474
|
-
var isAbsolute = __webpack_require__(
|
21579
|
+
var isAbsolute = __webpack_require__(5622).isAbsolute
|
20475
21580
|
var common = __webpack_require__(9686)
|
20476
|
-
var alphasort = common.alphasort
|
20477
|
-
var alphasorti = common.alphasorti
|
20478
21581
|
var setopts = common.setopts
|
20479
21582
|
var ownProp = common.ownProp
|
20480
21583
|
var childrenIgnored = common.childrenIgnored
|
@@ -20513,7 +21616,7 @@ function GlobSync (pattern, options) {
|
|
20513
21616
|
}
|
20514
21617
|
|
20515
21618
|
GlobSync.prototype._finish = function () {
|
20516
|
-
assert(this instanceof GlobSync)
|
21619
|
+
assert.ok(this instanceof GlobSync)
|
20517
21620
|
if (this.realpath) {
|
20518
21621
|
var self = this
|
20519
21622
|
this.matches.forEach(function (matchset, index) {
|
@@ -20537,7 +21640,7 @@ GlobSync.prototype._finish = function () {
|
|
20537
21640
|
|
20538
21641
|
|
20539
21642
|
GlobSync.prototype._process = function (pattern, index, inGlobStar) {
|
20540
|
-
assert(this instanceof GlobSync)
|
21643
|
+
assert.ok(this instanceof GlobSync)
|
20541
21644
|
|
20542
21645
|
// Get the first [n] parts of pattern that are all strings.
|
20543
21646
|
var n = 0
|
@@ -20574,7 +21677,10 @@ GlobSync.prototype._process = function (pattern, index, inGlobStar) {
|
|
20574
21677
|
var read
|
20575
21678
|
if (prefix === null)
|
20576
21679
|
read = '.'
|
20577
|
-
else if (isAbsolute(prefix) ||
|
21680
|
+
else if (isAbsolute(prefix) ||
|
21681
|
+
isAbsolute(pattern.map(function (p) {
|
21682
|
+
return typeof p === 'string' ? p : '[*]'
|
21683
|
+
}).join('/'))) {
|
20578
21684
|
if (!prefix || !isAbsolute(prefix))
|
20579
21685
|
prefix = '/' + prefix
|
20580
21686
|
read = prefix
|
@@ -20710,7 +21816,7 @@ GlobSync.prototype._readdirInGlobStar = function (abs) {
|
|
20710
21816
|
var lstat
|
20711
21817
|
var stat
|
20712
21818
|
try {
|
20713
|
-
lstat = fs.lstatSync(abs)
|
21819
|
+
lstat = this.fs.lstatSync(abs)
|
20714
21820
|
} catch (er) {
|
20715
21821
|
if (er.code === 'ENOENT') {
|
20716
21822
|
// lstat failed, doesn't exist
|
@@ -20747,7 +21853,7 @@ GlobSync.prototype._readdir = function (abs, inGlobStar) {
|
|
20747
21853
|
}
|
20748
21854
|
|
20749
21855
|
try {
|
20750
|
-
return this._readdirEntries(abs, fs.readdirSync(abs))
|
21856
|
+
return this._readdirEntries(abs, this.fs.readdirSync(abs))
|
20751
21857
|
} catch (er) {
|
20752
21858
|
this._readdirError(abs, er)
|
20753
21859
|
return null
|
@@ -20906,7 +22012,7 @@ GlobSync.prototype._stat = function (f) {
|
|
20906
22012
|
if (!stat) {
|
20907
22013
|
var lstat
|
20908
22014
|
try {
|
20909
|
-
lstat = fs.lstatSync(abs)
|
22015
|
+
lstat = this.fs.lstatSync(abs)
|
20910
22016
|
} catch (er) {
|
20911
22017
|
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
20912
22018
|
this.statCache[abs] = false
|
@@ -20916,7 +22022,7 @@ GlobSync.prototype._stat = function (f) {
|
|
20916
22022
|
|
20917
22023
|
if (lstat && lstat.isSymbolicLink()) {
|
20918
22024
|
try {
|
20919
|
-
stat = fs.statSync(abs)
|
22025
|
+
stat = this.fs.statSync(abs)
|
20920
22026
|
} catch (er) {
|
20921
22027
|
stat = lstat
|
20922
22028
|
}
|
@@ -32800,7 +33906,7 @@ function sortFiles(fileA, fileB) {
|
|
32800
33906
|
exports.sortFiles = sortFiles;
|
32801
33907
|
function detectApiExtensions(builders) {
|
32802
33908
|
return new Set(builders
|
32803
|
-
.filter((b) =>
|
33909
|
+
.filter((b) => Boolean(b.config && b.config.zeroConfig && b.src?.startsWith('api/')))
|
32804
33910
|
.map(b => path_1.extname(b.src))
|
32805
33911
|
.filter(Boolean));
|
32806
33912
|
}
|
@@ -32808,18 +33914,17 @@ exports.detectApiExtensions = detectApiExtensions;
|
|
32808
33914
|
function detectApiDirectory(builders) {
|
32809
33915
|
// TODO: We eventually want to save the api directory to
|
32810
33916
|
// builder.config.apiDirectory so it is only detected once
|
32811
|
-
const found = builders.some(b =>
|
33917
|
+
const found = builders.some(b => b.config && b.config.zeroConfig && b.src?.startsWith('api/'));
|
32812
33918
|
return found ? 'api' : null;
|
32813
33919
|
}
|
32814
33920
|
exports.detectApiDirectory = detectApiDirectory;
|
32815
33921
|
// TODO: Replace this function with `config.outputDirectory`
|
32816
33922
|
function getPublicBuilder(builders) {
|
32817
|
-
var _a;
|
32818
33923
|
for (const builder of builders) {
|
32819
33924
|
if (typeof builder.src === 'string' &&
|
32820
33925
|
_1.isOfficialRuntime('static', builder.use) &&
|
32821
33926
|
/^.*\/\*\*\/\*$/.test(builder.src) &&
|
32822
|
-
|
33927
|
+
builder.config?.zeroConfig === true) {
|
32823
33928
|
return builder;
|
32824
33929
|
}
|
32825
33930
|
}
|
@@ -32833,7 +33938,6 @@ function detectOutputDirectory(builders) {
|
|
32833
33938
|
}
|
32834
33939
|
exports.detectOutputDirectory = detectOutputDirectory;
|
32835
33940
|
async function detectBuilders(files, pkg, options = {}) {
|
32836
|
-
var _a;
|
32837
33941
|
const errors = [];
|
32838
33942
|
const warnings = [];
|
32839
33943
|
const apiBuilders = [];
|
@@ -32863,7 +33967,7 @@ async function detectBuilders(files, pkg, options = {}) {
|
|
32863
33967
|
const absolutePathCache = new Map();
|
32864
33968
|
const { projectSettings = {} } = options;
|
32865
33969
|
const { buildCommand, outputDirectory, framework } = projectSettings;
|
32866
|
-
const ignoreRuntimes = new Set(
|
33970
|
+
const ignoreRuntimes = new Set(slugToFramework.get(framework || '')?.ignoreRuntimes);
|
32867
33971
|
const withTag = options.tag ? `@${options.tag}` : '';
|
32868
33972
|
const apiMatches = getApiMatches()
|
32869
33973
|
.filter(b => !ignoreRuntimes.has(b.use))
|
@@ -33458,8 +34562,7 @@ function createRouteFromPath(filePath, featHandleMiss, cleanUrls) {
|
|
33458
34562
|
return { route, isDynamic };
|
33459
34563
|
}
|
33460
34564
|
function getRouteResult(pkg, apiRoutes, dynamicRoutes, outputDirectory, apiBuilders, frontendBuilder, options) {
|
33461
|
-
|
33462
|
-
const deps = Object.assign({}, pkg === null || pkg === void 0 ? void 0 : pkg.dependencies, pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies);
|
34565
|
+
const deps = Object.assign({}, pkg?.dependencies, pkg?.devDependencies);
|
33463
34566
|
const defaultRoutes = [];
|
33464
34567
|
const redirectRoutes = [];
|
33465
34568
|
const rewriteRoutes = [];
|
@@ -33469,9 +34572,9 @@ function getRouteResult(pkg, apiRoutes, dynamicRoutes, outputDirectory, apiBuild
|
|
33469
34572
|
redirectRoutes: [],
|
33470
34573
|
rewriteRoutes: [],
|
33471
34574
|
};
|
33472
|
-
const framework =
|
33473
|
-
const isNextjs = framework === 'nextjs' || _1.isOfficialRuntime('next', frontendBuilder
|
33474
|
-
const ignoreRuntimes =
|
34575
|
+
const framework = frontendBuilder?.config?.framework || '';
|
34576
|
+
const isNextjs = framework === 'nextjs' || _1.isOfficialRuntime('next', frontendBuilder?.use);
|
34577
|
+
const ignoreRuntimes = slugToFramework.get(framework)?.ignoreRuntimes;
|
33475
34578
|
if (apiRoutes && apiRoutes.length > 0) {
|
33476
34579
|
if (options.featHandleMiss) {
|
33477
34580
|
// Exclude extension names if the corresponding plugin is not found in package.json
|
@@ -33638,7 +34741,7 @@ const enableFileSystemApiFrameworks = new Set(['solidstart']);
|
|
33638
34741
|
*/
|
33639
34742
|
async function detectFileSystemAPI({ files, projectSettings, builders, vercelConfig, pkg, tag, enableFlag = false, }) {
|
33640
34743
|
const framework = projectSettings.framework || '';
|
33641
|
-
const deps = Object.assign({}, pkg
|
34744
|
+
const deps = Object.assign({}, pkg?.dependencies, pkg?.devDependencies);
|
33642
34745
|
const plugins = Object.keys(deps).filter(dep => dep.startsWith('vercel-plugin-'));
|
33643
34746
|
const hasDotOutput = Object.keys(files).some(file => file.startsWith('.output/'));
|
33644
34747
|
const hasMiddleware = Boolean(files['_middleware.js'] || files['_middleware.ts']);
|
@@ -33654,14 +34757,14 @@ async function detectFileSystemAPI({ files, projectSettings, builders, vercelCon
|
|
33654
34757
|
if (!isEnabled) {
|
33655
34758
|
return { metadata, fsApiBuilder: null, reason: 'Flag not enabled.' };
|
33656
34759
|
}
|
33657
|
-
if (
|
34760
|
+
if (vercelConfig?.builds && vercelConfig.builds.length > 0) {
|
33658
34761
|
return {
|
33659
34762
|
metadata,
|
33660
34763
|
fsApiBuilder: null,
|
33661
34764
|
reason: 'Detected `builds` in vercel.json. Please remove it in favor of CLI plugins.',
|
33662
34765
|
};
|
33663
34766
|
}
|
33664
|
-
if (Object.values(
|
34767
|
+
if (Object.values(vercelConfig?.functions || {}).some(fn => !!fn.runtime)) {
|
33665
34768
|
return {
|
33666
34769
|
metadata,
|
33667
34770
|
fsApiBuilder: null,
|
@@ -33731,7 +34834,7 @@ async function detectFileSystemAPI({ files, projectSettings, builders, vercelCon
|
|
33731
34834
|
// Use the old pipeline if a custom output directory was specified for Next.js
|
33732
34835
|
// because `vercel build` cannot ensure that the directory will be in the same
|
33733
34836
|
// location as `.output`, which can break imports (not just nft.json files).
|
33734
|
-
if (projectSettings
|
34837
|
+
if (projectSettings?.outputDirectory) {
|
33735
34838
|
return {
|
33736
34839
|
metadata,
|
33737
34840
|
fsApiBuilder: null,
|
@@ -33778,7 +34881,7 @@ async function detectFileSystemAPI({ files, projectSettings, builders, vercelCon
|
|
33778
34881
|
const frontendBuilder = builders.find(({ use }) => _1.isOfficialRuntime('next', use) ||
|
33779
34882
|
_1.isOfficialRuntime('static', use) ||
|
33780
34883
|
_1.isOfficialRuntime('static-build', use));
|
33781
|
-
const config =
|
34884
|
+
const config = frontendBuilder?.config || {};
|
33782
34885
|
const withTag = tag ? `@${tag}` : '';
|
33783
34886
|
const fsApiBuilder = {
|
33784
34887
|
use: `@vercelruntimes/file-system-api${withTag}`,
|
@@ -34371,6 +35474,85 @@ async function download(files, basePath, meta) {
|
|
34371
35474
|
exports.default = download;
|
34372
35475
|
|
34373
35476
|
|
35477
|
+
/***/ }),
|
35478
|
+
|
35479
|
+
/***/ 5706:
|
35480
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
35481
|
+
|
35482
|
+
"use strict";
|
35483
|
+
|
35484
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
35485
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
35486
|
+
};
|
35487
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
35488
|
+
exports.getGlobFs = void 0;
|
35489
|
+
const fs_1 = __importDefault(__webpack_require__(5747));
|
35490
|
+
function normalizePath(path) {
|
35491
|
+
// on windows, this will return a path like
|
35492
|
+
// D:/c/package.json
|
35493
|
+
// since we abstract the filesystem, we need to remove windows specific info from the path
|
35494
|
+
// and let the FS decide how to process the path
|
35495
|
+
// D:/c/package.json => /c/package.json
|
35496
|
+
return path.replace(/^[a-zA-Z]:/, '');
|
35497
|
+
}
|
35498
|
+
function getGlobFs(_fs) {
|
35499
|
+
const readdir = (path, callback) => {
|
35500
|
+
_fs
|
35501
|
+
.readdir(normalizePath(String(path)))
|
35502
|
+
.then(stats => callback(null, stats.map(stat => stat.name)))
|
35503
|
+
.catch(err => callback(err, []));
|
35504
|
+
};
|
35505
|
+
const stat = (path, callback) => {
|
35506
|
+
_fs
|
35507
|
+
.isFile(normalizePath(String(path)))
|
35508
|
+
.then(isPathAFile => {
|
35509
|
+
callback(null, {
|
35510
|
+
ino: 0,
|
35511
|
+
mode: 0,
|
35512
|
+
nlink: 0,
|
35513
|
+
uid: 0,
|
35514
|
+
gid: 0,
|
35515
|
+
rdev: 0,
|
35516
|
+
size: 0,
|
35517
|
+
blksize: 0,
|
35518
|
+
blocks: 0,
|
35519
|
+
atimeMs: 0,
|
35520
|
+
mtimeMs: 0,
|
35521
|
+
ctimeMs: 0,
|
35522
|
+
birthtimeMs: 0,
|
35523
|
+
atime: new Date(),
|
35524
|
+
mtime: new Date(),
|
35525
|
+
ctime: new Date(),
|
35526
|
+
birthtime: new Date(),
|
35527
|
+
dev: 0,
|
35528
|
+
isBlockDevice: () => false,
|
35529
|
+
isCharacterDevice: () => false,
|
35530
|
+
isDirectory: () => !isPathAFile,
|
35531
|
+
isFIFO: () => false,
|
35532
|
+
isFile: () => isPathAFile,
|
35533
|
+
isSocket: () => false,
|
35534
|
+
isSymbolicLink: () => false,
|
35535
|
+
});
|
35536
|
+
})
|
35537
|
+
.catch(err => callback(err, null));
|
35538
|
+
};
|
35539
|
+
return new Proxy(fs_1.default, {
|
35540
|
+
get(_target, prop) {
|
35541
|
+
switch (prop) {
|
35542
|
+
case 'readdir':
|
35543
|
+
return readdir;
|
35544
|
+
case 'lstat':
|
35545
|
+
case 'stat':
|
35546
|
+
return stat;
|
35547
|
+
default:
|
35548
|
+
throw new Error('Not Implemented');
|
35549
|
+
}
|
35550
|
+
},
|
35551
|
+
});
|
35552
|
+
}
|
35553
|
+
exports.getGlobFs = getGlobFs;
|
35554
|
+
|
35555
|
+
|
34374
35556
|
/***/ }),
|
34375
35557
|
|
34376
35558
|
/***/ 3838:
|
@@ -34645,6 +35827,7 @@ const fs_extra_1 = __importDefault(__webpack_require__(5392));
|
|
34645
35827
|
const path_1 = __importDefault(__webpack_require__(5622));
|
34646
35828
|
const async_sema_1 = __importDefault(__webpack_require__(5758));
|
34647
35829
|
const cross_spawn_1 = __importDefault(__webpack_require__(7618));
|
35830
|
+
const semver_1 = __webpack_require__(2879);
|
34648
35831
|
const util_1 = __webpack_require__(1669);
|
34649
35832
|
const debug_1 = __importDefault(__webpack_require__(1868));
|
34650
35833
|
const errors_1 = __webpack_require__(3983);
|
@@ -34761,15 +35944,15 @@ function getSpawnOptions(meta, nodeVersion) {
|
|
34761
35944
|
};
|
34762
35945
|
if (!meta.isDev) {
|
34763
35946
|
// Ensure that the selected Node version is at the beginning of the `$PATH`
|
34764
|
-
opts.env.PATH = `/node${nodeVersion.major}/bin
|
35947
|
+
opts.env.PATH = `/node${nodeVersion.major}/bin${path_1.default.delimiter}${opts.env.PATH || process.env.PATH}`;
|
34765
35948
|
}
|
34766
35949
|
return opts;
|
34767
35950
|
}
|
34768
35951
|
exports.getSpawnOptions = getSpawnOptions;
|
34769
35952
|
async function getNodeVersion(destPath, _nodeVersion, config = {}, meta = {}) {
|
35953
|
+
const latest = node_version_1.getLatestNodeVersion();
|
34770
35954
|
if (meta && meta.isDev) {
|
34771
35955
|
// Use the system-installed version of `node` in PATH for `vercel dev`
|
34772
|
-
const latest = node_version_1.getLatestNodeVersion();
|
34773
35956
|
return { ...latest, runtime: 'nodejs' };
|
34774
35957
|
}
|
34775
35958
|
const { packageJson } = await scanParentDirs(destPath, true);
|
@@ -34777,9 +35960,20 @@ async function getNodeVersion(destPath, _nodeVersion, config = {}, meta = {}) {
|
|
34777
35960
|
let isAuto = true;
|
34778
35961
|
if (packageJson && packageJson.engines && packageJson.engines.node) {
|
34779
35962
|
const { node } = packageJson.engines;
|
34780
|
-
if (nodeVersion &&
|
35963
|
+
if (nodeVersion &&
|
35964
|
+
semver_1.validRange(node) &&
|
35965
|
+
!semver_1.intersects(nodeVersion, node) &&
|
35966
|
+
!meta.isDev) {
|
34781
35967
|
console.warn(`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${nodeVersion}") will not apply. Learn More: http://vercel.link/node-version`);
|
34782
35968
|
}
|
35969
|
+
else if (semver_1.coerce(node)?.raw === node && !meta.isDev) {
|
35970
|
+
console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More: http://vercel.link/node-version`);
|
35971
|
+
}
|
35972
|
+
else if (semver_1.validRange(node) &&
|
35973
|
+
semver_1.intersects(`${latest.major + 1}.x`, node) &&
|
35974
|
+
!meta.isDev) {
|
35975
|
+
console.warn(`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More: http://vercel.link/node-version`);
|
35976
|
+
}
|
34783
35977
|
nodeVersion = node;
|
34784
35978
|
isAuto = false;
|
34785
35979
|
}
|
@@ -34863,11 +36057,10 @@ async function walkParentDirs({ base, start, filename, }) {
|
|
34863
36057
|
}
|
34864
36058
|
exports.walkParentDirs = walkParentDirs;
|
34865
36059
|
function isSet(v) {
|
34866
|
-
|
34867
|
-
return ((_a = v === null || v === void 0 ? void 0 : v.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'Set';
|
36060
|
+
return v?.constructor?.name === 'Set';
|
34868
36061
|
}
|
34869
36062
|
async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion) {
|
34870
|
-
if (meta
|
36063
|
+
if (meta?.isDev) {
|
34871
36064
|
debug_1.default('Skipping dependency installation because dev mode is enabled');
|
34872
36065
|
return false;
|
34873
36066
|
}
|
@@ -34938,16 +36131,16 @@ function getEnvForPackageManager({ cliType, lockfileVersion, nodeVersion, env, }
|
|
34938
36131
|
if (cliType === 'npm') {
|
34939
36132
|
if (typeof lockfileVersion === 'number' &&
|
34940
36133
|
lockfileVersion >= 2 &&
|
34941
|
-
(
|
36134
|
+
(nodeVersion?.major || 0) < 16) {
|
34942
36135
|
// Ensure that npm 7 is at the beginning of the `$PATH`
|
34943
|
-
newEnv.PATH = `/node16/bin-npm7
|
36136
|
+
newEnv.PATH = `/node16/bin-npm7${path_1.default.delimiter}${env.PATH}`;
|
34944
36137
|
console.log('Detected `package-lock.json` generated by npm 7...');
|
34945
36138
|
}
|
34946
36139
|
}
|
34947
36140
|
else if (cliType === 'pnpm') {
|
34948
36141
|
if (typeof lockfileVersion === 'number' && lockfileVersion === 5.4) {
|
34949
36142
|
// Ensure that pnpm 7 is at the beginning of the `$PATH`
|
34950
|
-
newEnv.PATH = `/pnpm7/node_modules/.bin
|
36143
|
+
newEnv.PATH = `/pnpm7/node_modules/.bin${path_1.default.delimiter}${env.PATH}`;
|
34951
36144
|
console.log('Detected `pnpm-lock.yaml` generated by pnpm 7...');
|
34952
36145
|
}
|
34953
36146
|
}
|
@@ -34967,9 +36160,9 @@ async function runCustomInstallCommand({ destPath, installCommand, nodeVersion,
|
|
34967
36160
|
cliType,
|
34968
36161
|
lockfileVersion,
|
34969
36162
|
nodeVersion,
|
34970
|
-
env:
|
36163
|
+
env: spawnOpts?.env || {},
|
34971
36164
|
});
|
34972
|
-
debug_1.default(`Running with $PATH:`,
|
36165
|
+
debug_1.default(`Running with $PATH:`, env?.PATH || '');
|
34973
36166
|
await execCommand(installCommand, {
|
34974
36167
|
...spawnOpts,
|
34975
36168
|
env,
|
@@ -34994,7 +36187,7 @@ async function runPackageJsonScript(destPath, scriptNames, spawnOpts) {
|
|
34994
36187
|
nodeVersion: undefined,
|
34995
36188
|
env: {
|
34996
36189
|
...process.env,
|
34997
|
-
...spawnOpts
|
36190
|
+
...spawnOpts?.env,
|
34998
36191
|
},
|
34999
36192
|
}),
|
35000
36193
|
};
|
@@ -35034,7 +36227,7 @@ async function runPipInstall(destPath, args = [], spawnOpts, meta) {
|
|
35034
36227
|
}
|
35035
36228
|
exports.runPipInstall = runPipInstall;
|
35036
36229
|
function getScriptName(pkg, possibleNames) {
|
35037
|
-
if (pkg
|
36230
|
+
if (pkg?.scripts) {
|
35038
36231
|
for (const name of possibleNames) {
|
35039
36232
|
if (name in pkg.scripts) {
|
35040
36233
|
return name;
|
@@ -35223,7 +36416,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35223
36416
|
};
|
35224
36417
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
35225
36418
|
exports.workspaceManagers = exports.isStaticRuntime = exports.isOfficialRuntime = exports.normalizePath = exports.readConfigFile = exports.DetectorFilesystem = exports.detectFramework = exports.detectFileSystemAPI = exports.detectApiExtensions = exports.detectApiDirectory = exports.detectOutputDirectory = exports.detectBuilders = exports.EdgeFunction = exports.getIgnoreFilter = exports.scanParentDirs = exports.getLambdaOptionsFromFunction = exports.isSymbolicLink = exports.debug = exports.streamToBuffer = exports.getPlatformEnv = exports.getSpawnOptions = exports.getDiscontinuedNodeVersions = exports.getLatestNodeVersion = exports.getNodeVersion = exports.getEnvForPackageManager = exports.runCustomInstallCommand = exports.runShellScript = exports.runPipInstall = exports.runBundleInstall = exports.runNpmInstall = exports.getNodeBinPath = exports.walkParentDirs = exports.spawnCommand = exports.execCommand = exports.runPackageJsonScript = exports.installDependencies = exports.getScriptName = exports.spawnAsync = exports.execAsync = exports.rename = exports.glob = exports.getWriteableDirectory = exports.download = exports.Prerender = exports.createLambda = exports.NodejsLambda = exports.Lambda = exports.FileRef = exports.FileFsRef = exports.FileBlob = void 0;
|
35226
|
-
exports.monorepoManagers = exports.getWorkspaces = void 0;
|
36419
|
+
exports.monorepoManagers = exports.getWorkspacePackagePaths = exports.getWorkspaces = void 0;
|
35227
36420
|
const file_blob_1 = __importDefault(__webpack_require__(2397));
|
35228
36421
|
exports.FileBlob = file_blob_1.default;
|
35229
36422
|
const file_fs_ref_1 = __importDefault(__webpack_require__(9331));
|
@@ -35319,6 +36512,8 @@ var workspace_managers_1 = __webpack_require__(4896);
|
|
35319
36512
|
Object.defineProperty(exports, "workspaceManagers", ({ enumerable: true, get: function () { return workspace_managers_1.workspaceManagers; } }));
|
35320
36513
|
var get_workspaces_1 = __webpack_require__(9740);
|
35321
36514
|
Object.defineProperty(exports, "getWorkspaces", ({ enumerable: true, get: function () { return get_workspaces_1.getWorkspaces; } }));
|
36515
|
+
var get_workspace_package_paths_1 = __webpack_require__(1953);
|
36516
|
+
Object.defineProperty(exports, "getWorkspacePackagePaths", ({ enumerable: true, get: function () { return get_workspace_package_paths_1.getWorkspacePackagePaths; } }));
|
35322
36517
|
var monorepo_managers_1 = __webpack_require__(6418);
|
35323
36518
|
Object.defineProperty(exports, "monorepoManagers", ({ enumerable: true, get: function () { return monorepo_managers_1.monorepoManagers; } }));
|
35324
36519
|
|
@@ -35445,7 +36640,7 @@ async function createZip(files) {
|
|
35445
36640
|
}
|
35446
36641
|
exports.createZip = createZip;
|
35447
36642
|
async function getLambdaOptionsFromFunction({ sourceFile, config, }) {
|
35448
|
-
if (config
|
36643
|
+
if (config?.functions) {
|
35449
36644
|
for (const [pattern, fn] of Object.entries(config.functions)) {
|
35450
36645
|
if (sourceFile === pattern || minimatch_1.default(sourceFile, pattern)) {
|
35451
36646
|
return {
|
@@ -35683,6 +36878,76 @@ function hasProp(obj, key) {
|
|
35683
36878
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
35684
36879
|
|
35685
36880
|
|
36881
|
+
/***/ }),
|
36882
|
+
|
36883
|
+
/***/ 1953:
|
36884
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
36885
|
+
|
36886
|
+
"use strict";
|
36887
|
+
|
36888
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
36889
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
36890
|
+
};
|
36891
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
36892
|
+
exports.getWorkspacePackagePaths = void 0;
|
36893
|
+
const path_1 = __importDefault(__webpack_require__(5622));
|
36894
|
+
const js_yaml_1 = __importDefault(__webpack_require__(6540));
|
36895
|
+
const glob_1 = __importDefault(__webpack_require__(1104));
|
36896
|
+
const get_glob_fs_1 = __webpack_require__(5706);
|
36897
|
+
const normalize_path_1 = __webpack_require__(6261);
|
36898
|
+
const posixPath = path_1.default.posix;
|
36899
|
+
async function getWorkspacePackagePaths({ fs, workspace, }) {
|
36900
|
+
const { type, rootPath } = workspace;
|
36901
|
+
const workspaceFs = fs.chdir(rootPath);
|
36902
|
+
let results = [];
|
36903
|
+
switch (type) {
|
36904
|
+
case 'yarn':
|
36905
|
+
case 'npm':
|
36906
|
+
results = await getPackageJsonWorkspacePackagePaths({ fs: workspaceFs });
|
36907
|
+
break;
|
36908
|
+
case 'pnpm':
|
36909
|
+
results = await getPnpmWorkspacePackagePaths({ fs: workspaceFs });
|
36910
|
+
break;
|
36911
|
+
default:
|
36912
|
+
throw new Error(`Unknown workspace implementation: ${type}`);
|
36913
|
+
}
|
36914
|
+
return results.map(packagePath => {
|
36915
|
+
return posixPath.join(rootPath, posixPath.dirname(packagePath));
|
36916
|
+
});
|
36917
|
+
}
|
36918
|
+
exports.getWorkspacePackagePaths = getWorkspacePackagePaths;
|
36919
|
+
async function getPackagePaths(packages, fs) {
|
36920
|
+
return (await Promise.all(packages.map(packageGlob => new Promise((resolve, reject) => {
|
36921
|
+
glob_1.default(normalize_path_1.normalizePath(posixPath.join(packageGlob, 'package.json')), {
|
36922
|
+
cwd: '/',
|
36923
|
+
fs: get_glob_fs_1.getGlobFs(fs),
|
36924
|
+
}, (err, matches) => {
|
36925
|
+
if (err)
|
36926
|
+
reject(err);
|
36927
|
+
else
|
36928
|
+
resolve(matches);
|
36929
|
+
});
|
36930
|
+
})))).flat();
|
36931
|
+
}
|
36932
|
+
async function getPackageJsonWorkspacePackagePaths({ fs, }) {
|
36933
|
+
const packageJsonAsBuffer = await fs.readFile('package.json');
|
36934
|
+
const { workspaces } = JSON.parse(packageJsonAsBuffer.toString());
|
36935
|
+
let packages = [];
|
36936
|
+
if (Array.isArray(workspaces)) {
|
36937
|
+
packages = workspaces;
|
36938
|
+
}
|
36939
|
+
else {
|
36940
|
+
packages = workspaces?.packages ?? [];
|
36941
|
+
}
|
36942
|
+
return getPackagePaths(packages, fs);
|
36943
|
+
}
|
36944
|
+
async function getPnpmWorkspacePackagePaths({ fs, }) {
|
36945
|
+
const pnpmWorkspaceAsBuffer = await fs.readFile('pnpm-workspace.yaml');
|
36946
|
+
const { packages = [] } = js_yaml_1.default.load(pnpmWorkspaceAsBuffer.toString());
|
36947
|
+
return getPackagePaths(packages, fs);
|
36948
|
+
}
|
36949
|
+
|
36950
|
+
|
35686
36951
|
/***/ }),
|
35687
36952
|
|
35688
36953
|
/***/ 9740:
|