@nx/js 24.1.0-beta.0 → 24.1.0-beta.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.
Files changed (40) hide show
  1. package/dist/internal.d.ts +2 -1
  2. package/dist/internal.js +8 -5
  3. package/dist/src/executors/copy-workspace-modules/copy-workspace-modules.js +40 -32
  4. package/dist/src/executors/prune-lockfile/prune-lockfile.js +105 -8
  5. package/dist/src/executors/verdaccio/placeholder-auth-token.d.ts +8 -0
  6. package/dist/src/executors/verdaccio/placeholder-auth-token.js +36 -0
  7. package/dist/src/executors/verdaccio/verdaccio.impl.js +49 -15
  8. package/dist/src/generators/setup-verdaccio/files/config.yml +8 -0
  9. package/dist/src/generators/typescript-sync/typescript-sync.js +5 -7
  10. package/dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.d.ts +1 -6
  11. package/dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.js +4 -224
  12. package/dist/src/migrations/update-23-2-0/add-pnpm-prune-lockfile-cache-config.js +18 -297
  13. package/dist/src/migrations/update-24-1-0/add-bun-deploy-output-cache-inputs.d.ts +8 -0
  14. package/dist/src/migrations/update-24-1-0/add-bun-deploy-output-cache-inputs.js +21 -0
  15. package/dist/src/migrations/update-24-1-0/add-bun-deploy-output-cache-inputs.md +49 -0
  16. package/dist/src/migrations/update-24-1-0/add-bun-prune-lockfile-cache-config.d.ts +2 -0
  17. package/dist/src/migrations/update-24-1-0/add-bun-prune-lockfile-cache-config.js +28 -0
  18. package/dist/src/migrations/update-24-1-0/add-bun-prune-lockfile-cache-config.md +44 -0
  19. package/dist/src/migrations/update-24-1-0/add-verdaccio-jwt-security.d.ts +10 -0
  20. package/dist/src/migrations/update-24-1-0/add-verdaccio-jwt-security.js +145 -0
  21. package/dist/src/migrations/update-24-1-0/add-verdaccio-jwt-security.md +49 -0
  22. package/dist/src/plugins/jest/start-local-registry.d.ts +4 -4
  23. package/dist/src/plugins/jest/start-local-registry.js +46 -32
  24. package/dist/src/release/version-actions.js +6 -0
  25. package/dist/src/utils/bun-install-settings-inputs.d.ts +20 -0
  26. package/dist/src/utils/bun-install-settings-inputs.js +31 -0
  27. package/dist/src/utils/deploy-output-cache-inputs.d.ts +35 -0
  28. package/dist/src/utils/deploy-output-cache-inputs.js +400 -0
  29. package/dist/src/utils/pnpm-install-settings-inputs.d.ts +0 -6
  30. package/dist/src/utils/pnpm-install-settings-inputs.js +0 -6
  31. package/dist/src/utils/prune-lockfile-cache-config.d.ts +18 -0
  32. package/dist/src/utils/prune-lockfile-cache-config.js +288 -0
  33. package/dist/src/utils/target-defaults-matching.d.ts +3 -0
  34. package/dist/src/utils/target-defaults-matching.js +7 -0
  35. package/dist/src/utils/workspace-module-sections.d.ts +10 -5
  36. package/dist/src/utils/workspace-module-sections.js +15 -6
  37. package/migrations.json +18 -0
  38. package/package.json +12 -12
  39. package/dist/src/utils/pnpm-deploy-output-cache-inputs.d.ts +0 -29
  40. package/dist/src/utils/pnpm-deploy-output-cache-inputs.js +0 -177
