@smoothbricks/nx-plugin 0.7.17 → 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.
Files changed (102) hide show
  1. package/README.md +204 -64
  2. package/dist/.build-inputs.json +24 -21
  3. package/dist/bun-lock-scope.d.ts +128 -20
  4. package/dist/bun-lock-scope.d.ts.map +1 -1
  5. package/dist/bun-lock-scope.js +267 -44
  6. package/dist/cargo-closure-input.d.ts +8 -6
  7. package/dist/cargo-closure-input.d.ts.map +1 -1
  8. package/dist/cargo-closure-input.js +14 -11
  9. package/dist/cargo-source-hash.d.ts +23 -4
  10. package/dist/cargo-source-hash.d.ts.map +1 -1
  11. package/dist/cargo-source-hash.js +80 -14
  12. package/dist/cargo-workspace.d.ts +20 -2
  13. package/dist/cargo-workspace.d.ts.map +1 -1
  14. package/dist/cargo-workspace.js +42 -22
  15. package/dist/ensure-built-receipt.d.ts +3 -2
  16. package/dist/ensure-built-receipt.d.ts.map +1 -1
  17. package/dist/ensure-built-receipt.js +3 -2
  18. package/dist/eslint-config-closure.d.ts +8 -3
  19. package/dist/eslint-config-closure.d.ts.map +1 -1
  20. package/dist/eslint-config-closure.js +24 -5
  21. package/dist/executors/bounded-exec/bounds.d.ts +12 -1
  22. package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
  23. package/dist/executors/bounded-exec/bounds.js +8 -4
  24. package/dist/executors/bounded-exec/cpu-rise.d.ts +73 -0
  25. package/dist/executors/bounded-exec/cpu-rise.d.ts.map +1 -0
  26. package/dist/executors/bounded-exec/cpu-rise.js +111 -0
  27. package/dist/executors/bounded-exec/executor.d.ts +1 -1
  28. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  29. package/dist/executors/bounded-exec/executor.js +54 -22
  30. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +8 -0
  31. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
  32. package/dist/executors/bounded-exec/hang-diagnostics.js +66 -6
  33. package/dist/executors/bounded-exec/mbx-pool.d.ts +16 -2
  34. package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
  35. package/dist/executors/bounded-exec/mbx-pool.js +18 -2
  36. package/dist/executors/bounded-exec/mbx-reservations.d.ts +5 -2
  37. package/dist/executors/bounded-exec/mbx-reservations.d.ts.map +1 -1
  38. package/dist/executors/bounded-exec/mbx-reservations.js +5 -3
  39. package/dist/executors/bounded-exec/progress-channel.d.ts +38 -0
  40. package/dist/executors/bounded-exec/progress-channel.d.ts.map +1 -0
  41. package/dist/executors/bounded-exec/progress-channel.js +113 -0
  42. package/dist/executors/bounded-exec/progress.d.ts +2 -1
  43. package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
  44. package/dist/executors/bounded-exec/ram-temp.d.ts +24 -1
  45. package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
  46. package/dist/executors/bounded-exec/ram-temp.js +123 -16
  47. package/dist/executors/bounded-exec/schema.d.ts +5 -0
  48. package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
  49. package/dist/executors/bounded-exec/schema.js +17 -1
  50. package/dist/executors/bounded-exec/verdict.d.ts +13 -6
  51. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  52. package/dist/executors/bounded-exec/verdict.js +34 -9
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +199 -89
  55. package/dist/managed-files/generator.d.ts +5 -1
  56. package/dist/managed-files/generator.d.ts.map +1 -1
  57. package/dist/managed-files/generator.js +22 -7
  58. package/dist/managed-files/render-memo.d.ts +13 -0
  59. package/dist/managed-files/render-memo.d.ts.map +1 -0
  60. package/dist/managed-files/render-memo.js +94 -0
  61. package/dist/test-program.d.ts +11 -6
  62. package/dist/test-program.d.ts.map +1 -1
  63. package/dist/test-program.js +39 -35
  64. package/dist/tool-bins.d.ts +12 -0
  65. package/dist/tool-bins.d.ts.map +1 -1
  66. package/dist/tool-bins.js +31 -6
  67. package/dist/typecheck-test-policy.d.ts +10 -1
  68. package/dist/typecheck-test-policy.d.ts.map +1 -1
  69. package/dist/typecheck-test-policy.js +40 -24
  70. package/dist/workspace-index.d.ts +14 -1
  71. package/dist/workspace-index.d.ts.map +1 -1
  72. package/dist/workspace-index.js +36 -4
  73. package/managed/raw/patches/nx@24.0.3.patch +703 -119
  74. package/managed/raw/tooling/direnv/developer-links.ts +17 -3
  75. package/managed/templates/github/actions/save-nix-devenv/action.yml +19 -1
  76. package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
  77. package/package.json +3 -2
  78. package/src/bun-lock-scope.ts +293 -40
  79. package/src/cargo-closure-input.ts +19 -11
  80. package/src/cargo-source-hash.ts +103 -13
  81. package/src/cargo-workspace.ts +59 -20
  82. package/src/ensure-built-receipt.ts +3 -2
  83. package/src/eslint-config-closure.ts +27 -6
  84. package/src/executors/bounded-exec/bounds.ts +13 -4
  85. package/src/executors/bounded-exec/cpu-rise.ts +156 -0
  86. package/src/executors/bounded-exec/executor.ts +65 -21
  87. package/src/executors/bounded-exec/hang-diagnostics.ts +88 -6
  88. package/src/executors/bounded-exec/mbx-pool.ts +24 -3
  89. package/src/executors/bounded-exec/mbx-reservations.ts +7 -5
  90. package/src/executors/bounded-exec/progress-channel.ts +129 -0
  91. package/src/executors/bounded-exec/progress.ts +2 -1
  92. package/src/executors/bounded-exec/ram-temp.ts +137 -17
  93. package/src/executors/bounded-exec/schema.ts +19 -0
  94. package/src/executors/bounded-exec/verdict.ts +44 -16
  95. package/src/index.ts +255 -98
  96. package/src/managed-files/generator.ts +21 -6
  97. package/src/managed-files/render-memo.ts +135 -0
  98. package/src/test-program.ts +36 -41
  99. package/src/tool-bins.ts +35 -6
  100. package/src/typecheck-test-policy.ts +49 -24
  101. package/src/workspace-index.ts +40 -5
  102. package/test-timings.json +6 -0
