From e369b98818435ffde7552674a5434991947e39b9 Mon Sep 17 00:00:00 2001 From: Erick Zhao Date: Thu, 19 Mar 2026 20:24:55 -0700 Subject: [PATCH 1/8] build: patch out lerna for verdaccio publish --- .../patches/lerna-npm-9.0.0-652834287a.patch | 103 ++++++++++++++++++ tools/verdaccio/spawn-verdaccio.ts | 1 + yarn.lock | 91 +++++++++++++++- 3 files changed, 193 insertions(+), 2 deletions(-) create mode 100644 .yarn/patches/lerna-npm-9.0.0-652834287a.patch diff --git a/.yarn/patches/lerna-npm-9.0.0-652834287a.patch b/.yarn/patches/lerna-npm-9.0.0-652834287a.patch new file mode 100644 index 0000000000..30fe66ff3e --- /dev/null +++ b/.yarn/patches/lerna-npm-9.0.0-652834287a.patch @@ -0,0 +1,103 @@ +# Adds --skip-check-working-tree flag to `lerna publish` so that +# tools/verdaccio/spawn-verdaccio.ts can publish to a local registry +# with uncommitted changes. See https://github.com/lerna/lerna/issues/2329 +diff --git a/dist/commands/publish/command.js b/dist/commands/publish/command.js +index 81ba8ac28f0e3512df2e62144c5b13f1e7405a20..a3b7b493695f581c5e351b6cd9f7fefe7102aaed 100644 +--- a/dist/commands/publish/command.js ++++ b/dist/commands/publish/command.js +@@ -7014,7 +7014,9 @@ var require_src = __commonJS({ + this.runRootLifecycle = /^(pre|post)?version$/.test(process.env.npm_lifecycle_event) ? (stage) => { + this.logger.warn("lifecycle", "Skipping root %j because it has already been called", stage); + } : (stage) => this.runPackageLifecycle(this.project.manifest, stage); +- if (this.commitAndTag && this.gitOpts.amend !== true) { ++ if (this.options.skipCheckWorkingTree) { ++ this.logger.warn("version", "Skipping working tree validation, proceed at your own risk"); ++ } else if (this.commitAndTag && this.gitOpts.amend !== true) { + const { forcePublish, conventionalCommits, conventionalGraduate } = this.options; + const checkUncommittedOnly = forcePublish || conventionalCommits && conventionalGraduate; + const check = checkUncommittedOnly ? throwIfUncommitted : checkWorkingTree; +@@ -8508,6 +8510,10 @@ var require_src2 = __commonJS({ + } + } + verifyWorkingTreeClean() { ++ if (this.options.skipCheckWorkingTree) { ++ this.logger.warn("publish", "Skipping working tree check, proceed at your own risk"); ++ return Promise.resolve(); ++ } + return describeRef(this.execOpts).then(throwIfUncommitted); + } + async detectFromGit() { +@@ -9215,6 +9221,10 @@ var require_command2 = __commonJS({ + "include-private": { + describe: "Include specified private packages when publishing by temporarily removing the private property from the package manifest. This should only be used for testing private packages that will become public. Private packages should not usually be published. See the npm docs for details (https://docs.npmjs.com/cli/v9/configuring-npm/package-json#private).", + type: "array" ++ }, ++ "skip-check-working-tree": { ++ describe: "Skip the check for uncommitted changes in the working tree before publishing.", ++ type: "boolean" + } + }; + composeVersionOptions(yargs2); +diff --git a/dist/commands/publish/index.js b/dist/commands/publish/index.js +index d0f1eafacb2336d387b43eb1d5a14bce636a3749..8ce1411fcd9b0d6aac988da7ff2ee699228c7868 100644 +--- a/dist/commands/publish/index.js ++++ b/dist/commands/publish/index.js +@@ -7468,7 +7468,9 @@ var require_src = __commonJS({ + this.runRootLifecycle = /^(pre|post)?version$/.test(process.env.npm_lifecycle_event) ? (stage) => { + this.logger.warn("lifecycle", "Skipping root %j because it has already been called", stage); + } : (stage) => this.runPackageLifecycle(this.project.manifest, stage); +- if (this.commitAndTag && this.gitOpts.amend !== true) { ++ if (this.options.skipCheckWorkingTree) { ++ this.logger.warn("version", "Skipping working tree validation, proceed at your own risk"); ++ } else if (this.commitAndTag && this.gitOpts.amend !== true) { + const { forcePublish, conventionalCommits, conventionalGraduate } = this.options; + const checkUncommittedOnly = forcePublish || conventionalCommits && conventionalGraduate; + const check = checkUncommittedOnly ? throwIfUncommitted : checkWorkingTree; +@@ -8191,6 +8193,10 @@ var require_src2 = __commonJS({ + } + } + verifyWorkingTreeClean() { ++ if (this.options.skipCheckWorkingTree) { ++ this.logger.warn("publish", "Skipping working tree check, proceed at your own risk"); ++ return Promise.resolve(); ++ } + return describeRef(this.execOpts).then(throwIfUncommitted); + } + async detectFromGit() { +diff --git a/dist/index.js b/dist/index.js +index 0860a73516147cec14807f56e381583212c9ccb1..0b4871926fbccc74437f7932cf9893e18898e263 100644 +--- a/dist/index.js ++++ b/dist/index.js +@@ -10018,7 +10018,9 @@ var require_src2 = __commonJS({ + this.runRootLifecycle = /^(pre|post)?version$/.test(process.env.npm_lifecycle_event) ? (stage) => { + this.logger.warn("lifecycle", "Skipping root %j because it has already been called", stage); + } : (stage) => this.runPackageLifecycle(this.project.manifest, stage); +- if (this.commitAndTag && this.gitOpts.amend !== true) { ++ if (this.options.skipCheckWorkingTree) { ++ this.logger.warn("version", "Skipping working tree validation, proceed at your own risk"); ++ } else if (this.commitAndTag && this.gitOpts.amend !== true) { + const { forcePublish, conventionalCommits, conventionalGraduate } = this.options; + const checkUncommittedOnly = forcePublish || conventionalCommits && conventionalGraduate; + const check = checkUncommittedOnly ? throwIfUncommitted : checkWorkingTree; +@@ -11512,6 +11514,10 @@ var require_src3 = __commonJS({ + } + } + verifyWorkingTreeClean() { ++ if (this.options.skipCheckWorkingTree) { ++ this.logger.warn("publish", "Skipping working tree check, proceed at your own risk"); ++ return Promise.resolve(); ++ } + return describeRef(this.execOpts).then(throwIfUncommitted); + } + async detectFromGit() { +@@ -12219,6 +12225,10 @@ var require_command10 = __commonJS({ + "include-private": { + describe: "Include specified private packages when publishing by temporarily removing the private property from the package manifest. This should only be used for testing private packages that will become public. Private packages should not usually be published. See the npm docs for details (https://docs.npmjs.com/cli/v9/configuring-npm/package-json#private).", + type: "array" ++ }, ++ "skip-check-working-tree": { ++ describe: "Skip the check for uncommitted changes in the working tree before publishing.", ++ type: "boolean" + } + }; + composeVersionOptions(yargs2); diff --git a/tools/verdaccio/spawn-verdaccio.ts b/tools/verdaccio/spawn-verdaccio.ts index fedeff7818..f8f7279e09 100644 --- a/tools/verdaccio/spawn-verdaccio.ts +++ b/tools/verdaccio/spawn-verdaccio.ts @@ -118,6 +118,7 @@ async function publishPackages(): Promise { '--yes', '--no-git-tag-version', '--no-push', + '--skip-check-working-tree', ], { cwd: FORGE_ROOT_DIR, diff --git a/yarn.lock b/yarn.lock index a5ef27b6de..bf3e6160be 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8263,7 +8263,7 @@ __metadata: html-webpack-plugin: "npm:^5.5.3" husky: "npm:^7.0.1" jiti: "npm:^2.4.2" - lerna: "npm:^9.0.0" + lerna: "patch:lerna@npm%3A9.0.0#~/.yarn/patches/lerna-npm-9.0.0-652834287a.patch" lint-staged: "npm:^12.1.7" listr2: "npm:^7.0.2" lodash-es: "npm:^4.17.21" @@ -12505,7 +12505,7 @@ __metadata: languageName: node linkType: hard -"lerna@npm:^9.0.0": +"lerna@npm:9.0.0": version: 9.0.0 resolution: "lerna@npm:9.0.0" dependencies: @@ -12592,6 +12592,93 @@ __metadata: languageName: node linkType: hard +"lerna@patch:lerna@npm%3A9.0.0#~/.yarn/patches/lerna-npm-9.0.0-652834287a.patch": + version: 9.0.0 + resolution: "lerna@patch:lerna@npm%3A9.0.0#~/.yarn/patches/lerna-npm-9.0.0-652834287a.patch::version=9.0.0&hash=39199f" + dependencies: + "@lerna/create": "npm:9.0.0" + "@npmcli/arborist": "npm:9.1.4" + "@npmcli/package-json": "npm:7.0.0" + "@npmcli/run-script": "npm:10.0.0" + "@nx/devkit": "npm:>=21.5.2 < 22.0.0" + "@octokit/plugin-enterprise-rest": "npm:6.0.1" + "@octokit/rest": "npm:20.1.2" + aproba: "npm:2.0.0" + byte-size: "npm:8.1.1" + chalk: "npm:4.1.0" + cmd-shim: "npm:6.0.3" + color-support: "npm:1.1.3" + columnify: "npm:1.6.0" + console-control-strings: "npm:^1.1.0" + conventional-changelog-angular: "npm:7.0.0" + conventional-changelog-core: "npm:5.0.1" + conventional-recommended-bump: "npm:7.0.1" + cosmiconfig: "npm:9.0.0" + dedent: "npm:1.5.3" + envinfo: "npm:7.13.0" + execa: "npm:5.0.0" + fs-extra: "npm:^11.2.0" + get-port: "npm:5.1.1" + get-stream: "npm:6.0.0" + git-url-parse: "npm:14.0.0" + glob-parent: "npm:6.0.2" + has-unicode: "npm:2.0.1" + import-local: "npm:3.1.0" + ini: "npm:^1.3.8" + init-package-json: "npm:8.2.2" + inquirer: "npm:12.9.6" + is-ci: "npm:3.0.1" + is-stream: "npm:2.0.0" + jest-diff: "npm:>=30.0.0 < 31" + js-yaml: "npm:4.1.0" + libnpmaccess: "npm:10.0.1" + libnpmpublish: "npm:11.1.0" + load-json-file: "npm:6.2.0" + make-dir: "npm:4.0.0" + make-fetch-happen: "npm:15.0.2" + minimatch: "npm:3.0.5" + multimatch: "npm:5.0.0" + npm-package-arg: "npm:13.0.0" + npm-packlist: "npm:10.0.1" + npm-registry-fetch: "npm:19.0.0" + nx: "npm:>=21.5.3 < 22.0.0" + p-map: "npm:4.0.0" + p-map-series: "npm:2.1.0" + p-pipe: "npm:3.1.0" + p-queue: "npm:6.6.2" + p-reduce: "npm:2.1.0" + p-waterfall: "npm:2.1.1" + pacote: "npm:21.0.1" + pify: "npm:5.0.0" + read-cmd-shim: "npm:4.0.0" + resolve-from: "npm:5.0.0" + rimraf: "npm:^4.4.1" + semver: "npm:7.7.2" + set-blocking: "npm:^2.0.0" + signal-exit: "npm:3.0.7" + slash: "npm:3.0.0" + ssri: "npm:12.0.0" + string-width: "npm:^4.2.3" + tar: "npm:6.2.1" + temp-dir: "npm:1.0.0" + through: "npm:2.3.8" + tinyglobby: "npm:0.2.12" + typescript: "npm:>=3 < 6" + upath: "npm:2.0.1" + uuid: "npm:^11.1.0" + validate-npm-package-license: "npm:3.0.4" + validate-npm-package-name: "npm:6.0.2" + wide-align: "npm:1.1.5" + write-file-atomic: "npm:5.0.1" + write-pkg: "npm:4.0.0" + yargs: "npm:17.7.2" + yargs-parser: "npm:21.1.1" + bin: + lerna: dist/cli.js + checksum: 10c0/ea556c3088533ed62fb76e0eb8a99772b4c6a08f3342d7de52842622a03f5f6c699fe6570f6630883ab8de7a2a924d4806b8327decce93f499fa508cdbb738ed + languageName: node + linkType: hard + "levn@npm:^0.4.1": version: 0.4.1 resolution: "levn@npm:0.4.1" From 4762b061e10038086a67f237a5904fd61b530d71 Mon Sep 17 00:00:00 2001 From: Erick Zhao Date: Thu, 19 Mar 2026 20:36:57 -0700 Subject: [PATCH 2/8] update lockfile --- yarn.lock | 1033 +++++++++++++++++++++++------------------------------ 1 file changed, 453 insertions(+), 580 deletions(-) diff --git a/yarn.lock b/yarn.lock index bf3e6160be..2c9cdd2cc3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2058,6 +2058,15 @@ __metadata: languageName: node linkType: hard +"@gar/promise-retry@npm:^1.0.0": + version: 1.0.2 + resolution: "@gar/promise-retry@npm:1.0.2" + dependencies: + retry: "npm:^0.13.1" + checksum: 10c0/748a84fb0ab962f7867966f21dc24d1872c53c1656dd3352320fe69ad3b2043f2dfdb3be024c7636ce4904c5ba1da22d0f3558e489c3de578f5bb520f062d0fd + languageName: node + linkType: hard + "@google-cloud/paginator@npm:^5.0.0": version: 5.0.0 resolution: "@google-cloud/paginator@npm:5.0.0" @@ -2775,81 +2784,6 @@ __metadata: languageName: node linkType: hard -"@lerna/create@npm:9.0.0": - version: 9.0.0 - resolution: "@lerna/create@npm:9.0.0" - dependencies: - "@npmcli/arborist": "npm:9.1.4" - "@npmcli/package-json": "npm:7.0.0" - "@npmcli/run-script": "npm:10.0.0" - "@nx/devkit": "npm:>=21.5.2 < 22.0.0" - "@octokit/plugin-enterprise-rest": "npm:6.0.1" - "@octokit/rest": "npm:20.1.2" - aproba: "npm:2.0.0" - byte-size: "npm:8.1.1" - chalk: "npm:4.1.0" - cmd-shim: "npm:6.0.3" - color-support: "npm:1.1.3" - columnify: "npm:1.6.0" - console-control-strings: "npm:^1.1.0" - conventional-changelog-core: "npm:5.0.1" - conventional-recommended-bump: "npm:7.0.1" - cosmiconfig: "npm:9.0.0" - dedent: "npm:1.5.3" - execa: "npm:5.0.0" - fs-extra: "npm:^11.2.0" - get-stream: "npm:6.0.0" - git-url-parse: "npm:14.0.0" - glob-parent: "npm:6.0.2" - has-unicode: "npm:2.0.1" - ini: "npm:^1.3.8" - init-package-json: "npm:8.2.2" - inquirer: "npm:12.9.6" - is-ci: "npm:3.0.1" - is-stream: "npm:2.0.0" - js-yaml: "npm:4.1.0" - libnpmpublish: "npm:11.1.0" - load-json-file: "npm:6.2.0" - make-dir: "npm:4.0.0" - make-fetch-happen: "npm:15.0.2" - minimatch: "npm:3.0.5" - multimatch: "npm:5.0.0" - npm-package-arg: "npm:13.0.0" - npm-packlist: "npm:10.0.1" - npm-registry-fetch: "npm:19.0.0" - nx: "npm:>=21.5.3 < 22.0.0" - p-map: "npm:4.0.0" - p-map-series: "npm:2.1.0" - p-queue: "npm:6.6.2" - p-reduce: "npm:^2.1.0" - pacote: "npm:21.0.1" - pify: "npm:5.0.0" - read-cmd-shim: "npm:4.0.0" - resolve-from: "npm:5.0.0" - rimraf: "npm:^4.4.1" - semver: "npm:7.7.2" - set-blocking: "npm:^2.0.0" - signal-exit: "npm:3.0.7" - slash: "npm:^3.0.0" - ssri: "npm:12.0.0" - string-width: "npm:^4.2.3" - tar: "npm:6.2.1" - temp-dir: "npm:1.0.0" - through: "npm:2.3.8" - tinyglobby: "npm:0.2.12" - upath: "npm:2.0.1" - uuid: "npm:^11.1.0" - validate-npm-package-license: "npm:3.0.4" - validate-npm-package-name: "npm:6.0.2" - wide-align: "npm:1.1.5" - write-file-atomic: "npm:5.0.1" - write-pkg: "npm:4.0.0" - yargs: "npm:17.7.2" - yargs-parser: "npm:21.1.1" - checksum: 10c0/0f574a25250702a887a7b733944e1866f03feca0524ae305691aa362a06fab172067cf6f5c94388197ba5d3d62100be66abe884b6449f8c634940da9ef247394 - languageName: node - linkType: hard - "@listr2/prompt-adapter-inquirer@npm:^2.0.22": version: 2.0.22 resolution: "@listr2/prompt-adapter-inquirer@npm:2.0.22" @@ -2985,47 +2919,46 @@ __metadata: languageName: node linkType: hard -"@npmcli/arborist@npm:9.1.4": - version: 9.1.4 - resolution: "@npmcli/arborist@npm:9.1.4" +"@npmcli/arborist@npm:9.1.6": + version: 9.1.6 + resolution: "@npmcli/arborist@npm:9.1.6" dependencies: "@isaacs/string-locale-compare": "npm:^1.1.0" "@npmcli/fs": "npm:^4.0.0" "@npmcli/installed-package-contents": "npm:^3.0.0" - "@npmcli/map-workspaces": "npm:^4.0.1" - "@npmcli/metavuln-calculator": "npm:^9.0.0" + "@npmcli/map-workspaces": "npm:^5.0.0" + "@npmcli/metavuln-calculator": "npm:^9.0.2" "@npmcli/name-from-folder": "npm:^3.0.0" "@npmcli/node-gyp": "npm:^4.0.0" - "@npmcli/package-json": "npm:^6.0.1" + "@npmcli/package-json": "npm:^7.0.0" "@npmcli/query": "npm:^4.0.0" "@npmcli/redact": "npm:^3.0.0" - "@npmcli/run-script": "npm:^9.0.1" + "@npmcli/run-script": "npm:^10.0.0" bin-links: "npm:^5.0.0" - cacache: "npm:^19.0.1" + cacache: "npm:^20.0.1" common-ancestor-path: "npm:^1.0.1" - hosted-git-info: "npm:^8.0.0" + hosted-git-info: "npm:^9.0.0" json-stringify-nice: "npm:^1.1.4" - lru-cache: "npm:^10.2.2" - minimatch: "npm:^9.0.4" + lru-cache: "npm:^11.2.1" + minimatch: "npm:^10.0.3" nopt: "npm:^8.0.0" npm-install-checks: "npm:^7.1.0" - npm-package-arg: "npm:^12.0.0" - npm-pick-manifest: "npm:^10.0.0" - npm-registry-fetch: "npm:^18.0.1" - pacote: "npm:^21.0.0" + npm-package-arg: "npm:^13.0.0" + npm-pick-manifest: "npm:^11.0.1" + npm-registry-fetch: "npm:^19.0.0" + pacote: "npm:^21.0.2" parse-conflict-json: "npm:^4.0.0" proc-log: "npm:^5.0.0" proggy: "npm:^3.0.0" promise-all-reject-late: "npm:^1.0.0" promise-call-limit: "npm:^3.0.1" - read-package-json-fast: "npm:^4.0.0" semver: "npm:^7.3.7" ssri: "npm:^12.0.0" treeverse: "npm:^3.0.0" walk-up-path: "npm:^4.0.0" bin: arborist: bin/index.js - checksum: 10c0/19d7aa69065bdd5acfc1c29cfd2266cc7763a90865d66a0b77d4f941d81f3255111f67a9204fddb7d5f7da9d5d66ebb67373b96df73a8cb7ed2b019589e38e48 + checksum: 10c0/359e2a278fda83e60bdfdc410c1d439753d8d390a475e934d31d3fd250a3f2b0693dc7c64f6e9ed9cc5bd0186b21b50c3fc1c5befc0c6ff4996d332477dbe1b1 languageName: node linkType: hard @@ -3082,28 +3015,40 @@ __metadata: languageName: node linkType: hard -"@npmcli/map-workspaces@npm:^4.0.1": - version: 4.0.2 - resolution: "@npmcli/map-workspaces@npm:4.0.2" +"@npmcli/installed-package-contents@npm:^4.0.0": + version: 4.0.0 + resolution: "@npmcli/installed-package-contents@npm:4.0.0" dependencies: - "@npmcli/name-from-folder": "npm:^3.0.0" - "@npmcli/package-json": "npm:^6.0.0" - glob: "npm:^10.2.2" - minimatch: "npm:^9.0.0" - checksum: 10c0/26af5e5271c52d0986228583218fa04fcea2e0e1052f0c50f5c7941bbfb7be487cc98c2e6732f0a3f515f6d9228d7dc04414f0471f40a33b748e2b4cbb350b86 + npm-bundled: "npm:^5.0.0" + npm-normalize-package-bin: "npm:^5.0.0" + bin: + installed-package-contents: bin/index.js + checksum: 10c0/297f32afc350e92c85981c1c793358af19e63c64d090f4e09997393fa2471f92da52317cb551356dc13594f2bdfad32d02c78bc2c664e2b7e0109d0d8713b39e languageName: node linkType: hard -"@npmcli/metavuln-calculator@npm:^9.0.0": - version: 9.0.2 - resolution: "@npmcli/metavuln-calculator@npm:9.0.2" +"@npmcli/map-workspaces@npm:^5.0.0": + version: 5.0.3 + resolution: "@npmcli/map-workspaces@npm:5.0.3" + dependencies: + "@npmcli/name-from-folder": "npm:^4.0.0" + "@npmcli/package-json": "npm:^7.0.0" + glob: "npm:^13.0.0" + minimatch: "npm:^10.0.3" + checksum: 10c0/975c3f94f9bc9e646b28ddabea2eebd11e6528241f7f7621cdfc083311c91b608a7b9647797e07a18bb8ce775e54a80d361800fffa3ced22803c5140f0a50553 + languageName: node + linkType: hard + +"@npmcli/metavuln-calculator@npm:^9.0.2": + version: 9.0.3 + resolution: "@npmcli/metavuln-calculator@npm:9.0.3" dependencies: cacache: "npm:^20.0.0" - json-parse-even-better-errors: "npm:^4.0.0" + json-parse-even-better-errors: "npm:^5.0.0" pacote: "npm:^21.0.0" - proc-log: "npm:^5.0.0" + proc-log: "npm:^6.0.0" semver: "npm:^7.3.5" - checksum: 10c0/67778cca70ad854f4b4b62a86d57becc5dab3ca1c477396bf1fde7cff161c32f30e266f33f1c6cf8cc42000b1899d2504dc84927c56169ed70c9b181433a522b + checksum: 10c0/cc5905788b0dbd2372beff690566ed917be8643b8c24352e669339f6ee66a6edf4a82ba22c7b88b8fa0c52589556c6aa4613a47825ab3727caee6ae8451ab09a languageName: node linkType: hard @@ -3114,6 +3059,13 @@ __metadata: languageName: node linkType: hard +"@npmcli/name-from-folder@npm:^4.0.0": + version: 4.0.0 + resolution: "@npmcli/name-from-folder@npm:4.0.0" + checksum: 10c0/edaeb4a4098f920e373cddd7f765347f1013e3a84e1cdb16da4b83144bc377fe7cd4fa37562596a53a9e46dfca381c2b8706c2661014921bc1bf710303dff713 + languageName: node + linkType: hard + "@npmcli/node-gyp@npm:^4.0.0": version: 4.0.0 resolution: "@npmcli/node-gyp@npm:4.0.0" @@ -3121,33 +3073,25 @@ __metadata: languageName: node linkType: hard -"@npmcli/package-json@npm:7.0.0": - version: 7.0.0 - resolution: "@npmcli/package-json@npm:7.0.0" - dependencies: - "@npmcli/git": "npm:^6.0.0" - glob: "npm:^11.0.3" - hosted-git-info: "npm:^9.0.0" - json-parse-even-better-errors: "npm:^4.0.0" - proc-log: "npm:^5.0.0" - semver: "npm:^7.5.3" - validate-npm-package-license: "npm:^3.0.4" - checksum: 10c0/bcb0e21cfa04b0daa640044261348db38a163cc25430a09522204e3286ae1388e5eab9c15847878fb4d4cfbd8c7883b4e887ea09b52ff3be18e5b775e01c63a9 +"@npmcli/node-gyp@npm:^5.0.0": + version: 5.0.0 + resolution: "@npmcli/node-gyp@npm:5.0.0" + checksum: 10c0/dc78219a848a30d26d46cd174816bdf21936aaee15469888cbd04433981ef866b35611275a1f94a31d68ea60cc18747d0d02430e4ce59f8a5c2423ec35b1bbed languageName: node linkType: hard -"@npmcli/package-json@npm:^6.0.0, @npmcli/package-json@npm:^6.0.1, @npmcli/package-json@npm:^6.2.0": - version: 6.2.0 - resolution: "@npmcli/package-json@npm:6.2.0" +"@npmcli/package-json@npm:7.0.2": + version: 7.0.2 + resolution: "@npmcli/package-json@npm:7.0.2" dependencies: - "@npmcli/git": "npm:^6.0.0" - glob: "npm:^10.2.2" - hosted-git-info: "npm:^8.0.0" - json-parse-even-better-errors: "npm:^4.0.0" - proc-log: "npm:^5.0.0" + "@npmcli/git": "npm:^7.0.0" + glob: "npm:^11.0.3" + hosted-git-info: "npm:^9.0.0" + json-parse-even-better-errors: "npm:^5.0.0" + proc-log: "npm:^6.0.0" semver: "npm:^7.5.3" validate-npm-package-license: "npm:^3.0.4" - checksum: 10c0/2bd8345a542a9ecfca9061614ccd191aac1c1b792a4b62a0f99e289280977ea6641897e449b6e206e5e78b1b3cc8fb822c70eb1df7d42763dba00cade80321c8 + checksum: 10c0/2901c648c80b4805c3c17ca30c76217858b348b20aab1ddf83b30240ed1d32257284545a9c78a8eb1c6d1a5dd7d5c61b430bfc5bc9ae409c989abafe54b6d4e3 languageName: node linkType: hard @@ -3175,6 +3119,15 @@ __metadata: languageName: node linkType: hard +"@npmcli/promise-spawn@npm:^9.0.0": + version: 9.0.1 + resolution: "@npmcli/promise-spawn@npm:9.0.1" + dependencies: + which: "npm:^6.0.0" + checksum: 10c0/361872192934bda684f590f140a2edd68add90d5936ca9a2e8792435447847adb59e249d5976950e20bbf213898c04da1b51b62fbc8f258b2fa8601af37fa0e2 + languageName: node + linkType: hard + "@npmcli/query@npm:^4.0.0": version: 4.0.1 resolution: "@npmcli/query@npm:4.0.1" @@ -3191,118 +3144,117 @@ __metadata: languageName: node linkType: hard -"@npmcli/run-script@npm:10.0.0, @npmcli/run-script@npm:^10.0.0": - version: 10.0.0 - resolution: "@npmcli/run-script@npm:10.0.0" +"@npmcli/run-script@npm:10.0.3": + version: 10.0.3 + resolution: "@npmcli/run-script@npm:10.0.3" dependencies: - "@npmcli/node-gyp": "npm:^4.0.0" + "@npmcli/node-gyp": "npm:^5.0.0" "@npmcli/package-json": "npm:^7.0.0" - "@npmcli/promise-spawn": "npm:^8.0.0" - node-gyp: "npm:^11.0.0" - proc-log: "npm:^5.0.0" - which: "npm:^5.0.0" - checksum: 10c0/2079aee17a875a56f34f31d5e9973933c7f885537aad023db4b217a392f0961968c18171b48a0db391a5b13549c8f5a89ebaa1a903b33975ea3610fb21085dbe + "@npmcli/promise-spawn": "npm:^9.0.0" + node-gyp: "npm:^12.1.0" + proc-log: "npm:^6.0.0" + which: "npm:^6.0.0" + checksum: 10c0/227483417d1f36011d35d1b868cd7a9c615553f195a86a282ca3c273e89f38f172fc1fcbb8f1635d419c861679570887874a37f9f21350e0b6fc813930224358 languageName: node linkType: hard -"@npmcli/run-script@npm:^9.0.1": - version: 9.1.0 - resolution: "@npmcli/run-script@npm:9.1.0" +"@npmcli/run-script@npm:^10.0.0": + version: 10.0.0 + resolution: "@npmcli/run-script@npm:10.0.0" dependencies: "@npmcli/node-gyp": "npm:^4.0.0" - "@npmcli/package-json": "npm:^6.0.0" + "@npmcli/package-json": "npm:^7.0.0" "@npmcli/promise-spawn": "npm:^8.0.0" node-gyp: "npm:^11.0.0" proc-log: "npm:^5.0.0" which: "npm:^5.0.0" - checksum: 10c0/4ed8eae5c7722c24814473f819d0bfe950f70e876bf9c52e05a61d3e74f2a044386da95e2e171e5a7a81e4c0b144582535addf2510e5decfd7d4aa7ae9e50931 + checksum: 10c0/2079aee17a875a56f34f31d5e9973933c7f885537aad023db4b217a392f0961968c18171b48a0db391a5b13549c8f5a89ebaa1a903b33975ea3610fb21085dbe languageName: node linkType: hard -"@nx/devkit@npm:>=21.5.2 < 22.0.0": - version: 21.5.3 - resolution: "@nx/devkit@npm:21.5.3" +"@nx/devkit@npm:>=21.5.2 < 23.0.0": + version: 22.5.4 + resolution: "@nx/devkit@npm:22.5.4" dependencies: + "@zkochan/js-yaml": "npm:0.0.7" ejs: "npm:^3.1.7" enquirer: "npm:~2.3.6" - ignore: "npm:^5.0.4" - minimatch: "npm:9.0.3" - semver: "npm:^7.5.3" - tmp: "npm:~0.2.1" + minimatch: "npm:10.2.4" + semver: "npm:^7.6.3" tslib: "npm:^2.3.0" yargs-parser: "npm:21.1.1" peerDependencies: - nx: ">= 20 <= 22" - checksum: 10c0/f7d2142a6279ed186f714f474d22044e833d263477c88d03a588ffec889e1bc3adffa838009ec99181487746912f2dbb2349ba2c02ceba36908167e6c19a75ca + nx: ">= 21 <= 23 || ^22.0.0-0" + checksum: 10c0/ad973e41963dbb8bb1d2c5bfa91b31b332bb98753b417e41f4a212af414fad8823e2a0115d38e94df53ef0b1061c0a798f512beec79babe19e22770141b43018 languageName: node linkType: hard -"@nx/nx-darwin-arm64@npm:21.5.3": - version: 21.5.3 - resolution: "@nx/nx-darwin-arm64@npm:21.5.3" +"@nx/nx-darwin-arm64@npm:22.5.4": + version: 22.5.4 + resolution: "@nx/nx-darwin-arm64@npm:22.5.4" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@nx/nx-darwin-x64@npm:21.5.3": - version: 21.5.3 - resolution: "@nx/nx-darwin-x64@npm:21.5.3" +"@nx/nx-darwin-x64@npm:22.5.4": + version: 22.5.4 + resolution: "@nx/nx-darwin-x64@npm:22.5.4" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@nx/nx-freebsd-x64@npm:21.5.3": - version: 21.5.3 - resolution: "@nx/nx-freebsd-x64@npm:21.5.3" +"@nx/nx-freebsd-x64@npm:22.5.4": + version: 22.5.4 + resolution: "@nx/nx-freebsd-x64@npm:22.5.4" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@nx/nx-linux-arm-gnueabihf@npm:21.5.3": - version: 21.5.3 - resolution: "@nx/nx-linux-arm-gnueabihf@npm:21.5.3" +"@nx/nx-linux-arm-gnueabihf@npm:22.5.4": + version: 22.5.4 + resolution: "@nx/nx-linux-arm-gnueabihf@npm:22.5.4" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@nx/nx-linux-arm64-gnu@npm:21.5.3": - version: 21.5.3 - resolution: "@nx/nx-linux-arm64-gnu@npm:21.5.3" +"@nx/nx-linux-arm64-gnu@npm:22.5.4": + version: 22.5.4 + resolution: "@nx/nx-linux-arm64-gnu@npm:22.5.4" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@nx/nx-linux-arm64-musl@npm:21.5.3": - version: 21.5.3 - resolution: "@nx/nx-linux-arm64-musl@npm:21.5.3" +"@nx/nx-linux-arm64-musl@npm:22.5.4": + version: 22.5.4 + resolution: "@nx/nx-linux-arm64-musl@npm:22.5.4" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@nx/nx-linux-x64-gnu@npm:21.5.3": - version: 21.5.3 - resolution: "@nx/nx-linux-x64-gnu@npm:21.5.3" +"@nx/nx-linux-x64-gnu@npm:22.5.4": + version: 22.5.4 + resolution: "@nx/nx-linux-x64-gnu@npm:22.5.4" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@nx/nx-linux-x64-musl@npm:21.5.3": - version: 21.5.3 - resolution: "@nx/nx-linux-x64-musl@npm:21.5.3" +"@nx/nx-linux-x64-musl@npm:22.5.4": + version: 22.5.4 + resolution: "@nx/nx-linux-x64-musl@npm:22.5.4" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@nx/nx-win32-arm64-msvc@npm:21.5.3": - version: 21.5.3 - resolution: "@nx/nx-win32-arm64-msvc@npm:21.5.3" +"@nx/nx-win32-arm64-msvc@npm:22.5.4": + version: 22.5.4 + resolution: "@nx/nx-win32-arm64-msvc@npm:22.5.4" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@nx/nx-win32-x64-msvc@npm:21.5.3": - version: 21.5.3 - resolution: "@nx/nx-win32-x64-msvc@npm:21.5.3" +"@nx/nx-win32-x64-msvc@npm:22.5.4": + version: 22.5.4 + resolution: "@nx/nx-win32-x64-msvc@npm:22.5.4" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -3816,15 +3768,6 @@ __metadata: languageName: node linkType: hard -"@sigstore/bundle@npm:^3.1.0": - version: 3.1.0 - resolution: "@sigstore/bundle@npm:3.1.0" - dependencies: - "@sigstore/protobuf-specs": "npm:^0.4.0" - checksum: 10c0/f34afa3efe81b0925cf1568eeea7678876c5889799fcdf9b81d1062067108e74fc3f3480b0d2b7daa7389f944e4a2523b5fc98d65dbbaa34d206d8c2edc4fa5a - languageName: node - linkType: hard - "@sigstore/bundle@npm:^4.0.0": version: 4.0.0 resolution: "@sigstore/bundle@npm:4.0.0" @@ -3834,13 +3777,6 @@ __metadata: languageName: node linkType: hard -"@sigstore/core@npm:^2.0.0": - version: 2.0.0 - resolution: "@sigstore/core@npm:2.0.0" - checksum: 10c0/bb7e668aedcda68312d2ff7c986fd0ba29057ca4dfbaef516c997b0799cd8858b2fc8017a7946fd2e43f237920adbcaa7455097a0a02909ed86cad9f98d592d4 - languageName: node - linkType: hard - "@sigstore/core@npm:^3.0.0": version: 3.0.0 resolution: "@sigstore/core@npm:3.0.0" @@ -3848,13 +3784,6 @@ __metadata: languageName: node linkType: hard -"@sigstore/protobuf-specs@npm:^0.4.0, @sigstore/protobuf-specs@npm:^0.4.1": - version: 0.4.3 - resolution: "@sigstore/protobuf-specs@npm:0.4.3" - checksum: 10c0/a7dbc66d1ff9e4455081a4d4c6b7a47a722072c55991698e2a900d91b7f0cb5ee9e8600b09ae5fd15ad3c6498d02418817f9d110c88b82d3e8edf9848fbf1222 - languageName: node - linkType: hard - "@sigstore/protobuf-specs@npm:^0.5.0": version: 0.5.0 resolution: "@sigstore/protobuf-specs@npm:0.5.0" @@ -3862,20 +3791,6 @@ __metadata: languageName: node linkType: hard -"@sigstore/sign@npm:^3.1.0": - version: 3.1.0 - resolution: "@sigstore/sign@npm:3.1.0" - dependencies: - "@sigstore/bundle": "npm:^3.1.0" - "@sigstore/core": "npm:^2.0.0" - "@sigstore/protobuf-specs": "npm:^0.4.0" - make-fetch-happen: "npm:^14.0.2" - proc-log: "npm:^5.0.0" - promise-retry: "npm:^2.0.1" - checksum: 10c0/7647f3a1350a09d66e7d77fdf8edf6eeb047f818acc2cd06325fc8ec9f0cd654dd25909876147b7ed052d459dc6a1d64e8cbaa44486300b241c3b139d778f254 - languageName: node - linkType: hard - "@sigstore/sign@npm:^4.0.0": version: 4.0.0 resolution: "@sigstore/sign@npm:4.0.0" @@ -3890,16 +3805,6 @@ __metadata: languageName: node linkType: hard -"@sigstore/tuf@npm:^3.1.0": - version: 3.1.1 - resolution: "@sigstore/tuf@npm:3.1.1" - dependencies: - "@sigstore/protobuf-specs": "npm:^0.4.1" - tuf-js: "npm:^3.0.1" - checksum: 10c0/08fdafb45c859cd58ef02e4f28e00a2d74f0c309dca36cf20fda17e55e194a3b7ebcfd9c40197c197d044ae4de0ff5d99b363aaec7cb6cbbf09611afa2661a55 - languageName: node - linkType: hard - "@sigstore/tuf@npm:^4.0.0": version: 4.0.0 resolution: "@sigstore/tuf@npm:4.0.0" @@ -3910,17 +3815,6 @@ __metadata: languageName: node linkType: hard -"@sigstore/verify@npm:^2.1.0": - version: 2.1.1 - resolution: "@sigstore/verify@npm:2.1.1" - dependencies: - "@sigstore/bundle": "npm:^3.1.0" - "@sigstore/core": "npm:^2.0.0" - "@sigstore/protobuf-specs": "npm:^0.4.1" - checksum: 10c0/4881d8cd798f7d0c5ffe42b643b950c2a8af1f07c96fc3f3a3409bf5f2221b832d4f018104a12ac8ae0740060ecbb837b99dec058765925d1dcb08ccbd92feb4 - languageName: node - linkType: hard - "@sigstore/verify@npm:^3.0.0": version: 3.0.0 resolution: "@sigstore/verify@npm:3.0.0" @@ -4593,16 +4487,6 @@ __metadata: languageName: node linkType: hard -"@tufjs/models@npm:3.0.1": - version: 3.0.1 - resolution: "@tufjs/models@npm:3.0.1" - dependencies: - "@tufjs/canonical-json": "npm:2.0.0" - minimatch: "npm:^9.0.5" - checksum: 10c0/0b2022589139102edf28f7fdcd094407fc98ac25bf530ebcf538dd63152baea9b6144b713c8dfc4f6b7580adeff706ab6ecc5f9716c4b816e58a04419abb1926 - languageName: node - linkType: hard - "@tufjs/models@npm:4.0.0": version: 4.0.0 resolution: "@tufjs/models@npm:4.0.0" @@ -5769,6 +5653,13 @@ __metadata: languageName: node linkType: hard +"abbrev@npm:^4.0.0": + version: 4.0.0 + resolution: "abbrev@npm:4.0.0" + checksum: 10c0/b4cc16935235e80702fc90192e349e32f8ef0ed151ef506aa78c81a7c455ec18375c4125414b99f84b2e055199d66383e787675f0bcd87da7a4dbd59f9eac1d5 + languageName: node + linkType: hard + "abort-controller@npm:^3.0.0": version: 3.0.0 resolution: "abort-controller@npm:3.0.0" @@ -6339,14 +6230,14 @@ __metadata: languageName: node linkType: hard -"axios@npm:^1.8.3": - version: 1.12.2 - resolution: "axios@npm:1.12.2" +"axios@npm:^1.12.0": + version: 1.13.6 + resolution: "axios@npm:1.13.6" dependencies: - follow-redirects: "npm:^1.15.6" - form-data: "npm:^4.0.4" + follow-redirects: "npm:^1.15.11" + form-data: "npm:^4.0.5" proxy-from-env: "npm:^1.1.0" - checksum: 10c0/80b063e318cf05cd33a4d991cea0162f3573481946f9129efb7766f38fde4c061c34f41a93a9f9521f02b7c9565ccbc197c099b0186543ac84a24580017adfed + checksum: 10c0/51fb5af055c3b85662fa97df17d986ae2c37d13bf86d50b6bb36b6b3a2dec6966a1d3a14ab3774b71707b155ae3597ed9b7babdf1a1a863d1a31840cb8e7ec71 languageName: node linkType: hard @@ -6376,6 +6267,13 @@ __metadata: languageName: node linkType: hard +"balanced-match@npm:^4.0.2": + version: 4.0.4 + resolution: "balanced-match@npm:4.0.4" + checksum: 10c0/07e86102a3eb2ee2a6a1a89164f29d0dbaebd28f2ca3f5ca786f36b8b23d9e417eb3be45a4acf754f837be5ac0a2317de90d3fcb7f4f4dc95720a1f36b26a17b + languageName: node + linkType: hard + "bare-events@npm:^2.7.0": version: 2.8.2 resolution: "bare-events@npm:2.8.2" @@ -6567,6 +6465,15 @@ __metadata: languageName: node linkType: hard +"brace-expansion@npm:^5.0.2": + version: 5.0.4 + resolution: "brace-expansion@npm:5.0.4" + dependencies: + balanced-match: "npm:^4.0.2" + checksum: 10c0/359cbcfa80b2eb914ca1f3440e92313fbfe7919ee6b274c35db55bec555aded69dac5ee78f102cec90c35f98c20fa43d10936d0cd9978158823c249257e1643a + languageName: node + linkType: hard + "braces@npm:^3.0.3, braces@npm:~3.0.2": version: 3.0.3 resolution: "braces@npm:3.0.3" @@ -6971,13 +6878,6 @@ __metadata: languageName: node linkType: hard -"chownr@npm:^2.0.0": - version: 2.0.0 - resolution: "chownr@npm:2.0.0" - checksum: 10c0/594754e1303672171cc04e50f6c398ae16128eb134a88f801bf5354fd96f205320f23536a045d9abd8b51024a149696e51231565891d4efdab8846021ecf88e6 - languageName: node - linkType: hard - "chownr@npm:^3.0.0": version: 3.0.0 resolution: "chownr@npm:3.0.0" @@ -6999,6 +6899,13 @@ __metadata: languageName: node linkType: hard +"ci-info@npm:4.3.1": + version: 4.3.1 + resolution: "ci-info@npm:4.3.1" + checksum: 10c0/7dd82000f514d76ddfe7775e4cb0d66e5c638f5fa0e2a3be29557e898da0d32ac04f231217d414d07fb968b1fbc6d980ee17ddde0d2c516f23da9cfff608f6c1 + languageName: node + linkType: hard + "ci-info@npm:^3.2.0": version: 3.9.0 resolution: "ci-info@npm:3.9.0" @@ -8263,7 +8170,7 @@ __metadata: html-webpack-plugin: "npm:^5.5.3" husky: "npm:^7.0.1" jiti: "npm:^2.4.2" - lerna: "patch:lerna@npm%3A9.0.0#~/.yarn/patches/lerna-npm-9.0.0-652834287a.patch" + lerna: "npm:^9.0.0" lint-staged: "npm:^12.1.7" listr2: "npm:^7.0.2" lodash-es: "npm:^4.17.21" @@ -9866,13 +9773,13 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.0.0, follow-redirects@npm:^1.15.6": - version: 1.15.6 - resolution: "follow-redirects@npm:1.15.6" +"follow-redirects@npm:^1.0.0, follow-redirects@npm:^1.15.11": + version: 1.15.11 + resolution: "follow-redirects@npm:1.15.11" peerDependenciesMeta: debug: optional: true - checksum: 10c0/9ff767f0d7be6aa6870c82ac79cf0368cd73e01bbc00e9eb1c2a16fbb198ec105e3c9b6628bb98e9f3ac66fe29a957b9645bcb9a490bb7aa0d35f908b6b85071 + checksum: 10c0/d301f430542520a54058d4aeeb453233c564aaccac835d29d15e050beb33f339ad67d9bddbce01739c5dc46a6716dbe3d9d0d5134b1ca203effa11a7ef092343 languageName: node linkType: hard @@ -9967,7 +9874,7 @@ __metadata: languageName: node linkType: hard -"form-data@npm:^4.0.0, form-data@npm:^4.0.4": +"form-data@npm:^4.0.0": version: 4.0.4 resolution: "form-data@npm:4.0.4" dependencies: @@ -9980,7 +9887,7 @@ __metadata: languageName: node linkType: hard -"form-data@npm:~4.0.4": +"form-data@npm:^4.0.5, form-data@npm:~4.0.4": version: 4.0.5 resolution: "form-data@npm:4.0.5" dependencies: @@ -10101,15 +10008,6 @@ __metadata: languageName: node linkType: hard -"fs-minipass@npm:^2.0.0": - version: 2.1.0 - resolution: "fs-minipass@npm:2.1.0" - dependencies: - minipass: "npm:^3.0.0" - checksum: 10c0/703d16522b8282d7299337539c3ed6edddd1afe82435e4f5b76e34a79cd74e488a8a0e26a636afc2440e1a23b03878e2122e3a2cfe375a5cf63c37d92b86a004 - languageName: node - linkType: hard - "fs-minipass@npm:^3.0.0": version: 3.0.3 resolution: "fs-minipass@npm:3.0.3" @@ -10620,6 +10518,17 @@ __metadata: languageName: node linkType: hard +"glob@npm:^13.0.0, glob@npm:^13.0.3": + version: 13.0.6 + resolution: "glob@npm:13.0.6" + dependencies: + minimatch: "npm:^10.2.2" + minipass: "npm:^7.1.3" + path-scurry: "npm:^2.0.2" + checksum: 10c0/269c236f11a9b50357fe7a8c6aadac667e01deb5242b19c84975628f05f4438d8ee1354bb62c5d6c10f37fd59911b54d7799730633a2786660d8c69f1d18120a + languageName: node + linkType: hard + "glob@npm:^7.1.3, glob@npm:^7.1.6": version: 7.2.3 resolution: "glob@npm:7.2.3" @@ -10648,18 +10557,6 @@ __metadata: languageName: node linkType: hard -"glob@npm:^9.2.0": - version: 9.3.5 - resolution: "glob@npm:9.3.5" - dependencies: - fs.realpath: "npm:^1.0.0" - minimatch: "npm:^8.0.2" - minipass: "npm:^4.2.4" - path-scurry: "npm:^1.6.1" - checksum: 10c0/2f6c2b9ee019ee21dc258ae97a88719614591e4c979cb4580b1b9df6f0f778a3cb38b4bdaf18dfa584637ea10f89a3c5f2533a5e449cf8741514ad18b0951f2e - languageName: node - linkType: hard - "global-agent@npm:^3.0.0": version: 3.0.0 resolution: "global-agent@npm:3.0.0" @@ -11389,7 +11286,7 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^5.0.4, ignore@npm:^5.1.1, ignore@npm:^5.2.0": +"ignore@npm:^5.1.1, ignore@npm:^5.2.0": version: 5.2.0 resolution: "ignore@npm:5.2.0" checksum: 10c0/7fb7b4c4c52c2555113ff968f8a83b8ac21b076282bfcb3f468c3fb429be69bd56222306c31de95dd452c647fc6ae24339b8047ebe3ef34c02591abfec58da01 @@ -12047,6 +11944,13 @@ __metadata: languageName: node linkType: hard +"isexe@npm:^4.0.0": + version: 4.0.0 + resolution: "isexe@npm:4.0.0" + checksum: 10c0/5884815115bceac452877659a9c7726382531592f43dc29e5d48b7c4100661aed54018cb90bd36cb2eaeba521092570769167acbb95c18d39afdccbcca06c5ce + languageName: node + linkType: hard + "isobject@npm:^3.0.1": version: 3.0.1 resolution: "isobject@npm:3.0.1" @@ -12149,17 +12053,6 @@ __metadata: languageName: node linkType: hard -"js-yaml@npm:4.1.0, js-yaml@npm:^4.1.0": - version: 4.1.0 - resolution: "js-yaml@npm:4.1.0" - dependencies: - argparse: "npm:^2.0.1" - bin: - js-yaml: bin/js-yaml.js - checksum: 10c0/184a24b4eaacfce40ad9074c64fd42ac83cf74d8c8cd137718d456ced75051229e5061b8633c3366b8aada17945a7a356b337828c19da92b51ae62126575018f - languageName: node - linkType: hard - "js-yaml@npm:4.1.1": version: 4.1.1 resolution: "js-yaml@npm:4.1.1" @@ -12183,6 +12076,17 @@ __metadata: languageName: node linkType: hard +"js-yaml@npm:^4.1.0": + version: 4.1.0 + resolution: "js-yaml@npm:4.1.0" + dependencies: + argparse: "npm:^2.0.1" + bin: + js-yaml: bin/js-yaml.js + checksum: 10c0/184a24b4eaacfce40ad9074c64fd42ac83cf74d8c8cd137718d456ced75051229e5061b8633c3366b8aada17945a7a356b337828c19da92b51ae62126575018f + languageName: node + linkType: hard + "jsbn@npm:~0.1.0": version: 0.1.1 resolution: "jsbn@npm:0.1.1" @@ -12227,6 +12131,13 @@ __metadata: languageName: node linkType: hard +"json-parse-even-better-errors@npm:^5.0.0": + version: 5.0.0 + resolution: "json-parse-even-better-errors@npm:5.0.0" + checksum: 10c0/9a33d120090a7637a2aa850acec610c011d7c6488c5184d7ffc0460ee0401057f3131a4dff70c6510900cf15a95ab99d3f0f2d959f59edfe6438d227e90bf5ca + languageName: node + linkType: hard + "json-schema-traverse@npm:^0.4.1": version: 0.4.1 resolution: "json-schema-traverse@npm:0.4.1" @@ -12505,107 +12416,20 @@ __metadata: languageName: node linkType: hard -"lerna@npm:9.0.0": - version: 9.0.0 - resolution: "lerna@npm:9.0.0" - dependencies: - "@lerna/create": "npm:9.0.0" - "@npmcli/arborist": "npm:9.1.4" - "@npmcli/package-json": "npm:7.0.0" - "@npmcli/run-script": "npm:10.0.0" - "@nx/devkit": "npm:>=21.5.2 < 22.0.0" - "@octokit/plugin-enterprise-rest": "npm:6.0.1" - "@octokit/rest": "npm:20.1.2" - aproba: "npm:2.0.0" - byte-size: "npm:8.1.1" - chalk: "npm:4.1.0" - cmd-shim: "npm:6.0.3" - color-support: "npm:1.1.3" - columnify: "npm:1.6.0" - console-control-strings: "npm:^1.1.0" - conventional-changelog-angular: "npm:7.0.0" - conventional-changelog-core: "npm:5.0.1" - conventional-recommended-bump: "npm:7.0.1" - cosmiconfig: "npm:9.0.0" - dedent: "npm:1.5.3" - envinfo: "npm:7.13.0" - execa: "npm:5.0.0" - fs-extra: "npm:^11.2.0" - get-port: "npm:5.1.1" - get-stream: "npm:6.0.0" - git-url-parse: "npm:14.0.0" - glob-parent: "npm:6.0.2" - has-unicode: "npm:2.0.1" - import-local: "npm:3.1.0" - ini: "npm:^1.3.8" - init-package-json: "npm:8.2.2" - inquirer: "npm:12.9.6" - is-ci: "npm:3.0.1" - is-stream: "npm:2.0.0" - jest-diff: "npm:>=30.0.0 < 31" - js-yaml: "npm:4.1.0" - libnpmaccess: "npm:10.0.1" - libnpmpublish: "npm:11.1.0" - load-json-file: "npm:6.2.0" - make-dir: "npm:4.0.0" - make-fetch-happen: "npm:15.0.2" - minimatch: "npm:3.0.5" - multimatch: "npm:5.0.0" - npm-package-arg: "npm:13.0.0" - npm-packlist: "npm:10.0.1" - npm-registry-fetch: "npm:19.0.0" - nx: "npm:>=21.5.3 < 22.0.0" - p-map: "npm:4.0.0" - p-map-series: "npm:2.1.0" - p-pipe: "npm:3.1.0" - p-queue: "npm:6.6.2" - p-reduce: "npm:2.1.0" - p-waterfall: "npm:2.1.1" - pacote: "npm:21.0.1" - pify: "npm:5.0.0" - read-cmd-shim: "npm:4.0.0" - resolve-from: "npm:5.0.0" - rimraf: "npm:^4.4.1" - semver: "npm:7.7.2" - set-blocking: "npm:^2.0.0" - signal-exit: "npm:3.0.7" - slash: "npm:3.0.0" - ssri: "npm:12.0.0" - string-width: "npm:^4.2.3" - tar: "npm:6.2.1" - temp-dir: "npm:1.0.0" - through: "npm:2.3.8" - tinyglobby: "npm:0.2.12" - typescript: "npm:>=3 < 6" - upath: "npm:2.0.1" - uuid: "npm:^11.1.0" - validate-npm-package-license: "npm:3.0.4" - validate-npm-package-name: "npm:6.0.2" - wide-align: "npm:1.1.5" - write-file-atomic: "npm:5.0.1" - write-pkg: "npm:4.0.0" - yargs: "npm:17.7.2" - yargs-parser: "npm:21.1.1" - bin: - lerna: dist/cli.js - checksum: 10c0/7255181577c680bcddf3c8fe1c4acef81e1ac9c98c1d97d8833916994036e21630fedecddb5dc47b63f9fb93b4717eb1bd0aba47edb4f46aa9212e09f105c9e2 - languageName: node - linkType: hard - -"lerna@patch:lerna@npm%3A9.0.0#~/.yarn/patches/lerna-npm-9.0.0-652834287a.patch": - version: 9.0.0 - resolution: "lerna@patch:lerna@npm%3A9.0.0#~/.yarn/patches/lerna-npm-9.0.0-652834287a.patch::version=9.0.0&hash=39199f" +"lerna@npm:^9.0.0": + version: 9.0.6 + resolution: "lerna@npm:9.0.6" dependencies: - "@lerna/create": "npm:9.0.0" - "@npmcli/arborist": "npm:9.1.4" - "@npmcli/package-json": "npm:7.0.0" - "@npmcli/run-script": "npm:10.0.0" - "@nx/devkit": "npm:>=21.5.2 < 22.0.0" + "@npmcli/arborist": "npm:9.1.6" + "@npmcli/package-json": "npm:7.0.2" + "@npmcli/run-script": "npm:10.0.3" + "@nx/devkit": "npm:>=21.5.2 < 23.0.0" "@octokit/plugin-enterprise-rest": "npm:6.0.1" "@octokit/rest": "npm:20.1.2" aproba: "npm:2.0.0" byte-size: "npm:8.1.1" chalk: "npm:4.1.0" + ci-info: "npm:4.3.1" cmd-shim: "npm:6.0.3" color-support: "npm:1.1.3" columnify: "npm:1.6.0" @@ -12630,18 +12454,18 @@ __metadata: is-ci: "npm:3.0.1" is-stream: "npm:2.0.0" jest-diff: "npm:>=30.0.0 < 31" - js-yaml: "npm:4.1.0" - libnpmaccess: "npm:10.0.1" - libnpmpublish: "npm:11.1.0" + js-yaml: "npm:4.1.1" + libnpmaccess: "npm:10.0.3" + libnpmpublish: "npm:11.1.2" load-json-file: "npm:6.2.0" make-dir: "npm:4.0.0" make-fetch-happen: "npm:15.0.2" - minimatch: "npm:3.0.5" + minimatch: "npm:3.1.4" multimatch: "npm:5.0.0" - npm-package-arg: "npm:13.0.0" - npm-packlist: "npm:10.0.1" - npm-registry-fetch: "npm:19.0.0" - nx: "npm:>=21.5.3 < 22.0.0" + npm-package-arg: "npm:13.0.1" + npm-packlist: "npm:10.0.3" + npm-registry-fetch: "npm:19.1.0" + nx: "npm:>=21.5.3 < 23.0.0" p-map: "npm:4.0.0" p-map-series: "npm:2.1.0" p-pipe: "npm:3.1.0" @@ -12652,14 +12476,14 @@ __metadata: pify: "npm:5.0.0" read-cmd-shim: "npm:4.0.0" resolve-from: "npm:5.0.0" - rimraf: "npm:^4.4.1" + rimraf: "npm:^6.1.2" semver: "npm:7.7.2" set-blocking: "npm:^2.0.0" signal-exit: "npm:3.0.7" slash: "npm:3.0.0" ssri: "npm:12.0.0" string-width: "npm:^4.2.3" - tar: "npm:6.2.1" + tar: "npm:7.5.11" temp-dir: "npm:1.0.0" through: "npm:2.3.8" tinyglobby: "npm:0.2.12" @@ -12675,7 +12499,7 @@ __metadata: yargs-parser: "npm:21.1.1" bin: lerna: dist/cli.js - checksum: 10c0/ea556c3088533ed62fb76e0eb8a99772b4c6a08f3342d7de52842622a03f5f6c699fe6570f6630883ab8de7a2a924d4806b8327decce93f499fa508cdbb738ed + checksum: 10c0/25132fd96b27c6a857c75bd07cd04fe9da7fc01815ce378c270f76dd632ce4e46307518530fff52867470c7e2961731cc21844dd4ec057eff464e37d1f299cb8 languageName: node linkType: hard @@ -12689,29 +12513,29 @@ __metadata: languageName: node linkType: hard -"libnpmaccess@npm:10.0.1": - version: 10.0.1 - resolution: "libnpmaccess@npm:10.0.1" +"libnpmaccess@npm:10.0.3": + version: 10.0.3 + resolution: "libnpmaccess@npm:10.0.3" dependencies: - npm-package-arg: "npm:^12.0.0" - npm-registry-fetch: "npm:^18.0.1" - checksum: 10c0/666fec42e56bf86ea149e7c3b40ffdfb1bacb7e1728be7395172500f4034f374e455a6d39c02fa58a73cecbfd5538b121d3c4df6b154b19ddc18da010673d084 + npm-package-arg: "npm:^13.0.0" + npm-registry-fetch: "npm:^19.0.0" + checksum: 10c0/4582f7a1b5e5a0103ed4e76776df3b82f5b296fc5d3ab92391d61ef526899783cdfa7983cb4cbc0d354ca4cdfd9e183523f8e45cb8be80a6804af05a7291127d languageName: node linkType: hard -"libnpmpublish@npm:11.1.0": - version: 11.1.0 - resolution: "libnpmpublish@npm:11.1.0" +"libnpmpublish@npm:11.1.2": + version: 11.1.2 + resolution: "libnpmpublish@npm:11.1.2" dependencies: - "@npmcli/package-json": "npm:^6.2.0" + "@npmcli/package-json": "npm:^7.0.0" ci-info: "npm:^4.0.0" - npm-package-arg: "npm:^12.0.0" - npm-registry-fetch: "npm:^18.0.1" + npm-package-arg: "npm:^13.0.0" + npm-registry-fetch: "npm:^19.0.0" proc-log: "npm:^5.0.0" semver: "npm:^7.3.7" - sigstore: "npm:^3.0.0" + sigstore: "npm:^4.0.0" ssri: "npm:^12.0.0" - checksum: 10c0/e7d469913226c294ab653cc12a93c55465cb459e8b8b969812d1c1711e60117937c7b46085a32ea937355475ab881c93a633c6927f8e69414b267db53f3e635c + checksum: 10c0/213cd2aeb65822892c3723a81d191a385e97f126ec63800f7051609e24c38c3fa36ea529b26739dc56dfba21f7f456347889f3aa1e6024c8c6a40bfa4cd9d184 languageName: node linkType: hard @@ -13087,7 +12911,7 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0, lru-cache@npm:^10.2.2": +"lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0": version: 10.4.3 resolution: "lru-cache@npm:10.4.3" checksum: 10c0/ebd04fbca961e6c1d6c0af3799adcc966a1babe798f685bb84e6599266599cd95d94630b10262f5424539bc4640107e8a33aa28585374abf561d30d16f4b39fb @@ -13110,13 +12934,6 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^9.1.1": - version: 9.1.2 - resolution: "lru-cache@npm:9.1.2" - checksum: 10c0/886811ab451332c899c230274e7e51507c15e5b3b18f0b39fb55f558978d58799a0b1a50e04d60a448d8c970ff4e6ee718bb119083ca88abb78930284f1e0900 - languageName: node - linkType: hard - "lru-cache@npm:^9.1.1 || ^10.0.0": version: 10.1.0 resolution: "lru-cache@npm:10.1.0" @@ -13188,7 +13005,7 @@ __metadata: languageName: node linkType: hard -"make-fetch-happen@npm:^14.0.0, make-fetch-happen@npm:^14.0.2, make-fetch-happen@npm:^14.0.3": +"make-fetch-happen@npm:^14.0.3": version: 14.0.3 resolution: "make-fetch-happen@npm:14.0.3" dependencies: @@ -13823,12 +13640,21 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:3.0.5": - version: 3.0.5 - resolution: "minimatch@npm:3.0.5" +"minimatch@npm:10.2.4, minimatch@npm:^10.2.2": + version: 10.2.4 + resolution: "minimatch@npm:10.2.4" + dependencies: + brace-expansion: "npm:^5.0.2" + checksum: 10c0/35f3dfb7b99b51efd46afd378486889f590e7efb10e0f6a10ba6800428cf65c9a8dedb74427d0570b318d749b543dc4e85f06d46d2858bc8cac7e1eb49a95945 + languageName: node + linkType: hard + +"minimatch@npm:3.1.4": + version: 3.1.4 + resolution: "minimatch@npm:3.1.4" dependencies: brace-expansion: "npm:^1.1.7" - checksum: 10c0/f398652d0d260137c289c270a4ac98ebe0a27cd316fa0fac72b096e96cbdc89f71d80d47ac7065c716ba3b0b730783b19180bd85a35f9247535d2adfe96bba76 + checksum: 10c0/868aab7e5f52570107eb283f021383be111cfeee0817a615f2a9ffe61fdc8fb86d535b9bf169fb8882261e7cb9da22b4d7b6f8b3402037f63558bab173f82212 languageName: node linkType: hard @@ -13841,15 +13667,6 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:9.0.3, minimatch@npm:^9.0.0, minimatch@npm:^9.0.1, minimatch@npm:^9.0.3": - version: 9.0.3 - resolution: "minimatch@npm:9.0.3" - dependencies: - brace-expansion: "npm:^2.0.1" - checksum: 10c0/85f407dcd38ac3e180f425e86553911d101455ca3ad5544d6a7cec16286657e4f8a9aa6695803025c55e31e35a91a2252b5dc8e7d527211278b8b65b4dbd5eac - languageName: node - linkType: hard - "minimatch@npm:^10.0.1, minimatch@npm:^10.1.1": version: 10.1.1 resolution: "minimatch@npm:10.1.1" @@ -13886,12 +13703,12 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^8.0.2": - version: 8.0.4 - resolution: "minimatch@npm:8.0.4" +"minimatch@npm:^9.0.1, minimatch@npm:^9.0.3": + version: 9.0.3 + resolution: "minimatch@npm:9.0.3" dependencies: brace-expansion: "npm:^2.0.1" - checksum: 10c0/a0a394c356dd5b4cb7f821720841a82fa6f07c9c562c5b716909d1b6ec5e56a7e4c4b5029da26dd256b7d2b3a3f38cbf9ddd8680e887b9b5282b09c05501c1ca + checksum: 10c0/85f407dcd38ac3e180f425e86553911d101455ca3ad5544d6a7cec16286657e4f8a9aa6695803025c55e31e35a91a2252b5dc8e7d527211278b8b65b4dbd5eac languageName: node linkType: hard @@ -13989,27 +13806,6 @@ __metadata: languageName: node linkType: hard -"minipass@npm:^4.2.4": - version: 4.2.8 - resolution: "minipass@npm:4.2.8" - checksum: 10c0/4ea76b030d97079f4429d6e8a8affd90baf1b6a1898977c8ccce4701c5a2ba2792e033abc6709373f25c2c4d4d95440d9d5e9464b46b7b76ca44d2ce26d939ce - languageName: node - linkType: hard - -"minipass@npm:^5.0.0": - version: 5.0.0 - resolution: "minipass@npm:5.0.0" - checksum: 10c0/a91d8043f691796a8ac88df039da19933ef0f633e3d7f0d35dcd5373af49131cf2399bfc355f41515dc495e3990369c3858cd319e5c2722b4753c90bf3152462 - languageName: node - linkType: hard - -"minipass@npm:^5.0.0 || ^6.0.2": - version: 6.0.2 - resolution: "minipass@npm:6.0.2" - checksum: 10c0/3878076578f44ef4078ceed10af2cfebbec1b6217bf9f7a3d8b940da8153769db29bf88498b2de0d1e0c12dfb7b634c5729b7ca03457f46435e801578add210a - languageName: node - linkType: hard - "minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.3": version: 7.0.4 resolution: "minipass@npm:7.0.4" @@ -14024,13 +13820,10 @@ __metadata: languageName: node linkType: hard -"minizlib@npm:^2.1.1": - version: 2.1.2 - resolution: "minizlib@npm:2.1.2" - dependencies: - minipass: "npm:^3.0.0" - yallist: "npm:^4.0.0" - checksum: 10c0/64fae024e1a7d0346a1102bb670085b17b7f95bf6cfdf5b128772ec8faf9ea211464ea4add406a3a6384a7d87a0cd1a96263692134323477b4fb43659a6cab78 +"minipass@npm:^7.1.3": + version: 7.1.3 + resolution: "minipass@npm:7.1.3" + checksum: 10c0/539da88daca16533211ea5a9ee98dc62ff5742f531f54640dd34429e621955e91cc280a91a776026264b7f9f6735947629f920944e9c1558369e8bf22eb33fbb languageName: node linkType: hard @@ -14043,7 +13836,7 @@ __metadata: languageName: node linkType: hard -"mkdirp@npm:1.0.4, mkdirp@npm:^1.0.3": +"mkdirp@npm:1.0.4": version: 1.0.4 resolution: "mkdirp@npm:1.0.4" bin: @@ -14373,6 +14166,26 @@ __metadata: languageName: node linkType: hard +"node-gyp@npm:^12.1.0": + version: 12.2.0 + resolution: "node-gyp@npm:12.2.0" + dependencies: + env-paths: "npm:^2.2.0" + exponential-backoff: "npm:^3.1.1" + graceful-fs: "npm:^4.2.6" + make-fetch-happen: "npm:^15.0.0" + nopt: "npm:^9.0.0" + proc-log: "npm:^6.0.0" + semver: "npm:^7.3.5" + tar: "npm:^7.5.4" + tinyglobby: "npm:^0.2.12" + which: "npm:^6.0.0" + bin: + node-gyp: bin/node-gyp.js + checksum: 10c0/3ed046746a5a7d90950cd8b0547332b06598443f31fe213ef4332a7174c7b7d259e1704835feda79b87d3f02e59d7791842aac60642ede4396ab25fdf0f8f759 + languageName: node + linkType: hard + "node-machine-id@npm:1.1.12": version: 1.1.12 resolution: "node-machine-id@npm:1.1.12" @@ -14398,6 +14211,17 @@ __metadata: languageName: node linkType: hard +"nopt@npm:^9.0.0": + version: 9.0.0 + resolution: "nopt@npm:9.0.0" + dependencies: + abbrev: "npm:^4.0.0" + bin: + nopt: bin/nopt.js + checksum: 10c0/1822eb6f9b020ef6f7a7516d7b64a8036e09666ea55ac40416c36e4b2b343122c3cff0e2f085675f53de1d2db99a2a89a60ccea1d120bcd6a5347bf6ceb4a7fd + languageName: node + linkType: hard + "normalize-package-data@npm:^2.3.2, normalize-package-data@npm:^2.5.0": version: 2.5.0 resolution: "normalize-package-data@npm:2.5.0" @@ -14452,6 +14276,15 @@ __metadata: languageName: node linkType: hard +"npm-bundled@npm:^5.0.0": + version: 5.0.0 + resolution: "npm-bundled@npm:5.0.0" + dependencies: + npm-normalize-package-bin: "npm:^5.0.0" + checksum: 10c0/6408b38343b51d5e329a0a4af4cf19d7872bc9099f6f7553fbadb5d56e69092d5af76fe501fa0817fcb8af29cf3cc8f8806a88031580f54068e5e80abf1ca870 + languageName: node + linkType: hard + "npm-install-checks@npm:^7.1.0": version: 7.1.2 resolution: "npm-install-checks@npm:7.1.2" @@ -14468,15 +14301,22 @@ __metadata: languageName: node linkType: hard -"npm-package-arg@npm:13.0.0, npm-package-arg@npm:^13.0.0": - version: 13.0.0 - resolution: "npm-package-arg@npm:13.0.0" +"npm-normalize-package-bin@npm:^5.0.0": + version: 5.0.0 + resolution: "npm-normalize-package-bin@npm:5.0.0" + checksum: 10c0/9cd875669354ce451779495a111dc1622bedf702f7ad8b36b05b4037a2c961356361cff49c1e2e77d90b80194dffd18fdb52f16bf64e00ccffe6129003a55248 + languageName: node + linkType: hard + +"npm-package-arg@npm:13.0.1": + version: 13.0.1 + resolution: "npm-package-arg@npm:13.0.1" dependencies: hosted-git-info: "npm:^9.0.0" proc-log: "npm:^5.0.0" semver: "npm:^7.3.5" validate-npm-package-name: "npm:^6.0.0" - checksum: 10c0/cb5d3378b5fa69320547ad80227932efedcbf772caf9f1350c28527eb6ac5c5d0085d3f2a09ce0a65cae34d7956b9bf40674dd8be91cd35a376bbb30888b2997 + checksum: 10c0/14ff9f491e2a1c68b5a0b0faede011179663e2ae59b96bf9fa3e4ea95ee1927fc3a20c0967e9dc20e0ee0ebddb7ea2172bd83abd4e7a5689ed837d156ad0f79f languageName: node linkType: hard @@ -14492,12 +14332,25 @@ __metadata: languageName: node linkType: hard -"npm-packlist@npm:10.0.1": - version: 10.0.1 - resolution: "npm-packlist@npm:10.0.1" +"npm-package-arg@npm:^13.0.0": + version: 13.0.0 + resolution: "npm-package-arg@npm:13.0.0" + dependencies: + hosted-git-info: "npm:^9.0.0" + proc-log: "npm:^5.0.0" + semver: "npm:^7.3.5" + validate-npm-package-name: "npm:^6.0.0" + checksum: 10c0/cb5d3378b5fa69320547ad80227932efedcbf772caf9f1350c28527eb6ac5c5d0085d3f2a09ce0a65cae34d7956b9bf40674dd8be91cd35a376bbb30888b2997 + languageName: node + linkType: hard + +"npm-packlist@npm:10.0.3": + version: 10.0.3 + resolution: "npm-packlist@npm:10.0.3" dependencies: ignore-walk: "npm:^8.0.0" - checksum: 10c0/64397de9e1c8c90d63dfb37604a49e642106f086ebc84d1b1fc7519e35d7c599a246bb75396d5b62f307e35e849c879aebf5f6da505453d7f2d619cf5362d8b3 + proc-log: "npm:^6.0.0" + checksum: 10c0/f4fa58890e7d9e80299c284cdf65fafac6eae0c23b830bbae9953255571364897a6f22a02b5da63f0c43e45019d7446feec6ed79124edc6a44c8d6c9a19d25cf languageName: node linkType: hard @@ -14535,9 +14388,9 @@ __metadata: languageName: node linkType: hard -"npm-registry-fetch@npm:19.0.0, npm-registry-fetch@npm:^19.0.0": - version: 19.0.0 - resolution: "npm-registry-fetch@npm:19.0.0" +"npm-registry-fetch@npm:19.1.0": + version: 19.1.0 + resolution: "npm-registry-fetch@npm:19.1.0" dependencies: "@npmcli/redact": "npm:^3.0.0" jsonparse: "npm:^1.3.1" @@ -14547,23 +14400,23 @@ __metadata: minizlib: "npm:^3.0.1" npm-package-arg: "npm:^13.0.0" proc-log: "npm:^5.0.0" - checksum: 10c0/1b5c5cf2a89e60f83be43edc62ef31cb942565a583c07dacdfd9d2a339cd8f1dee340b502656fbf23fe17a4380e58aca36c85f06d632c1b3e89131ee68b0b86c + checksum: 10c0/f326a0ba808b159da0ef8aec28411eec49972477584485211f48a47915d90750c9c589c187521dadb4053b5959bde911c4a6151596cb4ff19bd42aada315c609 languageName: node linkType: hard -"npm-registry-fetch@npm:^18.0.1": - version: 18.0.2 - resolution: "npm-registry-fetch@npm:18.0.2" +"npm-registry-fetch@npm:^19.0.0": + version: 19.0.0 + resolution: "npm-registry-fetch@npm:19.0.0" dependencies: "@npmcli/redact": "npm:^3.0.0" jsonparse: "npm:^1.3.1" - make-fetch-happen: "npm:^14.0.0" + make-fetch-happen: "npm:^15.0.0" minipass: "npm:^7.0.2" minipass-fetch: "npm:^4.0.0" minizlib: "npm:^3.0.1" - npm-package-arg: "npm:^12.0.0" + npm-package-arg: "npm:^13.0.0" proc-log: "npm:^5.0.0" - checksum: 10c0/43e02befb393f67d5014d690a96d55f0b5f837a3eb9a79b17738ff0e3a1f081968480f2f280d1ad77a088ebd88c196793d929b0e4d24a8389a324dfd4006bc39 + checksum: 10c0/1b5c5cf2a89e60f83be43edc62ef31cb942565a583c07dacdfd9d2a339cd8f1dee340b502656fbf23fe17a4380e58aca36c85f06d632c1b3e89131ee68b0b86c languageName: node linkType: hard @@ -14594,46 +14447,47 @@ __metadata: languageName: node linkType: hard -"nx@npm:>=21.5.3 < 22.0.0": - version: 21.5.3 - resolution: "nx@npm:21.5.3" +"nx@npm:>=21.5.3 < 23.0.0": + version: 22.5.4 + resolution: "nx@npm:22.5.4" dependencies: "@napi-rs/wasm-runtime": "npm:0.2.4" - "@nx/nx-darwin-arm64": "npm:21.5.3" - "@nx/nx-darwin-x64": "npm:21.5.3" - "@nx/nx-freebsd-x64": "npm:21.5.3" - "@nx/nx-linux-arm-gnueabihf": "npm:21.5.3" - "@nx/nx-linux-arm64-gnu": "npm:21.5.3" - "@nx/nx-linux-arm64-musl": "npm:21.5.3" - "@nx/nx-linux-x64-gnu": "npm:21.5.3" - "@nx/nx-linux-x64-musl": "npm:21.5.3" - "@nx/nx-win32-arm64-msvc": "npm:21.5.3" - "@nx/nx-win32-x64-msvc": "npm:21.5.3" + "@nx/nx-darwin-arm64": "npm:22.5.4" + "@nx/nx-darwin-x64": "npm:22.5.4" + "@nx/nx-freebsd-x64": "npm:22.5.4" + "@nx/nx-linux-arm-gnueabihf": "npm:22.5.4" + "@nx/nx-linux-arm64-gnu": "npm:22.5.4" + "@nx/nx-linux-arm64-musl": "npm:22.5.4" + "@nx/nx-linux-x64-gnu": "npm:22.5.4" + "@nx/nx-linux-x64-musl": "npm:22.5.4" + "@nx/nx-win32-arm64-msvc": "npm:22.5.4" + "@nx/nx-win32-x64-msvc": "npm:22.5.4" "@yarnpkg/lockfile": "npm:^1.1.0" "@yarnpkg/parsers": "npm:3.0.2" "@zkochan/js-yaml": "npm:0.0.7" - axios: "npm:^1.8.3" - chalk: "npm:^4.1.0" + axios: "npm:^1.12.0" cli-cursor: "npm:3.1.0" cli-spinners: "npm:2.6.1" cliui: "npm:^8.0.1" dotenv: "npm:~16.4.5" dotenv-expand: "npm:~11.0.6" + ejs: "npm:^3.1.7" enquirer: "npm:~2.3.6" figures: "npm:3.2.0" flat: "npm:^5.0.2" front-matter: "npm:^4.0.2" - ignore: "npm:^5.0.4" + ignore: "npm:^7.0.5" jest-diff: "npm:^30.0.2" jsonc-parser: "npm:3.2.0" lines-and-columns: "npm:2.0.3" - minimatch: "npm:9.0.3" + minimatch: "npm:10.2.4" node-machine-id: "npm:1.1.12" npm-run-path: "npm:^4.0.1" open: "npm:^8.4.0" ora: "npm:5.3.0" + picocolors: "npm:^1.1.0" resolve.exports: "npm:2.0.3" - semver: "npm:^7.5.3" + semver: "npm:^7.6.3" string-width: "npm:^4.2.3" tar-stream: "npm:~2.2.0" tmp: "npm:~0.2.1" @@ -14644,8 +14498,8 @@ __metadata: yargs: "npm:^17.6.2" yargs-parser: "npm:21.1.1" peerDependencies: - "@swc-node/register": ^1.8.0 - "@swc/core": ^1.3.85 + "@swc-node/register": ^1.11.1 + "@swc/core": ^1.15.8 dependenciesMeta: "@nx/nx-darwin-arm64": optional: true @@ -14675,7 +14529,7 @@ __metadata: bin: nx: bin/nx.js nx-cloud: bin/nx-cloud.js - checksum: 10c0/3b1fc6afcd78eef4af02756da878ff3d0f37924973e5bd9f0122377be17f95433ad2e60200cfc423446c9dc83c6e47a49690f1cdbe989236c58cdf2e928f9189 + checksum: 10c0/39b605a13d56c16cc4d14976780b522af55d77fb1c8d2a6e60d34dd95c910d49d179fd1b4568ff2de7712613dce603fa598d443cef57efd861bca390b95a49c6 languageName: node linkType: hard @@ -15130,7 +14984,7 @@ __metadata: languageName: node linkType: hard -"p-reduce@npm:2.1.0, p-reduce@npm:^2.0.0, p-reduce@npm:^2.1.0": +"p-reduce@npm:2.1.0, p-reduce@npm:^2.0.0": version: 2.1.0 resolution: "p-reduce@npm:2.1.0" checksum: 10c0/27b8ff0fb044995507a06cd6357dffba0f2b98862864745972562a21885d7906ce5c794036d2aaa63ef6303158e41e19aed9f19651dfdafb38548ecec7d0de15 @@ -15179,7 +15033,7 @@ __metadata: languageName: node linkType: hard -"package-json-from-dist@npm:^1.0.0": +"package-json-from-dist@npm:^1.0.0, package-json-from-dist@npm:^1.0.1": version: 1.0.1 resolution: "package-json-from-dist@npm:1.0.1" checksum: 10c0/62ba2785eb655fec084a257af34dbe24292ab74516d6aecef97ef72d4897310bc6898f6c85b5cd22770eaa1ce60d55a0230e150fb6a966e3ecd6c511e23d164b @@ -15240,6 +15094,33 @@ __metadata: languageName: node linkType: hard +"pacote@npm:^21.0.2": + version: 21.5.0 + resolution: "pacote@npm:21.5.0" + dependencies: + "@gar/promise-retry": "npm:^1.0.0" + "@npmcli/git": "npm:^7.0.0" + "@npmcli/installed-package-contents": "npm:^4.0.0" + "@npmcli/package-json": "npm:^7.0.0" + "@npmcli/promise-spawn": "npm:^9.0.0" + "@npmcli/run-script": "npm:^10.0.0" + cacache: "npm:^20.0.0" + fs-minipass: "npm:^3.0.0" + minipass: "npm:^7.0.2" + npm-package-arg: "npm:^13.0.0" + npm-packlist: "npm:^10.0.1" + npm-pick-manifest: "npm:^11.0.1" + npm-registry-fetch: "npm:^19.0.0" + proc-log: "npm:^6.0.0" + sigstore: "npm:^4.0.0" + ssri: "npm:^13.0.0" + tar: "npm:^7.4.3" + bin: + pacote: bin/index.js + checksum: 10c0/f91ee9c3645300b52eebdce461d4e1d8a9311e9ddf7f55f87532cd3df0282379613b0a9703f97d81c9efaae382f08fcf29e359d7f47f0e9c9670cfb7fc472954 + languageName: node + linkType: hard + "pako@npm:~0.2.0": version: 0.2.9 resolution: "pako@npm:0.2.9" @@ -15447,16 +15328,6 @@ __metadata: languageName: node linkType: hard -"path-scurry@npm:^1.6.1": - version: 1.9.2 - resolution: "path-scurry@npm:1.9.2" - dependencies: - lru-cache: "npm:^9.1.1" - minipass: "npm:^5.0.0 || ^6.0.2" - checksum: 10c0/99a3461a1ebc5269165170a744367a900802dc1ecc8a17a8c9700cca9b00b0938c8a06d57ec9bc9a485e430fd37c647f4029ccaf31b5f9dacedaf685cef3e69a - languageName: node - linkType: hard - "path-scurry@npm:^2.0.0": version: 2.0.0 resolution: "path-scurry@npm:2.0.0" @@ -15467,6 +15338,16 @@ __metadata: languageName: node linkType: hard +"path-scurry@npm:^2.0.2": + version: 2.0.2 + resolution: "path-scurry@npm:2.0.2" + dependencies: + lru-cache: "npm:^11.0.0" + minipass: "npm:^7.1.2" + checksum: 10c0/b35ad37cf6557a87fd057121ce2be7695380c9138d93e87ae928609da259ea0a170fac6f3ef1eb3ece8a068e8b7f2f3adf5bb2374cf4d4a57fe484954fcc9482 + languageName: node + linkType: hard + "path-to-regexp@npm:0.1.12": version: 0.1.12 resolution: "path-to-regexp@npm:0.1.12" @@ -15559,7 +15440,7 @@ __metadata: languageName: node linkType: hard -"picocolors@npm:^1.1.1": +"picocolors@npm:^1.1.0, picocolors@npm:^1.1.1": version: 1.1.1 resolution: "picocolors@npm:1.1.1" checksum: 10c0/e2e3e8170ab9d7c7421969adaa7e1b31434f789afb9b3f115f6b96d91945041ac3ceb02e9ec6fe6510ff036bcc0bf91e69a1772edc0b707e12b19c0f2d6bcf58 @@ -15784,6 +15665,13 @@ __metadata: languageName: node linkType: hard +"proc-log@npm:^6.0.0": + version: 6.1.0 + resolution: "proc-log@npm:6.1.0" + checksum: 10c0/4f178d4062733ead9d71a9b1ab24ebcecdfe2250916a5b1555f04fe2eda972a0ec76fbaa8df1ad9c02707add6749219d118a4fc46dc56bdfe4dde4b47d80bb82 + languageName: node + linkType: hard + "process-nextick-args@npm:~2.0.0": version: 2.0.1 resolution: "process-nextick-args@npm:2.0.1" @@ -16108,16 +15996,6 @@ __metadata: languageName: node linkType: hard -"read-package-json-fast@npm:^4.0.0": - version: 4.0.0 - resolution: "read-package-json-fast@npm:4.0.0" - dependencies: - json-parse-even-better-errors: "npm:^4.0.0" - npm-normalize-package-bin: "npm:^4.0.0" - checksum: 10c0/8a03509ae8e852f1abc4b109c1be571dd90ac9ea65d55433b2fe287e409113441a9b00df698288fe48aa786c1a2550569d47b5ab01ed83ada073d691d5aff582 - languageName: node - linkType: hard - "read-pkg-up@npm:^2.0.0": version: 2.0.0 resolution: "read-pkg-up@npm:2.0.0" @@ -16581,14 +16459,15 @@ __metadata: languageName: node linkType: hard -"rimraf@npm:^4.4.1": - version: 4.4.1 - resolution: "rimraf@npm:4.4.1" +"rimraf@npm:^6.1.2": + version: 6.1.3 + resolution: "rimraf@npm:6.1.3" dependencies: - glob: "npm:^9.2.0" + glob: "npm:^13.0.3" + package-json-from-dist: "npm:^1.0.1" bin: - rimraf: dist/cjs/src/bin.js - checksum: 10c0/8c5e142d26d8b222be9dc9a1a41ba48e95d8f374e813e66a8533e87c6180174fcb3f573b9b592eca12740ebf8b78526d136acd971d4a790763d6f2232c34fa24 + rimraf: dist/esm/bin.mjs + checksum: 10c0/4a56537850102e20ba5d5eb49f366b4b7b2435389734b4b8480cf0e0eb0f6f5d0c44120a171aeb0d8f9ab40312a10d2262f3f50acbad803e32caef61b6cf86fc languageName: node linkType: hard @@ -17131,20 +17010,6 @@ __metadata: languageName: node linkType: hard -"sigstore@npm:^3.0.0": - version: 3.1.0 - resolution: "sigstore@npm:3.1.0" - dependencies: - "@sigstore/bundle": "npm:^3.1.0" - "@sigstore/core": "npm:^2.0.0" - "@sigstore/protobuf-specs": "npm:^0.4.0" - "@sigstore/sign": "npm:^3.1.0" - "@sigstore/tuf": "npm:^3.1.0" - "@sigstore/verify": "npm:^2.1.0" - checksum: 10c0/c037f5526e698ec6de8654f6be6b6fa52bf52f2ffcd78109cdefc6d824bbb8390324522dcb0f84d57a674948ac53aef34dd77f9de66c91bcd91d0af56bb91c7e - languageName: node - linkType: hard - "sigstore@npm:^4.0.0": version: 4.0.0 resolution: "sigstore@npm:4.0.0" @@ -17159,7 +17024,7 @@ __metadata: languageName: node linkType: hard -"slash@npm:3.0.0, slash@npm:^3.0.0": +"slash@npm:3.0.0": version: 3.0.0 resolution: "slash@npm:3.0.0" checksum: 10c0/e18488c6a42bdfd4ac5be85b2ced3ccd0224773baae6ad42cfbb9ec74fc07f9fa8396bd35ee638084ead7a2a0818eb5e7151111544d4731ce843019dab4be47b @@ -17432,6 +17297,15 @@ __metadata: languageName: node linkType: hard +"ssri@npm:^13.0.0": + version: 13.0.1 + resolution: "ssri@npm:13.0.1" + dependencies: + minipass: "npm:^7.0.3" + checksum: 10c0/cf6408a18676c57ff2ed06b8a20dc64bb3e748e5c7e095332e6aecaa2b8422b1e94a739a8453bf65156a8a47afe23757ba4ab52d3ea3b62322dc40875763e17a + languageName: node + linkType: hard + "stackback@npm:0.0.2": version: 0.0.2 resolution: "stackback@npm:0.0.2" @@ -17881,17 +17755,16 @@ __metadata: languageName: node linkType: hard -"tar@npm:6.2.1": - version: 6.2.1 - resolution: "tar@npm:6.2.1" +"tar@npm:7.5.11, tar@npm:^7.5.4": + version: 7.5.11 + resolution: "tar@npm:7.5.11" dependencies: - chownr: "npm:^2.0.0" - fs-minipass: "npm:^2.0.0" - minipass: "npm:^5.0.0" - minizlib: "npm:^2.1.1" - mkdirp: "npm:^1.0.3" - yallist: "npm:^4.0.0" - checksum: 10c0/a5eca3eb50bc11552d453488344e6507156b9193efd7635e98e867fab275d527af53d8866e2370cd09dfe74378a18111622ace35af6a608e5223a7d27fe99537 + "@isaacs/fs-minipass": "npm:^4.0.0" + chownr: "npm:^3.0.0" + minipass: "npm:^7.1.2" + minizlib: "npm:^3.1.0" + yallist: "npm:^5.0.0" + checksum: 10c0/b6bb420550ef50ef23356018155e956cd83282c97b6128d8d5cfe5740c57582d806a244b2ef0bf686a74ce526babe8b8b9061527623e935e850008d86d838929 languageName: node linkType: hard @@ -18309,17 +18182,6 @@ __metadata: languageName: node linkType: hard -"tuf-js@npm:^3.0.1": - version: 3.1.0 - resolution: "tuf-js@npm:3.1.0" - dependencies: - "@tufjs/models": "npm:3.0.1" - debug: "npm:^4.4.1" - make-fetch-happen: "npm:^14.0.3" - checksum: 10c0/90d5dbdd0ecf2e42826c6253296aae27db5070d67da6374ac5f69eb0d0244f4043b67e3a84fb12a9a256d5b23d7143127e52fb096264eaacc3027c1d08b172ec - languageName: node - linkType: hard - "tuf-js@npm:^4.0.0": version: 4.0.0 resolution: "tuf-js@npm:4.0.0" @@ -19353,6 +19215,17 @@ __metadata: languageName: node linkType: hard +"which@npm:^6.0.0": + version: 6.0.1 + resolution: "which@npm:6.0.1" + dependencies: + isexe: "npm:^4.0.0" + bin: + node-which: bin/which.js + checksum: 10c0/7e710e54ea36d2d6183bee2f9caa27a3b47b9baf8dee55a199b736fcf85eab3b9df7556fca3d02b50af7f3dfba5ea3a45644189836df06267df457e354da66d5 + languageName: node + linkType: hard + "why-is-node-running@npm:^2.3.0": version: 2.3.0 resolution: "why-is-node-running@npm:2.3.0" From be8a1bd45fd5d4150c5da067ce160a4dff22301d Mon Sep 17 00:00:00 2001 From: Erick Zhao Date: Thu, 19 Mar 2026 22:34:13 -0700 Subject: [PATCH 3/8] re-apply patch correctly --- .../patches/lerna-npm-9.0.0-652834287a.patch | 103 - .../patches/lerna-npm-9.0.6-162b638d8c.patch | 13735 ++++++++++++++++ package.json | 2 +- yarn.lock | 91 +- 4 files changed, 13825 insertions(+), 106 deletions(-) delete mode 100644 .yarn/patches/lerna-npm-9.0.0-652834287a.patch create mode 100644 .yarn/patches/lerna-npm-9.0.6-162b638d8c.patch diff --git a/.yarn/patches/lerna-npm-9.0.0-652834287a.patch b/.yarn/patches/lerna-npm-9.0.0-652834287a.patch deleted file mode 100644 index 30fe66ff3e..0000000000 --- a/.yarn/patches/lerna-npm-9.0.0-652834287a.patch +++ /dev/null @@ -1,103 +0,0 @@ -# Adds --skip-check-working-tree flag to `lerna publish` so that -# tools/verdaccio/spawn-verdaccio.ts can publish to a local registry -# with uncommitted changes. See https://github.com/lerna/lerna/issues/2329 -diff --git a/dist/commands/publish/command.js b/dist/commands/publish/command.js -index 81ba8ac28f0e3512df2e62144c5b13f1e7405a20..a3b7b493695f581c5e351b6cd9f7fefe7102aaed 100644 ---- a/dist/commands/publish/command.js -+++ b/dist/commands/publish/command.js -@@ -7014,7 +7014,9 @@ var require_src = __commonJS({ - this.runRootLifecycle = /^(pre|post)?version$/.test(process.env.npm_lifecycle_event) ? (stage) => { - this.logger.warn("lifecycle", "Skipping root %j because it has already been called", stage); - } : (stage) => this.runPackageLifecycle(this.project.manifest, stage); -- if (this.commitAndTag && this.gitOpts.amend !== true) { -+ if (this.options.skipCheckWorkingTree) { -+ this.logger.warn("version", "Skipping working tree validation, proceed at your own risk"); -+ } else if (this.commitAndTag && this.gitOpts.amend !== true) { - const { forcePublish, conventionalCommits, conventionalGraduate } = this.options; - const checkUncommittedOnly = forcePublish || conventionalCommits && conventionalGraduate; - const check = checkUncommittedOnly ? throwIfUncommitted : checkWorkingTree; -@@ -8508,6 +8510,10 @@ var require_src2 = __commonJS({ - } - } - verifyWorkingTreeClean() { -+ if (this.options.skipCheckWorkingTree) { -+ this.logger.warn("publish", "Skipping working tree check, proceed at your own risk"); -+ return Promise.resolve(); -+ } - return describeRef(this.execOpts).then(throwIfUncommitted); - } - async detectFromGit() { -@@ -9215,6 +9221,10 @@ var require_command2 = __commonJS({ - "include-private": { - describe: "Include specified private packages when publishing by temporarily removing the private property from the package manifest. This should only be used for testing private packages that will become public. Private packages should not usually be published. See the npm docs for details (https://docs.npmjs.com/cli/v9/configuring-npm/package-json#private).", - type: "array" -+ }, -+ "skip-check-working-tree": { -+ describe: "Skip the check for uncommitted changes in the working tree before publishing.", -+ type: "boolean" - } - }; - composeVersionOptions(yargs2); -diff --git a/dist/commands/publish/index.js b/dist/commands/publish/index.js -index d0f1eafacb2336d387b43eb1d5a14bce636a3749..8ce1411fcd9b0d6aac988da7ff2ee699228c7868 100644 ---- a/dist/commands/publish/index.js -+++ b/dist/commands/publish/index.js -@@ -7468,7 +7468,9 @@ var require_src = __commonJS({ - this.runRootLifecycle = /^(pre|post)?version$/.test(process.env.npm_lifecycle_event) ? (stage) => { - this.logger.warn("lifecycle", "Skipping root %j because it has already been called", stage); - } : (stage) => this.runPackageLifecycle(this.project.manifest, stage); -- if (this.commitAndTag && this.gitOpts.amend !== true) { -+ if (this.options.skipCheckWorkingTree) { -+ this.logger.warn("version", "Skipping working tree validation, proceed at your own risk"); -+ } else if (this.commitAndTag && this.gitOpts.amend !== true) { - const { forcePublish, conventionalCommits, conventionalGraduate } = this.options; - const checkUncommittedOnly = forcePublish || conventionalCommits && conventionalGraduate; - const check = checkUncommittedOnly ? throwIfUncommitted : checkWorkingTree; -@@ -8191,6 +8193,10 @@ var require_src2 = __commonJS({ - } - } - verifyWorkingTreeClean() { -+ if (this.options.skipCheckWorkingTree) { -+ this.logger.warn("publish", "Skipping working tree check, proceed at your own risk"); -+ return Promise.resolve(); -+ } - return describeRef(this.execOpts).then(throwIfUncommitted); - } - async detectFromGit() { -diff --git a/dist/index.js b/dist/index.js -index 0860a73516147cec14807f56e381583212c9ccb1..0b4871926fbccc74437f7932cf9893e18898e263 100644 ---- a/dist/index.js -+++ b/dist/index.js -@@ -10018,7 +10018,9 @@ var require_src2 = __commonJS({ - this.runRootLifecycle = /^(pre|post)?version$/.test(process.env.npm_lifecycle_event) ? (stage) => { - this.logger.warn("lifecycle", "Skipping root %j because it has already been called", stage); - } : (stage) => this.runPackageLifecycle(this.project.manifest, stage); -- if (this.commitAndTag && this.gitOpts.amend !== true) { -+ if (this.options.skipCheckWorkingTree) { -+ this.logger.warn("version", "Skipping working tree validation, proceed at your own risk"); -+ } else if (this.commitAndTag && this.gitOpts.amend !== true) { - const { forcePublish, conventionalCommits, conventionalGraduate } = this.options; - const checkUncommittedOnly = forcePublish || conventionalCommits && conventionalGraduate; - const check = checkUncommittedOnly ? throwIfUncommitted : checkWorkingTree; -@@ -11512,6 +11514,10 @@ var require_src3 = __commonJS({ - } - } - verifyWorkingTreeClean() { -+ if (this.options.skipCheckWorkingTree) { -+ this.logger.warn("publish", "Skipping working tree check, proceed at your own risk"); -+ return Promise.resolve(); -+ } - return describeRef(this.execOpts).then(throwIfUncommitted); - } - async detectFromGit() { -@@ -12219,6 +12225,10 @@ var require_command10 = __commonJS({ - "include-private": { - describe: "Include specified private packages when publishing by temporarily removing the private property from the package manifest. This should only be used for testing private packages that will become public. Private packages should not usually be published. See the npm docs for details (https://docs.npmjs.com/cli/v9/configuring-npm/package-json#private).", - type: "array" -+ }, -+ "skip-check-working-tree": { -+ describe: "Skip the check for uncommitted changes in the working tree before publishing.", -+ type: "boolean" - } - }; - composeVersionOptions(yargs2); diff --git a/.yarn/patches/lerna-npm-9.0.6-162b638d8c.patch b/.yarn/patches/lerna-npm-9.0.6-162b638d8c.patch new file mode 100644 index 0000000000..ef360bf4c1 --- /dev/null +++ b/.yarn/patches/lerna-npm-9.0.6-162b638d8c.patch @@ -0,0 +1,13735 @@ +# Adds --skip-check-working-tree flag to `lerna publish` so that +# tools/verdaccio/spawn-verdaccio.ts can publish to a local registry +# with uncommitted changes. +# See https://github.com/lerna/lerna/issues/2329 +diff --git a/dist/commands/publish/command.js b/dist/commands/publish/command.js +index 50b3d3e430b7b78186447d8d40a977f7a89a4e08..6f25ee39c811ea971812a448540188d3b6c4cc7e 100644 +--- a/dist/commands/publish/command.js ++++ b/dist/commands/publish/command.js +@@ -7014,7 +7014,9 @@ var require_src = __commonJS({ + this.runRootLifecycle = /^(pre|post)?version$/.test(process.env.npm_lifecycle_event) ? (stage) => { + this.logger.warn("lifecycle", "Skipping root %j because it has already been called", stage); + } : (stage) => this.runPackageLifecycle(this.project.manifest, stage); +- if (this.commitAndTag && this.gitOpts.amend !== true) { ++ if (this.options.skipCheckWorkingTree) { ++ this.logger.warn("version", "Skipping working tree validation, proceed at your own risk"); ++ } else if (this.commitAndTag && this.gitOpts.amend !== true) { + const { forcePublish, conventionalCommits, conventionalGraduate } = this.options; + const checkUncommittedOnly = forcePublish || conventionalCommits && conventionalGraduate; + const check = checkUncommittedOnly ? throwIfUncommitted : checkWorkingTree; +@@ -8508,6 +8510,10 @@ var require_src2 = __commonJS({ + } + } + verifyWorkingTreeClean() { ++ if (this.options.skipCheckWorkingTree) { ++ this.logger.warn("publish", "Skipping working tree check, proceed at your own risk"); ++ return Promise.resolve(); ++ } + return describeRef(this.execOpts).then(throwIfUncommitted); + } + async detectFromGit() { +@@ -9215,6 +9221,10 @@ var require_command2 = __commonJS({ + "include-private": { + describe: "Include specified private packages when publishing by temporarily removing the private property from the package manifest. This should only be used for testing private packages that will become public. Private packages should not usually be published. See the npm docs for details (https://docs.npmjs.com/cli/v9/configuring-npm/package-json#private).", + type: "array" ++ }, ++ "skip-check-working-tree": { ++ describe: "Skip the check for uncommitted changes in the working tree before publishing.", ++ type: "boolean" + } + }; + composeVersionOptions(yargs2); +diff --git a/dist/commands/publish/index.js b/dist/commands/publish/index.js +index 7b22a62333512e89e908ada37156348e0dcd6f00..06f634ac0d4d1175613a089b28e519e47640a7f8 100644 +--- a/dist/commands/publish/index.js ++++ b/dist/commands/publish/index.js +@@ -7468,7 +7468,9 @@ var require_src = __commonJS({ + this.runRootLifecycle = /^(pre|post)?version$/.test(process.env.npm_lifecycle_event) ? (stage) => { + this.logger.warn("lifecycle", "Skipping root %j because it has already been called", stage); + } : (stage) => this.runPackageLifecycle(this.project.manifest, stage); +- if (this.commitAndTag && this.gitOpts.amend !== true) { ++ if (this.options.skipCheckWorkingTree) { ++ this.logger.warn("version", "Skipping working tree validation, proceed at your own risk"); ++ } else if (this.commitAndTag && this.gitOpts.amend !== true) { + const { forcePublish, conventionalCommits, conventionalGraduate } = this.options; + const checkUncommittedOnly = forcePublish || conventionalCommits && conventionalGraduate; + const check = checkUncommittedOnly ? throwIfUncommitted : checkWorkingTree; +@@ -8191,6 +8193,10 @@ var require_src2 = __commonJS({ + } + } + verifyWorkingTreeClean() { ++ if (this.options.skipCheckWorkingTree) { ++ this.logger.warn("publish", "Skipping working tree check, proceed at your own risk"); ++ return Promise.resolve(); ++ } + return describeRef(this.execOpts).then(throwIfUncommitted); + } + async detectFromGit() { +diff --git a/dist/index.js b/dist/index.js +index 2d421c71b17076f82a8b1223191c57dc8ccbb1f7..4f4a3405f16594eb03c01a3993ff7053afebd474 100644 +--- a/dist/index.js ++++ b/dist/index.js +@@ -10550,7 +10550,9 @@ var require_src3 = __commonJS({ + this.runRootLifecycle = /^(pre|post)?version$/.test(process.env.npm_lifecycle_event) ? (stage) => { + this.logger.warn("lifecycle", "Skipping root %j because it has already been called", stage); + } : (stage) => this.runPackageLifecycle(this.project.manifest, stage); +- if (this.commitAndTag && this.gitOpts.amend !== true) { ++ if (this.options.skipCheckWorkingTree) { ++ this.logger.warn("version", "Skipping working tree validation, proceed at your own risk"); ++ } else if (this.commitAndTag && this.gitOpts.amend !== true) { + const { forcePublish, conventionalCommits, conventionalGraduate } = this.options; + const checkUncommittedOnly = forcePublish || conventionalCommits && conventionalGraduate; + const check = checkUncommittedOnly ? throwIfUncommitted : checkWorkingTree; +@@ -12044,6 +12046,10 @@ var require_src4 = __commonJS({ + } + } + verifyWorkingTreeClean() { ++ if (this.options.skipCheckWorkingTree) { ++ this.logger.warn("publish", "Skipping working tree check, proceed at your own risk"); ++ return Promise.resolve(); ++ } + return describeRef(this.execOpts).then(throwIfUncommitted); + } + async detectFromGit() { +@@ -12751,6 +12757,10 @@ var require_command11 = __commonJS({ + "include-private": { + describe: "Include specified private packages when publishing by temporarily removing the private property from the package manifest. This should only be used for testing private packages that will become public. Private packages should not usually be published. See the npm docs for details (https://docs.npmjs.com/cli/v9/configuring-npm/package-json#private).", + type: "array" ++ }, ++ "skip-check-working-tree": { ++ describe: "Skip the check for uncommitted changes in the working tree before publishing.", ++ type: "boolean" + } + }; + composeVersionOptions(yargs2); +diff --git a/dist/index.js.orig b/dist/index.js.orig +new file mode 100644 +index 0000000000000000000000000000000000000000..2d421c71b17076f82a8b1223191c57dc8ccbb1f7 +--- /dev/null ++++ b/dist/index.js.orig +@@ -0,0 +1,13625 @@ ++"use strict"; ++var __create = Object.create; ++var __defProp = Object.defineProperty; ++var __getOwnPropDesc = Object.getOwnPropertyDescriptor; ++var __getOwnPropNames = Object.getOwnPropertyNames; ++var __getProtoOf = Object.getPrototypeOf; ++var __hasOwnProp = Object.prototype.hasOwnProperty; ++var __esm = (fn, res) => function __init() { ++ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; ++}; ++var __commonJS = (cb, mod) => function __require() { ++ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; ++}; ++var __export = (target, all) => { ++ for (var name in all) ++ __defProp(target, name, { get: all[name], enumerable: true }); ++}; ++var __copyProps = (to, from, except, desc) => { ++ if (from && typeof from === "object" || typeof from === "function") { ++ for (let key of __getOwnPropNames(from)) ++ if (!__hasOwnProp.call(to, key) && key !== except) ++ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); ++ } ++ return to; ++}; ++var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( ++ // If the importer is in node compatibility mode or this is not an ESM ++ // file that has been converted to a CommonJS file using a Babel- ++ // compatible transform (i.e. "__esModule" has not been set), then set ++ // "default" to the CommonJS "module.exports" for node compatibility. ++ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, ++ mod ++)); ++var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); ++ ++// libs/core/src/lib/add-dependencies.ts ++function addDependencies(projects, projectGraph) { ++ const projectsLookup = new Set(projects.map((p) => p.name)); ++ const dependencies = projectGraph.localPackageDependencies; ++ const collected = /* @__PURE__ */ new Set(); ++ projects.forEach((currentNode) => { ++ if (dependencies[currentNode.name] && dependencies[currentNode.name].length === 0) { ++ return; ++ } ++ const queue2 = [currentNode]; ++ const seen = /* @__PURE__ */ new Set(); ++ while (queue2.length) { ++ const node = queue2.shift(); ++ dependencies[node.name]?.forEach(({ target }) => { ++ if (seen.has(target)) { ++ return; ++ } ++ seen.add(target); ++ if (target === currentNode.name || projectsLookup.has(target)) { ++ return; ++ } ++ const dependencyNode = projectGraph.nodes[target]; ++ collected.add(dependencyNode); ++ queue2.push(dependencyNode); ++ }); ++ } ++ }); ++ return Array.from(/* @__PURE__ */ new Set([...projects, ...collected])); ++} ++var init_add_dependencies = __esm({ ++ "libs/core/src/lib/add-dependencies.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/core/src/lib/add-dependents.ts ++function addDependents(projects, projectGraph) { ++ const projectsLookup = new Set(projects.map((p) => p.name)); ++ const dependents = Object.values(projectGraph.localPackageDependencies).flat().reduce( ++ (prev, next) => ({ ++ ...prev, ++ [next.target]: [...prev[next.target] || [], next.source] ++ }), ++ {} ++ ); ++ const collected = /* @__PURE__ */ new Set(); ++ projects.forEach((currentNode) => { ++ if (dependents[currentNode.name] && dependents[currentNode.name].length === 0) { ++ return; ++ } ++ const queue2 = [currentNode]; ++ const seen = /* @__PURE__ */ new Set(); ++ while (queue2.length) { ++ const node = queue2.shift(); ++ dependents[node.name]?.forEach((dep) => { ++ if (seen.has(dep)) { ++ return; ++ } ++ seen.add(dep); ++ if (dep === currentNode.name || projectsLookup.has(dep)) { ++ return; ++ } ++ const dependentNode = projectGraph.nodes[dep]; ++ collected.add(dependentNode); ++ queue2.push(dependentNode); ++ }); ++ } ++ }); ++ return Array.from(/* @__PURE__ */ new Set([...projects, ...collected])); ++} ++var init_add_dependents = __esm({ ++ "libs/core/src/lib/add-dependents.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/are-we-there-yet/tracker-base.ts ++var import_node_events, trackerId, TrackerBase; ++var init_tracker_base = __esm({ ++ "libs/core/src/lib/npmlog/are-we-there-yet/tracker-base.ts"() { ++ "use strict"; ++ import_node_events = __toESM(require("node:events")); ++ trackerId = 0; ++ TrackerBase = class extends import_node_events.default { ++ id; ++ name; ++ constructor(name = "") { ++ super(); ++ this.id = ++trackerId; ++ this.name = name; ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/are-we-there-yet/tracker.ts ++var Tracker; ++var init_tracker = __esm({ ++ "libs/core/src/lib/npmlog/are-we-there-yet/tracker.ts"() { ++ "use strict"; ++ init_tracker_base(); ++ Tracker = class extends TrackerBase { ++ workDone; ++ workTodo; ++ constructor(name, todo) { ++ super(name); ++ this.workDone = 0; ++ this.workTodo = todo || 0; ++ } ++ completed() { ++ return this.workTodo === 0 ? 0 : this.workDone / this.workTodo; ++ } ++ addWork(work) { ++ this.workTodo += work; ++ this.emit("change", this.name, this.completed(), this); ++ } ++ completeWork(work) { ++ this.workDone += work; ++ if (this.workDone > this.workTodo) { ++ this.workDone = this.workTodo; ++ } ++ this.emit("change", this.name, this.completed(), this); ++ } ++ finish() { ++ this.workTodo = this.workDone = 1; ++ this.emit("change", this.name, 1, this); ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/are-we-there-yet/tracker-stream.ts ++var import_node_stream, TrackerStream; ++var init_tracker_stream = __esm({ ++ "libs/core/src/lib/npmlog/are-we-there-yet/tracker-stream.ts"() { ++ "use strict"; ++ import_node_stream = __toESM(require("node:stream")); ++ init_tracker(); ++ TrackerStream = class extends import_node_stream.default.Transform { ++ tracker; ++ name; ++ id; ++ constructor(name, size = 0, options) { ++ super(options); ++ this.tracker = new Tracker(name, size); ++ this.name = name; ++ this.id = this.tracker.id; ++ this.tracker.on("change", this.trackerChange.bind(this)); ++ } ++ trackerChange(name, completion) { ++ this.emit("change", name, completion, this); ++ } ++ _transform(data, encoding, cb) { ++ this.tracker.completeWork(data.length ? data.length : 1); ++ this.push(data); ++ cb(); ++ } ++ _flush(cb) { ++ this.tracker.finish(); ++ cb(); ++ } ++ completed() { ++ return this.tracker.completed(); ++ } ++ addWork(work) { ++ return this.tracker.addWork(work); ++ } ++ finish() { ++ return this.tracker.finish(); ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/are-we-there-yet/tracker-group.ts ++function bubbleChange(trackerGroup) { ++ return function(name, completed, tracker) { ++ trackerGroup.completion[tracker.id] = completed; ++ if (trackerGroup.finished) { ++ return; ++ } ++ trackerGroup.emit("change", name || trackerGroup.name, trackerGroup.completed(), trackerGroup); ++ }; ++} ++var TrackerGroup; ++var init_tracker_group = __esm({ ++ "libs/core/src/lib/npmlog/are-we-there-yet/tracker-group.ts"() { ++ "use strict"; ++ init_tracker(); ++ init_tracker_base(); ++ init_tracker_stream(); ++ TrackerGroup = class _TrackerGroup extends TrackerBase { ++ parentGroup = null; ++ trackers = []; ++ completion = {}; ++ weight = {}; ++ totalWeight = 0; ++ finished = false; ++ bubbleChange = bubbleChange(this); ++ nameInTree() { ++ const names = []; ++ let from = this; ++ while (from) { ++ names.unshift(from.name); ++ from = from.parentGroup; ++ } ++ return names.join("/"); ++ } ++ addUnit(unit, weight = 0) { ++ if (unit.addUnit) { ++ let toTest = this; ++ while (toTest) { ++ if (unit === toTest) { ++ throw new Error( ++ "Attempted to add tracker group " + unit.name + " to tree that already includes it " + this.nameInTree() ++ ); ++ } ++ toTest = toTest.parentGroup; ++ } ++ unit.parentGroup = this; ++ } ++ this.weight[unit.id] = weight || 1; ++ this.totalWeight += this.weight[unit.id]; ++ this.trackers.push(unit); ++ this.completion[unit.id] = unit.completed(); ++ unit.on("change", this.bubbleChange); ++ if (!this.finished) { ++ this.emit("change", unit.name, this.completion[unit.id], unit); ++ } ++ return unit; ++ } ++ completed() { ++ if (this.trackers.length === 0) { ++ return 0; ++ } ++ const valPerWeight = 1 / this.totalWeight; ++ let completed = 0; ++ for (let ii = 0; ii < this.trackers.length; ii++) { ++ const trackerId2 = this.trackers[ii].id; ++ completed += valPerWeight * this.weight[trackerId2] * this.completion[trackerId2]; ++ } ++ return completed; ++ } ++ newGroup(name, weight = 0) { ++ return this.addUnit(new _TrackerGroup(name), weight); ++ } ++ newItem(name, todo, weight = 0) { ++ return this.addUnit(new Tracker(name, todo), weight); ++ } ++ newStream(name, todo, weight = 0) { ++ return this.addUnit(new TrackerStream(name, todo), weight); ++ } ++ finish() { ++ this.finished = true; ++ if (!this.trackers.length) { ++ this.addUnit(new Tracker(), 1); ++ } ++ for (let ii = 0; ii < this.trackers.length; ii++) { ++ const tracker = this.trackers[ii]; ++ tracker.finish(); ++ tracker.removeListener("change", this.bubbleChange); ++ } ++ this.emit("change", this.name, 1, this); ++ } ++ debug(depth = 0) { ++ const indent = " ".repeat(depth); ++ let output2 = `${indent}${this.name || "top"}: ${this.completed()} ++`; ++ this.trackers.forEach(function(tracker) { ++ output2 += tracker instanceof _TrackerGroup ? tracker.debug(depth + 1) : `${indent} ${tracker.name}: ${tracker.completed()} ++`; ++ }); ++ return output2; ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/wide-truncate.ts ++var require_wide_truncate = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/wide-truncate.ts"(exports2, module2) { ++ "use strict"; ++ var stringWidth = require("string-width"); ++ var util5 = require("node:util"); ++ module2.exports = wideTruncate; ++ function wideTruncate(str, target) { ++ if (stringWidth(str) === 0) { ++ return str; ++ } ++ if (target <= 0) { ++ return ""; ++ } ++ if (stringWidth(str) <= target) { ++ return str; ++ } ++ var noAnsi = util5.stripVTControlCharacters(str); ++ var ansiSize = str.length + noAnsi.length; ++ var truncated = str.slice(0, target + ansiSize); ++ while (stringWidth(truncated) > target) { ++ truncated = truncated.slice(0, -1); ++ } ++ return truncated; ++ } ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/error.ts ++var require_error = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/error.ts"(exports2) { ++ "use strict"; ++ var util5 = require("util"); ++ var User = exports2.User = function User2(msg) { ++ var err = new Error(msg); ++ Error.captureStackTrace(err, User2); ++ err.code = "EGAUGE"; ++ return err; ++ }; ++ exports2.MissingTemplateValue = function MissingTemplateValue(item, values) { ++ var err = new User(util5.format('Missing template value "%s"', item.type)); ++ Error.captureStackTrace(err, MissingTemplateValue); ++ err.template = item; ++ err.values = values; ++ return err; ++ }; ++ exports2.Internal = function Internal(msg) { ++ var err = new Error(msg); ++ Error.captureStackTrace(err, Internal); ++ err.code = "EGAUGEINTERNAL"; ++ return err; ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/template-item.ts ++var require_template_item = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/template-item.ts"(exports2, module2) { ++ "use strict"; ++ var stringWidth = require("string-width"); ++ module2.exports = TemplateItem; ++ function isPercent(num) { ++ if (typeof num !== "string") { ++ return false; ++ } ++ return num.slice(-1) === "%"; ++ } ++ function percent(num) { ++ return Number(num.slice(0, -1)) / 100; ++ } ++ function TemplateItem(values, outputLength) { ++ this.overallOutputLength = outputLength; ++ this.finished = false; ++ this.type = null; ++ this.value = null; ++ this.length = null; ++ this.maxLength = null; ++ this.minLength = null; ++ this.kerning = null; ++ this.align = "left"; ++ this.padLeft = 0; ++ this.padRight = 0; ++ this.index = null; ++ this.first = null; ++ this.last = null; ++ if (typeof values === "string") { ++ this.value = values; ++ } else { ++ for (var prop in values) { ++ this[prop] = values[prop]; ++ } ++ } ++ if (isPercent(this.length)) { ++ this.length = Math.round(this.overallOutputLength * percent(this.length)); ++ } ++ if (isPercent(this.minLength)) { ++ this.minLength = Math.round(this.overallOutputLength * percent(this.minLength)); ++ } ++ if (isPercent(this.maxLength)) { ++ this.maxLength = Math.round(this.overallOutputLength * percent(this.maxLength)); ++ } ++ return this; ++ } ++ TemplateItem.prototype = {}; ++ TemplateItem.prototype.getBaseLength = function() { ++ var length = this.length; ++ if (length == null && typeof this.value === "string" && this.maxLength == null && this.minLength == null) { ++ length = stringWidth(this.value); ++ } ++ return length; ++ }; ++ TemplateItem.prototype.getLength = function() { ++ var length = this.getBaseLength(); ++ if (length == null) { ++ return null; ++ } ++ return length + this.padLeft + this.padRight; ++ }; ++ TemplateItem.prototype.getMaxLength = function() { ++ if (this.maxLength == null) { ++ return null; ++ } ++ return this.maxLength + this.padLeft + this.padRight; ++ }; ++ TemplateItem.prototype.getMinLength = function() { ++ if (this.minLength == null) { ++ return null; ++ } ++ return this.minLength + this.padLeft + this.padRight; ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/render-template.ts ++var require_render_template = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/render-template.ts"(exports2, module2) { ++ "use strict"; ++ var align = require("wide-align"); ++ var validate = require("aproba"); ++ var wideTruncate = require_wide_truncate(); ++ var error = require_error(); ++ var TemplateItem = require_template_item(); ++ function renderValueWithValues(values) { ++ return function(item) { ++ return renderValue(item, values); ++ }; ++ } ++ var renderTemplate = module2.exports = function(width, template, values) { ++ var items = prepareItems(width, template, values); ++ var rendered = items.map(renderValueWithValues(values)).join(""); ++ return align.left(wideTruncate(rendered, width), width); ++ }; ++ function preType(item) { ++ var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1); ++ return "pre" + cappedTypeName; ++ } ++ function postType(item) { ++ var cappedTypeName = item.type[0].toUpperCase() + item.type.slice(1); ++ return "post" + cappedTypeName; ++ } ++ function hasPreOrPost(item, values) { ++ if (!item.type) { ++ return; ++ } ++ return values[preType(item)] || values[postType(item)]; ++ } ++ function generatePreAndPost(baseItem, parentValues) { ++ var item = Object.assign({}, baseItem); ++ var values = Object.create(parentValues); ++ var template = []; ++ var pre = preType(item); ++ var post = postType(item); ++ if (values[pre]) { ++ template.push({ value: values[pre] }); ++ values[pre] = null; ++ } ++ item.minLength = null; ++ item.length = null; ++ item.maxLength = null; ++ template.push(item); ++ values[item.type] = values[item.type]; ++ if (values[post]) { ++ template.push({ value: values[post] }); ++ values[post] = null; ++ } ++ return function($1, $2, length) { ++ return renderTemplate(length, template, values); ++ }; ++ } ++ function prepareItems(width, template, values) { ++ function cloneAndObjectify(item, index, arr) { ++ var cloned = new TemplateItem(item, width); ++ var type = cloned.type; ++ if (cloned.value == null) { ++ if (!(type in values)) { ++ if (cloned.default == null) { ++ throw new error.MissingTemplateValue(cloned, values); ++ } else { ++ cloned.value = cloned.default; ++ } ++ } else { ++ cloned.value = values[type]; ++ } ++ } ++ if (cloned.value == null || cloned.value === "") { ++ return null; ++ } ++ cloned.index = index; ++ cloned.first = index === 0; ++ cloned.last = index === arr.length - 1; ++ if (hasPreOrPost(cloned, values)) { ++ cloned.value = generatePreAndPost(cloned, values); ++ } ++ return cloned; ++ } ++ var output2 = template.map(cloneAndObjectify).filter(function(item) { ++ return item != null; ++ }); ++ var remainingSpace = width; ++ var variableCount = output2.length; ++ function consumeSpace(length) { ++ if (length > remainingSpace) { ++ length = remainingSpace; ++ } ++ remainingSpace -= length; ++ } ++ function finishSizing(item, length) { ++ if (item.finished) { ++ throw new error.Internal("Tried to finish template item that was already finished"); ++ } ++ if (length === Infinity) { ++ throw new error.Internal("Length of template item cannot be infinity"); ++ } ++ if (length != null) { ++ item.length = length; ++ } ++ item.minLength = null; ++ item.maxLength = null; ++ --variableCount; ++ item.finished = true; ++ if (item.length == null) { ++ item.length = item.getBaseLength(); ++ } ++ if (item.length == null) { ++ throw new error.Internal("Finished template items must have a length"); ++ } ++ consumeSpace(item.getLength()); ++ } ++ output2.forEach(function(item) { ++ if (!item.kerning) { ++ return; ++ } ++ var prevPadRight = item.first ? 0 : output2[item.index - 1].padRight; ++ if (!item.first && prevPadRight < item.kerning) { ++ item.padLeft = item.kerning - prevPadRight; ++ } ++ if (!item.last) { ++ item.padRight = item.kerning; ++ } ++ }); ++ output2.forEach(function(item) { ++ if (item.getBaseLength() == null) { ++ return; ++ } ++ finishSizing(item); ++ }); ++ var resized = 0; ++ var resizing; ++ var hunkSize; ++ do { ++ resizing = false; ++ hunkSize = Math.round(remainingSpace / variableCount); ++ output2.forEach(function(item) { ++ if (item.finished) { ++ return; ++ } ++ if (!item.maxLength) { ++ return; ++ } ++ if (item.getMaxLength() < hunkSize) { ++ finishSizing(item, item.maxLength); ++ resizing = true; ++ } ++ }); ++ } while (resizing && resized++ < output2.length); ++ if (resizing) { ++ throw new error.Internal("Resize loop iterated too many times while determining maxLength"); ++ } ++ resized = 0; ++ do { ++ resizing = false; ++ hunkSize = Math.round(remainingSpace / variableCount); ++ output2.forEach(function(item) { ++ if (item.finished) { ++ return; ++ } ++ if (!item.minLength) { ++ return; ++ } ++ if (item.getMinLength() >= hunkSize) { ++ finishSizing(item, item.minLength); ++ resizing = true; ++ } ++ }); ++ } while (resizing && resized++ < output2.length); ++ if (resizing) { ++ throw new error.Internal("Resize loop iterated too many times while determining minLength"); ++ } ++ hunkSize = Math.round(remainingSpace / variableCount); ++ output2.forEach(function(item) { ++ if (item.finished) { ++ return; ++ } ++ finishSizing(item, hunkSize); ++ }); ++ return output2; ++ } ++ function renderFunction(item, values, length) { ++ validate("OON", arguments); ++ if (item.type) { ++ return item.value(values, values[item.type + "Theme"] || {}, length); ++ } else { ++ return item.value(values, {}, length); ++ } ++ } ++ function renderValue(item, values) { ++ var length = item.getBaseLength(); ++ var value = typeof item.value === "function" ? renderFunction(item, values, length) : item.value; ++ if (value == null || value === "") { ++ return ""; ++ } ++ var alignWith = align[item.align] || align.left; ++ var leftPadding = item.padLeft ? align.left("", item.padLeft) : ""; ++ var rightPadding = item.padRight ? align.right("", item.padRight) : ""; ++ var truncated = wideTruncate(String(value), length); ++ var aligned = alignWith(truncated, length); ++ return leftPadding + aligned + rightPadding; ++ } ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/plumbing.ts ++var require_plumbing = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/plumbing.ts"(exports2, module2) { ++ "use strict"; ++ var consoleControl2 = require("console-control-strings"); ++ var renderTemplate = require_render_template(); ++ var validate = require("aproba"); ++ var Plumbing2 = module2.exports = function(theme, template, width) { ++ if (!width) { ++ width = 80; ++ } ++ validate("OAN", [theme, template, width]); ++ this.showing = false; ++ this.theme = theme; ++ this.width = width; ++ this.template = template; ++ }; ++ Plumbing2.prototype = {}; ++ Plumbing2.prototype.setTheme = function(theme) { ++ validate("O", [theme]); ++ this.theme = theme; ++ }; ++ Plumbing2.prototype.setTemplate = function(template) { ++ validate("A", [template]); ++ this.template = template; ++ }; ++ Plumbing2.prototype.setWidth = function(width) { ++ validate("N", [width]); ++ this.width = width; ++ }; ++ Plumbing2.prototype.hide = function() { ++ return consoleControl2.gotoSOL() + consoleControl2.eraseLine(); ++ }; ++ Plumbing2.prototype.hideCursor = consoleControl2.hideCursor; ++ Plumbing2.prototype.showCursor = consoleControl2.showCursor; ++ Plumbing2.prototype.show = function(status) { ++ var values = Object.create(this.theme); ++ for (var key in status) { ++ values[key] = status[key]; ++ } ++ return renderTemplate(this.width, this.template, values).trim() + consoleControl2.color("reset") + consoleControl2.eraseLine() + consoleControl2.gotoSOL(); ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/has-color.ts ++var require_has_color = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/has-color.ts"(exports2, module2) { ++ "use strict"; ++ var colorSupport = require("color-support"); ++ module2.exports = colorSupport().hasBasic; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/spin.ts ++var require_spin = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/spin.ts"(exports2, module2) { ++ "use strict"; ++ module2.exports = function spin(spinstr, spun) { ++ return spinstr[spun % spinstr.length]; ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/progress-bar.ts ++var require_progress_bar = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/progress-bar.ts"(exports2, module2) { ++ "use strict"; ++ var validate = require("aproba"); ++ var renderTemplate = require_render_template(); ++ var wideTruncate = require_wide_truncate(); ++ var stringWidth = require("string-width"); ++ module2.exports = function(theme, width, completed) { ++ validate("ONN", [theme, width, completed]); ++ if (completed < 0) { ++ completed = 0; ++ } ++ if (completed > 1) { ++ completed = 1; ++ } ++ if (width <= 0) { ++ return ""; ++ } ++ var sofar = Math.round(width * completed); ++ var rest = width - sofar; ++ var template = [ ++ { type: "complete", value: repeat(theme.complete, sofar), length: sofar }, ++ { type: "remaining", value: repeat(theme.remaining, rest), length: rest } ++ ]; ++ return renderTemplate(width, template, theme); ++ }; ++ function repeat(string, width) { ++ var result = ""; ++ var n = width; ++ do { ++ if (n % 2) { ++ result += string; ++ } ++ n = Math.floor(n / 2); ++ string += string; ++ } while (n && stringWidth(result) < width); ++ return wideTruncate(result, width); ++ } ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/base-theme.ts ++var require_base_theme = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/base-theme.ts"(exports2, module2) { ++ "use strict"; ++ var spin = require_spin(); ++ var progressBar = require_progress_bar(); ++ module2.exports = { ++ activityIndicator: function(values, theme) { ++ if (values.spun == null) { ++ return; ++ } ++ return spin(theme, values.spun); ++ }, ++ progressbar: function(values, theme, width) { ++ if (values.completed == null) { ++ return; ++ } ++ return progressBar(theme, width, values.completed); ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/theme-set.ts ++var require_theme_set = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/theme-set.ts"(exports2, module2) { ++ "use strict"; ++ module2.exports = function() { ++ return ThemeSetProto.newThemeSet(); ++ }; ++ var ThemeSetProto = {}; ++ ThemeSetProto.baseTheme = require_base_theme(); ++ ThemeSetProto.newTheme = function(parent, theme) { ++ if (!theme) { ++ theme = parent; ++ parent = this.baseTheme; ++ } ++ return Object.assign({}, parent, theme); ++ }; ++ ThemeSetProto.getThemeNames = function() { ++ return Object.keys(this.themes); ++ }; ++ ThemeSetProto.addTheme = function(name, parent, theme) { ++ this.themes[name] = this.newTheme(parent, theme); ++ }; ++ ThemeSetProto.addToAllThemes = function(theme) { ++ var themes = this.themes; ++ Object.keys(themes).forEach(function(name) { ++ Object.assign(themes[name], theme); ++ }); ++ Object.assign(this.baseTheme, theme); ++ }; ++ ThemeSetProto.getTheme = function(name) { ++ if (!this.themes[name]) { ++ throw this.newMissingThemeError(name); ++ } ++ return this.themes[name]; ++ }; ++ ThemeSetProto.setDefault = function(opts, name) { ++ if (name == null) { ++ name = opts; ++ opts = {}; ++ } ++ var platform = opts.platform == null ? "fallback" : opts.platform; ++ var hasUnicode3 = !!opts.hasUnicode; ++ var hasColor2 = !!opts.hasColor; ++ if (!this.defaults[platform]) { ++ this.defaults[platform] = { true: {}, false: {} }; ++ } ++ this.defaults[platform][hasUnicode3][hasColor2] = name; ++ }; ++ ThemeSetProto.getDefault = function(opts) { ++ if (!opts) { ++ opts = {}; ++ } ++ var platformName = opts.platform || process.platform; ++ var platform = this.defaults[platformName] || this.defaults.fallback; ++ var hasUnicode3 = !!opts.hasUnicode; ++ var hasColor2 = !!opts.hasColor; ++ if (!platform) { ++ throw this.newMissingDefaultThemeError(platformName, hasUnicode3, hasColor2); ++ } ++ if (!platform[hasUnicode3][hasColor2]) { ++ if (hasUnicode3 && hasColor2 && platform[!hasUnicode3][hasColor2]) { ++ hasUnicode3 = false; ++ } else if (hasUnicode3 && hasColor2 && platform[hasUnicode3][!hasColor2]) { ++ hasColor2 = false; ++ } else if (hasUnicode3 && hasColor2 && platform[!hasUnicode3][!hasColor2]) { ++ hasUnicode3 = false; ++ hasColor2 = false; ++ } else if (hasUnicode3 && !hasColor2 && platform[!hasUnicode3][hasColor2]) { ++ hasUnicode3 = false; ++ } else if (!hasUnicode3 && hasColor2 && platform[hasUnicode3][!hasColor2]) { ++ hasColor2 = false; ++ } else if (platform === this.defaults.fallback) { ++ throw this.newMissingDefaultThemeError(platformName, hasUnicode3, hasColor2); ++ } ++ } ++ if (platform[hasUnicode3][hasColor2]) { ++ return this.getTheme(platform[hasUnicode3][hasColor2]); ++ } else { ++ return this.getDefault(Object.assign({}, opts, { platform: "fallback" })); ++ } ++ }; ++ ThemeSetProto.newMissingThemeError = function newMissingThemeError(name) { ++ var err = new Error('Could not find a gauge theme named "' + name + '"'); ++ Error.captureStackTrace.call(err, newMissingThemeError); ++ err.theme = name; ++ err.code = "EMISSINGTHEME"; ++ return err; ++ }; ++ ThemeSetProto.newMissingDefaultThemeError = function newMissingDefaultThemeError(platformName, hasUnicode3, hasColor2) { ++ var err = new Error( ++ "Could not find a gauge theme for your platform/unicode/color use combo:\n platform = " + platformName + "\n hasUnicode = " + hasUnicode3 + "\n hasColor = " + hasColor2 ++ ); ++ Error.captureStackTrace.call(err, newMissingDefaultThemeError); ++ err.platform = platformName; ++ err.hasUnicode = hasUnicode3; ++ err.hasColor = hasColor2; ++ err.code = "EMISSINGTHEME"; ++ return err; ++ }; ++ ThemeSetProto.newThemeSet = function() { ++ var themeset = function(opts) { ++ return themeset.getDefault(opts); ++ }; ++ return Object.assign(themeset, ThemeSetProto, { ++ themes: Object.assign({}, this.themes), ++ baseTheme: Object.assign({}, this.baseTheme), ++ defaults: JSON.parse(JSON.stringify(this.defaults || {})) ++ }); ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/themes.ts ++var require_themes = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/themes.ts"(exports2, module2) { ++ "use strict"; ++ var color = require("console-control-strings").color; ++ var ThemeSet = require_theme_set(); ++ var themes = module2.exports = new ThemeSet(); ++ themes.addTheme("ASCII", { ++ preProgressbar: "[", ++ postProgressbar: "]", ++ progressbarTheme: { ++ complete: "#", ++ remaining: "." ++ }, ++ activityIndicatorTheme: "-\\|/", ++ preSubsection: ">" ++ }); ++ themes.addTheme("colorASCII", themes.getTheme("ASCII"), { ++ progressbarTheme: { ++ preComplete: color("bgBrightWhite", "brightWhite"), ++ complete: "#", ++ postComplete: color("reset"), ++ preRemaining: color("bgBrightBlack", "brightBlack"), ++ remaining: ".", ++ postRemaining: color("reset") ++ } ++ }); ++ themes.addTheme("brailleSpinner", { ++ preProgressbar: "(", ++ postProgressbar: ")", ++ progressbarTheme: { ++ complete: "#", ++ remaining: "\u2802" ++ }, ++ activityIndicatorTheme: "\u280B\u2819\u2839\u2838\u283C\u2834\u2826\u2827\u2807\u280F", ++ preSubsection: ">" ++ }); ++ themes.addTheme("colorBrailleSpinner", themes.getTheme("brailleSpinner"), { ++ progressbarTheme: { ++ preComplete: color("bgBrightWhite", "brightWhite"), ++ complete: "#", ++ postComplete: color("reset"), ++ preRemaining: color("bgBrightBlack", "brightBlack"), ++ remaining: "\u2802", ++ postRemaining: color("reset") ++ } ++ }); ++ themes.setDefault({}, "ASCII"); ++ themes.setDefault({ hasColor: true }, "colorASCII"); ++ themes.setDefault({ platform: "darwin", hasUnicode: true }, "brailleSpinner"); ++ themes.setDefault({ platform: "darwin", hasUnicode: true, hasColor: true }, "colorBrailleSpinner"); ++ themes.setDefault({ platform: "linux", hasUnicode: true }, "brailleSpinner"); ++ themes.setDefault({ platform: "linux", hasUnicode: true, hasColor: true }, "colorBrailleSpinner"); ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/set-interval.ts ++var require_set_interval = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/set-interval.ts"(exports2, module2) { ++ "use strict"; ++ module2.exports = setInterval; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/process.ts ++var require_process = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/process.ts"(exports2, module2) { ++ "use strict"; ++ module2.exports = process; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/set-immediate.ts ++var require_set_immediate = __commonJS({ ++ "libs/core/src/lib/npmlog/gauge/set-immediate.ts"(exports2, module2) { ++ "use strict"; ++ var process3 = require_process(); ++ try { ++ module2.exports = setImmediate; ++ } catch (ex) { ++ module2.exports = process3.nextTick; ++ } ++ } ++}); ++ ++// libs/core/src/lib/npmlog/gauge/index.ts ++function callWith(obj, method) { ++ return function() { ++ return method.call(obj); ++ }; ++} ++var import_signal_exit, hasUnicode, Plumbing, hasColor, defaultThemes, setInterval2, process2, setImmediate2, Gauge; ++var init_gauge = __esm({ ++ "libs/core/src/lib/npmlog/gauge/index.ts"() { ++ "use strict"; ++ import_signal_exit = __toESM(require("signal-exit")); ++ hasUnicode = require("has-unicode"); ++ Plumbing = require_plumbing(); ++ hasColor = require_has_color(); ++ defaultThemes = require_themes(); ++ setInterval2 = require_set_interval(); ++ process2 = require_process(); ++ setImmediate2 = require_set_immediate(); ++ Gauge = class { ++ _status; ++ _paused; ++ _disabled; ++ _showing; ++ _onScreen; ++ _needsRedraw; ++ _hideCursor; ++ _fixedFramerate; ++ _lastUpdateAt; ++ _updateInterval; ++ _themes; ++ _theme; ++ _gauge; ++ _tty; ++ _writeTo; ++ _$$doRedraw; ++ _$$handleSizeChange; ++ _cleanupOnExit; ++ _removeOnExit; ++ redrawTracker; ++ constructor(arg1, arg2) { ++ let options, writeTo; ++ if (arg1 && arg1.write) { ++ writeTo = arg1; ++ options = arg2 || {}; ++ } else if (arg2 && arg2.write) { ++ writeTo = arg2; ++ options = arg1 || {}; ++ } else { ++ writeTo = process2.stderr; ++ options = arg1 || arg2 || {}; ++ } ++ this._status = { ++ spun: 0, ++ section: "", ++ subsection: "" ++ }; ++ this._paused = false; ++ this._disabled = true; ++ this._showing = false; ++ this._onScreen = false; ++ this._needsRedraw = false; ++ this._hideCursor = options.hideCursor == null ? true : options.hideCursor; ++ this._fixedFramerate = options.fixedFramerate == null ? !/^v0\.8\./.test(process2.version) : options.fixedFramerate; ++ this._lastUpdateAt = null; ++ this._updateInterval = options.updateInterval == null ? 50 : options.updateInterval; ++ this._themes = options.themes || defaultThemes; ++ this._theme = options.theme; ++ const theme = this._computeTheme(options.theme); ++ const template = options.template || [ ++ { type: "progressbar", length: 20 }, ++ { type: "activityIndicator", kerning: 1, length: 1 }, ++ { type: "section", kerning: 1, default: "" }, ++ { type: "subsection", kerning: 1, default: "" } ++ ]; ++ this.setWriteTo(writeTo, options.tty); ++ const PlumbingClass = options.Plumbing || Plumbing; ++ this._gauge = new PlumbingClass(theme, template, this.getWidth()); ++ this._$$doRedraw = callWith(this, this._doRedraw); ++ this._$$handleSizeChange = callWith(this, this._handleSizeChange); ++ this._cleanupOnExit = options.cleanupOnExit == null || options.cleanupOnExit; ++ this._removeOnExit = null; ++ if (options.enabled || options.enabled == null && this._tty && this._tty.isTTY) { ++ this.enable(); ++ } else { ++ this.disable(); ++ } ++ } ++ isEnabled() { ++ return !this._disabled; ++ } ++ setTemplate(template) { ++ this._gauge.setTemplate(template); ++ if (this._showing) { ++ this._requestRedraw(); ++ } ++ } ++ _computeTheme(theme) { ++ if (!theme) { ++ theme = {}; ++ } ++ if (typeof theme === "string") { ++ theme = this._themes.getTheme(theme); ++ } else if (Object.keys(theme).length === 0 || theme.hasUnicode != null || theme.hasColor != null) { ++ const useUnicode = theme.hasUnicode == null ? hasUnicode() : theme.hasUnicode; ++ const useColor = theme.hasColor == null ? hasColor : theme.hasColor; ++ theme = this._themes.getDefault({ ++ hasUnicode: useUnicode, ++ hasColor: useColor, ++ platform: theme.platform ++ }); ++ } ++ return theme; ++ } ++ setThemeset(themes) { ++ this._themes = themes; ++ this.setTheme(this._theme); ++ } ++ setTheme(theme) { ++ this._gauge.setTheme(this._computeTheme(theme)); ++ if (this._showing) { ++ this._requestRedraw(); ++ } ++ this._theme = theme; ++ } ++ _requestRedraw() { ++ this._needsRedraw = true; ++ if (!this._fixedFramerate) { ++ this._doRedraw(); ++ } ++ } ++ getWidth() { ++ return (this._tty && this._tty.columns || 80) - 1; ++ } ++ setWriteTo(writeTo, tty) { ++ const enabled = !this._disabled; ++ if (enabled) { ++ this.disable(); ++ } ++ this._writeTo = writeTo; ++ this._tty = tty || writeTo === process2.stderr && process2.stdout.isTTY && process2.stdout || writeTo.isTTY && writeTo || this._tty; ++ if (this._gauge) { ++ this._gauge.setWidth(this.getWidth()); ++ } ++ if (enabled) { ++ this.enable(); ++ } ++ } ++ enable() { ++ if (!this._disabled) { ++ return; ++ } ++ this._disabled = false; ++ if (this._tty) { ++ this._enableEvents(); ++ } ++ if (this._showing) { ++ this.show(); ++ } ++ } ++ disable() { ++ if (this._disabled) { ++ return; ++ } ++ if (this._showing) { ++ this._lastUpdateAt = null; ++ this._showing = false; ++ this._doRedraw(); ++ this._showing = true; ++ } ++ this._disabled = true; ++ if (this._tty) { ++ this._disableEvents(); ++ } ++ } ++ _enableEvents() { ++ if (this._cleanupOnExit) { ++ this._removeOnExit = (0, import_signal_exit.default)(callWith(this, this.disable)); ++ } ++ this._tty.on("resize", this._$$handleSizeChange); ++ if (this._fixedFramerate) { ++ this.redrawTracker = setInterval2(this._$$doRedraw, this._updateInterval); ++ if (this.redrawTracker.unref) { ++ this.redrawTracker.unref(); ++ } ++ } ++ } ++ _disableEvents() { ++ this._tty.removeListener("resize", this._$$handleSizeChange); ++ if (this._fixedFramerate) { ++ clearInterval(this.redrawTracker); ++ } ++ if (this._removeOnExit) { ++ this._removeOnExit(); ++ } ++ } ++ hide(cb) { ++ if (this._disabled) { ++ return cb && process2.nextTick(cb); ++ } ++ if (!this._showing) { ++ return cb && process2.nextTick(cb); ++ } ++ this._showing = false; ++ this._doRedraw(); ++ cb && setImmediate2(cb); ++ } ++ show(section, completed) { ++ this._showing = true; ++ if (typeof section === "string") { ++ this._status.section = section; ++ } else if (typeof section === "object") { ++ const sectionKeys = Object.keys(section); ++ for (let ii = 0; ii < sectionKeys.length; ++ii) { ++ const key = sectionKeys[ii]; ++ this._status[key] = section[key]; ++ } ++ } ++ if (completed != null) { ++ this._status.completed = completed; ++ } ++ if (this._disabled) { ++ return; ++ } ++ this._requestRedraw(); ++ } ++ pulse(subsection) { ++ this._status.subsection = subsection || ""; ++ this._status.spun++; ++ if (this._disabled) { ++ return; ++ } ++ if (!this._showing) { ++ return; ++ } ++ this._requestRedraw(); ++ } ++ _handleSizeChange() { ++ this._gauge.setWidth(this._tty.columns - 1); ++ this._requestRedraw(); ++ } ++ _doRedraw() { ++ if (this._disabled || this._paused) { ++ return; ++ } ++ if (!this._fixedFramerate) { ++ const now = Date.now(); ++ if (this._lastUpdateAt && now - this._lastUpdateAt < this._updateInterval) { ++ return; ++ } ++ this._lastUpdateAt = now; ++ } ++ if (!this._showing && this._onScreen) { ++ this._onScreen = false; ++ let result = this._gauge.hide(); ++ if (this._hideCursor) { ++ result += this._gauge.showCursor(); ++ } ++ return this._writeTo.write(result); ++ } ++ if (!this._showing && !this._onScreen) { ++ return; ++ } ++ if (this._showing && !this._onScreen) { ++ this._onScreen = true; ++ this._needsRedraw = true; ++ if (this._hideCursor) { ++ this._writeTo.write(this._gauge.hideCursor()); ++ } ++ } ++ if (!this._needsRedraw) { ++ return; ++ } ++ if (!this._writeTo.write(this._gauge.show(this._status))) { ++ this._paused = true; ++ this._writeTo.on( ++ "drain", ++ callWith(this, function() { ++ this._paused = false; ++ this._doRedraw(); ++ }) ++ ); ++ } ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npmlog/index.ts ++var import_node_events2, import_node_util, setBlocking, consoleControl, Logger, log, trackerConstructors, mixinLog, npmlog_default; ++var init_npmlog = __esm({ ++ "libs/core/src/lib/npmlog/index.ts"() { ++ "use strict"; ++ import_node_events2 = require("node:events"); ++ import_node_util = __toESM(require("node:util")); ++ init_tracker_group(); ++ init_gauge(); ++ setBlocking = require("set-blocking"); ++ consoleControl = require("console-control-strings"); ++ setBlocking(true); ++ Logger = class extends import_node_events2.EventEmitter { ++ _stream; ++ _paused; ++ _buffer; ++ unicodeEnabled; ++ colorEnabled; ++ id; ++ record; ++ maxRecordSize; ++ gauge; ++ tracker; ++ progressEnabled; ++ level; ++ prefixStyle; ++ headingStyle; ++ style; ++ levels; ++ disp; ++ heading; ++ // Known log levels, assigned dynamically in the constructor ++ silly; ++ verbose; ++ info; ++ timing; ++ http; ++ notice; ++ warn; ++ error; ++ silent; ++ constructor() { ++ super(); ++ this._stream = process.stderr; ++ this._paused = false; ++ this._buffer = []; ++ this.unicodeEnabled = false; ++ this.colorEnabled = void 0; ++ this.id = 0; ++ this.record = []; ++ this.maxRecordSize = 1e4; ++ this.level = "info"; ++ this.prefixStyle = { fg: "magenta" }; ++ this.headingStyle = { fg: "white", bg: "black" }; ++ this.style = {}; ++ this.levels = {}; ++ this.disp = {}; ++ this.gauge = new Gauge(this._stream, { ++ enabled: false, ++ theme: { hasColor: this.useColor() }, ++ template: [ ++ { type: "progressbar", length: 20 }, ++ { type: "activityIndicator", kerning: 1, length: 1 }, ++ { type: "section", default: "" }, ++ ":", ++ { type: "logline", kerning: 1, default: "" } ++ ] ++ }); ++ this.tracker = new TrackerGroup(); ++ this.progressEnabled = this.gauge.isEnabled(); ++ this.addLevel("silly", -Infinity, { inverse: true }, "sill"); ++ this.addLevel("verbose", 1e3, { fg: "cyan", bg: "black" }, "verb"); ++ this.addLevel("info", 2e3, { fg: "green" }); ++ this.addLevel("timing", 2500, { fg: "green", bg: "black" }); ++ this.addLevel("http", 3e3, { fg: "green", bg: "black" }); ++ this.addLevel("notice", 3500, { fg: "cyan", bg: "black" }); ++ this.addLevel("warn", 4e3, { fg: "black", bg: "yellow" }, "WARN"); ++ this.addLevel("error", 5e3, { fg: "red", bg: "black" }, "ERR!"); ++ this.addLevel("silent", Infinity); ++ this.on("error", () => { ++ }); ++ } ++ get stream() { ++ return this._stream; ++ } ++ set stream(newStream) { ++ this._stream = newStream; ++ if (this.gauge) { ++ this.gauge.setWriteTo(this._stream, this._stream); ++ } ++ } ++ useColor() { ++ return this.colorEnabled != null ? this.colorEnabled : this._stream?.isTTY ?? false; ++ } ++ enableColor() { ++ this.colorEnabled = true; ++ this.gauge.setTheme({ hasColor: this.colorEnabled, hasUnicode: this.unicodeEnabled }); ++ } ++ disableColor() { ++ this.colorEnabled = false; ++ this.gauge.setTheme({ hasColor: this.colorEnabled, hasUnicode: this.unicodeEnabled }); ++ } ++ enableUnicode() { ++ this.unicodeEnabled = true; ++ this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: this.unicodeEnabled }); ++ } ++ disableUnicode() { ++ this.unicodeEnabled = false; ++ this.gauge.setTheme({ hasColor: this.useColor(), hasUnicode: this.unicodeEnabled }); ++ } ++ setGaugeThemeset(themes) { ++ this.gauge.setThemeset(themes); ++ } ++ setGaugeTemplate(template) { ++ this.gauge.setTemplate(template); ++ } ++ enableProgress() { ++ if (this.progressEnabled || this._paused) { ++ return; ++ } ++ this.progressEnabled = true; ++ this.tracker.on("change", this.showProgress.bind(this)); ++ this.gauge.enable(); ++ } ++ disableProgress() { ++ if (!this.progressEnabled) { ++ return; ++ } ++ this.progressEnabled = false; ++ this.tracker.removeListener("change", this.showProgress.bind(this)); ++ this.gauge.disable(); ++ } ++ clearProgress(cb) { ++ if (!this.progressEnabled) { ++ return cb && process.nextTick(cb); ++ } ++ this.gauge.hide(cb); ++ } ++ showProgress(name, completed) { ++ if (!this.progressEnabled) { ++ return; ++ } ++ const values = {}; ++ if (name) { ++ values.section = name; ++ } ++ const last = this.record[this.record.length - 1]; ++ if (last) { ++ values.subsection = last.prefix; ++ const disp = this.disp[last.level]; ++ let logline = this._format(disp, this.style[last.level]); ++ if (last.prefix) { ++ logline += " " + this._format(last.prefix, this.prefixStyle); ++ } ++ logline += " " + last.message.split(/\r?\n/)[0]; ++ values.logline = logline; ++ } ++ values.completed = completed || this.tracker.completed(); ++ this.gauge.show(values); ++ } ++ pause() { ++ this._paused = true; ++ if (this.progressEnabled) { ++ this.gauge.disable(); ++ } ++ } ++ resume() { ++ if (!this._paused) { ++ return; ++ } ++ this._paused = false; ++ const buffer = this._buffer; ++ this._buffer = []; ++ buffer.forEach((m) => this.emitLog(m)); ++ if (this.progressEnabled) { ++ this.gauge.enable(); ++ } ++ } ++ log(lvl, prefix, ...messageArgs) { ++ const l = this.levels[lvl]; ++ if (l === void 0) { ++ this.emit("error", new Error(import_node_util.default.format("Undefined log level: %j", lvl))); ++ return; ++ } ++ let stack = null; ++ const a = messageArgs.map((arg) => { ++ if (arg instanceof Error && arg.stack) { ++ Object.defineProperty(arg, "stack", { ++ value: stack = arg.stack + "", ++ enumerable: true, ++ writable: true ++ }); ++ } ++ return arg; ++ }); ++ if (stack) { ++ a.unshift(stack + "\n"); ++ } ++ const message = import_node_util.default.format(...a); ++ const m = { ++ id: this.id++, ++ level: lvl, ++ prefix: String(prefix || ""), ++ message, ++ messageRaw: a ++ }; ++ this.emit("log", m); ++ this.emit(`log.${lvl}`, m); ++ if (m.prefix) { ++ this.emit(m.prefix, m); ++ } ++ this.record.push(m); ++ const mrs = this.maxRecordSize; ++ if (this.record.length > mrs) { ++ this.record = this.record.slice(-Math.floor(mrs * 0.9)); ++ } ++ this.emitLog(m); ++ } ++ emitLog(m) { ++ if (this._paused) { ++ this._buffer.push(m); ++ return; ++ } ++ if (this.progressEnabled) { ++ this.gauge.pulse(m.prefix); ++ } ++ const l = this.levels[m.level]; ++ if (l === void 0 || l < this.levels[this.level] || l > 0 && !isFinite(l)) { ++ return; ++ } ++ const disp = this.disp[m.level]; ++ this.clearProgress(); ++ m.message?.split(/\r?\n/).forEach((line) => { ++ const heading = this.heading; ++ if (heading) { ++ this.write(heading, this.headingStyle); ++ this.write(" "); ++ } ++ this.write(disp, this.style[m.level]); ++ const p = m.prefix || ""; ++ if (p) { ++ this.write(" "); ++ } ++ this.write(p, this.prefixStyle); ++ this.write(" " + line + "\n"); ++ }); ++ this.showProgress(); ++ } ++ _format(msg, style) { ++ if (!this._stream) { ++ return; ++ } ++ let output2 = ""; ++ if (this.useColor()) { ++ style = style || {}; ++ const settings = []; ++ if (style.fg) settings.push(style.fg); ++ if (style.bg) settings.push("bg" + style.bg[0].toUpperCase() + style.bg.slice(1)); ++ if (style.bold) settings.push("bold"); ++ if (style.underline) settings.push("underline"); ++ if (style.inverse) settings.push("inverse"); ++ if (settings.length) output2 += consoleControl.color(settings); ++ if (style.beep) output2 += consoleControl.beep(); ++ } ++ output2 += msg; ++ if (this.useColor()) output2 += consoleControl.color("reset"); ++ return output2; ++ } ++ write(msg, style) { ++ if (!this._stream) { ++ return; ++ } ++ this._stream.write(this._format(msg, style)); ++ } ++ addLevel(lvl, n, style, disp = null) { ++ if (disp == null) { ++ disp = lvl; ++ } ++ this.levels[lvl] = n; ++ this.style[lvl] = style; ++ if (!this[lvl]) { ++ this[lvl] = (...args) => { ++ const a = [lvl, ...args]; ++ return this.log.apply(this, a); ++ }; ++ } ++ this.disp[lvl] = disp; ++ } ++ }; ++ log = new Logger(); ++ trackerConstructors = ["newGroup", "newItem", "newStream"]; ++ mixinLog = function(tracker) { ++ Array.from( ++ /* @__PURE__ */ new Set([...Object.keys(log), ...Object.getOwnPropertyNames(Object.getPrototypeOf(log))]) ++ ).forEach(function(P) { ++ if (P[0] === "_") { ++ return; ++ } ++ if (trackerConstructors.filter(function(C) { ++ return C === P; ++ }).length) { ++ return; ++ } ++ if (tracker[P]) { ++ return; ++ } ++ if (typeof log[P] !== "function") { ++ return; ++ } ++ const func = log[P]; ++ tracker[P] = function() { ++ return func.apply(log, arguments); ++ }; ++ }); ++ if (tracker instanceof TrackerGroup) { ++ trackerConstructors.forEach(function(C) { ++ const func = tracker[C]; ++ tracker[C] = function() { ++ return mixinLog(func.apply(tracker, arguments)); ++ }; ++ }); ++ } ++ return tracker; ++ }; ++ trackerConstructors.forEach(function(C) { ++ log[C] = function() { ++ return mixinLog(this.tracker[C].apply(this.tracker, arguments)); ++ }; ++ }); ++ npmlog_default = log; ++ } ++}); ++ ++// libs/child-process/src/forked-strong-log-transformer.ts ++function Logger2(options) { ++ var defaults = JSON.parse(JSON.stringify(Logger2.DEFAULTS)); ++ options = Object.assign(defaults, options || {}); ++ var catcher = deLiner(); ++ var emitter = catcher; ++ var transforms = [objectifier()]; ++ if (options.tag) { ++ transforms.push(staticTagger(options.tag)); ++ } ++ if (options.mergeMultiline) { ++ transforms.push(lineMerger()); ++ } ++ transforms.push(formatters[options.format](options)); ++ transforms.push(reLiner()); ++ for (var t in transforms) { ++ emitter = emitter.pipe(transforms[t]); ++ } ++ return createDuplex(catcher, emitter); ++} ++function deLiner() { ++ var decoder = new import_node_string_decoder.StringDecoder("utf8"); ++ var last = ""; ++ return new import_node_stream2.default.Transform({ ++ transform(chunk, _enc, callback) { ++ last += decoder.write(chunk); ++ var list3 = last.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g); ++ last = list3.pop(); ++ for (var i = 0; i < list3.length; i++) { ++ if (list3[i]) { ++ this.push(list3[i]); ++ } ++ } ++ callback(); ++ }, ++ flush(callback) { ++ last += decoder.end(); ++ if (last) { ++ this.push(last); ++ } ++ callback(); ++ } ++ }); ++} ++function reLiner() { ++ return (0, import_through.default)(appendNewline); ++ function appendNewline(line) { ++ this.emit("data", line + "\n"); ++ } ++} ++function objectifier() { ++ return (0, import_through.default)(objectify, null, { autoDestroy: false }); ++ function objectify(line) { ++ this.emit("data", { ++ msg: line, ++ time: Date.now() ++ }); ++ } ++} ++function staticTagger(tag) { ++ return (0, import_through.default)(tagger); ++ function tagger(logEvent) { ++ logEvent.tag = tag; ++ this.emit("data", logEvent); ++ } ++} ++function textFormatter(options) { ++ return (0, import_through.default)(textify); ++ function textify(logEvent) { ++ var line = import_node_util2.default.format("%s%s", textifyTags(logEvent.tag), logEvent.msg.toString()); ++ if (options.timeStamp) { ++ line = import_node_util2.default.format("%s %s", new Date(logEvent.time).toISOString(), line); ++ } ++ this.emit("data", line.replace(/\n/g, "\\n")); ++ } ++ function textifyTags(tags) { ++ var str = ""; ++ if (typeof tags === "string") { ++ str = tags + " "; ++ } else if (typeof tags === "object") { ++ for (var t in tags) { ++ str += t + ":" + tags[t] + " "; ++ } ++ } ++ return str; ++ } ++} ++function jsonFormatter(options) { ++ return (0, import_through.default)(jsonify); ++ function jsonify(logEvent) { ++ if (options.timeStamp) { ++ logEvent.time = new Date(logEvent.time).toISOString(); ++ } else { ++ delete logEvent.time; ++ } ++ logEvent.msg = logEvent.msg.toString(); ++ this.emit("data", JSON.stringify(logEvent)); ++ } ++} ++function lineMerger(host) { ++ var previousLine = null; ++ var flushTimer = null; ++ var stream3 = (0, import_through.default)(lineMergerWrite, lineMergerEnd); ++ var flush = _flush.bind(stream3); ++ return stream3; ++ function lineMergerWrite(line) { ++ if (/^\s+/.test(line.msg)) { ++ if (previousLine) { ++ previousLine.msg += "\n" + line.msg; ++ } else { ++ previousLine = line; ++ } ++ } else { ++ flush(); ++ previousLine = line; ++ } ++ clearTimeout(flushTimer); ++ flushTimer = setTimeout(flush.bind(this), 10); ++ } ++ function _flush() { ++ if (previousLine) { ++ this.emit("data", previousLine); ++ previousLine = null; ++ } ++ } ++ function lineMergerEnd() { ++ flush.call(this); ++ this.emit("end"); ++ } ++} ++function createDuplex(input, output2) { ++ const duplex = new import_node_stream2.default.Duplex({ ++ objectMode: false, ++ allowHalfOpen: false ++ }); ++ duplex._write = (chunk, encoding, cb) => { ++ input.write(chunk, encoding, cb); ++ }; ++ duplex._read = () => { ++ }; ++ duplex._final = (cb) => { ++ input.end(cb); ++ }; ++ output2.on("data", (chunk) => { ++ duplex.push(chunk); ++ }); ++ output2.on("end", () => { ++ duplex.push(null); ++ }); ++ input.on("error", (err) => { ++ duplex.emit("error", err); ++ }); ++ output2.on("error", (err) => { ++ duplex.emit("error", err); ++ }); ++ return duplex; ++} ++var import_node_stream2, import_node_string_decoder, import_node_util2, import_through, forked_strong_log_transformer_default, formatters; ++var init_forked_strong_log_transformer = __esm({ ++ "libs/child-process/src/forked-strong-log-transformer.ts"() { ++ "use strict"; ++ import_node_stream2 = __toESM(require("node:stream")); ++ import_node_string_decoder = require("node:string_decoder"); ++ import_node_util2 = __toESM(require("node:util")); ++ import_through = __toESM(require("through")); ++ forked_strong_log_transformer_default = Logger2; ++ Logger2.DEFAULTS = { ++ format: "text", ++ tag: "", ++ mergeMultiline: false, ++ timeStamp: false ++ }; ++ formatters = { ++ text: textFormatter, ++ json: jsonFormatter ++ }; ++ } ++}); ++ ++// libs/child-process/src/set-exit-code.ts ++function setExitCode(code) { ++ process.exitCode = code; ++} ++var init_set_exit_code = __esm({ ++ "libs/child-process/src/set-exit-code.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/child-process/src/index.ts ++var src_exports = {}; ++__export(src_exports, { ++ exec: () => exec, ++ execSync: () => execSync, ++ getChildProcessCount: () => getChildProcessCount, ++ getExitCode: () => getExitCode, ++ spawn: () => spawn, ++ spawnStreaming: () => spawnStreaming ++}); ++function exec(command, args, opts) { ++ const options = Object.assign({ stdio: "pipe" }, opts); ++ const spawned = spawnProcess(command, args, options); ++ return wrapError(spawned); ++} ++function execSync(command, args, opts) { ++ return import_execa.default.sync(command, args, opts).stdout; ++} ++function spawn(command, args, opts) { ++ const options = Object.assign({}, opts, { stdio: "inherit" }); ++ const spawned = spawnProcess(command, args, options); ++ return wrapError(spawned); ++} ++function spawnStreaming(command, args, opts, prefix) { ++ const options = Object.assign({}, opts); ++ options.stdio = ["ignore", "pipe", "pipe"]; ++ const spawned = spawnProcess(command, args, options); ++ const stdoutOpts = {}; ++ const stderrOpts = {}; ++ if (prefix) { ++ const colorName = colorWheel[currentColor % NUM_COLORS]; ++ const color = colorName; ++ currentColor += 1; ++ stdoutOpts.tag = `${color.bold(prefix)}:`; ++ stderrOpts.tag = `${color(prefix)}:`; ++ } ++ if (children.size > process.stdout.listenerCount("close")) { ++ process.stdout.setMaxListeners(children.size); ++ process.stderr.setMaxListeners(children.size); ++ } ++ spawned.stdout?.pipe(forked_strong_log_transformer_default(stdoutOpts)).pipe(process.stdout); ++ spawned.stderr?.pipe(forked_strong_log_transformer_default(stderrOpts)).pipe(process.stderr); ++ return wrapError(spawned); ++} ++function getChildProcessCount() { ++ return children.size; ++} ++function getExitCode(result) { ++ if (result.exitCode) { ++ return result.exitCode; ++ } ++ if (typeof result.code === "number") { ++ return result.code; ++ } ++ if (typeof result.code === "string") { ++ return import_node_os.default.constants.errno[result.code]; ++ } ++ return process.exitCode; ++} ++function spawnProcess(command, args, opts) { ++ const child = (0, import_execa.default)(command, args, opts); ++ const drain = (exitCode, signal) => { ++ children.delete(child); ++ if (signal === void 0) { ++ child.removeListener("exit", drain); ++ } ++ if (exitCode) { ++ setExitCode(exitCode); ++ } ++ }; ++ child.once("exit", drain); ++ child.once("error", drain); ++ if (opts?.pkg) { ++ child.pkg = opts.pkg; ++ } ++ children.add(child); ++ return child; ++} ++function wrapError(spawned) { ++ if (spawned.pkg) { ++ return spawned.catch((err) => { ++ err.exitCode = getExitCode(err); ++ err.pkg = spawned.pkg; ++ throw err; ++ }); ++ } ++ return spawned; ++} ++var import_chalk, import_execa, import_node_os, children, colorWheel, NUM_COLORS, currentColor; ++var init_src = __esm({ ++ "libs/child-process/src/index.ts"() { ++ "use strict"; ++ import_chalk = __toESM(require("chalk")); ++ import_execa = __toESM(require("execa")); ++ import_node_os = __toESM(require("node:os")); ++ init_forked_strong_log_transformer(); ++ init_set_exit_code(); ++ children = /* @__PURE__ */ new Set(); ++ 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]; ++ NUM_COLORS = colorWheel.length; ++ currentColor = 0; ++ } ++}); ++ ++// libs/core/src/lib/collect-uncommitted.ts ++function collectUncommitted({ cwd, log: log2 = npmlog_default }) { ++ log2.silly("collect-uncommitted", "git status --porcelain (async)"); ++ return childProcess.exec("git", ["status", "--porcelain"], { cwd }).then(({ stdout }) => transformOutput(stdout)); ++} ++var import_chalk2, childProcess, maybeColorize, cRed, cGreen, replaceStatus, colorizeStats, splitOnNewLine, filterEmpty, o, transformOutput; ++var init_collect_uncommitted = __esm({ ++ "libs/core/src/lib/collect-uncommitted.ts"() { ++ "use strict"; ++ import_chalk2 = __toESM(require("chalk")); ++ init_npmlog(); ++ childProcess = (init_src(), __toCommonJS(src_exports)); ++ maybeColorize = (colorize) => (s) => s !== " " ? colorize(s) : s; ++ cRed = maybeColorize(import_chalk2.default.red); ++ cGreen = maybeColorize(import_chalk2.default.green); ++ replaceStatus = (_, maybeGreen, maybeRed) => `${cGreen(maybeGreen)}${cRed(maybeRed)}`; ++ colorizeStats = (stats) => stats.replace(/^([^U]| )([A-Z]| )/gm, replaceStatus).replace(/^\?{2}|U{2}/gm, cRed("$&")); ++ splitOnNewLine = (str) => str.split("\n"); ++ filterEmpty = (lines) => lines.filter((line) => line.length); ++ o = (l, r) => (x) => l(r(x)); ++ transformOutput = o(filterEmpty, o(splitOnNewLine, colorizeStats)); ++ } ++}); ++ ++// libs/core/src/lib/describe-ref.ts ++function getArgs(options, includeMergedTags = false) { ++ let args = [ ++ "describe", ++ // fallback to short sha if no tags located ++ "--always", ++ // always return full result, helps identify existing release ++ "--long", ++ // annotate if uncommitted changes present ++ "--dirty", ++ // prefer tags originating on upstream branch ++ "--first-parent" ++ ]; ++ if (options.match) { ++ args.push("--match", options.match); ++ } ++ if (includeMergedTags) { ++ args = args.filter((arg) => arg !== "--first-parent"); ++ } ++ return args; ++} ++function describeRef(options = {}, includeMergedTags) { ++ const promise = childProcess2.exec("git", getArgs(options, includeMergedTags), options); ++ return promise.then(({ stdout }) => { ++ const result = parse(stdout, options.cwd, options.separator); ++ npmlog_default.verbose("git-describe", "%j => %j", options && options.match, stdout); ++ npmlog_default.silly("git-describe", "parsed => %j", result); ++ return result; ++ }); ++} ++function describeRefSync(options = {}, includeMergedTags) { ++ const stdout = childProcess2.execSync("git", getArgs(options, includeMergedTags), options); ++ const result = parse(stdout, options.cwd, options.separator); ++ npmlog_default.silly("git-describe.sync", "%j => %j", stdout, result); ++ return result; ++} ++function parse(stdout, cwd, separator) { ++ separator = separator || "@"; ++ const minimalShaRegex = /^([0-9a-f]{7,40})(-dirty)?$/; ++ if (minimalShaRegex.test(stdout)) { ++ const [, sha2, isDirty2] = minimalShaRegex.exec(stdout); ++ const refCount2 = childProcess2.execSync("git", ["rev-list", "--count", sha2], { cwd }); ++ return { refCount: refCount2, sha: sha2, isDirty: Boolean(isDirty2) }; ++ } ++ const escapedSeparator = separator.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); ++ const regexPattern = new RegExp(`^((?:.*${escapedSeparator})?(.*))-(\\d+)-g([0-9a-f]+)(-dirty)?$`); ++ const [, lastTagName, lastVersion, refCount, sha, isDirty] = regexPattern.exec(stdout) || []; ++ return { lastTagName, lastVersion, refCount, sha, isDirty: Boolean(isDirty) }; ++} ++var childProcess2; ++var init_describe_ref = __esm({ ++ "libs/core/src/lib/describe-ref.ts"() { ++ "use strict"; ++ init_npmlog(); ++ childProcess2 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/core/src/lib/validation-error.ts ++var ValidationError; ++var init_validation_error = __esm({ ++ "libs/core/src/lib/validation-error.ts"() { ++ "use strict"; ++ init_npmlog(); ++ ValidationError = class extends Error { ++ prefix; ++ constructor(prefix, message, ...rest) { ++ super(message); ++ this.name = "ValidationError"; ++ this.prefix = prefix; ++ npmlog_default.resume(); ++ npmlog_default.error(prefix, message, ...rest); ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/check-working-tree.ts ++function checkWorkingTree({ cwd } = {}) { ++ let chain = Promise.resolve(); ++ chain = chain.then(() => describeRef({ cwd })); ++ const tests = [ ++ // prevent duplicate versioning ++ chain.then(throwIfReleased), ++ // prevent publish of uncommitted changes ++ chain.then(mkThrowIfUncommitted({ cwd })) ++ ]; ++ return chain.then((result) => Promise.all(tests).then(() => result)); ++} ++function throwIfReleased({ refCount }) { ++ if (refCount === "0") { ++ throw new ValidationError( ++ "ERELEASED", ++ "The current commit has already been released. Please make new commits before continuing." ++ ); ++ } ++} ++function mkThrowIfUncommitted(options = {}) { ++ return function throwIfUncommitted2(opts) { ++ if (opts.isDirty) { ++ return collectUncommitted(options).then((uncommitted) => { ++ throw new ValidationError("EUNCOMMIT", `${EUNCOMMIT_MSG}${uncommitted.join("\n")}`); ++ }); ++ } ++ }; ++} ++var EUNCOMMIT_MSG, throwIfUncommitted; ++var init_check_working_tree = __esm({ ++ "libs/core/src/lib/check-working-tree.ts"() { ++ "use strict"; ++ init_collect_uncommitted(); ++ init_describe_ref(); ++ init_validation_error(); ++ EUNCOMMIT_MSG = "Working tree has uncommitted changes, please commit or remove the following changes before continuing:\n"; ++ throwIfUncommitted = mkThrowIfUncommitted(); ++ } ++}); ++ ++// libs/core/src/lib/cli.ts ++function lernaCLI(argv, cwd) { ++ const cli = (0, import_yargs.default)(argv, cwd); ++ return globalOptions(cli).usage("Usage: $0 [options]").demandCommand(1, "A command is required. Pass --help to see all available commands and options.").recommendCommands().strict().fail((msg, err) => { ++ const actual = err || new Error(msg); ++ if (actual.name !== "ValidationError" && !actual.pkg) { ++ if (/Did you mean/.test(actual.message)) { ++ npmlog_default.error("lerna", `Unknown command "${cli.parsed.argv._[0]}"`); ++ } ++ npmlog_default.error("lerna", actual.message); ++ } ++ cli.exit(actual.exitCode > 0 ? actual.exitCode : 1, actual); ++ }).alias("h", "help").alias("v", "version").wrap(cli.terminalWidth()).epilogue(import_dedent.default` ++ When a command fails, all logs are written to lerna-debug.log in the current working directory. ++ ++ For more information, check out the docs at https://lerna.js.org/docs/introduction ++ `); ++} ++function globalOptions(argv) { ++ const opts = { ++ loglevel: { ++ defaultDescription: "info", ++ describe: "What level of logs to report.", ++ type: "string" ++ }, ++ concurrency: { ++ defaultDescription: String(import_node_os2.default.cpus().length), ++ describe: "How many processes to use when lerna parallelizes tasks.", ++ type: "number", ++ requiresArg: true ++ }, ++ "reject-cycles": { ++ describe: "Fail if a cycle is detected among dependencies.", ++ type: "boolean" ++ }, ++ "no-progress": { ++ describe: "Disable progress bars. (Always off in CI)", ++ type: "boolean" ++ }, ++ progress: { ++ // proxy for --no-progress ++ hidden: true, ++ type: "boolean" ++ }, ++ "no-sort": { ++ describe: "Do not sort packages topologically (dependencies before dependents).", ++ type: "boolean" ++ }, ++ sort: { ++ // proxy for --no-sort ++ hidden: true, ++ type: "boolean" ++ }, ++ "max-buffer": { ++ describe: "Set max-buffer (in bytes) for subcommand execution", ++ type: "number", ++ requiresArg: true ++ } ++ }; ++ const globalKeys = Object.keys(opts).concat(["help", "version"]); ++ return argv.options(opts).group(globalKeys, "Global Options:").option("ci", { ++ hidden: true, ++ type: "boolean" ++ }); ++} ++var import_dedent, import_node_os2, import_yargs; ++var init_cli = __esm({ ++ "libs/core/src/lib/cli.ts"() { ++ "use strict"; ++ import_dedent = __toESM(require("dedent")); ++ import_node_os2 = __toESM(require("node:os")); ++ import_yargs = __toESM(require("yargs")); ++ init_npmlog(); ++ process.env["NX_ISOLATE_PLUGINS"] = "false"; ++ process.env["NX_TUI"] = "false"; ++ process.env["npm_config_legacy_peer_deps"] ??= "false"; ++ } ++}); ++ ++// libs/core/src/lib/get-packages-for-option.ts ++function getPackagesForOption(option) { ++ let inputs = null; ++ if (option === true) { ++ inputs = ["*"]; ++ } else if (typeof option === "string") { ++ inputs = option.split(","); ++ } else if (Array.isArray(option)) { ++ inputs = [...option]; ++ } ++ return new Set(inputs); ++} ++var init_get_packages_for_option = __esm({ ++ "libs/core/src/lib/get-packages-for-option.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/core/src/lib/prerelease-id-from-version.ts ++function prereleaseIdFromVersion(version) { ++ return (import_semver.default.prerelease(version) || []).shift(); ++} ++var import_semver; ++var init_prerelease_id_from_version = __esm({ ++ "libs/core/src/lib/prerelease-id-from-version.ts"() { ++ "use strict"; ++ import_semver = __toESM(require("semver")); ++ } ++}); ++ ++// libs/core/src/lib/project-graph-with-packages.ts ++function getPackage(project) { ++ if (!project.package) { ++ throw new Error(`Failed attempting to find package for project ${project.name}`); ++ } ++ return project.package; ++} ++var isExternalNpmDependency; ++var init_project_graph_with_packages = __esm({ ++ "libs/core/src/lib/project-graph-with-packages.ts"() { ++ "use strict"; ++ isExternalNpmDependency = (dep) => dep.startsWith("npm:"); ++ } ++}); ++ ++// libs/core/src/lib/collect-updates/has-tags.ts ++function hasTags(opts) { ++ npmlog_default.silly("hasTags"); ++ let result = false; ++ try { ++ result = !!childProcess3.execSync("git", ["tag"], opts); ++ } catch (err) { ++ npmlog_default.warn("ENOTAGS", "No git tags were reachable from this branch!"); ++ npmlog_default.verbose("hasTags error", err); ++ } ++ npmlog_default.verbose("hasTags", result); ++ return result; ++} ++var childProcess3; ++var init_has_tags = __esm({ ++ "libs/core/src/lib/collect-updates/has-tags.ts"() { ++ "use strict"; ++ init_npmlog(); ++ childProcess3 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/core/src/lib/collect-updates/make-diff-predicate.ts ++function makeDiffPredicate(committish, execOpts, ignorePatterns = []) { ++ const ignoreFilters = new Set( ++ ignorePatterns.map( ++ (p) => import_minimatch.default.filter(`!${p}`, { ++ matchBase: true, ++ // dotfiles inside ignored directories should also match ++ dot: true ++ }) ++ ) ++ ); ++ if (ignoreFilters.size) { ++ npmlog_default.info("ignoring diff in paths matching", ignorePatterns); ++ } ++ return function hasDiffSinceThatIsntIgnored(node) { ++ const diff = diffSinceIn(committish, getPackage(node).location, execOpts); ++ if (diff === "") { ++ npmlog_default.silly("", "no diff found in %s", node.name); ++ return false; ++ } ++ npmlog_default.silly("found diff in", diff); ++ let changedFiles = diff.split("\n"); ++ if (ignoreFilters.size) { ++ for (const ignored of ignoreFilters) { ++ changedFiles = changedFiles.filter(ignored); ++ } ++ } ++ if (changedFiles.length) { ++ npmlog_default.verbose("filtered diff", changedFiles); ++ } else { ++ npmlog_default.verbose("", "no diff found in %s (after filtering)", node.name); ++ } ++ return changedFiles.length > 0; ++ }; ++} ++function diffSinceIn(committish, location, opts) { ++ const args = ["diff", "--name-only", committish]; ++ const formattedLocation = (0, import_slash.default)((0, import_path.relative)(opts.cwd, location)); ++ if (formattedLocation) { ++ args.push("--", formattedLocation); ++ } ++ npmlog_default.silly("checking diff", formattedLocation); ++ return execSync2("git", args, opts); ++} ++var import_minimatch, import_path, import_slash, execSync2; ++var init_make_diff_predicate = __esm({ ++ "libs/core/src/lib/collect-updates/make-diff-predicate.ts"() { ++ "use strict"; ++ import_minimatch = __toESM(require("minimatch")); ++ import_path = require("path"); ++ import_slash = __toESM(require("slash")); ++ init_npmlog(); ++ init_project_graph_with_packages(); ++ ({ execSync: execSync2 } = (init_src(), __toCommonJS(src_exports))); ++ } ++}); ++ ++// libs/core/src/lib/collect-updates/collect-project-updates.ts ++function collectProjectUpdates(filteredProjects, projectGraph, execOpts, commandOptions) { ++ const { ++ forcePublish, ++ conventionalCommits, ++ forceConventionalGraduate, ++ conventionalGraduate, ++ excludeDependents, ++ tagVersionSeparator ++ } = commandOptions; ++ const useConventionalGraduate = conventionalCommits && (conventionalGraduate || forceConventionalGraduate); ++ const forced = getPackagesForOption(useConventionalGraduate ? conventionalGraduate : forcePublish); ++ let committish = commandOptions.since ?? ""; ++ if (hasTags(execOpts)) { ++ const { sha, refCount, lastTagName } = describeRefSync( ++ { ...execOpts, separator: tagVersionSeparator }, ++ commandOptions.includeMergedTags ++ ); ++ if (refCount === "0" && forced.size === 0 && !committish) { ++ npmlog_default.notice("", "Current HEAD is already released, skipping change detection."); ++ return []; ++ } ++ if (commandOptions.canary) { ++ committish = `${sha}^..${sha}`; ++ } else if (!committish) { ++ committish = lastTagName; ++ } ++ } ++ if (forced.size) { ++ npmlog_default.warn( ++ useConventionalGraduate ? "conventional-graduate" : "force-publish", ++ forced.has("*") ? "all packages" : Array.from(forced.values()).join("\n") ++ ); ++ } ++ if (useConventionalGraduate) { ++ if (forced.has("*")) { ++ npmlog_default.info("", "Graduating all prereleased packages"); ++ } else { ++ npmlog_default.info("", "Graduating prereleased packages"); ++ } ++ } else if (!committish || forced.has("*")) { ++ npmlog_default.info("", "Assuming all packages changed"); ++ return collectProjects(filteredProjects, projectGraph, { ++ onInclude: (name) => npmlog_default.verbose("updated", name), ++ excludeDependents ++ }); ++ } ++ npmlog_default.info("", `Looking for changed packages since ${committish}`); ++ const hasDiff = makeDiffPredicate(committish, execOpts, commandOptions.ignoreChanges); ++ const needsBump = !commandOptions.bump || commandOptions.bump.startsWith("pre") ? () => false : ( ++ /* skip packages that have not been previously prereleased */ ++ (node) => !!prereleaseIdFromVersion(getPackage(node).version) ++ ); ++ const isForced = (node, name) => !!((forced.has("*") || forced.has(name)) && ((useConventionalGraduate ? prereleaseIdFromVersion(getPackage(node).version) : true) || forceConventionalGraduate)); ++ return collectProjects(filteredProjects, projectGraph, { ++ isCandidate: (node, name) => isForced(node, name) || needsBump(node) || hasDiff(node), ++ onInclude: (name) => npmlog_default.verbose("updated", name), ++ excludeDependents ++ }); ++} ++function collectProjects(projects, projectGraph, { isCandidate = () => true, onInclude, excludeDependents } = {}) { ++ const candidates = {}; ++ projects.forEach((node) => { ++ if (isCandidate(node, getPackage(node).name)) { ++ candidates[node.name] = node; ++ } ++ }); ++ if (!excludeDependents) { ++ collectDependents(candidates, projectGraph).forEach((node) => candidates[node.name] = node); ++ } ++ const updates = []; ++ projects.forEach((node) => { ++ if (candidates[node.name]) { ++ if (onInclude) { ++ onInclude(getPackage(node).name); ++ } ++ updates.push(node); ++ } ++ }); ++ return updates; ++} ++function collectDependents(nodes, projectGraph) { ++ const dependents = Object.values(projectGraph.localPackageDependencies).flat().reduce( ++ (prev, next) => ({ ++ ...prev, ++ [next.target]: [...prev[next.target] || [], next.source] ++ }), ++ {} ++ ); ++ const collected = /* @__PURE__ */ new Set(); ++ Object.values(nodes).forEach((currentNode) => { ++ if (dependents[currentNode.name] && dependents[currentNode.name].length === 0) { ++ return; ++ } ++ const queue2 = [currentNode]; ++ const seen = /* @__PURE__ */ new Set(); ++ while (queue2.length) { ++ const node = queue2.shift(); ++ dependents[node.name]?.forEach((dep) => { ++ if (seen.has(dep)) { ++ return; ++ } ++ seen.add(dep); ++ if (dep === currentNode.name || nodes[dep]) { ++ return; ++ } ++ const dependentNode = projectGraph.nodes[dep]; ++ collected.add(dependentNode); ++ queue2.push(dependentNode); ++ }); ++ } ++ }); ++ return collected; ++} ++var init_collect_project_updates = __esm({ ++ "libs/core/src/lib/collect-updates/collect-project-updates.ts"() { ++ "use strict"; ++ init_describe_ref(); ++ init_get_packages_for_option(); ++ init_npmlog(); ++ init_prerelease_id_from_version(); ++ init_project_graph_with_packages(); ++ init_has_tags(); ++ init_make_diff_predicate(); ++ } ++}); ++ ++// libs/core/src/lib/collect-updates/index.ts ++var init_collect_updates = __esm({ ++ "libs/core/src/lib/collect-updates/index.ts"() { ++ "use strict"; ++ init_collect_project_updates(); ++ } ++}); ++ ++// libs/core/src/lib/package.ts ++function binSafeName({ name, scope }) { ++ return scope ? name.substring(scope.length + 1) : name; ++} ++function shallowCopy(json) { ++ return Object.keys(json).reduce((obj, key) => { ++ const val = json[key]; ++ if (Array.isArray(val)) { ++ obj[key] = val.slice(); ++ } else if (val && typeof val === "object") { ++ obj[key] = Object.assign({}, val); ++ } else { ++ obj[key] = val; ++ } ++ return obj; ++ }, {}); ++} ++var import_devkit, import_fs, import_load_json_file, import_npm_package_arg, import_path2, import_write_pkg, PKG, _location, _resolved, _rootPath, _scripts, _contents, Package; ++var init_package = __esm({ ++ "libs/core/src/lib/package.ts"() { ++ "use strict"; ++ import_devkit = require("@nx/devkit"); ++ import_fs = __toESM(require("fs")); ++ import_load_json_file = __toESM(require("load-json-file")); ++ import_npm_package_arg = __toESM(require("npm-package-arg")); ++ import_path2 = __toESM(require("path")); ++ import_write_pkg = __toESM(require("write-pkg")); ++ PKG = Symbol("pkg"); ++ _location = Symbol("location"); ++ _resolved = Symbol("resolved"); ++ _rootPath = Symbol("rootPath"); ++ _scripts = Symbol("scripts"); ++ _contents = Symbol("contents"); ++ Package = class _Package { ++ name; ++ [PKG]; ++ [_location]; ++ [_resolved]; ++ [_rootPath]; ++ [_scripts]; ++ [_contents]; ++ licensePath; ++ packed; ++ /** ++ * Create a Package instance from parameters, possibly reusing existing instance. ++ * @param ref A path to a package.json file, Package instance, or JSON object ++ * @param [dir] If `ref` is a JSON object, this is the location of the manifest ++ */ ++ static lazy(ref, dir = ".") { ++ if (typeof ref === "string") { ++ const location = import_path2.default.resolve(import_path2.default.basename(ref) === "package.json" ? import_path2.default.dirname(ref) : ref); ++ const manifest = import_load_json_file.default.sync(import_path2.default.join(location, "package.json")); ++ return new _Package(manifest, location); ++ } ++ if ("__isLernaPackage" in ref) { ++ return ref; ++ } ++ return new _Package(ref, dir); ++ } ++ constructor(pkg2, location, rootPath = location) { ++ const resolved = import_npm_package_arg.default.resolve(pkg2.name, `file:${import_path2.default.relative(rootPath, location)}`, rootPath); ++ this.name = pkg2.name; ++ this[PKG] = pkg2; ++ Object.defineProperty(this, PKG, { enumerable: false, writable: true }); ++ this[_location] = location; ++ this[_resolved] = resolved; ++ this[_rootPath] = rootPath; ++ this[_scripts] = { ...pkg2.scripts }; ++ } ++ // readonly getters ++ get location() { ++ return this[_location]; ++ } ++ get private() { ++ return Boolean(this[PKG].private); ++ } ++ set private(isPrivate) { ++ this[PKG].private = isPrivate; ++ } ++ get resolved() { ++ return this[_resolved]; ++ } ++ get rootPath() { ++ return this[_rootPath]; ++ } ++ get scripts() { ++ return this[_scripts]; ++ } ++ get lernaConfig() { ++ return this[PKG].lerna; ++ } ++ set lernaConfig(config) { ++ this[PKG].lerna = config; ++ } ++ get bin() { ++ const pkg2 = this[PKG]; ++ return typeof pkg2.bin === "string" ? { ++ // See note on function implementation ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ [binSafeName(this.resolved)]: pkg2.bin ++ } : Object.assign({}, pkg2.bin); ++ } ++ get binLocation() { ++ return import_path2.default.join(this.location, "node_modules", ".bin"); ++ } ++ get manifestLocation() { ++ return import_path2.default.join(this.location, "package.json"); ++ } ++ get nodeModulesLocation() { ++ return import_path2.default.join(this.location, "node_modules"); ++ } ++ get __isLernaPackage() { ++ return true; ++ } ++ // accessors ++ get version() { ++ return this[PKG].version; ++ } ++ set version(version) { ++ this[PKG].version = version; ++ } ++ get contents() { ++ if (this[_contents]) { ++ return this[_contents]; ++ } ++ const publishConfig = this[PKG].publishConfig; ++ if (publishConfig && publishConfig.directory) { ++ return import_path2.default.join(this.location, publishConfig.directory); ++ } ++ return this.location; ++ } ++ set contents(subDirectory) { ++ const _workspaceRoot = process.env["NX_WORKSPACE_ROOT_PATH"] || import_devkit.workspaceRoot; ++ if (subDirectory.startsWith(_workspaceRoot)) { ++ this[_contents] = subDirectory; ++ return; ++ } ++ this[_contents] = import_path2.default.join(this.location, subDirectory); ++ } ++ // "live" collections ++ get dependencies() { ++ return this[PKG].dependencies; ++ } ++ get devDependencies() { ++ return this[PKG].devDependencies; ++ } ++ get optionalDependencies() { ++ return this[PKG].optionalDependencies; ++ } ++ get peerDependencies() { ++ return this[PKG].peerDependencies; ++ } ++ /** ++ * Map-like retrieval of arbitrary values ++ */ ++ get(key) { ++ return this[PKG][key]; ++ } ++ /** ++ * Map-like storage of arbitrary values ++ */ ++ set(key, val) { ++ this[PKG][key] = val; ++ return this; ++ } ++ /** ++ * Provide shallow copy for munging elsewhere ++ */ ++ toJSON() { ++ return shallowCopy(this[PKG]); ++ } ++ /** ++ * Refresh internal state from disk (e.g., changed by external lifecycles) ++ */ ++ refresh() { ++ return (0, import_load_json_file.default)(this.manifestLocation).then((pkg2) => { ++ this[PKG] = pkg2; ++ return this; ++ }); ++ } ++ /** ++ * Write manifest changes to disk ++ * @returns {Promise} resolves when write finished ++ */ ++ serialize() { ++ return (0, import_write_pkg.default)(this.manifestLocation, this[PKG]).then(() => this); ++ } ++ /** ++ * Sync dist manifest version ++ */ ++ async syncDistVersion(doSync) { ++ if (doSync) { ++ const distPkg = import_path2.default.join(this.contents, "package.json"); ++ if (distPkg !== this.manifestLocation && import_fs.default.existsSync(distPkg)) { ++ const pkg2 = await (0, import_load_json_file.default)(distPkg); ++ pkg2.version = this[PKG].version; ++ await (0, import_write_pkg.default)(distPkg, pkg2); ++ } ++ } ++ return this; ++ } ++ getLocalDependency(depName) { ++ if (this.dependencies && this.dependencies[depName]) { ++ return { ++ collection: "dependencies", ++ spec: this.dependencies[depName] ++ }; ++ } ++ if (this.devDependencies && this.devDependencies[depName]) { ++ return { ++ collection: "devDependencies", ++ spec: this.devDependencies[depName] ++ }; ++ } ++ if (this.optionalDependencies && this.optionalDependencies[depName]) { ++ return { ++ collection: "optionalDependencies", ++ spec: this.optionalDependencies[depName] ++ }; ++ } ++ if (this.peerDependencies && this.peerDependencies[depName]) { ++ const spec = this.peerDependencies[depName]; ++ const collection = "peerDependencies"; ++ const FILE_PROTOCOL = "file:"; ++ const WORKSPACE_PROTOCOL = "workspace:"; ++ if (spec.startsWith(WORKSPACE_PROTOCOL)) { ++ const token = spec.substring(WORKSPACE_PROTOCOL.length); ++ switch (token) { ++ case "*": { ++ return { collection, spec }; ++ } ++ case "^": { ++ return { collection, spec }; ++ } ++ case "~": { ++ return { collection, spec }; ++ } ++ default: { ++ return { collection, spec }; ++ } ++ } ++ } ++ if (spec.startsWith(FILE_PROTOCOL)) { ++ return null; ++ } ++ } ++ return null; ++ } ++ /** ++ * Mutate local dependency spec according to type ++ * @param resolved npa metadata ++ * @param depVersion semver ++ * @param savePrefix npm_config_save_prefix ++ * @param options ++ */ ++ updateLocalDependency(resolved, depVersion, savePrefix, options = { eraseWorkspacePrefix: false }) { ++ const depName = resolved.name; ++ let depCollection = this.dependencies; ++ if (!depCollection || !depCollection[depName]) { ++ depCollection = this.optionalDependencies; ++ } ++ if (!depCollection || !depCollection[depName]) { ++ depCollection = this.devDependencies; ++ } ++ if (!depCollection || !depCollection[depName]) { ++ depCollection = this.peerDependencies; ++ } ++ if (!depCollection) { ++ throw new Error(`${JSON.stringify(depName)} should exist in some dependency collection.`); ++ } ++ const workspaceSpec = resolved.workspaceSpec; ++ const workspaceAlias = resolved.workspaceAlias; ++ const gitCommittish = resolved.gitCommittish; ++ if (workspaceSpec) { ++ if (options.eraseWorkspacePrefix) { ++ if (workspaceAlias) { ++ const prefix = workspaceAlias === "*" ? "" : workspaceAlias; ++ depCollection[depName] = `${prefix}${depVersion}`; ++ } else { ++ const semverRange = workspaceSpec.substring("workspace:".length); ++ depCollection[depName] = semverRange; ++ } ++ } else { ++ if (!workspaceAlias) { ++ const matches = workspaceSpec.match(/^(workspace:[*~^]?)/); ++ const workspacePrefix = matches[0]; ++ depCollection[depName] = `${workspacePrefix}${depVersion}`; ++ } ++ } ++ } else if (resolved.registry || resolved.type === "directory") { ++ depCollection[depName] = `${savePrefix}${depVersion}`; ++ } else if (gitCommittish) { ++ const [tagPrefix] = /^\D*/.exec(gitCommittish); ++ const { hosted } = resolved; ++ hosted.committish = `${tagPrefix}${depVersion}`; ++ depCollection[depName] = hosted.toString({ noGitPlus: false, noCommittish: false }); ++ } else if (resolved.gitRange) { ++ const { hosted } = resolved; ++ hosted.committish = `semver:${savePrefix}${depVersion}`; ++ depCollection[depName] = hosted.toString({ noGitPlus: false, noCommittish: false }); ++ } ++ } ++ /** ++ * Remove the private property, effectively making the package public. ++ */ ++ removePrivate() { ++ delete this[PKG].private; ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/project/shallow-extend.ts ++function shallowExtend(json, defaults = {}) { ++ return Object.keys(json).reduce((obj, key) => { ++ const val = json[key]; ++ if (Array.isArray(val)) { ++ obj[key] = val.slice(); ++ } else if (val && typeof val === "object") { ++ obj[key] = shallowExtend(val, obj[key]); ++ } else { ++ obj[key] = val; ++ } ++ return obj; ++ }, defaults); ++} ++var init_shallow_extend = __esm({ ++ "libs/core/src/lib/project/shallow-extend.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/core/src/lib/project/apply-extends.ts ++function applyExtends(config, cwd, seen = /* @__PURE__ */ new Set()) { ++ let defaultConfig = {}; ++ if ("extends" in config) { ++ let pathToDefault; ++ try { ++ pathToDefault = (0, import_resolve_from.default)(cwd, config.extends); ++ } catch (err) { ++ throw new ValidationError("ERESOLVED", "Config .extends must be locally-resolvable", err); ++ } ++ if (seen.has(pathToDefault)) { ++ throw new ValidationError("ECIRCULAR", "Config .extends cannot be circular", seen); ++ } ++ seen.add(pathToDefault); ++ defaultConfig = require(pathToDefault); ++ delete config.extends; ++ defaultConfig = applyExtends(defaultConfig, import_path3.default.dirname(pathToDefault), seen); ++ } ++ return shallowExtend(config, defaultConfig); ++} ++var import_path3, import_resolve_from; ++var init_apply_extends = __esm({ ++ "libs/core/src/lib/project/apply-extends.ts"() { ++ "use strict"; ++ import_path3 = __toESM(require("path")); ++ import_resolve_from = __toESM(require("resolve-from")); ++ init_validation_error(); ++ init_shallow_extend(); ++ } ++}); ++ ++// libs/core/src/lib/project/make-file-finder.ts ++function normalize(results) { ++ return results.map((fp) => import_path4.default.normalize(fp)); ++} ++function getGlobOpts(rootPath, packageConfigs) { ++ const globOpts = { ++ cwd: rootPath, ++ absolute: true, ++ expandDirectories: false, ++ followSymbolicLinks: false ++ }; ++ if (packageConfigs.some((cfg) => cfg.indexOf("**") > -1)) { ++ if (packageConfigs.some((cfg) => cfg.indexOf("node_modules") > -1)) { ++ throw new ValidationError( ++ "EPKGCONFIG", ++ "An explicit node_modules package path does not allow globstars (**)" ++ ); ++ } ++ globOpts.ignore = [ ++ // allow globs like "packages/**", ++ // but avoid picking up node_modules/**/package.json ++ "**/node_modules/**" ++ ]; ++ } ++ return globOpts; ++} ++function makeFileFinder(rootPath, packageConfigs) { ++ const globOpts = getGlobOpts(rootPath, packageConfigs); ++ return (fileName, fileMapper, customGlobOpts) => { ++ const options = Object.assign({}, customGlobOpts, globOpts); ++ const promise = (0, import_p_map.default)( ++ Array.from(packageConfigs).sort(), ++ (globPath) => { ++ let chain = (0, import_tinyglobby.glob)(import_path4.default.posix.join(globPath, fileName), options); ++ chain = chain.then((results) => results.sort()); ++ chain = chain.then(normalize); ++ if (fileMapper) { ++ chain = chain.then(fileMapper); ++ } ++ return chain; ++ }, ++ { concurrency: 4 } ++ ); ++ return promise.then((results) => results.reduce((acc, result) => acc.concat(result), [])); ++ }; ++} ++function makeSyncFileFinder(rootPath, packageConfigs) { ++ const globOpts = getGlobOpts(rootPath, packageConfigs); ++ return (fileName, fileMapper) => { ++ const patterns = packageConfigs.map((globPath) => import_path4.default.posix.join(globPath, fileName)).sort(); ++ let results = (0, import_tinyglobby.globSync)(patterns, globOpts); ++ results = normalize(results); ++ return results.map((res) => fileMapper(res)); ++ }; ++} ++var import_tinyglobby, import_p_map, import_path4; ++var init_make_file_finder = __esm({ ++ "libs/core/src/lib/project/make-file-finder.ts"() { ++ "use strict"; ++ import_tinyglobby = require("tinyglobby"); ++ import_p_map = __toESM(require("p-map")); ++ import_path4 = __toESM(require("path")); ++ init_validation_error(); ++ } ++}); ++ ++// libs/core/src/lib/project/index.ts ++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_path5, LICENSE_GLOB, Project, getPackages, getPackagesSync; ++var init_project = __esm({ ++ "libs/core/src/lib/project/index.ts"() { ++ "use strict"; ++ import_devkit2 = require("@nx/devkit"); ++ import_cosmiconfig = require("cosmiconfig"); ++ import_dedent2 = __toESM(require("dedent")); ++ import_fs2 = __toESM(require("fs")); ++ import_glob_parent = __toESM(require("glob-parent")); ++ import_tinyglobby2 = require("tinyglobby"); ++ import_js_yaml = require("js-yaml"); ++ import_load_json_file2 = __toESM(require("load-json-file")); ++ import_p_map2 = __toESM(require("p-map")); ++ import_path5 = __toESM(require("path")); ++ init_npmlog(); ++ init_package(); ++ init_validation_error(); ++ init_apply_extends(); ++ init_make_file_finder(); ++ LICENSE_GLOB = "LICEN{S,C}E{,.*}"; ++ Project = class _Project { ++ config; ++ configNotFound; ++ rootConfigLocation; ++ rootPath; ++ packageConfigs; ++ manifest; ++ /** ++ * @deprecated Only used in legacy core utilities ++ * TODO: remove in v8 ++ */ ++ static getPackages(cwd) { ++ return new _Project(cwd).getPackages(); ++ } ++ /** ++ * @deprecated Only used in legacy core utilities ++ * TODO: remove in v8 ++ */ ++ static getPackagesSync(cwd) { ++ return new _Project(cwd).getPackagesSync(); ++ } ++ constructor(cwd, options) { ++ const { config, configNotFound, filepath } = this.#resolveLernaConfig(cwd); ++ this.config = config; ++ this.configNotFound = configNotFound || false; ++ this.rootConfigLocation = filepath; ++ this.rootPath = import_path5.default.dirname(filepath); ++ this.manifest = this.#resolveRootPackageJson(); ++ if (this.configNotFound) { ++ throw new ValidationError("ENOLERNA", "`lerna.json` does not exist, have you run `lerna init`?"); ++ } ++ if (!options?.skipLernaConfigValidations) { ++ this.#validateLernaConfig(config); ++ } ++ this.packageConfigs = this.#resolvePackageConfigs(); ++ npmlog_default.verbose("rootPath", this.rootPath); ++ } ++ get version() { ++ return this.config.version; ++ } ++ set version(val) { ++ this.config.version = val; ++ } ++ get packageParentDirs() { ++ return this.packageConfigs.map((packagePattern) => (0, import_glob_parent.default)(packagePattern)).map((parentDir) => import_path5.default.resolve(this.rootPath, parentDir)); ++ } ++ get licensePath() { ++ let licensePath; ++ try { ++ const search = (0, import_tinyglobby2.globSync)(LICENSE_GLOB, { ++ cwd: this.rootPath, ++ absolute: true, ++ caseSensitiveMatch: false, ++ // Project license is always a sibling of the root manifest ++ deep: 0 ++ }); ++ licensePath = search.shift(); ++ if (licensePath) { ++ licensePath = import_path5.default.normalize(licensePath); ++ Object.defineProperty(this, "licensePath", { ++ value: licensePath ++ }); ++ } ++ } catch (err) { ++ throw new ValidationError(err.name, err.message); ++ } ++ return licensePath; ++ } ++ get fileFinder() { ++ const finder = makeFileFinder(this.rootPath, this.packageConfigs); ++ Object.defineProperty(this, "fileFinder", { ++ value: finder ++ }); ++ return finder; ++ } ++ /** ++ * A promise resolving to a list of Package instances ++ */ ++ getPackages() { ++ const mapper = (packageConfigPath) => (0, import_load_json_file2.default)(packageConfigPath).then( ++ (packageJson) => new Package(packageJson, import_path5.default.dirname(packageConfigPath), this.rootPath) ++ ); ++ return this.fileFinder("package.json", (filePaths) => (0, import_p_map2.default)(filePaths, mapper, { concurrency: 50 })); ++ } ++ /** ++ * A list of Package instances ++ */ ++ getPackagesSync() { ++ const syncFileFinder = makeSyncFileFinder(this.rootPath, this.packageConfigs); ++ return syncFileFinder("package.json", (packageConfigPath) => { ++ return new Package( ++ import_load_json_file2.default.sync(packageConfigPath), ++ import_path5.default.dirname(packageConfigPath), ++ this.rootPath ++ ); ++ }); ++ } ++ getPackageLicensePaths() { ++ return this.fileFinder(LICENSE_GLOB, null, { caseSensitiveMatch: false }); ++ } ++ isIndependent() { ++ return this.version === "independent"; ++ } ++ serializeConfig() { ++ (0, import_devkit2.writeJsonFile)(this.rootConfigLocation, this.config, { spaces: 2 }); ++ return this.rootConfigLocation; ++ } ++ #resolveRootPackageJson() { ++ try { ++ const manifestLocation = import_path5.default.join(this.rootPath, "package.json"); ++ const packageJson = import_load_json_file2.default.sync(manifestLocation); ++ if (!packageJson.name) { ++ packageJson.name = import_path5.default.basename(import_path5.default.dirname(manifestLocation)); ++ } ++ return new Package(packageJson, this.rootPath); ++ } catch (err) { ++ if (err instanceof Error && err?.name === "JSONError") { ++ throw new ValidationError(err.name, err.message); ++ } ++ throw new ValidationError("ENOPKG", "`package.json` does not exist, have you run `lerna init`?"); ++ } ++ } ++ #resolveLernaConfig(cwd) { ++ try { ++ const explorer = (0, import_cosmiconfig.cosmiconfigSync)("lerna", { ++ loaders: { ++ ...import_cosmiconfig.defaultLoaders, ++ ".json": (filepath, content) => { ++ if (!filepath.endsWith("lerna.json")) { ++ return import_cosmiconfig.defaultLoaders[".json"](filepath, content); ++ } ++ try { ++ return (0, import_devkit2.parseJson)(content); ++ } catch (err) { ++ if (err instanceof Error) { ++ err.name = "JSONError"; ++ err.message = `Error in: ${filepath} ++${err.message}`; ++ } ++ throw err; ++ } ++ } ++ }, ++ searchPlaces: ["lerna.json", "package.json"], ++ searchStrategy: "global", ++ // Fix breaking change behaviour in cosmiconfig@9.0.0 ++ transform(obj) { ++ if (!obj) { ++ const configNotFoundResult = { ++ // No need to distinguish between missing and empty, ++ // saves a lot of noisy guards elsewhere ++ config: {}, ++ configNotFound: true, ++ // path.resolve(".", ...) starts from process.cwd() ++ filepath: import_path5.default.resolve(cwd || ".", "lerna.json") ++ }; ++ return configNotFoundResult; ++ } ++ obj.config = applyExtends(obj.config, import_path5.default.dirname(obj.filepath)); ++ return obj; ++ } ++ }); ++ return explorer.search(cwd); ++ } catch (err) { ++ if (err.name === "JSONError") { ++ throw new ValidationError(err.name, err.message); ++ } ++ throw err; ++ } ++ } ++ #validateLernaConfig(config) { ++ if (!this.version) { ++ throw new ValidationError("ENOVERSION", "Required property version does not exist in `lerna.json`"); ++ } ++ if (config.useWorkspaces !== void 0) { ++ throw new ValidationError( ++ "ECONFIGWORKSPACES", ++ `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.` ++ ); ++ } ++ } ++ #resolvePnpmWorkspaceConfig() { ++ let config; ++ try { ++ const configLocation = import_path5.default.join(this.rootPath, "pnpm-workspace.yaml"); ++ const configContent = import_fs2.default.readFileSync(configLocation, { encoding: "utf8" }); ++ config = (0, import_js_yaml.load)(configContent); ++ } catch (err) { ++ if (err.message.includes("ENOENT: no such file or directory")) { ++ throw new ValidationError( ++ "ENOENT", ++ "No pnpm-workspace.yaml found. See https://pnpm.io/workspaces for help configuring workspaces in pnpm." ++ ); ++ } ++ throw new ValidationError(err.name, err.message); ++ } ++ return config; ++ } ++ /** ++ * By default, the user's package manager workspaces configuration will be used to resolve packages. ++ * However, they can optionally specify an explicit set of package globs to be used instead. ++ * ++ * NOTE: This does not impact the project graph creation process, which will still ultimately use ++ * the package manager workspaces configuration to construct a full graph, it will only impact which ++ * of the packages in that graph will be considered when running commands. ++ */ ++ #resolvePackageConfigs() { ++ if (this.config.packages) { ++ npmlog_default.verbose( ++ "packageConfigs", ++ `Explicit "packages" configuration found in lerna.json. Resolving packages using the configured glob(s): ${JSON.stringify( ++ this.config.packages ++ )}` ++ ); ++ return this.config.packages; ++ } ++ if (this.config.npmClient === "pnpm") { ++ npmlog_default.verbose( ++ "packageConfigs", ++ 'Package manager "pnpm" detected. Resolving packages using `pnpm-workspace.yaml`.' ++ ); ++ const workspaces2 = this.#resolvePnpmWorkspaceConfig().packages; ++ if (!workspaces2) { ++ throw new ValidationError( ++ "EWORKSPACES", ++ 'No "packages" property found in `pnpm-workspace.yaml`. See https://pnpm.io/workspaces for help configuring workspaces in pnpm.' ++ ); ++ } ++ return workspaces2; ++ } ++ const workspaces = this.manifest?.get("workspaces"); ++ const isYarnClassicWorkspacesObjectConfig = Boolean( ++ workspaces && typeof workspaces === "object" && Array.isArray(workspaces.packages) ++ ); ++ const isValidWorkspacesConfig = Array.isArray(workspaces) || isYarnClassicWorkspacesObjectConfig; ++ if (!workspaces || !isValidWorkspacesConfig) { ++ throw new ValidationError( ++ "EWORKSPACES", ++ import_dedent2.default` ++ 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. ++ (A) Did you mean to specify a "packages" config manually in lerna.json instead of using your workspaces config? ++ (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. ++ See: https://lerna.js.org/docs/getting-started ++ ` ++ ); ++ } ++ npmlog_default.verbose("packageConfigs", `Resolving packages based on package.json "workspaces" configuration.`); ++ if (isYarnClassicWorkspacesObjectConfig) { ++ return workspaces.packages; ++ } ++ return workspaces; ++ } ++ }; ++ getPackages = Project.getPackages; ++ getPackagesSync = Project.getPackagesSync; ++ } ++}); ++ ++// libs/core/src/lib/write-log-file.ts ++function writeLogFile(cwd) { ++ let logOutput = ""; ++ npmlog_default.record.forEach((m) => { ++ let pref = [m.id, m.level]; ++ if (m.prefix) { ++ pref.push(m.prefix); ++ } ++ pref = pref.join(" "); ++ m.message.trim().split(/\r?\n/).map((line) => `${pref} ${line}`.trim()).forEach((line) => { ++ logOutput += line + import_os.default.EOL; ++ }); ++ }); ++ import_write_file_atomic.default.sync(import_path6.default.join(cwd, "lerna-debug.log"), logOutput); ++ npmlog_default.record.length = 0; ++} ++var import_os, import_path6, import_write_file_atomic; ++var init_write_log_file = __esm({ ++ "libs/core/src/lib/write-log-file.ts"() { ++ "use strict"; ++ import_os = __toESM(require("os")); ++ import_path6 = __toESM(require("path")); ++ import_write_file_atomic = __toESM(require("write-file-atomic")); ++ init_npmlog(); ++ } ++}); ++ ++// libs/core/src/lib/command/clean-stack.ts ++function cleanStack(err, className) { ++ const lines = isErrorWithStack(err) ? err.stack.split("\n") : String(err).split("\n"); ++ const cutoff = new RegExp(`^ at ${className}.runCommand .*$`); ++ const relevantIndex = lines.findIndex((line) => cutoff.test(line)); ++ if (relevantIndex) { ++ return lines.slice(0, relevantIndex).join("\n"); ++ } ++ return err.toString(); ++} ++function isErrorWithStack(err) { ++ return err.stack !== void 0; ++} ++var init_clean_stack = __esm({ ++ "libs/core/src/lib/command/clean-stack.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/core/src/lib/command/default-options.ts ++function defaultOptions(...sources) { ++ const options = {}; ++ for (const source of sources) { ++ if (source != null) { ++ for (const key of Object.keys(source)) { ++ if (options[key] === void 0) { ++ options[key] = source[key]; ++ } ++ } ++ } ++ } ++ return options; ++} ++var init_default_options = __esm({ ++ "libs/core/src/lib/command/default-options.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/core/src/lib/get-package-manifest-path.ts ++function getPackageManifestPath(node, files) { ++ const pkgJsonPath = (0, import_path7.resolve)((0, import_path7.join)(node.data.root, "package.json")); ++ return files.find((f) => (0, import_path7.resolve)(f.file) === pkgJsonPath)?.file; ++} ++var import_path7; ++var init_get_package_manifest_path = __esm({ ++ "libs/core/src/lib/get-package-manifest-path.ts"() { ++ "use strict"; ++ import_path7 = require("path"); ++ } ++}); ++ ++// libs/core/src/lib/command/create-project-graph-with-packages.ts ++async function createProjectGraphWithPackages(projectGraph, projectFileMap, packageConfigs) { ++ const _workspaceRoot = process.env["NX_WORKSPACE_ROOT_PATH"] || import_devkit3.workspaceRoot; ++ const projectNodes = Object.values(projectGraph.nodes); ++ const projectNodesMatchingPackageConfigs = projectNodes.filter((node) => { ++ const matchesRootPath = (config) => (0, import_minimatch2.default)(node.data.root, config); ++ return packageConfigs.some(matchesRootPath); ++ }); ++ const tuples = await Promise.all( ++ projectNodesMatchingPackageConfigs.map( ++ (node) => new Promise((resolve3) => { ++ const manifestPath = getPackageManifestPath(node, projectFileMap[node.name] || []); ++ if (manifestPath) { ++ const fullManifestPath = (0, import_path8.join)(_workspaceRoot, manifestPath); ++ resolve3((0, import_fs_extra.readJson)(fullManifestPath).then((manifest) => [node, manifest])); ++ } else { ++ resolve3([node, null]); ++ } ++ }) ++ ) ++ ); ++ const projectGraphWithOrderedNodes = { ++ ...projectGraph, ++ nodes: {}, ++ localPackageDependencies: {} ++ }; ++ const projectLookupByPackageName = {}; ++ const sortedTuples = [...tuples].sort((a, b) => a[0].data.root.localeCompare(b[0].data.root)); ++ sortedTuples.forEach(([node, manifest]) => { ++ let pkg2 = null; ++ if (manifest) { ++ pkg2 = new Package(manifest, (0, import_path8.join)(_workspaceRoot, node.data.root), _workspaceRoot); ++ projectLookupByPackageName[pkg2.name] = node.name; ++ } ++ projectGraphWithOrderedNodes.nodes[node.name] = { ++ ...node, ++ package: pkg2 ++ }; ++ }); ++ projectGraphWithOrderedNodes.dependencies = Object.keys(projectGraphWithOrderedNodes.dependencies).sort((a, b) => a.localeCompare(b)).reduce( ++ (prev, next) => ({ ++ ...prev, ++ [next]: projectGraphWithOrderedNodes.dependencies[next] ++ }), ++ {} ++ ); ++ Object.values(projectGraphWithOrderedNodes.dependencies).forEach((projectDeps) => { ++ const workspaceDeps = projectDeps.filter( ++ (dep) => !isExternalNpmDependency(dep.target) && !isExternalNpmDependency(dep.source) ++ ); ++ for (const dep of workspaceDeps) { ++ const source = projectGraphWithOrderedNodes.nodes[dep.source]; ++ const target = projectGraphWithOrderedNodes.nodes[dep.target]; ++ if (!source || !source.package || !target || !target.package) { ++ continue; ++ } ++ const sourcePkg = getPackage(source); ++ const targetPkg = getPackage(target); ++ const sourceNpmDependency = sourcePkg.getLocalDependency(targetPkg.name); ++ if (!sourceNpmDependency) { ++ continue; ++ } ++ const hasWorkspaceProtocol = sourceNpmDependency.spec.startsWith("workspace:"); ++ const workspaceDep = dep; ++ const resolvedTarget = resolvePackage( ++ targetPkg.name, ++ targetPkg.version, ++ sourceNpmDependency.spec, ++ sourcePkg.location ++ ); ++ const targetMatchesRequirement = hasWorkspaceProtocol || resolvedTarget.fetchSpec === targetPkg.location || (0, import_semver2.satisfies)( ++ targetPkg.version, ++ resolvedTarget.gitCommittish || resolvedTarget.gitRange || resolvedTarget.fetchSpec ++ ); ++ workspaceDep.dependencyCollection = sourceNpmDependency.collection; ++ workspaceDep.targetResolvedNpaResult = resolvedTarget; ++ workspaceDep.targetVersionMatchesDependencyRequirement = targetMatchesRequirement; ++ if (workspaceDep.targetVersionMatchesDependencyRequirement) { ++ projectGraphWithOrderedNodes.localPackageDependencies[dep.source] = [ ++ ...projectGraphWithOrderedNodes.localPackageDependencies[dep.source] || [], ++ workspaceDep ++ ]; ++ } ++ } ++ }); ++ return projectGraphWithOrderedNodes; ++} ++var import_devkit3, import_fs_extra, import_minimatch2, import_npm_package_arg2, import_path8, import_semver2, resolvePackage; ++var init_create_project_graph_with_packages = __esm({ ++ "libs/core/src/lib/command/create-project-graph-with-packages.ts"() { ++ "use strict"; ++ import_devkit3 = require("@nx/devkit"); ++ import_fs_extra = require("fs-extra"); ++ import_minimatch2 = __toESM(require("minimatch")); ++ import_npm_package_arg2 = require("npm-package-arg"); ++ import_path8 = require("path"); ++ import_semver2 = require("semver"); ++ init_get_package_manifest_path(); ++ init_package(); ++ init_project_graph_with_packages(); ++ resolvePackage = (name, version, spec, location) => { ++ spec = spec.replace(/^link:/, "file:"); ++ const isWorkspaceSpec = /^workspace:/.test(spec); ++ let workspaceSpec; ++ let workspaceAlias; ++ if (isWorkspaceSpec) { ++ workspaceSpec = spec; ++ spec = spec.replace(/^workspace:/, ""); ++ if (spec === "*" || spec === "^" || spec === "~") { ++ workspaceAlias = spec; ++ if (version) { ++ const prefix = spec === "*" ? "" : spec; ++ spec = `${prefix}${version}`; ++ } else { ++ spec = "*"; ++ } ++ } ++ } ++ const resolved = (0, import_npm_package_arg2.resolve)(name, spec, location); ++ resolved.workspaceSpec = workspaceSpec; ++ resolved.workspaceAlias = workspaceAlias; ++ return resolved; ++ }; ++ } ++}); ++ ++// libs/core/src/lib/command/detect-projects.ts ++async function detectProjects(packageConfigs) { ++ const _projectGraph = await (0, import_devkit4.createProjectGraphAsync)(); ++ const projectFileMap = await (0, import_devkit4.createProjectFileMapUsingProjectGraph)(_projectGraph); ++ const projectGraph = await createProjectGraphWithPackages(_projectGraph, projectFileMap, packageConfigs); ++ return { ++ projectGraph, ++ projectFileMap ++ }; ++} ++var import_devkit4; ++var init_detect_projects = __esm({ ++ "libs/core/src/lib/command/detect-projects.ts"() { ++ "use strict"; ++ import_devkit4 = require("@nx/devkit"); ++ init_create_project_graph_with_packages(); ++ } ++}); ++ ++// libs/core/src/lib/command/is-git-initialized.ts ++function isGitInitialized(cwd) { ++ const opts = { ++ cwd, ++ // don't throw, just want boolean ++ reject: false, ++ // only return code, no stdio needed ++ stdio: "ignore" ++ }; ++ return import_execa2.default.sync("git", ["rev-parse"], opts).exitCode === 0; ++} ++var import_execa2; ++var init_is_git_initialized = __esm({ ++ "libs/core/src/lib/command/is-git-initialized.ts"() { ++ "use strict"; ++ import_execa2 = __toESM(require("execa")); ++ } ++}); ++ ++// libs/core/src/lib/command/log-package-error.ts ++function logPackageError(err, stream3 = false) { ++ npmlog_default.error(err.command, `exited ${err.exitCode} in '${err.pkg.name}'`); ++ if (stream3) { ++ return; ++ } ++ if (err.stdout) { ++ npmlog_default.error(err.command, "stdout:"); ++ directLog(err.stdout); ++ } ++ if (err.stderr) { ++ npmlog_default.error(err.command, "stderr:"); ++ directLog(err.stderr); ++ } ++ npmlog_default.error(err.command, `exited ${err.exitCode} in '${err.pkg.name}'`); ++} ++function directLog(message) { ++ npmlog_default.pause(); ++ console.error(message); ++ npmlog_default.resume(); ++} ++var init_log_package_error = __esm({ ++ "libs/core/src/lib/command/log-package-error.ts"() { ++ "use strict"; ++ init_npmlog(); ++ } ++}); ++ ++// libs/core/src/lib/command/warn-if-hanging.ts ++function warnIfHanging() { ++ const childProcessCount = childProcess4.getChildProcessCount(); ++ if (childProcessCount > 0) { ++ npmlog_default.warn( ++ "complete", ++ `Waiting for ${childProcessCount} child process${childProcessCount === 1 ? "" : "es"} to exit. CTRL-C to exit immediately.` ++ ); ++ } ++} ++var childProcess4; ++var init_warn_if_hanging = __esm({ ++ "libs/core/src/lib/command/warn-if-hanging.ts"() { ++ "use strict"; ++ init_npmlog(); ++ childProcess4 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/core/src/lib/command/index.ts ++var import_dedent3, import_client, import_os2, DEFAULT_CONCURRENCY, Command; ++var init_command = __esm({ ++ "libs/core/src/lib/command/index.ts"() { ++ "use strict"; ++ import_dedent3 = __toESM(require("dedent")); ++ import_client = require("nx/src/daemon/client/client"); ++ import_os2 = __toESM(require("os")); ++ init_npmlog(); ++ init_project(); ++ init_validation_error(); ++ init_write_log_file(); ++ init_clean_stack(); ++ init_default_options(); ++ init_detect_projects(); ++ init_is_git_initialized(); ++ init_log_package_error(); ++ init_warn_if_hanging(); ++ DEFAULT_CONCURRENCY = import_os2.default.cpus().length; ++ Command = class _Command { ++ constructor(_argv, { ++ skipValidations, ++ preInitializedProjectData ++ } = { skipValidations: false }) { ++ this._argv = _argv; ++ npmlog_default.pause(); ++ npmlog_default.heading = "lerna"; ++ const argv = { ..._argv }; ++ npmlog_default.silly("argv", argv); ++ this.name = this.constructor.name.replace(/Command$/, "").toLowerCase(); ++ this.composed = typeof argv.composed === "string" && argv.composed !== this.name; ++ if (!this.composed) { ++ npmlog_default.notice("cli", `v${argv.lernaVersion}`); ++ } ++ let runner = new Promise((resolve3, reject) => { ++ let chain = Promise.resolve(); ++ chain = chain.then(() => { ++ this.project = new Project(argv.cwd, { skipLernaConfigValidations: skipValidations }); ++ }); ++ chain = chain.then(() => this.configureEnvironment()); ++ chain = chain.then(() => this.configureOptions()); ++ chain = chain.then(() => this.configureProperties()); ++ chain = chain.then(() => { ++ this.logger = _Command.createLogger(this.name, this.options.loglevel); ++ }); ++ if (!skipValidations) { ++ chain = chain.then(() => this.runValidations()); ++ } ++ chain = chain.then(() => { ++ if (preInitializedProjectData) { ++ this.projectFileMap = preInitializedProjectData.projectFileMap; ++ this.projectGraph = preInitializedProjectData.projectGraph; ++ return; ++ } ++ return this.detectProjects(); ++ }); ++ chain = chain.then(() => this.runPreparations()); ++ chain = chain.then(() => this.runCommand()); ++ chain.then( ++ (result) => { ++ warnIfHanging(); ++ import_client.daemonClient.reset(); ++ resolve3(result); ++ }, ++ (err) => { ++ if (err.pkg) { ++ logPackageError(err, this.options.stream); ++ } else if (err.name !== "ValidationError") { ++ npmlog_default.error("", cleanStack(err, this.constructor.name)); ++ } ++ if (err.name !== "ValidationError" && !err.pkg) { ++ writeLogFile(this.project.rootPath); ++ } ++ warnIfHanging(); ++ import_client.daemonClient.reset(); ++ reject(err); ++ } ++ ); ++ }); ++ if (argv.onResolved || argv.onRejected) { ++ runner = runner.then(argv.onResolved, argv.onRejected); ++ delete argv.onResolved; ++ delete argv.onRejected; ++ } ++ for (const key of ["cwd", "$0"]) { ++ Object.defineProperty(argv, key, { enumerable: false }); ++ } ++ Object.defineProperty(this, "argv", { ++ value: Object.freeze(argv) ++ }); ++ this.runner = runner; ++ } ++ name; ++ composed; ++ options = {}; ++ runner; ++ concurrency = 0; ++ toposort = false; ++ execOpts = {}; ++ logger; ++ envDefaults; ++ argv = {}; ++ projectGraph; ++ projectFileMap; ++ _project; ++ get project() { ++ if (this._project === void 0) { ++ throw new ValidationError("ENOPROJECT", "Lerna Project not initialized!"); ++ } ++ return this._project; ++ } ++ set project(project) { ++ this._project = project; ++ } ++ static createLogger(name, loglevel) { ++ if (loglevel) { ++ npmlog_default.level = loglevel; ++ } ++ npmlog_default.addLevel("success", 3001, { fg: "green", bold: true }); ++ npmlog_default.resume(); ++ return npmlog_default["newGroup"](name); ++ } ++ // proxy "Promise" methods to "private" instance ++ then(onResolved, onRejected) { ++ return this.runner.then(onResolved, onRejected); ++ } ++ /* istanbul ignore next */ ++ catch(onRejected) { ++ return this.runner.catch(onRejected); ++ } ++ get requiresGit() { ++ return true; ++ } ++ // Override this to inherit config from another command. ++ // For example `changed` inherits config from `publish`. ++ get otherCommandConfigs() { ++ return []; ++ } ++ async detectProjects() { ++ const { projectGraph, projectFileMap } = await detectProjects(this.project.packageConfigs); ++ this.projectGraph = projectGraph; ++ this.projectFileMap = projectFileMap; ++ } ++ configureEnvironment() { ++ const ci = require("is-ci"); ++ let loglevel; ++ let progress; ++ if (ci || !process.stderr.isTTY) { ++ npmlog_default.disableColor(); ++ progress = false; ++ } else if (!process.stdout.isTTY) { ++ progress = false; ++ loglevel = "error"; ++ } else if (process.stderr.isTTY) { ++ npmlog_default.enableColor(); ++ npmlog_default.enableUnicode(); ++ } ++ Object.defineProperty(this, "envDefaults", { ++ value: { ++ ci, ++ progress, ++ loglevel ++ } ++ }); ++ } ++ configureOptions() { ++ const commandConfig = this.project.config.command || {}; ++ const overrides = [this.name, ...this.otherCommandConfigs].map((key) => commandConfig[key]); ++ this.options = defaultOptions( ++ // CLI flags, which if defined overrule subsequent values ++ this.argv, ++ ...overrides, ++ // Global options from `lerna.json` ++ this.project.config, ++ // Environmental defaults prepared in previous step ++ this.envDefaults ++ ); ++ if (this.options.verbose && this.options.loglevel !== "silly") { ++ this.options.loglevel = "verbose"; ++ } ++ } ++ configureProperties() { ++ const { concurrency = 0, sort, maxBuffer } = this.options; ++ this.concurrency = Math.max(1, +concurrency || DEFAULT_CONCURRENCY); ++ this.toposort = sort === void 0 || sort; ++ this.execOpts = { ++ cwd: this.project.rootPath, ++ maxBuffer ++ }; ++ } ++ enableProgressBar() { ++ if (this.options.progress !== false) { ++ npmlog_default.enableProgress(); ++ } ++ } ++ runValidations() { ++ if ((this.options.since !== void 0 || this.requiresGit) && !isGitInitialized(this.project.rootPath)) { ++ throw new ValidationError( ++ "ENOGIT", ++ "The git binary was not found, this is not a git repository, or you git doesn't have the right ownership. Run `git rev-parse` to get more details." ++ ); ++ } ++ if (this.options.independent && !this.project.isIndependent()) { ++ throw new ValidationError( ++ "EVERSIONMODE", ++ import_dedent3.default` ++ You ran lerna with --independent or -i, but the repository is not set to independent mode. ++ To use independent mode you need to set lerna.json's "version" property to "independent". ++ Then you won't need to pass the --independent or -i flags. ++ ` ++ ); ++ } ++ } ++ runPreparations() { ++ if (!this.composed && this.project.isIndependent()) { ++ npmlog_default.info("versioning", "independent"); ++ } ++ if (!this.composed && this.options.ci) { ++ npmlog_default.info("ci", "enabled"); ++ } ++ } ++ async runCommand() { ++ const proceed = await this.initialize(); ++ if (proceed !== false) { ++ return this.execute(); ++ } ++ return void 0; ++ } ++ initialize() { ++ throw new ValidationError(this.name, "initialize() needs to be implemented."); ++ } ++ /** ++ * The execute() method can return a value in some cases (e.g. on the version command) ++ */ ++ execute() { ++ throw new ValidationError(this.name, "execute() needs to be implemented."); ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/conventional-commits/apply-build-metadata.ts ++function applyBuildMetadata(version, buildMetadata) { ++ if (!buildMetadata) { ++ return version; ++ } ++ if (isValidBuildMetadata(buildMetadata)) { ++ return `${version}+${buildMetadata}`; ++ } ++ throw new ValidationError("EBUILDMETADATA", "Build metadata does not satisfy SemVer specification."); ++} ++function isValidBuildMetadata(buildMetadata) { ++ return BUILD_METADATA_REGEX.test(buildMetadata); ++} ++var BUILD_METADATA_REGEX; ++var init_apply_build_metadata = __esm({ ++ "libs/core/src/lib/conventional-commits/apply-build-metadata.ts"() { ++ "use strict"; ++ init_validation_error(); ++ BUILD_METADATA_REGEX = /^[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*$/; ++ } ++}); ++ ++// libs/core/src/lib/conventional-commits/get-changelog-config.ts ++function isFunction(config) { ++ return Object.prototype.toString.call(config) === "[object Function]" || Object.prototype.toString.call(config) === "[object AsyncFunction]"; ++} ++function resolveConfigPromise(presetPackageName, presetConfig) { ++ npmlog_default.verbose("getChangelogConfig", "Attempting to resolve preset %j", presetPackageName); ++ let config = require(presetPackageName); ++ npmlog_default.info("getChangelogConfig", "Successfully resolved preset %j", presetPackageName); ++ if (isFunction(config)) { ++ try { ++ config = config(presetConfig); ++ } catch (_) { ++ config = (0, import_pify.default)(config)(); ++ } ++ } ++ return config; ++} ++function getChangelogConfig(changelogPreset = "conventional-changelog-angular", rootPath) { ++ const presetName = typeof changelogPreset === "string" ? changelogPreset : changelogPreset.name; ++ const presetConfig = typeof changelogPreset === "object" ? changelogPreset : {}; ++ const cacheKey = `${presetName}${presetConfig ? JSON.stringify(presetConfig) : ""}`; ++ let config = cfgCache.get(cacheKey); ++ if (!config) { ++ let presetPackageName = presetName; ++ const parsed = (0, import_npm_package_arg3.default)(presetPackageName, rootPath); ++ npmlog_default.verbose("getChangelogConfig", "using preset %j", presetPackageName); ++ npmlog_default.silly("npa", parsed); ++ if (parsed.type === "directory") { ++ if (parsed.raw[0] === "@") { ++ parsed.name = parsed.raw; ++ parsed.scope = parsed.raw.substring(0, parsed.raw.indexOf("/")); ++ } else { ++ presetPackageName = parsed.fetchSpec; ++ } ++ } else if (parsed.type === "git" && parsed.hosted && parsed.hosted.default === "shortcut") { ++ parsed.name = parsed.raw; ++ } ++ try { ++ config = resolveConfigPromise(presetPackageName, presetConfig); ++ cfgCache.set(cacheKey, config); ++ return Promise.resolve(config); ++ } catch (err) { ++ npmlog_default.verbose("getChangelogConfig", err.message); ++ npmlog_default.info("getChangelogConfig", "Auto-prefixing conventional-changelog preset %j", presetName); ++ parsed.name = parsed.raw; ++ } ++ if (parsed.name.indexOf("conventional-changelog-") < 0) { ++ const parts = parsed.name.split("/"); ++ const start = parsed.scope ? 1 : 0; ++ parts.splice(start, 1, `conventional-changelog-${parts[start]}`); ++ presetPackageName = parts.join("/"); ++ } ++ try { ++ config = resolveConfigPromise(presetPackageName, presetConfig); ++ cfgCache.set(cacheKey, config); ++ } catch (err) { ++ npmlog_default.warn("getChangelogConfig", err.message); ++ throw new ValidationError( ++ "EPRESET", ++ `Unable to load conventional-changelog preset '${presetName}'${presetName !== presetPackageName ? ` (${presetPackageName})` : ""}` ++ ); ++ } ++ } ++ return Promise.resolve(config); ++} ++var import_npm_package_arg3, import_pify, cfgCache; ++var init_get_changelog_config = __esm({ ++ "libs/core/src/lib/conventional-commits/get-changelog-config.ts"() { ++ "use strict"; ++ import_npm_package_arg3 = __toESM(require("npm-package-arg")); ++ import_pify = __toESM(require("pify")); ++ init_npmlog(); ++ init_validation_error(); ++ cfgCache = /* @__PURE__ */ new Map(); ++ } ++}); ++ ++// libs/core/src/lib/conventional-commits/recommend-version.ts ++function recommendVersion(pkg2, type, { ++ changelogPreset, ++ rootPath, ++ tagPrefix, ++ prereleaseId, ++ conventionalBumpPrerelease, ++ buildMetadata ++}, premajorVersionBump) { ++ npmlog_default.silly(type, "for %s at %s", pkg2.name, pkg2.location); ++ const options = { ++ path: pkg2.location ++ }; ++ if (type === "independent") { ++ options.lernaPackage = pkg2.name; ++ } else { ++ options.tagPrefix = tagPrefix; ++ } ++ const shouldBumpPrerelease = (releaseType, version) => { ++ if (!import_semver3.default.prerelease(version)) { ++ return true; ++ } ++ switch (releaseType) { ++ case "major": ++ return import_semver3.default.minor(version) !== 0 || import_semver3.default.patch(version) !== 0; ++ case "minor": ++ return import_semver3.default.patch(version) !== 0; ++ default: ++ return false; ++ } ++ }; ++ let chain = Promise.resolve(); ++ chain = chain.then(() => getChangelogConfig(changelogPreset, rootPath)); ++ chain = chain.then((config) => { ++ options.config = config; ++ return new Promise((resolve3, reject) => { ++ (0, import_conventional_recommended_bump.default)(options, (err, data) => { ++ if (err) { ++ return reject(err); ++ } ++ let releaseType = data.releaseType || "patch"; ++ if (prereleaseId) { ++ const shouldBump = conventionalBumpPrerelease || shouldBumpPrerelease(releaseType, pkg2.version); ++ const prereleaseType = shouldBump ? `pre${releaseType}` : "prerelease"; ++ npmlog_default.verbose(type, "increment %s by %s", pkg2.version, prereleaseType); ++ resolve3(applyBuildMetadata(import_semver3.default.inc(pkg2.version, prereleaseType, prereleaseId), buildMetadata)); ++ } else { ++ if (import_semver3.default.major(pkg2.version) === 0) { ++ if (releaseType === "major") { ++ releaseType = "minor"; ++ } else if (premajorVersionBump === "force-patch") { ++ releaseType = "patch"; ++ } ++ } ++ npmlog_default.verbose(type, "increment %s by %s", pkg2.version, releaseType); ++ resolve3(applyBuildMetadata(import_semver3.default.inc(pkg2.version, releaseType), buildMetadata)); ++ } ++ }); ++ }); ++ }); ++ return chain; ++} ++var import_conventional_recommended_bump, import_semver3; ++var init_recommend_version = __esm({ ++ "libs/core/src/lib/conventional-commits/recommend-version.ts"() { ++ "use strict"; ++ import_conventional_recommended_bump = __toESM(require("conventional-recommended-bump")); ++ import_semver3 = __toESM(require("semver")); ++ init_npmlog(); ++ init_apply_build_metadata(); ++ init_get_changelog_config(); ++ } ++}); ++ ++// libs/core/src/lib/conventional-commits/constants.ts ++var EOL, BLANK_LINE, COMMIT_GUIDELINE, CHANGELOG_HEADER; ++var init_constants = __esm({ ++ "libs/core/src/lib/conventional-commits/constants.ts"() { ++ "use strict"; ++ EOL = "\n"; ++ BLANK_LINE = EOL + EOL; ++ COMMIT_GUIDELINE = "See [Conventional Commits](https://conventionalcommits.org) for commit guidelines."; ++ CHANGELOG_HEADER = [ ++ "# Change Log", ++ "", ++ "All notable changes to this project will be documented in this file.", ++ COMMIT_GUIDELINE ++ ].join(EOL); ++ } ++}); ++ ++// libs/core/src/lib/conventional-commits/make-bump-only-filter.ts ++function makeBumpOnlyFilter(pkg2) { ++ return (newEntry) => { ++ if (!newEntry.split("\n").some((line) => line.startsWith("*"))) { ++ const message = `**Note:** Version bump only for package ${pkg2.name}`; ++ return [newEntry.trim(), message, BLANK_LINE].join(BLANK_LINE); ++ } ++ return newEntry; ++ }; ++} ++var init_make_bump_only_filter = __esm({ ++ "libs/core/src/lib/conventional-commits/make-bump-only-filter.ts"() { ++ "use strict"; ++ init_constants(); ++ } ++}); ++ ++// libs/core/src/lib/conventional-commits/read-existing-changelog.ts ++function readExistingChangelog(pkg2) { ++ const changelogFileLoc = import_path9.default.join(pkg2.location, "CHANGELOG.md"); ++ let chain = Promise.resolve(); ++ chain = chain.then(() => import_fs_extra2.default.readFile(changelogFileLoc, "utf8").catch(() => "")); ++ chain = chain.then((changelogContents) => { ++ const headerIndex = changelogContents.indexOf(COMMIT_GUIDELINE); ++ if (headerIndex !== -1) { ++ return changelogContents.substring(headerIndex + COMMIT_GUIDELINE.length + BLANK_LINE.length); ++ } ++ return changelogContents; ++ }); ++ chain = chain.then((changelogContents) => [changelogFileLoc, changelogContents]); ++ return chain; ++} ++var import_fs_extra2, import_path9; ++var init_read_existing_changelog = __esm({ ++ "libs/core/src/lib/conventional-commits/read-existing-changelog.ts"() { ++ "use strict"; ++ import_fs_extra2 = __toESM(require("fs-extra")); ++ import_path9 = __toESM(require("path")); ++ init_constants(); ++ } ++}); ++ ++// libs/core/src/lib/conventional-commits/update-changelog.ts ++function updateChangelog(pkg2, type, { ++ changelogPreset, ++ changelogEntryAdditionalMarkdown, ++ rootPath, ++ tagPrefix = "v", ++ version ++}) { ++ npmlog_default.silly(type, "for %s at %s", pkg2.name, pkg2.location); ++ return getChangelogConfig(changelogPreset, rootPath).then((config) => { ++ const options = {}; ++ const context = {}; ++ if (config.conventionalChangelog) { ++ options.config = Object.assign({}, config.conventionalChangelog); ++ } else { ++ options.config = Object.assign({}, config); ++ } ++ const gitRawCommitsOpts = Object.assign({}, options.config.gitRawCommitsOpts); ++ if (type === "root") { ++ context.version = version; ++ context.currentTag = `${tagPrefix}${version}`; ++ options.tagPrefix = tagPrefix; ++ } else { ++ gitRawCommitsOpts.path = pkg2.location; ++ options.pkg = { path: pkg2.manifestLocation }; ++ if (type === "independent") { ++ options.lernaPackage = pkg2.name; ++ } else { ++ options.tagPrefix = tagPrefix; ++ context.currentTag = `${tagPrefix}${pkg2.version}`; ++ } ++ } ++ const changelogStream = (0, import_conventional_changelog_core.default)(options, context, gitRawCommitsOpts); ++ return Promise.all([ ++ (0, import_get_stream.default)(changelogStream).then(makeBumpOnlyFilter(pkg2)), ++ readExistingChangelog(pkg2) ++ ]).then(([newEntry, [changelogFileLoc, changelogContents]]) => { ++ if (changelogEntryAdditionalMarkdown) { ++ const trailingWhitespace = newEntry.match(/\s*$/); ++ newEntry = newEntry.replace( ++ /\s*$/, ++ BLANK_LINE + changelogEntryAdditionalMarkdown + trailingWhitespace ++ ); ++ } ++ npmlog_default.silly(type, "writing new entry: %j", newEntry); ++ const content = [CHANGELOG_HEADER, newEntry, changelogContents].join(BLANK_LINE); ++ return import_fs_extra3.default.writeFile(changelogFileLoc, content.trim() + EOL).then(() => { ++ npmlog_default.verbose(type, "wrote", changelogFileLoc); ++ return { ++ logPath: changelogFileLoc, ++ newEntry ++ }; ++ }); ++ }); ++ }); ++} ++var import_conventional_changelog_core, import_fs_extra3, import_get_stream; ++var init_update_changelog = __esm({ ++ "libs/core/src/lib/conventional-commits/update-changelog.ts"() { ++ "use strict"; ++ import_conventional_changelog_core = __toESM(require("conventional-changelog-core")); ++ import_fs_extra3 = __toESM(require("fs-extra")); ++ import_get_stream = __toESM(require("get-stream")); ++ init_npmlog(); ++ init_constants(); ++ init_get_changelog_config(); ++ init_make_bump_only_filter(); ++ init_read_existing_changelog(); ++ } ++}); ++ ++// libs/core/src/lib/conventional-commits/index.ts ++var init_conventional_commits = __esm({ ++ "libs/core/src/lib/conventional-commits/index.ts"() { ++ "use strict"; ++ init_recommend_version(); ++ init_update_changelog(); ++ init_apply_build_metadata(); ++ } ++}); ++ ++// libs/core/src/lib/corepack/is-corepack-enabled.ts ++function isCorepackEnabled() { ++ return process.env["COREPACK_ROOT"] !== void 0; ++} ++var init_is_corepack_enabled = __esm({ ++ "libs/core/src/lib/corepack/is-corepack-enabled.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/core/src/lib/corepack/exec-package-manager.ts ++function createCommandAndArgs(npmClient, args) { ++ let command = npmClient; ++ const commandArgs = [...args]; ++ if (isCorepackEnabled()) { ++ commandArgs.unshift(command); ++ command = "corepack"; ++ } ++ return { command, commandArgs }; ++} ++function execPackageManager(npmClient, args, opts) { ++ const { command, commandArgs } = createCommandAndArgs(npmClient, args); ++ return childProcess5.exec(command, commandArgs, opts); ++} ++function execPackageManagerSync(npmClient, args, opts) { ++ const { command, commandArgs } = createCommandAndArgs(npmClient, args); ++ return childProcess5.execSync(command, commandArgs, opts); ++} ++var childProcess5; ++var init_exec_package_manager = __esm({ ++ "libs/core/src/lib/corepack/exec-package-manager.ts"() { ++ "use strict"; ++ init_is_corepack_enabled(); ++ childProcess5 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/core/src/lib/corepack/index.ts ++var init_corepack = __esm({ ++ "libs/core/src/lib/corepack/index.ts"() { ++ "use strict"; ++ init_exec_package_manager(); ++ } ++}); ++ ++// libs/core/src/lib/filter-options.ts ++function filterOptions(yargs2) { ++ const opts = { ++ scope: { ++ describe: "Include only packages with names matching the given glob.", ++ type: "string", ++ requiresArg: true ++ }, ++ ignore: { ++ describe: "Exclude packages with names matching the given glob.", ++ type: "string", ++ requiresArg: true ++ }, ++ "no-private": { ++ describe: 'Exclude packages with { "private": true } in their package.json.', ++ type: "boolean" ++ }, ++ private: { ++ // proxy for --no-private ++ hidden: true, ++ type: "boolean" ++ }, ++ since: { ++ describe: import_dedent4.default` ++ Only include packages that have been changed since the specified [ref]. ++ If no ref is passed, it defaults to the most-recent tag. ++ `, ++ type: "string" ++ }, ++ "exclude-dependents": { ++ describe: import_dedent4.default` ++ Exclude all transitive dependents when running a command ++ with --since, overriding the default "changed" algorithm. ++ `, ++ conflicts: "include-dependents", ++ type: "boolean" ++ }, ++ "include-dependents": { ++ describe: import_dedent4.default` ++ Include all transitive dependents when running a command ++ regardless of --scope, --ignore, or --since. ++ `, ++ conflicts: "exclude-dependents", ++ type: "boolean" ++ }, ++ "include-dependencies": { ++ describe: import_dedent4.default` ++ Include all transitive dependencies when running a command ++ regardless of --scope, --ignore, or --since. ++ `, ++ type: "boolean" ++ }, ++ "include-merged-tags": { ++ describe: "Include tags from merged branches when running a command with --since.", ++ type: "boolean" ++ }, ++ "continue-if-no-match": { ++ describe: "Don't fail if no package is matched", ++ hidden: true, ++ type: "boolean" ++ } ++ }; ++ return yargs2.options(opts).group(Object.keys(opts), "Filter Options:").option("include-filtered-dependents", { ++ // TODO: remove in next major release ++ hidden: true, ++ conflicts: ["exclude-dependents", "include-dependents"], ++ type: "boolean" ++ }).option("include-filtered-dependencies", { ++ // TODO: remove in next major release ++ hidden: true, ++ conflicts: "include-dependencies", ++ type: "boolean" ++ }).check((argv) => { ++ if (argv["includeFilteredDependents"]) { ++ argv["includeDependents"] = true; ++ argv["include-dependents"] = true; ++ delete argv["includeFilteredDependents"]; ++ delete argv["include-filtered-dependents"]; ++ npmlog_default.warn("deprecated", "--include-filtered-dependents has been renamed --include-dependents"); ++ } ++ if (argv["includeFilteredDependencies"]) { ++ argv["includeDependencies"] = true; ++ argv["include-dependencies"] = true; ++ delete argv["includeFilteredDependencies"]; ++ delete argv["include-filtered-dependencies"]; ++ npmlog_default.warn("deprecated", "--include-filtered-dependencies has been renamed --include-dependencies"); ++ } ++ return argv; ++ }); ++} ++var import_dedent4; ++var init_filter_options = __esm({ ++ "libs/core/src/lib/filter-options.ts"() { ++ "use strict"; ++ import_dedent4 = __toESM(require("dedent")); ++ init_npmlog(); ++ } ++}); ++ ++// libs/core/src/lib/filter-projects.ts ++function filterProjects(projectGraph, execOpts = {}, opts = {}) { ++ const options = { log: npmlog_default, ...opts }; ++ if (options.scope) { ++ options.log.notice("filter", "including %j", options.scope); ++ } ++ if (options.ignore) { ++ options.log.notice("filter", "excluding %j", options.ignore); ++ } ++ let projects = Object.values(projectGraph.nodes).filter((p) => !!p.package); ++ const patterns = [].concat(arrify(options.scope), negate(arrify(options.ignore))); ++ if (options.private === false) { ++ projects = projects.filter((p) => !p.package?.private); ++ } ++ const patternsToLog = [...patterns]; ++ if (patterns.length) { ++ if (!options.scope?.length) { ++ patterns.unshift("**"); ++ } ++ const packageNames = Array.from(projects).map((p) => p.package?.name).filter((p) => !!p); ++ const chosen = new Set((0, import_multimatch.default)(packageNames, patterns)); ++ projects = projects.filter((p) => p.package?.name && chosen.has(p.package.name)); ++ if (!projects.length && !options.continueIfNoMatch) { ++ throw new ValidationError("EFILTER", import_util.default.format("No packages remain after filtering", patterns)); ++ } ++ } ++ if (options.since !== void 0) { ++ options.log.notice("filter", "changed since %j", options.since); ++ if (options.excludeDependents) { ++ options.log.notice("filter", "excluding dependents"); ++ } ++ if (options.includeMergedTags) { ++ options.log.notice("filter", "including merged tags"); ++ } ++ const updates = collectProjectUpdates(projects, projectGraph, execOpts, opts); ++ const updated = new Set(updates.map((node) => node.name)); ++ projects = projects.filter((project) => updated.has(project.name)); ++ } ++ if (options.includeDependents) { ++ options.log.notice("filter", "including dependents"); ++ projects = addDependents(projects, projectGraph); ++ } ++ if (options.includeDependencies) { ++ options.log.notice("filter", "including dependencies"); ++ projects = addDependencies(projects, projectGraph); ++ } ++ if (patternsToLog.length) { ++ npmlog_default.info("filter", patternsToLog); ++ } ++ return projects; ++} ++function arrify(thing) { ++ if (!thing) { ++ return []; ++ } ++ if (!Array.isArray(thing)) { ++ return [thing]; ++ } ++ return thing; ++} ++function negate(patterns) { ++ return patterns.map((pattern) => `!${pattern}`); ++} ++var import_multimatch, import_util; ++var init_filter_projects = __esm({ ++ "libs/core/src/lib/filter-projects.ts"() { ++ "use strict"; ++ import_multimatch = __toESM(require("multimatch")); ++ import_util = __toESM(require("util")); ++ init_add_dependencies(); ++ init_add_dependents(); ++ init_collect_project_updates(); ++ init_npmlog(); ++ init_validation_error(); ++ } ++}); ++ ++// libs/core/src/lib/git-checkout.ts ++function gitCheckout(stagedFiles, gitOpts, execOpts) { ++ const files = gitOpts.granularPathspec ? stagedFiles : "."; ++ npmlog_default.silly("gitCheckout", files); ++ return childProcess6.exec("git", ["checkout", "--"].concat(files), execOpts); ++} ++var childProcess6; ++var init_git_checkout = __esm({ ++ "libs/core/src/lib/git-checkout.ts"() { ++ "use strict"; ++ init_npmlog(); ++ childProcess6 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/core/src/lib/has-npm-version.ts ++var import_semver4, childProcess7; ++var init_has_npm_version = __esm({ ++ "libs/core/src/lib/has-npm-version.ts"() { ++ "use strict"; ++ import_semver4 = __toESM(require("semver")); ++ childProcess7 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/core/src/lib/cycles/get-cycles.ts ++function getCycles(dependencies) { ++ const cycles = []; ++ const visited = /* @__PURE__ */ new Set(); ++ function dfs(next, path24) { ++ visited.add(next); ++ path24.push(next); ++ for (const dep of dependencies[next] || []) { ++ if (path24.includes(dep)) { ++ const cycle = path24.slice(path24.indexOf(dep)); ++ cycles.push(cycle); ++ } else if (!visited.has(dep)) { ++ dfs(dep, path24); ++ } ++ } ++ path24.pop(); ++ } ++ for (const next of Object.keys(dependencies)) { ++ if (!visited.has(next)) { ++ dfs(next, []); ++ } ++ } ++ return cycles; ++} ++var init_get_cycles = __esm({ ++ "libs/core/src/lib/cycles/get-cycles.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/core/src/lib/cycles/merge-overlapping-cycles.ts ++function intersection(arr1, arr2) { ++ return arr1.filter((item) => arr2.includes(item)); ++} ++function difference(arr1, arr2) { ++ return arr1.filter((item) => !arr2.includes(item)); ++} ++function mergeOverlappingCycles(cycles) { ++ const mergedCycles = []; ++ cycles.forEach((cycle) => { ++ let intersectionNodes = []; ++ const mergedCycle = mergedCycles.find((mergedCycle2) => { ++ intersectionNodes = intersection(mergedCycle2, cycle); ++ return intersectionNodes.length > 0; ++ }); ++ if (mergedCycle) { ++ mergedCycle.push(...difference(cycle, intersectionNodes)); ++ } else { ++ mergedCycles.push(cycle); ++ } ++ }); ++ return mergedCycles; ++} ++var init_merge_overlapping_cycles = __esm({ ++ "libs/core/src/lib/cycles/merge-overlapping-cycles.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/core/src/lib/cycles/report-cycles.ts ++function reportCycles(cycles, rejectCycles) { ++ const cyclesWithRepeatedNodes = cycles.map((cycle) => [...cycle, cycle[0]]); ++ const paths = Array.from(cyclesWithRepeatedNodes, (cycle) => cycle.join(" -> "), false); ++ if (!paths.length) { ++ return; ++ } ++ const cycleMessage = ["Dependency cycles detected, you should fix these!"].concat(paths).join("\n"); ++ if (rejectCycles) { ++ throw new ValidationError("ECYCLE", cycleMessage); ++ } ++ npmlog_default.warn("ECYCLE", cycleMessage); ++} ++var init_report_cycles = __esm({ ++ "libs/core/src/lib/cycles/report-cycles.ts"() { ++ "use strict"; ++ init_npmlog(); ++ init_validation_error(); ++ } ++}); ++ ++// libs/core/src/lib/cycles/index.ts ++var init_cycles = __esm({ ++ "libs/core/src/lib/cycles/index.ts"() { ++ "use strict"; ++ init_get_cycles(); ++ init_merge_overlapping_cycles(); ++ init_report_cycles(); ++ } ++}); ++ ++// libs/core/src/lib/toposort-projects.ts ++function toposortProjects(projects, projectGraph, rejectCycles = false) { ++ const projectsMap = new Map(projects.map((p) => [p.name, p])); ++ const localDependencies = projectGraph.localPackageDependencies; ++ const flattenedLocalDependencies = Object.values(localDependencies).flat(); ++ const getProject = (name) => { ++ const project = projectsMap.get(name); ++ if (!project) { ++ throw new Error(`Failed to find project ${name}. This is likely a bug in Lerna's toposort algorithm.`); ++ } ++ return project; ++ }; ++ const dependenciesBySource = projects.reduce( ++ (prev, next) => ({ ++ ...prev, ++ [next.name]: /* @__PURE__ */ new Set() ++ }), ++ {} ++ ); ++ flattenedLocalDependencies.forEach((dep) => { ++ if (dependenciesBySource[dep.source] && projectsMap.has(dep.target)) { ++ dependenciesBySource[dep.source].add(dep.target); ++ } ++ }); ++ const unmergedCycles = getCycles(dependenciesBySource); ++ reportCycles(unmergedCycles, rejectCycles); ++ const cycles = new Set(mergeOverlappingCycles(unmergedCycles)); ++ const seen = /* @__PURE__ */ new Set(); ++ const queueNextPackages = () => { ++ if (seen.size === projects.length) { ++ return; ++ } ++ let batch = Object.keys(dependenciesBySource).filter((p) => dependenciesBySource[p].size === 0).filter((p) => !seen.has(p)); ++ if (batch.length === 0) { ++ const cycle = Array.from(cycles.values()).find((cycle2) => { ++ const cycleHasExternalDependencies = cycle2.some((project) => { ++ const projectDeps = dependenciesBySource[project]; ++ const depIsNotInCycle = (dep) => cycle2.indexOf(dep) === -1; ++ return !!projectDeps && Array.from(projectDeps).filter(depIsNotInCycle).length > 0; ++ }); ++ return !cycleHasExternalDependencies; ++ }); ++ if (cycle) { ++ cycles.delete(cycle); ++ batch = cycle.filter((p) => projectsMap.has(p)); ++ } ++ } ++ batch.forEach((p) => { ++ seen.add(p); ++ delete dependenciesBySource[p]; ++ Object.keys(dependenciesBySource).forEach((dep) => dependenciesBySource[dep].delete(p)); ++ }); ++ queueNextPackages(); ++ }; ++ queueNextPackages(); ++ return Array.from(seen).map((p) => getProject(p)); ++} ++var init_toposort_projects = __esm({ ++ "libs/core/src/lib/toposort-projects.ts"() { ++ "use strict"; ++ init_cycles(); ++ } ++}); ++ ++// libs/core/src/lib/listable-format-projects.ts ++function listableFormatProjects(projectsList, projectGraph, options) { ++ const viewOptions = parseViewOptions(options); ++ const resultList = filterResultList(projectsList, projectGraph, viewOptions); ++ const count = resultList.length; ++ let text; ++ if (viewOptions.showJSON) { ++ text = formatJSON(resultList); ++ } else if (viewOptions.showNDJSON) { ++ text = formatNDJSON(resultList); ++ } else if (viewOptions.showParseable) { ++ text = formatParseable(resultList, viewOptions); ++ } else if (viewOptions.showGraph) { ++ text = formatJSONGraph(resultList, viewOptions); ++ } else { ++ text = formatColumns(resultList, viewOptions); ++ } ++ return { text, count }; ++} ++function parseViewOptions(options) { ++ const alias = options._[0]; ++ return { ++ showAll: alias === "la" || options.all, ++ showLong: alias === "la" || alias === "ll" || options.long, ++ showJSON: options.json, ++ showNDJSON: options.ndjson, ++ showParseable: options.parseable, ++ isTopological: options.toposort, ++ showGraph: options.graph ++ }; ++} ++function filterResultList(projectList, projectGraph, viewOptions) { ++ let result = viewOptions.showAll ? projectList : projectList.filter((project) => !getPackage(project).private); ++ if (viewOptions.isTopological) { ++ result = toposortProjects(result, projectGraph); ++ } ++ return result; ++} ++function toJSONList(resultList, addtionalProperties = () => ({})) { ++ return resultList.map((project) => { ++ const pkg2 = getPackage(project); ++ return { ++ name: pkg2.name, ++ version: pkg2.version, ++ private: pkg2.private, ++ location: pkg2.location, ++ ...addtionalProperties(project) ++ }; ++ }); ++} ++function formatJSON(resultList, additionalProperties = () => ({})) { ++ return JSON.stringify(toJSONList(resultList, additionalProperties), null, 2); ++} ++function formatNDJSON(resultList) { ++ return toJSONList(resultList).map((data) => JSON.stringify(data)).join("\n"); ++} ++function formatJSONGraph(resultList, viewOptions) { ++ const graph = {}; ++ const getNeighbors = viewOptions.showAll ? (pkg2) => Object.keys( ++ Object.assign( ++ {}, ++ pkg2.devDependencies, ++ pkg2.peerDependencies, ++ pkg2.optionalDependencies, ++ pkg2.dependencies ++ ) ++ ).sort() : (pkg2) => Object.keys( ++ Object.assign( ++ {}, ++ // no devDependencies ++ // no peerDependencies ++ pkg2.optionalDependencies, ++ pkg2.dependencies ++ ) ++ ).sort(); ++ for (const project of resultList) { ++ const pkg2 = getPackage(project); ++ graph[pkg2.name] = getNeighbors(pkg2); ++ } ++ return JSON.stringify(graph, null, 2); ++} ++function makeParseable(pkg2) { ++ const result = [pkg2.location, pkg2.name]; ++ if (pkg2.version) { ++ result.push(pkg2.version); ++ } else { ++ result.push("MISSING"); ++ } ++ if (pkg2.private) { ++ result.push("PRIVATE"); ++ } ++ return result.join(":"); ++} ++function formatParseable(resultList, viewOptions) { ++ return resultList.map((project) => { ++ const pkg2 = getPackage(project); ++ return viewOptions.showLong ? makeParseable(pkg2) : pkg2.location; ++ }).join("\n"); ++} ++function getColumnOrder(viewOptions) { ++ const columns = ["name"]; ++ if (viewOptions.showLong) { ++ columns.push("version", "location"); ++ } ++ if (viewOptions.showAll) { ++ columns.push("private"); ++ } ++ return columns; ++} ++function trimmedColumns(formattedResults, viewOptions) { ++ const str = (0, import_columnify.default)(formattedResults, { ++ showHeaders: false, ++ columns: getColumnOrder(viewOptions), ++ config: { ++ version: { ++ align: "right" ++ } ++ } ++ }); ++ return str.split("\n").map((line) => line.trimRight()).join("\n"); ++} ++function formatColumns(resultList, viewOptions) { ++ const formattedResults = resultList.map((project) => { ++ const pkg2 = getPackage(project); ++ const formatted = { ++ name: pkg2.name ++ }; ++ if (pkg2.version) { ++ formatted.version = import_chalk3.default.green(`v${pkg2.version}`); ++ } else { ++ formatted.version = import_chalk3.default.yellow("MISSING"); ++ } ++ if (pkg2.private) { ++ formatted.private = `(${import_chalk3.default.red("PRIVATE")})`; ++ } ++ formatted.location = import_chalk3.default.grey(import_path10.default.relative(".", pkg2.location)); ++ return formatted; ++ }); ++ return trimmedColumns(formattedResults, viewOptions); ++} ++var import_chalk3, import_columnify, import_path10; ++var init_listable_format_projects = __esm({ ++ "libs/core/src/lib/listable-format-projects.ts"() { ++ "use strict"; ++ import_chalk3 = __toESM(require("chalk")); ++ import_columnify = __toESM(require("columnify")); ++ import_path10 = __toESM(require("path")); ++ init_project_graph_with_packages(); ++ init_toposort_projects(); ++ } ++}); ++ ++// libs/core/src/lib/listable-options.ts ++function listableOptions(yargs2, group = "Command Options:") { ++ return yargs2.options({ ++ json: { ++ group, ++ describe: "Show information as a JSON array", ++ type: "boolean" ++ }, ++ ndjson: { ++ group, ++ describe: "Show information as newline-delimited JSON", ++ type: "boolean" ++ }, ++ a: { ++ group, ++ describe: "Show private packages that are normally hidden", ++ type: "boolean", ++ alias: "all" ++ }, ++ l: { ++ group, ++ describe: "Show extended information", ++ type: "boolean", ++ alias: "long" ++ }, ++ p: { ++ group, ++ describe: "Show parseable output instead of columnified view", ++ type: "boolean", ++ alias: "parseable" ++ }, ++ toposort: { ++ group, ++ describe: "Sort packages in topological order instead of lexical by directory", ++ type: "boolean" ++ }, ++ graph: { ++ group, ++ describe: "Show dependency graph as a JSON-formatted adjacency list", ++ type: "boolean" ++ } ++ }); ++} ++var init_listable_options = __esm({ ++ "libs/core/src/lib/listable-options.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/core/src/lib/log-packed.ts ++function logPacked(tarball) { ++ npmlog_default.notice(""); ++ npmlog_default.notice("", `${hasUnicode2 ? "\u{1F4E6} " : "package:"} ${tarball.name}@${tarball.version}`); ++ if (tarball.files && tarball.files.length) { ++ npmlog_default.notice("=== Tarball Contents ==="); ++ npmlog_default.notice( ++ "", ++ (0, import_columnify2.default)( ++ tarball.files.map((f) => { ++ const bytes = (0, import_byte_size.default)(f.size); ++ return { ++ path: f.path, ++ size: `${bytes.value}${bytes.unit}` ++ }; ++ }), ++ { ++ // TODO: refactor based on TS feedback ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ include: ["size", "path"], ++ showHeaders: false ++ } ++ ) ++ ); ++ } ++ if (tarball.bundled && tarball.bundled.length) { ++ npmlog_default.notice("=== Bundled Dependencies ==="); ++ tarball.bundled.forEach((name) => npmlog_default.notice("", name)); ++ } ++ npmlog_default.notice("=== Tarball Details ==="); ++ npmlog_default.notice( ++ "", ++ (0, import_columnify2.default)( ++ [ ++ { name: "name:", value: tarball.name }, ++ { name: "version:", value: tarball.version }, ++ tarball.filename && { name: "filename:", value: tarball.filename }, ++ tarball.size && { name: "package size:", value: (0, import_byte_size.default)(tarball.size) }, ++ tarball.unpackedSize && { name: "unpacked size:", value: (0, import_byte_size.default)(tarball.unpackedSize) }, ++ tarball.shasum && { name: "shasum:", value: tarball.shasum }, ++ tarball.integrity && { name: "integrity:", value: elideIntegrity(tarball.integrity) }, ++ tarball.bundled && tarball.bundled.length && { ++ name: "bundled deps:", ++ value: tarball.bundled.length ++ }, ++ tarball.bundled && tarball.bundled.length && { ++ name: "bundled files:", ++ value: tarball.entryCount - tarball.files.length ++ }, ++ tarball.bundled && tarball.bundled.length && { ++ name: "own files:", ++ value: tarball.files.length ++ }, ++ tarball.entryCount && { name: "total files:", value: tarball.entryCount } ++ ].filter((x) => x), ++ { ++ // TODO: refactor based on TS feedback ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ include: ["name", "value"], ++ showHeaders: false ++ } ++ ) ++ ); ++ npmlog_default.notice("", ""); ++} ++function elideIntegrity(integrity) { ++ const str = integrity.toString(); ++ return `${str.substr(0, 20)}[...]${str.substr(80)}`; ++} ++var import_byte_size, import_columnify2, import_has_unicode, hasUnicode2; ++var init_log_packed = __esm({ ++ "libs/core/src/lib/log-packed.ts"() { ++ "use strict"; ++ import_byte_size = __toESM(require("byte-size")); ++ import_columnify2 = __toESM(require("columnify")); ++ init_npmlog(); ++ import_has_unicode = __toESM(require("has-unicode")); ++ hasUnicode2 = (0, import_has_unicode.default)(); ++ } ++}); ++ ++// libs/core/src/lib/npm-conf/env-replace.ts ++function envReplace(str) { ++ if (typeof str !== "string" || !str) { ++ return str; ++ } ++ const regex = /(\\*)\$\{([^}]+)\}/g; ++ return str.replace(regex, (orig, esc, name) => { ++ esc = esc.length > 0 && esc.length % 2; ++ if (esc) { ++ return orig; ++ } ++ if (process.env[name] === void 0) { ++ throw new Error(`Failed to replace env in config: ${orig}`); ++ } ++ return process.env[name]; ++ }); ++} ++var init_env_replace = __esm({ ++ "libs/core/src/lib/npm-conf/env-replace.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/core/src/lib/npm-conf/find-prefix.ts ++function findPrefix(start) { ++ let dir = import_path11.default.resolve(start); ++ let walkedUp = false; ++ while (import_path11.default.basename(dir) === "node_modules") { ++ dir = import_path11.default.dirname(dir); ++ walkedUp = true; ++ } ++ if (walkedUp) { ++ return dir; ++ } ++ return find(dir, dir); ++} ++function find(name, original) { ++ if (name === "/" || process.platform === "win32" && /^[a-zA-Z]:(\\|\/)?$/.test(name)) { ++ return original; ++ } ++ try { ++ const files = import_fs3.default.readdirSync(name); ++ if (files.indexOf("node_modules") !== -1 || files.indexOf("package.json") !== -1) { ++ return name; ++ } ++ const dirname = import_path11.default.dirname(name); ++ if (dirname === name) { ++ return original; ++ } ++ return find(dirname, original); ++ } catch (err) { ++ if (name === original) { ++ if (err.code === "ENOENT") { ++ return original; ++ } ++ throw err; ++ } ++ return original; ++ } ++} ++var import_fs3, import_path11; ++var init_find_prefix = __esm({ ++ "libs/core/src/lib/npm-conf/find-prefix.ts"() { ++ "use strict"; ++ import_fs3 = __toESM(require("fs")); ++ import_path11 = __toESM(require("path")); ++ } ++}); ++ ++// libs/core/src/lib/npm-conf/types.ts ++var require_types = __commonJS({ ++ "libs/core/src/lib/npm-conf/types.ts"(exports2) { ++ "use strict"; ++ var import_path27 = __toESM(require("path")); ++ var import_stream = require("stream"); ++ var import_url2 = __toESM(require("url")); ++ var Umask = () => { ++ }; ++ var getLocalAddresses = () => []; ++ var semver8 = () => { ++ }; ++ exports2.types = { ++ access: [null, "restricted", "public"], ++ "allow-same-version": Boolean, ++ "always-auth": Boolean, ++ also: [null, "dev", "development"], ++ audit: Boolean, ++ "audit-level": ["low", "moderate", "high", "critical"], ++ "auth-type": ["legacy", "sso", "saml", "oauth"], ++ "bin-links": Boolean, ++ browser: [null, String], ++ ca: [null, String, Array], ++ cafile: import_path27.default, ++ cache: import_path27.default, ++ "cache-lock-stale": Number, ++ "cache-lock-retries": Number, ++ "cache-lock-wait": Number, ++ "cache-max": Number, ++ "cache-min": Number, ++ cert: [null, String], ++ cidr: [null, String, Array], ++ color: ["always", Boolean], ++ depth: Number, ++ description: Boolean, ++ dev: Boolean, ++ "dry-run": Boolean, ++ editor: String, ++ "engine-strict": Boolean, ++ force: Boolean, ++ "fetch-retries": Number, ++ "fetch-retry-factor": Number, ++ "fetch-retry-mintimeout": Number, ++ "fetch-retry-maxtimeout": Number, ++ git: String, ++ "git-tag-version": Boolean, ++ "commit-hooks": Boolean, ++ global: Boolean, ++ globalconfig: import_path27.default, ++ "global-style": Boolean, ++ group: [Number, String], ++ "https-proxy": [null, import_url2.default], ++ "user-agent": String, ++ "ham-it-up": Boolean, ++ heading: String, ++ "if-present": Boolean, ++ "ignore-prepublish": Boolean, ++ "ignore-scripts": Boolean, ++ "init-module": import_path27.default, ++ "init-author-name": String, ++ "init-author-email": String, ++ "init-author-url": ["", import_url2.default], ++ "init-license": String, ++ "init-version": semver8, ++ json: Boolean, ++ key: [null, String], ++ "legacy-bundling": Boolean, ++ link: Boolean, ++ "local-address": getLocalAddresses(), ++ loglevel: ["silent", "error", "warn", "notice", "http", "timing", "info", "verbose", "silly"], ++ logstream: import_stream.Stream, ++ "logs-max": Number, ++ long: Boolean, ++ maxsockets: Number, ++ message: String, ++ "metrics-registry": [null, String], ++ "node-options": [null, String], ++ "node-version": [null, semver8], ++ noproxy: [null, String, Array], ++ offline: Boolean, ++ "onload-script": [null, String], ++ only: [null, "dev", "development", "prod", "production"], ++ optional: Boolean, ++ "package-lock": Boolean, ++ otp: [null, String], ++ "package-lock-only": Boolean, ++ parseable: Boolean, ++ "prefer-offline": Boolean, ++ "prefer-online": Boolean, ++ prefix: import_path27.default, ++ preid: String, ++ production: Boolean, ++ progress: Boolean, ++ // allow proxy to be disabled explicitly ++ proxy: [null, false, import_url2.default], ++ "read-only": Boolean, ++ "rebuild-bundle": Boolean, ++ registry: [null, import_url2.default], ++ rollback: Boolean, ++ save: Boolean, ++ "save-bundle": Boolean, ++ "save-dev": Boolean, ++ "save-exact": Boolean, ++ "save-optional": Boolean, ++ "save-prefix": String, ++ "save-prod": Boolean, ++ scope: String, ++ "script-shell": [null, String], ++ "scripts-prepend-node-path": [false, true, "auto", "warn-only"], ++ searchopts: String, ++ searchexclude: [null, String], ++ searchlimit: Number, ++ searchstaleness: Number, ++ "send-metrics": Boolean, ++ shell: String, ++ shrinkwrap: Boolean, ++ "sign-git-commit": Boolean, ++ "sign-git-tag": Boolean, ++ "sso-poll-frequency": Number, ++ "sso-type": [null, "oauth", "saml"], ++ "strict-ssl": Boolean, ++ tag: String, ++ timing: Boolean, ++ tmp: import_path27.default, ++ unicode: Boolean, ++ "unsafe-perm": Boolean, ++ "update-notifier": Boolean, ++ usage: Boolean, ++ user: [Number, String], ++ userconfig: import_path27.default, ++ umask: Umask, ++ version: Boolean, ++ "tag-version-prefix": String, ++ versions: Boolean, ++ viewer: String, ++ _exit: Boolean ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npm-conf/parse-field.ts ++function parseField(input, key) { ++ if (typeof input !== "string") { ++ return input; ++ } ++ const typeList = [].concat(types[key]); ++ const isPath = typeList.indexOf(import_path12.default) !== -1; ++ const isBool = typeList.indexOf(Boolean) !== -1; ++ const isString = typeList.indexOf(String) !== -1; ++ const isNumber = typeList.indexOf(Number) !== -1; ++ let field = `${input}`.trim(); ++ if (/^".*"$/.test(field)) { ++ try { ++ field = JSON.parse(field); ++ } catch (err) { ++ throw new Error(`Failed parsing JSON config key ${key}: ${field}`); ++ } ++ } ++ if (isBool && !isString && field === "") { ++ return true; ++ } ++ switch (field) { ++ case "true": { ++ return true; ++ } ++ case "false": { ++ return false; ++ } ++ case "null": { ++ return null; ++ } ++ case "undefined": { ++ return void 0; ++ } ++ } ++ field = envReplace(field); ++ if (isPath) { ++ const regex = process.platform === "win32" ? /^~(\/|\\)/ : /^~\//; ++ if (regex.test(field) && process.env["HOME"]) { ++ field = import_path12.default.resolve(process.env["HOME"], field.substr(2)); ++ } ++ field = import_path12.default.resolve(field); ++ } ++ if (isNumber && !Number.isNaN(field)) { ++ field = Number(field); ++ } ++ return field; ++} ++var import_path12, types; ++var init_parse_field = __esm({ ++ "libs/core/src/lib/npm-conf/parse-field.ts"() { ++ "use strict"; ++ import_path12 = __toESM(require("path")); ++ init_env_replace(); ++ ({ types } = require_types()); ++ } ++}); ++ ++// libs/core/src/lib/npm-conf/nerf-dart.ts ++function toNerfDart(uri) { ++ const parsed = import_url.default.parse(uri); ++ delete parsed.protocol; ++ delete parsed.auth; ++ delete parsed.query; ++ delete parsed.search; ++ delete parsed.hash; ++ return import_url.default.resolve(import_url.default.format(parsed), "."); ++} ++var import_url; ++var init_nerf_dart = __esm({ ++ "libs/core/src/lib/npm-conf/nerf-dart.ts"() { ++ "use strict"; ++ import_url = __toESM(require("url")); ++ } ++}); ++ ++// libs/core/src/lib/npm-conf/config-chain/proto-list.ts ++var require_proto_list = __commonJS({ ++ "libs/core/src/lib/npm-conf/config-chain/proto-list.ts"(exports2, module2) { ++ "use strict"; ++ module2.exports = ProtoList; ++ function setProto(obj, proto) { ++ if (typeof Object.setPrototypeOf === "function") return Object.setPrototypeOf(obj, proto); ++ else obj.__proto__ = proto; ++ } ++ function ProtoList() { ++ this.list = []; ++ var root = null; ++ Object.defineProperty(this, "root", { ++ get: function() { ++ return root; ++ }, ++ set: function(r) { ++ root = r; ++ if (this.list.length) { ++ setProto(this.list[this.list.length - 1], r); ++ } ++ }, ++ enumerable: true, ++ configurable: true ++ }); ++ } ++ ProtoList.prototype = { ++ get length() { ++ return this.list.length; ++ }, ++ get keys() { ++ var k = []; ++ for (var i in this.list[0]) k.push(i); ++ return k; ++ }, ++ get snapshot() { ++ var o2 = {}; ++ this.keys.forEach(function(k) { ++ o2[k] = this.get(k); ++ }, this); ++ return o2; ++ }, ++ get store() { ++ return this.list[0]; ++ }, ++ push: function(obj) { ++ if (typeof obj !== "object") obj = { valueOf: obj }; ++ if (this.list.length >= 1) { ++ setProto(this.list[this.list.length - 1], obj); ++ } ++ setProto(obj, this.root); ++ return this.list.push(obj); ++ }, ++ pop: function() { ++ if (this.list.length >= 2) { ++ setProto(this.list[this.list.length - 2], this.root); ++ } ++ return this.list.pop(); ++ }, ++ unshift: function(obj) { ++ setProto(obj, this.list[0] || this.root); ++ return this.list.unshift(obj); ++ }, ++ shift: function() { ++ if (this.list.length === 1) { ++ setProto(this.list[0], this.root); ++ } ++ return this.list.shift(); ++ }, ++ get: function(key) { ++ return this.list[0][key]; ++ }, ++ set: function(key, val, save) { ++ if (!this.length) this.push({}); ++ if (save && this.list[0].hasOwnProperty(key)) this.push({}); ++ return this.list[0][key] = val; ++ }, ++ forEach: function(fn, thisp) { ++ for (var key in this.list[0]) fn.call(thisp, key, this.list[0][key]); ++ }, ++ slice: function() { ++ return this.list.slice.apply(this.list, arguments); ++ }, ++ splice: function() { ++ var ret = this.list.splice.apply(this.list, arguments); ++ for (var i = 0, l = this.list.length; i < l; i++) { ++ setProto(this.list[i], this.list[i + 1] || this.root); ++ } ++ return ret; ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npm-conf/config-chain/index.ts ++var require_config_chain = __commonJS({ ++ "libs/core/src/lib/npm-conf/config-chain/index.ts"(exports2, module2) { ++ "use strict"; ++ var ProtoList = require_proto_list(); ++ var path24 = require("path"); ++ var fs20 = require("fs"); ++ var ini = require("ini"); ++ var EE = require("events").EventEmitter; ++ var url2 = require("url"); ++ var http = require("http"); ++ var exports2 = module2.exports = function() { ++ var args = [].slice.call(arguments), conf = new ConfigChain2(); ++ while (args.length) { ++ var a = args.shift(); ++ if (a) conf.push("string" === typeof a ? json(a) : a); ++ } ++ return conf; ++ }; ++ var find2 = exports2.find = function() { ++ var rel = path24.join.apply(null, [].slice.call(arguments)); ++ function find3(start, rel2) { ++ var file = path24.join(start, rel2); ++ try { ++ fs20.statSync(file); ++ return file; ++ } catch (err) { ++ if (path24.dirname(start) !== start) ++ return find3(path24.dirname(start), rel2); ++ } ++ } ++ return find3(__dirname, rel); ++ }; ++ var parse2 = exports2.parse = function(content, file, type) { ++ content = "" + content; ++ if (!type) { ++ try { ++ return JSON.parse(content); ++ } catch (er) { ++ return ini.parse(content); ++ } ++ } else if (type === "json") { ++ if (this.emit) { ++ try { ++ return JSON.parse(content); ++ } catch (er) { ++ this.emit("error", er); ++ } ++ } else { ++ return JSON.parse(content); ++ } ++ } else { ++ return ini.parse(content); ++ } ++ }; ++ var json = exports2.json = function() { ++ var args = [].slice.call(arguments).filter(function(arg) { ++ return arg != null; ++ }); ++ var file = path24.join.apply(null, args); ++ var content; ++ try { ++ content = fs20.readFileSync(file, "utf-8"); ++ } catch (err) { ++ return; ++ } ++ return parse2(content, file, "json"); ++ }; ++ var env = exports2.env = function(prefix, env2) { ++ env2 = env2 || process.env; ++ var obj = {}; ++ var l = prefix.length; ++ for (var k in env2) { ++ if (k.indexOf(prefix) === 0) obj[k.substring(l)] = env2[k]; ++ } ++ return obj; ++ }; ++ exports2.ConfigChain = ConfigChain2; ++ function ConfigChain2() { ++ EE.apply(this); ++ ProtoList.apply(this, arguments); ++ this._awaiting = 0; ++ this._saving = 0; ++ this.sources = {}; ++ } ++ var extras = { ++ constructor: { value: ConfigChain2 } ++ }; ++ Object.keys(EE.prototype).forEach(function(k) { ++ extras[k] = Object.getOwnPropertyDescriptor(EE.prototype, k); ++ }); ++ ConfigChain2.prototype = Object.create(ProtoList.prototype, extras); ++ ConfigChain2.prototype.del = function(key, where) { ++ if (where) { ++ var target = this.sources[where]; ++ target = target && target.data; ++ if (!target) { ++ return this.emit("error", new Error("not found " + where)); ++ } ++ delete target[key]; ++ } else { ++ for (var i = 0, l = this.list.length; i < l; i++) { ++ delete this.list[i][key]; ++ } ++ } ++ return this; ++ }; ++ ConfigChain2.prototype.set = function(key, value, where) { ++ var target; ++ if (where) { ++ target = this.sources[where]; ++ target = target && target.data; ++ if (!target) { ++ return this.emit("error", new Error("not found " + where)); ++ } ++ } else { ++ target = this.list[0]; ++ if (!target) { ++ return this.emit("error", new Error("cannot set, no confs!")); ++ } ++ } ++ target[key] = value; ++ return this; ++ }; ++ ConfigChain2.prototype.get = function(key, where) { ++ if (where) { ++ where = this.sources[where]; ++ if (where) where = where.data; ++ if (where && Object.hasOwnProperty.call(where, key)) return where[key]; ++ return void 0; ++ } ++ return this.list[0][key]; ++ }; ++ ConfigChain2.prototype.save = function(where, type, cb) { ++ if (typeof type === "function") cb = type, type = null; ++ var target = this.sources[where]; ++ if (!target || !(target.path || target.source) || !target.data) { ++ return this.emit("error", new Error("bad save target: " + where)); ++ } ++ if (target.source) { ++ var pref = target.prefix || ""; ++ Object.keys(target.data).forEach(function(k) { ++ target.source[pref + k] = target.data[k]; ++ }); ++ return this; ++ } ++ var type = type || target.type; ++ var data = target.data; ++ if (target.type === "json") { ++ data = JSON.stringify(data); ++ } else { ++ data = ini.stringify(data); ++ } ++ this._saving++; ++ fs20.writeFile( ++ target.path, ++ data, ++ "utf8", ++ function(er) { ++ this._saving--; ++ if (er) { ++ if (cb) return cb(er); ++ else return this.emit("error", er); ++ } ++ if (this._saving === 0) { ++ if (cb) cb(); ++ this.emit("save"); ++ } ++ }.bind(this) ++ ); ++ return this; ++ }; ++ ConfigChain2.prototype.addFile = function(file, type, name) { ++ name = name || file; ++ var marker = { __source__: name }; ++ this.sources[name] = { path: file, type }; ++ this.push(marker); ++ this._await(); ++ fs20.readFile( ++ file, ++ "utf8", ++ function(er, data) { ++ if (er) this.emit("error", er); ++ this.addString(data, file, type, marker); ++ }.bind(this) ++ ); ++ return this; ++ }; ++ ConfigChain2.prototype.addEnv = function(prefix, env2, name) { ++ name = name || "env"; ++ var data = exports2.env(prefix, env2); ++ this.sources[name] = { data, source: env2, prefix }; ++ return this.add(data, name); ++ }; ++ ConfigChain2.prototype.addUrl = function(req, type, name) { ++ this._await(); ++ var href = url2.format(req); ++ name = name || href; ++ var marker = { __source__: name }; ++ this.sources[name] = { href, type }; ++ this.push(marker); ++ http.request( ++ req, ++ function(res) { ++ var c = []; ++ var ct = res.headers["content-type"]; ++ if (!type) { ++ type = ct.indexOf("json") !== -1 ? "json" : ct.indexOf("ini") !== -1 ? "ini" : href.match(/\.json$/) ? "json" : href.match(/\.ini$/) ? "ini" : null; ++ marker.type = type; ++ } ++ res.on("data", c.push.bind(c)).on( ++ "end", ++ function() { ++ this.addString(Buffer.concat(c), href, type, marker); ++ }.bind(this) ++ ).on("error", this.emit.bind(this, "error")); ++ }.bind(this) ++ ).on("error", this.emit.bind(this, "error")).end(); ++ return this; ++ }; ++ ConfigChain2.prototype.addString = function(data, file, type, marker) { ++ data = this.parse(data, file, type); ++ this.add(data, marker); ++ return this; ++ }; ++ ConfigChain2.prototype.add = function(data, marker) { ++ if (marker && typeof marker === "object") { ++ var i = this.list.indexOf(marker); ++ if (i === -1) { ++ return this.emit("error", new Error("bad marker")); ++ } ++ this.splice(i, 1, data); ++ marker = marker.__source__; ++ this.sources[marker] = this.sources[marker] || {}; ++ this.sources[marker].data = data; ++ this._resolve(); ++ } else { ++ if (typeof marker === "string") { ++ this.sources[marker] = this.sources[marker] || {}; ++ this.sources[marker].data = data; ++ } ++ this._await(); ++ this.push(data); ++ process.nextTick(this._resolve.bind(this)); ++ } ++ return this; ++ }; ++ ConfigChain2.prototype.parse = exports2.parse; ++ ConfigChain2.prototype._await = function() { ++ this._awaiting++; ++ }; ++ ConfigChain2.prototype._resolve = function() { ++ this._awaiting--; ++ if (this._awaiting === 0) this.emit("load", this); ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npm-conf/conf.ts ++var import_assert, import_fs4, import_path13, ConfigChain, Conf; ++var init_conf = __esm({ ++ "libs/core/src/lib/npm-conf/conf.ts"() { ++ "use strict"; ++ import_assert = __toESM(require("assert")); ++ import_fs4 = __toESM(require("fs")); ++ import_path13 = __toESM(require("path")); ++ init_env_replace(); ++ init_find_prefix(); ++ init_parse_field(); ++ init_nerf_dart(); ++ ({ ConfigChain } = require_config_chain()); ++ Conf = class extends ConfigChain { ++ root; ++ // https://github.com/npm/npm/blob/latest/lib/config/core.js#L208-L222 ++ constructor(base) { ++ super(base); ++ this.root = base; ++ } ++ // https://github.com/npm/npm/blob/latest/lib/config/core.js#L332-L342 ++ add(data, marker) { ++ try { ++ for (const x of Object.keys(data)) { ++ const newKey = envReplace(x); ++ const newField = parseField(data[x], newKey); ++ delete data[x]; ++ data[newKey] = newField; ++ } ++ } catch (err) { ++ throw err; ++ } ++ return super.add(data, marker); ++ } ++ // https://github.com/npm/npm/blob/latest/lib/config/core.js#L312-L325 ++ addFile(file, name = file) { ++ const marker = { __source__: name }; ++ this["sources"][name] = { path: file, type: "ini" }; ++ this["push"](marker); ++ this["_await"](); ++ try { ++ const contents = import_fs4.default.readFileSync(file, "utf8"); ++ this["addString"](contents, file, "ini", marker); ++ } catch (err) { ++ this["add"]({}, marker); ++ } ++ return this; ++ } ++ // https://github.com/npm/npm/blob/latest/lib/config/core.js#L344-L360 ++ addEnv(env = process.env) { ++ const conf = {}; ++ Object.keys(env).filter((x) => /^npm_config_/i.test(x)).forEach((x) => { ++ if (!env[x]) { ++ return; ++ } ++ const p = x.toLowerCase().replace(/^npm_config_/, "").replace(/(?!^)_/g, "-"); ++ conf[p] = env[x]; ++ }); ++ return super.addEnv("", conf, "env"); ++ } ++ // https://github.com/npm/npm/blob/latest/lib/config/load-prefix.js ++ loadPrefix() { ++ const cli = this["list"][0]; ++ Object.defineProperty(this, "prefix", { ++ enumerable: true, ++ set: (prefix) => { ++ const g = this["get"]("global"); ++ this[g ? "globalPrefix" : "localPrefix"] = prefix; ++ }, ++ get: () => { ++ const g = this["get"]("global"); ++ return g ? this["globalPrefix"] : this["localPrefix"]; ++ } ++ }); ++ Object.defineProperty(this, "globalPrefix", { ++ enumerable: true, ++ set: (prefix) => { ++ this["set"]("prefix", prefix); ++ }, ++ get: () => import_path13.default.resolve(this["get"]("prefix")) ++ }); ++ let p; ++ Object.defineProperty(this, "localPrefix", { ++ enumerable: true, ++ set: (prefix) => { ++ p = prefix; ++ }, ++ get: () => p ++ }); ++ if (Object.prototype.hasOwnProperty.call(cli, "prefix")) { ++ p = import_path13.default.resolve(cli.prefix); ++ } else { ++ try { ++ p = findPrefix(process.cwd()); ++ } catch (err) { ++ throw err; ++ } ++ } ++ return p; ++ } ++ // https://github.com/npm/npm/blob/latest/lib/config/load-cafile.js ++ loadCAFile(file) { ++ if (!file) { ++ return; ++ } ++ try { ++ const contents = import_fs4.default.readFileSync(file, "utf8"); ++ const delim = "-----END CERTIFICATE-----"; ++ const output2 = contents.split(delim).filter((x) => Boolean(x.trim())).map((x) => x.trimLeft() + delim); ++ this["set"]("ca", output2); ++ } catch (err) { ++ if (err.code === "ENOENT") { ++ return; ++ } ++ throw err; ++ } ++ } ++ // https://github.com/npm/npm/blob/latest/lib/config/set-user.js ++ loadUser() { ++ const defConf = this.root; ++ if (this["get"]("global")) { ++ return; ++ } ++ if (process.env["SUDO_UID"]) { ++ defConf.user = Number(process.env["SUDO_UID"]); ++ return; ++ } ++ const prefix = import_path13.default.resolve(this["get"]("prefix")); ++ try { ++ const stats = import_fs4.default.statSync(prefix); ++ defConf.user = stats.uid; ++ } catch (err) { ++ if (err.code === "ENOENT") { ++ return; ++ } ++ throw err; ++ } ++ } ++ // https://github.com/npm/npm/blob/24ec9f2/lib/config/get-credentials-by-uri.js ++ getCredentialsByURI(uri) { ++ (0, import_assert.default)(uri && typeof uri === "string", "registry URL is required"); ++ const nerfed = toNerfDart(uri); ++ const defnerf = toNerfDart(this["get"]("registry")); ++ const c = { ++ scope: nerfed, ++ token: void 0, ++ password: void 0, ++ username: void 0, ++ email: void 0, ++ auth: void 0, ++ alwaysAuth: void 0 ++ }; ++ if (this["get"](`${nerfed}:always-auth`) !== void 0) { ++ const val = this["get"](`${nerfed}:always-auth`); ++ c.alwaysAuth = val === "false" ? false : !!val; ++ } else if (this["get"]("always-auth") !== void 0) { ++ c.alwaysAuth = this["get"]("always-auth"); ++ } ++ if (this["get"](`${nerfed}:_authToken`)) { ++ c.token = this["get"](`${nerfed}:_authToken`); ++ return c; ++ } ++ let authDef = this["get"]("_auth"); ++ let userDef = this["get"]("username"); ++ let passDef = this["get"]("_password"); ++ if (authDef && !(userDef && passDef)) { ++ authDef = Buffer.from(authDef, "base64").toString(); ++ authDef = authDef.split(":"); ++ userDef = authDef.shift(); ++ passDef = authDef.join(":"); ++ } ++ if (this["get"](`${nerfed}:_password`)) { ++ c.password = Buffer.from(this["get"](`${nerfed}:_password`), "base64").toString("utf8"); ++ } else if (nerfed === defnerf && passDef) { ++ c.password = passDef; ++ } ++ if (this["get"](`${nerfed}:username`)) { ++ c.username = this["get"](`${nerfed}:username`); ++ } else if (nerfed === defnerf && userDef) { ++ c.username = userDef; ++ } ++ if (this["get"](`${nerfed}:email`)) { ++ c.email = this["get"](`${nerfed}:email`); ++ } else if (this["get"]("email")) { ++ c.email = this["get"]("email"); ++ } ++ if (c.username && c.password) { ++ c.auth = Buffer.from(`${c.username}:${c.password}`).toString("base64"); ++ } ++ return c; ++ } ++ // https://github.com/npm/npm/blob/24ec9f2/lib/config/set-credentials-by-uri.js ++ setCredentialsByURI(uri, c) { ++ (0, import_assert.default)(uri && typeof uri === "string", "registry URL is required"); ++ (0, import_assert.default)(c && typeof c === "object", "credentials are required"); ++ const nerfed = toNerfDart(uri); ++ if (c.token) { ++ this["set"](`${nerfed}:_authToken`, c.token, "user"); ++ this["del"](`${nerfed}:_password`, "user"); ++ this["del"](`${nerfed}:username`, "user"); ++ this["del"](`${nerfed}:email`, "user"); ++ this["del"](`${nerfed}:always-auth`, "user"); ++ } else if (c.username || c.password || c.email) { ++ (0, import_assert.default)(c.username, "must include username"); ++ (0, import_assert.default)(c.password, "must include password"); ++ (0, import_assert.default)(c.email, "must include email address"); ++ this["del"](`${nerfed}:_authToken`, "user"); ++ const encoded = Buffer.from(c.password, "utf8").toString("base64"); ++ this["set"](`${nerfed}:_password`, encoded, "user"); ++ this["set"](`${nerfed}:username`, c.username, "user"); ++ this["set"](`${nerfed}:email`, c.email, "user"); ++ if (c.alwaysAuth !== void 0) { ++ this["set"](`${nerfed}:always-auth`, c.alwaysAuth, "user"); ++ } else { ++ this["del"](`${nerfed}:always-auth`, "user"); ++ } ++ } else { ++ throw new Error("No credentials to set."); ++ } ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/get-npm-exec-opts.ts ++function getNpmExecOpts(pkg2, registry) { ++ const env = { ++ LERNA_PACKAGE_NAME: pkg2.name ++ }; ++ if (registry) { ++ env.npm_config_registry = registry; ++ } ++ npmlog_default.silly("getNpmExecOpts", pkg2.location, registry); ++ return { ++ cwd: pkg2.location, ++ env, ++ pkg: pkg2 ++ }; ++} ++var init_get_npm_exec_opts = __esm({ ++ "libs/core/src/lib/get-npm-exec-opts.ts"() { ++ "use strict"; ++ init_npmlog(); ++ } ++}); ++ ++// libs/core/src/lib/npm-install.ts ++function npmInstall(pkg2, { registry, npmClient, npmClientArgs, npmGlobalStyle, mutex, stdio = "pipe", subCommand = "install" }) { ++ const opts = getNpmExecOpts(pkg2, registry); ++ const args = [subCommand]; ++ let cmd = npmClient || "npm"; ++ if (npmGlobalStyle) { ++ cmd = "npm"; ++ args.push("--global-style"); ++ } ++ if (cmd === "yarn" && mutex) { ++ args.push("--mutex", mutex); ++ } ++ if (cmd === "yarn") { ++ args.push("--non-interactive"); ++ } ++ if (npmClientArgs && npmClientArgs.length) { ++ args.push(...npmClientArgs); ++ } ++ opts.stdio = stdio; ++ opts.env.LERNA_EXEC_PATH = pkg2.location; ++ opts.env.LERNA_ROOT_PATH = pkg2.rootPath; ++ npmlog_default.silly("npmInstall", [cmd, args]); ++ return childProcess8.exec(cmd, args, opts); ++} ++function npmInstallDependencies(pkg2, dependencies, config) { ++ npmlog_default.silly("npmInstallDependencies", pkg2.name, dependencies); ++ if (!(dependencies && dependencies.length)) { ++ npmlog_default.verbose("npmInstallDependencies", "no dependencies to install"); ++ return Promise.resolve(); ++ } ++ const packageJsonBkp = `${pkg2.manifestLocation}.lerna_backup`; ++ npmlog_default.silly("npmInstallDependencies", "backup", pkg2.manifestLocation); ++ return import_fs_extra4.default.copy(pkg2.manifestLocation, packageJsonBkp).then(() => { ++ const cleanup = () => { ++ npmlog_default.silly("npmInstallDependencies", "cleanup", pkg2.manifestLocation); ++ import_fs_extra4.default.renameSync(packageJsonBkp, pkg2.manifestLocation); ++ }; ++ const unregister = (0, import_signal_exit2.default)(cleanup); ++ const done = (finalError) => { ++ cleanup(); ++ unregister(); ++ if (finalError) { ++ throw finalError; ++ } ++ }; ++ const tempJson = transformManifest(pkg2, dependencies); ++ npmlog_default.silly("npmInstallDependencies", "writing tempJson", tempJson); ++ return (0, import_write_pkg2.default)(pkg2.manifestLocation, tempJson).then(() => npmInstall(pkg2, config)).then(() => done(), done); ++ }); ++} ++function transformManifest(pkg2, dependencies) { ++ const json = pkg2.toJSON(); ++ const depMap = new Map( ++ dependencies.map((dep) => { ++ const { name, rawSpec } = (0, import_npm_package_arg4.default)(dep, pkg2.location); ++ return [name, rawSpec || "*"]; ++ }) ++ ); ++ delete json.scripts; ++ ["dependencies", "devDependencies", "optionalDependencies"].forEach((depType) => { ++ const collection = json[depType]; ++ if (collection) { ++ Object.keys(collection).forEach((depName) => { ++ if (depMap.has(depName)) { ++ collection[depName] = depMap.get(depName); ++ depMap.delete(depName); ++ } else { ++ delete collection[depName]; ++ } ++ }); ++ } ++ }); ++ ["bundledDependencies", "bundleDependencies"].forEach((depType) => { ++ const collection = json[depType]; ++ if (Array.isArray(collection)) { ++ const newCollection = []; ++ for (const depName of collection) { ++ if (depMap.has(depName)) { ++ newCollection.push(depName); ++ depMap.delete(depName); ++ } ++ } ++ json[depType] = newCollection; ++ } ++ }); ++ if (depMap.size) { ++ if (!json.dependencies) { ++ json.dependencies = {}; ++ } ++ depMap.forEach((depVersion, depName) => { ++ json.dependencies[depName] = depVersion; ++ }); ++ } ++ return json; ++} ++var import_fs_extra4, import_npm_package_arg4, import_signal_exit2, import_write_pkg2, childProcess8; ++var init_npm_install = __esm({ ++ "libs/core/src/lib/npm-install.ts"() { ++ "use strict"; ++ import_fs_extra4 = __toESM(require("fs-extra")); ++ import_npm_package_arg4 = __toESM(require("npm-package-arg")); ++ import_signal_exit2 = __toESM(require("signal-exit")); ++ import_write_pkg2 = __toESM(require("write-pkg")); ++ init_get_npm_exec_opts(); ++ init_npmlog(); ++ childProcess8 = (init_src(), __toCommonJS(src_exports)); ++ module.exports.npmInstallDependencies = npmInstallDependencies; ++ } ++}); ++ ++// libs/core/src/lib/oidc.ts ++async function oidc({ packageName, registry, opts, config }) { ++ try { ++ if (!/** @see https://github.com/watson/ci-info/blob/v4.2.0/vendors.json#L152 */ ++ (import_ci_info.default.GITHUB_ACTIONS || /** @see https://github.com/watson/ci-info/blob/v4.2.0/vendors.json#L161C13-L161C22 */ ++ import_ci_info.default.GITLAB)) { ++ return void 0; ++ } ++ let idToken = process.env["NPM_ID_TOKEN"]; ++ if (!idToken && import_ci_info.default.GITHUB_ACTIONS) { ++ if (!(process.env["ACTIONS_ID_TOKEN_REQUEST_URL"] && process.env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"])) { ++ npmlog_default.silly("oidc", "Skipped because incorrect permissions for id-token within GitHub workflow"); ++ return void 0; ++ } ++ const audience = `npm:${new URL(registry).hostname}`; ++ const url2 = new URL(process.env["ACTIONS_ID_TOKEN_REQUEST_URL"]); ++ url2.searchParams.append("audience", audience); ++ const startTime = Date.now(); ++ const response2 = await (0, import_make_fetch_happen.default)(url2.href, { ++ retry: opts.retry, ++ headers: { ++ Accept: "application/json", ++ Authorization: `Bearer ${process.env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"]}` ++ } ++ }); ++ const elapsedTime = Date.now() - startTime; ++ npmlog_default.http("fetch", `GET ${url2.href} ${response2.status} ${elapsedTime}ms`); ++ const json = await response2.json(); ++ if (!response2.ok) { ++ npmlog_default.verbose("oidc", `Failed to fetch id_token from GitHub: received an invalid response`); ++ return void 0; ++ } ++ if (!json.value) { ++ npmlog_default.verbose("oidc", `Failed to fetch id_token from GitHub: missing value`); ++ return void 0; ++ } ++ idToken = json.value; ++ } ++ if (!idToken) { ++ npmlog_default.silly("oidc", "Skipped because no id_token available"); ++ return void 0; ++ } ++ const parsedRegistry = new URL(registry); ++ const regKey = `//${parsedRegistry.host}${parsedRegistry.pathname}`; ++ const authTokenKey = `${regKey}:_authToken`; ++ const escapedPackageName = (0, import_npm_package_arg5.default)(packageName).escapedName; ++ let response; ++ try { ++ response = await import_npm_registry_fetch.default.json( ++ // @ts-expect-error - Taken directly from npm codebase, the types for .json must be incomplete ++ new URL(`/-/npm/v1/oidc/token/exchange/package/${escapedPackageName}`, registry), ++ { ++ ...opts, ++ [authTokenKey]: idToken, ++ // Use the idToken as the auth token for the request ++ method: "POST" ++ } ++ ); ++ } catch (error) { ++ npmlog_default.verbose( ++ "oidc", ++ `Failed token exchange request with body message: ${error?.body?.message || "Unknown error"}` ++ ); ++ return void 0; ++ } ++ if (!response?.["token"]) { ++ npmlog_default.verbose("oidc", "Failed because token exchange was missing the token in the response body"); ++ return void 0; ++ } ++ opts[authTokenKey] = response["token"]; ++ config["set"](authTokenKey, response["token"], "user"); ++ npmlog_default.verbose("oidc", `Successfully retrieved and set token`); ++ try { ++ const [headerB64, payloadB64] = idToken.split("."); ++ if (headerB64 && payloadB64) { ++ const payloadJson = Buffer.from(payloadB64, "base64").toString("utf8"); ++ const payload = JSON.parse(payloadJson); ++ if (import_ci_info.default.GITHUB_ACTIONS && payload.repository_visibility === "public" || // only set provenance for gitlab if the repo is public and SIGSTORE_ID_TOKEN is available ++ import_ci_info.default.GITLAB && payload.project_visibility === "public" && process.env["SIGSTORE_ID_TOKEN"]) { ++ const visibility = await import_libnpmaccess.default.getVisibility(packageName, opts); ++ if (visibility?.public) { ++ npmlog_default.verbose("oidc", `Enabling provenance`); ++ opts.provenance = true; ++ config["set"]("provenance", true, "user"); ++ } ++ } ++ } ++ } catch (error) { ++ npmlog_default.verbose("oidc", `Failed to set provenance with message: ${error?.message || "Unknown error"}`); ++ } ++ } catch (error) { ++ npmlog_default.verbose("oidc", `Failure with message: ${error?.message || "Unknown error"}`); ++ } ++ return void 0; ++} ++var import_ci_info, import_libnpmaccess, import_make_fetch_happen, import_npm_package_arg5, import_npm_registry_fetch; ++var init_oidc = __esm({ ++ "libs/core/src/lib/oidc.ts"() { ++ "use strict"; ++ import_ci_info = __toESM(require("ci-info")); ++ import_libnpmaccess = __toESM(require("libnpmaccess")); ++ import_make_fetch_happen = __toESM(require("make-fetch-happen")); ++ import_npm_package_arg5 = __toESM(require("npm-package-arg")); ++ import_npm_registry_fetch = __toESM(require("npm-registry-fetch")); ++ init_npmlog(); ++ } ++}); ++ ++// libs/core/src/lib/prompt.ts ++function promptConfirmation(message) { ++ npmlog_default.pause(); ++ return import_inquirer.default.prompt([ ++ { ++ type: "expand", ++ name: "confirm", ++ message, ++ // We put any invalid default value here to help avoid accidentally clicking straight through ++ default: "2", ++ choices: [ ++ { key: "y", name: "Yes", value: true }, ++ { key: "n", name: "No", value: false } ++ ] ++ } ++ ]).then((answers) => { ++ npmlog_default.resume(); ++ return answers["confirm"]; ++ }); ++} ++function promptSelectOne(message, { ++ choices, ++ filter, ++ validate ++} = {}) { ++ npmlog_default.pause(); ++ return import_inquirer.default.prompt([ ++ { ++ type: "list", ++ name: "prompt", ++ message, ++ choices, ++ pageSize: choices?.length, ++ filter, ++ validate ++ } ++ ]).then((answers) => { ++ npmlog_default.resume(); ++ return answers["prompt"]; ++ }); ++} ++function promptTextInput(message, { ++ filter, ++ validate ++} = {}) { ++ npmlog_default.pause(); ++ return import_inquirer.default.prompt([ ++ { ++ type: "input", ++ name: "input", ++ message, ++ filter, ++ validate ++ } ++ ]).then((answers) => { ++ npmlog_default.resume(); ++ return answers["input"]; ++ }); ++} ++var import_inquirer; ++var init_prompt = __esm({ ++ "libs/core/src/lib/prompt.ts"() { ++ "use strict"; ++ import_inquirer = __toESM(require("inquirer")); ++ init_npmlog(); ++ } ++}); ++ ++// libs/core/src/lib/otplease.ts ++function otplease(fn, _opts, otpCache) { ++ const opts = { ...otpCache, ..._opts }; ++ return attempt(fn, opts, otpCache); ++} ++function attempt(fn, opts, otpCache) { ++ return new Promise((resolve3) => { ++ resolve3(fn(opts)); ++ }).catch((err) => { ++ if (err.code !== "EOTP" && !(err.code === "E401" && /one-time pass/.test(err.body))) { ++ throw err; ++ } else if (!process.stdin.isTTY || !process.stdout.isTTY) { ++ throw err; ++ } else { ++ if (otpCache != null && otpCache.otp != null && otpCache.otp !== opts["otp"]) { ++ return attempt(fn, { ...opts, ...otpCache }, otpCache); ++ } ++ return semaphore.wait().then(() => { ++ if (otpCache != null && otpCache.otp != null && otpCache.otp !== opts["otp"]) { ++ semaphore.release(); ++ return attempt(fn, { ...opts, ...otpCache }, otpCache); ++ } ++ return getOneTimePassword().then( ++ (otp) => { ++ if (otpCache != null) { ++ otpCache.otp = otp; ++ } ++ semaphore.release(); ++ return otp; ++ }, ++ (promptError) => { ++ semaphore.release(); ++ return Promise.reject(promptError); ++ } ++ ).then((otp) => { ++ return fn({ ...opts, otp }); ++ }); ++ }); ++ } ++ }); ++} ++function getOneTimePassword(message = "This operation requires a one-time password:") { ++ return promptTextInput(message, { ++ filter: (otp) => otp.replace(/\s+/g, ""), ++ 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" ++ }); ++} ++var semaphore; ++var init_otplease = __esm({ ++ "libs/core/src/lib/otplease.ts"() { ++ "use strict"; ++ init_prompt(); ++ semaphore = { ++ _promise: void 0, ++ _resolve: void 0, ++ wait() { ++ return new Promise((resolve3) => { ++ if (!this._promise) { ++ this._promise = new Promise((release) => { ++ this._resolve = release; ++ }); ++ resolve3(void 0); ++ } else { ++ resolve3(this._promise.then(() => this.wait())); ++ } ++ }); ++ }, ++ release() { ++ const resolve3 = this._resolve; ++ if (resolve3) { ++ this._resolve = void 0; ++ this._promise = void 0; ++ resolve3(); ++ } ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/npm-conf/defaults.ts ++var require_defaults = __commonJS({ ++ "libs/core/src/lib/npm-conf/defaults.ts"(exports2) { ++ "use strict"; ++ var import_os6 = __toESM(require("os")); ++ var import_path27 = __toESM(require("path")); ++ var temp = import_os6.default.tmpdir(); ++ var uidOrPid = process.getuid ? process.getuid() : process.pid; ++ var hasUnicode3 = () => true; ++ var isWindows = process.platform === "win32"; ++ var osenv = { ++ editor: () => process.env["EDITOR"] || process.env["VISUAL"] || (isWindows ? "notepad.exe" : "vi"), ++ shell: () => isWindows ? process.env["COMSPEC"] || "cmd.exe" : process.env["SHELL"] || "/bin/bash" ++ }; ++ var umask = { ++ fromString: () => process.umask() ++ }; ++ var home = import_os6.default.homedir(); ++ if (home) { ++ process.env["HOME"] = home; ++ } else { ++ home = import_path27.default.resolve(temp, `npm-${uidOrPid}`); ++ } ++ var cacheExtra = process.platform === "win32" ? "npm-cache" : ".npm"; ++ var cacheRoot = process.platform === "win32" && process.env["APPDATA"] || home; ++ var cache = import_path27.default.resolve(cacheRoot, cacheExtra); ++ var defaults; ++ var globalPrefix; ++ Object.defineProperty(exports2, "defaults", { ++ get() { ++ if (defaults) { ++ return defaults; ++ } ++ if (process.env["PREFIX"]) { ++ globalPrefix = process.env["PREFIX"]; ++ } else if (process.platform === "win32") { ++ globalPrefix = import_path27.default.dirname(process.execPath); ++ } else { ++ globalPrefix = import_path27.default.dirname(import_path27.default.dirname(process.execPath)); ++ if (process.env["DESTDIR"]) { ++ globalPrefix = import_path27.default.join(process.env["DESTDIR"], globalPrefix); ++ } ++ } ++ defaults = { ++ access: null, ++ "allow-same-version": false, ++ "always-auth": false, ++ also: null, ++ audit: true, ++ "audit-level": "low", ++ "auth-type": "legacy", ++ "bin-links": true, ++ browser: null, ++ ca: null, ++ cafile: null, ++ cache, ++ "cache-lock-stale": 6e4, ++ "cache-lock-retries": 10, ++ "cache-lock-wait": 1e4, ++ "cache-max": Infinity, ++ "cache-min": 10, ++ cert: null, ++ cidr: null, ++ color: process.env["NO_COLOR"] == null, ++ depth: Infinity, ++ description: true, ++ dev: false, ++ "dry-run": false, ++ editor: osenv.editor(), ++ "engine-strict": false, ++ force: false, ++ "fetch-retries": 2, ++ "fetch-retry-factor": 10, ++ "fetch-retry-mintimeout": 1e4, ++ "fetch-retry-maxtimeout": 6e4, ++ git: "git", ++ "git-tag-version": true, ++ "commit-hooks": true, ++ global: false, ++ globalconfig: import_path27.default.resolve(globalPrefix, "etc", "npmrc"), ++ "global-style": false, ++ group: process.platform === "win32" ? 0 : process.env["SUDO_GID"] || process.getgid && process.getgid(), ++ "ham-it-up": false, ++ heading: "npm", ++ "if-present": false, ++ "ignore-prepublish": false, ++ "ignore-scripts": false, ++ "init-module": import_path27.default.resolve(home, ".npm-init.js"), ++ "init-author-name": "", ++ "init-author-email": "", ++ "init-author-url": "", ++ "init-version": "1.0.0", ++ "init-license": "ISC", ++ json: false, ++ key: null, ++ "legacy-bundling": false, ++ link: false, ++ "local-address": void 0, ++ loglevel: "notice", ++ logstream: process.stderr, ++ "logs-max": 10, ++ long: false, ++ maxsockets: 50, ++ message: "%s", ++ "metrics-registry": null, ++ "node-options": null, ++ "node-version": process.version, ++ offline: false, ++ "onload-script": false, ++ only: null, ++ optional: true, ++ otp: void 0, ++ "package-lock": true, ++ "package-lock-only": false, ++ parseable: false, ++ "prefer-offline": false, ++ "prefer-online": false, ++ prefix: globalPrefix, ++ preid: "", ++ production: process.env["NODE_ENV"] === "production", ++ progress: !process.env["TRAVIS"] && !process.env["CI"], ++ proxy: null, ++ "https-proxy": null, ++ noproxy: null, ++ "user-agent": "npm/{npm-version} node/{node-version} {platform} {arch}", ++ "read-only": false, ++ "rebuild-bundle": true, ++ registry: "https://registry.npmjs.org/", ++ rollback: true, ++ save: true, ++ "save-bundle": false, ++ "save-dev": false, ++ "save-exact": false, ++ "save-optional": false, ++ "save-prefix": "^", ++ "save-prod": false, ++ scope: "", ++ "script-shell": void 0, ++ "scripts-prepend-node-path": "warn-only", ++ searchopts: "", ++ searchexclude: null, ++ searchlimit: 20, ++ searchstaleness: 15 * 60, ++ "send-metrics": false, ++ shell: osenv.shell(), ++ shrinkwrap: true, ++ "sign-git-commit": false, ++ "sign-git-tag": false, ++ "sso-poll-frequency": 500, ++ "sso-type": "oauth", ++ "strict-ssl": true, ++ tag: "latest", ++ "tag-version-prefix": "v", ++ timing: false, ++ tmp: temp, ++ unicode: hasUnicode3(), ++ "unsafe-perm": process.platform === "win32" || process.platform === "cygwin" || // TODO: refactor based on TS feedback ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ !(process.getuid && process.setuid && process.getgid && process.setgid) || process.getuid() !== 0, ++ "update-notifier": true, ++ usage: false, ++ user: process.platform === "win32" || import_os6.default.type() === "OS400" ? 0 : "nobody", ++ userconfig: import_path27.default.resolve(home, ".npmrc"), ++ // TODO: refactor based on TS feedback ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ umask: process.umask ? process.umask() : umask.fromString("022"), ++ version: false, ++ versions: false, ++ viewer: process.platform === "win32" ? "browser" : "man", ++ _exit: true ++ }; ++ return defaults; ++ } ++ }); ++ } ++}); ++ ++// libs/core/src/lib/npm-conf/index.ts ++var require_npm_conf = __commonJS({ ++ "libs/core/src/lib/npm-conf/index.ts"(exports2, module2) { ++ "use strict"; ++ var import_path27 = __toESM(require("path")); ++ init_conf(); ++ init_nerf_dart(); ++ var { defaults } = require_defaults(); ++ module2.exports = npmConf3; ++ module2.exports.Conf = Conf; ++ module2.exports.defaults = Object.assign({}, defaults); ++ module2.exports.toNerfDart = toNerfDart; ++ function npmConf3(opts) { ++ const conf = new Conf(Object.assign({}, defaults)); ++ const cleanOpts = opts ? Object.keys(opts).reduce((acc, key) => { ++ if (opts[key] !== void 0) { ++ acc[key] = opts[key]; ++ } ++ return acc; ++ }, {}) : {}; ++ conf.add(cleanOpts, "cli"); ++ conf.addEnv(); ++ conf.loadPrefix(); ++ const projectConf = import_path27.default.resolve(conf["localPrefix"], ".npmrc"); ++ const userConf = conf["get"]("userconfig"); ++ if (!conf["get"]("global") && projectConf !== userConf) { ++ conf.addFile(projectConf, "project"); ++ } else { ++ conf.add({}, "project"); ++ } ++ conf.addFile(conf["get"]("userconfig"), "user"); ++ if (conf["get"]("prefix")) { ++ const etc = import_path27.default.resolve(conf["get"]("prefix"), "etc"); ++ conf.root.globalconfig = import_path27.default.resolve(etc, "npmrc"); ++ conf.root.globalignorefile = import_path27.default.resolve(etc, "npmignore"); ++ } ++ conf.addFile(conf["get"]("globalconfig"), "global"); ++ conf.loadUser(); ++ const caFile = conf["get"]("cafile"); ++ if (caFile) { ++ conf.loadCAFile(caFile); ++ } ++ return conf; ++ } ++ } ++}); ++ ++// libs/core/src/lib/run-lifecycle.ts ++function flattenOptions(obj) { ++ return { ++ ignorePrepublish: obj["ignore-prepublish"], ++ ignoreScripts: obj["ignore-scripts"], ++ nodeOptions: obj["node-options"], ++ scriptShell: obj["script-shell"], ++ scriptsPrependNodePath: obj["scripts-prepend-node-path"], ++ unsafePerm: obj["unsafe-perm"], ++ ...obj ++ }; ++} ++function printCommandBanner(id, event, cmd, path24) { ++ return console.log(` ++> ${id ? `${id} ` : ""}${event} ${path24} ++> ${cmd.trim().replace(/\n/g, "\n> ")} ++`); ++} ++function runLifecycle(pkg2, stage, options) { ++ if ("root" in options) { ++ options = options.snapshot; ++ } ++ const opts = { ++ log: npmlog_default, ++ unsafePerm: true, ++ ...flattenOptions(options) ++ }; ++ const dir = pkg2.location; ++ const id = `${pkg2.name}@${pkg2.version}`; ++ const config = {}; ++ if (opts.ignoreScripts) { ++ opts.log.verbose("lifecycle", "%j ignored in %j", stage, pkg2.name); ++ return Promise.resolve(); ++ } ++ if (!pkg2.scripts || !pkg2.scripts[stage]) { ++ opts.log.silly("lifecycle", "No script for %j in %j, continuing", stage, pkg2.name); ++ return Promise.resolve(); ++ } ++ if (stage === "prepublish" && opts.ignorePrepublish) { ++ opts.log.verbose("lifecycle", "%j ignored in %j", stage, pkg2.name); ++ return Promise.resolve(); ++ } ++ for (const [key, val] of Object.entries(opts)) { ++ if (val != null && key !== "log" && key !== "logstream") { ++ config[key] = val; ++ } ++ } ++ if (pkg2.__isLernaPackage) { ++ pkg2 = pkg2.toJSON(); ++ } ++ pkg2._id = id; ++ opts.log.silly("lifecycle", "%j starting in %j", stage, pkg2.name); ++ opts.log.info("lifecycle", `${id}~${stage}: ${id}`); ++ const stdio = opts.stdio || "pipe"; ++ if (npmlog_default.level !== "silent") { ++ printCommandBanner(id, stage, pkg2.scripts[stage], dir); ++ } ++ return queue.add( ++ async () => runScript({ ++ event: stage, ++ path: dir, ++ pkg: pkg2, ++ args: [], ++ stdio, ++ banner: false, ++ // TODO: refactor based on TS feedback ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ scriptShell: config.scriptShell ++ }).then( ++ ({ stdout }) => { ++ if (stdout) { ++ process.stdout.write(stdout.toString().trimEnd() + "\n"); ++ } ++ opts.log.silly("lifecycle", "%j finished in %j", stage, pkg2.name); ++ }, ++ (err) => { ++ const exitCode = err.code || 1; ++ npmlog_default.error("lifecycle", "%j errored in %j, exiting %d", stage, pkg2.name, exitCode); ++ err.name = "ValidationError"; ++ err.exitCode = exitCode; ++ process.exitCode = exitCode; ++ throw err; ++ } ++ ) ++ ); ++} ++function createRunner(commandOptions) { ++ const cfg = npmConf(commandOptions).snapshot; ++ return (pkg2, stage) => runLifecycle(pkg2, stage, cfg); ++} ++var import_p_queue, runScript, npmConf, queue; ++var init_run_lifecycle = __esm({ ++ "libs/core/src/lib/run-lifecycle.ts"() { ++ "use strict"; ++ import_p_queue = __toESM(require("p-queue")); ++ init_npmlog(); ++ runScript = require("@npmcli/run-script"); ++ npmConf = require_npm_conf(); ++ queue = new import_p_queue.default({ concurrency: 1 }); ++ } ++}); ++ ++// libs/core/src/lib/npm-publish.ts ++function flattenOptions2(obj) { ++ return { ++ defaultTag: obj["tag"] || "latest", ++ dryRun: obj["dry-run"], ++ // libnpmpublish / npm-registry-fetch check strictSSL rather than strict-ssl ++ strictSSL: obj["strict-ssl"], ++ ...obj ++ }; ++} ++async function npmPublish(pkg2, tarFilePath, options, conf, otpCache) { ++ const { dryRun, ...remainingOptions } = flattenOptions2(options); ++ const { scope } = (0, import_npm_package_arg6.default)(pkg2.name); ++ const opts = { ++ log: npmlog_default, ++ ...remainingOptions, ++ projectScope: scope ++ }; ++ opts.log.verbose("publish", pkg2.name); ++ let result; ++ if (!dryRun) { ++ let { manifestLocation } = pkg2; ++ if (pkg2.contents !== pkg2.location) { ++ manifestLocation = import_path14.default.join(pkg2.contents, "package.json"); ++ } ++ const [tarData, npmCliPackageJson] = await Promise.all([ ++ import_fs_extra5.default.readFile(tarFilePath), ++ await (0, import_package_json.prepare)(import_path14.default.dirname(manifestLocation)) ++ ]); ++ const manifestContent = npmCliPackageJson.content; ++ if (opts.defaultTag !== "latest" && manifestContent.publishConfig && manifestContent.publishConfig.tag && manifestContent.publishConfig.tag !== opts.defaultTag) { ++ manifestContent.publishConfig.tag = opts.defaultTag; ++ } ++ if (manifestContent.publishConfig) { ++ Object.assign(opts, publishConfigToOpts(manifestContent.publishConfig)); ++ } ++ await oidc({ ++ packageName: pkg2.name, ++ registry: opts.registry ?? "https://registry.npmjs.org/", ++ opts, ++ config: conf ++ }); ++ result = await otplease((innerOpts) => (0, import_libnpmpublish.publish)(manifestContent, tarData, innerOpts), opts, otpCache); ++ } ++ await runLifecycle(pkg2, "publish", opts); ++ await runLifecycle(pkg2, "postpublish", opts); ++ return result; ++} ++function publishConfigToOpts(publishConfig) { ++ const opts = { ...publishConfig }; ++ if (publishConfig.tag) { ++ opts.defaultTag = publishConfig.tag; ++ delete opts.tag; ++ } ++ return opts; ++} ++var import_package_json, import_fs_extra5, import_libnpmpublish, import_npm_package_arg6, import_path14; ++var init_npm_publish = __esm({ ++ "libs/core/src/lib/npm-publish.ts"() { ++ "use strict"; ++ import_package_json = require("@npmcli/package-json"); ++ import_fs_extra5 = __toESM(require("fs-extra")); ++ import_libnpmpublish = require("libnpmpublish"); ++ import_npm_package_arg6 = __toESM(require("npm-package-arg")); ++ import_path14 = __toESM(require("path")); ++ init_npmlog(); ++ init_oidc(); ++ init_otplease(); ++ init_run_lifecycle(); ++ } ++}); ++ ++// libs/core/src/lib/npm-run-script.ts ++function npmRunScript(script, { args, npmClient, pkg: pkg2, reject = true }) { ++ npmlog_default.silly("npmRunScript", script, args, pkg2.name); ++ const argv = ["run", script, ...args]; ++ const opts = makeOpts(pkg2, reject); ++ return childProcess9.exec(npmClient, argv, opts); ++} ++function npmRunScriptStreaming(script, { args, npmClient, pkg: pkg2, prefix, reject = true }) { ++ npmlog_default.silly("npmRunScriptStreaming", [script, args, pkg2.name]); ++ const argv = ["run", script, ...args]; ++ const opts = makeOpts(pkg2, reject); ++ return childProcess9.spawnStreaming(npmClient, argv, opts, prefix && pkg2.name); ++} ++function makeOpts(pkg2, reject) { ++ return Object.assign(getNpmExecOpts(pkg2), { ++ windowsHide: false, ++ reject ++ }); ++} ++var childProcess9; ++var init_npm_run_script = __esm({ ++ "libs/core/src/lib/npm-run-script.ts"() { ++ "use strict"; ++ init_get_npm_exec_opts(); ++ init_npmlog(); ++ childProcess9 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/core/src/lib/output.ts ++function output(...args) { ++ npmlog_default["clearProgress"](); ++ console.log(...args); ++ npmlog_default["showProgress"](); ++} ++var init_output = __esm({ ++ "libs/core/src/lib/output.ts"() { ++ "use strict"; ++ init_npmlog(); ++ } ++}); ++ ++// libs/core/src/lib/get-packed.ts ++function getPacked(pkg2, tarFilePath) { ++ const bundledWanted = new Set(pkg2.bundleDependencies || pkg2.bundledDependencies || []); ++ const bundled = /* @__PURE__ */ new Set(); ++ const files = []; ++ let totalEntries = 0; ++ let totalEntrySize = 0; ++ return tar.list({ ++ file: tarFilePath, ++ onentry(entry) { ++ totalEntries += 1; ++ totalEntrySize += entry.size; ++ const p = entry.path; ++ if (p.startsWith("package/node_modules/")) { ++ const name = p.match(/^package\/node_modules\/((?:@[^/]+\/)?[^/]+)/)[1]; ++ if (bundledWanted.has(name)) { ++ bundled.add(name); ++ } ++ } else { ++ files.push({ ++ path: entry.path.replace(/^package\//, ""), ++ size: entry.size, ++ mode: entry.mode ++ }); ++ } ++ }, ++ strip: 1 ++ }).then( ++ () => Promise.all([ ++ import_fs_extra6.default.stat(tarFilePath), ++ import_ssri.default.fromStream(import_fs_extra6.default.createReadStream(tarFilePath), { ++ algorithms: ["sha1", "sha512"] ++ }) ++ ]) ++ ).then(([{ size }, { sha1, sha512 }]) => { ++ const shasum = sha1[0].hexDigest(); ++ return { ++ id: `${pkg2.name}@${pkg2.version}`, ++ name: pkg2.name, ++ version: pkg2.version, ++ size, ++ unpackedSize: totalEntrySize, ++ shasum, ++ integrity: import_ssri.default.parse(sha512[0]), ++ filename: import_path15.default.basename(tarFilePath), ++ files, ++ entryCount: totalEntries, ++ bundled: Array.from(bundled), ++ tarFilePath ++ }; ++ }); ++} ++var import_fs_extra6, import_path15, import_ssri, tar; ++var init_get_packed = __esm({ ++ "libs/core/src/lib/get-packed.ts"() { ++ "use strict"; ++ import_fs_extra6 = __toESM(require("fs-extra")); ++ import_path15 = __toESM(require("path")); ++ import_ssri = __toESM(require("ssri")); ++ tar = __toESM(require("tar")); ++ } ++}); ++ ++// libs/core/src/lib/temp-write.ts ++async function tempWrite(fileContent, filePath) { ++ const tempPath = tempfile(filePath); ++ const write = (0, import_is_stream.default)(fileContent) ? writeStream : writeFileP; ++ await (0, import_make_dir.default)(import_path16.default.dirname(tempPath)); ++ await write(tempPath, fileContent); ++ return tempPath; ++} ++var import_node_fs, import_is_stream, import_make_dir, import_path16, import_temp_dir, import_util2, uuid, writeFileP, tempfile, writeStream, temp_write_default; ++var init_temp_write = __esm({ ++ "libs/core/src/lib/temp-write.ts"() { ++ "use strict"; ++ import_node_fs = __toESM(require("node:fs")); ++ import_is_stream = __toESM(require("is-stream")); ++ import_make_dir = __toESM(require("make-dir")); ++ import_path16 = __toESM(require("path")); ++ import_temp_dir = __toESM(require("temp-dir")); ++ import_util2 = require("util"); ++ uuid = __toESM(require("uuid")); ++ writeFileP = (0, import_util2.promisify)(import_node_fs.default.writeFile); ++ tempfile = (filePath) => import_path16.default.join(import_temp_dir.default, uuid.v4(), filePath || ""); ++ writeStream = async (filePath, fileContent) => new Promise((resolve3, reject) => { ++ const writable = import_node_fs.default.createWriteStream(filePath); ++ fileContent.on("error", (error) => { ++ reject(error); ++ fileContent.unpipe(writable); ++ writable.end(); ++ }).pipe(writable).on("error", reject).on("finish", resolve3); ++ }); ++ tempWrite.sync = (fileContent, filePath) => { ++ const tempPath = tempfile(filePath); ++ import_make_dir.default.sync(import_path16.default.dirname(tempPath)); ++ import_node_fs.default.writeFileSync(tempPath, fileContent); ++ return tempPath; ++ }; ++ temp_write_default = tempWrite; ++ } ++}); ++ ++// libs/core/src/lib/pack-directory.ts ++async function packDirectory(_pkg, dir, options) { ++ const pkg2 = Package.lazy(_pkg, dir); ++ const opts = { ++ log: npmlog_default, ++ ...options ++ }; ++ opts.log.verbose("pack-directory", import_path17.default.relative(".", pkg2.contents)); ++ if (opts.ignorePrepublish !== true) { ++ await runLifecycle(pkg2, "prepublish", opts); ++ } ++ await runLifecycle(pkg2, "prepare", opts); ++ if (opts.lernaCommand === "publish") { ++ opts.stdio = "inherit"; ++ await pkg2.refresh(); ++ await runLifecycle(pkg2, "prepublishOnly", opts); ++ await pkg2.refresh(); ++ } ++ await runLifecycle(pkg2, "prepack", opts); ++ await pkg2.refresh(); ++ const arborist = new import_arborist.default({ ++ path: pkg2.contents ++ }); ++ const tree = await arborist.loadActual(); ++ const files = await (0, import_npm_packlist.default)(tree); ++ const stream3 = tar2.create( ++ { ++ cwd: pkg2.contents, ++ prefix: "package/", ++ portable: true, ++ // Provide a specific date in the 1980s for the benefit of zip, ++ // which is confounded by files dated at the Unix epoch 0. ++ mtime: /* @__PURE__ */ new Date("1985-10-26T08:15:00.000Z"), ++ gzip: true ++ }, ++ // NOTE: node-tar does some Magic Stuff depending on prefixes for files ++ // specifically with @ signs, so we just neutralize that one ++ // and any such future "features" by prepending `./` ++ files.map((f) => `./${f}`) ++ ); ++ const tarFilePath = await temp_write_default(stream3, getTarballName(pkg2)); ++ const packed = await getPacked(pkg2, tarFilePath); ++ await runLifecycle(pkg2, "postpack", opts); ++ return packed; ++} ++function getTarballName(pkg2) { ++ const name = pkg2.name[0] === "@" ? ( ++ // scoped packages get special treatment ++ pkg2.name.substr(1).replace(/\//g, "-") ++ ) : pkg2.name; ++ return `${name}-${pkg2.version}.tgz`; ++} ++var import_arborist, import_npm_packlist, import_path17, tar2; ++var init_pack_directory = __esm({ ++ "libs/core/src/lib/pack-directory.ts"() { ++ "use strict"; ++ import_arborist = __toESM(require("@npmcli/arborist")); ++ import_npm_packlist = __toESM(require("npm-packlist")); ++ import_path17 = __toESM(require("path")); ++ tar2 = __toESM(require("tar")); ++ init_get_packed(); ++ init_npmlog(); ++ init_package(); ++ init_run_lifecycle(); ++ init_temp_write(); ++ } ++}); ++ ++// libs/core/src/lib/profiler.ts ++function generateProfileOutputPath(outputDirectory) { ++ return import_upath.default.join(import_upath.default.resolve(outputDirectory || "."), getTimeBasedFilename()); ++} ++var import_fs_extra7, import_upath, hrtimeToMicroseconds, range, getTimeBasedFilename, Profiler; ++var init_profiler = __esm({ ++ "libs/core/src/lib/profiler.ts"() { ++ "use strict"; ++ import_fs_extra7 = __toESM(require("fs-extra")); ++ import_upath = __toESM(require("upath")); ++ init_npmlog(); ++ hrtimeToMicroseconds = (hrtime) => { ++ return (hrtime[0] * 1e9 + hrtime[1]) / 1e3; ++ }; ++ range = (len) => { ++ return Array(len).fill().map((_, idx) => idx); ++ }; ++ getTimeBasedFilename = () => { ++ const now = /* @__PURE__ */ new Date(); ++ const datetime = now.toISOString().split(".")[0]; ++ const datetimeNormalized = datetime.replace(/-|:/g, ""); ++ return `Lerna-Profile-${datetimeNormalized}.json`; ++ }; ++ Profiler = class { ++ events; ++ logger; ++ outputPath; ++ threads; ++ constructor({ concurrency, log: log2 = npmlog_default, outputDirectory }) { ++ this.events = []; ++ this.logger = log2; ++ this.outputPath = generateProfileOutputPath(outputDirectory); ++ this.threads = range(concurrency); ++ } ++ run(fn, name) { ++ let startTime; ++ let threadId; ++ return Promise.resolve().then(() => { ++ startTime = process.hrtime(); ++ threadId = this.threads.shift(); ++ }).then(() => fn()).then((value) => { ++ const duration = process.hrtime(startTime); ++ const event = { ++ name, ++ ph: "X", ++ ts: hrtimeToMicroseconds(startTime), ++ pid: 1, ++ tid: threadId, ++ dur: hrtimeToMicroseconds(duration) ++ }; ++ this.events.push(event); ++ this.threads.unshift(threadId); ++ this.threads.sort(); ++ return value; ++ }); ++ } ++ output() { ++ return import_fs_extra7.default.outputJson(this.outputPath, this.events).then(() => this.logger.info("profiler", `Performance profile saved to ${this.outputPath}`)); ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/pulse-till-done.ts ++function pulseStart(prefix) { ++ pulsers += 1; ++ if (pulsers > 1) { ++ return; ++ } ++ pulse = setInterval(() => npmlog_default.gauge.pulse(prefix), 150); ++} ++function pulseStop() { ++ pulsers -= 1; ++ if (pulsers > 0) { ++ return; ++ } ++ clearInterval(pulse); ++} ++function pulseTillDone(prefix, promise) { ++ if (!promise) { ++ promise = prefix; ++ prefix = ""; ++ } ++ pulseStart(prefix); ++ return Promise.resolve(promise).then( ++ (val) => { ++ pulseStop(); ++ return val; ++ }, ++ (err) => { ++ pulseStop(); ++ throw err; ++ } ++ ); ++} ++var pulsers, pulse; ++var init_pulse_till_done = __esm({ ++ "libs/core/src/lib/pulse-till-done.ts"() { ++ "use strict"; ++ init_npmlog(); ++ pulsers = 0; ++ } ++}); ++ ++// libs/core/src/lib/rimraf-dir.ts ++async function rimrafDir(dirPath) { ++ npmlog_default.silly("rimrafDir", dirPath); ++ if (!(0, import_fs5.existsSync)(dirPath)) { ++ return; ++ } ++ const isSuccessful = await (0, import_rimraf.rimraf)(dirPath); ++ if (!isSuccessful) { ++ throw new Error(`Failed to fully remove ${dirPath}`); ++ } ++ npmlog_default.verbose("rimrafDir", "removed", dirPath); ++} ++var import_fs5, import_rimraf; ++var init_rimraf_dir = __esm({ ++ "libs/core/src/lib/rimraf-dir.ts"() { ++ "use strict"; ++ import_fs5 = require("fs"); ++ import_rimraf = require("rimraf"); ++ init_npmlog(); ++ } ++}); ++ ++// libs/core/src/lib/run-projects-topologically.ts ++async function runProjectsTopologically(projects, projectGraph, runner, { concurrency, rejectCycles } = {}) { ++ const queue2 = new import_p_queue2.default({ concurrency }); ++ const returnValues = []; ++ const projectsMap = new Map(projects.map((p) => [p.name, p])); ++ const localDependencies = projectGraph.localPackageDependencies; ++ const flattenedLocalDependencies = Object.values(localDependencies).flat(); ++ const getProject = (name) => { ++ const project = projectsMap.get(name); ++ if (!project) { ++ throw new Error(`Failed to find project ${name}. This is likely a bug in Lerna's toposort algorithm.`); ++ } ++ return project; ++ }; ++ const dependenciesBySource = projects.reduce( ++ (prev, next) => ({ ++ ...prev, ++ [next.name]: /* @__PURE__ */ new Set() ++ }), ++ {} ++ ); ++ flattenedLocalDependencies.forEach((dep) => { ++ if (dependenciesBySource[dep.source] && projectsMap.has(dep.target)) { ++ dependenciesBySource[dep.source].add(dep.target); ++ } ++ }); ++ const unmergedCycles = getCycles(dependenciesBySource); ++ reportCycles(unmergedCycles, rejectCycles); ++ const cycles = new Set(mergeOverlappingCycles(unmergedCycles)); ++ const seen = /* @__PURE__ */ new Set(); ++ const errors = []; ++ const queueNextPackages = () => { ++ if (seen.size === projects.length) { ++ return; ++ } ++ let batch = Object.keys(dependenciesBySource).filter((p) => dependenciesBySource[p].size === 0).filter((p) => !seen.has(p)); ++ if (batch.length === 0) { ++ const cycle = Array.from(cycles.values()).find((cycle2) => { ++ const cycleHasExternalDependencies = cycle2.some((project) => { ++ const projectDeps = dependenciesBySource[project]; ++ const depIsNotInCycle = (dep) => cycle2.indexOf(dep) === -1; ++ return !!projectDeps && Array.from(projectDeps).filter(depIsNotInCycle).length > 0; ++ }); ++ return !cycleHasExternalDependencies; ++ }); ++ if (cycle) { ++ cycles.delete(cycle); ++ batch = cycle.filter((p) => projectsMap.has(p)); ++ } ++ } ++ batch.forEach((p) => { ++ const project = getProject(p); ++ seen.add(p); ++ queue2.add( ++ () => runner(project).then((value) => { ++ returnValues.push(value); ++ delete dependenciesBySource[p]; ++ Object.keys(dependenciesBySource).forEach((dep) => dependenciesBySource[dep].delete(p)); ++ queueNextPackages(); ++ }) ++ ).catch((err) => { ++ errors.push(err); ++ }); ++ }); ++ }; ++ queueNextPackages(); ++ await queue2.onIdle(); ++ if (errors.length) { ++ throw errors[0]; ++ } ++ if (seen.size !== projects.length) { ++ throw new ValidationError("ERROR", "Not all tasks were run. This is likely a bug in Lerna."); ++ } ++ return returnValues; ++} ++var import_p_queue2; ++var init_run_projects_topologically = __esm({ ++ "libs/core/src/lib/run-projects-topologically.ts"() { ++ "use strict"; ++ import_p_queue2 = __toESM(require("p-queue")); ++ init_cycles(); ++ init_validation_error(); ++ } ++}); ++ ++// libs/core/src/lib/scm-clients/github/create-github-client.ts ++function createGitHubClient() { ++ npmlog_default.silly("createGitHubClient"); ++ const { GH_TOKEN, GHE_API_URL, GHE_VERSION } = process.env; ++ if (!GH_TOKEN) { ++ throw new ValidationError( ++ "", ++ `A GH_TOKEN environment variable is required when "createRelease" is set to "github"` ++ ); ++ } ++ if (GHE_VERSION) { ++ import_rest.Octokit.plugin(require(`@octokit/plugin-enterprise-rest/ghe-${GHE_VERSION}`)); ++ } ++ const options = { ++ auth: `token ${GH_TOKEN}` ++ }; ++ if (GHE_API_URL) { ++ options.baseUrl = GHE_API_URL; ++ } ++ return new import_rest.Octokit(options); ++} ++function parseGitRepo(remote = "origin", opts) { ++ npmlog_default.silly("parseGitRepo"); ++ const args = ["config", "--get", `remote.${remote}.url`]; ++ npmlog_default.verbose("git", args); ++ const url2 = childProcess10.execSync("git", args, opts); ++ if (!url2) { ++ throw new ValidationError("", `Git remote URL could not be found using "${remote}".`); ++ } ++ return (0, import_git_url_parse.default)(url2); ++} ++var import_rest, import_git_url_parse, childProcess10; ++var init_create_github_client = __esm({ ++ "libs/core/src/lib/scm-clients/github/create-github-client.ts"() { ++ "use strict"; ++ import_rest = require("@octokit/rest"); ++ import_git_url_parse = __toESM(require("git-url-parse")); ++ init_npmlog(); ++ init_validation_error(); ++ childProcess10 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/core/src/lib/scm-clients/gitlab/gitlab-client.ts ++var import_make_fetch_happen2, import_path18, GitLabClient; ++var init_gitlab_client = __esm({ ++ "libs/core/src/lib/scm-clients/gitlab/gitlab-client.ts"() { ++ "use strict"; ++ import_make_fetch_happen2 = __toESM(require("make-fetch-happen")); ++ import_path18 = __toESM(require("path")); ++ init_npmlog(); ++ GitLabClient = class { ++ constructor(token, baseUrl = "https://gitlab.com/api/v4") { ++ this.token = token; ++ this.baseUrl = baseUrl; ++ } ++ // TODO: refactor based on TS feedback ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ createRelease({ owner, repo, name, tag_name: tagName, body }) { ++ const releasesUrl = this.releasesUrl(owner, repo, "releases"); ++ npmlog_default.silly("Requesting GitLab releases", releasesUrl); ++ return (0, import_make_fetch_happen2.default)(releasesUrl, { ++ method: "post", ++ body: JSON.stringify({ name, tag_name: tagName, description: body }), ++ headers: { ++ "PRIVATE-TOKEN": this.token, ++ "Content-Type": "application/json" ++ } ++ }).then(({ ok, status, statusText }) => { ++ if (!ok) { ++ npmlog_default.error("gitlab", `Failed to create release ++Request returned ${status} ${statusText}`); ++ } else { ++ npmlog_default.silly("gitlab", "Created release successfully."); ++ } ++ }); ++ } ++ releasesUrl(namespace, project) { ++ return new URL( ++ `${this.baseUrl}/${import_path18.default.join("projects", encodeURIComponent(`${namespace}/${project}`), "releases")}` ++ ).toString(); ++ } ++ }; ++ } ++}); ++ ++// libs/core/src/lib/scm-clients/gitlab/create-gitlab-client.ts ++function OcktokitAdapter(client) { ++ return { repos: { createRelease: client.createRelease.bind(client) } }; ++} ++function createGitLabClient() { ++ const { GL_API_URL, GL_TOKEN } = process.env; ++ npmlog_default.silly("Creating a GitLab client..."); ++ if (!GL_TOKEN) { ++ throw new Error("A GL_TOKEN environment variable is required."); ++ } ++ const client = new GitLabClient(GL_TOKEN, GL_API_URL); ++ return OcktokitAdapter(client); ++} ++var init_create_gitlab_client = __esm({ ++ "libs/core/src/lib/scm-clients/gitlab/create-gitlab-client.ts"() { ++ "use strict"; ++ init_npmlog(); ++ init_gitlab_client(); ++ } ++}); ++ ++// libs/core/src/lib/scm-clients/index.ts ++var init_scm_clients = __esm({ ++ "libs/core/src/lib/scm-clients/index.ts"() { ++ "use strict"; ++ init_create_github_client(); ++ init_create_gitlab_client(); ++ } ++}); ++ ++// libs/core/src/lib/timer.ts ++function timer() { ++ if (process.env["LERNA_INTEGRATION"]) { ++ return () => 0; ++ } ++ const startMillis = Date.now(); ++ return () => Date.now() - startMillis; ++} ++var init_timer = __esm({ ++ "libs/core/src/lib/timer.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/core/src/lib/npm-dist-tag.ts ++var npm_dist_tag_exports = {}; ++__export(npm_dist_tag_exports, { ++ add: () => add, ++ list: () => list2, ++ remove: () => remove ++}); ++function add(spec, tag, options, otpCache) { ++ const opts = { ++ log: npmlog_default, ++ ...options, ++ spec: (0, import_npm_package_arg7.default)(spec) ++ }; ++ const cleanTag = (tag || opts.defaultTag || opts.tag).trim(); ++ const { name, rawSpec: version } = opts.spec; ++ opts.log.verbose("dist-tag", `adding "${cleanTag}" to ${name}@${version}`); ++ if (opts.dryRun) { ++ opts.log.silly("dist-tag", "dry-run configured, bailing now"); ++ return Promise.resolve(); ++ } ++ return fetchTags(opts).then((tags) => { ++ if (tags[cleanTag] === version) { ++ opts.log.warn("dist-tag", `${name}@${cleanTag} already set to ${version}`); ++ return tags; ++ } ++ const uri = `/-/package/${opts.spec.escapedName}/dist-tags/${encodeURIComponent(cleanTag)}`; ++ const payload = { ++ ...opts, ++ method: "PUT", ++ body: JSON.stringify(version), ++ headers: { ++ // cannot use fetch.json() due to HTTP 204 response, ++ // so we manually set the required content-type ++ "content-type": "application/json" ++ }, ++ spec: opts.spec ++ }; ++ return otplease((wrappedPayload) => (0, import_npm_registry_fetch2.default)(uri, wrappedPayload), payload, otpCache).then(() => { ++ opts.log.verbose("dist-tag", `added "${cleanTag}" to ${name}@${version}`); ++ tags[cleanTag] = version; ++ return tags; ++ }); ++ }); ++} ++function remove(spec, tag, options, otpCache) { ++ const opts = { ++ log: npmlog_default, ++ ...options, ++ spec: (0, import_npm_package_arg7.default)(spec) ++ }; ++ opts.log.verbose("dist-tag", `removing "${tag}" from ${opts.spec.name}`); ++ if (opts.dryRun) { ++ opts.log.silly("dist-tag", "dry-run configured, bailing now"); ++ return Promise.resolve(); ++ } ++ return fetchTags(opts).then((tags) => { ++ const version = tags[tag]; ++ if (!version) { ++ opts.log.info("dist-tag", `"${tag}" is not a dist-tag on ${opts.spec.name}`); ++ return tags; ++ } ++ const uri = `/-/package/${opts.spec.escapedName}/dist-tags/${encodeURIComponent(tag)}`; ++ const payload = { ++ ...opts, ++ method: "DELETE", ++ spec: opts.spec ++ }; ++ return otplease((wrappedPayload) => (0, import_npm_registry_fetch2.default)(uri, wrappedPayload), payload, otpCache).then(() => { ++ opts.log.verbose("dist-tag", `removed "${tag}" from ${opts.spec.name}@${version}`); ++ delete tags[tag]; ++ return tags; ++ }); ++ }); ++} ++function list2(spec, options) { ++ const opts = { ++ log: npmlog_default, ++ ...options, ++ spec: (0, import_npm_package_arg7.default)(spec) ++ }; ++ if (opts.dryRun) { ++ opts.log.silly("dist-tag", "dry-run configured, bailing now"); ++ return Promise.resolve(); ++ } ++ return fetchTags(opts); ++} ++function fetchTags(opts) { ++ return import_npm_registry_fetch2.default.json(`/-/package/${opts.spec.escapedName}/dist-tags`, { ++ ...opts, ++ preferOnline: true, ++ spec: opts.spec ++ }).then((data) => { ++ if (data && typeof data === "object") { ++ delete data["_etag"]; ++ } ++ return data || {}; ++ }); ++} ++var import_npm_package_arg7, import_npm_registry_fetch2; ++var init_npm_dist_tag = __esm({ ++ "libs/core/src/lib/npm-dist-tag.ts"() { ++ "use strict"; ++ import_npm_package_arg7 = __toESM(require("npm-package-arg")); ++ import_npm_registry_fetch2 = __toESM(require("npm-registry-fetch")); ++ init_npmlog(); ++ init_otplease(); ++ } ++}); ++ ++// libs/core/src/index.ts ++var npmConf2, npmDistTag; ++var init_src2 = __esm({ ++ "libs/core/src/index.ts"() { ++ "use strict"; ++ init_add_dependencies(); ++ init_add_dependents(); ++ init_check_working_tree(); ++ init_cli(); ++ init_collect_updates(); ++ init_command(); ++ init_detect_projects(); ++ init_is_git_initialized(); ++ init_conventional_commits(); ++ init_corepack(); ++ init_describe_ref(); ++ init_filter_options(); ++ init_filter_projects(); ++ init_get_package_manifest_path(); ++ init_get_packages_for_option(); ++ init_git_checkout(); ++ init_has_npm_version(); ++ init_listable_format_projects(); ++ init_listable_options(); ++ init_log_packed(); ++ init_conf(); ++ init_npm_install(); ++ init_npm_publish(); ++ init_npm_run_script(); ++ init_otplease(); ++ init_output(); ++ init_pack_directory(); ++ init_package(); ++ init_prerelease_id_from_version(); ++ init_profiler(); ++ init_project(); ++ init_project_graph_with_packages(); ++ init_prompt(); ++ init_pulse_till_done(); ++ init_rimraf_dir(); ++ init_run_lifecycle(); ++ init_run_projects_topologically(); ++ init_scm_clients(); ++ init_temp_write(); ++ init_timer(); ++ init_toposort_projects(); ++ init_validation_error(); ++ init_npmlog(); ++ npmConf2 = require_npm_conf(); ++ npmDistTag = (init_npm_dist_tag(), __toCommonJS(npm_dist_tag_exports)); ++ } ++}); ++ ++// libs/commands/changed/src/index.ts ++var src_exports2 = {}; ++__export(src_exports2, { ++ ChangedCommand: () => ChangedCommand, ++ factory: () => factory ++}); ++function factory(argv) { ++ return new ChangedCommand(argv); ++} ++var ChangedCommand; ++var init_src3 = __esm({ ++ "libs/commands/changed/src/index.ts"() { ++ "use strict"; ++ init_src2(); ++ ChangedCommand = class extends Command { ++ result; ++ get otherCommandConfigs() { ++ return ["version", "publish"]; ++ } ++ initialize() { ++ if (this.options.conventionalGraduate) { ++ this.options.conventionalCommits = true; ++ if (this.options.forcePublish) { ++ this.logger.warn("option", "--force-publish superseded by --conventional-graduate"); ++ } ++ } ++ const projectsWithPackage = Object.values(this.projectGraph.nodes).filter((node) => !!node.package); ++ const updates = collectProjectUpdates( ++ projectsWithPackage, ++ this.projectGraph, ++ this.execOpts, ++ this.options ++ ); ++ this.result = listableFormatProjects(updates, this.projectGraph, this.options); ++ if (this.result.count === 0) { ++ this.logger.info("", "No changed packages found"); ++ process.exitCode = 1; ++ return false; ++ } ++ return true; ++ } ++ execute() { ++ output(this.result?.text); ++ this.logger.success( ++ "found", ++ "%d %s ready to publish", ++ this.result?.count, ++ this.result?.count === 1 ? "package" : "packages" ++ ); ++ } ++ }; ++ } ++}); ++ ++// libs/commands/changed/src/command.ts ++var require_command = __commonJS({ ++ "libs/commands/changed/src/command.ts"(exports2, module2) { ++ "use strict"; ++ init_src2(); ++ var command = { ++ command: "changed", ++ aliases: ["updated"], ++ describe: "List local packages that have changed since the last tagged release", ++ builder(yargs2) { ++ const opts = { ++ // only the relevant bits from `lerna version` ++ "conventional-commits": { ++ // fallback for overzealous --conventional-graduate ++ hidden: true, ++ type: "boolean" ++ }, ++ "conventional-graduate": { ++ describe: "Detect currently prereleased packages that would change to a non-prerelease version." ++ // type must remain ambiguous because it is overloaded (boolean _or_ string _or_ array) ++ }, ++ "force-conventional-graduate": { ++ describe: "Always include all packages by specified by --conventional-graduate whether or not they are a prerelease or have changes since the previous version.", ++ type: "boolean" ++ }, ++ "force-publish": { ++ describe: "Always include targeted packages when detecting changed packages, skipping default logic." ++ // type must remain ambiguous because it is overloaded (boolean _or_ string _or_ array) ++ }, ++ "ignore-changes": { ++ describe: [ ++ "Ignore changes in files matched by glob(s) when detecting changed packages.", ++ "Pass --no-ignore-changes to completely disable." ++ ].join("\n"), ++ type: "array" ++ }, ++ "include-merged-tags": { ++ describe: "Include tags from merged branches when detecting changed packages.", ++ type: "boolean" ++ } ++ }; ++ yargs2.options(opts).group(Object.keys(opts), "Command Options:"); ++ return listableOptions(yargs2, "Output Options:"); ++ }, ++ async handler(argv) { ++ return (await Promise.resolve().then(() => (init_src3(), src_exports2))).factory(argv); ++ } ++ }; ++ module2.exports = command; ++ } ++}); ++ ++// libs/legacy-core/src/lib/collect-updates/collect-dependents.ts ++function collectDependents2(nodes) { ++ const collected = /* @__PURE__ */ new Set(); ++ nodes.forEach((currentNode) => { ++ if (currentNode.localDependents.size === 0) { ++ return; ++ } ++ const queue2 = [currentNode]; ++ const seen = /* @__PURE__ */ new Set(); ++ const visit = (dependentNode, dependentName, siblingDependents) => { ++ if (seen.has(dependentNode)) { ++ return; ++ } ++ seen.add(dependentNode); ++ if (dependentNode === currentNode || siblingDependents.has(currentNode.name)) { ++ return; ++ } ++ collected.add(dependentNode); ++ queue2.push(dependentNode); ++ }; ++ while (queue2.length) { ++ const node = queue2.shift(); ++ node.localDependents.forEach(visit); ++ } ++ }); ++ return collected; ++} ++var init_collect_dependents = __esm({ ++ "libs/legacy-core/src/lib/collect-updates/collect-dependents.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/legacy-core/src/lib/collect-updates/collect-packages.ts ++function collectPackages(packages, { isCandidate = () => true, onInclude, excludeDependents } = {}) { ++ const candidates = /* @__PURE__ */ new Set(); ++ packages.forEach((node, name) => { ++ if (isCandidate(node, name)) { ++ candidates.add(node); ++ } ++ }); ++ if (!excludeDependents) { ++ collectDependents2(candidates).forEach((node) => candidates.add(node)); ++ } ++ const updates = []; ++ packages.forEach((node, name) => { ++ if (candidates.has(node)) { ++ if (onInclude) { ++ onInclude(name); ++ } ++ updates.push(node); ++ } ++ }); ++ return updates; ++} ++var init_collect_packages = __esm({ ++ "libs/legacy-core/src/lib/collect-updates/collect-packages.ts"() { ++ "use strict"; ++ init_collect_dependents(); ++ } ++}); ++ ++// libs/legacy-core/src/lib/collect-updates/has-tags.ts ++function hasTags2(opts) { ++ npmlog_default.silly("hasTags"); ++ let result = false; ++ try { ++ result = !!childProcess11.execSync("git", ["tag"], opts); ++ } catch (err) { ++ npmlog_default.warn("ENOTAGS", "No git tags were reachable from this branch!"); ++ npmlog_default.verbose("hasTags error", err); ++ } ++ npmlog_default.verbose("hasTags", result); ++ return result; ++} ++var childProcess11; ++var init_has_tags2 = __esm({ ++ "libs/legacy-core/src/lib/collect-updates/has-tags.ts"() { ++ "use strict"; ++ init_src2(); ++ childProcess11 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/legacy-core/src/lib/collect-updates/make-diff-predicate.ts ++function makeDiffPredicate2(committish, execOpts, ignorePatterns = []) { ++ const ignoreFilters = new Set( ++ ignorePatterns.map( ++ (p) => import_minimatch3.default.filter(`!${p}`, { ++ matchBase: true, ++ // dotfiles inside ignored directories should also match ++ dot: true ++ }) ++ ) ++ ); ++ if (ignoreFilters.size) { ++ npmlog_default.info("ignoring diff in paths matching", ignorePatterns); ++ } ++ return function hasDiffSinceThatIsntIgnored(node) { ++ const diff = diffSinceIn2(committish, node.location, execOpts); ++ if (diff === "") { ++ npmlog_default.silly("", "no diff found in %s", node.name); ++ return false; ++ } ++ npmlog_default.silly("found diff in", diff); ++ let changedFiles = diff.split("\n"); ++ if (ignoreFilters.size) { ++ for (const ignored of ignoreFilters) { ++ changedFiles = changedFiles.filter(ignored); ++ } ++ } ++ if (changedFiles.length) { ++ npmlog_default.verbose("filtered diff", changedFiles); ++ } else { ++ npmlog_default.verbose("", "no diff found in %s (after filtering)", node.name); ++ } ++ return changedFiles.length > 0; ++ }; ++} ++function diffSinceIn2(committish, location, opts) { ++ const args = ["diff", "--name-only", committish]; ++ const formattedLocation = (0, import_slash2.default)(import_path19.default.relative(opts.cwd, location)); ++ if (formattedLocation) { ++ args.push("--", formattedLocation); ++ } ++ npmlog_default.silly("checking diff", formattedLocation); ++ return childProcess12.execSync("git", args, opts); ++} ++var import_minimatch3, import_path19, import_slash2, childProcess12; ++var init_make_diff_predicate2 = __esm({ ++ "libs/legacy-core/src/lib/collect-updates/make-diff-predicate.ts"() { ++ "use strict"; ++ init_src2(); ++ import_minimatch3 = __toESM(require("minimatch")); ++ import_path19 = __toESM(require("path")); ++ import_slash2 = __toESM(require("slash")); ++ childProcess12 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/legacy-core/src/lib/collect-updates/index.ts ++function collectUpdates(filteredPackages, packageGraph, execOpts, commandOptions) { ++ const { forcePublish, conventionalCommits, conventionalGraduate, excludeDependents } = commandOptions; ++ const useConventionalGraduate = conventionalCommits && conventionalGraduate; ++ const forced = getPackagesForOption(useConventionalGraduate ? conventionalGraduate : forcePublish); ++ const packages = filteredPackages.length === packageGraph.size ? packageGraph : new Map(filteredPackages.map(({ name }) => [name, packageGraph.get(name)])); ++ let committish = commandOptions.since; ++ if (hasTags2(execOpts)) { ++ const { sha, refCount, lastTagName } = describeRefSync(execOpts, commandOptions.includeMergedTags); ++ if (refCount === "0" && forced.size === 0 && !committish) { ++ npmlog_default.notice("", "Current HEAD is already released, skipping change detection."); ++ return []; ++ } ++ if (commandOptions.canary) { ++ committish = `${sha}^..${sha}`; ++ } else if (!committish) { ++ committish = lastTagName; ++ } ++ } ++ if (forced.size) { ++ npmlog_default.warn( ++ useConventionalGraduate ? "conventional-graduate" : "force-publish", ++ forced.has("*") ? "all packages" : Array.from(forced.values()).join("\n") ++ ); ++ } ++ if (useConventionalGraduate) { ++ if (forced.has("*")) { ++ npmlog_default.info("", "Graduating all prereleased packages"); ++ } else { ++ npmlog_default.info("", "Graduating prereleased packages"); ++ } ++ } else if (!committish || forced.has("*")) { ++ npmlog_default.info("", "Assuming all packages changed"); ++ return collectPackages(packages, { ++ onInclude: (name) => npmlog_default.verbose("updated", name), ++ excludeDependents ++ }); ++ } ++ npmlog_default.info("", `Looking for changed packages since ${committish}`); ++ const hasDiff = makeDiffPredicate2(committish, execOpts, commandOptions.ignoreChanges); ++ const needsBump = !commandOptions.bump || commandOptions.bump.startsWith("pre") ? () => false : ( ++ /* skip packages that have not been previously prereleased */ ++ // TODO: refactor to address type issues ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ (node) => node.prereleaseId ++ ); ++ const isForced = (node, name) => (forced.has("*") || forced.has(name)) && (useConventionalGraduate ? node.prereleaseId : true); ++ return collectPackages(packages, { ++ // TODO: refactor to address type issues ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ isCandidate: (node, name) => isForced(node, name) || needsBump(node) || hasDiff(node), ++ onInclude: (name) => npmlog_default.verbose("updated", name), ++ excludeDependents ++ }); ++} ++var init_collect_updates2 = __esm({ ++ "libs/legacy-core/src/lib/collect-updates/index.ts"() { ++ "use strict"; ++ init_src2(); ++ init_describe_ref(); ++ init_collect_packages(); ++ init_has_tags2(); ++ init_make_diff_predicate2(); ++ } ++}); ++ ++// libs/legacy-core/src/lib/package-graph/cyclic-package-graph-node.ts ++var lastCollapsedNodeId, CyclicPackageGraphNode; ++var init_cyclic_package_graph_node = __esm({ ++ "libs/legacy-core/src/lib/package-graph/cyclic-package-graph-node.ts"() { ++ "use strict"; ++ lastCollapsedNodeId = 0; ++ CyclicPackageGraphNode = class extends Map { ++ name; ++ localDependencies; ++ localDependents; ++ constructor() { ++ super(); ++ this.name = `(cycle) ${lastCollapsedNodeId += 1}`; ++ this.localDependencies = /* @__PURE__ */ new Map(); ++ this.localDependents = /* @__PURE__ */ new Map(); ++ } ++ get isCycle() { ++ return true; ++ } ++ /** ++ * @returns A representation of a cycle, like like `A -> B -> C -> A`. ++ */ ++ toString() { ++ const parts = Array.from( ++ this, ++ ([key, node]) => ( ++ // TODO: refactor to address type issues ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ node.isCycle ? `(nested cycle: ${node.toString()})` : key ++ ) ++ ); ++ parts.push(parts[0]); ++ return parts.reverse().join(" -> "); ++ } ++ /** ++ * Flattens a CyclicPackageGraphNode (which can have multiple level of cycles). ++ */ ++ flatten() { ++ const result = []; ++ for (const node of this.values()) { ++ if (node.isCycle) { ++ result.push(...node.flatten()); ++ } else { ++ result.push(node); ++ } ++ } ++ return result; ++ } ++ /** ++ * Checks if a given node is contained in this cycle (or in a nested one) ++ * ++ * @param name The name of the package to search in this cycle ++ */ ++ contains(name) { ++ for (const [currentName, currentNode] of this) { ++ if (currentNode.isCycle) { ++ if (currentNode.contains(name)) { ++ return true; ++ } ++ } else if (currentName === name) { ++ return true; ++ } ++ } ++ return false; ++ } ++ /** ++ * Adds a graph node, or a nested cycle, to this group. ++ */ ++ insert(node) { ++ this.set(node.name, node); ++ this.unlink(node); ++ for (const [dependencyName, dependencyNode] of node.localDependencies) { ++ if (!this.contains(dependencyName)) { ++ this.localDependencies.set(dependencyName, dependencyNode); ++ } ++ } ++ for (const [dependentName, dependentNode] of node.localDependents) { ++ if (!this.contains(dependentName)) { ++ this.localDependents.set(dependentName, dependentNode); ++ } ++ } ++ } ++ /** ++ * Remove pointers to candidate node from internal collections. ++ * @param candidateNode instance to unlink ++ */ ++ unlink(candidateNode) { ++ this.localDependencies.delete(candidateNode.name); ++ this.localDependents.delete(candidateNode.name); ++ } ++ }; ++ } ++}); ++ ++// libs/legacy-core/src/lib/package-graph/package-graph-node.ts ++var import_semver5, PKG2, PackageGraphNode; ++var init_package_graph_node = __esm({ ++ "libs/legacy-core/src/lib/package-graph/package-graph-node.ts"() { ++ "use strict"; ++ init_src2(); ++ import_semver5 = __toESM(require("semver")); ++ PKG2 = Symbol("pkg"); ++ PackageGraphNode = class { ++ name; ++ externalDependencies; ++ localDependencies; ++ localDependents; ++ [PKG2]; ++ constructor(pkg2) { ++ this.name = pkg2.name; ++ this[PKG2] = pkg2; ++ Object.defineProperty(this, PKG2, { enumerable: false }); ++ this.externalDependencies = /* @__PURE__ */ new Map(); ++ this.localDependencies = /* @__PURE__ */ new Map(); ++ this.localDependents = /* @__PURE__ */ new Map(); ++ } ++ get location() { ++ return this[PKG2].location; ++ } ++ get pkg() { ++ return this[PKG2]; ++ } ++ get prereleaseId() { ++ return prereleaseIdFromVersion(this.version); ++ } ++ get version() { ++ return this[PKG2].version; ++ } ++ /** ++ * Determine if the Node satisfies a resolved semver range. ++ * @see https://github.com/npm/npm-package-arg#result-object ++ * ++ * @param {!Result} resolved npm-package-arg Result object ++ */ ++ satisfies({ gitCommittish, gitRange, fetchSpec }) { ++ return import_semver5.default.satisfies(this.version, gitCommittish || gitRange || fetchSpec); ++ } ++ /** ++ * Returns a string representation of this node (its name) ++ * ++ * @returns {String} ++ */ ++ toString() { ++ return this.name; ++ } ++ }; ++ } ++}); ++ ++// libs/legacy-core/src/lib/package-graph/report-cycles.ts ++function reportCycles2(paths, rejectCycles) { ++ if (!paths.length) { ++ return; ++ } ++ const cycleMessage = ["Dependency cycles detected, you should fix these!"].concat(paths).join("\n"); ++ if (rejectCycles) { ++ throw new ValidationError("ECYCLE", cycleMessage); ++ } ++ npmlog_default.warn("ECYCLE", cycleMessage); ++} ++var init_report_cycles2 = __esm({ ++ "libs/legacy-core/src/lib/package-graph/report-cycles.ts"() { ++ "use strict"; ++ init_src2(); ++ } ++}); ++ ++// libs/legacy-core/src/lib/package-graph/index.ts ++var import_npm_package_arg8, PackageGraph; ++var init_package_graph = __esm({ ++ "libs/legacy-core/src/lib/package-graph/index.ts"() { ++ "use strict"; ++ init_src2(); ++ import_npm_package_arg8 = __toESM(require("npm-package-arg")); ++ init_cyclic_package_graph_node(); ++ init_package_graph_node(); ++ init_report_cycles2(); ++ PackageGraph = class extends Map { ++ /** ++ * @param {import("@lerna/package").Package[]} packages An array of Packages to build the graph out of. ++ * @param {'allDependencies'|'dependencies'} [graphType] ++ * Pass "dependencies" to create a graph of only dependencies, ++ * excluding the devDependencies that would normally be included. ++ * @param {boolean} [forceLocal] Force all local dependencies to be linked. ++ */ ++ constructor(packages, graphType = "allDependencies", forceLocal) { ++ super(packages.map((pkg2) => [pkg2.name, new PackageGraphNode(pkg2)])); ++ if (packages.length !== this.size) { ++ const seen = /* @__PURE__ */ new Map(); ++ for (const { name, location } of packages) { ++ if (seen.has(name)) { ++ seen.get(name).push(location); ++ } else { ++ seen.set(name, [location]); ++ } ++ } ++ for (const [name, locations] of seen) { ++ if (locations.length > 1) { ++ throw new ValidationError( ++ "ENAME", ++ [`Package name "${name}" used in multiple packages:`, ...locations].join("\n ") ++ ); ++ } ++ } ++ } ++ this.forEach((currentNode, currentName) => { ++ const graphDependencies = graphType === "dependencies" ? Object.assign({}, currentNode.pkg.optionalDependencies, currentNode.pkg.dependencies) : Object.assign( ++ {}, ++ currentNode.pkg.devDependencies, ++ currentNode.pkg.optionalDependencies, ++ currentNode.pkg.dependencies ++ ); ++ Object.keys(graphDependencies).forEach((depName) => { ++ const depNode = this.get(depName); ++ let spec = graphDependencies[depName].replace(/^link:/, "file:"); ++ const isWorkspaceSpec = /^workspace:/.test(spec); ++ let fullWorkspaceSpec; ++ let workspaceAlias; ++ if (isWorkspaceSpec) { ++ fullWorkspaceSpec = spec; ++ spec = spec.replace(/^workspace:/, ""); ++ if (spec === "*" || spec === "^" || spec === "~") { ++ workspaceAlias = spec; ++ if (depNode?.version) { ++ const prefix = spec === "*" ? "" : spec; ++ const version = depNode.version; ++ spec = `${prefix}${version}`; ++ } else { ++ spec = "*"; ++ } ++ } ++ } ++ const resolved = import_npm_package_arg8.default.resolve(depName, spec, currentNode.location); ++ resolved.workspaceSpec = fullWorkspaceSpec; ++ resolved.workspaceAlias = workspaceAlias; ++ if (!depNode) { ++ return currentNode.externalDependencies.set(depName, resolved); ++ } ++ if (forceLocal || resolved.fetchSpec === depNode.location || depNode.satisfies(resolved)) { ++ currentNode.localDependencies.set(depName, resolved); ++ depNode.localDependents.set(currentName, currentNode); ++ } else { ++ if (isWorkspaceSpec) { ++ throw new ValidationError( ++ "EWORKSPACE", ++ `Package specification "${depName}@${spec}" could not be resolved within the workspace. To reference a non-matching, remote version of a local dependency, remove the 'workspace:' prefix.` ++ ); ++ } ++ currentNode.externalDependencies.set(depName, resolved); ++ } ++ }); ++ }); ++ } ++ get rawPackageList() { ++ return Array.from(this.values()).map((node) => node.pkg); ++ } ++ /** ++ * Takes a list of Packages and returns a list of those same Packages with any Packages ++ * they depend on. i.e if packageA depended on packageB `graph.addDependencies([packageA])` ++ * would return [packageA, packageB]. ++ * ++ * @param filteredPackages The packages to include dependencies for. ++ */ ++ addDependencies(filteredPackages) { ++ return this.extendList(filteredPackages, "localDependencies"); ++ } ++ /** ++ * Takes a list of Packages and returns a list of those same Packages with any Packages ++ * that depend on them. i.e if packageC depended on packageD `graph.addDependents([packageD])` ++ * would return [packageD, packageC]. ++ * ++ * @param filteredPackages The packages to include dependents for. ++ */ ++ addDependents(filteredPackages) { ++ return this.extendList(filteredPackages, "localDependents"); ++ } ++ /** ++ * Extends a list of packages by traversing on a given property, which must refer to a ++ * `PackageGraphNode` property that is a collection of `PackageGraphNode`s. ++ * Returns input packages with any additional packages found by traversing `nodeProp`. ++ * ++ * @param packageList The list of packages to extend ++ * @param nodeProp The property on `PackageGraphNode` used to traverse ++ */ ++ extendList(packageList, nodeProp) { ++ const search = new Set(packageList.map(({ name }) => this.get(name))); ++ const result = []; ++ search.forEach((currentNode) => { ++ result.push(currentNode); ++ currentNode[nodeProp].forEach((meta, depName) => { ++ const depNode = this.get(depName); ++ if (depNode !== currentNode && !search.has(depNode)) { ++ search.add(depNode); ++ } ++ }); ++ }); ++ return result.map((node) => node.pkg); ++ } ++ /** ++ * Return a tuple of cycle paths and nodes. ++ * ++ * @deprecated Use collapseCycles instead. ++ * ++ * @param rejectCycles Whether or not to reject cycles ++ */ ++ partitionCycles(rejectCycles) { ++ const cyclePaths = /* @__PURE__ */ new Set(); ++ const cycleNodes = /* @__PURE__ */ new Set(); ++ this.forEach((currentNode, currentName) => { ++ const seen = /* @__PURE__ */ new Set(); ++ const visits = (walk) => (dependentNode, dependentName, siblingDependents) => { ++ const step = walk.concat(dependentName); ++ if (seen.has(dependentNode)) { ++ return; ++ } ++ seen.add(dependentNode); ++ if (dependentNode === currentNode) { ++ cycleNodes.add(currentNode); ++ cyclePaths.add(step); ++ return; ++ } ++ if (siblingDependents.has(currentName)) { ++ const cycleDependentName = Array.from(dependentNode.localDependencies.keys()).find( ++ (key) => currentNode.localDependents.has(key) ++ ); ++ const pathToCycle = step.slice().reverse().concat(cycleDependentName); ++ cycleNodes.add(dependentNode); ++ cyclePaths.add(pathToCycle); ++ } ++ dependentNode.localDependents.forEach(visits(step)); ++ }; ++ currentNode.localDependents.forEach(visits([currentName])); ++ }); ++ reportCycles2( ++ Array.from(cyclePaths, (cycle) => cycle.join(" -> ")), ++ rejectCycles ++ ); ++ return [cyclePaths, cycleNodes]; ++ } ++ /** ++ * Returns the cycles of this graph. If two cycles share some elements, they will ++ * be returned as a single cycle. ++ * ++ * @param {boolean} rejectCycles Whether or not to reject cycles ++ * @returns {Set} ++ */ ++ collapseCycles(rejectCycles) { ++ const cyclePaths = []; ++ const nodeToCycle = /* @__PURE__ */ new Map(); ++ const cycles = /* @__PURE__ */ new Set(); ++ const walkStack = []; ++ const alreadyVisited = /* @__PURE__ */ new Set(); ++ function visits(baseNode, dependentNode) { ++ if (nodeToCycle.has(baseNode)) { ++ return; ++ } ++ let topLevelDependent = dependentNode; ++ while (nodeToCycle.has(topLevelDependent)) { ++ topLevelDependent = nodeToCycle.get(topLevelDependent); ++ } ++ const identifier = `${baseNode.name}:${topLevelDependent.name}`; ++ if (alreadyVisited.has(identifier)) { ++ return; ++ } ++ alreadyVisited.add(identifier); ++ if (topLevelDependent === baseNode || topLevelDependent.isCycle && topLevelDependent.has(baseNode.name)) { ++ const cycle = new CyclicPackageGraphNode(); ++ walkStack.forEach((nodeInCycle) => { ++ nodeToCycle.set(nodeInCycle, cycle); ++ cycle.insert(nodeInCycle); ++ cycles.delete(nodeInCycle); ++ }); ++ cycles.add(cycle); ++ cyclePaths.push(cycle.toString()); ++ return; ++ } ++ if (walkStack.indexOf(topLevelDependent) === -1) { ++ visitWithStack(baseNode, topLevelDependent); ++ } ++ } ++ function visitWithStack(baseNode, currentNode = baseNode) { ++ walkStack.push(currentNode); ++ currentNode.localDependents.forEach(visits.bind(null, baseNode)); ++ walkStack.pop(); ++ } ++ this.forEach((currentNode) => visitWithStack(currentNode)); ++ cycles.forEach((collapsedNode) => visitWithStack(collapsedNode)); ++ reportCycles2(cyclePaths, rejectCycles); ++ return cycles; ++ } ++ /** ++ * Remove cycle nodes. ++ * ++ * @deprecated Spread set into prune() instead. ++ */ ++ pruneCycleNodes(cycleNodes) { ++ return this.prune(...cycleNodes); ++ } ++ /** ++ * Remove all candidate nodes. ++ */ ++ prune(...candidates) { ++ if (candidates.length === this.size) { ++ return this.clear(); ++ } ++ candidates.forEach((node) => this.remove(node)); ++ } ++ /** ++ * Delete by value (instead of key), as well as removing pointers ++ * to itself in the other node's internal collections. ++ * @param candidateNode instance to remove ++ */ ++ remove(candidateNode) { ++ this.delete(candidateNode.name); ++ this.forEach((node) => { ++ node.localDependencies.delete(candidateNode.name); ++ node.localDependents.delete(candidateNode.name); ++ }); ++ } ++ }; ++ } ++}); ++ ++// libs/legacy-core/src/lib/write-log-file.ts ++function writeLogFile2(cwd) { ++ let logOutput = ""; ++ npmlog_default.record.forEach((m) => { ++ let pref = [m.id, m.level]; ++ if (m.prefix) { ++ pref.push(m.prefix); ++ } ++ pref = pref.join(" "); ++ m.message.trim().split(/\r?\n/).map((line) => `${pref} ${line}`.trim()).forEach((line) => { ++ logOutput += line + import_os3.default.EOL; ++ }); ++ }); ++ import_write_file_atomic2.default.sync(import_path20.default.join(cwd, "lerna-debug.log"), logOutput); ++ npmlog_default.record.length = 0; ++} ++var import_os3, import_path20, import_write_file_atomic2; ++var init_write_log_file2 = __esm({ ++ "libs/legacy-core/src/lib/write-log-file.ts"() { ++ "use strict"; ++ init_src2(); ++ import_os3 = __toESM(require("os")); ++ import_path20 = __toESM(require("path")); ++ import_write_file_atomic2 = __toESM(require("write-file-atomic")); ++ } ++}); ++ ++// libs/legacy-core/src/lib/command/clean-stack.ts ++function cleanStack2(err, className) { ++ const lines = isErrorWithStack2(err) ? err.stack.split("\n") : String(err).split("\n"); ++ const cutoff = new RegExp(`^ at ${className}.runCommand .*$`); ++ const relevantIndex = lines.findIndex((line) => cutoff.test(line)); ++ if (relevantIndex) { ++ return lines.slice(0, relevantIndex).join("\n"); ++ } ++ return err.toString(); ++} ++function isErrorWithStack2(err) { ++ return err.stack !== void 0; ++} ++var init_clean_stack2 = __esm({ ++ "libs/legacy-core/src/lib/command/clean-stack.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/legacy-core/src/lib/command/default-options.ts ++function defaultOptions2(...sources) { ++ const options = {}; ++ for (const source of sources) { ++ if (source != null) { ++ for (const key of Object.keys(source)) { ++ if (options[key] === void 0) { ++ options[key] = source[key]; ++ } ++ } ++ } ++ } ++ return options; ++} ++var init_default_options2 = __esm({ ++ "libs/legacy-core/src/lib/command/default-options.ts"() { ++ "use strict"; ++ } ++}); ++ ++// libs/legacy-core/src/lib/command/log-package-error.ts ++function logPackageError2(err, stream3 = false) { ++ npmlog_default.error(err.command, `exited ${err.exitCode} in '${err.pkg.name}'`); ++ if (stream3) { ++ return; ++ } ++ if (err.stdout) { ++ npmlog_default.error(err.command, "stdout:"); ++ directLog2(err.stdout); ++ } ++ if (err.stderr) { ++ npmlog_default.error(err.command, "stderr:"); ++ directLog2(err.stderr); ++ } ++ npmlog_default.error(err.command, `exited ${err.exitCode} in '${err.pkg.name}'`); ++} ++function directLog2(message) { ++ npmlog_default.pause(); ++ console.error(message); ++ npmlog_default.resume(); ++} ++var init_log_package_error2 = __esm({ ++ "libs/legacy-core/src/lib/command/log-package-error.ts"() { ++ "use strict"; ++ init_src2(); ++ } ++}); ++ ++// libs/legacy-core/src/lib/command/warn-if-hanging.ts ++function warnIfHanging2() { ++ const childProcessCount = childProcess13.getChildProcessCount(); ++ if (childProcessCount > 0) { ++ npmlog_default.warn( ++ "complete", ++ `Waiting for ${childProcessCount} child process${childProcessCount === 1 ? "" : "es"} to exit. CTRL-C to exit immediately.` ++ ); ++ } ++} ++var childProcess13; ++var init_warn_if_hanging2 = __esm({ ++ "libs/legacy-core/src/lib/command/warn-if-hanging.ts"() { ++ "use strict"; ++ init_src2(); ++ childProcess13 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/legacy-core/src/lib/command/index.ts ++var import_dedent5, import_execa3, import_os4, DEFAULT_CONCURRENCY2, Command2; ++var init_command2 = __esm({ ++ "libs/legacy-core/src/lib/command/index.ts"() { ++ "use strict"; ++ init_src2(); ++ import_dedent5 = __toESM(require("dedent")); ++ import_execa3 = __toESM(require("execa")); ++ import_os4 = __toESM(require("os")); ++ init_package_graph(); ++ init_write_log_file2(); ++ init_clean_stack2(); ++ init_default_options2(); ++ init_log_package_error2(); ++ init_warn_if_hanging2(); ++ DEFAULT_CONCURRENCY2 = import_os4.default.cpus().length; ++ Command2 = class { ++ constructor(_argv, { skipValidations } = { skipValidations: false }) { ++ this._argv = _argv; ++ npmlog_default.pause(); ++ npmlog_default.heading = "lerna"; ++ const argv = { ..._argv }; ++ npmlog_default.silly("argv", argv); ++ this.name = this.constructor.name.replace(/Command$/, "").toLowerCase(); ++ this.composed = typeof argv.composed === "string" && argv.composed !== this.name; ++ if (!this.composed) { ++ npmlog_default.notice("cli", `v${argv.lernaVersion}`); ++ } ++ let runner = new Promise((resolve3, reject) => { ++ let chain = Promise.resolve(); ++ chain = chain.then(() => { ++ this.project = new Project(argv.cwd); ++ }); ++ chain = chain.then(() => this.configureEnvironment()); ++ chain = chain.then(() => this.configureOptions()); ++ chain = chain.then(() => this.configureProperties()); ++ chain = chain.then(() => this.configureLogging()); ++ if (!skipValidations) { ++ chain = chain.then(() => this.runValidations()); ++ } ++ chain = chain.then(() => this.runPreparations()); ++ chain = chain.then(() => this.runCommand()); ++ chain.then( ++ (result) => { ++ warnIfHanging2(); ++ resolve3(result); ++ }, ++ (err) => { ++ if (err.pkg) { ++ logPackageError2(err, this.options.stream); ++ } else if (err.name !== "ValidationError") { ++ npmlog_default.error("", cleanStack2(err, this.constructor.name)); ++ } ++ if (err.name !== "ValidationError" && !err.pkg) { ++ writeLogFile2(this.project.rootPath); ++ } ++ warnIfHanging2(); ++ reject(err); ++ } ++ ); ++ }); ++ if (argv.onResolved || argv.onRejected) { ++ runner = runner.then(argv.onResolved, argv.onRejected); ++ delete argv.onResolved; ++ delete argv.onRejected; ++ } ++ for (const key of ["cwd", "$0"]) { ++ Object.defineProperty(argv, key, { enumerable: false }); ++ } ++ Object.defineProperty(this, "argv", { ++ value: Object.freeze(argv) ++ }); ++ this.runner = runner; ++ } ++ name; ++ composed; ++ options = {}; ++ runner; ++ concurrency; ++ toposort = false; ++ execOpts; ++ packageGraph; ++ logger; ++ _project; ++ get project() { ++ if (this._project === void 0) { ++ throw new ValidationError("ENOPROJECT", "Lerna Project not initialized!"); ++ } ++ return this._project; ++ } ++ set project(project) { ++ this._project = project; ++ } ++ // proxy "Promise" methods to "private" instance ++ then(onResolved, onRejected) { ++ return this.runner.then(onResolved, onRejected); ++ } ++ /* istanbul ignore next */ ++ catch(onRejected) { ++ return this.runner.catch(onRejected); ++ } ++ get requiresGit() { ++ return true; ++ } ++ // Override this to inherit config from another command. ++ // For example `changed` inherits config from `publish`. ++ get otherCommandConfigs() { ++ return []; ++ } ++ configureEnvironment() { ++ const ci = require("is-ci"); ++ let loglevel; ++ let progress; ++ if (ci || !process.stderr.isTTY) { ++ npmlog_default.disableColor(); ++ progress = false; ++ } else if (!process.stdout.isTTY) { ++ progress = false; ++ loglevel = "error"; ++ } else if (process.stderr.isTTY) { ++ npmlog_default.enableColor(); ++ npmlog_default.enableUnicode(); ++ } ++ Object.defineProperty(this, "envDefaults", { ++ value: { ++ ci, ++ progress, ++ loglevel ++ } ++ }); ++ } ++ configureOptions() { ++ const commandConfig = this.project.config.command || {}; ++ const overrides = [this.name, ...this.otherCommandConfigs].map((key) => commandConfig[key]); ++ this.options = defaultOptions2( ++ // CLI flags, which if defined overrule subsequent values ++ this.argv, ++ ...overrides, ++ // Global options from `lerna.json` ++ this.project.config, ++ // Environmental defaults prepared in previous step ++ this.envDefaults ++ ); ++ if (this.options.verbose && this.options.loglevel !== "silly") { ++ this.options.loglevel = "verbose"; ++ } ++ } ++ // eslint-disable-next-line @typescript-eslint/no-unused-vars ++ argv(argv, arg1, config, envDefaults) { ++ throw new Error("Method not implemented."); ++ } ++ // eslint-disable-next-line @typescript-eslint/no-unused-vars ++ envDefaults(argv, arg1, config, envDefaults) { ++ throw new Error("Method not implemented."); ++ } ++ configureProperties() { ++ const { concurrency = 0, sort, maxBuffer } = this.options; ++ this.concurrency = Math.max(1, +concurrency || DEFAULT_CONCURRENCY2); ++ this.toposort = sort === void 0 || sort; ++ this.execOpts = { ++ cwd: this.project.rootPath, ++ maxBuffer ++ }; ++ } ++ configureLogging() { ++ const { loglevel } = this.options; ++ if (loglevel) { ++ npmlog_default.level = loglevel; ++ } ++ npmlog_default.addLevel("success", 3001, { fg: "green", bold: true }); ++ Object.defineProperty(this, "logger", { ++ value: npmlog_default["newGroup"](this.name) ++ }); ++ npmlog_default.resume(); ++ } ++ enableProgressBar() { ++ if (this.options.progress !== false) { ++ npmlog_default.enableProgress(); ++ } ++ } ++ gitInitialized() { ++ const opts = { ++ cwd: this.project.rootPath, ++ // don't throw, just want boolean ++ reject: false, ++ // only return code, no stdio needed ++ stdio: "ignore" ++ }; ++ return import_execa3.default.sync("git", ["rev-parse"], opts).exitCode === 0; ++ } ++ runValidations() { ++ if ((this.options.since !== void 0 || this.requiresGit) && !this.gitInitialized()) { ++ throw new ValidationError("ENOGIT", "The git binary was not found, or this is not a git repository."); ++ } ++ if (this.options.independent && !this.project.isIndependent()) { ++ throw new ValidationError( ++ "EVERSIONMODE", ++ import_dedent5.default` ++ You ran lerna with --independent or -i, but the repository is not set to independent mode. ++ To use independent mode you need to set lerna.json's "version" property to "independent". ++ Then you won't need to pass the --independent or -i flags. ++ ` ++ ); ++ } ++ } ++ runPreparations() { ++ if (!this.composed && this.project.isIndependent()) { ++ npmlog_default.info("versioning", "independent"); ++ } ++ if (!this.composed && this.options.ci) { ++ npmlog_default.info("ci", "enabled"); ++ } ++ let chain = Promise.resolve(); ++ chain = chain.then(() => this.project.getPackages()); ++ chain = chain.then((packages) => { ++ this.packageGraph = new PackageGraph(packages); ++ }); ++ return chain; ++ } ++ runCommand() { ++ return Promise.resolve().then(() => this.initialize()).then((proceed) => { ++ if (proceed !== false) { ++ return this.execute(); ++ } ++ }); ++ } ++ initialize() { ++ throw new ValidationError(this.name, "initialize() needs to be implemented."); ++ } ++ execute() { ++ throw new ValidationError(this.name, "execute() needs to be implemented."); ++ } ++ }; ++ } ++}); ++ ++// libs/legacy-core/src/lib/create-symlink.ts ++var import_cmd_shim, import_fs_extra8; ++var init_create_symlink = __esm({ ++ "libs/legacy-core/src/lib/create-symlink.ts"() { ++ "use strict"; ++ import_cmd_shim = __toESM(require("cmd-shim")); ++ import_fs_extra8 = __toESM(require("fs-extra")); ++ init_src2(); ++ } ++}); ++ ++// libs/legacy-core/src/lib/filter-packages.ts ++function filterPackages(packagesToFilter, include = [], exclude = [], showPrivate, continueIfNoMatch) { ++ const filtered = new Set(packagesToFilter); ++ const patterns = [].concat(arrify2(include), negate2(exclude)); ++ if (showPrivate === false) { ++ for (const pkg2 of filtered) { ++ if (pkg2.private) { ++ filtered.delete(pkg2); ++ } ++ } ++ } ++ if (patterns.length) { ++ npmlog_default.info("filter", patterns); ++ if (!include.length) { ++ patterns.unshift("**"); ++ } ++ const pnames = Array.from(filtered).map((pkg2) => pkg2.name); ++ const chosen = new Set((0, import_multimatch2.default)(pnames, patterns)); ++ for (const pkg2 of filtered) { ++ if (!chosen.has(pkg2.name)) { ++ filtered.delete(pkg2); ++ } ++ } ++ if (!filtered.size && !continueIfNoMatch) { ++ throw new ValidationError("EFILTER", import_util3.default.format("No packages remain after filtering", patterns)); ++ } ++ } ++ return Array.from(filtered); ++} ++function arrify2(thing) { ++ if (!thing) { ++ return []; ++ } ++ if (!Array.isArray(thing)) { ++ return [thing]; ++ } ++ return thing; ++} ++function negate2(patterns) { ++ return arrify2(patterns).map((pattern) => `!${pattern}`); ++} ++var import_multimatch2, import_util3; ++var init_filter_packages = __esm({ ++ "libs/legacy-core/src/lib/filter-packages.ts"() { ++ "use strict"; ++ init_src2(); ++ import_multimatch2 = __toESM(require("multimatch")); ++ import_util3 = __toESM(require("util")); ++ } ++}); ++ ++// libs/legacy-core/src/lib/get-filtered-packages.ts ++function getFilteredPackages(packageGraph, execOpts, opts) { ++ const options = { log: npmlog_default, ...opts }; ++ if (options.scope) { ++ options.log.notice("filter", "including %j", options.scope); ++ } ++ if (options.ignore) { ++ options.log.notice("filter", "excluding %j", options.ignore); ++ } ++ let chain = Promise.resolve(); ++ chain = chain.then( ++ () => filterPackages( ++ packageGraph.rawPackageList, ++ // TODO: refactor to address type issues ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ options.scope, ++ options.ignore, ++ options.private, ++ options.continueIfNoMatch ++ ) ++ ); ++ if (options.since !== void 0) { ++ options.log.notice("filter", "changed since %j", options.since); ++ if (options.excludeDependents) { ++ options.log.notice("filter", "excluding dependents"); ++ } ++ if (options.includeMergedTags) { ++ options.log.notice("filter", "including merged tags"); ++ } ++ chain = chain.then( ++ (filteredPackages) => ( ++ // TODO: refactor to address type issues ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ Promise.resolve(collectUpdates(filteredPackages, packageGraph, execOpts, opts)).then((updates) => { ++ const updated = new Set(updates.map(({ pkg: pkg2 }) => pkg2.name)); ++ return filteredPackages.filter((pkg2) => updated.has(pkg2.name)); ++ }) ++ ) ++ ); ++ } ++ if (options.includeDependents) { ++ options.log.notice("filter", "including dependents"); ++ chain = chain.then((filteredPackages) => packageGraph.addDependents(filteredPackages)); ++ } ++ if (options.includeDependencies) { ++ options.log.notice("filter", "including dependencies"); ++ chain = chain.then((filteredPackages) => packageGraph.addDependencies(filteredPackages)); ++ } ++ return chain; ++} ++var init_get_filtered_packages = __esm({ ++ "libs/legacy-core/src/lib/get-filtered-packages.ts"() { ++ "use strict"; ++ init_src2(); ++ init_collect_updates2(); ++ init_filter_packages(); ++ } ++}); ++ ++// libs/legacy-core/src/lib/query-graph.ts ++var QueryGraph, toposort; ++var init_query_graph = __esm({ ++ "libs/legacy-core/src/lib/query-graph.ts"() { ++ "use strict"; ++ init_package_graph(); ++ QueryGraph = class _QueryGraph { ++ graph; ++ cycles; ++ /** ++ * Sort a list of Packages topologically. ++ * @returns A list of Package instances in topological order ++ */ ++ static toposort(packages, options) { ++ const graph = new _QueryGraph(packages, options); ++ const result = []; ++ let batch = graph.getAvailablePackages(); ++ while (batch.length) { ++ for (const node of batch) { ++ result.push(node.pkg); ++ graph.markAsDone(node); ++ } ++ batch = graph.getAvailablePackages(); ++ } ++ return result; ++ } ++ constructor(packages, { graphType = "allDependencies", rejectCycles } = {}) { ++ this.graph = new PackageGraph(packages, graphType); ++ this.cycles = this.graph.collapseCycles(rejectCycles); ++ } ++ _getNextLeaf() { ++ return Array.from(this.graph.values()).filter((node) => node.localDependencies.size === 0); ++ } ++ _getNextCycle() { ++ const cycle = Array.from(this.cycles).find((cycleNode) => cycleNode.localDependencies.size === 0); ++ if (!cycle) { ++ return []; ++ } ++ this.cycles.delete(cycle); ++ return cycle.flatten(); ++ } ++ getAvailablePackages() { ++ const availablePackages = this._getNextLeaf(); ++ if (availablePackages.length > 0) { ++ return availablePackages; ++ } ++ return this._getNextCycle(); ++ } ++ markAsTaken(name) { ++ this.graph.delete(name); ++ } ++ markAsDone(candidateNode) { ++ this.graph.remove(candidateNode); ++ for (const cycle of this.cycles) { ++ cycle.unlink(candidateNode); ++ } ++ } ++ }; ++ toposort = QueryGraph.toposort; ++ } ++}); ++ ++// libs/legacy-core/src/lib/listable-format.ts ++var import_chalk4, import_columnify3; ++var init_listable_format = __esm({ ++ "libs/legacy-core/src/lib/listable-format.ts"() { ++ "use strict"; ++ import_chalk4 = __toESM(require("chalk")); ++ import_columnify3 = __toESM(require("columnify")); ++ init_query_graph(); ++ } ++}); ++ ++// libs/legacy-core/src/lib/run-topologically.ts ++var import_p_queue3; ++var init_run_topologically = __esm({ ++ "libs/legacy-core/src/lib/run-topologically.ts"() { ++ "use strict"; ++ import_p_queue3 = __toESM(require("p-queue")); ++ init_query_graph(); ++ } ++}); ++ ++// libs/legacy-core/src/lib/symlink-binary/index.ts ++var import_fs_extra9, import_p_map3; ++var init_symlink_binary = __esm({ ++ "libs/legacy-core/src/lib/symlink-binary/index.ts"() { ++ "use strict"; ++ init_src2(); ++ import_fs_extra9 = __toESM(require("fs-extra")); ++ import_p_map3 = __toESM(require("p-map")); ++ init_create_symlink(); ++ } ++}); ++ ++// libs/legacy-core/src/lib/resolve-symlink.ts ++var import_fs_extra10, readCmdShim; ++var init_resolve_symlink = __esm({ ++ "libs/legacy-core/src/lib/resolve-symlink.ts"() { ++ "use strict"; ++ init_src2(); ++ import_fs_extra10 = __toESM(require("fs-extra")); ++ readCmdShim = require("read-cmd-shim"); ++ } ++}); ++ ++// libs/legacy-core/src/lib/symlink-dependencies.ts ++var import_fs_extra11, import_p_map4, import_p_map_series; ++var init_symlink_dependencies = __esm({ ++ "libs/legacy-core/src/lib/symlink-dependencies.ts"() { ++ "use strict"; ++ import_fs_extra11 = __toESM(require("fs-extra")); ++ import_p_map4 = __toESM(require("p-map")); ++ import_p_map_series = __toESM(require("p-map-series")); ++ init_create_symlink(); ++ init_resolve_symlink(); ++ init_symlink_binary(); ++ } ++}); ++ ++// libs/legacy-core/src/index.ts ++var init_src4 = __esm({ ++ "libs/legacy-core/src/index.ts"() { ++ "use strict"; ++ init_collect_updates2(); ++ init_command2(); ++ init_create_symlink(); ++ init_get_filtered_packages(); ++ init_listable_format(); ++ init_package_graph(); ++ init_package_graph_node(); ++ init_run_topologically(); ++ init_symlink_binary(); ++ init_symlink_dependencies(); ++ } ++}); ++ ++// libs/commands/clean/src/index.ts ++var require_src = __commonJS({ ++ "libs/commands/clean/src/index.ts"(exports2, module2) { ++ "use strict"; ++ init_src2(); ++ init_src4(); ++ var import_p_map10 = __toESM(require("p-map")); ++ var import_path27 = __toESM(require("path")); ++ module2.exports = function factory9(argv) { ++ return new CleanCommand(argv); ++ }; ++ var CleanCommand = class extends Command2 { ++ get requiresGit() { ++ return false; ++ } ++ initialize() { ++ let chain = Promise.resolve(); ++ chain = chain.then(() => getFilteredPackages(this.packageGraph, this.execOpts, this.options)); ++ chain = chain.then((filteredPackages) => { ++ this.directoriesToDelete = filteredPackages.map((pkg2) => pkg2.nodeModulesLocation); ++ }); ++ return chain.then(() => { ++ if (this.options.yes) { ++ return true; ++ } ++ this.logger.info("", "Removing the following directories:"); ++ this.logger.info( ++ "clean", ++ this.directoriesToDelete.map((dir) => import_path27.default.relative(this.project.rootPath, dir)).join("\n") ++ ); ++ return promptConfirmation("Proceed?"); ++ }); ++ } ++ execute() { ++ this.enableProgressBar(); ++ const tracker = this.logger.newItem("clean"); ++ const mapper = (dirPath) => { ++ tracker.info("clean", "removing", dirPath); ++ return pulseTillDone(rimrafDir(dirPath)).then(() => { ++ tracker.completeWork(1); ++ }); ++ }; ++ tracker.addWork(this.directoriesToDelete.length); ++ return (0, import_p_map10.default)(this.directoriesToDelete, mapper, { concurrency: this.concurrency }).then(() => { ++ tracker.finish(); ++ this.logger.success("clean", "finished"); ++ }); ++ } ++ }; ++ module2.exports.CleanCommand = CleanCommand; ++ } ++}); ++ ++// libs/commands/clean/src/command.ts ++var require_command2 = __commonJS({ ++ "libs/commands/clean/src/command.ts"(exports2, module2) { ++ "use strict"; ++ init_src2(); ++ var command = { ++ command: "clean", ++ describe: "Remove the node_modules directory from all packages", ++ builder(yargs2) { ++ yargs2.options({ ++ y: { ++ group: "Command Options:", ++ describe: "Skip all confirmation prompts", ++ alias: "yes", ++ type: "boolean" ++ } ++ }); ++ return filterOptions(yargs2); ++ }, ++ handler(argv) { ++ return require_src()(argv); ++ } ++ }; ++ module2.exports = command; ++ } ++}); ++ ++// libs/commands/create/src/lib/builtin-npmrc.ts ++var require_builtin_npmrc = __commonJS({ ++ "libs/commands/create/src/lib/builtin-npmrc.ts"(exports2, module2) { ++ "use strict"; ++ var import_fs_extra17 = __toESM(require("fs-extra")); ++ var import_path27 = __toESM(require("path")); ++ module2.exports.builtinNpmrc = builtinNpmrc; ++ function builtinNpmrc() { ++ let resolvedPath = ""; ++ try { ++ resolvedPath = import_path27.default.resolve( ++ import_fs_extra17.default.realpathSync(import_path27.default.join(import_path27.default.dirname(process.execPath), "npm")), ++ "../../npmrc" ++ ); ++ } catch (err) { ++ } ++ return resolvedPath; ++ } ++ } ++}); ++ ++// libs/commands/create/src/lib/cat-file.ts ++var require_cat_file = __commonJS({ ++ "libs/commands/create/src/lib/cat-file.ts"(exports2, module2) { ++ "use strict"; ++ var import_fs_extra17 = __toESM(require("fs-extra")); ++ var import_path27 = __toESM(require("path")); ++ module2.exports.catFile = catFile; ++ function catFile(baseDir, fileName, content, opts = "utf8") { ++ return import_fs_extra17.default.writeFile(import_path27.default.join(baseDir, fileName), `${content} ++`, opts); ++ } ++ } ++}); ++ ++// libs/commands/create/src/index.ts ++var require_src2 = __commonJS({ ++ "libs/commands/create/src/index.ts"(exports2, module2) { ++ "use strict"; ++ init_src2(); ++ init_src4(); ++ var import_dedent7 = __toESM(require("dedent")); ++ var import_fs_extra17 = __toESM(require("fs-extra")); ++ var import_npm_package_arg10 = __toESM(require("npm-package-arg")); ++ var import_os6 = __toESM(require("os")); ++ var import_p_reduce = __toESM(require("p-reduce")); ++ var import_pacote2 = __toESM(require("pacote")); ++ var import_path27 = __toESM(require("path")); ++ var import_slash4 = __toESM(require("slash")); ++ var import_url2 = require("url"); ++ var import_yargs_parser = require("yargs-parser"); ++ init_src(); ++ var initPackageJson = require("init-package-json"); ++ var { builtinNpmrc } = require_builtin_npmrc(); ++ var { catFile } = require_cat_file(); ++ var LERNA_MODULE_DATA = require.resolve(import_path27.default.join(__dirname, "./lib/lerna-module-data.js")); ++ var DEFAULT_DESCRIPTION = [ ++ "Now I\u2019m the model of a modern major general", ++ "The venerated Virginian veteran whose men are all", ++ "Lining up, to put me up on a pedestal", ++ "Writin\u2019 letters to relatives", ++ "Embellishin\u2019 my elegance and eloquence", ++ "But the elephant is in the room", ++ "The truth is in ya face when ya hear the British cannons go", ++ "BOOM" ++ ].join(" / "); ++ module2.exports = function factory9(argv) { ++ return new CreateCommand(argv); ++ }; ++ var CreateCommand = class extends Command2 { ++ initialize() { ++ const { ++ bin, ++ description = DEFAULT_DESCRIPTION, ++ esModule, ++ keywords, ++ license, ++ loc: pkgLocation, ++ name: pkgName, ++ yes ++ } = this.options; ++ const { name, scope } = (0, import_npm_package_arg10.default)(pkgName); ++ if (!name && pkgName.includes("/")) { ++ throw new ValidationError( ++ "ENOPKGNAME", ++ "Invalid package name. Use the positional to specify package directory.\nSee https://github.com/lerna/lerna/tree/main/libs/commands/create#usage for details." ++ ); ++ } ++ this.dirName = scope ? name.split("/").pop() : name; ++ this.pkgName = name; ++ this.pkgsDir = this._getPackagesDir(pkgLocation); ++ this.camelName = (0, import_yargs_parser.camelCase)(this.dirName); ++ this.outDir = esModule ? "dist" : "lib"; ++ this.targetDir = import_path27.default.resolve(this.pkgsDir, this.dirName); ++ this.binDir = import_path27.default.join(this.targetDir, "bin"); ++ this.binFileName = bin === true ? this.dirName : bin; ++ this.libDir = import_path27.default.join(this.targetDir, esModule ? "src" : "lib"); ++ this.libFileName = `${this.dirName}.js`; ++ this.testDir = import_path27.default.join(this.targetDir, "__tests__"); ++ this.testFileName = `${this.dirName}.test.js`; ++ this.conf = npmConf2({ ++ description, ++ esModule, ++ keywords, ++ scope, ++ yes ++ }); ++ this.conf.addFile(builtinNpmrc(), "builtin"); ++ this.conf.set("init-main", `${this.outDir}/${this.libFileName}`); ++ if (esModule) { ++ this.conf.set("init-es-module", `${this.outDir}/${this.dirName}.module.js`); ++ } ++ if (!this.project.isIndependent()) { ++ this.conf.set("init-version", this.project.version); ++ } ++ if (this.conf.get("init-author-name") === "") { ++ this.conf.set("init-author-name", this.gitConfig("user.name")); ++ } ++ if (this.conf.get("init-author-email") === "") { ++ this.conf.set("init-author-email", this.gitConfig("user.email")); ++ } ++ if (license) { ++ this.conf.set("init-license", license); ++ } ++ if (this.options.private) { ++ this.conf.set("private", true); ++ } ++ if (this.options.loglevel === "silent") { ++ this.conf.set("silent", true); ++ } ++ if (this.binFileName) { ++ this.conf.set("bin", { ++ [this.binFileName]: `bin/${this.binFileName}` ++ }); ++ } ++ this.conf.set("directories", { ++ lib: this.outDir, ++ test: "__tests__" ++ }); ++ this.setFiles(); ++ this.setHomepage(); ++ this.setPublishConfig(); ++ this.setRepository(); ++ return Promise.resolve(this.setDependencies()); ++ } ++ _getPackagesDir(pkgLocation) { ++ const packageParentDirs = this.project.packageParentDirs; ++ if (!pkgLocation) { ++ return packageParentDirs[0]; ++ } ++ const normalizedPkgLocation = import_path27.default.resolve(this.project.rootPath, import_path27.default.normalize(pkgLocation)).toLowerCase(); ++ const packageParentDirsLower = packageParentDirs.map((p) => p.toLowerCase()); ++ const matchingPathIndex = packageParentDirsLower.findIndex((p) => p.indexOf(normalizedPkgLocation) > -1); ++ if (matchingPathIndex > -1) { ++ return packageParentDirs[matchingPathIndex]; ++ } ++ throw new ValidationError( ++ "ENOPKGDIR", ++ `Location "${pkgLocation}" is not configured as a workspace directory.` ++ ); ++ } ++ async execute() { ++ await import_fs_extra17.default.mkdirp(this.libDir); ++ await import_fs_extra17.default.mkdirp(this.testDir); ++ await Promise.all([this.writeReadme(), this.writeLibFile(), this.writeTestFile()]); ++ if (this.binFileName) { ++ await import_fs_extra17.default.mkdirp(this.binDir); ++ await Promise.all([this.writeBinFile(), this.writeCliFile(), this.writeCliTest()]); ++ } ++ const data = await initPackageJson(this.targetDir, LERNA_MODULE_DATA, this.conf); ++ if (this.options.esModule) { ++ this.logger.notice( ++ "\u2714", ++ import_dedent7.default` ++ Ensure '${import_path27.default.relative(".", this.pkgsDir)}/*/${this.outDir}' has been added to ./.gitignore ++ Ensure rollup or babel build scripts are in the root ++ ` ++ ); ++ } ++ this.logger.success( ++ "create", ++ `New package ${data.name} created at ./${import_path27.default.relative(".", this.targetDir)}` ++ ); ++ } ++ gitConfig(prop) { ++ return execSync("git", ["config", "--get", prop], this.execOpts); ++ } ++ collectExternalVersions() { ++ const extVersions = /* @__PURE__ */ new Map(); ++ for (const { externalDependencies } of this.packageGraph.values()) { ++ for (const [name, resolved] of externalDependencies) { ++ extVersions.set(name, resolved.fetchSpec); ++ } ++ } ++ return extVersions; ++ } ++ hasLocalRelativeFileSpec() { ++ for (const { localDependencies } of this.packageGraph.values()) { ++ for (const spec of localDependencies.values()) { ++ if (spec.type === "directory") { ++ return true; ++ } ++ } ++ } ++ } ++ resolveRelative(depNode) { ++ const relPath = import_path27.default.relative(this.targetDir, depNode.location); ++ const spec = import_npm_package_arg10.default.resolve(depNode.name, relPath, this.targetDir); ++ return (0, import_slash4.default)(spec.saveSpec); ++ } ++ setDependencies() { ++ const inputs = new Set((this.options.dependencies || []).sort()); ++ if (this.options.bin) { ++ inputs.add("yargs"); ++ } ++ if (!inputs.size) { ++ return; ++ } ++ const exts = this.collectExternalVersions(); ++ const localRelative = this.hasLocalRelativeFileSpec(); ++ const savePrefix = this.conf.get("save-exact") ? "" : this.conf.get("save-prefix"); ++ const pacoteOpts = this.conf.snapshot; ++ const decideVersion = (spec) => { ++ if (this.packageGraph.has(spec.name)) { ++ const depNode = this.packageGraph.get(spec.name); ++ if (localRelative) { ++ return this.resolveRelative(depNode); ++ } ++ return `${savePrefix}${depNode.version}`; ++ } ++ if (spec.type === "tag" && spec.fetchSpec === "latest" || spec.type === "range" && spec.fetchSpec === "*") { ++ if (exts.has(spec.name)) { ++ return exts.get(spec.name); ++ } ++ return import_pacote2.default.manifest(spec, pacoteOpts).then((pkg2) => `${savePrefix}${pkg2.version}`); ++ } ++ if (spec.type === "git") { ++ throw new ValidationError("EGIT", "Do not use git dependencies"); ++ } ++ return spec.rawSpec; ++ }; ++ let chain = Promise.resolve(); ++ chain = chain.then( ++ () => (0, import_p_reduce.default)( ++ inputs, ++ (obj, input) => { ++ const spec = (0, import_npm_package_arg10.default)(input); ++ return Promise.resolve(spec).then(decideVersion).then((version) => { ++ obj[spec.name] = version; ++ return obj; ++ }); ++ }, ++ {} ++ ) ++ ); ++ chain = chain.then((dependencies) => { ++ this.conf.set("dependencies", dependencies); ++ }); ++ return chain; ++ } ++ setFiles() { ++ const files = [this.outDir]; ++ if (this.options.bin) { ++ files.unshift("bin"); ++ } ++ this.conf.set("files", files); ++ } ++ setHomepage() { ++ let { homepage = this.project.manifest.get("homepage") } = this.options; ++ if (!homepage) { ++ return; ++ } ++ if (homepage.indexOf("http") !== 0) { ++ homepage = `http://${homepage}`; ++ } ++ const hurl = new import_url2.URL(homepage); ++ const relativeTarget = import_path27.default.relative(this.project.rootPath, this.targetDir); ++ if (hurl.hostname.match("github")) { ++ hurl.pathname = import_path27.default.posix.join(hurl.pathname, "tree/main", relativeTarget); ++ hurl.hash = "readme"; ++ } else if (!this.options.homepage) { ++ hurl.pathname = import_path27.default.posix.join(hurl.pathname, relativeTarget); ++ } ++ this.conf.set("homepage", hurl.href); ++ } ++ setPublishConfig() { ++ const scope = this.conf.get("scope"); ++ const registry = this.options.registry || this.conf.get(`${scope}:registry`) || this.conf.get("registry"); ++ const isPublicRegistry = registry === this.conf.root.registry; ++ const publishConfig = {}; ++ if (scope && isPublicRegistry) { ++ publishConfig.access = this.options.access || "public"; ++ } ++ if (registry && !isPublicRegistry) { ++ publishConfig.registry = registry; ++ } ++ if (this.options.tag) { ++ publishConfig.tag = this.options.tag; ++ } ++ if (Object.keys(publishConfig).length) { ++ this.conf.set("publishConfig", publishConfig); ++ } ++ } ++ setRepository() { ++ try { ++ const url2 = execSync("git", ["remote", "get-url", "origin"], this.execOpts); ++ this.conf.set("repository", url2); ++ } catch (err) { ++ this.logger.warn("ENOREMOTE", "No git remote found, skipping repository property"); ++ } ++ } ++ writeReadme() { ++ const readmeContent = import_dedent7.default` ++ # \`${this.pkgName}\` ++ ++ > ${this.options.description || "TODO: description"} ++ ++ ## Usage ++ ++ \`\`\` ++ ${this.options.bin ? import_dedent7.default` ++ npm -g i ${this.pkgName} ++ ++ ${this.binFileName} --help ++ ` : this.options.esModule ? `import ${this.camelName} from '${this.pkgName}';` : `const ${this.camelName} = require('${this.pkgName}');`} ++ ++ // TODO: DEMONSTRATE API ++ \`\`\` ++ `; ++ return catFile(this.targetDir, "README.md", readmeContent); ++ } ++ writeLibFile() { ++ const libContent = this.options.esModule ? import_dedent7.default` ++ export default function ${this.camelName}() { ++ return 'Hello from ${this.camelName}'; ++ } ++ ` : import_dedent7.default` ++ 'use strict'; ++ ++ module.exports = ${this.camelName}; ++ ++ function ${this.camelName}() { ++ return 'Hello from ${this.camelName}'; ++ } ++ `; ++ return catFile(this.libDir, this.libFileName, libContent); ++ } ++ writeTestFile() { ++ const testContent = this.options.esModule ? import_dedent7.default` ++ import ${this.camelName} from '../src/${this.dirName}.js'; ++ import { strict as assert } from 'assert'; ++ ++ assert.strictEqual(${this.camelName}(), 'Hello from ${this.camelName}'); ++ console.info('${this.camelName} tests passed'); ++ ` : import_dedent7.default` ++ 'use strict'; ++ ++ const ${this.camelName} = require('..'); ++ const assert = require('assert').strict; ++ ++ assert.strictEqual(${this.camelName}(), 'Hello from ${this.camelName}'); ++ console.info('${this.camelName} tests passed'); ++ `; ++ return catFile(this.testDir, this.testFileName, testContent); ++ } ++ writeCliFile() { ++ const cliFileName = "cli.js"; ++ const cliContent = [ ++ this.options.esModule ? import_dedent7.default` ++ import factory from 'yargs/yargs'; ++ import ${this.camelName} from './${this.dirName}'; ++ ++ export default cli; ++ ` : import_dedent7.default` ++ 'use strict'; ++ ++ const factory = require('yargs/yargs'); ++ const ${this.camelName} = require('./${this.dirName}'); ++ ++ module.exports = cli; ++ `, ++ "", ++ // blank line ++ import_dedent7.default` ++ function cli(cwd) { ++ const parser = factory(null, cwd); ++ ++ parser.alias('h', 'help'); ++ parser.alias('v', 'version'); ++ ++ parser.usage( ++ "$0", ++ "TODO: description", ++ yargs => { ++ yargs.options({ ++ // TODO: options ++ }); ++ }, ++ argv => ${this.camelName}(argv) ++ ); ++ ++ return parser; ++ } ++ ` ++ ].join(import_os6.default.EOL); ++ return catFile(this.libDir, cliFileName, cliContent); ++ } ++ writeCliTest() { ++ const cliTestFileName = "cli.test.js"; ++ const cliTestContent = [ ++ this.options.esModule ? import_dedent7.default` ++ import cli from '../src/cli'; ++ ` : import_dedent7.default` ++ 'use strict'; ++ ++ const cli = require('../lib/cli'); ++ `, ++ "", ++ // blank line ++ import_dedent7.default` ++ describe('${this.pkgName} cli', () => { ++ // const argv = cli(cwd).parse(['args']); ++ it('needs tests'); ++ }); ++ ` ++ ].join(import_os6.default.EOL); ++ return catFile(this.testDir, cliTestFileName, cliTestContent); ++ } ++ writeBinFile() { ++ const binContent = import_dedent7.default` ++ #!/usr/bin/env node ++ ++ 'use strict'; ++ ++ // eslint-disable-next-line no-unused-expressions ++ require('../${this.outDir}/cli')${this.options.esModule ? ".default" : ""}().parse(process.argv.slice(2));`; ++ return catFile(this.binDir, this.binFileName, binContent, { mode: 493 }); ++ } ++ }; ++ module2.exports.CreateCommand = CreateCommand; ++ } ++}); ++ ++// libs/commands/create/src/command.ts ++var require_command3 = __commonJS({ ++ "libs/commands/create/src/command.ts"(exports2, module2) { ++ "use strict"; ++ var command = { ++ command: "create [loc]", ++ describe: "Create a new lerna-managed package", ++ builder(yargs2) { ++ yargs2.positional("name", { ++ describe: "The package name (including scope), which must be locally unique _and_ publicly available", ++ type: "string" ++ }).positional("loc", { ++ describe: "A custom package location, defaulting to the first configured package location", ++ type: "string" ++ }).options({ ++ access: { ++ group: "Command Options:", ++ defaultDescription: "public", ++ describe: "When using a scope, set publishConfig.access value", ++ choices: ["public", "restricted"] ++ }, ++ bin: { ++ group: "Command Options:", ++ defaultDescription: "", ++ describe: "Package has an executable. Customize with --bin " ++ }, ++ description: { ++ group: "Command Options:", ++ describe: "Package description", ++ type: "string" ++ }, ++ dependencies: { ++ group: "Command Options:", ++ describe: "A list of package dependencies", ++ type: "array" ++ }, ++ "es-module": { ++ group: "Command Options:", ++ describe: "Initialize a transpiled ES Module", ++ type: "boolean" ++ }, ++ homepage: { ++ group: "Command Options:", ++ describe: "The package homepage, defaulting to a subpath of the root pkg.homepage", ++ type: "string" ++ }, ++ keywords: { ++ group: "Command Options:", ++ describe: "A list of package keywords", ++ type: "array" ++ }, ++ license: { ++ group: "Command Options:", ++ defaultDescription: "ISC", ++ describe: "The desired package license (SPDX identifier)", ++ type: "string" ++ }, ++ private: { ++ group: "Command Options:", ++ describe: "Make the new package private, never published to any external registry", ++ type: "boolean" ++ }, ++ registry: { ++ group: "Command Options:", ++ describe: "Configure the package's publishConfig.registry", ++ type: "string" ++ }, ++ tag: { ++ group: "Command Options:", ++ describe: "Configure the package's publishConfig.tag", ++ type: "string" ++ }, ++ y: { ++ group: "Command Options:", ++ describe: "Skip all prompts, accepting default values", ++ alias: "yes", ++ type: "boolean" ++ } ++ }); ++ return yargs2; ++ }, ++ handler(argv) { ++ return require_src2()(argv); ++ } ++ }; ++ module2.exports = command; ++ } ++}); ++ ++// libs/commands/diff/src/lib/get-last-commit.ts ++function getLastCommit(execOpts) { ++ if (hasTags3(execOpts)) { ++ npmlog_default.silly("getLastTagInBranch", ""); ++ return execSync("git", ["describe", "--tags", "--abbrev=0"], execOpts); ++ } ++ npmlog_default.silly("getFirstCommit", ""); ++ return execSync("git", ["rev-list", "--max-parents=0", "HEAD"], execOpts); ++} ++function hasTags3(opts) { ++ let result = false; ++ try { ++ result = !!execSync("git", ["tag"], opts); ++ } catch (err) { ++ npmlog_default.warn("ENOTAGS", "No git tags were reachable from this branch!"); ++ npmlog_default.verbose("hasTags error", err); ++ } ++ npmlog_default.verbose("hasTags", result.toString()); ++ return result; ++} ++var init_get_last_commit = __esm({ ++ "libs/commands/diff/src/lib/get-last-commit.ts"() { ++ "use strict"; ++ init_src(); ++ init_src2(); ++ } ++}); ++ ++// libs/commands/diff/src/lib/has-commit.ts ++function hasCommit(opts) { ++ npmlog_default.silly("hasCommit", ""); ++ let retVal; ++ try { ++ execSync("git", ["log"], opts); ++ retVal = true; ++ } catch (e) { ++ retVal = false; ++ } ++ npmlog_default.verbose("hasCommit", retVal.toString()); ++ return retVal; ++} ++var init_has_commit = __esm({ ++ "libs/commands/diff/src/lib/has-commit.ts"() { ++ "use strict"; ++ init_src(); ++ init_src2(); ++ } ++}); ++ ++// libs/commands/diff/src/index.ts ++var src_exports3 = {}; ++__export(src_exports3, { ++ DiffCommand: () => DiffCommand, ++ factory: () => factory2 ++}); ++function factory2(argv) { ++ return new DiffCommand(argv); ++} ++var DiffCommand; ++var init_src5 = __esm({ ++ "libs/commands/diff/src/index.ts"() { ++ "use strict"; ++ init_src2(); ++ init_get_last_commit(); ++ init_has_commit(); ++ init_src(); ++ DiffCommand = class extends Command { ++ args = []; ++ initialize() { ++ const packageName = this.options.pkgName; ++ let targetPackage; ++ if (packageName) { ++ const project = Object.values(this.projectGraph.nodes).find( ++ (p) => p.package && getPackage(p).name === packageName ++ ); ++ targetPackage = project && getPackage(project); ++ if (!targetPackage) { ++ throw new ValidationError("ENOPKG", `Cannot diff, the package '${packageName}' does not exist.`); ++ } ++ } ++ if (!hasCommit(this.execOpts)) { ++ throw new ValidationError("ENOCOMMITS", "Cannot diff, there are no commits in this repository yet."); ++ } ++ const args = ["diff", getLastCommit(this.execOpts), "--color=auto"]; ++ if (targetPackage) { ++ args.push("--", targetPackage.location); ++ } else { ++ args.push("--", ...this.project.packageParentDirs); ++ } ++ if (this.options.ignoreChanges) { ++ this.options.ignoreChanges.forEach((ignorePattern) => { ++ args.push(`:(exclude,glob)${ignorePattern}`); ++ }); ++ } ++ this.args = args; ++ } ++ execute() { ++ return spawn("git", this.args, this.execOpts).catch((err) => { ++ if (err.exitCode) { ++ throw err; ++ } ++ }); ++ } ++ }; ++ } ++}); ++ ++// libs/commands/diff/src/command.ts ++var require_command4 = __commonJS({ ++ "libs/commands/diff/src/command.ts"(exports2, module2) { ++ "use strict"; ++ var command = { ++ command: "diff [pkgName]", ++ describe: "Diff all packages or a single package since the last release", ++ builder(yargs2) { ++ return yargs2.positional("pkgName", { ++ describe: "An optional package name to filter the diff output" ++ }).options({ ++ "ignore-changes": { ++ group: "Command Options:", ++ describe: "Ignore changes in files matched by glob(s).", ++ type: "array" ++ } ++ }).epilogue( ++ "When ignoreChanges is configured in lerna.json, pass --no-ignore-changes to include ignored files." ++ ); ++ }, ++ async handler(argv) { ++ return (await Promise.resolve().then(() => (init_src5(), src_exports3))).factory(argv); ++ } ++ }; ++ module2.exports = command; ++ } ++}); ++ ++// libs/commands/exec/src/index.ts ++function factory3(argv) { ++ return new ExecCommand(argv); ++} ++var import_p_map5, childProcess14, ExecCommand; ++var init_src6 = __esm({ ++ "libs/commands/exec/src/index.ts"() { ++ "use strict"; ++ init_src2(); ++ import_p_map5 = __toESM(require("p-map")); ++ childProcess14 = (init_src(), __toCommonJS(src_exports)); ++ ExecCommand = class extends Command { ++ command; ++ args; ++ bail; ++ prefix; ++ env; ++ filteredProjects = []; ++ count; ++ packagePlural; ++ joinedCommand; ++ get requiresGit() { ++ return false; ++ } ++ async initialize() { ++ const dashedArgs = this.options["--"] || []; ++ this.command = this.options.cmd || dashedArgs.shift(); ++ this.args = (this.options.args || []).concat(dashedArgs); ++ if (!this.command) { ++ throw new ValidationError("ENOCOMMAND", "A command to execute is required"); ++ } ++ this.bail = this.options.bail !== false; ++ this.prefix = this.options.prefix !== false; ++ this.env = Object.assign({}, process.env); ++ this.filteredProjects = filterProjects(this.projectGraph, this.execOpts, this.options); ++ this.count = this.filteredProjects.length; ++ this.packagePlural = this.count === 1 ? "package" : "packages"; ++ this.joinedCommand = [this.command].concat(this.args).join(" "); ++ } ++ async execute() { ++ this.logger.info( ++ "", ++ "Executing command in %d %s: %j", ++ this.count, ++ this.packagePlural, ++ this.joinedCommand ++ ); ++ let runCommand; ++ if (this.options.parallel) { ++ runCommand = () => this.runCommandInPackagesParallel(); ++ } else if (this.toposort) { ++ runCommand = () => this.runCommandInPackagesTopological(); ++ } else { ++ runCommand = () => this.runCommandInPackagesLexical(); ++ } ++ if (this.bail) { ++ try { ++ await runCommand(); ++ } catch (err) { ++ process.exitCode = err.exitCode; ++ throw err; ++ } ++ } else { ++ const results = await runCommand(); ++ if (results.some((result) => result.failed)) { ++ const codes = results.filter((result) => result.failed).map((result) => result.exitCode); ++ const exitCode = Math.max(...codes, 1); ++ this.logger.error("", "Received non-zero exit code %d during execution", exitCode); ++ process.exitCode = exitCode; ++ } ++ } ++ this.logger.success( ++ "exec", ++ "Executed command in %d %s: %j", ++ this.count, ++ this.packagePlural, ++ this.joinedCommand ++ ); ++ } ++ getOpts(pkg2) { ++ return { ++ cwd: pkg2.location, ++ shell: true, ++ extendEnv: false, ++ env: Object.assign({}, this.env, { ++ LERNA_PACKAGE_NAME: pkg2.name, ++ LERNA_ROOT_PATH: this.project.rootPath ++ }), ++ reject: this.bail, ++ pkg: pkg2 ++ }; ++ } ++ getRunner() { ++ return this.options.stream ? (pkg2) => this.runCommandInPackageStreaming(pkg2) : (pkg2) => this.runCommandInPackageCapturing(pkg2); ++ } ++ runCommandInPackagesTopological() { ++ let profiler; ++ let runner; ++ if (this.options.profile) { ++ profiler = new Profiler({ ++ concurrency: this.concurrency, ++ log: this.logger, ++ outputDirectory: this.options.profileLocation || this.project.rootPath ++ }); ++ const callback = this.getRunner(); ++ runner = (pkg2) => profiler.run(() => callback(pkg2), pkg2.name); ++ } else { ++ runner = this.getRunner(); ++ } ++ let chain = runProjectsTopologically( ++ this.filteredProjects, ++ this.projectGraph, ++ (p) => runner(getPackage(p)), ++ { ++ concurrency: this.concurrency, ++ rejectCycles: this.options.rejectCycles ++ } ++ ); ++ if (profiler) { ++ chain = chain.then((results) => profiler.output().then(() => results)); ++ } ++ return chain; ++ } ++ runCommandInPackagesParallel() { ++ return (0, import_p_map5.default)(this.filteredProjects, (p) => this.runCommandInPackageStreaming(getPackage(p))); ++ } ++ runCommandInPackagesLexical() { ++ return (0, import_p_map5.default)(this.filteredProjects, (p) => this.getRunner()(getPackage(p)), { ++ concurrency: this.concurrency ++ }); ++ } ++ runCommandInPackageStreaming(pkg2) { ++ return childProcess14.spawnStreaming(this.command, this.args, this.getOpts(pkg2), this.prefix && pkg2.name); ++ } ++ runCommandInPackageCapturing(pkg2) { ++ return childProcess14.spawn(this.command, this.args, this.getOpts(pkg2)); ++ } ++ }; ++ } ++}); ++ ++// libs/commands/exec/src/command.ts ++var require_command5 = __commonJS({ ++ "libs/commands/exec/src/command.ts"(exports2, module2) { ++ "use strict"; ++ init_src2(); ++ init_src6(); ++ var command = { ++ command: "exec [cmd] [args..]", ++ describe: "Execute an arbitrary command in each package", ++ builder(yargs2) { ++ yargs2.example("$0 exec ls -- --la", "# execute `ls -la` in all packages").example("$0 exec -- ls --la", "# execute `ls -la` in all packages, keeping cmd outside").parserConfiguration({ ++ "populate--": true ++ }).positional("cmd", { ++ describe: "The command to execute. Any command flags must be passed after --", ++ type: "string" ++ }).positional("args", { ++ describe: "Positional arguments (not recognized by lerna) to send to command", ++ type: "string" ++ }).options({ ++ stream: { ++ group: "Command Options:", ++ describe: "Stream output with lines prefixed by originating package name.", ++ type: "boolean" ++ }, ++ parallel: { ++ group: "Command Options:", ++ describe: "Execute command with unlimited concurrency, streaming prefixed output.", ++ type: "boolean" ++ }, ++ "no-bail": { ++ group: "Command Options:", ++ describe: "Continue executing command despite non-zero exit in a given package.", ++ type: "boolean" ++ }, ++ bail: { ++ // proxy for --no-bail ++ hidden: true, ++ type: "boolean" ++ }, ++ // This option controls prefix for stream output so that it can be disabled to be friendly ++ // to tools like Visual Studio Code to highlight the raw results ++ "no-prefix": { ++ group: "Command Options:", ++ describe: "Do not prefix streaming output.", ++ type: "boolean" ++ }, ++ prefix: { ++ // proxy for --no-prefix ++ hidden: true, ++ type: "boolean" ++ }, ++ profile: { ++ group: "Command Options:", ++ describe: "Profile command executions and output performance profile to default location.", ++ type: "boolean" ++ }, ++ "profile-location": { ++ group: "Command Options:", ++ describe: "Output performance profile to custom location instead of default project root.", ++ type: "string" ++ } ++ }); ++ return filterOptions(yargs2); ++ }, ++ async handler(argv) { ++ return factory3(argv); ++ } ++ }; ++ module2.exports = command; ++ } ++}); ++ ++// libs/commands/import/src/index.ts ++var src_exports4 = {}; ++__export(src_exports4, { ++ ImportCommand: () => ImportCommand, ++ factory: () => factory4 ++}); ++function factory4(argv) { ++ return new ImportCommand(argv); ++} ++var import_dedent6, import_fs_extra12, import_p_map_series2, import_path21, childProcess15, ImportCommand; ++var init_src7 = __esm({ ++ "libs/commands/import/src/index.ts"() { ++ "use strict"; ++ init_src2(); ++ import_dedent6 = __toESM(require("dedent")); ++ import_fs_extra12 = __toESM(require("fs-extra")); ++ import_p_map_series2 = __toESM(require("p-map-series")); ++ import_path21 = __toESM(require("path")); ++ childProcess15 = (init_src(), __toCommonJS(src_exports)); ++ ImportCommand = class extends Command { ++ externalExecOpts = { cwd: "" }; ++ targetDirRelativeToGitRoot; ++ commits = []; ++ origGitEmail; ++ origGitName; ++ preImportHead; ++ gitParamsForTargetCommits() { ++ const params = ["log", "--format=%h"]; ++ if (this.options.flatten) { ++ params.push("--first-parent"); ++ } ++ return params; ++ } ++ initialize() { ++ const inputPath = this.options.dir; ++ const externalRepoPath = import_path21.default.resolve(inputPath ?? ""); ++ const externalRepoBase = import_path21.default.basename(externalRepoPath); ++ this.externalExecOpts = Object.assign({}, this.execOpts, { ++ cwd: externalRepoPath ++ }); ++ let stats; ++ try { ++ stats = import_fs_extra12.default.statSync(externalRepoPath); ++ } catch (e) { ++ if (e.code === "ENOENT") { ++ throw new ValidationError("ENOENT", `No repository found at "${inputPath}"`); ++ } ++ throw e; ++ } ++ if (!stats.isDirectory()) { ++ throw new ValidationError("ENODIR", `Input path "${inputPath}" is not a directory`); ++ } ++ const packageJson = import_path21.default.join(externalRepoPath, "package.json"); ++ const packageName = require(packageJson).name; ++ if (!packageName) { ++ throw new ValidationError("ENOPKG", `No package name specified in "${packageJson}"`); ++ } ++ const targetBase = this.getTargetBase(); ++ if (this.getPackageDirectories().indexOf(targetBase) === -1) { ++ throw new ValidationError( ++ "EDESTDIR", ++ `--dest does not match with the package directories: ${this.getPackageDirectories()}` ++ ); ++ } ++ const targetDir = import_path21.default.join(targetBase, externalRepoBase); ++ const gitRepoRoot = this.getWorkspaceRoot(); ++ const lernaRootRelativeToGitRoot = import_path21.default.relative(gitRepoRoot, this.project.rootPath); ++ this.targetDirRelativeToGitRoot = import_path21.default.join(lernaRootRelativeToGitRoot, targetDir); ++ if (this.targetDirRelativeToGitRoot.startsWith("..")) { ++ throw new ValidationError( ++ "ENOTINREPO", ++ `Project root ${this.project.rootPath} is not a subdirectory of git root ${gitRepoRoot}` ++ ); ++ } ++ if (import_fs_extra12.default.existsSync(import_path21.default.resolve(this.project.rootPath, targetDir))) { ++ throw new ValidationError("EEXISTS", `Target directory already exists "${targetDir}"`); ++ } ++ this.commits = this.externalExecSync("git", this.gitParamsForTargetCommits()).split("\n").reverse(); ++ if (!this.commits.length) { ++ throw new ValidationError("NOCOMMITS", `No git commits to import at "${inputPath}"`); ++ } ++ if (this.options.preserveCommit) { ++ this.origGitEmail = this.execSync("git", ["config", "user.email"]); ++ this.origGitName = this.execSync("git", ["config", "user.name"]); ++ } ++ this.preImportHead = this.getCurrentSHA(); ++ if (this.execSync("git", ["diff-index", "HEAD"])) { ++ throw new ValidationError("ECHANGES", "Local repository has un-committed changes"); ++ } ++ this.logger.info( ++ "", ++ `About to import ${this.commits.length} commits from ${inputPath} into ${targetDir}` ++ ); ++ if (this.options.yes) { ++ return true; ++ } ++ return promptConfirmation("Are you sure you want to import these commits onto the current branch?"); ++ } ++ getPackageDirectories() { ++ return this.project.packageConfigs.filter((p) => p.endsWith("*")).map((p) => import_path21.default.dirname(p)); ++ } ++ getTargetBase() { ++ if (this.options.dest) { ++ return this.options.dest; ++ } ++ return this.getPackageDirectories().shift() || "packages"; ++ } ++ getCurrentSHA() { ++ return this.execSync("git", ["rev-parse", "HEAD"]); ++ } ++ getWorkspaceRoot() { ++ return this.execSync("git", ["rev-parse", "--show-toplevel"]); ++ } ++ execSync(cmd, args) { ++ return childProcess15.execSync(cmd, args, this.execOpts); ++ } ++ externalExecSync(cmd, args) { ++ return childProcess15.execSync(cmd, args, this.externalExecOpts); ++ } ++ createPatchForCommit(sha) { ++ let patch = null; ++ if (this.options.flatten) { ++ const diff = this.externalExecSync("git", [ ++ "log", ++ "--reverse", ++ "--first-parent", ++ "-p", ++ "-m", ++ "--pretty=email", ++ "--stat", ++ "--binary", ++ "-1", ++ "--color=never", ++ sha, ++ // custom git prefixes for accurate parsing of filepaths (#1655) ++ `--src-prefix=COMPARE_A/`, ++ `--dst-prefix=COMPARE_B/` ++ ]); ++ const version = this.externalExecSync("git", ["--version"]).replace(/git version /g, ""); ++ patch = `${diff} ++-- ++${version}`; ++ } else { ++ patch = this.externalExecSync("git", [ ++ "format-patch", ++ "-1", ++ sha, ++ "--stdout", ++ // custom git prefixes for accurate parsing of filepaths (#1655) ++ `--src-prefix=COMPARE_A/`, ++ `--dst-prefix=COMPARE_B/` ++ ]); ++ } ++ const formattedTarget = this.targetDirRelativeToGitRoot?.replace(/\\/g, "/"); ++ const replacement = `$1/${formattedTarget}`; ++ return patch.replace(/^([-+]{3} "?COMPARE_[AB])/gm, replacement).replace(/^(diff --git "?COMPARE_A)/gm, replacement).replace(/^(diff --git (?! "?COMPARE_B\/).+ "?COMPARE_B)/gm, replacement).replace(/^(copy (from|to)) ("?)/gm, `$1 $3${formattedTarget}/`).replace(/^(rename (from|to)) ("?)/gm, `$1 $3${formattedTarget}/`); ++ } ++ getGitUserFromSha(sha) { ++ return { ++ email: this.externalExecSync("git", ["show", "-s", "--format='%ae'", sha]), ++ name: this.externalExecSync("git", ["show", "-s", "--format='%an'", sha]) ++ }; ++ } ++ configureGitUser({ email, name }) { ++ this.execSync("git", ["config", "user.email", `"${email}"`]); ++ this.execSync("git", ["config", "user.name", `"${name}"`]); ++ } ++ execute() { ++ this.enableProgressBar(); ++ const tracker = this.logger["newItem"]("execute"); ++ const mapper = (sha) => { ++ tracker.info(sha); ++ const patch = this.createPatchForCommit(sha); ++ const procArgs = ["am", "-3", "--keep-non-patch"]; ++ if (this.options.preserveCommit) { ++ this.configureGitUser(this.getGitUserFromSha(sha)); ++ procArgs.push("--committer-date-is-author-date"); ++ } ++ const proc = childProcess15.exec("git", procArgs, this.execOpts); ++ proc.stdin.end(patch); ++ return pulseTillDone(proc).then(() => { ++ tracker.completeWork(1); ++ }).catch((err) => { ++ const diff = this.externalExecSync("git", ["diff", "-s", `${sha}^!`]).trim(); ++ if (diff === "") { ++ tracker.completeWork(1); ++ return childProcess15.exec("git", ["am", "--skip"], this.execOpts); ++ } ++ err.sha = sha; ++ throw err; ++ }); ++ }; ++ tracker.addWork(this.commits.length); ++ return (0, import_p_map_series2.default)(this.commits, mapper).then(() => { ++ tracker.finish(); ++ if (this.options.preserveCommit) { ++ this.configureGitUser({ ++ email: this.origGitEmail, ++ name: this.origGitName ++ }); ++ } ++ this.logger.success("import", "finished"); ++ }).catch((err) => { ++ tracker.finish(); ++ if (this.options.preserveCommit) { ++ this.configureGitUser({ ++ email: this.origGitEmail, ++ name: this.origGitName ++ }); ++ } ++ this.logger.error("import", `Rolling back to previous HEAD (commit ${this.preImportHead})`); ++ this.execSync("git", ["am", "--abort"]); ++ if (this.preImportHead) { ++ this.execSync("git", ["reset", "--hard", this.preImportHead]); ++ } ++ throw new ValidationError( ++ "EIMPORT", ++ import_dedent6.default` ++ Failed to apply commit ${err.sha}. ++ ${err.message} ++ ++ You may try again with --flatten to import flat history. ++ ` ++ ); ++ }); ++ } ++ }; ++ } ++}); ++ ++// libs/commands/import/src/command.ts ++var require_command6 = __commonJS({ ++ "libs/commands/import/src/command.ts"(exports2, module2) { ++ "use strict"; ++ var command = { ++ command: "import ", ++ describe: "Import a package into the monorepo with commit history", ++ builder(yargs2) { ++ return yargs2.positional("dir", { describe: "The path to an external git repository that contains an npm package" }).options({ ++ flatten: { ++ group: "Command Options:", ++ describe: "Import each merge commit as a single change the merge introduced", ++ type: "boolean" ++ }, ++ dest: { ++ group: "Command Options:", ++ describe: "Import destination directory for the external git repository", ++ type: "string" ++ }, ++ "preserve-commit": { ++ group: "Command Options:", ++ describe: "Preserve original committer in addition to original author", ++ type: "boolean" ++ }, ++ y: { ++ group: "Command Options:", ++ describe: "Skip all confirmation prompts", ++ alias: "yes", ++ type: "boolean" ++ } ++ }); ++ }, ++ async handler(argv) { ++ return (await Promise.resolve().then(() => (init_src7(), src_exports4))).factory(argv); ++ } ++ }; ++ module2.exports = command; ++ } ++}); ++ ++// libs/commands/info/src/index.ts ++var src_exports5 = {}; ++__export(src_exports5, { ++ InfoCommand: () => InfoCommand, ++ factory: () => factory5 ++}); ++function factory5(argv) { ++ return new InfoCommand(argv); ++} ++var import_envinfo, InfoCommand; ++var init_src8 = __esm({ ++ "libs/commands/info/src/index.ts"() { ++ "use strict"; ++ init_src2(); ++ import_envinfo = __toESM(require("envinfo")); ++ InfoCommand = class extends Command { ++ initialize() { ++ } ++ execute() { ++ output("\n Environment info:"); ++ import_envinfo.default.run({ ++ System: ["OS", "CPU"], ++ Binaries: ["Node", "Yarn", "npm"], ++ Utilities: ["Git"], ++ npmPackages: ["lerna"] ++ }).then(output); ++ } ++ }; ++ } ++}); ++ ++// libs/commands/info/src/command.ts ++var require_command7 = __commonJS({ ++ "libs/commands/info/src/command.ts"(exports2, module2) { ++ "use strict"; ++ var command = { ++ command: "info", ++ describe: "Prints debugging information about the local environment", ++ async handler(argv) { ++ return (await Promise.resolve().then(() => (init_src8(), src_exports5))).factory(argv); ++ } ++ }; ++ module2.exports = command; ++ } ++}); ++ ++// libs/commands/init/src/index.ts ++var src_exports6 = {}; ++__export(src_exports6, { ++ InitCommand: () => InitCommand, ++ factory: () => factory6 ++}); ++function factory6(args) { ++ return new InitCommand(args); ++} ++var import_devkit5, import_fs6, import_fs_extra13, import_tree, LARGE_BUFFER, childProcess16, PACKAGE_GLOB, InitCommand; ++var init_src9 = __esm({ ++ "libs/commands/init/src/index.ts"() { ++ "use strict"; ++ init_src2(); ++ import_devkit5 = require("@nx/devkit"); ++ import_fs6 = require("fs"); ++ import_fs_extra13 = require("fs-extra"); ++ import_tree = require("nx/src/generators/tree"); ++ LARGE_BUFFER = 1024 * 1e6; ++ childProcess16 = (init_src(), __toCommonJS(src_exports)); ++ PACKAGE_GLOB = "packages/*"; ++ InitCommand = class { ++ constructor(args) { ++ this.args = args; ++ npmlog_default.heading = "lerna"; ++ this.logger = Command.createLogger(this.name, args.loglevel); ++ this.logger.notice("cli", `v${this.args.lernaVersion}`); ++ this.packageManager = this.detectPackageManager() || this.detectInvokedPackageManager() || "npm"; ++ this.runner = this.execute(); ++ } ++ name = "init"; ++ logger; ++ cwd = process.cwd(); ++ packageManager; ++ runner; ++ async execute() { ++ const tree = new import_tree.FsTree(this.cwd, false); ++ const task = await this.generate(tree); ++ const changes = tree.listChanges(); ++ if (!changes.length) { ++ return; ++ } ++ const isDryRun = this.args.dryRun; ++ const { default: chalk5 } = await import("chalk"); ++ const { diff } = await import("jest-diff"); ++ function printDiff(before, after) { ++ console.error( ++ diff(before, after, { ++ omitAnnotationLines: true, ++ contextLines: 1, ++ expand: false, ++ aColor: chalk5.red, ++ bColor: chalk5.green, ++ patchColor: () => "" ++ }) ++ ); ++ } ++ if (isDryRun) { ++ this.logger.info("", "The following file system updates will be made:"); ++ } else { ++ this.logger.info("", "Applying the following file system updates:"); ++ } ++ const indent = ""; ++ changes.forEach((f) => { ++ if (f.type === "CREATE") { ++ console.error( ++ `${indent}${chalk5.green("CREATE")} ${f.path}${isDryRun ? chalk5.yellow(" [preview]") : ""}` ++ ); ++ if (isDryRun) { ++ printDiff("", f.content?.toString() || ""); ++ } ++ } else if (f.type === "UPDATE") { ++ console.error( ++ `${indent}${chalk5.white("UPDATE")} ${f.path}${isDryRun ? chalk5.yellow(" [preview]") : ""}` ++ ); ++ if (isDryRun) { ++ const currentContentsOnDisk = (0, import_fs_extra13.readFileSync)((0, import_devkit5.joinPathFragments)(tree.root, f.path)).toString(); ++ printDiff(currentContentsOnDisk, f.content?.toString() || ""); ++ } ++ } else if (f.type === "DELETE") { ++ console.error(`${indent}${chalk5.yellow("DELETE")} ${f.path}`); ++ } ++ }); ++ if (!isDryRun) { ++ (0, import_tree.flushChanges)(this.cwd, changes); ++ if (task) { ++ await task(); ++ } ++ this.logger.success("", "Initialized Lerna files"); ++ this.logger.info("", "New to Lerna? Check out the docs: https://lerna.js.org/docs/getting-started"); ++ } else { ++ this.logger.warn("", `The "dryRun" flag means no changes were made.`); ++ } ++ } ++ // proxy "Promise" methods to "private" instance ++ then(onResolved, onRejected) { ++ return this.runner.then(onResolved, onRejected); ++ } ++ /* istanbul ignore next */ ++ catch(onRejected) { ++ return this.runner.catch(onRejected); ++ } ++ async generate(tree) { ++ const defaultLernaJson = { ++ $schema: "node_modules/lerna/schemas/lerna-schema.json", ++ version: this.args.independent === true ? "independent" : "0.0.0" ++ }; ++ if (tree.exists("lerna.json")) { ++ this.logger.error("", "Lerna has already been initialized for this repo."); ++ this.logger.error( ++ "", ++ "If you are looking to ensure that your config is up to date with the latest and greatest, run `lerna repair` instead" ++ ); ++ return; ++ } ++ const lernaJson = defaultLernaJson; ++ if (this.args.packages) { ++ lernaJson.packages = this.args.packages; ++ } ++ if (this.packageManager !== "npm") { ++ lernaJson.npmClient = this.packageManager; ++ } ++ if (!tree.exists("package.json")) { ++ (0, import_devkit5.writeJson)(tree, "lerna.json", lernaJson); ++ const basePackageJson = { ++ name: "root", ++ private: true ++ }; ++ if (this.packageManager === "pnpm") { ++ (0, import_devkit5.writeJson)(tree, "package.json", basePackageJson); ++ if (!tree.exists("pnpm-workspace.yaml")) { ++ tree.write("pnpm-workspace.yaml", `packages: ++ - '${PACKAGE_GLOB}' ++`); ++ } ++ } else { ++ (0, import_devkit5.writeJson)(tree, "package.json", { ++ ...basePackageJson, ++ workspaces: [PACKAGE_GLOB] ++ }); ++ } ++ } else { ++ if (this.args.packages || this.#hasWorkspacesConfigured(tree)) { ++ (0, import_devkit5.writeJson)(tree, "lerna.json", lernaJson); ++ } else { ++ this.logger.error( ++ "", ++ "Cannot initialize lerna because your package manager has not been configured to use `workspaces`, and you have not explicitly specified any packages to operate on" ++ ); ++ this.logger.error( ++ "", ++ "See https://lerna.js.org/docs/getting-started#adding-lerna-to-an-existing-repo for how to resolve this" ++ ); ++ return; ++ } ++ } ++ (0, import_devkit5.addDependenciesToPackageJson)( ++ tree, ++ {}, ++ { lerna: this.args.exact ? this.args.lernaVersion : `^${this.args.lernaVersion}` } ++ ); ++ if (!tree.exists(".gitignore")) { ++ tree.write(".gitignore", "node_modules/"); ++ } ++ return async () => { ++ if (isGitInitialized(this.cwd)) { ++ this.logger.info("", "Git is already initialized"); ++ } else { ++ this.logger.info("", "Initializing Git repository"); ++ await childProcess16.exec("git", ["init"], { ++ cwd: this.cwd, ++ maxBuffer: 1024 ++ }); ++ } ++ if (this.args.skipInstall === void 0) { ++ this.logger.info("", `Using ${this.packageManager} to install packages`); ++ const packageManagerCommand = (0, import_devkit5.getPackageManagerCommand)(this.packageManager); ++ const [command, ...args] = packageManagerCommand.install.split(" "); ++ await childProcess16.exec(command, args, { ++ cwd: this.cwd, ++ maxBuffer: LARGE_BUFFER ++ }); ++ } ++ }; ++ } ++ #hasWorkspacesConfigured(tree) { ++ const packageJson = (0, import_devkit5.readJson)(tree, "package.json"); ++ return Array.isArray(packageJson.workspaces) || tree.exists("pnpm-workspace.yaml"); ++ } ++ detectPackageManager() { ++ const packageManager = (0, import_fs6.existsSync)("yarn.lock") ? "yarn" : (0, import_fs6.existsSync)("pnpm-lock.yaml") ? "pnpm" : (0, import_fs6.existsSync)("package-lock.json") ? "npm" : null; ++ if (packageManager) { ++ this.logger.verbose("", `Detected lock file for ${packageManager}`); ++ } ++ return packageManager; ++ } ++ /** ++ * Detects which package manager was used to invoke lerna init command ++ * based on the main Module process that invokes the command ++ * - npx returns 'npm' ++ * - pnpx returns 'pnpm' ++ * - yarn create returns 'yarn' ++ */ ++ detectInvokedPackageManager() { ++ let detectedPackageManager = null; ++ const invoker = require.main || process["mainModule"]; ++ if (!invoker) { ++ this.logger.verbose("", "Could not detect package manager from process"); ++ return detectedPackageManager; ++ } ++ for (const pkgManager of ["pnpm", "yarn", "npm"]) { ++ if (invoker.path.includes(pkgManager)) { ++ this.logger.verbose("", `Detected package manager ${pkgManager} from process`); ++ detectedPackageManager = pkgManager; ++ break; ++ } ++ } ++ return detectedPackageManager; ++ } ++ }; ++ } ++}); ++ ++// libs/commands/init/src/command.ts ++var require_command8 = __commonJS({ ++ "libs/commands/init/src/command.ts"(exports2, module2) { ++ "use strict"; ++ var command = { ++ command: "init", ++ describe: "Create a new Lerna repo or upgrade an existing repo to the current version of Lerna", ++ builder: { ++ exact: { ++ describe: "Specify lerna dependency version in package.json without a caret (^)", ++ type: "boolean" ++ }, ++ independent: { ++ describe: "Version packages independently", ++ alias: "i", ++ type: "boolean" ++ }, ++ packages: { ++ describe: "A glob pattern matching packages that should be included (instead of defaulting to the package manager's workspaces config)", ++ type: "array" ++ }, ++ dryRun: { ++ describe: "Preview the changes that will be made to the file system without actually modifying anything", ++ type: "boolean", ++ default: false ++ }, ++ skipInstall: { ++ describe: "Skip installation of dependencies after initialization", ++ type: "boolean" ++ } ++ }, ++ async handler(argv) { ++ return (await Promise.resolve().then(() => (init_src9(), src_exports6))).factory(argv); ++ } ++ }; ++ module2.exports = command; ++ } ++}); ++ ++// libs/commands/list/src/index.ts ++var src_exports7 = {}; ++__export(src_exports7, { ++ ListCommand: () => ListCommand, ++ factory: () => factory7 ++}); ++function factory7(argv) { ++ return new ListCommand(argv); ++} ++var ListCommand; ++var init_src10 = __esm({ ++ "libs/commands/list/src/index.ts"() { ++ "use strict"; ++ init_src2(); ++ ListCommand = class extends Command { ++ result; ++ get requiresGit() { ++ return false; ++ } ++ async initialize() { ++ const filteredProjects = filterProjects(this.projectGraph, this.execOpts, this.options); ++ this.result = listableFormatProjects(filteredProjects, this.projectGraph, this.options); ++ } ++ execute() { ++ if (this.result?.text.length) { ++ output(this.result.text); ++ } ++ this.logger.success( ++ "found", ++ "%d %s", ++ this.result?.count, ++ this.result?.count === 1 ? "package" : "packages" ++ ); ++ process.stdout.end(() => process.exit(0)); ++ } ++ }; ++ } ++}); ++ ++// libs/commands/list/src/command.ts ++var require_command9 = __commonJS({ ++ "libs/commands/list/src/command.ts"(exports2, module2) { ++ "use strict"; ++ init_src2(); ++ var command = { ++ command: "list", ++ aliases: ["ls", "la", "ll"], ++ describe: "List local packages", ++ builder(yargs2) { ++ listableOptions(yargs2); ++ return filterOptions(yargs2); ++ }, ++ async handler(argv) { ++ return (await Promise.resolve().then(() => (init_src10(), src_exports7))).factory(argv); ++ } ++ }; ++ module2.exports = command; ++ } ++}); ++ ++// libs/commands/version/src/lib/create-release.ts ++function truncateReleaseBody(body, type) { ++ let maxReleaseBodyLength; ++ switch (type) { ++ case "gitlab": ++ maxReleaseBodyLength = 1e6; ++ break; ++ case "github": ++ maxReleaseBodyLength = 125e3; ++ break; ++ default: ++ return body; ++ } ++ if (body.length > maxReleaseBodyLength) { ++ const ellipsis = "..."; ++ return body.slice(0, maxReleaseBodyLength - ellipsis.length) + ellipsis; ++ } ++ return body; ++} ++function createReleaseClient(type) { ++ switch (type) { ++ case "gitlab": ++ return createGitLabClient(); ++ case "github": ++ return createGitHubClient(); ++ /* istanbul ignore next: guarded by yargs.choices() */ ++ default: ++ throw new ValidationError("ERELEASE", "Invalid release client type"); ++ } ++} ++function createRelease(client, { ++ type, ++ tags, ++ releaseNotes, ++ tagVersionSeparator ++}, { gitRemote, execOpts }) { ++ const repo = parseGitRepo(gitRemote, execOpts); ++ return Promise.all( ++ releaseNotes.map(({ notes, name }) => { ++ const tag = name === "fixed" ? tags[0] : tags.find((t) => t.startsWith(`${name}${tagVersionSeparator}`)); ++ if (!tag) { ++ return Promise.resolve(); ++ } ++ const prereleaseParts = import_semver6.default.prerelease(tag.replace(`${name}${tagVersionSeparator}`, "")) || []; ++ const body = truncateReleaseBody(notes, type); ++ return client.repos.createRelease({ ++ owner: repo.owner, ++ repo: repo.name, ++ tag_name: tag, ++ name: tag, ++ body, ++ draft: false, ++ prerelease: prereleaseParts.length > 0 ++ }); ++ }) ++ ); ++} ++var import_semver6; ++var init_create_release = __esm({ ++ "libs/commands/version/src/lib/create-release.ts"() { ++ "use strict"; ++ init_src2(); ++ import_semver6 = __toESM(require("semver")); ++ } ++}); ++ ++// libs/commands/version/src/lib/get-current-branch.ts ++function getCurrentBranch(opts) { ++ npmlog_default.silly("getCurrentBranch"); ++ const branch = childProcess17.execSync("git", ["rev-parse", "--abbrev-ref", "HEAD"], opts); ++ npmlog_default.verbose("currentBranch", branch); ++ return branch; ++} ++var childProcess17; ++var init_get_current_branch = __esm({ ++ "libs/commands/version/src/lib/get-current-branch.ts"() { ++ "use strict"; ++ init_src2(); ++ childProcess17 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/commands/version/src/lib/git-add.ts ++function resolvePrettier() { ++ if (!resolvedPrettier) { ++ try { ++ const packageJson = (0, import_devkit6.readJsonFile)(import_path22.default.join(import_devkit6.workspaceRoot, "package.json")); ++ const hasPrettier = packageJson.devDependencies?.prettier || packageJson.dependencies?.prettier; ++ if (!hasPrettier) { ++ return; ++ } ++ resolvedPrettier = require("prettier"); ++ } catch { ++ return; ++ } ++ } ++ return resolvedPrettier; ++} ++async function maybeFormatFile(filePath) { ++ const prettier = resolvePrettier(); ++ if (!prettier) { ++ return; ++ } ++ const config = await resolvedPrettier.resolveConfig(filePath); ++ const ignorePath = import_path22.default.join(import_devkit6.workspaceRoot, ".prettierignore"); ++ const fullFilePath = import_path22.default.join(import_devkit6.workspaceRoot, filePath); ++ const fileInfo = await resolvedPrettier.getFileInfo(fullFilePath, { ignorePath }); ++ if (fileInfo.ignored) { ++ npmlog_default.silly("version", `Skipped applying prettier to ignored file: ${filePath}`); ++ return; ++ } ++ try { ++ const input = import_fs7.default.readFileSync(fullFilePath, "utf8"); ++ import_fs7.default.writeFileSync( ++ fullFilePath, ++ await resolvedPrettier.format(input, { ...config, filepath: fullFilePath }), ++ "utf8" ++ ); ++ npmlog_default.silly("version", `Successfully applied prettier to updated file: ${filePath}`); ++ } catch { ++ npmlog_default.silly("version", `Failed to apply prettier to updated file: ${filePath}`); ++ } ++} ++async function gitAdd(changedFiles, gitOpts, execOpts) { ++ let files = []; ++ for (const file of changedFiles) { ++ const filePath = (0, import_slash3.default)(import_path22.default.relative(execOpts.cwd, import_path22.default.resolve(execOpts.cwd, file))); ++ await maybeFormatFile(filePath); ++ if (gitOpts.granularPathspec) { ++ files.push(filePath); ++ } ++ } ++ if (!gitOpts.granularPathspec) { ++ files = "."; ++ } ++ npmlog_default.silly("gitAdd", files); ++ return childProcess18.exec("git", ["add", "--", ...files], execOpts); ++} ++var import_devkit6, import_fs7, import_path22, import_slash3, childProcess18, resolvedPrettier; ++var init_git_add = __esm({ ++ "libs/commands/version/src/lib/git-add.ts"() { ++ "use strict"; ++ init_src2(); ++ import_devkit6 = require("@nx/devkit"); ++ import_fs7 = __toESM(require("fs")); ++ import_path22 = __toESM(require("path")); ++ import_slash3 = __toESM(require("slash")); ++ childProcess18 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/commands/version/src/lib/git-commit.ts ++function gitCommit(message, { amend, commitHooks, signGitCommit, signoffGitCommit, overrideMessage }, opts) { ++ npmlog_default.silly("gitCommit", message); ++ const args = ["commit"]; ++ if (commitHooks === false) { ++ args.push("--no-verify"); ++ } ++ if (signGitCommit) { ++ args.push("--gpg-sign"); ++ } ++ if (signoffGitCommit) { ++ args.push("--signoff"); ++ } ++ const shouldChangeMessage = amend ? amend && overrideMessage : true; ++ if (amend) { ++ args.push("--amend"); ++ } ++ if (shouldChangeMessage) { ++ if (message.indexOf(import_os5.EOL) > -1) { ++ args.push("-F", temp_write_default.sync(message, "lerna-commit.txt")); ++ } else { ++ args.push("-m", message); ++ } ++ } else { ++ args.push("--no-edit"); ++ } ++ npmlog_default.verbose("git", args); ++ return childProcess19.exec("git", args, opts); ++} ++var import_os5, childProcess19; ++var init_git_commit = __esm({ ++ "libs/commands/version/src/lib/git-commit.ts"() { ++ "use strict"; ++ init_src2(); ++ import_os5 = require("os"); ++ childProcess19 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/commands/version/src/lib/git-push.ts ++function gitPush(remote, branch, opts) { ++ npmlog_default.silly("gitPush", remote, branch); ++ return childProcess20.exec("git", ["push", "--follow-tags", "--no-verify", "--atomic", remote, branch], opts).catch((error) => { ++ if (/atomic/.test(error.stderr) || process.env.GIT_REDIRECT_STDERR === "2>&1" && /atomic/.test(error.stdout)) { ++ npmlog_default.warn("gitPush", error.stderr); ++ npmlog_default.info("gitPush", "--atomic failed, attempting non-atomic push"); ++ return childProcess20.exec("git", ["push", "--follow-tags", "--no-verify", remote, branch], opts); ++ } ++ throw error; ++ }); ++} ++var childProcess20; ++var init_git_push = __esm({ ++ "libs/commands/version/src/lib/git-push.ts"() { ++ "use strict"; ++ init_src2(); ++ childProcess20 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/commands/version/src/lib/git-tag.ts ++function gitTag(tag, { forceGitTag, signGitTag }, opts, command = "git tag %s -m %s") { ++ npmlog_default.silly("gitTag", tag, command); ++ const [cmd, ...args] = command.split(" "); ++ const interpolatedArgs = args.map((arg) => arg.replace(/%s/, tag)); ++ if (forceGitTag) { ++ interpolatedArgs.push("--force"); ++ } ++ if (signGitTag) { ++ interpolatedArgs.push("--sign"); ++ } ++ npmlog_default.verbose(cmd, interpolatedArgs); ++ return childProcess21.exec(cmd, interpolatedArgs, opts); ++} ++var childProcess21; ++var init_git_tag = __esm({ ++ "libs/commands/version/src/lib/git-tag.ts"() { ++ "use strict"; ++ init_src2(); ++ childProcess21 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/commands/version/src/lib/is-anything-committed.ts ++function isAnythingCommitted(opts) { ++ npmlog_default.silly("isAnythingCommitted", ""); ++ const anyCommits = childProcess22.execSync("git", ["rev-list", "--count", "--all", "--max-count=1"], opts); ++ npmlog_default.verbose("isAnythingCommitted", anyCommits); ++ return Boolean(parseInt(anyCommits, 10)); ++} ++var childProcess22; ++var init_is_anything_committed = __esm({ ++ "libs/commands/version/src/lib/is-anything-committed.ts"() { ++ "use strict"; ++ init_src2(); ++ childProcess22 = (init_src(), __toCommonJS(src_exports)); ++ module.exports.isAnythingCommitted = isAnythingCommitted; ++ } ++}); ++ ++// libs/commands/version/src/lib/is-behind-upstream.ts ++function isBehindUpstream(gitRemote, branch, opts) { ++ npmlog_default.silly("isBehindUpstream", ""); ++ updateRemote(opts); ++ const remoteBranch = `${gitRemote}/${branch}`; ++ const [behind, ahead] = countLeftRight(`${remoteBranch}...${branch}`, opts); ++ npmlog_default.silly( ++ "isBehindUpstream", ++ `${branch} is behind ${remoteBranch} by ${behind} commit(s) and ahead by ${ahead}` ++ ); ++ return Boolean(behind); ++} ++function updateRemote(opts) { ++ childProcess23.execSync("git", ["remote", "update"], opts); ++} ++function countLeftRight(symmetricDifference, opts) { ++ const stdout = childProcess23.execSync( ++ "git", ++ ["rev-list", "--left-right", "--count", symmetricDifference], ++ opts ++ ); ++ return stdout.split(" ").map((val) => parseInt(val, 10)); ++} ++var childProcess23; ++var init_is_behind_upstream = __esm({ ++ "libs/commands/version/src/lib/is-behind-upstream.ts"() { ++ "use strict"; ++ init_src2(); ++ childProcess23 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/commands/version/src/lib/is-breaking-change.ts ++function isBreakingChange(currentVersion, nextVersion) { ++ const releaseType = import_semver7.default.diff(currentVersion, nextVersion); ++ let breaking; ++ if (releaseType === "major") { ++ breaking = true; ++ } else if (releaseType === "minor") { ++ breaking = import_semver7.default.lt(currentVersion, "1.0.0"); ++ } else if (releaseType === "patch") { ++ breaking = import_semver7.default.lt(currentVersion, "0.1.0"); ++ } else { ++ breaking = false; ++ } ++ return breaking; ++} ++var import_semver7; ++var init_is_breaking_change = __esm({ ++ "libs/commands/version/src/lib/is-breaking-change.ts"() { ++ "use strict"; ++ import_semver7 = __toESM(require("semver")); ++ } ++}); ++ ++// libs/commands/version/src/lib/prompt-version.ts ++function makePromptVersion(resolvePrereleaseId, buildMetadata) { ++ return (node) => promptVersion(node.version, node.name, resolvePrereleaseId(node.prereleaseId), buildMetadata); ++} ++function promptVersion(currentVersion, name, prereleaseId, buildMetadata) { ++ const patch = applyBuildMetadata(import_semver8.default.inc(currentVersion, "patch"), buildMetadata); ++ const minor = applyBuildMetadata(import_semver8.default.inc(currentVersion, "minor"), buildMetadata); ++ const major = applyBuildMetadata(import_semver8.default.inc(currentVersion, "major"), buildMetadata); ++ const prepatch = applyBuildMetadata(import_semver8.default.inc(currentVersion, "prepatch", prereleaseId), buildMetadata); ++ const preminor = applyBuildMetadata(import_semver8.default.inc(currentVersion, "preminor", prereleaseId), buildMetadata); ++ const premajor = applyBuildMetadata(import_semver8.default.inc(currentVersion, "premajor", prereleaseId), buildMetadata); ++ const message = `Select a new version ${name ? `for ${name} ` : ""}(currently ${currentVersion})`; ++ return promptSelectOne(message, { ++ choices: [ ++ { value: patch, name: `Patch (${patch})` }, ++ { value: minor, name: `Minor (${minor})` }, ++ { value: major, name: `Major (${major})` }, ++ { value: prepatch, name: `Prepatch (${prepatch})` }, ++ { value: preminor, name: `Preminor (${preminor})` }, ++ { value: premajor, name: `Premajor (${premajor})` }, ++ { value: "PRERELEASE", name: "Custom Prerelease" }, ++ { value: "CUSTOM", name: "Custom Version" } ++ ] ++ }).then((choice) => { ++ if (choice === "CUSTOM") { ++ return promptTextInput("Enter a custom version", { ++ filter: import_semver8.default.valid, ++ // semver.valid() always returns null with invalid input ++ validate: (v) => v !== null || "Must be a valid semver version" ++ }); ++ } ++ if (choice === "PRERELEASE") { ++ const defaultVersion = import_semver8.default.inc(currentVersion, "prerelease", prereleaseId); ++ const prompt = `(default: "${prereleaseId}", yielding ${defaultVersion})`; ++ return promptTextInput(`Enter a prerelease identifier ${prompt}`, { ++ filter: (v) => applyBuildMetadata(import_semver8.default.inc(currentVersion, "prerelease", v || prereleaseId), buildMetadata) ++ }); ++ } ++ return choice; ++ }); ++} ++var import_semver8; ++var init_prompt_version = __esm({ ++ "libs/commands/version/src/lib/prompt-version.ts"() { ++ "use strict"; ++ init_src2(); ++ import_semver8 = __toESM(require("semver")); ++ } ++}); ++ ++// libs/commands/version/src/lib/remote-branch-exists.ts ++function remoteBranchExists(gitRemote, branch, opts) { ++ npmlog_default.silly("remoteBranchExists", ""); ++ const remoteBranch = `${gitRemote}/${branch}`; ++ try { ++ childProcess24.execSync("git", ["show-ref", "--verify", `refs/remotes/${remoteBranch}`], opts); ++ return true; ++ } catch (e) { ++ return false; ++ } ++} ++var childProcess24; ++var init_remote_branch_exists = __esm({ ++ "libs/commands/version/src/lib/remote-branch-exists.ts"() { ++ "use strict"; ++ init_src2(); ++ childProcess24 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/commands/version/src/lib/update-lockfile-version.ts ++async function updateLockfileVersion(pkg2) { ++ const lockfilePath = import_path23.default.join(pkg2.location, "package-lock.json"); ++ const obj = await (0, import_load_json_file3.default)(lockfilePath).catch(() => { ++ npmlog_default.verbose("version", `${pkg2.name} has no lockfile. Skipping lockfile update.`); ++ }); ++ if (!obj) { ++ return; ++ } ++ obj.version = pkg2.version; ++ if (obj.packages && obj.packages[""]) { ++ obj.packages[""].version = pkg2.version; ++ if (obj.packages[""].dependencies) { ++ const updatedPkgDependencies = Object.keys(obj.packages[""].dependencies).reduce( ++ (prev, next) => ({ ...prev, [next]: pkg2.dependencies?.[next] }), ++ {} ++ ); ++ obj.packages[""].dependencies = updatedPkgDependencies; ++ } ++ if (obj.packages[""].devDependencies) { ++ const updatedPkgDevDependencies = Object.keys(obj.packages[""].devDependencies).reduce( ++ (prev, next) => ({ ...prev, [next]: pkg2.devDependencies?.[next] }), ++ {} ++ ); ++ obj.packages[""].devDependencies = updatedPkgDevDependencies; ++ } ++ } ++ (0, import_devkit7.writeJsonFile)(lockfilePath, obj, { ++ spaces: 2 ++ }); ++ return lockfilePath; ++} ++var import_devkit7, import_load_json_file3, import_path23; ++var init_update_lockfile_version = __esm({ ++ "libs/commands/version/src/lib/update-lockfile-version.ts"() { ++ "use strict"; ++ init_src2(); ++ import_devkit7 = require("@nx/devkit"); ++ import_load_json_file3 = __toESM(require("load-json-file")); ++ import_path23 = __toESM(require("path")); ++ } ++}); ++ ++// libs/commands/version/src/index.ts ++var require_src3 = __commonJS({ ++ "libs/commands/version/src/index.ts"(exports2, module2) { ++ "use strict"; ++ init_src2(); ++ var import_chalk5 = __toESM(require("chalk")); ++ var import_dedent7 = __toESM(require("dedent")); ++ var import_execa4 = __toESM(require("execa")); ++ var import_fs8 = __toESM(require("fs")); ++ var import_minimatch4 = __toESM(require("minimatch")); ++ var import_os6 = __toESM(require("os")); ++ var import_p_map10 = __toESM(require("p-map")); ++ var import_p_pipe = __toESM(require("p-pipe")); ++ var import_p_reduce = __toESM(require("p-reduce")); ++ var import_p_waterfall = __toESM(require("p-waterfall")); ++ var import_path27 = __toESM(require("path")); ++ var import_semver9 = __toESM(require("semver")); ++ init_create_release(); ++ init_get_current_branch(); ++ init_git_add(); ++ init_git_commit(); ++ init_git_push(); ++ init_git_tag(); ++ init_is_anything_committed(); ++ init_is_behind_upstream(); ++ init_is_breaking_change(); ++ init_prompt_version(); ++ init_remote_branch_exists(); ++ init_update_lockfile_version(); ++ var childProcess28 = (init_src(), __toCommonJS(src_exports)); ++ module2.exports = function factory9(argv, preInitializedProjectData) { ++ return new VersionCommand(argv, preInitializedProjectData); ++ }; ++ var VersionCommand = class extends Command { ++ commitAndTag; ++ pushToRemote; ++ allowBranch; ++ gitRemote; ++ tagPrefix; ++ releaseClient; ++ releaseNotes; ++ gitOpts; ++ savePrefix; ++ currentBranch; ++ updates = []; ++ tags; ++ globalVersion; ++ hasRootedLeaf; ++ runPackageLifecycle; ++ runRootLifecycle; ++ updatesVersions; ++ packagesToVersion; ++ projectsWithPackage = []; ++ premajorVersionBump; ++ get otherCommandConfigs() { ++ return ["publish"]; ++ } ++ get requiresGit() { ++ return !!(this.commitAndTag || this.pushToRemote || this.options.allowBranch || this.options.conventionalCommits); ++ } ++ /** ++ * Due to lerna publish's legacy of being backwards compatible with running versioning and publishing ++ * in a single step, we need to be able to receive any project data which might already exist from the ++ * publish command (in the case that it invokes the version command from within its implementation details). ++ */ ++ constructor(argv, preInitializedProjectData) { ++ super(argv, { skipValidations: false, preInitializedProjectData }); ++ } ++ configureProperties() { ++ super.configureProperties(); ++ const { ++ amend, ++ commitHooks = true, ++ gitRemote = "origin", ++ gitTagVersion = true, ++ granularPathspec = true, ++ push = true, ++ signGitCommit, ++ signoffGitCommit, ++ signGitTag, ++ forceGitTag, ++ tagVersionPrefix = "v", ++ premajorVersionBump = "default", ++ message ++ } = this.options; ++ this.gitRemote = gitRemote; ++ this.tagPrefix = tagVersionPrefix; ++ this.commitAndTag = gitTagVersion; ++ this.pushToRemote = gitTagVersion && amend !== true && push; ++ const overrideMessage = amend && !!message; ++ this.premajorVersionBump = premajorVersionBump; ++ this.releaseClient = this.pushToRemote && this.options.createRelease && createReleaseClient(this.options.createRelease); ++ this.releaseNotes = []; ++ if (this.releaseClient && this.options.conventionalCommits !== true) { ++ throw new ValidationError("ERELEASE", "To create a release, you must enable --conventional-commits"); ++ } ++ if (this.releaseClient && this.options.changelog === false) { ++ throw new ValidationError("ERELEASE", "To create a release, you cannot pass --no-changelog"); ++ } ++ this.gitOpts = { ++ amend, ++ commitHooks, ++ granularPathspec, ++ signGitCommit, ++ signoffGitCommit, ++ signGitTag, ++ forceGitTag, ++ overrideMessage ++ }; ++ this.savePrefix = this.options.exact ? "" : "^"; ++ } ++ async initialize() { ++ if (!this.project.isIndependent()) { ++ this.logger.info("current version", this.project.version); ++ } ++ if (this.requiresGit) { ++ if (!isAnythingCommitted(this.execOpts)) { ++ throw new ValidationError( ++ "ENOCOMMIT", ++ "No commits in this repository. Please commit something before using version." ++ ); ++ } ++ this.currentBranch = getCurrentBranch(this.execOpts); ++ if (this.currentBranch === "HEAD") { ++ throw new ValidationError( ++ "ENOGIT", ++ "Detached git HEAD, please checkout a branch to choose versions." ++ ); ++ } ++ if (this.pushToRemote && !remoteBranchExists(this.gitRemote, this.currentBranch, this.execOpts)) { ++ throw new ValidationError( ++ "ENOREMOTEBRANCH", ++ import_dedent7.default` ++ Branch '${this.currentBranch}' doesn't exist in remote '${this.gitRemote}'. ++ If this is a new branch, please make sure you push it to the remote first. ++ ` ++ ); ++ } ++ if (this.options.allowBranch && ![].concat(this.options.allowBranch).some((x) => (0, import_minimatch4.default)(this.currentBranch, x))) { ++ throw new ValidationError( ++ "ENOTALLOWED", ++ import_dedent7.default` ++ Branch '${this.currentBranch}' is restricted from versioning due to allowBranch config. ++ Please consider the reasons for this restriction before overriding the option. ++ ` ++ ); ++ } ++ if (this.commitAndTag && this.pushToRemote && isBehindUpstream(this.gitRemote, this.currentBranch, this.execOpts)) { ++ const message = `Local branch '${this.currentBranch}' is behind remote upstream ${this.gitRemote}/${this.currentBranch}`; ++ if (!this.options.ci) { ++ throw new ValidationError( ++ "EBEHIND", ++ import_dedent7.default` ++ ${message} ++ Please merge remote changes into '${this.currentBranch}' with 'git pull' ++ ` ++ ); ++ } ++ this.logger.warn("EBEHIND", `${message}, exiting`); ++ return false; ++ } ++ } else { ++ this.logger.notice( ++ "FYI", ++ "git repository validation has been skipped, please ensure your version bumps are correct" ++ ); ++ } ++ if (this.options.conventionalPrerelease && this.options.conventionalGraduate) { ++ throw new ValidationError( ++ "ENOTALLOWED", ++ import_dedent7.default` ++ --conventional-prerelease cannot be combined with --conventional-graduate. ++ ` ++ ); ++ } ++ this.projectsWithPackage = Object.values(this.projectGraph.nodes).filter((node) => !!node.package); ++ this.updates = collectProjectUpdates( ++ this.projectsWithPackage, ++ this.projectGraph, ++ this.execOpts, ++ this.options ++ ).filter((node) => { ++ const pkg2 = getPackage(node); ++ if (pkg2.private && this.options.private === false) { ++ return false; ++ } ++ if (!pkg2.version) { ++ if (pkg2.private) { ++ this.logger.info("version", "Skipping unversioned private package %j", pkg2.name); ++ } else { ++ throw new ValidationError( ++ "ENOVERSION", ++ import_dedent7.default` ++ A version field is required in ${pkg2.name}'s package.json file. ++ If you wish to keep the package unversioned, it must be made private. ++ ` ++ ); ++ } ++ } ++ return !!pkg2.version; ++ }); ++ if (!this.updates.length) { ++ this.logger.success("", `No changed packages to ${this.composed ? "publish" : "version"}`); ++ return false; ++ } ++ this.hasRootedLeaf = !!this.projectGraph.nodes[this.project.manifest.name]; ++ if (this.hasRootedLeaf && !this.composed) { ++ this.logger.info("version", "rooted leaf detected, skipping synthetic root lifecycles"); ++ } ++ this.runPackageLifecycle = createRunner({ ...this.options, stdio: "inherit" }); ++ this.runRootLifecycle = /^(pre|post)?version$/.test(process.env.npm_lifecycle_event) ? (stage) => { ++ this.logger.warn("lifecycle", "Skipping root %j because it has already been called", stage); ++ } : (stage) => this.runPackageLifecycle(this.project.manifest, stage); ++ if (this.commitAndTag && this.gitOpts.amend !== true) { ++ const { forcePublish, conventionalCommits, conventionalGraduate } = this.options; ++ const checkUncommittedOnly = forcePublish || conventionalCommits && conventionalGraduate; ++ const check = checkUncommittedOnly ? throwIfUncommitted : checkWorkingTree; ++ await check(this.execOpts); ++ } else { ++ this.logger.warn("version", "Skipping working tree validation, proceed at your own risk"); ++ } ++ const versions = await this.getVersionsForUpdates(); ++ this.setUpdatesForVersions(versions); ++ return this.confirmVersions(); ++ } ++ execute() { ++ const tasks = [() => this.updatePackageVersions()]; ++ if (this.commitAndTag) { ++ tasks.push(() => this.commitAndTagUpdates()); ++ } else { ++ this.logger.info("execute", "Skipping git tag/commit"); ++ } ++ if (this.pushToRemote) { ++ tasks.push(() => this.gitPushToRemote()); ++ } else { ++ this.logger.info("execute", "Skipping git push"); ++ } ++ if (this.releaseClient) { ++ this.logger.info("execute", "Creating releases..."); ++ tasks.push( ++ () => createRelease( ++ this.releaseClient, ++ { ++ type: this.options.createRelease, ++ tags: this.tags, ++ tagVersionSeparator: this.options.tagVersionSeparator || "@", ++ releaseNotes: this.releaseNotes ++ }, ++ { gitRemote: this.options.gitRemote, execOpts: this.execOpts } ++ ) ++ ); ++ } else { ++ this.logger.info("execute", "Skipping releases"); ++ } ++ return (0, import_p_waterfall.default)(tasks).then(() => { ++ if (!this.composed) { ++ this.logger.success("version", "finished"); ++ } ++ return { ++ updates: this.updates, ++ updatesVersions: this.updatesVersions ++ }; ++ }); ++ } ++ /** ++ * Gets a mapping of project names to their package's new version. ++ * @returns {Promise>} A map of project names to their package's new versions ++ */ ++ getVersionsForUpdates() { ++ const independentVersions = this.project.isIndependent(); ++ const { bump, conventionalCommits, preid } = this.options; ++ const repoVersion = bump ? import_semver9.default.clean(bump) : ""; ++ const increment = bump && !import_semver9.default.valid(bump) ? bump : ""; ++ const resolvePrereleaseId = (existingPreid) => preid || existingPreid || "alpha"; ++ const makeGlobalVersionPredicate = (nextVersion) => { ++ this.globalVersion = nextVersion; ++ return () => nextVersion; ++ }; ++ let predicate; ++ if (repoVersion) { ++ predicate = makeGlobalVersionPredicate(applyBuildMetadata(repoVersion, this.options.buildMetadata)); ++ } else if (increment && independentVersions) { ++ predicate = (node) => applyBuildMetadata( ++ import_semver9.default.inc(node.version, increment, resolvePrereleaseId(node.prereleaseId)), ++ this.options.buildMetadata ++ ); ++ } else if (increment) { ++ const baseVersion = this.project.version; ++ const prereleaseId = prereleaseIdFromVersion(baseVersion); ++ const nextVersion = applyBuildMetadata( ++ import_semver9.default.inc(baseVersion, increment, resolvePrereleaseId(prereleaseId)), ++ this.options.buildMetadata ++ ); ++ predicate = makeGlobalVersionPredicate(nextVersion); ++ } else if (conventionalCommits) { ++ return this.recommendVersions(resolvePrereleaseId); ++ } else if (independentVersions) { ++ predicate = makePromptVersion(resolvePrereleaseId, this.options.buildMetadata); ++ } else { ++ const baseVersion = this.project.version; ++ const prereleaseId = prereleaseIdFromVersion(baseVersion); ++ const node = { version: baseVersion, prereleaseId }; ++ const prompt = makePromptVersion(resolvePrereleaseId, this.options.buildMetadata); ++ predicate = prompt(node).then(makeGlobalVersionPredicate); ++ } ++ return Promise.resolve(predicate).then( ++ (getVersion) => this.reduceVersions((node) => { ++ const pkg2 = getPackage(node); ++ return getVersion({ ++ version: pkg2.version, ++ name: pkg2.name, ++ prereleaseId: prereleaseIdFromVersion(pkg2.version) ++ }); ++ }) ++ ); ++ } ++ reduceVersions(getVersion) { ++ const iterator = (versionMap, node) => Promise.resolve(getVersion(node)).then((version) => versionMap.set(node.name, version)); ++ return (0, import_p_reduce.default)(this.updates, iterator, /* @__PURE__ */ new Map()); ++ } ++ getPrereleasePackageNames() { ++ const prereleasePackageNames = getPackagesForOption(this.options.conventionalPrerelease); ++ const isCandidate = prereleasePackageNames.has("*") ? () => true : (node, name) => prereleasePackageNames.has(name); ++ return collectProjects(this.projectsWithPackage, this.projectGraph, { isCandidate }).map( ++ (pkg2) => pkg2.name ++ ); ++ } ++ async recommendVersions(resolvePrereleaseId) { ++ const independentVersions = this.project.isIndependent(); ++ const { buildMetadata, changelogPreset, conventionalGraduate, conventionalBumpPrerelease } = this.options; ++ const rootPath = this.project.manifest.location; ++ const type = independentVersions ? "independent" : "fixed"; ++ const prereleasePackageNames = this.getPrereleasePackageNames(); ++ const graduatePackageNames = Array.from(getPackagesForOption(conventionalGraduate)); ++ const shouldPrerelease = (name) => prereleasePackageNames && prereleasePackageNames.includes(name); ++ const shouldGraduate = (name) => graduatePackageNames.includes("*") || graduatePackageNames.includes(name); ++ const getPrereleaseId = (node) => { ++ if (!shouldGraduate(node.name) && (shouldPrerelease(node.name) || node.prereleaseId)) { ++ return resolvePrereleaseId(node.prereleaseId); ++ } ++ }; ++ if (type === "fixed") { ++ this.setGlobalVersionFloor(); ++ } ++ const versions = await this.reduceVersions((node) => { ++ const pkg2 = getPackage(node); ++ return recommendVersion( ++ pkg2, ++ type, ++ { ++ changelogPreset, ++ rootPath, ++ tagPrefix: this.tagPrefix, ++ prereleaseId: getPrereleaseId({ ++ name: node.name, ++ prereleaseId: prereleaseIdFromVersion(pkg2.version) ++ }), ++ conventionalBumpPrerelease, ++ buildMetadata ++ }, ++ this.premajorVersionBump ++ ); ++ }); ++ if (type === "fixed") { ++ this.globalVersion = await this.setGlobalVersionCeiling(versions); ++ } ++ return versions; ++ } ++ setGlobalVersionFloor() { ++ const globalVersion = this.project.version; ++ for (const node of this.updates) { ++ const pkg2 = getPackage(node); ++ if (import_semver9.default.lt(pkg2.version, globalVersion)) { ++ this.logger.verbose( ++ "version", ++ `Overriding version of ${pkg2.name} from ${pkg2.version} to ${globalVersion}` ++ ); ++ pkg2.set("version", globalVersion); ++ } ++ } ++ } ++ setGlobalVersionCeiling(versions) { ++ let highestVersion = this.project.version; ++ versions.forEach((bump) => { ++ if (bump && import_semver9.default.gt(bump, highestVersion)) { ++ highestVersion = bump; ++ } ++ }); ++ versions.forEach((_, name) => versions.set(name, highestVersion)); ++ return highestVersion; ++ } ++ setUpdatesForVersions(versions) { ++ if (this.project.isIndependent() || versions.size === this.projectsWithPackage.length) { ++ this.updatesVersions = versions; ++ } else { ++ let hasBreakingChange; ++ for (const [name, bump] of versions) { ++ const pkg2 = getPackage(this.projectGraph.nodes[name]); ++ hasBreakingChange = hasBreakingChange || isBreakingChange(pkg2.version, bump); ++ } ++ if (hasBreakingChange) { ++ this.updates = this.projectsWithPackage; ++ if (this.options.private === false) { ++ this.updates = this.updates.filter((node) => !getPackage(node).private); ++ } ++ this.updatesVersions = new Map(this.updates.map((node) => [node.name, this.globalVersion])); ++ } else { ++ this.updatesVersions = versions; ++ } ++ } ++ this.packagesToVersion = this.updates.map((node) => getPackage(node)); ++ } ++ confirmVersions() { ++ if (this.options.json) { ++ const updatedProjectsJson = formatJSON(this.updates, ({ name }) => ({ ++ newVersion: this.updatesVersions.get(name) ++ })); ++ output(updatedProjectsJson); ++ } else { ++ const changes = this.updates.map((node) => { ++ const pkg2 = getPackage(node); ++ let line = ` - ${pkg2.name}: ${pkg2.version} => ${this.updatesVersions.get(node.name)}`; ++ if (pkg2.private) { ++ line += ` (${import_chalk5.default.red("private")})`; ++ } ++ return line; ++ }); ++ output(""); ++ output("Changes:"); ++ output(changes.join(import_os6.default.EOL)); ++ output(""); ++ } ++ if (this.options.yes) { ++ this.logger.info("auto-confirmed", ""); ++ return true; ++ } ++ const message = this.composed ? "Are you sure you want to publish these packages?" : "Are you sure you want to create these versions?"; ++ return promptConfirmation(message); ++ } ++ async updatePackageVersions() { ++ const { ++ conventionalCommits, ++ changelogPreset, ++ changelogEntryAdditionalMarkdown, ++ changelog = true, ++ runScriptsOnLockfileUpdate = false, ++ syncDistVersion = false ++ } = this.options; ++ const independentVersions = this.project.isIndependent(); ++ const rootPath = this.project.manifest.location; ++ const changedFiles = /* @__PURE__ */ new Set(); ++ if (!this.hasRootedLeaf) { ++ await this.runRootLifecycle("preversion"); ++ } ++ const actions = [ ++ (node) => this.runPackageLifecycle(getPackage(node), "preversion").then(() => node), ++ // manifest may be mutated by any previous lifecycle ++ (node) => getPackage(node).refresh().then(() => node), ++ (node) => { ++ const pkg2 = getPackage(node); ++ pkg2.version = this.updatesVersions.get(node.name); ++ this.updateDependencies(node); ++ return Promise.all([ ++ updateLockfileVersion(pkg2), ++ pkg2.serialize(), ++ pkg2.syncDistVersion(syncDistVersion) ++ ]).then(([lockfilePath]) => { ++ changedFiles.add(pkg2.manifestLocation); ++ if (lockfilePath) { ++ changedFiles.add(lockfilePath); ++ } ++ return node; ++ }); ++ }, ++ (node) => this.runPackageLifecycle(getPackage(node), "version").then(() => node) ++ ]; ++ if (conventionalCommits && changelog) { ++ const type = independentVersions ? "independent" : "fixed"; ++ actions.push( ++ (node) => updateChangelog(getPackage(node), type, { ++ changelogPreset, ++ changelogEntryAdditionalMarkdown, ++ rootPath, ++ tagPrefix: this.tagPrefix ++ }).then(({ logPath, newEntry }) => { ++ changedFiles.add(logPath); ++ if (independentVersions) { ++ this.releaseNotes.push({ ++ name: getPackage(node).name, ++ notes: newEntry ++ }); ++ } ++ return node; ++ }) ++ ); ++ } ++ const mapUpdate = (0, import_p_pipe.default)(...actions); ++ await runProjectsTopologically(this.updates, this.projectGraph, mapUpdate, { ++ concurrency: this.concurrency, ++ rejectCycles: this.options.rejectCycles ++ }); ++ if (!independentVersions) { ++ this.project.version = this.globalVersion; ++ if (conventionalCommits && changelog) { ++ const { logPath, newEntry } = await updateChangelog(this.project.manifest, "root", { ++ changelogPreset, ++ changelogEntryAdditionalMarkdown, ++ rootPath, ++ tagPrefix: this.tagPrefix, ++ version: this.globalVersion ++ }); ++ changedFiles.add(logPath); ++ this.releaseNotes.push({ ++ name: "fixed", ++ notes: newEntry ++ }); ++ } ++ const lernaConfigLocation = await Promise.resolve(this.project.serializeConfig()); ++ changedFiles.add(lernaConfigLocation); ++ } ++ const npmClientArgsRaw = this.options.npmClientArgs || []; ++ const npmClientArgs = npmClientArgsRaw.reduce((args, arg) => args.concat(arg.split(/\s|,/)), []); ++ if (!this.hasRootedLeaf) { ++ await this.runRootLifecycle("version"); ++ } ++ if (this.options.npmClient === "pnpm") { ++ this.logger.verbose("version", "Updating root pnpm-lock.yaml"); ++ await execPackageManager( ++ "pnpm", ++ [ ++ "install", ++ "--lockfile-only", ++ !runScriptsOnLockfileUpdate ? "--ignore-scripts" : "", ++ ...npmClientArgs ++ ].filter(Boolean), ++ this.execOpts ++ ); ++ const lockfilePath = import_path27.default.join(this.project.rootPath, "pnpm-lock.yaml"); ++ changedFiles.add(lockfilePath); ++ } ++ if (this.options.npmClient === "yarn") { ++ const yarnVersion = execPackageManagerSync("yarn", ["--version"], this.execOpts); ++ this.logger.verbose("version", `Detected yarn version ${yarnVersion}`); ++ if (import_semver9.default.gte(yarnVersion, "2.0.0")) { ++ this.logger.verbose("version", "Updating root yarn.lock"); ++ await execPackageManager("yarn", ["install", "--mode", "update-lockfile", ...npmClientArgs], { ++ ...this.execOpts, ++ env: { ++ ...process.env, ++ YARN_ENABLE_SCRIPTS: "false" ++ } ++ }); ++ const lockfilePath = import_path27.default.join(this.project.rootPath, "yarn.lock"); ++ changedFiles.add(lockfilePath); ++ } ++ } ++ if (this.options.npmClient === "npm" || !this.options.npmClient) { ++ const lockfilePath = import_path27.default.join(this.project.rootPath, "package-lock.json"); ++ if (import_fs8.default.existsSync(lockfilePath)) { ++ this.logger.verbose("version", "Updating root package-lock.json"); ++ await childProcess28.exec( ++ "npm", ++ [ ++ "install", ++ "--package-lock-only", ++ !runScriptsOnLockfileUpdate ? "--ignore-scripts" : "", ++ ...npmClientArgs ++ ].filter(Boolean), ++ this.execOpts ++ ); ++ changedFiles.add(lockfilePath); ++ } ++ } ++ if (this.commitAndTag) { ++ await gitAdd(Array.from(changedFiles), this.gitOpts, this.execOpts); ++ } ++ } ++ updateDependencies(node) { ++ const dependencies = this.projectGraph.localPackageDependencies[node.name] || []; ++ const pkg2 = getPackage(node); ++ dependencies.forEach((dep) => { ++ const depVersion = this.updatesVersions.get(dep.target); ++ if ( ++ // only update if the dependency version is being changed ++ depVersion && // don't overwrite local file: specifiers, they only change during publish ++ dep.targetResolvedNpaResult.type !== "directory" ++ ) { ++ pkg2.updateLocalDependency(dep.targetResolvedNpaResult, depVersion, this.savePrefix); ++ } ++ }); ++ } ++ async commitAndTagUpdates() { ++ let tags = []; ++ if (this.project.isIndependent()) { ++ tags = await this.gitCommitAndTagVersionForUpdates(); ++ } else { ++ tags = await this.gitCommitAndTagVersion(); ++ } ++ this.tags = tags; ++ await (0, import_p_map10.default)(this.packagesToVersion, (pkg2) => this.runPackageLifecycle(pkg2, "postversion")); ++ if (!this.hasRootedLeaf) { ++ await this.runRootLifecycle("postversion"); ++ } ++ } ++ async gitCommitAndTagVersionForUpdates() { ++ const tagVersionSeparator = this.options.tagVersionSeparator || "@"; ++ const tags = this.updates.map((node) => { ++ const pkg2 = getPackage(node); ++ return `${pkg2.name}${tagVersionSeparator}${this.updatesVersions.get(node.name)}`; ++ }); ++ const subject = this.options.message || "Publish"; ++ const message = tags.reduce((msg, tag) => `${msg}${import_os6.default.EOL} - ${tag}`, `${subject}${import_os6.default.EOL}`); ++ if (await this.hasChanges()) { ++ await gitCommit(message, this.gitOpts, this.execOpts); ++ } ++ if (this.gitOpts.signGitTag) { ++ for (const tag of tags) await gitTag(tag, this.gitOpts, this.execOpts, this.options.gitTagCommand); ++ } else { ++ await Promise.all( ++ tags.map((tag) => gitTag(tag, this.gitOpts, this.execOpts, this.options.gitTagCommand)) ++ ); ++ } ++ return tags; ++ } ++ async gitCommitAndTagVersion() { ++ const version = this.globalVersion; ++ const tag = `${this.tagPrefix}${version}`; ++ const message = this.options.message ? this.options.message.replace(/%s/g, tag).replace(/%v/g, version) : tag; ++ if (await this.hasChanges()) { ++ await gitCommit(message, this.gitOpts, this.execOpts); ++ } ++ await gitTag(tag, this.gitOpts, this.execOpts, this.options.gitTagCommand); ++ return [tag]; ++ } ++ gitPushToRemote() { ++ this.logger.info("git", "Pushing tags..."); ++ return gitPush(this.gitRemote, this.currentBranch, this.execOpts); ++ } ++ async hasChanges() { ++ try { ++ await (0, import_execa4.default)("git", ["diff", "--staged", "--quiet"], { ++ stdio: "pipe", ++ ...this.execOpts, ++ cwd: this.execOpts.cwd ++ // force it to a string ++ }); ++ } catch (e) { ++ return true; ++ } ++ } ++ }; ++ module2.exports.VersionCommand = VersionCommand; ++ } ++}); ++ ++// libs/commands/version/src/command.ts ++var require_command10 = __commonJS({ ++ "libs/commands/version/src/command.ts"(exports2, module2) { ++ "use strict"; ++ init_src2(); ++ var import_semver9 = __toESM(require("semver")); ++ function addBumpPositional(yargs2, additionalKeywords = []) { ++ const semverKeywords = ["major", "minor", "patch", "premajor", "preminor", "prepatch", "prerelease"].concat( ++ additionalKeywords ++ ); ++ const bumpOptionList = `'${semverKeywords.slice(0, -1).join("', '")}', or '${semverKeywords[semverKeywords.length - 1]}'.`; ++ yargs2.positional("bump", { ++ describe: `Increment version(s) by explicit version _or_ semver keyword, ++${bumpOptionList}`, ++ type: "string", ++ coerce: (choice) => { ++ if (!import_semver9.default.valid(choice) && semverKeywords.indexOf(choice) === -1) { ++ throw new Error(`bump must be an explicit version string _or_ one of: ${bumpOptionList}`); ++ } ++ return choice; ++ } ++ }); ++ } ++ var command = { ++ command: "version [bump]", ++ describe: "Bump version of packages changed since the last release", ++ // TODO: refactor based on TS feedback ++ // eslint-disable-next-line @typescript-eslint/ban-ts-comment ++ // @ts-ignore ++ builder(yargs2, composed) { ++ const opts = { ++ "allow-branch": { ++ describe: "Specify which branches to allow versioning from.", ++ type: "array" ++ }, ++ amend: { ++ describe: "Amend the existing commit, instead of generating a new one.", ++ type: "boolean" ++ }, ++ "build-metadata": { ++ describe: "Apply semver-compatible build metadata to the release", ++ requiresArg: true, ++ type: "string" ++ }, ++ "conventional-commits": { ++ describe: "Use conventional-changelog to determine version bump and generate CHANGELOG.", ++ type: "boolean" ++ }, ++ "conventional-graduate": { ++ describe: "Version currently prereleased packages to a non-prerelease version." ++ // type must remain ambiguous because it is overloaded (boolean _or_ string _or_ array) ++ }, ++ "force-conventional-graduate": { ++ describe: "Forces all packages specified by --conventional-graduate to bump their version whether or not they are a prerelease or have changes since the previous version.", ++ type: "boolean" ++ }, ++ "conventional-prerelease": { ++ describe: "Version changed packages as prereleases when using --conventional-commits." ++ // type must remain ambiguous because it is overloaded (boolean _or_ string _or_ array) ++ }, ++ "conventional-bump-prerelease": { ++ describe: "Bumps prerelease versions if conventional commits requires it.", ++ type: "boolean" ++ }, ++ "changelog-preset": { ++ describe: "Custom conventional-changelog preset.", ++ type: "string", ++ requiresArg: true, ++ defaultDescription: "angular" ++ }, ++ "changelog-entry-additional-markdown": { ++ describe: "Additional markdown to add to CHANGELOG.md entries.", ++ type: "string" ++ }, ++ exact: { ++ describe: "Specify cross-dependency version numbers exactly rather than with a caret (^).", ++ type: "boolean" ++ }, ++ "force-publish": { ++ describe: "Always include targeted packages in versioning operations, skipping default logic." ++ // type must remain ambiguous because it is overloaded (boolean _or_ string _or_ array) ++ }, ++ "git-remote": { ++ describe: "Push git changes to the specified remote.", ++ type: "string", ++ requiresArg: true, ++ defaultDescription: "origin" ++ }, ++ "create-release": { ++ describe: "Create an official GitHub or GitLab release for every version.", ++ type: "string", ++ choices: ["gitlab", "github"] ++ }, ++ "ignore-changes": { ++ describe: [ ++ "Ignore changes in files matched by glob(s) when detecting changed packages.", ++ "Pass --no-ignore-changes to completely disable." ++ ].join("\n"), ++ type: "array" ++ }, ++ "ignore-scripts": { ++ describe: "Disable all lifecycle scripts", ++ type: "boolean" ++ }, ++ "include-merged-tags": { ++ describe: "Include tags from merged branches when detecting changed packages.", ++ type: "boolean" ++ }, ++ json: { ++ describe: "Outputs changed packages in json format", ++ type: "boolean" ++ }, ++ m: { ++ describe: "Use a custom commit message when creating the version commit.", ++ alias: "message", ++ type: "string", ++ requiresArg: true ++ }, ++ "no-changelog": { ++ describe: "Do not generate CHANGELOG.md files when using --conventional-commits.", ++ type: "boolean" ++ }, ++ changelog: { ++ // proxy for --no-changelog ++ hidden: true, ++ type: "boolean" ++ }, ++ "no-commit-hooks": { ++ describe: "Do not run git commit hooks when committing version changes.", ++ type: "boolean" ++ }, ++ "commit-hooks": { ++ // proxy for --no-commit-hooks ++ hidden: true, ++ type: "boolean" ++ }, ++ "no-git-tag-version": { ++ describe: "Do not commit or tag version changes.", ++ type: "boolean" ++ }, ++ "git-tag-version": { ++ // proxy for --no-git-tag-version ++ hidden: true, ++ type: "boolean" ++ }, ++ "sync-dist-version": { ++ describe: "Update the version of the package.json of the contents directory.", ++ type: "boolean" ++ }, ++ // TODO: (major) make --no-granular-pathspec the default ++ "no-granular-pathspec": { ++ describe: "Do not stage changes file-by-file, but globally.", ++ type: "boolean" ++ }, ++ "granular-pathspec": { ++ // proxy for --no-granular-pathspec ++ hidden: true, ++ // describe: "Stage changes file-by-file, not globally.", ++ type: "boolean" ++ }, ++ // TODO: (major) make --no-private the default ++ "no-private": { ++ describe: "Do not version private packages.", ++ type: "boolean" ++ }, ++ private: { ++ // proxy for --no-private ++ hidden: true, ++ type: "boolean" ++ }, ++ "no-push": { ++ describe: "Do not push tagged commit to git remote.", ++ type: "boolean" ++ }, ++ push: { ++ // proxy for --no-push ++ hidden: true, ++ type: "boolean" ++ }, ++ // preid is copied into ../publish/command because a whitelist for one option isn't worth it ++ preid: { ++ describe: "Specify the prerelease identifier when versioning a prerelease", ++ type: "string", ++ requiresArg: true, ++ defaultDescription: "alpha" ++ }, ++ "sign-git-commit": { ++ describe: "Pass the `--gpg-sign` flag to `git commit`.", ++ type: "boolean" ++ }, ++ "signoff-git-commit": { ++ describe: "Pass the `--signoff` flag to `git commit`.", ++ type: "boolean" ++ }, ++ "sign-git-tag": { ++ describe: "Pass the `--sign` flag to `git tag`.", ++ type: "boolean" ++ }, ++ "force-git-tag": { ++ describe: "Pass the `--force` flag to `git tag`.", ++ type: "boolean" ++ }, ++ "tag-version-prefix": { ++ describe: "Customize the tag prefix. To remove entirely, pass an empty string.", ++ type: "string", ++ requiresArg: true, ++ defaultDescription: "v" ++ }, ++ "tag-version-separator": { ++ describe: "Customize the tag version separator used when creating tags for independent versioning.", ++ type: "string", ++ requiresArg: true, ++ defaultDescription: "@" ++ }, ++ "git-tag-command": { ++ describe: "Allows users to specify a custom command to be used when applying git tags. For example, this may be useful for providing a wrapper command in CI/CD pipelines that have no direct write access.", ++ type: "string" ++ }, ++ "run-scripts-on-lockfile-update": { ++ describe: "Do not disable all lifecycle scripts while updating the lock file after the version bump.", ++ type: "boolean" ++ }, ++ "npm-client-args": { ++ describe: "Additional arguments to pass to the npm client when performing 'npm install'.", ++ type: "array" ++ }, ++ "premajor-version-bump": { ++ describe: "Controls how pre-major version packages are bumped by lerna.", ++ type: "string", ++ choices: ["default", "force-patch"], ++ requiresArg: true, ++ defaultDescription: "default" ++ }, ++ y: { ++ describe: "Skip all confirmation prompts.", ++ alias: "yes", ++ type: "boolean" ++ } ++ }; ++ if (composed) { ++ Object.keys(opts).forEach((key) => { ++ opts[key].hidden = true; ++ }); ++ yargs2.default("composed", composed).hide("composed"); ++ } else { ++ addBumpPositional(yargs2); ++ } ++ yargs2.options(opts); ++ yargs2.parserConfiguration({ ++ "populate--": true ++ }); ++ if (!composed) { ++ yargs2.group(Object.keys(opts), "Command Options:"); ++ } ++ return yargs2.option("ignore", { ++ // NOT the same as filter-options --ignore ++ hidden: true, ++ conflicts: "ignore-changes", ++ type: "array" ++ }).option("cd-version", { ++ hidden: true, ++ conflicts: "bump", ++ type: "string", ++ requiresArg: true ++ }).option("repo-version", { ++ hidden: true, ++ conflicts: "bump", ++ type: "string", ++ requiresArg: true ++ }).option("skip-git", { ++ hidden: true, ++ type: "boolean" ++ }).option("github-release", { ++ hidden: true, ++ type: "boolean" ++ }).check((argv) => { ++ if (argv.ignore) { ++ throw new Error( ++ "--ignore was renamed to --ignore-changes. We recommend running `lerna repair` in order to ensure your lerna.json is up to date, otherwise check your CLI usage and/or any configs you extend from." ++ ); ++ } ++ if (argv.cdVersion) { ++ throw new Error( ++ "--cd-version was replaced by positional [bump]. We recommend running `lerna repair` in order to ensure your lerna.json is up to date, otherwise check your CLI usage and/or any configs you extend from." ++ ); ++ } ++ if (argv.repoVersion) { ++ throw new Error( ++ "--repo-version was replaced by positional [bump]. We recommend running `lerna repair` in order to ensure your lerna.json is up to date, otherwise check your CLI usage and/or any configs you extend from." ++ ); ++ } ++ if (argv.skipGit) { ++ throw new Error( ++ "--skip-git was replaced by --no-git-tag-version --no-push. We recommend running `lerna repair` in order to ensure your lerna.json is up to date, otherwise check your CLI usage and/or any configs you extend from." ++ ); ++ } ++ if (argv.githubRelease) { ++ throw new Error( ++ "--github-release was replaced by --create-release=github. We recommend running `lerna repair` in order to ensure your lerna.json is up to date, otherwise check your CLI usage and/or any configs you extend from." ++ ); ++ } ++ if (argv["--"]) { ++ npmlog_default.warn("EDOUBLEDASH", "Arguments after -- are no longer passed to subprocess executions."); ++ npmlog_default.warn("EDOUBLEDASH", "This will cause an error in a future major version."); ++ } ++ return argv; ++ }); ++ }, ++ handler(argv) { ++ return require_src3()(argv); ++ }, ++ addBumpPositional ++ }; ++ module2.exports = command; ++ } ++}); ++ ++// libs/commands/publish/src/lib/create-temp-licenses.ts ++function createTempLicenses(srcLicensePath, packagesToBeLicensed) { ++ if (!srcLicensePath || !packagesToBeLicensed.length) { ++ return Promise.resolve(); ++ } ++ const licenseFileName = import_path24.default.basename(srcLicensePath); ++ const options = { ++ // make an effort to keep package contents stable over time ++ preserveTimestamps: process.arch !== "ia32" ++ // (give up on 32-bit architecture to avoid fs-extra warning) ++ }; ++ packagesToBeLicensed.forEach((pkg2) => { ++ pkg2.licensePath = import_path24.default.join(pkg2.contents, licenseFileName); ++ }); ++ return (0, import_p_map6.default)(packagesToBeLicensed, (pkg2) => import_fs_extra14.default.copy(srcLicensePath, pkg2.licensePath, options)); ++} ++var import_fs_extra14, import_p_map6, import_path24; ++var init_create_temp_licenses = __esm({ ++ "libs/commands/publish/src/lib/create-temp-licenses.ts"() { ++ "use strict"; ++ import_fs_extra14 = __toESM(require("fs-extra")); ++ import_p_map6 = __toESM(require("p-map")); ++ import_path24 = __toESM(require("path")); ++ } ++}); ++ ++// libs/commands/publish/src/lib/get-current-sha.ts ++function getCurrentSHA(opts) { ++ npmlog_default.silly("getCurrentSHA", ""); ++ const sha = childProcess25.execSync("git", ["rev-parse", "HEAD"], opts); ++ npmlog_default.verbose("getCurrentSHA", sha); ++ return sha; ++} ++var childProcess25; ++var init_get_current_sha = __esm({ ++ "libs/commands/publish/src/lib/get-current-sha.ts"() { ++ "use strict"; ++ init_src2(); ++ childProcess25 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/commands/publish/src/lib/get-current-tags.ts ++async function getCurrentTags(execOpts, matchingPattern) { ++ npmlog_default.silly("getCurrentTags", "matching %j", matchingPattern); ++ const opts = Object.assign({}, execOpts, { ++ // don't reject due to non-zero exit code when there are no results ++ reject: false ++ }); ++ const result = await childProcess26.exec( ++ "git", ++ ["tag", "--sort", "version:refname", "--points-at", "HEAD", "--list", matchingPattern], ++ opts ++ ); ++ const lines = result.stdout.split("\n").filter(Boolean); ++ if (matchingPattern === "*@*") { ++ return lines.map((tag) => (0, import_npm_package_arg9.default)(tag).name); ++ } ++ return lines; ++} ++var import_npm_package_arg9, childProcess26; ++var init_get_current_tags = __esm({ ++ "libs/commands/publish/src/lib/get-current-tags.ts"() { ++ "use strict"; ++ init_src2(); ++ import_npm_package_arg9 = __toESM(require("npm-package-arg")); ++ childProcess26 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/commands/publish/src/lib/fetch-config.ts ++function getFetchConfig(options, extra) { ++ return { ++ log: npmlog_default, ++ ...options, ++ ...extra ++ }; ++} ++var init_fetch_config = __esm({ ++ "libs/commands/publish/src/lib/fetch-config.ts"() { ++ "use strict"; ++ init_src2(); ++ } ++}); ++ ++// libs/commands/publish/src/lib/get-profile-data.ts ++function getProfileData(opts) { ++ opts.log.verbose("", "Retrieving npm user profile"); ++ return pulseTillDone(import_npm_registry_fetch3.default.json("/-/npm/v1/user", opts)).then((data) => { ++ opts.log.silly("npm profile get", "received %j", data); ++ return Object.assign( ++ // remap to match legacy whoami format ++ { username: data.name }, ++ data ++ ); ++ }); ++} ++var import_npm_registry_fetch3; ++var init_get_profile_data = __esm({ ++ "libs/commands/publish/src/lib/get-profile-data.ts"() { ++ "use strict"; ++ init_src2(); ++ import_npm_registry_fetch3 = __toESM(require("npm-registry-fetch")); ++ } ++}); ++ ++// libs/commands/publish/src/lib/get-whoami.ts ++function getWhoAmI(opts) { ++ opts.log.verbose("", "Retrieving npm username"); ++ return pulseTillDone(import_npm_registry_fetch4.default.json("/-/whoami", opts)).then((data) => { ++ opts.log.silly("npm whoami", "received %j", data); ++ return data; ++ }); ++} ++var import_npm_registry_fetch4; ++var init_get_whoami = __esm({ ++ "libs/commands/publish/src/lib/get-whoami.ts"() { ++ "use strict"; ++ init_src2(); ++ import_npm_registry_fetch4 = __toESM(require("npm-registry-fetch")); ++ } ++}); ++ ++// libs/commands/publish/src/lib/get-npm-username.ts ++function getNpmUsername(options = {}) { ++ const opts = getFetchConfig(options, { ++ // don't wait forever for third-party failures to be dealt with ++ fetchRetries: 0 ++ }); ++ opts.log.info("", "Verifying npm credentials"); ++ return getProfileData(opts).catch((err) => { ++ if (err.code === "E500" || err.code === "E404") { ++ return getWhoAmI(opts); ++ } ++ throw err; ++ }).then(success, failure); ++ function success(result) { ++ opts.log.silly("get npm username", "received %j", result); ++ if (!result.username) { ++ throw new ValidationError( ++ "ENEEDAUTH", ++ "You must be logged in to publish packages. Use `npm login` and try again." ++ ); ++ } ++ return result.username; ++ } ++ function failure(err) { ++ opts.log.pause(); ++ console.error(err.message); ++ opts.log.resume(); ++ if (opts.registry === "https://registry.npmjs.org/") { ++ if (err.code === "E403") { ++ throw new ValidationError( ++ "ENEEDAUTH", ++ "Access verification failed. Ensure that your npm access token has both read and write access, or remove the verifyAccess option to skip this verification. Note that npm automation tokens do NOT have read access (https://docs.npmjs.com/creating-and-viewing-access-tokens)." ++ ); ++ } ++ throw new ValidationError("EWHOAMI", "Authentication error. Use `npm whoami` to troubleshoot."); ++ } ++ opts.log.warn( ++ "EWHOAMI", ++ "Unable to determine npm username from third-party registry, this command will likely fail soon!" ++ ); ++ } ++} ++var init_get_npm_username = __esm({ ++ "libs/commands/publish/src/lib/get-npm-username.ts"() { ++ "use strict"; ++ init_src2(); ++ init_fetch_config(); ++ init_get_profile_data(); ++ init_get_whoami(); ++ } ++}); ++ ++// libs/commands/publish/src/lib/get-packages-without-license.ts ++function getPackagesWithoutLicense(project, packagesToPublish) { ++ return project.getPackageLicensePaths().then((licensePaths) => { ++ const licensed = new Set(licensePaths.map((lp) => import_path25.default.dirname(lp))); ++ return packagesToPublish.filter((pkg2) => !licensed.has(pkg2.location)); ++ }); ++} ++var import_path25; ++var init_get_packages_without_license = __esm({ ++ "libs/commands/publish/src/lib/get-packages-without-license.ts"() { ++ "use strict"; ++ import_path25 = __toESM(require("path")); ++ } ++}); ++ ++// libs/commands/publish/src/lib/get-projects-with-tagged-packages.ts ++async function getProjectsWithTaggedPackages(projectNodes, projectFileMap, execOpts) { ++ npmlog_default.silly("getTaggedPackages", ""); ++ const result = await childProcess27.exec( ++ "git", ++ ["diff-tree", "--name-only", "--no-commit-id", "--root", "-r", "-c", "HEAD"], ++ execOpts ++ ); ++ const stdout = result.stdout; ++ const files = new Set(stdout.split("\n")); ++ return projectNodes.filter((node) => projectFileMap[node.name]?.some((file) => files.has(file.file))); ++} ++var childProcess27; ++var init_get_projects_with_tagged_packages = __esm({ ++ "libs/commands/publish/src/lib/get-projects-with-tagged-packages.ts"() { ++ "use strict"; ++ init_src2(); ++ childProcess27 = (init_src(), __toCommonJS(src_exports)); ++ } ++}); ++ ++// libs/commands/publish/src/lib/get-projects-with-unpublished-packages.ts ++async function getProjectsWithUnpublishedPackages(projectNodes, opts) { ++ npmlog_default.silly("getProjectsWithUnpublishedPackages", ""); ++ const mapper = (node) => { ++ const pkg2 = getPackage(node); ++ opts["strictSSL"] = opts["strict-ssl"]; ++ return import_pacote.default.packument(pkg2.name, opts).then( ++ (packument) => { ++ if (packument.versions === void 0 || packument.versions[pkg2.version] === void 0) { ++ return node; ++ } ++ }, ++ () => { ++ npmlog_default.warn("", "Unable to determine published version, assuming %j unpublished.", pkg2.name); ++ return node; ++ } ++ ); ++ }; ++ const results = await (0, import_p_map7.default)(projectNodes, mapper, { concurrency: 4 }); ++ return results.filter(Boolean); ++} ++var import_p_map7, import_pacote; ++var init_get_projects_with_unpublished_packages = __esm({ ++ "libs/commands/publish/src/lib/get-projects-with-unpublished-packages.ts"() { ++ "use strict"; ++ init_src2(); ++ init_src2(); ++ import_p_map7 = __toESM(require("p-map")); ++ import_pacote = __toESM(require("pacote")); ++ } ++}); ++ ++// libs/commands/publish/src/lib/get-two-factor-auth-required.ts ++function getTwoFactorAuthRequired(options = {}) { ++ const opts = getFetchConfig(options, { ++ // don't wait forever for third-party failures to be dealt with ++ fetchRetries: 0 ++ }); ++ opts.log.info("", "Checking two-factor auth mode"); ++ return getProfileData(opts).then(success, failure); ++ function success(result) { ++ opts.log.silly("2FA", result.tfa); ++ if (result.tfa.pending) { ++ return false; ++ } ++ return result.tfa.mode === "auth-and-writes"; ++ } ++ function failure(err) { ++ if (err.code === "E500" || err.code === "E404") { ++ opts.log.warn( ++ "EREGISTRY", ++ `Registry "${opts.registry}" does not support 'npm profile get', skipping two-factor auth check...` ++ ); ++ return false; ++ } ++ opts.log.pause(); ++ console.error(err.message); ++ opts.log.resume(); ++ throw new ValidationError("ETWOFACTOR", "Unable to obtain two-factor auth mode"); ++ } ++} ++var init_get_two_factor_auth_required = __esm({ ++ "libs/commands/publish/src/lib/get-two-factor-auth-required.ts"() { ++ "use strict"; ++ init_src2(); ++ init_fetch_config(); ++ init_get_profile_data(); ++ } ++}); ++ ++// libs/commands/publish/src/lib/git-checkout.ts ++var init_git_checkout2 = __esm({ ++ "libs/commands/publish/src/lib/git-checkout.ts"() { ++ "use strict"; ++ init_src2(); ++ } ++}); ++ ++// libs/commands/publish/src/lib/interpolate.ts ++function interpolate(template, data) { ++ const _workspaceRoot = process.env["NX_WORKSPACE_ROOT_PATH"] || import_devkit8.workspaceRoot; ++ if (template.includes("{workspaceRoot}", 1)) { ++ throw new Error( ++ `Config '${template}' is invalid. {workspaceRoot} can only be used at the beginning of the expression.` ++ ); ++ } ++ if (data.projectRoot == "." && template.includes("{projectRoot}", 1)) { ++ throw new Error( ++ `Config '${template}' is invalid. When {projectRoot} is '.', it can only be used at the beginning of the expression.` ++ ); ++ } ++ let res = template.replace("{workspaceRoot}", _workspaceRoot); ++ if (data.projectRoot == ".") { ++ res = res.replace("{projectRoot}/", ""); ++ } ++ return res.replace(/{([\s\S]+?)}/g, (match) => { ++ let value = data; ++ const path24 = match.slice(1, -1).trim().split("."); ++ for (let idx = 0; idx < path24.length; idx++) { ++ if (!value[path24[idx]]) { ++ return match; ++ } ++ value = value[path24[idx]]; ++ } ++ return value; ++ }); ++} ++var import_devkit8; ++var init_interpolate = __esm({ ++ "libs/commands/publish/src/lib/interpolate.ts"() { ++ "use strict"; ++ import_devkit8 = require("@nx/devkit"); ++ } ++}); ++ ++// libs/commands/publish/src/lib/remove-temp-licenses.ts ++function removeTempLicenses(packagesToBeLicensed) { ++ if (!packagesToBeLicensed.length) { ++ return Promise.resolve(); ++ } ++ return (0, import_p_map8.default)(packagesToBeLicensed, (pkg2) => import_fs_extra15.default.remove(pkg2.licensePath)); ++} ++var import_fs_extra15, import_p_map8; ++var init_remove_temp_licenses = __esm({ ++ "libs/commands/publish/src/lib/remove-temp-licenses.ts"() { ++ "use strict"; ++ import_fs_extra15 = __toESM(require("fs-extra")); ++ import_p_map8 = __toESM(require("p-map")); ++ } ++}); ++ ++// libs/commands/publish/src/lib/throttle-queue.ts ++var TailHeadQueue; ++var init_throttle_queue = __esm({ ++ "libs/commands/publish/src/lib/throttle-queue.ts"() { ++ "use strict"; ++ TailHeadQueue = class { ++ queue_list; ++ queue_size; ++ queue_period; ++ allowance; ++ last_end; ++ /** ++ * @param size The number of items that may run concurrently ++ * @param period The time between the end of the execution of an item and the start of the execution of the next one (ms) ++ */ ++ constructor(size, period) { ++ this.queue_list = []; ++ this.queue_size = Math.floor(size); ++ this.queue_period = period; ++ this.allowance = this.queue_size; ++ this.last_end = []; ++ } ++ /** ++ * Validate the execution of a queue item and schedule the execution of the next one ++ */ ++ _on_settled() { ++ const next = this.queue_list.shift(); ++ if (next !== void 0) { ++ setTimeout(next, this.queue_period); ++ } else { ++ this.last_end.push(Date.now()); ++ this.allowance += 1; ++ } ++ } ++ async queue(f) { ++ let p; ++ if (this.allowance > 0) { ++ this.allowance -= 1; ++ if (this.allowance + 1 <= this.last_end.length) { ++ const time_offset = Date.now() - (this.last_end.shift() || 0); ++ if (time_offset < this.queue_period) { ++ p = new Promise((r) => setTimeout(r, this.queue_period - time_offset)).then(f); ++ } ++ } ++ if (p === void 0) { ++ p = f(); ++ } ++ } else { ++ p = new Promise((r) => { ++ this.queue_list.push(r); ++ }).then(f); ++ } ++ return p.finally(() => { ++ this._on_settled(); ++ }); ++ } ++ }; ++ } ++}); ++ ++// libs/commands/publish/src/lib/verify-npm-package-access.ts ++function verifyNpmPackageAccess(packages, username, options) { ++ const opts = getFetchConfig(options, { ++ // don't wait forever for third-party failures to be dealt with ++ fetchRetries: 0 ++ }); ++ opts.log.silly("verifyNpmPackageAccess", ""); ++ return pulseTillDone(import_libnpmaccess2.default.getPackages(username, opts)).then(success, failure); ++ function success(result) { ++ const userPackages = Object.keys(result || {}); ++ if (userPackages.length === 0) { ++ opts.log.warn( ++ "", ++ "The logged-in user does not have any previously-published packages, skipping permission checks..." ++ ); ++ return; ++ } ++ for (const pkg2 of packages) { ++ if (pkg2.name in result && result[pkg2.name] !== "read-write") { ++ throw new ValidationError( ++ "EACCESS", ++ `You do not have write permission required to publish "${pkg2.name}"` ++ ); ++ } ++ } ++ } ++ function failure(err) { ++ if (err.code === "E500" || err.code === "E404") { ++ opts.log.warn( ++ "EREGISTRY", ++ "Registry %j does not support `npm access list packages`, skipping permission checks...", ++ // registry ++ opts.registry ++ ); ++ return; ++ } ++ opts.log.pause(); ++ console.error(err.message); ++ opts.log.resume(); ++ throw new ValidationError("EWHOAMI", "Authentication error. Use `npm whoami` to troubleshoot."); ++ } ++} ++var import_libnpmaccess2; ++var init_verify_npm_package_access = __esm({ ++ "libs/commands/publish/src/lib/verify-npm-package-access.ts"() { ++ "use strict"; ++ init_src2(); ++ import_libnpmaccess2 = __toESM(require("libnpmaccess")); ++ init_fetch_config(); ++ } ++}); ++ ++// libs/commands/publish/src/index.ts ++var require_src4 = __commonJS({ ++ "libs/commands/publish/src/index.ts"(exports2, module2) { ++ "use strict"; ++ init_src2(); ++ var import_devkit9 = require("@nx/devkit"); ++ var import_fs_extra17 = require("fs-extra"); ++ var import_node_crypto = __toESM(require("node:crypto")); ++ var import_node_fs2 = __toESM(require("node:fs")); ++ var import_node_os3 = __toESM(require("node:os")); ++ var import_node_path = __toESM(require("node:path")); ++ var import_npm_package_arg10 = __toESM(require("npm-package-arg")); ++ var import_p_map10 = __toESM(require("p-map")); ++ var import_p_pipe = __toESM(require("p-pipe")); ++ var import_semver9 = __toESM(require("semver")); ++ var import_tinyglobby3 = require("tinyglobby"); ++ init_create_temp_licenses(); ++ init_get_current_sha(); ++ init_get_current_tags(); ++ init_get_npm_username(); ++ init_get_packages_without_license(); ++ init_get_projects_with_tagged_packages(); ++ init_get_projects_with_unpublished_packages(); ++ init_get_two_factor_auth_required(); ++ init_git_checkout2(); ++ init_interpolate(); ++ init_remove_temp_licenses(); ++ init_throttle_queue(); ++ init_verify_npm_package_access(); ++ var versionCommand = require_src3(); ++ module2.exports = function factory9(argv) { ++ return new PublishCommand(argv); ++ }; ++ var PublishCommand = class extends Command { ++ savePrefix; ++ tagPrefix; ++ gitReset; ++ npmSession; ++ verifyAccess; ++ conf; ++ otpCache; ++ hasRootedLeaf; ++ runPackageLifecycle; ++ runRootLifecycle; ++ updates; ++ projectsWithPackage; ++ updatesVersions; ++ packagesToPublish; ++ publishedPackages; ++ privatePackagesToPublish; ++ packagesToBeLicensed; ++ twoFactorAuthRequired; ++ uniqueProvenanceUrls = /* @__PURE__ */ new Set(); ++ get otherCommandConfigs() { ++ return ["version"]; ++ } ++ get requiresGit() { ++ return this.options.bump !== "from-package"; ++ } ++ configureProperties() { ++ super.configureProperties(); ++ this.toposort = this.options.sort !== false; ++ const { ++ // prettier-ignore ++ exact, ++ gitHead, ++ gitReset, ++ tagVersionPrefix = "v", ++ verifyAccess ++ } = this.options; ++ if (this.requiresGit && gitHead) { ++ throw new ValidationError("EGITHEAD", "--git-head is only allowed with 'from-package' positional"); ++ } ++ this.savePrefix = exact ? "" : "^"; ++ this.tagPrefix = tagVersionPrefix; ++ this.gitReset = gitReset !== false; ++ this.npmSession = import_node_crypto.default.randomBytes(8).toString("hex"); ++ this.verifyAccess = verifyAccess; ++ } ++ get userAgent() { ++ return `lerna/${this.options.lernaVersion}/node@${process.version}+${process.arch} (${process.platform})`; ++ } ++ async initialize() { ++ if (this.options.verifyAccess === false) { ++ this.logger.warn( ++ "verify-access", ++ "--verify-access=false and --no-verify-access are no longer needed, because the legacy preemptive access verification is now disabled by default. Requests will fail with appropriate errors when not authorized correctly." ++ ); ++ } ++ if (this.options.includePrivate) { ++ if (this.options.includePrivate.length === 0) { ++ throw new ValidationError( ++ "EINCLPRIV", ++ "Must specify at least one private package to include with --include-private." ++ ); ++ } ++ this.logger.info("publish", `Including private packages %j`, this.options.includePrivate); ++ } ++ if (this.options.skipNpm) { ++ this.logger.warn("deprecated", "Instead of --skip-npm, call `lerna version` directly"); ++ return versionCommand(this.argv).then(() => false); ++ } ++ if (this.options.buildMetadata && this.options.canary) { ++ throw new ValidationError( ++ "ENOTSATISFIED", ++ "Cannot use --build-metadata in conjunction with --canary option." ++ ); ++ } else if (this.options.canary) { ++ this.logger.info("canary", "enabled"); ++ } ++ if (this.options.requireScripts) { ++ this.logger.info("require-scripts", "enabled"); ++ } ++ this.logger.verbose("session", this.npmSession); ++ this.logger.verbose("user-agent", this.userAgent); ++ this.conf = npmConf2({ ++ lernaCommand: "publish", ++ _auth: this.options.legacyAuth, ++ npmSession: this.npmSession, ++ npmVersion: this.userAgent, ++ otp: this.options.otp, ++ registry: this.options.registry, ++ "ignore-prepublish": this.options.ignorePrepublish, ++ "ignore-scripts": this.options.ignoreScripts ++ }); ++ this.otpCache = { otp: this.conf.get("otp") }; ++ this.conf.set("user-agent", this.userAgent, "cli"); ++ if (this.conf.get("registry") === "https://registry.yarnpkg.com") { ++ this.logger.warn("", "Yarn's registry proxy is broken, replacing with public npm registry"); ++ this.logger.warn("", "If you don't have an npm token, you should exit and run `npm login`"); ++ this.conf.set("registry", "https://registry.npmjs.org/", "cli"); ++ } ++ const distTag = this.getDistTag(); ++ if (distTag) { ++ this.conf.set("tag", distTag.trim(), "cli"); ++ } ++ this.hasRootedLeaf = !!this.projectGraph.nodes[this.project.manifest.name]; ++ if (this.hasRootedLeaf) { ++ this.logger.info("publish", "rooted leaf detected, skipping synthetic root lifecycles"); ++ } ++ this.runPackageLifecycle = createRunner(this.options); ++ this.runRootLifecycle = /^(pre|post)?publish$/.test(process.env.npm_lifecycle_event) ? (stage) => { ++ this.logger.warn("lifecycle", "Skipping root %j because it has already been called", stage); ++ } : (stage) => this.runPackageLifecycle(this.project.manifest, stage); ++ this.projectsWithPackage = Object.values(this.projectGraph.nodes).filter((node) => !!node.package); ++ this.projectsWithPackage.map((node) => { ++ const interpolateStr = (str) => { ++ const res = interpolate(str, { ++ projectRoot: node.data.root, ++ projectName: node.name, ++ workspaceRoot: this.project.rootPath ++ }); ++ this.logger.verbose( ++ "silly", ++ `Interpolated string "%s" for node "%s" to produce "%s"`, ++ str, ++ node.name, ++ res ++ ); ++ return res; ++ }; ++ const pkg2 = getPackage(node); ++ if (this.options.contents) { ++ pkg2.contents = this.options.contents; ++ } ++ if (pkg2.lernaConfig?.command?.publish?.directory) { ++ pkg2.contents = interpolateStr(pkg2.lernaConfig.command.publish.directory); ++ } else if (this.project.config.command?.publish?.["directory"]) { ++ pkg2.contents = interpolateStr(this.project.config.command.publish["directory"]); ++ } ++ if (pkg2.lernaConfig?.command?.publish?.assets) { ++ pkg2.lernaConfig.command.publish.assets = pkg2.lernaConfig.command.publish.assets.map( ++ (asset) => interpolateAsset(asset, interpolateStr) ++ ); ++ } else if (this.project.config.command?.publish?.["assets"]) { ++ const assets = this.project.config.command?.publish?.["assets"].map( ++ (asset) => interpolateAsset(asset, interpolateStr) ++ ); ++ pkg2.lernaConfig = pkg2.lernaConfig || {}; ++ pkg2.lernaConfig.command = pkg2.lernaConfig.command || {}; ++ pkg2.lernaConfig.command.publish = pkg2.lernaConfig.command.publish || {}; ++ pkg2.lernaConfig.command.publish.assets = assets; ++ } ++ }); ++ let result; ++ if (this.options.bump === "from-git") { ++ result = await this.detectFromGit(); ++ } else if (this.options.bump === "from-package") { ++ result = await this.detectFromPackage(); ++ } else if (this.options.canary) { ++ result = await this.detectCanaryVersions(); ++ } else { ++ result = await versionCommand(this.argv, { ++ projectFileMap: this.projectFileMap, ++ projectGraph: this.projectGraph ++ }); ++ } ++ if (!result) { ++ return false; ++ } ++ if (!result.updates.length) { ++ this.logger.success("", "No changed packages to publish"); ++ return false; ++ } ++ this.updates = this.filterPrivatePkgUpdates(result.updates); ++ this.updatesVersions = new Map(result.updatesVersions); ++ function interpolateAsset(asset, interpolationFn) { ++ if (typeof asset === "string") { ++ return interpolationFn(asset); ++ } ++ if (asset.from) { ++ asset.from = interpolationFn(asset.from); ++ } ++ if (asset.to) { ++ asset.to = interpolationFn(asset.to); ++ } ++ return asset; ++ } ++ this.packagesToPublish = this.updates.map((node) => getPackage(node)); ++ if (result.needsConfirmation) { ++ return this.confirmPublish(); ++ } ++ return true; ++ } ++ async execute() { ++ this.enableProgressBar(); ++ this.logger.info("publish", "Publishing packages to npm..."); ++ await this.prepareRegistryActions(); ++ await this.prepareLicenseActions(); ++ this.preparePrivatePackages(); ++ if (this.options.canary) { ++ await this.updateCanaryVersions(); ++ } ++ await this.resolveLocalDependencyLinks(); ++ await this.resolveWorkspaceDependencyLinks(); ++ this.annotateGitHead(); ++ await this.serializeChanges(); ++ await this.packUpdated(); ++ await this.publishPacked(); ++ this.restorePrivatePackages(); ++ await this.serializeChanges(); ++ if (this.gitReset) { ++ await this.resetChanges(); ++ } ++ if (this.options.tempTag) { ++ await this.npmUpdateAsLatest(); ++ } ++ const count = this.publishedPackages.length; ++ const publishedPackagesSorted = this.publishedPackages.sort((a, b) => a.name.localeCompare(b.name)); ++ if (!count) { ++ this.logger.success("", "All packages have already been published."); ++ return; ++ } ++ output("Successfully published:"); ++ if (this.options.summaryFile !== void 0) { ++ const filePath = this.getSummaryFilePath(); ++ const jsonObject = publishedPackagesSorted.map((pkg2) => { ++ return { ++ packageName: pkg2.name, ++ version: pkg2.version ++ }; ++ }); ++ output(jsonObject); ++ try { ++ import_node_fs2.default.writeFileSync(filePath, JSON.stringify(jsonObject)); ++ output("Publish summary created: ", filePath); ++ } catch (error) { ++ output("Failed to create the summary report", error); ++ } ++ } else { ++ const message = publishedPackagesSorted.map((pkg2) => ` - ${pkg2.name}@${pkg2.version}`); ++ output(message.join(import_node_os3.default.EOL)); ++ } ++ this.logger.success("published", "%d %s", count, count === 1 ? "package" : "packages"); ++ if (this.uniqueProvenanceUrls.size > 0) { ++ output("The following provenance transparency log entries were created during publishing:"); ++ const message = Array.from(this.uniqueProvenanceUrls).map((url2) => ` - ${url2}`); ++ output(message.join(import_node_os3.default.EOL)); ++ } ++ } ++ verifyWorkingTreeClean() { ++ return describeRef(this.execOpts).then(throwIfUncommitted); ++ } ++ async detectFromGit() { ++ const matchingPattern = this.project.isIndependent() ? "*@*" : `${this.tagPrefix}*.*.*`; ++ try { ++ await this.verifyWorkingTreeClean(); ++ } catch (err) { ++ if (err.failed && /git describe/.test(err.command)) { ++ this.logger.silly("EWORKINGTREE", err.message); ++ this.logger.notice("FYI", "Unable to verify working tree, proceed at your own risk"); ++ } else { ++ throw err; ++ } ++ } ++ const taggedPackageNames = await getCurrentTags(this.execOpts, matchingPattern); ++ let updates; ++ let updatesVersions; ++ if (!taggedPackageNames.length) { ++ this.logger.notice("from-git", "No tagged release found"); ++ updates = []; ++ } else if (this.project.isIndependent()) { ++ updates = []; ++ updatesVersions = []; ++ taggedPackageNames.forEach((tag) => { ++ const npaResult = (0, import_npm_package_arg10.default)(tag); ++ const node = this.projectsWithPackage.find((node2) => getPackage(node2).name === npaResult.name); ++ updates.push(node); ++ updatesVersions.push([node.name, getPackage(node).version || npaResult.rawSpec]); ++ }); ++ } else { ++ updates = await getProjectsWithTaggedPackages( ++ this.projectsWithPackage, ++ this.projectFileMap, ++ this.execOpts ++ ); ++ updatesVersions = updates.map((node) => [node.name, getPackage(node).version]); ++ } ++ updates = this.filterPrivatePkgUpdates(updates); ++ return { ++ updates, ++ updatesVersions, ++ needsConfirmation: true ++ }; ++ } ++ async detectFromPackage() { ++ try { ++ await this.verifyWorkingTreeClean(); ++ } catch (err) { ++ if (err.failed && /git describe/.test(err.command)) { ++ this.logger.silly("EWORKINGTREE", err.message); ++ this.logger.notice("FYI", "Unable to verify working tree, proceed at your own risk"); ++ process.exitCode = 0; ++ } else { ++ throw err; ++ } ++ } ++ let updates; ++ updates = await getProjectsWithUnpublishedPackages(this.projectsWithPackage, this.conf.snapshot); ++ updates = this.filterPrivatePkgUpdates(updates); ++ if (!updates.length) { ++ this.logger.notice("from-package", "No unpublished release found"); ++ } ++ const updatesVersions = updates.map((node) => [node.name, getPackage(node).version]); ++ return { ++ updates, ++ updatesVersions, ++ needsConfirmation: true ++ }; ++ } ++ async detectCanaryVersions() { ++ const { cwd } = this.execOpts; ++ const { ++ bump = "prepatch", ++ preid = "alpha", ++ ignoreChanges, ++ forcePublish, ++ includeMergedTags ++ } = this.options; ++ const release = bump.startsWith("pre") ? bump.replace("release", "patch") : `pre${bump}`; ++ try { ++ await this.verifyWorkingTreeClean(); ++ } catch (err) { ++ if (err.failed && /git describe/.test(err.command)) { ++ this.logger.silly("EWORKINGTREE", err.message); ++ this.logger.notice("FYI", "Unable to verify working tree, proceed at your own risk"); ++ } else { ++ throw err; ++ } ++ } ++ const updates = this.filterPrivatePkgUpdates( ++ collectProjectUpdates(this.projectsWithPackage, this.projectGraph, this.execOpts, { ++ bump: "prerelease", ++ canary: true, ++ ignoreChanges, ++ forcePublish, ++ includeMergedTags ++ }) ++ ); ++ const makeVersion = (fallback) => ({ lastVersion = fallback, refCount, sha }) => { ++ const nextVersion = import_semver9.default.inc( ++ lastVersion.replace(this.tagPrefix, ""), ++ release.replace("pre", "") ++ ); ++ return `${nextVersion}-${preid}.${Math.max(0, refCount - 1)}+${sha}`; ++ }; ++ let updatesVersions; ++ if (this.project.isIndependent()) { ++ updatesVersions = await (0, import_p_map10.default)( ++ updates, ++ (node) => describeRef( ++ { ++ match: `${getPackage(node).name}@*`, ++ cwd ++ }, ++ includeMergedTags ++ ).then(makeVersion(getPackage(node).version)).then((version) => [node.name, version]) ++ ); ++ } else { ++ updatesVersions = await describeRef( ++ { ++ match: `${this.tagPrefix}*.*.*`, ++ cwd ++ }, ++ includeMergedTags ++ ).then(makeVersion(this.project.version)).then((version) => updates.map((node) => [node.name, version])); ++ } ++ return { ++ updates, ++ updatesVersions, ++ needsConfirmation: true ++ }; ++ } ++ confirmPublish() { ++ const count = this.updates.length; ++ const message = this.updates.map((node) => { ++ const pkg2 = getPackage(node); ++ const version = this.updatesVersions.get(node.name); ++ return ` - ${pkg2.name} => ${version}${pkg2.private ? " (private!)" : ""}`; ++ }); ++ output(""); ++ output(`Found ${count} ${count === 1 ? "package" : "packages"} to publish:`); ++ output(message.join(import_node_os3.default.EOL)); ++ output(""); ++ if (this.options.yes) { ++ this.logger.info("auto-confirmed", ""); ++ return true; ++ } ++ return promptConfirmation("Are you sure you want to publish these packages?"); ++ } ++ preparePrivatePackages() { ++ this.privatePackagesToPublish = []; ++ this.packagesToPublish.forEach((pkg2) => { ++ if (pkg2.private) { ++ pkg2.removePrivate(); ++ this.privatePackagesToPublish.push(pkg2); ++ } ++ }); ++ } ++ restorePrivatePackages() { ++ this.privatePackagesToPublish.forEach((pkg2) => { ++ pkg2.private = true; ++ }); ++ } ++ async prepareLicenseActions() { ++ const packagesWithoutLicense = await getPackagesWithoutLicense(this.project, this.packagesToPublish); ++ if (packagesWithoutLicense.length && !this.project.licensePath) { ++ this.packagesToBeLicensed = []; ++ const names = packagesWithoutLicense.map((pkg2) => pkg2.name); ++ const noun = names.length > 1 ? "Packages" : "Package"; ++ const verb = names.length > 1 ? "are" : "is"; ++ const list3 = names.length > 1 ? `${names.slice(0, -1).join(", ")}${names.length > 2 ? "," : ""} and ${names[names.length - 1]}` : names[0]; ++ this.logger.warn( ++ "ENOLICENSE", ++ "%s %s %s missing a license.\n%s\n%s", ++ noun, ++ list3, ++ verb, ++ "One way to fix this is to add a LICENSE.md file to the root of this repository.", ++ "See https://choosealicense.com for additional guidance." ++ ); ++ } else { ++ this.packagesToBeLicensed = packagesWithoutLicense; ++ } ++ } ++ async prepareRegistryActions() { ++ if (this.conf.get("registry") !== "https://registry.npmjs.org/") { ++ this.logger.notice("", "Skipping all user and access validation due to third-party registry"); ++ this.logger.notice("", "Make sure you're authenticated properly \xAF\\_(\u30C4)_/\xAF"); ++ return; ++ } ++ if (process.env.LERNA_INTEGRATION) { ++ return; ++ } ++ if (this.verifyAccess) { ++ const username = await getNpmUsername(this.conf.snapshot); ++ if (username) { ++ await verifyNpmPackageAccess(this.packagesToPublish, username, this.conf.snapshot); ++ } ++ this.twoFactorAuthRequired = await getTwoFactorAuthRequired(this.conf.snapshot); ++ } ++ } ++ async updateCanaryVersions() { ++ await (0, import_p_map10.default)(this.updates, (node) => { ++ const pkg2 = getPackage(node); ++ pkg2.set("version", this.updatesVersions.get(node.name)); ++ const dependencies = this.projectGraph.localPackageDependencies[node.name] || []; ++ dependencies.forEach((dep) => { ++ const depPkg = getPackage(this.projectGraph.nodes[dep.target]); ++ const depVersion = this.updatesVersions.get(dep.target) || depPkg.version; ++ pkg2.updateLocalDependency(dep.targetResolvedNpaResult, depVersion, this.savePrefix); ++ }); ++ }); ++ } ++ async resolveLocalDependencyLinks() { ++ const updatesWithLocalLinks = this.updates.filter((node) => { ++ const dependencies = this.projectGraph.localPackageDependencies[node.name] || []; ++ return dependencies.some((dep) => dep.targetResolvedNpaResult.type === "directory"); ++ }); ++ await (0, import_p_map10.default)(updatesWithLocalLinks, (node) => { ++ const pkg2 = getPackage(node); ++ const dependencies = this.projectGraph.localPackageDependencies[node.name] || []; ++ dependencies.forEach((dep) => { ++ const depPkg = getPackage(this.projectGraph.nodes[dep.target]); ++ const depVersion = this.updatesVersions.get(dep.target) || depPkg.version; ++ pkg2.updateLocalDependency(dep.targetResolvedNpaResult, depVersion, this.savePrefix); ++ }); ++ }); ++ } ++ async resolveWorkspaceDependencyLinks() { ++ const updatesWithWorkspaceLinks = this.updates.filter((node) => { ++ const dependencies = this.projectGraph.localPackageDependencies[node.name] || []; ++ return dependencies.some((dep) => !!dep.targetResolvedNpaResult.workspaceSpec); ++ }); ++ await (0, import_p_map10.default)(updatesWithWorkspaceLinks, (node) => { ++ const pkg2 = getPackage(node); ++ const dependencies = this.projectGraph.localPackageDependencies[node.name] || []; ++ dependencies.forEach((dep) => { ++ const depPkg = getPackage(this.projectGraph.nodes[dep.target]); ++ const resolved = dep.targetResolvedNpaResult; ++ if (resolved.workspaceSpec) { ++ let depVersion; ++ let savePrefix; ++ if (resolved.workspaceAlias) { ++ depVersion = this.updatesVersions.get(dep.target) || depPkg.version; ++ savePrefix = resolved.workspaceAlias === "*" ? "" : resolved.workspaceAlias; ++ } else { ++ const specMatch = resolved.workspaceSpec.match(/^workspace:([~^]?)(.*)/); ++ savePrefix = specMatch[1]; ++ depVersion = this.updatesVersions.get(dep.target) || depPkg.version; ++ } ++ pkg2.updateLocalDependency(resolved, depVersion, savePrefix, { eraseWorkspacePrefix: true }); ++ } ++ }); ++ }); ++ } ++ annotateGitHead() { ++ try { ++ const gitHead = this.options.gitHead || getCurrentSHA(this.execOpts); ++ for (const pkg2 of this.packagesToPublish) { ++ pkg2.set("gitHead", gitHead); ++ } ++ } catch (err) { ++ this.logger.silly("EGITHEAD", err.message); ++ this.logger.notice( ++ "FYI", ++ "Unable to set temporary gitHead property, it will be missing from registry metadata" ++ ); ++ } ++ } ++ async serializeChanges() { ++ await (0, import_p_map10.default)(this.packagesToPublish, (pkg2) => pkg2.serialize()); ++ } ++ async resetChanges() { ++ const _workspaceRoot = process.env["NX_WORKSPACE_ROOT_PATH"] || import_devkit9.workspaceRoot; ++ const gitOpts = { ++ granularPathspec: this.options.granularPathspec !== false ++ }; ++ const dirtyManifests = [this.project.manifest].concat(this.packagesToPublish).map((pkg2) => import_node_path.default.relative(_workspaceRoot, pkg2.manifestLocation)); ++ try { ++ await gitCheckout(dirtyManifests, gitOpts, this.execOpts); ++ } catch (err) { ++ this.logger.silly("EGITCHECKOUT", err.message); ++ this.logger.notice("FYI", "Unable to reset working tree changes, this probably isn't a git repo."); ++ } ++ } ++ execScript(pkg2, script) { ++ const scriptLocation = import_node_path.default.join(pkg2.location, "scripts", script); ++ try { ++ require(scriptLocation); ++ } catch (ex) { ++ this.logger.silly("execScript", `No ${script} script found at ${scriptLocation}`); ++ } ++ return pkg2; ++ } ++ async removeTempLicensesOnError() { ++ await removeTempLicenses(this.packagesToBeLicensed).catch((removeError) => { ++ this.logger.error( ++ "licenses", ++ "error removing temporary license files", ++ removeError.stack || removeError ++ ); ++ }); ++ } ++ async requestOneTimePassword() { ++ if (this.otpCache.otp) { ++ return; ++ } ++ const otp = await getOneTimePassword("Enter OTP:"); ++ this.otpCache.otp = otp; ++ } ++ topoMapPackages(mapper) { ++ return runProjectsTopologically(this.updates, this.projectGraph, (node) => mapper(getPackage(node)), { ++ concurrency: this.concurrency, ++ rejectCycles: this.options.rejectCycles ++ }); ++ } ++ async packUpdated() { ++ const tracker = this.logger.newItem("npm pack"); ++ tracker.addWork(this.packagesToPublish.length); ++ await createTempLicenses(this.project.licensePath, this.packagesToBeLicensed); ++ if (!this.hasRootedLeaf) { ++ await this.runRootLifecycle("prepublish"); ++ await this.runPackageLifecycle(this.project.manifest, "prepare"); ++ await this.runPackageLifecycle(this.project.manifest, "prepublishOnly"); ++ await this.runPackageLifecycle(this.project.manifest, "prepack"); ++ } ++ const opts = this.conf.snapshot; ++ const mapper = (0, import_p_pipe.default)( ++ ...[ ++ this.options.requireScripts && ((pkg2) => this.execScript(pkg2, "prepublish")), ++ (pkg2) => this.copyAssets(pkg2).then(() => pkg2), ++ (pkg2) => pulseTillDone(packDirectory(pkg2, pkg2.location, opts)).then((packed) => { ++ tracker.verbose("packed", import_node_path.default.relative(this.project.rootPath, pkg2.contents)); ++ tracker.completeWork(1); ++ pkg2.packed = packed; ++ return pkg2.refresh(); ++ }) ++ ].filter(Boolean) ++ ); ++ if (this.toposort) { ++ await this.topoMapPackages(mapper).catch((err) => { ++ this.removeTempLicensesOnError(); ++ throw err; ++ }); ++ } else { ++ await (0, import_p_map10.default)(this.packagesToPublish, mapper, { concurrency: this.concurrency }); ++ } ++ await removeTempLicenses(this.packagesToBeLicensed); ++ if (!this.hasRootedLeaf) { ++ await this.runPackageLifecycle(this.project.manifest, "postpack"); ++ } ++ tracker.finish(); ++ } ++ async publishPacked() { ++ this.publishedPackages = []; ++ const tracker = this.logger.newItem("publish"); ++ tracker.addWork(this.packagesToPublish.length); ++ let chain = Promise.resolve(); ++ if (this.twoFactorAuthRequired) { ++ chain = chain.then(() => this.requestOneTimePassword()); ++ } ++ const opts = Object.assign(this.conf.snapshot, { ++ // distTag defaults to "latest" OR whatever is in pkg.publishConfig.tag ++ // if we skip temp tags we should tag with the proper value immediately ++ tag: this.options.tempTag ? "lerna-temp" : this.conf.get("tag") ++ }); ++ const logListener = (...args) => { ++ const str = args.join(" "); ++ if (str.toLowerCase().includes("provenance statement") && str.includes("https://")) { ++ const url2 = str.match(/https:\/\/[^ ]+/)[0]; ++ this.uniqueProvenanceUrls.add(url2); ++ } ++ }; ++ process.on("log", logListener); ++ let queue2 = void 0; ++ if (this.options.throttle) { ++ const DEFAULT_QUEUE_THROTTLE_SIZE = 25; ++ const DEFAULT_QUEUE_THROTTLE_DELAY = 30; ++ queue2 = new TailHeadQueue( ++ this.options.throttleSize !== void 0 ? this.options.throttleSize : DEFAULT_QUEUE_THROTTLE_SIZE, ++ (this.options.throttleDelay !== void 0 ? this.options.throttleDelay : DEFAULT_QUEUE_THROTTLE_DELAY) * 1e3 ++ ); ++ } ++ const mapper = (0, import_p_pipe.default)( ++ ...[ ++ (pkg2) => { ++ const preDistTag = this.getPreDistTag(pkg2); ++ const tag = !this.options.tempTag && preDistTag ? preDistTag : opts.tag; ++ const pkgOpts = Object.assign({}, opts, { tag }); ++ return pulseTillDone( ++ queue2 ? queue2.queue(() => npmPublish(pkg2, pkg2.packed.tarFilePath, pkgOpts, this.conf, this.otpCache)) : npmPublish(pkg2, pkg2.packed.tarFilePath, pkgOpts, this.conf, this.otpCache) ++ ).then(() => { ++ this.publishedPackages.push(pkg2); ++ tracker.success("published", pkg2.name, pkg2.version); ++ tracker.completeWork(1); ++ logPacked(pkg2.packed); ++ return pkg2; ++ }).catch((err) => { ++ if (err.code === "E409" || err.code === "EPUBLISHCONFLICT" || err.code === "E403" && err.body?.error?.includes("You cannot publish over the previously published versions")) { ++ tracker.warn("publish", `Package is already published: ${pkg2.name}@${pkg2.version}`); ++ tracker.completeWork(1); ++ return pkg2; ++ } ++ this.logger.silly("", err); ++ this.logger.warn("notice", `Package failed to publish: ${pkg2.name}`); ++ this.logger.error(err.code, err.body && err.body.error || err.message); ++ err.name = "ValidationError"; ++ if ("errno" in err && typeof err.errno === "number" && Number.isFinite(err.errno)) { ++ process.exitCode = err.errno; ++ } else { ++ this.logger.error("", `errno "${err.errno}" is not a valid exit code - exiting with code 1`); ++ process.exitCode = 1; ++ } ++ throw err; ++ }); ++ }, ++ this.options.requireScripts && ((pkg2) => this.execScript(pkg2, "postpublish")) ++ ].filter(Boolean) ++ ); ++ chain = chain.then(() => { ++ if (this.toposort) { ++ return this.topoMapPackages(mapper); ++ } else { ++ return (0, import_p_map10.default)(this.packagesToPublish, mapper, { concurrency: this.concurrency }); ++ } ++ }); ++ if (!this.hasRootedLeaf) { ++ chain = chain.then(() => this.runRootLifecycle("publish")); ++ chain = chain.then(() => this.runRootLifecycle("postpublish")); ++ } ++ return chain.finally(() => { ++ process.removeListener("log", logListener); ++ tracker.finish(); ++ }); ++ } ++ async npmUpdateAsLatest() { ++ const tracker = this.logger.newItem("npmUpdateAsLatest"); ++ tracker.addWork(this.updates.length); ++ tracker.showProgress(); ++ const opts = this.conf.snapshot; ++ const getDistTag = (publishConfig) => { ++ if (opts.tag === "latest" && publishConfig && publishConfig.tag) { ++ return publishConfig.tag; ++ } ++ return opts.tag; ++ }; ++ const mapper = (pkg2) => { ++ const spec = `${pkg2.name}@${pkg2.version}`; ++ const preDistTag = this.getPreDistTag(pkg2); ++ const distTag = preDistTag || getDistTag(pkg2.get("publishConfig")); ++ return Promise.resolve().then(() => pulseTillDone(npmDistTag.remove(spec, "lerna-temp", opts, this.otpCache))).then(() => pulseTillDone(npmDistTag.add(spec, distTag, opts, this.otpCache))).then(() => { ++ tracker.success("dist-tag", "%s@%s => %j", pkg2.name, pkg2.version, distTag); ++ tracker.completeWork(1); ++ return pkg2; ++ }); ++ }; ++ if (this.toposort) { ++ await this.topoMapPackages(mapper); ++ } else { ++ await (0, import_p_map10.default)(this.packagesToPublish, mapper, { concurrency: this.concurrency }); ++ } ++ tracker.finish(); ++ } ++ getDistTag() { ++ if (this.options.distTag) { ++ return this.options.distTag; ++ } ++ if (this.options.canary) { ++ return "canary"; ++ } ++ return void 0; ++ } ++ getPreDistTag(pkg2) { ++ if (!this.options.preDistTag) { ++ return; ++ } ++ const isPrerelease = prereleaseIdFromVersion(pkg2.version); ++ if (isPrerelease) { ++ return this.options.preDistTag; ++ } ++ } ++ // filter out private packages, respecting the --include-private option ++ filterPrivatePkgUpdates(updates) { ++ const privatePackagesToInclude = new Set(this.options.includePrivate || []); ++ return updates.filter( ++ (node) => !getPackage(node).private || privatePackagesToInclude.has("*") || privatePackagesToInclude.has(getPackage(node).name) ++ ); ++ } ++ async copyAssets(pkg2) { ++ if (!pkg2.lernaConfig?.command?.publish?.assets) { ++ return; ++ } ++ if ((0, import_node_path.normalize)(pkg2.location) === (0, import_node_path.normalize)(pkg2.contents)) { ++ return; ++ } ++ const _workspaceRoot = process.env["NX_WORKSPACE_ROOT_PATH"] || import_devkit9.workspaceRoot; ++ const assets = pkg2.lernaConfig?.command?.publish?.assets; ++ const filesToCopy = []; ++ const getFiles = (assetGlob) => (0, import_tinyglobby3.glob)(assetGlob, { ++ cwd: pkg2.location, ++ onlyFiles: false, ++ expandDirectories: false ++ }); ++ for (const asset of assets) { ++ if (typeof asset === "string") { ++ const files = await getFiles(asset); ++ this.logger.verbose("publish", "Expanded asset glob %s into files %j", asset, files); ++ for (const file of files) { ++ filesToCopy.push({ ++ from: (0, import_node_path.join)(pkg2.location, file), ++ to: (0, import_node_path.join)(pkg2.contents, file) ++ }); ++ } ++ } else if (asset.from && typeof asset.from === "string" && asset.to && typeof asset.to === "string") { ++ const files = await getFiles(asset.from); ++ this.logger.verbose("publish", "Expanded asset glob %s into files %j", asset.from, files); ++ for (const file of files) { ++ filesToCopy.push({ ++ from: (0, import_node_path.join)(pkg2.location, file), ++ to: (0, import_node_path.join)(pkg2.contents, asset.to, (0, import_node_path.basename)(file)) ++ }); ++ } ++ } else { ++ throw new ValidationError( ++ "EINVALIDASSETS", ++ "Asset configuration must be a plain string or object with both `from` and `to` string properties." ++ ); ++ } ++ } ++ for (const file of filesToCopy) { ++ if ((0, import_node_path.normalize)(file.from) === (0, import_node_path.normalize)(file.to)) { ++ this.logger.warn( ++ "EPUBLISHASSET", ++ "Asset %s is already in package directory", ++ file.from.replace(`${_workspaceRoot}/`, "") ++ ); ++ } else if ((0, import_node_fs2.existsSync)(file.from)) { ++ this.logger.verbose( ++ "publish", ++ "Copying asset %s to %s", ++ file.from.replace(`${_workspaceRoot}/`, ""), ++ file.to.replace(`${_workspaceRoot}/`, "") ++ ); ++ await (0, import_fs_extra17.copy)(file.from, file.to); ++ } else { ++ this.logger.warn( ++ "EPUBLISHASSET", ++ "Asset %s does not exist", ++ file.from.replace(`${_workspaceRoot}/`, "") ++ ); ++ } ++ } ++ } ++ getSummaryFilePath() { ++ if (this.options.summaryFile === void 0) { ++ throw new Error("summaryFile options is not defined. Unable to get path."); ++ } ++ if (this.options.summaryFile === "") { ++ return import_node_path.default.join(process.cwd(), "./lerna-publish-summary.json"); ++ } ++ const normalizedPath = import_node_path.default.normalize(this.options.summaryFile); ++ if (normalizedPath === "") { ++ throw new Error("summaryFile is not a valid path."); ++ } ++ if (normalizedPath.endsWith(".json")) { ++ return import_node_path.default.join(process.cwd(), normalizedPath); ++ } ++ return import_node_path.default.join(process.cwd(), normalizedPath, "lerna-publish-summary.json"); ++ } ++ }; ++ module2.exports.PublishCommand = PublishCommand; ++ } ++}); ++ ++// libs/commands/publish/src/command.ts ++var require_command11 = __commonJS({ ++ "libs/commands/publish/src/command.ts"(exports2, module2) { ++ "use strict"; ++ init_src2(); ++ var versionCommand = require_command10(); ++ function composeVersionOptions(yargs2) { ++ versionCommand.addBumpPositional(yargs2, ["from-git", "from-package"]); ++ versionCommand.builder(yargs2, "publish"); ++ return yargs2; ++ } ++ var command = { ++ command: "publish [bump]", ++ describe: "Publish packages in the current project", ++ builder(yargs2) { ++ const opts = { ++ c: { ++ describe: "Publish packages after every successful merge using the sha as part of the tag.", ++ alias: "canary", ++ type: "boolean" ++ }, ++ // preid is copied from ../version/command because a whitelist for one option isn't worth it ++ preid: { ++ describe: "Specify the prerelease identifier when publishing a prerelease", ++ type: "string", ++ requiresArg: true, ++ defaultDescription: "alpha" ++ }, ++ contents: { ++ describe: "Subdirectory to publish. Must apply to ALL packages.", ++ type: "string", ++ requiresArg: true, ++ defaultDescription: "." ++ }, ++ "dist-tag": { ++ describe: "Publish packages with the specified npm dist-tag", ++ type: "string", ++ requiresArg: true ++ }, ++ "legacy-auth": { ++ describe: "Legacy Base64 Encoded username and password.", ++ type: "string" ++ }, ++ "pre-dist-tag": { ++ describe: "Publish prerelease packages with the specified npm dist-tag", ++ type: "string", ++ requiresArg: true ++ }, ++ "git-head": { ++ describe: "Explicit SHA to set as gitHead when packing tarballs, only allowed with 'from-package' positional.", ++ type: "string", ++ requiresArg: true ++ }, ++ "graph-type": { ++ describe: "Type of dependency to use when determining package hierarchy.", ++ choices: ["all", "dependencies"], ++ defaultDescription: "dependencies" ++ }, ++ "ignore-prepublish": { ++ describe: "Disable deprecated 'prepublish' lifecycle script", ++ type: "boolean" ++ }, ++ "ignore-scripts": { ++ describe: "Disable all lifecycle scripts", ++ type: "boolean" ++ }, ++ // TODO: (major) make --no-granular-pathspec the default ++ "no-granular-pathspec": { ++ describe: "Do not reset changes file-by-file, but globally.", ++ type: "boolean" ++ }, ++ "granular-pathspec": { ++ // proxy for --no-granular-pathspec ++ hidden: true, ++ // describe: "Reset changes file-by-file, not globally.", ++ type: "boolean" ++ }, ++ otp: { ++ describe: "Supply a one-time password for publishing with two-factor authentication.", ++ type: "string", ++ requiresArg: true ++ }, ++ registry: { ++ describe: "Use the specified registry for all npm client operations.", ++ type: "string", ++ requiresArg: true ++ }, ++ "require-scripts": { ++ describe: "Execute ./scripts/prepublish.js and ./scripts/postpublish.js, relative to package root.", ++ type: "boolean" ++ }, ++ "no-git-reset": { ++ describe: "Do not reset changes to working tree after publishing is complete.", ++ type: "boolean" ++ }, ++ "git-reset": { ++ // proxy for --no-git-reset ++ hidden: true, ++ type: "boolean" ++ }, ++ "temp-tag": { ++ describe: "Create a temporary tag while publishing.", ++ type: "boolean" ++ }, ++ throttle: { ++ describe: "Throttle module publication. This is implicit if a throttle size or delay is provided", ++ type: "boolean" ++ }, ++ "throttle-size": { ++ describe: "Bucket size used to throttle module publication.", ++ type: "number" ++ }, ++ "throttle-delay": { ++ describe: "Delay between throttle bucket items publications (in seconds).", ++ type: "number" ++ }, ++ "no-verify-access": { ++ // proxy for --verify-access ++ describe: "Do not verify package read-write access for current npm user.", ++ type: "boolean" ++ }, ++ "verify-access": { ++ describe: "Verify package read-write access for current npm user.", ++ type: "boolean" ++ }, ++ "summary-file": { ++ // generate lerna publish json output. ++ describe: "Generate a json summary report after all packages have been successfully published, you can pass an optional path for where to save the file.", ++ type: "string" ++ }, ++ "include-private": { ++ describe: "Include specified private packages when publishing by temporarily removing the private property from the package manifest. This should only be used for testing private packages that will become public. Private packages should not usually be published. See the npm docs for details (https://docs.npmjs.com/cli/v9/configuring-npm/package-json#private).", ++ type: "array" ++ } ++ }; ++ composeVersionOptions(yargs2); ++ yargs2.options(opts); ++ const { hiddenOptions } = yargs2.getOptions(); ++ const sharedKeys = ["preid", "y", "ignore-scripts"]; ++ for (const sharedKey of sharedKeys) { ++ hiddenOptions.splice( ++ hiddenOptions.findIndex((k) => k === sharedKey), ++ 1 ++ ); ++ } ++ yargs2.group(Object.keys(opts).concat(sharedKeys), "Command Options:"); ++ return yargs2.option("npm-tag", { ++ // TODO: remove in next major release ++ hidden: true, ++ conflicts: "dist-tag", ++ type: "string", ++ requiresArg: true ++ }).option("verify-registry", { ++ // TODO: remove in next major release ++ hidden: true, ++ type: "boolean" ++ }).option("skip-npm", { ++ // TODO: remove in next major release ++ // deprecation notice handled in initialize() ++ hidden: true, ++ type: "boolean" ++ }).check((argv) => { ++ if (argv["npmTag"]) { ++ argv["distTag"] = argv["npmTag"]; ++ argv["dist-tag"] = argv["npmTag"]; ++ delete argv["npmTag"]; ++ delete argv["npm-tag"]; ++ npmlog_default.warn("deprecated", "--npm-tag has been renamed --dist-tag"); ++ } ++ return argv; ++ }).middleware((args) => { ++ const { includePrivate } = args; ++ if (includePrivate && Array.isArray(includePrivate)) { ++ args["includePrivate"] = includePrivate.reduce((acc, pkg2) => [...acc, ...pkg2.split(/[\s,]/)], []); ++ } ++ }, true); ++ }, ++ handler(argv) { ++ return require_src4()(argv); ++ } ++ }; ++ module2.exports = command; ++ } ++}); ++ ++// libs/commands/run/src/index.ts ++function factory8(argv) { ++ return new RunCommand(argv); ++} ++var import_fs_extra16, import_run_many, import_run_one, import_p_map9, import_path26, import_perf_hooks, RunCommand; ++var init_src11 = __esm({ ++ "libs/commands/run/src/index.ts"() { ++ "use strict"; ++ init_src2(); ++ import_fs_extra16 = require("fs-extra"); ++ import_run_many = require("nx/src/command-line/run-many/run-many"); ++ import_run_one = require("nx/src/command-line/run/run-one"); ++ import_p_map9 = __toESM(require("p-map")); ++ import_path26 = __toESM(require("path")); ++ import_perf_hooks = require("perf_hooks"); ++ RunCommand = class extends Command { ++ script = ""; ++ args; ++ npmClient; ++ bail; ++ prefix; ++ projectsWithScript = []; ++ count; ++ packagePlural; ++ joinedCommand; ++ get requiresGit() { ++ return false; ++ } ++ async initialize() { ++ const { script, npmClient = "npm", bail, prefix } = this.options; ++ this.script = script; ++ this.args = this.options["--"] || []; ++ this.npmClient = npmClient; ++ if (!this.script) { ++ throw new ValidationError("ENOSCRIPT", "You must specify a lifecycle script to run"); ++ } ++ if (this.argv.npmClient && this.options.useNx !== false) { ++ throw new ValidationError( ++ "run", ++ "The legacy task runner option `--npm-client` is not currently supported. Please open an issue on https://github.com/lerna/lerna if you require this feature." ++ ); ++ } ++ if (Array.isArray(this.script) && this.options.useNx === false) { ++ throw new ValidationError( ++ "run", ++ "The legacy task runner does not support running multiple scripts concurrently. Please update to the latest version of lerna and ensure you do not have useNx set to false in your lerna.json." ++ ); ++ } ++ this.bail = bail !== false; ++ this.prefix = prefix !== false; ++ const filteredProjects = filterProjects(this.projectGraph, this.execOpts, this.options); ++ this.projectsWithScript = script === "env" ? filteredProjects : filteredProjects.filter((project) => { ++ if (Array.isArray(this.script)) { ++ return this.script.some((scriptName) => project.data.targets?.[scriptName]); ++ } ++ return project.data.targets?.[this.script ?? ""]; ++ }); ++ this.count = this.projectsWithScript.length; ++ this.packagePlural = this.count === 1 ? "package" : "packages"; ++ this.joinedCommand = [this.npmClient, "run", this.script].concat(this.args).join(" "); ++ if (!this.count) { ++ this.logger.success("run", `No packages found with the lifecycle script '${script}'`); ++ return false; ++ } ++ return true; ++ } ++ async execute() { ++ if (this.options.useNx === false) { ++ this.logger.info( ++ "", ++ "Executing command in %d %s: %j", ++ this.count, ++ this.packagePlural, ++ this.joinedCommand ++ ); ++ } ++ const getElapsed = timer(); ++ let runScripts; ++ if (this.options.useNx !== false) { ++ runScripts = () => this.runScriptsUsingNx(); ++ } else if (this.options.parallel) { ++ runScripts = () => this.runScriptInPackagesParallel(); ++ } else if (this.toposort) { ++ runScripts = () => this.runScriptInPackagesTopological(); ++ } else { ++ runScripts = () => this.runScriptInPackagesLexical(); ++ } ++ if (this.bail) { ++ try { ++ await runScripts(); ++ } catch (err) { ++ process.exitCode = err.exitCode; ++ throw err; ++ } ++ } else { ++ const results = await runScripts(); ++ if (results.some((result) => result.failed)) { ++ const codes = results.filter((result) => result.failed).map((result) => result.exitCode); ++ const exitCode = Math.max(...codes, 1); ++ this.logger.error("", "Received non-zero exit code %d during execution", exitCode); ++ process.exitCode = exitCode; ++ } ++ } ++ this.logger.success( ++ "run", ++ "Ran npm script '%s' in %d %s in %ss:", ++ this.script, ++ this.count, ++ this.packagePlural, ++ (getElapsed() / 1e3).toFixed(1) ++ ); ++ this.logger.success("", this.projectsWithScript.map((p) => `- ${getPackage(p).name}`).join("\n")); ++ } ++ getOpts(pkg2) { ++ return { ++ args: this.args, ++ npmClient: this.npmClient, ++ prefix: this.prefix, ++ reject: this.bail, ++ pkg: pkg2 ++ }; ++ } ++ getRunner() { ++ return this.options.stream ? (pkg2) => this.runScriptInPackageStreaming(pkg2) : (pkg2) => this.runScriptInPackageCapturing(pkg2); ++ } ++ runScriptInPackagesTopological() { ++ let profiler; ++ let runner; ++ if (this.options.profile) { ++ profiler = new Profiler({ ++ concurrency: this.concurrency, ++ log: this.logger, ++ outputDirectory: this.options.profileLocation ++ }); ++ const callback = this.getRunner(); ++ runner = (pkg2) => profiler.run(() => callback(pkg2), pkg2.name); ++ } else { ++ runner = this.getRunner(); ++ } ++ let chain = runProjectsTopologically( ++ this.projectsWithScript, ++ this.projectGraph, ++ (p) => runner(getPackage(p)), ++ { ++ concurrency: this.concurrency, ++ rejectCycles: this.options.rejectCycles ++ } ++ ); ++ if (profiler) { ++ chain = chain.then((results) => profiler.output().then(() => results)); ++ } ++ return chain; ++ } ++ runScriptInPackagesParallel() { ++ return (0, import_p_map9.default)(this.projectsWithScript, (p) => this.runScriptInPackageStreaming(getPackage(p))); ++ } ++ runScriptInPackagesLexical() { ++ return (0, import_p_map9.default)(this.projectsWithScript, (p) => this.getRunner()(getPackage(p)), { ++ concurrency: this.concurrency ++ }); ++ } ++ runScriptInPackageStreaming(pkg2) { ++ return npmRunScriptStreaming(this.script, this.getOpts(pkg2)); ++ } ++ runScriptInPackageCapturing(pkg2) { ++ const getElapsed = timer(); ++ return npmRunScript(this.script, this.getOpts(pkg2)).then((result) => { ++ this.logger.info( ++ "run", ++ "Ran npm script '%s' in '%s' in %ss:", ++ this.script, ++ pkg2.name, ++ (getElapsed() / 1e3).toFixed(1) ++ ); ++ output(result.stdout); ++ return result; ++ }); ++ } ++ async runScriptsUsingNx() { ++ if (this.options.ci) { ++ process.env["CI"] = "true"; ++ } ++ if (this.options.profile) { ++ const absolutePath = generateProfileOutputPath(this.options.profileLocation); ++ process.env["NX_PROFILE"] = import_path26.default.relative(this.project.rootPath, absolutePath); ++ } ++ import_perf_hooks.performance.mark("init-local"); ++ this.configureNxOutput(); ++ const { targetDependencies, options, extraOptions } = await this.prepNxOptions(); ++ if (this.projectsWithScript.length === 1 && !Array.isArray(this.script)) { ++ const fullQualifiedTarget = this.projectsWithScript.map((p) => p.name)[0] + ":" + this.addQuotesAroundScriptNameIfItHasAColon(this.script); ++ return (0, import_run_one.runOne)( ++ process.cwd(), ++ { ++ "project:target:configuration": fullQualifiedTarget, ++ ...options ++ }, ++ targetDependencies, ++ extraOptions ++ ); ++ } else { ++ const projects = this.projectsWithScript.map((p) => p.name).join(","); ++ return (0, import_run_many.runMany)( ++ { ++ projects, ++ targets: Array.isArray(this.script) ? this.script : [this.script], ++ ...options ++ }, ++ targetDependencies, ++ extraOptions ++ ); ++ } ++ } ++ addQuotesAroundScriptNameIfItHasAColon(scriptName) { ++ if (scriptName.includes(":")) { ++ return `"${scriptName}"`; ++ } else { ++ return scriptName; ++ } ++ } ++ async prepNxOptions() { ++ const nxJsonExists = (0, import_fs_extra16.existsSync)(import_path26.default.join(this.project.rootPath, "nx.json")); ++ const { readNxJson } = require("nx/src/config/configuration"); ++ const nxJson = readNxJson(); ++ const targetDependenciesAreDefined = Object.keys(nxJson.targetDependencies || nxJson.targetDefaults || {}).length > 0; ++ const hasProjectSpecificNxConfiguration = this.projectsWithScript.some((p) => !!getPackage(p).get("nx")); ++ const hasCustomizedNxConfiguration = nxJsonExists && targetDependenciesAreDefined || hasProjectSpecificNxConfiguration; ++ const mimicLernaDefaultBehavior = !hasCustomizedNxConfiguration; ++ const targetDependencies = this.toposort && !this.options.parallel && mimicLernaDefaultBehavior && !Array.isArray(this.script) ? { ++ [this.script]: [ ++ { ++ dependencies: true, ++ target: this.script ++ } ++ ] ++ } : {}; ++ if (this.options.prefix === false && !this.options.stream) { ++ this.logger.warn(this.name, `"no-prefix" is ignored when not using streaming output.`); ++ } ++ const outputStyle = this.options.stream ? this.prefix ? "stream" : "stream-without-prefixes" : "dynamic"; ++ const options = { ++ outputStyle, ++ /** ++ * To match lerna's own behavior (via pMap's default concurrency), we set parallel to a very large number if ++ * the flag has been set (we can't use Infinity because that would cause issues with the task runner). ++ */ ++ parallel: this.options.parallel && mimicLernaDefaultBehavior ? 999 : this.concurrency, ++ nxBail: this.bail, ++ nxIgnoreCycles: !this.options.rejectCycles, ++ skipNxCache: this.options.skipNxCache, ++ verbose: this.options.verbose, ++ __overrides__: this.args?.map((t) => t.toString()) ++ }; ++ if (hasCustomizedNxConfiguration) { ++ this.logger.verbose( ++ this.name, ++ "Nx target configuration was found. Task dependencies will be automatically included." ++ ); ++ if (this.options.parallel || this.options.sort !== void 0) { ++ this.logger.warn( ++ this.name, ++ `"parallel", "sort", and "no-sort" are ignored when Nx targets are configured. See https://lerna.js.org/docs/lerna6-obsolete-options for details.` ++ ); ++ } ++ if (this.options.includeDependencies) { ++ this.logger.info( ++ this.name, ++ `Using the "include-dependencies" option when Nx targets are configured will include both task dependencies detected by Nx and project dependencies detected by Lerna. See https://lerna.js.org/docs/lerna6-obsolete-options#--include-dependencies for details.` ++ ); ++ } ++ if (this.options.ignore) { ++ this.logger.info( ++ this.name, ++ `Using the "ignore" option when Nx targets are configured will exclude only tasks that are not determined to be required by Nx. See https://lerna.js.org/docs/lerna6-obsolete-options#--ignore for details.` ++ ); ++ } ++ } else { ++ this.logger.verbose( ++ this.name, ++ "Nx target configuration was not found. Task dependencies will not be automatically included." ++ ); ++ } ++ const extraOptions = { ++ excludeTaskDependencies: mimicLernaDefaultBehavior, ++ loadDotEnvFiles: this.options.loadEnvFiles ?? true ++ }; ++ return { targetDependencies, options, extraOptions }; ++ } ++ configureNxOutput() { ++ try { ++ const nxOutput = require("nx/src/utils/output"); ++ nxOutput.output.cliName = "Lerna (powered by Nx)"; ++ nxOutput.output.formatCommand = (taskId) => taskId; ++ return nxOutput; ++ } catch (err) { ++ this.logger.error( ++ "\n", ++ "There was a critical error when configuring the task runner, please report this on https://github.com/lerna/lerna" ++ ); ++ throw err; ++ } ++ } ++ }; ++ } ++}); ++ ++// libs/commands/run/src/command.ts ++var require_command12 = __commonJS({ ++ "libs/commands/run/src/command.ts"(exports2, module2) { ++ "use strict"; ++ init_src2(); ++ init_src11(); ++ var command = { ++ command: "run