@kernlang/core 3.1.1 → 3.1.3

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/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # @kernlang/core
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@kernlang/core?color=cb3837&label=npm)](https://www.npmjs.com/package/@kernlang/core)
4
+ [![license](https://img.shields.io/badge/license-AGPL--3.0-blue)](https://github.com/KERNlang/kern/blob/main/LICENSE)
5
+
3
6
  Kern core — parser, types, spec, config, style engines, codegen
4
7
 
5
8
  Part of the [KERN monorepo](https://github.com/KERNlang/kern).
@@ -7,6 +7,14 @@
7
7
  * Machine nodes are KERN's killer feature: 12 lines of KERN → 140+ lines of TS.
8
8
  */
9
9
  import type { IRNode } from './types.js';
10
+ /** Validate and emit a safe identifier for generated code. Throws on invalid. */
11
+ export declare function emitIdentifier(value: string | undefined, fallback: string, node?: IRNode): string;
12
+ /** Escape a string for safe interpolation into a single-quoted JS string literal. */
13
+ export declare function emitStringLiteral(value: string): string;
14
+ /** Validate and emit a safe filesystem path for generated code. */
15
+ export declare function emitPath(value: string, node?: IRNode): string;
16
+ /** Escape a value for interpolation into a template literal in generated code. */
17
+ export declare function emitTemplateSafe(value: string): string;
10
18
  /** Register an evolved generator (called at startup). */
11
19
  export declare function registerEvolvedGenerator(keyword: string, fn: (node: IRNode) => string[]): void;
12
20
  /** Register a target-specific evolved generator (called at startup). */
@@ -35,6 +43,7 @@ export declare function dedent(code: string): string;
35
43
  export declare function cssPropertyName(camel: string): string;
36
44
  /** Extract handler code from a node (finds handler child, dedents). */
37
45
  export declare function handlerCode(node: IRNode): string;
46
+ export declare function exportPrefix(node: IRNode): string;
38
47
  export declare function generateType(node: IRNode): string[];
39
48
  export declare function generateInterface(node: IRNode): string[];
40
49
  export declare function generateUnion(node: IRNode): string[];
@@ -56,7 +65,6 @@ export declare function generateConst(node: IRNode): string[];
56
65
  * Supports default values via = after the type. */
57
66
  export declare function parseParamList(params: string): string;
58
67
  export declare function capitalize(s: string): string;
59
- export declare function generateHook(node: IRNode): string[];
60
68
  export declare function emitReasonAnnotations(node: IRNode): string[];
61
69
  /** Emit a TODO comment for nodes with low literal confidence (< 0.5). */
62
70
  export declare function emitLowConfidenceTodo(node: IRNode, confidence: string | undefined): string[];
@@ -73,7 +81,7 @@ export declare function generateResolve(node: IRNode): string[];
73
81
  export declare function generateExpect(node: IRNode): string[];
74
82
  export declare function generateRecover(node: IRNode): string[];
75
83
  export declare function generatePattern(node: IRNode): string[];
76
- export declare function generateApply(node: IRNode): string[];
84
+ export declare function generateApply(node: IRNode, _depth?: number): string[];
77
85
  export declare function generateConditional(node: IRNode): string[];
78
86
  export declare function generateSelect(node: IRNode): string[];
79
87
  export declare function generateModel(node: IRNode): string[];