@rcrsr/rill 0.7.2 → 0.8.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.
Files changed (107) hide show
  1. package/README.md +29 -1
  2. package/dist/ast-nodes.d.ts +635 -0
  3. package/dist/ast-nodes.d.ts.map +1 -0
  4. package/dist/ast-nodes.js +2 -0
  5. package/dist/ast-nodes.js.map +1 -0
  6. package/dist/ast-unions.d.ts +6 -0
  7. package/dist/ast-unions.d.ts.map +1 -0
  8. package/dist/ast-unions.js +6 -0
  9. package/dist/ast-unions.js.map +1 -0
  10. package/dist/error-classes.d.ts +90 -0
  11. package/dist/error-classes.d.ts.map +1 -0
  12. package/dist/error-classes.js +185 -0
  13. package/dist/error-classes.js.map +1 -0
  14. package/dist/error-registry.d.ts +93 -0
  15. package/dist/error-registry.d.ts.map +1 -0
  16. package/dist/error-registry.js +876 -0
  17. package/dist/error-registry.js.map +1 -0
  18. package/dist/ext/crypto/index.d.ts +32 -0
  19. package/dist/ext/crypto/index.d.ts.map +1 -0
  20. package/dist/ext/crypto/index.js +143 -0
  21. package/dist/ext/crypto/index.js.map +1 -0
  22. package/dist/ext/exec/index.d.ts +45 -0
  23. package/dist/ext/exec/index.d.ts.map +1 -0
  24. package/dist/ext/exec/index.js +168 -0
  25. package/dist/ext/exec/index.js.map +1 -0
  26. package/dist/ext/exec/runner.d.ts +62 -0
  27. package/dist/ext/exec/runner.d.ts.map +1 -0
  28. package/dist/ext/exec/runner.js +168 -0
  29. package/dist/ext/exec/runner.js.map +1 -0
  30. package/dist/ext/fetch/index.d.ts +68 -0
  31. package/dist/ext/fetch/index.d.ts.map +1 -0
  32. package/dist/ext/fetch/index.js +259 -0
  33. package/dist/ext/fetch/index.js.map +1 -0
  34. package/dist/ext/fetch/request.d.ts +90 -0
  35. package/dist/ext/fetch/request.d.ts.map +1 -0
  36. package/dist/ext/fetch/request.js +413 -0
  37. package/dist/ext/fetch/request.js.map +1 -0
  38. package/dist/ext/fs/index.d.ts +39 -0
  39. package/dist/ext/fs/index.d.ts.map +1 -0
  40. package/dist/ext/fs/index.js +560 -0
  41. package/dist/ext/fs/index.js.map +1 -0
  42. package/dist/ext/fs/sandbox.d.ts +78 -0
  43. package/dist/ext/fs/sandbox.d.ts.map +1 -0
  44. package/dist/ext/fs/sandbox.js +208 -0
  45. package/dist/ext/fs/sandbox.js.map +1 -0
  46. package/dist/ext/kv/index.d.ts +46 -0
  47. package/dist/ext/kv/index.d.ts.map +1 -0
  48. package/dist/ext/kv/index.js +215 -0
  49. package/dist/ext/kv/index.js.map +1 -0
  50. package/dist/ext/kv/store.d.ts +46 -0
  51. package/dist/ext/kv/store.d.ts.map +1 -0
  52. package/dist/ext/kv/store.js +256 -0
  53. package/dist/ext/kv/store.js.map +1 -0
  54. package/dist/generated/introspection-data.d.ts +1 -1
  55. package/dist/generated/introspection-data.d.ts.map +1 -1
  56. package/dist/generated/introspection-data.js +509 -481
  57. package/dist/generated/introspection-data.js.map +1 -1
  58. package/dist/generated/version-data.d.ts +1 -1
  59. package/dist/generated/version-data.js +3 -3
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/index.js.map +1 -1
  64. package/dist/runtime/core/callable.d.ts +5 -5
  65. package/dist/runtime/core/callable.d.ts.map +1 -1
  66. package/dist/runtime/core/callable.js +2 -1
  67. package/dist/runtime/core/callable.js.map +1 -1
  68. package/dist/runtime/core/eval/mixins/collections.d.ts.map +1 -1
  69. package/dist/runtime/core/eval/mixins/collections.js +5 -1
  70. package/dist/runtime/core/eval/mixins/collections.js.map +1 -1
  71. package/dist/runtime/core/eval/mixins/literals.d.ts.map +1 -1
  72. package/dist/runtime/core/eval/mixins/literals.js +5 -1
  73. package/dist/runtime/core/eval/mixins/literals.js.map +1 -1
  74. package/dist/runtime/core/eval/mixins/variables.js +12 -12
  75. package/dist/runtime/core/eval/mixins/variables.js.map +1 -1
  76. package/dist/runtime/core/values.d.ts +31 -3
  77. package/dist/runtime/core/values.d.ts.map +1 -1
  78. package/dist/runtime/core/values.js +47 -1
  79. package/dist/runtime/core/values.js.map +1 -1
  80. package/dist/runtime/ext/builtins.d.ts.map +1 -1
  81. package/dist/runtime/ext/builtins.js +202 -1
  82. package/dist/runtime/ext/builtins.js.map +1 -1
  83. package/dist/runtime/ext/extensions.d.ts +39 -3
  84. package/dist/runtime/ext/extensions.d.ts.map +1 -1
  85. package/dist/runtime/ext/extensions.js +77 -12
  86. package/dist/runtime/ext/extensions.js.map +1 -1
  87. package/dist/runtime/index.d.ts +5 -5
  88. package/dist/runtime/index.d.ts.map +1 -1
  89. package/dist/runtime/index.js +2 -2
  90. package/dist/runtime/index.js.map +1 -1
  91. package/dist/source-location.d.ts +10 -0
  92. package/dist/source-location.d.ts.map +1 -0
  93. package/dist/source-location.js +5 -0
  94. package/dist/source-location.js.map +1 -0
  95. package/dist/token-types.d.ts +68 -0
  96. package/dist/token-types.d.ts.map +1 -0
  97. package/dist/token-types.js +79 -0
  98. package/dist/token-types.js.map +1 -0
  99. package/dist/types.d.ts +9 -882
  100. package/dist/types.d.ts.map +1 -1
  101. package/dist/types.js +8 -958
  102. package/dist/types.js.map +1 -1
  103. package/dist/value-types.d.ts +3 -0
  104. package/dist/value-types.d.ts.map +1 -0
  105. package/dist/value-types.js +2 -0
  106. package/dist/value-types.js.map +1 -0
  107. package/package.json +50 -11
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-nodes.d.ts","sourceRoot":"","sources":["../src/ast-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,UAAU,QAAQ;IAChB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAMD,MAAM,WAAW,UAAW,SAAQ,QAAQ;IAC1C,QAAQ,CAAC,IAAI,EAAE,Q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Z,eAAe,GACf,aAAa,GACb,eAAe,GACf,SAAS,GACT,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,GACf,SAAS,GACT,cAAc,GACd,QAAQ,GACR,aAAa,GACb,cAAc,GACd,aAAa,GACb,eAAe,GACf,gBAAgB,GAChB,eAAe,GACf,mBAAmB,GACnB,SAAS,GACT,UAAU,GACV,iBAAiB,GACjB,aAAa,GACb,sBAAsB,GACtB,YAAY,GACZ,aAAa,GACb,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,cAAc,GACd,iBAAiB,GACjB,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ast-nodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-nodes.js","sourceRoot":"","sources":["../src/ast-nodes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * AST Type Unions
3
+ * String union of all AST node type literals.
4
+ */
5
+ export type NodeType = 'Script' | 'Frontmatter' | 'Closure' | 'ClosureParam' | 'Statement' | 'PipeChain' | 'PostfixExpr' | 'MethodCall' | 'Invoke' | 'HostCall' | 'ClosureCall' | 'PipeInvoke' | 'Variable' | 'Capture' | 'Conditional' | 'WhileLoop' | 'DoWhileLoop' | 'Block' | 'StringLiteral' | 'Interpolation' | 'NumberLiteral' | 'BoolLiteral' | 'Tuple' | 'ListSpread' | 'Dict' | 'DictEntry' | 'Break' | 'Return' | 'Pass' | 'Assert' | 'BinaryExpr' | 'UnaryExpr' | 'InnerExpr' | 'GroupedExpr' | 'ClosureChain' | 'Destructure' | 'DestructPattern' | 'Slice' | 'Enumerate' | 'Spread' | 'TypeAssertion' | 'TypeCheck' | 'AnnotatedStatement' | 'NamedArg' | 'SpreadArg' | 'EachExpr' | 'MapExpr' | 'FoldExpr' | 'FilterExpr' | 'RecoveryError' | 'Error';
6
+ //# sourceMappingURL=ast-unions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-unions.d.ts","sourceRoot":"","sources":["../src/ast-unions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,MAAM,QAAQ,GAChB,QAAQ,GACR,aAAa,GACb,SAAS,GACT,cAAc,GACd,WAAW,GACX,WAAW,GACX,aAAa,GACb,YAAY,GACZ,QAAQ,GACR,UAAU,GACV,aAAa,GACb,YAAY,GACZ,UAAU,GACV,SAAS,GACT,aAAa,GACb,WAAW,GACX,aAAa,GACb,OAAO,GACP,eAAe,GACf,eAAe,GACf,eAAe,GACf,aAAa,GACb,OAAO,GACP,YAAY,GACZ,MAAM,GACN,WAAW,GACX,OAAO,GACP,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,YAAY,GACZ,WAAW,GACX,WAAW,GACX,aAAa,GACb,cAAc,GACd,aAAa,GACb,iBAAiB,GACjB,OAAO,GACP,WAAW,GACX,QAAQ,GACR,eAAe,GACf,WAAW,GACX,oBAAoB,GACpB,UAAU,GACV,WAAW,GACX,UAAU,GACV,SAAS,GACT,UAAU,GACV,YAAY,GACZ,eAAe,GACf,OAAO,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * AST Type Unions
3
+ * String union of all AST node type literals.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=ast-unions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-unions.js","sourceRoot":"","sources":["../src/ast-unions.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Rill Error Classes and Factory
3
+ * Structured error types with registry-based error codes
4
+ */
5
+ import type { SourceLocation, SourceSpan } from './source-location.js';
6
+ /**
7
+ * Call stack frame information for error reporting.
8
+ * Represents a single frame in the call stack with location and context.
9
+ */
10
+ export interface CallFrame {
11
+ /** Source location of the call */
12
+ readonly location: SourceSpan;
13
+ /** Name of the function (closure or host function) */
14
+ readonly functionName?: string | undefined;
15
+ /** Additional context (e.g., "in each body") */
16
+ readonly context?: string | undefined;
17
+ }
18
+ /** Structured error data for host applications */
19
+ export interface RillErrorData {
20
+ readonly errorId: string;
21
+ readonly helpUrl?: string | undefined;
22
+ readonly message: string;
23
+ readonly location?: SourceLocation | undefined;
24
+ readonly context?: Record<string, unknown> | undefined;
25
+ }
26
+ /**
27
+ * Factory function for creating errors from registry.
28
+ *
29
+ * Looks up error definition from registry, renders message template with context,
30
+ * and creates RillError with structured metadata.
31
+ *
32
+ * @param errorId - Error identifier (format: RILL-{category}{3-digit})
33
+ * @param context - Key-value pairs for template placeholder replacement
34
+ * @param location - Source location where error occurred (optional)
35
+ * @returns RillError instance with rendered message
36
+ * @throws TypeError if errorId is not found in registry
37
+ *
38
+ * @example
39
+ * createError("RILL-R005", { name: "foo" }, location)
40
+ * // Creates RuntimeError: "Variable foo is not defined at 1:5"
41
+ *
42
+ * @example
43
+ * createError("RILL-X999", {})
44
+ * // Throws: TypeError("Unknown error ID: RILL-X999")
45
+ */
46
+ export declare function createError(errorId: string, context: Record<string, unknown>, location?: SourceLocation | undefined): RillError;
47
+ /**
48
+ * Base error class for all Rill errors.
49
+ * Provides structured data for host applications to format as needed.
50
+ */
51
+ export declare class RillError extends Error {
52
+ readonly errorId: string;
53
+ readonly helpUrl: string | undefined;
54
+ readonly location?: SourceLocation | undefined;
55
+ readonly context?: Record<string, unknown> | undefined;
56
+ constructor(data: RillErrorData);
57
+ /** Get structured error data for custom formatting */
58
+ toData(): RillErrorData;
59
+ /** Format error for display (can be overridden by host) */
60
+ format(formatter?: (data: RillErrorData) => string): string;
61
+ }
62
+ /** Parse-time errors */
63
+ export declare class ParseError extends RillError {
64
+ constructor(errorId: string, message: string, location: SourceLocation, context?: Record<string, unknown>);
65
+ }
66
+ /** Runtime execution errors */
67
+ export declare class RuntimeError extends RillError {
68
+ constructor(errorId: string, message: string, location?: SourceLocation, context?: Record<string, unknown>);
69
+ /** Create from an AST node */
70
+ static fromNode(errorId: string, message: string, node?: {
71
+ span: SourceSpan;
72
+ }, context?: Record<string, unknown>): RuntimeError;
73
+ }
74
+ /** Timeout errors */
75
+ export declare class TimeoutError extends RuntimeError {
76
+ readonly functionName: string;
77
+ readonly timeoutMs: number;
78
+ constructor(functionName: string, timeoutMs: number, location?: SourceLocation);
79
+ }
80
+ /** Auto-exception errors (when $_ matches a pattern) */
81
+ export declare class AutoExceptionError extends RuntimeError {
82
+ readonly pattern: string;
83
+ readonly matchedValue: string;
84
+ constructor(pattern: string, matchedValue: string, location?: SourceLocation);
85
+ }
86
+ /** Abort errors (when execution is cancelled via AbortSignal) */
87
+ export declare class AbortError extends RuntimeError {
88
+ constructor(location?: SourceLocation);
89
+ }
90
+ //# sourceMappingURL=error-classes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-classes.d.ts","sourceRoot":"","sources":["../src/error-classes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAQvE;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,kCAAkC;IAClC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,sDAAsD;IACtD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,gDAAgD;IAChD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAMD,kDAAkD;AAClD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CACxD;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,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AAED,qBAAqB;AACrB,qBAAa,YAAa,SAAQ,YAAY;IAC5C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAGzB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,cAAc;CAY5B;AAED,wDAAwD;AACxD,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;gBAG5B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,cAAc;CAY5B;AAED,iEAAiE;AACjE,qBAAa,UAAW,SAAQ,YAAY;gBAC9B,QAAQ,CAAC,EAAE,cAAc;CAItC"}
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Rill Error Classes and Factory
3
+ * Structured error types with registry-based error codes
4
+ */
5
+ import { ERROR_REGISTRY, renderMessage, getHelpUrl } from './error-registry.js';
6
+ import { VERSION } from './generated/version-data.js';
7
+ // ============================================================
8
+ // ERROR FACTORY
9
+ // ============================================================
10
+ /**
11
+ * Factory function for creating errors from registry.
12
+ *
13
+ * Looks up error definition from registry, renders message template with context,
14
+ * and creates RillError with structured metadata.
15
+ *
16
+ * @param errorId - Error identifier (format: RILL-{category}{3-digit})
17
+ * @param context - Key-value pairs for template placeholder replacement
18
+ * @param location - Source location where error occurred (optional)
19
+ * @returns RillError instance with rendered message
20
+ * @throws TypeError if errorId is not found in registry
21
+ *
22
+ * @example
23
+ * createError("RILL-R005", { name: "foo" }, location)
24
+ * // Creates RuntimeError: "Variable foo is not defined at 1:5"
25
+ *
26
+ * @example
27
+ * createError("RILL-X999", {})
28
+ * // Throws: TypeError("Unknown error ID: RILL-X999")
29
+ */
30
+ export function createError(errorId, context, location) {
31
+ // Lookup error definition from registry (O(1))
32
+ const definition = ERROR_REGISTRY.get(errorId);
33
+ // EC-9: Unknown errorId -> Throws TypeError
34
+ if (!definition) {
35
+ throw new TypeError(`Unknown error ID: ${errorId}`);
36
+ }
37
+ // Render message from template + context (O(n) where n = template length)
38
+ // EC-10: Context value fails String() coercion -> Uses fallback "[object Object]"
39
+ // This is handled inside renderMessage via try-catch
40
+ const message = renderMessage(definition.messageTemplate, context);
41
+ // EC-11: Malformed location (missing line/column) -> Error created without location metadata
42
+ // We accept the location as-is; if it's malformed, the error won't have proper location data
43
+ // This is acceptable per spec - the error is still created, just without complete location info
44
+ // Compute helpUrl from errorId using VERSION constant
45
+ const helpUrl = getHelpUrl(errorId, VERSION);
46
+ // Create RillError with errorId, helpUrl, and rendered message
47
+ return new RillError({
48
+ errorId,
49
+ helpUrl: helpUrl || undefined, // Convert empty string to undefined
50
+ message,
51
+ location,
52
+ context,
53
+ });
54
+ }
55
+ // ============================================================
56
+ // BASE ERROR CLASS
57
+ // ============================================================
58
+ /**
59
+ * Base error class for all Rill errors.
60
+ * Provides structured data for host applications to format as needed.
61
+ */
62
+ export class RillError extends Error {
63
+ errorId;
64
+ helpUrl;
65
+ location;
66
+ context;
67
+ constructor(data) {
68
+ // EC-3: Missing errorId
69
+ if (!data.errorId) {
70
+ throw new TypeError('errorId is required');
71
+ }
72
+ // EC-4: Unknown errorId
73
+ if (!ERROR_REGISTRY.has(data.errorId)) {
74
+ throw new TypeError(`Unknown error ID: ${data.errorId}`);
75
+ }
76
+ const locationStr = data.location
77
+ ? ` at ${data.location.line}:${data.location.column}`
78
+ : '';
79
+ super(`${data.message}${locationStr}`);
80
+ this.name = 'RillError';
81
+ this.errorId = data.errorId;
82
+ this.helpUrl = data.helpUrl;
83
+ this.location = data.location;
84
+ this.context = data.context;
85
+ }
86
+ /** Get structured error data for custom formatting */
87
+ toData() {
88
+ return {
89
+ errorId: this.errorId,
90
+ helpUrl: this.helpUrl,
91
+ message: this.message.replace(/ at \d+:\d+$/, ''), // Strip location suffix
92
+ location: this.location,
93
+ context: this.context,
94
+ };
95
+ }
96
+ /** Format error for display (can be overridden by host) */
97
+ format(formatter) {
98
+ if (formatter)
99
+ return formatter(this.toData());
100
+ return this.message;
101
+ }
102
+ }
103
+ // ============================================================
104
+ // SPECIALIZED ERROR CLASSES
105
+ // ============================================================
106
+ /** Parse-time errors */
107
+ export class ParseError extends RillError {
108
+ constructor(errorId, message, location, context) {
109
+ // EC-7: Unknown errorId
110
+ const definition = ERROR_REGISTRY.get(errorId);
111
+ if (!definition) {
112
+ throw new TypeError(`Unknown error ID: ${errorId}`);
113
+ }
114
+ // EC-8: Wrong category
115
+ if (definition.category !== 'parse') {
116
+ throw new TypeError(`Expected parse error ID, got: ${errorId}`);
117
+ }
118
+ const helpUrl = getHelpUrl(errorId, VERSION);
119
+ super({
120
+ errorId,
121
+ helpUrl: helpUrl || undefined,
122
+ message,
123
+ location,
124
+ context,
125
+ });
126
+ this.name = 'ParseError';
127
+ }
128
+ }
129
+ /** Runtime execution errors */
130
+ export class RuntimeError extends RillError {
131
+ constructor(errorId, message, location, context) {
132
+ // Validate errorId exists in registry
133
+ const definition = ERROR_REGISTRY.get(errorId);
134
+ if (!definition) {
135
+ throw new TypeError(`Unknown error ID: ${errorId}`);
136
+ }
137
+ // Validate errorId is a runtime error
138
+ if (definition.category !== 'runtime') {
139
+ throw new TypeError(`Expected runtime error ID, got: ${errorId}`);
140
+ }
141
+ const helpUrl = getHelpUrl(errorId, VERSION);
142
+ super({
143
+ errorId,
144
+ helpUrl: helpUrl || undefined,
145
+ message,
146
+ location,
147
+ context,
148
+ });
149
+ this.name = 'RuntimeError';
150
+ }
151
+ /** Create from an AST node */
152
+ static fromNode(errorId, message, node, context) {
153
+ return new RuntimeError(errorId, message, node?.span.start, context);
154
+ }
155
+ }
156
+ /** Timeout errors */
157
+ export class TimeoutError extends RuntimeError {
158
+ functionName;
159
+ timeoutMs;
160
+ constructor(functionName, timeoutMs, location) {
161
+ super('RILL-R012', `Function '${functionName}' timed out after ${timeoutMs}ms`, location, { functionName, timeoutMs });
162
+ this.name = 'TimeoutError';
163
+ this.functionName = functionName;
164
+ this.timeoutMs = timeoutMs;
165
+ }
166
+ }
167
+ /** Auto-exception errors (when $_ matches a pattern) */
168
+ export class AutoExceptionError extends RuntimeError {
169
+ pattern;
170
+ matchedValue;
171
+ constructor(pattern, matchedValue, location) {
172
+ super('RILL-R014', `Auto-exception triggered: pattern '${pattern}' matched`, location, { pattern, matchedValue });
173
+ this.name = 'AutoExceptionError';
174
+ this.pattern = pattern;
175
+ this.matchedValue = matchedValue;
176
+ }
177
+ }
178
+ /** Abort errors (when execution is cancelled via AbortSignal) */
179
+ export class AbortError extends RuntimeError {
180
+ constructor(location) {
181
+ super('RILL-R013', 'Execution aborted', location, {});
182
+ this.name = 'AbortError';
183
+ }
184
+ }
185
+ //# sourceMappingURL=error-classes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-classes.js","sourceRoot":"","sources":["../src/error-classes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAgCtD,+DAA+D;AAC/D,gBAAgB;AAChB,+DAA+D;AAE/D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,WAAW,CACzB,OAAe,EACf,OAAgC,EAChC,QAAqC;IAErC,+CAA+C;IAC/C,MAAM,UAAU,GAAG,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAE/C,4CAA4C;IAC5C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,SAAS,CAAC,qBAAqB,OAAO,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,0EAA0E;IAC1E,kFAAkF;IAClF,qDAAqD;IACrD,MAAM,OAAO,GAAG,aAAa,CAAC,UAAU,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAEnE,6FAA6F;I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C;QAC3B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED,wDAAwD;AACxD,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IACzC,OAAO,CAAS;IAChB,YAAY,CAAS;IAE9B,YACE,OAAe,EACf,YAAoB,EACpB,QAAyB;QAEzB,KAAK,CACH,WAAW,EACX,sCAAsC,OAAO,WAAW,EACxD,QAAQ,EACR,EAAE,OAAO,EAAE,YAAY,EAAE,CAC1B,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAED,iEAAiE;AACjE,MAAM,OAAO,UAAW,SAAQ,YAAY;IAC1C,YAAY,QAAyB;QACnC,KAAK,CAAC,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Error Registry
3
+ * Central error definition registry with template rendering and help URL generation.
4
+ */
5
+ /** Error category determining error ID prefix */
6
+ export type ErrorCategory = 'lexer' | 'parse' | 'runtime' | 'check';
7
+ /** Error severity level */
8
+ export type ErrorSeverity = 'error' | 'warning';
9
+ /**
10
+ * Example demonstrating an error condition.
11
+ * Used in error documentation to show common scenarios.
12
+ */
13
+ export interface ErrorExample {
14
+ /** Description of the example scenario (max 100 characters) */
15
+ readonly description: string;
16
+ /** Example code demonstrating the error (max 500 characters) */
17
+ readonly code: string;
18
+ }
19
+ /** Error registry entry containing all metadata for a single error condition */
20
+ export interface ErrorDefinition {
21
+ /** Format: RILL-{category}{3-digit} (e.g., RILL-R001) */
22
+ readonly errorId: string;
23
+ /** Error category (determines ID prefix) */
24
+ readonly category: ErrorCategory;
25
+ /** Severity level (defaults to 'error' when omitted) */
26
+ readonly severity?: ErrorSeverity | undefined;
27
+ /** Human-readable description (max 50 characters) */
28
+ readonly description: string;
29
+ /** Message template with {placeholder} syntax */
30
+ readonly messageTemplate: string;
31
+ /** What causes this error (max 200 characters) */
32
+ readonly cause?: string | undefined;
33
+ /** How to resolve this error (max 300 characters) */
34
+ readonly resolution?: string | undefined;
35
+ /** Example scenarios demonstrating this error (max 3 entries) */
36
+ readonly examples?: ErrorExample[] | undefined;
37
+ }
38
+ /**
39
+ * Central registry for all error definitions with O(1) lookup.
40
+ * Immutable after initialization.
41
+ */
42
+ export interface ErrorRegistry {
43
+ get(errorId: string): ErrorDefinition | undefined;
44
+ has(errorId: string): boolean;
45
+ readonly size: number;
46
+ entries(): IterableIterator<[string, ErrorDefinition]>;
47
+ }
48
+ /**
49
+ * Global error registry instance.
50
+ * Read-only singleton initialized at module load.
51
+ */
52
+ export declare const ERROR_REGISTRY: ErrorRegistry;
53
+ /**
54
+ * Renders a message template by replacing placeholders with context values.
55
+ *
56
+ * Placeholder format: {varName}
57
+ * Missing context values render as empty string.
58
+ * Non-string values are coerced via String().
59
+ * Invalid templates (unclosed braces) return template unchanged.
60
+ *
61
+ * @param template - Template string with {placeholder} syntax
62
+ * @param context - Key-value pairs for placeholder replacement
63
+ * @returns Rendered message with placeholders replaced
64
+ *
65
+ * @example
66
+ * renderMessage("Expected {expected}, got {actual}", {expected: "string", actual: "number"})
67
+ * // Returns: "Expected string, got number"
68
+ *
69
+ * @example
70
+ * renderMessage("Hello {name}", {})
71
+ * // Returns: "Hello "
72
+ */
73
+ export declare function renderMessage(template: string, context: Record<string, unknown>): string;
74
+ /**
75
+ * Generates documentation URL for an error ID.
76
+ *
77
+ * Format: https://github.com/rcrsr/rill/blob/v{version}/docs/ref-errors.md#{errorId}
78
+ * Error ID is lowercased in anchor.
79
+ *
80
+ * @param errorId - Error identifier (format: RILL-{category}{3-digit}, e.g., RILL-R001)
81
+ * @param version - Semver version (format: X.Y.Z)
82
+ * @returns Documentation URL, or empty string if inputs are invalid
83
+ *
84
+ * @example
85
+ * getHelpUrl("RILL-R001", "0.4.1")
86
+ * // Returns: "https://github.com/rcrsr/rill/blob/v0.4.1/docs/ref-errors.md#rill-r001"
87
+ *
88
+ * @example
89
+ * getHelpUrl("invalid", "0.4.1")
90
+ * // Returns: ""
91
+ */
92
+ export declare function getHelpUrl(errorId: string, version: string): string;
93
+ //# sourceMappingURL=error-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-registry.d.ts","sourceRoot":"","sources":["../src/error-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,iDAAiD;AACjD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAEpE,2BAA2B;AAC3B,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAC9C,qDAAqD;IACrD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iDAAiD;IACjD,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,kDAAkD;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,qDAAqD;IACrD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC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