@socketsecurity/cli-with-sentry 1.0.69 → 1.0.70
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/cli.js +161 -111
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -0
- package/dist/types/commands/fix/agent-fix.d.mts +3 -0
- package/dist/types/commands/fix/agent-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/coana-fix.d.mts +6 -0
- package/dist/types/commands/fix/coana-fix.d.mts.map +1 -0
- package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/npm-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/pnpm-fix.d.mts.map +1 -1
- package/dist/utils.js +79 -79
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +2835 -493
- package/external/@coana-tech/cli/cli.mjs +657 -586
- package/external/@socketsecurity/registry/external/@socketregistry/packageurl-js.js +1 -1
- package/external/@socketsecurity/registry/external/cacache.js +1976 -295
- package/external/@socketsecurity/registry/external/libnpmpack.js +83273 -78270
- package/external/@socketsecurity/registry/external/npm-package-arg.js +58 -1
- package/external/@socketsecurity/registry/external/pacote.js +15839 -3934
- package/external/@socketsecurity/registry/manifest.json +14 -14
- package/package.json +10 -10
package/dist/vendor.js
CHANGED
|
@@ -2301,11 +2301,11 @@ var validateNpmPackageLicense$1 = function (argument) {
|
|
|
2301
2301
|
};
|
|
2302
2302
|
}
|
|
2303
2303
|
};
|
|
2304
|
-
var commonjs$
|
|
2305
|
-
Object.defineProperty(commonjs$
|
|
2304
|
+
var commonjs$j = {};
|
|
2305
|
+
Object.defineProperty(commonjs$j, "__esModule", {
|
|
2306
2306
|
value: true
|
|
2307
2307
|
});
|
|
2308
|
-
commonjs$
|
|
2308
|
+
commonjs$j.LRUCache = void 0;
|
|
2309
2309
|
const perf = typeof performance === 'object' && performance && typeof performance.now === 'function' ? performance : Date;
|
|
2310
2310
|
const warned = new Set();
|
|
2311
2311
|
const PROCESS = typeof process === 'object' && !!process ? process : {};
|
|
@@ -3411,7 +3411,7 @@ let LRUCache$1 = class LRUCache {
|
|
|
3411
3411
|
}
|
|
3412
3412
|
}
|
|
3413
3413
|
};
|
|
3414
|
-
commonjs$
|
|
3414
|
+
commonjs$j.LRUCache = LRUCache$1;
|
|
3415
3415
|
const maybeJoin = (...args) => args.every(arg => arg) ? args.join('') : '';
|
|
3416
3416
|
const maybeEncode = arg => arg ? encodeURIComponent(arg) : '';
|
|
3417
3417
|
const formatHashFragment = f => f.toLowerCase().replace(/^\W+|\/|\W+$/g, '').replace(/\W+/g, '-');
|
|
@@ -3781,7 +3781,7 @@ hosts$1.sourcehut = {
|
|
|
3781
3781
|
for (const [name, host] of Object.entries(hosts$1)) {
|
|
3782
3782
|
hosts$1[name] = Object.assign({}, defaults$2, host);
|
|
3783
3783
|
}
|
|
3784
|
-
var hosts_1$
|
|
3784
|
+
var hosts_1$2 = hosts$1;
|
|
3785
3785
|
const url$2 = require$$0$7;
|
|
3786
3786
|
const lastIndexOfBefore = (str, char, beforeChar) => {
|
|
3787
3787
|
const startPosition = str.indexOf(beforeChar);
|
|
@@ -3823,11 +3823,11 @@ const correctUrl = giturl => {
|
|
|
3823
3823
|
}
|
|
3824
3824
|
return giturl;
|
|
3825
3825
|
};
|
|
3826
|
-
var parseUrl$2 = (giturl, protocols) => {
|
|
3826
|
+
var parseUrl$2$1 = (giturl, protocols) => {
|
|
3827
3827
|
const withProtocol = protocols ? correctProtocol(giturl, protocols) : giturl;
|
|
3828
3828
|
return safeUrl(withProtocol) || safeUrl(correctUrl(withProtocol));
|
|
3829
3829
|
};
|
|
3830
|
-
const parseUrl$1$1 = parseUrl$2;
|
|
3830
|
+
const parseUrl$1$1 = parseUrl$2$1;
|
|
3831
3831
|
const isGitHubShorthand = arg => {
|
|
3832
3832
|
const firstHash = arg.indexOf('#');
|
|
3833
3833
|
const firstSlash = arg.indexOf('/');
|
|
@@ -3844,7 +3844,7 @@ const isGitHubShorthand = arg => {
|
|
|
3844
3844
|
const doesNotStartWithDot = !arg.startsWith('.');
|
|
3845
3845
|
return spaceOnlyAfterHash && hasSlash && doesNotEndWithSlash && doesNotStartWithDot && atOnlyAfterHash && colonOnlyAfterHash && secondSlashOnlyAfterHash;
|
|
3846
3846
|
};
|
|
3847
|
-
var fromUrl$1 = (giturl, opts, {
|
|
3847
|
+
var fromUrl$1$1 = (giturl, opts, {
|
|
3848
3848
|
gitHosts,
|
|
3849
3849
|
protocols
|
|
3850
3850
|
}) => {
|
|
@@ -3919,10 +3919,10 @@ var fromUrl$1 = (giturl, opts, {
|
|
|
3919
3919
|
};
|
|
3920
3920
|
const {
|
|
3921
3921
|
LRUCache
|
|
3922
|
-
} = commonjs$
|
|
3923
|
-
const hosts = hosts_1$
|
|
3924
|
-
const fromUrl$2 = fromUrl$1;
|
|
3925
|
-
const parseUrl$3 = parseUrl$2;
|
|
3922
|
+
} = commonjs$j;
|
|
3923
|
+
const hosts = hosts_1$2;
|
|
3924
|
+
const fromUrl$2 = fromUrl$1$1;
|
|
3925
|
+
const parseUrl$3 = parseUrl$2$1;
|
|
3926
3926
|
const cache$1 = new LRUCache({
|
|
3927
3927
|
max: 1000
|
|
3928
3928
|
});
|
|
@@ -5084,7 +5084,7 @@ jsTokens.matchToToken = function (match) {
|
|
|
5084
5084
|
if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace";
|
|
5085
5085
|
return token;
|
|
5086
5086
|
};
|
|
5087
|
-
var lib$
|
|
5087
|
+
var lib$J = {};
|
|
5088
5088
|
var identifier = {};
|
|
5089
5089
|
Object.defineProperty(identifier, "__esModule", {
|
|
5090
5090
|
value: true
|
|
@@ -5238,7 +5238,7 @@ function isKeyword(word) {
|
|
|
5238
5238
|
});
|
|
5239
5239
|
var _identifier = identifier;
|
|
5240
5240
|
var _keyword = keyword$1;
|
|
5241
|
-
})(lib$
|
|
5241
|
+
})(lib$J);
|
|
5242
5242
|
var chalk$1 = {
|
|
5243
5243
|
exports: {}
|
|
5244
5244
|
};
|
|
@@ -6764,7 +6764,7 @@ Object.defineProperty(lib$1$1, "__esModule", {
|
|
|
6764
6764
|
lib$1$1.default = highlight;
|
|
6765
6765
|
lib$1$1.shouldHighlight = shouldHighlight;
|
|
6766
6766
|
var _jsTokens = jsTokens;
|
|
6767
|
-
var _helperValidatorIdentifier = lib$
|
|
6767
|
+
var _helperValidatorIdentifier = lib$J;
|
|
6768
6768
|
var _chalk$1 = _interopRequireWildcard$1(chalkExports$1, true);
|
|
6769
6769
|
function _getRequireWildcardCache$1(e) {
|
|
6770
6770
|
if ("function" != typeof WeakMap) return null;
|
|
@@ -35519,7 +35519,7 @@ var isInteractiveExports = /*@__PURE__*/ requireIsInteractive();
|
|
|
35519
35519
|
var dist$e = {};
|
|
35520
35520
|
|
|
35521
35521
|
var name$2 = "@socketsecurity/sdk";
|
|
35522
|
-
var version$5 = "1.4.
|
|
35522
|
+
var version$5 = "1.4.65";
|
|
35523
35523
|
var license = "MIT";
|
|
35524
35524
|
var description = "SDK for the Socket API client";
|
|
35525
35525
|
var author = {
|
|
@@ -35602,7 +35602,7 @@ var scripts = {
|
|
|
35602
35602
|
"update:deps": "npx --yes npm-check-updates"
|
|
35603
35603
|
};
|
|
35604
35604
|
var dependencies = {
|
|
35605
|
-
"@socketsecurity/registry": "1.0.
|
|
35605
|
+
"@socketsecurity/registry": "1.0.245"
|
|
35606
35606
|
};
|
|
35607
35607
|
var devDependencies = {
|
|
35608
35608
|
"@biomejs/biome": "2.1.2",
|
|
@@ -41646,11 +41646,11 @@ function requireCjs$1() {
|
|
|
41646
41646
|
return cjs$1;
|
|
41647
41647
|
}
|
|
41648
41648
|
|
|
41649
|
-
var lib$
|
|
41650
|
-
var hasRequiredLib$
|
|
41651
|
-
function requireLib$
|
|
41652
|
-
if (hasRequiredLib$
|
|
41653
|
-
hasRequiredLib$
|
|
41649
|
+
var lib$I;
|
|
41650
|
+
var hasRequiredLib$I;
|
|
41651
|
+
function requireLib$I() {
|
|
41652
|
+
if (hasRequiredLib$I) return lib$I;
|
|
41653
|
+
hasRequiredLib$I = 1;
|
|
41654
41654
|
const {
|
|
41655
41655
|
isexe,
|
|
41656
41656
|
sync: isexeSync
|
|
@@ -41768,12 +41768,12 @@ function requireLib$H() {
|
|
|
41768
41768
|
}
|
|
41769
41769
|
throw getNotFoundError(cmd);
|
|
41770
41770
|
};
|
|
41771
|
-
lib$
|
|
41771
|
+
lib$I = which;
|
|
41772
41772
|
which.sync = whichSync;
|
|
41773
|
-
return lib$
|
|
41773
|
+
return lib$I;
|
|
41774
41774
|
}
|
|
41775
41775
|
|
|
41776
|
-
var libExports$2 = requireLib$
|
|
41776
|
+
var libExports$2 = requireLib$I();
|
|
41777
41777
|
|
|
41778
41778
|
var error$a;
|
|
41779
41779
|
var hasRequiredError$a;
|
|
@@ -49055,7 +49055,7 @@ function getValues(context, operator, key, modifier) {
|
|
|
49055
49055
|
}
|
|
49056
49056
|
return result;
|
|
49057
49057
|
}
|
|
49058
|
-
function parseUrl$
|
|
49058
|
+
function parseUrl$2(template) {
|
|
49059
49059
|
return {
|
|
49060
49060
|
expand: expand.bind(null, template)
|
|
49061
49061
|
};
|
|
@@ -49104,7 +49104,7 @@ function parse$4(options) {
|
|
|
49104
49104
|
let body;
|
|
49105
49105
|
let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]);
|
|
49106
49106
|
const urlVariableNames = extractUrlVariableNames(url);
|
|
49107
|
-
url = parseUrl$
|
|
49107
|
+
url = parseUrl$2(url).expand(parameters);
|
|
49108
49108
|
if (!/^http/.test(url)) {
|
|
49109
49109
|
url = options.baseUrl + url;
|
|
49110
49110
|
}
|
|
@@ -51336,19 +51336,19 @@ const Octokit = Octokit$1.plugin(requestLog, legacyRestEndpointMethods, paginate
|
|
|
51336
51336
|
|
|
51337
51337
|
var npa = {exports: {}};
|
|
51338
51338
|
|
|
51339
|
-
var commonjs$
|
|
51339
|
+
var commonjs$i = {};
|
|
51340
51340
|
|
|
51341
|
-
var hasRequiredCommonjs$
|
|
51342
|
-
function requireCommonjs$
|
|
51343
|
-
if (hasRequiredCommonjs$
|
|
51344
|
-
hasRequiredCommonjs$
|
|
51341
|
+
var hasRequiredCommonjs$i;
|
|
51342
|
+
function requireCommonjs$i() {
|
|
51343
|
+
if (hasRequiredCommonjs$i) return commonjs$i;
|
|
51344
|
+
hasRequiredCommonjs$i = 1;
|
|
51345
51345
|
/**
|
|
51346
51346
|
* @module LRUCache
|
|
51347
51347
|
*/
|
|
51348
|
-
Object.defineProperty(commonjs$
|
|
51348
|
+
Object.defineProperty(commonjs$i, "__esModule", {
|
|
51349
51349
|
value: true
|
|
51350
51350
|
});
|
|
51351
|
-
commonjs$
|
|
51351
|
+
commonjs$i.LRUCache = void 0;
|
|
51352
51352
|
const perf = typeof performance === 'object' && performance && typeof performance.now === 'function' ? performance : Date;
|
|
51353
51353
|
const warned = new Set();
|
|
51354
51354
|
/* c8 ignore start */
|
|
@@ -51466,6 +51466,7 @@ function requireCommonjs$h() {
|
|
|
51466
51466
|
#max;
|
|
51467
51467
|
#maxSize;
|
|
51468
51468
|
#dispose;
|
|
51469
|
+
#onInsert;
|
|
51469
51470
|
#disposeAfter;
|
|
51470
51471
|
#fetchMethod;
|
|
51471
51472
|
#memoMethod;
|
|
@@ -51547,6 +51548,7 @@ function requireCommonjs$h() {
|
|
|
51547
51548
|
#hasDispose;
|
|
51548
51549
|
#hasFetchMethod;
|
|
51549
51550
|
#hasDisposeAfter;
|
|
51551
|
+
#hasOnInsert;
|
|
51550
51552
|
/**
|
|
51551
51553
|
* Do not call this method unless you need to inspect the
|
|
51552
51554
|
* inner workings of the cache. If anything returned by this
|
|
@@ -51623,6 +51625,12 @@ function requireCommonjs$h() {
|
|
|
51623
51625
|
get dispose() {
|
|
51624
51626
|
return this.#dispose;
|
|
51625
51627
|
}
|
|
51628
|
+
/**
|
|
51629
|
+
* {@link LRUCache.OptionsBase.onInsert} (read-only)
|
|
51630
|
+
*/
|
|
51631
|
+
get onInsert() {
|
|
51632
|
+
return this.#onInsert;
|
|
51633
|
+
}
|
|
51626
51634
|
/**
|
|
51627
51635
|
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
|
51628
51636
|
*/
|
|
@@ -51639,6 +51647,7 @@ function requireCommonjs$h() {
|
|
|
51639
51647
|
updateAgeOnHas,
|
|
51640
51648
|
allowStale,
|
|
51641
51649
|
dispose,
|
|
51650
|
+
onInsert,
|
|
51642
51651
|
disposeAfter,
|
|
51643
51652
|
noDisposeOnSet,
|
|
51644
51653
|
noUpdateTTL,
|
|
@@ -51694,6 +51703,9 @@ function requireCommonjs$h() {
|
|
|
51694
51703
|
if (typeof dispose === 'function') {
|
|
51695
51704
|
this.#dispose = dispose;
|
|
51696
51705
|
}
|
|
51706
|
+
if (typeof onInsert === 'function') {
|
|
51707
|
+
this.#onInsert = onInsert;
|
|
51708
|
+
}
|
|
51697
51709
|
if (typeof disposeAfter === 'function') {
|
|
51698
51710
|
this.#disposeAfter = disposeAfter;
|
|
51699
51711
|
this.#disposed = [];
|
|
@@ -51702,6 +51714,7 @@ function requireCommonjs$h() {
|
|
|
51702
51714
|
this.#disposed = undefined;
|
|
51703
51715
|
}
|
|
51704
51716
|
this.#hasDispose = !!this.#dispose;
|
|
51717
|
+
this.#hasOnInsert = !!this.#onInsert;
|
|
51705
51718
|
this.#hasDisposeAfter = !!this.#disposeAfter;
|
|
51706
51719
|
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
51707
51720
|
this.noUpdateTTL = !!noUpdateTTL;
|
|
@@ -52114,7 +52127,7 @@ function requireCommonjs$h() {
|
|
|
52114
52127
|
}
|
|
52115
52128
|
/**
|
|
52116
52129
|
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
|
52117
|
-
* passed to {@link
|
|
52130
|
+
* passed to {@link LRUCache#load}.
|
|
52118
52131
|
*
|
|
52119
52132
|
* The `start` fields are calculated relative to a portable `Date.now()`
|
|
52120
52133
|
* timestamp, even if `performance.now()` is available.
|
|
@@ -52247,6 +52260,9 @@ function requireCommonjs$h() {
|
|
|
52247
52260
|
this.#addItemSize(index, size, status);
|
|
52248
52261
|
if (status) status.set = 'add';
|
|
52249
52262
|
noUpdateTTL = false;
|
|
52263
|
+
if (this.#hasOnInsert) {
|
|
52264
|
+
this.#onInsert?.(v, k, 'add');
|
|
52265
|
+
}
|
|
52250
52266
|
} else {
|
|
52251
52267
|
// update
|
|
52252
52268
|
this.#moveToTail(index);
|
|
@@ -52284,6 +52300,9 @@ function requireCommonjs$h() {
|
|
|
52284
52300
|
} else if (status) {
|
|
52285
52301
|
status.set = 'update';
|
|
52286
52302
|
}
|
|
52303
|
+
if (this.#hasOnInsert) {
|
|
52304
|
+
this.onInsert?.(v, k, v === oldVal ? 'update' : 'replace');
|
|
52305
|
+
}
|
|
52287
52306
|
}
|
|
52288
52307
|
if (ttl !== 0 && !this.#ttls) {
|
|
52289
52308
|
this.#initializeTTLTracking();
|
|
@@ -52846,16 +52865,16 @@ function requireCommonjs$h() {
|
|
|
52846
52865
|
}
|
|
52847
52866
|
}
|
|
52848
52867
|
}
|
|
52849
|
-
commonjs$
|
|
52850
|
-
return commonjs$
|
|
52868
|
+
commonjs$i.LRUCache = LRUCache;
|
|
52869
|
+
return commonjs$i;
|
|
52851
52870
|
}
|
|
52852
52871
|
|
|
52853
52872
|
/* eslint-disable max-len */
|
|
52854
|
-
var hosts_1;
|
|
52855
|
-
var hasRequiredHosts;
|
|
52856
|
-
function requireHosts() {
|
|
52857
|
-
if (hasRequiredHosts) return hosts_1;
|
|
52858
|
-
hasRequiredHosts = 1;
|
|
52873
|
+
var hosts_1$1;
|
|
52874
|
+
var hasRequiredHosts$1;
|
|
52875
|
+
function requireHosts$1() {
|
|
52876
|
+
if (hasRequiredHosts$1) return hosts_1$1;
|
|
52877
|
+
hasRequiredHosts$1 = 1;
|
|
52859
52878
|
const maybeJoin = (...args) => args.every(arg => arg) ? args.join('') : '';
|
|
52860
52879
|
const maybeEncode = arg => arg ? encodeURIComponent(arg) : '';
|
|
52861
52880
|
const formatHashFragment = f => f.toLowerCase().replace(/^\W+/g, '') // strip leading non-characters
|
|
@@ -53230,15 +53249,15 @@ function requireHosts() {
|
|
|
53230
53249
|
for (const [name, host] of Object.entries(hosts)) {
|
|
53231
53250
|
hosts[name] = Object.assign({}, defaults, host);
|
|
53232
53251
|
}
|
|
53233
|
-
hosts_1 = hosts;
|
|
53234
|
-
return hosts_1;
|
|
53252
|
+
hosts_1$1 = hosts;
|
|
53253
|
+
return hosts_1$1;
|
|
53235
53254
|
}
|
|
53236
53255
|
|
|
53237
|
-
var parseUrl;
|
|
53238
|
-
var hasRequiredParseUrl;
|
|
53239
|
-
function requireParseUrl() {
|
|
53240
|
-
if (hasRequiredParseUrl) return parseUrl;
|
|
53241
|
-
hasRequiredParseUrl = 1;
|
|
53256
|
+
var parseUrl$1;
|
|
53257
|
+
var hasRequiredParseUrl$1;
|
|
53258
|
+
function requireParseUrl$1() {
|
|
53259
|
+
if (hasRequiredParseUrl$1) return parseUrl$1;
|
|
53260
|
+
hasRequiredParseUrl$1 = 1;
|
|
53242
53261
|
const url = require$$0$e;
|
|
53243
53262
|
const lastIndexOfBefore = (str, char, beforeChar) => {
|
|
53244
53263
|
const startPosition = str.indexOf(beforeChar);
|
|
@@ -53304,19 +53323,19 @@ function requireParseUrl() {
|
|
|
53304
53323
|
}
|
|
53305
53324
|
return giturl;
|
|
53306
53325
|
};
|
|
53307
|
-
parseUrl = (giturl, protocols) => {
|
|
53326
|
+
parseUrl$1 = (giturl, protocols) => {
|
|
53308
53327
|
const withProtocol = protocols ? correctProtocol(giturl, protocols) : giturl;
|
|
53309
53328
|
return safeUrl(withProtocol) || safeUrl(correctUrl(withProtocol));
|
|
53310
53329
|
};
|
|
53311
|
-
return parseUrl;
|
|
53330
|
+
return parseUrl$1;
|
|
53312
53331
|
}
|
|
53313
53332
|
|
|
53314
|
-
var fromUrl;
|
|
53315
|
-
var hasRequiredFromUrl;
|
|
53316
|
-
function requireFromUrl() {
|
|
53317
|
-
if (hasRequiredFromUrl) return fromUrl;
|
|
53318
|
-
hasRequiredFromUrl = 1;
|
|
53319
|
-
const parseUrl = requireParseUrl();
|
|
53333
|
+
var fromUrl$1;
|
|
53334
|
+
var hasRequiredFromUrl$1;
|
|
53335
|
+
function requireFromUrl$1() {
|
|
53336
|
+
if (hasRequiredFromUrl$1) return fromUrl$1;
|
|
53337
|
+
hasRequiredFromUrl$1 = 1;
|
|
53338
|
+
const parseUrl = requireParseUrl$1();
|
|
53320
53339
|
|
|
53321
53340
|
// look for github shorthand inputs, such as npm/cli
|
|
53322
53341
|
const isGitHubShorthand = arg => {
|
|
@@ -53344,7 +53363,7 @@ function requireFromUrl() {
|
|
|
53344
53363
|
const doesNotStartWithDot = !arg.startsWith('.');
|
|
53345
53364
|
return spaceOnlyAfterHash && hasSlash && doesNotEndWithSlash && doesNotStartWithDot && atOnlyAfterHash && colonOnlyAfterHash && secondSlashOnlyAfterHash;
|
|
53346
53365
|
};
|
|
53347
|
-
fromUrl = (giturl, opts, {
|
|
53366
|
+
fromUrl$1 = (giturl, opts, {
|
|
53348
53367
|
gitHosts,
|
|
53349
53368
|
protocols
|
|
53350
53369
|
}) => {
|
|
@@ -53420,20 +53439,20 @@ function requireFromUrl() {
|
|
|
53420
53439
|
}
|
|
53421
53440
|
return [gitHostName, user, auth, project, committish, defaultRepresentation, opts];
|
|
53422
53441
|
};
|
|
53423
|
-
return fromUrl;
|
|
53442
|
+
return fromUrl$1;
|
|
53424
53443
|
}
|
|
53425
53444
|
|
|
53426
|
-
var lib$
|
|
53427
|
-
var hasRequiredLib$
|
|
53428
|
-
function requireLib$
|
|
53429
|
-
if (hasRequiredLib$
|
|
53430
|
-
hasRequiredLib$
|
|
53445
|
+
var lib$H;
|
|
53446
|
+
var hasRequiredLib$H;
|
|
53447
|
+
function requireLib$H() {
|
|
53448
|
+
if (hasRequiredLib$H) return lib$H;
|
|
53449
|
+
hasRequiredLib$H = 1;
|
|
53431
53450
|
const {
|
|
53432
53451
|
LRUCache
|
|
53433
|
-
} = /*@__PURE__*/requireCommonjs$
|
|
53434
|
-
const hosts = requireHosts();
|
|
53435
|
-
const fromUrl = requireFromUrl();
|
|
53436
|
-
const parseUrl = requireParseUrl();
|
|
53452
|
+
} = /*@__PURE__*/requireCommonjs$i();
|
|
53453
|
+
const hosts = requireHosts$1();
|
|
53454
|
+
const fromUrl = requireFromUrl$1();
|
|
53455
|
+
const parseUrl = requireParseUrl$1();
|
|
53437
53456
|
const cache = new LRUCache({
|
|
53438
53457
|
max: 1000
|
|
53439
53458
|
});
|
|
@@ -53656,20 +53675,20 @@ function requireLib$G() {
|
|
|
53656
53675
|
for (const [name, host] of Object.entries(hosts)) {
|
|
53657
53676
|
GitHost.addHost(name, host);
|
|
53658
53677
|
}
|
|
53659
|
-
lib$
|
|
53660
|
-
return lib$
|
|
53678
|
+
lib$H = GitHost;
|
|
53679
|
+
return lib$H;
|
|
53661
53680
|
}
|
|
53662
53681
|
|
|
53663
|
-
var lib$
|
|
53664
|
-
var hasRequiredLib$
|
|
53665
|
-
function requireLib$
|
|
53666
|
-
if (hasRequiredLib$
|
|
53667
|
-
hasRequiredLib$
|
|
53682
|
+
var lib$G;
|
|
53683
|
+
var hasRequiredLib$G;
|
|
53684
|
+
function requireLib$G() {
|
|
53685
|
+
if (hasRequiredLib$G) return lib$G;
|
|
53686
|
+
hasRequiredLib$G = 1;
|
|
53668
53687
|
const {
|
|
53669
53688
|
builtinModules: builtins
|
|
53670
53689
|
} = require$$0$l;
|
|
53671
53690
|
var scopedPackagePattern = new RegExp('^(?:@([^/]+?)[/])?([^/]+?)$');
|
|
53672
|
-
var
|
|
53691
|
+
var exclusionList = ['node_modules', 'favicon.ico'];
|
|
53673
53692
|
function validate(name) {
|
|
53674
53693
|
var warnings = [];
|
|
53675
53694
|
var errors = [];
|
|
@@ -53699,9 +53718,9 @@ function requireLib$F() {
|
|
|
53699
53718
|
}
|
|
53700
53719
|
|
|
53701
53720
|
// No funny business
|
|
53702
|
-
|
|
53703
|
-
if (name.toLowerCase() ===
|
|
53704
|
-
errors.push(
|
|
53721
|
+
exclusionList.forEach(function (excludedName) {
|
|
53722
|
+
if (name.toLowerCase() === excludedName) {
|
|
53723
|
+
errors.push(excludedName + ' is not a valid package name');
|
|
53705
53724
|
}
|
|
53706
53725
|
});
|
|
53707
53726
|
|
|
@@ -53754,17 +53773,17 @@ function requireLib$F() {
|
|
|
53754
53773
|
}
|
|
53755
53774
|
return result;
|
|
53756
53775
|
};
|
|
53757
|
-
lib$
|
|
53758
|
-
return lib$
|
|
53776
|
+
lib$G = validate;
|
|
53777
|
+
return lib$G;
|
|
53759
53778
|
}
|
|
53760
53779
|
|
|
53761
|
-
var lib$
|
|
53762
|
-
var hasRequiredLib$
|
|
53763
|
-
function requireLib$
|
|
53764
|
-
if (hasRequiredLib$
|
|
53765
|
-
hasRequiredLib$
|
|
53780
|
+
var lib$F;
|
|
53781
|
+
var hasRequiredLib$F;
|
|
53782
|
+
function requireLib$F() {
|
|
53783
|
+
if (hasRequiredLib$F) return lib$F;
|
|
53784
|
+
hasRequiredLib$F = 1;
|
|
53766
53785
|
const META = Symbol('proc-log.meta');
|
|
53767
|
-
lib$
|
|
53786
|
+
lib$F = {
|
|
53768
53787
|
META: META,
|
|
53769
53788
|
output: {
|
|
53770
53789
|
LEVELS: ['standard', 'error', 'buffer', 'flush'],
|
|
@@ -53893,7 +53912,7 @@ function requireLib$E() {
|
|
|
53893
53912
|
}
|
|
53894
53913
|
}
|
|
53895
53914
|
};
|
|
53896
|
-
return lib$
|
|
53915
|
+
return lib$F;
|
|
53897
53916
|
}
|
|
53898
53917
|
|
|
53899
53918
|
var hasRequiredNpa;
|
|
@@ -53909,12 +53928,12 @@ function requireNpa() {
|
|
|
53909
53928
|
const {
|
|
53910
53929
|
homedir
|
|
53911
53930
|
} = os$3;
|
|
53912
|
-
const HostedGit = requireLib$
|
|
53931
|
+
const HostedGit = requireLib$H();
|
|
53913
53932
|
const semver = requireSemver();
|
|
53914
|
-
const validatePackageName = requireLib$
|
|
53933
|
+
const validatePackageName = requireLib$G();
|
|
53915
53934
|
const {
|
|
53916
53935
|
log
|
|
53917
|
-
} = requireLib$
|
|
53936
|
+
} = requireLib$F();
|
|
53918
53937
|
const hasSlashes = isWindows ? /\\|[/]/ : /[/]/;
|
|
53919
53938
|
const isURL = /^(?:git[+])?[a-z]+:/i;
|
|
53920
53939
|
const isGit = /^[^@]+@[^:.]+\.[^:]+:.+$/i;
|
|
@@ -54529,7 +54548,7 @@ function requireOverrideSet() {
|
|
|
54529
54548
|
const semver = requireSemver();
|
|
54530
54549
|
const {
|
|
54531
54550
|
log
|
|
54532
|
-
} = requireLib$
|
|
54551
|
+
} = requireLib$F();
|
|
54533
54552
|
class OverrideSet {
|
|
54534
54553
|
constructor({
|
|
54535
54554
|
overrides,
|
|
@@ -55037,18 +55056,18 @@ function requireEdge() {
|
|
|
55037
55056
|
|
|
55038
55057
|
var edgeExports = requireEdge();
|
|
55039
55058
|
|
|
55040
|
-
var lib$
|
|
55041
|
-
var hasRequiredLib$
|
|
55042
|
-
function requireLib$
|
|
55043
|
-
if (hasRequiredLib$
|
|
55044
|
-
hasRequiredLib$
|
|
55059
|
+
var lib$E;
|
|
55060
|
+
var hasRequiredLib$E;
|
|
55061
|
+
function requireLib$E() {
|
|
55062
|
+
if (hasRequiredLib$E) return lib$E;
|
|
55063
|
+
hasRequiredLib$E = 1;
|
|
55045
55064
|
const {
|
|
55046
55065
|
basename,
|
|
55047
55066
|
dirname
|
|
55048
55067
|
} = require$$0$d;
|
|
55049
55068
|
const getName = (parent, base) => parent.charAt(0) === '@' ? `${parent}/${base}` : base;
|
|
55050
|
-
lib$
|
|
55051
|
-
return lib$
|
|
55069
|
+
lib$E = dir => dir ? getName(basename(dirname(dir)), basename(dir)) : false;
|
|
55070
|
+
return lib$E;
|
|
55052
55071
|
}
|
|
55053
55072
|
|
|
55054
55073
|
var debug$1 = {exports: {}};
|
|
@@ -55227,11 +55246,11 @@ function requireInventory() {
|
|
|
55227
55246
|
return inventory;
|
|
55228
55247
|
}
|
|
55229
55248
|
|
|
55230
|
-
var lib$
|
|
55231
|
-
var hasRequiredLib$
|
|
55232
|
-
function requireLib$
|
|
55233
|
-
if (hasRequiredLib$
|
|
55234
|
-
hasRequiredLib$
|
|
55249
|
+
var lib$D;
|
|
55250
|
+
var hasRequiredLib$D;
|
|
55251
|
+
function requireLib$D() {
|
|
55252
|
+
if (hasRequiredLib$D) return lib$D;
|
|
55253
|
+
hasRequiredLib$D = 1;
|
|
55235
55254
|
const INDENT = Symbol.for('indent');
|
|
55236
55255
|
const NEWLINE = Symbol.for('newline');
|
|
55237
55256
|
const DEFAULT_NEWLINE = '\n';
|
|
@@ -55331,7 +55350,7 @@ function requireLib$C() {
|
|
|
55331
55350
|
throw new JSONParseError(e, txt, context, parseJsonError);
|
|
55332
55351
|
}
|
|
55333
55352
|
};
|
|
55334
|
-
lib$
|
|
55353
|
+
lib$D = parseJsonError;
|
|
55335
55354
|
parseJsonError.JSONParseError = JSONParseError;
|
|
55336
55355
|
parseJsonError.noExceptions = (raw, reviver) => {
|
|
55337
55356
|
try {
|
|
@@ -55340,14 +55359,14 @@ function requireLib$C() {
|
|
|
55340
55359
|
// no exceptions
|
|
55341
55360
|
}
|
|
55342
55361
|
};
|
|
55343
|
-
return lib$
|
|
55362
|
+
return lib$D;
|
|
55344
55363
|
}
|
|
55345
55364
|
|
|
55346
|
-
var lib$
|
|
55347
|
-
var hasRequiredLib$
|
|
55348
|
-
function requireLib$
|
|
55349
|
-
if (hasRequiredLib$
|
|
55350
|
-
hasRequiredLib$
|
|
55365
|
+
var lib$C;
|
|
55366
|
+
var hasRequiredLib$C;
|
|
55367
|
+
function requireLib$C() {
|
|
55368
|
+
if (hasRequiredLib$C) return lib$C;
|
|
55369
|
+
hasRequiredLib$C = 1;
|
|
55351
55370
|
// pass in a manifest with a 'bin' field here, and it'll turn it
|
|
55352
55371
|
// into a properly santized bin object
|
|
55353
55372
|
const {
|
|
@@ -55398,22 +55417,22 @@ function requireLib$B() {
|
|
|
55398
55417
|
}
|
|
55399
55418
|
return pkg;
|
|
55400
55419
|
};
|
|
55401
|
-
lib$
|
|
55402
|
-
return lib$
|
|
55420
|
+
lib$C = normalize;
|
|
55421
|
+
return lib$C;
|
|
55403
55422
|
}
|
|
55404
55423
|
|
|
55405
|
-
var lib$
|
|
55406
|
-
var hasRequiredLib$
|
|
55407
|
-
function requireLib$
|
|
55408
|
-
if (hasRequiredLib$
|
|
55409
|
-
hasRequiredLib$
|
|
55424
|
+
var lib$B;
|
|
55425
|
+
var hasRequiredLib$B;
|
|
55426
|
+
function requireLib$B() {
|
|
55427
|
+
if (hasRequiredLib$B) return lib$B;
|
|
55428
|
+
hasRequiredLib$B = 1;
|
|
55410
55429
|
const {
|
|
55411
55430
|
readFile,
|
|
55412
55431
|
lstat,
|
|
55413
55432
|
readdir
|
|
55414
55433
|
} = require$$0$k;
|
|
55415
|
-
const parse = requireLib$
|
|
55416
|
-
const normalizePackageBin = requireLib$
|
|
55434
|
+
const parse = requireLib$D();
|
|
55435
|
+
const normalizePackageBin = requireLib$C();
|
|
55417
55436
|
const {
|
|
55418
55437
|
resolve,
|
|
55419
55438
|
dirname,
|
|
@@ -55542,8 +55561,8 @@ function requireLib$A() {
|
|
|
55542
55561
|
}
|
|
55543
55562
|
return data;
|
|
55544
55563
|
};
|
|
55545
|
-
lib$
|
|
55546
|
-
return lib$
|
|
55564
|
+
lib$B = rpj;
|
|
55565
|
+
return lib$B;
|
|
55547
55566
|
}
|
|
55548
55567
|
|
|
55549
55568
|
var isWindows;
|
|
@@ -55668,11 +55687,11 @@ function requireToBatchSyntax() {
|
|
|
55668
55687
|
return toBatchSyntax;
|
|
55669
55688
|
}
|
|
55670
55689
|
|
|
55671
|
-
var lib$
|
|
55672
|
-
var hasRequiredLib$
|
|
55673
|
-
function requireLib$
|
|
55674
|
-
if (hasRequiredLib$
|
|
55675
|
-
hasRequiredLib$
|
|
55690
|
+
var lib$A;
|
|
55691
|
+
var hasRequiredLib$A;
|
|
55692
|
+
function requireLib$A() {
|
|
55693
|
+
if (hasRequiredLib$A) return lib$A;
|
|
55694
|
+
hasRequiredLib$A = 1;
|
|
55676
55695
|
// On windows, create a .cmd file.
|
|
55677
55696
|
// Read the #! in the file to see what it uses. The vast majority
|
|
55678
55697
|
// of the time, this will be either:
|
|
@@ -55828,16 +55847,16 @@ function requireLib$z() {
|
|
|
55828
55847
|
return Promise.all([writeFile(to + '.ps1', pwsh, 'utf8'), writeFile(to + '.cmd', cmd, 'utf8'), writeFile(to, sh, 'utf8')]).then(() => chmodShim(to));
|
|
55829
55848
|
};
|
|
55830
55849
|
const chmodShim = to => Promise.all([chmod(to, 0o755), chmod(to + '.cmd', 0o755), chmod(to + '.ps1', 0o755)]);
|
|
55831
|
-
lib$
|
|
55850
|
+
lib$A = cmdShim;
|
|
55832
55851
|
cmdShim.ifExists = cmdShimIfExists;
|
|
55833
|
-
return lib$
|
|
55852
|
+
return lib$A;
|
|
55834
55853
|
}
|
|
55835
55854
|
|
|
55836
|
-
var lib$
|
|
55837
|
-
var hasRequiredLib$
|
|
55838
|
-
function requireLib$
|
|
55839
|
-
if (hasRequiredLib$
|
|
55840
|
-
hasRequiredLib$
|
|
55855
|
+
var lib$z;
|
|
55856
|
+
var hasRequiredLib$z;
|
|
55857
|
+
function requireLib$z() {
|
|
55858
|
+
if (hasRequiredLib$z) return lib$z;
|
|
55859
|
+
hasRequiredLib$z = 1;
|
|
55841
55860
|
const fs = require$$0$a;
|
|
55842
55861
|
const {
|
|
55843
55862
|
promisify
|
|
@@ -55906,11 +55925,11 @@ function requireLib$y() {
|
|
|
55906
55925
|
return destination;
|
|
55907
55926
|
};
|
|
55908
55927
|
readCmdShim.sync = readCmdShimSync;
|
|
55909
|
-
lib$
|
|
55910
|
-
return lib$
|
|
55928
|
+
lib$z = readCmdShim;
|
|
55929
|
+
return lib$z;
|
|
55911
55930
|
}
|
|
55912
55931
|
|
|
55913
|
-
var lib$
|
|
55932
|
+
var lib$y = {exports: {}};
|
|
55914
55933
|
|
|
55915
55934
|
var imurmurhash = {exports: {}};
|
|
55916
55935
|
|
|
@@ -56381,14 +56400,14 @@ function requireCjs() {
|
|
|
56381
56400
|
return cjs;
|
|
56382
56401
|
}
|
|
56383
56402
|
|
|
56384
|
-
var hasRequiredLib$
|
|
56385
|
-
function requireLib$
|
|
56386
|
-
if (hasRequiredLib$
|
|
56387
|
-
hasRequiredLib$
|
|
56388
|
-
lib$
|
|
56389
|
-
lib$
|
|
56390
|
-
lib$
|
|
56391
|
-
lib$
|
|
56403
|
+
var hasRequiredLib$y;
|
|
56404
|
+
function requireLib$y() {
|
|
56405
|
+
if (hasRequiredLib$y) return lib$y.exports;
|
|
56406
|
+
hasRequiredLib$y = 1;
|
|
56407
|
+
lib$y.exports = writeFile;
|
|
56408
|
+
lib$y.exports.sync = writeFileSync;
|
|
56409
|
+
lib$y.exports._getTmpname = getTmpname; // for testing
|
|
56410
|
+
lib$y.exports._cleanupOnExit = cleanupOnExit;
|
|
56392
56411
|
const fs = require$$0$a;
|
|
56393
56412
|
const MurmurHash3 = requireImurmurhash();
|
|
56394
56413
|
const {
|
|
@@ -56629,7 +56648,7 @@ function requireLib$x() {
|
|
|
56629
56648
|
}
|
|
56630
56649
|
}
|
|
56631
56650
|
}
|
|
56632
|
-
return lib$
|
|
56651
|
+
return lib$y.exports;
|
|
56633
56652
|
}
|
|
56634
56653
|
|
|
56635
56654
|
var fixBin_1;
|
|
@@ -56645,7 +56664,7 @@ function requireFixBin() {
|
|
|
56645
56664
|
readFile
|
|
56646
56665
|
} = require$$0$k;
|
|
56647
56666
|
const execMode = 0o777 & ~process.umask();
|
|
56648
|
-
const writeFileAtomic = requireLib$
|
|
56667
|
+
const writeFileAtomic = requireLib$y();
|
|
56649
56668
|
const isWindowsHashBang = buf => buf[0] === '#'.charCodeAt(0) && buf[1] === '!'.charCodeAt(0) && /^#![^\n]+\r\n/.test(buf.toString());
|
|
56650
56669
|
const isWindowsHashbangFile = file => {
|
|
56651
56670
|
const FALSE = () => false;
|
|
@@ -56682,8 +56701,8 @@ function requireShimBin() {
|
|
|
56682
56701
|
throw er;
|
|
56683
56702
|
}
|
|
56684
56703
|
};
|
|
56685
|
-
const cmdShim = requireLib$
|
|
56686
|
-
const readCmdShim = requireLib$
|
|
56704
|
+
const cmdShim = requireLib$A();
|
|
56705
|
+
const readCmdShim = requireLib$z();
|
|
56687
56706
|
const fixBin = requireFixBin();
|
|
56688
56707
|
|
|
56689
56708
|
// even in --force mode, we never create a shim over a shim we've
|
|
@@ -56786,7 +56805,7 @@ function requireLinkGently() {
|
|
|
56786
56805
|
} = require$$0$k;
|
|
56787
56806
|
const {
|
|
56788
56807
|
log
|
|
56789
|
-
} = requireLib$
|
|
56808
|
+
} = requireLib$F();
|
|
56790
56809
|
const throwSignificant = er => {
|
|
56791
56810
|
if (er.code === 'ENOENT') {
|
|
56792
56811
|
return;
|
|
@@ -56916,7 +56935,7 @@ function requireLinkBins() {
|
|
|
56916
56935
|
relative
|
|
56917
56936
|
} = require$$0$d;
|
|
56918
56937
|
const linkBin = isWindows ? requireShimBin() : requireLinkBin();
|
|
56919
|
-
const normalize = requireLib$
|
|
56938
|
+
const normalize = requireLib$C();
|
|
56920
56939
|
const linkBins = ({
|
|
56921
56940
|
path,
|
|
56922
56941
|
pkg,
|
|
@@ -57052,7 +57071,7 @@ function requireCheckBin() {
|
|
|
57052
57071
|
resolve,
|
|
57053
57072
|
dirname
|
|
57054
57073
|
} = require$$0$d;
|
|
57055
|
-
const readCmdShim = requireLib$
|
|
57074
|
+
const readCmdShim = requireLib$z();
|
|
57056
57075
|
const {
|
|
57057
57076
|
readlink
|
|
57058
57077
|
} = require$$0$k;
|
|
@@ -57152,7 +57171,7 @@ function requireCheckBins() {
|
|
|
57152
57171
|
if (hasRequiredCheckBins) return checkBins_1;
|
|
57153
57172
|
hasRequiredCheckBins = 1;
|
|
57154
57173
|
const checkBin = requireCheckBin();
|
|
57155
|
-
const normalize = requireLib$
|
|
57174
|
+
const normalize = requireLib$C();
|
|
57156
57175
|
const checkBins = async ({
|
|
57157
57176
|
pkg,
|
|
57158
57177
|
path,
|
|
@@ -57241,11 +57260,11 @@ function requireGetPaths() {
|
|
|
57241
57260
|
return getPaths;
|
|
57242
57261
|
}
|
|
57243
57262
|
|
|
57244
|
-
var lib$
|
|
57245
|
-
var hasRequiredLib$
|
|
57246
|
-
function requireLib$
|
|
57247
|
-
if (hasRequiredLib$
|
|
57248
|
-
hasRequiredLib$
|
|
57263
|
+
var lib$x;
|
|
57264
|
+
var hasRequiredLib$x;
|
|
57265
|
+
function requireLib$x() {
|
|
57266
|
+
if (hasRequiredLib$x) return lib$x;
|
|
57267
|
+
hasRequiredLib$x = 1;
|
|
57249
57268
|
const linkBins = requireLinkBins();
|
|
57250
57269
|
const linkMans = requireLinkMans();
|
|
57251
57270
|
const binLinks = opts => {
|
|
@@ -57294,12 +57313,12 @@ function requireLib$w() {
|
|
|
57294
57313
|
};
|
|
57295
57314
|
const checkBins = requireCheckBins();
|
|
57296
57315
|
const getPaths = requireGetPaths();
|
|
57297
|
-
lib$
|
|
57316
|
+
lib$x = Object.assign(binLinks, {
|
|
57298
57317
|
checkBins,
|
|
57299
57318
|
resetSeen,
|
|
57300
57319
|
getPaths
|
|
57301
57320
|
});
|
|
57302
|
-
return lib$
|
|
57321
|
+
return lib$x;
|
|
57303
57322
|
}
|
|
57304
57323
|
|
|
57305
57324
|
var gatherDepSet_1;
|
|
@@ -57499,16 +57518,16 @@ function requireTreeCheck() {
|
|
|
57499
57518
|
return treeCheck;
|
|
57500
57519
|
}
|
|
57501
57520
|
|
|
57502
|
-
var commonjs$
|
|
57521
|
+
var commonjs$h = {};
|
|
57503
57522
|
|
|
57504
|
-
var hasRequiredCommonjs$
|
|
57505
|
-
function requireCommonjs$
|
|
57506
|
-
if (hasRequiredCommonjs$
|
|
57507
|
-
hasRequiredCommonjs$
|
|
57508
|
-
Object.defineProperty(commonjs$
|
|
57523
|
+
var hasRequiredCommonjs$h;
|
|
57524
|
+
function requireCommonjs$h() {
|
|
57525
|
+
if (hasRequiredCommonjs$h) return commonjs$h;
|
|
57526
|
+
hasRequiredCommonjs$h = 1;
|
|
57527
|
+
Object.defineProperty(commonjs$h, "__esModule", {
|
|
57509
57528
|
value: true
|
|
57510
57529
|
});
|
|
57511
|
-
commonjs$
|
|
57530
|
+
commonjs$h.walkUp = void 0;
|
|
57512
57531
|
const path_1 = require$$0$d;
|
|
57513
57532
|
const walkUp = function* (path) {
|
|
57514
57533
|
for (path = (0, path_1.resolve)(path); path;) {
|
|
@@ -57521,8 +57540,8 @@ function requireCommonjs$g() {
|
|
|
57521
57540
|
}
|
|
57522
57541
|
}
|
|
57523
57542
|
};
|
|
57524
|
-
commonjs$
|
|
57525
|
-
return commonjs$
|
|
57543
|
+
commonjs$h.walkUp = walkUp;
|
|
57544
|
+
return commonjs$h;
|
|
57526
57545
|
}
|
|
57527
57546
|
|
|
57528
57547
|
var relpath_1;
|
|
@@ -61925,11 +61944,11 @@ function requireDist$d() {
|
|
|
61925
61944
|
return dist$d.exports;
|
|
61926
61945
|
}
|
|
61927
61946
|
|
|
61928
|
-
var lib$
|
|
61929
|
-
var hasRequiredLib$
|
|
61930
|
-
function requireLib$
|
|
61931
|
-
if (hasRequiredLib$
|
|
61932
|
-
hasRequiredLib$
|
|
61947
|
+
var lib$w;
|
|
61948
|
+
var hasRequiredLib$w;
|
|
61949
|
+
function requireLib$w() {
|
|
61950
|
+
if (hasRequiredLib$w) return lib$w;
|
|
61951
|
+
hasRequiredLib$w = 1;
|
|
61933
61952
|
const parser = requireDist$d();
|
|
61934
61953
|
const arrayDelimiter = Symbol('arrayDelimiter');
|
|
61935
61954
|
const escapeSlashes = str => str.replace(/\//g, '\\/');
|
|
@@ -62156,14 +62175,14 @@ function requireLib$v() {
|
|
|
62156
62175
|
lossless: false
|
|
62157
62176
|
});
|
|
62158
62177
|
};
|
|
62159
|
-
lib$
|
|
62178
|
+
lib$w = {
|
|
62160
62179
|
parser: queryParser,
|
|
62161
62180
|
arrayDelimiter
|
|
62162
62181
|
};
|
|
62163
|
-
return lib$
|
|
62182
|
+
return lib$w;
|
|
62164
62183
|
}
|
|
62165
62184
|
|
|
62166
|
-
var commonjs$
|
|
62185
|
+
var commonjs$g = {};
|
|
62167
62186
|
|
|
62168
62187
|
var balancedMatch;
|
|
62169
62188
|
var hasRequiredBalancedMatch;
|
|
@@ -63149,10 +63168,10 @@ function require_escape$1() {
|
|
|
63149
63168
|
return _escape$1;
|
|
63150
63169
|
}
|
|
63151
63170
|
|
|
63152
|
-
var hasRequiredCommonjs$
|
|
63153
|
-
function requireCommonjs$
|
|
63154
|
-
if (hasRequiredCommonjs$
|
|
63155
|
-
hasRequiredCommonjs$
|
|
63171
|
+
var hasRequiredCommonjs$g;
|
|
63172
|
+
function requireCommonjs$g() {
|
|
63173
|
+
if (hasRequiredCommonjs$g) return commonjs$g;
|
|
63174
|
+
hasRequiredCommonjs$g = 1;
|
|
63156
63175
|
(function (exports) {
|
|
63157
63176
|
|
|
63158
63177
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
@@ -64052,189 +64071,2513 @@ function requireCommonjs$f() {
|
|
|
64052
64071
|
if (options.flipNegate) {
|
|
64053
64072
|
return true;
|
|
64054
64073
|
}
|
|
64055
|
-
return !this.negate;
|
|
64074
|
+
return !this.negate;
|
|
64075
|
+
}
|
|
64076
|
+
}
|
|
64077
|
+
// didn't get any hits. this is success if it's a negative
|
|
64078
|
+
// pattern, failure otherwise.
|
|
64079
|
+
if (options.flipNegate) {
|
|
64080
|
+
return false;
|
|
64081
|
+
}
|
|
64082
|
+
return this.negate;
|
|
64083
|
+
}
|
|
64084
|
+
static defaults(def) {
|
|
64085
|
+
return exports.minimatch.defaults(def).Minimatch;
|
|
64086
|
+
}
|
|
64087
|
+
}
|
|
64088
|
+
exports.Minimatch = Minimatch;
|
|
64089
|
+
/* c8 ignore start */
|
|
64090
|
+
var ast_js_2 = requireAst();
|
|
64091
|
+
Object.defineProperty(exports, "AST", {
|
|
64092
|
+
enumerable: true,
|
|
64093
|
+
get: function () {
|
|
64094
|
+
return ast_js_2.AST;
|
|
64095
|
+
}
|
|
64096
|
+
});
|
|
64097
|
+
var escape_js_2 = require_escape$1();
|
|
64098
|
+
Object.defineProperty(exports, "escape", {
|
|
64099
|
+
enumerable: true,
|
|
64100
|
+
get: function () {
|
|
64101
|
+
return escape_js_2.escape;
|
|
64102
|
+
}
|
|
64103
|
+
});
|
|
64104
|
+
var unescape_js_2 = require_unescape();
|
|
64105
|
+
Object.defineProperty(exports, "unescape", {
|
|
64106
|
+
enumerable: true,
|
|
64107
|
+
get: function () {
|
|
64108
|
+
return unescape_js_2.unescape;
|
|
64109
|
+
}
|
|
64110
|
+
});
|
|
64111
|
+
/* c8 ignore stop */
|
|
64112
|
+
exports.minimatch.AST = ast_js_1.AST;
|
|
64113
|
+
exports.minimatch.Minimatch = Minimatch;
|
|
64114
|
+
exports.minimatch.escape = escape_js_1.escape;
|
|
64115
|
+
exports.minimatch.unescape = unescape_js_1.unescape;
|
|
64116
|
+
})(commonjs$g);
|
|
64117
|
+
return commonjs$g;
|
|
64118
|
+
}
|
|
64119
|
+
|
|
64120
|
+
var updateDependencies_1;
|
|
64121
|
+
var hasRequiredUpdateDependencies;
|
|
64122
|
+
function requireUpdateDependencies() {
|
|
64123
|
+
if (hasRequiredUpdateDependencies) return updateDependencies_1;
|
|
64124
|
+
hasRequiredUpdateDependencies = 1;
|
|
64125
|
+
const depTypes = new Set(['dependencies', 'optionalDependencies', 'devDependencies', 'peerDependencies']);
|
|
64126
|
+
|
|
64127
|
+
// sort alphabetically all types of deps for a given package
|
|
64128
|
+
const orderDeps = content => {
|
|
64129
|
+
for (const type of depTypes) {
|
|
64130
|
+
if (content && content[type]) {
|
|
64131
|
+
content[type] = Object.keys(content[type]).sort((a, b) => a.localeCompare(b, 'en')).reduce((res, key) => {
|
|
64132
|
+
res[key] = content[type][key];
|
|
64133
|
+
return res;
|
|
64134
|
+
}, {});
|
|
64135
|
+
}
|
|
64136
|
+
}
|
|
64137
|
+
return content;
|
|
64138
|
+
};
|
|
64139
|
+
const updateDependencies = ({
|
|
64140
|
+
content,
|
|
64141
|
+
originalContent
|
|
64142
|
+
}) => {
|
|
64143
|
+
const pkg = orderDeps({
|
|
64144
|
+
...content
|
|
64145
|
+
});
|
|
64146
|
+
|
|
64147
|
+
// optionalDependencies don't need to be repeated in two places
|
|
64148
|
+
if (pkg.dependencies) {
|
|
64149
|
+
if (pkg.optionalDependencies) {
|
|
64150
|
+
for (const name of Object.keys(pkg.optionalDependencies)) {
|
|
64151
|
+
delete pkg.dependencies[name];
|
|
64152
|
+
}
|
|
64153
|
+
}
|
|
64154
|
+
}
|
|
64155
|
+
const result = {
|
|
64156
|
+
...originalContent
|
|
64157
|
+
};
|
|
64158
|
+
|
|
64159
|
+
// loop through all types of dependencies and update package json pkg
|
|
64160
|
+
for (const type of depTypes) {
|
|
64161
|
+
if (pkg[type]) {
|
|
64162
|
+
result[type] = pkg[type];
|
|
64163
|
+
}
|
|
64164
|
+
|
|
64165
|
+
// prune empty type props from resulting object
|
|
64166
|
+
const emptyDepType = pkg[type] && typeof pkg === 'object' && Object.keys(pkg[type]).length === 0;
|
|
64167
|
+
if (emptyDepType) {
|
|
64168
|
+
delete result[type];
|
|
64169
|
+
}
|
|
64170
|
+
}
|
|
64171
|
+
|
|
64172
|
+
// if original package.json had dep in peerDeps AND deps, preserve that.
|
|
64173
|
+
const {
|
|
64174
|
+
dependencies: origProd,
|
|
64175
|
+
peerDependencies: origPeer
|
|
64176
|
+
} = originalContent || {};
|
|
64177
|
+
const {
|
|
64178
|
+
peerDependencies: newPeer
|
|
64179
|
+
} = result;
|
|
64180
|
+
if (origProd && origPeer && newPeer) {
|
|
64181
|
+
// we have original prod/peer deps, and new peer deps
|
|
64182
|
+
// copy over any that were in both in the original
|
|
64183
|
+
for (const name of Object.keys(origPeer)) {
|
|
64184
|
+
if (origProd[name] !== undefined && newPeer[name] !== undefined) {
|
|
64185
|
+
result.dependencies = result.dependencies || {};
|
|
64186
|
+
result.dependencies[name] = newPeer[name];
|
|
64187
|
+
}
|
|
64188
|
+
}
|
|
64189
|
+
}
|
|
64190
|
+
return result;
|
|
64191
|
+
};
|
|
64192
|
+
updateDependencies.knownKeys = depTypes;
|
|
64193
|
+
updateDependencies_1 = updateDependencies;
|
|
64194
|
+
return updateDependencies_1;
|
|
64195
|
+
}
|
|
64196
|
+
|
|
64197
|
+
var updateScripts_1;
|
|
64198
|
+
var hasRequiredUpdateScripts;
|
|
64199
|
+
function requireUpdateScripts() {
|
|
64200
|
+
if (hasRequiredUpdateScripts) return updateScripts_1;
|
|
64201
|
+
hasRequiredUpdateScripts = 1;
|
|
64202
|
+
const updateScripts = ({
|
|
64203
|
+
content,
|
|
64204
|
+
originalContent = {}
|
|
64205
|
+
}) => {
|
|
64206
|
+
const newScripts = content.scripts;
|
|
64207
|
+
if (!newScripts) {
|
|
64208
|
+
return originalContent;
|
|
64209
|
+
}
|
|
64210
|
+
|
|
64211
|
+
// validate scripts content being appended
|
|
64212
|
+
const hasInvalidScripts = () => Object.entries(newScripts).some(([key, value]) => typeof key !== 'string' || typeof value !== 'string');
|
|
64213
|
+
if (hasInvalidScripts()) {
|
|
64214
|
+
throw Object.assign(new TypeError('package.json scripts should be a key-value pair of strings.'), {
|
|
64215
|
+
code: 'ESCRIPTSINVALID'
|
|
64216
|
+
});
|
|
64217
|
+
}
|
|
64218
|
+
return {
|
|
64219
|
+
...originalContent,
|
|
64220
|
+
scripts: {
|
|
64221
|
+
...newScripts
|
|
64222
|
+
}
|
|
64223
|
+
};
|
|
64224
|
+
};
|
|
64225
|
+
updateScripts_1 = updateScripts;
|
|
64226
|
+
return updateScripts_1;
|
|
64227
|
+
}
|
|
64228
|
+
|
|
64229
|
+
var updateWorkspaces_1;
|
|
64230
|
+
var hasRequiredUpdateWorkspaces;
|
|
64231
|
+
function requireUpdateWorkspaces() {
|
|
64232
|
+
if (hasRequiredUpdateWorkspaces) return updateWorkspaces_1;
|
|
64233
|
+
hasRequiredUpdateWorkspaces = 1;
|
|
64234
|
+
const updateWorkspaces = ({
|
|
64235
|
+
content,
|
|
64236
|
+
originalContent = {}
|
|
64237
|
+
}) => {
|
|
64238
|
+
const newWorkspaces = content.workspaces;
|
|
64239
|
+
if (!newWorkspaces) {
|
|
64240
|
+
return originalContent;
|
|
64241
|
+
}
|
|
64242
|
+
|
|
64243
|
+
// validate workspaces content being appended
|
|
64244
|
+
const hasInvalidWorkspaces = () => newWorkspaces.some(w => !(typeof w === 'string'));
|
|
64245
|
+
if (!newWorkspaces.length || hasInvalidWorkspaces()) {
|
|
64246
|
+
throw Object.assign(new TypeError('workspaces should be an array of strings.'), {
|
|
64247
|
+
code: 'EWORKSPACESINVALID'
|
|
64248
|
+
});
|
|
64249
|
+
}
|
|
64250
|
+
return {
|
|
64251
|
+
...originalContent,
|
|
64252
|
+
workspaces: [...newWorkspaces]
|
|
64253
|
+
};
|
|
64254
|
+
};
|
|
64255
|
+
updateWorkspaces_1 = updateWorkspaces;
|
|
64256
|
+
return updateWorkspaces_1;
|
|
64257
|
+
}
|
|
64258
|
+
|
|
64259
|
+
var commonjs$f = {};
|
|
64260
|
+
|
|
64261
|
+
var hasRequiredCommonjs$f;
|
|
64262
|
+
function requireCommonjs$f() {
|
|
64263
|
+
if (hasRequiredCommonjs$f) return commonjs$f;
|
|
64264
|
+
hasRequiredCommonjs$f = 1;
|
|
64265
|
+
/**
|
|
64266
|
+
* @module LRUCache
|
|
64267
|
+
*/
|
|
64268
|
+
Object.defineProperty(commonjs$f, "__esModule", {
|
|
64269
|
+
value: true
|
|
64270
|
+
});
|
|
64271
|
+
commonjs$f.LRUCache = void 0;
|
|
64272
|
+
const perf = typeof performance === 'object' && performance && typeof performance.now === 'function' ? performance : Date;
|
|
64273
|
+
const warned = new Set();
|
|
64274
|
+
/* c8 ignore start */
|
|
64275
|
+
const PROCESS = typeof process === 'object' && !!process ? process : {};
|
|
64276
|
+
/* c8 ignore start */
|
|
64277
|
+
const emitWarning = (msg, type, code, fn) => {
|
|
64278
|
+
typeof PROCESS.emitWarning === 'function' ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
|
|
64279
|
+
};
|
|
64280
|
+
let AC = globalThis.AbortController;
|
|
64281
|
+
let AS = globalThis.AbortSignal;
|
|
64282
|
+
/* c8 ignore start */
|
|
64283
|
+
if (typeof AC === 'undefined') {
|
|
64284
|
+
//@ts-ignore
|
|
64285
|
+
AS = class AbortSignal {
|
|
64286
|
+
onabort;
|
|
64287
|
+
_onabort = [];
|
|
64288
|
+
reason;
|
|
64289
|
+
aborted = false;
|
|
64290
|
+
addEventListener(_, fn) {
|
|
64291
|
+
this._onabort.push(fn);
|
|
64292
|
+
}
|
|
64293
|
+
};
|
|
64294
|
+
//@ts-ignore
|
|
64295
|
+
AC = class AbortController {
|
|
64296
|
+
constructor() {
|
|
64297
|
+
warnACPolyfill();
|
|
64298
|
+
}
|
|
64299
|
+
signal = new AS();
|
|
64300
|
+
abort(reason) {
|
|
64301
|
+
if (this.signal.aborted) return;
|
|
64302
|
+
//@ts-ignore
|
|
64303
|
+
this.signal.reason = reason;
|
|
64304
|
+
//@ts-ignore
|
|
64305
|
+
this.signal.aborted = true;
|
|
64306
|
+
//@ts-ignore
|
|
64307
|
+
for (const fn of this.signal._onabort) {
|
|
64308
|
+
fn(reason);
|
|
64309
|
+
}
|
|
64310
|
+
this.signal.onabort?.(reason);
|
|
64311
|
+
}
|
|
64312
|
+
};
|
|
64313
|
+
let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== '1';
|
|
64314
|
+
const warnACPolyfill = () => {
|
|
64315
|
+
if (!printACPolyfillWarning) return;
|
|
64316
|
+
printACPolyfillWarning = false;
|
|
64317
|
+
emitWarning('AbortController is not defined. If using lru-cache in ' + 'node 14, load an AbortController polyfill from the ' + '`node-abort-controller` package. A minimal polyfill is ' + 'provided for use by LRUCache.fetch(), but it should not be ' + 'relied upon in other contexts (eg, passing it to other APIs that ' + 'use AbortController/AbortSignal might have undesirable effects). ' + 'You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.', 'NO_ABORT_CONTROLLER', 'ENOTSUP', warnACPolyfill);
|
|
64318
|
+
};
|
|
64319
|
+
}
|
|
64320
|
+
/* c8 ignore stop */
|
|
64321
|
+
const shouldWarn = code => !warned.has(code);
|
|
64322
|
+
const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n);
|
|
64323
|
+
/* c8 ignore start */
|
|
64324
|
+
// This is a little bit ridiculous, tbh.
|
|
64325
|
+
// The maximum array length is 2^32-1 or thereabouts on most JS impls.
|
|
64326
|
+
// And well before that point, you're caching the entire world, I mean,
|
|
64327
|
+
// that's ~32GB of just integers for the next/prev links, plus whatever
|
|
64328
|
+
// else to hold that many keys and values. Just filling the memory with
|
|
64329
|
+
// zeroes at init time is brutal when you get that big.
|
|
64330
|
+
// But why not be complete?
|
|
64331
|
+
// Maybe in the future, these limits will have expanded.
|
|
64332
|
+
const getUintArray = max => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
|
|
64333
|
+
/* c8 ignore stop */
|
|
64334
|
+
class ZeroArray extends Array {
|
|
64335
|
+
constructor(size) {
|
|
64336
|
+
super(size);
|
|
64337
|
+
this.fill(0);
|
|
64338
|
+
}
|
|
64339
|
+
}
|
|
64340
|
+
class Stack {
|
|
64341
|
+
heap;
|
|
64342
|
+
length;
|
|
64343
|
+
// private constructor
|
|
64344
|
+
static #constructing = false;
|
|
64345
|
+
static create(max) {
|
|
64346
|
+
const HeapCls = getUintArray(max);
|
|
64347
|
+
if (!HeapCls) return [];
|
|
64348
|
+
Stack.#constructing = true;
|
|
64349
|
+
const s = new Stack(max, HeapCls);
|
|
64350
|
+
Stack.#constructing = false;
|
|
64351
|
+
return s;
|
|
64352
|
+
}
|
|
64353
|
+
constructor(max, HeapCls) {
|
|
64354
|
+
/* c8 ignore start */
|
|
64355
|
+
if (!Stack.#constructing) {
|
|
64356
|
+
throw new TypeError('instantiate Stack using Stack.create(n)');
|
|
64357
|
+
}
|
|
64358
|
+
/* c8 ignore stop */
|
|
64359
|
+
this.heap = new HeapCls(max);
|
|
64360
|
+
this.length = 0;
|
|
64361
|
+
}
|
|
64362
|
+
push(n) {
|
|
64363
|
+
this.heap[this.length++] = n;
|
|
64364
|
+
}
|
|
64365
|
+
pop() {
|
|
64366
|
+
return this.heap[--this.length];
|
|
64367
|
+
}
|
|
64368
|
+
}
|
|
64369
|
+
/**
|
|
64370
|
+
* Default export, the thing you're using this module to get.
|
|
64371
|
+
*
|
|
64372
|
+
* The `K` and `V` types define the key and value types, respectively. The
|
|
64373
|
+
* optional `FC` type defines the type of the `context` object passed to
|
|
64374
|
+
* `cache.fetch()` and `cache.memo()`.
|
|
64375
|
+
*
|
|
64376
|
+
* Keys and values **must not** be `null` or `undefined`.
|
|
64377
|
+
*
|
|
64378
|
+
* All properties from the options object (with the exception of `max`,
|
|
64379
|
+
* `maxSize`, `fetchMethod`, `memoMethod`, `dispose` and `disposeAfter`) are
|
|
64380
|
+
* added as normal public members. (The listed options are read-only getters.)
|
|
64381
|
+
*
|
|
64382
|
+
* Changing any of these will alter the defaults for subsequent method calls.
|
|
64383
|
+
*/
|
|
64384
|
+
class LRUCache {
|
|
64385
|
+
// options that cannot be changed without disaster
|
|
64386
|
+
#max;
|
|
64387
|
+
#maxSize;
|
|
64388
|
+
#dispose;
|
|
64389
|
+
#disposeAfter;
|
|
64390
|
+
#fetchMethod;
|
|
64391
|
+
#memoMethod;
|
|
64392
|
+
/**
|
|
64393
|
+
* {@link LRUCache.OptionsBase.ttl}
|
|
64394
|
+
*/
|
|
64395
|
+
ttl;
|
|
64396
|
+
/**
|
|
64397
|
+
* {@link LRUCache.OptionsBase.ttlResolution}
|
|
64398
|
+
*/
|
|
64399
|
+
ttlResolution;
|
|
64400
|
+
/**
|
|
64401
|
+
* {@link LRUCache.OptionsBase.ttlAutopurge}
|
|
64402
|
+
*/
|
|
64403
|
+
ttlAutopurge;
|
|
64404
|
+
/**
|
|
64405
|
+
* {@link LRUCache.OptionsBase.updateAgeOnGet}
|
|
64406
|
+
*/
|
|
64407
|
+
updateAgeOnGet;
|
|
64408
|
+
/**
|
|
64409
|
+
* {@link LRUCache.OptionsBase.updateAgeOnHas}
|
|
64410
|
+
*/
|
|
64411
|
+
updateAgeOnHas;
|
|
64412
|
+
/**
|
|
64413
|
+
* {@link LRUCache.OptionsBase.allowStale}
|
|
64414
|
+
*/
|
|
64415
|
+
allowStale;
|
|
64416
|
+
/**
|
|
64417
|
+
* {@link LRUCache.OptionsBase.noDisposeOnSet}
|
|
64418
|
+
*/
|
|
64419
|
+
noDisposeOnSet;
|
|
64420
|
+
/**
|
|
64421
|
+
* {@link LRUCache.OptionsBase.noUpdateTTL}
|
|
64422
|
+
*/
|
|
64423
|
+
noUpdateTTL;
|
|
64424
|
+
/**
|
|
64425
|
+
* {@link LRUCache.OptionsBase.maxEntrySize}
|
|
64426
|
+
*/
|
|
64427
|
+
maxEntrySize;
|
|
64428
|
+
/**
|
|
64429
|
+
* {@link LRUCache.OptionsBase.sizeCalculation}
|
|
64430
|
+
*/
|
|
64431
|
+
sizeCalculation;
|
|
64432
|
+
/**
|
|
64433
|
+
* {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
|
|
64434
|
+
*/
|
|
64435
|
+
noDeleteOnFetchRejection;
|
|
64436
|
+
/**
|
|
64437
|
+
* {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
|
|
64438
|
+
*/
|
|
64439
|
+
noDeleteOnStaleGet;
|
|
64440
|
+
/**
|
|
64441
|
+
* {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
|
|
64442
|
+
*/
|
|
64443
|
+
allowStaleOnFetchAbort;
|
|
64444
|
+
/**
|
|
64445
|
+
* {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
|
|
64446
|
+
*/
|
|
64447
|
+
allowStaleOnFetchRejection;
|
|
64448
|
+
/**
|
|
64449
|
+
* {@link LRUCache.OptionsBase.ignoreFetchAbort}
|
|
64450
|
+
*/
|
|
64451
|
+
ignoreFetchAbort;
|
|
64452
|
+
// computed properties
|
|
64453
|
+
#size;
|
|
64454
|
+
#calculatedSize;
|
|
64455
|
+
#keyMap;
|
|
64456
|
+
#keyList;
|
|
64457
|
+
#valList;
|
|
64458
|
+
#next;
|
|
64459
|
+
#prev;
|
|
64460
|
+
#head;
|
|
64461
|
+
#tail;
|
|
64462
|
+
#free;
|
|
64463
|
+
#disposed;
|
|
64464
|
+
#sizes;
|
|
64465
|
+
#starts;
|
|
64466
|
+
#ttls;
|
|
64467
|
+
#hasDispose;
|
|
64468
|
+
#hasFetchMethod;
|
|
64469
|
+
#hasDisposeAfter;
|
|
64470
|
+
/**
|
|
64471
|
+
* Do not call this method unless you need to inspect the
|
|
64472
|
+
* inner workings of the cache. If anything returned by this
|
|
64473
|
+
* object is modified in any way, strange breakage may occur.
|
|
64474
|
+
*
|
|
64475
|
+
* These fields are private for a reason!
|
|
64476
|
+
*
|
|
64477
|
+
* @internal
|
|
64478
|
+
*/
|
|
64479
|
+
static unsafeExposeInternals(c) {
|
|
64480
|
+
return {
|
|
64481
|
+
// properties
|
|
64482
|
+
starts: c.#starts,
|
|
64483
|
+
ttls: c.#ttls,
|
|
64484
|
+
sizes: c.#sizes,
|
|
64485
|
+
keyMap: c.#keyMap,
|
|
64486
|
+
keyList: c.#keyList,
|
|
64487
|
+
valList: c.#valList,
|
|
64488
|
+
next: c.#next,
|
|
64489
|
+
prev: c.#prev,
|
|
64490
|
+
get head() {
|
|
64491
|
+
return c.#head;
|
|
64492
|
+
},
|
|
64493
|
+
get tail() {
|
|
64494
|
+
return c.#tail;
|
|
64495
|
+
},
|
|
64496
|
+
free: c.#free,
|
|
64497
|
+
// methods
|
|
64498
|
+
isBackgroundFetch: p => c.#isBackgroundFetch(p),
|
|
64499
|
+
backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
|
|
64500
|
+
moveToTail: index => c.#moveToTail(index),
|
|
64501
|
+
indexes: options => c.#indexes(options),
|
|
64502
|
+
rindexes: options => c.#rindexes(options),
|
|
64503
|
+
isStale: index => c.#isStale(index)
|
|
64504
|
+
};
|
|
64505
|
+
}
|
|
64506
|
+
// Protected read-only members
|
|
64507
|
+
/**
|
|
64508
|
+
* {@link LRUCache.OptionsBase.max} (read-only)
|
|
64509
|
+
*/
|
|
64510
|
+
get max() {
|
|
64511
|
+
return this.#max;
|
|
64512
|
+
}
|
|
64513
|
+
/**
|
|
64514
|
+
* {@link LRUCache.OptionsBase.maxSize} (read-only)
|
|
64515
|
+
*/
|
|
64516
|
+
get maxSize() {
|
|
64517
|
+
return this.#maxSize;
|
|
64518
|
+
}
|
|
64519
|
+
/**
|
|
64520
|
+
* The total computed size of items in the cache (read-only)
|
|
64521
|
+
*/
|
|
64522
|
+
get calculatedSize() {
|
|
64523
|
+
return this.#calculatedSize;
|
|
64524
|
+
}
|
|
64525
|
+
/**
|
|
64526
|
+
* The number of items stored in the cache (read-only)
|
|
64527
|
+
*/
|
|
64528
|
+
get size() {
|
|
64529
|
+
return this.#size;
|
|
64530
|
+
}
|
|
64531
|
+
/**
|
|
64532
|
+
* {@link LRUCache.OptionsBase.fetchMethod} (read-only)
|
|
64533
|
+
*/
|
|
64534
|
+
get fetchMethod() {
|
|
64535
|
+
return this.#fetchMethod;
|
|
64536
|
+
}
|
|
64537
|
+
get memoMethod() {
|
|
64538
|
+
return this.#memoMethod;
|
|
64539
|
+
}
|
|
64540
|
+
/**
|
|
64541
|
+
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
|
64542
|
+
*/
|
|
64543
|
+
get dispose() {
|
|
64544
|
+
return this.#dispose;
|
|
64545
|
+
}
|
|
64546
|
+
/**
|
|
64547
|
+
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
|
64548
|
+
*/
|
|
64549
|
+
get disposeAfter() {
|
|
64550
|
+
return this.#disposeAfter;
|
|
64551
|
+
}
|
|
64552
|
+
constructor(options) {
|
|
64553
|
+
const {
|
|
64554
|
+
max = 0,
|
|
64555
|
+
ttl,
|
|
64556
|
+
ttlResolution = 1,
|
|
64557
|
+
ttlAutopurge,
|
|
64558
|
+
updateAgeOnGet,
|
|
64559
|
+
updateAgeOnHas,
|
|
64560
|
+
allowStale,
|
|
64561
|
+
dispose,
|
|
64562
|
+
disposeAfter,
|
|
64563
|
+
noDisposeOnSet,
|
|
64564
|
+
noUpdateTTL,
|
|
64565
|
+
maxSize = 0,
|
|
64566
|
+
maxEntrySize = 0,
|
|
64567
|
+
sizeCalculation,
|
|
64568
|
+
fetchMethod,
|
|
64569
|
+
memoMethod,
|
|
64570
|
+
noDeleteOnFetchRejection,
|
|
64571
|
+
noDeleteOnStaleGet,
|
|
64572
|
+
allowStaleOnFetchRejection,
|
|
64573
|
+
allowStaleOnFetchAbort,
|
|
64574
|
+
ignoreFetchAbort
|
|
64575
|
+
} = options;
|
|
64576
|
+
if (max !== 0 && !isPosInt(max)) {
|
|
64577
|
+
throw new TypeError('max option must be a nonnegative integer');
|
|
64578
|
+
}
|
|
64579
|
+
const UintArray = max ? getUintArray(max) : Array;
|
|
64580
|
+
if (!UintArray) {
|
|
64581
|
+
throw new Error('invalid max value: ' + max);
|
|
64582
|
+
}
|
|
64583
|
+
this.#max = max;
|
|
64584
|
+
this.#maxSize = maxSize;
|
|
64585
|
+
this.maxEntrySize = maxEntrySize || this.#maxSize;
|
|
64586
|
+
this.sizeCalculation = sizeCalculation;
|
|
64587
|
+
if (this.sizeCalculation) {
|
|
64588
|
+
if (!this.#maxSize && !this.maxEntrySize) {
|
|
64589
|
+
throw new TypeError('cannot set sizeCalculation without setting maxSize or maxEntrySize');
|
|
64590
|
+
}
|
|
64591
|
+
if (typeof this.sizeCalculation !== 'function') {
|
|
64592
|
+
throw new TypeError('sizeCalculation set to non-function');
|
|
64593
|
+
}
|
|
64594
|
+
}
|
|
64595
|
+
if (memoMethod !== undefined && typeof memoMethod !== 'function') {
|
|
64596
|
+
throw new TypeError('memoMethod must be a function if defined');
|
|
64597
|
+
}
|
|
64598
|
+
this.#memoMethod = memoMethod;
|
|
64599
|
+
if (fetchMethod !== undefined && typeof fetchMethod !== 'function') {
|
|
64600
|
+
throw new TypeError('fetchMethod must be a function if specified');
|
|
64601
|
+
}
|
|
64602
|
+
this.#fetchMethod = fetchMethod;
|
|
64603
|
+
this.#hasFetchMethod = !!fetchMethod;
|
|
64604
|
+
this.#keyMap = new Map();
|
|
64605
|
+
this.#keyList = new Array(max).fill(undefined);
|
|
64606
|
+
this.#valList = new Array(max).fill(undefined);
|
|
64607
|
+
this.#next = new UintArray(max);
|
|
64608
|
+
this.#prev = new UintArray(max);
|
|
64609
|
+
this.#head = 0;
|
|
64610
|
+
this.#tail = 0;
|
|
64611
|
+
this.#free = Stack.create(max);
|
|
64612
|
+
this.#size = 0;
|
|
64613
|
+
this.#calculatedSize = 0;
|
|
64614
|
+
if (typeof dispose === 'function') {
|
|
64615
|
+
this.#dispose = dispose;
|
|
64616
|
+
}
|
|
64617
|
+
if (typeof disposeAfter === 'function') {
|
|
64618
|
+
this.#disposeAfter = disposeAfter;
|
|
64619
|
+
this.#disposed = [];
|
|
64620
|
+
} else {
|
|
64621
|
+
this.#disposeAfter = undefined;
|
|
64622
|
+
this.#disposed = undefined;
|
|
64623
|
+
}
|
|
64624
|
+
this.#hasDispose = !!this.#dispose;
|
|
64625
|
+
this.#hasDisposeAfter = !!this.#disposeAfter;
|
|
64626
|
+
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
64627
|
+
this.noUpdateTTL = !!noUpdateTTL;
|
|
64628
|
+
this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
|
|
64629
|
+
this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
|
|
64630
|
+
this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
|
|
64631
|
+
this.ignoreFetchAbort = !!ignoreFetchAbort;
|
|
64632
|
+
// NB: maxEntrySize is set to maxSize if it's set
|
|
64633
|
+
if (this.maxEntrySize !== 0) {
|
|
64634
|
+
if (this.#maxSize !== 0) {
|
|
64635
|
+
if (!isPosInt(this.#maxSize)) {
|
|
64636
|
+
throw new TypeError('maxSize must be a positive integer if specified');
|
|
64637
|
+
}
|
|
64638
|
+
}
|
|
64639
|
+
if (!isPosInt(this.maxEntrySize)) {
|
|
64640
|
+
throw new TypeError('maxEntrySize must be a positive integer if specified');
|
|
64641
|
+
}
|
|
64642
|
+
this.#initializeSizeTracking();
|
|
64643
|
+
}
|
|
64644
|
+
this.allowStale = !!allowStale;
|
|
64645
|
+
this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
|
|
64646
|
+
this.updateAgeOnGet = !!updateAgeOnGet;
|
|
64647
|
+
this.updateAgeOnHas = !!updateAgeOnHas;
|
|
64648
|
+
this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
|
|
64649
|
+
this.ttlAutopurge = !!ttlAutopurge;
|
|
64650
|
+
this.ttl = ttl || 0;
|
|
64651
|
+
if (this.ttl) {
|
|
64652
|
+
if (!isPosInt(this.ttl)) {
|
|
64653
|
+
throw new TypeError('ttl must be a positive integer if specified');
|
|
64654
|
+
}
|
|
64655
|
+
this.#initializeTTLTracking();
|
|
64656
|
+
}
|
|
64657
|
+
// do not allow completely unbounded caches
|
|
64658
|
+
if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
|
|
64659
|
+
throw new TypeError('At least one of max, maxSize, or ttl is required');
|
|
64660
|
+
}
|
|
64661
|
+
if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
|
|
64662
|
+
const code = 'LRU_CACHE_UNBOUNDED';
|
|
64663
|
+
if (shouldWarn(code)) {
|
|
64664
|
+
warned.add(code);
|
|
64665
|
+
const msg = 'TTL caching without ttlAutopurge, max, or maxSize can ' + 'result in unbounded memory consumption.';
|
|
64666
|
+
emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache);
|
|
64667
|
+
}
|
|
64668
|
+
}
|
|
64669
|
+
}
|
|
64670
|
+
/**
|
|
64671
|
+
* Return the number of ms left in the item's TTL. If item is not in cache,
|
|
64672
|
+
* returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
|
|
64673
|
+
*/
|
|
64674
|
+
getRemainingTTL(key) {
|
|
64675
|
+
return this.#keyMap.has(key) ? Infinity : 0;
|
|
64676
|
+
}
|
|
64677
|
+
#initializeTTLTracking() {
|
|
64678
|
+
const ttls = new ZeroArray(this.#max);
|
|
64679
|
+
const starts = new ZeroArray(this.#max);
|
|
64680
|
+
this.#ttls = ttls;
|
|
64681
|
+
this.#starts = starts;
|
|
64682
|
+
this.#setItemTTL = (index, ttl, start = perf.now()) => {
|
|
64683
|
+
starts[index] = ttl !== 0 ? start : 0;
|
|
64684
|
+
ttls[index] = ttl;
|
|
64685
|
+
if (ttl !== 0 && this.ttlAutopurge) {
|
|
64686
|
+
const t = setTimeout(() => {
|
|
64687
|
+
if (this.#isStale(index)) {
|
|
64688
|
+
this.#delete(this.#keyList[index], 'expire');
|
|
64689
|
+
}
|
|
64690
|
+
}, ttl + 1);
|
|
64691
|
+
// unref() not supported on all platforms
|
|
64692
|
+
/* c8 ignore start */
|
|
64693
|
+
if (t.unref) {
|
|
64694
|
+
t.unref();
|
|
64695
|
+
}
|
|
64696
|
+
/* c8 ignore stop */
|
|
64697
|
+
}
|
|
64698
|
+
};
|
|
64699
|
+
this.#updateItemAge = index => {
|
|
64700
|
+
starts[index] = ttls[index] !== 0 ? perf.now() : 0;
|
|
64701
|
+
};
|
|
64702
|
+
this.#statusTTL = (status, index) => {
|
|
64703
|
+
if (ttls[index]) {
|
|
64704
|
+
const ttl = ttls[index];
|
|
64705
|
+
const start = starts[index];
|
|
64706
|
+
/* c8 ignore next */
|
|
64707
|
+
if (!ttl || !start) return;
|
|
64708
|
+
status.ttl = ttl;
|
|
64709
|
+
status.start = start;
|
|
64710
|
+
status.now = cachedNow || getNow();
|
|
64711
|
+
const age = status.now - start;
|
|
64712
|
+
status.remainingTTL = ttl - age;
|
|
64713
|
+
}
|
|
64714
|
+
};
|
|
64715
|
+
// debounce calls to perf.now() to 1s so we're not hitting
|
|
64716
|
+
// that costly call repeatedly.
|
|
64717
|
+
let cachedNow = 0;
|
|
64718
|
+
const getNow = () => {
|
|
64719
|
+
const n = perf.now();
|
|
64720
|
+
if (this.ttlResolution > 0) {
|
|
64721
|
+
cachedNow = n;
|
|
64722
|
+
const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
|
|
64723
|
+
// not available on all platforms
|
|
64724
|
+
/* c8 ignore start */
|
|
64725
|
+
if (t.unref) {
|
|
64726
|
+
t.unref();
|
|
64727
|
+
}
|
|
64728
|
+
/* c8 ignore stop */
|
|
64729
|
+
}
|
|
64730
|
+
return n;
|
|
64731
|
+
};
|
|
64732
|
+
this.getRemainingTTL = key => {
|
|
64733
|
+
const index = this.#keyMap.get(key);
|
|
64734
|
+
if (index === undefined) {
|
|
64735
|
+
return 0;
|
|
64736
|
+
}
|
|
64737
|
+
const ttl = ttls[index];
|
|
64738
|
+
const start = starts[index];
|
|
64739
|
+
if (!ttl || !start) {
|
|
64740
|
+
return Infinity;
|
|
64741
|
+
}
|
|
64742
|
+
const age = (cachedNow || getNow()) - start;
|
|
64743
|
+
return ttl - age;
|
|
64744
|
+
};
|
|
64745
|
+
this.#isStale = index => {
|
|
64746
|
+
const s = starts[index];
|
|
64747
|
+
const t = ttls[index];
|
|
64748
|
+
return !!t && !!s && (cachedNow || getNow()) - s > t;
|
|
64749
|
+
};
|
|
64750
|
+
}
|
|
64751
|
+
// conditionally set private methods related to TTL
|
|
64752
|
+
#updateItemAge = () => {};
|
|
64753
|
+
#statusTTL = () => {};
|
|
64754
|
+
#setItemTTL = () => {};
|
|
64755
|
+
/* c8 ignore stop */
|
|
64756
|
+
#isStale = () => false;
|
|
64757
|
+
#initializeSizeTracking() {
|
|
64758
|
+
const sizes = new ZeroArray(this.#max);
|
|
64759
|
+
this.#calculatedSize = 0;
|
|
64760
|
+
this.#sizes = sizes;
|
|
64761
|
+
this.#removeItemSize = index => {
|
|
64762
|
+
this.#calculatedSize -= sizes[index];
|
|
64763
|
+
sizes[index] = 0;
|
|
64764
|
+
};
|
|
64765
|
+
this.#requireSize = (k, v, size, sizeCalculation) => {
|
|
64766
|
+
// provisionally accept background fetches.
|
|
64767
|
+
// actual value size will be checked when they return.
|
|
64768
|
+
if (this.#isBackgroundFetch(v)) {
|
|
64769
|
+
return 0;
|
|
64770
|
+
}
|
|
64771
|
+
if (!isPosInt(size)) {
|
|
64772
|
+
if (sizeCalculation) {
|
|
64773
|
+
if (typeof sizeCalculation !== 'function') {
|
|
64774
|
+
throw new TypeError('sizeCalculation must be a function');
|
|
64775
|
+
}
|
|
64776
|
+
size = sizeCalculation(v, k);
|
|
64777
|
+
if (!isPosInt(size)) {
|
|
64778
|
+
throw new TypeError('sizeCalculation return invalid (expect positive integer)');
|
|
64779
|
+
}
|
|
64780
|
+
} else {
|
|
64781
|
+
throw new TypeError('invalid size value (must be positive integer). ' + 'When maxSize or maxEntrySize is used, sizeCalculation ' + 'or size must be set.');
|
|
64782
|
+
}
|
|
64783
|
+
}
|
|
64784
|
+
return size;
|
|
64785
|
+
};
|
|
64786
|
+
this.#addItemSize = (index, size, status) => {
|
|
64787
|
+
sizes[index] = size;
|
|
64788
|
+
if (this.#maxSize) {
|
|
64789
|
+
const maxSize = this.#maxSize - sizes[index];
|
|
64790
|
+
while (this.#calculatedSize > maxSize) {
|
|
64791
|
+
this.#evict(true);
|
|
64792
|
+
}
|
|
64793
|
+
}
|
|
64794
|
+
this.#calculatedSize += sizes[index];
|
|
64795
|
+
if (status) {
|
|
64796
|
+
status.entrySize = size;
|
|
64797
|
+
status.totalCalculatedSize = this.#calculatedSize;
|
|
64798
|
+
}
|
|
64799
|
+
};
|
|
64800
|
+
}
|
|
64801
|
+
#removeItemSize = _i => {};
|
|
64802
|
+
#addItemSize = (_i, _s, _st) => {};
|
|
64803
|
+
#requireSize = (_k, _v, size, sizeCalculation) => {
|
|
64804
|
+
if (size || sizeCalculation) {
|
|
64805
|
+
throw new TypeError('cannot set size without setting maxSize or maxEntrySize on cache');
|
|
64806
|
+
}
|
|
64807
|
+
return 0;
|
|
64808
|
+
};
|
|
64809
|
+
*#indexes({
|
|
64810
|
+
allowStale = this.allowStale
|
|
64811
|
+
} = {}) {
|
|
64812
|
+
if (this.#size) {
|
|
64813
|
+
for (let i = this.#tail; true;) {
|
|
64814
|
+
if (!this.#isValidIndex(i)) {
|
|
64815
|
+
break;
|
|
64816
|
+
}
|
|
64817
|
+
if (allowStale || !this.#isStale(i)) {
|
|
64818
|
+
yield i;
|
|
64819
|
+
}
|
|
64820
|
+
if (i === this.#head) {
|
|
64821
|
+
break;
|
|
64822
|
+
} else {
|
|
64823
|
+
i = this.#prev[i];
|
|
64824
|
+
}
|
|
64825
|
+
}
|
|
64826
|
+
}
|
|
64827
|
+
}
|
|
64828
|
+
*#rindexes({
|
|
64829
|
+
allowStale = this.allowStale
|
|
64830
|
+
} = {}) {
|
|
64831
|
+
if (this.#size) {
|
|
64832
|
+
for (let i = this.#head; true;) {
|
|
64833
|
+
if (!this.#isValidIndex(i)) {
|
|
64834
|
+
break;
|
|
64835
|
+
}
|
|
64836
|
+
if (allowStale || !this.#isStale(i)) {
|
|
64837
|
+
yield i;
|
|
64838
|
+
}
|
|
64839
|
+
if (i === this.#tail) {
|
|
64840
|
+
break;
|
|
64841
|
+
} else {
|
|
64842
|
+
i = this.#next[i];
|
|
64843
|
+
}
|
|
64844
|
+
}
|
|
64845
|
+
}
|
|
64846
|
+
}
|
|
64847
|
+
#isValidIndex(index) {
|
|
64848
|
+
return index !== undefined && this.#keyMap.get(this.#keyList[index]) === index;
|
|
64849
|
+
}
|
|
64850
|
+
/**
|
|
64851
|
+
* Return a generator yielding `[key, value]` pairs,
|
|
64852
|
+
* in order from most recently used to least recently used.
|
|
64853
|
+
*/
|
|
64854
|
+
*entries() {
|
|
64855
|
+
for (const i of this.#indexes()) {
|
|
64856
|
+
if (this.#valList[i] !== undefined && this.#keyList[i] !== undefined && !this.#isBackgroundFetch(this.#valList[i])) {
|
|
64857
|
+
yield [this.#keyList[i], this.#valList[i]];
|
|
64858
|
+
}
|
|
64859
|
+
}
|
|
64860
|
+
}
|
|
64861
|
+
/**
|
|
64862
|
+
* Inverse order version of {@link LRUCache.entries}
|
|
64863
|
+
*
|
|
64864
|
+
* Return a generator yielding `[key, value]` pairs,
|
|
64865
|
+
* in order from least recently used to most recently used.
|
|
64866
|
+
*/
|
|
64867
|
+
*rentries() {
|
|
64868
|
+
for (const i of this.#rindexes()) {
|
|
64869
|
+
if (this.#valList[i] !== undefined && this.#keyList[i] !== undefined && !this.#isBackgroundFetch(this.#valList[i])) {
|
|
64870
|
+
yield [this.#keyList[i], this.#valList[i]];
|
|
64871
|
+
}
|
|
64872
|
+
}
|
|
64873
|
+
}
|
|
64874
|
+
/**
|
|
64875
|
+
* Return a generator yielding the keys in the cache,
|
|
64876
|
+
* in order from most recently used to least recently used.
|
|
64877
|
+
*/
|
|
64878
|
+
*keys() {
|
|
64879
|
+
for (const i of this.#indexes()) {
|
|
64880
|
+
const k = this.#keyList[i];
|
|
64881
|
+
if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i])) {
|
|
64882
|
+
yield k;
|
|
64883
|
+
}
|
|
64884
|
+
}
|
|
64885
|
+
}
|
|
64886
|
+
/**
|
|
64887
|
+
* Inverse order version of {@link LRUCache.keys}
|
|
64888
|
+
*
|
|
64889
|
+
* Return a generator yielding the keys in the cache,
|
|
64890
|
+
* in order from least recently used to most recently used.
|
|
64891
|
+
*/
|
|
64892
|
+
*rkeys() {
|
|
64893
|
+
for (const i of this.#rindexes()) {
|
|
64894
|
+
const k = this.#keyList[i];
|
|
64895
|
+
if (k !== undefined && !this.#isBackgroundFetch(this.#valList[i])) {
|
|
64896
|
+
yield k;
|
|
64897
|
+
}
|
|
64898
|
+
}
|
|
64899
|
+
}
|
|
64900
|
+
/**
|
|
64901
|
+
* Return a generator yielding the values in the cache,
|
|
64902
|
+
* in order from most recently used to least recently used.
|
|
64903
|
+
*/
|
|
64904
|
+
*values() {
|
|
64905
|
+
for (const i of this.#indexes()) {
|
|
64906
|
+
const v = this.#valList[i];
|
|
64907
|
+
if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i])) {
|
|
64908
|
+
yield this.#valList[i];
|
|
64909
|
+
}
|
|
64910
|
+
}
|
|
64911
|
+
}
|
|
64912
|
+
/**
|
|
64913
|
+
* Inverse order version of {@link LRUCache.values}
|
|
64914
|
+
*
|
|
64915
|
+
* Return a generator yielding the values in the cache,
|
|
64916
|
+
* in order from least recently used to most recently used.
|
|
64917
|
+
*/
|
|
64918
|
+
*rvalues() {
|
|
64919
|
+
for (const i of this.#rindexes()) {
|
|
64920
|
+
const v = this.#valList[i];
|
|
64921
|
+
if (v !== undefined && !this.#isBackgroundFetch(this.#valList[i])) {
|
|
64922
|
+
yield this.#valList[i];
|
|
64923
|
+
}
|
|
64924
|
+
}
|
|
64925
|
+
}
|
|
64926
|
+
/**
|
|
64927
|
+
* Iterating over the cache itself yields the same results as
|
|
64928
|
+
* {@link LRUCache.entries}
|
|
64929
|
+
*/
|
|
64930
|
+
[Symbol.iterator]() {
|
|
64931
|
+
return this.entries();
|
|
64932
|
+
}
|
|
64933
|
+
/**
|
|
64934
|
+
* A String value that is used in the creation of the default string
|
|
64935
|
+
* description of an object. Called by the built-in method
|
|
64936
|
+
* `Object.prototype.toString`.
|
|
64937
|
+
*/
|
|
64938
|
+
[Symbol.toStringTag] = 'LRUCache';
|
|
64939
|
+
/**
|
|
64940
|
+
* Find a value for which the supplied fn method returns a truthy value,
|
|
64941
|
+
* similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
|
|
64942
|
+
*/
|
|
64943
|
+
find(fn, getOptions = {}) {
|
|
64944
|
+
for (const i of this.#indexes()) {
|
|
64945
|
+
const v = this.#valList[i];
|
|
64946
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
64947
|
+
if (value === undefined) continue;
|
|
64948
|
+
if (fn(value, this.#keyList[i], this)) {
|
|
64949
|
+
return this.get(this.#keyList[i], getOptions);
|
|
64950
|
+
}
|
|
64951
|
+
}
|
|
64952
|
+
}
|
|
64953
|
+
/**
|
|
64954
|
+
* Call the supplied function on each item in the cache, in order from most
|
|
64955
|
+
* recently used to least recently used.
|
|
64956
|
+
*
|
|
64957
|
+
* `fn` is called as `fn(value, key, cache)`.
|
|
64958
|
+
*
|
|
64959
|
+
* If `thisp` is provided, function will be called in the `this`-context of
|
|
64960
|
+
* the provided object, or the cache if no `thisp` object is provided.
|
|
64961
|
+
*
|
|
64962
|
+
* Does not update age or recenty of use, or iterate over stale values.
|
|
64963
|
+
*/
|
|
64964
|
+
forEach(fn, thisp = this) {
|
|
64965
|
+
for (const i of this.#indexes()) {
|
|
64966
|
+
const v = this.#valList[i];
|
|
64967
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
64968
|
+
if (value === undefined) continue;
|
|
64969
|
+
fn.call(thisp, value, this.#keyList[i], this);
|
|
64970
|
+
}
|
|
64971
|
+
}
|
|
64972
|
+
/**
|
|
64973
|
+
* The same as {@link LRUCache.forEach} but items are iterated over in
|
|
64974
|
+
* reverse order. (ie, less recently used items are iterated over first.)
|
|
64975
|
+
*/
|
|
64976
|
+
rforEach(fn, thisp = this) {
|
|
64977
|
+
for (const i of this.#rindexes()) {
|
|
64978
|
+
const v = this.#valList[i];
|
|
64979
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
64980
|
+
if (value === undefined) continue;
|
|
64981
|
+
fn.call(thisp, value, this.#keyList[i], this);
|
|
64982
|
+
}
|
|
64983
|
+
}
|
|
64984
|
+
/**
|
|
64985
|
+
* Delete any stale entries. Returns true if anything was removed,
|
|
64986
|
+
* false otherwise.
|
|
64987
|
+
*/
|
|
64988
|
+
purgeStale() {
|
|
64989
|
+
let deleted = false;
|
|
64990
|
+
for (const i of this.#rindexes({
|
|
64991
|
+
allowStale: true
|
|
64992
|
+
})) {
|
|
64993
|
+
if (this.#isStale(i)) {
|
|
64994
|
+
this.#delete(this.#keyList[i], 'expire');
|
|
64995
|
+
deleted = true;
|
|
64996
|
+
}
|
|
64997
|
+
}
|
|
64998
|
+
return deleted;
|
|
64999
|
+
}
|
|
65000
|
+
/**
|
|
65001
|
+
* Get the extended info about a given entry, to get its value, size, and
|
|
65002
|
+
* TTL info simultaneously. Returns `undefined` if the key is not present.
|
|
65003
|
+
*
|
|
65004
|
+
* Unlike {@link LRUCache#dump}, which is designed to be portable and survive
|
|
65005
|
+
* serialization, the `start` value is always the current timestamp, and the
|
|
65006
|
+
* `ttl` is a calculated remaining time to live (negative if expired).
|
|
65007
|
+
*
|
|
65008
|
+
* Always returns stale values, if their info is found in the cache, so be
|
|
65009
|
+
* sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
|
|
65010
|
+
* if relevant.
|
|
65011
|
+
*/
|
|
65012
|
+
info(key) {
|
|
65013
|
+
const i = this.#keyMap.get(key);
|
|
65014
|
+
if (i === undefined) return undefined;
|
|
65015
|
+
const v = this.#valList[i];
|
|
65016
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
65017
|
+
if (value === undefined) return undefined;
|
|
65018
|
+
const entry = {
|
|
65019
|
+
value
|
|
65020
|
+
};
|
|
65021
|
+
if (this.#ttls && this.#starts) {
|
|
65022
|
+
const ttl = this.#ttls[i];
|
|
65023
|
+
const start = this.#starts[i];
|
|
65024
|
+
if (ttl && start) {
|
|
65025
|
+
const remain = ttl - (perf.now() - start);
|
|
65026
|
+
entry.ttl = remain;
|
|
65027
|
+
entry.start = Date.now();
|
|
65028
|
+
}
|
|
65029
|
+
}
|
|
65030
|
+
if (this.#sizes) {
|
|
65031
|
+
entry.size = this.#sizes[i];
|
|
65032
|
+
}
|
|
65033
|
+
return entry;
|
|
65034
|
+
}
|
|
65035
|
+
/**
|
|
65036
|
+
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
|
65037
|
+
* passed to {@link LRLUCache#load}.
|
|
65038
|
+
*
|
|
65039
|
+
* The `start` fields are calculated relative to a portable `Date.now()`
|
|
65040
|
+
* timestamp, even if `performance.now()` is available.
|
|
65041
|
+
*
|
|
65042
|
+
* Stale entries are always included in the `dump`, even if
|
|
65043
|
+
* {@link LRUCache.OptionsBase.allowStale} is false.
|
|
65044
|
+
*
|
|
65045
|
+
* Note: this returns an actual array, not a generator, so it can be more
|
|
65046
|
+
* easily passed around.
|
|
65047
|
+
*/
|
|
65048
|
+
dump() {
|
|
65049
|
+
const arr = [];
|
|
65050
|
+
for (const i of this.#indexes({
|
|
65051
|
+
allowStale: true
|
|
65052
|
+
})) {
|
|
65053
|
+
const key = this.#keyList[i];
|
|
65054
|
+
const v = this.#valList[i];
|
|
65055
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
65056
|
+
if (value === undefined || key === undefined) continue;
|
|
65057
|
+
const entry = {
|
|
65058
|
+
value
|
|
65059
|
+
};
|
|
65060
|
+
if (this.#ttls && this.#starts) {
|
|
65061
|
+
entry.ttl = this.#ttls[i];
|
|
65062
|
+
// always dump the start relative to a portable timestamp
|
|
65063
|
+
// it's ok for this to be a bit slow, it's a rare operation.
|
|
65064
|
+
const age = perf.now() - this.#starts[i];
|
|
65065
|
+
entry.start = Math.floor(Date.now() - age);
|
|
65066
|
+
}
|
|
65067
|
+
if (this.#sizes) {
|
|
65068
|
+
entry.size = this.#sizes[i];
|
|
65069
|
+
}
|
|
65070
|
+
arr.unshift([key, entry]);
|
|
65071
|
+
}
|
|
65072
|
+
return arr;
|
|
65073
|
+
}
|
|
65074
|
+
/**
|
|
65075
|
+
* Reset the cache and load in the items in entries in the order listed.
|
|
65076
|
+
*
|
|
65077
|
+
* The shape of the resulting cache may be different if the same options are
|
|
65078
|
+
* not used in both caches.
|
|
65079
|
+
*
|
|
65080
|
+
* The `start` fields are assumed to be calculated relative to a portable
|
|
65081
|
+
* `Date.now()` timestamp, even if `performance.now()` is available.
|
|
65082
|
+
*/
|
|
65083
|
+
load(arr) {
|
|
65084
|
+
this.clear();
|
|
65085
|
+
for (const [key, entry] of arr) {
|
|
65086
|
+
if (entry.start) {
|
|
65087
|
+
// entry.start is a portable timestamp, but we may be using
|
|
65088
|
+
// node's performance.now(), so calculate the offset, so that
|
|
65089
|
+
// we get the intended remaining TTL, no matter how long it's
|
|
65090
|
+
// been on ice.
|
|
65091
|
+
//
|
|
65092
|
+
// it's ok for this to be a bit slow, it's a rare operation.
|
|
65093
|
+
const age = Date.now() - entry.start;
|
|
65094
|
+
entry.start = perf.now() - age;
|
|
65095
|
+
}
|
|
65096
|
+
this.set(key, entry.value, entry);
|
|
65097
|
+
}
|
|
65098
|
+
}
|
|
65099
|
+
/**
|
|
65100
|
+
* Add a value to the cache.
|
|
65101
|
+
*
|
|
65102
|
+
* Note: if `undefined` is specified as a value, this is an alias for
|
|
65103
|
+
* {@link LRUCache#delete}
|
|
65104
|
+
*
|
|
65105
|
+
* Fields on the {@link LRUCache.SetOptions} options param will override
|
|
65106
|
+
* their corresponding values in the constructor options for the scope
|
|
65107
|
+
* of this single `set()` operation.
|
|
65108
|
+
*
|
|
65109
|
+
* If `start` is provided, then that will set the effective start
|
|
65110
|
+
* time for the TTL calculation. Note that this must be a previous
|
|
65111
|
+
* value of `performance.now()` if supported, or a previous value of
|
|
65112
|
+
* `Date.now()` if not.
|
|
65113
|
+
*
|
|
65114
|
+
* Options object may also include `size`, which will prevent
|
|
65115
|
+
* calling the `sizeCalculation` function and just use the specified
|
|
65116
|
+
* number if it is a positive integer, and `noDisposeOnSet` which
|
|
65117
|
+
* will prevent calling a `dispose` function in the case of
|
|
65118
|
+
* overwrites.
|
|
65119
|
+
*
|
|
65120
|
+
* If the `size` (or return value of `sizeCalculation`) for a given
|
|
65121
|
+
* entry is greater than `maxEntrySize`, then the item will not be
|
|
65122
|
+
* added to the cache.
|
|
65123
|
+
*
|
|
65124
|
+
* Will update the recency of the entry.
|
|
65125
|
+
*
|
|
65126
|
+
* If the value is `undefined`, then this is an alias for
|
|
65127
|
+
* `cache.delete(key)`. `undefined` is never stored in the cache.
|
|
65128
|
+
*/
|
|
65129
|
+
set(k, v, setOptions = {}) {
|
|
65130
|
+
if (v === undefined) {
|
|
65131
|
+
this.delete(k);
|
|
65132
|
+
return this;
|
|
65133
|
+
}
|
|
65134
|
+
const {
|
|
65135
|
+
ttl = this.ttl,
|
|
65136
|
+
start,
|
|
65137
|
+
noDisposeOnSet = this.noDisposeOnSet,
|
|
65138
|
+
sizeCalculation = this.sizeCalculation,
|
|
65139
|
+
status
|
|
65140
|
+
} = setOptions;
|
|
65141
|
+
let {
|
|
65142
|
+
noUpdateTTL = this.noUpdateTTL
|
|
65143
|
+
} = setOptions;
|
|
65144
|
+
const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
|
|
65145
|
+
// if the item doesn't fit, don't do anything
|
|
65146
|
+
// NB: maxEntrySize set to maxSize by default
|
|
65147
|
+
if (this.maxEntrySize && size > this.maxEntrySize) {
|
|
65148
|
+
if (status) {
|
|
65149
|
+
status.set = 'miss';
|
|
65150
|
+
status.maxEntrySizeExceeded = true;
|
|
65151
|
+
}
|
|
65152
|
+
// have to delete, in case something is there already.
|
|
65153
|
+
this.#delete(k, 'set');
|
|
65154
|
+
return this;
|
|
65155
|
+
}
|
|
65156
|
+
let index = this.#size === 0 ? undefined : this.#keyMap.get(k);
|
|
65157
|
+
if (index === undefined) {
|
|
65158
|
+
// addition
|
|
65159
|
+
index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
|
|
65160
|
+
this.#keyList[index] = k;
|
|
65161
|
+
this.#valList[index] = v;
|
|
65162
|
+
this.#keyMap.set(k, index);
|
|
65163
|
+
this.#next[this.#tail] = index;
|
|
65164
|
+
this.#prev[index] = this.#tail;
|
|
65165
|
+
this.#tail = index;
|
|
65166
|
+
this.#size++;
|
|
65167
|
+
this.#addItemSize(index, size, status);
|
|
65168
|
+
if (status) status.set = 'add';
|
|
65169
|
+
noUpdateTTL = false;
|
|
65170
|
+
} else {
|
|
65171
|
+
// update
|
|
65172
|
+
this.#moveToTail(index);
|
|
65173
|
+
const oldVal = this.#valList[index];
|
|
65174
|
+
if (v !== oldVal) {
|
|
65175
|
+
if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
|
|
65176
|
+
oldVal.__abortController.abort(new Error('replaced'));
|
|
65177
|
+
const {
|
|
65178
|
+
__staleWhileFetching: s
|
|
65179
|
+
} = oldVal;
|
|
65180
|
+
if (s !== undefined && !noDisposeOnSet) {
|
|
65181
|
+
if (this.#hasDispose) {
|
|
65182
|
+
this.#dispose?.(s, k, 'set');
|
|
65183
|
+
}
|
|
65184
|
+
if (this.#hasDisposeAfter) {
|
|
65185
|
+
this.#disposed?.push([s, k, 'set']);
|
|
65186
|
+
}
|
|
65187
|
+
}
|
|
65188
|
+
} else if (!noDisposeOnSet) {
|
|
65189
|
+
if (this.#hasDispose) {
|
|
65190
|
+
this.#dispose?.(oldVal, k, 'set');
|
|
65191
|
+
}
|
|
65192
|
+
if (this.#hasDisposeAfter) {
|
|
65193
|
+
this.#disposed?.push([oldVal, k, 'set']);
|
|
65194
|
+
}
|
|
65195
|
+
}
|
|
65196
|
+
this.#removeItemSize(index);
|
|
65197
|
+
this.#addItemSize(index, size, status);
|
|
65198
|
+
this.#valList[index] = v;
|
|
65199
|
+
if (status) {
|
|
65200
|
+
status.set = 'replace';
|
|
65201
|
+
const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
|
|
65202
|
+
if (oldValue !== undefined) status.oldValue = oldValue;
|
|
65203
|
+
}
|
|
65204
|
+
} else if (status) {
|
|
65205
|
+
status.set = 'update';
|
|
65206
|
+
}
|
|
65207
|
+
}
|
|
65208
|
+
if (ttl !== 0 && !this.#ttls) {
|
|
65209
|
+
this.#initializeTTLTracking();
|
|
65210
|
+
}
|
|
65211
|
+
if (this.#ttls) {
|
|
65212
|
+
if (!noUpdateTTL) {
|
|
65213
|
+
this.#setItemTTL(index, ttl, start);
|
|
65214
|
+
}
|
|
65215
|
+
if (status) this.#statusTTL(status, index);
|
|
65216
|
+
}
|
|
65217
|
+
if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
|
|
65218
|
+
const dt = this.#disposed;
|
|
65219
|
+
let task;
|
|
65220
|
+
while (task = dt?.shift()) {
|
|
65221
|
+
this.#disposeAfter?.(...task);
|
|
65222
|
+
}
|
|
65223
|
+
}
|
|
65224
|
+
return this;
|
|
65225
|
+
}
|
|
65226
|
+
/**
|
|
65227
|
+
* Evict the least recently used item, returning its value or
|
|
65228
|
+
* `undefined` if cache is empty.
|
|
65229
|
+
*/
|
|
65230
|
+
pop() {
|
|
65231
|
+
try {
|
|
65232
|
+
while (this.#size) {
|
|
65233
|
+
const val = this.#valList[this.#head];
|
|
65234
|
+
this.#evict(true);
|
|
65235
|
+
if (this.#isBackgroundFetch(val)) {
|
|
65236
|
+
if (val.__staleWhileFetching) {
|
|
65237
|
+
return val.__staleWhileFetching;
|
|
65238
|
+
}
|
|
65239
|
+
} else if (val !== undefined) {
|
|
65240
|
+
return val;
|
|
65241
|
+
}
|
|
65242
|
+
}
|
|
65243
|
+
} finally {
|
|
65244
|
+
if (this.#hasDisposeAfter && this.#disposed) {
|
|
65245
|
+
const dt = this.#disposed;
|
|
65246
|
+
let task;
|
|
65247
|
+
while (task = dt?.shift()) {
|
|
65248
|
+
this.#disposeAfter?.(...task);
|
|
65249
|
+
}
|
|
65250
|
+
}
|
|
65251
|
+
}
|
|
65252
|
+
}
|
|
65253
|
+
#evict(free) {
|
|
65254
|
+
const head = this.#head;
|
|
65255
|
+
const k = this.#keyList[head];
|
|
65256
|
+
const v = this.#valList[head];
|
|
65257
|
+
if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
|
|
65258
|
+
v.__abortController.abort(new Error('evicted'));
|
|
65259
|
+
} else if (this.#hasDispose || this.#hasDisposeAfter) {
|
|
65260
|
+
if (this.#hasDispose) {
|
|
65261
|
+
this.#dispose?.(v, k, 'evict');
|
|
65262
|
+
}
|
|
65263
|
+
if (this.#hasDisposeAfter) {
|
|
65264
|
+
this.#disposed?.push([v, k, 'evict']);
|
|
65265
|
+
}
|
|
65266
|
+
}
|
|
65267
|
+
this.#removeItemSize(head);
|
|
65268
|
+
// if we aren't about to use the index, then null these out
|
|
65269
|
+
if (free) {
|
|
65270
|
+
this.#keyList[head] = undefined;
|
|
65271
|
+
this.#valList[head] = undefined;
|
|
65272
|
+
this.#free.push(head);
|
|
65273
|
+
}
|
|
65274
|
+
if (this.#size === 1) {
|
|
65275
|
+
this.#head = this.#tail = 0;
|
|
65276
|
+
this.#free.length = 0;
|
|
65277
|
+
} else {
|
|
65278
|
+
this.#head = this.#next[head];
|
|
65279
|
+
}
|
|
65280
|
+
this.#keyMap.delete(k);
|
|
65281
|
+
this.#size--;
|
|
65282
|
+
return head;
|
|
65283
|
+
}
|
|
65284
|
+
/**
|
|
65285
|
+
* Check if a key is in the cache, without updating the recency of use.
|
|
65286
|
+
* Will return false if the item is stale, even though it is technically
|
|
65287
|
+
* in the cache.
|
|
65288
|
+
*
|
|
65289
|
+
* Check if a key is in the cache, without updating the recency of
|
|
65290
|
+
* use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
|
|
65291
|
+
* to `true` in either the options or the constructor.
|
|
65292
|
+
*
|
|
65293
|
+
* Will return `false` if the item is stale, even though it is technically in
|
|
65294
|
+
* the cache. The difference can be determined (if it matters) by using a
|
|
65295
|
+
* `status` argument, and inspecting the `has` field.
|
|
65296
|
+
*
|
|
65297
|
+
* Will not update item age unless
|
|
65298
|
+
* {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
|
|
65299
|
+
*/
|
|
65300
|
+
has(k, hasOptions = {}) {
|
|
65301
|
+
const {
|
|
65302
|
+
updateAgeOnHas = this.updateAgeOnHas,
|
|
65303
|
+
status
|
|
65304
|
+
} = hasOptions;
|
|
65305
|
+
const index = this.#keyMap.get(k);
|
|
65306
|
+
if (index !== undefined) {
|
|
65307
|
+
const v = this.#valList[index];
|
|
65308
|
+
if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === undefined) {
|
|
65309
|
+
return false;
|
|
65310
|
+
}
|
|
65311
|
+
if (!this.#isStale(index)) {
|
|
65312
|
+
if (updateAgeOnHas) {
|
|
65313
|
+
this.#updateItemAge(index);
|
|
65314
|
+
}
|
|
65315
|
+
if (status) {
|
|
65316
|
+
status.has = 'hit';
|
|
65317
|
+
this.#statusTTL(status, index);
|
|
65318
|
+
}
|
|
65319
|
+
return true;
|
|
65320
|
+
} else if (status) {
|
|
65321
|
+
status.has = 'stale';
|
|
65322
|
+
this.#statusTTL(status, index);
|
|
65323
|
+
}
|
|
65324
|
+
} else if (status) {
|
|
65325
|
+
status.has = 'miss';
|
|
65326
|
+
}
|
|
65327
|
+
return false;
|
|
65328
|
+
}
|
|
65329
|
+
/**
|
|
65330
|
+
* Like {@link LRUCache#get} but doesn't update recency or delete stale
|
|
65331
|
+
* items.
|
|
65332
|
+
*
|
|
65333
|
+
* Returns `undefined` if the item is stale, unless
|
|
65334
|
+
* {@link LRUCache.OptionsBase.allowStale} is set.
|
|
65335
|
+
*/
|
|
65336
|
+
peek(k, peekOptions = {}) {
|
|
65337
|
+
const {
|
|
65338
|
+
allowStale = this.allowStale
|
|
65339
|
+
} = peekOptions;
|
|
65340
|
+
const index = this.#keyMap.get(k);
|
|
65341
|
+
if (index === undefined || !allowStale && this.#isStale(index)) {
|
|
65342
|
+
return;
|
|
65343
|
+
}
|
|
65344
|
+
const v = this.#valList[index];
|
|
65345
|
+
// either stale and allowed, or forcing a refresh of non-stale value
|
|
65346
|
+
return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
65347
|
+
}
|
|
65348
|
+
#backgroundFetch(k, index, options, context) {
|
|
65349
|
+
const v = index === undefined ? undefined : this.#valList[index];
|
|
65350
|
+
if (this.#isBackgroundFetch(v)) {
|
|
65351
|
+
return v;
|
|
65352
|
+
}
|
|
65353
|
+
const ac = new AC();
|
|
65354
|
+
const {
|
|
65355
|
+
signal
|
|
65356
|
+
} = options;
|
|
65357
|
+
// when/if our AC signals, then stop listening to theirs.
|
|
65358
|
+
signal?.addEventListener('abort', () => ac.abort(signal.reason), {
|
|
65359
|
+
signal: ac.signal
|
|
65360
|
+
});
|
|
65361
|
+
const fetchOpts = {
|
|
65362
|
+
signal: ac.signal,
|
|
65363
|
+
options,
|
|
65364
|
+
context
|
|
65365
|
+
};
|
|
65366
|
+
const cb = (v, updateCache = false) => {
|
|
65367
|
+
const {
|
|
65368
|
+
aborted
|
|
65369
|
+
} = ac.signal;
|
|
65370
|
+
const ignoreAbort = options.ignoreFetchAbort && v !== undefined;
|
|
65371
|
+
if (options.status) {
|
|
65372
|
+
if (aborted && !updateCache) {
|
|
65373
|
+
options.status.fetchAborted = true;
|
|
65374
|
+
options.status.fetchError = ac.signal.reason;
|
|
65375
|
+
if (ignoreAbort) options.status.fetchAbortIgnored = true;
|
|
65376
|
+
} else {
|
|
65377
|
+
options.status.fetchResolved = true;
|
|
65378
|
+
}
|
|
65379
|
+
}
|
|
65380
|
+
if (aborted && !ignoreAbort && !updateCache) {
|
|
65381
|
+
return fetchFail(ac.signal.reason);
|
|
65382
|
+
}
|
|
65383
|
+
// either we didn't abort, and are still here, or we did, and ignored
|
|
65384
|
+
const bf = p;
|
|
65385
|
+
if (this.#valList[index] === p) {
|
|
65386
|
+
if (v === undefined) {
|
|
65387
|
+
if (bf.__staleWhileFetching) {
|
|
65388
|
+
this.#valList[index] = bf.__staleWhileFetching;
|
|
65389
|
+
} else {
|
|
65390
|
+
this.#delete(k, 'fetch');
|
|
65391
|
+
}
|
|
65392
|
+
} else {
|
|
65393
|
+
if (options.status) options.status.fetchUpdated = true;
|
|
65394
|
+
this.set(k, v, fetchOpts.options);
|
|
65395
|
+
}
|
|
65396
|
+
}
|
|
65397
|
+
return v;
|
|
65398
|
+
};
|
|
65399
|
+
const eb = er => {
|
|
65400
|
+
if (options.status) {
|
|
65401
|
+
options.status.fetchRejected = true;
|
|
65402
|
+
options.status.fetchError = er;
|
|
65403
|
+
}
|
|
65404
|
+
return fetchFail(er);
|
|
65405
|
+
};
|
|
65406
|
+
const fetchFail = er => {
|
|
65407
|
+
const {
|
|
65408
|
+
aborted
|
|
65409
|
+
} = ac.signal;
|
|
65410
|
+
const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
|
|
65411
|
+
const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
|
|
65412
|
+
const noDelete = allowStale || options.noDeleteOnFetchRejection;
|
|
65413
|
+
const bf = p;
|
|
65414
|
+
if (this.#valList[index] === p) {
|
|
65415
|
+
// if we allow stale on fetch rejections, then we need to ensure that
|
|
65416
|
+
// the stale value is not removed from the cache when the fetch fails.
|
|
65417
|
+
const del = !noDelete || bf.__staleWhileFetching === undefined;
|
|
65418
|
+
if (del) {
|
|
65419
|
+
this.#delete(k, 'fetch');
|
|
65420
|
+
} else if (!allowStaleAborted) {
|
|
65421
|
+
// still replace the *promise* with the stale value,
|
|
65422
|
+
// since we are done with the promise at this point.
|
|
65423
|
+
// leave it untouched if we're still waiting for an
|
|
65424
|
+
// aborted background fetch that hasn't yet returned.
|
|
65425
|
+
this.#valList[index] = bf.__staleWhileFetching;
|
|
65426
|
+
}
|
|
65427
|
+
}
|
|
65428
|
+
if (allowStale) {
|
|
65429
|
+
if (options.status && bf.__staleWhileFetching !== undefined) {
|
|
65430
|
+
options.status.returnedStale = true;
|
|
65431
|
+
}
|
|
65432
|
+
return bf.__staleWhileFetching;
|
|
65433
|
+
} else if (bf.__returned === bf) {
|
|
65434
|
+
throw er;
|
|
65435
|
+
}
|
|
65436
|
+
};
|
|
65437
|
+
const pcall = (res, rej) => {
|
|
65438
|
+
const fmp = this.#fetchMethod?.(k, v, fetchOpts);
|
|
65439
|
+
if (fmp && fmp instanceof Promise) {
|
|
65440
|
+
fmp.then(v => res(v === undefined ? undefined : v), rej);
|
|
65441
|
+
}
|
|
65442
|
+
// ignored, we go until we finish, regardless.
|
|
65443
|
+
// defer check until we are actually aborting,
|
|
65444
|
+
// so fetchMethod can override.
|
|
65445
|
+
ac.signal.addEventListener('abort', () => {
|
|
65446
|
+
if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
|
|
65447
|
+
res(undefined);
|
|
65448
|
+
// when it eventually resolves, update the cache.
|
|
65449
|
+
if (options.allowStaleOnFetchAbort) {
|
|
65450
|
+
res = v => cb(v, true);
|
|
65451
|
+
}
|
|
65452
|
+
}
|
|
65453
|
+
});
|
|
65454
|
+
};
|
|
65455
|
+
if (options.status) options.status.fetchDispatched = true;
|
|
65456
|
+
const p = new Promise(pcall).then(cb, eb);
|
|
65457
|
+
const bf = Object.assign(p, {
|
|
65458
|
+
__abortController: ac,
|
|
65459
|
+
__staleWhileFetching: v,
|
|
65460
|
+
__returned: undefined
|
|
65461
|
+
});
|
|
65462
|
+
if (index === undefined) {
|
|
65463
|
+
// internal, don't expose status.
|
|
65464
|
+
this.set(k, bf, {
|
|
65465
|
+
...fetchOpts.options,
|
|
65466
|
+
status: undefined
|
|
65467
|
+
});
|
|
65468
|
+
index = this.#keyMap.get(k);
|
|
65469
|
+
} else {
|
|
65470
|
+
this.#valList[index] = bf;
|
|
65471
|
+
}
|
|
65472
|
+
return bf;
|
|
65473
|
+
}
|
|
65474
|
+
#isBackgroundFetch(p) {
|
|
65475
|
+
if (!this.#hasFetchMethod) return false;
|
|
65476
|
+
const b = p;
|
|
65477
|
+
return !!b && b instanceof Promise && b.hasOwnProperty('__staleWhileFetching') && b.__abortController instanceof AC;
|
|
65478
|
+
}
|
|
65479
|
+
async fetch(k, fetchOptions = {}) {
|
|
65480
|
+
const {
|
|
65481
|
+
// get options
|
|
65482
|
+
allowStale = this.allowStale,
|
|
65483
|
+
updateAgeOnGet = this.updateAgeOnGet,
|
|
65484
|
+
noDeleteOnStaleGet = this.noDeleteOnStaleGet,
|
|
65485
|
+
// set options
|
|
65486
|
+
ttl = this.ttl,
|
|
65487
|
+
noDisposeOnSet = this.noDisposeOnSet,
|
|
65488
|
+
size = 0,
|
|
65489
|
+
sizeCalculation = this.sizeCalculation,
|
|
65490
|
+
noUpdateTTL = this.noUpdateTTL,
|
|
65491
|
+
// fetch exclusive options
|
|
65492
|
+
noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
|
|
65493
|
+
allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
|
|
65494
|
+
ignoreFetchAbort = this.ignoreFetchAbort,
|
|
65495
|
+
allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
|
|
65496
|
+
context,
|
|
65497
|
+
forceRefresh = false,
|
|
65498
|
+
status,
|
|
65499
|
+
signal
|
|
65500
|
+
} = fetchOptions;
|
|
65501
|
+
if (!this.#hasFetchMethod) {
|
|
65502
|
+
if (status) status.fetch = 'get';
|
|
65503
|
+
return this.get(k, {
|
|
65504
|
+
allowStale,
|
|
65505
|
+
updateAgeOnGet,
|
|
65506
|
+
noDeleteOnStaleGet,
|
|
65507
|
+
status
|
|
65508
|
+
});
|
|
65509
|
+
}
|
|
65510
|
+
const options = {
|
|
65511
|
+
allowStale,
|
|
65512
|
+
updateAgeOnGet,
|
|
65513
|
+
noDeleteOnStaleGet,
|
|
65514
|
+
ttl,
|
|
65515
|
+
noDisposeOnSet,
|
|
65516
|
+
size,
|
|
65517
|
+
sizeCalculation,
|
|
65518
|
+
noUpdateTTL,
|
|
65519
|
+
noDeleteOnFetchRejection,
|
|
65520
|
+
allowStaleOnFetchRejection,
|
|
65521
|
+
allowStaleOnFetchAbort,
|
|
65522
|
+
ignoreFetchAbort,
|
|
65523
|
+
status,
|
|
65524
|
+
signal
|
|
65525
|
+
};
|
|
65526
|
+
let index = this.#keyMap.get(k);
|
|
65527
|
+
if (index === undefined) {
|
|
65528
|
+
if (status) status.fetch = 'miss';
|
|
65529
|
+
const p = this.#backgroundFetch(k, index, options, context);
|
|
65530
|
+
return p.__returned = p;
|
|
65531
|
+
} else {
|
|
65532
|
+
// in cache, maybe already fetching
|
|
65533
|
+
const v = this.#valList[index];
|
|
65534
|
+
if (this.#isBackgroundFetch(v)) {
|
|
65535
|
+
const stale = allowStale && v.__staleWhileFetching !== undefined;
|
|
65536
|
+
if (status) {
|
|
65537
|
+
status.fetch = 'inflight';
|
|
65538
|
+
if (stale) status.returnedStale = true;
|
|
65539
|
+
}
|
|
65540
|
+
return stale ? v.__staleWhileFetching : v.__returned = v;
|
|
65541
|
+
}
|
|
65542
|
+
// if we force a refresh, that means do NOT serve the cached value,
|
|
65543
|
+
// unless we are already in the process of refreshing the cache.
|
|
65544
|
+
const isStale = this.#isStale(index);
|
|
65545
|
+
if (!forceRefresh && !isStale) {
|
|
65546
|
+
if (status) status.fetch = 'hit';
|
|
65547
|
+
this.#moveToTail(index);
|
|
65548
|
+
if (updateAgeOnGet) {
|
|
65549
|
+
this.#updateItemAge(index);
|
|
65550
|
+
}
|
|
65551
|
+
if (status) this.#statusTTL(status, index);
|
|
65552
|
+
return v;
|
|
65553
|
+
}
|
|
65554
|
+
// ok, it is stale or a forced refresh, and not already fetching.
|
|
65555
|
+
// refresh the cache.
|
|
65556
|
+
const p = this.#backgroundFetch(k, index, options, context);
|
|
65557
|
+
const hasStale = p.__staleWhileFetching !== undefined;
|
|
65558
|
+
const staleVal = hasStale && allowStale;
|
|
65559
|
+
if (status) {
|
|
65560
|
+
status.fetch = isStale ? 'stale' : 'refresh';
|
|
65561
|
+
if (staleVal && isStale) status.returnedStale = true;
|
|
65562
|
+
}
|
|
65563
|
+
return staleVal ? p.__staleWhileFetching : p.__returned = p;
|
|
65564
|
+
}
|
|
65565
|
+
}
|
|
65566
|
+
async forceFetch(k, fetchOptions = {}) {
|
|
65567
|
+
const v = await this.fetch(k, fetchOptions);
|
|
65568
|
+
if (v === undefined) throw new Error('fetch() returned undefined');
|
|
65569
|
+
return v;
|
|
65570
|
+
}
|
|
65571
|
+
memo(k, memoOptions = {}) {
|
|
65572
|
+
const memoMethod = this.#memoMethod;
|
|
65573
|
+
if (!memoMethod) {
|
|
65574
|
+
throw new Error('no memoMethod provided to constructor');
|
|
65575
|
+
}
|
|
65576
|
+
const {
|
|
65577
|
+
context,
|
|
65578
|
+
forceRefresh,
|
|
65579
|
+
...options
|
|
65580
|
+
} = memoOptions;
|
|
65581
|
+
const v = this.get(k, options);
|
|
65582
|
+
if (!forceRefresh && v !== undefined) return v;
|
|
65583
|
+
const vv = memoMethod(k, v, {
|
|
65584
|
+
options,
|
|
65585
|
+
context
|
|
65586
|
+
});
|
|
65587
|
+
this.set(k, vv, options);
|
|
65588
|
+
return vv;
|
|
65589
|
+
}
|
|
65590
|
+
/**
|
|
65591
|
+
* Return a value from the cache. Will update the recency of the cache
|
|
65592
|
+
* entry found.
|
|
65593
|
+
*
|
|
65594
|
+
* If the key is not found, get() will return `undefined`.
|
|
65595
|
+
*/
|
|
65596
|
+
get(k, getOptions = {}) {
|
|
65597
|
+
const {
|
|
65598
|
+
allowStale = this.allowStale,
|
|
65599
|
+
updateAgeOnGet = this.updateAgeOnGet,
|
|
65600
|
+
noDeleteOnStaleGet = this.noDeleteOnStaleGet,
|
|
65601
|
+
status
|
|
65602
|
+
} = getOptions;
|
|
65603
|
+
const index = this.#keyMap.get(k);
|
|
65604
|
+
if (index !== undefined) {
|
|
65605
|
+
const value = this.#valList[index];
|
|
65606
|
+
const fetching = this.#isBackgroundFetch(value);
|
|
65607
|
+
if (status) this.#statusTTL(status, index);
|
|
65608
|
+
if (this.#isStale(index)) {
|
|
65609
|
+
if (status) status.get = 'stale';
|
|
65610
|
+
// delete only if not an in-flight background fetch
|
|
65611
|
+
if (!fetching) {
|
|
65612
|
+
if (!noDeleteOnStaleGet) {
|
|
65613
|
+
this.#delete(k, 'expire');
|
|
65614
|
+
}
|
|
65615
|
+
if (status && allowStale) status.returnedStale = true;
|
|
65616
|
+
return allowStale ? value : undefined;
|
|
65617
|
+
} else {
|
|
65618
|
+
if (status && allowStale && value.__staleWhileFetching !== undefined) {
|
|
65619
|
+
status.returnedStale = true;
|
|
65620
|
+
}
|
|
65621
|
+
return allowStale ? value.__staleWhileFetching : undefined;
|
|
65622
|
+
}
|
|
65623
|
+
} else {
|
|
65624
|
+
if (status) status.get = 'hit';
|
|
65625
|
+
// if we're currently fetching it, we don't actually have it yet
|
|
65626
|
+
// it's not stale, which means this isn't a staleWhileRefetching.
|
|
65627
|
+
// If it's not stale, and fetching, AND has a __staleWhileFetching
|
|
65628
|
+
// value, then that means the user fetched with {forceRefresh:true},
|
|
65629
|
+
// so it's safe to return that value.
|
|
65630
|
+
if (fetching) {
|
|
65631
|
+
return value.__staleWhileFetching;
|
|
65632
|
+
}
|
|
65633
|
+
this.#moveToTail(index);
|
|
65634
|
+
if (updateAgeOnGet) {
|
|
65635
|
+
this.#updateItemAge(index);
|
|
65636
|
+
}
|
|
65637
|
+
return value;
|
|
65638
|
+
}
|
|
65639
|
+
} else if (status) {
|
|
65640
|
+
status.get = 'miss';
|
|
65641
|
+
}
|
|
65642
|
+
}
|
|
65643
|
+
#connect(p, n) {
|
|
65644
|
+
this.#prev[n] = p;
|
|
65645
|
+
this.#next[p] = n;
|
|
65646
|
+
}
|
|
65647
|
+
#moveToTail(index) {
|
|
65648
|
+
// if tail already, nothing to do
|
|
65649
|
+
// if head, move head to next[index]
|
|
65650
|
+
// else
|
|
65651
|
+
// move next[prev[index]] to next[index] (head has no prev)
|
|
65652
|
+
// move prev[next[index]] to prev[index]
|
|
65653
|
+
// prev[index] = tail
|
|
65654
|
+
// next[tail] = index
|
|
65655
|
+
// tail = index
|
|
65656
|
+
if (index !== this.#tail) {
|
|
65657
|
+
if (index === this.#head) {
|
|
65658
|
+
this.#head = this.#next[index];
|
|
65659
|
+
} else {
|
|
65660
|
+
this.#connect(this.#prev[index], this.#next[index]);
|
|
65661
|
+
}
|
|
65662
|
+
this.#connect(this.#tail, index);
|
|
65663
|
+
this.#tail = index;
|
|
65664
|
+
}
|
|
65665
|
+
}
|
|
65666
|
+
/**
|
|
65667
|
+
* Deletes a key out of the cache.
|
|
65668
|
+
*
|
|
65669
|
+
* Returns true if the key was deleted, false otherwise.
|
|
65670
|
+
*/
|
|
65671
|
+
delete(k) {
|
|
65672
|
+
return this.#delete(k, 'delete');
|
|
65673
|
+
}
|
|
65674
|
+
#delete(k, reason) {
|
|
65675
|
+
let deleted = false;
|
|
65676
|
+
if (this.#size !== 0) {
|
|
65677
|
+
const index = this.#keyMap.get(k);
|
|
65678
|
+
if (index !== undefined) {
|
|
65679
|
+
deleted = true;
|
|
65680
|
+
if (this.#size === 1) {
|
|
65681
|
+
this.#clear(reason);
|
|
65682
|
+
} else {
|
|
65683
|
+
this.#removeItemSize(index);
|
|
65684
|
+
const v = this.#valList[index];
|
|
65685
|
+
if (this.#isBackgroundFetch(v)) {
|
|
65686
|
+
v.__abortController.abort(new Error('deleted'));
|
|
65687
|
+
} else if (this.#hasDispose || this.#hasDisposeAfter) {
|
|
65688
|
+
if (this.#hasDispose) {
|
|
65689
|
+
this.#dispose?.(v, k, reason);
|
|
65690
|
+
}
|
|
65691
|
+
if (this.#hasDisposeAfter) {
|
|
65692
|
+
this.#disposed?.push([v, k, reason]);
|
|
65693
|
+
}
|
|
65694
|
+
}
|
|
65695
|
+
this.#keyMap.delete(k);
|
|
65696
|
+
this.#keyList[index] = undefined;
|
|
65697
|
+
this.#valList[index] = undefined;
|
|
65698
|
+
if (index === this.#tail) {
|
|
65699
|
+
this.#tail = this.#prev[index];
|
|
65700
|
+
} else if (index === this.#head) {
|
|
65701
|
+
this.#head = this.#next[index];
|
|
65702
|
+
} else {
|
|
65703
|
+
const pi = this.#prev[index];
|
|
65704
|
+
this.#next[pi] = this.#next[index];
|
|
65705
|
+
const ni = this.#next[index];
|
|
65706
|
+
this.#prev[ni] = this.#prev[index];
|
|
65707
|
+
}
|
|
65708
|
+
this.#size--;
|
|
65709
|
+
this.#free.push(index);
|
|
64056
65710
|
}
|
|
64057
65711
|
}
|
|
64058
|
-
// didn't get any hits. this is success if it's a negative
|
|
64059
|
-
// pattern, failure otherwise.
|
|
64060
|
-
if (options.flipNegate) {
|
|
64061
|
-
return false;
|
|
64062
|
-
}
|
|
64063
|
-
return this.negate;
|
|
64064
65712
|
}
|
|
64065
|
-
|
|
64066
|
-
|
|
65713
|
+
if (this.#hasDisposeAfter && this.#disposed?.length) {
|
|
65714
|
+
const dt = this.#disposed;
|
|
65715
|
+
let task;
|
|
65716
|
+
while (task = dt?.shift()) {
|
|
65717
|
+
this.#disposeAfter?.(...task);
|
|
65718
|
+
}
|
|
64067
65719
|
}
|
|
65720
|
+
return deleted;
|
|
64068
65721
|
}
|
|
64069
|
-
|
|
64070
|
-
|
|
64071
|
-
|
|
64072
|
-
|
|
64073
|
-
|
|
64074
|
-
|
|
64075
|
-
|
|
65722
|
+
/**
|
|
65723
|
+
* Clear the cache entirely, throwing away all values.
|
|
65724
|
+
*/
|
|
65725
|
+
clear() {
|
|
65726
|
+
return this.#clear('delete');
|
|
65727
|
+
}
|
|
65728
|
+
#clear(reason) {
|
|
65729
|
+
for (const index of this.#rindexes({
|
|
65730
|
+
allowStale: true
|
|
65731
|
+
})) {
|
|
65732
|
+
const v = this.#valList[index];
|
|
65733
|
+
if (this.#isBackgroundFetch(v)) {
|
|
65734
|
+
v.__abortController.abort(new Error('deleted'));
|
|
65735
|
+
} else {
|
|
65736
|
+
const k = this.#keyList[index];
|
|
65737
|
+
if (this.#hasDispose) {
|
|
65738
|
+
this.#dispose?.(v, k, reason);
|
|
65739
|
+
}
|
|
65740
|
+
if (this.#hasDisposeAfter) {
|
|
65741
|
+
this.#disposed?.push([v, k, reason]);
|
|
65742
|
+
}
|
|
65743
|
+
}
|
|
64076
65744
|
}
|
|
64077
|
-
|
|
64078
|
-
|
|
64079
|
-
|
|
64080
|
-
|
|
64081
|
-
|
|
64082
|
-
|
|
65745
|
+
this.#keyMap.clear();
|
|
65746
|
+
this.#valList.fill(undefined);
|
|
65747
|
+
this.#keyList.fill(undefined);
|
|
65748
|
+
if (this.#ttls && this.#starts) {
|
|
65749
|
+
this.#ttls.fill(0);
|
|
65750
|
+
this.#starts.fill(0);
|
|
64083
65751
|
}
|
|
64084
|
-
|
|
64085
|
-
|
|
64086
|
-
Object.defineProperty(exports, "unescape", {
|
|
64087
|
-
enumerable: true,
|
|
64088
|
-
get: function () {
|
|
64089
|
-
return unescape_js_2.unescape;
|
|
65752
|
+
if (this.#sizes) {
|
|
65753
|
+
this.#sizes.fill(0);
|
|
64090
65754
|
}
|
|
64091
|
-
|
|
64092
|
-
|
|
64093
|
-
|
|
64094
|
-
|
|
64095
|
-
|
|
64096
|
-
|
|
64097
|
-
|
|
65755
|
+
this.#head = 0;
|
|
65756
|
+
this.#tail = 0;
|
|
65757
|
+
this.#free.length = 0;
|
|
65758
|
+
this.#calculatedSize = 0;
|
|
65759
|
+
this.#size = 0;
|
|
65760
|
+
if (this.#hasDisposeAfter && this.#disposed) {
|
|
65761
|
+
const dt = this.#disposed;
|
|
65762
|
+
let task;
|
|
65763
|
+
while (task = dt?.shift()) {
|
|
65764
|
+
this.#disposeAfter?.(...task);
|
|
65765
|
+
}
|
|
65766
|
+
}
|
|
65767
|
+
}
|
|
65768
|
+
}
|
|
65769
|
+
commonjs$f.LRUCache = LRUCache;
|
|
64098
65770
|
return commonjs$f;
|
|
64099
65771
|
}
|
|
64100
65772
|
|
|
64101
|
-
|
|
64102
|
-
var
|
|
64103
|
-
|
|
64104
|
-
|
|
64105
|
-
|
|
64106
|
-
|
|
65773
|
+
/* eslint-disable max-len */
|
|
65774
|
+
var hosts_1;
|
|
65775
|
+
var hasRequiredHosts;
|
|
65776
|
+
function requireHosts() {
|
|
65777
|
+
if (hasRequiredHosts) return hosts_1;
|
|
65778
|
+
hasRequiredHosts = 1;
|
|
65779
|
+
const maybeJoin = (...args) => args.every(arg => arg) ? args.join('') : '';
|
|
65780
|
+
const maybeEncode = arg => arg ? encodeURIComponent(arg) : '';
|
|
65781
|
+
const formatHashFragment = f => f.toLowerCase().replace(/^\W+/g, '') // strip leading non-characters
|
|
65782
|
+
.replace(/(?<!\W)\W+$/, '') // strip trailing non-characters
|
|
65783
|
+
.replace(/\//g, '') // strip all slashes
|
|
65784
|
+
.replace(/\W+/g, '-'); // replace remaining non-characters with '-'
|
|
64107
65785
|
|
|
64108
|
-
|
|
64109
|
-
|
|
64110
|
-
|
|
64111
|
-
|
|
64112
|
-
|
|
64113
|
-
|
|
64114
|
-
|
|
64115
|
-
|
|
65786
|
+
const defaults = {
|
|
65787
|
+
sshtemplate: ({
|
|
65788
|
+
domain,
|
|
65789
|
+
user,
|
|
65790
|
+
project,
|
|
65791
|
+
committish
|
|
65792
|
+
}) => `git@${domain}:${user}/${project}.git${maybeJoin('#', committish)}`,
|
|
65793
|
+
sshurltemplate: ({
|
|
65794
|
+
domain,
|
|
65795
|
+
user,
|
|
65796
|
+
project,
|
|
65797
|
+
committish
|
|
65798
|
+
}) => `git+ssh://git@${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
|
|
65799
|
+
edittemplate: ({
|
|
65800
|
+
domain,
|
|
65801
|
+
user,
|
|
65802
|
+
project,
|
|
65803
|
+
committish,
|
|
65804
|
+
editpath,
|
|
65805
|
+
path
|
|
65806
|
+
}) => `https://${domain}/${user}/${project}${maybeJoin('/', editpath, '/', maybeEncode(committish || 'HEAD'), '/', path)}`,
|
|
65807
|
+
browsetemplate: ({
|
|
65808
|
+
domain,
|
|
65809
|
+
user,
|
|
65810
|
+
project,
|
|
65811
|
+
committish,
|
|
65812
|
+
treepath
|
|
65813
|
+
}) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}`,
|
|
65814
|
+
browsetreetemplate: ({
|
|
65815
|
+
domain,
|
|
65816
|
+
user,
|
|
65817
|
+
project,
|
|
65818
|
+
committish,
|
|
65819
|
+
treepath,
|
|
65820
|
+
path,
|
|
65821
|
+
fragment,
|
|
65822
|
+
hashformat
|
|
65823
|
+
}) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'HEAD')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,
|
|
65824
|
+
browseblobtemplate: ({
|
|
65825
|
+
domain,
|
|
65826
|
+
user,
|
|
65827
|
+
project,
|
|
65828
|
+
committish,
|
|
65829
|
+
blobpath,
|
|
65830
|
+
path,
|
|
65831
|
+
fragment,
|
|
65832
|
+
hashformat
|
|
65833
|
+
}) => `https://${domain}/${user}/${project}/${blobpath}/${maybeEncode(committish || 'HEAD')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,
|
|
65834
|
+
docstemplate: ({
|
|
65835
|
+
domain,
|
|
65836
|
+
user,
|
|
65837
|
+
project,
|
|
65838
|
+
treepath,
|
|
65839
|
+
committish
|
|
65840
|
+
}) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,
|
|
65841
|
+
httpstemplate: ({
|
|
65842
|
+
auth,
|
|
65843
|
+
domain,
|
|
65844
|
+
user,
|
|
65845
|
+
project,
|
|
65846
|
+
committish
|
|
65847
|
+
}) => `git+https://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
|
|
65848
|
+
filetemplate: ({
|
|
65849
|
+
domain,
|
|
65850
|
+
user,
|
|
65851
|
+
project,
|
|
65852
|
+
committish,
|
|
65853
|
+
path
|
|
65854
|
+
}) => `https://${domain}/${user}/${project}/raw/${maybeEncode(committish || 'HEAD')}/${path}`,
|
|
65855
|
+
shortcuttemplate: ({
|
|
65856
|
+
type,
|
|
65857
|
+
user,
|
|
65858
|
+
project,
|
|
65859
|
+
committish
|
|
65860
|
+
}) => `${type}:${user}/${project}${maybeJoin('#', committish)}`,
|
|
65861
|
+
pathtemplate: ({
|
|
65862
|
+
user,
|
|
65863
|
+
project,
|
|
65864
|
+
committish
|
|
65865
|
+
}) => `${user}/${project}${maybeJoin('#', committish)}`,
|
|
65866
|
+
bugstemplate: ({
|
|
65867
|
+
domain,
|
|
65868
|
+
user,
|
|
65869
|
+
project
|
|
65870
|
+
}) => `https://${domain}/${user}/${project}/issues`,
|
|
65871
|
+
hashformat: formatHashFragment
|
|
65872
|
+
};
|
|
65873
|
+
const hosts = {};
|
|
65874
|
+
hosts.github = {
|
|
65875
|
+
// First two are insecure and generally shouldn't be used any more, but
|
|
65876
|
+
// they are still supported.
|
|
65877
|
+
protocols: ['git:', 'http:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'],
|
|
65878
|
+
domain: 'github.com',
|
|
65879
|
+
treepath: 'tree',
|
|
65880
|
+
blobpath: 'blob',
|
|
65881
|
+
editpath: 'edit',
|
|
65882
|
+
filetemplate: ({
|
|
65883
|
+
auth,
|
|
65884
|
+
user,
|
|
65885
|
+
project,
|
|
65886
|
+
committish,
|
|
65887
|
+
path
|
|
65888
|
+
}) => `https://${maybeJoin(auth, '@')}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish || 'HEAD')}/${path}`,
|
|
65889
|
+
gittemplate: ({
|
|
65890
|
+
auth,
|
|
65891
|
+
domain,
|
|
65892
|
+
user,
|
|
65893
|
+
project,
|
|
65894
|
+
committish
|
|
65895
|
+
}) => `git://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
|
|
65896
|
+
tarballtemplate: ({
|
|
65897
|
+
domain,
|
|
65898
|
+
user,
|
|
65899
|
+
project,
|
|
65900
|
+
committish
|
|
65901
|
+
}) => `https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish || 'HEAD')}`,
|
|
65902
|
+
extract: url => {
|
|
65903
|
+
let [, user, project, type, committish] = url.pathname.split('/', 5);
|
|
65904
|
+
if (type && type !== 'tree') {
|
|
65905
|
+
return;
|
|
65906
|
+
}
|
|
65907
|
+
if (!type) {
|
|
65908
|
+
committish = url.hash.slice(1);
|
|
65909
|
+
}
|
|
65910
|
+
if (project && project.endsWith('.git')) {
|
|
65911
|
+
project = project.slice(0, -4);
|
|
65912
|
+
}
|
|
65913
|
+
if (!user || !project) {
|
|
65914
|
+
return;
|
|
64116
65915
|
}
|
|
65916
|
+
return {
|
|
65917
|
+
user,
|
|
65918
|
+
project,
|
|
65919
|
+
committish
|
|
65920
|
+
};
|
|
64117
65921
|
}
|
|
64118
|
-
return content;
|
|
64119
65922
|
};
|
|
64120
|
-
|
|
64121
|
-
|
|
64122
|
-
|
|
64123
|
-
|
|
64124
|
-
|
|
64125
|
-
|
|
64126
|
-
|
|
64127
|
-
|
|
64128
|
-
|
|
64129
|
-
|
|
64130
|
-
|
|
64131
|
-
|
|
64132
|
-
|
|
65923
|
+
hosts.bitbucket = {
|
|
65924
|
+
protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'],
|
|
65925
|
+
domain: 'bitbucket.org',
|
|
65926
|
+
treepath: 'src',
|
|
65927
|
+
blobpath: 'src',
|
|
65928
|
+
editpath: '?mode=edit',
|
|
65929
|
+
edittemplate: ({
|
|
65930
|
+
domain,
|
|
65931
|
+
user,
|
|
65932
|
+
project,
|
|
65933
|
+
committish,
|
|
65934
|
+
treepath,
|
|
65935
|
+
path,
|
|
65936
|
+
editpath
|
|
65937
|
+
}) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish || 'HEAD'), '/', path, editpath)}`,
|
|
65938
|
+
tarballtemplate: ({
|
|
65939
|
+
domain,
|
|
65940
|
+
user,
|
|
65941
|
+
project,
|
|
65942
|
+
committish
|
|
65943
|
+
}) => `https://${domain}/${user}/${project}/get/${maybeEncode(committish || 'HEAD')}.tar.gz`,
|
|
65944
|
+
extract: url => {
|
|
65945
|
+
let [, user, project, aux] = url.pathname.split('/', 4);
|
|
65946
|
+
if (['get'].includes(aux)) {
|
|
65947
|
+
return;
|
|
65948
|
+
}
|
|
65949
|
+
if (project && project.endsWith('.git')) {
|
|
65950
|
+
project = project.slice(0, -4);
|
|
65951
|
+
}
|
|
65952
|
+
if (!user || !project) {
|
|
65953
|
+
return;
|
|
65954
|
+
}
|
|
65955
|
+
return {
|
|
65956
|
+
user,
|
|
65957
|
+
project,
|
|
65958
|
+
committish: url.hash.slice(1)
|
|
65959
|
+
};
|
|
65960
|
+
}
|
|
65961
|
+
};
|
|
65962
|
+
hosts.gitlab = {
|
|
65963
|
+
protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'],
|
|
65964
|
+
domain: 'gitlab.com',
|
|
65965
|
+
treepath: 'tree',
|
|
65966
|
+
blobpath: 'tree',
|
|
65967
|
+
editpath: '-/edit',
|
|
65968
|
+
httpstemplate: ({
|
|
65969
|
+
auth,
|
|
65970
|
+
domain,
|
|
65971
|
+
user,
|
|
65972
|
+
project,
|
|
65973
|
+
committish
|
|
65974
|
+
}) => `git+https://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
|
|
65975
|
+
tarballtemplate: ({
|
|
65976
|
+
domain,
|
|
65977
|
+
user,
|
|
65978
|
+
project,
|
|
65979
|
+
committish
|
|
65980
|
+
}) => `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish || 'HEAD')}`,
|
|
65981
|
+
extract: url => {
|
|
65982
|
+
const path = url.pathname.slice(1);
|
|
65983
|
+
if (path.includes('/-/') || path.includes('/archive.tar.gz')) {
|
|
65984
|
+
return;
|
|
65985
|
+
}
|
|
65986
|
+
const segments = path.split('/');
|
|
65987
|
+
let project = segments.pop();
|
|
65988
|
+
if (project.endsWith('.git')) {
|
|
65989
|
+
project = project.slice(0, -4);
|
|
65990
|
+
}
|
|
65991
|
+
const user = segments.join('/');
|
|
65992
|
+
if (!user || !project) {
|
|
65993
|
+
return;
|
|
65994
|
+
}
|
|
65995
|
+
return {
|
|
65996
|
+
user,
|
|
65997
|
+
project,
|
|
65998
|
+
committish: url.hash.slice(1)
|
|
65999
|
+
};
|
|
66000
|
+
}
|
|
66001
|
+
};
|
|
66002
|
+
hosts.gist = {
|
|
66003
|
+
protocols: ['git:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'],
|
|
66004
|
+
domain: 'gist.github.com',
|
|
66005
|
+
editpath: 'edit',
|
|
66006
|
+
sshtemplate: ({
|
|
66007
|
+
domain,
|
|
66008
|
+
project,
|
|
66009
|
+
committish
|
|
66010
|
+
}) => `git@${domain}:${project}.git${maybeJoin('#', committish)}`,
|
|
66011
|
+
sshurltemplate: ({
|
|
66012
|
+
domain,
|
|
66013
|
+
project,
|
|
66014
|
+
committish
|
|
66015
|
+
}) => `git+ssh://git@${domain}/${project}.git${maybeJoin('#', committish)}`,
|
|
66016
|
+
edittemplate: ({
|
|
66017
|
+
domain,
|
|
66018
|
+
user,
|
|
66019
|
+
project,
|
|
66020
|
+
committish,
|
|
66021
|
+
editpath
|
|
66022
|
+
}) => `https://${domain}/${user}/${project}${maybeJoin('/', maybeEncode(committish))}/${editpath}`,
|
|
66023
|
+
browsetemplate: ({
|
|
66024
|
+
domain,
|
|
66025
|
+
project,
|
|
66026
|
+
committish
|
|
66027
|
+
}) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`,
|
|
66028
|
+
browsetreetemplate: ({
|
|
66029
|
+
domain,
|
|
66030
|
+
project,
|
|
66031
|
+
committish,
|
|
66032
|
+
path,
|
|
66033
|
+
hashformat
|
|
66034
|
+
}) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}${maybeJoin('#', hashformat(path))}`,
|
|
66035
|
+
browseblobtemplate: ({
|
|
66036
|
+
domain,
|
|
66037
|
+
project,
|
|
66038
|
+
committish,
|
|
66039
|
+
path,
|
|
66040
|
+
hashformat
|
|
66041
|
+
}) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}${maybeJoin('#', hashformat(path))}`,
|
|
66042
|
+
docstemplate: ({
|
|
66043
|
+
domain,
|
|
66044
|
+
project,
|
|
66045
|
+
committish
|
|
66046
|
+
}) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`,
|
|
66047
|
+
httpstemplate: ({
|
|
66048
|
+
domain,
|
|
66049
|
+
project,
|
|
66050
|
+
committish
|
|
66051
|
+
}) => `git+https://${domain}/${project}.git${maybeJoin('#', committish)}`,
|
|
66052
|
+
filetemplate: ({
|
|
66053
|
+
user,
|
|
66054
|
+
project,
|
|
66055
|
+
committish,
|
|
66056
|
+
path
|
|
66057
|
+
}) => `https://gist.githubusercontent.com/${user}/${project}/raw${maybeJoin('/', maybeEncode(committish))}/${path}`,
|
|
66058
|
+
shortcuttemplate: ({
|
|
66059
|
+
type,
|
|
66060
|
+
project,
|
|
66061
|
+
committish
|
|
66062
|
+
}) => `${type}:${project}${maybeJoin('#', committish)}`,
|
|
66063
|
+
pathtemplate: ({
|
|
66064
|
+
project,
|
|
66065
|
+
committish
|
|
66066
|
+
}) => `${project}${maybeJoin('#', committish)}`,
|
|
66067
|
+
bugstemplate: ({
|
|
66068
|
+
domain,
|
|
66069
|
+
project
|
|
66070
|
+
}) => `https://${domain}/${project}`,
|
|
66071
|
+
gittemplate: ({
|
|
66072
|
+
domain,
|
|
66073
|
+
project,
|
|
66074
|
+
committish
|
|
66075
|
+
}) => `git://${domain}/${project}.git${maybeJoin('#', committish)}`,
|
|
66076
|
+
tarballtemplate: ({
|
|
66077
|
+
project,
|
|
66078
|
+
committish
|
|
66079
|
+
}) => `https://codeload.github.com/gist/${project}/tar.gz/${maybeEncode(committish || 'HEAD')}`,
|
|
66080
|
+
extract: url => {
|
|
66081
|
+
let [, user, project, aux] = url.pathname.split('/', 4);
|
|
66082
|
+
if (aux === 'raw') {
|
|
66083
|
+
return;
|
|
66084
|
+
}
|
|
66085
|
+
if (!project) {
|
|
66086
|
+
if (!user) {
|
|
66087
|
+
return;
|
|
64133
66088
|
}
|
|
66089
|
+
project = user;
|
|
66090
|
+
user = null;
|
|
64134
66091
|
}
|
|
66092
|
+
if (project.endsWith('.git')) {
|
|
66093
|
+
project = project.slice(0, -4);
|
|
66094
|
+
}
|
|
66095
|
+
return {
|
|
66096
|
+
user,
|
|
66097
|
+
project,
|
|
66098
|
+
committish: url.hash.slice(1)
|
|
66099
|
+
};
|
|
66100
|
+
},
|
|
66101
|
+
hashformat: function (fragment) {
|
|
66102
|
+
return fragment && 'file-' + formatHashFragment(fragment);
|
|
64135
66103
|
}
|
|
64136
|
-
|
|
64137
|
-
|
|
64138
|
-
|
|
66104
|
+
};
|
|
66105
|
+
hosts.sourcehut = {
|
|
66106
|
+
protocols: ['git+ssh:', 'https:'],
|
|
66107
|
+
domain: 'git.sr.ht',
|
|
66108
|
+
treepath: 'tree',
|
|
66109
|
+
blobpath: 'tree',
|
|
66110
|
+
filetemplate: ({
|
|
66111
|
+
domain,
|
|
66112
|
+
user,
|
|
66113
|
+
project,
|
|
66114
|
+
committish,
|
|
66115
|
+
path
|
|
66116
|
+
}) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || 'HEAD'}/${path}`,
|
|
66117
|
+
httpstemplate: ({
|
|
66118
|
+
domain,
|
|
66119
|
+
user,
|
|
66120
|
+
project,
|
|
66121
|
+
committish
|
|
66122
|
+
}) => `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
|
|
66123
|
+
tarballtemplate: ({
|
|
66124
|
+
domain,
|
|
66125
|
+
user,
|
|
66126
|
+
project,
|
|
66127
|
+
committish
|
|
66128
|
+
}) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'HEAD'}.tar.gz`,
|
|
66129
|
+
bugstemplate: () => null,
|
|
66130
|
+
extract: url => {
|
|
66131
|
+
let [, user, project, aux] = url.pathname.split('/', 4);
|
|
64139
66132
|
|
|
64140
|
-
|
|
64141
|
-
|
|
64142
|
-
|
|
64143
|
-
result[type] = pkg[type];
|
|
66133
|
+
// tarball url
|
|
66134
|
+
if (['archive'].includes(aux)) {
|
|
66135
|
+
return;
|
|
64144
66136
|
}
|
|
64145
|
-
|
|
64146
|
-
|
|
64147
|
-
const emptyDepType = pkg[type] && typeof pkg === 'object' && Object.keys(pkg[type]).length === 0;
|
|
64148
|
-
if (emptyDepType) {
|
|
64149
|
-
delete result[type];
|
|
66137
|
+
if (project && project.endsWith('.git')) {
|
|
66138
|
+
project = project.slice(0, -4);
|
|
64150
66139
|
}
|
|
66140
|
+
if (!user || !project) {
|
|
66141
|
+
return;
|
|
66142
|
+
}
|
|
66143
|
+
return {
|
|
66144
|
+
user,
|
|
66145
|
+
project,
|
|
66146
|
+
committish: url.hash.slice(1)
|
|
66147
|
+
};
|
|
66148
|
+
}
|
|
66149
|
+
};
|
|
66150
|
+
for (const [name, host] of Object.entries(hosts)) {
|
|
66151
|
+
hosts[name] = Object.assign({}, defaults, host);
|
|
66152
|
+
}
|
|
66153
|
+
hosts_1 = hosts;
|
|
66154
|
+
return hosts_1;
|
|
66155
|
+
}
|
|
66156
|
+
|
|
66157
|
+
var parseUrl;
|
|
66158
|
+
var hasRequiredParseUrl;
|
|
66159
|
+
function requireParseUrl() {
|
|
66160
|
+
if (hasRequiredParseUrl) return parseUrl;
|
|
66161
|
+
hasRequiredParseUrl = 1;
|
|
66162
|
+
const url = require$$0$e;
|
|
66163
|
+
const lastIndexOfBefore = (str, char, beforeChar) => {
|
|
66164
|
+
const startPosition = str.indexOf(beforeChar);
|
|
66165
|
+
return str.lastIndexOf(char, startPosition > -1 ? startPosition : Infinity);
|
|
66166
|
+
};
|
|
66167
|
+
const safeUrl = u => {
|
|
66168
|
+
try {
|
|
66169
|
+
return new url.URL(u);
|
|
66170
|
+
} catch {
|
|
66171
|
+
// this fn should never throw
|
|
64151
66172
|
}
|
|
66173
|
+
};
|
|
64152
66174
|
|
|
64153
|
-
|
|
64154
|
-
|
|
64155
|
-
|
|
64156
|
-
|
|
64157
|
-
|
|
64158
|
-
|
|
64159
|
-
|
|
64160
|
-
|
|
64161
|
-
if (
|
|
64162
|
-
|
|
64163
|
-
|
|
64164
|
-
|
|
64165
|
-
|
|
64166
|
-
result.dependencies = result.dependencies || {};
|
|
64167
|
-
result.dependencies[name] = newPeer[name];
|
|
64168
|
-
}
|
|
66175
|
+
// accepts input like git:github.com:user/repo and inserts the // after the first :
|
|
66176
|
+
const correctProtocol = (arg, protocols) => {
|
|
66177
|
+
const firstColon = arg.indexOf(':');
|
|
66178
|
+
const proto = arg.slice(0, firstColon + 1);
|
|
66179
|
+
if (Object.prototype.hasOwnProperty.call(protocols, proto)) {
|
|
66180
|
+
return arg;
|
|
66181
|
+
}
|
|
66182
|
+
const firstAt = arg.indexOf('@');
|
|
66183
|
+
if (firstAt > -1) {
|
|
66184
|
+
if (firstAt > firstColon) {
|
|
66185
|
+
return `git+ssh://${arg}`;
|
|
66186
|
+
} else {
|
|
66187
|
+
return arg;
|
|
64169
66188
|
}
|
|
64170
66189
|
}
|
|
64171
|
-
|
|
66190
|
+
const doubleSlash = arg.indexOf('//');
|
|
66191
|
+
if (doubleSlash === firstColon + 1) {
|
|
66192
|
+
return arg;
|
|
66193
|
+
}
|
|
66194
|
+
return `${arg.slice(0, firstColon + 1)}//${arg.slice(firstColon + 1)}`;
|
|
64172
66195
|
};
|
|
64173
|
-
|
|
64174
|
-
|
|
64175
|
-
|
|
66196
|
+
|
|
66197
|
+
// attempt to correct an scp style url so that it will parse with `new URL()`
|
|
66198
|
+
const correctUrl = giturl => {
|
|
66199
|
+
// ignore @ that come after the first hash since the denotes the start
|
|
66200
|
+
// of a committish which can contain @ characters
|
|
66201
|
+
const firstAt = lastIndexOfBefore(giturl, '@', '#');
|
|
66202
|
+
// ignore colons that come after the hash since that could include colons such as:
|
|
66203
|
+
// git@github.com:user/package-2#semver:^1.0.0
|
|
66204
|
+
const lastColonBeforeHash = lastIndexOfBefore(giturl, ':', '#');
|
|
66205
|
+
if (lastColonBeforeHash > firstAt) {
|
|
66206
|
+
// the last : comes after the first @ (or there is no @)
|
|
66207
|
+
// like it would in:
|
|
66208
|
+
// proto://hostname.com:user/repo
|
|
66209
|
+
// username@hostname.com:user/repo
|
|
66210
|
+
// :password@hostname.com:user/repo
|
|
66211
|
+
// username:password@hostname.com:user/repo
|
|
66212
|
+
// proto://username@hostname.com:user/repo
|
|
66213
|
+
// proto://:password@hostname.com:user/repo
|
|
66214
|
+
// proto://username:password@hostname.com:user/repo
|
|
66215
|
+
// then we replace the last : with a / to create a valid path
|
|
66216
|
+
giturl = giturl.slice(0, lastColonBeforeHash) + '/' + giturl.slice(lastColonBeforeHash + 1);
|
|
66217
|
+
}
|
|
66218
|
+
if (lastIndexOfBefore(giturl, ':', '#') === -1 && giturl.indexOf('//') === -1) {
|
|
66219
|
+
// we have no : at all
|
|
66220
|
+
// as it would be in:
|
|
66221
|
+
// username@hostname.com/user/repo
|
|
66222
|
+
// then we prepend a protocol
|
|
66223
|
+
giturl = `git+ssh://${giturl}`;
|
|
66224
|
+
}
|
|
66225
|
+
return giturl;
|
|
66226
|
+
};
|
|
66227
|
+
parseUrl = (giturl, protocols) => {
|
|
66228
|
+
const withProtocol = protocols ? correctProtocol(giturl, protocols) : giturl;
|
|
66229
|
+
return safeUrl(withProtocol) || safeUrl(correctUrl(withProtocol));
|
|
66230
|
+
};
|
|
66231
|
+
return parseUrl;
|
|
64176
66232
|
}
|
|
64177
66233
|
|
|
64178
|
-
var
|
|
64179
|
-
var
|
|
64180
|
-
function
|
|
64181
|
-
if (
|
|
64182
|
-
|
|
64183
|
-
const
|
|
64184
|
-
|
|
64185
|
-
|
|
66234
|
+
var fromUrl;
|
|
66235
|
+
var hasRequiredFromUrl;
|
|
66236
|
+
function requireFromUrl() {
|
|
66237
|
+
if (hasRequiredFromUrl) return fromUrl;
|
|
66238
|
+
hasRequiredFromUrl = 1;
|
|
66239
|
+
const parseUrl = requireParseUrl();
|
|
66240
|
+
|
|
66241
|
+
// look for github shorthand inputs, such as npm/cli
|
|
66242
|
+
const isGitHubShorthand = arg => {
|
|
66243
|
+
// it cannot contain whitespace before the first #
|
|
66244
|
+
// it cannot start with a / because that's probably an absolute file path
|
|
66245
|
+
// but it must include a slash since repos are username/repository
|
|
66246
|
+
// it cannot start with a . because that's probably a relative file path
|
|
66247
|
+
// it cannot start with an @ because that's a scoped package if it passes the other tests
|
|
66248
|
+
// it cannot contain a : before a # because that tells us that there's a protocol
|
|
66249
|
+
// a second / may not exist before a #
|
|
66250
|
+
const firstHash = arg.indexOf('#');
|
|
66251
|
+
const firstSlash = arg.indexOf('/');
|
|
66252
|
+
const secondSlash = arg.indexOf('/', firstSlash + 1);
|
|
66253
|
+
const firstColon = arg.indexOf(':');
|
|
66254
|
+
const firstSpace = /\s/.exec(arg);
|
|
66255
|
+
const firstAt = arg.indexOf('@');
|
|
66256
|
+
const spaceOnlyAfterHash = !firstSpace || firstHash > -1 && firstSpace.index > firstHash;
|
|
66257
|
+
const atOnlyAfterHash = firstAt === -1 || firstHash > -1 && firstAt > firstHash;
|
|
66258
|
+
const colonOnlyAfterHash = firstColon === -1 || firstHash > -1 && firstColon > firstHash;
|
|
66259
|
+
const secondSlashOnlyAfterHash = secondSlash === -1 || firstHash > -1 && secondSlash > firstHash;
|
|
66260
|
+
const hasSlash = firstSlash > 0;
|
|
66261
|
+
// if a # is found, what we really want to know is that the character
|
|
66262
|
+
// immediately before # is not a /
|
|
66263
|
+
const doesNotEndWithSlash = firstHash > -1 ? arg[firstHash - 1] !== '/' : !arg.endsWith('/');
|
|
66264
|
+
const doesNotStartWithDot = !arg.startsWith('.');
|
|
66265
|
+
return spaceOnlyAfterHash && hasSlash && doesNotEndWithSlash && doesNotStartWithDot && atOnlyAfterHash && colonOnlyAfterHash && secondSlashOnlyAfterHash;
|
|
66266
|
+
};
|
|
66267
|
+
fromUrl = (giturl, opts, {
|
|
66268
|
+
gitHosts,
|
|
66269
|
+
protocols
|
|
64186
66270
|
}) => {
|
|
64187
|
-
|
|
64188
|
-
|
|
64189
|
-
|
|
66271
|
+
if (!giturl) {
|
|
66272
|
+
return;
|
|
66273
|
+
}
|
|
66274
|
+
const correctedUrl = isGitHubShorthand(giturl) ? `github:${giturl}` : giturl;
|
|
66275
|
+
const parsed = parseUrl(correctedUrl, protocols);
|
|
66276
|
+
if (!parsed) {
|
|
66277
|
+
return;
|
|
66278
|
+
}
|
|
66279
|
+
const gitHostShortcut = gitHosts.byShortcut[parsed.protocol];
|
|
66280
|
+
const gitHostDomain = gitHosts.byDomain[parsed.hostname.startsWith('www.') ? parsed.hostname.slice(4) : parsed.hostname];
|
|
66281
|
+
const gitHostName = gitHostShortcut || gitHostDomain;
|
|
66282
|
+
if (!gitHostName) {
|
|
66283
|
+
return;
|
|
66284
|
+
}
|
|
66285
|
+
const gitHostInfo = gitHosts[gitHostShortcut || gitHostDomain];
|
|
66286
|
+
let auth = null;
|
|
66287
|
+
if (protocols[parsed.protocol]?.auth && (parsed.username || parsed.password)) {
|
|
66288
|
+
auth = `${parsed.username}${parsed.password ? ':' + parsed.password : ''}`;
|
|
66289
|
+
}
|
|
66290
|
+
let committish = null;
|
|
66291
|
+
let user = null;
|
|
66292
|
+
let project = null;
|
|
66293
|
+
let defaultRepresentation = null;
|
|
66294
|
+
try {
|
|
66295
|
+
if (gitHostShortcut) {
|
|
66296
|
+
let pathname = parsed.pathname.startsWith('/') ? parsed.pathname.slice(1) : parsed.pathname;
|
|
66297
|
+
const firstAt = pathname.indexOf('@');
|
|
66298
|
+
// we ignore auth for shortcuts, so just trim it out
|
|
66299
|
+
if (firstAt > -1) {
|
|
66300
|
+
pathname = pathname.slice(firstAt + 1);
|
|
66301
|
+
}
|
|
66302
|
+
const lastSlash = pathname.lastIndexOf('/');
|
|
66303
|
+
if (lastSlash > -1) {
|
|
66304
|
+
user = decodeURIComponent(pathname.slice(0, lastSlash));
|
|
66305
|
+
// we want nulls only, never empty strings
|
|
66306
|
+
if (!user) {
|
|
66307
|
+
user = null;
|
|
66308
|
+
}
|
|
66309
|
+
project = decodeURIComponent(pathname.slice(lastSlash + 1));
|
|
66310
|
+
} else {
|
|
66311
|
+
project = decodeURIComponent(pathname);
|
|
66312
|
+
}
|
|
66313
|
+
if (project.endsWith('.git')) {
|
|
66314
|
+
project = project.slice(0, -4);
|
|
66315
|
+
}
|
|
66316
|
+
if (parsed.hash) {
|
|
66317
|
+
committish = decodeURIComponent(parsed.hash.slice(1));
|
|
66318
|
+
}
|
|
66319
|
+
defaultRepresentation = 'shortcut';
|
|
66320
|
+
} else {
|
|
66321
|
+
if (!gitHostInfo.protocols.includes(parsed.protocol)) {
|
|
66322
|
+
return;
|
|
66323
|
+
}
|
|
66324
|
+
const segments = gitHostInfo.extract(parsed);
|
|
66325
|
+
if (!segments) {
|
|
66326
|
+
return;
|
|
66327
|
+
}
|
|
66328
|
+
user = segments.user && decodeURIComponent(segments.user);
|
|
66329
|
+
project = decodeURIComponent(segments.project);
|
|
66330
|
+
committish = decodeURIComponent(segments.committish);
|
|
66331
|
+
defaultRepresentation = protocols[parsed.protocol]?.name || parsed.protocol.slice(0, -1);
|
|
66332
|
+
}
|
|
66333
|
+
} catch (err) {
|
|
66334
|
+
/* istanbul ignore else */
|
|
66335
|
+
if (err instanceof URIError) {
|
|
66336
|
+
return;
|
|
66337
|
+
} else {
|
|
66338
|
+
throw err;
|
|
66339
|
+
}
|
|
64190
66340
|
}
|
|
66341
|
+
return [gitHostName, user, auth, project, committish, defaultRepresentation, opts];
|
|
66342
|
+
};
|
|
66343
|
+
return fromUrl;
|
|
66344
|
+
}
|
|
64191
66345
|
|
|
64192
|
-
|
|
64193
|
-
|
|
64194
|
-
|
|
64195
|
-
|
|
64196
|
-
|
|
66346
|
+
var lib$v;
|
|
66347
|
+
var hasRequiredLib$v;
|
|
66348
|
+
function requireLib$v() {
|
|
66349
|
+
if (hasRequiredLib$v) return lib$v;
|
|
66350
|
+
hasRequiredLib$v = 1;
|
|
66351
|
+
const {
|
|
66352
|
+
LRUCache
|
|
66353
|
+
} = /*@__PURE__*/requireCommonjs$f();
|
|
66354
|
+
const hosts = requireHosts();
|
|
66355
|
+
const fromUrl = requireFromUrl();
|
|
66356
|
+
const parseUrl = requireParseUrl();
|
|
66357
|
+
const cache = new LRUCache({
|
|
66358
|
+
max: 1000
|
|
66359
|
+
});
|
|
66360
|
+
function unknownHostedUrl(url) {
|
|
66361
|
+
try {
|
|
66362
|
+
const {
|
|
66363
|
+
protocol,
|
|
66364
|
+
hostname,
|
|
66365
|
+
pathname
|
|
66366
|
+
} = new URL(url);
|
|
66367
|
+
if (!hostname) {
|
|
66368
|
+
return null;
|
|
66369
|
+
}
|
|
66370
|
+
const proto = /(?:git\+)http:$/.test(protocol) ? 'http:' : 'https:';
|
|
66371
|
+
const path = pathname.replace(/\.git$/, '');
|
|
66372
|
+
return `${proto}//${hostname}${path}`;
|
|
66373
|
+
} catch {
|
|
66374
|
+
return null;
|
|
66375
|
+
}
|
|
66376
|
+
}
|
|
66377
|
+
class GitHost {
|
|
66378
|
+
constructor(type, user, auth, project, committish, defaultRepresentation, opts = {}) {
|
|
66379
|
+
Object.assign(this, GitHost.#gitHosts[type], {
|
|
66380
|
+
type,
|
|
66381
|
+
user,
|
|
66382
|
+
auth,
|
|
66383
|
+
project,
|
|
66384
|
+
committish,
|
|
66385
|
+
default: defaultRepresentation,
|
|
66386
|
+
opts
|
|
64197
66387
|
});
|
|
64198
66388
|
}
|
|
64199
|
-
|
|
64200
|
-
|
|
64201
|
-
|
|
64202
|
-
|
|
66389
|
+
static #gitHosts = {
|
|
66390
|
+
byShortcut: {},
|
|
66391
|
+
byDomain: {}
|
|
66392
|
+
};
|
|
66393
|
+
static #protocols = {
|
|
66394
|
+
'git+ssh:': {
|
|
66395
|
+
name: 'sshurl'
|
|
66396
|
+
},
|
|
66397
|
+
'ssh:': {
|
|
66398
|
+
name: 'sshurl'
|
|
66399
|
+
},
|
|
66400
|
+
'git+https:': {
|
|
66401
|
+
name: 'https',
|
|
66402
|
+
auth: true
|
|
66403
|
+
},
|
|
66404
|
+
'git:': {
|
|
66405
|
+
auth: true
|
|
66406
|
+
},
|
|
66407
|
+
'http:': {
|
|
66408
|
+
auth: true
|
|
66409
|
+
},
|
|
66410
|
+
'https:': {
|
|
66411
|
+
auth: true
|
|
66412
|
+
},
|
|
66413
|
+
'git+http:': {
|
|
66414
|
+
auth: true
|
|
64203
66415
|
}
|
|
64204
66416
|
};
|
|
64205
|
-
|
|
64206
|
-
|
|
64207
|
-
|
|
64208
|
-
}
|
|
66417
|
+
static addHost(name, host) {
|
|
66418
|
+
GitHost.#gitHosts[name] = host;
|
|
66419
|
+
GitHost.#gitHosts.byDomain[host.domain] = name;
|
|
66420
|
+
GitHost.#gitHosts.byShortcut[`${name}:`] = name;
|
|
66421
|
+
GitHost.#protocols[`${name}:`] = {
|
|
66422
|
+
name
|
|
66423
|
+
};
|
|
66424
|
+
}
|
|
66425
|
+
static fromUrl(giturl, opts) {
|
|
66426
|
+
if (typeof giturl !== 'string') {
|
|
66427
|
+
return;
|
|
66428
|
+
}
|
|
66429
|
+
const key = giturl + JSON.stringify(opts || {});
|
|
66430
|
+
if (!cache.has(key)) {
|
|
66431
|
+
const hostArgs = fromUrl(giturl, opts, {
|
|
66432
|
+
gitHosts: GitHost.#gitHosts,
|
|
66433
|
+
protocols: GitHost.#protocols
|
|
66434
|
+
});
|
|
66435
|
+
cache.set(key, hostArgs ? new GitHost(...hostArgs) : undefined);
|
|
66436
|
+
}
|
|
66437
|
+
return cache.get(key);
|
|
66438
|
+
}
|
|
66439
|
+
static fromManifest(manifest, opts = {}) {
|
|
66440
|
+
if (!manifest || typeof manifest !== 'object') {
|
|
66441
|
+
return;
|
|
66442
|
+
}
|
|
66443
|
+
const r = manifest.repository;
|
|
66444
|
+
// TODO: look into also checking the `bugs`/`homepage` URLs
|
|
64209
66445
|
|
|
64210
|
-
|
|
64211
|
-
|
|
64212
|
-
|
|
64213
|
-
|
|
64214
|
-
|
|
64215
|
-
|
|
64216
|
-
|
|
64217
|
-
|
|
64218
|
-
|
|
64219
|
-
|
|
64220
|
-
if (!newWorkspaces) {
|
|
64221
|
-
return originalContent;
|
|
66446
|
+
const rurl = r && (typeof r === 'string' ? r : typeof r === 'object' && typeof r.url === 'string' ? r.url : null);
|
|
66447
|
+
if (!rurl) {
|
|
66448
|
+
throw new Error('no repository');
|
|
66449
|
+
}
|
|
66450
|
+
const info = rurl && GitHost.fromUrl(rurl.replace(/^git\+/, ''), opts) || null;
|
|
66451
|
+
if (info) {
|
|
66452
|
+
return info;
|
|
66453
|
+
}
|
|
66454
|
+
const unk = unknownHostedUrl(rurl);
|
|
66455
|
+
return GitHost.fromUrl(unk, opts) || unk;
|
|
64222
66456
|
}
|
|
66457
|
+
static parseUrl(url) {
|
|
66458
|
+
return parseUrl(url);
|
|
66459
|
+
}
|
|
66460
|
+
#fill(template, opts) {
|
|
66461
|
+
if (typeof template !== 'function') {
|
|
66462
|
+
return null;
|
|
66463
|
+
}
|
|
66464
|
+
const options = {
|
|
66465
|
+
...this,
|
|
66466
|
+
...this.opts,
|
|
66467
|
+
...opts
|
|
66468
|
+
};
|
|
64223
66469
|
|
|
64224
|
-
|
|
64225
|
-
|
|
64226
|
-
|
|
64227
|
-
|
|
64228
|
-
|
|
66470
|
+
// the path should always be set so we don't end up with 'undefined' in urls
|
|
66471
|
+
if (!options.path) {
|
|
66472
|
+
options.path = '';
|
|
66473
|
+
}
|
|
66474
|
+
|
|
66475
|
+
// template functions will insert the leading slash themselves
|
|
66476
|
+
if (options.path.startsWith('/')) {
|
|
66477
|
+
options.path = options.path.slice(1);
|
|
66478
|
+
}
|
|
66479
|
+
if (options.noCommittish) {
|
|
66480
|
+
options.committish = null;
|
|
66481
|
+
}
|
|
66482
|
+
const result = template(options);
|
|
66483
|
+
return options.noGitPlus && result.startsWith('git+') ? result.slice(4) : result;
|
|
66484
|
+
}
|
|
66485
|
+
hash() {
|
|
66486
|
+
return this.committish ? `#${this.committish}` : '';
|
|
66487
|
+
}
|
|
66488
|
+
ssh(opts) {
|
|
66489
|
+
return this.#fill(this.sshtemplate, opts);
|
|
66490
|
+
}
|
|
66491
|
+
sshurl(opts) {
|
|
66492
|
+
return this.#fill(this.sshurltemplate, opts);
|
|
66493
|
+
}
|
|
66494
|
+
browse(path, ...args) {
|
|
66495
|
+
// not a string, treat path as opts
|
|
66496
|
+
if (typeof path !== 'string') {
|
|
66497
|
+
return this.#fill(this.browsetemplate, path);
|
|
66498
|
+
}
|
|
66499
|
+
if (typeof args[0] !== 'string') {
|
|
66500
|
+
return this.#fill(this.browsetreetemplate, {
|
|
66501
|
+
...args[0],
|
|
66502
|
+
path
|
|
66503
|
+
});
|
|
66504
|
+
}
|
|
66505
|
+
return this.#fill(this.browsetreetemplate, {
|
|
66506
|
+
...args[1],
|
|
66507
|
+
fragment: args[0],
|
|
66508
|
+
path
|
|
64229
66509
|
});
|
|
64230
66510
|
}
|
|
64231
|
-
|
|
64232
|
-
|
|
64233
|
-
|
|
64234
|
-
|
|
64235
|
-
|
|
64236
|
-
|
|
64237
|
-
|
|
66511
|
+
|
|
66512
|
+
// If the path is known to be a file, then browseFile should be used. For some hosts
|
|
66513
|
+
// the url is the same as browse, but for others like GitHub a file can use both `/tree/`
|
|
66514
|
+
// and `/blob/` in the path. When using a default committish of `HEAD` then the `/tree/`
|
|
66515
|
+
// path will redirect to a specific commit. Using the `/blob/` path avoids this and
|
|
66516
|
+
// does not redirect to a different commit.
|
|
66517
|
+
browseFile(path, ...args) {
|
|
66518
|
+
if (typeof args[0] !== 'string') {
|
|
66519
|
+
return this.#fill(this.browseblobtemplate, {
|
|
66520
|
+
...args[0],
|
|
66521
|
+
path
|
|
66522
|
+
});
|
|
66523
|
+
}
|
|
66524
|
+
return this.#fill(this.browseblobtemplate, {
|
|
66525
|
+
...args[1],
|
|
66526
|
+
fragment: args[0],
|
|
66527
|
+
path
|
|
66528
|
+
});
|
|
66529
|
+
}
|
|
66530
|
+
docs(opts) {
|
|
66531
|
+
return this.#fill(this.docstemplate, opts);
|
|
66532
|
+
}
|
|
66533
|
+
bugs(opts) {
|
|
66534
|
+
return this.#fill(this.bugstemplate, opts);
|
|
66535
|
+
}
|
|
66536
|
+
https(opts) {
|
|
66537
|
+
return this.#fill(this.httpstemplate, opts);
|
|
66538
|
+
}
|
|
66539
|
+
git(opts) {
|
|
66540
|
+
return this.#fill(this.gittemplate, opts);
|
|
66541
|
+
}
|
|
66542
|
+
shortcut(opts) {
|
|
66543
|
+
return this.#fill(this.shortcuttemplate, opts);
|
|
66544
|
+
}
|
|
66545
|
+
path(opts) {
|
|
66546
|
+
return this.#fill(this.pathtemplate, opts);
|
|
66547
|
+
}
|
|
66548
|
+
tarball(opts) {
|
|
66549
|
+
return this.#fill(this.tarballtemplate, {
|
|
66550
|
+
...opts,
|
|
66551
|
+
noCommittish: false
|
|
66552
|
+
});
|
|
66553
|
+
}
|
|
66554
|
+
file(path, opts) {
|
|
66555
|
+
return this.#fill(this.filetemplate, {
|
|
66556
|
+
...opts,
|
|
66557
|
+
path
|
|
66558
|
+
});
|
|
66559
|
+
}
|
|
66560
|
+
edit(path, opts) {
|
|
66561
|
+
return this.#fill(this.edittemplate, {
|
|
66562
|
+
...opts,
|
|
66563
|
+
path
|
|
66564
|
+
});
|
|
66565
|
+
}
|
|
66566
|
+
getDefaultRepresentation() {
|
|
66567
|
+
return this.default;
|
|
66568
|
+
}
|
|
66569
|
+
toString(opts) {
|
|
66570
|
+
if (this.default && typeof this[this.default] === 'function') {
|
|
66571
|
+
return this[this.default](opts);
|
|
66572
|
+
}
|
|
66573
|
+
return this.sshurl(opts);
|
|
66574
|
+
}
|
|
66575
|
+
}
|
|
66576
|
+
for (const [name, host] of Object.entries(hosts)) {
|
|
66577
|
+
GitHost.addHost(name, host);
|
|
66578
|
+
}
|
|
66579
|
+
lib$v = GitHost;
|
|
66580
|
+
return lib$v;
|
|
64238
66581
|
}
|
|
64239
66582
|
|
|
64240
66583
|
var commonjs$e = {};
|
|
@@ -68703,7 +71046,7 @@ function requirePattern$2() {
|
|
|
68703
71046
|
value: true
|
|
68704
71047
|
});
|
|
68705
71048
|
pattern$2.Pattern = void 0;
|
|
68706
|
-
const minimatch_1 = requireCommonjs$
|
|
71049
|
+
const minimatch_1 = requireCommonjs$g();
|
|
68707
71050
|
const isPatternList = pl => pl.length >= 1;
|
|
68708
71051
|
const isGlobList = gl => gl.length >= 1;
|
|
68709
71052
|
/**
|
|
@@ -68900,7 +71243,7 @@ function requireIgnore$2() {
|
|
|
68900
71243
|
value: true
|
|
68901
71244
|
});
|
|
68902
71245
|
ignore$2.Ignore = void 0;
|
|
68903
|
-
const minimatch_1 = requireCommonjs$
|
|
71246
|
+
const minimatch_1 = requireCommonjs$g();
|
|
68904
71247
|
const pattern_js_1 = requirePattern$2();
|
|
68905
71248
|
const defaultPlatform = typeof process === 'object' && process && typeof process.platform === 'string' ? process.platform : 'linux';
|
|
68906
71249
|
/**
|
|
@@ -69016,7 +71359,7 @@ function requireProcessor$2() {
|
|
|
69016
71359
|
value: true
|
|
69017
71360
|
});
|
|
69018
71361
|
processor$2.Processor = processor$2.SubWalks = processor$2.MatchRecord = processor$2.HasWalkedCache = void 0;
|
|
69019
|
-
const minimatch_1 = requireCommonjs$
|
|
71362
|
+
const minimatch_1 = requireCommonjs$g();
|
|
69020
71363
|
/**
|
|
69021
71364
|
* A cache of which patterns have been processed for a given Path
|
|
69022
71365
|
*/
|
|
@@ -69633,7 +71976,7 @@ function requireGlob$3() {
|
|
|
69633
71976
|
value: true
|
|
69634
71977
|
});
|
|
69635
71978
|
glob$2.Glob = void 0;
|
|
69636
|
-
const minimatch_1 = requireCommonjs$
|
|
71979
|
+
const minimatch_1 = requireCommonjs$g();
|
|
69637
71980
|
const node_url_1 = require$$0$7;
|
|
69638
71981
|
const path_scurry_1 = requireCommonjs$c();
|
|
69639
71982
|
const pattern_js_1 = requirePattern$2();
|
|
@@ -69864,7 +72207,7 @@ function requireHasMagic$2() {
|
|
|
69864
72207
|
value: true
|
|
69865
72208
|
});
|
|
69866
72209
|
hasMagic$2.hasMagic = void 0;
|
|
69867
|
-
const minimatch_1 = requireCommonjs$
|
|
72210
|
+
const minimatch_1 = requireCommonjs$g();
|
|
69868
72211
|
/**
|
|
69869
72212
|
* Return true if the patterns provided contain any magic glob characters,
|
|
69870
72213
|
* given the options provided.
|
|
@@ -69904,10 +72247,10 @@ function requireCommonjs$b() {
|
|
|
69904
72247
|
exports.globSync = globSync;
|
|
69905
72248
|
exports.globIterateSync = globIterateSync;
|
|
69906
72249
|
exports.globIterate = globIterate;
|
|
69907
|
-
const minimatch_1 = requireCommonjs$
|
|
72250
|
+
const minimatch_1 = requireCommonjs$g();
|
|
69908
72251
|
const glob_js_1 = requireGlob$3();
|
|
69909
72252
|
const has_magic_js_1 = requireHasMagic$2();
|
|
69910
|
-
var minimatch_2 = requireCommonjs$
|
|
72253
|
+
var minimatch_2 = requireCommonjs$g();
|
|
69911
72254
|
Object.defineProperty(exports, "escape", {
|
|
69912
72255
|
enumerable: true,
|
|
69913
72256
|
get: function () {
|
|
@@ -70069,7 +72412,7 @@ function requireLib$u() {
|
|
|
70069
72412
|
spawn
|
|
70070
72413
|
} = require$$0$m;
|
|
70071
72414
|
const os = require$$0$f;
|
|
70072
|
-
const which = requireLib$
|
|
72415
|
+
const which = requireLib$I();
|
|
70073
72416
|
const escape = require_escape();
|
|
70074
72417
|
|
|
70075
72418
|
// 'extra' object is for decorating the error a bit more
|
|
@@ -70741,7 +73084,7 @@ var hasRequiredWhich;
|
|
|
70741
73084
|
function requireWhich() {
|
|
70742
73085
|
if (hasRequiredWhich) return which_1;
|
|
70743
73086
|
hasRequiredWhich = 1;
|
|
70744
|
-
const which = requireLib$
|
|
73087
|
+
const which = requireLib$I();
|
|
70745
73088
|
let gitPath;
|
|
70746
73089
|
try {
|
|
70747
73090
|
gitPath = which.sync('git');
|
|
@@ -70771,7 +73114,7 @@ function requireSpawn() {
|
|
|
70771
73114
|
const promiseRetry = requirePromiseRetry();
|
|
70772
73115
|
const {
|
|
70773
73116
|
log
|
|
70774
|
-
} = requireLib$
|
|
73117
|
+
} = requireLib$F();
|
|
70775
73118
|
const makeError = requireMakeError();
|
|
70776
73119
|
const makeOpts = requireOpts();
|
|
70777
73120
|
spawn_1 = (gitArgs, opts = {}) => {
|
|
@@ -72845,7 +75188,7 @@ function requireLib$s() {
|
|
|
72845
75188
|
const {
|
|
72846
75189
|
checkEngine
|
|
72847
75190
|
} = requireLib$t();
|
|
72848
|
-
const normalizeBin = requireLib$
|
|
75191
|
+
const normalizeBin = requireLib$C();
|
|
72849
75192
|
const engineOk = (manifest, npmVersion, nodeVersion) => {
|
|
72850
75193
|
try {
|
|
72851
75194
|
checkEngine(manifest, npmVersion, nodeVersion);
|
|
@@ -74612,7 +76955,7 @@ var hasRequiredNormalizeData;
|
|
|
74612
76955
|
function requireNormalizeData() {
|
|
74613
76956
|
if (hasRequiredNormalizeData) return normalizeData_1;
|
|
74614
76957
|
hasRequiredNormalizeData = 1;
|
|
74615
|
-
const hostedGitInfo = requireLib$
|
|
76958
|
+
const hostedGitInfo = requireLib$v();
|
|
74616
76959
|
const validateLicense = requireValidateNpmPackageLicense();
|
|
74617
76960
|
const typos = {
|
|
74618
76961
|
dependancies: 'dependencies',
|
|
@@ -74883,7 +77226,7 @@ function requireNormalize() {
|
|
|
74883
77226
|
const path = path$2;
|
|
74884
77227
|
const {
|
|
74885
77228
|
log
|
|
74886
|
-
} = requireLib$
|
|
77229
|
+
} = requireLib$F();
|
|
74887
77230
|
const moduleBuiltin = require$$5$3;
|
|
74888
77231
|
|
|
74889
77232
|
/**
|
|
@@ -74892,7 +77235,7 @@ function requireNormalize() {
|
|
|
74892
77235
|
let _hostedGitInfo;
|
|
74893
77236
|
function lazyHostedGitInfo() {
|
|
74894
77237
|
if (!_hostedGitInfo) {
|
|
74895
|
-
_hostedGitInfo = requireLib$
|
|
77238
|
+
_hostedGitInfo = requireLib$v();
|
|
74896
77239
|
}
|
|
74897
77240
|
return _hostedGitInfo;
|
|
74898
77241
|
}
|
|
@@ -75482,7 +77825,7 @@ function requireReadPackage() {
|
|
|
75482
77825
|
const {
|
|
75483
77826
|
readFile
|
|
75484
77827
|
} = require$$0$k;
|
|
75485
|
-
const parseJSON = requireLib$
|
|
77828
|
+
const parseJSON = requireLib$D();
|
|
75486
77829
|
async function read(filename) {
|
|
75487
77830
|
try {
|
|
75488
77831
|
const data = await readFile(filename, 'utf8');
|
|
@@ -75716,7 +78059,7 @@ function requireLib$q() {
|
|
|
75716
78059
|
const {
|
|
75717
78060
|
resolve
|
|
75718
78061
|
} = path$2;
|
|
75719
|
-
const parseJSON = requireLib$
|
|
78062
|
+
const parseJSON = requireLib$D();
|
|
75720
78063
|
const updateDeps = requireUpdateDependencies();
|
|
75721
78064
|
const updateScripts = requireUpdateScripts();
|
|
75722
78065
|
const updateWorkspaces = requireUpdateWorkspaces();
|
|
@@ -83486,7 +85829,7 @@ function requirePattern$1() {
|
|
|
83486
85829
|
value: true
|
|
83487
85830
|
});
|
|
83488
85831
|
pattern$1.Pattern = void 0;
|
|
83489
|
-
const minimatch_1 = requireCommonjs$
|
|
85832
|
+
const minimatch_1 = requireCommonjs$g();
|
|
83490
85833
|
const isPatternList = pl => pl.length >= 1;
|
|
83491
85834
|
const isGlobList = gl => gl.length >= 1;
|
|
83492
85835
|
/**
|
|
@@ -83683,7 +86026,7 @@ function requireIgnore$1() {
|
|
|
83683
86026
|
value: true
|
|
83684
86027
|
});
|
|
83685
86028
|
ignore$1.Ignore = void 0;
|
|
83686
|
-
const minimatch_1 = requireCommonjs$
|
|
86029
|
+
const minimatch_1 = requireCommonjs$g();
|
|
83687
86030
|
const pattern_js_1 = requirePattern$1();
|
|
83688
86031
|
const defaultPlatform = typeof process === 'object' && process && typeof process.platform === 'string' ? process.platform : 'linux';
|
|
83689
86032
|
/**
|
|
@@ -83799,7 +86142,7 @@ function requireProcessor$1() {
|
|
|
83799
86142
|
value: true
|
|
83800
86143
|
});
|
|
83801
86144
|
processor$1.Processor = processor$1.SubWalks = processor$1.MatchRecord = processor$1.HasWalkedCache = void 0;
|
|
83802
|
-
const minimatch_1 = requireCommonjs$
|
|
86145
|
+
const minimatch_1 = requireCommonjs$g();
|
|
83803
86146
|
/**
|
|
83804
86147
|
* A cache of which patterns have been processed for a given Path
|
|
83805
86148
|
*/
|
|
@@ -84416,7 +86759,7 @@ function requireGlob$2() {
|
|
|
84416
86759
|
value: true
|
|
84417
86760
|
});
|
|
84418
86761
|
glob$1.Glob = void 0;
|
|
84419
|
-
const minimatch_1 = requireCommonjs$
|
|
86762
|
+
const minimatch_1 = requireCommonjs$g();
|
|
84420
86763
|
const node_url_1 = require$$0$7;
|
|
84421
86764
|
const path_scurry_1 = requireCommonjs$8();
|
|
84422
86765
|
const pattern_js_1 = requirePattern$1();
|
|
@@ -84647,7 +86990,7 @@ function requireHasMagic$1() {
|
|
|
84647
86990
|
value: true
|
|
84648
86991
|
});
|
|
84649
86992
|
hasMagic$1.hasMagic = void 0;
|
|
84650
|
-
const minimatch_1 = requireCommonjs$
|
|
86993
|
+
const minimatch_1 = requireCommonjs$g();
|
|
84651
86994
|
/**
|
|
84652
86995
|
* Return true if the patterns provided contain any magic glob characters,
|
|
84653
86996
|
* given the options provided.
|
|
@@ -84687,10 +87030,10 @@ function requireCommonjs$7() {
|
|
|
84687
87030
|
exports.globSync = globSync;
|
|
84688
87031
|
exports.globIterateSync = globIterateSync;
|
|
84689
87032
|
exports.globIterate = globIterate;
|
|
84690
|
-
const minimatch_1 = requireCommonjs$
|
|
87033
|
+
const minimatch_1 = requireCommonjs$g();
|
|
84691
87034
|
const glob_js_1 = requireGlob$2();
|
|
84692
87035
|
const has_magic_js_1 = requireHasMagic$1();
|
|
84693
|
-
var minimatch_2 = requireCommonjs$
|
|
87036
|
+
var minimatch_2 = requireCommonjs$g();
|
|
84694
87037
|
Object.defineProperty(exports, "escape", {
|
|
84695
87038
|
enumerable: true,
|
|
84696
87039
|
get: function () {
|
|
@@ -85212,7 +87555,7 @@ function requireLib$j() {
|
|
|
85212
87555
|
const EE = require$$0$c.EventEmitter;
|
|
85213
87556
|
// we don't care about the package bins, but we share a pj cache
|
|
85214
87557
|
// with other modules that DO care about it, so keep it nice.
|
|
85215
|
-
const normalizePackageBin = requireLib$
|
|
87558
|
+
const normalizePackageBin = requireLib$C();
|
|
85216
87559
|
class BundleWalker extends EE {
|
|
85217
87560
|
constructor(opt) {
|
|
85218
87561
|
opt = opt || {};
|
|
@@ -85454,7 +87797,7 @@ function requireLib$i() {
|
|
|
85454
87797
|
basename,
|
|
85455
87798
|
dirname
|
|
85456
87799
|
} = require$$0$d;
|
|
85457
|
-
const normalizePackageBin = requireLib$
|
|
87800
|
+
const normalizePackageBin = requireLib$C();
|
|
85458
87801
|
const readPackage = ({
|
|
85459
87802
|
path,
|
|
85460
87803
|
packageJsonCache
|
|
@@ -92831,7 +95174,7 @@ function requireLib$h() {
|
|
|
92831
95174
|
const fs = require$$0$a;
|
|
92832
95175
|
const path = require$$0$d;
|
|
92833
95176
|
const EE = require$$0$c.EventEmitter;
|
|
92834
|
-
const Minimatch = requireCommonjs$
|
|
95177
|
+
const Minimatch = requireCommonjs$g().Minimatch;
|
|
92835
95178
|
class Walker extends EE {
|
|
92836
95179
|
constructor(opts) {
|
|
92837
95180
|
opts = opts || {};
|
|
@@ -93831,7 +96174,7 @@ function requireRunScriptPkg() {
|
|
|
93831
96174
|
const {
|
|
93832
96175
|
output,
|
|
93833
96176
|
input
|
|
93834
|
-
} = requireLib$
|
|
96177
|
+
} = requireLib$F();
|
|
93835
96178
|
output.standard(banner);
|
|
93836
96179
|
inputEnd = input.start();
|
|
93837
96180
|
}
|
|
@@ -108240,7 +110583,7 @@ function requireCheckResponse() {
|
|
|
108240
110583
|
const defaultOpts = requireDefaultOpts();
|
|
108241
110584
|
const {
|
|
108242
110585
|
log
|
|
108243
|
-
} = requireLib$
|
|
110586
|
+
} = requireLib$F();
|
|
108244
110587
|
const {
|
|
108245
110588
|
redact: cleanUrl
|
|
108246
110589
|
} = requireLib$c();
|
|
@@ -120512,7 +122855,7 @@ function requireRemote$1() {
|
|
|
120512
122855
|
const ssri = requireLib$p();
|
|
120513
122856
|
const {
|
|
120514
122857
|
log
|
|
120515
|
-
} = requireLib$
|
|
122858
|
+
} = requireLib$F();
|
|
120516
122859
|
const CachingMinipassPipeline = requirePipeline();
|
|
120517
122860
|
const {
|
|
120518
122861
|
getAgent
|
|
@@ -122366,7 +124709,7 @@ function requireGit() {
|
|
|
122366
124709
|
} = requireCommonjs$d();
|
|
122367
124710
|
const {
|
|
122368
124711
|
log
|
|
122369
|
-
} = requireLib$
|
|
124712
|
+
} = requireLib$F();
|
|
122370
124713
|
const DirFetcher = requireDir();
|
|
122371
124714
|
const Fetcher = requireFetcher();
|
|
122372
124715
|
const FileFetcher = requireFile$1();
|
|
@@ -127473,7 +129816,7 @@ function requireFetch() {
|
|
|
127473
129816
|
*/
|
|
127474
129817
|
const http2_1 = require$$0$r;
|
|
127475
129818
|
const make_fetch_happen_1 = __importDefault(requireLib$a());
|
|
127476
|
-
const proc_log_1 = requireLib$
|
|
129819
|
+
const proc_log_1 = requireLib$F();
|
|
127477
129820
|
const promise_retry_1 = __importDefault(requirePromiseRetry());
|
|
127478
129821
|
const util_1 = requireUtil();
|
|
127479
129822
|
const error_1 = requireError$6();
|
|
@@ -129381,7 +131724,7 @@ function requireRole() {
|
|
|
129381
131724
|
});
|
|
129382
131725
|
role.SuccinctRoles = role.DelegatedRole = role.Role = role.TOP_LEVEL_ROLE_NAMES = void 0;
|
|
129383
131726
|
const crypto_1 = __importDefault(require$$0$n);
|
|
129384
|
-
const minimatch_1 = requireCommonjs$
|
|
131727
|
+
const minimatch_1 = requireCommonjs$g();
|
|
129385
131728
|
const util_1 = __importDefault(require$$0$9);
|
|
129386
131729
|
const error_1 = requireError$4();
|
|
129387
131730
|
const utils_1 = requireUtils();
|
|
@@ -134175,7 +136518,7 @@ function requireFetcher() {
|
|
|
134175
136518
|
} = requireCommonjs$d();
|
|
134176
136519
|
const {
|
|
134177
136520
|
log
|
|
134178
|
-
} = requireLib$
|
|
136521
|
+
} = requireLib$F();
|
|
134179
136522
|
const _ = require_protected();
|
|
134180
136523
|
const cacheDir = requireCacheDir();
|
|
134181
136524
|
const isPackageBin = requireIsPackageBin();
|
|
@@ -134641,14 +136984,14 @@ function requireQuerySelectorAll() {
|
|
|
134641
136984
|
const {
|
|
134642
136985
|
parser,
|
|
134643
136986
|
arrayDelimiter
|
|
134644
|
-
} = requireLib$
|
|
136987
|
+
} = requireLib$w();
|
|
134645
136988
|
const localeCompare = requireStringLocaleCompare()('en');
|
|
134646
136989
|
const {
|
|
134647
136990
|
log
|
|
134648
|
-
} = requireLib$
|
|
136991
|
+
} = requireLib$F();
|
|
134649
136992
|
const {
|
|
134650
136993
|
minimatch
|
|
134651
|
-
} = requireCommonjs$
|
|
136994
|
+
} = requireCommonjs$g();
|
|
134652
136995
|
const npa = requireNpa();
|
|
134653
136996
|
const pacote = requireLib$7();
|
|
134654
136997
|
const semver = requireSemver();
|
|
@@ -135590,26 +137933,26 @@ function requireNode$1() {
|
|
|
135590
137933
|
// tree.
|
|
135591
137934
|
|
|
135592
137935
|
const semver = requireSemver();
|
|
135593
|
-
const nameFromFolder = requireLib$
|
|
137936
|
+
const nameFromFolder = requireLib$E();
|
|
135594
137937
|
const Edge = requireEdge();
|
|
135595
137938
|
const Inventory = requireInventory();
|
|
135596
137939
|
const OverrideSet = requireOverrideSet();
|
|
135597
137940
|
const {
|
|
135598
137941
|
normalize
|
|
135599
|
-
} = requireLib$
|
|
137942
|
+
} = requireLib$B();
|
|
135600
137943
|
const {
|
|
135601
137944
|
getPaths: getBinPaths
|
|
135602
|
-
} = requireLib$
|
|
137945
|
+
} = requireLib$x();
|
|
135603
137946
|
const npa = requireNpa();
|
|
135604
137947
|
const debug = requireDebug$1();
|
|
135605
137948
|
const gatherDepSet = requireGatherDepSet();
|
|
135606
137949
|
const treeCheck = requireTreeCheck();
|
|
135607
137950
|
const {
|
|
135608
137951
|
walkUp
|
|
135609
|
-
} = requireCommonjs$
|
|
137952
|
+
} = requireCommonjs$h();
|
|
135610
137953
|
const {
|
|
135611
137954
|
log
|
|
135612
|
-
} = requireLib$
|
|
137955
|
+
} = requireLib$F();
|
|
135613
137956
|
const {
|
|
135614
137957
|
resolve,
|
|
135615
137958
|
relative,
|
|
@@ -136029,6 +138372,9 @@ function requireNode$1() {
|
|
|
136029
138372
|
}
|
|
136030
138373
|
return false;
|
|
136031
138374
|
}
|
|
138375
|
+
shouldOmit(omitSet) {
|
|
138376
|
+
return this.peer && omitSet.has('peer') || this.dev && omitSet.has('dev') || this.optional && omitSet.has('optional') || this.devOptional && omitSet.has('optional') && omitSet.has('dev');
|
|
138377
|
+
}
|
|
136032
138378
|
getBundler(path = []) {
|
|
136033
138379
|
// made a cycle, definitely not bundled!
|
|
136034
138380
|
if (path.includes(this)) {
|
|
@@ -140852,7 +143198,7 @@ function requirePattern() {
|
|
|
140852
143198
|
value: true
|
|
140853
143199
|
});
|
|
140854
143200
|
pattern.Pattern = void 0;
|
|
140855
|
-
const minimatch_1 = requireCommonjs$
|
|
143201
|
+
const minimatch_1 = requireCommonjs$g();
|
|
140856
143202
|
const isPatternList = pl => pl.length >= 1;
|
|
140857
143203
|
const isGlobList = gl => gl.length >= 1;
|
|
140858
143204
|
/**
|
|
@@ -141049,7 +143395,7 @@ function requireIgnore() {
|
|
|
141049
143395
|
value: true
|
|
141050
143396
|
});
|
|
141051
143397
|
ignore.Ignore = void 0;
|
|
141052
|
-
const minimatch_1 = requireCommonjs$
|
|
143398
|
+
const minimatch_1 = requireCommonjs$g();
|
|
141053
143399
|
const pattern_js_1 = requirePattern();
|
|
141054
143400
|
const defaultPlatform = typeof process === 'object' && process && typeof process.platform === 'string' ? process.platform : 'linux';
|
|
141055
143401
|
/**
|
|
@@ -141165,7 +143511,7 @@ function requireProcessor() {
|
|
|
141165
143511
|
value: true
|
|
141166
143512
|
});
|
|
141167
143513
|
processor.Processor = processor.SubWalks = processor.MatchRecord = processor.HasWalkedCache = void 0;
|
|
141168
|
-
const minimatch_1 = requireCommonjs$
|
|
143514
|
+
const minimatch_1 = requireCommonjs$g();
|
|
141169
143515
|
/**
|
|
141170
143516
|
* A cache of which patterns have been processed for a given Path
|
|
141171
143517
|
*/
|
|
@@ -141782,7 +144128,7 @@ function requireGlob() {
|
|
|
141782
144128
|
value: true
|
|
141783
144129
|
});
|
|
141784
144130
|
glob.Glob = void 0;
|
|
141785
|
-
const minimatch_1 = requireCommonjs$
|
|
144131
|
+
const minimatch_1 = requireCommonjs$g();
|
|
141786
144132
|
const node_url_1 = require$$0$7;
|
|
141787
144133
|
const path_scurry_1 = requireCommonjs$3();
|
|
141788
144134
|
const pattern_js_1 = requirePattern();
|
|
@@ -142013,7 +144359,7 @@ function requireHasMagic() {
|
|
|
142013
144359
|
value: true
|
|
142014
144360
|
});
|
|
142015
144361
|
hasMagic.hasMagic = void 0;
|
|
142016
|
-
const minimatch_1 = requireCommonjs$
|
|
144362
|
+
const minimatch_1 = requireCommonjs$g();
|
|
142017
144363
|
/**
|
|
142018
144364
|
* Return true if the patterns provided contain any magic glob characters,
|
|
142019
144365
|
* given the options provided.
|
|
@@ -142053,10 +144399,10 @@ function requireCommonjs$2() {
|
|
|
142053
144399
|
exports.globSync = globSync;
|
|
142054
144400
|
exports.globIterateSync = globIterateSync;
|
|
142055
144401
|
exports.globIterate = globIterate;
|
|
142056
|
-
const minimatch_1 = requireCommonjs$
|
|
144402
|
+
const minimatch_1 = requireCommonjs$g();
|
|
142057
144403
|
const glob_js_1 = requireGlob();
|
|
142058
144404
|
const has_magic_js_1 = requireHasMagic();
|
|
142059
|
-
var minimatch_2 = requireCommonjs$
|
|
144405
|
+
var minimatch_2 = requireCommonjs$g();
|
|
142060
144406
|
Object.defineProperty(exports, "escape", {
|
|
142061
144407
|
enumerable: true,
|
|
142062
144408
|
get: function () {
|
|
@@ -142149,10 +144495,10 @@ function requireLib$5() {
|
|
|
142149
144495
|
if (hasRequiredLib$5) return lib$5;
|
|
142150
144496
|
hasRequiredLib$5 = 1;
|
|
142151
144497
|
const path = require$$0$d;
|
|
142152
|
-
const getName = requireLib$
|
|
144498
|
+
const getName = requireLib$E();
|
|
142153
144499
|
const {
|
|
142154
144500
|
minimatch
|
|
142155
|
-
} = requireCommonjs$
|
|
144501
|
+
} = requireCommonjs$g();
|
|
142156
144502
|
const pkgJson = requireLib$q();
|
|
142157
144503
|
const {
|
|
142158
144504
|
glob
|
|
@@ -142376,7 +144722,7 @@ function requireAddRmPkgDeps() {
|
|
|
142376
144722
|
|
|
142377
144723
|
const {
|
|
142378
144724
|
log
|
|
142379
|
-
} = requireLib$
|
|
144725
|
+
} = requireLib$F();
|
|
142380
144726
|
const localeCompare = requireStringLocaleCompare()('en');
|
|
142381
144727
|
const add = ({
|
|
142382
144728
|
pkg,
|
|
@@ -143156,12 +145502,12 @@ function requireLib$4() {
|
|
|
143156
145502
|
const cacache = requireLib$k();
|
|
143157
145503
|
const {
|
|
143158
145504
|
time
|
|
143159
|
-
} = requireLib$
|
|
145505
|
+
} = requireLib$F();
|
|
143160
145506
|
const Advisory = requireAdvisory();
|
|
143161
145507
|
const {
|
|
143162
145508
|
homedir
|
|
143163
145509
|
} = require$$0$f;
|
|
143164
|
-
const jsonParse = requireLib$
|
|
145510
|
+
const jsonParse = requireLib$D();
|
|
143165
145511
|
const _packument = Symbol('packument');
|
|
143166
145512
|
const _cachePut = Symbol('cachePut');
|
|
143167
145513
|
const _cacheGet = Symbol('cacheGet');
|
|
@@ -143290,24 +145636,21 @@ function requireAuditReport() {
|
|
|
143290
145636
|
if (hasRequiredAuditReport) return auditReport;
|
|
143291
145637
|
hasRequiredAuditReport = 1;
|
|
143292
145638
|
// an object representing the set of vulnerabilities in a tree
|
|
143293
|
-
/* eslint camelcase: "off" */
|
|
143294
145639
|
|
|
143295
145640
|
const localeCompare = requireStringLocaleCompare()('en');
|
|
143296
145641
|
const npa = requireNpa();
|
|
143297
145642
|
const pickManifest = requireLib$s();
|
|
143298
145643
|
const Vuln = requireVuln();
|
|
143299
145644
|
const Calculator = requireLib$4();
|
|
143300
|
-
const _getReport = Symbol('getReport');
|
|
143301
|
-
const _fixAvailable = Symbol('fixAvailable');
|
|
143302
|
-
const _checkTopNode = Symbol('checkTopNode');
|
|
143303
|
-
const _init = Symbol('init');
|
|
143304
|
-
const _omit = Symbol('omit');
|
|
143305
145645
|
const {
|
|
143306
145646
|
log,
|
|
143307
145647
|
time
|
|
143308
|
-
} = requireLib$
|
|
145648
|
+
} = requireLib$F();
|
|
143309
145649
|
const npmFetch = requireLib$9();
|
|
143310
145650
|
class AuditReport extends Map {
|
|
145651
|
+
#omit;
|
|
145652
|
+
error = null;
|
|
145653
|
+
topVulns = new Map();
|
|
143311
145654
|
static load(tree, opts) {
|
|
143312
145655
|
return new AuditReport(tree, opts).run();
|
|
143313
145656
|
}
|
|
@@ -143370,22 +145713,17 @@ function requireAuditReport() {
|
|
|
143370
145713
|
}
|
|
143371
145714
|
constructor(tree, opts = {}) {
|
|
143372
145715
|
super();
|
|
143373
|
-
|
|
143374
|
-
omit
|
|
143375
|
-
} = opts;
|
|
143376
|
-
this[_omit] = new Set(omit || []);
|
|
143377
|
-
this.topVulns = new Map();
|
|
145716
|
+
this.#omit = new Set(opts.omit || []);
|
|
143378
145717
|
this.calculator = new Calculator(opts);
|
|
143379
|
-
this.error = null;
|
|
143380
145718
|
this.options = opts;
|
|
143381
145719
|
this.tree = tree;
|
|
143382
145720
|
this.filterSet = opts.filterSet;
|
|
143383
145721
|
}
|
|
143384
145722
|
async run() {
|
|
143385
|
-
this.report = await this
|
|
145723
|
+
this.report = await this.#getReport();
|
|
143386
145724
|
log.silly('audit report', this.report);
|
|
143387
145725
|
if (this.report) {
|
|
143388
|
-
await this
|
|
145726
|
+
await this.#init();
|
|
143389
145727
|
}
|
|
143390
145728
|
return this;
|
|
143391
145729
|
}
|
|
@@ -143393,7 +145731,7 @@ function requireAuditReport() {
|
|
|
143393
145731
|
const vuln = this.get(node.packageName);
|
|
143394
145732
|
return !!(vuln && vuln.isVulnerable(node));
|
|
143395
145733
|
}
|
|
143396
|
-
async
|
|
145734
|
+
async #init() {
|
|
143397
145735
|
const timeEnd = time.start('auditReport:init');
|
|
143398
145736
|
const promises = [];
|
|
143399
145737
|
for (const [name, advisories] of Object.entries(this.report)) {
|
|
@@ -143429,7 +145767,7 @@ function requireAuditReport() {
|
|
|
143429
145767
|
if (!seen.has(k)) {
|
|
143430
145768
|
const p = [];
|
|
143431
145769
|
for (const node of this.tree.inventory.query('packageName', name)) {
|
|
143432
|
-
if (!shouldAudit(node
|
|
145770
|
+
if (!this.shouldAudit(node)) {
|
|
143433
145771
|
continue;
|
|
143434
145772
|
}
|
|
143435
145773
|
|
|
@@ -143455,7 +145793,15 @@ function requireAuditReport() {
|
|
|
143455
145793
|
spec
|
|
143456
145794
|
} of node.edgesIn) {
|
|
143457
145795
|
if (dep.isTop && !vuln.topNodes.has(dep)) {
|
|
143458
|
-
this
|
|
145796
|
+
vuln.fixAvailable = this.#fixAvailable(vuln, spec);
|
|
145797
|
+
if (vuln.fixAvailable !== true) {
|
|
145798
|
+
// now we know the top node is vulnerable, and cannot be
|
|
145799
|
+
// upgraded out of the bad place without --force. But, there's
|
|
145800
|
+
// no need to add it to the actual vulns list, because nothing
|
|
145801
|
+
// depends on root.
|
|
145802
|
+
this.topVulns.set(vuln.name, vuln);
|
|
145803
|
+
vuln.topNodes.add(dep);
|
|
145804
|
+
}
|
|
143459
145805
|
} else {
|
|
143460
145806
|
// calculate a metavuln, if necessary
|
|
143461
145807
|
const calc = this.calculator.calculate(dep.packageName, advisory);
|
|
@@ -143495,31 +145841,15 @@ function requireAuditReport() {
|
|
|
143495
145841
|
}
|
|
143496
145842
|
timeEnd();
|
|
143497
145843
|
}
|
|
143498
|
-
[_checkTopNode](topNode, vuln, spec) {
|
|
143499
|
-
vuln.fixAvailable = this[_fixAvailable](topNode, vuln, spec);
|
|
143500
|
-
if (vuln.fixAvailable !== true) {
|
|
143501
|
-
// now we know the top node is vulnerable, and cannot be
|
|
143502
|
-
// upgraded out of the bad place without --force. But, there's
|
|
143503
|
-
// no need to add it to the actual vulns list, because nothing
|
|
143504
|
-
// depends on root.
|
|
143505
|
-
this.topVulns.set(vuln.name, vuln);
|
|
143506
|
-
vuln.topNodes.add(topNode);
|
|
143507
|
-
}
|
|
143508
|
-
}
|
|
143509
145844
|
|
|
143510
|
-
//
|
|
143511
|
-
|
|
143512
|
-
|
|
143513
|
-
[_fixAvailable](topNode, vuln, spec) {
|
|
143514
|
-
// this will always be set to at least {name, versions:{}}
|
|
143515
|
-
const paku = vuln.packument;
|
|
145845
|
+
// given the spec, see if there is a fix available at all, and note whether or not it's a semver major fix or not (i.e. will need --force)
|
|
145846
|
+
#fixAvailable(vuln, spec) {
|
|
145847
|
+
// TODO we return true, false, OR an object here. this is probably a bad pattern.
|
|
143516
145848
|
if (!vuln.testSpec(spec)) {
|
|
143517
145849
|
return true;
|
|
143518
145850
|
}
|
|
143519
145851
|
|
|
143520
|
-
//
|
|
143521
|
-
// somewhere other than the registry, and we got something vulnerable,
|
|
143522
|
-
// then we're stuck with it.
|
|
145852
|
+
// even if we HAVE a packument, if we're looking for it somewhere other than the registry and we have something vulnerable then we're stuck with it.
|
|
143523
145853
|
const specObj = npa(spec);
|
|
143524
145854
|
if (!specObj.registry) {
|
|
143525
145855
|
return false;
|
|
@@ -143528,15 +145858,13 @@ function requireAuditReport() {
|
|
|
143528
145858
|
spec = specObj.subSpec.rawSpec;
|
|
143529
145859
|
}
|
|
143530
145860
|
|
|
143531
|
-
//
|
|
143532
|
-
// still check to see if the node is fixable with a different version,
|
|
143533
|
-
// and if that is a semver major bump.
|
|
145861
|
+
// we don't provide fixes for top nodes other than root, but we still check to see if the node is fixable with a different version, and note if that is a semver major bump.
|
|
143534
145862
|
try {
|
|
143535
145863
|
const {
|
|
143536
145864
|
_isSemVerMajor: isSemVerMajor,
|
|
143537
145865
|
version,
|
|
143538
145866
|
name
|
|
143539
|
-
} = pickManifest(
|
|
145867
|
+
} = pickManifest(vuln.packument, spec, {
|
|
143540
145868
|
...this.options,
|
|
143541
145869
|
before: null,
|
|
143542
145870
|
avoid: vuln.range,
|
|
@@ -143554,14 +145882,14 @@ function requireAuditReport() {
|
|
|
143554
145882
|
set() {
|
|
143555
145883
|
throw new Error('do not call AuditReport.set() directly');
|
|
143556
145884
|
}
|
|
143557
|
-
async
|
|
145885
|
+
async #getReport() {
|
|
143558
145886
|
// if we're not auditing, just return false
|
|
143559
145887
|
if (this.options.audit === false || this.options.offline === true || this.tree.inventory.size === 1) {
|
|
143560
145888
|
return null;
|
|
143561
145889
|
}
|
|
143562
145890
|
const timeEnd = time.start('auditReport:getReport');
|
|
143563
145891
|
try {
|
|
143564
|
-
const body = prepareBulkData(
|
|
145892
|
+
const body = this.prepareBulkData();
|
|
143565
145893
|
log.silly('audit', 'bulk request', body);
|
|
143566
145894
|
|
|
143567
145895
|
// no sense asking if we don't have anything to audit,
|
|
@@ -143586,28 +145914,34 @@ function requireAuditReport() {
|
|
|
143586
145914
|
timeEnd();
|
|
143587
145915
|
}
|
|
143588
145916
|
}
|
|
143589
|
-
}
|
|
143590
145917
|
|
|
143591
|
-
|
|
143592
|
-
|
|
143593
|
-
|
|
143594
|
-
|
|
143595
|
-
const prepareBulkData = (tree, omit, filterSet) => {
|
|
143596
|
-
const payload = {};
|
|
143597
|
-
for (const name of tree.inventory.query('packageName')) {
|
|
143598
|
-
const set = new Set();
|
|
143599
|
-
for (const node of tree.inventory.query('packageName', name)) {
|
|
143600
|
-
if (!shouldAudit(node, omit, filterSet)) {
|
|
143601
|
-
continue;
|
|
143602
|
-
}
|
|
143603
|
-
set.add(node.version);
|
|
145918
|
+
// return true if we should audit this one
|
|
145919
|
+
shouldAudit(node) {
|
|
145920
|
+
if (!node.version || node.isRoot || this.filterSet && this.filterSet?.size !== 0 && !this.filterSet?.has(node)) {
|
|
145921
|
+
return false;
|
|
143604
145922
|
}
|
|
143605
|
-
if (
|
|
143606
|
-
|
|
145923
|
+
if (this.#omit.size === 0) {
|
|
145924
|
+
return true;
|
|
143607
145925
|
}
|
|
145926
|
+
return !node.shouldOmit(this.#omit);
|
|
143608
145927
|
}
|
|
143609
|
-
|
|
143610
|
-
|
|
145928
|
+
prepareBulkData() {
|
|
145929
|
+
const payload = {};
|
|
145930
|
+
for (const name of this.tree.inventory.query('packageName')) {
|
|
145931
|
+
const set = new Set();
|
|
145932
|
+
for (const node of this.tree.inventory.query('packageName', name)) {
|
|
145933
|
+
if (!this.shouldAudit(node)) {
|
|
145934
|
+
continue;
|
|
145935
|
+
}
|
|
145936
|
+
set.add(node.version);
|
|
145937
|
+
}
|
|
145938
|
+
if (set.size) {
|
|
145939
|
+
payload[name] = [...set];
|
|
145940
|
+
}
|
|
145941
|
+
}
|
|
145942
|
+
return payload;
|
|
145943
|
+
}
|
|
145944
|
+
}
|
|
143611
145945
|
auditReport = AuditReport;
|
|
143612
145946
|
return auditReport;
|
|
143613
145947
|
}
|
|
@@ -145139,7 +147473,7 @@ function requirePackumentCache() {
|
|
|
145139
147473
|
} = require$$1$d;
|
|
145140
147474
|
const {
|
|
145141
147475
|
log
|
|
145142
|
-
} = requireLib$
|
|
147476
|
+
} = requireLib$F();
|
|
145143
147477
|
|
|
145144
147478
|
// This is an in-memory cache that Pacote uses for packuments.
|
|
145145
147479
|
// Packuments are usually cached on disk. This allows for rapid re-requests
|
|
@@ -146382,7 +148716,7 @@ function requirePlaceDep() {
|
|
|
146382
148716
|
const localeCompare = requireStringLocaleCompare()('en');
|
|
146383
148717
|
const {
|
|
146384
148718
|
log
|
|
146385
|
-
} = requireLib$
|
|
148719
|
+
} = requireLib$F();
|
|
146386
148720
|
const {
|
|
146387
148721
|
redact
|
|
146388
148722
|
} = requireLib$c();
|
|
@@ -147879,7 +150213,7 @@ var hasRequiredLib$2;
|
|
|
147879
150213
|
function requireLib$2() {
|
|
147880
150214
|
if (hasRequiredLib$2) return lib$2;
|
|
147881
150215
|
hasRequiredLib$2 = 1;
|
|
147882
|
-
const parseJSON = requireLib$
|
|
150216
|
+
const parseJSON = requireLib$D();
|
|
147883
150217
|
const {
|
|
147884
150218
|
diff
|
|
147885
150219
|
} = requireJustDiff();
|
|
@@ -148061,7 +150395,7 @@ function requireShrinkwrap() {
|
|
|
148061
150395
|
|
|
148062
150396
|
const {
|
|
148063
150397
|
log
|
|
148064
|
-
} = requireLib$
|
|
150398
|
+
} = requireLib$F();
|
|
148065
150399
|
const YarnLock = requireYarnLock();
|
|
148066
150400
|
const {
|
|
148067
150401
|
readFile,
|
|
@@ -148081,7 +150415,7 @@ function requireShrinkwrap() {
|
|
|
148081
150415
|
const npa = requireNpa();
|
|
148082
150416
|
const pkgJson = requireLib$q();
|
|
148083
150417
|
const parseJSON = requireLib$2();
|
|
148084
|
-
const nameFromFolder = requireLib$
|
|
150418
|
+
const nameFromFolder = requireLib$E();
|
|
148085
150419
|
const stringify = requireJsonStringifyNice();
|
|
148086
150420
|
const swKeyOrder = ['name', 'version', 'lockfileVersion', 'resolved', 'integrity', 'requires', 'packages', 'dependencies'];
|
|
148087
150421
|
|
|
@@ -149171,7 +151505,7 @@ function requireBuildIdealTree() {
|
|
|
149171
151505
|
hasRequiredBuildIdealTree = 1;
|
|
149172
151506
|
// mixin implementing the buildIdealTree method
|
|
149173
151507
|
const localeCompare = requireStringLocaleCompare()('en');
|
|
149174
|
-
const rpj = requireLib$
|
|
151508
|
+
const rpj = requireLib$B();
|
|
149175
151509
|
const npa = requireNpa();
|
|
149176
151510
|
const pacote = requireLib$7();
|
|
149177
151511
|
const cacache = requireLib$k();
|
|
@@ -149181,7 +151515,8 @@ function requireBuildIdealTree() {
|
|
|
149181
151515
|
const realpath = requireRealpath();
|
|
149182
151516
|
const {
|
|
149183
151517
|
resolve,
|
|
149184
|
-
dirname
|
|
151518
|
+
dirname,
|
|
151519
|
+
sep
|
|
149185
151520
|
} = path$2;
|
|
149186
151521
|
const treeCheck = requireTreeCheck();
|
|
149187
151522
|
const {
|
|
@@ -149197,7 +151532,7 @@ function requireBuildIdealTree() {
|
|
|
149197
151532
|
const {
|
|
149198
151533
|
log,
|
|
149199
151534
|
time
|
|
149200
|
-
} = requireLib$
|
|
151535
|
+
} = requireLib$F();
|
|
149201
151536
|
const {
|
|
149202
151537
|
redact
|
|
149203
151538
|
} = requireLib$c();
|
|
@@ -149372,10 +151707,12 @@ function requireBuildIdealTree() {
|
|
|
149372
151707
|
const {
|
|
149373
151708
|
engineStrict,
|
|
149374
151709
|
npmVersion,
|
|
149375
|
-
nodeVersion
|
|
151710
|
+
nodeVersion,
|
|
151711
|
+
omit = []
|
|
149376
151712
|
} = this.options;
|
|
151713
|
+
const omitSet = new Set(omit);
|
|
149377
151714
|
for (const node of this.idealTree.inventory.values()) {
|
|
149378
|
-
if (!node.optional) {
|
|
151715
|
+
if (!node.optional && !node.shouldOmit(omitSet)) {
|
|
149379
151716
|
try {
|
|
149380
151717
|
// if devEngines is present in the root node we ignore the engines check
|
|
149381
151718
|
if (!(node.isRoot && node.package.devEngines)) {
|
|
@@ -150394,9 +152731,21 @@ This is a one-time fix-up, please be patient...
|
|
|
150394
152731
|
} = this;
|
|
150395
152732
|
const isWorkspace = this.idealTree.workspaces && this.idealTree.workspaces.has(spec.name);
|
|
150396
152733
|
|
|
150397
|
-
// spec is a directory, link it
|
|
152734
|
+
// spec is a directory, link it if:
|
|
152735
|
+
// - it's a workspace, OR
|
|
152736
|
+
// - it's a project-internal file: dependency (always linked), OR
|
|
152737
|
+
// - it's external and installLinks is false
|
|
150398
152738
|
// TODO post arborist refactor, will need to check for installStrategy=linked
|
|
150399
|
-
|
|
152739
|
+
let isProjectInternalFileSpec = false;
|
|
152740
|
+
if (edge?.rawSpec.startsWith('file:../') || edge?.rawSpec.startsWith('file:./')) {
|
|
152741
|
+
const targetPath = resolve(parent.realpath, edge.rawSpec.slice(5));
|
|
152742
|
+
const resolvedProjectRoot = resolve(this.idealTree.realpath);
|
|
152743
|
+
// Check if the target is within the project root
|
|
152744
|
+
isProjectInternalFileSpec = targetPath.startsWith(resolvedProjectRoot + sep) || targetPath === resolvedProjectRoot;
|
|
152745
|
+
}
|
|
152746
|
+
// Decide whether to link or copy the dependency
|
|
152747
|
+
const shouldLink = isWorkspace || isProjectInternalFileSpec || !installLinks;
|
|
152748
|
+
if (spec.type === 'directory' && shouldLink) {
|
|
150400
152749
|
return this.#linkFromSpec(name, spec, parent, edge);
|
|
150401
152750
|
}
|
|
150402
152751
|
|
|
@@ -150648,11 +152997,6 @@ This is a one-time fix-up, please be patient...
|
|
|
150648
152997
|
const needPrune = metaFromDisk && (mutateTree || flagsSuspect);
|
|
150649
152998
|
if (this.#prune && needPrune) {
|
|
150650
152999
|
this.#idealTreePrune();
|
|
150651
|
-
for (const node of this.idealTree.inventory.values()) {
|
|
150652
|
-
if (node.extraneous) {
|
|
150653
|
-
node.parent = null;
|
|
150654
|
-
}
|
|
150655
|
-
}
|
|
150656
153000
|
}
|
|
150657
153001
|
timeEnd();
|
|
150658
153002
|
}
|
|
@@ -150680,7 +153024,12 @@ This is a one-time fix-up, please be patient...
|
|
|
150680
153024
|
}
|
|
150681
153025
|
#idealTreePrune() {
|
|
150682
153026
|
for (const node of this.idealTree.inventory.values()) {
|
|
150683
|
-
|
|
153027
|
+
// optional peer dependencies are meant to be added to the tree
|
|
153028
|
+
// through an explicit required dependency (most commonly in the
|
|
153029
|
+
// root package.json), at which point they won't be optional so
|
|
153030
|
+
// any dependencies still marked as both optional and peer at
|
|
153031
|
+
// this point can be pruned as a special kind of extraneous
|
|
153032
|
+
if (node.extraneous || node.peer && node.optional) {
|
|
150684
153033
|
node.parent = null;
|
|
150685
153034
|
}
|
|
150686
153035
|
}
|
|
@@ -150754,13 +153103,13 @@ function requireLoadActual() {
|
|
|
150754
153103
|
join,
|
|
150755
153104
|
normalize
|
|
150756
153105
|
} = path$2;
|
|
150757
|
-
const rpj = requireLib$
|
|
153106
|
+
const rpj = requireLib$B();
|
|
150758
153107
|
const {
|
|
150759
153108
|
readdirScoped
|
|
150760
153109
|
} = requireLib$m();
|
|
150761
153110
|
const {
|
|
150762
153111
|
walkUp
|
|
150763
|
-
} = requireCommonjs$
|
|
153112
|
+
} = requireCommonjs$h();
|
|
150764
153113
|
const ancestorPath = requireCommonAncestorPath();
|
|
150765
153114
|
const treeCheck = requireTreeCheck();
|
|
150766
153115
|
const Shrinkwrap = requireShrinkwrap();
|
|
@@ -151201,14 +153550,14 @@ function requireLoadVirtual() {
|
|
|
151201
153550
|
const {
|
|
151202
153551
|
resolve
|
|
151203
153552
|
} = path$2;
|
|
151204
|
-
const nameFromFolder = requireLib$
|
|
153553
|
+
const nameFromFolder = requireLib$E();
|
|
151205
153554
|
const consistentResolve = requireConsistentResolve();
|
|
151206
153555
|
const Shrinkwrap = requireShrinkwrap();
|
|
151207
153556
|
const Node = requireNode$1();
|
|
151208
153557
|
const Link = requireLink();
|
|
151209
153558
|
const relpath = requireRelpath();
|
|
151210
153559
|
const calcDepFlags = requireCalcDepFlags();
|
|
151211
|
-
const rpj = requireLib$
|
|
153560
|
+
const rpj = requireLib$B();
|
|
151212
153561
|
const treeCheck = requireTreeCheck();
|
|
151213
153562
|
const flagsSuspect = Symbol.for('flagsSuspect');
|
|
151214
153563
|
const setWorkspaces = Symbol.for('setWorkspaces');
|
|
@@ -151557,8 +153906,8 @@ function requireRebuild() {
|
|
|
151557
153906
|
depth: dfwalk
|
|
151558
153907
|
} = requireLib$6();
|
|
151559
153908
|
const promiseAllRejectLate = requirePromiseAllRejectLate();
|
|
151560
|
-
const rpj = requireLib$
|
|
151561
|
-
const binLinks = requireLib$
|
|
153909
|
+
const rpj = requireLib$B();
|
|
153910
|
+
const binLinks = requireLib$x();
|
|
151562
153911
|
const runScript = requireRunScript();
|
|
151563
153912
|
const {
|
|
151564
153913
|
callLimit: promiseCallLimit
|
|
@@ -151573,7 +153922,7 @@ function requireRebuild() {
|
|
|
151573
153922
|
const {
|
|
151574
153923
|
log,
|
|
151575
153924
|
time
|
|
151576
|
-
} = requireLib$
|
|
153925
|
+
} = requireLib$F();
|
|
151577
153926
|
const boolEnv = b => b ? '1' : '';
|
|
151578
153927
|
const sortNodes = (a, b) => a.depth - b.depth || localeCompare(a.path, b.path);
|
|
151579
153928
|
const _checkBins = Symbol.for('checkBins');
|
|
@@ -152471,13 +154820,13 @@ function requireReify() {
|
|
|
152471
154820
|
const debug = requireDebug$1();
|
|
152472
154821
|
const {
|
|
152473
154822
|
walkUp
|
|
152474
|
-
} = requireCommonjs$
|
|
154823
|
+
} = requireCommonjs$h();
|
|
152475
154824
|
const {
|
|
152476
154825
|
log,
|
|
152477
154826
|
time
|
|
152478
|
-
} = requireLib$
|
|
152479
|
-
const rpj = requireLib$
|
|
152480
|
-
const hgi = requireLib$
|
|
154827
|
+
} = requireLib$F();
|
|
154828
|
+
const rpj = requireLib$B();
|
|
154829
|
+
const hgi = requireLib$v();
|
|
152481
154830
|
const {
|
|
152482
154831
|
dirname,
|
|
152483
154832
|
resolve,
|
|
@@ -152566,9 +154915,7 @@ function requireReify() {
|
|
|
152566
154915
|
#bundleUnpacked = new Set(); // the nodes we unpack to read their bundles
|
|
152567
154916
|
#dryRun;
|
|
152568
154917
|
#nmValidated = new Set();
|
|
152569
|
-
#
|
|
152570
|
-
#omitPeer;
|
|
152571
|
-
#omitOptional;
|
|
154918
|
+
#omit;
|
|
152572
154919
|
#retiredPaths = {};
|
|
152573
154920
|
#retiredUnchanged = {};
|
|
152574
154921
|
#savePrefix;
|
|
@@ -152588,10 +154935,7 @@ function requireReify() {
|
|
|
152588
154935
|
er.code = 'ESHRINKWRAPGLOBAL';
|
|
152589
154936
|
throw er;
|
|
152590
154937
|
}
|
|
152591
|
-
|
|
152592
|
-
this.#omitDev = omit.has('dev');
|
|
152593
|
-
this.#omitOptional = omit.has('optional');
|
|
152594
|
-
this.#omitPeer = omit.has('peer');
|
|
154938
|
+
this.#omit = new Set(options.omit);
|
|
152595
154939
|
|
|
152596
154940
|
// start tracker block
|
|
152597
154941
|
this.addTracker('reify');
|
|
@@ -153021,7 +155365,7 @@ function requireReify() {
|
|
|
153021
155365
|
// adding to the trash list will skip reifying, and delete them
|
|
153022
155366
|
// if they are currently in the tree and otherwise untouched.
|
|
153023
155367
|
[_addOmitsToTrashList]() {
|
|
153024
|
-
if (!this.#
|
|
155368
|
+
if (!this.#omit.size) {
|
|
153025
155369
|
return;
|
|
153026
155370
|
}
|
|
153027
155371
|
const timeEnd = time.start('reify:trashOmits');
|
|
@@ -153042,7 +155386,7 @@ function requireReify() {
|
|
|
153042
155386
|
}
|
|
153043
155387
|
|
|
153044
155388
|
// omit node if the dep type matches any omit flags that were set
|
|
153045
|
-
if (node.
|
|
155389
|
+
if (node.shouldOmit(this.#omit)) {
|
|
153046
155390
|
this[_addNodeToTrashList](node);
|
|
153047
155391
|
}
|
|
153048
155392
|
}
|
|
@@ -154559,7 +156903,7 @@ function requireArborist() {
|
|
|
154559
156903
|
const {
|
|
154560
156904
|
log,
|
|
154561
156905
|
time
|
|
154562
|
-
} = requireLib$
|
|
156906
|
+
} = requireLib$F();
|
|
154563
156907
|
const {
|
|
154564
156908
|
saveTypeMap
|
|
154565
156909
|
} = requireAddRmPkgDeps();
|
|
@@ -159067,13 +161411,13 @@ function requireLib() {
|
|
|
159067
161411
|
// TODO: set the scope config from package.json or explicit cli config
|
|
159068
161412
|
const {
|
|
159069
161413
|
walkUp
|
|
159070
|
-
} = requireCommonjs$
|
|
161414
|
+
} = requireCommonjs$h();
|
|
159071
161415
|
const ini = requireIni();
|
|
159072
161416
|
const nopt = requireNopt();
|
|
159073
161417
|
const {
|
|
159074
161418
|
log,
|
|
159075
161419
|
time
|
|
159076
|
-
} = requireLib$
|
|
161420
|
+
} = requireLib$F();
|
|
159077
161421
|
const {
|
|
159078
161422
|
resolve,
|
|
159079
161423
|
dirname,
|
|
@@ -160898,12 +163242,13 @@ function requireDefinitions$1() {
|
|
|
160898
163242
|
}),
|
|
160899
163243
|
before: new Definition('before', {
|
|
160900
163244
|
default: null,
|
|
163245
|
+
hint: '<date>',
|
|
160901
163246
|
type: [null, Date],
|
|
160902
163247
|
description: `
|
|
160903
163248
|
If passed to \`npm install\`, will rebuild the npm tree such that only
|
|
160904
|
-
versions that were available **on or before** the
|
|
160905
|
-
installed. If there
|
|
160906
|
-
|
|
163249
|
+
versions that were available **on or before** the given date are
|
|
163250
|
+
installed. If there are no versions available for the current set of
|
|
163251
|
+
dependencies, the command will error.
|
|
160907
163252
|
|
|
160908
163253
|
If the requested version is a \`dist-tag\` and the given tag does not
|
|
160909
163254
|
pass the \`--before\` filter, the most recent version less than or equal
|
|
@@ -160928,7 +163273,7 @@ function requireDefinitions$1() {
|
|
|
160928
163273
|
browser: new Definition('browser', {
|
|
160929
163274
|
default: null,
|
|
160930
163275
|
defaultDescription: `
|
|
160931
|
-
|
|
163276
|
+
macOS: \`"open"\`, Windows: \`"start"\`, Others: \`"xdg-open"\`
|
|
160932
163277
|
`,
|
|
160933
163278
|
type: [null, Boolean, String],
|
|
160934
163279
|
description: `
|
|
@@ -162220,9 +164565,9 @@ function requireDefinitions$1() {
|
|
|
162220
164565
|
}
|
|
162221
164566
|
}),
|
|
162222
164567
|
progress: new Definition('progress', {
|
|
162223
|
-
default: !ciInfo.isCI,
|
|
164568
|
+
default: !(ciInfo.isCI || !process.stderr.isTTY || !process.stdout.isTTY || process.env.TERM === 'dumb'),
|
|
162224
164569
|
defaultDescription: `
|
|
162225
|
-
\`true\`
|
|
164570
|
+
\`true\` when not in CI and both stderr and stdout are TTYs and not in a dumb terminal
|
|
162226
164571
|
`,
|
|
162227
164572
|
type: Boolean,
|
|
162228
164573
|
description: `
|
|
@@ -162232,11 +164577,8 @@ function requireDefinitions$1() {
|
|
|
162232
164577
|
Set to \`false\` to suppress the progress bar.
|
|
162233
164578
|
`,
|
|
162234
164579
|
flatten(key, obj, flatOptions) {
|
|
162235
|
-
|
|
162236
|
-
|
|
162237
|
-
// also. This prevents the progress from appearing when piping output to another
|
|
162238
|
-
// command which doesn't break anything, but does look very odd to users.
|
|
162239
|
-
: !!process.stderr.isTTY && !!process.stdout.isTTY && process.env.TERM !== 'dumb';
|
|
164580
|
+
// Only show progress if explicitly enabled AND we have proper TTY environment
|
|
164581
|
+
flatOptions.progress = !!obj.progress && !!process.stderr.isTTY && !!process.stdout.isTTY && process.env.TERM !== 'dumb';
|
|
162240
164582
|
}
|
|
162241
164583
|
}),
|
|
162242
164584
|
provenance: new Definition('provenance', {
|
|
@@ -171039,7 +173381,7 @@ yargsParser.camelCase = camelCase;
|
|
|
171039
173381
|
yargsParser.decamelize = decamelize;
|
|
171040
173382
|
yargsParser.looksLikeNumber = looksLikeNumber;
|
|
171041
173383
|
|
|
171042
|
-
var libExports = requireLib$
|
|
173384
|
+
var libExports = requireLib$A();
|
|
171043
173385
|
|
|
171044
173386
|
var chalk = {exports: {}};
|
|
171045
173387
|
|
|
@@ -173036,5 +175378,5 @@ exports.terminalLinkExports = terminalLinkExports;
|
|
|
173036
175378
|
exports.updater = updater$1;
|
|
173037
175379
|
exports.yargsParser = yargsParser;
|
|
173038
175380
|
exports.yoctocolorsCjsExports = yoctocolorsCjsExports;
|
|
173039
|
-
//# debugId=
|
|
175381
|
+
//# debugId=22a026e5-cfb1-461f-b739-122e1b9ab409
|
|
173040
175382
|
//# sourceMappingURL=vendor.js.map
|