macroforge 0.1.75 → 0.1.77

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/index.d.ts CHANGED
@@ -7,46 +7,46 @@
7
7
  * different JavaScript class name. Used internally by [`NativePlugin::get_mapper`].
8
8
  */
9
9
  export declare class NativeMapper {
10
- /**
11
- * Creates a new mapper wrapping the given source mapping.
12
- *
13
- * # Arguments
14
- *
15
- * * `mapping` - The source mapping result from macro expansion
16
- */
17
- constructor(mapping: SourceMappingResult);
18
- /** Checks if this mapper has no mapping data. */
19
- isEmpty(): boolean;
20
- /**
21
- * Converts a position in the original source to expanded source.
22
- * See [`NativePositionMapper::original_to_expanded`] for details.
23
- */
24
- originalToExpanded(pos: number): number;
25
- /**
26
- * Converts a position in the expanded source back to original.
27
- * See [`NativePositionMapper::expanded_to_original`] for details.
28
- */
29
- expandedToOriginal(pos: number): number | null;
30
- /**
31
- * Returns the name of the macro that generated code at the given position.
32
- * See [`NativePositionMapper::generated_by`] for details.
33
- */
34
- generatedBy(pos: number): string | null;
35
- /**
36
- * Maps a span from expanded source to original source.
37
- * See [`NativePositionMapper::map_span_to_original`] for details.
38
- */
39
- mapSpanToOriginal(start: number, length: number): SpanResult | null;
40
- /**
41
- * Maps a span from original source to expanded source.
42
- * See [`NativePositionMapper::map_span_to_expanded`] for details.
43
- */
44
- mapSpanToExpanded(start: number, length: number): SpanResult;
45
- /**
46
- * Checks if a position is inside macro-generated code.
47
- * See [`NativePositionMapper::is_in_generated`] for details.
48
- */
49
- isInGenerated(pos: number): boolean;
10
+ /**
11
+ * Creates a new mapper wrapping the given source mapping.
12
+ *
13
+ * # Arguments
14
+ *
15
+ * * `mapping` - The source mapping result from macro expansion
16
+ */
17
+ constructor(mapping: SourceMappingResult)
18
+ /** Checks if this mapper has no mapping data. */
19
+ isEmpty(): boolean
20
+ /**
21
+ * Converts a position in the original source to expanded source.
22
+ * See [`NativePositionMapper::original_to_expanded`] for details.
23
+ */
24
+ originalToExpanded(pos: number): number
25
+ /**
26
+ * Converts a position in the expanded source back to original.
27
+ * See [`NativePositionMapper::expanded_to_original`] for details.
28
+ */
29
+ expandedToOriginal(pos: number): number | null
30
+ /**
31
+ * Returns the name of the macro that generated code at the given position.
32
+ * See [`NativePositionMapper::generated_by`] for details.
33
+ */
34
+ generatedBy(pos: number): string | null
35
+ /**
36
+ * Maps a span from expanded source to original source.
37
+ * See [`NativePositionMapper::map_span_to_original`] for details.
38
+ */
39
+ mapSpanToOriginal(start: number, length: number): SpanResult | null
40
+ /**
41
+ * Maps a span from original source to expanded source.
42
+ * See [`NativePositionMapper::map_span_to_expanded`] for details.
43
+ */
44
+ mapSpanToExpanded(start: number, length: number): SpanResult
45
+ /**
46
+ * Checks if a position is inside macro-generated code.
47
+ * See [`NativePositionMapper::is_in_generated`] for details.
48
+ */
49
+ isInGenerated(pos: number): boolean
50
50
  }
51
51
 
52
52
  /**
@@ -78,124 +78,120 @@ export declare class NativeMapper {
78
78
  * ```
79
79
  */
