snyk 1.1292.0 → 1.1292.2
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/293.index.js +567 -776
- package/dist/cli/293.index.js.map +1 -1
- package/dist/cli/470.index.js +13 -3
- package/dist/cli/470.index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +22 -22
- package/package.json +1 -1
- package/src/generated/sha256sums.txt +8 -8
- package/src/generated/version +1 -1
- package/wrapper_dist/generated/sha256sums.txt +8 -8
- package/wrapper_dist/generated/version +1 -1
package/dist/cli/293.index.js
CHANGED
|
@@ -18171,9 +18171,9 @@ const registry_call_1 = __webpack_require__(15271);
|
|
|
18171
18171
|
/**
|
|
18172
18172
|
* Root V2 endpoint, useful to check V2 support and validating credentials.
|
|
18173
18173
|
*/
|
|
18174
|
-
async function checkSupport(registryBase, username, password, options = {}) {
|
|
18174
|
+
async function checkSupport(registryBase, username, password, options = {}, callChainObserver = { visitedUrls: [] }) {
|
|
18175
18175
|
const result = await (0, registry_call_1.registryV2Call)(registryBase, "/", // full url path should be "/v2/" as per spec
|
|
18176
|
-
contentTypes.JSON, username, password, options);
|
|
18176
|
+
contentTypes.JSON, callChainObserver, username, password, options);
|
|
18177
18177
|
// always return thruthy object, even for ECR
|
|
18178
18178
|
return result || {};
|
|
18179
18179
|
}
|
|
@@ -18209,12 +18209,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
18209
18209
|
exports.downloadLayer = void 0;
|
|
18210
18210
|
const registry_call_1 = __webpack_require__(15271);
|
|
18211
18211
|
const contentTypes = __webpack_require__(42625);
|
|
18212
|
-
async function downloadLayer(output, registryBase, repo, digest, username, password, options = {}) {
|
|
18212
|
+
async function downloadLayer(output, registryBase, repo, digest, username, password, options = {}, callChainObserver = { visitedUrls: [] }) {
|
|
18213
18213
|
var _a;
|
|
18214
18214
|
const accept = `${(_a = options.acceptLayer) !== null && _a !== void 0 ? _a : contentTypes.LAYER}`;
|
|
18215
18215
|
const endpoint = `/${repo}/blobs/${digest}`;
|
|
18216
18216
|
options = Object.assign({ json: false, encoding: null, snykInternalOutputStream: output }, options);
|
|
18217
|
-
const layerResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, accept, username, password, options);
|
|
18217
|
+
const layerResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, accept, callChainObserver, username, password, options);
|
|
18218
18218
|
return layerResponse;
|
|
18219
18219
|
}
|
|
18220
18220
|
exports.downloadLayer = downloadLayer;
|
|
@@ -18287,9 +18287,9 @@ exports.getImageConfig = void 0;
|
|
|
18287
18287
|
const registry_call_1 = __webpack_require__(15271);
|
|
18288
18288
|
const contentTypes = __webpack_require__(42625);
|
|
18289
18289
|
const needle_1 = __webpack_require__(48360);
|
|
18290
|
-
async function getImageConfig(registryBase, repo, digest, username, password, options = {}) {
|
|
18290
|
+
async function getImageConfig(registryBase, repo, digest, username, password, options = {}, callChainObserver = { visitedUrls: [] }) {
|
|
18291
18291
|
const endpoint = `/${repo}/blobs/${digest}`;
|
|
18292
|
-
const configResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, contentTypes.IMAGE_CONFIG, username, password, options);
|
|
18292
|
+
const configResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, contentTypes.IMAGE_CONFIG, callChainObserver, username, password, options);
|
|
18293
18293
|
return (0, needle_1.parseResponseBody)(configResponse);
|
|
18294
18294
|
}
|
|
18295
18295
|
exports.getImageConfig = getImageConfig;
|
|
@@ -18305,8 +18305,8 @@ exports.getImageConfig = getImageConfig;
|
|
|
18305
18305
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
18306
18306
|
exports.getImageSize = void 0;
|
|
18307
18307
|
const get_manifest_1 = __webpack_require__(32603);
|
|
18308
|
-
async function getImageSize(registryBase, repo, tag, username, password, options = {}) {
|
|
18309
|
-
const manifest = await (0, get_manifest_1.getManifest)(registryBase, repo, tag, username, password, options);
|
|
18308
|
+
async function getImageSize(registryBase, repo, tag, username, password, options = {}, callChainObserver = { visitedUrls: [] }) {
|
|
18309
|
+
const manifest = await (0, get_manifest_1.getManifest)(registryBase, repo, tag, username, password, options, undefined, callChainObserver);
|
|
18310
18310
|
const layers = manifest.layers || [];
|
|
18311
18311
|
return layers.reduce((size, layerConfig) => size + layerConfig.size, 0);
|
|
18312
18312
|
}
|
|
@@ -18325,12 +18325,12 @@ exports.getLayer = void 0;
|
|
|
18325
18325
|
const registry_call_1 = __webpack_require__(15271);
|
|
18326
18326
|
const contentTypes = __webpack_require__(42625);
|
|
18327
18327
|
/** @deprecated use downloadLayer instead. */
|
|
18328
|
-
async function getLayer(registryBase, repo, digest, username, password, options = {}) {
|
|
18328
|
+
async function getLayer(registryBase, repo, digest, username, password, options = {}, callChainObserver = { visitedUrls: [] }) {
|
|
18329
18329
|
var _a;
|
|
18330
18330
|
const accept = `${(_a = options.acceptLayer) !== null && _a !== void 0 ? _a : contentTypes.LAYER}`;
|
|
18331
18331
|
const endpoint = `/${repo}/blobs/${digest}`;
|
|
18332
18332
|
options = Object.assign({ json: false, encoding: null }, options);
|
|
18333
|
-
const layerResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, accept, username, password, options);
|
|
18333
|
+
const layerResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, accept, callChainObserver, username, password, options);
|
|
18334
18334
|
// When the content type is wrongly set to text instead of binary, response body is returned as string instead of a buffer
|
|
18335
18335
|
// This forces a buffer response.
|
|
18336
18336
|
if (!(layerResponse.body instanceof Buffer)) {
|
|
@@ -18368,7 +18368,7 @@ const digestRegex = /^sha256:[a-f0-9]{64}$/i;
|
|
|
18368
18368
|
* Defaults to linux/amd64. In case the requested manifest platform is not found an error is thrown.
|
|
18369
18369
|
* @returns
|
|
18370
18370
|
*/
|
|
18371
|
-
async function getManifest(registryBase, repo, imageReference, username, password, options = {}, platform) {
|
|
18371
|
+
async function getManifest(registryBase, repo, imageReference, username, password, options = {}, platform, callChainObserver = { visitedUrls: [] }) {
|
|
18372
18372
|
var _a;
|
|
18373
18373
|
const accept = (_a = options.acceptManifest) !== null && _a !== void 0 ? _a : `${contentTypes.MANIFEST_V2}, ${contentTypes.MANIFEST_LIST_V2}`;
|
|
18374
18374
|
const endpoint = `/${repo}/manifests/${imageReference}`;
|
|
@@ -18379,7 +18379,7 @@ async function getManifest(registryBase, repo, imageReference, username, passwor
|
|
|
18379
18379
|
catch (err) {
|
|
18380
18380
|
throw new needle_1.NeedleWrapperException(err.message, 400);
|
|
18381
18381
|
}
|
|
18382
|
-
let manifestResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, accept, username, password, options);
|
|
18382
|
+
let manifestResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, accept, callChainObserver, username, password, options);
|
|
18383
18383
|
const contentType = manifestResponse.headers["content-type"];
|
|
18384
18384
|
let indexDigest;
|
|
18385
18385
|
let manifestDigest;
|
|
@@ -18389,7 +18389,7 @@ async function getManifest(registryBase, repo, imageReference, username, passwor
|
|
|
18389
18389
|
manifestDigest = getManifestDigestByPlatform(manifestResponse, platform);
|
|
18390
18390
|
// need to call again with actual manifest (and not a list of manifest-lists)
|
|
18391
18391
|
const endpoint = `/${repo}/manifests/${manifestDigest}`;
|
|
18392
|
-
manifestResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, accept, username, password, options);
|
|
18392
|
+
manifestResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, accept, callChainObserver !== null && callChainObserver !== void 0 ? callChainObserver : { visitedUrls: [] }, username, password, options);
|
|
18393
18393
|
}
|
|
18394
18394
|
const dockerContentDigest = manifestResponse.headers["Docker-Content-Digest"];
|
|
18395
18395
|
switch (true) {
|
|
@@ -18433,15 +18433,19 @@ function getManifestDigestByPlatform(manifestResponse, platform) {
|
|
|
18433
18433
|
};
|
|
18434
18434
|
const platformFilter = platform ? platform : defaultPlatform;
|
|
18435
18435
|
const manifestList = (0, needle_1.parseResponseBody)(manifestResponse);
|
|
18436
|
-
const manifestPlatform = getManifestByOsAndArch(manifestList.manifests, platformFilter.os, platformFilter.architecture);
|
|
18436
|
+
const manifestPlatform = getManifestByOsAndArch(manifestList.manifests, platformFilter.os, platformFilter.architecture, platformFilter.variant);
|
|
18437
18437
|
if (manifestPlatform) {
|
|
18438
18438
|
return manifestPlatform.digest;
|
|
18439
18439
|
}
|
|
18440
18440
|
throw new Error(`no supported manifest found for platform: ${JSON.stringify(platformFilter)}`);
|
|
18441
18441
|
}
|
|
18442
|
-
function getManifestByOsAndArch(platformManifest, os, architecture) {
|
|
18443
|
-
return platformManifest.find(manifest =>
|
|
18444
|
-
|
|
18442
|
+
function getManifestByOsAndArch(platformManifest, os, architecture, variant) {
|
|
18443
|
+
return platformManifest.find(manifest => {
|
|
18444
|
+
var _a, _b, _c;
|
|
18445
|
+
return ((_a = manifest.platform) === null || _a === void 0 ? void 0 : _a.os) === os &&
|
|
18446
|
+
((_b = manifest.platform) === null || _b === void 0 ? void 0 : _b.architecture) === architecture &&
|
|
18447
|
+
((_c = manifest.platform) === null || _c === void 0 ? void 0 : _c.variant) === variant;
|
|
18448
|
+
});
|
|
18445
18449
|
}
|
|
18446
18450
|
//# sourceMappingURL=get-manifest.js.map
|
|
18447
18451
|
|
|
@@ -18456,9 +18460,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
18456
18460
|
exports.getRepos = void 0;
|
|
18457
18461
|
const contentTypes = __webpack_require__(42625);
|
|
18458
18462
|
const registry_call_1 = __webpack_require__(15271);
|
|
18459
|
-
async function getRepos(registryBase, username, password, pageSize = 100, maxPages = Number.MAX_SAFE_INTEGER, options = {}) {
|
|
18463
|
+
async function getRepos(registryBase, username, password, pageSize = 100, maxPages = Number.MAX_SAFE_INTEGER, options = {}, callChainObserver = { visitedUrls: [] }) {
|
|
18460
18464
|
const endpoint = "/_catalog";
|
|
18461
|
-
|
|
18465
|
+
const result = await (0, registry_call_1.paginatedV2Call)(registryBase, contentTypes.JSON, username, password, endpoint, "repositories", pageSize, maxPages, options, callChainObserver);
|
|
18466
|
+
return result;
|
|
18462
18467
|
}
|
|
18463
18468
|
exports.getRepos = getRepos;
|
|
18464
18469
|
//# sourceMappingURL=get-repos.js.map
|
|
@@ -18474,9 +18479,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
18474
18479
|
exports.getTags = void 0;
|
|
18475
18480
|
const registry_call_1 = __webpack_require__(15271);
|
|
18476
18481
|
const contentTypes = __webpack_require__(42625);
|
|
18477
|
-
async function getTags(registryBase, repo, username, password, pageSize = 1000, maxPages = Number.MAX_SAFE_INTEGER, options = {}) {
|
|
18482
|
+
async function getTags(registryBase, repo, username, password, pageSize = 1000, maxPages = Number.MAX_SAFE_INTEGER, options = {}, callChainObserver = { visitedUrls: [] }) {
|
|
18478
18483
|
const endpoint = `/${repo}/tags/list`;
|
|
18479
|
-
return await (0, registry_call_1.paginatedV2Call)(registryBase, contentTypes.JSON, username, password, endpoint, "tags", pageSize, maxPages, options);
|
|
18484
|
+
return await (0, registry_call_1.paginatedV2Call)(registryBase, contentTypes.JSON, username, password, endpoint, "tags", pageSize, maxPages, options, callChainObserver);
|
|
18480
18485
|
}
|
|
18481
18486
|
exports.getTags = getTags;
|
|
18482
18487
|
//# sourceMappingURL=get-tags.js.map
|
|
@@ -18526,8 +18531,9 @@ exports.contentTypes = contentTypes;
|
|
|
18526
18531
|
"use strict";
|
|
18527
18532
|
|
|
18528
18533
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
18529
|
-
exports.NeedleWrapperException = exports.parseResponseBody = exports.needleWrapper = void 0;
|
|
18534
|
+
exports.checkAllowedHosts = exports.NeedleWrapperException = exports.parseResponseBody = exports.needleWrapper = void 0;
|
|
18530
18535
|
const fs = __webpack_require__(57147);
|
|
18536
|
+
const net = __webpack_require__(41808);
|
|
18531
18537
|
const needle = __webpack_require__(64484);
|
|
18532
18538
|
const stream_1 = __webpack_require__(12781);
|
|
18533
18539
|
// TODO: this is a temporary code that allows setting needle default timeout (alias for
|
|
@@ -18547,9 +18553,16 @@ if (process.env.DOCKER_REGISTRY_V2_CLIENT_NEEDLE_OPEN_TIMEOUT) {
|
|
|
18547
18553
|
* and returns a response that matches what the response it used to get from `request` library
|
|
18548
18554
|
* @param options request options
|
|
18549
18555
|
*/
|
|
18550
|
-
async function needleWrapper(options, maxRetries) {
|
|
18556
|
+
async function needleWrapper(options, maxRetries, callChainObserver = { visitedUrls: [] }) {
|
|
18551
18557
|
var _a, _b;
|
|
18552
18558
|
let uri = options.uri;
|
|
18559
|
+
const allowedHostResult = checkAllowedHosts(uri, {
|
|
18560
|
+
allowedHosts: options.allowedHosts,
|
|
18561
|
+
disallowDangerousHosts: options.disallowDangerousHosts,
|
|
18562
|
+
});
|
|
18563
|
+
if (!allowedHostResult.allowed) {
|
|
18564
|
+
throw new Error(`Refusing to connect to disallowed host ${uri} with reason ${allowedHostResult.denyReason}`);
|
|
18565
|
+
}
|
|
18553
18566
|
// append query parameters
|
|
18554
18567
|
if (options.qs) {
|
|
18555
18568
|
for (const key in options.qs) {
|
|
@@ -18561,6 +18574,7 @@ async function needleWrapper(options, maxRetries) {
|
|
|
18561
18574
|
uri = uri.replace("&", "?");
|
|
18562
18575
|
}
|
|
18563
18576
|
}
|
|
18577
|
+
callChainObserver.visitedUrls.push(uri);
|
|
18564
18578
|
let response;
|
|
18565
18579
|
let lastError;
|
|
18566
18580
|
let retries = maxRetries !== null && maxRetries !== void 0 ? maxRetries : 0;
|
|
@@ -18663,6 +18677,52 @@ async function stream(readable, writeable) {
|
|
|
18663
18677
|
(0, stream_1.pipeline)(readable, writeable, err => err ? reject(err) : resolve(response));
|
|
18664
18678
|
});
|
|
18665
18679
|
}
|
|
18680
|
+
function checkAllowedHosts(uri, options) {
|
|
18681
|
+
let host;
|
|
18682
|
+
try {
|
|
18683
|
+
host = new URL(uri).hostname;
|
|
18684
|
+
}
|
|
18685
|
+
catch (err) {
|
|
18686
|
+
throw new Error(`Failed to parse host from uri: ${uri}`);
|
|
18687
|
+
}
|
|
18688
|
+
if (options.allowedHosts && !options.allowedHosts.includes(host)) {
|
|
18689
|
+
return {
|
|
18690
|
+
allowed: false,
|
|
18691
|
+
denyReason: "host disallowed by allowed hosts filter",
|
|
18692
|
+
};
|
|
18693
|
+
}
|
|
18694
|
+
if (options.disallowDangerousHosts) {
|
|
18695
|
+
// Disallow IPv4 addresses
|
|
18696
|
+
if (net.isIPv4(host)) {
|
|
18697
|
+
return {
|
|
18698
|
+
allowed: false,
|
|
18699
|
+
denyReason: "host disallowed by IPv4 address filter",
|
|
18700
|
+
};
|
|
18701
|
+
}
|
|
18702
|
+
if (/^\[.*\]$/.test(host) && net.isIPv6(host.slice(1, -1))) {
|
|
18703
|
+
return {
|
|
18704
|
+
allowed: false,
|
|
18705
|
+
denyReason: "host disallowed by IPv6 address filter",
|
|
18706
|
+
};
|
|
18707
|
+
}
|
|
18708
|
+
// Disallow hosts in the cluster.local subdomain
|
|
18709
|
+
if (/cluster\.local$/.test(host)) {
|
|
18710
|
+
return {
|
|
18711
|
+
allowed: false,
|
|
18712
|
+
denyReason: "host disallowed by cluster.local subdomains filter",
|
|
18713
|
+
};
|
|
18714
|
+
}
|
|
18715
|
+
// Disallow hosts without a TLD+1
|
|
18716
|
+
if (!host.includes(".")) {
|
|
18717
|
+
return {
|
|
18718
|
+
allowed: false,
|
|
18719
|
+
denyReason: "host disallowed by require TLD+1 filter",
|
|
18720
|
+
};
|
|
18721
|
+
}
|
|
18722
|
+
}
|
|
18723
|
+
return { allowed: true };
|
|
18724
|
+
}
|
|
18725
|
+
exports.checkAllowedHosts = checkAllowedHosts;
|
|
18666
18726
|
//# sourceMappingURL=needle.js.map
|
|
18667
18727
|
|
|
18668
18728
|
/***/ }),
|
|
@@ -18680,10 +18740,11 @@ const needle_1 = __webpack_require__(48360);
|
|
|
18680
18740
|
const BEARER_REALM = "Bearer realm";
|
|
18681
18741
|
const MAX_RETRIES = 1;
|
|
18682
18742
|
const MAX_REDIRECTS = 5;
|
|
18683
|
-
async function registryV2Call(registryBase, endpoint, accept, username, password, reqOptions = {}) {
|
|
18743
|
+
async function registryV2Call(registryBase, endpoint, accept, callChainObserver, username, password, reqOptions = {}) {
|
|
18684
18744
|
const reqConfig = buildUnauthenticatedV2RequestConfig(registryBase, endpoint, accept, reqOptions);
|
|
18685
18745
|
try {
|
|
18686
|
-
|
|
18746
|
+
callChainObserver.visitedUrls.push();
|
|
18747
|
+
return await (0, needle_1.needleWrapper)(reqConfig, MAX_RETRIES, callChainObserver);
|
|
18687
18748
|
}
|
|
18688
18749
|
catch (err) {
|
|
18689
18750
|
if (err.statusCode === 401) {
|
|
@@ -18695,17 +18756,17 @@ async function registryV2Call(registryBase, endpoint, accept, username, password
|
|
|
18695
18756
|
}
|
|
18696
18757
|
const authConfig = await setAuthConfig(registryBase, err, reqConfig, username, password, reqOptions);
|
|
18697
18758
|
try {
|
|
18698
|
-
return await (0, needle_1.needleWrapper)(authConfig, MAX_RETRIES);
|
|
18759
|
+
return await (0, needle_1.needleWrapper)(authConfig, MAX_RETRIES, callChainObserver);
|
|
18699
18760
|
}
|
|
18700
18761
|
catch (err) {
|
|
18701
18762
|
if (isRedirectStatus(err.statusCode)) {
|
|
18702
|
-
return await handleRedirect(err, reqConfig);
|
|
18763
|
+
return await handleRedirect(err, reqConfig, callChainObserver);
|
|
18703
18764
|
}
|
|
18704
18765
|
throw err;
|
|
18705
18766
|
}
|
|
18706
18767
|
}
|
|
18707
18768
|
if (isRedirectStatus(err.statusCode)) {
|
|
18708
|
-
return await handleRedirect(err, reqConfig);
|
|
18769
|
+
return await handleRedirect(err, reqConfig, callChainObserver);
|
|
18709
18770
|
}
|
|
18710
18771
|
throw err;
|
|
18711
18772
|
}
|
|
@@ -18721,10 +18782,10 @@ exports.registryV2Call = registryV2Call;
|
|
|
18721
18782
|
* Once it's no longer necessary, it is advised that this function is removed.
|
|
18722
18783
|
*
|
|
18723
18784
|
*/
|
|
18724
|
-
async function registryCall(uri, username, password, reqOptions = {}) {
|
|
18785
|
+
async function registryCall(uri, username, password, reqOptions = {}, callChainObserver = { visitedUrls: [] }) {
|
|
18725
18786
|
const reqConfig = applyRequestOptions({ uri: `https://${uri}` }, reqOptions);
|
|
18726
18787
|
try {
|
|
18727
|
-
return await (0, needle_1.needleWrapper)(reqConfig, MAX_RETRIES);
|
|
18788
|
+
return await (0, needle_1.needleWrapper)(reqConfig, MAX_RETRIES, callChainObserver);
|
|
18728
18789
|
}
|
|
18729
18790
|
catch (err) {
|
|
18730
18791
|
if (err.statusCode === 401) {
|
|
@@ -18736,28 +18797,28 @@ async function registryCall(uri, username, password, reqOptions = {}) {
|
|
|
18736
18797
|
}
|
|
18737
18798
|
const authConfig = await setAuthConfig("", err, reqConfig, username, password, reqOptions);
|
|
18738
18799
|
try {
|
|
18739
|
-
return await (0, needle_1.needleWrapper)(authConfig, MAX_RETRIES);
|
|
18800
|
+
return await (0, needle_1.needleWrapper)(authConfig, MAX_RETRIES, callChainObserver);
|
|
18740
18801
|
}
|
|
18741
18802
|
catch (err) {
|
|
18742
18803
|
if (isRedirectStatus(err.statusCode)) {
|
|
18743
|
-
return await handleRedirect(err, reqConfig);
|
|
18804
|
+
return await handleRedirect(err, reqConfig, callChainObserver);
|
|
18744
18805
|
}
|
|
18745
18806
|
throw err;
|
|
18746
18807
|
}
|
|
18747
18808
|
}
|
|
18748
18809
|
if (isRedirectStatus(err.statusCode)) {
|
|
18749
|
-
return await handleRedirect(err, reqConfig);
|
|
18810
|
+
return await handleRedirect(err, reqConfig, callChainObserver);
|
|
18750
18811
|
}
|
|
18751
18812
|
throw err;
|
|
18752
18813
|
}
|
|
18753
18814
|
}
|
|
18754
18815
|
exports.registryCall = registryCall;
|
|
18755
|
-
async function paginatedV2Call(registryBase, accept, username, password, endpoint, key, pageSize = 1000, maxPages = Number.MAX_SAFE_INTEGER, reqOptions = {}) {
|
|
18816
|
+
async function paginatedV2Call(registryBase, accept, username, password, endpoint, key, pageSize = 1000, maxPages = Number.MAX_SAFE_INTEGER, reqOptions = {}, callChainObserver = { visitedUrls: [] }) {
|
|
18756
18817
|
const result = [];
|
|
18757
18818
|
let pageEndpoint = `${endpoint}?n=${pageSize}`;
|
|
18758
18819
|
let pageCount = 0;
|
|
18759
18820
|
while (pageCount < maxPages) {
|
|
18760
|
-
const response = await registryV2Call(registryBase, pageEndpoint, accept, username, password, reqOptions);
|
|
18821
|
+
const response = await registryV2Call(registryBase, pageEndpoint, accept, callChainObserver, username, password, reqOptions);
|
|
18761
18822
|
const body = (0, needle_1.parseResponseBody)(response);
|
|
18762
18823
|
if (body && body[key]) {
|
|
18763
18824
|
result.push(...body[key]);
|
|
@@ -18840,10 +18901,10 @@ async function setAuthConfig(registryBase, err, reqConfig, username, password, r
|
|
|
18840
18901
|
}
|
|
18841
18902
|
}
|
|
18842
18903
|
// Handle redirect while following up to MAX_REDIRECTS
|
|
18843
|
-
async function handleRedirect(err, config) {
|
|
18844
|
-
return handleRedirectRec(err, config, MAX_REDIRECTS);
|
|
18904
|
+
async function handleRedirect(err, config, callChainObserver) {
|
|
18905
|
+
return handleRedirectRec(err, config, MAX_REDIRECTS, callChainObserver);
|
|
18845
18906
|
}
|
|
18846
|
-
async function handleRedirectRec(err, config, maxRedirects = 0) {
|
|
18907
|
+
async function handleRedirectRec(err, config, maxRedirects = 0, callChainObserver) {
|
|
18847
18908
|
if (maxRedirects === 0) {
|
|
18848
18909
|
throw err;
|
|
18849
18910
|
}
|
|
@@ -18863,11 +18924,11 @@ async function handleRedirectRec(err, config, maxRedirects = 0) {
|
|
|
18863
18924
|
const redirectUrl = assertFullUrl(location, config.uri);
|
|
18864
18925
|
config.uri = redirectUrl;
|
|
18865
18926
|
try {
|
|
18866
|
-
return await (0, needle_1.needleWrapper)(config, MAX_RETRIES);
|
|
18927
|
+
return await (0, needle_1.needleWrapper)(config, MAX_RETRIES, callChainObserver);
|
|
18867
18928
|
}
|
|
18868
18929
|
catch (err) {
|
|
18869
18930
|
if (isRedirectStatus(err.statusCode)) {
|
|
18870
|
-
return await handleRedirectRec(err, config, maxRedirects - 1);
|
|
18931
|
+
return await handleRedirectRec(err, config, maxRedirects - 1, callChainObserver);
|
|
18871
18932
|
}
|
|
18872
18933
|
throw err;
|
|
18873
18934
|
}
|
|
@@ -18971,7 +19032,7 @@ class ValidationError extends Error {
|
|
|
18971
19032
|
exports.ValidationError = ValidationError;
|
|
18972
19033
|
function validateRepoOrImageRef(input) {
|
|
18973
19034
|
const invalidCharacters = ["&", ";", " ", '"'];
|
|
18974
|
-
if (input.trim().length === 0) {
|
|
19035
|
+
if (!input || input.trim().length === 0) {
|
|
18975
19036
|
throw new ValidationError(exports.REPO_IMAGE_REF_BLANK_ERROR);
|
|
18976
19037
|
}
|
|
18977
19038
|
if (invalidCharacters.some(c => input.includes(c))) {
|
|
@@ -33908,7 +33969,7 @@ class DockerPull {
|
|
|
33908
33969
|
async pull(registryBase, repo, tag, opt) {
|
|
33909
33970
|
var _a, _b;
|
|
33910
33971
|
const loadImage = (opt === null || opt === void 0 ? void 0 : opt.loadImage) === undefined ? true : opt.loadImage;
|
|
33911
|
-
const manifest = await registryClient.getManifest(registryBase, repo, tag, opt === null || opt === void 0 ? void 0 : opt.username, opt === null || opt === void 0 ? void 0 : opt.password, opt === null || opt === void 0 ? void 0 : opt.reqOptions);
|
|
33972
|
+
const manifest = await registryClient.getManifest(registryBase, repo, tag, opt === null || opt === void 0 ? void 0 : opt.username, opt === null || opt === void 0 ? void 0 : opt.password, opt === null || opt === void 0 ? void 0 : opt.reqOptions, opt === null || opt === void 0 ? void 0 : opt.platform);
|
|
33912
33973
|
const indexDigest = (_a = manifest.indexDigest) !== null && _a !== void 0 ? _a : undefined;
|
|
33913
33974
|
const manifestDigest = (_b = manifest.manifestDigest) !== null && _b !== void 0 ? _b : undefined;
|
|
33914
33975
|
if (manifest.schemaVersion !== 2) {
|
|
@@ -34241,11 +34302,10 @@ exports.dirSync = dirSync;
|
|
|
34241
34302
|
|
|
34242
34303
|
const tar = __webpack_require__(5464)
|
|
34243
34304
|
const pump = __webpack_require__(74286)
|
|
34244
|
-
const mkdirp = __webpack_require__(42986)
|
|
34245
34305
|
const fs = __webpack_require__(57147)
|
|
34246
34306
|
const path = __webpack_require__(71017)
|
|
34247
34307
|
|
|
34248
|
-
const win32 = process.platform === 'win32'
|
|
34308
|
+
const win32 = (global.Bare?.platform || process.platform) === 'win32'
|
|
34249
34309
|
|
|
34250
34310
|
exports.pack = function pack (cwd, opts) {
|
|
34251
34311
|
if (!cwd) cwd = '.'
|
|
@@ -34286,6 +34346,7 @@ exports.pack = function pack (cwd, opts) {
|
|
|
34286
34346
|
}
|
|
34287
34347
|
|
|
34288
34348
|
function onstat (err, filename, stat) {
|
|
34349
|
+
if (pack.destroyed) return
|
|
34289
34350
|
if (err) return pack.destroy(err)
|
|
34290
34351
|
if (!filename) {
|
|
34291
34352
|
if (opts.finalize !== false) pack.finalize()
|
|
@@ -34539,7 +34600,7 @@ exports.extract = function extract (cwd, opts) {
|
|
|
34539
34600
|
xfs.stat(name, function (err) {
|
|
34540
34601
|
if (!err) return cb(null)
|
|
34541
34602
|
if (err.code !== 'ENOENT') return cb(err)
|
|
34542
|
-
|
|
34603
|
+
xfs.mkdir(name, { mode: opts.mode, recursive: true }, function (err, made) {
|
|
34543
34604
|
if (err) return cb(err)
|
|
34544
34605
|
chperm(name, opts, cb)
|
|
34545
34606
|
})
|
|
@@ -35086,7 +35147,7 @@ exports.decodePax = function decodePax (buf) {
|
|
|
35086
35147
|
while (buf.length) {
|
|
35087
35148
|
let i = 0
|
|
35088
35149
|
while (i < buf.length && buf[i] !== 32) i++
|
|
35089
|
-
const len = parseInt(buf.subarray(0, i)
|
|
35150
|
+
const len = parseInt(b4a.toString(buf.subarray(0, i)), 10)
|
|
35090
35151
|
if (!len) return result
|
|
35091
35152
|
|
|
35092
35153
|
const b = b4a.toString(buf.subarray(i + 1, len - 1))
|
|
@@ -35356,7 +35417,7 @@ function decodeOct (val, offset, length) {
|
|
|
35356
35417
|
const end = clamp(indexOf(val, 32, offset, val.length), val.length, val.length)
|
|
35357
35418
|
while (offset < end && val[offset] === 0) offset++
|
|
35358
35419
|
if (end === offset) return 0
|
|
35359
|
-
return parseInt(val.subarray(offset, end)
|
|
35420
|
+
return parseInt(b4a.toString(val.subarray(offset, end)), 8)
|
|
35360
35421
|
}
|
|
35361
35422
|
}
|
|
35362
35423
|
|
|
@@ -179316,111 +179377,6 @@ module.exports = (fromStream, toStream) => {
|
|
|
179316
179377
|
};
|
|
179317
179378
|
|
|
179318
179379
|
|
|
179319
|
-
/***/ }),
|
|
179320
|
-
|
|
179321
|
-
/***/ 42986:
|
|
179322
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
179323
|
-
|
|
179324
|
-
var path = __webpack_require__(71017);
|
|
179325
|
-
var fs = __webpack_require__(57147);
|
|
179326
|
-
var _0777 = parseInt('0777', 8);
|
|
179327
|
-
|
|
179328
|
-
module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
|
|
179329
|
-
|
|
179330
|
-
function mkdirP (p, opts, f, made) {
|
|
179331
|
-
if (typeof opts === 'function') {
|
|
179332
|
-
f = opts;
|
|
179333
|
-
opts = {};
|
|
179334
|
-
}
|
|
179335
|
-
else if (!opts || typeof opts !== 'object') {
|
|
179336
|
-
opts = { mode: opts };
|
|
179337
|
-
}
|
|
179338
|
-
|
|
179339
|
-
var mode = opts.mode;
|
|
179340
|
-
var xfs = opts.fs || fs;
|
|
179341
|
-
|
|
179342
|
-
if (mode === undefined) {
|
|
179343
|
-
mode = _0777 & (~process.umask());
|
|
179344
|
-
}
|
|
179345
|
-
if (!made) made = null;
|
|
179346
|
-
|
|
179347
|
-
var cb = f || function () {};
|
|
179348
|
-
p = path.resolve(p);
|
|
179349
|
-
|
|
179350
|
-
xfs.mkdir(p, mode, function (er) {
|
|
179351
|
-
if (!er) {
|
|
179352
|
-
made = made || p;
|
|
179353
|
-
return cb(null, made);
|
|
179354
|
-
}
|
|
179355
|
-
switch (er.code) {
|
|
179356
|
-
case 'ENOENT':
|
|
179357
|
-
mkdirP(path.dirname(p), opts, function (er, made) {
|
|
179358
|
-
if (er) cb(er, made);
|
|
179359
|
-
else mkdirP(p, opts, cb, made);
|
|
179360
|
-
});
|
|
179361
|
-
break;
|
|
179362
|
-
|
|
179363
|
-
// In the case of any other error, just see if there's a dir
|
|
179364
|
-
// there already. If so, then hooray! If not, then something
|
|
179365
|
-
// is borked.
|
|
179366
|
-
default:
|
|
179367
|
-
xfs.stat(p, function (er2, stat) {
|
|
179368
|
-
// if the stat fails, then that's super weird.
|
|
179369
|
-
// let the original error be the failure reason.
|
|
179370
|
-
if (er2 || !stat.isDirectory()) cb(er, made)
|
|
179371
|
-
else cb(null, made);
|
|
179372
|
-
});
|
|
179373
|
-
break;
|
|
179374
|
-
}
|
|
179375
|
-
});
|
|
179376
|
-
}
|
|
179377
|
-
|
|
179378
|
-
mkdirP.sync = function sync (p, opts, made) {
|
|
179379
|
-
if (!opts || typeof opts !== 'object') {
|
|
179380
|
-
opts = { mode: opts };
|
|
179381
|
-
}
|
|
179382
|
-
|
|
179383
|
-
var mode = opts.mode;
|
|
179384
|
-
var xfs = opts.fs || fs;
|
|
179385
|
-
|
|
179386
|
-
if (mode === undefined) {
|
|
179387
|
-
mode = _0777 & (~process.umask());
|
|
179388
|
-
}
|
|
179389
|
-
if (!made) made = null;
|
|
179390
|
-
|
|
179391
|
-
p = path.resolve(p);
|
|
179392
|
-
|
|
179393
|
-
try {
|
|
179394
|
-
xfs.mkdirSync(p, mode);
|
|
179395
|
-
made = made || p;
|
|
179396
|
-
}
|
|
179397
|
-
catch (err0) {
|
|
179398
|
-
switch (err0.code) {
|
|
179399
|
-
case 'ENOENT' :
|
|
179400
|
-
made = sync(path.dirname(p), opts, made);
|
|
179401
|
-
sync(p, opts, made);
|
|
179402
|
-
break;
|
|
179403
|
-
|
|
179404
|
-
// In the case of any other error, just see if there's a dir
|
|
179405
|
-
// there already. If so, then hooray! If not, then something
|
|
179406
|
-
// is borked.
|
|
179407
|
-
default:
|
|
179408
|
-
var stat;
|
|
179409
|
-
try {
|
|
179410
|
-
stat = xfs.statSync(p);
|
|
179411
|
-
}
|
|
179412
|
-
catch (err1) {
|
|
179413
|
-
throw err0;
|
|
179414
|
-
}
|
|
179415
|
-
if (!stat.isDirectory()) throw err0;
|
|
179416
|
-
break;
|
|
179417
|
-
}
|
|
179418
|
-
}
|
|
179419
|
-
|
|
179420
|
-
return made;
|
|
179421
|
-
};
|
|
179422
|
-
|
|
179423
|
-
|
|
179424
179380
|
/***/ }),
|
|
179425
179381
|
|
|
179426
179382
|
/***/ 23424:
|
|
@@ -192556,19 +192512,19 @@ exports.parsePomProperties = parsePomProperties;
|
|
|
192556
192512
|
"use strict";
|
|
192557
192513
|
|
|
192558
192514
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
192559
|
-
exports.groupFilesByDirectory = exports.cleanupAppNodeModules = exports.
|
|
192515
|
+
exports.groupFilesByDirectory = exports.cleanupAppNodeModules = exports.persistNodeModules = void 0;
|
|
192560
192516
|
const Debug = __webpack_require__(15158);
|
|
192561
192517
|
const promises_1 = __webpack_require__(73292);
|
|
192562
192518
|
const path = __webpack_require__(71017);
|
|
192563
192519
|
const debug = Debug("snyk");
|
|
192564
|
-
async function
|
|
192520
|
+
async function createTempProjectDir(projectDir) {
|
|
192565
192521
|
const tmpDir = await (0, promises_1.mkdtemp)("snyk");
|
|
192566
|
-
const
|
|
192567
|
-
|
|
192568
|
-
|
|
192569
|
-
|
|
192570
|
-
|
|
192571
|
-
|
|
192522
|
+
const tempProjectRoot = path.join(tmpDir, projectDir);
|
|
192523
|
+
await (0, promises_1.mkdir)(tempProjectRoot, { recursive: true });
|
|
192524
|
+
return {
|
|
192525
|
+
tmpDir,
|
|
192526
|
+
tempProjectRoot,
|
|
192527
|
+
};
|
|
192572
192528
|
}
|
|
192573
192529
|
const manifestName = "package.json";
|
|
192574
192530
|
async function fileExists(path) {
|
|
@@ -192576,44 +192532,39 @@ async function fileExists(path) {
|
|
|
192576
192532
|
.then(() => true)
|
|
192577
192533
|
.catch(() => false);
|
|
192578
192534
|
}
|
|
192579
|
-
async function
|
|
192535
|
+
async function createSyntheticManifest(tempRootManifestDir) {
|
|
192580
192536
|
const tempRootManifestPath = path.join(tempRootManifestDir, manifestName);
|
|
192581
192537
|
debug(`Creating an empty synthetic manifest file: ${tempRootManifestPath}`);
|
|
192582
192538
|
await (0, promises_1.writeFile)(tempRootManifestPath, "{}", "utf-8");
|
|
192583
192539
|
}
|
|
192584
|
-
async function
|
|
192585
|
-
for (const
|
|
192586
|
-
const
|
|
192587
|
-
|
|
192588
|
-
continue;
|
|
192589
|
-
}
|
|
192590
|
-
const manifestPath = path.join(dependencyPath, "package.json");
|
|
192591
|
-
const manifestContent = filePathToContent[manifestPath];
|
|
192592
|
-
await createFile(path.join(tempAppRootDirPath, manifestPath), manifestContent);
|
|
192540
|
+
async function saveOnDisk(tempDir, modules, filePathToContent) {
|
|
192541
|
+
for (const module of modules) {
|
|
192542
|
+
const manifestContent = filePathToContent[module];
|
|
192543
|
+
await createFile(path.join(tempDir, module), manifestContent);
|
|
192593
192544
|
}
|
|
192594
192545
|
}
|
|
192595
|
-
async function
|
|
192596
|
-
const
|
|
192597
|
-
|
|
192598
|
-
|
|
192599
|
-
if (
|
|
192546
|
+
async function persistNodeModules(project, filePathToContent, fileNamesGroupedByDirectory) {
|
|
192547
|
+
const modules = fileNamesGroupedByDirectory.get(project);
|
|
192548
|
+
const tmpDir = "";
|
|
192549
|
+
const tempProjectRoot = "";
|
|
192550
|
+
if (!modules || modules.size === 0) {
|
|
192600
192551
|
debug(`Empty application directory tree.`);
|
|
192601
192552
|
return {
|
|
192602
192553
|
tempDir: tmpDir,
|
|
192603
|
-
|
|
192554
|
+
tempProjectPath: tempProjectRoot,
|
|
192604
192555
|
};
|
|
192605
192556
|
}
|
|
192606
192557
|
try {
|
|
192607
|
-
|
|
192608
|
-
await
|
|
192558
|
+
const { tmpDir, tempProjectRoot } = await createTempProjectDir(project);
|
|
192559
|
+
await saveOnDisk(tmpDir, modules, filePathToContent);
|
|
192609
192560
|
const result = {
|
|
192610
192561
|
tempDir: tmpDir,
|
|
192611
|
-
|
|
192612
|
-
manifestPath: path.join(
|
|
192562
|
+
tempProjectPath: tempProjectRoot,
|
|
192563
|
+
manifestPath: path.join(tempProjectRoot.substring(tmpDir.length), manifestName),
|
|
192613
192564
|
};
|
|
192614
|
-
const manifestFileExists = await fileExists(path.join(
|
|
192565
|
+
const manifestFileExists = await fileExists(path.join(tempProjectRoot, manifestName));
|
|
192615
192566
|
if (!manifestFileExists) {
|
|
192616
|
-
await
|
|
192567
|
+
await createSyntheticManifest(tempProjectRoot);
|
|
192617
192568
|
delete result.manifestPath;
|
|
192618
192569
|
}
|
|
192619
192570
|
return result;
|
|
@@ -192622,26 +192573,28 @@ async function persistAppNodeModules(filePathToContent, fileNamesGroupedByDirect
|
|
|
192622
192573
|
debug(`Failed to copy the application manifest files locally: ${error.message}`);
|
|
192623
192574
|
return {
|
|
192624
192575
|
tempDir: tmpDir,
|
|
192625
|
-
|
|
192576
|
+
tempProjectPath: tempProjectRoot,
|
|
192626
192577
|
};
|
|
192627
192578
|
}
|
|
192628
192579
|
}
|
|
192629
|
-
exports.
|
|
192580
|
+
exports.persistNodeModules = persistNodeModules;
|
|
192630
192581
|
async function createFile(filePath, fileContent) {
|
|
192631
192582
|
await (0, promises_1.mkdir)(path.dirname(filePath), { recursive: true });
|
|
192632
192583
|
await (0, promises_1.writeFile)(filePath, fileContent, "utf-8");
|
|
192633
192584
|
}
|
|
192634
192585
|
function groupFilesByDirectory(filePathToContent) {
|
|
192635
|
-
|
|
192586
|
+
var _a;
|
|
192587
|
+
const filesByDir = new Map();
|
|
192636
192588
|
for (const filePath of Object.keys(filePathToContent)) {
|
|
192637
|
-
const directory =
|
|
192638
|
-
|
|
192639
|
-
|
|
192640
|
-
|
|
192589
|
+
const directory = filePath.includes("node_modules")
|
|
192590
|
+
? filePath.split("/node_modules")[0]
|
|
192591
|
+
: path.dirname(filePath);
|
|
192592
|
+
if (!filesByDir.has(directory)) {
|
|
192593
|
+
filesByDir.set(directory, new Set());
|
|
192641
192594
|
}
|
|
192642
|
-
|
|
192595
|
+
(_a = filesByDir.get(directory)) === null || _a === void 0 ? void 0 : _a.add(filePath);
|
|
192643
192596
|
}
|
|
192644
|
-
return
|
|
192597
|
+
return filesByDir;
|
|
192645
192598
|
}
|
|
192646
192599
|
exports.groupFilesByDirectory = groupFilesByDirectory;
|
|
192647
192600
|
async function cleanupAppNodeModules(appRootDir) {
|
|
@@ -192672,6 +192625,7 @@ const resolveDeps = __webpack_require__(40068);
|
|
|
192672
192625
|
const debug = Debug("snyk");
|
|
192673
192626
|
const node_modules_utils_1 = __webpack_require__(89252);
|
|
192674
192627
|
async function nodeFilesToScannedProjects(filePathToContent) {
|
|
192628
|
+
const scanResults = [];
|
|
192675
192629
|
/**
|
|
192676
192630
|
* TODO: Add support for Yarn workspaces!
|
|
192677
192631
|
* https://github.com/snyk/nodejs-lockfile-parser/blob/af8ba81930e950156b539281ecf41c1bc63dacf4/test/lib/yarn-workflows.test.ts#L7-L17
|
|
@@ -192685,46 +192639,57 @@ async function nodeFilesToScannedProjects(filePathToContent) {
|
|
|
192685
192639
|
return [];
|
|
192686
192640
|
}
|
|
192687
192641
|
const fileNamesGroupedByDirectory = (0, node_modules_utils_1.groupFilesByDirectory)(filePathToContent);
|
|
192688
|
-
const manifestFilePairs =
|
|
192689
|
-
|
|
192690
|
-
|
|
192691
|
-
|
|
192642
|
+
const [manifestFilePairs, nodeProjects] = findProjectsAndManifests(fileNamesGroupedByDirectory);
|
|
192643
|
+
if (manifestFilePairs.length !== 0) {
|
|
192644
|
+
scanResults.push(...(await depGraphFromManifestFiles(filePathToContent, manifestFilePairs)));
|
|
192645
|
+
}
|
|
192646
|
+
if (nodeProjects.length !== 0) {
|
|
192647
|
+
scanResults.push(...(await depGraphFromNodeModules(filePathToContent, nodeProjects, fileNamesGroupedByDirectory)));
|
|
192648
|
+
}
|
|
192649
|
+
return scanResults;
|
|
192692
192650
|
}
|
|
192693
192651
|
exports.nodeFilesToScannedProjects = nodeFilesToScannedProjects;
|
|
192694
|
-
async function depGraphFromNodeModules(filePathToContent, fileNamesGroupedByDirectory) {
|
|
192695
|
-
const { tempDir, tempApplicationPath, manifestPath } = await (0, node_modules_utils_1.persistAppNodeModules)(filePathToContent, fileNamesGroupedByDirectory);
|
|
192696
|
-
if (!tempApplicationPath) {
|
|
192697
|
-
return [];
|
|
192698
|
-
}
|
|
192652
|
+
async function depGraphFromNodeModules(filePathToContent, nodeProjects, fileNamesGroupedByDirectory) {
|
|
192699
192653
|
const scanResults = [];
|
|
192700
|
-
|
|
192701
|
-
const
|
|
192702
|
-
|
|
192703
|
-
|
|
192704
|
-
|
|
192705
|
-
|
|
192706
|
-
|
|
192707
|
-
|
|
192708
|
-
|
|
192709
|
-
|
|
192710
|
-
|
|
192711
|
-
|
|
192712
|
-
|
|
192713
|
-
|
|
192714
|
-
|
|
192654
|
+
for (const project of nodeProjects) {
|
|
192655
|
+
const { tempDir, tempProjectPath, manifestPath } = await (0, node_modules_utils_1.persistNodeModules)(project, filePathToContent, fileNamesGroupedByDirectory);
|
|
192656
|
+
if (!tempProjectPath) {
|
|
192657
|
+
await (0, node_modules_utils_1.cleanupAppNodeModules)(tempDir);
|
|
192658
|
+
continue;
|
|
192659
|
+
}
|
|
192660
|
+
try {
|
|
192661
|
+
const pkgTree = await resolveDeps(tempProjectPath, {
|
|
192662
|
+
dev: false,
|
|
192663
|
+
noFromArrays: true,
|
|
192664
|
+
});
|
|
192665
|
+
const depGraph = await dep_graph_1.legacy.depTreeToGraph(pkgTree, pkgTree.type || "npm");
|
|
192666
|
+
scanResults.push({
|
|
192667
|
+
facts: [
|
|
192668
|
+
{
|
|
192669
|
+
type: "depGraph",
|
|
192670
|
+
data: depGraph,
|
|
192671
|
+
},
|
|
192672
|
+
{
|
|
192673
|
+
type: "testedFiles",
|
|
192674
|
+
data: manifestPath
|
|
192675
|
+
? manifestPath
|
|
192676
|
+
: path.join(project, "node_modules"),
|
|
192677
|
+
},
|
|
192678
|
+
],
|
|
192679
|
+
identity: {
|
|
192680
|
+
type: depGraph.pkgManager.name,
|
|
192681
|
+
targetFile: manifestPath
|
|
192682
|
+
? manifestPath
|
|
192683
|
+
: path.join(project, "node_modules"),
|
|
192715
192684
|
},
|
|
192716
|
-
|
|
192717
|
-
|
|
192718
|
-
|
|
192719
|
-
|
|
192720
|
-
|
|
192721
|
-
|
|
192722
|
-
|
|
192723
|
-
|
|
192724
|
-
debug(`An error occurred while analysing node_modules dir: ${error.message}`);
|
|
192725
|
-
}
|
|
192726
|
-
finally {
|
|
192727
|
-
await (0, node_modules_utils_1.cleanupAppNodeModules)(tempDir);
|
|
192685
|
+
});
|
|
192686
|
+
}
|
|
192687
|
+
catch (error) {
|
|
192688
|
+
debug(`An error occurred while analysing node_modules dir: ${error.message}`);
|
|
192689
|
+
}
|
|
192690
|
+
finally {
|
|
192691
|
+
await (0, node_modules_utils_1.cleanupAppNodeModules)(tempDir);
|
|
192692
|
+
}
|
|
192728
192693
|
}
|
|
192729
192694
|
return scanResults;
|
|
192730
192695
|
}
|
|
@@ -192734,7 +192699,14 @@ async function depGraphFromManifestFiles(filePathToContent, manifestFilePairs) {
|
|
|
192734
192699
|
const shouldBeStrictForManifestAndLockfileOutOfSync = false;
|
|
192735
192700
|
for (const pathPair of manifestFilePairs) {
|
|
192736
192701
|
// TODO: initially generate as DepGraph
|
|
192737
|
-
|
|
192702
|
+
let parserResult;
|
|
192703
|
+
try {
|
|
192704
|
+
parserResult = await lockFileParser.buildDepTree(filePathToContent[pathPair.manifest], filePathToContent[pathPair.lock], shouldIncludeDevDependencies, pathPair.lockType, shouldBeStrictForManifestAndLockfileOutOfSync);
|
|
192705
|
+
}
|
|
192706
|
+
catch (err) {
|
|
192707
|
+
debug(`An error occurred while analysing a pair of manifest and lock files: ${err.message}`);
|
|
192708
|
+
continue;
|
|
192709
|
+
}
|
|
192738
192710
|
const strippedLabelsParserResult = stripUndefinedLabels(parserResult);
|
|
192739
192711
|
const depGraph = await dep_graph_1.legacy.depTreeToGraph(strippedLabelsParserResult, pathPair.lockType);
|
|
192740
192712
|
const depGraphFact = {
|
|
@@ -192755,38 +192727,41 @@ async function depGraphFromManifestFiles(filePathToContent, manifestFilePairs) {
|
|
|
192755
192727
|
}
|
|
192756
192728
|
return scanResults;
|
|
192757
192729
|
}
|
|
192758
|
-
function
|
|
192730
|
+
function findProjectsAndManifests(fileNamesGroupedByDirectory) {
|
|
192759
192731
|
const manifestLockPathPairs = [];
|
|
192760
|
-
|
|
192761
|
-
|
|
192762
|
-
|
|
192763
|
-
|
|
192764
|
-
|
|
192765
|
-
if (filesInDirectory.length !== 2) {
|
|
192766
|
-
// either a missing file or too many files, ignore
|
|
192732
|
+
const nodeProjects = [];
|
|
192733
|
+
for (const directoryPath of fileNamesGroupedByDirectory.keys()) {
|
|
192734
|
+
const filesInDirectory = fileNamesGroupedByDirectory.get(directoryPath);
|
|
192735
|
+
if (!filesInDirectory || filesInDirectory.size < 1) {
|
|
192736
|
+
// missing manifest files
|
|
192767
192737
|
continue;
|
|
192768
192738
|
}
|
|
192769
|
-
const
|
|
192770
|
-
const
|
|
192771
|
-
const
|
|
192772
|
-
|
|
192773
|
-
|
|
192774
|
-
|
|
192775
|
-
|
|
192776
|
-
|
|
192777
|
-
});
|
|
192739
|
+
const expectedManifest = path.join(directoryPath, "package.json");
|
|
192740
|
+
const expectedNpmLockFile = path.join(directoryPath, "package-lock.json");
|
|
192741
|
+
const expectedYarnLockFile = path.join(directoryPath, "yarn.lock");
|
|
192742
|
+
const hasManifestFileOnly = filesInDirectory.has(expectedManifest) &&
|
|
192743
|
+
!(filesInDirectory.has(expectedNpmLockFile) ||
|
|
192744
|
+
filesInDirectory.has(expectedYarnLockFile));
|
|
192745
|
+
const hasNoManifestFile = !filesInDirectory.has(expectedManifest);
|
|
192746
|
+
if (hasManifestFileOnly && filesInDirectory.size === 1) {
|
|
192778
192747
|
continue;
|
|
192779
192748
|
}
|
|
192780
|
-
if (
|
|
192781
|
-
|
|
192782
|
-
manifest: path.join(directoryPath, "package.json"),
|
|
192783
|
-
lock: path.join(directoryPath, "yarn.lock"),
|
|
192784
|
-
lockType: lockFileParser.LockfileType.yarn,
|
|
192785
|
-
});
|
|
192749
|
+
if (hasManifestFileOnly || hasNoManifestFile) {
|
|
192750
|
+
nodeProjects.push(directoryPath);
|
|
192786
192751
|
continue;
|
|
192787
192752
|
}
|
|
192753
|
+
manifestLockPathPairs.push({
|
|
192754
|
+
manifest: expectedManifest,
|
|
192755
|
+
// TODO: correlate filtering action with expected lockfile types
|
|
192756
|
+
lock: filesInDirectory.has(expectedNpmLockFile)
|
|
192757
|
+
? expectedNpmLockFile
|
|
192758
|
+
: expectedYarnLockFile,
|
|
192759
|
+
lockType: filesInDirectory.has(expectedNpmLockFile)
|
|
192760
|
+
? lockFileParser.LockfileType.npm
|
|
192761
|
+
: lockFileParser.LockfileType.yarn,
|
|
192762
|
+
});
|
|
192788
192763
|
}
|
|
192789
|
-
return manifestLockPathPairs;
|
|
192764
|
+
return [manifestLockPathPairs, nodeProjects];
|
|
192790
192765
|
}
|
|
192791
192766
|
function stripUndefinedLabels(parserResult) {
|
|
192792
192767
|
const optionalLabels = parserResult.labels;
|
|
@@ -192923,6 +192898,7 @@ const Debug = __webpack_require__(15158);
|
|
|
192923
192898
|
const event_loop_spinner_1 = __webpack_require__(77158);
|
|
192924
192899
|
const path = __webpack_require__(71017);
|
|
192925
192900
|
const semver = __webpack_require__(41009);
|
|
192901
|
+
const common_1 = __webpack_require__(60409);
|
|
192926
192902
|
const metadata_parser_1 = __webpack_require__(97176);
|
|
192927
192903
|
const requirements_parser_1 = __webpack_require__(13157);
|
|
192928
192904
|
const debug = Debug("snyk");
|
|
@@ -193007,7 +192983,7 @@ async function pipFilesToScannedProjects(filePathToContent) {
|
|
|
193007
192983
|
// pre-sort each package name by version, descending
|
|
193008
192984
|
for (const name of Object.keys(metadataItems)) {
|
|
193009
192985
|
metadataItems[name].sort((v1, v2) => {
|
|
193010
|
-
return
|
|
192986
|
+
return (0, common_1.compareVersions)(v1.version, v2.version);
|
|
193011
192987
|
});
|
|
193012
192988
|
}
|
|
193013
192989
|
for (const requirementsFile of Object.keys(requirements)) {
|
|
@@ -193188,11 +193164,11 @@ function handleDockerPullError(err, platform) {
|
|
|
193188
193164
|
throw new Error(err);
|
|
193189
193165
|
}
|
|
193190
193166
|
}
|
|
193191
|
-
async function pullFromContainerRegistry(docker, targetImage, imageSavePath, username, password) {
|
|
193167
|
+
async function pullFromContainerRegistry(docker, targetImage, imageSavePath, username, password, platform) {
|
|
193192
193168
|
const { hostname, imageName, tag } = extractImageDetails(targetImage);
|
|
193193
193169
|
debug(`Attempting to pull: registry: ${hostname}, image: ${imageName}, tag: ${tag}`);
|
|
193194
193170
|
try {
|
|
193195
|
-
return await docker.pull(hostname, imageName, tag, imageSavePath, username, password);
|
|
193171
|
+
return await docker.pull(hostname, imageName, tag, imageSavePath, username, password, platform);
|
|
193196
193172
|
}
|
|
193197
193173
|
catch (err) {
|
|
193198
193174
|
handleDockerPullError(err.message);
|
|
@@ -193206,7 +193182,7 @@ async function pullImage(docker, targetImage, saveLocation, imageSavePath, usern
|
|
|
193206
193182
|
return new image_1.ImageName(targetImage);
|
|
193207
193183
|
}
|
|
193208
193184
|
}
|
|
193209
|
-
const { indexDigest, manifestDigest } = await pullFromContainerRegistry(docker, targetImage, imageSavePath, username, password);
|
|
193185
|
+
const { indexDigest, manifestDigest } = await pullFromContainerRegistry(docker, targetImage, imageSavePath, username, password, platform);
|
|
193210
193186
|
const imageName = new image_1.ImageName(targetImage, {
|
|
193211
193187
|
manifest: manifestDigest,
|
|
193212
193188
|
index: indexDigest,
|
|
@@ -194532,12 +194508,26 @@ class Docker {
|
|
|
194532
194508
|
return false;
|
|
194533
194509
|
}
|
|
194534
194510
|
}
|
|
194535
|
-
async pull(registry, repo, tag, imageSavePath, username, password) {
|
|
194511
|
+
async pull(registry, repo, tag, imageSavePath, username, password, platform) {
|
|
194536
194512
|
const dockerPull = new snyk_docker_pull_1.DockerPull();
|
|
194513
|
+
const platformTokens = platform ? platform.split("/") : undefined;
|
|
194514
|
+
let os = "linux";
|
|
194515
|
+
let architecture = "amd64";
|
|
194516
|
+
let variant;
|
|
194517
|
+
if (platformTokens) {
|
|
194518
|
+
const platformTokensLen = platformTokens.length;
|
|
194519
|
+
if (platformTokensLen <= 1) {
|
|
194520
|
+
throw Error("Invalid platform string. Please provide a platform name that follows os/arch[/variant] format.");
|
|
194521
|
+
}
|
|
194522
|
+
os = platformTokens[0];
|
|
194523
|
+
architecture = platformTokens[1];
|
|
194524
|
+
variant = platformTokens[2];
|
|
194525
|
+
}
|
|
194537
194526
|
const opt = {
|
|
194538
194527
|
username,
|
|
194539
194528
|
password,
|
|
194540
194529
|
loadImage: false,
|
|
194530
|
+
platform: platformTokens ? { os, architecture, variant } : undefined,
|
|
194541
194531
|
imageSavePath,
|
|
194542
194532
|
reqOptions: {
|
|
194543
194533
|
acceptManifest: [
|
|
@@ -196985,16 +196975,12 @@ exports.getJarFileContentAction = {
|
|
|
196985
196975
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
196986
196976
|
exports.getNodeAppFileContentAction = void 0;
|
|
196987
196977
|
const path_1 = __webpack_require__(71017);
|
|
196988
|
-
const path = __webpack_require__(71017);
|
|
196989
196978
|
const stream_utils_1 = __webpack_require__(54540);
|
|
196990
|
-
const ignoredPaths = ["/usr", "/bin", "/opt", "C:\\"];
|
|
196991
196979
|
const nodeAppFiles = ["package.json", "package-lock.json", "yarn.lock"];
|
|
196992
196980
|
const deletedAppFiles = nodeAppFiles.map((file) => ".wh." + file);
|
|
196993
196981
|
function filePathMatches(filePath) {
|
|
196994
196982
|
const fileName = (0, path_1.basename)(filePath);
|
|
196995
|
-
|
|
196996
|
-
return (!ignoredPaths.some((ignorePath) => dirName.includes(ignorePath)) &&
|
|
196997
|
-
(nodeAppFiles.includes(fileName) || deletedAppFiles.includes(fileName)));
|
|
196983
|
+
return nodeAppFiles.includes(fileName) || deletedAppFiles.includes(fileName);
|
|
196998
196984
|
}
|
|
196999
196985
|
exports.getNodeAppFileContentAction = {
|
|
197000
196986
|
actionName: "node-app-files",
|
|
@@ -197328,7 +197314,7 @@ exports.parseAnalysisResults = parseAnalysisResults;
|
|
|
197328
197314
|
"use strict";
|
|
197329
197315
|
|
|
197330
197316
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
197331
|
-
exports.specifierValidRange = void 0;
|
|
197317
|
+
exports.compareVersions = exports.VERSION_EXTRACTION_REGEX = exports.specifierValidRange = void 0;
|
|
197332
197318
|
function specifierValidRange(specifier, version) {
|
|
197333
197319
|
specifier =
|
|
197334
197320
|
specifier === "==" || specifier === "===" || specifier === "~="
|
|
@@ -197345,6 +197331,40 @@ function specifierValidRange(specifier, version) {
|
|
|
197345
197331
|
return versionPartsLength === 2 ? "^" : "~";
|
|
197346
197332
|
}
|
|
197347
197333
|
exports.specifierValidRange = specifierValidRange;
|
|
197334
|
+
// This regex is used to extract the "semver" part from the version string.
|
|
197335
|
+
// See the tests for a better understanding (Also the reason why this is exported)
|
|
197336
|
+
exports.VERSION_EXTRACTION_REGEX = /(?<VERSION>(\d+\.)*\d+).*/;
|
|
197337
|
+
function compareArrays(v1, v2) {
|
|
197338
|
+
const max = v1.length > v2.length ? v1.length : v2.length;
|
|
197339
|
+
for (let i = 0; i < max; i++) {
|
|
197340
|
+
if ((v1[i] || 0) < (v2[i] || 0)) {
|
|
197341
|
+
return 1;
|
|
197342
|
+
}
|
|
197343
|
+
if ((v1[i] || 0) > (v2[i] || 0)) {
|
|
197344
|
+
return -1;
|
|
197345
|
+
}
|
|
197346
|
+
}
|
|
197347
|
+
return 0;
|
|
197348
|
+
}
|
|
197349
|
+
/**
|
|
197350
|
+
* This function was taken from a different semver library and slightly modified.
|
|
197351
|
+
* If passed to Array.prototype.sort, versions will be sorted in descending order.
|
|
197352
|
+
*/
|
|
197353
|
+
function compareVersions(version1, version2) {
|
|
197354
|
+
const v1Match = exports.VERSION_EXTRACTION_REGEX.exec(version1);
|
|
197355
|
+
const v2Match = exports.VERSION_EXTRACTION_REGEX.exec(version2);
|
|
197356
|
+
if (v1Match === null || v2Match === null) {
|
|
197357
|
+
return 0;
|
|
197358
|
+
}
|
|
197359
|
+
const v1 = v1Match
|
|
197360
|
+
.groups.VERSION.split(".")
|
|
197361
|
+
.map((part) => Number.parseInt(part, 10));
|
|
197362
|
+
const v2 = v2Match
|
|
197363
|
+
.groups.VERSION.split(".")
|
|
197364
|
+
.map((part) => Number.parseInt(part, 10));
|
|
197365
|
+
return compareArrays(v1, v2);
|
|
197366
|
+
}
|
|
197367
|
+
exports.compareVersions = compareVersions;
|
|
197348
197368
|
//# sourceMappingURL=common.js.map
|
|
197349
197369
|
|
|
197350
197370
|
/***/ }),
|
|
@@ -202854,481 +202874,6 @@ const forEachStep = (self, fn, node, thisp) => {
|
|
|
202854
202874
|
module.exports = LRUCache
|
|
202855
202875
|
|
|
202856
202876
|
|
|
202857
|
-
/***/ }),
|
|
202858
|
-
|
|
202859
|
-
/***/ 15305:
|
|
202860
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
202861
|
-
|
|
202862
|
-
"use strict";
|
|
202863
|
-
|
|
202864
|
-
|
|
202865
|
-
const util = __webpack_require__(73837);
|
|
202866
|
-
const braces = __webpack_require__(86744);
|
|
202867
|
-
const picomatch = __webpack_require__(59444);
|
|
202868
|
-
const utils = __webpack_require__(28702);
|
|
202869
|
-
const isEmptyString = val => val === '' || val === './';
|
|
202870
|
-
|
|
202871
|
-
/**
|
|
202872
|
-
* Returns an array of strings that match one or more glob patterns.
|
|
202873
|
-
*
|
|
202874
|
-
* ```js
|
|
202875
|
-
* const mm = require('micromatch');
|
|
202876
|
-
* // mm(list, patterns[, options]);
|
|
202877
|
-
*
|
|
202878
|
-
* console.log(mm(['a.js', 'a.txt'], ['*.js']));
|
|
202879
|
-
* //=> [ 'a.js' ]
|
|
202880
|
-
* ```
|
|
202881
|
-
* @param {String|Array<string>} `list` List of strings to match.
|
|
202882
|
-
* @param {String|Array<string>} `patterns` One or more glob patterns to use for matching.
|
|
202883
|
-
* @param {Object} `options` See available [options](#options)
|
|
202884
|
-
* @return {Array} Returns an array of matches
|
|
202885
|
-
* @summary false
|
|
202886
|
-
* @api public
|
|
202887
|
-
*/
|
|
202888
|
-
|
|
202889
|
-
const micromatch = (list, patterns, options) => {
|
|
202890
|
-
patterns = [].concat(patterns);
|
|
202891
|
-
list = [].concat(list);
|
|
202892
|
-
|
|
202893
|
-
let omit = new Set();
|
|
202894
|
-
let keep = new Set();
|
|
202895
|
-
let items = new Set();
|
|
202896
|
-
let negatives = 0;
|
|
202897
|
-
|
|
202898
|
-
let onResult = state => {
|
|
202899
|
-
items.add(state.output);
|
|
202900
|
-
if (options && options.onResult) {
|
|
202901
|
-
options.onResult(state);
|
|
202902
|
-
}
|
|
202903
|
-
};
|
|
202904
|
-
|
|
202905
|
-
for (let i = 0; i < patterns.length; i++) {
|
|
202906
|
-
let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
|
|
202907
|
-
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
202908
|
-
if (negated) negatives++;
|
|
202909
|
-
|
|
202910
|
-
for (let item of list) {
|
|
202911
|
-
let matched = isMatch(item, true);
|
|
202912
|
-
|
|
202913
|
-
let match = negated ? !matched.isMatch : matched.isMatch;
|
|
202914
|
-
if (!match) continue;
|
|
202915
|
-
|
|
202916
|
-
if (negated) {
|
|
202917
|
-
omit.add(matched.output);
|
|
202918
|
-
} else {
|
|
202919
|
-
omit.delete(matched.output);
|
|
202920
|
-
keep.add(matched.output);
|
|
202921
|
-
}
|
|
202922
|
-
}
|
|
202923
|
-
}
|
|
202924
|
-
|
|
202925
|
-
let result = negatives === patterns.length ? [...items] : [...keep];
|
|
202926
|
-
let matches = result.filter(item => !omit.has(item));
|
|
202927
|
-
|
|
202928
|
-
if (options && matches.length === 0) {
|
|
202929
|
-
if (options.failglob === true) {
|
|
202930
|
-
throw new Error(`No matches found for "${patterns.join(', ')}"`);
|
|
202931
|
-
}
|
|
202932
|
-
|
|
202933
|
-
if (options.nonull === true || options.nullglob === true) {
|
|
202934
|
-
return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns;
|
|
202935
|
-
}
|
|
202936
|
-
}
|
|
202937
|
-
|
|
202938
|
-
return matches;
|
|
202939
|
-
};
|
|
202940
|
-
|
|
202941
|
-
/**
|
|
202942
|
-
* Backwards compatibility
|
|
202943
|
-
*/
|
|
202944
|
-
|
|
202945
|
-
micromatch.match = micromatch;
|
|
202946
|
-
|
|
202947
|
-
/**
|
|
202948
|
-
* Returns a matcher function from the given glob `pattern` and `options`.
|
|
202949
|
-
* The returned function takes a string to match as its only argument and returns
|
|
202950
|
-
* true if the string is a match.
|
|
202951
|
-
*
|
|
202952
|
-
* ```js
|
|
202953
|
-
* const mm = require('micromatch');
|
|
202954
|
-
* // mm.matcher(pattern[, options]);
|
|
202955
|
-
*
|
|
202956
|
-
* const isMatch = mm.matcher('*.!(*a)');
|
|
202957
|
-
* console.log(isMatch('a.a')); //=> false
|
|
202958
|
-
* console.log(isMatch('a.b')); //=> true
|
|
202959
|
-
* ```
|
|
202960
|
-
* @param {String} `pattern` Glob pattern
|
|
202961
|
-
* @param {Object} `options`
|
|
202962
|
-
* @return {Function} Returns a matcher function.
|
|
202963
|
-
* @api public
|
|
202964
|
-
*/
|
|
202965
|
-
|
|
202966
|
-
micromatch.matcher = (pattern, options) => picomatch(pattern, options);
|
|
202967
|
-
|
|
202968
|
-
/**
|
|
202969
|
-
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
202970
|
-
*
|
|
202971
|
-
* ```js
|
|
202972
|
-
* const mm = require('micromatch');
|
|
202973
|
-
* // mm.isMatch(string, patterns[, options]);
|
|
202974
|
-
*
|
|
202975
|
-
* console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
202976
|
-
* console.log(mm.isMatch('a.a', 'b.*')); //=> false
|
|
202977
|
-
* ```
|
|
202978
|
-
* @param {String} `str` The string to test.
|
|
202979
|
-
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
|
|
202980
|
-
* @param {Object} `[options]` See available [options](#options).
|
|
202981
|
-
* @return {Boolean} Returns true if any patterns match `str`
|
|
202982
|
-
* @api public
|
|
202983
|
-
*/
|
|
202984
|
-
|
|
202985
|
-
micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
202986
|
-
|
|
202987
|
-
/**
|
|
202988
|
-
* Backwards compatibility
|
|
202989
|
-
*/
|
|
202990
|
-
|
|
202991
|
-
micromatch.any = micromatch.isMatch;
|
|
202992
|
-
|
|
202993
|
-
/**
|
|
202994
|
-
* Returns a list of strings that _**do not match any**_ of the given `patterns`.
|
|
202995
|
-
*
|
|
202996
|
-
* ```js
|
|
202997
|
-
* const mm = require('micromatch');
|
|
202998
|
-
* // mm.not(list, patterns[, options]);
|
|
202999
|
-
*
|
|
203000
|
-
* console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
|
|
203001
|
-
* //=> ['b.b', 'c.c']
|
|
203002
|
-
* ```
|
|
203003
|
-
* @param {Array} `list` Array of strings to match.
|
|
203004
|
-
* @param {String|Array} `patterns` One or more glob pattern to use for matching.
|
|
203005
|
-
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
|
203006
|
-
* @return {Array} Returns an array of strings that **do not match** the given patterns.
|
|
203007
|
-
* @api public
|
|
203008
|
-
*/
|
|
203009
|
-
|
|
203010
|
-
micromatch.not = (list, patterns, options = {}) => {
|
|
203011
|
-
patterns = [].concat(patterns).map(String);
|
|
203012
|
-
let result = new Set();
|
|
203013
|
-
let items = [];
|
|
203014
|
-
|
|
203015
|
-
let onResult = state => {
|
|
203016
|
-
if (options.onResult) options.onResult(state);
|
|
203017
|
-
items.push(state.output);
|
|
203018
|
-
};
|
|
203019
|
-
|
|
203020
|
-
let matches = new Set(micromatch(list, patterns, { ...options, onResult }));
|
|
203021
|
-
|
|
203022
|
-
for (let item of items) {
|
|
203023
|
-
if (!matches.has(item)) {
|
|
203024
|
-
result.add(item);
|
|
203025
|
-
}
|
|
203026
|
-
}
|
|
203027
|
-
return [...result];
|
|
203028
|
-
};
|
|
203029
|
-
|
|
203030
|
-
/**
|
|
203031
|
-
* Returns true if the given `string` contains the given pattern. Similar
|
|
203032
|
-
* to [.isMatch](#isMatch) but the pattern can match any part of the string.
|
|
203033
|
-
*
|
|
203034
|
-
* ```js
|
|
203035
|
-
* var mm = require('micromatch');
|
|
203036
|
-
* // mm.contains(string, pattern[, options]);
|
|
203037
|
-
*
|
|
203038
|
-
* console.log(mm.contains('aa/bb/cc', '*b'));
|
|
203039
|
-
* //=> true
|
|
203040
|
-
* console.log(mm.contains('aa/bb/cc', '*d'));
|
|
203041
|
-
* //=> false
|
|
203042
|
-
* ```
|
|
203043
|
-
* @param {String} `str` The string to match.
|
|
203044
|
-
* @param {String|Array} `patterns` Glob pattern to use for matching.
|
|
203045
|
-
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
|
203046
|
-
* @return {Boolean} Returns true if any of the patterns matches any part of `str`.
|
|
203047
|
-
* @api public
|
|
203048
|
-
*/
|
|
203049
|
-
|
|
203050
|
-
micromatch.contains = (str, pattern, options) => {
|
|
203051
|
-
if (typeof str !== 'string') {
|
|
203052
|
-
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
203053
|
-
}
|
|
203054
|
-
|
|
203055
|
-
if (Array.isArray(pattern)) {
|
|
203056
|
-
return pattern.some(p => micromatch.contains(str, p, options));
|
|
203057
|
-
}
|
|
203058
|
-
|
|
203059
|
-
if (typeof pattern === 'string') {
|
|
203060
|
-
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
203061
|
-
return false;
|
|
203062
|
-
}
|
|
203063
|
-
|
|
203064
|
-
if (str.includes(pattern) || (str.startsWith('./') && str.slice(2).includes(pattern))) {
|
|
203065
|
-
return true;
|
|
203066
|
-
}
|
|
203067
|
-
}
|
|
203068
|
-
|
|
203069
|
-
return micromatch.isMatch(str, pattern, { ...options, contains: true });
|
|
203070
|
-
};
|
|
203071
|
-
|
|
203072
|
-
/**
|
|
203073
|
-
* Filter the keys of the given object with the given `glob` pattern
|
|
203074
|
-
* and `options`. Does not attempt to match nested keys. If you need this feature,
|
|
203075
|
-
* use [glob-object][] instead.
|
|
203076
|
-
*
|
|
203077
|
-
* ```js
|
|
203078
|
-
* const mm = require('micromatch');
|
|
203079
|
-
* // mm.matchKeys(object, patterns[, options]);
|
|
203080
|
-
*
|
|
203081
|
-
* const obj = { aa: 'a', ab: 'b', ac: 'c' };
|
|
203082
|
-
* console.log(mm.matchKeys(obj, '*b'));
|
|
203083
|
-
* //=> { ab: 'b' }
|
|
203084
|
-
* ```
|
|
203085
|
-
* @param {Object} `object` The object with keys to filter.
|
|
203086
|
-
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
|
|
203087
|
-
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
|
203088
|
-
* @return {Object} Returns an object with only keys that match the given patterns.
|
|
203089
|
-
* @api public
|
|
203090
|
-
*/
|
|
203091
|
-
|
|
203092
|
-
micromatch.matchKeys = (obj, patterns, options) => {
|
|
203093
|
-
if (!utils.isObject(obj)) {
|
|
203094
|
-
throw new TypeError('Expected the first argument to be an object');
|
|
203095
|
-
}
|
|
203096
|
-
let keys = micromatch(Object.keys(obj), patterns, options);
|
|
203097
|
-
let res = {};
|
|
203098
|
-
for (let key of keys) res[key] = obj[key];
|
|
203099
|
-
return res;
|
|
203100
|
-
};
|
|
203101
|
-
|
|
203102
|
-
/**
|
|
203103
|
-
* Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
|
|
203104
|
-
*
|
|
203105
|
-
* ```js
|
|
203106
|
-
* const mm = require('micromatch');
|
|
203107
|
-
* // mm.some(list, patterns[, options]);
|
|
203108
|
-
*
|
|
203109
|
-
* console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
|
|
203110
|
-
* // true
|
|
203111
|
-
* console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
|
|
203112
|
-
* // false
|
|
203113
|
-
* ```
|
|
203114
|
-
* @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
|
|
203115
|
-
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
|
|
203116
|
-
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
|
203117
|
-
* @return {Boolean} Returns true if any `patterns` matches any of the strings in `list`
|
|
203118
|
-
* @api public
|
|
203119
|
-
*/
|
|
203120
|
-
|
|
203121
|
-
micromatch.some = (list, patterns, options) => {
|
|
203122
|
-
let items = [].concat(list);
|
|
203123
|
-
|
|
203124
|
-
for (let pattern of [].concat(patterns)) {
|
|
203125
|
-
let isMatch = picomatch(String(pattern), options);
|
|
203126
|
-
if (items.some(item => isMatch(item))) {
|
|
203127
|
-
return true;
|
|
203128
|
-
}
|
|
203129
|
-
}
|
|
203130
|
-
return false;
|
|
203131
|
-
};
|
|
203132
|
-
|
|
203133
|
-
/**
|
|
203134
|
-
* Returns true if every string in the given `list` matches
|
|
203135
|
-
* any of the given glob `patterns`.
|
|
203136
|
-
*
|
|
203137
|
-
* ```js
|
|
203138
|
-
* const mm = require('micromatch');
|
|
203139
|
-
* // mm.every(list, patterns[, options]);
|
|
203140
|
-
*
|
|
203141
|
-
* console.log(mm.every('foo.js', ['foo.js']));
|
|
203142
|
-
* // true
|
|
203143
|
-
* console.log(mm.every(['foo.js', 'bar.js'], ['*.js']));
|
|
203144
|
-
* // true
|
|
203145
|
-
* console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
|
|
203146
|
-
* // false
|
|
203147
|
-
* console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
|
|
203148
|
-
* // false
|
|
203149
|
-
* ```
|
|
203150
|
-
* @param {String|Array} `list` The string or array of strings to test.
|
|
203151
|
-
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
|
|
203152
|
-
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
|
203153
|
-
* @return {Boolean} Returns true if all `patterns` matches all of the strings in `list`
|
|
203154
|
-
* @api public
|
|
203155
|
-
*/
|
|
203156
|
-
|
|
203157
|
-
micromatch.every = (list, patterns, options) => {
|
|
203158
|
-
let items = [].concat(list);
|
|
203159
|
-
|
|
203160
|
-
for (let pattern of [].concat(patterns)) {
|
|
203161
|
-
let isMatch = picomatch(String(pattern), options);
|
|
203162
|
-
if (!items.every(item => isMatch(item))) {
|
|
203163
|
-
return false;
|
|
203164
|
-
}
|
|
203165
|
-
}
|
|
203166
|
-
return true;
|
|
203167
|
-
};
|
|
203168
|
-
|
|
203169
|
-
/**
|
|
203170
|
-
* Returns true if **all** of the given `patterns` match
|
|
203171
|
-
* the specified string.
|
|
203172
|
-
*
|
|
203173
|
-
* ```js
|
|
203174
|
-
* const mm = require('micromatch');
|
|
203175
|
-
* // mm.all(string, patterns[, options]);
|
|
203176
|
-
*
|
|
203177
|
-
* console.log(mm.all('foo.js', ['foo.js']));
|
|
203178
|
-
* // true
|
|
203179
|
-
*
|
|
203180
|
-
* console.log(mm.all('foo.js', ['*.js', '!foo.js']));
|
|
203181
|
-
* // false
|
|
203182
|
-
*
|
|
203183
|
-
* console.log(mm.all('foo.js', ['*.js', 'foo.js']));
|
|
203184
|
-
* // true
|
|
203185
|
-
*
|
|
203186
|
-
* console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
|
|
203187
|
-
* // true
|
|
203188
|
-
* ```
|
|
203189
|
-
* @param {String|Array} `str` The string to test.
|
|
203190
|
-
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
|
|
203191
|
-
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
|
203192
|
-
* @return {Boolean} Returns true if any patterns match `str`
|
|
203193
|
-
* @api public
|
|
203194
|
-
*/
|
|
203195
|
-
|
|
203196
|
-
micromatch.all = (str, patterns, options) => {
|
|
203197
|
-
if (typeof str !== 'string') {
|
|
203198
|
-
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
203199
|
-
}
|
|
203200
|
-
|
|
203201
|
-
return [].concat(patterns).every(p => picomatch(p, options)(str));
|
|
203202
|
-
};
|
|
203203
|
-
|
|
203204
|
-
/**
|
|
203205
|
-
* Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
|
|
203206
|
-
*
|
|
203207
|
-
* ```js
|
|
203208
|
-
* const mm = require('micromatch');
|
|
203209
|
-
* // mm.capture(pattern, string[, options]);
|
|
203210
|
-
*
|
|
203211
|
-
* console.log(mm.capture('test/*.js', 'test/foo.js'));
|
|
203212
|
-
* //=> ['foo']
|
|
203213
|
-
* console.log(mm.capture('test/*.js', 'foo/bar.css'));
|
|
203214
|
-
* //=> null
|
|
203215
|
-
* ```
|
|
203216
|
-
* @param {String} `glob` Glob pattern to use for matching.
|
|
203217
|
-
* @param {String} `input` String to match
|
|
203218
|
-
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
|
203219
|
-
* @return {Array|null} Returns an array of captures if the input matches the glob pattern, otherwise `null`.
|
|
203220
|
-
* @api public
|
|
203221
|
-
*/
|
|
203222
|
-
|
|
203223
|
-
micromatch.capture = (glob, input, options) => {
|
|
203224
|
-
let posix = utils.isWindows(options);
|
|
203225
|
-
let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
|
|
203226
|
-
let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
|
|
203227
|
-
|
|
203228
|
-
if (match) {
|
|
203229
|
-
return match.slice(1).map(v => v === void 0 ? '' : v);
|
|
203230
|
-
}
|
|
203231
|
-
};
|
|
203232
|
-
|
|
203233
|
-
/**
|
|
203234
|
-
* Create a regular expression from the given glob `pattern`.
|
|
203235
|
-
*
|
|
203236
|
-
* ```js
|
|
203237
|
-
* const mm = require('micromatch');
|
|
203238
|
-
* // mm.makeRe(pattern[, options]);
|
|
203239
|
-
*
|
|
203240
|
-
* console.log(mm.makeRe('*.js'));
|
|
203241
|
-
* //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
|
|
203242
|
-
* ```
|
|
203243
|
-
* @param {String} `pattern` A glob pattern to convert to regex.
|
|
203244
|
-
* @param {Object} `options`
|
|
203245
|
-
* @return {RegExp} Returns a regex created from the given pattern.
|
|
203246
|
-
* @api public
|
|
203247
|
-
*/
|
|
203248
|
-
|
|
203249
|
-
micromatch.makeRe = (...args) => picomatch.makeRe(...args);
|
|
203250
|
-
|
|
203251
|
-
/**
|
|
203252
|
-
* Scan a glob pattern to separate the pattern into segments. Used
|
|
203253
|
-
* by the [split](#split) method.
|
|
203254
|
-
*
|
|
203255
|
-
* ```js
|
|
203256
|
-
* const mm = require('micromatch');
|
|
203257
|
-
* const state = mm.scan(pattern[, options]);
|
|
203258
|
-
* ```
|
|
203259
|
-
* @param {String} `pattern`
|
|
203260
|
-
* @param {Object} `options`
|
|
203261
|
-
* @return {Object} Returns an object with
|
|
203262
|
-
* @api public
|
|
203263
|
-
*/
|
|
203264
|
-
|
|
203265
|
-
micromatch.scan = (...args) => picomatch.scan(...args);
|
|
203266
|
-
|
|
203267
|
-
/**
|
|
203268
|
-
* Parse a glob pattern to create the source string for a regular
|
|
203269
|
-
* expression.
|
|
203270
|
-
*
|
|
203271
|
-
* ```js
|
|
203272
|
-
* const mm = require('micromatch');
|
|
203273
|
-
* const state = mm.parse(pattern[, options]);
|
|
203274
|
-
* ```
|
|
203275
|
-
* @param {String} `glob`
|
|
203276
|
-
* @param {Object} `options`
|
|
203277
|
-
* @return {Object} Returns an object with useful properties and output to be used as regex source string.
|
|
203278
|
-
* @api public
|
|
203279
|
-
*/
|
|
203280
|
-
|
|
203281
|
-
micromatch.parse = (patterns, options) => {
|
|
203282
|
-
let res = [];
|
|
203283
|
-
for (let pattern of [].concat(patterns || [])) {
|
|
203284
|
-
for (let str of braces(String(pattern), options)) {
|
|
203285
|
-
res.push(picomatch.parse(str, options));
|
|
203286
|
-
}
|
|
203287
|
-
}
|
|
203288
|
-
return res;
|
|
203289
|
-
};
|
|
203290
|
-
|
|
203291
|
-
/**
|
|
203292
|
-
* Process the given brace `pattern`.
|
|
203293
|
-
*
|
|
203294
|
-
* ```js
|
|
203295
|
-
* const { braces } = require('micromatch');
|
|
203296
|
-
* console.log(braces('foo/{a,b,c}/bar'));
|
|
203297
|
-
* //=> [ 'foo/(a|b|c)/bar' ]
|
|
203298
|
-
*
|
|
203299
|
-
* console.log(braces('foo/{a,b,c}/bar', { expand: true }));
|
|
203300
|
-
* //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ]
|
|
203301
|
-
* ```
|
|
203302
|
-
* @param {String} `pattern` String with brace pattern to process.
|
|
203303
|
-
* @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options.
|
|
203304
|
-
* @return {Array}
|
|
203305
|
-
* @api public
|
|
203306
|
-
*/
|
|
203307
|
-
|
|
203308
|
-
micromatch.braces = (pattern, options) => {
|
|
203309
|
-
if (typeof pattern !== 'string') throw new TypeError('Expected a string');
|
|
203310
|
-
if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) {
|
|
203311
|
-
return [pattern];
|
|
203312
|
-
}
|
|
203313
|
-
return braces(pattern, options);
|
|
203314
|
-
};
|
|
203315
|
-
|
|
203316
|
-
/**
|
|
203317
|
-
* Expand braces
|
|
203318
|
-
*/
|
|
203319
|
-
|
|
203320
|
-
micromatch.braceExpand = (pattern, options) => {
|
|
203321
|
-
if (typeof pattern !== 'string') throw new TypeError('Expected a string');
|
|
203322
|
-
return micromatch.braces(pattern, { ...options, expand: true });
|
|
203323
|
-
};
|
|
203324
|
-
|
|
203325
|
-
/**
|
|
203326
|
-
* Expose micromatch
|
|
203327
|
-
*/
|
|
203328
|
-
|
|
203329
|
-
module.exports = micromatch;
|
|
203330
|
-
|
|
203331
|
-
|
|
203332
202877
|
/***/ }),
|
|
203333
202878
|
|
|
203334
202879
|
/***/ 38545:
|
|
@@ -206718,7 +206263,7 @@ const util_1 = __webpack_require__(76904);
|
|
|
206718
206263
|
const errors_1 = __webpack_require__(52495);
|
|
206719
206264
|
const parsers_1 = __webpack_require__(82244);
|
|
206720
206265
|
const semver = __webpack_require__(41009);
|
|
206721
|
-
const micromatch = __webpack_require__(
|
|
206266
|
+
const micromatch = __webpack_require__(70850);
|
|
206722
206267
|
const pathUtil = __webpack_require__(71017);
|
|
206723
206268
|
const event_loop_spinner_1 = __webpack_require__(77158);
|
|
206724
206269
|
const parseNpmLockV2Project = async (pkgJsonContent, pkgLockContent, options) => {
|
|
@@ -286599,11 +286144,12 @@ const PREMATURE_CLOSE = new Error('Premature close')
|
|
|
286599
286144
|
|
|
286600
286145
|
const queueTick = __webpack_require__(63522)
|
|
286601
286146
|
const FIFO = __webpack_require__(91607)
|
|
286147
|
+
const TextDecoder = __webpack_require__(27540)
|
|
286602
286148
|
|
|
286603
286149
|
/* eslint-disable no-multi-spaces */
|
|
286604
286150
|
|
|
286605
|
-
//
|
|
286606
|
-
const MAX = ((1 <<
|
|
286151
|
+
// 29 bits used total (4 from shared, 14 from read, and 11 from write)
|
|
286152
|
+
const MAX = ((1 << 29) - 1)
|
|
286607
286153
|
|
|
286608
286154
|
// Shared state
|
|
286609
286155
|
const OPENING = 0b0001
|
|
@@ -286615,25 +286161,27 @@ const NOT_OPENING = MAX ^ OPENING
|
|
|
286615
286161
|
const NOT_PREDESTROYING = MAX ^ PREDESTROYING
|
|
286616
286162
|
|
|
286617
286163
|
// Read state (4 bit offset from shared state)
|
|
286618
|
-
const READ_ACTIVE =
|
|
286619
|
-
const READ_UPDATING =
|
|
286620
|
-
const READ_PRIMARY =
|
|
286621
|
-
const READ_QUEUED =
|
|
286622
|
-
const READ_RESUMED =
|
|
286623
|
-
const READ_PIPE_DRAINED =
|
|
286624
|
-
const READ_ENDING =
|
|
286625
|
-
const READ_EMIT_DATA =
|
|
286626
|
-
const READ_EMIT_READABLE =
|
|
286627
|
-
const READ_EMITTED_READABLE =
|
|
286628
|
-
const READ_DONE =
|
|
286629
|
-
const READ_NEXT_TICK =
|
|
286630
|
-
const READ_NEEDS_PUSH =
|
|
286164
|
+
const READ_ACTIVE = 0b00000000000001 << 4
|
|
286165
|
+
const READ_UPDATING = 0b00000000000010 << 4
|
|
286166
|
+
const READ_PRIMARY = 0b00000000000100 << 4
|
|
286167
|
+
const READ_QUEUED = 0b00000000001000 << 4
|
|
286168
|
+
const READ_RESUMED = 0b00000000010000 << 4
|
|
286169
|
+
const READ_PIPE_DRAINED = 0b00000000100000 << 4
|
|
286170
|
+
const READ_ENDING = 0b00000001000000 << 4
|
|
286171
|
+
const READ_EMIT_DATA = 0b00000010000000 << 4
|
|
286172
|
+
const READ_EMIT_READABLE = 0b00000100000000 << 4
|
|
286173
|
+
const READ_EMITTED_READABLE = 0b00001000000000 << 4
|
|
286174
|
+
const READ_DONE = 0b00010000000000 << 4
|
|
286175
|
+
const READ_NEXT_TICK = 0b00100000000000 << 4
|
|
286176
|
+
const READ_NEEDS_PUSH = 0b01000000000000 << 4
|
|
286177
|
+
const READ_READ_AHEAD = 0b10000000000000 << 4
|
|
286631
286178
|
|
|
286632
286179
|
// Combined read state
|
|
286633
286180
|
const READ_FLOWING = READ_RESUMED | READ_PIPE_DRAINED
|
|
286634
286181
|
const READ_ACTIVE_AND_NEEDS_PUSH = READ_ACTIVE | READ_NEEDS_PUSH
|
|
286635
286182
|
const READ_PRIMARY_AND_ACTIVE = READ_PRIMARY | READ_ACTIVE
|
|
286636
286183
|
const READ_EMIT_READABLE_AND_QUEUED = READ_EMIT_READABLE | READ_QUEUED
|
|
286184
|
+
const READ_RESUMED_READ_AHEAD = READ_RESUMED | READ_READ_AHEAD
|
|
286637
286185
|
|
|
286638
286186
|
const READ_NOT_ACTIVE = MAX ^ READ_ACTIVE
|
|
286639
286187
|
const READ_NON_PRIMARY = MAX ^ READ_PRIMARY
|
|
@@ -286645,18 +286193,21 @@ const READ_NOT_ENDING = MAX ^ READ_ENDING
|
|
|
286645
286193
|
const READ_PIPE_NOT_DRAINED = MAX ^ READ_FLOWING
|
|
286646
286194
|
const READ_NOT_NEXT_TICK = MAX ^ READ_NEXT_TICK
|
|
286647
286195
|
const READ_NOT_UPDATING = MAX ^ READ_UPDATING
|
|
286648
|
-
|
|
286649
|
-
|
|
286650
|
-
|
|
286651
|
-
|
|
286652
|
-
const
|
|
286653
|
-
const
|
|
286654
|
-
const
|
|
286655
|
-
const
|
|
286656
|
-
const
|
|
286657
|
-
const
|
|
286658
|
-
const
|
|
286659
|
-
const
|
|
286196
|
+
const READ_NO_READ_AHEAD = MAX ^ READ_READ_AHEAD
|
|
286197
|
+
const READ_PAUSED_NO_READ_AHEAD = MAX ^ READ_RESUMED_READ_AHEAD
|
|
286198
|
+
|
|
286199
|
+
// Write state (18 bit offset, 4 bit offset from shared state and 14 from read state)
|
|
286200
|
+
const WRITE_ACTIVE = 0b00000000001 << 18
|
|
286201
|
+
const WRITE_UPDATING = 0b00000000010 << 18
|
|
286202
|
+
const WRITE_PRIMARY = 0b00000000100 << 18
|
|
286203
|
+
const WRITE_QUEUED = 0b00000001000 << 18
|
|
286204
|
+
const WRITE_UNDRAINED = 0b00000010000 << 18
|
|
286205
|
+
const WRITE_DONE = 0b00000100000 << 18
|
|
286206
|
+
const WRITE_EMIT_DRAIN = 0b00001000000 << 18
|
|
286207
|
+
const WRITE_NEXT_TICK = 0b00010000000 << 18
|
|
286208
|
+
const WRITE_WRITING = 0b00100000000 << 18
|
|
286209
|
+
const WRITE_FINISHING = 0b01000000000 << 18
|
|
286210
|
+
const WRITE_CORKED = 0b10000000000 << 18
|
|
286660
286211
|
|
|
286661
286212
|
const WRITE_NOT_ACTIVE = MAX ^ (WRITE_ACTIVE | WRITE_WRITING)
|
|
286662
286213
|
const WRITE_NON_PRIMARY = MAX ^ WRITE_PRIMARY
|
|
@@ -286665,6 +286216,7 @@ const WRITE_DRAINED = MAX ^ WRITE_UNDRAINED
|
|
|
286665
286216
|
const WRITE_NOT_QUEUED = MAX ^ WRITE_QUEUED
|
|
286666
286217
|
const WRITE_NOT_NEXT_TICK = MAX ^ WRITE_NEXT_TICK
|
|
286667
286218
|
const WRITE_NOT_UPDATING = MAX ^ WRITE_UPDATING
|
|
286219
|
+
const WRITE_NOT_CORKED = MAX ^ WRITE_CORKED
|
|
286668
286220
|
|
|
286669
286221
|
// Combined shared state
|
|
286670
286222
|
const ACTIVE = READ_ACTIVE | WRITE_ACTIVE
|
|
@@ -286683,7 +286235,7 @@ const READ_PRIMARY_STATUS = OPEN_STATUS | READ_ENDING | READ_DONE
|
|
|
286683
286235
|
const READ_STATUS = OPEN_STATUS | READ_DONE | READ_QUEUED
|
|
286684
286236
|
const READ_ENDING_STATUS = OPEN_STATUS | READ_ENDING | READ_QUEUED
|
|
286685
286237
|
const READ_READABLE_STATUS = OPEN_STATUS | READ_EMIT_READABLE | READ_QUEUED | READ_EMITTED_READABLE
|
|
286686
|
-
const SHOULD_NOT_READ = OPEN_STATUS | READ_ACTIVE | READ_ENDING | READ_DONE | READ_NEEDS_PUSH
|
|
286238
|
+
const SHOULD_NOT_READ = OPEN_STATUS | READ_ACTIVE | READ_ENDING | READ_DONE | READ_NEEDS_PUSH | READ_READ_AHEAD
|
|
286687
286239
|
const READ_BACKPRESSURE_STATUS = DESTROY_STATUS | READ_ENDING | READ_DONE
|
|
286688
286240
|
const READ_UPDATE_SYNC_STATUS = READ_UPDATING | OPEN_STATUS | READ_NEXT_TICK | READ_PRIMARY
|
|
286689
286241
|
|
|
@@ -286692,7 +286244,7 @@ const WRITE_PRIMARY_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_DONE
|
|
|
286692
286244
|
const WRITE_QUEUED_AND_UNDRAINED = WRITE_QUEUED | WRITE_UNDRAINED
|
|
286693
286245
|
const WRITE_QUEUED_AND_ACTIVE = WRITE_QUEUED | WRITE_ACTIVE
|
|
286694
286246
|
const WRITE_DRAIN_STATUS = WRITE_QUEUED | WRITE_UNDRAINED | OPEN_STATUS | WRITE_ACTIVE
|
|
286695
|
-
const WRITE_STATUS = OPEN_STATUS | WRITE_ACTIVE | WRITE_QUEUED
|
|
286247
|
+
const WRITE_STATUS = OPEN_STATUS | WRITE_ACTIVE | WRITE_QUEUED | WRITE_CORKED
|
|
286696
286248
|
const WRITE_PRIMARY_AND_ACTIVE = WRITE_PRIMARY | WRITE_ACTIVE
|
|
286697
286249
|
const WRITE_ACTIVE_AND_WRITING = WRITE_ACTIVE | WRITE_WRITING
|
|
286698
286250
|
const WRITE_FINISHING_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_QUEUED_AND_ACTIVE | WRITE_DONE
|
|
@@ -286826,8 +286378,9 @@ class ReadableState {
|
|
|
286826
286378
|
constructor (stream, { highWaterMark = 16384, map = null, mapReadable, byteLength, byteLengthReadable } = {}) {
|
|
286827
286379
|
this.stream = stream
|
|
286828
286380
|
this.queue = new FIFO()
|
|
286829
|
-
this.highWaterMark = highWaterMark
|
|
286381
|
+
this.highWaterMark = highWaterMark === 0 ? 1 : highWaterMark
|
|
286830
286382
|
this.buffered = 0
|
|
286383
|
+
this.readAhead = highWaterMark > 0
|
|
286831
286384
|
this.error = null
|
|
286832
286385
|
this.pipeline = null
|
|
286833
286386
|
this.byteLength = byteLengthReadable || byteLength || defaultByteLength
|
|
@@ -286877,7 +286430,11 @@ class ReadableState {
|
|
|
286877
286430
|
return false
|
|
286878
286431
|
}
|
|
286879
286432
|
|
|
286880
|
-
if (this.map !== null)
|
|
286433
|
+
if (this.map !== null) {
|
|
286434
|
+
data = this.map(data)
|
|
286435
|
+
if (data === null) return this.buffered < this.highWaterMark
|
|
286436
|
+
}
|
|
286437
|
+
|
|
286881
286438
|
this.buffered += this.byteLength(data)
|
|
286882
286439
|
this.queue.push(data)
|
|
286883
286440
|
|
|
@@ -286917,6 +286474,11 @@ class ReadableState {
|
|
|
286917
286474
|
return data
|
|
286918
286475
|
}
|
|
286919
286476
|
|
|
286477
|
+
if (this.readAhead === false) {
|
|
286478
|
+
stream._duplexState |= READ_READ_AHEAD
|
|
286479
|
+
this.updateNextTick()
|
|
286480
|
+
}
|
|
286481
|
+
|
|
286920
286482
|
return null
|
|
286921
286483
|
}
|
|
286922
286484
|
|
|
@@ -286938,7 +286500,7 @@ class ReadableState {
|
|
|
286938
286500
|
do {
|
|
286939
286501
|
this.drain()
|
|
286940
286502
|
|
|
286941
|
-
while (this.buffered < this.highWaterMark && (stream._duplexState & SHOULD_NOT_READ) ===
|
|
286503
|
+
while (this.buffered < this.highWaterMark && (stream._duplexState & SHOULD_NOT_READ) === READ_READ_AHEAD) {
|
|
286942
286504
|
stream._duplexState |= READ_ACTIVE_AND_NEEDS_PUSH
|
|
286943
286505
|
stream._read(this.afterRead)
|
|
286944
286506
|
this.drain()
|
|
@@ -287111,6 +286673,7 @@ function afterWrite (err) {
|
|
|
287111
286673
|
function afterRead (err) {
|
|
287112
286674
|
if (err) this.stream.destroy(err)
|
|
287113
286675
|
this.stream._duplexState &= READ_NOT_ACTIVE
|
|
286676
|
+
if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0) this.stream._duplexState &= READ_NO_READ_AHEAD
|
|
287114
286677
|
this.updateCallback()
|
|
287115
286678
|
}
|
|
287116
286679
|
|
|
@@ -287168,7 +286731,7 @@ function afterTransform (err, data) {
|
|
|
287168
286731
|
function newListener (name) {
|
|
287169
286732
|
if (this._readableState !== null) {
|
|
287170
286733
|
if (name === 'data') {
|
|
287171
|
-
this._duplexState |= (READ_EMIT_DATA |
|
|
286734
|
+
this._duplexState |= (READ_EMIT_DATA | READ_RESUMED_READ_AHEAD)
|
|
287172
286735
|
this._readableState.updateNextTick()
|
|
287173
286736
|
}
|
|
287174
286737
|
if (name === 'readable') {
|
|
@@ -287261,12 +286824,26 @@ class Readable extends Stream {
|
|
|
287261
286824
|
constructor (opts) {
|
|
287262
286825
|
super(opts)
|
|
287263
286826
|
|
|
287264
|
-
this._duplexState |= OPENING | WRITE_DONE
|
|
286827
|
+
this._duplexState |= OPENING | WRITE_DONE | READ_READ_AHEAD
|
|
287265
286828
|
this._readableState = new ReadableState(this, opts)
|
|
287266
286829
|
|
|
287267
286830
|
if (opts) {
|
|
286831
|
+
if (this._readableState.readAhead === false) this._duplexState &= READ_NO_READ_AHEAD
|
|
287268
286832
|
if (opts.read) this._read = opts.read
|
|
287269
286833
|
if (opts.eagerOpen) this._readableState.updateNextTick()
|
|
286834
|
+
if (opts.encoding) this.setEncoding(opts.encoding)
|
|
286835
|
+
}
|
|
286836
|
+
}
|
|
286837
|
+
|
|
286838
|
+
setEncoding (encoding) {
|
|
286839
|
+
const dec = new TextDecoder(encoding)
|
|
286840
|
+
const map = this._readableState.map || echo
|
|
286841
|
+
this._readableState.map = mapOrSkip
|
|
286842
|
+
return this
|
|
286843
|
+
|
|
286844
|
+
function mapOrSkip (data) {
|
|
286845
|
+
const next = dec.push(data)
|
|
286846
|
+
return next === '' ? null : map(next)
|
|
287270
286847
|
}
|
|
287271
286848
|
}
|
|
287272
286849
|
|
|
@@ -287296,13 +286873,13 @@ class Readable extends Stream {
|
|
|
287296
286873
|
}
|
|
287297
286874
|
|
|
287298
286875
|
resume () {
|
|
287299
|
-
this._duplexState |=
|
|
286876
|
+
this._duplexState |= READ_RESUMED_READ_AHEAD
|
|
287300
286877
|
this._readableState.updateNextTick()
|
|
287301
286878
|
return this
|
|
287302
286879
|
}
|
|
287303
286880
|
|
|
287304
286881
|
pause () {
|
|
287305
|
-
this._duplexState &= READ_PAUSED
|
|
286882
|
+
this._duplexState &= (this._readableState.readAhead === false ? READ_PAUSED_NO_READ_AHEAD : READ_PAUSED)
|
|
287306
286883
|
return this
|
|
287307
286884
|
}
|
|
287308
286885
|
|
|
@@ -287430,6 +287007,15 @@ class Writable extends Stream {
|
|
|
287430
287007
|
}
|
|
287431
287008
|
}
|
|
287432
287009
|
|
|
287010
|
+
cork () {
|
|
287011
|
+
this._duplexState |= WRITE_CORKED
|
|
287012
|
+
}
|
|
287013
|
+
|
|
287014
|
+
uncork () {
|
|
287015
|
+
this._duplexState &= WRITE_NOT_CORKED
|
|
287016
|
+
this._writableState.updateNextTick()
|
|
287017
|
+
}
|
|
287018
|
+
|
|
287433
287019
|
_writev (batch, cb) {
|
|
287434
287020
|
cb(null)
|
|
287435
287021
|
}
|
|
@@ -287474,7 +287060,7 @@ class Duplex extends Readable { // and Writable
|
|
|
287474
287060
|
constructor (opts) {
|
|
287475
287061
|
super(opts)
|
|
287476
287062
|
|
|
287477
|
-
this._duplexState = OPENING
|
|
287063
|
+
this._duplexState = OPENING | (this._duplexState & READ_READ_AHEAD)
|
|
287478
287064
|
this._writableState = new WritableState(this, opts)
|
|
287479
287065
|
|
|
287480
287066
|
if (opts) {
|
|
@@ -287484,6 +287070,15 @@ class Duplex extends Readable { // and Writable
|
|
|
287484
287070
|
}
|
|
287485
287071
|
}
|
|
287486
287072
|
|
|
287073
|
+
cork () {
|
|
287074
|
+
this._duplexState |= WRITE_CORKED
|
|
287075
|
+
}
|
|
287076
|
+
|
|
287077
|
+
uncork () {
|
|
287078
|
+
this._duplexState &= WRITE_NOT_CORKED
|
|
287079
|
+
this._writableState.updateNextTick()
|
|
287080
|
+
}
|
|
287081
|
+
|
|
287487
287082
|
_writev (batch, cb) {
|
|
287488
287083
|
cb(null)
|
|
287489
287084
|
}
|
|
@@ -287643,6 +287238,10 @@ function pipeline (stream, ...streams) {
|
|
|
287643
287238
|
}
|
|
287644
287239
|
}
|
|
287645
287240
|
|
|
287241
|
+
function echo (s) {
|
|
287242
|
+
return s
|
|
287243
|
+
}
|
|
287244
|
+
|
|
287646
287245
|
function isStream (stream) {
|
|
287647
287246
|
return !!stream._readableState || !!stream._writableState
|
|
287648
287247
|
}
|
|
@@ -288531,6 +288130,198 @@ Pack.prototype._read = function (n) {
|
|
|
288531
288130
|
module.exports = Pack
|
|
288532
288131
|
|
|
288533
288132
|
|
|
288133
|
+
/***/ }),
|
|
288134
|
+
|
|
288135
|
+
/***/ 27540:
|
|
288136
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
288137
|
+
|
|
288138
|
+
const PassThroughDecoder = __webpack_require__(30558)
|
|
288139
|
+
const UTF8Decoder = __webpack_require__(86888)
|
|
288140
|
+
|
|
288141
|
+
module.exports = class TextDecoder {
|
|
288142
|
+
constructor (encoding = 'utf8') {
|
|
288143
|
+
this.encoding = normalizeEncoding(encoding)
|
|
288144
|
+
|
|
288145
|
+
switch (this.encoding) {
|
|
288146
|
+
case 'utf8':
|
|
288147
|
+
this.decoder = new UTF8Decoder()
|
|
288148
|
+
break
|
|
288149
|
+
case 'utf16le':
|
|
288150
|
+
case 'base64':
|
|
288151
|
+
throw new Error('Unsupported encoding: ' + this.encoding)
|
|
288152
|
+
default:
|
|
288153
|
+
this.decoder = new PassThroughDecoder(this.encoding)
|
|
288154
|
+
}
|
|
288155
|
+
}
|
|
288156
|
+
|
|
288157
|
+
push (data) {
|
|
288158
|
+
if (typeof data === 'string') return data
|
|
288159
|
+
return this.decoder.decode(data)
|
|
288160
|
+
}
|
|
288161
|
+
|
|
288162
|
+
// For Node.js compatibility
|
|
288163
|
+
write (data) {
|
|
288164
|
+
return this.push(data)
|
|
288165
|
+
}
|
|
288166
|
+
|
|
288167
|
+
end (data) {
|
|
288168
|
+
let result = ''
|
|
288169
|
+
if (data) result = this.push(data)
|
|
288170
|
+
result += this.decoder.flush()
|
|
288171
|
+
return result
|
|
288172
|
+
}
|
|
288173
|
+
}
|
|
288174
|
+
|
|
288175
|
+
function normalizeEncoding (encoding) {
|
|
288176
|
+
encoding = encoding.toLowerCase()
|
|
288177
|
+
|
|
288178
|
+
switch (encoding) {
|
|
288179
|
+
case 'utf8':
|
|
288180
|
+
case 'utf-8':
|
|
288181
|
+
return 'utf8'
|
|
288182
|
+
case 'ucs2':
|
|
288183
|
+
case 'ucs-2':
|
|
288184
|
+
case 'utf16le':
|
|
288185
|
+
case 'utf-16le':
|
|
288186
|
+
return 'utf16le'
|
|
288187
|
+
case 'latin1':
|
|
288188
|
+
case 'binary':
|
|
288189
|
+
return 'latin1'
|
|
288190
|
+
case 'base64':
|
|
288191
|
+
case 'ascii':
|
|
288192
|
+
case 'hex':
|
|
288193
|
+
return encoding
|
|
288194
|
+
default:
|
|
288195
|
+
throw new Error('Unknown encoding: ' + encoding)
|
|
288196
|
+
}
|
|
288197
|
+
};
|
|
288198
|
+
|
|
288199
|
+
|
|
288200
|
+
/***/ }),
|
|
288201
|
+
|
|
288202
|
+
/***/ 30558:
|
|
288203
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
288204
|
+
|
|
288205
|
+
const b4a = __webpack_require__(85792)
|
|
288206
|
+
|
|
288207
|
+
module.exports = class PassThroughDecoder {
|
|
288208
|
+
constructor (encoding) {
|
|
288209
|
+
this.encoding = encoding
|
|
288210
|
+
}
|
|
288211
|
+
|
|
288212
|
+
decode (tail) {
|
|
288213
|
+
return b4a.toString(tail, this.encoding)
|
|
288214
|
+
}
|
|
288215
|
+
|
|
288216
|
+
flush () {
|
|
288217
|
+
return ''
|
|
288218
|
+
}
|
|
288219
|
+
}
|
|
288220
|
+
|
|
288221
|
+
|
|
288222
|
+
/***/ }),
|
|
288223
|
+
|
|
288224
|
+
/***/ 86888:
|
|
288225
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
288226
|
+
|
|
288227
|
+
const b4a = __webpack_require__(85792)
|
|
288228
|
+
|
|
288229
|
+
/**
|
|
288230
|
+
* https://encoding.spec.whatwg.org/#utf-8-decoder
|
|
288231
|
+
*/
|
|
288232
|
+
module.exports = class UTF8Decoder {
|
|
288233
|
+
constructor () {
|
|
288234
|
+
this.codePoint = 0
|
|
288235
|
+
this.bytesSeen = 0
|
|
288236
|
+
this.bytesNeeded = 0
|
|
288237
|
+
this.lowerBoundary = 0x80
|
|
288238
|
+
this.upperBoundary = 0xbf
|
|
288239
|
+
}
|
|
288240
|
+
|
|
288241
|
+
decode (data) {
|
|
288242
|
+
// If we have a fast path, just sniff if the last part is a boundary
|
|
288243
|
+
if (this.bytesNeeded === 0) {
|
|
288244
|
+
let isBoundary = true
|
|
288245
|
+
|
|
288246
|
+
for (let i = Math.max(0, data.byteLength - 4), n = data.byteLength; i < n && isBoundary; i++) {
|
|
288247
|
+
isBoundary = data[i] <= 0x7f
|
|
288248
|
+
}
|
|
288249
|
+
|
|
288250
|
+
if (isBoundary) return b4a.toString(data, 'utf8')
|
|
288251
|
+
}
|
|
288252
|
+
|
|
288253
|
+
let result = ''
|
|
288254
|
+
|
|
288255
|
+
for (let i = 0, n = data.byteLength; i < n; i++) {
|
|
288256
|
+
const byte = data[i]
|
|
288257
|
+
|
|
288258
|
+
if (this.bytesNeeded === 0) {
|
|
288259
|
+
if (byte <= 0x7f) {
|
|
288260
|
+
result += String.fromCharCode(byte)
|
|
288261
|
+
} else if (byte >= 0xc2 && byte <= 0xdf) {
|
|
288262
|
+
this.bytesNeeded = 1
|
|
288263
|
+
this.codePoint = byte & 0x1f
|
|
288264
|
+
} else if (byte >= 0xe0 && byte <= 0xef) {
|
|
288265
|
+
if (byte === 0xe0) this.lowerBoundary = 0xa0
|
|
288266
|
+
else if (byte === 0xed) this.upperBoundary = 0x9f
|
|
288267
|
+
this.bytesNeeded = 2
|
|
288268
|
+
this.codePoint = byte & 0xf
|
|
288269
|
+
} else if (byte >= 0xf0 && byte <= 0xf4) {
|
|
288270
|
+
if (byte === 0xf0) this.lowerBoundary = 0x90
|
|
288271
|
+
if (byte === 0xf4) this.upperBoundary = 0x8f
|
|
288272
|
+
this.bytesNeeded = 3
|
|
288273
|
+
this.codePoint = byte & 0x7
|
|
288274
|
+
} else {
|
|
288275
|
+
result += '\ufffd'
|
|
288276
|
+
}
|
|
288277
|
+
|
|
288278
|
+
continue
|
|
288279
|
+
}
|
|
288280
|
+
|
|
288281
|
+
if (byte < this.lowerBoundary || byte > this.upperBoundary) {
|
|
288282
|
+
this.codePoint = 0
|
|
288283
|
+
this.bytesNeeded = 0
|
|
288284
|
+
this.bytesSeen = 0
|
|
288285
|
+
this.lowerBoundary = 0x80
|
|
288286
|
+
this.upperBoundary = 0xbf
|
|
288287
|
+
|
|
288288
|
+
result += '\ufffd'
|
|
288289
|
+
|
|
288290
|
+
continue
|
|
288291
|
+
}
|
|
288292
|
+
|
|
288293
|
+
this.lowerBoundary = 0x80
|
|
288294
|
+
this.upperBoundary = 0xbf
|
|
288295
|
+
|
|
288296
|
+
this.codePoint = (this.codePoint << 6) | (byte & 0x3f)
|
|
288297
|
+
this.bytesSeen++
|
|
288298
|
+
|
|
288299
|
+
if (this.bytesSeen !== this.bytesNeeded) continue
|
|
288300
|
+
|
|
288301
|
+
result += String.fromCodePoint(this.codePoint)
|
|
288302
|
+
|
|
288303
|
+
this.codePoint = 0
|
|
288304
|
+
this.bytesNeeded = 0
|
|
288305
|
+
this.bytesSeen = 0
|
|
288306
|
+
}
|
|
288307
|
+
|
|
288308
|
+
return result
|
|
288309
|
+
}
|
|
288310
|
+
|
|
288311
|
+
flush () {
|
|
288312
|
+
const result = this.bytesNeeded > 0 ? '\ufffd' : ''
|
|
288313
|
+
|
|
288314
|
+
this.codePoint = 0
|
|
288315
|
+
this.bytesNeeded = 0
|
|
288316
|
+
this.bytesSeen = 0
|
|
288317
|
+
this.lowerBoundary = 0x80
|
|
288318
|
+
this.upperBoundary = 0xbf
|
|
288319
|
+
|
|
288320
|
+
return result
|
|
288321
|
+
}
|
|
288322
|
+
}
|
|
288323
|
+
|
|
288324
|
+
|
|
288534
288325
|
/***/ }),
|
|
288535
288326
|
|
|
288536
288327
|
/***/ 75575:
|