@smoothbricks/nx-plugin 0.7.16 → 0.7.18
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 +210 -64
- package/dist/.build-inputs.json +28 -23
- package/dist/bun-lock-scope.d.ts +128 -20
- package/dist/bun-lock-scope.d.ts.map +1 -1
- package/dist/bun-lock-scope.js +267 -44
- package/dist/cargo-closure-input.d.ts +8 -6
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +14 -11
- package/dist/cargo-source-hash.d.ts +23 -4
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +80 -14
- package/dist/cargo-workspace.d.ts +20 -2
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +42 -22
- package/dist/compile-environment.d.ts +8 -0
- package/dist/compile-environment.d.ts.map +1 -0
- package/dist/compile-environment.js +80 -0
- package/dist/dependency-manifests.d.ts +13 -0
- package/dist/dependency-manifests.d.ts.map +1 -0
- package/dist/dependency-manifests.js +20 -0
- package/dist/ensure-built-receipt.d.ts +3 -2
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +3 -2
- package/dist/eslint-config-closure.d.ts +8 -3
- package/dist/eslint-config-closure.d.ts.map +1 -1
- package/dist/eslint-config-closure.js +24 -5
- package/dist/executors/bounded-exec/bounds.d.ts +12 -1
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
- package/dist/executors/bounded-exec/bounds.js +8 -4
- package/dist/executors/bounded-exec/cpu-rise.d.ts +73 -0
- package/dist/executors/bounded-exec/cpu-rise.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-rise.js +111 -0
- package/dist/executors/bounded-exec/executor.d.ts +1 -1
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +54 -22
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +8 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +66 -6
- package/dist/executors/bounded-exec/mbx-pool.d.ts +16 -2
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-pool.js +18 -2
- package/dist/executors/bounded-exec/mbx-reservations.d.ts +5 -2
- package/dist/executors/bounded-exec/mbx-reservations.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-reservations.js +5 -3
- package/dist/executors/bounded-exec/progress-channel.d.ts +38 -0
- package/dist/executors/bounded-exec/progress-channel.d.ts.map +1 -0
- package/dist/executors/bounded-exec/progress-channel.js +113 -0
- package/dist/executors/bounded-exec/progress.d.ts +2 -1
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.d.ts +24 -1
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +123 -16
- package/dist/executors/bounded-exec/schema.d.ts +5 -0
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/schema.js +17 -1
- package/dist/executors/bounded-exec/verdict.d.ts +13 -6
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +34 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +216 -97
- package/dist/managed-files/files.d.ts +3 -3
- package/dist/managed-files/files.js +3 -3
- package/dist/managed-files/generator.d.ts +5 -1
- package/dist/managed-files/generator.d.ts.map +1 -1
- package/dist/managed-files/generator.js +22 -7
- package/dist/managed-files/render-memo.d.ts +13 -0
- package/dist/managed-files/render-memo.d.ts.map +1 -0
- package/dist/managed-files/render-memo.js +94 -0
- package/dist/test-program.d.ts +11 -6
- package/dist/test-program.d.ts.map +1 -1
- package/dist/test-program.js +39 -35
- package/dist/tool-bins.d.ts +12 -0
- package/dist/tool-bins.d.ts.map +1 -1
- package/dist/tool-bins.js +31 -6
- package/dist/typecheck-route.d.ts +3 -4
- package/dist/typecheck-route.d.ts.map +1 -1
- package/dist/typecheck-route.js +4 -15
- package/dist/typecheck-test-policy.d.ts +10 -1
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +40 -24
- package/dist/workspace-index.d.ts +14 -1
- package/dist/workspace-index.d.ts.map +1 -1
- package/dist/workspace-index.js +36 -4
- package/managed/raw/patches/nx@24.0.3.patch +703 -119
- package/managed/raw/patches/{ttsc@0.34.1.patch → ttsc@0.36.3.patch} +728 -71
- package/managed/raw/tooling/direnv/developer-links.ts +17 -3
- package/managed/raw/tooling/direnv/devenv.smoo.nix +1 -1
- package/managed/templates/github/actions/save-nix-devenv/action.yml +19 -1
- package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
- package/package.json +5 -4
- package/src/bun-lock-scope.ts +293 -40
- package/src/cargo-closure-input.ts +19 -11
- package/src/cargo-source-hash.ts +103 -13
- package/src/cargo-workspace.ts +59 -20
- package/src/compile-environment.ts +35 -0
- package/src/dependency-manifests.ts +30 -0
- package/src/ensure-built-receipt.ts +3 -2
- package/src/eslint-config-closure.ts +27 -6
- package/src/executors/bounded-exec/bounds.ts +13 -4
- package/src/executors/bounded-exec/cpu-rise.ts +156 -0
- package/src/executors/bounded-exec/executor.ts +65 -21
- package/src/executors/bounded-exec/hang-diagnostics.ts +88 -6
- package/src/executors/bounded-exec/mbx-pool.ts +24 -3
- package/src/executors/bounded-exec/mbx-reservations.ts +7 -5
- package/src/executors/bounded-exec/progress-channel.ts +129 -0
- package/src/executors/bounded-exec/progress.ts +2 -1
- package/src/executors/bounded-exec/ram-temp.ts +137 -17
- package/src/executors/bounded-exec/schema.ts +19 -0
- package/src/executors/bounded-exec/verdict.ts +44 -16
- package/src/index.ts +272 -106
- package/src/managed-files/files.ts +3 -3
- package/src/managed-files/generator.ts +21 -6
- package/src/managed-files/render-memo.ts +135 -0
- package/src/test-program.ts +36 -41
- package/src/tool-bins.ts +35 -6
- package/src/typecheck-route.ts +5 -14
- package/src/typecheck-test-policy.ts +49 -24
- package/src/workspace-index.ts +40 -5
- package/test-timings.json +6 -0
package/src/index.ts
CHANGED
|
@@ -26,7 +26,22 @@ import { parse as parseToml } from 'smol-toml';
|
|
|
26
26
|
import { BOUNDED_TEST_IDLE_TIMEOUT_MS, BOUNDED_TEST_KILL_AFTER_MS } from './bounded-test-policy.js';
|
|
27
27
|
import { refuseOverlappingOutputs } from './build-state-output-policy.js';
|
|
28
28
|
import { builtOutputLockfileDependencies, builtOutputLockfileNodes } from './built-output-packages.js';
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
BUN_LOCK_SCOPE_NAMED_INPUT,
|
|
31
|
+
bunLoadInput,
|
|
32
|
+
bunLoadScopes,
|
|
33
|
+
bunLockDependencies,
|
|
34
|
+
bunLockInput,
|
|
35
|
+
bunLockNode,
|
|
36
|
+
bunLockRuntimeNode,
|
|
37
|
+
bunScopeInput,
|
|
38
|
+
bunVersionAliasDependencies,
|
|
39
|
+
manifestsAbove,
|
|
40
|
+
type PackageLoad,
|
|
41
|
+
refuseUndeclaredImports,
|
|
42
|
+
specifierPackage,
|
|
43
|
+
typescriptLoads,
|
|
44
|
+
} from './bun-lock-scope.js';
|
|
30
45
|
import {
|
|
31
46
|
CARGO_CLOSURE_INPUT,
|
|
32
47
|
CARGO_LOCK_NODE_PREFIX,
|
|
@@ -34,7 +49,7 @@ import {
|
|
|
34
49
|
cargoClosureInputs,
|
|
35
50
|
cargoLockNode,
|
|
36
51
|
cargoLockNodeName,
|
|
37
|
-
|
|
52
|
+
indexedCargoSources,
|
|
38
53
|
isCargoLockInput,
|
|
39
54
|
resolveCargoClosureSource,
|
|
40
55
|
} from './cargo-closure-input.js';
|
|
@@ -49,6 +64,7 @@ import {
|
|
|
49
64
|
type CargoCrossTestTarget,
|
|
50
65
|
type CargoInputsCache,
|
|
51
66
|
cargoPackageTestInputs,
|
|
67
|
+
cargoProducerOutputInputs,
|
|
52
68
|
cargoTestGroupTargetName,
|
|
53
69
|
cargoTestPackageTargetName,
|
|
54
70
|
createCargoInputsCache,
|
|
@@ -63,6 +79,7 @@ import {
|
|
|
63
79
|
type SerialTestGroup,
|
|
64
80
|
serialTestGroups,
|
|
65
81
|
} from './cargo-workspace.js';
|
|
82
|
+
import { compileEnvironment } from './compile-environment.js';
|
|
66
83
|
import {
|
|
67
84
|
CARGO_CROSS_LINT_COMMAND,
|
|
68
85
|
CARGO_CROSS_LINT_TARGET,
|
|
@@ -75,6 +92,7 @@ import {
|
|
|
75
92
|
cargoFrozen,
|
|
76
93
|
runsFrozenCargo,
|
|
77
94
|
} from './cross-check-policy.js';
|
|
95
|
+
import { type DependencyManifest, directDependencyManifests } from './dependency-manifests.js';
|
|
78
96
|
import { eslintConfigClosure } from './eslint-config-closure.js';
|
|
79
97
|
import type { EslintFileSet } from './eslint-file-set.js';
|
|
80
98
|
import { ESLINT_SOURCES_GLOB, eslintSources } from './eslint-sources.js';
|
|
@@ -83,8 +101,10 @@ import {
|
|
|
83
101
|
type AllVerdictsOptions,
|
|
84
102
|
ESLINT_SOURCES_TOKEN,
|
|
85
103
|
} from './executors/all-verdicts/schema.js';
|
|
104
|
+
import { runsAsCargoLeaf } from './executors/bounded-exec/mbx-pool.js';
|
|
86
105
|
import { closeRunReservations, serveRunReservations } from './executors/bounded-exec/mbx-reservations.js';
|
|
87
106
|
import { closeRunCpuPool, serveRunCpuPool } from './executors/bounded-exec/run-cpu-pool.js';
|
|
107
|
+
import { boundedCommand } from './executors/bounded-exec/schema.js';
|
|
88
108
|
import { ffiPathProblem } from './executors/scriptc-native/ffi-paths.js';
|
|
89
109
|
import type { ScriptcNativeFfi } from './executors/scriptc-native/schema.js';
|
|
90
110
|
import { hashVersionlessCrateManifests } from './manifest-hash.js';
|
|
@@ -104,7 +124,13 @@ import {
|
|
|
104
124
|
timingsSuiteInputs,
|
|
105
125
|
} from './test-timings.js';
|
|
106
126
|
import { assertUpstreamBasePrecondition } from './test-walk-policy.js';
|
|
107
|
-
import {
|
|
127
|
+
import {
|
|
128
|
+
type NativeTools,
|
|
129
|
+
nativeToolCommand,
|
|
130
|
+
nativeToolDependsOn,
|
|
131
|
+
pluginBuildDependsOn,
|
|
132
|
+
resolveNativeTools,
|
|
133
|
+
} from './tool-bins.js';
|
|
108
134
|
import { typecheckRoute } from './typecheck-route.js';
|
|
109
135
|
import {
|
|
110
136
|
isBuildOutputTargetName,
|
|
@@ -160,11 +186,8 @@ interface TypecheckTargets {
|
|
|
160
186
|
* which bun.lock and the patches in its check inputs already key, and it waits for the targets the declaring package
|
|
161
187
|
* names to prepare the plugin binaries ttsc loads. Every other project runs the pinned native compiler.
|
|
162
188
|
*/
|
|
163
|
-
function typecheckTargets(
|
|
164
|
-
const route = typecheckRoute(
|
|
165
|
-
...Object.keys(packageJson.dependencies ?? {}),
|
|
166
|
-
...Object.keys(packageJson.devDependencies ?? {}),
|
|
167
|
-
]);
|
|
189
|
+
function typecheckTargets(manifests: readonly DependencyManifest[]): TypecheckTargets {
|
|
190
|
+
const route = typecheckRoute(manifests);
|
|
168
191
|
return route.declaredBy.length === 0
|
|
169
192
|
? { command: typecheckCommand, inputs: [TYPECHECK_COMPILER_INPUT], dependsOn: [] }
|
|
170
193
|
: { command: (args) => `ttsc ${args}`, inputs: [], dependsOn: route.dependsOn };
|
|
@@ -232,13 +255,46 @@ const NODE_MODULES_SEGMENT = /(?:^|\/)node_modules(?:\/|$)/;
|
|
|
232
255
|
* which is the silence above. The ancestors this cannot name as a fileset are
|
|
233
256
|
* the two kinds Nx has no fileset for; see {@link configChainInput}.
|
|
234
257
|
*/
|
|
235
|
-
function typescriptConfigChainInputs(configPaths: readonly string[], workspaceRoot: string):
|
|
236
|
-
const
|
|
258
|
+
function typescriptConfigChainInputs(configPaths: readonly string[], workspaceRoot: string): TypescriptConfigChain {
|
|
259
|
+
const chain: TypescriptConfigChainParts = {
|
|
260
|
+
inputs: new Set([WORKSPACE_TSCONFIG_BASE_INPUT]),
|
|
261
|
+
extendsLoads: [],
|
|
262
|
+
transformLoads: [],
|
|
263
|
+
};
|
|
237
264
|
const walked = new Set<string>();
|
|
238
265
|
for (const configPath of configPaths) {
|
|
239
|
-
addTypescriptConfigAncestors(configPath, workspaceRoot,
|
|
266
|
+
addTypescriptConfigAncestors(configPath, workspaceRoot, chain, walked);
|
|
267
|
+
}
|
|
268
|
+
return { inputs: [...chain.inputs], extendsLoads: chain.extendsLoads, transformLoads: chain.transformLoads };
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** What a project's TypeScript configs make its tasks read: the config files, and the packages they load by name. */
|
|
272
|
+
interface TypescriptConfigChain {
|
|
273
|
+
/** Every workspace config of the chains, as an input. */
|
|
274
|
+
readonly inputs: string[];
|
|
275
|
+
/** Each installed config the chains extend, by the package holding it and the directory of the config naming it. */
|
|
276
|
+
readonly extendsLoads: readonly PackageLoad[];
|
|
277
|
+
/** Each transform plugin a workspace config of the chains names (`compilerOptions.plugins[].transform`), which ttsc loads. */
|
|
278
|
+
readonly transformLoads: readonly PackageLoad[];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
interface TypescriptConfigChainParts {
|
|
282
|
+
readonly inputs: Set<string>;
|
|
283
|
+
readonly extendsLoads: PackageLoad[];
|
|
284
|
+
readonly transformLoads: PackageLoad[];
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** The bare transform plugin specifiers one config names (`compilerOptions.plugins[].transform`). */
|
|
288
|
+
function typescriptTransforms(configPath: string): string[] {
|
|
289
|
+
const config: unknown = readJsonFile(configPath, { expectComments: true });
|
|
290
|
+
if (!isRecord(config) || !isRecord(config.compilerOptions) || !Array.isArray(config.compilerOptions.plugins)) {
|
|
291
|
+
return [];
|
|
240
292
|
}
|
|
241
|
-
return
|
|
293
|
+
return config.compilerOptions.plugins.flatMap((plugin: unknown) =>
|
|
294
|
+
isRecord(plugin) && typeof plugin.transform === 'string' && /^[@\w]/u.test(plugin.transform)
|
|
295
|
+
? [plugin.transform]
|
|
296
|
+
: [],
|
|
297
|
+
);
|
|
242
298
|
}
|
|
243
299
|
|
|
244
300
|
/**
|
|
@@ -246,24 +302,32 @@ function typescriptConfigChainInputs(configPaths: readonly string[], workspaceRo
|
|
|
246
302
|
* `extends` cycle.
|
|
247
303
|
*
|
|
248
304
|
* The walk stops at an ancestor Nx cannot hash, because everything reachable
|
|
249
|
-
* from an installed config is installed too: the
|
|
250
|
-
*
|
|
251
|
-
*
|
|
305
|
+
* from an installed config is installed too: the package holding it is
|
|
306
|
+
* recorded as a load of the extending config's directory, and the lock scope
|
|
307
|
+
* that declares it there keys that whole subtree. Parsing it could only
|
|
308
|
+
* invent failures for a dependency's own chain.
|
|
252
309
|
*/
|
|
253
310
|
function addTypescriptConfigAncestors(
|
|
254
311
|
configPath: string,
|
|
255
312
|
workspaceRoot: string,
|
|
256
|
-
|
|
313
|
+
chain: TypescriptConfigChainParts,
|
|
257
314
|
walked: Set<string>,
|
|
258
315
|
): void {
|
|
259
316
|
if (walked.has(configPath)) return;
|
|
260
317
|
walked.add(configPath);
|
|
318
|
+
const directory = relative(workspaceRoot, dirname(configPath)).replaceAll('\\', '/') || '.';
|
|
319
|
+
for (const transform of typescriptTransforms(configPath)) {
|
|
320
|
+
chain.transformLoads.push({ directory, name: specifierPackage(transform) });
|
|
321
|
+
}
|
|
261
322
|
for (const specifier of typescriptConfigExtends(configPath)) {
|
|
262
323
|
const ancestor = resolveTypescriptConfigExtends(specifier, configPath);
|
|
263
324
|
const input = configChainInput(ancestor, configPath, workspaceRoot);
|
|
264
|
-
if (input === null)
|
|
265
|
-
|
|
266
|
-
|
|
325
|
+
if (input === null) {
|
|
326
|
+
if (ancestor.installed) chain.extendsLoads.push({ directory, name: specifierPackage(specifier) });
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
chain.inputs.add(input);
|
|
330
|
+
addTypescriptConfigAncestors(ancestor.path, workspaceRoot, chain, walked);
|
|
267
331
|
}
|
|
268
332
|
}
|
|
269
333
|
|
|
@@ -427,6 +491,8 @@ interface EslintWorkspace {
|
|
|
427
491
|
readonly sources: ReadonlySet<string>;
|
|
428
492
|
/** The workspace modules the root configs load, transitively, workspace-relative and sorted; the configs excluded. */
|
|
429
493
|
readonly configImports: readonly string[];
|
|
494
|
+
/** The lock scopes of the installed packages those modules load by name, each where its module loads it; sorted. */
|
|
495
|
+
readonly configScopes: readonly string[];
|
|
430
496
|
}
|
|
431
497
|
|
|
432
498
|
/**
|
|
@@ -446,15 +512,18 @@ interface EslintWorkspace {
|
|
|
446
512
|
* The configs key every lint target with exactly the workspace files they
|
|
447
513
|
* load (eslint-config-closure.ts): a glob over the directory holding a
|
|
448
514
|
* config's rule modules keyed every file beside them, and one test fixture
|
|
449
|
-
* there re-keyed 44 lint targets in one land.
|
|
515
|
+
* there re-keyed 44 lint targets in one land. The packages they load by name
|
|
516
|
+
* key it by the lock scope declaring each where it loads (bun-lock-scope.ts).
|
|
450
517
|
*/
|
|
451
518
|
async function eslintWorkspace(workspaceRoot: string): Promise<EslintWorkspace | null> {
|
|
452
519
|
const configs = ESLINT_CONFIG_FILES.filter((name) => existsSync(join(workspaceRoot, name)));
|
|
453
520
|
if (configs.length === 0) return null;
|
|
454
521
|
const indexed = new Set(await globIndexedFiles(workspaceRoot, [ESLINT_SOURCES_GLOB, '**/*.json']));
|
|
522
|
+
const closure = eslintConfigClosure(workspaceRoot, configs, indexed);
|
|
455
523
|
return {
|
|
456
524
|
sources: new Set([...indexed].filter((path) => !path.endsWith('.json'))),
|
|
457
|
-
configImports:
|
|
525
|
+
configImports: closure.files,
|
|
526
|
+
configScopes: bunLoadScopes(workspaceRoot, closure.packageLoads),
|
|
458
527
|
};
|
|
459
528
|
}
|
|
460
529
|
|
|
@@ -852,18 +921,21 @@ function createCargoWasmTarget(
|
|
|
852
921
|
* create its parent, so the build consumes what the `mkdir` produced. Outside
|
|
853
922
|
* Nx there is no task hash, and a build no task names is refused here rather
|
|
854
923
|
* than by every runner.
|
|
924
|
+
*
|
|
925
|
+
* `inputs` is the workspace's Cargo union; the build also runs the nextest helper (`record`).
|
|
855
926
|
*/
|
|
856
927
|
function createCargoTestBuildTarget(
|
|
857
928
|
projectRoot: string,
|
|
858
929
|
toolConfig: string,
|
|
859
930
|
nativeTools: NativeTools | null,
|
|
931
|
+
inputs: NonNullable<TargetConfiguration['inputs']>,
|
|
860
932
|
): TargetConfiguration {
|
|
861
|
-
const helper = nativeToolCommand(nativeTools, projectRoot, 'nextest-extract',
|
|
933
|
+
const helper = nativeToolCommand(nativeTools, projectRoot, 'nextest-extract', NEXTEST_HELPER_BIN);
|
|
862
934
|
return {
|
|
863
935
|
executor: 'nx:run-commands',
|
|
864
936
|
metadata: CARGO_PRODUCER_METADATA,
|
|
865
937
|
cache: true,
|
|
866
|
-
inputs:
|
|
938
|
+
inputs: [...inputs, ...nextestHelperInputs(nativeTools)],
|
|
867
939
|
outputs: [
|
|
868
940
|
`{projectRoot}/${NEXTEST_BINARIES_METADATA}`,
|
|
869
941
|
`{projectRoot}/${NEXTEST_CARGO_METADATA}`,
|
|
@@ -893,6 +965,21 @@ function nextestBinariesBuild(toolConfig: string): string {
|
|
|
893
965
|
return cargoFrozen(`${NEXTEST_BINARIES_BUILD_ARGS.join(' ')} ${toolConfig}`);
|
|
894
966
|
}
|
|
895
967
|
|
|
968
|
+
/** The nextest helper the test build and every runner run (`record`, `ensure`, `target-dir`). */
|
|
969
|
+
const NEXTEST_HELPER_BIN = 'smoo-nx-nextest-binaries';
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* The helper's bytes, for a target that runs it, where this workspace builds it: the producer edge orders the build and
|
|
973
|
+
* this input keys what the target runs. An installed helper is its package's, keyed as the package.
|
|
974
|
+
*/
|
|
975
|
+
function nextestHelperInputs(
|
|
976
|
+
nativeTools: NativeTools | null,
|
|
977
|
+
): { dependentTasksOutputFiles: string; transitive: false }[] {
|
|
978
|
+
return nativeTools !== null && nativeToolDependsOn(nativeTools, 'nextest-extract').length > 0
|
|
979
|
+
? [{ dependentTasksOutputFiles: `**/dist/bin/${nativeTools.platform}/${NEXTEST_HELPER_BIN}`, transitive: false }]
|
|
980
|
+
: [];
|
|
981
|
+
}
|
|
982
|
+
|
|
896
983
|
/**
|
|
897
984
|
* One foreign triple's test archive, and the target that EXECUTES it.
|
|
898
985
|
*
|
|
@@ -1307,12 +1394,14 @@ export const postTasksExecution: PostTasksExecution<ProducerReceiptsOptions> = a
|
|
|
1307
1394
|
export const createDependencies: CreateDependencies = (options, context) => [
|
|
1308
1395
|
...bunLockDependencies(context),
|
|
1309
1396
|
...builtOutputLockfileDependencies(options, context),
|
|
1397
|
+
...bunVersionAliasDependencies(context.externalNodes ?? {}),
|
|
1310
1398
|
];
|
|
1311
1399
|
|
|
1312
1400
|
/** Nx invokes this only after merging inferred/declarative targets and every plugin's project dependencies. */
|
|
1313
1401
|
export const createMetadata: CreateMetadata = (graph, _options, context) => {
|
|
1314
1402
|
refuseOverlappingOutputs(graph, context.workspaceRoot);
|
|
1315
1403
|
refuseBuildTestDependencies(graph, context.workspaceRoot);
|
|
1404
|
+
refuseUndeclaredImports(graph);
|
|
1316
1405
|
return {};
|
|
1317
1406
|
};
|
|
1318
1407
|
|
|
@@ -1625,7 +1714,14 @@ async function createProjectTargets(
|
|
|
1625
1714
|
const projectRoot = dirname(packageJsonPath);
|
|
1626
1715
|
const absoluteProjectRoot = join(workspaceRoot, projectRoot);
|
|
1627
1716
|
const packageJson = await readPackageJson(join(workspaceRoot, packageJsonPath));
|
|
1628
|
-
const
|
|
1717
|
+
const dependencyManifests = directDependencyManifests(join(workspaceRoot, packageJsonPath), [
|
|
1718
|
+
...Object.keys(packageJson.dependencies ?? {}),
|
|
1719
|
+
...Object.keys(packageJson.devDependencies ?? {}),
|
|
1720
|
+
]);
|
|
1721
|
+
const typecheck = typecheckTargets(dependencyManifests);
|
|
1722
|
+
// The environment a direct dependency's ttsc plugin lowers by (compile-environment.ts): the emitted JavaScript is a
|
|
1723
|
+
// function of it, so every target whose output is the transformed compile hashes it. A check never is.
|
|
1724
|
+
const compileEnvInputs = compileEnvironment(dependencyManifests).map((name) => ({ env: name }));
|
|
1629
1725
|
const projectName = packageJson.nx?.name ?? packageJson.name;
|
|
1630
1726
|
if (typeof projectName !== 'string' || projectName.length === 0) {
|
|
1631
1727
|
throw new Error(`${packageJsonPath} must declare a non-empty package or nx project name`);
|
|
@@ -1672,20 +1768,40 @@ async function createProjectTargets(
|
|
|
1672
1768
|
[...(hasLibTsconfig ? [libTsconfigPath] : []), ...(hasTestTsconfig ? [testTsconfigPath] : [])],
|
|
1673
1769
|
workspaceRoot,
|
|
1674
1770
|
);
|
|
1771
|
+
// The packages a TypeScript task loads by name beyond its sources' imports, each keyed by the lock scope that
|
|
1772
|
+
// declares it where it loads (bun-lock-scope.ts): the project's own node keys its own declarations, and a root
|
|
1773
|
+
// declaration is named by itself, so no task is keyed on root tooling it never loads. A check reads the @types and
|
|
1774
|
+
// tslib TypeScript finds by ancestry and the installed configs its chain extends. The emit also runs ttsc from the
|
|
1775
|
+
// root's node_modules/.bin, and ttsc loads the TypeScript API from the project and each transform plugin its
|
|
1776
|
+
// configs name.
|
|
1777
|
+
const manifests = manifestsAbove(workspaceRoot, projectRoot);
|
|
1778
|
+
const rootManifests = manifests.filter((manifest) => manifest.root === '.');
|
|
1779
|
+
const checkScopes = [
|
|
1780
|
+
...bunLoadInput(manifests, typescriptLoads(manifests)).externalDependencies,
|
|
1781
|
+
...bunLoadScopes(workspaceRoot, typescriptConfigChain.extendsLoads),
|
|
1782
|
+
];
|
|
1783
|
+
const checkScopeInput = bunScopeInput(projectRoot, checkScopes);
|
|
1784
|
+
const emitScopeInput = bunScopeInput(
|
|
1785
|
+
projectRoot,
|
|
1786
|
+
checkScopes,
|
|
1787
|
+
bunLoadInput(manifests, ['typescript']).externalDependencies,
|
|
1788
|
+
bunLoadInput(rootManifests, ['ttsc', '@typescript/native']).externalDependencies,
|
|
1789
|
+
bunLoadScopes(workspaceRoot, typescriptConfigChain.transformLoads),
|
|
1790
|
+
);
|
|
1675
1791
|
const toolchainInputs = [
|
|
1676
1792
|
...RELEASE_REWRITTEN_WORKSPACE_INPUTS,
|
|
1677
|
-
|
|
1793
|
+
emitScopeInput,
|
|
1678
1794
|
...TYPESCRIPT_PATCH_INPUTS,
|
|
1679
|
-
...typescriptConfigChain,
|
|
1795
|
+
...typescriptConfigChain.inputs,
|
|
1680
1796
|
];
|
|
1681
1797
|
const checkInputs =
|
|
1682
1798
|
versionless === null
|
|
1683
1799
|
? toolchainInputs
|
|
1684
1800
|
: [
|
|
1685
1801
|
...TYPESCRIPT_PATCH_INPUTS,
|
|
1686
|
-
...typescriptConfigChain,
|
|
1802
|
+
...typescriptConfigChain.inputs,
|
|
1687
1803
|
...VERSIONLESS_TOOLCHAIN_MANIFEST_INPUTS,
|
|
1688
|
-
|
|
1804
|
+
checkScopeInput,
|
|
1689
1805
|
];
|
|
1690
1806
|
const selfProduction = versionless === null ? 'production' : VERSIONLESS_PRODUCTION_INPUT;
|
|
1691
1807
|
const selfDefault = versionless === null ? 'default' : VERSIONLESS_DEFAULT_INPUT;
|
|
@@ -1726,7 +1842,7 @@ async function createProjectTargets(
|
|
|
1726
1842
|
targets['tsc-js'] = {
|
|
1727
1843
|
executor: '@smoothbricks/nx-plugin:typescript-emit',
|
|
1728
1844
|
cache: true,
|
|
1729
|
-
inputs: ['production', '^production', ...toolchainInputs, '{projectRoot}/tsconfig.lib.json'],
|
|
1845
|
+
inputs: ['production', '^production', ...toolchainInputs, ...compileEnvInputs, '{projectRoot}/tsconfig.lib.json'],
|
|
1730
1846
|
outputs: inferTypescriptOutputs(libOutDir),
|
|
1731
1847
|
dependsOn: ['^*-js', ...(cargoWasmConfig ? ['cargo-wasm'] : [])],
|
|
1732
1848
|
options: {
|
|
@@ -1754,7 +1870,10 @@ async function createProjectTargets(
|
|
|
1754
1870
|
};
|
|
1755
1871
|
Object.assign(
|
|
1756
1872
|
targets,
|
|
1757
|
-
scriptcPlatformTargets(packageJson, packageJsonPath, projectRoot, libTsconfigPath,
|
|
1873
|
+
scriptcPlatformTargets(packageJson, packageJsonPath, projectRoot, libTsconfigPath, [
|
|
1874
|
+
...toolchainInputs,
|
|
1875
|
+
...compileEnvInputs,
|
|
1876
|
+
]),
|
|
1758
1877
|
);
|
|
1759
1878
|
}
|
|
1760
1879
|
|
|
@@ -1886,32 +2005,37 @@ async function createProjectTargets(
|
|
|
1886
2005
|
memberDir: plan.package.dir,
|
|
1887
2006
|
cache: cargoWorkspace.inputsCache,
|
|
1888
2007
|
cargo: cargoWorkspace.closureSource.cargo,
|
|
2008
|
+
sources: cargoWorkspace.closureSource.sources,
|
|
1889
2009
|
}),
|
|
1890
2010
|
),
|
|
1891
2011
|
)
|
|
1892
2012
|
).flat(),
|
|
1893
2013
|
),
|
|
1894
2014
|
];
|
|
1895
|
-
// Generated crate sources (wire codecs, vocabularies, fixtures)
|
|
1896
|
-
// gitignored and invisible to nx's file
|
|
1897
|
-
// as the outputs of the targets a
|
|
1898
|
-
// those outputs here means a
|
|
1899
|
-
//
|
|
1900
|
-
//
|
|
1901
|
-
//
|
|
1902
|
-
//
|
|
2015
|
+
// Generated crate sources (wire codecs, vocabularies, fixtures) and
|
|
2016
|
+
// compiled-in files are often gitignored and invisible to nx's file
|
|
2017
|
+
// hasher; they reach these targets as the outputs of the targets a
|
|
2018
|
+
// repository adds to `dependsOn`. Hashing those outputs here means a
|
|
2019
|
+
// repository never has to restate `inputs` to add them - and a restated
|
|
2020
|
+
// `inputs` REPLACES this union with the root project's `default`, which
|
|
2021
|
+
// owns no crate file, so the test build then cache-hits against edited
|
|
2022
|
+
// crates while every per-crate test reruns on the stale binary. Only the
|
|
2023
|
+
// outputs under the union's own file sets are hashed
|
|
2024
|
+
// (`cargoProducerOutputInputs`): a compile reads nothing else, and a
|
|
2025
|
+
// producer's TypeScript output outside every crate keys no Rust build.
|
|
2026
|
+
const closureInputs = workspaceInputs.length > 0 ? workspaceInputs : CARGO_INPUTS;
|
|
1903
2027
|
const workspaceCargoInputs: TargetConfiguration['inputs'] = [
|
|
1904
|
-
...
|
|
1905
|
-
|
|
2028
|
+
...closureInputs,
|
|
2029
|
+
...cargoProducerOutputInputs(closureInputs, cargoWorkspaceRoot),
|
|
1906
2030
|
];
|
|
2031
|
+
// The build's `cargo nextest list` loads the repository's nextest config and
|
|
2032
|
+
// refuses an invalid one, so that file keys the build as well as every run.
|
|
1907
2033
|
targets[CARGO_TEST_BUILD_TARGET] = createCargoTestBuildTarget(
|
|
1908
2034
|
cargoWorkspaceRoot,
|
|
1909
2035
|
nextestToolConfigArg(cargoWorkspaceRoot),
|
|
1910
2036
|
nativeTools,
|
|
2037
|
+
[...workspaceCargoInputs, `{projectRoot}/${NEXTEST_REPO_CONFIG_PATH}`],
|
|
1911
2038
|
);
|
|
1912
|
-
// The build's `cargo nextest list` loads the repository's nextest config and
|
|
1913
|
-
// refuses an invalid one, so that file keys the build as well as every run.
|
|
1914
|
-
targets[CARGO_TEST_BUILD_TARGET].inputs = [...workspaceCargoInputs, `{projectRoot}/${NEXTEST_REPO_CONFIG_PATH}`];
|
|
1915
2039
|
// One archive per declared foreign triple, from the same inputs and the
|
|
1916
2040
|
// same repository nextest config, whose `archive.include` decides what an
|
|
1917
2041
|
// archive CONTAINS: it is the workspace's test binaries for another
|
|
@@ -2206,38 +2330,6 @@ async function createProjectTargets(
|
|
|
2206
2330
|
];
|
|
2207
2331
|
}
|
|
2208
2332
|
|
|
2209
|
-
const napiDebug = targets['napi-debug'];
|
|
2210
|
-
if (napiDebug && cargoWorkspace) {
|
|
2211
|
-
// A crate whose project also builds the debug cdylib runs its tests after
|
|
2212
|
-
// that build: the tests dlopen what `napi-debug` writes into `target/debug`,
|
|
2213
|
-
// and a test binary run in place loads it from this tree.
|
|
2214
|
-
const runners = [
|
|
2215
|
-
...cargoPackagePlans.flatMap((plan) => plan.pieces.map((piece) => piece.targetName)),
|
|
2216
|
-
// The root owns the serial groups' runners, so they take its build as its pieces do.
|
|
2217
|
-
...(ownsCargoWorkspaceTargets
|
|
2218
|
-
? cargoWorkspace.serialGroups.map((group) => cargoTestGroupTargetName(group.group))
|
|
2219
|
-
: []),
|
|
2220
|
-
];
|
|
2221
|
-
for (const name of runners) {
|
|
2222
|
-
const target = targets[name];
|
|
2223
|
-
if (target && !hasCargoTargetDependency(target.dependsOn ?? [], 'napi-debug')) {
|
|
2224
|
-
target.dependsOn = [...(target.dependsOn ?? []), 'napi-debug'];
|
|
2225
|
-
}
|
|
2226
|
-
}
|
|
2227
|
-
} else if (napiDebug) {
|
|
2228
|
-
const cargoTest = targets[CARGO_TEST_TARGET];
|
|
2229
|
-
if (
|
|
2230
|
-
cargoTest?.options &&
|
|
2231
|
-
typeof cargoTest.options.command === 'string' &&
|
|
2232
|
-
cargoTest.options.command.startsWith('cargo ')
|
|
2233
|
-
) {
|
|
2234
|
-
const dependsOn = cargoTest.dependsOn ?? [];
|
|
2235
|
-
if (!dependsOn.includes('napi-debug')) {
|
|
2236
|
-
cargoTest.dependsOn = [...dependsOn, 'napi-debug'];
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
|
|
2241
2333
|
// The inferring host's own platform binaries join the aggregate `build`;
|
|
2242
2334
|
// publish still owns foreign platforms.
|
|
2243
2335
|
const hostPlatformBinaries = hostPlatformTargetNames(
|
|
@@ -2403,6 +2495,15 @@ async function createProjectTargets(
|
|
|
2403
2495
|
inputs: lintProgramInputs,
|
|
2404
2496
|
eslintFileSet,
|
|
2405
2497
|
} = projectLintCommands(projectRoot, workspaceRoot, eslint);
|
|
2498
|
+
// The lint tools run from the root's node_modules/.bin, and ESLint loads the packages its configs name.
|
|
2499
|
+
const runsEslint = eslintFileSet !== null;
|
|
2500
|
+
const lintScopes = [
|
|
2501
|
+
...bunLoadInput(rootManifests, [
|
|
2502
|
+
...(runsEslint ? ['eslint'] : []),
|
|
2503
|
+
...(lintCommands.some((command) => command.startsWith('biome ')) ? ['@biomejs/biome'] : []),
|
|
2504
|
+
]).externalDependencies,
|
|
2505
|
+
...(runsEslint ? (eslint?.configScopes ?? []) : []),
|
|
2506
|
+
];
|
|
2406
2507
|
// Every lint tool reaches its own verdict in one run: run-commands would end the
|
|
2407
2508
|
// other tools once one fails, and their findings would surface a run later.
|
|
2408
2509
|
if (validationTargets.length > 0 || lintCommands.length > 0) {
|
|
@@ -2422,6 +2523,7 @@ async function createProjectTargets(
|
|
|
2422
2523
|
`{projectRoot}/${name}`,
|
|
2423
2524
|
]),
|
|
2424
2525
|
...(eslint?.configImports ?? []).map((path) => `{workspaceRoot}/${path}`),
|
|
2526
|
+
...(lintScopes.length > 0 ? [bunScopeInput(projectRoot, lintScopes)] : []),
|
|
2425
2527
|
],
|
|
2426
2528
|
...(lintCommands.length > 0
|
|
2427
2529
|
? {
|
|
@@ -2449,8 +2551,12 @@ async function createProjectTargets(
|
|
|
2449
2551
|
}
|
|
2450
2552
|
}
|
|
2451
2553
|
|
|
2452
|
-
//
|
|
2453
|
-
//
|
|
2554
|
+
// bounded-exec's admission observer loads cowshed's process-lineage entry, and through it the addon, only while a
|
|
2555
|
+
// Cargo leaf waits for mbx admission (specs/cowshed/11_shell.md, "Cargo test-runner boundaries"; mbx-queue.ts). Such
|
|
2556
|
+
// a target runs after the local producers so the observer finds them. Its reading only decides whether that wait is
|
|
2557
|
+
// credited against the idle bound, so the producers' bytes key no target (README, "Bounded exec key"): a command that
|
|
2558
|
+
// reads them keys them itself. A command named in either the declaration or the inference counts.
|
|
2559
|
+
// Declarations retain these prerequisites with Nx's ordinary "..." merge token.
|
|
2454
2560
|
// The canonical release-check instead judges prebuilt shipping artifacts and must remain dependency-free.
|
|
2455
2561
|
const observerProducers = [...nativeToolDependsOn(nativeTools, 'cowshed'), ...lineageProducer];
|
|
2456
2562
|
if (observerProducers.length > 0) {
|
|
@@ -2463,15 +2569,67 @@ async function createProjectTargets(
|
|
|
2463
2569
|
if (targets[name]?.executor !== undefined && targets[name]?.executor !== executor) {
|
|
2464
2570
|
targets[name] = {};
|
|
2465
2571
|
}
|
|
2572
|
+
const runs = [...targetOptionSets(declared), ...targetOptionSets(targets[name])];
|
|
2573
|
+
if (!runs.some((options) => runsAsCargoLeaf(boundedCommandLine(options) ?? ''))) continue;
|
|
2466
2574
|
targets[name] ??= {};
|
|
2467
2575
|
const target = targets[name];
|
|
2468
2576
|
target.dependsOn = [...(target.dependsOn ?? []), ...observerProducers];
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
// The package's addon loader reads napi-debug's dev-profile addon when NAPI_DEBUG_ADDON=1 (createNapiTestTarget), so
|
|
2581
|
+
// a target whose run sets it, in its declaration or its inference, runs after that build and keys the addon it writes.
|
|
2582
|
+
if (targets['napi-debug'] !== undefined) {
|
|
2583
|
+
for (const name of new Set([...Object.keys(targets), ...Object.keys(declaredTargets)])) {
|
|
2584
|
+
const declared = declaredTargets[name];
|
|
2585
|
+
const runs = [...targetOptionSets(declared), ...targetOptionSets(targets[name])];
|
|
2586
|
+
if (!runs.some((options) => isRecord(options.env) && options.env.NAPI_DEBUG_ADDON === '1')) continue;
|
|
2587
|
+
const executor =
|
|
2588
|
+
isRecord(declared) && declared.executor !== undefined ? declared.executor : targets[name]?.executor;
|
|
2589
|
+
// Nx discards an incompatible executor's inferred configuration; only the addon prerequisite belongs below it.
|
|
2590
|
+
if (targets[name]?.executor !== undefined && targets[name]?.executor !== executor) {
|
|
2591
|
+
targets[name] = {};
|
|
2592
|
+
}
|
|
2593
|
+
targets[name] ??= {};
|
|
2594
|
+
const target = targets[name];
|
|
2595
|
+
const named = [
|
|
2596
|
+
...(target.dependsOn ?? []),
|
|
2597
|
+
...(isRecord(declared) && Array.isArray(declared.dependsOn) ? declared.dependsOn : []),
|
|
2598
|
+
];
|
|
2599
|
+
if (!named.includes('napi-debug')) {
|
|
2600
|
+
target.dependsOn = [...(target.dependsOn ?? []), 'napi-debug'];
|
|
2601
|
+
}
|
|
2469
2602
|
const inputs =
|
|
2470
2603
|
target.inputs ?? (isRecord(declared) && Array.isArray(declared.inputs) ? [] : ['default', '^production']);
|
|
2471
|
-
target.inputs = [
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2604
|
+
target.inputs = [...inputs, { dependentTasksOutputFiles: '**/*.node', transitive: false }];
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
// A plugin executor is a file the workspace plugin's own build writes, so a target that starts before that build
|
|
2609
|
+
// ends loads the dist a previous build left: one without the executors the plugin gained since (a Linux CLI
|
|
2610
|
+
// target failed "Could not resolve ./dist/executors/cargo-zigbuild/executor.js" in a checkout restored from a
|
|
2611
|
+
// cache that predated it). Every such target of every project but the plugin takes the one edge, so no executor
|
|
2612
|
+
// needs its own: the executors that build the plugin (the bootstrap ones) take none, the plugin's own targets
|
|
2613
|
+
// are ordered by its own graph, and release-check stays dependency-free (specs/cowshed/06_cli.md,
|
|
2614
|
+
// `release-check`). Declarations that replace `dependsOn` keep it with Nx's "..." token.
|
|
2615
|
+
if (packageJson.name !== '@smoothbricks/nx-plugin') {
|
|
2616
|
+
for (const name of new Set([...Object.keys(targets), ...Object.keys(declaredTargets)])) {
|
|
2617
|
+
if (name === 'release-check') continue;
|
|
2618
|
+
const declared = declaredTargets[name];
|
|
2619
|
+
const executor =
|
|
2620
|
+
isRecord(declared) && declared.executor !== undefined ? declared.executor : targets[name]?.executor;
|
|
2621
|
+
const edge = pluginBuildDependsOn(nativeTools, executor);
|
|
2622
|
+
if (edge.length === 0) continue;
|
|
2623
|
+
// Nx discards an incompatible executor's inferred configuration; only the edge belongs below it.
|
|
2624
|
+
if (targets[name]?.executor !== undefined && targets[name]?.executor !== executor) {
|
|
2625
|
+
targets[name] = {};
|
|
2626
|
+
}
|
|
2627
|
+
targets[name] ??= {};
|
|
2628
|
+
const target = targets[name];
|
|
2629
|
+
const present = new Set((target.dependsOn ?? []).map((dependency) => JSON.stringify(dependency)));
|
|
2630
|
+
target.dependsOn = [
|
|
2631
|
+
...(target.dependsOn ?? []),
|
|
2632
|
+
...edge.filter((dependency) => !present.has(JSON.stringify(dependency))),
|
|
2475
2633
|
];
|
|
2476
2634
|
}
|
|
2477
2635
|
}
|
|
@@ -2495,6 +2653,7 @@ async function createProjectTargets(
|
|
|
2495
2653
|
// its configuration hash, so defining it everywhere would invalidate every
|
|
2496
2654
|
// task in the repository to serve projects that can never reference it.
|
|
2497
2655
|
const namedInputs: Record<string, NonNullable<TargetConfiguration['inputs']>> = {
|
|
2656
|
+
[BUN_LOCK_SCOPE_NAMED_INPUT]: [bunLockInput(projectRoot)],
|
|
2498
2657
|
...(versionless === null
|
|
2499
2658
|
? {}
|
|
2500
2659
|
: {
|
|
@@ -2581,7 +2740,8 @@ async function lockScopeNodes(
|
|
|
2581
2740
|
}
|
|
2582
2741
|
}
|
|
2583
2742
|
const own = bunLockNode(projectRoot);
|
|
2584
|
-
const
|
|
2743
|
+
const runtime = bunLockRuntimeNode(projectRoot);
|
|
2744
|
+
const nodes: Record<string, ProjectGraphExternalNode> = { [own.name]: own, [runtime.name]: runtime };
|
|
2585
2745
|
for (const node of await Promise.all(
|
|
2586
2746
|
[...directories].map((directory) => cargoLockNode(directory, cargoSourcesUnder(directory, cargoWorkspaces))),
|
|
2587
2747
|
)) {
|
|
@@ -2950,6 +3110,28 @@ function createNapiTargets(
|
|
|
2950
3110
|
return targets;
|
|
2951
3111
|
}
|
|
2952
3112
|
|
|
3113
|
+
/** A target's own options and each of its configurations' options, as one declaration or inference states them. */
|
|
3114
|
+
function targetOptionSets(target: unknown): Record<string, unknown>[] {
|
|
3115
|
+
if (!isRecord(target)) return [];
|
|
3116
|
+
const configurations = isRecord(target.configurations) ? Object.values(target.configurations) : [];
|
|
3117
|
+
return [target.options, ...configurations].filter(isRecord);
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
/** The command line a bounded-exec run with `options` starts (`boundedCommand`), or null when they name no command. */
|
|
3121
|
+
function boundedCommandLine(options: Record<string, unknown>): string | null {
|
|
3122
|
+
const { command, args } = options;
|
|
3123
|
+
if (typeof command !== 'string') return null;
|
|
3124
|
+
return boundedCommand({
|
|
3125
|
+
command,
|
|
3126
|
+
args:
|
|
3127
|
+
typeof args === 'string'
|
|
3128
|
+
? args
|
|
3129
|
+
: Array.isArray(args)
|
|
3130
|
+
? args.filter((arg): arg is string => typeof arg === 'string')
|
|
3131
|
+
: undefined,
|
|
3132
|
+
});
|
|
3133
|
+
}
|
|
3134
|
+
|
|
2953
3135
|
function createNapiTestTarget(projectRoot: string, hasDedicatedBunfig: boolean): TargetConfiguration {
|
|
2954
3136
|
const configFlag = hasDedicatedBunfig ? ' --config=../bunfig.napi-test.toml' : ' --config=../bunfig.toml';
|
|
2955
3137
|
return {
|
|
@@ -3208,14 +3390,14 @@ async function resolveCargoWorkspaces(
|
|
|
3208
3390
|
if (found.length === 0) return [];
|
|
3209
3391
|
// Started only once every workspace listed cleanly, so a listing that throws
|
|
3210
3392
|
// leaves no Cargo process behind.
|
|
3211
|
-
const
|
|
3393
|
+
const indexedSources = indexedCargoSources(workspaceRoot);
|
|
3212
3394
|
return Promise.all(
|
|
3213
3395
|
found.map(async (workspace) => ({
|
|
3214
3396
|
...workspace,
|
|
3215
3397
|
closureSource: await resolveCargoClosureSource(
|
|
3216
3398
|
posix.join(workspace.projectRoot, 'Cargo.toml'),
|
|
3217
3399
|
workspaceRoot,
|
|
3218
|
-
|
|
3400
|
+
indexedSources,
|
|
3219
3401
|
workspace.inputsCache.compiledInFiles,
|
|
3220
3402
|
),
|
|
3221
3403
|
})),
|
|
@@ -3365,6 +3547,7 @@ async function cargoTestRunnerInputs(
|
|
|
3365
3547
|
memberDir,
|
|
3366
3548
|
cache: workspace.inputsCache,
|
|
3367
3549
|
cargo: workspace.closureSource.cargo,
|
|
3550
|
+
sources: workspace.closureSource.sources,
|
|
3368
3551
|
}),
|
|
3369
3552
|
),
|
|
3370
3553
|
);
|
|
@@ -3415,7 +3598,7 @@ const NEXTEST_BINARIES_FIXTURE_TIMEOUT_MS = 3_600_000;
|
|
|
3415
3598
|
* from the run's, and names the crates loudly when mbx had to compile (smoo-nx-nextest-binaries).
|
|
3416
3599
|
*/
|
|
3417
3600
|
function nextestRunnerFixture(workspace: CargoWorkspace, nativeTools: NativeTools | null): string {
|
|
3418
|
-
const helper = nativeToolCommand(nativeTools, workspace.projectRoot, 'nextest-extract',
|
|
3601
|
+
const helper = nativeToolCommand(nativeTools, workspace.projectRoot, 'nextest-extract', NEXTEST_HELPER_BIN);
|
|
3419
3602
|
return `${helper} ensure ${NEXTEST_BINARIES_METADATA} ${NEXTEST_BUILD_KEY} -- ${nextestBinariesBuild(nextestToolConfigArg(workspace.projectRoot))}`;
|
|
3420
3603
|
}
|
|
3421
3604
|
|
|
@@ -3433,7 +3616,7 @@ function nextestRunnerCommand(
|
|
|
3433
3616
|
): string {
|
|
3434
3617
|
const toolConfig = nextestToolConfigArg(workspace.projectRoot);
|
|
3435
3618
|
// Relative to the runner's cwd, so the hashed command is the same in every checkout.
|
|
3436
|
-
const helper = nativeToolCommand(nativeTools, workspace.projectRoot, 'nextest-extract',
|
|
3619
|
+
const helper = nativeToolCommand(nativeTools, workspace.projectRoot, 'nextest-extract', NEXTEST_HELPER_BIN);
|
|
3437
3620
|
const reuseBuild =
|
|
3438
3621
|
`--binaries-metadata ${NEXTEST_BINARIES_METADATA} --cargo-metadata ${NEXTEST_CARGO_METADATA} ` +
|
|
3439
3622
|
`--target-dir-remap "$(${helper} target-dir)"`;
|
|
@@ -3453,7 +3636,8 @@ function cargoTestRunnerTarget(
|
|
|
3453
3636
|
return {
|
|
3454
3637
|
executor: '@smoothbricks/nx-plugin:bounded-exec',
|
|
3455
3638
|
cache: true,
|
|
3456
|
-
|
|
3639
|
+
// The command (`target-dir`) and the fixture (`ensure`) run the nextest helper.
|
|
3640
|
+
inputs: [...inputs, ...nextestHelperInputs(nativeTools)],
|
|
3457
3641
|
dependsOn: [build, ...nativeToolDependsOn(nativeTools, 'nextest-extract')],
|
|
3458
3642
|
options: {
|
|
3459
3643
|
command: nextestRunnerCommand(
|
|
@@ -3491,7 +3675,7 @@ function cargoTestGroupTarget(
|
|
|
3491
3675
|
return {
|
|
3492
3676
|
executor: '@smoothbricks/nx-plugin:bounded-exec',
|
|
3493
3677
|
cache: true,
|
|
3494
|
-
inputs: [...inputs, fileHashInput(PLUGIN_NEXTEST_CODE_BOUND)],
|
|
3678
|
+
inputs: [...inputs, fileHashInput(PLUGIN_NEXTEST_CODE_BOUND), ...nextestHelperInputs(nativeTools)],
|
|
3495
3679
|
dependsOn: [CARGO_TEST_BUILD_TARGET, ...nativeToolDependsOn(nativeTools, 'nextest-extract')],
|
|
3496
3680
|
options: {
|
|
3497
3681
|
command: nextestRunnerCommand('run', workspace, nativeTools, group.filter, ' --no-fail-fast --no-tests=fail'),
|
|
@@ -3504,21 +3688,3 @@ function cargoTestGroupTarget(
|
|
|
3504
3688
|
},
|
|
3505
3689
|
};
|
|
3506
3690
|
}
|
|
3507
|
-
|
|
3508
|
-
function hasCargoTargetDependency(
|
|
3509
|
-
dependencies: readonly CargoTargetDependency[],
|
|
3510
|
-
expected: CargoTargetDependency,
|
|
3511
|
-
): boolean {
|
|
3512
|
-
if (typeof expected === 'string') {
|
|
3513
|
-
return dependencies.includes(expected);
|
|
3514
|
-
}
|
|
3515
|
-
return dependencies.some(
|
|
3516
|
-
(dependency) =>
|
|
3517
|
-
typeof dependency !== 'string' &&
|
|
3518
|
-
dependency.target === expected.target &&
|
|
3519
|
-
Array.isArray(dependency.projects) &&
|
|
3520
|
-
Array.isArray(expected.projects) &&
|
|
3521
|
-
dependency.projects.length === expected.projects.length &&
|
|
3522
|
-
dependency.projects.every((project, index) => project === expected.projects?.[index]),
|
|
3523
|
-
);
|
|
3524
|
-
}
|