80
80
  export declare class NativePlugin {
81
- /**
82
- * Creates a new `NativePlugin` instance.
83
- *
84
- * Initializes the plugin with an empty cache and sets up a default log file
85
- * at `/tmp/macroforge-plugin.log` for debugging purposes.
86
- *
87
- * # Returns
88
- *
89
- * A new `NativePlugin` ready for processing files.
90
- *
91
- * # Side Effects
92
- *
93
- * Creates or clears the log file at `/tmp/macroforge-plugin.log`.
94
- */
95
- constructor();
96
- /**
97
- * Writes a message to the plugin's log file.
98
- *
99
- * Useful for debugging macro expansion issues in production environments.
100
- *
101
- * # Arguments
102
- *
103
- * * `message` - The message to log
104
- *
105
- * # Note
106
- *
107
- * Messages are appended to the log file. If the log file hasn't been
108
- * configured or cannot be written to, the message is silently dropped.
109
- */
110
- log(message: string): void;
111
- /**
112
- * Sets the path for the plugin's log file.
113
- *
114
- * # Arguments
115
- *
116
- * * `path` - The file path to use for logging
117
- *
118
- * # Note
119
- *
120
- * This does not create the file; it will be created when the first
121
- * message is logged.
122
- */
123
- setLogFile(path: string): void;
124
- /**
125
- * Processes a TypeScript file through the macro expansion system.
126
- *
127
- * This is the main entry point for file processing. It handles caching,
128
- * thread isolation (to prevent stack overflow), and error recovery.
129
- *
130
- * # Arguments
131
- *
132
- * * `_env` - NAPI environment (unused but required by NAPI)
133
- * * `filepath` - Path to the file (used for TSX detection and caching)
134
- * * `code` - The TypeScript source code to process
135
- * * `options` - Optional configuration for expansion and caching
136
- *
137
- * # Returns
138
- *
139
- * An [`ExpandResult`] containing the expanded code, diagnostics, and source mapping.
140
- *
141
- * # Errors
142
- *
143
- * Returns an error if:
144
- * - Thread spawning fails
145
- * - The worker thread panics (often due to stack overflow)
146
- * - Macro expansion fails internally
147
- *
148
- * # Performance
149
- *
150
- * - Uses a 32MB thread stack to prevent stack overflow during deep AST recursion
151
- * - Caches results by filepath and version for efficient incremental processing
152
- * - Early bailout for files without `@derive` decorators
153
- *
154
- * # Thread Safety
155
- *
156
- * Macro expansion runs in a separate thread because:
157
- * 1. SWC AST operations can be deeply recursive, exceeding default stack limits
158
- * 2. Node.js thread stack is typically only 2MB
159
- * 3. Panics in the worker thread are caught and reported gracefully
160
- */
161
- processFile(
162
- filepath: string,
163
- code: string,
164
- options?: ProcessFileOptions | undefined | null
165
- ): ExpandResult;
166
- /**
167
- * Retrieves a position mapper for a previously processed file.
168
- *
169
- * The mapper enables translation between original and expanded source positions,
170
- * which is essential for IDE features like error reporting and navigation.
171
- *
172
- * # Arguments
173
- *
174
- * * `filepath` - Path to the file (must have been previously processed)
175
- *
176
- * # Returns
177
- *
178
- * `Some(NativeMapper)` if the file has been processed and has source mapping data,
179
- * `None` if the file hasn't been processed or has no mapping (no macros expanded).
180
- */
181
- getMapper(filepath: string): NativeMapper | null;
182
- /**
183
- * Maps diagnostics from expanded source positions back to original source positions.
184
- *
185
- * This is used by IDE integrations to show errors at the correct locations
186
- * in the user's original code, rather than in the macro-expanded output.
187
- *
188
- * # Arguments
189
- *
190
- * * `filepath` - Path to the file the diagnostics are for
191
- * * `diags` - Diagnostics with positions in the expanded source
192
- *
193
- * # Returns
194
- *
195
- * Diagnostics with positions mapped back to the original source.
196
- * If no mapper is available for the file, returns diagnostics unchanged.
197
- */
198
- mapDiagnostics(filepath: string, diags: Array<JsDiagnostic>): Array<JsDiagnostic>;
81
+ /**
82
+ * Creates a new `NativePlugin` instance.
83
+ *
84
+ * Initializes the plugin with an empty cache and sets up a default log file
85
+ * at `/tmp/macroforge-plugin.log` for debugging purposes.
86
+ *
87
+ * # Returns
88
+ *
89
+ * A new `NativePlugin` ready for processing files.
90
+ *
91
+ * # Side Effects
92
+ *
93
+ * Creates or clears the log file at `/tmp/macroforge-plugin.log`.
94
+ */
95
+ constructor()
96
+ /**
97
+ * Writes a message to the plugin's log file.
98
+ *
99
+ * Useful for debugging macro expansion issues in production environments.
100
+ *
101
+ * # Arguments
102
+ *
103
+ * * `message` - The message to log
104
+ *
105
+ * # Note
106
+ *
107
+ * Messages are appended to the log file. If the log file hasn't been
108
+ * configured or cannot be written to, the message is silently dropped.
109
+ */
110
+ log(message: string): void
111
+ /**
112
+ * Sets the path for the plugin's log file.
113
+ *
114
+ * # Arguments
115
+ *
116
+ * * `path` - The file path to use for logging
117
+ *
118
+ * # Note
119
+ *
120
+ * This does not create the file; it will be created when the first
121
+ * message is logged.
122
+ */
123
+ setLogFile(path: string): void
124
+ /**
125
+ * Processes a TypeScript file through the macro expansion system.
126
+ *
127
+ * This is the main entry point for file processing. It handles caching,
128
+ * thread isolation (to prevent stack overflow), and error recovery.
129
+ *
130
+ * # Arguments
131
+ *
132
+ * * `_env` - NAPI environment (unused but required by NAPI)
133
+ * * `filepath` - Path to the file (used for TSX detection and caching)
134
+ * * `code` - The TypeScript source code to process
135
+ * * `options` - Optional configuration for expansion and caching
136
+ *
137
+ * # Returns
138
+ *
139
+ * An [`ExpandResult`] containing the expanded code, diagnostics, and source mapping.
140
+ *
141
+ * # Errors
142
+ *
143
+ * Returns an error if:
144
+ * - Thread spawning fails
145
+ * - The worker thread panics (often due to stack overflow)
146
+ * - Macro expansion fails internally
147
+ *
148
+ * # Performance
149
+ *
150
+ * - Uses a 32MB thread stack to prevent stack overflow during deep AST recursion
151
+ * - Caches results by filepath and version for efficient incremental processing
152
+ * - Early bailout for files without `@derive` decorators
153
+ *
154
+ * # Thread Safety
155
+ *
156
+ * Macro expansion runs in a separate thread because:
157
+ * 1. SWC AST operations can be deeply recursive, exceeding default stack limits
158
+ * 2. Node.js thread stack is typically only 2MB
159
+ * 3. Panics in the worker thread are caught and reported gracefully
160
+ */
161
+ processFile(filepath: string, code: string, options?: ProcessFileOptions | undefined | null): ExpandResult
162
+ /**
163
+ * Retrieves a position mapper for a previously processed file.
164
+ *
165
+ * The mapper enables translation between original and expanded source positions,
166
+ * which is essential for IDE features like error reporting and navigation.
167
+ *
168
+ * # Arguments
169
+ *
170
+ * * `filepath` - Path to the file (must have been previously processed)
171
+ *
172
+ * # Returns
173
+ *
174
+ * `Some(NativeMapper)` if the file has been processed and has source mapping data,
175
+ * `None` if the file hasn't been processed or has no mapping (no macros expanded).
176
+ */
177
+ getMapper(filepath: string): NativeMapper | null
178
+ /**
179
+ * Maps diagnostics from expanded source positions back to original source positions.
180
+ *
181
+ * This is used by IDE integrations to show errors at the correct locations
182
+ * in the user's original code, rather than in the macro-expanded output.
183
+ *
184
+ * # Arguments
185
+ *
186
+ * * `filepath` - Path to the file the diagnostics are for
187
+ * * `diags` - Diagnostics with positions in the expanded source
188
+ *
189
+ * # Returns
190
+ *
191
+ * Diagnostics with positions mapped back to the original source.
192
+ * If no mapper is available for the file, returns diagnostics unchanged.
193
+ */
194
+ mapDiagnostics(filepath: string, diags: Array<JsDiagnostic>): Array<JsDiagnostic>
199
195
  }
200
196
 
201
197
  /**
@@ -228,124 +224,124 @@ export declare class NativePlugin {
228
224
  * ```
229
225
  */
