@smoothbricks/nx-plugin 0.7.15 → 0.7.17

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 (41) hide show
  1. package/README.md +15 -0
  2. package/dist/.build-inputs.json +10 -7
  3. package/dist/compile-environment.d.ts +8 -0
  4. package/dist/compile-environment.d.ts.map +1 -0
  5. package/dist/compile-environment.js +80 -0
  6. package/dist/dependency-manifests.d.ts +13 -0
  7. package/dist/dependency-manifests.d.ts.map +1 -0
  8. package/dist/dependency-manifests.js +20 -0
  9. package/dist/executors/bounded-exec/child-exit-diagnostics.d.ts +45 -0
  10. package/dist/executors/bounded-exec/child-exit-diagnostics.d.ts.map +1 -0
  11. package/dist/executors/bounded-exec/child-exit-diagnostics.js +188 -0
  12. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  13. package/dist/executors/bounded-exec/executor.js +10 -1
  14. package/dist/executors/bounded-exec/host-memory.d.ts +11 -0
  15. package/dist/executors/bounded-exec/host-memory.d.ts.map +1 -1
  16. package/dist/executors/bounded-exec/host-memory.darwin.d.ts.map +1 -1
  17. package/dist/executors/bounded-exec/host-memory.darwin.js +1 -0
  18. package/dist/executors/bounded-exec/host-memory.linux.d.ts +3 -1
  19. package/dist/executors/bounded-exec/host-memory.linux.d.ts.map +1 -1
  20. package/dist/executors/bounded-exec/host-memory.linux.js +16 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +17 -8
  23. package/dist/managed-files/files.d.ts +3 -3
  24. package/dist/managed-files/files.js +3 -3
  25. package/dist/typecheck-route.d.ts +3 -4
  26. package/dist/typecheck-route.d.ts.map +1 -1
  27. package/dist/typecheck-route.js +4 -15
  28. package/managed/raw/patches/{ttsc@0.34.1.patch → ttsc@0.36.3.patch} +728 -71
  29. package/managed/raw/tooling/direnv/devenv.smoo.nix +1 -1
  30. package/package.json +9 -4
  31. package/src/compile-environment.ts +35 -0
  32. package/src/dependency-manifests.ts +30 -0
  33. package/src/executors/bounded-exec/child-exit-diagnostics.ts +87 -0
  34. package/src/executors/bounded-exec/executor.ts +10 -1
  35. package/src/executors/bounded-exec/host-memory.darwin.ts +1 -0
  36. package/src/executors/bounded-exec/host-memory.linux.ts +25 -2
  37. package/src/executors/bounded-exec/host-memory.ts +7 -0
  38. package/src/index.ts +17 -8
  39. package/src/managed-files/files.ts +3 -3
  40. package/src/typecheck-route.ts +5 -14
  41. package/test-timings.json +138 -137
