@lerna-lite/core 0.3.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/LICENSE +20 -0
- package/README.md +16 -0
- package/dist/child-process.d.ts +13 -0
- package/dist/child-process.js +129 -0
- package/dist/child-process.js.map +1 -0
- package/dist/command.d.ts +37 -0
- package/dist/command.js +269 -0
- package/dist/command.js.map +1 -0
- package/dist/conventional-commits/constants.d.ts +4 -0
- package/dist/conventional-commits/constants.js +13 -0
- package/dist/conventional-commits/constants.js.map +1 -0
- package/dist/conventional-commits/get-changelog-config.d.ts +12 -0
- package/dist/conventional-commits/get-changelog-config.js +92 -0
- package/dist/conventional-commits/get-changelog-config.js.map +1 -0
- package/dist/conventional-commits/index.d.ts +6 -0
- package/dist/conventional-commits/index.js +19 -0
- package/dist/conventional-commits/index.js.map +1 -0
- package/dist/conventional-commits/make-bump-only-filter.d.ts +6 -0
- package/dist/conventional-commits/make-bump-only-filter.js +23 -0
- package/dist/conventional-commits/make-bump-only-filter.js.map +1 -0
- package/dist/conventional-commits/read-existing-changelog.d.ts +7 -0
- package/dist/conventional-commits/read-existing-changelog.js +33 -0
- package/dist/conventional-commits/read-existing-changelog.js.map +1 -0
- package/dist/conventional-commits/recommend-version.d.ts +10 -0
- package/dist/conventional-commits/recommend-version.js +87 -0
- package/dist/conventional-commits/recommend-version.js.map +1 -0
- package/dist/conventional-commits/update-changelog.d.ts +11 -0
- package/dist/conventional-commits/update-changelog.js +84 -0
- package/dist/conventional-commits/update-changelog.js.map +1 -0
- package/dist/git-clients/github-client.d.ts +6 -0
- package/dist/git-clients/github-client.js +41 -0
- package/dist/git-clients/github-client.js.map +1 -0
- package/dist/git-clients/gitlab-client.d.ts +5 -0
- package/dist/git-clients/gitlab-client.js +53 -0
- package/dist/git-clients/gitlab-client.js.map +1 -0
- package/dist/git-clients/index.d.ts +2 -0
- package/dist/git-clients/index.js +15 -0
- package/dist/git-clients/index.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/models/index.d.ts +97 -0
- package/dist/models/index.js +3 -0
- package/dist/models/index.js.map +1 -0
- package/dist/otplease.d.ts +13 -0
- package/dist/otplease.js +110 -0
- package/dist/otplease.js.map +1 -0
- package/dist/package-graph/index.d.ts +2 -0
- package/dist/package-graph/index.js +15 -0
- package/dist/package-graph/index.js.map +1 -0
- package/dist/package-graph/lib/cyclic-package-graph-node.d.ts +41 -0
- package/dist/package-graph/lib/cyclic-package-graph-node.js +101 -0
- package/dist/package-graph/lib/cyclic-package-graph-node.js.map +1 -0
- package/dist/package-graph/lib/index.d.ts +3 -0
- package/dist/package-graph/lib/index.js +16 -0
- package/dist/package-graph/lib/index.js.map +1 -0
- package/dist/package-graph/lib/package-graph-node.d.ts +35 -0
- package/dist/package-graph/lib/package-graph-node.js +61 -0
- package/dist/package-graph/lib/package-graph-node.js.map +1 -0
- package/dist/package-graph/lib/report-cycles.d.ts +1 -0
- package/dist/package-graph/lib/report-cycles.js +20 -0
- package/dist/package-graph/lib/report-cycles.js.map +1 -0
- package/dist/package-graph/package-graph.d.ts +78 -0
- package/dist/package-graph/package-graph.js +256 -0
- package/dist/package-graph/package-graph.js.map +1 -0
- package/dist/package.d.ts +96 -0
- package/dist/package.js +260 -0
- package/dist/package.js.map +1 -0
- package/dist/project/index.d.ts +2 -0
- package/dist/project/index.js +15 -0
- package/dist/project/index.js.map +1 -0
- package/dist/project/lib/apply-extends.d.ts +6 -0
- package/dist/project/lib/apply-extends.js +38 -0
- package/dist/project/lib/apply-extends.js.map +1 -0
- package/dist/project/lib/index.d.ts +3 -0
- package/dist/project/lib/index.js +16 -0
- package/dist/project/lib/index.js.map +1 -0
- package/dist/project/lib/make-file-finder.d.ts +2 -0
- package/dist/project/lib/make-file-finder.js +72 -0
- package/dist/project/lib/make-file-finder.js.map +1 -0
- package/dist/project/lib/shallow-extend.d.ts +5 -0
- package/dist/project/lib/shallow-extend.js +25 -0
- package/dist/project/lib/shallow-extend.js.map +1 -0
- package/dist/project/project.d.ts +50 -0
- package/dist/project/project.js +193 -0
- package/dist/project/project.js.map +1 -0
- package/dist/prompt.d.ts +5 -0
- package/dist/prompt.js +65 -0
- package/dist/prompt.js.map +1 -0
- package/dist/utils/check-working-tree.d.ts +8 -0
- package/dist/utils/check-working-tree.js +42 -0
- package/dist/utils/check-working-tree.js.map +1 -0
- package/dist/utils/clean-stack.d.ts +5 -0
- package/dist/utils/clean-stack.js +19 -0
- package/dist/utils/clean-stack.js.map +1 -0
- package/dist/utils/collect-dependents.d.ts +11 -0
- package/dist/utils/collect-dependents.js +46 -0
- package/dist/utils/collect-dependents.js.map +1 -0
- package/dist/utils/collect-uncommitted.d.ts +19 -0
- package/dist/utils/collect-uncommitted.js +46 -0
- package/dist/utils/collect-uncommitted.js.map +1 -0
- package/dist/utils/collect-updates/collect-updates.d.ts +25 -0
- package/dist/utils/collect-updates/collect-updates.js +100 -0
- package/dist/utils/collect-updates/collect-updates.js.map +1 -0
- package/dist/utils/collect-updates/index.d.ts +2 -0
- package/dist/utils/collect-updates/index.js +15 -0
- package/dist/utils/collect-updates/index.js.map +1 -0
- package/dist/utils/collect-updates/lib/collect-packages.d.ts +13 -0
- package/dist/utils/collect-updates/lib/collect-packages.js +34 -0
- package/dist/utils/collect-updates/lib/collect-packages.js.map +1 -0
- package/dist/utils/collect-updates/lib/get-packages-for-option.d.ts +5 -0
- package/dist/utils/collect-updates/lib/get-packages-for-option.js +31 -0
- package/dist/utils/collect-updates/lib/get-packages-for-option.js.map +1 -0
- package/dist/utils/collect-updates/lib/has-tags.d.ts +5 -0
- package/dist/utils/collect-updates/lib/has-tags.js +27 -0
- package/dist/utils/collect-updates/lib/has-tags.js.map +1 -0
- package/dist/utils/collect-updates/lib/index.d.ts +4 -0
- package/dist/utils/collect-updates/lib/index.js +17 -0
- package/dist/utils/collect-updates/lib/index.js.map +1 -0
- package/dist/utils/collect-updates/lib/make-diff-predicate.d.ts +6 -0
- package/dist/utils/collect-updates/lib/make-diff-predicate.js +65 -0
- package/dist/utils/collect-updates/lib/make-diff-predicate.js.map +1 -0
- package/dist/utils/conf.d.ts +23 -0
- package/dist/utils/conf.js +256 -0
- package/dist/utils/conf.js.map +1 -0
- package/dist/utils/defaults.d.ts +1 -0
- package/dist/utils/defaults.js +182 -0
- package/dist/utils/defaults.js.map +1 -0
- package/dist/utils/describe-ref.d.ts +24 -0
- package/dist/utils/describe-ref.js +81 -0
- package/dist/utils/describe-ref.js.map +1 -0
- package/dist/utils/env-replace.d.ts +1 -0
- package/dist/utils/env-replace.js +23 -0
- package/dist/utils/env-replace.js.map +1 -0
- package/dist/utils/find-prefix.d.ts +2 -0
- package/dist/utils/find-prefix.js +49 -0
- package/dist/utils/find-prefix.js.map +1 -0
- package/dist/utils/format-error.d.ts +7 -0
- package/dist/utils/format-error.js +20 -0
- package/dist/utils/format-error.js.map +1 -0
- package/dist/utils/index.d.ts +23 -0
- package/dist/utils/index.js +36 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/log-package-error.d.ts +5 -0
- package/dist/utils/log-package-error.js +36 -0
- package/dist/utils/log-package-error.js.map +1 -0
- package/dist/utils/nerf-dart.d.ts +1 -0
- package/dist/utils/nerf-dart.js +19 -0
- package/dist/utils/nerf-dart.js.map +1 -0
- package/dist/utils/npm-conf.d.ts +2 -0
- package/dist/utils/npm-conf.js +54 -0
- package/dist/utils/npm-conf.js.map +1 -0
- package/dist/utils/parse-field.d.ts +1 -0
- package/dist/utils/parse-field.js +66 -0
- package/dist/utils/parse-field.js.map +1 -0
- package/dist/utils/prerelease-id-from-version.d.ts +5 -0
- package/dist/utils/prerelease-id-from-version.js +16 -0
- package/dist/utils/prerelease-id-from-version.js.map +1 -0
- package/dist/utils/pulse-till-done.d.ts +1 -0
- package/dist/utils/pulse-till-done.js +41 -0
- package/dist/utils/pulse-till-done.js.map +1 -0
- package/dist/utils/query-graph.d.ts +36 -0
- package/dist/utils/query-graph.js +78 -0
- package/dist/utils/query-graph.js.map +1 -0
- package/dist/utils/run-lifecycle.d.ts +10 -0
- package/dist/utils/run-lifecycle.js +109 -0
- package/dist/utils/run-lifecycle.js.map +1 -0
- package/dist/utils/run-topologically.d.ts +12 -0
- package/dist/utils/run-topologically.js +37 -0
- package/dist/utils/run-topologically.js.map +1 -0
- package/dist/utils/types.d.ts +128 -0
- package/dist/utils/types.js +138 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/warn-if-hanging.d.ts +1 -0
- package/dist/utils/warn-if-hanging.js +18 -0
- package/dist/utils/warn-if-hanging.js.map +1 -0
- package/dist/utils/write-log-file.d.ts +1 -0
- package/dist/utils/write-log-file.js +33 -0
- package/dist/utils/write-log-file.js.map +1 -0
- package/dist/validation-error.d.ts +4 -0
- package/dist/validation-error.js +19 -0
- package/dist/validation-error.js.map +1 -0
- package/package.json +110 -0
package/dist/otplease.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOneTimePassword = exports.otplease = void 0;
|
|
4
|
+
const prompt_1 = require("./prompt");
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {object} OneTimePasswordCache - Passed between concurrent executions
|
|
7
|
+
* @property {string} [otp] The one-time password, passed as an option or received via prompt
|
|
8
|
+
*/
|
|
9
|
+
// basic single-entry semaphore
|
|
10
|
+
const semaphore = {
|
|
11
|
+
wait() {
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
if (!this._promise) {
|
|
14
|
+
// not waiting, block other callers until 'release' is called.
|
|
15
|
+
this._promise = new Promise((release) => {
|
|
16
|
+
this._resolve = release;
|
|
17
|
+
});
|
|
18
|
+
resolve(undefined);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
// wait for 'release' to be called and try to lock the semaphore again.
|
|
22
|
+
resolve(this._promise.then(() => this.wait()));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
release() {
|
|
27
|
+
const resolve = this._resolve;
|
|
28
|
+
// istanbul ignore else
|
|
29
|
+
if (resolve) {
|
|
30
|
+
this._resolve = undefined;
|
|
31
|
+
this._promise = undefined;
|
|
32
|
+
// notify waiters that the semaphore has been released.
|
|
33
|
+
resolve();
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Attempt to execute Promise callback, prompting for OTP if necessary.
|
|
39
|
+
* @template {Record<string, unknown>} T
|
|
40
|
+
* @param {(opts: T) => Promise<unknown>} fn
|
|
41
|
+
* @param {T} _opts The options to be passed to `fn`
|
|
42
|
+
* @param {OneTimePasswordCache} otpCache
|
|
43
|
+
*/
|
|
44
|
+
function otplease(fn, _opts, otpCache) {
|
|
45
|
+
// always prefer explicit config (if present) to cache
|
|
46
|
+
const opts = { ...otpCache, ..._opts };
|
|
47
|
+
return attempt(fn, opts, otpCache);
|
|
48
|
+
}
|
|
49
|
+
exports.otplease = otplease;
|
|
50
|
+
/** @returns {Promise<unknown>} */
|
|
51
|
+
function attempt(fn, opts, otpCache) {
|
|
52
|
+
return new Promise((resolve) => {
|
|
53
|
+
resolve(fn(opts));
|
|
54
|
+
}).catch((err) => {
|
|
55
|
+
if (err.code !== 'EOTP' && !(err.code === 'E401' && /one-time pass/.test(err.body))) {
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
else if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
59
|
+
throw err;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// check the cache in case a concurrent caller has already updated the otp.
|
|
63
|
+
if (otpCache !== null && otpCache.otp !== null && otpCache.otp !== opts.otp) {
|
|
64
|
+
return attempt(fn, { ...opts, ...otpCache }, otpCache);
|
|
65
|
+
}
|
|
66
|
+
// only allow one getOneTimePassword attempt at a time to reuse the value
|
|
67
|
+
// from the preceeding prompt
|
|
68
|
+
return semaphore.wait().then(() => {
|
|
69
|
+
// check the cache again in case a previous waiter already updated it.
|
|
70
|
+
if (otpCache !== null && otpCache.otp !== null && otpCache.otp !== opts.otp) {
|
|
71
|
+
semaphore.release();
|
|
72
|
+
return attempt(fn, { ...opts, ...otpCache }, otpCache);
|
|
73
|
+
}
|
|
74
|
+
return getOneTimePassword()
|
|
75
|
+
.then((otp) => {
|
|
76
|
+
// update the otp and release the lock so that waiting
|
|
77
|
+
// callers can see the updated otp.
|
|
78
|
+
if (otpCache !== null) {
|
|
79
|
+
// eslint-disable-next-line no-param-reassign
|
|
80
|
+
otpCache.otp = otp;
|
|
81
|
+
}
|
|
82
|
+
semaphore.release();
|
|
83
|
+
return otp;
|
|
84
|
+
}, (promptError) => {
|
|
85
|
+
// release the lock and reject the promise.
|
|
86
|
+
semaphore.release();
|
|
87
|
+
return Promise.reject(promptError);
|
|
88
|
+
})
|
|
89
|
+
.then((otp) => {
|
|
90
|
+
return fn({ ...opts, otp });
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Prompt user for one-time password.
|
|
98
|
+
* @returns {Promise<string>}
|
|
99
|
+
*/
|
|
100
|
+
function getOneTimePassword(message = 'This operation requires a one-time password:') {
|
|
101
|
+
// Logic taken from npm internals: https://git.io/fNoMe
|
|
102
|
+
return prompt_1.PromptUtilities.input(message, {
|
|
103
|
+
filter: (otp) => otp.replace(/\s+/g, ''),
|
|
104
|
+
validate: (otp) => (otp && /^[\d ]+$|^[A-Fa-f0-9]{64,64}$/.test(otp)) ||
|
|
105
|
+
'Must be a valid one-time-password. ' +
|
|
106
|
+
'See https://docs.npmjs.com/getting-started/using-two-factor-authentication',
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
exports.getOneTimePassword = getOneTimePassword;
|
|
110
|
+
//# sourceMappingURL=otplease.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otplease.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BAC7C,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;qBACpB;oBACD,SAAS,CAAC,OAAO,EAAE,CAAC;oBACpB,OAAO,GAAG,CAAC;gBACb,CAAC,EACD,CAAC,WAAW,EAAE,EAAE;oBACd,2CAA2C;oBAC3C,SAAS,CAAC,OAAO,EAAE,CAAC;oBACpB,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;gBACrC,CAAC,CACF;qBACA,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;oBACZ,OAAO,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;gBAC9B,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,OAAO,GAAG,8CAA8C;IACzF,uDAAuD;IACvD,OAAO,wBAAe,CAAC,KAAK,CAAC,OAAO,EAAE;QACpC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;QACxC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAChB,CAAC,GAAG,IAAI,+BAA+B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClD,qCAAqC;gBACrC,4EAA4E;KAC/E,CAAC,CAAC;AACL,CAAC;AATD,gDASC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./package-graph"), exports);
|
|
14
|
+
__exportStar(require("./lib"), exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/package-graph/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAgC;AAChC,wCAAsB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a cyclic collection of nodes in a PackageGraph.
|
|
3
|
+
* It is meant to be used as a black box, where the only exposed
|
|
4
|
+
* information are the connections to the other nodes of the graph.
|
|
5
|
+
* It can contain either `PackageGraphNode`s or other `CyclicPackageGraphNode`s.
|
|
6
|
+
*
|
|
7
|
+
* @extends {Map<string, import('..').PackageGraphNode | CyclicPackageGraphNode>}
|
|
8
|
+
*/
|
|
9
|
+
export declare class CyclicPackageGraphNode extends Map {
|
|
10
|
+
name: string;
|
|
11
|
+
localDependencies: Map<string, any>;
|
|
12
|
+
localDependents: Map<string, any>;
|
|
13
|
+
constructor();
|
|
14
|
+
get isCycle(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @returns {string} A representation of a cycle, like like `A -> B -> C -> A`.
|
|
17
|
+
*/
|
|
18
|
+
toString(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Flattens a CyclicPackageGraphNode (which can have multiple level of cycles).
|
|
21
|
+
*/
|
|
22
|
+
flatten(): any[];
|
|
23
|
+
/**
|
|
24
|
+
* Checks if a given node is contained in this cycle (or in a nested one)
|
|
25
|
+
*
|
|
26
|
+
* @param {string} name The name of the package to search in this cycle
|
|
27
|
+
* @returns {boolean}
|
|
28
|
+
*/
|
|
29
|
+
contains(name: any): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Adds a graph node, or a nested cycle, to this group.
|
|
32
|
+
*
|
|
33
|
+
* @param {import('..').PackageGraphNode | CyclicPackageGraphNode} node
|
|
34
|
+
*/
|
|
35
|
+
insert(node: any): void;
|
|
36
|
+
/**
|
|
37
|
+
* Remove pointers to candidate node from internal collections.
|
|
38
|
+
* @param {import('..').PackageGraphNode | CyclicPackageGraphNode} candidateNode instance to unlink
|
|
39
|
+
*/
|
|
40
|
+
unlink(candidateNode: any): void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
/** @type {Map<string, import('..').PackageGraphNode | CyclicPackageGraphNode>} */
|
|
18
|
+
this.localDependencies = new Map();
|
|
19
|
+
/** @type {Map<string, import('..').PackageGraphNode | CyclicPackageGraphNode>} */
|
|
20
|
+
this.localDependents = new Map();
|
|
21
|
+
}
|
|
22
|
+
// eslint-disable-next-line class-methods-use-this
|
|
23
|
+
get isCycle() {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @returns {string} A representation of a cycle, like like `A -> B -> C -> A`.
|
|
28
|
+
*/
|
|
29
|
+
toString() {
|
|
30
|
+
const parts = Array.from(this, ([key, node]) => node.isCycle ? `(nested cycle: ${node.toString()})` : key);
|
|
31
|
+
// start from the origin
|
|
32
|
+
parts.push(parts[0]);
|
|
33
|
+
return parts.reverse().join(' -> ');
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Flattens a CyclicPackageGraphNode (which can have multiple level of cycles).
|
|
37
|
+
*/
|
|
38
|
+
flatten() {
|
|
39
|
+
/** @type {import('..').PackageGraphNode[]} */
|
|
40
|
+
const result = [];
|
|
41
|
+
for (const node of this.values()) {
|
|
42
|
+
if (node.isCycle) {
|
|
43
|
+
result.push(...node.flatten());
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
result.push(node);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Checks if a given node is contained in this cycle (or in a nested one)
|
|
53
|
+
*
|
|
54
|
+
* @param {string} name The name of the package to search in this cycle
|
|
55
|
+
* @returns {boolean}
|
|
56
|
+
*/
|
|
57
|
+
contains(name) {
|
|
58
|
+
for (const [currentName, currentNode] of this) {
|
|
59
|
+
if (currentNode.isCycle) {
|
|
60
|
+
if (currentNode.contains(name)) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else if (currentName === name) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Adds a graph node, or a nested cycle, to this group.
|
|
72
|
+
*
|
|
73
|
+
* @param {import('..').PackageGraphNode | CyclicPackageGraphNode} node
|
|
74
|
+
*/
|
|
75
|
+
insert(node) {
|
|
76
|
+
this.set(node.name, node);
|
|
77
|
+
this.unlink(node);
|
|
78
|
+
for (const [dependencyName, dependencyNode] of node.localDependencies) {
|
|
79
|
+
if (!this.contains(dependencyName)) {
|
|
80
|
+
this.localDependencies.set(dependencyName, dependencyNode);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
for (const [dependentName, dependentNode] of node.localDependents) {
|
|
84
|
+
if (!this.contains(dependentName)) {
|
|
85
|
+
this.localDependents.set(dependentName, dependentNode);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Remove pointers to candidate node from internal collections.
|
|
91
|
+
* @param {import('..').PackageGraphNode | CyclicPackageGraphNode} candidateNode instance to unlink
|
|
92
|
+
*/
|
|
93
|
+
unlink(candidateNode) {
|
|
94
|
+
// remove incoming edges ("indegree")
|
|
95
|
+
this.localDependencies.delete(candidateNode.name);
|
|
96
|
+
// remove outgoing edges ("outdegree")
|
|
97
|
+
this.localDependents.delete(candidateNode.name);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.CyclicPackageGraphNode = CyclicPackageGraphNode;
|
|
101
|
+
//# sourceMappingURL=cyclic-package-graph-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cyclic-package-graph-node.js","sourceRoot":"","sources":["../../../src/package-graph/lib/cyclic-package-graph-node.ts"],"names":[],"mappings":";;;AAAA,IAAI,mBAAmB,GAAG,CAAC,CAAC;AAE5B;;;;;;;GAOG;AACH,MAAa,sBAAuB,SAAQ,GAAG;IAK7C;QACE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,mBAAmB,IAAI,CAAC,CAAC,EAAE,CAAC;QAEpD,kFAAkF;QAClF,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAC;QAEnC,kFAAkF;QAClF,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;IACnC,CAAC;IAED,kDAAkD;IAClD,IAAI,OAAO;QACT,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CA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AAE,cAAc,CAAC,IAAI,IAAI,CAAC,iBAAiB,EAAE;YACrE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;gBAClC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;aAC5D;SACF;QAED,KAAK,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE;YACjE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;gBACjC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;aACxD;SACF;IACH,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,aAAa;QAClB,qCAAqC;QACrC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAElD,sCAAsC;QACtC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;CACF;AA1GD,wDA0GC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./cyclic-package-graph-node"), exports);
|
|
14
|
+
__exportStar(require("./package-graph-node"), exports);
|
|
15
|
+
__exportStar(require("./report-cycles"), exports);
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/package-graph/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8DAA4C;AAC5C,uDAAqC;AACrC,kDAAgC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A node in a PackageGraph.
|
|
3
|
+
*/
|
|
4
|
+
export declare class PackageGraphNode {
|
|
5
|
+
name: string;
|
|
6
|
+
externalDependencies: Map<string, any>;
|
|
7
|
+
localDependencies: Map<string, any>;
|
|
8
|
+
localDependents: Map<string, any>;
|
|
9
|
+
/**
|
|
10
|
+
* @param {import("@lerna/package").Package} pkg
|
|
11
|
+
*/
|
|
12
|
+
constructor(pkg: any);
|
|
13
|
+
get location(): any;
|
|
14
|
+
get pkg(): any;
|
|
15
|
+
get prereleaseId(): string | undefined;
|
|
16
|
+
get version(): any;
|
|
17
|
+
/**
|
|
18
|
+
* Determine if the Node satisfies a resolved semver range.
|
|
19
|
+
* @see https://github.com/npm/npm-package-arg#result-object
|
|
20
|
+
*
|
|
21
|
+
* @param {!Result} resolved npm-package-arg Result object
|
|
22
|
+
* @returns {Boolean}
|
|
23
|
+
*/
|
|
24
|
+
satisfies({ gitCommittish, gitRange, fetchSpec }: {
|
|
25
|
+
gitCommittish: any;
|
|
26
|
+
gitRange: any;
|
|
27
|
+
fetchSpec: any;
|
|
28
|
+
}): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Returns a string representation of this node (its name)
|
|
31
|
+
*
|
|
32
|
+
* @returns {String}
|
|
33
|
+
*/
|
|
34
|
+
toString(): string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PackageGraphNode = void 0;
|
|
7
|
+
const semver_1 = __importDefault(require("semver"));
|
|
8
|
+
const prerelease_id_from_version_1 = require("../../utils/prerelease-id-from-version");
|
|
9
|
+
const PKG = Symbol('pkg');
|
|
10
|
+
/**
|
|
11
|
+
* A node in a PackageGraph.
|
|
12
|
+
*/
|
|
13
|
+
class PackageGraphNode {
|
|
14
|
+
/**
|
|
15
|
+
* @param {import("@lerna/package").Package} pkg
|
|
16
|
+
*/
|
|
17
|
+
constructor(pkg) {
|
|
18
|
+
this.name = pkg.name;
|
|
19
|
+
this[PKG] = pkg;
|
|
20
|
+
// omit raw pkg from default util.inspect() output
|
|
21
|
+
Object.defineProperty(this, PKG, { enumerable: false });
|
|
22
|
+
/** @type {Map<string, import("npm-package-arg").Result>} */
|
|
23
|
+
this.externalDependencies = new Map();
|
|
24
|
+
/** @type {Map<string, import("npm-package-arg").Result>} */
|
|
25
|
+
this.localDependencies = new Map();
|
|
26
|
+
/** @type {Map<string, PackageGraphNode>} */
|
|
27
|
+
this.localDependents = new Map();
|
|
28
|
+
}
|
|
29
|
+
get location() {
|
|
30
|
+
return this[PKG].location;
|
|
31
|
+
}
|
|
32
|
+
get pkg() {
|
|
33
|
+
return this[PKG];
|
|
34
|
+
}
|
|
35
|
+
get prereleaseId() {
|
|
36
|
+
return (0, prerelease_id_from_version_1.prereleaseIdFromVersion)(this.version);
|
|
37
|
+
}
|
|
38
|
+
get version() {
|
|
39
|
+
return this[PKG].version;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Determine if the Node satisfies a resolved semver range.
|
|
43
|
+
* @see https://github.com/npm/npm-package-arg#result-object
|
|
44
|
+
*
|
|
45
|
+
* @param {!Result} resolved npm-package-arg Result object
|
|
46
|
+
* @returns {Boolean}
|
|
47
|
+
*/
|
|
48
|
+
satisfies({ gitCommittish, gitRange, fetchSpec }) {
|
|
49
|
+
return semver_1.default.satisfies(this.version, gitCommittish || gitRange || fetchSpec);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns a string representation of this node (its name)
|
|
53
|
+
*
|
|
54
|
+
* @returns {String}
|
|
55
|
+
*/
|
|
56
|
+
toString() {
|
|
57
|
+
return this.name;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.PackageGraphNode = PackageGraphNode;
|
|
61
|
+
//# sourceMappingURL=package-graph-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-graph-node.js","sourceRoot":"","sources":["../../../src/package-graph/lib/package-graph-node.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,uFAAiF;AAEjF,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAE1B;;GAEG;AACH,MAAa,gBAAgB;IAM3B;;OAEG;IACH,YAAY,GAAG;QACb,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;QAEhB,kDAAkD;QAClD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QAExD,4DAA4D;QAC5D,IAAI,CAAC,oBAAoB,GAAG,IAAI,GAAG,EAAE,CAAC;QAEtC,4DAA4D;QAC5D,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAC;QAEnC,4CAA4C;QAC5C,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;IAC5B,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAA,oDAAuB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;IAC3B,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE;QAC9C,OAAO,gBAAM,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,IAAI,QAAQ,IAAI,SAAS,CAAC,CAAC;IAChF,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AA7DD,4CA6DC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function reportCycles(paths: any, rejectCycles: any): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.reportCycles = void 0;
|
|
7
|
+
const npmlog_1 = __importDefault(require("npmlog"));
|
|
8
|
+
const validation_error_1 = require("../../validation-error");
|
|
9
|
+
function reportCycles(paths, rejectCycles) {
|
|
10
|
+
if (!paths.length) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const cycleMessage = ['Dependency cycles detected, you should fix these!'].concat(paths).join('\n');
|
|
14
|
+
if (rejectCycles) {
|
|
15
|
+
throw new validation_error_1.ValidationError('ECYCLE', cycleMessage);
|
|
16
|
+
}
|
|
17
|
+
npmlog_1.default.warn('ECYCLE', cycleMessage);
|
|
18
|
+
}
|
|
19
|
+
exports.reportCycles = reportCycles;
|
|
20
|
+
//# sourceMappingURL=report-cycles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-cycles.js","sourceRoot":"","sources":["../../../src/package-graph/lib/report-cycles.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAyB;AAEzB,6DAAyD;AAEzD,SAAgB,YAAY,CAAC,KAAK,EAAE,YAAY;IAC9C,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;QACjB,OAAO;KACR;IAED,MAAM,YAAY,GAAG,CAAC,mDAAmD,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEpG,IAAI,YAAY,EAAE;QAChB,MAAM,IAAI,kCAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;KACnD;IAED,gBAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACnC,CAAC;AAZD,oCAYC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Package } from '../package';
|
|
2
|
+
/**
|
|
3
|
+
* A graph of packages in the current project.
|
|
4
|
+
*
|
|
5
|
+
* @extends {Map<string, PackageGraphNode>}
|
|
6
|
+
*/
|
|
7
|
+
export declare class PackageGraph extends Map {
|
|
8
|
+
/**
|
|
9
|
+
* @param {import("@lerna/package").Package[]} packages An array of Packages to build the graph out of.
|
|
10
|
+
* @param {'allDependencies'|'dependencies'} [graphType]
|
|
11
|
+
* Pass "dependencies" to create a graph of only dependencies,
|
|
12
|
+
* excluding the devDependencies that would normally be included.
|
|
13
|
+
* @param {boolean} [forceLocal] Force all local dependencies to be linked.
|
|
14
|
+
*/
|
|
15
|
+
constructor(packages: Package[], graphType?: string, forceLocal?: boolean);
|
|
16
|
+
get rawPackageList(): any[];
|
|
17
|
+
/**
|
|
18
|
+
* Takes a list of Packages and returns a list of those same Packages with any Packages
|
|
19
|
+
* they depend on. i.e if packageA depended on packageB `graph.addDependencies([packageA])`
|
|
20
|
+
* would return [packageA, packageB].
|
|
21
|
+
*
|
|
22
|
+
* @param {import("@lerna/package").Package[]} filteredPackages The packages to include dependencies for.
|
|
23
|
+
*/
|
|
24
|
+
addDependencies(filteredPackages: any): any[];
|
|
25
|
+
/**
|
|
26
|
+
* Takes a list of Packages and returns a list of those same Packages with any Packages
|
|
27
|
+
* that depend on them. i.e if packageC depended on packageD `graph.addDependents([packageD])`
|
|
28
|
+
* would return [packageD, packageC].
|
|
29
|
+
*
|
|
30
|
+
* @param {import("@lerna/package").Package[]} filteredPackages The packages to include dependents for.
|
|
31
|
+
*/
|
|
32
|
+
addDependents(filteredPackages: any): any[];
|
|
33
|
+
/**
|
|
34
|
+
* Extends a list of packages by traversing on a given property, which must refer to a
|
|
35
|
+
* `PackageGraphNode` property that is a collection of `PackageGraphNode`s.
|
|
36
|
+
* Returns input packages with any additional packages found by traversing `nodeProp`.
|
|
37
|
+
*
|
|
38
|
+
* @param {import("@lerna/package").Package[]} packageList The list of packages to extend
|
|
39
|
+
* @param {'localDependencies'|'localDependents'} nodeProp The property on `PackageGraphNode` used to traverse
|
|
40
|
+
*/
|
|
41
|
+
extendList(packageList: any, nodeProp: any): any[];
|
|
42
|
+
/**
|
|
43
|
+
* Return a tuple of cycle paths and nodes.
|
|
44
|
+
*
|
|
45
|
+
* @deprecated Use collapseCycles instead.
|
|
46
|
+
*
|
|
47
|
+
* @param {boolean} rejectCycles Whether or not to reject cycles
|
|
48
|
+
* @returns {[Set<string[]>, Set<PackageGraphNode>]}
|
|
49
|
+
*/
|
|
50
|
+
partitionCycles(rejectCycles: any): Set<unknown>[];
|
|
51
|
+
/**
|
|
52
|
+
* Returns the cycles of this graph. If two cycles share some elements, they will
|
|
53
|
+
* be returned as a single cycle.
|
|
54
|
+
*
|
|
55
|
+
* @param {boolean} rejectCycles Whether or not to reject cycles
|
|
56
|
+
* @returns {Set<CyclicPackageGraphNode>}
|
|
57
|
+
*/
|
|
58
|
+
collapseCycles(rejectCycles: any): Set<unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* Remove cycle nodes.
|
|
61
|
+
*
|
|
62
|
+
* @deprecated Spread set into prune() instead.
|
|
63
|
+
*
|
|
64
|
+
* @param {Set<PackageGraphNode>} cycleNodes
|
|
65
|
+
*/
|
|
66
|
+
pruneCycleNodes(cycleNodes: any): void;
|
|
67
|
+
/**
|
|
68
|
+
* Remove all candidate nodes.
|
|
69
|
+
* @param {PackageGraphNode[]} candidates
|
|
70
|
+
*/
|
|
71
|
+
prune(...candidates: any[]): void;
|
|
72
|
+
/**
|
|
73
|
+
* Delete by value (instead of key), as well as removing pointers
|
|
74
|
+
* to itself in the other node's internal collections.
|
|
75
|
+
* @param {PackageGraphNode} candidateNode instance to remove
|
|
76
|
+
*/
|
|
77
|
+
remove(candidateNode: any): void;
|
|
78
|
+
}
|