@kernlang/core 3.2.3 → 3.3.4
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/codegen/functions.js +19 -0
- package/dist/codegen/functions.js.map +1 -1
- package/dist/codegen/ground-layer.d.ts +1 -0
- package/dist/codegen/ground-layer.js +45 -0
- package/dist/codegen/ground-layer.js.map +1 -1
- package/dist/codegen/type-system.d.ts +1 -0
- package/dist/codegen/type-system.js +107 -24
- package/dist/codegen/type-system.js.map +1 -1
- package/dist/codegen-core.d.ts +2 -2
- package/dist/codegen-core.js +12 -4
- package/dist/codegen-core.js.map +1 -1
- package/dist/config.d.ts +16 -0
- package/dist/config.js +8 -0
- package/dist/config.js.map +1 -1
- package/dist/coverage-gap.d.ts +15 -0
- package/dist/coverage-gap.js +17 -5
- package/dist/coverage-gap.js.map +1 -1
- package/dist/importer.js +47 -6
- package/dist/importer.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/migrate-literals.d.ts +44 -0
- package/dist/migrate-literals.js +69 -0
- package/dist/migrate-literals.js.map +1 -0
- package/dist/node-props.d.ts +32 -3
- package/dist/node-props.js.map +1 -1
- package/dist/parser-core.js +90 -1
- package/dist/parser-core.js.map +1 -1
- package/dist/scanner.js +11 -1
- package/dist/scanner.js.map +1 -1
- package/dist/schema.js +48 -2
- package/dist/schema.js.map +1 -1
- package/dist/shadow-analyzer.d.ts +22 -0
- package/dist/shadow-analyzer.js +593 -0
- package/dist/shadow-analyzer.js.map +1 -0
- package/dist/spec.d.ts +2 -2
- package/dist/spec.js +7 -1
- package/dist/spec.js.map +1 -1
- package/dist/version-adapters.d.ts +14 -0
- package/dist/version-adapters.js +23 -1
- package/dist/version-adapters.js.map +1 -1
- package/dist/version-detect.d.ts +7 -0
- package/dist/version-detect.js +17 -0
- package/dist/version-detect.js.map +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shadow Source analyzer — semantic visibility into handler bodies without touching the node model.
|
|
3
|
+
*
|
|
4
|
+
* Strategy: synthesize a virtual TypeScript file per handler that models the surrounding scope
|
|
5
|
+
* (fn params, service `this`, websocket connection locals), run a single shared `ts.Program`
|
|
6
|
+
* across all virtual files, and map diagnostics back to the original .kern source.
|
|
7
|
+
*
|
|
8
|
+
* Narrower v0: supports only contexts whose lowering exists in `packages/core/src/codegen/`.
|
|
9
|
+
* Currently: `fn`, `method` (inside `service`/`repository`), and `on` (inside `websocket`).
|
|
10
|
+
* Every other handler parent is flagged `shadow-unsupported-context` rather than modeled —
|
|
11
|
+
* we'd rather miss diagnostics than emit confident false ones.
|
|
12
|
+
*/
|
|
13
|
+
import { parseParamList } from './codegen/helpers.js';
|
|
14
|
+
const HANDLER_OPEN = 'handler <<<';
|
|
15
|
+
// Minimal set of type names that should NOT be declared as `type X = any;` in the support file.
|
|
16
|
+
// Narrowly scoped — everything not in this set but referenced as a type must either come from
|
|
17
|
+
// an IR declaration (collected in collectDeclaredTypeNames) or trigger a real TS diagnostic.
|
|
18
|
+
const BUILTIN_TYPE_NAMES = new Set([
|
|
19
|
+
'any',
|
|
20
|
+
'unknown',
|
|
21
|
+
'never',
|
|
22
|
+
'void',
|
|
23
|
+
'undefined',
|
|
24
|
+
'null',
|
|
25
|
+
'string',
|
|
26
|
+
'number',
|
|
27
|
+
'boolean',
|
|
28
|
+
'object',
|
|
29
|
+
'bigint',
|
|
30
|
+
'symbol',
|
|
31
|
+
'true',
|
|
32
|
+
'false',
|
|
33
|
+
'Promise',
|
|
34
|
+
'Array',
|
|
35
|
+
'ReadonlyArray',
|
|
36
|
+
'Record',
|
|
37
|
+
'Pick',
|
|
38
|
+
'Omit',
|
|
39
|
+
'Partial',
|
|
40
|
+
'Required',
|
|
41
|
+
'ReturnType',
|
|
42
|
+
'Parameters',
|
|
43
|
+
'NonNullable',
|
|
44
|
+
'Exclude',
|
|
45
|
+
'Extract',
|
|
46
|
+
'Awaited',
|
|
47
|
+
'Map',
|
|
48
|
+
'Set',
|
|
49
|
+
'WeakMap',
|
|
50
|
+
'WeakSet',
|
|
51
|
+
'Date',
|
|
52
|
+
'Error',
|
|
53
|
+
'RegExp',
|
|
54
|
+
'URL',
|
|
55
|
+
'URLSearchParams',
|
|
56
|
+
'Uint8Array',
|
|
57
|
+
'Buffer',
|
|
58
|
+
'AbortController',
|
|
59
|
+
'AbortSignal',
|
|
60
|
+
]);
|
|
61
|
+
// IR node types that DECLARE a type name usable inside handlers.
|
|
62
|
+
const DECLARING_NODE_TYPES = new Set([
|
|
63
|
+
'type',
|
|
64
|
+
'interface',
|
|
65
|
+
'union',
|
|
66
|
+
'error',
|
|
67
|
+
'event',
|
|
68
|
+
'model',
|
|
69
|
+
'service',
|
|
70
|
+
'class',
|
|
71
|
+
'repository',
|
|
72
|
+
]);
|
|
73
|
+
export async function analyzeShadow(root) {
|
|
74
|
+
const ts = await loadTypeScript();
|
|
75
|
+
if (!ts) {
|
|
76
|
+
return [
|
|
77
|
+
{
|
|
78
|
+
rule: 'shadow-typescript-missing',
|
|
79
|
+
nodeType: root.type,
|
|
80
|
+
message: "Shadow analysis requires the optional peer dependency 'typescript' to be installed.",
|
|
81
|
+
line: root.loc?.line,
|
|
82
|
+
col: root.loc?.col,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
const declaredTypeNames = collectDeclaredTypeNames(root);
|
|
87
|
+
const moduleDeclarations = collectModuleDeclarations(root);
|
|
88
|
+
const diagnostics = [];
|
|
89
|
+
const units = [];
|
|
90
|
+
walk(root, [], (node, ancestors) => {
|
|
91
|
+
if (node.type !== 'handler')
|
|
92
|
+
return;
|
|
93
|
+
if (ancestors.some((a) => a.type === '__error'))
|
|
94
|
+
return;
|
|
95
|
+
const parentNode = ancestors[ancestors.length - 1];
|
|
96
|
+
if (!parentNode)
|
|
97
|
+
return;
|
|
98
|
+
const result = buildHandlerUnit(node, parentNode, ancestors, units.length);
|
|
99
|
+
diagnostics.push(...result.diagnostics);
|
|
100
|
+
if (result.unit)
|
|
101
|
+
units.push(result.unit);
|
|
102
|
+
});
|
|
103
|
+
if (units.length === 0)
|
|
104
|
+
return diagnostics;
|
|
105
|
+
const supportFileName = '/__kern_shadow__/support.d.ts';
|
|
106
|
+
const files = new Map([[supportFileName, buildSupportFile(declaredTypeNames, moduleDeclarations)]]);
|
|
107
|
+
const unitsByFile = new Map();
|
|
108
|
+
for (const unit of units) {
|
|
109
|
+
files.set(unit.fileName, unit.virtualSource);
|
|
110
|
+
unitsByFile.set(unit.fileName, unit);
|
|
111
|
+
}
|
|
112
|
+
const options = {
|
|
113
|
+
target: ts.ScriptTarget.ES2022,
|
|
114
|
+
module: ts.ModuleKind.ESNext,
|
|
115
|
+
strict: true,
|
|
116
|
+
noEmit: true,
|
|
117
|
+
skipLibCheck: true,
|
|
118
|
+
noUnusedParameters: false,
|
|
119
|
+
noUnusedLocals: false,
|
|
120
|
+
lib: ['lib.es2022.d.ts'],
|
|
121
|
+
types: [],
|
|
122
|
+
};
|
|
123
|
+
const baseHost = ts.createCompilerHost(options, true);
|
|
124
|
+
const host = {
|
|
125
|
+
...baseHost,
|
|
126
|
+
fileExists(fileName) {
|
|
127
|
+
return files.has(fileName) || baseHost.fileExists(fileName);
|
|
128
|
+
},
|
|
129
|
+
readFile(fileName) {
|
|
130
|
+
return files.get(fileName) ?? baseHost.readFile(fileName);
|
|
131
|
+
},
|
|
132
|
+
getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile) {
|
|
133
|
+
const text = files.get(fileName);
|
|
134
|
+
if (text !== undefined) {
|
|
135
|
+
return ts.createSourceFile(fileName, text, languageVersion, true);
|
|
136
|
+
}
|
|
137
|
+
return baseHost.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
|
|
138
|
+
},
|
|
139
|
+
writeFile() { },
|
|
140
|
+
getCurrentDirectory() {
|
|
141
|
+
return '/__kern_shadow__';
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
const program = ts.createProgram({
|
|
145
|
+
rootNames: [...files.keys()],
|
|
146
|
+
options,
|
|
147
|
+
host,
|
|
148
|
+
});
|
|
149
|
+
for (const diagnostic of program.getSemanticDiagnostics()) {
|
|
150
|
+
const unit = diagnostic.file ? unitsByFile.get(diagnostic.file.fileName) : undefined;
|
|
151
|
+
if (!unit || diagnostic.start === undefined)
|
|
152
|
+
continue;
|
|
153
|
+
const mapped = mapDiagnostic(ts, diagnostic, unit);
|
|
154
|
+
if (mapped)
|
|
155
|
+
diagnostics.push(mapped);
|
|
156
|
+
}
|
|
157
|
+
return diagnostics;
|
|
158
|
+
}
|
|
159
|
+
async function loadTypeScript() {
|
|
160
|
+
try {
|
|
161
|
+
const mod = (await import('typescript'));
|
|
162
|
+
return mod.default ?? mod;
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function buildHandlerUnit(handlerNode, parentNode, ancestors, index) {
|
|
169
|
+
const rawCode = typeof handlerNode.props?.code === 'string' ? handlerNode.props.code : '';
|
|
170
|
+
if (!rawCode.trim())
|
|
171
|
+
return { diagnostics: [] };
|
|
172
|
+
switch (parentNode.type) {
|
|
173
|
+
case 'fn': {
|
|
174
|
+
const fnKeyword = shadowFnKeyword(parentNode);
|
|
175
|
+
return {
|
|
176
|
+
diagnostics: [],
|
|
177
|
+
unit: createUnit({
|
|
178
|
+
index,
|
|
179
|
+
handlerNode,
|
|
180
|
+
parentType: 'fn',
|
|
181
|
+
lines: [
|
|
182
|
+
buildModuleMarker(),
|
|
183
|
+
buildReferenceLine(),
|
|
184
|
+
`${fnKeyword} __shadow(${safeParams(parentNode.props?.params)})${wrappedReturnClause(parentNode)} {`,
|
|
185
|
+
rawCode,
|
|
186
|
+
'}',
|
|
187
|
+
],
|
|
188
|
+
bodyStartLine: 4,
|
|
189
|
+
rawCode,
|
|
190
|
+
}),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
case 'method': {
|
|
194
|
+
const ownerNode = ancestors[ancestors.length - 2];
|
|
195
|
+
if (!ownerNode ||
|
|
196
|
+
(ownerNode.type !== 'service' && ownerNode.type !== 'repository' && ownerNode.type !== 'class')) {
|
|
197
|
+
return unsupportedContext(handlerNode, parentNode, 'method owner is not a service, class, or repository');
|
|
198
|
+
}
|
|
199
|
+
const scopeLines = buildMethodScopeLines(ownerNode, index);
|
|
200
|
+
const selfTypeName = `__ShadowSelf_${index}`;
|
|
201
|
+
const staticSelfTypeName = `__ShadowStaticSelf_${index}`;
|
|
202
|
+
const isStatic = parentNode.props?.static === 'true' || parentNode.props?.static === true;
|
|
203
|
+
const fnKeyword = shadowFnKeyword(parentNode);
|
|
204
|
+
return {
|
|
205
|
+
diagnostics: [],
|
|
206
|
+
unit: createUnit({
|
|
207
|
+
index,
|
|
208
|
+
handlerNode,
|
|
209
|
+
parentType: 'method',
|
|
210
|
+
lines: [
|
|
211
|
+
buildModuleMarker(),
|
|
212
|
+
buildReferenceLine(),
|
|
213
|
+
...scopeLines,
|
|
214
|
+
`${fnKeyword} __shadow(${methodParams(parentNode, isStatic, selfTypeName, staticSelfTypeName)})${wrappedReturnClause(parentNode)} {`,
|
|
215
|
+
rawCode,
|
|
216
|
+
'}',
|
|
217
|
+
],
|
|
218
|
+
bodyStartLine: 4 + scopeLines.length,
|
|
219
|
+
rawCode,
|
|
220
|
+
}),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
case 'on': {
|
|
224
|
+
const container = ancestors[ancestors.length - 2];
|
|
225
|
+
if (container?.type === 'websocket') {
|
|
226
|
+
return {
|
|
227
|
+
diagnostics: [],
|
|
228
|
+
unit: buildWebSocketOnUnit(handlerNode, parentNode, index, rawCode),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
void container;
|
|
232
|
+
return unsupportedContext(handlerNode, parentNode, `'on' handlers are only modeled inside 'websocket' containers in this release`);
|
|
233
|
+
}
|
|
234
|
+
default:
|
|
235
|
+
return unsupportedContext(handlerNode, parentNode, `shadow analysis does not model '${parentNode.type}' handler scope yet`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function buildWebSocketOnUnit(handlerNode, onNode, index, rawCode) {
|
|
239
|
+
// Mirrors events.ts:144-194. All websocket handlers share the outer
|
|
240
|
+
// `wss.on('connection', (ws, req) => { const path = req.url || ...; ... })` scope,
|
|
241
|
+
// so `ws`, `req`, `path` are in lexical scope for every inner handler.
|
|
242
|
+
const eventName = typeof onNode.props?.event === 'string'
|
|
243
|
+
? onNode.props.event
|
|
244
|
+
: typeof onNode.props?.name === 'string'
|
|
245
|
+
? onNode.props.name
|
|
246
|
+
: '';
|
|
247
|
+
const sharedLocals = [
|
|
248
|
+
' const ws: __ShadowWebSocket = undefined as any;',
|
|
249
|
+
' const req: __ShadowRequest = undefined as any;',
|
|
250
|
+
' const path: string = "";',
|
|
251
|
+
];
|
|
252
|
+
const eventLocals = [];
|
|
253
|
+
if (eventName === 'message') {
|
|
254
|
+
// events.ts:158-161: `ws.on('message', (raw) => { const data = JSON.parse(raw.toString()); ... })`
|
|
255
|
+
// `raw` is the ws RawData argument; `data` is any (JSON.parse return).
|
|
256
|
+
eventLocals.push(' const raw: Buffer = new Uint8Array() as Buffer;', ' const data: any = undefined;');
|
|
257
|
+
}
|
|
258
|
+
else if (eventName === 'error') {
|
|
259
|
+
// events.ts:172: `ws.on('error', (error) => { ... })` — `error` param, typed unknown/Error in ws.
|
|
260
|
+
eventLocals.push(' const error: Error = new Error();');
|
|
261
|
+
}
|
|
262
|
+
// connect/disconnect/close: no extra locals — callbacks take no useful params.
|
|
263
|
+
// ws `on` callbacks are sync arrow functions in the generator — see events.ts:145,158,172,183.
|
|
264
|
+
// A user `await` inside a ws handler IS a real bug and shadow should surface it.
|
|
265
|
+
return createUnit({
|
|
266
|
+
index,
|
|
267
|
+
handlerNode,
|
|
268
|
+
parentType: `on:${eventName || 'unknown'}`,
|
|
269
|
+
lines: [
|
|
270
|
+
buildModuleMarker(),
|
|
271
|
+
buildReferenceLine(),
|
|
272
|
+
`// websocket on='${eventName || 'unknown'}'`,
|
|
273
|
+
'function __shadow(): void {',
|
|
274
|
+
...sharedLocals,
|
|
275
|
+
...eventLocals,
|
|
276
|
+
rawCode,
|
|
277
|
+
'}',
|
|
278
|
+
],
|
|
279
|
+
bodyStartLine: 5 + sharedLocals.length + eventLocals.length,
|
|
280
|
+
rawCode,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
function unsupportedContext(handlerNode, parentNode, detail) {
|
|
284
|
+
return {
|
|
285
|
+
diagnostics: [
|
|
286
|
+
{
|
|
287
|
+
rule: 'shadow-unsupported-context',
|
|
288
|
+
nodeType: parentNode.type,
|
|
289
|
+
message: `Skipped shadow analysis for '${parentNode.type}' handler: ${detail}.`,
|
|
290
|
+
line: handlerNode.loc?.line,
|
|
291
|
+
col: handlerNode.loc?.col,
|
|
292
|
+
},
|
|
293
|
+
],
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
function createUnit({ index, handlerNode, parentType, lines, bodyStartLine, rawCode, }) {
|
|
297
|
+
const safeSuffix = parentType.replace(/[^a-zA-Z0-9_]/g, '_');
|
|
298
|
+
const fileName = `/__kern_shadow__/handler-${index}-${safeSuffix}.ts`;
|
|
299
|
+
const virtualSource = lines.join('\n');
|
|
300
|
+
const sourceLoc = inferSourceStart(handlerNode, rawCode);
|
|
301
|
+
return {
|
|
302
|
+
fileName,
|
|
303
|
+
node: handlerNode,
|
|
304
|
+
parentType,
|
|
305
|
+
rawCode,
|
|
306
|
+
virtualSource,
|
|
307
|
+
bodyStartLine,
|
|
308
|
+
bodyLineCount: rawCode.split('\n').length,
|
|
309
|
+
sourceStartLine: sourceLoc.line,
|
|
310
|
+
sourceStartCol: sourceLoc.col,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function buildSupportFile(declaredTypeNames, moduleDeclarations) {
|
|
314
|
+
const extraTypes = [...declaredTypeNames]
|
|
315
|
+
.filter((name) => !BUILTIN_TYPE_NAMES.has(name))
|
|
316
|
+
.sort()
|
|
317
|
+
.map((name) => `type ${name} = any;`);
|
|
318
|
+
// `lib: ['lib.es2022.d.ts']` strips Node's ambient runtime globals, so we stub the
|
|
319
|
+
// handful that real handlers routinely reach for. Typed as `any` to avoid downstream
|
|
320
|
+
// false positives on shape — this is a lint assist, not a strict type-check.
|
|
321
|
+
return [
|
|
322
|
+
'declare const console: {',
|
|
323
|
+
' log(...args: unknown[]): void;',
|
|
324
|
+
' info(...args: unknown[]): void;',
|
|
325
|
+
' warn(...args: unknown[]): void;',
|
|
326
|
+
' error(...args: unknown[]): void;',
|
|
327
|
+
' debug(...args: unknown[]): void;',
|
|
328
|
+
'};',
|
|
329
|
+
'declare const process: any;',
|
|
330
|
+
'declare function setTimeout(cb: (...args: any[]) => void, ms?: number, ...args: any[]): any;',
|
|
331
|
+
'declare function clearTimeout(handle: any): void;',
|
|
332
|
+
'declare function setInterval(cb: (...args: any[]) => void, ms?: number, ...args: any[]): any;',
|
|
333
|
+
'declare function clearInterval(handle: any): void;',
|
|
334
|
+
'declare function setImmediate(cb: (...args: any[]) => void, ...args: any[]): any;',
|
|
335
|
+
'declare function clearImmediate(handle: any): void;',
|
|
336
|
+
'declare function queueMicrotask(cb: () => void): void;',
|
|
337
|
+
'declare function fetch(input: any, init?: any): Promise<any>;',
|
|
338
|
+
'declare function structuredClone<T>(value: T): T;',
|
|
339
|
+
'declare const globalThis: any;',
|
|
340
|
+
'',
|
|
341
|
+
'type Buffer = Uint8Array;',
|
|
342
|
+
'type __ShadowRequest = {',
|
|
343
|
+
' url?: string;',
|
|
344
|
+
' headers: Record<string, string | undefined>;',
|
|
345
|
+
' method?: string;',
|
|
346
|
+
'};',
|
|
347
|
+
'type __ShadowWebSocket = {',
|
|
348
|
+
' send(data: unknown): void;',
|
|
349
|
+
' close(code?: number): void;',
|
|
350
|
+
' readyState?: number;',
|
|
351
|
+
' on(event: string, listener: (...args: any[]) => void): void;',
|
|
352
|
+
'};',
|
|
353
|
+
...extraTypes,
|
|
354
|
+
'',
|
|
355
|
+
'// ── Module-scope declarations from the KERN file ──',
|
|
356
|
+
...moduleDeclarations,
|
|
357
|
+
].join('\n');
|
|
358
|
+
}
|
|
359
|
+
function buildMethodScopeLines(ownerNode, index) {
|
|
360
|
+
const fieldLines = (ownerNode.children || [])
|
|
361
|
+
.filter((child) => child.type === 'field')
|
|
362
|
+
.map((field) => {
|
|
363
|
+
const name = typeof field.props?.name === 'string' ? field.props.name : 'field';
|
|
364
|
+
const type = typeof field.props?.type === 'string' ? field.props.type : 'any';
|
|
365
|
+
return ` ${name}: ${type};`;
|
|
366
|
+
});
|
|
367
|
+
// Repositories synthesize a `readonly modelType = '<model>';` in generateRepository()
|
|
368
|
+
// (see packages/core/src/codegen/data-layer.ts). Expose it so `this.modelType` type-checks.
|
|
369
|
+
if (ownerNode.type === 'repository') {
|
|
370
|
+
const model = typeof ownerNode.props?.model === 'string' ? ownerNode.props.model : '';
|
|
371
|
+
fieldLines.push(` readonly modelType: ${model ? JSON.stringify(model) : 'string'};`);
|
|
372
|
+
}
|
|
373
|
+
const instanceMethods = [];
|
|
374
|
+
const staticMethods = [];
|
|
375
|
+
for (const child of ownerNode.children || []) {
|
|
376
|
+
if (child.type !== 'method')
|
|
377
|
+
continue;
|
|
378
|
+
const name = typeof child.props?.name === 'string' ? child.props.name : 'method';
|
|
379
|
+
const isStatic = child.props?.static === 'true' || child.props?.static === true;
|
|
380
|
+
const params = safeParams(child.props?.params);
|
|
381
|
+
const returns = returnType(child.props?.returns);
|
|
382
|
+
const line = ` ${name}(${params}): ${returns};`;
|
|
383
|
+
if (isStatic)
|
|
384
|
+
staticMethods.push(line);
|
|
385
|
+
else
|
|
386
|
+
instanceMethods.push(line);
|
|
387
|
+
}
|
|
388
|
+
return [
|
|
389
|
+
`type __ShadowSelf_${index} = {`,
|
|
390
|
+
...fieldLines,
|
|
391
|
+
...instanceMethods,
|
|
392
|
+
'};',
|
|
393
|
+
`type __ShadowStaticSelf_${index} = {`,
|
|
394
|
+
...staticMethods,
|
|
395
|
+
'};',
|
|
396
|
+
];
|
|
397
|
+
}
|
|
398
|
+
function returnType(value) {
|
|
399
|
+
return typeof value === 'string' && value.trim() ? value.trim() : 'unknown';
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Mirror codegen/functions.ts:27-108 return-type inference for both the
|
|
403
|
+
* __shadow wrapper and the module-scope stub. Keeps generator/stream/async
|
|
404
|
+
* handling in one place.
|
|
405
|
+
*/
|
|
406
|
+
function wrappedReturnType(node) {
|
|
407
|
+
const declared = returnType(node.props?.returns);
|
|
408
|
+
const async = node.props?.async === 'true' || node.props?.async === true;
|
|
409
|
+
const generator = node.props?.generator === 'true' || node.props?.generator === true;
|
|
410
|
+
const stream = node.props?.stream === 'true' || node.props?.stream === true;
|
|
411
|
+
if (stream || (async && generator)) {
|
|
412
|
+
return /^AsyncGenerator</.test(declared) ? declared : `AsyncGenerator<${declared}>`;
|
|
413
|
+
}
|
|
414
|
+
if (generator) {
|
|
415
|
+
return /^Generator</.test(declared) ? declared : `Generator<${declared}>`;
|
|
416
|
+
}
|
|
417
|
+
if (async && !/^Promise</.test(declared)) {
|
|
418
|
+
return `Promise<${declared}>`;
|
|
419
|
+
}
|
|
420
|
+
return declared;
|
|
421
|
+
}
|
|
422
|
+
function wrappedReturnClause(node) {
|
|
423
|
+
return `: ${wrappedReturnType(node)}`;
|
|
424
|
+
}
|
|
425
|
+
function safeParams(value) {
|
|
426
|
+
return typeof value === 'string' && value.trim() ? parseParamList(value) : '';
|
|
427
|
+
}
|
|
428
|
+
function methodParams(node, isStatic, selfTypeName, staticSelfTypeName) {
|
|
429
|
+
const parts = [`this: ${isStatic ? staticSelfTypeName : selfTypeName}`];
|
|
430
|
+
const params = safeParams(node.props?.params);
|
|
431
|
+
if (params)
|
|
432
|
+
parts.push(params);
|
|
433
|
+
return parts.join(', ');
|
|
434
|
+
}
|
|
435
|
+
function buildReferenceLine() {
|
|
436
|
+
return '/// <reference path="./support.d.ts" />';
|
|
437
|
+
}
|
|
438
|
+
function buildModuleMarker() {
|
|
439
|
+
// Force each virtual file to be a module, not a script. Otherwise TS puts every
|
|
440
|
+
// __shadow/__ShadowSelf_* declaration into one global namespace and handlers
|
|
441
|
+
// silently cross-contaminate each other.
|
|
442
|
+
return 'export {};';
|
|
443
|
+
}
|
|
444
|
+
function shadowFnKeyword(node) {
|
|
445
|
+
// Mirror codegen/functions.ts:32-79 strictly. A plain fn that uses `await` SHOULD
|
|
446
|
+
// get TS1308 under shadow — it would be a real bug at compile time too.
|
|
447
|
+
const async = node.props?.async === 'true' || node.props?.async === true;
|
|
448
|
+
const generator = node.props?.generator === 'true' || node.props?.generator === true;
|
|
449
|
+
const stream = node.props?.stream === 'true' || node.props?.stream === true;
|
|
450
|
+
if (stream)
|
|
451
|
+
return 'async function*';
|
|
452
|
+
if (async && generator)
|
|
453
|
+
return 'async function*';
|
|
454
|
+
if (generator)
|
|
455
|
+
return 'function*';
|
|
456
|
+
if (async)
|
|
457
|
+
return 'async function';
|
|
458
|
+
return 'function';
|
|
459
|
+
}
|
|
460
|
+
function mapDiagnostic(ts, diagnostic, unit) {
|
|
461
|
+
const file = diagnostic.file;
|
|
462
|
+
if (!file || diagnostic.start === undefined)
|
|
463
|
+
return undefined;
|
|
464
|
+
const position = ts.getLineAndCharacterOfPosition(file, diagnostic.start);
|
|
465
|
+
const diagnosticLine = position.line + 1;
|
|
466
|
+
// Diagnostics inside the body — map 1:1.
|
|
467
|
+
if (diagnosticLine >= unit.bodyStartLine && diagnosticLine < unit.bodyStartLine + unit.bodyLineCount) {
|
|
468
|
+
const sourceLine = unit.sourceStartLine + (diagnosticLine - unit.bodyStartLine);
|
|
469
|
+
const sourceCol = diagnosticLine === unit.bodyStartLine ? unit.sourceStartCol + position.character : position.character + 1;
|
|
470
|
+
return {
|
|
471
|
+
rule: 'shadow-ts',
|
|
472
|
+
nodeType: unit.parentType,
|
|
473
|
+
message: ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'),
|
|
474
|
+
line: sourceLine,
|
|
475
|
+
col: sourceCol,
|
|
476
|
+
tsCode: diagnostic.code,
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
// Diagnostics in the wrapper region (signature, scope types, module marker) —
|
|
480
|
+
// e.g. TS2355 "function whose declared type is neither 'void' nor 'any' must
|
|
481
|
+
// return a value" lands on the signature line. Attribute it to the handler's
|
|
482
|
+
// first source line so real errors aren't silently dropped.
|
|
483
|
+
if (diagnosticLine < unit.bodyStartLine + unit.bodyLineCount) {
|
|
484
|
+
return {
|
|
485
|
+
rule: 'shadow-ts',
|
|
486
|
+
nodeType: unit.parentType,
|
|
487
|
+
message: ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'),
|
|
488
|
+
line: unit.sourceStartLine,
|
|
489
|
+
col: unit.sourceStartCol,
|
|
490
|
+
tsCode: diagnostic.code,
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
// Outside the unit's extent entirely — belongs to a different unit or the support file.
|
|
494
|
+
return undefined;
|
|
495
|
+
}
|
|
496
|
+
function inferSourceStart(handlerNode, rawCode) {
|
|
497
|
+
const handlerLine = handlerNode.loc?.line ?? 1;
|
|
498
|
+
const handlerCol = handlerNode.loc?.col ?? 1;
|
|
499
|
+
if (!rawCode.includes('\n')) {
|
|
500
|
+
// Inline: `handler <<< return x >>>` — col offset accounts for any leading whitespace.
|
|
501
|
+
const leading = rawCode.length - rawCode.trimStart().length;
|
|
502
|
+
return {
|
|
503
|
+
line: handlerLine,
|
|
504
|
+
col: handlerCol + HANDLER_OPEN.length + leading,
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
return {
|
|
508
|
+
line: handlerLine + 1,
|
|
509
|
+
col: 1,
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Collect `declare`-style entries for every top-level KERN symbol that would be
|
|
514
|
+
* visible from sibling handlers in the emitted TypeScript. Goes in the support
|
|
515
|
+
* file as ambient declarations so each virtual handler file sees them without
|
|
516
|
+
* importing. Keeps signatures loose (`any` args, `unknown` returns) — this is
|
|
517
|
+
* a lint assist, not a strict type-check.
|
|
518
|
+
*/
|
|
519
|
+
function collectModuleDeclarations(root) {
|
|
520
|
+
const lines = [];
|
|
521
|
+
const seen = new Set();
|
|
522
|
+
// The parser promotes the first top-level declaration to the root and nests
|
|
523
|
+
// the rest as its children. Walking the whole tree and filtering by type is
|
|
524
|
+
// simpler than reasoning about which level is "top" in any given file. Any
|
|
525
|
+
// declaration we encounter is module-scope from the handler's perspective
|
|
526
|
+
// because handlers can't be parents of these node kinds.
|
|
527
|
+
walk(root, [], (node) => {
|
|
528
|
+
const name = typeof node.props?.name === 'string' ? node.props.name : '';
|
|
529
|
+
if (!name || !/^[A-Za-z_]\w*$/.test(name))
|
|
530
|
+
return;
|
|
531
|
+
const key = `${node.type}:${name}`;
|
|
532
|
+
if (seen.has(key))
|
|
533
|
+
return;
|
|
534
|
+
switch (node.type) {
|
|
535
|
+
case 'fn': {
|
|
536
|
+
const params = safeParams(node.props?.params);
|
|
537
|
+
lines.push(`declare function ${name}(${params}): ${wrappedReturnType(node)};`);
|
|
538
|
+
seen.add(key);
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
541
|
+
case 'const': {
|
|
542
|
+
const type = typeof node.props?.type === 'string' ? node.props.type : 'any';
|
|
543
|
+
lines.push(`declare const ${name}: ${type};`);
|
|
544
|
+
seen.add(key);
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
case 'error':
|
|
548
|
+
// Use a namespace+var merge so `new NotFound()` works without pulling in
|
|
549
|
+
// a full class body (declare class would also work but can trip on
|
|
550
|
+
// `extends Error` in the minimal lib we load).
|
|
551
|
+
lines.push(`declare const ${name}: { new (...args: any[]): Error & { [key: string]: any } };`);
|
|
552
|
+
seen.add(key);
|
|
553
|
+
break;
|
|
554
|
+
case 'service':
|
|
555
|
+
case 'repository':
|
|
556
|
+
// These compile to real classes (generateService/generateRepository).
|
|
557
|
+
lines.push(`declare const ${name}: { new (...args: any[]): { [key: string]: any } } & { [key: string]: any };`);
|
|
558
|
+
seen.add(key);
|
|
559
|
+
break;
|
|
560
|
+
case 'model':
|
|
561
|
+
case 'type':
|
|
562
|
+
case 'interface':
|
|
563
|
+
case 'union':
|
|
564
|
+
case 'event':
|
|
565
|
+
// Type-only: generateModel emits `interface ${name}`, not a value.
|
|
566
|
+
// Already covered by declaredTypeNames -> `type X = any;` in the support file.
|
|
567
|
+
break;
|
|
568
|
+
default:
|
|
569
|
+
// Ignore UI/framework nodes — their identifiers aren't referenced from handler bodies.
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
return lines;
|
|
574
|
+
}
|
|
575
|
+
function collectDeclaredTypeNames(root) {
|
|
576
|
+
const names = new Set();
|
|
577
|
+
walk(root, [], (node) => {
|
|
578
|
+
if (!DECLARING_NODE_TYPES.has(node.type))
|
|
579
|
+
return;
|
|
580
|
+
const name = typeof node.props?.name === 'string' ? node.props.name : '';
|
|
581
|
+
if (name && /^[A-Za-z_]\w*$/.test(name)) {
|
|
582
|
+
names.add(name);
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
return names;
|
|
586
|
+
}
|
|
587
|
+
function walk(node, ancestors, visit) {
|
|
588
|
+
visit(node, ancestors);
|
|
589
|
+
for (const child of node.children || []) {
|
|
590
|
+
walk(child, [...ancestors, node], visit);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
//# sourceMappingURL=shadow-analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadow-analyzer.js","sourceRoot":"","sources":["../src/shadow-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAsGtD,MAAM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CAAC,CAAC;IAC3C,CAAC;AACH,CAAC"}
|
package/dist/spec.d.ts
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* Meta: theme nodes ($ref), pseudo-selectors (:press, :hover)
|
|
10
10
|
* Targets: Next.js, React+Tailwind, React Native, Express
|
|
11
11
|
*/
|
|
12
|
-
export declare const KERN_VERSION = "
|
|
12
|
+
export declare const KERN_VERSION = "3.3.4";
|
|
13
13
|
export declare const IR_GRAMMAR = "\ndocument = node+\nnode = indent type (SP prop)* (SP style)? (SP themeref)* NL child*\nchild = node\nindent = \" \"*\ntype = ident\nprop = ident \"=\" value\nvalue = quoted | bare\nquoted = '\"' [^\"]* '\"'\nbare = [^\\s{$]+\nstyle = \"{\" spair (\",\" spair)* \"}\"\nspair = sident \":\" svalue | \":\" pseudo \":\" sident \":\" svalue\npseudo = \"press\" | \"hover\" | \"active\" | \"focus\"\nsident = shorthand | ident\nsvalue = [^,}]+\nthemeref = \"$\" ident\nident = [A-Za-z_][A-Za-z0-9_-]*\nSP = \" \"+\nNL = \"\\n\" | EOF\n";
|
|
14
|
-
export declare const NODE_TYPES: readonly ["screen", "page", "row", "col", "card", "grid", "scroll", "text", "image", "progress", "divider", "codeblock", "section", "form", "button", "input", "textarea", "slider", "toggle", "modal", "list", "item", "tabs", "tab", "header", "link", "theme", "doc", "server", "route", "middleware", "handler", "schema", "stream", "spawn", "timer", "on", "env", "websocket", "params", "auth", "validate", "respond", "trigger", "cli", "command", "arg", "flag", "import", "separator", "table", "thead", "tbody", "tr", "th", "td", "scoreboard", "metric", "spinner", "box", "gradient", "state", "animation", "repl", "guard", "parallel", "dispatch", "then", "each", "layout", "loading", "metadata", "generateMetadata", "notFound", "redirect", "fetch", "type", "interface", "field", "fn", "const", "union", "variant", "service", "method", "singleton", "constructor", "signal", "cleanup", "machine", "transition", "error", "module", "export", "config", "store", "test", "describe", "it", "event", "hook", "provider", "effect", "logic", "memo", "callback", "ref", "context", "prop", "returns", "render", "input-area", "output-area", "text-input", "select-input", "multi-select", "confirm-input", "password-input", "status-message", "alert", "ordered-list", "unordered-list", "focus", "app-exit", "static-log", "newline", "layout-row", "layout-col", "layout-stack", "spacer", "screen-embed", "model", "column", "relation", "repository", "dependency", "inject", "cache", "entry", "invalidate", "conditional", "component", "select", "option", "icon", "svg", "template", "slot", "body", "derive", "transform", "action", "assume", "invariant", "branch", "path", "resolve", "candidate", "discriminator", "collect", "pattern", "apply", "expect", "recover", "strategy", "reason", "evidence", "needs", "rule", "message", "mcp", "tool", "resource", "prompt", "param", "description", "sampling", "elicitation"];
|
|
14
|
+
export declare const NODE_TYPES: readonly ["screen", "page", "row", "col", "card", "grid", "scroll", "text", "image", "progress", "divider", "codeblock", "section", "form", "button", "input", "textarea", "slider", "toggle", "modal", "list", "item", "tabs", "tab", "header", "link", "theme", "doc", "server", "route", "middleware", "handler", "schema", "stream", "spawn", "timer", "on", "env", "websocket", "params", "auth", "validate", "respond", "trigger", "cli", "command", "arg", "flag", "import", "separator", "table", "thead", "tbody", "tr", "th", "td", "scoreboard", "metric", "spinner", "box", "gradient", "state", "animation", "repl", "guard", "parallel", "dispatch", "then", "each", "layout", "loading", "metadata", "generateMetadata", "notFound", "redirect", "fetch", "type", "interface", "field", "fn", "const", "union", "variant", "service", "class", "method", "getter", "setter", "singleton", "constructor", "signal", "cleanup", "machine", "transition", "error", "module", "export", "config", "store", "test", "describe", "it", "event", "hook", "provider", "effect", "logic", "memo", "callback", "ref", "context", "prop", "returns", "render", "input-area", "output-area", "text-input", "select-input", "multi-select", "confirm-input", "password-input", "status-message", "alert", "ordered-list", "unordered-list", "focus", "app-exit", "static-log", "newline", "layout-row", "layout-col", "layout-stack", "spacer", "screen-embed", "alternate-screen", "scroll-box", "model", "column", "relation", "repository", "dependency", "inject", "cache", "entry", "invalidate", "conditional", "component", "select", "option", "icon", "svg", "template", "slot", "body", "derive", "transform", "action", "actionRegistry", "assume", "invariant", "branch", "path", "resolve", "candidate", "discriminator", "collect", "pattern", "apply", "expect", "recover", "strategy", "reason", "evidence", "needs", "rule", "message", "mcp", "tool", "resource", "prompt", "param", "description", "sampling", "elicitation"];
|
|
15
15
|
export type IRNodeType = (typeof NODE_TYPES)[number];
|
|
16
16
|
import { type KernRuntime } from './runtime.js';
|
|
17
17
|
/** Register an evolved node type (called at startup from .kern/evolved/). */
|