@renderify/ir 0.1.0
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/LICENSE +21 -0
- package/README.md +55 -0
- package/dist/ir.cjs.js +576 -0
- package/dist/ir.cjs.js.map +1 -0
- package/dist/ir.d.mts +175 -0
- package/dist/ir.d.ts +175 -0
- package/dist/ir.esm.js +556 -0
- package/dist/ir.esm.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/hash.ts","../src/source-imports.ts"],"sourcesContent":["export type JsonPrimitive = string | number | boolean | null;\n\nexport {\n createFnv1a64Hasher,\n type Fnv1a64Hasher,\n hashStringFNV1a32,\n hashStringFNV1a32Base36,\n hashStringFNV1a64Hex,\n} from \"./hash\";\nexport {\n collectRuntimeSourceImports,\n parseRuntimeSourceImportRanges,\n type RuntimeSourceImportRange,\n} from \"./source-imports\";\n\nexport type JsonValue = JsonPrimitive | JsonObject | JsonValue[];\n\nexport interface JsonObject {\n [key: string]: JsonValue;\n}\n\nexport interface RuntimeTextNode {\n type: \"text\";\n value: string;\n}\n\nexport interface RuntimeElementNode {\n type: \"element\";\n tag: string;\n props?: Record<string, JsonValue>;\n children?: RuntimeNode[];\n}\n\nexport interface RuntimeComponentNode {\n type: \"component\";\n module: string;\n exportName?: string;\n props?: Record<string, JsonValue>;\n children?: RuntimeNode[];\n}\n\nexport type RuntimeNode =\n | RuntimeTextNode\n | RuntimeElementNode\n | RuntimeComponentNode;\n\nexport type RuntimeExecutionProfile =\n | \"standard\"\n | \"isolated-vm\"\n | \"sandbox-worker\"\n | \"sandbox-iframe\";\n\nexport const DEFAULT_JSPM_SPECIFIER_OVERRIDES: Readonly<\n Record<string, string>\n> = Object.freeze({\n preact: \"https://ga.jspm.io/npm:preact@10.28.3/dist/preact.module.js\",\n \"preact/hooks\":\n \"https://ga.jspm.io/npm:preact@10.28.3/hooks/dist/hooks.module.js\",\n \"preact/compat\":\n \"https://ga.jspm.io/npm:preact@10.28.3/compat/dist/compat.module.js\",\n \"preact/jsx-runtime\":\n \"https://ga.jspm.io/npm:preact@10.28.3/jsx-runtime/dist/jsxRuntime.module.js\",\n react: \"https://ga.jspm.io/npm:preact@10.28.3/compat/dist/compat.module.js\",\n \"react-dom\":\n \"https://ga.jspm.io/npm:preact@10.28.3/compat/dist/compat.module.js\",\n \"react-dom/client\":\n \"https://ga.jspm.io/npm:preact@10.28.3/compat/dist/compat.module.js\",\n \"react/jsx-runtime\":\n \"https://ga.jspm.io/npm:preact@10.28.3/jsx-runtime/dist/jsxRuntime.module.js\",\n \"react/jsx-dev-runtime\":\n \"https://ga.jspm.io/npm:preact@10.28.3/jsx-runtime/dist/jsxRuntime.module.js\",\n recharts: \"https://ga.jspm.io/npm:recharts@3.3.0/es6/index.js\",\n});\n\nexport type RuntimeSourceLanguage = \"js\" | \"jsx\" | \"ts\" | \"tsx\";\nexport type RuntimeSourceRuntime = \"renderify\" | \"preact\";\n\nexport interface RuntimeSourceModule {\n code: string;\n language: RuntimeSourceLanguage;\n exportName?: string;\n runtime?: RuntimeSourceRuntime;\n}\n\nexport const RUNTIME_PLAN_SPEC_VERSION_V1 = \"runtime-plan/v1\";\nexport const DEFAULT_RUNTIME_PLAN_SPEC_VERSION = RUNTIME_PLAN_SPEC_VERSION_V1;\n\nexport type RuntimePlanSpecVersion = typeof RUNTIME_PLAN_SPEC_VERSION_V1;\n\nexport interface RuntimeModuleDescriptor {\n resolvedUrl: string;\n integrity?: string;\n version?: string;\n signer?: string;\n}\n\nexport type RuntimeModuleManifest = Record<string, RuntimeModuleDescriptor>;\n\nexport interface RuntimeCapabilities {\n domWrite?: boolean;\n networkHosts?: string[];\n allowedModules?: string[];\n timers?: boolean;\n storage?: Array<\"localStorage\" | \"sessionStorage\">;\n executionProfile?: RuntimeExecutionProfile;\n maxImports?: number;\n maxComponentInvocations?: number;\n maxExecutionMs?: number;\n}\n\nexport interface RuntimeValueFromPath {\n $from: string;\n}\n\nexport type RuntimeActionValue = JsonValue | RuntimeValueFromPath;\n\nexport interface RuntimeSetAction {\n type: \"set\";\n path: string;\n value: RuntimeActionValue;\n}\n\nexport interface RuntimeIncrementAction {\n type: \"increment\";\n path: string;\n by?: number;\n}\n\nexport interface RuntimeToggleAction {\n type: \"toggle\";\n path: string;\n}\n\nexport interface RuntimePushAction {\n type: \"push\";\n path: string;\n value: RuntimeActionValue;\n}\n\nexport type RuntimeAction =\n | RuntimeSetAction\n | RuntimeIncrementAction\n | RuntimeToggleAction\n | RuntimePushAction;\n\nexport interface RuntimeEvent {\n type: string;\n payload?: Record<string, JsonValue>;\n}\n\nexport type RuntimeStateSnapshot = Record<string, JsonValue>;\n\nexport interface RuntimeStateModel {\n initial: RuntimeStateSnapshot;\n transitions?: Record<string, RuntimeAction[]>;\n}\n\nexport interface RuntimePlanMetadata {\n sourcePrompt?: string;\n sourceModel?: string;\n tags?: string[];\n [key: string]: JsonValue | undefined;\n}\n\nexport interface RuntimePlan {\n specVersion?: string;\n id: string;\n version: number;\n root: RuntimeNode;\n capabilities: RuntimeCapabilities;\n state?: RuntimeStateModel;\n imports?: string[];\n moduleManifest?: RuntimeModuleManifest;\n source?: RuntimeSourceModule;\n metadata?: RuntimePlanMetadata;\n}\n\nexport interface RuntimeExecutionContext {\n userId?: string;\n variables?: Record<string, JsonValue>;\n}\n\nexport interface RuntimeDiagnostic {\n level: \"info\" | \"warning\" | \"error\";\n code: string;\n message: string;\n}\n\nexport type RuntimeRenderArtifactMode = \"preact-vnode\";\n\nexport interface RuntimeRenderArtifact {\n mode: RuntimeRenderArtifactMode;\n payload: unknown;\n}\n\nexport interface RuntimeExecutionResult {\n planId: string;\n root: RuntimeNode;\n diagnostics: RuntimeDiagnostic[];\n state?: RuntimeStateSnapshot;\n handledEvent?: RuntimeEvent;\n appliedActions?: RuntimeAction[];\n renderArtifact?: RuntimeRenderArtifact;\n}\n\nexport function createTextNode(value: string): RuntimeTextNode {\n return { type: \"text\", value };\n}\n\nexport function createElementNode(\n tag: string,\n props?: Record<string, JsonValue>,\n children?: RuntimeNode[],\n): RuntimeElementNode {\n return { type: \"element\", tag, props, children };\n}\n\nexport function createComponentNode(\n module: string,\n exportName = \"default\",\n props?: Record<string, JsonValue>,\n children?: RuntimeNode[],\n): RuntimeComponentNode {\n return { type: \"component\", module, exportName, props, children };\n}\n\nexport function isRuntimeNode(value: unknown): value is RuntimeNode {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const candidate = value as Partial<RuntimeNode>;\n\n if (candidate.type === \"text\") {\n return typeof (candidate as RuntimeTextNode).value === \"string\";\n }\n\n if (candidate.type === \"element\") {\n return typeof (candidate as RuntimeElementNode).tag === \"string\";\n }\n\n if (candidate.type === \"component\") {\n return typeof (candidate as RuntimeComponentNode).module === \"string\";\n }\n\n return false;\n}\n\nexport function isJsonValue(value: unknown): value is JsonValue {\n return isJsonValueInternal(value, new Set<object>());\n}\n\nexport function isRuntimeValueFromPath(\n value: unknown,\n): value is RuntimeValueFromPath {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const candidate = value as Partial<RuntimeValueFromPath>;\n return typeof candidate.$from === \"string\";\n}\n\nexport function isRuntimeAction(value: unknown): value is RuntimeAction {\n if (!isRecord(value)) {\n return false;\n }\n\n if (typeof value.path !== \"string\" || value.path.trim().length === 0) {\n return false;\n }\n\n if (value.type === \"set\" || value.type === \"push\") {\n return (\n \"value\" in value &&\n (isJsonValue(value.value) || isRuntimeValueFromPath(value.value))\n );\n }\n\n if (value.type === \"increment\") {\n return (\n value.by === undefined ||\n (typeof value.by === \"number\" && Number.isFinite(value.by))\n );\n }\n\n if (value.type === \"toggle\") {\n return true;\n }\n\n return false;\n}\n\nexport function isRuntimeStateSnapshot(\n value: unknown,\n): value is RuntimeStateSnapshot {\n if (!isRecord(value)) {\n return false;\n }\n\n for (const entry of Object.values(value)) {\n if (!isJsonValue(entry)) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function isRuntimeStateModel(\n value: unknown,\n): value is RuntimeStateModel {\n if (!isRecord(value)) {\n return false;\n }\n\n if (!isRuntimeStateSnapshot(value.initial)) {\n return false;\n }\n\n if (value.transitions === undefined) {\n return true;\n }\n\n if (!isRecord(value.transitions)) {\n return false;\n }\n\n for (const [eventType, actions] of Object.entries(value.transitions)) {\n if (eventType.trim().length === 0) {\n return false;\n }\n\n if (!Array.isArray(actions)) {\n return false;\n }\n\n for (const action of actions) {\n if (!isRuntimeAction(action)) {\n return false;\n }\n }\n }\n\n return true;\n}\n\nexport function isRuntimeCapabilities(\n value: unknown,\n): value is RuntimeCapabilities {\n if (!isRecord(value)) {\n return false;\n }\n\n if (value.domWrite !== undefined && typeof value.domWrite !== \"boolean\") {\n return false;\n }\n\n if (\n value.networkHosts !== undefined &&\n (!Array.isArray(value.networkHosts) ||\n value.networkHosts.some((entry) => typeof entry !== \"string\"))\n ) {\n return false;\n }\n\n if (\n value.allowedModules !== undefined &&\n (!Array.isArray(value.allowedModules) ||\n value.allowedModules.some((entry) => typeof entry !== \"string\"))\n ) {\n return false;\n }\n\n if (value.timers !== undefined && typeof value.timers !== \"boolean\") {\n return false;\n }\n\n if (\n value.executionProfile !== undefined &&\n value.executionProfile !== \"standard\" &&\n value.executionProfile !== \"isolated-vm\" &&\n value.executionProfile !== \"sandbox-worker\" &&\n value.executionProfile !== \"sandbox-iframe\"\n ) {\n return false;\n }\n\n if (\n value.storage !== undefined &&\n (!Array.isArray(value.storage) ||\n value.storage.some(\n (entry) => entry !== \"localStorage\" && entry !== \"sessionStorage\",\n ))\n ) {\n return false;\n }\n\n if (!isFiniteNonNegativeNumber(value.maxImports)) {\n return false;\n }\n\n if (!isFiniteNonNegativeNumber(value.maxComponentInvocations)) {\n return false;\n }\n\n if (\n value.maxExecutionMs !== undefined &&\n (typeof value.maxExecutionMs !== \"number\" ||\n !Number.isFinite(value.maxExecutionMs) ||\n value.maxExecutionMs < 1)\n ) {\n return false;\n }\n\n return true;\n}\n\nexport function isRuntimeSourceLanguage(\n value: unknown,\n): value is RuntimeSourceLanguage {\n return value === \"js\" || value === \"jsx\" || value === \"ts\" || value === \"tsx\";\n}\n\nexport function isRuntimeSourceRuntime(\n value: unknown,\n): value is RuntimeSourceRuntime {\n return value === \"renderify\" || value === \"preact\";\n}\n\nexport function isRuntimeSourceModule(\n value: unknown,\n): value is RuntimeSourceModule {\n if (!isRecord(value)) {\n return false;\n }\n\n if (typeof value.code !== \"string\" || value.code.trim().length === 0) {\n return false;\n }\n\n if (!isRuntimeSourceLanguage(value.language)) {\n return false;\n }\n\n if (\n value.exportName !== undefined &&\n (typeof value.exportName !== \"string\" ||\n value.exportName.trim().length === 0)\n ) {\n return false;\n }\n\n if (value.runtime !== undefined && !isRuntimeSourceRuntime(value.runtime)) {\n return false;\n }\n\n return true;\n}\n\nexport function isRuntimePlanMetadata(\n value: unknown,\n): value is RuntimePlanMetadata {\n if (!isRecord(value)) {\n return false;\n }\n\n if (\n value.sourcePrompt !== undefined &&\n typeof value.sourcePrompt !== \"string\"\n ) {\n return false;\n }\n\n if (\n value.sourceModel !== undefined &&\n typeof value.sourceModel !== \"string\"\n ) {\n return false;\n }\n\n if (\n value.tags !== undefined &&\n (!Array.isArray(value.tags) ||\n value.tags.some((entry) => typeof entry !== \"string\"))\n ) {\n return false;\n }\n\n for (const [key, entry] of Object.entries(value)) {\n if (key === \"sourcePrompt\" || key === \"sourceModel\" || key === \"tags\") {\n continue;\n }\n\n if (entry !== undefined && !isJsonValue(entry)) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function isRuntimeEvent(value: unknown): value is RuntimeEvent {\n if (!isRecord(value)) {\n return false;\n }\n\n if (typeof value.type !== \"string\" || value.type.trim().length === 0) {\n return false;\n }\n\n if (value.payload !== undefined && !isRuntimeStateSnapshot(value.payload)) {\n return false;\n }\n\n return true;\n}\n\nexport function isRuntimePlan(value: unknown): value is RuntimePlan {\n if (!isRecord(value)) {\n return false;\n }\n\n if (typeof value.id !== \"string\" || value.id.trim().length === 0) {\n return false;\n }\n\n if (\n typeof value.version !== \"number\" ||\n !Number.isInteger(value.version) ||\n value.version <= 0\n ) {\n return false;\n }\n\n if (!isRuntimeNode(value.root)) {\n return false;\n }\n\n if (!isRuntimeCapabilities(value.capabilities)) {\n return false;\n }\n\n if (\n value.specVersion !== undefined &&\n (typeof value.specVersion !== \"string\" ||\n value.specVersion.trim().length === 0)\n ) {\n return false;\n }\n\n if (\n value.imports !== undefined &&\n (!Array.isArray(value.imports) ||\n value.imports.some((entry) => typeof entry !== \"string\"))\n ) {\n return false;\n }\n\n if (\n value.moduleManifest !== undefined &&\n !isRuntimeModuleManifest(value.moduleManifest)\n ) {\n return false;\n }\n\n if (value.state !== undefined && !isRuntimeStateModel(value.state)) {\n return false;\n }\n\n if (value.source !== undefined && !isRuntimeSourceModule(value.source)) {\n return false;\n }\n\n if (value.metadata !== undefined && !isRuntimePlanMetadata(value.metadata)) {\n return false;\n }\n\n return true;\n}\n\nexport function isRuntimeModuleDescriptor(\n value: unknown,\n): value is RuntimeModuleDescriptor {\n if (!isRecord(value)) {\n return false;\n }\n\n if (\n typeof value.resolvedUrl !== \"string\" ||\n value.resolvedUrl.trim().length === 0\n ) {\n return false;\n }\n\n if (\n value.integrity !== undefined &&\n (typeof value.integrity !== \"string\" || value.integrity.trim().length === 0)\n ) {\n return false;\n }\n\n if (\n value.version !== undefined &&\n (typeof value.version !== \"string\" || value.version.trim().length === 0)\n ) {\n return false;\n }\n\n if (\n value.signer !== undefined &&\n (typeof value.signer !== \"string\" || value.signer.trim().length === 0)\n ) {\n return false;\n }\n\n return true;\n}\n\nexport function isRuntimeModuleManifest(\n value: unknown,\n): value is RuntimeModuleManifest {\n if (!isRecord(value)) {\n return false;\n }\n\n for (const [specifier, descriptor] of Object.entries(value)) {\n if (specifier.trim().length === 0) {\n return false;\n }\n\n if (!isRuntimeModuleDescriptor(descriptor)) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function resolveRuntimePlanSpecVersion(specVersion?: string): string {\n if (typeof specVersion === \"string\" && specVersion.trim().length > 0) {\n return specVersion.trim();\n }\n\n return DEFAULT_RUNTIME_PLAN_SPEC_VERSION;\n}\n\nexport function walkRuntimeNode(\n node: RuntimeNode,\n visitor: (node: RuntimeNode, depth: number) => void,\n depth = 0,\n): void {\n visitor(node, depth);\n\n const children = node.type === \"text\" ? undefined : node.children;\n if (!children || children.length === 0) {\n return;\n }\n\n for (const child of children) {\n walkRuntimeNode(child, visitor, depth + 1);\n }\n}\n\nexport function collectComponentModules(root: RuntimeNode): string[] {\n const modules = new Set<string>();\n\n walkRuntimeNode(root, (node) => {\n if (node.type === \"component\") {\n modules.add(node.module);\n }\n });\n\n return [...modules];\n}\n\nexport function splitPath(path: string): string[] {\n return path\n .split(\".\")\n .map((segment) => segment.trim())\n .filter((segment) => segment.length > 0);\n}\n\nexport function isSafePath(path: string): boolean {\n const segments = splitPath(path);\n\n if (segments.length === 0) {\n return false;\n }\n\n for (const segment of segments) {\n if (\n segment === \"__proto__\" ||\n segment === \"prototype\" ||\n segment === \"constructor\"\n ) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function getValueByPath(source: unknown, path: string): unknown {\n const segments = splitPath(path);\n if (segments.length === 0) {\n return undefined;\n }\n\n let cursor: unknown = source;\n\n for (const segment of segments) {\n if (typeof cursor !== \"object\" || cursor === null) {\n return undefined;\n }\n\n cursor = (cursor as Record<string, unknown>)[segment];\n }\n\n return cursor;\n}\n\nexport function setValueByPath(\n target: RuntimeStateSnapshot,\n path: string,\n value: JsonValue,\n): void {\n const segments = splitPath(path);\n if (segments.length === 0) {\n return;\n }\n\n let cursor: Record<string, JsonValue> = target;\n\n for (let i = 0; i < segments.length; i += 1) {\n const segment = segments[i];\n const isLast = i === segments.length - 1;\n\n if (isLast) {\n cursor[segment] = value;\n return;\n }\n\n const next = cursor[segment];\n if (typeof next !== \"object\" || next === null || Array.isArray(next)) {\n cursor[segment] = {};\n }\n\n cursor = cursor[segment] as Record<string, JsonValue>;\n }\n}\n\nexport function cloneJsonValue<T extends JsonValue>(value: T): T {\n if (typeof globalThis.structuredClone === \"function\") {\n return globalThis.structuredClone(value) as T;\n }\n\n return JSON.parse(JSON.stringify(value)) as T;\n}\n\nexport function asJsonValue(value: unknown): JsonValue {\n if (value === undefined) {\n return null;\n }\n\n if (\n value === null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\"\n ) {\n return value;\n }\n\n if (typeof value === \"number\") {\n return Number.isFinite(value) ? value : null;\n }\n\n if (Array.isArray(value)) {\n return value.map((item) => asJsonValue(item));\n }\n\n if (typeof value === \"object\" && value !== null) {\n const result: JsonObject = {};\n for (const [key, item] of Object.entries(value)) {\n result[key] = asJsonValue(item);\n }\n return result;\n }\n\n return String(value);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isFiniteNonNegativeNumber(value: unknown): boolean {\n return (\n value === undefined ||\n (typeof value === \"number\" && Number.isFinite(value) && value >= 0)\n );\n}\n\nfunction isJsonValueInternal(value: unknown, seen: Set<object>): boolean {\n if (\n value === null ||\n typeof value === \"string\" ||\n typeof value === \"boolean\"\n ) {\n return true;\n }\n\n if (typeof value === \"number\") {\n return Number.isFinite(value);\n }\n\n if (Array.isArray(value)) {\n if (seen.has(value)) {\n return false;\n }\n\n seen.add(value);\n const valid = value.every((entry) => isJsonValueInternal(entry, seen));\n seen.delete(value);\n return valid;\n }\n\n if (isRecord(value)) {\n if (seen.has(value)) {\n return false;\n }\n\n seen.add(value);\n const valid = Object.values(value).every((entry) =>\n isJsonValueInternal(entry, seen),\n );\n seen.delete(value);\n return valid;\n }\n\n return false;\n}\n","const FNV1A_64_OFFSET_BASIS = 0xcbf29ce484222325n;\nconst FNV1A_64_PRIME = 0x100000001b3n;\nconst UINT64_MASK = 0xffffffffffffffffn;\n\nexport interface Fnv1a64Hasher {\n update(chunk: string): void;\n digestHex(): string;\n}\n\nexport function createFnv1a64Hasher(): Fnv1a64Hasher {\n let hash = FNV1A_64_OFFSET_BASIS;\n\n return {\n update: (chunk: string) => {\n for (let index = 0; index < chunk.length; index += 1) {\n hash ^= BigInt(chunk.charCodeAt(index));\n hash = (hash * FNV1A_64_PRIME) & UINT64_MASK;\n }\n },\n digestHex: () => hash.toString(16),\n };\n}\n\nexport function hashStringFNV1a64Hex(value: string): string {\n const hasher = createFnv1a64Hasher();\n hasher.update(value);\n return hasher.digestHex();\n}\n\nexport function hashStringFNV1a32(value: string): number {\n let hash = 2166136261;\n for (let index = 0; index < value.length; index += 1) {\n hash ^= value.charCodeAt(index);\n // Equivalent to `hash *= 0x01000193` (FNV-1a 32-bit prime) via bit shifts.\n hash +=\n (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);\n }\n return hash >>> 0;\n}\n\nexport function hashStringFNV1a32Base36(value: string): string {\n return hashStringFNV1a32(value).toString(36);\n}\n","import {\n init as initModuleLexer,\n parse as parseModuleImports,\n} from \"es-module-lexer\";\n\nconst SOURCE_IMPORT_REWRITE_PATTERNS = [\n /\\bfrom\\s+[\"']([^\"']+)[\"']/g,\n /\\bimport\\s+[\"']([^\"']+)[\"']/g,\n /\\bimport\\s*\\(\\s*[\"']([^\"']+)[\"']\\s*\\)/g,\n] as const;\n\nexport interface RuntimeSourceImportRange {\n start: number;\n end: number;\n specifier: string;\n}\n\nexport async function parseRuntimeSourceImportRanges(\n source: string,\n): Promise<RuntimeSourceImportRange[]> {\n if (source.trim().length === 0) {\n return [];\n }\n\n try {\n await initModuleLexer;\n const [imports] = parseModuleImports(source);\n const parsed: RuntimeSourceImportRange[] = [];\n\n for (const entry of imports) {\n const specifier = entry.n?.trim();\n if (!specifier) {\n continue;\n }\n\n if (entry.s < 0 || entry.e <= entry.s) {\n continue;\n }\n\n parsed.push({\n start: entry.s,\n end: entry.e,\n specifier,\n });\n }\n\n return parsed.sort((left, right) => left.start - right.start);\n } catch {\n return parseRuntimeSourceImportRangesFromRegex(source);\n }\n}\n\nexport async function collectRuntimeSourceImports(\n source: string,\n): Promise<string[]> {\n const ranges = await parseRuntimeSourceImportRanges(source);\n const imports = new Set<string>();\n\n for (const entry of ranges) {\n imports.add(entry.specifier);\n }\n\n return [...imports];\n}\n\nfunction parseRuntimeSourceImportRangesFromRegex(\n source: string,\n): RuntimeSourceImportRange[] {\n const parsed = new Map<string, RuntimeSourceImportRange>();\n\n for (const pattern of SOURCE_IMPORT_REWRITE_PATTERNS) {\n const regex = new RegExp(\n pattern.source,\n pattern.flags.includes(\"g\") ? pattern.flags : `${pattern.flags}g`,\n );\n\n let match = regex.exec(source);\n while (match) {\n const fullMatch = String(match[0] ?? \"\");\n const capturedSpecifier = String(match[1] ?? \"\").trim();\n if (capturedSpecifier.length === 0) {\n match = regex.exec(source);\n continue;\n }\n\n const relativeIndex = fullMatch.indexOf(capturedSpecifier);\n if (relativeIndex < 0) {\n match = regex.exec(source);\n continue;\n }\n\n const start = match.index + relativeIndex;\n const end = start + capturedSpecifier.length;\n parsed.set(`${start}:${end}`, {\n start,\n end,\n specifier: capturedSpecifier,\n });\n\n match = regex.exec(source);\n }\n }\n\n return [...parsed.values()].sort((left, right) => left.start - right.start);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAM,wBAAwB;AAC9B,IAAM,iBAAiB;AACvB,IAAM,cAAc;AAOb,SAAS,sBAAqC;AACnD,MAAI,OAAO;AAEX,SAAO;AAAA,IACL,QAAQ,CAAC,UAAkB;AACzB,eAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;AACpD,gBA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IAAI,KAAK,GAAG;AACnB,aAAO;AAAA,IACT;AAEA,SAAK,IAAI,KAAK;AACd,UAAM,QAAQ,MAAM,MAAM,CAAC,UAAU,oBAAoB,OAAO,IAAI,CAAC;AACrE,SAAK,OAAO,KAAK;AACjB,WAAO;AAAA,EACT;AAEA,MAAI,SAAS,KAAK,GAAG;AACnB,QAAI,KAAK,IAAI,KAAK,GAAG;AACnB,aAAO;AAAA,IACT;AAEA,SAAK,IAAI,KAAK;AACd,UAAM,QAAQ,OAAO,OAAO,KAAK,EAAE;AAAA,MAAM,CAAC,UACxC,oBAAoB,OAAO,IAAI;AAAA,IACjC;AACA,SAAK,OAAO,KAAK;AACjB,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":["initModuleLexer","parseModuleImports","module"]}
|
package/dist/ir.d.mts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
interface Fnv1a64Hasher {
|
|
2
|
+
update(chunk: string): void;
|
|
3
|
+
digestHex(): string;
|
|
4
|
+
}
|
|
5
|
+
declare function createFnv1a64Hasher(): Fnv1a64Hasher;
|
|
6
|
+
declare function hashStringFNV1a64Hex(value: string): string;
|
|
7
|
+
declare function hashStringFNV1a32(value: string): number;
|
|
8
|
+
declare function hashStringFNV1a32Base36(value: string): string;
|
|
9
|
+
|
|
10
|
+
interface RuntimeSourceImportRange {
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
specifier: string;
|
|
14
|
+
}
|
|
15
|
+
declare function parseRuntimeSourceImportRanges(source: string): Promise<RuntimeSourceImportRange[]>;
|
|
16
|
+
declare function collectRuntimeSourceImports(source: string): Promise<string[]>;
|
|
17
|
+
|
|
18
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
19
|
+
|
|
20
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
21
|
+
interface JsonObject {
|
|
22
|
+
[key: string]: JsonValue;
|
|
23
|
+
}
|
|
24
|
+
interface RuntimeTextNode {
|
|
25
|
+
type: "text";
|
|
26
|
+
value: string;
|
|
27
|
+
}
|
|
28
|
+
interface RuntimeElementNode {
|
|
29
|
+
type: "element";
|
|
30
|
+
tag: string;
|
|
31
|
+
props?: Record<string, JsonValue>;
|
|
32
|
+
children?: RuntimeNode[];
|
|
33
|
+
}
|
|
34
|
+
interface RuntimeComponentNode {
|
|
35
|
+
type: "component";
|
|
36
|
+
module: string;
|
|
37
|
+
exportName?: string;
|
|
38
|
+
props?: Record<string, JsonValue>;
|
|
39
|
+
children?: RuntimeNode[];
|
|
40
|
+
}
|
|
41
|
+
type RuntimeNode = RuntimeTextNode | RuntimeElementNode | RuntimeComponentNode;
|
|
42
|
+
type RuntimeExecutionProfile = "standard" | "isolated-vm" | "sandbox-worker" | "sandbox-iframe";
|
|
43
|
+
declare const DEFAULT_JSPM_SPECIFIER_OVERRIDES: Readonly<Record<string, string>>;
|
|
44
|
+
type RuntimeSourceLanguage = "js" | "jsx" | "ts" | "tsx";
|
|
45
|
+
type RuntimeSourceRuntime = "renderify" | "preact";
|
|
46
|
+
interface RuntimeSourceModule {
|
|
47
|
+
code: string;
|
|
48
|
+
language: RuntimeSourceLanguage;
|
|
49
|
+
exportName?: string;
|
|
50
|
+
runtime?: RuntimeSourceRuntime;
|
|
51
|
+
}
|
|
52
|
+
declare const RUNTIME_PLAN_SPEC_VERSION_V1 = "runtime-plan/v1";
|
|
53
|
+
declare const DEFAULT_RUNTIME_PLAN_SPEC_VERSION = "runtime-plan/v1";
|
|
54
|
+
type RuntimePlanSpecVersion = typeof RUNTIME_PLAN_SPEC_VERSION_V1;
|
|
55
|
+
interface RuntimeModuleDescriptor {
|
|
56
|
+
resolvedUrl: string;
|
|
57
|
+
integrity?: string;
|
|
58
|
+
version?: string;
|
|
59
|
+
signer?: string;
|
|
60
|
+
}
|
|
61
|
+
type RuntimeModuleManifest = Record<string, RuntimeModuleDescriptor>;
|
|
62
|
+
interface RuntimeCapabilities {
|
|
63
|
+
domWrite?: boolean;
|
|
64
|
+
networkHosts?: string[];
|
|
65
|
+
allowedModules?: string[];
|
|
66
|
+
timers?: boolean;
|
|
67
|
+
storage?: Array<"localStorage" | "sessionStorage">;
|
|
68
|
+
executionProfile?: RuntimeExecutionProfile;
|
|
69
|
+
maxImports?: number;
|
|
70
|
+
maxComponentInvocations?: number;
|
|
71
|
+
maxExecutionMs?: number;
|
|
72
|
+
}
|
|
73
|
+
interface RuntimeValueFromPath {
|
|
74
|
+
$from: string;
|
|
75
|
+
}
|
|
76
|
+
type RuntimeActionValue = JsonValue | RuntimeValueFromPath;
|
|
77
|
+
interface RuntimeSetAction {
|
|
78
|
+
type: "set";
|
|
79
|
+
path: string;
|
|
80
|
+
value: RuntimeActionValue;
|
|
81
|
+
}
|
|
82
|
+
interface RuntimeIncrementAction {
|
|
83
|
+
type: "increment";
|
|
84
|
+
path: string;
|
|
85
|
+
by?: number;
|
|
86
|
+
}
|
|
87
|
+
interface RuntimeToggleAction {
|
|
88
|
+
type: "toggle";
|
|
89
|
+
path: string;
|
|
90
|
+
}
|
|
91
|
+
interface RuntimePushAction {
|
|
92
|
+
type: "push";
|
|
93
|
+
path: string;
|
|
94
|
+
value: RuntimeActionValue;
|
|
95
|
+
}
|
|
96
|
+
type RuntimeAction = RuntimeSetAction | RuntimeIncrementAction | RuntimeToggleAction | RuntimePushAction;
|
|
97
|
+
interface RuntimeEvent {
|
|
98
|
+
type: string;
|
|
99
|
+
payload?: Record<string, JsonValue>;
|
|
100
|
+
}
|
|
101
|
+
type RuntimeStateSnapshot = Record<string, JsonValue>;
|
|
102
|
+
interface RuntimeStateModel {
|
|
103
|
+
initial: RuntimeStateSnapshot;
|
|
104
|
+
transitions?: Record<string, RuntimeAction[]>;
|
|
105
|
+
}
|
|
106
|
+
interface RuntimePlanMetadata {
|
|
107
|
+
sourcePrompt?: string;
|
|
108
|
+
sourceModel?: string;
|
|
109
|
+
tags?: string[];
|
|
110
|
+
[key: string]: JsonValue | undefined;
|
|
111
|
+
}
|
|
112
|
+
interface RuntimePlan {
|
|
113
|
+
specVersion?: string;
|
|
114
|
+
id: string;
|
|
115
|
+
version: number;
|
|
116
|
+
root: RuntimeNode;
|
|
117
|
+
capabilities: RuntimeCapabilities;
|
|
118
|
+
state?: RuntimeStateModel;
|
|
119
|
+
imports?: string[];
|
|
120
|
+
moduleManifest?: RuntimeModuleManifest;
|
|
121
|
+
source?: RuntimeSourceModule;
|
|
122
|
+
metadata?: RuntimePlanMetadata;
|
|
123
|
+
}
|
|
124
|
+
interface RuntimeExecutionContext {
|
|
125
|
+
userId?: string;
|
|
126
|
+
variables?: Record<string, JsonValue>;
|
|
127
|
+
}
|
|
128
|
+
interface RuntimeDiagnostic {
|
|
129
|
+
level: "info" | "warning" | "error";
|
|
130
|
+
code: string;
|
|
131
|
+
message: string;
|
|
132
|
+
}
|
|
133
|
+
type RuntimeRenderArtifactMode = "preact-vnode";
|
|
134
|
+
interface RuntimeRenderArtifact {
|
|
135
|
+
mode: RuntimeRenderArtifactMode;
|
|
136
|
+
payload: unknown;
|
|
137
|
+
}
|
|
138
|
+
interface RuntimeExecutionResult {
|
|
139
|
+
planId: string;
|
|
140
|
+
root: RuntimeNode;
|
|
141
|
+
diagnostics: RuntimeDiagnostic[];
|
|
142
|
+
state?: RuntimeStateSnapshot;
|
|
143
|
+
handledEvent?: RuntimeEvent;
|
|
144
|
+
appliedActions?: RuntimeAction[];
|
|
145
|
+
renderArtifact?: RuntimeRenderArtifact;
|
|
146
|
+
}
|
|
147
|
+
declare function createTextNode(value: string): RuntimeTextNode;
|
|
148
|
+
declare function createElementNode(tag: string, props?: Record<string, JsonValue>, children?: RuntimeNode[]): RuntimeElementNode;
|
|
149
|
+
declare function createComponentNode(module: string, exportName?: string, props?: Record<string, JsonValue>, children?: RuntimeNode[]): RuntimeComponentNode;
|
|
150
|
+
declare function isRuntimeNode(value: unknown): value is RuntimeNode;
|
|
151
|
+
declare function isJsonValue(value: unknown): value is JsonValue;
|
|
152
|
+
declare function isRuntimeValueFromPath(value: unknown): value is RuntimeValueFromPath;
|
|
153
|
+
declare function isRuntimeAction(value: unknown): value is RuntimeAction;
|
|
154
|
+
declare function isRuntimeStateSnapshot(value: unknown): value is RuntimeStateSnapshot;
|
|
155
|
+
declare function isRuntimeStateModel(value: unknown): value is RuntimeStateModel;
|
|
156
|
+
declare function isRuntimeCapabilities(value: unknown): value is RuntimeCapabilities;
|
|
157
|
+
declare function isRuntimeSourceLanguage(value: unknown): value is RuntimeSourceLanguage;
|
|
158
|
+
declare function isRuntimeSourceRuntime(value: unknown): value is RuntimeSourceRuntime;
|
|
159
|
+
declare function isRuntimeSourceModule(value: unknown): value is RuntimeSourceModule;
|
|
160
|
+
declare function isRuntimePlanMetadata(value: unknown): value is RuntimePlanMetadata;
|
|
161
|
+
declare function isRuntimeEvent(value: unknown): value is RuntimeEvent;
|
|
162
|
+
declare function isRuntimePlan(value: unknown): value is RuntimePlan;
|
|
163
|
+
declare function isRuntimeModuleDescriptor(value: unknown): value is RuntimeModuleDescriptor;
|
|
164
|
+
declare function isRuntimeModuleManifest(value: unknown): value is RuntimeModuleManifest;
|
|
165
|
+
declare function resolveRuntimePlanSpecVersion(specVersion?: string): string;
|
|
166
|
+
declare function walkRuntimeNode(node: RuntimeNode, visitor: (node: RuntimeNode, depth: number) => void, depth?: number): void;
|
|
167
|
+
declare function collectComponentModules(root: RuntimeNode): string[];
|
|
168
|
+
declare function splitPath(path: string): string[];
|
|
169
|
+
declare function isSafePath(path: string): boolean;
|
|
170
|
+
declare function getValueByPath(source: unknown, path: string): unknown;
|
|
171
|
+
declare function setValueByPath(target: RuntimeStateSnapshot, path: string, value: JsonValue): void;
|
|
172
|
+
declare function cloneJsonValue<T extends JsonValue>(value: T): T;
|
|
173
|
+
declare function asJsonValue(value: unknown): JsonValue;
|
|
174
|
+
|
|
175
|
+
export { DEFAULT_JSPM_SPECIFIER_OVERRIDES, DEFAULT_RUNTIME_PLAN_SPEC_VERSION, type Fnv1a64Hasher, type JsonObject, type JsonPrimitive, type JsonValue, RUNTIME_PLAN_SPEC_VERSION_V1, type RuntimeAction, type RuntimeActionValue, type RuntimeCapabilities, type RuntimeComponentNode, type RuntimeDiagnostic, type RuntimeElementNode, type RuntimeEvent, type RuntimeExecutionContext, type RuntimeExecutionProfile, type RuntimeExecutionResult, type RuntimeIncrementAction, type RuntimeModuleDescriptor, type RuntimeModuleManifest, type RuntimeNode, type RuntimePlan, type RuntimePlanMetadata, type RuntimePlanSpecVersion, type RuntimePushAction, type RuntimeRenderArtifact, type RuntimeRenderArtifactMode, type RuntimeSetAction, type RuntimeSourceImportRange, type RuntimeSourceLanguage, type RuntimeSourceModule, type RuntimeSourceRuntime, type RuntimeStateModel, type RuntimeStateSnapshot, type RuntimeTextNode, type RuntimeToggleAction, type RuntimeValueFromPath, asJsonValue, cloneJsonValue, collectComponentModules, collectRuntimeSourceImports, createComponentNode, createElementNode, createFnv1a64Hasher, createTextNode, getValueByPath, hashStringFNV1a32, hashStringFNV1a32Base36, hashStringFNV1a64Hex, isJsonValue, isRuntimeAction, isRuntimeCapabilities, isRuntimeEvent, isRuntimeModuleDescriptor, isRuntimeModuleManifest, isRuntimeNode, isRuntimePlan, isRuntimePlanMetadata, isRuntimeSourceLanguage, isRuntimeSourceModule, isRuntimeSourceRuntime, isRuntimeStateModel, isRuntimeStateSnapshot, isRuntimeValueFromPath, isSafePath, parseRuntimeSourceImportRanges, resolveRuntimePlanSpecVersion, setValueByPath, splitPath, walkRuntimeNode };
|
package/dist/ir.d.ts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
interface Fnv1a64Hasher {
|
|
2
|
+
update(chunk: string): void;
|
|
3
|
+
digestHex(): string;
|
|
4
|
+
}
|
|
5
|
+
declare function createFnv1a64Hasher(): Fnv1a64Hasher;
|
|
6
|
+
declare function hashStringFNV1a64Hex(value: string): string;
|
|
7
|
+
declare function hashStringFNV1a32(value: string): number;
|
|
8
|
+
declare function hashStringFNV1a32Base36(value: string): string;
|
|
9
|
+
|
|
10
|
+
interface RuntimeSourceImportRange {
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
specifier: string;
|
|
14
|
+
}
|
|
15
|
+
declare function parseRuntimeSourceImportRanges(source: string): Promise<RuntimeSourceImportRange[]>;
|
|
16
|
+
declare function collectRuntimeSourceImports(source: string): Promise<string[]>;
|
|
17
|
+
|
|
18
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
19
|
+
|
|
20
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
21
|
+
interface JsonObject {
|
|
22
|
+
[key: string]: JsonValue;
|
|
23
|
+
}
|
|
24
|
+
interface RuntimeTextNode {
|
|
25
|
+
type: "text";
|
|
26
|
+
value: string;
|
|
27
|
+
}
|
|
28
|
+
interface RuntimeElementNode {
|
|
29
|
+
type: "element";
|
|
30
|
+
tag: string;
|
|
31
|
+
props?: Record<string, JsonValue>;
|
|
32
|
+
children?: RuntimeNode[];
|
|
33
|
+
}
|
|
34
|
+
interface RuntimeComponentNode {
|
|
35
|
+
type: "component";
|
|
36
|
+
module: string;
|
|
37
|
+
exportName?: string;
|
|
38
|
+
props?: Record<string, JsonValue>;
|
|
39
|
+
children?: RuntimeNode[];
|
|
40
|
+
}
|
|
41
|
+
type RuntimeNode = RuntimeTextNode | RuntimeElementNode | RuntimeComponentNode;
|
|
42
|
+
type RuntimeExecutionProfile = "standard" | "isolated-vm" | "sandbox-worker" | "sandbox-iframe";
|
|
43
|
+
declare const DEFAULT_JSPM_SPECIFIER_OVERRIDES: Readonly<Record<string, string>>;
|
|
44
|
+
type RuntimeSourceLanguage = "js" | "jsx" | "ts" | "tsx";
|
|
45
|
+
type RuntimeSourceRuntime = "renderify" | "preact";
|
|
46
|
+
interface RuntimeSourceModule {
|
|
47
|
+
code: string;
|
|
48
|
+
language: RuntimeSourceLanguage;
|
|
49
|
+
exportName?: string;
|
|
50
|
+
runtime?: RuntimeSourceRuntime;
|
|
51
|
+
}
|
|
52
|
+
declare const RUNTIME_PLAN_SPEC_VERSION_V1 = "runtime-plan/v1";
|
|
53
|
+
declare const DEFAULT_RUNTIME_PLAN_SPEC_VERSION = "runtime-plan/v1";
|
|
54
|
+
type RuntimePlanSpecVersion = typeof RUNTIME_PLAN_SPEC_VERSION_V1;
|
|
55
|
+
interface RuntimeModuleDescriptor {
|
|
56
|
+
resolvedUrl: string;
|
|
57
|
+
integrity?: string;
|
|
58
|
+
version?: string;
|
|
59
|
+
signer?: string;
|
|
60
|
+
}
|
|
61
|
+
type RuntimeModuleManifest = Record<string, RuntimeModuleDescriptor>;
|
|
62
|
+
interface RuntimeCapabilities {
|
|
63
|
+
domWrite?: boolean;
|
|
64
|
+
networkHosts?: string[];
|
|
65
|
+
allowedModules?: string[];
|
|
66
|
+
timers?: boolean;
|
|
67
|
+
storage?: Array<"localStorage" | "sessionStorage">;
|
|
68
|
+
executionProfile?: RuntimeExecutionProfile;
|
|
69
|
+
maxImports?: number;
|
|
70
|
+
maxComponentInvocations?: number;
|
|
71
|
+
maxExecutionMs?: number;
|
|
72
|
+
}
|
|
73
|
+
interface RuntimeValueFromPath {
|
|
74
|
+
$from: string;
|
|
75
|
+
}
|
|
76
|
+
type RuntimeActionValue = JsonValue | RuntimeValueFromPath;
|
|
77
|
+
interface RuntimeSetAction {
|
|
78
|
+
type: "set";
|
|
79
|
+
path: string;
|
|
80
|
+
value: RuntimeActionValue;
|
|
81
|
+
}
|
|
82
|
+
interface RuntimeIncrementAction {
|
|
83
|
+
type: "increment";
|
|
84
|
+
path: string;
|
|
85
|
+
by?: number;
|
|
86
|
+
}
|
|
87
|
+
interface RuntimeToggleAction {
|
|
88
|
+
type: "toggle";
|
|
89
|
+
path: string;
|
|
90
|
+
}
|
|
91
|
+
interface RuntimePushAction {
|
|
92
|
+
type: "push";
|
|
93
|
+
path: string;
|
|
94
|
+
value: RuntimeActionValue;
|
|
95
|
+
}
|
|
96
|
+
type RuntimeAction = RuntimeSetAction | RuntimeIncrementAction | RuntimeToggleAction | RuntimePushAction;
|
|
97
|
+
interface RuntimeEvent {
|
|
98
|
+
type: string;
|
|
99
|
+
payload?: Record<string, JsonValue>;
|
|
100
|
+
}
|
|
101
|
+
type RuntimeStateSnapshot = Record<string, JsonValue>;
|
|
102
|
+
interface RuntimeStateModel {
|
|
103
|
+
initial: RuntimeStateSnapshot;
|
|
104
|
+
transitions?: Record<string, RuntimeAction[]>;
|
|
105
|
+
}
|
|
106
|
+
interface RuntimePlanMetadata {
|
|
107
|
+
sourcePrompt?: string;
|
|
108
|
+
sourceModel?: string;
|
|
109
|
+
tags?: string[];
|
|
110
|
+
[key: string]: JsonValue | undefined;
|
|
111
|
+
}
|
|
112
|
+
interface RuntimePlan {
|
|
113
|
+
specVersion?: string;
|
|
114
|
+
id: string;
|
|
115
|
+
version: number;
|
|
116
|
+
root: RuntimeNode;
|
|
117
|
+
capabilities: RuntimeCapabilities;
|
|
118
|
+
state?: RuntimeStateModel;
|
|
119
|
+
imports?: string[];
|
|
120
|
+
moduleManifest?: RuntimeModuleManifest;
|
|
121
|
+
source?: RuntimeSourceModule;
|
|
122
|
+
metadata?: RuntimePlanMetadata;
|
|
123
|
+
}
|
|
124
|
+
interface RuntimeExecutionContext {
|
|
125
|
+
userId?: string;
|
|
126
|
+
variables?: Record<string, JsonValue>;
|
|
127
|
+
}
|
|
128
|
+
interface RuntimeDiagnostic {
|
|
129
|
+
level: "info" | "warning" | "error";
|
|
130
|
+
code: string;
|
|
131
|
+
message: string;
|
|
132
|
+
}
|
|
133
|
+
type RuntimeRenderArtifactMode = "preact-vnode";
|
|
134
|
+
interface RuntimeRenderArtifact {
|
|
135
|
+
mode: RuntimeRenderArtifactMode;
|
|
136
|
+
payload: unknown;
|
|
137
|
+
}
|
|
138
|
+
interface RuntimeExecutionResult {
|
|
139
|
+
planId: string;
|
|
140
|
+
root: RuntimeNode;
|
|
141
|
+
diagnostics: RuntimeDiagnostic[];
|
|
142
|
+
state?: RuntimeStateSnapshot;
|
|
143
|
+
handledEvent?: RuntimeEvent;
|
|
144
|
+
appliedActions?: RuntimeAction[];
|
|
145
|
+
renderArtifact?: RuntimeRenderArtifact;
|
|
146
|
+
}
|
|
147
|
+
declare function createTextNode(value: string): RuntimeTextNode;
|
|
148
|
+
declare function createElementNode(tag: string, props?: Record<string, JsonValue>, children?: RuntimeNode[]): RuntimeElementNode;
|
|
149
|
+
declare function createComponentNode(module: string, exportName?: string, props?: Record<string, JsonValue>, children?: RuntimeNode[]): RuntimeComponentNode;
|
|
150
|
+
declare function isRuntimeNode(value: unknown): value is RuntimeNode;
|
|
151
|
+
declare function isJsonValue(value: unknown): value is JsonValue;
|
|
152
|
+
declare function isRuntimeValueFromPath(value: unknown): value is RuntimeValueFromPath;
|
|
153
|
+
declare function isRuntimeAction(value: unknown): value is RuntimeAction;
|
|
154
|
+
declare function isRuntimeStateSnapshot(value: unknown): value is RuntimeStateSnapshot;
|
|
155
|
+
declare function isRuntimeStateModel(value: unknown): value is RuntimeStateModel;
|
|
156
|
+
declare function isRuntimeCapabilities(value: unknown): value is RuntimeCapabilities;
|
|
157
|
+
declare function isRuntimeSourceLanguage(value: unknown): value is RuntimeSourceLanguage;
|
|
158
|
+
declare function isRuntimeSourceRuntime(value: unknown): value is RuntimeSourceRuntime;
|
|
159
|
+
declare function isRuntimeSourceModule(value: unknown): value is RuntimeSourceModule;
|
|
160
|
+
declare function isRuntimePlanMetadata(value: unknown): value is RuntimePlanMetadata;
|
|
161
|
+
declare function isRuntimeEvent(value: unknown): value is RuntimeEvent;
|
|
162
|
+
declare function isRuntimePlan(value: unknown): value is RuntimePlan;
|
|
163
|
+
declare function isRuntimeModuleDescriptor(value: unknown): value is RuntimeModuleDescriptor;
|
|
164
|
+
declare function isRuntimeModuleManifest(value: unknown): value is RuntimeModuleManifest;
|
|
165
|
+
declare function resolveRuntimePlanSpecVersion(specVersion?: string): string;
|
|
166
|
+
declare function walkRuntimeNode(node: RuntimeNode, visitor: (node: RuntimeNode, depth: number) => void, depth?: number): void;
|
|
167
|
+
declare function collectComponentModules(root: RuntimeNode): string[];
|
|
168
|
+
declare function splitPath(path: string): string[];
|
|
169
|
+
declare function isSafePath(path: string): boolean;
|
|
170
|
+
declare function getValueByPath(source: unknown, path: string): unknown;
|
|
171
|
+
declare function setValueByPath(target: RuntimeStateSnapshot, path: string, value: JsonValue): void;
|
|
172
|
+
declare function cloneJsonValue<T extends JsonValue>(value: T): T;
|
|
173
|
+
declare function asJsonValue(value: unknown): JsonValue;
|
|
174
|
+
|
|
175
|
+
export { DEFAULT_JSPM_SPECIFIER_OVERRIDES, DEFAULT_RUNTIME_PLAN_SPEC_VERSION, type Fnv1a64Hasher, type JsonObject, type JsonPrimitive, type JsonValue, RUNTIME_PLAN_SPEC_VERSION_V1, type RuntimeAction, type RuntimeActionValue, type RuntimeCapabilities, type RuntimeComponentNode, type RuntimeDiagnostic, type RuntimeElementNode, type RuntimeEvent, type RuntimeExecutionContext, type RuntimeExecutionProfile, type RuntimeExecutionResult, type RuntimeIncrementAction, type RuntimeModuleDescriptor, type RuntimeModuleManifest, type RuntimeNode, type RuntimePlan, type RuntimePlanMetadata, type RuntimePlanSpecVersion, type RuntimePushAction, type RuntimeRenderArtifact, type RuntimeRenderArtifactMode, type RuntimeSetAction, type RuntimeSourceImportRange, type RuntimeSourceLanguage, type RuntimeSourceModule, type RuntimeSourceRuntime, type RuntimeStateModel, type RuntimeStateSnapshot, type RuntimeTextNode, type RuntimeToggleAction, type RuntimeValueFromPath, asJsonValue, cloneJsonValue, collectComponentModules, collectRuntimeSourceImports, createComponentNode, createElementNode, createFnv1a64Hasher, createTextNode, getValueByPath, hashStringFNV1a32, hashStringFNV1a32Base36, hashStringFNV1a64Hex, isJsonValue, isRuntimeAction, isRuntimeCapabilities, isRuntimeEvent, isRuntimeModuleDescriptor, isRuntimeModuleManifest, isRuntimeNode, isRuntimePlan, isRuntimePlanMetadata, isRuntimeSourceLanguage, isRuntimeSourceModule, isRuntimeSourceRuntime, isRuntimeStateModel, isRuntimeStateSnapshot, isRuntimeValueFromPath, isSafePath, parseRuntimeSourceImportRanges, resolveRuntimePlanSpecVersion, setValueByPath, splitPath, walkRuntimeNode };
|