@smoothbricks/nx-plugin 0.4.11 → 0.4.13

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 CHANGED
@@ -13,6 +13,21 @@ with `tsconfig.lib.json` receives transformer-aware `tsc-js` and native `typeche
13
13
  - `test:watch` from explicit `test` commands for Bun and Vitest packages
14
14
  - Cargo workspace targets from a neighboring workspace-root `Cargo.toml`
15
15
  - aggregate `build` and `lint` targets
16
+ - an uncached `deploy` for a PRIVATE project with a wrangler manifest, running
17
+ `smoo wrangler deploy-stage --stage {args.stage}`
18
+
19
+ The deploy is one target that takes whichever stage it is given, never a configuration per stage: pull-request stages
20
+ are `prN` for unbounded N, so `nx run <project>:deploy --stage=pr42` has to work for a stage no enumeration could list.
21
+ It is never cached, because a cache hit would mean "we once uploaded this hash", which a rollback falsifies silently.
22
+ Declaring `deploy` locally overrides only the properties it names, so a project adds cross-project ordering with
23
+ `"dependsOn": ["...", "backend:deploy"]` and keeps the inferred command; a project that declares `deploy-build` gets
24
+ that edge instead of `build`, and the plugin caches that half without inventing its command.
25
+
26
+ `private: true` is half the detection, because a wrangler manifest alone does not mean deployable: a published library
27
+ ships one to document the Durable Object binding it implements, and that manifest carries the same `name`, `main` and
28
+ `compatibility_date` a deployable worker's does. So the inferred target goes to packages npm will never publish, and a
29
+ published package that really is deployed declares `deploy` itself. Whether CI deploys any of them is a separate
30
+ question, answered only by the deploy tags the CLI reads (`stage-deploy-target` and its three siblings).
16
31
 
17
32
  Lint commands are inferred per project. A workspace Biome configuration enables the project-wide Biome check; an ESLint
18
33
  flat configuration enables ESLint only for existing JavaScript/TypeScript files under that project's `src`. Rust-only
@@ -90,6 +105,47 @@ Git and registry dependencies are identified by `Cargo.lock`; uncommitted change
90
105
  a pinned Git dependency. Local `path` dependencies stay live and their source edits change the digest. Build-script data
91
106
  and environment inputs outside the Rust/Cargo inputs above still require explicit Nx inputs.
92
107
 
108
+ ### Manifest versions and validation inputs
109
+
110
+ A release rewrites `version` in every package manifest it publishes and in the lockfile entries mirroring them. Those
111
+ files are inputs of `lint`, `typecheck` and `typecheck-tests`, so a publish run misses the cache for the whole gate set
112
+ over a change that alters no code. Those three targets therefore leave the raw manifests out of their filesets and hash
113
+ them by field instead: a `json` input with `excludeFields` for `package.json#version`, and one dropping the lockfile's
114
+ `workspaces` section, which is only the mirror of each member's own manifest. Nx hashes both in its native hasher, so
115
+ this costs no process. Everything else still counts: a dependency range, an export map, and the lockfile's resolution
116
+ table.
117
+
118
+ Crate manifests are the one kind Nx cannot hash by field, because TOML has no such input. The plugin hashes them itself,
119
+ in the process that builds the graph and is already reading them: a single forward scan over the bytes feeds the hasher
120
+ every run it keeps, dropping `[package].version` and the `[workspace.package].version` members inherit and nothing else
121
+ — a `version` naming a _different_ crate under a dependency table stays in the digest, and anything a line-oriented scan
122
+ cannot read (a multi-line string, an unterminated value) is hashed verbatim rather than guessed at. The digest then
123
+ travels as a literal input path that matches no file: Nx hashes a project's `namedInputs` definitions into that
124
+ project's configuration hash, which is part of every task in the project and of every task depending on it, so the value
125
+ reaches the hash with no process at all. Earlier revisions spawned a command per crate project per graph computation;
126
+ that spawn is gone.
127
+
128
+ Targets that produce a shipped artifact keep hashing the raw manifests. A crate embeds its version at compile time
129
+ through `env!("CARGO_PKG_VERSION")`, so a version-insensitive `build`, `pack`, `tsc-js` or cargo hash would let a
130
+ post-bump run hit a pre-bump artifact and publish a binary reporting the previous version.
131
+
132
+ A dependency's manifests are hashed the same way once the workspace declares the named input, which gives projects this
133
+ plugin does not infer a definition to resolve:
134
+
135
+ ```json
136
+ {
137
+ "namedInputs": {
138
+ "versionlessProduction": ["production"]
139
+ }
140
+ }
141
+ ```
142
+
143
+ Without it the dependency half stays `^production`. On an Nx older than 23.2, which rejects a `json` input rather than
144
+ ignoring it, the targets keep today's inputs entirely; the same is true of crate manifests when the command is not
145
+ installed. Every fallback costs cache hits and never trades away invalidation, because Nx runs a `runtime` input without
146
+ reporting a failing one — a fileset that excluded a manifest with no digest replacing it would serve stale results
147
+ silently.
148
+
93
149
  ## Nx Target Naming
