@webpieces/nx-webpieces-rules 0.4.883 → 0.4.885

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 (45) hide show
  1. package/README.md +41 -8
  2. package/package.json +7 -7
  3. package/src/executors/visualize-runtime/executor.js +13 -1
  4. package/src/executors/visualize-runtime/executor.js.map +1 -1
  5. package/src/lib/dot-syntax.js +26 -0
  6. package/src/lib/dot-syntax.js.map +1 -1
  7. package/src/lib/graph-color-modes.d.ts +2 -1
  8. package/src/lib/graph-color-modes.js +5 -2
  9. package/src/lib/graph-color-modes.js.map +1 -1
  10. package/src/lib/graph-impact.js +1 -0
  11. package/src/lib/graph-impact.js.map +1 -1
  12. package/src/lib/graph-legend.d.ts +1 -1
  13. package/src/lib/graph-legend.js.map +1 -1
  14. package/src/lib/graph-mode-state.client.d.ts +32 -0
  15. package/src/lib/graph-mode-state.client.js +141 -0
  16. package/src/lib/graph-mode-state.client.js.map +1 -0
  17. package/src/lib/graph-page-shell.d.ts +5 -1
  18. package/src/lib/graph-page-shell.js +31 -12
  19. package/src/lib/graph-page-shell.js.map +1 -1
  20. package/src/lib/graph-render-model.d.ts +7 -5
  21. package/src/lib/graph-render-model.js +11 -8
  22. package/src/lib/graph-render-model.js.map +1 -1
  23. package/src/lib/graph-visualizer.client.d.ts +11 -46
  24. package/src/lib/graph-visualizer.client.js +103 -160
  25. package/src/lib/graph-visualizer.client.js.map +1 -1
  26. package/src/lib/graph-visualizer.js +2 -1
  27. package/src/lib/graph-visualizer.js.map +1 -1
  28. package/src/lib/runtime-details.d.ts +4 -1
  29. package/src/lib/runtime-details.js +102 -55
  30. package/src/lib/runtime-details.js.map +1 -1
  31. package/src/lib/runtime-html-page.d.ts +13 -40
  32. package/src/lib/runtime-html-page.js +96 -129
  33. package/src/lib/runtime-html-page.js.map +1 -1
  34. package/src/lib/runtime-viewer-adapter.d.ts +16 -0
  35. package/src/lib/runtime-viewer-adapter.js +58 -0
  36. package/src/lib/runtime-viewer-adapter.js.map +1 -0
  37. package/src/lib/runtime-visualizer.client.d.ts +9 -19
  38. package/src/lib/runtime-visualizer.client.js +75 -75
  39. package/src/lib/runtime-visualizer.client.js.map +1 -1
  40. package/src/lib/runtime-visualizer.d.ts +2 -16
  41. package/src/lib/runtime-visualizer.js +22 -44
  42. package/src/lib/runtime-visualizer.js.map +1 -1
  43. package/src/lib/runtime-viz-options.d.ts +19 -0
  44. package/src/lib/runtime-viz-options.js +22 -0
  45. package/src/lib/runtime-viz-options.js.map +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"graph-impact.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/graph-impact.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;;;;AAEH,iDAA0C;AAC1C,+CAAyB;AACzB,mDAA6B;AAC7B,uCAA4F;AAC5F,0DAAyE;AAEzE,+CAA2C;AAC3C,wCAAqC;AAErC,4FAA4F;AAC/E,QAAA,kBAAkB,GAAG,SAAS,CAAC;AAC/B,QAAA,mBAAmB,GAAG,wBAAwB,CAAC;AAC/C,QAAA,kBAAkB,GAAG,GAAG,0BAAkB,IAAI,2BAAmB,EAAE,CAAC;AACjF,2GAA2G;AAC3G,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,8FAA8F;AAC9F,MAAM,WAAW,GAAG,MAAM,CAAC;AAEd,QAAA,yBAAyB,GAAG,oCAAoC,CAAC;AACjE,QAAA,kBAAkB,GAC3B,uFAAuF,CAAC;AAC/E,QAAA,kBAAkB,GAAG,wBAAwB,CAAC;AAE3D,mDAAmD;AACnD,IAAY,UAKX;AALD,WAAY,UAAU;IAClB,2DAA2D;IAC3D,+BAAiB,CAAA;IACjB,2CAA2C;IAC3C,+BAAiB,CAAA;AACrB,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAED,mEAAmE;AACtD,QAAA,sB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WAAW,CAAC,MAAM,uBAAuB,MAAM,CAAC,YAAY,kBAAkB,CAC3F,CAAC;IACN,CAAC;CACJ;AAtED,sCAsEC","sourcesContent":["/**\n * Impact mode's data: what one COMPARISON's build looks like, in three shades (plus untouched grey).\n *\n * There are two comparisons, and only two (#1163). Both end at the WORKING TREE, so uncommitted and\n * untracked work counts in either:\n *\n * - BRANCH, \"Changed on this branch\": the fork point (`DiffScope.detectBase` in rules-config:\n * `git merge-base HEAD origin/main`, falling back to `main`) → working tree.\n * - COMMIT, \"Last commit\": `HEAD^` → working tree. To see what another commit changed, check it out\n * (`git checkout <hash>`) and run `pnpm arch:visualize`: nx computes `--affected` against the code\n * that is actually on disk, so nothing here ever jumps to another commit.\n *\n * Which of them exist is decided by `ImpactScopeResolver` from where HEAD is. On `main` (by BRANCH\n * NAME, so a local main with unpushed commits still counts as main) and on a detached HEAD only the\n * last commit exists — the fork point IS HEAD there, so the branch comparison would always be empty.\n * On a feature branch with commits past its fork point both exist, the branch one first. On a FRESH\n * feature branch (fork point = HEAD) only the branch one exists: falling through to \"last commit\"\n * would show main's last PR as if it were the branch's own work.\n *\n * Per comparison:\n * - BUILD INPUT is every transitive dependency of the affected set that is not itself affected:\n * `ci` dependsOn `^build`, so they must exist as build output though their inputs did not change.\n * nx restores them from cache when it has them and compiles them otherwise — which one happens is\n * not knowable here, so nothing claims it. A pure downward walk over the graph's own edges.\n * - AFFECTED is `nx show projects --affected --base=<the comparison's base> --json`, with NO\n * `--head`, so uncommitted and untracked work counts. nx already gets right everything a\n * hand-rolled diff gets wrong: lockfile and package.json changes resolved per project, root/global\n * inputs, namedInputs, implicitDependencies, nested roots and deleted files. This uses its public\n * CLI surface only, never nx internals, and never NX_BASE/NX_HEAD, whose value depends on whoever\n * launched the process.\n * - TOUCHED is the subset of that set which OWNS a changed file, by nx's own file-to-project\n * ownership (the project file map from `createProjectFileMapUsingProjectGraph`, public devkit API)\n * — never a path-prefix guess. The ownership map is computed ONCE and shared by every comparison.\n * A project whose only change is a DELETED file is not in that map (the file is gone), so it shows\n * as affected rather than touched. The changed-file list is `DiffScope.getChangedFiles`, the same\n * base→working-tree diff (with untracked files) every code rule uses.\n *\n * The answer changes per checkout, so it never goes into the committed dependencies.html or\n * dependencies.json (both stay byte-stable). It goes into a SIDECAR,\n * `architecture/.impact/dependencies.impact.js`: a plain script setting one window global,\n * `window.__WP_IMPACT__ = { scans, defaultKind }`, loaded with `<script src>` — the one way a page\n * opened straight from disk (file://) can read a neighbouring file. The directory carries its own\n * `.gitignore` containing `*`, which ignores the directory and everything in it, so a consumer repo\n * needs no gitignore edit and the PR gate's \"build left nothing uncommitted\" check never sees it.\n *\n * `architecture:visualize` scans every comparison that exists. `architecture:generate` refreshes\n * ONLY the branch comparison (`GENERATE_IMPACT_KINDS`) and never scans the last commit; on main or a\n * detached HEAD that leaves nothing to write, so it removes the sidecar and the page says to run\n * `pnpm arch:visualize`.\n *\n * Impact is a convenience. When nx or git cannot answer any comparison, NO sidecar is written (a\n * stale one is removed) and the page disables Impact with a one-line reason. It never fails\n * generation.\n */\n\nimport { spawnSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { createProjectFileMapUsingProjectGraph, createProjectGraphAsync } from '@nx/devkit';\nimport { DiffScope, ChangedFilesOptions } from '@webpieces/rules-config';\nimport type { EnhancedGraph } from './graph-sorter';\nimport { GraphNames } from './graph-names';\nimport { toError } from '../toError';\n\n/** Relative to the architecture/ directory the page lives in; the page's `<script src>`. */\nexport const IMPACT_SIDECAR_DIR = '.impact';\nexport const IMPACT_SIDECAR_FILE = 'dependencies.impact.js';\nexport const IMPACT_SIDECAR_SRC = `${IMPACT_SIDECAR_DIR}/${IMPACT_SIDECAR_FILE}`;\n/** Each nx call is capped; a slow or wedged nx disables that comparison instead of stalling generation. */\nconst NX_TIMEOUT_MS = 15000;\n/** The branch whose name means \"there is no branch comparison here, only the last commit\". */\nconst MAIN_BRANCH = 'main';\n\nexport const NOTHING_CHANGED_ON_BRANCH = 'Nothing changed on this branch yet';\nexport const ROOT_COMMIT_REASON =\n \"HEAD is the repository's first commit; there is no previous commit to compare against\";\nexport const UNCOMMITTED_SUFFIX = ' + uncommitted changes';\n\n/** Which of the two comparisons a scan answers. */\nexport enum ImpactKind {\n /** Fork point → working tree: \"Changed on this branch\". */\n BRANCH = 'branch',\n /** HEAD^ → working tree: \"Last commit\". */\n COMMIT = 'commit',\n}\n\n/** `architecture:visualize` scans every comparison that exists. */\nexport const VISUALIZE_IMPACT_KINDS: readonly ImpactKind[] = [ImpactKind.BRANCH, ImpactKind.COMMIT];\n/** `architecture:generate` refreshes the branch comparison only and never scans the last commit. */\nexport const GENERATE_IMPACT_KINDS: readonly ImpactKind[] = [ImpactKind.BRANCH];\n\n/** One scan as the sidecar carries it; the page reads `window.__WP_IMPACT__.scans`. */\nexport class ImpactReport {\n constructor(\n public readonly kind: ImpactKind,\n /** What the page says this scan compares, e.g. \"Changed on this branch (since abc1234)\". */\n public readonly label: string,\n /** The working tree had uncommitted or untracked changes (they count in the scan). */\n public readonly dirty: boolean,\n public readonly available: boolean,\n /** Why the scan is unavailable; for an available but EMPTY scan, the note the page shows. */\n public readonly reason: string,\n /** The base's short sha ('' when there is none). */\n public readonly base: string,\n /** Affected AND owning a changed file (node ids). */\n public readonly touched: string[],\n /** Affected but owning no changed file (node ids): their ci re-runs. */\n public readonly affected: string[],\n /**\n * Transitive dependencies of the affected set that are NOT affected (node ids). `ci` dependsOn\n * `^build`, so they must exist as build output although their inputs did not change: nx\n * restores them from cache when it has them and compiles them otherwise. Which of the two\n * happens is not knowable here, so the page claims neither.\n */\n public readonly buildInputs: string[],\n public readonly changedFiles: number,\n /**\n * Transitive dependencies of the TOUCHED set that are not touched themselves (node ids): the\n * Filter popover's \"Changed + dependencies\". (\"Changed + dependents\" is touched + affected,\n * which nx already computed as the dependents whose tests re-run.)\n */\n public readonly dependencies: string[],\n /**\n * Changed files no project owns (repo-relative, sorted): workspace-global inputs such as\n * pnpm-lock.yaml. When nothing is touched they are WHY everything is affected, and the\n * legend names them. Empty when nx's file ownership was unavailable — then nothing is known.\n */\n public readonly globalFiles: string[],\n ) {}\n}\n\n/** The sidecar's one global: every scan, and the one the page shows first. */\nexport class ImpactSidecarData {\n constructor(\n public readonly scans: ImpactReport[],\n public readonly defaultKind: ImpactKind,\n ) {}\n}\n\n/** A scan (or a whole plan) that could not produce an answer. */\nexport class ImpactUnavailable {\n constructor(\n public readonly reason: string,\n public readonly label: string = 'Impact',\n ) {}\n}\n\n/** One comparison to scan. `base` is a full sha; null when it does not exist (`reason` says why). */\nexport class ImpactComparison {\n constructor(\n public readonly kind: ImpactKind,\n public readonly base: string | null,\n public readonly label: string,\n public readonly dirty: boolean,\n public readonly reason: string,\n ) {}\n}\n\n/** The comparisons that exist where HEAD is, and which one the page shows first. */\nexport class ImpactPlan {\n constructor(\n public readonly comparisons: ImpactComparison[],\n public readonly defaultKind: ImpactKind,\n ) {}\n}\n\n/** The few git facts the resolver needs. Injected so specs never spawn git. */\nexport class ImpactGit {\n /** The checked-out branch's short name; null on a detached HEAD (or without git). */\n branch(root: string): string | null {\n return this.run(root, ['symbolic-ref', '--short', '-q', 'HEAD']);\n }\n\n /** The full sha `ref` names; null when it does not resolve (e.g. `HEAD^` on the first commit). */\n sha(root: string, ref: string): string | null {\n return this.run(root, ['rev-parse', '--verify', '-q', `${ref}^{commit}`]);\n }\n\n /** `git status --porcelain` is non-empty: uncommitted or untracked work. */\n dirty(root: string): boolean {\n return (this.run(root, ['status', '--porcelain']) ?? '') !== '';\n }\n\n /** HEAD's subject line ('' when unknown). */\n subject(root: string): string {\n return this.run(root, ['log', '-1', '--format=%s', 'HEAD']) ?? '';\n }\n\n /** Trimmed stdout, or null on any failure. */\n private run(root: string, args: string[]): string | null {\n const result = spawnSync('git', args, { cwd: root, encoding: 'utf8', stdio: 'pipe' });\n if (result.error !== undefined || result.status !== 0) return null;\n return result.stdout.trim();\n }\n}\n\n/**\n * Decides which comparisons exist from where HEAD is (#1163):\n *\n * | where | comparisons | default |\n * |---|---|---|\n * | `main` (by branch NAME) | last commit | last commit |\n * | detached HEAD | last commit | last commit |\n * | feature branch with commits past the fork point | branch, last commit | branch |\n * | fresh feature branch (fork point = HEAD) | branch | branch |\n *\n * HEAD with no parent leaves the last commit unavailable, with `ROOT_COMMIT_REASON`.\n */\nexport class ImpactScopeResolver {\n constructor(\n private readonly git: ImpactGit = new ImpactGit(),\n private readonly diffScope: DiffScope = new DiffScope(),\n ) {}\n\n resolve(root: string): ImpactPlan | ImpactUnavailable {\n const head = this.git.sha(root, 'HEAD');\n if (head === null) return new ImpactUnavailable('git cannot resolve HEAD (not a git checkout, or git is unavailable)');\n const branch = this.git.branch(root);\n const dirty = this.git.dirty(root);\n const commit = this.lastCommit(root, dirty);\n // On main the decision is the branch NAME, never merge-base: unpushed commits still mean \"last commit\".\n if (branch === null || branch === MAIN_BRANCH) return new ImpactPlan([commit], ImpactKind.COMMIT);\n const fork = this.diffScope.detectBase(root);\n if (fork === null) {\n const reason = 'no fork point: neither origin/main nor main resolves';\n return new ImpactPlan(\n [new ImpactComparison(ImpactKind.BRANCH, null, 'Changed on this branch', dirty, reason)],\n ImpactKind.BRANCH,\n );\n }\n const onBranch = new ImpactComparison(\n ImpactKind.BRANCH,\n fork,\n `Changed on this branch (since ${this.short(fork)})${dirty ? UNCOMMITTED_SUFFIX : ''}`,\n dirty,\n '',\n );\n // A fresh branch has no commit of its own: \"last commit\" would be main's last PR, not its work.\n if (this.sameCommit(fork, head)) return new ImpactPlan([onBranch], ImpactKind.BRANCH);\n return new ImpactPlan([onBranch, commit], ImpactKind.BRANCH);\n }\n\n private lastCommit(root: string, dirty: boolean): ImpactComparison {\n const parent = this.git.sha(root, 'HEAD^');\n if (parent === null) return new ImpactComparison(ImpactKind.COMMIT, null, 'Last commit', dirty, ROOT_COMMIT_REASON);\n const subject = this.git.subject(root);\n const label =\n `Changed since ${this.short(parent)}${subject === '' ? '' : ` — ${subject}`}` +\n (dirty ? UNCOMMITTED_SUFFIX : '');\n return new ImpactComparison(ImpactKind.COMMIT, parent, label, dirty, '');\n }\n\n /** detectBase may hand back a full or an abbreviated sha; compare on the shorter of the two. */\n private sameCommit(a: string, b: string): boolean {\n const length = Math.min(a.length, b.length);\n return length > 0 && a.slice(0, length) === b.slice(0, length);\n }\n\n private short(sha: string): string {\n return sha.slice(0, 7);\n }\n}\n\n/** Runs the workspace's own nx CLI. Injected so specs never spawn nx. */\nexport class NxCli {\n /** stdout, or null when nx cannot be found, exits non-zero or exceeds the timeout. */\n run(workspaceRoot: string, args: string[], timeoutMs: number): string | null {\n const bin = this.binary(workspaceRoot);\n if (bin === null) return null;\n const result = spawnSync(process.execPath, [bin, ...args], {\n cwd: workspaceRoot,\n encoding: 'utf8',\n timeout: timeoutMs,\n stdio: 'pipe',\n maxBuffer: 16 * 1024 * 1024,\n });\n if (result.error !== undefined || result.status !== 0) return null;\n return result.stdout;\n }\n\n /** Resolved the way node would from the workspace, so a linked worktree finds its main tree's nx. */\n private binary(workspaceRoot: string): string | null {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- a workspace without nx resolves nothing; that is an answer, not an error\n try {\n return require.resolve('nx/bin/nx.js', { paths: [workspaceRoot] });\n } catch (err: unknown) {\n const error = toError(err);\n void error; // no nx installed here — Impact is simply unavailable\n return null;\n }\n }\n}\n\n/** nx's own file → project ownership, from the public devkit file map. Injected for specs. */\nexport class ProjectFileOwners {\n async owners(): Promise<Map<string, string>> {\n const fileMap = await createProjectFileMapUsingProjectGraph(await createProjectGraphAsync());\n const owners = new Map<string, string>();\n for (const project of Object.keys(fileMap)) {\n for (const data of fileMap[project]) owners.set(data.file, project);\n }\n return owners;\n }\n}\n\n/**\n * nx's ownership map, computed at most ONCE however many comparisons ask for it. Failing is not\n * fatal: the set then shows in one shade, all \"affected\".\n */\nexport class SharedOwners {\n private pending: Promise<Map<string, string>> | null = null;\n\n constructor(private readonly ownership: ProjectFileOwners) {}\n\n get(): Promise<Map<string, string>> {\n if (this.pending === null) this.pending = this.load();\n return this.pending;\n }\n\n private async load(): Promise<Map<string, string>> {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- the second shade is optional\n try {\n return await this.ownership.owners();\n } catch (err: unknown) {\n const error = toError(err);\n console.warn(`⚠️ Impact: nx file ownership unavailable (${error.message}); showing one shade`);\n return new Map<string, string>();\n }\n }\n}\n\n/** The sets one scan found; an empty one is still an answer. */\nclass ImpactSets {\n constructor(\n public readonly touched: string[] = [],\n public readonly affected: string[] = [],\n public readonly buildInputs: string[] = [],\n public readonly dependencies: string[] = [],\n public readonly globalFiles: string[] = [],\n ) {}\n}\n\nexport class NxImpactScanner {\n private readonly names = new GraphNames();\n\n constructor(\n private readonly diffScope: DiffScope = new DiffScope(),\n private readonly nx: NxCli = new NxCli(),\n private readonly ownership: ProjectFileOwners = new ProjectFileOwners(),\n ) {}\n\n /** Every comparison, in order, sharing one ownership map. */\n async scanAll(\n workspaceRoot: string,\n graph: EnhancedGraph,\n comparisons: ImpactComparison[],\n ): Promise<(ImpactReport | ImpactUnavailable)[]> {\n const owners = new SharedOwners(this.ownership);\n const results: (ImpactReport | ImpactUnavailable)[] = [];\n for (const comparison of comparisons) results.push(await this.scan(workspaceRoot, graph, comparison, owners));\n return results;\n }\n\n /** One comparison: nx affected from ITS base, with NO `--head`, so uncommitted work counts. */\n async scan(\n workspaceRoot: string,\n graph: EnhancedGraph,\n comparison: ImpactComparison,\n owners: SharedOwners = new SharedOwners(this.ownership),\n ): Promise<ImpactReport | ImpactUnavailable> {\n const base = comparison.base;\n if (base === null) return this.report(comparison, false, comparison.reason, '', 0, new ImpactSets());\n const json = this.nx.run(workspaceRoot, ['show', 'projects', '--affected', `--base=${base}`, '--json'], NX_TIMEOUT_MS);\n if (json === null)\n return new ImpactUnavailable(`nx show projects --affected failed or took over ${NX_TIMEOUT_MS / 1000}s`, comparison.label);\n const affectedSet = this.parse(json, graph);\n if (affectedSet === null)\n return new ImpactUnavailable('nx show projects --affected printed something other than a JSON list', comparison.label);\n const options = new ChangedFilesOptions();\n options.tsOnly = false;\n options.includeDeletions = true;\n const files = this.diffScope.getChangedFiles(workspaceRoot, base, undefined, options);\n const short = base.slice(0, 7);\n if (affectedSet.length === 0)\n return this.report(comparison, true, this.emptyNote(comparison, files.length, short), short, files.length, new ImpactSets());\n const map = await owners.get();\n const touched = this.touched(affectedSet, files, map);\n const rest = affectedSet.filter((project: string): boolean => !touched.includes(project));\n const sets = new ImpactSets(\n this.ids(touched),\n this.ids(rest),\n this.ids(this.buildInputs(affectedSet, graph)),\n this.ids(this.buildInputs(touched, graph)),\n this.globalFiles(files, map),\n );\n return this.report(comparison, true, '', short, files.length, sets);\n }\n\n /**\n * An empty scan is still an ANSWER (available, zero sets): a fresh branch with a clean tree has\n * simply changed nothing yet, and the page says so instead of disabling Impact.\n */\n emptyNote(comparison: ImpactComparison, changedFiles: number, short: string): string {\n if (changedFiles === 0 && comparison.kind === ImpactKind.BRANCH) return NOTHING_CHANGED_ON_BRANCH;\n if (changedFiles === 0) return `Nothing changed since ${short}`;\n return `Nothing affected since ${short}`;\n }\n\n /** Changed files no project owns; none are claimed when ownership itself was unavailable. */\n globalFiles(files: string[], owners: Map<string, string>): string[] {\n if (owners.size === 0) return [];\n return files.filter((file: string): boolean => !owners.has(file)).sort();\n }\n\n /**\n * Every transitive dependency of `roots` that is not itself one of them: a pure downward walk over\n * the graph's own dependsOn edges, no nx call. Of the affected set these are the build inputs; of\n * the touched set, \"Changed + dependencies\".\n */\n buildInputs(roots: string[], graph: EnhancedGraph): string[] {\n const inSet = new Set<string>(roots);\n const seen = new Set<string>(roots);\n const stack = [...roots];\n const inputs: string[] = [];\n while (stack.length > 0) {\n const project = stack.pop() as string;\n for (const dep of graph[project]?.dependsOn ?? []) {\n if (seen.has(dep)) continue;\n seen.add(dep);\n stack.push(dep);\n if (!inSet.has(dep) && graph[dep] !== undefined) inputs.push(dep);\n }\n }\n return inputs.sort();\n }\n\n /** Affected projects that own one of the changed files, by nx's own ownership. */\n touched(affected: string[], files: string[], owners: Map<string, string>): string[] {\n const owning = new Set<string>();\n for (const file of files) {\n const owner = owners.get(file);\n if (owner !== undefined) owning.add(owner);\n }\n return affected.filter((project: string): boolean => owning.has(project));\n }\n\n /** The JSON list, narrowed to projects the graph draws; null when it is not a list of names. */\n parse(json: string, graph: EnhancedGraph): string[] | null {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- untrusted CLI output; anything unparseable is reported as a reason\n try {\n // webpieces-disable no-any-unknown -- CLI JSON is untrusted until narrowed below\n const parsed: unknown = JSON.parse(json);\n if (!Array.isArray(parsed)) return null;\n return parsed\n .filter((name: unknown): name is string => typeof name === 'string' && graph[name] !== undefined)\n .sort();\n } catch (err: unknown) {\n const error = toError(err);\n void error; // not JSON — the caller reports it\n return null;\n }\n }\n\n private report(\n comparison: ImpactComparison,\n available: boolean,\n reason: string,\n base: string,\n changedFiles: number,\n sets: ImpactSets,\n ): ImpactReport {\n return new ImpactReport(\n comparison.kind,\n comparison.label,\n comparison.dirty,\n available,\n reason,\n base,\n sets.touched,\n sets.affected,\n sets.buildInputs,\n changedFiles,\n sets.dependencies,\n sets.globalFiles,\n );\n }\n\n private ids(projects: string[]): string[] {\n return projects.map((project: string): string => this.names.getNodeId(project));\n }\n}\n\n/** Writes (or removes) the sidecar, self-ignored, beside architecture/dependencies.html. */\nexport class ImpactSidecar {\n /** Never throws: a sidecar that cannot be written just leaves Impact disabled on the page. */\n write(architectureDir: string, data: ImpactSidecarData): string | null {\n const dir = path.join(architectureDir, IMPACT_SIDECAR_DIR);\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- impact is optional; a write failure must never fail generation\n try {\n fs.mkdirSync(dir, { recursive: true });\n fs.writeFileSync(\n path.join(dir, '.gitignore'),\n '# Written by architecture:generate and architecture:visualize. Per-checkout data: never commit it.\\n*\\n',\n 'utf-8',\n );\n const file = path.join(dir, IMPACT_SIDECAR_FILE);\n fs.writeFileSync(file, this.script(data), 'utf-8');\n return file;\n } catch (err: unknown) {\n const error = toError(err);\n console.warn(`⚠️ Could not write the impact sidecar: ${error.message}`);\n return null;\n }\n }\n\n /** A stale sidecar from an earlier checkout must never be shown as this one's impact. */\n remove(architectureDir: string): void {\n fs.rmSync(path.join(architectureDir, IMPACT_SIDECAR_DIR, IMPACT_SIDECAR_FILE), { force: true });\n }\n\n script(data: ImpactSidecarData): string {\n const json = JSON.stringify(data).replace(/</g, '\\\\u003c');\n return `// Generated by architecture:generate or architecture:visualize for one checkout. Gitignored; do not commit.\\nwindow.__WP_IMPACT__ = ${json};\\n`;\n }\n}\n\n/** The executors' one call: resolve, scan each comparison, write, and report one line per comparison. */\nexport class ImpactRefresh {\n constructor(\n private readonly scanner: NxImpactScanner = new NxImpactScanner(),\n private readonly sidecar: ImpactSidecar = new ImpactSidecar(),\n private readonly resolver: ImpactScopeResolver = new ImpactScopeResolver(),\n ) {}\n\n /**\n * Scans the comparisons in `kinds` that exist here (`VISUALIZE_IMPACT_KINDS` /\n * `GENERATE_IMPACT_KINDS`). Never throws — Impact is optional, generation is not.\n */\n async run(\n architectureDir: string,\n workspaceRoot: string,\n graph: EnhancedGraph,\n kinds: readonly ImpactKind[],\n ): Promise<string> {\n const started = Date.now();\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- impact is optional; any failure becomes a reason, never a failed generation\n try {\n const plan = this.resolver.resolve(workspaceRoot);\n if (plan instanceof ImpactUnavailable) return this.none(architectureDir, plan.reason, started);\n const comparisons = plan.comparisons.filter(\n (comparison: ImpactComparison): boolean => kinds.includes(comparison.kind),\n );\n if (comparisons.length === 0)\n return this.none(\n architectureDir,\n 'no Changed-on-this-branch comparison on main or a detached HEAD; pnpm arch:visualize shows the last commit',\n started,\n );\n const results = await this.scanner.scanAll(workspaceRoot, graph, comparisons);\n const lines = results.map((result: ImpactReport | ImpactUnavailable): string => this.line(result));\n const scans = results.filter(\n (result: ImpactReport | ImpactUnavailable): result is ImpactReport => result instanceof ImpactReport,\n );\n const cost = `${Date.now() - started} ms`;\n if (scans.length === 0) {\n this.sidecar.remove(architectureDir);\n return [...lines, `ℹ️ Impact disabled, no sidecar written (${cost})`].join('\\n');\n }\n const file = this.sidecar.write(architectureDir, new ImpactSidecarData(scans, this.defaultKind(scans, plan.defaultKind)));\n return [...lines, file === null ? `⚠️ Impact sidecar not written (${cost})` : `→ ${file} (${cost})`].join('\\n');\n } catch (err: unknown) {\n const error = toError(err);\n return `⚠️ Impact skipped: ${error.message}`;\n }\n }\n\n /** The plan's default when that scan is available, else the first available one. */\n private defaultKind(scans: ImpactReport[], preferred: ImpactKind): ImpactKind {\n const usable = scans.filter((scan: ImpactReport): boolean => scan.available);\n if (usable.length === 0 || usable.some((scan: ImpactReport): boolean => scan.kind === preferred)) return preferred;\n return usable[0].kind;\n }\n\n private none(architectureDir: string, reason: string, started: number): string {\n this.sidecar.remove(architectureDir);\n return `ℹ️ Impact disabled, no sidecar written: ${reason} (${Date.now() - started} ms)`;\n }\n\n private line(result: ImpactReport | ImpactUnavailable): string {\n if (result instanceof ImpactUnavailable || !result.available)\n return `ℹ️ Impact · ${result.label}: unavailable — ${result.reason}`;\n if (result.reason !== '') return `✅ Impact · ${result.label}: ${result.reason}`;\n return (\n `✅ Impact · ${result.label}: ${result.touched.length} changed · ${result.affected.length} dependents · ` +\n `${result.buildInputs.length} dependencies, from ${result.changedFiles} changed file(s)`\n );\n }\n}\n"]}
