@kernlang/core 3.1.5 → 3.1.7
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/LICENSE +17 -0
- package/README.md +5 -2
- package/dist/codegen/data-layer.d.ts +12 -0
- package/dist/codegen/data-layer.js +291 -0
- package/dist/codegen/data-layer.js.map +1 -0
- package/dist/codegen/emitters.js +1 -4
- package/dist/codegen/emitters.js.map +1 -1
- package/dist/codegen/events.d.ts +9 -0
- package/dist/codegen/events.js +169 -0
- package/dist/codegen/events.js.map +1 -0
- package/dist/codegen/functions.d.ts +8 -0
- package/dist/codegen/functions.js +149 -0
- package/dist/codegen/functions.js.map +1 -0
- package/dist/codegen/ground-layer.d.ts +22 -0
- package/dist/codegen/ground-layer.js +321 -0
- package/dist/codegen/ground-layer.js.map +1 -0
- package/dist/codegen/helpers.d.ts +2 -0
- package/dist/codegen/helpers.js +19 -7
- package/dist/codegen/helpers.js.map +1 -1
- package/dist/codegen/machines.d.ts +9 -0
- package/dist/codegen/machines.js +129 -0
- package/dist/codegen/machines.js.map +1 -0
- package/dist/codegen/modules.d.ts +10 -0
- package/dist/codegen/modules.js +43 -0
- package/dist/codegen/modules.js.map +1 -0
- package/dist/codegen/screens.d.ts +29 -0
- package/dist/codegen/screens.js +202 -0
- package/dist/codegen/screens.js.map +1 -0
- package/dist/codegen/semantic-types.d.ts +14 -0
- package/dist/codegen/semantic-types.js +31 -0
- package/dist/codegen/semantic-types.js.map +1 -0
- package/dist/codegen/test-gen.d.ts +7 -0
- package/dist/codegen/test-gen.js +56 -0
- package/dist/codegen/test-gen.js.map +1 -0
- package/dist/codegen/type-system.d.ts +11 -0
- package/dist/codegen/type-system.js +171 -0
- package/dist/codegen/type-system.js.map +1 -0
- package/dist/codegen-core.d.ts +30 -36
- package/dist/codegen-core.js +258 -1459
- package/dist/codegen-core.js.map +1 -1
- package/dist/concepts.js.map +1 -1
- package/dist/config.d.ts +20 -1
- package/dist/config.js +36 -3
- package/dist/config.js.map +1 -1
- package/dist/coverage-gap.js +9 -5
- package/dist/coverage-gap.js.map +1 -1
- package/dist/decompiler.d.ts +10 -1
- package/dist/decompiler.js +21 -4
- package/dist/decompiler.js.map +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +11 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +33 -28
- package/dist/index.js +40 -35
- package/dist/index.js.map +1 -1
- package/dist/node-props.d.ts +255 -0
- package/dist/node-props.js +35 -0
- package/dist/node-props.js.map +1 -0
- package/dist/parser-core.d.ts +5 -0
- package/dist/parser-core.js +364 -0
- package/dist/parser-core.js.map +1 -0
- package/dist/parser-diagnostics.d.ts +14 -0
- package/dist/parser-diagnostics.js +32 -0
- package/dist/parser-diagnostics.js.map +1 -0
- package/dist/parser-keywords.d.ts +5 -0
- package/dist/parser-keywords.js +203 -0
- package/dist/parser-keywords.js.map +1 -0
- package/dist/parser-style.d.ts +3 -0
- package/dist/parser-style.js +73 -0
- package/dist/parser-style.js.map +1 -0
- package/dist/parser-token-stream.d.ts +27 -0
- package/dist/parser-token-stream.js +81 -0
- package/dist/parser-token-stream.js.map +1 -0
- package/dist/parser-tokenizer.d.ts +11 -0
- package/dist/parser-tokenizer.js +188 -0
- package/dist/parser-tokenizer.js.map +1 -0
- package/dist/parser.d.ts +61 -14
- package/dist/parser.js +65 -865
- package/dist/parser.js.map +1 -1
- package/dist/scanner.js +85 -25
- package/dist/scanner.js.map +1 -1
- package/dist/schema.d.ts +7 -2
- package/dist/schema.js +7 -2
- package/dist/schema.js.map +1 -1
- package/dist/source-map.d.ts +27 -0
- package/dist/source-map.js +82 -0
- package/dist/source-map.js.map +1 -0
- package/dist/spec.d.ts +1 -1
- package/dist/spec.js +197 -55
- package/dist/spec.js.map +1 -1
- package/dist/styles-react.js +1 -1
- package/dist/styles-react.js.map +1 -1
- package/dist/styles-tailwind.d.ts +10 -0
- package/dist/styles-tailwind.js +62 -15
- package/dist/styles-tailwind.js.map +1 -1
- package/dist/template-catalog.js +1 -1
- package/dist/template-catalog.js.map +1 -1
- package/dist/template-engine.d.ts +11 -6
- package/dist/template-engine.js +20 -12
- package/dist/template-engine.js.map +1 -1
- package/dist/types.d.ts +8 -3
- package/dist/utils.d.ts +21 -1
- package/dist/utils.js +29 -5
- package/dist/utils.js.map +1 -1
- package/dist/version-adapters.js +1 -2
- package/dist/version-adapters.js.map +1 -1
- package/dist/version-detect.js +3 -3
- package/dist/version-detect.js.map +1 -1
- package/dist/walk.d.ts +40 -0
- package/dist/walk.js +111 -0
- package/dist/walk.js.map +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,46 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @kernlang/core — parser, types, spec, config, style engines, codegen
|
|
3
3
|
*/
|
|
4
|
-
// Runtime (instance-based state)
|
|
5
|
-
export { KernRuntime, defaultRuntime } from './runtime.js';
|
|
6
|
-
// Core
|
|
7
|
-
export { parse, parseDocument, parseWithDiagnostics, parseDocumentWithDiagnostics, parseStrict, parseDocumentStrict, getParseDiagnostics, registerParserHints, unregisterParserHints, clearParserHints, tokenizeLine } from './parser.js';
|
|
8
|
-
export { decompile } from './decompiler.js';
|
|
9
|
-
export { KernParseError } from './errors.js';
|
|
10
|
-
// Config
|
|
11
|
-
export { resolveConfig, mergeConfig, DEFAULT_CONFIG, VALID_TARGETS, VALID_STRUCTURES } from './config.js';
|
|
12
|
-
// Version detection & adapters
|
|
13
|
-
export { parseMajorVersion, detectVersionsFromPackageJson, resolveTailwindMajor, resolveNextjsMajor } from './version-detect.js';
|
|
14
|
-
export { buildTailwindProfile, buildNextjsProfile, buildVersionProfile, applyTailwindTokenRules, } from './version-adapters.js';
|
|
15
|
-
// Spec
|
|
16
|
-
export { KERN_VERSION, NODE_TYPES, STYLE_SHORTHANDS, VALUE_SHORTHANDS,
|
|
17
|
-
// Evolved types (v4)
|
|
18
|
-
registerEvolvedType, unregisterEvolvedType, isKnownNodeType, getEvolvedTypes, clearEvolvedTypes, KERN_RESERVED, } from './spec.js';
|
|
19
|
-
// Schema validation
|
|
20
|
-
export { validateSchema, NODE_SCHEMAS } from './schema.js';
|
|
21
|
-
// Style engines
|
|
22
|
-
export { stylesToTailwind, colorToTw, pxToTw, DEFAULT_COLORS } from './styles-tailwind.js';
|
|
23
|
-
export { expandStyles, expandStyleKey, expandStyleValue } from './styles-react.js';
|
|
24
4
|
// Codegen — public entry points
|
|
25
|
-
export {
|
|
5
|
+
export { CORE_NODE_TYPES, capitalize, clearEvolvedGenerators, cssPropertyName, dedent,
|
|
26
6
|
// Safe emitters (prompt-injection immunity)
|
|
27
|
-
emitIdentifier,
|
|
7
|
+
emitIdentifier, emitImportSpecifier, emitLowConfidenceTodo, emitPath, emitReasonAnnotations, emitStringLiteral, emitTemplateSafe, emitTypeAnnotation, exportPrefix, generateCoreNode, generateMachineReducer, getChildren, getFirstChild,
|
|
28
8
|
// Shared IR node helpers (used by transpiler packages)
|
|
29
|
-
getProps,
|
|
9
|
+
getProps, getPseudoStyles, getStyles, getThemeRefs, handlerCode, hasEvolvedGenerator, isCoreNode, mapSemanticType, parseParamList,
|
|
30
10
|
// Evolved generators — prefer KernRuntime for new code
|
|
31
|
-
registerEvolvedGenerator, registerEvolvedTargetGenerator,
|
|
32
|
-
// Codegen errors
|
|
33
|
-
export { KernCodegenError } from './errors.js';
|
|
34
|
-
// Template engine
|
|
35
|
-
export { registerTemplate, isTemplateNode, expandTemplateNode, clearTemplates, getTemplate, templateCount, KernTemplateError, } from './template-engine.js';
|
|
36
|
-
// Coverage gap emitter (v3)
|
|
37
|
-
export { collectCoverageGaps, writeCoverageGaps, readCoverageGaps } from './coverage-gap.js';
|
|
38
|
-
// Template catalog
|
|
39
|
-
export { TEMPLATE_CATALOG, COMMON_TEMPLATES, detectTemplates } from './template-catalog.js';
|
|
40
|
-
// Scanner
|
|
41
|
-
export { scanProject, generateConfigSource, formatScanSummary } from './scanner.js';
|
|
11
|
+
registerEvolvedGenerator, registerEvolvedTargetGenerator, SEMANTIC_TYPE_MAP, sourceComment, unregisterEvolvedGenerator, } from './codegen-core.js';
|
|
42
12
|
// Concepts (universal cross-language review model)
|
|
43
13
|
export { conceptId, conceptSpan } from './concepts.js';
|
|
14
|
+
// Config
|
|
15
|
+
export { DEFAULT_CONFIG, mergeConfig, resolveConfig, VALID_STRUCTURES, VALID_TARGETS } from './config.js';
|
|
16
|
+
// Coverage gap emitter (v3)
|
|
17
|
+
export { collectCoverageGaps, readCoverageGaps, writeCoverageGaps } from './coverage-gap.js';
|
|
18
|
+
export { decompile } from './decompiler.js';
|
|
19
|
+
// Codegen errors
|
|
20
|
+
export { KernCodegenError, KernConfigError, KernParseError } from './errors.js';
|
|
21
|
+
// Typed node props
|
|
22
|
+
export { propsOf, propsUntyped } from './node-props.js';
|
|
23
|
+
// Core
|
|
24
|
+
export { clearParserHints, getParseDiagnostics, getParseWarnings, parse, parseDocument, parseDocumentStrict, parseDocumentWithDiagnostics, parseStrict, parseWithDiagnostics, registerParserHints, tokenizeLine, unregisterParserHints, } from './parser.js';
|
|
25
|
+
// Runtime (instance-based state)
|
|
26
|
+
export { defaultRuntime, KernRuntime } from './runtime.js';
|
|
27
|
+
// Scanner
|
|
28
|
+
export { formatScanSummary, generateConfigSource, scanProject } from './scanner.js';
|
|
29
|
+
// Schema validation
|
|
30
|
+
export { NODE_SCHEMAS, validateSchema } from './schema.js';
|
|
31
|
+
// Source map serialization
|
|
32
|
+
export { serializeSourceMap } from './source-map.js';
|
|
33
|
+
// Spec
|
|
34
|
+
export { clearEvolvedTypes, getEvolvedTypes, isKnownNodeType, KERN_RESERVED, KERN_VERSION, NODE_TYPES,
|
|
35
|
+
// Evolved types (v4)
|
|
36
|
+
registerEvolvedType, STYLE_SHORTHANDS, unregisterEvolvedType, VALUE_SHORTHANDS, } from './spec.js';
|
|
37
|
+
export { expandStyleKey, expandStyles, expandStyleValue } from './styles-react.js';
|
|
38
|
+
// Style engines
|
|
39
|
+
export { colorToTw, DEFAULT_COLORS, pxToTw, stylesToTailwind } from './styles-tailwind.js';
|
|
40
|
+
// Template catalog
|
|
41
|
+
export { COMMON_TEMPLATES, detectTemplates, TEMPLATE_CATALOG } from './template-catalog.js';
|
|
42
|
+
// Template engine
|
|
43
|
+
export { clearTemplates, expandTemplateNode, getTemplate, isTemplateNode, KernTemplateError, registerTemplate, templateCount, } from './template-engine.js';
|
|
44
44
|
// Utilities
|
|
45
|
-
export {
|
|
45
|
+
export { accountNode, buildDiagnostics, camelKey, countTokens, escapeJsString, escapeJsx, escapeJsxAttr, escapeJsxText, serializeIR, } from './utils.js';
|
|
46
|
+
export { applyTailwindTokenRules, buildNextjsProfile, buildTailwindProfile, buildVersionProfile, } from './version-adapters.js';
|
|
47
|
+
// Version detection & adapters
|
|
48
|
+
export { detectVersionsFromPackageJson, parseMajorVersion, resolveNextjsMajor, resolveTailwindMajor, } from './version-detect.js';
|
|
49
|
+
// Walker
|
|
50
|
+
export { getNodeAtPosition, walkIR } from './walk.js';
|
|
46
51
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed prop interfaces for known IR node types.
|
|
3
|
+
*
|
|
4
|
+
* Each interface captures the props that generators actually access
|
|
5
|
+
* for a given node type. Unknown/evolved types fall back to Record<string, unknown>.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const props = propsOf<'fn'>(node);
|
|
9
|
+
* props.name // string | undefined (no cast needed)
|
|
10
|
+
* props.params // string | undefined
|
|
11
|
+
*/
|
|
12
|
+
import type { IRNode } from './types.js';
|
|
13
|
+
interface BaseProps {
|
|
14
|
+
name?: string;
|
|
15
|
+
export?: string | boolean;
|
|
16
|
+
confidence?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface TypeProps extends BaseProps {
|
|
19
|
+
values?: string;
|
|
20
|
+
alias?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface InterfaceProps extends BaseProps {
|
|
23
|
+
extends?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface UnionProps extends BaseProps {
|
|
26
|
+
discriminant?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ServiceProps extends BaseProps {
|
|
29
|
+
implements?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ConstProps extends BaseProps {
|
|
32
|
+
type?: string;
|
|
33
|
+
value?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface FnProps extends BaseProps {
|
|
36
|
+
params?: string;
|
|
37
|
+
returns?: string;
|
|
38
|
+
async?: string | boolean;
|
|
39
|
+
stream?: string | boolean;
|
|
40
|
+
generator?: string | boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface ErrorProps extends BaseProps {
|
|
43
|
+
extends?: string;
|
|
44
|
+
message?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface MachineProps extends BaseProps {
|
|
47
|
+
initial?: string | boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface ConfigProps extends BaseProps {
|
|
50
|
+
}
|
|
51
|
+
export interface StoreProps extends BaseProps {
|
|
52
|
+
path?: string;
|
|
53
|
+
key?: string;
|
|
54
|
+
model?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface RepositoryProps extends BaseProps {
|
|
57
|
+
model?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface CacheProps extends BaseProps {
|
|
60
|
+
backend?: string;
|
|
61
|
+
prefix?: string;
|
|
62
|
+
ttl?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface DependencyProps extends BaseProps {
|
|
65
|
+
scope?: string;
|
|
66
|
+
factory?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface ModelProps extends BaseProps {
|
|
69
|
+
table?: string;
|
|
70
|
+
extends?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface EventProps extends BaseProps {
|
|
73
|
+
payload?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface OnProps extends BaseProps {
|
|
76
|
+
handler?: string;
|
|
77
|
+
key?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface WebSocketProps extends BaseProps {
|
|
80
|
+
url?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface DeriveProps extends BaseProps {
|
|
83
|
+
expr?: string;
|
|
84
|
+
type?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface TransformProps extends BaseProps {
|
|
87
|
+
target?: string;
|
|
88
|
+
via?: string;
|
|
89
|
+
type?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface ActionProps extends BaseProps {
|
|
92
|
+
params?: string;
|
|
93
|
+
returns?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface GuardProps extends BaseProps {
|
|
96
|
+
when?: string;
|
|
97
|
+
message?: string;
|
|
98
|
+
}
|
|
99
|
+
export interface AssumeProps extends BaseProps {
|
|
100
|
+
expr?: string;
|
|
101
|
+
message?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface InvariantProps extends BaseProps {
|
|
104
|
+
expr?: string;
|
|
105
|
+
message?: string;
|
|
106
|
+
}
|
|
107
|
+
export interface EachProps extends BaseProps {
|
|
108
|
+
in?: string;
|
|
109
|
+
index?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface CollectProps extends BaseProps {
|
|
112
|
+
from?: string;
|
|
113
|
+
where?: string;
|
|
114
|
+
limit?: string;
|
|
115
|
+
order?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface BranchProps extends BaseProps {
|
|
118
|
+
on?: string;
|
|
119
|
+
}
|
|
120
|
+
export interface ResolveProps extends BaseProps {
|
|
121
|
+
}
|
|
122
|
+
export interface ExpectProps extends BaseProps {
|
|
123
|
+
expr?: string;
|
|
124
|
+
within?: string;
|
|
125
|
+
max?: string;
|
|
126
|
+
min?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface RecoverProps extends BaseProps {
|
|
129
|
+
}
|
|
130
|
+
export interface PatternProps extends BaseProps {
|
|
131
|
+
pattern?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface ConditionalProps extends BaseProps {
|
|
134
|
+
if?: string | import('./types.js').ExprObject;
|
|
135
|
+
}
|
|
136
|
+
export interface SelectProps extends BaseProps {
|
|
137
|
+
value?: string;
|
|
138
|
+
placeholder?: string;
|
|
139
|
+
onChange?: string;
|
|
140
|
+
}
|
|
141
|
+
export interface ModuleProps extends BaseProps {
|
|
142
|
+
}
|
|
143
|
+
export interface ImportProps extends BaseProps {
|
|
144
|
+
from?: string;
|
|
145
|
+
names?: string;
|
|
146
|
+
types?: string | boolean;
|
|
147
|
+
default?: string;
|
|
148
|
+
}
|
|
149
|
+
export interface FieldProps extends BaseProps {
|
|
150
|
+
type?: string;
|
|
151
|
+
optional?: string | boolean;
|
|
152
|
+
default?: string;
|
|
153
|
+
private?: string | boolean;
|
|
154
|
+
}
|
|
155
|
+
export interface VariantProps extends BaseProps {
|
|
156
|
+
}
|
|
157
|
+
export interface MethodProps extends BaseProps {
|
|
158
|
+
params?: string;
|
|
159
|
+
returns?: string;
|
|
160
|
+
}
|
|
161
|
+
export interface TransitionProps extends BaseProps {
|
|
162
|
+
from?: string;
|
|
163
|
+
to?: string;
|
|
164
|
+
}
|
|
165
|
+
export interface StateProps extends BaseProps {
|
|
166
|
+
value?: string;
|
|
167
|
+
initial?: string | boolean;
|
|
168
|
+
}
|
|
169
|
+
export interface ColumnProps extends BaseProps {
|
|
170
|
+
type?: string;
|
|
171
|
+
primary?: string | boolean;
|
|
172
|
+
unique?: string | boolean;
|
|
173
|
+
nullable?: string | boolean;
|
|
174
|
+
default?: string;
|
|
175
|
+
optional?: string | boolean;
|
|
176
|
+
}
|
|
177
|
+
export interface RelationProps extends BaseProps {
|
|
178
|
+
type?: string;
|
|
179
|
+
model?: string;
|
|
180
|
+
foreignKey?: string;
|
|
181
|
+
target?: string;
|
|
182
|
+
kind?: string;
|
|
183
|
+
}
|
|
184
|
+
export interface OptionProps extends BaseProps {
|
|
185
|
+
value?: string;
|
|
186
|
+
label?: string;
|
|
187
|
+
}
|
|
188
|
+
export interface TestProps extends BaseProps {
|
|
189
|
+
suite?: string;
|
|
190
|
+
}
|
|
191
|
+
/** Maps known node types to their typed prop interface. */
|
|
192
|
+
export interface NodePropsMap {
|
|
193
|
+
type: TypeProps;
|
|
194
|
+
interface: InterfaceProps;
|
|
195
|
+
union: UnionProps;
|
|
196
|
+
service: ServiceProps;
|
|
197
|
+
const: ConstProps;
|
|
198
|
+
fn: FnProps;
|
|
199
|
+
error: ErrorProps;
|
|
200
|
+
machine: MachineProps;
|
|
201
|
+
config: ConfigProps;
|
|
202
|
+
store: StoreProps;
|
|
203
|
+
repository: RepositoryProps;
|
|
204
|
+
cache: CacheProps;
|
|
205
|
+
dependency: DependencyProps;
|
|
206
|
+
model: ModelProps;
|
|
207
|
+
event: EventProps;
|
|
208
|
+
on: OnProps;
|
|
209
|
+
websocket: WebSocketProps;
|
|
210
|
+
derive: DeriveProps;
|
|
211
|
+
transform: TransformProps;
|
|
212
|
+
action: ActionProps;
|
|
213
|
+
guard: GuardProps;
|
|
214
|
+
assume: AssumeProps;
|
|
215
|
+
invariant: InvariantProps;
|
|
216
|
+
each: EachProps;
|
|
217
|
+
collect: CollectProps;
|
|
218
|
+
branch: BranchProps;
|
|
219
|
+
resolve: ResolveProps;
|
|
220
|
+
expect: ExpectProps;
|
|
221
|
+
recover: RecoverProps;
|
|
222
|
+
pattern: PatternProps;
|
|
223
|
+
conditional: ConditionalProps;
|
|
224
|
+
select: SelectProps;
|
|
225
|
+
module: ModuleProps;
|
|
226
|
+
import: ImportProps;
|
|
227
|
+
field: FieldProps;
|
|
228
|
+
variant: VariantProps;
|
|
229
|
+
method: MethodProps;
|
|
230
|
+
transition: TransitionProps;
|
|
231
|
+
state: StateProps;
|
|
232
|
+
column: ColumnProps;
|
|
233
|
+
relation: RelationProps;
|
|
234
|
+
option: OptionProps;
|
|
235
|
+
test: TestProps;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Get typed props for a known node type. Falls back to `Record<string, unknown>`
|
|
239
|
+
* for custom/evolved types not in the map.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* const props = propsOf<'fn'>(node);
|
|
244
|
+
* props.name // string | undefined
|
|
245
|
+
* props.params // string | undefined
|
|
246
|
+
* props.returns // string | undefined
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
export declare function propsOf<T extends keyof NodePropsMap>(node: IRNode): NodePropsMap[T];
|
|
250
|
+
/**
|
|
251
|
+
* Get props as a generic record — for custom/evolved types or when the
|
|
252
|
+
* node type isn't known at compile time.
|
|
253
|
+
*/
|
|
254
|
+
export declare function propsUntyped(node: IRNode): Record<string, unknown>;
|
|
255
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed prop interfaces for known IR node types.
|
|
3
|
+
*
|
|
4
|
+
* Each interface captures the props that generators actually access
|
|
5
|
+
* for a given node type. Unknown/evolved types fall back to Record<string, unknown>.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const props = propsOf<'fn'>(node);
|
|
9
|
+
* props.name // string | undefined (no cast needed)
|
|
10
|
+
* props.params // string | undefined
|
|
11
|
+
*/
|
|
12
|
+
// ── Helper ──────────────────────────────────────────────────────────────
|
|
13
|
+
/**
|
|
14
|
+
* Get typed props for a known node type. Falls back to `Record<string, unknown>`
|
|
15
|
+
* for custom/evolved types not in the map.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const props = propsOf<'fn'>(node);
|
|
20
|
+
* props.name // string | undefined
|
|
21
|
+
* props.params // string | undefined
|
|
22
|
+
* props.returns // string | undefined
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function propsOf(node) {
|
|
26
|
+
return (node.props || {});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get props as a generic record — for custom/evolved types or when the
|
|
30
|
+
* node type isn't known at compile time.
|
|
31
|
+
*/
|
|
32
|
+
export function propsUntyped(node) {
|
|
33
|
+
return (node.props || {});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=node-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-props.js","sourceRoot":"","sources":["../src/node-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAoSH,2EAA2E;AAE3E;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,OAAO,CAA+B,IAAY;IAChE,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAoB,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAA4B,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** @internal Core parser pipeline — line parsing, tree building, and orchestration. */
|
|
2
|
+
import { type KernRuntime } from './runtime.js';
|
|
3
|
+
import type { ParseResult } from './types.js';
|
|
4
|
+
/** @internal Single internal entry that wires parseLines → buildTree → computeEndSpans. */
|
|
5
|
+
export declare function parseInternal(source: string, asDocument: boolean, runtime?: KernRuntime): ParseResult;
|