@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.
- package/dist/boundary-graph.d.ts +13 -0
- package/dist/boundary-graph.d.ts.map +1 -1
- package/dist/boundary-graph.js +1 -0
- package/dist/boundary-graph.js.map +1 -1
- package/dist/compiler-module-context.d.ts +2 -0
- package/dist/compiler-module-context.d.ts.map +1 -1
- package/dist/compiler-module-context.js +1 -0
- package/dist/compiler-module-context.js.map +1 -1
- package/dist/diagnostics.d.ts +1 -0
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +1 -0
- package/dist/diagnostics.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +35 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +24 -15
- package/dist/internal.js.map +1 -1
- package/dist/ir.d.ts +21 -0
- package/dist/ir.d.ts.map +1 -1
- package/dist/ir.js.map +1 -1
- package/dist/oxc-transform.d.ts +1 -0
- package/dist/oxc-transform.d.ts.map +1 -1
- package/dist/oxc-transform.js +1 -0
- package/dist/oxc-transform.js.map +1 -1
- package/dist/oxc.d.ts +4 -0
- package/dist/oxc.d.ts.map +1 -1
- package/dist/oxc.js +3 -0
- package/dist/oxc.js.map +1 -1
- package/dist/transform.d.ts +2 -0
- package/dist/transform.d.ts.map +1 -1
- package/dist/transform.js +2 -0
- package/dist/transform.js.map +1 -1
- package/dist/types.d.ts +20 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +4 -4
- package/src/boundary-graph.ts +13 -0
- package/src/compiler-module-context.ts +2 -0
- package/src/diagnostics.ts +1 -0
- package/src/index.ts +2 -0
- package/src/internal.ts +35 -15
- package/src/ir.ts +21 -0
- package/src/oxc-transform.ts +1 -0
- package/src/oxc.ts +4 -0
- package/src/transform.ts +2 -0
- package/src/types.ts +34 -0
package/dist/transform.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { CompilerModuleContext } from "./internal.js";
|
|
2
2
|
import type { TransformInput, TransformOutput } from "./types.js";
|
|
3
|
+
/** Compiles one mreact source module into client or server JavaScript output. */
|
|
3
4
|
export declare function transform(input: TransformInput): TransformOutput;
|
|
5
|
+
/** Compiles a pre-parsed compiler module context into client or server JavaScript output. */
|
|
4
6
|
export declare function transformCompilerModuleContext(input: TransformInput & {
|
|
5
7
|
moduleContext: CompilerModuleContext;
|
|
6
8
|
}): TransformOutput;
|
package/dist/transform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAuC,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEhG,OAAO,KAAK,EAIV,cAAc,EACd,eAAe,EAChB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,CAShE;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,cAAc,GAAG;IAAE,aAAa,EAAE,qBAAqB,CAAA;CAAE,GAC/D,eAAe,CAWjB;AAmeD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgB/C"}
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAuC,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEhG,OAAO,KAAK,EAIV,cAAc,EACd,eAAe,EAChB,MAAM,YAAY,CAAC;AAEpB,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,CAShE;AAED,6FAA6F;AAC7F,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,cAAc,GAAG;IAAE,aAAa,EAAE,qBAAqB,CAAA;CAAE,GAC/D,eAAe,CAWjB;AAmeD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgB/C"}
|
package/dist/transform.js
CHANGED
|
@@ -4,6 +4,7 @@ import { emitServer } from "./emit-server.js";
|
|
|
4
4
|
import { emitServerStream } from "./emit-server-stream.js";
|
|
5
5
|
import { analyzeCompilerModuleContextWithOxc, analyzeWithOxc } from "./oxc.js";
|
|
6
6
|
import { unsupportedClientAsyncComponentDiagnostic } from "./diagnostics.js";
|
|
7
|
+
/** Compiles one mreact source module into client or server JavaScript output. */
|
|
7
8
|
export function transform(input) {
|
|
8
9
|
return transformWithAnalyzer(input, (analyzeTarget, analyzeOptions) => analyzeWithOxc({
|
|
9
10
|
code: input.code,
|
|
@@ -12,6 +13,7 @@ export function transform(input) {
|
|
|
12
13
|
options: analyzeOptions,
|
|
13
14
|
}));
|
|
14
15
|
}
|
|
16
|
+
/** Compiles a pre-parsed compiler module context into client or server JavaScript output. */
|
|
15
17
|
export function transformCompilerModuleContext(input) {
|
|
16
18
|
if (input.moduleContext.code !== input.code || input.moduleContext.filename !== input.filename) {
|
|
17
19
|
throw new Error("Transform input moduleContext must match the input code and filename.");
|
package/dist/transform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,mCAAmC,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/E,OAAO,EAAE,yCAAyC,EAAE,MAAM,kBAAkB,CAAC;AAY7E,MAAM,UAAU,SAAS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,eAAyB,EACzB,4BAAqC;IAErC,OAAO;QACL,eAAe;QACf,GAAG,CAAC,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,CAAC;QACvE,GAAG,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC;QACnE,GAAG,CAAC,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC;QAC7D,GAAG,CAAC,4BAA4B,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,4BAA4B,EAAE,CAAC;KACxF,CAAC;AACJ,CAAC","sourcesContent":["import { emitClient } from \"./emit-client.js\";\nimport { emitCompat } from \"./emit-compat.js\";\nimport { emitServer } from \"./emit-server.js\";\nimport { emitServerStream } from \"./emit-server-stream.js\";\nimport { analyzeCompilerModuleContextWithOxc, analyzeWithOxc } from \"./oxc.js\";\nimport { unsupportedClientAsyncComponentDiagnostic } from \"./diagnostics.js\";\nimport type { ComponentIr, JsxNodeIr } from \"./ir.js\";\nimport type { AnalyzeToIrInput, AnalyzeToIrOutput, CompilerModuleContext } from \"./internal.js\";\nimport type { AnalyzeModuleOptions } from \"./types.js\";\nimport type {\n ClientReferenceMetadata,\n EventHydrationEntryMetadata,\n ModuleMetadata,\n TransformInput,\n TransformOutput,\n} from \"./types.js\";\n\nexport function transform(input: TransformInput): TransformOutput {\n return transformWithAnalyzer(input, (analyzeTarget, analyzeOptions) =>\n analyzeWithOxc({\n code: input.code,\n filename: input.filename,\n target: analyzeTarget,\n options: analyzeOptions,\n }),\n );\n}\n\nexport function transformCompilerModuleContext(\n input: TransformInput & { moduleContext: CompilerModuleContext },\n): TransformOutput {\n if (input.moduleContext.code !== input.code || input.moduleContext.filename !== input.filename) {\n throw new Error(\"Transform input moduleContext must match the input code and filename.\");\n }\n\n return transformWithAnalyzer(input, (analyzeTarget, analyzeOptions) =>\n analyzeCompilerModuleContextWithOxc(input.moduleContext, {\n target: analyzeTarget,\n options: analyzeOptions,\n }),\n );\n}\n\nfunction transformWithAnalyzer(\n input: TransformInput,\n analyze: (target: AnalyzeToIrInput[\"target\"], options: AnalyzeModuleOptions) => AnalyzeToIrOutput,\n): TransformOutput {\n const mode = input.mode ?? \"reactive\";\n const serverOutput = input.serverOutput ?? \"string\";\n const serverBootstrap = input.serverBootstrap ?? \"none\";\n const analyzeTarget = mode === \"compat\" ? \"client\" : input.target;\n const bodyStatementJsx =\n input.target === \"server\"\n ? \"server-string\"\n : mode === \"compat\" && input.target === \"client\"\n ? \"compat-object\"\n : \"dom-node\";\n const analyzeOptions = {\n topLevelJsx:\n mode === \"compat\" && input.target === \"client\"\n ? \"compat-object\"\n : input.target === \"server\"\n ? \"server-string\"\n : \"diagnostic\",\n bodyStatementJsx,\n ...(input.target === \"server\" ? { serverOutput } : {}),\n awaitCompatComponents:\n input.target === \"server\" && serverOutput === \"stream\" ? \"lower\" : \"diagnostic\",\n clientBoundaryImports: input.clientBoundaryImports ?? [],\n clientBoundaryFallbackImports: input.clientBoundaryFallbackImports ?? [],\n compatReactNodeReturn: mode === \"compat\",\n ...(mode === \"compat\" && input.target === \"server\"\n ? { compatReactNodeReturnRenderMode: \"react-node\" as const }\n : {}),\n } as const;\n const analyzed = analyze(analyzeTarget, analyzeOptions);\n const diagnostics = [...analyzed.diagnostics];\n\n if (input.target === \"client\") {\n diagnostics.push(...collectClientAsyncComponentDiagnostics(analyzed.ir.components));\n }\n\n const emitted =\n mode === \"compat\" && input.target === \"client\"\n ? emitCompat(analyzed.ir, { dev: input.dev })\n : input.target === \"server\"\n ? serverOutput === \"stream\"\n ? emitServerStream(analyzed.ir, {\n ...createServerOptions(\n serverBootstrap,\n input.serverBootstrapNonce,\n input.serverBootstrapSrc,\n input.serverHydration,\n input.reactSuspenseRevealScriptSrc,\n ),\n ...(input.serverAwaitHydration === true\n ? { serverAwaitHydration: true as const }\n : {}),\n dynamicAttributes: mode === \"compat\" ? \"drop\" : \"emit\",\n escape: input.serverEscape,\n })\n : emitServer(analyzed.ir, {\n ...createServerOptions(\n serverBootstrap,\n input.serverBootstrapNonce,\n input.serverBootstrapSrc,\n input.serverHydration,\n ),\n dynamicAttributes: mode === \"compat\" ? \"drop\" : \"emit\",\n escape: input.serverEscape,\n })\n : emitClient(analyzed.ir);\n\n const metadata: ModuleMetadata = {\n filename: input.filename,\n target: input.target,\n compiler: {\n frontend: \"oxc\",\n typescriptFallback: false,\n },\n components: analyzed.ir.components.map((component) => ({\n name: component.name,\n exportName: component.exportName,\n })),\n imports: emitted.imports,\n };\n const events = collectEventHydrationEntries(analyzed.ir.components);\n\n if (events.length > 0) {\n metadata.eventHydrationManifest = {\n version: 1,\n events,\n };\n }\n const clientReferences = collectClientReferences(analyzed.ir.components);\n\n if (clientReferences.length > 0) {\n metadata.clientReferences = clientReferences;\n }\n const clientReferenceManifest = collectClientReferenceManifest(analyzed.ir.components);\n\n if (clientReferenceManifest.length > 0) {\n metadata.clientReferenceManifest = clientReferenceManifest;\n }\n\n if (input.target === \"server\") {\n metadata.serverOutput = serverOutput;\n\n if (serverBootstrap !== \"none\") {\n metadata.serverBootstrap = serverBootstrap;\n }\n\n if (input.serverBootstrapNonce !== undefined) {\n metadata.serverBootstrapNonce = input.serverBootstrapNonce;\n }\n\n if (input.serverBootstrapSrc !== undefined) {\n metadata.serverBootstrapSrc = input.serverBootstrapSrc;\n }\n\n if (input.serverHydration === true) {\n metadata.serverHydration = true;\n }\n\n if (input.serverAwaitHydration === true) {\n metadata.serverAwaitHydration = true;\n }\n\n if (input.reactSuspenseRevealScriptSrc !== undefined) {\n metadata.reactSuspenseRevealScriptSrc = input.reactSuspenseRevealScriptSrc;\n }\n }\n\n return {\n code: emitted.code,\n map: input.sourceMap === true ? createSourceMap(input, emitted.code) : null,\n diagnostics,\n metadata,\n };\n}\n\nfunction collectClientAsyncComponentDiagnostics(\n components: readonly ComponentIr[],\n): TransformOutput[\"diagnostics\"] {\n return components\n .filter((component) => component.async === true)\n .map((component) => unsupportedClientAsyncComponentDiagnostic(component.name));\n}\n\nfunction createSourceMap(input: TransformInput, outputCode: string): string {\n const generatedMap = createSegmentMappings(outputCode, input.code);\n\n return JSON.stringify({\n version: 3,\n file: `${input.filename}.js`,\n sources: [input.filename],\n sourcesContent: [input.code],\n names: generatedMap.names,\n mappings: generatedMap.mappings,\n });\n}\n\ninterface GeneratedSourceMap {\n mappings: string;\n names: string[];\n}\n\nfunction createSegmentMappings(outputCode: string, sourceCode: string): GeneratedSourceMap {\n const generatedLines = outputCode.split(\"\\n\");\n const sourceLines = sourceCode.split(\"\\n\");\n const lines: string[] = [];\n const names: string[] = [];\n const nameIndexes = new Map<string, number>();\n let previousSourceIndex = 0;\n let previousSourceLine = 0;\n let previousSourceColumn = 0;\n let previousNameIndex = 0;\n const searchState: SourceMapSearchState = { tokenOffsets: new Map() };\n\n for (const [lineIndex, generatedLine] of generatedLines.entries()) {\n let previousGeneratedColumn = 0;\n const segments = collectSourceMapSegments(generatedLine, lineIndex, sourceLines, searchState);\n\n lines.push(\n segments\n .map((segment) => {\n const fields = [\n encodeVlq(segment.generatedColumn - previousGeneratedColumn),\n encodeVlq(0 - previousSourceIndex),\n encodeVlq(segment.sourceLine - previousSourceLine),\n encodeVlq(segment.sourceColumn - previousSourceColumn),\n ];\n\n if (segment.name !== undefined) {\n const nameIndex = getSourceMapNameIndex(segment.name, names, nameIndexes);\n fields.push(encodeVlq(nameIndex - previousNameIndex));\n previousNameIndex = nameIndex;\n }\n\n const encoded = fields.join(\"\");\n previousGeneratedColumn = segment.generatedColumn;\n previousSourceIndex = 0;\n previousSourceLine = segment.sourceLine;\n previousSourceColumn = segment.sourceColumn;\n return encoded;\n })\n .join(\",\"),\n );\n }\n\n return { mappings: lines.join(\";\"), names };\n}\n\ninterface SourceMapSegment {\n generatedColumn: number;\n sourceLine: number;\n sourceColumn: number;\n name?: string;\n}\n\ninterface SourceMapSearchState {\n tokenOffsets: Map<string, number>;\n}\n\nfunction collectSourceMapSegments(\n generatedLine: string,\n generatedLineIndex: number,\n sourceLines: readonly string[],\n searchState: SourceMapSearchState,\n): SourceMapSegment[] {\n const fallbackSourceLine = findFallbackSourceLine(generatedLine, generatedLineIndex, sourceLines);\n const segments: SourceMapSegment[] = [\n {\n generatedColumn: 0,\n sourceLine: fallbackSourceLine,\n sourceColumn: 0,\n },\n ];\n\n const functionMatch = /function\\s+([A-Za-z_$][\\w$]*)/.exec(generatedLine);\n if (functionMatch !== null && functionMatch.index !== undefined) {\n const token = `function ${functionMatch[1]}`;\n const sourceLocation = findSourceLocation(sourceLines, token);\n\n if (sourceLocation !== undefined) {\n segments.push({\n generatedColumn: functionMatch.index,\n sourceLine: sourceLocation.line,\n sourceColumn: sourceLocation.column,\n });\n }\n }\n\n const returnColumn = generatedLine.indexOf(\"return\");\n if (returnColumn >= 0) {\n const sourceLocation = findSourceLocation(sourceLines, \"return\");\n\n if (sourceLocation !== undefined) {\n segments.push({\n generatedColumn: returnColumn,\n sourceLine: sourceLocation.line,\n sourceColumn: sourceLocation.column,\n });\n }\n }\n\n const templateStart = generatedLine.indexOf('createTemplate(\"');\n const templateTag =\n templateStart < 0\n ? undefined\n : generatedLine.slice(templateStart).match(/<[A-Za-z][\\w:-]*/)?.[0];\n if (templateTag !== undefined) {\n const generatedColumn = generatedLine.indexOf(templateTag);\n const sourceLocation = findSourceLocation(sourceLines, templateTag);\n\n if (generatedColumn >= 0 && sourceLocation !== undefined) {\n segments.push({\n generatedColumn,\n sourceLine: sourceLocation.line,\n sourceColumn: sourceLocation.column,\n });\n }\n }\n\n const dynamicExpression = /=> \\(([^)]+)\\)/.exec(generatedLine)?.[1]?.trim();\n if (dynamicExpression !== undefined && dynamicExpression !== \"\") {\n const generatedColumn = generatedLine.indexOf(dynamicExpression);\n const bindPropAttribute = /bindProp\\([^,]+,\\s+\"([^\"]+)\"/.exec(generatedLine)?.[1];\n const sourceLocation =\n bindPropAttribute === undefined\n ? undefined\n : (findSourceLocation(\n sourceLines,\n `${bindPropAttribute}={${dynamicExpression}}`,\n searchState,\n ) ??\n findSourceLocation(\n sourceLines,\n `${bindPropAttribute}=\"${dynamicExpression}\"`,\n searchState,\n ));\n const fallbackSourceLocation =\n findSourceLocation(sourceLines, `{${dynamicExpression}}`, searchState) ??\n findJsxExpressionTokenLocation(sourceLines, dynamicExpression) ??\n findSourceLocation(sourceLines, dynamicExpression, searchState);\n const resolvedSourceLocation = sourceLocation ?? fallbackSourceLocation;\n\n if (generatedColumn >= 0 && resolvedSourceLocation !== undefined) {\n const sourceColumnOffset =\n bindPropAttribute !== undefined && sourceLocation !== undefined\n ? bindPropAttribute.length + 2\n : sourceLines[resolvedSourceLocation.line]?.startsWith(\"{\", resolvedSourceLocation.column)\n ? 1\n : 0;\n\n segments.push({\n generatedColumn,\n sourceLine: resolvedSourceLocation.line,\n sourceColumn: resolvedSourceLocation.column + sourceColumnOffset,\n ...(isIdentifierName(dynamicExpression) ? { name: dynamicExpression } : {}),\n });\n\n for (const identifier of collectIdentifierReferences(dynamicExpression)) {\n segments.push({\n generatedColumn: generatedColumn + identifier.column,\n sourceLine: resolvedSourceLocation.line,\n sourceColumn: resolvedSourceLocation.column + sourceColumnOffset + identifier.column,\n name: identifier.name,\n });\n }\n }\n }\n\n return dedupeAndSortSegments(segments);\n}\n\nfunction getSourceMapNameIndex(\n name: string,\n names: string[],\n indexes: Map<string, number>,\n): number {\n const existing = indexes.get(name);\n\n if (existing !== undefined) {\n return existing;\n }\n\n const index = names.length;\n names.push(name);\n indexes.set(name, index);\n return index;\n}\n\nfunction isIdentifierName(value: string): boolean {\n return /^[A-Za-z_$][\\w$]*$/.test(value);\n}\n\nfunction collectIdentifierReferences(expression: string): { name: string; column: number }[] {\n const references: { name: string; column: number }[] = [];\n const seen = new Set<string>();\n const identifierPattern = /\\b[A-Za-z_$][\\w$]*\\b/g;\n\n for (const match of expression.matchAll(identifierPattern)) {\n const name = match[0];\n const column = match.index ?? 0;\n\n if (sourceMapIgnoredIdentifiers.has(name) || seen.has(`${name}:${column}`)) {\n continue;\n }\n\n references.push({ name, column });\n seen.add(`${name}:${column}`);\n }\n\n return references;\n}\n\nconst sourceMapIgnoredIdentifiers = new Set([\"false\", \"null\", \"true\", \"undefined\"]);\n\nfunction findFallbackSourceLine(\n generatedLine: string,\n generatedLineIndex: number,\n sourceLines: readonly string[],\n): number {\n const functionName = /function\\s+([A-Za-z_$][\\w$]*)/.exec(generatedLine)?.[1];\n\n if (functionName !== undefined) {\n return findSourceLocation(sourceLines, `function ${functionName}`)?.line ?? 0;\n }\n\n if (generatedLine.includes(\"createTemplate\")) {\n const jsxLine = sourceLines.findIndex((line) => line.includes(\"<\"));\n return jsxLine < 0 ? 0 : jsxLine;\n }\n\n if (generatedLine.includes(\"return\")) {\n return findSourceLocation(sourceLines, \"return\")?.line ?? 0;\n }\n\n return Math.min(generatedLineIndex, Math.max(0, sourceLines.length - 1));\n}\n\nfunction findSourceLocation(\n sourceLines: readonly string[],\n token: string,\n searchState?: SourceMapSearchState,\n): { line: number; column: number } | undefined {\n const source = sourceLines.join(\"\\n\");\n const start = searchState?.tokenOffsets.get(token) ?? 0;\n let offset = source.indexOf(token, start);\n\n if (offset < 0 && start > 0) {\n offset = source.indexOf(token);\n }\n\n if (offset < 0) {\n return undefined;\n }\n\n searchState?.tokenOffsets.set(token, offset + token.length);\n return sourceOffsetToLineColumn(sourceLines, offset);\n}\n\nfunction sourceOffsetToLineColumn(\n sourceLines: readonly string[],\n offset: number,\n): { line: number; column: number } {\n let remaining = offset;\n\n for (const [line, sourceLine] of sourceLines.entries()) {\n if (remaining <= sourceLine.length) {\n return { line, column: remaining };\n }\n\n remaining -= sourceLine.length + 1;\n }\n\n return {\n line: Math.max(0, sourceLines.length - 1),\n column: sourceLines.at(-1)?.length ?? 0,\n };\n}\n\nfunction findJsxExpressionTokenLocation(\n sourceLines: readonly string[],\n token: string,\n): { line: number; column: number } | undefined {\n let insideJsxExpression = false;\n\n for (const [line, sourceLine] of sourceLines.entries()) {\n if (sourceLine.includes(\"<\") && sourceLine.includes(\"{\")) {\n insideJsxExpression = true;\n }\n\n if (insideJsxExpression) {\n const column = sourceLine.indexOf(token);\n\n if (column >= 0) {\n return { line, column };\n }\n }\n\n if (sourceLine.includes(\"}\")) {\n insideJsxExpression = false;\n }\n }\n\n return undefined;\n}\n\nfunction dedupeAndSortSegments(segments: readonly SourceMapSegment[]): SourceMapSegment[] {\n const byGeneratedColumn = new Map<number, SourceMapSegment>();\n\n for (const segment of segments) {\n byGeneratedColumn.set(segment.generatedColumn, segment);\n }\n\n return Array.from(byGeneratedColumn.values()).sort(\n (left, right) => left.generatedColumn - right.generatedColumn,\n );\n}\n\nconst sourceMapBase64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\nexport function encodeVlq(value: number): string {\n let vlq = value < 0 ? -value * 2 + 1 : value * 2;\n let encoded = \"\";\n\n do {\n let digit = vlq % 32;\n vlq = Math.floor(vlq / 32);\n\n if (vlq > 0) {\n digit += 32;\n }\n\n encoded += sourceMapBase64[digit] ?? \"\";\n } while (vlq > 0);\n\n return encoded;\n}\n\nfunction collectEventHydrationEntries(\n components: readonly ComponentIr[],\n): EventHydrationEntryMetadata[] {\n return components.flatMap((component) => {\n const entries: EventHydrationEntryMetadata[] = [];\n collectEventsFromNode(component.root, component.name, \"0\", entries);\n return entries;\n });\n}\n\nfunction collectClientReferences(components: readonly ComponentIr[]): string[] {\n const references = new Set<string>();\n\n for (const component of components) {\n collectClientReferencesFromNode(component.root, references);\n }\n\n return Array.from(references);\n}\n\nfunction collectClientReferenceManifest(\n components: readonly ComponentIr[],\n): ClientReferenceMetadata[] {\n const references = new Map<string, ClientReferenceMetadata>();\n\n for (const component of components) {\n collectClientReferenceManifestFromNode(component.root, references);\n }\n\n return Array.from(references.values());\n}\n\nfunction collectClientReferenceManifestFromNode(\n node: JsxNodeIr,\n references: Map<string, ClientReferenceMetadata>,\n): void {\n if (node.kind === \"component\" && node.clientReference !== undefined) {\n references.set(\n `${node.name}:${node.clientReference.moduleId}:${node.clientReference.exportName}`,\n {\n name: node.name,\n moduleId: node.clientReference.moduleId,\n exportName: node.clientReference.exportName,\n },\n );\n }\n\n for (const child of getNodeChildren(node)) {\n collectClientReferenceManifestFromNode(child, references);\n }\n\n if (node.kind === \"component\") {\n for (const prop of node.props) {\n if (prop.kind === \"render-prop\") {\n for (const child of prop.children) {\n collectClientReferenceManifestFromNode(child, references);\n }\n }\n }\n }\n}\n\nfunction collectClientReferencesFromNode(node: JsxNodeIr, references: Set<string>): void {\n if (\n node.kind === \"component\" &&\n node.runtime === \"compat\" &&\n node.clientReference !== undefined\n ) {\n references.add(node.name);\n }\n\n for (const child of getNodeChildren(node)) {\n collectClientReferencesFromNode(child, references);\n }\n\n if (node.kind === \"component\") {\n for (const prop of node.props) {\n if (prop.kind === \"render-prop\") {\n for (const child of prop.children) {\n collectClientReferencesFromNode(child, references);\n }\n }\n }\n }\n}\n\nfunction collectEventsFromNode(\n node: JsxNodeIr,\n componentName: string,\n path: string,\n entries: EventHydrationEntryMetadata[],\n): void {\n if (node.kind === \"element\") {\n for (const attr of node.attributes) {\n if (attr.kind === \"event\") {\n entries.push({\n id: `${componentName}:${path}`,\n event: attr.eventName,\n handler: attr.code,\n });\n }\n }\n }\n\n for (const [index, child] of getNodeChildren(node).entries()) {\n collectEventsFromNode(child, componentName, `${path}.${index}`, entries);\n }\n}\n\nfunction getNodeChildren(node: JsxNodeIr): readonly JsxNodeIr[] {\n if (node.kind === \"element\" || node.kind === \"fragment\") {\n return node.children;\n }\n\n if (node.kind === \"conditional\") {\n return [...node.whenTrue, ...node.whenFalse];\n }\n\n if (node.kind === \"list\") {\n return node.children;\n }\n\n if (node.kind === \"async-boundary\") {\n return [...node.children, ...(node.placeholderChildren ?? []), ...(node.catchChildren ?? [])];\n }\n\n return [];\n}\n\nfunction createServerOptions(\n serverBootstrap: NonNullable<TransformInput[\"serverBootstrap\"]>,\n serverBootstrapNonce?: string,\n serverBootstrapSrc?: string,\n serverHydration?: boolean,\n reactSuspenseRevealScriptSrc?: string,\n) {\n return {\n serverBootstrap,\n ...(serverBootstrapNonce === undefined ? {} : { serverBootstrapNonce }),\n ...(serverBootstrapSrc === undefined ? {} : { serverBootstrapSrc }),\n ...(serverHydration === undefined ? {} : { serverHydration }),\n ...(reactSuspenseRevealScriptSrc === undefined ? {} : { reactSuspenseRevealScriptSrc }),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,mCAAmC,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/E,OAAO,EAAE,yCAAyC,EAAE,MAAM,kBAAkB,CAAC;AAY7E,iFAAiF;AACjF,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,OAAO,qBAAqB,CAAC,KAAK,EAAE,CAAC,aAAa,EAAE,cAAc,EAAE,EAAE,CACpE,cAAc,CAAC;QACb,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE,cAAc;KACxB,CAAC,CACH,CAAC;AACJ,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,8BAA8B,CAC5C,KAAgE;IAEhE,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,aAAa,CAAC,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AAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,4BAA4B,EAAE,CAAC;KACxF,CAAC;AACJ,CAAC","sourcesContent":["import { emitClient } from \"./emit-client.js\";\nimport { emitCompat } from \"./emit-compat.js\";\nimport { emitServer } from \"./emit-server.js\";\nimport { emitServerStream } from \"./emit-server-stream.js\";\nimport { analyzeCompilerModuleContextWithOxc, analyzeWithOxc } from \"./oxc.js\";\nimport { unsupportedClientAsyncComponentDiagnostic } from \"./diagnostics.js\";\nimport type { ComponentIr, JsxNodeIr } from \"./ir.js\";\nimport type { AnalyzeToIrInput, AnalyzeToIrOutput, CompilerModuleContext } from \"./internal.js\";\nimport type { AnalyzeModuleOptions } from \"./types.js\";\nimport type {\n ClientReferenceMetadata,\n EventHydrationEntryMetadata,\n ModuleMetadata,\n TransformInput,\n TransformOutput,\n} from \"./types.js\";\n\n/** Compiles one mreact source module into client or server JavaScript output. */\nexport function transform(input: TransformInput): TransformOutput {\n return transformWithAnalyzer(input, (analyzeTarget, analyzeOptions) =>\n analyzeWithOxc({\n code: input.code,\n filename: input.filename,\n target: analyzeTarget,\n options: analyzeOptions,\n }),\n );\n}\n\n/** Compiles a pre-parsed compiler module context into client or server JavaScript output. */\nexport function transformCompilerModuleContext(\n input: TransformInput & { moduleContext: CompilerModuleContext },\n): TransformOutput {\n if (input.moduleContext.code !== input.code || input.moduleContext.filename !== input.filename) {\n throw new Error(\"Transform input moduleContext must match the input code and filename.\");\n }\n\n return transformWithAnalyzer(input, (analyzeTarget, analyzeOptions) =>\n analyzeCompilerModuleContextWithOxc(input.moduleContext, {\n target: analyzeTarget,\n options: analyzeOptions,\n }),\n );\n}\n\nfunction transformWithAnalyzer(\n input: TransformInput,\n analyze: (target: AnalyzeToIrInput[\"target\"], options: AnalyzeModuleOptions) => AnalyzeToIrOutput,\n): TransformOutput {\n const mode = input.mode ?? \"reactive\";\n const serverOutput = input.serverOutput ?? \"string\";\n const serverBootstrap = input.serverBootstrap ?? \"none\";\n const analyzeTarget = mode === \"compat\" ? \"client\" : input.target;\n const bodyStatementJsx =\n input.target === \"server\"\n ? \"server-string\"\n : mode === \"compat\" && input.target === \"client\"\n ? \"compat-object\"\n : \"dom-node\";\n const analyzeOptions = {\n topLevelJsx:\n mode === \"compat\" && input.target === \"client\"\n ? \"compat-object\"\n : input.target === \"server\"\n ? \"server-string\"\n : \"diagnostic\",\n bodyStatementJsx,\n ...(input.target === \"server\" ? { serverOutput } : {}),\n awaitCompatComponents:\n input.target === \"server\" && serverOutput === \"stream\" ? \"lower\" : \"diagnostic\",\n clientBoundaryImports: input.clientBoundaryImports ?? [],\n clientBoundaryFallbackImports: input.clientBoundaryFallbackImports ?? [],\n compatReactNodeReturn: mode === \"compat\",\n ...(mode === \"compat\" && input.target === \"server\"\n ? { compatReactNodeReturnRenderMode: \"react-node\" as const }\n : {}),\n } as const;\n const analyzed = analyze(analyzeTarget, analyzeOptions);\n const diagnostics = [...analyzed.diagnostics];\n\n if (input.target === \"client\") {\n diagnostics.push(...collectClientAsyncComponentDiagnostics(analyzed.ir.components));\n }\n\n const emitted =\n mode === \"compat\" && input.target === \"client\"\n ? emitCompat(analyzed.ir, { dev: input.dev })\n : input.target === \"server\"\n ? serverOutput === \"stream\"\n ? emitServerStream(analyzed.ir, {\n ...createServerOptions(\n serverBootstrap,\n input.serverBootstrapNonce,\n input.serverBootstrapSrc,\n input.serverHydration,\n input.reactSuspenseRevealScriptSrc,\n ),\n ...(input.serverAwaitHydration === true\n ? { serverAwaitHydration: true as const }\n : {}),\n dynamicAttributes: mode === \"compat\" ? \"drop\" : \"emit\",\n escape: input.serverEscape,\n })\n : emitServer(analyzed.ir, {\n ...createServerOptions(\n serverBootstrap,\n input.serverBootstrapNonce,\n input.serverBootstrapSrc,\n input.serverHydration,\n ),\n dynamicAttributes: mode === \"compat\" ? \"drop\" : \"emit\",\n escape: input.serverEscape,\n })\n : emitClient(analyzed.ir);\n\n const metadata: ModuleMetadata = {\n filename: input.filename,\n target: input.target,\n compiler: {\n frontend: \"oxc\",\n typescriptFallback: false,\n },\n components: analyzed.ir.components.map((component) => ({\n name: component.name,\n exportName: component.exportName,\n })),\n imports: emitted.imports,\n };\n const events = collectEventHydrationEntries(analyzed.ir.components);\n\n if (events.length > 0) {\n metadata.eventHydrationManifest = {\n version: 1,\n events,\n };\n }\n const clientReferences = collectClientReferences(analyzed.ir.components);\n\n if (clientReferences.length > 0) {\n metadata.clientReferences = clientReferences;\n }\n const clientReferenceManifest = collectClientReferenceManifest(analyzed.ir.components);\n\n if (clientReferenceManifest.length > 0) {\n metadata.clientReferenceManifest = clientReferenceManifest;\n }\n\n if (input.target === \"server\") {\n metadata.serverOutput = serverOutput;\n\n if (serverBootstrap !== \"none\") {\n metadata.serverBootstrap = serverBootstrap;\n }\n\n if (input.serverBootstrapNonce !== undefined) {\n metadata.serverBootstrapNonce = input.serverBootstrapNonce;\n }\n\n if (input.serverBootstrapSrc !== undefined) {\n metadata.serverBootstrapSrc = input.serverBootstrapSrc;\n }\n\n if (input.serverHydration === true) {\n metadata.serverHydration = true;\n }\n\n if (input.serverAwaitHydration === true) {\n metadata.serverAwaitHydration = true;\n }\n\n if (input.reactSuspenseRevealScriptSrc !== undefined) {\n metadata.reactSuspenseRevealScriptSrc = input.reactSuspenseRevealScriptSrc;\n }\n }\n\n return {\n code: emitted.code,\n map: input.sourceMap === true ? createSourceMap(input, emitted.code) : null,\n diagnostics,\n metadata,\n };\n}\n\nfunction collectClientAsyncComponentDiagnostics(\n components: readonly ComponentIr[],\n): TransformOutput[\"diagnostics\"] {\n return components\n .filter((component) => component.async === true)\n .map((component) => unsupportedClientAsyncComponentDiagnostic(component.name));\n}\n\nfunction createSourceMap(input: TransformInput, outputCode: string): string {\n const generatedMap = createSegmentMappings(outputCode, input.code);\n\n return JSON.stringify({\n version: 3,\n file: `${input.filename}.js`,\n sources: [input.filename],\n sourcesContent: [input.code],\n names: generatedMap.names,\n mappings: generatedMap.mappings,\n });\n}\n\ninterface GeneratedSourceMap {\n mappings: string;\n names: string[];\n}\n\nfunction createSegmentMappings(outputCode: string, sourceCode: string): GeneratedSourceMap {\n const generatedLines = outputCode.split(\"\\n\");\n const sourceLines = sourceCode.split(\"\\n\");\n const lines: string[] = [];\n const names: string[] = [];\n const nameIndexes = new Map<string, number>();\n let previousSourceIndex = 0;\n let previousSourceLine = 0;\n let previousSourceColumn = 0;\n let previousNameIndex = 0;\n const searchState: SourceMapSearchState = { tokenOffsets: new Map() };\n\n for (const [lineIndex, generatedLine] of generatedLines.entries()) {\n let previousGeneratedColumn = 0;\n const segments = collectSourceMapSegments(generatedLine, lineIndex, sourceLines, searchState);\n\n lines.push(\n segments\n .map((segment) => {\n const fields = [\n encodeVlq(segment.generatedColumn - previousGeneratedColumn),\n encodeVlq(0 - previousSourceIndex),\n encodeVlq(segment.sourceLine - previousSourceLine),\n encodeVlq(segment.sourceColumn - previousSourceColumn),\n ];\n\n if (segment.name !== undefined) {\n const nameIndex = getSourceMapNameIndex(segment.name, names, nameIndexes);\n fields.push(encodeVlq(nameIndex - previousNameIndex));\n previousNameIndex = nameIndex;\n }\n\n const encoded = fields.join(\"\");\n previousGeneratedColumn = segment.generatedColumn;\n previousSourceIndex = 0;\n previousSourceLine = segment.sourceLine;\n previousSourceColumn = segment.sourceColumn;\n return encoded;\n })\n .join(\",\"),\n );\n }\n\n return { mappings: lines.join(\";\"), names };\n}\n\ninterface SourceMapSegment {\n generatedColumn: number;\n sourceLine: number;\n sourceColumn: number;\n name?: string;\n}\n\ninterface SourceMapSearchState {\n tokenOffsets: Map<string, number>;\n}\n\nfunction collectSourceMapSegments(\n generatedLine: string,\n generatedLineIndex: number,\n sourceLines: readonly string[],\n searchState: SourceMapSearchState,\n): SourceMapSegment[] {\n const fallbackSourceLine = findFallbackSourceLine(generatedLine, generatedLineIndex, sourceLines);\n const segments: SourceMapSegment[] = [\n {\n generatedColumn: 0,\n sourceLine: fallbackSourceLine,\n sourceColumn: 0,\n },\n ];\n\n const functionMatch = /function\\s+([A-Za-z_$][\\w$]*)/.exec(generatedLine);\n if (functionMatch !== null && functionMatch.index !== undefined) {\n const token = `function ${functionMatch[1]}`;\n const sourceLocation = findSourceLocation(sourceLines, token);\n\n if (sourceLocation !== undefined) {\n segments.push({\n generatedColumn: functionMatch.index,\n sourceLine: sourceLocation.line,\n sourceColumn: sourceLocation.column,\n });\n }\n }\n\n const returnColumn = generatedLine.indexOf(\"return\");\n if (returnColumn >= 0) {\n const sourceLocation = findSourceLocation(sourceLines, \"return\");\n\n if (sourceLocation !== undefined) {\n segments.push({\n generatedColumn: returnColumn,\n sourceLine: sourceLocation.line,\n sourceColumn: sourceLocation.column,\n });\n }\n }\n\n const templateStart = generatedLine.indexOf('createTemplate(\"');\n const templateTag =\n templateStart < 0\n ? undefined\n : generatedLine.slice(templateStart).match(/<[A-Za-z][\\w:-]*/)?.[0];\n if (templateTag !== undefined) {\n const generatedColumn = generatedLine.indexOf(templateTag);\n const sourceLocation = findSourceLocation(sourceLines, templateTag);\n\n if (generatedColumn >= 0 && sourceLocation !== undefined) {\n segments.push({\n generatedColumn,\n sourceLine: sourceLocation.line,\n sourceColumn: sourceLocation.column,\n });\n }\n }\n\n const dynamicExpression = /=> \\(([^)]+)\\)/.exec(generatedLine)?.[1]?.trim();\n if (dynamicExpression !== undefined && dynamicExpression !== \"\") {\n const generatedColumn = generatedLine.indexOf(dynamicExpression);\n const bindPropAttribute = /bindProp\\([^,]+,\\s+\"([^\"]+)\"/.exec(generatedLine)?.[1];\n const sourceLocation =\n bindPropAttribute === undefined\n ? undefined\n : (findSourceLocation(\n sourceLines,\n `${bindPropAttribute}={${dynamicExpression}}`,\n searchState,\n ) ??\n findSourceLocation(\n sourceLines,\n `${bindPropAttribute}=\"${dynamicExpression}\"`,\n searchState,\n ));\n const fallbackSourceLocation =\n findSourceLocation(sourceLines, `{${dynamicExpression}}`, searchState) ??\n findJsxExpressionTokenLocation(sourceLines, dynamicExpression) ??\n findSourceLocation(sourceLines, dynamicExpression, searchState);\n const resolvedSourceLocation = sourceLocation ?? fallbackSourceLocation;\n\n if (generatedColumn >= 0 && resolvedSourceLocation !== undefined) {\n const sourceColumnOffset =\n bindPropAttribute !== undefined && sourceLocation !== undefined\n ? bindPropAttribute.length + 2\n : sourceLines[resolvedSourceLocation.line]?.startsWith(\"{\", resolvedSourceLocation.column)\n ? 1\n : 0;\n\n segments.push({\n generatedColumn,\n sourceLine: resolvedSourceLocation.line,\n sourceColumn: resolvedSourceLocation.column + sourceColumnOffset,\n ...(isIdentifierName(dynamicExpression) ? { name: dynamicExpression } : {}),\n });\n\n for (const identifier of collectIdentifierReferences(dynamicExpression)) {\n segments.push({\n generatedColumn: generatedColumn + identifier.column,\n sourceLine: resolvedSourceLocation.line,\n sourceColumn: resolvedSourceLocation.column + sourceColumnOffset + identifier.column,\n name: identifier.name,\n });\n }\n }\n }\n\n return dedupeAndSortSegments(segments);\n}\n\nfunction getSourceMapNameIndex(\n name: string,\n names: string[],\n indexes: Map<string, number>,\n): number {\n const existing = indexes.get(name);\n\n if (existing !== undefined) {\n return existing;\n }\n\n const index = names.length;\n names.push(name);\n indexes.set(name, index);\n return index;\n}\n\nfunction isIdentifierName(value: string): boolean {\n return /^[A-Za-z_$][\\w$]*$/.test(value);\n}\n\nfunction collectIdentifierReferences(expression: string): { name: string; column: number }[] {\n const references: { name: string; column: number }[] = [];\n const seen = new Set<string>();\n const identifierPattern = /\\b[A-Za-z_$][\\w$]*\\b/g;\n\n for (const match of expression.matchAll(identifierPattern)) {\n const name = match[0];\n const column = match.index ?? 0;\n\n if (sourceMapIgnoredIdentifiers.has(name) || seen.has(`${name}:${column}`)) {\n continue;\n }\n\n references.push({ name, column });\n seen.add(`${name}:${column}`);\n }\n\n return references;\n}\n\nconst sourceMapIgnoredIdentifiers = new Set([\"false\", \"null\", \"true\", \"undefined\"]);\n\nfunction findFallbackSourceLine(\n generatedLine: string,\n generatedLineIndex: number,\n sourceLines: readonly string[],\n): number {\n const functionName = /function\\s+([A-Za-z_$][\\w$]*)/.exec(generatedLine)?.[1];\n\n if (functionName !== undefined) {\n return findSourceLocation(sourceLines, `function ${functionName}`)?.line ?? 0;\n }\n\n if (generatedLine.includes(\"createTemplate\")) {\n const jsxLine = sourceLines.findIndex((line) => line.includes(\"<\"));\n return jsxLine < 0 ? 0 : jsxLine;\n }\n\n if (generatedLine.includes(\"return\")) {\n return findSourceLocation(sourceLines, \"return\")?.line ?? 0;\n }\n\n return Math.min(generatedLineIndex, Math.max(0, sourceLines.length - 1));\n}\n\nfunction findSourceLocation(\n sourceLines: readonly string[],\n token: string,\n searchState?: SourceMapSearchState,\n): { line: number; column: number } | undefined {\n const source = sourceLines.join(\"\\n\");\n const start = searchState?.tokenOffsets.get(token) ?? 0;\n let offset = source.indexOf(token, start);\n\n if (offset < 0 && start > 0) {\n offset = source.indexOf(token);\n }\n\n if (offset < 0) {\n return undefined;\n }\n\n searchState?.tokenOffsets.set(token, offset + token.length);\n return sourceOffsetToLineColumn(sourceLines, offset);\n}\n\nfunction sourceOffsetToLineColumn(\n sourceLines: readonly string[],\n offset: number,\n): { line: number; column: number } {\n let remaining = offset;\n\n for (const [line, sourceLine] of sourceLines.entries()) {\n if (remaining <= sourceLine.length) {\n return { line, column: remaining };\n }\n\n remaining -= sourceLine.length + 1;\n }\n\n return {\n line: Math.max(0, sourceLines.length - 1),\n column: sourceLines.at(-1)?.length ?? 0,\n };\n}\n\nfunction findJsxExpressionTokenLocation(\n sourceLines: readonly string[],\n token: string,\n): { line: number; column: number } | undefined {\n let insideJsxExpression = false;\n\n for (const [line, sourceLine] of sourceLines.entries()) {\n if (sourceLine.includes(\"<\") && sourceLine.includes(\"{\")) {\n insideJsxExpression = true;\n }\n\n if (insideJsxExpression) {\n const column = sourceLine.indexOf(token);\n\n if (column >= 0) {\n return { line, column };\n }\n }\n\n if (sourceLine.includes(\"}\")) {\n insideJsxExpression = false;\n }\n }\n\n return undefined;\n}\n\nfunction dedupeAndSortSegments(segments: readonly SourceMapSegment[]): SourceMapSegment[] {\n const byGeneratedColumn = new Map<number, SourceMapSegment>();\n\n for (const segment of segments) {\n byGeneratedColumn.set(segment.generatedColumn, segment);\n }\n\n return Array.from(byGeneratedColumn.values()).sort(\n (left, right) => left.generatedColumn - right.generatedColumn,\n );\n}\n\nconst sourceMapBase64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\nexport function encodeVlq(value: number): string {\n let vlq = value < 0 ? -value * 2 + 1 : value * 2;\n let encoded = \"\";\n\n do {\n let digit = vlq % 32;\n vlq = Math.floor(vlq / 32);\n\n if (vlq > 0) {\n digit += 32;\n }\n\n encoded += sourceMapBase64[digit] ?? \"\";\n } while (vlq > 0);\n\n return encoded;\n}\n\nfunction collectEventHydrationEntries(\n components: readonly ComponentIr[],\n): EventHydrationEntryMetadata[] {\n return components.flatMap((component) => {\n const entries: EventHydrationEntryMetadata[] = [];\n collectEventsFromNode(component.root, component.name, \"0\", entries);\n return entries;\n });\n}\n\nfunction collectClientReferences(components: readonly ComponentIr[]): string[] {\n const references = new Set<string>();\n\n for (const component of components) {\n collectClientReferencesFromNode(component.root, references);\n }\n\n return Array.from(references);\n}\n\nfunction collectClientReferenceManifest(\n components: readonly ComponentIr[],\n): ClientReferenceMetadata[] {\n const references = new Map<string, ClientReferenceMetadata>();\n\n for (const component of components) {\n collectClientReferenceManifestFromNode(component.root, references);\n }\n\n return Array.from(references.values());\n}\n\nfunction collectClientReferenceManifestFromNode(\n node: JsxNodeIr,\n references: Map<string, ClientReferenceMetadata>,\n): void {\n if (node.kind === \"component\" && node.clientReference !== undefined) {\n references.set(\n `${node.name}:${node.clientReference.moduleId}:${node.clientReference.exportName}`,\n {\n name: node.name,\n moduleId: node.clientReference.moduleId,\n exportName: node.clientReference.exportName,\n },\n );\n }\n\n for (const child of getNodeChildren(node)) {\n collectClientReferenceManifestFromNode(child, references);\n }\n\n if (node.kind === \"component\") {\n for (const prop of node.props) {\n if (prop.kind === \"render-prop\") {\n for (const child of prop.children) {\n collectClientReferenceManifestFromNode(child, references);\n }\n }\n }\n }\n}\n\nfunction collectClientReferencesFromNode(node: JsxNodeIr, references: Set<string>): void {\n if (\n node.kind === \"component\" &&\n node.runtime === \"compat\" &&\n node.clientReference !== undefined\n ) {\n references.add(node.name);\n }\n\n for (const child of getNodeChildren(node)) {\n collectClientReferencesFromNode(child, references);\n }\n\n if (node.kind === \"component\") {\n for (const prop of node.props) {\n if (prop.kind === \"render-prop\") {\n for (const child of prop.children) {\n collectClientReferencesFromNode(child, references);\n }\n }\n }\n }\n}\n\nfunction collectEventsFromNode(\n node: JsxNodeIr,\n componentName: string,\n path: string,\n entries: EventHydrationEntryMetadata[],\n): void {\n if (node.kind === \"element\") {\n for (const attr of node.attributes) {\n if (attr.kind === \"event\") {\n entries.push({\n id: `${componentName}:${path}`,\n event: attr.eventName,\n handler: attr.code,\n });\n }\n }\n }\n\n for (const [index, child] of getNodeChildren(node).entries()) {\n collectEventsFromNode(child, componentName, `${path}.${index}`, entries);\n }\n}\n\nfunction getNodeChildren(node: JsxNodeIr): readonly JsxNodeIr[] {\n if (node.kind === \"element\" || node.kind === \"fragment\") {\n return node.children;\n }\n\n if (node.kind === \"conditional\") {\n return [...node.whenTrue, ...node.whenFalse];\n }\n\n if (node.kind === \"list\") {\n return node.children;\n }\n\n if (node.kind === \"async-boundary\") {\n return [...node.children, ...(node.placeholderChildren ?? []), ...(node.catchChildren ?? [])];\n }\n\n return [];\n}\n\nfunction createServerOptions(\n serverBootstrap: NonNullable<TransformInput[\"serverBootstrap\"]>,\n serverBootstrapNonce?: string,\n serverBootstrapSrc?: string,\n serverHydration?: boolean,\n reactSuspenseRevealScriptSrc?: string,\n) {\n return {\n serverBootstrap,\n ...(serverBootstrapNonce === undefined ? {} : { serverBootstrapNonce }),\n ...(serverBootstrapSrc === undefined ? {} : { serverBootstrapSrc }),\n ...(serverHydration === undefined ? {} : { serverHydration }),\n ...(reactSuspenseRevealScriptSrc === undefined ? {} : { reactSuspenseRevealScriptSrc }),\n };\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { ClientReferenceMetadata as SharedClientReferenceMetadata, CompileTarget as SharedCompileTarget, CompilerFrontend as SharedCompilerFrontend, ComponentMetadata as SharedComponentMetadata, Diagnostic as SharedDiagnostic, DiagnosticSuggestion as SharedDiagnosticSuggestion, EventHydrationEntryMetadata as SharedEventHydrationEntryMetadata, EventHydrationManifestMetadata as SharedEventHydrationManifestMetadata, ModuleMetadata as SharedModuleMetadata, RuntimeImport as SharedRuntimeImport, ServerBootstrapMode as SharedServerBootstrapMode, ServerOutputMode as SharedServerOutputMode, SourceLocation as SharedSourceLocation, TransformOutput as SharedTransformOutput } from "@reckona/mreact-shared/compiler-contract";
|
|
2
|
+
/** Names whether the compiler emits client or server output. */
|
|
2
3
|
export type CompileTarget = SharedCompileTarget;
|
|
4
|
+
/** Names the server renderer output format produced by the compiler. */
|
|
3
5
|
export type ServerOutputMode = SharedServerOutputMode;
|
|
6
|
+
/** Names how the server renderer should emit bootstrap scripts. */
|
|
4
7
|
export type ServerBootstrapMode = SharedServerBootstrapMode;
|
|
8
|
+
/** Names the parser backend used by the compiler. */
|
|
5
9
|
export type ParserMode = "oxc";
|
|
10
|
+
/** Names the frontend implementation that produced compiler metadata. */
|
|
6
11
|
export type CompilerFrontend = SharedCompilerFrontend;
|
|
12
|
+
/** Names how JSX found in component body statements should be lowered. */
|
|
7
13
|
export type BodyStatementJsxMode = "dom-node" | "compat-object" | "server-string" | "unsupported";
|
|
14
|
+
/** Configures lower-level module analysis before code emission. */
|
|
8
15
|
export interface AnalyzeModuleOptions {
|
|
9
16
|
topLevelJsx?: "diagnostic" | "compat-object" | "server-string";
|
|
10
17
|
bodyStatementJsx?: BodyStatementJsxMode;
|
|
@@ -15,6 +22,7 @@ export interface AnalyzeModuleOptions {
|
|
|
15
22
|
compatReactNodeReturn?: boolean;
|
|
16
23
|
compatReactNodeReturnRenderMode?: "react-node";
|
|
17
24
|
}
|
|
25
|
+
/** Configures a single compiler transform call. */
|
|
18
26
|
export interface TransformInput {
|
|
19
27
|
code: string;
|
|
20
28
|
filename: string;
|
|
@@ -34,19 +42,31 @@ export interface TransformInput {
|
|
|
34
42
|
serverEscape?: ServerEscapeOptions;
|
|
35
43
|
reactSuspenseRevealScriptSrc?: string;
|
|
36
44
|
}
|
|
45
|
+
/** Configures imports for the server HTML escape helper emitted by the compiler. */
|
|
37
46
|
export interface ServerEscapeOptions {
|
|
38
47
|
batchImportName: string;
|
|
39
48
|
batchImportSource: string;
|
|
40
49
|
}
|
|
50
|
+
/** Describes emitted code, source map data, diagnostics, and metadata from a transform. */
|
|
41
51
|
export type TransformOutput = SharedTransformOutput;
|
|
52
|
+
/** Describes a compiler diagnostic message. */
|
|
42
53
|
export type Diagnostic = SharedDiagnostic;
|
|
54
|
+
/** Describes a suggested fix attached to a compiler diagnostic. */
|
|
43
55
|
export type DiagnosticSuggestion = SharedDiagnosticSuggestion;
|
|
56
|
+
/** Describes a one-based source location for diagnostics and metadata. */
|
|
44
57
|
export type SourceLocation = SharedSourceLocation;
|
|
58
|
+
/** Describes metadata collected for one transformed module. */
|
|
45
59
|
export type ModuleMetadata = SharedModuleMetadata;
|
|
60
|
+
/** Describes compiler frontend metadata for one transformed module. */
|
|
46
61
|
export type CompilerMetadata = SharedModuleMetadata["compiler"];
|
|
62
|
+
/** Describes a client boundary reference discovered during compilation. */
|
|
47
63
|
export type ClientReferenceMetadata = SharedClientReferenceMetadata;
|
|
64
|
+
/** Describes one compiled component discovered in a module. */
|
|
48
65
|
export type ComponentMetadata = SharedComponentMetadata;
|
|
66
|
+
/** Describes a runtime import required by emitted compiler output. */
|
|
49
67
|
export type RuntimeImport = SharedRuntimeImport;
|
|
68
|
+
/** Describes event hydration metadata emitted for server-rendered handlers. */
|
|
50
69
|
export type EventHydrationManifestMetadata = SharedEventHydrationManifestMetadata;
|
|
70
|
+
/** Describes one event hydration entry in a compiler metadata manifest. */
|
|
51
71
|
export type EventHydrationEntryMetadata = SharedEventHydrationEntryMetadata;
|
|
52
72
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,IAAI,6BAA6B,EACxD,aAAa,IAAI,mBAAmB,EACpC,gBAAgB,IAAI,sBAAsB,EAC1C,iBAAiB,IAAI,uBAAuB,EAC5C,UAAU,IAAI,gBAAgB,EAC9B,oBAAoB,IAAI,0BAA0B,EAClD,2BAA2B,IAAI,iCAAiC,EAChE,8BAA8B,IAAI,oCAAoC,EACtE,cAAc,IAAI,oBAAoB,EACtC,aAAa,IAAI,mBAAmB,EACpC,mBAAmB,IAAI,yBAAyB,EAChD,gBAAgB,IAAI,sBAAsB,EAC1C,cAAc,IAAI,oBAAoB,EACtC,eAAe,IAAI,qBAAqB,EACzC,MAAM,0CAA0C,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,IAAI,6BAA6B,EACxD,aAAa,IAAI,mBAAmB,EACpC,gBAAgB,IAAI,sBAAsB,EAC1C,iBAAiB,IAAI,uBAAuB,EAC5C,UAAU,IAAI,gBAAgB,EAC9B,oBAAoB,IAAI,0BAA0B,EAClD,2BAA2B,IAAI,iCAAiC,EAChE,8BAA8B,IAAI,oCAAoC,EACtE,cAAc,IAAI,oBAAoB,EACtC,aAAa,IAAI,mBAAmB,EACpC,mBAAmB,IAAI,yBAAyB,EAChD,gBAAgB,IAAI,sBAAsB,EAC1C,cAAc,IAAI,oBAAoB,EACtC,eAAe,IAAI,qBAAqB,EACzC,MAAM,0CAA0C,CAAC;AAElD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AAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,6BAA6B,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClD,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC;AAED,oFAAoF;AACpF,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,2FAA2F;AAC3F,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAEpD,+CAA+C;AAC/C,MAAM,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAE1C,mEAAmE;AACnE,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAE9D,0EAA0E;AAC1E,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAElD,+DAA+D;AAC/D,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAElD,uEAAuE;AACvE,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAEhE,2EAA2E;AAC3E,MAAM,MAAM,uBAAuB,GAAG,6BAA6B,CAAC;AAEpE,+DAA+D;AAC/D,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAExD,sEAAsE;AACtE,MAAM,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAEhD,+EAA+E;AAC/E,MAAM,MAAM,8BAA8B,GAAG,oCAAoC,CAAC;AAElF,2EAA2E;AAC3E,MAAM,MAAM,2BAA2B,GAAG,iCAAiC,CAAC"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ClientReferenceMetadata as SharedClientReferenceMetadata,\n CompileTarget as SharedCompileTarget,\n CompilerFrontend as SharedCompilerFrontend,\n ComponentMetadata as SharedComponentMetadata,\n Diagnostic as SharedDiagnostic,\n DiagnosticSuggestion as SharedDiagnosticSuggestion,\n EventHydrationEntryMetadata as SharedEventHydrationEntryMetadata,\n EventHydrationManifestMetadata as SharedEventHydrationManifestMetadata,\n ModuleMetadata as SharedModuleMetadata,\n RuntimeImport as SharedRuntimeImport,\n ServerBootstrapMode as SharedServerBootstrapMode,\n ServerOutputMode as SharedServerOutputMode,\n SourceLocation as SharedSourceLocation,\n TransformOutput as SharedTransformOutput,\n} from \"@reckona/mreact-shared/compiler-contract\";\n\nexport type CompileTarget = SharedCompileTarget;\nexport type ServerOutputMode = SharedServerOutputMode;\nexport type ServerBootstrapMode = SharedServerBootstrapMode;\nexport type ParserMode = \"oxc\";\nexport type CompilerFrontend = SharedCompilerFrontend;\n\nexport type BodyStatementJsxMode = \"dom-node\" | \"compat-object\" | \"server-string\" | \"unsupported\";\n\nexport interface AnalyzeModuleOptions {\n topLevelJsx?: \"diagnostic\" | \"compat-object\" | \"server-string\";\n bodyStatementJsx?: BodyStatementJsxMode;\n serverOutput?: ServerOutputMode;\n awaitCompatComponents?: \"diagnostic\" | \"lower\";\n clientBoundaryImports?: readonly string[];\n clientBoundaryFallbackImports?: readonly string[];\n compatReactNodeReturn?: boolean;\n compatReactNodeReturnRenderMode?: \"react-node\";\n}\n\nexport interface TransformInput {\n code: string;\n filename: string;\n target: CompileTarget;\n dev: boolean;\n sourceMap?: boolean;\n mode?: \"auto\" | \"reactive\" | \"compat\";\n parser?: ParserMode;\n serverOutput?: ServerOutputMode;\n serverBootstrap?: ServerBootstrapMode;\n serverBootstrapNonce?: string;\n serverBootstrapSrc?: string;\n serverHydration?: boolean;\n serverAwaitHydration?: boolean;\n clientBoundaryImports?: readonly string[];\n clientBoundaryFallbackImports?: readonly string[];\n serverEscape?: ServerEscapeOptions;\n reactSuspenseRevealScriptSrc?: string;\n}\n\nexport interface ServerEscapeOptions {\n batchImportName: string;\n batchImportSource: string;\n}\n\nexport type TransformOutput = SharedTransformOutput;\nexport type Diagnostic = SharedDiagnostic;\nexport type DiagnosticSuggestion = SharedDiagnosticSuggestion;\nexport type SourceLocation = SharedSourceLocation;\nexport type ModuleMetadata = SharedModuleMetadata;\nexport type CompilerMetadata = SharedModuleMetadata[\"compiler\"];\nexport type ClientReferenceMetadata = SharedClientReferenceMetadata;\nexport type ComponentMetadata = SharedComponentMetadata;\nexport type RuntimeImport = SharedRuntimeImport;\nexport type EventHydrationManifestMetadata = SharedEventHydrationManifestMetadata;\nexport type EventHydrationEntryMetadata = SharedEventHydrationEntryMetadata;\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ClientReferenceMetadata as SharedClientReferenceMetadata,\n CompileTarget as SharedCompileTarget,\n CompilerFrontend as SharedCompilerFrontend,\n ComponentMetadata as SharedComponentMetadata,\n Diagnostic as SharedDiagnostic,\n DiagnosticSuggestion as SharedDiagnosticSuggestion,\n EventHydrationEntryMetadata as SharedEventHydrationEntryMetadata,\n EventHydrationManifestMetadata as SharedEventHydrationManifestMetadata,\n ModuleMetadata as SharedModuleMetadata,\n RuntimeImport as SharedRuntimeImport,\n ServerBootstrapMode as SharedServerBootstrapMode,\n ServerOutputMode as SharedServerOutputMode,\n SourceLocation as SharedSourceLocation,\n TransformOutput as SharedTransformOutput,\n} from \"@reckona/mreact-shared/compiler-contract\";\n\n/** Names whether the compiler emits client or server output. */\nexport type CompileTarget = SharedCompileTarget;\n\n/** Names the server renderer output format produced by the compiler. */\nexport type ServerOutputMode = SharedServerOutputMode;\n\n/** Names how the server renderer should emit bootstrap scripts. */\nexport type ServerBootstrapMode = SharedServerBootstrapMode;\n\n/** Names the parser backend used by the compiler. */\nexport type ParserMode = \"oxc\";\n\n/** Names the frontend implementation that produced compiler metadata. */\nexport type CompilerFrontend = SharedCompilerFrontend;\n\n/** Names how JSX found in component body statements should be lowered. */\nexport type BodyStatementJsxMode = \"dom-node\" | \"compat-object\" | \"server-string\" | \"unsupported\";\n\n/** Configures lower-level module analysis before code emission. */\nexport interface AnalyzeModuleOptions {\n topLevelJsx?: \"diagnostic\" | \"compat-object\" | \"server-string\";\n bodyStatementJsx?: BodyStatementJsxMode;\n serverOutput?: ServerOutputMode;\n awaitCompatComponents?: \"diagnostic\" | \"lower\";\n clientBoundaryImports?: readonly string[];\n clientBoundaryFallbackImports?: readonly string[];\n compatReactNodeReturn?: boolean;\n compatReactNodeReturnRenderMode?: \"react-node\";\n}\n\n/** Configures a single compiler transform call. */\nexport interface TransformInput {\n code: string;\n filename: string;\n target: CompileTarget;\n dev: boolean;\n sourceMap?: boolean;\n mode?: \"auto\" | \"reactive\" | \"compat\";\n parser?: ParserMode;\n serverOutput?: ServerOutputMode;\n serverBootstrap?: ServerBootstrapMode;\n serverBootstrapNonce?: string;\n serverBootstrapSrc?: string;\n serverHydration?: boolean;\n serverAwaitHydration?: boolean;\n clientBoundaryImports?: readonly string[];\n clientBoundaryFallbackImports?: readonly string[];\n serverEscape?: ServerEscapeOptions;\n reactSuspenseRevealScriptSrc?: string;\n}\n\n/** Configures imports for the server HTML escape helper emitted by the compiler. */\nexport interface ServerEscapeOptions {\n batchImportName: string;\n batchImportSource: string;\n}\n\n/** Describes emitted code, source map data, diagnostics, and metadata from a transform. */\nexport type TransformOutput = SharedTransformOutput;\n\n/** Describes a compiler diagnostic message. */\nexport type Diagnostic = SharedDiagnostic;\n\n/** Describes a suggested fix attached to a compiler diagnostic. */\nexport type DiagnosticSuggestion = SharedDiagnosticSuggestion;\n\n/** Describes a one-based source location for diagnostics and metadata. */\nexport type SourceLocation = SharedSourceLocation;\n\n/** Describes metadata collected for one transformed module. */\nexport type ModuleMetadata = SharedModuleMetadata;\n\n/** Describes compiler frontend metadata for one transformed module. */\nexport type CompilerMetadata = SharedModuleMetadata[\"compiler\"];\n\n/** Describes a client boundary reference discovered during compilation. */\nexport type ClientReferenceMetadata = SharedClientReferenceMetadata;\n\n/** Describes one compiled component discovered in a module. */\nexport type ComponentMetadata = SharedComponentMetadata;\n\n/** Describes a runtime import required by emitted compiler output. */\nexport type RuntimeImport = SharedRuntimeImport;\n\n/** Describes event hydration metadata emitted for server-rendered handlers. */\nexport type EventHydrationManifestMetadata = SharedEventHydrationManifestMetadata;\n\n/** Describes one event hydration entry in a compiler metadata manifest. */\nexport type EventHydrationEntryMetadata = SharedEventHydrationEntryMetadata;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reckona/mreact-compiler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.161",
|
|
4
4
|
"description": "Compiler passes and OXC-backed JSX analysis for mreact.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"oxc-parser": "0.
|
|
52
|
-
"oxc-transform": "0.
|
|
53
|
-
"@reckona/mreact-shared": "0.0.
|
|
51
|
+
"oxc-parser": "0.135.0",
|
|
52
|
+
"oxc-transform": "0.135.0",
|
|
53
|
+
"@reckona/mreact-shared": "0.0.161"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/boundary-graph.ts
CHANGED
|
@@ -12,12 +12,14 @@ import type {
|
|
|
12
12
|
} from "./internal.js";
|
|
13
13
|
import type { Diagnostic } from "./types.js";
|
|
14
14
|
|
|
15
|
+
/** Classifies the route role of a module used as a boundary graph entry. */
|
|
15
16
|
export type BoundaryGraphEntryKind =
|
|
16
17
|
| "module"
|
|
17
18
|
| "route-layout"
|
|
18
19
|
| "route-page"
|
|
19
20
|
| "route-template";
|
|
20
21
|
|
|
22
|
+
/** Classifies how a module or export participates in client, server, and shared execution. */
|
|
21
23
|
export type BoundaryClassification =
|
|
22
24
|
| "client-boundary"
|
|
23
25
|
| "client-route"
|
|
@@ -27,11 +29,13 @@ export type BoundaryClassification =
|
|
|
27
29
|
| "shared"
|
|
28
30
|
| "unknown";
|
|
29
31
|
|
|
32
|
+
/** Describes an entry module passed to boundary graph analysis. */
|
|
30
33
|
export interface BoundaryGraphEntry {
|
|
31
34
|
file: string;
|
|
32
35
|
kind: BoundaryGraphEntryKind;
|
|
33
36
|
}
|
|
34
37
|
|
|
38
|
+
/** Supplies entry modules and module loading hooks for boundary graph analysis. */
|
|
35
39
|
export interface BoundaryGraphInput {
|
|
36
40
|
entries: readonly BoundaryGraphEntry[];
|
|
37
41
|
readModule(file: string): Promise<string | undefined> | string | undefined;
|
|
@@ -41,17 +45,20 @@ export interface BoundaryGraphInput {
|
|
|
41
45
|
}): Promise<string | undefined> | string | undefined;
|
|
42
46
|
}
|
|
43
47
|
|
|
48
|
+
/** Describes the boundary classification assigned to one named export. */
|
|
44
49
|
export interface BoundaryGraphExport {
|
|
45
50
|
classification: BoundaryClassification;
|
|
46
51
|
name: string;
|
|
47
52
|
}
|
|
48
53
|
|
|
54
|
+
/** Describes one analyzed module and the classifications for its exports. */
|
|
49
55
|
export interface BoundaryGraphModule {
|
|
50
56
|
classification: BoundaryClassification;
|
|
51
57
|
exports: BoundaryGraphExport[];
|
|
52
58
|
file: string;
|
|
53
59
|
}
|
|
54
60
|
|
|
61
|
+
/** Describes an import that crosses from server-rendered code into a client boundary. */
|
|
55
62
|
export interface BoundaryGraphClientBoundary {
|
|
56
63
|
exportNames?: readonly string[];
|
|
57
64
|
importerFile: string;
|
|
@@ -59,6 +66,7 @@ export interface BoundaryGraphClientBoundary {
|
|
|
59
66
|
source: string;
|
|
60
67
|
}
|
|
61
68
|
|
|
69
|
+
/** Describes an inferred or explicit server action reference discovered in the graph. */
|
|
62
70
|
export interface BoundaryGraphServerActionSite {
|
|
63
71
|
end: number;
|
|
64
72
|
exportName: string;
|
|
@@ -71,12 +79,14 @@ export interface BoundaryGraphServerActionSite {
|
|
|
71
79
|
start: number;
|
|
72
80
|
}
|
|
73
81
|
|
|
82
|
+
/** Names the kind of boundary graph trace event. */
|
|
74
83
|
export type BoundaryGraphTraceKind =
|
|
75
84
|
| "client-boundary"
|
|
76
85
|
| "export"
|
|
77
86
|
| "module"
|
|
78
87
|
| "server-action";
|
|
79
88
|
|
|
89
|
+
/** Names the analysis reason attached to a boundary graph trace event. */
|
|
80
90
|
export type BoundaryGraphTraceReason =
|
|
81
91
|
| "client-runtime-export"
|
|
82
92
|
| "module-classification"
|
|
@@ -89,6 +99,7 @@ export type BoundaryGraphTraceReason =
|
|
|
89
99
|
| "unknown-module"
|
|
90
100
|
| "use-server-directive";
|
|
91
101
|
|
|
102
|
+
/** Records one decision made while classifying a boundary graph. */
|
|
92
103
|
export interface BoundaryGraphTraceEvent {
|
|
93
104
|
classification: BoundaryClassification;
|
|
94
105
|
exportName?: string;
|
|
@@ -104,6 +115,7 @@ export interface BoundaryGraphTraceEvent {
|
|
|
104
115
|
viaExportName?: string;
|
|
105
116
|
}
|
|
106
117
|
|
|
118
|
+
/** Contains modules, client boundaries, server actions, diagnostics, and trace events for a graph analysis run. */
|
|
107
119
|
export interface BoundaryGraphResult {
|
|
108
120
|
clientBoundaries: BoundaryGraphClientBoundary[];
|
|
109
121
|
diagnostics: Diagnostic[];
|
|
@@ -118,6 +130,7 @@ interface ResolvedServerActionTarget {
|
|
|
118
130
|
moduleFile: string;
|
|
119
131
|
}
|
|
120
132
|
|
|
133
|
+
/** Analyzes route modules and static imports to classify server, client, shared, and action boundaries. */
|
|
121
134
|
export async function analyzeBoundaryGraph(
|
|
122
135
|
input: BoundaryGraphInput,
|
|
123
136
|
): Promise<BoundaryGraphResult> {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parseSync } from "oxc-parser";
|
|
2
2
|
|
|
3
|
+
/** Stores parsed OXC program data and parse errors for a compiler module. */
|
|
3
4
|
export interface CompilerModuleContext {
|
|
4
5
|
code: string;
|
|
5
6
|
filename: string;
|
|
@@ -7,6 +8,7 @@ export interface CompilerModuleContext {
|
|
|
7
8
|
program: unknown;
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
/** Parses source code with OXC and returns a compiler module context. */
|
|
10
12
|
export function createCompilerModuleContextWithOxc(input: {
|
|
11
13
|
code: string;
|
|
12
14
|
filename?: string | undefined;
|
package/src/diagnostics.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Re-exports compiler module analysis helpers from the internal compiler API. */
|
|
1
2
|
export {
|
|
2
3
|
collectIdentifierReferenceNames,
|
|
3
4
|
collectJsxComponentRootNames,
|
|
@@ -17,6 +18,7 @@ export {
|
|
|
17
18
|
stripTopLevelExportDeclarations,
|
|
18
19
|
stripUnusedStaticValueImports,
|
|
19
20
|
} from "./internal.js";
|
|
21
|
+
/** Re-exports compiler module analysis types from the internal compiler API. */
|
|
20
22
|
export type {
|
|
21
23
|
StaticExportReference,
|
|
22
24
|
StaticExportSpecifierReference,
|