package/dist/index.js CHANGED
@@ -15,7 +15,9 @@ import { CARGO_CLOSURE_INPUT, CARGO_LOCK_NODE_PREFIX, cargoClosureInputs, cargoL
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
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';
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';
@@ -70,11 +72,8 @@ function typecheckCommand(args) {
70
72
  * which bun.lock and the patches in its check inputs already key, and it waits for the targets the declaring package
71
73
  * names to prepare the plugin binaries ttsc loads. Every other project runs the pinned native compiler.
72
74
  */
73
- function typecheckTargets(packageJsonPath, packageJson) {
74
- const route = typecheckRoute(packageJsonPath, [
75
- ...Object.keys(packageJson.dependencies ?? {}),
76
- ...Object.keys(packageJson.devDependencies ?? {}),
77
- ]);
75
+ function typecheckTargets(manifests) {
76
+ const route = typecheckRoute(manifests);
78
77
  return route.declaredBy.length === 0
79
78
  ? { command: typecheckCommand, inputs: [TYPECHECK_COMPILER_INPUT], dependsOn: [] }
80
79
  : { command: (args) => `ttsc ${args}`, inputs: [], dependsOn: route.dependsOn };
@@ -1291,7 +1290,14 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
1291
1290
  const projectRoot = dirname(packageJsonPath);
1292
1291
  const absoluteProjectRoot = join(workspaceRoot, projectRoot);
1293
1292
  const packageJson = await readPackageJson(join(workspaceRoot, packageJsonPath));
1294
- const typecheck = typecheckTargets(join(workspaceRoot, packageJsonPath), packageJson);
1293
+ const dependencyManifests = directDependencyManifests(join(workspaceRoot, packageJsonPath), [
1294
+ ...Object.keys(packageJson.dependencies ?? {}),
1295
+ ...Object.keys(packageJson.devDependencies ?? {}),
1296
+ ]);
1297
+ const typecheck = typecheckTargets(dependencyManifests);
1298
+ // The environment a direct dependency's ttsc plugin lowers by (compile-environment.ts): the emitted JavaScript is a
1299
+ // function of it, so every target whose output is the transformed compile hashes it. A check never is.
1300
+ const compileEnvInputs = compileEnvironment(dependencyManifests).map((name) => ({ env: name }));
1295
1301
  const projectName = packageJson.nx?.name ?? packageJson.name;
1296
1302
  if (typeof projectName !== 'string' || projectName.length === 0) {
1297
1303
  throw new Error(`${packageJsonPath} must declare a non-empty package or nx project name`);
@@ -1367,7 +1373,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
1367
1373
  targets['tsc-js'] = {
1368
1374
  executor: '@smoothbricks/nx-plugin:typescript-emit',
1369
1375
  cache: true,
1370
- inputs: ['production', '^production', ...toolchainInputs, '{projectRoot}/tsconfig.lib.json'],
1376
+ inputs: ['production', '^production', ...toolchainInputs, ...compileEnvInputs, '{projectRoot}/tsconfig.lib.json'],
1371
1377
  outputs: inferTypescriptOutputs(libOutDir),
1372
1378
  dependsOn: ['^*-js', ...(cargoWasmConfig ? ['cargo-wasm'] : [])],
1373
1379
  options: {
@@ -1393,7 +1399,10 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
1393
1399
  cwd: projectRoot,
1394
1400
  },
1395
1401
  };
1396
- Object.assign(targets, scriptcPlatformTargets(packageJson, packageJsonPath, projectRoot, libTsconfigPath, toolchainInputs));
1402
+ Object.assign(targets, scriptcPlatformTargets(packageJson, packageJsonPath, projectRoot, libTsconfigPath, [
1403
+ ...toolchainInputs,
1404
+ ...compileEnvInputs,
1405
+ ]));
1397
1406
  }
1398
1407
  if (hasTestTsconfig) {
1399
1408
  targets['typecheck-tests'] = {
@@ -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.34.1';
48
- readonly key: 'ttsc@0.34.1';
49
- readonly path: 'patches/ttsc@0.34.1.patch';
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.34.1',
11
- key: 'ttsc@0.34.1',
12
- path: 'patches/ttsc@0.34.1.patch',
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 = {
@@ -1,3 +1,4 @@
1
+ import type { DependencyManifest } from './dependency-manifests.js';
1
2
  /**
2
3
  * What a package whose ttsc plugin lowers a dialect declares in its manifest, as `smoo.typecheck`: every project that
3
4
  * depends on it directly compiles sources the stock checker refuses (a construct the plugin's ProgramPlugin rewrites
@@ -19,10 +20,8 @@ export interface TypecheckRoute {
19
20
  readonly dependsOn: readonly string[];
20
21
  }
21
22
  /**
22
- * The typecheck route of the project whose manifest is `packageJsonPath`, over its direct dependencies (the ones ttsc
23
- * discovers plugins on: `dependencies` and `devDependencies`). Each dependency's manifest is the one Node resolution
24
- * reaches from the project, as ttsc reads it; a dependency that is not installed declares nothing. A manifest that
23
+ * The typecheck route of a project over its direct dependencies' manifests (dependency-manifests.ts). A manifest that
25
24
  * declares `smoo.typecheck` in another shape refuses the inference by its path and the field it got wrong.
26
25
  */
27
- export declare function typecheckRoute(packageJsonPath: string, dependencies: readonly string[]): TypecheckRoute;
26
+ export declare function typecheckRoute(manifests: readonly DependencyManifest[]): TypecheckRoute;
28
27
  //# sourceMappingURL=typecheck-route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typecheck-route.d.ts","sourceRoot":"","sources":["../src/typecheck-route.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AASD,yHAAyH;AACzH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,CAuBvG"}
1
+ {"version":3,"file":"typecheck-route.d.ts","sourceRoot":"","sources":["../src/typecheck-route.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AASD,yHAAyH;AACzH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,kBAAkB,EAAE,GAAG,cAAc,CAkBvF"}
@@ -1,8 +1,5 @@
1
1
  import * as _validateReport_1 from "typia/lib/internal/_validateReport";
2
2
  import * as _createStandardSchema_1 from "typia/lib/internal/_createStandardSchema";
3
- import { existsSync, readFileSync } from 'node:fs';
4
- import { createRequire } from 'node:module';
5
- import { join } from 'node:path';
6
3
  import typia from 'typia';
7
4
  const validateManifest = (() => {
8
5
  let errors;
@@ -76,22 +73,14 @@ const validateManifest = (() => {
76
73
  });
77
74
  })();
78
75
  /**
79
- * The typecheck route of the project whose manifest is `packageJsonPath`, over its direct dependencies (the ones ttsc
80
- * discovers plugins on: `dependencies` and `devDependencies`). Each dependency's manifest is the one Node resolution
81
- * reaches from the project, as ttsc reads it; a dependency that is not installed declares nothing. A manifest that
76
+ * The typecheck route of a project over its direct dependencies' manifests (dependency-manifests.ts). A manifest that
82
77
  * declares `smoo.typecheck` in another shape refuses the inference by its path and the field it got wrong.
83
78
  */
84
- export function typecheckRoute(packageJsonPath, dependencies) {
79
+ export function typecheckRoute(manifests) {
85
80
  const declaredBy = [];
86
81
  const dependsOn = [];
87
- const lookup = createRequire(packageJsonPath);
88
- for (const name of new Set(dependencies)) {
89
- const manifest = (lookup.resolve.paths(name) ?? [])
90
- .map((root) => join(root, ...name.split('/'), 'package.json'))
91
- .find((candidate) => existsSync(candidate));
92
- if (manifest === undefined)
93
- continue;
94
- const checked = validateManifest(JSON.parse(readFileSync(manifest, 'utf-8')));
82
+ for (const { name, path: manifest, json } of manifests) {
83
+ const checked = validateManifest(json);
95
84
  if (!checked.success) {
96
85
  throw new Error(`${manifest}: smoo.typecheck must be { compiler: 'ttsc', dependsOn: ['<project>:<target>', ...] }: ${checked.errors
97
86
  .map((error) => `${error.path} expected ${error.expected}`)