@@ -0,0 +1,288 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addPruneLockfileCacheConfig = addPruneLockfileCacheConfig;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const internal_1 = require("@nx/devkit/internal");
6
+ const target_defaults_matching_1 = require("./target-defaults-matching");
7
+ const PRUNE_LOCKFILE_EXECUTOR = '@nx/js:prune-lockfile';
8
+ /**
9
+ * Adds `artifacts` to the `outputs` of `@nx/js:prune-lockfile` targets that
10
+ * declare `lockFile`, and `rootInputs` to their `inputs`, on whichever layer
11
+ * (the target or a `targetDefaults` entry) the runtime reads each from.
12
+ */
13
+ function addPruneLockfileCacheConfig(tree, config) {
14
+ const nxJson = (0, devkit_1.readNxJson)(tree);
15
+ const targetDefaults = nxJson?.targetDefaults;
16
+ const pruneTargets = [];
17
+ const projects = new Map();
18
+ const changedProjects = new Set();
19
+ for (const [projectName, project] of (0, devkit_1.getProjects)(tree)) {
20
+ projects.set(projectName, project);
21
+ const projectNode = {
22
+ name: projectName,
23
+ type: 'lib',
24
+ data: { root: project.root, tags: project.tags },
25
+ };
26
+ for (const [targetName, target] of Object.entries(project.targets ?? {})) {
27
+ // The executor may come from a matching targetDefaults entry rather
28
+ // than the target itself. A `command` target resolves to nx:run-commands
29
+ // before defaults apply, so a default can never make it a prune target.
30
+ const executor = target.executor ??
31
+ (target.command
32
+ ? 'nx:run-commands'
33
+ : (0, target_defaults_matching_1.resolveDefaultsExecutor)(targetName, projectName, projectNode, targetDefaults, PRUNE_LOCKFILE_EXECUTOR));
34
+ if (executor !== PRUNE_LOCKFILE_EXECUTOR) {
35
+ continue;
36
+ }
37
+ pruneTargets.push({
38
+ targetName,
39
+ projectName,
40
+ projectNode,
41
+ matcherExecutor: target.executor,
42
+ target,
43
+ });
44
+ if (appendPruneOutputs(target, config)) {
45
+ changedProjects.add(projectName);
46
+ }
47
+ }
48
+ }
49
+ let defaultsChanged = false;
50
+ // runtime applies only the first key that resolves for a target (executor,
51
+ // exact name, then longest glob), so anchor each prune target to its
52
+ // selected key
53
+ const keyedPruneTargets = pruneTargets.map((ref) => ({
54
+ ref,
55
+ selectedKey: targetDefaults
56
+ ? (0, target_defaults_matching_1.selectDefaultsKey)(ref, targetDefaults, PRUNE_LOCKFILE_EXECUTOR)
57
+ : null,
58
+ }));
59
+ if (targetDefaults) {
60
+ for (const [key, value] of Object.entries(targetDefaults)) {
61
+ // a value may be the plain object form or the filtered array form
62
+ for (const entry of Array.isArray(value) ? value : [value]) {
63
+ if (!appliesToPruneLockfileTargets(key, entry, keyedPruneTargets)) {
64
+ continue;
65
+ }
66
+ defaultsChanged = appendPruneOutputs(entry, config) || defaultsChanged;
67
+ }
68
+ }
69
+ }
70
+ // `inputs` is decided separately from `outputs`, because the two can be
71
+ // authored on different layers and a target's own `inputs` replaces the
72
+ // defaults' array rather than merging with it. The sources are only ever
73
+ // appended to an array that already exists, or written with nx's default as
74
+ // the base when no layer declares one. The migration never authors a `'...'`
75
+ // of its own: whether the entry it would expand against survives depends on
76
+ // the document-order identity resets in nx's own merge, and a spread that
77
+ // ends up with nothing to expand narrows the target to the root sources.
78
+ for (const { ref, selectedKey } of keyedPruneTargets) {
79
+ const entries = (0, target_defaults_matching_1.compatibleDefaultsEntries)(ref, selectedKey, targetDefaults);
80
+ const defaults = entries.length
81
+ ? (0, internal_1.readTargetDefaultsForTarget)(ref.targetName, { [selectedKey]: entries }, ref.matcherExecutor, { projectName: ref.projectName, projectNode: ref.projectNode })
82
+ : null;
83
+ // The effective outputs, not the target's own array: a target inheriting
84
+ // its lockfile entry, or spreading the defaults' outputs into its own, is
85
+ // still this package manager's prune target.
86
+ const effective = (0, internal_1.mergeTargetConfigurations)(ref.target, defaults ?? {});
87
+ if (!declaresLockfile(effective.outputs, config.lockFile)) {
88
+ continue;
89
+ }
90
+ if (ref.target.inputs !== undefined) {
91
+ // A target's own array wins outright, so nothing else can carry them.
92
+ if (addRootSettingsInputs(ref.target, config.rootInputs, effective.inputs)) {
93
+ changedProjects.add(ref.projectName);
94
+ }
95
+ continue;
96
+ }
97
+ // Otherwise they belong to the entry supplying the array the target
98
+ // inherits, which is the last matching one declaring `inputs`.
99
+ const supplier = (0, target_defaults_matching_1.lastMatchingInputsSupplier)(ref, selectedKey, entries);
100
+ if (supplier) {
101
+ defaultsChanged =
102
+ addRootSettingsInputs(supplier, config.rootInputs, effective.inputs) ||
103
+ defaultsChanged;
104
+ }
105
+ else if (addRootSettingsInputs(ref.target, config.rootInputs, effective.inputs)) {
106
+ changedProjects.add(ref.projectName);
107
+ }
108
+ }
109
+ // A workspace configuring its prune targets purely through `targetDefaults`
110
+ // has no concrete target to carry the decision above.
111
+ if (targetDefaults && pruneTargets.length === 0) {
112
+ for (const [key, value] of Object.entries(targetDefaults)) {
113
+ const entries = Array.isArray(value) ? value : [value];
114
+ // The key qualifies only when it locates the executor without a
115
+ // concrete target to resolve against: the key itself, an entry pinning
116
+ // it, or an entry filtering on it. Every identity-compatible sibling
117
+ // still merges for such a target, an identity-neutral one included.
118
+ const compatible = entries.filter(entryIdentityCompatible);
119
+ const locatesExecutor = key === PRUNE_LOCKFILE_EXECUTOR ||
120
+ compatible.some((entry) => entry.executor === PRUNE_LOCKFILE_EXECUTOR ||
121
+ entry.filter?.executor === PRUNE_LOCKFILE_EXECUTOR);
122
+ if (!locatesExecutor ||
123
+ !compatible.some((entry) => declaresLockfile(entry.outputs, config.lockFile))) {
124
+ continue;
125
+ }
126
+ // Every compatible entry declaring `inputs` can be the array a future
127
+ // target inherits (a later filtered one replaces it for its projects),
128
+ // so each carries the sources itself; a sibling's array covers nothing
129
+ // unless a `'...'` spread pulls it in, in which case only the strictly
130
+ // filter-less earlier entries are the base it expands against: a
131
+ // filtered one supplies nothing to the targets its filter excludes,
132
+ // an executor filter failing for a target whose executor a sibling
133
+ // supplies (earlier entries are updated first, so the base is checked
134
+ // with the sources already added).
135
+ const suppliers = compatible.filter((entry) => entry.inputs !== undefined);
136
+ for (const [index, entry] of compatible.entries()) {
137
+ if (entry.inputs === undefined) {
138
+ continue;
139
+ }
140
+ const reference = entry.inputs.includes('...')
141
+ ? [
142
+ ...entry.inputs,
143
+ ...compatible
144
+ .slice(0, index)
145
+ .filter((earlier) => !earlier.filter)
146
+ .flatMap((earlier) => earlier.inputs ?? []),
147
+ ]
148
+ : entry.inputs;
149
+ defaultsChanged =
150
+ addRootSettingsInputs(entry, config.rootInputs, reference) ||
151
+ defaultsChanged;
152
+ }
153
+ // Targets no filtered supplier matches fall back to nx's own default
154
+ // when no filter-less entry declares an array, so the spelled-out
155
+ // default is prepended as its own entry: prepending keeps it from
156
+ // replacing a later supplier's array. A prepended carrier must match
157
+ // only targets an existing entry already matched, or the key starts
158
+ // winning selection for targets that previously fell through to their
159
+ // name or glob defaults. That holds under an executor key with a
160
+ // filter-less entry (a neutral carrier), and under a name or glob key
161
+ // with a filter-less pin (a pinned carrier, which a same-name target of
162
+ // another executor cannot inherit). An all-filtered array gets no
163
+ // fallback: any carrier would widen the key. The object form has no
164
+ // room to prepend; its single filter-less entry carries it instead.
165
+ if (!suppliers.some((supplier) => !supplier.filter)) {
166
+ const canCarry = key === PRUNE_LOCKFILE_EXECUTOR
167
+ ? compatible.some((entry) => !entry.filter)
168
+ : compatible.some((entry) => !entry.filter && entry.executor === PRUNE_LOCKFILE_EXECUTOR);
169
+ if (canCarry) {
170
+ if (Array.isArray(value)) {
171
+ const fallback = key === PRUNE_LOCKFILE_EXECUTOR
172
+ ? {}
173
+ : { executor: PRUNE_LOCKFILE_EXECUTOR };
174
+ addRootSettingsInputs(fallback, config.rootInputs, []);
175
+ value.unshift(fallback);
176
+ defaultsChanged = true;
177
+ }
178
+ else {
179
+ defaultsChanged =
180
+ addRootSettingsInputs(value, config.rootInputs, []) ||
181
+ defaultsChanged;
182
+ }
183
+ }
184
+ }
185
+ }
186
+ }
187
+ for (const projectName of changedProjects) {
188
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projects.get(projectName));
189
+ }
190
+ if (defaultsChanged) {
191
+ (0, devkit_1.updateNxJson)(tree, nxJson);
192
+ }
193
+ }
194
+ function declaresLockfile(outputs, lockFile) {
195
+ return lockfileEntry(outputs, lockFile) !== undefined;
196
+ }
197
+ function lockfileEntry(outputs, lockFile) {
198
+ return outputs?.find((output) => typeof output === 'string' &&
199
+ !output.startsWith('!') &&
200
+ (output === lockFile || output.endsWith(`/${lockFile}`)));
201
+ }
202
+ /**
203
+ * Adds the workspace root sources the artifacts are built from, skipping any
204
+ * the target already hashes: a `'...'` in the owner's array can carry one in
205
+ * from the layer below, where a check against the owner's own entries cannot
206
+ * see it. An absent `inputs` means nx's own default, so that is spelled out
207
+ * before adding to it rather than narrowing the configuration to the root
208
+ * sources alone.
209
+ */
210
+ function addRootSettingsInputs(config, rootInputs, referenceInputs = []) {
211
+ const alreadyHashed = (0, target_defaults_matching_1.namedFilesets)(referenceInputs);
212
+ const missing = rootInputs.filter((input) => typeof input === 'string'
213
+ ? !alreadyHashed.has(input) && !config.inputs?.includes(input)
214
+ : !(0, target_defaults_matching_1.hasRuntimeInput)(referenceInputs, input) &&
215
+ !(0, target_defaults_matching_1.hasRuntimeInput)(config.inputs, input));
216
+ if (missing.length === 0) {
217
+ return false;
218
+ }
219
+ config.inputs = [...(config.inputs ?? target_defaults_matching_1.DEFAULT_INPUTS), ...missing];
220
+ return true;
221
+ }
222
+ /**
223
+ * Whether a `targetDefaults` entry applies to `@nx/js:prune-lockfile` targets,
224
+ * mirroring nx's runtime matching: the entry's `filter` and merge-time
225
+ * payload compatibility are evaluated first, then the entry must sit under a
226
+ * prune target's selected key and match its context. Entries locating the
227
+ * executor (key, `executor` field, or `filter.executor`) match without a
228
+ * concrete target so a defaults-only workspace still gets the update. The
229
+ * in-key merge accumulation (identity replacement, outputs replacement, `...`
230
+ * spreads) is deliberately not replicated: an entry the merge ends up
231
+ * discarding for the prune target may still get the artifacts appended, which
232
+ * is additive-only for the target's own replay.
233
+ */
234
+ function appliesToPruneLockfileTargets(key, config, pruneTargets) {
235
+ if (!entryIdentityCompatible(config)) {
236
+ return false;
237
+ }
238
+ const filter = config.filter;
239
+ if (pruneTargets.length === 0) {
240
+ const locatesExecutor = key === PRUNE_LOCKFILE_EXECUTOR ||
241
+ config.executor === PRUNE_LOCKFILE_EXECUTOR ||
242
+ filter?.executor === PRUNE_LOCKFILE_EXECUTOR;
243
+ return locatesExecutor && !filter?.projects;
244
+ }
245
+ return pruneTargets.some(({ ref, selectedKey }) => selectedKey === key &&
246
+ (0, internal_1.readTargetDefaultsForTarget)(ref.targetName, { [key]: [config] }, ref.matcherExecutor, { projectName: ref.projectName, projectNode: ref.projectNode }) !== null);
247
+ }
248
+ /**
249
+ * Whether a `targetDefaults` entry can merge into an `@nx/js:prune-lockfile`
250
+ * target at all: a filter or payload pinning another executor or a command
251
+ * identity never does (isCompatibleTarget), and prune-lockfile targets are
252
+ * always explicitly configured, never inferred, so a plugin-filtered entry
253
+ * never applies either.
254
+ */
255
+ function entryIdentityCompatible(config) {
256
+ const filter = config.filter;
257
+ if (filter?.executor && filter.executor !== PRUNE_LOCKFILE_EXECUTOR) {
258
+ return false;
259
+ }
260
+ if (filter?.plugin) {
261
+ return false;
262
+ }
263
+ return !((config.executor && config.executor !== PRUNE_LOCKFILE_EXECUTOR) ||
264
+ config.command);
265
+ }
266
+ /**
267
+ * Appends the artifacts next to an existing lockfile entry, reusing that
268
+ * entry's own path spelling. Configurations with no `outputs` or no entry for
269
+ * the lockfile are left alone: the lockfile entry is what identifies the
270
+ * target as this package manager's, and one without `outputs` caches nothing
271
+ * to begin with.
272
+ */
273
+ function appendPruneOutputs(target, config) {
274
+ const entry = lockfileEntry(target.outputs, config.lockFile);
275
+ if (!entry) {
276
+ return false;
277
+ }
278
+ const prefix = entry.slice(0, -config.lockFile.length);
279
+ let changed = false;
280
+ for (const artifact of config.artifacts) {
281
+ const output = `${prefix}${artifact}`;
282
+ if (!target.outputs.includes(output)) {
283
+ target.outputs.push(output);
284
+ changed = true;
285
+ }
286
+ }
287
+ return changed;
288
+ }
@@ -38,6 +38,9 @@ export declare function compatibleDefaultsEntries(ref: MatchedTargetRef, selecte
38
38
  export declare function lastMatchingInputsSupplier(ref: MatchedTargetRef, selectedKey: string, entries: TargetDefaultArrayEntry[]): TargetDefaultArrayEntry | undefined;
39
39
  /** The plain filesets an inputs array names, for a containment check. */
40
40
  export declare function namedFilesets(inputs: TargetConfiguration['inputs']): ReadonlySet<string>;
41
+ export declare function hasRuntimeInput(inputs: TargetConfiguration['inputs'], input: {
42
+ runtime: string;
43
+ }): boolean;
41
44
  /**
42
45
  * The executor an executor-less target ends up with after its selected
43
46
  * defaults key applies. Each matching entry's identity is resolved like the
@@ -4,6 +4,7 @@ exports.DEFAULT_INPUTS = void 0;
4
4
  exports.compatibleDefaultsEntries = compatibleDefaultsEntries;
5
5
  exports.lastMatchingInputsSupplier = lastMatchingInputsSupplier;
6
6
  exports.namedFilesets = namedFilesets;
7
+ exports.hasRuntimeInput = hasRuntimeInput;
7
8
  exports.resolveDefaultsExecutor = resolveDefaultsExecutor;
8
9
  exports.selectDefaultsKey = selectDefaultsKey;
9
10
  const internal_1 = require("@nx/devkit/internal");
@@ -51,6 +52,12 @@ function lastMatchingInputsSupplier(ref, selectedKey, entries) {
51
52
  function namedFilesets(inputs) {
52
53
  return new Set((inputs ?? []).filter((input) => typeof input === 'string'));
53
54
  }
55
+ function hasRuntimeInput(inputs, input) {
56
+ return (inputs ?? []).some((existing) => typeof existing === 'object' &&
57
+ existing !== null &&
58
+ 'runtime' in existing &&
59
+ existing.runtime === input.runtime);
60
+ }
54
61
  /**
55
62
  * The executor an executor-less target ends up with after its selected
56
63
  * defaults key applies. Each matching entry's identity is resolved like the
@@ -7,10 +7,15 @@
7
7
  * because pnpm rejects a `file:` spec under peerDependencies (a peer-declared
8
8
  * workspace module is installed as a regular dependency instead). A
9
9
  * `workspace:*` spec left in any of them fails `pnpm install --frozen-lockfile`
10
- * (#35425). Transitive copies recurse over dependencies, optionalDependencies,
11
- * and peerDependencies (TRANSITIVE_INSTALL_SECTIONS in copy-workspace-modules),
12
- * since pnpm installs a transitive dependency's optional and auto-installed peer
13
- * deps but never its devDependencies; a transitive workspace-module peer is
14
- * moved into dependencies the same way.
10
+ * (#35425). Transitive copies recurse over TRANSITIVE_INSTALL_SECTIONS; a
11
+ * transitive workspace-module peer is moved into dependencies the same way.
15
12
  */
16
13
  export declare const WORKSPACE_MODULE_INSTALL_SECTIONS: readonly ["dependencies", "optionalDependencies", "devDependencies", "peerDependencies"];
14
+ /**
15
+ * Sections of a copied module's own manifest whose workspace-module deps are
16
+ * copied too. pnpm installs a transitive dependency's regular, optional, and
17
+ * auto-installed peer deps (a workspace peer is linked and recorded under the
18
+ * depending importer's dependencies in the lockfile), but never its
19
+ * devDependencies.
20
+ */
21
+ export declare const TRANSITIVE_INSTALL_SECTIONS: readonly ["dependencies", "optionalDependencies", "peerDependencies"];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WORKSPACE_MODULE_INSTALL_SECTIONS = void 0;
3
+ exports.TRANSITIVE_INSTALL_SECTIONS = exports.WORKSPACE_MODULE_INSTALL_SECTIONS = void 0;
4
4
  /**
5
5
  * App-level dependency sections that can declare a workspace module the pruned
6
6
  * standalone output must install. copy-workspace-modules copies the module from
@@ -10,11 +10,8 @@ exports.WORKSPACE_MODULE_INSTALL_SECTIONS = void 0;
10
10
  * because pnpm rejects a `file:` spec under peerDependencies (a peer-declared
11
11
  * workspace module is installed as a regular dependency instead). A
12
12
  * `workspace:*` spec left in any of them fails `pnpm install --frozen-lockfile`
13
- * (#35425). Transitive copies recurse over dependencies, optionalDependencies,
14
- * and peerDependencies (TRANSITIVE_INSTALL_SECTIONS in copy-workspace-modules),
15
- * since pnpm installs a transitive dependency's optional and auto-installed peer
16
- * deps but never its devDependencies; a transitive workspace-module peer is
17
- * moved into dependencies the same way.
13
+ * (#35425). Transitive copies recurse over TRANSITIVE_INSTALL_SECTIONS; a
14
+ * transitive workspace-module peer is moved into dependencies the same way.
18
15
  */
19
16
  exports.WORKSPACE_MODULE_INSTALL_SECTIONS = [
20
17
  'dependencies',
@@ -22,3 +19,15 @@ exports.WORKSPACE_MODULE_INSTALL_SECTIONS = [
22
19
  'devDependencies',
23
20
  'peerDependencies',
24
21
  ];
22
+ /**
23
+ * Sections of a copied module's own manifest whose workspace-module deps are
24
+ * copied too. pnpm installs a transitive dependency's regular, optional, and
25
+ * auto-installed peer deps (a workspace peer is linked and recorded under the
26
+ * depending importer's dependencies in the lockfile), but never its
27
+ * devDependencies.
28
+ */
29
+ exports.TRANSITIVE_INSTALL_SECTIONS = [
30
+ 'dependencies',
31
+ 'optionalDependencies',
32
+ 'peerDependencies',
33
+ ];
package/migrations.json CHANGED
@@ -64,6 +64,24 @@
64
64
  "description": "Replaces the removed `classProperties.loose` option with `loose` for the `@nx/js/babel`, `@nx/react/babel` and `@nx/web/babel` presets in JSON babel config files.",
65
65
  "implementation": "./dist/src/migrations/update-24-1-0/replace-babel-class-properties-loose",
66
66
  "documentation": "./dist/src/migrations/update-24-1-0/replace-babel-class-properties-loose.md"
67
+ },
68
+ "update-24-1-0-add-verdaccio-jwt-security": {
69
+ "version": "24.1.0-beta.1",
70
+ "description": "Enables JWT API tokens in Verdaccio config files used by `@nx/js:verdaccio` targets, so Verdaccio 7+ accepts the placeholder npm auth token that Nx sets for the local registry.",
71
+ "implementation": "./dist/src/migrations/update-24-1-0/add-verdaccio-jwt-security",
72
+ "documentation": "./dist/src/migrations/update-24-1-0/add-verdaccio-jwt-security.md"
73
+ },
74
+ "update-24-1-0-add-bun-prune-lockfile-cache-config": {
75
+ "version": "24.1.0-beta.2",
76
+ "description": "Add the patches and local_path_modules paths to the outputs of @nx/js:prune-lockfile targets that declare a bun.lock or bun.lockb output (adding bun.lock next to a bun.lockb one), and the workspace root package.json to their inputs, so a cache replay restores the bun patch files and vendored local-path dependencies the executor now emits, and a change to the root trustedDependencies does not replay a stale output.",
77
+ "implementation": "./dist/src/migrations/update-24-1-0/add-bun-prune-lockfile-cache-config",
78
+ "documentation": "./dist/src/migrations/update-24-1-0/add-bun-prune-lockfile-cache-config.md"
79
+ },
80
+ "update-24-1-0-add-bun-deploy-output-cache-inputs": {
81
+ "version": "24.1.0-beta.2",
82
+ "description": "Add the trustedDependencies and patchedDependencies fields of the root package.json to the inputs of build targets that emit the pruned Bun deploy output (esbuild with generatePackageJson, tsc and swc with generateLockfile, and project or targetDefaults entries replacing the inputs of inferred webpack and rspack builds) in workspaces on bun.lock or the binary bun.lockb, so removing a package from trustedDependencies does not replay a cached output that still trusts it.",
83
+ "implementation": "./dist/src/migrations/update-24-1-0/add-bun-deploy-output-cache-inputs",
84
+ "documentation": "./dist/src/migrations/update-24-1-0/add-bun-deploy-output-cache-inputs.md"
67
85
  }
68
86
  },
