@reckona/mreact-compiler 0.0.159 → 0.0.161

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 (49) hide show
  1. package/dist/boundary-graph.d.ts +13 -0
  2. package/dist/boundary-graph.d.ts.map +1 -1
  3. package/dist/boundary-graph.js +1 -0
  4. package/dist/boundary-graph.js.map +1 -1
  5. package/dist/compiler-module-context.d.ts +2 -0
  6. package/dist/compiler-module-context.d.ts.map +1 -1
  7. package/dist/compiler-module-context.js +1 -0
  8. package/dist/compiler-module-context.js.map +1 -1
  9. package/dist/diagnostics.d.ts +1 -0
  10. package/dist/diagnostics.d.ts.map +1 -1
  11. package/dist/diagnostics.js +1 -0
  12. package/dist/diagnostics.js.map +1 -1
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/internal.d.ts +35 -0
  18. package/dist/internal.d.ts.map +1 -1
  19. package/dist/internal.js +24 -15
  20. package/dist/internal.js.map +1 -1
  21. package/dist/ir.d.ts +21 -0
  22. package/dist/ir.d.ts.map +1 -1
  23. package/dist/ir.js.map +1 -1
  24. package/dist/oxc-transform.d.ts +1 -0
  25. package/dist/oxc-transform.d.ts.map +1 -1
  26. package/dist/oxc-transform.js +1 -0
  27. package/dist/oxc-transform.js.map +1 -1
  28. package/dist/oxc.d.ts +4 -0
  29. package/dist/oxc.d.ts.map +1 -1
  30. package/dist/oxc.js +3 -0
  31. package/dist/oxc.js.map +1 -1
  32. package/dist/transform.d.ts +2 -0
  33. package/dist/transform.d.ts.map +1 -1
  34. package/dist/transform.js +2 -0
  35. package/dist/transform.js.map +1 -1
  36. package/dist/types.d.ts +20 -0
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/types.js.map +1 -1
  39. package/package.json +4 -4
  40. package/src/boundary-graph.ts +13 -0
  41. package/src/compiler-module-context.ts +2 -0
  42. package/src/diagnostics.ts +1 -0
  43. package/src/index.ts +2 -0
  44. package/src/internal.ts +35 -15
  45. package/src/ir.ts +21 -0
  46. package/src/oxc-transform.ts +1 -0
  47. package/src/oxc.ts +4 -0
  48. package/src/transform.ts +2 -0
  49. package/src/types.ts +34 -0
package/src/internal.ts CHANGED
@@ -16,6 +16,7 @@ import type {
16
16
  Diagnostic,
17
17
  } from "./types.js";
18
18
 
