@dads-framework/testing 0.2.0 → 0.3.0
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 +4 -3
- package/bin/dad-test-import-nx.js +3 -0
- package/bin/dad-test-nx.js +3 -0
- package/dist/init/init-testing-manifest.js +1 -1
- package/dist/init/init-testing-manifest.js.map +1 -1
- package/dist/nx/atomic-output.d.ts +9 -0
- package/dist/nx/atomic-output.d.ts.map +1 -0
- package/dist/nx/atomic-output.js +39 -0
- package/dist/nx/atomic-output.js.map +1 -0
- package/dist/nx/cli.d.ts +2 -0
- package/dist/nx/cli.d.ts.map +1 -0
- package/dist/nx/cli.js +21 -0
- package/dist/nx/cli.js.map +1 -0
- package/dist/nx/dads-identifier.d.ts +11 -0
- package/dist/nx/dads-identifier.d.ts.map +1 -0
- package/dist/nx/dads-identifier.js +14 -0
- package/dist/nx/dads-identifier.js.map +1 -0
- package/dist/nx/import-digest.d.ts +12 -0
- package/dist/nx/import-digest.d.ts.map +1 -0
- package/dist/nx/import-digest.js +69 -0
- package/dist/nx/import-digest.js.map +1 -0
- package/dist/nx/import-nx-types.d.ts +166 -0
- package/dist/nx/import-nx-types.d.ts.map +1 -0
- package/dist/nx/import-nx-types.js +2 -0
- package/dist/nx/import-nx-types.js.map +1 -0
- package/dist/nx/import-nx-workspace.d.ts +7 -0
- package/dist/nx/import-nx-workspace.d.ts.map +1 -0
- package/dist/nx/import-nx-workspace.js +292 -0
- package/dist/nx/import-nx-workspace.js.map +1 -0
- package/dist/nx/import-nx.d.ts +12 -0
- package/dist/nx/import-nx.d.ts.map +1 -0
- package/dist/nx/import-nx.js +12 -0
- package/dist/nx/import-nx.js.map +1 -0
- package/dist/nx/index.d.ts +4 -0
- package/dist/nx/index.d.ts.map +1 -0
- package/dist/nx/index.js +4 -0
- package/dist/nx/index.js.map +1 -0
- package/dist/nx/json-values.d.ts +43 -0
- package/dist/nx/json-values.d.ts.map +1 -0
- package/dist/nx/json-values.js +76 -0
- package/dist/nx/json-values.js.map +1 -0
- package/dist/nx/nx-graph-fallback.d.ts +18 -0
- package/dist/nx/nx-graph-fallback.d.ts.map +1 -0
- package/dist/nx/nx-graph-fallback.js +61 -0
- package/dist/nx/nx-graph-fallback.js.map +1 -0
- package/dist/nx/nx-installation.d.ts +4 -0
- package/dist/nx/nx-installation.d.ts.map +1 -0
- package/dist/nx/nx-installation.js +97 -0
- package/dist/nx/nx-installation.js.map +1 -0
- package/dist/nx/nx-jsonc.d.ts +3 -0
- package/dist/nx/nx-jsonc.d.ts.map +1 -0
- package/dist/nx/nx-jsonc.js +91 -0
- package/dist/nx/nx-jsonc.js.map +1 -0
- package/dist/nx/nx-native-cli.d.ts +2 -0
- package/dist/nx/nx-native-cli.d.ts.map +1 -0
- package/dist/nx/nx-native-cli.js +64 -0
- package/dist/nx/nx-native-cli.js.map +1 -0
- package/dist/nx/nx-native-graph.d.ts +11 -0
- package/dist/nx/nx-native-graph.d.ts.map +1 -0
- package/dist/nx/nx-native-graph.js +130 -0
- package/dist/nx/nx-native-graph.js.map +1 -0
- package/dist/nx/nx-native-input-expansion.d.ts +9 -0
- package/dist/nx/nx-native-input-expansion.d.ts.map +1 -0
- package/dist/nx/nx-native-input-expansion.js +114 -0
- package/dist/nx/nx-native-input-expansion.js.map +1 -0
- package/dist/nx/nx-native-inputs.d.ts +9 -0
- package/dist/nx/nx-native-inputs.d.ts.map +1 -0
- package/dist/nx/nx-native-inputs.js +212 -0
- package/dist/nx/nx-native-inputs.js.map +1 -0
- package/dist/nx/nx-native-model.d.ts +28 -0
- package/dist/nx/nx-native-model.d.ts.map +1 -0
- package/dist/nx/nx-native-model.js +119 -0
- package/dist/nx/nx-native-model.js.map +1 -0
- package/dist/nx/nx-native-process.d.ts +2 -0
- package/dist/nx/nx-native-process.d.ts.map +1 -0
- package/dist/nx/nx-native-process.js +18 -0
- package/dist/nx/nx-native-process.js.map +1 -0
- package/dist/nx/nx-native-scope.d.ts +4 -0
- package/dist/nx/nx-native-scope.d.ts.map +1 -0
- package/dist/nx/nx-native-scope.js +21 -0
- package/dist/nx/nx-native-scope.js.map +1 -0
- package/dist/nx/nx-native-scratch.d.ts +5 -0
- package/dist/nx/nx-native-scratch.d.ts.map +1 -0
- package/dist/nx/nx-native-scratch.js +78 -0
- package/dist/nx/nx-native-scratch.js.map +1 -0
- package/dist/nx/nx-native-workspace.d.ts +16 -0
- package/dist/nx/nx-native-workspace.d.ts.map +1 -0
- package/dist/nx/nx-native-workspace.js +72 -0
- package/dist/nx/nx-native-workspace.js.map +1 -0
- package/dist/nx/nx-target-conversion.d.ts +9 -0
- package/dist/nx/nx-target-conversion.d.ts.map +1 -0
- package/dist/nx/nx-target-conversion.js +284 -0
- package/dist/nx/nx-target-conversion.js.map +1 -0
- package/dist/nx/nx-workspace-reader.d.ts +42 -0
- package/dist/nx/nx-workspace-reader.d.ts.map +1 -0
- package/dist/nx/nx-workspace-reader.js +302 -0
- package/dist/nx/nx-workspace-reader.js.map +1 -0
- package/dist/path-aliases/alias-file-system.d.ts +26 -0
- package/dist/path-aliases/alias-file-system.d.ts.map +1 -0
- package/dist/path-aliases/alias-file-system.js +16 -0
- package/dist/path-aliases/alias-file-system.js.map +1 -0
- package/dist/path-aliases/alias-resolver-conformance-cases.d.ts +40 -0
- package/dist/path-aliases/alias-resolver-conformance-cases.d.ts.map +1 -0
- package/dist/path-aliases/alias-resolver-conformance-cases.js +324 -0
- package/dist/path-aliases/alias-resolver-conformance-cases.js.map +1 -0
- package/dist/path-aliases/alias-resolver-conformance.d.ts +41 -0
- package/dist/path-aliases/alias-resolver-conformance.d.ts.map +1 -0
- package/dist/path-aliases/alias-resolver-conformance.js +141 -0
- package/dist/path-aliases/alias-resolver-conformance.js.map +1 -0
- package/dist/path-aliases/alias-resolver.d.ts +23 -0
- package/dist/path-aliases/alias-resolver.d.ts.map +1 -0
- package/dist/path-aliases/alias-resolver.js +199 -0
- package/dist/path-aliases/alias-resolver.js.map +1 -0
- package/dist/path-aliases/in-memory-file-system.d.ts +16 -0
- package/dist/path-aliases/in-memory-file-system.d.ts.map +1 -0
- package/dist/path-aliases/in-memory-file-system.js +43 -0
- package/dist/path-aliases/in-memory-file-system.js.map +1 -0
- package/dist/path-aliases/index.d.ts +6 -0
- package/dist/path-aliases/index.d.ts.map +1 -0
- package/dist/path-aliases/index.js +6 -0
- package/dist/path-aliases/index.js.map +1 -0
- package/dist/path-aliases/json-with-comments.d.ts +14 -0
- package/dist/path-aliases/json-with-comments.d.ts.map +1 -0
- package/dist/path-aliases/json-with-comments.js +245 -0
- package/dist/path-aliases/json-with-comments.js.map +1 -0
- package/dist/path-aliases/node-file-system.d.ts +10 -0
- package/dist/path-aliases/node-file-system.d.ts.map +1 -0
- package/dist/path-aliases/node-file-system.js +29 -0
- package/dist/path-aliases/node-file-system.js.map +1 -0
- package/dist/path-aliases/tsconfig-chain.d.ts +40 -0
- package/dist/path-aliases/tsconfig-chain.d.ts.map +1 -0
- package/dist/path-aliases/tsconfig-chain.js +139 -0
- package/dist/path-aliases/tsconfig-chain.js.map +1 -0
- package/dist/testing.tsbuildinfo +1 -1
- package/dist/vitest/dads-tsconfig-paths.d.ts +17 -0
- package/dist/vitest/dads-tsconfig-paths.d.ts.map +1 -0
- package/dist/vitest/dads-tsconfig-paths.js +38 -0
- package/dist/vitest/dads-tsconfig-paths.js.map +1 -0
- package/dist/vitest/index.d.ts +2 -0
- package/dist/vitest/index.d.ts.map +1 -0
- package/dist/vitest/index.js +2 -0
- package/dist/vitest/index.js.map +1 -0
- package/nx/README.md +259 -0
- package/package.json +35 -8
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The import, read top to bottom.
|
|
3
|
+
*
|
|
4
|
+
* One Nx workspace becomes two files: a Dads-owned manifest that runs without
|
|
5
|
+
* Nx, and a report that says what was read, what was converted, and what was
|
|
6
|
+
* left behind and why. The phases below run in the order they are written —
|
|
7
|
+
* pin the source tree, read the graph, read the projects, convert the targets,
|
|
8
|
+
* then write — and each of the two shapes Nx can answer in that this importer
|
|
9
|
+
* does not understand ends with a report on disk before the failure is raised,
|
|
10
|
+
* so a refused import is still evidence rather than a stack trace.
|
|
11
|
+
*/
|
|
12
|
+
import path from "node:path";
|
|
13
|
+
import { resolveLocalNxCli } from "./nx-installation.js";
|
|
14
|
+
import { writeOutputsAtomically } from "./atomic-output.js";
|
|
15
|
+
import { digestInputs, digestProjectInputs, sha256 } from "./import-digest.js";
|
|
16
|
+
import { stableJson } from "./json-values.js";
|
|
17
|
+
import { parseNxGraphFallbackDependencies } from "./nx-graph-fallback.js";
|
|
18
|
+
import { convertTarget } from "./nx-target-conversion.js";
|
|
19
|
+
import { parseProject, readNxPlugins, readOptionalJson, readNxProjectConfiguration, readProjects, readProjectGraph, readVersions, relativeLocation, requireCleanCommittedWorkspace, runProcess, } from "./nx-workspace-reader.js";
|
|
20
|
+
const outputManifestName = "dads.testing.json";
|
|
21
|
+
const outputReportName = "dads.testing.import-report.json";
|
|
22
|
+
/**
|
|
23
|
+
* Imports only fully materialized, shell-free Nx run-commands targets. The
|
|
24
|
+
* output is a Dads-owned manifest; Nx is not read when the manifest executes.
|
|
25
|
+
*/
|
|
26
|
+
export async function importNxTestingWorkspace(options) {
|
|
27
|
+
const workspaceRoot = path.resolve(options.workspaceRoot);
|
|
28
|
+
const runner = options.runner ?? runProcess;
|
|
29
|
+
const source = await readNxSource(workspaceRoot, options.expectedGitSha, runner);
|
|
30
|
+
const graph = await readGraphOrReport(workspaceRoot, source, runner);
|
|
31
|
+
const workspace = await readWorkspaceProjects(workspaceRoot, source, runner);
|
|
32
|
+
const fallbackDependencies = await resolveFallbackOrReport({
|
|
33
|
+
workspaceRoot,
|
|
34
|
+
source,
|
|
35
|
+
workspace,
|
|
36
|
+
graph,
|
|
37
|
+
});
|
|
38
|
+
const conversion = await convertProjects(workspaceRoot, workspace.parsedProjects);
|
|
39
|
+
const manifest = buildManifest(workspace, conversion, fallbackDependencies);
|
|
40
|
+
const manifestContents = stableJson(manifest);
|
|
41
|
+
const report = buildReport({
|
|
42
|
+
source,
|
|
43
|
+
workspace,
|
|
44
|
+
graph,
|
|
45
|
+
conversion,
|
|
46
|
+
manifestChecksum: sha256(manifestContents),
|
|
47
|
+
});
|
|
48
|
+
return writeImportOutputs(workspaceRoot, manifest, manifestContents, report);
|
|
49
|
+
}
|
|
50
|
+
// --- Phases --------------------------------------------------------------
|
|
51
|
+
/** Pins the source tree, then reads everything that is not a project. */
|
|
52
|
+
async function readNxSource(workspaceRoot, expectedGitSha, runner) {
|
|
53
|
+
const gitSnapshot = await requireCleanCommittedWorkspace(workspaceRoot, expectedGitSha, runner);
|
|
54
|
+
const nxExecutable = await resolveLocalNxCli(workspaceRoot);
|
|
55
|
+
const versions = await readVersions(workspaceRoot, nxExecutable, runner);
|
|
56
|
+
const rootInputs = await digestInputs(workspaceRoot);
|
|
57
|
+
const nxConfig = await readOptionalJson(path.join(workspaceRoot, "nx.json"));
|
|
58
|
+
const plugins = readNxPlugins(nxConfig);
|
|
59
|
+
const projects = await readProjects(workspaceRoot, nxExecutable, runner);
|
|
60
|
+
return {
|
|
61
|
+
gitSnapshot,
|
|
62
|
+
nxExecutable,
|
|
63
|
+
versions,
|
|
64
|
+
rootInputs,
|
|
65
|
+
plugins,
|
|
66
|
+
projects,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** Reads the project graph, or leaves a report saying why it could not. */
|
|
70
|
+
async function readGraphOrReport(workspaceRoot, source, runner) {
|
|
71
|
+
try {
|
|
72
|
+
return await readProjectGraph(workspaceRoot, source.nxExecutable, runner);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
const message = failureMessage(error, "Unknown graph collection failure.");
|
|
76
|
+
await writeUnsupportedGraphReport({
|
|
77
|
+
workspaceRoot,
|
|
78
|
+
source,
|
|
79
|
+
inputs: source.rootInputs,
|
|
80
|
+
message,
|
|
81
|
+
});
|
|
82
|
+
throw new Error(message, { cause: error });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** Reads every project, and digests the files each one is derived from. */
|
|
86
|
+
async function readWorkspaceProjects(workspaceRoot, source, runner) {
|
|
87
|
+
const snapshots = await Promise.all(source.projects.map(async (project) => ({
|
|
88
|
+
name: project,
|
|
89
|
+
value: await readNxProjectConfiguration(workspaceRoot, source.nxExecutable, runner, project),
|
|
90
|
+
})));
|
|
91
|
+
const parsed = snapshots.map((snapshot) => parseProject(snapshot.value, snapshot.name));
|
|
92
|
+
const inputs = await digestProjectInputs(workspaceRoot, source.rootInputs, parsed.map((project) => project.root));
|
|
93
|
+
return {
|
|
94
|
+
snapshots,
|
|
95
|
+
parsedProjects: [...parsed].sort((left, right) => left.name.localeCompare(right.name)),
|
|
96
|
+
inputs,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** Reads the fallback edges, or leaves a report naming the shape it saw. */
|
|
100
|
+
async function resolveFallbackOrReport(input) {
|
|
101
|
+
try {
|
|
102
|
+
return parseNxGraphFallbackDependencies(input.graph, input.workspace.parsedProjects);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
const message = failureMessage(error, "Unknown Nx graph shape failure.");
|
|
106
|
+
await writeUnsupportedGraphReport({
|
|
107
|
+
workspaceRoot: input.workspaceRoot,
|
|
108
|
+
source: input.source,
|
|
109
|
+
inputs: input.workspace.inputs,
|
|
110
|
+
graph: input.graph,
|
|
111
|
+
resolvedProjects: input.workspace.snapshots,
|
|
112
|
+
message,
|
|
113
|
+
});
|
|
114
|
+
throw new Error(message, { cause: error });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/** Converts every target of every project, keeping the audit for each one. */
|
|
118
|
+
async function convertProjects(workspaceRoot, projects) {
|
|
119
|
+
const conversions = [];
|
|
120
|
+
const executors = new Set();
|
|
121
|
+
let targetCount = 0;
|
|
122
|
+
for (const project of projects) {
|
|
123
|
+
const sourceLocation = relativeLocation(workspaceRoot, project.root);
|
|
124
|
+
for (const target of project.targets) {
|
|
125
|
+
targetCount += 1;
|
|
126
|
+
if (target.executor)
|
|
127
|
+
executors.add(target.executor);
|
|
128
|
+
conversions.push(await convertTarget({ workspaceRoot, project, target, sourceLocation }));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
tasks: conversions.flatMap((one) => (one.task ? [one.task] : [])),
|
|
133
|
+
audits: conversions.map((one) => one.audit),
|
|
134
|
+
droppedFields: conversions.flatMap((one) => one.droppedFields),
|
|
135
|
+
failures: conversions.flatMap((one) => (one.failure ? [one.failure] : [])),
|
|
136
|
+
executors: [...executors].sort(),
|
|
137
|
+
targetCount,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
// --- The two outputs -----------------------------------------------------
|
|
141
|
+
/** The manifest: projects and tasks, each sorted by its Dads identifier. */
|
|
142
|
+
function buildManifest(workspace, conversion, fallbackDependencies) {
|
|
143
|
+
return {
|
|
144
|
+
schemaVersion: 1,
|
|
145
|
+
workspace: {
|
|
146
|
+
root: ".",
|
|
147
|
+
fullFallback: {
|
|
148
|
+
taskIds: conversion.tasks.map((task) => task.id).sort(),
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
projects: workspace.parsedProjects
|
|
152
|
+
.map((project) => ({
|
|
153
|
+
id: project.id,
|
|
154
|
+
root: project.root,
|
|
155
|
+
fallbackDependencies: fallbackDependencies.get(project.name) ?? [],
|
|
156
|
+
}))
|
|
157
|
+
.sort((left, right) => left.id.localeCompare(right.id)),
|
|
158
|
+
tasks: [...conversion.tasks].sort((left, right) => left.id.localeCompare(right.id)),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/** The report: what was read, what it became, and everything left behind. */
|
|
162
|
+
function buildReport(input) {
|
|
163
|
+
const { source, workspace, conversion } = input;
|
|
164
|
+
return {
|
|
165
|
+
schemaVersion: 1,
|
|
166
|
+
importer: {
|
|
167
|
+
name: "@dads-framework/testing-import-nx",
|
|
168
|
+
manifestChecksum: input.manifestChecksum,
|
|
169
|
+
},
|
|
170
|
+
source: {
|
|
171
|
+
workspaceRoot: ".",
|
|
172
|
+
expectedGitSha: source.gitSnapshot.expected,
|
|
173
|
+
resolvedGitSha: source.gitSnapshot.resolved,
|
|
174
|
+
versions: source.versions,
|
|
175
|
+
inputs: workspace.inputs,
|
|
176
|
+
locations: workspace.inputs.map((entry) => entry.path),
|
|
177
|
+
},
|
|
178
|
+
nx: {
|
|
179
|
+
projects: source.projects,
|
|
180
|
+
resolvedProjects: resolvedConfigurations(workspace.snapshots),
|
|
181
|
+
projectGraph: input.graph,
|
|
182
|
+
executors: conversion.executors,
|
|
183
|
+
plugins: source.plugins,
|
|
184
|
+
},
|
|
185
|
+
summary: {
|
|
186
|
+
projects: source.projects.length,
|
|
187
|
+
targets: conversion.targetCount,
|
|
188
|
+
converted: conversion.tasks.length,
|
|
189
|
+
excluded: conversion.audits.length - conversion.tasks.length,
|
|
190
|
+
},
|
|
191
|
+
tasks: [...conversion.audits].sort(byAuditIdentity),
|
|
192
|
+
droppedFields: [...conversion.droppedFields].sort(byDroppedFieldIdentity),
|
|
193
|
+
failures: [...conversion.failures].sort((left, right) => left.subject.localeCompare(right.subject)),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/** Each project's configuration exactly as Nx gave it, sorted by name. */
|
|
197
|
+
function resolvedConfigurations(snapshots) {
|
|
198
|
+
return snapshots
|
|
199
|
+
.map((snapshot) => ({
|
|
200
|
+
name: snapshot.name,
|
|
201
|
+
configuration: snapshot.value,
|
|
202
|
+
}))
|
|
203
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Writes both outputs, or — when nothing converted — only the report. A strict
|
|
207
|
+
* v1 manifest needs at least one task, so an empty import is a failure that
|
|
208
|
+
* still leaves the evidence of why behind.
|
|
209
|
+
*/
|
|
210
|
+
async function writeImportOutputs(workspaceRoot, manifest, manifestContents, report) {
|
|
211
|
+
const manifestPath = path.join(workspaceRoot, outputManifestName);
|
|
212
|
+
const reportPath = path.join(workspaceRoot, outputReportName);
|
|
213
|
+
if (manifest.tasks.length === 0) {
|
|
214
|
+
const contents = stableJson(noStandaloneReport(report));
|
|
215
|
+
await writeOutputsAtomically([{ path: reportPath, contents }]);
|
|
216
|
+
throw new Error("No standalone Nx tasks were convertible; see dads.testing.import-report.json.");
|
|
217
|
+
}
|
|
218
|
+
await writeOutputsAtomically([
|
|
219
|
+
{ path: manifestPath, contents: manifestContents },
|
|
220
|
+
{ path: reportPath, contents: stableJson(report) },
|
|
221
|
+
]);
|
|
222
|
+
return { manifest, report, manifestPath, reportPath };
|
|
223
|
+
}
|
|
224
|
+
/** The report as it reads when no manifest was written beside it. */
|
|
225
|
+
function noStandaloneReport(report) {
|
|
226
|
+
return {
|
|
227
|
+
...report,
|
|
228
|
+
importer: { ...report.importer, manifestChecksum: null },
|
|
229
|
+
failures: [
|
|
230
|
+
...report.failures,
|
|
231
|
+
{
|
|
232
|
+
stage: "conversion",
|
|
233
|
+
subject: "manifest",
|
|
234
|
+
message: "No standalone tasks were convertible; no dads.testing.json was written because strict v1 manifests require at least one task.",
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/** Nothing converted, because nothing was ever read. */
|
|
240
|
+
const nothingConverted = {
|
|
241
|
+
tasks: [],
|
|
242
|
+
audits: [],
|
|
243
|
+
droppedFields: [],
|
|
244
|
+
failures: [],
|
|
245
|
+
executors: [],
|
|
246
|
+
targetCount: 0,
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* The report an import leaves behind when Nx answered in a shape this
|
|
250
|
+
* importer does not understand: the same report as a successful import, made
|
|
251
|
+
* of everything that had been read, carrying the one failure that stopped it.
|
|
252
|
+
*/
|
|
253
|
+
async function writeUnsupportedGraphReport(input) {
|
|
254
|
+
const report = buildReport({
|
|
255
|
+
source: input.source,
|
|
256
|
+
workspace: {
|
|
257
|
+
snapshots: input.resolvedProjects ?? [],
|
|
258
|
+
parsedProjects: [],
|
|
259
|
+
inputs: input.inputs,
|
|
260
|
+
},
|
|
261
|
+
graph: input.graph ?? null,
|
|
262
|
+
conversion: nothingConverted,
|
|
263
|
+
manifestChecksum: null,
|
|
264
|
+
});
|
|
265
|
+
await writeOutputsAtomically([
|
|
266
|
+
{
|
|
267
|
+
path: path.join(input.workspaceRoot, outputReportName),
|
|
268
|
+
contents: stableJson({
|
|
269
|
+
...report,
|
|
270
|
+
failures: [
|
|
271
|
+
{
|
|
272
|
+
stage: "graph",
|
|
273
|
+
subject: "nx graph --file",
|
|
274
|
+
message: input.message,
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
}),
|
|
278
|
+
},
|
|
279
|
+
]);
|
|
280
|
+
}
|
|
281
|
+
// --- Ordering ------------------------------------------------------------
|
|
282
|
+
/** `error`'s message, or `fallback` when it was not an `Error` at all. */
|
|
283
|
+
function failureMessage(error, fallback) {
|
|
284
|
+
return error instanceof Error ? error.message : fallback;
|
|
285
|
+
}
|
|
286
|
+
function byAuditIdentity(left, right) {
|
|
287
|
+
return `${left.project}:${left.target}`.localeCompare(`${right.project}:${right.target}`);
|
|
288
|
+
}
|
|
289
|
+
function byDroppedFieldIdentity(left, right) {
|
|
290
|
+
return `${left.project}:${left.target}:${left.field}`.localeCompare(`${right.project}:${right.target}:${right.field}`);
|
|
291
|
+
}
|
|
292
|
+
//# sourceMappingURL=import-nx-workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-nx-workspace.js","sourceRoot":"","sources":["../../src/nx/import-nx-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAA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|
|
2
|
+
* The Nx importer's surface: one entry point and the shapes it speaks in.
|
|
3
|
+
*
|
|
4
|
+
* The import itself reads top to bottom in `import-nx-workspace.ts`; the
|
|
5
|
+
* phases it calls live beside it, one file per question — what the workspace
|
|
6
|
+
* says, what a target becomes, what the graph implies, what was hashed, and
|
|
7
|
+
* how the two outputs land.
|
|
8
|
+
*/
|
|
9
|
+
export { importNxTestingWorkspace } from "./import-nx-workspace.js";
|
|
10
|
+
export { type DadsTestingManifest, type DadsTestingTask, type ImportNxTestingOptions, type ImportNxTestingResult, type NxCommandRunner, type NxImportReport, } from "./import-nx-types.js";
|
|
11
|
+
export { type JsonValue } from "./json-values.js";
|
|
12
|
+
//# sourceMappingURL=import-nx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-nx.d.ts","sourceRoot":"","sources":["../../src/nx/import-nx.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Nx importer's surface: one entry point and the shapes it speaks in.
|
|
3
|
+
*
|
|
4
|
+
* The import itself reads top to bottom in `import-nx-workspace.ts`; the
|
|
5
|
+
* phases it calls live beside it, one file per question — what the workspace
|
|
6
|
+
* says, what a target becomes, what the graph implies, what was hashed, and
|
|
7
|
+
* how the two outputs land.
|
|
8
|
+
*/
|
|
9
|
+
export { importNxTestingWorkspace } from "./import-nx-workspace.js";
|
|
10
|
+
export {} from "./import-nx-types.js";
|
|
11
|
+
export {} from "./json-values.js";
|
|
12
|
+
//# sourceMappingURL=import-nx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-nx.js","sourceRoot":"","sources":["../../src/nx/import-nx.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAON,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAkB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { importNxTestingWorkspace, type DadsTestingManifest, type DadsTestingTask, type ImportNxTestingOptions, type ImportNxTestingResult, type JsonValue, type NxCommandRunner, type NxImportReport, } from "./import-nx.js";
|
|
2
|
+
export { planNativeNxTesting, runNativeNxTesting, type NativeNxTestingOptions, type NativeNxTestingResult, } from "./nx-native-workspace.js";
|
|
3
|
+
export { type NativeNxCoverage } from "./nx-native-model.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nx/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/nx/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nx/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,GAQzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAyB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JSON layer the importer reads Nx through and writes its outputs with.
|
|
3
|
+
*
|
|
4
|
+
* Nx answers in JSON, so every value that crosses into this package arrives as
|
|
5
|
+
* untyped data. One definition of "a JSON value" and one set of narrowing
|
|
6
|
+
* readers keep that data from being asserted into a shape it does not have.
|
|
7
|
+
* `stableJson` is the other half: the manifest checksum is taken over its
|
|
8
|
+
* bytes, so key order and spacing are part of the contract, not a formatting
|
|
9
|
+
* preference.
|
|
10
|
+
*/
|
|
11
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
12
|
+
export type JsonValue = JsonPrimitive | readonly JsonValue[] | {
|
|
13
|
+
readonly [key: string]: JsonValue;
|
|
14
|
+
};
|
|
15
|
+
export type JsonRecord = {
|
|
16
|
+
readonly [key: string]: JsonValue;
|
|
17
|
+
};
|
|
18
|
+
/** Parses `value` as JSON data, naming `subject` in every failure. */
|
|
19
|
+
export declare function parseJson(value: string, subject: string): JsonValue;
|
|
20
|
+
/** True when `value` is data JSON can round-trip without loss. */
|
|
21
|
+
export declare function isJsonValue(value: unknown): value is JsonValue;
|
|
22
|
+
/**
|
|
23
|
+
* True when `value` is a JSON array. `Array.isArray` alone answers with
|
|
24
|
+
* `any[]`, which would let untyped elements back into typed code; this states
|
|
25
|
+
* the element type the JSON layer actually guarantees.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isJsonArray(value: unknown): value is readonly JsonValue[];
|
|
28
|
+
/** True when `value` is a JSON object rather than an array or a primitive. */
|
|
29
|
+
export declare function isJsonRecord(value: JsonValue | undefined): value is JsonRecord;
|
|
30
|
+
/** `record[property]` when it is an object, and `undefined` otherwise. */
|
|
31
|
+
export declare function readOptionalJsonRecord(record: JsonRecord, property: string): JsonRecord | undefined;
|
|
32
|
+
/** `record[property]` when it is a string, and `undefined` otherwise. */
|
|
33
|
+
export declare function readOptionalString(record: JsonRecord, property: string): string | undefined;
|
|
34
|
+
/** `record[property]` when it is a boolean, and `undefined` otherwise. */
|
|
35
|
+
export declare function readOptionalBoolean(record: JsonRecord, property: string): boolean | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Serializes `value` with every object key sorted, two-space indentation, and
|
|
38
|
+
* a trailing newline. Two runs over equal data produce equal bytes, which is
|
|
39
|
+
* what makes the manifest checksum meaningful.
|
|
40
|
+
*/
|
|
41
|
+
export declare function stableJson(value: unknown): string;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=json-values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-values.d.ts","sourceRoot":"","sources":["../../src/nx/json-values.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AACtD,MAAM,MAAM,SAAS,GACnB,aAAa,GAAG,SAAS,SAAS,EAAE,GAAG;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAC/E,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE/D,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAUnE;AAED,kEAAkE;AAClE,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAW9D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,SAAS,EAAE,CAEzE;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,GAAG,SAAS,GAC3B,KAAK,IAAI,UAAU,CAErB;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,GACf,UAAU,GAAG,SAAS,CAGxB;AAED,yEAAyE;AACzE,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,GAAG,SAAS,CAGpB;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,GAAG,SAAS,CAGrB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIjD"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { isRecord } from "../parse-guards.js";
|
|
2
|
+
/** Parses `value` as JSON data, naming `subject` in every failure. */
|
|
3
|
+
export function parseJson(value, subject) {
|
|
4
|
+
try {
|
|
5
|
+
const parsed = JSON.parse(value);
|
|
6
|
+
if (!isJsonValue(parsed))
|
|
7
|
+
throw new Error("value is not valid JSON data");
|
|
8
|
+
return parsed;
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
const message = error instanceof Error ? error.message : "unknown JSON failure";
|
|
12
|
+
throw new Error(`Unable to parse ${subject}: ${message}`, { cause: error });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** True when `value` is data JSON can round-trip without loss. */
|
|
16
|
+
export function isJsonValue(value) {
|
|
17
|
+
if (value === null ||
|
|
18
|
+
typeof value === "string" ||
|
|
19
|
+
typeof value === "number" ||
|
|
20
|
+
typeof value === "boolean")
|
|
21
|
+
return true;
|
|
22
|
+
if (Array.isArray(value))
|
|
23
|
+
return value.every(isJsonValue);
|
|
24
|
+
if (!isRecord(value))
|
|
25
|
+
return false;
|
|
26
|
+
return Object.values(value).every(isJsonValue);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* True when `value` is a JSON array. `Array.isArray` alone answers with
|
|
30
|
+
* `any[]`, which would let untyped elements back into typed code; this states
|
|
31
|
+
* the element type the JSON layer actually guarantees.
|
|
32
|
+
*/
|
|
33
|
+
export function isJsonArray(value) {
|
|
34
|
+
return Array.isArray(value);
|
|
35
|
+
}
|
|
36
|
+
/** True when `value` is a JSON object rather than an array or a primitive. */
|
|
37
|
+
export function isJsonRecord(value) {
|
|
38
|
+
return isRecord(value);
|
|
39
|
+
}
|
|
40
|
+
/** `record[property]` when it is an object, and `undefined` otherwise. */
|
|
41
|
+
export function readOptionalJsonRecord(record, property) {
|
|
42
|
+
const value = record[property];
|
|
43
|
+
return isJsonRecord(value) ? value : undefined;
|
|
44
|
+
}
|
|
45
|
+
/** `record[property]` when it is a string, and `undefined` otherwise. */
|
|
46
|
+
export function readOptionalString(record, property) {
|
|
47
|
+
const value = record[property];
|
|
48
|
+
return typeof value === "string" ? value : undefined;
|
|
49
|
+
}
|
|
50
|
+
/** `record[property]` when it is a boolean, and `undefined` otherwise. */
|
|
51
|
+
export function readOptionalBoolean(record, property) {
|
|
52
|
+
const value = record[property];
|
|
53
|
+
return typeof value === "boolean" ? value : undefined;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Serializes `value` with every object key sorted, two-space indentation, and
|
|
57
|
+
* a trailing newline. Two runs over equal data produce equal bytes, which is
|
|
58
|
+
* what makes the manifest checksum meaningful.
|
|
59
|
+
*/
|
|
60
|
+
export function stableJson(value) {
|
|
61
|
+
if (!isJsonValue(value))
|
|
62
|
+
throw new Error("Importer attempted to serialize a non-JSON output value.");
|
|
63
|
+
return `${JSON.stringify(sortJson(value), undefined, 2)}\n`;
|
|
64
|
+
}
|
|
65
|
+
/** `value` with the keys of every object it contains sorted. */
|
|
66
|
+
function sortJson(value) {
|
|
67
|
+
if (Array.isArray(value))
|
|
68
|
+
return value.map(sortJson);
|
|
69
|
+
if (!isJsonRecord(value))
|
|
70
|
+
return value;
|
|
71
|
+
const sorted = {};
|
|
72
|
+
for (const key of Object.keys(value).sort())
|
|
73
|
+
sorted[key] = sortJson(value[key] ?? null);
|
|
74
|
+
return sorted;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=json-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-values.js","sourceRoot":"","sources":["../../src/nx/json-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAkB9C,sEAAsE;AACtE,MAAM,UAAU,SAAS,CAAC,KAAa,EAAE,OAAe;IACtD,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAC1E,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,OAAO,GACX,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,KAAK,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IACE,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAE1B,OAAO,IAAI,CAAC;IACd,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1D,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,OAAO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C,IAAI,CAAC;AAC9D,CAAC;AAED,gEAAgE;AAChE,SAAS,QAAQ,CAAC,KAAgB;IAChC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,MAAM,MAAM,GAAiC,EAAE,CAAC;IAChD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE;QACzC,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one thing this importer keeps from the Nx project graph: which projects
|
|
3
|
+
* a project falls back to when Dads cannot compute impact itself.
|
|
4
|
+
*
|
|
5
|
+
* Supports the JSON written by `nx graph --file=<path>` where
|
|
6
|
+
* `graph.nodes[project]` is an object and `graph.dependencies[source]` is an
|
|
7
|
+
* array of `{ source, target }` edges. An edge is interpreted only when its
|
|
8
|
+
* source agrees with its containing dependency key, so the frozen Dads
|
|
9
|
+
* fallback dependency is `source -> target` (source depends on target). Any
|
|
10
|
+
* other shape is refused rather than guessed at: a fallback that silently
|
|
11
|
+
* misses an edge would under-test a change, which is the one failure mode a
|
|
12
|
+
* fallback exists to prevent.
|
|
13
|
+
*/
|
|
14
|
+
import type { NxProject } from "./import-nx-types.js";
|
|
15
|
+
import { type JsonValue } from "./json-values.js";
|
|
16
|
+
/** Each project's fallback dependencies, by project name. */
|
|
17
|
+
export declare function parseNxGraphFallbackDependencies(graph: JsonValue, projects: readonly NxProject[]): ReadonlyMap<string, readonly string[]>;
|
|
18
|
+
//# sourceMappingURL=nx-graph-fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nx-graph-fallback.d.ts","sourceRoot":"","sources":["../../src/nx/nx-graph-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAML,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAQ1B,6DAA6D;AAC7D,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,SAAS,SAAS,EAAE,GAC7B,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAQxC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { isJsonArray, isJsonRecord, readOptionalString, readOptionalJsonRecord, } from "./json-values.js";
|
|
2
|
+
/** Each project's fallback dependencies, by project name. */
|
|
3
|
+
export function parseNxGraphFallbackDependencies(graph, projects) {
|
|
4
|
+
const body = readGraphBody(graph);
|
|
5
|
+
const byName = new Map(projects.map((project) => [project.name, project]));
|
|
6
|
+
const fallback = new Map();
|
|
7
|
+
for (const project of projects) {
|
|
8
|
+
fallback.set(project.name, projectDependencies(body, byName, project));
|
|
9
|
+
}
|
|
10
|
+
return fallback;
|
|
11
|
+
}
|
|
12
|
+
/** The `graph.nodes` and `graph.dependencies` objects, or a refusal. */
|
|
13
|
+
function readGraphBody(graph) {
|
|
14
|
+
if (!isJsonRecord(graph))
|
|
15
|
+
throw new Error("Unsupported Nx graph shape: graph output must be a JSON object.");
|
|
16
|
+
const graphBody = readOptionalJsonRecord(graph, "graph");
|
|
17
|
+
if (!graphBody)
|
|
18
|
+
throw new Error("Unsupported Nx graph shape: expected top-level graph object.");
|
|
19
|
+
const nodes = readOptionalJsonRecord(graphBody, "nodes");
|
|
20
|
+
const dependencies = readOptionalJsonRecord(graphBody, "dependencies");
|
|
21
|
+
if (!nodes || !dependencies)
|
|
22
|
+
throw new Error("Unsupported Nx graph shape: expected graph.nodes and graph.dependencies objects.");
|
|
23
|
+
return { nodes, dependencies };
|
|
24
|
+
}
|
|
25
|
+
/** One project's fallback dependency ids, deduplicated and sorted. */
|
|
26
|
+
function projectDependencies(body, byName, project) {
|
|
27
|
+
const dependencies = new Set();
|
|
28
|
+
for (const edge of readProjectEdges(body, project.name)) {
|
|
29
|
+
const targetProject = byName.get(readEdgeTarget(edge, project.name));
|
|
30
|
+
if (targetProject === undefined)
|
|
31
|
+
continue;
|
|
32
|
+
if (targetProject.id === project.id) {
|
|
33
|
+
throw new Error(`Unsupported Nx graph shape: project ${project.name} has a self dependency that strict v1 cannot represent.`);
|
|
34
|
+
}
|
|
35
|
+
dependencies.add(targetProject.id);
|
|
36
|
+
}
|
|
37
|
+
return [...dependencies].sort();
|
|
38
|
+
}
|
|
39
|
+
/** The declared edges leaving one project, or a refusal. */
|
|
40
|
+
function readProjectEdges(body, projectName) {
|
|
41
|
+
if (!isJsonRecord(body.nodes[projectName])) {
|
|
42
|
+
throw new Error(`Unsupported Nx graph shape: graph.nodes is missing object node ${projectName}.`);
|
|
43
|
+
}
|
|
44
|
+
const edges = body.dependencies[projectName];
|
|
45
|
+
if (!isJsonArray(edges)) {
|
|
46
|
+
throw new Error(`Unsupported Nx graph shape: graph.dependencies is missing edge array ${projectName}.`);
|
|
47
|
+
}
|
|
48
|
+
return edges;
|
|
49
|
+
}
|
|
50
|
+
/** The project one edge points at, or a refusal naming what was missing; `nx-native-graph.ts` has `readNativeEdgeTarget`. */
|
|
51
|
+
function readEdgeTarget(edge, projectName) {
|
|
52
|
+
if (!isJsonRecord(edge))
|
|
53
|
+
throw new Error(`Unsupported Nx graph shape: dependency edge for ${projectName} is not an object.`);
|
|
54
|
+
const source = readOptionalString(edge, "source");
|
|
55
|
+
const target = readOptionalString(edge, "target");
|
|
56
|
+
if (source !== projectName || target === undefined) {
|
|
57
|
+
throw new Error(`Unsupported Nx graph shape: dependency edge for ${projectName} does not declare matching source and target.`);
|
|
58
|
+
}
|
|
59
|
+
return target;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=nx-graph-fallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nx-graph-fallback.js","sourceRoot":"","sources":["../../src/nx/nx-graph-fallback.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,GAGvB,MAAM,kBAAkB,CAAC;AAQ1B,6DAA6D;AAC7D,MAAM,UAAU,gCAAgC,CAC9C,KAAgB,EAChB,QAA8B;IAE9B,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3E,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA6B,CAAC;IACtD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,wEAAwE;AACxE,SAAS,aAAa,CAAC,KAAgB;IACrC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;IACJ,MAAM,SAAS,GAAG,sBAAsB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACzD,IAAI,CAAC,SAAS;QACZ,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;IACJ,MAAM,KAAK,GAAG,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,sBAAsB,CAAC,SAAS,EAAE,cAAc,CAAC,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