69
87
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/js",
3
- "version": "24.1.0-beta.0",
3
+ "version": "24.1.0-beta.2",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "files": [
@@ -162,8 +162,8 @@
162
162
  "@babel/preset-env": "^7.23.2",
163
163
  "@babel/preset-typescript": "^7.22.5",
164
164
  "@babel/runtime": "^7.22.6",
165
- "@nx/devkit": "24.1.0-beta.0",
166
- "@nx/workspace": "24.1.0-beta.0",
165
+ "@nx/devkit": "24.1.0-beta.2",
166
+ "@nx/workspace": "24.1.0-beta.2",
167
167
  "@zkochan/js-yaml": "0.0.7",
168
168
  "babel-plugin-const-enum": "^1.0.1",
169
169
  "babel-plugin-macros": "^3.1.0",
@@ -183,18 +183,18 @@
183
183
  "tslib": "^2.3.0"
184
184
  },
185
185
  "devDependencies": {
186
- "@nx/esbuild": "24.1.0-beta.0",
187
- "@nx/eslint": "24.1.0-beta.0",
188
- "@nx/jest": "24.1.0-beta.0",
189
- "@nx/oxlint": "24.1.0-beta.0",
190
- "@nx/rollup": "24.1.0-beta.0",
191
- "@nx/vite": "24.1.0-beta.0",
192
- "@nx/vitest": "24.1.0-beta.0",
193
- "nx": "24.1.0-beta.0"
186
+ "@nx/esbuild": "24.1.0-beta.2",
187
+ "@nx/eslint": "24.1.0-beta.2",
188
+ "@nx/jest": "24.1.0-beta.2",
189
+ "@nx/oxlint": "24.1.0-beta.2",
190
+ "@nx/rollup": "24.1.0-beta.2",
191
+ "@nx/vite": "24.1.0-beta.2",
192
+ "@nx/vitest": "24.1.0-beta.2",
193
+ "nx": "24.1.0-beta.2"
194
194
  },