230
226
  export declare class PositionMapper {
231
- /**
232
- * Creates a new position mapper from source mapping data.
233
- *
234
- * # Arguments
235
- *
236
- * * `mapping` - The source mapping result from macro expansion
237
- *
238
- * # Returns
239
- *
240
- * A new `NativePositionMapper` ready for position translation.
241
- */
242
- constructor(mapping: SourceMappingResult);
243
- /**
244
- * Checks if this mapper has no mapping data.
245
- *
246
- * An empty mapper indicates no transformations occurred, so position
247
- * translation is an identity operation.
248
- *
249
- * # Returns
250
- *
251
- * `true` if there are no segments and no generated regions.
252
- */
253
- isEmpty(): boolean;
254
- /**
255
- * Converts a position in the original source to the corresponding position in expanded source.
256
- *
257
- * Uses binary search for O(log n) lookup performance.
258
- *
259
- * # Arguments
260
- *
261
- * * `pos` - Byte offset in the original source
262
- *
263
- * # Returns
264
- *
265
- * The corresponding byte offset in the expanded source. If the position falls
266
- * in a gap between segments, returns the position unchanged. If after the last
267
- * segment, extrapolates based on the delta.
268
- *
269
- * # Algorithm
270
- *
271
- * 1. Binary search to find the segment containing or after `pos`
272
- * 2. If inside a segment, compute offset within segment and translate
273
- * 3. If after all segments, extrapolate from the last segment
274
- * 4. Otherwise, return position unchanged (gap or before first segment)
275
- */
276
- originalToExpanded(pos: number): number;
277
- /**
278
- * Converts a position in the expanded source back to the original source position.
279
- *
280
- * Returns `None` if the position is inside macro-generated code that has no
281
- * corresponding location in the original source.
282
- *
283
- * # Arguments
284
- *
285
- * * `pos` - Byte offset in the expanded source
286
- *
287
- * # Returns
288
- *
289
- * `Some(original_pos)` if the position maps to original code,
290
- * `None` if the position is in macro-generated code.
291
- */
292
- expandedToOriginal(pos: number): number | null;
293
- /**
294
- * Returns the name of the macro that generated code at the given position.
295
- *
296
- * # Arguments
297
- *
298
- * * `pos` - Byte offset in the expanded source
299
- *
300
- * # Returns
301
- *
302
- * `Some(macro_name)` if the position is inside generated code (e.g., "Debug"),
303
- * `None` if the position is in original (non-generated) code.
304
- */
305
- generatedBy(pos: number): string | null;
306
- /**
307
- * Maps a span (start + length) from expanded source to original source.
308
- *
309
- * # Arguments
310
- *
311
- * * `start` - Start byte offset in expanded source
312
- * * `length` - Length of the span in bytes
313
- *
314
- * # Returns
315
- *
316
- * `Some(SpanResult)` with the mapped span in original source,
317
- * `None` if either endpoint is in generated code.
318
- */
319
- mapSpanToOriginal(start: number, length: number): SpanResult | null;
320
- /**
321
- * Maps a span (start + length) from original source to expanded source.
322
- *
323
- * This always succeeds since every original position has an expanded equivalent.
324
- *
325
- * # Arguments
326
- *
327
- * * `start` - Start byte offset in original source
328
- * * `length` - Length of the span in bytes
329
- *
330
- * # Returns
331
- *
332
- * A `SpanResult` with the mapped span in expanded source.
333
- */
334
- mapSpanToExpanded(start: number, length: number): SpanResult;
335
- /**
336
- * Checks if a position is inside macro-generated code.
337
- *
338
- * # Arguments
339
- *
340
- * * `pos` - Byte offset in the expanded source
341
- *
342
- * # Returns
343
- *
344
- * `true` if the position is inside a generated region, `false` otherwise.
345
- */
346
- isInGenerated(pos: number): boolean;
227
+ /**
228
+ * Creates a new position mapper from source mapping data.
229
+ *
230
+ * # Arguments
231
+ *
232
+ * * `mapping` - The source mapping result from macro expansion
233
+ *
234
+ * # Returns
235
+ *
236
+ * A new `NativePositionMapper` ready for position translation.
237
+ */
238
+ constructor(mapping: SourceMappingResult)
239
+ /**
240
+ * Checks if this mapper has no mapping data.
241
+ *
242
+ * An empty mapper indicates no transformations occurred, so position
243
+ * translation is an identity operation.
244
+ *
245
+ * # Returns
246
+ *
247
+ * `true` if there are no segments and no generated regions.
248
+ */
249
+ isEmpty(): boolean
250
+ /**
251
+ * Converts a position in the original source to the corresponding position in expanded source.
252
+ *
253
+ * Uses binary search for O(log n) lookup performance.
254
+ *
255
+ * # Arguments
256
+ *
257
+ * * `pos` - Byte offset in the original source
258
+ *
259
+ * # Returns
260
+ *
261
+ * The corresponding byte offset in the expanded source. If the position falls
262
+ * in a gap between segments, returns the position unchanged. If after the last
263
+ * segment, extrapolates based on the delta.
264
+ *
265
+ * # Algorithm
266
+ *
267
+ * 1. Binary search to find the segment containing or after `pos`
268
+ * 2. If inside a segment, compute offset within segment and translate
269
+ * 3. If after all segments, extrapolate from the last segment
270
+ * 4. Otherwise, return position unchanged (gap or before first segment)
271
+ */
272
+ originalToExpanded(pos: number): number
273
+ /**
274
+ * Converts a position in the expanded source back to the original source position.
275
+ *
276
+ * Returns `None` if the position is inside macro-generated code that has no
277
+ * corresponding location in the original source.
278
+ *
279
+ * # Arguments
280
+ *
281
+ * * `pos` - Byte offset in the expanded source
282
+ *
283
+ * # Returns
284
+ *
285
+ * `Some(original_pos)` if the position maps to original code,
286
+ * `None` if the position is in macro-generated code.
287
+ */
288
+ expandedToOriginal(pos: number): number | null
289
+ /**
290
+ * Returns the name of the macro that generated code at the given position.
291
+ *
292
+ * # Arguments
293
+ *
294
+ * * `pos` - Byte offset in the expanded source
295
+ *
296
+ * # Returns
297
+ *
298
+ * `Some(macro_name)` if the position is inside generated code (e.g., "Debug"),
299
+ * `None` if the position is in original (non-generated) code.
300
+ */
301
+ generatedBy(pos: number): string | null
302
+ /**
303
+ * Maps a span (start + length) from expanded source to original source.
304
+ *
305
+ * # Arguments
306
+ *
307
+ * * `start` - Start byte offset in expanded source
308
+ * * `length` - Length of the span in bytes
309
+ *
310
+ * # Returns
311
+ *
312
+ * `Some(SpanResult)` with the mapped span in original source,
313
+ * `None` if either endpoint is in generated code.
314
+ */
315
+ mapSpanToOriginal(start: number, length: number): SpanResult | null
316
+ /**
317
+ * Maps a span (start + length) from original source to expanded source.
318
+ *
319
+ * This always succeeds since every original position has an expanded equivalent.
320
+ *
321
+ * # Arguments
322
+ *
323
+ * * `start` - Start byte offset in original source
324
+ * * `length` - Length of the span in bytes
325
+ *
326
+ * # Returns
327
+ *
328
+ * A `SpanResult` with the mapped span in expanded source.
329
+ */
330
+ mapSpanToExpanded(start: number, length: number): SpanResult
331
+ /**
332
+ * Checks if a position is inside macro-generated code.
333
+ *
334
+ * # Arguments
335
+ *
336
+ * * `pos` - Byte offset in the expanded source
337
+ *
338
+ * # Returns
339
+ *
340
+ * `true` if the position is inside a generated region, `false` otherwise.
341
+ */
342
+ isInGenerated(pos: number): boolean
347
343
  }
