@danielx/civet 0.11.7 → 0.11.8
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/CHANGELOG.md +52 -0
- package/README.md +3 -7
- package/dist/browser.js +23954 -9243
- package/dist/browser.min.js +1 -0
- package/dist/cache.js +128 -0
- package/dist/cache.mjs +89 -0
- package/dist/civet +56 -8
- package/dist/main.js +37647 -12195
- package/dist/main.mjs +37647 -12195
- package/dist/ts-diagnostic.js +41 -0
- package/dist/ts-diagnostic.mjs +40 -0
- package/dist/ts-service/index.js +1239 -0
- package/dist/ts-service/index.js.map +7 -0
- package/dist/ts-service/index.mjs +1188 -0
- package/dist/ts-service/index.mjs.map +7 -0
- package/dist/types.d.ts +0 -14
- package/dist/unplugin/unplugin.d.ts +28 -1
- package/dist/unplugin/unplugin.js +269 -276
- package/dist/unplugin/unplugin.mjs +270 -282
- package/package.json +43 -20
- package/dist/esbuild-plugin.js +0 -131
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../source/ts-service/index.civet", "../../source/ts-service/snapshot.civet", "../../source/ts-service/path.civet", "../../source/ts-service/types.civet", "../../source/ts-service/host.civet", "../../source/ts-service/config.civet", "../../source/ts-service/service.civet", "../../source/ts-service/doc.civet", "../../source/ts-service/plugins/civet.civet", "../../source/cache.civet", "../../source/ts-service/plugins/hera.civet", "../../source/ts-service/typecheck.civet"],
|
|
4
|
+
"sourcesContent": ["/**\n * `@danielx/civet/ts-service` — shared Civet→TS pipeline for the LSP\n * server, CLI typecheck, and unplugin. Public surface: the TSService /\n * TSHost factories, the bundled Civet + Hera transpiler plugins, the\n * DocFactory / Plugin / Transpiler types, and a few path helpers.\n */\n\nexport type {\n SourceMap\n TranspiledDoc\n DocFactory\n FileMeta\n TranspileResult\n Transpiler\n Plugin\n Logger\n} from ./types.civet\n\nexport {\n Snap\n fullDiffTextChangeRange\n} from ./snapshot.civet\n\nexport {\n getCanonicalFileName\n getExtensionFromPath\n getTranspiledExtensionsFromPath\n removeExtension\n remapFileName\n} from ./path.civet\n\nexport {\n type Host\n TSHost\n} from ./host.civet\n\nexport {\n type TSServiceOptions\n type ResolvedService\n TSService\n} from ./service.civet\n\nexport {\n createInMemoryDocFactory\n} from ./doc.civet\n\nexport {\n type CivetPluginOptions\n makeCivetPlugin\n} from ./plugins/civet.civet\n\nexport {\n type HeraPluginOptions\n makeHeraPlugin\n} from ./plugins/hera.civet\n\nexport {\n type Cache\n createMemoryCache\n createDiskCache\n} from ../cache.civet\n\nexport {\n type IncrementalTypecheckOptions\n type IncrementalTypecheckResult\n makeIncrementalTypecheckProgram\n} from ./typecheck.civet\n", "/**\n * IScriptSnapshot helpers used by the host's getScriptSnapshot path.\n * `Snap` falls back to a full text-diff change range so TypeScript can\n * incrementally re-parse on edits without us plumbing AST-aware ranges.\n */\n\nts from typescript\n\n/**\n * Diff `oldText` and `newText` as plain strings and return a single TS\n * change range covering the difference. Returns `undefined` when the\n * texts are identical. Algorithm credit:\n * https://github.com/vuejs/language-tools/blob/5607f45/packages/language-core/src/virtualFile/computedFiles.ts#L218\n */\nexport function fullDiffTextChangeRange(oldText: string, newText: string): ts.TextChangeRange?\n oldTextLength := oldText.length\n newTextLength := newText.length\n minLength := Math.min(oldTextLength, newTextLength)\n\n for let start = 0; start < minLength; start++\n if oldText[start] !== newText[start]\n end .= oldTextLength\n stop .= minLength - start\n for let i = 0; i < stop; i++\n if oldText[oldTextLength - i - 1] !== newText[newTextLength - i - 1]\n break\n end--\n\n length := end - start\n newLength := length + (newTextLength - oldTextLength)\n\n return {\n span: { start, length }\n newLength\n }\n\n return undefined\n\n/**\n * Build an IScriptSnapshot for `newText`. `getChangeRange(oldSnapshot)`\n * lazily computes (and caches per old snapshot) the diff against the\n * previous text via `fullDiffTextChangeRange`.\n */\nexport function Snap(newText: string): ts.IScriptSnapshot\n changeRanges := new Map<ts.IScriptSnapshot, ts.TextChangeRange?>()\n\n snapshot: ts.IScriptSnapshot := {\n getText: (start, end) => newText.slice(start, end)\n getLength: () => newText.length\n getChangeRange(oldSnapshot)\n unless changeRanges.has(oldSnapshot)\n changeRanges.set(oldSnapshot, undefined)\n oldText := oldSnapshot.getText(0, oldSnapshot.getLength())\n changeRange := fullDiffTextChangeRange(oldText, newText)\n if changeRange\n changeRanges.set(oldSnapshot, changeRange)\n\n changeRanges.get(oldSnapshot)\n }\n\n return snapshot\n", "/**\n * Path normalization and extension helpers used by the host's\n * scriptFileNames bookkeeping and the LSP server's diagnostic remap.\n */\n\nts from typescript\npath from node:path\n\n{ type Transpiler } from ./types.civet\n\n/**\n * Normalize to OS-native separators and lowercase on case-insensitive\n * file systems. Use everywhere path keys compare across user input,\n * TypeScript callbacks, and the host's caches.\n */\nexport function getCanonicalFileName(fileName: string): string\n fileName = path.normalize fileName\n // ts.sys is unset in browser workers; browser paths are POSIX/case-sensitive.\n /* c8 ignore next -- Node coverage always has ts.sys; browser workers do not. */\n fileName = fileName.toLowerCase() unless ts.sys?.useCaseSensitiveFileNames ?? true\n fileName\n\nlastExtension := /(?:\\.(?:[^./]+))?$/\nlastTwoExtensions := /(\\.[^./]*)(\\.[^./]*)$/\n\n/**\n * Returns the extension of the file including the dot.\n * @example\n * getExtensionFromPath('foo/bar/baz.js') // => '.js'\n * @example\n * getExtensionFromPath('foo/bar/baz') // => ''\n * @example\n * getExtensionFromPath('foo/bar/baz.') // => ''\n */\nexport function getExtensionFromPath(p: string): string\n match := p.match(lastExtension)\n return \"\" unless match\n match[0]\n\n/**\n * Returns the last two extensions of a path.\n * @example\n * getTranspiledExtensionsFromPath('foo/bar/baz.js') // => undefined\n * @example\n * getTranspiledExtensionsFromPath('foo/bar/baz') // => undefined\n * @example\n * getTranspiledExtensionsFromPath('foo/bar/baz.civet.ts') // => ['.civet', '.ts']\n */\nexport function getTranspiledExtensionsFromPath(p: string): [string, string]?\n match := p.match(lastTwoExtensions)\n return unless match\n [match[1], match[2]]\n\n/**\n * Removes the last extension from a path.\n * @example\n * removeExtension('foo/bar/baz.js') // => 'foo/bar/baz'\n * @example\n * removeExtension('foo/bar/baz.civet.ts') // => 'foo/bar/baz.civet'\n */\nexport function removeExtension(p: string): string\n p.replace /\\.[^\\/.]+$/, \"\"\n\n/**\n * Convert a transpiled file name (e.g. `foo.civet.tsx`) back to its source\n * file name (`foo.civet`) when a registered transpiler claims that extension.\n * Used by the language service to surface diagnostics under the original path.\n */\nexport function remapFileName(fileName: string, transpilers: Map<string, Transpiler>): string\n [extension, target] := getTranspiledExtensionsFromPath(fileName) ?? []\n return fileName unless extension\n transpiler := transpilers.get(extension)\n return fileName unless transpiler\n return removeExtension(fileName) if transpiler.target === target\n fileName\n", "/**\n * Core types for `@danielx/civet/ts-service`: the abstract surface the\n * LSP server, CLI typecheck, and unplugin build against.\n */\n\nts from typescript\n{ type SourceMapping } from ../ts-diagnostic.civet\n\ntype CivetSourceMap = { data: { lines: SourceMapping[][] } }\nexport type { SourceMapping }\nexport interface ParseError extends Error\n line?: number | string\n column?: number | string\n header?: string\n\n/**\n * Civet's source map exposes lines either directly (current) or nested\n * under `data` (Civet <0.9.4). Diagnostic remappers accept either.\n */\nexport interface SourceMap\n lines?: CivetSourceMap[\"data\"][\"lines\"]\n data?: CivetSourceMap[\"data\"]\n\n/**\n * Minimal text-document shape used through the host. Structurally\n * compatible with `vscode-languageserver-textdocument`'s TextDocument\n * so LSP can pass real instances unchanged.\n */\nexport interface TranspiledDoc\n readonly uri: string\n /** Mutated in place by `DocFactory.update`; not readonly. */\n version: number\n getText(): string\n\n/**\n * Editor- and runtime-specific document construction abstracted away\n * from the shared host. LSP wires a TextDocument-backed factory;\n * CLI / unplugin use `createInMemoryDocFactory`.\n */\nexport interface DocFactory<D extends TranspiledDoc>\n create(uri: string, languageId: string, version: number, text: string): D\n /** Replace text + bump version in place; subsequent reads see the update. */\n update(doc: D, text: string, version: number): void\n uriToPath(uri: string): string\n pathToUri(path: string): string\n\n/**\n * Per-file metadata maintained alongside the synthetic transpiled\n * sibling (`.civet.tsx`, `.hera.tsx`, ...) TypeScript actually compiles.\n * The original `.civet` / `.hera` source lives in the host's pathMap.\n */\nexport interface FileMeta\n sourcemapLines: SourceMap[\"lines\"]?\n transpiledDoc: TranspiledDoc?\n commentRanges: { pos: number, length: number }[]?\n parseErrors: (Error | ParseError)[]?\n /** True when compilation errors prevented producing a transpiled doc. */\n fatal: boolean\n\nexport interface TranspileResult\n code: string\n sourceMap?: SourceMap\n commentRanges?: { pos: number, length: number }[]\n errors?: (Error | ParseError)[]\n\n/**\n * Turns one source format into TypeScript. The Promise return shape\n * leaves room for async transpilers; today's host treats Promise\n * results as \"not yet ready\" and returns the previous text.\n */\nexport interface Transpiler\n /** Source extension, e.g. `.civet`, `.hera`. */\n extension: string\n /** Synthetic target extension, e.g. `.tsx`, `.jsx`. */\n target: ts.Extension\n compile(path: string, source: string): TranspileResult? | Promise<TranspileResult?>\n\n/**\n * A bundle of transpilers (and, eventually, language-server hooks like\n * definition / hover) registered with a TSService.\n */\nexport interface Plugin\n transpilers?: Transpiler[]\n\nexport interface Logger\n log(msg: string): void\n info(msg: string): void\n error(msg: string): void\n", "/**\n * Shared TypeScript LanguageServiceHost factory. Maintains a virtual\n * filesystem where each registered transpiler's source files (.civet,\n * .hera, …) appear as siblings of their transpiled targets (.civet.tsx,\n * .hera.tsx, …); resolveModuleNames + readFile / fileExists overrides\n * route TS's resolver through them. vscode-languageserver-textdocument\n * + vscode-uri are abstracted via DocFactory so non-LSP consumers can\n * use simpler in-memory docs.\n */\n\npath from node:path\n\nts from typescript\n{ isExternalModuleNameRelative } := ts\n{ type CompilerHost, type CompilerOptions, type IScriptSnapshot, type LanguageServiceHost } from typescript\n\n{\n type DocFactory\n type FileMeta\n type Logger\n type Transpiler\n type TranspiledDoc\n} from ./types.civet\n{ Snap } from ./snapshot.civet\n{\n getCanonicalFileName\n getExtensionFromPath\n getTranspiledExtensionsFromPath\n removeExtension\n} from ./path.civet\n{ mogrifyPackageJsonImports } from ./config.civet\nassert from node:assert\n\n// ts doesn't have this key in the type\ninterface ResolvedModuleWithFailedLookupLocations extends ts.ResolvedModuleWithFailedLookupLocations\n failedLookupLocations: string[]\n\nexport interface Host extends LanguageServiceHost\n /** Per-file metadata (sourcemap, parse errors, …) for a transpiled source. */\n getMeta(p: string): FileMeta?\n /**\n * Add or replace an editor-tracked source document. Transpilable\n * extensions (.civet, .hera, …) get a synthetic `<src>.<target>`\n * sibling registered as the program root; plain .ts/.js are added\n * to scriptFileNames directly.\n */\n addOrUpdateDocument(doc: TranspiledDoc): void\n /**\n * Register a path as a program root without a TranspiledDoc — TS reads\n * it from disk on demand. For consumers that want project-wide scope\n * over a tsconfig-discovered file list.\n */\n addScriptFileName(p: string): void\n /**\n * Drop editor-tied caches for a document on LSP didClose. Project\n * membership is preserved; the next access re-reads from disk.\n */\n closeDocument(p: string): void\n /**\n * Fully drop a document (and its transpiled sibling) from the project,\n * including the scriptFileNames entry. Used when the file is deleted.\n */\n removeDocument(p: string): void\n\nexport function TSHost(\n compilationSettings: CompilerOptions\n initialFileNames: string[]\n baseHost: CompilerHost\n transpilers: Map<string, Transpiler>\n docFactory: DocFactory<TranspiledDoc>\n _logger: Logger = console\n libDir?: string\n): Host\n { rootDir } := compilationSettings\n assert(rootDir, \"TSHost requires a rootDir in compilationSettings\")\n\n // Explicit `files: [...]` entries from tsconfig don't flow through\n // service.civet's configSys mogrify (only `include` does), so rewrite\n // any raw transpilable extensions to their synthetic targets here —\n // otherwise `getOrCreatePathSnapshot` would parse raw `.civet` as TS.\n // Canonical path key -> case-preserved script file name returned to TS.\n // Internal lookups need canonical keys on case-insensitive systems, but TS\n // must see the original casing to avoid duplicate-file casing diagnostics.\n scriptFileNames: Map<string, string> := new Map\n for fileName of initialFileNames\n scriptFileName := getTranspiledPath fileName\n scriptFileNames.set getCanonicalFileName(scriptFileName), scriptFileName\n fileMetaData: Map<string, FileMeta> := new Map\n\n pathMap: Map<string, TranspiledDoc> := new Map\n snapshotMap: Map<string, IScriptSnapshot> := new Map\n\n projectVersion .= 0\n\n resolutionCache: ts.ModuleResolutionCache := ts.createModuleResolutionCache(rootDir, (fileName) => fileName, compilationSettings)\n\n baseReadFile := baseHost@readFile\n baseFileExists := baseHost@fileExists\n /* c8 ignore next -- modern TS hosts provide directoryExists; fallback supports older/custom hosts. */\n baseDirectoryExists := baseHost.directoryExists?.bind(baseHost) ?? => false\n\n let self: Host\n\n return self = Object.assign({}, baseHost, {\n /** Mogrifies transpilable extensions inside `package.json#imports` on read. */\n readFile(filename: string)\n contents := getPathSource filename\n if contents and path.basename(filename) is \"package.json\"\n return mogrifyPackageJsonImports contents, transpilers\n contents\n\n /** Treats synthetic `<src>.<target>` siblings as existing whenever the source does. */\n fileExists(filename: string)\n pathExists(filename) or syntheticTargetExists(filename)\n\n /**\n * LSP bundles its own lib copies under `<dist>/lib` (libDir set);\n * other consumers fall through to TS's resolved-module lookup.\n */\n getDefaultLibFileName(options: ts.CompilerOptions)\n if libDir\n return path.join(libDir, ts.getDefaultLibFileName(options))\n baseHost.getDefaultLibFileName(options)\n getDefaultLibLocation()\n if libDir\n return libDir\n baseHost.getDefaultLibLocation?() ?? path.dirname(baseHost.getDefaultLibFileName(compilationSettings))\n\n getModuleResolutionCache()\n resolutionCache\n\n /**\n * Defer to TS's standard resolver first; fall back to our own walk\n * (paths / baseUrl / relative) for transpilable extensions TS doesn't\n * know about. Requires `allowNonTsExtensions`; matches resolve to a\n * synthetic `<src>.<target>` so subsequent `getScriptSnapshot` calls\n * hit the transpiler.\n */\n resolveModuleNames(moduleNames: string[], containingFile: string, _reusedNames: string[] | undefined, _redirectedReference: ts.ResolvedProjectReference | undefined, compilerOptions: CompilerOptions, _containingSourceFile?: ts.SourceFile)\n moduleNames.map (name) =>\n // Try to resolve the module using the standard TypeScript logic\n { resolvedModule } := ts.resolveModuleName(name, containingFile, compilerOptions, self, resolutionCache) as ResolvedModuleWithFailedLookupLocations\n return resolvedModule if resolvedModule\n\n // get the transpiler for the extension\n extension := getExtensionFromPath(name)\n transpiler .= transpilers.get(extension)\n if transpiler or !extension\n exists := transpiler ? pathExists : baseDirectoryExists\n resolvedModule := (resolved: string) =>\n // Assumes exists(resolved) is true\n // Directories don't yet have a transpiler chosen; try to find one\n // via implicit index file.\n // TODO: Only when state.features & NodeResolutionFeatures.EsmMode\n // TODO: Read package.json as in loadNodeModuleFromDirectoryWorker\n unless transpiler\n for [_, t] of transpilers\n index := path.join(resolved, \"index\" + t.extension)\n if pathExists(index)\n transpiler = t\n resolved = index\n break\n\n return unless transpiler\n // Now pathExists(resolved) should be true\n { target } := transpiler\n return {\n resolvedFileName: resolved + target\n extension: target\n isExternalLibraryImport: false\n }\n\n // Mimic tryResolve from\n // https://github.com/microsoft/TypeScript/blob/cf33fd0cde22905effce371bb02484a9f2009023/src/compiler/moduleNameResolver.ts\n // tryLoadModuleUsingOptionalResolutionSettings.\n // `baseUrl` is @deprecated in TS 5.0+ but TS still reads it first as\n // the paths base, so we mirror that behavior for legacy tsconfigs.\n { paths, pathsBasePath } := compilationSettings\n baseUrl := (compilationSettings as { baseUrl?: string }).baseUrl\n unless isExternalModuleNameRelative(name) // absolute\n // tryLoadModuleUsingPathsIfEligible\n if paths\n // tryLoadModuleUsingPaths. parseJsonConfigFileContent always\n // assigns options.pathsBasePath the tsconfig's directory when\n // `paths` is set, so baseUrl ?? pathsBasePath suffices. See\n // https://github.com/microsoft/TypeScript/blob/bbef6a7a31cff1d0d9f94b082996334baca74caa/src/compiler/utilities.ts#L6317-L6320\n pathsBase := baseUrl ?? pathsBasePath as string\n // TODO: more closely follow tryParsePatterns from\n // https://github.com/microsoft/TypeScript/blob/bbef6a7a31cff1d0d9f94b082996334baca74caa/src/compiler/utilities.ts#L9743-L9745\n best .= ''\n bestPrefix .= ''\n for [pattern, replacements] of Object.entries(paths)\n if pattern.endsWith(\"*\")\n prefix := pattern.slice(0, -1)\n if name.startsWith(prefix)\n for replacement of replacements\n resolved := path.resolve\n pathsBase\n replacement.replace('*', name.slice(prefix.length))\n\n if exists(resolved) and prefix.length > bestPrefix.length\n best = resolved\n bestPrefix = prefix\n\n else if name is pattern\n for replacement of replacements\n resolved := path.resolve(pathsBase, replacement)\n if exists(resolved) and pattern.length > bestPrefix.length\n best = resolved\n bestPrefix = pattern\n\n return resolvedModule(best) if best\n\n // tryLoadModuleUsingBaseUrl\n if baseUrl\n /* c8 ignore next 2 -- only fires for tsconfigs with `baseUrl`; test fixtures don't set it */\n resolved := path.resolve(baseUrl, name)\n return resolvedModule(resolved) if exists(resolved)\n\n else // relative\n // TODO: tryLoadModuleUsingRootDirs\n\n // This backup resolver is really just for relative paths.\n // TODO: Implement absolute case from tryResolve\n // https://github.com/microsoft/TypeScript/blob/cf33fd0cde22905effce371bb02484a9f2009023/src/compiler/moduleNameResolver.ts#L3221\n resolved := path.resolve path.dirname(containingFile), name\n return resolvedModule(resolved) if exists(resolved)\n // TODO: add to resolution cache?\n\n return undefined\n\n resolveModuleNameLiterals(literals: readonly any[], containingFile: string, _redirectedReference: ts.ResolvedProjectReference | undefined, compilerOptions: CompilerOptions)\n literals.map (literal) =>\n name: string := literal.text\n for [ext, t] of transpilers\n if name.endsWith ext\n resolved := path.resolve path.dirname(containingFile), name\n if pathExists(resolved)\n return\n resolvedModule:\n resolvedFileName: resolved + t.target\n extension: t.target\n isExternalLibraryImport: false\n unless getExtensionFromPath(name)\n resolved := path.resolve path.dirname(containingFile), name\n if baseDirectoryExists(resolved)\n for [_, t] of transpilers\n index := path.join(resolved, \"index\" + t.extension)\n if pathExists(index)\n return\n resolvedModule:\n resolvedFileName: index + t.target\n extension: t.target\n isExternalLibraryImport: false\n resolvedModule: ts.resolveModuleName(name, containingFile, compilerOptions, self, resolutionCache).resolvedModule\n\n addOrUpdateDocument(doc: TranspiledDoc): void\n rawPath := path.normalize docFactory.uriToPath(doc.uri)\n p := getCanonicalFileName rawPath\n snapshotMap.delete(p)\n projectVersion++\n\n extension := getExtensionFromPath(p)\n transpiler := transpilers.get(extension)\n\n if transpiler\n { target } := transpiler\n transpiledPath := p + target\n displayTranspiledPath := rawPath + target\n\n transpiledDoc .= pathMap.get(transpiledPath)\n initTranspiledDoc(displayTranspiledPath) unless transpiledDoc\n snapshotMap.delete(transpiledPath)\n\n // Source doc lives in pathMap (not scriptFileNames) so the\n // transpiled sibling can pick up updates via getOrCreatePathSnapshot.\n pathMap.set(p, doc)\n return\n\n scriptFileNames.set p, rawPath\n pathMap.set(p, doc)\n\n addScriptFileName(p: string): void\n target := getTranspiledPath p\n canonical := getCanonicalFileName target\n return if scriptFileNames.has canonical\n\n scriptFileNames.set canonical, target\n projectVersion++\n\n closeDocument(rawPath: string): void\n canonical := getCanonicalFileName rawPath\n transpiledPath := getCanonicalTranspiledPath(rawPath)\n\n pathMap.delete(canonical)\n snapshotMap.delete(canonical)\n fileMetaData.delete(canonical)\n\n if transpiledPath !== canonical\n pathMap.delete(transpiledPath)\n snapshotMap.delete(transpiledPath)\n\n projectVersion++\n\n removeDocument(rawPath: string): void\n canonical := getCanonicalFileName rawPath\n transpiledPath := getCanonicalTranspiledPath(rawPath)\n\n pathMap.delete(canonical)\n snapshotMap.delete(canonical)\n fileMetaData.delete(canonical)\n scriptFileNames.delete(canonical)\n\n if transpiledPath !== canonical\n pathMap.delete(transpiledPath)\n snapshotMap.delete(transpiledPath)\n scriptFileNames.delete(transpiledPath)\n\n projectVersion++\n\n getMeta(p: string)\n p = getCanonicalFileName p\n // Force snapshot creation so meta is populated before lookup.\n getOrCreatePathSnapshot(getCanonicalTranspiledPath(p))\n fileMetaData.get(p)\n\n getProjectVersion()\n projectVersion.toString()\n\n getCompilationSettings()\n compilationSettings\n\n // TS passes forward-slash paths on every OS; both methods\n // normalize through getCanonicalFileName before lookup.\n getScriptSnapshot(p: string)\n getOrCreatePathSnapshot(getCanonicalFileName p)\n getScriptVersion(p: string)\n pathMap.get(getCanonicalFileName p)?.version.toString() || \"0\"\n\n getScriptFileNames()\n Array.from(scriptFileNames.values())\n\n // CompilerHost requires writeFile, but our consumers always pass an\n // explicit writeFile to program.emit() / builder.emit(), so this is\n // unreachable — keep as a no-op to satisfy the interface.\n writeFile(_fileName: string, _content: string): void\n return\n })\n\n /**\n * Whether `<src>.<target>` \"exists\" — true whenever the underlying\n * `<src>` source is on disk. Backs the `fileExists` override so TS's\n * resolver accepts the synthetic siblings produced by\n * `mogrifyPackageJsonImports`.\n */\n function syntheticTargetExists(filename: string): boolean\n for [ext, t] of transpilers\n if filename.endsWith(t.target)\n source := filename.slice(0, -t.target.length)\n if source.endsWith(ext) and pathExists(source)\n return true\n false\n\n /** Open editor docs count as existing even before they exist on disk. */\n function pathExists(p: string): boolean\n pathMap.has(getCanonicalFileName p) or baseFileExists(p)\n\n /** Open editor docs win over disk. */\n function getPathSource(p: string): string?\n p = getCanonicalFileName p\n doc := pathMap.get(p)\n return doc.getText() if doc\n return baseReadFile p if baseFileExists p\n return undefined // no such file\n\n /** Returns the synthetic-target path while preserving the caller's path casing. */\n function getTranspiledPath(p: string)\n p = path.normalize p\n extension := getExtensionFromPath(p)\n transpiler := transpilers.get(extension)\n return p + transpiler.target if transpiler\n p\n\n /** Returns the synthetic-target path canonicalized for internal map keys. */\n function getCanonicalTranspiledPath(p: string)\n getCanonicalFileName getTranspiledPath(p)\n\n /**\n * Memoized snapshot factory. For transpilable targets, re-runs the\n * transpiler when the source doc has advanced past the cached version\n * and falls back to the previous transpiled text on compile errors.\n */\n function getOrCreatePathSnapshot(p: string)\n rawPath := path.normalize p\n p = getCanonicalFileName rawPath\n snapshot .= snapshotMap.get(p)\n return snapshot if snapshot\n\n let transpiler\n\n // p arrives with the transpiler's target extension already applied\n // (e.g. `foo.civet.tsx`); the second-to-last extension picks the\n // transpiler.\n exts := getTranspiledExtensionsFromPath(p)\n if exts and (transpiler = transpilers.get(exts[0]))\n sourcePath := removeExtension(p)\n sourceDoc := pathMap.get(sourcePath)\n transpiledDoc .= pathMap.get(p)\n transpiledDoc = initTranspiledDoc(rawPath) unless transpiledDoc\n\n let source\n sourceDocVersion .= 0\n unless sourceDoc\n source = getPathSource(sourcePath)\n else\n source = sourceDoc.getText()\n sourceDocVersion = sourceDoc.version\n\n if source and sourceDocVersion > transpiledDoc.version\n transpiledCode := doTranspileAndUpdateMeta(transpiledDoc, sourceDocVersion, transpiler, sourcePath, source)\n snapshot = Snap(transpiledCode) if transpiledCode?\n\n // Fall back to the previous transpiled text if the new compile errored.\n snapshot = Snap(transpiledDoc.getText()) unless snapshot\n\n snapshotMap.set(p, snapshot)\n return snapshot\n\n snapshot = Snap(getPathSource(p) ?? \"\")\n snapshotMap.set(p, snapshot)\n return snapshot\n\n /** Upsert FileMeta for `p` (merges into the existing entry if present). */\n function createOrUpdateMeta(p: string, update: FileMeta & { transpiledDoc: TranspiledDoc })\n p = getCanonicalFileName p\n meta .= fileMetaData.get(p)\n unless meta\n fileMetaData.set(p, update)\n else\n Object.assign(meta, update)\n\n /**\n * Run the transpiler, update FileMeta, write the new text into the\n * transpiledDoc. Returns the transpiled code or `undefined` on any\n * failure (parse error, async result, falsy compile output) — errors\n * thrown here would crash TS's snapshot/version path so we trap and\n * surface them through `FileMeta.parseErrors` instead.\n */\n function doTranspileAndUpdateMeta(transpiledDoc: TranspiledDoc, version: number, transpiler: Transpiler, sourcePath: string, sourceCode: string): string?\n let result\n try\n result = transpiler.compile(sourcePath, sourceCode)\n catch e\n createOrUpdateMeta sourcePath, {\n transpiledDoc\n sourcemapLines: undefined\n commentRanges: undefined\n parseErrors: [e as Error]\n fatal: true\n }\n return\n\n // Async transpilers aren't supported on this code path yet — the\n // LanguageService snapshot interface is sync. Treat any Promise as\n // not-yet-ready and return the previous text.\n /* c8 ignore next 2 -- forward-compat guard: makeCivetPlugin / makeHeraPlugin are sync; only future async transpilers would hit this */\n if result <? Promise\n return\n\n return unless result\n\n { code: transpiledCode, sourceMap, commentRanges, errors } := result\n sourcemapLines .= sourceMap?.lines\n /* c8 ignore start -- Civet <0.9.4 sourcemap shape (lines nested under .data) */\n sourcemapLines ??= sourceMap?.data?.lines\n /* c8 ignore stop */\n createOrUpdateMeta sourcePath, {\n transpiledDoc\n sourcemapLines\n commentRanges\n parseErrors: errors\n fatal: false\n }\n docFactory.update transpiledDoc, transpiledCode, version\n transpiledCode\n\n /** Empty placeholder; `getOrCreatePathSnapshot` fills it on first request. */\n function initTranspiledDoc(p: string)\n scriptPath := path.normalize p\n p = getCanonicalFileName scriptPath\n uri := docFactory.pathToUri(scriptPath)\n transpiledDoc := docFactory.create(uri, \"none\", -1, \"\")\n pathMap.set(p, transpiledDoc)\n scriptFileNames.set(p, scriptPath)\n transpiledDoc\n", "/**\n * Shared tsconfig parsing for the LanguageService (TSService) and the\n * incremental typecheck pipelines. Both need to widen TS's include\n * walk to discover `.civet` / `.hera` files and rewrite matches to their\n * synthetic `.tsx` siblings, parse the tsconfig, and apply the same\n * Civet-aware compiler defaults — kept in one place here.\n */\n\nts from typescript\npath from node:path\n\n{ type Plugin, type Transpiler } from ./types.civet\n{ getExtensionFromPath } from ./path.civet\n\n/** Build a Map of source-extension → Transpiler from a plugin list. */\nexport function buildTranspilers(plugins: readonly Plugin[]): Map<string, Transpiler>\n m: Map<string, Transpiler> := new Map\n for plugin of plugins\n plugin.transpilers?.forEach (t) =>\n m.set t.extension, t\n m\n\n/**\n * Rewrite transpilable extensions inside a `package.json#imports` map\n * to their synthetic `.tsx` siblings. TS resolves `imports` inside\n * `ts.resolveModuleName` before any host-level module redirect runs,\n * so consumers wire this in at `readFile` instead.\n */\nexport function mogrifyPackageJsonImports(\n contents: string\n transpilers: Map<string, Transpiler>\n): string\n /* c8 ignore start -- defensive: package.json is JSON by spec; if a project\n ships a malformed one we'd rather pass it through than crash module\n resolution */\n let parsed: Record<string, unknown>\n try\n parsed = JSON.parse contents\n catch\n return contents\n /* c8 ignore stop */\n return contents unless parsed.imports? <? \"object\"\n let modified = false\n function recurse(node: unknown): void\n return unless node? <? \"object\"\n obj := node as Record<string, unknown>\n for key in obj\n value := obj[key]\n if value <? \"string\"\n ext := getExtensionFromPath value\n if t? := transpilers.get(ext)\n obj[key] = value + t.target\n modified = true\n else if value\n recurse value\n recurse parsed.imports\n if modified then JSON.stringify parsed else contents\n\nexport interface ParseTsConfigOptions\n /** Pre-loaded tsconfig JSON (skips reading `<projectPath>/tsconfig.json`). */\n tsConfig?: any\n /**\n * When true (default), `readDirectory` is widened so the include\n * filter discovers each transpiler's source extension and reports it\n * as the synthetic `<src>.<target>` sibling. Set false for consumers\n * that drive the file set themselves (bundler `load()` hooks).\n */\n widenIncludeFilter?: boolean\n /**\n * Override the TypeScript's file system, for browser\n */\n system?: ts.System\n\n/**\n * Parse `<projectPath>/tsconfig.json` (or the inline `tsConfig`),\n * applying Civet-aware defaults (`allowNonTsExtensions`, JSX preserve).\n * The returned `parsed.fileNames` reflects the widened include walk\n * when `widenIncludeFilter` is on.\n */\nexport function parseTsConfigForCivet(\n projectPath: string\n transpilers: Map<string, Transpiler>\n options: ParseTsConfigOptions = {}\n): ts.ParsedCommandLine\n widen := options.widenIncludeFilter ?? true\n system := options.system ?? ts.sys\n extraExtensions := Array.from transpilers.keys()\n\n configSys := if widen and extraExtensions.length > 0 then {\n ...system\n readDirectory: (\n p: string\n extensions?: readonly string[]\n excludes?: readonly string[]\n includes?: readonly string[]\n depth?: number\n ): string[] ->\n /* c8 ignore next -- TS always supplies extensions */\n exts := extensions ? [...extensions, ...extraExtensions] : undefined\n system.readDirectory(p, exts, excludes, includes, depth).map (f) =>\n for ext of extraExtensions\n if f.endsWith(ext)\n t := transpilers.get(ext)\n return f + t.target if t\n f\n } else system\n\n tsConfigPath := path.join projectPath, \"tsconfig.json\"\n config := options.tsConfig ?? ts.readConfigFile(tsConfigPath, system.readFile).config\n parsed := ts.parseJsonConfigFileContent(\n config\n configSys\n projectPath\n {}\n tsConfigPath\n undefined\n )\n parsed.options.allowNonTsExtensions ??= true\n parsed.options.jsx ??= ts.JsxEmit.Preserve\n parsed.options.rootDir ??= projectPath\n parsed\n", "/**\n * Shared TSService factory: builds a TypeScript LanguageService over a\n * Civet-aware host so any consumer (LSP, CLI typecheck, unplugin) can\n * drive Civet/Hera type checking, navigation, and diagnostics from one\n * place. Project-path-based — the LSP wrapper resolves URIs to fsPaths\n * and handles project-Civet detection before calling in.\n */\n\npath from node:path\n\nts from typescript\n{ type LanguageService } from typescript\n{\n createCompilerHost\n createLanguageService\n} := ts\n\n{\n type DocFactory\n type Logger\n type Plugin\n type TranspiledDoc\n} from ./types.civet\n{ type Host, TSHost } from ./host.civet\n{ getCanonicalFileName, remapFileName } from ./path.civet\n{ buildTranspilers, parseTsConfigForCivet } from ./config.civet\n\nexport interface TSServiceOptions\n /** Initial plugins; later additions go through registerPlugin / loadPlugins. */\n plugins?: Plugin[]\n /** Document constructor + URI parsing. Required (no sensible default). */\n docFactory: DocFactory<TranspiledDoc>\n /** Defaults to console. */\n logger?: Logger\n /**\n * Directory containing TypeScript lib.*.d.ts files. Set by the LSP server\n * which bundles its own lib copies; left undefined elsewhere so the host\n * falls back to ts.getDefaultLibFilePath.\n */\n libDir?: string\n /**\n * When `true` (default), the service walks the tsconfig include patterns\n * for every registered transpiler extension (.civet, .hera, …) and\n * pre-populates scriptFileNames with the discovered files. Right for\n * batch typecheck (`pnpm typecheck`) and for an LSP that wants\n * cross-file types to resolve before any document is opened.\n *\n * Set `false` for consumers that drive the file set themselves through\n * `addOrUpdateDocument` — e.g. unplugin's bundler-driven `load()` hook,\n * which only wants TS to typecheck files it has actually seen, not the\n * whole project.\n */\n discoverProjectFiles?: boolean\n /**\n * Compiler options merged on top of the parsed tsconfig. Used for\n * toggling features without rewriting tsconfig.json — e.g. the CLI\n * typecheck flag sets `incremental` + `tsBuildInfoFile`.\n */\n extraCompilerOptions?: ts.CompilerOptions\n /**\n * Pre-loaded tsconfig JSON (as readConfigFile returns it). When\n * provided, bypasses `<projectPath>/tsconfig.json` on disk — lets\n * consumers pass an inline tsConfig without writing it down first.\n */\n tsConfig?: any\n /** Filesystem implementation; defaults to `ts.sys` in Node. */\n system?: ts.System\n\nexport interface ResolvedService extends LanguageService\n host: Host\n /** Map a TypeScript file name (e.g. `foo.civet.tsx`) to its source path (`foo.civet`). */\n getSourceFileName(fileName: string): string\n /** Register a plugin's transpilers at runtime. Existing snapshots are not invalidated. */\n registerPlugin(plugin: Plugin): void\n /**\n * Discover `<projectPath>/.civet/*-plugin.mjs` files and dynamic-import each\n * as a Plugin. Returns once all plugins have either loaded or failed\n * (failures are logged, not thrown).\n */\n loadPlugins(): Promise<void>\n\nexport function TSService(projectPath: string, options: TSServiceOptions): ResolvedService\n { plugins = [], docFactory, libDir, discoverProjectFiles = true, extraCompilerOptions } := options\n system := options.system ?? ts.sys\n /* c8 ignore next -- console default fires for ad-hoc consumers; tests always supply a logger */\n logger: Logger := options.logger ?? console\n\n // Populate transpilers before parseTsConfigForCivet runs — its\n // configSys wrapper closes over the map to widen the include walk.\n // registerPlugin mutates the same map for runtime plugin loads\n // (loadPlugins below). Existing snapshots aren't invalidated: a\n // plugin registered after a file has been transpiled won't apply\n // until that file is re-snapshotted.\n transpilers := buildTranspilers plugins\n function registerPlugin(plugin: Plugin): void\n plugin.transpilers?.forEach (t) =>\n transpilers.set t.extension, t\n\n parsedConfig := parseTsConfigForCivet projectPath, transpilers, {\n tsConfig: options.tsConfig\n widenIncludeFilter: discoverProjectFiles\n system\n }\n\n hostOptions := if extraCompilerOptions\n { ...parsedConfig.options, ...extraCompilerOptions }\n else\n parsedConfig.options\n\n baseHost := createBaseHost(hostOptions, system)\n\n host := TSHost(hostOptions, parsedConfig.fileNames, baseHost, transpilers, docFactory, logger, libDir)\n service := createLanguageService(host)\n\n loadPlugins := async function (): Promise<void>\n civetFolder := path.join(projectPath, \"./.civet/\")\n // Current TS returns [] for missing dirs, but the catch arm is\n // forward-compat insurance: a future TS or alternative System impl\n // throwing ENOENT shouldn't take the service down.\n let civetFiles: string[]\n try\n civetFiles = system.readDirectory(civetFolder)\n /* c8 ignore start -- ts.sys.readDirectory returns [] for missing dirs in\n tested versions; this catch is forward-compat insurance */\n catch e\n logger.info `No .civet plugin folder at ${civetFolder} (${(e as Error).message})`\n return\n /* c8 ignore stop */\n pluginFiles := civetFiles.filter((file) => file.endsWith(\"plugin.mjs\"))\n\n for filePath of pluginFiles\n // pathToUri produces a `file:///` URI dynamic import accepts on\n // every OS (Windows needs `file:///C:/…`).\n pluginUri := docFactory.pathToUri(filePath)\n logger.info(\"Loading plugin \" + pluginUri)\n try\n { default: plugin }: { default: Plugin } := await import(/* @vite-ignore */ pluginUri)\n logger.info(\"Loaded plugin \" + plugin)\n registerPlugin plugin\n catch e\n logger.error(\"Error loading plugin \" + pluginUri + \" \" + e)\n return\n\n return Object.assign {}, service, {\n host\n /** `foo.civet.tsx` → `foo.civet`; passthrough for non-transpiled files. */\n getSourceFileName(fileName: string)\n getCanonicalFileName remapFileName(fileName, transpilers)\n registerPlugin\n loadPlugins\n }\n\nexport function createBaseHost(options: ts.CompilerOptions, system: ts.System): ts.CompilerHost\n if system is ts.sys\n return createCompilerHost(options)\n\n getCanonicalFileName := (fileName: string) =>\n if system.useCaseSensitiveFileNames then fileName else fileName.toLowerCase()\n\n {\n getSourceFile(fileName: string, languageVersion: ts.ScriptTarget)\n sourceText := system.readFile(fileName)\n return unless sourceText?\n ts.createSourceFile(fileName, sourceText, languageVersion)\n getDefaultLibFileName(options: ts.CompilerOptions)\n path.join('/typescript/lib', ts.getDefaultLibFileName(options))\n writeFile(fileName: string, content: string)\n system.writeFile?(fileName, content)\n getCurrentDirectory()\n system.getCurrentDirectory()\n getDirectories(path: string)\n system.getDirectories?(path) ?? []\n fileExists(fileName: string)\n system.fileExists(fileName)\n readFile(fileName: string)\n system.readFile(fileName)\n useCaseSensitiveFileNames()\n system.useCaseSensitiveFileNames\n getCanonicalFileName\n getNewLine()\n system.newLine\n directoryExists(path: string)\n system.directoryExists?(path) ?? false\n readDirectory(path: string, extensions?: readonly string[], excludes?: readonly string[], includes?: readonly string[], depth?: number)\n system.readDirectory(path, extensions, excludes, includes, depth)\n realpath(path: string)\n system.realpath ? system.realpath(path) : path\n }\n", "/**\n * Minimal in-memory DocFactory for non-LSP consumers (CLI typecheck,\n * `civet --typecheck`, unplugin's bundler-driven typecheck). The LSP\n * server keeps its own DocFactory that wraps vscode-languageserver-\n * textdocument's `TextDocument` so editor-tracked versions and richer\n * positionAt/offsetAt work without translation.\n */\n\n{ pathToFileURL, fileURLToPath } from \"node:url\"\n\n{ type DocFactory, type TranspiledDoc } from ./types.civet\n\nclass InMemoryDoc\n uri: string\n version: number\n text: string\n\n @(uri: string, version: number, text: string)\n @uri = uri\n @version = version\n @text = text\n\n getText(): string\n @text\n\n setText(t: string): void\n @text = t\n\n/**\n * DocFactory backed by minimal in-memory documents. Suitable for any\n * consumer that doesn't need editor-style incremental positionAt /\n * offsetAt — TSService only reads `uri`, `version`, and `getText()`.\n * URIs use the `file://` scheme via Node's `url.pathToFileURL`.\n */\nexport function createInMemoryDocFactory(): DocFactory<TranspiledDoc>\n {\n create: (uri, _languageId, version, text) =>\n new InMemoryDoc(uri, version, text) as unknown as TranspiledDoc\n update: (doc, text, version) =>\n (doc as unknown as InMemoryDoc).setText text\n doc.version = version\n uriToPath: (uri) => fileURLToPath uri\n pathToUri: (p) => pathToFileURL(p).toString()\n }\n", "/**\n * Civet transpiler plugin. Defaults to the bundled @danielx/civet; the\n * LSP server passes a project-discovered Civet + loaded civetconfig so\n * the type-check pipeline matches the language-layer behavior the editor\n * sees.\n */\n\n{ type CompileOptions, type ParseError, lib as BundledCivetLib } from @danielx/civet\nBundledCivetModule from @danielx/civet\nBundledCivetPackage from @danielx/civet/package.json with type: 'json'\n\n{ type Extension } from typescript\n\n{ type Plugin, type SourceMap, type TranspileResult } from ../types.civet\n{ type Cache, makeCacheKey } from ../../cache.civet\n\ninterface CivetTraversalLib\n gatherRecursiveAll(ast: unknown, predicate: (node: unknown) => boolean): unknown[]\n\ninterface CachedTranspile\n code: string\n lines?: SourceMap[\"lines\"]\n commentRanges?: { pos: number, length: number }[]\n\nexport interface CivetPluginOptions\n /** Override the Civet module. Defaults to the bundled @danielx/civet. */\n Civet?: typeof BundledCivetModule\n /** Override the lib export (provides `gatherRecursiveAll`). Defaults to the bundled lib. */\n CivetLib?: CivetTraversalLib\n /** Override the version string. Used to detect Civet 0.9.4+ SourceMap API. */\n CivetVersion?: string\n /** Civet compile config (typically loaded from civetconfig.json or similar). Defaults to {}. */\n config?: CompileOptions\n /**\n * Optional cache for transpile results. When supplied, successful compiles\n * (errors-empty) are stored and reused for matching inputs. Cache keys are\n * derived from source, sourcePath, civet version, and the user's config.\n */\n cache?: Cache\n\n/**\n * Build a Civet transpiler Plugin. The returned plugin's transpiler is\n * synchronous and forces `parseOptions.comptime: false` because the\n * TypeScript LanguageService snapshot path is sync; comptime macro execution\n * (which is async) belongs in the build/CLI compile pipeline, not this one.\n */\nexport function makeCivetPlugin(options: CivetPluginOptions = {}): Plugin\n Civet := options.Civet ?? BundledCivetModule\n CivetLib := options.CivetLib ?? BundledCivetLib\n CivetVersion := options.CivetVersion ?? BundledCivetPackage.version\n civetConfig := options.config ?? {}\n cache := options.cache\n\n function transpileCivet(p: string, source: string): TranspileResult\n errors: ParseError[] := []\n options: CompileOptions & { sync: true } := {}\n ...civetConfig\n filename: p\n errors\n sync: true\n parseOptions: {}\n ...civetConfig.parseOptions\n comptime: false\n\n // Civet 0.9.4 introduced `new SourceMap` API. Older project Civets fall\n // through to the legacy single-call compile path (uncached — rare).\n [major, minor, patch] := CivetVersion.split(\".\").map(Number)\n if major is 0 and (minor < 9 or minor is 9 and patch < 4)\n result := Civet.compile source, { ...options, sourceMap: true }\n return { ...result, errors }\n\n cacheKey := if cache then makeCacheKey {\n source\n sourcePath: p\n compilerName: 'civet'\n compilerVersion: CivetVersion\n options: civetConfig\n } else undefined\n\n if cacheKey\n hit := cache!.get cacheKey\n if hit\n try\n parsed := JSON.parse(hit) as CachedTranspile\n result: TranspileResult := {\n code: parsed.code\n sourceMap: { lines: parsed.lines } as SourceMap\n errors\n }\n result.commentRanges = parsed.commentRanges if parsed.commentRanges\n return result\n catch\n // corrupt cache entry — fall through and recompile\n\n // Re-use the single parse for both code generation and comment extraction.\n options.ast = true\n ast := Civet.compile source, options\n sourceMap := new Civet.SourceMap source, p\n code := Civet.generate ast, {}\n ...options\n sourceMap\n commentRanges := collectCommentRanges(ast)\n\n if cacheKey and errors.length is 0\n /* c8 ignore next -- `?? .data?.lines` only fires for legacy Civet (<0.9.4) sourcemap shape; bundled Civet always exposes .lines directly */\n lines := (sourceMap as SourceMap).lines ?? (sourceMap as SourceMap).data?.lines\n cache!.set cacheKey, JSON.stringify { code, lines, commentRanges }\n\n {\n code\n sourceMap\n commentRanges\n errors\n }\n\n /** Collect `$loc` ranges of every Comment node in the AST. */\n function collectCommentRanges(ast: unknown)\n comments := CivetLib.gatherRecursiveAll(ast, (node: any) =>\n node?.type is \"Comment\" and node.$loc?.length > 0\n ) as { $loc: { pos: number, length: number } }[]\n comments.map (comment) => comment.$loc\n\n {\n transpilers: [{\n extension: \".civet\"\n target: \".tsx\" as Extension\n compile: transpileCivet\n }]\n }\n\nexport default makeCivetPlugin\n", "/**\n * Internal cache primitives shared between the build-time loaders\n * (build/register.js, build/esm-hook.mjs, build/esbuild.civet) and the\n * type-check pipeline (ts-service plugins, unplugin --typecheck).\n *\n * Only primitives live here — orchestration (which compiler runs, what\n * options) stays with the caller. Not exposed as a public subpath; the\n * build/ shim and ts-service consume the dist/ build directly.\n */\n\n* as crypto from node:crypto\n* as fs from node:fs\n* as path from node:path\n\nexport interface Cache\n get(key: string): string | undefined\n set(key: string, value: string): void\n\n/**\n * Inputs that determine cache identity for a single compile. Identical\n * `source` + `compilerName` + `compilerVersion` + `options` always hash\n * the same; `sourcePath` is included so a moved or renamed file produces\n * a fresh sourcemap rather than reusing the previous filename.\n */\nexport interface CacheKeyInput\n /** Source text fed to the compiler. */\n source: string\n /** Source file path; resolved to an absolute, forward-slash form before hashing. */\n sourcePath: string\n /** Compiler family name, e.g. 'civet' or 'hera'. */\n compilerName: string\n /** Compiler package version. */\n compilerVersion: string\n /** Secondary compiler version, e.g. civet for the hera→civet pipeline. */\n civetVersion?: string\n /** mtime of the resolved compiler source — invalidates dev-mode caches when the local compiler changes. */\n civetMtime?: string\n /** Compile options forwarded to the compiler. Canonicalized (sorted keys, no functions) before hashing. */\n options?: unknown\n\n/** SHA1 hex over an array of strings, NUL-separated to disambiguate. */\nexport function hashParts(parts: string[]): string\n hash := crypto.createHash 'sha1'\n for part of parts\n hash.update(part).update '\\0'\n hash.digest 'hex'\n\n/**\n * Stable JSON serialization: sorts object keys recursively and drops\n * function-valued fields. Used to canonicalize compile options for\n * hashing so logically equivalent option sets produce identical keys.\n */\nexport function stableStringify(value: unknown): string\n JSON.stringify value, (_key, val) =>\n return undefined if typeof val is 'function'\n if val and typeof val is 'object' and not Array.isArray val\n sorted: Record<string, unknown> := {}\n for key of Object.keys(val as object).sort()\n sorted[key] = (val as Record<string, unknown>)[key]\n return sorted\n val\n\n/**\n * Compute a SHA1 cache key from a CacheKeyInput. Two inputs hash the\n * same iff their source, compiler identity, options, and resolved\n * source path all match.\n */\nexport function makeCacheKey(input: CacheKeyInput): string\n resolved := path.resolve(input.sourcePath).replace(/\\\\/g, '/')\n hashParts [\n input.source\n input.compilerName\n input.compilerVersion\n input.civetVersion ?? ''\n input.civetMtime ?? ''\n resolved\n stableStringify input.options ?? {}\n ]\n\n/** In-memory cache backed by a Map. No eviction. */\nexport function createMemoryCache(): Cache\n store: Map<string, string> := new Map\n {\n get(key)\n store.get key\n set(key, value)\n store.set key, value\n return\n }\n\n/**\n * On-disk cache rooted at `dir`. All errors are swallowed: the cache is\n * a performance optimization, never a correctness dependency. Writes go\n * via tmp+rename so concurrent builds can't observe a torn read. Keys\n * are flat (no nested subdirectories), so `dir` is created once here\n * rather than from each `set()`.\n *\n * On every successful `get()`, the entry's mtime is bumped to \"now\" so\n * external culling (e.g. `find .cache/build -mtime +30 -delete`) can\n * reliably distinguish hot from cold entries.\n */\nexport function createDiskCache(dir: string): Cache\n try\n fs.mkdirSync dir, recursive: true\n /* c8 ignore next 2 -- best-effort: recursive mkdir is idempotent for existing dirs; only fires on permission errors / read-only fs */\n catch\n // dir already exists or is unwritable — set() will silently noop on write failures\n {\n get(key)\n target := path.join dir, key\n try\n content := fs.readFileSync target, 'utf8'\n // Best-effort mtime touch for LRU-style culling; ignore errors\n // (file vanished, read-only fs, etc.) — the value is still valid.\n try\n now := new Date\n fs.utimesSync target, now, now\n /* c8 ignore next 2 -- best-effort touch: fires only on read-only fs / file vanished mid-read */\n catch\n // ignore\n return content\n catch\n return undefined\n set(key, value)\n target := path.join dir, key\n try\n tmp := `${target}.tmp.${process.pid}`\n fs.writeFileSync tmp, value\n fs.renameSync tmp, target\n /* c8 ignore next 2 -- best-effort write: fires only on disk-full / read-only fs */\n catch\n return\n }\n", "/**\n * Hera transpiler plugin. Two-stage compile: Hera grammar → Civet code,\n * Civet code → TS — with the Hera→Civet sourcemap fed in as Civet's\n * `upstreamSourceMap` so TS diagnostics map all the way back to the\n * `.hera` source through the same `remapPosition` plumbing other\n * consumers use.\n */\n\n{ type CompileOptions, type ParseError } from @danielx/civet\nBundledCivetModule from @danielx/civet\nBundledCivetPackage from @danielx/civet/package.json with type: 'json'\n{ createRequire } from node:module\n\n{ type Extension } from typescript\n{ type Plugin, type SourceMap, type TranspileResult } from ../types.civet\n{ type Cache, makeCacheKey } from ../../cache.civet\n\ninterface CachedTranspile\n code: string\n lines?: SourceMap[\"lines\"]\n\n// `require` that works for both build targets and any consumer bundle.\n// In CJS `__filename` is a global; in pure ESM it's undefined and we\n// fall back to `import.meta.url`. The typeof guard short-circuits\n// before `import.meta.url` is read in CJS — load-bearing because some\n// consumer bundles (e.g. lsp/server) `define` `import.meta.url` to \"\"\n// and `createRequire(\"\")` throws.\nheraRequire := createRequire(\n /* c8 ignore start -- one branch fires per build target; tests cover only one */\n __filename !<? \"undefined\" ? __filename : import.meta.url\n /* c8 ignore stop */\n)\n\ninterface HeraCompileResult\n code: string\n sourceMap?: unknown\n\ninterface HeraModule\n compile(source: string, options: { filename: string, module: boolean, sourceMap: boolean, language?: string }): HeraCompileResult\n\nexport interface HeraPluginOptions\n /**\n * Override the Hera module. When omitted, `@danielx/hera` is loaded\n * lazily via `require()` the first time a `.hera` file is transpiled —\n * so consumers without any `.hera` files don't need it installed, and\n * `@danielx/hera` can stay an optional peer dependency rather than a\n * hard runtime requirement of `@danielx/civet/ts-service`.\n */\n Hera?: HeraModule\n /** Override the Hera package version used in cache keys. Auto-detected from `@danielx/hera/package.json` on first compile when omitted. */\n HeraVersion?: string\n /** Override the second-stage Civet module. Defaults to bundled @danielx/civet. */\n Civet?: typeof BundledCivetModule\n /** Override the second-stage Civet package version used in cache keys. Defaults to the bundled Civet's version. */\n CivetVersion?: string\n /** Civet compile config forwarded to the second stage (mirrors makeCivetPlugin). */\n config?: CompileOptions\n /**\n * Optional cache for transpile results. When supplied, successful compiles\n * (errors-empty) are stored and reused for matching inputs.\n */\n cache?: Cache\n\n/**\n * Build a Hera transpiler Plugin. The `@danielx/hera` runtime is\n * resolved lazily on first `.hera` compile (so consumers without any\n * `.hera` files don't pay the require), then cached.\n */\nexport function makeHeraPlugin(options: HeraPluginOptions = {}): Plugin\n Civet := options.Civet ?? BundledCivetModule\n CivetVersion := options.CivetVersion ?? BundledCivetPackage.version\n civetConfig := options.config ?? {}\n cache := options.cache\n\n let resolvedHera: HeraModule?\n let resolvedHeraVersion: string?\n function getHera(): HeraModule\n return resolvedHera if resolvedHera\n if options.Hera\n resolvedHera = options.Hera\n return resolvedHera!\n /* c8 ignore start -- defensive: project's devDeps include @danielx/hera so require() always succeeds in tests */\n let mod: { compile: HeraModule['compile'] }\n try\n mod = heraRequire('@danielx/hera')\n catch\n throw new Error \"@danielx/hera is not installed; install it as a (peer) dependency to type-check .hera files, or pass HeraPluginOptions.Hera explicitly.\"\n /* c8 ignore stop */\n // @danielx/hera's published d.ts declares compile as returning `string`,\n // but with `sourceMap: true` the runtime returns `{ code, sourceMap }`.\n resolvedHera = { compile: mod.compile } as unknown as HeraModule\n resolvedHera!\n\n function getHeraVersion(): string\n return resolvedHeraVersion if resolvedHeraVersion\n if options.HeraVersion\n resolvedHeraVersion = options.HeraVersion\n return resolvedHeraVersion\n try\n pkg := heraRequire('@danielx/hera/package.json') as { version: string }\n resolvedHeraVersion = pkg.version\n catch\n resolvedHeraVersion = 'unknown'\n resolvedHeraVersion\n\n // Folded into the cache key (alongside civetConfig) so future option\n // changes invalidate entries. `language: 'civet'` is required for\n // Hera to emit TS-typed Civet — without it, `::Type` annotations are\n // stripped.\n heraOptions := {\n module: true\n sourceMap: true\n language: 'civet'\n }\n\n function transpileHera(p: string, source: string): TranspileResult\n errors: (Error | ParseError)[] := []\n\n cacheKey := if cache then makeCacheKey {\n source\n sourcePath: p\n compilerName: 'hera'\n compilerVersion: getHeraVersion()\n civetVersion: CivetVersion\n options: { heraOptions, civetConfig }\n } else undefined\n\n if cacheKey\n hit := cache!.get cacheKey\n if hit\n try\n { code, lines } := JSON.parse(hit) as CachedTranspile\n return {\n code\n sourceMap: { lines } as SourceMap\n errors\n }\n catch\n // corrupt cache entry — fall through and recompile\n\n try\n // Stage 1: Hera grammar → Civet code, with a Hera→Civet sourcemap.\n heraResult := getHera().compile source, { ...heraOptions, filename: p }\n\n // Stage 2: Civet code → TS, composing the upstream Hera→Civet map so\n // the final lines table maps `.hera.tsx` positions all the way back\n // to `.hera` source coordinates. `sync: true` forces the synchronous\n // overload of Civet.compile (matching makeCivetPlugin).\n civetOptions: CompileOptions & { sync: true, sourceMap: true } := {}\n ...civetConfig\n filename: p\n js: false\n sync: true\n sourceMap: true\n upstreamSourceMap: heraResult.sourceMap as string | object\n parseOptions: {}\n ...civetConfig.parseOptions\n comptime: false\n civetResult := Civet.compile heraResult.code, civetOptions\n\n if cacheKey\n sm := civetResult.sourceMap as SourceMap?\n lines := sm?.lines ?? sm?.data?.lines\n cache!.set cacheKey, JSON.stringify { code: civetResult.code, lines }\n\n {\n code: civetResult.code\n sourceMap: civetResult.sourceMap\n errors\n }\n catch e\n errors.push e as Error\n { code: \"\", errors }\n\n {\n transpilers: [{\n extension: \".hera\"\n target: \".tsx\" as Extension\n compile: transpileHera\n }]\n }\n\nexport default makeHeraPlugin\n", "/**\n * Incremental typecheck pipeline — the alternative to TSService for\n * one-shot `civet --typecheck` runs. Bypasses LanguageService and\n * constructs `ts.createIncrementalProgram` directly, so a prior\n * `.tsbuildinfo` actually skips per-file checks (LanguageService.getProgram()\n * can't leverage incremental state).\n *\n * Editor / watch / bundler consumers keep using TSService — this path is\n * for project-discovery typecheck where the full file set is read from\n * disk.\n */\n\nts from typescript\n* as fs from fs\n* as path from path\n\n{ type Plugin, type FileMeta, type Logger } from ./types.civet\n{\n getCanonicalFileName\n getTranspiledExtensionsFromPath\n removeExtension\n} from ./path.civet\n{\n buildTranspilers\n mogrifyPackageJsonImports\n parseTsConfigForCivet\n} from ./config.civet\n\nexport interface IncrementalTypecheckOptions\n /** Plugins providing transpilers for `.civet`, `.hera`, etc. */\n plugins: Plugin[]\n /** Pre-parsed tsconfig content (skips disk re-read of tsconfig.json). */\n tsConfig?: any\n /** Compiler options merged on top of the parsed tsconfig (e.g. tsBuildInfoFile). */\n extraCompilerOptions?: ts.CompilerOptions\n logger?: Logger\n\nexport interface IncrementalTypecheckResult\n builder: ts.EmitAndSemanticDiagnosticsBuilderProgram\n /**\n * The CompilerHost driving the program — exposed so tests (and bespoke\n * consumers) can probe `fileExists` / `getSourceFile` etc. directly.\n */\n host: ts.CompilerHost\n /** Per-source-file metadata captured during getSourceFile (sourcemap lines, parse errors). */\n getMeta(sourcePath: string): FileMeta?\n /** Diagnostics from parseJsonConfigFileContent. */\n configErrors: readonly ts.Diagnostic[]\n\n/**\n * Build a CompilerHost + IncrementalProgram set up to synthesize\n * `<source>.<target>` siblings (e.g. `foo.civet.tsx`) from the registered\n * transpilers. Each synthetic SourceFile is annotated with a content-hash\n * `version` so TS's BuilderProgram can detect changes across runs against\n * the prior tsbuildinfo state.\n */\nexport function makeIncrementalTypecheckProgram(\n projectPath: string\n options: IncrementalTypecheckOptions\n): IncrementalTypecheckResult\n transpilers := buildTranspilers options.plugins\n extraExtensions := Array.from transpilers.keys()\n parsed := parseTsConfigForCivet projectPath, transpilers, { tsConfig: options.tsConfig }\n\n compilerOptions: ts.CompilerOptions := {\n ...parsed.options\n ...options.extraCompilerOptions\n }\n compilerOptions.jsx ??= ts.JsxEmit.Preserve\n\n baseHost := ts.createIncrementalCompilerHost compilerOptions\n fileMetaData: Map<string, FileMeta> := new Map\n\n hashText := (text: string): string =>\n /* c8 ignore next -- baseHost.createHash is always set on Node */\n baseHost.createHash?(text) ?? text.length.toString()\n\n origGetSourceFile := baseHost.getSourceFile.bind baseHost\n baseHost.getSourceFile = (fileName: string, langVersion: any, onError, shouldCreateNew) =>\n exts := getTranspiledExtensionsFromPath fileName\n transpiler := exts and transpilers.get exts[0]\n if exts and transpiler and transpiler.target is exts[1]\n sourcePath := removeExtension fileName\n let sourceText: string?\n try\n sourceText = fs.readFileSync sourcePath, 'utf8'\n /* c8 ignore start -- fileExists already passed; only fires if the file vanishes between calls */\n catch\n return undefined\n /* c8 ignore stop */\n let result\n try\n result = transpiler.compile sourcePath, sourceText\n catch e\n fileMetaData.set getCanonicalFileName(sourcePath), {\n sourcemapLines: undefined\n transpiledDoc: undefined\n commentRanges: undefined\n parseErrors: [e as Error]\n fatal: true\n }\n return undefined\n // Async transpilers aren't supported here (matches TSService host).\n /* c8 ignore next -- bundled plugins are sync */\n return undefined if result <? Promise\n return undefined unless result and result.code\n /* c8 ignore next -- `?? .data?.lines` fallback only fires for legacy Civet (<0.9.4) sourcemap shape; bundled Civet always exposes .lines directly */\n sourcemapLines := result.sourceMap?.lines ?? result.sourceMap?.data?.lines\n fileMetaData.set getCanonicalFileName(sourcePath), {\n sourcemapLines\n transpiledDoc: undefined\n commentRanges: result.commentRanges\n parseErrors: result.errors\n fatal: false\n }\n sf := ts.createSourceFile fileName, result.code, langVersion, true\n // BuilderProgram requires a per-file version; createIncrementalCompilerHost's\n // own getSourceFile sets it from the file text hash, but our synthetic\n // sources need it set explicitly.\n (sf as any).version = hashText result.code\n return sf\n sf := origGetSourceFile fileName, langVersion, onError, shouldCreateNew\n /* c8 ignore start -- baseHost normally sets version itself; defensive */\n if sf and (sf as any).version is undefined\n (sf as any).version = hashText sf.text\n /* c8 ignore stop */\n sf\n\n origFileExists := baseHost.fileExists.bind baseHost\n // fileExists override: TS validates resolveModuleNameLiterals's outputs\n // (synthetic `.civet.tsx` paths) by asking the host whether they exist.\n // Without this override, TS would consult the bare filesystem, the\n // synthetic sibling wouldn't be found, and cross-file civet imports\n // would silently break.\n baseHost.fileExists = (fileName: string) =>\n exts := getTranspiledExtensionsFromPath fileName\n if exts\n transpiler := transpilers.get exts[0]\n if transpiler and transpiler.target is exts[1]\n return origFileExists removeExtension(fileName)\n origFileExists fileName\n\n // package.json#imports resolution runs before resolveModuleNameLiterals,\n // so rewrite transpilable extensions at the readFile boundary.\n origReadFile := baseHost.readFile.bind baseHost\n baseHost.readFile = (fileName: string) =>\n contents := origReadFile fileName\n if contents and path.basename(fileName) is \"package.json\"\n return mogrifyPackageJsonImports contents, transpilers\n contents\n\n // Redirect `import './foo.civet'` to its `.civet.tsx` synthetic sibling;\n // anything else falls through to ts.resolveModuleName. ts.resolveModuleName\n // returns `{ resolvedModule: ResolvedModuleFull | undefined }`, so we can\n // pass the field through directly without an explicit if/else.\n baseHost.resolveModuleNameLiterals = (literals: readonly any[], containingFile: string, _redirected, opts: ts.CompilerOptions) =>\n literals.map (lit) =>\n name: string := lit.text\n for ext of extraExtensions\n if name.endsWith ext\n t := transpilers.get(ext)!\n containingDir := path.dirname containingFile\n resolved := path.resolve containingDir, name\n if origFileExists resolved\n return {\n resolvedModule: {\n resolvedFileName: resolved + t.target\n extension: t.target\n isExternalLibraryImport: false\n }\n }\n { resolvedModule: ts.resolveModuleName(name, containingFile, opts, baseHost).resolvedModule }\n\n // ts.createIncrementalProgram reads any prior tsbuildinfo via the\n // host's readFile (driven by compilerOptions.tsBuildInfoFile) — no\n // explicit oldProgram parameter, the API picks it up internally.\n programOptions: ts.IncrementalProgramOptions<ts.EmitAndSemanticDiagnosticsBuilderProgram> := {\n rootNames: parsed.fileNames\n options: compilerOptions\n host: baseHost\n configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics parsed\n }\n programOptions.projectReferences = parsed.projectReferences if parsed.projectReferences\n builder := ts.createIncrementalProgram programOptions\n\n {\n builder\n host: baseHost\n getMeta(sourcePath: string)\n fileMetaData.get getCanonicalFileName(sourcePath)\n configErrors: parsed.errors\n }\n\nexport default makeIncrementalTypecheckProgram\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;ACME,wBAAM;AAQD,SAAS,wBAAwB,SAAiB,SAAqC;AAC/E,QAAb,gBAAiB,QAAQ;AACZ,QAAb,gBAAiB,QAAQ;AAChB,QAAT,YAAa,KAAK,IAAI,eAAe,aAAa;AAElD,WAAQ,QAAQ,GAAG,QAAQ,WAAW,SAAO;AAC3C,QAAG,QAAQ,KAAK,MAAM,QAAQ,KAAK,GAAC;AAC/B,UAAH,MAAO;AACH,UAAJ,OAAQ,YAAY;AACpB,eAAQ,IAAI,GAAG,IAAI,MAAM,KAAG;AAC1B,YAAG,QAAQ,gBAAgB,IAAI,CAAC,MAAM,QAAQ,gBAAgB,IAAI,CAAC,GAAC;AAClE;QAAK;AACP;MAAK;AAED,YAAN,SAAU,MAAM;AACP,YAAT,YAAa,UAAU,gBAAgB;AAEvC,aAAO;QACL,MAAM,EAAE,OAAO,OAAO;QACtB;MACF;IAAC;EAAA;AAEL,SAAO;AAAS;AAOX,SAAS,KAAK,SAAoC;AAC3C,QAAZ,eAAgB,oBAAI,IAA6C;AAErC,QAA5B,WAAgC;IAC9B,SAAS,CAA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Aa,QAAQ;AACjC,QAAG,YAAkB,eAAS,QAAQ,MAAK,gBAAc;AACvD,aAAO,0BAA0B,UAAU,WAAW;IAAA;AAC5D,WAAI;EAAQ;AAMV,WAAS,4BAA4B,CAAC,UAA0B,gBAAwB,aAAa,SAA4B;AACnI,WAAI,SAAS,IAAI,CAAC,QAAO;AACP,YAAZ,OAAgB,IAAI;AACpB,iBAAI,OAAO,iBAAe;AACxB,YAAG,KAAK,SAAS,GAAG,GAAA;AACjB,gBAAD,IAAK,YAAY,IAAI,GAAG;AACX,gBAAb,gBAAsB,cAAQ,cAAc;AACpC,gBAAR,WAAiB,cAAQ,eAAe,IAAI;AAC5C,cAAG,eAAe,QAAQ,GAAA;AACxB,mBAAO;cACL,gBAAgB;gBACd,kBAAkB,WAAW,EAAE;gBAC/B,WAAW,EAAE;gBACb,yBAAyB;cAC3B;YACF;UAAC;QAAA;MAAA;AACb,aAAM,EAAE,gBAAgB,oBAAAD,QAAG,kBAAkB,MAAM,gBAAgB,MAAM,QAAQ,EAAE,eAAe;IAAC,CAAA;EAAA;AAKR,QAAzF,iBAA6F;IAC3F,WAAW,OAAO;IAClB,SAAS;IACT,MAAM;IACN,8BAA8B,oBAAAA,QAAG,gCAAgC,MAAM;EACzE;AAC4D,MAAG,OAAO,mBAAiB;AAAvF,mBAAe,oBAAoB,OAAO;EAAA;AACnC,QAAP,UAAW,oBAAAA,QAAG,yBAAyB,cAAc;AAEvD,SAAE;IACE;IACA,MAAM;IACV,QAAY,YAAmB;AAC/B,aAAM,aAAa,IAAI,qBAAqB,UAAU,CAAC;IAAA;IACnD,cAAc,OAAO;EACvB;AAAC;",
|
|
6
|
+
"names": ["import_typescript", "import_typescript", "path", "ts", "import_node_path", "import_typescript", "import_typescript", "import_node_path", "ts", "path", "ts", "assert", "path", "resolvedModule", "resolved", "import_node_path", "import_typescript", "ts", "path", "getCanonicalFileName", "options", "import_civet", "import_typescript", "path", "BundledCivetModule", "BundledCivetLib", "BundledCivetPackage", "options", "import_civet", "import_package", "import_typescript", "BundledCivetModule", "BundledCivetPackage", "import_typescript", "fs", "path", "ts", "sf"]
|
|
7
|
+
}
|