@@ -2,9 +2,9 @@ import { createHash } from 'node:crypto';
2
2
  import { realpath } from 'node:fs/promises';
3
3
  import { isAbsolute, join, posix, relative, sep } from 'node:path';
4
4
  import { CARGO_ANCESTOR_INPUTS } from '@smoothbricks/cargo-retain/cargo-ancestor-inputs';
5
- import { compiledInFiles, dependencyClosure, HASH_SKIPPED_DIRECTORIES, readCargoResolve, } from './cargo-source-hash.js';
5
+ import { cargoSourceIndex, compiledInFiles, dependencyClosure, HASH_SKIPPED_DIRECTORIES, readCargoResolve, retainIncludeScans, } from './cargo-source-hash.js';
6
6
  import { runtimeInput, shellWord } from './runtime-input.js';
7
- import { globIndexedFiles } from './workspace-index.js';
7
+ import { globIndexedFiles, indexedFileData } from './workspace-index.js';
8
8
  /**
9
9
  * The named input the plugin infers for every project with crates of a Cargo
10
10
  * workspace under its root: the mutable sources of the Cargo-resolved
@@ -51,12 +51,15 @@ const SKIPPED_TREES = `**/{${HASH_SKIPPED_DIRECTORIES.join(',')}}/**`;
51
51
  /** A path holding any of these would be read as a pattern, not as itself. */
52
52
  const GLOB_SYNTAX = /[*?[\]{}()!,]/;
53
53
  /**
54
- * Every `Cargo.toml` Nx's workspace file index holds: .gitignore and .nxignore
55
- * applied, `node_modules` never entered. A package whose manifest is missing
56
- * here has no files a fileset input can hash.
54
+ * The Cargo manifests and Rust sources of Nx's workspace file index, with Nx's content hash of each source:
55
+ * .gitignore and .nxignore applied, `node_modules` never entered. A package whose manifest is missing here has no
56
+ * files a fileset input can hash. Scans of source texts no longer indexed are forgotten here.
57
57
  */
