@tsrx/typescript-plugin 0.6.3 → 0.7.1
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/README.md +12 -0
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/module-format-CDeoefY0.js +5 -0
- package/dist/module-format-CDeoefY0.js.map +1 -0
- package/dist/tsc.js +1 -1
- package/dist/tsc.js.map +1 -1
- package/package.json +7 -7
- package/dist/language-C8Cl5qyV.js +0 -5
- package/dist/language-C8Cl5qyV.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"language-C8Cl5qyV.js","names":["exports","exports","fileURLToPath","fs","path","resolveExports","parse","printParseErrorCode","path","createRequire","logError","logWarning","require","createRequire","fileURLToPath","forEachEmbeddedCode"],"sources":["../../../node_modules/.pnpm/@volar+source-map@2.4.28/node_modules/@volar/source-map/lib/binarySearch.js","../../../node_modules/.pnpm/@volar+source-map@2.4.28/node_modules/@volar/source-map/lib/translateOffset.js","../../../node_modules/.pnpm/@volar+source-map@2.4.28/node_modules/@volar/source-map/lib/sourceMap.js","../../../node_modules/.pnpm/@volar+source-map@2.4.28/node_modules/@volar/source-map/index.js","../../../node_modules/.pnpm/@volar+language-core@2.4.28/node_modules/@volar/language-core/lib/editor.js","../../../node_modules/.pnpm/@volar+language-core@2.4.28/node_modules/@volar/language-core/lib/linkedCodeMap.js","../../../node_modules/.pnpm/@volar+language-core@2.4.28/node_modules/@volar/language-core/lib/types.js","../../../node_modules/.pnpm/@volar+language-core@2.4.28/node_modules/@volar/language-core/lib/utils.js","../../../node_modules/.pnpm/@volar+language-core@2.4.28/node_modules/@volar/language-core/index.js","../src/config-host.js","../../../node_modules/.pnpm/resolve-pkg-maps@1.0.0/node_modules/resolve-pkg-maps/dist/index.mjs","../src/package-resolution.js","../src/jsonc.js","../src/tsconfig-resolution.js","../src/utils.js","../src/consumer-compiler.js","../src/transform.js","../src/language.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.binarySearch = binarySearch;\nfunction binarySearch(values, searchValue) {\n let low = 0;\n let high = values.length - 1;\n let match;\n while (low <= high) {\n const mid = Math.floor((low + high) / 2);\n const midValue = values[mid];\n if (midValue < searchValue) {\n low = mid + 1;\n }\n else if (midValue > searchValue) {\n high = mid - 1;\n }\n else {\n low = mid;\n high = mid;\n match = mid;\n break;\n }\n }\n const finalLow = Math.max(Math.min(low, high, values.length - 1), 0);\n const finalHigh = Math.min(Math.max(low, high, 0), values.length - 1);\n return { low: finalLow, high: finalHigh, match };\n}\n//# sourceMappingURL=binarySearch.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.translateOffset = translateOffset;\nlet warned = false;\nfunction translateOffset(start, fromOffsets, toOffsets, fromLengths, toLengths = fromLengths, preferEnd = false) {\n const isSorted = fromOffsets.every((value, index) => index === 0 || fromOffsets[index - 1] <= value);\n if (!isSorted) {\n for (let i = 0; i < fromOffsets.length; i++) {\n const fromOffset = fromOffsets[i];\n const fromLength = fromLengths[i];\n if (start >= fromOffset && start <= fromOffset + fromLength) {\n const toLength = toLengths[i];\n const toOffset = toOffsets[i];\n let rangeOffset;\n const relativePos = start - fromOffset;\n if (preferEnd && toLength > fromLength && relativePos === fromLength) {\n rangeOffset = toLength;\n }\n else {\n rangeOffset = Math.min(relativePos, toLength);\n }\n return toOffset + rangeOffset;\n }\n }\n if (!warned) {\n warned = true;\n console.warn('fromOffsets should be sorted in ascending order');\n }\n }\n let low = 0;\n let high = fromOffsets.length - 1;\n while (low <= high) {\n const mid = Math.floor((low + high) / 2);\n const fromOffset = fromOffsets[mid];\n const fromLength = fromLengths[mid];\n if (start >= fromOffset && start <= fromOffset + fromLength) {\n const toLength = toLengths[mid];\n const toOffset = toOffsets[mid];\n let rangeOffset;\n const relativePos = start - fromOffset;\n if (preferEnd && toLength > fromLength && relativePos === fromLength) {\n rangeOffset = toLength;\n }\n else {\n rangeOffset = Math.min(relativePos, toLength);\n }\n return toOffset + rangeOffset;\n }\n else if (start < fromOffset) {\n high = mid - 1;\n }\n else {\n low = mid + 1;\n }\n }\n}\n//# sourceMappingURL=translateOffset.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SourceMap = void 0;\nconst binarySearch_1 = require(\"./binarySearch\");\nconst translateOffset_1 = require(\"./translateOffset\");\nclass SourceMap {\n constructor(mappings) {\n this.mappings = mappings;\n }\n toSourceRange(generatedStart, generatedEnd, fallbackToAnyMatch, filter) {\n return this.findMatchingStartEnd(generatedStart, generatedEnd, fallbackToAnyMatch, 'generatedOffsets', filter);\n }\n toGeneratedRange(sourceStart, sourceEnd, fallbackToAnyMatch, filter) {\n return this.findMatchingStartEnd(sourceStart, sourceEnd, fallbackToAnyMatch, 'sourceOffsets', filter);\n }\n toSourceLocation(generatedOffset, filter) {\n return this.findMatchingOffsets(generatedOffset, 'generatedOffsets', filter);\n }\n toGeneratedLocation(sourceOffset, filter) {\n return this.findMatchingOffsets(sourceOffset, 'sourceOffsets', filter);\n }\n *findMatchingOffsets(offset, fromRange, filter, preferEnd = false) {\n const memo = this.getMemoBasedOnRange(fromRange);\n if (memo.offsets.length === 0) {\n return;\n }\n const { low: start, high: end } = (0, binarySearch_1.binarySearch)(memo.offsets, offset);\n const skip = new Set();\n const toRange = fromRange === 'sourceOffsets' ? 'generatedOffsets' : 'sourceOffsets';\n for (let i = start; i <= end; i++) {\n for (const mapping of memo.mappings[i]) {\n if (skip.has(mapping)) {\n continue;\n }\n skip.add(mapping);\n if (filter && !filter(mapping.data)) {\n continue;\n }\n const mapped = (0, translateOffset_1.translateOffset)(offset, mapping[fromRange], mapping[toRange], getLengths(mapping, fromRange), getLengths(mapping, toRange), preferEnd);\n if (mapped !== undefined) {\n yield [mapped, mapping];\n }\n }\n }\n }\n *findMatchingStartEnd(start, end, fallbackToAnyMatch, fromRange, filter) {\n const toRange = fromRange === 'sourceOffsets' ? 'generatedOffsets' : 'sourceOffsets';\n const preferEnd = toRange === 'sourceOffsets';\n const mappedStarts = [];\n let hadMatch = false;\n for (const [mappedStart, mapping] of this.findMatchingOffsets(start, fromRange)) {\n if (filter && !filter(mapping.data)) {\n continue;\n }\n mappedStarts.push([mappedStart, mapping]);\n const mappedEnd = (0, translateOffset_1.translateOffset)(end, mapping[fromRange], mapping[toRange], getLengths(mapping, fromRange), getLengths(mapping, toRange), preferEnd);\n if (mappedEnd !== undefined) {\n hadMatch = true;\n yield [mappedStart, mappedEnd, mapping, mapping];\n }\n }\n if (!hadMatch && fallbackToAnyMatch) {\n for (const [mappedStart, mappingStart] of mappedStarts) {\n for (const [mappedEnd, mappingEnd] of this.findMatchingOffsets(end, fromRange, undefined, preferEnd)) {\n if (filter && !filter(mappingEnd.data) || mappedEnd < mappedStart) {\n continue;\n }\n yield [mappedStart, mappedEnd, mappingStart, mappingEnd];\n break;\n }\n }\n }\n }\n getMemoBasedOnRange(fromRange) {\n return fromRange === 'sourceOffsets'\n ? this.sourceCodeOffsetsMemo ??= this.createMemo('sourceOffsets')\n : this.generatedCodeOffsetsMemo ??= this.createMemo('generatedOffsets');\n }\n createMemo(key) {\n const offsetsSet = new Set();\n for (const mapping of this.mappings) {\n for (let i = 0; i < mapping[key].length; i++) {\n offsetsSet.add(mapping[key][i]);\n offsetsSet.add(mapping[key][i] + getLengths(mapping, key)[i]);\n }\n }\n const offsets = [...offsetsSet].sort((a, b) => a - b);\n const mappings = offsets.map(() => new Set());\n for (const mapping of this.mappings) {\n for (let i = 0; i < mapping[key].length; i++) {\n const startIndex = (0, binarySearch_1.binarySearch)(offsets, mapping[key][i]).match;\n const endIndex = (0, binarySearch_1.binarySearch)(offsets, mapping[key][i] + getLengths(mapping, key)[i]).match;\n for (let i = startIndex; i <= endIndex; i++) {\n mappings[i].add(mapping);\n }\n }\n }\n return { offsets, mappings };\n }\n}\nexports.SourceMap = SourceMap;\nfunction getLengths(mapping, key) {\n return key === 'sourceOffsets' ? mapping.lengths : mapping.generatedLengths ?? mapping.lengths;\n}\n//# sourceMappingURL=sourceMap.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./lib/sourceMap\"), exports);\n__exportStar(require(\"./lib/translateOffset\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isHoverEnabled = isHoverEnabled;\nexports.isInlayHintsEnabled = isInlayHintsEnabled;\nexports.isCodeLensEnabled = isCodeLensEnabled;\nexports.isMonikerEnabled = isMonikerEnabled;\nexports.isInlineValueEnabled = isInlineValueEnabled;\nexports.isSemanticTokensEnabled = isSemanticTokensEnabled;\nexports.isCallHierarchyEnabled = isCallHierarchyEnabled;\nexports.isTypeHierarchyEnabled = isTypeHierarchyEnabled;\nexports.isRenameEnabled = isRenameEnabled;\nexports.isDefinitionEnabled = isDefinitionEnabled;\nexports.isTypeDefinitionEnabled = isTypeDefinitionEnabled;\nexports.isReferencesEnabled = isReferencesEnabled;\nexports.isImplementationEnabled = isImplementationEnabled;\nexports.isHighlightEnabled = isHighlightEnabled;\nexports.isSymbolsEnabled = isSymbolsEnabled;\nexports.isFoldingRangesEnabled = isFoldingRangesEnabled;\nexports.isSelectionRangesEnabled = isSelectionRangesEnabled;\nexports.isLinkedEditingEnabled = isLinkedEditingEnabled;\nexports.isColorEnabled = isColorEnabled;\nexports.isDocumentLinkEnabled = isDocumentLinkEnabled;\nexports.isDiagnosticsEnabled = isDiagnosticsEnabled;\nexports.isCodeActionsEnabled = isCodeActionsEnabled;\nexports.isFormattingEnabled = isFormattingEnabled;\nexports.isCompletionEnabled = isCompletionEnabled;\nexports.isAutoInsertEnabled = isAutoInsertEnabled;\nexports.isSignatureHelpEnabled = isSignatureHelpEnabled;\nexports.shouldReportDiagnostics = shouldReportDiagnostics;\nexports.resolveRenameNewName = resolveRenameNewName;\nexports.resolveRenameEditText = resolveRenameEditText;\nexports.findOverlapCodeRange = findOverlapCodeRange;\nfunction isHoverEnabled(info) {\n return !!info.semantic;\n}\nfunction isInlayHintsEnabled(info) {\n return !!info.semantic;\n}\nfunction isCodeLensEnabled(info) {\n return !!info.semantic;\n}\nfunction isMonikerEnabled(info) {\n return !!info.semantic;\n}\nfunction isInlineValueEnabled(info) {\n return !!info.semantic;\n}\nfunction isSemanticTokensEnabled(info) {\n return typeof info.semantic === 'object'\n ? info.semantic.shouldHighlight?.() ?? true\n : !!info.semantic;\n}\nfunction isCallHierarchyEnabled(info) {\n return !!info.navigation;\n}\nfunction isTypeHierarchyEnabled(info) {\n return !!info.navigation;\n}\nfunction isRenameEnabled(info) {\n return typeof info.navigation === 'object'\n ? info.navigation.shouldRename?.() ?? true\n : !!info.navigation;\n}\nfunction isDefinitionEnabled(info) {\n return !!info.navigation;\n}\nfunction isTypeDefinitionEnabled(info) {\n return !!info.navigation;\n}\nfunction isReferencesEnabled(info) {\n return !!info.navigation;\n}\nfunction isImplementationEnabled(info) {\n return !!info.navigation;\n}\nfunction isHighlightEnabled(info) {\n return typeof info.navigation === 'object'\n ? info.navigation.shouldHighlight?.() ?? true\n : !!info.navigation;\n}\nfunction isSymbolsEnabled(info) {\n return !!info.structure;\n}\nfunction isFoldingRangesEnabled(info) {\n return !!info.structure;\n}\nfunction isSelectionRangesEnabled(info) {\n return !!info.structure;\n}\nfunction isLinkedEditingEnabled(info) {\n return !!info.structure;\n}\nfunction isColorEnabled(info) {\n return !!info.structure;\n}\nfunction isDocumentLinkEnabled(info) {\n return !!info.structure;\n}\nfunction isDiagnosticsEnabled(info) {\n return !!info.verification;\n}\nfunction isCodeActionsEnabled(info) {\n return !!info.verification;\n}\nfunction isFormattingEnabled(info) {\n return !!info.format;\n}\nfunction isCompletionEnabled(info) {\n return !!info.completion;\n}\nfunction isAutoInsertEnabled(info) {\n return !!info.completion;\n}\nfunction isSignatureHelpEnabled(info) {\n return !!info.completion;\n}\n// should...\nfunction shouldReportDiagnostics(info, source, code) {\n return typeof info.verification === 'object'\n ? info.verification.shouldReport?.(source, code) ?? true\n : !!info.verification;\n}\n// resolve...\nfunction resolveRenameNewName(newName, info) {\n return typeof info.navigation === 'object'\n ? info.navigation.resolveRenameNewName?.(newName) ?? newName\n : newName;\n}\nfunction resolveRenameEditText(text, info) {\n return typeof info.navigation === 'object'\n ? info.navigation.resolveRenameEditText?.(text) ?? text\n : text;\n}\nfunction findOverlapCodeRange(start, end, map, filter) {\n let mappedStart;\n let mappedEnd;\n for (const [mapped, mapping] of map.toGeneratedLocation(start)) {\n if (filter(mapping.data)) {\n mappedStart = mapped;\n break;\n }\n }\n for (const [mapped, mapping] of map.toGeneratedLocation(end)) {\n if (filter(mapping.data)) {\n mappedEnd = mapped;\n break;\n }\n }\n if (mappedStart === undefined || mappedEnd === undefined) {\n for (const mapping of map.mappings) {\n if (filter(mapping.data)) {\n const mappingStart = mapping.sourceOffsets[0];\n const mappingEnd = mapping.sourceOffsets[mapping.sourceOffsets.length - 1]\n + mapping.lengths[mapping.lengths.length - 1];\n const overlap = getOverlapRange(start, end, mappingStart, mappingEnd);\n if (overlap) {\n const curMappedStart = (overlap.start - mappingStart) + mapping.generatedOffsets[0];\n const lastGeneratedLength = (mapping.generatedLengths ?? mapping.lengths)[mapping.generatedOffsets.length - 1];\n const curMappedEndOffset = Math.min(overlap.end - mapping.sourceOffsets[mapping.sourceOffsets.length - 1], lastGeneratedLength);\n const curMappedEnd = mapping.generatedOffsets[mapping.generatedOffsets.length - 1] + curMappedEndOffset;\n mappedStart = mappedStart === undefined ? curMappedStart : Math.min(mappedStart, curMappedStart);\n mappedEnd = mappedEnd === undefined ? curMappedEnd : Math.max(mappedEnd, curMappedEnd);\n }\n }\n }\n }\n if (mappedStart !== undefined && mappedEnd !== undefined) {\n return {\n start: mappedStart,\n end: mappedEnd,\n };\n }\n}\nfunction getOverlapRange(range1Start, range1End, range2Start, range2End) {\n const start = Math.max(range1Start, range2Start);\n const end = Math.min(range1End, range2End);\n if (start > end) {\n return undefined;\n }\n return {\n start,\n end,\n };\n}\n//# sourceMappingURL=editor.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LinkedCodeMap = void 0;\nconst source_map_1 = require(\"@volar/source-map\");\nclass LinkedCodeMap extends source_map_1.SourceMap {\n *getLinkedOffsets(start) {\n for (const mapped of this.toGeneratedLocation(start)) {\n yield mapped[0];\n }\n for (const mapped of this.toSourceLocation(start)) {\n yield mapped[0];\n }\n }\n}\nexports.LinkedCodeMap = LinkedCodeMap;\n//# sourceMappingURL=linkedCodeMap.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=types.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FileMap = void 0;\nclass FileMap extends Map {\n constructor(caseSensitive) {\n super();\n this.caseSensitive = caseSensitive;\n this.originalFileNames = new Map();\n }\n keys() {\n return this.originalFileNames.values();\n }\n get(key) {\n return super.get(this.normalizeId(key));\n }\n has(key) {\n return super.has(this.normalizeId(key));\n }\n set(key, value) {\n this.originalFileNames.set(this.normalizeId(key), key);\n return super.set(this.normalizeId(key), value);\n }\n delete(key) {\n this.originalFileNames.delete(this.normalizeId(key));\n return super.delete(this.normalizeId(key));\n }\n clear() {\n this.originalFileNames.clear();\n return super.clear();\n }\n normalizeId(id) {\n return this.caseSensitive ? id : id.toLowerCase();\n }\n}\nexports.FileMap = FileMap;\n//# sourceMappingURL=utils.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.defaultMapperFactory = exports.SourceMap = void 0;\nexports.createLanguage = createLanguage;\nexports.forEachEmbeddedCode = forEachEmbeddedCode;\nvar source_map_1 = require(\"@volar/source-map\");\nObject.defineProperty(exports, \"SourceMap\", { enumerable: true, get: function () { return source_map_1.SourceMap; } });\n__exportStar(require(\"./lib/editor\"), exports);\n__exportStar(require(\"./lib/linkedCodeMap\"), exports);\n__exportStar(require(\"./lib/types\"), exports);\n__exportStar(require(\"./lib/utils\"), exports);\nconst source_map_2 = require(\"@volar/source-map\");\nconst linkedCodeMap_1 = require(\"./lib/linkedCodeMap\");\nconst defaultMapperFactory = mappings => new source_map_2.SourceMap(mappings);\nexports.defaultMapperFactory = defaultMapperFactory;\nfunction createLanguage(plugins, scriptRegistry, sync, onAssociationDirty) {\n const virtualCodeToSourceScriptMap = new WeakMap();\n const virtualCodeToSourceMap = new WeakMap();\n const virtualCodeToLinkedCodeMap = new WeakMap();\n const language = {\n mapperFactory: exports.defaultMapperFactory,\n plugins,\n scripts: {\n fromVirtualCode(virtualCode) {\n return virtualCodeToSourceScriptMap.get(virtualCode);\n },\n get(id, includeFsFiles = true, shouldRegister = false) {\n sync(id, includeFsFiles, shouldRegister);\n const result = scriptRegistry.get(id);\n // The sync function provider may not always call the set function due to caching, so it is necessary to explicitly check isAssociationDirty.\n if (result?.isAssociationDirty) {\n this.set(id, result.snapshot, result.languageId);\n }\n return scriptRegistry.get(id);\n },\n set(id, snapshot, languageId, _plugins = plugins) {\n if (!languageId) {\n for (const plugin of plugins) {\n languageId = plugin.getLanguageId?.(id);\n if (languageId) {\n break;\n }\n }\n }\n if (!languageId) {\n console.warn(`languageId not found for ${String(id)}`);\n return;\n }\n let associatedOnly = false;\n for (const plugin of plugins) {\n if (plugin.isAssociatedFileOnly?.(id, languageId)) {\n associatedOnly = true;\n break;\n }\n }\n if (scriptRegistry.has(id)) {\n const sourceScript = scriptRegistry.get(id);\n if (sourceScript.languageId !== languageId || sourceScript.associatedOnly !== associatedOnly) {\n this.delete(id);\n triggerTargetsDirty(sourceScript);\n return this.set(id, snapshot, languageId);\n }\n else if (associatedOnly) {\n if (sourceScript.snapshot !== snapshot) {\n sourceScript.snapshot = snapshot;\n triggerTargetsDirty(sourceScript);\n }\n }\n else if (sourceScript.isAssociationDirty || sourceScript.snapshot !== snapshot) {\n if (sourceScript.snapshot !== snapshot) {\n sourceScript.snapshot = snapshot;\n triggerTargetsDirty(sourceScript);\n }\n const codegenCtx = prepareCreateVirtualCode(sourceScript);\n if (sourceScript.generated) {\n const { updateVirtualCode, createVirtualCode } = sourceScript.generated.languagePlugin;\n const newVirtualCode = updateVirtualCode\n ? updateVirtualCode(id, sourceScript.generated.root, snapshot, codegenCtx)\n : createVirtualCode?.(id, languageId, snapshot, codegenCtx);\n if (newVirtualCode) {\n sourceScript.generated.root = newVirtualCode;\n sourceScript.generated.embeddedCodes.clear();\n for (const code of forEachEmbeddedCode(sourceScript.generated.root)) {\n virtualCodeToSourceScriptMap.set(code, sourceScript);\n sourceScript.generated.embeddedCodes.set(code.id, code);\n }\n return sourceScript;\n }\n else {\n this.delete(id);\n return;\n }\n }\n }\n else {\n // not changed\n return sourceScript;\n }\n }\n else {\n // created\n const sourceScript = {\n id: id,\n languageId,\n snapshot,\n associatedIds: new Set(),\n targetIds: new Set(),\n associatedOnly,\n };\n scriptRegistry.set(id, sourceScript);\n if (associatedOnly) {\n return sourceScript;\n }\n for (const languagePlugin of _plugins) {\n const virtualCode = languagePlugin.createVirtualCode?.(id, languageId, snapshot, prepareCreateVirtualCode(sourceScript));\n if (virtualCode) {\n sourceScript.generated = {\n root: virtualCode,\n languagePlugin,\n embeddedCodes: new Map(),\n };\n for (const code of forEachEmbeddedCode(virtualCode)) {\n virtualCodeToSourceScriptMap.set(code, sourceScript);\n sourceScript.generated.embeddedCodes.set(code.id, code);\n }\n break;\n }\n }\n return sourceScript;\n }\n },\n delete(id) {\n const sourceScript = scriptRegistry.get(id);\n if (sourceScript) {\n sourceScript.generated?.languagePlugin.disposeVirtualCode?.(id, sourceScript.generated.root);\n scriptRegistry.delete(id);\n triggerTargetsDirty(sourceScript);\n }\n },\n },\n maps: {\n get(virtualCode, sourceScript) {\n let mapCache = virtualCodeToSourceMap.get(virtualCode.snapshot);\n if (!mapCache) {\n virtualCodeToSourceMap.set(virtualCode.snapshot, mapCache = new WeakMap());\n }\n if (!mapCache.has(sourceScript.snapshot)) {\n const mappings = virtualCode.associatedScriptMappings?.get(sourceScript.id) ?? virtualCode.mappings;\n mapCache.set(sourceScript.snapshot, language.mapperFactory(mappings));\n }\n return mapCache.get(sourceScript.snapshot);\n },\n *forEach(virtualCode) {\n const sourceScript = virtualCodeToSourceScriptMap.get(virtualCode);\n yield [\n sourceScript,\n this.get(virtualCode, sourceScript),\n ];\n if (virtualCode.associatedScriptMappings) {\n for (const [relatedScriptId] of virtualCode.associatedScriptMappings) {\n const relatedSourceScript = scriptRegistry.get(relatedScriptId);\n if (relatedSourceScript) {\n yield [\n relatedSourceScript,\n this.get(virtualCode, relatedSourceScript),\n ];\n }\n }\n }\n },\n },\n linkedCodeMaps: {\n get(virtualCode) {\n const sourceScript = virtualCodeToSourceScriptMap.get(virtualCode);\n let mapCache = virtualCodeToLinkedCodeMap.get(virtualCode.snapshot);\n if (mapCache?.[0] !== sourceScript.snapshot) {\n virtualCodeToLinkedCodeMap.set(virtualCode.snapshot, mapCache = [\n sourceScript.snapshot,\n virtualCode.linkedCodeMappings\n ? new linkedCodeMap_1.LinkedCodeMap(virtualCode.linkedCodeMappings)\n : undefined,\n ]);\n }\n return mapCache[1];\n },\n },\n };\n return language;\n function triggerTargetsDirty(sourceScript) {\n sourceScript.targetIds.forEach(id => {\n const sourceScript = scriptRegistry.get(id);\n if (sourceScript) {\n sourceScript.isAssociationDirty = true;\n onAssociationDirty?.(sourceScript.id);\n }\n });\n }\n function prepareCreateVirtualCode(sourceScript) {\n for (const id of sourceScript.associatedIds) {\n scriptRegistry.get(id)?.targetIds.delete(sourceScript.id);\n }\n sourceScript.associatedIds.clear();\n sourceScript.isAssociationDirty = false;\n return {\n getAssociatedScript(id) {\n sync(id, true, true);\n const relatedSourceScript = scriptRegistry.get(id);\n if (relatedSourceScript) {\n relatedSourceScript.targetIds.add(sourceScript.id);\n sourceScript.associatedIds.add(relatedSourceScript.id);\n }\n return relatedSourceScript;\n },\n };\n }\n}\nfunction* forEachEmbeddedCode(virtualCode) {\n yield virtualCode;\n if (virtualCode.embeddedCodes) {\n for (const embeddedCode of virtualCode.embeddedCodes) {\n yield* forEachEmbeddedCode(embeddedCode);\n }\n }\n}\n//# sourceMappingURL=index.js.map","/**\n * The file-system host the TSRX tooling reads `tsconfig.json` files and\n * package manifests through when no TypeScript `sys` is supplied. It covers\n * the subset of `ts.sys` that `tsconfig-resolution.js` and\n * `consumer-compiler.js` use, on `node:fs`, so the native TypeScript 7 path\n * (whose `typescript` package has no JavaScript API) needs no TypeScript at\n * all. `ts.sys` still satisfies the same interface for the classic path.\n */\n\nimport fs from 'node:fs';\nimport { fileURLToPath } from 'node:url';\n\n/**\n * @typedef {object} ConfigHost\n * @property {(file_name: string) => boolean} fileExists\n * @property {(file_name: string) => string | undefined} readFile\n * @property {(directory_name: string) => boolean} [directoryExists]\n * @property {boolean | (() => boolean)} useCaseSensitiveFileNames\n * @property {(file_name: string) => Date | undefined} [getModifiedTime]\n * @property {(path_name: string) => string} [realpath]\n */\n\n/**\n * Whether the file system distinguishes letter case, probed the way\n * TypeScript's `sys` does: this module's own path with its case swapped exists\n * only on a case-insensitive file system.\n * @returns {boolean}\n */\nfunction detect_case_sensitive_file_names() {\n\tconst own_path = fileURLToPath(import.meta.url);\n\tconst swapped = own_path.replace(/[a-zA-Z]/g, (letter) =>\n\t\tletter === letter.toLowerCase() ? letter.toUpperCase() : letter.toLowerCase(),\n\t);\n\tif (swapped === own_path) {\n\t\treturn true;\n\t}\n\treturn !fs.existsSync(swapped);\n}\n\n/** @type {boolean | undefined} */\nlet case_sensitive_file_names;\n\n/** @returns {boolean} */\nexport function use_case_sensitive_file_names() {\n\tcase_sensitive_file_names ??= detect_case_sensitive_file_names();\n\treturn case_sensitive_file_names;\n}\n\n/**\n * @param {string} file_name\n * @returns {fs.Stats | undefined}\n */\nfunction stat(file_name) {\n\ttry {\n\t\treturn fs.statSync(file_name, { throwIfNoEntry: false });\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/** @returns {ConfigHost} */\nexport function create_config_host() {\n\treturn {\n\t\tfileExists: (file_name) => stat(file_name)?.isFile() === true,\n\t\tdirectoryExists: (directory_name) => stat(directory_name)?.isDirectory() === true,\n\t\treadFile: (file_name) => {\n\t\t\ttry {\n\t\t\t\treturn fs.readFileSync(file_name, 'utf8');\n\t\t\t} catch {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t\tuseCaseSensitiveFileNames: use_case_sensitive_file_names,\n\t\tgetModifiedTime: (file_name) => stat(file_name)?.mtime,\n\t\trealpath: (path_name) => {\n\t\t\ttry {\n\t\t\t\treturn fs.realpathSync(path_name);\n\t\t\t} catch {\n\t\t\t\treturn path_name;\n\t\t\t}\n\t\t},\n\t};\n}\n\n/** The shared default host; one instance so per-host caches are reused. */\nexport const NODE_CONFIG_HOST = create_config_host();\n","const A=r=>r!==null&&typeof r==\"object\",a=(r,t)=>Object.assign(new Error(`[${r}]: ${t}`),{code:r}),_=\"ERR_INVALID_PACKAGE_CONFIG\",E=\"ERR_INVALID_PACKAGE_TARGET\",I=\"ERR_PACKAGE_PATH_NOT_EXPORTED\",P=\"ERR_PACKAGE_IMPORT_NOT_DEFINED\",R=/^\\d+$/,O=/^(\\.{1,2}|node_modules)$/i,w=/\\/|\\\\/;var h=(r=>(r.Export=\"exports\",r.Import=\"imports\",r))(h||{});const f=(r,t,e,o,c)=>{if(t==null)return[];if(typeof t==\"string\"){const[n,...i]=t.split(w);if(n===\"..\"||i.some(l=>O.test(l)))throw a(E,`Invalid \"${r}\" target \"${t}\" defined in the package config`);return[c?t.replace(/\\*/g,c):t]}if(Array.isArray(t))return t.flatMap(n=>f(r,n,e,o,c));if(A(t)){for(const n of Object.keys(t)){if(R.test(n))throw a(_,\"Cannot contain numeric property keys\");if(n===\"default\"||o.includes(n))return f(r,t[n],e,o,c)}return[]}throw a(E,`Invalid \"${r}\" target \"${t}\"`)},s=\"*\",m=(r,t)=>{const e=r.indexOf(s),o=t.indexOf(s);return e===o?t.length>r.length:o>e};function d(r,t){if(!t.includes(s)&&r.hasOwnProperty(t))return[t];let e,o;for(const c of Object.keys(r))if(c.includes(s)){const[n,i,l]=c.split(s);if(l===void 0&&t.startsWith(n)&&t.endsWith(i)){const g=t.slice(n.length,-i.length||void 0);g&&(!e||m(e,c))&&(e=c,o=g)}}return[e,o]}const p=r=>Object.keys(r).reduce((t,e)=>{const o=e===\"\"||e[0]!==\".\";if(t===void 0||t===o)return o;throw a(_,'\"exports\" cannot contain some keys starting with \".\" and some not')},void 0),u=/^\\w+:/,v=(r,t,e)=>{if(!r)throw new Error('\"exports\" is required');t=t===\"\"?\".\":`./${t}`,(typeof r==\"string\"||Array.isArray(r)||A(r)&&p(r))&&(r={\".\":r});const[o,c]=d(r,t),n=f(h.Export,r[o],t,e,c);if(n.length===0)throw a(I,t===\".\"?'No \"exports\" main defined':`Package subpath '${t}' is not defined by \"exports\"`);for(const i of n)if(!i.startsWith(\"./\")&&!u.test(i))throw a(E,`Invalid \"exports\" target \"${i}\" defined in the package config`);return n},T=(r,t,e)=>{if(!r)throw new Error('\"imports\" is required');const[o,c]=d(r,t),n=f(h.Import,r[o],t,e,c);if(n.length===0)throw a(P,`Package import specifier \"${t}\" is not defined in package`);return n};export{v as resolveExports,T as resolveImports};\n","/**\n * Package lookups without TypeScript's module resolver: the runtime entry of a\n * TSRX compiler package, and the file a `tsconfig.json` `extends` entry names.\n * Both walk `node_modules` directories upwards from a starting directory and\n * read every `package.json` fresh, so they also serve as the retry path when\n * Node's own `require.resolve` keeps a negative lookup after a package is\n * installed.\n */\n\nimport path from 'node:path';\nimport { resolveExports } from 'resolve-pkg-maps';\nimport { NODE_CONFIG_HOST } from './config-host.js';\n\n/** @typedef {import('./config-host.js').ConfigHost} ConfigHost */\n\n/**\n * @typedef {object} ParsedSpecifier\n * @property {string} name `pkg` or `@scope/pkg`.\n * @property {string} subpath The part after the package name, without a leading slash; empty for the package root.\n */\n\n/**\n * @param {string} specifier\n * @returns {ParsedSpecifier | undefined} `undefined` for relative, absolute or empty specifiers.\n */\nexport function parse_bare_specifier(specifier) {\n\tif (specifier === '' || specifier.startsWith('.') || path.isAbsolute(specifier)) {\n\t\treturn undefined;\n\t}\n\tconst segments = specifier.split('/');\n\tconst name_segments = specifier.startsWith('@') ? 2 : 1;\n\tif (segments.length < name_segments || segments.slice(0, name_segments).some((s) => s === '')) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\tname: segments.slice(0, name_segments).join('/'),\n\t\tsubpath: segments.slice(name_segments).join('/'),\n\t};\n}\n\n/**\n * A directory exists when the host says so, or (for hosts without\n * `directoryExists`) when it holds a `package.json`.\n * @param {ConfigHost} host\n * @param {string} directory_name\n * @returns {boolean}\n */\nfunction is_directory(host, directory_name) {\n\treturn host.directoryExists\n\t\t? host.directoryExists(directory_name)\n\t\t: host.fileExists(path.join(directory_name, 'package.json'));\n}\n\n/**\n * Read a package manifest through the host, never through Node's cached reader.\n * @param {ConfigHost} host\n * @param {string} package_dir\n * @returns {Record<string, unknown> | undefined}\n */\nexport function read_package_manifest(host, package_dir) {\n\tconst text = host.readFile(path.join(package_dir, 'package.json'));\n\tif (text === undefined) {\n\t\treturn undefined;\n\t}\n\ttry {\n\t\tconst parsed = JSON.parse(text);\n\t\treturn parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)\n\t\t\t? parsed\n\t\t\t: undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Every `node_modules/<name>` directory that exists on the way up from `from_dir`.\n * @param {ConfigHost} host\n * @param {string} from_dir\n * @param {string} name\n * @returns {string[]}\n */\nexport function package_directories(host, from_dir, name) {\n\t/** @type {string[]} */\n\tconst directories = [];\n\tlet current = path.resolve(from_dir);\n\twhile (true) {\n\t\tif (path.basename(current) !== 'node_modules') {\n\t\t\tconst candidate = path.join(current, 'node_modules', name);\n\t\t\tif (is_directory(host, candidate)) {\n\t\t\t\tdirectories.push(candidate);\n\t\t\t}\n\t\t}\n\t\tconst parent = path.dirname(current);\n\t\tif (parent === current) {\n\t\t\treturn directories;\n\t\t}\n\t\tcurrent = parent;\n\t}\n}\n\n/**\n * Targets of `exports` for a subpath under the given conditions, in order;\n * empty when the package has no `exports` or does not export the subpath.\n * @param {Record<string, unknown> | undefined} manifest\n * @param {string} subpath\n * @param {readonly string[]} conditions\n * @returns {string[]}\n */\nfunction exports_targets(manifest, subpath, conditions) {\n\tconst exports = manifest?.exports;\n\tif (exports === undefined || exports === null) {\n\t\treturn [];\n\t}\n\ttry {\n\t\treturn resolveExports(\n\t\t\t/** @type {import('resolve-pkg-maps').PathConditions} */ (exports),\n\t\t\tsubpath,\n\t\t\tconditions,\n\t\t);\n\t} catch {\n\t\treturn [];\n\t}\n}\n\n/**\n * The file a bare specifier loads at runtime: the package's `exports` (under\n * `conditions`), else its `main`, else `index.js`, with the extension probing\n * Node's CommonJS loader applies; a subpath is resolved the same way.\n * @param {string} specifier\n * @param {string} from_dir\n * @param {{ conditions?: readonly string[], host?: ConfigHost }} [options]\n * @returns {string | undefined}\n */\nexport function resolve_package_entry(specifier, from_dir, options = {}) {\n\tconst parsed = parse_bare_specifier(specifier);\n\tif (!parsed) {\n\t\treturn undefined;\n\t}\n\tconst host = options.host ?? NODE_CONFIG_HOST;\n\tconst conditions = options.conditions ?? ['node', 'require', 'default'];\n\tfor (const package_dir of package_directories(host, from_dir, parsed.name)) {\n\t\tconst manifest = read_package_manifest(host, package_dir);\n\t\tfor (const target of exports_targets(manifest, parsed.subpath, conditions)) {\n\t\t\tconst resolved = path.resolve(package_dir, target);\n\t\t\tif (host.fileExists(resolved)) {\n\t\t\t\treturn resolved;\n\t\t\t}\n\t\t}\n\t\tif (manifest?.exports !== undefined && manifest.exports !== null) {\n\t\t\t// `exports` is authoritative: nothing else in the package is reachable.\n\t\t\tcontinue;\n\t\t}\n\t\tconst main = typeof manifest?.main === 'string' ? manifest.main : undefined;\n\t\tconst targets =\n\t\t\tparsed.subpath !== '' ? [parsed.subpath] : main !== undefined ? [main, 'index'] : ['index'];\n\t\tfor (const target of targets) {\n\t\t\tconst base = path.resolve(package_dir, target);\n\t\t\tfor (const candidate of [\n\t\t\t\tbase,\n\t\t\t\t`${base}.js`,\n\t\t\t\t`${base}.cjs`,\n\t\t\t\t`${base}.mjs`,\n\t\t\t\t`${base}.json`,\n\t\t\t\tpath.join(base, 'index.js'),\n\t\t\t]) {\n\t\t\t\tif (host.fileExists(candidate)) {\n\t\t\t\t\treturn candidate;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * The config a package directory stands for: its `package.json` `tsconfig`\n * field (with `.json` appended when the file is missing without it, as\n * TypeScript's file loader does) or its `tsconfig.json`.\n * @param {ConfigHost} host\n * @param {string} directory\n * @param {Record<string, unknown> | undefined} manifest\n * @returns {string | undefined}\n */\nfunction tsconfig_field_target(host, directory, manifest) {\n\tconst field = typeof manifest?.tsconfig === 'string' ? manifest.tsconfig : 'tsconfig.json';\n\tlet resolved = path.resolve(directory, field);\n\tif (!host.fileExists(resolved) && !resolved.endsWith('.json')) {\n\t\tresolved = `${resolved}.json`;\n\t}\n\treturn host.fileExists(resolved) ? resolved : undefined;\n}\n\n/**\n * The JSON file a `tsconfig.json` `extends` entry names. The rules and their\n * order are those of get-tsconfig's `resolveExtendsPath` (MIT, privatenumber),\n * which are tested against `tsc`:\n *\n * 1. `..` means `../tsconfig.json`; an entry starting with `.` is relative to\n * the config's directory; an absolute path is used as is. A missing path\n * without a `.json` extension gets one appended.\n * 2. Otherwise the entry names a package (`name` or `@scope/name`, plus an\n * optional subpath) found by walking `node_modules` upwards. A package with\n * `exports` is resolved only through them (conditions `require`, `types`);\n * an unexported subpath is a hard stop. Without `exports`, the package\n * root's `tsconfig` field or its `tsconfig.json` is used; a subpath is tried\n * with `.json` appended, as a `.json` file, then as a directory whose\n * `package.json` `tsconfig` field or `tsconfig.json` is the target.\n *\n * @param {string} extends_value\n * @param {string} config_dir\n * @param {ConfigHost} [host]\n * @returns {{ path: string, candidate?: string } | { path?: undefined, candidate?: string }}\n * `path` when found; `candidate` is the location TypeScript would have read\n * for a path entry, whether or not it exists (so a watcher can wait for it).\n */\nexport function resolve_extends_target(extends_value, config_dir, host = NODE_CONFIG_HOST) {\n\tlet file_path = extends_value === '..' ? path.join('..', 'tsconfig.json') : extends_value;\n\tif (file_path.startsWith('.')) {\n\t\tfile_path = path.resolve(config_dir, file_path);\n\t}\n\tif (path.isAbsolute(file_path)) {\n\t\tif (host.fileExists(file_path)) {\n\t\t\treturn { path: file_path, candidate: file_path };\n\t\t}\n\t\t// Like TypeScript, append `.json` whenever the path is not a file, even\n\t\t// when a directory of that name exists next to the JSON file.\n\t\tconst candidate = file_path.endsWith('.json') ? file_path : `${file_path}.json`;\n\t\treturn host.fileExists(candidate) ? { path: candidate, candidate } : { candidate };\n\t}\n\tconst parsed = parse_bare_specifier(extends_value);\n\tif (!parsed) {\n\t\treturn {};\n\t}\n\tfor (const found_dir of package_directories(host, config_dir, parsed.name)) {\n\t\tconst package_dir = host.realpath ? host.realpath(found_dir) : found_dir;\n\t\tconst manifest = read_package_manifest(host, package_dir);\n\t\tif (manifest?.exports !== undefined && manifest.exports !== null) {\n\t\t\tconst [target] = exports_targets(manifest, parsed.subpath, ['require', 'types']);\n\t\t\tif (target === undefined) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst resolved = path.resolve(package_dir, target);\n\t\t\treturn host.fileExists(resolved) ? { path: resolved } : {};\n\t\t}\n\t\tif (parsed.subpath === '') {\n\t\t\tconst resolved = tsconfig_field_target(host, package_dir, manifest);\n\t\t\tif (resolved !== undefined) {\n\t\t\t\treturn { path: resolved };\n\t\t\t}\n\t\t}\n\t\tconst full_path = path.join(package_dir, parsed.subpath);\n\t\tif (!full_path.endsWith('.json') && host.fileExists(`${full_path}.json`)) {\n\t\t\treturn { path: `${full_path}.json` };\n\t\t}\n\t\tif (is_directory(host, full_path)) {\n\t\t\tconst resolved = tsconfig_field_target(\n\t\t\t\thost,\n\t\t\t\tfull_path,\n\t\t\t\tread_package_manifest(host, full_path),\n\t\t\t);\n\t\t\tif (resolved !== undefined) {\n\t\t\t\treturn { path: resolved };\n\t\t\t}\n\t\t} else if (full_path.endsWith('.json') && host.fileExists(full_path)) {\n\t\t\treturn { path: full_path };\n\t\t}\n\t}\n\treturn {};\n}\n","/**\n * A JSON-with-comments reader for `tsconfig.json` and package manifests:\n * comments and trailing commas are allowed, as TypeScript allows them. The\n * parsing is Microsoft's `jsonc-parser` (the same scanner VS Code and\n * get-tsconfig use), so what parses here parses there.\n */\n\n// The ESM build: the package's UMD `main` requires its `./impl/*` files at run\n// time, which the bundles of the mapper, the language server and the VS Code\n// extension cannot follow (the package has no `exports` map, so the path is\n// public).\n// A runtime dependency of every package that bundles this module (the mapper,\n// the language server, the VS Code extension): its UMD entry requires its\n// `./impl/*` files at run time, which a bundle cannot follow.\nimport { parse, printParseErrorCode } from 'jsonc-parser';\n\n/**\n * @typedef {object} JsoncParseResult\n * @property {unknown} value `undefined` when the text does not parse.\n * @property {{ message: string, offset: number }} [error] The first parse error.\n */\n\n/**\n * @param {string} text\n * @returns {JsoncParseResult}\n */\nexport function parse_jsonc(text) {\n\tconst source = text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;\n\tif (source.trim() === '') {\n\t\t// An empty config file is an empty object, as for TypeScript.\n\t\treturn { value: {} };\n\t}\n\t/** @type {import('jsonc-parser').ParseError[]} */\n\tconst errors = [];\n\tconst value = parse(source, errors, { allowTrailingComma: true, disallowComments: false });\n\tif (errors.length > 0) {\n\t\tconst [first] = errors;\n\t\treturn {\n\t\t\tvalue: undefined,\n\t\t\terror: {\n\t\t\t\tmessage: `${printParseErrorCode(first.error)} at offset ${first.offset}`,\n\t\t\t\toffset: first.offset,\n\t\t\t},\n\t\t};\n\t}\n\treturn { value };\n}\n","import path from 'node:path';\nimport { parse_jsonc } from './jsonc.js';\nimport { resolve_extends_target } from './package-resolution.js';\n\n/**\n * What the tooling needs from a file system to read tsconfig files: the\n * subset of TypeScript's `sys` that `config-host.js` also provides on\n * `node:fs`, so no TypeScript is needed to resolve a config chain.\n * @typedef {object} TsconfigHost\n * @property {(file_name: string) => boolean} fileExists\n * @property {(file_name: string) => string | undefined} readFile\n * @property {boolean | (() => boolean)} useCaseSensitiveFileNames\n * @property {(file_name: string) => Date | undefined} [getModifiedTime]\n */\n\n/**\n * A problem reading or resolving a config file. `code` follows TypeScript's\n * numbering for the cases it has one for (5024 invalid `extends` entry,\n * 6053 file not found, 18000 circular `extends`), so callers that filter on\n * codes keep working on both paths.\n * @typedef {object} TsconfigDiagnostic\n * @property {number} code\n * @property {string} message\n * @property {string} [file] The config file the problem is in.\n */\n\n/**\n * @typedef {object} TsconfigLayer\n * @property {string} path\n * @property {string} dir\n * @property {Record<string, unknown>} config\n * @property {string | undefined} raw_source\n * @property {TsconfigDiagnostic[]} parse_diagnostics\n */\n\n/** @typedef {TsconfigLayer & { extends_values: unknown[] }} ParsedTsconfigLayer */\n\n/**\n * @typedef {object} TsconfigExtendsFailure\n * @property {string} config_path\n * @property {unknown} extends_value\n * @property {string | undefined} resolved_path\n * @property {TsconfigDiagnostic[]} diagnostics\n */\n\n/**\n * @typedef {object} ResolvedTsconfigLayers\n * @property {TsconfigLayer[]} layers\n * @property {string[]} dependencies\n * @property {TsconfigDiagnostic[]} diagnostics\n * @property {TsconfigExtendsFailure[]} extends_failures\n */\n\n/**\n * @template TValue\n * @typedef {{state: 'absent'} | {state: 'found', value: TValue}} ConfigValueResult\n */\n\n/** @typedef {{config_path: string, config_dir: string}} TsconfigValueOrigin */\n\nexport const INVALID_EXTENDS_DIAGNOSTIC_CODE = 5024;\nexport const FILE_NOT_FOUND_DIAGNOSTIC_CODE = 6053;\nexport const CIRCULARITY_DIAGNOSTIC_CODE = 18000;\nconst PARSE_ERROR_DIAGNOSTIC_CODE = 1005;\n\n/**\n * Load a tsconfig and its explicit inheritance graph from lowest to highest\n * precedence. Parsed files are cached, but traversal intentionally does not\n * deduplicate layers because a shared base must be reapplied in every branch.\n * `extends` entries follow TypeScript's rules (see `resolve_extends_target`).\n *\n * @param {TsconfigHost} host\n * @param {string} config_file_name\n * @returns {ResolvedTsconfigLayers}\n */\nexport function load_tsconfig_layers(host, config_file_name) {\n\t/** @type {Map<string, ParsedTsconfigLayer>} */\n\tconst parsed_file_cache = new Map();\n\t/** @type {TsconfigLayer[]} */\n\tconst layers = [];\n\t/** @type {string[]} */\n\tconst dependencies = [];\n\tconst dependency_keys = new Set();\n\t/** @type {TsconfigDiagnostic[]} */\n\tconst diagnostics = [];\n\t/** @type {TsconfigExtendsFailure[]} */\n\tconst extends_failures = [];\n\tconst diagnostic_keys = new Set();\n\t/** The chain of configs being visited, root first, for cycle reporting. */\n\t/** @type {string[]} */\n\tconst active_stack = [];\n\tconst active_keys = new Set();\n\tconst use_case_sensitive_file_names =\n\t\ttypeof host.useCaseSensitiveFileNames === 'function'\n\t\t\t? host.useCaseSensitiveFileNames()\n\t\t\t: host.useCaseSensitiveFileNames;\n\n\t/** @param {string} file_name */\n\tfunction normalize_path(file_name) {\n\t\treturn path.normalize(path.resolve(file_name));\n\t}\n\n\t/** @param {string} file_name */\n\tfunction get_path_key(file_name) {\n\t\tconst normalized_path = normalize_path(file_name);\n\t\treturn use_case_sensitive_file_names ? normalized_path : normalized_path.toLowerCase();\n\t}\n\n\t/** @param {TsconfigDiagnostic[]} next_diagnostics */\n\tfunction add_diagnostics(next_diagnostics) {\n\t\tfor (const diagnostic of next_diagnostics) {\n\t\t\tconst key = `${diagnostic.code}\\0${diagnostic.file ?? ''}\\0${diagnostic.message}`;\n\t\t\tif (!diagnostic_keys.has(key)) {\n\t\t\t\tdiagnostic_keys.add(key);\n\t\t\t\tdiagnostics.push(diagnostic);\n\t\t\t}\n\t\t}\n\t}\n\n\t/** @param {string} file_name */\n\tfunction add_dependency(file_name) {\n\t\tconst normalized_path = normalize_path(file_name);\n\t\tconst key = get_path_key(normalized_path);\n\t\tif (!dependency_keys.has(key)) {\n\t\t\tdependency_keys.add(key);\n\t\t\tdependencies.push(normalized_path);\n\t\t}\n\t}\n\n\t/** @param {string} file_name */\n\tfunction parse_file(file_name) {\n\t\tconst normalized_path = normalize_path(file_name);\n\t\tconst key = get_path_key(normalized_path);\n\t\tconst cached = parsed_file_cache.get(key);\n\t\tif (cached) {\n\t\t\treturn cached;\n\t\t}\n\n\t\tconst raw_source = host.readFile(normalized_path);\n\t\t/** @type {TsconfigDiagnostic[]} */\n\t\tconst parse_diagnostics = [];\n\t\t/** @type {Record<string, unknown>} */\n\t\tlet config = {};\n\t\tif (raw_source !== undefined) {\n\t\t\tconst parsed = parse_jsonc(raw_source);\n\t\t\tif (parsed.error) {\n\t\t\t\tparse_diagnostics.push({\n\t\t\t\t\tcode: PARSE_ERROR_DIAGNOSTIC_CODE,\n\t\t\t\t\tmessage: `Failed to parse ${normalized_path}: ${parsed.error.message}`,\n\t\t\t\t\tfile: normalized_path,\n\t\t\t\t});\n\t\t\t} else if (\n\t\t\t\tparsed.value !== null &&\n\t\t\t\ttypeof parsed.value === 'object' &&\n\t\t\t\t!Array.isArray(parsed.value)\n\t\t\t) {\n\t\t\t\tconfig = /** @type {Record<string, unknown>} */ (parsed.value);\n\t\t\t} else {\n\t\t\t\tparse_diagnostics.push({\n\t\t\t\t\tcode: PARSE_ERROR_DIAGNOSTIC_CODE,\n\t\t\t\t\tmessage: `The root value of ${normalized_path} must be an object.`,\n\t\t\t\t\tfile: normalized_path,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tconst extends_value = config.extends;\n\t\tconst extends_values = Array.isArray(extends_value)\n\t\t\t? extends_value\n\t\t\t: extends_value !== undefined\n\t\t\t\t? [extends_value]\n\t\t\t\t: [];\n\t\tconst parsed = {\n\t\t\tpath: normalized_path,\n\t\t\tdir: path.dirname(normalized_path),\n\t\t\tconfig,\n\t\t\traw_source,\n\t\t\tparse_diagnostics,\n\t\t\textends_values,\n\t\t};\n\t\tparsed_file_cache.set(key, parsed);\n\t\tadd_diagnostics(parse_diagnostics);\n\t\treturn parsed;\n\t}\n\n\t/**\n\t * Resolve one immediate extends entry. The conventional JSON candidate of an\n\t * unresolved relative entry is still recorded as a dependency so creating it\n\t * later invalidates caches and language-server projects.\n\t * @param {ParsedTsconfigLayer} parsed\n\t * @param {unknown} extends_value\n\t */\n\tfunction resolve_extends_path(parsed, extends_value) {\n\t\tif (typeof extends_value !== 'string') {\n\t\t\tconst diagnostic = {\n\t\t\t\tcode: INVALID_EXTENDS_DIAGNOSTIC_CODE,\n\t\t\t\tmessage: `Compiler option 'extends' requires a value of type string.`,\n\t\t\t\tfile: parsed.path,\n\t\t\t};\n\t\t\tadd_diagnostics([diagnostic]);\n\t\t\textends_failures.push({\n\t\t\t\tconfig_path: parsed.path,\n\t\t\t\textends_value,\n\t\t\t\tresolved_path: undefined,\n\t\t\t\tdiagnostics: [diagnostic],\n\t\t\t});\n\t\t\treturn undefined;\n\t\t}\n\t\tconst target = resolve_extends_target(extends_value, parsed.dir, host);\n\t\tconst dependency_path = target.path ?? target.candidate;\n\t\tif (dependency_path !== undefined) {\n\t\t\tadd_dependency(dependency_path);\n\t\t}\n\t\tif (target.path === undefined) {\n\t\t\tconst diagnostic = {\n\t\t\t\tcode: FILE_NOT_FOUND_DIAGNOSTIC_CODE,\n\t\t\t\tmessage: `File '${target.candidate ?? extends_value}' not found.`,\n\t\t\t\tfile: parsed.path,\n\t\t\t};\n\t\t\tadd_diagnostics([diagnostic]);\n\t\t\textends_failures.push({\n\t\t\t\tconfig_path: parsed.path,\n\t\t\t\textends_value,\n\t\t\t\tresolved_path: dependency_path,\n\t\t\t\tdiagnostics: [diagnostic],\n\t\t\t});\n\t\t\treturn undefined;\n\t\t}\n\t\tif (active_keys.has(get_path_key(target.path))) {\n\t\t\tconst chain = [...active_stack, normalize_path(target.path)];\n\t\t\tconst diagnostic = {\n\t\t\t\tcode: CIRCULARITY_DIAGNOSTIC_CODE,\n\t\t\t\tmessage: `Circularity detected while resolving configuration: ${chain.join(' -> ')}`,\n\t\t\t\tfile: parsed.path,\n\t\t\t};\n\t\t\tadd_diagnostics([diagnostic]);\n\t\t\textends_failures.push({\n\t\t\t\tconfig_path: parsed.path,\n\t\t\t\textends_value,\n\t\t\t\tresolved_path: dependency_path,\n\t\t\t\tdiagnostics: [diagnostic],\n\t\t\t});\n\t\t\treturn undefined;\n\t\t}\n\t\treturn target.path;\n\t}\n\n\t/** @param {string} file_name */\n\tfunction visit(file_name) {\n\t\tconst normalized_path = normalize_path(file_name);\n\t\tconst key = get_path_key(normalized_path);\n\t\tactive_keys.add(key);\n\t\tactive_stack.push(normalized_path);\n\t\tadd_dependency(normalized_path);\n\t\tconst parsed = parse_file(normalized_path);\n\t\tfor (const extends_value of parsed.extends_values) {\n\t\t\tconst extended_path = resolve_extends_path(parsed, extends_value);\n\t\t\tif (extended_path !== undefined) {\n\t\t\t\tvisit(extended_path);\n\t\t\t}\n\t\t}\n\t\tlayers.push({\n\t\t\tpath: parsed.path,\n\t\t\tdir: parsed.dir,\n\t\t\tconfig: parsed.config,\n\t\t\traw_source: parsed.raw_source,\n\t\t\tparse_diagnostics: parsed.parse_diagnostics,\n\t\t});\n\t\tactive_stack.pop();\n\t\tactive_keys.delete(key);\n\t}\n\n\tvisit(config_file_name);\n\treturn { layers, dependencies, diagnostics, extends_failures };\n}\n\n/**\n * Read a nested config value only when every segment is an own property.\n *\n * @param {unknown} config\n * @param {readonly PropertyKey[]} path_parts\n * @returns {ConfigValueResult<unknown>}\n */\nexport function get_own_config_value(config, path_parts) {\n\tlet current = config;\n\tfor (const path_part of path_parts) {\n\t\tif (\n\t\t\tcurrent === null ||\n\t\t\t(typeof current !== 'object' && typeof current !== 'function') ||\n\t\t\t!Object.prototype.hasOwnProperty.call(current, path_part)\n\t\t) {\n\t\t\treturn { state: 'absent' };\n\t\t}\n\t\tcurrent = /** @type {Record<PropertyKey, unknown>} */ (current)[path_part];\n\t}\n\treturn { state: 'found', value: current };\n}\n\n/**\n * Resolve a caller-defined value across layers. The last result whose state is\n * not absent wins and is annotated with the config that declared it.\n *\n * @template {{state: string}} TResult\n * @param {readonly TsconfigLayer[]} layers\n * @param {(layer: TsconfigLayer) => TResult} read_layer\n * @returns {{state: 'absent'} | (TResult & TsconfigValueOrigin)}\n */\nexport function resolve_inherited_config_value(layers, read_layer) {\n\t/** @type {{state: 'absent'} | (TResult & TsconfigValueOrigin)} */\n\tlet resolved = { state: 'absent' };\n\tfor (const layer of layers) {\n\t\tconst value = read_layer(layer);\n\t\tif (value.state !== 'absent') {\n\t\t\tresolved = {\n\t\t\t\t...value,\n\t\t\t\tconfig_path: layer.path,\n\t\t\t\tconfig_dir: layer.dir,\n\t\t\t};\n\t\t}\n\t}\n\treturn resolved;\n}\n","export const DEBUG = process.env.TSRX_DEBUG === 'true';\n// Matches valid JS/CSS identifier characters: word chars, dashes (CSS), $, and # (TSRX shorthands)\nexport const charAllowedWordRegex = /[\\w\\-$#]/;\n\n/**\n * Create a logging utility with a specific label\n * @param {string} label\n * @returns {{\n * \tlog: (...args: unknown[]) => void,\n * \tlogError: (...args: unknown[]) => void,\n * \tlogWarning: (...args: unknown[]) => void,\n * }}\n */\nexport function createLogging(label) {\n\treturn {\n\t\tlog(...args) {\n\t\t\tif (DEBUG) {\n\t\t\t\tconsole.log(label, ...args);\n\t\t\t}\n\t\t},\n\t\tlogError(...args) {\n\t\t\tif (DEBUG) {\n\t\t\t\tconsole.error(label, ...args);\n\t\t\t}\n\t\t},\n\t\tlogWarning(...args) {\n\t\t\tif (DEBUG) {\n\t\t\t\tconsole.warn(label, ...args);\n\t\t\t}\n\t\t},\n\t};\n}\n\n/**\n * Get the word at a specific position in the text\n * @param {string} text\n * @param {number} start\n * @returns {{word: string, start: number, end: number}}\n */\nexport function getWordFromPosition(text, start) {\n\tlet wordStart = start;\n\tlet wordEnd = start;\n\twhile (wordStart > 0 && charAllowedWordRegex.test(text[wordStart - 1])) {\n\t\twordStart--;\n\t}\n\twhile (wordEnd < text.length && charAllowedWordRegex.test(text[wordEnd])) {\n\t\twordEnd++;\n\t}\n\n\tconst word = text.substring(wordStart, wordEnd);\n\n\treturn {\n\t\tword,\n\t\tstart: wordStart,\n\t\tend: wordEnd,\n\t};\n}\n","/** @typedef {{actual_type: string, actual_value: string}} InvalidConfigValueDetails */\n/** @typedef {'web' | 'ios' | 'android'} Platform */\n/**\n * @typedef {\n * \t| {state: 'absent'}\n * \t| {state: 'declared', value: string}\n * \t| ({state: 'invalid', target: 'tsrx' | 'compiler'} & InvalidConfigValueDetails)\n * } CompilerDeclaration\n */\n\n/**\n * @typedef {\n * \t| {state: 'absent'}\n * \t| {state: 'declared', value: Platform}\n * \t| ({state: 'invalid', target: 'tsrx' | 'platform'} & InvalidConfigValueDetails)\n * } PlatformDeclaration\n */\n\n/**\n * @typedef {object} CompilerResolutionOptions\n * @property {typeof import('typescript')} [ts] Accepted for the classic callers; config resolution no longer uses it.\n * @property {string} [configFileName]\n * @property {import('./tsconfig-resolution.js').TsconfigHost} [configHost]\n * @property {Set<string>} [dependencies]\n * @property {boolean} [requirePlatformResolution]\n */\n\n/**\n * @typedef {object} ConfigHostResolutionCache\n * @property {Map<string, string | null>} nearest_config_paths\n * @property {Map<string, CachedTsconfigLayers>} resolved_config_layers\n */\n\n/**\n * @typedef {object} CachedTsconfigLayers\n * @property {import('./tsconfig-resolution.js').ResolvedTsconfigLayers} value\n * @property {Map<string, number | undefined> | undefined} dependency_modified_times\n */\n\nimport { createRequire } from 'module';\nimport path from 'path';\nimport { NODE_CONFIG_HOST } from './config-host.js';\nimport { resolve_package_entry } from './package-resolution.js';\nimport {\n\tget_own_config_value,\n\tload_tsconfig_layers,\n\tresolve_inherited_config_value,\n} from './tsconfig-resolution.js';\nimport { createLogging } from './utils.js';\n\nconst { log, logError, logWarning } = createLogging('[TSRX Language]');\n// npm scope/package names stay lowercase-strict; case-sensitive export subpaths may use capitals.\nconst bare_package_specifier_pattern =\n\t/^(?:@[a-z0-9][a-z0-9._~-]*\\/)?[a-z0-9][a-z0-9._~-]*(?:\\/[A-Za-z0-9][A-Za-z0-9._~-]*)*$/;\nconst tsrx_key_pattern = /[\"']tsrx[\"']\\s*:/;\n/** @type {WeakMap<object, ConfigHostResolutionCache>} */\nlet config_host_to_resolution_cache = new WeakMap();\n/** @type {Map<string, string | null>} */\nconst declared_compiler_path_map = new Map();\n\n/**\n * @param {unknown} value\n * @returns {{ actual_type: string, actual_value: string }}\n */\nfunction describe_config_value(value) {\n\tconst actual_type = value === null ? 'null' : Array.isArray(value) ? 'array' : typeof value;\n\treturn {\n\t\tactual_type,\n\t\tactual_value: JSON.stringify(value) ?? String(value),\n\t};\n}\n\n/**\n * Keep filesystem-derived config caches isolated per TypeScript/Volar host.\n * Different hosts can expose different snapshots for the same absolute path.\n * @param {import('./tsconfig-resolution.js').TsconfigHost} host\n */\nfunction get_config_host_cache(host) {\n\tlet cache = config_host_to_resolution_cache.get(host);\n\tif (!cache) {\n\t\tcache = {\n\t\t\tnearest_config_paths: new Map(),\n\t\t\tresolved_config_layers: new Map(),\n\t\t};\n\t\tconfig_host_to_resolution_cache.set(host, cache);\n\t}\n\treturn cache;\n}\n\n/**\n * @param {string} file_name\n * @param {import('./tsconfig-resolution.js').TsconfigHost} host\n */\nfunction get_config_cache_key(file_name, host) {\n\tconst normalized_path = path.normalize(path.resolve(file_name));\n\tconst use_case_sensitive_file_names =\n\t\ttypeof host.useCaseSensitiveFileNames === 'function'\n\t\t\t? host.useCaseSensitiveFileNames()\n\t\t\t: host.useCaseSensitiveFileNames;\n\treturn use_case_sensitive_file_names ? normalized_path : normalized_path.toLowerCase();\n}\n\n/**\n * @param {unknown} config\n * @returns {CompilerDeclaration}\n */\nfunction get_compiler_declaration(config) {\n\tconst tsrx_result = get_own_config_value(config, ['tsrx']);\n\tif (tsrx_result.state === 'absent') {\n\t\treturn { state: 'absent' };\n\t}\n\n\tconst tsrx_value = tsrx_result.value;\n\tif (tsrx_value === null || typeof tsrx_value !== 'object' || Array.isArray(tsrx_value)) {\n\t\treturn { state: 'invalid', target: 'tsrx', ...describe_config_value(tsrx_value) };\n\t}\n\tconst compiler_result = get_own_config_value(tsrx_value, ['compiler']);\n\tif (compiler_result.state === 'absent') {\n\t\treturn { state: 'absent' };\n\t}\n\n\tconst compiler = compiler_result.value;\n\tif (typeof compiler === 'string' && compiler.trim() !== '') {\n\t\treturn { state: 'declared', value: compiler.trim() };\n\t}\n\treturn { state: 'invalid', target: 'compiler', ...describe_config_value(compiler) };\n}\n\n/**\n * @param {unknown} config\n * @returns {PlatformDeclaration}\n */\nfunction get_platform_declaration(config) {\n\tconst tsrx_result = get_own_config_value(config, ['tsrx']);\n\tif (tsrx_result.state === 'absent') {\n\t\treturn { state: 'absent' };\n\t}\n\n\tconst tsrx_value = tsrx_result.value;\n\tif (tsrx_value === null || typeof tsrx_value !== 'object' || Array.isArray(tsrx_value)) {\n\t\treturn { state: 'invalid', target: 'tsrx', ...describe_config_value(tsrx_value) };\n\t}\n\tconst platform_result = get_own_config_value(tsrx_value, ['platform']);\n\tif (platform_result.state === 'absent') {\n\t\treturn { state: 'absent' };\n\t}\n\n\tconst platform = platform_result.value;\n\tif (platform === 'web' || platform === 'ios' || platform === 'android') {\n\t\treturn { state: 'declared', value: platform };\n\t}\n\treturn { state: 'invalid', target: 'platform', ...describe_config_value(platform) };\n}\n\n/**\n * Find the nearest tsconfig.json to use as the root of inheritance resolution.\n * @param {string} start_dir\n * @param {import('./tsconfig-resolution.js').TsconfigHost} host\n * @param {ConfigHostResolutionCache} cache\n * @returns {string | null}\n */\nfunction get_nearest_root_tsconfig(start_dir, host, cache) {\n\tlet current_dir = start_dir;\n\t/** @type {string[]} */\n\tconst visited_dir_keys = [];\n\n\twhile (current_dir) {\n\t\tconst current_dir_key = get_config_cache_key(current_dir, host);\n\t\tif (cache.nearest_config_paths.has(current_dir_key)) {\n\t\t\tconst cached_tsconfig = cache.nearest_config_paths.get(current_dir_key) ?? null;\n\t\t\tfor (const visited_dir_key of visited_dir_keys) {\n\t\t\t\tcache.nearest_config_paths.set(visited_dir_key, cached_tsconfig);\n\t\t\t}\n\t\t\treturn cached_tsconfig;\n\t\t}\n\n\t\tvisited_dir_keys.push(current_dir_key);\n\t\tconst tsconfig_path = path.join(current_dir, 'tsconfig.json');\n\t\tif (host.fileExists(tsconfig_path)) {\n\t\t\tfor (const visited_dir_key of visited_dir_keys) {\n\t\t\t\tcache.nearest_config_paths.set(visited_dir_key, tsconfig_path);\n\t\t\t}\n\t\t\treturn tsconfig_path;\n\t\t}\n\n\t\tconst parent_dir = path.dirname(current_dir);\n\t\tif (parent_dir === current_dir) {\n\t\t\tbreak;\n\t\t}\n\t\tcurrent_dir = parent_dir;\n\t}\n\n\tfor (const visited_dir_key of visited_dir_keys) {\n\t\tcache.nearest_config_paths.set(visited_dir_key, null);\n\t}\n\treturn null;\n}\n\n/**\n * @param {import('./tsconfig-resolution.js').TsconfigHost} host\n * @param {string} root_config_path\n * @param {ConfigHostResolutionCache} cache\n */\nfunction get_tsconfig_layers(host, root_config_path, cache) {\n\tconst cache_key = get_config_cache_key(root_config_path, host);\n\tconst cached = cache.resolved_config_layers.get(cache_key);\n\tif (\n\t\tcached &&\n\t\t(cached.dependency_modified_times === undefined ||\n\t\t\t[...cached.dependency_modified_times].every(\n\t\t\t\t([dependency, modified_time]) =>\n\t\t\t\t\thost.getModifiedTime?.(dependency)?.valueOf() === modified_time,\n\t\t\t))\n\t) {\n\t\treturn cached.value;\n\t}\n\tconst value = load_tsconfig_layers(host, root_config_path);\n\tconst dependency_modified_times = host.getModifiedTime\n\t\t? new Map(\n\t\t\t\tvalue.dependencies.map((dependency) => [\n\t\t\t\t\tdependency,\n\t\t\t\t\thost.getModifiedTime?.(dependency)?.valueOf(),\n\t\t\t\t]),\n\t\t\t)\n\t\t: undefined;\n\tcache.resolved_config_layers.set(cache_key, { value, dependency_modified_times });\n\treturn value;\n}\n\n/**\n * A declaration in the config that owns a failed extends entry, or in a child\n * config above it, has higher precedence than anything the missing base could\n * have declared and therefore makes that failure irrelevant to this value.\n * @param {readonly import('./tsconfig-resolution.js').TsconfigLayer[]} layers\n * @param {import('./tsconfig-resolution.js').TsconfigExtendsFailure} failure\n * @param {string} declaration_config_path\n */\nfunction is_extends_failure_overridden(layers, failure, declaration_config_path) {\n\tconst failure_owner_index = layers.findLastIndex((layer) => layer.path === failure.config_path);\n\tconst declaration_index = layers.findLastIndex((layer) => layer.path === declaration_config_path);\n\treturn failure_owner_index >= 0 && declaration_index >= failure_owner_index;\n}\n\n/**\n * Resolve without a module-resolution cache. This is the recovery path when\n * Node retains a negative package lookup after a dependency is installed: the\n * package walk reads every manifest fresh and resolves the runtime entry.\n * @param {import('./tsconfig-resolution.js').TsconfigHost} host\n * @param {string} config_path\n * @param {string} specifier\n */\nfunction resolve_uncached_declared_compiler(host, config_path, specifier) {\n\treturn resolve_package_entry(specifier, path.dirname(config_path), { host });\n}\n\n/**\n * Resolve the compiler explicitly selected by a consumer tsconfig. Invalid\n * specifiers are stable and cached, while missing packages are retried so\n * tsserver can recover after the dependency is installed.\n * @param {import('./tsconfig-resolution.js').TsconfigHost} host\n * @param {string} config_path\n * @param {string} specifier\n * @returns {string | null}\n */\nfunction resolve_declared_compiler(host, config_path, specifier) {\n\tconst cache_key = `${config_path}\\0${specifier}`;\n\tif (declared_compiler_path_map.has(cache_key)) {\n\t\treturn declared_compiler_path_map.get(cache_key) ?? null;\n\t}\n\n\tif (!bare_package_specifier_pattern.test(specifier)) {\n\t\tdeclared_compiler_path_map.set(cache_key, null);\n\t\tlogError(\n\t\t\t'Declared TSRX compiler must be a bare package specifier:',\n\t\t\tspecifier,\n\t\t\t`in ${config_path}`,\n\t\t);\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst tsconfig_require = createRequire(config_path);\n\t\tconst compiler_path = tsconfig_require.resolve(specifier);\n\t\tdeclared_compiler_path_map.set(cache_key, compiler_path);\n\t\tlog('Found declared tsrx compiler at:', compiler_path, 'from tsconfig:', config_path);\n\t\treturn compiler_path;\n\t} catch {\n\t\tconst compiler_path = resolve_uncached_declared_compiler(host, config_path, specifier);\n\t\tif (compiler_path !== undefined) {\n\t\t\tdeclared_compiler_path_map.set(cache_key, compiler_path);\n\t\t\tlog(\n\t\t\t\t'Found declared tsrx compiler after uncached retry at:',\n\t\t\t\tcompiler_path,\n\t\t\t\t'from tsconfig:',\n\t\t\t\tconfig_path,\n\t\t\t);\n\t\t\treturn compiler_path;\n\t\t}\n\t\tlogError(`Unable to resolve declared TSRX compiler \"${specifier}\" from tsconfig`, config_path);\n\t\treturn null;\n\t}\n}\n\n/**\n * Return undefined when there is no consumer declaration, null for a declared\n * hard stop, or the resolved compiler path for a valid declaration.\n * @param {string} normalized_file_name\n * @param {CompilerResolutionOptions} [options]\n * @returns {string | null | undefined}\n */\nexport function resolve_consumer_compiler_for_file(normalized_file_name, options = {}) {\n\tconst config_host = options.configHost ?? NODE_CONFIG_HOST;\n\tconst host_cache = get_config_host_cache(config_host);\n\tconst root_config_path =\n\t\toptions.configFileName ??\n\t\tget_nearest_root_tsconfig(path.dirname(normalized_file_name), config_host, host_cache);\n\tif (root_config_path === null) {\n\t\treturn undefined;\n\t}\n\tconst resolved_layers = get_tsconfig_layers(config_host, root_config_path, host_cache);\n\tfor (const dependency of resolved_layers.dependencies) {\n\t\toptions.dependencies?.add(dependency);\n\t}\n\tconst unreadable_layers = resolved_layers.layers.filter(\n\t\t(layer) => layer.raw_source === undefined,\n\t);\n\tif (unreadable_layers.length > 0) {\n\t\tfor (const layer of unreadable_layers) {\n\t\t\tlogError('Unable to read tsconfig layer:', layer.path);\n\t\t}\n\t\treturn null;\n\t}\n\tconst malformed_layers = resolved_layers.layers.filter(\n\t\t(layer) => layer.parse_diagnostics.length > 0,\n\t);\n\tif (malformed_layers.length > 0) {\n\t\tconst has_tsrx_intent = resolved_layers.layers.some((layer) => {\n\t\t\tif (get_own_config_value(layer.config, ['tsrx']).state === 'found') {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (layer.parse_diagnostics.length === 0 || layer.raw_source === undefined) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// A comment can cause a false positive and hard stop; that fails safe when\n\t\t\t// an unparseable layer may have declared a compiler.\n\t\t\treturn tsrx_key_pattern.test(layer.raw_source);\n\t\t});\n\t\tconst log_parse_error = has_tsrx_intent ? logError : logWarning;\n\t\tfor (const layer of malformed_layers) {\n\t\t\tfor (const diagnostic of layer.parse_diagnostics) {\n\t\t\t\tlog_parse_error('Unable to parse tsconfig layer:', layer.path, diagnostic.message);\n\t\t\t}\n\t\t}\n\t\treturn has_tsrx_intent ? null : undefined;\n\t}\n\tconst declaration = resolve_inherited_config_value(resolved_layers.layers, (layer) =>\n\t\tget_compiler_declaration(layer.config),\n\t);\n\tif (declaration.state === 'invalid') {\n\t\tlogError(\n\t\t\t`Invalid TSRX ${declaration.target} declaration:`,\n\t\t\tdeclaration.actual_type,\n\t\t\tdeclaration.actual_value,\n\t\t\t`in ${declaration.config_path}`,\n\t\t);\n\t\treturn null;\n\t}\n\tconst effective_extends_failures = resolved_layers.extends_failures.filter(\n\t\t(failure) =>\n\t\t\tdeclaration.state !== 'declared' ||\n\t\t\t!is_extends_failure_overridden(resolved_layers.layers, failure, declaration.config_path),\n\t);\n\tif (effective_extends_failures.length > 0) {\n\t\tfor (const failure of effective_extends_failures) {\n\t\t\tif (failure.diagnostics.length === 0) {\n\t\t\t\tlogError(\n\t\t\t\t\t'Unable to resolve tsconfig extends entry:',\n\t\t\t\t\tJSON.stringify(failure.extends_value),\n\t\t\t\t\t`in ${failure.config_path}`,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor (const diagnostic of failure.diagnostics) {\n\t\t\t\tlogError(\n\t\t\t\t\t'Unable to resolve tsconfig extends entry:',\n\t\t\t\t\tJSON.stringify(failure.extends_value),\n\t\t\t\t\t`in ${failure.config_path}`,\n\t\t\t\t\tdiagnostic.message,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\tif (declaration.state === 'declared') {\n\t\treturn resolve_declared_compiler(config_host, declaration.config_path, declaration.value);\n\t}\n\treturn undefined;\n}\n\n/**\n * Resolve the compile-time platform selected by the active TypeScript project.\n * The same inheritance graph and dependency tracking as compiler selection are\n * used so nested projects and config edits cannot silently drift.\n *\n * @param {string} normalized_file_name\n * @param {CompilerResolutionOptions} [options]\n * @returns {Platform | undefined}\n */\nexport function resolve_consumer_platform_for_file(normalized_file_name, options = {}) {\n\tconst config_host = options.configHost ?? NODE_CONFIG_HOST;\n\tconst host_cache = get_config_host_cache(config_host);\n\tconst root_config_path =\n\t\toptions.configFileName ??\n\t\tget_nearest_root_tsconfig(path.dirname(normalized_file_name), config_host, host_cache);\n\tif (root_config_path === null) {\n\t\treturn undefined;\n\t}\n\n\tconst resolved_layers = get_tsconfig_layers(config_host, root_config_path, host_cache);\n\tfor (const dependency of resolved_layers.dependencies) {\n\t\toptions.dependencies?.add(dependency);\n\t}\n\n\tconst unreadable_layer = resolved_layers.layers.find((layer) => layer.raw_source === undefined);\n\tif (unreadable_layer) {\n\t\tconst message = `Unable to read tsconfig layer while resolving TSRX platform: ${unreadable_layer.path}`;\n\t\tlogError(message);\n\t\tthrow new Error(message);\n\t}\n\n\tconst malformed_layers = resolved_layers.layers.filter(\n\t\t(layer) => layer.parse_diagnostics.length > 0,\n\t);\n\tif (malformed_layers.length > 0) {\n\t\tconst has_tsrx_intent = resolved_layers.layers.some((layer) => {\n\t\t\tif (get_own_config_value(layer.config, ['tsrx']).state === 'found') return true;\n\t\t\treturn (\n\t\t\t\tlayer.parse_diagnostics.length > 0 &&\n\t\t\t\tlayer.raw_source !== undefined &&\n\t\t\t\ttsrx_key_pattern.test(layer.raw_source)\n\t\t\t);\n\t\t});\n\t\tif (!has_tsrx_intent) return undefined;\n\n\t\tconst layer = malformed_layers[0];\n\t\tconst detail = layer.parse_diagnostics[0].message;\n\t\tconst message = `Unable to parse tsconfig layer while resolving TSRX platform: ${layer.path}: ${detail}`;\n\t\tlogError(message);\n\t\tthrow new Error(message);\n\t}\n\n\tconst declaration = resolve_inherited_config_value(resolved_layers.layers, (layer) =>\n\t\tget_platform_declaration(layer.config),\n\t);\n\tif (declaration.state === 'invalid') {\n\t\tconst expected =\n\t\t\tdeclaration.target === 'platform' ? ' Expected \"web\", \"ios\", or \"android\".' : '';\n\t\tconst message = `Invalid TSRX ${declaration.target} declaration: ${declaration.actual_type} ${declaration.actual_value} in ${declaration.config_path}.${expected}`;\n\t\tlogError(message);\n\t\tthrow new TypeError(message);\n\t}\n\n\tconst effective_extends_failures = resolved_layers.extends_failures.filter(\n\t\t(failure) =>\n\t\t\tdeclaration.state !== 'declared' ||\n\t\t\t!is_extends_failure_overridden(resolved_layers.layers, failure, declaration.config_path),\n\t);\n\tif (effective_extends_failures.length > 0) {\n\t\t// An unresolved lower-precedence config must not break a file that does not\n\t\t// use platform flags. Known declarations are still validated above. When a\n\t\t// flag is present, the caller requests a complete graph so an unknown base\n\t\t// cannot silently choose the wrong branch.\n\t\tif (!options.requirePlatformResolution) {\n\t\t\treturn declaration.state === 'declared' ? declaration.value : undefined;\n\t\t}\n\t\tconst failure = effective_extends_failures[0];\n\t\tconst detail = failure.diagnostics.length > 0 ? `: ${failure.diagnostics[0].message}` : '';\n\t\tconst message = `Unable to resolve tsconfig extends entry ${JSON.stringify(failure.extends_value)} in ${failure.config_path} while resolving TSRX platform${detail}`;\n\t\tlogError(message);\n\t\tthrow new Error(message);\n\t}\n\n\treturn declaration.state === 'declared' ? declaration.value : undefined;\n}\n\n/** Drop all filesystem-derived consumer compiler resolution state. */\nexport function reset_consumer_compiler_resolution_caches() {\n\tconfig_host_to_resolution_cache = new WeakMap();\n\tdeclared_compiler_path_map.clear();\n}\n","/** @import * as AST from 'estree'; */\n/** @import {CompileError, VolarMappingsResult, CodeMapping} from '@tsrx/core/types' */\n\n/**\n * The compiler contract every TSRX target exposes for editor tooling. Octane\n * and consumer-declared modules may spell the entry `compileToVolarMappings`;\n * see `normalize_tsrx_compiler_module` in `language.js`.\n * @typedef {{\n * \tcompile?: (source: string, filename: string, options?: TsrxTransformOptions) => { code?: string, errors?: CompileError[] },\n * \tcompile_to_volar_mappings(source: string, filename: string, options?: { loose?: boolean } & TsrxTransformOptions): VolarMappingsResult,\n * }} TSRXCompilerModule\n */\n\n/**\n * @typedef {object} TsrxTransformOptions\n * @property {'web' | 'ios' | 'android'} [platform] Platform selected for `import.meta.env.platform` flags.\n */\n\n/**\n * A `<style>` or `<script>` body inside a `.tsrx` file, located by source\n * offset. Both region kinds map 1:1 onto their source text.\n * @typedef {object} EmbeddedRegion\n * @property {string} id Stable id, e.g. `style_0` / `script_0`.\n * @property {number} start Source offset of the first character of the body.\n * @property {number} length Body length in UTF-16 code units.\n * @property {string} content The body text.\n */\n\n/**\n * The type-only transform of one `.tsrx` file, free of any Volar or\n * TypeScript-host types so that both the classic Volar language plugin and the\n * TypeScript 7 content mapper can consume it.\n *\n * `fatalError` is set when the compiler threw: `text` is then `''`,\n * `mappings` is empty and `sourceAst` is `null`. Otherwise `text` is the\n * generated TSX, `mappings` maps it back to the source, `errors` holds the\n * non-fatal (usage) diagnostics and the regions describe the embedded\n * `<style>` / `<script>` bodies.\n * @typedef {object} TsrxTransformResult\n * @property {string} text\n * @property {CodeMapping[]} mappings\n * @property {EmbeddedRegion[]} cssRegions\n * @property {EmbeddedRegion[]} scriptRegions\n * @property {CompileError[]} errors\n * @property {CompileError | null} fatalError\n * @property {AST.Program | null} sourceAst\n */\n\n/**\n * Run a TSRX compiler's type-only transform in loose mode.\n *\n * Pure with respect to its inputs: the compiler module is the only\n * collaborator, no caches are consulted and nothing is logged.\n * @param {TSRXCompilerModule} compiler\n * @param {string} file_name\n * @param {string} content\n * @param {TsrxTransformOptions} [options]\n * @returns {TsrxTransformResult}\n */\nexport function transform_tsrx(compiler, file_name, content, options = {}) {\n\t/** @type {VolarMappingsResult} */\n\tlet transpiled;\n\ttry {\n\t\ttranspiled = compiler.compile_to_volar_mappings(content, file_name, {\n\t\t\tloose: true,\n\t\t\tplatform: options.platform,\n\t\t});\n\t} catch (e) {\n\t\tconst error = /** @type {CompileError} */ (e);\n\t\terror.type = 'fatal';\n\t\treturn {\n\t\t\ttext: '',\n\t\t\tmappings: [],\n\t\t\tcssRegions: [],\n\t\t\tscriptRegions: [],\n\t\t\terrors: [],\n\t\t\tfatalError: error,\n\t\t\tsourceAst: null,\n\t\t};\n\t}\n\n\tconst scriptRegions = regions_from_mappings(transpiled.scriptMappings ?? []);\n\tconst embedded = embed_script_bodies(\n\t\tblank_script_bodies(transpiled.code ?? '', scriptRegions),\n\t\ttranspiled.mappings ?? [],\n\t\tscriptRegions,\n\t);\n\treturn {\n\t\ttext: embedded.text,\n\t\tmappings: embedded.mappings,\n\t\tcssRegions: regions_from_mappings(transpiled.cssMappings ?? []),\n\t\tscriptRegions,\n\t\terrors: transpiled.errors ?? [],\n\t\tfatalError: null,\n\t\tsourceAst: transpiled.sourceAst ?? null,\n\t};\n}\n\n/**\n * The mapping data of a `<script>` body embedded in the generated TSX: every\n * language feature except formatting, exactly like the compiler's own spans.\n */\nconst SCRIPT_BODY_MAPPING_DATA = {\n\tverification: true,\n\tcompletion: true,\n\tsemantic: true,\n\tnavigation: true,\n\tstructure: true,\n\tformat: false,\n\tcustomData: {},\n};\n\n/**\n * `import` declarations at the top level of a `<script>` body, by offset. A\n * conservative statement scanner (a line starting with `import`, up to the\n * module specifier and optional attributes) rather than a parser: the body is\n * plain TypeScript and the transform has no TypeScript parser of its own.\n */\nconst IMPORT_DECLARATION =\n\t/^[ \\t]*import\\s+(?:type\\s+)?(?:(?:[\\w$]+\\s*,\\s*)?(?:\\{[^}]*\\}|\\*\\s+as\\s+[\\w$]+|[\\w$]+)\\s+from\\s+)?(['\"])[^'\"\\n]*\\1(?:\\s+with\\s*\\{[^}]*\\})?[ \\t]*;?/gm;\n\n/**\n * Whole export statements that carry no declaration: re-exports\n * (`export ... from '...'`), local export lists (`export { a as b };`),\n * `export type { T };` and `export = x;`. Module-level syntax with nothing to\n * export from an inline script, blanked entirely.\n */\nconst EXPORT_STATEMENT =\n\t/^[ \\t]*export\\s+(?:type\\s+)?(?:(?:\\{[^}]*\\}|\\*(?:\\s+as\\s+[\\w$]+)?)(?:\\s+from\\s+(['\"])[^'\"\\n]*\\1(?:\\s+with\\s*\\{[^}]*\\})?)?|=\\s*[^;\\n]*)[ \\t]*;?/gm;\n\n/**\n * `export default` in front of a named function or class declaration: only the\n * keywords are blanked, so the declaration keeps its name in the block's scope.\n */\nconst EXPORT_DEFAULT_NAMED =\n\t/^([ \\t]*)(export[ \\t]+default[ \\t]+)(?=(?:async[ \\t]+)?function[ \\t]*\\*?[ \\t]*[A-Za-z_$]|(?:abstract[ \\t]+)?class[ \\t]+(?!(?:extends|implements)\\b)[A-Za-z_$])/gm;\n\n/**\n * `export default` in front of an expression, an anonymous function or an\n * anonymous class: replaced by a same-length `const <name>=` so the rest stays\n * a valid, checked initializer (an anonymous `function () {}` or `class {}` is\n * only valid as an expression).\n */\nconst EXPORT_DEFAULT = /^([ \\t]*)(export[ \\t]+default[ \\t]+)(?=\\S)/gm;\n\n/** The `export` keyword in front of a declaration. */\nconst EXPORT_KEYWORD =\n\t/^([ \\t]*)(export[ \\t]+)(?=(?:async[ \\t]+)?(?:const|let|var|function|class|type|interface|enum|abstract|declare|namespace|module)\\b)/gm;\n\n/**\n * A `<script type=\"module\">` body may `export`, but nothing can import an inline\n * script, so its exports are dead and a block cannot hold them: statements that\n * only export are blanked, `export default` becomes a same-length `const`\n * binding, and the keyword in front of a declaration is blanked, keeping every\n * length so the body's mapping stays one to one.\n * @param {string} body\n * @returns {string}\n */\nexport function blank_export_syntax(body) {\n\treturn body\n\t\t.replace(EXPORT_STATEMENT, (statement) => statement.replace(/[^\\r\\n]/g, ' '))\n\t\t.replace(\n\t\t\tEXPORT_DEFAULT_NAMED,\n\t\t\t(_match, indent, keywords) => indent + ' '.repeat(keywords.length),\n\t\t)\n\t\t.replace(EXPORT_DEFAULT, (_match, indent, keywords) => {\n\t\t\t// `const ` + name + `=` must be exactly as long as the keywords (15+ chars).\n\t\t\tconst name = '_default'.padEnd(keywords.length - 'const '.length - '='.length, '_');\n\t\t\treturn `${indent}const ${name}=`;\n\t\t})\n\t\t.replace(EXPORT_KEYWORD, (_match, indent, keyword) => indent + ' '.repeat(keyword.length));\n}\n\n/**\n * @param {string} body\n * @returns {Array<{ start: number, end: number }>}\n */\nexport function find_import_declarations(body) {\n\t/** @type {Array<{ start: number, end: number }>} */\n\tconst imports = [];\n\tfor (const match of body.matchAll(IMPORT_DECLARATION)) {\n\t\tconst start = match.index + match[0].length - match[0].trimStart().length;\n\t\timports.push({ start, end: match.index + match[0].length });\n\t}\n\treturn imports;\n}\n\n/**\n * Append every `<script>` body to the generated TSX as a block statement, so\n * TypeScript checks it in the same file as the component, on every path that\n * consumes the transform (the language server, tsserver through the plugin, and\n * the content mapper), with ordinary mappings back to the source. A block keeps\n * one body's declarations from colliding with another's or with the\n * component's, and contributes nothing to declaration output.\n *\n * `import` declarations cannot live in a block, so each body's imports are\n * hoisted verbatim in front of its block, at module level, where TypeScript\n * resolves them like any other import (a browser-only URL in a\n * `<script type=\"module\">` yields a mapped \"cannot find module\"); their place\n * in the block is blanked. `export` syntax is blanked in place\n * ({@link blank_export_syntax}). Top-level `await` is legal inside a block of a\n * module and stays as written. Each body maps in one multi-segment mapping.\n * @param {string} text\n * @param {CodeMapping[]} mappings\n * @param {EmbeddedRegion[]} script_regions\n * @returns {{ text: string, mappings: CodeMapping[] }}\n */\nexport function embed_script_bodies(text, mappings, script_regions) {\n\tconst result_mappings = [...mappings];\n\tfor (const region of script_regions) {\n\t\tif (region.length === 0 || region.content.length !== region.length) continue;\n\t\tconst imports = find_import_declarations(region.content);\n\t\t/** @type {number[]} */\n\t\tconst sourceOffsets = [];\n\t\t/** @type {number[]} */\n\t\tconst generatedOffsets = [];\n\t\t/** @type {number[]} */\n\t\tconst lengths = [];\n\n\t\tlet hoisted = '';\n\t\tlet body = blank_export_syntax(region.content);\n\t\tfor (const { start, end } of imports) {\n\t\t\tsourceOffsets.push(region.start + start);\n\t\t\tgeneratedOffsets.push(text.length + 1 + hoisted.length);\n\t\t\tlengths.push(end - start);\n\t\t\thoisted += region.content.slice(start, end) + '\\n';\n\t\t\tbody = body.slice(0, start) + ' '.repeat(end - start) + body.slice(end);\n\t\t}\n\t\tconst block_prefix = `\\n${hoisted};{\\n`;\n\t\tconst body_offset = text.length + block_prefix.length;\n\t\tlet cursor = 0;\n\t\tfor (const { start, end } of [...imports, { start: region.length, end: region.length }]) {\n\t\t\tif (start > cursor) {\n\t\t\t\tsourceOffsets.push(region.start + cursor);\n\t\t\t\tgeneratedOffsets.push(body_offset + cursor);\n\t\t\t\tlengths.push(start - cursor);\n\t\t\t}\n\t\t\tcursor = end;\n\t\t}\n\t\ttext += `${block_prefix}${body}\\n}\\n`;\n\t\tif (sourceOffsets.length > 0) {\n\t\t\tresult_mappings.push({\n\t\t\t\tsourceOffsets,\n\t\t\t\tgeneratedOffsets,\n\t\t\t\tlengths,\n\t\t\t\tgeneratedLengths: [...lengths],\n\t\t\t\tdata: { ...SCRIPT_BODY_MAPPING_DATA, customData: { embeddedId: region.id } },\n\t\t\t});\n\t\t}\n\t}\n\treturn { text, mappings: result_mappings };\n}\n\n/**\n * Blank every `<script>` body in the generated TSX, keeping its length and\n * line breaks. The compilers copy the body verbatim into the JSX text of the\n * `<script>` element, where a `<` (as in `1 < 2`) parses as a tag and yields a\n * syntax error that only the Volar path used to hide (it drops diagnostics\n * with no source mapping; the content-mapper protocol reports them). The body\n * is type-checked as a block appended by {@link embed_script_bodies}, and no\n * mapping of the generated TSX points into the copy in the JSX text\n * (`regions_from_mappings`), so blanking it loses nothing. A body is located by its text followed by the closing tag; a body\n * that is not found unchanged in the output is left alone.\n * @param {string} text\n * @param {EmbeddedRegion[]} script_regions\n * @returns {string}\n */\nexport function blank_script_bodies(text, script_regions) {\n\tlet cursor = 0;\n\tfor (const region of script_regions) {\n\t\tif (region.length === 0) continue;\n\t\tconst needle = `${region.content}</script>`;\n\t\tconst index = text.indexOf(needle, cursor);\n\t\tif (index < 0) continue;\n\t\tconst blank = region.content.replace(/[^\\r\\n]/g, ' ');\n\t\ttext = text.slice(0, index) + blank + text.slice(index + region.content.length);\n\t\tcursor = index + needle.length;\n\t}\n\treturn text;\n}\n\n/**\n * @param {CodeMapping[]} mappings\n * @returns {EmbeddedRegion[]}\n */\nfunction regions_from_mappings(mappings) {\n\treturn mappings.map((mapping) => ({\n\t\tid: String(mapping.data?.customData?.embeddedId ?? ''),\n\t\tstart: mapping.sourceOffsets[0],\n\t\tlength: mapping.lengths[0],\n\t\tcontent: String(mapping.data?.customData?.content ?? ''),\n\t}));\n}\n\n/**\n * Extract raw `<style>...</style>` bodies from source text, used as a fallback\n * for CSS intellisense while the file has a fatal compile error (no AST\n * available; the normal path derives regions from the compiler's\n * `cssMappings` instead).\n *\n * The opening-tag pattern is attribute-aware: a `>` inside a quoted value or an\n * `{...}` expression container (one level of nesting) does not end the tag, so\n * `apply={cond ? a : b}` and `apply={(x) => y}` are handled. It refuses to\n * match self-closing `<style apply={theme} />` blocks (the `/` before `>` must\n * not close the tag): they carry no CSS body, so, like the compiler's\n * `cssMappings`, they yield no region and cannot swallow a later bodied block.\n * One region is produced per bodied block, in source order, whether the blocks\n * share a scope or sit in nested `@{ ... }` / control-flow bodies.\n * @param {string} code\n * @returns {EmbeddedRegion[]}\n */\nexport function extract_css_regions(code) {\n\tconst style_regex =\n\t\t/<style\\b((?:[^>\"'{}/]|\"[^\"]*\"|'[^']*'|\\{(?:[^{}]|\\{[^{}]*\\})*\\}|\\/(?!>))*)>([\\s\\S]*?)<\\/style>/gi;\n\treturn extract_regions(code, style_regex, '<style'.length, 'style');\n}\n\n/**\n * @param {string} code\n * @param {RegExp} regex Global regex whose group 1 is the attribute text and group 2 the body.\n * @param {number} tag_name_length Length of `<tag`.\n * @param {string} id_prefix\n * @returns {EmbeddedRegion[]}\n */\nfunction extract_regions(code, regex, tag_name_length, id_prefix) {\n\t/** @type {EmbeddedRegion[]} */\n\tconst regions = [];\n\tlet match;\n\twhile ((match = regex.exec(code)) !== null) {\n\t\tconst attrs = match[1];\n\t\tconst content = match[2];\n\t\t// `<tag` + attrs + `>`; attrs may contain a quoted or braced `>`, so derive\n\t\t// the opening tag's end from the match structure rather than searching for `>`.\n\t\tconst start = match.index + tag_name_length + attrs.length + 1;\n\t\tregions.push({\n\t\t\tid: `${id_prefix}_${regions.length}`,\n\t\t\tstart,\n\t\t\tlength: content.length,\n\t\t\tcontent,\n\t\t});\n\t}\n\treturn regions;\n}\n","/** @import * as AST from 'estree'; */\n/** @import {CompileError, CodeMapping} from '@tsrx/core/types' */\n\n/** @typedef {import('./transform.js').TSRXCompilerModule} TSRXCompilerModule */\n/** @typedef {import('./transform.js').TsrxTransformResult} TsrxTransformResult */\n/** @typedef {import('./transform.js').EmbeddedRegion} EmbeddedRegion */\n\n/** @typedef {Map<string, CodeMapping>} CachedMappings */\n/** @typedef {import('typescript').CompilerOptions} CompilerOptions */\n/** @typedef {import('@volar/language-core').IScriptSnapshot} IScriptSnapshot */\n/** @typedef {import('@volar/language-core').VirtualCode} VirtualCode */\n/** @typedef {string | { fsPath: string }} ScriptId */\n// Side-effect import: augments @volar/language-core's LanguagePlugin with the `typescript` field.\n/** @typedef {typeof import('@volar/typescript')} _VolarTypeScriptAugmentation */\n/** @typedef {import('./consumer-compiler.js').CompilerResolutionOptions} CompilerResolutionOptions */\n/** @typedef {import('@volar/language-core').LanguagePlugin<ScriptId, VirtualCode>} TsrxLanguagePlugin */\n\n/** @typedef {InstanceType<typeof import('./language.js')[\"TSRXVirtualCode\"]>} TSRXVirtualCodeInstance */\n\nimport { forEachEmbeddedCode } from '@volar/language-core';\nimport fs from 'fs';\nimport path from 'path';\nimport { createRequire } from 'module';\nimport { fileURLToPath } from 'url';\nimport {\n\treset_consumer_compiler_resolution_caches,\n\tresolve_consumer_compiler_for_file,\n\tresolve_consumer_platform_for_file,\n} from './consumer-compiler.js';\nimport { NODE_CONFIG_HOST } from './config-host.js';\nimport { extract_css_regions, transform_tsrx } from './transform.js';\nimport { createLogging, DEBUG } from './utils.js';\n\nconst require = createRequire(import.meta.url);\nconst root_dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst { log, logWarning, logError } = createLogging('[TSRX Language]');\n/** @type {Set<string>} */\nconst loggedCompilationFailures = new Set();\nexport const TSRX_EXTENSIONS = ['.tsrx'];\n/**\n * `[package name, package directory parts, supported extensions, package hints, entry candidates?]`.\n * Entry candidates are relative to the package directory and are probed in order,\n * so a package that ships both a build output and its sources lists the published\n * layout first.\n * @typedef {[string, string[], string[], string[], string[][]?]} CompilerCandidate\n */\n/** @type {CompilerCandidate[]} */\nexport const COMPILER_CANDIDATES = [\n\t[\n\t\t'@tsrx/ripple',\n\t\t['node_modules', '@tsrx', 'ripple'],\n\t\t['.tsrx'],\n\t\t['@tsrx/ripple', 'ripple', '@ripple-ts/vite-plugin'],\n\t],\n\t[\n\t\t'@tsrx/react',\n\t\t['node_modules', '@tsrx', 'react'],\n\t\t['.tsrx'],\n\t\t['@tsrx/react', '@tsrx/vite-plugin-react'],\n\t],\n\t[\n\t\t'@tsrx/solid',\n\t\t['node_modules', '@tsrx', 'solid'],\n\t\t['.tsrx'],\n\t\t['@tsrx/solid', '@tsrx/vite-plugin-solid'],\n\t],\n\t[\n\t\t'@tsrx/preact',\n\t\t['node_modules', '@tsrx', 'preact'],\n\t\t['.tsrx'],\n\t\t['@tsrx/preact', '@tsrx/vite-plugin-preact'],\n\t],\n\t[\n\t\t'@tsrx/vue',\n\t\t['node_modules', '@tsrx', 'vue'],\n\t\t['.tsrx'],\n\t\t['@tsrx/vue', '@tsrx/vite-plugin-vue'],\n\t],\n\t[\n\t\t'@tsrx/hono',\n\t\t['node_modules', '@tsrx', 'hono'],\n\t\t['.tsrx'],\n\t\t['@tsrx/hono', '@tsrx/vite-plugin-hono'],\n\t],\n\t[\n\t\t'octane',\n\t\t['node_modules', 'octane'],\n\t\t['.tsrx'],\n\t\t['octane', '@octanejs/vite-plugin'],\n\t\t// Published `octane` releases only ship `dist/` and expose the compiler as\n\t\t// `octane/compiler/volar`; the `src/` layout is kept for source checkouts.\n\t\t[\n\t\t\t['dist', 'compiler', 'volar.js'],\n\t\t\t['src', 'compiler', 'volar.js'],\n\t\t],\n\t],\n];\n\n/** @type {string[][]} */\nconst DEFAULT_COMPILER_ENTRY_CANDIDATES = [['src', 'index.js']];\n\n/**\n * @param {string} file_name\n * @returns {boolean}\n */\nexport function is_tsrx_file(file_name) {\n\treturn TSRX_EXTENSIONS.some((extension) => file_name.endsWith(extension));\n}\n\n/**\n * Tokenize enough of a source text to find member chains: comments and\n * string literals are skipped, template literals contribute only their\n * `${...}` expressions, and every identifier, `.` and `?.` is a token.\n * It tokenizes independently of any grammar, so partially authored TSRX and\n * template syntax (`@{`, `@if`) are fine.\n * @param {string} source\n * @returns {Array<{ kind: 'word' | 'dot' | 'question-dot' | 'other', text: string }>}\n */\nfunction tokenize_member_chains(source) {\n\t/** @type {Array<{ kind: 'word' | 'dot' | 'question-dot' | 'other', text: string }>} */\n\tconst tokens = [];\n\tconst length = source.length;\n\tlet index = 0;\n\t/** Brace depth at which each open template substitution started, innermost last. */\n\t/** @type {number[]} */\n\tconst template_braces = [];\n\tlet brace_depth = 0;\n\n\t/** Skip template text from `index` to the closing backtick or the next substitution. */\n\tfunction skip_template_text() {\n\t\twhile (index < length && source[index] !== '`') {\n\t\t\tif (source[index] === '\\\\') {\n\t\t\t\tindex += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (source[index] === '$' && source[index + 1] === '{') {\n\t\t\t\ttemplate_braces.push(brace_depth);\n\t\t\t\tindex += 2;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tindex += 1;\n\t\t}\n\t\tif (index < length) index += 1;\n\t}\n\n\twhile (index < length) {\n\t\tconst char = source[index];\n\t\tconst next = source[index + 1];\n\t\tif (/\\s/.test(char)) {\n\t\t\tindex += 1;\n\t\t} else if (char === '/' && next === '/') {\n\t\t\twhile (index < length && source[index] !== '\\n') index += 1;\n\t\t} else if (char === '/' && next === '*') {\n\t\t\tconst end = source.indexOf('*/', index + 2);\n\t\t\tindex = end < 0 ? length : end + 2;\n\t\t} else if (char === '\"' || char === \"'\") {\n\t\t\tindex += 1;\n\t\t\twhile (index < length && source[index] !== char && source[index] !== '\\n') {\n\t\t\t\tif (source[index] === '\\\\') index += 1;\n\t\t\t\tindex += 1;\n\t\t\t}\n\t\t\tindex += 1;\n\t\t} else if (char === '`') {\n\t\t\tindex += 1;\n\t\t\tskip_template_text();\n\t\t} else if (\n\t\t\tchar === '}' &&\n\t\t\ttemplate_braces.length > 0 &&\n\t\t\ttemplate_braces[template_braces.length - 1] === brace_depth\n\t\t) {\n\t\t\t// The substitution closed: back into the template literal's text.\n\t\t\ttemplate_braces.pop();\n\t\t\tindex += 1;\n\t\t\tskip_template_text();\n\t\t} else if (/[A-Za-z_$]/.test(char)) {\n\t\t\tlet end = index + 1;\n\t\t\twhile (end < length && /[\\w$]/.test(source[end])) end += 1;\n\t\t\ttokens.push({ kind: 'word', text: source.slice(index, end) });\n\t\t\tindex = end;\n\t\t} else if (char === '?' && next === '.') {\n\t\t\ttokens.push({ kind: 'question-dot', text: '?.' });\n\t\t\tindex += 2;\n\t\t} else if (char === '.') {\n\t\t\ttokens.push({ kind: 'dot', text: '.' });\n\t\t\tindex += 1;\n\t\t} else {\n\t\t\tif (char === '{') brace_depth += 1;\n\t\t\telse if (char === '}') brace_depth -= 1;\n\t\t\ttokens.push({ kind: 'other', text: char });\n\t\t\tindex += 1;\n\t\t}\n\t}\n\treturn tokens;\n}\n\n/**\n * Detect exact platform property paths (`import.meta.env.platform.web` and\n * the `ios` and `android` twins) without matching comments or string\n * literals, and without TypeScript's scanner so the native path needs no\n * TypeScript.\n *\n * @param {string} source\n * @param {unknown} [_typescript] Accepted for older callers; unused.\n * @returns {boolean}\n */\nexport function source_uses_platform_flag(source, _typescript) {\n\tconst tokens = tokenize_member_chains(source);\n\tconst prefix = ['import', '.', 'meta', '.', 'env', '.', 'platform', '.'];\n\tfor (let index = 0; index + prefix.length < tokens.length; index += 1) {\n\t\tif (\n\t\t\tindex > 0 &&\n\t\t\t(tokens[index - 1].kind === 'dot' || tokens[index - 1].kind === 'question-dot')\n\t\t) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!prefix.every((text, offset) => tokens[index + offset].text === text)) continue;\n\t\tconst name = tokens[index + prefix.length].text;\n\t\tif (name === 'web' || name === 'ios' || name === 'android') return true;\n\t}\n\treturn false;\n}\n\n/**\n * @param {CompilerResolutionOptions} [options]\n * @returns {TsrxLanguagePlugin}\n */\nexport function getTsrxLanguagePlugin(options = {}) {\n\tlog('Creating TSRX language plugin...');\n\t// `ts` is only needed by the TypeScript-facing parts of the plugin (the\n\t// classic path); the native backend creates the plugin without one.\n\tconst typescript = options.ts;\n\t/** @type {CompilerResolutionOptions} */\n\tconst compiler_resolution_options = {\n\t\t...options,\n\t\tconfigHost: options.configHost ?? NODE_CONFIG_HOST,\n\t};\n\n\treturn {\n\t\tgetLanguageId(fileNameOrUri) {\n\t\t\tconst file_name =\n\t\t\t\ttypeof fileNameOrUri === 'string'\n\t\t\t\t\t? fileNameOrUri\n\t\t\t\t\t: fileNameOrUri.fsPath.replace(/\\\\/g, '/');\n\t\t\tif (is_tsrx_file(file_name)) {\n\t\t\t\tlog('Identified TSRX file:', file_name);\n\t\t\t\treturn 'tsrx';\n\t\t\t}\n\t\t},\n\t\tcreateVirtualCode(fileNameOrUri, languageId, snapshot) {\n\t\t\tif (languageId === 'tsrx') {\n\t\t\t\tconst file_name = normalizeFileNameOrUri(fileNameOrUri);\n\t\t\t\tconst compiler = get_tsrx_compiler(file_name, compiler_resolution_options);\n\t\t\t\tif (!compiler) {\n\t\t\t\t\tlogError(`TSRX compiler not found for file: ${file_name}`);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tlog('Creating virtual code for:', file_name);\n\t\t\t\ttry {\n\t\t\t\t\treturn new TSRXVirtualCode(file_name, snapshot, compiler, (required) =>\n\t\t\t\t\t\tresolve_consumer_platform_for_file(file_name, {\n\t\t\t\t\t\t\t...compiler_resolution_options,\n\t\t\t\t\t\t\trequirePlatformResolution: required,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tlogError('Failed to create virtual code for:', file_name, ':', err);\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t\tupdateVirtualCode(fileNameOrUri, virtualCode, snapshot) {\n\t\t\tif (virtualCode instanceof TSRXVirtualCode) {\n\t\t\t\tlog('Updating existing virtual code for:', virtualCode.fileName);\n\t\t\t\tvirtualCode.update(snapshot);\n\t\t\t\treturn virtualCode;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\n\t\ttypescript: {\n\t\t\textraFileExtensions: TSRX_EXTENSIONS.map((extension) => ({\n\t\t\t\textension: extension.slice(1),\n\t\t\t\tisMixedContent: false,\n\t\t\t\tscriptKind: 7,\n\t\t\t})),\n\t\t\t/**\n\t\t\t * @param {VirtualCode} tsrx_code\n\t\t\t */\n\t\t\tgetServiceScript(tsrx_code) {\n\t\t\t\tfor (const code of forEachEmbeddedCode(tsrx_code)) {\n\t\t\t\t\tif (code.languageId === 'tsrx') {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tcode,\n\t\t\t\t\t\t\textension: '.tsx',\n\t\t\t\t\t\t\tscriptKind: 4,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * @implements {VirtualCode}\n */\n/**\n * File names (as TypeScript spells them) whose last TSRX compilation failed.\n * While a file is in this state its generated code is the raw source, so every\n * TypeScript diagnostic on it would be noise; the tsserver plugin (`index.js`)\n * drops them, as the classic language server's diagnostic filter does, and the\n * TSRX compile error is reported by the language server instead.\n * @type {Set<string>}\n */\nexport const files_with_fatal_compile_error = new Set();\n\n/**\n * @param {string} file_name\n * @returns {boolean}\n */\nexport function has_fatal_compile_error(file_name) {\n\treturn files_with_fatal_compile_error.has(normalize_file_name_key(file_name));\n}\n\n/**\n * @param {string} file_name\n * @returns {string}\n */\nfunction normalize_file_name_key(file_name) {\n\treturn file_name.replace(/\\\\/g, '/').toLowerCase();\n}\n\nexport class TSRXVirtualCode {\n\t/** @type {string} */\n\tid = 'root';\n\t/** @type {string} */\n\tlanguageId = 'tsrx';\n\t/** @type {unknown[]} */\n\tcodegenStacks = [];\n\t/** @type {TSRXCompilerModule} */\n\ttsrx;\n\t/** @type {((required: boolean) => 'web' | 'ios' | 'android' | undefined) | undefined} */\n\tplatformProvider;\n\t/** @type {string} */\n\tgeneratedCode = '';\n\t/** @type {VirtualCode['embeddedCodes']} */\n\tembeddedCodes = [];\n\t/** @type {CodeMapping[]} */\n\tmappings = [];\n\t/** @type {CompileError[]} */\n\tfatalErrors = [];\n\t/** @type {CompileError[]} */\n\tusageErrors = [];\n\t/** @type {IScriptSnapshot} */\n\tsnapshot;\n\t/** @type {IScriptSnapshot} */\n\tsourceSnapshot;\n\t/** @type {string} */\n\toriginalCode = '';\n\t/** @type {AST.Program | null} */\n\tsourceAst = null;\n\t/** @type {boolean} */\n\tisDotCompletionMode = false;\n\t/** @type {unknown[]} */\n\tdiagnostics = [];\n\t/** @type {CachedMappings | null} */\n\t#mappingGenToSource = null;\n\t/** @type {CachedMappings | null} */\n\t#mappingSourceToGen = null;\n\n\t/**\n\t * @param {string} file_name\n\t * @param {IScriptSnapshot} snapshot\n\t * @param {TSRXCompilerModule} tsrx\n\t * @param {(required: boolean) => 'web' | 'ios' | 'android' | undefined} [platform_provider]\n\t */\n\tconstructor(file_name, snapshot, tsrx, platform_provider) {\n\t\tlog('Initializing TSRXVirtualCode for:', file_name);\n\n\t\tthis.fileName = file_name;\n\t\tthis.tsrx = tsrx;\n\t\tthis.platformProvider = platform_provider;\n\t\tthis.snapshot = snapshot;\n\t\tthis.sourceSnapshot = snapshot;\n\t\tthis.originalCode = snapshot.getText(0, snapshot.getLength());\n\n\t\t// Validate the selected TSRX compiler.\n\t\tif (!tsrx || typeof tsrx.compile_to_volar_mappings !== 'function') {\n\t\t\tlogError('Invalid TSRX compiler - missing compile_to_volar_mappings method');\n\t\t\tthrow new Error('Invalid TSRX compiler');\n\t\t}\n\n\t\tthis.update(snapshot);\n\t}\n\n\t/**\n\t * @param {IScriptSnapshot} snapshot\n\t * @returns {void}\n\t */\n\tupdate(snapshot) {\n\t\tlog('Updating virtual code for:', this.fileName);\n\n\t\tconst newCode = snapshot.getText(0, snapshot.getLength());\n\t\tconst changeRange = snapshot.getChangeRange(this.sourceSnapshot);\n\t\tthis.sourceSnapshot = snapshot;\n\n\t\t// Only clear mapping index - don't update snapshot/originalCode yet\n\t\tthis.#mappingGenToSource = null;\n\t\tthis.#mappingSourceToGen = null;\n\n\t\tthis.fatalErrors = [];\n\t\tthis.usageErrors = [];\n\t\tthis.sourceAst = null;\n\t\tthis.isDotCompletionMode = false;\n\n\t\t// Check if a single \".\" was typed using changeRange\n\t\tlet isDotTyped = false;\n\t\tlet dotPosition = -1;\n\n\t\tlog('changeRange:', JSON.stringify(changeRange));\n\n\t\tif (changeRange) {\n\t\t\tconst changeStart = changeRange.span.start;\n\t\t\tconst changeEnd = changeStart + changeRange.span.length;\n\t\t\tconst newEnd = changeStart + changeRange.newLength;\n\n\t\t\t// Get the old text (what was replaced) from originalCode\n\t\t\tconst oldText = this.originalCode.substring(changeStart, changeEnd);\n\t\t\t// Get the new text (what replaced it) from newCode\n\t\t\tconst newText = newCode.substring(changeStart, newEnd);\n\n\t\t\tlog('Change details:');\n\t\t\tlog(' Position:', changeStart, '-', changeEnd, '(length:', changeRange.span.length, ')');\n\t\t\tlog(' Old text:', JSON.stringify(oldText));\n\t\t\tlog(' New text:', JSON.stringify(newText), '(length:', changeRange.newLength, ')');\n\n\t\t\t// Check if a dot was added at the end of the new text\n\t\t\tif (newText.endsWith('.')) {\n\t\t\t\t// The dot is at position newEnd - 1\n\t\t\t\t// We need to check the character BEFORE the dot (inside the new text)\n\t\t\t\tconst charBeforeDot = newEnd > 1 ? newCode[newEnd - 2] : '';\n\t\t\t\tlog(' Char before dot:', JSON.stringify(charBeforeDot));\n\n\t\t\t\tif (/[$#_\\u200C\\u200D\\p{ID_Continue}\\)\\]\\}]/u.test(charBeforeDot)) {\n\t\t\t\t\tisDotTyped = true;\n\t\t\t\t\tdotPosition = newEnd - 1; // Position of the dot\n\t\t\t\t\tlog('ChangeRange detected dot typed at position', dotPosition);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/** @type {TsrxTransformResult} */\n\t\tlet result;\n\t\ttry {\n\t\t\tconst platform = this.platformProvider?.(source_uses_platform_flag(newCode));\n\t\t\t// If user typed a \".\", compile without it and then stitch it back into\n\t\t\t// the generated output so completions can still resolve.\n\t\t\tif (isDotTyped && dotPosition >= 0) {\n\t\t\t\tthis.isDotCompletionMode = true;\n\t\t\t\tconst codeWithoutDot =\n\t\t\t\t\tnewCode.substring(0, dotPosition) + newCode.substring(dotPosition + 1);\n\n\t\t\t\tlog('Compiling without typed dot at position', dotPosition);\n\t\t\t\tresult = transform_tsrx(this.tsrx, this.fileName, codeWithoutDot, { platform });\n\n\t\t\t\tif (!result.fatalError && result.text && result.mappings.length > 0) {\n\t\t\t\t\tlog('Compilation without dot successful');\n\t\t\t\t\tconst insertedDotPosition = restore_typed_dot_in_transpiled_code(result, dotPosition);\n\n\t\t\t\t\tif (insertedDotPosition === null) {\n\t\t\t\t\t\tlogWarning('Failed to restore typed dot into transpiled output');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog('Inserted typed dot at generated position', insertedDotPosition);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog('Compiling TSRX code...');\n\t\t\t\tresult = transform_tsrx(this.tsrx, this.fileName, newCode, { platform });\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t// Platform resolution failed (invalid tsconfig): treat it like a compile failure.\n\t\t\tconst error = /** @type {CompileError} */ (e);\n\t\t\terror.type = 'fatal';\n\t\t\tresult = {\n\t\t\t\ttext: '',\n\t\t\t\tmappings: [],\n\t\t\t\tcssRegions: [],\n\t\t\t\tscriptRegions: [],\n\t\t\t\terrors: [],\n\t\t\t\tfatalError: error,\n\t\t\t\tsourceAst: null,\n\t\t\t};\n\t\t}\n\n\t\tif (result.fatalError) {\n\t\t\tlogError('TSRX compilation failed for', this.fileName, ':', result.fatalError);\n\t\t\tif (process.env.TSRX_TSC === 'true') {\n\t\t\t\tlogTSRXErrors(this.fileName, [result.fatalError]);\n\t\t\t}\n\t\t\tthis.fatalErrors.push(result.fatalError);\n\t\t\tfiles_with_fatal_compile_error.add(normalize_file_name_key(this.fileName));\n\t\t} else {\n\t\t\tlog('Compilation successful, generated code length:', result.text.length);\n\t\t\tfiles_with_fatal_compile_error.delete(normalize_file_name_key(this.fileName));\n\t\t}\n\n\t\tthis.originalCode = newCode;\n\n\t\tif (!result.fatalError && result.text) {\n\t\t\t// Successful compilation - update everything\n\t\t\tthis.generatedCode = result.text;\n\t\t\tthis.mappings = result.mappings;\n\t\t\tthis.usageErrors = result.errors;\n\t\t\tthis.sourceAst = result.sourceAst;\n\n\t\t\tif (process.env.TSRX_TSC === 'true' && result.errors.length > 0) {\n\t\t\t\tlogTSRXErrors(this.fileName, result.errors);\n\t\t\t}\n\n\t\t\tif (result.cssRegions.length > 0) {\n\t\t\t\tlog('Creating', result.cssRegions.length, 'CSS embedded codes');\n\t\t\t}\n\t\t\t// `<script>` bodies are not embedded codes: the transform appends each one\n\t\t\t// to the generated TSX as a block (`embed_script_bodies`), so TypeScript\n\t\t\t// checks them in the same file on every path. Only CSS is embedded.\n\t\t\tthis.embeddedCodes = result.cssRegions.map((region) =>\n\t\t\t\tcreate_embedded_code_from_region(region, 'css'),\n\t\t\t);\n\n\t\t\tif (DEBUG) {\n\t\t\t\tlog('CSS embedded codes:', (this.embeddedCodes || []).length);\n\t\t\t\tlog('Using transpiled code, mapping count:', this.mappings.length);\n\t\t\t\tlog('Original code length:', newCode.length);\n\t\t\t\tlog('Generated code length:', this.generatedCode.length);\n\t\t\t\tlog('Last 100 chars of original:', JSON.stringify(newCode.slice(-100)));\n\t\t\t\tlog('Last 200 chars of generated:', JSON.stringify(this.generatedCode.slice(-200)));\n\t\t\t\tlog('Last few mappings:');\n\t\t\t\tconst startIdx = Math.max(0, this.mappings.length - 5);\n\t\t\t\tfor (let i = startIdx; i < this.mappings.length; i++) {\n\t\t\t\t\tconst m = this.mappings[i];\n\t\t\t\t\tlog(\n\t\t\t\t\t\t` Mapping ${i}: source[${m.sourceOffsets[0]}:${m.sourceOffsets[0] + m.lengths[0]}] -> gen[${m.generatedOffsets[0]}:${m.generatedOffsets[0] + m.lengths[0]}], len=${m.lengths[0]}, completion=${m.data?.completion}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// When compilation fails, show where it failed and disable all\n\t\t\t// TypeScript diagnostics until the compilation error is fixed\n\t\t\tlog('Compilation failed, only display where the compilation error occurred.');\n\n\t\t\t// Feed the raw source back as the generated code, with verification\n\t\t\t// enabled. This lets TS parse it and surface errors at the broken\n\t\t\t// construct itself — important when a TSRX compile error has no `pos`\n\t\t\t// (or an unreliable one), since the dedicated diagnostic plugin would\n\t\t\t// otherwise pin the error to offset 0 (top of file, off-screen) and the\n\t\t\t// user would have no signal pointing at the actual problem.\n\t\t\tthis.generatedCode = newCode;\n\n\t\t\t// Create 1:1 mappings for the entire content.\n\t\t\t//\n\t\t\t// Enable `completion` on this fallback mapping. Volar only invokes\n\t\t\t// completion providers at a cursor position when some mapping covering\n\t\t\t// it has the completion capability (isCompletionEnabled === !!data.completion).\n\t\t\t// Without it, a transient compile error (e.g. a half-typed `@if`) would\n\t\t\t// disable ALL completions in the file, so the user gets no suggestions to\n\t\t\t// help them finish the very construct that is broken. Keeping completion on\n\t\t\t// lets template-directive and TypeScript completions surface while editing.\n\t\t\tthis.mappings = [\n\t\t\t\t{\n\t\t\t\t\tsourceOffsets: [0],\n\t\t\t\t\tgeneratedOffsets: [0],\n\t\t\t\t\tlengths: [newCode.length],\n\t\t\t\t\tgeneratedLengths: [newCode.length],\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tcompletion: true,\n\t\t\t\t\t\tverification: true,\n\t\t\t\t\t\tcustomData: {},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t];\n\n\t\t\t// Extract CSS from <style> tags for embedded codes, so CSS intellisense\n\t\t\t// keeps working while the file has a transient compile error elsewhere.\n\t\t\tthis.embeddedCodes = extract_css_regions(newCode).map((region) =>\n\t\t\t\tcreate_embedded_code_from_region(region, 'css'),\n\t\t\t);\n\t\t}\n\n\t\tthis.snapshot = /** @type {IScriptSnapshot} */ ({\n\t\t\tgetText: (start, end) => this.generatedCode.substring(start, end),\n\t\t\tgetLength: () => this.generatedCode.length,\n\t\t\tgetChangeRange: () => undefined,\n\t\t});\n\t}\n\n\t#buildMappingCache() {\n\t\tif (this.#mappingGenToSource || this.#mappingSourceToGen) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#mappingGenToSource = new Map();\n\t\tthis.#mappingSourceToGen = new Map();\n\n\t\tvar mapping, genStart, genLength, genEnd, genKey;\n\t\tvar sourceStart, sourceLength, sourceEnd, sourceKey;\n\t\tfor (var i = 0; i < this.mappings.length; i++) {\n\t\t\tmapping = this.mappings[i];\n\n\t\t\tgenStart = mapping.generatedOffsets[0];\n\t\t\tgenLength = mapping.generatedLengths[0];\n\t\t\tgenEnd = genStart + genLength;\n\t\t\tgenKey = `${genStart}-${genEnd}`;\n\t\t\tthis.#mappingGenToSource.set(genKey, mapping);\n\n\t\t\tsourceStart = mapping.sourceOffsets[0];\n\t\t\tsourceLength = mapping.lengths[0];\n\t\t\tsourceEnd = sourceStart + sourceLength;\n\t\t\tsourceKey = `${sourceStart}-${sourceEnd}`;\n\t\t\tthis.#mappingSourceToGen.set(sourceKey, mapping);\n\t\t}\n\t}\n\n\t/**\n\t * Find mapping by generated range\n\t * @param {number} start - The start offset of the range\n\t * @param {number} end - The end offset of the range\n\t * @returns {CodeMapping | null} The mapping for this range, or null if not found\n\t */\n\tfindMappingByGeneratedRange(start, end) {\n\t\tthis.#buildMappingCache();\n\t\treturn /** @type {CachedMappings} */ (this.#mappingGenToSource).get(`${start}-${end}`) ?? null;\n\t}\n\n\t/**\n\t * Find mapping by source range\n\t * @param {number} start - The start offset of the range\n\t * @param {number} end - The end offset of the range\n\t * @returns {CodeMapping | null} The mapping for this range, or null if not found\n\t */\n\tfindMappingBySourceRange(start, end) {\n\t\tthis.#buildMappingCache();\n\t\treturn /** @type {CachedMappings} */ (this.#mappingSourceToGen).get(`${start}-${end}`) ?? null;\n\t}\n\n\t/**\n\t * Resolve a source range to a generated `[start, end]` offset pair by spanning\n\t * the token mappings that overlap it.\n\t *\n\t * Statement and element source ranges are only ever covered by several\n\t * granular token mappings (e.g. `const test = 5;` maps as `const `, `test`,\n\t * ` = `, `5`, `;`), and keywords/punctuation are frequently dropped entirely,\n\t * so an exact `findMappingBySourceRange` lookup never matches a multi-token\n\t * range and the endpoints often fall on unmapped tokens. Callers that have a\n\t * range with no exact mapping (such as compile-error diagnostics) use this to\n\t * land on the range: the generated start comes from the first overlapping\n\t * token and the generated end from the last, so an error pointing at a `const`\n\t * keyword still resolves via the `test`/`5` tokens that follow it.\n\t *\n\t * @param {number} start - Start of the source range\n\t * @param {number} end - Exclusive end of the source range\n\t * @returns {[number, number] | null} Generated `[start, end]`, or null if no\n\t * token overlaps the range\n\t */\n\tfindGeneratedRangeBySourceRange(start, end) {\n\t\t/** @type {CodeMapping | null} */\n\t\tlet first = null;\n\t\t/** @type {CodeMapping | null} */\n\t\tlet last = null;\n\t\tfor (let i = 0; i < this.mappings.length; i++) {\n\t\t\tconst mapping = this.mappings[i];\n\t\t\tconst sourceStart = mapping.sourceOffsets[0];\n\t\t\tconst sourceEnd = sourceStart + mapping.lengths[0];\n\t\t\t// Skip tokens that do not overlap the half-open range [start, end).\n\t\t\tif (sourceEnd <= start || sourceStart >= end) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!first || sourceStart < first.sourceOffsets[0]) {\n\t\t\t\tfirst = mapping;\n\t\t\t}\n\t\t\tif (!last || sourceEnd > last.sourceOffsets[0] + last.lengths[0]) {\n\t\t\t\tlast = mapping;\n\t\t\t}\n\t\t}\n\t\tif (!first || !last) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Offset into the first/last token, clamped so an endpoint that lands\n\t\t// before/after the token (an unmapped keyword or punctuation) snaps to the\n\t\t// token edge rather than escaping its generated span.\n\t\tconst generated_start =\n\t\t\tfirst.generatedOffsets[0] +\n\t\t\tclamp_offset(start - first.sourceOffsets[0], first.generatedLengths[0]);\n\t\tconst generated_end =\n\t\t\tlast.generatedOffsets[0] +\n\t\t\tclamp_offset(end - last.sourceOffsets[0], last.generatedLengths[0]);\n\t\treturn [generated_start, Math.max(generated_end, generated_start + 1)];\n\t}\n}\n\n/**\n * Clamp an intra-token offset into `[0, length]`.\n * @param {number} offset\n * @param {number} length\n * @returns {number}\n */\nfunction clamp_offset(offset, length) {\n\treturn Math.min(Math.max(offset, 0), length);\n}\n\n/**\n * @param {string} file_name\n * @param {ReadonlyArray<unknown>} errors\n */\nfunction logTSRXErrors(file_name, errors) {\n\tfor (const error of errors) {\n\t\tconst message =\n\t\t\terror && typeof error === 'object' && 'message' in error\n\t\t\t\t? String(/** @type {{ message: unknown }} */ (error).message)\n\t\t\t\t: String(error);\n\t\tconst key = `${file_name}\\0${message}`;\n\t\tif (loggedCompilationFailures.has(key)) {\n\t\t\tcontinue;\n\t\t}\n\t\tloggedCompilationFailures.add(key);\n\t\tconsole.error(`[tsrx-tsc] ${file_name}: ${message}`);\n\t}\n}\n\n/**\n * Build an embedded virtual code from a `<style>` / `<script>` region produced\n * by the transform. The embedded document text is the region's content;\n * `languageId` selects which Volar service handles it (`css` or `typescript`).\n * @param {EmbeddedRegion} region\n * @param {string} languageId\n * @returns {VirtualCode}\n */\nfunction create_embedded_code_from_region(region, languageId) {\n\tconst content = region.content;\n\t/** @type {CodeMapping} */\n\tconst mapping = {\n\t\tsourceOffsets: [region.start],\n\t\tgeneratedOffsets: [0],\n\t\tlengths: [region.length],\n\t\tgeneratedLengths: [region.length],\n\t\tdata: {\n\t\t\tverification: true,\n\t\t\tcompletion: true,\n\t\t\tsemantic: true,\n\t\t\tnavigation: true,\n\t\t\tstructure: true,\n\t\t\tformat: false,\n\t\t\tcustomData: {\n\t\t\t\tcontent,\n\t\t\t\tembeddedId: region.id,\n\t\t\t},\n\t\t},\n\t};\n\treturn {\n\t\tid: region.id,\n\t\tlanguageId,\n\t\tsnapshot: {\n\t\t\tgetText: (/** @type {number} */ start, /** @type {number} */ end) =>\n\t\t\t\tcontent.substring(start, end),\n\t\t\tgetLength: () => region.length,\n\t\t\tgetChangeRange: () => undefined,\n\t\t},\n\t\tmappings: [mapping],\n\t\tembeddedCodes: [],\n\t};\n}\n\n/**\n * Insert a typed dot back into the transpiled code and update mappings so the\n * source and generated offsets stay aligned for completion requests.\n * @param {TsrxTransformResult} transpiled\n * @param {number} dotPosition\n * @returns {number | null}\n */\nfunction restore_typed_dot_in_transpiled_code(transpiled, dotPosition) {\n\tlet dot_mapping = null;\n\n\tfor (const mapping of transpiled.mappings) {\n\t\tconst source_end = mapping.sourceOffsets[0] + mapping.lengths[0];\n\t\tif (source_end === dotPosition) {\n\t\t\tdot_mapping = mapping;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (!dot_mapping) {\n\t\treturn null;\n\t}\n\n\tconst generated_length = dot_mapping.generatedLengths[0];\n\tconst insertedDotPosition = dot_mapping.generatedOffsets[0] + generated_length;\n\n\ttranspiled.text =\n\t\ttranspiled.text.substring(0, insertedDotPosition) +\n\t\t'.' +\n\t\ttranspiled.text.substring(insertedDotPosition);\n\n\t// Create a separate 1:1 mapping for the dot character instead of extending\n\t// the existing mapping. When source and generated lengths differ (e.g.\n\t// #state → _$__u0023_state), Volar's translateOffset uses\n\t// Math.min(relativePos, toLength) which would map the cursor after the dot\n\t// to the middle of the generated identifier instead of after it.\n\n\t/** @type {CodeMapping} */\n\tconst new_dot_mapping = {\n\t\tsourceOffsets: [dotPosition],\n\t\tgeneratedOffsets: [insertedDotPosition],\n\t\tlengths: [1],\n\t\tgeneratedLengths: [1],\n\t\tdata: { ...dot_mapping.data },\n\t};\n\n\t// Find the index to insert after dot_mapping\n\tconst dot_mapping_index = transpiled.mappings.indexOf(dot_mapping);\n\ttranspiled.mappings.splice(dot_mapping_index + 1, 0, new_dot_mapping);\n\n\tfor (const mapping of transpiled.mappings) {\n\t\tif (\n\t\t\tmapping !== dot_mapping &&\n\t\t\tmapping !== new_dot_mapping &&\n\t\t\tmapping.generatedOffsets[0] >= insertedDotPosition\n\t\t) {\n\t\t\tmapping.generatedOffsets[0] += 1;\n\t\t}\n\t\tif (\n\t\t\tmapping !== dot_mapping &&\n\t\t\tmapping !== new_dot_mapping &&\n\t\t\tmapping.sourceOffsets[0] >= dotPosition\n\t\t) {\n\t\t\tmapping.sourceOffsets[0] += 1;\n\t\t}\n\t}\n\n\treturn insertedDotPosition;\n}\n\n/**\n * @template T\n * @param {{ options?: CompilerOptions } & T} config\n * @returns {{ options: CompilerOptions } & T}\n */\nexport const resolveConfig = (config) => {\n\tconst baseOptions = config.options ?? /** @type {CompilerOptions} */ ({});\n\t/** @type {CompilerOptions} */\n\tconst options = { ...baseOptions };\n\n\t// Only the classic path (a TypeScript language service host) asks for\n\t// resolved compiler options, so TypeScript is loaded here and not at import.\n\tconst ts = /** @type {typeof import('typescript')} */ (require('typescript'));\n\n\t// Default target: align with modern bundlers while staying configurable.\n\tif (options.target === undefined) {\n\t\toptions.target = ts.ScriptTarget.ESNext;\n\t}\n\n\t// Leave `lib` unchanged. When omitted, TypeScript selects the target's\n\t// default library through the active language-service host. `lib: []`\n\t// and `noLib` must retain their distinct TypeScript semantics.\n\n\t// Default typeRoots: automatically discover @types like tsserver.\n\tif (!options.types) {\n\t\tconst host = ts.createCompilerHost(options);\n\t\tconst typeRoots = ts.getEffectiveTypeRoots(options, host);\n\t\tif (typeRoots && typeRoots.length > 0) {\n\t\t\toptions.typeRoots = typeRoots;\n\t\t}\n\t}\n\n\treturn {\n\t\t...config,\n\t\toptions,\n\t};\n};\n\n/** @type {Map<string, string | null>} */\nexport const path2TsrxCompilerPathMap = new Map();\n/** @type {Map<string, { mtimeMs: number, size: number, content: string }>} */\nconst pathToTypesCache = new Map();\n/** @type {Map<string, { text: string, matches: Map<string, RegExpMatchArray> }>} */\nconst typeNameMatchCache = new Map();\n/** @type {Map<string, { name: string | null, dependencies: Set<string> } | null>} */\nconst pathToPackageManifestCache = new Map();\n\n/**\n * @param {ScriptId} fileNameOrUri\n * @returns {string}\n */\nexport function normalizeFileNameOrUri(fileNameOrUri) {\n\treturn typeof fileNameOrUri === 'string'\n\t\t? fileNameOrUri\n\t\t: fileNameOrUri.fsPath.replace(/\\\\/g, '/');\n}\n\n/**\n * @param {string} start_dir\n * @param {(file_path: import('fs').PathLike) => boolean} [exists_sync]\n * @returns {{ name: string | null, dependencies: Set<string> } | null}\n */\nfunction get_nearest_package_manifest(start_dir, exists_sync = fs.existsSync) {\n\tlet current_dir = start_dir;\n\t/** @type {string[]} */\n\tconst visited_dirs = [];\n\n\twhile (current_dir) {\n\t\tif (pathToPackageManifestCache.has(current_dir)) {\n\t\t\tconst cached_manifest = pathToPackageManifestCache.get(current_dir) ?? null;\n\t\t\tfor (const visited_dir of visited_dirs) {\n\t\t\t\tpathToPackageManifestCache.set(visited_dir, cached_manifest);\n\t\t\t}\n\t\t\treturn cached_manifest;\n\t\t}\n\n\t\tvisited_dirs.push(current_dir);\n\n\t\tconst package_json_path = path.join(current_dir, 'package.json');\n\t\tif (exists_sync(package_json_path)) {\n\t\t\ttry {\n\t\t\t\tconst package_json = JSON.parse(fs.readFileSync(package_json_path, 'utf8'));\n\t\t\t\tconst dependencies = new Set([\n\t\t\t\t\t...Object.keys(package_json.dependencies ?? {}),\n\t\t\t\t\t...Object.keys(package_json.devDependencies ?? {}),\n\t\t\t\t\t...Object.keys(package_json.peerDependencies ?? {}),\n\t\t\t\t\t...Object.keys(package_json.optionalDependencies ?? {}),\n\t\t\t\t]);\n\t\t\t\tconst package_manifest = {\n\t\t\t\t\tname: typeof package_json.name === 'string' ? package_json.name : null,\n\t\t\t\t\tdependencies,\n\t\t\t\t};\n\n\t\t\t\tfor (const visited_dir of visited_dirs) {\n\t\t\t\t\tpathToPackageManifestCache.set(visited_dir, package_manifest);\n\t\t\t\t}\n\n\t\t\t\treturn package_manifest;\n\t\t\t} catch {\n\t\t\t\tfor (const visited_dir of visited_dirs) {\n\t\t\t\t\tpathToPackageManifestCache.set(visited_dir, null);\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tconst parent_dir = path.dirname(current_dir);\n\t\tif (parent_dir === current_dir) {\n\t\t\tbreak;\n\t\t}\n\t\tcurrent_dir = parent_dir;\n\t}\n\n\tfor (const visited_dir of visited_dirs) {\n\t\tpathToPackageManifestCache.set(visited_dir, null);\n\t}\n\n\treturn null;\n}\n\n/**\n * @param {{ name: string | null, dependencies: Set<string> } | null} package_manifest\n * @param {string} compiler_name\n * @param {string[]} package_hints\n * @returns {boolean}\n */\nfunction package_manifest_matches_compiler(package_manifest, compiler_name, package_hints) {\n\tif (!package_manifest) {\n\t\treturn false;\n\t}\n\n\tif (\n\t\tpackage_manifest.name === compiler_name ||\n\t\tpackage_hints.includes(package_manifest.name ?? '')\n\t) {\n\t\treturn true;\n\t}\n\n\tif (package_manifest.dependencies.has(compiler_name)) {\n\t\treturn true;\n\t}\n\n\tfor (const package_hint of package_hints) {\n\t\tif (package_manifest.dependencies.has(package_hint)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Resolve and load the TSRX compiler that owns a `.tsrx` file.\n * @param {string} normalized_file_name\n * @param {CompilerResolutionOptions} [options]\n * @returns {TSRXCompilerModule | undefined}\n */\nexport function get_tsrx_compiler(normalized_file_name, options) {\n\tconst compiler_path = get_compiler_entry_for_file(normalized_file_name, options);\n\tif (compiler_path) {\n\t\treturn require_tsrx_compiler(compiler_path);\n\t}\n}\n\n/**\n * Load a resolved compiler entry and normalize its contract.\n * @param {string} compiler_path\n * @returns {TSRXCompilerModule}\n */\nexport function require_tsrx_compiler(compiler_path) {\n\treturn normalize_tsrx_compiler_module(require(compiler_path));\n}\n\n/**\n * Normalize the compiler contract used by Octane and consumer-declared modules.\n * @param {TSRXCompilerModule & { compileToVolarMappings?: TSRXCompilerModule['compile_to_volar_mappings'] }} compiler_module\n * @returns {TSRXCompilerModule}\n */\nfunction normalize_tsrx_compiler_module(compiler_module) {\n\tif (\n\t\ttypeof compiler_module?.compile_to_volar_mappings !== 'function' &&\n\t\ttypeof compiler_module?.compileToVolarMappings === 'function'\n\t) {\n\t\treturn {\n\t\t\t...compiler_module,\n\t\t\tcompile_to_volar_mappings: compiler_module.compileToVolarMappings,\n\t\t};\n\t}\n\treturn compiler_module;\n}\n\n/**\n * @param {string} normalized_file_name\n * @param {(file_path: import('fs').PathLike) => boolean} [exists_sync]\n * @param {Map<string, string | null>} [compiler_path_map]\n * @returns {string | undefined}\n */\nexport function find_workspace_compiler_entry_for_file(\n\tnormalized_file_name,\n\texists_sync = fs.existsSync,\n\tcompiler_path_map = path2TsrxCompilerPathMap,\n) {\n\tconst parts = normalized_file_name.split('/');\n\tconst ext = path.extname(normalized_file_name);\n\n\tfor (let i = parts.length - 2; i >= 0; i--) {\n\t\tconst dir = parts.slice(0, i + 1).join('/');\n\t\tconst cache_key = dir + '\\0' + ext;\n\n\t\tif (!compiler_path_map.has(cache_key)) {\n\t\t\t/** @type {Array<[string, string, string[]]>} */\n\t\t\tconst available_candidates = [];\n\t\t\tfor (const [\n\t\t\t\tcompiler_name,\n\t\t\t\tcompiler_dir_parts,\n\t\t\t\tsupported_extensions,\n\t\t\t\tpackage_hints,\n\t\t\t\tentry_candidates = DEFAULT_COMPILER_ENTRY_CANDIDATES,\n\t\t\t] of COMPILER_CANDIDATES) {\n\t\t\t\tif (!supported_extensions.includes(ext)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfor (const entry_parts of entry_candidates) {\n\t\t\t\t\tconst full_path = [dir, ...compiler_dir_parts, ...entry_parts].join('/');\n\t\t\t\t\tif (exists_sync(full_path)) {\n\t\t\t\t\t\tavailable_candidates.push([compiler_name, full_path, package_hints]);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet found_path = null;\n\t\t\tif (available_candidates.length > 0) {\n\t\t\t\tconst package_manifest = get_nearest_package_manifest(dir, exists_sync);\n\t\t\t\tconst preferred_candidate = available_candidates.find(([compiler_name, , package_hints]) =>\n\t\t\t\t\tpackage_manifest_matches_compiler(package_manifest, compiler_name, package_hints),\n\t\t\t\t);\n\t\t\t\tfound_path = preferred_candidate?.[1] ?? available_candidates[0][1];\n\t\t\t\tlog('Found tsrx compiler at:', found_path, 'for extension:', ext);\n\t\t\t}\n\n\t\t\tcompiler_path_map.set(cache_key, found_path);\n\t\t}\n\n\t\tconst compiler_path = compiler_path_map.get(cache_key);\n\t\tif (compiler_path) {\n\t\t\treturn compiler_path;\n\t\t}\n\t}\n}\n\n/**\n * @param {string} normalized_file_name\n * @param {CompilerResolutionOptions} [options]\n * @returns {string | undefined}\n */\nexport function get_compiler_entry_for_file(normalized_file_name, options) {\n\tconst ext = path.extname(normalized_file_name);\n\tconst consumer_compiler_path = resolve_consumer_compiler_for_file(normalized_file_name, options);\n\tif (consumer_compiler_path !== undefined) {\n\t\treturn consumer_compiler_path ?? undefined;\n\t}\n\tconst package_manifest = get_nearest_package_manifest(path.dirname(normalized_file_name));\n\n\tconst workspace_compiler_path = find_workspace_compiler_entry_for_file(normalized_file_name);\n\tif (workspace_compiler_path) {\n\t\treturn workspace_compiler_path;\n\t}\n\n\tconst warn_message = `No supported tsrx compiler found in workspace for ${normalized_file_name}.`;\n\n\t// Fallback: look for a packaged compiler.\n\tlet current_dir = root_dirname;\n\n\twhile (current_dir) {\n\t\t/** @type {Array<[string, string, string[]]>} */\n\t\tconst available_candidates = [];\n\t\tfor (const [\n\t\t\tcompiler_name,\n\t\t\tcompiler_dir_parts,\n\t\t\tsupported_extensions,\n\t\t\tpackage_hints,\n\t\t\tentry_candidates = DEFAULT_COMPILER_ENTRY_CANDIDATES,\n\t\t] of COMPILER_CANDIDATES) {\n\t\t\tif (!supported_extensions.includes(ext)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst full_path = path.join(current_dir, ...compiler_dir_parts);\n\t\t\tfor (const entry_parts of entry_candidates) {\n\t\t\t\tconst entry_path = path.join(full_path, ...entry_parts);\n\t\t\t\tif (fs.existsSync(entry_path)) {\n\t\t\t\t\tavailable_candidates.push([compiler_name, entry_path, package_hints]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (available_candidates.length > 0) {\n\t\t\tconst preferred_candidate = available_candidates.find(([compiler_name, , package_hints]) =>\n\t\t\t\tpackage_manifest_matches_compiler(package_manifest, compiler_name, package_hints),\n\t\t\t);\n\t\t\tconst entry_path = preferred_candidate?.[1] ?? available_candidates[0][1];\n\t\t\tlogWarning(`${warn_message} Using packaged version at ${entry_path}`);\n\t\t\treturn entry_path;\n\t\t}\n\n\t\tconst parent_dir = path.dirname(current_dir);\n\t\tif (parent_dir === current_dir) {\n\t\t\tbreak;\n\t\t}\n\t\tcurrent_dir = parent_dir;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Resolve the tsrx compiler package that owns a `.tsrx` file (e.g. `'@tsrx/ripple'`,\n * `'@tsrx/react'`) from the exact compiler entry selected for compilation. All\n * targets share the `.tsrx` extension, so this is how the editor layer tells them\n * apart. Returns `undefined` for an unresolved or unknown third-party compiler.\n * @param {string} file_name\n * @param {CompilerResolutionOptions} [options]\n * @returns {string | undefined}\n */\nexport function get_tsrx_compiler_name_for_file(file_name, options) {\n\tconst entry = get_compiler_entry_for_file(file_name.replace(/\\\\/g, '/'), options);\n\tif (!entry) {\n\t\treturn undefined;\n\t}\n\n\tconst package_name = get_nearest_package_manifest(path.dirname(entry))?.name;\n\tif (COMPILER_CANDIDATES.some(([compiler_name]) => compiler_name === package_name)) {\n\t\treturn package_name ?? undefined;\n\t}\n\n\t// Compatibility fallback for unpackaged compiler fixtures and historical\n\t// source layouts that do not include a readable package manifest.\n\tconst normalized_entry = entry.replace(/\\\\/g, '/');\n\tfor (const [\n\t\tcompiler_name,\n\t\tcompiler_dir_parts,\n\t\t,\n\t\t,\n\t\tentry_candidates = DEFAULT_COMPILER_ENTRY_CANDIDATES,\n\t] of COMPILER_CANDIDATES) {\n\t\tfor (const entry_parts of entry_candidates) {\n\t\t\tconst suffix = '/' + [...compiler_dir_parts, ...entry_parts].join('/');\n\t\t\tif (normalized_entry.endsWith(suffix)) {\n\t\t\t\treturn compiler_name;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Whether a `.tsrx` file is compiled by the Ripple target (as opposed to\n * React/Solid/Preact/Vue). Used to gate Ripple-runtime-only editor suggestions.\n * @param {string} file_name\n * @param {CompilerResolutionOptions} [options]\n * @returns {boolean}\n */\nexport function is_ripple_target_file(file_name, options) {\n\treturn get_tsrx_compiler_name_for_file(file_name, options) === '@tsrx/ripple';\n}\n\n/**\n * Create a stable key for filesystem caches. Windows paths are case-insensitive\n * to TypeScript, while file URIs conventionally lowercase their drive letter.\n * @param {string} file_name\n */\nfunction getPathCacheKey(file_name) {\n\tconst is_windows_path =\n\t\tprocess.platform === 'win32' || /^[a-z]:[\\\\/]/i.test(file_name) || file_name.startsWith('\\\\\\\\');\n\tconst path_api = is_windows_path ? path.win32 : path;\n\tconst normalized = path_api.normalize(file_name);\n\treturn is_windows_path ? normalized.toLowerCase() : normalized;\n}\n\n/**\n * @param {string} typesFilePath\n * @returns {string | undefined}\n */\nexport function getCachedTypeDefinitionFile(typesFilePath) {\n\tconst cache_key = getPathCacheKey(typesFilePath);\n\n\tlet stat;\n\ttry {\n\t\tstat = fs.statSync(typesFilePath);\n\t} catch {\n\t\tlogWarning(`Types file does not exist at path: ${typesFilePath}`);\n\t\treturn;\n\t}\n\n\tconst cached = pathToTypesCache.get(cache_key);\n\tif (cached && cached.mtimeMs === stat.mtimeMs && cached.size === stat.size) {\n\t\treturn cached.content;\n\t}\n\n\tlog(`Found TSRX types at: ${typesFilePath}`);\n\n\t// Read the file to find the class definition offset\n\tconst fileContent = fs.readFileSync(typesFilePath, 'utf8');\n\n\tif (!fileContent) {\n\t\tlogWarning(`Failed to read content of types file at: ${typesFilePath}`);\n\t\treturn;\n\t}\n\n\tpathToTypesCache.set(cache_key, {\n\t\tmtimeMs: stat.mtimeMs,\n\t\tsize: stat.size,\n\t\tcontent: fileContent,\n\t});\n\treturn fileContent;\n}\n\n/**\n * @param {string} typeName\n * @param {string} text\n * @param {string} [sourceKey]\n * @returns {RegExpMatchArray | undefined}\n */\nexport function getCachedTypeMatches(typeName, text, sourceKey = text) {\n\tconst cache_key = sourceKey === text ? text : getPathCacheKey(sourceKey);\n\tlet source_cache = typeNameMatchCache.get(cache_key);\n\tif (!source_cache || source_cache.text !== text) {\n\t\tsource_cache = {\n\t\t\ttext,\n\t\t\tmatches: new Map(),\n\t\t};\n\t\ttypeNameMatchCache.set(cache_key, source_cache);\n\t}\n\n\tconst cached = source_cache.matches.get(typeName);\n\tif (cached) {\n\t\treturn cached;\n\t}\n\n\tconst searchPattern = new RegExp(\n\t\t`(?:export\\\\s+(?:declare\\\\s+)?|declare\\\\s+)(class|function)\\\\s+${typeName}`,\n\t);\n\n\tconst match = text.match(searchPattern);\n\n\tif (match && match.index !== undefined) {\n\t\tsource_cache.matches.set(typeName, match);\n\t\treturn match;\n\t}\n\n\treturn;\n}\n\n/**\n * @param {string} normalized_file_name\n * @param {CompilerResolutionOptions} [options]\n * @returns {string | undefined}\n */\nexport function get_compiler_dir_for_file(normalized_file_name, options) {\n\tconst entry = get_compiler_entry_for_file(normalized_file_name, options);\n\tif (!entry) {\n\t\treturn undefined;\n\t}\n\n\tlet current_dir = path.dirname(entry);\n\twhile (current_dir) {\n\t\tif (fs.existsSync(path.join(current_dir, 'package.json'))) {\n\t\t\treturn current_dir;\n\t\t}\n\t\tif (path.basename(current_dir) === 'node_modules') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst parent_dir = path.dirname(current_dir);\n\t\tif (parent_dir === current_dir) {\n\t\t\treturn undefined;\n\t\t}\n\t\tcurrent_dir = parent_dir;\n\t}\n}\n\nexport { get_compiler_dir_for_file as getTsrxCompilerDirForFile };\n\n/**\n * Drop compiler-selection state. Loaded ESM compiler graphs cannot be evicted\n * safely in-process; language-server package watchers restart the process.\n */\nexport function invalidateCompilerResolutionCaches() {\n\tpath2TsrxCompilerPathMap.clear();\n\tpathToPackageManifestCache.clear();\n\treset_consumer_compiler_resolution_caches();\n\tloggedCompilationFailures.clear();\n}\n\n/**\n * Drop cached definition-file content and matches. A path invalidates only one\n * file; omitting it clears all definition state.\n * @param {string} [typesFilePath]\n */\nexport function invalidateTypeDefinitionCaches(typesFilePath) {\n\tif (typesFilePath) {\n\t\tconst cache_key = getPathCacheKey(typesFilePath);\n\t\tpathToTypesCache.delete(cache_key);\n\t\ttypeNameMatchCache.delete(cache_key);\n\t\treturn;\n\t}\n\n\tpathToTypesCache.clear();\n\ttypeNameMatchCache.clear();\n}\n\n/** Reset all module-level state used in tests. */\nexport function _reset_for_test() {\n\tinvalidateCompilerResolutionCaches();\n\tinvalidateTypeDefinitionCaches();\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,10],"mappings":"+yBACA,OAAO,eAAe,EAAS,aAAc,CAAE,MAAO,EAAK,CAAC,EAC5D,EAAQ,aAAe,EACvB,SAAS,EAAa,EAAQ,EAAa,CACvC,IAAI,EAAM,EACN,EAAO,EAAO,OAAS,EACvB,EACJ,KAAO,GAAO,GAAM,CAChB,IAAM,EAAM,KAAK,OAAO,EAAM,GAAQ,CAAC,EACjC,EAAW,EAAO,GACxB,GAAI,EAAW,EACX,EAAM,EAAM,OAEX,GAAI,EAAW,EAChB,EAAO,EAAM,MAEZ,CACD,EAAM,EACN,EAAO,EACP,EAAQ,EACR,KACJ,CACJ,CAGA,MAAO,CAAE,IAFQ,KAAK,IAAI,KAAK,IAAI,EAAK,EAAM,EAAO,OAAS,CAAC,EAAG,CAE7C,EAAG,KADN,KAAK,IAAI,KAAK,IAAI,EAAK,EAAM,CAAC,EAAG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