@smoothbricks/nx-plugin 0.6.3-0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -121
- package/dist/.build-inputs.json +25 -20
- package/dist/bin/smoo-nx-go-test-build.d.ts +3 -0
- package/dist/bin/smoo-nx-go-test-build.d.ts.map +1 -0
- package/dist/bin/smoo-nx-go-test-build.js +79 -0
- package/dist/bin/smoo-nx-go-test-run.d.ts +3 -0
- package/dist/bin/smoo-nx-go-test-run.d.ts.map +1 -0
- package/dist/bin/smoo-nx-go-test-run.js +129 -0
- package/dist/bounded-test-policy.d.ts +1 -1
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +9 -8
- package/dist/cargo-workspace.d.ts +10 -20
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +12 -22
- package/dist/cross-check-policy.d.ts +2 -2
- package/dist/cross-check-policy.js +2 -2
- package/dist/deploy-policy.d.ts +6 -0
- package/dist/deploy-policy.d.ts.map +1 -1
- package/dist/deploy-policy.js +11 -0
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +49 -37
- package/dist/executors/bounded-exec/mbx-pool.d.ts +39 -10
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-pool.js +78 -24
- package/dist/executors/bounded-exec/progress.js +5 -5
- package/dist/executors/bounded-exec/runner-sizing.d.ts +40 -2
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-sizing.js +55 -4
- package/dist/executors/bounded-exec/runtime-pin.js +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +6 -0
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +6 -0
- package/dist/executors/wrangler-deploy/deploy-hash.d.ts +10 -0
- package/dist/executors/wrangler-deploy/deploy-hash.d.ts.map +1 -0
- package/dist/executors/wrangler-deploy/deploy-hash.js +14 -0
- package/dist/executors/wrangler-deploy/executor.d.ts +24 -0
- package/dist/executors/wrangler-deploy/executor.d.ts.map +1 -0
- package/dist/executors/wrangler-deploy/executor.js +43 -0
- package/dist/executors/wrangler-deploy/hasher.d.ts +27 -0
- package/dist/executors/wrangler-deploy/hasher.d.ts.map +1 -0
- package/dist/executors/wrangler-deploy/hasher.js +90 -0
- package/dist/executors/wrangler-deploy/schema.d.ts +5 -0
- package/dist/executors/wrangler-deploy/schema.d.ts.map +1 -0
- package/dist/go-tests.d.ts +30 -0
- package/dist/go-tests.d.ts.map +1 -0
- package/dist/go-tests.js +43 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +271 -230
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +5 -0
- package/dist/process-group.js +2 -2
- package/dist/runtime-input-policy.d.ts +3 -3
- package/dist/runtime-input-policy.js +3 -3
- package/dist/test-timings.d.ts +23 -4
- package/dist/test-timings.d.ts.map +1 -1
- package/dist/test-timings.js +72 -12
- package/dist/version-actions.cjs +10 -11
- package/dist/version-actions.d.cts.map +1 -1
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +17 -22
- package/dist/workspace-manifest.js +3 -3
- package/executors.json +6 -5
- package/managed/raw/patches/nx@23.2.1.patch +118 -24
- package/managed/raw/patches/ttsc@0.34.1.patch +64 -0
- package/managed/raw/tooling/direnv/developer-links.ts +121 -51
- package/managed/raw/tooling/direnv/installed-bun-links.ts +7 -6
- package/managed/raw/tooling/direnv/setup-environment.ts +14 -4
- package/managed/raw/tooling/git-hooks/pinned-revisions-served.ts +252 -0
- package/managed/raw/tooling/git-hooks/pre-push.sh +34 -32
- package/package.json +57 -7
- package/runtime/nx-publish/.build-inputs.json +11 -0
- package/runtime-input.sh +50 -23
- package/src/bin/smoo-nx-go-test-build.ts +83 -0
- package/src/bin/smoo-nx-go-test-run.ts +140 -0
- package/src/bounded-test-policy.ts +9 -8
- package/src/cargo-workspace.ts +12 -24
- package/src/cross-check-policy.ts +2 -2
- package/src/deploy-policy.ts +11 -0
- package/src/executors/bounded-exec/executor.ts +61 -42
- package/src/executors/bounded-exec/mbx-pool.ts +97 -33
- package/src/executors/bounded-exec/progress.ts +5 -5
- package/src/executors/bounded-exec/runner-sizing.ts +73 -7
- package/src/executors/bounded-exec/runtime-pin.ts +1 -1
- package/src/executors/bounded-exec/verdict.ts +7 -0
- package/src/executors/wrangler-deploy/deploy-hash.ts +15 -0
- package/src/executors/wrangler-deploy/executor.ts +63 -0
- package/src/executors/wrangler-deploy/hasher.ts +111 -0
- package/src/executors/wrangler-deploy/schema.json +16 -0
- package/src/executors/wrangler-deploy/schema.ts +4 -0
- package/src/go-tests.ts +67 -0
- package/src/index.ts +294 -253
- package/src/managed-files/files.ts +5 -0
- package/src/process-group.ts +2 -2
- package/src/runtime-input-policy.ts +3 -3
- package/src/test-timings.ts +72 -14
- package/src/version-actions.cts +10 -11
- package/src/workspace-config-policy.ts +20 -29
- package/src/workspace-manifest.ts +3 -3
- package/test-timings.json +131 -130
- package/dist/executors/clean-outputs/executor.d.ts +0 -26
- package/dist/executors/clean-outputs/executor.d.ts.map +0 -1
- package/dist/executors/clean-outputs/executor.js +0 -83
- package/dist/executors/clean-outputs/schema.d.ts +0 -4
- package/dist/executors/clean-outputs/schema.d.ts.map +0 -1
- package/src/executors/clean-outputs/executor.ts +0 -131
- package/src/executors/clean-outputs/schema.json +0 -15
- package/src/executors/clean-outputs/schema.ts +0 -3
- /package/dist/executors/{clean-outputs → wrangler-deploy}/schema.js +0 -0
|
@@ -211,6 +211,11 @@ const managedFiles: ManagedFileDescriptor[] = [
|
|
|
211
211
|
target: 'tooling/git-hooks/pre-push.sh',
|
|
212
212
|
executable: true,
|
|
213
213
|
},
|
|
214
|
+
{
|
|
215
|
+
kind: 'raw',
|
|
216
|
+
source: 'tooling/git-hooks/pinned-revisions-served.ts',
|
|
217
|
+
target: 'tooling/git-hooks/pinned-revisions-served.ts',
|
|
218
|
+
},
|
|
214
219
|
{
|
|
215
220
|
kind: 'raw',
|
|
216
221
|
source: 'tooling/git-reword-commit',
|
package/src/process-group.ts
CHANGED
|
@@ -173,8 +173,8 @@ export function killProcessGroupNow(pgid: number, patience: Patience): boolean {
|
|
|
173
173
|
* Waits `ms` of host time without blocking this thread, so that the event loop serves everything else meanwhile and
|
|
174
174
|
* reaps the group's leader. Two waits, and whichever ends first ends the pause: a timer, which keeps the process alive
|
|
175
175
|
* while it waits, and `Atomics.waitAsync`, which does not (a process with nothing else pending exits under it, as
|
|
176
|
-
* measured on Node 26 and Bun 1.4.3) but is not a timer. A timer alone is its caller's clock, and a test
|
|
177
|
-
* clock stops it for good, while what a kill waits for is the kernel.
|
|
176
|
+
* measured on Node 26 and Bun 1.4.3 and 1.4.4) but is not a timer. A timer alone is its caller's clock, and a test
|
|
177
|
+
* that fakes the clock stops it for good, while what a kill waits for is the kernel.
|
|
178
178
|
*/
|
|
179
179
|
function pause(ms: number): Promise<void> {
|
|
180
180
|
return new Promise((resolve) => {
|
|
@@ -376,9 +376,9 @@ function absentAsUndefined<T>(read: () => T): T | undefined {
|
|
|
376
376
|
|
|
377
377
|
/**
|
|
378
378
|
* The report of every failure runtime-input.sh retained under `root` at or after `sinceMs`, oldest first, each headed
|
|
379
|
-
* by its path. Nx
|
|
380
|
-
* drops the input's stderr, so a headless run prints these after Nx fails: they name the command,
|
|
381
|
-
* its stderr. A record without a report (its evidence could not be written) is named as such.
|
|
379
|
+
* by its path. Nx names a failed runtime input's tasks and their runtime inputs (`Could not hash …`), not which one
|
|
380
|
+
* failed or why, and drops the input's stderr, so a headless run prints these after Nx fails: they name the command,
|
|
381
|
+
* its exit status and its stderr. A record without a report (its evidence could not be written) is named as such.
|
|
382
382
|
*/
|
|
383
383
|
export function runtimeInputFailureReports(root: string, sinceMs: number): string[] {
|
|
384
384
|
const directory = join(root, RUNTIME_INPUT_FAILURES);
|
package/src/test-timings.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { Stats } from 'node:fs';
|
|
1
2
|
import { readdir, readFile, stat } from 'node:fs/promises';
|
|
2
3
|
import { join, posix } from 'node:path';
|
|
3
4
|
import { parse as parseToml } from 'smol-toml';
|
|
4
5
|
import typia, { type IValidation } from 'typia';
|
|
5
6
|
|
|
6
|
-
import { shellWord } from './runtime-input.js';
|
|
7
|
+
import { runtimeInput, shellWord } from './runtime-input.js';
|
|
7
8
|
import { isRecord } from './type-guards.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -187,10 +188,11 @@ const validateBunfigDiscovery = typia.createValidate<BunfigDiscovery>();
|
|
|
187
188
|
* Bun's test discovery for `args` in `cwd`, replayed without running a test: files named `*.test.*`, `*_test.*`,
|
|
188
189
|
* `*.spec.*` or `*_spec.*` with a JavaScript extension, in any letter case, under bunfig's `test.root`, outside
|
|
189
190
|
* `node_modules` and hidden directories. A symlink counts as its target, a directory entered and a file matched, and a
|
|
190
|
-
* link to nothing
|
|
191
|
-
* the cwd-relative path as written and replace bunfig's
|
|
192
|
-
* bunfig; `.gitignore` plays no part. These are the rules
|
|
193
|
-
* files `bun test --update-timings` writes for a fixture,
|
|
191
|
+
* link to nothing is skipped; any other link it cannot resolve refuses the replay. The link's own name is the one the
|
|
192
|
+
* name rules see. `--path-ignore-patterns` globs match the cwd-relative path as written and replace bunfig's
|
|
193
|
+
* `pathIgnorePatterns` when given; `--config=` names another bunfig; `.gitignore` plays no part. These are the rules
|
|
194
|
+
* of Bun 1.4.4: `test-timings.test.ts` compares them with the files `bun test --update-timings` writes for a fixture,
|
|
195
|
+
* so a Bun release that changes them fails there.
|
|
194
196
|
*/
|
|
195
197
|
export async function timingsCoverage(
|
|
196
198
|
workspaceRoot: string,
|
|
@@ -210,7 +212,12 @@ export async function timingsCoverage(
|
|
|
210
212
|
cliIgnores.length > 0 ? cliIgnores : typeof bunfigIgnores === 'string' ? [bunfigIgnores] : bunfigIgnores;
|
|
211
213
|
const root = posix.normalize(bunfig.test?.root ?? '.');
|
|
212
214
|
const files: string[] = [];
|
|
213
|
-
|
|
215
|
+
try {
|
|
216
|
+
await collectTestFiles(cwd, root === '.' ? '' : root.replace(/\/$/, ''), ignores, files);
|
|
217
|
+
} catch (error) {
|
|
218
|
+
if (!(error instanceof Error && 'code' in error)) throw error;
|
|
219
|
+
return { ok: false, error: `cannot replay Bun's discovery under ${posix.join(suite.cwd, root)}: ${error.message}` };
|
|
220
|
+
}
|
|
214
221
|
files.sort();
|
|
215
222
|
const timed = new Set<string>();
|
|
216
223
|
for (const manifest of manifests) {
|
|
@@ -221,6 +228,50 @@ export async function timingsCoverage(
|
|
|
221
228
|
return { ok: true, coverage: { manifests, files, untimed: files.filter((file) => !timed.has(file)) } };
|
|
222
229
|
}
|
|
223
230
|
|
|
231
|
+
/**
|
|
232
|
+
* What the shard-timings check reads, as Nx inputs: its timing manifests and its bunfig as files, and the names Bun's
|
|
233
|
+
* discovery would find as {@link bunTestFileNamesInput}. Files alone cannot key the last: discovery finds gitignored
|
|
234
|
+
* files too, and Nx hashes no ignored file.
|
|
235
|
+
*/
|
|
236
|
+
export function timingsSuiteInputs(suite: Pick<TimingsShardedSuite, 'cwd' | 'args'>): (string | { runtime: string })[] {
|
|
237
|
+
const inCwd = (file: string) => `{workspaceRoot}/${posix.join(suite.cwd, file)}`;
|
|
238
|
+
return [
|
|
239
|
+
...flagValues(suite.args, '--timings').map(inCwd),
|
|
240
|
+
inCwd(flagValues(suite.args, '--config').at(-1) ?? 'bunfig.toml'),
|
|
241
|
+
bunTestFileNamesInput(suite.cwd),
|
|
242
|
+
];
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* The names of the files under `cwd` (workspace-relative) Bun's discovery could run, sorted, as a runtime input. It is a
|
|
247
|
+
* superset of {@link timingsCoverage}'s rules (any extension, the whole tree whatever bunfig's `test.root`, no ignore
|
|
248
|
+
* glob), so every file discovery would find changes the value, and a name discovery skips costs at most a cache miss.
|
|
249
|
+
* Like Bun, it skips `node_modules` and hidden directories, follows symlinks (each directory once, by its real path),
|
|
250
|
+
* skips a link to nothing, and reads no `.gitignore`. It walks with Bun, which every workspace declares.
|
|
251
|
+
*/
|
|
252
|
+
export function bunTestFileNamesInput(cwd: string): { runtime: string } {
|
|
253
|
+
return runtimeInput(`bun -e ${shellWord(LIST_TEST_FILE_NAMES)} ${shellWord(cwd)}`);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const LIST_TEST_FILE_NAMES = [
|
|
257
|
+
'const { readdirSync, realpathSync, statSync } = require("node:fs");',
|
|
258
|
+
'const names = []; const seen = new Set();',
|
|
259
|
+
'const walk = (dir) => {',
|
|
260
|
+
' const real = realpathSync(dir); if (seen.has(real)) return; seen.add(real);',
|
|
261
|
+
' for (const entry of readdirSync(dir, { withFileTypes: true })) {',
|
|
262
|
+
' const path = dir === "." ? entry.name : dir + "/" + entry.name; const name = entry.name.toLowerCase();',
|
|
263
|
+
' let directory = entry.isDirectory();',
|
|
264
|
+
' if (entry.isSymbolicLink()) {',
|
|
265
|
+
' try { directory = statSync(path).isDirectory(); }',
|
|
266
|
+
' catch (error) { if (error?.code !== "ENOENT") throw error; continue; }',
|
|
267
|
+
' }',
|
|
268
|
+
' if (directory) { if (!name.startsWith(".") && name !== "node_modules") walk(path); }',
|
|
269
|
+
' else if (/[._](test|spec)[.]/.test(name)) names.push(path);',
|
|
270
|
+
' }',
|
|
271
|
+
'};',
|
|
272
|
+
'process.chdir(process.argv[1]); walk("."); names.sort(); for (const name of names) console.log(name);',
|
|
273
|
+
].join(' ');
|
|
274
|
+
|
|
224
275
|
/**
|
|
225
276
|
* The failure an untimed file earns: every such file, and the one command that refreshes the manifest. `cwd` is the
|
|
226
277
|
* suite's workspace-relative directory, so the operator can find the files from the repository root.
|
|
@@ -242,17 +293,14 @@ async function collectTestFiles(cwd: string, dir: string, ignores: readonly stri
|
|
|
242
293
|
const path = dir === '' ? entry.name : `${dir}/${entry.name}`;
|
|
243
294
|
// Bun matches every name in lower case, and its ignore globs see the path as written.
|
|
244
295
|
const name = entry.name.toLowerCase();
|
|
245
|
-
// Bun follows a symlink to what it points at and
|
|
246
|
-
const resolved = entry.isSymbolicLink() ? await
|
|
247
|
-
if (resolved
|
|
296
|
+
// Bun follows a symlink to what it points at and skips one that points at nothing.
|
|
297
|
+
const resolved = entry.isSymbolicLink() ? await statUnlessMissing(join(cwd, path)) : entry;
|
|
298
|
+
if (resolved === null) continue;
|
|
299
|
+
if (resolved.isDirectory()) {
|
|
248
300
|
if (!name.startsWith('.') && name !== 'node_modules') {
|
|
249
301
|
await collectTestFiles(cwd, path, ignores, files);
|
|
250
302
|
}
|
|
251
|
-
} else if (
|
|
252
|
-
(resolved === null || resolved.isFile()) &&
|
|
253
|
-
TEST_FILE.test(name) &&
|
|
254
|
-
!ignores.some((glob) => posix.matchesGlob(path, glob))
|
|
255
|
-
) {
|
|
303
|
+
} else if (resolved.isFile() && TEST_FILE.test(name) && !ignores.some((glob) => posix.matchesGlob(path, glob))) {
|
|
256
304
|
files.push(path);
|
|
257
305
|
}
|
|
258
306
|
}
|
|
@@ -297,6 +345,16 @@ async function readTimingManifest(
|
|
|
297
345
|
return { ok: true, files: validated.data.files };
|
|
298
346
|
}
|
|
299
347
|
|
|
348
|
+
/** What a symlink at `path` leads to, or null when it leads nowhere; any other failure to resolve it is thrown. */
|
|
349
|
+
async function statUnlessMissing(path: string): Promise<Stats | null> {
|
|
350
|
+
try {
|
|
351
|
+
return await stat(path);
|
|
352
|
+
} catch (error) {
|
|
353
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') return null;
|
|
354
|
+
throw error;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
300
358
|
async function readOptionalFile(path: string): Promise<string | null> {
|
|
301
359
|
try {
|
|
302
360
|
return await readFile(path, 'utf-8');
|
package/src/version-actions.cts
CHANGED
|
@@ -34,19 +34,18 @@ const PUBLISHED_DEPENDENCY_FIELDS = ['dependencies', 'peerDependencies', 'option
|
|
|
34
34
|
const afterAllProjectsVersioned: AfterAllProjectsVersioned = async (cwd, options) => {
|
|
35
35
|
const result = await nxJsVersionActions.afterAllProjectsVersioned(cwd, options);
|
|
36
36
|
|
|
37
|
-
// Temporary Bun workaround. Delete this hook together with the CLI lockfile
|
|
38
|
-
// sync/validation code once supported Bun versions fix all three issues:
|
|
39
|
-
// - https://github.com/oven-sh/bun/issues/18906
|
|
40
|
-
// - https://github.com/oven-sh/bun/issues/20477
|
|
41
|
-
// - https://github.com/oven-sh/bun/issues/20829
|
|
42
|
-
//
|
|
43
37
|
// After ANY version bump (release or prepare-next), bun.lock workspace versions
|
|
44
|
-
// must match package.json exactly
|
|
45
|
-
//
|
|
38
|
+
// must match package.json exactly, unpublished -next included, and
|
|
39
|
+
// `smoo monorepo validate` refuses a lock that does not. The Bun bugs this hook
|
|
40
|
+
// began as a workaround for are closed (oven-sh/bun#18906, #20477, #20829):
|
|
41
|
+
// measured on Bun 1.4.4, `bun install --lockfile-only`, the lock update Nx runs
|
|
42
|
+
// after versioning, writes a bumped package.json version into bun.lock. But
|
|
43
|
+
// `bun install --frozen-lockfile` still accepts an entry the manifest moved
|
|
44
|
+
// past, so the release commit's lock is made exact here whatever ran before.
|
|
46
45
|
//
|
|
47
|
-
// Publish-time
|
|
48
|
-
// `smoo release publish
|
|
49
|
-
//
|
|
46
|
+
// Publish-time pins (-next → last stable tag) go only into the packed manifest
|
|
47
|
+
// of `smoo release publish`, never into bun.lock. Rewriting the lock that way
|
|
48
|
+
// on prepare-next is what left it at 0.x.y while package.json said
|
|
50
49
|
// 0.x.y-next.0 and blew up monorepo validate / packed-package-manifest.
|
|
51
50
|
const updated = syncBunLockfileVersionsToPackageJson(cwd);
|
|
52
51
|
if (updated === 0) {
|
|
@@ -84,7 +84,11 @@ export function isTestRunnerTargetName(name: string): boolean {
|
|
|
84
84
|
|
|
85
85
|
const nxJsTypescriptPlugin = '@nx/js/typescript';
|
|
86
86
|
const smoothBricksNxPlugin = '@smoothbricks/nx-plugin';
|
|
87
|
-
|
|
87
|
+
/**
|
|
88
|
+
* The executor of the retired `clean` target, which deleted declared outputs file by file. Build state is removed whole
|
|
89
|
+
* instead (cowshed rm, mbx gc), so a `targetDefaults.clean` naming it is refused and removed.
|
|
90
|
+
*/
|
|
91
|
+
const retiredCleanOutputsExecutor = '@smoothbricks/nx-plugin:clean-outputs';
|
|
88
92
|
const ciWorkflowNamedInput = ['{workspaceRoot}/.github/workflows/ci.yml'];
|
|
89
93
|
const inferredTestTypecheckTarget = 'typecheck-tests';
|
|
90
94
|
/**
|
|
@@ -138,6 +142,12 @@ export function checkWorkspaceConfig(nxJson: Record<string, unknown>): NxPolicyI
|
|
|
138
142
|
'Per-project inference selects current library or build outputs before test typechecking.',
|
|
139
143
|
});
|
|
140
144
|
}
|
|
145
|
+
if (isRetiredCleanTargetDefault(targetDefaults, targetName)) {
|
|
146
|
+
issues.push({
|
|
147
|
+
path: 'nx.json',
|
|
148
|
+
message: `targetDefaults.clean names the retired ${retiredCleanOutputsExecutor}; run smoo monorepo update to remove it`,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
141
151
|
}
|
|
142
152
|
}
|
|
143
153
|
|
|
@@ -149,9 +159,6 @@ export function checkWorkspaceConfig(nxJson: Record<string, unknown>): NxPolicyI
|
|
|
149
159
|
|
|
150
160
|
validateLintTargetDefault(nxJson, 'nx.json', issues);
|
|
151
161
|
|
|
152
|
-
// Clean target default
|
|
153
|
-
validateCleanTargetDefault(nxJson, 'nx.json', issues);
|
|
154
|
-
|
|
155
162
|
// Named input defaults
|
|
156
163
|
validateNamedInputDefaults(nxJson, 'nx.json', issues);
|
|
157
164
|
|
|
@@ -203,7 +210,6 @@ export function applyWorkspaceConfig(nxJson: Record<string, unknown>): boolean {
|
|
|
203
210
|
changed = applyBuildTargetDefault(nxJson) || changed;
|
|
204
211
|
changed = applyTestTargetDefault(nxJson) || changed;
|
|
205
212
|
changed = applyLintTargetDefault(nxJson) || changed;
|
|
206
|
-
changed = applyCleanTargetDefault(nxJson) || changed;
|
|
207
213
|
changed = applyNamedInputDefaults(nxJson) || changed;
|
|
208
214
|
const plugins = validatePlugins(nxJson.plugins === undefined ? [] : nxJson.plugins);
|
|
209
215
|
if (plugins.success) {
|
|
@@ -322,21 +328,6 @@ function validateBuildTargetDefault(
|
|
|
322
328
|
}
|
|
323
329
|
}
|
|
324
330
|
|
|
325
|
-
function validateCleanTargetDefault(
|
|
326
|
-
nxJson: Record<string, unknown>,
|
|
327
|
-
nxJsonPath: string,
|
|
328
|
-
issues: NxPolicyIssue[],
|
|
329
|
-
): void {
|
|
330
|
-
const targetDefaults = recordProperty(nxJson, 'targetDefaults');
|
|
331
|
-
const clean = targetDefaults ? recordProperty(targetDefaults, 'clean') : null;
|
|
332
|
-
if (!clean || clean.executor !== cleanOutputsExecutor) {
|
|
333
|
-
issues.push({ path: nxJsonPath, message: `targetDefaults.clean.executor must be ${cleanOutputsExecutor}` });
|
|
334
|
-
}
|
|
335
|
-
if (clean?.cache !== false) {
|
|
336
|
-
issues.push({ path: nxJsonPath, message: 'targetDefaults.clean.cache must be false' });
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
331
|
function validateNamedInputDefaults(
|
|
341
332
|
nxJson: Record<string, unknown>,
|
|
342
333
|
nxJsonPath: string,
|
|
@@ -471,14 +462,6 @@ function applyLintTargetDefault(nxJson: Record<string, unknown>): boolean {
|
|
|
471
462
|
return changed;
|
|
472
463
|
}
|
|
473
464
|
|
|
474
|
-
function applyCleanTargetDefault(nxJson: Record<string, unknown>): boolean {
|
|
475
|
-
const targetDefaults = getOrCreateRecord(nxJson, 'targetDefaults');
|
|
476
|
-
const clean = getOrCreateRecord(targetDefaults, 'clean');
|
|
477
|
-
let changed = setStringProperty(clean, 'executor', cleanOutputsExecutor);
|
|
478
|
-
changed = setBooleanProperty(clean, 'cache', false) || changed;
|
|
479
|
-
return changed;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
465
|
function applyNamedInputDefaults(nxJson: Record<string, unknown>): boolean {
|
|
483
466
|
const namedInputs = getOrCreateRecord(nxJson, 'namedInputs');
|
|
484
467
|
let changed = false;
|
|
@@ -516,7 +499,11 @@ function removeDisallowedTargetDefaults(nxJson: Record<string, unknown>): boolea
|
|
|
516
499
|
}
|
|
517
500
|
let changed = false;
|
|
518
501
|
for (const targetName of Object.keys(targetDefaults)) {
|
|
519
|
-
if (
|
|
502
|
+
if (
|
|
503
|
+
targetName.includes(':') ||
|
|
504
|
+
targetName === inferredTestTypecheckTarget ||
|
|
505
|
+
isRetiredCleanTargetDefault(targetDefaults, targetName)
|
|
506
|
+
) {
|
|
520
507
|
delete targetDefaults[targetName];
|
|
521
508
|
changed = true;
|
|
522
509
|
}
|
|
@@ -524,6 +511,10 @@ function removeDisallowedTargetDefaults(nxJson: Record<string, unknown>): boolea
|
|
|
524
511
|
return changed;
|
|
525
512
|
}
|
|
526
513
|
|
|
514
|
+
function isRetiredCleanTargetDefault(targetDefaults: Record<string, unknown>, targetName: string): boolean {
|
|
515
|
+
return targetName === 'clean' && recordProperty(targetDefaults, 'clean')?.executor === retiredCleanOutputsExecutor;
|
|
516
|
+
}
|
|
517
|
+
|
|
527
518
|
function isPreciseProductionNamedInput(production: unknown[]): boolean {
|
|
528
519
|
let hasPositiveProjectInput = false;
|
|
529
520
|
for (const input of production) {
|
|
@@ -414,9 +414,9 @@ export function catalogName(value: string): string | null {
|
|
|
414
414
|
/**
|
|
415
415
|
* Where Bun reads a root manifest's catalogs: from the object form of `workspaces` once it holds `catalog` or
|
|
416
416
|
* `catalogs`, and then from nowhere else; otherwise from the manifest's own top-level `catalog` and `catalogs`.
|
|
417
|
-
* Measured with `bun install` 1.4.3: beside a `workspaces.catalog`, a top-level `catalog` entry is not in
|
|
418
|
-
* and a top-level `catalogs` name is "no catalog named"; beside a `workspaces` object without either, the
|
|
419
|
-
* resolves.
|
|
417
|
+
* Measured with `bun install` 1.4.3 and 1.4.4: beside a `workspaces.catalog`, a top-level `catalog` entry is not in
|
|
418
|
+
* the catalog and a top-level `catalogs` name is "no catalog named"; beside a `workspaces` object without either, the
|
|
419
|
+
* top level resolves.
|
|
420
420
|
*/
|
|
421
421
|
function catalogHolder(root: PackageJson): { holder: PackageCatalogs; path: string } {
|
|
422
422
|
const workspaces = root.workspaces;
|
package/test-timings.json
CHANGED
|
@@ -2,137 +2,138 @@
|
|
|
2
2
|
"version": 1,
|
|
3
3
|
"files": {
|
|
4
4
|
"src/executors/bounded-exec/go-progress-host.test.ts": 113358,
|
|
5
|
-
"src/ensure-built.test.ts":
|
|
6
|
-
"src/
|
|
7
|
-
"src/nx-daemon-validity.test.ts": 50650,
|
|
8
|
-
"src/executors/bounded-exec/mbx-queue.test.ts": 45955,
|
|
5
|
+
"src/ensure-built.test.ts": 50158,
|
|
6
|
+
"src/nx-daemon-validity.test.ts": 43752,
|
|
9
7
|
"src/executors/bounded-exec/cargo-progress-host.test.ts": 38973,
|
|
10
|
-
"src/
|
|
11
|
-
"src/executors/bounded-exec/executor.test.ts":
|
|
12
|
-
"src/
|
|
13
|
-
"src/
|
|
14
|
-
"src/
|
|
15
|
-
"src/cargo-
|
|
16
|
-
"src/cargo-source-hash.test.ts":
|
|
17
|
-
"src/
|
|
18
|
-
"src/
|
|
19
|
-
"src/cargo-closure-input.test.ts":
|
|
20
|
-
"src/
|
|
21
|
-
"src/
|
|
22
|
-
"src/
|
|
23
|
-
"src/
|
|
24
|
-
"src/
|
|
25
|
-
"src/
|
|
26
|
-
"src/
|
|
27
|
-
"src/
|
|
28
|
-
"src/
|
|
29
|
-
"src/
|
|
30
|
-
"src/nx-daemon-
|
|
31
|
-
"src/
|
|
32
|
-
"src/
|
|
33
|
-
"src/
|
|
34
|
-
"src/
|
|
35
|
-
"src/
|
|
36
|
-
"src/nx-daemon-
|
|
37
|
-
"src/nx-
|
|
38
|
-
"src/
|
|
39
|
-
"src/
|
|
40
|
-
"src/
|
|
41
|
-
"src/
|
|
42
|
-
"src/
|
|
43
|
-
"src/
|
|
44
|
-
"src/task-
|
|
45
|
-
"src/
|
|
46
|
-
"src/
|
|
47
|
-
"src/
|
|
48
|
-
"src/nx-
|
|
49
|
-
"src/
|
|
50
|
-
"src/
|
|
51
|
-
"src/
|
|
52
|
-
"src/
|
|
53
|
-
"src/
|
|
54
|
-
"src/
|
|
55
|
-
"src/
|
|
56
|
-
"src/
|
|
57
|
-
"src/
|
|
58
|
-
"src/
|
|
59
|
-
"src/
|
|
60
|
-
"src/
|
|
61
|
-
"src/nx-
|
|
62
|
-
"src/
|
|
63
|
-
"src/
|
|
64
|
-
"src/
|
|
65
|
-
"src/
|
|
66
|
-
"src/
|
|
67
|
-
"src/
|
|
68
|
-
"src/
|
|
69
|
-
"src/nx-
|
|
70
|
-
"src/
|
|
71
|
-
"src/bun-bootstrap.test.ts":
|
|
72
|
-
"src/nx-
|
|
73
|
-
"src/
|
|
74
|
-
"src/nx-
|
|
75
|
-
"src/
|
|
76
|
-
"src/nx-raw-inputs.test.ts":
|
|
77
|
-
"src/
|
|
78
|
-
"src/
|
|
79
|
-
"src/
|
|
80
|
-
"src/
|
|
81
|
-
"src/
|
|
82
|
-
"src/
|
|
83
|
-
"src/
|
|
84
|
-
"src/
|
|
85
|
-
"src/
|
|
86
|
-
"src/
|
|
87
|
-
"src/
|
|
88
|
-
"src/
|
|
89
|
-
"src/
|
|
90
|
-
"src/
|
|
91
|
-
"src/
|
|
92
|
-
"src/
|
|
93
|
-
"src/
|
|
94
|
-
"src/
|
|
95
|
-
"src/
|
|
96
|
-
"src/
|
|
97
|
-
"src/
|
|
98
|
-
"src/
|
|
99
|
-
"src/
|
|
100
|
-
"src/
|
|
101
|
-
"src/
|
|
102
|
-
"src/
|
|
103
|
-
"src/
|
|
104
|
-
"src/
|
|
105
|
-
"src/executors/bounded-exec/
|
|
106
|
-
"src/
|
|
107
|
-
"src/managed-files/tree-permissions.test.ts": 33,
|
|
8
|
+
"src/nextest-partitions.test.ts": 35261,
|
|
9
|
+
"src/executors/bounded-exec/executor.test.ts": 28863,
|
|
10
|
+
"src/cargo-retention.test.ts": 24111,
|
|
11
|
+
"src/owned-installation.test.ts": 23722,
|
|
12
|
+
"src/ensure-built-receipt.test.ts": 20391,
|
|
13
|
+
"src/cargo-resolve-cache.test.ts": 20246,
|
|
14
|
+
"src/cargo-source-hash.test.ts": 16053,
|
|
15
|
+
"src/linked-snapshots.nx.test.ts": 11920,
|
|
16
|
+
"src/index.test.ts": 8528,
|
|
17
|
+
"src/cargo-closure-input.test.ts": 8157,
|
|
18
|
+
"src/nx-daemon-claim.test.ts": 7678,
|
|
19
|
+
"src/executors/typescript-emit/executor.test.ts": 7126,
|
|
20
|
+
"src/executors/bounded-exec/ram-temp.test.ts": 5801,
|
|
21
|
+
"src/process-group.test.ts": 5461,
|
|
22
|
+
"src/bounded-test-policy.test.ts": 5361,
|
|
23
|
+
"src/task-history-namespace.test.ts": 5246,
|
|
24
|
+
"src/executors/bounded-exec/run-cpu-pool.test.ts": 5185,
|
|
25
|
+
"src/task-results.test.ts": 4915,
|
|
26
|
+
"src/nx-daemon-start-never.test.ts": 4590,
|
|
27
|
+
"src/serial-group-wiring.test.ts": 4153,
|
|
28
|
+
"src/nx-daemon-ignore-files.test.ts": 4149,
|
|
29
|
+
"src/nx-dot-input-policy.test.ts": 3577,
|
|
30
|
+
"src/cargo-workspace.test.ts": 3534,
|
|
31
|
+
"src/cargo-build-script-env.test.ts": 3401,
|
|
32
|
+
"src/executors/bounded-exec/hang-diagnostics.test.ts": 3348,
|
|
33
|
+
"src/nx-files-archive-racy.test.ts": 3119,
|
|
34
|
+
"src/nx-daemon-idle-policy.test.ts": 3069,
|
|
35
|
+
"src/nx-remote-cache-outage.test.ts": 2542,
|
|
36
|
+
"src/cross-check-policy.test.ts": 2486,
|
|
37
|
+
"src/cargo-closure-key.test.ts": 2374,
|
|
38
|
+
"src/managed-files/repo-path.test.ts": 2244,
|
|
39
|
+
"src/testing.test.ts": 2140,
|
|
40
|
+
"src/nx-daemon-watch-filter.test.ts": 2120,
|
|
41
|
+
"src/nx-daemon-env-identity.test.ts": 2075,
|
|
42
|
+
"src/nx-task-output-lease.test.ts": 1926,
|
|
43
|
+
"src/runtime-input.test.ts": 1781,
|
|
44
|
+
"src/nx-skipped-task-exit.test.ts": 1767,
|
|
45
|
+
"src/executors/bounded-exec/verdict.test.ts": 1643,
|
|
46
|
+
"src/nx-project-graph-errors.test.ts": 1591,
|
|
47
|
+
"src/managed-files/forgejo-artifact.test.ts": 1556,
|
|
48
|
+
"src/nx-cache-restore-mtime.test.ts": 1453,
|
|
49
|
+
"src/graph-input-contract.test.ts": 1308,
|
|
50
|
+
"src/managed-files/generator.test.ts": 1168,
|
|
51
|
+
"src/nx-foreign-workspace-env.test.ts": 1151,
|
|
52
|
+
"src/nx-cache-kept-outputs.test.ts": 1095,
|
|
53
|
+
"src/nx-use-local.test.ts": 1064,
|
|
54
|
+
"src/bin/smoo-nx-bound-failures.test.ts": 1049,
|
|
55
|
+
"src/managed-files/managed-format-json.test.ts": 1041,
|
|
56
|
+
"src/typecheck-test-policy.test.ts": 1019,
|
|
57
|
+
"src/executors/all-verdicts/executor.test.ts": 972,
|
|
58
|
+
"src/nextest-code-bound.test.ts": 896,
|
|
59
|
+
"src/nx-plugin-load-errors.test.ts": 860,
|
|
60
|
+
"src/executors/bounded-exec/test-results-run.test.ts": 838,
|
|
61
|
+
"src/nx-resident-graph-workers.test.ts": 836,
|
|
62
|
+
"src/cargo-child-kill.test.ts": 745,
|
|
63
|
+
"src/test-walk-policy.test.ts": 633,
|
|
64
|
+
"src/typescript-resolution.test.ts": 562,
|
|
65
|
+
"src/executors/bounded-exec/runner-hook.test.ts": 543,
|
|
66
|
+
"src/task-graph-policy.nx.test.ts": 512,
|
|
67
|
+
"src/nx-store-resolution.test.ts": 485,
|
|
68
|
+
"src/nx-failure-life-cycles.test.ts": 450,
|
|
69
|
+
"src/bun-bootstrap.test.ts": 414,
|
|
70
|
+
"src/nx-daemon-root-normalization.test.ts": 407,
|
|
71
|
+
"src/managed-files/github-host-cache-isolation.test.ts": 356,
|
|
72
|
+
"src/nx-incomplete-run-summary.test.ts": 346,
|
|
73
|
+
"src/nx-critical-path-schedule.test.ts": 315,
|
|
74
|
+
"src/nx-raw-inputs.test.ts": 275,
|
|
75
|
+
"src/nx-cache-bound.test.ts": 248,
|
|
76
|
+
"src/ensure-built-witness.test.ts": 237,
|
|
77
|
+
"src/test-clock-policy.test.ts": 230,
|
|
78
|
+
"src/managed-files/unserved-workspace-hooks.test.ts": 215,
|
|
79
|
+
"src/executors/bounded-exec/cpu-pool.test.ts": 212,
|
|
80
|
+
"src/package-target-policy.test.ts": 211,
|
|
81
|
+
"src/executors/cargo-zigbuild/executor.test.ts": 194,
|
|
82
|
+
"src/lock-scope.test.ts": 135,
|
|
83
|
+
"src/managed-files/cache-ttsc-plugins.test.ts": 116,
|
|
84
|
+
"src/forbidden-spelling-policy.test.ts": 115,
|
|
85
|
+
"src/managed-files/devenv-wrapper.test.ts": 103,
|
|
86
|
+
"src/executors/bounded-exec/runtime-pin.test.ts": 99,
|
|
87
|
+
"src/nx-state-location.test.ts": 88,
|
|
88
|
+
"src/managed-files/setup-devenv-free-disk.test.ts": 86,
|
|
89
|
+
"src/generators/make-public/generator.test.ts": 85,
|
|
90
|
+
"src/test-timings.test.ts": 85,
|
|
91
|
+
"src/cargo-closure-filesets.test.ts": 83,
|
|
92
|
+
"src/executors/scriptc-native/executor.test.ts": 80,
|
|
93
|
+
"src/executors/wrangler-deploy/executor.test.ts": 70,
|
|
94
|
+
"src/producer-receipts.test.ts": 60,
|
|
95
|
+
"src/release-config-policy.test.ts": 56,
|
|
96
|
+
"src/version-actions.test.ts": 53,
|
|
97
|
+
"src/manifest-hash.test.ts": 49,
|
|
98
|
+
"src/workspace-config-policy.test.ts": 47,
|
|
99
|
+
"src/executors/wrangler-deploy/hasher.test.ts": 39,
|
|
100
|
+
"src/generators/create-package/generator.test.ts": 33,
|
|
101
|
+
"src/cargo-toolchain-paths.test.ts": 31,
|
|
102
|
+
"src/eslint-sources.test.ts": 31,
|
|
103
|
+
"src/executors/bounded-exec/test-results.test.ts": 30,
|
|
104
|
+
"src/managed-files/trace-db-artifact.test.ts": 30,
|
|
108
105
|
"src/executors/nextest-group/executor.test.ts": 28,
|
|
109
|
-
"src/executors/bounded-exec/
|
|
110
|
-
"src/
|
|
111
|
-
"src/executors/
|
|
112
|
-
"src/
|
|
113
|
-
"src/generators/bun-test-tracing/generator.test.ts":
|
|
114
|
-
"src/
|
|
115
|
-
"src/
|
|
116
|
-
"src/
|
|
117
|
-
"src/
|
|
118
|
-
"src/
|
|
119
|
-
"src/
|
|
120
|
-
"src/
|
|
121
|
-
"src/executors/bounded-exec/
|
|
122
|
-
"src/managed-files/
|
|
123
|
-
"src/
|
|
124
|
-
"src/
|
|
125
|
-
"src/
|
|
126
|
-
"src/managed-files/
|
|
127
|
-
"src/
|
|
128
|
-
"src/
|
|
129
|
-
"src/
|
|
130
|
-
"src/
|
|
131
|
-
"src/
|
|
132
|
-
"src/
|
|
133
|
-
"src/
|
|
134
|
-
"src/
|
|
135
|
-
"src/
|
|
136
|
-
"src/
|
|
106
|
+
"src/executors/bounded-exec/disk-lease.test.ts": 27,
|
|
107
|
+
"src/executors/bounded-exec/ram-provenance.test.ts": 27,
|
|
108
|
+
"src/executors/bounded-exec/progress.test.ts": 26,
|
|
109
|
+
"src/executors/bounded-exec/ram-detach.test.ts": 25,
|
|
110
|
+
"src/generators/bun-test-tracing/generator.test.ts": 25,
|
|
111
|
+
"src/executors/bounded-exec/mbx-queue.test.ts": 24,
|
|
112
|
+
"src/build-state-output-policy.test.ts": 21,
|
|
113
|
+
"src/generators/bounded-test-targets/generator.test.ts": 21,
|
|
114
|
+
"src/executors/bounded-exec/bounds.test.ts": 20,
|
|
115
|
+
"src/executors/bounded-exec/runner-sizing.test.ts": 19,
|
|
116
|
+
"src/executors/bounded-exec/lock-wait.test.ts": 17,
|
|
117
|
+
"src/executors/bounded-exec/ram-temp-held.test.ts": 17,
|
|
118
|
+
"src/executors/bounded-exec/runner-lifecycle.test.ts": 17,
|
|
119
|
+
"src/managed-files/json-edit.test.ts": 17,
|
|
120
|
+
"src/executors/bounded-exec/mbx-pool.test.ts": 15,
|
|
121
|
+
"src/executors/bounded-exec/ram-fixture.test.ts": 14,
|
|
122
|
+
"src/managed-files/tree-permissions.test.ts": 12,
|
|
123
|
+
"src/managed-files/tree.test.ts": 12,
|
|
124
|
+
"src/wait-why-policy.test.ts": 12,
|
|
125
|
+
"src/executors/bounded-exec/owned-subtree.test.ts": 11,
|
|
126
|
+
"src/cargo-closure-input.property.test.ts": 10,
|
|
127
|
+
"src/managed-files/managed-content.test.ts": 10,
|
|
128
|
+
"src/nx-daemon-idle-cpu.test.ts": 10,
|
|
129
|
+
"src/task-graph-policy.test.ts": 10,
|
|
130
|
+
"src/disk-command-policy.test.ts": 9,
|
|
131
|
+
"src/test-program.test.ts": 9,
|
|
132
|
+
"src/bun-file-packages.test.ts": 8,
|
|
133
|
+
"src/cargo-retention-hook.test.ts": 8,
|
|
134
|
+
"src/host-controller-wiring.test.ts": 8,
|
|
135
|
+
"src/nx-project-resolution-cache.test.ts": 8,
|
|
136
|
+
"src/nx-task-graph-cycles.test.ts": 7,
|
|
137
|
+
"src/nx-run-information.test.ts": 6
|
|
137
138
|
}
|
|
138
139
|
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { CleanOutputsOptions } from './schema.js';
|
|
2
|
-
interface CleanOutputsContext {
|
|
3
|
-
root: string;
|
|
4
|
-
projectName?: string;
|
|
5
|
-
projectsConfigurations?: {
|
|
6
|
-
projects: Record<string, NxProject>;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
interface CleanOutputsResult {
|
|
10
|
-
success: boolean;
|
|
11
|
-
}
|
|
12
|
-
interface NxProject {
|
|
13
|
-
root?: string;
|
|
14
|
-
targets?: Record<string, {
|
|
15
|
-
outputs?: string[];
|
|
16
|
-
}>;
|
|
17
|
-
}
|
|
18
|
-
export default function cleanOutputsExecutor(options: CleanOutputsOptions, context: CleanOutputsContext): Promise<CleanOutputsResult>;
|
|
19
|
-
export declare function resolveOutputDirs(options: {
|
|
20
|
-
outputs: string[];
|
|
21
|
-
projectName: string;
|
|
22
|
-
projectRoot: string;
|
|
23
|
-
workspaceRoot: string;
|
|
24
|
-
}): string[];
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=executor.d.ts.map
|