@nx/js 24.1.0-beta.1 → 24.1.0-beta.3

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 (34) 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/release-publish/release-publish.impl.js +6 -1
  6. package/dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.d.ts +1 -6
  7. package/dist/src/migrations/update-23-2-0/add-pnpm-deploy-output-cache-inputs.js +4 -224
  8. package/dist/src/migrations/update-23-2-0/add-pnpm-prune-lockfile-cache-config.js +18 -297
  9. package/dist/src/migrations/update-24-1-0/add-bun-deploy-output-cache-inputs.d.ts +8 -0
  10. package/dist/src/migrations/update-24-1-0/add-bun-deploy-output-cache-inputs.js +21 -0
  11. package/dist/src/migrations/update-24-1-0/add-bun-deploy-output-cache-inputs.md +49 -0
  12. package/dist/src/migrations/update-24-1-0/add-bun-prune-lockfile-cache-config.d.ts +2 -0
  13. package/dist/src/migrations/update-24-1-0/add-bun-prune-lockfile-cache-config.js +28 -0
  14. package/dist/src/migrations/update-24-1-0/add-bun-prune-lockfile-cache-config.md +44 -0
  15. package/dist/src/plugins/typescript/plugin.js +58 -5
  16. package/dist/src/plugins/typescript/typecheck-target.d.ts +6 -0
  17. package/dist/src/plugins/typescript/typecheck-target.js +7 -5
  18. package/dist/src/release/version-actions.js +6 -0
  19. package/dist/src/utils/bun-install-settings-inputs.d.ts +20 -0
  20. package/dist/src/utils/bun-install-settings-inputs.js +31 -0
  21. package/dist/src/utils/deploy-output-cache-inputs.d.ts +35 -0
  22. package/dist/src/utils/deploy-output-cache-inputs.js +400 -0
  23. package/dist/src/utils/pnpm-install-settings-inputs.d.ts +0 -6
  24. package/dist/src/utils/pnpm-install-settings-inputs.js +0 -6
  25. package/dist/src/utils/prune-lockfile-cache-config.d.ts +18 -0
  26. package/dist/src/utils/prune-lockfile-cache-config.js +288 -0
  27. package/dist/src/utils/target-defaults-matching.d.ts +3 -0
  28. package/dist/src/utils/target-defaults-matching.js +7 -0
  29. package/dist/src/utils/workspace-module-sections.d.ts +10 -5
  30. package/dist/src/utils/workspace-module-sections.js +15 -6
  31. package/migrations.json +14 -2
  32. package/package.json +20 -12
  33. package/dist/src/utils/pnpm-deploy-output-cache-inputs.d.ts +0 -29
  34. package/dist/src/utils/pnpm-deploy-output-cache-inputs.js +0 -177
@@ -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
- }