snyk-paket-parser 1.5.0 → 1.6.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/dependencies-parser.js +50 -65
- package/dist/dependencies-parser.js.map +1 -1
- package/dist/errors/invalid-user-input-error.js +7 -15
- package/dist/errors/invalid-user-input-error.js.map +1 -1
- package/dist/errors/out-of-sync-error.js +9 -13
- package/dist/errors/out-of-sync-error.js.map +1 -1
- package/dist/index.js +112 -221
- package/dist/index.js.map +1 -1
- package/dist/line-parser.js +14 -29
- package/dist/line-parser.js.map +1 -1
- package/dist/lock-parser.js +62 -85
- package/dist/lock-parser.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,52 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var SOURCE = 'source';
|
|
3
|
+
const line_parser_1 = require("./line-parser");
|
|
4
|
+
const COMMENTS = ['#', '//'];
|
|
5
|
+
const GROUP = 'group';
|
|
6
|
+
const SOURCE = 'source';
|
|
8
7
|
// https://fsprojects.github.io/Paket/dependencies-file.html#Sources
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
const GITHUB = 'github';
|
|
9
|
+
const NUGET = 'nuget';
|
|
10
|
+
const CLITOOL = 'clitool';
|
|
11
|
+
const GIT = 'git';
|
|
12
|
+
const GIST = 'gist';
|
|
13
|
+
const HTTP = 'http';
|
|
15
14
|
function parseNuget(line) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const commentRegex = new RegExp(`(?:${COMMENTS[0]}|${COMMENTS[1]}).+`);
|
|
16
|
+
const nameVersionOptionsRegex = new RegExp(/(\S+)\s*([^:\n]*)(:.*)?/);
|
|
17
|
+
const versionFirstOptionRegex = new RegExp(/\s(?=[^ ]*$)/);
|
|
18
|
+
const [, name, versionRangeAndFirstOption, restOptions] = line
|
|
20
19
|
.replace(NUGET, '') // Remove 'nuget' string
|
|
21
20
|
.replace(commentRegex, '') // Remove comments from line end
|
|
22
21
|
.trim()
|
|
23
|
-
.match(nameVersionOptionsRegex)
|
|
22
|
+
.match(nameVersionOptionsRegex); // Split into groups for further parsing
|
|
24
23
|
// nuget dependency result object to be returned
|
|
25
|
-
|
|
24
|
+
const result = {
|
|
26
25
|
source: NUGET,
|
|
27
|
-
name
|
|
26
|
+
name,
|
|
28
27
|
versionRange: versionRangeAndFirstOption,
|
|
29
28
|
options: {},
|
|
30
29
|
};
|
|
31
30
|
if (restOptions) {
|
|
32
31
|
// tslint:disable-next-line:prefer-const
|
|
33
|
-
|
|
32
|
+
let [versionRange, firstOptionName] = versionRangeAndFirstOption.split(versionFirstOptionRegex);
|
|
34
33
|
result.versionRange = versionRange;
|
|
35
34
|
// If version is missing it will treat first option as version
|
|
36
35
|
if (!firstOptionName) {
|
|
37
36
|
result.versionRange = '';
|
|
38
37
|
firstOptionName = versionRange;
|
|
39
38
|
}
|
|
40
|
-
result.options =
|
|
39
|
+
result.options = `${firstOptionName}${restOptions}`
|
|
41
40
|
.split(/\s*,\s*/) // Split by comma if there is couple possibilities for option (e.g. framework >= net40, net45)
|
|
42
41
|
.reverse()
|
|
43
|
-
.reduce(
|
|
42
|
+
.reduce((optionsMap, option, index, array) => {
|
|
44
43
|
if (option.includes(':')) {
|
|
45
|
-
|
|
44
|
+
const [optionKey, value] = option.split(/:\s*/);
|
|
46
45
|
optionsMap[optionKey] = value;
|
|
47
46
|
}
|
|
48
47
|
else {
|
|
49
|
-
array[index + 1] = array[index + 1]
|
|
48
|
+
array[index + 1] = `${array[index + 1]}, ${option}`;
|
|
50
49
|
}
|
|
51
50
|
return optionsMap;
|
|
52
51
|
}, {});
|
|
@@ -55,12 +54,12 @@ function parseNuget(line) {
|
|
|
55
54
|
}
|
|
56
55
|
// https://fsprojects.github.io/Paket/github-dependencies.html
|
|
57
56
|
function parseGithub(line) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
const re = /"[^"]*"|\S+/g;
|
|
58
|
+
const parts = line.match(re).splice(1);
|
|
59
|
+
const [repo, version] = parts[0].split(':');
|
|
61
60
|
return {
|
|
62
61
|
file: parts[1] || '',
|
|
63
|
-
repo
|
|
62
|
+
repo,
|
|
64
63
|
source: 'github',
|
|
65
64
|
token: parts[2] || '',
|
|
66
65
|
version: version || '',
|
|
@@ -69,45 +68,44 @@ function parseGithub(line) {
|
|
|
69
68
|
// https://fsprojects.github.io/Paket/nuget-dependencies.html#NuGet-feeds
|
|
70
69
|
function parseSource(line) {
|
|
71
70
|
// Split URL and option string including possible comments.
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const urlRe = /^source ([^\s]+)(.*)$/i;
|
|
72
|
+
const [, url, optionsString] = line.match(urlRe);
|
|
74
73
|
// Options in this line is always double quoted.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
const options = {};
|
|
75
|
+
const optionsRe = /(.*?)\W*:\W*"(.*?)"/g;
|
|
76
|
+
const optionsStringTrimmed = optionsString.trim();
|
|
77
|
+
let matches = optionsRe.exec(optionsStringTrimmed);
|
|
79
78
|
while (matches) {
|
|
80
79
|
options[matches[1].trim()] = matches[2].trim();
|
|
81
80
|
matches = optionsRe.exec(optionsStringTrimmed);
|
|
82
81
|
}
|
|
83
82
|
return {
|
|
84
|
-
options
|
|
85
|
-
url
|
|
83
|
+
options,
|
|
84
|
+
url,
|
|
86
85
|
};
|
|
87
86
|
}
|
|
88
87
|
function parseGroupOption(line) {
|
|
89
88
|
// Line could be separated by space or by colon.
|
|
90
89
|
// TODO: Think what to do with possible comment in the line.
|
|
91
|
-
|
|
90
|
+
const result = line.match(/(\S+?)\s*(:|\s)\s*(.*)/);
|
|
92
91
|
return [result[1] || '', result[3] || ''];
|
|
93
92
|
}
|
|
94
93
|
function parseDependenciesFile(input) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var group = {
|
|
94
|
+
const lines = line_parser_1.parseLines(input);
|
|
95
|
+
const result = [];
|
|
96
|
+
let group = {
|
|
99
97
|
dependencies: [],
|
|
100
98
|
name: null,
|
|
101
99
|
options: {},
|
|
102
100
|
sources: [],
|
|
103
101
|
};
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
for (const line of lines) {
|
|
103
|
+
const isComment = !!COMMENTS.find((comment) => line.data.startsWith(comment));
|
|
106
104
|
// Ignore commented lines.
|
|
107
105
|
if (isComment) {
|
|
108
|
-
|
|
106
|
+
continue;
|
|
109
107
|
}
|
|
110
|
-
if (line.data.startsWith(GROUP
|
|
108
|
+
if (line.data.startsWith(`${GROUP} `)) {
|
|
111
109
|
result.push(group);
|
|
112
110
|
group = {
|
|
113
111
|
dependencies: [],
|
|
@@ -116,44 +114,31 @@ function parseDependenciesFile(input) {
|
|
|
116
114
|
sources: [],
|
|
117
115
|
};
|
|
118
116
|
}
|
|
119
|
-
else if (line.data.startsWith(SOURCE
|
|
117
|
+
else if (line.data.startsWith(`${SOURCE} `)) {
|
|
120
118
|
group.sources.push(parseSource(line.data));
|
|
121
119
|
}
|
|
122
|
-
else if (line.data.startsWith(GITHUB
|
|
120
|
+
else if (line.data.startsWith(`${GITHUB} `)) {
|
|
123
121
|
group.dependencies.push(parseGithub(line.data));
|
|
124
122
|
}
|
|
125
|
-
else if (line.data.startsWith(NUGET
|
|
123
|
+
else if (line.data.startsWith(`${NUGET} `)) {
|
|
126
124
|
group.dependencies.push(parseNuget(line.data));
|
|
127
125
|
}
|
|
128
|
-
else if (line.data.startsWith(CLITOOL
|
|
126
|
+
else if (line.data.startsWith(`${CLITOOL} `)) {
|
|
129
127
|
// TODO
|
|
130
128
|
}
|
|
131
|
-
else if (line.data.startsWith(GIT
|
|
129
|
+
else if (line.data.startsWith(`${GIT} `)) {
|
|
132
130
|
// TODO
|
|
133
131
|
}
|
|
134
|
-
else if (line.data.startsWith(GIST
|
|
132
|
+
else if (line.data.startsWith(`${GIST} `)) {
|
|
135
133
|
// TODO
|
|
136
134
|
}
|
|
137
|
-
else if (line.data.startsWith(HTTP
|
|
135
|
+
else if (line.data.startsWith(`${HTTP} `)) {
|
|
138
136
|
// TODO
|
|
139
137
|
}
|
|
140
138
|
else {
|
|
141
|
-
|
|
139
|
+
const [name, value] = parseGroupOption(line.data);
|
|
142
140
|
group.options[name] = value;
|
|
143
141
|
}
|
|
144
|
-
};
|
|
145
|
-
try {
|
|
146
|
-
for (var lines_1 = tslib_1.__values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) {
|
|
147
|
-
var line = lines_1_1.value;
|
|
148
|
-
_loop_1(line);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
152
|
-
finally {
|
|
153
|
-
try {
|
|
154
|
-
if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1);
|
|
155
|
-
}
|
|
156
|
-
finally { if (e_1) throw e_1.error; }
|
|
157
142
|
}
|
|
158
143
|
result.push(group);
|
|
159
144
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies-parser.js","sourceRoot":"","sources":["../lib/dependencies-parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dependencies-parser.js","sourceRoot":"","sources":["../lib/dependencies-parser.ts"],"names":[],"mappings":";;AAAA,+CAAyC;AAEzC,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC7B,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,oEAAoE;AACpE,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,MAAM,OAAO,GAAG,S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aAAM;YACL,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;SAC7B;KACF;IAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAEnB,OAAO,MAAM,CAAC;AAChB,CAAC;AAjDD,sDAiDC"}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
args[_i] = arguments[_i];
|
|
10
|
-
}
|
|
11
|
-
var _this = _super.apply(this, tslib_1.__spread(args)) || this;
|
|
12
|
-
_this.code = 422;
|
|
13
|
-
_this.name = 'InvalidUserInputError';
|
|
14
|
-
Error.captureStackTrace(_this, InvalidUserInputError);
|
|
15
|
-
return _this;
|
|
3
|
+
class InvalidUserInputError extends Error {
|
|
4
|
+
constructor(...args) {
|
|
5
|
+
super(...args);
|
|
6
|
+
this.code = 422;
|
|
7
|
+
this.name = 'InvalidUserInputError';
|
|
8
|
+
Error.captureStackTrace(this, InvalidUserInputError);
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
}(Error));
|
|
10
|
+
}
|
|
19
11
|
exports.InvalidUserInputError = InvalidUserInputError;
|
|
20
12
|
//# sourceMappingURL=invalid-user-input-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-user-input-error.js","sourceRoot":"","sources":["../../lib/errors/invalid-user-input-error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invalid-user-input-error.js","sourceRoot":"","sources":["../../lib/errors/invalid-user-input-error.ts"],"names":[],"mappings":";;AAAA,MAAa,qBAAsB,SAAQ,KAAK;IAI9C,YAAY,GAAG,IAAW;QACxB,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QAJV,SAAI,GAAG,GAAG,CAAC;QACX,SAAI,GAAG,uBAAuB,CAAC;QAIpC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IACvD,CAAC;CACF;AARD,sDAQC"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function OutOfSyncError(dependencyName) {
|
|
7
|
-
var _this = _super.call(this, "Dependency " + dependencyName + " was not found in paket.lock. Your " +
|
|
3
|
+
class OutOfSyncError extends Error {
|
|
4
|
+
constructor(dependencyName) {
|
|
5
|
+
super(`Dependency ${dependencyName} was not found in paket.lock. Your ` +
|
|
8
6
|
'paket.dependencies and paket.lock are probably out of sync. Please ' +
|
|
9
|
-
'run "paket install" and try again.')
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Error.captureStackTrace(
|
|
14
|
-
return _this;
|
|
7
|
+
'run "paket install" and try again.');
|
|
8
|
+
this.code = 422;
|
|
9
|
+
this.name = 'OutOfSyncError';
|
|
10
|
+
this.dependencyName = dependencyName;
|
|
11
|
+
Error.captureStackTrace(this, OutOfSyncError);
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
}(Error));
|
|
13
|
+
}
|
|
18
14
|
exports.OutOfSyncError = OutOfSyncError;
|
|
19
15
|
//# sourceMappingURL=out-of-sync-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"out-of-sync-error.js","sourceRoot":"","sources":["../../lib/errors/out-of-sync-error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"out-of-sync-error.js","sourceRoot":"","sources":["../../lib/errors/out-of-sync-error.ts"],"names":[],"mappings":";;AAAA,MAAa,cAAe,SAAQ,KAAK;IAMvC,YAAY,cAAsB;QAChC,KAAK,CAAC,cAAc,cAAc,qCAAqC;YACrE,qEAAqE;YACrE,oCAAoC,CAAC,CAAC;QARnC,SAAI,GAAG,GAAG,CAAC;QACX,SAAI,GAAG,gBAAgB,CAAC;QAQ7B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAChD,CAAC;CACF;AAbD,wCAaC"}
|
package/dist/index.js
CHANGED
|
@@ -1,279 +1,170 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const lock_parser_1 = require("./lock-parser");
|
|
5
|
+
const dependencies_parser_1 = require("./dependencies-parser");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
const errors_1 = require("./errors");
|
|
9
9
|
exports.InvalidUserInputError = errors_1.InvalidUserInputError;
|
|
10
10
|
exports.OutOfSyncError = errors_1.OutOfSyncError;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const DEV_GROUPS = ['build', 'test', 'tests'];
|
|
12
|
+
const SUPPORTED_SOURCES = ['nuget'];
|
|
13
|
+
const FREQUENCY_THRESHOLD = 100;
|
|
14
14
|
var DepType;
|
|
15
15
|
(function (DepType) {
|
|
16
16
|
DepType["prod"] = "prod";
|
|
17
17
|
DepType["dev"] = "dev";
|
|
18
18
|
})(DepType = exports.DepType || (exports.DepType = {}));
|
|
19
|
-
function buildDepTreeFromFiles(root, manifestFilePath, lockFilePath, includeDev, strict) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
lockFileContents = fs.readFileSync(lockFileFullPath, 'utf-8');
|
|
39
|
-
_a = {};
|
|
40
|
-
return [4 /*yield*/, buildDepTree(manifestFileContents, lockFileContents, includeDev, strict)];
|
|
41
|
-
case 1: return [2 /*return*/, (_a.dependencies = _b.sent(),
|
|
42
|
-
_a.name = path.basename(path.dirname(manifestFileFullPath)),
|
|
43
|
-
_a.version = '',
|
|
44
|
-
_a)];
|
|
45
|
-
}
|
|
46
|
-
});
|
|
19
|
+
function buildDepTreeFromFiles(root, manifestFilePath, lockFilePath, includeDev = false, strict = true) {
|
|
20
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const manifestFileFullPath = path.resolve(root, manifestFilePath);
|
|
22
|
+
const lockFileFullPath = path.resolve(root, lockFilePath);
|
|
23
|
+
if (!fs.existsSync(manifestFileFullPath)) {
|
|
24
|
+
throw new errors_1.InvalidUserInputError('Target file paket.dependencies not found at ' +
|
|
25
|
+
`location: ${manifestFileFullPath}`);
|
|
26
|
+
}
|
|
27
|
+
if (!fs.existsSync(lockFileFullPath)) {
|
|
28
|
+
throw new errors_1.InvalidUserInputError('Lockfile not found at location: ' +
|
|
29
|
+
lockFileFullPath);
|
|
30
|
+
}
|
|
31
|
+
const manifestFileContents = fs.readFileSync(manifestFileFullPath, 'utf-8');
|
|
32
|
+
const lockFileContents = fs.readFileSync(lockFileFullPath, 'utf-8');
|
|
33
|
+
return {
|
|
34
|
+
dependencies: yield buildDepTree(manifestFileContents, lockFileContents, includeDev, strict),
|
|
35
|
+
name: path.basename(path.dirname(manifestFileFullPath)),
|
|
36
|
+
version: '',
|
|
37
|
+
};
|
|
47
38
|
});
|
|
48
39
|
}
|
|
49
40
|
exports.buildDepTreeFromFiles = buildDepTreeFromFiles;
|
|
50
|
-
function buildDepTree(manifestFileContents, lockFileContents, includeDev, strict) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
collectResolvedDeps(lockFile, dependenciesMap);
|
|
61
|
-
try {
|
|
62
|
-
for (_c = tslib_1.__values(dependenciesMap.values()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
63
|
-
dep = _d.value;
|
|
64
|
-
if (dep.root) {
|
|
65
|
-
calculateReferences(dep, dependenciesMap);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
41
|
+
function buildDepTree(manifestFileContents, lockFileContents, includeDev = false, strict = true) {
|
|
42
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const manifestFile = dependencies_parser_1.parseDependenciesFile(manifestFileContents);
|
|
44
|
+
const lockFile = lock_parser_1.parseLockFile(lockFileContents);
|
|
45
|
+
const dependenciesMap = new Map();
|
|
46
|
+
collectRootDeps(manifestFile, dependenciesMap);
|
|
47
|
+
collectResolvedDeps(lockFile, dependenciesMap);
|
|
48
|
+
for (const dep of dependenciesMap.values()) {
|
|
49
|
+
if (dep.root) {
|
|
50
|
+
calculateReferences(dep, dependenciesMap);
|
|
68
51
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
dependencies = {};
|
|
77
|
-
try {
|
|
78
|
-
for (_e = tslib_1.__values(dependenciesMap.values()), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
79
|
-
dep = _f.value;
|
|
80
|
-
if (dep.root && (includeDev || dep.depType === DepType.prod)) {
|
|
81
|
-
if (strict && !dep.resolved) {
|
|
82
|
-
throw new errors_1.OutOfSyncError(dep.name);
|
|
83
|
-
}
|
|
84
|
-
dependencies[dep.name] = buildTreeFromList(dep, dependenciesMap);
|
|
85
|
-
if (!dep.resolved) {
|
|
86
|
-
dependencies[dep.name].missingLockFileEntry = true;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
52
|
+
}
|
|
53
|
+
const dependencies = {};
|
|
54
|
+
for (const dep of dependenciesMap.values()) {
|
|
55
|
+
if (dep.root && (includeDev || dep.depType === DepType.prod)) {
|
|
56
|
+
if (strict && !dep.resolved) {
|
|
57
|
+
throw new errors_1.OutOfSyncError(dep.name);
|
|
89
58
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
try {
|
|
94
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
59
|
+
dependencies[dep.name] = buildTreeFromList(dep, dependenciesMap);
|
|
60
|
+
if (!dep.resolved) {
|
|
61
|
+
dependencies[dep.name].missingLockFileEntry = true;
|
|
95
62
|
}
|
|
96
|
-
finally { if (e_2) throw e_2.error; }
|
|
97
63
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
64
|
+
}
|
|
65
|
+
const frequentSubTree = buildFrequentDepsSubtree(dependenciesMap);
|
|
66
|
+
if (Object.keys(frequentSubTree.dependencies).length) {
|
|
67
|
+
dependencies[frequentSubTree.name] = frequentSubTree;
|
|
68
|
+
}
|
|
69
|
+
return dependencies;
|
|
104
70
|
});
|
|
105
71
|
}
|
|
106
72
|
function collectRootDeps(manifestFile, dependenciesMap) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
for (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
for (var _c = tslib_1.__values(group.dependencies), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
114
|
-
var dep = _d.value;
|
|
115
|
-
if (SUPPORTED_SOURCES.indexOf(dep.source.toLowerCase()) === -1) {
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
var nugetDep = dep;
|
|
119
|
-
if (!dependenciesMap.has(nugetDep.name.toLowerCase())) {
|
|
120
|
-
dependenciesMap.set(nugetDep.name.toLowerCase(), {
|
|
121
|
-
name: nugetDep.name,
|
|
122
|
-
// Will be overwritten in `collectResolvedDeps`.
|
|
123
|
-
version: nugetDep.versionRange,
|
|
124
|
-
// Will be overwritten in `collectResolvedDeps`.
|
|
125
|
-
dependencies: [],
|
|
126
|
-
depType: isDev ? DepType.dev : DepType.prod,
|
|
127
|
-
root: true,
|
|
128
|
-
refs: 1,
|
|
129
|
-
// Will be overwritten in `collectResolvedDeps`.
|
|
130
|
-
resolved: false,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
73
|
+
for (const group of manifestFile) {
|
|
74
|
+
const isDev = DEV_GROUPS.indexOf((group.name || '').toLowerCase()) !== -1;
|
|
75
|
+
for (const dep of group.dependencies) {
|
|
76
|
+
if (SUPPORTED_SOURCES.indexOf(dep.source.toLowerCase()) === -1) {
|
|
77
|
+
continue;
|
|
134
78
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
79
|
+
const nugetDep = dep;
|
|
80
|
+
if (!dependenciesMap.has(nugetDep.name.toLowerCase())) {
|
|
81
|
+
dependenciesMap.set(nugetDep.name.toLowerCase(), {
|
|
82
|
+
name: nugetDep.name,
|
|
83
|
+
// Will be overwritten in `collectResolvedDeps`.
|
|
84
|
+
version: nugetDep.versionRange,
|
|
85
|
+
// Will be overwritten in `collectResolvedDeps`.
|
|
86
|
+
dependencies: [],
|
|
87
|
+
depType: isDev ? DepType.dev : DepType.prod,
|
|
88
|
+
root: true,
|
|
89
|
+
refs: 1,
|
|
90
|
+
// Will be overwritten in `collectResolvedDeps`.
|
|
91
|
+
resolved: false,
|
|
92
|
+
});
|
|
141
93
|
}
|
|
142
94
|
}
|
|
143
95
|
}
|
|
144
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
145
|
-
finally {
|
|
146
|
-
try {
|
|
147
|
-
if (manifestFile_1_1 && !manifestFile_1_1.done && (_a = manifestFile_1.return)) _a.call(manifestFile_1);
|
|
148
|
-
}
|
|
149
|
-
finally { if (e_3) throw e_3.error; }
|
|
150
|
-
}
|
|
151
96
|
}
|
|
152
97
|
function collectResolvedDeps(lockFile, dependenciesMap) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
for (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
try {
|
|
159
|
-
for (var _e = tslib_1.__values(group.dependencies), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
160
|
-
var dep = _f.value;
|
|
161
|
-
if (SUPPORTED_SOURCES.indexOf(dep.repository.toLowerCase()) === -1) {
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
if (dependenciesMap.has(dep.name.toLowerCase())) {
|
|
165
|
-
var rootDep = dependenciesMap.get(dep.name.toLowerCase());
|
|
166
|
-
rootDep.version = dep.version;
|
|
167
|
-
rootDep.dependencies = dep.dependencies.map(function (d) { return d.name.toLowerCase(); });
|
|
168
|
-
rootDep.resolved = true;
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
dependenciesMap.set(dep.name.toLowerCase(), {
|
|
172
|
-
name: dep.name,
|
|
173
|
-
version: dep.version,
|
|
174
|
-
dependencies: dep.dependencies.map(function (d) { return d.name.toLowerCase(); }),
|
|
175
|
-
depType: isDev ? DepType.dev : DepType.prod,
|
|
176
|
-
root: false,
|
|
177
|
-
refs: 0,
|
|
178
|
-
resolved: true,
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}
|
|
98
|
+
for (const group of lockFile.groups) {
|
|
99
|
+
const isDev = DEV_GROUPS.indexOf((group.name || '').toLowerCase()) !== -1;
|
|
100
|
+
for (const dep of group.dependencies) {
|
|
101
|
+
if (SUPPORTED_SOURCES.indexOf(dep.repository.toLowerCase()) === -1) {
|
|
102
|
+
continue;
|
|
182
103
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
104
|
+
if (dependenciesMap.has(dep.name.toLowerCase())) {
|
|
105
|
+
const rootDep = dependenciesMap.get(dep.name.toLowerCase());
|
|
106
|
+
rootDep.version = dep.version;
|
|
107
|
+
rootDep.dependencies = dep.dependencies.map((d) => d.name.toLowerCase());
|
|
108
|
+
rootDep.resolved = true;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
dependenciesMap.set(dep.name.toLowerCase(), {
|
|
112
|
+
name: dep.name,
|
|
113
|
+
version: dep.version,
|
|
114
|
+
dependencies: dep.dependencies.map((d) => d.name.toLowerCase()),
|
|
115
|
+
depType: isDev ? DepType.dev : DepType.prod,
|
|
116
|
+
root: false,
|
|
117
|
+
refs: 0,
|
|
118
|
+
resolved: true,
|
|
119
|
+
});
|
|
189
120
|
}
|
|
190
121
|
}
|
|
191
122
|
}
|
|
192
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
193
|
-
finally {
|
|
194
|
-
try {
|
|
195
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
196
|
-
}
|
|
197
|
-
finally { if (e_5) throw e_5.error; }
|
|
198
|
-
}
|
|
199
123
|
}
|
|
200
124
|
function calculateReferences(node, dependenciesMap) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
sub
|
|
207
|
-
// Do not propagate calculations if we already reach threshold for the node.
|
|
208
|
-
if (sub.refs < FREQUENCY_THRESHOLD) {
|
|
209
|
-
calculateReferences(sub, dependenciesMap);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
214
|
-
finally {
|
|
215
|
-
try {
|
|
216
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
125
|
+
for (const subName of node.dependencies) {
|
|
126
|
+
const sub = dependenciesMap.get(subName);
|
|
127
|
+
sub.refs += node.refs;
|
|
128
|
+
// Do not propagate calculations if we already reach threshold for the node.
|
|
129
|
+
if (sub.refs < FREQUENCY_THRESHOLD) {
|
|
130
|
+
calculateReferences(sub, dependenciesMap);
|
|
217
131
|
}
|
|
218
|
-
finally { if (e_7) throw e_7.error; }
|
|
219
132
|
}
|
|
220
133
|
}
|
|
221
134
|
function buildFrequentDepsSubtree(dependenciesMap) {
|
|
222
|
-
|
|
135
|
+
const tree = {
|
|
223
136
|
name: 'meta-common-packages',
|
|
224
137
|
version: 'meta',
|
|
225
138
|
dependencies: {},
|
|
226
139
|
};
|
|
227
|
-
getFrequentDependencies(dependenciesMap).forEach(
|
|
228
|
-
|
|
140
|
+
getFrequentDependencies(dependenciesMap).forEach((listItem) => {
|
|
141
|
+
const treeNode = buildTreeFromList(listItem, dependenciesMap);
|
|
229
142
|
tree.dependencies[treeNode.name] = treeNode;
|
|
230
143
|
});
|
|
231
144
|
return tree;
|
|
232
145
|
}
|
|
233
146
|
function getFrequentDependencies(dependenciesMap) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
var dep = _c.value;
|
|
239
|
-
if (!dep.root && dep.refs >= FREQUENCY_THRESHOLD) {
|
|
240
|
-
frequentDeps.push(dep);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
245
|
-
finally {
|
|
246
|
-
try {
|
|
247
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
147
|
+
const frequentDeps = [];
|
|
148
|
+
for (const dep of dependenciesMap.values()) {
|
|
149
|
+
if (!dep.root && dep.refs >= FREQUENCY_THRESHOLD) {
|
|
150
|
+
frequentDeps.push(dep);
|
|
248
151
|
}
|
|
249
|
-
finally { if (e_8) throw e_8.error; }
|
|
250
152
|
}
|
|
251
153
|
return frequentDeps;
|
|
252
154
|
}
|
|
253
155
|
function buildTreeFromList(listItem, dependenciesMap) {
|
|
254
|
-
|
|
255
|
-
var tree = {
|
|
156
|
+
const tree = {
|
|
256
157
|
name: listItem.name,
|
|
257
158
|
version: listItem.version,
|
|
258
159
|
dependencies: {},
|
|
259
160
|
depType: listItem.depType,
|
|
260
161
|
};
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
var subtree = buildTreeFromList(subListItem, dependenciesMap);
|
|
267
|
-
tree.dependencies[subtree.name] = subtree;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
272
|
-
finally {
|
|
273
|
-
try {
|
|
274
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
162
|
+
for (const name of listItem.dependencies) {
|
|
163
|
+
const subListItem = dependenciesMap.get(name);
|
|
164
|
+
if (!(subListItem.refs >= FREQUENCY_THRESHOLD)) {
|
|
165
|
+
const subtree = buildTreeFromList(subListItem, dependenciesMap);
|
|
166
|
+
tree.dependencies[subtree.name] = subtree;
|
|
275
167
|
}
|
|
276
|
-
finally { if (e_9) throw e_9.error; }
|
|
277
168
|
}
|
|
278
169
|
return tree;
|
|
279
170
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AACvD,+DAAgG;AAChG,6BAA6B;AAC7B,yBAAyB;AACzB,qCAA+D;AAMvD,gCANA,8BAAqB,CAMA;AAAE,yBANA,uBAAc,CAMA;AAJ7C,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9C,MAAM,iBAAiB,GAAG,CAAC,OAAO,CAAC,CAAC;AACpC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAgBhC,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,wBAAa,CAAA;IACb,s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,CAAC,CAAC,WAAW,CAAC,IAAI,IAAI,mBAAmB,CAAC,EAAE;YAC9C,MAAM,OAAO,GAAG,iBAAiB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;YAChE,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;SAC3C;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/line-parser.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function Line(data, indentation) {
|
|
3
|
+
class Line {
|
|
4
|
+
constructor(data, indentation) {
|
|
6
5
|
this.data = data;
|
|
7
6
|
this.indentation = indentation;
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
}());
|
|
8
|
+
}
|
|
11
9
|
exports.Line = Line;
|
|
12
10
|
function countIndents(line, indent) {
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const spaces = line.match(/^\s*/)[0].length;
|
|
12
|
+
const count = spaces / indent.length;
|
|
15
13
|
if (count % 1 !== 0) {
|
|
16
14
|
throw new Error('Line indentation malformed');
|
|
17
15
|
}
|
|
@@ -30,29 +28,16 @@ function removeByteOrderMark(input) {
|
|
|
30
28
|
return input;
|
|
31
29
|
}
|
|
32
30
|
// parse space indented lines into array of Lines
|
|
33
|
-
function parseLines(input, indent /* two spaces */, lineSeparator) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
for (var lines_1 = tslib_1.__values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) {
|
|
41
|
-
var line = lines_1_1.value;
|
|
42
|
-
var data = line.trim();
|
|
43
|
-
if (data === '') { // GROUPS often separated by blank lines
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
var indentation = countIndents(line, indent);
|
|
47
|
-
result.push(new Line(data, indentation));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
51
|
-
finally {
|
|
52
|
-
try {
|
|
53
|
-
if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1);
|
|
31
|
+
function parseLines(input, indent = ' ' /* two spaces */, lineSeparator = /\r?\n/) {
|
|
32
|
+
const lines = removeByteOrderMark(input).split(lineSeparator);
|
|
33
|
+
const result = [];
|
|
34
|
+
for (const line of lines) {
|
|
35
|
+
const data = line.trim();
|
|
36
|
+
if (data === '') { // GROUPS often separated by blank lines
|
|
37
|
+
continue;
|
|
54
38
|
}
|
|
55
|
-
|
|
39
|
+
const indentation = countIndents(line, indent);
|
|
40
|
+
result.push(new Line(data, indentation));
|
|
56
41
|
}
|
|
57
42
|
return result;
|
|
58
43
|
}
|
package/dist/line-parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-parser.js","sourceRoot":"","sources":["../lib/line-parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"line-parser.js","sourceRoot":"","sources":["../lib/line-parser.ts"],"names":[],"mappings":";;AAAA,MAAa,IAAI;IAIf,YAAY,IAAY,EAAE,WAAmB;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AARD,oBAQC;AAED,SAAS,YAAY,CAAC,IAAY,EAAE,MAAc;IAChD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;KAC/C;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,oEAAoE;AACpE,+EAA+E;AAC/E,iDAAiD;AACjD,EAAE;AACF,kDAAkD;AAClD,wEAAwE;AACxE,SAAS,mBAAmB,CAAC,KAAa;IACxC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;QACpD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KACxB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,iDAAiD;AACjD,SAAgB,UAAU,CACxB,KAAa,EACb,SAAiB,IAAI,CAAC,gBAAgB,EACtC,gBAAwB,OAAO;IAG/B,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAW,EAAE,CAAC;IAE1B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAEzB,IAAI,IAAI,KAAK,EAAE,EAAE,EAAE,wCAAwC;YACzD,SAAS;SACV;QAED,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAE/C,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;KAC1C;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAtBD,gCAsBC"}
|
package/dist/lock-parser.js
CHANGED
|
@@ -1,42 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var SPECS = 'SPECS';
|
|
3
|
+
const line_parser_1 = require("./line-parser");
|
|
4
|
+
const REPOSITORY_TYPES = ['HTTP', 'GIST', 'GIT', 'NUGET', 'GITHUB']; // naming convention in paket's standard parser
|
|
5
|
+
const GROUP = 'GROUP';
|
|
6
|
+
const REMOTE = 'REMOTE';
|
|
7
|
+
const SPECS = 'SPECS';
|
|
9
8
|
function parseOptions(optionsString) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var optionParts = option.split(/: +/);
|
|
16
|
-
if (optionParts[0] !== '') {
|
|
17
|
-
options[optionParts[0]] = optionParts[1];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
22
|
-
finally {
|
|
23
|
-
try {
|
|
24
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
9
|
+
const options = {};
|
|
10
|
+
for (const option of optionsString.split(/, +/)) {
|
|
11
|
+
const optionParts = option.split(/: +/);
|
|
12
|
+
if (optionParts[0] !== '') {
|
|
13
|
+
options[optionParts[0]] = optionParts[1];
|
|
25
14
|
}
|
|
26
|
-
finally { if (e_1) throw e_1.error; }
|
|
27
15
|
}
|
|
28
16
|
return options;
|
|
29
17
|
}
|
|
30
18
|
function parseDependencyLine(line, isSubDependency) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
const re = /^([^ ]+)\W+\(([^)]+)\)\W*(.*)$/;
|
|
20
|
+
const match = line.data.match(re);
|
|
21
|
+
const result = {
|
|
34
22
|
name: '',
|
|
35
23
|
version: '',
|
|
36
24
|
options: {},
|
|
37
25
|
};
|
|
38
26
|
if (!match && !isSubDependency) {
|
|
39
|
-
throw new Error(
|
|
27
|
+
throw new Error(`Malformed paket.lock file: Missing resolved version on ${line.data}`);
|
|
40
28
|
}
|
|
41
29
|
// Octokit (0.10.0)
|
|
42
30
|
// Microsoft.Net.Http
|
|
@@ -56,79 +44,68 @@ function parseDependencyLine(line, isSubDependency) {
|
|
|
56
44
|
return result;
|
|
57
45
|
}
|
|
58
46
|
function parseLockFile(input) {
|
|
59
|
-
|
|
60
|
-
var result = {
|
|
47
|
+
const result = {
|
|
61
48
|
groups: [],
|
|
62
49
|
};
|
|
63
|
-
|
|
64
|
-
|
|
50
|
+
const lines = line_parser_1.parseLines(input);
|
|
51
|
+
let group = {
|
|
65
52
|
name: null,
|
|
66
53
|
repositories: {},
|
|
67
54
|
dependencies: [],
|
|
68
55
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
dependencies: [],
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
else if (REPOSITORY_TYPES.indexOf(upperCaseLine) !== -1) {
|
|
86
|
-
depContext.repository = line.data;
|
|
87
|
-
group.repositories[line.data] = [];
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
var _b = tslib_1.__read(line.data.split(':'), 2), optionName = _b[0], optionValue = _b[1];
|
|
91
|
-
group.options = group.options || {};
|
|
92
|
-
// TODO: keeping null option values to know the option names
|
|
93
|
-
// need to decide what to do with them
|
|
94
|
-
group.options[optionName.trim()] = optionValue ? optionValue.trim() : null;
|
|
95
|
-
}
|
|
56
|
+
let depContext = {};
|
|
57
|
+
let dependency = null;
|
|
58
|
+
for (const line of lines) {
|
|
59
|
+
const upperCaseLine = line.data.toUpperCase();
|
|
60
|
+
if (line.indentation === 0) { // group or group option
|
|
61
|
+
if (upperCaseLine.startsWith(GROUP)) {
|
|
62
|
+
result.groups.push(group);
|
|
63
|
+
depContext = {};
|
|
64
|
+
group = {
|
|
65
|
+
name: line.data.substr(GROUP.length).trim(),
|
|
66
|
+
repositories: {},
|
|
67
|
+
dependencies: [],
|
|
68
|
+
};
|
|
96
69
|
}
|
|
97
|
-
else if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (remote) {
|
|
101
|
-
depContext.remote = remote;
|
|
102
|
-
group.repositories[depContext.repository].push(remote);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
else if (upperCaseLine.startsWith(SPECS)) {
|
|
106
|
-
// TODO: for now we add the specs as boolean in meta
|
|
107
|
-
group.specs = true;
|
|
108
|
-
}
|
|
70
|
+
else if (REPOSITORY_TYPES.indexOf(upperCaseLine) !== -1) {
|
|
71
|
+
depContext.repository = line.data;
|
|
72
|
+
group.repositories[line.data] = [];
|
|
109
73
|
}
|
|
110
74
|
else {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
75
|
+
const [optionName, optionValue] = line.data.split(':');
|
|
76
|
+
group.options = group.options || {};
|
|
77
|
+
// TODO: keeping null option values to know the option names
|
|
78
|
+
// need to decide what to do with them
|
|
79
|
+
group.options[optionName.trim()] = optionValue ? optionValue.trim() : null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else if (line.indentation === 1) { // remote or specs
|
|
83
|
+
if (upperCaseLine.startsWith(REMOTE)) {
|
|
84
|
+
const remote = line.data.substring(REMOTE.length + ':'.length).trim();
|
|
85
|
+
if (remote) {
|
|
86
|
+
depContext.remote = remote;
|
|
87
|
+
group.repositories[depContext.repository].push(remote);
|
|
119
88
|
}
|
|
120
89
|
}
|
|
121
|
-
if (
|
|
122
|
-
|
|
90
|
+
else if (upperCaseLine.startsWith(SPECS)) {
|
|
91
|
+
// TODO: for now we add the specs as boolean in meta
|
|
92
|
+
group.specs = true;
|
|
123
93
|
}
|
|
124
94
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
95
|
+
else {
|
|
96
|
+
const dep = parseDependencyLine(line, line.indentation === 3);
|
|
97
|
+
if (line.indentation === 2) { // Resolved Dependency
|
|
98
|
+
dep.remote = depContext.remote;
|
|
99
|
+
dep.repository = depContext.repository;
|
|
100
|
+
dependency = dep;
|
|
101
|
+
}
|
|
102
|
+
else { // Transitive Dependency
|
|
103
|
+
dependency.dependencies.push(dep);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (group && dependency && group.dependencies.indexOf(dependency) === -1) {
|
|
107
|
+
group.dependencies.push(dependency);
|
|
130
108
|
}
|
|
131
|
-
finally { if (e_2) throw e_2.error; }
|
|
132
109
|
}
|
|
133
110
|
result.groups.push(group);
|
|
134
111
|
return result;
|
package/dist/lock-parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lock-parser.js","sourceRoot":"","sources":["../lib/lock-parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lock-parser.js","sourceRoot":"","sources":["../lib/lock-parser.ts"],"names":[],"mappings":";;AAAA,+CAA+C;AAE/C,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,+CAA+C;AACpH,MAAM,KAAK,GAAG,OAAO,CAAC;AACtB,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,MAAM,KAAK,GAAG,OAAO,CAAC;AA6BtB,SAAS,YAAY,CAAC,aAAqB;IACzC,MAAM,OAAO,GAAG,EAAY,CAAC;IAE7B,KAAK,MAAM,MAAM,IAAI,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;QAC/C,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACxC,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACzB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;SAC1C;KACF;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAU,EAAE,eAAwB;IAC/D,MAAM,EAAE,GAAG,gCAAgC,CAAC;IAC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