58
- export async function indexedCargoManifests(workspaceRoot) {
59
- return new Set(await globIndexedFiles(workspaceRoot, ['**/Cargo.toml']));
58
+ export async function indexedCargoSources(workspaceRoot) {
59
+ const [root, files] = await Promise.all([realpath(workspaceRoot), indexedFileData(workspaceRoot)]);
60
+ const index = cargoSourceIndex(root, files);
61
+ retainIncludeScans(index);
62
+ return index;
60
63
  }
61
64
  /**
62
65
  * Content-keyed locked offline metadata. A refusal fails graph inference:
@@ -64,9 +67,9 @@ export async function indexedCargoManifests(workspaceRoot) {
64
67
  * precise set of cache inputs.
65
68
  */
66
69
  export async function resolveCargoClosureSource(manifest, workspaceRoot, indexed, compiledFilesCache) {
67
- const [root, index] = await Promise.all([realpath(workspaceRoot), indexed]);
68
- const cargo = await readCargoResolve(join(root, manifest), root, index);
69
- return { manifest, workspaceRoot, root, cargo, indexed: index, compiledFilesCache };
70
+ const [root, sources] = await Promise.all([realpath(workspaceRoot), indexed]);
71
+ const cargo = await readCargoResolve(join(root, manifest), root, sources.manifests);
72
+ return { manifest, workspaceRoot, root, cargo, indexed: sources.manifests, sources, compiledFilesCache };
70
73
  }
71
74
  /**
72
75
  * The `cargoClosure` definition for the project at `projectRoot`: for each
@@ -135,7 +138,7 @@ async function workspaceClosureInputs(projectRoot, source) {
135
138
  if (!indexed.has(posix.join(directory, 'Cargo.toml'))) {
136
139
  throw new Error(`the Cargo package ${directory} is not in Nx's file index (an ignored directory)`);
137
140
  }
138
- for (const compiled of compiledInFiles(pkg.directory, source.compiledFilesCache)) {
141
+ for (const compiled of compiledInFiles(pkg.directory, source.sources, source.compiledFilesCache)) {
139
142
  const file = indexablePath(root, compiled.file);
140
143
  if (file === null)
141
144
  throw new Error(`${directory} compiles ${compiled.file}, which Nx's file index cannot hold`);
@@ -1,3 +1,4 @@
1
+ import { type FileData } from 'nx/src/native/index.js';
1
2
  /** One resolved dependency of a package: the package it resolved to, and whether every declaration of it is a dev one. */
2
3
  export interface CargoEdge {
3
4
  readonly pkg: string;
@@ -100,9 +101,27 @@ export interface CompiledCargoInput {
100
101
  readonly literal: string;
101
102
  }
102
103
  /**
103
- * Existing literal include_str!/include_bytes! files read by this package's Rust sources.
104
- * One graph owns the memo; runtime hashing consumes the same discovery alongside source
105
- * bytes. Nested packages own their sources separately. Computed paths remain explicit inputs.
104
+ * The Rust sources and Cargo packages of Nx's workspace file index (.gitignore and .nxignore applied, as for every
105
+ * fileset input), canonical and absolute. A graph computation takes a package's sources and nested packages from
106
+ * here, so it lists no directory and probes no path for a manifest.
106
107
  */
107
- export declare function compiledInFiles(root: string, cache: Map<string, CompiledCargoInput[]>): CompiledCargoInput[];
108
+ export interface CargoSourceIndex {
109
+ /** Every `Cargo.toml` in the index, relative to the workspace root. */
110
+ readonly manifests: ReadonlySet<string>;
111
+ /** Every directory holding an indexed `Cargo.toml`. */
112
+ readonly packageDirectories: ReadonlySet<string>;
113
+ /** Nx's content hash of every indexed `.rs` file. */
114
+ readonly rustSources: ReadonlyMap<string, string>;
115
+ }
116
+ /** {@link CargoSourceIndex} of Nx's file data (workspace-relative paths and content hashes) under the canonical `root`. */
117
+ export declare function cargoSourceIndex(root: string, files: Iterable<FileData>): CargoSourceIndex;
118
+ /** Forgets the scan of every source text `index` no longer holds. */
119
+ export declare function retainIncludeScans(index: CargoSourceIndex): void;
120
+ /**
121
+ * Existing literal include_str!/include_bytes! files read by this package's Rust sources, as Nx's file index holds
122
+ * them: a generated (ignored) source is its producer's output and keys a consumer through its dependency outputs.
123
+ * One graph owns the memo; runtime hashing consumes the same discovery alongside source bytes. Nested packages own
124
+ * their sources separately. Computed paths remain explicit inputs.
125
+ */
126
+ export declare function compiledInFiles(root: string, index: CargoSourceIndex, cache: Map<string, CompiledCargoInput[]>): CompiledCargoInput[];
108
127
  //# sourceMappingURL=cargo-source-hash.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cargo-source-hash.d.ts","sourceRoot":"","sources":["../src/cargo-source-hash.ts"],"names":[],"mappings":"AAgHA,0HAA0H;AAC1H,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yFAAyF;IACzF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,iHAAiH;AACjH,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;AAElE,mFAAmF;AACnF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC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,qEAAqE;AACrE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAGhE;AAyBD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC,GACvC,kBAAkB,EAAE,CAYtB"}
@@ -5,14 +5,14 @@ import { accessSync, constants, existsSync, readdirSync, readFileSync, realpathS
5
5
  import { lstat, mkdir, readdir, readFile, readlink, realpath, rename, rm, stat, writeFile } from 'node:fs/promises';
6
6
  import { createRequire } from 'node:module';
7
7
  import { homedir } from 'node:os';
8
- import { delimiter, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
8
+ import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
9
9
  import { CARGO_ANCESTOR_INPUTS } from '@smoothbricks/cargo-retain/cargo-ancestor-inputs';
10
10
  import native from 'nx/src/native/index.js';
11
11
  import { workspaceDataDirectoryForWorkspace } from 'nx/src/utils/cache-directory.js';
12
12
  import { CARGO_TOOLCHAIN_PIN_INPUTS } from './cargo-toolchain-policy.js';
13
13
  import { describeTeardown, killProcessGroupNow, TEARDOWN_PATIENCE } from './process-group.js';
14
14
  import { rustTokens } from './rust-tokens.js';
15
- const { IS_WASM, WorkspaceContext } = native;
15
+ const { IS_WASM, WorkspaceContext, hashArray } = native;
16
16
  const cargoResolveEvents = channel('@smoothbricks/nx-plugin:cargo-resolve');
17
17
  /**
18
18
  * Narrowed field by field, not by typia: graph inference imports this module,
@@ -867,7 +867,7 @@ export async function hashCargoPathInputs(manifestPath, workspaceRoot, options)
867
867
  const scan = scans.get(input.file);
868
868
  if (scan !== undefined) {
869
869
  scans.delete(input.file);
870
- collectCompiledInputs(input.file, bytes.toString('utf8'), scan.found);
870
+ collectCompiledInputs(input.file, includeSpellings(bytes.toString('utf8')), scan.found);
871
871
  }
872
872
  hash.update(input.key);
873
873
  hash.update('\0');
@@ -890,7 +890,7 @@ export async function hashCargoPathInputs(manifestPath, workspaceRoot, options)
890
890
  continue;
891
891
  // Discovery also visits ignored sources. They have no scheduled identity;
892
892
  // if an include alias later names one, preserve the old read-then-hash path.
893
- collectCompiledInputs(source, readFileSync(source, 'utf8'), scan.found);
893
+ collectCompiledInputs(source, includeSpellings(readFileSync(source, 'utf8')), scan.found);
894
894
  }
895
895
  for (const input of [...scan.found.values()].sort((left, right) => left.file < right.file ? -1 : left.file > right.file ? 1 : 0)) {
896
896
  if (ignored(input.file))
@@ -1065,9 +1065,13 @@ function* compiledSourceFiles(root) {
1065
1065
  }
1066
1066
  }
1067
1067
  }
1068
- function collectCompiledInputs(source, text, found) {
1068
+ /** What a source with no include spells. */
1069
+ const NO_SPELLINGS = [];
1070
+ /** The paths a Rust source's text spells as literal include_str!/include_bytes! arguments. */
1071
+ function includeSpellings(text) {
1069
1072
  if (!text.includes('include_'))
1070
- return;
1073
+ return NO_SPELLINGS;
1074
+ const spellings = [];
1071
1075
  const tokens = rustTokens(text);
1072
1076
  for (let index = 0; index < tokens.length; index += 1) {
1073
1077
  if (tokens[index]?.text !== 'include_str' && tokens[index]?.text !== 'include_bytes')
@@ -1082,8 +1086,14 @@ function collectCompiledInputs(source, text, found) {
1082
1086
  // must reference path-sized storage, not a view into the decoded source.
1083
1087
  const literal = Buffer.from(tokens[index + 3]?.text ?? '', 'utf8').toString('utf8');
1084
1088
  const path = INCLUDE_STRING.exec(literal)?.[1] ?? INCLUDE_RAW_STRING.exec(literal)?.[2];
1085
- if (path === undefined || path === '')
1086
- continue;
1089
+ if (path !== undefined && path !== '')
1090
+ spellings.push(path);
1091
+ }
1092
+ return spellings;
1093
+ }
1094
+ /** Records each existing file `source` spells, keeping the smallest declaring source and spelling per file. */
1095
+ function collectCompiledInputs(source, spellings, found) {
1096
+ for (const path of spellings) {
1087
1097
  const file = resolve(dirname(source), path);
1088
1098
  if (statSync(file, { throwIfNoEntry: false })?.isFile()) {
1089
1099
  const prior = found.get(file);
@@ -1093,18 +1103,74 @@ function collectCompiledInputs(source, text, found) {
1093
1103
  }
1094
1104
  }
1095
1105
  }
1106
+ /** {@link CargoSourceIndex} of Nx's file data (workspace-relative paths and content hashes) under the canonical `root`. */
1107
+ export function cargoSourceIndex(root, files) {
1108
+ const manifests = new Set();
1109
+ const packageDirectories = new Set();
1110
+ const rustSources = new Map();
1111
+ for (const { file, hash } of files) {
1112
+ if (file === 'Cargo.toml' || file.endsWith('/Cargo.toml')) {
1113
+ manifests.add(file);
1114
+ packageDirectories.add(dirname(join(root, file)));
1115
+ }
1116
+ else if (file.endsWith('.rs')) {
1117
+ rustSources.set(join(root, file), hash);
1118
+ }
1119
+ }
1120
+ return { manifests, packageDirectories, rustSources };
1121
+ }
1096
1122
  /**
1097
- * Existing literal include_str!/include_bytes! files read by this package's Rust sources.
1098
- * One graph owns the memo; runtime hashing consumes the same discovery alongside source
1099
- * bytes. Nested packages own their sources separately. Computed paths remain explicit inputs.
1123
+ * The include spellings of every Rust source text scanned, by Nx's content hash of that text: a source whose hash is
1124
+ * unchanged is not read again. An entry is kept only when the text read hashes to that hash, so a write Nx's index has
1125
+ * not seen yet is scanned but never remembered under the hash of the bytes it replaced. Entries leave when no index
1126
+ * holds their hash any longer ({@link retainIncludeScans}); nothing expires by time.
1100
1127
  */
1101
- export function compiledInFiles(root, cache) {
1128
+ const includeScans = new Map();
1129
+ /** Forgets the scan of every source text `index` no longer holds. */
1130
+ export function retainIncludeScans(index) {
1131
+ const held = new Set(index.rustSources.values());
1132
+ for (const hash of includeScans.keys())
1133
+ if (!held.has(hash))
1134
+ includeScans.delete(hash);
1135
+ }
1136
+ function includeSpellingsOf(source, hash) {
1137
+ const known = includeScans.get(hash);
1138
+ if (known !== undefined)
1139
+ return known;
1140
+ const text = readFileSync(source, 'utf8');
1141
+ const spellings = includeSpellings(text);
1142
+ if (hashArray([text]) === hash)
1143
+ includeScans.set(hash, spellings);
1144
+ return spellings;
1145
+ }
1146
+ const SCAN_SKIPPED = new Set(HASH_SKIPPED_DIRECTORIES);
1147
+ /** The indexed Rust sources of the package at `root`, with their hashes: none beneath a nested package or a skipped directory. */
1148
+ function* packageRustSources(root, index) {
1149
+ const prefix = `${root}${sep}`;
1150
+ sources: for (const [source, hash] of index.rustSources) {
1151
+ if (!source.startsWith(prefix))
1152
+ continue;
1153
+ for (let directory = dirname(source); directory !== root; directory = dirname(directory)) {
1154
+ if (index.packageDirectories.has(directory) || SCAN_SKIPPED.has(basename(directory)))
1155
+ continue sources;
1156
+ }
1157
+ yield [source, hash];
1158
+ }
1159
+ }
1160
+ /**
1161
+ * Existing literal include_str!/include_bytes! files read by this package's Rust sources, as Nx's file index holds
1162
+ * them: a generated (ignored) source is its producer's output and keys a consumer through its dependency outputs.
1163
+ * One graph owns the memo; runtime hashing consumes the same discovery alongside source bytes. Nested packages own
1164
+ * their sources separately. Computed paths remain explicit inputs.
1165
+ */
1166
+ export function compiledInFiles(root, index, cache) {
1102
1167
  const cached = cache.get(root);
1103
1168
  if (cached !== undefined)
1104
1169
  return cached;
1105
1170
  const found = new Map();
1106
- for (const source of compiledSourceFiles(root))
1107
- collectCompiledInputs(source, readFileSync(source, 'utf8'), found);
1171
+ for (const [source, hash] of packageRustSources(root, index)) {
1172
+ collectCompiledInputs(source, includeSpellingsOf(source, hash), found);
1173
+ }
1108
1174
  const files = [...found.values()].sort((left, right) => left.file < right.file ? -1 : left.file > right.file ? 1 : 0);
1109
1175
  cache.set(root, files);
1110
1176
  return files;
@@ -1,5 +1,5 @@
1
1
  import { type TomlTable } from 'smol-toml';
2
- import { type CargoResolve, type CompiledCargoInput } from './cargo-source-hash.js';
2
+ import { type CargoResolve, type CargoSourceIndex, type CompiledCargoInput } from './cargo-source-hash.js';
3
3
  export interface CargoWorkspacePackage {
4
4
  name: string;
5
5
  dir: string;
@@ -40,6 +40,8 @@ export interface CargoPackageTestInputsOptions {
40
40
  memberDir: string;
41
41
  /** Cargo's locked resolve of that workspace, which decides the crates the member's tests build. */
42
42
  cargo: CargoResolve;
43
+ /** Nx's indexed Cargo sources, where the crates' Rust sources and nested packages are found. */
44
+ sources: CargoSourceIndex;
43
45
  /** Shared across every call of one graph computation; see {@link createCargoInputsCache}. */
44
46
  cache?: CargoInputsCache;
45
47
  }
@@ -50,7 +52,9 @@ export interface CargoPackageTestInputsOptions {
50
52
  * three targets over ~45 crates that was ~135 derivations and the dominant
51
53
  * cost of loading the graph. The cache lives exactly as long as one
52
54
  * `createNodes` call — Nx recomputes the graph when a manifest changes, so
53
- * nothing here can go stale across runs.
55
+ * nothing here can go stale across runs. What outlives the call is keyed by
56
+ * content, not by time: a Rust source's include scan by Nx's hash of it
57
+ * (`compiledInFiles`), so a recomputation reads only the sources that changed.
54
58
  */
55
59
  export interface CargoInputsCache {
56
60
  readonly manifests: Map<string, Promise<TomlTable>>;
@@ -59,6 +63,20 @@ export interface CargoInputsCache {
59
63
  readonly results: Map<string, Promise<string[]>>;
60
64
  }
61
65
  export declare function createCargoInputsCache(): CargoInputsCache;
66
+ /** A producer output a Cargo target hashes: the files one producer edge writes under one closure file set. */
67
+ export interface CargoProducerOutputInput {
68
+ readonly dependentTasksOutputFiles: string;
69
+ readonly transitive: false;
70
+ }
71
+ /**
72
+ * The outputs of a Cargo target's producers its compile can read: one `dependentTasksOutputFiles` per file set of its
73
+ * closure (`cargoPackageTestInputs`, or the generic fallback rooted at `projectRoot`). A producer that writes a
74
+ * generated crate source, a compiled-in file or a manifest keys the target; one that writes anywhere else, such as a
75
+ * TypeScript package's `dist`, does not. Nx matches the glob against each output file's workspace-relative path (the
76
+ * same `matchGlobPaths` its `--check` uses), so the `{workspaceRoot}/` anchor is dropped. An exclusion or a named input
77
+ * has no output form, and a producer writes into no build directory the exclusions name.
78
+ */
79
+ export declare function cargoProducerOutputInputs(inputs: readonly (string | object)[], projectRoot: string): CargoProducerOutputInput[];
62
80
  export declare function cargoPackageTestInputs(options: CargoPackageTestInputsOptions): Promise<string[]>;
63
81
  /**
64
82
  * Refuses inputs outside the Nx workspace that `nx.json` gives no `externalRustCrates` runtime hash for: no fileset
@@ -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,OAAO,EAAgB,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAmB,MAAM,wBAAwB,CAAC;AAEnH,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,mGAAmG;IACnG,KAAK,EAAE,YAAY,CAAC;IACpB,6FAA6F;IAC7F,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B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AoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,yBAAyB,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { existsSync, readdirSync, readFileSync } from 'node:fs';
2
2
  import { readFile, realpath } from 'node:fs/promises';
3
- import { dirname, isAbsolute, join, posix, relative, resolve, sep } from 'node:path';
3
+ import { basename, dirname, isAbsolute, join, posix, relative, resolve, sep } from 'node:path';
4
4
  import { readNxJson } from 'nx/src/config/nx-json.js';
5
5
  import { parse as parseToml } from 'smol-toml';
6
- import { buildClosure, compiledInFiles } from './cargo-source-hash.js';
6
+ import { buildClosure, compiledInFiles, } from './cargo-source-hash.js';
7
7
  export function listCargoWorkspacePackages(absoluteProjectRoot) {
8
8
  const workspaceTomlPath = join(absoluteProjectRoot, 'Cargo.toml');
9
9
  if (!existsSync(workspaceTomlPath)) {
@@ -173,6 +173,26 @@ export const EXTERNAL_RUST_CRATES_INPUT = 'externalRustCrates';
173
173
  export function createCargoInputsCache() {
174
174
  return { manifests: new Map(), nestedCrateDirs: new Map(), compiledInFiles: new Map(), results: new Map() };
175
175
  }
176
+ /**
177
+ * The outputs of a Cargo target's producers its compile can read: one `dependentTasksOutputFiles` per file set of its
178
+ * closure (`cargoPackageTestInputs`, or the generic fallback rooted at `projectRoot`). A producer that writes a
179
+ * generated crate source, a compiled-in file or a manifest keys the target; one that writes anywhere else, such as a
180
+ * TypeScript package's `dist`, does not. Nx matches the glob against each output file's workspace-relative path (the
181
+ * same `matchGlobPaths` its `--check` uses), so the `{workspaceRoot}/` anchor is dropped. An exclusion or a named input
182
+ * has no output form, and a producer writes into no build directory the exclusions name.
183
+ */
184
+ export function cargoProducerOutputInputs(inputs, projectRoot) {
185
+ const globs = inputs.flatMap((input) => {
186
+ if (typeof input !== 'string')
187
+ return [];
188
+ if (input.startsWith('{workspaceRoot}/'))
189
+ return [input.slice('{workspaceRoot}/'.length)];
190
+ if (input.startsWith('{projectRoot}/'))
191
+ return [posix.join(projectRoot, input.slice('{projectRoot}/'.length))];
192
+ return [];
193
+ });
194
+ return [...new Set(globs)].map((glob) => ({ dependentTasksOutputFiles: glob, transitive: false }));
195
+ }
176
196
  export function cargoPackageTestInputs(options) {
177
197
  const cache = options.cache ?? createCargoInputsCache();
178
198
  const key = `${options.absoluteProjectRoot}\0${options.memberDir}`;
@@ -183,7 +203,7 @@ export function cargoPackageTestInputs(options) {
183
203
  cache.results.set(key, derived);
184
204
  return derived;
185
205
  }
186
- async function deriveCargoPackageTestInputs({ workspaceRoot, absoluteProjectRoot, memberDir, cargo }, cache) {
206
+ async function deriveCargoPackageTestInputs({ workspaceRoot, absoluteProjectRoot, memberDir, cargo, sources }, cache) {
187
207
  // Every fileset is anchored at `{workspaceRoot}`, never `{projectRoot}`: Nx
188
208
  // hashes a `{projectRoot}` glob against only the files its project OWNS, and
189
209
  // a nested Nx project owns the crates under it. A repository-root cargo
@@ -253,7 +273,7 @@ async function deriveCargoPackageTestInputs({ workspaceRoot, absoluteProjectRoot
253
273
  // Cargo packages can compile include_bytes!, headers, schemas and build.rs,
254
274
  // not only Rust sources. Nested packages are separate source owners.
255
275
  inputs.add(`${inputPath(absoluteDir)}/**/*`);
256
- for (const child of nestedCrateDirs(absoluteDir, cache)) {
276
+ for (const child of nestedCrateDirs(absoluteDir, sources, cache)) {
257
277
  const childDir = relative(cargoRoot, child).split(sep).join('/');
258
278
  if (!dirs.has(childDir))
259
279
  exclusions.add(`!${inputPath(child)}/**`);
@@ -261,7 +281,7 @@ async function deriveCargoPackageTestInputs({ workspaceRoot, absoluteProjectRoot
261
281
  // `include_str!("../../../skills/SKILL.md")` compiles a file the package's own
262
282
  // fileset does not reach; a target that does not hash it serves a binary
263
283
  // built from the file's old bytes.
264
- for (const { file } of compiledInFiles(absoluteDir, cache.compiledInFiles)) {
284
+ for (const { file } of compiledInFiles(absoluteDir, sources, cache.compiledInFiles)) {
265
285
  if (isOutsideRoot(relative(absoluteDir, file)))
266
286
  declaredSources.add(file);
267
287
  }
@@ -338,30 +358,30 @@ export function requireExternalRustCratesInput(workspaceRoot, manifest, external
338
358
  'with runtime inputs that hash those external sources and configuration');
339
359
  }
340
360
  /** Every directory beneath `root` that holds its own `Cargo.toml`, the walk stopping at each. */
341
- function nestedCrateDirs(root, cache) {
361
+ /** Directories whose packages are never nested crates of a package: build output, VCS and Nx state, installed packages. */
362
+ const NESTED_CRATE_SKIPPED = new Set(['target', '.git', 'node_modules', '.nx']);
363
+ /**
364
+ * The packages nested in the package at `root`: the indexed package directories beneath it with no other package,
365
+ * and no skipped directory, in between. Read from Nx's file index, so no directory is listed and no path probed.
366
+ */
367
+ function nestedCrateDirs(root, sources, cache) {
342
368
  const cached = cache.nestedCrateDirs.get(root);
343
369
  if (cached !== undefined)
344
370
  return cached;
371
+ const prefix = `${root}${sep}`;
345
372
  const found = [];
346
- const scan = [root];
347
- while (scan.length > 0) {
348
- const current = scan.pop();
349
- if (current === undefined || !existsSync(current))
373
+ nested: for (const directory of sources.packageDirectories) {
374
+ if (!directory.startsWith(prefix))
350
375
  continue;
351
- for (const entry of readdirSync(current, { withFileTypes: true })) {
352
- if (!entry.isDirectory())
353
- continue;
354
- const child = join(current, entry.name);
355
- if (['target', '.git', 'node_modules', '.nx'].includes(entry.name)) {
356
- }
357
- else if (existsSync(join(child, 'Cargo.toml'))) {
358
- found.push(child);
359
- }
360
- else {
361
- scan.push(child);
362
- }
376
+ if (NESTED_CRATE_SKIPPED.has(basename(directory)))
377
+ continue;
378
+ for (let parent = dirname(directory); parent !== root; parent = dirname(parent)) {
379
+ if (sources.packageDirectories.has(parent) || NESTED_CRATE_SKIPPED.has(basename(parent)))
380
+ continue nested;
363
381
  }
382
+ found.push(directory);
364
383
  }
384
+ found.sort();
365
385
  cache.nestedCrateDirs.set(root, found);
366
386
  return found;
367
387
  }
@@ -28,8 +28,9 @@ export interface ProducerSourceWitness {
28
28
  readonly outputs: readonly string[];
29
29
  }
30
30
  /**
31
- * Git as receipts read it: the checkout and nothing of the operator's home. The producer hooks run in whichever process
32
- * Nx runs plugins in, a workspace's sandboxed daemon included, which adopts a host client's HOME; git with that HOME
31
+ * Git as receipts read it: the checkout and nothing of the operator's home. The producer hooks run in the process that
32
+ * runs the tasks (patches/README.md, "A run's task hooks run in its own process"), a host shell's or a sandboxed job's,
33
+ * under whatever HOME that process has; git with the operator's HOME
33
34
  * reads the operator's global configuration, the sandbox denies it, and git dies (specs/cowshed/04_sandbox.md, the
34
35
  * runtime-input contract). A receipt's tree, HEAD and tracked-file status are read under the repository's own
35
36
  * configuration alone, so a host run and a sandboxed run agree on them.
@@ -1 +1 @@
1
- {"version":3,"file":"ensure-built-receipt.d.ts","sourceRoot":"","sources":["../src/ensure-built-receipt.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B,EAC5B,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,UAAU,EAIf,KAAK,WAAW,EAEhB,KAAK,WAAW,EACjB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,MAAM,eAAe,CAAC,CAAC,IACzB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACxC;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AACpD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,GAAG,8BAA8B,CAAC;IACpE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,E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
6
6
  import { censusStart, directoryMembers, movedNodes, recordedStamp, } from './ensure-built-witness.js';
7
7
  /**
8
- * Git as receipts read it: the checkout and nothing of the operator's home. The producer hooks run in whichever process
9
- * Nx runs plugins in, a workspace's sandboxed daemon included, which adopts a host client's HOME; git with that HOME
8
+ * Git as receipts read it: the checkout and nothing of the operator's home. The producer hooks run in the process that
9
+ * runs the tasks (patches/README.md, "A run's task hooks run in its own process"), a host shell's or a sandboxed job's,
10
+ * under whatever HOME that process has; git with the operator's HOME
10
11
  * reads the operator's global configuration, the sandbox denies it, and git dies (specs/cowshed/04_sandbox.md, the
11
12
  * runtime-input contract). A receipt's tree, HEAD and tracked-file status are read under the repository's own
12
13
  * configuration alone, so a host run and a sandboxed run agree on them.
@@ -1,7 +1,12 @@
1
+ import { type PackageLoad } from './bun-lock-scope.js';
1
2
  /**
2
3
  * The workspace-relative files `configs` load, transitively, the configs
3
- * excluded, sorted. `indexed` is Nx's workspace file index (at least its
4
- * JavaScript, TypeScript, JSON and package.json files); a file outside it refuses.
4
+ * excluded, sorted, and the installed packages those modules load by name.
5
+ * `indexed` is Nx's workspace file index (at least its JavaScript,
6
+ * TypeScript, JSON and package.json files); a file outside it refuses.
5
7
  */
6
- export declare function eslintConfigClosure(workspaceRoot: string, configs: readonly string[], indexed: ReadonlySet<string>): string[];
8
+ export declare function eslintConfigClosure(workspaceRoot: string, configs: readonly string[], indexed: ReadonlySet<string>): {
9
+ readonly files: string[];
10
+ readonly packageLoads: PackageLoad[];
11
+ };
7
12
  //# sourceMappingURL=eslint-config-closure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"eslint-config-closure.d.ts","sourceRoot":"","sources":["../src/eslint-config-closure.ts"],"names":[],"mappings":"AAwEA;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAC3B,MAAM,EAAE,CA2CV"}
1
+ {"version":3,"file":"eslint-config-closure.d.ts","sourceRoot":"","sources":["../src/eslint-config-closure.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,qBAAqB,CAAC;AAmCzE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAC3B;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,WAAW,EAAE,CAAA;CAAE,CA4DpE"}
@@ -17,8 +17,10 @@ import * as _assertGuard_1 from "typia/lib/internal/_assertGuard";
17
17
  * `createRequire(module).resolve` and each `import` with
18
18
  * `import.meta.resolve(specifier, module)`.
19
19
  *
20
- * A builtin, or a package installed outside the workspace's own files, adds
21
- * nothing: `bun.lock` and the root manifest key what is installed. A package
20
+ * A builtin adds nothing. A package installed outside the workspace's own
21
+ * files is reported by name with the directory whose module loads it: the
22
+ * lint target keys it by the lock scope that declares it there
23
+ * (bun-lock-scope.ts, `bunLoadScope`). A package
22
24
  * that resolves into the workspace's own files (a workspace member linked into
23
25
  * `node_modules`) is keyed and walked like a relative module. Every loaded
24
26
  * file keys the package.json files that decide how it loads: the nearest one
@@ -36,6 +38,7 @@ import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
36
38
  import { fileURLToPath, pathToFileURL } from 'node:url';
37
39
  import ts from 'typescript';
38
40
  import typia from 'typia';
41
+ import { specifierPackage } from './bun-lock-scope.js';
39
42
  /** The options ESLint creates its jiti with; `fsCache: false` only keeps graph construction from writing a cache. */
40
43
  const JITI_OPTIONS = { moduleCache: false, fsCache: false };
41
44
  const TYPESCRIPT_CONFIG = /\.[mc]?ts$/u;
@@ -55,12 +58,14 @@ console.log(JSON.stringify(loads.map(({ kind, specifier, from }) => {
55
58
  })));`;
56
59
  /**
57
60
  * The workspace-relative files `configs` load, transitively, the configs
58
- * excluded, sorted. `indexed` is Nx's workspace file index (at least its
59
- * JavaScript, TypeScript, JSON and package.json files); a file outside it refuses.
61
+ * excluded, sorted, and the installed packages those modules load by name.
62
+ * `indexed` is Nx's workspace file index (at least its JavaScript,
63
+ * TypeScript, JSON and package.json files); a file outside it refuses.
60
64
  */
61
65
  export function eslintConfigClosure(workspaceRoot, configs, indexed) {
62
66
  const root = realpathSync(workspaceRoot);
63
67
  const keyed = new Set();
68
+ const packageLoads = new Map();
64
69
  const jiti = configs.some((config) => TYPESCRIPT_CONFIG.test(config)) ? workspaceJiti(workspaceRoot) : null;
65
70
  for (const config of configs) {
66
71
  const loader = TYPESCRIPT_CONFIG.test(config) ? jiti : null;
@@ -79,6 +84,11 @@ export function eslintConfigClosure(workspaceRoot, configs, indexed) {
79
84
  const workspacePath = relative(root, real).split(sep).join('/');
80
85
  const installed = workspacePath.split('/').includes('node_modules');
81
86
  if (workspacePath.startsWith('../') || isAbsolute(workspacePath) || installed) {
87
+ if (load.bare) {
88
+ const directory = relative(root, dirname(load.from)).split(sep).join('/') || '.';
89
+ const name = specifierPackage(load.specifier);
90
+ packageLoads.set(`${directory}\0${name}`, { directory, name });
91
+ }
82
92
  if (load.bare || installed)
83
93
  return;
84
94
  throw new Error(`${load.importer} imports '${load.specifier}', which resolves outside the workspace to ${real}`);
@@ -96,7 +106,16 @@ export function eslintConfigClosure(workspaceRoot, configs, indexed) {
96
106
  });
97
107
  }
98
108
  }
99
- return [...keyed].sort();
109
+ return {
110
+ files: [...keyed].sort(),
111
+ packageLoads: [...packageLoads.values()].sort((left, right) => left.directory === right.directory
112
+ ? left.name < right.name
113
+ ? -1
114
+ : 1
115
+ : left.directory < right.directory
116
+ ? -1
117
+ : 1),
118
+ };
100
119
  }
101
120
  /** The loads `module` performs that resolve to a file; refuses a computed load or an unresolvable specifier kind. */
102
121
  function moduleLoads(root, config, module, jiti) {
@@ -7,7 +7,9 @@
7
7
  * ceiling starts at spawn. Later zero-hold intervals pause only the idle budget.
8
8
  * - Any explicitly queued task process pauses idle, including alongside held grants; ceilings keep running.
9
9
  * - The fixture ceiling ends with its segment. The idle clock also stops outside the testing lifecycle.
10
- * - Finished tests reset the idle budget whether their release byte arrived before or after their output.
10
+ * - Finished tests reset the idle budget whether their release byte arrived before or after their output, and so does
11
+ * progress a running test reports on the run's progress channel (progress-channel.ts). The run's CPU is no event:
12
+ * it never resets the budget.
11
13
  */
12
14
  /** The limits a run was given, in milliseconds; an absent one never expires. */
13
15
  export interface BoundLimits {
@@ -71,6 +73,15 @@ export type BoundEvent =
71
73
  readonly wasTesting: boolean;
72
74
  readonly finished: boolean;
73
75
  }
76
+ /**
77
+ * A running test reported progress on the run's progress channel: it restarts the idle bound as a finished test
78
+ * does, and moves no phase, so `testing` is the answer before and after it.
79
+ */
80
+ | {
81
+ readonly kind: 'reported';
82
+ readonly at: number;
83
+ readonly testing: boolean;
84
+ }
74
85
  /** The fixture's segment ended: its ceiling no longer applies. */
75
86
  | {
76
87
  readonly kind: 'fixture-done';
@@ -1 +1 @@
1
- {"version":3,"file":"bounds.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/bounds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,gFAAgF;AAChF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,Q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