@smoothbricks/nx-plugin 0.7.1 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +140 -137
  2. package/dist/.build-inputs.json +18 -18
  3. package/dist/cargo-toolchain-paths.d.ts +1 -1
  4. package/dist/cargo-toolchain-paths.js +1 -1
  5. package/dist/cargo-toolchain-policy.d.ts +2 -2
  6. package/dist/cargo-toolchain-policy.js +2 -2
  7. package/dist/cross-check-policy.d.ts +25 -30
  8. package/dist/cross-check-policy.d.ts.map +1 -1
  9. package/dist/cross-check-policy.js +27 -31
  10. package/dist/ensure-built-witness.js +727 -450
  11. package/dist/ensure-built.js +2 -2
  12. package/dist/executors/bounded-exec/bounds.d.ts +6 -3
  13. package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
  14. package/dist/executors/bounded-exec/bounds.js +9 -2
  15. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  16. package/dist/executors/bounded-exec/executor.js +24 -19
  17. package/dist/executors/bounded-exec/mbx-pool.d.ts +13 -16
  18. package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
  19. package/dist/executors/bounded-exec/mbx-pool.js +24 -28
  20. package/dist/executors/bounded-exec/runner-lifecycle.d.ts +2 -0
  21. package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
  22. package/dist/executors/bounded-exec/runner-lifecycle.js +9 -5
  23. package/dist/executors/bounded-exec/runner-sizing.d.ts +6 -1
  24. package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -1
  25. package/dist/executors/bounded-exec/runner-sizing.js +7 -2
  26. package/dist/executors/bounded-exec/schema.d.ts +12 -3
  27. package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
  28. package/dist/executors/cargo-zigbuild/executor.d.ts +10 -0
  29. package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
  30. package/dist/executors/cargo-zigbuild/executor.js +36 -2
  31. package/dist/index.js +24 -11
  32. package/dist/managed-files/files.d.ts +4 -4
  33. package/dist/managed-files/files.js +4 -4
  34. package/dist/owned-installation.d.ts.map +1 -1
  35. package/dist/owned-installation.js +4 -2
  36. package/dist/producer-receipts.js +476 -402
  37. package/dist/task-graph-policy.js +1 -1
  38. package/dist/testing.d.ts +8 -0
  39. package/dist/testing.d.ts.map +1 -1
  40. package/dist/testing.js +15 -0
  41. package/dist/workspace-config-policy.d.ts +1 -1
  42. package/dist/workspace-config-policy.js +1 -1
  43. package/dist/workspace-manifest.d.ts +5 -0
  44. package/dist/workspace-manifest.d.ts.map +1 -1
  45. package/managed/raw/patches/{nx@23.2.1.patch → nx@24.0.3.patch} +1397 -2174
  46. package/managed/raw/tooling/direnv/devenv.smoo.nix +30 -31
  47. package/managed/raw/tooling/git-hooks/pre-push.sh +21 -21
  48. package/managed/templates/github/actions/setup-devenv/action.yml +20 -5
  49. package/package.json +4 -3
  50. package/runtime/nx-publish/.build-inputs.json +2 -2
  51. package/runtime/nx-publish/cache_adapter.js +24 -11
  52. package/runtime/nx-publish/nx_publish.js +2 -1
  53. package/runtime-input.sh +1 -1
  54. package/src/cargo-toolchain-paths.ts +1 -1
  55. package/src/cargo-toolchain-policy.ts +2 -2
  56. package/src/cross-check-policy.ts +29 -32
  57. package/src/ensure-built.ts +2 -2
  58. package/src/executors/bounded-exec/bounds.ts +13 -4
  59. package/src/executors/bounded-exec/executor.ts +27 -29
  60. package/src/executors/bounded-exec/mbx-pool.ts +36 -30
  61. package/src/executors/bounded-exec/runner-lifecycle.ts +13 -6
  62. package/src/executors/bounded-exec/runner-sizing.ts +8 -2
  63. package/src/executors/bounded-exec/schema.json +5 -1
  64. package/src/executors/bounded-exec/schema.ts +12 -3
  65. package/src/executors/cargo-zigbuild/executor.ts +42 -2
  66. package/src/index.ts +27 -9
  67. package/src/managed-files/files.ts +4 -4
  68. package/src/owned-installation.ts +4 -2
  69. package/src/task-graph-policy.ts +1 -1
  70. package/src/testing.ts +13 -0
  71. package/src/workspace-config-policy.ts +1 -1
  72. package/src/workspace-manifest.ts +5 -0
  73. package/test-timings.json +2 -0