94
150
 
95
151
  Target names are `{tool}-{output}` names. Use names like `tsc-js`, `tsdown-js`, and `cargo-wasm`; `build` and `lint` are
@@ -80,6 +80,41 @@ export declare const CARGO_TEST_ARCHIVE_TARGET = "cargo-test-archive";
80
80
  * target mkdir's it first.
81
81
  */
82
82
  export declare const CARGO_TEST_ARCHIVE_FILE = "target/nextest/archive.tar.zst";
83
+ /**
84
+ * One foreign target triple this cargo workspace also archives its tests for.
85
+ */
86
+ export interface CargoCrossTestTarget {
87
+ target: string;
88
+ /**
89
+ * The repository's own cargo driver for this triple, relative to the cargo
90
+ * workspace root — a program that accepts cargo's argv and links for the
91
+ * target. Exported to the archive command as `CARGO`, which is cargo's own
92
+ * driver variable and the only seam nextest offers: nextest shells out to
93
+ * `$CARGO metadata` and `$CARGO test --no-run --target <triple>` (measured),
94
+ * so a repository whose cross link needs zig, an SDK or a sysroot puts that
95
+ * knowledge in one script instead of in the generated command.
96
+ *
97
+ * Absent means the ambient toolchain already links the triple.
98
+ */
99
+ cargo?: string;
100
+ }
101
+ /**
102
+ * Foreign target triples this cargo workspace archives tests for, from
103
+ * `[workspace.metadata.smoothbricks.test] cross-targets`. An entry is either
104
+ * the triple as a string, or a table adding that triple's cargo driver:
105
+ *
106
+ * ```toml
107
+ * [workspace.metadata.smoothbricks.test]
108
+ * cross-targets = [{ target = "aarch64-apple-darwin", cargo = "scripts/cargo-for-nextest.sh" }]
109
+ * ```
110
+ *
111
+ * The DECLARATION lives in Cargo.toml rather than in a CI config because a
112
+ * Rust target triple is a cargo fact: the same list decides which archives the
113
+ * graph can produce whether or not anything is running CI, and it is read from
114
+ * the same manifest `shards` comes out of, beside it in the same
115
+ * `smoothbricks.test` table, with the parser this module already uses.
116
+ */
117
+ export declare function listCargoCrossTestTargets(absoluteProjectRoot: string): CargoCrossTestTarget[];
83
118
  /**
84
119
  * Tests that nextest.toml singles out are pinned to this suffix instead of
85
120
  * being sharded. Only a sharded crate has one: an unsharded crate runs its
@@ -1 +1 @@
1
- {"version":3,"file":"cargo-workspace.d.ts","sourceRoot":"","sources":["../src/cargo-workspace.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/D,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,+BAAgC,SAAQ,qBAAqB;IAC5E,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,0BAA0B,CAAC,mBAAmB,EAAE,MAAM,GAAG,qBAAqB,EAAE,CAkF/F;AA0ED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,SAAS,qBAAqB,EAAE,EAC1C,QAAQ,EAAE,SAAS,qBAAqB,EAAE,GACzC,+BAA+B,EAAE,CAgBnC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,uBAAuB,CAAC;AAE/D,MAAM,WAAW,6BAA6B;IAC5C,oEAAoE;IACpE,aAAa,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,eAAe,EAAE,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sB,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQhG;AA6VD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAE9C,wEAAwE;AACxE,eAAO,MAAM,yBAAyB,uBAAuB,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,uBAAuB,CAAC;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,mCAAmC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CAAC,mBAAmB,EAAE,MAAM,GAAG,oBAAoB,EAAE,CA8C7F;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,eAAe,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAGtF;AAED;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYhF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoB9E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAI1G;AAED,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,yBAAyB,CAAC"}
@@ -500,6 +500,65 @@ export const CARGO_TEST_ARCHIVE_TARGET = 'cargo-test-archive';
500
500
  * target mkdir's it first.
501
501
  */
502
502
  export const CARGO_TEST_ARCHIVE_FILE = 'target/nextest/archive.tar.zst';
