@kernlang/cli 3.3.9 → 3.4.1
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/commands/compile.js +30 -16
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/import.js +196 -44
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/migrate-class-body.d.ts +1 -1
- package/dist/commands/migrate-class-body.js +155 -8
- package/dist/commands/migrate-class-body.js.map +1 -1
- package/dist/commands/review.js +150 -10
- package/dist/commands/review.js.map +1 -1
- package/dist/commands/test.d.ts +1 -0
- package/dist/commands/test.js +263 -5
- package/dist/commands/test.js.map +1 -1
- package/dist/git-env.d.ts +1 -0
- package/dist/git-env.js +25 -0
- package/dist/git-env.js.map +1 -0
- package/dist/lib/cross-module-registry.d.ts +21 -0
- package/dist/lib/cross-module-registry.js +95 -0
- package/dist/lib/cross-module-registry.js.map +1 -0
- package/dist/remote-repo.js +2 -0
- package/dist/remote-repo.js.map +1 -1
- package/dist/shared.d.ts +4 -4
- package/dist/shared.js +207 -19
- package/dist/shared.js.map +1 -1
- package/package.json +15 -14
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Slice 7 v2 — project-wide registry of exported Result/Option-returning
|
|
2
|
+
* fns. Built once before the compile loop; consulted per-file via a
|
|
3
|
+
* caller-specific `ImportResolver` that resolves `use path="…"` strings
|
|
4
|
+
* against the current module's directory.
|
|
5
|
+
*
|
|
6
|
+
* Scope: the registry only indexes fns whose `returns` is exactly
|
|
7
|
+
* `Result<…>` or `Option<…>` (the same shape `parser-validate-propagation`
|
|
8
|
+
* classifies as `result`/`option`). Imports of any other return shape
|
|
9
|
+
* contribute nothing — the propagation pass leaves those calls alone. */
|
|
10
|
+
import { type ImportResolver, type ModuleExports } from '@kernlang/core';
|
|
11
|
+
/** Walk every `.kern` file in the project once and produce a
|
|
12
|
+
* `Map<absoluteFilePath, ModuleExports>`. Files that fail to parse are
|
|
13
|
+
* skipped silently — their per-file compile will surface its own errors. */
|
|
14
|
+
export declare function buildCrossModuleRegistry(kernFiles: readonly string[]): Map<string, ModuleExports>;
|
|
15
|
+
/** Build a per-file `ImportResolver` that maps `use path="…"` strings to
|
|
16
|
+
* the corresponding `ModuleExports`. Resolves relative paths against the
|
|
17
|
+
* current file's directory and accepts both `./helper` and `./helper.kern`
|
|
18
|
+
* forms (preserving parity with KERN's import syntax). Bare imports
|
|
19
|
+
* (`zod`, `react`, …) and unresolvable paths return `null`, leaving the
|
|
20
|
+
* call to pass through propagation unchanged. */
|
|
21
|
+
export declare function makeImportResolverForFile(currentFileAbs: string, registry: Map<string, ModuleExports>): ImportResolver;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/** Slice 7 v2 — project-wide registry of exported Result/Option-returning
|
|
2
|
+
* fns. Built once before the compile loop; consulted per-file via a
|
|
3
|
+
* caller-specific `ImportResolver` that resolves `use path="…"` strings
|
|
4
|
+
* against the current module's directory.
|
|
5
|
+
*
|
|
6
|
+
* Scope: the registry only indexes fns whose `returns` is exactly
|
|
7
|
+
* `Result<…>` or `Option<…>` (the same shape `parser-validate-propagation`
|
|
8
|
+
* classifies as `result`/`option`). Imports of any other return shape
|
|
9
|
+
* contribute nothing — the propagation pass leaves those calls alone. */
|
|
10
|
+
import { parseDocument } from '@kernlang/core';
|
|
11
|
+
import { existsSync, readFileSync } from 'fs';
|
|
12
|
+
import { dirname, resolve } from 'path';
|
|
13
|
+
const RESULT_RETURN_RE = /^Result<[\s\S]*>$/;
|
|
14
|
+
const OPTION_RETURN_RE = /^Option<[\s\S]*>$/;
|
|
15
|
+
/** Strip an outer `Promise<…>` wrapper if present. Mirrors the helper in
|
|
16
|
+
* `parser-validate-propagation.ts` so the registry classifies async
|
|
17
|
+
* exports the same way the propagation pass does. */
|
|
18
|
+
function unwrapPromise(s) {
|
|
19
|
+
const t = s.trim();
|
|
20
|
+
if (t.startsWith('Promise<') && t.endsWith('>')) {
|
|
21
|
+
return { inner: t.slice('Promise<'.length, -1).trim(), wasPromise: true };
|
|
22
|
+
}
|
|
23
|
+
return { inner: t, wasPromise: false };
|
|
24
|
+
}
|
|
25
|
+
function classifyExports(root) {
|
|
26
|
+
const resultFns = new Set();
|
|
27
|
+
const optionFns = new Set();
|
|
28
|
+
const asyncResultFns = new Set();
|
|
29
|
+
const asyncOptionFns = new Set();
|
|
30
|
+
function walk(node) {
|
|
31
|
+
if (node.type === 'fn' || node.type === 'method') {
|
|
32
|
+
const props = node.props || {};
|
|
33
|
+
const name = typeof props.name === 'string' ? props.name : null;
|
|
34
|
+
const returns = props.returns;
|
|
35
|
+
// KERN fns are exported by default; `export=false` opts out. Only
|
|
36
|
+
// exported names contribute to cross-module recognition.
|
|
37
|
+
const exportProp = props.export;
|
|
38
|
+
const isExported = !(exportProp === 'false' || exportProp === false);
|
|
39
|
+
const isAsync = props.async === true || props.async === 'true';
|
|
40
|
+
if (name && isExported && typeof returns === 'string') {
|
|
41
|
+
const { inner, wasPromise } = unwrapPromise(returns);
|
|
42
|
+
const effectivelyAsync = wasPromise || isAsync;
|
|
43
|
+
if (RESULT_RETURN_RE.test(inner)) {
|
|
44
|
+
(effectivelyAsync ? asyncResultFns : resultFns).add(name);
|
|
45
|
+
}
|
|
46
|
+
else if (OPTION_RETURN_RE.test(inner)) {
|
|
47
|
+
(effectivelyAsync ? asyncOptionFns : optionFns).add(name);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (node.children)
|
|
52
|
+
for (const c of node.children)
|
|
53
|
+
walk(c);
|
|
54
|
+
}
|
|
55
|
+
walk(root);
|
|
56
|
+
return { resultFns, optionFns, asyncResultFns, asyncOptionFns };
|
|
57
|
+
}
|
|
58
|
+
/** Walk every `.kern` file in the project once and produce a
|
|
59
|
+
* `Map<absoluteFilePath, ModuleExports>`. Files that fail to parse are
|
|
60
|
+
* skipped silently — their per-file compile will surface its own errors. */
|
|
61
|
+
export function buildCrossModuleRegistry(kernFiles) {
|
|
62
|
+
const registry = new Map();
|
|
63
|
+
for (const file of kernFiles) {
|
|
64
|
+
try {
|
|
65
|
+
const abs = resolve(file);
|
|
66
|
+
const source = readFileSync(abs, 'utf-8');
|
|
67
|
+
const root = parseDocument(source);
|
|
68
|
+
registry.set(abs, classifyExports(root));
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Parse failures aren't a registry concern — skip and let the
|
|
72
|
+
// per-file compile surface its diagnostics.
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return registry;
|
|
76
|
+
}
|
|
77
|
+
/** Build a per-file `ImportResolver` that maps `use path="…"` strings to
|
|
78
|
+
* the corresponding `ModuleExports`. Resolves relative paths against the
|
|
79
|
+
* current file's directory and accepts both `./helper` and `./helper.kern`
|
|
80
|
+
* forms (preserving parity with KERN's import syntax). Bare imports
|
|
81
|
+
* (`zod`, `react`, …) and unresolvable paths return `null`, leaving the
|
|
82
|
+
* call to pass through propagation unchanged. */
|
|
83
|
+
export function makeImportResolverForFile(currentFileAbs, registry) {
|
|
84
|
+
const dir = dirname(currentFileAbs);
|
|
85
|
+
return (path) => {
|
|
86
|
+
if (!path.startsWith('./') && !path.startsWith('../'))
|
|
87
|
+
return null;
|
|
88
|
+
const withExt = path.endsWith('.kern') ? path : `${path}.kern`;
|
|
89
|
+
const abs = resolve(dir, withExt);
|
|
90
|
+
if (!existsSync(abs))
|
|
91
|
+
return null;
|
|
92
|
+
return registry.get(abs) ?? null;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=cross-module-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cross-module-registry.js","sourceRoot":"","sources":["../../src/lib/cross-module-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;0EAQ0E;AAE1E,OAAO,EAAwD,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAA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H,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;YAC1B,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAC1C,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;YACnC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3C,CAAC;QAAC,MAAM,CAAC;YACP,8DAA8D;YAC9D,4CAA4C;QAC9C,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;kDAKkD;AAClD,MAAM,UAAU,yBAAyB,CACvC,cAAsB,EACtB,QAAoC;IAEpC,MAAM,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACpC,OAAO,CAAC,IAAY,EAAwB,EAAE;QAC5C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACnE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC;QAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAClC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAClC,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;IACnC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/remote-repo.js
CHANGED
|
@@ -2,6 +2,7 @@ import { execFileSync } from 'child_process';
|
|
|
2
2
|
import { existsSync, mkdtempSync, rmSync } from 'fs';
|
|
3
3
|
import { tmpdir } from 'os';
|
|
4
4
|
import { join, resolve } from 'path';
|
|
5
|
+
import { withoutLocalGitEnv } from './git-env.js';
|
|
5
6
|
import { hasFlag, parseFlagOrNext } from './shared.js';
|
|
6
7
|
function formatGitError(err) {
|
|
7
8
|
if (!(err instanceof Error))
|
|
@@ -22,6 +23,7 @@ function formatGitError(err) {
|
|
|
22
23
|
function runGit(args, cwd) {
|
|
23
24
|
execFileSync('git', args, {
|
|
24
25
|
cwd,
|
|
26
|
+
env: withoutLocalGitEnv(),
|
|
25
27
|
encoding: 'utf-8',
|
|
26
28
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
27
29
|
});
|
package/dist/remote-repo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-repo.js","sourceRoot":"","sources":["../src/remote-repo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAuBvD,SAAS,cAAc,CAAC,GAAY;IAClC,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,GAAqE,CAAC;IACzF,MAAM,MAAM,GACV,OAAO,UAAU,CAAC,MAAM,KAAK,QAAQ;QACnC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE;QAC1B,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC;YAClC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE;YAC5C,CAAC,CAAC,EAAE,CAAC;IACX,MAAM,MAAM,GACV,OAAO,UAA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AAY,CAAC,WAAW,EAAE,CAAC,CAAC;IACxF,CAAC;IAED,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,MAAM,OAAO,GAAG,GAAS,EAAE;QACzB,IAAI,OAAO,IAAI,QAAQ;YAAE,OAAO;QAChC,OAAO,GAAG,IAAI,CAAC;QACf,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,CAAC,CAAC;IACF,MAAM,WAAW,GAAG,GAAS,EAAE,CAAC,OAAO,EAAE,CAAC;IAE1C,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEvB,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,MAAM,OAAO,CAAC,WAAW,2BAA2B,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,GAAG,CAAC;YACf,SAAS;YACT,GAAG,EAAE,YAAY,CAAC,GAAG;YACrB,OAAO,EAAE,OAAO;YAChB,OAAO;YACP,YAAY,EAAE,YAAY,CAAC,YAAY;YACvC,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACjC,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IRNode, KernTarget, ParseDiagnostic, ResolvedKernConfig, SchemaViolation, ShadowDiagnostic } from '@kernlang/core';
|
|
2
|
-
export declare const GENERATED_HEADER = "// @generated by kern v3.
|
|
2
|
+
export declare const GENERATED_HEADER = "// @generated by kern v3.4.1 \u2014 DO NOT EDIT. Source: ";
|
|
3
3
|
/**
|
|
4
4
|
* Check the existing output file's @generated stamp against the current compiler version.
|
|
5
5
|
* Emits a warning when the stamp is newer (downgrade) or older by a minor/major (drift).
|
|
@@ -16,7 +16,7 @@ export declare function surfaceParseDiagnostics(diagnostics: ParseDiagnostic[],
|
|
|
16
16
|
errors: number;
|
|
17
17
|
warnings: number;
|
|
18
18
|
};
|
|
19
|
-
export declare function parseAndSurface(source: string, file?: string): IRNode;
|
|
19
|
+
export declare function parseAndSurface(source: string, file?: string, options?: import('@kernlang/core').ParseOptions): IRNode;
|
|
20
20
|
export interface FileDiagnosticsJSON {
|
|
21
21
|
file: string;
|
|
22
22
|
success: boolean;
|
|
@@ -25,7 +25,7 @@ export interface FileDiagnosticsJSON {
|
|
|
25
25
|
shadowDiagnostics?: ShadowDiagnostic[];
|
|
26
26
|
}
|
|
27
27
|
/** Parse a .kern file and return structured diagnostics as JSON-serializable object. */
|
|
28
|
-
export declare function parseWithJSONDiagnostics(source: string, file: string): {
|
|
28
|
+
export declare function parseWithJSONDiagnostics(source: string, file: string, options?: import('@kernlang/core').ParseOptions): {
|
|
29
29
|
root: IRNode;
|
|
30
30
|
json: FileDiagnosticsJSON;
|
|
31
31
|
};
|
|
@@ -53,7 +53,7 @@ export declare function findNearestPackageJson(startDir: string): string | null;
|
|
|
53
53
|
export declare function findKernFiles(dir: string, singleFile?: string): string[];
|
|
54
54
|
export declare function collectTsFilesFlat(dirPath: string, recursive: boolean): string[];
|
|
55
55
|
export declare function transpileForTarget(ast: IRNode, cfg: ResolvedKernConfig): import("@kernlang/core").TranspileResult;
|
|
56
|
-
export declare function transpileAndWrite(file: string, cfg: ResolvedKernConfig, args: string[], outDirOverride?: string, inputBase?: string): void;
|
|
56
|
+
export declare function transpileAndWrite(file: string, cfg: ResolvedKernConfig, args: string[], outDirOverride?: string, inputBase?: string, options?: import('@kernlang/core').ParseOptions): void;
|
|
57
57
|
export declare function loadConfig(): ResolvedKernConfig;
|
|
58
58
|
export declare function loadTemplates(cfg: ResolvedKernConfig): void;
|
|
59
59
|
/**
|
package/dist/shared.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { analyzeShadow, COMMON_TEMPLATES, clearTemplates, collectCoverageGaps, detectTarget, expandTemplateNode, generateCoreNode, isCoreNode, isTemplateNode, KERN_VERSION, parseWithDiagnostics, registerTemplate, resolveConfig, validateSchema, validateSemantics, writeCoverageGaps, } from '@kernlang/core';
|
|
1
|
+
import { analyzeShadow, COMMON_TEMPLATES, clearTemplates, collectCoverageGaps, detectKernStdlibUsage, detectTarget, expandTemplateNode, generateCoreNode, injectKernStdlibPreamble, injectKernStdlibPreambleIntoSFC, isCoreNode, isTemplateNode, KERN_VERSION, kernStdlibPreamble, parseWithDiagnostics, registerTemplate, resolveConfig, sourceComment, validateSchema, validateSemantics, writeCoverageGaps, } from '@kernlang/core';
|
|
2
2
|
import { transpileExpress } from '@kernlang/express';
|
|
3
3
|
import { transpileFastAPI } from '@kernlang/fastapi';
|
|
4
4
|
import { transpileMCP } from '@kernlang/mcp';
|
|
@@ -13,6 +13,29 @@ import { transpileCliApp } from './transpiler-cli.js';
|
|
|
13
13
|
// ── Constants ────────────────────────────────────────────────────────────
|
|
14
14
|
export const GENERATED_HEADER = `// @generated by kern v${KERN_VERSION} — DO NOT EDIT. Source: `;
|
|
15
15
|
const STAMP_PATTERN = /^\/\/\s*@generated by kern v(\d+)\.(\d+)\.(\d+)/;
|
|
16
|
+
const SOURCE_TRACE_PATTERN = /^\s*\/\/ @kern-source: /m;
|
|
17
|
+
const TRACEABLE_NODE_TYPES = new Set([
|
|
18
|
+
'action',
|
|
19
|
+
'class',
|
|
20
|
+
'config',
|
|
21
|
+
'const',
|
|
22
|
+
'enum',
|
|
23
|
+
'error',
|
|
24
|
+
'event',
|
|
25
|
+
'fn',
|
|
26
|
+
'hook',
|
|
27
|
+
'interface',
|
|
28
|
+
'machine',
|
|
29
|
+
'mcp',
|
|
30
|
+
'model',
|
|
31
|
+
'repository',
|
|
32
|
+
'screen',
|
|
33
|
+
'service',
|
|
34
|
+
'store',
|
|
35
|
+
'tool',
|
|
36
|
+
'type',
|
|
37
|
+
'union',
|
|
38
|
+
]);
|
|
16
39
|
function withGeneratedHeader(content, header) {
|
|
17
40
|
if (content.startsWith('#!')) {
|
|
18
41
|
const newline = content.indexOf('\n');
|
|
@@ -22,6 +45,79 @@ function withGeneratedHeader(content, header) {
|
|
|
22
45
|
}
|
|
23
46
|
return `${header}${content}`;
|
|
24
47
|
}
|
|
48
|
+
function escapeRegex(value) {
|
|
49
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
50
|
+
}
|
|
51
|
+
function collectSourceTracePoints(ast, sourceName) {
|
|
52
|
+
const nodes = [ast, ...(ast.children || [])];
|
|
53
|
+
return nodes
|
|
54
|
+
.filter((node) => node.loc && TRACEABLE_NODE_TYPES.has(node.type) && typeof node.props?.name === 'string')
|
|
55
|
+
.map((node) => ({
|
|
56
|
+
comment: sourceComment(node, sourceName),
|
|
57
|
+
name: node.props.name,
|
|
58
|
+
nodeType: node.type,
|
|
59
|
+
}))
|
|
60
|
+
.filter((point) => point.comment.length > 0);
|
|
61
|
+
}
|
|
62
|
+
function declarationPatterns(point) {
|
|
63
|
+
const name = escapeRegex(point.name);
|
|
64
|
+
return [
|
|
65
|
+
new RegExp(`^(\\s*)(?:export\\s+)?(?:default\\s+)?(?:async\\s+)?function\\s+${name}\\b`),
|
|
66
|
+
new RegExp(`^(\\s*)(?:export\\s+)?(?:default\\s+)?class\\s+${name}\\b`),
|
|
67
|
+
new RegExp(`^(\\s*)(?:export\\s+)?const\\s+${name}\\b`),
|
|
68
|
+
new RegExp(`^(\\s*)(?:export\\s+)?let\\s+${name}\\b`),
|
|
69
|
+
new RegExp(`^(\\s*)(?:export\\s+)?interface\\s+${name}\\b`),
|
|
70
|
+
new RegExp(`^(\\s*)(?:export\\s+)?type\\s+${name}\\b`),
|
|
71
|
+
new RegExp(`^(\\s*)(?:export\\s+)?enum\\s+${name}\\b`),
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
function sourceTraceInsertIndex(lines) {
|
|
75
|
+
let index = 0;
|
|
76
|
+
if (lines[index]?.startsWith('#!'))
|
|
77
|
+
index += 1;
|
|
78
|
+
if (/^\/\/ @generated by kern\b/.test(lines[index] ?? '')) {
|
|
79
|
+
index += 1;
|
|
80
|
+
if (lines[index] === '')
|
|
81
|
+
index += 1;
|
|
82
|
+
}
|
|
83
|
+
return index;
|
|
84
|
+
}
|
|
85
|
+
function entryTracePoints(points) {
|
|
86
|
+
for (let index = points.length - 1; index >= 0; index -= 1) {
|
|
87
|
+
if (points[index].nodeType === 'screen')
|
|
88
|
+
return [points[index]];
|
|
89
|
+
}
|
|
90
|
+
return points.length > 0 ? [points[0]] : [];
|
|
91
|
+
}
|
|
92
|
+
function withSourceTraceComments(content, ast, sourceName, options = {}) {
|
|
93
|
+
if (content.trim().length === 0)
|
|
94
|
+
return content;
|
|
95
|
+
if (SOURCE_TRACE_PATTERN.test(content))
|
|
96
|
+
return content;
|
|
97
|
+
const collectedPoints = collectSourceTracePoints(ast, sourceName);
|
|
98
|
+
const points = options.entry ? entryTracePoints(collectedPoints) : collectedPoints;
|
|
99
|
+
if (points.length === 0)
|
|
100
|
+
return content;
|
|
101
|
+
const lines = content.split('\n');
|
|
102
|
+
const unmatched = [];
|
|
103
|
+
for (const point of points) {
|
|
104
|
+
let inserted = false;
|
|
105
|
+
const patterns = declarationPatterns(point);
|
|
106
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
107
|
+
if (!patterns.some((pattern) => pattern.test(lines[index])))
|
|
108
|
+
continue;
|
|
109
|
+
lines.splice(index, 0, point.comment);
|
|
110
|
+
inserted = true;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
if (!inserted)
|
|
114
|
+
unmatched.push(point.comment);
|
|
115
|
+
}
|
|
116
|
+
if (unmatched.length > 0) {
|
|
117
|
+
lines.splice(sourceTraceInsertIndex(lines), 0, ...unmatched, '');
|
|
118
|
+
}
|
|
119
|
+
return lines.join('\n');
|
|
120
|
+
}
|
|
25
121
|
/** Parse a [major, minor, patch] tuple from a generated-header line, or null if absent. */
|
|
26
122
|
function parseStampedVersion(file) {
|
|
27
123
|
let candidateLines;
|
|
@@ -106,14 +202,14 @@ export function surfaceParseDiagnostics(diagnostics, file) {
|
|
|
106
202
|
}
|
|
107
203
|
return { errors, warnings };
|
|
108
204
|
}
|
|
109
|
-
export function parseAndSurface(source, file) {
|
|
110
|
-
const result = parseWithDiagnostics(source);
|
|
205
|
+
export function parseAndSurface(source, file, options) {
|
|
206
|
+
const result = parseWithDiagnostics(source, undefined, options);
|
|
111
207
|
surfaceParseDiagnostics(result.diagnostics, file);
|
|
112
208
|
return result.root;
|
|
113
209
|
}
|
|
114
210
|
/** Parse a .kern file and return structured diagnostics as JSON-serializable object. */
|
|
115
|
-
export function parseWithJSONDiagnostics(source, file) {
|
|
116
|
-
const result = parseWithDiagnostics(source);
|
|
211
|
+
export function parseWithJSONDiagnostics(source, file, options) {
|
|
212
|
+
const result = parseWithDiagnostics(source, undefined, options);
|
|
117
213
|
const schemaViolations = [
|
|
118
214
|
...validateSchema(result.root),
|
|
119
215
|
...validateSemantics(result.root).map((sv) => ({
|
|
@@ -157,17 +253,35 @@ export function getOutputExtension(target) {
|
|
|
157
253
|
/** Extract exported symbol names from generated TypeScript lines, distinguishing type-only exports. */
|
|
158
254
|
export function extractExportsFromLines(lines) {
|
|
159
255
|
const exports = [];
|
|
160
|
-
const
|
|
256
|
+
// `const\s+enum` must come BEFORE the bare `const` branch — otherwise the regex
|
|
257
|
+
// matches `export const` and captures `enum` as the identifier instead of `Flag`
|
|
258
|
+
// for `export const enum Flag { ... }` (slice 2b regression caught by Codex).
|
|
259
|
+
const re = /^export\s+(?:async\s+)?(?:function\*?|class|const\s+enum|const|enum|abstract\s+class)\s+(\w+)/;
|
|
161
260
|
const typeRe = /^export\s+(?:interface|type)\s+(\w+)/;
|
|
261
|
+
// Slice 2e — function overloads + impl share the same `export function name`
|
|
262
|
+
// prefix; without dedup the barrel emits `export { add, add, add }` (TS error).
|
|
263
|
+
// Dedupe by (name, typeOnly) — TS allows a value and a type with the same
|
|
264
|
+
// name (namespace merging) but not two values.
|
|
265
|
+
const seen = new Set();
|
|
266
|
+
const key = (name, typeOnly) => `${typeOnly ? 't' : 'v'}:${name}`;
|
|
162
267
|
for (const line of lines) {
|
|
163
268
|
const m = line.match(re);
|
|
164
269
|
if (m) {
|
|
270
|
+
const k = key(m[1], false);
|
|
271
|
+
if (seen.has(k))
|
|
272
|
+
continue;
|
|
273
|
+
seen.add(k);
|
|
165
274
|
exports.push({ name: m[1], typeOnly: false });
|
|
166
275
|
continue;
|
|
167
276
|
}
|
|
168
277
|
const tm = line.match(typeRe);
|
|
169
|
-
if (tm)
|
|
278
|
+
if (tm) {
|
|
279
|
+
const k = key(tm[1], true);
|
|
280
|
+
if (seen.has(k))
|
|
281
|
+
continue;
|
|
282
|
+
seen.add(k);
|
|
170
283
|
exports.push({ name: tm[1], typeOnly: true });
|
|
284
|
+
}
|
|
171
285
|
}
|
|
172
286
|
return exports;
|
|
173
287
|
}
|
|
@@ -368,7 +482,11 @@ export function collectTsFilesFlat(dirPath, recursive) {
|
|
|
368
482
|
function transpileLib(ast, _cfg) {
|
|
369
483
|
const lines = [];
|
|
370
484
|
function processNode(node) {
|
|
371
|
-
if (
|
|
485
|
+
if (isReactNode(node.type)) {
|
|
486
|
+
lines.push(...generateReactNode(node));
|
|
487
|
+
lines.push('');
|
|
488
|
+
}
|
|
489
|
+
else if (isCoreNode(node.type)) {
|
|
372
490
|
lines.push(...generateCoreNode(node));
|
|
373
491
|
lines.push('');
|
|
374
492
|
}
|
|
@@ -376,10 +494,6 @@ function transpileLib(ast, _cfg) {
|
|
|
376
494
|
lines.push(...expandTemplateNode(node));
|
|
377
495
|
lines.push('');
|
|
378
496
|
}
|
|
379
|
-
else if (isReactNode(node.type)) {
|
|
380
|
-
lines.push(...generateReactNode(node));
|
|
381
|
-
lines.push('');
|
|
382
|
-
}
|
|
383
497
|
}
|
|
384
498
|
processNode(ast);
|
|
385
499
|
if (ast.children) {
|
|
@@ -390,9 +504,71 @@ function transpileLib(ast, _cfg) {
|
|
|
390
504
|
const code = lines.join('\n');
|
|
391
505
|
return { code, sourceMap: [], irTokenCount: 0, tsTokenCount: 0, tokenReduction: 0 };
|
|
392
506
|
}
|
|
507
|
+
/** Slice 4 layer 2 — apply the Result / Option preamble post-transpile.
|
|
508
|
+
*
|
|
509
|
+
* Lifted from `transpileLib` so every TS-family target picks up the compact
|
|
510
|
+
* form without each transpiler needing its own integration. FastAPI is
|
|
511
|
+
* excluded (Python).
|
|
512
|
+
*
|
|
513
|
+
* Slice 4 follow-up — Vue / Nuxt SFC outputs route through
|
|
514
|
+
* `injectKernStdlibPreambleIntoSFC`, which inserts the preamble INSIDE
|
|
515
|
+
* the `<script setup lang="ts">` block instead of before it. The earlier
|
|
516
|
+
* blanket pre-injection broke `.vue` parse because raw `type Result<…>`
|
|
517
|
+
* text appeared ahead of the SFC. Plain TS-family targets continue to
|
|
518
|
+
* use `injectKernStdlibPreamble` (which knows about `'use client'`,
|
|
519
|
+
* hashbangs, and JSDoc).
|
|
520
|
+
*
|
|
521
|
+
* Multi-artifact targets (express routes, structured Next.js, etc.) get the
|
|
522
|
+
* preamble injected into every artifact whose path ends in `.ts` / `.tsx`
|
|
523
|
+
* / `.mts` / `.cts`, since each route file independently references types
|
|
524
|
+
* in its handlers. Structured Vue / Nuxt artifacts use the SFC injector
|
|
525
|
+
* for `.vue` files. */
|
|
526
|
+
const TS_FAMILY_TARGETS = new Set([
|
|
527
|
+
'lib',
|
|
528
|
+
'native',
|
|
529
|
+
'web',
|
|
530
|
+
'tailwind',
|
|
531
|
+
'mcp',
|
|
532
|
+
'express',
|
|
533
|
+
'cli',
|
|
534
|
+
'terminal',
|
|
535
|
+
'ink',
|
|
536
|
+
'nextjs',
|
|
537
|
+
]);
|
|
538
|
+
const SFC_TARGETS = new Set(['vue', 'nuxt']);
|
|
539
|
+
function isTsArtifactPath(path) {
|
|
540
|
+
return path.endsWith('.ts') || path.endsWith('.tsx') || path.endsWith('.mts') || path.endsWith('.cts');
|
|
541
|
+
}
|
|
542
|
+
function isSfcArtifactPath(path) {
|
|
543
|
+
return path.endsWith('.vue');
|
|
544
|
+
}
|
|
545
|
+
function applyKernStdlibPreamble(ast, target, result) {
|
|
546
|
+
const isSfc = SFC_TARGETS.has(target);
|
|
547
|
+
if (!TS_FAMILY_TARGETS.has(target) && !isSfc)
|
|
548
|
+
return result;
|
|
549
|
+
const usage = detectKernStdlibUsage(ast);
|
|
550
|
+
const preamble = kernStdlibPreamble(usage);
|
|
551
|
+
if (preamble.length === 0)
|
|
552
|
+
return result;
|
|
553
|
+
const inject = isSfc ? injectKernStdlibPreambleIntoSFC : injectKernStdlibPreamble;
|
|
554
|
+
const updatedCode = inject(result.code, preamble);
|
|
555
|
+
const updatedArtifacts = result.artifacts?.map((art) => {
|
|
556
|
+
if (isSfcArtifactPath(art.path)) {
|
|
557
|
+
return { ...art, content: injectKernStdlibPreambleIntoSFC(art.content, preamble) };
|
|
558
|
+
}
|
|
559
|
+
if (isTsArtifactPath(art.path)) {
|
|
560
|
+
return { ...art, content: injectKernStdlibPreamble(art.content, preamble) };
|
|
561
|
+
}
|
|
562
|
+
return art;
|
|
563
|
+
});
|
|
564
|
+
return {
|
|
565
|
+
...result,
|
|
566
|
+
code: updatedCode,
|
|
567
|
+
...(updatedArtifacts ? { artifacts: updatedArtifacts } : {}),
|
|
568
|
+
};
|
|
569
|
+
}
|
|
393
570
|
// ── Transpile dispatch ───────────────────────────────────────────────────
|
|
394
|
-
|
|
395
|
-
const target = cfg.target === 'auto' ? detectTarget(ast) : cfg.target;
|
|
571
|
+
function dispatchTranspile(target, ast, cfg) {
|
|
396
572
|
return target === 'lib'
|
|
397
573
|
? transpileLib(ast, cfg)
|
|
398
574
|
: target === 'native'
|
|
@@ -419,12 +595,21 @@ export function transpileForTarget(ast, cfg) {
|
|
|
419
595
|
? transpileNuxt(ast, cfg)
|
|
420
596
|
: transpileNextjs(ast, cfg);
|
|
421
597
|
}
|
|
598
|
+
export function transpileForTarget(ast, cfg) {
|
|
599
|
+
const target = cfg.target === 'auto' ? detectTarget(ast) : cfg.target;
|
|
600
|
+
const result = dispatchTranspile(target, ast, cfg);
|
|
601
|
+
// Slice 4 layer 2 — auto-emit Result / Option type aliases for every
|
|
602
|
+
// TS-family target. Single integration point so target transpilers don't
|
|
603
|
+
// each need their own preamble plumbing.
|
|
604
|
+
return applyKernStdlibPreamble(ast, target, result);
|
|
605
|
+
}
|
|
422
606
|
// ── Transpile + write ────────────────────────────────────────────────────
|
|
423
|
-
export function transpileAndWrite(file, cfg, args, outDirOverride, inputBase) {
|
|
607
|
+
export function transpileAndWrite(file, cfg, args, outDirOverride, inputBase, options) {
|
|
424
608
|
const source = readFileSync(file, 'utf-8');
|
|
425
|
-
const ast = parseAndSurface(source, file);
|
|
609
|
+
const ast = parseAndSurface(source, file, options);
|
|
426
610
|
const ext = file.endsWith('.kern') ? '.kern' : '.ir';
|
|
427
611
|
const name = basename(file, ext);
|
|
612
|
+
const sourceName = basename(file, ext);
|
|
428
613
|
const relSource = relative(process.cwd(), file);
|
|
429
614
|
const header = `${GENERATED_HEADER + relSource}\n\n`;
|
|
430
615
|
if (!args.includes('--no-gaps')) {
|
|
@@ -446,7 +631,10 @@ export function transpileAndWrite(file, cfg, args, outDirOverride, inputBase) {
|
|
|
446
631
|
const artifactPath = resolve(outDir, artifact.path);
|
|
447
632
|
mkdirSync(dirname(artifactPath), { recursive: true });
|
|
448
633
|
checkVersionDrift(artifactPath, relSource);
|
|
449
|
-
|
|
634
|
+
const tracedContent = withSourceTraceComments(artifact.content, ast, sourceName, {
|
|
635
|
+
entry: artifact.type === 'entry',
|
|
636
|
+
});
|
|
637
|
+
writeFileSync(artifactPath, withGeneratedHeader(tracedContent, header));
|
|
450
638
|
}
|
|
451
639
|
}
|
|
452
640
|
else {
|
|
@@ -464,7 +652,7 @@ export function transpileAndWrite(file, cfg, args, outDirOverride, inputBase) {
|
|
|
464
652
|
const outFilePath = resolve(outDir, outFileName);
|
|
465
653
|
mkdirSync(dirname(outFilePath), { recursive: true });
|
|
466
654
|
checkVersionDrift(outFilePath, relSource);
|
|
467
|
-
writeFileSync(outFilePath, withGeneratedHeader(result.code, header));
|
|
655
|
+
writeFileSync(outFilePath, withGeneratedHeader(withSourceTraceComments(result.code, ast, sourceName), header));
|
|
468
656
|
// Flat Ink output still needs a runnable entrypoint. Emit a sibling
|
|
469
657
|
// companion file that imports the generated component by filename, so
|
|
470
658
|
// multi-file directory compiles do not collide on a shared index.tsx.
|
|
@@ -475,7 +663,7 @@ export function transpileAndWrite(file, cfg, args, outDirOverride, inputBase) {
|
|
|
475
663
|
const componentModule = `./${basename(outFileName, '.tsx')}.js`;
|
|
476
664
|
const entryContent = entryArtifact.content.replace(/from '\.\/[^']+\.js';/, `from '${componentModule}';`);
|
|
477
665
|
checkVersionDrift(entryFilePath, relSource);
|
|
478
|
-
writeFileSync(entryFilePath, withGeneratedHeader(entryContent, header));
|
|
666
|
+
writeFileSync(entryFilePath, withGeneratedHeader(withSourceTraceComments(entryContent, ast, sourceName, { entry: true }), header));
|
|
479
667
|
}
|
|
480
668
|
}
|
|
481
669
|
// In flat mode (default), other targets skip artifact emission — single file output only.
|