@orkestrel/guide 0.0.27 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/core/index.cjs +5 -28
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +0 -21
- package/dist/src/core/index.d.ts +0 -21
- package/dist/src/core/index.js +7 -29
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +31 -4
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +15 -0
- package/dist/src/server/index.d.ts +15 -0
- package/dist/src/server/index.js +31 -5
- package/dist/src/server/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -23,10 +23,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
let _orkestrel_contract = require("@orkestrel/contract");
|
|
24
24
|
let node_path = require("node:path");
|
|
25
25
|
let node_url = require("node:url");
|
|
26
|
+
let _src_core = require("../core/index.cjs");
|
|
26
27
|
let node_fs = require("node:fs");
|
|
27
28
|
let node_process = require("node:process");
|
|
28
29
|
node_process = __toESM(node_process, 1);
|
|
29
|
-
let _src_core = require("../core/index.cjs");
|
|
30
30
|
let node_child_process = require("node:child_process");
|
|
31
31
|
let node_os = require("node:os");
|
|
32
32
|
// src/server/constants.ts
|
|
@@ -142,6 +142,23 @@ function computeGuideProject(module) {
|
|
|
142
142
|
if (layer === void 0 || environment === void 0) return void 0;
|
|
143
143
|
return `configs/${layer}/tsconfig.${environment}.json`;
|
|
144
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* Computes the environment directory whose project compiles a guide source.
|
|
147
|
+
*
|
|
148
|
+
* @param source - The workspace-relative source directory
|
|
149
|
+
* @returns The `src/<env>` or `app/<env>` directory that `source` equals or sits beneath, or
|
|
150
|
+
* `undefined` for a source under neither
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* computeGuideEnvironment('src/core/panels') // 'src/core'
|
|
155
|
+
* computeGuideEnvironment('lib/core') // undefined
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
function computeGuideEnvironment(source) {
|
|
159
|
+
if (!(0, _src_core.hasCanonicalSegments)(source)) return void 0;
|
|
160
|
+
return /^(?:src|app)\/[A-Za-z0-9_-]+(?=\/|$)/.exec(source)?.[0];
|
|
161
|
+
}
|
|
145
162
|
// src/server/parsers.ts
|
|
146
163
|
/**
|
|
147
164
|
* Maps the supported `--to guide` and `--to source` arguments to an explicit rewrite destination.
|
|
@@ -432,9 +449,18 @@ var GuideCommand = class {
|
|
|
432
449
|
spec: pitch
|
|
433
450
|
}) }
|
|
434
451
|
};
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
const
|
|
452
|
+
const sources = new Set(new _src_core.Parity(options).rows().flatMap((row) => (0, _src_core.normalizeDirectories)(row.entry.source)));
|
|
453
|
+
const environments = new Set(Array.from(sources).map((source) => computeGuideEnvironment(source) ?? source));
|
|
454
|
+
for (const environment of environments) if (!compiled.has(environment)) compiled.set(environment, this.#compiler.compile(environment));
|
|
455
|
+
const declarations = Object.freeze(Object.fromEntries(Array.from(compiled).filter(([environment]) => environments.has(environment)).flatMap(([, emitted]) => Object.entries(emitted))));
|
|
456
|
+
const missing = Array.from(sources).flatMap((module) => {
|
|
457
|
+
const project = computeGuideProject(computeGuideEnvironment(module) ?? module);
|
|
458
|
+
return project === void 0 || Object.keys(declarations).some((key) => key.startsWith(`${module}/`)) ? [] : [{
|
|
459
|
+
module,
|
|
460
|
+
project
|
|
461
|
+
}];
|
|
462
|
+
});
|
|
463
|
+
if (missing.length > 0) throw new _src_core.GuideError(`${missing.map(({ module, project }) => `${JSON.stringify(module)} emitted no declaration under ${module} through ${project}`).join("; ")}; each project's include must cover its module and its declarations must emit into --outDir, with no declarationDir.`, "empty", { context: { missing } });
|
|
438
464
|
return {
|
|
439
465
|
...options,
|
|
440
466
|
declarations
|
|
@@ -544,6 +570,7 @@ exports.GUIDE_SCRATCH_RETRIES = GUIDE_SCRATCH_RETRIES;
|
|
|
544
570
|
exports.GUIDE_USAGE = GUIDE_USAGE;
|
|
545
571
|
exports.GuideCommand = GuideCommand;
|
|
546
572
|
exports.GuideCompiler = GuideCompiler;
|
|
573
|
+
exports.computeGuideEnvironment = computeGuideEnvironment;
|
|
547
574
|
exports.computeGuideProject = computeGuideProject;
|
|
548
575
|
exports.formatGuideFinding = formatGuideFinding;
|
|
549
576
|
exports.matchesGuideResult = matchesGuideResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["isObject","isArray","isFunction","resolve","isInstance","fileURLToPath","parseEnum","parseJSONAs","isRecord","isNonEmptyString","GuideError","resolve","dirname","mkdtempSync","join","tmpdir","readdirSync","relative","sep","readFileSync","existsSync","parseJSONAs","isRecord","isNonEmptyString","spawnSync","process","process","isError","parseManifest","Parity","normalizeDirectories","resolve","globSync","isObject","isFunction","isString","isFiniteNumber"],"sources":["../../../src/server/constants.ts","../../../src/server/helpers.ts","../../../src/server/parsers.ts","../../../src/server/GuideCompiler.ts","../../../src/server/GuideCommand.ts"],"sourcesContent":["/** Names the workspace-relative guide concept index. */\nexport const GUIDE_INDEX = 'guides/README.md'\n\n/** Names the package manifest read for native pitch selection. */\nexport const GUIDE_MANIFEST = 'package.json'\n\n/** Names the package README paired with its indexed guide pitch. */\nexport const GUIDE_README = 'README.md'\n\n/** Holds the native command usage text written for unsupported arguments. */\nexport const GUIDE_USAGE = 'usage: npm run test:guides [-- --to guide|--to source]'\n\n/** Names the host temporary directory prefix of a declaration emit's scratch output. */\nexport const GUIDE_SCRATCH_PREFIX = 'orkestrel-guide-'\n\n/** Holds the removal retries a declaration emit's scratch output takes on a busy host. */\nexport const GUIDE_SCRATCH_RETRIES = 3\n\n/** Holds the default milliseconds one compiler run may take before it is stopped. */\nexport const GUIDE_COMPILER_TIMEOUT = 300_000\n\n/**\n * Holds the default bytes of output one compiler run may write to each stream, room for the\n * diagnostics of a large failing project.\n */\nexport const GUIDE_COMPILER_LIMIT = 64 * 1024 * 1024\n","import type { ManifestEntry, ParityFinding } from '@src/core'\nimport { isArray, isFunction, isInstance, isObject } from '@orkestrel/contract'\nimport { resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\n/**\n * Formats one finding with its guide prefix when needed.\n *\n * @param finding - The finding to format\n * @returns The finding text with its spec prefix when the text does not already carry it\n *\n * @example\n * ```ts\n * formatGuideFinding({ spec: 'guides/widget.md', text: 'missing export' })\n * ```\n */\nexport function formatGuideFinding(finding: ParityFinding): string {\n\tconst spec = finding.spec\n\tconst prefix = spec === undefined || finding.text.startsWith(spec) ? '' : `${spec} `\n\treturn `${prefix}${finding.text}`\n}\n\n/**\n * Reads an owned foreign result view and accepts passed modules without unhandled errors.\n *\n * @param result - The unknown external runner result to inspect\n * @returns True if a module is present, every module passed, and no unhandled error exists; false otherwise\n *\n * @example\n * ```ts\n * matchesGuideResult({ testModules: [{ state: () => 'passed' }], unhandledErrors: [] })\n * ```\n */\nexport function matchesGuideResult(result: unknown): boolean {\n\tif (!isObject(result)) return false\n\tconst testModules = Reflect.get(result, 'testModules')\n\tconst unhandledErrors = Reflect.get(result, 'unhandledErrors')\n\tif (!isArray(testModules) || !isArray(unhandledErrors)) return false\n\tconst modules = [...testModules]\n\tconst errors = [...unhandledErrors]\n\tif (modules.length === 0 || errors.length > 0) return false\n\tfor (const module of modules) {\n\t\tif (!isObject(module)) return false\n\t\tconst state = Reflect.get(module, 'state')\n\t\tif (!isFunction(state) || Reflect.apply(state, module, []) !== 'passed') return false\n\t}\n\treturn true\n}\n\n/**\n * Resolves a command root to a native absolute path.\n *\n * @param root - The workspace root as a file URL or native path\n * @returns The native absolute workspace path\n *\n * @example\n * ```ts\n * resolveGuideRoot('/workspace')\n * ```\n */\nexport function resolveGuideRoot(root: URL | string): string {\n\treturn resolve(isInstance(root, URL) ? fileURLToPath(root) : root)\n}\n\n/**\n * Selects the indexed guide matching a package's bare name.\n *\n * @param entries - The concept-index entries to search\n * @param name - The package's bare name, or `undefined` when none was parsed\n * @returns The indexed own-guide path, or `undefined` when the index carries none\n *\n * @example\n * ```ts\n * selectGuidePitch([{ concept: 'Widget', spec: 'guides/widget.md', source: 'src', tests: 'tests' }], 'widget')\n * ```\n */\nexport function selectGuidePitch(\n\tentries: readonly ManifestEntry[],\n\tname: string | undefined,\n): string | undefined {\n\tif (name === undefined) return undefined\n\tconst spec = `guides/${name}.md`\n\treturn entries.some((entry) => entry.spec === spec) ? spec : undefined\n}\n\n/**\n * Computes the scoped project a guide module's declarations are emitted through.\n *\n * @param module - The workspace-relative module directory\n * @returns The workspace-relative `configs/<layer>/tsconfig.<env>.json` path for a module\n * `src/<env>` or `app/<env>`, or `undefined` for any other module\n *\n * @example\n * ```ts\n * computeGuideProject('src/core') // 'configs/src/tsconfig.core.json'\n * computeGuideProject('src/core/sources') // undefined\n * ```\n */\nexport function computeGuideProject(module: string): string | undefined {\n\tconst matched = /^(src|app)\\/([A-Za-z0-9_-]+)$/.exec(module)\n\tconst layer = matched?.[1]\n\tconst environment = matched?.[2]\n\tif (layer === undefined || environment === undefined) return undefined\n\treturn `configs/${layer}/tsconfig.${environment}.json`\n}\n","import type { ParityDirection } from '@src/core'\nimport { isNonEmptyString, isRecord, parseEnum, parseJSONAs } from '@orkestrel/contract'\n\n/**\n * Maps the supported `--to guide` and `--to source` arguments to an explicit rewrite destination.\n *\n * @param args - The arguments after the native command entry\n * @returns The requested destination, or `undefined` when the shape is unsupported\n *\n * @example\n * ```ts\n * parseGuideDirection(['--to', 'guide'])\n * ```\n */\nexport function parseGuideDirection(args: readonly string[]): ParityDirection | undefined {\n\tif (args.length !== 2 || args[0] !== '--to') return undefined\n\treturn parseEnum(args[1], ['guide', 'source'])\n}\n\n/**\n * Reads the bare package name from package manifest JSON.\n *\n * @param manifest - The package manifest JSON text\n * @returns The name after its final scope separator, or `undefined` when no name is declared\n *\n * @example\n * ```ts\n * parsePackageName('{\"name\":\"@scope/widget\"}')\n * ```\n */\nexport function parsePackageName(manifest: string): string | undefined {\n\tconst parsed = parseJSONAs(manifest, isRecord)\n\tif (parsed === undefined) return undefined\n\tconst name = parsed.name\n\tif (!isNonEmptyString(name)) return undefined\n\treturn name.slice(name.lastIndexOf('/') + 1)\n}\n\n/**\n * Reads the `rootDir` a `tsc --showConfig` reading resolves.\n *\n * @param text - The compiler's `--showConfig` output\n * @returns The `rootDir` text, relative to the project file, or `undefined` when none is declared\n *\n * @example\n * ```ts\n * parseCompilerRoot('{\"compilerOptions\":{\"rootDir\":\"../../src/core\"}}') // '../../src/core'\n * ```\n */\nexport function parseCompilerRoot(text: string): string | undefined {\n\tconst parsed = parseJSONAs(text, isRecord)\n\tconst options = parsed?.compilerOptions\n\tif (!isRecord(options)) return undefined\n\tconst root = options.rootDir\n\treturn isNonEmptyString(root) ? root : undefined\n}\n","import type { GuideCompilerInterface, GuideCompilerOptions } from './types.js'\nimport { isNonEmptyString, isRecord, parseJSONAs } from '@orkestrel/contract'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { dirname, join, relative, resolve, sep } from 'node:path'\nimport process from 'node:process'\nimport { GuideError } from '@src/core'\nimport {\n\tGUIDE_COMPILER_LIMIT,\n\tGUIDE_COMPILER_TIMEOUT,\n\tGUIDE_SCRATCH_PREFIX,\n\tGUIDE_SCRATCH_RETRIES,\n} from './constants.js'\nimport { computeGuideProject, resolveGuideRoot } from './helpers.js'\nimport { parseCompilerRoot } from './parsers.js'\n\n/**\n * Emits a guide module's declarations through the workspace's own TypeScript compiler, the\n * projection every computed `Signature` cell is read from.\n *\n * @remarks\n * The compiler is the `bin.tsc` entry the workspace root's `node_modules/typescript/package.json`\n * names, run by `process.execPath` with no shell, under a timeout and a per-stream output bound. A\n * module `src/<env>` or `app/<env>` emits through `configs/<layer>/tsconfig.<env>.json` into a fresh\n * scratch directory, with comments removed and LF line endings, and the scratch directory is\n * removed before the call returns or throws. Its path never enters the result, so two compiles of\n * one tree under one compiler return the same text. Every refusal is a `GuideError` whose\n * `context` names the module and project, except that a module outside `src/<env>` and\n * `app/<env>` names the module alone and a workspace with no compiler names its `root`.\n *\n * @param options - The workspace root, the run bounds, and the scratch parent directory\n *\n * @example\n * ```ts\n * import { GuideCompiler } from '@orkestrel/guide/server'\n *\n * const declarations = new GuideCompiler({ root: new URL('../', import.meta.url) }).compile('src/core')\n * declarations['src/core/helpers.d.ts'] // 'export declare function …'\n * ```\n */\nexport class GuideCompiler implements GuideCompilerInterface {\n\treadonly #root: string\n\treadonly #timeout: number\n\treadonly #limit: number\n\treadonly #temporary: string | undefined\n\n\tconstructor(options: GuideCompilerOptions) {\n\t\tthis.#root = resolveGuideRoot(options.root)\n\t\tthis.#timeout = options.timeout ?? GUIDE_COMPILER_TIMEOUT\n\t\tthis.#limit = options.limit ?? GUIDE_COMPILER_LIMIT\n\t\tthis.#temporary = options.temporary\n\t}\n\n\t/**\n\t * Emits the declarations of one `src/<env>` or `app/<env>` module through its scoped project.\n\t *\n\t * @param module - The workspace-relative module directory, `src/<env>` or `app/<env>`\n\t * @returns The emitted declaration text keyed by workspace-relative `.d.ts` path, sorted by key\n\t * @throws `GuideError` with code `compile` when the module is outside `src/<env>` and\n\t * `app/<env>`, the workspace installs no TypeScript compiler, the project declares no\n\t * `rootDir`, or the compiler exits non-zero; `empty` when the project emits no declaration under\n\t * the module; `timeout` when a run passes the timeout; and `overflow` when a run passes the output\n\t * bound\n\t *\n\t * @example\n\t * ```ts\n\t * compiler.compile('src/core')['src/core/types.d.ts'] // 'export type …'\n\t * ```\n\t */\n\tcompile(module: string): Readonly<Record<string, string>> {\n\t\tconst project = computeGuideProject(module)\n\t\tif (project === undefined) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module.slice(0, 200))} is outside src/<env> and app/<env>; a guide module compiles through configs/<layer>/tsconfig.<env>.json, such as configs/src/tsconfig.core.json for src/core.`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { module: module.slice(0, 200) } },\n\t\t\t)\n\t\t}\n\t\tconst compiler = this.#locate()\n\t\tconst path = resolve(this.#root, project)\n\t\tconst root = parseCompilerRoot(\n\t\t\tthis.#run(module, project, compiler, ['--showConfig', '-p', path]),\n\t\t)\n\t\tif (root === undefined) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} compiles through ${project}, which declares no rootDir.`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { module, project } },\n\t\t\t)\n\t\t}\n\t\tconst base = resolve(dirname(path), root)\n\t\tconst scratch = mkdtempSync(join(this.#temporary ?? tmpdir(), GUIDE_SCRATCH_PREFIX))\n\t\ttry {\n\t\t\tthis.#run(module, project, compiler, [\n\t\t\t\t'-p',\n\t\t\t\tpath,\n\t\t\t\t'--declaration',\n\t\t\t\t'--emitDeclarationOnly',\n\t\t\t\t'--noEmit',\n\t\t\t\t'false',\n\t\t\t\t'--declarationMap',\n\t\t\t\t'false',\n\t\t\t\t'--removeComments',\n\t\t\t\t'--newLine',\n\t\t\t\t'lf',\n\t\t\t\t'--outDir',\n\t\t\t\tscratch,\n\t\t\t])\n\t\t\tconst entries = readdirSync(scratch, { recursive: true, encoding: 'utf8' })\n\t\t\t\t.filter((file) => file.endsWith('.d.ts'))\n\t\t\t\t.map((file) => ({\n\t\t\t\t\tkey: relative(this.#root, resolve(base, file)).split(sep).join('/'),\n\t\t\t\t\tfile,\n\t\t\t\t}))\n\t\t\t\t.filter((entry) => entry.key.startsWith(`${module}/`))\n\t\t\t\t.sort((left, right) => (left.key === right.key ? 0 : left.key < right.key ? -1 : 1))\n\t\t\tif (entries.length === 0) {\n\t\t\t\tthrow new GuideError(\n\t\t\t\t\t`${JSON.stringify(module)} emitted no declaration under ${module} through ${project}; the project's include must cover ${module} and its declarations must emit into --outDir, with no declarationDir.`,\n\t\t\t\t\t'empty',\n\t\t\t\t\t{ context: { module, project } },\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst declarations = Object.freeze(\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tentries.map((entry) => [entry.key, readFileSync(join(scratch, entry.file), 'utf8')]),\n\t\t\t\t),\n\t\t\t)\n\t\t\trmSync(scratch, { recursive: true, force: true, maxRetries: GUIDE_SCRATCH_RETRIES })\n\t\t\treturn declarations\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\trmSync(scratch, { recursive: true, force: true, maxRetries: GUIDE_SCRATCH_RETRIES })\n\t\t\t} catch {\n\t\t\t\t// The compile error answers for this call; a removal failure must not replace it.\n\t\t\t}\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t// The workspace root's own compiler entry, named by its installed manifest's `bin.tsc`.\n\t#locate(): string {\n\t\tconst manifest = join(this.#root, 'node_modules', 'typescript', 'package.json')\n\t\tconst declared = existsSync(manifest)\n\t\t\t? parseJSONAs(readFileSync(manifest, 'utf8'), isRecord)\n\t\t\t: undefined\n\t\tconst bin = declared?.bin\n\t\tconst entry = isRecord(bin) ? bin.tsc : undefined\n\t\tif (!isNonEmptyString(entry)) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`The workspace at ${JSON.stringify(this.#root)} installs no TypeScript compiler; node_modules/typescript/package.json names no bin.tsc entry.`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { root: this.#root } },\n\t\t\t)\n\t\t}\n\t\treturn resolve(dirname(manifest), entry)\n\t}\n\n\t#run(module: string, project: string, compiler: string, args: readonly string[]): string {\n\t\tconst result = spawnSync(process.execPath, [compiler, ...args], {\n\t\t\tcwd: this.#root,\n\t\t\tencoding: 'utf8',\n\t\t\tmaxBuffer: this.#limit,\n\t\t\ttimeout: this.#timeout,\n\t\t\twindowsHide: true,\n\t\t})\n\t\tconst code: unknown = result.error === undefined ? undefined : Reflect.get(result.error, 'code')\n\t\tif (code === 'ETIMEDOUT') {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} did not compile through ${project} within ${this.#timeout} ms; the compiler was stopped at the timeout.`,\n\t\t\t\t'timeout',\n\t\t\t\t{ context: { module, project, timeout: this.#timeout } },\n\t\t\t)\n\t\t}\n\t\tif (code === 'ENOBUFS') {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} wrote more than ${this.#limit} bytes of compiler output to one stream through ${project}; the compiler was stopped at the output bound.`,\n\t\t\t\t'overflow',\n\t\t\t\t{ context: { module, project, limit: this.#limit } },\n\t\t\t)\n\t\t}\n\t\tif (result.error !== undefined || result.status !== 0) {\n\t\t\tconst output = `${result.stdout ?? ''}${result.stderr ?? ''}${result.error?.message ?? ''}`\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} does not compile through ${project}:\\n${output}`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { module, project, output } },\n\t\t\t)\n\t\t}\n\t\treturn result.stdout\n\t}\n}\n","import type {\n\tGuideCommandContext,\n\tGuideCompilerInterface,\n\tGuideCommandHandler,\n\tGuideCommandInterface,\n\tGuideCommandOptions,\n\tGuideReadFunction,\n\tGuideRunnerFunction,\n} from './types.js'\nimport type { GuideModule, ParityFinding, ParityOptions } from '@src/core'\nimport { isError, isFiniteNumber, isFunction, isObject, isString } from '@orkestrel/contract'\nimport { globSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport process from 'node:process'\nimport { normalizeDirectories, Parity, parseManifest } from '@src/core'\nimport { GUIDE_INDEX, GUIDE_MANIFEST, GUIDE_README, GUIDE_USAGE } from './constants.js'\nimport { GuideCompiler } from './GuideCompiler.js'\nimport {\n\tformatGuideFinding,\n\tmatchesGuideResult,\n\tresolveGuideRoot,\n\tselectGuidePitch,\n} from './helpers.js'\nimport { parseGuideDirection, parsePackageName } from './parsers.js'\n\n/**\n * Drives native checking and explicit rewrites or registers package assertions in the guides\n * worker.\n *\n * @param options - The workspace policy and direct host ports\n *\n * @example\n * ```ts\n * import { GuideCommand } from '@orkestrel/guide/server'\n * import { readInventory } from '@orkestrel/test/server'\n * import { createVitest } from 'vitest/node'\n *\n * await new GuideCommand({\n * \troot: new URL('../', import.meta.url),\n * \tpatterns: ['src/**\\/*.ts', 'tests/**\\/*.ts', 'guides/*.md', '*.md'],\n * \tmodules: { '@scope/widget': 'src/core' },\n * \tlanguages: ['ts'],\n * \tlanguage: 'ts',\n * \treader: readInventory,\n * \trunner: createVitest,\n * }).execute(async ({ files, report, root, rows }) => {\n * \tconst { expect, it } = await import('vitest')\n * \tit('checks the documented inventory', () => {\n * \t\texpect(root.length).toBeGreaterThan(0)\n * \t\texpect(Object.keys(files).length).toBeGreaterThan(0)\n * \t\texpect(rows.length).toBeGreaterThan(0)\n * \t\texpect(report.input).toEqual([])\n * \t})\n * })\n * ```\n */\nexport class GuideCommand implements GuideCommandInterface {\n\treadonly #root: string\n\treadonly #patterns: readonly string[]\n\treadonly #modules: Readonly<Record<string, GuideModule>>\n\treadonly #languages: readonly string[]\n\treadonly #language: string\n\treadonly #reader: GuideReadFunction\n\treadonly #runner: GuideRunnerFunction\n\treadonly #compiler: GuideCompilerInterface\n\n\tconstructor(options: GuideCommandOptions) {\n\t\tthis.#root = resolveGuideRoot(options.root)\n\t\tthis.#patterns = Object.freeze([...options.patterns])\n\t\tthis.#modules = Object.freeze({ ...options.modules })\n\t\tthis.#languages = Object.freeze([...options.languages])\n\t\tthis.#language = options.language\n\t\tthis.#reader = options.reader\n\t\tthis.#runner = options.runner\n\t\tthis.#compiler = new GuideCompiler({ root: this.#root })\n\t}\n\n\t/**\n\t * Runs the native command or registers package assertions with fresh worker inventory and parity.\n\t *\n\t * @param register - The package-owned assertion registration callback\n\t * @returns A promise that resolves after the selected command path finishes\n\t * @throws When worker inventory reading or package assertion registration fails. Native failures\n\t * are reported through stderr and process exit status before this promise resolves.\n\t */\n\tasync execute(register: GuideCommandHandler): Promise<void> {\n\t\tif (process.env.VITEST === 'true') {\n\t\t\tawait this.#register(register)\n\t\t\treturn\n\t\t}\n\t\ttry {\n\t\t\tawait this.#executeNative()\n\t\t} catch (error) {\n\t\t\tprocess.stderr.write(`${isError(error) ? error.message : String(error)}\\n`)\n\t\t\tthis.#raise(1)\n\t\t}\n\t}\n\n\t// `compiled` holds one command run's declarations by module, so a module compiles once per run.\n\t#createOptions(\n\t\tcompiled: Map<string, Readonly<Record<string, string>>>,\n\t): ParityOptions | undefined {\n\t\tconst files = this.#readInventory()\n\t\tconst manifest = files[GUIDE_INDEX]\n\t\tif (manifest === undefined) return undefined\n\t\tconst entries = Object.freeze([...parseManifest(manifest, 'guides')])\n\t\tconst packageFiles = Object.freeze({ ...this.#reader(this.#root, [GUIDE_MANIFEST]) })\n\t\tconst packageManifest = packageFiles[GUIDE_MANIFEST]\n\t\tconst pitch = selectGuidePitch(\n\t\t\tentries,\n\t\t\tpackageManifest === undefined ? undefined : parsePackageName(packageManifest),\n\t\t)\n\t\tconst options: ParityOptions = {\n\t\t\tfiles,\n\t\t\tentries,\n\t\t\tmodules: this.#modules,\n\t\t\tlanguages: this.#languages,\n\t\t\tlanguage: this.#language,\n\t\t\t...(pitch === undefined\n\t\t\t\t? {}\n\t\t\t\t: { pitch: Object.freeze({ readme: GUIDE_README, spec: pitch }) }),\n\t\t}\n\t\t// Parity parses every manifest guide at construction, so a malformed guide refuses before\n\t\t// any module compiles.\n\t\tconst directories = new Set(\n\t\t\tnew Parity(options).rows().flatMap((row) => normalizeDirectories(row.entry.source)),\n\t\t)\n\t\tfor (const directory of directories) {\n\t\t\tif (!compiled.has(directory)) compiled.set(directory, this.#compiler.compile(directory))\n\t\t}\n\t\tconst declarations = Object.freeze(\n\t\t\tObject.fromEntries(\n\t\t\t\tArray.from(directories).flatMap((directory) =>\n\t\t\t\t\tObject.entries(compiled.get(directory) ?? {}),\n\t\t\t\t),\n\t\t\t),\n\t\t)\n\t\treturn { ...options, declarations }\n\t}\n\n\tasync #executeNative(): Promise<void> {\n\t\tconst args = process.argv.slice(2)\n\t\tconst direction = parseGuideDirection(args)\n\t\tif (direction === undefined && args.length > 0) {\n\t\t\tprocess.stdout.write(`${GUIDE_USAGE}\\n`)\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tif (direction === undefined) {\n\t\t\tif (!(await this.#executeRunner())) this.#raise(1)\n\t\t\treturn\n\t\t}\n\n\t\tconst compiled = new Map<string, Readonly<Record<string, string>>>()\n\t\tconst options = this.#createOptions(compiled)\n\t\tif (options === undefined) {\n\t\t\tthis.#reportMissing()\n\t\t\treturn\n\t\t}\n\t\tconst parity = new Parity(options)\n\t\tif (this.#report(parity.inspect().input)) {\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tconst rewritten = direction === 'guide' ? parity.document() : parity.annotate()\n\t\tfor (const change of rewritten.changes) {\n\t\t\twriteFileSync(resolve(this.#root, change.path), change.content)\n\t\t\tprocess.stdout.write(`wrote ${change.path}\\n`)\n\t\t}\n\n\t\tconst freshOptions = this.#createOptions(compiled)\n\t\tif (freshOptions === undefined) {\n\t\t\tthis.#reportMissing()\n\t\t\treturn\n\t\t}\n\t\tconst freshParity = new Parity(freshOptions)\n\t\tconst freshReport = freshParity.inspect()\n\t\tif (this.#report(freshReport.input)) {\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tconst remaining =\n\t\t\tdirection === 'guide' ? freshParity.document().findings : freshParity.annotate().findings\n\t\tif (this.#report(remaining)) this.#raise(1)\n\t\tif (this.#report(freshReport.pitch)) this.#raise(1)\n\t\tif (rewritten.changes.length > 0) process.stdout.write('next: npm run format\\n')\n\t\tif (!(await this.#executeRunner())) this.#raise(1)\n\t}\n\n\t#readInventory(): Readonly<Record<string, string>> {\n\t\tconst targets = globSync([...this.#patterns], { cwd: this.#root }).map((path) =>\n\t\t\tpath.replaceAll('\\\\', '/'),\n\t\t)\n\t\treturn Object.freeze({ ...this.#reader(this.#root, targets) })\n\t}\n\n\tasync #register(register: GuideCommandHandler): Promise<void> {\n\t\tconst options = this.#createOptions(new Map())\n\t\tif (options === undefined) {\n\t\t\tthrow new Error('The inventory carries no guides/README.md to index from')\n\t\t}\n\t\tconst parity = new Parity(options)\n\t\tconst context: GuideCommandContext = Object.freeze({\n\t\t\troot: this.#root,\n\t\t\tfiles: options.files,\n\t\t\trows: parity.rows(),\n\t\t\treport: parity.inspect(),\n\t\t})\n\t\tawait register(context)\n\t}\n\n\t#report(findings: readonly ParityFinding[]): boolean {\n\t\tfor (const finding of findings) {\n\t\t\tprocess.stdout.write(`${formatGuideFinding(finding)}\\n`)\n\t\t}\n\t\treturn findings.length > 0\n\t}\n\n\t#reportMissing(): void {\n\t\tprocess.stdout.write(`${GUIDE_INDEX}: the workspace carries no concept index to read\\n`)\n\t\tthis.#raise(2)\n\t}\n\n\tasync #executeRunner(): Promise<boolean> {\n\t\tconst runner = await this.#runner('test', {\n\t\t\troot: this.#root,\n\t\t\tconfig: resolve(this.#root, 'vite.config.ts'),\n\t\t\tproject: 'guides',\n\t\t\treporters: 'dot',\n\t\t\tcache: false,\n\t\t\twatch: false,\n\t\t})\n\t\tif (!isObject(runner)) throw new Error('The guides runner is not an object')\n\t\tconst close = Reflect.get(runner, 'close')\n\t\tif (!isFunction(close)) throw new Error('The guides runner has no callable close member')\n\t\ttry {\n\t\t\tconst start = Reflect.get(runner, 'start')\n\t\t\tif (!isFunction(start)) throw new Error('The guides runner has no callable start member')\n\t\t\treturn matchesGuideResult(await Reflect.apply(start, runner, []))\n\t\t} finally {\n\t\t\tawait Reflect.apply(close, runner, [])\n\t\t}\n\t}\n\n\t#raise(code: number): void {\n\t\tconst current = process.exitCode\n\t\tconst numeric = isString(current) ? Number.parseInt(current, 10) : current\n\t\tif (!isFiniteNumber(numeric) || numeric < code) {\n\t\t\tprocess.exitCode = code\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAa,cAAc;;AAG3B,IAAa,iBAAiB;;AAG9B,IAAa,eAAe;;AAG5B,IAAa,cAAc;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mBAAmB,MAAM,QAAQ,MAAM,OAAO,QAAQ,CAAC,CAAC,CAAC;EACjE,UAAU;GACT,MAAM,QAAQ,MAAM,OAAO,QAAQ,CAAC,CAAC;EACtC;CACD;CAEA,OAAO,MAAoB;EAC1B,MAAM,UAAUR,aAAAA,QAAQ;EACxB,MAAM,WAAA,GAAUS,oBAAAA,SAAAA,CAAS,OAAO,IAAI,OAAO,SAAS,SAAS,EAAE,IAAI;EACnE,IAAI,EAAA,GAACC,oBAAAA,eAAAA,CAAe,OAAO,KAAK,UAAU,MACzC,aAAA,QAAA,WAAmB;CAErB;AACD"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["isObject","isArray","isFunction","resolve","isInstance","fileURLToPath","hasCanonicalSegments","parseEnum","parseJSONAs","isRecord","isNonEmptyString","GuideError","resolve","dirname","mkdtempSync","join","tmpdir","readdirSync","relative","sep","readFileSync","existsSync","parseJSONAs","isRecord","isNonEmptyString","spawnSync","process","process","isError","parseManifest","Parity","normalizeDirectories","GuideError","resolve","globSync","isObject","isFunction","isString","isFiniteNumber"],"sources":["../../../src/server/constants.ts","../../../src/server/helpers.ts","../../../src/server/parsers.ts","../../../src/server/GuideCompiler.ts","../../../src/server/GuideCommand.ts"],"sourcesContent":["/** Names the workspace-relative guide concept index. */\nexport const GUIDE_INDEX = 'guides/README.md'\n\n/** Names the package manifest read for native pitch selection. */\nexport const GUIDE_MANIFEST = 'package.json'\n\n/** Names the package README paired with its indexed guide pitch. */\nexport const GUIDE_README = 'README.md'\n\n/** Holds the native command usage text written for unsupported arguments. */\nexport const GUIDE_USAGE = 'usage: npm run test:guides [-- --to guide|--to source]'\n\n/** Names the host temporary directory prefix of a declaration emit's scratch output. */\nexport const GUIDE_SCRATCH_PREFIX = 'orkestrel-guide-'\n\n/** Holds the removal retries a declaration emit's scratch output takes on a busy host. */\nexport const GUIDE_SCRATCH_RETRIES = 3\n\n/** Holds the default milliseconds one compiler run may take before it is stopped. */\nexport const GUIDE_COMPILER_TIMEOUT = 300_000\n\n/**\n * Holds the default bytes of output one compiler run may write to each stream, room for the\n * diagnostics of a large failing project.\n */\nexport const GUIDE_COMPILER_LIMIT = 64 * 1024 * 1024\n","import type { ManifestEntry, ParityFinding } from '@src/core'\nimport { isArray, isFunction, isInstance, isObject } from '@orkestrel/contract'\nimport { resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { hasCanonicalSegments } from '@src/core'\n\n/**\n * Formats one finding with its guide prefix when needed.\n *\n * @param finding - The finding to format\n * @returns The finding text with its spec prefix when the text does not already carry it\n *\n * @example\n * ```ts\n * formatGuideFinding({ spec: 'guides/widget.md', text: 'missing export' })\n * ```\n */\nexport function formatGuideFinding(finding: ParityFinding): string {\n\tconst spec = finding.spec\n\tconst prefix = spec === undefined || finding.text.startsWith(spec) ? '' : `${spec} `\n\treturn `${prefix}${finding.text}`\n}\n\n/**\n * Reads an owned foreign result view and accepts passed modules without unhandled errors.\n *\n * @param result - The unknown external runner result to inspect\n * @returns True if a module is present, every module passed, and no unhandled error exists; false otherwise\n *\n * @example\n * ```ts\n * matchesGuideResult({ testModules: [{ state: () => 'passed' }], unhandledErrors: [] })\n * ```\n */\nexport function matchesGuideResult(result: unknown): boolean {\n\tif (!isObject(result)) return false\n\tconst testModules = Reflect.get(result, 'testModules')\n\tconst unhandledErrors = Reflect.get(result, 'unhandledErrors')\n\tif (!isArray(testModules) || !isArray(unhandledErrors)) return false\n\tconst modules = [...testModules]\n\tconst errors = [...unhandledErrors]\n\tif (modules.length === 0 || errors.length > 0) return false\n\tfor (const module of modules) {\n\t\tif (!isObject(module)) return false\n\t\tconst state = Reflect.get(module, 'state')\n\t\tif (!isFunction(state) || Reflect.apply(state, module, []) !== 'passed') return false\n\t}\n\treturn true\n}\n\n/**\n * Resolves a command root to a native absolute path.\n *\n * @param root - The workspace root as a file URL or native path\n * @returns The native absolute workspace path\n *\n * @example\n * ```ts\n * resolveGuideRoot('/workspace')\n * ```\n */\nexport function resolveGuideRoot(root: URL | string): string {\n\treturn resolve(isInstance(root, URL) ? fileURLToPath(root) : root)\n}\n\n/**\n * Selects the indexed guide matching a package's bare name.\n *\n * @param entries - The concept-index entries to search\n * @param name - The package's bare name, or `undefined` when none was parsed\n * @returns The indexed own-guide path, or `undefined` when the index carries none\n *\n * @example\n * ```ts\n * selectGuidePitch([{ concept: 'Widget', spec: 'guides/widget.md', source: 'src', tests: 'tests' }], 'widget')\n * ```\n */\nexport function selectGuidePitch(\n\tentries: readonly ManifestEntry[],\n\tname: string | undefined,\n): string | undefined {\n\tif (name === undefined) return undefined\n\tconst spec = `guides/${name}.md`\n\treturn entries.some((entry) => entry.spec === spec) ? spec : undefined\n}\n\n/**\n * Computes the scoped project a guide module's declarations are emitted through.\n *\n * @param module - The workspace-relative module directory\n * @returns The workspace-relative `configs/<layer>/tsconfig.<env>.json` path for a module\n * `src/<env>` or `app/<env>`, or `undefined` for any other module\n *\n * @example\n * ```ts\n * computeGuideProject('src/core') // 'configs/src/tsconfig.core.json'\n * computeGuideProject('src/core/sources') // undefined\n * ```\n */\nexport function computeGuideProject(module: string): string | undefined {\n\tconst matched = /^(src|app)\\/([A-Za-z0-9_-]+)$/.exec(module)\n\tconst layer = matched?.[1]\n\tconst environment = matched?.[2]\n\tif (layer === undefined || environment === undefined) return undefined\n\treturn `configs/${layer}/tsconfig.${environment}.json`\n}\n\n/**\n * Computes the environment directory whose project compiles a guide source.\n *\n * @param source - The workspace-relative source directory\n * @returns The `src/<env>` or `app/<env>` directory that `source` equals or sits beneath, or\n * `undefined` for a source under neither\n *\n * @example\n * ```ts\n * computeGuideEnvironment('src/core/panels') // 'src/core'\n * computeGuideEnvironment('lib/core') // undefined\n * ```\n */\nexport function computeGuideEnvironment(source: string): string | undefined {\n\tif (!hasCanonicalSegments(source)) return undefined\n\treturn /^(?:src|app)\\/[A-Za-z0-9_-]+(?=\\/|$)/.exec(source)?.[0]\n}\n","import type { ParityDirection } from '@src/core'\nimport { isNonEmptyString, isRecord, parseEnum, parseJSONAs } from '@orkestrel/contract'\n\n/**\n * Maps the supported `--to guide` and `--to source` arguments to an explicit rewrite destination.\n *\n * @param args - The arguments after the native command entry\n * @returns The requested destination, or `undefined` when the shape is unsupported\n *\n * @example\n * ```ts\n * parseGuideDirection(['--to', 'guide'])\n * ```\n */\nexport function parseGuideDirection(args: readonly string[]): ParityDirection | undefined {\n\tif (args.length !== 2 || args[0] !== '--to') return undefined\n\treturn parseEnum(args[1], ['guide', 'source'])\n}\n\n/**\n * Reads the bare package name from package manifest JSON.\n *\n * @param manifest - The package manifest JSON text\n * @returns The name after its final scope separator, or `undefined` when no name is declared\n *\n * @example\n * ```ts\n * parsePackageName('{\"name\":\"@scope/widget\"}')\n * ```\n */\nexport function parsePackageName(manifest: string): string | undefined {\n\tconst parsed = parseJSONAs(manifest, isRecord)\n\tif (parsed === undefined) return undefined\n\tconst name = parsed.name\n\tif (!isNonEmptyString(name)) return undefined\n\treturn name.slice(name.lastIndexOf('/') + 1)\n}\n\n/**\n * Reads the `rootDir` a `tsc --showConfig` reading resolves.\n *\n * @param text - The compiler's `--showConfig` output\n * @returns The `rootDir` text, relative to the project file, or `undefined` when none is declared\n *\n * @example\n * ```ts\n * parseCompilerRoot('{\"compilerOptions\":{\"rootDir\":\"../../src/core\"}}') // '../../src/core'\n * ```\n */\nexport function parseCompilerRoot(text: string): string | undefined {\n\tconst parsed = parseJSONAs(text, isRecord)\n\tconst options = parsed?.compilerOptions\n\tif (!isRecord(options)) return undefined\n\tconst root = options.rootDir\n\treturn isNonEmptyString(root) ? root : undefined\n}\n","import type { GuideCompilerInterface, GuideCompilerOptions } from './types.js'\nimport { isNonEmptyString, isRecord, parseJSONAs } from '@orkestrel/contract'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { dirname, join, relative, resolve, sep } from 'node:path'\nimport process from 'node:process'\nimport { GuideError } from '@src/core'\nimport {\n\tGUIDE_COMPILER_LIMIT,\n\tGUIDE_COMPILER_TIMEOUT,\n\tGUIDE_SCRATCH_PREFIX,\n\tGUIDE_SCRATCH_RETRIES,\n} from './constants.js'\nimport { computeGuideProject, resolveGuideRoot } from './helpers.js'\nimport { parseCompilerRoot } from './parsers.js'\n\n/**\n * Emits a guide module's declarations through the workspace's own TypeScript compiler, the\n * projection every computed `Signature` cell is read from.\n *\n * @remarks\n * The compiler is the `bin.tsc` entry the workspace root's `node_modules/typescript/package.json`\n * names, run by `process.execPath` with no shell, under a timeout and a per-stream output bound. A\n * module `src/<env>` or `app/<env>` emits through `configs/<layer>/tsconfig.<env>.json` into a fresh\n * scratch directory, with comments removed and LF line endings, and the scratch directory is\n * removed before the call returns or throws. Its path never enters the result, so two compiles of\n * one tree under one compiler return the same text. Every refusal is a `GuideError` whose\n * `context` names the module and project, except that a module outside `src/<env>` and\n * `app/<env>` names the module alone and a workspace with no compiler names its `root`.\n *\n * @param options - The workspace root, the run bounds, and the scratch parent directory\n *\n * @example\n * ```ts\n * import { GuideCompiler } from '@orkestrel/guide/server'\n *\n * const declarations = new GuideCompiler({ root: new URL('../', import.meta.url) }).compile('src/core')\n * declarations['src/core/helpers.d.ts'] // 'export declare function …'\n * ```\n */\nexport class GuideCompiler implements GuideCompilerInterface {\n\treadonly #root: string\n\treadonly #timeout: number\n\treadonly #limit: number\n\treadonly #temporary: string | undefined\n\n\tconstructor(options: GuideCompilerOptions) {\n\t\tthis.#root = resolveGuideRoot(options.root)\n\t\tthis.#timeout = options.timeout ?? GUIDE_COMPILER_TIMEOUT\n\t\tthis.#limit = options.limit ?? GUIDE_COMPILER_LIMIT\n\t\tthis.#temporary = options.temporary\n\t}\n\n\t/**\n\t * Emits the declarations of one `src/<env>` or `app/<env>` module through its scoped project.\n\t *\n\t * @param module - The workspace-relative module directory, `src/<env>` or `app/<env>`\n\t * @returns The emitted declaration text keyed by workspace-relative `.d.ts` path, sorted by key\n\t * @throws `GuideError` with code `compile` when the module is outside `src/<env>` and\n\t * `app/<env>`, the workspace installs no TypeScript compiler, the project declares no\n\t * `rootDir`, or the compiler exits non-zero; `empty` when the project emits no declaration under\n\t * the module; `timeout` when a run passes the timeout; and `overflow` when a run passes the output\n\t * bound\n\t *\n\t * @example\n\t * ```ts\n\t * compiler.compile('src/core')['src/core/types.d.ts'] // 'export type …'\n\t * ```\n\t */\n\tcompile(module: string): Readonly<Record<string, string>> {\n\t\tconst project = computeGuideProject(module)\n\t\tif (project === undefined) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module.slice(0, 200))} is outside src/<env> and app/<env>; a guide module compiles through configs/<layer>/tsconfig.<env>.json, such as configs/src/tsconfig.core.json for src/core.`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { module: module.slice(0, 200) } },\n\t\t\t)\n\t\t}\n\t\tconst compiler = this.#locate()\n\t\tconst path = resolve(this.#root, project)\n\t\tconst root = parseCompilerRoot(\n\t\t\tthis.#run(module, project, compiler, ['--showConfig', '-p', path]),\n\t\t)\n\t\tif (root === undefined) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} compiles through ${project}, which declares no rootDir.`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { module, project } },\n\t\t\t)\n\t\t}\n\t\tconst base = resolve(dirname(path), root)\n\t\tconst scratch = mkdtempSync(join(this.#temporary ?? tmpdir(), GUIDE_SCRATCH_PREFIX))\n\t\ttry {\n\t\t\tthis.#run(module, project, compiler, [\n\t\t\t\t'-p',\n\t\t\t\tpath,\n\t\t\t\t'--declaration',\n\t\t\t\t'--emitDeclarationOnly',\n\t\t\t\t'--noEmit',\n\t\t\t\t'false',\n\t\t\t\t'--declarationMap',\n\t\t\t\t'false',\n\t\t\t\t'--removeComments',\n\t\t\t\t'--newLine',\n\t\t\t\t'lf',\n\t\t\t\t'--outDir',\n\t\t\t\tscratch,\n\t\t\t])\n\t\t\tconst entries = readdirSync(scratch, { recursive: true, encoding: 'utf8' })\n\t\t\t\t.filter((file) => file.endsWith('.d.ts'))\n\t\t\t\t.map((file) => ({\n\t\t\t\t\tkey: relative(this.#root, resolve(base, file)).split(sep).join('/'),\n\t\t\t\t\tfile,\n\t\t\t\t}))\n\t\t\t\t.filter((entry) => entry.key.startsWith(`${module}/`))\n\t\t\t\t.sort((left, right) => (left.key === right.key ? 0 : left.key < right.key ? -1 : 1))\n\t\t\tif (entries.length === 0) {\n\t\t\t\tthrow new GuideError(\n\t\t\t\t\t`${JSON.stringify(module)} emitted no declaration under ${module} through ${project}; the project's include must cover ${module} and its declarations must emit into --outDir, with no declarationDir.`,\n\t\t\t\t\t'empty',\n\t\t\t\t\t{ context: { module, project } },\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst declarations = Object.freeze(\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tentries.map((entry) => [entry.key, readFileSync(join(scratch, entry.file), 'utf8')]),\n\t\t\t\t),\n\t\t\t)\n\t\t\trmSync(scratch, { recursive: true, force: true, maxRetries: GUIDE_SCRATCH_RETRIES })\n\t\t\treturn declarations\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\trmSync(scratch, { recursive: true, force: true, maxRetries: GUIDE_SCRATCH_RETRIES })\n\t\t\t} catch {\n\t\t\t\t// The compile error answers for this call; a removal failure must not replace it.\n\t\t\t}\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t// The workspace root's own compiler entry, named by its installed manifest's `bin.tsc`.\n\t#locate(): string {\n\t\tconst manifest = join(this.#root, 'node_modules', 'typescript', 'package.json')\n\t\tconst declared = existsSync(manifest)\n\t\t\t? parseJSONAs(readFileSync(manifest, 'utf8'), isRecord)\n\t\t\t: undefined\n\t\tconst bin = declared?.bin\n\t\tconst entry = isRecord(bin) ? bin.tsc : undefined\n\t\tif (!isNonEmptyString(entry)) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`The workspace at ${JSON.stringify(this.#root)} installs no TypeScript compiler; node_modules/typescript/package.json names no bin.tsc entry.`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { root: this.#root } },\n\t\t\t)\n\t\t}\n\t\treturn resolve(dirname(manifest), entry)\n\t}\n\n\t#run(module: string, project: string, compiler: string, args: readonly string[]): string {\n\t\tconst result = spawnSync(process.execPath, [compiler, ...args], {\n\t\t\tcwd: this.#root,\n\t\t\tencoding: 'utf8',\n\t\t\tmaxBuffer: this.#limit,\n\t\t\ttimeout: this.#timeout,\n\t\t\twindowsHide: true,\n\t\t})\n\t\tconst code: unknown = result.error === undefined ? undefined : Reflect.get(result.error, 'code')\n\t\tif (code === 'ETIMEDOUT') {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} did not compile through ${project} within ${this.#timeout} ms; the compiler was stopped at the timeout.`,\n\t\t\t\t'timeout',\n\t\t\t\t{ context: { module, project, timeout: this.#timeout } },\n\t\t\t)\n\t\t}\n\t\tif (code === 'ENOBUFS') {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} wrote more than ${this.#limit} bytes of compiler output to one stream through ${project}; the compiler was stopped at the output bound.`,\n\t\t\t\t'overflow',\n\t\t\t\t{ context: { module, project, limit: this.#limit } },\n\t\t\t)\n\t\t}\n\t\tif (result.error !== undefined || result.status !== 0) {\n\t\t\tconst output = `${result.stdout ?? ''}${result.stderr ?? ''}${result.error?.message ?? ''}`\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} does not compile through ${project}:\\n${output}`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { module, project, output } },\n\t\t\t)\n\t\t}\n\t\treturn result.stdout\n\t}\n}\n","import type {\n\tGuideCommandContext,\n\tGuideCompilerInterface,\n\tGuideCommandHandler,\n\tGuideCommandInterface,\n\tGuideCommandOptions,\n\tGuideReadFunction,\n\tGuideRunnerFunction,\n} from './types.js'\nimport type { GuideModule, ParityFinding, ParityOptions } from '@src/core'\nimport { isError, isFiniteNumber, isFunction, isObject, isString } from '@orkestrel/contract'\nimport { globSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport process from 'node:process'\nimport { GuideError, normalizeDirectories, Parity, parseManifest } from '@src/core'\nimport { GUIDE_INDEX, GUIDE_MANIFEST, GUIDE_README, GUIDE_USAGE } from './constants.js'\nimport { GuideCompiler } from './GuideCompiler.js'\nimport {\n\tcomputeGuideEnvironment,\n\tcomputeGuideProject,\n\tformatGuideFinding,\n\tmatchesGuideResult,\n\tresolveGuideRoot,\n\tselectGuidePitch,\n} from './helpers.js'\nimport { parseGuideDirection, parsePackageName } from './parsers.js'\n\n/**\n * Drives native checking and explicit rewrites or registers package assertions in the guides\n * worker.\n *\n * @param options - The workspace policy and direct host ports\n *\n * @example\n * ```ts\n * import { GuideCommand } from '@orkestrel/guide/server'\n * import { readInventory } from '@orkestrel/test/server'\n * import { createVitest } from 'vitest/node'\n *\n * await new GuideCommand({\n * \troot: new URL('../', import.meta.url),\n * \tpatterns: ['src/**\\/*.ts', 'tests/**\\/*.ts', 'guides/*.md', '*.md'],\n * \tmodules: { '@scope/widget': 'src/core' },\n * \tlanguages: ['ts'],\n * \tlanguage: 'ts',\n * \treader: readInventory,\n * \trunner: createVitest,\n * }).execute(async ({ files, report, root, rows }) => {\n * \tconst { expect, it } = await import('vitest')\n * \tit('checks the documented inventory', () => {\n * \t\texpect(root.length).toBeGreaterThan(0)\n * \t\texpect(Object.keys(files).length).toBeGreaterThan(0)\n * \t\texpect(rows.length).toBeGreaterThan(0)\n * \t\texpect(report.input).toEqual([])\n * \t})\n * })\n * ```\n */\nexport class GuideCommand implements GuideCommandInterface {\n\treadonly #root: string\n\treadonly #patterns: readonly string[]\n\treadonly #modules: Readonly<Record<string, GuideModule>>\n\treadonly #languages: readonly string[]\n\treadonly #language: string\n\treadonly #reader: GuideReadFunction\n\treadonly #runner: GuideRunnerFunction\n\treadonly #compiler: GuideCompilerInterface\n\n\tconstructor(options: GuideCommandOptions) {\n\t\tthis.#root = resolveGuideRoot(options.root)\n\t\tthis.#patterns = Object.freeze([...options.patterns])\n\t\tthis.#modules = Object.freeze({ ...options.modules })\n\t\tthis.#languages = Object.freeze([...options.languages])\n\t\tthis.#language = options.language\n\t\tthis.#reader = options.reader\n\t\tthis.#runner = options.runner\n\t\tthis.#compiler = new GuideCompiler({ root: this.#root })\n\t}\n\n\t/**\n\t * Runs the native command or registers package assertions with fresh worker inventory and parity.\n\t *\n\t * @param register - The package-owned assertion registration callback\n\t * @returns A promise that resolves after the selected command path finishes\n\t * @throws When worker inventory reading or package assertion registration fails. Native failures\n\t * are reported through stderr and process exit status before this promise resolves.\n\t */\n\tasync execute(register: GuideCommandHandler): Promise<void> {\n\t\tif (process.env.VITEST === 'true') {\n\t\t\tawait this.#register(register)\n\t\t\treturn\n\t\t}\n\t\ttry {\n\t\t\tawait this.#executeNative()\n\t\t} catch (error) {\n\t\t\tprocess.stderr.write(`${isError(error) ? error.message : String(error)}\\n`)\n\t\t\tthis.#raise(1)\n\t\t}\n\t}\n\n\t// `compiled` holds each environment's emit across one command run's inventory reads.\n\t#createOptions(\n\t\tcompiled: Map<string, Readonly<Record<string, string>>>,\n\t): ParityOptions | undefined {\n\t\tconst files = this.#readInventory()\n\t\tconst manifest = files[GUIDE_INDEX]\n\t\tif (manifest === undefined) return undefined\n\t\tconst entries = Object.freeze([...parseManifest(manifest, 'guides')])\n\t\tconst packageFiles = Object.freeze({ ...this.#reader(this.#root, [GUIDE_MANIFEST]) })\n\t\tconst packageManifest = packageFiles[GUIDE_MANIFEST]\n\t\tconst pitch = selectGuidePitch(\n\t\t\tentries,\n\t\t\tpackageManifest === undefined ? undefined : parsePackageName(packageManifest),\n\t\t)\n\t\tconst options: ParityOptions = {\n\t\t\tfiles,\n\t\t\tentries,\n\t\t\tmodules: this.#modules,\n\t\t\tlanguages: this.#languages,\n\t\t\tlanguage: this.#language,\n\t\t\t...(pitch === undefined\n\t\t\t\t? {}\n\t\t\t\t: { pitch: Object.freeze({ readme: GUIDE_README, spec: pitch }) }),\n\t\t}\n\t\t// Parity parses every manifest guide at construction, so a malformed guide refuses first.\n\t\tconst sources = new Set(\n\t\t\tnew Parity(options).rows().flatMap((row) => normalizeDirectories(row.entry.source)),\n\t\t)\n\t\tconst environments = new Set(\n\t\t\tArray.from(sources).map((source) => computeGuideEnvironment(source) ?? source),\n\t\t)\n\t\tfor (const environment of environments) {\n\t\t\tif (!compiled.has(environment)) compiled.set(environment, this.#compiler.compile(environment))\n\t\t}\n\t\tconst declarations = Object.freeze(\n\t\t\tObject.fromEntries(\n\t\t\t\tArray.from(compiled)\n\t\t\t\t\t.filter(([environment]) => environments.has(environment))\n\t\t\t\t\t.flatMap(([, emitted]) => Object.entries(emitted)),\n\t\t\t),\n\t\t)\n\t\tconst missing = Array.from(sources).flatMap((module) => {\n\t\t\tconst project = computeGuideProject(computeGuideEnvironment(module) ?? module)\n\t\t\treturn project === undefined ||\n\t\t\t\tObject.keys(declarations).some((key) => key.startsWith(`${module}/`))\n\t\t\t\t? []\n\t\t\t\t: [{ module, project }]\n\t\t})\n\t\tif (missing.length > 0) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${missing.map(({ module, project }) => `${JSON.stringify(module)} emitted no declaration under ${module} through ${project}`).join('; ')}; each project's include must cover its module and its declarations must emit into --outDir, with no declarationDir.`,\n\t\t\t\t'empty',\n\t\t\t\t{ context: { missing } },\n\t\t\t)\n\t\t}\n\t\treturn { ...options, declarations }\n\t}\n\n\tasync #executeNative(): Promise<void> {\n\t\tconst args = process.argv.slice(2)\n\t\tconst direction = parseGuideDirection(args)\n\t\tif (direction === undefined && args.length > 0) {\n\t\t\tprocess.stdout.write(`${GUIDE_USAGE}\\n`)\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tif (direction === undefined) {\n\t\t\tif (!(await this.#executeRunner())) this.#raise(1)\n\t\t\treturn\n\t\t}\n\n\t\tconst compiled = new Map<string, Readonly<Record<string, string>>>()\n\t\tconst options = this.#createOptions(compiled)\n\t\tif (options === undefined) {\n\t\t\tthis.#reportMissing()\n\t\t\treturn\n\t\t}\n\t\tconst parity = new Parity(options)\n\t\tif (this.#report(parity.inspect().input)) {\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tconst rewritten = direction === 'guide' ? parity.document() : parity.annotate()\n\t\tfor (const change of rewritten.changes) {\n\t\t\twriteFileSync(resolve(this.#root, change.path), change.content)\n\t\t\tprocess.stdout.write(`wrote ${change.path}\\n`)\n\t\t}\n\n\t\tconst freshOptions = this.#createOptions(compiled)\n\t\tif (freshOptions === undefined) {\n\t\t\tthis.#reportMissing()\n\t\t\treturn\n\t\t}\n\t\tconst freshParity = new Parity(freshOptions)\n\t\tconst freshReport = freshParity.inspect()\n\t\tif (this.#report(freshReport.input)) {\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tconst remaining =\n\t\t\tdirection === 'guide' ? freshParity.document().findings : freshParity.annotate().findings\n\t\tif (this.#report(remaining)) this.#raise(1)\n\t\tif (this.#report(freshReport.pitch)) this.#raise(1)\n\t\tif (rewritten.changes.length > 0) process.stdout.write('next: npm run format\\n')\n\t\tif (!(await this.#executeRunner())) this.#raise(1)\n\t}\n\n\t#readInventory(): Readonly<Record<string, string>> {\n\t\tconst targets = globSync([...this.#patterns], { cwd: this.#root }).map((path) =>\n\t\t\tpath.replaceAll('\\\\', '/'),\n\t\t)\n\t\treturn Object.freeze({ ...this.#reader(this.#root, targets) })\n\t}\n\n\tasync #register(register: GuideCommandHandler): Promise<void> {\n\t\tconst options = this.#createOptions(new Map())\n\t\tif (options === undefined) {\n\t\t\tthrow new Error('The inventory carries no guides/README.md to index from')\n\t\t}\n\t\tconst parity = new Parity(options)\n\t\tconst context: GuideCommandContext = Object.freeze({\n\t\t\troot: this.#root,\n\t\t\tfiles: options.files,\n\t\t\trows: parity.rows(),\n\t\t\treport: parity.inspect(),\n\t\t})\n\t\tawait register(context)\n\t}\n\n\t#report(findings: readonly ParityFinding[]): boolean {\n\t\tfor (const finding of findings) {\n\t\t\tprocess.stdout.write(`${formatGuideFinding(finding)}\\n`)\n\t\t}\n\t\treturn findings.length > 0\n\t}\n\n\t#reportMissing(): void {\n\t\tprocess.stdout.write(`${GUIDE_INDEX}: the workspace carries no concept index to read\\n`)\n\t\tthis.#raise(2)\n\t}\n\n\tasync #executeRunner(): Promise<boolean> {\n\t\tconst runner = await this.#runner('test', {\n\t\t\troot: this.#root,\n\t\t\tconfig: resolve(this.#root, 'vite.config.ts'),\n\t\t\tproject: 'guides',\n\t\t\treporters: 'dot',\n\t\t\tcache: false,\n\t\t\twatch: false,\n\t\t})\n\t\tif (!isObject(runner)) throw new Error('The guides runner is not an object')\n\t\tconst close = Reflect.get(runner, 'close')\n\t\tif (!isFunction(close)) throw new Error('The guides runner has no callable close member')\n\t\ttry {\n\t\t\tconst start = Reflect.get(runner, 'start')\n\t\t\tif (!isFunction(start)) throw new Error('The guides runner has no callable start member')\n\t\t\treturn matchesGuideResult(await Reflect.apply(start, runner, []))\n\t\t} finally {\n\t\t\tawait Reflect.apply(close, runner, [])\n\t\t}\n\t}\n\n\t#raise(code: number): void {\n\t\tconst current = process.exitCode\n\t\tconst numeric = isString(current) ? Number.parseInt(current, 10) : current\n\t\tif (!isFiniteNumber(numeric) || numeric < code) {\n\t\t\tprocess.exitCode = code\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAa,cAAc;;AAG3B,IAAa,iBAAiB;;AAG9B,IAAa,eAAe;;AAG5B,IAAa,cAAc;;AAG3B,IAAa,uBAAuB;;AAGpC,IAAa,wBAAwB;;AAGrC,IAAa,yBAAyB;;;;;AAMtC,IAAa,uBAAuB;;;;;;;;;;;;;ACRpC,SAAgB,mBAAmB,SAAgC;CAClE,MAAM,OAAO,QAAQ;CAErB,OAAO,GADQ,SAAS,KAAA,KAAa,QAAQ,KAAK,WAAW,IAAI,IAAI,KAAK,GAAG,KAAK,KAC/D,QAAQ;AAC5B;;;;;;;;;;;;AAaA,SAAg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,MAAM,KAAK,QAAQ,QAAQ;GACzC,MAAM,KAAK;GACX,SAAA,GAAQG,UAAAA,QAAAA,CAAQ,KAAK,OAAO,gBAAgB;GAC5C,SAAS;GACT,WAAW;GACX,OAAO;GACP,OAAO;EACR,CAAC;EACD,IAAI,EAAA,GAACE,oBAAAA,SAAAA,CAAS,MAAM,GAAG,MAAM,IAAI,MAAM,oCAAoC;EAC3E,MAAM,QAAQ,QAAQ,IAAI,QAAQ,OAAO;EACzC,IAAI,EAAA,GAACC,oBAAAA,WAAAA,CAAW,KAAK,GAAG,MAAM,IAAI,MAAM,gDAAgD;EACxF,IAAI;GACH,MAAM,QAAQ,QAAQ,IAAI,QAAQ,OAAO;GACzC,IAAI,EAAA,GAACA,oBAAAA,WAAAA,CAAW,KAAK,GAAG,MAAM,IAAI,MAAM,gDAAgD;GACxF,OAAO,mBAAmB,MAAM,QAAQ,MAAM,OAAO,QAAQ,CAAC,CAAC,CAAC;EACjE,UAAU;GACT,MAAM,QAAQ,MAAM,OAAO,QAAQ,CAAC,CAAC;EACtC;CACD;CAEA,OAAO,MAAoB;EAC1B,MAAM,UAAUT,aAAAA,QAAQ;EACxB,MAAM,WAAA,GAAUU,oBAAAA,SAAAA,CAAS,OAAO,IAAI,OAAO,SAAS,SAAS,EAAE,IAAI;EACnE,IAAI,EAAA,GAACC,oBAAAA,eAAAA,CAAe,OAAO,KAAK,UAAU,MACzC,aAAA,QAAA,WAAmB;CAErB;AACD"}
|
|
@@ -5,6 +5,21 @@ import type { ParityFinding } from '@orkestrel/guide';
|
|
|
5
5
|
import type { ParityResult } from '@orkestrel/guide';
|
|
6
6
|
import type { ParityRow } from '@orkestrel/guide';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Computes the environment directory whose project compiles a guide source.
|
|
10
|
+
*
|
|
11
|
+
* @param source - The workspace-relative source directory
|
|
12
|
+
* @returns The `src/<env>` or `app/<env>` directory that `source` equals or sits beneath, or
|
|
13
|
+
* `undefined` for a source under neither
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* computeGuideEnvironment('src/core/panels') // 'src/core'
|
|
18
|
+
* computeGuideEnvironment('lib/core') // undefined
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function computeGuideEnvironment(source: string): string | undefined;
|
|
22
|
+
|
|
8
23
|
/**
|
|
9
24
|
* Computes the scoped project a guide module's declarations are emitted through.
|
|
10
25
|
*
|
|
@@ -5,6 +5,21 @@ import type { ParityFinding } from '@orkestrel/guide';
|
|
|
5
5
|
import type { ParityResult } from '@orkestrel/guide';
|
|
6
6
|
import type { ParityRow } from '@orkestrel/guide';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Computes the environment directory whose project compiles a guide source.
|
|
10
|
+
*
|
|
11
|
+
* @param source - The workspace-relative source directory
|
|
12
|
+
* @returns The `src/<env>` or `app/<env>` directory that `source` equals or sits beneath, or
|
|
13
|
+
* `undefined` for a source under neither
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* computeGuideEnvironment('src/core/panels') // 'src/core'
|
|
18
|
+
* computeGuideEnvironment('lib/core') // undefined
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function computeGuideEnvironment(source: string): string | undefined;
|
|
22
|
+
|
|
8
23
|
/**
|
|
9
24
|
* Computes the scoped project a guide module's declarations are emitted through.
|
|
10
25
|
*
|
package/dist/src/server/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isArray, isError, isFiniteNumber, isFunction, isInstance, isNonEmptyString, isObject, isRecord, isString, parseEnum, parseJSONAs } from "@orkestrel/contract";
|
|
2
2
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { GuideError, Parity, hasCanonicalSegments, normalizeDirectories, parseManifest } from "../core/index.js";
|
|
4
5
|
import { existsSync, globSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
5
6
|
import process from "node:process";
|
|
6
|
-
import { GuideError, Parity, normalizeDirectories, parseManifest } from "../core/index.js";
|
|
7
7
|
import { spawnSync } from "node:child_process";
|
|
8
8
|
import { tmpdir } from "node:os";
|
|
9
9
|
// src/server/constants.ts
|
|
@@ -119,6 +119,23 @@ function computeGuideProject(module) {
|
|
|
119
119
|
if (layer === void 0 || environment === void 0) return void 0;
|
|
120
120
|
return `configs/${layer}/tsconfig.${environment}.json`;
|
|
121
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Computes the environment directory whose project compiles a guide source.
|
|
124
|
+
*
|
|
125
|
+
* @param source - The workspace-relative source directory
|
|
126
|
+
* @returns The `src/<env>` or `app/<env>` directory that `source` equals or sits beneath, or
|
|
127
|
+
* `undefined` for a source under neither
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* computeGuideEnvironment('src/core/panels') // 'src/core'
|
|
132
|
+
* computeGuideEnvironment('lib/core') // undefined
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
function computeGuideEnvironment(source) {
|
|
136
|
+
if (!hasCanonicalSegments(source)) return void 0;
|
|
137
|
+
return /^(?:src|app)\/[A-Za-z0-9_-]+(?=\/|$)/.exec(source)?.[0];
|
|
138
|
+
}
|
|
122
139
|
// src/server/parsers.ts
|
|
123
140
|
/**
|
|
124
141
|
* Maps the supported `--to guide` and `--to source` arguments to an explicit rewrite destination.
|
|
@@ -409,9 +426,18 @@ var GuideCommand = class {
|
|
|
409
426
|
spec: pitch
|
|
410
427
|
}) }
|
|
411
428
|
};
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
const
|
|
429
|
+
const sources = new Set(new Parity(options).rows().flatMap((row) => normalizeDirectories(row.entry.source)));
|
|
430
|
+
const environments = new Set(Array.from(sources).map((source) => computeGuideEnvironment(source) ?? source));
|
|
431
|
+
for (const environment of environments) if (!compiled.has(environment)) compiled.set(environment, this.#compiler.compile(environment));
|
|
432
|
+
const declarations = Object.freeze(Object.fromEntries(Array.from(compiled).filter(([environment]) => environments.has(environment)).flatMap(([, emitted]) => Object.entries(emitted))));
|
|
433
|
+
const missing = Array.from(sources).flatMap((module) => {
|
|
434
|
+
const project = computeGuideProject(computeGuideEnvironment(module) ?? module);
|
|
435
|
+
return project === void 0 || Object.keys(declarations).some((key) => key.startsWith(`${module}/`)) ? [] : [{
|
|
436
|
+
module,
|
|
437
|
+
project
|
|
438
|
+
}];
|
|
439
|
+
});
|
|
440
|
+
if (missing.length > 0) throw new GuideError(`${missing.map(({ module, project }) => `${JSON.stringify(module)} emitted no declaration under ${module} through ${project}`).join("; ")}; each project's include must cover its module and its declarations must emit into --outDir, with no declarationDir.`, "empty", { context: { missing } });
|
|
415
441
|
return {
|
|
416
442
|
...options,
|
|
417
443
|
declarations
|
|
@@ -511,6 +537,6 @@ var GuideCommand = class {
|
|
|
511
537
|
if (!isFiniteNumber(numeric) || numeric < code) process.exitCode = code;
|
|
512
538
|
}
|
|
513
539
|
};
|
|
514
|
-
export { GUIDE_COMPILER_LIMIT, GUIDE_COMPILER_TIMEOUT, GUIDE_INDEX, GUIDE_MANIFEST, GUIDE_README, GUIDE_SCRATCH_PREFIX, GUIDE_SCRATCH_RETRIES, GUIDE_USAGE, GuideCommand, GuideCompiler, computeGuideProject, formatGuideFinding, matchesGuideResult, parseCompilerRoot, parseGuideDirection, parsePackageName, resolveGuideRoot, selectGuidePitch };
|
|
540
|
+
export { GUIDE_COMPILER_LIMIT, GUIDE_COMPILER_TIMEOUT, GUIDE_INDEX, GUIDE_MANIFEST, GUIDE_README, GUIDE_SCRATCH_PREFIX, GUIDE_SCRATCH_RETRIES, GUIDE_USAGE, GuideCommand, GuideCompiler, computeGuideEnvironment, computeGuideProject, formatGuideFinding, matchesGuideResult, parseCompilerRoot, parseGuideDirection, parsePackageName, resolveGuideRoot, selectGuidePitch };
|
|
515
541
|
|
|
516
542
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/server/constants.ts","../../../src/server/helpers.ts","../../../src/server/parsers.ts","../../../src/server/GuideCompiler.ts","../../../src/server/GuideCommand.ts"],"sourcesContent":["/** Names the workspace-relative guide concept index. */\nexport const GUIDE_INDEX = 'guides/README.md'\n\n/** Names the package manifest read for native pitch selection. */\nexport const GUIDE_MANIFEST = 'package.json'\n\n/** Names the package README paired with its indexed guide pitch. */\nexport const GUIDE_README = 'README.md'\n\n/** Holds the native command usage text written for unsupported arguments. */\nexport const GUIDE_USAGE = 'usage: npm run test:guides [-- --to guide|--to source]'\n\n/** Names the host temporary directory prefix of a declaration emit's scratch output. */\nexport const GUIDE_SCRATCH_PREFIX = 'orkestrel-guide-'\n\n/** Holds the removal retries a declaration emit's scratch output takes on a busy host. */\nexport const GUIDE_SCRATCH_RETRIES = 3\n\n/** Holds the default milliseconds one compiler run may take before it is stopped. */\nexport const GUIDE_COMPILER_TIMEOUT = 300_000\n\n/**\n * Holds the default bytes of output one compiler run may write to each stream, room for the\n * diagnostics of a large failing project.\n */\nexport const GUIDE_COMPILER_LIMIT = 64 * 1024 * 1024\n","import type { ManifestEntry, ParityFinding } from '@src/core'\nimport { isArray, isFunction, isInstance, isObject } from '@orkestrel/contract'\nimport { resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\n/**\n * Formats one finding with its guide prefix when needed.\n *\n * @param finding - The finding to format\n * @returns The finding text with its spec prefix when the text does not already carry it\n *\n * @example\n * ```ts\n * formatGuideFinding({ spec: 'guides/widget.md', text: 'missing export' })\n * ```\n */\nexport function formatGuideFinding(finding: ParityFinding): string {\n\tconst spec = finding.spec\n\tconst prefix = spec === undefined || finding.text.startsWith(spec) ? '' : `${spec} `\n\treturn `${prefix}${finding.text}`\n}\n\n/**\n * Reads an owned foreign result view and accepts passed modules without unhandled errors.\n *\n * @param result - The unknown external runner result to inspect\n * @returns True if a module is present, every module passed, and no unhandled error exists; false otherwise\n *\n * @example\n * ```ts\n * matchesGuideResult({ testModules: [{ state: () => 'passed' }], unhandledErrors: [] })\n * ```\n */\nexport function matchesGuideResult(result: unknown): boolean {\n\tif (!isObject(result)) return false\n\tconst testModules = Reflect.get(result, 'testModules')\n\tconst unhandledErrors = Reflect.get(result, 'unhandledErrors')\n\tif (!isArray(testModules) || !isArray(unhandledErrors)) return false\n\tconst modules = [...testModules]\n\tconst errors = [...unhandledErrors]\n\tif (modules.length === 0 || errors.length > 0) return false\n\tfor (const module of modules) {\n\t\tif (!isObject(module)) return false\n\t\tconst state = Reflect.get(module, 'state')\n\t\tif (!isFunction(state) || Reflect.apply(state, module, []) !== 'passed') return false\n\t}\n\treturn true\n}\n\n/**\n * Resolves a command root to a native absolute path.\n *\n * @param root - The workspace root as a file URL or native path\n * @returns The native absolute workspace path\n *\n * @example\n * ```ts\n * resolveGuideRoot('/workspace')\n * ```\n */\nexport function resolveGuideRoot(root: URL | string): string {\n\treturn resolve(isInstance(root, URL) ? fileURLToPath(root) : root)\n}\n\n/**\n * Selects the indexed guide matching a package's bare name.\n *\n * @param entries - The concept-index entries to search\n * @param name - The package's bare name, or `undefined` when none was parsed\n * @returns The indexed own-guide path, or `undefined` when the index carries none\n *\n * @example\n * ```ts\n * selectGuidePitch([{ concept: 'Widget', spec: 'guides/widget.md', source: 'src', tests: 'tests' }], 'widget')\n * ```\n */\nexport function selectGuidePitch(\n\tentries: readonly ManifestEntry[],\n\tname: string | undefined,\n): string | undefined {\n\tif (name === undefined) return undefined\n\tconst spec = `guides/${name}.md`\n\treturn entries.some((entry) => entry.spec === spec) ? spec : undefined\n}\n\n/**\n * Computes the scoped project a guide module's declarations are emitted through.\n *\n * @param module - The workspace-relative module directory\n * @returns The workspace-relative `configs/<layer>/tsconfig.<env>.json` path for a module\n * `src/<env>` or `app/<env>`, or `undefined` for any other module\n *\n * @example\n * ```ts\n * computeGuideProject('src/core') // 'configs/src/tsconfig.core.json'\n * computeGuideProject('src/core/sources') // undefined\n * ```\n */\nexport function computeGuideProject(module: string): string | undefined {\n\tconst matched = /^(src|app)\\/([A-Za-z0-9_-]+)$/.exec(module)\n\tconst layer = matched?.[1]\n\tconst environment = matched?.[2]\n\tif (layer === undefined || environment === undefined) return undefined\n\treturn `configs/${layer}/tsconfig.${environment}.json`\n}\n","import type { ParityDirection } from '@src/core'\nimport { isNonEmptyString, isRecord, parseEnum, parseJSONAs } from '@orkestrel/contract'\n\n/**\n * Maps the supported `--to guide` and `--to source` arguments to an explicit rewrite destination.\n *\n * @param args - The arguments after the native command entry\n * @returns The requested destination, or `undefined` when the shape is unsupported\n *\n * @example\n * ```ts\n * parseGuideDirection(['--to', 'guide'])\n * ```\n */\nexport function parseGuideDirection(args: readonly string[]): ParityDirection | undefined {\n\tif (args.length !== 2 || args[0] !== '--to') return undefined\n\treturn parseEnum(args[1], ['guide', 'source'])\n}\n\n/**\n * Reads the bare package name from package manifest JSON.\n *\n * @param manifest - The package manifest JSON text\n * @returns The name after its final scope separator, or `undefined` when no name is declared\n *\n * @example\n * ```ts\n * parsePackageName('{\"name\":\"@scope/widget\"}')\n * ```\n */\nexport function parsePackageName(manifest: string): string | undefined {\n\tconst parsed = parseJSONAs(manifest, isRecord)\n\tif (parsed === undefined) return undefined\n\tconst name = parsed.name\n\tif (!isNonEmptyString(name)) return undefined\n\treturn name.slice(name.lastIndexOf('/') + 1)\n}\n\n/**\n * Reads the `rootDir` a `tsc --showConfig` reading resolves.\n *\n * @param text - The compiler's `--showConfig` output\n * @returns The `rootDir` text, relative to the project file, or `undefined` when none is declared\n *\n * @example\n * ```ts\n * parseCompilerRoot('{\"compilerOptions\":{\"rootDir\":\"../../src/core\"}}') // '../../src/core'\n * ```\n */\nexport function parseCompilerRoot(text: string): string | undefined {\n\tconst parsed = parseJSONAs(text, isRecord)\n\tconst options = parsed?.compilerOptions\n\tif (!isRecord(options)) return undefined\n\tconst root = options.rootDir\n\treturn isNonEmptyString(root) ? root : undefined\n}\n","import type { GuideCompilerInterface, GuideCompilerOptions } from './types.js'\nimport { isNonEmptyString, isRecord, parseJSONAs } from '@orkestrel/contract'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { dirname, join, relative, resolve, sep } from 'node:path'\nimport process from 'node:process'\nimport { GuideError } from '@src/core'\nimport {\n\tGUIDE_COMPILER_LIMIT,\n\tGUIDE_COMPILER_TIMEOUT,\n\tGUIDE_SCRATCH_PREFIX,\n\tGUIDE_SCRATCH_RETRIES,\n} from './constants.js'\nimport { computeGuideProject, resolveGuideRoot } from './helpers.js'\nimport { parseCompilerRoot } from './parsers.js'\n\n/**\n * Emits a guide module's declarations through the workspace's own TypeScript compiler, the\n * projection every computed `Signature` cell is read from.\n *\n * @remarks\n * The compiler is the `bin.tsc` entry the workspace root's `node_modules/typescript/package.json`\n * names, run by `process.execPath` with no shell, under a timeout and a per-stream output bound. A\n * module `src/<env>` or `app/<env>` emits through `configs/<layer>/tsconfig.<env>.json` into a fresh\n * scratch directory, with comments removed and LF line endings, and the scratch directory is\n * removed before the call returns or throws. Its path never enters the result, so two compiles of\n * one tree under one compiler return the same text. Every refusal is a `GuideError` whose\n * `context` names the module and project, except that a module outside `src/<env>` and\n * `app/<env>` names the module alone and a workspace with no compiler names its `root`.\n *\n * @param options - The workspace root, the run bounds, and the scratch parent directory\n *\n * @example\n * ```ts\n * import { GuideCompiler } from '@orkestrel/guide/server'\n *\n * const declarations = new GuideCompiler({ root: new URL('../', import.meta.url) }).compile('src/core')\n * declarations['src/core/helpers.d.ts'] // 'export declare function …'\n * ```\n */\nexport class GuideCompiler implements GuideCompilerInterface {\n\treadonly #root: string\n\treadonly #timeout: number\n\treadonly #limit: number\n\treadonly #temporary: string | undefined\n\n\tconstructor(options: GuideCompilerOptions) {\n\t\tthis.#root = resolveGuideRoot(options.root)\n\t\tthis.#timeout = options.timeout ?? GUIDE_COMPILER_TIMEOUT\n\t\tthis.#limit = options.limit ?? GUIDE_COMPILER_LIMIT\n\t\tthis.#temporary = options.temporary\n\t}\n\n\t/**\n\t * Emits the declarations of one `src/<env>` or `app/<env>` module through its scoped project.\n\t *\n\t * @param module - The workspace-relative module directory, `src/<env>` or `app/<env>`\n\t * @returns The emitted declaration text keyed by workspace-relative `.d.ts` path, sorted by key\n\t * @throws `GuideError` with code `compile` when the module is outside `src/<env>` and\n\t * `app/<env>`, the workspace installs no TypeScript compiler, the project declares no\n\t * `rootDir`, or the compiler exits non-zero; `empty` when the project emits no declaration under\n\t * the module; `timeout` when a run passes the timeout; and `overflow` when a run passes the output\n\t * bound\n\t *\n\t * @example\n\t * ```ts\n\t * compiler.compile('src/core')['src/core/types.d.ts'] // 'export type …'\n\t * ```\n\t */\n\tcompile(module: string): Readonly<Record<string, string>> {\n\t\tconst project = computeGuideProject(module)\n\t\tif (project === undefined) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module.slice(0, 200))} is outside src/<env> and app/<env>; a guide module compiles through configs/<layer>/tsconfig.<env>.json, such as configs/src/tsconfig.core.json for src/core.`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { module: module.slice(0, 200) } },\n\t\t\t)\n\t\t}\n\t\tconst compiler = this.#locate()\n\t\tconst path = resolve(this.#root, project)\n\t\tconst root = parseCompilerRoot(\n\t\t\tthis.#run(module, project, compiler, ['--showConfig', '-p', path]),\n\t\t)\n\t\tif (root === undefined) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} compiles through ${project}, which declares no rootDir.`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { module, project } },\n\t\t\t)\n\t\t}\n\t\tconst base = resolve(dirname(path), root)\n\t\tconst scratch = mkdtempSync(join(this.#temporary ?? tmpdir(), GUIDE_SCRATCH_PREFIX))\n\t\ttry {\n\t\t\tthis.#run(module, project, compiler, [\n\t\t\t\t'-p',\n\t\t\t\tpath,\n\t\t\t\t'--declaration',\n\t\t\t\t'--emitDeclarationOnly',\n\t\t\t\t'--noEmit',\n\t\t\t\t'false',\n\t\t\t\t'--declarationMap',\n\t\t\t\t'false',\n\t\t\t\t'--removeComments',\n\t\t\t\t'--newLine',\n\t\t\t\t'lf',\n\t\t\t\t'--outDir',\n\t\t\t\tscratch,\n\t\t\t])\n\t\t\tconst entries = readdirSync(scratch, { recursive: true, encoding: 'utf8' })\n\t\t\t\t.filter((file) => file.endsWith('.d.ts'))\n\t\t\t\t.map((file) => ({\n\t\t\t\t\tkey: relative(this.#root, resolve(base, file)).split(sep).join('/'),\n\t\t\t\t\tfile,\n\t\t\t\t}))\n\t\t\t\t.filter((entry) => entry.key.startsWith(`${module}/`))\n\t\t\t\t.sort((left, right) => (left.key === right.key ? 0 : left.key < right.key ? -1 : 1))\n\t\t\tif (entries.length === 0) {\n\t\t\t\tthrow new GuideError(\n\t\t\t\t\t`${JSON.stringify(module)} emitted no declaration under ${module} through ${project}; the project's include must cover ${module} and its declarations must emit into --outDir, with no declarationDir.`,\n\t\t\t\t\t'empty',\n\t\t\t\t\t{ context: { module, project } },\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst declarations = Object.freeze(\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tentries.map((entry) => [entry.key, readFileSync(join(scratch, entry.file), 'utf8')]),\n\t\t\t\t),\n\t\t\t)\n\t\t\trmSync(scratch, { recursive: true, force: true, maxRetries: GUIDE_SCRATCH_RETRIES })\n\t\t\treturn declarations\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\trmSync(scratch, { recursive: true, force: true, maxRetries: GUIDE_SCRATCH_RETRIES })\n\t\t\t} catch {\n\t\t\t\t// The compile error answers for this call; a removal failure must not replace it.\n\t\t\t}\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t// The workspace root's own compiler entry, named by its installed manifest's `bin.tsc`.\n\t#locate(): string {\n\t\tconst manifest = join(this.#root, 'node_modules', 'typescript', 'package.json')\n\t\tconst declared = existsSync(manifest)\n\t\t\t? parseJSONAs(readFileSync(manifest, 'utf8'), isRecord)\n\t\t\t: undefined\n\t\tconst bin = declared?.bin\n\t\tconst entry = isRecord(bin) ? bin.tsc : undefined\n\t\tif (!isNonEmptyString(entry)) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`The workspace at ${JSON.stringify(this.#root)} installs no TypeScript compiler; node_modules/typescript/package.json names no bin.tsc entry.`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { root: this.#root } },\n\t\t\t)\n\t\t}\n\t\treturn resolve(dirname(manifest), entry)\n\t}\n\n\t#run(module: string, project: string, compiler: string, args: readonly string[]): string {\n\t\tconst result = spawnSync(process.execPath, [compiler, ...args], {\n\t\t\tcwd: this.#root,\n\t\t\tencoding: 'utf8',\n\t\t\tmaxBuffer: this.#limit,\n\t\t\ttimeout: this.#timeout,\n\t\t\twindowsHide: true,\n\t\t})\n\t\tconst code: unknown = result.error === undefined ? undefined : Reflect.get(result.error, 'code')\n\t\tif (code === 'ETIMEDOUT') {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} did not compile through ${project} within ${this.#timeout} ms; the compiler was stopped at the timeout.`,\n\t\t\t\t'timeout',\n\t\t\t\t{ context: { module, project, timeout: this.#timeout } },\n\t\t\t)\n\t\t}\n\t\tif (code === 'ENOBUFS') {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} wrote more than ${this.#limit} bytes of compiler output to one stream through ${project}; the compiler was stopped at the output bound.`,\n\t\t\t\t'overflow',\n\t\t\t\t{ context: { module, project, limit: this.#limit } },\n\t\t\t)\n\t\t}\n\t\tif (result.error !== undefined || result.status !== 0) {\n\t\t\tconst output = `${result.stdout ?? ''}${result.stderr ?? ''}${result.error?.message ?? ''}`\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} does not compile through ${project}:\\n${output}`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { module, project, output } },\n\t\t\t)\n\t\t}\n\t\treturn result.stdout\n\t}\n}\n","import type {\n\tGuideCommandContext,\n\tGuideCompilerInterface,\n\tGuideCommandHandler,\n\tGuideCommandInterface,\n\tGuideCommandOptions,\n\tGuideReadFunction,\n\tGuideRunnerFunction,\n} from './types.js'\nimport type { GuideModule, ParityFinding, ParityOptions } from '@src/core'\nimport { isError, isFiniteNumber, isFunction, isObject, isString } from '@orkestrel/contract'\nimport { globSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport process from 'node:process'\nimport { normalizeDirectories, Parity, parseManifest } from '@src/core'\nimport { GUIDE_INDEX, GUIDE_MANIFEST, GUIDE_README, GUIDE_USAGE } from './constants.js'\nimport { GuideCompiler } from './GuideCompiler.js'\nimport {\n\tformatGuideFinding,\n\tmatchesGuideResult,\n\tresolveGuideRoot,\n\tselectGuidePitch,\n} from './helpers.js'\nimport { parseGuideDirection, parsePackageName } from './parsers.js'\n\n/**\n * Drives native checking and explicit rewrites or registers package assertions in the guides\n * worker.\n *\n * @param options - The workspace policy and direct host ports\n *\n * @example\n * ```ts\n * import { GuideCommand } from '@orkestrel/guide/server'\n * import { readInventory } from '@orkestrel/test/server'\n * import { createVitest } from 'vitest/node'\n *\n * await new GuideCommand({\n * \troot: new URL('../', import.meta.url),\n * \tpatterns: ['src/**\\/*.ts', 'tests/**\\/*.ts', 'guides/*.md', '*.md'],\n * \tmodules: { '@scope/widget': 'src/core' },\n * \tlanguages: ['ts'],\n * \tlanguage: 'ts',\n * \treader: readInventory,\n * \trunner: createVitest,\n * }).execute(async ({ files, report, root, rows }) => {\n * \tconst { expect, it } = await import('vitest')\n * \tit('checks the documented inventory', () => {\n * \t\texpect(root.length).toBeGreaterThan(0)\n * \t\texpect(Object.keys(files).length).toBeGreaterThan(0)\n * \t\texpect(rows.length).toBeGreaterThan(0)\n * \t\texpect(report.input).toEqual([])\n * \t})\n * })\n * ```\n */\nexport class GuideCommand implements GuideCommandInterface {\n\treadonly #root: string\n\treadonly #patterns: readonly string[]\n\treadonly #modules: Readonly<Record<string, GuideModule>>\n\treadonly #languages: readonly string[]\n\treadonly #language: string\n\treadonly #reader: GuideReadFunction\n\treadonly #runner: GuideRunnerFunction\n\treadonly #compiler: GuideCompilerInterface\n\n\tconstructor(options: GuideCommandOptions) {\n\t\tthis.#root = resolveGuideRoot(options.root)\n\t\tthis.#patterns = Object.freeze([...options.patterns])\n\t\tthis.#modules = Object.freeze({ ...options.modules })\n\t\tthis.#languages = Object.freeze([...options.languages])\n\t\tthis.#language = options.language\n\t\tthis.#reader = options.reader\n\t\tthis.#runner = options.runner\n\t\tthis.#compiler = new GuideCompiler({ root: this.#root })\n\t}\n\n\t/**\n\t * Runs the native command or registers package assertions with fresh worker inventory and parity.\n\t *\n\t * @param register - The package-owned assertion registration callback\n\t * @returns A promise that resolves after the selected command path finishes\n\t * @throws When worker inventory reading or package assertion registration fails. Native failures\n\t * are reported through stderr and process exit status before this promise resolves.\n\t */\n\tasync execute(register: GuideCommandHandler): Promise<void> {\n\t\tif (process.env.VITEST === 'true') {\n\t\t\tawait this.#register(register)\n\t\t\treturn\n\t\t}\n\t\ttry {\n\t\t\tawait this.#executeNative()\n\t\t} catch (error) {\n\t\t\tprocess.stderr.write(`${isError(error) ? error.message : String(error)}\\n`)\n\t\t\tthis.#raise(1)\n\t\t}\n\t}\n\n\t// `compiled` holds one command run's declarations by module, so a module compiles once per run.\n\t#createOptions(\n\t\tcompiled: Map<string, Readonly<Record<string, string>>>,\n\t): ParityOptions | undefined {\n\t\tconst files = this.#readInventory()\n\t\tconst manifest = files[GUIDE_INDEX]\n\t\tif (manifest === undefined) return undefined\n\t\tconst entries = Object.freeze([...parseManifest(manifest, 'guides')])\n\t\tconst packageFiles = Object.freeze({ ...this.#reader(this.#root, [GUIDE_MANIFEST]) })\n\t\tconst packageManifest = packageFiles[GUIDE_MANIFEST]\n\t\tconst pitch = selectGuidePitch(\n\t\t\tentries,\n\t\t\tpackageManifest === undefined ? undefined : parsePackageName(packageManifest),\n\t\t)\n\t\tconst options: ParityOptions = {\n\t\t\tfiles,\n\t\t\tentries,\n\t\t\tmodules: this.#modules,\n\t\t\tlanguages: this.#languages,\n\t\t\tlanguage: this.#language,\n\t\t\t...(pitch === undefined\n\t\t\t\t? {}\n\t\t\t\t: { pitch: Object.freeze({ readme: GUIDE_README, spec: pitch }) }),\n\t\t}\n\t\t// Parity parses every manifest guide at construction, so a malformed guide refuses before\n\t\t// any module compiles.\n\t\tconst directories = new Set(\n\t\t\tnew Parity(options).rows().flatMap((row) => normalizeDirectories(row.entry.source)),\n\t\t)\n\t\tfor (const directory of directories) {\n\t\t\tif (!compiled.has(directory)) compiled.set(directory, this.#compiler.compile(directory))\n\t\t}\n\t\tconst declarations = Object.freeze(\n\t\t\tObject.fromEntries(\n\t\t\t\tArray.from(directories).flatMap((directory) =>\n\t\t\t\t\tObject.entries(compiled.get(directory) ?? {}),\n\t\t\t\t),\n\t\t\t),\n\t\t)\n\t\treturn { ...options, declarations }\n\t}\n\n\tasync #executeNative(): Promise<void> {\n\t\tconst args = process.argv.slice(2)\n\t\tconst direction = parseGuideDirection(args)\n\t\tif (direction === undefined && args.length > 0) {\n\t\t\tprocess.stdout.write(`${GUIDE_USAGE}\\n`)\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tif (direction === undefined) {\n\t\t\tif (!(await this.#executeRunner())) this.#raise(1)\n\t\t\treturn\n\t\t}\n\n\t\tconst compiled = new Map<string, Readonly<Record<string, string>>>()\n\t\tconst options = this.#createOptions(compiled)\n\t\tif (options === undefined) {\n\t\t\tthis.#reportMissing()\n\t\t\treturn\n\t\t}\n\t\tconst parity = new Parity(options)\n\t\tif (this.#report(parity.inspect().input)) {\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tconst rewritten = direction === 'guide' ? parity.document() : parity.annotate()\n\t\tfor (const change of rewritten.changes) {\n\t\t\twriteFileSync(resolve(this.#root, change.path), change.content)\n\t\t\tprocess.stdout.write(`wrote ${change.path}\\n`)\n\t\t}\n\n\t\tconst freshOptions = this.#createOptions(compiled)\n\t\tif (freshOptions === undefined) {\n\t\t\tthis.#reportMissing()\n\t\t\treturn\n\t\t}\n\t\tconst freshParity = new Parity(freshOptions)\n\t\tconst freshReport = freshParity.inspect()\n\t\tif (this.#report(freshReport.input)) {\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tconst remaining =\n\t\t\tdirection === 'guide' ? freshParity.document().findings : freshParity.annotate().findings\n\t\tif (this.#report(remaining)) this.#raise(1)\n\t\tif (this.#report(freshReport.pitch)) this.#raise(1)\n\t\tif (rewritten.changes.length > 0) process.stdout.write('next: npm run format\\n')\n\t\tif (!(await this.#executeRunner())) this.#raise(1)\n\t}\n\n\t#readInventory(): Readonly<Record<string, string>> {\n\t\tconst targets = globSync([...this.#patterns], { cwd: this.#root }).map((path) =>\n\t\t\tpath.replaceAll('\\\\', '/'),\n\t\t)\n\t\treturn Object.freeze({ ...this.#reader(this.#root, targets) })\n\t}\n\n\tasync #register(register: GuideCommandHandler): Promise<void> {\n\t\tconst options = this.#createOptions(new Map())\n\t\tif (options === undefined) {\n\t\t\tthrow new Error('The inventory carries no guides/README.md to index from')\n\t\t}\n\t\tconst parity = new Parity(options)\n\t\tconst context: GuideCommandContext = Object.freeze({\n\t\t\troot: this.#root,\n\t\t\tfiles: options.files,\n\t\t\trows: parity.rows(),\n\t\t\treport: parity.inspect(),\n\t\t})\n\t\tawait register(context)\n\t}\n\n\t#report(findings: readonly ParityFinding[]): boolean {\n\t\tfor (const finding of findings) {\n\t\t\tprocess.stdout.write(`${formatGuideFinding(finding)}\\n`)\n\t\t}\n\t\treturn findings.length > 0\n\t}\n\n\t#reportMissing(): void {\n\t\tprocess.stdout.write(`${GUIDE_INDEX}: the workspace carries no concept index to read\\n`)\n\t\tthis.#raise(2)\n\t}\n\n\tasync #executeRunner(): Promise<boolean> {\n\t\tconst runner = await this.#runner('test', {\n\t\t\troot: this.#root,\n\t\t\tconfig: resolve(this.#root, 'vite.config.ts'),\n\t\t\tproject: 'guides',\n\t\t\treporters: 'dot',\n\t\t\tcache: false,\n\t\t\twatch: false,\n\t\t})\n\t\tif (!isObject(runner)) throw new Error('The guides runner is not an object')\n\t\tconst close = Reflect.get(runner, 'close')\n\t\tif (!isFunction(close)) throw new Error('The guides runner has no callable close member')\n\t\ttry {\n\t\t\tconst start = Reflect.get(runner, 'start')\n\t\t\tif (!isFunction(start)) throw new Error('The guides runner has no callable start member')\n\t\t\treturn matchesGuideResult(await Reflect.apply(start, runner, []))\n\t\t} finally {\n\t\t\tawait Reflect.apply(close, runner, [])\n\t\t}\n\t}\n\n\t#raise(code: number): void {\n\t\tconst current = process.exitCode\n\t\tconst numeric = isString(current) ? Number.parseInt(current, 10) : current\n\t\tif (!isFiniteNumber(numeric) || numeric < code) {\n\t\t\tprocess.exitCode = code\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;AACA,IAAa,cAAc;;AAG3B,IAAa,iBAAiB;;AAG9B,IAAa,eAAe;;AAG5B,IAAa,cAAc;;AAG3B,IAAa,uBAAuB;;AAGpC,IAAa,wBAAwB;;AAGrC,IAAa,yBAAyB;;;;;AAMtC,IAAa,uBAAuB;;;;;;;;;;;;;ACTpC,SAAgB,mBAAmB,SAAgC;CAClE,MAAM,OAAO,QAAQ;CAErB,OAAO,GADQ,SAAS,KAAA,KAAa,QAAQ,KAAK,WAAW,IAAI,IAAI,KAAK,GAAG,KAAK,KAC/D,QAAQ;AAC5B;;;;;;;;;;;;AAaA,SAAgB,mBAAmB,QAA0B;CAC5D,IAAI,CAAC,SAAS,MAAM,GAAG,OAAO;CAC9B,MAAM,cAAc,QAAQ,IAAI,QAAQ,aAAa;CACrD,MAAM,kBAAkB,QAAQ,IAAI,QAAQ,iBAAiB;CAC7D,IAAI,CAAC,QAAQ,WAAW,KAAK,CAAC,QAAQ,eAAe,GAAG,OAAO;CAC/D,MAAM,UAAU,CAAC,GAAG,WAAW;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EA,QAAQ,UAA6C;EACpD,KAAK,MAAM,WAAW,UACrB,QAAQ,OAAO,MAAM,GAAG,mBAAmB,OAAO,EAAE,GAAG;EAExD,OAAO,SAAS,SAAS;CAC1B;CAEA,iBAAuB;EACtB,QAAQ,OAAO,MAAM,GAAG,YAAY,mDAAmD;EACvF,KAAK,OAAO,CAAC;CACd;CAEA,MAAM,iBAAmC;EACxC,MAAM,SAAS,MAAM,KAAK,QAAQ,QAAQ;GACzC,MAAM,KAAK;GACX,QAAQ,QAAQ,KAAK,OAAO,gBAAgB;GAC5C,SAAS;GACT,WAAW;GACX,OAAO;GACP,OAAO;EACR,CAAC;EACD,IAAI,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,oCAAoC;EAC3E,MAAM,QAAQ,QAAQ,IAAI,QAAQ,OAAO;EACzC,IAAI,CAAC,WAAW,KAAK,GAAG,MAAM,IAAI,MAAM,gDAAgD;EACxF,IAAI;GACH,MAAM,QAAQ,QAAQ,IAAI,QAAQ,OAAO;GACzC,IAAI,CAAC,WAAW,KAAK,GAAG,MAAM,IAAI,MAAM,gDAAgD;GACxF,OAAO,mBAAmB,MAAM,QAAQ,MAAM,OAAO,QAAQ,CAAC,CAAC,CAAC;EACjE,UAAU;GACT,MAAM,QAAQ,MAAM,OAAO,QAAQ,CAAC,CAAC;EACtC;CACD;CAEA,OAAO,MAAoB;EAC1B,MAAM,UAAU,QAAQ;EACxB,MAAM,UAAU,SAAS,OAAO,IAAI,OAAO,SAAS,SAAS,EAAE,IAAI;EACnE,IAAI,CAAC,eAAe,OAAO,KAAK,UAAU,MACzC,QAAQ,WAAW;CAErB;AACD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/server/constants.ts","../../../src/server/helpers.ts","../../../src/server/parsers.ts","../../../src/server/GuideCompiler.ts","../../../src/server/GuideCommand.ts"],"sourcesContent":["/** Names the workspace-relative guide concept index. */\nexport const GUIDE_INDEX = 'guides/README.md'\n\n/** Names the package manifest read for native pitch selection. */\nexport const GUIDE_MANIFEST = 'package.json'\n\n/** Names the package README paired with its indexed guide pitch. */\nexport const GUIDE_README = 'README.md'\n\n/** Holds the native command usage text written for unsupported arguments. */\nexport const GUIDE_USAGE = 'usage: npm run test:guides [-- --to guide|--to source]'\n\n/** Names the host temporary directory prefix of a declaration emit's scratch output. */\nexport const GUIDE_SCRATCH_PREFIX = 'orkestrel-guide-'\n\n/** Holds the removal retries a declaration emit's scratch output takes on a busy host. */\nexport const GUIDE_SCRATCH_RETRIES = 3\n\n/** Holds the default milliseconds one compiler run may take before it is stopped. */\nexport const GUIDE_COMPILER_TIMEOUT = 300_000\n\n/**\n * Holds the default bytes of output one compiler run may write to each stream, room for the\n * diagnostics of a large failing project.\n */\nexport const GUIDE_COMPILER_LIMIT = 64 * 1024 * 1024\n","import type { ManifestEntry, ParityFinding } from '@src/core'\nimport { isArray, isFunction, isInstance, isObject } from '@orkestrel/contract'\nimport { resolve } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { hasCanonicalSegments } from '@src/core'\n\n/**\n * Formats one finding with its guide prefix when needed.\n *\n * @param finding - The finding to format\n * @returns The finding text with its spec prefix when the text does not already carry it\n *\n * @example\n * ```ts\n * formatGuideFinding({ spec: 'guides/widget.md', text: 'missing export' })\n * ```\n */\nexport function formatGuideFinding(finding: ParityFinding): string {\n\tconst spec = finding.spec\n\tconst prefix = spec === undefined || finding.text.startsWith(spec) ? '' : `${spec} `\n\treturn `${prefix}${finding.text}`\n}\n\n/**\n * Reads an owned foreign result view and accepts passed modules without unhandled errors.\n *\n * @param result - The unknown external runner result to inspect\n * @returns True if a module is present, every module passed, and no unhandled error exists; false otherwise\n *\n * @example\n * ```ts\n * matchesGuideResult({ testModules: [{ state: () => 'passed' }], unhandledErrors: [] })\n * ```\n */\nexport function matchesGuideResult(result: unknown): boolean {\n\tif (!isObject(result)) return false\n\tconst testModules = Reflect.get(result, 'testModules')\n\tconst unhandledErrors = Reflect.get(result, 'unhandledErrors')\n\tif (!isArray(testModules) || !isArray(unhandledErrors)) return false\n\tconst modules = [...testModules]\n\tconst errors = [...unhandledErrors]\n\tif (modules.length === 0 || errors.length > 0) return false\n\tfor (const module of modules) {\n\t\tif (!isObject(module)) return false\n\t\tconst state = Reflect.get(module, 'state')\n\t\tif (!isFunction(state) || Reflect.apply(state, module, []) !== 'passed') return false\n\t}\n\treturn true\n}\n\n/**\n * Resolves a command root to a native absolute path.\n *\n * @param root - The workspace root as a file URL or native path\n * @returns The native absolute workspace path\n *\n * @example\n * ```ts\n * resolveGuideRoot('/workspace')\n * ```\n */\nexport function resolveGuideRoot(root: URL | string): string {\n\treturn resolve(isInstance(root, URL) ? fileURLToPath(root) : root)\n}\n\n/**\n * Selects the indexed guide matching a package's bare name.\n *\n * @param entries - The concept-index entries to search\n * @param name - The package's bare name, or `undefined` when none was parsed\n * @returns The indexed own-guide path, or `undefined` when the index carries none\n *\n * @example\n * ```ts\n * selectGuidePitch([{ concept: 'Widget', spec: 'guides/widget.md', source: 'src', tests: 'tests' }], 'widget')\n * ```\n */\nexport function selectGuidePitch(\n\tentries: readonly ManifestEntry[],\n\tname: string | undefined,\n): string | undefined {\n\tif (name === undefined) return undefined\n\tconst spec = `guides/${name}.md`\n\treturn entries.some((entry) => entry.spec === spec) ? spec : undefined\n}\n\n/**\n * Computes the scoped project a guide module's declarations are emitted through.\n *\n * @param module - The workspace-relative module directory\n * @returns The workspace-relative `configs/<layer>/tsconfig.<env>.json` path for a module\n * `src/<env>` or `app/<env>`, or `undefined` for any other module\n *\n * @example\n * ```ts\n * computeGuideProject('src/core') // 'configs/src/tsconfig.core.json'\n * computeGuideProject('src/core/sources') // undefined\n * ```\n */\nexport function computeGuideProject(module: string): string | undefined {\n\tconst matched = /^(src|app)\\/([A-Za-z0-9_-]+)$/.exec(module)\n\tconst layer = matched?.[1]\n\tconst environment = matched?.[2]\n\tif (layer === undefined || environment === undefined) return undefined\n\treturn `configs/${layer}/tsconfig.${environment}.json`\n}\n\n/**\n * Computes the environment directory whose project compiles a guide source.\n *\n * @param source - The workspace-relative source directory\n * @returns The `src/<env>` or `app/<env>` directory that `source` equals or sits beneath, or\n * `undefined` for a source under neither\n *\n * @example\n * ```ts\n * computeGuideEnvironment('src/core/panels') // 'src/core'\n * computeGuideEnvironment('lib/core') // undefined\n * ```\n */\nexport function computeGuideEnvironment(source: string): string | undefined {\n\tif (!hasCanonicalSegments(source)) return undefined\n\treturn /^(?:src|app)\\/[A-Za-z0-9_-]+(?=\\/|$)/.exec(source)?.[0]\n}\n","import type { ParityDirection } from '@src/core'\nimport { isNonEmptyString, isRecord, parseEnum, parseJSONAs } from '@orkestrel/contract'\n\n/**\n * Maps the supported `--to guide` and `--to source` arguments to an explicit rewrite destination.\n *\n * @param args - The arguments after the native command entry\n * @returns The requested destination, or `undefined` when the shape is unsupported\n *\n * @example\n * ```ts\n * parseGuideDirection(['--to', 'guide'])\n * ```\n */\nexport function parseGuideDirection(args: readonly string[]): ParityDirection | undefined {\n\tif (args.length !== 2 || args[0] !== '--to') return undefined\n\treturn parseEnum(args[1], ['guide', 'source'])\n}\n\n/**\n * Reads the bare package name from package manifest JSON.\n *\n * @param manifest - The package manifest JSON text\n * @returns The name after its final scope separator, or `undefined` when no name is declared\n *\n * @example\n * ```ts\n * parsePackageName('{\"name\":\"@scope/widget\"}')\n * ```\n */\nexport function parsePackageName(manifest: string): string | undefined {\n\tconst parsed = parseJSONAs(manifest, isRecord)\n\tif (parsed === undefined) return undefined\n\tconst name = parsed.name\n\tif (!isNonEmptyString(name)) return undefined\n\treturn name.slice(name.lastIndexOf('/') + 1)\n}\n\n/**\n * Reads the `rootDir` a `tsc --showConfig` reading resolves.\n *\n * @param text - The compiler's `--showConfig` output\n * @returns The `rootDir` text, relative to the project file, or `undefined` when none is declared\n *\n * @example\n * ```ts\n * parseCompilerRoot('{\"compilerOptions\":{\"rootDir\":\"../../src/core\"}}') // '../../src/core'\n * ```\n */\nexport function parseCompilerRoot(text: string): string | undefined {\n\tconst parsed = parseJSONAs(text, isRecord)\n\tconst options = parsed?.compilerOptions\n\tif (!isRecord(options)) return undefined\n\tconst root = options.rootDir\n\treturn isNonEmptyString(root) ? root : undefined\n}\n","import type { GuideCompilerInterface, GuideCompilerOptions } from './types.js'\nimport { isNonEmptyString, isRecord, parseJSONAs } from '@orkestrel/contract'\nimport { spawnSync } from 'node:child_process'\nimport { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { dirname, join, relative, resolve, sep } from 'node:path'\nimport process from 'node:process'\nimport { GuideError } from '@src/core'\nimport {\n\tGUIDE_COMPILER_LIMIT,\n\tGUIDE_COMPILER_TIMEOUT,\n\tGUIDE_SCRATCH_PREFIX,\n\tGUIDE_SCRATCH_RETRIES,\n} from './constants.js'\nimport { computeGuideProject, resolveGuideRoot } from './helpers.js'\nimport { parseCompilerRoot } from './parsers.js'\n\n/**\n * Emits a guide module's declarations through the workspace's own TypeScript compiler, the\n * projection every computed `Signature` cell is read from.\n *\n * @remarks\n * The compiler is the `bin.tsc` entry the workspace root's `node_modules/typescript/package.json`\n * names, run by `process.execPath` with no shell, under a timeout and a per-stream output bound. A\n * module `src/<env>` or `app/<env>` emits through `configs/<layer>/tsconfig.<env>.json` into a fresh\n * scratch directory, with comments removed and LF line endings, and the scratch directory is\n * removed before the call returns or throws. Its path never enters the result, so two compiles of\n * one tree under one compiler return the same text. Every refusal is a `GuideError` whose\n * `context` names the module and project, except that a module outside `src/<env>` and\n * `app/<env>` names the module alone and a workspace with no compiler names its `root`.\n *\n * @param options - The workspace root, the run bounds, and the scratch parent directory\n *\n * @example\n * ```ts\n * import { GuideCompiler } from '@orkestrel/guide/server'\n *\n * const declarations = new GuideCompiler({ root: new URL('../', import.meta.url) }).compile('src/core')\n * declarations['src/core/helpers.d.ts'] // 'export declare function …'\n * ```\n */\nexport class GuideCompiler implements GuideCompilerInterface {\n\treadonly #root: string\n\treadonly #timeout: number\n\treadonly #limit: number\n\treadonly #temporary: string | undefined\n\n\tconstructor(options: GuideCompilerOptions) {\n\t\tthis.#root = resolveGuideRoot(options.root)\n\t\tthis.#timeout = options.timeout ?? GUIDE_COMPILER_TIMEOUT\n\t\tthis.#limit = options.limit ?? GUIDE_COMPILER_LIMIT\n\t\tthis.#temporary = options.temporary\n\t}\n\n\t/**\n\t * Emits the declarations of one `src/<env>` or `app/<env>` module through its scoped project.\n\t *\n\t * @param module - The workspace-relative module directory, `src/<env>` or `app/<env>`\n\t * @returns The emitted declaration text keyed by workspace-relative `.d.ts` path, sorted by key\n\t * @throws `GuideError` with code `compile` when the module is outside `src/<env>` and\n\t * `app/<env>`, the workspace installs no TypeScript compiler, the project declares no\n\t * `rootDir`, or the compiler exits non-zero; `empty` when the project emits no declaration under\n\t * the module; `timeout` when a run passes the timeout; and `overflow` when a run passes the output\n\t * bound\n\t *\n\t * @example\n\t * ```ts\n\t * compiler.compile('src/core')['src/core/types.d.ts'] // 'export type …'\n\t * ```\n\t */\n\tcompile(module: string): Readonly<Record<string, string>> {\n\t\tconst project = computeGuideProject(module)\n\t\tif (project === undefined) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module.slice(0, 200))} is outside src/<env> and app/<env>; a guide module compiles through configs/<layer>/tsconfig.<env>.json, such as configs/src/tsconfig.core.json for src/core.`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { module: module.slice(0, 200) } },\n\t\t\t)\n\t\t}\n\t\tconst compiler = this.#locate()\n\t\tconst path = resolve(this.#root, project)\n\t\tconst root = parseCompilerRoot(\n\t\t\tthis.#run(module, project, compiler, ['--showConfig', '-p', path]),\n\t\t)\n\t\tif (root === undefined) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} compiles through ${project}, which declares no rootDir.`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { module, project } },\n\t\t\t)\n\t\t}\n\t\tconst base = resolve(dirname(path), root)\n\t\tconst scratch = mkdtempSync(join(this.#temporary ?? tmpdir(), GUIDE_SCRATCH_PREFIX))\n\t\ttry {\n\t\t\tthis.#run(module, project, compiler, [\n\t\t\t\t'-p',\n\t\t\t\tpath,\n\t\t\t\t'--declaration',\n\t\t\t\t'--emitDeclarationOnly',\n\t\t\t\t'--noEmit',\n\t\t\t\t'false',\n\t\t\t\t'--declarationMap',\n\t\t\t\t'false',\n\t\t\t\t'--removeComments',\n\t\t\t\t'--newLine',\n\t\t\t\t'lf',\n\t\t\t\t'--outDir',\n\t\t\t\tscratch,\n\t\t\t])\n\t\t\tconst entries = readdirSync(scratch, { recursive: true, encoding: 'utf8' })\n\t\t\t\t.filter((file) => file.endsWith('.d.ts'))\n\t\t\t\t.map((file) => ({\n\t\t\t\t\tkey: relative(this.#root, resolve(base, file)).split(sep).join('/'),\n\t\t\t\t\tfile,\n\t\t\t\t}))\n\t\t\t\t.filter((entry) => entry.key.startsWith(`${module}/`))\n\t\t\t\t.sort((left, right) => (left.key === right.key ? 0 : left.key < right.key ? -1 : 1))\n\t\t\tif (entries.length === 0) {\n\t\t\t\tthrow new GuideError(\n\t\t\t\t\t`${JSON.stringify(module)} emitted no declaration under ${module} through ${project}; the project's include must cover ${module} and its declarations must emit into --outDir, with no declarationDir.`,\n\t\t\t\t\t'empty',\n\t\t\t\t\t{ context: { module, project } },\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst declarations = Object.freeze(\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tentries.map((entry) => [entry.key, readFileSync(join(scratch, entry.file), 'utf8')]),\n\t\t\t\t),\n\t\t\t)\n\t\t\trmSync(scratch, { recursive: true, force: true, maxRetries: GUIDE_SCRATCH_RETRIES })\n\t\t\treturn declarations\n\t\t} catch (error) {\n\t\t\ttry {\n\t\t\t\trmSync(scratch, { recursive: true, force: true, maxRetries: GUIDE_SCRATCH_RETRIES })\n\t\t\t} catch {\n\t\t\t\t// The compile error answers for this call; a removal failure must not replace it.\n\t\t\t}\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t// The workspace root's own compiler entry, named by its installed manifest's `bin.tsc`.\n\t#locate(): string {\n\t\tconst manifest = join(this.#root, 'node_modules', 'typescript', 'package.json')\n\t\tconst declared = existsSync(manifest)\n\t\t\t? parseJSONAs(readFileSync(manifest, 'utf8'), isRecord)\n\t\t\t: undefined\n\t\tconst bin = declared?.bin\n\t\tconst entry = isRecord(bin) ? bin.tsc : undefined\n\t\tif (!isNonEmptyString(entry)) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`The workspace at ${JSON.stringify(this.#root)} installs no TypeScript compiler; node_modules/typescript/package.json names no bin.tsc entry.`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { root: this.#root } },\n\t\t\t)\n\t\t}\n\t\treturn resolve(dirname(manifest), entry)\n\t}\n\n\t#run(module: string, project: string, compiler: string, args: readonly string[]): string {\n\t\tconst result = spawnSync(process.execPath, [compiler, ...args], {\n\t\t\tcwd: this.#root,\n\t\t\tencoding: 'utf8',\n\t\t\tmaxBuffer: this.#limit,\n\t\t\ttimeout: this.#timeout,\n\t\t\twindowsHide: true,\n\t\t})\n\t\tconst code: unknown = result.error === undefined ? undefined : Reflect.get(result.error, 'code')\n\t\tif (code === 'ETIMEDOUT') {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} did not compile through ${project} within ${this.#timeout} ms; the compiler was stopped at the timeout.`,\n\t\t\t\t'timeout',\n\t\t\t\t{ context: { module, project, timeout: this.#timeout } },\n\t\t\t)\n\t\t}\n\t\tif (code === 'ENOBUFS') {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} wrote more than ${this.#limit} bytes of compiler output to one stream through ${project}; the compiler was stopped at the output bound.`,\n\t\t\t\t'overflow',\n\t\t\t\t{ context: { module, project, limit: this.#limit } },\n\t\t\t)\n\t\t}\n\t\tif (result.error !== undefined || result.status !== 0) {\n\t\t\tconst output = `${result.stdout ?? ''}${result.stderr ?? ''}${result.error?.message ?? ''}`\n\t\t\tthrow new GuideError(\n\t\t\t\t`${JSON.stringify(module)} does not compile through ${project}:\\n${output}`,\n\t\t\t\t'compile',\n\t\t\t\t{ context: { module, project, output } },\n\t\t\t)\n\t\t}\n\t\treturn result.stdout\n\t}\n}\n","import type {\n\tGuideCommandContext,\n\tGuideCompilerInterface,\n\tGuideCommandHandler,\n\tGuideCommandInterface,\n\tGuideCommandOptions,\n\tGuideReadFunction,\n\tGuideRunnerFunction,\n} from './types.js'\nimport type { GuideModule, ParityFinding, ParityOptions } from '@src/core'\nimport { isError, isFiniteNumber, isFunction, isObject, isString } from '@orkestrel/contract'\nimport { globSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport process from 'node:process'\nimport { GuideError, normalizeDirectories, Parity, parseManifest } from '@src/core'\nimport { GUIDE_INDEX, GUIDE_MANIFEST, GUIDE_README, GUIDE_USAGE } from './constants.js'\nimport { GuideCompiler } from './GuideCompiler.js'\nimport {\n\tcomputeGuideEnvironment,\n\tcomputeGuideProject,\n\tformatGuideFinding,\n\tmatchesGuideResult,\n\tresolveGuideRoot,\n\tselectGuidePitch,\n} from './helpers.js'\nimport { parseGuideDirection, parsePackageName } from './parsers.js'\n\n/**\n * Drives native checking and explicit rewrites or registers package assertions in the guides\n * worker.\n *\n * @param options - The workspace policy and direct host ports\n *\n * @example\n * ```ts\n * import { GuideCommand } from '@orkestrel/guide/server'\n * import { readInventory } from '@orkestrel/test/server'\n * import { createVitest } from 'vitest/node'\n *\n * await new GuideCommand({\n * \troot: new URL('../', import.meta.url),\n * \tpatterns: ['src/**\\/*.ts', 'tests/**\\/*.ts', 'guides/*.md', '*.md'],\n * \tmodules: { '@scope/widget': 'src/core' },\n * \tlanguages: ['ts'],\n * \tlanguage: 'ts',\n * \treader: readInventory,\n * \trunner: createVitest,\n * }).execute(async ({ files, report, root, rows }) => {\n * \tconst { expect, it } = await import('vitest')\n * \tit('checks the documented inventory', () => {\n * \t\texpect(root.length).toBeGreaterThan(0)\n * \t\texpect(Object.keys(files).length).toBeGreaterThan(0)\n * \t\texpect(rows.length).toBeGreaterThan(0)\n * \t\texpect(report.input).toEqual([])\n * \t})\n * })\n * ```\n */\nexport class GuideCommand implements GuideCommandInterface {\n\treadonly #root: string\n\treadonly #patterns: readonly string[]\n\treadonly #modules: Readonly<Record<string, GuideModule>>\n\treadonly #languages: readonly string[]\n\treadonly #language: string\n\treadonly #reader: GuideReadFunction\n\treadonly #runner: GuideRunnerFunction\n\treadonly #compiler: GuideCompilerInterface\n\n\tconstructor(options: GuideCommandOptions) {\n\t\tthis.#root = resolveGuideRoot(options.root)\n\t\tthis.#patterns = Object.freeze([...options.patterns])\n\t\tthis.#modules = Object.freeze({ ...options.modules })\n\t\tthis.#languages = Object.freeze([...options.languages])\n\t\tthis.#language = options.language\n\t\tthis.#reader = options.reader\n\t\tthis.#runner = options.runner\n\t\tthis.#compiler = new GuideCompiler({ root: this.#root })\n\t}\n\n\t/**\n\t * Runs the native command or registers package assertions with fresh worker inventory and parity.\n\t *\n\t * @param register - The package-owned assertion registration callback\n\t * @returns A promise that resolves after the selected command path finishes\n\t * @throws When worker inventory reading or package assertion registration fails. Native failures\n\t * are reported through stderr and process exit status before this promise resolves.\n\t */\n\tasync execute(register: GuideCommandHandler): Promise<void> {\n\t\tif (process.env.VITEST === 'true') {\n\t\t\tawait this.#register(register)\n\t\t\treturn\n\t\t}\n\t\ttry {\n\t\t\tawait this.#executeNative()\n\t\t} catch (error) {\n\t\t\tprocess.stderr.write(`${isError(error) ? error.message : String(error)}\\n`)\n\t\t\tthis.#raise(1)\n\t\t}\n\t}\n\n\t// `compiled` holds each environment's emit across one command run's inventory reads.\n\t#createOptions(\n\t\tcompiled: Map<string, Readonly<Record<string, string>>>,\n\t): ParityOptions | undefined {\n\t\tconst files = this.#readInventory()\n\t\tconst manifest = files[GUIDE_INDEX]\n\t\tif (manifest === undefined) return undefined\n\t\tconst entries = Object.freeze([...parseManifest(manifest, 'guides')])\n\t\tconst packageFiles = Object.freeze({ ...this.#reader(this.#root, [GUIDE_MANIFEST]) })\n\t\tconst packageManifest = packageFiles[GUIDE_MANIFEST]\n\t\tconst pitch = selectGuidePitch(\n\t\t\tentries,\n\t\t\tpackageManifest === undefined ? undefined : parsePackageName(packageManifest),\n\t\t)\n\t\tconst options: ParityOptions = {\n\t\t\tfiles,\n\t\t\tentries,\n\t\t\tmodules: this.#modules,\n\t\t\tlanguages: this.#languages,\n\t\t\tlanguage: this.#language,\n\t\t\t...(pitch === undefined\n\t\t\t\t? {}\n\t\t\t\t: { pitch: Object.freeze({ readme: GUIDE_README, spec: pitch }) }),\n\t\t}\n\t\t// Parity parses every manifest guide at construction, so a malformed guide refuses first.\n\t\tconst sources = new Set(\n\t\t\tnew Parity(options).rows().flatMap((row) => normalizeDirectories(row.entry.source)),\n\t\t)\n\t\tconst environments = new Set(\n\t\t\tArray.from(sources).map((source) => computeGuideEnvironment(source) ?? source),\n\t\t)\n\t\tfor (const environment of environments) {\n\t\t\tif (!compiled.has(environment)) compiled.set(environment, this.#compiler.compile(environment))\n\t\t}\n\t\tconst declarations = Object.freeze(\n\t\t\tObject.fromEntries(\n\t\t\t\tArray.from(compiled)\n\t\t\t\t\t.filter(([environment]) => environments.has(environment))\n\t\t\t\t\t.flatMap(([, emitted]) => Object.entries(emitted)),\n\t\t\t),\n\t\t)\n\t\tconst missing = Array.from(sources).flatMap((module) => {\n\t\t\tconst project = computeGuideProject(computeGuideEnvironment(module) ?? module)\n\t\t\treturn project === undefined ||\n\t\t\t\tObject.keys(declarations).some((key) => key.startsWith(`${module}/`))\n\t\t\t\t? []\n\t\t\t\t: [{ module, project }]\n\t\t})\n\t\tif (missing.length > 0) {\n\t\t\tthrow new GuideError(\n\t\t\t\t`${missing.map(({ module, project }) => `${JSON.stringify(module)} emitted no declaration under ${module} through ${project}`).join('; ')}; each project's include must cover its module and its declarations must emit into --outDir, with no declarationDir.`,\n\t\t\t\t'empty',\n\t\t\t\t{ context: { missing } },\n\t\t\t)\n\t\t}\n\t\treturn { ...options, declarations }\n\t}\n\n\tasync #executeNative(): Promise<void> {\n\t\tconst args = process.argv.slice(2)\n\t\tconst direction = parseGuideDirection(args)\n\t\tif (direction === undefined && args.length > 0) {\n\t\t\tprocess.stdout.write(`${GUIDE_USAGE}\\n`)\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tif (direction === undefined) {\n\t\t\tif (!(await this.#executeRunner())) this.#raise(1)\n\t\t\treturn\n\t\t}\n\n\t\tconst compiled = new Map<string, Readonly<Record<string, string>>>()\n\t\tconst options = this.#createOptions(compiled)\n\t\tif (options === undefined) {\n\t\t\tthis.#reportMissing()\n\t\t\treturn\n\t\t}\n\t\tconst parity = new Parity(options)\n\t\tif (this.#report(parity.inspect().input)) {\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tconst rewritten = direction === 'guide' ? parity.document() : parity.annotate()\n\t\tfor (const change of rewritten.changes) {\n\t\t\twriteFileSync(resolve(this.#root, change.path), change.content)\n\t\t\tprocess.stdout.write(`wrote ${change.path}\\n`)\n\t\t}\n\n\t\tconst freshOptions = this.#createOptions(compiled)\n\t\tif (freshOptions === undefined) {\n\t\t\tthis.#reportMissing()\n\t\t\treturn\n\t\t}\n\t\tconst freshParity = new Parity(freshOptions)\n\t\tconst freshReport = freshParity.inspect()\n\t\tif (this.#report(freshReport.input)) {\n\t\t\tthis.#raise(2)\n\t\t\treturn\n\t\t}\n\t\tconst remaining =\n\t\t\tdirection === 'guide' ? freshParity.document().findings : freshParity.annotate().findings\n\t\tif (this.#report(remaining)) this.#raise(1)\n\t\tif (this.#report(freshReport.pitch)) this.#raise(1)\n\t\tif (rewritten.changes.length > 0) process.stdout.write('next: npm run format\\n')\n\t\tif (!(await this.#executeRunner())) this.#raise(1)\n\t}\n\n\t#readInventory(): Readonly<Record<string, string>> {\n\t\tconst targets = globSync([...this.#patterns], { cwd: this.#root }).map((path) =>\n\t\t\tpath.replaceAll('\\\\', '/'),\n\t\t)\n\t\treturn Object.freeze({ ...this.#reader(this.#root, targets) })\n\t}\n\n\tasync #register(register: GuideCommandHandler): Promise<void> {\n\t\tconst options = this.#createOptions(new Map())\n\t\tif (options === undefined) {\n\t\t\tthrow new Error('The inventory carries no guides/README.md to index from')\n\t\t}\n\t\tconst parity = new Parity(options)\n\t\tconst context: GuideCommandContext = Object.freeze({\n\t\t\troot: this.#root,\n\t\t\tfiles: options.files,\n\t\t\trows: parity.rows(),\n\t\t\treport: parity.inspect(),\n\t\t})\n\t\tawait register(context)\n\t}\n\n\t#report(findings: readonly ParityFinding[]): boolean {\n\t\tfor (const finding of findings) {\n\t\t\tprocess.stdout.write(`${formatGuideFinding(finding)}\\n`)\n\t\t}\n\t\treturn findings.length > 0\n\t}\n\n\t#reportMissing(): void {\n\t\tprocess.stdout.write(`${GUIDE_INDEX}: the workspace carries no concept index to read\\n`)\n\t\tthis.#raise(2)\n\t}\n\n\tasync #executeRunner(): Promise<boolean> {\n\t\tconst runner = await this.#runner('test', {\n\t\t\troot: this.#root,\n\t\t\tconfig: resolve(this.#root, 'vite.config.ts'),\n\t\t\tproject: 'guides',\n\t\t\treporters: 'dot',\n\t\t\tcache: false,\n\t\t\twatch: false,\n\t\t})\n\t\tif (!isObject(runner)) throw new Error('The guides runner is not an object')\n\t\tconst close = Reflect.get(runner, 'close')\n\t\tif (!isFunction(close)) throw new Error('The guides runner has no callable close member')\n\t\ttry {\n\t\t\tconst start = Reflect.get(runner, 'start')\n\t\t\tif (!isFunction(start)) throw new Error('The guides runner has no callable start member')\n\t\t\treturn matchesGuideResult(await Reflect.apply(start, runner, []))\n\t\t} finally {\n\t\t\tawait Reflect.apply(close, runner, [])\n\t\t}\n\t}\n\n\t#raise(code: number): void {\n\t\tconst current = process.exitCode\n\t\tconst numeric = isString(current) ? Number.parseInt(current, 10) : current\n\t\tif (!isFiniteNumber(numeric) || numeric < code) {\n\t\t\tprocess.exitCode = code\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;AACA,IAAa,cAAc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1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orkestrel/guide",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"description": "Guides-parity test helpers — prove a package's guides are in bijection with the code they document: surface and methods bijection, link integrity, and non-vacuous extraction, built on @orkestrel/markdown. Part of the @orkestrel line.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bijection",
|
|
@@ -85,14 +85,14 @@
|
|
|
85
85
|
"test:setup": "vitest run --config vite.config.ts --no-cache --reporter=dot --project setup"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@orkestrel/contract": "^0.0.
|
|
89
|
-
"@orkestrel/markdown": "^0.0.
|
|
88
|
+
"@orkestrel/contract": "^0.0.21",
|
|
89
|
+
"@orkestrel/markdown": "^0.0.19"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@microsoft/api-extractor": "^7.60.
|
|
92
|
+
"@microsoft/api-extractor": "^7.60.1",
|
|
93
93
|
"@orkestrel/probe": "^0.0.26",
|
|
94
|
-
"@orkestrel/scaffold": "^0.0.
|
|
95
|
-
"@orkestrel/test": "^0.0.
|
|
94
|
+
"@orkestrel/scaffold": "^0.0.119",
|
|
95
|
+
"@orkestrel/test": "^0.0.32",
|
|
96
96
|
"@types/node": "^26.6.6",
|
|
97
97
|
"oxfmt": "^0.75.0",
|
|
98
98
|
"oxlint": "^1.90.0",
|