503
+ /**
504
+ * Foreign target triples this cargo workspace archives tests for, from
505
+ * `[workspace.metadata.smoothbricks.test] cross-targets`. An entry is either
506
+ * the triple as a string, or a table adding that triple's cargo driver:
507
+ *
508
+ * ```toml
509
+ * [workspace.metadata.smoothbricks.test]
510
+ * cross-targets = [{ target = "aarch64-apple-darwin", cargo = "scripts/cargo-for-nextest.sh" }]
511
+ * ```
512
+ *
513
+ * The DECLARATION lives in Cargo.toml rather than in a CI config because a
514
+ * Rust target triple is a cargo fact: the same list decides which archives the
515
+ * graph can produce whether or not anything is running CI, and it is read from
516
+ * the same manifest `shards` comes out of, beside it in the same
517
+ * `smoothbricks.test` table, with the parser this module already uses.
518
+ */
519
+ export function listCargoCrossTestTargets(absoluteProjectRoot) {
520
+ const workspaceTomlPath = join(absoluteProjectRoot, 'Cargo.toml');
521
+ if (!existsSync(workspaceTomlPath)) {
522
+ return [];
523
+ }
524
+ const parsed = parseToml(readFileSync(workspaceTomlPath, 'utf-8'));
525
+ if (!isRecord(parsed) || !isRecord(parsed.workspace)) {
526
+ return [];
527
+ }
528
+ const metadata = isRecord(parsed.workspace.metadata) ? parsed.workspace.metadata : null;
529
+ const smoothbricks = metadata && isRecord(metadata.smoothbricks) ? metadata.smoothbricks : null;
530
+ const test = smoothbricks && isRecord(smoothbricks.test) ? smoothbricks.test : null;
531
+ const declared = test?.['cross-targets'];
532
+ if (declared === undefined) {
533
+ return [];
534
+ }
535
+ if (!Array.isArray(declared)) {
536
+ throw new Error(`${workspaceTomlPath}: smoothbricks.test.cross-targets must be an array of target triples`);
537
+ }
538
+ const crossTargets = [];
539
+ for (const entry of declared) {
540
+ const target = typeof entry === 'string' ? entry : isRecord(entry) ? entry.target : undefined;
541
+ // A triple becomes an Nx target NAME and an archive FILE name, so anything
542
+ // a shell or Nx would have to quote is refused where it is declared rather
543
+ // than emitted into a command.
544
+ if (typeof target !== 'string' || !/^[a-z0-9][a-z0-9._-]*$/.test(target)) {
545
+ throw new Error(`${workspaceTomlPath}: smoothbricks.test.cross-targets entries must be target triples like ` +
546
+ `"aarch64-apple-darwin", got ${JSON.stringify(entry)}`);
547
+ }
548
+ const cargo = isRecord(entry) ? entry.cargo : undefined;
549
+ // The driver is an input of every archive built through it, so it has to be
550
+ // a path inside this workspace rather than a command line: `{projectRoot}/`
551
+ // plus this string is what makes editing it invalidate the archive.
552
+ if (cargo !== undefined && (typeof cargo !== 'string' || cargo.length === 0 || !/^[\w./-]+$/.test(cargo))) {
553
+ throw new Error(`${workspaceTomlPath}: smoothbricks.test.cross-targets ${target} cargo must be a path inside the ` +
554
+ `cargo workspace, got ${JSON.stringify(cargo)}`);
555
+ }
556
+ if (!crossTargets.some((existing) => existing.target === target)) {
557
+ crossTargets.push(cargo === undefined ? { target } : { target, cargo });
558
+ }
559
+ }
560
+ return crossTargets;
561
+ }
503
562
  /**
504
563
  * Tests that nextest.toml singles out are pinned to this suffix instead of
505
564
  * being sharded. Only a sharded crate has one: an unsharded crate runs its
@@ -112,8 +112,54 @@ export declare const CROSS_CHECK_SCRIPT_NAME = "check:linux";
112
112
  /**
113
113
  * The developer entry point: one command on macOS that reports what CI's Linux
114
114
  * job would. `tooling/devenv` is the managed wrapper, so this resolves the
115
- * repository's devenv config from any repo in the fleet without naming its path,
116
- * and `--quiet` keeps the output to Nx's own.
115
+ * repository's devenv config from any repo in the fleet without naming its path.
116
+ *
117
+ * Deliberately NOT `--quiet`. The pre-push gate is a probe: it consults the Nx
118
+ * cache and refuses a push that has no hit, never entering a profile or starting
119
+ * a compile of its own. That makes this script the only place the gate ever
120
+ * runs, and a human watching it needs devenv's progress too — the cross profile
121
+ * is a 0.4 GiB closure and the clippy behind it is unbounded, so a silent
122
+ * terminal is indistinguishable from a hang. Suppressing that output only paid
123
+ * while a hook ran this for you and nobody read it.
124
+ */
125
+ export declare const CROSS_CHECK_SCRIPT_COMMAND = "tooling/devenv -P linux-cross shell -- nx run-many -t cargo-lint-cross";
126
+ /**
127
+ * A cross-built test archive and the target that EXECUTES it, per foreign
128
+ * target triple the cargo workspace declares in
129
+ * `[workspace.metadata.smoothbricks.test] cross-targets`.
130
+ *
131
+ * TWO names because the halves run on two machines. `cargo-lint-cross` above
132
+ * type-checks foreign code and states outright that a cross TEST target could
133
+ * only build a harness it must then refuse to launch — that is still true of
134
+ * one machine. It stops being true across two: the triple's archive is built
135
+ * where the cross toolchain is, shipped, and executed where those binaries are
136
+ * native, which is the only arrangement in which a cross compile is proved by
137
+ * running rather than by linking.
138
+ *
139
+ * `cargo-cross-test-` and not `cargo-test-`: `packageNameFromCargoTestTarget`
140
+ * reads everything under that prefix as a crate, so a triple there would invent
141
+ * a workspace member named `aarch64-apple-darwin` and make the per-crate
142
+ * coverage policy unsatisfiable. The `-cross` qualifier is the same neutral one
143
+ * `CARGO_CROSS_LINT_TARGET` carries, and for the same reason: it stays outside
144
+ * every platform-suffix and build-output family, so no aggregate sweeps a
145
+ * foreign archive into `build`.
146
+ *
147
+ * These names live here rather than beside the Cargo.toml reader because the
148
+ * workflow generator renders jobs from them: the CLI already imports this
149
+ * module, and a second spelling of the convention on that side would drift
150
+ * silently the first time either half changed.
151
+ */
152
+ export declare function cargoCrossTestArchiveTargetName(triple: string): string;
153
+ /** The bounded runner that executes one triple's archive. */
154
+ export declare function cargoCrossTestTargetName(triple: string): string;
155
+ /**
156
+ * One archive file per triple, beside the host-native
157
+ * `CARGO_TEST_ARCHIVE_FILE`, relative to the cargo workspace root. Distinct
158
+ * paths are what let both exist: each is a declared Nx output, so a single path
159
+ * for two triples would let a restored cache serve one machine's binaries under
160
+ * the other's name.
117
161
  */
