import { type EmbeddedJavaScriptEditorToken } from "./embedded-javascript-editor.ts"; import { type Span } from "./source.ts"; export type EmbeddedJavaScriptKind = "checked" | "unsafe"; export interface EmbeddedJavaScriptLiteralScan { readonly kind: EmbeddedJavaScriptKind; readonly start: number; readonly sourceStart: number; readonly sourceEnd: number; readonly end: number; readonly closed: boolean; readonly openingLineBreak: boolean; } export interface EmbeddedJavaScriptTokenPayload { readonly embeddedJavaScript: true; readonly kind: EmbeddedJavaScriptKind; readonly sourceSpan: Span; } export interface InspectedEmbeddedJavaScriptExport { readonly name: string; readonly nameSpan: Span; readonly local: string; readonly localSpan: Span; } export interface InspectedEmbeddedJavaScriptImport { readonly span: Span; } export interface InspectedEmbeddedJavaScriptDependency { readonly source: string; readonly span: Span; readonly dynamic: boolean; } export interface InspectedEmbeddedJavaScriptBinding { readonly name: string; readonly nameSpan: Span; } export interface EmbeddedJavaScriptFactoryEdit { readonly span: Span; readonly replacement: string; } export interface EmbeddedJavaScriptIssue { readonly message: string; readonly span: Span; } export interface EmbeddedJavaScriptInspection { readonly exports: readonly InspectedEmbeddedJavaScriptExport[]; readonly imports: readonly InspectedEmbeddedJavaScriptImport[]; readonly dependencies: readonly InspectedEmbeddedJavaScriptDependency[]; readonly bindings: readonly InspectedEmbeddedJavaScriptBinding[]; readonly editorTokens: readonly EmbeddedJavaScriptEditorToken[]; /** * AST-derived edits that turn a checked module body into a factory body: * imports leave the body, declaration exports lose only `export`, and export * lists leave the body because their local-to-exported mapping is in * `exports`. The emitter applies these to the original source slice, so no * foreign code is regenerated or formatted by Core. */ readonly factoryEdits: readonly EmbeddedJavaScriptFactoryEdit[]; readonly issues: readonly EmbeddedJavaScriptIssue[]; } /** * Recognizes the only two Core-owned tagged raw block headers. This is a small * scanner for VelarScript's header shape, not for JavaScript: the latter is * always parsed by Acorn below. */ export declare function embeddedJavaScriptHeaderKind(source: string, backtick: number): EmbeddedJavaScriptKind | null; /** * Scans one D53 raw block. The closing backtick is deliberately structural: * it is the only backtick at the declaration's indentation on an otherwise * empty line (apart from the checked block's `:`). JavaScript template * literals therefore need no escaping in every shape but one, which the rule * cannot avoid and D53 does not record: a literal whose closing backtick sits * alone on a line at that same indentation is indistinguishable from the * terminator and ends the block there. D53 has no escape for it, so * `structuralTerminatorHint` below names the rule when the truncated payload * fails to parse; the remedy is to indent that backtick. * * A truncation whose remnant is *itself* a legal module — `export const t = * String.raw` cut before its tagged literal — cannot be named from here at all, * because the payload this function hands on is indistinguishable from a block * the author meant to end there. Telling those apart needs the lone-backtick * line that follows the block, which only the lexer sees. */ export declare function scanEmbeddedJavaScriptLiteral(source: string, start: number): EmbeddedJavaScriptLiteralScan | null; export declare function isEmbeddedJavaScriptTokenPayload(value: unknown): value is EmbeddedJavaScriptTokenPayload; /** Parses a raw source slice as an ECMAScript module and derives all lowering metadata from its AST. */ export declare function inspectEmbeddedJavaScript(source: string, sourceStart: number, checked: boolean, capturedParameters?: readonly string[]): EmbeddedJavaScriptInspection; //# sourceMappingURL=embedded-javascript.d.ts.map