@lerna-lite/core 1.3.0 → 1.4.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/README.md +13 -12
- package/dist/child-process.d.ts +62 -62
- package/dist/child-process.js +165 -165
- package/dist/command.d.ts +37 -35
- package/dist/command.js +266 -266
- package/dist/command.js.map +1 -1
- package/dist/conventional-commits/constants.d.ts +4 -4
- package/dist/conventional-commits/constants.js +12 -12
- package/dist/conventional-commits/get-changelog-config.d.ts +12 -12
- package/dist/conventional-commits/get-changelog-config.js +98 -98
- package/dist/conventional-commits/index.d.ts +6 -6
- package/dist/conventional-commits/index.js +22 -22
- package/dist/conventional-commits/make-bump-only-filter.d.ts +6 -6
- package/dist/conventional-commits/make-bump-only-filter.js +22 -22
- package/dist/conventional-commits/read-existing-changelog.d.ts +7 -7
- package/dist/conventional-commits/read-existing-changelog.js +32 -32
- package/dist/conventional-commits/recommend-version.d.ts +11 -11
- package/dist/conventional-commits/recommend-version.js +86 -86
- package/dist/conventional-commits/update-changelog.d.ts +11 -11
- package/dist/conventional-commits/update-changelog.js +83 -83
- package/dist/git-clients/GitLabClient.d.ts +8 -8
- package/dist/git-clients/GitLabClient.js +39 -39
- package/dist/git-clients/github-client.d.ts +6 -6
- package/dist/git-clients/github-client.js +40 -40
- package/dist/git-clients/gitlab-client.d.ts +6 -6
- package/dist/git-clients/gitlab-client.js +21 -21
- package/dist/git-clients/index.d.ts +2 -2
- package/dist/git-clients/index.js +18 -18
- package/dist/index.d.ts +12 -12
- package/dist/index.js +30 -30
- package/dist/models/command-options.d.ts +206 -0
- package/dist/models/command-options.js +3 -0
- package/dist/models/command-options.js.map +1 -0
- package/dist/models/index.d.ts +2 -186
- package/dist/models/index.js +18 -2
- package/dist/models/index.js.map +1 -1
- package/dist/models/interfaces.d.ts +201 -0
- package/dist/models/interfaces.js +3 -0
- package/dist/models/interfaces.js.map +1 -0
- package/dist/otplease.d.ts +14 -14
- package/dist/otplease.js +108 -108
- package/dist/package-graph/index.d.ts +2 -2
- package/dist/package-graph/index.js +18 -18
- package/dist/package-graph/lib/cyclic-package-graph-node.d.ts +42 -42
- package/dist/package-graph/lib/cyclic-package-graph-node.js +97 -97
- package/dist/package-graph/lib/index.d.ts +3 -3
- package/dist/package-graph/lib/index.js +19 -19
- package/dist/package-graph/lib/package-graph-node.d.ts +33 -33
- package/dist/package-graph/lib/package-graph-node.js +58 -58
- package/dist/package-graph/lib/report-cycles.d.ts +1 -1
- package/dist/package-graph/lib/report-cycles.js +19 -19
- package/dist/package-graph/package-graph.d.ts +79 -79
- package/dist/package-graph/package-graph.js +276 -276
- package/dist/package.d.ts +91 -85
- package/dist/package.js +282 -276
- package/dist/package.js.map +1 -1
- package/dist/project/index.d.ts +2 -2
- package/dist/project/index.js +18 -18
- package/dist/project/lib/apply-extends.d.ts +10 -10
- package/dist/project/lib/apply-extends.js +37 -37
- package/dist/project/lib/index.d.ts +3 -3
- package/dist/project/lib/index.js +19 -19
- package/dist/project/lib/make-file-finder.d.ts +3 -3
- package/dist/project/lib/make-file-finder.js +71 -71
- package/dist/project/lib/shallow-extend.d.ts +11 -11
- package/dist/project/lib/shallow-extend.js +24 -24
- package/dist/project/project.d.ts +45 -45
- package/dist/project/project.js +195 -195
- package/dist/prompt.d.ts +23 -23
- package/dist/prompt.js +75 -75
- package/dist/utils/check-working-tree.d.ts +8 -8
- package/dist/utils/check-working-tree.js +41 -41
- package/dist/utils/clean-stack.d.ts +5 -5
- package/dist/utils/clean-stack.js +18 -18
- package/dist/utils/collect-uncommitted.d.ts +18 -18
- package/dist/utils/collect-uncommitted.js +40 -40
- package/dist/utils/collect-updates/collect-updates.d.ts +11 -11
- package/dist/utils/collect-updates/collect-updates.js +82 -82
- package/dist/utils/collect-updates/index.d.ts +2 -2
- package/dist/utils/collect-updates/index.js +18 -18
- package/dist/utils/collect-updates/lib/collect-dependents.d.ts +11 -11
- package/dist/utils/collect-updates/lib/collect-dependents.js +45 -45
- package/dist/utils/collect-updates/lib/collect-packages.d.ts +13 -13
- package/dist/utils/collect-updates/lib/collect-packages.js +33 -33
- package/dist/utils/collect-updates/lib/get-packages-for-option.d.ts +5 -5
- package/dist/utils/collect-updates/lib/get-packages-for-option.js +30 -30
- package/dist/utils/collect-updates/lib/has-tags.d.ts +5 -5
- package/dist/utils/collect-updates/lib/has-tags.js +26 -26
- package/dist/utils/collect-updates/lib/index.d.ts +5 -5
- package/dist/utils/collect-updates/lib/index.js +21 -21
- package/dist/utils/collect-updates/lib/make-diff-predicate.d.ts +7 -7
- package/dist/utils/collect-updates/lib/make-diff-predicate.js +64 -64
- package/dist/utils/conf.d.ts +25 -25
- package/dist/utils/conf.js +255 -255
- package/dist/utils/defaults.d.ts +1 -1
- package/dist/utils/defaults.js +182 -182
- package/dist/utils/defaults.js.map +1 -1
- package/dist/utils/describe-ref.d.ts +37 -37
- package/dist/utils/describe-ref.js +80 -80
- package/dist/utils/env-replace.d.ts +1 -1
- package/dist/utils/env-replace.js +22 -22
- package/dist/utils/find-prefix.d.ts +2 -2
- package/dist/utils/find-prefix.js +48 -48
- package/dist/utils/index.d.ts +23 -22
- package/dist/utils/index.js +39 -38
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/log-package-error.d.ts +5 -5
- package/dist/utils/log-package-error.js +35 -35
- package/dist/utils/nerf-dart.d.ts +1 -1
- package/dist/utils/nerf-dart.js +18 -18
- package/dist/utils/npm-conf.d.ts +4 -4
- package/dist/utils/npm-conf.js +55 -55
- package/dist/utils/output.d.ts +1 -1
- package/dist/utils/output.js +13 -13
- package/dist/utils/parse-field.d.ts +1 -1
- package/dist/utils/parse-field.js +65 -65
- package/dist/utils/prerelease-id-from-version.d.ts +5 -5
- package/dist/utils/prerelease-id-from-version.js +15 -15
- package/dist/utils/pulse-till-done.d.ts +1 -1
- package/dist/utils/pulse-till-done.js +40 -40
- package/dist/utils/query-graph.d.ts +36 -36
- package/dist/utils/query-graph.js +77 -77
- package/dist/utils/query-graph.js.map +1 -1
- package/dist/utils/run-lifecycle.d.ts +10 -10
- package/dist/utils/run-lifecycle.js +131 -107
- package/dist/utils/run-lifecycle.js.map +1 -1
- package/dist/utils/run-topologically.d.ts +12 -12
- package/dist/utils/run-topologically.js +36 -36
- package/dist/utils/temp-write.d.ts +13 -0
- package/dist/utils/temp-write.js +50 -0
- package/dist/utils/temp-write.js.map +1 -0
- package/dist/utils/types.d.ts +131 -129
- package/dist/utils/types.js +138 -138
- package/dist/utils/warn-if-hanging.d.ts +1 -1
- package/dist/utils/warn-if-hanging.js +17 -17
- package/dist/utils/write-log-file.d.ts +1 -1
- package/dist/utils/write-log-file.js +32 -32
- package/dist/validation-error.d.ts +4 -4
- package/dist/validation-error.js +18 -18
- package/package.json +14 -10
package/dist/otplease.js
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOneTimePassword = exports.otplease = void 0;
|
|
4
|
-
const prompt_1 = require("./prompt");
|
|
5
|
-
// basic single-entry semaphore
|
|
6
|
-
const semaphore = {
|
|
7
|
-
wait() {
|
|
8
|
-
return new Promise((resolve) => {
|
|
9
|
-
if (!this._promise) {
|
|
10
|
-
// not waiting, block other callers until 'release' is called.
|
|
11
|
-
this._promise = new Promise((release) => {
|
|
12
|
-
this._resolve = release;
|
|
13
|
-
});
|
|
14
|
-
resolve(undefined);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
// wait for 'release' to be called and try to lock the semaphore again.
|
|
18
|
-
resolve(this._promise.then(() => this.wait()));
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
},
|
|
22
|
-
release() {
|
|
23
|
-
const resolve = this._resolve;
|
|
24
|
-
// istanbul ignore else
|
|
25
|
-
if (resolve) {
|
|
26
|
-
this._resolve = undefined;
|
|
27
|
-
this._promise = undefined;
|
|
28
|
-
// notify waiters that the semaphore has been released.
|
|
29
|
-
resolve();
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Attempt to execute Promise callback, prompting for OTP if necessary.
|
|
35
|
-
* @template {Record<string, unknown>} T
|
|
36
|
-
* @param {(opts: T) => Promise<unknown>} fn
|
|
37
|
-
* @param {T} _opts The options to be passed to `fn`
|
|
38
|
-
* @param {OneTimePasswordCache} otpCache
|
|
39
|
-
*/
|
|
40
|
-
function otplease(fn, _opts, otpCache) {
|
|
41
|
-
// always prefer explicit config (if present) to cache
|
|
42
|
-
const opts = { ...otpCache, ..._opts };
|
|
43
|
-
return attempt(fn, opts, otpCache);
|
|
44
|
-
}
|
|
45
|
-
exports.otplease = otplease;
|
|
46
|
-
/** @returns {Promise<unknown>} */
|
|
47
|
-
function attempt(fn, opts, otpCache) {
|
|
48
|
-
return new Promise((resolve) => {
|
|
49
|
-
resolve(fn(opts));
|
|
50
|
-
}).catch((err) => {
|
|
51
|
-
if (err.code !== 'EOTP' && !(err.code === 'E401' && /one-time pass/.test(err.body))) {
|
|
52
|
-
throw err;
|
|
53
|
-
}
|
|
54
|
-
else if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
55
|
-
throw err;
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
// check the cache in case a concurrent caller has already updated the otp.
|
|
59
|
-
if (!isNullOrUndefined(otpCache) && !isNullOrUndefined(otpCache.otp) && otpCache.otp !== opts.otp) {
|
|
60
|
-
return attempt(fn, { ...opts, ...otpCache }, otpCache);
|
|
61
|
-
}
|
|
62
|
-
// only allow one getOneTimePassword attempt at a time to reuse the value
|
|
63
|
-
// from the preceeding prompt
|
|
64
|
-
return semaphore.wait().then(() => {
|
|
65
|
-
// check the cache again in case a previous waiter already updated it.
|
|
66
|
-
if (!isNullOrUndefined(otpCache) && !isNullOrUndefined(otpCache.otp) && otpCache.otp !== opts.otp) {
|
|
67
|
-
semaphore.release();
|
|
68
|
-
return attempt(fn, { ...opts, ...otpCache }, otpCache);
|
|
69
|
-
}
|
|
70
|
-
return getOneTimePassword()
|
|
71
|
-
.then((otp) => {
|
|
72
|
-
// update the otp and release the lock so that waiting
|
|
73
|
-
// callers can see the updated otp.
|
|
74
|
-
if (!isNullOrUndefined(otpCache)) {
|
|
75
|
-
// eslint-disable-next-line no-param-reassign
|
|
76
|
-
otpCache.otp = otp;
|
|
77
|
-
}
|
|
78
|
-
semaphore.release();
|
|
79
|
-
return otp;
|
|
80
|
-
}, (promptError) => {
|
|
81
|
-
// release the lock and reject the promise.
|
|
82
|
-
semaphore.release();
|
|
83
|
-
return Promise.reject(promptError);
|
|
84
|
-
})
|
|
85
|
-
.then((otp) => {
|
|
86
|
-
return fn({ ...opts, otp });
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Prompt user for one-time password.
|
|
94
|
-
* @returns {Promise<string>}
|
|
95
|
-
*/
|
|
96
|
-
function getOneTimePassword(message = 'This operation requires a one-time password:') {
|
|
97
|
-
// Logic taken from npm internals: https://github.com/npm/cli/blob/4f801d8a476f7ca52b0f182bf4e17a80db12b4e2/lib/utils/read-user-info.js#L21-L35
|
|
98
|
-
return (0, prompt_1.promptTextInput)(message, {
|
|
99
|
-
filter: (otp) => otp.replace(/\s+/g, ''),
|
|
100
|
-
validate: (otp) => (otp && /^[\d ]+$|^[A-Fa-f0-9]{64,64}$/.test(otp)) ||
|
|
101
|
-
'Must be a valid one-time-password. ' +
|
|
102
|
-
'See https://docs.npmjs.com/getting-started/using-two-factor-authentication',
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
exports.getOneTimePassword = getOneTimePassword;
|
|
106
|
-
function isNullOrUndefined(val) {
|
|
107
|
-
return val === null || val === undefined;
|
|
108
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOneTimePassword = exports.otplease = void 0;
|
|
4
|
+
const prompt_1 = require("./prompt");
|
|
5
|
+
// basic single-entry semaphore
|
|
6
|
+
const semaphore = {
|
|
7
|
+
wait() {
|
|
8
|
+
return new Promise((resolve) => {
|
|
9
|
+
if (!this._promise) {
|
|
10
|
+
// not waiting, block other callers until 'release' is called.
|
|
11
|
+
this._promise = new Promise((release) => {
|
|
12
|
+
this._resolve = release;
|
|
13
|
+
});
|
|
14
|
+
resolve(undefined);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
// wait for 'release' to be called and try to lock the semaphore again.
|
|
18
|
+
resolve(this._promise.then(() => this.wait()));
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
release() {
|
|
23
|
+
const resolve = this._resolve;
|
|
24
|
+
// istanbul ignore else
|
|
25
|
+
if (resolve) {
|
|
26
|
+
this._resolve = undefined;
|
|
27
|
+
this._promise = undefined;
|
|
28
|
+
// notify waiters that the semaphore has been released.
|
|
29
|
+
resolve();
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Attempt to execute Promise callback, prompting for OTP if necessary.
|
|
35
|
+
* @template {Record<string, unknown>} T
|
|
36
|
+
* @param {(opts: T) => Promise<unknown>} fn
|
|
37
|
+
* @param {T} _opts The options to be passed to `fn`
|
|
38
|
+
* @param {OneTimePasswordCache} otpCache
|
|
39
|
+
*/
|
|
40
|
+
function otplease(fn, _opts, otpCache) {
|
|
41
|
+
// always prefer explicit config (if present) to cache
|
|
42
|
+
const opts = { ...otpCache, ..._opts };
|
|
43
|
+
return attempt(fn, opts, otpCache);
|
|
44
|
+
}
|
|
45
|
+
exports.otplease = otplease;
|
|
46
|
+
/** @returns {Promise<unknown>} */
|
|
47
|
+
function attempt(fn, opts, otpCache) {
|
|
48
|
+
return new Promise((resolve) => {
|
|
49
|
+
resolve(fn(opts));
|
|
50
|
+
}).catch((err) => {
|
|
51
|
+
if (err.code !== 'EOTP' && !(err.code === 'E401' && /one-time pass/.test(err.body))) {
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
else if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
55
|
+
throw err;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// check the cache in case a concurrent caller has already updated the otp.
|
|
59
|
+
if (!isNullOrUndefined(otpCache) && !isNullOrUndefined(otpCache.otp) && otpCache.otp !== opts.otp) {
|
|
60
|
+
return attempt(fn, { ...opts, ...otpCache }, otpCache);
|
|
61
|
+
}
|
|
62
|
+
// only allow one getOneTimePassword attempt at a time to reuse the value
|
|
63
|
+
// from the preceeding prompt
|
|
64
|
+
return semaphore.wait().then(() => {
|
|
65
|
+
// check the cache again in case a previous waiter already updated it.
|
|
66
|
+
if (!isNullOrUndefined(otpCache) && !isNullOrUndefined(otpCache.otp) && otpCache.otp !== opts.otp) {
|
|
67
|
+
semaphore.release();
|
|
68
|
+
return attempt(fn, { ...opts, ...otpCache }, otpCache);
|
|
69
|
+
}
|
|
70
|
+
return getOneTimePassword()
|
|
71
|
+
.then((otp) => {
|
|
72
|
+
// update the otp and release the lock so that waiting
|
|
73
|
+
// callers can see the updated otp.
|
|
74
|
+
if (!isNullOrUndefined(otpCache)) {
|
|
75
|
+
// eslint-disable-next-line no-param-reassign
|
|
76
|
+
otpCache.otp = otp;
|
|
77
|
+
}
|
|
78
|
+
semaphore.release();
|
|
79
|
+
return otp;
|
|
80
|
+
}, (promptError) => {
|
|
81
|
+
// release the lock and reject the promise.
|
|
82
|
+
semaphore.release();
|
|
83
|
+
return Promise.reject(promptError);
|
|
84
|
+
})
|
|
85
|
+
.then((otp) => {
|
|
86
|
+
return fn({ ...opts, otp });
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Prompt user for one-time password.
|
|
94
|
+
* @returns {Promise<string>}
|
|
95
|
+
*/
|
|
96
|
+
function getOneTimePassword(message = 'This operation requires a one-time password:') {
|
|
97
|
+
// Logic taken from npm internals: https://github.com/npm/cli/blob/4f801d8a476f7ca52b0f182bf4e17a80db12b4e2/lib/utils/read-user-info.js#L21-L35
|
|
98
|
+
return (0, prompt_1.promptTextInput)(message, {
|
|
99
|
+
filter: (otp) => otp.replace(/\s+/g, ''),
|
|
100
|
+
validate: (otp) => (otp && /^[\d ]+$|^[A-Fa-f0-9]{64,64}$/.test(otp)) ||
|
|
101
|
+
'Must be a valid one-time-password. ' +
|
|
102
|
+
'See https://docs.npmjs.com/getting-started/using-two-factor-authentication',
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
exports.getOneTimePassword = getOneTimePassword;
|
|
106
|
+
function isNullOrUndefined(val) {
|
|
107
|
+
return val === null || val === undefined;
|
|
108
|
+
}
|
|
109
109
|
//# sourceMappingURL=otplease.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './package-graph';
|
|
2
|
-
export * from './lib';
|
|
1
|
+
export * from './package-graph';
|
|
2
|
+
export * from './lib';
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./package-graph"), exports);
|
|
18
|
-
__exportStar(require("./lib"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./package-graph"), exports);
|
|
18
|
+
__exportStar(require("./lib"), exports);
|
|
19
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { PackageGraphNode } from '../../package-graph';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a cyclic collection of nodes in a PackageGraph.
|
|
4
|
-
* It is meant to be used as a black box, where the only exposed
|
|
5
|
-
* information are the connections to the other nodes of the graph.
|
|
6
|
-
* It can contain either `PackageGraphNode`s or other `CyclicPackageGraphNode`s.
|
|
7
|
-
*
|
|
8
|
-
* @extends {Map<string, import('..').PackageGraphNode | CyclicPackageGraphNode>}
|
|
9
|
-
*/
|
|
10
|
-
export declare class CyclicPackageGraphNode extends Map<string, PackageGraphNode | CyclicPackageGraphNode> {
|
|
11
|
-
name: string;
|
|
12
|
-
localDependencies: Map<string, any>;
|
|
13
|
-
localDependents: Map<string, any>;
|
|
14
|
-
constructor();
|
|
15
|
-
get isCycle(): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* @returns {string} A representation of a cycle, like like `A -> B -> C -> A`.
|
|
18
|
-
*/
|
|
19
|
-
toString(): string;
|
|
20
|
-
/**
|
|
21
|
-
* Flattens a CyclicPackageGraphNode (which can have multiple level of cycles).
|
|
22
|
-
*/
|
|
23
|
-
flatten(): PackageGraphNode[];
|
|
24
|
-
/**
|
|
25
|
-
* Checks if a given node is contained in this cycle (or in a nested one)
|
|
26
|
-
*
|
|
27
|
-
* @param {string} name The name of the package to search in this cycle
|
|
28
|
-
* @returns {boolean}
|
|
29
|
-
*/
|
|
30
|
-
contains(name: string): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Adds a graph node, or a nested cycle, to this group.
|
|
33
|
-
*
|
|
34
|
-
* @param {import('..').PackageGraphNode | CyclicPackageGraphNode} node
|
|
35
|
-
*/
|
|
36
|
-
insert(node: PackageGraphNode | CyclicPackageGraphNode): void;
|
|
37
|
-
/**
|
|
38
|
-
* Remove pointers to candidate node from internal collections.
|
|
39
|
-
* @param {import('..').PackageGraphNode | CyclicPackageGraphNode} candidateNode instance to unlink
|
|
40
|
-
*/
|
|
41
|
-
unlink(candidateNode: PackageGraphNode | CyclicPackageGraphNode): void;
|
|
42
|
-
}
|
|
1
|
+
import { PackageGraphNode } from '../../package-graph';
|
|
2
|
+
/**
|
|
3
|
+
* Represents a cyclic collection of nodes in a PackageGraph.
|
|
4
|
+
* It is meant to be used as a black box, where the only exposed
|
|
5
|
+
* information are the connections to the other nodes of the graph.
|
|
6
|
+
* It can contain either `PackageGraphNode`s or other `CyclicPackageGraphNode`s.
|
|
7
|
+
*
|
|
8
|
+
* @extends {Map<string, import('..').PackageGraphNode | CyclicPackageGraphNode>}
|
|
9
|
+
*/
|
|
10
|
+
export declare class CyclicPackageGraphNode extends Map<string, PackageGraphNode | CyclicPackageGraphNode> {
|
|
11
|
+
name: string;
|
|
12
|
+
localDependencies: Map<string, any>;
|
|
13
|
+
localDependents: Map<string, any>;
|
|
14
|
+
constructor();
|
|
15
|
+
get isCycle(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @returns {string} A representation of a cycle, like like `A -> B -> C -> A`.
|
|
18
|
+
*/
|
|
19
|
+
toString(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Flattens a CyclicPackageGraphNode (which can have multiple level of cycles).
|
|
22
|
+
*/
|
|
23
|
+
flatten(): PackageGraphNode[];
|
|
24
|
+
/**
|
|
25
|
+
* Checks if a given node is contained in this cycle (or in a nested one)
|
|
26
|
+
*
|
|
27
|
+
* @param {string} name The name of the package to search in this cycle
|
|
28
|
+
* @returns {boolean}
|
|
29
|
+
*/
|
|
30
|
+
contains(name: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Adds a graph node, or a nested cycle, to this group.
|
|
33
|
+
*
|
|
34
|
+
* @param {import('..').PackageGraphNode | CyclicPackageGraphNode} node
|
|
35
|
+
*/
|
|
36
|
+
insert(node: PackageGraphNode | CyclicPackageGraphNode): void;
|
|
37
|
+
/**
|
|
38
|
+
* Remove pointers to candidate node from internal collections.
|
|
39
|
+
* @param {import('..').PackageGraphNode | CyclicPackageGraphNode} candidateNode instance to unlink
|
|
40
|
+
*/
|
|
41
|
+
unlink(candidateNode: PackageGraphNode | CyclicPackageGraphNode): void;
|
|
42
|
+
}
|
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CyclicPackageGraphNode = void 0;
|
|
4
|
-
let lastCollapsedNodeId = 0;
|
|
5
|
-
/**
|
|
6
|
-
* Represents a cyclic collection of nodes in a PackageGraph.
|
|
7
|
-
* It is meant to be used as a black box, where the only exposed
|
|
8
|
-
* information are the connections to the other nodes of the graph.
|
|
9
|
-
* It can contain either `PackageGraphNode`s or other `CyclicPackageGraphNode`s.
|
|
10
|
-
*
|
|
11
|
-
* @extends {Map<string, import('..').PackageGraphNode | CyclicPackageGraphNode>}
|
|
12
|
-
*/
|
|
13
|
-
class CyclicPackageGraphNode extends Map {
|
|
14
|
-
constructor() {
|
|
15
|
-
super();
|
|
16
|
-
this.name = `(cycle) ${(lastCollapsedNodeId += 1)}`;
|
|
17
|
-
this.localDependencies = new Map();
|
|
18
|
-
this.localDependents = new Map();
|
|
19
|
-
}
|
|
20
|
-
// eslint-disable-next-line class-methods-use-this
|
|
21
|
-
get isCycle() {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @returns {string} A representation of a cycle, like like `A -> B -> C -> A`.
|
|
26
|
-
*/
|
|
27
|
-
toString() {
|
|
28
|
-
const parts = Array.from(this, ([key, node]) => node.isCycle ? `(nested cycle: ${node.toString()})` : key);
|
|
29
|
-
// start from the origin
|
|
30
|
-
parts.push(parts[0]);
|
|
31
|
-
return parts.reverse().join(' -> ');
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Flattens a CyclicPackageGraphNode (which can have multiple level of cycles).
|
|
35
|
-
*/
|
|
36
|
-
flatten() {
|
|
37
|
-
const result = [];
|
|
38
|
-
for (const node of this.values()) {
|
|
39
|
-
if (node.isCycle) {
|
|
40
|
-
result.push(...node.flatten());
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
result.push(node);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Checks if a given node is contained in this cycle (or in a nested one)
|
|
50
|
-
*
|
|
51
|
-
* @param {string} name The name of the package to search in this cycle
|
|
52
|
-
* @returns {boolean}
|
|
53
|
-
*/
|
|
54
|
-
contains(name) {
|
|
55
|
-
for (const [currentName, currentNode] of this) {
|
|
56
|
-
if (currentNode.isCycle) {
|
|
57
|
-
if (currentNode.contains(name)) {
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else if (currentName === name) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Adds a graph node, or a nested cycle, to this group.
|
|
69
|
-
*
|
|
70
|
-
* @param {import('..').PackageGraphNode | CyclicPackageGraphNode} node
|
|
71
|
-
*/
|
|
72
|
-
insert(node) {
|
|
73
|
-
this.set(node.name, node);
|
|
74
|
-
this.unlink(node);
|
|
75
|
-
for (const [dependencyName, dependencyNode] of node.localDependencies) {
|
|
76
|
-
if (!this.contains(dependencyName)) {
|
|
77
|
-
this.localDependencies.set(dependencyName, dependencyNode);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
for (const [dependentName, dependentNode] of node.localDependents) {
|
|
81
|
-
if (!this.contains(dependentName)) {
|
|
82
|
-
this.localDependents.set(dependentName, dependentNode);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Remove pointers to candidate node from internal collections.
|
|
88
|
-
* @param {import('..').PackageGraphNode | CyclicPackageGraphNode} candidateNode instance to unlink
|
|
89
|
-
*/
|
|
90
|
-
unlink(candidateNode) {
|
|
91
|
-
// remove incoming edges ("indegree")
|
|
92
|
-
this.localDependencies.delete(candidateNode.name);
|
|
93
|
-
// remove outgoing edges ("outdegree")
|
|
94
|
-
this.localDependents.delete(candidateNode.name);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
exports.CyclicPackageGraphNode = CyclicPackageGraphNode;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CyclicPackageGraphNode = void 0;
|
|
4
|
+
let lastCollapsedNodeId = 0;
|
|
5
|
+
/**
|
|
6
|
+
* Represents a cyclic collection of nodes in a PackageGraph.
|
|
7
|
+
* It is meant to be used as a black box, where the only exposed
|
|
8
|
+
* information are the connections to the other nodes of the graph.
|
|
9
|
+
* It can contain either `PackageGraphNode`s or other `CyclicPackageGraphNode`s.
|
|
10
|
+
*
|
|
11
|
+
* @extends {Map<string, import('..').PackageGraphNode | CyclicPackageGraphNode>}
|
|
12
|
+
*/
|
|
13
|
+
class CyclicPackageGraphNode extends Map {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.name = `(cycle) ${(lastCollapsedNodeId += 1)}`;
|
|
17
|
+
this.localDependencies = new Map();
|
|
18
|
+
this.localDependents = new Map();
|
|
19
|
+
}
|
|
20
|
+
// eslint-disable-next-line class-methods-use-this
|
|
21
|
+
get isCycle() {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @returns {string} A representation of a cycle, like like `A -> B -> C -> A`.
|
|
26
|
+
*/
|
|
27
|
+
toString() {
|
|
28
|
+
const parts = Array.from(this, ([key, node]) => node.isCycle ? `(nested cycle: ${node.toString()})` : key);
|
|
29
|
+
// start from the origin
|
|
30
|
+
parts.push(parts[0]);
|
|
31
|
+
return parts.reverse().join(' -> ');
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Flattens a CyclicPackageGraphNode (which can have multiple level of cycles).
|
|
35
|
+
*/
|
|
36
|
+
flatten() {
|
|
37
|
+
const result = [];
|
|
38
|
+
for (const node of this.values()) {
|
|
39
|
+
if (node.isCycle) {
|
|
40
|
+
result.push(...node.flatten());
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
result.push(node);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Checks if a given node is contained in this cycle (or in a nested one)
|
|
50
|
+
*
|
|
51
|
+
* @param {string} name The name of the package to search in this cycle
|
|
52
|
+
* @returns {boolean}
|
|
53
|
+
*/
|
|
54
|
+
contains(name) {
|
|
55
|
+
for (const [currentName, currentNode] of this) {
|
|
56
|
+
if (currentNode.isCycle) {
|
|
57
|
+
if (currentNode.contains(name)) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else if (currentName === name) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Adds a graph node, or a nested cycle, to this group.
|
|
69
|
+
*
|
|
70
|
+
* @param {import('..').PackageGraphNode | CyclicPackageGraphNode} node
|
|
71
|
+
*/
|
|
72
|
+
insert(node) {
|
|
73
|
+
this.set(node.name, node);
|
|
74
|
+
this.unlink(node);
|
|
75
|
+
for (const [dependencyName, dependencyNode] of node.localDependencies) {
|
|
76
|
+
if (!this.contains(dependencyName)) {
|
|
77
|
+
this.localDependencies.set(dependencyName, dependencyNode);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
for (const [dependentName, dependentNode] of node.localDependents) {
|
|
81
|
+
if (!this.contains(dependentName)) {
|
|
82
|
+
this.localDependents.set(dependentName, dependentNode);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Remove pointers to candidate node from internal collections.
|
|
88
|
+
* @param {import('..').PackageGraphNode | CyclicPackageGraphNode} candidateNode instance to unlink
|
|
89
|
+
*/
|
|
90
|
+
unlink(candidateNode) {
|
|
91
|
+
// remove incoming edges ("indegree")
|
|
92
|
+
this.localDependencies.delete(candidateNode.name);
|
|
93
|
+
// remove outgoing edges ("outdegree")
|
|
94
|
+
this.localDependents.delete(candidateNode.name);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.CyclicPackageGraphNode = CyclicPackageGraphNode;
|
|
98
98
|
//# sourceMappingURL=cyclic-package-graph-node.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './cyclic-package-graph-node';
|
|
2
|
-
export * from './package-graph-node';
|
|
3
|
-
export * from './report-cycles';
|
|
1
|
+
export * from './cyclic-package-graph-node';
|
|
2
|
+
export * from './package-graph-node';
|
|
3
|
+
export * from './report-cycles';
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./cyclic-package-graph-node"), exports);
|
|
18
|
-
__exportStar(require("./package-graph-node"), exports);
|
|
19
|
-
__exportStar(require("./report-cycles"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cyclic-package-graph-node"), exports);
|
|
18
|
+
__exportStar(require("./package-graph-node"), exports);
|
|
19
|
+
__exportStar(require("./report-cycles"), exports);
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Result } from 'npm-package-arg';
|
|
2
|
-
import { Package } from '../../package';
|
|
3
|
-
/**
|
|
4
|
-
* A node in a PackageGraph.
|
|
5
|
-
*/
|
|
6
|
-
export declare class PackageGraphNode {
|
|
7
|
-
name: string;
|
|
8
|
-
externalDependencies: Map<string, any>;
|
|
9
|
-
localDependencies: Map<string, any>;
|
|
10
|
-
localDependents: Map<string, any>;
|
|
11
|
-
/**
|
|
12
|
-
* @param {import("@lerna/package").Package} pkg
|
|
13
|
-
*/
|
|
14
|
-
constructor(pkg: Package);
|
|
15
|
-
get location(): string;
|
|
16
|
-
get pkg(): Package;
|
|
17
|
-
get prereleaseId(): string | undefined;
|
|
18
|
-
get version(): string;
|
|
19
|
-
/**
|
|
20
|
-
* Determine if the Node satisfies a resolved semver range.
|
|
21
|
-
* @see https://github.com/npm/npm-package-arg#result-object
|
|
22
|
-
*
|
|
23
|
-
* @param {!Result} resolved npm-package-arg Result object
|
|
24
|
-
* @returns {Boolean}
|
|
25
|
-
*/
|
|
26
|
-
satisfies({ gitCommittish, gitRange, fetchSpec }: Partial<Result>): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Returns a string representation of this node (its name)
|
|
29
|
-
*
|
|
30
|
-
* @returns {String}
|
|
31
|
-
*/
|
|
32
|
-
toString(): string;
|
|
33
|
-
}
|
|
1
|
+
import { Result } from 'npm-package-arg';
|
|
2
|
+
import { Package } from '../../package';
|
|
3
|
+
/**
|
|
4
|
+
* A node in a PackageGraph.
|
|
5
|
+
*/
|
|
6
|
+
export declare class PackageGraphNode {
|
|
7
|
+
name: string;
|
|
8
|
+
externalDependencies: Map<string, any>;
|
|
9
|
+
localDependencies: Map<string, any>;
|
|
10
|
+
localDependents: Map<string, any>;
|
|
11
|
+
/**
|
|
12
|
+
* @param {import("@lerna/package").Package} pkg
|
|
13
|
+
*/
|
|
14
|
+
constructor(pkg: Package);
|
|
15
|
+
get location(): string;
|
|
16
|
+
get pkg(): Package;
|
|
17
|
+
get prereleaseId(): string | undefined;
|
|
18
|
+
get version(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Determine if the Node satisfies a resolved semver range.
|
|
21
|
+
* @see https://github.com/npm/npm-package-arg#result-object
|
|
22
|
+
*
|
|
23
|
+
* @param {!Result} resolved npm-package-arg Result object
|
|
24
|
+
* @returns {Boolean}
|
|
25
|
+
*/
|
|
26
|
+
satisfies({ gitCommittish, gitRange, fetchSpec }: Partial<Result>): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Returns a string representation of this node (its name)
|
|
29
|
+
*
|
|
30
|
+
* @returns {String}
|
|
31
|
+
*/
|
|
32
|
+
toString(): string;
|
|
33
|
+
}
|