348
- export type NativePositionMapper = PositionMapper;
344
+ export type NativePositionMapper = PositionMapper
349
345
 
350
346
  /**
351
347
  * Returns debug information about all registered macro descriptors (debug API).
@@ -357,7 +353,7 @@ export type NativePositionMapper = PositionMapper;
357
353
  *
358
354
  * A vector of strings describing each registered macro descriptor.
359
355
  */
360
- export declare function __macroforgeDebugDescriptors(): Array<string>;
356
+ export declare function __macroforgeDebugDescriptors(): Array<string>
361
357
 
362
358
  /**
363
359
  * Returns all registered macro module names (debug API).
@@ -368,7 +364,7 @@ export declare function __macroforgeDebugDescriptors(): Array<string>;
368
364
  *
369
365
  * A vector of module names.
370
366
  */
371
- export declare function __macroforgeDebugGetModules(): Array<string>;
367
+ export declare function __macroforgeDebugGetModules(): Array<string>
372
368
 
373
369
  /**
374
370
  * Looks up a macro by module and name (debug API).
@@ -384,7 +380,7 @@ export declare function __macroforgeDebugGetModules(): Array<string>;
384
380
  *
385
381
  * A string describing whether the macro was found or not.
386
382
  */
387
- export declare function __macroforgeDebugLookup(module: string, name: string): string;
383
+ export declare function __macroforgeDebugLookup(module: string, name: string): string
388
384
 
389
385
  /**
390
386
  * Returns the names of all registered macros.
@@ -393,7 +389,7 @@ export declare function __macroforgeDebugLookup(module: string, name: string): s
393
389
  *
394
390
  * A vector of macro names (e.g., `["Debug", "Clone", "Serialize"]`).
395
391
  */
396
- export declare function __macroforgeGetMacroNames(): Array<string>;
392
+ export declare function __macroforgeGetMacroNames(): Array<string>
397
393
 
398
394
  /**
399
395
  * Returns the complete manifest of all registered macros and decorators.
@@ -413,7 +409,7 @@ export declare function __macroforgeGetMacroNames(): Array<string>;
413
409
  * // ["Debug", "Clone", "PartialEq", "Hash", "Serialize", "Deserialize", ...]
414
410
  * ```
415
411
  */
416
- export declare function __macroforgeGetManifest(): MacroManifest;
412
+ export declare function __macroforgeGetManifest(): MacroManifest
417
413
 
418
414
  /**
419
415
  * Checks if any macros are registered in this package.
@@ -424,7 +420,7 @@ export declare function __macroforgeGetManifest(): MacroManifest;
424
420
  *
425
421
  * `true` if at least one macro is registered, `false` otherwise.
426
422
  */
427
- export declare function __macroforgeIsMacroPackage(): boolean;
423
+ export declare function __macroforgeIsMacroPackage(): boolean
428
424
 
429
425
  /**
430
426
  * r" Run this macro with the given context.
@@ -452,7 +448,7 @@ export declare function __macroforgeIsMacroPackage(): boolean;
452
448
  * r" - The `TsStream` cannot be created from the context
453
449
  * r" - The result cannot be serialized to JSON
454
450
  */
455
- export declare function __macroforgeRunClone(contextJson: string): string;
451
+ export declare function __macroforgeRunClone(contextJson: string): string
456
452
 
457
453
  /**
458
454
  * r" Run this macro with the given context.
@@ -480,7 +476,7 @@ export declare function __macroforgeRunClone(contextJson: string): string;
480
476
  * r" - The `TsStream` cannot be created from the context
481
477
  * r" - The result cannot be serialized to JSON
482
478
  */
483
- export declare function __macroforgeRunDebug(contextJson: string): string;
479
+ export declare function __macroforgeRunDebug(contextJson: string): string
484
480
 
485
481
  /**
486
482
  * r" Run this macro with the given context.
@@ -508,7 +504,7 @@ export declare function __macroforgeRunDebug(contextJson: string): string;
508
504
  * r" - The `TsStream` cannot be created from the context
509
505
  * r" - The result cannot be serialized to JSON
510
506
  */
511
- export declare function __macroforgeRunDefault(contextJson: string): string;
507
+ export declare function __macroforgeRunDefault(contextJson: string): string
512
508
 
513
509
  /**
514
510
  * r" Run this macro with the given context.
@@ -536,7 +532,7 @@ export declare function __macroforgeRunDefault(contextJson: string): string;
536
532
  * r" - The `TsStream` cannot be created from the context
537
533
  * r" - The result cannot be serialized to JSON
538
534
  */
539
- export declare function __macroforgeRunDeserialize(contextJson: string): string;
535
+ export declare function __macroforgeRunDeserialize(contextJson: string): string
540
536
 
541
537
  /**
542
538
  * r" Run this macro with the given context.
@@ -564,7 +560,7 @@ export declare function __macroforgeRunDeserialize(contextJson: string): string;
564
560
  * r" - The `TsStream` cannot be created from the context
565
561
  * r" - The result cannot be serialized to JSON
566
562
  */
567
- export declare function __macroforgeRunHash(contextJson: string): string;
563
+ export declare function __macroforgeRunHash(contextJson: string): string
568
564
 
569
565
  /**
570
566
  * r" Run this macro with the given context.
@@ -592,7 +588,7 @@ export declare function __macroforgeRunHash(contextJson: string): string;
592
588
  * r" - The `TsStream` cannot be created from the context
593
589
  * r" - The result cannot be serialized to JSON
594
590
  */
595
- export declare function __macroforgeRunOrd(contextJson: string): string;
591
+ export declare function __macroforgeRunOrd(contextJson: string): string
596
592
 
597
593
  /**
598
594
  * r" Run this macro with the given context.
@@ -620,7 +616,7 @@ export declare function __macroforgeRunOrd(contextJson: string): string;
620
616
  * r" - The `TsStream` cannot be created from the context
621
617
  * r" - The result cannot be serialized to JSON
622
618
  */
623
- export declare function __macroforgeRunPartialEq(contextJson: string): string;
619
+ export declare function __macroforgeRunPartialEq(contextJson: string): string
624
620
 