118
- export declare const CROSS_CHECK_SCRIPT_COMMAND = "tooling/devenv --quiet -P linux-cross shell -- nx run-many -t cargo-lint-cross";
162
+ export declare function cargoCrossTestArchiveFile(triple: string): string;
163
+ /** Inverse of `cargoCrossTestArchiveTargetName`; null for every other target. */
164
+ export declare function cargoCrossTestTripleFromArchiveTarget(targetName: string): string | null;
119
165
  //# sourceMappingURL=cross-check-policy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cross-check-policy.d.ts","sourceRoot":"","sources":["../src/cross-check-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAI1D;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,yBAAyB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,wBAAwB,QAElC,CAAC;AAEJ,eAAO,MAAM,yBAAyB,QAErC,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,mFAAyG,CAAC"}
1
+ {"version":3,"file":"cross-check-policy.d.ts","sourceRoot":"","sources":["../src/cross-check-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAI1D;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,yBAAyB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,wBAAwB,QAElC,CAAC;AAEJ,eAAO,MAAM,yBAAyB,QAErC,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,2EAAiG,CAAC;AAEzI;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhE;AAID,iFAAiF;AACjF,wBAAgB,qCAAqC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKvF"}
@@ -115,7 +115,65 @@ export const CROSS_CHECK_SCRIPT_NAME = 'check:linux';
115
115
  /**
116
116
  * The developer entry point: one command on macOS that reports what CI's Linux
117
117
  * job would. `tooling/devenv` is the managed wrapper, so this resolves the
118
- * repository's devenv config from any repo in the fleet without naming its path,
119
- * and `--quiet` keeps the output to Nx's own.
118
+ * repository's devenv config from any repo in the fleet without naming its path.
119
+ *
120
+ * Deliberately NOT `--quiet`. The pre-push gate is a probe: it consults the Nx
121
+ * cache and refuses a push that has no hit, never entering a profile or starting
122
+ * a compile of its own. That makes this script the only place the gate ever
123
+ * runs, and a human watching it needs devenv's progress too — the cross profile
124
+ * is a 0.4 GiB closure and the clippy behind it is unbounded, so a silent
125
+ * terminal is indistinguishable from a hang. Suppressing that output only paid
126
+ * while a hook ran this for you and nobody read it.
127
+ */
128
+ export const CROSS_CHECK_SCRIPT_COMMAND = `tooling/devenv -P ${DEVENV_CROSS_PROFILE} shell -- nx run-many -t ${CARGO_CROSS_LINT_TARGET}`;
129
+ /**
130
+ * A cross-built test archive and the target that EXECUTES it, per foreign
131
+ * target triple the cargo workspace declares in
132
+ * `[workspace.metadata.smoothbricks.test] cross-targets`.
133
+ *
134
+ * TWO names because the halves run on two machines. `cargo-lint-cross` above
135
+ * type-checks foreign code and states outright that a cross TEST target could
136
+ * only build a harness it must then refuse to launch — that is still true of
137
+ * one machine. It stops being true across two: the triple's archive is built
138
+ * where the cross toolchain is, shipped, and executed where those binaries are
139
+ * native, which is the only arrangement in which a cross compile is proved by
140
+ * running rather than by linking.
141
+ *
142
+ * `cargo-cross-test-` and not `cargo-test-`: `packageNameFromCargoTestTarget`
143
+ * reads everything under that prefix as a crate, so a triple there would invent
144
+ * a workspace member named `aarch64-apple-darwin` and make the per-crate
145
+ * coverage policy unsatisfiable. The `-cross` qualifier is the same neutral one
146
+ * `CARGO_CROSS_LINT_TARGET` carries, and for the same reason: it stays outside
147
+ * every platform-suffix and build-output family, so no aggregate sweeps a
148
+ * foreign archive into `build`.
149
+ *
150
+ * These names live here rather than beside the Cargo.toml reader because the
151
+ * workflow generator renders jobs from them: the CLI already imports this
152
+ * module, and a second spelling of the convention on that side would drift
153
+ * silently the first time either half changed.
120
154
  */
121
- export const CROSS_CHECK_SCRIPT_COMMAND = `tooling/devenv --quiet -P ${DEVENV_CROSS_PROFILE} shell -- nx run-many -t ${CARGO_CROSS_LINT_TARGET}`;
155
+ export function cargoCrossTestArchiveTargetName(triple) {
156
+ return `cargo-cross-test-archive-${triple}`;
157
+ }
158
+ /** The bounded runner that executes one triple's archive. */
159
+ export function cargoCrossTestTargetName(triple) {
160
+ return `cargo-cross-test-${triple}`;
161
+ }
162
+ /**
163
+ * One archive file per triple, beside the host-native
164
+ * `CARGO_TEST_ARCHIVE_FILE`, relative to the cargo workspace root. Distinct
165
+ * paths are what let both exist: each is a declared Nx output, so a single path
166
+ * for two triples would let a restored cache serve one machine's binaries under
167
+ * the other's name.
168
+ */
169
+ export function cargoCrossTestArchiveFile(triple) {
170
+ return `target/nextest/archive-${triple}.tar.zst`;
171
+ }
172
+ const CARGO_CROSS_TEST_ARCHIVE_PREFIX = cargoCrossTestArchiveTargetName('');
173
+ /** Inverse of `cargoCrossTestArchiveTargetName`; null for every other target. */
174
+ export function cargoCrossTestTripleFromArchiveTarget(targetName) {
175
+ return targetName.startsWith(CARGO_CROSS_TEST_ARCHIVE_PREFIX) &&
176
+ targetName.length > CARGO_CROSS_TEST_ARCHIVE_PREFIX.length
177
+ ? targetName.slice(CARGO_CROSS_TEST_ARCHIVE_PREFIX.length)
178
+ : null;
179
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAKL,yBAAyB,EAW1B,MAAM,sBAAsB,CAAC;AAa9B,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAErC,gEAAgE;AAChE,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAmDlD,KAAK,gBAAgB,GAAG,OAAO,GAAG,KAAK,CAAC;AACxC,KAAK,gBAAgB,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1C,UAAU,YAAY;IACpB,YAAY,EAAE,gBAAgB,CAAC;IAC/B,YAAY,EAAE,gBAAgB,CAAC;CAChC;AA8HD,UAAU,oBAAqB,SAAQ,YAAY;IACjD,UAAU,EAAE,MAAM,CAAC;CACpB;AA0CD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,oBAAoB,GAAG,MAAM,CAEhF;AA+KD,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ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