@smoothbricks/nx-plugin 0.4.21 → 0.4.23

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 (64) hide show
  1. package/README.md +95 -18
  2. package/dist/bin/smoo-nx-cargo-hash.js +32 -6
  3. package/dist/bin/smoo-nx-exec.js +35 -11
  4. package/dist/cargo-closure-input.d.ts +63 -0
  5. package/dist/cargo-closure-input.d.ts.map +1 -0
  6. package/dist/cargo-closure-input.js +197 -0
  7. package/dist/cargo-source-hash.d.ts +46 -2
  8. package/dist/cargo-source-hash.d.ts.map +1 -1
  9. package/dist/cargo-source-hash.js +238 -114
  10. package/dist/cross-check-policy.d.ts +14 -0
  11. package/dist/cross-check-policy.d.ts.map +1 -1
  12. package/dist/cross-check-policy.js +15 -1
  13. package/dist/ensure-built.d.ts +3 -2
  14. package/dist/ensure-built.d.ts.map +1 -1
  15. package/dist/ensure-built.js +33 -56
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +112 -76
  18. package/dist/managed-files/ci-workflow.d.ts.map +1 -1
  19. package/dist/managed-files/ci-workflow.js +12 -15
  20. package/dist/managed-files/files.d.ts.map +1 -1
  21. package/dist/managed-files/files.js +10 -0
  22. package/dist/managed-files/publish-workflow.d.ts.map +1 -1
  23. package/dist/managed-files/publish-workflow.js +12 -6
  24. package/dist/manifest-hash.d.ts.map +1 -1
  25. package/dist/manifest-hash.js +24 -30
  26. package/dist/package-target-policy.js +1 -1
  27. package/dist/platform-targets.d.ts +7 -0
  28. package/dist/platform-targets.d.ts.map +1 -1
  29. package/dist/platform-targets.js +7 -0
  30. package/dist/workspace-config-policy.d.ts +1 -1
  31. package/dist/workspace-config-policy.d.ts.map +1 -1
  32. package/dist/workspace-config-policy.js +1 -1
  33. package/managed/raw/envrc +38 -1
  34. package/managed/raw/tooling/direnv/developer-links.ts +201 -0
  35. package/managed/raw/tooling/direnv/devenv.smoo.nix +75 -51
  36. package/managed/raw/tooling/direnv/secret-references.ts +3 -1
  37. package/managed/raw/tooling/direnv/setup-environment.ts +562 -78
  38. package/managed/raw/tooling/direnv/shared-caches.sh +53 -0
  39. package/managed/raw/tooling/git-hooks/pre-push.sh +22 -1
  40. package/managed/templates/github/workflows/managed-files.yml +4 -3
  41. package/nextest.toml +5 -5
  42. package/package.json +2 -2
  43. package/src/__tests__/fixture-nx-env.ts +31 -0
  44. package/src/__tests__/in-process-nx-index.ts +9 -0
  45. package/src/bin/smoo-nx-cargo-hash.ts +29 -9
  46. package/src/bin/smoo-nx-exec.ts +40 -11
  47. package/src/cargo-closure-input.test.ts +184 -0
  48. package/src/cargo-closure-input.ts +247 -0
  49. package/src/cargo-source-hash.test.ts +104 -10
  50. package/src/cargo-source-hash.ts +290 -37
  51. package/src/cross-check-policy.ts +15 -3
  52. package/src/ensure-built.test.ts +65 -5
  53. package/src/ensure-built.ts +40 -85
  54. package/src/index.test.ts +94 -53
  55. package/src/index.ts +164 -84
  56. package/src/managed-files/ci-workflow.ts +12 -15
  57. package/src/managed-files/files.ts +10 -0
  58. package/src/managed-files/generator.test.ts +29 -0
  59. package/src/managed-files/publish-workflow.ts +17 -6
  60. package/src/manifest-hash.test.ts +21 -1
  61. package/src/manifest-hash.ts +26 -29
  62. package/src/package-target-policy.ts +1 -1
  63. package/src/platform-targets.ts +8 -0
  64. package/src/workspace-config-policy.ts +6 -1