625
621
  /**
626
622
  * r" Run this macro with the given context.
@@ -648,7 +644,7 @@ export declare function __macroforgeRunPartialEq(contextJson: string): string;
648
644
  * r" - The `TsStream` cannot be created from the context
649
645
  * r" - The result cannot be serialized to JSON
650
646
  */
651
- export declare function __macroforgeRunPartialOrd(contextJson: string): string;
647
+ export declare function __macroforgeRunPartialOrd(contextJson: string): string
652
648
 
653
649
  /**
654
650
  * r" Run this macro with the given context.
@@ -676,7 +672,7 @@ export declare function __macroforgeRunPartialOrd(contextJson: string): string;
676
672
  * r" - The `TsStream` cannot be created from the context
677
673
  * r" - The result cannot be serialized to JSON
678
674
  */
679
- export declare function __macroforgeRunSerialize(contextJson: string): string;
675
+ export declare function __macroforgeRunSerialize(contextJson: string): string
680
676
 
681
677
  /**
682
678
  * Checks if the given TypeScript code has valid syntax.
@@ -702,7 +698,7 @@ export declare function __macroforgeRunSerialize(contextJson: string): string;
702
698
  * }
703
699
  * ```
704
700
  */
705
- export declare function checkSyntax(code: string, filepath: string): SyntaxCheckResult;
701
+ export declare function checkSyntax(code: string, filepath: string): SyntaxCheckResult
706
702
 
707
703
  /**
708
704
  * Clears the configuration cache.
@@ -722,7 +718,7 @@ export declare function checkSyntax(code: string, filepath: string): SyntaxCheck
722
718
  * const result = loadConfig(configContent, configPath);
723
719
  * ```
724
720
  */
725
- export declare function clearConfigCache(): void;
721
+ export declare function clearConfigCache(): void
726
722
 
727
723
  /**
728
724
  * Entry for a registered decorator in the manifest.
@@ -731,14 +727,14 @@ export declare function clearConfigCache(): void;
731
727
  * that can be used with macros.
732
728
  */
733
729
  export interface DecoratorManifestEntry {
734
- /** The module this decorator belongs to (e.g., "serde"). */
735
- module: string;
736
- /** The exported name of the decorator (e.g., "skip", "rename"). */
737
- export: string;
738
- /** The decorator kind: "class", "property", "method", "accessor", "parameter". */
739
- kind: string;
740
- /** Documentation string for the decorator. */
741
- docs: string;
730
+ /** The module this decorator belongs to (e.g., "serde"). */
731
+ module: string
732
+ /** The exported name of the decorator (e.g., "skip", "rename"). */
733
+ export: string
734
+ /** The decorator kind: "class", "property", "method", "accessor", "parameter". */
735
+ kind: string
736
+ /** Documentation string for the decorator. */
737
+ docs: string
742
738
  }
743
739
 
744
740
  /**
@@ -760,7 +756,7 @@ export interface DecoratorManifestEntry {
760
756
  * }
761
757
  * ```
762
758
  */
763
- export declare function Derive(...features: any[]): ClassDecorator;
759
+ export declare function Derive(...features: any[]): ClassDecorator
764
760
 
765
761
  /**
766
762
  * Options for macro expansion.
@@ -768,49 +764,63 @@ export declare function Derive(...features: any[]): ClassDecorator;
768
764
  * Used by [`expand_sync`] to configure expansion behavior.
769
765
  */
770
766
  export interface ExpandOptions {
771
- /**
772
- * If `true`, preserves `@derive` decorators in the output.
773
- * If `false` (default), decorators are stripped after expansion.
774
- */
775
- keepDecorators?: boolean;
776
- /**
777
- * Additional decorator module names from external macros.
778
- *
779
- * These are used during decorator stripping to identify Macroforge-specific
780
- * decorators that should be removed from the output. Built-in decorator modules
781
- * (like "serde", "debug") are automatically included.
782
- *
783
- * External macro packages should export their decorator module names, which
784
- * plugins can collect and pass here.
785
- *
786
- * # Example
787
- *
788
- * ```javascript
789
- * expandSync(code, filepath, {
790
- * keepDecorators: false,
791
- * externalDecoratorModules: ["myMacro", "customValidator"]
792
- * });
793
- * ```
794
- */
795
- externalDecoratorModules?: Array<string>;
796
- /**
797
- * Path to a previously loaded config file.
798
- *
799
- * When provided, the expansion will use the cached configuration
800
- * (including foreign types) from this path. The config must have been
801
- * previously loaded via [`load_config`].
802
- *
803
- * # Example
804
- *
805
- * ```javascript
806
- * // First, load the config
807
- * const configResult = loadConfig(configContent, configPath);
808
- *
809
- * // Then use it during expansion
810
- * expandSync(code, filepath, { configPath });
811
- * ```
812
- */
813
- configPath?: string;
767
+ /**
768
+ * If `true`, preserves `@derive` decorators in the output.
769
+ * If `false` (default), decorators are stripped after expansion.
770
+ */
771
+ keepDecorators?: boolean
772
+ /**
773
+ * Additional decorator module names from external macros.
774
+ *
775
+ * These are used during decorator stripping to identify Macroforge-specific
776
+ * decorators that should be removed from the output. Built-in decorator modules
777
+ * (like "serde", "debug") are automatically included.
778
+ *
779
+ * External macro packages should export their decorator module names, which
780
+ * plugins can collect and pass here.
781
+ *
782
+ * # Example
783
+ *
784
+ * ```javascript
785
+ * expandSync(code, filepath, {
786
+ * keepDecorators: false,
787
+ * externalDecoratorModules: ["myMacro", "customValidator"]
788
+ * });
789
+ * ```
790
+ */
791
+ externalDecoratorModules?: Array<string>
792
+ /**
793
+ * Path to a previously loaded config file.
794
+ *
795
+ * When provided, the expansion will use the cached configuration
796
+ * (including foreign types) from this path. The config must have been
797
+ * previously loaded via [`load_config`].
798
+ *
799
+ * # Example
800
+ *
801
+ * ```javascript
802
+ * // First, load the config
803
+ * const configResult = loadConfig(configContent, configPath);
804
+ *
805
+ * // Then use it during expansion
806
+ * expandSync(code, filepath, { configPath });
807
+ * ```
808
+ */
809
+ configPath?: string
810
+ /**
811
+ * Pre-built type registry JSON from [`scan_project_sync`].
812
+ *
813
+ * When provided, macros receive project-wide type awareness through
814
+ * the `type_registry` and `resolved_fields` fields on `MacroContextIR`.
815
+ *
816
+ * # Example
817
+ *
818
+ * ```javascript
819
+ * const scan = scanProjectSync(projectRoot);
820
+ * expandSync(code, filepath, { typeRegistryJson: scan.registryJson });
821
+ * ```
822
+ */
823
+ typeRegistryJson?: string
814
824
  }
