@reckona/mreact-compiler 0.0.160 → 0.0.162

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 (58) 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/emit-server-stream.d.ts.map +1 -1
  14. package/dist/emit-server-stream.js +70 -4
  15. package/dist/emit-server-stream.js.map +1 -1
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/internal.d.ts +35 -0
  21. package/dist/internal.d.ts.map +1 -1
  22. package/dist/internal.js +24 -15
  23. package/dist/internal.js.map +1 -1
  24. package/dist/ir.d.ts +21 -0
  25. package/dist/ir.d.ts.map +1 -1
  26. package/dist/ir.js.map +1 -1
  27. package/dist/oxc-compat-create-element.d.ts +2 -0
  28. package/dist/oxc-compat-create-element.d.ts.map +1 -1
  29. package/dist/oxc-compat-create-element.js +93 -18
  30. package/dist/oxc-compat-create-element.js.map +1 -1
  31. package/dist/oxc-transform.d.ts +1 -0
  32. package/dist/oxc-transform.d.ts.map +1 -1
  33. package/dist/oxc-transform.js +1 -0
  34. package/dist/oxc-transform.js.map +1 -1
  35. package/dist/oxc.d.ts +4 -0
  36. package/dist/oxc.d.ts.map +1 -1
  37. package/dist/oxc.js +180 -21
  38. package/dist/oxc.js.map +1 -1
  39. package/dist/transform.d.ts +2 -0
  40. package/dist/transform.d.ts.map +1 -1
  41. package/dist/transform.js +2 -0
  42. package/dist/transform.js.map +1 -1
  43. package/dist/types.d.ts +20 -0
  44. package/dist/types.d.ts.map +1 -1
  45. package/dist/types.js.map +1 -1
  46. package/package.json +2 -2
  47. package/src/boundary-graph.ts +13 -0
  48. package/src/compiler-module-context.ts +2 -0
  49. package/src/diagnostics.ts +1 -0
  50. package/src/emit-server-stream.ts +103 -8
  51. package/src/index.ts +2 -0
  52. package/src/internal.ts +35 -15
  53. package/src/ir.ts +21 -0
  54. package/src/oxc-compat-create-element.ts +132 -25
  55. package/src/oxc-transform.ts +1 -0
  56. package/src/oxc.ts +330 -12
  57. package/src/transform.ts +2 -0
  58. package/src/types.ts +34 -0
package/dist/oxc.js CHANGED
@@ -13,7 +13,7 @@ import { collectOxcAsyncComponentNames, collectOxcExportedComponents, collectOxc
13
13
  import { collectOxcClientBoundaryImportComponents, collectOxcCompatReactNodeComponentReferences, collectOxcCompatRuntimeImportComponents, markOxcAsyncComponentReferences, markOxcClientReferences, markOxcCompatReactNodeReferences, markOxcCompatRuntimeReferences, } from "./oxc-component-references.js";
14
14
  import { normalizeOxcExpressionCode, stripOxcGeneratedImports } from "./oxc-code-utils.js";
15
15
  import { analyzeOxcExpressionChild, analyzeOxcJsxNode, } from "./oxc-child-analysis.js";
16
- import { analyzeCompatCreateElementRoot, collectCompatCreateElementNames, collectFunctionShadowedNames, hasLowerableCompatCreateElementReturn, } from "./oxc-compat-create-element.js";
16
+ import { analyzeCompatCreateElementFunctionRoot, analyzeCompatCreateElementRoot, collectCompatCreateElementNames, collectCompatRenderToStringNames, collectFunctionShadowedNames, hasLowerableCompatCreateElementReturn, } from "./oxc-compat-create-element.js";
17
17
  import { lowerOxcDomNodeExpression } from "./oxc-dom-lowering.js";
18
18
  import { lowerOxcCompatObjectExpression, lowerOxcCompatReactNodeExpression, lowerOxcNestedJsxExpression, lowerOxcServerStringExpression, } from "./oxc-nested-lowering.js";
19
19
  import { isOxcJsxBranch, readOxcReturnExpressionFromStatement } from "./oxc-expression-utils.js";
@@ -41,6 +41,7 @@ function createOxcChildAnalysisContext(componentNames, target, diagnostics, body
41
41
  lowerNestedJsxExpression: lowerOxcNestedJsxExpression,
42
42
  };
43
43
  }
