@depup/lerna 9.0.5-depup.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 +88 -0
- package/dist/cli.js +50 -0
- package/dist/commands/changed/command.js +5806 -0
- package/dist/commands/changed/index.js +5195 -0
- package/dist/commands/clean/command.js +6271 -0
- package/dist/commands/clean/index.js +6157 -0
- package/dist/commands/diff/command.js +5313 -0
- package/dist/commands/diff/index.js +4742 -0
- package/dist/commands/diff/lib/get-last-commit.js +4240 -0
- package/dist/commands/diff/lib/has-commit.js +4233 -0
- package/dist/commands/exec/command.js +6010 -0
- package/dist/commands/exec/index.js +5337 -0
- package/dist/commands/import/command.js +5500 -0
- package/dist/commands/import/index.js +4931 -0
- package/dist/commands/info/command.js +5229 -0
- package/dist/commands/info/index.js +4685 -0
- package/dist/commands/init/command.js +5440 -0
- package/dist/commands/init/index.js +4872 -0
- package/dist/commands/list/command.js +5974 -0
- package/dist/commands/list/index.js +5309 -0
- package/dist/commands/publish/command.js +9271 -0
- package/dist/commands/publish/index.js +8771 -0
- package/dist/commands/publish/lib/create-temp-licenses.js +64 -0
- package/dist/commands/publish/lib/fetch-config.js +4763 -0
- package/dist/commands/publish/lib/get-current-sha.js +4764 -0
- package/dist/commands/publish/lib/get-current-tags.js +4776 -0
- package/dist/commands/publish/lib/get-npm-username.js +4886 -0
- package/dist/commands/publish/lib/get-packages-without-license.js +53 -0
- package/dist/commands/publish/lib/get-profile-data.js +4802 -0
- package/dist/commands/publish/lib/get-two-factor-auth-required.js +4855 -0
- package/dist/commands/publish/lib/get-whoami.js +4798 -0
- package/dist/commands/publish/lib/git-checkout.js +4761 -0
- package/dist/commands/publish/lib/remove-temp-licenses.js +54 -0
- package/dist/commands/publish/lib/verify-npm-package-access.js +4848 -0
- package/dist/commands/run/command.js +6229 -0
- package/dist/commands/run/index.js +5534 -0
- package/dist/commands/version/command.js +7415 -0
- package/dist/commands/version/index.js +7100 -0
- package/dist/commands/version/lib/create-release.js +4892 -0
- package/dist/commands/version/lib/get-current-branch.js +4764 -0
- package/dist/commands/version/lib/git-add.js +4817 -0
- package/dist/commands/version/lib/git-commit.js +4788 -0
- package/dist/commands/version/lib/git-push.js +4769 -0
- package/dist/commands/version/lib/git-tag.js +4771 -0
- package/dist/commands/version/lib/is-anything-committed.js +4765 -0
- package/dist/commands/version/lib/is-behind-upstream.js +4780 -0
- package/dist/commands/version/lib/is-breaking-change.js +61 -0
- package/dist/commands/version/lib/prompt-version.js +4833 -0
- package/dist/commands/version/lib/remote-branch-exists.js +4768 -0
- package/dist/commands/version/lib/update-lockfile-version.js +4791 -0
- package/dist/index.js +13093 -0
- package/dist/libs/child-process/src/forked-strong-log-transformer.d.ts +19 -0
- package/dist/libs/child-process/src/index.d.ts +46 -0
- package/dist/libs/child-process/src/set-exit-code.d.ts +1 -0
- package/dist/libs/commands/changed/src/command.d.ts +6 -0
- package/dist/libs/commands/changed/src/index.d.ts +15 -0
- package/dist/libs/commands/clean/src/command.d.ts +6 -0
- package/dist/libs/commands/diff/src/command.d.ts +6 -0
- package/dist/libs/commands/diff/src/index.d.ts +12 -0
- package/dist/libs/commands/diff/src/lib/get-last-commit.d.ts +7 -0
- package/dist/libs/commands/diff/src/lib/has-commit.d.ts +7 -0
- package/dist/libs/commands/exec/src/command.d.ts +6 -0
- package/dist/libs/commands/exec/src/index.d.ts +35 -0
- package/dist/libs/commands/import/src/command.d.ts +6 -0
- package/dist/libs/commands/import/src/index.d.ts +36 -0
- package/dist/libs/commands/info/src/command.d.ts +6 -0
- package/dist/libs/commands/info/src/index.d.ts +6 -0
- package/dist/libs/commands/init/src/command.d.ts +6 -0
- package/dist/libs/commands/init/src/index.d.ts +37 -0
- package/dist/libs/commands/list/src/command.d.ts +6 -0
- package/dist/libs/commands/list/src/index.d.ts +8 -0
- package/dist/libs/commands/publish/src/command.d.ts +6 -0
- package/dist/libs/commands/run/src/command.d.ts +7 -0
- package/dist/libs/commands/run/src/index.d.ts +39 -0
- package/dist/libs/commands/version/src/command.d.ts +6 -0
- package/dist/libs/core/src/index.d.ts +46 -0
- package/dist/libs/core/src/lib/add-dependencies.d.ts +2 -0
- package/dist/libs/core/src/lib/add-dependents.d.ts +2 -0
- package/dist/libs/core/src/lib/check-working-tree.d.ts +12 -0
- package/dist/libs/core/src/lib/cli.d.ts +14 -0
- package/dist/libs/core/src/lib/collect-uncommitted.d.ts +12 -0
- package/dist/libs/core/src/lib/collect-updates/collect-project-updates.d.ts +29 -0
- package/dist/libs/core/src/lib/collect-updates/has-tags.d.ts +6 -0
- package/dist/libs/core/src/lib/collect-updates/index.d.ts +1 -0
- package/dist/libs/core/src/lib/collect-updates/make-diff-predicate.d.ts +3 -0
- package/dist/libs/core/src/lib/command/clean-stack.d.ts +1 -0
- package/dist/libs/core/src/lib/command/create-project-graph-with-packages.d.ts +5 -0
- package/dist/libs/core/src/lib/command/default-options.d.ts +2 -0
- package/dist/libs/core/src/lib/command/detect-projects.d.ts +6 -0
- package/dist/libs/core/src/lib/command/index.d.ts +80 -0
- package/dist/libs/core/src/lib/command/is-git-initialized.d.ts +1 -0
- package/dist/libs/core/src/lib/command/log-package-error.d.ts +1 -0
- package/dist/libs/core/src/lib/command/warn-if-hanging.d.ts +1 -0
- package/dist/libs/core/src/lib/conventional-commits/apply-build-metadata.d.ts +4 -0
- package/dist/libs/core/src/lib/conventional-commits/constants.d.ts +17 -0
- package/dist/libs/core/src/lib/conventional-commits/get-changelog-config.d.ts +2 -0
- package/dist/libs/core/src/lib/conventional-commits/index.d.ts +3 -0
- package/dist/libs/core/src/lib/conventional-commits/make-bump-only-filter.d.ts +2 -0
- package/dist/libs/core/src/lib/conventional-commits/read-existing-changelog.d.ts +6 -0
- package/dist/libs/core/src/lib/conventional-commits/recommend-version.d.ts +6 -0
- package/dist/libs/core/src/lib/conventional-commits/update-changelog.d.ts +8 -0
- package/dist/libs/core/src/lib/corepack/exec-package-manager.d.ts +4 -0
- package/dist/libs/core/src/lib/corepack/index.d.ts +1 -0
- package/dist/libs/core/src/lib/corepack/is-corepack-enabled.d.ts +1 -0
- package/dist/libs/core/src/lib/cycles/get-cycles.d.ts +6 -0
- package/dist/libs/core/src/lib/cycles/index.d.ts +3 -0
- package/dist/libs/core/src/lib/cycles/merge-overlapping-cycles.d.ts +6 -0
- package/dist/libs/core/src/lib/cycles/report-cycles.d.ts +1 -0
- package/dist/libs/core/src/lib/describe-ref.d.ts +17 -0
- package/dist/libs/core/src/lib/filter-options.d.ts +15 -0
- package/dist/libs/core/src/lib/filter-projects.d.ts +4 -0
- package/dist/libs/core/src/lib/get-npm-exec-opts.d.ts +11 -0
- package/dist/libs/core/src/lib/get-package-manifest-path.d.ts +2 -0
- package/dist/libs/core/src/lib/get-packages-for-option.d.ts +4 -0
- package/dist/libs/core/src/lib/get-packed.d.ts +1 -0
- package/dist/libs/core/src/lib/git-checkout.d.ts +7 -0
- package/dist/libs/core/src/lib/has-npm-version.d.ts +1 -0
- package/dist/libs/core/src/lib/listable-format-projects.d.ts +24 -0
- package/dist/libs/core/src/lib/listable-options.d.ts +54 -0
- package/dist/libs/core/src/lib/log-packed.d.ts +14 -0
- package/dist/libs/core/src/lib/npm-conf/conf.d.ts +22 -0
- package/dist/libs/core/src/lib/npm-conf/env-replace.d.ts +1 -0
- package/dist/libs/core/src/lib/npm-conf/find-prefix.d.ts +1 -0
- package/dist/libs/core/src/lib/npm-conf/nerf-dart.d.ts +1 -0
- package/dist/libs/core/src/lib/npm-conf/parse-field.d.ts +1 -0
- package/dist/libs/core/src/lib/npm-install.d.ts +2 -0
- package/dist/libs/core/src/lib/npm-publish.d.ts +20 -0
- package/dist/libs/core/src/lib/npm-run-script.d.ts +2 -0
- package/dist/libs/core/src/lib/npmlog/are-we-there-yet/tracker-base.d.ts +6 -0
- package/dist/libs/core/src/lib/npmlog/are-we-there-yet/tracker-group.d.ts +21 -0
- package/dist/libs/core/src/lib/npmlog/are-we-there-yet/tracker-stream.d.ts +14 -0
- package/dist/libs/core/src/lib/npmlog/are-we-there-yet/tracker.d.ts +10 -0
- package/dist/libs/core/src/lib/npmlog/gauge/index.d.ts +43 -0
- package/dist/libs/core/src/lib/npmlog/index.d.ts +76 -0
- package/dist/libs/core/src/lib/oidc.d.ts +25 -0
- package/dist/libs/core/src/lib/otplease.d.ts +15 -0
- package/dist/libs/core/src/lib/output.d.ts +1 -0
- package/dist/libs/core/src/lib/pack-directory.d.ts +30 -0
- package/dist/libs/core/src/lib/package.d.ts +128 -0
- package/dist/libs/core/src/lib/prerelease-id-from-version.d.ts +1 -0
- package/dist/libs/core/src/lib/profiler.d.ts +20 -0
- package/dist/libs/core/src/lib/project/apply-extends.d.ts +4 -0
- package/dist/libs/core/src/lib/project/index.d.ts +82 -0
- package/dist/libs/core/src/lib/project/make-file-finder.d.ts +2 -0
- package/dist/libs/core/src/lib/project/shallow-extend.d.ts +1 -0
- package/dist/libs/core/src/lib/project-graph-with-packages.d.ts +23 -0
- package/dist/libs/core/src/lib/prompt.d.ts +19 -0
- package/dist/libs/core/src/lib/pulse-till-done.d.ts +2 -0
- package/dist/libs/core/src/lib/rimraf-dir.d.ts +1 -0
- package/dist/libs/core/src/lib/run-lifecycle.d.ts +21 -0
- package/dist/libs/core/src/lib/run-projects-topologically.d.ts +10 -0
- package/dist/libs/core/src/lib/scm-clients/github/create-github-client.d.ts +4 -0
- package/dist/libs/core/src/lib/scm-clients/gitlab/create-gitlab-client.d.ts +11 -0
- package/dist/libs/core/src/lib/scm-clients/gitlab/gitlab-client.d.ts +13 -0
- package/dist/libs/core/src/lib/scm-clients/index.d.ts +2 -0
- package/dist/libs/core/src/lib/temp-write.d.ts +5 -0
- package/dist/libs/core/src/lib/timer.d.ts +1 -0
- package/dist/libs/core/src/lib/toposort-projects.d.ts +2 -0
- package/dist/libs/core/src/lib/validation-error.d.ts +4 -0
- package/dist/libs/core/src/lib/write-log-file.d.ts +1 -0
- package/dist/libs/legacy-core/src/index.d.ts +10 -0
- package/dist/libs/legacy-core/src/lib/collect-updates/collect-dependents.d.ts +5 -0
- package/dist/libs/legacy-core/src/lib/collect-updates/collect-packages.d.ts +10 -0
- package/dist/libs/legacy-core/src/lib/collect-updates/has-tags.d.ts +5 -0
- package/dist/libs/legacy-core/src/lib/collect-updates/index.d.ts +19 -0
- package/dist/libs/legacy-core/src/lib/collect-updates/make-diff-predicate.d.ts +7 -0
- package/dist/libs/legacy-core/src/lib/command/clean-stack.d.ts +1 -0
- package/dist/libs/legacy-core/src/lib/command/default-options.d.ts +2 -0
- package/dist/libs/legacy-core/src/lib/command/index.d.ts +40 -0
- package/dist/libs/legacy-core/src/lib/command/log-package-error.d.ts +1 -0
- package/dist/libs/legacy-core/src/lib/command/warn-if-hanging.d.ts +1 -0
- package/dist/libs/legacy-core/src/lib/create-symlink.d.ts +4 -0
- package/dist/libs/legacy-core/src/lib/filter-packages.d.ts +13 -0
- package/dist/libs/legacy-core/src/lib/get-filtered-packages.d.ts +7 -0
- package/dist/libs/legacy-core/src/lib/listable-format.d.ts +8 -0
- package/dist/libs/legacy-core/src/lib/package-graph/cyclic-package-graph-node.d.ts +37 -0
- package/dist/libs/legacy-core/src/lib/package-graph/index.d.ts +74 -0
- package/dist/libs/legacy-core/src/lib/package-graph/package-graph-node.d.ts +32 -0
- package/dist/libs/legacy-core/src/lib/package-graph/report-cycles.d.ts +1 -0
- package/dist/libs/legacy-core/src/lib/query-graph.d.ts +27 -0
- package/dist/libs/legacy-core/src/lib/resolve-symlink.d.ts +1 -0
- package/dist/libs/legacy-core/src/lib/run-topologically.d.ts +16 -0
- package/dist/libs/legacy-core/src/lib/symlink-binary/index.d.ts +5 -0
- package/dist/libs/legacy-core/src/lib/symlink-dependencies.d.ts +9 -0
- package/dist/libs/legacy-core/src/lib/write-log-file.d.ts +1 -0
- package/dist/migrations/add-schema-config/add-schema-config.js +34 -0
- package/dist/migrations/remove-invalid-init-config/remove-invalid-init-config.js +34 -0
- package/dist/migrations/remove-invalid-lerna-config/remove-invalid-lerna-config.js +34 -0
- package/dist/migrations/remove-invalid-use-workspaces/remove-invalid-use-workspaces.js +34 -0
- package/dist/migrations/remove-unnecessary-use-nx/remove-unnecessary-use-nx.js +34 -0
- package/dist/migrations/update-options-from-legacy-deprecate-config/update-options-from-legacy-deprecate-config.js +96 -0
- package/dist/packages/lerna/src/commands/add-caching/command.d.ts +6 -0
- package/dist/packages/lerna/src/commands/add-caching/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/changed/command.d.ts +1 -0
- package/dist/packages/lerna/src/commands/changed/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/clean/command.d.ts +0 -0
- package/dist/packages/lerna/src/commands/clean/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/diff/command.d.ts +1 -0
- package/dist/packages/lerna/src/commands/diff/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/diff/lib/get-last-commit.d.ts +1 -0
- package/dist/packages/lerna/src/commands/diff/lib/has-commit.d.ts +1 -0
- package/dist/packages/lerna/src/commands/exec/command.d.ts +1 -0
- package/dist/packages/lerna/src/commands/exec/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/import/command.d.ts +1 -0
- package/dist/packages/lerna/src/commands/import/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/info/command.d.ts +1 -0
- package/dist/packages/lerna/src/commands/info/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/init/command.d.ts +1 -0
- package/dist/packages/lerna/src/commands/init/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/list/command.d.ts +1 -0
- package/dist/packages/lerna/src/commands/list/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/publish/command.d.ts +0 -0
- package/dist/packages/lerna/src/commands/publish/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/publish/lib/create-temp-licenses.d.ts +0 -0
- package/dist/packages/lerna/src/commands/publish/lib/fetch-config.d.ts +0 -0
- package/dist/packages/lerna/src/commands/publish/lib/get-current-sha.d.ts +0 -0
- package/dist/packages/lerna/src/commands/publish/lib/get-current-tags.d.ts +0 -0
- package/dist/packages/lerna/src/commands/publish/lib/get-npm-username.d.ts +0 -0
- package/dist/packages/lerna/src/commands/publish/lib/get-packages-without-license.d.ts +0 -0
- package/dist/packages/lerna/src/commands/publish/lib/get-profile-data.d.ts +0 -0
- package/dist/packages/lerna/src/commands/publish/lib/get-two-factor-auth-required.d.ts +0 -0
- package/dist/packages/lerna/src/commands/publish/lib/get-whoami.d.ts +0 -0
- package/dist/packages/lerna/src/commands/publish/lib/git-checkout.d.ts +0 -0
- package/dist/packages/lerna/src/commands/publish/lib/remove-temp-licenses.d.ts +0 -0
- package/dist/packages/lerna/src/commands/publish/lib/verify-npm-package-access.d.ts +0 -0
- package/dist/packages/lerna/src/commands/repair/command.d.ts +6 -0
- package/dist/packages/lerna/src/commands/repair/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/run/command.d.ts +1 -0
- package/dist/packages/lerna/src/commands/run/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/version/command.d.ts +0 -0
- package/dist/packages/lerna/src/commands/version/index.d.ts +1 -0
- package/dist/packages/lerna/src/commands/version/lib/create-release.d.ts +0 -0
- package/dist/packages/lerna/src/commands/version/lib/get-current-branch.d.ts +0 -0
- package/dist/packages/lerna/src/commands/version/lib/git-add.d.ts +0 -0
- package/dist/packages/lerna/src/commands/version/lib/git-commit.d.ts +0 -0
- package/dist/packages/lerna/src/commands/version/lib/git-push.d.ts +0 -0
- package/dist/packages/lerna/src/commands/version/lib/git-tag.d.ts +0 -0
- package/dist/packages/lerna/src/commands/version/lib/is-anything-committed.d.ts +0 -0
- package/dist/packages/lerna/src/commands/version/lib/is-behind-upstream.d.ts +0 -0
- package/dist/packages/lerna/src/commands/version/lib/is-breaking-change.d.ts +0 -0
- package/dist/packages/lerna/src/commands/version/lib/prompt-version.d.ts +0 -0
- package/dist/packages/lerna/src/commands/version/lib/remote-branch-exists.d.ts +0 -0
- package/dist/packages/lerna/src/commands/version/lib/update-lockfile-version.d.ts +0 -0
- package/dist/packages/lerna/src/commands/watch/command.d.ts +6 -0
- package/dist/packages/lerna/src/commands/watch/index.d.ts +1 -0
- package/dist/packages/lerna/src/index.d.ts +1 -0
- package/dist/packages/lerna/src/migrations/add-schema-config/add-schema-config.d.ts +2 -0
- package/dist/packages/lerna/src/migrations/remove-invalid-init-config/remove-invalid-init-config.d.ts +2 -0
- package/dist/packages/lerna/src/migrations/remove-invalid-lerna-config/remove-invalid-lerna-config.d.ts +2 -0
- package/dist/packages/lerna/src/migrations/remove-invalid-use-workspaces/remove-invalid-use-workspaces.d.ts +2 -0
- package/dist/packages/lerna/src/migrations/remove-unnecessary-use-nx/remove-unnecessary-use-nx.d.ts +2 -0
- package/dist/packages/lerna/src/migrations/update-options-from-legacy-deprecate-config/update-options-from-legacy-deprecate-config.d.ts +9 -0
- package/dist/packages/lerna/src/utils/detect-projects.d.ts +4 -0
- package/dist/packages/lerna/src/utils/index.d.ts +1 -0
- package/dist/utils/index.js +4362 -0
- package/migrations.json +40 -0
- package/package.json +376 -0
- package/schemas/lerna-schema.json +1855 -0
|
@@ -0,0 +1,4892 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
|
|
36
|
+
// libs/core/src/lib/add-dependencies.ts
|
|
37
|
+
var init_add_dependencies = __esm({
|
|
38
|
+
"libs/core/src/lib/add-dependencies.ts"() {
|
|
39
|
+
"use strict";
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// libs/core/src/lib/add-dependents.ts
|
|
44
|
+
var init_add_dependents = __esm({
|
|
45
|
+
"libs/core/src/lib/add-dependents.ts"() {
|
|
46
|
+
"use strict";
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// libs/core/src/lib/npmlog/are-we-there-yet/tracker-base.ts
|
|
51
|
+
var import_node_events, trackerId, TrackerBase;
|
|
52
|
+
var init_tracker_base = __esm({
|
|
53
|
+
"libs/core/src/lib/npmlog/are-we-there-yet/tracker-base.ts"() {
|
|
54
|
+
"use strict";
|
|
55
|
+
import_node_events = __toESM(require("node:events"));
|
|
56
|
+
trackerId = 0;
|
|
57
|
+
TrackerBase = class extends import_node_events.default {
|
|
58
|
+
id;
|
|
59
|
+
name;
|
|
60
|
+
constructor(name = "") {
|
|
61
|
+
super();
|
|
62
|
+
this.id = ++trackerId;
|
|
63
|
+
this.name = name;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// libs/core/src/lib/npmlog/are-we-there-yet/tracker.ts
|
|
70
|
+
var Tracker;
|
|
71
|
+
var init_tracker = __esm({
|
|
72
|
+
"libs/core/src/lib/npmlog/are-we-there-yet/tracker.ts"() {
|
|
73
|
+
"use strict";
|
|
74
|
+
init_tracker_base();
|
|
75
|
+
Tracker = class extends TrackerBase {
|
|
76
|
+
workDone;
|
|
77
|
+
workTodo;
|
|
78
|
+
constructor(name, todo) {
|
|
79
|
+
super(name);
|
|
80
|
+
this.workDone = 0;
|
|
81
|
+
this.workTodo = todo || 0;
|
|
82
|
+
}
|
|
83
|
+
completed() {
|
|
84
|
+
return this.workTodo === 0 ? 0 : this.workDone / this.workTodo;
|
|
85
|
+
}
|
|
86
|
+
addWork(work) {
|
|
87
|
+
this.workTodo += work;
|
|
88
|
+
this.emit("change", this.name, this.completed(), this);
|
|
89
|
+
}
|
|
90
|
+
completeWork(work) {
|
|
91
|
+
this.workDone += work;
|
|
92
|
+
if (this.workDone > this.workTodo) {
|
|
93
|
+
this.workDone = this.workTodo;
|
|
94
|
+
}
|
|
95
|
+
this.emit("change", this.name, this.completed(), this);
|
|
96
|
+
}
|
|
97
|
+
finish() {
|
|
98
|
+
this.workTodo = this.workDone = 1;
|
|
99
|
+
this.emit("change", this.name, 1, this);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// libs/core/src/lib/npmlog/are-we-there-yet/tracker-stream.ts
|
|
106
|
+
var import_node_stream, TrackerStream;
|
|
107
|
+
var init_tracker_stream = __esm({
|
|
108
|
+
"libs/core/src/lib/npmlog/are-we-there-yet/tracker-stream.ts"() {
|
|
109
|
+
"use strict";
|
|
110
|
+
import_node_stream = __toESM(require("node:stream"));
|
|
111
|
+
init_tracker();
|
|
112
|
+
TrackerStream = class extends import_node_stream.default.Transform {
|
|
113
|
+
tracker;
|
|
114
|
+
name;
|
|
115
|
+
id;
|
|
116
|
+
constructor(name, size = 0, options) {
|
|
117
|
+
super(options);
|
|
118
|
+
this.tracker = new Tracker(name, size);
|
|
119
|
+
this.name = name;
|
|
120
|
+
this.id = this.tracker.id;
|
|
121
|
+
this.tracker.on("change", this.trackerChange.bind(this));
|
|
122
|
+
}
|
|
123
|
+
trackerChange(name, completion) {
|
|
124
|
+
this.emit("change", name, completion, this);
|
|
125
|
+
}
|
|
126
|
+
_transform(data, encoding, cb) {
|
|
127
|
+
this.tracker.completeWork(data.length ? data.length : 1);
|
|
128
|
+
this.push(data);
|
|
129
|
+
cb();
|
|
130
|
+
}
|
|
131
|
+
_flush(cb) {
|
|
132
|
+
this.tracker.finish();
|
|
133
|
+
cb();
|
|
134
|
+
}
|
|
135
|
+
completed() {
|
|
136
|
+
return this.tracker.completed();
|
|
137
|
+
}
|
|
138
|
+
addWork(work) {
|
|
139
|
+
return this.tracker.addWork(work);
|
|
140
|
+
}
|
|
141
|
+
finish() {
|
|
142
|
+
return this.tracker.finish();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// libs/core/src/lib/npmlog/are-we-there-yet/tracker-group.ts
|
|
149
|
+
function bubbleChange(trackerGroup) {
|
|
150
|
+
return function(name, completed, tracker) {
|
|
151
|
+
trackerGroup.completion[tracker.id] = completed;
|
|
152
|
+
if (trackerGroup.finished) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
trackerGroup.emit("change", name || trackerGroup.name, trackerGroup.completed(), trackerGroup);
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
var TrackerGroup;
|
|
159
|
+
var init_tracker_group = __esm({
|
|
160
|
+
"libs/core/src/lib/npmlog/are-we-there-yet/tracker-group.ts"() {
|
|
161
|
+
"use strict";
|
|
162
|
+
init_tracker();
|
|
163
|
+
init_tracker_base();
|
|
164
|
+
init_tracker_stream();
|
|
165
|
+
TrackerGroup = class _TrackerGroup extends TrackerBase {
|
|
166
|
+
parentGroup = null;
|
|
167
|
+
trackers = [];
|
|
168
|
+
completion = {};
|
|
169
|
+
weight = {};
|
|
170
|
+
totalWeight = 0;
|
|
171
|
+
finished = false;
|
|
172
|
+
bubbleChange = bubbleChange(this);
|
|
173
|
+
nameInTree() {
|
|
174
|
+
const names = [];
|
|
175
|
+
let from = this;
|
|
176
|
+
while (from) {
|
|
177
|
+
names.unshift(from.name);
|
|
178
|
+
from = from.parentGroup;
|
|
179
|
+
}
|
|
180
|
+
return names.join("/");
|
|
181
|
+
}
|
|
182
|
+
addUnit(unit, weight = 0) {
|
|
183
|
+
if (unit.addUnit) {
|
|
184
|
+
let toTest = this;
|
|
185
|
+
while (toTest) {
|
|
186
|
+
if (unit === toTest) {
|
|
187
|
+
throw new Error(
|
|
188
|
+
"Attempted to add tracker group " + unit.name + " to tree that already includes it " + this.nameInTree()
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
toTest = toTest.parentGroup;
|
|
192
|
+
}
|
|
193
|
+
unit.parentGroup = this;
|
|
194
|
+
}
|
|
195
|
+
this.weight[unit.id] = weight || 1;
|
|
196
|
+
this.totalWeight += this.weight[unit.id];
|
|
197
|
+
this.trackers.push(unit);
|
|
198
|
+
this.completion[unit.id] = unit.completed();
|
|
199
|
+
unit.on("change", this.bubbleChange);
|
|
200
|
+
if (!this.finished) {
|
|
201
|
+
this.emit("change", unit.name, this.completion[unit.id], unit);
|
|
202
|
+
}
|
|
203
|
+
return unit;
|
|
204
|
+
}
|
|
205
|
+
completed() {
|
|
206
|
+
if (this.trackers.length === 0) {
|
|
207
|
+
return 0;
|
|
208
|
+
}
|
|
209
|
+
const valPerWeight = 1 / this.totalWeight;
|
|
210
|
+
let completed = 0;
|
|
211
|
+
for (let ii = 0; ii < this.trackers.length; ii++) {
|
|
212
|
+
const trackerId2 = this.trackers[ii].id;
|
|
213
|
+
completed += valPerWeight * this.weight[trackerId2] * this.completion[trackerId2];
|
|
214
|
+
}
|
|
215
|
+
return completed;
|
|
216
|
+
}
|
|
217
|
+
newGroup(name, weight = 0) {
|
|
218
|
+
return this.addUnit(new _TrackerGroup(name), weight);
|
|
219
|
+
}
|
|
220
|
+
newItem(name, todo, weight = 0) {
|
|
221
|
+
return this.addUnit(new Tracker(name, todo), weight);
|
|
222
|
+
}
|
|
223
|
+
newStream(name, todo, weight = 0) {
|
|
224
|
+
return this.addUnit(new TrackerStream(name, todo), weight);
|
|
225
|
+
}
|
|
226
|
+
finish() {
|
|
227
|
+
this.finished = true;
|
|
228
|
+
if (!this.trackers.length) {
|
|
229
|
+
this.addUnit(new Tracker(), 1);
|
|
230
|
+
}
|
|
231
|
+
for (let ii = 0; ii < this.trackers.length; ii++) {
|
|
232
|
+
const tracker = this.trackers[ii];
|
|
233
|
+
tracker.finish();
|
|
234
|
+
tracker.removeListener("change", this.bubbleChange);
|
|
235
|
+
}
|
|
236
|
+
this.emit("change", this.name, 1, this);
|
|
237
|
+
}
|
|
238
|
+
debug(depth = 0) {
|
|
239
|
+
const indent = " ".repeat(depth);
|
|
240
|
+
let output2 = `${indent}${this.name || "top"}: ${this.completed()}
|
|
241
|
+
`;
|
|
242
|
+
this.trackers.forEach(function(tracker) {
|
|
243
|
+
output2 += tracker instanceof _TrackerGroup ? tracker.debug(depth + 1) : `${indent} ${tracker.name}: ${tracker.completed()}
|
|
244
|
+
`;
|
|
245
|
+
});
|
|
246
|
+
return output2;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
// libs/core/src/lib/npmlog/gauge/wide-truncate.ts
|
|
253
|
+
var require_wide_truncate = __commonJS({
|
|
254
|
+
"libs/core/src/lib/npmlog/gauge/wide-truncate.ts"(exports2, module2) {
|
|
255
|
+
"use strict";
|
|
256
|
+
var stringWidth = require("string-width");
|
|
257
|
+
var util3 = require("node:util");
|
|
258
|
+
module2.exports = wideTruncate;
|
|
259
|
+
function wideTruncate(str, target) {
|
|
260
|
+
if (stringWidth(str) === 0) {
|
|
261
|
+
return str;
|
|
262
|
+
}
|
|
263
|
+
if (target <= 0) {
|
|
264
|
+
return "";
|
|
265
|
+
}
|
|
266
|
+
if (stringWidth(str) <= target) {
|
|
267
|
+
return str;
|
|
268
|
+
}
|
|
269
|
+
var noAnsi = util3.stripVTControlCharacters(str);
|
|
270
|
+
var ansiSize = str.length + noAnsi.length;
|
|
271
|
+
var truncated = str.slice(0, target + ansiSize);
|
|
272
|
+
while (stringWidth(truncated) > target) {
|
|
273
|
+
truncated = truncated.slice(0, -1);
|
|
274
|
+
}
|
|
275
|
+
return truncated;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
// libs/core/src/lib/npmlog/gauge/error.ts
|
|
281
|
+
var require_error = __commonJS({
|
|
282
|
+
"libs/core/src/lib/npmlog/gauge/error.ts"(exports2) {
|
|
283
|
+
"use strict";
|
|
284
|
+
var util3 = require("util");
|
|
285
|
+
var User = exports2.User = function User2(msg) {
|
|
286
|
+
var err = new Error(msg);
|
|
287
|
+
Error.captureStackTrace(err, User2);
|
|
288
|
+
err.code = "EGAUGE";
|
|
289
|
+
return err;
|
|
290
|
+
};
|
|
291
|
+
exports2.MissingTemplateValue = function MissingTemplateValue(item, values) {
|
|
292
|
+
var err = new User(util3.format('Missing template value "%s"', item.type));
|
|
293
|
+
Error.captureStackTrace(err, MissingTemplateValue);
|
|
294
|
+
err.template = item;
|
|
295
|
+
err.values = values;
|
|
296
|
+
return err;
|
|
297
|
+
};
|
|
298
|
+
exports2.Internal = function Internal(msg) {
|
|
299
|
+
var err = new Error(msg);
|
|
300
|
+
Error.captureStackTrace(err, Internal);
|
|
301
|
+
err.code = "EGAUGEINTERNAL";
|
|
302
|
+
return err;
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
// libs/core/src/lib/npmlog/gauge/template-item.ts
|
|
308
|
+
var require_template_item = __commonJS({
|
|
309
|
+
"libs/core/src/lib/npmlog/gauge/template-item.ts"(exports2, module2) {
|
|
310
|
+
"use strict";
|
|
311
|
+
var stringWidth = require("string-width");
|
|
312
|
+
module2.exports = TemplateItem;
|
|
313
|
+
function isPercent(num) {
|
|
314
|
+
if (typeof num !== "string") {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
return num.slice(-1) === "%";
|
|
318
|
+
}
|
|
319
|
+
function percent(num) {
|
|
320
|
+
return Number(num.slice(0, -1)) / 100;
|
|
321
|
+
}
|
|
322
|
+
function TemplateItem(values, outputLength) {
|
|
323
|
+
this.overallOutputLength = outputLength;
|
|
324
|
+
this.finished = false;
|
|
325
|
+
this.type = null;
|
|
326
|
+
this.value = null;
|
|
327
|
+
this.length = null;
|
|
328
|
+
this.maxLength = null;
|
|
329
|
+
this.minLength = null;
|
|
330
|
+
this.kerning = null;
|
|
331
|
+
this.align = "left";
|
|
332
|
+
this.padLeft = 0;
|
|
333
|
+
this.padRight = 0;
|
|
334
|
+
this.index = null;
|
|
335
|
+
this.first = null;
|
|
336
|
+
this.last = null;
|
|
337
|
+
if (typeof values === "string") {
|
|
338
|
+
this.value = values;
|
|
339
|
+
} else {
|
|
340
|
+
for (var prop in values) {
|
|
341
|
+
this[prop] = values[prop];
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (isPercent(this.length)) {
|
|
345
|
+
this.length = Math.round(this.overallOutputLength * percent(this.length));
|
|
346
|
+
}
|
|
347
|
+
if (isPercent(this.minLength)) {
|
|
348
|
+
this.minLength = Math.round(this.overallOutputLength * percent(this.minLength));
|
|
349
|
+
}
|
|
350
|
+
if (isPercent(this.maxLength)) {
|
|
351
|
+
this.maxLength = Math.round(this.overallOutputLength * percent(this.maxLength));
|
|
352
|
+
}
|
|
353
|
+
return this;
|
|
354
|
+
}
|
|
355
|
+
TemplateItem.prototype = {};
|
|
356
|
+
TemplateItem.prototype.getBaseLength = function() {
|
|
357
|
+
var length = this.length;
|
|
358
|
+
if (length == null && typeof this.value === "string" && this.maxLength == null && this.minLength == null) {
|
|
359
|
+
length = stringWidth(this.value);
|
|
360
|
+
}
|
|
361
|
+
return length;
|
|
362
|
+
};
|
|
363
|
+
TemplateItem.prototype.getLength = function() {
|
|
364
|
+
var length = this.getBaseLength();
|
|
365
|
+
if (length == null) {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
return length + this.padLeft + this.padRight;
|
|
369
|
+
};
|
|
370
|
+
TemplateItem.prototype.getMaxLength = function() {
|
|
371
|
+
if (this.maxLength == null) {
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
return this.maxLength + this.padLeft + this.padRight;
|
|
375
|
+
};
|
|
376
|
+
TemplateItem.prototype.getMinLength = function() {
|
|
377
|
+
if (this.minLength == null) {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
return this.minLength + this.padLeft + this.padRight;
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
// libs/core/src/lib/npmlog/gauge/render-template.ts
|
|
386
|
+
var require_render_template = __commonJS({
|
|
387
|
+
"libs/core/src/lib/npmlog/gauge/render-template.ts"(exports2, module2) {
|
|
388
|
+
"use strict";
|
|
389
|
+
var align = require("wide-align");
|
|
390
|
+
var validate = require("aproba");
|
|
391
|
+
var wideTruncate = require_wide_truncate();
|
|
392
|
+
var error = require_error();
|
|
393
|
+
var TemplateItem = require_template_item();
|
|
394
|
+
function renderValueWithValues(values) {
|
|
395
|
+
return function(item) {
|
|
396
|
+
return renderValue(item, values);
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
var renderTemplate = module2.exports = function(width, template, values) {
|
|
400
|
+
var items = prepareItems(width, template, values);
|
|
401
|
+
var rendered = items.map(renderValueWithValues(values)).join("");
|
|
402
|
+
return align.left(wideTruncate(rendered, width), width);
|
|
403
|
+
};
|
|
404
|
+
function preType(item) {
|
|
405
|
+
var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1);
|
|
406
|
+
return "pre" + cappedTypeName;
|
|
407
|
+
}
|
|
408
|
+
function postType(item) {
|
|
409
|
+
var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1);
|
|
410
|
+
return "post" + cappedTypeName;
|
|
411
|
+
}
|
|
412
|
+
function hasPreOrPost(item, values) {
|
|
413
|
+
if (!item.type) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
return values[preType(item)] || values[postType(item)];
|
|
417
|
+
}
|
|
418
|
+
function generatePreAndPost(baseItem, parentValues) {
|
|
419
|
+
var item = Object.assign({}, baseItem);
|
|
420
|
+
var values = Object.create(parentValues);
|
|
421
|
+
var template = [];
|
|
422
|
+
var pre = preType(item);
|
|
423
|
+
var post = postType(item);
|
|
424
|
+
if (values[pre]) {
|
|
425
|
+
template.push({ value: values[pre] });
|
|
426
|
+
values[pre] = null;
|
|
427
|
+
}
|
|
428
|
+
item.minLength = null;
|
|
429
|
+
item.length = null;
|
|
430
|
+
item.maxLength = null;
|
|
431
|
+
template.push(item);
|
|
432
|
+
values[item.type] = values[item.type];
|
|
433
|
+
if (values[post]) {
|
|
434
|
+
template.push({ value: values[post] });
|
|
435
|
+
values[post] = null;
|
|
436
|
+
}
|
|
437
|
+
return function($1, $2, length) {
|
|
438
|
+
return renderTemplate(length, template, values);
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
function prepareItems(width, template, values) {
|
|
442
|
+
function cloneAndObjectify(item, index, arr) {
|
|
443
|
+
var cloned = new TemplateItem(item, width);
|
|
444
|
+
var type = cloned.type;
|
|
445
|
+
if (cloned.value == null) {
|
|
446
|
+
if (!(type in values)) {
|
|
447
|
+
if (cloned.default == null) {
|
|
448
|
+
throw new error.MissingTemplateValue(cloned, values);
|
|
449
|
+
} else {
|
|
450
|
+
cloned.value = cloned.default;
|
|
451
|
+
}
|
|
452
|
+
} else {
|
|
453
|
+
cloned.value = values[type];
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (cloned.value == null || cloned.value === "") {
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
cloned.index = index;
|
|
460
|
+
cloned.first = index === 0;
|
|
461
|
+
cloned.last = index === arr.length - 1;
|
|
462
|
+
if (hasPreOrPost(cloned, values)) {
|
|
463
|
+
cloned.value = generatePreAndPost(cloned, values);
|
|
464
|
+
}
|
|
465
|
+
return cloned;
|
|
466
|
+
}
|
|
467
|
+
var output2 = template.map(cloneAndObjectify).filter(function(item) {
|
|
468
|
+
return item != null;
|
|
469
|
+
});
|
|
470
|
+
var remainingSpace = width;
|
|
471
|
+
var variableCount = output2.length;
|
|
472
|
+
function consumeSpace(length) {
|
|
473
|
+
if (length > remainingSpace) {
|
|
474
|
+
length = remainingSpace;
|
|
475
|
+
}
|
|
476
|
+
remainingSpace -= length;
|
|
477
|
+
}
|
|
478
|
+
function finishSizing(item, length) {
|
|
479
|
+
if (item.finished) {
|
|
480
|
+
throw new error.Internal("Tried to finish template item that was already finished");
|
|
481
|
+
}
|
|
482
|
+
if (length === Infinity) {
|
|
483
|
+
throw new error.Internal("Length of template item cannot be infinity");
|
|
484
|
+
}
|
|
485
|
+
if (length != null) {
|
|
486
|
+
item.length = length;
|
|
487
|
+
}
|
|
488
|
+
item.minLength = null;
|
|
489
|
+
item.maxLength = null;
|
|
490
|
+
--variableCount;
|
|
491
|
+
item.finished = true;
|
|
492
|
+
if (item.length == null) {
|
|
493
|
+
item.length = item.getBaseLength();
|
|
494
|
+
}
|
|
495
|
+
if (item.length == null) {
|
|
496
|
+
throw new error.Internal("Finished template items must have a length");
|
|
497
|
+
}
|
|
498
|
+
consumeSpace(item.getLength());
|
|
499
|
+
}
|
|
500
|
+
output2.forEach(function(item) {
|
|
501
|
+
if (!item.kerning) {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
var prevPadRight = item.first ? 0 : output2[item.index - 1].padRight;
|
|
505
|
+
if (!item.first && prevPadRight < item.kerning) {
|
|
506
|
+
item.padLeft = item.kerning - prevPadRight;
|
|
507
|
+
}
|
|
508
|
+
if (!item.last) {
|
|
509
|
+
item.padRight = item.kerning;
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
output2.forEach(function(item) {
|
|
513
|
+
if (item.getBaseLength() == null) {
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
finishSizing(item);
|
|
517
|
+
});
|
|
518
|
+
var resized = 0;
|
|
519
|
+
var resizing;
|
|
520
|
+
var hunkSize;
|
|
521
|
+
do {
|
|
522
|
+
resizing = false;
|
|
523
|
+
hunkSize = Math.round(remainingSpace / variableCount);
|
|
524
|
+
output2.forEach(function(item) {
|
|
525
|
+
if (item.finished) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
if (!item.maxLength) {
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
if (item.getMaxLength() < hunkSize) {
|
|
532
|
+
finishSizing(item, item.maxLength);
|
|
533
|
+
resizing = true;
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
} while (resizing && resized++ < output2.length);
|
|
537
|
+
if (resizing) {
|
|
538
|
+
throw new error.Internal("Resize loop iterated too many times while determining maxLength");
|
|
539
|
+
}
|
|
540
|
+
resized = 0;
|
|
541
|
+
do {
|
|
542
|
+
resizing = false;
|
|
543
|
+
hunkSize = Math.round(remainingSpace / variableCount);
|
|
544
|
+
output2.forEach(function(item) {
|
|
545
|
+
if (item.finished) {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
if (!item.minLength) {
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
if (item.getMinLength() >= hunkSize) {
|
|
552
|
+
finishSizing(item, item.minLength);
|
|
553
|
+
resizing = true;
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
} while (resizing && resized++ < output2.length);
|
|
557
|
+
if (resizing) {
|
|
558
|
+
throw new error.Internal("Resize loop iterated too many times while determining minLength");
|
|
559
|
+
}
|
|
560
|
+
hunkSize = Math.round(remainingSpace / variableCount);
|
|
561
|
+
output2.forEach(function(item) {
|
|
562
|
+
if (item.finished) {
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
finishSizing(item, hunkSize);
|
|
566
|
+
});
|
|
567
|
+
return output2;
|
|
568
|
+
}
|
|
569
|
+
function renderFunction(item, values, length) {
|
|
570
|
+
validate("OON", arguments);
|
|
571
|
+
if (item.type) {
|
|
572
|
+
return item.value(values, values[item.type + "Theme"] || {}, length);
|
|
573
|
+
} else {
|
|
574
|
+
return item.value(values, {}, length);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
function renderValue(item, values) {
|
|
578
|
+
var length = item.getBaseLength();
|
|
579
|
+
var value = typeof item.value === "function" ? renderFunction(item, values, length) : item.value;
|
|
580
|
+
if (value == null || value === "") {
|
|
581
|
+
return "";
|
|
582
|
+
}
|
|
583
|
+
var alignWith = align[item.align] || align.left;
|
|
584
|
+
var leftPadding = item.padLeft ? align.left("", item.padLeft) : "";
|
|
585
|
+
var rightPadding = item.padRight ? align.right("", item.padRight) : "";
|
|
586
|
+
var truncated = wideTruncate(String(value), length);
|
|
587
|
+
var aligned = alignWith(truncated, length);
|
|
588
|
+
return leftPadding + aligned + rightPadding;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
// libs/core/src/lib/npmlog/gauge/plumbing.ts
|
|
594
|
+
var require_plumbing = __commonJS({
|
|
595
|
+
"libs/core/src/lib/npmlog/gauge/plumbing.ts"(exports2, module2) {
|
|
596
|
+
"use strict";
|
|
597
|
+
var consoleControl2 = require("console-control-strings");
|
|
598
|
+
var renderTemplate = require_render_template();
|
|
599
|
+
var validate = require("aproba");
|
|
600
|
+
var Plumbing2 = module2.exports = function(theme, template, width) {
|
|
601
|
+
if (!width) {
|
|
602
|
+
width = 80;
|
|
603
|
+
}
|
|
604
|
+
validate("OAN", [theme, template, width]);
|
|
605
|
+
this.showing = false;
|
|
606
|
+
this.theme = theme;
|
|
607
|
+
this.width = width;
|
|
608
|
+
this.template = template;
|
|
609
|
+
};
|
|
610
|
+
Plumbing2.prototype = {};
|
|
611
|
+
Plumbing2.prototype.setTheme = function(theme) {
|
|
612
|
+
validate("O", [theme]);
|
|
613
|
+
this.theme = theme;
|
|
614
|
+
};
|
|
615
|
+
Plumbing2.prototype.setTemplate = function(template) {
|
|
616
|
+
validate("A", [template]);
|
|
617
|
+
this.template = template;
|
|
618
|
+
};
|
|
619
|
+
Plumbing2.prototype.setWidth = function(width) {
|
|
620
|
+
validate("N", [width]);
|
|
621
|
+
this.width = width;
|
|
622
|
+
};
|
|
623
|
+
Plumbing2.prototype.hide = function() {
|
|
624
|
+
return consoleControl2.gotoSOL() + consoleControl2.eraseLine();
|
|
625
|
+
};
|
|
626
|
+
Plumbing2.prototype.hideCursor = consoleControl2.hideCursor;
|
|
627
|
+
Plumbing2.prototype.showCursor = consoleControl2.showCursor;
|
|
628
|
+
Plumbing2.prototype.show = function(status) {
|
|
629
|
+
var values = Object.create(this.theme);
|
|
630
|
+
for (var key in status) {
|
|
631
|
+
values[key] = status[key];
|
|
632
|
+
}
|
|
633
|
+
return renderTemplate(this.width, this.template, values).trim() + consoleControl2.color("reset") + consoleControl2.eraseLine() + consoleControl2.gotoSOL();
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
// libs/core/src/lib/npmlog/gauge/has-color.ts
|
|
639
|
+
var require_has_color = __commonJS({
|
|
640
|
+
"libs/core/src/lib/npmlog/gauge/has-color.ts"(exports2, module2) {
|
|
641
|
+
"use strict";
|
|
642
|
+
var colorSupport = require("color-support");
|
|
643
|
+
module2.exports = colorSupport().hasBasic;
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
// libs/core/src/lib/npmlog/gauge/spin.ts
|
|
648
|
+
var require_spin = __commonJS({
|
|
649
|
+
"libs/core/src/lib/npmlog/gauge/spin.ts"(exports2, module2) {
|
|
650
|
+
"use strict";
|
|
651
|
+
module2.exports = function spin(spinstr, spun) {
|
|
652
|
+
return spinstr[spun % spinstr.length];
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
// libs/core/src/lib/npmlog/gauge/progress-bar.ts
|
|
658
|
+
var require_progress_bar = __commonJS({
|
|
659
|
+
"libs/core/src/lib/npmlog/gauge/progress-bar.ts"(exports2, module2) {
|
|
660
|
+
"use strict";
|
|
661
|
+
var validate = require("aproba");
|
|
662
|
+
var renderTemplate = require_render_template();
|
|
663
|
+
var wideTruncate = require_wide_truncate();
|
|
664
|
+
var stringWidth = require("string-width");
|
|
665
|
+
module2.exports = function(theme, width, completed) {
|
|
666
|
+
validate("ONN", [theme, width, completed]);
|
|
667
|
+
if (completed < 0) {
|
|
668
|
+
completed = 0;
|
|
669
|
+
}
|
|
670
|
+
if (completed > 1) {
|
|
671
|
+
completed = 1;
|
|
672
|
+
}
|
|
673
|
+
if (width <= 0) {
|
|
674
|
+
return "";
|
|
675
|
+
}
|
|
676
|
+
var sofar = Math.round(width * completed);
|
|
677
|
+
var rest = width - sofar;
|
|
678
|
+
var template = [
|
|
679
|
+
{ type: "complete", value: repeat(theme.complete, sofar), length: sofar },
|
|
680
|
+
{ type: "remaining", value: repeat(theme.remaining, rest), length: rest }
|
|
681
|
+
];
|
|
682
|
+
return renderTemplate(width, template, theme);
|
|
683
|
+
};
|
|
684
|
+
function repeat(string, width) {
|
|
685
|
+
var result = "";
|
|
686
|
+
var n = width;
|
|
687
|
+
do {
|
|
688
|
+
if (n % 2) {
|
|
689
|
+
result += string;
|
|
690
|
+
}
|
|
691
|
+
n = Math.floor(n / 2);
|
|
692
|
+
string += string;
|
|
693
|
+
} while (n && stringWidth(result) < width);
|
|
694
|
+
return wideTruncate(result, width);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
// libs/core/src/lib/npmlog/gauge/base-theme.ts
|
|
700
|
+
var require_base_theme = __commonJS({
|
|
701
|
+
"libs/core/src/lib/npmlog/gauge/base-theme.ts"(exports2, module2) {
|
|
702
|
+
"use strict";
|
|
703
|
+
var spin = require_spin();
|
|
704
|
+
var progressBar = require_progress_bar();
|
|
705
|
+
module2.exports = {
|
|
706
|
+
activityIndicator: function(values, theme) {
|
|
707
|
+
if (values.spun == null) {
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
return spin(theme, values.spun);
|
|
711
|
+
},
|
|
712
|
+
progressbar: function(values, theme, width) {
|
|
713
|
+
if (values.completed == null) {
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
return progressBar(theme, width, values.completed);
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
// libs/core/src/lib/npmlog/gauge/theme-set.ts
|
|
723
|
+
var require_theme_set = __commonJS({
|
|
724
|
+
"libs/core/src/lib/npmlog/gauge/theme-set.ts"(exports2, module2) {
|
|
725
|
+
"use strict";
|
|
726
|
+
module2.exports = function() {
|
|
727
|
+
return ThemeSetProto.newThemeSet();
|
|
728
|
+
};
|
|
729
|
+
var ThemeSetProto = {};
|
|
730
|
+
ThemeSetProto.baseTheme = require_base_theme();
|
|
731
|
+
ThemeSetProto.newTheme = function(parent, theme) {
|
|
732
|
+
if (!theme) {
|
|
733
|
+
theme = parent;
|
|
734
|
+
parent = this.baseTheme;
|
|
735
|
+
}
|
|
736
|
+
return Object.assign({}, parent, theme);
|
|
737
|
+
};
|
|
738
|
+
ThemeSetProto.getThemeNames = function() {
|
|
739
|
+
return Object.keys(this.themes);
|
|
740
|
+
};
|
|
741
|
+
ThemeSetProto.addTheme = function(name, parent, theme) {
|
|
742
|
+
this.themes[name] = this.newTheme(parent, theme);
|
|
743
|
+
};
|
|
744
|
+
ThemeSetProto.addToAllThemes = function(theme) {
|
|
745
|
+
var themes = this.themes;
|
|
746
|
+
Object.keys(themes).forEach(function(name) {
|
|
747
|
+
Object.assign(themes[name], theme);
|
|
748
|
+
});
|
|
749
|
+
Object.assign(this.baseTheme, theme);
|
|
750
|
+
};
|
|
751
|
+
ThemeSetProto.getTheme = function(name) {
|
|
752
|
+
if (!this.themes[name]) {
|
|
753
|
+
throw this.newMissingThemeError(name);
|
|
754
|
+
}
|
|
755
|
+
return this.themes[name];
|
|
756
|
+
};
|
|
757
|
+
ThemeSetProto.setDefault = function(opts, name) {
|
|
758
|
+
if (name == null) {
|
|
759
|
+
name = opts;
|
|
760
|
+
opts = {};
|
|
761
|
+
}
|
|
762
|
+
var platform = opts.platform == null ? "fallback" : opts.platform;
|
|
763
|
+
var hasUnicode3 = !!opts.hasUnicode;
|
|
764
|
+
var hasColor2 = !!opts.hasColor;
|
|
765
|
+
if (!this.defaults[platform]) {
|
|
766
|
+
this.defaults[platform] = { true: {}, false: {} };
|
|
767
|
+
}
|
|
768
|
+
this.defaults[platform][hasUnicode3][hasColor2] = name;
|
|
769
|
+
};
|
|
770
|
+
ThemeSetProto.getDefault = function(opts) {
|
|
771
|
+
if (!opts) {
|
|
772
|
+
opts = {};
|
|
773
|
+
}
|
|
774
|
+
var platformName = opts.platform || process.platform;
|
|
775
|
+
var platform = this.defaults[platformName] || this.defaults.fallback;
|
|
776
|
+
var hasUnicode3 = !!opts.hasUnicode;
|
|
777
|
+
var hasColor2 = !!opts.hasColor;
|
|
778
|
+
if (!platform) {
|
|
779
|
+
throw this.newMissingDefaultThemeError(platformName, hasUnicode3, hasColor2);
|
|
780
|
+
}
|
|
781
|
+
if (!platform[hasUnicode3][hasColor2]) {
|
|
782
|
+
if (hasUnicode3 && hasColor2 && platform[!hasUnicode3][hasColor2]) {
|
|
783
|
+
hasUnicode3 = false;
|
|
784
|
+
} else if (hasUnicode3 && hasColor2 && platform[hasUnicode3][!hasColor2]) {
|
|
785
|
+
hasColor2 = false;
|
|
786
|
+
} else if (hasUnicode3 && hasColor2 && platform[!hasUnicode3][!hasColor2]) {
|
|
787
|
+
hasUnicode3 = false;
|
|
788
|
+
hasColor2 = false;
|
|
789
|
+
} else if (hasUnicode3 && !hasColor2 && platform[!hasUnicode3][hasColor2]) {
|
|
790
|
+
hasUnicode3 = false;
|
|
791
|
+
} else if (!hasUnicode3 && hasColor2 && platform[hasUnicode3][!hasColor2]) {
|
|
792
|
+
hasColor2 = false;
|
|
793
|
+
} else if (platform === this.defaults.fallback) {
|
|
794
|
+
throw this.newMissingDefaultThemeError(platformName, hasUnicode3, hasColor2);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
if (platform[hasUnicode3][hasColor2]) {
|
|
798
|
+
return this.getTheme(platform[hasUnicode3][hasColor2]);
|
|
799
|
+
} else {
|
|
800
|
+
return this.getDefault(Object.assign({}, opts, { platform: "fallback" }));
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
ThemeSetProto.newMissingThemeError = function newMissingThemeError(name) {
|
|
804
|
+
var err = new Error('Could not find a gauge theme named "' + name + '"');
|
|
805
|
+
Error.captureStackTrace.call(err, newMissingThemeError);
|
|
806
|
+
err.theme = name;
|
|
807
|
+
err.code = "EMISSINGTHEME";
|
|
808
|
+
return err;
|
|
809
|
+
};
|
|
810
|
+
ThemeSetProto.newMissingDefaultThemeError = function newMissingDefaultThemeError(platformName, hasUnicode3, hasColor2) {
|
|
811
|
+
var err = new Error(
|
|
812
|
+
"Could not find a gauge theme for your platform/unicode/color use combo:\n platform = " + platformName + "\n hasUnicode = " + hasUnicode3 + "\n hasColor = " + hasColor2
|
|
813
|
+
);
|
|
814
|
+
Error.captureStackTrace.call(err, newMissingDefaultThemeError);
|
|
815
|
+
err.platform = platformName;
|
|
816
|
+
err.hasUnicode = hasUnicode3;
|
|
817
|
+
err.hasColor = hasColor2;
|
|
818
|
+
err.code = "EMISSINGTHEME";
|
|
819
|
+
return err;
|
|
820
|
+
};
|
|
821
|
+
ThemeSetProto.newThemeSet = function() {
|
|
822
|
+
var themeset = function(opts) {
|
|
823
|
+
return themeset.getDefault(opts);
|
|
824
|
+
};
|
|
825
|
+
return Object.assign(themeset, ThemeSetProto, {
|
|
826
|
+
themes: Object.assign({}, this.themes),
|
|
827
|
+
baseTheme: Object.assign({}, this.baseTheme),
|
|
828
|
+
defaults: JSON.parse(JSON.stringify(this.defaults || {}))
|
|
829
|
+
});
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
// libs/core/src/lib/npmlog/gauge/themes.ts
|
|
835
|
+
var require_themes = __commonJS({
|
|
836
|
+
"libs/core/src/lib/npmlog/gauge/themes.ts"(exports2, module2) {
|
|
837
|
+
"use strict";
|
|
838
|
+
var color = require("console-control-strings").color;
|
|
839
|
+
var ThemeSet = require_theme_set();
|
|
840
|
+
var themes = module2.exports = new ThemeSet();
|
|
841
|
+
themes.addTheme("ASCII", {
|
|
842
|
+
preProgressbar: "[",
|
|
843
|
+
postProgressbar: "]",
|
|
844
|
+
progressbarTheme: {
|
|
845
|
+
complete: "#",
|
|
846
|
+
remaining: "."
|
|
847
|
+
},
|
|
848
|
+
activityIndicatorTheme: "-\\|/",
|
|
849
|
+
preSubsection: ">"
|
|
850
|
+
});
|
|
851
|
+
themes.addTheme("colorASCII", themes.getTheme("ASCII"), {
|
|
852
|
+
progressbarTheme: {
|
|
853
|
+
preComplete: color("bgBrightWhite", "brightWhite"),
|
|
854
|
+
complete: "#",
|
|
855
|
+
postComplete: color("reset"),
|
|
856
|
+
preRemaining: color("bgBrightBlack", "brightBlack"),
|
|
857
|
+
remaining: ".",
|
|
858
|
+
postRemaining: color("reset")
|
|
859
|
+
}
|
|
860
|
+
});
|
|
861
|
+
themes.addTheme("brailleSpinner", {
|
|
862
|
+
preProgressbar: "(",
|
|
863
|
+
postProgressbar: ")",
|
|
864
|
+
progressbarTheme: {
|
|
865
|
+
complete: "#",
|
|
866
|
+
remaining: "\u2802"
|
|
867
|
+
},
|
|
868
|
+
activityIndicatorTheme: "\u280B\u2819\u2839\u2838\u283C\u2834\u2826\u2827\u2807\u280F",
|
|
869
|
+
preSubsection: ">"
|
|
870
|
+
});
|
|
871
|
+
themes.addTheme("colorBrailleSpinner", themes.getTheme("brailleSpinner"), {
|
|
872
|
+
progressbarTheme: {
|
|
873
|
+
preComplete: color("bgBrightWhite", "brightWhite"),
|
|
874
|
+
complete: "#",
|
|
875
|
+
postComplete: color("reset"),
|
|
876
|
+
preRemaining: color("bgBrightBlack", "brightBlack"),
|
|
877
|
+
remaining: "\u2802",
|
|
878
|
+
postRemaining: color("reset")
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
themes.setDefault({}, "ASCII");
|
|
882
|
+
themes.setDefault({ hasColor: true }, "colorASCII");
|
|
883
|
+
themes.setDefault({ platform: "darwin", hasUnicode: true }, "brailleSpinner");
|
|
884
|
+
themes.setDefault({ platform: "darwin", hasUnicode: true, hasColor: true }, "colorBrailleSpinner");
|
|
885
|
+
themes.setDefault({ platform: "linux", hasUnicode: true }, "brailleSpinner");
|
|
886
|
+
themes.setDefault({ platform: "linux", hasUnicode: true, hasColor: true }, "colorBrailleSpinner");
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
// libs/core/src/lib/npmlog/gauge/set-interval.ts
|
|
891
|
+
var require_set_interval = __commonJS({
|
|
892
|
+
"libs/core/src/lib/npmlog/gauge/set-interval.ts"(exports2, module2) {
|
|
893
|
+
"use strict";
|
|
894
|
+
module2.exports = setInterval;
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
|
|
898
|
+
// libs/core/src/lib/npmlog/gauge/process.ts
|
|
899
|
+
var require_process = __commonJS({
|
|
900
|
+
"libs/core/src/lib/npmlog/gauge/process.ts"(exports2, module2) {
|
|
901
|
+
"use strict";
|
|
902
|
+
module2.exports = process;
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
// libs/core/src/lib/npmlog/gauge/set-immediate.ts
|
|
907
|
+
var require_set_immediate = __commonJS({
|
|
908
|
+
"libs/core/src/lib/npmlog/gauge/set-immediate.ts"(exports2, module2) {
|
|
909
|
+
"use strict";
|
|
910
|
+
var process3 = require_process();
|
|
911
|
+
try {
|
|
912
|
+
module2.exports = setImmediate;
|
|
913
|
+
} catch (ex) {
|
|
914
|
+
module2.exports = process3.nextTick;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
|
|
919
|
+
// libs/core/src/lib/npmlog/gauge/index.ts
|
|
920
|
+
function callWith(obj, method) {
|
|
921
|
+
return function() {
|
|
922
|
+
return method.call(obj);
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
var import_signal_exit, hasUnicode, Plumbing, hasColor, defaultThemes, setInterval2, process2, setImmediate2, Gauge;
|
|
926
|
+
var init_gauge = __esm({
|
|
927
|
+
"libs/core/src/lib/npmlog/gauge/index.ts"() {
|
|
928
|
+
"use strict";
|
|
929
|
+
import_signal_exit = __toESM(require("signal-exit"));
|
|
930
|
+
hasUnicode = require("has-unicode");
|
|
931
|
+
Plumbing = require_plumbing();
|
|
932
|
+
hasColor = require_has_color();
|
|
933
|
+
defaultThemes = require_themes();
|
|
934
|
+
setInterval2 = require_set_interval();
|
|
935
|
+
process2 = require_process();
|
|
936
|
+
setImmediate2 = require_set_immediate();
|
|
937
|
+
Gauge = class {
|
|
938
|
+
_status;
|
|
939
|
+
_paused;
|
|
940
|
+
_disabled;
|
|
941
|
+
_showing;
|
|
942
|
+
_onScreen;
|
|
943
|
+
_needsRedraw;
|
|
944
|
+
_hideCursor;
|
|
945
|
+
_fixedFramerate;
|
|
946
|
+
_lastUpdateAt;
|
|
947
|
+
_updateInterval;
|
|
948
|
+
_themes;
|
|
949
|
+
_theme;
|
|
950
|
+
_gauge;
|
|
951
|
+
_tty;
|
|
952
|
+
_writeTo;
|
|
953
|
+
_$$doRedraw;
|
|
954
|
+
_$$handleSizeChange;
|
|
955
|
+
_cleanupOnExit;
|
|
956
|
+
_removeOnExit;
|
|
957
|
+
redrawTracker;
|
|
958
|
+
constructor(arg1, arg2) {
|
|
959
|
+
let options, writeTo;
|
|
960
|
+
if (arg1 && arg1.write) {
|
|
961
|
+
writeTo = arg1;
|
|
962
|
+
options = arg2 || {};
|
|
963
|
+
} else if (arg2 && arg2.write) {
|
|
964
|
+
writeTo = arg2;
|
|
965
|
+
options = arg1 || {};
|
|
966
|
+
} else {
|
|
967
|
+
writeTo = process2.stderr;
|
|
968
|
+
options = arg1 || arg2 || {};
|
|
969
|
+
}
|
|
970
|
+
this._status = {
|
|
971
|
+
spun: 0,
|
|
972
|
+
section: "",
|
|
973
|
+
subsection: ""
|
|
974
|
+
};
|
|
975
|
+
this._paused = false;
|
|
976
|
+
this._disabled = true;
|
|
977
|
+
this._showing = false;
|
|
978
|
+
this._onScreen = false;
|
|
979
|
+
this._needsRedraw = false;
|
|
980
|
+
this._hideCursor = options.hideCursor == null ? true : options.hideCursor;
|
|
981
|
+
this._fixedFramerate = options.fixedFramerate == null ? !/^v0\.8\./.test(process2.version) : options.fixedFramerate;
|
|
982
|
+
this._lastUpdateAt = null;
|
|
983
|
+
this._updateInterval = options.updateInterval == null ? 50 : options.updateInterval;
|
|
984
|
+
this._themes = options.themes || defaultThemes;
|
|
985
|
+
this._theme = options.theme;
|
|
986
|
+
const theme = this._computeTheme(options.theme);
|
|
987
|
+
const template = options.template || [
|
|
988
|
+
{ type: "progressbar", length: 20 },
|
|
989
|
+
{ type: "activityIndicator", kerning: 1, length: 1 },
|
|
990
|
+
{ type: "section", kerning: 1, default: "" },
|
|
991
|
+
{ type: "subsection", kerning: 1, default: "" }
|
|
992
|
+
];
|
|
993
|
+
this.setWriteTo(writeTo, options.tty);
|
|
994
|
+
const PlumbingClass = options.Plumbing || Plumbing;
|
|
995
|
+
this._gauge = new PlumbingClass(theme, template, this.getWidth());
|
|
996
|
+
this._$$doRedraw = callWith(this, this._doRedraw);
|
|
997
|
+
this._$$handleSizeChange = callWith(this, this._handleSizeChange);
|
|
998
|
+
this._cleanupOnExit = options.cleanupOnExit == null || options.cleanupOnExit;
|
|
999
|
+
this._removeOnExit = null;
|
|
1000
|
+
if (options.enabled || options.enabled == null && this._tty && this._tty.isTTY) {
|
|
1001
|
+
this.enable();
|
|
1002
|
+
} else {
|
|
1003
|
+
this.disable();
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
isEnabled() {
|
|
1007
|
+
return !this._disabled;
|
|
1008
|
+
}
|
|
1009
|
+
setTemplate(template) {
|
|
1010
|
+
this._gauge.setTemplate(template);
|
|
1011
|
+
if (this._showing) {
|
|
1012
|
+
this._requestRedraw();
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
_computeTheme(theme) {
|
|
1016
|
+
if (!theme) {
|
|
1017
|
+
theme = {};
|
|
1018
|
+
}
|
|
1019
|
+
if (typeof theme === "string") {
|
|
1020
|
+
theme = this._themes.getTheme(theme);
|
|
1021
|
+
} else if (Object.keys(theme).length === 0 || theme.hasUnicode != null || theme.hasColor != null) {
|
|
1022
|
+
const useUnicode = theme.hasUnicode == null ? hasUnicode() : theme.hasUnicode;
|
|
1023
|
+
const useColor = theme.hasColor == null ? hasColor : theme.hasColor;
|
|
1024
|
+
theme = this._themes.getDefault({
|
|
1025
|
+
hasUnicode: useUnicode,
|
|
1026
|
+
hasColor: useColor,
|
|
1027
|
+
platform: theme.platform
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
return theme;
|
|
1031
|
+
}
|
|
1032
|
+
setThemeset(themes) {
|
|
1033
|
+
this._themes = themes;
|
|
1034
|
+
this.setTheme(this._theme);
|
|
1035
|
+
}
|
|
1036
|
+
setTheme(theme) {
|
|
1037
|
+
this._gauge.setTheme(this._computeTheme(theme));
|
|
1038
|
+
if (this._showing) {
|
|
1039
|
+
this._requestRedraw();
|
|
1040
|
+
}
|
|
1041
|
+
this._theme = theme;
|
|
1042
|
+
}
|
|
1043
|
+
_requestRedraw() {
|
|
1044
|
+
this._needsRedraw = true;
|
|
1045
|
+
if (!this._fixedFramerate) {
|
|
1046
|
+
this._doRedraw();
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
getWidth() {
|
|
1050
|
+
return (this._tty && this._tty.columns || 80) - 1;
|
|
1051
|
+
}
|
|
1052
|
+
setWriteTo(writeTo, tty) {
|
|
1053
|
+
const enabled = !this._disabled;
|
|
1054
|
+
if (enabled) {
|
|
1055
|
+
this.disable();
|
|
1056
|
+
}
|
|
1057
|
+
this._writeTo = writeTo;
|
|
1058
|
+
this._tty = tty || writeTo === process2.stderr && process2.stdout.isTTY && process2.stdout || writeTo.isTTY && writeTo || this._tty;
|
|
1059
|
+
if (this._gauge) {
|
|
1060
|
+
this._gauge.setWidth(this.getWidth());
|
|
1061
|
+
}
|
|
1062
|
+
if (enabled) {
|
|
1063
|
+
this.enable();
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
enable() {
|
|
1067
|
+
if (!this._disabled) {
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
this._disabled = false;
|
|
1071
|
+
if (this._tty) {
|
|
1072
|
+
this._enableEvents();
|
|
1073
|
+
}
|
|
1074
|
+
if (this._showing) {
|
|
1075
|
+
this.show();
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
disable() {
|
|
1079
|
+
if (this._disabled) {
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
if (this._showing) {
|
|
1083
|
+
this._lastUpdateAt = null;
|
|
1084
|
+
this._showing = false;
|
|
1085
|
+
this._doRedraw();
|
|
1086
|
+
this._showing = true;
|
|
1087
|
+
}
|
|
1088
|
+
this._disabled = true;
|
|
1089
|
+
if (this._tty) {
|
|
1090
|
+
this._disableEvents();
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
_enableEvents() {
|
|
1094
|
+
if (this._cleanupOnExit) {
|
|
1095
|
+
this._removeOnExit = (0, import_signal_exit.default)(callWith(this, this.disable));
|
|
1096
|
+
}
|
|
1097
|
+
this._tty.on("resize", this._$$handleSizeChange);
|
|
1098
|
+
if (this._fixedFramerate) {
|
|
1099
|
+
this.redrawTracker = setInterval2(this._$$doRedraw, this._updateInterval);
|
|
1100
|
+
if (this.redrawTracker.unref) {
|
|
1101
|
+
this.redrawTracker.unref();
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
_disableEvents() {
|
|
1106
|
+
this._tty.removeListener("resize", this._$$handleSizeChange);
|
|
1107
|
+
if (this._fixedFramerate) {
|
|
1108
|
+
clearInterval(this.redrawTracker);
|
|
1109
|
+
}
|
|
1110
|
+
if (this._removeOnExit) {
|
|
1111
|
+
this._removeOnExit();
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
hide(cb) {
|
|
1115
|
+
if (this._disabled) {
|
|
1116
|
+
return cb && process2.nextTick(cb);
|
|
1117
|
+
}
|
|
1118
|
+
if (!this._showing) {
|
|
1119
|
+
return cb && process2.nextTick(cb);
|
|
1120
|
+
}
|
|
1121
|
+
this._showing = false;
|
|
1122
|
+
this._doRedraw();
|
|
1123
|
+
cb && setImmediate2(cb);
|
|
1124
|
+
}
|
|
1125
|
+
show(section, completed) {
|
|
1126
|
+
this._showing = true;
|
|
1127
|
+
if (typeof section === "string") {
|
|
1128
|
+
this._status.section = section;
|
|
1129
|
+
} else if (typeof section === "object") {
|
|
1130
|
+
const sectionKeys = Object.keys(section);
|
|
1131
|
+
for (let ii = 0; ii < sectionKeys.length; ++ii) {
|
|
1132
|
+
const key = sectionKeys[ii];
|
|
1133
|
+
this._status[key] = section[key];
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
if (completed != null) {
|
|
1137
|
+
this._status.completed = completed;
|
|
1138
|
+
}
|
|
1139
|
+
if (this._disabled) {
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
this._requestRedraw();
|
|
1143
|
+
}
|
|
1144
|
+
pulse(subsection) {
|
|
1145
|
+
this._status.subsection = subsection || "";
|
|
1146
|
+
this._status.spun++;
|
|
1147
|
+
if (this._disabled) {
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
if (!this._showing) {
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1153
|
+
this._requestRedraw();
|
|
1154
|
+
}
|
|
1155
|
+
_handleSizeChange() {
|
|
1156
|
+
this._gauge.setWidth(this._tty.columns - 1);
|
|
1157
|
+
this._requestRedraw();
|
|
1158
|
+
}
|
|
1159
|
+
_doRedraw() {
|
|
1160
|
+
if (this._disabled || this._paused) {
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
if (!this._fixedFramerate) {
|
|
1164
|
+
const now = Date.now();
|
|
1165
|
+
if (this._lastUpdateAt && now - this._lastUpdateAt < this._updateInterval) {
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
this._lastUpdateAt = now;
|
|
1169
|
+
}
|
|
1170
|
+
if (!this._showing && this._onScreen) {
|
|
1171
|
+
this._onScreen = false;
|
|
1172
|
+
let result = this._gauge.hide();
|
|
1173
|
+
if (this._hideCursor) {
|
|
1174
|
+
result += this._gauge.showCursor();
|
|
1175
|
+
}
|
|
1176
|
+
return this._writeTo.write(result);
|
|
1177
|
+
}
|
|
1178
|
+
if (!this._showing && !this._onScreen) {
|
|
1179
|
+
return;
|
|
1180
|
+
}
|
|
1181
|
+
if (this._showing && !this._onScreen) {
|
|
1182
|
+
this._onScreen = true;
|
|
1183
|
+
this._needsRedraw = true;
|
|
1184
|
+
if (this._hideCursor) {
|
|
1185
|
+
this._writeTo.write(this._gauge.hideCursor());
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
if (!this._needsRedraw) {
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
if (!this._writeTo.write(this._gauge.show(this._status))) {
|
|
1192
|
+
this._paused = true;
|
|
1193
|
+
this._writeTo.on(
|
|
1194
|
+
"drain",
|
|
1195
|
+
callWith(this, function() {
|
|
1196
|
+
this._paused = false;
|
|
1197
|
+
this._doRedraw();
|
|
1198
|
+
})
|
|
1199
|
+
);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
};
|
|
1203
|
+
}
|
|
1204
|
+
});
|
|
1205
|
+
|
|
1206
|
+
// libs/core/src/lib/npmlog/index.ts
|
|
1207
|
+
var import_node_events2, import_node_util, setBlocking, consoleControl, Logger, log, trackerConstructors, mixinLog, npmlog_default;
|
|
1208
|
+
var init_npmlog = __esm({
|
|
1209
|
+
"libs/core/src/lib/npmlog/index.ts"() {
|
|
1210
|
+
"use strict";
|
|
1211
|
+
import_node_events2 = require("node:events");
|
|
1212
|
+
import_node_util = __toESM(require("node:util"));
|
|
1213
|
+
init_tracker_group();
|
|
1214
|
+
init_gauge();
|
|
1215
|
+
setBlocking = require("set-blocking");
|
|
1216
|
+
consoleControl = require("console-control-strings");
|
|
1217
|
+
setBlocking(true);
|
|
1218
|
+
Logger = class extends import_node_events2.EventEmitter {
|
|
1219
|
+
_stream;
|
|
1220
|
+
_paused;
|
|
1221
|
+
_buffer;
|
|
1222
|
+
unicodeEnabled;
|
|
1223
|
+
colorEnabled;
|
|
1224
|
+
id;
|
|
1225
|
+
record;
|
|
1226
|
+
maxRecordSize;
|
|
1227
|
+
gauge;
|
|
1228
|
+
tracker;
|
|
1229
|
+
progressEnabled;
|
|
1230
|
+
level;
|
|
1231
|
+
prefixStyle;
|
|
1232
|
+
headingStyle;
|
|
1233
|
+
style;
|
|
1234
|
+
levels;
|
|
1235
|
+
disp;
|
|
1236
|
+
heading;
|
|
1237
|
+
// Known log levels, assigned dynamically in the constructor
|
|
1238
|
+
silly;
|
|
1239
|
+
verbose;
|
|
1240
|
+
info;
|
|
1241
|
+
timing;
|
|
1242
|
+
http;
|
|
1243
|
+
notice;
|
|
1244
|
+
warn;
|
|
1245
|
+
error;
|
|
1246
|
+
silent;
|
|
1247
|
+
constructor() {
|
|
1248
|
+
super();
|
|
1249
|
+
this._stream = process.stderr;
|
|
1250
|
+
this._paused = false;
|
|
1251
|
+
this._buffer = [];
|
|
1252
|
+
this.unicodeEnabled = false;
|
|
1253
|
+
this.colorEnabled = void 0;
|
|
1254
|
+
this.id = 0;
|
|
1255
|
+
this.record = [];
|
|
1256
|
+
this.maxRecordSize = 1e4;
|
|
1257
|
+
this.level = "info";
|
|
1258
|
+
this.prefixStyle = { fg: "magenta" };
|
|
1259
|
+
this.headingStyle = { fg: "white", bg: "black" };
|
|
1260
|
+
this.style = {};
|
|
1261
|
+
this.levels = {};
|
|
1262
|
+
this.disp = {};
|
|
1263
|
+
this.gauge = new Gauge(this._stream, {
|
|
1264
|
+
enabled: false,
|
|
1265
|
+
theme: { hasColor: this.useColor() },
|
|
1266
|
+
template: [
|
|
1267
|
+
{ type: "progressbar", length: 20 },
|
|
1268
|
+
{ type: "activityIndicator", kerning: 1, length: 1 },
|
|
1269
|
+
{ type: "section", default: "" },
|
|
1270
|
+
":",
|
|
1271
|
+
{ type: "logline", kerning: 1, default: "" }
|
|
1272
|
+
]
|
|
1273
|
+
});
|
|
1274
|
+
this.tracker = new TrackerGroup();
|
|
1275
|
+
this.progressEnabled = this.gauge.isEnabled();
|
|
1276
|
+
this.addLevel("silly", -Infinity, { inverse: true }, "sill");
|
|
1277
|
+
this.addLevel("verbose", 1e3, { fg: "cyan", bg: "black" }, "verb");
|
|
1278
|
+
this.addLevel("info", 2e3, { fg: "green" });
|
|
1279
|
+
this.addLevel("timing", 2500, { fg: "green", bg: "black" });
|
|
1280
|
+
this.addLevel("http", 3e3, { fg: "green", bg: "black" });
|
|
1281
|
+
this.addLevel("notice", 3500, { fg: "cyan", bg: "black" });
|
|
1282
|
+
this.addLevel("warn", 4e3, { fg: "black", bg: "yellow" }, "WARN");
|
|
1283
|
+
this.addLevel("error", 5e3, { fg: "red", bg: "black" }, "ERR!");
|
|
1284
|
+
this.addLevel("silent", Infinity);
|
|
1285
|
+
this.on("error", () => {
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
get stream() {
|
|
1289
|
+
return this._stream;
|
|
1290
|
+
}
|
|
1291
|
+
set stream(newStream) {
|
|
1292
|
+
this._stream = newStream;
|
|
1293
|
+
if (this.gauge) {
|
|
1294
|
+
this.gauge.setWriteTo(this._stream, this._stream);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
useColor() {
|
|
1298
|
+
return this.colorEnabled != null ? this.colorEnabled : this._stream?.isTTY ?? false;
|
|
1299
|
+
}
|
|
1300
|
+
enableColor() {
|
|
1301
|
+
this.colorEnabled = true;
|
|
1302
|
+
this.gauge.setTheme({ hasColor: this.colorEnabled, hasUnicode: this.unicodeEnabled });
|
|
1303
|
+
}
|
|
1304
|
+
disableColor() {
|
|
1305
|
+
this.colorEnabled = false;
|
|
1306
|
+
this.gauge.setTheme({ hasColor: this.colorEnabled, hasUnicode: this.unicodeEnabled });
|
|
1307
|
+
}
|
|
1308
|
+
enableUnicode() {
|
|
1309
|
+
this.unicodeEnabled = true;
|
|
1310
|
+
this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: this.unicodeEnabled });
|
|
1311
|
+
}
|
|
1312
|
+
disableUnicode() {
|
|
1313
|
+
this.unicodeEnabled = false;
|
|
1314
|
+
this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: this.unicodeEnabled });
|
|
1315
|
+
}
|
|
1316
|
+
setGaugeThemeset(themes) {
|
|
1317
|
+
this.gauge.setThemeset(themes);
|
|
1318
|
+
}
|
|
1319
|
+
setGaugeTemplate(template) {
|
|
1320
|
+
this.gauge.setTemplate(template);
|
|
1321
|
+
}
|
|
1322
|
+
enableProgress() {
|
|
1323
|
+
if (this.progressEnabled || this._paused) {
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
this.progressEnabled = true;
|
|
1327
|
+
this.tracker.on("change", this.showProgress.bind(this));
|
|
1328
|
+
this.gauge.enable();
|
|
1329
|
+
}
|
|
1330
|
+
disableProgress() {
|
|
1331
|
+
if (!this.progressEnabled) {
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
this.progressEnabled = false;
|
|
1335
|
+
this.tracker.removeListener("change", this.showProgress.bind(this));
|
|
1336
|
+
this.gauge.disable();
|
|
1337
|
+
}
|
|
1338
|
+
clearProgress(cb) {
|
|
1339
|
+
if (!this.progressEnabled) {
|
|
1340
|
+
return cb && process.nextTick(cb);
|
|
1341
|
+
}
|
|
1342
|
+
this.gauge.hide(cb);
|
|
1343
|
+
}
|
|
1344
|
+
showProgress(name, completed) {
|
|
1345
|
+
if (!this.progressEnabled) {
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
const values = {};
|
|
1349
|
+
if (name) {
|
|
1350
|
+
values.section = name;
|
|
1351
|
+
}
|
|
1352
|
+
const last = this.record[this.record.length - 1];
|
|
1353
|
+
if (last) {
|
|
1354
|
+
values.subsection = last.prefix;
|
|
1355
|
+
const disp = this.disp[last.level];
|
|
1356
|
+
let logline = this._format(disp, this.style[last.level]);
|
|
1357
|
+
if (last.prefix) {
|
|
1358
|
+
logline += " " + this._format(last.prefix, this.prefixStyle);
|
|
1359
|
+
}
|
|
1360
|
+
logline += " " + last.message.split(/\r?\n/)[0];
|
|
1361
|
+
values.logline = logline;
|
|
1362
|
+
}
|
|
1363
|
+
values.completed = completed || this.tracker.completed();
|
|
1364
|
+
this.gauge.show(values);
|
|
1365
|
+
}
|
|
1366
|
+
pause() {
|
|
1367
|
+
this._paused = true;
|
|
1368
|
+
if (this.progressEnabled) {
|
|
1369
|
+
this.gauge.disable();
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
resume() {
|
|
1373
|
+
if (!this._paused) {
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
this._paused = false;
|
|
1377
|
+
const buffer = this._buffer;
|
|
1378
|
+
this._buffer = [];
|
|
1379
|
+
buffer.forEach((m) => this.emitLog(m));
|
|
1380
|
+
if (this.progressEnabled) {
|
|
1381
|
+
this.gauge.enable();
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
log(lvl, prefix, ...messageArgs) {
|
|
1385
|
+
const l = this.levels[lvl];
|
|
1386
|
+
if (l === void 0) {
|
|
1387
|
+
this.emit("error", new Error(import_node_util.default.format("Undefined log level: %j", lvl)));
|
|
1388
|
+
return;
|
|
1389
|
+
}
|
|
1390
|
+
let stack = null;
|
|
1391
|
+
const a = messageArgs.map((arg) => {
|
|
1392
|
+
if (arg instanceof Error && arg.stack) {
|
|
1393
|
+
Object.defineProperty(arg, "stack", {
|
|
1394
|
+
value: stack = arg.stack + "",
|
|
1395
|
+
enumerable: true,
|
|
1396
|
+
writable: true
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1399
|
+
return arg;
|
|
1400
|
+
});
|
|
1401
|
+
if (stack) {
|
|
1402
|
+
a.unshift(stack + "\n");
|
|
1403
|
+
}
|
|
1404
|
+
const message = import_node_util.default.format(...a);
|
|
1405
|
+
const m = {
|
|
1406
|
+
id: this.id++,
|
|
1407
|
+
level: lvl,
|
|
1408
|
+
prefix: String(prefix || ""),
|
|
1409
|
+
message,
|
|
1410
|
+
messageRaw: a
|
|
1411
|
+
};
|
|
1412
|
+
this.emit("log", m);
|
|
1413
|
+
this.emit(`log.${lvl}`, m);
|
|
1414
|
+
if (m.prefix) {
|
|
1415
|
+
this.emit(m.prefix, m);
|
|
1416
|
+
}
|
|
1417
|
+
this.record.push(m);
|
|
1418
|
+
const mrs = this.maxRecordSize;
|
|
1419
|
+
if (this.record.length > mrs) {
|
|
1420
|
+
this.record = this.record.slice(-Math.floor(mrs * 0.9));
|
|
1421
|
+
}
|
|
1422
|
+
this.emitLog(m);
|
|
1423
|
+
}
|
|
1424
|
+
emitLog(m) {
|
|
1425
|
+
if (this._paused) {
|
|
1426
|
+
this._buffer.push(m);
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1429
|
+
if (this.progressEnabled) {
|
|
1430
|
+
this.gauge.pulse(m.prefix);
|
|
1431
|
+
}
|
|
1432
|
+
const l = this.levels[m.level];
|
|
1433
|
+
if (l === void 0 || l < this.levels[this.level] || l > 0 && !isFinite(l)) {
|
|
1434
|
+
return;
|
|
1435
|
+
}
|
|
1436
|
+
const disp = this.disp[m.level];
|
|
1437
|
+
this.clearProgress();
|
|
1438
|
+
m.message?.split(/\r?\n/).forEach((line) => {
|
|
1439
|
+
const heading = this.heading;
|
|
1440
|
+
if (heading) {
|
|
1441
|
+
this.write(heading, this.headingStyle);
|
|
1442
|
+
this.write(" ");
|
|
1443
|
+
}
|
|
1444
|
+
this.write(disp, this.style[m.level]);
|
|
1445
|
+
const p = m.prefix || "";
|
|
1446
|
+
if (p) {
|
|
1447
|
+
this.write(" ");
|
|
1448
|
+
}
|
|
1449
|
+
this.write(p, this.prefixStyle);
|
|
1450
|
+
this.write(" " + line + "\n");
|
|
1451
|
+
});
|
|
1452
|
+
this.showProgress();
|
|
1453
|
+
}
|
|
1454
|
+
_format(msg, style) {
|
|
1455
|
+
if (!this._stream) {
|
|
1456
|
+
return;
|
|
1457
|
+
}
|
|
1458
|
+
let output2 = "";
|
|
1459
|
+
if (this.useColor()) {
|
|
1460
|
+
style = style || {};
|
|
1461
|
+
const settings = [];
|
|
1462
|
+
if (style.fg) settings.push(style.fg);
|
|
1463
|
+
if (style.bg) settings.push("bg" + style.bg[0].toUpperCase() + style.bg.slice(1));
|
|
1464
|
+
if (style.bold) settings.push("bold");
|
|
1465
|
+
if (style.underline) settings.push("underline");
|
|
1466
|
+
if (style.inverse) settings.push("inverse");
|
|
1467
|
+
if (settings.length) output2 += consoleControl.color(settings);
|
|
1468
|
+
if (style.beep) output2 += consoleControl.beep();
|
|
1469
|
+
}
|
|
1470
|
+
output2 += msg;
|
|
1471
|
+
if (this.useColor()) output2 += consoleControl.color("reset");
|
|
1472
|
+
return output2;
|
|
1473
|
+
}
|
|
1474
|
+
write(msg, style) {
|
|
1475
|
+
if (!this._stream) {
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
this._stream.write(this._format(msg, style));
|
|
1479
|
+
}
|
|
1480
|
+
addLevel(lvl, n, style, disp = null) {
|
|
1481
|
+
if (disp == null) {
|
|
1482
|
+
disp = lvl;
|
|
1483
|
+
}
|
|
1484
|
+
this.levels[lvl] = n;
|
|
1485
|
+
this.style[lvl] = style;
|
|
1486
|
+
if (!this[lvl]) {
|
|
1487
|
+
this[lvl] = (...args) => {
|
|
1488
|
+
const a = [lvl, ...args];
|
|
1489
|
+
return this.log.apply(this, a);
|
|
1490
|
+
};
|
|
1491
|
+
}
|
|
1492
|
+
this.disp[lvl] = disp;
|
|
1493
|
+
}
|
|
1494
|
+
};
|
|
1495
|
+
log = new Logger();
|
|
1496
|
+
trackerConstructors = ["newGroup", "newItem", "newStream"];
|
|
1497
|
+
mixinLog = function(tracker) {
|
|
1498
|
+
Array.from(
|
|
1499
|
+
/* @__PURE__ */ new Set([...Object.keys(log), ...Object.getOwnPropertyNames(Object.getPrototypeOf(log))])
|
|
1500
|
+
).forEach(function(P) {
|
|
1501
|
+
if (P[0] === "_") {
|
|
1502
|
+
return;
|
|
1503
|
+
}
|
|
1504
|
+
if (trackerConstructors.filter(function(C) {
|
|
1505
|
+
return C === P;
|
|
1506
|
+
}).length) {
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
if (tracker[P]) {
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
if (typeof log[P] !== "function") {
|
|
1513
|
+
return;
|
|
1514
|
+
}
|
|
1515
|
+
const func = log[P];
|
|
1516
|
+
tracker[P] = function() {
|
|
1517
|
+
return func.apply(log, arguments);
|
|
1518
|
+
};
|
|
1519
|
+
});
|
|
1520
|
+
if (tracker instanceof TrackerGroup) {
|
|
1521
|
+
trackerConstructors.forEach(function(C) {
|
|
1522
|
+
const func = tracker[C];
|
|
1523
|
+
tracker[C] = function() {
|
|
1524
|
+
return mixinLog(func.apply(tracker, arguments));
|
|
1525
|
+
};
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
return tracker;
|
|
1529
|
+
};
|
|
1530
|
+
trackerConstructors.forEach(function(C) {
|
|
1531
|
+
log[C] = function() {
|
|
1532
|
+
return mixinLog(this.tracker[C].apply(this.tracker, arguments));
|
|
1533
|
+
};
|
|
1534
|
+
});
|
|
1535
|
+
npmlog_default = log;
|
|
1536
|
+
}
|
|
1537
|
+
});
|
|
1538
|
+
|
|
1539
|
+
// libs/child-process/src/forked-strong-log-transformer.ts
|
|
1540
|
+
function Logger2(options) {
|
|
1541
|
+
var defaults = JSON.parse(JSON.stringify(Logger2.DEFAULTS));
|
|
1542
|
+
options = Object.assign(defaults, options || {});
|
|
1543
|
+
var catcher = deLiner();
|
|
1544
|
+
var emitter = catcher;
|
|
1545
|
+
var transforms = [objectifier()];
|
|
1546
|
+
if (options.tag) {
|
|
1547
|
+
transforms.push(staticTagger(options.tag));
|
|
1548
|
+
}
|
|
1549
|
+
if (options.mergeMultiline) {
|
|
1550
|
+
transforms.push(lineMerger());
|
|
1551
|
+
}
|
|
1552
|
+
transforms.push(formatters[options.format](options));
|
|
1553
|
+
transforms.push(reLiner());
|
|
1554
|
+
for (var t in transforms) {
|
|
1555
|
+
emitter = emitter.pipe(transforms[t]);
|
|
1556
|
+
}
|
|
1557
|
+
return createDuplex(catcher, emitter);
|
|
1558
|
+
}
|
|
1559
|
+
function deLiner() {
|
|
1560
|
+
var decoder = new import_node_string_decoder.StringDecoder("utf8");
|
|
1561
|
+
var last = "";
|
|
1562
|
+
return new import_node_stream2.default.Transform({
|
|
1563
|
+
transform(chunk, _enc, callback) {
|
|
1564
|
+
last += decoder.write(chunk);
|
|
1565
|
+
var list3 = last.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g);
|
|
1566
|
+
last = list3.pop();
|
|
1567
|
+
for (var i = 0; i < list3.length; i++) {
|
|
1568
|
+
if (list3[i]) {
|
|
1569
|
+
this.push(list3[i]);
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
callback();
|
|
1573
|
+
},
|
|
1574
|
+
flush(callback) {
|
|
1575
|
+
last += decoder.end();
|
|
1576
|
+
if (last) {
|
|
1577
|
+
this.push(last);
|
|
1578
|
+
}
|
|
1579
|
+
callback();
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
function reLiner() {
|
|
1584
|
+
return (0, import_through.default)(appendNewline);
|
|
1585
|
+
function appendNewline(line) {
|
|
1586
|
+
this.emit("data", line + "\n");
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
function objectifier() {
|
|
1590
|
+
return (0, import_through.default)(objectify, null, { autoDestroy: false });
|
|
1591
|
+
function objectify(line) {
|
|
1592
|
+
this.emit("data", {
|
|
1593
|
+
msg: line,
|
|
1594
|
+
time: Date.now()
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
function staticTagger(tag) {
|
|
1599
|
+
return (0, import_through.default)(tagger);
|
|
1600
|
+
function tagger(logEvent) {
|
|
1601
|
+
logEvent.tag = tag;
|
|
1602
|
+
this.emit("data", logEvent);
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
function textFormatter(options) {
|
|
1606
|
+
return (0, import_through.default)(textify);
|
|
1607
|
+
function textify(logEvent) {
|
|
1608
|
+
var line = import_node_util2.default.format("%s%s", textifyTags(logEvent.tag), logEvent.msg.toString());
|
|
1609
|
+
if (options.timeStamp) {
|
|
1610
|
+
line = import_node_util2.default.format("%s %s", new Date(logEvent.time).toISOString(), line);
|
|
1611
|
+
}
|
|
1612
|
+
this.emit("data", line.replace(/\n/g, "\\n"));
|
|
1613
|
+
}
|
|
1614
|
+
function textifyTags(tags) {
|
|
1615
|
+
var str = "";
|
|
1616
|
+
if (typeof tags === "string") {
|
|
1617
|
+
str = tags + " ";
|
|
1618
|
+
} else if (typeof tags === "object") {
|
|
1619
|
+
for (var t in tags) {
|
|
1620
|
+
str += t + ":" + tags[t] + " ";
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
return str;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
function jsonFormatter(options) {
|
|
1627
|
+
return (0, import_through.default)(jsonify);
|
|
1628
|
+
function jsonify(logEvent) {
|
|
1629
|
+
if (options.timeStamp) {
|
|
1630
|
+
logEvent.time = new Date(logEvent.time).toISOString();
|
|
1631
|
+
} else {
|
|
1632
|
+
delete logEvent.time;
|
|
1633
|
+
}
|
|
1634
|
+
logEvent.msg = logEvent.msg.toString();
|
|
1635
|
+
this.emit("data", JSON.stringify(logEvent));
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
function lineMerger(host) {
|
|
1639
|
+
var previousLine = null;
|
|
1640
|
+
var flushTimer = null;
|
|
1641
|
+
var stream3 = (0, import_through.default)(lineMergerWrite, lineMergerEnd);
|
|
1642
|
+
var flush = _flush.bind(stream3);
|
|
1643
|
+
return stream3;
|
|
1644
|
+
function lineMergerWrite(line) {
|
|
1645
|
+
if (/^\s+/.test(line.msg)) {
|
|
1646
|
+
if (previousLine) {
|
|
1647
|
+
previousLine.msg += "\n" + line.msg;
|
|
1648
|
+
} else {
|
|
1649
|
+
previousLine = line;
|
|
1650
|
+
}
|
|
1651
|
+
} else {
|
|
1652
|
+
flush();
|
|
1653
|
+
previousLine = line;
|
|
1654
|
+
}
|
|
1655
|
+
clearTimeout(flushTimer);
|
|
1656
|
+
flushTimer = setTimeout(flush.bind(this), 10);
|
|
1657
|
+
}
|
|
1658
|
+
function _flush() {
|
|
1659
|
+
if (previousLine) {
|
|
1660
|
+
this.emit("data", previousLine);
|
|
1661
|
+
previousLine = null;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
function lineMergerEnd() {
|
|
1665
|
+
flush.call(this);
|
|
1666
|
+
this.emit("end");
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
function createDuplex(input, output2) {
|
|
1670
|
+
const duplex = new import_node_stream2.default.Duplex({
|
|
1671
|
+
objectMode: false,
|
|
1672
|
+
allowHalfOpen: false
|
|
1673
|
+
});
|
|
1674
|
+
duplex._write = (chunk, encoding, cb) => {
|
|
1675
|
+
input.write(chunk, encoding, cb);
|
|
1676
|
+
};
|
|
1677
|
+
duplex._read = () => {
|
|
1678
|
+
};
|
|
1679
|
+
duplex._final = (cb) => {
|
|
1680
|
+
input.end(cb);
|
|
1681
|
+
};
|
|
1682
|
+
output2.on("data", (chunk) => {
|
|
1683
|
+
duplex.push(chunk);
|
|
1684
|
+
});
|
|
1685
|
+
output2.on("end", () => {
|
|
1686
|
+
duplex.push(null);
|
|
1687
|
+
});
|
|
1688
|
+
input.on("error", (err) => {
|
|
1689
|
+
duplex.emit("error", err);
|
|
1690
|
+
});
|
|
1691
|
+
output2.on("error", (err) => {
|
|
1692
|
+
duplex.emit("error", err);
|
|
1693
|
+
});
|
|
1694
|
+
return duplex;
|
|
1695
|
+
}
|
|
1696
|
+
var import_node_stream2, import_node_string_decoder, import_node_util2, import_through, forked_strong_log_transformer_default, formatters;
|
|
1697
|
+
var init_forked_strong_log_transformer = __esm({
|
|
1698
|
+
"libs/child-process/src/forked-strong-log-transformer.ts"() {
|
|
1699
|
+
"use strict";
|
|
1700
|
+
import_node_stream2 = __toESM(require("node:stream"));
|
|
1701
|
+
import_node_string_decoder = require("node:string_decoder");
|
|
1702
|
+
import_node_util2 = __toESM(require("node:util"));
|
|
1703
|
+
import_through = __toESM(require("through"));
|
|
1704
|
+
forked_strong_log_transformer_default = Logger2;
|
|
1705
|
+
Logger2.DEFAULTS = {
|
|
1706
|
+
format: "text",
|
|
1707
|
+
tag: "",
|
|
1708
|
+
mergeMultiline: false,
|
|
1709
|
+
timeStamp: false
|
|
1710
|
+
};
|
|
1711
|
+
formatters = {
|
|
1712
|
+
text: textFormatter,
|
|
1713
|
+
json: jsonFormatter
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1716
|
+
});
|
|
1717
|
+
|
|
1718
|
+
// libs/child-process/src/set-exit-code.ts
|
|
1719
|
+
function setExitCode(code) {
|
|
1720
|
+
process.exitCode = code;
|
|
1721
|
+
}
|
|
1722
|
+
var init_set_exit_code = __esm({
|
|
1723
|
+
"libs/child-process/src/set-exit-code.ts"() {
|
|
1724
|
+
"use strict";
|
|
1725
|
+
}
|
|
1726
|
+
});
|
|
1727
|
+
|
|
1728
|
+
// libs/child-process/src/index.ts
|
|
1729
|
+
var src_exports = {};
|
|
1730
|
+
__export(src_exports, {
|
|
1731
|
+
exec: () => exec,
|
|
1732
|
+
execSync: () => execSync,
|
|
1733
|
+
getChildProcessCount: () => getChildProcessCount,
|
|
1734
|
+
getExitCode: () => getExitCode,
|
|
1735
|
+
spawn: () => spawn,
|
|
1736
|
+
spawnStreaming: () => spawnStreaming
|
|
1737
|
+
});
|
|
1738
|
+
function exec(command, args, opts) {
|
|
1739
|
+
const options = Object.assign({ stdio: "pipe" }, opts);
|
|
1740
|
+
const spawned = spawnProcess(command, args, options);
|
|
1741
|
+
return wrapError(spawned);
|
|
1742
|
+
}
|
|
1743
|
+
function execSync(command, args, opts) {
|
|
1744
|
+
return import_execa.default.sync(command, args, opts).stdout;
|
|
1745
|
+
}
|
|
1746
|
+
function spawn(command, args, opts) {
|
|
1747
|
+
const options = Object.assign({}, opts, { stdio: "inherit" });
|
|
1748
|
+
const spawned = spawnProcess(command, args, options);
|
|
1749
|
+
return wrapError(spawned);
|
|
1750
|
+
}
|
|
1751
|
+
function spawnStreaming(command, args, opts, prefix) {
|
|
1752
|
+
const options = Object.assign({}, opts);
|
|
1753
|
+
options.stdio = ["ignore", "pipe", "pipe"];
|
|
1754
|
+
const spawned = spawnProcess(command, args, options);
|
|
1755
|
+
const stdoutOpts = {};
|
|
1756
|
+
const stderrOpts = {};
|
|
1757
|
+
if (prefix) {
|
|
1758
|
+
const colorName = colorWheel[currentColor % NUM_COLORS];
|
|
1759
|
+
const color = colorName;
|
|
1760
|
+
currentColor += 1;
|
|
1761
|
+
stdoutOpts.tag = `${color.bold(prefix)}:`;
|
|
1762
|
+
stderrOpts.tag = `${color(prefix)}:`;
|
|
1763
|
+
}
|
|
1764
|
+
if (children.size > process.stdout.listenerCount("close")) {
|
|
1765
|
+
process.stdout.setMaxListeners(children.size);
|
|
1766
|
+
process.stderr.setMaxListeners(children.size);
|
|
1767
|
+
}
|
|
1768
|
+
spawned.stdout?.pipe(forked_strong_log_transformer_default(stdoutOpts)).pipe(process.stdout);
|
|
1769
|
+
spawned.stderr?.pipe(forked_strong_log_transformer_default(stderrOpts)).pipe(process.stderr);
|
|
1770
|
+
return wrapError(spawned);
|
|
1771
|
+
}
|
|
1772
|
+
function getChildProcessCount() {
|
|
1773
|
+
return children.size;
|
|
1774
|
+
}
|
|
1775
|
+
function getExitCode(result) {
|
|
1776
|
+
if (result.exitCode) {
|
|
1777
|
+
return result.exitCode;
|
|
1778
|
+
}
|
|
1779
|
+
if (typeof result.code === "number") {
|
|
1780
|
+
return result.code;
|
|
1781
|
+
}
|
|
1782
|
+
if (typeof result.code === "string") {
|
|
1783
|
+
return import_node_os.default.constants.errno[result.code];
|
|
1784
|
+
}
|
|
1785
|
+
return process.exitCode;
|
|
1786
|
+
}
|
|
1787
|
+
function spawnProcess(command, args, opts) {
|
|
1788
|
+
const child = (0, import_execa.default)(command, args, opts);
|
|
1789
|
+
const drain = (exitCode, signal) => {
|
|
1790
|
+
children.delete(child);
|
|
1791
|
+
if (signal === void 0) {
|
|
1792
|
+
child.removeListener("exit", drain);
|
|
1793
|
+
}
|
|
1794
|
+
if (exitCode) {
|
|
1795
|
+
setExitCode(exitCode);
|
|
1796
|
+
}
|
|
1797
|
+
};
|
|
1798
|
+
child.once("exit", drain);
|
|
1799
|
+
child.once("error", drain);
|
|
1800
|
+
if (opts?.pkg) {
|
|
1801
|
+
child.pkg = opts.pkg;
|
|
1802
|
+
}
|
|
1803
|
+
children.add(child);
|
|
1804
|
+
return child;
|
|
1805
|
+
}
|
|
1806
|
+
function wrapError(spawned) {
|
|
1807
|
+
if (spawned.pkg) {
|
|
1808
|
+
return spawned.catch((err) => {
|
|
1809
|
+
err.exitCode = getExitCode(err);
|
|
1810
|
+
err.pkg = spawned.pkg;
|
|
1811
|
+
throw err;
|
|
1812
|
+
});
|
|
1813
|
+
}
|
|
1814
|
+
return spawned;
|
|
1815
|
+
}
|
|
1816
|
+
var import_chalk, import_execa, import_node_os, children, colorWheel, NUM_COLORS, currentColor;
|
|
1817
|
+
var init_src = __esm({
|
|
1818
|
+
"libs/child-process/src/index.ts"() {
|
|
1819
|
+
"use strict";
|
|
1820
|
+
import_chalk = __toESM(require("chalk"));
|
|
1821
|
+
import_execa = __toESM(require("execa"));
|
|
1822
|
+
import_node_os = __toESM(require("node:os"));
|
|
1823
|
+
init_forked_strong_log_transformer();
|
|
1824
|
+
init_set_exit_code();
|
|
1825
|
+
children = /* @__PURE__ */ new Set();
|
|
1826
|
+
colorWheel = [import_chalk.default.cyan, import_chalk.default.magenta, import_chalk.default.blue, import_chalk.default.yellow, import_chalk.default.green, import_chalk.default.blueBright];
|
|
1827
|
+
NUM_COLORS = colorWheel.length;
|
|
1828
|
+
currentColor = 0;
|
|
1829
|
+
}
|
|
1830
|
+
});
|
|
1831
|
+
|
|
1832
|
+
// libs/core/src/lib/collect-uncommitted.ts
|
|
1833
|
+
function collectUncommitted({ cwd, log: log2 = npmlog_default }) {
|
|
1834
|
+
log2.silly("collect-uncommitted", "git status --porcelain (async)");
|
|
1835
|
+
return childProcess.exec("git", ["status", "--porcelain"], { cwd }).then(({ stdout }) => transformOutput(stdout));
|
|
1836
|
+
}
|
|
1837
|
+
var import_chalk2, childProcess, maybeColorize, cRed, cGreen, replaceStatus, colorizeStats, splitOnNewLine, filterEmpty, o, transformOutput;
|
|
1838
|
+
var init_collect_uncommitted = __esm({
|
|
1839
|
+
"libs/core/src/lib/collect-uncommitted.ts"() {
|
|
1840
|
+
"use strict";
|
|
1841
|
+
import_chalk2 = __toESM(require("chalk"));
|
|
1842
|
+
init_npmlog();
|
|
1843
|
+
childProcess = (init_src(), __toCommonJS(src_exports));
|
|
1844
|
+
maybeColorize = (colorize) => (s) => s !== " " ? colorize(s) : s;
|
|
1845
|
+
cRed = maybeColorize(import_chalk2.default.red);
|
|
1846
|
+
cGreen = maybeColorize(import_chalk2.default.green);
|
|
1847
|
+
replaceStatus = (_, maybeGreen, maybeRed) => `${cGreen(maybeGreen)}${cRed(maybeRed)}`;
|
|
1848
|
+
colorizeStats = (stats) => stats.replace(/^([^U]| )([A-Z]| )/gm, replaceStatus).replace(/^\?{2}|U{2}/gm, cRed("$&"));
|
|
1849
|
+
splitOnNewLine = (str) => str.split("\n");
|
|
1850
|
+
filterEmpty = (lines) => lines.filter((line) => line.length);
|
|
1851
|
+
o = (l, r) => (x) => l(r(x));
|
|
1852
|
+
transformOutput = o(filterEmpty, o(splitOnNewLine, colorizeStats));
|
|
1853
|
+
}
|
|
1854
|
+
});
|
|
1855
|
+
|
|
1856
|
+
// libs/core/src/lib/describe-ref.ts
|
|
1857
|
+
var childProcess2;
|
|
1858
|
+
var init_describe_ref = __esm({
|
|
1859
|
+
"libs/core/src/lib/describe-ref.ts"() {
|
|
1860
|
+
"use strict";
|
|
1861
|
+
init_npmlog();
|
|
1862
|
+
childProcess2 = (init_src(), __toCommonJS(src_exports));
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
|
|
1866
|
+
// libs/core/src/lib/validation-error.ts
|
|
1867
|
+
var ValidationError;
|
|
1868
|
+
var init_validation_error = __esm({
|
|
1869
|
+
"libs/core/src/lib/validation-error.ts"() {
|
|
1870
|
+
"use strict";
|
|
1871
|
+
init_npmlog();
|
|
1872
|
+
ValidationError = class extends Error {
|
|
1873
|
+
prefix;
|
|
1874
|
+
constructor(prefix, message, ...rest) {
|
|
1875
|
+
super(message);
|
|
1876
|
+
this.name = "ValidationError";
|
|
1877
|
+
this.prefix = prefix;
|
|
1878
|
+
npmlog_default.resume();
|
|
1879
|
+
npmlog_default.error(prefix, message, ...rest);
|
|
1880
|
+
}
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1883
|
+
});
|
|
1884
|
+
|
|
1885
|
+
// libs/core/src/lib/check-working-tree.ts
|
|
1886
|
+
function mkThrowIfUncommitted(options = {}) {
|
|
1887
|
+
return function throwIfUncommitted2(opts) {
|
|
1888
|
+
if (opts.isDirty) {
|
|
1889
|
+
return collectUncommitted(options).then((uncommitted) => {
|
|
1890
|
+
throw new ValidationError("EUNCOMMIT", `${EUNCOMMIT_MSG}${uncommitted.join("\n")}`);
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
var EUNCOMMIT_MSG, throwIfUncommitted;
|
|
1896
|
+
var init_check_working_tree = __esm({
|
|
1897
|
+
"libs/core/src/lib/check-working-tree.ts"() {
|
|
1898
|
+
"use strict";
|
|
1899
|
+
init_collect_uncommitted();
|
|
1900
|
+
init_describe_ref();
|
|
1901
|
+
init_validation_error();
|
|
1902
|
+
EUNCOMMIT_MSG = "Working tree has uncommitted changes, please commit or remove the following changes before continuing:\n";
|
|
1903
|
+
throwIfUncommitted = mkThrowIfUncommitted();
|
|
1904
|
+
}
|
|
1905
|
+
});
|
|
1906
|
+
|
|
1907
|
+
// libs/core/src/lib/cli.ts
|
|
1908
|
+
var import_dedent, import_yargs;
|
|
1909
|
+
var init_cli = __esm({
|
|
1910
|
+
"libs/core/src/lib/cli.ts"() {
|
|
1911
|
+
"use strict";
|
|
1912
|
+
import_dedent = __toESM(require("dedent"));
|
|
1913
|
+
import_yargs = __toESM(require("yargs"));
|
|
1914
|
+
init_npmlog();
|
|
1915
|
+
process.env["NX_ISOLATE_PLUGINS"] = "false";
|
|
1916
|
+
process.env["NX_TUI"] = "false";
|
|
1917
|
+
process.env["npm_config_legacy_peer_deps"] ??= "false";
|
|
1918
|
+
}
|
|
1919
|
+
});
|
|
1920
|
+
|
|
1921
|
+
// libs/core/src/lib/get-packages-for-option.ts
|
|
1922
|
+
var init_get_packages_for_option = __esm({
|
|
1923
|
+
"libs/core/src/lib/get-packages-for-option.ts"() {
|
|
1924
|
+
"use strict";
|
|
1925
|
+
}
|
|
1926
|
+
});
|
|
1927
|
+
|
|
1928
|
+
// libs/core/src/lib/prerelease-id-from-version.ts
|
|
1929
|
+
var import_semver;
|
|
1930
|
+
var init_prerelease_id_from_version = __esm({
|
|
1931
|
+
"libs/core/src/lib/prerelease-id-from-version.ts"() {
|
|
1932
|
+
"use strict";
|
|
1933
|
+
import_semver = __toESM(require("semver"));
|
|
1934
|
+
}
|
|
1935
|
+
});
|
|
1936
|
+
|
|
1937
|
+
// libs/core/src/lib/project-graph-with-packages.ts
|
|
1938
|
+
var init_project_graph_with_packages = __esm({
|
|
1939
|
+
"libs/core/src/lib/project-graph-with-packages.ts"() {
|
|
1940
|
+
"use strict";
|
|
1941
|
+
}
|
|
1942
|
+
});
|
|
1943
|
+
|
|
1944
|
+
// libs/core/src/lib/collect-updates/has-tags.ts
|
|
1945
|
+
var childProcess3;
|
|
1946
|
+
var init_has_tags = __esm({
|
|
1947
|
+
"libs/core/src/lib/collect-updates/has-tags.ts"() {
|
|
1948
|
+
"use strict";
|
|
1949
|
+
init_npmlog();
|
|
1950
|
+
childProcess3 = (init_src(), __toCommonJS(src_exports));
|
|
1951
|
+
}
|
|
1952
|
+
});
|
|
1953
|
+
|
|
1954
|
+
// libs/core/src/lib/collect-updates/make-diff-predicate.ts
|
|
1955
|
+
var import_minimatch, import_slash, execSync2;
|
|
1956
|
+
var init_make_diff_predicate = __esm({
|
|
1957
|
+
"libs/core/src/lib/collect-updates/make-diff-predicate.ts"() {
|
|
1958
|
+
"use strict";
|
|
1959
|
+
import_minimatch = __toESM(require("minimatch"));
|
|
1960
|
+
import_slash = __toESM(require("slash"));
|
|
1961
|
+
init_npmlog();
|
|
1962
|
+
init_project_graph_with_packages();
|
|
1963
|
+
({ execSync: execSync2 } = (init_src(), __toCommonJS(src_exports)));
|
|
1964
|
+
}
|
|
1965
|
+
});
|
|
1966
|
+
|
|
1967
|
+
// libs/core/src/lib/collect-updates/collect-project-updates.ts
|
|
1968
|
+
var init_collect_project_updates = __esm({
|
|
1969
|
+
"libs/core/src/lib/collect-updates/collect-project-updates.ts"() {
|
|
1970
|
+
"use strict";
|
|
1971
|
+
init_describe_ref();
|
|
1972
|
+
init_get_packages_for_option();
|
|
1973
|
+
init_npmlog();
|
|
1974
|
+
init_prerelease_id_from_version();
|
|
1975
|
+
init_project_graph_with_packages();
|
|
1976
|
+
init_has_tags();
|
|
1977
|
+
init_make_diff_predicate();
|
|
1978
|
+
}
|
|
1979
|
+
});
|
|
1980
|
+
|
|
1981
|
+
// libs/core/src/lib/collect-updates/index.ts
|
|
1982
|
+
var init_collect_updates = __esm({
|
|
1983
|
+
"libs/core/src/lib/collect-updates/index.ts"() {
|
|
1984
|
+
"use strict";
|
|
1985
|
+
init_collect_project_updates();
|
|
1986
|
+
}
|
|
1987
|
+
});
|
|
1988
|
+
|
|
1989
|
+
// libs/core/src/lib/package.ts
|
|
1990
|
+
function binSafeName({ name, scope }) {
|
|
1991
|
+
return scope ? name.substring(scope.length + 1) : name;
|
|
1992
|
+
}
|
|
1993
|
+
function shallowCopy(json) {
|
|
1994
|
+
return Object.keys(json).reduce((obj, key) => {
|
|
1995
|
+
const val = json[key];
|
|
1996
|
+
if (Array.isArray(val)) {
|
|
1997
|
+
obj[key] = val.slice();
|
|
1998
|
+
} else if (val && typeof val === "object") {
|
|
1999
|
+
obj[key] = Object.assign({}, val);
|
|
2000
|
+
} else {
|
|
2001
|
+
obj[key] = val;
|
|
2002
|
+
}
|
|
2003
|
+
return obj;
|
|
2004
|
+
}, {});
|
|
2005
|
+
}
|
|
2006
|
+
var import_devkit, import_fs, import_load_json_file, import_npm_package_arg, import_path, import_write_pkg, PKG, _location, _resolved, _rootPath, _scripts, _contents, Package;
|
|
2007
|
+
var init_package = __esm({
|
|
2008
|
+
"libs/core/src/lib/package.ts"() {
|
|
2009
|
+
"use strict";
|
|
2010
|
+
import_devkit = require("@nx/devkit");
|
|
2011
|
+
import_fs = __toESM(require("fs"));
|
|
2012
|
+
import_load_json_file = __toESM(require("load-json-file"));
|
|
2013
|
+
import_npm_package_arg = __toESM(require("npm-package-arg"));
|
|
2014
|
+
import_path = __toESM(require("path"));
|
|
2015
|
+
import_write_pkg = __toESM(require("write-pkg"));
|
|
2016
|
+
PKG = Symbol("pkg");
|
|
2017
|
+
_location = Symbol("location");
|
|
2018
|
+
_resolved = Symbol("resolved");
|
|
2019
|
+
_rootPath = Symbol("rootPath");
|
|
2020
|
+
_scripts = Symbol("scripts");
|
|
2021
|
+
_contents = Symbol("contents");
|
|
2022
|
+
Package = class _Package {
|
|
2023
|
+
name;
|
|
2024
|
+
[PKG];
|
|
2025
|
+
[_location];
|
|
2026
|
+
[_resolved];
|
|
2027
|
+
[_rootPath];
|
|
2028
|
+
[_scripts];
|
|
2029
|
+
[_contents];
|
|
2030
|
+
licensePath;
|
|
2031
|
+
packed;
|
|
2032
|
+
/**
|
|
2033
|
+
* Create a Package instance from parameters, possibly reusing existing instance.
|
|
2034
|
+
* @param ref A path to a package.json file, Package instance, or JSON object
|
|
2035
|
+
* @param [dir] If `ref` is a JSON object, this is the location of the manifest
|
|
2036
|
+
*/
|
|
2037
|
+
static lazy(ref, dir = ".") {
|
|
2038
|
+
if (typeof ref === "string") {
|
|
2039
|
+
const location = import_path.default.resolve(import_path.default.basename(ref) === "package.json" ? import_path.default.dirname(ref) : ref);
|
|
2040
|
+
const manifest = import_load_json_file.default.sync(import_path.default.join(location, "package.json"));
|
|
2041
|
+
return new _Package(manifest, location);
|
|
2042
|
+
}
|
|
2043
|
+
if ("__isLernaPackage" in ref) {
|
|
2044
|
+
return ref;
|
|
2045
|
+
}
|
|
2046
|
+
return new _Package(ref, dir);
|
|
2047
|
+
}
|
|
2048
|
+
constructor(pkg, location, rootPath = location) {
|
|
2049
|
+
const resolved = import_npm_package_arg.default.resolve(pkg.name, `file:${import_path.default.relative(rootPath, location)}`, rootPath);
|
|
2050
|
+
this.name = pkg.name;
|
|
2051
|
+
this[PKG] = pkg;
|
|
2052
|
+
Object.defineProperty(this, PKG, { enumerable: false, writable: true });
|
|
2053
|
+
this[_location] = location;
|
|
2054
|
+
this[_resolved] = resolved;
|
|
2055
|
+
this[_rootPath] = rootPath;
|
|
2056
|
+
this[_scripts] = { ...pkg.scripts };
|
|
2057
|
+
}
|
|
2058
|
+
// readonly getters
|
|
2059
|
+
get location() {
|
|
2060
|
+
return this[_location];
|
|
2061
|
+
}
|
|
2062
|
+
get private() {
|
|
2063
|
+
return Boolean(this[PKG].private);
|
|
2064
|
+
}
|
|
2065
|
+
set private(isPrivate) {
|
|
2066
|
+
this[PKG].private = isPrivate;
|
|
2067
|
+
}
|
|
2068
|
+
get resolved() {
|
|
2069
|
+
return this[_resolved];
|
|
2070
|
+
}
|
|
2071
|
+
get rootPath() {
|
|
2072
|
+
return this[_rootPath];
|
|
2073
|
+
}
|
|
2074
|
+
get scripts() {
|
|
2075
|
+
return this[_scripts];
|
|
2076
|
+
}
|
|
2077
|
+
get lernaConfig() {
|
|
2078
|
+
return this[PKG].lerna;
|
|
2079
|
+
}
|
|
2080
|
+
set lernaConfig(config) {
|
|
2081
|
+
this[PKG].lerna = config;
|
|
2082
|
+
}
|
|
2083
|
+
get bin() {
|
|
2084
|
+
const pkg = this[PKG];
|
|
2085
|
+
return typeof pkg.bin === "string" ? {
|
|
2086
|
+
// See note on function implementation
|
|
2087
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2088
|
+
// @ts-ignore
|
|
2089
|
+
[binSafeName(this.resolved)]: pkg.bin
|
|
2090
|
+
} : Object.assign({}, pkg.bin);
|
|
2091
|
+
}
|
|
2092
|
+
get binLocation() {
|
|
2093
|
+
return import_path.default.join(this.location, "node_modules", ".bin");
|
|
2094
|
+
}
|
|
2095
|
+
get manifestLocation() {
|
|
2096
|
+
return import_path.default.join(this.location, "package.json");
|
|
2097
|
+
}
|
|
2098
|
+
get nodeModulesLocation() {
|
|
2099
|
+
return import_path.default.join(this.location, "node_modules");
|
|
2100
|
+
}
|
|
2101
|
+
get __isLernaPackage() {
|
|
2102
|
+
return true;
|
|
2103
|
+
}
|
|
2104
|
+
// accessors
|
|
2105
|
+
get version() {
|
|
2106
|
+
return this[PKG].version;
|
|
2107
|
+
}
|
|
2108
|
+
set version(version) {
|
|
2109
|
+
this[PKG].version = version;
|
|
2110
|
+
}
|
|
2111
|
+
get contents() {
|
|
2112
|
+
if (this[_contents]) {
|
|
2113
|
+
return this[_contents];
|
|
2114
|
+
}
|
|
2115
|
+
const publishConfig = this[PKG].publishConfig;
|
|
2116
|
+
if (publishConfig && publishConfig.directory) {
|
|
2117
|
+
return import_path.default.join(this.location, publishConfig.directory);
|
|
2118
|
+
}
|
|
2119
|
+
return this.location;
|
|
2120
|
+
}
|
|
2121
|
+
set contents(subDirectory) {
|
|
2122
|
+
const _workspaceRoot = process.env["NX_WORKSPACE_ROOT_PATH"] || import_devkit.workspaceRoot;
|
|
2123
|
+
if (subDirectory.startsWith(_workspaceRoot)) {
|
|
2124
|
+
this[_contents] = subDirectory;
|
|
2125
|
+
return;
|
|
2126
|
+
}
|
|
2127
|
+
this[_contents] = import_path.default.join(this.location, subDirectory);
|
|
2128
|
+
}
|
|
2129
|
+
// "live" collections
|
|
2130
|
+
get dependencies() {
|
|
2131
|
+
return this[PKG].dependencies;
|
|
2132
|
+
}
|
|
2133
|
+
get devDependencies() {
|
|
2134
|
+
return this[PKG].devDependencies;
|
|
2135
|
+
}
|
|
2136
|
+
get optionalDependencies() {
|
|
2137
|
+
return this[PKG].optionalDependencies;
|
|
2138
|
+
}
|
|
2139
|
+
get peerDependencies() {
|
|
2140
|
+
return this[PKG].peerDependencies;
|
|
2141
|
+
}
|
|
2142
|
+
/**
|
|
2143
|
+
* Map-like retrieval of arbitrary values
|
|
2144
|
+
*/
|
|
2145
|
+
get(key) {
|
|
2146
|
+
return this[PKG][key];
|
|
2147
|
+
}
|
|
2148
|
+
/**
|
|
2149
|
+
* Map-like storage of arbitrary values
|
|
2150
|
+
*/
|
|
2151
|
+
set(key, val) {
|
|
2152
|
+
this[PKG][key] = val;
|
|
2153
|
+
return this;
|
|
2154
|
+
}
|
|
2155
|
+
/**
|
|
2156
|
+
* Provide shallow copy for munging elsewhere
|
|
2157
|
+
*/
|
|
2158
|
+
toJSON() {
|
|
2159
|
+
return shallowCopy(this[PKG]);
|
|
2160
|
+
}
|
|
2161
|
+
/**
|
|
2162
|
+
* Refresh internal state from disk (e.g., changed by external lifecycles)
|
|
2163
|
+
*/
|
|
2164
|
+
refresh() {
|
|
2165
|
+
return (0, import_load_json_file.default)(this.manifestLocation).then((pkg) => {
|
|
2166
|
+
this[PKG] = pkg;
|
|
2167
|
+
return this;
|
|
2168
|
+
});
|
|
2169
|
+
}
|
|
2170
|
+
/**
|
|
2171
|
+
* Write manifest changes to disk
|
|
2172
|
+
* @returns {Promise} resolves when write finished
|
|
2173
|
+
*/
|
|
2174
|
+
serialize() {
|
|
2175
|
+
return (0, import_write_pkg.default)(this.manifestLocation, this[PKG]).then(() => this);
|
|
2176
|
+
}
|
|
2177
|
+
/**
|
|
2178
|
+
* Sync dist manifest version
|
|
2179
|
+
*/
|
|
2180
|
+
async syncDistVersion(doSync) {
|
|
2181
|
+
if (doSync) {
|
|
2182
|
+
const distPkg = import_path.default.join(this.contents, "package.json");
|
|
2183
|
+
if (distPkg !== this.manifestLocation && import_fs.default.existsSync(distPkg)) {
|
|
2184
|
+
const pkg = await (0, import_load_json_file.default)(distPkg);
|
|
2185
|
+
pkg.version = this[PKG].version;
|
|
2186
|
+
await (0, import_write_pkg.default)(distPkg, pkg);
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
return this;
|
|
2190
|
+
}
|
|
2191
|
+
getLocalDependency(depName) {
|
|
2192
|
+
if (this.dependencies && this.dependencies[depName]) {
|
|
2193
|
+
return {
|
|
2194
|
+
collection: "dependencies",
|
|
2195
|
+
spec: this.dependencies[depName]
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2198
|
+
if (this.devDependencies && this.devDependencies[depName]) {
|
|
2199
|
+
return {
|
|
2200
|
+
collection: "devDependencies",
|
|
2201
|
+
spec: this.devDependencies[depName]
|
|
2202
|
+
};
|
|
2203
|
+
}
|
|
2204
|
+
if (this.optionalDependencies && this.optionalDependencies[depName]) {
|
|
2205
|
+
return {
|
|
2206
|
+
collection: "optionalDependencies",
|
|
2207
|
+
spec: this.optionalDependencies[depName]
|
|
2208
|
+
};
|
|
2209
|
+
}
|
|
2210
|
+
if (this.peerDependencies && this.peerDependencies[depName]) {
|
|
2211
|
+
const spec = this.peerDependencies[depName];
|
|
2212
|
+
const collection = "peerDependencies";
|
|
2213
|
+
const FILE_PROTOCOL = "file:";
|
|
2214
|
+
const WORKSPACE_PROTOCOL = "workspace:";
|
|
2215
|
+
if (spec.startsWith(WORKSPACE_PROTOCOL)) {
|
|
2216
|
+
const token = spec.substring(WORKSPACE_PROTOCOL.length);
|
|
2217
|
+
switch (token) {
|
|
2218
|
+
case "*": {
|
|
2219
|
+
return { collection, spec };
|
|
2220
|
+
}
|
|
2221
|
+
case "^": {
|
|
2222
|
+
return { collection, spec };
|
|
2223
|
+
}
|
|
2224
|
+
case "~": {
|
|
2225
|
+
return { collection, spec };
|
|
2226
|
+
}
|
|
2227
|
+
default: {
|
|
2228
|
+
return { collection, spec };
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
if (spec.startsWith(FILE_PROTOCOL)) {
|
|
2233
|
+
return null;
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
return null;
|
|
2237
|
+
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Mutate local dependency spec according to type
|
|
2240
|
+
* @param resolved npa metadata
|
|
2241
|
+
* @param depVersion semver
|
|
2242
|
+
* @param savePrefix npm_config_save_prefix
|
|
2243
|
+
* @param options
|
|
2244
|
+
*/
|
|
2245
|
+
updateLocalDependency(resolved, depVersion, savePrefix, options = { eraseWorkspacePrefix: false }) {
|
|
2246
|
+
const depName = resolved.name;
|
|
2247
|
+
let depCollection = this.dependencies;
|
|
2248
|
+
if (!depCollection || !depCollection[depName]) {
|
|
2249
|
+
depCollection = this.optionalDependencies;
|
|
2250
|
+
}
|
|
2251
|
+
if (!depCollection || !depCollection[depName]) {
|
|
2252
|
+
depCollection = this.devDependencies;
|
|
2253
|
+
}
|
|
2254
|
+
if (!depCollection || !depCollection[depName]) {
|
|
2255
|
+
depCollection = this.peerDependencies;
|
|
2256
|
+
}
|
|
2257
|
+
if (!depCollection) {
|
|
2258
|
+
throw new Error(`${JSON.stringify(depName)} should exist in some dependency collection.`);
|
|
2259
|
+
}
|
|
2260
|
+
const workspaceSpec = resolved.workspaceSpec;
|
|
2261
|
+
const workspaceAlias = resolved.workspaceAlias;
|
|
2262
|
+
const gitCommittish = resolved.gitCommittish;
|
|
2263
|
+
if (workspaceSpec) {
|
|
2264
|
+
if (options.eraseWorkspacePrefix) {
|
|
2265
|
+
if (workspaceAlias) {
|
|
2266
|
+
const prefix = workspaceAlias === "*" ? "" : workspaceAlias;
|
|
2267
|
+
depCollection[depName] = `${prefix}${depVersion}`;
|
|
2268
|
+
} else {
|
|
2269
|
+
const semverRange = workspaceSpec.substring("workspace:".length);
|
|
2270
|
+
depCollection[depName] = semverRange;
|
|
2271
|
+
}
|
|
2272
|
+
} else {
|
|
2273
|
+
if (!workspaceAlias) {
|
|
2274
|
+
const matches = workspaceSpec.match(/^(workspace:[*~^]?)/);
|
|
2275
|
+
const workspacePrefix = matches[0];
|
|
2276
|
+
depCollection[depName] = `${workspacePrefix}${depVersion}`;
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
} else if (resolved.registry || resolved.type === "directory") {
|
|
2280
|
+
depCollection[depName] = `${savePrefix}${depVersion}`;
|
|
2281
|
+
} else if (gitCommittish) {
|
|
2282
|
+
const [tagPrefix] = /^\D*/.exec(gitCommittish);
|
|
2283
|
+
const { hosted } = resolved;
|
|
2284
|
+
hosted.committish = `${tagPrefix}${depVersion}`;
|
|
2285
|
+
depCollection[depName] = hosted.toString({ noGitPlus: false, noCommittish: false });
|
|
2286
|
+
} else if (resolved.gitRange) {
|
|
2287
|
+
const { hosted } = resolved;
|
|
2288
|
+
hosted.committish = `semver:${savePrefix}${depVersion}`;
|
|
2289
|
+
depCollection[depName] = hosted.toString({ noGitPlus: false, noCommittish: false });
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* Remove the private property, effectively making the package public.
|
|
2294
|
+
*/
|
|
2295
|
+
removePrivate() {
|
|
2296
|
+
delete this[PKG].private;
|
|
2297
|
+
}
|
|
2298
|
+
};
|
|
2299
|
+
}
|
|
2300
|
+
});
|
|
2301
|
+
|
|
2302
|
+
// libs/core/src/lib/project/shallow-extend.ts
|
|
2303
|
+
function shallowExtend(json, defaults = {}) {
|
|
2304
|
+
return Object.keys(json).reduce((obj, key) => {
|
|
2305
|
+
const val = json[key];
|
|
2306
|
+
if (Array.isArray(val)) {
|
|
2307
|
+
obj[key] = val.slice();
|
|
2308
|
+
} else if (val && typeof val === "object") {
|
|
2309
|
+
obj[key] = shallowExtend(val, obj[key]);
|
|
2310
|
+
} else {
|
|
2311
|
+
obj[key] = val;
|
|
2312
|
+
}
|
|
2313
|
+
return obj;
|
|
2314
|
+
}, defaults);
|
|
2315
|
+
}
|
|
2316
|
+
var init_shallow_extend = __esm({
|
|
2317
|
+
"libs/core/src/lib/project/shallow-extend.ts"() {
|
|
2318
|
+
"use strict";
|
|
2319
|
+
}
|
|
2320
|
+
});
|
|
2321
|
+
|
|
2322
|
+
// libs/core/src/lib/project/apply-extends.ts
|
|
2323
|
+
function applyExtends(config, cwd, seen = /* @__PURE__ */ new Set()) {
|
|
2324
|
+
let defaultConfig = {};
|
|
2325
|
+
if ("extends" in config) {
|
|
2326
|
+
let pathToDefault;
|
|
2327
|
+
try {
|
|
2328
|
+
pathToDefault = (0, import_resolve_from.default)(cwd, config.extends);
|
|
2329
|
+
} catch (err) {
|
|
2330
|
+
throw new ValidationError("ERESOLVED", "Config .extends must be locally-resolvable", err);
|
|
2331
|
+
}
|
|
2332
|
+
if (seen.has(pathToDefault)) {
|
|
2333
|
+
throw new ValidationError("ECIRCULAR", "Config .extends cannot be circular", seen);
|
|
2334
|
+
}
|
|
2335
|
+
seen.add(pathToDefault);
|
|
2336
|
+
defaultConfig = require(pathToDefault);
|
|
2337
|
+
delete config.extends;
|
|
2338
|
+
defaultConfig = applyExtends(defaultConfig, import_path2.default.dirname(pathToDefault), seen);
|
|
2339
|
+
}
|
|
2340
|
+
return shallowExtend(config, defaultConfig);
|
|
2341
|
+
}
|
|
2342
|
+
var import_path2, import_resolve_from;
|
|
2343
|
+
var init_apply_extends = __esm({
|
|
2344
|
+
"libs/core/src/lib/project/apply-extends.ts"() {
|
|
2345
|
+
"use strict";
|
|
2346
|
+
import_path2 = __toESM(require("path"));
|
|
2347
|
+
import_resolve_from = __toESM(require("resolve-from"));
|
|
2348
|
+
init_validation_error();
|
|
2349
|
+
init_shallow_extend();
|
|
2350
|
+
}
|
|
2351
|
+
});
|
|
2352
|
+
|
|
2353
|
+
// libs/core/src/lib/project/make-file-finder.ts
|
|
2354
|
+
function normalize(results) {
|
|
2355
|
+
return results.map((fp) => import_path3.default.normalize(fp));
|
|
2356
|
+
}
|
|
2357
|
+
function getGlobOpts(rootPath, packageConfigs) {
|
|
2358
|
+
const globOpts = {
|
|
2359
|
+
cwd: rootPath,
|
|
2360
|
+
absolute: true,
|
|
2361
|
+
expandDirectories: false,
|
|
2362
|
+
followSymbolicLinks: false
|
|
2363
|
+
};
|
|
2364
|
+
if (packageConfigs.some((cfg) => cfg.indexOf("**") > -1)) {
|
|
2365
|
+
if (packageConfigs.some((cfg) => cfg.indexOf("node_modules") > -1)) {
|
|
2366
|
+
throw new ValidationError(
|
|
2367
|
+
"EPKGCONFIG",
|
|
2368
|
+
"An explicit node_modules package path does not allow globstars (**)"
|
|
2369
|
+
);
|
|
2370
|
+
}
|
|
2371
|
+
globOpts.ignore = [
|
|
2372
|
+
// allow globs like "packages/**",
|
|
2373
|
+
// but avoid picking up node_modules/**/package.json
|
|
2374
|
+
"**/node_modules/**"
|
|
2375
|
+
];
|
|
2376
|
+
}
|
|
2377
|
+
return globOpts;
|
|
2378
|
+
}
|
|
2379
|
+
function makeFileFinder(rootPath, packageConfigs) {
|
|
2380
|
+
const globOpts = getGlobOpts(rootPath, packageConfigs);
|
|
2381
|
+
return (fileName, fileMapper, customGlobOpts) => {
|
|
2382
|
+
const options = Object.assign({}, customGlobOpts, globOpts);
|
|
2383
|
+
const promise = (0, import_p_map.default)(
|
|
2384
|
+
Array.from(packageConfigs).sort(),
|
|
2385
|
+
(globPath) => {
|
|
2386
|
+
let chain = (0, import_tinyglobby.glob)(import_path3.default.posix.join(globPath, fileName), options);
|
|
2387
|
+
chain = chain.then((results) => results.sort());
|
|
2388
|
+
chain = chain.then(normalize);
|
|
2389
|
+
if (fileMapper) {
|
|
2390
|
+
chain = chain.then(fileMapper);
|
|
2391
|
+
}
|
|
2392
|
+
return chain;
|
|
2393
|
+
},
|
|
2394
|
+
{ concurrency: 4 }
|
|
2395
|
+
);
|
|
2396
|
+
return promise.then((results) => results.reduce((acc, result) => acc.concat(result), []));
|
|
2397
|
+
};
|
|
2398
|
+
}
|
|
2399
|
+
function makeSyncFileFinder(rootPath, packageConfigs) {
|
|
2400
|
+
const globOpts = getGlobOpts(rootPath, packageConfigs);
|
|
2401
|
+
return (fileName, fileMapper) => {
|
|
2402
|
+
const patterns = packageConfigs.map((globPath) => import_path3.default.posix.join(globPath, fileName)).sort();
|
|
2403
|
+
let results = (0, import_tinyglobby.globSync)(patterns, globOpts);
|
|
2404
|
+
results = normalize(results);
|
|
2405
|
+
return results.map((res) => fileMapper(res));
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
var import_tinyglobby, import_p_map, import_path3;
|
|
2409
|
+
var init_make_file_finder = __esm({
|
|
2410
|
+
"libs/core/src/lib/project/make-file-finder.ts"() {
|
|
2411
|
+
"use strict";
|
|
2412
|
+
import_tinyglobby = require("tinyglobby");
|
|
2413
|
+
import_p_map = __toESM(require("p-map"));
|
|
2414
|
+
import_path3 = __toESM(require("path"));
|
|
2415
|
+
init_validation_error();
|
|
2416
|
+
}
|
|
2417
|
+
});
|
|
2418
|
+
|
|
2419
|
+
// libs/core/src/lib/project/index.ts
|
|
2420
|
+
var import_devkit2, import_cosmiconfig, import_dedent2, import_fs2, import_glob_parent, import_tinyglobby2, import_js_yaml, import_load_json_file2, import_p_map2, import_path4, LICENSE_GLOB, Project, getPackages, getPackagesSync;
|
|
2421
|
+
var init_project = __esm({
|
|
2422
|
+
"libs/core/src/lib/project/index.ts"() {
|
|
2423
|
+
"use strict";
|
|
2424
|
+
import_devkit2 = require("@nx/devkit");
|
|
2425
|
+
import_cosmiconfig = require("cosmiconfig");
|
|
2426
|
+
import_dedent2 = __toESM(require("dedent"));
|
|
2427
|
+
import_fs2 = __toESM(require("fs"));
|
|
2428
|
+
import_glob_parent = __toESM(require("glob-parent"));
|
|
2429
|
+
import_tinyglobby2 = require("tinyglobby");
|
|
2430
|
+
import_js_yaml = require("js-yaml");
|
|
2431
|
+
import_load_json_file2 = __toESM(require("load-json-file"));
|
|
2432
|
+
import_p_map2 = __toESM(require("p-map"));
|
|
2433
|
+
import_path4 = __toESM(require("path"));
|
|
2434
|
+
init_npmlog();
|
|
2435
|
+
init_package();
|
|
2436
|
+
init_validation_error();
|
|
2437
|
+
init_apply_extends();
|
|
2438
|
+
init_make_file_finder();
|
|
2439
|
+
LICENSE_GLOB = "LICEN{S,C}E{,.*}";
|
|
2440
|
+
Project = class _Project {
|
|
2441
|
+
config;
|
|
2442
|
+
configNotFound;
|
|
2443
|
+
rootConfigLocation;
|
|
2444
|
+
rootPath;
|
|
2445
|
+
packageConfigs;
|
|
2446
|
+
manifest;
|
|
2447
|
+
/**
|
|
2448
|
+
* @deprecated Only used in legacy core utilities
|
|
2449
|
+
* TODO: remove in v8
|
|
2450
|
+
*/
|
|
2451
|
+
static getPackages(cwd) {
|
|
2452
|
+
return new _Project(cwd).getPackages();
|
|
2453
|
+
}
|
|
2454
|
+
/**
|
|
2455
|
+
* @deprecated Only used in legacy core utilities
|
|
2456
|
+
* TODO: remove in v8
|
|
2457
|
+
*/
|
|
2458
|
+
static getPackagesSync(cwd) {
|
|
2459
|
+
return new _Project(cwd).getPackagesSync();
|
|
2460
|
+
}
|
|
2461
|
+
constructor(cwd, options) {
|
|
2462
|
+
const { config, configNotFound, filepath } = this.#resolveLernaConfig(cwd);
|
|
2463
|
+
this.config = config;
|
|
2464
|
+
this.configNotFound = configNotFound || false;
|
|
2465
|
+
this.rootConfigLocation = filepath;
|
|
2466
|
+
this.rootPath = import_path4.default.dirname(filepath);
|
|
2467
|
+
this.manifest = this.#resolveRootPackageJson();
|
|
2468
|
+
if (this.configNotFound) {
|
|
2469
|
+
throw new ValidationError("ENOLERNA", "`lerna.json` does not exist, have you run `lerna init`?");
|
|
2470
|
+
}
|
|
2471
|
+
if (!options?.skipLernaConfigValidations) {
|
|
2472
|
+
this.#validateLernaConfig(config);
|
|
2473
|
+
}
|
|
2474
|
+
this.packageConfigs = this.#resolvePackageConfigs();
|
|
2475
|
+
npmlog_default.verbose("rootPath", this.rootPath);
|
|
2476
|
+
}
|
|
2477
|
+
get version() {
|
|
2478
|
+
return this.config.version;
|
|
2479
|
+
}
|
|
2480
|
+
set version(val) {
|
|
2481
|
+
this.config.version = val;
|
|
2482
|
+
}
|
|
2483
|
+
get packageParentDirs() {
|
|
2484
|
+
return this.packageConfigs.map((packagePattern) => (0, import_glob_parent.default)(packagePattern)).map((parentDir) => import_path4.default.resolve(this.rootPath, parentDir));
|
|
2485
|
+
}
|
|
2486
|
+
get licensePath() {
|
|
2487
|
+
let licensePath;
|
|
2488
|
+
try {
|
|
2489
|
+
const search = (0, import_tinyglobby2.globSync)(LICENSE_GLOB, {
|
|
2490
|
+
cwd: this.rootPath,
|
|
2491
|
+
absolute: true,
|
|
2492
|
+
caseSensitiveMatch: false,
|
|
2493
|
+
// Project license is always a sibling of the root manifest
|
|
2494
|
+
deep: 0
|
|
2495
|
+
});
|
|
2496
|
+
licensePath = search.shift();
|
|
2497
|
+
if (licensePath) {
|
|
2498
|
+
licensePath = import_path4.default.normalize(licensePath);
|
|
2499
|
+
Object.defineProperty(this, "licensePath", {
|
|
2500
|
+
value: licensePath
|
|
2501
|
+
});
|
|
2502
|
+
}
|
|
2503
|
+
} catch (err) {
|
|
2504
|
+
throw new ValidationError(err.name, err.message);
|
|
2505
|
+
}
|
|
2506
|
+
return licensePath;
|
|
2507
|
+
}
|
|
2508
|
+
get fileFinder() {
|
|
2509
|
+
const finder = makeFileFinder(this.rootPath, this.packageConfigs);
|
|
2510
|
+
Object.defineProperty(this, "fileFinder", {
|
|
2511
|
+
value: finder
|
|
2512
|
+
});
|
|
2513
|
+
return finder;
|
|
2514
|
+
}
|
|
2515
|
+
/**
|
|
2516
|
+
* A promise resolving to a list of Package instances
|
|
2517
|
+
*/
|
|
2518
|
+
getPackages() {
|
|
2519
|
+
const mapper = (packageConfigPath) => (0, import_load_json_file2.default)(packageConfigPath).then(
|
|
2520
|
+
(packageJson) => new Package(packageJson, import_path4.default.dirname(packageConfigPath), this.rootPath)
|
|
2521
|
+
);
|
|
2522
|
+
return this.fileFinder("package.json", (filePaths) => (0, import_p_map2.default)(filePaths, mapper, { concurrency: 50 }));
|
|
2523
|
+
}
|
|
2524
|
+
/**
|
|
2525
|
+
* A list of Package instances
|
|
2526
|
+
*/
|
|
2527
|
+
getPackagesSync() {
|
|
2528
|
+
const syncFileFinder = makeSyncFileFinder(this.rootPath, this.packageConfigs);
|
|
2529
|
+
return syncFileFinder("package.json", (packageConfigPath) => {
|
|
2530
|
+
return new Package(
|
|
2531
|
+
import_load_json_file2.default.sync(packageConfigPath),
|
|
2532
|
+
import_path4.default.dirname(packageConfigPath),
|
|
2533
|
+
this.rootPath
|
|
2534
|
+
);
|
|
2535
|
+
});
|
|
2536
|
+
}
|
|
2537
|
+
getPackageLicensePaths() {
|
|
2538
|
+
return this.fileFinder(LICENSE_GLOB, null, { caseSensitiveMatch: false });
|
|
2539
|
+
}
|
|
2540
|
+
isIndependent() {
|
|
2541
|
+
return this.version === "independent";
|
|
2542
|
+
}
|
|
2543
|
+
serializeConfig() {
|
|
2544
|
+
(0, import_devkit2.writeJsonFile)(this.rootConfigLocation, this.config, { spaces: 2 });
|
|
2545
|
+
return this.rootConfigLocation;
|
|
2546
|
+
}
|
|
2547
|
+
#resolveRootPackageJson() {
|
|
2548
|
+
try {
|
|
2549
|
+
const manifestLocation = import_path4.default.join(this.rootPath, "package.json");
|
|
2550
|
+
const packageJson = import_load_json_file2.default.sync(manifestLocation);
|
|
2551
|
+
if (!packageJson.name) {
|
|
2552
|
+
packageJson.name = import_path4.default.basename(import_path4.default.dirname(manifestLocation));
|
|
2553
|
+
}
|
|
2554
|
+
return new Package(packageJson, this.rootPath);
|
|
2555
|
+
} catch (err) {
|
|
2556
|
+
if (err instanceof Error && err?.name === "JSONError") {
|
|
2557
|
+
throw new ValidationError(err.name, err.message);
|
|
2558
|
+
}
|
|
2559
|
+
throw new ValidationError("ENOPKG", "`package.json` does not exist, have you run `lerna init`?");
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2562
|
+
#resolveLernaConfig(cwd) {
|
|
2563
|
+
try {
|
|
2564
|
+
const explorer = (0, import_cosmiconfig.cosmiconfigSync)("lerna", {
|
|
2565
|
+
loaders: {
|
|
2566
|
+
...import_cosmiconfig.defaultLoaders,
|
|
2567
|
+
".json": (filepath, content) => {
|
|
2568
|
+
if (!filepath.endsWith("lerna.json")) {
|
|
2569
|
+
return import_cosmiconfig.defaultLoaders[".json"](filepath, content);
|
|
2570
|
+
}
|
|
2571
|
+
try {
|
|
2572
|
+
return (0, import_devkit2.parseJson)(content);
|
|
2573
|
+
} catch (err) {
|
|
2574
|
+
if (err instanceof Error) {
|
|
2575
|
+
err.name = "JSONError";
|
|
2576
|
+
err.message = `Error in: ${filepath}
|
|
2577
|
+
${err.message}`;
|
|
2578
|
+
}
|
|
2579
|
+
throw err;
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
},
|
|
2583
|
+
searchPlaces: ["lerna.json", "package.json"],
|
|
2584
|
+
searchStrategy: "global",
|
|
2585
|
+
// Fix breaking change behaviour in cosmiconfig@9.0.0
|
|
2586
|
+
transform(obj) {
|
|
2587
|
+
if (!obj) {
|
|
2588
|
+
const configNotFoundResult = {
|
|
2589
|
+
// No need to distinguish between missing and empty,
|
|
2590
|
+
// saves a lot of noisy guards elsewhere
|
|
2591
|
+
config: {},
|
|
2592
|
+
configNotFound: true,
|
|
2593
|
+
// path.resolve(".", ...) starts from process.cwd()
|
|
2594
|
+
filepath: import_path4.default.resolve(cwd || ".", "lerna.json")
|
|
2595
|
+
};
|
|
2596
|
+
return configNotFoundResult;
|
|
2597
|
+
}
|
|
2598
|
+
obj.config = applyExtends(obj.config, import_path4.default.dirname(obj.filepath));
|
|
2599
|
+
return obj;
|
|
2600
|
+
}
|
|
2601
|
+
});
|
|
2602
|
+
return explorer.search(cwd);
|
|
2603
|
+
} catch (err) {
|
|
2604
|
+
if (err.name === "JSONError") {
|
|
2605
|
+
throw new ValidationError(err.name, err.message);
|
|
2606
|
+
}
|
|
2607
|
+
throw err;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
#validateLernaConfig(config) {
|
|
2611
|
+
if (!this.version) {
|
|
2612
|
+
throw new ValidationError("ENOVERSION", "Required property version does not exist in `lerna.json`");
|
|
2613
|
+
}
|
|
2614
|
+
if (config.useWorkspaces !== void 0) {
|
|
2615
|
+
throw new ValidationError(
|
|
2616
|
+
"ECONFIGWORKSPACES",
|
|
2617
|
+
`The "useWorkspaces" option has been removed. By default lerna will resolve your packages using your package manager's workspaces configuration. Alternatively, you can manually provide a list of package globs to be used instead via the "packages" option in lerna.json.`
|
|
2618
|
+
);
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
#resolvePnpmWorkspaceConfig() {
|
|
2622
|
+
let config;
|
|
2623
|
+
try {
|
|
2624
|
+
const configLocation = import_path4.default.join(this.rootPath, "pnpm-workspace.yaml");
|
|
2625
|
+
const configContent = import_fs2.default.readFileSync(configLocation, { encoding: "utf8" });
|
|
2626
|
+
config = (0, import_js_yaml.load)(configContent);
|
|
2627
|
+
} catch (err) {
|
|
2628
|
+
if (err.message.includes("ENOENT: no such file or directory")) {
|
|
2629
|
+
throw new ValidationError(
|
|
2630
|
+
"ENOENT",
|
|
2631
|
+
"No pnpm-workspace.yaml found. See https://pnpm.io/workspaces for help configuring workspaces in pnpm."
|
|
2632
|
+
);
|
|
2633
|
+
}
|
|
2634
|
+
throw new ValidationError(err.name, err.message);
|
|
2635
|
+
}
|
|
2636
|
+
return config;
|
|
2637
|
+
}
|
|
2638
|
+
/**
|
|
2639
|
+
* By default, the user's package manager workspaces configuration will be used to resolve packages.
|
|
2640
|
+
* However, they can optionally specify an explicit set of package globs to be used instead.
|
|
2641
|
+
*
|
|
2642
|
+
* NOTE: This does not impact the project graph creation process, which will still ultimately use
|
|
2643
|
+
* the package manager workspaces configuration to construct a full graph, it will only impact which
|
|
2644
|
+
* of the packages in that graph will be considered when running commands.
|
|
2645
|
+
*/
|
|
2646
|
+
#resolvePackageConfigs() {
|
|
2647
|
+
if (this.config.packages) {
|
|
2648
|
+
npmlog_default.verbose(
|
|
2649
|
+
"packageConfigs",
|
|
2650
|
+
`Explicit "packages" configuration found in lerna.json. Resolving packages using the configured glob(s): ${JSON.stringify(
|
|
2651
|
+
this.config.packages
|
|
2652
|
+
)}`
|
|
2653
|
+
);
|
|
2654
|
+
return this.config.packages;
|
|
2655
|
+
}
|
|
2656
|
+
if (this.config.npmClient === "pnpm") {
|
|
2657
|
+
npmlog_default.verbose(
|
|
2658
|
+
"packageConfigs",
|
|
2659
|
+
'Package manager "pnpm" detected. Resolving packages using `pnpm-workspace.yaml`.'
|
|
2660
|
+
);
|
|
2661
|
+
const workspaces2 = this.#resolvePnpmWorkspaceConfig().packages;
|
|
2662
|
+
if (!workspaces2) {
|
|
2663
|
+
throw new ValidationError(
|
|
2664
|
+
"EWORKSPACES",
|
|
2665
|
+
'No "packages" property found in `pnpm-workspace.yaml`. See https://pnpm.io/workspaces for help configuring workspaces in pnpm.'
|
|
2666
|
+
);
|
|
2667
|
+
}
|
|
2668
|
+
return workspaces2;
|
|
2669
|
+
}
|
|
2670
|
+
const workspaces = this.manifest?.get("workspaces");
|
|
2671
|
+
const isYarnClassicWorkspacesObjectConfig = Boolean(
|
|
2672
|
+
workspaces && typeof workspaces === "object" && Array.isArray(workspaces.packages)
|
|
2673
|
+
);
|
|
2674
|
+
const isValidWorkspacesConfig = Array.isArray(workspaces) || isYarnClassicWorkspacesObjectConfig;
|
|
2675
|
+
if (!workspaces || !isValidWorkspacesConfig) {
|
|
2676
|
+
throw new ValidationError(
|
|
2677
|
+
"EWORKSPACES",
|
|
2678
|
+
import_dedent2.default`
|
|
2679
|
+
Lerna is expecting to able to resolve the "workspaces" configuration from your package manager in order to determine what packages to work on, but no "workspaces" config was found.
|
|
2680
|
+
(A) Did you mean to specify a "packages" config manually in lerna.json instead of using your workspaces config?
|
|
2681
|
+
(B) Alternatively, if you are using pnpm as your package manager, make sure you set "npmClient": "pnpm" in your lerna.json so that lerna knows to read from the "pnpm-workspace.yaml" file instead of package.json.
|
|
2682
|
+
See: https://lerna.js.org/docs/getting-started
|
|
2683
|
+
`
|
|
2684
|
+
);
|
|
2685
|
+
}
|
|
2686
|
+
npmlog_default.verbose("packageConfigs", `Resolving packages based on package.json "workspaces" configuration.`);
|
|
2687
|
+
if (isYarnClassicWorkspacesObjectConfig) {
|
|
2688
|
+
return workspaces.packages;
|
|
2689
|
+
}
|
|
2690
|
+
return workspaces;
|
|
2691
|
+
}
|
|
2692
|
+
};
|
|
2693
|
+
getPackages = Project.getPackages;
|
|
2694
|
+
getPackagesSync = Project.getPackagesSync;
|
|
2695
|
+
}
|
|
2696
|
+
});
|
|
2697
|
+
|
|
2698
|
+
// libs/core/src/lib/write-log-file.ts
|
|
2699
|
+
var import_write_file_atomic;
|
|
2700
|
+
var init_write_log_file = __esm({
|
|
2701
|
+
"libs/core/src/lib/write-log-file.ts"() {
|
|
2702
|
+
"use strict";
|
|
2703
|
+
import_write_file_atomic = __toESM(require("write-file-atomic"));
|
|
2704
|
+
init_npmlog();
|
|
2705
|
+
}
|
|
2706
|
+
});
|
|
2707
|
+
|
|
2708
|
+
// libs/core/src/lib/command/clean-stack.ts
|
|
2709
|
+
var init_clean_stack = __esm({
|
|
2710
|
+
"libs/core/src/lib/command/clean-stack.ts"() {
|
|
2711
|
+
"use strict";
|
|
2712
|
+
}
|
|
2713
|
+
});
|
|
2714
|
+
|
|
2715
|
+
// libs/core/src/lib/command/default-options.ts
|
|
2716
|
+
var init_default_options = __esm({
|
|
2717
|
+
"libs/core/src/lib/command/default-options.ts"() {
|
|
2718
|
+
"use strict";
|
|
2719
|
+
}
|
|
2720
|
+
});
|
|
2721
|
+
|
|
2722
|
+
// libs/core/src/lib/get-package-manifest-path.ts
|
|
2723
|
+
var init_get_package_manifest_path = __esm({
|
|
2724
|
+
"libs/core/src/lib/get-package-manifest-path.ts"() {
|
|
2725
|
+
"use strict";
|
|
2726
|
+
}
|
|
2727
|
+
});
|
|
2728
|
+
|
|
2729
|
+
// libs/core/src/lib/command/create-project-graph-with-packages.ts
|
|
2730
|
+
var import_devkit3, import_fs_extra, import_minimatch2, import_npm_package_arg2, import_semver2;
|
|
2731
|
+
var init_create_project_graph_with_packages = __esm({
|
|
2732
|
+
"libs/core/src/lib/command/create-project-graph-with-packages.ts"() {
|
|
2733
|
+
"use strict";
|
|
2734
|
+
import_devkit3 = require("@nx/devkit");
|
|
2735
|
+
import_fs_extra = require("fs-extra");
|
|
2736
|
+
import_minimatch2 = __toESM(require("minimatch"));
|
|
2737
|
+
import_npm_package_arg2 = require("npm-package-arg");
|
|
2738
|
+
import_semver2 = require("semver");
|
|
2739
|
+
init_get_package_manifest_path();
|
|
2740
|
+
init_package();
|
|
2741
|
+
init_project_graph_with_packages();
|
|
2742
|
+
}
|
|
2743
|
+
});
|
|
2744
|
+
|
|
2745
|
+
// libs/core/src/lib/command/detect-projects.ts
|
|
2746
|
+
var import_devkit4;
|
|
2747
|
+
var init_detect_projects = __esm({
|
|
2748
|
+
"libs/core/src/lib/command/detect-projects.ts"() {
|
|
2749
|
+
"use strict";
|
|
2750
|
+
import_devkit4 = require("@nx/devkit");
|
|
2751
|
+
init_create_project_graph_with_packages();
|
|
2752
|
+
}
|
|
2753
|
+
});
|
|
2754
|
+
|
|
2755
|
+
// libs/core/src/lib/command/is-git-initialized.ts
|
|
2756
|
+
var import_execa2;
|
|
2757
|
+
var init_is_git_initialized = __esm({
|
|
2758
|
+
"libs/core/src/lib/command/is-git-initialized.ts"() {
|
|
2759
|
+
"use strict";
|
|
2760
|
+
import_execa2 = __toESM(require("execa"));
|
|
2761
|
+
}
|
|
2762
|
+
});
|
|
2763
|
+
|
|
2764
|
+
// libs/core/src/lib/command/log-package-error.ts
|
|
2765
|
+
var init_log_package_error = __esm({
|
|
2766
|
+
"libs/core/src/lib/command/log-package-error.ts"() {
|
|
2767
|
+
"use strict";
|
|
2768
|
+
init_npmlog();
|
|
2769
|
+
}
|
|
2770
|
+
});
|
|
2771
|
+
|
|
2772
|
+
// libs/core/src/lib/command/warn-if-hanging.ts
|
|
2773
|
+
var childProcess4;
|
|
2774
|
+
var init_warn_if_hanging = __esm({
|
|
2775
|
+
"libs/core/src/lib/command/warn-if-hanging.ts"() {
|
|
2776
|
+
"use strict";
|
|
2777
|
+
init_npmlog();
|
|
2778
|
+
childProcess4 = (init_src(), __toCommonJS(src_exports));
|
|
2779
|
+
}
|
|
2780
|
+
});
|
|
2781
|
+
|
|
2782
|
+
// libs/core/src/lib/command/index.ts
|
|
2783
|
+
var import_dedent3, import_client, import_os, DEFAULT_CONCURRENCY;
|
|
2784
|
+
var init_command = __esm({
|
|
2785
|
+
"libs/core/src/lib/command/index.ts"() {
|
|
2786
|
+
"use strict";
|
|
2787
|
+
import_dedent3 = __toESM(require("dedent"));
|
|
2788
|
+
import_client = require("nx/src/daemon/client/client");
|
|
2789
|
+
import_os = __toESM(require("os"));
|
|
2790
|
+
init_npmlog();
|
|
2791
|
+
init_project();
|
|
2792
|
+
init_validation_error();
|
|
2793
|
+
init_write_log_file();
|
|
2794
|
+
init_clean_stack();
|
|
2795
|
+
init_default_options();
|
|
2796
|
+
init_detect_projects();
|
|
2797
|
+
init_is_git_initialized();
|
|
2798
|
+
init_log_package_error();
|
|
2799
|
+
init_warn_if_hanging();
|
|
2800
|
+
DEFAULT_CONCURRENCY = import_os.default.cpus().length;
|
|
2801
|
+
}
|
|
2802
|
+
});
|
|
2803
|
+
|
|
2804
|
+
// libs/core/src/lib/conventional-commits/apply-build-metadata.ts
|
|
2805
|
+
var init_apply_build_metadata = __esm({
|
|
2806
|
+
"libs/core/src/lib/conventional-commits/apply-build-metadata.ts"() {
|
|
2807
|
+
"use strict";
|
|
2808
|
+
init_validation_error();
|
|
2809
|
+
}
|
|
2810
|
+
});
|
|
2811
|
+
|
|
2812
|
+
// libs/core/src/lib/conventional-commits/get-changelog-config.ts
|
|
2813
|
+
var import_npm_package_arg3, import_pify;
|
|
2814
|
+
var init_get_changelog_config = __esm({
|
|
2815
|
+
"libs/core/src/lib/conventional-commits/get-changelog-config.ts"() {
|
|
2816
|
+
"use strict";
|
|
2817
|
+
import_npm_package_arg3 = __toESM(require("npm-package-arg"));
|
|
2818
|
+
import_pify = __toESM(require("pify"));
|
|
2819
|
+
init_npmlog();
|
|
2820
|
+
init_validation_error();
|
|
2821
|
+
}
|
|
2822
|
+
});
|
|
2823
|
+
|
|
2824
|
+
// libs/core/src/lib/conventional-commits/recommend-version.ts
|
|
2825
|
+
var import_conventional_recommended_bump, import_semver3;
|
|
2826
|
+
var init_recommend_version = __esm({
|
|
2827
|
+
"libs/core/src/lib/conventional-commits/recommend-version.ts"() {
|
|
2828
|
+
"use strict";
|
|
2829
|
+
import_conventional_recommended_bump = __toESM(require("conventional-recommended-bump"));
|
|
2830
|
+
import_semver3 = __toESM(require("semver"));
|
|
2831
|
+
init_npmlog();
|
|
2832
|
+
init_apply_build_metadata();
|
|
2833
|
+
init_get_changelog_config();
|
|
2834
|
+
}
|
|
2835
|
+
});
|
|
2836
|
+
|
|
2837
|
+
// libs/core/src/lib/conventional-commits/constants.ts
|
|
2838
|
+
var EOL, BLANK_LINE, COMMIT_GUIDELINE, CHANGELOG_HEADER;
|
|
2839
|
+
var init_constants = __esm({
|
|
2840
|
+
"libs/core/src/lib/conventional-commits/constants.ts"() {
|
|
2841
|
+
"use strict";
|
|
2842
|
+
EOL = "\n";
|
|
2843
|
+
BLANK_LINE = EOL + EOL;
|
|
2844
|
+
COMMIT_GUIDELINE = "See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.";
|
|
2845
|
+
CHANGELOG_HEADER = [
|
|
2846
|
+
"# Change Log",
|
|
2847
|
+
"",
|
|
2848
|
+
"All notable changes to this project will be documented in this file.",
|
|
2849
|
+
COMMIT_GUIDELINE
|
|
2850
|
+
].join(EOL);
|
|
2851
|
+
}
|
|
2852
|
+
});
|
|
2853
|
+
|
|
2854
|
+
// libs/core/src/lib/conventional-commits/make-bump-only-filter.ts
|
|
2855
|
+
var init_make_bump_only_filter = __esm({
|
|
2856
|
+
"libs/core/src/lib/conventional-commits/make-bump-only-filter.ts"() {
|
|
2857
|
+
"use strict";
|
|
2858
|
+
init_constants();
|
|
2859
|
+
}
|
|
2860
|
+
});
|
|
2861
|
+
|
|
2862
|
+
// libs/core/src/lib/conventional-commits/read-existing-changelog.ts
|
|
2863
|
+
var import_fs_extra2;
|
|
2864
|
+
var init_read_existing_changelog = __esm({
|
|
2865
|
+
"libs/core/src/lib/conventional-commits/read-existing-changelog.ts"() {
|
|
2866
|
+
"use strict";
|
|
2867
|
+
import_fs_extra2 = __toESM(require("fs-extra"));
|
|
2868
|
+
init_constants();
|
|
2869
|
+
}
|
|
2870
|
+
});
|
|
2871
|
+
|
|
2872
|
+
// libs/core/src/lib/conventional-commits/update-changelog.ts
|
|
2873
|
+
var import_conventional_changelog_core, import_fs_extra3, import_get_stream;
|
|
2874
|
+
var init_update_changelog = __esm({
|
|
2875
|
+
"libs/core/src/lib/conventional-commits/update-changelog.ts"() {
|
|
2876
|
+
"use strict";
|
|
2877
|
+
import_conventional_changelog_core = __toESM(require("conventional-changelog-core"));
|
|
2878
|
+
import_fs_extra3 = __toESM(require("fs-extra"));
|
|
2879
|
+
import_get_stream = __toESM(require("get-stream"));
|
|
2880
|
+
init_npmlog();
|
|
2881
|
+
init_constants();
|
|
2882
|
+
init_get_changelog_config();
|
|
2883
|
+
init_make_bump_only_filter();
|
|
2884
|
+
init_read_existing_changelog();
|
|
2885
|
+
}
|
|
2886
|
+
});
|
|
2887
|
+
|
|
2888
|
+
// libs/core/src/lib/conventional-commits/index.ts
|
|
2889
|
+
var init_conventional_commits = __esm({
|
|
2890
|
+
"libs/core/src/lib/conventional-commits/index.ts"() {
|
|
2891
|
+
"use strict";
|
|
2892
|
+
init_recommend_version();
|
|
2893
|
+
init_update_changelog();
|
|
2894
|
+
init_apply_build_metadata();
|
|
2895
|
+
}
|
|
2896
|
+
});
|
|
2897
|
+
|
|
2898
|
+
// libs/core/src/lib/corepack/is-corepack-enabled.ts
|
|
2899
|
+
var init_is_corepack_enabled = __esm({
|
|
2900
|
+
"libs/core/src/lib/corepack/is-corepack-enabled.ts"() {
|
|
2901
|
+
"use strict";
|
|
2902
|
+
}
|
|
2903
|
+
});
|
|
2904
|
+
|
|
2905
|
+
// libs/core/src/lib/corepack/exec-package-manager.ts
|
|
2906
|
+
var childProcess5;
|
|
2907
|
+
var init_exec_package_manager = __esm({
|
|
2908
|
+
"libs/core/src/lib/corepack/exec-package-manager.ts"() {
|
|
2909
|
+
"use strict";
|
|
2910
|
+
init_is_corepack_enabled();
|
|
2911
|
+
childProcess5 = (init_src(), __toCommonJS(src_exports));
|
|
2912
|
+
}
|
|
2913
|
+
});
|
|
2914
|
+
|
|
2915
|
+
// libs/core/src/lib/corepack/index.ts
|
|
2916
|
+
var init_corepack = __esm({
|
|
2917
|
+
"libs/core/src/lib/corepack/index.ts"() {
|
|
2918
|
+
"use strict";
|
|
2919
|
+
init_exec_package_manager();
|
|
2920
|
+
}
|
|
2921
|
+
});
|
|
2922
|
+
|
|
2923
|
+
// libs/core/src/lib/filter-options.ts
|
|
2924
|
+
var import_dedent4;
|
|
2925
|
+
var init_filter_options = __esm({
|
|
2926
|
+
"libs/core/src/lib/filter-options.ts"() {
|
|
2927
|
+
"use strict";
|
|
2928
|
+
import_dedent4 = __toESM(require("dedent"));
|
|
2929
|
+
init_npmlog();
|
|
2930
|
+
}
|
|
2931
|
+
});
|
|
2932
|
+
|
|
2933
|
+
// libs/core/src/lib/filter-projects.ts
|
|
2934
|
+
var import_multimatch;
|
|
2935
|
+
var init_filter_projects = __esm({
|
|
2936
|
+
"libs/core/src/lib/filter-projects.ts"() {
|
|
2937
|
+
"use strict";
|
|
2938
|
+
import_multimatch = __toESM(require("multimatch"));
|
|
2939
|
+
init_add_dependencies();
|
|
2940
|
+
init_add_dependents();
|
|
2941
|
+
init_collect_project_updates();
|
|
2942
|
+
init_npmlog();
|
|
2943
|
+
init_validation_error();
|
|
2944
|
+
}
|
|
2945
|
+
});
|
|
2946
|
+
|
|
2947
|
+
// libs/core/src/lib/git-checkout.ts
|
|
2948
|
+
var childProcess6;
|
|
2949
|
+
var init_git_checkout = __esm({
|
|
2950
|
+
"libs/core/src/lib/git-checkout.ts"() {
|
|
2951
|
+
"use strict";
|
|
2952
|
+
init_npmlog();
|
|
2953
|
+
childProcess6 = (init_src(), __toCommonJS(src_exports));
|
|
2954
|
+
}
|
|
2955
|
+
});
|
|
2956
|
+
|
|
2957
|
+
// libs/core/src/lib/has-npm-version.ts
|
|
2958
|
+
var import_semver4, childProcess7;
|
|
2959
|
+
var init_has_npm_version = __esm({
|
|
2960
|
+
"libs/core/src/lib/has-npm-version.ts"() {
|
|
2961
|
+
"use strict";
|
|
2962
|
+
import_semver4 = __toESM(require("semver"));
|
|
2963
|
+
childProcess7 = (init_src(), __toCommonJS(src_exports));
|
|
2964
|
+
}
|
|
2965
|
+
});
|
|
2966
|
+
|
|
2967
|
+
// libs/core/src/lib/cycles/get-cycles.ts
|
|
2968
|
+
var init_get_cycles = __esm({
|
|
2969
|
+
"libs/core/src/lib/cycles/get-cycles.ts"() {
|
|
2970
|
+
"use strict";
|
|
2971
|
+
}
|
|
2972
|
+
});
|
|
2973
|
+
|
|
2974
|
+
// libs/core/src/lib/cycles/merge-overlapping-cycles.ts
|
|
2975
|
+
var init_merge_overlapping_cycles = __esm({
|
|
2976
|
+
"libs/core/src/lib/cycles/merge-overlapping-cycles.ts"() {
|
|
2977
|
+
"use strict";
|
|
2978
|
+
}
|
|
2979
|
+
});
|
|
2980
|
+
|
|
2981
|
+
// libs/core/src/lib/cycles/report-cycles.ts
|
|
2982
|
+
var init_report_cycles = __esm({
|
|
2983
|
+
"libs/core/src/lib/cycles/report-cycles.ts"() {
|
|
2984
|
+
"use strict";
|
|
2985
|
+
init_npmlog();
|
|
2986
|
+
init_validation_error();
|
|
2987
|
+
}
|
|
2988
|
+
});
|
|
2989
|
+
|
|
2990
|
+
// libs/core/src/lib/cycles/index.ts
|
|
2991
|
+
var init_cycles = __esm({
|
|
2992
|
+
"libs/core/src/lib/cycles/index.ts"() {
|
|
2993
|
+
"use strict";
|
|
2994
|
+
init_get_cycles();
|
|
2995
|
+
init_merge_overlapping_cycles();
|
|
2996
|
+
init_report_cycles();
|
|
2997
|
+
}
|
|
2998
|
+
});
|
|
2999
|
+
|
|
3000
|
+
// libs/core/src/lib/toposort-projects.ts
|
|
3001
|
+
var init_toposort_projects = __esm({
|
|
3002
|
+
"libs/core/src/lib/toposort-projects.ts"() {
|
|
3003
|
+
"use strict";
|
|
3004
|
+
init_cycles();
|
|
3005
|
+
}
|
|
3006
|
+
});
|
|
3007
|
+
|
|
3008
|
+
// libs/core/src/lib/listable-format-projects.ts
|
|
3009
|
+
var import_chalk3, import_columnify;
|
|
3010
|
+
var init_listable_format_projects = __esm({
|
|
3011
|
+
"libs/core/src/lib/listable-format-projects.ts"() {
|
|
3012
|
+
"use strict";
|
|
3013
|
+
import_chalk3 = __toESM(require("chalk"));
|
|
3014
|
+
import_columnify = __toESM(require("columnify"));
|
|
3015
|
+
init_project_graph_with_packages();
|
|
3016
|
+
init_toposort_projects();
|
|
3017
|
+
}
|
|
3018
|
+
});
|
|
3019
|
+
|
|
3020
|
+
// libs/core/src/lib/listable-options.ts
|
|
3021
|
+
var init_listable_options = __esm({
|
|
3022
|
+
"libs/core/src/lib/listable-options.ts"() {
|
|
3023
|
+
"use strict";
|
|
3024
|
+
}
|
|
3025
|
+
});
|
|
3026
|
+
|
|
3027
|
+
// libs/core/src/lib/log-packed.ts
|
|
3028
|
+
var import_byte_size, import_columnify2, import_has_unicode, hasUnicode2;
|
|
3029
|
+
var init_log_packed = __esm({
|
|
3030
|
+
"libs/core/src/lib/log-packed.ts"() {
|
|
3031
|
+
"use strict";
|
|
3032
|
+
import_byte_size = __toESM(require("byte-size"));
|
|
3033
|
+
import_columnify2 = __toESM(require("columnify"));
|
|
3034
|
+
init_npmlog();
|
|
3035
|
+
import_has_unicode = __toESM(require("has-unicode"));
|
|
3036
|
+
hasUnicode2 = (0, import_has_unicode.default)();
|
|
3037
|
+
}
|
|
3038
|
+
});
|
|
3039
|
+
|
|
3040
|
+
// libs/core/src/lib/npm-conf/env-replace.ts
|
|
3041
|
+
function envReplace(str) {
|
|
3042
|
+
if (typeof str !== "string" || !str) {
|
|
3043
|
+
return str;
|
|
3044
|
+
}
|
|
3045
|
+
const regex = /(\\*)\$\{([^}]+)\}/g;
|
|
3046
|
+
return str.replace(regex, (orig, esc, name) => {
|
|
3047
|
+
esc = esc.length > 0 && esc.length % 2;
|
|
3048
|
+
if (esc) {
|
|
3049
|
+
return orig;
|
|
3050
|
+
}
|
|
3051
|
+
if (process.env[name] === void 0) {
|
|
3052
|
+
throw new Error(`Failed to replace env in config: ${orig}`);
|
|
3053
|
+
}
|
|
3054
|
+
return process.env[name];
|
|
3055
|
+
});
|
|
3056
|
+
}
|
|
3057
|
+
var init_env_replace = __esm({
|
|
3058
|
+
"libs/core/src/lib/npm-conf/env-replace.ts"() {
|
|
3059
|
+
"use strict";
|
|
3060
|
+
}
|
|
3061
|
+
});
|
|
3062
|
+
|
|
3063
|
+
// libs/core/src/lib/npm-conf/find-prefix.ts
|
|
3064
|
+
function findPrefix(start) {
|
|
3065
|
+
let dir = import_path5.default.resolve(start);
|
|
3066
|
+
let walkedUp = false;
|
|
3067
|
+
while (import_path5.default.basename(dir) === "node_modules") {
|
|
3068
|
+
dir = import_path5.default.dirname(dir);
|
|
3069
|
+
walkedUp = true;
|
|
3070
|
+
}
|
|
3071
|
+
if (walkedUp) {
|
|
3072
|
+
return dir;
|
|
3073
|
+
}
|
|
3074
|
+
return find(dir, dir);
|
|
3075
|
+
}
|
|
3076
|
+
function find(name, original) {
|
|
3077
|
+
if (name === "/" || process.platform === "win32" && /^[a-zA-Z]:(\\|\/)?$/.test(name)) {
|
|
3078
|
+
return original;
|
|
3079
|
+
}
|
|
3080
|
+
try {
|
|
3081
|
+
const files = import_fs3.default.readdirSync(name);
|
|
3082
|
+
if (files.indexOf("node_modules") !== -1 || files.indexOf("package.json") !== -1) {
|
|
3083
|
+
return name;
|
|
3084
|
+
}
|
|
3085
|
+
const dirname = import_path5.default.dirname(name);
|
|
3086
|
+
if (dirname === name) {
|
|
3087
|
+
return original;
|
|
3088
|
+
}
|
|
3089
|
+
return find(dirname, original);
|
|
3090
|
+
} catch (err) {
|
|
3091
|
+
if (name === original) {
|
|
3092
|
+
if (err.code === "ENOENT") {
|
|
3093
|
+
return original;
|
|
3094
|
+
}
|
|
3095
|
+
throw err;
|
|
3096
|
+
}
|
|
3097
|
+
return original;
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
var import_fs3, import_path5;
|
|
3101
|
+
var init_find_prefix = __esm({
|
|
3102
|
+
"libs/core/src/lib/npm-conf/find-prefix.ts"() {
|
|
3103
|
+
"use strict";
|
|
3104
|
+
import_fs3 = __toESM(require("fs"));
|
|
3105
|
+
import_path5 = __toESM(require("path"));
|
|
3106
|
+
}
|
|
3107
|
+
});
|
|
3108
|
+
|
|
3109
|
+
// libs/core/src/lib/npm-conf/types.ts
|
|
3110
|
+
var require_types = __commonJS({
|
|
3111
|
+
"libs/core/src/lib/npm-conf/types.ts"(exports2) {
|
|
3112
|
+
"use strict";
|
|
3113
|
+
var import_path10 = __toESM(require("path"));
|
|
3114
|
+
var import_stream = require("stream");
|
|
3115
|
+
var import_url2 = __toESM(require("url"));
|
|
3116
|
+
var Umask = () => {
|
|
3117
|
+
};
|
|
3118
|
+
var getLocalAddresses = () => [];
|
|
3119
|
+
var semver5 = () => {
|
|
3120
|
+
};
|
|
3121
|
+
exports2.types = {
|
|
3122
|
+
access: [null, "restricted", "public"],
|
|
3123
|
+
"allow-same-version": Boolean,
|
|
3124
|
+
"always-auth": Boolean,
|
|
3125
|
+
also: [null, "dev", "development"],
|
|
3126
|
+
audit: Boolean,
|
|
3127
|
+
"audit-level": ["low", "moderate", "high", "critical"],
|
|
3128
|
+
"auth-type": ["legacy", "sso", "saml", "oauth"],
|
|
3129
|
+
"bin-links": Boolean,
|
|
3130
|
+
browser: [null, String],
|
|
3131
|
+
ca: [null, String, Array],
|
|
3132
|
+
cafile: import_path10.default,
|
|
3133
|
+
cache: import_path10.default,
|
|
3134
|
+
"cache-lock-stale": Number,
|
|
3135
|
+
"cache-lock-retries": Number,
|
|
3136
|
+
"cache-lock-wait": Number,
|
|
3137
|
+
"cache-max": Number,
|
|
3138
|
+
"cache-min": Number,
|
|
3139
|
+
cert: [null, String],
|
|
3140
|
+
cidr: [null, String, Array],
|
|
3141
|
+
color: ["always", Boolean],
|
|
3142
|
+
depth: Number,
|
|
3143
|
+
description: Boolean,
|
|
3144
|
+
dev: Boolean,
|
|
3145
|
+
"dry-run": Boolean,
|
|
3146
|
+
editor: String,
|
|
3147
|
+
"engine-strict": Boolean,
|
|
3148
|
+
force: Boolean,
|
|
3149
|
+
"fetch-retries": Number,
|
|
3150
|
+
"fetch-retry-factor": Number,
|
|
3151
|
+
"fetch-retry-mintimeout": Number,
|
|
3152
|
+
"fetch-retry-maxtimeout": Number,
|
|
3153
|
+
git: String,
|
|
3154
|
+
"git-tag-version": Boolean,
|
|
3155
|
+
"commit-hooks": Boolean,
|
|
3156
|
+
global: Boolean,
|
|
3157
|
+
globalconfig: import_path10.default,
|
|
3158
|
+
"global-style": Boolean,
|
|
3159
|
+
group: [Number, String],
|
|
3160
|
+
"https-proxy": [null, import_url2.default],
|
|
3161
|
+
"user-agent": String,
|
|
3162
|
+
"ham-it-up": Boolean,
|
|
3163
|
+
heading: String,
|
|
3164
|
+
"if-present": Boolean,
|
|
3165
|
+
"ignore-prepublish": Boolean,
|
|
3166
|
+
"ignore-scripts": Boolean,
|
|
3167
|
+
"init-module": import_path10.default,
|
|
3168
|
+
"init-author-name": String,
|
|
3169
|
+
"init-author-email": String,
|
|
3170
|
+
"init-author-url": ["", import_url2.default],
|
|
3171
|
+
"init-license": String,
|
|
3172
|
+
"init-version": semver5,
|
|
3173
|
+
json: Boolean,
|
|
3174
|
+
key: [null, String],
|
|
3175
|
+
"legacy-bundling": Boolean,
|
|
3176
|
+
link: Boolean,
|
|
3177
|
+
"local-address": getLocalAddresses(),
|
|
3178
|
+
loglevel: ["silent", "error", "warn", "notice", "http", "timing", "info", "verbose", "silly"],
|
|
3179
|
+
logstream: import_stream.Stream,
|
|
3180
|
+
"logs-max": Number,
|
|
3181
|
+
long: Boolean,
|
|
3182
|
+
maxsockets: Number,
|
|
3183
|
+
message: String,
|
|
3184
|
+
"metrics-registry": [null, String],
|
|
3185
|
+
"node-options": [null, String],
|
|
3186
|
+
"node-version": [null, semver5],
|
|
3187
|
+
noproxy: [null, String, Array],
|
|
3188
|
+
offline: Boolean,
|
|
3189
|
+
"onload-script": [null, String],
|
|
3190
|
+
only: [null, "dev", "development", "prod", "production"],
|
|
3191
|
+
optional: Boolean,
|
|
3192
|
+
"package-lock": Boolean,
|
|
3193
|
+
otp: [null, String],
|
|
3194
|
+
"package-lock-only": Boolean,
|
|
3195
|
+
parseable: Boolean,
|
|
3196
|
+
"prefer-offline": Boolean,
|
|
3197
|
+
"prefer-online": Boolean,
|
|
3198
|
+
prefix: import_path10.default,
|
|
3199
|
+
preid: String,
|
|
3200
|
+
production: Boolean,
|
|
3201
|
+
progress: Boolean,
|
|
3202
|
+
// allow proxy to be disabled explicitly
|
|
3203
|
+
proxy: [null, false, import_url2.default],
|
|
3204
|
+
"read-only": Boolean,
|
|
3205
|
+
"rebuild-bundle": Boolean,
|
|
3206
|
+
registry: [null, import_url2.default],
|
|
3207
|
+
rollback: Boolean,
|
|
3208
|
+
save: Boolean,
|
|
3209
|
+
"save-bundle": Boolean,
|
|
3210
|
+
"save-dev": Boolean,
|
|
3211
|
+
"save-exact": Boolean,
|
|
3212
|
+
"save-optional": Boolean,
|
|
3213
|
+
"save-prefix": String,
|
|
3214
|
+
"save-prod": Boolean,
|
|
3215
|
+
scope: String,
|
|
3216
|
+
"script-shell": [null, String],
|
|
3217
|
+
"scripts-prepend-node-path": [false, true, "auto", "warn-only"],
|
|
3218
|
+
searchopts: String,
|
|
3219
|
+
searchexclude: [null, String],
|
|
3220
|
+
searchlimit: Number,
|
|
3221
|
+
searchstaleness: Number,
|
|
3222
|
+
"send-metrics": Boolean,
|
|
3223
|
+
shell: String,
|
|
3224
|
+
shrinkwrap: Boolean,
|
|
3225
|
+
"sign-git-commit": Boolean,
|
|
3226
|
+
"sign-git-tag": Boolean,
|
|
3227
|
+
"sso-poll-frequency": Number,
|
|
3228
|
+
"sso-type": [null, "oauth", "saml"],
|
|
3229
|
+
"strict-ssl": Boolean,
|
|
3230
|
+
tag: String,
|
|
3231
|
+
timing: Boolean,
|
|
3232
|
+
tmp: import_path10.default,
|
|
3233
|
+
unicode: Boolean,
|
|
3234
|
+
"unsafe-perm": Boolean,
|
|
3235
|
+
"update-notifier": Boolean,
|
|
3236
|
+
usage: Boolean,
|
|
3237
|
+
user: [Number, String],
|
|
3238
|
+
userconfig: import_path10.default,
|
|
3239
|
+
umask: Umask,
|
|
3240
|
+
version: Boolean,
|
|
3241
|
+
"tag-version-prefix": String,
|
|
3242
|
+
versions: Boolean,
|
|
3243
|
+
viewer: String,
|
|
3244
|
+
_exit: Boolean
|
|
3245
|
+
};
|
|
3246
|
+
}
|
|
3247
|
+
});
|
|
3248
|
+
|
|
3249
|
+
// libs/core/src/lib/npm-conf/parse-field.ts
|
|
3250
|
+
function parseField(input, key) {
|
|
3251
|
+
if (typeof input !== "string") {
|
|
3252
|
+
return input;
|
|
3253
|
+
}
|
|
3254
|
+
const typeList = [].concat(types[key]);
|
|
3255
|
+
const isPath = typeList.indexOf(import_path6.default) !== -1;
|
|
3256
|
+
const isBool = typeList.indexOf(Boolean) !== -1;
|
|
3257
|
+
const isString = typeList.indexOf(String) !== -1;
|
|
3258
|
+
const isNumber = typeList.indexOf(Number) !== -1;
|
|
3259
|
+
let field = `${input}`.trim();
|
|
3260
|
+
if (/^".*"$/.test(field)) {
|
|
3261
|
+
try {
|
|
3262
|
+
field = JSON.parse(field);
|
|
3263
|
+
} catch (err) {
|
|
3264
|
+
throw new Error(`Failed parsing JSON config key ${key}: ${field}`);
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
if (isBool && !isString && field === "") {
|
|
3268
|
+
return true;
|
|
3269
|
+
}
|
|
3270
|
+
switch (field) {
|
|
3271
|
+
case "true": {
|
|
3272
|
+
return true;
|
|
3273
|
+
}
|
|
3274
|
+
case "false": {
|
|
3275
|
+
return false;
|
|
3276
|
+
}
|
|
3277
|
+
case "null": {
|
|
3278
|
+
return null;
|
|
3279
|
+
}
|
|
3280
|
+
case "undefined": {
|
|
3281
|
+
return void 0;
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
field = envReplace(field);
|
|
3285
|
+
if (isPath) {
|
|
3286
|
+
const regex = process.platform === "win32" ? /^~(\/|\\)/ : /^~\//;
|
|
3287
|
+
if (regex.test(field) && process.env["HOME"]) {
|
|
3288
|
+
field = import_path6.default.resolve(process.env["HOME"], field.substr(2));
|
|
3289
|
+
}
|
|
3290
|
+
field = import_path6.default.resolve(field);
|
|
3291
|
+
}
|
|
3292
|
+
if (isNumber && !Number.isNaN(field)) {
|
|
3293
|
+
field = Number(field);
|
|
3294
|
+
}
|
|
3295
|
+
return field;
|
|
3296
|
+
}
|
|
3297
|
+
var import_path6, types;
|
|
3298
|
+
var init_parse_field = __esm({
|
|
3299
|
+
"libs/core/src/lib/npm-conf/parse-field.ts"() {
|
|
3300
|
+
"use strict";
|
|
3301
|
+
import_path6 = __toESM(require("path"));
|
|
3302
|
+
init_env_replace();
|
|
3303
|
+
({ types } = require_types());
|
|
3304
|
+
}
|
|
3305
|
+
});
|
|
3306
|
+
|
|
3307
|
+
// libs/core/src/lib/npm-conf/nerf-dart.ts
|
|
3308
|
+
function toNerfDart(uri) {
|
|
3309
|
+
const parsed = import_url.default.parse(uri);
|
|
3310
|
+
delete parsed.protocol;
|
|
3311
|
+
delete parsed.auth;
|
|
3312
|
+
delete parsed.query;
|
|
3313
|
+
delete parsed.search;
|
|
3314
|
+
delete parsed.hash;
|
|
3315
|
+
return import_url.default.resolve(import_url.default.format(parsed), ".");
|
|
3316
|
+
}
|
|
3317
|
+
var import_url;
|
|
3318
|
+
var init_nerf_dart = __esm({
|
|
3319
|
+
"libs/core/src/lib/npm-conf/nerf-dart.ts"() {
|
|
3320
|
+
"use strict";
|
|
3321
|
+
import_url = __toESM(require("url"));
|
|
3322
|
+
}
|
|
3323
|
+
});
|
|
3324
|
+
|
|
3325
|
+
// libs/core/src/lib/npm-conf/config-chain/proto-list.ts
|
|
3326
|
+
var require_proto_list = __commonJS({
|
|
3327
|
+
"libs/core/src/lib/npm-conf/config-chain/proto-list.ts"(exports2, module2) {
|
|
3328
|
+
"use strict";
|
|
3329
|
+
module2.exports = ProtoList;
|
|
3330
|
+
function setProto(obj, proto) {
|
|
3331
|
+
if (typeof Object.setPrototypeOf === "function") return Object.setPrototypeOf(obj, proto);
|
|
3332
|
+
else obj.__proto__ = proto;
|
|
3333
|
+
}
|
|
3334
|
+
function ProtoList() {
|
|
3335
|
+
this.list = [];
|
|
3336
|
+
var root = null;
|
|
3337
|
+
Object.defineProperty(this, "root", {
|
|
3338
|
+
get: function() {
|
|
3339
|
+
return root;
|
|
3340
|
+
},
|
|
3341
|
+
set: function(r) {
|
|
3342
|
+
root = r;
|
|
3343
|
+
if (this.list.length) {
|
|
3344
|
+
setProto(this.list[this.list.length - 1], r);
|
|
3345
|
+
}
|
|
3346
|
+
},
|
|
3347
|
+
enumerable: true,
|
|
3348
|
+
configurable: true
|
|
3349
|
+
});
|
|
3350
|
+
}
|
|
3351
|
+
ProtoList.prototype = {
|
|
3352
|
+
get length() {
|
|
3353
|
+
return this.list.length;
|
|
3354
|
+
},
|
|
3355
|
+
get keys() {
|
|
3356
|
+
var k = [];
|
|
3357
|
+
for (var i in this.list[0]) k.push(i);
|
|
3358
|
+
return k;
|
|
3359
|
+
},
|
|
3360
|
+
get snapshot() {
|
|
3361
|
+
var o2 = {};
|
|
3362
|
+
this.keys.forEach(function(k) {
|
|
3363
|
+
o2[k] = this.get(k);
|
|
3364
|
+
}, this);
|
|
3365
|
+
return o2;
|
|
3366
|
+
},
|
|
3367
|
+
get store() {
|
|
3368
|
+
return this.list[0];
|
|
3369
|
+
},
|
|
3370
|
+
push: function(obj) {
|
|
3371
|
+
if (typeof obj !== "object") obj = { valueOf: obj };
|
|
3372
|
+
if (this.list.length >= 1) {
|
|
3373
|
+
setProto(this.list[this.list.length - 1], obj);
|
|
3374
|
+
}
|
|
3375
|
+
setProto(obj, this.root);
|
|
3376
|
+
return this.list.push(obj);
|
|
3377
|
+
},
|
|
3378
|
+
pop: function() {
|
|
3379
|
+
if (this.list.length >= 2) {
|
|
3380
|
+
setProto(this.list[this.list.length - 2], this.root);
|
|
3381
|
+
}
|
|
3382
|
+
return this.list.pop();
|
|
3383
|
+
},
|
|
3384
|
+
unshift: function(obj) {
|
|
3385
|
+
setProto(obj, this.list[0] || this.root);
|
|
3386
|
+
return this.list.unshift(obj);
|
|
3387
|
+
},
|
|
3388
|
+
shift: function() {
|
|
3389
|
+
if (this.list.length === 1) {
|
|
3390
|
+
setProto(this.list[0], this.root);
|
|
3391
|
+
}
|
|
3392
|
+
return this.list.shift();
|
|
3393
|
+
},
|
|
3394
|
+
get: function(key) {
|
|
3395
|
+
return this.list[0][key];
|
|
3396
|
+
},
|
|
3397
|
+
set: function(key, val, save) {
|
|
3398
|
+
if (!this.length) this.push({});
|
|
3399
|
+
if (save && this.list[0].hasOwnProperty(key)) this.push({});
|
|
3400
|
+
return this.list[0][key] = val;
|
|
3401
|
+
},
|
|
3402
|
+
forEach: function(fn, thisp) {
|
|
3403
|
+
for (var key in this.list[0]) fn.call(thisp, key, this.list[0][key]);
|
|
3404
|
+
},
|
|
3405
|
+
slice: function() {
|
|
3406
|
+
return this.list.slice.apply(this.list, arguments);
|
|
3407
|
+
},
|
|
3408
|
+
splice: function() {
|
|
3409
|
+
var ret = this.list.splice.apply(this.list, arguments);
|
|
3410
|
+
for (var i = 0, l = this.list.length; i < l; i++) {
|
|
3411
|
+
setProto(this.list[i], this.list[i + 1] || this.root);
|
|
3412
|
+
}
|
|
3413
|
+
return ret;
|
|
3414
|
+
}
|
|
3415
|
+
};
|
|
3416
|
+
}
|
|
3417
|
+
});
|
|
3418
|
+
|
|
3419
|
+
// libs/core/src/lib/npm-conf/config-chain/index.ts
|
|
3420
|
+
var require_config_chain = __commonJS({
|
|
3421
|
+
"libs/core/src/lib/npm-conf/config-chain/index.ts"(exports2, module2) {
|
|
3422
|
+
"use strict";
|
|
3423
|
+
var ProtoList = require_proto_list();
|
|
3424
|
+
var path10 = require("path");
|
|
3425
|
+
var fs12 = require("fs");
|
|
3426
|
+
var ini = require("ini");
|
|
3427
|
+
var EE = require("events").EventEmitter;
|
|
3428
|
+
var url2 = require("url");
|
|
3429
|
+
var http = require("http");
|
|
3430
|
+
var exports2 = module2.exports = function() {
|
|
3431
|
+
var args = [].slice.call(arguments), conf = new ConfigChain2();
|
|
3432
|
+
while (args.length) {
|
|
3433
|
+
var a = args.shift();
|
|
3434
|
+
if (a) conf.push("string" === typeof a ? json(a) : a);
|
|
3435
|
+
}
|
|
3436
|
+
return conf;
|
|
3437
|
+
};
|
|
3438
|
+
var find2 = exports2.find = function() {
|
|
3439
|
+
var rel = path10.join.apply(null, [].slice.call(arguments));
|
|
3440
|
+
function find3(start, rel2) {
|
|
3441
|
+
var file = path10.join(start, rel2);
|
|
3442
|
+
try {
|
|
3443
|
+
fs12.statSync(file);
|
|
3444
|
+
return file;
|
|
3445
|
+
} catch (err) {
|
|
3446
|
+
if (path10.dirname(start) !== start)
|
|
3447
|
+
return find3(path10.dirname(start), rel2);
|
|
3448
|
+
}
|
|
3449
|
+
}
|
|
3450
|
+
return find3(__dirname, rel);
|
|
3451
|
+
};
|
|
3452
|
+
var parse = exports2.parse = function(content, file, type) {
|
|
3453
|
+
content = "" + content;
|
|
3454
|
+
if (!type) {
|
|
3455
|
+
try {
|
|
3456
|
+
return JSON.parse(content);
|
|
3457
|
+
} catch (er) {
|
|
3458
|
+
return ini.parse(content);
|
|
3459
|
+
}
|
|
3460
|
+
} else if (type === "json") {
|
|
3461
|
+
if (this.emit) {
|
|
3462
|
+
try {
|
|
3463
|
+
return JSON.parse(content);
|
|
3464
|
+
} catch (er) {
|
|
3465
|
+
this.emit("error", er);
|
|
3466
|
+
}
|
|
3467
|
+
} else {
|
|
3468
|
+
return JSON.parse(content);
|
|
3469
|
+
}
|
|
3470
|
+
} else {
|
|
3471
|
+
return ini.parse(content);
|
|
3472
|
+
}
|
|
3473
|
+
};
|
|
3474
|
+
var json = exports2.json = function() {
|
|
3475
|
+
var args = [].slice.call(arguments).filter(function(arg) {
|
|
3476
|
+
return arg != null;
|
|
3477
|
+
});
|
|
3478
|
+
var file = path10.join.apply(null, args);
|
|
3479
|
+
var content;
|
|
3480
|
+
try {
|
|
3481
|
+
content = fs12.readFileSync(file, "utf-8");
|
|
3482
|
+
} catch (err) {
|
|
3483
|
+
return;
|
|
3484
|
+
}
|
|
3485
|
+
return parse(content, file, "json");
|
|
3486
|
+
};
|
|
3487
|
+
var env = exports2.env = function(prefix, env2) {
|
|
3488
|
+
env2 = env2 || process.env;
|
|
3489
|
+
var obj = {};
|
|
3490
|
+
var l = prefix.length;
|
|
3491
|
+
for (var k in env2) {
|
|
3492
|
+
if (k.indexOf(prefix) === 0) obj[k.substring(l)] = env2[k];
|
|
3493
|
+
}
|
|
3494
|
+
return obj;
|
|
3495
|
+
};
|
|
3496
|
+
exports2.ConfigChain = ConfigChain2;
|
|
3497
|
+
function ConfigChain2() {
|
|
3498
|
+
EE.apply(this);
|
|
3499
|
+
ProtoList.apply(this, arguments);
|
|
3500
|
+
this._awaiting = 0;
|
|
3501
|
+
this._saving = 0;
|
|
3502
|
+
this.sources = {};
|
|
3503
|
+
}
|
|
3504
|
+
var extras = {
|
|
3505
|
+
constructor: { value: ConfigChain2 }
|
|
3506
|
+
};
|
|
3507
|
+
Object.keys(EE.prototype).forEach(function(k) {
|
|
3508
|
+
extras[k] = Object.getOwnPropertyDescriptor(EE.prototype, k);
|
|
3509
|
+
});
|
|
3510
|
+
ConfigChain2.prototype = Object.create(ProtoList.prototype, extras);
|
|
3511
|
+
ConfigChain2.prototype.del = function(key, where) {
|
|
3512
|
+
if (where) {
|
|
3513
|
+
var target = this.sources[where];
|
|
3514
|
+
target = target && target.data;
|
|
3515
|
+
if (!target) {
|
|
3516
|
+
return this.emit("error", new Error("not found " + where));
|
|
3517
|
+
}
|
|
3518
|
+
delete target[key];
|
|
3519
|
+
} else {
|
|
3520
|
+
for (var i = 0, l = this.list.length; i < l; i++) {
|
|
3521
|
+
delete this.list[i][key];
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
3524
|
+
return this;
|
|
3525
|
+
};
|
|
3526
|
+
ConfigChain2.prototype.set = function(key, value, where) {
|
|
3527
|
+
var target;
|
|
3528
|
+
if (where) {
|
|
3529
|
+
target = this.sources[where];
|
|
3530
|
+
target = target && target.data;
|
|
3531
|
+
if (!target) {
|
|
3532
|
+
return this.emit("error", new Error("not found " + where));
|
|
3533
|
+
}
|
|
3534
|
+
} else {
|
|
3535
|
+
target = this.list[0];
|
|
3536
|
+
if (!target) {
|
|
3537
|
+
return this.emit("error", new Error("cannot set, no confs!"));
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
target[key] = value;
|
|
3541
|
+
return this;
|
|
3542
|
+
};
|
|
3543
|
+
ConfigChain2.prototype.get = function(key, where) {
|
|
3544
|
+
if (where) {
|
|
3545
|
+
where = this.sources[where];
|
|
3546
|
+
if (where) where = where.data;
|
|
3547
|
+
if (where && Object.hasOwnProperty.call(where, key)) return where[key];
|
|
3548
|
+
return void 0;
|
|
3549
|
+
}
|
|
3550
|
+
return this.list[0][key];
|
|
3551
|
+
};
|
|
3552
|
+
ConfigChain2.prototype.save = function(where, type, cb) {
|
|
3553
|
+
if (typeof type === "function") cb = type, type = null;
|
|
3554
|
+
var target = this.sources[where];
|
|
3555
|
+
if (!target || !(target.path || target.source) || !target.data) {
|
|
3556
|
+
return this.emit("error", new Error("bad save target: " + where));
|
|
3557
|
+
}
|
|
3558
|
+
if (target.source) {
|
|
3559
|
+
var pref = target.prefix || "";
|
|
3560
|
+
Object.keys(target.data).forEach(function(k) {
|
|
3561
|
+
target.source[pref + k] = target.data[k];
|
|
3562
|
+
});
|
|
3563
|
+
return this;
|
|
3564
|
+
}
|
|
3565
|
+
var type = type || target.type;
|
|
3566
|
+
var data = target.data;
|
|
3567
|
+
if (target.type === "json") {
|
|
3568
|
+
data = JSON.stringify(data);
|
|
3569
|
+
} else {
|
|
3570
|
+
data = ini.stringify(data);
|
|
3571
|
+
}
|
|
3572
|
+
this._saving++;
|
|
3573
|
+
fs12.writeFile(
|
|
3574
|
+
target.path,
|
|
3575
|
+
data,
|
|
3576
|
+
"utf8",
|
|
3577
|
+
function(er) {
|
|
3578
|
+
this._saving--;
|
|
3579
|
+
if (er) {
|
|
3580
|
+
if (cb) return cb(er);
|
|
3581
|
+
else return this.emit("error", er);
|
|
3582
|
+
}
|
|
3583
|
+
if (this._saving === 0) {
|
|
3584
|
+
if (cb) cb();
|
|
3585
|
+
this.emit("save");
|
|
3586
|
+
}
|
|
3587
|
+
}.bind(this)
|
|
3588
|
+
);
|
|
3589
|
+
return this;
|
|
3590
|
+
};
|
|
3591
|
+
ConfigChain2.prototype.addFile = function(file, type, name) {
|
|
3592
|
+
name = name || file;
|
|
3593
|
+
var marker = { __source__: name };
|
|
3594
|
+
this.sources[name] = { path: file, type };
|
|
3595
|
+
this.push(marker);
|
|
3596
|
+
this._await();
|
|
3597
|
+
fs12.readFile(
|
|
3598
|
+
file,
|
|
3599
|
+
"utf8",
|
|
3600
|
+
function(er, data) {
|
|
3601
|
+
if (er) this.emit("error", er);
|
|
3602
|
+
this.addString(data, file, type, marker);
|
|
3603
|
+
}.bind(this)
|
|
3604
|
+
);
|
|
3605
|
+
return this;
|
|
3606
|
+
};
|
|
3607
|
+
ConfigChain2.prototype.addEnv = function(prefix, env2, name) {
|
|
3608
|
+
name = name || "env";
|
|
3609
|
+
var data = exports2.env(prefix, env2);
|
|
3610
|
+
this.sources[name] = { data, source: env2, prefix };
|
|
3611
|
+
return this.add(data, name);
|
|
3612
|
+
};
|
|
3613
|
+
ConfigChain2.prototype.addUrl = function(req, type, name) {
|
|
3614
|
+
this._await();
|
|
3615
|
+
var href = url2.format(req);
|
|
3616
|
+
name = name || href;
|
|
3617
|
+
var marker = { __source__: name };
|
|
3618
|
+
this.sources[name] = { href, type };
|
|
3619
|
+
this.push(marker);
|
|
3620
|
+
http.request(
|
|
3621
|
+
req,
|
|
3622
|
+
function(res) {
|
|
3623
|
+
var c = [];
|
|
3624
|
+
var ct = res.headers["content-type"];
|
|
3625
|
+
if (!type) {
|
|
3626
|
+
type = ct.indexOf("json") !== -1 ? "json" : ct.indexOf("ini") !== -1 ? "ini" : href.match(/\.json$/) ? "json" : href.match(/\.ini$/) ? "ini" : null;
|
|
3627
|
+
marker.type = type;
|
|
3628
|
+
}
|
|
3629
|
+
res.on("data", c.push.bind(c)).on(
|
|
3630
|
+
"end",
|
|
3631
|
+
function() {
|
|
3632
|
+
this.addString(Buffer.concat(c), href, type, marker);
|
|
3633
|
+
}.bind(this)
|
|
3634
|
+
).on("error", this.emit.bind(this, "error"));
|
|
3635
|
+
}.bind(this)
|
|
3636
|
+
).on("error", this.emit.bind(this, "error")).end();
|
|
3637
|
+
return this;
|
|
3638
|
+
};
|
|
3639
|
+
ConfigChain2.prototype.addString = function(data, file, type, marker) {
|
|
3640
|
+
data = this.parse(data, file, type);
|
|
3641
|
+
this.add(data, marker);
|
|
3642
|
+
return this;
|
|
3643
|
+
};
|
|
3644
|
+
ConfigChain2.prototype.add = function(data, marker) {
|
|
3645
|
+
if (marker && typeof marker === "object") {
|
|
3646
|
+
var i = this.list.indexOf(marker);
|
|
3647
|
+
if (i === -1) {
|
|
3648
|
+
return this.emit("error", new Error("bad marker"));
|
|
3649
|
+
}
|
|
3650
|
+
this.splice(i, 1, data);
|
|
3651
|
+
marker = marker.__source__;
|
|
3652
|
+
this.sources[marker] = this.sources[marker] || {};
|
|
3653
|
+
this.sources[marker].data = data;
|
|
3654
|
+
this._resolve();
|
|
3655
|
+
} else {
|
|
3656
|
+
if (typeof marker === "string") {
|
|
3657
|
+
this.sources[marker] = this.sources[marker] || {};
|
|
3658
|
+
this.sources[marker].data = data;
|
|
3659
|
+
}
|
|
3660
|
+
this._await();
|
|
3661
|
+
this.push(data);
|
|
3662
|
+
process.nextTick(this._resolve.bind(this));
|
|
3663
|
+
}
|
|
3664
|
+
return this;
|
|
3665
|
+
};
|
|
3666
|
+
ConfigChain2.prototype.parse = exports2.parse;
|
|
3667
|
+
ConfigChain2.prototype._await = function() {
|
|
3668
|
+
this._awaiting++;
|
|
3669
|
+
};
|
|
3670
|
+
ConfigChain2.prototype._resolve = function() {
|
|
3671
|
+
this._awaiting--;
|
|
3672
|
+
if (this._awaiting === 0) this.emit("load", this);
|
|
3673
|
+
};
|
|
3674
|
+
}
|
|
3675
|
+
});
|
|
3676
|
+
|
|
3677
|
+
// libs/core/src/lib/npm-conf/conf.ts
|
|
3678
|
+
var import_assert, import_fs4, import_path7, ConfigChain, Conf;
|
|
3679
|
+
var init_conf = __esm({
|
|
3680
|
+
"libs/core/src/lib/npm-conf/conf.ts"() {
|
|
3681
|
+
"use strict";
|
|
3682
|
+
import_assert = __toESM(require("assert"));
|
|
3683
|
+
import_fs4 = __toESM(require("fs"));
|
|
3684
|
+
import_path7 = __toESM(require("path"));
|
|
3685
|
+
init_env_replace();
|
|
3686
|
+
init_find_prefix();
|
|
3687
|
+
init_parse_field();
|
|
3688
|
+
init_nerf_dart();
|
|
3689
|
+
({ ConfigChain } = require_config_chain());
|
|
3690
|
+
Conf = class extends ConfigChain {
|
|
3691
|
+
root;
|
|
3692
|
+
// https://github.com/npm/npm/blob/latest/lib/config/core.js#L208-L222
|
|
3693
|
+
constructor(base) {
|
|
3694
|
+
super(base);
|
|
3695
|
+
this.root = base;
|
|
3696
|
+
}
|
|
3697
|
+
// https://github.com/npm/npm/blob/latest/lib/config/core.js#L332-L342
|
|
3698
|
+
add(data, marker) {
|
|
3699
|
+
try {
|
|
3700
|
+
for (const x of Object.keys(data)) {
|
|
3701
|
+
const newKey = envReplace(x);
|
|
3702
|
+
const newField = parseField(data[x], newKey);
|
|
3703
|
+
delete data[x];
|
|
3704
|
+
data[newKey] = newField;
|
|
3705
|
+
}
|
|
3706
|
+
} catch (err) {
|
|
3707
|
+
throw err;
|
|
3708
|
+
}
|
|
3709
|
+
return super.add(data, marker);
|
|
3710
|
+
}
|
|
3711
|
+
// https://github.com/npm/npm/blob/latest/lib/config/core.js#L312-L325
|
|
3712
|
+
addFile(file, name = file) {
|
|
3713
|
+
const marker = { __source__: name };
|
|
3714
|
+
this["sources"][name] = { path: file, type: "ini" };
|
|
3715
|
+
this["push"](marker);
|
|
3716
|
+
this["_await"]();
|
|
3717
|
+
try {
|
|
3718
|
+
const contents = import_fs4.default.readFileSync(file, "utf8");
|
|
3719
|
+
this["addString"](contents, file, "ini", marker);
|
|
3720
|
+
} catch (err) {
|
|
3721
|
+
this["add"]({}, marker);
|
|
3722
|
+
}
|
|
3723
|
+
return this;
|
|
3724
|
+
}
|
|
3725
|
+
// https://github.com/npm/npm/blob/latest/lib/config/core.js#L344-L360
|
|
3726
|
+
addEnv(env = process.env) {
|
|
3727
|
+
const conf = {};
|
|
3728
|
+
Object.keys(env).filter((x) => /^npm_config_/i.test(x)).forEach((x) => {
|
|
3729
|
+
if (!env[x]) {
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3732
|
+
const p = x.toLowerCase().replace(/^npm_config_/, "").replace(/(?!^)_/g, "-");
|
|
3733
|
+
conf[p] = env[x];
|
|
3734
|
+
});
|
|
3735
|
+
return super.addEnv("", conf, "env");
|
|
3736
|
+
}
|
|
3737
|
+
// https://github.com/npm/npm/blob/latest/lib/config/load-prefix.js
|
|
3738
|
+
loadPrefix() {
|
|
3739
|
+
const cli = this["list"][0];
|
|
3740
|
+
Object.defineProperty(this, "prefix", {
|
|
3741
|
+
enumerable: true,
|
|
3742
|
+
set: (prefix) => {
|
|
3743
|
+
const g = this["get"]("global");
|
|
3744
|
+
this[g ? "globalPrefix" : "localPrefix"] = prefix;
|
|
3745
|
+
},
|
|
3746
|
+
get: () => {
|
|
3747
|
+
const g = this["get"]("global");
|
|
3748
|
+
return g ? this["globalPrefix"] : this["localPrefix"];
|
|
3749
|
+
}
|
|
3750
|
+
});
|
|
3751
|
+
Object.defineProperty(this, "globalPrefix", {
|
|
3752
|
+
enumerable: true,
|
|
3753
|
+
set: (prefix) => {
|
|
3754
|
+
this["set"]("prefix", prefix);
|
|
3755
|
+
},
|
|
3756
|
+
get: () => import_path7.default.resolve(this["get"]("prefix"))
|
|
3757
|
+
});
|
|
3758
|
+
let p;
|
|
3759
|
+
Object.defineProperty(this, "localPrefix", {
|
|
3760
|
+
enumerable: true,
|
|
3761
|
+
set: (prefix) => {
|
|
3762
|
+
p = prefix;
|
|
3763
|
+
},
|
|
3764
|
+
get: () => p
|
|
3765
|
+
});
|
|
3766
|
+
if (Object.prototype.hasOwnProperty.call(cli, "prefix")) {
|
|
3767
|
+
p = import_path7.default.resolve(cli.prefix);
|
|
3768
|
+
} else {
|
|
3769
|
+
try {
|
|
3770
|
+
p = findPrefix(process.cwd());
|
|
3771
|
+
} catch (err) {
|
|
3772
|
+
throw err;
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
return p;
|
|
3776
|
+
}
|
|
3777
|
+
// https://github.com/npm/npm/blob/latest/lib/config/load-cafile.js
|
|
3778
|
+
loadCAFile(file) {
|
|
3779
|
+
if (!file) {
|
|
3780
|
+
return;
|
|
3781
|
+
}
|
|
3782
|
+
try {
|
|
3783
|
+
const contents = import_fs4.default.readFileSync(file, "utf8");
|
|
3784
|
+
const delim = "-----END CERTIFICATE-----";
|
|
3785
|
+
const output2 = contents.split(delim).filter((x) => Boolean(x.trim())).map((x) => x.trimLeft() + delim);
|
|
3786
|
+
this["set"]("ca", output2);
|
|
3787
|
+
} catch (err) {
|
|
3788
|
+
if (err.code === "ENOENT") {
|
|
3789
|
+
return;
|
|
3790
|
+
}
|
|
3791
|
+
throw err;
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
// https://github.com/npm/npm/blob/latest/lib/config/set-user.js
|
|
3795
|
+
loadUser() {
|
|
3796
|
+
const defConf = this.root;
|
|
3797
|
+
if (this["get"]("global")) {
|
|
3798
|
+
return;
|
|
3799
|
+
}
|
|
3800
|
+
if (process.env["SUDO_UID"]) {
|
|
3801
|
+
defConf.user = Number(process.env["SUDO_UID"]);
|
|
3802
|
+
return;
|
|
3803
|
+
}
|
|
3804
|
+
const prefix = import_path7.default.resolve(this["get"]("prefix"));
|
|
3805
|
+
try {
|
|
3806
|
+
const stats = import_fs4.default.statSync(prefix);
|
|
3807
|
+
defConf.user = stats.uid;
|
|
3808
|
+
} catch (err) {
|
|
3809
|
+
if (err.code === "ENOENT") {
|
|
3810
|
+
return;
|
|
3811
|
+
}
|
|
3812
|
+
throw err;
|
|
3813
|
+
}
|
|
3814
|
+
}
|
|
3815
|
+
// https://github.com/npm/npm/blob/24ec9f2/lib/config/get-credentials-by-uri.js
|
|
3816
|
+
getCredentialsByURI(uri) {
|
|
3817
|
+
(0, import_assert.default)(uri && typeof uri === "string", "registry URL is required");
|
|
3818
|
+
const nerfed = toNerfDart(uri);
|
|
3819
|
+
const defnerf = toNerfDart(this["get"]("registry"));
|
|
3820
|
+
const c = {
|
|
3821
|
+
scope: nerfed,
|
|
3822
|
+
token: void 0,
|
|
3823
|
+
password: void 0,
|
|
3824
|
+
username: void 0,
|
|
3825
|
+
email: void 0,
|
|
3826
|
+
auth: void 0,
|
|
3827
|
+
alwaysAuth: void 0
|
|
3828
|
+
};
|
|
3829
|
+
if (this["get"](`${nerfed}:always-auth`) !== void 0) {
|
|
3830
|
+
const val = this["get"](`${nerfed}:always-auth`);
|
|
3831
|
+
c.alwaysAuth = val === "false" ? false : !!val;
|
|
3832
|
+
} else if (this["get"]("always-auth") !== void 0) {
|
|
3833
|
+
c.alwaysAuth = this["get"]("always-auth");
|
|
3834
|
+
}
|
|
3835
|
+
if (this["get"](`${nerfed}:_authToken`)) {
|
|
3836
|
+
c.token = this["get"](`${nerfed}:_authToken`);
|
|
3837
|
+
return c;
|
|
3838
|
+
}
|
|
3839
|
+
let authDef = this["get"]("_auth");
|
|
3840
|
+
let userDef = this["get"]("username");
|
|
3841
|
+
let passDef = this["get"]("_password");
|
|
3842
|
+
if (authDef && !(userDef && passDef)) {
|
|
3843
|
+
authDef = Buffer.from(authDef, "base64").toString();
|
|
3844
|
+
authDef = authDef.split(":");
|
|
3845
|
+
userDef = authDef.shift();
|
|
3846
|
+
passDef = authDef.join(":");
|
|
3847
|
+
}
|
|
3848
|
+
if (this["get"](`${nerfed}:_password`)) {
|
|
3849
|
+
c.password = Buffer.from(this["get"](`${nerfed}:_password`), "base64").toString("utf8");
|
|
3850
|
+
} else if (nerfed === defnerf && passDef) {
|
|
3851
|
+
c.password = passDef;
|
|
3852
|
+
}
|
|
3853
|
+
if (this["get"](`${nerfed}:username`)) {
|
|
3854
|
+
c.username = this["get"](`${nerfed}:username`);
|
|
3855
|
+
} else if (nerfed === defnerf && userDef) {
|
|
3856
|
+
c.username = userDef;
|
|
3857
|
+
}
|
|
3858
|
+
if (this["get"](`${nerfed}:email`)) {
|
|
3859
|
+
c.email = this["get"](`${nerfed}:email`);
|
|
3860
|
+
} else if (this["get"]("email")) {
|
|
3861
|
+
c.email = this["get"]("email");
|
|
3862
|
+
}
|
|
3863
|
+
if (c.username && c.password) {
|
|
3864
|
+
c.auth = Buffer.from(`${c.username}:${c.password}`).toString("base64");
|
|
3865
|
+
}
|
|
3866
|
+
return c;
|
|
3867
|
+
}
|
|
3868
|
+
// https://github.com/npm/npm/blob/24ec9f2/lib/config/set-credentials-by-uri.js
|
|
3869
|
+
setCredentialsByURI(uri, c) {
|
|
3870
|
+
(0, import_assert.default)(uri && typeof uri === "string", "registry URL is required");
|
|
3871
|
+
(0, import_assert.default)(c && typeof c === "object", "credentials are required");
|
|
3872
|
+
const nerfed = toNerfDart(uri);
|
|
3873
|
+
if (c.token) {
|
|
3874
|
+
this["set"](`${nerfed}:_authToken`, c.token, "user");
|
|
3875
|
+
this["del"](`${nerfed}:_password`, "user");
|
|
3876
|
+
this["del"](`${nerfed}:username`, "user");
|
|
3877
|
+
this["del"](`${nerfed}:email`, "user");
|
|
3878
|
+
this["del"](`${nerfed}:always-auth`, "user");
|
|
3879
|
+
} else if (c.username || c.password || c.email) {
|
|
3880
|
+
(0, import_assert.default)(c.username, "must include username");
|
|
3881
|
+
(0, import_assert.default)(c.password, "must include password");
|
|
3882
|
+
(0, import_assert.default)(c.email, "must include email address");
|
|
3883
|
+
this["del"](`${nerfed}:_authToken`, "user");
|
|
3884
|
+
const encoded = Buffer.from(c.password, "utf8").toString("base64");
|
|
3885
|
+
this["set"](`${nerfed}:_password`, encoded, "user");
|
|
3886
|
+
this["set"](`${nerfed}:username`, c.username, "user");
|
|
3887
|
+
this["set"](`${nerfed}:email`, c.email, "user");
|
|
3888
|
+
if (c.alwaysAuth !== void 0) {
|
|
3889
|
+
this["set"](`${nerfed}:always-auth`, c.alwaysAuth, "user");
|
|
3890
|
+
} else {
|
|
3891
|
+
this["del"](`${nerfed}:always-auth`, "user");
|
|
3892
|
+
}
|
|
3893
|
+
} else {
|
|
3894
|
+
throw new Error("No credentials to set.");
|
|
3895
|
+
}
|
|
3896
|
+
}
|
|
3897
|
+
};
|
|
3898
|
+
}
|
|
3899
|
+
});
|
|
3900
|
+
|
|
3901
|
+
// libs/core/src/lib/get-npm-exec-opts.ts
|
|
3902
|
+
function getNpmExecOpts(pkg, registry) {
|
|
3903
|
+
const env = {
|
|
3904
|
+
LERNA_PACKAGE_NAME: pkg.name
|
|
3905
|
+
};
|
|
3906
|
+
if (registry) {
|
|
3907
|
+
env.npm_config_registry = registry;
|
|
3908
|
+
}
|
|
3909
|
+
npmlog_default.silly("getNpmExecOpts", pkg.location, registry);
|
|
3910
|
+
return {
|
|
3911
|
+
cwd: pkg.location,
|
|
3912
|
+
env,
|
|
3913
|
+
pkg
|
|
3914
|
+
};
|
|
3915
|
+
}
|
|
3916
|
+
var init_get_npm_exec_opts = __esm({
|
|
3917
|
+
"libs/core/src/lib/get-npm-exec-opts.ts"() {
|
|
3918
|
+
"use strict";
|
|
3919
|
+
init_npmlog();
|
|
3920
|
+
}
|
|
3921
|
+
});
|
|
3922
|
+
|
|
3923
|
+
// libs/core/src/lib/npm-install.ts
|
|
3924
|
+
function npmInstall(pkg, { registry, npmClient, npmClientArgs, npmGlobalStyle, mutex, stdio = "pipe", subCommand = "install" }) {
|
|
3925
|
+
const opts = getNpmExecOpts(pkg, registry);
|
|
3926
|
+
const args = [subCommand];
|
|
3927
|
+
let cmd = npmClient || "npm";
|
|
3928
|
+
if (npmGlobalStyle) {
|
|
3929
|
+
cmd = "npm";
|
|
3930
|
+
args.push("--global-style");
|
|
3931
|
+
}
|
|
3932
|
+
if (cmd === "yarn" && mutex) {
|
|
3933
|
+
args.push("--mutex", mutex);
|
|
3934
|
+
}
|
|
3935
|
+
if (cmd === "yarn") {
|
|
3936
|
+
args.push("--non-interactive");
|
|
3937
|
+
}
|
|
3938
|
+
if (npmClientArgs && npmClientArgs.length) {
|
|
3939
|
+
args.push(...npmClientArgs);
|
|
3940
|
+
}
|
|
3941
|
+
opts.stdio = stdio;
|
|
3942
|
+
opts.env.LERNA_EXEC_PATH = pkg.location;
|
|
3943
|
+
opts.env.LERNA_ROOT_PATH = pkg.rootPath;
|
|
3944
|
+
npmlog_default.silly("npmInstall", [cmd, args]);
|
|
3945
|
+
return childProcess8.exec(cmd, args, opts);
|
|
3946
|
+
}
|
|
3947
|
+
function npmInstallDependencies(pkg, dependencies, config) {
|
|
3948
|
+
npmlog_default.silly("npmInstallDependencies", pkg.name, dependencies);
|
|
3949
|
+
if (!(dependencies && dependencies.length)) {
|
|
3950
|
+
npmlog_default.verbose("npmInstallDependencies", "no dependencies to install");
|
|
3951
|
+
return Promise.resolve();
|
|
3952
|
+
}
|
|
3953
|
+
const packageJsonBkp = `${pkg.manifestLocation}.lerna_backup`;
|
|
3954
|
+
npmlog_default.silly("npmInstallDependencies", "backup", pkg.manifestLocation);
|
|
3955
|
+
return import_fs_extra4.default.copy(pkg.manifestLocation, packageJsonBkp).then(() => {
|
|
3956
|
+
const cleanup = () => {
|
|
3957
|
+
npmlog_default.silly("npmInstallDependencies", "cleanup", pkg.manifestLocation);
|
|
3958
|
+
import_fs_extra4.default.renameSync(packageJsonBkp, pkg.manifestLocation);
|
|
3959
|
+
};
|
|
3960
|
+
const unregister = (0, import_signal_exit2.default)(cleanup);
|
|
3961
|
+
const done = (finalError) => {
|
|
3962
|
+
cleanup();
|
|
3963
|
+
unregister();
|
|
3964
|
+
if (finalError) {
|
|
3965
|
+
throw finalError;
|
|
3966
|
+
}
|
|
3967
|
+
};
|
|
3968
|
+
const tempJson = transformManifest(pkg, dependencies);
|
|
3969
|
+
npmlog_default.silly("npmInstallDependencies", "writing tempJson", tempJson);
|
|
3970
|
+
return (0, import_write_pkg2.default)(pkg.manifestLocation, tempJson).then(() => npmInstall(pkg, config)).then(() => done(), done);
|
|
3971
|
+
});
|
|
3972
|
+
}
|
|
3973
|
+
function transformManifest(pkg, dependencies) {
|
|
3974
|
+
const json = pkg.toJSON();
|
|
3975
|
+
const depMap = new Map(
|
|
3976
|
+
dependencies.map((dep) => {
|
|
3977
|
+
const { name, rawSpec } = (0, import_npm_package_arg4.default)(dep, pkg.location);
|
|
3978
|
+
return [name, rawSpec || "*"];
|
|
3979
|
+
})
|
|
3980
|
+
);
|
|
3981
|
+
delete json.scripts;
|
|
3982
|
+
["dependencies", "devDependencies", "optionalDependencies"].forEach((depType) => {
|
|
3983
|
+
const collection = json[depType];
|
|
3984
|
+
if (collection) {
|
|
3985
|
+
Object.keys(collection).forEach((depName) => {
|
|
3986
|
+
if (depMap.has(depName)) {
|
|
3987
|
+
collection[depName] = depMap.get(depName);
|
|
3988
|
+
depMap.delete(depName);
|
|
3989
|
+
} else {
|
|
3990
|
+
delete collection[depName];
|
|
3991
|
+
}
|
|
3992
|
+
});
|
|
3993
|
+
}
|
|
3994
|
+
});
|
|
3995
|
+
["bundledDependencies", "bundleDependencies"].forEach((depType) => {
|
|
3996
|
+
const collection = json[depType];
|
|
3997
|
+
if (Array.isArray(collection)) {
|
|
3998
|
+
const newCollection = [];
|
|
3999
|
+
for (const depName of collection) {
|
|
4000
|
+
if (depMap.has(depName)) {
|
|
4001
|
+
newCollection.push(depName);
|
|
4002
|
+
depMap.delete(depName);
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
json[depType] = newCollection;
|
|
4006
|
+
}
|
|
4007
|
+
});
|
|
4008
|
+
if (depMap.size) {
|
|
4009
|
+
if (!json.dependencies) {
|
|
4010
|
+
json.dependencies = {};
|
|
4011
|
+
}
|
|
4012
|
+
depMap.forEach((depVersion, depName) => {
|
|
4013
|
+
json.dependencies[depName] = depVersion;
|
|
4014
|
+
});
|
|
4015
|
+
}
|
|
4016
|
+
return json;
|
|
4017
|
+
}
|
|
4018
|
+
var import_fs_extra4, import_npm_package_arg4, import_signal_exit2, import_write_pkg2, childProcess8;
|
|
4019
|
+
var init_npm_install = __esm({
|
|
4020
|
+
"libs/core/src/lib/npm-install.ts"() {
|
|
4021
|
+
"use strict";
|
|
4022
|
+
import_fs_extra4 = __toESM(require("fs-extra"));
|
|
4023
|
+
import_npm_package_arg4 = __toESM(require("npm-package-arg"));
|
|
4024
|
+
import_signal_exit2 = __toESM(require("signal-exit"));
|
|
4025
|
+
import_write_pkg2 = __toESM(require("write-pkg"));
|
|
4026
|
+
init_get_npm_exec_opts();
|
|
4027
|
+
init_npmlog();
|
|
4028
|
+
childProcess8 = (init_src(), __toCommonJS(src_exports));
|
|
4029
|
+
module.exports.npmInstallDependencies = npmInstallDependencies;
|
|
4030
|
+
}
|
|
4031
|
+
});
|
|
4032
|
+
|
|
4033
|
+
// libs/core/src/lib/oidc.ts
|
|
4034
|
+
var import_ci_info, import_libnpmaccess, import_make_fetch_happen, import_npm_package_arg5, import_npm_registry_fetch;
|
|
4035
|
+
var init_oidc = __esm({
|
|
4036
|
+
"libs/core/src/lib/oidc.ts"() {
|
|
4037
|
+
"use strict";
|
|
4038
|
+
import_ci_info = __toESM(require("ci-info"));
|
|
4039
|
+
import_libnpmaccess = __toESM(require("libnpmaccess"));
|
|
4040
|
+
import_make_fetch_happen = __toESM(require("make-fetch-happen"));
|
|
4041
|
+
import_npm_package_arg5 = __toESM(require("npm-package-arg"));
|
|
4042
|
+
import_npm_registry_fetch = __toESM(require("npm-registry-fetch"));
|
|
4043
|
+
init_npmlog();
|
|
4044
|
+
}
|
|
4045
|
+
});
|
|
4046
|
+
|
|
4047
|
+
// libs/core/src/lib/prompt.ts
|
|
4048
|
+
function promptTextInput(message, {
|
|
4049
|
+
filter,
|
|
4050
|
+
validate
|
|
4051
|
+
} = {}) {
|
|
4052
|
+
npmlog_default.pause();
|
|
4053
|
+
return import_inquirer.default.prompt([
|
|
4054
|
+
{
|
|
4055
|
+
type: "input",
|
|
4056
|
+
name: "input",
|
|
4057
|
+
message,
|
|
4058
|
+
filter,
|
|
4059
|
+
validate
|
|
4060
|
+
}
|
|
4061
|
+
]).then((answers) => {
|
|
4062
|
+
npmlog_default.resume();
|
|
4063
|
+
return answers["input"];
|
|
4064
|
+
});
|
|
4065
|
+
}
|
|
4066
|
+
var import_inquirer;
|
|
4067
|
+
var init_prompt = __esm({
|
|
4068
|
+
"libs/core/src/lib/prompt.ts"() {
|
|
4069
|
+
"use strict";
|
|
4070
|
+
import_inquirer = __toESM(require("inquirer"));
|
|
4071
|
+
init_npmlog();
|
|
4072
|
+
}
|
|
4073
|
+
});
|
|
4074
|
+
|
|
4075
|
+
// libs/core/src/lib/otplease.ts
|
|
4076
|
+
function otplease(fn, _opts, otpCache) {
|
|
4077
|
+
const opts = { ...otpCache, ..._opts };
|
|
4078
|
+
return attempt(fn, opts, otpCache);
|
|
4079
|
+
}
|
|
4080
|
+
function attempt(fn, opts, otpCache) {
|
|
4081
|
+
return new Promise((resolve2) => {
|
|
4082
|
+
resolve2(fn(opts));
|
|
4083
|
+
}).catch((err) => {
|
|
4084
|
+
if (err.code !== "EOTP" && !(err.code === "E401" && /one-time pass/.test(err.body))) {
|
|
4085
|
+
throw err;
|
|
4086
|
+
} else if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
4087
|
+
throw err;
|
|
4088
|
+
} else {
|
|
4089
|
+
if (otpCache != null && otpCache.otp != null && otpCache.otp !== opts["otp"]) {
|
|
4090
|
+
return attempt(fn, { ...opts, ...otpCache }, otpCache);
|
|
4091
|
+
}
|
|
4092
|
+
return semaphore.wait().then(() => {
|
|
4093
|
+
if (otpCache != null && otpCache.otp != null && otpCache.otp !== opts["otp"]) {
|
|
4094
|
+
semaphore.release();
|
|
4095
|
+
return attempt(fn, { ...opts, ...otpCache }, otpCache);
|
|
4096
|
+
}
|
|
4097
|
+
return getOneTimePassword().then(
|
|
4098
|
+
(otp) => {
|
|
4099
|
+
if (otpCache != null) {
|
|
4100
|
+
otpCache.otp = otp;
|
|
4101
|
+
}
|
|
4102
|
+
semaphore.release();
|
|
4103
|
+
return otp;
|
|
4104
|
+
},
|
|
4105
|
+
(promptError) => {
|
|
4106
|
+
semaphore.release();
|
|
4107
|
+
return Promise.reject(promptError);
|
|
4108
|
+
}
|
|
4109
|
+
).then((otp) => {
|
|
4110
|
+
return fn({ ...opts, otp });
|
|
4111
|
+
});
|
|
4112
|
+
});
|
|
4113
|
+
}
|
|
4114
|
+
});
|
|
4115
|
+
}
|
|
4116
|
+
function getOneTimePassword(message = "This operation requires a one-time password:") {
|
|
4117
|
+
return promptTextInput(message, {
|
|
4118
|
+
filter: (otp) => otp.replace(/\s+/g, ""),
|
|
4119
|
+
validate: (otp) => otp && /^[\d ]+$|^[A-Fa-f0-9]{64,64}$/.test(otp) || "Must be a valid one-time-password. See https://docs.npmjs.com/getting-started/using-two-factor-authentication"
|
|
4120
|
+
});
|
|
4121
|
+
}
|
|
4122
|
+
var semaphore;
|
|
4123
|
+
var init_otplease = __esm({
|
|
4124
|
+
"libs/core/src/lib/otplease.ts"() {
|
|
4125
|
+
"use strict";
|
|
4126
|
+
init_prompt();
|
|
4127
|
+
semaphore = {
|
|
4128
|
+
_promise: void 0,
|
|
4129
|
+
_resolve: void 0,
|
|
4130
|
+
wait() {
|
|
4131
|
+
return new Promise((resolve2) => {
|
|
4132
|
+
if (!this._promise) {
|
|
4133
|
+
this._promise = new Promise((release) => {
|
|
4134
|
+
this._resolve = release;
|
|
4135
|
+
});
|
|
4136
|
+
resolve2(void 0);
|
|
4137
|
+
} else {
|
|
4138
|
+
resolve2(this._promise.then(() => this.wait()));
|
|
4139
|
+
}
|
|
4140
|
+
});
|
|
4141
|
+
},
|
|
4142
|
+
release() {
|
|
4143
|
+
const resolve2 = this._resolve;
|
|
4144
|
+
if (resolve2) {
|
|
4145
|
+
this._resolve = void 0;
|
|
4146
|
+
this._promise = void 0;
|
|
4147
|
+
resolve2();
|
|
4148
|
+
}
|
|
4149
|
+
}
|
|
4150
|
+
};
|
|
4151
|
+
}
|
|
4152
|
+
});
|
|
4153
|
+
|
|
4154
|
+
// libs/core/src/lib/npm-conf/defaults.ts
|
|
4155
|
+
var require_defaults = __commonJS({
|
|
4156
|
+
"libs/core/src/lib/npm-conf/defaults.ts"(exports2) {
|
|
4157
|
+
"use strict";
|
|
4158
|
+
var import_os2 = __toESM(require("os"));
|
|
4159
|
+
var import_path10 = __toESM(require("path"));
|
|
4160
|
+
var temp = import_os2.default.tmpdir();
|
|
4161
|
+
var uidOrPid = process.getuid ? process.getuid() : process.pid;
|
|
4162
|
+
var hasUnicode3 = () => true;
|
|
4163
|
+
var isWindows = process.platform === "win32";
|
|
4164
|
+
var osenv = {
|
|
4165
|
+
editor: () => process.env["EDITOR"] || process.env["VISUAL"] || (isWindows ? "notepad.exe" : "vi"),
|
|
4166
|
+
shell: () => isWindows ? process.env["COMSPEC"] || "cmd.exe" : process.env["SHELL"] || "/bin/bash"
|
|
4167
|
+
};
|
|
4168
|
+
var umask = {
|
|
4169
|
+
fromString: () => process.umask()
|
|
4170
|
+
};
|
|
4171
|
+
var home = import_os2.default.homedir();
|
|
4172
|
+
if (home) {
|
|
4173
|
+
process.env["HOME"] = home;
|
|
4174
|
+
} else {
|
|
4175
|
+
home = import_path10.default.resolve(temp, `npm-${uidOrPid}`);
|
|
4176
|
+
}
|
|
4177
|
+
var cacheExtra = process.platform === "win32" ? "npm-cache" : ".npm";
|
|
4178
|
+
var cacheRoot = process.platform === "win32" && process.env["APPDATA"] || home;
|
|
4179
|
+
var cache = import_path10.default.resolve(cacheRoot, cacheExtra);
|
|
4180
|
+
var defaults;
|
|
4181
|
+
var globalPrefix;
|
|
4182
|
+
Object.defineProperty(exports2, "defaults", {
|
|
4183
|
+
get() {
|
|
4184
|
+
if (defaults) {
|
|
4185
|
+
return defaults;
|
|
4186
|
+
}
|
|
4187
|
+
if (process.env["PREFIX"]) {
|
|
4188
|
+
globalPrefix = process.env["PREFIX"];
|
|
4189
|
+
} else if (process.platform === "win32") {
|
|
4190
|
+
globalPrefix = import_path10.default.dirname(process.execPath);
|
|
4191
|
+
} else {
|
|
4192
|
+
globalPrefix = import_path10.default.dirname(import_path10.default.dirname(process.execPath));
|
|
4193
|
+
if (process.env["DESTDIR"]) {
|
|
4194
|
+
globalPrefix = import_path10.default.join(process.env["DESTDIR"], globalPrefix);
|
|
4195
|
+
}
|
|
4196
|
+
}
|
|
4197
|
+
defaults = {
|
|
4198
|
+
access: null,
|
|
4199
|
+
"allow-same-version": false,
|
|
4200
|
+
"always-auth": false,
|
|
4201
|
+
also: null,
|
|
4202
|
+
audit: true,
|
|
4203
|
+
"audit-level": "low",
|
|
4204
|
+
"auth-type": "legacy",
|
|
4205
|
+
"bin-links": true,
|
|
4206
|
+
browser: null,
|
|
4207
|
+
ca: null,
|
|
4208
|
+
cafile: null,
|
|
4209
|
+
cache,
|
|
4210
|
+
"cache-lock-stale": 6e4,
|
|
4211
|
+
"cache-lock-retries": 10,
|
|
4212
|
+
"cache-lock-wait": 1e4,
|
|
4213
|
+
"cache-max": Infinity,
|
|
4214
|
+
"cache-min": 10,
|
|
4215
|
+
cert: null,
|
|
4216
|
+
cidr: null,
|
|
4217
|
+
color: process.env["NO_COLOR"] == null,
|
|
4218
|
+
depth: Infinity,
|
|
4219
|
+
description: true,
|
|
4220
|
+
dev: false,
|
|
4221
|
+
"dry-run": false,
|
|
4222
|
+
editor: osenv.editor(),
|
|
4223
|
+
"engine-strict": false,
|
|
4224
|
+
force: false,
|
|
4225
|
+
"fetch-retries": 2,
|
|
4226
|
+
"fetch-retry-factor": 10,
|
|
4227
|
+
"fetch-retry-mintimeout": 1e4,
|
|
4228
|
+
"fetch-retry-maxtimeout": 6e4,
|
|
4229
|
+
git: "git",
|
|
4230
|
+
"git-tag-version": true,
|
|
4231
|
+
"commit-hooks": true,
|
|
4232
|
+
global: false,
|
|
4233
|
+
globalconfig: import_path10.default.resolve(globalPrefix, "etc", "npmrc"),
|
|
4234
|
+
"global-style": false,
|
|
4235
|
+
group: process.platform === "win32" ? 0 : process.env["SUDO_GID"] || process.getgid && process.getgid(),
|
|
4236
|
+
"ham-it-up": false,
|
|
4237
|
+
heading: "npm",
|
|
4238
|
+
"if-present": false,
|
|
4239
|
+
"ignore-prepublish": false,
|
|
4240
|
+
"ignore-scripts": false,
|
|
4241
|
+
"init-module": import_path10.default.resolve(home, ".npm-init.js"),
|
|
4242
|
+
"init-author-name": "",
|
|
4243
|
+
"init-author-email": "",
|
|
4244
|
+
"init-author-url": "",
|
|
4245
|
+
"init-version": "1.0.0",
|
|
4246
|
+
"init-license": "ISC",
|
|
4247
|
+
json: false,
|
|
4248
|
+
key: null,
|
|
4249
|
+
"legacy-bundling": false,
|
|
4250
|
+
link: false,
|
|
4251
|
+
"local-address": void 0,
|
|
4252
|
+
loglevel: "notice",
|
|
4253
|
+
logstream: process.stderr,
|
|
4254
|
+
"logs-max": 10,
|
|
4255
|
+
long: false,
|
|
4256
|
+
maxsockets: 50,
|
|
4257
|
+
message: "%s",
|
|
4258
|
+
"metrics-registry": null,
|
|
4259
|
+
"node-options": null,
|
|
4260
|
+
"node-version": process.version,
|
|
4261
|
+
offline: false,
|
|
4262
|
+
"onload-script": false,
|
|
4263
|
+
only: null,
|
|
4264
|
+
optional: true,
|
|
4265
|
+
otp: void 0,
|
|
4266
|
+
"package-lock": true,
|
|
4267
|
+
"package-lock-only": false,
|
|
4268
|
+
parseable: false,
|
|
4269
|
+
"prefer-offline": false,
|
|
4270
|
+
"prefer-online": false,
|
|
4271
|
+
prefix: globalPrefix,
|
|
4272
|
+
preid: "",
|
|
4273
|
+
production: process.env["NODE_ENV"] === "production",
|
|
4274
|
+
progress: !process.env["TRAVIS"] && !process.env["CI"],
|
|
4275
|
+
proxy: null,
|
|
4276
|
+
"https-proxy": null,
|
|
4277
|
+
noproxy: null,
|
|
4278
|
+
"user-agent": "npm/{npm-version} node/{node-version} {platform} {arch}",
|
|
4279
|
+
"read-only": false,
|
|
4280
|
+
"rebuild-bundle": true,
|
|
4281
|
+
registry: "https://registry.npmjs.org/",
|
|
4282
|
+
rollback: true,
|
|
4283
|
+
save: true,
|
|
4284
|
+
"save-bundle": false,
|
|
4285
|
+
"save-dev": false,
|
|
4286
|
+
"save-exact": false,
|
|
4287
|
+
"save-optional": false,
|
|
4288
|
+
"save-prefix": "^",
|
|
4289
|
+
"save-prod": false,
|
|
4290
|
+
scope: "",
|
|
4291
|
+
"script-shell": void 0,
|
|
4292
|
+
"scripts-prepend-node-path": "warn-only",
|
|
4293
|
+
searchopts: "",
|
|
4294
|
+
searchexclude: null,
|
|
4295
|
+
searchlimit: 20,
|
|
4296
|
+
searchstaleness: 15 * 60,
|
|
4297
|
+
"send-metrics": false,
|
|
4298
|
+
shell: osenv.shell(),
|
|
4299
|
+
shrinkwrap: true,
|
|
4300
|
+
"sign-git-commit": false,
|
|
4301
|
+
"sign-git-tag": false,
|
|
4302
|
+
"sso-poll-frequency": 500,
|
|
4303
|
+
"sso-type": "oauth",
|
|
4304
|
+
"strict-ssl": true,
|
|
4305
|
+
tag: "latest",
|
|
4306
|
+
"tag-version-prefix": "v",
|
|
4307
|
+
timing: false,
|
|
4308
|
+
tmp: temp,
|
|
4309
|
+
unicode: hasUnicode3(),
|
|
4310
|
+
"unsafe-perm": process.platform === "win32" || process.platform === "cygwin" || // TODO: refactor based on TS feedback
|
|
4311
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4312
|
+
// @ts-ignore
|
|
4313
|
+
!(process.getuid && process.setuid && process.getgid && process.setgid) || process.getuid() !== 0,
|
|
4314
|
+
"update-notifier": true,
|
|
4315
|
+
usage: false,
|
|
4316
|
+
user: process.platform === "win32" || import_os2.default.type() === "OS400" ? 0 : "nobody",
|
|
4317
|
+
userconfig: import_path10.default.resolve(home, ".npmrc"),
|
|
4318
|
+
// TODO: refactor based on TS feedback
|
|
4319
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4320
|
+
// @ts-ignore
|
|
4321
|
+
umask: process.umask ? process.umask() : umask.fromString("022"),
|
|
4322
|
+
version: false,
|
|
4323
|
+
versions: false,
|
|
4324
|
+
viewer: process.platform === "win32" ? "browser" : "man",
|
|
4325
|
+
_exit: true
|
|
4326
|
+
};
|
|
4327
|
+
return defaults;
|
|
4328
|
+
}
|
|
4329
|
+
});
|
|
4330
|
+
}
|
|
4331
|
+
});
|
|
4332
|
+
|
|
4333
|
+
// libs/core/src/lib/npm-conf/index.ts
|
|
4334
|
+
var require_npm_conf = __commonJS({
|
|
4335
|
+
"libs/core/src/lib/npm-conf/index.ts"(exports2, module2) {
|
|
4336
|
+
"use strict";
|
|
4337
|
+
var import_path10 = __toESM(require("path"));
|
|
4338
|
+
init_conf();
|
|
4339
|
+
init_nerf_dart();
|
|
4340
|
+
var { defaults } = require_defaults();
|
|
4341
|
+
module2.exports = npmConf3;
|
|
4342
|
+
module2.exports.Conf = Conf;
|
|
4343
|
+
module2.exports.defaults = Object.assign({}, defaults);
|
|
4344
|
+
module2.exports.toNerfDart = toNerfDart;
|
|
4345
|
+
function npmConf3(opts) {
|
|
4346
|
+
const conf = new Conf(Object.assign({}, defaults));
|
|
4347
|
+
const cleanOpts = opts ? Object.keys(opts).reduce((acc, key) => {
|
|
4348
|
+
if (opts[key] !== void 0) {
|
|
4349
|
+
acc[key] = opts[key];
|
|
4350
|
+
}
|
|
4351
|
+
return acc;
|
|
4352
|
+
}, {}) : {};
|
|
4353
|
+
conf.add(cleanOpts, "cli");
|
|
4354
|
+
conf.addEnv();
|
|
4355
|
+
conf.loadPrefix();
|
|
4356
|
+
const projectConf = import_path10.default.resolve(conf["localPrefix"], ".npmrc");
|
|
4357
|
+
const userConf = conf["get"]("userconfig");
|
|
4358
|
+
if (!conf["get"]("global") && projectConf !== userConf) {
|
|
4359
|
+
conf.addFile(projectConf, "project");
|
|
4360
|
+
} else {
|
|
4361
|
+
conf.add({}, "project");
|
|
4362
|
+
}
|
|
4363
|
+
conf.addFile(conf["get"]("userconfig"), "user");
|
|
4364
|
+
if (conf["get"]("prefix")) {
|
|
4365
|
+
const etc = import_path10.default.resolve(conf["get"]("prefix"), "etc");
|
|
4366
|
+
conf.root.globalconfig = import_path10.default.resolve(etc, "npmrc");
|
|
4367
|
+
conf.root.globalignorefile = import_path10.default.resolve(etc, "npmignore");
|
|
4368
|
+
}
|
|
4369
|
+
conf.addFile(conf["get"]("globalconfig"), "global");
|
|
4370
|
+
conf.loadUser();
|
|
4371
|
+
const caFile = conf["get"]("cafile");
|
|
4372
|
+
if (caFile) {
|
|
4373
|
+
conf.loadCAFile(caFile);
|
|
4374
|
+
}
|
|
4375
|
+
return conf;
|
|
4376
|
+
}
|
|
4377
|
+
}
|
|
4378
|
+
});
|
|
4379
|
+
|
|
4380
|
+
// libs/core/src/lib/run-lifecycle.ts
|
|
4381
|
+
var import_p_queue, runScript, npmConf, queue;
|
|
4382
|
+
var init_run_lifecycle = __esm({
|
|
4383
|
+
"libs/core/src/lib/run-lifecycle.ts"() {
|
|
4384
|
+
"use strict";
|
|
4385
|
+
import_p_queue = __toESM(require("p-queue"));
|
|
4386
|
+
init_npmlog();
|
|
4387
|
+
runScript = require("@npmcli/run-script");
|
|
4388
|
+
npmConf = require_npm_conf();
|
|
4389
|
+
queue = new import_p_queue.default({ concurrency: 1 });
|
|
4390
|
+
}
|
|
4391
|
+
});
|
|
4392
|
+
|
|
4393
|
+
// libs/core/src/lib/npm-publish.ts
|
|
4394
|
+
var import_package_json, import_fs_extra5, import_libnpmpublish, import_npm_package_arg6;
|
|
4395
|
+
var init_npm_publish = __esm({
|
|
4396
|
+
"libs/core/src/lib/npm-publish.ts"() {
|
|
4397
|
+
"use strict";
|
|
4398
|
+
import_package_json = require("@npmcli/package-json");
|
|
4399
|
+
import_fs_extra5 = __toESM(require("fs-extra"));
|
|
4400
|
+
import_libnpmpublish = require("libnpmpublish");
|
|
4401
|
+
import_npm_package_arg6 = __toESM(require("npm-package-arg"));
|
|
4402
|
+
init_npmlog();
|
|
4403
|
+
init_oidc();
|
|
4404
|
+
init_otplease();
|
|
4405
|
+
init_run_lifecycle();
|
|
4406
|
+
}
|
|
4407
|
+
});
|
|
4408
|
+
|
|
4409
|
+
// libs/core/src/lib/npm-run-script.ts
|
|
4410
|
+
var childProcess9;
|
|
4411
|
+
var init_npm_run_script = __esm({
|
|
4412
|
+
"libs/core/src/lib/npm-run-script.ts"() {
|
|
4413
|
+
"use strict";
|
|
4414
|
+
init_get_npm_exec_opts();
|
|
4415
|
+
init_npmlog();
|
|
4416
|
+
childProcess9 = (init_src(), __toCommonJS(src_exports));
|
|
4417
|
+
}
|
|
4418
|
+
});
|
|
4419
|
+
|
|
4420
|
+
// libs/core/src/lib/output.ts
|
|
4421
|
+
var init_output = __esm({
|
|
4422
|
+
"libs/core/src/lib/output.ts"() {
|
|
4423
|
+
"use strict";
|
|
4424
|
+
init_npmlog();
|
|
4425
|
+
}
|
|
4426
|
+
});
|
|
4427
|
+
|
|
4428
|
+
// libs/core/src/lib/get-packed.ts
|
|
4429
|
+
var import_fs_extra6, import_ssri, tar;
|
|
4430
|
+
var init_get_packed = __esm({
|
|
4431
|
+
"libs/core/src/lib/get-packed.ts"() {
|
|
4432
|
+
"use strict";
|
|
4433
|
+
import_fs_extra6 = __toESM(require("fs-extra"));
|
|
4434
|
+
import_ssri = __toESM(require("ssri"));
|
|
4435
|
+
tar = __toESM(require("tar"));
|
|
4436
|
+
}
|
|
4437
|
+
});
|
|
4438
|
+
|
|
4439
|
+
// libs/core/src/lib/temp-write.ts
|
|
4440
|
+
async function tempWrite(fileContent, filePath) {
|
|
4441
|
+
const tempPath = tempfile(filePath);
|
|
4442
|
+
const write = (0, import_is_stream.default)(fileContent) ? writeStream : writeFileP;
|
|
4443
|
+
await (0, import_make_dir.default)(import_path8.default.dirname(tempPath));
|
|
4444
|
+
await write(tempPath, fileContent);
|
|
4445
|
+
return tempPath;
|
|
4446
|
+
}
|
|
4447
|
+
var import_node_fs, import_is_stream, import_make_dir, import_path8, import_temp_dir, import_util, uuid, writeFileP, tempfile, writeStream;
|
|
4448
|
+
var init_temp_write = __esm({
|
|
4449
|
+
"libs/core/src/lib/temp-write.ts"() {
|
|
4450
|
+
"use strict";
|
|
4451
|
+
import_node_fs = __toESM(require("node:fs"));
|
|
4452
|
+
import_is_stream = __toESM(require("is-stream"));
|
|
4453
|
+
import_make_dir = __toESM(require("make-dir"));
|
|
4454
|
+
import_path8 = __toESM(require("path"));
|
|
4455
|
+
import_temp_dir = __toESM(require("temp-dir"));
|
|
4456
|
+
import_util = require("util");
|
|
4457
|
+
uuid = __toESM(require("uuid"));
|
|
4458
|
+
writeFileP = (0, import_util.promisify)(import_node_fs.default.writeFile);
|
|
4459
|
+
tempfile = (filePath) => import_path8.default.join(import_temp_dir.default, uuid.v4(), filePath || "");
|
|
4460
|
+
writeStream = async (filePath, fileContent) => new Promise((resolve2, reject) => {
|
|
4461
|
+
const writable = import_node_fs.default.createWriteStream(filePath);
|
|
4462
|
+
fileContent.on("error", (error) => {
|
|
4463
|
+
reject(error);
|
|
4464
|
+
fileContent.unpipe(writable);
|
|
4465
|
+
writable.end();
|
|
4466
|
+
}).pipe(writable).on("error", reject).on("finish", resolve2);
|
|
4467
|
+
});
|
|
4468
|
+
tempWrite.sync = (fileContent, filePath) => {
|
|
4469
|
+
const tempPath = tempfile(filePath);
|
|
4470
|
+
import_make_dir.default.sync(import_path8.default.dirname(tempPath));
|
|
4471
|
+
import_node_fs.default.writeFileSync(tempPath, fileContent);
|
|
4472
|
+
return tempPath;
|
|
4473
|
+
};
|
|
4474
|
+
}
|
|
4475
|
+
});
|
|
4476
|
+
|
|
4477
|
+
// libs/core/src/lib/pack-directory.ts
|
|
4478
|
+
var import_arborist, import_npm_packlist, tar2;
|
|
4479
|
+
var init_pack_directory = __esm({
|
|
4480
|
+
"libs/core/src/lib/pack-directory.ts"() {
|
|
4481
|
+
"use strict";
|
|
4482
|
+
import_arborist = __toESM(require("@npmcli/arborist"));
|
|
4483
|
+
import_npm_packlist = __toESM(require("npm-packlist"));
|
|
4484
|
+
tar2 = __toESM(require("tar"));
|
|
4485
|
+
init_get_packed();
|
|
4486
|
+
init_npmlog();
|
|
4487
|
+
init_package();
|
|
4488
|
+
init_run_lifecycle();
|
|
4489
|
+
init_temp_write();
|
|
4490
|
+
}
|
|
4491
|
+
});
|
|
4492
|
+
|
|
4493
|
+
// libs/core/src/lib/profiler.ts
|
|
4494
|
+
var import_fs_extra7, import_upath;
|
|
4495
|
+
var init_profiler = __esm({
|
|
4496
|
+
"libs/core/src/lib/profiler.ts"() {
|
|
4497
|
+
"use strict";
|
|
4498
|
+
import_fs_extra7 = __toESM(require("fs-extra"));
|
|
4499
|
+
import_upath = __toESM(require("upath"));
|
|
4500
|
+
init_npmlog();
|
|
4501
|
+
}
|
|
4502
|
+
});
|
|
4503
|
+
|
|
4504
|
+
// libs/core/src/lib/pulse-till-done.ts
|
|
4505
|
+
var init_pulse_till_done = __esm({
|
|
4506
|
+
"libs/core/src/lib/pulse-till-done.ts"() {
|
|
4507
|
+
"use strict";
|
|
4508
|
+
init_npmlog();
|
|
4509
|
+
}
|
|
4510
|
+
});
|
|
4511
|
+
|
|
4512
|
+
// libs/core/src/lib/rimraf-dir.ts
|
|
4513
|
+
var import_rimraf;
|
|
4514
|
+
var init_rimraf_dir = __esm({
|
|
4515
|
+
"libs/core/src/lib/rimraf-dir.ts"() {
|
|
4516
|
+
"use strict";
|
|
4517
|
+
import_rimraf = require("rimraf");
|
|
4518
|
+
init_npmlog();
|
|
4519
|
+
}
|
|
4520
|
+
});
|
|
4521
|
+
|
|
4522
|
+
// libs/core/src/lib/run-projects-topologically.ts
|
|
4523
|
+
var import_p_queue2;
|
|
4524
|
+
var init_run_projects_topologically = __esm({
|
|
4525
|
+
"libs/core/src/lib/run-projects-topologically.ts"() {
|
|
4526
|
+
"use strict";
|
|
4527
|
+
import_p_queue2 = __toESM(require("p-queue"));
|
|
4528
|
+
init_cycles();
|
|
4529
|
+
init_validation_error();
|
|
4530
|
+
}
|
|
4531
|
+
});
|
|
4532
|
+
|
|
4533
|
+
// libs/core/src/lib/scm-clients/github/create-github-client.ts
|
|
4534
|
+
function createGitHubClient() {
|
|
4535
|
+
npmlog_default.silly("createGitHubClient");
|
|
4536
|
+
const { GH_TOKEN, GHE_API_URL, GHE_VERSION } = process.env;
|
|
4537
|
+
if (!GH_TOKEN) {
|
|
4538
|
+
throw new ValidationError(
|
|
4539
|
+
"",
|
|
4540
|
+
`A GH_TOKEN environment variable is required when "createRelease" is set to "github"`
|
|
4541
|
+
);
|
|
4542
|
+
}
|
|
4543
|
+
if (GHE_VERSION) {
|
|
4544
|
+
import_rest.Octokit.plugin(require(`@octokit/plugin-enterprise-rest/ghe-${GHE_VERSION}`));
|
|
4545
|
+
}
|
|
4546
|
+
const options = {
|
|
4547
|
+
auth: `token ${GH_TOKEN}`
|
|
4548
|
+
};
|
|
4549
|
+
if (GHE_API_URL) {
|
|
4550
|
+
options.baseUrl = GHE_API_URL;
|
|
4551
|
+
}
|
|
4552
|
+
return new import_rest.Octokit(options);
|
|
4553
|
+
}
|
|
4554
|
+
function parseGitRepo(remote = "origin", opts) {
|
|
4555
|
+
npmlog_default.silly("parseGitRepo");
|
|
4556
|
+
const args = ["config", "--get", `remote.${remote}.url`];
|
|
4557
|
+
npmlog_default.verbose("git", args);
|
|
4558
|
+
const url2 = childProcess10.execSync("git", args, opts);
|
|
4559
|
+
if (!url2) {
|
|
4560
|
+
throw new ValidationError("", `Git remote URL could not be found using "${remote}".`);
|
|
4561
|
+
}
|
|
4562
|
+
return (0, import_git_url_parse.default)(url2);
|
|
4563
|
+
}
|
|
4564
|
+
var import_rest, import_git_url_parse, childProcess10;
|
|
4565
|
+
var init_create_github_client = __esm({
|
|
4566
|
+
"libs/core/src/lib/scm-clients/github/create-github-client.ts"() {
|
|
4567
|
+
"use strict";
|
|
4568
|
+
import_rest = require("@octokit/rest");
|
|
4569
|
+
import_git_url_parse = __toESM(require("git-url-parse"));
|
|
4570
|
+
init_npmlog();
|
|
4571
|
+
init_validation_error();
|
|
4572
|
+
childProcess10 = (init_src(), __toCommonJS(src_exports));
|
|
4573
|
+
}
|
|
4574
|
+
});
|
|
4575
|
+
|
|
4576
|
+
// libs/core/src/lib/scm-clients/gitlab/gitlab-client.ts
|
|
4577
|
+
var import_make_fetch_happen2, import_path9, GitLabClient;
|
|
4578
|
+
var init_gitlab_client = __esm({
|
|
4579
|
+
"libs/core/src/lib/scm-clients/gitlab/gitlab-client.ts"() {
|
|
4580
|
+
"use strict";
|
|
4581
|
+
import_make_fetch_happen2 = __toESM(require("make-fetch-happen"));
|
|
4582
|
+
import_path9 = __toESM(require("path"));
|
|
4583
|
+
init_npmlog();
|
|
4584
|
+
GitLabClient = class {
|
|
4585
|
+
constructor(token, baseUrl = "https://gitlab.com/api/v4") {
|
|
4586
|
+
this.token = token;
|
|
4587
|
+
this.baseUrl = baseUrl;
|
|
4588
|
+
}
|
|
4589
|
+
// TODO: refactor based on TS feedback
|
|
4590
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4591
|
+
// @ts-ignore
|
|
4592
|
+
createRelease({ owner, repo, name, tag_name: tagName, body }) {
|
|
4593
|
+
const releasesUrl = this.releasesUrl(owner, repo, "releases");
|
|
4594
|
+
npmlog_default.silly("Requesting GitLab releases", releasesUrl);
|
|
4595
|
+
return (0, import_make_fetch_happen2.default)(releasesUrl, {
|
|
4596
|
+
method: "post",
|
|
4597
|
+
body: JSON.stringify({ name, tag_name: tagName, description: body }),
|
|
4598
|
+
headers: {
|
|
4599
|
+
"PRIVATE-TOKEN": this.token,
|
|
4600
|
+
"Content-Type": "application/json"
|
|
4601
|
+
}
|
|
4602
|
+
}).then(({ ok, status, statusText }) => {
|
|
4603
|
+
if (!ok) {
|
|
4604
|
+
npmlog_default.error("gitlab", `Failed to create release
|
|
4605
|
+
Request returned ${status} ${statusText}`);
|
|
4606
|
+
} else {
|
|
4607
|
+
npmlog_default.silly("gitlab", "Created release successfully.");
|
|
4608
|
+
}
|
|
4609
|
+
});
|
|
4610
|
+
}
|
|
4611
|
+
releasesUrl(namespace, project) {
|
|
4612
|
+
return new URL(
|
|
4613
|
+
`${this.baseUrl}/${import_path9.default.join("projects", encodeURIComponent(`${namespace}/${project}`), "releases")}`
|
|
4614
|
+
).toString();
|
|
4615
|
+
}
|
|
4616
|
+
};
|
|
4617
|
+
}
|
|
4618
|
+
});
|
|
4619
|
+
|
|
4620
|
+
// libs/core/src/lib/scm-clients/gitlab/create-gitlab-client.ts
|
|
4621
|
+
function OcktokitAdapter(client) {
|
|
4622
|
+
return { repos: { createRelease: client.createRelease.bind(client) } };
|
|
4623
|
+
}
|
|
4624
|
+
function createGitLabClient() {
|
|
4625
|
+
const { GL_API_URL, GL_TOKEN } = process.env;
|
|
4626
|
+
npmlog_default.silly("Creating a GitLab client...");
|
|
4627
|
+
if (!GL_TOKEN) {
|
|
4628
|
+
throw new Error("A GL_TOKEN environment variable is required.");
|
|
4629
|
+
}
|
|
4630
|
+
const client = new GitLabClient(GL_TOKEN, GL_API_URL);
|
|
4631
|
+
return OcktokitAdapter(client);
|
|
4632
|
+
}
|
|
4633
|
+
var init_create_gitlab_client = __esm({
|
|
4634
|
+
"libs/core/src/lib/scm-clients/gitlab/create-gitlab-client.ts"() {
|
|
4635
|
+
"use strict";
|
|
4636
|
+
init_npmlog();
|
|
4637
|
+
init_gitlab_client();
|
|
4638
|
+
}
|
|
4639
|
+
});
|
|
4640
|
+
|
|
4641
|
+
// libs/core/src/lib/scm-clients/index.ts
|
|
4642
|
+
var init_scm_clients = __esm({
|
|
4643
|
+
"libs/core/src/lib/scm-clients/index.ts"() {
|
|
4644
|
+
"use strict";
|
|
4645
|
+
init_create_github_client();
|
|
4646
|
+
init_create_gitlab_client();
|
|
4647
|
+
}
|
|
4648
|
+
});
|
|
4649
|
+
|
|
4650
|
+
// libs/core/src/lib/timer.ts
|
|
4651
|
+
var init_timer = __esm({
|
|
4652
|
+
"libs/core/src/lib/timer.ts"() {
|
|
4653
|
+
"use strict";
|
|
4654
|
+
}
|
|
4655
|
+
});
|
|
4656
|
+
|
|
4657
|
+
// libs/core/src/lib/npm-dist-tag.ts
|
|
4658
|
+
var npm_dist_tag_exports = {};
|
|
4659
|
+
__export(npm_dist_tag_exports, {
|
|
4660
|
+
add: () => add,
|
|
4661
|
+
list: () => list2,
|
|
4662
|
+
remove: () => remove
|
|
4663
|
+
});
|
|
4664
|
+
function add(spec, tag, options, otpCache) {
|
|
4665
|
+
const opts = {
|
|
4666
|
+
log: npmlog_default,
|
|
4667
|
+
...options,
|
|
4668
|
+
spec: (0, import_npm_package_arg7.default)(spec)
|
|
4669
|
+
};
|
|
4670
|
+
const cleanTag = (tag || opts.defaultTag || opts.tag).trim();
|
|
4671
|
+
const { name, rawSpec: version } = opts.spec;
|
|
4672
|
+
opts.log.verbose("dist-tag", `adding "${cleanTag}" to ${name}@${version}`);
|
|
4673
|
+
if (opts.dryRun) {
|
|
4674
|
+
opts.log.silly("dist-tag", "dry-run configured, bailing now");
|
|
4675
|
+
return Promise.resolve();
|
|
4676
|
+
}
|
|
4677
|
+
return fetchTags(opts).then((tags) => {
|
|
4678
|
+
if (tags[cleanTag] === version) {
|
|
4679
|
+
opts.log.warn("dist-tag", `${name}@${cleanTag} already set to ${version}`);
|
|
4680
|
+
return tags;
|
|
4681
|
+
}
|
|
4682
|
+
const uri = `/-/package/${opts.spec.escapedName}/dist-tags/${encodeURIComponent(cleanTag)}`;
|
|
4683
|
+
const payload = {
|
|
4684
|
+
...opts,
|
|
4685
|
+
method: "PUT",
|
|
4686
|
+
body: JSON.stringify(version),
|
|
4687
|
+
headers: {
|
|
4688
|
+
// cannot use fetch.json() due to HTTP 204 response,
|
|
4689
|
+
// so we manually set the required content-type
|
|
4690
|
+
"content-type": "application/json"
|
|
4691
|
+
},
|
|
4692
|
+
spec: opts.spec
|
|
4693
|
+
};
|
|
4694
|
+
return otplease((wrappedPayload) => (0, import_npm_registry_fetch2.default)(uri, wrappedPayload), payload, otpCache).then(() => {
|
|
4695
|
+
opts.log.verbose("dist-tag", `added "${cleanTag}" to ${name}@${version}`);
|
|
4696
|
+
tags[cleanTag] = version;
|
|
4697
|
+
return tags;
|
|
4698
|
+
});
|
|
4699
|
+
});
|
|
4700
|
+
}
|
|
4701
|
+
function remove(spec, tag, options, otpCache) {
|
|
4702
|
+
const opts = {
|
|
4703
|
+
log: npmlog_default,
|
|
4704
|
+
...options,
|
|
4705
|
+
spec: (0, import_npm_package_arg7.default)(spec)
|
|
4706
|
+
};
|
|
4707
|
+
opts.log.verbose("dist-tag", `removing "${tag}" from ${opts.spec.name}`);
|
|
4708
|
+
if (opts.dryRun) {
|
|
4709
|
+
opts.log.silly("dist-tag", "dry-run configured, bailing now");
|
|
4710
|
+
return Promise.resolve();
|
|
4711
|
+
}
|
|
4712
|
+
return fetchTags(opts).then((tags) => {
|
|
4713
|
+
const version = tags[tag];
|
|
4714
|
+
if (!version) {
|
|
4715
|
+
opts.log.info("dist-tag", `"${tag}" is not a dist-tag on ${opts.spec.name}`);
|
|
4716
|
+
return tags;
|
|
4717
|
+
}
|
|
4718
|
+
const uri = `/-/package/${opts.spec.escapedName}/dist-tags/${encodeURIComponent(tag)}`;
|
|
4719
|
+
const payload = {
|
|
4720
|
+
...opts,
|
|
4721
|
+
method: "DELETE",
|
|
4722
|
+
spec: opts.spec
|
|
4723
|
+
};
|
|
4724
|
+
return otplease((wrappedPayload) => (0, import_npm_registry_fetch2.default)(uri, wrappedPayload), payload, otpCache).then(() => {
|
|
4725
|
+
opts.log.verbose("dist-tag", `removed "${tag}" from ${opts.spec.name}@${version}`);
|
|
4726
|
+
delete tags[tag];
|
|
4727
|
+
return tags;
|
|
4728
|
+
});
|
|
4729
|
+
});
|
|
4730
|
+
}
|
|
4731
|
+
function list2(spec, options) {
|
|
4732
|
+
const opts = {
|
|
4733
|
+
log: npmlog_default,
|
|
4734
|
+
...options,
|
|
4735
|
+
spec: (0, import_npm_package_arg7.default)(spec)
|
|
4736
|
+
};
|
|
4737
|
+
if (opts.dryRun) {
|
|
4738
|
+
opts.log.silly("dist-tag", "dry-run configured, bailing now");
|
|
4739
|
+
return Promise.resolve();
|
|
4740
|
+
}
|
|
4741
|
+
return fetchTags(opts);
|
|
4742
|
+
}
|
|
4743
|
+
function fetchTags(opts) {
|
|
4744
|
+
return import_npm_registry_fetch2.default.json(`/-/package/${opts.spec.escapedName}/dist-tags`, {
|
|
4745
|
+
...opts,
|
|
4746
|
+
preferOnline: true,
|
|
4747
|
+
spec: opts.spec
|
|
4748
|
+
}).then((data) => {
|
|
4749
|
+
if (data && typeof data === "object") {
|
|
4750
|
+
delete data["_etag"];
|
|
4751
|
+
}
|
|
4752
|
+
return data || {};
|
|
4753
|
+
});
|
|
4754
|
+
}
|
|
4755
|
+
var import_npm_package_arg7, import_npm_registry_fetch2;
|
|
4756
|
+
var init_npm_dist_tag = __esm({
|
|
4757
|
+
"libs/core/src/lib/npm-dist-tag.ts"() {
|
|
4758
|
+
"use strict";
|
|
4759
|
+
import_npm_package_arg7 = __toESM(require("npm-package-arg"));
|
|
4760
|
+
import_npm_registry_fetch2 = __toESM(require("npm-registry-fetch"));
|
|
4761
|
+
init_npmlog();
|
|
4762
|
+
init_otplease();
|
|
4763
|
+
}
|
|
4764
|
+
});
|
|
4765
|
+
|
|
4766
|
+
// libs/core/src/index.ts
|
|
4767
|
+
var npmConf2, npmDistTag;
|
|
4768
|
+
var init_src2 = __esm({
|
|
4769
|
+
"libs/core/src/index.ts"() {
|
|
4770
|
+
"use strict";
|
|
4771
|
+
init_add_dependencies();
|
|
4772
|
+
init_add_dependents();
|
|
4773
|
+
init_check_working_tree();
|
|
4774
|
+
init_cli();
|
|
4775
|
+
init_collect_updates();
|
|
4776
|
+
init_command();
|
|
4777
|
+
init_detect_projects();
|
|
4778
|
+
init_is_git_initialized();
|
|
4779
|
+
init_conventional_commits();
|
|
4780
|
+
init_corepack();
|
|
4781
|
+
init_describe_ref();
|
|
4782
|
+
init_filter_options();
|
|
4783
|
+
init_filter_projects();
|
|
4784
|
+
init_get_package_manifest_path();
|
|
4785
|
+
init_get_packages_for_option();
|
|
4786
|
+
init_git_checkout();
|
|
4787
|
+
init_has_npm_version();
|
|
4788
|
+
init_listable_format_projects();
|
|
4789
|
+
init_listable_options();
|
|
4790
|
+
init_log_packed();
|
|
4791
|
+
init_conf();
|
|
4792
|
+
init_npm_install();
|
|
4793
|
+
init_npm_publish();
|
|
4794
|
+
init_npm_run_script();
|
|
4795
|
+
init_otplease();
|
|
4796
|
+
init_output();
|
|
4797
|
+
init_pack_directory();
|
|
4798
|
+
init_package();
|
|
4799
|
+
init_prerelease_id_from_version();
|
|
4800
|
+
init_profiler();
|
|
4801
|
+
init_project();
|
|
4802
|
+
init_project_graph_with_packages();
|
|
4803
|
+
init_prompt();
|
|
4804
|
+
init_pulse_till_done();
|
|
4805
|
+
init_rimraf_dir();
|
|
4806
|
+
init_run_lifecycle();
|
|
4807
|
+
init_run_projects_topologically();
|
|
4808
|
+
init_scm_clients();
|
|
4809
|
+
init_temp_write();
|
|
4810
|
+
init_timer();
|
|
4811
|
+
init_toposort_projects();
|
|
4812
|
+
init_validation_error();
|
|
4813
|
+
init_npmlog();
|
|
4814
|
+
npmConf2 = require_npm_conf();
|
|
4815
|
+
npmDistTag = (init_npm_dist_tag(), __toCommonJS(npm_dist_tag_exports));
|
|
4816
|
+
}
|
|
4817
|
+
});
|
|
4818
|
+
|
|
4819
|
+
// libs/commands/version/src/lib/create-release.ts
|
|
4820
|
+
var create_release_exports = {};
|
|
4821
|
+
__export(create_release_exports, {
|
|
4822
|
+
createRelease: () => createRelease,
|
|
4823
|
+
createReleaseClient: () => createReleaseClient,
|
|
4824
|
+
truncateReleaseBody: () => truncateReleaseBody
|
|
4825
|
+
});
|
|
4826
|
+
function truncateReleaseBody(body, type) {
|
|
4827
|
+
let maxReleaseBodyLength;
|
|
4828
|
+
switch (type) {
|
|
4829
|
+
case "gitlab":
|
|
4830
|
+
maxReleaseBodyLength = 1e6;
|
|
4831
|
+
break;
|
|
4832
|
+
case "github":
|
|
4833
|
+
maxReleaseBodyLength = 125e3;
|
|
4834
|
+
break;
|
|
4835
|
+
default:
|
|
4836
|
+
return body;
|
|
4837
|
+
}
|
|
4838
|
+
if (body.length > maxReleaseBodyLength) {
|
|
4839
|
+
const ellipsis = "...";
|
|
4840
|
+
return body.slice(0, maxReleaseBodyLength - ellipsis.length) + ellipsis;
|
|
4841
|
+
}
|
|
4842
|
+
return body;
|
|
4843
|
+
}
|
|
4844
|
+
function createReleaseClient(type) {
|
|
4845
|
+
switch (type) {
|
|
4846
|
+
case "gitlab":
|
|
4847
|
+
return createGitLabClient();
|
|
4848
|
+
case "github":
|
|
4849
|
+
return createGitHubClient();
|
|
4850
|
+
/* istanbul ignore next: guarded by yargs.choices() */
|
|
4851
|
+
default:
|
|
4852
|
+
throw new ValidationError("ERELEASE", "Invalid release client type");
|
|
4853
|
+
}
|
|
4854
|
+
}
|
|
4855
|
+
function createRelease(client, {
|
|
4856
|
+
type,
|
|
4857
|
+
tags,
|
|
4858
|
+
releaseNotes,
|
|
4859
|
+
tagVersionSeparator
|
|
4860
|
+
}, { gitRemote, execOpts }) {
|
|
4861
|
+
const repo = parseGitRepo(gitRemote, execOpts);
|
|
4862
|
+
return Promise.all(
|
|
4863
|
+
releaseNotes.map(({ notes, name }) => {
|
|
4864
|
+
const tag = name === "fixed" ? tags[0] : tags.find((t) => t.startsWith(`${name}${tagVersionSeparator}`));
|
|
4865
|
+
if (!tag) {
|
|
4866
|
+
return Promise.resolve();
|
|
4867
|
+
}
|
|
4868
|
+
const prereleaseParts = import_semver5.default.prerelease(tag.replace(`${name}${tagVersionSeparator}`, "")) || [];
|
|
4869
|
+
const body = truncateReleaseBody(notes, type);
|
|
4870
|
+
return client.repos.createRelease({
|
|
4871
|
+
owner: repo.owner,
|
|
4872
|
+
repo: repo.name,
|
|
4873
|
+
tag_name: tag,
|
|
4874
|
+
name: tag,
|
|
4875
|
+
body,
|
|
4876
|
+
draft: false,
|
|
4877
|
+
prerelease: prereleaseParts.length > 0
|
|
4878
|
+
});
|
|
4879
|
+
})
|
|
4880
|
+
);
|
|
4881
|
+
}
|
|
4882
|
+
var import_semver5;
|
|
4883
|
+
var init_create_release = __esm({
|
|
4884
|
+
"libs/commands/version/src/lib/create-release.ts"() {
|
|
4885
|
+
"use strict";
|
|
4886
|
+
init_src2();
|
|
4887
|
+
import_semver5 = __toESM(require("semver"));
|
|
4888
|
+
}
|
|
4889
|
+
});
|
|
4890
|
+
|
|
4891
|
+
// packages/lerna/src/commands/version/lib/create-release.ts
|
|
4892
|
+
module.exports = (init_create_release(), __toCommonJS(create_release_exports));
|