@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/dist/index.js
CHANGED
|
@@ -10,17 +10,21 @@ import { parse as parseToml } from 'smol-toml';
|
|
|
10
10
|
import { BOUNDED_TEST_IDLE_TIMEOUT_MS, BOUNDED_TEST_KILL_AFTER_MS } from './bounded-test-policy.js';
|
|
11
11
|
import { refuseOverlappingOutputs } from './build-state-output-policy.js';
|
|
12
12
|
import { builtOutputLockfileDependencies, builtOutputLockfileNodes } from './built-output-packages.js';
|
|
13
|
-
import { bunLockDependencies, bunLockInput, bunLockNode } from './bun-lock-scope.js';
|
|
14
|
-
import { CARGO_CLOSURE_INPUT, CARGO_LOCK_NODE_PREFIX, cargoClosureInputs, cargoLockNode, cargoLockNodeName,
|
|
13
|
+
import { BUN_LOCK_SCOPE_NAMED_INPUT, bunLoadInput, bunLoadScopes, bunLockDependencies, bunLockInput, bunLockNode, bunLockRuntimeNode, bunScopeInput, bunVersionAliasDependencies, manifestsAbove, refuseUndeclaredImports, specifierPackage, typescriptLoads, } from './bun-lock-scope.js';
|
|
14
|
+
import { CARGO_CLOSURE_INPUT, CARGO_LOCK_NODE_PREFIX, cargoClosureInputs, cargoLockNode, cargoLockNodeName, indexedCargoSources, isCargoLockInput, resolveCargoClosureSource, } from './cargo-closure-input.js';
|
|
15
15
|
import { CARGO_PRODUCER_METADATA, postTasksExecution as postCargoRetention } from './cargo-retention-hook.js';
|
|
16
16
|
import { CARGO_TOOLCHAIN_NAMED_INPUT, cargoRuntimeInput, cargoToolchainInputs } from './cargo-toolchain-policy.js';
|
|
17
|
-
import { attributeCargoWorkspacePackages, CARGO_TEST_BUILD_TARGET, CARGO_TEST_EXCEPTIONS_SUFFIX, CARGO_TEST_TARGET, cargoPackageTestInputs, cargoTestGroupTargetName, cargoTestPackageTargetName, createCargoInputsCache, EXTERNAL_RUST_CRATES_INPUT, exceptionalTestFilter, listCargoCrossTestTargets, listCargoWorkspacePackages, NEXTEST_REPO_CONFIG_PATH, nextestToolConfigArg, PLUGIN_NEXTEST_CONFIG_PATH, requireExternalRustCratesInput, serialTestGroups, } from './cargo-workspace.js';
|
|
17
|
+
import { attributeCargoWorkspacePackages, CARGO_TEST_BUILD_TARGET, CARGO_TEST_EXCEPTIONS_SUFFIX, CARGO_TEST_TARGET, cargoPackageTestInputs, cargoProducerOutputInputs, cargoTestGroupTargetName, cargoTestPackageTargetName, createCargoInputsCache, EXTERNAL_RUST_CRATES_INPUT, exceptionalTestFilter, listCargoCrossTestTargets, listCargoWorkspacePackages, NEXTEST_REPO_CONFIG_PATH, nextestToolConfigArg, PLUGIN_NEXTEST_CONFIG_PATH, requireExternalRustCratesInput, serialTestGroups, } from './cargo-workspace.js';
|
|
18
|
+
import { compileEnvironment } from './compile-environment.js';
|
|
18
19
|
import { CARGO_CROSS_LINT_COMMAND, CARGO_CROSS_LINT_TARGET, CARGO_FETCH_COMMAND, CARGO_FETCH_TARGET, CARGO_LINT_CLIPPY_COMMAND, cargoCrossTestArchiveFile, cargoCrossTestArchiveTargetName, cargoCrossTestTargetName, cargoFrozen, runsFrozenCargo, } from './cross-check-policy.js';
|
|
20
|
+
import { directDependencyManifests } from './dependency-manifests.js';
|
|
19
21
|
import { eslintConfigClosure } from './eslint-config-closure.js';
|
|
20
22
|
import { ESLINT_SOURCES_GLOB, eslintSources } from './eslint-sources.js';
|
|
21
23
|
import { ALL_VERDICTS_EXECUTOR, ESLINT_SOURCES_TOKEN, } from './executors/all-verdicts/schema.js';
|
|
24
|
+
import { runsAsCargoLeaf } from './executors/bounded-exec/mbx-pool.js';
|
|
22
25
|
import { closeRunReservations, serveRunReservations } from './executors/bounded-exec/mbx-reservations.js';
|
|
23
26
|
import { closeRunCpuPool, serveRunCpuPool } from './executors/bounded-exec/run-cpu-pool.js';
|
|
27
|
+
import { boundedCommand } from './executors/bounded-exec/schema.js';
|
|
24
28
|
import { ffiPathProblem } from './executors/scriptc-native/ffi-paths.js';
|
|
25
29
|
import { hashVersionlessCrateManifests } from './manifest-hash.js';
|
|
26
30
|
import { NEXTEST_TIMINGS_PATH, namedTestsFilter, readNextestTimings, timedShardMembers } from './nextest-timings.js';
|
|
@@ -30,7 +34,7 @@ import { inferredTaskKind, refuseBuildTestDependencies } from './task-graph-poli
|
|
|
30
34
|
import { postTasksExecution as postTaskResults, preTasksExecution as preTaskResults } from './task-results.js';
|
|
31
35
|
import { SHARD_TIMINGS_EXECUTOR, SHARD_TIMINGS_TARGET, timingsShardedSuite, timingsSuiteInputs, } from './test-timings.js';
|
|
32
36
|
import { assertUpstreamBasePrecondition } from './test-walk-policy.js';
|
|
33
|
-
import { nativeToolCommand, nativeToolDependsOn, resolveNativeTools } from './tool-bins.js';
|
|
37
|
+
import { nativeToolCommand, nativeToolDependsOn, pluginBuildDependsOn, resolveNativeTools, } from './tool-bins.js';
|
|
34
38
|
import { typecheckRoute } from './typecheck-route.js';
|
|
35
39
|
import { isBuildOutputTargetName, isTestNamespaceTargetName, isTestRunnerTargetName, RELEASE_CONFIGURATION, } from './workspace-config-policy.js';
|
|
36
40
|
import { globIndexedFiles } from './workspace-index.js';
|
|
@@ -70,11 +74,8 @@ function typecheckCommand(args) {
|
|
|
70
74
|
* which bun.lock and the patches in its check inputs already key, and it waits for the targets the declaring package
|
|
71
75
|
* names to prepare the plugin binaries ttsc loads. Every other project runs the pinned native compiler.
|
|
72
76
|
*/
|
|
73
|
-
function typecheckTargets(
|
|
74
|
-
const route = typecheckRoute(
|
|
75
|
-
...Object.keys(packageJson.dependencies ?? {}),
|
|
76
|
-
...Object.keys(packageJson.devDependencies ?? {}),
|
|
77
|
-
]);
|
|
77
|
+
function typecheckTargets(manifests) {
|
|
78
|
+
const route = typecheckRoute(manifests);
|
|
78
79
|
return route.declaredBy.length === 0
|
|
79
80
|
? { command: typecheckCommand, inputs: [TYPECHECK_COMPILER_INPUT], dependsOn: [] }
|
|
80
81
|
: { command: (args) => `ttsc ${args}`, inputs: [], dependsOn: route.dependsOn };
|
|
@@ -140,33 +141,55 @@ const NODE_MODULES_SEGMENT = /(?:^|\/)node_modules(?:\/|$)/;
|
|
|
140
141
|
* the two kinds Nx has no fileset for; see {@link configChainInput}.
|
|
141
142
|
*/
|
|
142
143
|
function typescriptConfigChainInputs(configPaths, workspaceRoot) {
|
|
143
|
-
const
|
|
144
|
+
const chain = {
|
|
145
|
+
inputs: new Set([WORKSPACE_TSCONFIG_BASE_INPUT]),
|
|
146
|
+
extendsLoads: [],
|
|
147
|
+
transformLoads: [],
|
|
148
|
+
};
|
|
144
149
|
const walked = new Set();
|
|
145
150
|
for (const configPath of configPaths) {
|
|
146
|
-
addTypescriptConfigAncestors(configPath, workspaceRoot,
|
|
151
|
+
addTypescriptConfigAncestors(configPath, workspaceRoot, chain, walked);
|
|
152
|
+
}
|
|
153
|
+
return { inputs: [...chain.inputs], extendsLoads: chain.extendsLoads, transformLoads: chain.transformLoads };
|
|
154
|
+
}
|
|
155
|
+
/** The bare transform plugin specifiers one config names (`compilerOptions.plugins[].transform`). */
|
|
156
|
+
function typescriptTransforms(configPath) {
|
|
157
|
+
const config = readJsonFile(configPath, { expectComments: true });
|
|
158
|
+
if (!isRecord(config) || !isRecord(config.compilerOptions) || !Array.isArray(config.compilerOptions.plugins)) {
|
|
159
|
+
return [];
|
|
147
160
|
}
|
|
148
|
-
return [
|
|
161
|
+
return config.compilerOptions.plugins.flatMap((plugin) => isRecord(plugin) && typeof plugin.transform === 'string' && /^[@\w]/u.test(plugin.transform)
|
|
162
|
+
? [plugin.transform]
|
|
163
|
+
: []);
|
|
149
164
|
}
|
|
150
165
|
/**
|
|
151
166
|
* One config's ancestors; `walked` both dedupes shared bases and breaks an
|
|
152
167
|
* `extends` cycle.
|
|
153
168
|
*
|
|
154
169
|
* The walk stops at an ancestor Nx cannot hash, because everything reachable
|
|
155
|
-
* from an installed config is installed too: the
|
|
156
|
-
*
|
|
157
|
-
*
|
|
170
|
+
* from an installed config is installed too: the package holding it is
|
|
171
|
+
* recorded as a load of the extending config's directory, and the lock scope
|
|
172
|
+
* that declares it there keys that whole subtree. Parsing it could only
|
|
173
|
+
* invent failures for a dependency's own chain.
|
|
158
174
|
*/
|
|
159
|
-
function addTypescriptConfigAncestors(configPath, workspaceRoot,
|
|
175
|
+
function addTypescriptConfigAncestors(configPath, workspaceRoot, chain, walked) {
|
|
160
176
|
if (walked.has(configPath))
|
|
161
177
|
return;
|
|
162
178
|
walked.add(configPath);
|
|
179
|
+
const directory = relative(workspaceRoot, dirname(configPath)).replaceAll('\\', '/') || '.';
|
|
180
|
+
for (const transform of typescriptTransforms(configPath)) {
|
|
181
|
+
chain.transformLoads.push({ directory, name: specifierPackage(transform) });
|
|
182
|
+
}
|
|
163
183
|
for (const specifier of typescriptConfigExtends(configPath)) {
|
|
164
184
|
const ancestor = resolveTypescriptConfigExtends(specifier, configPath);
|
|
165
185
|
const input = configChainInput(ancestor, configPath, workspaceRoot);
|
|
166
|
-
if (input === null)
|
|
186
|
+
if (input === null) {
|
|
187
|
+
if (ancestor.installed)
|
|
188
|
+
chain.extendsLoads.push({ directory, name: specifierPackage(specifier) });
|
|
167
189
|
continue;
|
|
168
|
-
|
|
169
|
-
|
|
190
|
+
}
|
|
191
|
+
chain.inputs.add(input);
|
|
192
|
+
addTypescriptConfigAncestors(ancestor.path, workspaceRoot, chain, walked);
|
|
170
193
|
}
|
|
171
194
|
}
|
|
172
195
|
/** What one config extends: a single specifier, or the ordered list TypeScript 5.0 added. */
|
|
@@ -320,16 +343,19 @@ const ESLINT_CONFIG_FILES = [
|
|
|
320
343
|
* The configs key every lint target with exactly the workspace files they
|
|
321
344
|
* load (eslint-config-closure.ts): a glob over the directory holding a
|
|
322
345
|
* config's rule modules keyed every file beside them, and one test fixture
|
|
323
|
-
* there re-keyed 44 lint targets in one land.
|
|
346
|
+
* there re-keyed 44 lint targets in one land. The packages they load by name
|
|
347
|
+
* key it by the lock scope declaring each where it loads (bun-lock-scope.ts).
|
|
324
348
|
*/
|
|
325
349
|
async function eslintWorkspace(workspaceRoot) {
|
|
326
350
|
const configs = ESLINT_CONFIG_FILES.filter((name) => existsSync(join(workspaceRoot, name)));
|
|
327
351
|
if (configs.length === 0)
|
|
328
352
|
return null;
|
|
329
353
|
const indexed = new Set(await globIndexedFiles(workspaceRoot, [ESLINT_SOURCES_GLOB, '**/*.json']));
|
|
354
|
+
const closure = eslintConfigClosure(workspaceRoot, configs, indexed);
|
|
330
355
|
return {
|
|
331
356
|
sources: new Set([...indexed].filter((path) => !path.endsWith('.json'))),
|
|
332
|
-
configImports:
|
|
357
|
+
configImports: closure.files,
|
|
358
|
+
configScopes: bunLoadScopes(workspaceRoot, closure.packageLoads),
|
|
333
359
|
};
|
|
334
360
|
}
|
|
335
361
|
function projectLintCommands(projectRoot, workspaceRoot, eslint) {
|
|
@@ -662,14 +688,16 @@ function createCargoWasmTarget(projectRoot, config, repoRooted, cargoTargetDirec
|
|
|
662
688
|
* create its parent, so the build consumes what the `mkdir` produced. Outside
|
|
663
689
|
* Nx there is no task hash, and a build no task names is refused here rather
|
|
664
690
|
* than by every runner.
|
|
691
|
+
*
|
|
692
|
+
* `inputs` is the workspace's Cargo union; the build also runs the nextest helper (`record`).
|
|
665
693
|
*/
|
|
666
|
-
function createCargoTestBuildTarget(projectRoot, toolConfig, nativeTools) {
|
|
667
|
-
const helper = nativeToolCommand(nativeTools, projectRoot, 'nextest-extract',
|
|
694
|
+
function createCargoTestBuildTarget(projectRoot, toolConfig, nativeTools, inputs) {
|
|
695
|
+
const helper = nativeToolCommand(nativeTools, projectRoot, 'nextest-extract', NEXTEST_HELPER_BIN);
|
|
668
696
|
return {
|
|
669
697
|
executor: 'nx:run-commands',
|
|
670
698
|
metadata: CARGO_PRODUCER_METADATA,
|
|
671
699
|
cache: true,
|
|
672
|
-
inputs:
|
|
700
|
+
inputs: [...inputs, ...nextestHelperInputs(nativeTools)],
|
|
673
701
|
outputs: [
|
|
674
702
|
`{projectRoot}/${NEXTEST_BINARIES_METADATA}`,
|
|
675
703
|
`{projectRoot}/${NEXTEST_CARGO_METADATA}`,
|
|
@@ -697,6 +725,17 @@ function createCargoTestBuildTarget(projectRoot, toolConfig, nativeTools) {
|
|
|
697
725
|
function nextestBinariesBuild(toolConfig) {
|
|
698
726
|
return cargoFrozen(`${NEXTEST_BINARIES_BUILD_ARGS.join(' ')} ${toolConfig}`);
|
|
699
727
|
}
|
|
728
|
+
/** The nextest helper the test build and every runner run (`record`, `ensure`, `target-dir`). */
|
|
729
|
+
const NEXTEST_HELPER_BIN = 'smoo-nx-nextest-binaries';
|
|
730
|
+
/**
|
|
731
|
+
* The helper's bytes, for a target that runs it, where this workspace builds it: the producer edge orders the build and
|
|
732
|
+
* this input keys what the target runs. An installed helper is its package's, keyed as the package.
|
|
733
|
+
*/
|
|
734
|
+
function nextestHelperInputs(nativeTools) {
|
|
735
|
+
return nativeTools !== null && nativeToolDependsOn(nativeTools, 'nextest-extract').length > 0
|
|
736
|
+
? [{ dependentTasksOutputFiles: `**/dist/bin/${nativeTools.platform}/${NEXTEST_HELPER_BIN}`, transitive: false }]
|
|
737
|
+
: [];
|
|
738
|
+
}
|
|
700
739
|
/**
|
|
701
740
|
* One foreign triple's test archive, and the target that EXECUTES it.
|
|
702
741
|
*
|
|
@@ -1034,11 +1073,13 @@ export const postTasksExecution = async (options, context) => {
|
|
|
1034
1073
|
export const createDependencies = (options, context) => [
|
|
1035
1074
|
...bunLockDependencies(context),
|
|
1036
1075
|
...builtOutputLockfileDependencies(options, context),
|
|
1076
|
+
...bunVersionAliasDependencies(context.externalNodes ?? {}),
|
|
1037
1077
|
];
|
|
1038
1078
|
/** Nx invokes this only after merging inferred/declarative targets and every plugin's project dependencies. */
|
|
1039
1079
|
export const createMetadata = (graph, _options, context) => {
|
|
1040
1080
|
refuseOverlappingOutputs(graph, context.workspaceRoot);
|
|
1041
1081
|
refuseBuildTestDependencies(graph, context.workspaceRoot);
|
|
1082
|
+
refuseUndeclaredImports(graph);
|
|
1042
1083
|
return {};
|
|
1043
1084
|
};
|
|
1044
1085
|
export default { createNodesV2, createDependencies, createMetadata, postTasksExecution, preTasksExecution };
|
|
@@ -1291,7 +1332,14 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1291
1332
|
const projectRoot = dirname(packageJsonPath);
|
|
1292
1333
|
const absoluteProjectRoot = join(workspaceRoot, projectRoot);
|
|
1293
1334
|
const packageJson = await readPackageJson(join(workspaceRoot, packageJsonPath));
|
|
1294
|
-
const
|
|
1335
|
+
const dependencyManifests = directDependencyManifests(join(workspaceRoot, packageJsonPath), [
|
|
1336
|
+
...Object.keys(packageJson.dependencies ?? {}),
|
|
1337
|
+
...Object.keys(packageJson.devDependencies ?? {}),
|
|
1338
|
+
]);
|
|
1339
|
+
const typecheck = typecheckTargets(dependencyManifests);
|
|
1340
|
+
// The environment a direct dependency's ttsc plugin lowers by (compile-environment.ts): the emitted JavaScript is a
|
|
1341
|
+
// function of it, so every target whose output is the transformed compile hashes it. A check never is.
|
|
1342
|
+
const compileEnvInputs = compileEnvironment(dependencyManifests).map((name) => ({ env: name }));
|
|
1295
1343
|
const projectName = packageJson.nx?.name ?? packageJson.name;
|
|
1296
1344
|
if (typeof projectName !== 'string' || projectName.length === 0) {
|
|
1297
1345
|
throw new Error(`${packageJsonPath} must declare a non-empty package or nx project name`);
|
|
@@ -1331,19 +1379,33 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1331
1379
|
// whole `extends` chain of the configs its commands name and not just those
|
|
1332
1380
|
// two files. Resolved once per project: every target below shares it.
|
|
1333
1381
|
const typescriptConfigChain = typescriptConfigChainInputs([...(hasLibTsconfig ? [libTsconfigPath] : []), ...(hasTestTsconfig ? [testTsconfigPath] : [])], workspaceRoot);
|
|
1382
|
+
// The packages a TypeScript task loads by name beyond its sources' imports, each keyed by the lock scope that
|
|
1383
|
+
// declares it where it loads (bun-lock-scope.ts): the project's own node keys its own declarations, and a root
|
|
1384
|
+
// declaration is named by itself, so no task is keyed on root tooling it never loads. A check reads the @types and
|
|
1385
|
+
// tslib TypeScript finds by ancestry and the installed configs its chain extends. The emit also runs ttsc from the
|
|
1386
|
+
// root's node_modules/.bin, and ttsc loads the TypeScript API from the project and each transform plugin its
|
|
1387
|
+
// configs name.
|
|
1388
|
+
const manifests = manifestsAbove(workspaceRoot, projectRoot);
|
|
1389
|
+
const rootManifests = manifests.filter((manifest) => manifest.root === '.');
|
|
1390
|
+
const checkScopes = [
|
|
1391
|
+
...bunLoadInput(manifests, typescriptLoads(manifests)).externalDependencies,
|
|
1392
|
+
...bunLoadScopes(workspaceRoot, typescriptConfigChain.extendsLoads),
|
|
1393
|
+
];
|
|
1394
|
+
const checkScopeInput = bunScopeInput(projectRoot, checkScopes);
|
|
1395
|
+
const emitScopeInput = bunScopeInput(projectRoot, checkScopes, bunLoadInput(manifests, ['typescript']).externalDependencies, bunLoadInput(rootManifests, ['ttsc', '@typescript/native']).externalDependencies, bunLoadScopes(workspaceRoot, typescriptConfigChain.transformLoads));
|
|
1334
1396
|
const toolchainInputs = [
|
|
1335
1397
|
...RELEASE_REWRITTEN_WORKSPACE_INPUTS,
|
|
1336
|
-
|
|
1398
|
+
emitScopeInput,
|
|
1337
1399
|
...TYPESCRIPT_PATCH_INPUTS,
|
|
1338
|
-
...typescriptConfigChain,
|
|
1400
|
+
...typescriptConfigChain.inputs,
|
|
1339
1401
|
];
|
|
1340
1402
|
const checkInputs = versionless === null
|
|
1341
1403
|
? toolchainInputs
|
|
1342
1404
|
: [
|
|
1343
1405
|
...TYPESCRIPT_PATCH_INPUTS,
|
|
1344
|
-
...typescriptConfigChain,
|
|
1406
|
+
...typescriptConfigChain.inputs,
|
|
1345
1407
|
...VERSIONLESS_TOOLCHAIN_MANIFEST_INPUTS,
|
|
1346
|
-
|
|
1408
|
+
checkScopeInput,
|
|
1347
1409
|
];
|
|
1348
1410
|
const selfProduction = versionless === null ? 'production' : VERSIONLESS_PRODUCTION_INPUT;
|
|
1349
1411
|
const selfDefault = versionless === null ? 'default' : VERSIONLESS_DEFAULT_INPUT;
|
|
@@ -1367,7 +1429,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1367
1429
|
targets['tsc-js'] = {
|
|
1368
1430
|
executor: '@smoothbricks/nx-plugin:typescript-emit',
|
|
1369
1431
|
cache: true,
|
|
1370
|
-
inputs: ['production', '^production', ...toolchainInputs, '{projectRoot}/tsconfig.lib.json'],
|
|
1432
|
+
inputs: ['production', '^production', ...toolchainInputs, ...compileEnvInputs, '{projectRoot}/tsconfig.lib.json'],
|
|
1371
1433
|
outputs: inferTypescriptOutputs(libOutDir),
|
|
1372
1434
|
dependsOn: ['^*-js', ...(cargoWasmConfig ? ['cargo-wasm'] : [])],
|
|
1373
1435
|
options: {
|
|
@@ -1393,7 +1455,10 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1393
1455
|
cwd: projectRoot,
|
|
1394
1456
|
},
|
|
1395
1457
|
};
|
|
1396
|
-
Object.assign(targets, scriptcPlatformTargets(packageJson, packageJsonPath, projectRoot, libTsconfigPath,
|
|
1458
|
+
Object.assign(targets, scriptcPlatformTargets(packageJson, packageJsonPath, projectRoot, libTsconfigPath, [
|
|
1459
|
+
...toolchainInputs,
|
|
1460
|
+
...compileEnvInputs,
|
|
1461
|
+
]));
|
|
1397
1462
|
}
|
|
1398
1463
|
if (hasTestTsconfig) {
|
|
1399
1464
|
targets['typecheck-tests'] = {
|
|
@@ -1504,24 +1569,28 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1504
1569
|
memberDir: plan.package.dir,
|
|
1505
1570
|
cache: cargoWorkspace.inputsCache,
|
|
1506
1571
|
cargo: cargoWorkspace.closureSource.cargo,
|
|
1572
|
+
sources: cargoWorkspace.closureSource.sources,
|
|
1507
1573
|
})))).flat()),
|
|
1508
1574
|
];
|
|
1509
|
-
// Generated crate sources (wire codecs, vocabularies, fixtures)
|
|
1510
|
-
// gitignored and invisible to nx's file
|
|
1511
|
-
// as the outputs of the targets a
|
|
1512
|
-
// those outputs here means a
|
|
1513
|
-
//
|
|
1514
|
-
//
|
|
1515
|
-
//
|
|
1516
|
-
//
|
|
1575
|
+
// Generated crate sources (wire codecs, vocabularies, fixtures) and
|
|
1576
|
+
// compiled-in files are often gitignored and invisible to nx's file
|
|
1577
|
+
// hasher; they reach these targets as the outputs of the targets a
|
|
1578
|
+
// repository adds to `dependsOn`. Hashing those outputs here means a
|
|
1579
|
+
// repository never has to restate `inputs` to add them - and a restated
|
|
1580
|
+
// `inputs` REPLACES this union with the root project's `default`, which
|
|
1581
|
+
// owns no crate file, so the test build then cache-hits against edited
|
|
1582
|
+
// crates while every per-crate test reruns on the stale binary. Only the
|
|
1583
|
+
// outputs under the union's own file sets are hashed
|
|
1584
|
+
// (`cargoProducerOutputInputs`): a compile reads nothing else, and a
|
|
1585
|
+
// producer's TypeScript output outside every crate keys no Rust build.
|
|
1586
|
+
const closureInputs = workspaceInputs.length > 0 ? workspaceInputs : CARGO_INPUTS;
|
|
1517
1587
|
const workspaceCargoInputs = [
|
|
1518
|
-
...
|
|
1519
|
-
|
|
1588
|
+
...closureInputs,
|
|
1589
|
+
...cargoProducerOutputInputs(closureInputs, cargoWorkspaceRoot),
|
|
1520
1590
|
];
|
|
1521
|
-
targets[CARGO_TEST_BUILD_TARGET] = createCargoTestBuildTarget(cargoWorkspaceRoot, nextestToolConfigArg(cargoWorkspaceRoot), nativeTools);
|
|
1522
1591
|
// The build's `cargo nextest list` loads the repository's nextest config and
|
|
1523
1592
|
// refuses an invalid one, so that file keys the build as well as every run.
|
|
1524
|
-
targets[CARGO_TEST_BUILD_TARGET]
|
|
1593
|
+
targets[CARGO_TEST_BUILD_TARGET] = createCargoTestBuildTarget(cargoWorkspaceRoot, nextestToolConfigArg(cargoWorkspaceRoot), nativeTools, [...workspaceCargoInputs, `{projectRoot}/${NEXTEST_REPO_CONFIG_PATH}`]);
|
|
1525
1594
|
// One archive per declared foreign triple, from the same inputs and the
|
|
1526
1595
|
// same repository nextest config, whose `archive.include` decides what an
|
|
1527
1596
|
// archive CONTAINS: it is the workspace's test binaries for another
|
|
@@ -1788,36 +1857,6 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1788
1857
|
[UNRESOLVED_CARGO_LOCK_INPUT]),
|
|
1789
1858
|
];
|
|
1790
1859
|
}
|
|
1791
|
-
const napiDebug = targets['napi-debug'];
|
|
1792
|
-
if (napiDebug && cargoWorkspace) {
|
|
1793
|
-
// A crate whose project also builds the debug cdylib runs its tests after
|
|
1794
|
-
// that build: the tests dlopen what `napi-debug` writes into `target/debug`,
|
|
1795
|
-
// and a test binary run in place loads it from this tree.
|
|
1796
|
-
const runners = [
|
|
1797
|
-
...cargoPackagePlans.flatMap((plan) => plan.pieces.map((piece) => piece.targetName)),
|
|
1798
|
-
// The root owns the serial groups' runners, so they take its build as its pieces do.
|
|
1799
|
-
...(ownsCargoWorkspaceTargets
|
|
1800
|
-
? cargoWorkspace.serialGroups.map((group) => cargoTestGroupTargetName(group.group))
|
|
1801
|
-
: []),
|
|
1802
|
-
];
|
|
1803
|
-
for (const name of runners) {
|
|
1804
|
-
const target = targets[name];
|
|
1805
|
-
if (target && !hasCargoTargetDependency(target.dependsOn ?? [], 'napi-debug')) {
|
|
1806
|
-
target.dependsOn = [...(target.dependsOn ?? []), 'napi-debug'];
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
else if (napiDebug) {
|
|
1811
|
-
const cargoTest = targets[CARGO_TEST_TARGET];
|
|
1812
|
-
if (cargoTest?.options &&
|
|
1813
|
-
typeof cargoTest.options.command === 'string' &&
|
|
1814
|
-
cargoTest.options.command.startsWith('cargo ')) {
|
|
1815
|
-
const dependsOn = cargoTest.dependsOn ?? [];
|
|
1816
|
-
if (!dependsOn.includes('napi-debug')) {
|
|
1817
|
-
cargoTest.dependsOn = [...dependsOn, 'napi-debug'];
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
1860
|
// The inferring host's own platform binaries join the aggregate `build`;
|
|
1822
1861
|
// publish still owns foreign platforms.
|
|
1823
1862
|
const hostPlatformBinaries = hostPlatformTargetNames([...Object.keys(declaredTargets), ...Object.keys(targets)], hostPlatform);
|
|
@@ -1971,6 +2010,15 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1971
2010
|
validationTargets.push(SHARD_TIMINGS_TARGET);
|
|
1972
2011
|
}
|
|
1973
2012
|
const { commands: lintCommands, inputs: lintProgramInputs, eslintFileSet, } = projectLintCommands(projectRoot, workspaceRoot, eslint);
|
|
2013
|
+
// The lint tools run from the root's node_modules/.bin, and ESLint loads the packages its configs name.
|
|
2014
|
+
const runsEslint = eslintFileSet !== null;
|
|
2015
|
+
const lintScopes = [
|
|
2016
|
+
...bunLoadInput(rootManifests, [
|
|
2017
|
+
...(runsEslint ? ['eslint'] : []),
|
|
2018
|
+
...(lintCommands.some((command) => command.startsWith('biome ')) ? ['@biomejs/biome'] : []),
|
|
2019
|
+
]).externalDependencies,
|
|
2020
|
+
...(runsEslint ? (eslint?.configScopes ?? []) : []),
|
|
2021
|
+
];
|
|
1974
2022
|
// Every lint tool reaches its own verdict in one run: run-commands would end the
|
|
1975
2023
|
// other tools once one fails, and their findings would surface a run later.
|
|
1976
2024
|
if (validationTargets.length > 0 || lintCommands.length > 0) {
|
|
@@ -1990,6 +2038,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1990
2038
|
`{projectRoot}/${name}`,
|
|
1991
2039
|
]),
|
|
1992
2040
|
...(eslint?.configImports ?? []).map((path) => `{workspaceRoot}/${path}`),
|
|
2041
|
+
...(lintScopes.length > 0 ? [bunScopeInput(projectRoot, lintScopes)] : []),
|
|
1993
2042
|
],
|
|
1994
2043
|
...(lintCommands.length > 0
|
|
1995
2044
|
? {
|
|
@@ -2016,8 +2065,12 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
2016
2065
|
];
|
|
2017
2066
|
}
|
|
2018
2067
|
}
|
|
2019
|
-
//
|
|
2020
|
-
//
|
|
2068
|
+
// bounded-exec's admission observer loads cowshed's process-lineage entry, and through it the addon, only while a
|
|
2069
|
+
// Cargo leaf waits for mbx admission (specs/cowshed/11_shell.md, "Cargo test-runner boundaries"; mbx-queue.ts). Such
|
|
2070
|
+
// a target runs after the local producers so the observer finds them. Its reading only decides whether that wait is
|
|
2071
|
+
// credited against the idle bound, so the producers' bytes key no target (README, "Bounded exec key"): a command that
|
|
2072
|
+
// reads them keys them itself. A command named in either the declaration or the inference counts.
|
|
2073
|
+
// Declarations retain these prerequisites with Nx's ordinary "..." merge token.
|
|
2021
2074
|
// The canonical release-check instead judges prebuilt shipping artifacts and must remain dependency-free.
|
|
2022
2075
|
const observerProducers = [...nativeToolDependsOn(nativeTools, 'cowshed'), ...lineageProducer];
|
|
2023
2076
|
if (observerProducers.length > 0) {
|
|
@@ -2030,14 +2083,66 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
2030
2083
|
if (targets[name]?.executor !== undefined && targets[name]?.executor !== executor) {
|
|
2031
2084
|
targets[name] = {};
|
|
2032
2085
|
}
|
|
2086
|
+
const runs = [...targetOptionSets(declared), ...targetOptionSets(targets[name])];
|
|
2087
|
+
if (!runs.some((options) => runsAsCargoLeaf(boundedCommandLine(options) ?? '')))
|
|
2088
|
+
continue;
|
|
2033
2089
|
targets[name] ??= {};
|
|
2034
2090
|
const target = targets[name];
|
|
2035
2091
|
target.dependsOn = [...(target.dependsOn ?? []), ...observerProducers];
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
// The package's addon loader reads napi-debug's dev-profile addon when NAPI_DEBUG_ADDON=1 (createNapiTestTarget), so
|
|
2095
|
+
// a target whose run sets it, in its declaration or its inference, runs after that build and keys the addon it writes.
|
|
2096
|
+
if (targets['napi-debug'] !== undefined) {
|
|
2097
|
+
for (const name of new Set([...Object.keys(targets), ...Object.keys(declaredTargets)])) {
|
|
2098
|
+
const declared = declaredTargets[name];
|
|
2099
|
+
const runs = [...targetOptionSets(declared), ...targetOptionSets(targets[name])];
|
|
2100
|
+
if (!runs.some((options) => isRecord(options.env) && options.env.NAPI_DEBUG_ADDON === '1'))
|
|
2101
|
+
continue;
|
|
2102
|
+
const executor = isRecord(declared) && declared.executor !== undefined ? declared.executor : targets[name]?.executor;
|
|
2103
|
+
// Nx discards an incompatible executor's inferred configuration; only the addon prerequisite belongs below it.
|
|
2104
|
+
if (targets[name]?.executor !== undefined && targets[name]?.executor !== executor) {
|
|
2105
|
+
targets[name] = {};
|
|
2106
|
+
}
|
|
2107
|
+
targets[name] ??= {};
|
|
2108
|
+
const target = targets[name];
|
|
2109
|
+
const named = [
|
|
2110
|
+
...(target.dependsOn ?? []),
|
|
2111
|
+
...(isRecord(declared) && Array.isArray(declared.dependsOn) ? declared.dependsOn : []),
|
|
2112
|
+
];
|
|
2113
|
+
if (!named.includes('napi-debug')) {
|
|
2114
|
+
target.dependsOn = [...(target.dependsOn ?? []), 'napi-debug'];
|
|
2115
|
+
}
|
|
2036
2116
|
const inputs = target.inputs ?? (isRecord(declared) && Array.isArray(declared.inputs) ? [] : ['default', '^production']);
|
|
2037
|
-
target.inputs = [
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2117
|
+
target.inputs = [...inputs, { dependentTasksOutputFiles: '**/*.node', transitive: false }];
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
// A plugin executor is a file the workspace plugin's own build writes, so a target that starts before that build
|
|
2121
|
+
// ends loads the dist a previous build left: one without the executors the plugin gained since (a Linux CLI
|
|
2122
|
+
// target failed "Could not resolve ./dist/executors/cargo-zigbuild/executor.js" in a checkout restored from a
|
|
2123
|
+
// cache that predated it). Every such target of every project but the plugin takes the one edge, so no executor
|
|
2124
|
+
// needs its own: the executors that build the plugin (the bootstrap ones) take none, the plugin's own targets
|
|
2125
|
+
// are ordered by its own graph, and release-check stays dependency-free (specs/cowshed/06_cli.md,
|
|
2126
|
+
// `release-check`). Declarations that replace `dependsOn` keep it with Nx's "..." token.
|
|
2127
|
+
if (packageJson.name !== '@smoothbricks/nx-plugin') {
|
|
2128
|
+
for (const name of new Set([...Object.keys(targets), ...Object.keys(declaredTargets)])) {
|
|
2129
|
+
if (name === 'release-check')
|
|
2130
|
+
continue;
|
|
2131
|
+
const declared = declaredTargets[name];
|
|
2132
|
+
const executor = isRecord(declared) && declared.executor !== undefined ? declared.executor : targets[name]?.executor;
|
|
2133
|
+
const edge = pluginBuildDependsOn(nativeTools, executor);
|
|
2134
|
+
if (edge.length === 0)
|
|
2135
|
+
continue;
|
|
2136
|
+
// Nx discards an incompatible executor's inferred configuration; only the edge belongs below it.
|
|
2137
|
+
if (targets[name]?.executor !== undefined && targets[name]?.executor !== executor) {
|
|
2138
|
+
targets[name] = {};
|
|
2139
|
+
}
|
|
2140
|
+
targets[name] ??= {};
|
|
2141
|
+
const target = targets[name];
|
|
2142
|
+
const present = new Set((target.dependsOn ?? []).map((dependency) => JSON.stringify(dependency)));
|
|
2143
|
+
target.dependsOn = [
|
|
2144
|
+
...(target.dependsOn ?? []),
|
|
2145
|
+
...edge.filter((dependency) => !present.has(JSON.stringify(dependency))),
|
|
2041
2146
|
];
|
|
2042
2147
|
}
|
|
2043
2148
|
}
|
|
@@ -2060,6 +2165,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
2060
2165
|
// its configuration hash, so defining it everywhere would invalidate every
|
|
2061
2166
|
// task in the repository to serve projects that can never reference it.
|
|
2062
2167
|
const namedInputs = {
|
|
2168
|
+
[BUN_LOCK_SCOPE_NAMED_INPUT]: [bunLockInput(projectRoot)],
|
|
2063
2169
|
...(versionless === null
|
|
2064
2170
|
? {}
|
|
2065
2171
|
: {
|
|
@@ -2134,7 +2240,8 @@ async function lockScopeNodes(projectRoot, inputLists, cargoWorkspaces) {
|
|
|
2134
2240
|
}
|
|
2135
2241
|
}
|
|
2136
2242
|
const own = bunLockNode(projectRoot);
|
|
2137
|
-
const
|
|
2243
|
+
const runtime = bunLockRuntimeNode(projectRoot);
|
|
2244
|
+
const nodes = { [own.name]: own, [runtime.name]: runtime };
|
|
2138
2245
|
for (const node of await Promise.all([...directories].map((directory) => cargoLockNode(directory, cargoSourcesUnder(directory, cargoWorkspaces))))) {
|
|
2139
2246
|
nodes[node.name] = node;
|
|
2140
2247
|
}
|
|
@@ -2430,6 +2537,27 @@ function createNapiTargets(projectRoot, config, hostPlatform, nativeTools, repoR
|
|
|
2430
2537
|
}
|
|
2431
2538
|
return targets;
|
|
2432
2539
|
}
|
|
2540
|
+
/** A target's own options and each of its configurations' options, as one declaration or inference states them. */
|
|
2541
|
+
function targetOptionSets(target) {
|
|
2542
|
+
if (!isRecord(target))
|
|
2543
|
+
return [];
|
|
2544
|
+
const configurations = isRecord(target.configurations) ? Object.values(target.configurations) : [];
|
|
2545
|
+
return [target.options, ...configurations].filter(isRecord);
|
|
2546
|
+
}
|
|
2547
|
+
/** The command line a bounded-exec run with `options` starts (`boundedCommand`), or null when they name no command. */
|
|
2548
|
+
function boundedCommandLine(options) {
|
|
2549
|
+
const { command, args } = options;
|
|
2550
|
+
if (typeof command !== 'string')
|
|
2551
|
+
return null;
|
|
2552
|
+
return boundedCommand({
|
|
2553
|
+
command,
|
|
2554
|
+
args: typeof args === 'string'
|
|
2555
|
+
? args
|
|
2556
|
+
: Array.isArray(args)
|
|
2557
|
+
? args.filter((arg) => typeof arg === 'string')
|
|
2558
|
+
: undefined,
|
|
2559
|
+
});
|
|
2560
|
+
}
|
|
2433
2561
|
function createNapiTestTarget(projectRoot, hasDedicatedBunfig) {
|
|
2434
2562
|
const configFlag = hasDedicatedBunfig ? ' --config=../bunfig.napi-test.toml' : ' --config=../bunfig.toml';
|
|
2435
2563
|
return {
|
|
@@ -2634,10 +2762,10 @@ async function resolveCargoWorkspaces(packageJsonPaths, workspaceRoot, hostPlatf
|
|
|
2634
2762
|
return [];
|
|
2635
2763
|
// Started only once every workspace listed cleanly, so a listing that throws
|
|
2636
2764
|
// leaves no Cargo process behind.
|
|
2637
|
-
const
|
|
2765
|
+
const indexedSources = indexedCargoSources(workspaceRoot);
|
|
2638
2766
|
return Promise.all(found.map(async (workspace) => ({
|
|
2639
2767
|
...workspace,
|
|
2640
|
-
closureSource: await resolveCargoClosureSource(posix.join(workspace.projectRoot, 'Cargo.toml'), workspaceRoot,
|
|
2768
|
+
closureSource: await resolveCargoClosureSource(posix.join(workspace.projectRoot, 'Cargo.toml'), workspaceRoot, indexedSources, workspace.inputsCache.compiledInFiles),
|
|
2641
2769
|
})));
|
|
2642
2770
|
}
|
|
2643
2771
|
/**
|
|
@@ -2766,6 +2894,7 @@ async function cargoTestRunnerInputs(workspaceRoot, workspace, memberDirs) {
|
|
|
2766
2894
|
memberDir,
|
|
2767
2895
|
cache: workspace.inputsCache,
|
|
2768
2896
|
cargo: workspace.closureSource.cargo,
|
|
2897
|
+
sources: workspace.closureSource.sources,
|
|
2769
2898
|
})));
|
|
2770
2899
|
// The test build unifies every built package's manifest into every test binary, and a runner's key does not follow
|
|
2771
2900
|
// the build's outputs, so each runner names them all: the ones Nx holds as files, the rest through the repository's
|
|
@@ -2813,7 +2942,7 @@ const NEXTEST_BINARIES_FIXTURE_TIMEOUT_MS = 3_600_000;
|
|
|
2813
2942
|
* from the run's, and names the crates loudly when mbx had to compile (smoo-nx-nextest-binaries).
|
|
2814
2943
|
*/
|
|
2815
2944
|
function nextestRunnerFixture(workspace, nativeTools) {
|
|
2816
|
-
const helper = nativeToolCommand(nativeTools, workspace.projectRoot, 'nextest-extract',
|
|
2945
|
+
const helper = nativeToolCommand(nativeTools, workspace.projectRoot, 'nextest-extract', NEXTEST_HELPER_BIN);
|
|
2817
2946
|
return `${helper} ensure ${NEXTEST_BINARIES_METADATA} ${NEXTEST_BUILD_KEY} -- ${nextestBinariesBuild(nextestToolConfigArg(workspace.projectRoot))}`;
|
|
2818
2947
|
}
|
|
2819
2948
|
/**
|
|
@@ -2824,7 +2953,7 @@ function nextestRunnerFixture(workspace, nativeTools) {
|
|
|
2824
2953
|
function nextestRunnerCommand(verb, workspace, nativeTools, selector, flags) {
|
|
2825
2954
|
const toolConfig = nextestToolConfigArg(workspace.projectRoot);
|
|
2826
2955
|
// Relative to the runner's cwd, so the hashed command is the same in every checkout.
|
|
2827
|
-
const helper = nativeToolCommand(nativeTools, workspace.projectRoot, 'nextest-extract',
|
|
2956
|
+
const helper = nativeToolCommand(nativeTools, workspace.projectRoot, 'nextest-extract', NEXTEST_HELPER_BIN);
|
|
2828
2957
|
const reuseBuild = `--binaries-metadata ${NEXTEST_BINARIES_METADATA} --cargo-metadata ${NEXTEST_CARGO_METADATA} ` +
|
|
2829
2958
|
`--target-dir-remap "$(${helper} target-dir)"`;
|
|
2830
2959
|
return cargoFrozen(`nextest ${verb} ${reuseBuild} --workspace-remap . -E ${shellWord(selector)}${flags} --user-config-file none ${toolConfig}`);
|
|
@@ -2834,7 +2963,8 @@ function cargoTestRunnerTarget(workspace, nativeTools, build, inputs, piece) {
|
|
|
2834
2963
|
return {
|
|
2835
2964
|
executor: '@smoothbricks/nx-plugin:bounded-exec',
|
|
2836
2965
|
cache: true,
|
|
2837
|
-
|
|
2966
|
+
// The command (`target-dir`) and the fixture (`ensure`) run the nextest helper.
|
|
2967
|
+
inputs: [...inputs, ...nextestHelperInputs(nativeTools)],
|
|
2838
2968
|
dependsOn: [build, ...nativeToolDependsOn(nativeTools, 'nextest-extract')],
|
|
2839
2969
|
options: {
|
|
2840
2970
|
command: nextestRunnerCommand('run', workspace, nativeTools, piece.selector, `${piece.extra} --no-fail-fast --no-tests=pass`),
|
|
@@ -2860,7 +2990,7 @@ function cargoTestGroupTarget(workspace, nativeTools, inputs, group) {
|
|
|
2860
2990
|
return {
|
|
2861
2991
|
executor: '@smoothbricks/nx-plugin:bounded-exec',
|
|
2862
2992
|
cache: true,
|
|
2863
|
-
inputs: [...inputs, fileHashInput(PLUGIN_NEXTEST_CODE_BOUND)],
|
|
2993
|
+
inputs: [...inputs, fileHashInput(PLUGIN_NEXTEST_CODE_BOUND), ...nextestHelperInputs(nativeTools)],
|
|
2864
2994
|
dependsOn: [CARGO_TEST_BUILD_TARGET, ...nativeToolDependsOn(nativeTools, 'nextest-extract')],
|
|
2865
2995
|
options: {
|
|
2866
2996
|
command: nextestRunnerCommand('run', workspace, nativeTools, group.filter, ' --no-fail-fast --no-tests=fail'),
|
|
@@ -2873,14 +3003,3 @@ function cargoTestGroupTarget(workspace, nativeTools, inputs, group) {
|
|
|
2873
3003
|
},
|
|
2874
3004
|
};
|
|
2875
3005
|
}
|
|
2876
|
-
function hasCargoTargetDependency(dependencies, expected) {
|
|
2877
|
-
if (typeof expected === 'string') {
|
|
2878
|
-
return dependencies.includes(expected);
|
|
2879
|
-
}
|
|
2880
|
-
return dependencies.some((dependency) => typeof dependency !== 'string' &&
|
|
2881
|
-
dependency.target === expected.target &&
|
|
2882
|
-
Array.isArray(dependency.projects) &&
|
|
2883
|
-
Array.isArray(expected.projects) &&
|
|
2884
|
-
dependency.projects.length === expected.projects.length &&
|
|
2885
|
-
dependency.projects.every((project, index) => project === expected.projects?.[index]));
|
|
2886
|
-
}
|
|
@@ -44,9 +44,9 @@ export interface ManagedFileContext {
|
|
|
44
44
|
}
|
|
45
45
|
/** Temporary upstream compiler repairs distributed to smoo-managed Bun workspaces. */
|
|
46
46
|
export declare const managedTtscPatch: {
|
|
47
|
-
readonly version: '0.
|
|
48
|
-
readonly key: 'ttsc@0.
|
|
49
|
-
readonly path: 'patches/ttsc@0.
|
|
47
|
+
readonly version: '0.36.3';
|
|
48
|
+
readonly key: 'ttsc@0.36.3';
|
|
49
|
+
readonly path: 'patches/ttsc@0.36.3.patch';
|
|
50
50
|
};
|
|
51
51
|
/** Maintained Nx 24.0.3 repairs, applied as an ordinary Bun patchedDependency over the registry release. */
|
|
52
52
|
export declare const managedNxPatch: {
|
|
@@ -7,9 +7,9 @@ import { renderPrPreviewCleanupWorkflowYaml, renderPrStageSweepWorkflowYaml } fr
|
|
|
7
7
|
import { renderPublishWorkflowYaml } from './publish-workflow.js';
|
|
8
8
|
/** Temporary upstream compiler repairs distributed to smoo-managed Bun workspaces. */
|
|
9
9
|
export const managedTtscPatch = {
|
|
10
|
-
version: '0.
|
|
11
|
-
key: 'ttsc@0.
|
|
12
|
-
path: 'patches/ttsc@0.
|
|
10
|
+
version: '0.36.3',
|
|
11
|
+
key: 'ttsc@0.36.3',
|
|
12
|
+
path: 'patches/ttsc@0.36.3.patch',
|
|
13
13
|
};
|
|
14
14
|
/** Maintained Nx 24.0.3 repairs, applied as an ordinary Bun patchedDependency over the registry release. */
|
|
15
15
|
export const managedNxPatch = {
|
|
@@ -9,7 +9,11 @@ import { type FileResult, type ManagedPathInfo } from './tree.js';
|
|
|
9
9
|
* installs dependencies or resolves secrets.
|
|
10
10
|
*/
|
|
11
11
|
export declare function generateManagedFiles(tree: Tree, projects: WorkspaceProjects, pathInfo?: ReadonlyMap<string, ManagedPathInfo>): Promise<FileResult[]>;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Shared rendering boundary; stage only after every consumer formatter has succeeded. The render is a function of the
|
|
14
|
+
* context, the workspace's source listing and what it reads through the Tree, so it runs again only when one of those
|
|
15
|
+
* changed (`renderedOnChange`); staging always compares against the Tree as it is.
|
|
16
|
+
*/
|
|
13
17
|
export declare function generateManagedFilesForContext(tree: Tree, context: ManagedFileContext, pathInfo?: ReadonlyMap<string, ManagedPathInfo>): Promise<FileResult[]>;
|
|
14
18
|
/** Native Nx generate/sync entry point. CLI calls the same transformation with its already-loaded graph. */
|
|
15
19
|
export default function generator(tree: Tree): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/managed-files/generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/managed-files/generator.ts"],"names":[],"mappings":"AACA,OAAO,EAAqE,KAAK,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGxH,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,YAAY,CAAC;AAIzE,OAAO,EAA4B,KAAK,UAAU,EAAE,KAAK,eAAe,EAAqB,MAAM,WAAW,CAAC;AAE/G;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,GAC9C,OAAO,CAAC,UAAU,EAAE,CAAC,CAcvB;AAED;;;;GAIG;AACH,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,GAC9C,OAAO,CAAC,UAAU,EAAE,CAAC,CAqBvB;AAED,4GAA4G;AAC5G,wBAA8B,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjE"}
|