snyk 1.1068.0 → 1.1069.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/263.index.js +391 -2443
- package/dist/cli/263.index.js.map +1 -1
- package/dist/cli/535.index.js +2 -2
- package/dist/cli/535.index.js.map +1 -1
- package/dist/cli/index.js +8 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +4 -4
- package/package.json +1 -1
package/dist/cli/263.index.js
CHANGED
|
@@ -164509,34 +164509,27 @@ const path = __webpack_require__(85622);
|
|
|
164509
164509
|
const crypto = __webpack_require__(76417);
|
|
164510
164510
|
const fs = __webpack_require__(35747);
|
|
164511
164511
|
const glob = __webpack_require__(12884);
|
|
164512
|
-
const needle = __webpack_require__(49482);
|
|
164513
164512
|
const debugLib = __webpack_require__(15158);
|
|
164513
|
+
const search_1 = __webpack_require__(18906);
|
|
164514
164514
|
const debug = debugLib('snyk-mvn-plugin');
|
|
164515
|
-
// Using the maven-central sha1 checksum API call (see: https://search.maven.org/classic/#api)
|
|
164516
|
-
const MAVEN_SEARCH_URL = process.env.MAVEN_SEARCH_URL || 'https://search.maven.org/solrsearch/select';
|
|
164517
164515
|
const ALGORITHM = 'sha1';
|
|
164518
164516
|
const DIGEST = 'hex';
|
|
164519
164517
|
function getSha1(buf) {
|
|
164520
164518
|
return crypto.createHash(ALGORITHM).update(buf).digest(DIGEST);
|
|
164521
164519
|
}
|
|
164522
|
-
function getMavenDependency(targetPath) {
|
|
164520
|
+
function getMavenDependency(targetPath, snykHttpClient) {
|
|
164523
164521
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
164524
164522
|
const contents = fs.readFileSync(targetPath);
|
|
164525
164523
|
const sha1 = getSha1(contents);
|
|
164526
|
-
|
|
164527
|
-
return {
|
|
164528
|
-
groupId: g,
|
|
164529
|
-
artifactId: a,
|
|
164530
|
-
version: v,
|
|
164531
|
-
};
|
|
164524
|
+
return (0, search_1.getMavenPackageInfo)(sha1, targetPath, snykHttpClient);
|
|
164532
164525
|
});
|
|
164533
164526
|
}
|
|
164534
|
-
function getDependencies(paths) {
|
|
164527
|
+
function getDependencies(paths, snykHttpClient) {
|
|
164535
164528
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
164536
164529
|
const dependencies = [];
|
|
164537
164530
|
for (const p of paths) {
|
|
164538
164531
|
try {
|
|
164539
|
-
const dependency = yield getMavenDependency(p);
|
|
164532
|
+
const dependency = yield getMavenDependency(p, snykHttpClient);
|
|
164540
164533
|
dependencies.push(dependency);
|
|
164541
164534
|
}
|
|
164542
164535
|
catch (err) {
|
|
@@ -164549,10 +164542,10 @@ function getDependencies(paths) {
|
|
|
164549
164542
|
return dependencies;
|
|
164550
164543
|
});
|
|
164551
164544
|
}
|
|
164552
|
-
function createDepGraphFromArchive(root, targetPath) {
|
|
164545
|
+
function createDepGraphFromArchive(root, targetPath, snykHttpClient) {
|
|
164553
164546
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
164554
164547
|
try {
|
|
164555
|
-
return yield createDepGraphFromArchives(root, [targetPath]);
|
|
164548
|
+
return yield createDepGraphFromArchives(root, [targetPath], snykHttpClient);
|
|
164556
164549
|
}
|
|
164557
164550
|
catch (err) {
|
|
164558
164551
|
const msg = `There was a problem generating a dep-graph for '${targetPath}'.`;
|
|
@@ -164565,12 +164558,15 @@ function createDepGraphFromArchive(root, targetPath) {
|
|
|
164565
164558
|
});
|
|
164566
164559
|
}
|
|
164567
164560
|
exports.createDepGraphFromArchive = createDepGraphFromArchive;
|
|
164568
|
-
function createDepGraphFromArchives(root, archivePaths) {
|
|
164561
|
+
function createDepGraphFromArchives(root, archivePaths, snykHttpClient) {
|
|
164569
164562
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
164563
|
+
if (!snykHttpClient) {
|
|
164564
|
+
throw new Error('No HTTP client provided!');
|
|
164565
|
+
}
|
|
164570
164566
|
try {
|
|
164571
|
-
const dependencies = yield getDependencies(archivePaths);
|
|
164567
|
+
const dependencies = yield getDependencies(archivePaths, snykHttpClient);
|
|
164572
164568
|
if (!dependencies.length) {
|
|
164573
|
-
throw new Error(`No Maven artifacts found
|
|
164569
|
+
throw new Error(`No Maven artifacts found!`);
|
|
164574
164570
|
}
|
|
164575
164571
|
debug(`Creating dep-graph from ${JSON.stringify(dependencies)}`);
|
|
164576
164572
|
const rootDependency = getRootDependency(root);
|
|
@@ -164612,35 +164608,6 @@ function findArchives(targetPath, recursive = false) {
|
|
|
164612
164608
|
return glob.sync(`${dir}/${recursive ? '**/' : ''}*.@(jar|war|aar|zip)`);
|
|
164613
164609
|
}
|
|
164614
164610
|
exports.findArchives = findArchives;
|
|
164615
|
-
function getMavenPackageInfo(sha1, targetPath) {
|
|
164616
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
164617
|
-
const url = `${MAVEN_SEARCH_URL}?q=1:"${sha1}"&wt=json`;
|
|
164618
|
-
return new Promise((resolve, reject) => {
|
|
164619
|
-
needle.request('get', url, {}, { json: true }, (err, fullRes, res) => {
|
|
164620
|
-
if (err) {
|
|
164621
|
-
reject(err);
|
|
164622
|
-
}
|
|
164623
|
-
if (!res || !res.response) {
|
|
164624
|
-
reject(new Error(`Unexpected result querying '${MAVEN_SEARCH_URL}' for sha1 hash '${sha1}'.`));
|
|
164625
|
-
}
|
|
164626
|
-
if (res.response.docs.length === 0) {
|
|
164627
|
-
resolve({
|
|
164628
|
-
g: 'unknown',
|
|
164629
|
-
a: `${targetPath}:${sha1}`,
|
|
164630
|
-
v: 'unknown',
|
|
164631
|
-
});
|
|
164632
|
-
}
|
|
164633
|
-
if (res.response.docs.length > 1) {
|
|
164634
|
-
const sha1Target = path.parse(targetPath).base;
|
|
164635
|
-
debug('Got multiple results for sha1, looking for', sha1Target);
|
|
164636
|
-
const foundPackage = res.response.docs.find(({ g }) => sha1Target.includes(g));
|
|
164637
|
-
res.response.docs = [foundPackage || res.response.docs[0]];
|
|
164638
|
-
}
|
|
164639
|
-
resolve(res.response.docs[0]);
|
|
164640
|
-
});
|
|
164641
|
-
});
|
|
164642
|
-
});
|
|
164643
|
-
}
|
|
164644
164611
|
function getRootDependency(root, targetFile) {
|
|
164645
164612
|
let groupId;
|
|
164646
164613
|
if (targetFile) {
|
|
@@ -164778,7 +164745,7 @@ function findWrapper(mavenCommand, root, targetPath) {
|
|
|
164778
164745
|
} while (!foundMVWLocation);
|
|
164779
164746
|
return currentFolder;
|
|
164780
164747
|
}
|
|
164781
|
-
function inspect(root, targetFile, options) {
|
|
164748
|
+
function inspect(root, targetFile, options, snykHttpClient) {
|
|
164782
164749
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
164783
164750
|
const targetPath = targetFile
|
|
164784
164751
|
? path.resolve(root, targetFile)
|
|
@@ -164791,7 +164758,7 @@ function inspect(root, targetFile, options) {
|
|
|
164791
164758
|
}
|
|
164792
164759
|
if (targetPath && (0, archive_1.isArchive)(targetPath)) {
|
|
164793
164760
|
debug(`Creating dep-graph from ${targetPath}`);
|
|
164794
|
-
const depGraph = yield (0, archive_1.createDepGraphFromArchive)(root, targetPath);
|
|
164761
|
+
const depGraph = yield (0, archive_1.createDepGraphFromArchive)(root, targetPath, snykHttpClient);
|
|
164795
164762
|
return {
|
|
164796
164763
|
plugin: {
|
|
164797
164764
|
name: 'bundled:maven',
|
|
@@ -164807,7 +164774,7 @@ function inspect(root, targetFile, options) {
|
|
|
164807
164774
|
const archives = (0, archive_1.findArchives)(root, recursive);
|
|
164808
164775
|
if (archives.length > 0) {
|
|
164809
164776
|
debug(`Creating dep-graph from archives in ${root}`);
|
|
164810
|
-
const depGraph = yield (0, archive_1.createDepGraphFromArchives)(root, archives);
|
|
164777
|
+
const depGraph = yield (0, archive_1.createDepGraphFromArchives)(root, archives, snykHttpClient);
|
|
164811
164778
|
return {
|
|
164812
164779
|
plugin: {
|
|
164813
164780
|
name: 'bundled:maven',
|
|
@@ -165006,2435 +164973,424 @@ function createPackage(pkg) {
|
|
|
165006
164973
|
return result;
|
|
165007
164974
|
}
|
|
165008
164975
|
function dequote(str) {
|
|
165009
|
-
return str.slice(str.indexOf('"') + 1, str.lastIndexOf('"'));
|
|
165010
|
-
}
|
|
165011
|
-
function getConstraint(str) {
|
|
165012
|
-
const index = str.indexOf('selected from constraint');
|
|
165013
|
-
if (index === -1) {
|
|
165014
|
-
return null;
|
|
165015
|
-
}
|
|
165016
|
-
return str.slice(index + 25, str.lastIndexOf(')'));
|
|
165017
|
-
}
|
|
165018
|
-
//# sourceMappingURL=parse-mvn.js.map
|
|
165019
|
-
|
|
165020
|
-
/***/ }),
|
|
165021
|
-
|
|
165022
|
-
/***/ 8074:
|
|
165023
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
165024
|
-
|
|
165025
|
-
"use strict";
|
|
165026
|
-
|
|
165027
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165028
|
-
exports.buildDepGraph = void 0;
|
|
165029
|
-
const dep_graph_1 = __webpack_require__(71479);
|
|
165030
|
-
const dependency_1 = __webpack_require__(20448);
|
|
165031
|
-
function buildDepGraph(mavenGraph) {
|
|
165032
|
-
const { rootId, nodes } = mavenGraph;
|
|
165033
|
-
const root = getPkgInfo(rootId);
|
|
165034
|
-
const builder = new dep_graph_1.DepGraphBuilder({ name: 'maven' }, root);
|
|
165035
|
-
const visited = [];
|
|
165036
|
-
const queue = [];
|
|
165037
|
-
queue.push(...getItems(rootId, nodes[rootId]));
|
|
165038
|
-
// breadth first search
|
|
165039
|
-
while (queue.length > 0) {
|
|
165040
|
-
const item = queue.shift();
|
|
165041
|
-
if (!item)
|
|
165042
|
-
continue;
|
|
165043
|
-
const { id, parentId } = item;
|
|
165044
|
-
const pkgInfo = getPkgInfo(id);
|
|
165045
|
-
if (visited.includes(id)) {
|
|
165046
|
-
const prunedId = id + ':pruned';
|
|
165047
|
-
builder.addPkgNode(pkgInfo, prunedId, { labels: { pruned: 'true' } });
|
|
165048
|
-
builder.connectDep(parentId, prunedId);
|
|
165049
|
-
continue; // don't queue any more children
|
|
165050
|
-
}
|
|
165051
|
-
const parentNodeId = parentId === rootId ? builder.rootNodeId : parentId;
|
|
165052
|
-
builder.addPkgNode(pkgInfo, id);
|
|
165053
|
-
builder.connectDep(parentNodeId, id);
|
|
165054
|
-
queue.push(...getItems(id, nodes[id]));
|
|
165055
|
-
visited.push(id);
|
|
165056
|
-
}
|
|
165057
|
-
return builder.build();
|
|
165058
|
-
}
|
|
165059
|
-
exports.buildDepGraph = buildDepGraph;
|
|
165060
|
-
function getItems(parentId, node) {
|
|
165061
|
-
const items = [];
|
|
165062
|
-
for (const id of (node === null || node === void 0 ? void 0 : node.dependsOn) || []) {
|
|
165063
|
-
items.push({ id, parentId });
|
|
165064
|
-
}
|
|
165065
|
-
return items;
|
|
165066
|
-
}
|
|
165067
|
-
function getPkgInfo(value) {
|
|
165068
|
-
const { groupId, artifactId, version } = (0, dependency_1.parseDependency)(value);
|
|
165069
|
-
return {
|
|
165070
|
-
name: `${groupId}:${artifactId}`,
|
|
165071
|
-
version,
|
|
165072
|
-
};
|
|
165073
|
-
}
|
|
165074
|
-
//# sourceMappingURL=dep-graph.js.map
|
|
165075
|
-
|
|
165076
|
-
/***/ }),
|
|
165077
|
-
|
|
165078
|
-
/***/ 20448:
|
|
165079
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
165080
|
-
|
|
165081
|
-
"use strict";
|
|
165082
|
-
|
|
165083
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165084
|
-
exports.parseDependency = void 0;
|
|
165085
|
-
const UNKNOWN = 'unknown';
|
|
165086
|
-
const unknownDependency = {
|
|
165087
|
-
groupId: UNKNOWN,
|
|
165088
|
-
artifactId: UNKNOWN,
|
|
165089
|
-
type: UNKNOWN,
|
|
165090
|
-
version: UNKNOWN,
|
|
165091
|
-
};
|
|
165092
|
-
function parseDependency(value) {
|
|
165093
|
-
if (typeof value !== 'string')
|
|
165094
|
-
return unknownDependency;
|
|
165095
|
-
const parts = value.split(':');
|
|
165096
|
-
switch (parts.length) {
|
|
165097
|
-
// using classifier and scope
|
|
165098
|
-
// "com.example:my-app:jar:jdk8:1.2.3:compile"
|
|
165099
|
-
case 6: {
|
|
165100
|
-
return {
|
|
165101
|
-
groupId: getPart(parts, 0),
|
|
165102
|
-
artifactId: getPart(parts, 1),
|
|
165103
|
-
type: getPart(parts, 2),
|
|
165104
|
-
classifier: getPart(parts, 3),
|
|
165105
|
-
version: getPart(parts, 4),
|
|
165106
|
-
scope: getPart(parts, 5),
|
|
165107
|
-
};
|
|
165108
|
-
}
|
|
165109
|
-
// using scope
|
|
165110
|
-
// "com.example:my-app:jar:1.2.3:compile"
|
|
165111
|
-
case 5: {
|
|
165112
|
-
return {
|
|
165113
|
-
groupId: getPart(parts, 0),
|
|
165114
|
-
artifactId: getPart(parts, 1),
|
|
165115
|
-
type: getPart(parts, 2),
|
|
165116
|
-
version: getPart(parts, 3),
|
|
165117
|
-
scope: getPart(parts, 4),
|
|
165118
|
-
};
|
|
165119
|
-
}
|
|
165120
|
-
// everything else
|
|
165121
|
-
// "com.example:my-app:jar:1.2.3"
|
|
165122
|
-
case 4: {
|
|
165123
|
-
return {
|
|
165124
|
-
groupId: getPart(parts, 0),
|
|
165125
|
-
artifactId: getPart(parts, 1),
|
|
165126
|
-
type: getPart(parts, 2),
|
|
165127
|
-
version: getPart(parts, 3),
|
|
165128
|
-
};
|
|
165129
|
-
}
|
|
165130
|
-
default: {
|
|
165131
|
-
return unknownDependency;
|
|
165132
|
-
}
|
|
165133
|
-
}
|
|
165134
|
-
}
|
|
165135
|
-
exports.parseDependency = parseDependency;
|
|
165136
|
-
function getPart(parts, index) {
|
|
165137
|
-
return parts[index] || UNKNOWN;
|
|
165138
|
-
}
|
|
165139
|
-
//# sourceMappingURL=dependency.js.map
|
|
165140
|
-
|
|
165141
|
-
/***/ }),
|
|
165142
|
-
|
|
165143
|
-
/***/ 2175:
|
|
165144
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
165145
|
-
|
|
165146
|
-
"use strict";
|
|
165147
|
-
|
|
165148
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165149
|
-
exports.parseDigraphs = void 0;
|
|
165150
|
-
const maven_graph_builder_1 = __webpack_require__(68465);
|
|
165151
|
-
const newLine = /[\r\n]+/g;
|
|
165152
|
-
function parseDigraphs(digraphs) {
|
|
165153
|
-
const graphs = [];
|
|
165154
|
-
for (const digraph of digraphs) {
|
|
165155
|
-
const lines = digraph.split(newLine);
|
|
165156
|
-
const rootId = findQuotedContents(lines[0]);
|
|
165157
|
-
if (!rootId) {
|
|
165158
|
-
throw new Error(`Unexpected digraph could not find root node. Could not parse "${lines[0]}".`);
|
|
165159
|
-
}
|
|
165160
|
-
const builder = new maven_graph_builder_1.MavenGraphBuilder(rootId);
|
|
165161
|
-
for (let i = 1; i < lines.length - 1; i++) {
|
|
165162
|
-
const line = parseLine(lines[i]);
|
|
165163
|
-
if (!line) {
|
|
165164
|
-
throw new Error(`Unexpected digraph could not connect nodes. Could not parse "${lines[i]}".`);
|
|
165165
|
-
}
|
|
165166
|
-
builder.connect(line.from, line.to);
|
|
165167
|
-
}
|
|
165168
|
-
graphs.push(builder.graph);
|
|
165169
|
-
}
|
|
165170
|
-
return graphs;
|
|
165171
|
-
}
|
|
165172
|
-
exports.parseDigraphs = parseDigraphs;
|
|
165173
|
-
function parseLine(line) {
|
|
165174
|
-
if (!line)
|
|
165175
|
-
return null;
|
|
165176
|
-
const [left, right] = line.split('->');
|
|
165177
|
-
if (!left || !right)
|
|
165178
|
-
return null;
|
|
165179
|
-
const from = findQuotedContents(left);
|
|
165180
|
-
const to = findQuotedContents(right);
|
|
165181
|
-
if (!from || !to)
|
|
165182
|
-
return null;
|
|
165183
|
-
return { from, to };
|
|
165184
|
-
}
|
|
165185
|
-
function findQuotedContents(value) {
|
|
165186
|
-
if (!value)
|
|
165187
|
-
return null;
|
|
165188
|
-
const start = value.indexOf('"') + 1;
|
|
165189
|
-
const end = value.lastIndexOf('"');
|
|
165190
|
-
return value.substring(start, end);
|
|
165191
|
-
}
|
|
165192
|
-
//# sourceMappingURL=digraph.js.map
|
|
165193
|
-
|
|
165194
|
-
/***/ }),
|
|
165195
|
-
|
|
165196
|
-
/***/ 22891:
|
|
165197
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
165198
|
-
|
|
165199
|
-
"use strict";
|
|
165200
|
-
|
|
165201
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165202
|
-
exports.parse = void 0;
|
|
165203
|
-
const stdout_1 = __webpack_require__(16866);
|
|
165204
|
-
const digraph_1 = __webpack_require__(2175);
|
|
165205
|
-
const dep_graph_1 = __webpack_require__(8074);
|
|
165206
|
-
function parse(stdout) {
|
|
165207
|
-
const digraphs = (0, stdout_1.parseStdout)(stdout);
|
|
165208
|
-
const mavenGraphs = (0, digraph_1.parseDigraphs)(digraphs);
|
|
165209
|
-
const scannedProjects = [];
|
|
165210
|
-
for (const mavenGraph of mavenGraphs) {
|
|
165211
|
-
const depGraph = (0, dep_graph_1.buildDepGraph)(mavenGraph);
|
|
165212
|
-
scannedProjects.push({ depGraph });
|
|
165213
|
-
}
|
|
165214
|
-
return {
|
|
165215
|
-
scannedProjects,
|
|
165216
|
-
};
|
|
165217
|
-
}
|
|
165218
|
-
exports.parse = parse;
|
|
165219
|
-
//# sourceMappingURL=index.js.map
|
|
165220
|
-
|
|
165221
|
-
/***/ }),
|
|
165222
|
-
|
|
165223
|
-
/***/ 68465:
|
|
165224
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
165225
|
-
|
|
165226
|
-
"use strict";
|
|
165227
|
-
|
|
165228
|
-
var _MavenGraphBuilder_graph;
|
|
165229
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165230
|
-
exports.MavenGraphBuilder = void 0;
|
|
165231
|
-
const tslib_1 = __webpack_require__(90999);
|
|
165232
|
-
class MavenGraphBuilder {
|
|
165233
|
-
constructor(rootId) {
|
|
165234
|
-
_MavenGraphBuilder_graph.set(this, void 0);
|
|
165235
|
-
tslib_1.__classPrivateFieldSet(this, _MavenGraphBuilder_graph, {
|
|
165236
|
-
rootId,
|
|
165237
|
-
nodes: {
|
|
165238
|
-
[rootId]: { dependsOn: [] },
|
|
165239
|
-
},
|
|
165240
|
-
}, "f");
|
|
165241
|
-
}
|
|
165242
|
-
add(id) {
|
|
165243
|
-
if (!this.node(id)) {
|
|
165244
|
-
tslib_1.__classPrivateFieldGet(this, _MavenGraphBuilder_graph, "f").nodes[id] = { dependsOn: [] };
|
|
165245
|
-
}
|
|
165246
|
-
}
|
|
165247
|
-
node(id) {
|
|
165248
|
-
return tslib_1.__classPrivateFieldGet(this, _MavenGraphBuilder_graph, "f").nodes[id];
|
|
165249
|
-
}
|
|
165250
|
-
connect(parentId, id) {
|
|
165251
|
-
this.add(parentId);
|
|
165252
|
-
this.add(id);
|
|
165253
|
-
const node = this.node(parentId);
|
|
165254
|
-
if (!node)
|
|
165255
|
-
return;
|
|
165256
|
-
if (!node.dependsOn.includes(id)) {
|
|
165257
|
-
node.dependsOn.push(id);
|
|
165258
|
-
}
|
|
165259
|
-
}
|
|
165260
|
-
get graph() {
|
|
165261
|
-
return tslib_1.__classPrivateFieldGet(this, _MavenGraphBuilder_graph, "f");
|
|
165262
|
-
}
|
|
165263
|
-
}
|
|
165264
|
-
exports.MavenGraphBuilder = MavenGraphBuilder;
|
|
165265
|
-
_MavenGraphBuilder_graph = new WeakMap();
|
|
165266
|
-
//# sourceMappingURL=maven-graph-builder.js.map
|
|
165267
|
-
|
|
165268
|
-
/***/ }),
|
|
165269
|
-
|
|
165270
|
-
/***/ 16866:
|
|
165271
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
165272
|
-
|
|
165273
|
-
"use strict";
|
|
165274
|
-
|
|
165275
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165276
|
-
exports.parseStdout = void 0;
|
|
165277
|
-
const logLabel = /^\[\w+\]\s*/gm;
|
|
165278
|
-
const digraph = /digraph([\s\S]*?)\}/g;
|
|
165279
|
-
const errorLabel = /^\[ERROR\]/gm;
|
|
165280
|
-
// Parse the output from 'mvn dependency:tree -DoutputType=dot'
|
|
165281
|
-
function parseStdout(stdout) {
|
|
165282
|
-
if (errorLabel.test(stdout)) {
|
|
165283
|
-
throw new Error('Maven output contains errors.');
|
|
165284
|
-
}
|
|
165285
|
-
const digraphs = stdout.replace(logLabel, '').match(digraph);
|
|
165286
|
-
if (!digraphs) {
|
|
165287
|
-
throw new Error('Cannot find any digraphs.');
|
|
165288
|
-
}
|
|
165289
|
-
return digraphs;
|
|
165290
|
-
}
|
|
165291
|
-
exports.parseStdout = parseStdout;
|
|
165292
|
-
//# sourceMappingURL=stdout.js.map
|
|
165293
|
-
|
|
165294
|
-
/***/ }),
|
|
165295
|
-
|
|
165296
|
-
/***/ 17872:
|
|
165297
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
165298
|
-
|
|
165299
|
-
"use strict";
|
|
165300
|
-
|
|
165301
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165302
|
-
exports.execute = void 0;
|
|
165303
|
-
const childProcess = __webpack_require__(63129);
|
|
165304
|
-
const index_1 = __webpack_require__(29615);
|
|
165305
|
-
const shescape_1 = __webpack_require__(79114);
|
|
165306
|
-
function execute(command, args, options) {
|
|
165307
|
-
const spawnOptions = { shell: true };
|
|
165308
|
-
if (options && options.cwd) {
|
|
165309
|
-
spawnOptions.cwd = options.cwd;
|
|
165310
|
-
}
|
|
165311
|
-
if (args) {
|
|
165312
|
-
args = (0, shescape_1.quoteAll)(args, spawnOptions);
|
|
165313
|
-
}
|
|
165314
|
-
return new Promise((resolve, reject) => {
|
|
165315
|
-
let stdout = '';
|
|
165316
|
-
let stderr = '';
|
|
165317
|
-
const proc = childProcess.spawn(command, args, spawnOptions);
|
|
165318
|
-
proc.stdout.on('data', (data) => {
|
|
165319
|
-
stdout = stdout + data;
|
|
165320
|
-
});
|
|
165321
|
-
proc.stderr.on('data', (data) => {
|
|
165322
|
-
stderr = stderr + data;
|
|
165323
|
-
});
|
|
165324
|
-
proc.on('error', (err) => {
|
|
165325
|
-
(0, index_1.debug)(`Child process errored with: ${err.message}`);
|
|
165326
|
-
});
|
|
165327
|
-
proc.on('exit', (code) => {
|
|
165328
|
-
(0, index_1.debug)(`Child process exited with code: ${code}`);
|
|
165329
|
-
});
|
|
165330
|
-
proc.on('close', (code) => {
|
|
165331
|
-
if (code !== 0) {
|
|
165332
|
-
(0, index_1.debug)(`Child process failed with exit code: ${code}`, '----------------', 'STDERR:', stderr, '----------------', 'STDOUT:', stdout, '----------------');
|
|
165333
|
-
const stdErrMessage = stderr ? `\nSTDERR:\n${stderr}` : '';
|
|
165334
|
-
const stdOutMessage = stdout ? `\nSTDOUT:\n${stdout}` : '';
|
|
165335
|
-
const debugSuggestion = process.env.DEBUG
|
|
165336
|
-
? ''
|
|
165337
|
-
: `\nRun in debug mode (-d) to see STDERR and STDOUT.`;
|
|
165338
|
-
return reject(new Error(`Child process failed with exit code: ${code}.` +
|
|
165339
|
-
debugSuggestion +
|
|
165340
|
-
(stdErrMessage || stdOutMessage)));
|
|
165341
|
-
}
|
|
165342
|
-
resolve(stdout || stderr);
|
|
165343
|
-
});
|
|
165344
|
-
});
|
|
165345
|
-
}
|
|
165346
|
-
exports.execute = execute;
|
|
165347
|
-
//# sourceMappingURL=sub-process.js.map
|
|
165348
|
-
|
|
165349
|
-
/***/ }),
|
|
165350
|
-
|
|
165351
|
-
/***/ 53394:
|
|
165352
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
165353
|
-
|
|
165354
|
-
var createHash = __webpack_require__(76417).createHash;
|
|
165355
|
-
|
|
165356
|
-
function get_header(header, credentials, opts) {
|
|
165357
|
-
var type = header.split(' ')[0],
|
|
165358
|
-
user = credentials[0],
|
|
165359
|
-
pass = credentials[1];
|
|
165360
|
-
|
|
165361
|
-
if (type == 'Digest') {
|
|
165362
|
-
return digest.generate(header, user, pass, opts.method, opts.path);
|
|
165363
|
-
} else if (type == 'Basic') {
|
|
165364
|
-
return basic(user, pass);
|
|
165365
|
-
}
|
|
165366
|
-
}
|
|
165367
|
-
|
|
165368
|
-
////////////////////
|
|
165369
|
-
// basic
|
|
165370
|
-
|
|
165371
|
-
function md5(string) {
|
|
165372
|
-
return createHash('md5').update(string).digest('hex');
|
|
165373
|
-
}
|
|
165374
|
-
|
|
165375
|
-
function basic(user, pass) {
|
|
165376
|
-
var str = typeof pass == 'undefined' ? user : [user, pass].join(':');
|
|
165377
|
-
return 'Basic ' + Buffer.from(str).toString('base64');
|
|
165378
|
-
}
|
|
165379
|
-
|
|
165380
|
-
////////////////////
|
|
165381
|
-
// digest
|
|
165382
|
-
// logic inspired from https://github.com/simme/node-http-digest-client
|
|
165383
|
-
|
|
165384
|
-
var digest = {};
|
|
165385
|
-
|
|
165386
|
-
digest.parse_header = function(header) {
|
|
165387
|
-
var challenge = {},
|
|
165388
|
-
matches = header.match(/([a-z0-9_-]+)="?([a-z0-9_=\/\.@\s-\+)()]+)"?/gi);
|
|
165389
|
-
|
|
165390
|
-
for (var i = 0, l = matches.length; i < l; i++) {
|
|
165391
|
-
var parts = matches[i].split('='),
|
|
165392
|
-
key = parts.shift(),
|
|
165393
|
-
val = parts.join('=').replace(/^"/, '').replace(/"$/, '');
|
|
165394
|
-
|
|
165395
|
-
challenge[key] = val;
|
|
165396
|
-
}
|
|
165397
|
-
|
|
165398
|
-
return challenge;
|
|
165399
|
-
}
|
|
165400
|
-
|
|
165401
|
-
digest.update_nc = function(nc) {
|
|
165402
|
-
var max = 99999999;
|
|
165403
|
-
nc++;
|
|
165404
|
-
|
|
165405
|
-
if (nc > max)
|
|
165406
|
-
nc = 1;
|
|
165407
|
-
|
|
165408
|
-
var padding = new Array(8).join('0') + '';
|
|
165409
|
-
nc = nc + '';
|
|
165410
|
-
return padding.substr(0, 8 - nc.length) + nc;
|
|
165411
|
-
}
|
|
165412
|
-
|
|
165413
|
-
digest.generate = function(header, user, pass, method, path) {
|
|
165414
|
-
|
|
165415
|
-
var nc = 1,
|
|
165416
|
-
cnonce = null,
|
|
165417
|
-
challenge = digest.parse_header(header);
|
|
165418
|
-
|
|
165419
|
-
var ha1 = md5(user + ':' + challenge.realm + ':' + pass),
|
|
165420
|
-
ha2 = md5(method.toUpperCase() + ':' + path),
|
|
165421
|
-
resp = [ha1, challenge.nonce];
|
|
165422
|
-
|
|
165423
|
-
if (typeof challenge.qop === 'string') {
|
|
165424
|
-
cnonce = md5(Math.random().toString(36)).substr(0, 8);
|
|
165425
|
-
nc = digest.update_nc(nc);
|
|
165426
|
-
resp = resp.concat(nc, cnonce);
|
|
165427
|
-
resp = resp.concat(challenge.qop, ha2);
|
|
165428
|
-
} else {
|
|
165429
|
-
resp = resp.concat(ha2);
|
|
165430
|
-
}
|
|
165431
|
-
|
|
165432
|
-
|
|
165433
|
-
var params = {
|
|
165434
|
-
uri : path,
|
|
165435
|
-
realm : challenge.realm,
|
|
165436
|
-
nonce : challenge.nonce,
|
|
165437
|
-
username : user,
|
|
165438
|
-
response : md5(resp.join(':'))
|
|
165439
|
-
}
|
|
165440
|
-
|
|
165441
|
-
if (challenge.qop) {
|
|
165442
|
-
params.qop = challenge.qop;
|
|
165443
|
-
}
|
|
165444
|
-
|
|
165445
|
-
if (challenge.opaque) {
|
|
165446
|
-
params.opaque = challenge.opaque;
|
|
165447
|
-
}
|
|
165448
|
-
|
|
165449
|
-
if (cnonce) {
|
|
165450
|
-
params.nc = nc;
|
|
165451
|
-
params.cnonce = cnonce;
|
|
165452
|
-
}
|
|
165453
|
-
|
|
165454
|
-
header = []
|
|
165455
|
-
for (var k in params)
|
|
165456
|
-
header.push(k + '="' + params[k] + '"')
|
|
165457
|
-
|
|
165458
|
-
return 'Digest ' + header.join(', ');
|
|
165459
|
-
}
|
|
165460
|
-
|
|
165461
|
-
module.exports = {
|
|
165462
|
-
header : get_header,
|
|
165463
|
-
basic : basic,
|
|
165464
|
-
digest : digest.generate
|
|
165465
|
-
}
|
|
165466
|
-
|
|
165467
|
-
|
|
165468
|
-
/***/ }),
|
|
165469
|
-
|
|
165470
|
-
/***/ 77334:
|
|
165471
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
165472
|
-
|
|
165473
|
-
|
|
165474
|
-
// Simple cookie handling implementation based on the standard RFC 6265.
|
|
165475
|
-
//
|
|
165476
|
-
// This module just has two functionalities:
|
|
165477
|
-
// - Parse a set-cookie-header as a key value object
|
|
165478
|
-
// - Write a cookie-string from a key value object
|
|
165479
|
-
//
|
|
165480
|
-
// All cookie attributes are ignored.
|
|
165481
|
-
|
|
165482
|
-
var unescape = __webpack_require__(71191).unescape;
|
|
165483
|
-
|
|
165484
|
-
var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/;
|
|
165485
|
-
var EXCLUDED_CHARS = /[\x00-\x1F\x7F\x3B\x3B\s\"\,\\"%]/g;
|
|
165486
|
-
var TRAILING_SEMICOLON = /\x3B+$/;
|
|
165487
|
-
var SEP_SEMICOLON = /\s*\x3B\s*/;
|
|
165488
|
-
|
|
165489
|
-
// i know these should be 'const', but I'd like to keep
|
|
165490
|
-
// supporting earlier node.js versions as long as I can. :)
|
|
165491
|
-
|
|
165492
|
-
var KEY_INDEX = 1; // index of key from COOKIE_PAIR match
|
|
165493
|
-
var VALUE_INDEX = 3; // index of value from COOKIE_PAIR match
|
|
165494
|
-
|
|
165495
|
-
// Returns a copy str trimmed and without trainling semicolon.
|
|
165496
|
-
function cleanCookieString(str) {
|
|
165497
|
-
return str.trim().replace(/\x3B+$/, '');
|
|
165498
|
-
}
|
|
165499
|
-
|
|
165500
|
-
function getFirstPair(str) {
|
|
165501
|
-
var index = str.indexOf('\x3B');
|
|
165502
|
-
return index === -1 ? str : str.substr(0, index);
|
|
165503
|
-
}
|
|
165504
|
-
|
|
165505
|
-
// Returns a encoded copy of str based on RFC6265 S4.1.1.
|
|
165506
|
-
function encodeCookieComponent(str) {
|
|
165507
|
-
return str.toString().replace(EXCLUDED_CHARS, encodeURIComponent);
|
|
165508
|
-
}
|
|
165509
|
-
|
|
165510
|
-
// Parses a set-cookie-string based on the standard defined in RFC6265 S4.1.1.
|
|
165511
|
-
function parseSetCookieString(str) {
|
|
165512
|
-
str = cleanCookieString(str);
|
|
165513
|
-
str = getFirstPair(str);
|
|
165514
|
-
|
|
165515
|
-
var res = COOKIE_PAIR.exec(str);
|
|
165516
|
-
if (!res || !res[VALUE_INDEX]) return null;
|
|
165517
|
-
|
|
165518
|
-
return {
|
|
165519
|
-
name : unescape(res[KEY_INDEX]),
|
|
165520
|
-
value : unescape(res[VALUE_INDEX])
|
|
165521
|
-
};
|
|
165522
|
-
}
|
|
165523
|
-
|
|
165524
|
-
// Parses a set-cookie-header and returns a key/value object.
|
|
165525
|
-
// Each key represents the name of a cookie.
|
|
165526
|
-
function parseSetCookieHeader(header) {
|
|
165527
|
-
if (!header) return {};
|
|
165528
|
-
header = Array.isArray(header) ? header : [header];
|
|
165529
|
-
|
|
165530
|
-
return header.reduce(function(res, str) {
|
|
165531
|
-
var cookie = parseSetCookieString(str);
|
|
165532
|
-
if (cookie) res[cookie.name] = cookie.value;
|
|
165533
|
-
return res;
|
|
165534
|
-
}, {});
|
|
165535
|
-
}
|
|
165536
|
-
|
|
165537
|
-
// Writes a set-cookie-string based on the standard definded in RFC6265 S4.1.1.
|
|
165538
|
-
function writeCookieString(obj) {
|
|
165539
|
-
return Object.keys(obj).reduce(function(str, name) {
|
|
165540
|
-
var encodedName = encodeCookieComponent(name);
|
|
165541
|
-
var encodedValue = encodeCookieComponent(obj[name]);
|
|
165542
|
-
str += (str ? '; ' : '') + encodedName + '=' + encodedValue;
|
|
165543
|
-
return str;
|
|
165544
|
-
}, '');
|
|
165545
|
-
}
|
|
165546
|
-
|
|
165547
|
-
// returns a key/val object from an array of cookie strings
|
|
165548
|
-
exports.read = parseSetCookieHeader;
|
|
165549
|
-
|
|
165550
|
-
// writes a cookie string header
|
|
165551
|
-
exports.write = writeCookieString;
|
|
165552
|
-
|
|
165553
|
-
|
|
165554
|
-
/***/ }),
|
|
165555
|
-
|
|
165556
|
-
/***/ 50957:
|
|
165557
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
165558
|
-
|
|
165559
|
-
var iconv,
|
|
165560
|
-
inherits = __webpack_require__(31669).inherits,
|
|
165561
|
-
stream = __webpack_require__(92413);
|
|
165562
|
-
|
|
165563
|
-
var regex = /(?:charset|encoding)\s*=\s*['"]? *([\w\-]+)/i;
|
|
165564
|
-
|
|
165565
|
-
inherits(StreamDecoder, stream.Transform);
|
|
165566
|
-
|
|
165567
|
-
function StreamDecoder(charset) {
|
|
165568
|
-
if (!(this instanceof StreamDecoder))
|
|
165569
|
-
return new StreamDecoder(charset);
|
|
165570
|
-
|
|
165571
|
-
stream.Transform.call(this, charset);
|
|
165572
|
-
this.charset = charset;
|
|
165573
|
-
this.parsed_chunk = false;
|
|
165574
|
-
}
|
|
165575
|
-
|
|
165576
|
-
StreamDecoder.prototype._transform = function(chunk, encoding, done) {
|
|
165577
|
-
var res, found;
|
|
165578
|
-
|
|
165579
|
-
// try get charset from chunk, just once
|
|
165580
|
-
if (this.charset == 'utf8' && !this.parsed_chunk) {
|
|
165581
|
-
this.parsed_chunk = true;
|
|
165582
|
-
|
|
165583
|
-
var matches = regex.exec(chunk.toString());
|
|
165584
|
-
if (matches) {
|
|
165585
|
-
found = matches[1].toLowerCase();
|
|
165586
|
-
this.charset = found == 'utf-8' ? 'utf8' : found;
|
|
165587
|
-
}
|
|
165588
|
-
}
|
|
165589
|
-
|
|
165590
|
-
try {
|
|
165591
|
-
res = iconv.decode(chunk, this.charset);
|
|
165592
|
-
} catch(e) { // something went wrong, just return original chunk
|
|
165593
|
-
res = chunk;
|
|
165594
|
-
}
|
|
165595
|
-
|
|
165596
|
-
this.push(res);
|
|
165597
|
-
done();
|
|
165598
|
-
}
|
|
165599
|
-
|
|
165600
|
-
module.exports = function(charset) {
|
|
165601
|
-
try {
|
|
165602
|
-
if (!iconv) iconv = __webpack_require__(4914);
|
|
165603
|
-
} catch(e) {
|
|
165604
|
-
/* iconv not found */
|
|
165605
|
-
}
|
|
165606
|
-
|
|
165607
|
-
if (iconv)
|
|
165608
|
-
return new StreamDecoder(charset);
|
|
165609
|
-
else
|
|
165610
|
-
return new stream.PassThrough;
|
|
165611
|
-
}
|
|
165612
|
-
|
|
165613
|
-
|
|
165614
|
-
/***/ }),
|
|
165615
|
-
|
|
165616
|
-
/***/ 30050:
|
|
165617
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
165618
|
-
|
|
165619
|
-
var readFile = __webpack_require__(35747).readFile,
|
|
165620
|
-
basename = __webpack_require__(85622).basename;
|
|
165621
|
-
|
|
165622
|
-
exports.build = function(data, boundary, callback) {
|
|
165623
|
-
|
|
165624
|
-
if (typeof data != 'object' || typeof data.pipe == 'function')
|
|
165625
|
-
return callback(new Error('Multipart builder expects data as key/val object.'));
|
|
165626
|
-
|
|
165627
|
-
var body = '',
|
|
165628
|
-
object = flatten(data),
|
|
165629
|
-
count = Object.keys(object).length;
|
|
165630
|
-
|
|
165631
|
-
if (count === 0)
|
|
165632
|
-
return callback(new Error('Empty multipart body. Invalid data.'))
|
|
165633
|
-
|
|
165634
|
-
function done(err, section) {
|
|
165635
|
-
if (err) return callback(err);
|
|
165636
|
-
if (section) body += section;
|
|
165637
|
-
--count || callback(null, body + '--' + boundary + '--');
|
|
165638
|
-
};
|
|
165639
|
-
|
|
165640
|
-
for (var key in object) {
|
|
165641
|
-
var value = object[key];
|
|
165642
|
-
if (value === null || typeof value == 'undefined') {
|
|
165643
|
-
done();
|
|
165644
|
-
} else if (Buffer.isBuffer(value)) {
|
|
165645
|
-
var part = { buffer: value, content_type: 'application/octet-stream' };
|
|
165646
|
-
generate_part(key, part, boundary, done);
|
|
165647
|
-
} else {
|
|
165648
|
-
var part = (value.buffer || value.file || value.content_type) ? value : { value: value };
|
|
165649
|
-
generate_part(key, part, boundary, done);
|
|
165650
|
-
}
|
|
165651
|
-
}
|
|
165652
|
-
|
|
165653
|
-
}
|
|
165654
|
-
|
|
165655
|
-
function generate_part(name, part, boundary, callback) {
|
|
165656
|
-
|
|
165657
|
-
var return_part = '--' + boundary + '\r\n';
|
|
165658
|
-
return_part += 'Content-Disposition: form-data; name="' + name + '"';
|
|
165659
|
-
|
|
165660
|
-
function append(data, filename) {
|
|
165661
|
-
|
|
165662
|
-
if (data) {
|
|
165663
|
-
var binary = part.content_type.indexOf('text') == -1;
|
|
165664
|
-
return_part += '; filename="' + encodeURIComponent(filename) + '"\r\n';
|
|
165665
|
-
if (binary) return_part += 'Content-Transfer-Encoding: binary\r\n';
|
|
165666
|
-
return_part += 'Content-Type: ' + part.content_type + '\r\n\r\n';
|
|
165667
|
-
return_part += binary ? data.toString('binary') : data.toString('utf8');
|
|
165668
|
-
}
|
|
165669
|
-
|
|
165670
|
-
callback(null, return_part + '\r\n');
|
|
165671
|
-
};
|
|
165672
|
-
|
|
165673
|
-
if ((part.file || part.buffer) && part.content_type) {
|
|
165674
|
-
|
|
165675
|
-
var filename = part.filename ? part.filename : part.file ? basename(part.file) : name;
|
|
165676
|
-
if (part.buffer) return append(part.buffer, filename);
|
|
165677
|
-
|
|
165678
|
-
readFile(part.file, function(err, data) {
|
|
165679
|
-
if (err) return callback(err);
|
|
165680
|
-
append(data, filename);
|
|
165681
|
-
});
|
|
165682
|
-
|
|
165683
|
-
} else {
|
|
165684
|
-
|
|
165685
|
-
if (typeof part.value == 'object')
|
|
165686
|
-
return callback(new Error('Object received for ' + name + ', expected string.'))
|
|
165687
|
-
|
|
165688
|
-
if (part.content_type) {
|
|
165689
|
-
return_part += '\r\n';
|
|
165690
|
-
return_part += 'Content-Type: ' + part.content_type;
|
|
165691
|
-
}
|
|
165692
|
-
|
|
165693
|
-
return_part += '\r\n\r\n';
|
|
165694
|
-
return_part += Buffer.from(String(part.value), 'utf8').toString('binary');
|
|
165695
|
-
append();
|
|
165696
|
-
|
|
165697
|
-
}
|
|
165698
|
-
|
|
165699
|
-
}
|
|
165700
|
-
|
|
165701
|
-
// flattens nested objects for multipart body
|
|
165702
|
-
function flatten(object, into, prefix) {
|
|
165703
|
-
into = into || {};
|
|
165704
|
-
|
|
165705
|
-
for(var key in object) {
|
|
165706
|
-
var prefix_key = prefix ? prefix + '[' + key + ']' : key;
|
|
165707
|
-
var prop = object[key];
|
|
165708
|
-
|
|
165709
|
-
if (prop && typeof prop === 'object' && !(prop.buffer || prop.file || prop.content_type))
|
|
165710
|
-
flatten(prop, into, prefix_key)
|
|
165711
|
-
else
|
|
165712
|
-
into[prefix_key] = prop;
|
|
165713
|
-
}
|
|
165714
|
-
|
|
165715
|
-
return into;
|
|
165716
|
-
}
|
|
165717
|
-
|
|
165718
|
-
|
|
165719
|
-
/***/ }),
|
|
165720
|
-
|
|
165721
|
-
/***/ 49482:
|
|
165722
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
165723
|
-
|
|
165724
|
-
//////////////////////////////////////////
|
|
165725
|
-
// Needle -- HTTP Client for Node.js
|
|
165726
|
-
// Written by Tomás Pollak <tomas@forkhq.com>
|
|
165727
|
-
// (c) 2012-2020 - Fork Ltd.
|
|
165728
|
-
// MIT Licensed
|
|
165729
|
-
//////////////////////////////////////////
|
|
165730
|
-
|
|
165731
|
-
var fs = __webpack_require__(35747),
|
|
165732
|
-
http = __webpack_require__(98605),
|
|
165733
|
-
https = __webpack_require__(57211),
|
|
165734
|
-
url = __webpack_require__(78835),
|
|
165735
|
-
stream = __webpack_require__(92413),
|
|
165736
|
-
debug = __webpack_require__(89081)('needle'),
|
|
165737
|
-
stringify = __webpack_require__(60315)/* .build */ .J,
|
|
165738
|
-
multipart = __webpack_require__(30050),
|
|
165739
|
-
auth = __webpack_require__(53394),
|
|
165740
|
-
cookies = __webpack_require__(77334),
|
|
165741
|
-
parsers = __webpack_require__(87218),
|
|
165742
|
-
decoder = __webpack_require__(50957);
|
|
165743
|
-
|
|
165744
|
-
//////////////////////////////////////////
|
|
165745
|
-
// variabilia
|
|
165746
|
-
|
|
165747
|
-
var version = __webpack_require__(83049)/* .version */ .i8;
|
|
165748
|
-
|
|
165749
|
-
var user_agent = 'Needle/' + version;
|
|
165750
|
-
user_agent += ' (Node.js ' + process.version + '; ' + process.platform + ' ' + process.arch + ')';
|
|
165751
|
-
|
|
165752
|
-
var tls_options = 'agent pfx key passphrase cert ca ciphers rejectUnauthorized secureProtocol checkServerIdentity family';
|
|
165753
|
-
|
|
165754
|
-
// older versions of node (< 0.11.4) prevent the runtime from exiting
|
|
165755
|
-
// because of connections in keep-alive state. so if this is the case
|
|
165756
|
-
// we'll default new requests to set a Connection: close header.
|
|
165757
|
-
var close_by_default = !http.Agent || http.Agent.defaultMaxSockets != Infinity;
|
|
165758
|
-
|
|
165759
|
-
// see if we have Object.assign. otherwise fall back to util._extend
|
|
165760
|
-
var extend = Object.assign ? Object.assign : __webpack_require__(31669)._extend;
|
|
165761
|
-
|
|
165762
|
-
// these are the status codes that Needle interprets as redirects.
|
|
165763
|
-
var redirect_codes = [301, 302, 303, 307, 308];
|
|
165764
|
-
|
|
165765
|
-
//////////////////////////////////////////
|
|
165766
|
-
// decompressors for gzip/deflate/br bodies
|
|
165767
|
-
|
|
165768
|
-
function bind_opts(fn, options) {
|
|
165769
|
-
return fn.bind(null, options);
|
|
165770
|
-
}
|
|
165771
|
-
|
|
165772
|
-
var decompressors = {};
|
|
165773
|
-
|
|
165774
|
-
try {
|
|
165775
|
-
|
|
165776
|
-
var zlib = __webpack_require__(78761);
|
|
165777
|
-
|
|
165778
|
-
// Enable Z_SYNC_FLUSH to avoid Z_BUF_ERROR errors (Node PR #2595)
|
|
165779
|
-
var zlib_options = {
|
|
165780
|
-
flush: zlib.Z_SYNC_FLUSH,
|
|
165781
|
-
finishFlush: zlib.Z_SYNC_FLUSH
|
|
165782
|
-
};
|
|
165783
|
-
|
|
165784
|
-
var br_options = {
|
|
165785
|
-
flush: zlib.BROTLI_OPERATION_FLUSH,
|
|
165786
|
-
finishFlush: zlib.BROTLI_OPERATION_FLUSH
|
|
165787
|
-
};
|
|
165788
|
-
|
|
165789
|
-
decompressors['x-deflate'] = bind_opts(zlib.Inflate, zlib_options);
|
|
165790
|
-
decompressors['deflate'] = bind_opts(zlib.Inflate, zlib_options);
|
|
165791
|
-
decompressors['x-gzip'] = bind_opts(zlib.Gunzip, zlib_options);
|
|
165792
|
-
decompressors['gzip'] = bind_opts(zlib.Gunzip, zlib_options);
|
|
165793
|
-
if (typeof zlib.BrotliDecompress === 'function') {
|
|
165794
|
-
decompressors['br'] = bind_opts(zlib.BrotliDecompress, br_options);
|
|
165795
|
-
}
|
|
165796
|
-
|
|
165797
|
-
} catch(e) { /* zlib not available */ }
|
|
165798
|
-
|
|
165799
|
-
//////////////////////////////////////////
|
|
165800
|
-
// options and aliases
|
|
165801
|
-
|
|
165802
|
-
var defaults = {
|
|
165803
|
-
// data
|
|
165804
|
-
boundary : '--------------------NODENEEDLEHTTPCLIENT',
|
|
165805
|
-
encoding : 'utf8',
|
|
165806
|
-
parse_response : 'all', // same as true. valid options: 'json', 'xml' or false/null
|
|
165807
|
-
proxy : null,
|
|
165808
|
-
|
|
165809
|
-
// headers
|
|
165810
|
-
headers : {},
|
|
165811
|
-
accept : '*/*',
|
|
165812
|
-
user_agent : user_agent,
|
|
165813
|
-
|
|
165814
|
-
// numbers
|
|
165815
|
-
open_timeout : 10000,
|
|
165816
|
-
response_timeout : 0,
|
|
165817
|
-
read_timeout : 0,
|
|
165818
|
-
follow_max : 0,
|
|
165819
|
-
stream_length : -1,
|
|
165820
|
-
|
|
165821
|
-
// booleans
|
|
165822
|
-
compressed : false,
|
|
165823
|
-
decode_response : true,
|
|
165824
|
-
parse_cookies : true,
|
|
165825
|
-
follow_set_cookies : false,
|
|
165826
|
-
follow_set_referer : false,
|
|
165827
|
-
follow_keep_method : false,
|
|
165828
|
-
follow_if_same_host : false,
|
|
165829
|
-
follow_if_same_protocol : false,
|
|
165830
|
-
follow_if_same_location : false
|
|
165831
|
-
}
|
|
165832
|
-
|
|
165833
|
-
var aliased = {
|
|
165834
|
-
options: {
|
|
165835
|
-
decode : 'decode_response',
|
|
165836
|
-
parse : 'parse_response',
|
|
165837
|
-
timeout : 'open_timeout',
|
|
165838
|
-
follow : 'follow_max'
|
|
165839
|
-
},
|
|
165840
|
-
inverted: {}
|
|
165841
|
-
}
|
|
165842
|
-
|
|
165843
|
-
// only once, invert aliased keys so we can get passed options.
|
|
165844
|
-
Object.keys(aliased.options).map(function(k) {
|
|
165845
|
-
var value = aliased.options[k];
|
|
165846
|
-
aliased.inverted[value] = k;
|
|
165847
|
-
});
|
|
165848
|
-
|
|
165849
|
-
//////////////////////////////////////////
|
|
165850
|
-
// helpers
|
|
165851
|
-
|
|
165852
|
-
function keys_by_type(type) {
|
|
165853
|
-
return Object.keys(defaults).map(function(el) {
|
|
165854
|
-
if (defaults[el] !== null && defaults[el].constructor == type)
|
|
165855
|
-
return el;
|
|
165856
|
-
}).filter(function(el) { return el })
|
|
165857
|
-
}
|
|
165858
|
-
|
|
165859
|
-
function parse_content_type(header) {
|
|
165860
|
-
if (!header || header === '') return {};
|
|
165861
|
-
|
|
165862
|
-
var found, charset = 'utf8', arr = header.split(';');
|
|
165863
|
-
|
|
165864
|
-
if (arr.length > 1 && (found = arr[1].match(/charset=(.+)/)))
|
|
165865
|
-
charset = found[1];
|
|
165866
|
-
|
|
165867
|
-
return { type: arr[0], charset: charset };
|
|
165868
|
-
}
|
|
165869
|
-
|
|
165870
|
-
function is_stream(obj) {
|
|
165871
|
-
return typeof obj.pipe === 'function';
|
|
165872
|
-
}
|
|
165873
|
-
|
|
165874
|
-
function get_stream_length(stream, given_length, cb) {
|
|
165875
|
-
if (given_length > 0)
|
|
165876
|
-
return cb(given_length);
|
|
165877
|
-
|
|
165878
|
-
if (stream.end !== void 0 && stream.end !== Infinity && stream.start !== void 0)
|
|
165879
|
-
return cb((stream.end + 1) - (stream.start || 0));
|
|
165880
|
-
|
|
165881
|
-
fs.stat(stream.path, function(err, stat) {
|
|
165882
|
-
cb(stat ? stat.size - (stream.start || 0) : null);
|
|
165883
|
-
});
|
|
165884
|
-
}
|
|
165885
|
-
|
|
165886
|
-
function resolve_url(href, base) {
|
|
165887
|
-
if (url.URL)
|
|
165888
|
-
return new url.URL(href, base);
|
|
165889
|
-
|
|
165890
|
-
// older Node version (< v6.13)
|
|
165891
|
-
return url.resolve(base, href);
|
|
165892
|
-
}
|
|
165893
|
-
|
|
165894
|
-
function pump_streams(streams, cb) {
|
|
165895
|
-
if (stream.pipeline)
|
|
165896
|
-
return stream.pipeline.apply(null, streams.concat(cb));
|
|
165897
|
-
|
|
165898
|
-
var tmp = streams.shift();
|
|
165899
|
-
while (streams.length) {
|
|
165900
|
-
tmp = tmp.pipe(streams.shift());
|
|
165901
|
-
tmp.once('error', function(e) {
|
|
165902
|
-
cb && cb(e);
|
|
165903
|
-
cb = null;
|
|
165904
|
-
})
|
|
165905
|
-
}
|
|
165906
|
-
}
|
|
165907
|
-
|
|
165908
|
-
//////////////////////////////////////////
|
|
165909
|
-
// the main act
|
|
165910
|
-
|
|
165911
|
-
function Needle(method, uri, data, options, callback) {
|
|
165912
|
-
// if (!(this instanceof Needle)) {
|
|
165913
|
-
// return new Needle(method, uri, data, options, callback);
|
|
165914
|
-
// }
|
|
165915
|
-
|
|
165916
|
-
if (typeof uri !== 'string')
|
|
165917
|
-
throw new TypeError('URL must be a string, not ' + uri);
|
|
165918
|
-
|
|
165919
|
-
this.method = method.toLowerCase();
|
|
165920
|
-
this.uri = uri;
|
|
165921
|
-
this.data = data;
|
|
165922
|
-
|
|
165923
|
-
if (typeof options == 'function') {
|
|
165924
|
-
this.callback = options;
|
|
165925
|
-
this.options = {};
|
|
165926
|
-
} else {
|
|
165927
|
-
this.callback = callback;
|
|
165928
|
-
this.options = options;
|
|
165929
|
-
}
|
|
165930
|
-
|
|
165931
|
-
}
|
|
165932
|
-
|
|
165933
|
-
Needle.prototype.setup = function(uri, options) {
|
|
165934
|
-
|
|
165935
|
-
function get_option(key, fallback) {
|
|
165936
|
-
// if original is in options, return that value
|
|
165937
|
-
if (typeof options[key] != 'undefined') return options[key];
|
|
165938
|
-
|
|
165939
|
-
// otherwise, return value from alias or fallback/undefined
|
|
165940
|
-
return typeof options[aliased.inverted[key]] != 'undefined'
|
|
165941
|
-
? options[aliased.inverted[key]] : fallback;
|
|
165942
|
-
}
|
|
165943
|
-
|
|
165944
|
-
function check_value(expected, key) {
|
|
165945
|
-
var value = get_option(key),
|
|
165946
|
-
type = typeof value;
|
|
165947
|
-
|
|
165948
|
-
if (type != 'undefined' && type != expected)
|
|
165949
|
-
throw new TypeError(type + ' received for ' + key + ', but expected a ' + expected);
|
|
165950
|
-
|
|
165951
|
-
return (type == expected) ? value : defaults[key];
|
|
165952
|
-
}
|
|
165953
|
-
|
|
165954
|
-
//////////////////////////////////////////////////
|
|
165955
|
-
// the basics
|
|
165956
|
-
|
|
165957
|
-
var config = {
|
|
165958
|
-
http_opts : {
|
|
165959
|
-
localAddress: get_option('localAddress', undefined),
|
|
165960
|
-
lookup: get_option('lookup', undefined)
|
|
165961
|
-
}, // passed later to http.request() directly
|
|
165962
|
-
headers : {},
|
|
165963
|
-
output : options.output,
|
|
165964
|
-
proxy : get_option('proxy', defaults.proxy),
|
|
165965
|
-
parser : get_option('parse_response', defaults.parse_response),
|
|
165966
|
-
encoding : options.encoding || (options.multipart ? 'binary' : defaults.encoding)
|
|
165967
|
-
}
|
|
165968
|
-
|
|
165969
|
-
keys_by_type(Boolean).forEach(function(key) {
|
|
165970
|
-
config[key] = check_value('boolean', key);
|
|
165971
|
-
})
|
|
165972
|
-
|
|
165973
|
-
keys_by_type(Number).forEach(function(key) {
|
|
165974
|
-
config[key] = check_value('number', key);
|
|
165975
|
-
})
|
|
165976
|
-
|
|
165977
|
-
// populate http_opts with given TLS options
|
|
165978
|
-
tls_options.split(' ').forEach(function(key) {
|
|
165979
|
-
if (typeof options[key] != 'undefined') {
|
|
165980
|
-
config.http_opts[key] = options[key];
|
|
165981
|
-
if (typeof options.agent == 'undefined')
|
|
165982
|
-
config.http_opts.agent = false; // otherwise tls options are skipped
|
|
165983
|
-
}
|
|
165984
|
-
});
|
|
165985
|
-
|
|
165986
|
-
//////////////////////////////////////////////////
|
|
165987
|
-
// headers, cookies
|
|
165988
|
-
|
|
165989
|
-
for (var key in defaults.headers)
|
|
165990
|
-
config.headers[key] = defaults.headers[key];
|
|
165991
|
-
|
|
165992
|
-
config.headers['accept'] = options.accept || defaults.accept;
|
|
165993
|
-
config.headers['user-agent'] = options.user_agent || defaults.user_agent;
|
|
165994
|
-
|
|
165995
|
-
if (options.content_type)
|
|
165996
|
-
config.headers['content-type'] = options.content_type;
|
|
165997
|
-
|
|
165998
|
-
// set connection header if opts.connection was passed, or if node < 0.11.4 (close)
|
|
165999
|
-
if (options.connection || close_by_default)
|
|
166000
|
-
config.headers['connection'] = options.connection || 'close';
|
|
166001
|
-
|
|
166002
|
-
if ((options.compressed || defaults.compressed) && typeof zlib != 'undefined')
|
|
166003
|
-
config.headers['accept-encoding'] = decompressors['br'] ? 'gzip, deflate, br' : 'gzip, deflate';
|
|
166004
|
-
|
|
166005
|
-
if (options.cookies)
|
|
166006
|
-
config.headers['cookie'] = cookies.write(options.cookies);
|
|
166007
|
-
|
|
166008
|
-
//////////////////////////////////////////////////
|
|
166009
|
-
// basic/digest auth
|
|
166010
|
-
|
|
166011
|
-
if (uri.match(/[^\/]@/)) { // url contains user:pass@host, so parse it.
|
|
166012
|
-
var parts = (url.parse(uri).auth || '').split(':');
|
|
166013
|
-
options.username = parts[0];
|
|
166014
|
-
options.password = parts[1];
|
|
166015
|
-
}
|
|
166016
|
-
|
|
166017
|
-
if (options.username) {
|
|
166018
|
-
if (options.auth && (options.auth == 'auto' || options.auth == 'digest')) {
|
|
166019
|
-
config.credentials = [options.username, options.password];
|
|
166020
|
-
} else {
|
|
166021
|
-
config.headers['authorization'] = auth.basic(options.username, options.password);
|
|
166022
|
-
}
|
|
166023
|
-
}
|
|
166024
|
-
|
|
166025
|
-
// if proxy is present, set auth header from either url or proxy_user option.
|
|
166026
|
-
if (config.proxy) {
|
|
166027
|
-
if (config.proxy.indexOf('http') === -1)
|
|
166028
|
-
config.proxy = 'http://' + config.proxy;
|
|
166029
|
-
|
|
166030
|
-
if (config.proxy.indexOf('@') !== -1) {
|
|
166031
|
-
var proxy = (url.parse(config.proxy).auth || '').split(':');
|
|
166032
|
-
options.proxy_user = proxy[0];
|
|
166033
|
-
options.proxy_pass = proxy[1];
|
|
166034
|
-
}
|
|
166035
|
-
|
|
166036
|
-
if (options.proxy_user)
|
|
166037
|
-
config.headers['proxy-authorization'] = auth.basic(options.proxy_user, options.proxy_pass);
|
|
166038
|
-
}
|
|
166039
|
-
|
|
166040
|
-
// now that all our headers are set, overwrite them if instructed.
|
|
166041
|
-
for (var h in options.headers)
|
|
166042
|
-
config.headers[h.toLowerCase()] = options.headers[h];
|
|
166043
|
-
|
|
166044
|
-
config.uri_modifier = get_option('uri_modifier', null);
|
|
166045
|
-
|
|
166046
|
-
return config;
|
|
166047
|
-
}
|
|
166048
|
-
|
|
166049
|
-
Needle.prototype.start = function() {
|
|
166050
|
-
|
|
166051
|
-
var out = new stream.PassThrough({ objectMode: false }),
|
|
166052
|
-
uri = this.uri,
|
|
166053
|
-
data = this.data,
|
|
166054
|
-
method = this.method,
|
|
166055
|
-
callback = (typeof this.options == 'function') ? this.options : this.callback,
|
|
166056
|
-
options = this.options || {};
|
|
166057
|
-
|
|
166058
|
-
// if no 'http' is found on URL, prepend it.
|
|
166059
|
-
if (uri.indexOf('http') === -1)
|
|
166060
|
-
uri = uri.replace(/^(\/\/)?/, 'http://');
|
|
166061
|
-
|
|
166062
|
-
var self = this, body, waiting = false, config = this.setup(uri, options);
|
|
166063
|
-
|
|
166064
|
-
// unless options.json was set to false, assume boss also wants JSON if content-type matches.
|
|
166065
|
-
var json = options.json || (options.json !== false && config.headers['content-type'] == 'application/json');
|
|
166066
|
-
|
|
166067
|
-
if (data) {
|
|
166068
|
-
|
|
166069
|
-
if (options.multipart) { // boss says we do multipart. so we do it.
|
|
166070
|
-
var boundary = options.boundary || defaults.boundary;
|
|
166071
|
-
|
|
166072
|
-
waiting = true;
|
|
166073
|
-
multipart.build(data, boundary, function(err, parts) {
|
|
166074
|
-
if (err) throw(err);
|
|
166075
|
-
|
|
166076
|
-
config.headers['content-type'] = 'multipart/form-data; boundary=' + boundary;
|
|
166077
|
-
next(parts);
|
|
166078
|
-
});
|
|
166079
|
-
|
|
166080
|
-
} else if (is_stream(data)) {
|
|
166081
|
-
|
|
166082
|
-
if (method == 'get')
|
|
166083
|
-
throw new Error('Refusing to pipe() a stream via GET. Did you mean .post?');
|
|
166084
|
-
|
|
166085
|
-
if (config.stream_length > 0 || (config.stream_length === 0 && data.path)) {
|
|
166086
|
-
// ok, let's get the stream's length and set it as the content-length header.
|
|
166087
|
-
// this prevents some servers from cutting us off before all the data is sent.
|
|
166088
|
-
waiting = true;
|
|
166089
|
-
get_stream_length(data, config.stream_length, function(length) {
|
|
166090
|
-
data.length = length;
|
|
166091
|
-
next(data);
|
|
166092
|
-
})
|
|
166093
|
-
|
|
166094
|
-
} else {
|
|
166095
|
-
// if the boss doesn't want us to get the stream's length, or if it doesn't
|
|
166096
|
-
// have a file descriptor for that purpose, then just head on.
|
|
166097
|
-
body = data;
|
|
166098
|
-
}
|
|
166099
|
-
|
|
166100
|
-
} else if (Buffer.isBuffer(data)) {
|
|
166101
|
-
|
|
166102
|
-
body = data; // use the raw buffer as request body.
|
|
166103
|
-
|
|
166104
|
-
} else if (method == 'get' && !json) {
|
|
166105
|
-
|
|
166106
|
-
// append the data to the URI as a querystring.
|
|
166107
|
-
uri = uri.replace(/\?.*|$/, '?' + stringify(data));
|
|
166108
|
-
|
|
166109
|
-
} else { // string or object data, no multipart.
|
|
166110
|
-
|
|
166111
|
-
// if string, leave it as it is, otherwise, stringify.
|
|
166112
|
-
body = (typeof(data) === 'string') ? data
|
|
166113
|
-
: json ? JSON.stringify(data) : stringify(data);
|
|
166114
|
-
|
|
166115
|
-
// ensure we have a buffer so bytecount is correct.
|
|
166116
|
-
body = Buffer.from(body, config.encoding);
|
|
166117
|
-
}
|
|
166118
|
-
|
|
166119
|
-
}
|
|
166120
|
-
|
|
166121
|
-
function next(body) {
|
|
166122
|
-
if (body) {
|
|
166123
|
-
if (body.length) config.headers['content-length'] = body.length;
|
|
166124
|
-
|
|
166125
|
-
// if no content-type was passed, determine if json or not.
|
|
166126
|
-
if (!config.headers['content-type']) {
|
|
166127
|
-
config.headers['content-type'] = json
|
|
166128
|
-
? 'application/json; charset=utf-8'
|
|
166129
|
-
: 'application/x-www-form-urlencoded'; // no charset says W3 spec.
|
|
166130
|
-
}
|
|
166131
|
-
}
|
|
166132
|
-
|
|
166133
|
-
// unless a specific accept header was set, assume json: true wants JSON back.
|
|
166134
|
-
if (options.json && (!options.accept && !(options.headers || {}).accept))
|
|
166135
|
-
config.headers['accept'] = 'application/json';
|
|
166136
|
-
|
|
166137
|
-
self.send_request(1, method, uri, config, body, out, callback);
|
|
166138
|
-
}
|
|
166139
|
-
|
|
166140
|
-
if (!waiting) next(body);
|
|
166141
|
-
return out;
|
|
166142
|
-
}
|
|
166143
|
-
|
|
166144
|
-
Needle.prototype.get_request_opts = function(method, uri, config) {
|
|
166145
|
-
var opts = config.http_opts,
|
|
166146
|
-
proxy = config.proxy,
|
|
166147
|
-
remote = proxy ? url.parse(proxy) : url.parse(uri);
|
|
166148
|
-
|
|
166149
|
-
opts.protocol = remote.protocol;
|
|
166150
|
-
opts.host = remote.hostname;
|
|
166151
|
-
opts.port = remote.port || (remote.protocol == 'https:' ? 443 : 80);
|
|
166152
|
-
opts.path = proxy ? uri : remote.pathname + (remote.search || '');
|
|
166153
|
-
opts.method = method;
|
|
166154
|
-
opts.headers = config.headers;
|
|
166155
|
-
|
|
166156
|
-
if (!opts.headers['host']) {
|
|
166157
|
-
// if using proxy, make sure the host header shows the final destination
|
|
166158
|
-
var target = proxy ? url.parse(uri) : remote;
|
|
166159
|
-
opts.headers['host'] = target.hostname;
|
|
166160
|
-
|
|
166161
|
-
// and if a non standard port was passed, append it to the port header
|
|
166162
|
-
if (target.port && [80, 443].indexOf(target.port) === -1) {
|
|
166163
|
-
opts.headers['host'] += ':' + target.port;
|
|
166164
|
-
}
|
|
166165
|
-
}
|
|
166166
|
-
|
|
166167
|
-
return opts;
|
|
166168
|
-
}
|
|
166169
|
-
|
|
166170
|
-
Needle.prototype.should_follow = function(location, config, original) {
|
|
166171
|
-
if (!location) return false;
|
|
166172
|
-
|
|
166173
|
-
// returns true if location contains matching property (host or protocol)
|
|
166174
|
-
function matches(property) {
|
|
166175
|
-
var property = original[property];
|
|
166176
|
-
return location.indexOf(property) !== -1;
|
|
166177
|
-
}
|
|
166178
|
-
|
|
166179
|
-
// first, check whether the requested location is actually different from the original
|
|
166180
|
-
if (!config.follow_if_same_location && location === original)
|
|
166181
|
-
return false;
|
|
166182
|
-
|
|
166183
|
-
if (config.follow_if_same_host && !matches('host'))
|
|
166184
|
-
return false; // host does not match, so not following
|
|
166185
|
-
|
|
166186
|
-
if (config.follow_if_same_protocol && !matches('protocol'))
|
|
166187
|
-
return false; // procotol does not match, so not following
|
|
166188
|
-
|
|
166189
|
-
return true;
|
|
166190
|
-
}
|
|
166191
|
-
|
|
166192
|
-
Needle.prototype.send_request = function(count, method, uri, config, post_data, out, callback) {
|
|
166193
|
-
|
|
166194
|
-
if (typeof config.uri_modifier === 'function') {
|
|
166195
|
-
var modified_uri = config.uri_modifier(uri);
|
|
166196
|
-
debug('Modifying request URI', uri + ' => ' + modified_uri);
|
|
166197
|
-
uri = modified_uri;
|
|
166198
|
-
}
|
|
166199
|
-
|
|
166200
|
-
var request,
|
|
166201
|
-
timer,
|
|
166202
|
-
returned = 0,
|
|
166203
|
-
self = this,
|
|
166204
|
-
request_opts = this.get_request_opts(method, uri, config),
|
|
166205
|
-
protocol = request_opts.protocol == 'https:' ? https : http;
|
|
166206
|
-
|
|
166207
|
-
function done(err, resp) {
|
|
166208
|
-
if (returned++ > 0)
|
|
166209
|
-
return debug('Already finished, stopping here.');
|
|
166210
|
-
|
|
166211
|
-
if (timer) clearTimeout(timer);
|
|
166212
|
-
request.removeListener('error', had_error);
|
|
166213
|
-
out.done = true;
|
|
166214
|
-
|
|
166215
|
-
if (callback)
|
|
166216
|
-
return callback(err, resp, resp ? resp.body : undefined);
|
|
166217
|
-
|
|
166218
|
-
// NOTE: this event used to be called 'end', but the behaviour was confusing
|
|
166219
|
-
// when errors ocurred, because the stream would still emit an 'end' event.
|
|
166220
|
-
out.emit('done', err);
|
|
166221
|
-
|
|
166222
|
-
// trigger the 'done' event on streams we're being piped to, if any
|
|
166223
|
-
var pipes = out._readableState.pipes || [];
|
|
166224
|
-
if (!pipes.forEach) pipes = [pipes];
|
|
166225
|
-
pipes.forEach(function(st) { st.emit('done', err); })
|
|
166226
|
-
}
|
|
166227
|
-
|
|
166228
|
-
function had_error(err) {
|
|
166229
|
-
debug('Request error', err);
|
|
166230
|
-
out.emit('err', err);
|
|
166231
|
-
done(err || new Error('Unknown error when making request.'));
|
|
166232
|
-
}
|
|
166233
|
-
|
|
166234
|
-
function set_timeout(type, milisecs) {
|
|
166235
|
-
if (timer) clearTimeout(timer);
|
|
166236
|
-
if (milisecs <= 0) return;
|
|
166237
|
-
|
|
166238
|
-
timer = setTimeout(function() {
|
|
166239
|
-
out.emit('timeout', type);
|
|
166240
|
-
request.abort();
|
|
166241
|
-
// also invoke done() to terminate job on read_timeout
|
|
166242
|
-
if (type == 'read') done(new Error(type + ' timeout'));
|
|
166243
|
-
}, milisecs);
|
|
166244
|
-
}
|
|
166245
|
-
|
|
166246
|
-
// handle errors on the underlying socket, that may be closed while writing
|
|
166247
|
-
// for an example case, see test/long_string_spec.js. we make sure this
|
|
166248
|
-
// scenario ocurred by verifying the socket's writable & destroyed states.
|
|
166249
|
-
function on_socket_end() {
|
|
166250
|
-
if (returned && !this.writable && this.destroyed === false) {
|
|
166251
|
-
this.destroy();
|
|
166252
|
-
had_error(new Error('Remote end closed socket abruptly.'))
|
|
166253
|
-
}
|
|
166254
|
-
}
|
|
166255
|
-
|
|
166256
|
-
debug('Making request #' + count, request_opts);
|
|
166257
|
-
request = protocol.request(request_opts, function(resp) {
|
|
166258
|
-
|
|
166259
|
-
var headers = resp.headers;
|
|
166260
|
-
debug('Got response', resp.statusCode, headers);
|
|
166261
|
-
out.emit('response', resp);
|
|
166262
|
-
|
|
166263
|
-
set_timeout('read', config.read_timeout);
|
|
166264
|
-
|
|
166265
|
-
// if we got cookies, parse them unless we were instructed not to. make sure to include any
|
|
166266
|
-
// cookies that might have been set on previous redirects.
|
|
166267
|
-
if (config.parse_cookies && (headers['set-cookie'] || config.previous_resp_cookies)) {
|
|
166268
|
-
resp.cookies = extend(config.previous_resp_cookies || {}, cookies.read(headers['set-cookie']));
|
|
166269
|
-
debug('Got cookies', resp.cookies);
|
|
166270
|
-
}
|
|
166271
|
-
|
|
166272
|
-
// if redirect code is found, determine if we should follow it according to the given options.
|
|
166273
|
-
if (redirect_codes.indexOf(resp.statusCode) !== -1 && self.should_follow(headers.location, config, uri)) {
|
|
166274
|
-
// clear timer before following redirects to prevent unexpected setTimeout consequence
|
|
166275
|
-
clearTimeout(timer);
|
|
166276
|
-
|
|
166277
|
-
if (count <= config.follow_max) {
|
|
166278
|
-
out.emit('redirect', headers.location);
|
|
166279
|
-
|
|
166280
|
-
// unless 'follow_keep_method' is true, rewrite the request to GET before continuing.
|
|
166281
|
-
if (!config.follow_keep_method) {
|
|
166282
|
-
method = 'GET';
|
|
166283
|
-
post_data = null;
|
|
166284
|
-
delete config.headers['content-length']; // in case the original was a multipart POST request.
|
|
166285
|
-
}
|
|
166286
|
-
|
|
166287
|
-
// if follow_set_cookies is true, insert cookies in the next request's headers.
|
|
166288
|
-
// we set both the original request cookies plus any response cookies we might have received.
|
|
166289
|
-
if (config.follow_set_cookies) {
|
|
166290
|
-
var request_cookies = cookies.read(config.headers['cookie']);
|
|
166291
|
-
config.previous_resp_cookies = resp.cookies;
|
|
166292
|
-
if (Object.keys(request_cookies).length || Object.keys(resp.cookies || {}).length) {
|
|
166293
|
-
config.headers['cookie'] = cookies.write(extend(request_cookies, resp.cookies));
|
|
166294
|
-
}
|
|
166295
|
-
} else if (config.headers['cookie']) {
|
|
166296
|
-
debug('Clearing original request cookie', config.headers['cookie']);
|
|
166297
|
-
delete config.headers['cookie'];
|
|
166298
|
-
}
|
|
166299
|
-
|
|
166300
|
-
if (config.follow_set_referer)
|
|
166301
|
-
config.headers['referer'] = encodeURI(uri); // the original, not the destination URL.
|
|
166302
|
-
|
|
166303
|
-
config.headers['host'] = null; // clear previous Host header to avoid conflicts.
|
|
166304
|
-
|
|
166305
|
-
var redirect_url = resolve_url(headers.location, uri);
|
|
166306
|
-
debug('Redirecting to ' + redirect_url.toString());
|
|
166307
|
-
return self.send_request(++count, method, redirect_url.toString(), config, post_data, out, callback);
|
|
166308
|
-
} else if (config.follow_max > 0) {
|
|
166309
|
-
return done(new Error('Max redirects reached. Possible loop in: ' + headers.location));
|
|
166310
|
-
}
|
|
166311
|
-
}
|
|
166312
|
-
|
|
166313
|
-
// if auth is requested and credentials were not passed, resend request, provided we have user/pass.
|
|
166314
|
-
if (resp.statusCode == 401 && headers['www-authenticate'] && config.credentials) {
|
|
166315
|
-
if (!config.headers['authorization']) { // only if authentication hasn't been sent
|
|
166316
|
-
var auth_header = auth.header(headers['www-authenticate'], config.credentials, request_opts);
|
|
166317
|
-
|
|
166318
|
-
if (auth_header) {
|
|
166319
|
-
config.headers['authorization'] = auth_header;
|
|
166320
|
-
return self.send_request(count, method, uri, config, post_data, out, callback);
|
|
166321
|
-
}
|
|
166322
|
-
}
|
|
166323
|
-
}
|
|
166324
|
-
|
|
166325
|
-
// ok, so we got a valid (non-redirect & authorized) response. let's notify the stream guys.
|
|
166326
|
-
out.emit('header', resp.statusCode, headers);
|
|
166327
|
-
out.emit('headers', headers);
|
|
166328
|
-
|
|
166329
|
-
var pipeline = [],
|
|
166330
|
-
mime = parse_content_type(headers['content-type']),
|
|
166331
|
-
text_response = mime.type && (mime.type.indexOf('text/') != -1 || !!mime.type.match(/(\/|\+)(xml|json)$/));
|
|
166332
|
-
|
|
166333
|
-
// To start, if our body is compressed and we're able to inflate it, do it.
|
|
166334
|
-
if (headers['content-encoding'] && decompressors[headers['content-encoding']]) {
|
|
166335
|
-
|
|
166336
|
-
var decompressor = decompressors[headers['content-encoding']]();
|
|
166337
|
-
|
|
166338
|
-
// make sure we catch errors triggered by the decompressor.
|
|
166339
|
-
decompressor.on('error', had_error);
|
|
166340
|
-
pipeline.push(decompressor);
|
|
166341
|
-
}
|
|
166342
|
-
|
|
166343
|
-
// If parse is enabled and we have a parser for it, then go for it.
|
|
166344
|
-
if (config.parser && parsers[mime.type]) {
|
|
166345
|
-
|
|
166346
|
-
// If a specific parser was requested, make sure we don't parse other types.
|
|
166347
|
-
var parser_name = config.parser.toString().toLowerCase();
|
|
166348
|
-
if (['xml', 'json'].indexOf(parser_name) == -1 || parsers[mime.type].name == parser_name) {
|
|
166349
|
-
|
|
166350
|
-
// OK, so either we're parsing all content types or the one requested matches.
|
|
166351
|
-
out.parser = parsers[mime.type].name;
|
|
166352
|
-
pipeline.push(parsers[mime.type].fn());
|
|
166353
|
-
|
|
166354
|
-
// Set objectMode on out stream to improve performance.
|
|
166355
|
-
out._writableState.objectMode = true;
|
|
166356
|
-
out._readableState.objectMode = true;
|
|
166357
|
-
}
|
|
166358
|
-
|
|
166359
|
-
// If we're not parsing, and unless decoding was disabled, we'll try
|
|
166360
|
-
// decoding non UTF-8 bodies to UTF-8, using the iconv-lite library.
|
|
166361
|
-
} else if (text_response && config.decode_response && mime.charset) {
|
|
166362
|
-
pipeline.push(decoder(mime.charset));
|
|
166363
|
-
}
|
|
166364
|
-
|
|
166365
|
-
// And `out` is the stream we finally push the decoded/parsed output to.
|
|
166366
|
-
pipeline.push(out);
|
|
166367
|
-
|
|
166368
|
-
// Now, release the kraken!
|
|
166369
|
-
pump_streams([resp].concat(pipeline), function(err) {
|
|
166370
|
-
if (err) debug(err)
|
|
166371
|
-
|
|
166372
|
-
// on node v8.x, if an error ocurrs on the receiving end,
|
|
166373
|
-
// then we want to abort the request to avoid having dangling sockets
|
|
166374
|
-
if (err && err.message == 'write after end') request.destroy();
|
|
166375
|
-
});
|
|
166376
|
-
|
|
166377
|
-
// If the user has requested and output file, pipe the output stream to it.
|
|
166378
|
-
// In stream mode, we will still get the response stream to play with.
|
|
166379
|
-
if (config.output && resp.statusCode == 200) {
|
|
166380
|
-
|
|
166381
|
-
// for some reason, simply piping resp to the writable stream doesn't
|
|
166382
|
-
// work all the time (stream gets cut in the middle with no warning).
|
|
166383
|
-
// so we'll manually need to do the readable/write(chunk) trick.
|
|
166384
|
-
var file = fs.createWriteStream(config.output);
|
|
166385
|
-
file.on('error', had_error);
|
|
166386
|
-
|
|
166387
|
-
out.on('end', function() {
|
|
166388
|
-
if (file.writable) file.end();
|
|
166389
|
-
});
|
|
166390
|
-
|
|
166391
|
-
file.on('close', function() {
|
|
166392
|
-
delete out.file;
|
|
166393
|
-
})
|
|
166394
|
-
|
|
166395
|
-
out.on('readable', function() {
|
|
166396
|
-
var chunk;
|
|
166397
|
-
while ((chunk = this.read()) !== null) {
|
|
166398
|
-
if (file.writable) file.write(chunk);
|
|
166399
|
-
|
|
166400
|
-
// if callback was requested, also push it to resp.body
|
|
166401
|
-
if (resp.body) resp.body.push(chunk);
|
|
166402
|
-
}
|
|
166403
|
-
})
|
|
166404
|
-
|
|
166405
|
-
out.file = file;
|
|
166406
|
-
}
|
|
166407
|
-
|
|
166408
|
-
// Only aggregate the full body if a callback was requested.
|
|
166409
|
-
if (callback) {
|
|
166410
|
-
resp.raw = [];
|
|
166411
|
-
resp.body = [];
|
|
166412
|
-
resp.bytes = 0;
|
|
166413
|
-
|
|
166414
|
-
// Gather and count the amount of (raw) bytes using a PassThrough stream.
|
|
166415
|
-
var clean_pipe = new stream.PassThrough();
|
|
166416
|
-
|
|
166417
|
-
clean_pipe.on('readable', function() {
|
|
166418
|
-
var chunk;
|
|
166419
|
-
while ((chunk = this.read()) != null) {
|
|
166420
|
-
resp.bytes += chunk.length;
|
|
166421
|
-
resp.raw.push(chunk);
|
|
166422
|
-
}
|
|
166423
|
-
})
|
|
166424
|
-
|
|
166425
|
-
pump_streams([resp, clean_pipe], function(err) {
|
|
166426
|
-
if (err) debug(err);
|
|
166427
|
-
});
|
|
166428
|
-
|
|
166429
|
-
// Listen on the 'readable' event to aggregate the chunks, but only if
|
|
166430
|
-
// file output wasn't requested. Otherwise we'd have two stream readers.
|
|
166431
|
-
if (!config.output || resp.statusCode != 200) {
|
|
166432
|
-
out.on('readable', function() {
|
|
166433
|
-
var chunk;
|
|
166434
|
-
while ((chunk = this.read()) !== null) {
|
|
166435
|
-
// We're either pushing buffers or objects, never strings.
|
|
166436
|
-
if (typeof chunk == 'string') chunk = Buffer.from(chunk);
|
|
166437
|
-
|
|
166438
|
-
// Push all chunks to resp.body. We'll bind them in resp.end().
|
|
166439
|
-
resp.body.push(chunk);
|
|
166440
|
-
}
|
|
166441
|
-
})
|
|
166442
|
-
}
|
|
166443
|
-
}
|
|
166444
|
-
|
|
166445
|
-
// And set the .body property once all data is in.
|
|
166446
|
-
out.on('end', function() {
|
|
166447
|
-
if (resp.body) { // callback mode
|
|
166448
|
-
|
|
166449
|
-
// we want to be able to access to the raw data later, so keep a reference.
|
|
166450
|
-
resp.raw = Buffer.concat(resp.raw);
|
|
166451
|
-
|
|
166452
|
-
// if parse was successful, we should have an array with one object
|
|
166453
|
-
if (resp.body[0] !== undefined && !Buffer.isBuffer(resp.body[0])) {
|
|
166454
|
-
|
|
166455
|
-
// that's our body right there.
|
|
166456
|
-
resp.body = resp.body[0];
|
|
166457
|
-
|
|
166458
|
-
// set the parser property on our response. we may want to check.
|
|
166459
|
-
if (out.parser) resp.parser = out.parser;
|
|
166460
|
-
|
|
166461
|
-
} else { // we got one or several buffers. string or binary.
|
|
166462
|
-
resp.body = Buffer.concat(resp.body);
|
|
166463
|
-
|
|
166464
|
-
// if we're here and parsed is true, it means we tried to but it didn't work.
|
|
166465
|
-
// so given that we got a text response, let's stringify it.
|
|
166466
|
-
if (text_response || out.parser) {
|
|
166467
|
-
resp.body = resp.body.toString();
|
|
166468
|
-
}
|
|
166469
|
-
}
|
|
166470
|
-
}
|
|
166471
|
-
|
|
166472
|
-
// if an output file is being written to, make sure the callback
|
|
166473
|
-
// is triggered after all data has been written to it.
|
|
166474
|
-
if (out.file) {
|
|
166475
|
-
out.file.on('close', function() {
|
|
166476
|
-
done(null, resp);
|
|
166477
|
-
})
|
|
166478
|
-
} else { // elvis has left the building.
|
|
166479
|
-
done(null, resp);
|
|
166480
|
-
}
|
|
166481
|
-
|
|
166482
|
-
});
|
|
166483
|
-
|
|
166484
|
-
// out.on('error', function(err) {
|
|
166485
|
-
// had_error(err);
|
|
166486
|
-
// if (err.code == 'ERR_STREAM_DESTROYED' || err.code == 'ERR_STREAM_PREMATURE_CLOSE') {
|
|
166487
|
-
// request.abort();
|
|
166488
|
-
// }
|
|
166489
|
-
// })
|
|
166490
|
-
|
|
166491
|
-
}); // end request call
|
|
166492
|
-
|
|
166493
|
-
// unless open_timeout was disabled, set a timeout to abort the request.
|
|
166494
|
-
set_timeout('open', config.open_timeout);
|
|
166495
|
-
|
|
166496
|
-
// handle errors on the request object. things might get bumpy.
|
|
166497
|
-
request.on('error', had_error);
|
|
166498
|
-
|
|
166499
|
-
// make sure timer is cleared if request is aborted (issue #257)
|
|
166500
|
-
request.once('abort', function() {
|
|
166501
|
-
if (timer) clearTimeout(timer);
|
|
166502
|
-
})
|
|
166503
|
-
|
|
166504
|
-
// handle socket 'end' event to ensure we don't get delayed EPIPE errors.
|
|
166505
|
-
request.once('socket', function(socket) {
|
|
166506
|
-
if (socket.connecting) {
|
|
166507
|
-
socket.once('connect', function() {
|
|
166508
|
-
set_timeout('response', config.response_timeout);
|
|
166509
|
-
})
|
|
166510
|
-
} else {
|
|
166511
|
-
set_timeout('response', config.response_timeout);
|
|
166512
|
-
}
|
|
166513
|
-
|
|
166514
|
-
// socket.once('close', function(e) {
|
|
166515
|
-
// console.log('socket closed!', e);
|
|
166516
|
-
// })
|
|
166517
|
-
|
|
166518
|
-
if (!socket.on_socket_end) {
|
|
166519
|
-
socket.on_socket_end = on_socket_end;
|
|
166520
|
-
socket.once('end', function() { process.nextTick(on_socket_end.bind(socket)) });
|
|
166521
|
-
}
|
|
166522
|
-
})
|
|
166523
|
-
|
|
166524
|
-
if (post_data) {
|
|
166525
|
-
if (is_stream(post_data)) {
|
|
166526
|
-
pump_streams([post_data, request], function(err) {
|
|
166527
|
-
if (err) debug(err);
|
|
166528
|
-
});
|
|
166529
|
-
} else {
|
|
166530
|
-
request.write(post_data, config.encoding);
|
|
166531
|
-
request.end();
|
|
166532
|
-
}
|
|
166533
|
-
} else {
|
|
166534
|
-
request.end();
|
|
166535
|
-
}
|
|
166536
|
-
|
|
166537
|
-
out.abort = function() { request.abort() }; // easier access
|
|
166538
|
-
out.request = request;
|
|
166539
|
-
return out;
|
|
166540
|
-
}
|
|
166541
|
-
|
|
166542
|
-
//////////////////////////////////////////
|
|
166543
|
-
// exports
|
|
166544
|
-
|
|
166545
|
-
if (typeof Promise !== 'undefined') {
|
|
166546
|
-
module.exports = function() {
|
|
166547
|
-
var verb, args = [].slice.call(arguments);
|
|
166548
|
-
|
|
166549
|
-
if (args[0].match(/\.|\//)) // first argument looks like a URL
|
|
166550
|
-
verb = (args.length > 2) ? 'post' : 'get';
|
|
166551
|
-
else
|
|
166552
|
-
verb = args.shift();
|
|
166553
|
-
|
|
166554
|
-
if (verb.match(/get|head/i) && args.length == 2)
|
|
166555
|
-
args.splice(1, 0, null); // assume no data if head/get with two args (url, options)
|
|
166556
|
-
|
|
166557
|
-
return new Promise(function(resolve, reject) {
|
|
166558
|
-
module.exports.request(verb, args[0], args[1], args[2], function(err, resp) {
|
|
166559
|
-
return err ? reject(err) : resolve(resp);
|
|
166560
|
-
});
|
|
166561
|
-
})
|
|
166562
|
-
}
|
|
166563
|
-
}
|
|
166564
|
-
|
|
166565
|
-
module.exports.version = version;
|
|
166566
|
-
|
|
166567
|
-
module.exports.defaults = function(obj) {
|
|
166568
|
-
for (var key in obj) {
|
|
166569
|
-
var target_key = aliased.options[key] || key;
|
|
166570
|
-
|
|
166571
|
-
if (defaults.hasOwnProperty(target_key) && typeof obj[key] != 'undefined') {
|
|
166572
|
-
if (target_key != 'parse_response' && target_key != 'proxy') {
|
|
166573
|
-
// ensure type matches the original, except for proxy/parse_response that can be null/bool or string
|
|
166574
|
-
var valid_type = defaults[target_key].constructor.name;
|
|
166575
|
-
|
|
166576
|
-
if (obj[key].constructor.name != valid_type)
|
|
166577
|
-
throw new TypeError('Invalid type for ' + key + ', should be ' + valid_type);
|
|
166578
|
-
}
|
|
166579
|
-
defaults[target_key] = obj[key];
|
|
166580
|
-
} else {
|
|
166581
|
-
throw new Error('Invalid property for defaults:' + target_key);
|
|
166582
|
-
}
|
|
166583
|
-
}
|
|
166584
|
-
|
|
166585
|
-
return defaults;
|
|
166586
|
-
}
|
|
166587
|
-
|
|
166588
|
-
'head get'.split(' ').forEach(function(method) {
|
|
166589
|
-
module.exports[method] = function(uri, options, callback) {
|
|
166590
|
-
return new Needle(method, uri, null, options, callback).start();
|
|
166591
|
-
}
|
|
166592
|
-
})
|
|
166593
|
-
|
|
166594
|
-
'post put patch delete'.split(' ').forEach(function(method) {
|
|
166595
|
-
module.exports[method] = function(uri, data, options, callback) {
|
|
166596
|
-
return new Needle(method, uri, data, options, callback).start();
|
|
166597
|
-
}
|
|
166598
|
-
})
|
|
166599
|
-
|
|
166600
|
-
module.exports.request = function(method, uri, data, opts, callback) {
|
|
166601
|
-
return new Needle(method, uri, data, opts, callback).start();
|
|
166602
|
-
};
|
|
166603
|
-
|
|
166604
|
-
|
|
166605
|
-
/***/ }),
|
|
166606
|
-
|
|
166607
|
-
/***/ 87218:
|
|
166608
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
166609
|
-
|
|
166610
|
-
//////////////////////////////////////////
|
|
166611
|
-
// Defines mappings between content-type
|
|
166612
|
-
// and the appropriate parsers.
|
|
166613
|
-
//////////////////////////////////////////
|
|
166614
|
-
|
|
166615
|
-
var Transform = __webpack_require__(92413).Transform;
|
|
166616
|
-
var sax = __webpack_require__(36099);
|
|
166617
|
-
|
|
166618
|
-
function parseXML(str, cb) {
|
|
166619
|
-
var obj, current, parser = sax.parser(true, { trim: true, lowercase: true })
|
|
166620
|
-
parser.onerror = parser.onend = done;
|
|
166621
|
-
|
|
166622
|
-
function done(err) {
|
|
166623
|
-
parser.onerror = parser.onend = function() { }
|
|
166624
|
-
cb(err, obj)
|
|
166625
|
-
}
|
|
166626
|
-
|
|
166627
|
-
function newElement(name, attributes) {
|
|
166628
|
-
return {
|
|
166629
|
-
name: name || '',
|
|
166630
|
-
value: '',
|
|
166631
|
-
attributes: attributes || {},
|
|
166632
|
-
children: []
|
|
166633
|
-
}
|
|
166634
|
-
}
|
|
166635
|
-
|
|
166636
|
-
parser.oncdata = parser.ontext = function(t) {
|
|
166637
|
-
if (current) current.value += t
|
|
166638
|
-
}
|
|
166639
|
-
|
|
166640
|
-
parser.onopentag = function(node) {
|
|
166641
|
-
var element = newElement(node.name, node.attributes)
|
|
166642
|
-
if (current) {
|
|
166643
|
-
element.parent = current
|
|
166644
|
-
current.children.push(element)
|
|
166645
|
-
} else { // root object
|
|
166646
|
-
obj = element
|
|
166647
|
-
}
|
|
166648
|
-
|
|
166649
|
-
current = element
|
|
166650
|
-
};
|
|
166651
|
-
|
|
166652
|
-
parser.onclosetag = function() {
|
|
166653
|
-
if (typeof current.parent !== 'undefined') {
|
|
166654
|
-
var just_closed = current
|
|
166655
|
-
current = current.parent
|
|
166656
|
-
delete just_closed.parent
|
|
166657
|
-
}
|
|
166658
|
-
}
|
|
166659
|
-
|
|
166660
|
-
parser.write(str).close()
|
|
166661
|
-
}
|
|
166662
|
-
|
|
166663
|
-
function parserFactory(name, fn) {
|
|
166664
|
-
|
|
166665
|
-
function parser() {
|
|
166666
|
-
var chunks = [],
|
|
166667
|
-
stream = new Transform({ objectMode: true });
|
|
166668
|
-
|
|
166669
|
-
// Buffer all our data
|
|
166670
|
-
stream._transform = function(chunk, encoding, done) {
|
|
166671
|
-
chunks.push(chunk);
|
|
166672
|
-
done();
|
|
166673
|
-
}
|
|
166674
|
-
|
|
166675
|
-
// And call the parser when all is there.
|
|
166676
|
-
stream._flush = function(done) {
|
|
166677
|
-
var self = this,
|
|
166678
|
-
data = Buffer.concat(chunks);
|
|
166679
|
-
|
|
166680
|
-
try {
|
|
166681
|
-
fn(data, function(err, result) {
|
|
166682
|
-
if (err) throw err;
|
|
166683
|
-
self.push(result);
|
|
166684
|
-
});
|
|
166685
|
-
} catch (err) {
|
|
166686
|
-
self.push(data); // just pass the original data
|
|
166687
|
-
} finally {
|
|
166688
|
-
done();
|
|
166689
|
-
}
|
|
166690
|
-
}
|
|
166691
|
-
|
|
166692
|
-
return stream;
|
|
166693
|
-
}
|
|
166694
|
-
|
|
166695
|
-
return { fn: parser, name: name };
|
|
166696
|
-
}
|
|
166697
|
-
|
|
166698
|
-
var parsers = {}
|
|
166699
|
-
|
|
166700
|
-
function buildParser(name, types, fn) {
|
|
166701
|
-
var parser = parserFactory(name, fn);
|
|
166702
|
-
types.forEach(function(type) {
|
|
166703
|
-
parsers[type] = parser;
|
|
166704
|
-
})
|
|
166705
|
-
}
|
|
166706
|
-
|
|
166707
|
-
buildParser('json', [
|
|
166708
|
-
'application/json',
|
|
166709
|
-
'text/javascript',
|
|
166710
|
-
'application/vnd.api+json'
|
|
166711
|
-
], function(buffer, cb) {
|
|
166712
|
-
var err, data;
|
|
166713
|
-
try { data = JSON.parse(buffer); } catch (e) { err = e; }
|
|
166714
|
-
cb(err, data);
|
|
166715
|
-
});
|
|
166716
|
-
|
|
166717
|
-
buildParser('xml', [
|
|
166718
|
-
'text/xml',
|
|
166719
|
-
'application/xml',
|
|
166720
|
-
'application/rdf+xml',
|
|
166721
|
-
'application/rss+xml',
|
|
166722
|
-
'application/atom+xml'
|
|
166723
|
-
], function(buffer, cb) {
|
|
166724
|
-
parseXML(buffer.toString(), function(err, obj) {
|
|
166725
|
-
cb(err, obj)
|
|
166726
|
-
})
|
|
166727
|
-
});
|
|
166728
|
-
|
|
166729
|
-
module.exports = parsers;
|
|
166730
|
-
module.exports.use = buildParser;
|
|
166731
|
-
|
|
166732
|
-
|
|
166733
|
-
/***/ }),
|
|
166734
|
-
|
|
166735
|
-
/***/ 60315:
|
|
166736
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
166737
|
-
|
|
166738
|
-
// based on the qs module, but handles null objects as expected
|
|
166739
|
-
// fixes by Tomas Pollak.
|
|
166740
|
-
|
|
166741
|
-
var toString = Object.prototype.toString;
|
|
166742
|
-
|
|
166743
|
-
function stringify(obj, prefix) {
|
|
166744
|
-
if (prefix && (obj === null || typeof obj == 'undefined')) {
|
|
166745
|
-
return prefix + '=';
|
|
166746
|
-
} else if (toString.call(obj) == '[object Array]') {
|
|
166747
|
-
return stringifyArray(obj, prefix);
|
|
166748
|
-
} else if (toString.call(obj) == '[object Object]') {
|
|
166749
|
-
return stringifyObject(obj, prefix);
|
|
166750
|
-
} else if (toString.call(obj) == '[object Date]') {
|
|
166751
|
-
return obj.toISOString();
|
|
166752
|
-
} else if (prefix) { // string inside array or hash
|
|
166753
|
-
return prefix + '=' + encodeURIComponent(String(obj));
|
|
166754
|
-
} else if (String(obj).indexOf('=') !== -1) { // string with equal sign
|
|
166755
|
-
return String(obj);
|
|
166756
|
-
} else {
|
|
166757
|
-
throw new TypeError('Cannot build a querystring out of: ' + obj);
|
|
166758
|
-
}
|
|
166759
|
-
};
|
|
166760
|
-
|
|
166761
|
-
function stringifyArray(arr, prefix) {
|
|
166762
|
-
var ret = [];
|
|
166763
|
-
|
|
166764
|
-
for (var i = 0, len = arr.length; i < len; i++) {
|
|
166765
|
-
if (prefix)
|
|
166766
|
-
ret.push(stringify(arr[i], prefix + '[]'));
|
|
166767
|
-
else
|
|
166768
|
-
ret.push(stringify(arr[i]));
|
|
166769
|
-
}
|
|
166770
|
-
|
|
166771
|
-
return ret.join('&');
|
|
166772
|
-
}
|
|
166773
|
-
|
|
166774
|
-
function stringifyObject(obj, prefix) {
|
|
166775
|
-
var ret = [];
|
|
166776
|
-
|
|
166777
|
-
Object.keys(obj).forEach(function(key) {
|
|
166778
|
-
ret.push(stringify(obj[key], prefix
|
|
166779
|
-
? prefix + '[' + encodeURIComponent(key) + ']'
|
|
166780
|
-
: encodeURIComponent(key)));
|
|
166781
|
-
})
|
|
166782
|
-
|
|
166783
|
-
return ret.join('&');
|
|
166784
|
-
}
|
|
166785
|
-
|
|
166786
|
-
exports.J = stringify;
|
|
166787
|
-
|
|
166788
|
-
|
|
166789
|
-
/***/ }),
|
|
166790
|
-
|
|
166791
|
-
/***/ 15704:
|
|
166792
|
-
/***/ ((module, exports, __webpack_require__) => {
|
|
166793
|
-
|
|
166794
|
-
"use strict";
|
|
166795
|
-
|
|
166796
|
-
|
|
166797
|
-
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
166798
|
-
|
|
166799
|
-
/* eslint-env browser */
|
|
166800
|
-
|
|
166801
|
-
/**
|
|
166802
|
-
* This is the web browser implementation of `debug()`.
|
|
166803
|
-
*/
|
|
166804
|
-
exports.log = log;
|
|
166805
|
-
exports.formatArgs = formatArgs;
|
|
166806
|
-
exports.save = save;
|
|
166807
|
-
exports.load = load;
|
|
166808
|
-
exports.useColors = useColors;
|
|
166809
|
-
exports.storage = localstorage();
|
|
166810
|
-
/**
|
|
166811
|
-
* Colors.
|
|
166812
|
-
*/
|
|
166813
|
-
|
|
166814
|
-
exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
|
|
166815
|
-
/**
|
|
166816
|
-
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
166817
|
-
* and the Firebug extension (any Firefox version) are known
|
|
166818
|
-
* to support "%c" CSS customizations.
|
|
166819
|
-
*
|
|
166820
|
-
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
166821
|
-
*/
|
|
166822
|
-
// eslint-disable-next-line complexity
|
|
166823
|
-
|
|
166824
|
-
function useColors() {
|
|
166825
|
-
// NB: In an Electron preload script, document will be defined but not fully
|
|
166826
|
-
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
166827
|
-
// explicitly
|
|
166828
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
166829
|
-
return true;
|
|
166830
|
-
} // Internet Explorer and Edge do not support colors.
|
|
166831
|
-
|
|
166832
|
-
|
|
166833
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
166834
|
-
return false;
|
|
166835
|
-
} // Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
166836
|
-
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
166837
|
-
|
|
166838
|
-
|
|
166839
|
-
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
166840
|
-
typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
166841
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
166842
|
-
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
166843
|
-
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
166844
|
-
}
|
|
166845
|
-
/**
|
|
166846
|
-
* Colorize log arguments if enabled.
|
|
166847
|
-
*
|
|
166848
|
-
* @api public
|
|
166849
|
-
*/
|
|
166850
|
-
|
|
166851
|
-
|
|
166852
|
-
function formatArgs(args) {
|
|
166853
|
-
args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
|
166854
|
-
|
|
166855
|
-
if (!this.useColors) {
|
|
166856
|
-
return;
|
|
166857
|
-
}
|
|
166858
|
-
|
|
166859
|
-
var c = 'color: ' + this.color;
|
|
166860
|
-
args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
|
|
166861
|
-
// arguments passed either before or after the %c, so we need to
|
|
166862
|
-
// figure out the correct index to insert the CSS into
|
|
166863
|
-
|
|
166864
|
-
var index = 0;
|
|
166865
|
-
var lastC = 0;
|
|
166866
|
-
args[0].replace(/%[a-zA-Z%]/g, function (match) {
|
|
166867
|
-
if (match === '%%') {
|
|
166868
|
-
return;
|
|
166869
|
-
}
|
|
166870
|
-
|
|
166871
|
-
index++;
|
|
166872
|
-
|
|
166873
|
-
if (match === '%c') {
|
|
166874
|
-
// We only are interested in the *last* %c
|
|
166875
|
-
// (the user may have provided their own)
|
|
166876
|
-
lastC = index;
|
|
166877
|
-
}
|
|
166878
|
-
});
|
|
166879
|
-
args.splice(lastC, 0, c);
|
|
166880
|
-
}
|
|
166881
|
-
/**
|
|
166882
|
-
* Invokes `console.log()` when available.
|
|
166883
|
-
* No-op when `console.log` is not a "function".
|
|
166884
|
-
*
|
|
166885
|
-
* @api public
|
|
166886
|
-
*/
|
|
166887
|
-
|
|
166888
|
-
|
|
166889
|
-
function log() {
|
|
166890
|
-
var _console;
|
|
166891
|
-
|
|
166892
|
-
// This hackery is required for IE8/9, where
|
|
166893
|
-
// the `console.log` function doesn't have 'apply'
|
|
166894
|
-
return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
|
|
166895
|
-
}
|
|
166896
|
-
/**
|
|
166897
|
-
* Save `namespaces`.
|
|
166898
|
-
*
|
|
166899
|
-
* @param {String} namespaces
|
|
166900
|
-
* @api private
|
|
166901
|
-
*/
|
|
166902
|
-
|
|
166903
|
-
|
|
166904
|
-
function save(namespaces) {
|
|
166905
|
-
try {
|
|
166906
|
-
if (namespaces) {
|
|
166907
|
-
exports.storage.setItem('debug', namespaces);
|
|
166908
|
-
} else {
|
|
166909
|
-
exports.storage.removeItem('debug');
|
|
166910
|
-
}
|
|
166911
|
-
} catch (error) {// Swallow
|
|
166912
|
-
// XXX (@Qix-) should we be logging these?
|
|
166913
|
-
}
|
|
166914
|
-
}
|
|
166915
|
-
/**
|
|
166916
|
-
* Load `namespaces`.
|
|
166917
|
-
*
|
|
166918
|
-
* @return {String} returns the previously persisted debug modes
|
|
166919
|
-
* @api private
|
|
166920
|
-
*/
|
|
166921
|
-
|
|
166922
|
-
|
|
166923
|
-
function load() {
|
|
166924
|
-
var r;
|
|
166925
|
-
|
|
166926
|
-
try {
|
|
166927
|
-
r = exports.storage.getItem('debug');
|
|
166928
|
-
} catch (error) {} // Swallow
|
|
166929
|
-
// XXX (@Qix-) should we be logging these?
|
|
166930
|
-
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
166931
|
-
|
|
166932
|
-
|
|
166933
|
-
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
166934
|
-
r = process.env.DEBUG;
|
|
166935
|
-
}
|
|
166936
|
-
|
|
166937
|
-
return r;
|
|
166938
|
-
}
|
|
166939
|
-
/**
|
|
166940
|
-
* Localstorage attempts to return the localstorage.
|
|
166941
|
-
*
|
|
166942
|
-
* This is necessary because safari throws
|
|
166943
|
-
* when a user disables cookies/localstorage
|
|
166944
|
-
* and you attempt to access it.
|
|
166945
|
-
*
|
|
166946
|
-
* @return {LocalStorage}
|
|
166947
|
-
* @api private
|
|
166948
|
-
*/
|
|
166949
|
-
|
|
166950
|
-
|
|
166951
|
-
function localstorage() {
|
|
166952
|
-
try {
|
|
166953
|
-
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
166954
|
-
// The Browser also has localStorage in the global context.
|
|
166955
|
-
return localStorage;
|
|
166956
|
-
} catch (error) {// Swallow
|
|
166957
|
-
// XXX (@Qix-) should we be logging these?
|
|
166958
|
-
}
|
|
166959
|
-
}
|
|
166960
|
-
|
|
166961
|
-
module.exports = __webpack_require__(40283)(exports);
|
|
166962
|
-
var formatters = module.exports.formatters;
|
|
166963
|
-
/**
|
|
166964
|
-
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
166965
|
-
*/
|
|
166966
|
-
|
|
166967
|
-
formatters.j = function (v) {
|
|
166968
|
-
try {
|
|
166969
|
-
return JSON.stringify(v);
|
|
166970
|
-
} catch (error) {
|
|
166971
|
-
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
166972
|
-
}
|
|
166973
|
-
};
|
|
166974
|
-
|
|
166975
|
-
|
|
166976
|
-
|
|
166977
|
-
/***/ }),
|
|
166978
|
-
|
|
166979
|
-
/***/ 40283:
|
|
166980
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
166981
|
-
|
|
166982
|
-
"use strict";
|
|
166983
|
-
|
|
166984
|
-
|
|
166985
|
-
/**
|
|
166986
|
-
* This is the common logic for both the Node.js and web browser
|
|
166987
|
-
* implementations of `debug()`.
|
|
166988
|
-
*/
|
|
166989
|
-
function setup(env) {
|
|
166990
|
-
createDebug.debug = createDebug;
|
|
166991
|
-
createDebug.default = createDebug;
|
|
166992
|
-
createDebug.coerce = coerce;
|
|
166993
|
-
createDebug.disable = disable;
|
|
166994
|
-
createDebug.enable = enable;
|
|
166995
|
-
createDebug.enabled = enabled;
|
|
166996
|
-
createDebug.humanize = __webpack_require__(57824);
|
|
166997
|
-
Object.keys(env).forEach(function (key) {
|
|
166998
|
-
createDebug[key] = env[key];
|
|
166999
|
-
});
|
|
167000
|
-
/**
|
|
167001
|
-
* Active `debug` instances.
|
|
167002
|
-
*/
|
|
167003
|
-
|
|
167004
|
-
createDebug.instances = [];
|
|
167005
|
-
/**
|
|
167006
|
-
* The currently active debug mode names, and names to skip.
|
|
167007
|
-
*/
|
|
167008
|
-
|
|
167009
|
-
createDebug.names = [];
|
|
167010
|
-
createDebug.skips = [];
|
|
167011
|
-
/**
|
|
167012
|
-
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
167013
|
-
*
|
|
167014
|
-
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
167015
|
-
*/
|
|
167016
|
-
|
|
167017
|
-
createDebug.formatters = {};
|
|
167018
|
-
/**
|
|
167019
|
-
* Selects a color for a debug namespace
|
|
167020
|
-
* @param {String} namespace The namespace string for the for the debug instance to be colored
|
|
167021
|
-
* @return {Number|String} An ANSI color code for the given namespace
|
|
167022
|
-
* @api private
|
|
167023
|
-
*/
|
|
167024
|
-
|
|
167025
|
-
function selectColor(namespace) {
|
|
167026
|
-
var hash = 0;
|
|
167027
|
-
|
|
167028
|
-
for (var i = 0; i < namespace.length; i++) {
|
|
167029
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
167030
|
-
hash |= 0; // Convert to 32bit integer
|
|
167031
|
-
}
|
|
167032
|
-
|
|
167033
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
167034
|
-
}
|
|
167035
|
-
|
|
167036
|
-
createDebug.selectColor = selectColor;
|
|
167037
|
-
/**
|
|
167038
|
-
* Create a debugger with the given `namespace`.
|
|
167039
|
-
*
|
|
167040
|
-
* @param {String} namespace
|
|
167041
|
-
* @return {Function}
|
|
167042
|
-
* @api public
|
|
167043
|
-
*/
|
|
167044
|
-
|
|
167045
|
-
function createDebug(namespace) {
|
|
167046
|
-
var prevTime;
|
|
167047
|
-
|
|
167048
|
-
function debug() {
|
|
167049
|
-
// Disabled?
|
|
167050
|
-
if (!debug.enabled) {
|
|
167051
|
-
return;
|
|
167052
|
-
}
|
|
167053
|
-
|
|
167054
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
167055
|
-
args[_key] = arguments[_key];
|
|
167056
|
-
}
|
|
167057
|
-
|
|
167058
|
-
var self = debug; // Set `diff` timestamp
|
|
167059
|
-
|
|
167060
|
-
var curr = Number(new Date());
|
|
167061
|
-
var ms = curr - (prevTime || curr);
|
|
167062
|
-
self.diff = ms;
|
|
167063
|
-
self.prev = prevTime;
|
|
167064
|
-
self.curr = curr;
|
|
167065
|
-
prevTime = curr;
|
|
167066
|
-
args[0] = createDebug.coerce(args[0]);
|
|
167067
|
-
|
|
167068
|
-
if (typeof args[0] !== 'string') {
|
|
167069
|
-
// Anything else let's inspect with %O
|
|
167070
|
-
args.unshift('%O');
|
|
167071
|
-
} // Apply any `formatters` transformations
|
|
167072
|
-
|
|
167073
|
-
|
|
167074
|
-
var index = 0;
|
|
167075
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
|
|
167076
|
-
// If we encounter an escaped % then don't increase the array index
|
|
167077
|
-
if (match === '%%') {
|
|
167078
|
-
return match;
|
|
167079
|
-
}
|
|
167080
|
-
|
|
167081
|
-
index++;
|
|
167082
|
-
var formatter = createDebug.formatters[format];
|
|
167083
|
-
|
|
167084
|
-
if (typeof formatter === 'function') {
|
|
167085
|
-
var val = args[index];
|
|
167086
|
-
match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
|
|
167087
|
-
|
|
167088
|
-
args.splice(index, 1);
|
|
167089
|
-
index--;
|
|
167090
|
-
}
|
|
167091
|
-
|
|
167092
|
-
return match;
|
|
167093
|
-
}); // Apply env-specific formatting (colors, etc.)
|
|
167094
|
-
|
|
167095
|
-
createDebug.formatArgs.call(self, args);
|
|
167096
|
-
var logFn = self.log || createDebug.log;
|
|
167097
|
-
logFn.apply(self, args);
|
|
167098
|
-
}
|
|
167099
|
-
|
|
167100
|
-
debug.namespace = namespace;
|
|
167101
|
-
debug.enabled = createDebug.enabled(namespace);
|
|
167102
|
-
debug.useColors = createDebug.useColors();
|
|
167103
|
-
debug.color = selectColor(namespace);
|
|
167104
|
-
debug.destroy = destroy;
|
|
167105
|
-
debug.extend = extend; // Debug.formatArgs = formatArgs;
|
|
167106
|
-
// debug.rawLog = rawLog;
|
|
167107
|
-
// env-specific initialization logic for debug instances
|
|
167108
|
-
|
|
167109
|
-
if (typeof createDebug.init === 'function') {
|
|
167110
|
-
createDebug.init(debug);
|
|
167111
|
-
}
|
|
167112
|
-
|
|
167113
|
-
createDebug.instances.push(debug);
|
|
167114
|
-
return debug;
|
|
167115
|
-
}
|
|
167116
|
-
|
|
167117
|
-
function destroy() {
|
|
167118
|
-
var index = createDebug.instances.indexOf(this);
|
|
167119
|
-
|
|
167120
|
-
if (index !== -1) {
|
|
167121
|
-
createDebug.instances.splice(index, 1);
|
|
167122
|
-
return true;
|
|
167123
|
-
}
|
|
167124
|
-
|
|
167125
|
-
return false;
|
|
167126
|
-
}
|
|
167127
|
-
|
|
167128
|
-
function extend(namespace, delimiter) {
|
|
167129
|
-
return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
167130
|
-
}
|
|
167131
|
-
/**
|
|
167132
|
-
* Enables a debug mode by namespaces. This can include modes
|
|
167133
|
-
* separated by a colon and wildcards.
|
|
167134
|
-
*
|
|
167135
|
-
* @param {String} namespaces
|
|
167136
|
-
* @api public
|
|
167137
|
-
*/
|
|
167138
|
-
|
|
167139
|
-
|
|
167140
|
-
function enable(namespaces) {
|
|
167141
|
-
createDebug.save(namespaces);
|
|
167142
|
-
createDebug.names = [];
|
|
167143
|
-
createDebug.skips = [];
|
|
167144
|
-
var i;
|
|
167145
|
-
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
167146
|
-
var len = split.length;
|
|
167147
|
-
|
|
167148
|
-
for (i = 0; i < len; i++) {
|
|
167149
|
-
if (!split[i]) {
|
|
167150
|
-
// ignore empty strings
|
|
167151
|
-
continue;
|
|
167152
|
-
}
|
|
167153
|
-
|
|
167154
|
-
namespaces = split[i].replace(/\*/g, '.*?');
|
|
167155
|
-
|
|
167156
|
-
if (namespaces[0] === '-') {
|
|
167157
|
-
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
|
167158
|
-
} else {
|
|
167159
|
-
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
167160
|
-
}
|
|
167161
|
-
}
|
|
167162
|
-
|
|
167163
|
-
for (i = 0; i < createDebug.instances.length; i++) {
|
|
167164
|
-
var instance = createDebug.instances[i];
|
|
167165
|
-
instance.enabled = createDebug.enabled(instance.namespace);
|
|
167166
|
-
}
|
|
167167
|
-
}
|
|
167168
|
-
/**
|
|
167169
|
-
* Disable debug output.
|
|
167170
|
-
*
|
|
167171
|
-
* @api public
|
|
167172
|
-
*/
|
|
167173
|
-
|
|
167174
|
-
|
|
167175
|
-
function disable() {
|
|
167176
|
-
createDebug.enable('');
|
|
167177
|
-
}
|
|
167178
|
-
/**
|
|
167179
|
-
* Returns true if the given mode name is enabled, false otherwise.
|
|
167180
|
-
*
|
|
167181
|
-
* @param {String} name
|
|
167182
|
-
* @return {Boolean}
|
|
167183
|
-
* @api public
|
|
167184
|
-
*/
|
|
167185
|
-
|
|
167186
|
-
|
|
167187
|
-
function enabled(name) {
|
|
167188
|
-
if (name[name.length - 1] === '*') {
|
|
167189
|
-
return true;
|
|
167190
|
-
}
|
|
167191
|
-
|
|
167192
|
-
var i;
|
|
167193
|
-
var len;
|
|
167194
|
-
|
|
167195
|
-
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
167196
|
-
if (createDebug.skips[i].test(name)) {
|
|
167197
|
-
return false;
|
|
167198
|
-
}
|
|
167199
|
-
}
|
|
167200
|
-
|
|
167201
|
-
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
167202
|
-
if (createDebug.names[i].test(name)) {
|
|
167203
|
-
return true;
|
|
167204
|
-
}
|
|
167205
|
-
}
|
|
167206
|
-
|
|
167207
|
-
return false;
|
|
167208
|
-
}
|
|
167209
|
-
/**
|
|
167210
|
-
* Coerce `val`.
|
|
167211
|
-
*
|
|
167212
|
-
* @param {Mixed} val
|
|
167213
|
-
* @return {Mixed}
|
|
167214
|
-
* @api private
|
|
167215
|
-
*/
|
|
167216
|
-
|
|
167217
|
-
|
|
167218
|
-
function coerce(val) {
|
|
167219
|
-
if (val instanceof Error) {
|
|
167220
|
-
return val.stack || val.message;
|
|
164976
|
+
return str.slice(str.indexOf('"') + 1, str.lastIndexOf('"'));
|
|
164977
|
+
}
|
|
164978
|
+
function getConstraint(str) {
|
|
164979
|
+
const index = str.indexOf('selected from constraint');
|
|
164980
|
+
if (index === -1) {
|
|
164981
|
+
return null;
|
|
167221
164982
|
}
|
|
167222
|
-
|
|
167223
|
-
return val;
|
|
167224
|
-
}
|
|
167225
|
-
|
|
167226
|
-
createDebug.enable(createDebug.load());
|
|
167227
|
-
return createDebug;
|
|
164983
|
+
return str.slice(index + 25, str.lastIndexOf(')'));
|
|
167228
164984
|
}
|
|
167229
|
-
|
|
167230
|
-
module.exports = setup;
|
|
167231
|
-
|
|
167232
|
-
|
|
164985
|
+
//# sourceMappingURL=parse-mvn.js.map
|
|
167233
164986
|
|
|
167234
164987
|
/***/ }),
|
|
167235
164988
|
|
|
167236
|
-
/***/
|
|
167237
|
-
/***/ ((
|
|
164989
|
+
/***/ 8074:
|
|
164990
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
167238
164991
|
|
|
167239
164992
|
"use strict";
|
|
167240
164993
|
|
|
167241
|
-
|
|
167242
|
-
|
|
167243
|
-
|
|
167244
|
-
|
|
167245
|
-
|
|
167246
|
-
|
|
167247
|
-
|
|
167248
|
-
|
|
167249
|
-
|
|
164994
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
164995
|
+
exports.buildDepGraph = void 0;
|
|
164996
|
+
const dep_graph_1 = __webpack_require__(71479);
|
|
164997
|
+
const dependency_1 = __webpack_require__(20448);
|
|
164998
|
+
function buildDepGraph(mavenGraph) {
|
|
164999
|
+
const { rootId, nodes } = mavenGraph;
|
|
165000
|
+
const root = getPkgInfo(rootId);
|
|
165001
|
+
const builder = new dep_graph_1.DepGraphBuilder({ name: 'maven' }, root);
|
|
165002
|
+
const visited = [];
|
|
165003
|
+
const queue = [];
|
|
165004
|
+
queue.push(...getItems(rootId, nodes[rootId]));
|
|
165005
|
+
// breadth first search
|
|
165006
|
+
while (queue.length > 0) {
|
|
165007
|
+
const item = queue.shift();
|
|
165008
|
+
if (!item)
|
|
165009
|
+
continue;
|
|
165010
|
+
const { id, parentId } = item;
|
|
165011
|
+
const pkgInfo = getPkgInfo(id);
|
|
165012
|
+
if (visited.includes(id)) {
|
|
165013
|
+
const prunedId = id + ':pruned';
|
|
165014
|
+
builder.addPkgNode(pkgInfo, prunedId, { labels: { pruned: 'true' } });
|
|
165015
|
+
builder.connectDep(parentId, prunedId);
|
|
165016
|
+
continue; // don't queue any more children
|
|
165017
|
+
}
|
|
165018
|
+
const parentNodeId = parentId === rootId ? builder.rootNodeId : parentId;
|
|
165019
|
+
builder.addPkgNode(pkgInfo, id);
|
|
165020
|
+
builder.connectDep(parentNodeId, id);
|
|
165021
|
+
queue.push(...getItems(id, nodes[id]));
|
|
165022
|
+
visited.push(id);
|
|
165023
|
+
}
|
|
165024
|
+
return builder.build();
|
|
167250
165025
|
}
|
|
167251
|
-
|
|
167252
|
-
|
|
165026
|
+
exports.buildDepGraph = buildDepGraph;
|
|
165027
|
+
function getItems(parentId, node) {
|
|
165028
|
+
const items = [];
|
|
165029
|
+
for (const id of (node === null || node === void 0 ? void 0 : node.dependsOn) || []) {
|
|
165030
|
+
items.push({ id, parentId });
|
|
165031
|
+
}
|
|
165032
|
+
return items;
|
|
165033
|
+
}
|
|
165034
|
+
function getPkgInfo(value) {
|
|
165035
|
+
const { groupId, artifactId, version } = (0, dependency_1.parseDependency)(value);
|
|
165036
|
+
return {
|
|
165037
|
+
name: `${groupId}:${artifactId}`,
|
|
165038
|
+
version,
|
|
165039
|
+
};
|
|
165040
|
+
}
|
|
165041
|
+
//# sourceMappingURL=dep-graph.js.map
|
|
167253
165042
|
|
|
167254
165043
|
/***/ }),
|
|
167255
165044
|
|
|
167256
|
-
/***/
|
|
167257
|
-
/***/ ((
|
|
165045
|
+
/***/ 20448:
|
|
165046
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
167258
165047
|
|
|
167259
165048
|
"use strict";
|
|
167260
165049
|
|
|
165050
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165051
|
+
exports.parseDependency = void 0;
|
|
165052
|
+
const UNKNOWN = 'unknown';
|
|
165053
|
+
const unknownDependency = {
|
|
165054
|
+
groupId: UNKNOWN,
|
|
165055
|
+
artifactId: UNKNOWN,
|
|
165056
|
+
type: UNKNOWN,
|
|
165057
|
+
version: UNKNOWN,
|
|
165058
|
+
};
|
|
165059
|
+
function parseDependency(value) {
|
|
165060
|
+
if (typeof value !== 'string')
|
|
165061
|
+
return unknownDependency;
|
|
165062
|
+
const parts = value.split(':');
|
|
165063
|
+
switch (parts.length) {
|
|
165064
|
+
// using classifier and scope
|
|
165065
|
+
// "com.example:my-app:jar:jdk8:1.2.3:compile"
|
|
165066
|
+
case 6: {
|
|
165067
|
+
return {
|
|
165068
|
+
groupId: getPart(parts, 0),
|
|
165069
|
+
artifactId: getPart(parts, 1),
|
|
165070
|
+
type: getPart(parts, 2),
|
|
165071
|
+
classifier: getPart(parts, 3),
|
|
165072
|
+
version: getPart(parts, 4),
|
|
165073
|
+
scope: getPart(parts, 5),
|
|
165074
|
+
};
|
|
165075
|
+
}
|
|
165076
|
+
// using scope
|
|
165077
|
+
// "com.example:my-app:jar:1.2.3:compile"
|
|
165078
|
+
case 5: {
|
|
165079
|
+
return {
|
|
165080
|
+
groupId: getPart(parts, 0),
|
|
165081
|
+
artifactId: getPart(parts, 1),
|
|
165082
|
+
type: getPart(parts, 2),
|
|
165083
|
+
version: getPart(parts, 3),
|
|
165084
|
+
scope: getPart(parts, 4),
|
|
165085
|
+
};
|
|
165086
|
+
}
|
|
165087
|
+
// everything else
|
|
165088
|
+
// "com.example:my-app:jar:1.2.3"
|
|
165089
|
+
case 4: {
|
|
165090
|
+
return {
|
|
165091
|
+
groupId: getPart(parts, 0),
|
|
165092
|
+
artifactId: getPart(parts, 1),
|
|
165093
|
+
type: getPart(parts, 2),
|
|
165094
|
+
version: getPart(parts, 3),
|
|
165095
|
+
};
|
|
165096
|
+
}
|
|
165097
|
+
default: {
|
|
165098
|
+
return unknownDependency;
|
|
165099
|
+
}
|
|
165100
|
+
}
|
|
165101
|
+
}
|
|
165102
|
+
exports.parseDependency = parseDependency;
|
|
165103
|
+
function getPart(parts, index) {
|
|
165104
|
+
return parts[index] || UNKNOWN;
|
|
165105
|
+
}
|
|
165106
|
+
//# sourceMappingURL=dependency.js.map
|
|
167261
165107
|
|
|
167262
|
-
|
|
167263
|
-
* Module dependencies.
|
|
167264
|
-
*/
|
|
167265
|
-
var tty = __webpack_require__(33867);
|
|
167266
|
-
|
|
167267
|
-
var util = __webpack_require__(31669);
|
|
167268
|
-
/**
|
|
167269
|
-
* This is the Node.js implementation of `debug()`.
|
|
167270
|
-
*/
|
|
167271
|
-
|
|
165108
|
+
/***/ }),
|
|
167272
165109
|
|
|
167273
|
-
|
|
167274
|
-
exports
|
|
167275
|
-
exports.formatArgs = formatArgs;
|
|
167276
|
-
exports.save = save;
|
|
167277
|
-
exports.load = load;
|
|
167278
|
-
exports.useColors = useColors;
|
|
167279
|
-
/**
|
|
167280
|
-
* Colors.
|
|
167281
|
-
*/
|
|
165110
|
+
/***/ 2175:
|
|
165111
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
167282
165112
|
|
|
167283
|
-
|
|
165113
|
+
"use strict";
|
|
167284
165114
|
|
|
167285
|
-
|
|
167286
|
-
|
|
167287
|
-
|
|
167288
|
-
|
|
165115
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165116
|
+
exports.parseDigraphs = void 0;
|
|
165117
|
+
const maven_graph_builder_1 = __webpack_require__(68465);
|
|
165118
|
+
const newLine = /[\r\n]+/g;
|
|
165119
|
+
function parseDigraphs(digraphs) {
|
|
165120
|
+
const graphs = [];
|
|
165121
|
+
for (const digraph of digraphs) {
|
|
165122
|
+
const lines = digraph.split(newLine);
|
|
165123
|
+
const rootId = findQuotedContents(lines[0]);
|
|
165124
|
+
if (!rootId) {
|
|
165125
|
+
throw new Error(`Unexpected digraph could not find root node. Could not parse "${lines[0]}".`);
|
|
165126
|
+
}
|
|
165127
|
+
const builder = new maven_graph_builder_1.MavenGraphBuilder(rootId);
|
|
165128
|
+
for (let i = 1; i < lines.length - 1; i++) {
|
|
165129
|
+
const line = parseLine(lines[i]);
|
|
165130
|
+
if (!line) {
|
|
165131
|
+
throw new Error(`Unexpected digraph could not connect nodes. Could not parse "${lines[i]}".`);
|
|
165132
|
+
}
|
|
165133
|
+
builder.connect(line.from, line.to);
|
|
165134
|
+
}
|
|
165135
|
+
graphs.push(builder.graph);
|
|
165136
|
+
}
|
|
165137
|
+
return graphs;
|
|
165138
|
+
}
|
|
165139
|
+
exports.parseDigraphs = parseDigraphs;
|
|
165140
|
+
function parseLine(line) {
|
|
165141
|
+
if (!line)
|
|
165142
|
+
return null;
|
|
165143
|
+
const [left, right] = line.split('->');
|
|
165144
|
+
if (!left || !right)
|
|
165145
|
+
return null;
|
|
165146
|
+
const from = findQuotedContents(left);
|
|
165147
|
+
const to = findQuotedContents(right);
|
|
165148
|
+
if (!from || !to)
|
|
165149
|
+
return null;
|
|
165150
|
+
return { from, to };
|
|
165151
|
+
}
|
|
165152
|
+
function findQuotedContents(value) {
|
|
165153
|
+
if (!value)
|
|
165154
|
+
return null;
|
|
165155
|
+
const start = value.indexOf('"') + 1;
|
|
165156
|
+
const end = value.lastIndexOf('"');
|
|
165157
|
+
return value.substring(start, end);
|
|
165158
|
+
}
|
|
165159
|
+
//# sourceMappingURL=digraph.js.map
|
|
167289
165160
|
|
|
167290
|
-
|
|
167291
|
-
exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
|
|
167292
|
-
}
|
|
167293
|
-
} catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|
165161
|
+
/***/ }),
|
|
167294
165162
|
|
|
167295
|
-
|
|
167296
|
-
|
|
167297
|
-
*
|
|
167298
|
-
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
167299
|
-
*/
|
|
165163
|
+
/***/ 22891:
|
|
165164
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
167300
165165
|
|
|
165166
|
+
"use strict";
|
|
167301
165167
|
|
|
167302
|
-
exports
|
|
167303
|
-
|
|
167304
|
-
|
|
167305
|
-
|
|
167306
|
-
|
|
167307
|
-
|
|
167308
|
-
|
|
165168
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165169
|
+
exports.parse = void 0;
|
|
165170
|
+
const stdout_1 = __webpack_require__(16866);
|
|
165171
|
+
const digraph_1 = __webpack_require__(2175);
|
|
165172
|
+
const dep_graph_1 = __webpack_require__(8074);
|
|
165173
|
+
function parse(stdout) {
|
|
165174
|
+
const digraphs = (0, stdout_1.parseStdout)(stdout);
|
|
165175
|
+
const mavenGraphs = (0, digraph_1.parseDigraphs)(digraphs);
|
|
165176
|
+
const scannedProjects = [];
|
|
165177
|
+
for (const mavenGraph of mavenGraphs) {
|
|
165178
|
+
const depGraph = (0, dep_graph_1.buildDepGraph)(mavenGraph);
|
|
165179
|
+
scannedProjects.push({ depGraph });
|
|
165180
|
+
}
|
|
165181
|
+
return {
|
|
165182
|
+
scannedProjects,
|
|
165183
|
+
};
|
|
165184
|
+
}
|
|
165185
|
+
exports.parse = parse;
|
|
165186
|
+
//# sourceMappingURL=index.js.map
|
|
167309
165187
|
|
|
167310
|
-
|
|
165188
|
+
/***/ }),
|
|
167311
165189
|
|
|
167312
|
-
|
|
167313
|
-
|
|
167314
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
167315
|
-
val = false;
|
|
167316
|
-
} else if (val === 'null') {
|
|
167317
|
-
val = null;
|
|
167318
|
-
} else {
|
|
167319
|
-
val = Number(val);
|
|
167320
|
-
}
|
|
165190
|
+
/***/ 68465:
|
|
165191
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
167321
165192
|
|
|
167322
|
-
|
|
167323
|
-
return obj;
|
|
167324
|
-
}, {});
|
|
167325
|
-
/**
|
|
167326
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
167327
|
-
*/
|
|
165193
|
+
"use strict";
|
|
167328
165194
|
|
|
167329
|
-
|
|
167330
|
-
|
|
165195
|
+
var _MavenGraphBuilder_graph;
|
|
165196
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165197
|
+
exports.MavenGraphBuilder = void 0;
|
|
165198
|
+
const tslib_1 = __webpack_require__(90999);
|
|
165199
|
+
class MavenGraphBuilder {
|
|
165200
|
+
constructor(rootId) {
|
|
165201
|
+
_MavenGraphBuilder_graph.set(this, void 0);
|
|
165202
|
+
tslib_1.__classPrivateFieldSet(this, _MavenGraphBuilder_graph, {
|
|
165203
|
+
rootId,
|
|
165204
|
+
nodes: {
|
|
165205
|
+
[rootId]: { dependsOn: [] },
|
|
165206
|
+
},
|
|
165207
|
+
}, "f");
|
|
165208
|
+
}
|
|
165209
|
+
add(id) {
|
|
165210
|
+
if (!this.node(id)) {
|
|
165211
|
+
tslib_1.__classPrivateFieldGet(this, _MavenGraphBuilder_graph, "f").nodes[id] = { dependsOn: [] };
|
|
165212
|
+
}
|
|
165213
|
+
}
|
|
165214
|
+
node(id) {
|
|
165215
|
+
return tslib_1.__classPrivateFieldGet(this, _MavenGraphBuilder_graph, "f").nodes[id];
|
|
165216
|
+
}
|
|
165217
|
+
connect(parentId, id) {
|
|
165218
|
+
this.add(parentId);
|
|
165219
|
+
this.add(id);
|
|
165220
|
+
const node = this.node(parentId);
|
|
165221
|
+
if (!node)
|
|
165222
|
+
return;
|
|
165223
|
+
if (!node.dependsOn.includes(id)) {
|
|
165224
|
+
node.dependsOn.push(id);
|
|
165225
|
+
}
|
|
165226
|
+
}
|
|
165227
|
+
get graph() {
|
|
165228
|
+
return tslib_1.__classPrivateFieldGet(this, _MavenGraphBuilder_graph, "f");
|
|
165229
|
+
}
|
|
167331
165230
|
}
|
|
167332
|
-
|
|
167333
|
-
|
|
167334
|
-
|
|
167335
|
-
* @api public
|
|
167336
|
-
*/
|
|
167337
|
-
|
|
165231
|
+
exports.MavenGraphBuilder = MavenGraphBuilder;
|
|
165232
|
+
_MavenGraphBuilder_graph = new WeakMap();
|
|
165233
|
+
//# sourceMappingURL=maven-graph-builder.js.map
|
|
167338
165234
|
|
|
167339
|
-
|
|
167340
|
-
var name = this.namespace,
|
|
167341
|
-
useColors = this.useColors;
|
|
165235
|
+
/***/ }),
|
|
167342
165236
|
|
|
167343
|
-
|
|
167344
|
-
|
|
167345
|
-
var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c);
|
|
167346
|
-
var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m");
|
|
167347
|
-
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
167348
|
-
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
167349
|
-
} else {
|
|
167350
|
-
args[0] = getDate() + name + ' ' + args[0];
|
|
167351
|
-
}
|
|
167352
|
-
}
|
|
165237
|
+
/***/ 16866:
|
|
165238
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
167353
165239
|
|
|
167354
|
-
|
|
167355
|
-
if (exports.inspectOpts.hideDate) {
|
|
167356
|
-
return '';
|
|
167357
|
-
}
|
|
165240
|
+
"use strict";
|
|
167358
165241
|
|
|
167359
|
-
|
|
165242
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165243
|
+
exports.parseStdout = void 0;
|
|
165244
|
+
const logLabel = /^\[\w+\]\s*/gm;
|
|
165245
|
+
const digraph = /digraph([\s\S]*?)\}/g;
|
|
165246
|
+
const errorLabel = /^\[ERROR\]/gm;
|
|
165247
|
+
// Parse the output from 'mvn dependency:tree -DoutputType=dot'
|
|
165248
|
+
function parseStdout(stdout) {
|
|
165249
|
+
if (errorLabel.test(stdout)) {
|
|
165250
|
+
throw new Error('Maven output contains errors.');
|
|
165251
|
+
}
|
|
165252
|
+
const digraphs = stdout.replace(logLabel, '').match(digraph);
|
|
165253
|
+
if (!digraphs) {
|
|
165254
|
+
throw new Error('Cannot find any digraphs.');
|
|
165255
|
+
}
|
|
165256
|
+
return digraphs;
|
|
167360
165257
|
}
|
|
167361
|
-
|
|
167362
|
-
|
|
167363
|
-
*/
|
|
165258
|
+
exports.parseStdout = parseStdout;
|
|
165259
|
+
//# sourceMappingURL=stdout.js.map
|
|
167364
165260
|
|
|
165261
|
+
/***/ }),
|
|
167365
165262
|
|
|
167366
|
-
|
|
167367
|
-
|
|
167368
|
-
}
|
|
167369
|
-
/**
|
|
167370
|
-
* Save `namespaces`.
|
|
167371
|
-
*
|
|
167372
|
-
* @param {String} namespaces
|
|
167373
|
-
* @api private
|
|
167374
|
-
*/
|
|
165263
|
+
/***/ 18906:
|
|
165264
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
167375
165265
|
|
|
165266
|
+
"use strict";
|
|
167376
165267
|
|
|
167377
|
-
|
|
167378
|
-
|
|
167379
|
-
|
|
167380
|
-
|
|
167381
|
-
|
|
167382
|
-
|
|
167383
|
-
|
|
167384
|
-
|
|
165268
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165269
|
+
exports.getMavenPackageInfo = void 0;
|
|
165270
|
+
const tslib_1 = __webpack_require__(90999);
|
|
165271
|
+
const packageurl_js_1 = __webpack_require__(38382);
|
|
165272
|
+
const debugLib = __webpack_require__(15158);
|
|
165273
|
+
const path = __webpack_require__(85622);
|
|
165274
|
+
const debug = debugLib('snyk-mvn-plugin');
|
|
165275
|
+
const PACKAGE_SEARCH_TYPE = 'maven';
|
|
165276
|
+
const PACKAGE_SEARCH_ENDPOINT = '/packages';
|
|
165277
|
+
const PACKAGE_SEARCH_VERSION = '2022-09-21~beta';
|
|
165278
|
+
function getMavenPackageInfo(sha1, targetPath, snykHttpClient) {
|
|
165279
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
165280
|
+
const searchResults = yield searchMavenPackageByChecksum(sha1, targetPath, snykHttpClient);
|
|
165281
|
+
if (searchResults.length == 0) {
|
|
165282
|
+
return fallbackPackageInfo(sha1, targetPath);
|
|
165283
|
+
}
|
|
165284
|
+
let foundPackage;
|
|
165285
|
+
if (searchResults.length > 1) {
|
|
165286
|
+
const sha1Target = path.parse(targetPath).base;
|
|
165287
|
+
debug(`Got multiple results for ${sha1}, looking for ${sha1Target}`);
|
|
165288
|
+
foundPackage = searchResults.find((result) => sha1Target.includes(result.groupId));
|
|
165289
|
+
}
|
|
165290
|
+
return foundPackage || searchResults[0];
|
|
165291
|
+
});
|
|
167385
165292
|
}
|
|
167386
|
-
|
|
167387
|
-
|
|
167388
|
-
*
|
|
167389
|
-
|
|
167390
|
-
|
|
167391
|
-
|
|
167392
|
-
|
|
167393
|
-
|
|
167394
|
-
|
|
167395
|
-
|
|
165293
|
+
exports.getMavenPackageInfo = getMavenPackageInfo;
|
|
165294
|
+
function searchMavenPackageByChecksum(sha1, targetPath, snykHttpClient) {
|
|
165295
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
165296
|
+
const { res, body } = yield snykHttpClient({
|
|
165297
|
+
method: 'get',
|
|
165298
|
+
path: PACKAGE_SEARCH_ENDPOINT,
|
|
165299
|
+
qs: {
|
|
165300
|
+
version: PACKAGE_SEARCH_VERSION,
|
|
165301
|
+
package_type: PACKAGE_SEARCH_TYPE,
|
|
165302
|
+
package_sha1: sha1,
|
|
165303
|
+
},
|
|
165304
|
+
});
|
|
165305
|
+
if (!(res === null || res === void 0 ? void 0 : res.statusCode) || (res === null || res === void 0 ? void 0 : res.statusCode) >= 400 || !body) {
|
|
165306
|
+
debug(`Failed to resolve ${targetPath} using sha1 ${sha1}.`);
|
|
165307
|
+
return [];
|
|
165308
|
+
}
|
|
165309
|
+
return mapPackageSearchResult(body, sha1, targetPath);
|
|
165310
|
+
});
|
|
167396
165311
|
}
|
|
167397
|
-
|
|
167398
|
-
|
|
167399
|
-
|
|
167400
|
-
|
|
167401
|
-
|
|
167402
|
-
|
|
167403
|
-
|
|
167404
|
-
|
|
167405
|
-
|
|
167406
|
-
|
|
167407
|
-
|
|
167408
|
-
|
|
167409
|
-
|
|
167410
|
-
|
|
167411
|
-
|
|
165312
|
+
function mapPackageSearchResult(body, sha1, targetPath) {
|
|
165313
|
+
return body.data
|
|
165314
|
+
.map((purl) => {
|
|
165315
|
+
try {
|
|
165316
|
+
const pkg = packageurl_js_1.PackageURL.fromString(purl.id);
|
|
165317
|
+
const fallback = fallbackPackageInfo(sha1, targetPath);
|
|
165318
|
+
return {
|
|
165319
|
+
groupId: pkg.namespace || fallback.groupId,
|
|
165320
|
+
artifactId: pkg.name || fallback.artifactId,
|
|
165321
|
+
version: pkg.version || fallback.version,
|
|
165322
|
+
};
|
|
165323
|
+
}
|
|
165324
|
+
catch (_error) {
|
|
165325
|
+
debug(`Failed to parse package url components for ${targetPath} using sha1 '${sha1}.`);
|
|
165326
|
+
return undefined;
|
|
165327
|
+
}
|
|
165328
|
+
})
|
|
165329
|
+
.filter((mvnPackage) => mvnPackage !== undefined);
|
|
167412
165330
|
}
|
|
165331
|
+
function fallbackPackageInfo(sha1, targetPath) {
|
|
165332
|
+
return {
|
|
165333
|
+
groupId: 'unknown',
|
|
165334
|
+
artifactId: `${targetPath}:${sha1}`,
|
|
165335
|
+
version: 'unknown',
|
|
165336
|
+
};
|
|
165337
|
+
}
|
|
165338
|
+
//# sourceMappingURL=search.js.map
|
|
167413
165339
|
|
|
167414
|
-
|
|
167415
|
-
var formatters = module.exports.formatters;
|
|
167416
|
-
/**
|
|
167417
|
-
* Map %o to `util.inspect()`, all on a single line.
|
|
167418
|
-
*/
|
|
167419
|
-
|
|
167420
|
-
formatters.o = function (v) {
|
|
167421
|
-
this.inspectOpts.colors = this.useColors;
|
|
167422
|
-
return util.inspect(v, this.inspectOpts)
|
|
167423
|
-
.split('\n')
|
|
167424
|
-
.map(function (str) { return str.trim(); })
|
|
167425
|
-
.join(' ');
|
|
167426
|
-
};
|
|
167427
|
-
/**
|
|
167428
|
-
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
167429
|
-
*/
|
|
167430
|
-
|
|
165340
|
+
/***/ }),
|
|
167431
165341
|
|
|
167432
|
-
|
|
167433
|
-
|
|
167434
|
-
return util.inspect(v, this.inspectOpts);
|
|
167435
|
-
};
|
|
165342
|
+
/***/ 17872:
|
|
165343
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
167436
165344
|
|
|
165345
|
+
"use strict";
|
|
167437
165346
|
|
|
165347
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
165348
|
+
exports.execute = void 0;
|
|
165349
|
+
const childProcess = __webpack_require__(63129);
|
|
165350
|
+
const index_1 = __webpack_require__(29615);
|
|
165351
|
+
const shescape_1 = __webpack_require__(79114);
|
|
165352
|
+
function execute(command, args, options) {
|
|
165353
|
+
const spawnOptions = { shell: true };
|
|
165354
|
+
if (options && options.cwd) {
|
|
165355
|
+
spawnOptions.cwd = options.cwd;
|
|
165356
|
+
}
|
|
165357
|
+
if (args) {
|
|
165358
|
+
args = (0, shescape_1.quoteAll)(args, spawnOptions);
|
|
165359
|
+
}
|
|
165360
|
+
return new Promise((resolve, reject) => {
|
|
165361
|
+
let stdout = '';
|
|
165362
|
+
let stderr = '';
|
|
165363
|
+
const proc = childProcess.spawn(command, args, spawnOptions);
|
|
165364
|
+
proc.stdout.on('data', (data) => {
|
|
165365
|
+
stdout = stdout + data;
|
|
165366
|
+
});
|
|
165367
|
+
proc.stderr.on('data', (data) => {
|
|
165368
|
+
stderr = stderr + data;
|
|
165369
|
+
});
|
|
165370
|
+
proc.on('error', (err) => {
|
|
165371
|
+
(0, index_1.debug)(`Child process errored with: ${err.message}`);
|
|
165372
|
+
});
|
|
165373
|
+
proc.on('exit', (code) => {
|
|
165374
|
+
(0, index_1.debug)(`Child process exited with code: ${code}`);
|
|
165375
|
+
});
|
|
165376
|
+
proc.on('close', (code) => {
|
|
165377
|
+
if (code !== 0) {
|
|
165378
|
+
(0, index_1.debug)(`Child process failed with exit code: ${code}`, '----------------', 'STDERR:', stderr, '----------------', 'STDOUT:', stdout, '----------------');
|
|
165379
|
+
const stdErrMessage = stderr ? `\nSTDERR:\n${stderr}` : '';
|
|
165380
|
+
const stdOutMessage = stdout ? `\nSTDOUT:\n${stdout}` : '';
|
|
165381
|
+
const debugSuggestion = process.env.DEBUG
|
|
165382
|
+
? ''
|
|
165383
|
+
: `\nRun in debug mode (-d) to see STDERR and STDOUT.`;
|
|
165384
|
+
return reject(new Error(`Child process failed with exit code: ${code}.` +
|
|
165385
|
+
debugSuggestion +
|
|
165386
|
+
(stdErrMessage || stdOutMessage)));
|
|
165387
|
+
}
|
|
165388
|
+
resolve(stdout || stderr);
|
|
165389
|
+
});
|
|
165390
|
+
});
|
|
165391
|
+
}
|
|
165392
|
+
exports.execute = execute;
|
|
165393
|
+
//# sourceMappingURL=sub-process.js.map
|
|
167438
165394
|
|
|
167439
165395
|
/***/ }),
|
|
167440
165396
|
|
|
@@ -167555,7 +165511,7 @@ function __generator(thisArg, body) {
|
|
|
167555
165511
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
167556
165512
|
function step(op) {
|
|
167557
165513
|
if (f) throw new TypeError("Generator is already executing.");
|
|
167558
|
-
while (_) try {
|
|
165514
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
167559
165515
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
167560
165516
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
167561
165517
|
switch (op[0]) {
|
|
@@ -246699,14 +244655,6 @@ module.exports = JSON.parse('[{"name":"AppVeyor","constant":"APPVEYOR","env":"AP
|
|
|
246699
244655
|
|
|
246700
244656
|
/***/ }),
|
|
246701
244657
|
|
|
246702
|
-
/***/ 83049:
|
|
246703
|
-
/***/ ((module) => {
|
|
246704
|
-
|
|
246705
|
-
"use strict";
|
|
246706
|
-
module.exports = {"i8":"2.9.1"};
|
|
246707
|
-
|
|
246708
|
-
/***/ }),
|
|
246709
|
-
|
|
246710
244658
|
/***/ 66674:
|
|
246711
244659
|
/***/ ((module) => {
|
|
246712
244660
|
|