815
825
 
816
826
  /**
@@ -840,16 +850,16 @@ export interface ExpandOptions {
840
850
  * ```
841
851
  */
842
852
  export interface ExpandResult {
843
- /** The expanded TypeScript code with all macros processed. */
844
- code: string;
845
- /** Optional TypeScript type declarations for generated methods. */
846
- types?: string;
847
- /** Optional JSON metadata about processed classes. */
848
- metadata?: string;
849
- /** Diagnostics (errors, warnings, info) from the expansion process. */
850
- diagnostics: Array<MacroDiagnostic>;
851
- /** Source mapping for position translation between original and expanded code. */
852
- sourceMapping?: SourceMappingResult;
853
+ /** The expanded TypeScript code with all macros processed. */
854
+ code: string
855
+ /** Optional TypeScript type declarations for generated methods. */
856
+ types?: string
857
+ /** Optional JSON metadata about processed classes. */
858
+ metadata?: string
859
+ /** Diagnostics (errors, warnings, info) from the expansion process. */
860
+ diagnostics: Array<MacroDiagnostic>
861
+ /** Source mapping for position translation between original and expanded code. */
862
+ sourceMapping?: SourceMappingResult
853
863
  }
854
864
 
855
865
  /**
@@ -889,11 +899,7 @@ export interface ExpandResult {
889
899
  * console.log(result.diagnostics); // Any warnings or errors
890
900
  * ```
891
901
  */
892
- export declare function expandSync(
893
- code: string,
894
- filepath: string,
895
- options?: ExpandOptions | undefined | null
896
- ): ExpandResult;
902
+ export declare function expandSync(code: string, filepath: string, options?: ExpandOptions | undefined | null): ExpandResult
897
903
 
898
904
  /**
899
905
  * A region in the expanded source that was generated by a macro.
@@ -908,12 +914,12 @@ export declare function expandSync(
908
914
  * with `source_macro = "Debug"`.
909
915
  */
910
916
  export interface GeneratedRegionResult {
911
- /** Byte offset where the generated region starts in the expanded source. */
912
- start: number;
913
- /** Byte offset where the generated region ends in the expanded source. */
914
- end: number;
915
- /** Name of the macro that generated this region (e.g., "Debug", "Clone"). */
916
- sourceMacro: string;
917
+ /** Byte offset where the generated region starts in the expanded source. */
918
+ start: number
919
+ /** Byte offset where the generated region ends in the expanded source. */
920
+ end: number
921
+ /** Name of the macro that generated this region (e.g., "Debug", "Clone"). */
922
+ sourceMacro: string
917
923
  }
918
924
 
919
925
  /**
@@ -922,10 +928,10 @@ export interface GeneratedRegionResult {
922
928
  * Used to track where decorators and macro-related imports come from.
923
929
  */
924
930
  export interface ImportSourceResult {
925
- /** Local identifier name in the import statement (e.g., `Derive` in `import { Derive }`). */
926
- local: string;
927
- /** Module specifier this identifier was imported from (e.g., `"macroforge-ts"`). */
928
- module: string;
931
+ /** Local identifier name in the import statement (e.g., `Derive` in `import { Derive }`). */
932
+ local: string
933
+ /** Module specifier this identifier was imported from (e.g., `"macroforge-ts"`). */
934
+ module: string
929
935
  }
930
936
 
931
937
  /**
@@ -935,16 +941,16 @@ export interface ImportSourceResult {
935
941
  * with language servers and IDEs.
936
942
  */
937
943
  export interface JsDiagnostic {
938
- /** Byte offset where the diagnostic starts. `None` for global diagnostics. */
939
- start?: number;
940
- /** Length of the diagnostic span in bytes. */
941
- length?: number;
942
- /** Human-readable diagnostic message. */
943
- message?: string;
944
- /** TypeScript diagnostic code (e.g., 2304 for "Cannot find name"). */
945
- code?: number;
946
- /** Diagnostic category: "error", "warning", "suggestion", "message". */
947
- category?: string;
944
+ /** Byte offset where the diagnostic starts. `None` for global diagnostics. */
945
+ start?: number
946
+ /** Length of the diagnostic span in bytes. */
947
+ length?: number
948
+ /** Human-readable diagnostic message. */
949
+ message?: string
950
+ /** TypeScript diagnostic code (e.g., 2304 for "Cannot find name"). */
951
+ code?: number
952
+ /** Diagnostic category: "error", "warning", "suggestion", "message". */
953
+ category?: string
948
954
  }
949
955
 
950
956
  /**
@@ -980,7 +986,7 @@ export interface JsDiagnostic {
980
986
  * const expanded = expandSync(code, filepath, { configPath });
981
987
  * ```
982
988
  */
983
- export declare function loadConfig(content: string, filepath: string): LoadConfigResult;
989
+ export declare function loadConfig(content: string, filepath: string): LoadConfigResult
984
990
 
985
991
  /**
986
992
  * Result of loading a macroforge configuration file.
@@ -988,14 +994,14 @@ export declare function loadConfig(content: string, filepath: string): LoadConfi
988
994
  * Returned by [`load_config`] after parsing a `macroforge.config.js/ts` file.
989
995
  */
990
996
  export interface LoadConfigResult {
991
- /** Whether to preserve `@derive` decorators in the output code. */
992
- keepDecorators: boolean;
993
- /** Whether to generate a convenience const for non-class types. */
994
- generateConvenienceConst: boolean;
995
- /** Whether the config has any foreign type handlers defined. */
996
- hasForeignTypes: boolean;
997
- /** Number of foreign types configured. */
998
- foreignTypeCount: number;
997
+ /** Whether to preserve `@derive` decorators in the output code. */
998
+ keepDecorators: boolean
999
+ /** Whether to generate a convenience const for non-class types. */
1000
+ generateConvenienceConst: boolean
1001
+ /** Whether the config has any foreign type handlers defined. */
1002
+ hasForeignTypes: boolean
1003
+ /** Number of foreign types configured. */
1004
+ foreignTypeCount: number
999
1005
  }
1000
1006
 
1001
1007
  /**
@@ -1025,23 +1031,23 @@ export interface LoadConfigResult {
1025
1031
  * ```
1026
1032
  */
