@smoothbricks/nx-plugin 0.7.17 → 0.7.19
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 +315 -114
- package/dist/.build-inputs.json +47 -38
- package/dist/built-output-packages.js +1 -1
- package/dist/bun-lock-scope.d.ts +128 -20
- package/dist/bun-lock-scope.d.ts.map +1 -1
- package/dist/bun-lock-scope.js +267 -44
- package/dist/cargo-closure-input.d.ts +8 -6
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +15 -12
- package/dist/cargo-source-hash.d.ts +26 -25
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +84 -105
- package/dist/cargo-toolchain-paths.d.ts +2 -2
- package/dist/cargo-toolchain-paths.js +2 -2
- package/dist/cargo-workspace.d.ts +20 -2
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +43 -22
- package/dist/ensure-built-receipt.d.ts +3 -2
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +3 -2
- package/dist/eslint-config-closure.d.ts +8 -3
- package/dist/eslint-config-closure.d.ts.map +1 -1
- package/dist/eslint-config-closure.js +24 -5
- package/dist/executors/bounded-exec/admission-queue.d.ts +3 -1
- package/dist/executors/bounded-exec/admission-queue.d.ts.map +1 -1
- package/dist/executors/bounded-exec/admission-queue.js +9 -10
- package/dist/executors/bounded-exec/awake-clock.d.ts +5 -0
- package/dist/executors/bounded-exec/awake-clock.d.ts.map +1 -0
- package/dist/executors/bounded-exec/awake-clock.js +22 -0
- package/dist/executors/bounded-exec/bounds.d.ts +19 -6
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
- package/dist/executors/bounded-exec/bounds.js +22 -15
- package/dist/executors/bounded-exec/case-gate.d.ts +114 -0
- package/dist/executors/bounded-exec/case-gate.d.ts.map +1 -0
- package/dist/executors/bounded-exec/case-gate.js +342 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts +1 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool-thread.js +2 -2
- package/dist/executors/bounded-exec/cpu-pool.d.ts +28 -1
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +102 -16
- package/dist/executors/bounded-exec/cpu-rise.d.ts +73 -0
- package/dist/executors/bounded-exec/cpu-rise.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-rise.js +111 -0
- package/dist/executors/bounded-exec/endpoint-life.d.ts +146 -0
- package/dist/executors/bounded-exec/endpoint-life.d.ts.map +1 -0
- package/dist/executors/bounded-exec/endpoint-life.js +228 -0
- package/dist/executors/bounded-exec/executor.d.ts +1 -1
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +256 -86
- package/dist/executors/bounded-exec/gateway-lease.d.ts +1 -1
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +8 -1
- package/dist/executors/bounded-exec/go-run-summary.d.ts +51 -0
- package/dist/executors/bounded-exec/go-run-summary.d.ts.map +1 -0
- package/dist/executors/bounded-exec/go-run-summary.js +98 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +11 -3
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +125 -47
- package/dist/executors/bounded-exec/lease-wait.d.ts +1 -0
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -1
- package/dist/executors/bounded-exec/lease-wait.js +1 -0
- package/dist/executors/bounded-exec/mbx-pool.d.ts +42 -7
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-pool.js +45 -8
- package/dist/executors/bounded-exec/mbx-reservations.d.ts +12 -6
- package/dist/executors/bounded-exec/mbx-reservations.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-reservations.js +190 -284
- package/dist/executors/bounded-exec/parent-grant.d.ts +2 -0
- package/dist/executors/bounded-exec/parent-grant.d.ts.map +1 -1
- package/dist/executors/bounded-exec/parent-grant.js +1 -0
- package/dist/executors/bounded-exec/pool-admission.d.ts +29 -3
- package/dist/executors/bounded-exec/pool-admission.d.ts.map +1 -1
- package/dist/executors/bounded-exec/pool-admission.js +47 -1
- package/dist/executors/bounded-exec/progress-channel.d.ts +38 -0
- package/dist/executors/bounded-exec/progress-channel.d.ts.map +1 -0
- package/dist/executors/bounded-exec/progress-channel.js +113 -0
- package/dist/executors/bounded-exec/progress.d.ts +5 -1
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/progress.js +31 -1
- package/dist/executors/bounded-exec/ram-temp.d.ts +24 -1
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +123 -16
- package/dist/executors/bounded-exec/reservation-connection.d.ts +90 -0
- package/dist/executors/bounded-exec/reservation-connection.d.ts.map +1 -0
- package/dist/executors/bounded-exec/reservation-connection.js +248 -0
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +3 -0
- package/dist/executors/bounded-exec/runner-sizing.d.ts +9 -5
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-sizing.js +13 -9
- package/dist/executors/bounded-exec/schema.d.ts +7 -2
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/schema.js +17 -1
- package/dist/executors/bounded-exec/suite-minimum.d.ts +21 -0
- package/dist/executors/bounded-exec/suite-minimum.d.ts.map +1 -0
- package/dist/executors/bounded-exec/suite-minimum.js +85 -0
- package/dist/executors/bounded-exec/test-result-writer.d.ts +2 -0
- package/dist/executors/bounded-exec/test-result-writer.d.ts.map +1 -1
- package/dist/executors/bounded-exec/test-result-writer.js +1 -0
- package/dist/executors/bounded-exec/test-results.d.ts +5 -0
- package/dist/executors/bounded-exec/test-results.d.ts.map +1 -1
- package/dist/executors/bounded-exec/test-results.js +2 -2
- package/dist/executors/bounded-exec/verdict.d.ts +39 -10
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +60 -14
- package/dist/executors/cargo-zigbuild/executor.d.ts +10 -8
- package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
- package/dist/executors/cargo-zigbuild/executor.js +32 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +294 -152
- package/dist/managed-files/ci-workflow.d.ts +4 -1
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +9 -14
- package/dist/managed-files/files.d.ts +3 -3
- package/dist/managed-files/files.js +3 -3
- package/dist/managed-files/generator.d.ts +5 -1
- package/dist/managed-files/generator.d.ts.map +1 -1
- package/dist/managed-files/generator.js +22 -7
- package/dist/managed-files/render-memo.d.ts +13 -0
- package/dist/managed-files/render-memo.d.ts.map +1 -0
- package/dist/managed-files/render-memo.js +94 -0
- package/dist/task-results.js +2 -1
- package/dist/test-program.d.ts +11 -6
- package/dist/test-program.d.ts.map +1 -1
- package/dist/test-program.js +39 -35
- package/dist/tool-bins.d.ts +12 -0
- package/dist/tool-bins.d.ts.map +1 -1
- package/dist/tool-bins.js +31 -6
- package/dist/typecheck-test-policy.d.ts +10 -1
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +40 -24
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +135 -42
- package/dist/workspace-index.d.ts +14 -1
- package/dist/workspace-index.d.ts.map +1 -1
- package/dist/workspace-index.js +36 -4
- package/executors.json +2 -0
- package/managed/raw/envrc +24 -0
- package/managed/raw/patches/nx@24.0.3.patch +1851 -221
- package/managed/raw/patches/ttsc@0.37.1.patch +1055 -0
- package/managed/raw/tooling/direnv/developer-links.ts +122 -14
- package/managed/raw/tooling/direnv/devenv.smoo.nix +20 -19
- package/managed/templates/github/actions/save-nix-devenv/action.yml +19 -1
- package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
- package/package.json +68 -11
- package/runtime/nx-publish/.build-inputs.json +2 -2
- package/runtime/nx-publish/cache_adapter.js +293 -3
- package/runtime/nx-publish/nx_publish.js +36 -14
- package/src/built-output-packages.ts +1 -1
- package/src/bun-lock-scope.ts +293 -40
- package/src/cargo-closure-input.ts +20 -12
- package/src/cargo-source-hash.ts +119 -145
- package/src/cargo-toolchain-paths.ts +2 -2
- package/src/cargo-workspace.ts +59 -21
- package/src/ensure-built-receipt.ts +3 -2
- package/src/eslint-config-closure.ts +27 -6
- package/src/executors/bounded-exec/admission-queue.ts +11 -10
- package/src/executors/bounded-exec/awake-clock.ts +20 -0
- package/src/executors/bounded-exec/bounds.ts +41 -19
- package/src/executors/bounded-exec/case-gate.ts +365 -0
- package/src/executors/bounded-exec/cpu-pool-thread.ts +3 -3
- package/src/executors/bounded-exec/cpu-pool.ts +139 -12
- package/src/executors/bounded-exec/cpu-rise.ts +156 -0
- package/src/executors/bounded-exec/endpoint-life.ts +279 -0
- package/src/executors/bounded-exec/executor.ts +341 -123
- package/src/executors/bounded-exec/gateway-lease.ts +6 -0
- package/src/executors/bounded-exec/go-run-summary.ts +137 -0
- package/src/executors/bounded-exec/hang-diagnostics.ts +150 -50
- package/src/executors/bounded-exec/lease-wait.ts +1 -0
- package/src/executors/bounded-exec/mbx-pool.ts +57 -9
- package/src/executors/bounded-exec/mbx-reservations.ts +216 -183
- package/src/executors/bounded-exec/parent-grant.ts +3 -0
- package/src/executors/bounded-exec/pool-admission.ts +59 -2
- package/src/executors/bounded-exec/progress-channel.ts +129 -0
- package/src/executors/bounded-exec/progress.ts +39 -3
- package/src/executors/bounded-exec/ram-temp.ts +137 -17
- package/src/executors/bounded-exec/reservation-connection.ts +221 -0
- package/src/executors/bounded-exec/run-cpu-pool.ts +2 -0
- package/src/executors/bounded-exec/runner-sizing.ts +13 -8
- package/src/executors/bounded-exec/schema.json +1 -1
- package/src/executors/bounded-exec/schema.ts +21 -2
- package/src/executors/bounded-exec/suite-minimum.ts +81 -0
- package/src/executors/bounded-exec/test-result-writer.ts +3 -0
- package/src/executors/bounded-exec/test-results.ts +5 -0
- package/src/executors/bounded-exec/verdict.ts +83 -22
- package/src/executors/cargo-zigbuild/executor.ts +30 -19
- package/src/index.ts +357 -166
- package/src/managed-files/ci-workflow.ts +13 -17
- package/src/managed-files/files.ts +3 -3
- package/src/managed-files/generator.ts +21 -6
- package/src/managed-files/render-memo.ts +135 -0
- package/src/test-program.ts +36 -41
- package/src/tool-bins.ts +35 -6
- package/src/typecheck-test-policy.ts +49 -24
- package/src/workspace-config-policy.ts +161 -43
- package/src/workspace-index.ts +40 -5
- package/test-timings.json +157 -141
- package/managed/raw/patches/ttsc@0.36.3.patch +0 -1660
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as _assertGuard_1 from "typia/lib/internal/_assertGuard";
|
|
2
|
-
import { existsSync, readdirSync, readFileSync
|
|
2
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
3
3
|
import { dirname, join, posix, relative } from 'node:path';
|
|
4
4
|
import { getProjects, parseJson, readJson, readProjectConfiguration } from 'nx/src/devkit-exports.js';
|
|
5
|
+
import { globWithWorkspaceContextSync } from 'nx/src/utils/workspace-context.js';
|
|
5
6
|
import typia from 'typia';
|
|
6
7
|
import { editJsonText } from './managed-files/json-edit.js';
|
|
7
8
|
import { formatJsonWithBiome, jsonFileText } from './managed-files/managed-format.js';
|
|
8
|
-
import { includeGlobsFor,
|
|
9
|
+
import { includeGlobsFor, SOURCE_LISTING_GLOBS, testProgramFault, typeScriptSourcesByProject, } from './test-program.js';
|
|
9
10
|
import { isRecord } from './type-guards.js';
|
|
11
|
+
import { freshIndexedFiles } from './workspace-index.js';
|
|
10
12
|
import { workspacePackagePatterns } from './workspace-manifest.js';
|
|
11
13
|
const workspaceDependencyFields = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'];
|
|
12
14
|
/**
|
|
@@ -202,7 +204,9 @@ export function removeTsconfigTestReference(projectTsconfig) {
|
|
|
202
204
|
*/
|
|
203
205
|
export function checkTypecheckTestPolicyTree(tree) {
|
|
204
206
|
const issues = [];
|
|
205
|
-
|
|
207
|
+
const projects = getProjects(tree);
|
|
208
|
+
const sources = typeScriptSourcesByProject(treeSourceListing(tree), [...projects.values()].map((project) => project.root));
|
|
209
|
+
for (const [projectName, config] of projects) {
|
|
206
210
|
const pkgPath = `${config.root}/package.json`;
|
|
207
211
|
if (!tree.exists(pkgPath))
|
|
208
212
|
continue;
|
|
@@ -227,7 +231,7 @@ export function checkTypecheckTestPolicyTree(tree) {
|
|
|
227
231
|
// Check tsconfig.test.json contents
|
|
228
232
|
const tsconfigTest = readJson(tree, tsconfigTestPath);
|
|
229
233
|
issues.push(...checkTypecheckTestConfig(tsconfigTest, config.root));
|
|
230
|
-
const fault = testProgramFault(treeProgram(tree, config.root), tsconfigTest);
|
|
234
|
+
const fault = testProgramFault(treeProgram(tree, config.root, sources), tsconfigTest);
|
|
231
235
|
if (fault !== null) {
|
|
232
236
|
issues.push({ path: tsconfigTestPath, message: testProgramFaultMessage(config.root, testRunners, fault) });
|
|
233
237
|
}
|
|
@@ -243,11 +247,14 @@ export function checkTypecheckTestPolicyTree(tree) {
|
|
|
243
247
|
/**
|
|
244
248
|
* Render test typechecking policy from the caller's Tree. The managed generator
|
|
245
249
|
* owns staging, permission checks, and flushing together with its other files.
|
|
250
|
+
* `listing` is {@link treeSourceListing} of the same Tree: the caller holds it, as the render's memo is keyed on it.
|
|
246
251
|
*/
|
|
247
|
-
export function renderTypecheckTestFiles(tree) {
|
|
252
|
+
export function renderTypecheckTestFiles(tree, listing) {
|
|
248
253
|
const files = [];
|
|
249
254
|
const workspacePackages = collectWorkspacePackagesTree(tree);
|
|
250
|
-
|
|
255
|
+
const projects = getProjects(tree);
|
|
256
|
+
const sources = typeScriptSourcesByProject(listing, [...projects.values()].map((project) => project.root));
|
|
257
|
+
for (const [projectName, config] of projects) {
|
|
251
258
|
const pkgPath = `${config.root}/package.json`;
|
|
252
259
|
if (!tree.exists(pkgPath))
|
|
253
260
|
continue;
|
|
@@ -272,7 +279,7 @@ export function renderTypecheckTestFiles(tree) {
|
|
|
272
279
|
const libCompilerOptions = libTsconfig ? recordProperty(libTsconfig, 'compilerOptions') : null;
|
|
273
280
|
// Collect reference paths
|
|
274
281
|
const referencePaths = collectReferencePathsTree(tree, config.root, pkg, workspacePackages);
|
|
275
|
-
const program = treeProgram(tree, config.root);
|
|
282
|
+
const program = treeProgram(tree, config.root, sources);
|
|
276
283
|
applyTypecheckTestDefaults(tsconfigTest, {
|
|
277
284
|
testRunners,
|
|
278
285
|
testExtends,
|
|
@@ -324,28 +331,34 @@ function renderTsconfig(tree, target, after) {
|
|
|
324
331
|
}
|
|
325
332
|
return { target, content: edited === current ? current : formatJsonWithBiome(path, edited) };
|
|
326
333
|
}
|
|
327
|
-
|
|
334
|
+
/**
|
|
335
|
+
* The files a Tree's source listing reads, workspace-relative and sorted: Nx's workspace file index for the Tree's
|
|
336
|
+
* root, with the Tree's pending edits over it, as devkit's own `getProjects` lists project files. The index applies
|
|
337
|
+
* .gitignore and .nxignore, so the listing is what the commit holds, the same in every checkout, and never build
|
|
338
|
+
* output one disk happens to carry; it is read from memory, so no directory is listed and no file probed. A path a
|
|
339
|
+
* pending edit writes is listed whatever its name: the listing passes over what is neither a source nor a manifest.
|
|
340
|
+
*/
|
|
341
|
+
export function treeSourceListing(tree) {
|
|
342
|
+
const files = new Set(globWithWorkspaceContextSync(tree.root, SOURCE_LISTING_GLOBS));
|
|
343
|
+
for (const change of tree.listChanges()) {
|
|
344
|
+
if (change.type === 'DELETE')
|
|
345
|
+
files.delete(change.path);
|
|
346
|
+
else
|
|
347
|
+
files.add(change.path);
|
|
348
|
+
}
|
|
349
|
+
return [...files].sort();
|
|
350
|
+
}
|
|
351
|
+
function treeProgram(tree, projectRoot, sources) {
|
|
328
352
|
return {
|
|
329
353
|
projectRoot,
|
|
330
|
-
files:
|
|
354
|
+
files: sources.get(projectRoot) ?? [],
|
|
331
355
|
readConfig: (path) => (tree.exists(path) ? readJson(tree, path) : null),
|
|
332
356
|
};
|
|
333
357
|
}
|
|
334
|
-
function diskProgram(root, projectRoot) {
|
|
335
|
-
const disk = {
|
|
336
|
-
children: (directory) => readdirSync(join(root, directory)),
|
|
337
|
-
isFile: (path) => {
|
|
338
|
-
try {
|
|
339
|
-
return statSync(join(root, path)).isFile();
|
|
340
|
-
}
|
|
341
|
-
catch {
|
|
342
|
-
return false;
|
|
343
|
-
}
|
|
344
|
-
},
|
|
345
|
-
};
|
|
358
|
+
function diskProgram(root, projectRoot, sources) {
|
|
346
359
|
return {
|
|
347
360
|
projectRoot,
|
|
348
|
-
files:
|
|
361
|
+
files: sources.get(projectRoot) ?? [],
|
|
349
362
|
readConfig: (path) => readJsonObject(join(root, path)),
|
|
350
363
|
};
|
|
351
364
|
}
|
|
@@ -368,7 +381,10 @@ function testProgramFaultMessage(projectRoot, testRunners, fault) {
|
|
|
368
381
|
export function checkTypecheckTestPolicy(root) {
|
|
369
382
|
const issues = [];
|
|
370
383
|
const workspaceNames = getWorkspacePackageNames(root);
|
|
371
|
-
|
|
384
|
+
const packageJsonPaths = listWorkspacePackageJsonPaths(root);
|
|
385
|
+
// Files as they are on disk now, through the same ignore rules as the Tree listing.
|
|
386
|
+
const sources = typeScriptSourcesByProject(freshIndexedFiles(root, SOURCE_LISTING_GLOBS), packageJsonPaths.map((path) => relative(root, dirname(path))));
|
|
387
|
+
for (const packageJsonPath of packageJsonPaths) {
|
|
372
388
|
const pkg = readJsonObject(packageJsonPath);
|
|
373
389
|
if (!pkg) {
|
|
374
390
|
continue;
|
|
@@ -398,7 +414,7 @@ export function checkTypecheckTestPolicy(root) {
|
|
|
398
414
|
if (tsconfig) {
|
|
399
415
|
const absoluteIssues = checkTypecheckTestConfig(tsconfig, join(root, packagePath));
|
|
400
416
|
issues.push(...absoluteIssues);
|
|
401
|
-
const program = diskProgram(root, packagePath);
|
|
417
|
+
const program = diskProgram(root, packagePath, sources);
|
|
402
418
|
const fault = testProgramFault(program, tsconfig);
|
|
403
419
|
if (fault !== null) {
|
|
404
420
|
issues.push({ path: tsconfigTestPath, message: testProgramFaultMessage(packagePath, testRunners, fault) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-config-policy.d.ts","sourceRoot":"","sources":["../src/workspace-config-policy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAQrD,eAAO,MAAM,4BAA4B,0CAA0C,CAAC;AAGpF,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,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAI/B;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI/D;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D;AA2BD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"workspace-config-policy.d.ts","sourceRoot":"","sources":["../src/workspace-config-policy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAQrD,eAAO,MAAM,4BAA4B,0CAA0C,CAAC;AAGpF,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,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAI/B;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI/D;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D;AA2BD;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,EAAE,CAqFrF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAyB7E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,aAAa,EAAE,CAKpE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAQ5D;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"}
|
|
@@ -177,6 +177,9 @@ export function checkWorkspaceConfig(nxJson) {
|
|
|
177
177
|
const issues = [];
|
|
178
178
|
// Colon target defaults
|
|
179
179
|
const targetDefaults = recordProperty(nxJson, 'targetDefaults');
|
|
180
|
+
if (nxJson.targetDefaults !== undefined && targetDefaults === null) {
|
|
181
|
+
issues.push({ path: 'nx.json', message: 'targetDefaults must be an object; smoo does not rewrite it' });
|
|
182
|
+
}
|
|
180
183
|
if (targetDefaults) {
|
|
181
184
|
for (const targetName of Object.keys(targetDefaults)) {
|
|
182
185
|
if (targetName.includes(':')) {
|
|
@@ -193,12 +196,15 @@ export function checkWorkspaceConfig(nxJson) {
|
|
|
193
196
|
'Per-project inference selects current library or build outputs before test typechecking.',
|
|
194
197
|
});
|
|
195
198
|
}
|
|
196
|
-
if (
|
|
199
|
+
if (retiredCleanEntries(targetDefaults, targetName).length !== 0) {
|
|
197
200
|
issues.push({
|
|
198
201
|
path: 'nx.json',
|
|
199
202
|
message: `targetDefaults.clean names the retired ${retiredCleanOutputsExecutor}; run smoo monorepo update to remove it`,
|
|
200
203
|
});
|
|
201
204
|
}
|
|
205
|
+
if (targetDefault(nxJson, targetName).form === 'malformed') {
|
|
206
|
+
issues.push({ path: 'nx.json', message: malformedTargetDefaultMessage(targetName) });
|
|
207
|
+
}
|
|
202
208
|
}
|
|
203
209
|
}
|
|
204
210
|
// Build target default
|
|
@@ -326,10 +332,21 @@ export function applyWorkspaceConfigPolicy(root) {
|
|
|
326
332
|
return changed;
|
|
327
333
|
}
|
|
328
334
|
function validateBuildTargetDefault(nxJson, nxJsonPath, issues) {
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
335
|
+
const build = targetDefault(nxJson, 'build');
|
|
336
|
+
if (build.form === 'malformed') {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const entries = build.form === 'absent' ? [] : build.entries;
|
|
340
|
+
if (catchAllValue(entries, 'cache') !== true) {
|
|
341
|
+
issues.push({
|
|
342
|
+
path: nxJsonPath,
|
|
343
|
+
message: build.form === 'list'
|
|
344
|
+
? 'targetDefaults.build.cache must be true in an entry without a filter'
|
|
345
|
+
: 'targetDefaults.build.cache must be true',
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
if (entries.some((entry) => 'filter' in entry && 'cache' in entry && entry.cache !== true)) {
|
|
349
|
+
issues.push({ path: nxJsonPath, message: 'targetDefaults.build.cache must be true in every entry that sets it' });
|
|
333
350
|
}
|
|
334
351
|
// dependsOn and outputs are both owned by the inference plugin, and Nx gives
|
|
335
352
|
// targetDefaults precedence over inferred values, so anything set here lands
|
|
@@ -352,7 +369,7 @@ function validateBuildTargetDefault(nxJson, nxJsonPath, issues) {
|
|
|
352
369
|
// `build` genuinely emits files declares its own outputs in package.json,
|
|
353
370
|
// where the claim is scoped to the project that can honour it.
|
|
354
371
|
for (const property of ['dependsOn', 'outputs']) {
|
|
355
|
-
if (
|
|
372
|
+
if (entries.some((entry) => property in entry)) {
|
|
356
373
|
issues.push({
|
|
357
374
|
path: nxJsonPath,
|
|
358
375
|
message: `targetDefaults.build.${property} must not be set; @smoothbricks/nx-plugin infers the build aggregate`,
|
|
@@ -417,24 +434,46 @@ function markdownExclusionMessage(name) {
|
|
|
417
434
|
return `namedInputs.${name} must exclude ${MARKDOWN_EXCLUSION.slice(1)}: Markdown is no task's input unless a target names it.`;
|
|
418
435
|
}
|
|
419
436
|
function applyBuildTargetDefault(nxJson) {
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
437
|
+
const build = targetDefault(nxJson, 'build');
|
|
438
|
+
if (build.form === 'malformed') {
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
if (build.form === 'absent') {
|
|
442
|
+
const targetDefaults = recordProperty(nxJson, 'targetDefaults');
|
|
443
|
+
if (nxJson.targetDefaults !== undefined && targetDefaults === null) {
|
|
444
|
+
return false;
|
|
445
|
+
}
|
|
446
|
+
getOrCreateRecord(nxJson, 'targetDefaults').build = { cache: true };
|
|
447
|
+
return true;
|
|
448
|
+
}
|
|
449
|
+
let changed = false;
|
|
450
|
+
if (catchAllValue(build.entries, 'cache') !== true) {
|
|
451
|
+
const catchAll = build.entries.filter((entry) => !('filter' in entry)).at(-1);
|
|
452
|
+
if (catchAll !== undefined) {
|
|
453
|
+
changed = setBooleanProperty(catchAll, 'cache', true);
|
|
454
|
+
}
|
|
455
|
+
else if (build.form === 'list') {
|
|
456
|
+
// A list with no entry for every build gets one that caches; the entries it holds stay as written.
|
|
457
|
+
build.list.push({ cache: true });
|
|
426
458
|
changed = true;
|
|
427
459
|
}
|
|
460
|
+
else {
|
|
461
|
+
changed = setBooleanProperty(build.record, 'cache', true);
|
|
462
|
+
}
|
|
428
463
|
}
|
|
429
|
-
|
|
464
|
+
for (const entry of build.entries) {
|
|
465
|
+
if ('filter' in entry && 'cache' in entry && entry.cache !== true) {
|
|
466
|
+
delete entry.cache;
|
|
467
|
+
changed = true;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return deleteMembers(build.entries, ['dependsOn', 'outputs']) || changed;
|
|
430
471
|
}
|
|
431
472
|
function validateTestTargetDefault(nxJson, nxJsonPath, issues) {
|
|
432
|
-
const targetDefaults = recordProperty(nxJson, 'targetDefaults');
|
|
433
|
-
const test = targetDefaults ? recordProperty(targetDefaults, 'test') : null;
|
|
434
473
|
// Same clobber as targetDefaults.build.dependsOn: Nx replaces an inferred
|
|
435
474
|
// list rather than merging, so a workspace-wide [^build, build] unwires
|
|
436
475
|
// cargo-test from every Rust test aggregate. Cache stays allowed.
|
|
437
|
-
if (test
|
|
476
|
+
if (targetDefaultEntries(nxJson, 'test').some((entry) => 'dependsOn' in entry)) {
|
|
438
477
|
issues.push({
|
|
439
478
|
path: nxJsonPath,
|
|
440
479
|
message: 'targetDefaults.test.dependsOn must not be set; @smoothbricks/nx-plugin infers the test aggregate',
|
|
@@ -442,23 +481,24 @@ function validateTestTargetDefault(nxJson, nxJsonPath, issues) {
|
|
|
442
481
|
}
|
|
443
482
|
}
|
|
444
483
|
function applyTestTargetDefault(nxJson) {
|
|
445
|
-
|
|
446
|
-
const test = targetDefaults ? recordProperty(targetDefaults, 'test') : null;
|
|
447
|
-
if (test === null || !('dependsOn' in test)) {
|
|
448
|
-
return false;
|
|
449
|
-
}
|
|
450
|
-
delete test.dependsOn;
|
|
451
|
-
return true;
|
|
484
|
+
return deleteMembers(targetDefaultEntries(nxJson, 'test'), ['dependsOn']);
|
|
452
485
|
}
|
|
453
486
|
const inferredLintProperties = ['executor', 'options', 'dependsOn', 'outputs', 'inputs'];
|
|
454
|
-
|
|
455
|
-
|
|
487
|
+
/**
|
|
488
|
+
* Whether an entry's inputs keep what lint infers. Every entry spreads what came before it (`...`); an entry for every
|
|
489
|
+
* lint target also keeps the dependency declarations (`^production`), which a filtered entry inherits by spreading it.
|
|
490
|
+
*/
|
|
491
|
+
function preservesInferredLintInputs(entry) {
|
|
492
|
+
const inputs = entry.inputs;
|
|
493
|
+
return Array.isArray(inputs) && inputs.includes('...') && ('filter' in entry || inputs.includes('^production'));
|
|
494
|
+
}
|
|
495
|
+
function offendingLintProperties(entry) {
|
|
496
|
+
return inferredLintProperties.filter((property) => property in entry && !(property === 'inputs' && preservesInferredLintInputs(entry)));
|
|
456
497
|
}
|
|
457
498
|
function validateLintTargetDefault(nxJson, nxJsonPath, issues) {
|
|
458
|
-
const
|
|
459
|
-
const lint = defaults ? recordProperty(defaults, 'lint') : null;
|
|
499
|
+
const offending = new Set(targetDefaultEntries(nxJson, 'lint').flatMap(offendingLintProperties));
|
|
460
500
|
for (const property of inferredLintProperties) {
|
|
461
|
-
if (
|
|
501
|
+
if (offending.has(property)) {
|
|
462
502
|
issues.push({
|
|
463
503
|
path: nxJsonPath,
|
|
464
504
|
message: `targetDefaults.lint.${property} must not be set; @smoothbricks/nx-plugin infers lint from project sources`,
|
|
@@ -467,16 +507,9 @@ function validateLintTargetDefault(nxJson, nxJsonPath, issues) {
|
|
|
467
507
|
}
|
|
468
508
|
}
|
|
469
509
|
function applyLintTargetDefault(nxJson) {
|
|
470
|
-
const defaults = recordProperty(nxJson, 'targetDefaults');
|
|
471
|
-
const lint = defaults ? recordProperty(defaults, 'lint') : null;
|
|
472
|
-
if (lint === null)
|
|
473
|
-
return false;
|
|
474
510
|
let changed = false;
|
|
475
|
-
for (const
|
|
476
|
-
|
|
477
|
-
delete lint[property];
|
|
478
|
-
changed = true;
|
|
479
|
-
}
|
|
511
|
+
for (const entry of targetDefaultEntries(nxJson, 'lint')) {
|
|
512
|
+
changed = deleteMembers([entry], offendingLintProperties(entry)) || changed;
|
|
480
513
|
}
|
|
481
514
|
return changed;
|
|
482
515
|
}
|
|
@@ -518,17 +551,33 @@ function removeDisallowedTargetDefaults(nxJson) {
|
|
|
518
551
|
}
|
|
519
552
|
let changed = false;
|
|
520
553
|
for (const targetName of Object.keys(targetDefaults)) {
|
|
521
|
-
if (targetName.includes(':') ||
|
|
522
|
-
targetName === inferredTestTypecheckTarget ||
|
|
523
|
-
isRetiredCleanTargetDefault(targetDefaults, targetName)) {
|
|
554
|
+
if (targetName.includes(':') || targetName === inferredTestTypecheckTarget) {
|
|
524
555
|
delete targetDefaults[targetName];
|
|
525
556
|
changed = true;
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
559
|
+
const retired = retiredCleanEntries(targetDefaults, targetName);
|
|
560
|
+
if (retired.length === 0) {
|
|
561
|
+
continue;
|
|
526
562
|
}
|
|
563
|
+
const value = targetDefaults[targetName];
|
|
564
|
+
const kept = Array.isArray(value) ? value.filter((entry) => !retired.includes(entry)) : [];
|
|
565
|
+
if (kept.length === 0) {
|
|
566
|
+
delete targetDefaults[targetName];
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
targetDefaults[targetName] = kept;
|
|
570
|
+
}
|
|
571
|
+
changed = true;
|
|
527
572
|
}
|
|
528
573
|
return changed;
|
|
529
574
|
}
|
|
530
|
-
|
|
531
|
-
|
|
575
|
+
/** The entries of `targetName`'s default that name the retired clean executor, which the policy removes. */
|
|
576
|
+
function retiredCleanEntries(targetDefaults, targetName) {
|
|
577
|
+
if (targetName !== 'clean') {
|
|
578
|
+
return [];
|
|
579
|
+
}
|
|
580
|
+
return targetDefaultEntries({ targetDefaults }, 'clean').filter((entry) => entry.executor === retiredCleanOutputsExecutor);
|
|
532
581
|
}
|
|
533
582
|
function isPreciseProductionNamedInput(production) {
|
|
534
583
|
let hasPositiveProjectInput = false;
|
|
@@ -584,6 +633,50 @@ function recordProperty(record, key) {
|
|
|
584
633
|
const value = record[key];
|
|
585
634
|
return isRecord(value) ? value : null;
|
|
586
635
|
}
|
|
636
|
+
function targetDefault(nxJson, targetName) {
|
|
637
|
+
const value = recordProperty(nxJson, 'targetDefaults')?.[targetName];
|
|
638
|
+
if (value === undefined) {
|
|
639
|
+
return { form: 'absent' };
|
|
640
|
+
}
|
|
641
|
+
if (isRecord(value)) {
|
|
642
|
+
return { form: 'record', entries: [value], record: value };
|
|
643
|
+
}
|
|
644
|
+
if (Array.isArray(value) && value.every(isRecord)) {
|
|
645
|
+
return { form: 'list', entries: [...value], list: value };
|
|
646
|
+
}
|
|
647
|
+
return { form: 'malformed' };
|
|
648
|
+
}
|
|
649
|
+
/** The entries of a readable target default; none for an absent or malformed one, which validation reports. */
|
|
650
|
+
function targetDefaultEntries(nxJson, targetName) {
|
|
651
|
+
const value = targetDefault(nxJson, targetName);
|
|
652
|
+
return value.form === 'record' || value.form === 'list' ? value.entries : [];
|
|
653
|
+
}
|
|
654
|
+
/** What every target of the name receives for `key` from the entries without a filter: Nx merges them, last one wins. */
|
|
655
|
+
function catchAllValue(entries, key) {
|
|
656
|
+
let value;
|
|
657
|
+
for (const entry of entries) {
|
|
658
|
+
if (!('filter' in entry) && key in entry) {
|
|
659
|
+
value = entry[key];
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
return value;
|
|
663
|
+
}
|
|
664
|
+
/** Remove `members` from every entry that holds them; the entries themselves and their other members stay. */
|
|
665
|
+
function deleteMembers(entries, members) {
|
|
666
|
+
let changed = false;
|
|
667
|
+
for (const entry of entries) {
|
|
668
|
+
for (const member of members) {
|
|
669
|
+
if (member in entry) {
|
|
670
|
+
delete entry[member];
|
|
671
|
+
changed = true;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
return changed;
|
|
676
|
+
}
|
|
677
|
+
function malformedTargetDefaultMessage(targetName) {
|
|
678
|
+
return `targetDefaults.${targetName} must be an object or a list of objects; smoo does not rewrite it`;
|
|
679
|
+
}
|
|
587
680
|
function getOrCreateRecord(record, key) {
|
|
588
681
|
const value = record[key];
|
|
589
682
|
if (isRecord(value)) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FileData } from 'nx/src/native/index.js';
|
|
1
2
|
/**
|
|
2
3
|
* The files of Nx's workspace file index that match `globs`, workspace-relative:
|
|
3
4
|
* .gitignore and .nxignore applied, `node_modules` never entered. These are
|
|
@@ -6,7 +7,10 @@
|
|
|
6
7
|
* output happens to be on disk.
|
|
7
8
|
*
|
|
8
9
|
* The daemon serves only its own workspace's index. Any other root, such as a
|
|
9
|
-
* test fixture or a foreign checkout, is
|
|
10
|
+
* test fixture or a foreign checkout, is read from the filesystem now
|
|
11
|
+
* ({@link freshIndexedFiles}), under that root's own data directory: Nx's
|
|
12
|
+
* process context for it would resolve the inherited NX_WORKSPACE_DATA_DIRECTORY,
|
|
13
|
+
* this workspace's, and take its files lock and archive.
|
|
10
14
|
*/
|
|
11
15
|
export declare function globIndexedFiles(workspaceRoot: string, globs: string[]): Promise<string[]>;
|
|
12
16
|
/**
|
|
@@ -16,4 +20,13 @@ export declare function globIndexedFiles(workspaceRoot: string, globs: string[])
|
|
|
16
20
|
* runs on the files as they are asks here; what describes a graph asks {@link globIndexedFiles}.
|
|
17
21
|
*/
|
|
18
22
|
export declare function freshIndexedFiles(workspaceRoot: string, globs: string[]): string[];
|
|
23
|
+
/**
|
|
24
|
+
* Every file of Nx's workspace file index with Nx's content hash of it, workspace-relative: the hashes Nx's task
|
|
25
|
+
* hasher keys every fileset on, kept current by its watcher, so a caller can tell an unchanged file without reading
|
|
26
|
+
* it. The daemon serves its own workspace; any other root, such as a test fixture, is read from the filesystem now
|
|
27
|
+
* ({@link freshIndexedFileData}), since the daemon's answer would be about another tree.
|
|
28
|
+
*/
|
|
29
|
+
export declare function indexedFileData(workspaceRoot: string): Promise<FileData[]>;
|
|
30
|
+
/** Like {@link indexedFileData}, read from the filesystem now, as {@link freshIndexedFiles} lists it. */
|
|
31
|
+
export declare function freshIndexedFileData(workspaceRoot: string): FileData[];
|
|
19
32
|
//# sourceMappingURL=workspace-index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-index.d.ts","sourceRoot":"","sources":["../src/workspace-index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace-index.d.ts","sourceRoot":"","sources":["../src/workspace-index.ts"],"names":[],"mappings":"AACA,OAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAK/D;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAIhG;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAElF;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAIhF;AAED,yGAAyG;AACzG,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,QAAQ,EAAE,CAEtE"}
|
package/dist/workspace-index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
1
2
|
import native from 'nx/src/native/index.js';
|
|
2
3
|
import { workspaceDataDirectoryForWorkspace } from 'nx/src/utils/cache-directory.js';
|
|
3
|
-
import {
|
|
4
|
+
import { getAllFileDataInContext, globWithWorkspaceContext } from 'nx/src/utils/workspace-context.js';
|
|
4
5
|
import { workspaceRoot as daemonWorkspaceRoot } from 'nx/src/utils/workspace-root.js';
|
|
5
6
|
/**
|
|
6
7
|
* The files of Nx's workspace file index that match `globs`, workspace-relative:
|
|
@@ -10,12 +11,15 @@ import { workspaceRoot as daemonWorkspaceRoot } from 'nx/src/utils/workspace-roo
|
|
|
10
11
|
* output happens to be on disk.
|
|
11
12
|
*
|
|
12
13
|
* The daemon serves only its own workspace's index. Any other root, such as a
|
|
13
|
-
* test fixture or a foreign checkout, is
|
|
14
|
+
* test fixture or a foreign checkout, is read from the filesystem now
|
|
15
|
+
* ({@link freshIndexedFiles}), under that root's own data directory: Nx's
|
|
16
|
+
* process context for it would resolve the inherited NX_WORKSPACE_DATA_DIRECTORY,
|
|
17
|
+
* this workspace's, and take its files lock and archive.
|
|
14
18
|
*/
|
|
15
19
|
export async function globIndexedFiles(workspaceRoot, globs) {
|
|
16
20
|
return workspaceRoot === daemonWorkspaceRoot
|
|
17
21
|
? globWithWorkspaceContext(workspaceRoot, globs)
|
|
18
|
-
:
|
|
22
|
+
: freshIndexedFiles(workspaceRoot, globs);
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* Like {@link globIndexedFiles}, read from the filesystem now: a new native context, the same walk and the same ignore
|
|
@@ -24,5 +28,33 @@ export async function globIndexedFiles(workspaceRoot, globs) {
|
|
|
24
28
|
* runs on the files as they are asks here; what describes a graph asks {@link globIndexedFiles}.
|
|
25
29
|
*/
|
|
26
30
|
export function freshIndexedFiles(workspaceRoot, globs) {
|
|
27
|
-
return new native.WorkspaceContext(workspaceRoot,
|
|
31
|
+
return new native.WorkspaceContext(workspaceRoot, indexDataDirectory(workspaceRoot)).glob(globs);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Every file of Nx's workspace file index with Nx's content hash of it, workspace-relative: the hashes Nx's task
|
|
35
|
+
* hasher keys every fileset on, kept current by its watcher, so a caller can tell an unchanged file without reading
|
|
36
|
+
* it. The daemon serves its own workspace; any other root, such as a test fixture, is read from the filesystem now
|
|
37
|
+
* ({@link freshIndexedFileData}), since the daemon's answer would be about another tree.
|
|
38
|
+
*/
|
|
39
|
+
export async function indexedFileData(workspaceRoot) {
|
|
40
|
+
return workspaceRoot === daemonWorkspaceRoot
|
|
41
|
+
? getAllFileDataInContext(workspaceRoot)
|
|
42
|
+
: freshIndexedFileData(workspaceRoot);
|
|
43
|
+
}
|
|
44
|
+
/** Like {@link indexedFileData}, read from the filesystem now, as {@link freshIndexedFiles} lists it. */
|
|
45
|
+
export function freshIndexedFileData(workspaceRoot) {
|
|
46
|
+
return new native.WorkspaceContext(workspaceRoot, indexDataDirectory(workspaceRoot)).allFileData();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Where a fresh native context of `workspaceRoot` keeps its files lock and archive. Nx's
|
|
50
|
+
* `workspaceDataDirectoryForWorkspace` answers `NX_WORKSPACE_DATA_DIRECTORY` for every root, and that variable names
|
|
51
|
+
* this process's workspace's data (CI points it at a shared directory outside the checkout). A walk of another root
|
|
52
|
+
* there takes this workspace's files lock, and when another process holds it, loads the archive that process writes,
|
|
53
|
+
* this workspace's files, as the other root's (CI's Lint, run 42738719423: the compiled-in fixtures found no crate).
|
|
54
|
+
* Any other root walks under Nx's default for it, inside itself.
|
|
55
|
+
*/
|
|
56
|
+
function indexDataDirectory(workspaceRoot) {
|
|
57
|
+
return workspaceRoot === daemonWorkspaceRoot
|
|
58
|
+
? workspaceDataDirectoryForWorkspace(workspaceRoot)
|
|
59
|
+
: join(workspaceRoot, '.nx', 'workspace-data');
|
|
28
60
|
}
|
package/executors.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"./dist/executors/bounded-exec/cpu-grant.js",
|
|
10
10
|
"./dist/executors/bounded-exec/cpu-pool.js",
|
|
11
11
|
"./dist/executors/bounded-exec/disk-lease.js",
|
|
12
|
+
"./dist/executors/bounded-exec/case-gate.js",
|
|
12
13
|
"./dist/executors/bounded-exec/gateway-lease.js",
|
|
13
14
|
"./dist/executors/bounded-exec/hang-diagnostics.js",
|
|
14
15
|
"./dist/executors/bounded-exec/host-memory.js",
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
"./dist/executors/bounded-exec/ram-detach.js",
|
|
23
24
|
"./dist/executors/bounded-exec/ram-temp-held.js",
|
|
24
25
|
"./dist/executors/bounded-exec/ram-temp.js",
|
|
26
|
+
"./dist/executors/bounded-exec/suite-minimum.js",
|
|
25
27
|
"./dist/testing.js"
|
|
26
28
|
]
|
|
27
29
|
},
|
package/managed/raw/envrc
CHANGED
|
@@ -58,6 +58,30 @@ watch_file \
|
|
|
58
58
|
tooling/direnv/secret-references.ts \
|
|
59
59
|
tooling/direnv/toolchain-stamp.ts
|
|
60
60
|
|
|
61
|
+
# bun.lock records where each patch lives and never what it says, and `bun install`
|
|
62
|
+
# applies the bytes of the patches the root package.json's patchedDependencies
|
|
63
|
+
# names. Editing a patch therefore moves no file watched above: a pull that
|
|
64
|
+
# changed only a patch left the shell on the package it had installed, and
|
|
65
|
+
# devenv's smoo:install was never asked to apply the new bytes. So each patch is
|
|
66
|
+
# watched too. A manifest that cannot be read is said and the shell still loads;
|
|
67
|
+
# package.json is watched, so mending it re-enters.
|
|
68
|
+
smoo_patches=()
|
|
69
|
+
if smoo_patch_list=$(bun --eval '
|
|
70
|
+
const patches = JSON.parse(await Bun.file("package.json").text()).patchedDependencies ?? {};
|
|
71
|
+
if (typeof patches !== "object" || Array.isArray(patches) || Object.values(patches).some((patch) => typeof patch !== "string")) {
|
|
72
|
+
throw new Error("patchedDependencies must map each package to a patch path");
|
|
73
|
+
}
|
|
74
|
+
for (const patch of Object.values(patches)) console.log(patch);
|
|
75
|
+
'); then
|
|
76
|
+
while IFS= read -r smoo_patch; do
|
|
77
|
+
[ -z "$smoo_patch" ] || smoo_patches+=("$smoo_patch")
|
|
78
|
+
done <<<"$smoo_patch_list"
|
|
79
|
+
[ "${#smoo_patches[@]}" -eq 0 ] || watch_file "${smoo_patches[@]}"
|
|
80
|
+
else
|
|
81
|
+
log_error "package.json's patchedDependencies could not be read (see above): its patches are not watched"
|
|
82
|
+
fi
|
|
83
|
+
unset smoo_patches smoo_patch_list smoo_patch
|
|
84
|
+
|
|
61
85
|
# A cowshed workspace's environment, for interactive shells inside one; an
|
|
62
86
|
# absent file is skipped.
|
|
63
87
|
source_env_if_exists .cowshed/env
|