@@ -1 +1 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/managed-files/files.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EACb,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,6BAA6B,EAC7B,2BAA2B,EAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,kBAAkB,EAAmD,MAAM,kBAAkB,CAAC;AAI5G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAa7C,MAAM,WAAW,kBAAkB;IACjC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AAkB,GAC1B,MAAM,CAMR"}
@@ -46,6 +46,11 @@ const managedFiles = [
46
46
  target: 'tooling/direnv/setup-environment.ts',
47
47
  executable: true,
48
48
  },
49
+ {
50
+ kind: 'raw',
51
+ source: 'tooling/direnv/developer-links.ts',
52
+ target: 'tooling/direnv/developer-links.ts',
53
+ },
49
54
  {
50
55
  kind: 'raw',
51
56
  source: 'tooling/direnv/secret-references.ts',
@@ -62,6 +67,11 @@ const managedFiles = [
62
67
  source: 'tooling/direnv/devenv.smoo.nix',
63
68
  target: 'tooling/direnv/devenv.smoo.nix',
64
69
  },
70
+ {
71
+ kind: 'raw',
72
+ source: 'tooling/direnv/shared-caches.sh',
73
+ target: 'tooling/direnv/shared-caches.sh',
74
+ },
65
75
  {
66
76
  kind: 'raw',
67
77
  source: 'tooling/git-hooks/pre-commit.sh',
@@ -1 +1 @@
1
- {"version":3,"file":"publish-workflow.d.ts","sourceRoot":"","sources":["../../src/managed-files/publish-workflow.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,2BAA2B,EAC5B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAKL,KAAK,sBAAsB,EAI5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAgD,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAExG,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,YAAY,CAAC;AACtF,MAAM,MAAM,wBAAwB,GAChC,oBAAoB,GACpB,uBAAuB,GACvB,mBAAmB,GACnB,8BAA8B,GAC9B,SAAS,GACT,QAAQ,CAAC;AACb,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAChE,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG,YAAY,CAAC;AAE/D,oBAAY,uBAAuB;IACjC,QAAQ,aAAa;IACr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AAID,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,gCAAqC,GAAG,yBAAyB,CA2F/G;AAkCD,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,yBAAyB,EACnC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CAwFnC;AA2BD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,gCAAqC,GAAG,MAAM,CAkBhG"}
@@ -1,8 +1,14 @@
1
1
  /* biome-ignore-all lint/suspicious/noTemplateCurlyInString: GitHub Actions expressions are emitted literally. */
2
- import { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS } from '../platform-targets.js';
2
+ import { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS, RELEASE_CONFIGURATION, } from '../platform-targets.js';
3
3
  import { isSmoothBricksCodebasePackageName } from '../workspace-package-policy.js';
4
4
  import { artifactStepLines, CiWorkflowStepKind, cargoCredentialJobEnvLines, cargoCredentialStepLines, deployStepSecretEnvLines, remoteCacheJobEnvLines, sourceCheckoutsStepLines, } from './ci-workflow.js';
5
5
  import { GITHUB_HOSTED_LINUX_RUNNER, renderRunsOnLine } from './github-runs-on.js';
6
+ /**
7
+ * Carried by every step that builds what ships: the build aggregate and each
8
+ * platform leg. Lint and unit tests keep the default configuration, cargo's
9
+ * dev profile, like every local and CI run.
10
+ */
11
+ const RELEASE_BUILD_ARGUMENT = `--configuration ${RELEASE_CONFIGURATION}`;
6
12
  export var PublishWorkflowStepKind;
7
13
  (function (PublishWorkflowStepKind) {
8
14
  PublishWorkflowStepKind["Checkout"] = "checkout";
@@ -446,7 +452,7 @@ function yamlLinesForStep(step, options) {
446
452
  // blocks on actual package issues (smoo monorepo validate).
447
453
  return conditionalRunStep(step, 'smoo monorepo check --warn');
448
454
  case PublishWorkflowStepKind.Build:
449
- return conditionalRunStep(step, `smoo github-ci nx-run-many --targets build --projects "${githubExpression('steps.version.outputs.projects')}"`);
455
+ return conditionalRunStep(step, `smoo github-ci nx-run-many --targets build --projects "${githubExpression('steps.version.outputs.projects')}" ${RELEASE_BUILD_ARGUMENT}`);
450
456
  case PublishWorkflowStepKind.Lint:
451
457
  return conditionalRunStep(step, `smoo github-ci nx-run-many --targets lint --projects "${githubExpression('steps.plan.outputs.projects')}"`);
452
458
  case PublishWorkflowStepKind.UnitTests:
@@ -589,9 +595,9 @@ function renderSingleJobPublishWorkflowSteps(steps, options) {
589
595
  lines.push(' - name: Check cross-platform toolchain prerequisites', ' working-directory: .', ' run: |', ' set -euo pipefail', ...producer.preflight.split('\n').map((line) => ` ${line}`), '');
590
596
  }
591
597
  if (step.kind === PublishWorkflowStepKind.Build) {
592
- lines.push(' - name: 🐧 Build supplemental Linux targets', " if: steps.version.outputs.mode != 'none'", ` run: smoo github-ci nx-run-many --targets "${LINUX_PLATFORM_TARGET_GLOBS.join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}"`, '');
598
+ lines.push(' - name: 🐧 Build supplemental Linux targets', " if: steps.version.outputs.mode != 'none'", ` run: smoo github-ci nx-run-many --targets "${LINUX_PLATFORM_TARGET_GLOBS.join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}" ${RELEASE_BUILD_ARGUMENT}`, '');
593
599
  if (crossOnThisRunner) {
594
- lines.push(' - name: 🍎 Build selected macOS and iOS release outputs', " if: steps.version.outputs.mode != 'none'", ` run: smoo github-ci nx-run-many --targets "${macosPlatformFamilies(options).join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}"`, '');
600
+ lines.push(' - name: 🍎 Build selected macOS and iOS release outputs', " if: steps.version.outputs.mode != 'none'", ` run: smoo github-ci nx-run-many --targets "${macosPlatformFamilies(options).join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}" ${RELEASE_BUILD_ARGUMENT}`, '');
595
601
  }
596
602
  }
597
603
  }
@@ -706,7 +712,7 @@ function renderLinuxReleaseCandidateSteps(steps, options) {
706
712
  lines.push(` - name: ${step.name}`, ' uses: actions/checkout@v6.0.2', ' with:', ` ref: ${githubExpression('github.sha')}`, ' filter: blob:none', ' fetch-depth: 0');
707
713
  }
708
714
  else if (step.kind === PublishWorkflowStepKind.Build) {
709
- lines.push(` - name: ${step.name}`, " if: steps.version.outputs.mode != 'none'", ' run:', ` smoo github-ci nx-run-many --targets build --projects "${githubExpression('steps.version.outputs.projects')}" --collect-outputs "${githubExpression('runner.temp')}/release-build-outputs"`);
715
+ lines.push(` - name: ${step.name}`, " if: steps.version.outputs.mode != 'none'", ' run:', ` smoo github-ci nx-run-many --targets build --projects "${githubExpression('steps.version.outputs.projects')}" ${RELEASE_BUILD_ARGUMENT} --collect-outputs "${githubExpression('runner.temp')}/release-build-outputs"`);
710
716
  }
711
717
  else {
712
718
  lines.push(...yamlLinesForStep(step, options));
@@ -717,7 +723,7 @@ function renderLinuxReleaseCandidateSteps(steps, options) {
717
723
  stepNumber += 1;
718
724
  }
719
725
  if (step.kind === PublishWorkflowStepKind.Build && hasLinuxPlatformTargets(options)) {
720
- lines.push('', ` # Step ${stepNumber}`, ' - name: 🐧 Build supplemental Linux targets', " if: steps.version.outputs.mode != 'none'", ' run:', ` smoo github-ci nx-run-many --targets "${LINUX_PLATFORM_TARGET_GLOBS.join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}" --collect-outputs "${githubExpression('runner.temp')}/linux-platform-outputs"`);
726
+ lines.push('', ` # Step ${stepNumber}`, ' - name: 🐧 Build supplemental Linux targets', " if: steps.version.outputs.mode != 'none'", ' run:', ` smoo github-ci nx-run-many --targets "${LINUX_PLATFORM_TARGET_GLOBS.join(',')}" --projects "${githubExpression('steps.version.outputs.projects')}" ${RELEASE_BUILD_ARGUMENT} --collect-outputs "${githubExpression('runner.temp')}/linux-platform-outputs"`);
721
727
  stepNumber += 1;
722
728
  }
723
729
  lines.push('');
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-hash.d.ts","sourceRoot":"","sources":["../src/manifest-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAoEpD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CA8CjF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,6BAA6B,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgB/G"}
1
+ {"version":3,"file":"manifest-hash.d.ts","sourceRoot":"","sources":["../src/manifest-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAoEpD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CA8CjF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,6BAA6B,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB/G"}
@@ -1,7 +1,7 @@
1
1
  import { createHash } from 'node:crypto';
2
- import { readdir, readFile } from 'node:fs/promises';
3
- import { join, sep } from 'node:path';
4
- import { isNonSourceDirectory } from './source-directories.js';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { join, posix } from 'node:path';
4
+ import { globWithWorkspaceContext } from 'nx/src/utils/workspace-context.js';
5
5
  /**
6
6
  * A release rewrites `version` in every manifest it publishes. Those manifests
7
7
  * are inputs of the validation targets, so a publish run misses the cache for
@@ -145,41 +145,35 @@ export function updateVersionlessCrateManifest(hash, manifest) {
145
145
  * answer: the dependency the digest describes really did change.
146
146
  */
147
147
  export async function hashVersionlessCrateManifests(projectRoot, workspaceRoot) {
148
- const root = join(workspaceRoot, projectRoot);
149
- const paths = [];
150
- await collectCrateManifests(root, '', paths);
151
- paths.sort();
152
- const manifests = await Promise.all(paths.map((path) => readFile(join(root, path))));
148
+ const manifests = await Promise.all((await listCrateManifests(projectRoot, workspaceRoot)).map(async (path) => ({
149
+ path,
150
+ bytes: await readFile(join(workspaceRoot, projectRoot, path)),
151
+ })));
153
152
  const hash = createHash('sha256');
154
153
  hash.update(DIGEST_TAG);
155
154
  hash.update(SEPARATOR);
156
- for (let index = 0; index < paths.length; index++) {
157
- hash.update(paths[index]);
155
+ for (const { path, bytes } of manifests) {
156
+ hash.update(path);
158
157
  hash.update(SEPARATOR);
159
- updateVersionlessCrateManifest(hash, manifests[index]);
158
+ updateVersionlessCrateManifest(hash, bytes);
160
159
  hash.update(SEPARATOR);
161
160
  }
162
161
  return hash.digest('hex');
163
162
  }
164
- /** Collects manifest paths relative to the project root, `/`-separated so the digest is platform-independent. */
165
- async function collectCrateManifests(directory, prefix, found) {
166
- // No `catch`: an unreadable directory would otherwise hash as an empty
167
- // manifest set, which is the silent-staleness failure this module exists to
168
- // avoid. The caller degrades to the raw manifests instead. Symlinked
169
- // directories are not entries `isDirectory` reports, so the walk cannot loop
170
- // and matches what Nx keeps in its file map.
171
- for (const entry of await readdir(directory, { withFileTypes: true })) {
172
- if (entry.isDirectory()) {
173
- // The exclusions every source walk in this plugin uses, so the digest
174
- // covers the same files Nx keeps in its file map.
175
- if (!isNonSourceDirectory(entry.name)) {
176
- await collectCrateManifests(`${directory}${sep}${entry.name}`, `${prefix}${entry.name}/`, found);
177
- }
178
- }
179
- else if (entry.name === CARGO_MANIFEST) {
180
- found.push(`${prefix}${entry.name}`);
181
- }
182
- }
163
+ /**
164
+ * Crate manifest paths relative to the project root, `/`-separated and sorted,
165
+ * so the digest is platform-independent. They come from Nx's own workspace
166
+ * file index — exactly the files the project's `Cargo.toml` exclusion removes
167
+ * from its filesets, with `.gitignore` applied — rather than from a walk of
168
+ * the tree: a walk reads ignored build output, which an Nx cache restore can
169
+ * delete while it is being read. No `catch`: a listing or read that fails
170
+ * would otherwise hash as a smaller manifest set, the silent staleness this
171
+ * module exists to avoid; the caller degrades to the raw manifests instead.
172
+ */
173
+ async function listCrateManifests(projectRoot, workspaceRoot) {
174
+ const prefix = projectRoot === '.' ? '' : `${posix.normalize(projectRoot)}/`;
175
+ const files = await globWithWorkspaceContext(workspaceRoot, [`${prefix}**/${CARGO_MANIFEST}`]);
176
+ return files.map((file) => file.slice(prefix.length)).sort();
183
177
  }
184
178
  /** `from` is just past the `[`. */
185
179
  function isOwnVersionTable(manifest, from, to) {
@@ -236,7 +236,7 @@ function isRedundantBuildDeclaration(build, resolvedTargets) {
236
236
  * Deliberately NOT decided against the resolved project graph. Nx replaces a
237
237
  * named property of an inferred target with the declared one, so the resolved
238
238
  * `build.dependsOn` IS the declaration: comparing them answered "redundant"
239
- * for every noop aggregate anyone ever wrote. AxE's `containium` lost seven
239
+ * for every noop aggregate anyone ever wrote. A downstream runtime host lost seven
240
240
  * edges that way — four of them targets no inference can reach — and a clean
241
241
  * checkout then built it without its producers. The question this has to
242
242
  * answer is what inference yields WITHOUT the declaration, so the test is
@@ -2,4 +2,11 @@
2
2
  export declare const MACOS_PLATFORM_TARGET_GLOBS: readonly ['*-macos', '*-ios'];
3
3
  export declare const LINUX_PLATFORM_TARGET_GLOBS: readonly ['*-linux'];
4
4
  export declare const PLATFORM_TARGET_GLOBS: readonly ["*-macos", "*-ios", "*-linux"];
5
+ /**
6
+ * The Nx configuration that builds what ships. A cargo build target's default
7
+ * options compile cargo's `dev` profile, which every local build, test and
8
+ * gate shares; this configuration adds `--release`. Only release tooling
9
+ * selects it, so a shipped artifact is the only thing compiled twice.
10
+ */
11
+ export declare const RELEASE_CONFIGURATION = "production";
5
12
  //# sourceMappingURL=platform-targets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform-targets.d.ts","sourceRoot":"","sources":["../src/platform-targets.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,eAAO,MAAM,2BAA2B,YAAI,SAAS,EAAE,OAAO,CAAU,CAAC;AACzE,eAAO,MAAM,2BAA2B,YAAI,SAAS,CAAU,CAAC;AAChE,eAAO,MAAM,qBAAqB,0CAA4E,CAAC"}
1
+ {"version":3,"file":"platform-targets.d.ts","sourceRoot":"","sources":["../src/platform-targets.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,eAAO,MAAM,2BAA2B,YAAI,SAAS,EAAE,OAAO,CAAU,CAAC;AACzE,eAAO,MAAM,2BAA2B,YAAI,SAAS,CAAU,CAAC;AAChE,eAAO,MAAM,qBAAqB,0CAA4E,CAAC;AAE/G;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,eAAe,CAAC"}
@@ -2,3 +2,10 @@
2
2
  export const MACOS_PLATFORM_TARGET_GLOBS = ['*-macos', '*-ios'];
3
3
  export const LINUX_PLATFORM_TARGET_GLOBS = ['*-linux'];
4
4
  export const PLATFORM_TARGET_GLOBS = [...MACOS_PLATFORM_TARGET_GLOBS, ...LINUX_PLATFORM_TARGET_GLOBS];
5
+ /**
6
+ * The Nx configuration that builds what ships. A cargo build target's default
7
+ * options compile cargo's `dev` profile, which every local build, test and
8
+ * gate shares; this configuration adds `--release`. Only release tooling
9
+ * selects it, so a shipped artifact is the only thing compiled twice.
10
+ */
11
+ export const RELEASE_CONFIGURATION = 'production';
@@ -5,7 +5,7 @@ export interface NxPolicyIssue {
5
5
  message: string;
6
6
  }
7
7
  export declare const BUILD_OUTPUT_DEPENDENCIES: readonly ['*-js', '*-web', '*-html', '*-css', '*-android', '*-native', '*-napi', '*-bun', '*-wasm'];
8
- export { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS, PLATFORM_TARGET_GLOBS } from './platform-targets.js';
8
+ export { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS, PLATFORM_TARGET_GLOBS, RELEASE_CONFIGURATION, } from './platform-targets.js';
9
9
  /**
10
10
  * The glob list above, spelled as a target name: a target whose name ends in a
11
11
  * reserved family suffix EMITS that kind of artifact. Inference collects
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-config-policy.d.ts","sourceRoot":"","sources":["../src/workspace-config-policy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAKrD,eAAO,MAAM,4BAA4B,0CAA0C,CAAC;AAEpF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,yBAAyB,YACpC,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,WAAW,EACX,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,CACA,CAAC;AAEX,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAIxH;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI5D;AAgBD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,EAAE,CA4DrF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAqB7E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,aAAa,EAAE,CAKpE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAU5D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAYxE;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAWhE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
@@ -14,7 +14,7 @@ export const BUILD_OUTPUT_DEPENDENCIES = [
14
14
  '*-bun',
15
15
  '*-wasm',
16
16
  ];
17
- export { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS, PLATFORM_TARGET_GLOBS } from './platform-targets.js';
17
+ export { LINUX_PLATFORM_TARGET_GLOBS, MACOS_PLATFORM_TARGET_GLOBS, PLATFORM_TARGET_GLOBS, RELEASE_CONFIGURATION, } from './platform-targets.js';
18
18
  const buildOutputTargetSuffixes = BUILD_OUTPUT_DEPENDENCIES.map((glob) => glob.slice(1));
19
19
  /**
20
20
  * The glob list above, spelled as a target name: a target whose name ends in a
package/managed/raw/envrc CHANGED
@@ -11,10 +11,47 @@ esac
11
11
 
12
12
  watch_file tooling/direnv/envrc.sh
13
13
 
14
+ # devenv asks the Cachix API for the signing key of each binary cache it pulls
15
+ # from (`cachix.pull`, `devenv` by default) unless cachix_trusted_keys.json in
16
+ # its home already records it. A cowshed sandbox gives every workspace a private
17
+ # data home and no route to that API (devenv's TLS client rejects the gateway's
18
+ # certificate), so each activation there asked again and was refused. The key is
19
+ # public and fixed, so it is recorded before devenv starts; an existing file is
20
+ # devenv's and stays as it is.
21
+ devenv_keys="${DEVENV_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}/devenv}/cachix_trusted_keys.json"
22
+ if [ ! -e "$devenv_keys" ]; then
23
+ mkdir -p "$(dirname "$devenv_keys")"
24
+ printf '{\n "devenv": "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="\n}\n' >"$devenv_keys.$$"
25
+ mv -f "$devenv_keys.$$" "$devenv_keys"
26
+ fi
27
+ unset devenv_keys
28
+
14
29
  # Load local extensions and overrides from the project root (the gitignored
15
30
  # .envrc-local); capture it before we cd into tooling/direnv, since envrc.sh
16
31
  # leaves us there and a bare relative path would resolve under tooling/direnv.
17
- local_override="$PWD/.envrc-local"
32
+ project_root="$PWD"
33
+ local_override="$project_root/.envrc-local"
18
34
  cd tooling/direnv
19
35
  . envrc.sh
36
+
37
+ # Re-enter exactly when shell entry has something to do. The scripts it runs
38
+ # decide what that is, and setup-environment.ts records the files its install
39
+ # stamps cover — lockfiles, every workspace manifest, bunfig.toml, patches,
40
+ # every pyproject.toml — one per line in $DEVENV_STATE/install-inputs. A shell
41
+ # direnv keeps loaded, or a pool of them gated on direnv's watches, then
42
+ # reinstalls after a pull or a manifest edit and stays put otherwise.
43
+ install_inputs=()
44
+ if [ -f "${DEVENV_STATE:-}/install-inputs" ]; then
45
+ while IFS= read -r install_input; do
46
+ install_inputs+=("$install_input")
47
+ done <"$DEVENV_STATE/install-inputs"
48
+ fi
49
+ watch_file \
50
+ "$project_root/tooling/direnv/repo-path" \
51
+ "$project_root/tooling/direnv/shared-caches.sh" \
52
+ "$project_root/tooling/direnv/setup-environment.ts" \
53
+ "$project_root/tooling/direnv/secret-references.ts" \
54
+ "$project_root/tooling/direnv/toolchain-stamp.ts" \
55
+ ${install_inputs[@]+"${install_inputs[@]}"}
56
+
20
57
  source_env_if_exists "$local_override"
@@ -0,0 +1,201 @@
1
+ /**
2
+ * The links a developer points out of this checkout, kept across every
3
+ * install smoo runs.
4
+ *
5
+ * `bun link <name>`, or a hand-made `ln -s`, replaces a dependency's entry in
6
+ * a node_modules tree with a link to a local checkout of that package: how a
7
+ * consumer runs against a build that is not published yet. Every `bun
8
+ * install` re-points every declared dependency at the lockfile's version —
9
+ * an install with nothing to do included, and before the root `preinstall`
10
+ * script runs (measured on Bun 1.4.2), so no lifecycle script ever sees the
11
+ * link. So each install smoo runs (shell entry's, a CI runner's
12
+ * frozen-lockfile one, `smoo monorepo update`'s) records these links before
13
+ * it installs and puts exactly those back afterwards. A plain `bun install`
14
+ * still relinks them: only a wrapper around bun itself could intercept that.
15
+ *
16
+ * A developer link is a symlink directly inside a node_modules tree bun
17
+ * installs (the root's or a workspace member's, scoped names included) whose
18
+ * target lies outside the project root. The target is resolved against the
19
+ * link's own directory and no further. Everything bun links there resolves
20
+ * inside the root: workspace members by relative path, packages into
21
+ * node_modules/.bun. Following the links further would misclassify: under
22
+ * `globalStore`, each .bun entry is itself a link into the shared install
23
+ * cache, outside every checkout.
24
+ *
25
+ * Nothing is recorded across installs, so the state is the filesystem itself:
26
+ * unlinking a package means removing its link, and the next install puts the
27
+ * lockfile's version there. A link whose target no longer exists is removed
28
+ * before the install, with a warning, so that install puts the lockfile's
29
+ * version in its place.
30
+ *
31
+ * Like secret-references.ts, this is a managed raw script: shell entry imports
32
+ * it before anything is installed, and `smoo monorepo update` loads the copy
33
+ * the nx-plugin ships. Because both use the one implementation, the shell and
34
+ * the command keep the same links.
35
+ */
36
+
37
+ import {
38
+ type Dirent,
39
+ existsSync,
40
+ mkdirSync,
41
+ readdirSync,
42
+ readFileSync,
43
+ readlinkSync,
44
+ rmSync,
45
+ symlinkSync,
46
+ } from 'node:fs';
47
+ import path from 'node:path';
48
+
49
+ interface DeveloperLink {
50
+ /** Where the link is, relative to the project root. */
51
+ readonly path: string;
52
+ /** The link's own text, restored byte for byte. */
53
+ readonly target: string;
54
+ }
55
+
56
+ interface DeveloperLinks {
57
+ readonly live: readonly DeveloperLink[];
58
+ /** Links whose target no longer exists. */
59
+ readonly dangling: readonly DeveloperLink[];
60
+ }
61
+
62
+ /**
63
+ * Runs `install` with every developer link under `root` kept. The links in
64
+ * place when it starts are exactly the links in place when it settles,
65
+ * whether it resolved or rejected, less those that already dangled. It then
66
+ * names them as `reportDeveloperLinks` does.
67
+ */
68
+ export async function keepDeveloperLinks<T>(root: string, install: () => Promise<T>): Promise<T> {
69
+ const { live, dangling } = findDeveloperLinks(root);
70
+ for (const link of dangling) {
71
+ rmSync(path.join(root, link.path), { force: true });
72
+ console.error(`! removed developer link ${link.path}: its target ${resolvedTarget(root, link)} no longer exists`);
73
+ }
74
+ try {
75
+ return await install();
76
+ } finally {
77
+ for (const link of live) {
78
+ restoreLink(root, link);
79
+ }
80
+ describeDeveloperLinks(root, live);
81
+ }
82
+ }
83
+
84
+ /**
85
+ * One stderr line naming each linked package and the checkout it points at,
86
+ * so a shell running a local build says so. Shell entry prints it on every
87
+ * entry that installs nothing. The entry that installs gets the same line
88
+ * from `keepDeveloperLinks`, but devenv's direnv integration runs that entry
89
+ * where its output is not shown. A dangling link is left for the next
90
+ * install to remove.
91
+ */
92
+ export function reportDeveloperLinks(root: string): void {
93
+ describeDeveloperLinks(root, findDeveloperLinks(root).live);
94
+ }
95
+
96
+ /** A package linked from many members is named once, with its count. */
97
+ function describeDeveloperLinks(root: string, links: readonly DeveloperLink[]): void {
98
+ if (links.length === 0) {
99
+ return;
100
+ }
101
+ const counts = new Map<string, number>();
102
+ for (const link of links) {
103
+ const name = link.path.slice(link.path.lastIndexOf('node_modules/') + 'node_modules/'.length);
104
+ const named = `${name} -> ${resolvedTarget(root, link)}`;
105
+ counts.set(named, (counts.get(named) ?? 0) + 1);
106
+ }
107
+ const entries = [...counts].map(([named, count]) => (count === 1 ? named : `${named} (${count} links)`));
108
+ console.error(`linked to local checkouts: ${entries.join(', ')}`);
109
+ }
110
+
111
+ function findDeveloperLinks(root: string): DeveloperLinks {
112
+ const live: DeveloperLink[] = [];
113
+ const dangling: DeveloperLink[] = [];
114
+ for (const tree of nodeModulesTrees(root)) {
115
+ for (const entry of packageLinks(root, tree)) {
116
+ const link: DeveloperLink = { path: entry, target: readlinkSync(path.join(root, entry)) };
117
+ const target = resolvedTarget(root, link);
118
+ const relative = path.relative(root, target);
119
+ if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
120
+ (existsSync(target) ? live : dangling).push(link);
121
+ }
122
+ }
123
+ }
124
+ return { live, dangling };
125
+ }
126
+
127
+ /**
128
+ * The node_modules trees the last install wrote, relative to the root: the
129
+ * root's and each workspace member's, as bun.lock names them. The lockfile,
130
+ * not the manifest's workspace globs, because it is bun's own record of the
131
+ * members it installed. A missing or unreadable lockfile leaves the root's
132
+ * tree alone; the install that follows reports the lockfile in its own words.
133
+ */
134
+ function nodeModulesTrees(root: string): string[] {
135
+ let lock: unknown;
136
+ try {
137
+ lock = Bun.JSONC.parse(readFileSync(path.join(root, 'bun.lock'), 'utf8'));
138
+ } catch {
139
+ return ['node_modules'];
140
+ }
141
+ const workspaces = typeof lock === 'object' && lock !== null ? Reflect.get(lock, 'workspaces') : undefined;
142
+ const members = typeof workspaces === 'object' && workspaces !== null ? Object.keys(workspaces) : [];
143
+ return [...new Set(['', ...members])].map((member) => path.join(member, 'node_modules'));
144
+ }
145
+
146
+ /** Every symlink a package name could be in `tree`: `name` and `@scope/name`. */
147
+ function packageLinks(root: string, tree: string): string[] {
148
+ const links: string[] = [];
149
+ for (const entry of directoryEntries(path.join(root, tree))) {
150
+ if (entry.name.startsWith('.')) {
151
+ continue;
152
+ }
153
+ if (entry.isSymbolicLink()) {
154
+ links.push(path.join(tree, entry.name));
155
+ } else if (entry.name.startsWith('@') && entry.isDirectory()) {
156
+ for (const scoped of directoryEntries(path.join(root, tree, entry.name))) {
157
+ if (scoped.isSymbolicLink()) {
158
+ links.push(path.join(tree, entry.name, scoped.name));
159
+ }
160
+ }
161
+ }
162
+ }
163
+ return links;
164
+ }
165
+
166
+ function directoryEntries(directory: string): Dirent[] {
167
+ try {
168
+ return readdirSync(directory, { withFileTypes: true });
169
+ } catch (error) {
170
+ if (error instanceof Error && 'code' in error && (error.code === 'ENOENT' || error.code === 'ENOTDIR')) {
171
+ return [];
172
+ }
173
+ throw error;
174
+ }
175
+ }
176
+
177
+ function resolvedTarget(root: string, link: DeveloperLink): string {
178
+ return path.resolve(root, path.dirname(link.path), link.target);
179
+ }
180
+
181
+ /** Puts `link` back unless the install left it as it was. */
182
+ function restoreLink(root: string, link: DeveloperLink): void {
183
+ const at = path.join(root, link.path);
184
+ let current: string | null;
185
+ try {
186
+ current = readlinkSync(at);
187
+ } catch {
188
+ // Nothing there, or no link: either way the install replaced it.
189
+ current = null;
190
+ }
191
+ if (current === link.target) {
192
+ return;
193
+ }
194
+ // What the install put there: a link into node_modules/.bun, or, under the
195
+ // hoisted linker, a copied package directory. Removing a link never
196
+ // follows it. The parent is created again for a dependency the install
197
+ // dropped along with its scope directory.
198
+ rmSync(at, { recursive: true, force: true });
199
+ mkdirSync(path.dirname(at), { recursive: true });
200
+ symlinkSync(link.target, at);
201
+ }