nx 23.1.0 → 23.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/nx.js +2 -1
- package/dist/release/changelog-renderer/index.js +4 -5
- package/dist/release/index.d.ts +1 -1
- package/dist/src/ai/configure-ai-agents-disclaimer.d.ts +5 -0
- package/dist/src/ai/configure-ai-agents-disclaimer.js +31 -0
- package/dist/src/analytics/analytics.d.ts +6 -0
- package/dist/src/analytics/analytics.js +16 -8
- package/dist/src/analytics/index.d.ts +1 -1
- package/dist/src/analytics/index.js +2 -1
- package/dist/src/command-line/add/add.js +13 -1
- package/dist/src/command-line/affected/affected.js +1 -0
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +2 -2
- package/dist/src/command-line/graph/graph.d.ts +1 -0
- package/dist/src/command-line/graph/graph.js +15 -6
- package/dist/src/command-line/import/import.js +2 -3
- package/dist/src/command-line/init/ai-agent-prompts.d.ts +1 -1
- package/dist/src/command-line/init/ai-agent-prompts.js +7 -6
- package/dist/src/command-line/init/command-object.js +10 -2
- package/dist/src/command-line/init/configure-plugins.js +3 -2
- package/dist/src/command-line/init/implementation/add-nx-to-monorepo.js +4 -2
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +4 -3
- package/dist/src/command-line/init/implementation/add-nx-to-npm-repo.js +4 -3
- package/dist/src/command-line/init/implementation/add-nx-to-turborepo.js +4 -3
- package/dist/src/command-line/init/implementation/angular/index.js +4 -2
- package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +2 -5
- package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +3 -0
- package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +4 -1
- package/dist/src/command-line/init/implementation/utils.d.ts +3 -3
- package/dist/src/command-line/init/implementation/utils.js +22 -3
- package/dist/src/command-line/init/init-v2.js +4 -5
- package/dist/src/command-line/migrate/execute-migration.d.ts +72 -0
- package/dist/src/command-line/migrate/execute-migration.js +389 -0
- package/dist/src/command-line/migrate/migrate-ui-api.js +17 -12
- package/dist/src/command-line/migrate/migrate.d.ts +5 -45
- package/dist/src/command-line/migrate/migrate.js +122 -402
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +1 -1
- package/dist/src/command-line/nx-cloud/connect/view-logs.js +2 -0
- package/dist/src/command-line/release/changelog.js +5 -0
- package/dist/src/command-line/release/index.d.ts +1 -1
- package/dist/src/command-line/release/utils/git.js +7 -3
- package/dist/src/command-line/release/utils/release-graph.d.ts +19 -2
- package/dist/src/command-line/release/utils/release-graph.js +71 -19
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +7 -1
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +1 -1
- package/dist/src/command-line/release/utils/shared.d.ts +2 -2
- package/dist/src/command-line/release/version/release-group-processor.d.ts +24 -0
- package/dist/src/command-line/release/version/release-group-processor.js +80 -6
- package/dist/src/command-line/release/version/version-actions.d.ts +27 -2
- package/dist/src/command-line/release/version/version-actions.js +9 -1
- package/dist/src/command-line/release/version.js +9 -5
- package/dist/src/command-line/reset/reset.js +6 -1
- package/dist/src/command-line/run/run-one.js +1 -0
- package/dist/src/command-line/run-many/run-many.js +1 -0
- package/dist/src/command-line/show/show-target/info.js +11 -2
- package/dist/src/command-line/show/show-target/inputs.js +50 -153
- package/dist/src/command-line/show/show-target/outputs.js +48 -173
- package/dist/src/command-line/show/show-target/utils.d.ts +28 -0
- package/dist/src/command-line/show/show-target/utils.js +83 -3
- package/dist/src/command-line/watch/watch.js +13 -0
- package/dist/src/command-line/yargs-utils/shared-options.d.ts +1 -1
- package/dist/src/commands-runner/create-command-graph.js +5 -0
- package/dist/src/config/nx-json.d.ts +5 -3
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.js +1 -1
- package/dist/src/daemon/client/client.d.ts +52 -3
- package/dist/src/daemon/client/client.js +177 -55
- package/dist/src/daemon/client/daemon-environment.d.ts +17 -0
- package/dist/src/daemon/client/daemon-environment.js +110 -2
- package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
- package/dist/src/daemon/message-types/daemon-message.d.ts +32 -0
- package/dist/src/daemon/message-types/daemon-message.js +25 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.d.ts +5 -0
- package/dist/src/daemon/server/file-watching/file-watcher-sockets.js +16 -0
- package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
- package/dist/src/daemon/server/latest-nx.js +5 -2
- package/dist/src/daemon/server/server.js +31 -4
- package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
- package/dist/src/daemon/server/shutdown-utils.js +11 -4
- package/dist/src/daemon/socket-utils.d.ts +1 -0
- package/dist/src/daemon/socket-utils.js +24 -3
- package/dist/src/daemon/tmp-dir.d.ts +43 -3
- package/dist/src/daemon/tmp-dir.js +437 -15
- package/dist/src/devkit-internals.d.ts +96 -3
- package/dist/src/devkit-internals.js +200 -4
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +5 -0
- package/dist/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +9 -2
- package/dist/src/generators/tree.d.ts +4 -2
- package/dist/src/generators/utils/nx-json.js +13 -3
- package/dist/src/hasher/check-task-files.d.ts +86 -0
- package/dist/src/hasher/check-task-files.js +378 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +12 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +250 -0
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +50 -0
- package/dist/src/native/index.d.ts +31 -2
- package/dist/src/native/index.js +71 -28
- package/dist/src/native/native-bindings.js +3 -0
- package/dist/src/native/native-file-cache-location.d.ts +17 -1
- package/dist/src/native/native-file-cache-location.js +86 -12
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/utilities/get-cloud-options.js +5 -2
- package/dist/src/nx-cloud/utilities/onboarding.js +5 -2
- package/dist/src/plugins/js/lock-file/bun-parser.js +43 -10
- package/dist/src/plugins/js/lock-file/npm-parser.js +71 -27
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +110 -17
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +15 -9
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -0
- package/dist/src/plugins/js/lock-file/yarn-parser.js +32 -5
- package/dist/src/plugins/js/project-graph/affected/npm-packages.js +51 -20
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +14 -4
- package/dist/src/plugins/js/utils/register.d.ts +18 -0
- package/dist/src/plugins/js/utils/register.js +81 -0
- package/dist/src/plugins/js/utils/typescript.d.ts +9 -0
- package/dist/src/plugins/js/utils/typescript.js +15 -0
- package/dist/src/project-graph/affected/affected-project-graph-models.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.d.ts +1 -1
- package/dist/src/project-graph/affected/affected-project-graph.js +2 -2
- package/dist/src/project-graph/affected/locators/project-glob-changes.js +5 -2
- package/dist/src/project-graph/build-project-graph.js +7 -1
- package/dist/src/project-graph/error-types.d.ts +12 -1
- package/dist/src/project-graph/error-types.js +68 -3
- package/dist/src/project-graph/file-utils.js +6 -1
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +22 -1
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
- package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
- package/dist/src/project-graph/plugins/loaded-nx-plugin.js +1 -0
- package/dist/src/project-graph/plugins/transpiler.js +4 -0
- package/dist/src/project-graph/project-graph.js +23 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +10 -12
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +93 -63
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +5 -8
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +16 -15
- package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +12 -5
- package/dist/src/project-graph/utils/project-configuration/source-maps.js +21 -7
- package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +26 -27
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +50 -8
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +149 -6
- package/dist/src/project-graph/utils/project-configuration/utils.d.ts +15 -0
- package/dist/src/project-graph/utils/project-configuration/utils.js +42 -6
- package/dist/src/project-graph/utils/project-configuration-utils.d.ts +15 -12
- package/dist/src/project-graph/utils/project-configuration-utils.js +79 -101
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +11 -4
- package/dist/src/tasks-runner/life-cycles/performance-analysis.js +15 -6
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +5 -4
- package/dist/src/tasks-runner/life-cycles/performance-report.d.ts +18 -8
- package/dist/src/tasks-runner/life-cycles/performance-report.js +66 -29
- package/dist/src/tasks-runner/run-command.js +4 -2
- package/dist/src/tasks-runner/task-env.d.ts +9 -0
- package/dist/src/tasks-runner/task-env.js +31 -4
- package/dist/src/tasks-runner/task-orchestrator.d.ts +4 -1
- package/dist/src/tasks-runner/task-orchestrator.js +23 -10
- package/dist/src/tasks-runner/utils.js +2 -6
- package/dist/src/utils/acknowledge-build-scripts.d.ts +13 -0
- package/dist/src/utils/acknowledge-build-scripts.js +102 -0
- package/dist/src/utils/analytics-prompt.d.ts +0 -6
- package/dist/src/utils/analytics-prompt.js +0 -51
- package/dist/src/utils/assert-workspace-validity.js +7 -2
- package/dist/src/utils/catalog/manager-utils.d.ts +1 -2
- package/dist/src/utils/catalog/manager-utils.js +22 -5
- package/dist/src/utils/catalog/pnpm-manager.d.ts +1 -0
- package/dist/src/utils/catalog/pnpm-manager.js +3 -15
- package/dist/src/utils/catalog/yarn-manager.d.ts +1 -0
- package/dist/src/utils/catalog/yarn-manager.js +3 -15
- package/dist/src/utils/command-line-utils.js +30 -20
- package/dist/src/utils/fileutils.d.ts +5 -0
- package/dist/src/utils/fileutils.js +7 -2
- package/dist/src/utils/git-revision.d.ts +12 -0
- package/dist/src/utils/git-revision.js +25 -0
- package/dist/src/utils/git-utils.d.ts +16 -3
- package/dist/src/utils/git-utils.js +146 -52
- package/dist/src/utils/git-worktrees.d.ts +30 -0
- package/dist/src/utils/git-worktrees.js +212 -0
- package/dist/src/utils/ignore.d.ts +128 -1
- package/dist/src/utils/ignore.js +182 -12
- package/dist/src/utils/long-running-target.d.ts +10 -0
- package/dist/src/utils/long-running-target.js +19 -0
- package/dist/src/utils/min-release-age/behavior/bun.js +7 -11
- package/dist/src/utils/min-release-age/behavior/npm.js +5 -2
- package/dist/src/utils/min-release-age/behavior/pnpm.js +9 -7
- package/dist/src/utils/min-release-age/packument.js +1 -1
- package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
- package/dist/src/utils/nx-tmp-dir.js +40 -0
- package/dist/src/utils/owned-private-dir.d.ts +132 -0
- package/dist/src/utils/owned-private-dir.js +323 -0
- package/dist/src/utils/package-json.js +11 -7
- package/dist/src/utils/package-manager-config/bunfig.d.ts +14 -0
- package/dist/src/utils/package-manager-config/bunfig.js +49 -0
- package/dist/src/utils/package-manager-config/npmrc.d.ts +23 -0
- package/dist/src/utils/package-manager-config/npmrc.js +124 -0
- package/dist/src/utils/package-manager-config/pnpm-config.d.ts +17 -0
- package/dist/src/utils/package-manager-config/pnpm-config.js +60 -0
- package/dist/src/utils/package-manager.d.ts +23 -2
- package/dist/src/utils/package-manager.js +264 -43
- package/dist/src/utils/provenance.js +18 -16
- package/dist/src/utils/registry-config/bun.d.ts +2 -0
- package/dist/src/utils/registry-config/bun.js +257 -0
- package/dist/src/utils/registry-config/index.d.ts +13 -0
- package/dist/src/utils/registry-config/index.js +102 -0
- package/dist/src/utils/registry-config/pnpm.d.ts +2 -0
- package/dist/src/utils/registry-config/pnpm.js +1551 -0
- package/dist/src/utils/registry-config/utils.d.ts +195 -0
- package/dist/src/utils/registry-config/utils.js +496 -0
- package/dist/src/utils/registry-config/yarn-berry.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-berry.js +612 -0
- package/dist/src/utils/registry-config/yarn-classic.d.ts +2 -0
- package/dist/src/utils/registry-config/yarn-classic.js +1001 -0
- package/dist/src/utils/safe-spawn.d.ts +24 -0
- package/dist/src/utils/safe-spawn.js +104 -0
- package/dist/src/utils/shell-quoting.d.ts +15 -0
- package/dist/src/utils/shell-quoting.js +35 -0
- package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
- package/dist/src/utils/wait-for-socket-connection.js +14 -8
- package/dist/src/utils/workspace-id.d.ts +20 -0
- package/dist/src/utils/workspace-id.js +54 -0
- package/migrations.json +13 -1
- package/package.json +22 -17
- package/dist/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
- package/dist/src/migrations/update-17-3-0/nx-release-path.js +0 -47
- package/dist/src/utils/min-release-age/npmrc.d.ts +0 -15
- package/dist/src/utils/min-release-age/npmrc.js +0 -45
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import type { PackageManager } from '../package-manager';
|
|
2
|
+
/**
|
|
3
|
+
* Environment entries (npm_config_* keys) to overlay on a spawned npm process
|
|
4
|
+
* so its per-key config resolution reproduces the workspace package manager's
|
|
5
|
+
* own registry/auth/TLS resolution. npm parses these at its env tier: above
|
|
6
|
+
* every .npmrc level, below CLI flags (we never pass registry CLI flags).
|
|
7
|
+
*/
|
|
8
|
+
export type NpmConfigEnv = Record<string, string>;
|
|
9
|
+
export declare function getPackageScope(packageName: string): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Converts a registry URL into npm's nerf-dart key prefix (host + directory
|
|
12
|
+
* path), e.g. `https://r.example.com/npm/` -> `//r.example.com/npm/`.
|
|
13
|
+
* See https://github.com/npm/cli/blob/bb056c85059cfb39514614e31abba09f20ac1612/workspaces/config/lib/nerf-dart.js#L12-L17
|
|
14
|
+
*/
|
|
15
|
+
export declare function nerfDart(registryUrl: string): string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Where npm and pnpm both begin a lookup for `registry`, and what
|
|
18
|
+
* registryKeysFor climbs from. Both append the trailing slash a registry path is
|
|
19
|
+
* missing before darting (npm darts the request URI; pnpm does it in
|
|
20
|
+
* getAuthHeaderByURI and pickSettingByUrl), so the walk starts at the request's
|
|
21
|
+
* own directory and still reaches a setting pinned to `//h/api/npm/` for a
|
|
22
|
+
* request to `https://h/api/npm`, which the plain dart begins above.
|
|
23
|
+
*
|
|
24
|
+
* A registry URL carrying a query or a fragment lands back on the plain dart:
|
|
25
|
+
* npm builds its request URI by concatenation, so the package name joins the
|
|
26
|
+
* query rather than the path, and its walk never reaches the deeper directory.
|
|
27
|
+
*/
|
|
28
|
+
export declare function requestNerfDart(registry: string): string | null;
|
|
29
|
+
/** npm's key rewrite: non-leading `_` to `-`, then lowercased. */
|
|
30
|
+
export declare function normalizeNpmConfigKey(key: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* The value npm resolves for `setting` out of an environment: the last non-empty
|
|
33
|
+
* `npm_config_*` spelling wins (loadEnv). `setting` is the name npm looks the
|
|
34
|
+
* value up under, so a scope npm rewrites (`@my_scope`) finds nothing.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readNpmConfigEnv(env: NodeJS.ProcessEnv, setting: string): string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Merges an npm_config_* overlay into the environment for a spawned npm, leaving
|
|
39
|
+
* one non-empty spelling per setting: the overlay's where it carries the setting,
|
|
40
|
+
* otherwise the ambient one npm itself would resolve. npm reads its env tier
|
|
41
|
+
* last-write-wins over the received key order, and both macOS `/bin/sh` and npm's
|
|
42
|
+
* own shell launcher rebuild that order, so a setting left spelled two ways
|
|
43
|
+
* (`NPM_CONFIG_REGISTRY` beside `npm_config_registry`) goes to whichever one they
|
|
44
|
+
* emit last instead of to the value resolved here.
|
|
45
|
+
*
|
|
46
|
+
* `managerIgnoresEnv` says which settings the package manager resolves without
|
|
47
|
+
* reading `npm_config_*`. Bridged settings it answers true for are dropped even
|
|
48
|
+
* where the overlay claims nothing: npm's env tier sits above every file, so
|
|
49
|
+
* leaving one in place stops npm from reaching the .npmrc chain the package
|
|
50
|
+
* manager itself resolved from. Settings outside the bridged set stay ambient
|
|
51
|
+
* either way.
|
|
52
|
+
*/
|
|
53
|
+
export declare function mergeNpmConfigEnv(baseEnv: NodeJS.ProcessEnv, overlay: NpmConfigEnv, managerIgnoresEnv?: IgnoresNpmConfigEnv): NodeJS.ProcessEnv;
|
|
54
|
+
export type IgnoresNpmConfigEnv = (setting: string) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The settings the package manager resolves without reading `npm_config_*`, as
|
|
57
|
+
* a predicate over setting names. A bridged setting it returns true for is one
|
|
58
|
+
* the spawned npm never receives from the ambient environment; settings outside
|
|
59
|
+
* the bridged set it has no say over. pnpm reads them all up to 10.x and stops at 11.0.0,
|
|
60
|
+
* which switched to its own `PNPM_CONFIG_*` prefix, except that 11.6.0 restored
|
|
61
|
+
* the URL-scoped credential keys; yarn berry has never read any; npm reads them by
|
|
62
|
+
* definition, and bun reads them for the settings this module bridges.
|
|
63
|
+
*
|
|
64
|
+
* An undetermined or unparseable version answers false for every setting:
|
|
65
|
+
* bridging is skipped or falls open there anyway, so the ambient environment
|
|
66
|
+
* stays as it is.
|
|
67
|
+
*/
|
|
68
|
+
export declare function ignoresNpmConfigEnv(packageManager: PackageManager, packageManagerVersion: string | null): IgnoresNpmConfigEnv;
|
|
69
|
+
export declare function setRegistry(env: NpmConfigEnv, url: string): void;
|
|
70
|
+
export declare function setScopedRegistry(env: NpmConfigEnv, scope: string, url: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Keyed on the registry's own directory rather than the parent a path missing
|
|
73
|
+
* its trailing slash darts to, so two registries under one parent keep separate
|
|
74
|
+
* keys instead of handing each other's credential out. The same holds for the
|
|
75
|
+
* two sinks below.
|
|
76
|
+
*/
|
|
77
|
+
export declare function setAuthToken(env: NpmConfigEnv, registryUrl: string, token: string): void;
|
|
78
|
+
/** `_auth` carries base64(user:pass). */
|
|
79
|
+
export declare function setAuthIdent(env: NpmConfigEnv, registryUrl: string, base64Ident: string): void;
|
|
80
|
+
/**
|
|
81
|
+
* npm presents a client certificate only when both halves are configured, so
|
|
82
|
+
* they are set together; each is a path, not the material itself.
|
|
83
|
+
* See https://github.com/npm/npm-registry-fetch/blob/v19.1.1/lib/auth.js#L170
|
|
84
|
+
*/
|
|
85
|
+
export declare function setClientCertificate(env: NpmConfigEnv, registryUrl: string, certfile: string, keyfile: string): void;
|
|
86
|
+
export declare function setCafile(env: NpmConfigEnv, path: string): void;
|
|
87
|
+
export declare function setStrictSsl(env: NpmConfigEnv, value: boolean): void;
|
|
88
|
+
export declare function setProxies(env: NpmConfigEnv, proxies: {
|
|
89
|
+
httpProxy?: string;
|
|
90
|
+
httpsProxy?: string;
|
|
91
|
+
noProxy?: string;
|
|
92
|
+
}): void;
|
|
93
|
+
/**
|
|
94
|
+
* Directories above `root` (exclusive), nearest first. yarn classic and berry
|
|
95
|
+
* both read rc files from ancestor directories, which npm never sees because
|
|
96
|
+
* its project-config walk stops at the first package.json.
|
|
97
|
+
*/
|
|
98
|
+
export declare function ancestorDirectories(root: string): string[];
|
|
99
|
+
/**
|
|
100
|
+
* Resolves `${VAR}` references to the value npm itself ends up with, escapes
|
|
101
|
+
* consumed and the `${VAR?}` form falling back to an empty string. Use it to
|
|
102
|
+
* predict what a value npm reads for itself becomes, not to produce one for it:
|
|
103
|
+
* a bridged value goes through npm's own pass, which expandEnvVars accounts for.
|
|
104
|
+
* The `${VAR?}` form only landed in npm 11.6.0, so against an older spawned npm
|
|
105
|
+
* the prediction resolves a reference that npm itself would leave verbatim.
|
|
106
|
+
* See https://github.com/npm/cli/blob/v11.16.0/workspaces/config/lib/env-replace.js
|
|
107
|
+
*/
|
|
108
|
+
export declare function expandNpmEnvVars(value: string, env?: NodeJS.ProcessEnv): string;
|
|
109
|
+
/**
|
|
110
|
+
* The value to bridge so that npm's own expansion produces `value`, for a
|
|
111
|
+
* resolution that consumed the package manager's escapes rather than leaving
|
|
112
|
+
* them for npm (a literal a reader never expanded, or an expander whose escape
|
|
113
|
+
* rule is not npm's). Each reference gets an odd run of backslashes, which npm
|
|
114
|
+
* halves back to what it started as. Only what npm's reader would act on is
|
|
115
|
+
* escaped, so a `${` it leaves alone is not turned into a literal backslash.
|
|
116
|
+
*/
|
|
117
|
+
export declare function escapeNpmEnvExpr(value: string): string;
|
|
118
|
+
/**
|
|
119
|
+
* Expands `${VAR}` references from the environment the way npm/bun ini readers
|
|
120
|
+
* do. Unknown variables are left verbatim. The result is bridged, so an escaped
|
|
121
|
+
* reference keeps its escape for the spawned npm to consume.
|
|
122
|
+
*/
|
|
123
|
+
export declare function expandEnvVars(value: string, env?: NodeJS.ProcessEnv): string;
|
|
124
|
+
/**
|
|
125
|
+
* Expands `${VAR}` the way yarn classic's own envReplace does, which parts from
|
|
126
|
+
* npm's on both halves of its escape rule: an odd run of backslashes keeps
|
|
127
|
+
* every one of them along with the reference, and an even one drops all of them
|
|
128
|
+
* rather than half. A reference it resolves nothing for aborts yarn, so it
|
|
129
|
+
* throws here into the caller's fall-open.
|
|
130
|
+
* See https://github.com/yarnpkg/yarn/blob/v1.22.22/src/registries/npm-registry.js
|
|
131
|
+
*/
|
|
132
|
+
export declare function expandYarnEnvVars(value: string, env?: NodeJS.ProcessEnv): string;
|
|
133
|
+
/**
|
|
134
|
+
* Expands `${VAR}` the way pnpm's @pnpm/config.env-replace does. A reference
|
|
135
|
+
* that resolves to nothing becomes an empty string, matching the envReplaceLossy
|
|
136
|
+
* reader pnpm takes its config through from 11.0.0; keeping it verbatim would
|
|
137
|
+
* put a literal `${VAR}` on the wire as if it were a credential. Below 11 the
|
|
138
|
+
* reader throws instead and the whole file goes with it (readPnpmNpmrcMap), so
|
|
139
|
+
* on that line nothing reaching this carries an unresolvable reference.
|
|
140
|
+
*
|
|
141
|
+
* This is what pnpm itself ends up with, escapes consumed. Use it for a key,
|
|
142
|
+
* which nothing expands a second time, and for a value compared against pnpm's
|
|
143
|
+
* own resolution; a value handed to the spawned npm goes through
|
|
144
|
+
* bridgePnpmEnvVars instead.
|
|
145
|
+
*/
|
|
146
|
+
export declare function expandPnpmEnvVars(value: string, env?: NodeJS.ProcessEnv): string;
|
|
147
|
+
/**
|
|
148
|
+
* The same expansion in the form to hand the spawned npm: every `${VAR}` left in
|
|
149
|
+
* what pnpm resolved is escaped, so npm reproduces it instead of expanding a
|
|
150
|
+
* reference pnpm would have sent literally, whether that reference is one pnpm
|
|
151
|
+
* kept escaped or one a variable's own value carries.
|
|
152
|
+
*
|
|
153
|
+
* The escaping runs over pnpm's whole result rather than per reference, because
|
|
154
|
+
* a resolved value ending in a backslash joins the escape run of the reference
|
|
155
|
+
* behind it. Escaping each piece on its own leaves npm reading the merged run,
|
|
156
|
+
* whose parity says expand where pnpm's said keep.
|
|
157
|
+
*/
|
|
158
|
+
export declare function bridgePnpmEnvVars(value: string, env?: NodeJS.ProcessEnv): string;
|
|
159
|
+
/** The `${VAR}` references in `value` that pnpm's throwing reader dies on. */
|
|
160
|
+
export declare function unresolvedPnpmEnvVars(value: string, env?: NodeJS.ProcessEnv): string[];
|
|
161
|
+
/** Whether every `${VAR}` in `value` is one pnpm's throwing reader gets past. */
|
|
162
|
+
export declare function pnpmEnvVarsResolve(value: string, env?: NodeJS.ProcessEnv): boolean;
|
|
163
|
+
export declare function readEnvVar(env: NodeJS.ProcessEnv, name: string): string | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Reads `map` under `setting`, matching how npm and pnpm both expand a `${VAR}`
|
|
166
|
+
* in an .npmrc key before they look a value up under it; `setting` is already
|
|
167
|
+
* the resolved form to match. Both readers assign in file order, so the last key
|
|
168
|
+
* that `expand` turns into `setting` wins, a literal one included.
|
|
169
|
+
*/
|
|
170
|
+
export declare function readExpandedKey(map: Map<string, string>, setting: string, expand: (value: string) => string): string | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* The registry keys npm looks a setting up under for `dart`, nearest first: it
|
|
173
|
+
* strips one path segment at a time until only the host is left, which covers
|
|
174
|
+
* the key spelled with and without its trailing slash.
|
|
175
|
+
* See https://github.com/npm/npm-registry-fetch/blob/v18.0.2/lib/auth.js#L16-L26
|
|
176
|
+
*/
|
|
177
|
+
export declare function registryKeysFor(dart: string): string[];
|
|
178
|
+
/**
|
|
179
|
+
* Whether npm would find a credential for `dart` among the values `read`
|
|
180
|
+
* exposes, at the dart or at any parent of it.
|
|
181
|
+
* See https://github.com/npm/npm-registry-fetch/blob/v18.0.2/lib/auth.js#L34-L49
|
|
182
|
+
*/
|
|
183
|
+
export declare function hasCredentialFor(dart: string, read: (key: string) => string | undefined): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* npm reads the user's own .npmrc chain and the overlay cannot switch that off,
|
|
186
|
+
* so npm can authenticate on a registry the package manager resolved but would
|
|
187
|
+
* have queried anonymously. The fetch still succeeds, so nothing else reports it.
|
|
188
|
+
* Warn only where the overlay is what sent npm to that registry: left to itself
|
|
189
|
+
* npm would have used its own resolution and the same credentials, which is what
|
|
190
|
+
* the user gets from npm anywhere else.
|
|
191
|
+
*
|
|
192
|
+
* `remediation` closes the message, because what the user can safely do about it
|
|
193
|
+
* depends on whether the package manager reads .npmrc at all.
|
|
194
|
+
*/
|
|
195
|
+
export declare function warnNativeCredential(env: NpmConfigEnv, dart: string, packageManager: string, remediation: string, npmVisible: (key: string) => string | undefined): void;
|