19
+ /** Configures source code, filename, target, and analysis options for IR generation. */
19
20
  export interface AnalyzeToIrInput {
20
21
  code: string;
21
22
  filename: string;
@@ -23,28 +24,33 @@ export interface AnalyzeToIrInput {
23
24
  options?: AnalyzeModuleOptions;
24
25
  }
25
26
 
27
+ /** Contains the module IR and diagnostics produced by compiler analysis. */
26
28
  export interface AnalyzeToIrOutput {
27
29
  ir: ModuleIr;
28
30
  diagnostics: Diagnostic[];
29
31
  usedTypescriptFallback?: boolean;
30
32
  }
31
33
 
34
+ /** Describes a static import declaration and the local names it introduces. */
32
35
  export interface StaticImportReference {
33
36
  localNames: string[];
34
37
  sideEffect: boolean;
35
38
  source: string;
36
39
  }
37
40
 
41
+ /** Describes one specifier inside a static import declaration. */
38
42
  export interface StaticImportSpecifierReference {
39
43
  importedName: string;
40
44
  kind: "default" | "named" | "namespace";
41
45
  localName: string;
42
46
  }
43
47
 
48
+ /** Describes a static import declaration with its individual specifiers. */
44
49
  export interface ClientRouteStaticImportReference extends StaticImportReference {
45
50
  specifiers: StaticImportSpecifierReference[];
46
51
  }
47
52
 
53
+ /** Describes a static export declaration and the names it exports. */
48
54
  export interface StaticExportReference {
49
55
  exportedNames: string[];
50
56
  exportAll: boolean;
@@ -52,11 +58,13 @@ export interface StaticExportReference {
52
58
  source: string;
53
59
  }
54
60
 
61
+ /** Describes one specifier inside a static export declaration. */
55
62
  export interface StaticExportSpecifierReference {
56
63
  exportedName: string;
57
64
  localName: string;
58
65
  }
59
66
 
67
+ /** Describes render and client-runtime reachability for one top-level export. */
60
68
  export interface TopLevelExportRenderInfo {
61
69
  calledComponentRoots: string[];
62
70
  clientRuntime: boolean;
@@ -64,6 +72,7 @@ export interface TopLevelExportRenderInfo {
64
72
  renderedComponentRoots: string[];
65
73
  }
66
74
 
75
+ /** Summarizes route-module imports, exports, directives, references, and reachable render roots. */
67
76
  export interface ClientRouteModuleAnalysis {
68
77
  clientRuntime: boolean;
69
78
  defaultExportIdentifier: string | undefined;
@@ -81,12 +90,14 @@ export interface ClientRouteModuleAnalysis {
81
90
  topLevelExportRenderInfo: TopLevelExportRenderInfo[];
82
91
  }
83
92
 
93
+ /** Describes a named form action reference and its source span. */
84
94
  export interface FormActionReference {
85
95
  end: number;
86
96
  name: string;
87
97
  start: number;
88
98
  }
89
99
 
100
+ /** Describes a form action expression reference and both wrapper and expression source spans. */
90
101
  export interface FormActionExpressionReference {
91
102
  end: number;
92
103
  expression: string;
@@ -100,10 +111,12 @@ interface ComponentAliasState {
100
111
  stringConstants: Map<string, string>;
101
112
  }
102
113
 
114
+ /** Analyzes source code into compiler IR with diagnostics. */
103
115
  export function analyzeToIr(input: AnalyzeToIrInput): AnalyzeToIrOutput {
104
116
  return analyzeWithOxc(input);
105
117
  }
106
118
 
119
+ /** Analyzes a pre-parsed compiler module context into compiler IR with diagnostics. */
107
120
  export function analyzeCompilerModuleContextToIr(
108
121
  context: CompilerModuleContext,
109
122
  input: Omit<AnalyzeToIrInput, "code" | "filename">,
@@ -111,6 +124,7 @@ export function analyzeCompilerModuleContextToIr(
111
124
  return analyzeCompilerModuleContextWithOxc(context, input);
112
125
  }
113
126
 
127
+ /** Creates a compiler module context from source code and an optional filename. */
114
128
  export function createCompilerModuleContext(input: {
115
129
  code: string;
116
130
  filename?: string | undefined;
@@ -118,6 +132,7 @@ export function createCompilerModuleContext(input: {
118
132
  return createCompilerModuleContextWithOxc(input);
119
133
  }
120
134
 
135
+ /** Checks whether a module declares any of the given names as top-level exports. */
121
136
  export function hasTopLevelExportDeclaration(input: {
122
137
  code: string;
123
138
  filename?: string | undefined;
@@ -131,10 +146,7 @@ export function hasTopLevelExportDeclaration(input: {
131
146
  );
132
147
  }
133
148
 
134
- // Reads the value of a top-level `export const <name> = <boolean literal>`
135
- // declaration. Returns `undefined` when the export is absent or not a boolean
136
- // literal. AST-based so commented-out or string-literal occurrences of the same
137
- // text are not mistaken for a real export.
149
+ /** Reads a top-level exported boolean literal by name, ignoring comments and non-literal values. */
138
150
  export function readTopLevelBooleanExport(input: {
139
151
  code: string;
140
152
  filename?: string | undefined;
@@ -146,8 +158,7 @@ export function readTopLevelBooleanExport(input: {
146
158
  );
147
159
  }
148
160
 
149
- // Context-accepting variant so callers with a cached `CompilerModuleContext`
150
- // (e.g. the dev server) avoid re-parsing the module per request.
161
+ /** Reads a top-level exported boolean literal from a cached compiler module context. */
151
162
  export function readTopLevelBooleanExportFromContext(
152
163
  context: CompilerModuleContext,
153
164
  name: string,
@@ -203,6 +214,7 @@ function booleanExpressionValue(node: Record<string, unknown> | undefined): bool
203
214
  return undefined;
204
215
  }
205
216
 
217
+ /** Removes top-level export declarations for selected names while preserving their values where possible. */
206
218
  export function stripTopLevelExportDeclarations(input: {
207
219
  code: string;
208
220
  filename?: string | undefined;
@@ -223,6 +235,7 @@ export function stripTopLevelExportDeclarations(input: {
223
235
  return code;
224
236
  }
225
237
 
238
+ /** Converts selected top-level export declarations into non-exported declarations. */
226
239
  export function demoteTopLevelExportDeclarations(input: {
227
240
  code: string;
228
241
  filename?: string | undefined;
@@ -243,6 +256,7 @@ export function demoteTopLevelExportDeclarations(input: {
243
256
  return code;
244
257
  }
245
258
 
259
+ /** Removes unused static value imports while preserving side-effect and type-only imports. */
246
260
  export function stripUnusedStaticValueImports(input: {
247
261
  code: string;
248
262
  filename?: string | undefined;
@@ -264,6 +278,7 @@ export function stripUnusedStaticValueImports(input: {
264
278
  return code;
265
279
  }
266
280
 
281
+ /** Collects module specifier strings from static import and export declarations. */
267
282
  export function collectStaticModuleSpecifiers(input: {
268
283
  code: string;
269
284
  filename?: string | undefined;
@@ -273,6 +288,7 @@ export function collectStaticModuleSpecifiers(input: {
273
288
  return programBody(parsed.program).flatMap(staticModuleSpecifier);
274
289
  }
275
290
 
291
+ /** Collects static import declarations and their local binding names. */
276
292
  export function collectStaticImportReferences(input: {
277
293
  code: string;
278
294
  filename?: string | undefined;
@@ -282,6 +298,7 @@ export function collectStaticImportReferences(input: {
282
298
  return programBody(parsed.program).flatMap(staticImportReference);
283
299
  }
284
300
 
301
+ /** Collects static export declarations and their exported names. */
285
302
  export function collectStaticExportReferences(input: {
286
303
  code: string;
287
304
  filename?: string | undefined;
@@ -291,6 +308,7 @@ export function collectStaticExportReferences(input: {
291
308
  return programBody(parsed.program).flatMap(staticExportReference);
292
309
  }
293
310
 
311
+ /** Collects root component names referenced by JSX elements in a module. */
294
312
  export function collectJsxComponentRootNames(input: {
295
313
  code: string;
296
314
  filename?: string | undefined;
@@ -305,6 +323,7 @@ export function collectJsxComponentRootNames(input: {
305
323
  return Array.from(names).sort();
306
324
  }
307
325
 
326
+ /** Collects identifier reference names from a module, excluding declarations. */
308
327
  export function collectIdentifierReferenceNames(input: {
309
328
  code: string;
310
329
  filename?: string | undefined;
@@ -316,15 +335,7 @@ export function collectIdentifierReferenceNames(input: {
316
335
  return Array.from(names).sort();
317
336
  }
318
337
 
319
- // Returns true when the module references a browser global (`window`,
320
- // `document`, `localStorage`) in a position that may execute during server
321
- // rendering. A reference is considered guarded -- and therefore server-safe --
322
- // when it can only evaluate behind a `typeof window !== "undefined"` style
323
- // check: the guarded branch of an if/ternary, the short-circuited side of a
324
- // logical expression, or statements following a guarded early exit. A guard on
325
- // any one browser global covers the others, matching how isomorphic modules
326
- // are written in practice. Alias-tracked guards (`const isBrowser = ...`) are
327
- // not followed; they conservatively report an unguarded reference.
338
+ /** Checks whether browser globals may execute during server rendering without a guard. */
328
339
  export function hasUnguardedBrowserGlobalReference(input: {
329
340
  code: string;
330
341
  filename?: string | undefined;
@@ -334,6 +345,7 @@ export function hasUnguardedBrowserGlobalReference(input: {
334
345
  return hasUnguardedBrowserGlobalReferenceInNode(parsed.program, false);
335
346
  }
336
347
 
348
+ /** Collects unique named form action references from a module. */
337
349
  export function collectFormActionReferenceNames(input: {
338
350
  code: string;
339
351
  filename?: string | undefined;
@@ -343,6 +355,7 @@ export function collectFormActionReferenceNames(input: {
343
355
  ).sort();
344
356
  }
345
357
 
358
+ /** Collects named form action references and their source spans from a module. */
346
359
  export function collectFormActionReferences(input: {
347
360
  code: string;
348
361
  filename?: string | undefined;
@@ -356,6 +369,7 @@ export function collectFormActionReferences(input: {
356
369
  );
357
370
  }
358
371
 
372
+ /** Collects form action expression references and their source spans from a module. */
359
373
  export function collectFormActionExpressionReferences(input: {
360
374
  code: string;
361
375
  filename?: string | undefined;
@@ -371,6 +385,7 @@ export function collectFormActionExpressionReferences(input: {
371
385
  );
372
386
  }
373
387
 
388
+ /** Collects value export names declared at the top level of a module. */
374
389
  export function collectTopLevelValueExportNames(input: {
375
390
  code: string;
376
391
  filename?: string | undefined;
@@ -387,6 +402,7 @@ export function collectTopLevelValueExportNames(input: {
387
402
  return Array.from(names).sort();
388
403
  }
389
404
 
405
+ /** Collects render reachability information for top-level exports in a module. */
390
406
  export function collectTopLevelExportRenderInfo(input: {
391
407
  code: string;
392
408
  filename?: string | undefined;
@@ -396,6 +412,7 @@ export function collectTopLevelExportRenderInfo(input: {
396
412
  return collectTopLevelExportRenderInfoFromProgram(parsed.program);
397
413
  }
398
414
 
415
+ /** Analyzes a route module for directives, static imports, exports, references, and render reachability. */
399
416
  export function collectClientRouteModuleAnalysis(input: {
400
417
  code: string;
401
418
  filename?: string | undefined;
@@ -405,6 +422,7 @@ export function collectClientRouteModuleAnalysis(input: {
405
422
  return collectClientRouteModuleAnalysisFromContext(parsed);
406
423
  }
407
424
 
425
+ /** Analyzes a cached compiler module context for route-module metadata. */
408
426
  export function collectClientRouteModuleAnalysisFromContext(
409
427
  context: CompilerModuleContext,
410
428
  ): ClientRouteModuleAnalysis {
@@ -1016,6 +1034,7 @@ function isNonComputedPropertyKey(node: Record<string, unknown>): boolean {
1016
1034
  );
1017
1035
  }
1018
1036
 
1037
+ /** Checks whether a module begins with a specific directive string. */
1019
1038
  export function hasModuleDirective(input: {
1020
1039
  code: string;
1021
1040
  directive: string;
@@ -1045,6 +1064,7 @@ function hasModuleDirectiveInProgram(program: unknown, expectedDirective: string
1045
1064
  return false;
1046
1065
  }
1047
1066
 
1067
+ /** Checks whether a module contains syntax that requires client runtime execution. */
1048
1068
  export function hasClientRuntimeSyntax(input: {
1049
1069
  code: string;
1050
1070
  filename?: string | undefined;
package/src/ir.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { SourceLocation } from "./types.js";
2
2
 
3
+ /** Represents the compiler intermediate representation for one module. */
3
4
  export interface ModuleIr {
4
5
  userImports: string[];
5
6
  moduleStatements: string[];
@@ -7,6 +8,7 @@ export interface ModuleIr {
7
8
  components: ComponentIr[];
8
9
  }
9
10
 
11
+ /** Represents one component discovered and lowered by compiler analysis. */
10
12
  export interface ComponentIr {
11
13
  name: string;
12
14
  exportName: string;
@@ -19,6 +21,7 @@ export interface ComponentIr {
19
21
  root: JsxNodeIr;
20
22
  }
21
23
 
24
+ /** Represents any JSX node shape supported by the compiler intermediate representation. */
22
25
  export type JsxNodeIr =
23
26
  | JsxElementIr
24
27
  | ComponentRefIr
@@ -29,6 +32,7 @@ export type JsxNodeIr =
29
32
  | ExprIr
30
33
  | AsyncBoundaryIr;
31
34
 
35
+ /** Represents a lowered intrinsic JSX element. */
32
36
  export interface JsxElementIr {
33
37
  kind: "element";
34
38
  tagName: string;
@@ -37,6 +41,7 @@ export interface JsxElementIr {
37
41
  children: JsxNodeIr[];
38
42
  }
39
43
 
44
+ /** Represents a lowered component reference and its props, children, and boundary metadata. */
40
45
  export interface ComponentRefIr {
41
46
  kind: "component";
42
47
  name: string;
@@ -49,20 +54,24 @@ export interface ComponentRefIr {
49
54
  children: JsxNodeIr[];
50
55
  }
51
56
 
57
+ /** Represents a client module reference attached to a component in server output. */
52
58
  export interface ClientReferenceIr {
53
59
  moduleId: string;
54
60
  exportName: string;
55
61
  ssrFallback?: boolean;
56
62
  }
57
63
 
64
+ /** Represents any prop shape supported by a component reference. */
58
65
  export type ComponentPropIr = ComponentNamedPropIr | ComponentRenderPropIr | ComponentSpreadPropIr;
59
66
 
67
+ /** Represents a named component prop with expression code. */
60
68
  export interface ComponentNamedPropIr {
61
69
  kind: "prop";
62
70
  name: string;
63
71
  code: string;
64
72
  }
65
73
 
74
+ /** Represents a render-prop child lowered into the component prop list. */
66
75
  export interface ComponentRenderPropIr {
67
76
  kind: "render-prop";
68
77
  name: string;
@@ -70,17 +79,20 @@ export interface ComponentRenderPropIr {
70
79
  children: JsxNodeIr[];
71
80
  }
72
81
 
82
+ /** Represents a spread prop expression passed to a component reference. */
73
83
  export interface ComponentSpreadPropIr {
74
84
  kind: "spread-prop";
75
85
  code: string;
76
86
  }
77
87
 
88
+ /** Represents a JSX fragment and its lowered children. */
78
89
  export interface JsxFragmentIr {
79
90
  kind: "fragment";
80
91
  bodyStatements?: string[];
81
92
  children: JsxNodeIr[];
82
93
  }
83
94
 
95
+ /** Represents a conditional JSX expression with true and false branches. */
84
96
  export interface ConditionalIr {
85
97
  kind: "conditional";
86
98
  conditionCode: string;
@@ -89,6 +101,7 @@ export interface ConditionalIr {
89
101
  whenFalse: JsxNodeIr[];
90
102
  }
91
103
 
104
+ /** Represents a JSX list rendering expression and its lowered item body. */
92
105
  export interface ListIr {
93
106
  kind: "list";
94
107
  itemsCode: string;
@@ -100,17 +113,20 @@ export interface ListIr {
100
113
  children: JsxNodeIr[];
101
114
  }
102
115
 
116
+ /** Represents static text emitted from JSX. */
103
117
  export interface TextIr {
104
118
  kind: "text";
105
119
  value: string;
106
120
  }
107
121
 
122
+ /** Represents a dynamic expression emitted from JSX. */
108
123
  export interface ExprIr {
109
124
  kind: "expr";
110
125
  code: string;
111
126
  renderMode?: "dynamic" | "html" | "react-node" | "stream-node" | "compat-child";
112
127
  }
113
128
 
129
+ /** Represents an async boundary lowered from an Await-style JSX construct. */
114
130
  export interface AsyncBoundaryIr {
115
131
  kind: "async-boundary";
116
132
  loc?: SourceLocation;
@@ -124,18 +140,21 @@ export interface AsyncBoundaryIr {
124
140
  awaitId?: string;
125
141
  }
126
142
 
143
+ /** Represents any intrinsic attribute shape supported by the compiler IR. */
127
144
  export type AttributeIr =
128
145
  | StaticAttributeIr
129
146
  | DynamicAttributeIr
130
147
  | EventAttributeIr
131
148
  | SpreadAttributeIr;
132
149
 
150
+ /** Represents a static intrinsic attribute. */
133
151
  export interface StaticAttributeIr {
134
152
  kind: "static-attr";
135
153
  name: string;
136
154
  value: string;
137
155
  }
138
156
 
157
+ /** Represents a dynamic intrinsic attribute expression. */
139
158
  export interface DynamicAttributeIr {
140
159
  kind: "dynamic-attr";
141
160
  name: string;
@@ -145,6 +164,7 @@ export interface DynamicAttributeIr {
145
164
  serialization?: "compat";
146
165
  }
147
166
 
167
+ /** Represents an event handler attribute emitted for client hydration. */
148
168
  export interface EventAttributeIr {
149
169
  kind: "event";
150
170
  name: string;
@@ -152,6 +172,7 @@ export interface EventAttributeIr {
152
172
  code: string;
153
173
  }
154
174
 
175
+ /** Represents a spread attribute expression on an intrinsic element. */
155
176
  export interface SpreadAttributeIr {
156
177
  kind: "spread-attr";
157
178
  code: string;
@@ -3,6 +3,7 @@ import { transformSync } from "oxc-transform";
3
3
  const stripTypeScriptCache = new Map<string, string>();
4
4
  const stripTypeScriptCacheLimit = 512;
5
5
 
6
+ /** Removes TypeScript syntax from a snippet with OXC while preserving JSX. */
6
7
  export function stripTypeScriptWithOxc(source: string): string {
7
8
  if (!needsTypeScriptStripping(source)) {
8
9
  return source.trimEnd();
package/src/oxc.ts CHANGED
@@ -95,6 +95,7 @@ import {
95
95
  import { containsRawJsxInIr } from "./oxc-raw-jsx.js";
96
96
  import type { AnalyzeModuleOptions, CompileTarget, Diagnostic } from "./types.js";
97
97
 
98
+ /** Reports OXC analysis parity data used by compiler migration and diagnostics tests. */
98
99
  export interface OxcParityResult {
99
100
  matches: boolean;
100
101
  oxc: {
@@ -151,6 +152,7 @@ function createOxcChildAnalysisContext(
151
152
  };
152
153
  }
153
154
 
155
+ /** Compares OXC component discovery and IR output against parity expectations for one module. */
154
156
  export function analyzeOxcParity(input: AnalyzeToIrInput): OxcParityResult {
155
157
  const oxc = parseSync(input.filename, input.code, {
156
158
  lang: "tsx",
@@ -182,6 +184,7 @@ export function analyzeOxcParity(input: AnalyzeToIrInput): OxcParityResult {
182
184
  };
183
185
  }
184
186
 
187
+ /** Analyzes source code into compiler IR using OXC parsing and lowering. */
185
188
  export function analyzeWithOxc(input: AnalyzeToIrInput): AnalyzeToIrOutput {
186
189
  return analyzeCompilerModuleContextWithOxc(createCompilerModuleContextWithOxc(input), {
187
190
  target: input.target,
@@ -189,6 +192,7 @@ export function analyzeWithOxc(input: AnalyzeToIrInput): AnalyzeToIrOutput {
189
192
  });
190
193
  }
191
194
 
195
+ /** Analyzes a cached OXC compiler module context into compiler IR. */
192
196
  export function analyzeCompilerModuleContextWithOxc(
193
197
  context: CompilerModuleContext,
194
198
  input: Omit<AnalyzeToIrInput, "code" | "filename">,
package/src/transform.ts CHANGED
@@ -15,6 +15,7 @@ import type {
15
15
  TransformOutput,
16
16
  } from "./types.js";
17
17
 
18
+ /** Compiles one mreact source module into client or server JavaScript output. */
18
19
  export function transform(input: TransformInput): TransformOutput {
19
20
  return transformWithAnalyzer(input, (analyzeTarget, analyzeOptions) =>
20
21
  analyzeWithOxc({
@@ -26,6 +27,7 @@ export function transform(input: TransformInput): TransformOutput {
26
27
  );
27
28
  }
28
29
 
30
+ /** Compiles a pre-parsed compiler module context into client or server JavaScript output. */
29
31
  export function transformCompilerModuleContext(
30
32
  input: TransformInput & { moduleContext: CompilerModuleContext },
31
33
  ): TransformOutput {
package/src/types.ts CHANGED
@@ -15,14 +15,25 @@ import type {
15
15
  TransformOutput as SharedTransformOutput,
16
16
  } from "@reckona/mreact-shared/compiler-contract";
17
17
 
18
+ /** Names whether the compiler emits client or server output. */
18
19
  export type CompileTarget = SharedCompileTarget;
20
+
21
+ /** Names the server renderer output format produced by the compiler. */
19
22
  export type ServerOutputMode = SharedServerOutputMode;
23
+
24
+ /** Names how the server renderer should emit bootstrap scripts. */
20
25
  export type ServerBootstrapMode = SharedServerBootstrapMode;
26
+
27
+ /** Names the parser backend used by the compiler. */
21
28
  export type ParserMode = "oxc";
29
+
30
+ /** Names the frontend implementation that produced compiler metadata. */
22
31
  export type CompilerFrontend = SharedCompilerFrontend;
23
32
 
33
+ /** Names how JSX found in component body statements should be lowered. */
24
34
  export type BodyStatementJsxMode = "dom-node" | "compat-object" | "server-string" | "unsupported";
25
35
 
36
+ /** Configures lower-level module analysis before code emission. */
26
37
  export interface AnalyzeModuleOptions {
27
38
  topLevelJsx?: "diagnostic" | "compat-object" | "server-string";
28
39
  bodyStatementJsx?: BodyStatementJsxMode;
@@ -34,6 +45,7 @@ export interface AnalyzeModuleOptions {
34
45
  compatReactNodeReturnRenderMode?: "react-node";
35
46
  }
36
47
 
48
+ /** Configures a single compiler transform call. */
37
49
  export interface TransformInput {
38
50
  code: string;
39
51
  filename: string;
@@ -54,19 +66,41 @@ export interface TransformInput {
54
66
  reactSuspenseRevealScriptSrc?: string;
55
67
  }
56
68
 
69
+ /** Configures imports for the server HTML escape helper emitted by the compiler. */
57
70
  export interface ServerEscapeOptions {
58
71
  batchImportName: string;
59
72
  batchImportSource: string;
60
73
  }
61
74
 
75
+ /** Describes emitted code, source map data, diagnostics, and metadata from a transform. */
62
76
  export type TransformOutput = SharedTransformOutput;
77
+
78
+ /** Describes a compiler diagnostic message. */
63
79
  export type Diagnostic = SharedDiagnostic;
80
+
81
+ /** Describes a suggested fix attached to a compiler diagnostic. */
64
82
  export type DiagnosticSuggestion = SharedDiagnosticSuggestion;
83
+
84
+ /** Describes a one-based source location for diagnostics and metadata. */
65
85
  export type SourceLocation = SharedSourceLocation;
86
+
87
+ /** Describes metadata collected for one transformed module. */
66
88
  export type ModuleMetadata = SharedModuleMetadata;
89
+
90
+ /** Describes compiler frontend metadata for one transformed module. */
67
91
  export type CompilerMetadata = SharedModuleMetadata["compiler"];
92
+
93
+ /** Describes a client boundary reference discovered during compilation. */
68
94
  export type ClientReferenceMetadata = SharedClientReferenceMetadata;
95
+
96
+ /** Describes one compiled component discovered in a module. */
69
97
  export type ComponentMetadata = SharedComponentMetadata;
98
+
99
+ /** Describes a runtime import required by emitted compiler output. */
70
100
  export type RuntimeImport = SharedRuntimeImport;
101
+
102
+ /** Describes event hydration metadata emitted for server-rendered handlers. */
71
103
  export type EventHydrationManifestMetadata = SharedEventHydrationManifestMetadata;
104
+
105
+ /** Describes one event hydration entry in a compiler metadata manifest. */
72
106
  export type EventHydrationEntryMetadata = SharedEventHydrationEntryMetadata;