1027
1033
  export interface MacroDiagnostic {
1028
- /**
1029
- * Severity level of the diagnostic.
1030
- * One of: "error", "warning", "info".
1031
- */
1032
- level: string;
1033
- /** Human-readable message describing the diagnostic. */
1034
- message: string;
1035
- /**
1036
- * Byte offset in the original source where the issue starts.
1037
- * `None` if the diagnostic is not associated with a specific location.
1038
- */
1039
- start?: number;
1040
- /**
1041
- * Byte offset in the original source where the issue ends.
1042
- * `None` if the diagnostic is not associated with a specific location.
1043
- */
1044
- end?: number;
1034
+ /**
1035
+ * Severity level of the diagnostic.
1036
+ * One of: "error", "warning", "info".
1037
+ */
1038
+ level: string
1039
+ /** Human-readable message describing the diagnostic. */
1040
+ message: string
1041
+ /**
1042
+ * Byte offset in the original source where the issue starts.
1043
+ * `None` if the diagnostic is not associated with a specific location.
1044
+ */
1045
+ start?: number
1046
+ /**
1047
+ * Byte offset in the original source where the issue ends.
1048
+ * `None` if the diagnostic is not associated with a specific location.
1049
+ */
1050
+ end?: number
1045
1051
  }
1046
1052
 
1047
1053
  /**
@@ -1053,12 +1059,12 @@ export interface MacroDiagnostic {
1053
1059
  * - Tooling integration
1054
1060
  */
1055
1061
  export interface MacroManifest {
1056
- /** ABI version for compatibility checking. */
1057
- version: number;
1058
- /** All registered macros (derive, attribute, function). */
1059
- macros: Array<MacroManifestEntry>;
1060
- /** All registered field/class decorators. */
1061
- decorators: Array<DecoratorManifestEntry>;
1062
+ /** ABI version for compatibility checking. */
1063
+ version: number
1064
+ /** All registered macros (derive, attribute, function). */
1065
+ macros: Array<MacroManifestEntry>
1066
+ /** All registered field/class decorators. */
1067
+ decorators: Array<DecoratorManifestEntry>
1062
1068
  }
1063
1069
 
1064
1070
  /**
@@ -1068,14 +1074,14 @@ export interface MacroManifest {
1068
1074
  * such as IDE extensions and documentation generators.
1069
1075
  */
1070
1076
  export interface MacroManifestEntry {
1071
- /** The macro name (e.g., "Debug", "Clone", "Serialize"). */
1072
- name: string;
1073
- /** The macro kind: "derive", "attribute", or "function". */
1074
- kind: string;
1075
- /** Human-readable description of what the macro does. */
1076
- description: string;
1077
- /** The package that provides this macro (e.g., "macroforge-ts"). */
1078
- package: string;
1077
+ /** The macro name (e.g., "Debug", "Clone", "Serialize"). */
1078
+ name: string
1079
+ /** The macro kind: "derive", "attribute", or "function". */
1080
+ kind: string
1081
+ /** Human-readable description of what the macro does. */
1082
+ description: string
1083
+ /** The package that provides this macro (e.g., "macroforge-ts"). */
1084
+ package: string
1079
1085
  }
1080
1086
 
1081
1087
  /**
@@ -1092,14 +1098,14 @@ export interface MacroManifestEntry {
1092
1098
  * - Segments are non-overlapping and sorted by position
1093
1099
  */
1094
1100
  export interface MappingSegmentResult {
1095
- /** Byte offset where this segment starts in the original source. */
1096
- originalStart: number;
1097
- /** Byte offset where this segment ends in the original source. */
1098
- originalEnd: number;
1099
- /** Byte offset where this segment starts in the expanded source. */
1100
- expandedStart: number;
1101
- /** Byte offset where this segment ends in the expanded source. */
1102
- expandedEnd: number;
1101
+ /** Byte offset where this segment starts in the original source. */
1102
+ originalStart: number
1103
+ /** Byte offset where this segment ends in the original source. */
1104
+ originalEnd: number
1105
+ /** Byte offset where this segment starts in the expanded source. */
1106
+ expandedStart: number
1107
+ /** Byte offset where this segment ends in the expanded source. */
1108
+ expandedEnd: number
1103
1109
  }
1104
1110
 
1105
1111
  /**
@@ -1133,10 +1139,7 @@ export interface MappingSegmentResult {
1133
1139
  * // ]
1134
1140
  * ```
1135
1141
  */
1136
- export declare function parseImportSources(
1137
- code: string,
1138
- filepath: string
1139
- ): Array<ImportSourceResult>;
1142
+ export declare function parseImportSources(code: string, filepath: string): Array<ImportSourceResult>
1140
1143
 
1141
1144
  /**
1142
1145
  * Options for processing a file through the macro system.
@@ -1145,26 +1148,84 @@ export declare function parseImportSources(
1145
1148
  * and caching.
1146
1149
  */