1
+ {"version":3,"file":"graph-impact.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/graph-impact.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;;;;AAEH,iDAA0C;AAC1C,+CAAyB;AACzB,mDAA6B;AAC7B,uCAA4F;AAC5F,0DAAyE;AAEzE,+CAA2C;AAC3C,wCAAqC;AAErC,4FAA4F;AAC/E,QAAA,kBAAkB,GAAG,SAAS,CAA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Ac,EAAE,OAAe;QACjE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACrC,OAAO,4CAA4C,MAAM,KAAK,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,MAAM,CAAC;IAC7F,CAAC;IAEO,IAAI,CAAC,MAAwC;QACjD,IAAI,MAAM,YAAY,iBAAiB,IAAI,CAAC,MAAM,CAAC,SAAS;YACxD,OAAO,gBAAgB,MAAM,CAAC,KAAK,mBAAmB,MAAM,CAAC,MAAM,EAAE,CAAC;QAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE;YAAE,OAAO,cAAc,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;QAChF,OAAO,CACH,cAAc,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,OAAO,CAAC,MAAM,cAAc,MAAM,CAAC,QAAQ,CAAC,MAAM,gBAAgB;YACxG,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,uBAAuB,MAAM,CAAC,YAAY,kBAAkB,CAC3F,CAAC;IACN,CAAC;CACJ;AAvED,sCAuEC","sourcesContent":["/**\n * Impact mode's data: what one COMPARISON's build looks like, in three shades (plus untouched grey).\n *\n * There are two comparisons, and only two (#1163). Both end at the WORKING TREE, so uncommitted and\n * untracked work counts in either:\n *\n * - BRANCH, \"Changed on this branch\": the fork point (`DiffScope.detectBase` in rules-config:\n * `git merge-base HEAD origin/main`, falling back to `main`) → working tree.\n * - COMMIT, \"Last commit\": `HEAD^` → working tree. To see what another commit changed, check it out\n * (`git checkout <hash>`) and run `pnpm arch:visualize`: nx computes `--affected` against the code\n * that is actually on disk, so nothing here ever jumps to another commit.\n *\n * Which of them exist is decided by `ImpactScopeResolver` from where HEAD is. On `main` (by BRANCH\n * NAME, so a local main with unpushed commits still counts as main) and on a detached HEAD only the\n * last commit exists — the fork point IS HEAD there, so the branch comparison would always be empty.\n * On a feature branch with commits past its fork point both exist, the branch one first. On a FRESH\n * feature branch (fork point = HEAD) only the branch one exists: falling through to \"last commit\"\n * would show main's last PR as if it were the branch's own work.\n *\n * Per comparison:\n * - BUILD INPUT is every transitive dependency of the affected set that is not itself affected:\n * `ci` dependsOn `^build`, so they must exist as build output though their inputs did not change.\n * nx restores them from cache when it has them and compiles them otherwise — which one happens is\n * not knowable here, so nothing claims it. A pure downward walk over the graph's own edges.\n * - AFFECTED is `nx show projects --affected --base=<the comparison's base> --json`, with NO\n * `--head`, so uncommitted and untracked work counts. nx already gets right everything a\n * hand-rolled diff gets wrong: lockfile and package.json changes resolved per project, root/global\n * inputs, namedInputs, implicitDependencies, nested roots and deleted files. This uses its public\n * CLI surface only, never nx internals, and never NX_BASE/NX_HEAD, whose value depends on whoever\n * launched the process.\n * - TOUCHED is the subset of that set which OWNS a changed file, by nx's own file-to-project\n * ownership (the project file map from `createProjectFileMapUsingProjectGraph`, public devkit API)\n * — never a path-prefix guess. The ownership map is computed ONCE and shared by every comparison.\n * A project whose only change is a DELETED file is not in that map (the file is gone), so it shows\n * as affected rather than touched. The changed-file list is `DiffScope.getChangedFiles`, the same\n * base→working-tree diff (with untracked files) every code rule uses.\n *\n * The answer changes per checkout, so it never goes into the committed dependencies.html or\n * dependencies.json (both stay byte-stable). It goes into a SIDECAR,\n * `architecture/.impact/dependencies.impact.js`: a plain script setting one window global,\n * `window.__WP_IMPACT__ = { scans, defaultKind }`, loaded with `<script src>` — the one way a page\n * opened straight from disk (file://) can read a neighbouring file. The directory carries its own\n * `.gitignore` containing `*`, which ignores the directory and everything in it, so a consumer repo\n * needs no gitignore edit and the PR gate's \"build left nothing uncommitted\" check never sees it.\n *\n * `architecture:visualize` scans every comparison that exists. `architecture:generate` refreshes\n * ONLY the branch comparison (`GENERATE_IMPACT_KINDS`) and never scans the last commit; on main or a\n * detached HEAD that leaves nothing to write, so it removes the sidecar and the page says to run\n * `pnpm arch:visualize`.\n *\n * Impact is a convenience. When nx or git cannot answer any comparison, NO sidecar is written (a\n * stale one is removed) and the page disables Impact with a one-line reason. It never fails\n * generation.\n */\n\nimport { spawnSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { createProjectFileMapUsingProjectGraph, createProjectGraphAsync } from '@nx/devkit';\nimport { DiffScope, ChangedFilesOptions } from '@webpieces/rules-config';\nimport type { EnhancedGraph } from './graph-sorter';\nimport { GraphNames } from './graph-names';\nimport { toError } from '../toError';\n\n/** Relative to the architecture/ directory the page lives in; the page's `<script src>`. */\nexport const IMPACT_SIDECAR_DIR = '.impact';\nexport const IMPACT_SIDECAR_FILE = 'dependencies.impact.js';\nexport const IMPACT_SIDECAR_SRC = `${IMPACT_SIDECAR_DIR}/${IMPACT_SIDECAR_FILE}`;\n/** Each nx call is capped; a slow or wedged nx disables that comparison instead of stalling generation. */\nconst NX_TIMEOUT_MS = 15000;\n/** The branch whose name means \"there is no branch comparison here, only the last commit\". */\nconst MAIN_BRANCH = 'main';\n\nexport const NOTHING_CHANGED_ON_BRANCH = 'Nothing changed on this branch yet';\nexport const ROOT_COMMIT_REASON =\n \"HEAD is the repository's first commit; there is no previous commit to compare against\";\nexport const UNCOMMITTED_SUFFIX = ' + uncommitted changes';\n\n/** Which of the two comparisons a scan answers. */\nexport enum ImpactKind {\n /** Fork point → working tree: \"Changed on this branch\". */\n BRANCH = 'branch',\n /** HEAD^ → working tree: \"Last commit\". */\n COMMIT = 'commit',\n}\n\n/** `architecture:visualize` scans every comparison that exists. */\nexport const VISUALIZE_IMPACT_KINDS: readonly ImpactKind[] = [ImpactKind.BRANCH, ImpactKind.COMMIT];\n/** `architecture:generate` refreshes the branch comparison only and never scans the last commit. */\nexport const GENERATE_IMPACT_KINDS: readonly ImpactKind[] = [ImpactKind.BRANCH];\n\n/** One scan as the sidecar carries it; the page reads `window.__WP_IMPACT__.scans`. */\nexport class ImpactReport {\n constructor(\n public readonly kind: ImpactKind,\n /** What the page says this scan compares, e.g. \"Changed on this branch (since abc1234)\". */\n public readonly label: string,\n /** The working tree had uncommitted or untracked changes (they count in the scan). */\n public readonly dirty: boolean,\n public readonly available: boolean,\n /** Why the scan is unavailable; for an available but EMPTY scan, the note the page shows. */\n public readonly reason: string,\n /** The base's short sha ('' when there is none). */\n public readonly base: string,\n /** Affected AND owning a changed file (node ids). */\n public readonly touched: string[],\n /** Affected but owning no changed file (node ids): their ci re-runs. */\n public readonly affected: string[],\n /**\n * Transitive dependencies of the affected set that are NOT affected (node ids). `ci` dependsOn\n * `^build`, so they must exist as build output although their inputs did not change: nx\n * restores them from cache when it has them and compiles them otherwise. Which of the two\n * happens is not knowable here, so the page claims neither.\n */\n public readonly buildInputs: string[],\n public readonly changedFiles: number,\n /**\n * Transitive dependencies of the TOUCHED set that are not touched themselves (node ids): the\n * Filter popover's \"Changed + dependencies\". (\"Changed + dependents\" is touched + affected,\n * which nx already computed as the dependents whose tests re-run.)\n */\n public readonly dependencies: string[],\n /**\n * Changed files no project owns (repo-relative, sorted): workspace-global inputs such as\n * pnpm-lock.yaml. When nothing is touched they are WHY everything is affected, and the\n * legend names them. Empty when nx's file ownership was unavailable — then nothing is known.\n */\n public readonly globalFiles: string[],\n ) {}\n}\n\n/** The sidecar's one global: every scan, and the one the page shows first. */\nexport class ImpactSidecarData {\n constructor(\n public readonly scans: ImpactReport[],\n public readonly defaultKind: ImpactKind,\n ) {}\n}\n\n/** A scan (or a whole plan) that could not produce an answer. */\nexport class ImpactUnavailable {\n constructor(\n public readonly reason: string,\n public readonly label: string = 'Impact',\n ) {}\n}\n\n/** One comparison to scan. `base` is a full sha; null when it does not exist (`reason` says why). */\nexport class ImpactComparison {\n constructor(\n public readonly kind: ImpactKind,\n public readonly base: string | null,\n public readonly label: string,\n public readonly dirty: boolean,\n public readonly reason: string,\n ) {}\n}\n\n/** The comparisons that exist where HEAD is, and which one the page shows first. */\nexport class ImpactPlan {\n constructor(\n public readonly comparisons: ImpactComparison[],\n public readonly defaultKind: ImpactKind,\n ) {}\n}\n\n/** The few git facts the resolver needs. Injected so specs never spawn git. */\nexport class ImpactGit {\n /** The checked-out branch's short name; null on a detached HEAD (or without git). */\n branch(root: string): string | null {\n return this.run(root, ['symbolic-ref', '--short', '-q', 'HEAD']);\n }\n\n /** The full sha `ref` names; null when it does not resolve (e.g. `HEAD^` on the first commit). */\n sha(root: string, ref: string): string | null {\n return this.run(root, ['rev-parse', '--verify', '-q', `${ref}^{commit}`]);\n }\n\n /** `git status --porcelain` is non-empty: uncommitted or untracked work. */\n dirty(root: string): boolean {\n return (this.run(root, ['status', '--porcelain']) ?? '') !== '';\n }\n\n /** HEAD's subject line ('' when unknown). */\n subject(root: string): string {\n return this.run(root, ['log', '-1', '--format=%s', 'HEAD']) ?? '';\n }\n\n /** Trimmed stdout, or null on any failure. */\n private run(root: string, args: string[]): string | null {\n const result = spawnSync('git', args, { cwd: root, encoding: 'utf8', stdio: 'pipe' });\n if (result.error !== undefined || result.status !== 0) return null;\n return result.stdout.trim();\n }\n}\n\n/**\n * Decides which comparisons exist from where HEAD is (#1163):\n *\n * | where | comparisons | default |\n * |---|---|---|\n * | `main` (by branch NAME) | last commit | last commit |\n * | detached HEAD | last commit | last commit |\n * | feature branch with commits past the fork point | branch, last commit | branch |\n * | fresh feature branch (fork point = HEAD) | branch | branch |\n *\n * HEAD with no parent leaves the last commit unavailable, with `ROOT_COMMIT_REASON`.\n */\nexport class ImpactScopeResolver {\n constructor(\n private readonly git: ImpactGit = new ImpactGit(),\n private readonly diffScope: DiffScope = new DiffScope(),\n ) {}\n\n resolve(root: string): ImpactPlan | ImpactUnavailable {\n const head = this.git.sha(root, 'HEAD');\n if (head === null) return new ImpactUnavailable('git cannot resolve HEAD (not a git checkout, or git is unavailable)');\n const branch = this.git.branch(root);\n const dirty = this.git.dirty(root);\n const commit = this.lastCommit(root, dirty);\n // On main the decision is the branch NAME, never merge-base: unpushed commits still mean \"last commit\".\n if (branch === null || branch === MAIN_BRANCH) return new ImpactPlan([commit], ImpactKind.COMMIT);\n const fork = this.diffScope.detectBase(root);\n if (fork === null) {\n const reason = 'no fork point: neither origin/main nor main resolves';\n return new ImpactPlan(\n [new ImpactComparison(ImpactKind.BRANCH, null, 'Changed on this branch', dirty, reason)],\n ImpactKind.BRANCH,\n );\n }\n const onBranch = new ImpactComparison(\n ImpactKind.BRANCH,\n fork,\n `Changed on this branch (since ${this.short(fork)})${dirty ? UNCOMMITTED_SUFFIX : ''}`,\n dirty,\n '',\n );\n // A fresh branch has no commit of its own: \"last commit\" would be main's last PR, not its work.\n if (this.sameCommit(fork, head)) return new ImpactPlan([onBranch], ImpactKind.BRANCH);\n return new ImpactPlan([onBranch, commit], ImpactKind.BRANCH);\n }\n\n private lastCommit(root: string, dirty: boolean): ImpactComparison {\n const parent = this.git.sha(root, 'HEAD^');\n if (parent === null) return new ImpactComparison(ImpactKind.COMMIT, null, 'Last commit', dirty, ROOT_COMMIT_REASON);\n const subject = this.git.subject(root);\n const label =\n `Changed since ${this.short(parent)}${subject === '' ? '' : ` — ${subject}`}` +\n (dirty ? UNCOMMITTED_SUFFIX : '');\n return new ImpactComparison(ImpactKind.COMMIT, parent, label, dirty, '');\n }\n\n /** detectBase may hand back a full or an abbreviated sha; compare on the shorter of the two. */\n private sameCommit(a: string, b: string): boolean {\n const length = Math.min(a.length, b.length);\n return length > 0 && a.slice(0, length) === b.slice(0, length);\n }\n\n private short(sha: string): string {\n return sha.slice(0, 7);\n }\n}\n\n/** Runs the workspace's own nx CLI. Injected so specs never spawn nx. */\nexport class NxCli {\n /** stdout, or null when nx cannot be found, exits non-zero or exceeds the timeout. */\n run(workspaceRoot: string, args: string[], timeoutMs: number): string | null {\n const bin = this.binary(workspaceRoot);\n if (bin === null) return null;\n const result = spawnSync(process.execPath, [bin, ...args], {\n cwd: workspaceRoot,\n encoding: 'utf8',\n timeout: timeoutMs,\n stdio: 'pipe',\n maxBuffer: 16 * 1024 * 1024,\n });\n if (result.error !== undefined || result.status !== 0) return null;\n return result.stdout;\n }\n\n /** Resolved the way node would from the workspace, so a linked worktree finds its main tree's nx. */\n private binary(workspaceRoot: string): string | null {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- a workspace without nx resolves nothing; that is an answer, not an error\n try {\n return require.resolve('nx/bin/nx.js', { paths: [workspaceRoot] });\n } catch (err: unknown) {\n const error = toError(err);\n void error; // no nx installed here — Impact is simply unavailable\n return null;\n }\n }\n}\n\n/** nx's own file → project ownership, from the public devkit file map. Injected for specs. */\nexport class ProjectFileOwners {\n async owners(): Promise<Map<string, string>> {\n const fileMap = await createProjectFileMapUsingProjectGraph(await createProjectGraphAsync());\n const owners = new Map<string, string>();\n for (const project of Object.keys(fileMap)) {\n for (const data of fileMap[project]) owners.set(data.file, project);\n }\n return owners;\n }\n}\n\n/**\n * nx's ownership map, computed at most ONCE however many comparisons ask for it. Failing is not\n * fatal: the set then shows in one shade, all \"affected\".\n */\nexport class SharedOwners {\n private pending: Promise<Map<string, string>> | null = null;\n\n constructor(private readonly ownership: ProjectFileOwners) {}\n\n get(): Promise<Map<string, string>> {\n if (this.pending === null) this.pending = this.load();\n return this.pending;\n }\n\n private async load(): Promise<Map<string, string>> {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- the second shade is optional\n try {\n return await this.ownership.owners();\n } catch (err: unknown) {\n const error = toError(err);\n console.warn(`⚠️ Impact: nx file ownership unavailable (${error.message}); showing one shade`);\n return new Map<string, string>();\n }\n }\n}\n\n/** The sets one scan found; an empty one is still an answer. */\nclass ImpactSets {\n constructor(\n public readonly touched: string[] = [],\n public readonly affected: string[] = [],\n public readonly buildInputs: string[] = [],\n public readonly dependencies: string[] = [],\n public readonly globalFiles: string[] = [],\n ) {}\n}\n\nexport class NxImpactScanner {\n private readonly names = new GraphNames();\n\n constructor(\n private readonly diffScope: DiffScope = new DiffScope(),\n private readonly nx: NxCli = new NxCli(),\n private readonly ownership: ProjectFileOwners = new ProjectFileOwners(),\n ) {}\n\n /** Every comparison, in order, sharing one ownership map. */\n async scanAll(\n workspaceRoot: string,\n graph: EnhancedGraph,\n comparisons: ImpactComparison[],\n ): Promise<(ImpactReport | ImpactUnavailable)[]> {\n const owners = new SharedOwners(this.ownership);\n const results: (ImpactReport | ImpactUnavailable)[] = [];\n for (const comparison of comparisons) results.push(await this.scan(workspaceRoot, graph, comparison, owners));\n return results;\n }\n\n /** One comparison: nx affected from ITS base, with NO `--head`, so uncommitted work counts. */\n async scan(\n workspaceRoot: string,\n graph: EnhancedGraph,\n comparison: ImpactComparison,\n owners: SharedOwners = new SharedOwners(this.ownership),\n ): Promise<ImpactReport | ImpactUnavailable> {\n const base = comparison.base;\n if (base === null) return this.report(comparison, false, comparison.reason, '', 0, new ImpactSets());\n const json = this.nx.run(workspaceRoot, ['show', 'projects', '--affected', `--base=${base}`, '--json'], NX_TIMEOUT_MS);\n if (json === null)\n return new ImpactUnavailable(`nx show projects --affected failed or took over ${NX_TIMEOUT_MS / 1000}s`, comparison.label);\n const affectedSet = this.parse(json, graph);\n if (affectedSet === null)\n return new ImpactUnavailable('nx show projects --affected printed something other than a JSON list', comparison.label);\n const options = new ChangedFilesOptions();\n options.tsOnly = false;\n options.includeDeletions = true;\n const files = this.diffScope.getChangedFiles(workspaceRoot, base, undefined, options);\n const short = base.slice(0, 7);\n if (affectedSet.length === 0)\n return this.report(comparison, true, this.emptyNote(comparison, files.length, short), short, files.length, new ImpactSets());\n const map = await owners.get();\n const touched = this.touched(affectedSet, files, map);\n const rest = affectedSet.filter((project: string): boolean => !touched.includes(project));\n const sets = new ImpactSets(\n this.ids(touched),\n this.ids(rest),\n this.ids(this.buildInputs(affectedSet, graph)),\n this.ids(this.buildInputs(touched, graph)),\n this.globalFiles(files, map),\n );\n return this.report(comparison, true, '', short, files.length, sets);\n }\n\n /**\n * An empty scan is still an ANSWER (available, zero sets): a fresh branch with a clean tree has\n * simply changed nothing yet, and the page says so instead of disabling Impact.\n */\n emptyNote(comparison: ImpactComparison, changedFiles: number, short: string): string {\n if (changedFiles === 0 && comparison.kind === ImpactKind.BRANCH) return NOTHING_CHANGED_ON_BRANCH;\n if (changedFiles === 0) return `Nothing changed since ${short}`;\n return `Nothing affected since ${short}`;\n }\n\n /** Changed files no project owns; none are claimed when ownership itself was unavailable. */\n globalFiles(files: string[], owners: Map<string, string>): string[] {\n if (owners.size === 0) return [];\n return files.filter((file: string): boolean => !owners.has(file)).sort();\n }\n\n /**\n * Every transitive dependency of `roots` that is not itself one of them: a pure downward walk over\n * the graph's own dependsOn edges, no nx call. Of the affected set these are the build inputs; of\n * the touched set, \"Changed + dependencies\".\n */\n buildInputs(roots: string[], graph: EnhancedGraph): string[] {\n const inSet = new Set<string>(roots);\n const seen = new Set<string>(roots);\n const stack = [...roots];\n const inputs: string[] = [];\n while (stack.length > 0) {\n const project = stack.pop() as string;\n for (const dep of graph[project]?.dependsOn ?? []) {\n if (seen.has(dep)) continue;\n seen.add(dep);\n stack.push(dep);\n if (!inSet.has(dep) && graph[dep] !== undefined) inputs.push(dep);\n }\n }\n return inputs.sort();\n }\n\n /** Affected projects that own one of the changed files, by nx's own ownership. */\n touched(affected: string[], files: string[], owners: Map<string, string>): string[] {\n const owning = new Set<string>();\n for (const file of files) {\n const owner = owners.get(file);\n if (owner !== undefined) owning.add(owner);\n }\n return affected.filter((project: string): boolean => owning.has(project));\n }\n\n /** The JSON list, narrowed to projects the graph draws; null when it is not a list of names. */\n parse(json: string, graph: EnhancedGraph): string[] | null {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- untrusted CLI output; anything unparseable is reported as a reason\n try {\n // webpieces-disable no-any-unknown -- CLI JSON is untrusted until narrowed below\n const parsed: unknown = JSON.parse(json);\n if (!Array.isArray(parsed)) return null;\n return parsed\n .filter((name: unknown): name is string => typeof name === 'string' && graph[name] !== undefined)\n .sort();\n } catch (err: unknown) {\n const error = toError(err);\n void error; // not JSON — the caller reports it\n return null;\n }\n }\n\n private report(\n comparison: ImpactComparison,\n available: boolean,\n reason: string,\n base: string,\n changedFiles: number,\n sets: ImpactSets,\n ): ImpactReport {\n return new ImpactReport(\n comparison.kind,\n comparison.label,\n comparison.dirty,\n available,\n reason,\n base,\n sets.touched,\n sets.affected,\n sets.buildInputs,\n changedFiles,\n sets.dependencies,\n sets.globalFiles,\n );\n }\n\n private ids(projects: string[]): string[] {\n return projects.map((project: string): string => this.names.getNodeId(project));\n }\n}\n\n/** Writes (or removes) the sidecar, self-ignored, beside architecture/dependencies.html. */\nexport class ImpactSidecar {\n /** Never throws: a sidecar that cannot be written just leaves Impact disabled on the page. */\n write(architectureDir: string, data: ImpactSidecarData): string | null {\n const dir = path.join(architectureDir, IMPACT_SIDECAR_DIR);\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- impact is optional; a write failure must never fail generation\n try {\n fs.mkdirSync(dir, { recursive: true });\n fs.writeFileSync(\n path.join(dir, '.gitignore'),\n '# Written by architecture:generate and architecture:visualize. Per-checkout data: never commit it.\\n*\\n',\n 'utf-8',\n );\n const file = path.join(dir, IMPACT_SIDECAR_FILE);\n fs.writeFileSync(file, this.script(data), 'utf-8');\n return file;\n } catch (err: unknown) {\n const error = toError(err);\n console.warn(`⚠️ Could not write the impact sidecar: ${error.message}`);\n return null;\n }\n }\n\n /** A stale sidecar from an earlier checkout must never be shown as this one's impact. */\n remove(architectureDir: string): void {\n fs.rmSync(path.join(architectureDir, IMPACT_SIDECAR_DIR, IMPACT_SIDECAR_FILE), { force: true });\n }\n\n script(data: ImpactSidecarData): string {\n const json = JSON.stringify(data).replace(/</g, '\\\\u003c');\n return `// Generated by architecture:generate or architecture:visualize for one checkout. Gitignored; do not commit.\\nwindow.__WP_IMPACT__ = ${json};\\n`;\n }\n}\n\n/** The executors' one call: resolve, scan each comparison, write, and report one line per comparison. */\nexport class ImpactRefresh {\n constructor(\n private readonly scanner: NxImpactScanner = new NxImpactScanner(),\n private readonly sidecar: ImpactSidecar = new ImpactSidecar(),\n private readonly resolver: ImpactScopeResolver = new ImpactScopeResolver(),\n ) {}\n\n /**\n * Scans the comparisons in `kinds` that exist here (`VISUALIZE_IMPACT_KINDS` /\n * `GENERATE_IMPACT_KINDS`). Never throws — Impact is optional, generation is not.\n */\n async run(\n architectureDir: string,\n workspaceRoot: string,\n graph: EnhancedGraph,\n kinds: readonly ImpactKind[],\n ): Promise<string> {\n const started = Date.now();\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- impact is optional; any failure becomes a reason, never a failed generation\n try {\n const plan = this.resolver.resolve(workspaceRoot);\n if (plan instanceof ImpactUnavailable) return this.none(architectureDir, plan.reason, started);\n const comparisons = plan.comparisons.filter(\n (comparison: ImpactComparison): boolean => kinds.includes(comparison.kind),\n );\n if (comparisons.length === 0)\n return this.none(\n architectureDir,\n 'no Changed-on-this-branch comparison on main or a detached HEAD; pnpm arch:visualize shows the last commit',\n started,\n );\n const results = await this.scanner.scanAll(workspaceRoot, graph, comparisons);\n const lines = results.map((result: ImpactReport | ImpactUnavailable): string => this.line(result));\n const scans = results.filter(\n (result: ImpactReport | ImpactUnavailable): result is ImpactReport => result instanceof ImpactReport,\n );\n const cost = `${Date.now() - started} ms`;\n if (scans.length === 0) {\n this.sidecar.remove(architectureDir);\n return [...lines, `ℹ️ Impact disabled, no sidecar written (${cost})`].join('\\n');\n }\n const file = this.sidecar.write(architectureDir, new ImpactSidecarData(scans, this.defaultKind(scans, plan.defaultKind)));\n return [...lines, file === null ? `⚠️ Impact sidecar not written (${cost})` : `→ ${file} (${cost})`].join('\\n');\n } catch (err: unknown) {\n const error = toError(err);\n this.sidecar.remove(architectureDir);\n return `⚠️ Impact skipped: ${error.message}`;\n }\n }\n\n /** The plan's default when that scan is available, else the first available one. */\n private defaultKind(scans: ImpactReport[], preferred: ImpactKind): ImpactKind {\n const usable = scans.filter((scan: ImpactReport): boolean => scan.available);\n if (usable.length === 0 || usable.some((scan: ImpactReport): boolean => scan.kind === preferred)) return preferred;\n return usable[0].kind;\n }\n\n private none(architectureDir: string, reason: string, started: number): string {\n this.sidecar.remove(architectureDir);\n return `ℹ️ Impact disabled, no sidecar written: ${reason} (${Date.now() - started} ms)`;\n }\n\n private line(result: ImpactReport | ImpactUnavailable): string {\n if (result instanceof ImpactUnavailable || !result.available)\n return `ℹ️ Impact · ${result.label}: unavailable — ${result.reason}`;\n if (result.reason !== '') return `✅ Impact · ${result.label}: ${result.reason}`;\n return (\n `✅ Impact · ${result.label}: ${result.touched.length} changed · ${result.affected.length} dependents · ` +\n `${result.buildInputs.length} dependencies, from ${result.changedFiles} changed file(s)`\n );\n }\n}\n"]}
@@ -23,7 +23,7 @@ export declare class GraphLegend {
23
23
  * Which box is which is only known from the branch's sidecar, so all four rows always show. The
24
24
  * words are the Filter's (#1179): changed · dependent · dependency · not in this build.
25
25
  */
26
- private impactRows;
26
+ impactRows(): string;
27
27
  /**
28
28
  * Product mode (#1179): one row per product with its counts, then the shared, several-products and
29
29
  * no-product rows that some drawn box actually uses.
@@ -1 +1 @@
1
- {"version":3,"file":"graph-legend.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/graph-legend.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,oDAAwE;AACxE,2DAe6B;AAC7B,qDAO0B;AAE1B,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB,MAAa,WAAW;IACpB,+FAA+F;IAC/F,QAAQ,CAAC,KAAkB;QACvB,OAAO,CACH,IAAI,CAAC,OAAO,CAAC,6BAAS,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;YAC/D,IAAI,CAAC,OAAO,CAAC,6BAAS,CAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;YACxE,IAAI,CAAC,OAAO,CAAC,6BAAS,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC;YACvD,IAAI,CAAC,OAAO,CAAC,6BAA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AK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACJ;AAzLD,kCAyLC","sourcesContent":["/**\n * The architecture graph's legend, generated per color mode FROM THE PROJECTS ACTUALLY DRAWN.\n *\n * The hand-written legend this replaces listed five frameworks when six existed and never mentioned\n * the `app` and `bundle` borders the renderer drew (#1155). Generating the rows from the same tables\n * the renderer colors with (graph-color-modes.ts) means a color in use always has a row, and a color\n * nothing uses never does.\n *\n * Swatches are inline SVG drawn with presentation attributes, never `style=`, so the page carries\n * no inline CSS.\n */\n\nimport { KNOWN_FRAMEWORKS, KnownFramework } from '@webpieces/rules-sdk';\nimport {\n BASE_ORDER,\n FRAMEWORK_STYLES,\n FrameworkStyle,\n GraphMode,\n IMPACT_AFFECTED,\n IMPACT_BUILD_INPUT,\n IMPACT_BUILD_INPUT_BORDER,\n IMPACT_TOUCHED,\n IMPACT_UNTOUCHED,\n LegendFacts,\n NO_RUNTIME_COLOR,\n ProductCount,\n ROLE_STYLES,\n RoleStyle,\n} from './graph-color-modes';\nimport {\n PRODUCT_NONE_BORDER,\n PRODUCT_NONE_FILL,\n PRODUCT_PALETTE_SIZE,\n PRODUCT_SHARED_FILL,\n ProductColor,\n ProductPalette,\n} from './graph-products';\n\nconst SWATCH_W = 26;\nconst SWATCH_H = 16;\nconst FRAME = '#3a3c46';\n\nexport class GraphLegend {\n /** One section per mode; the page shows the section of the current mode and hides the rest. */\n sections(facts: LegendFacts): string {\n return (\n this.section(GraphMode.RUNTIME, this.runtimeRows(facts), false) +\n this.section(GraphMode.ARCHITECTURE, this.architectureRows(facts), true) +\n this.section(GraphMode.IMPACT, this.impactRows(), true) +\n this.section(GraphMode.PRODUCT, this.productRows(facts), true)\n );\n }\n\n /** The edge key: why a line exists. Static — every graph can carry every edge kind. */\n edgeKey(): string {\n return (\n '<div class=\"wp-legend-list\">' +\n this.edgeRow('#e9eaf0', '', 'uses', 'calls the API, or a plain library import') +\n this.edgeRow('#e9eaf0', '4 3', 'implements', 'serves the API (labeled with its contracts)') +\n this.edgeRow('#7aa2ff', '4 3', 'uses + implements', 'implements some contracts, uses others') +\n '</div>'\n );\n }\n\n private section(mode: GraphMode, rows: string, hidden: boolean): string {\n const hide = hidden ? ' hidden' : '';\n return `<div class=\"wp-legend-list\" data-wp-legend-mode=\"${mode}\"${hide}>${rows}</div>`;\n }\n\n /** Base runtimes first (stripe order), then specializations, in the shared vocabulary's order. */\n runtimeRows(facts: LegendFacts): string {\n const present = (framework: KnownFramework): boolean => facts.frameworks.includes(framework);\n const ordered: FrameworkStyle[] = [\n ...BASE_ORDER.map((base: KnownFramework): FrameworkStyle => FRAMEWORK_STYLES[base]),\n ...KNOWN_FRAMEWORKS.map((f: KnownFramework): FrameworkStyle => FRAMEWORK_STYLES[f]).filter(\n (style: FrameworkStyle): boolean => !style.isBase(),\n ),\n ];\n let rows = '';\n for (const style of ordered) {\n if (!present(style.framework)) continue;\n rows += this.row(style.framework, this.envSwatch(style), style.framework, style.description);\n }\n if (facts.multiRuntime)\n rows += this.row('multi', this.stripesSwatch(), 'several runtimes', 'one equal stripe per runtime');\n if (facts.noRuntime)\n rows += this.row('none', this.solid(NO_RUNTIME_COLOR, '', ''), 'no framework tag', 'runs nowhere declared');\n return rows;\n }\n\n architectureRows(facts: LegendFacts): string {\n let rows = '';\n for (const style of ROLE_STYLES) {\n if (!facts.roles.includes(style.role)) continue;\n rows += this.row(style.role, this.roleSwatch(style), style.role, style.description);\n }\n return rows;\n }\n\n /**\n * Which box is which is only known from the branch's sidecar, so all four rows always show. The\n * words are the Filter's (#1179): changed · dependent · dependency · not in this build.\n */\n private impactRows(): string {\n return (\n this.row('touched', this.solid(IMPACT_TOUCHED, '', ''), 'changed', 'owns a changed file') +\n this.row(\n 'affected',\n this.solid(IMPACT_AFFECTED, IMPACT_TOUCHED, ''),\n 'dependent',\n 'uses a changed project: its tests and build re-run',\n ) +\n this.row(\n 'build-input',\n this.solid(IMPACT_BUILD_INPUT, IMPACT_BUILD_INPUT_BORDER, '3 2'),\n 'dependency (built, unchanged)',\n 'compiled or restored from cache for this build',\n ) +\n this.row('untouched', this.solid(IMPACT_UNTOUCHED, '', ''), 'not in this build', 'nothing here changed or depends on a change') +\n '<p class=\"wp-impact-note\" data-wp-impact-note></p>'\n );\n }\n\n /**\n * Product mode (#1179): one row per product with its counts, then the shared, several-products and\n * no-product rows that some drawn box actually uses.\n */\n productRows(facts: LegendFacts): string {\n if (facts.products.length === 0)\n return this.row(\n 'no-products',\n this.solid(PRODUCT_NONE_FILL, PRODUCT_NONE_BORDER, '3 2'),\n 'no products declared',\n 'tag servers, clients and apps product:<name> to see each product',\n );\n const palette = new ProductPalette(facts.products.map((count: ProductCount): string => count.product));\n let rows = '';\n for (const count of facts.products) {\n const color = palette.colorOf(count.product);\n const detail = color.inPalette\n ? `${count.only} only ${count.product}`\n : `${count.only} only ${count.product} — past the palette's ${PRODUCT_PALETTE_SIZE}: neutral fill`;\n rows += this.row(`product:${count.product}`, this.solid(color.color, '', ''), `${count.product} · ${count.total}`, detail);\n }\n if (facts.sharedByAll > 0)\n rows += this.row(\n 'shared',\n this.solid(PRODUCT_SHARED_FILL, '', ''),\n `shared by every product · ${facts.sharedByAll}`,\n 'a change here is a change to every product',\n );\n if (facts.multiProduct)\n rows += this.row('several', this.productStripes(palette), 'several products', 'one stripe per product');\n if (facts.noProduct > 0)\n rows += this.row(\n 'no-product',\n this.solid(PRODUCT_NONE_FILL, PRODUCT_NONE_BORDER, '3 2'),\n `no product · ${facts.noProduct}`,\n 'no tagged server, client or app reaches it',\n );\n return rows;\n }\n\n private row(key: string, swatch: string, title: string, detail: string): string {\n return (\n `<div class=\"wp-legend-row\" data-wp-legend=\"${key}\">${swatch}` +\n `<span>${title}<small>${detail}</small></span></div>`\n );\n }\n\n private open(): string {\n return `<svg width=\"${SWATCH_W}\" height=\"${SWATCH_H}\" viewBox=\"0 0 ${SWATCH_W} ${SWATCH_H}\" aria-hidden=\"true\">`;\n }\n\n private frame(): string {\n return `<rect x=\"0.5\" y=\"0.5\" width=\"${SWATCH_W - 1}\" height=\"${SWATCH_H - 1}\" fill=\"none\" stroke=\"${FRAME}\"/></svg>`;\n }\n\n /** A base runtime is solid; a specialization is its inset on the base color. */\n private envSwatch(style: FrameworkStyle): string {\n const base = `<rect width=\"${SWATCH_W}\" height=\"${SWATCH_H}\" fill=\"${FRAMEWORK_STYLES[style.base].color}\"/>`;\n if (style.isBase()) return this.open() + base + this.frame();\n const inset = `<rect x=\"4\" y=\"4\" width=\"${SWATCH_W - 8}\" height=\"${SWATCH_H - 8}\" rx=\"2\" fill=\"${style.color}\"/>`;\n return this.open() + base + inset + this.frame();\n }\n\n private stripesSwatch(): string {\n const width = SWATCH_W / BASE_ORDER.length;\n const stripes = BASE_ORDER.map(\n (base: KnownFramework, index: number): string =>\n `<rect x=\"${(index * width).toFixed(2)}\" width=\"${width.toFixed(2)}\" height=\"${SWATCH_H}\" fill=\"${FRAMEWORK_STYLES[base].color}\"/>`,\n ).join('');\n return this.open() + stripes + this.frame();\n }\n\n /** The first three product colors as stripes: the \"several products\" swatch. */\n private productStripes(palette: ProductPalette): string {\n const colors = palette.colors.slice(0, 3);\n const width = SWATCH_W / colors.length;\n const stripes = colors\n .map(\n (color: ProductColor, index: number): string =>\n `<rect x=\"${(index * width).toFixed(2)}\" width=\"${width.toFixed(2)}\" height=\"${SWATCH_H}\" fill=\"${color.color}\"/>`,\n )\n .join('');\n return this.open() + stripes + this.frame();\n }\n\n private roleSwatch(style: RoleStyle): string {\n return this.solid(style.fill, '', '');\n }\n\n /** A filled swatch, optionally with an inner ring (dashed when `dash` is set). */\n private solid(fill: string, outline: string, dash: string): string {\n const dashed = dash === '' ? '' : ` stroke-dasharray=\"${dash}\"`;\n const ring =\n outline === ''\n ? ''\n : `<rect x=\"2\" y=\"2\" width=\"${SWATCH_W - 4}\" height=\"${SWATCH_H - 4}\" fill=\"none\" stroke=\"${outline}\" stroke-width=\"2\"${dashed}/>`;\n return this.open() + `<rect width=\"${SWATCH_W}\" height=\"${SWATCH_H}\" fill=\"${fill}\"/>` + ring + this.frame();\n }\n\n private edgeRow(color: string, dash: string, title: string, detail: string): string {\n const dashed = dash === '' ? '' : ` stroke-dasharray=\"${dash}\"`;\n const line = `<svg width=\"28\" height=\"10\" aria-hidden=\"true\"><line x1=\"0\" y1=\"5\" x2=\"28\" y2=\"5\" stroke=\"${color}\" stroke-width=\"1.6\"${dashed}/></svg>`;\n return this.row(title, line, title, detail);\n }\n}\n"]}
1
+ {"version":3,"file":"graph-legend.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/graph-legend.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,oDAAwE;AACxE,2DAe6B;AAC7B,qDAO0B;AAE1B,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB,MAAa,WAAW;IACpB,+FAA+F;IAC/F,QAAQ,CAAC,KAAkB;QACvB,OAAO,CACH,IAAI,CAAC,OAAO,CAAC,6BAAS,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;YAC/D,IAAI,CAAC,OAAO,CAAC,6BAAS,CAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;YACxE,IAAI,CAAC,OAAO,CAAC,6BAAS,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC;YACvD,IAAI,CAAC,OAAO,CAAC,6BAAS,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CACjE,CAAC;IACN,CAAC;IAED,uFAAuF;IACvF,OAAO;QACH,OAAO,CACH,8BAA8B;YAC9B,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,EAAE,MA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AI,CAAC,EAAE,CAAC,CAAC;QACd,OAAO,IAAI,CAAC,IAAI,EAAE,GAAG,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAChD,CAAC;IAEO,UAAU,CAAC,KAAgB;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,kFAAkF;IAC1E,KAAK,CAAC,IAAY,EAAE,OAAe,EAAE,IAAY;QACrD,MAAM,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,sBAAsB,IAAI,GAAG,CAAC;QAChE,MAAM,IAAI,GACN,OAAO,KAAK,EAAE;YACV,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,4BAA4B,QAAQ,GAAG,CAAC,aAAa,QAAQ,GAAG,CAAC,yBAAyB,OAAO,qBAAqB,MAAM,IAAI,CAAC;QAC3I,OAAO,IAAI,CAAC,IAAI,EAAE,GAAG,gBAAgB,QAAQ,aAAa,QAAQ,WAAW,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IACjH,CAAC;IAEO,OAAO,CAAC,KAAa,EAAE,IAAY,EAAE,KAAa,EAAE,MAAc;QACtE,MAAM,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,sBAAsB,IAAI,GAAG,CAAC;QAChE,MAAM,IAAI,GAAG,6FAA6F,KAAK,uBAAuB,MAAM,UAAU,CAAC;QACvJ,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACJ;AAzLD,kCAyLC","sourcesContent":["/**\n * The architecture graph's legend, generated per color mode FROM THE PROJECTS ACTUALLY DRAWN.\n *\n * The hand-written legend this replaces listed five frameworks when six existed and never mentioned\n * the `app` and `bundle` borders the renderer drew (#1155). Generating the rows from the same tables\n * the renderer colors with (graph-color-modes.ts) means a color in use always has a row, and a color\n * nothing uses never does.\n *\n * Swatches are inline SVG drawn with presentation attributes, never `style=`, so the page carries\n * no inline CSS.\n */\n\nimport { KNOWN_FRAMEWORKS, KnownFramework } from '@webpieces/rules-sdk';\nimport {\n BASE_ORDER,\n FRAMEWORK_STYLES,\n FrameworkStyle,\n GraphMode,\n IMPACT_AFFECTED,\n IMPACT_BUILD_INPUT,\n IMPACT_BUILD_INPUT_BORDER,\n IMPACT_TOUCHED,\n IMPACT_UNTOUCHED,\n LegendFacts,\n NO_RUNTIME_COLOR,\n ProductCount,\n ROLE_STYLES,\n RoleStyle,\n} from './graph-color-modes';\nimport {\n PRODUCT_NONE_BORDER,\n PRODUCT_NONE_FILL,\n PRODUCT_PALETTE_SIZE,\n PRODUCT_SHARED_FILL,\n ProductColor,\n ProductPalette,\n} from './graph-products';\n\nconst SWATCH_W = 26;\nconst SWATCH_H = 16;\nconst FRAME = '#3a3c46';\n\nexport class GraphLegend {\n /** One section per mode; the page shows the section of the current mode and hides the rest. */\n sections(facts: LegendFacts): string {\n return (\n this.section(GraphMode.RUNTIME, this.runtimeRows(facts), false) +\n this.section(GraphMode.ARCHITECTURE, this.architectureRows(facts), true) +\n this.section(GraphMode.IMPACT, this.impactRows(), true) +\n this.section(GraphMode.PRODUCT, this.productRows(facts), true)\n );\n }\n\n /** The edge key: why a line exists. Static — every graph can carry every edge kind. */\n edgeKey(): string {\n return (\n '<div class=\"wp-legend-list\">' +\n this.edgeRow('#e9eaf0', '', 'uses', 'calls the API, or a plain library import') +\n this.edgeRow('#e9eaf0', '4 3', 'implements', 'serves the API (labeled with its contracts)') +\n this.edgeRow('#7aa2ff', '4 3', 'uses + implements', 'implements some contracts, uses others') +\n '</div>'\n );\n }\n\n private section(mode: GraphMode, rows: string, hidden: boolean): string {\n const hide = hidden ? ' hidden' : '';\n return `<div class=\"wp-legend-list\" data-wp-legend-mode=\"${mode}\"${hide}>${rows}</div>`;\n }\n\n /** Base runtimes first (stripe order), then specializations, in the shared vocabulary's order. */\n runtimeRows(facts: LegendFacts): string {\n const present = (framework: KnownFramework): boolean => facts.frameworks.includes(framework);\n const ordered: FrameworkStyle[] = [\n ...BASE_ORDER.map((base: KnownFramework): FrameworkStyle => FRAMEWORK_STYLES[base]),\n ...KNOWN_FRAMEWORKS.map((f: KnownFramework): FrameworkStyle => FRAMEWORK_STYLES[f]).filter(\n (style: FrameworkStyle): boolean => !style.isBase(),\n ),\n ];\n let rows = '';\n for (const style of ordered) {\n if (!present(style.framework)) continue;\n rows += this.row(style.framework, this.envSwatch(style), style.framework, style.description);\n }\n if (facts.multiRuntime)\n rows += this.row('multi', this.stripesSwatch(), 'several runtimes', 'one equal stripe per runtime');\n if (facts.noRuntime)\n rows += this.row('none', this.solid(NO_RUNTIME_COLOR, '', ''), 'no framework tag', 'runs nowhere declared');\n return rows;\n }\n\n architectureRows(facts: LegendFacts): string {\n let rows = '';\n for (const style of ROLE_STYLES) {\n if (!facts.roles.includes(style.role)) continue;\n rows += this.row(style.role, this.roleSwatch(style), style.role, style.description);\n }\n return rows;\n }\n\n /**\n * Which box is which is only known from the branch's sidecar, so all four rows always show. The\n * words are the Filter's (#1179): changed · dependent · dependency · not in this build.\n */\n impactRows(): string {\n return (\n this.row('touched', this.solid(IMPACT_TOUCHED, '', ''), 'changed', 'owns a changed file') +\n this.row(\n 'affected',\n this.solid(IMPACT_AFFECTED, IMPACT_TOUCHED, ''),\n 'dependent',\n 'uses a changed project: its tests and build re-run',\n ) +\n this.row(\n 'build-input',\n this.solid(IMPACT_BUILD_INPUT, IMPACT_BUILD_INPUT_BORDER, '3 2'),\n 'dependency (built, unchanged)',\n 'compiled or restored from cache for this build',\n ) +\n this.row('untouched', this.solid(IMPACT_UNTOUCHED, '', ''), 'not in this build', 'nothing here changed or depends on a change') +\n '<p class=\"wp-impact-note\" data-wp-impact-note></p>'\n );\n }\n\n /**\n * Product mode (#1179): one row per product with its counts, then the shared, several-products and\n * no-product rows that some drawn box actually uses.\n */\n productRows(facts: LegendFacts): string {\n if (facts.products.length === 0)\n return this.row(\n 'no-products',\n this.solid(PRODUCT_NONE_FILL, PRODUCT_NONE_BORDER, '3 2'),\n 'no products declared',\n 'tag servers, clients and apps product:<name> to see each product',\n );\n const palette = new ProductPalette(facts.products.map((count: ProductCount): string => count.product));\n let rows = '';\n for (const count of facts.products) {\n const color = palette.colorOf(count.product);\n const detail = color.inPalette\n ? `${count.only} only ${count.product}`\n : `${count.only} only ${count.product} — past the palette's ${PRODUCT_PALETTE_SIZE}: neutral fill`;\n rows += this.row(`product:${count.product}`, this.solid(color.color, '', ''), `${count.product} · ${count.total}`, detail);\n }\n if (facts.sharedByAll > 0)\n rows += this.row(\n 'shared',\n this.solid(PRODUCT_SHARED_FILL, '', ''),\n `shared by every product · ${facts.sharedByAll}`,\n 'a change here is a change to every product',\n );\n if (facts.multiProduct)\n rows += this.row('several', this.productStripes(palette), 'several products', 'one stripe per product');\n if (facts.noProduct > 0)\n rows += this.row(\n 'no-product',\n this.solid(PRODUCT_NONE_FILL, PRODUCT_NONE_BORDER, '3 2'),\n `no product · ${facts.noProduct}`,\n 'no tagged server, client or app reaches it',\n );\n return rows;\n }\n\n private row(key: string, swatch: string, title: string, detail: string): string {\n return (\n `<div class=\"wp-legend-row\" data-wp-legend=\"${key}\">${swatch}` +\n `<span>${title}<small>${detail}</small></span></div>`\n );\n }\n\n private open(): string {\n return `<svg width=\"${SWATCH_W}\" height=\"${SWATCH_H}\" viewBox=\"0 0 ${SWATCH_W} ${SWATCH_H}\" aria-hidden=\"true\">`;\n }\n\n private frame(): string {\n return `<rect x=\"0.5\" y=\"0.5\" width=\"${SWATCH_W - 1}\" height=\"${SWATCH_H - 1}\" fill=\"none\" stroke=\"${FRAME}\"/></svg>`;\n }\n\n /** A base runtime is solid; a specialization is its inset on the base color. */\n private envSwatch(style: FrameworkStyle): string {\n const base = `<rect width=\"${SWATCH_W}\" height=\"${SWATCH_H}\" fill=\"${FRAMEWORK_STYLES[style.base].color}\"/>`;\n if (style.isBase()) return this.open() + base + this.frame();\n const inset = `<rect x=\"4\" y=\"4\" width=\"${SWATCH_W - 8}\" height=\"${SWATCH_H - 8}\" rx=\"2\" fill=\"${style.color}\"/>`;\n return this.open() + base + inset + this.frame();\n }\n\n private stripesSwatch(): string {\n const width = SWATCH_W / BASE_ORDER.length;\n const stripes = BASE_ORDER.map(\n (base: KnownFramework, index: number): string =>\n `<rect x=\"${(index * width).toFixed(2)}\" width=\"${width.toFixed(2)}\" height=\"${SWATCH_H}\" fill=\"${FRAMEWORK_STYLES[base].color}\"/>`,\n ).join('');\n return this.open() + stripes + this.frame();\n }\n\n /** The first three product colors as stripes: the \"several products\" swatch. */\n private productStripes(palette: ProductPalette): string {\n const colors = palette.colors.slice(0, 3);\n const width = SWATCH_W / colors.length;\n const stripes = colors\n .map(\n (color: ProductColor, index: number): string =>\n `<rect x=\"${(index * width).toFixed(2)}\" width=\"${width.toFixed(2)}\" height=\"${SWATCH_H}\" fill=\"${color.color}\"/>`,\n )\n .join('');\n return this.open() + stripes + this.frame();\n }\n\n private roleSwatch(style: RoleStyle): string {\n return this.solid(style.fill, '', '');\n }\n\n /** A filled swatch, optionally with an inner ring (dashed when `dash` is set). */\n private solid(fill: string, outline: string, dash: string): string {\n const dashed = dash === '' ? '' : ` stroke-dasharray=\"${dash}\"`;\n const ring =\n outline === ''\n ? ''\n : `<rect x=\"2\" y=\"2\" width=\"${SWATCH_W - 4}\" height=\"${SWATCH_H - 4}\" fill=\"none\" stroke=\"${outline}\" stroke-width=\"2\"${dashed}/>`;\n return this.open() + `<rect width=\"${SWATCH_W}\" height=\"${SWATCH_H}\" fill=\"${fill}\"/>` + ring + this.frame();\n }\n\n private edgeRow(color: string, dash: string, title: string, detail: string): string {\n const dashed = dash === '' ? '' : ` stroke-dasharray=\"${dash}\"`;\n const line = `<svg width=\"28\" height=\"10\" aria-hidden=\"true\"><line x1=\"0\" y1=\"5\" x2=\"28\" y2=\"5\" stroke=\"${color}\" stroke-width=\"1.6\"${dashed}/></svg>`;\n return this.row(title, line, title, detail);\n }\n}\n"]}
@@ -0,0 +1,32 @@
1
+ declare class WpModeState {
2
+ private readonly hasProducts;
3
+ private readonly viewer;
4
+ static readonly MODES: string[];
5
+ static readonly NAMES: string[];
6
+ static readonly SUBTITLES: string[];
7
+ readonly scans: ImpactJson[];
8
+ kind: string;
9
+ mode: string;
10
+ /** @param hasProducts some box belongs to a product, so the Product mode has something to show */
11
+ constructor(hasProducts: boolean, viewer: string);
12
+ private storageKey;
13
+ /** '' when Product can be shown, else why not. */
14
+ productReason(): string;
15
+ /** The active scan; null when the page has no Impact data. */
16
+ get impact(): ImpactJson | null;
17
+ /** '' when Impact can be shown, else the one line the drawer and the Filter popover say instead. */
18
+ impactReason(): string;
19
+ /** Switch the active scan; false (and nothing changes) for a missing or unavailable one. */
20
+ setKind(kind: string): boolean;
21
+ kindAvailable(kind: string): boolean;
22
+ private initialKind;
23
+ available(mode: string): boolean;
24
+ name(mode: string): string;
25
+ subtitle(mode: string): string;
26
+ /** False (and nothing changes) for an unknown or unavailable mode. */
27
+ set(mode: string): boolean;
28
+ /** Which impact shade a box gets, from the ACTIVE scan. */
29
+ status(id: string): 'touched' | 'affected' | 'buildInput' | 'untouched';
30
+ private initial;
31
+ private read;
32
+ }
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ class WpModeState {
3
+ hasProducts;
4
+ viewer;
5
+ static MODES = ['runtime', 'architecture', 'impact', 'product'];
6
+ static NAMES = ['Runtime', 'Architecture', 'Impact', 'Product'];
7
+ static SUBTITLES = [
8
+ 'where the code can run',
9
+ 'servers · clients · APIs',
10
+ 'what changed',
11
+ 'which products it belongs to',
12
+ ];
13
+ scans = window.__WP_IMPACT__?.scans ?? [];
14
+ kind = '';
15
+ mode = 'runtime';
16
+ /** @param hasProducts some box belongs to a product, so the Product mode has something to show */
17
+ constructor(hasProducts, viewer) {
18
+ this.hasProducts = hasProducts;
19
+ this.viewer = viewer;
20
+ this.kind = this.initialKind();
21
+ this.mode = this.initial();
22
+ }
23
+ storageKey(kind) {
24
+ return `wp-${this.viewer}-graph-${kind}`;
25
+ }
26
+ /** '' when Product can be shown, else why not. */
27
+ productReason() {
28
+ return this.hasProducts
29
+ ? ''
30
+ : 'No products here: tag servers, clients and apps product:<name> in their project.json, then regenerate.';
31
+ }
32
+ /** The active scan; null when the page has no Impact data. */
33
+ get impact() {
34
+ return this.scans.find((scan) => scan.kind === this.kind) ?? null;
35
+ }
36
+ /** '' when Impact can be shown, else the one line the drawer and the Filter popover say instead. */
37
+ impactReason() {
38
+ const impact = this.impact;
39
+ if (impact === null &&
40
+ this.viewer === 'runtime' &&
41
+ document.body.dataset['wpProjectFacts'] === 'false')
42
+ return 'No saved project facts for Impact. Run pnpm nx run architecture:generate, then pnpm arch:visualize-runtime.';
43
+ if (impact === null)
44
+ return `No impact data here. Run pnpm arch:visualize${this.viewer === 'runtime' ? '-runtime' : ''} to compute it — no full regenerate needed.`;
45
+ return impact.available ? '' : `Impact unavailable (${impact.label}): ${impact.reason}.`;
46
+ }
47
+ /** Switch the active scan; false (and nothing changes) for a missing or unavailable one. */
48
+ setKind(kind) {
49
+ if (!this.kindAvailable(kind))
50
+ return false;
51
+ this.kind = kind;
52
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- storage is a per-viewer convenience; a blocked store must not break the page
53
+ try {
54
+ localStorage.setItem(this.storageKey('impact-kind'), kind);
55
+ // webpieces-disable no-any-unknown -- browsers may throw any value from blocked storage
56
+ }
57
+ catch (err) {
58
+ //const error = toError(err);
59
+ void err;
60
+ }
61
+ return true;
62
+ }
63
+ kindAvailable(kind) {
64
+ return this.scans.some((scan) => scan.kind === kind && scan.available);
65
+ }
66
+ initialKind() {
67
+ const stored = this.read(this.storageKey('impact-kind'));
68
+ if (stored !== null && this.kindAvailable(stored))
69
+ return stored;
70
+ const preferred = window.__WP_IMPACT__?.defaultKind ?? '';
71
+ if (this.scans.some((scan) => scan.kind === preferred))
72
+ return preferred;
73
+ return this.scans[0]?.kind ?? '';
74
+ }
75
+ available(mode) {
76
+ if (!WpModeState.MODES.includes(mode))
77
+ return false;
78
+ if (mode === 'impact')
79
+ return this.impactReason() === '';
80
+ if (mode === 'product')
81
+ return this.productReason() === '';
82
+ return true;
83
+ }
84
+ name(mode) {
85
+ return WpModeState.NAMES[WpModeState.MODES.indexOf(mode)] ?? mode;
86
+ }
87
+ subtitle(mode) {
88
+ return WpModeState.SUBTITLES[WpModeState.MODES.indexOf(mode)] ?? '';
89
+ }
90
+ /** False (and nothing changes) for an unknown or unavailable mode. */
91
+ set(mode) {
92
+ if (!this.available(mode))
93
+ return false;
94
+ this.mode = mode;
95
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- storage is a per-viewer convenience; a blocked store must not break the page
96
+ try {
97
+ localStorage.setItem(this.storageKey('mode'), mode);
98
+ if (location.hash !== `#${mode}`)
99
+ history.replaceState(null, '', `#${mode}`);
100
+ // webpieces-disable no-any-unknown -- browsers may throw any value from blocked storage
101
+ }
102
+ catch (err) {
103
+ //const error = toError(err);
104
+ void err;
105
+ }
106
+ return true;
107
+ }
108
+ /** Which impact shade a box gets, from the ACTIVE scan. */
109
+ status(id) {
110
+ const impact = this.impact;
111
+ if (impact?.touched.includes(id))
112
+ return 'touched';
113
+ if (impact?.affected.includes(id))
114
+ return 'affected';
115
+ if (impact?.buildInputs.includes(id))
116
+ return 'buildInput';
117
+ return 'untouched';
118
+ }
119
+ initial() {
120
+ const hashed = location.hash.slice(1);
121
+ if (this.available(hashed))
122
+ return hashed;
123
+ const stored = this.read(this.storageKey('mode'));
124
+ if (stored !== null && this.available(stored))
125
+ return stored;
126
+ return 'runtime';
127
+ }
128
+ read(key) {
129
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- storage is a per-viewer convenience; a blocked store reads as "nothing stored"
130
+ try {
131
+ return localStorage.getItem(key);
132
+ // webpieces-disable no-any-unknown -- browsers may throw any value from blocked storage
133
+ }
134
+ catch (err) {
135
+ //const error = toError(err);
136
+ void err;
137
+ return null;
138
+ }
139
+ }
140
+ }
141
+ //# sourceMappingURL=graph-mode-state.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-mode-state.client.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/graph-mode-state.client.ts"],"names":[],"mappings":";AAAA,MAAM,WAAW;IAeQ;IACA;IAfrB,MAAM,CAAU,KAAK,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IACzE,MAAM,CAAU,KAAK,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IACzE,MAAM,CAAU,SAAS,GAAG;QACxB,wBAAwB;QACxB,0BAA0B;QAC1B,cAAc;QACd,8BAA8B;KACjC,CAAC;IACO,KAAK,GAAiB,MAAM,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE,CAAC;IACjE,IAAI,GAAG,EAAE,CAAC;IACV,IAAI,GAAG,SAAS,CAAC;IAEjB,kGAAkG;IAClG,YACqB,WAAoB,EACpB,MAAc;QADd,gBAAW,GAAX,WAAW,CAAS;QACpB,WAAM,GAAN,MAAM,CAAQ;QAE/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;IAEO,UAAU,CAAC,IAAY;QAC3B,OAAO,MAAM,IAAI,CAAC,MAAM,UAAU,IAAI,EAAE,CAAC;IAC7C,CAAC;IAED,kDAAkD;IAClD,aAAa;QACT,OAAO,IAAI,CAAC,WAAW;YACnB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,wGAAwG,CAAC;IACnH,CAAC;IAED,8DAA8D;IAC9D,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,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O,SAAS,CAAC;IACrB,CAAC;IAEO,IAAI,CAAC,GAAW;QACpB,gJAAgJ;QAChJ,IAAI,CAAC;YACD,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACjC,wFAAwF;QAC5F,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,6BAA6B;YAC7B,KAAK,GAAG,CAAC;YACT,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC","sourcesContent":["class WpModeState {\n static readonly MODES = ['runtime', 'architecture', 'impact', 'product'];\n static readonly NAMES = ['Runtime', 'Architecture', 'Impact', 'Product'];\n static readonly SUBTITLES = [\n 'where the code can run',\n 'servers · clients · APIs',\n 'what changed',\n 'which products it belongs to',\n ];\n readonly scans: ImpactJson[] = window.__WP_IMPACT__?.scans ?? [];\n kind = '';\n mode = 'runtime';\n\n /** @param hasProducts some box belongs to a product, so the Product mode has something to show */\n constructor(\n private readonly hasProducts: boolean,\n private readonly viewer: string,\n ) {\n this.kind = this.initialKind();\n this.mode = this.initial();\n }\n\n private storageKey(kind: string): string {\n return `wp-${this.viewer}-graph-${kind}`;\n }\n\n /** '' when Product can be shown, else why not. */\n productReason(): string {\n return this.hasProducts\n ? ''\n : 'No products here: tag servers, clients and apps product:<name> in their project.json, then regenerate.';\n }\n\n /** The active scan; null when the page has no Impact data. */\n get impact(): ImpactJson | null {\n return this.scans.find((scan: ImpactJson): boolean => scan.kind === this.kind) ?? null;\n }\n\n /** '' when Impact can be shown, else the one line the drawer and the Filter popover say instead. */\n impactReason(): string {\n const impact = this.impact;\n if (\n impact === null &&\n this.viewer === 'runtime' &&\n document.body.dataset['wpProjectFacts'] === 'false'\n )\n return 'No saved project facts for Impact. Run pnpm nx run architecture:generate, then pnpm arch:visualize-runtime.';\n if (impact === null)\n return `No impact data here. Run pnpm arch:visualize${this.viewer === 'runtime' ? '-runtime' : ''} to compute it — no full regenerate needed.`;\n return impact.available ? '' : `Impact unavailable (${impact.label}): ${impact.reason}.`;\n }\n\n /** Switch the active scan; false (and nothing changes) for a missing or unavailable one. */\n setKind(kind: string): boolean {\n if (!this.kindAvailable(kind)) return false;\n this.kind = kind;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- storage is a per-viewer convenience; a blocked store must not break the page\n try {\n localStorage.setItem(this.storageKey('impact-kind'), kind);\n // webpieces-disable no-any-unknown -- browsers may throw any value from blocked storage\n } catch (err: unknown) {\n //const error = toError(err);\n void err;\n }\n return true;\n }\n\n kindAvailable(kind: string): boolean {\n return this.scans.some((scan: ImpactJson): boolean => scan.kind === kind && scan.available);\n }\n\n private initialKind(): string {\n const stored = this.read(this.storageKey('impact-kind'));\n if (stored !== null && this.kindAvailable(stored)) return stored;\n const preferred = window.__WP_IMPACT__?.defaultKind ?? '';\n if (this.scans.some((scan: ImpactJson): boolean => scan.kind === preferred))\n return preferred;\n return this.scans[0]?.kind ?? '';\n }\n\n available(mode: string): boolean {\n if (!WpModeState.MODES.includes(mode)) return false;\n if (mode === 'impact') return this.impactReason() === '';\n if (mode === 'product') return this.productReason() === '';\n return true;\n }\n\n name(mode: string): string {\n return WpModeState.NAMES[WpModeState.MODES.indexOf(mode)] ?? mode;\n }\n\n subtitle(mode: string): string {\n return WpModeState.SUBTITLES[WpModeState.MODES.indexOf(mode)] ?? '';\n }\n\n /** False (and nothing changes) for an unknown or unavailable mode. */\n set(mode: string): boolean {\n if (!this.available(mode)) return false;\n this.mode = mode;\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- storage is a per-viewer convenience; a blocked store must not break the page\n try {\n localStorage.setItem(this.storageKey('mode'), mode);\n if (location.hash !== `#${mode}`) history.replaceState(null, '', `#${mode}`);\n // webpieces-disable no-any-unknown -- browsers may throw any value from blocked storage\n } catch (err: unknown) {\n //const error = toError(err);\n void err;\n }\n return true;\n }\n\n /** Which impact shade a box gets, from the ACTIVE scan. */\n status(id: string): 'touched' | 'affected' | 'buildInput' | 'untouched' {\n const impact = this.impact;\n if (impact?.touched.includes(id)) return 'touched';\n if (impact?.affected.includes(id)) return 'affected';\n if (impact?.buildInputs.includes(id)) return 'buildInput';\n return 'untouched';\n }\n\n private initial(): string {\n const hashed = location.hash.slice(1);\n if (this.available(hashed)) return hashed;\n const stored = this.read(this.storageKey('mode'));\n if (stored !== null && this.available(stored)) return stored;\n return 'runtime';\n }\n\n private read(key: string): string | null {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions -- storage is a per-viewer convenience; a blocked store reads as \"nothing stored\"\n try {\n return localStorage.getItem(key);\n // webpieces-disable no-any-unknown -- browsers may throw any value from blocked storage\n } catch (err: unknown) {\n //const error = toError(err);\n void err;\n return null;\n }\n }\n}\n"]}
@@ -50,9 +50,13 @@ export declare class ShellParts {
50
50
  readonly responsibilities: string;
51
51
  /** Every declared product, sorted (#1179); empty hides the Filter's Product group. */
52
52
  readonly products: string[];
53
+ readonly runtime: boolean;
54
+ readonly frameworks: readonly string[];
55
+ readonly roles: readonly string[];
56
+ readonly emptyState: string;
53
57
  constructor(title: string, lockControl: string, legend: string, edgeKey: string, filterStatus: string, snapshot: string, responsibilities: string,
54
58
  /** Every declared product, sorted (#1179); empty hides the Filter's Product group. */
55
- products: string[]);
59
+ products: string[], runtime?: boolean, frameworks?: readonly string[], roles?: readonly string[], emptyState?: string);
56
60
  }
57
61
  export declare class GraphPageShell {
58
62
  body(parts: ShellParts): string;