44
+ /** Compares OXC component discovery and IR output against parity expectations for one module. */
44
45
  export function analyzeOxcParity(input) {
45
46
  const oxc = parseSync(input.filename, input.code, {
46
47
  lang: "tsx",
@@ -66,12 +67,14 @@ export function analyzeOxcParity(input) {
66
67
  },
67
68
  };
68
69
  }
70
+ /** Analyzes source code into compiler IR using OXC parsing and lowering. */
69
71
  export function analyzeWithOxc(input) {
70
72
  return analyzeCompilerModuleContextWithOxc(createCompilerModuleContextWithOxc(input), {
71
73
  target: input.target,
72
74
  ...(input.options === undefined ? {} : { options: input.options }),
73
75
  });
74
76
  }
77
+ /** Analyzes a cached OXC compiler module context into compiler IR. */
75
78
  export function analyzeCompilerModuleContextWithOxc(context, input) {
76
79
  const analyzed = analyzeOxcToIr(context.code, context.program, input.target, input.options);
77
80
  return {
@@ -108,10 +111,13 @@ function analyzeOxcToIr(code, program, target, options) {
108
111
  ? collectOxcCompatReactNodeComponentReferences(program)
109
112
  : undefined;
110
113
  const localJsxReturnFunctionNames = target === "server" ? collectOxcLocalJsxReturnFunctionNames(program) : new Set();
111
- // Stream emit keeps interpreting compat trees for now; only the string
112
- // pipeline lowers createElement calls.
113
- const compatCreateElementNames = target === "server" && options?.serverOutput !== "stream"
114
- ? collectCompatCreateElementNames(program)
114
+ const compatCreateElementNames = target === "server" ? collectCompatCreateElementNames(program) : new Set();
115
+ const compatRenderToStringNames = target === "server" ? collectCompatRenderToStringNames(program) : new Set();
116
+ const compatCreateElementLocalFunctionLikes = target === "server"
117
+ ? collectCompatCreateElementLocalFunctionLikes(program)
118
+ : new Map();
119
+ const compatRenderToStringLowerableTargets = target === "server"
120
+ ? collectCompatRenderToStringLowerableTargets(code, body, compatCreateElementNames, compatRenderToStringNames, compatCreateElementLocalFunctionLikes)
115
121
  : new Set();
116
122
  const localJsxHelperHtmlParameters = target === "server"
117
123
  ? collectLocalJsxHelperHtmlParameters(program, localJsxReturnFunctionNames)
@@ -133,7 +139,7 @@ function analyzeOxcToIr(code, program, target, options) {
133
139
  continue;
134
140
  }
135
141
  if (isOxcJsxComponentStatement(statement, localJsxReturnFunctionNames) ||
136
- isCompatCreateElementComponentStatement(code, statement, compatCreateElementNames) ||
142
+ isCompatCreateElementComponentStatement(code, statement, compatCreateElementNames, compatRenderToStringNames, compatCreateElementLocalFunctionLikes, compatRenderToStringLowerableTargets, options?.serverOutput) ||
137
143
  (options?.compatReactNodeReturn === true && isOxcExportedFunctionLike(statement))) {
138
144
  const declaration = readObject(readObject(statement).declaration);
139
145
  if (declaration.type === "VariableDeclaration") {
@@ -171,7 +177,7 @@ function analyzeOxcToIr(code, program, target, options) {
171
177
  const componentNames = componentNamesFromProgram(program, moduleBindingNames);
172
178
  const componentCallNames = options?.serverOutput === "stream" ? componentCallNamesFromProgram(program) : undefined;
173
179
  const asyncComponentNames = collectOxcAsyncComponentNames(program);
174
- const components = body.flatMap((statement) => analyzeOxcComponent(code, statement, componentNames, target, diagnostics, options?.bodyStatementJsx ?? "dom-node", compatCreateElementNames, moduleRenderValueBindings, options?.compatReactNodeReturn === true, options?.serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters));
180
+ const components = body.flatMap((statement) => analyzeOxcComponent(code, statement, componentNames, target, diagnostics, options?.bodyStatementJsx ?? "dom-node", compatCreateElementNames, compatRenderToStringNames, compatCreateElementLocalFunctionLikes, compatRenderToStringLowerableTargets, moduleRenderValueBindings, options?.compatReactNodeReturn === true, options?.serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters));
175
181
  for (const component of components) {
176
182
  markOxcAsyncComponentReferences(component.root, asyncComponentNames);
177
183
  markOxcClientReferences(component.root, clientBoundaryImports);
@@ -302,47 +308,198 @@ function readCompatCreateElementPlainComponent(code, statement, names) {
302
308
  }
303
309
  return undefined;
304
310
  }
305
- function isCompatCreateElementComponentStatement(code, statement, names) {
306
- if (names.size === 0) {
311
+ function collectCompatCreateElementLocalFunctionLikes(program) {
312
+ const functionLikes = new Map();
313
+ for (const statement of readArray(readObject(program).body)) {
314
+ const object = readObject(statement);
315
+ const declaration = object.type === "ExportNamedDeclaration" ? readObject(object.declaration) : object;
316
+ if (declaration.type === "FunctionDeclaration") {
317
+ const id = readObject(declaration.id);
318
+ if (typeof id.name === "string") {
319
+ functionLikes.set(id.name, declaration);
320
+ }
321
+ continue;
322
+ }
323
+ if (declaration.type !== "VariableDeclaration") {
324
+ continue;
325
+ }
326
+ for (const declarator of readArray(declaration.declarations)) {
327
+ const declaratorObject = readObject(declarator);
328
+ const id = readObject(declaratorObject.id);
329
+ const initializer = unwrapOxcComponentFunctionLikeInitializer(readObject(declaratorObject.init));
330
+ if (typeof id.name === "string" && initializer !== undefined) {
331
+ functionLikes.set(id.name, initializer);
332
+ }
333
+ }
334
+ }
335
+ return functionLikes;
336
+ }
337
+ function collectCompatRenderToStringLowerableTargets(code, body, createElementNames, renderToStringNames, localFunctionLikes) {
338
+ const targets = new Set();
339
+ if (createElementNames.size === 0 || renderToStringNames.size === 0) {
340
+ return targets;
341
+ }
342
+ for (const statement of body) {
343
+ const functionLike = unwrapOxcStatementFunctionLike(statement);
344
+ if (functionLike === undefined) {
345
+ continue;
346
+ }
347
+ const targetName = readCompatRenderToStringWrapperTargetName(code, functionLike, renderToStringNames);
348
+ const targetFunctionLike = targetName === undefined ? undefined : localFunctionLikes.get(targetName);
349
+ if (targetName !== undefined &&
350
+ targetFunctionLike !== undefined &&
351
+ analyzeCompatCreateElementFunctionRoot(code, targetFunctionLike, createElementNames) !==
352
+ undefined) {
353
+ targets.add(targetName);
354
+ }
355
+ }
356
+ return targets;
357
+ }
358
+ function unwrapOxcStatementFunctionLike(statement) {
359
+ const object = readObject(statement);
360
+ const declaration = object.type === "ExportNamedDeclaration" || object.type === "ExportDefaultDeclaration"
361
+ ? readObject(object.declaration)
362
+ : object;
363
+ if (declaration.type === "FunctionDeclaration") {
364
+ return declaration;
365
+ }
366
+ if (declaration.type !== "VariableDeclaration") {
367
+ return unwrapOxcComponentFunctionLikeInitializer(declaration);
368
+ }
369
+ for (const declarator of readArray(declaration.declarations)) {
370
+ const initializer = unwrapOxcComponentFunctionLikeInitializer(readObject(readObject(declarator).init));
371
+ if (initializer !== undefined) {
372
+ return initializer;
373
+ }
374
+ }
375
+ return undefined;
376
+ }
377
+ function readCompatRenderToStringWrapperTargetName(code, functionLike, renderToStringNames) {
378
+ const expression = readCompatRenderToStringWrapperReturnExpression(functionLike);
379
+ if (expression === undefined) {
380
+ return undefined;
381
+ }
382
+ return readCompatRenderToStringTargetName(expression, renderToStringNames, collectFunctionShadowedNames(functionLike, renderToStringNames));
383
+ }
384
+ function readCompatRenderToStringWrapperReturnExpression(functionLike) {
385
+ const body = unwrapOxcParentheses(readObject(functionLike.body));
386
+ if (body.type !== "BlockStatement") {
387
+ return body;
388
+ }
389
+ for (const statement of readArray(body.body)) {
390
+ const statementObject = readObject(statement);
391
+ if (statementObject.type === "ReturnStatement") {
392
+ return unwrapOxcParentheses(readObject(statementObject.argument));
393
+ }
394
+ }
395
+ return undefined;
396
+ }
397
+ function readCompatRenderToStringTargetName(expression, renderToStringNames, shadowedNames) {
398
+ if (renderToStringNames.size === 0 ||
399
+ expression.type !== "CallExpression" ||
400
+ expression.optional === true) {
401
+ return undefined;
402
+ }
403
+ const callee = unwrapOxcParentheses(readObject(expression.callee));
404
+ if (callee.type !== "Identifier" ||
405
+ typeof callee.name !== "string" ||
406
+ !renderToStringNames.has(callee.name) ||
407
+ shadowedNames.has(callee.name)) {
408
+ return undefined;
409
+ }
410
+ const args = readArray(expression.arguments);
411
+ if (args.length !== 1) {
412
+ return undefined;
413
+ }
414
+ const target = unwrapOxcParentheses(readObject(args[0]));
415
+ return target.type === "Identifier" && typeof target.name === "string" ? target.name : undefined;
416
+ }
417
+ function hasCompatRenderToStringWrapperReturn(code, functionLike, renderToStringNames) {
418
+ return (readCompatRenderToStringWrapperTargetName(code, functionLike, renderToStringNames) !== undefined);
419
+ }
420
+ function analyzeCompatRenderToStringWrapperRoot(code, functionLike, returnExpression, createElementNames, renderToStringNames, localFunctionLikes) {
421
+ const targetName = readCompatRenderToStringTargetName(returnExpression, renderToStringNames, collectFunctionShadowedNames(functionLike, renderToStringNames));
422
+ if (targetName === undefined) {
423
+ return undefined;
424
+ }
425
+ const targetFunctionLike = localFunctionLikes.get(targetName);
426
+ const lowered = targetFunctionLike === undefined
427
+ ? undefined
428
+ : analyzeCompatCreateElementFunctionRoot(code, targetFunctionLike, createElementNames);
429
+ if (lowered !== undefined) {
430
+ return lowered;
431
+ }
432
+ return {
433
+ kind: "expr",
434
+ code: normalizeOxcExpressionCode(readSource(code, returnExpression)),
435
+ renderMode: "html",
436
+ };
437
+ }
438
+ function isCompatCreateElementComponentStatement(code, statement, names, renderToStringNames, localFunctionLikes, renderToStringLowerableTargets, serverOutput) {
439
+ if (names.size === 0 && renderToStringNames.size === 0) {
307
440
  return false;
308
441
  }
309
442
  const object = readObject(statement);
310
443
  if (object.type === "ExportDefaultDeclaration") {
311
- return readCompatCreateElementFunctionLike(code, readObject(object.declaration), names) !== undefined;
444
+ const functionLike = unwrapOxcComponentFunctionLikeInitializer(readObject(object.declaration));
445
+ return (readCompatCreateElementFunctionLike(code, readObject(object.declaration), names) !==
446
+ undefined ||
447
+ (functionLike !== undefined &&
448
+ hasCompatRenderToStringWrapperReturn(code, functionLike, renderToStringNames)));
312
449
  }
313
450
  if (object.type === "ExportNamedDeclaration") {
314
451
  const declaration = readObject(object.declaration);
315
452
  if (declaration.type === "FunctionDeclaration") {
316
- return hasLowerableCompatCreateElementReturn(code, declaration, names);
453
+ return (hasLowerableCompatCreateElementReturn(code, declaration, names) ||
454
+ hasCompatRenderToStringWrapperReturn(code, declaration, renderToStringNames));
317
455
  }
318
456
  return readCompatCreateElementPlainComponent(code, declaration, names) !== undefined;
319
457
  }
320
- return readCompatCreateElementPlainComponent(code, statement, names) !== undefined;
458
+ const plainComponent = readCompatCreateElementPlainComponent(code, statement, names);
459
+ if (serverOutput === "stream") {
460
+ return (plainComponent !== undefined &&
461
+ renderToStringLowerableTargets.has(plainComponent.name) &&
462
+ localFunctionLikes.get(plainComponent.name) === plainComponent.initializer);
463
+ }
464
+ if (plainComponent !== undefined) {
465
+ return true;
466
+ }
467
+ const functionLike = unwrapOxcStatementFunctionLike(statement);
468
+ if (functionLike === undefined) {
469
+ return false;
470
+ }
471
+ return hasCompatRenderToStringWrapperReturn(code, functionLike, renderToStringNames);
321
472
  }
322
- function analyzeOxcComponent(code, statement, componentNames, target, diagnostics, bodyStatementJsx, compatCreateElementNames, moduleRenderValueBindings, compatReactNodeReturn, serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters) {
473
+ function analyzeOxcComponent(code, statement, componentNames, target, diagnostics, bodyStatementJsx, compatCreateElementNames, compatRenderToStringNames, compatCreateElementLocalFunctionLikes, compatRenderToStringLowerableTargets, moduleRenderValueBindings, compatReactNodeReturn, serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters) {
323
474
  const object = readObject(statement);
324
475
  if (object.type === "ExportDefaultDeclaration") {
325
476
  const declaration = unwrapOxcComponentFunctionLikeInitializer(readObject(object.declaration));
326
477
  if (declaration === undefined ||
327
478
  (!hasOxcFunctionLikeComponentReturn(declaration) &&
328
- !hasLowerableCompatCreateElementReturn(code, declaration, compatCreateElementNames))) {
479
+ !hasLowerableCompatCreateElementReturn(code, declaration, compatCreateElementNames) &&
480
+ !hasCompatRenderToStringWrapperReturn(code, declaration, compatRenderToStringNames))) {
329
481
  return [];
330
482
  }
331
483
  const id = readObject(declaration.id);
332
484
  const name = typeof id.name === "string" ? id.name : "DefaultExport";
333
485
  return [
334
- analyzeOxcFunctionLikeComponent(code, name, declaration, "default", componentNames, target, diagnostics, bodyStatementJsx, compatCreateElementNames, moduleRenderValueBindings, compatReactNodeReturn, serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters, true),
486
+ analyzeOxcFunctionLikeComponent(code, name, declaration, "default", componentNames, target, diagnostics, bodyStatementJsx, compatCreateElementNames, compatRenderToStringNames, compatCreateElementLocalFunctionLikes, moduleRenderValueBindings, compatReactNodeReturn, serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters, true),
335
487
  ];
336
488
  }
337
489
  if (object.type !== "ExportNamedDeclaration") {
338
490
  const plainComponent = readOxcPlainComponent(statement) ??
339
- readCompatCreateElementPlainComponent(code, statement, compatCreateElementNames);
491
+ (serverOutput === "stream"
492
+ ? undefined
493
+ : readCompatCreateElementPlainComponent(code, statement, compatCreateElementNames));
340
494
  if (plainComponent === undefined) {
341
495
  return [];
342
496
  }
497
+ if (compatRenderToStringLowerableTargets.has(plainComponent.name)) {
498
+ return [];
499
+ }
343
500
  return [
344
501
  {
345
- ...analyzeOxcFunctionLikeComponent(code, plainComponent.name, plainComponent.initializer, plainComponent.name, componentNames, target, diagnostics, bodyStatementJsx, compatCreateElementNames, moduleRenderValueBindings, compatReactNodeReturn, serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters),
502
+ ...analyzeOxcFunctionLikeComponent(code, plainComponent.name, plainComponent.initializer, plainComponent.name, componentNames, target, diagnostics, bodyStatementJsx, compatCreateElementNames, compatRenderToStringNames, compatCreateElementLocalFunctionLikes, moduleRenderValueBindings, compatReactNodeReturn, serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters),
346
503
  exported: false,
347
504
  },
348
505
  ];
@@ -355,14 +512,15 @@ function analyzeOxcComponent(code, statement, componentNames, target, diagnostic
355
512
  return [];
356
513
  }
357
514
  return [
358
- analyzeOxcFunctionLikeComponent(code, variableComponent.name, variableComponent.initializer, variableComponent.name, componentNames, target, diagnostics, bodyStatementJsx, compatCreateElementNames, moduleRenderValueBindings, compatReactNodeReturn, serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters),
515
+ analyzeOxcFunctionLikeComponent(code, variableComponent.name, variableComponent.initializer, variableComponent.name, componentNames, target, diagnostics, bodyStatementJsx, compatCreateElementNames, compatRenderToStringNames, compatCreateElementLocalFunctionLikes, moduleRenderValueBindings, compatReactNodeReturn, serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters),
359
516
  ];
360
517
  }
361
518
  if (declaration.type !== "FunctionDeclaration" ||
362
519
  (!compatReactNodeReturn &&
363
520
  !hasComponentReturn(declaration.body) &&
364
521
  !hasLocalJsxHelperCallReturn(declaration.body, localJsxReturnFunctionNames) &&
365
- !hasLowerableCompatCreateElementReturn(code, declaration, compatCreateElementNames))) {
522
+ !hasLowerableCompatCreateElementReturn(code, declaration, compatCreateElementNames) &&
523
+ !hasCompatRenderToStringWrapperReturn(code, declaration, compatRenderToStringNames))) {
366
524
  return [];
367
525
  }
368
526
  const id = readObject(declaration.id);
@@ -370,7 +528,7 @@ function analyzeOxcComponent(code, statement, componentNames, target, diagnostic
370
528
  return [];
371
529
  }
372
530
  return [
373
- analyzeOxcFunctionLikeComponent(code, id.name, declaration, id.name, componentNames, target, diagnostics, bodyStatementJsx, compatCreateElementNames, moduleRenderValueBindings, compatReactNodeReturn, serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters),
531
+ analyzeOxcFunctionLikeComponent(code, id.name, declaration, id.name, componentNames, target, diagnostics, bodyStatementJsx, compatCreateElementNames, compatRenderToStringNames, compatCreateElementLocalFunctionLikes, moduleRenderValueBindings, compatReactNodeReturn, serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters),
374
532
  ];
375
533
  }
376
534
  function lowerOxcLocalJsxHelperCallExpressionCode(code, expression, componentNames, target, diagnostics, bodyLowerers) {
@@ -385,7 +543,7 @@ function lowerOxcLocalJsxHelperCallExpressionCode(code, expression, componentNam
385
543
  });
386
544
  return `${readSource(code, readObject(expression.callee))}(${args.join(", ")})`;
387
545
  }
388
- function analyzeOxcFunctionLikeComponent(code, name, functionLike, exportName, componentNames, target, diagnostics, bodyStatementJsx, compatCreateElementNames, moduleRenderValueBindings, compatReactNodeReturn, serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters, exportDefault = false) {
546
+ function analyzeOxcFunctionLikeComponent(code, name, functionLike, exportName, componentNames, target, diagnostics, bodyStatementJsx, compatCreateElementNames, compatRenderToStringNames, compatCreateElementLocalFunctionLikes, moduleRenderValueBindings, compatReactNodeReturn, serverOutput, componentCallNames, bodyLowerers, reactiveDerivedFunctionNames, localJsxReturnFunctionNames, localJsxHelperHtmlParameters, exportDefault = false) {
389
547
  const functionBody = readObject(functionLike.body);
390
548
  const body = functionBody.type === "BlockStatement" ? readArray(functionBody.body) : [];
391
549
  const earlyIfRootReturn = bodyStatementJsx === "compat-object"
@@ -424,6 +582,7 @@ function analyzeOxcFunctionLikeComponent(code, name, functionLike, exportName, c
424
582
  names: compatCreateElementNames,
425
583
  shadowed: collectFunctionShadowedNames(functionLike, compatCreateElementNames),
426
584
  })) ??
585
+ analyzeCompatRenderToStringWrapperRoot(code, functionLike, returnExpression, compatCreateElementNames, compatRenderToStringNames, compatCreateElementLocalFunctionLikes) ??
427
586
  (isJsxRoot(returnExpression.type) || returnExpression.type === "JSXFragment"
428
587
  ? analyzeOxcJsxNode(code, returnExpression, childAnalysisContext)
429
588
  : isOxcComponentCallExpression(returnExpression)