195
195
  "peerDependencies": {
196
196
  "@swc/cli": ">=0.6.0 <0.9.0",
197
- "verdaccio": "^6.0.5"
197
+ "verdaccio": "^6.0.5 || ^7.0.0"
198
198
  },
199
199
  "peerDependenciesMeta": {
200
200
  "@swc/cli": {
@@ -1,29 +0,0 @@
1
- import type { TargetDefaults } from '@nx/devkit';
2
- import { type MatchedTargetRef } from './target-defaults-matching';
3
- /**
4
- * Adds the missing `PNPM_INSTALL_SETTINGS_INPUTS` to the layer whose `inputs`
5
- * array the runtime actually uses for this target: the target's own `inputs`
6
- * when it declares them (its array replaces the defaults' rather than merging
7
- * with it), otherwise the matching `targetDefaults` entry supplying the array
8
- * it inherits, and otherwise the target itself with nx's own default spelled
9
- * out first, so nothing that was hashed stops being hashed. Sources the
10
- * effective inputs already hash, including via a whole-file root package.json
11
- * fileset or a `json` input covering the settings fields, are left alone; no
12
- * `'...'` is ever authored. Returns which layer was mutated, or null when
13
- * nothing was missing.
14
- */
15
- export declare function addPnpmDeployOutputCacheInputs(ref: MatchedTargetRef, targetDefaults: TargetDefaults | undefined, executor: string): 'target' | 'defaults' | null;
16
- /**
17
- * Variant for a plugin-inferred target, whose generated `inputs` already carry
18
- * the settings sources (the runtime probe only while the root manifest has no
19
- * valid pnpm pin): a repair is only needed when an overlay (a project-level
20
- * target entry, exact or glob key, or a matching `targetDefaults` entry)
21
- * supplies a replacing `inputs` array that discards them. The repair appends
22
- * the full set, probe included, because it runs once and the pin can be
23
- * removed later. The inferred layer is modeled as an array of exactly the
24
- * settings inputs: enough for the missing check, and it makes an overlay-less
25
- * target come back as nothing missing, so the fallback that would narrow the
26
- * plugin's richer array to `DEFAULT_INPUTS` can never be reached: with no
27
- * replacing supplier there is nothing to mutate.
28
- */
29
- export declare function addPnpmDeployOutputCacheInputsToInferredTargetOverlay(ref: MatchedTargetRef, targetDefaults: TargetDefaults | undefined): 'target' | 'defaults' | null;
@@ -1,177 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addPnpmDeployOutputCacheInputs = addPnpmDeployOutputCacheInputs;
4
- exports.addPnpmDeployOutputCacheInputsToInferredTargetOverlay = addPnpmDeployOutputCacheInputsToInferredTargetOverlay;
5
- const internal_1 = require("@nx/devkit/internal");
6
- const pnpm_install_settings_inputs_1 = require("./pnpm-install-settings-inputs");
7
- const target_defaults_matching_1 = require("./target-defaults-matching");
8
- const ROOT_MANIFEST = '{workspaceRoot}/package.json';
9
- const MANIFEST_SETTINGS_FIELDS = new Set(pnpm_install_settings_inputs_1.PNPM_INSTALL_SETTINGS_INPUTS.filter((input) => typeof input !== 'string' && 'json' in input).flatMap((input) => input.fields ?? []));
10
- /**
11
- * Adds the missing `PNPM_INSTALL_SETTINGS_INPUTS` to the layer whose `inputs`
12
- * array the runtime actually uses for this target: the target's own `inputs`
13
- * when it declares them (its array replaces the defaults' rather than merging
14
- * with it), otherwise the matching `targetDefaults` entry supplying the array
15
- * it inherits, and otherwise the target itself with nx's own default spelled
16
- * out first, so nothing that was hashed stops being hashed. Sources the
17
- * effective inputs already hash, including via a whole-file root package.json
18
- * fileset or a `json` input covering the settings fields, are left alone; no
19
- * `'...'` is ever authored. Returns which layer was mutated, or null when
20
- * nothing was missing.
21
- */
22
- function addPnpmDeployOutputCacheInputs(ref, targetDefaults, executor) {
23
- const selectedKey = targetDefaults
24
- ? (0, target_defaults_matching_1.selectDefaultsKey)(ref, targetDefaults, executor)
25
- : null;
26
- const entries = (0, target_defaults_matching_1.compatibleDefaultsEntries)(ref, selectedKey, targetDefaults);
27
- const defaults = entries.length
28
- ? (0, internal_1.readTargetDefaultsForTarget)(ref.targetName, { [selectedKey]: entries }, ref.matcherExecutor, {
29
- projectName: ref.projectName,
30
- projectNode: ref.projectNode,
31
- sourcePlugin: ref.sourcePlugin,
32
- })
33
- : null;
34
- const effective = (0, internal_1.mergeTargetConfigurations)(ref.target, defaults ?? {});
35
- const missing = missingSettingsInputs(effective.inputs);
36
- if (missing.length === 0) {
37
- return null;
38
- }
39
- if (ref.target.inputs !== undefined) {
40
- appendInputs(ref.target, missing);
41
- return 'target';
42
- }
43
- const supplier = (0, target_defaults_matching_1.lastMatchingInputsSupplier)(ref, selectedKey, entries);
44
- if (supplier) {
45
- appendInputs(supplier, missing);
46
- return 'defaults';
47
- }
48
- appendInputs(ref.target, missing);
49
- return 'target';
50
- }
51
- /**
52
- * Variant for a plugin-inferred target, whose generated `inputs` already carry
53
- * the settings sources (the runtime probe only while the root manifest has no
54
- * valid pnpm pin): a repair is only needed when an overlay (a project-level
55
- * target entry, exact or glob key, or a matching `targetDefaults` entry)
56
- * supplies a replacing `inputs` array that discards them. The repair appends
57
- * the full set, probe included, because it runs once and the pin can be
58
- * removed later. The inferred layer is modeled as an array of exactly the
59
- * settings inputs: enough for the missing check, and it makes an overlay-less
60
- * target come back as nothing missing, so the fallback that would narrow the
61
- * plugin's richer array to `DEFAULT_INPUTS` can never be reached: with no
62
- * replacing supplier there is nothing to mutate.
63
- */
64
- function addPnpmDeployOutputCacheInputsToInferredTargetOverlay(ref, targetDefaults) {
65
- const selectedKey = targetDefaults
66
- ? (0, target_defaults_matching_1.selectDefaultsKey)(ref, targetDefaults, ref.matcherExecutor)
67
- : null;
68
- const entries = (0, target_defaults_matching_1.compatibleDefaultsEntries)(ref, selectedKey, targetDefaults);
69
- const defaults = entries.length
70
- ? (0, internal_1.readTargetDefaultsForTarget)(ref.targetName, { [selectedKey]: entries }, ref.matcherExecutor, {
71
- projectName: ref.projectName,
72
- projectNode: ref.projectNode,
73
- sourcePlugin: ref.sourcePlugin,
74
- })
75
- : null;
76
- const inferredLayer = {
77
- inputs: [...pnpm_install_settings_inputs_1.PNPM_INSTALL_SETTINGS_INPUTS],
78
- };
79
- const effective = (0, internal_1.mergeTargetConfigurations)(ref.target, (0, internal_1.mergeTargetConfigurations)(defaults ?? {}, inferredLayer));
80
- const missing = missingSettingsInputs(effective.inputs);
81
- if (missing.length === 0) {
82
- return null;
83
- }
84
- if (ref.target.inputs !== undefined) {
85
- appendInputs(ref.target, missing);
86
- return 'target';
87
- }
88
- const supplier = (0, target_defaults_matching_1.lastMatchingInputsSupplier)(ref, selectedKey, entries);
89
- if (supplier) {
90
- appendInputs(supplier, missing);
91
- return 'defaults';
92
- }
93
- return null;
94
- }
95
- /**
96
- * The settings sources the effective inputs do not hash yet. The manifest
97
- * counts as covered by a whole-file fileset no negative pattern can cancel,
98
- * or by an existing `json` input that hashes all the settings fields (`json`
99
- * inputs are immune to fileset negations); the workspace yaml by its fileset
100
- * (a negative pattern cancelling that fileset has no input-level counter, so
101
- * it is left to the author who wrote it); the runtime probe by an identical
102
- * `runtime` entry.
103
- */
104
- function missingSettingsInputs(inputs) {
105
- const filesets = (0, target_defaults_matching_1.namedFilesets)(inputs);
106
- const missing = [];
107
- for (const input of pnpm_install_settings_inputs_1.PNPM_INSTALL_SETTINGS_INPUTS) {
108
- if (typeof input === 'string') {
109
- if (!filesets.has(input)) {
110
- missing.push(input);
111
- }
112
- }
113
- else if ('runtime' in input) {
114
- if (!(inputs ?? []).some((existing) => typeof existing === 'object' &&
115
- existing !== null &&
116
- 'runtime' in existing &&
117
- existing.runtime === input.runtime)) {
118
- missing.push(input);
119
- }
120
- }
121
- else if (!(filesets.has(ROOT_MANIFEST) && !negationMayCancel(inputs)) &&
122
- !(inputs ?? []).some((existing) => typeof existing === 'object' &&
123
- existing !== null &&
124
- 'json' in existing &&
125
- existing.json === ROOT_MANIFEST &&
126
- [...MANIFEST_SETTINGS_FIELDS].every((field) => jsonInputCoversField(existing, field)))) {
127
- missing.push(input);
128
- }
129
- }
130
- return missing;
131
- }
132
- /**
133
- * Whether a negative fileset entry could remove the source from the hash. Any
134
- * workspace-root-scoped negation counts, in the string or `{ fileset }` form:
135
- * nx's pattern syntax (globs, extglobs) is not re-evaluated here, and an
136
- * extra input for a source the negation does not actually touch is harmless.
137
- * Project-relative negations never match a workspace-root file.
138
- */
139
- function negationMayCancel(inputs) {
140
- return (inputs ?? []).some((existing) => {
141
- const pattern = typeof existing === 'string'
142
- ? existing
143
- : typeof existing === 'object' &&
144
- existing !== null &&
145
- 'fileset' in existing
146
- ? existing.fileset
147
- : undefined;
148
- return (typeof pattern === 'string' &&
149
- pattern.startsWith('!') &&
150
- pattern.includes('{workspaceRoot}'));
151
- });
152
- }
153
- /**
154
- * Whether an existing `json` input hashes `field`: selected by the allowlist
155
- * (an entry covers its whole subtree) and not touched by the denylist, which
156
- * the hasher applies after selection. A denylist entry below the field only
157
- * removes part of its subtree, but that part is then unhashed, so it
158
- * disqualifies coverage too.
159
- */
160
- function jsonInputCoversField(input, field) {
161
- const selected = input.fields === undefined ||
162
- input.fields.some((path) => path === field || field.startsWith(`${path}.`));
163
- if (!selected) {
164
- return false;
165
- }
166
- return !(input.excludeFields ?? []).some((path) => path === field ||
167
- field.startsWith(`${path}.`) ||
168
- path.startsWith(`${field}.`));
169
- }
170
- /**
171
- * Appends to an array that already exists, or writes nx's default as the base
172
- * when no layer declares one, so the configuration is never narrowed to the
173
- * settings sources alone.
174
- */
175
- function appendInputs(config, missing) {
176
- config.inputs = [...(config.inputs ?? target_defaults_matching_1.DEFAULT_INPUTS), ...missing];
177
- }