package/dist/index.js CHANGED
@@ -1289,7 +1289,8 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
1289
1289
  const hasOrdinaryBuildOutputTarget = hasLibTsconfig || napiConfig !== null || cargoWasmConfig !== null || declaresPackageLocalBuildOutput(packageJson);
1290
1290
  const isDeployableWranglerProject = packageJson.private === true && WRANGLER_CONFIG_FILES.some((file) => existsSync(join(absoluteProjectRoot, file)));
1291
1291
  if (hasLibTsconfig) {
1292
- const executableOutputs = packageBinOutputs(packageJson, packageJsonPath);
1292
+ const libOutDir = typescriptOutDir(libTsconfigPath, packageJsonPath);
1293
+ const executableOutputs = packageBinOutputs(packageJson, packageJsonPath).filter((bin) => typescriptEmitWrites(libOutDir, bin));
1293
1294
  // Dependency packages may publish bundled entries that raw tsc does not produce.
1294
1295
  // Build every JavaScript output lane before resolving package exports, without pulling
1295
1296
  // unrelated Wasm, N-API, native, or web outputs onto the compiler critical path.
@@ -1299,7 +1300,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
1299
1300
  executor: '@smoothbricks/nx-plugin:typescript-emit',
1300
1301
  cache: true,
1301
1302
  inputs: ['production', '^production', ...toolchainInputs, '{projectRoot}/tsconfig.lib.json'],
1302
- outputs: inferTypescriptOutputs(libTsconfigPath, packageJsonPath),
1303
+ outputs: inferTypescriptOutputs(libOutDir),
1303
1304
  dependsOn: ['^*-js', ...(cargoWasmConfig ? ['cargo-wasm'] : [])],
1304
1305
  options: {
1305
1306
  ...(executableOutputs.length > 0 ? { executableOutputs } : {}),
@@ -2161,8 +2162,7 @@ async function resolveCargoWasmConfig(absoluteProjectRoot, packageJsonPath, work
2161
2162
  }
2162
2163
  return resolved[0] ?? null;
2163
2164
  }
2164
- function inferTypescriptOutputs(tsconfigPath, packageJsonPath) {
2165
- const outDir = typescriptOutDir(tsconfigPath, packageJsonPath);
2165
+ function inferTypescriptOutputs(outDir) {
2166
2166
  // No .tsbuildinfo here: the emit executor overlays incremental: false, so
2167
2167
  // tsc-js never writes one and a declared-but-absent output fails the
2168
2168
  // release-candidate output inspection.
@@ -2170,6 +2170,17 @@ function inferTypescriptOutputs(tsconfigPath, packageJsonPath) {
2170
2170
  ? ['{projectRoot}/dist/**/*.{js,cjs,mjs,jsx,d.ts,d.cts,d.mts}{,.map}']
2171
2171
  : [`{projectRoot}/${outDir}/`];
2172
2172
  }
2173
+ /**
2174
+ * Whether the emit `inferTypescriptOutputs(outDir)` declares writes the project-relative `path`: a file beneath
2175
+ * outDir, or JavaScript beneath dist for a config that states no outDir. A package bin a second emit, a bundler or Git
2176
+ * puts elsewhere is not this emit's: a tsc-js that claimed one stat'ed it on a clean checkout before anything wrote it.
2177
+ */
2178
+ function typescriptEmitWrites(outDir, path) {
2179
+ const emitted = posix.normalize(path.replaceAll('\\', '/'));
2180
+ return outDir === null
2181
+ ? emitted.startsWith('dist/') && /\.(?:[cm]?js|jsx)$/.test(emitted)
2182
+ : emitted.startsWith(`${outDir}/`);
2183
+ }
2173
2184
  /** The project-relative `compilerOptions.outDir` the config itself states, or null when it states none. */
2174
2185
  function typescriptOutDir(tsconfigPath, packageJsonPath) {
2175
2186
  const tsconfig = readJsonFile(tsconfigPath);
@@ -2737,17 +2748,17 @@ function nextestRunnerFixture(workspace, nativeTools) {
2737
2748
  return `${helper} ensure ${NEXTEST_BINARIES_METADATA} ${NEXTEST_BUILD_KEY} -- ${nextestBinariesBuild(nextestToolConfigArg(workspace.projectRoot))}`;
2738
2749
  }
2739
2750
  /**
2740
- * One `nextest run` over a filterset against the workspace's test build. Every runner of the
2741
- * workspace builds its command here, so the reuse-build, the remap, the tool config and the cwd
2742
- * cannot drift between the per-crate pieces and the serial groups.
2751
+ * One `nextest run`, or `nextest list`, over a filterset against the workspace's test build. Every runner of the
2752
+ * workspace builds its command here, so the reuse-build, the remap, the tool config and the cwd cannot drift between
2753
+ * the per-crate pieces, their test lists and the serial groups.
2743
2754
  */
2744
- function nextestRunnerCommand(workspace, nativeTools, selector, flags) {
2755
+ function nextestRunnerCommand(verb, workspace, nativeTools, selector, flags) {
2745
2756
  const toolConfig = nextestToolConfigArg(workspace.projectRoot);
2746
2757
  // Relative to the runner's cwd, so the hashed command is the same in every checkout.
2747
2758
  const helper = nativeToolCommand(nativeTools, workspace.projectRoot, 'nextest-extract', 'smoo-nx-nextest-binaries');
2748
2759
  const reuseBuild = `--binaries-metadata ${NEXTEST_BINARIES_METADATA} --cargo-metadata ${NEXTEST_CARGO_METADATA} ` +
2749
2760
  `--target-dir-remap "$(${helper} target-dir)"`;
2750
- return cargoFrozen(`nextest run ${reuseBuild} --workspace-remap . -E ${shellWord(selector)}${flags} --user-config-file none ${toolConfig}`);
2761
+ return cargoFrozen(`nextest ${verb} ${reuseBuild} --workspace-remap . -E ${shellWord(selector)}${flags} --user-config-file none ${toolConfig}`);
2751
2762
  }
2752
2763
  /** One per-crate piece: a bounded run of its partition of the test build's tests. */
2753
2764
  function cargoTestRunnerTarget(workspace, nativeTools, build, inputs, piece) {
@@ -2757,10 +2768,12 @@ function cargoTestRunnerTarget(workspace, nativeTools, build, inputs, piece) {
2757
2768
  inputs,
2758
2769
  dependsOn: [build, ...nativeToolDependsOn(nativeTools, 'nextest-extract')],
2759
2770
  options: {
2760
- command: nextestRunnerCommand(workspace, nativeTools, piece.selector, `${piece.extra} --no-fail-fast --no-tests=pass`),
2771
+ command: nextestRunnerCommand('run', workspace, nativeTools, piece.selector, `${piece.extra} --no-fail-fast --no-tests=pass`),
2761
2772
  cwd: workspace.projectRoot,
2762
2773
  fixtureCommand: nextestRunnerFixture(workspace, nativeTools),
2763
2774
  fixtureTimeoutMs: NEXTEST_BINARIES_FIXTURE_TIMEOUT_MS,
2775
+ // One line per test the piece runs, so under mbx it reserves no more cores than it has tests.
2776
+ unitsCommand: nextestRunnerCommand('list', workspace, nativeTools, piece.selector, `${piece.extra} -T oneline`),
2764
2777
  idleTimeoutMs: BOUNDED_TEST_IDLE_TIMEOUT_MS,
2765
2778
  killAfterMs: BOUNDED_TEST_KILL_AFTER_MS,
2766
2779
  },
@@ -2781,7 +2794,7 @@ function cargoTestGroupTarget(workspace, nativeTools, inputs, group) {
2781
2794
  inputs: [...inputs, fileHashInput(PLUGIN_NEXTEST_CODE_BOUND)],
2782
2795
  dependsOn: [CARGO_TEST_BUILD_TARGET, ...nativeToolDependsOn(nativeTools, 'nextest-extract')],
2783
2796
  options: {
2784
- command: nextestRunnerCommand(workspace, nativeTools, group.filter, ' --no-fail-fast --no-tests=fail'),
2797
+ command: nextestRunnerCommand('run', workspace, nativeTools, group.filter, ' --no-fail-fast --no-tests=fail'),
2785
2798
  cwd: workspace.projectRoot,
2786
2799
  fixtureCommand: nextestRunnerFixture(workspace, nativeTools),
2787
2800
  fixtureTimeoutMs: NEXTEST_BINARIES_FIXTURE_TIMEOUT_MS,
@@ -46,11 +46,11 @@ export declare const managedTtscPatch: {
46
46
  readonly key: 'ttsc@0.34.1';
47
47
  readonly path: 'patches/ttsc@0.34.1.patch';
48
48
  };
49
- /** Maintained Nx 23.2.1 repairs, applied as an ordinary Bun patchedDependency over the registry release. */
49
+ /** Maintained Nx 24.0.3 repairs, applied as an ordinary Bun patchedDependency over the registry release. */
50
50
  export declare const managedNxPatch: {
51
- readonly version: '23.2.1';
52
- readonly key: 'nx@23.2.1';
53
- readonly path: 'patches/nx@23.2.1.patch';
51
+ readonly version: '24.0.3';
52
+ readonly key: 'nx@24.0.3';
53
+ readonly path: 'patches/nx@24.0.3.patch';
54
54
  };
55
55
  export declare const managedFileTargetsForTest: {
56
56
  target: string;
@@ -11,11 +11,11 @@ export const managedTtscPatch = {
11
11
  key: 'ttsc@0.34.1',
12
12
  path: 'patches/ttsc@0.34.1.patch',
13
13
  };
14
- /** Maintained Nx 23.2.1 repairs, applied as an ordinary Bun patchedDependency over the registry release. */
14
+ /** Maintained Nx 24.0.3 repairs, applied as an ordinary Bun patchedDependency over the registry release. */
15
15
  export const managedNxPatch = {
16
- version: '23.2.1',
17
- key: 'nx@23.2.1',
18
- path: 'patches/nx@23.2.1.patch',
16
+ version: '24.0.3',
17
+ key: 'nx@24.0.3',
18
+ path: 'patches/nx@24.0.3.patch',
19
19
  };
20
20
  const managedFiles = [
21
21
  {
@@ -1 +1 @@
1
- {"version":3,"file":"owned-installation.d.ts","sourceRoot":"","sources":["../src/owned-installation.ts"],"names":[],"mappings":"AA2fA,wHAAwH;AACxH,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,+FAA+F;IAC/F,QAAQ,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAoBxF"}
1
+ {"version":3,"file":"owned-installation.d.ts","sourceRoot":"","sources":["../src/owned-installation.ts"],"names":[],"mappings":"AA6fA,wHAAwH;AACxH,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,+FAA+F;IAC/F,QAAQ,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAoBxF"}
@@ -12,7 +12,7 @@ const __typia_transform__accessExpressionAsString = _accessExpressionAsString_1.
12
12
  * test reads it. A fixture must not take an input it does not own.
13
13
  *
14
14
  * So the closure is copied, exactly as the witness's own census resolves it from the workspace that names it: each
15
- * package once, with the census's own exclusions (`node_modules`, `.git`, `.nx`), each dependency edge relinked beside
15
+ * package once, without its `node_modules` and `.git`, each dependency edge relinked beside
16
16
  * its copy as Bun's isolated layout does, the top-level packages' bins in `.bin`. Every copy is a new inode, cloned
17
17
  * where the volume allows and written otherwise, so no link count is shared with anything outside its owner.
18
18
  *
@@ -365,7 +365,9 @@ function copyPackage(source, root, { place }) {
365
365
  recursive: true,
366
366
  verbatimSymlinks: true,
367
367
  mode: constants.COPYFILE_FICLONE,
368
- filter: (path) => path === source || !['node_modules', '.git', '.nx'].includes(basename(path)),
368
+ // A package's own .nx is content, not Nx state: @nx/workspace 24.0.3 ships templates under one, and the census
369
+ // selects their directories through the package's `files` (expandOutputs), so a copy without them holds less.
370
+ filter: (path) => path === source || !['node_modules', '.git'].includes(basename(path)),
369
371
  });
370
372
  }
371
373
  /** Link every resolution edge of `host` beside its copy under `root`, and the top-level packages' bins in `.bin`. */