1147
1150
  export interface ProcessFileOptions {
1148
- /**
1149
- * If `true`, preserves `@derive` decorators in the output.
1150
- * If `false` (default), decorators are stripped after expansion.
1151
- */
1152
- keepDecorators?: boolean;
1153
- /**
1154
- * Version string for cache invalidation.
1155
- * When provided, cached results are only reused if versions match.
1156
- */
1157
- version?: string;
1158
- /**
1159
- * Additional decorator module names from external macros.
1160
- * See [`ExpandOptions::external_decorator_modules`] for details.
1161
- */
1162
- externalDecoratorModules?: Array<string>;
1163
- /**
1164
- * Path to a previously loaded config file (for foreign types lookup).
1165
- * See [`ExpandOptions::config_path`] for details.
1166
- */
1167
- configPath?: string;
1151
+ /**
1152
+ * If `true`, preserves `@derive` decorators in the output.
1153
+ * If `false` (default), decorators are stripped after expansion.
1154
+ */
1155
+ keepDecorators?: boolean
1156
+ /**
1157
+ * Version string for cache invalidation.
1158
+ * When provided, cached results are only reused if versions match.
1159
+ */
1160
+ version?: string
1161
+ /**
1162
+ * Additional decorator module names from external macros.
1163
+ * See [`ExpandOptions::external_decorator_modules`] for details.
1164
+ */
1165
+ externalDecoratorModules?: Array<string>
1166
+ /**
1167
+ * Path to a previously loaded config file (for foreign types lookup).
1168
+ * See [`ExpandOptions::config_path`] for details.
1169
+ */
1170
+ configPath?: string
1171
+ /**
1172
+ * Pre-built type registry JSON from [`scan_project_sync`].
1173
+ * See [`ExpandOptions::type_registry_json`] for details.
1174
+ */
1175
+ typeRegistryJson?: string
1176
+ }
1177
+
1178
+ /** Options for scanning a TypeScript project for type information. */
1179
+ export interface ScanOptions {
1180
+ /** File extensions to scan (default: `[".ts", ".tsx"]`). */
1181
+ extensions?: Array<string>
1182
+ /** Whether to only collect exported types (default: `false`). */
1183
+ exportedOnly?: boolean
1184
+ }
1185
+
1186
+ /**
1187
+ * Scan a TypeScript project and build a type registry.
1188
+ *
1189
+ * This should be called once at build start (e.g., in Vite's `buildStart` hook)
1190
+ * and the resulting `registry_json` should be passed to [`expand_sync`] via
1191
+ * `ExpandOptions.type_registry_json`.
1192
+ *
1193
+ * # Arguments
1194
+ *
1195
+ * * `root_dir` - The project root directory to scan
1196
+ * * `options` - Optional scan configuration
1197
+ *
1198
+ * # Returns
1199
+ *
1200
+ * A [`ScanResult`] with the serialized registry and scan statistics.
1201
+ *
1202
+ * # Example
1203
+ *
1204
+ * ```javascript
1205
+ * const scan = scanProjectSync(projectRoot);
1206
+ * console.log(`Found ${scan.typesFound} types in ${scan.filesScanned} files`);
1207
+ *
1208
+ * // Pass to expand_sync for each file
1209
+ * const result = expandSync(code, filepath, {
1210
+ * typeRegistryJson: scan.registryJson,
1211
+ * });
1212
+ * ```
1213
+ */
1214
+ export declare function scanProjectSync(rootDir: string, options?: ScanOptions | undefined | null): ScanResult
1215
+
1216
+ /** Result of scanning a project for type information. */
1217
+ export interface ScanResult {
1218
+ /**
1219
+ * JSON-serialized [`TypeRegistry`].
1220
+ * Pass this to `expand_sync` via `ExpandOptions.type_registry_json`.
1221
+ */
1222
+ registryJson: string
1223
+ /** Number of files scanned. */
1224
+ filesScanned: number
1225
+ /** Number of types found. */
1226
+ typesFound: number
1227
+ /** Diagnostics from scanning (e.g., files that failed to parse). */
1228
+ diagnostics: Array<MacroDiagnostic>
1168
1229
  }
1169
1230
 
1170
1231
  /**
@@ -1181,16 +1242,16 @@ export interface ProcessFileOptions {
1181
1242
  * - Mapping IDE diagnostics from expanded code back to original source
1182
1243
  */
1183
1244
  export interface SourceMappingResult {
1184
- /**
1185
- * Segments mapping preserved regions between original and expanded source.
1186
- * Sorted by position for efficient binary search lookups.
1187
- */
1188
- segments: Array<MappingSegmentResult>;
1189
- /**
1190
- * Regions in the expanded source that were generated by macros.
1191
- * Used to identify synthetic code with no original source location.
1192
- */
1193
- generatedRegions: Array<GeneratedRegionResult>;
1245
+ /**
1246
+ * Segments mapping preserved regions between original and expanded source.
1247
+ * Sorted by position for efficient binary search lookups.
1248
+ */
1249
+ segments: Array<MappingSegmentResult>
1250
+ /**
1251
+ * Regions in the expanded source that were generated by macros.
1252
+ * Used to identify synthetic code with no original source location.
1253
+ */
1254
+ generatedRegions: Array<GeneratedRegionResult>
1194
1255
  }
1195
1256
 
1196
1257
  /**
@@ -1199,10 +1260,10 @@ export interface SourceMappingResult {
1199
1260
  * Used for mapping diagnostics and other positional information.
1200
1261
  */
1201
1262
  export interface SpanResult {
1202
- /** Byte offset where the span starts. */
1203
- start: number;
1204
- /** Length of the span in bytes. */
1205
- length: number;
1263
+ /** Byte offset where the span starts. */
1264
+ start: number
1265
+ /** Length of the span in bytes. */
1266
+ length: number
1206
1267
  }
1207
1268
 
1208
1269
  /**
@@ -1211,10 +1272,10 @@ export interface SpanResult {
1211
1272
  * Returned by [`check_syntax`] to indicate whether code parses successfully.
1212
1273
  */
1213
1274
  export interface SyntaxCheckResult {
1214
- /** `true` if the code parsed without errors, `false` otherwise. */
1215
- ok: boolean;
1216
- /** Error message if parsing failed, `None` if successful. */
1217
- error?: string;
1275
+ /** `true` if the code parsed without errors, `false` otherwise. */
1276
+ ok: boolean
1277
+ /** Error message if parsing failed, `None` if successful. */
1278
+ error?: string
1218
1279
  }
1219
1280
 
1220
1281
  /**
@@ -1231,23 +1292,23 @@ export interface SyntaxCheckResult {
1231
1292
  * * `metadata` - Optional JSON metadata about processed classes
1232
1293
  */
1233
1294
  export interface TransformResult {
1234
- /** The transformed TypeScript/JavaScript code with all macros expanded. */
1235
- code: string;
1236
- /**
1237
- * Source map for mapping transformed positions back to original.
1238
- * Currently always `None` - source mapping is handled separately via `SourceMappingResult`.
1239
- */
1240
- map?: string;
1241
- /**
1242
- * TypeScript type declarations (`.d.ts` content) for generated methods.
1243
- * Used by IDEs to provide type information for macro-generated code.
1244
- */
1245
- types?: string;
1246
- /**
1247
- * JSON-serialized metadata about processed classes.
1248
- * Contains information about which classes were processed and what was generated.
1249
- */
1250
- metadata?: string;
1295
+ /** The transformed TypeScript/JavaScript code with all macros expanded. */
1296
+ code: string
1297
+ /**
1298
+ * Source map for mapping transformed positions back to original.
1299
+ * Currently always `None` - source mapping is handled separately via `SourceMappingResult`.
1300
+ */
1301
+ map?: string
1302
+ /**
1303
+ * TypeScript type declarations (`.d.ts` content) for generated methods.
1304
+ * Used by IDEs to provide type information for macro-generated code.
1305
+ */
1306
+ types?: string
1307
+ /**
1308
+ * JSON-serialized metadata about processed classes.
1309
+ * Contains information about which classes were processed and what was generated.
1310
+ */
1311
+ metadata?: string
1251
1312
  }
1252
1313
 
1253
1314
  /**
@@ -1277,4 +1338,4 @@ export interface TransformResult {
1277
1338
  *
1278
1339
  * Uses a 32MB thread stack to prevent stack overflow during deep AST recursion.
1279
1340
  */
1280
- export declare function transformSync(code: string, filepath: string): TransformResult;
1341
+ export declare function transformSync(code: string, filepath: string): TransformResult