@tsrx/typescript-plugin 0.3.104 → 0.3.105

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.
@@ -0,0 +1,5 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`typescript`);l=c(l,1);let u=require(`fs`);u=c(u,1);let d=require(`path`);d=c(d,1);let f=require(`module`),p=require(`url`),m=require(`node:path`);m=c(m,1);var h=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.binarySearch=t;function t(e,t){let n=0,r=e.length-1,i;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o<t)n=a+1;else if(o>t)r=a-1;else{n=a,r=a,i=a;break}}return{low:Math.max(Math.min(n,r,e.length-1),0),high:Math.min(Math.max(n,r,0),e.length-1),match:i}}})),g=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.translateOffset=n;let t=!1;function n(e,n,r,i,a=i,o=!1){if(!n.every((e,t)=>t===0||n[t-1]<=e)){for(let t=0;t<n.length;t++){let s=n[t],c=i[t];if(e>=s&&e<=s+c){let n=a[t],i=r[t],l,u=e-s;return l=o&&n>c&&u===c?n:Math.min(u,n),i+l}}t||(t=!0,console.warn(`fromOffsets should be sorted in ascending order`))}let s=0,c=n.length-1;for(;s<=c;){let t=Math.floor((s+c)/2),l=n[t],u=i[t];if(e>=l&&e<=l+u){let n=a[t],i=r[t],s,c=e-l;return s=o&&n>u&&c===u?n:Math.min(c,n),i+s}else e<l?c=t-1:s=t+1}}})),_=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SourceMap=void 0;let t=h(),n=g();e.SourceMap=class{constructor(e){this.mappings=e}toSourceRange(e,t,n,r){return this.findMatchingStartEnd(e,t,n,`generatedOffsets`,r)}toGeneratedRange(e,t,n,r){return this.findMatchingStartEnd(e,t,n,`sourceOffsets`,r)}toSourceLocation(e,t){return this.findMatchingOffsets(e,`generatedOffsets`,t)}toGeneratedLocation(e,t){return this.findMatchingOffsets(e,`sourceOffsets`,t)}*findMatchingOffsets(e,i,a,o=!1){let s=this.getMemoBasedOnRange(i);if(s.offsets.length===0)return;let{low:c,high:l}=(0,t.binarySearch)(s.offsets,e),u=new Set,d=i===`sourceOffsets`?`generatedOffsets`:`sourceOffsets`;for(let t=c;t<=l;t++)for(let c of s.mappings[t]){if(u.has(c)||(u.add(c),a&&!a(c.data)))continue;let t=(0,n.translateOffset)(e,c[i],c[d],r(c,i),r(c,d),o);t!==void 0&&(yield[t,c])}}*findMatchingStartEnd(e,t,i,a,o){let s=a===`sourceOffsets`?`generatedOffsets`:`sourceOffsets`,c=s===`sourceOffsets`,l=[],u=!1;for(let[i,d]of this.findMatchingOffsets(e,a)){if(o&&!o(d.data))continue;l.push([i,d]);let e=(0,n.translateOffset)(t,d[a],d[s],r(d,a),r(d,s),c);e!==void 0&&(u=!0,yield[i,e,d,d])}if(!u&&i){for(let[e,n]of l)for(let[r,i]of this.findMatchingOffsets(t,a,void 0,c))if(!(o&&!o(i.data)||r<e)){yield[e,r,n,i];break}}}getMemoBasedOnRange(e){return e===`sourceOffsets`?this.sourceCodeOffsetsMemo??=this.createMemo(`sourceOffsets`):this.generatedCodeOffsetsMemo??=this.createMemo(`generatedOffsets`)}createMemo(e){let n=new Set;for(let t of this.mappings)for(let i=0;i<t[e].length;i++)n.add(t[e][i]),n.add(t[e][i]+r(t,e)[i]);let i=[...n].sort((e,t)=>e-t),a=i.map(()=>new Set);for(let n of this.mappings)for(let o=0;o<n[e].length;o++){let s=(0,t.binarySearch)(i,n[e][o]).match,c=(0,t.binarySearch)(i,n[e][o]+r(n,e)[o]).match;for(let e=s;e<=c;e++)a[e].add(n)}return{offsets:i,mappings:a}}};function r(e,t){return t===`sourceOffsets`?e.lengths:e.generatedLengths??e.lengths}})),v=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(_(),e),n(g(),e)})),y=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isHoverEnabled=t,e.isInlayHintsEnabled=n,e.isCodeLensEnabled=r,e.isMonikerEnabled=i,e.isInlineValueEnabled=a,e.isSemanticTokensEnabled=o,e.isCallHierarchyEnabled=s,e.isTypeHierarchyEnabled=c,e.isRenameEnabled=l,e.isDefinitionEnabled=u,e.isTypeDefinitionEnabled=d,e.isReferencesEnabled=f,e.isImplementationEnabled=p,e.isHighlightEnabled=m,e.isSymbolsEnabled=h,e.isFoldingRangesEnabled=g,e.isSelectionRangesEnabled=_,e.isLinkedEditingEnabled=v,e.isColorEnabled=y,e.isDocumentLinkEnabled=b,e.isDiagnosticsEnabled=x,e.isCodeActionsEnabled=S,e.isFormattingEnabled=C,e.isCompletionEnabled=w,e.isAutoInsertEnabled=T,e.isSignatureHelpEnabled=E,e.shouldReportDiagnostics=D,e.resolveRenameNewName=O,e.resolveRenameEditText=k,e.findOverlapCodeRange=A;function t(e){return!!e.semantic}function n(e){return!!e.semantic}function r(e){return!!e.semantic}function i(e){return!!e.semantic}function a(e){return!!e.semantic}function o(e){return typeof e.semantic==`object`?e.semantic.shouldHighlight?.()??!0:!!e.semantic}function s(e){return!!e.navigation}function c(e){return!!e.navigation}function l(e){return typeof e.navigation==`object`?e.navigation.shouldRename?.()??!0:!!e.navigation}function u(e){return!!e.navigation}function d(e){return!!e.navigation}function f(e){return!!e.navigation}function p(e){return!!e.navigation}function m(e){return typeof e.navigation==`object`?e.navigation.shouldHighlight?.()??!0:!!e.navigation}function h(e){return!!e.structure}function g(e){return!!e.structure}function _(e){return!!e.structure}function v(e){return!!e.structure}function y(e){return!!e.structure}function b(e){return!!e.structure}function x(e){return!!e.verification}function S(e){return!!e.verification}function C(e){return!!e.format}function w(e){return!!e.completion}function T(e){return!!e.completion}function E(e){return!!e.completion}function D(e,t,n){return typeof e.verification==`object`?e.verification.shouldReport?.(t,n)??!0:!!e.verification}function O(e,t){return typeof t.navigation==`object`?t.navigation.resolveRenameNewName?.(e)??e:e}function k(e,t){return typeof t.navigation==`object`?t.navigation.resolveRenameEditText?.(e)??e:e}function A(e,t,n,r){let i,a;for(let[t,a]of n.toGeneratedLocation(e))if(r(a.data)){i=t;break}for(let[e,i]of n.toGeneratedLocation(t))if(r(i.data)){a=e;break}if(i===void 0||a===void 0){for(let o of n.mappings)if(r(o.data)){let n=o.sourceOffsets[0],r=j(e,t,n,o.sourceOffsets[o.sourceOffsets.length-1]+o.lengths[o.lengths.length-1]);if(r){let e=r.start-n+o.generatedOffsets[0],t=(o.generatedLengths??o.lengths)[o.generatedOffsets.length-1],s=Math.min(r.end-o.sourceOffsets[o.sourceOffsets.length-1],t),c=o.generatedOffsets[o.generatedOffsets.length-1]+s;i=i===void 0?e:Math.min(i,e),a=a===void 0?c:Math.max(a,c)}}}if(i!==void 0&&a!==void 0)return{start:i,end:a}}function j(e,t,n,r){let i=Math.max(e,n),a=Math.min(t,r);if(!(i>a))return{start:i,end:a}}})),b=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LinkedCodeMap=void 0;let t=v();e.LinkedCodeMap=class extends t.SourceMap{*getLinkedOffsets(e){for(let t of this.toGeneratedLocation(e))yield t[0];for(let t of this.toSourceLocation(e))yield t[0]}}})),x=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),S=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FileMap=void 0,e.FileMap=class extends Map{constructor(e){super(),this.caseSensitive=e,this.originalFileNames=new Map}keys(){return this.originalFileNames.values()}get(e){return super.get(this.normalizeId(e))}has(e){return super.has(this.normalizeId(e))}set(e,t){return this.originalFileNames.set(this.normalizeId(e),e),super.set(this.normalizeId(e),t)}delete(e){return this.originalFileNames.delete(this.normalizeId(e)),super.delete(this.normalizeId(e))}clear(){return this.originalFileNames.clear(),super.clear()}normalizeId(e){return this.caseSensitive?e:e.toLowerCase()}}})),C=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultMapperFactory=e.SourceMap=void 0,e.createLanguage=o,e.forEachEmbeddedCode=s;var r=v();Object.defineProperty(e,`SourceMap`,{enumerable:!0,get:function(){return r.SourceMap}}),n(y(),e),n(b(),e),n(x(),e),n(S(),e);let i=v(),a=b();e.defaultMapperFactory=e=>new i.SourceMap(e);function o(t,n,r,i){let o=new WeakMap,c=new WeakMap,l=new WeakMap,u={mapperFactory:e.defaultMapperFactory,plugins:t,scripts:{fromVirtualCode(e){return o.get(e)},get(e,t=!0,i=!1){r(e,t,i);let a=n.get(e);return a?.isAssociationDirty&&this.set(e,a.snapshot,a.languageId),n.get(e)},set(e,r,i,a=t){if(!i){for(let n of t)if(i=n.getLanguageId?.(e),i)break}if(!i){console.warn(`languageId not found for ${String(e)}`);return}let c=!1;for(let n of t)if(n.isAssociatedFileOnly?.(e,i)){c=!0;break}if(n.has(e)){let t=n.get(e);if(t.languageId!==i||t.associatedOnly!==c)return this.delete(e),d(t),this.set(e,r,i);if(c)t.snapshot!==r&&(t.snapshot=r,d(t));else if(t.isAssociationDirty||t.snapshot!==r){t.snapshot!==r&&(t.snapshot=r,d(t));let n=f(t);if(t.generated){let{updateVirtualCode:a,createVirtualCode:c}=t.generated.languagePlugin,l=a?a(e,t.generated.root,r,n):c?.(e,i,r,n);if(l){t.generated.root=l,t.generated.embeddedCodes.clear();for(let e of s(t.generated.root))o.set(e,t),t.generated.embeddedCodes.set(e.id,e);return t}else{this.delete(e);return}}}else return t}else{let t={id:e,languageId:i,snapshot:r,associatedIds:new Set,targetIds:new Set,associatedOnly:c};if(n.set(e,t),c)return t;for(let n of a){let a=n.createVirtualCode?.(e,i,r,f(t));if(a){t.generated={root:a,languagePlugin:n,embeddedCodes:new Map};for(let e of s(a))o.set(e,t),t.generated.embeddedCodes.set(e.id,e);break}}return t}},delete(e){let t=n.get(e);t&&(t.generated?.languagePlugin.disposeVirtualCode?.(e,t.generated.root),n.delete(e),d(t))}},maps:{get(e,t){let n=c.get(e.snapshot);if(n||c.set(e.snapshot,n=new WeakMap),!n.has(t.snapshot)){let r=e.associatedScriptMappings?.get(t.id)??e.mappings;n.set(t.snapshot,u.mapperFactory(r))}return n.get(t.snapshot)},*forEach(e){let t=o.get(e);if(yield[t,this.get(e,t)],e.associatedScriptMappings)for(let[t]of e.associatedScriptMappings){let r=n.get(t);r&&(yield[r,this.get(e,r)])}}},linkedCodeMaps:{get(e){let t=o.get(e),n=l.get(e.snapshot);return n?.[0]!==t.snapshot&&l.set(e.snapshot,n=[t.snapshot,e.linkedCodeMappings?new a.LinkedCodeMap(e.linkedCodeMappings):void 0]),n[1]}}};return u;function d(e){e.targetIds.forEach(e=>{let t=n.get(e);t&&(t.isAssociationDirty=!0,i?.(t.id))})}function f(e){for(let t of e.associatedIds)n.get(t)?.targetIds.delete(e.id);return e.associatedIds.clear(),e.isAssociationDirty=!1,{getAssociatedScript(t){r(t,!0,!0);let i=n.get(t);return i&&(i.targetIds.add(e.id),e.associatedIds.add(i.id)),i}}}}function*s(e){if(yield e,e.embeddedCodes)for(let t of e.embeddedCodes)yield*s(t)}})),w=C();function T(e,t,n){let r=new Map,i=[],a=[],o=new Set,s=[],c=[],l=new Set,u=new Set,d=typeof t.useCaseSensitiveFileNames==`function`?t.useCaseSensitiveFileNames():t.useCaseSensitiveFileNames,f={fileExists:t.fileExists,readFile:t.readFile,readDirectory:t.readDirectory,useCaseSensitiveFileNames:d};function p(e){return m.default.normalize(m.default.resolve(e))}function h(e){let t=p(e);return d?t:t.toLowerCase()}function g(t){for(let n of t){let t=e.flattenDiagnosticMessageText(n.messageText,`
2
+ `),r=`${n.code}\0${n.file?.fileName??``}\0${n.start??``}\0${t}`;l.has(r)||(l.add(r),s.push(n))}}function _(e){let t=p(e),n=h(t);o.has(n)||(o.add(n),a.push(t))}function v(e,t){if(typeof t!=`string`||!m.default.isAbsolute(t)&&!t.startsWith(`.`))return;let n=m.default.resolve(e.dir,t);return m.default.extname(n)===``?`${n}.json`:n}function y(n){let i=p(n),a=h(i),o=r.get(a);if(o)return o;let s=t.readFile(i),c=e.readJsonConfigFile(i,t.readFile),l=[...c.parseDiagnostics],u=e.convertToObject(c,l),d=typeof u==`object`&&u&&!Array.isArray(u)?u:{},f=d.extends,_=Array.isArray(f)?f:f===void 0?[]:[f],v={path:i,dir:m.default.dirname(i),config:d,raw_source:s,parse_diagnostics:l,extends_values:_};return r.set(a,v),g(l),v}function b(n,r){let i=JSON.stringify({extends:r,files:[]}),a=e.readJsonConfigFile(n.path,()=>i),o=e.parseJsonSourceFileConfigFileContent(a,f,n.dir,{},n.path).errors.filter(e=>e.code!==18003);g(o);let s=a.extendedSourceFiles?.[0],l=s??v(n,r);l!==void 0&&_(l);let u=o.some(e=>e.code===18e3),d=s===void 0||!t.fileExists(s);return(d||u)&&c.push({config_path:n.path,extends_value:r,resolved_path:l,diagnostics:o}),d?void 0:s}function x(e){let t=p(e),n=h(t);if(u.has(n))return;u.add(n),_(t);let r=y(t);for(let e of r.extends_values){let t=b(r,e);t!==void 0&&x(t)}i.push({path:r.path,dir:r.dir,config:r.config,raw_source:r.raw_source,parse_diagnostics:r.parse_diagnostics}),u.delete(n)}return x(n),{layers:i,dependencies:a,diagnostics:s,extends_failures:c}}function E(e,t){let n=e;for(let e of t){if(n===null||typeof n!=`object`&&typeof n!=`function`||!Object.prototype.hasOwnProperty.call(n,e))return{state:`absent`};n=n[e]}return{state:`found`,value:n}}function D(e,t){let n={state:`absent`};for(let r of e){let e=t(r);e.state!==`absent`&&(n={...e,config_path:r.path,config_dir:r.dir})}return n}const O=process.env.RIPPLE_DEBUG===`true`;function k(e){return{log(...t){O&&console.log(e,...t)},logError(...t){O&&console.error(e,...t)},logWarning(...t){O&&console.warn(e,...t)}}}const{log:A,logError:j,logWarning:M}=k(`[Ripple Language]`),ee=/^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*(?:\/[A-Za-z0-9][A-Za-z0-9._~-]*)*$/,te=/["']tsrx["']\s*:/;let N=new WeakMap;const P=new Map;function F(e){return{actual_type:e===null?`null`:Array.isArray(e)?`array`:typeof e,actual_value:JSON.stringify(e)??String(e)}}function I(e){let t=N.get(e);return t||(t={nearest_config_paths:new Map,resolved_config_layers:new Map},N.set(e,t)),t}function L(e,t){let n=d.default.normalize(d.default.resolve(e));return(typeof t.useCaseSensitiveFileNames==`function`?t.useCaseSensitiveFileNames():t.useCaseSensitiveFileNames)?n:n.toLowerCase()}function R(e){let t=E(e,[`tsrx`]);if(t.state===`absent`)return{state:`absent`};let n=t.value;if(typeof n!=`object`||!n||Array.isArray(n))return{state:`invalid`,target:`tsrx`,...F(n)};let r=E(n,[`compiler`]);if(r.state===`absent`)return{state:`absent`};let i=r.value;return typeof i==`string`&&i.trim()!==``?{state:`declared`,value:i.trim()}:{state:`invalid`,target:`compiler`,...F(i)}}function ne(e,t,n){let r=e,i=[];for(;r;){let e=L(r,t);if(n.nearest_config_paths.has(e)){let t=n.nearest_config_paths.get(e)??null;for(let e of i)n.nearest_config_paths.set(e,t);return t}i.push(e);let a=d.default.join(r,`tsconfig.json`);if(t.fileExists(a)){for(let e of i)n.nearest_config_paths.set(e,a);return a}let o=d.default.dirname(r);if(o===r)break;r=o}for(let e of i)n.nearest_config_paths.set(e,null);return null}function re(e,t,n,r){let i=L(n,t),a=r.resolved_config_layers.get(i);if(a&&(a.dependency_modified_times===void 0||[...a.dependency_modified_times].every(([e,n])=>t.getModifiedTime?.(e)?.valueOf()===n)))return a.value;let o=T(e,t,n),s=t.getModifiedTime?new Map(o.dependencies.map(e=>[e,t.getModifiedTime?.(e)?.valueOf()])):void 0;return r.resolved_config_layers.set(i,{value:o,dependency_modified_times:s}),o}function ie(e,t,n){let r=e.findLastIndex(e=>e.path===t.config_path),i=e.findLastIndex(e=>e.path===n);return r>=0&&i>=r}function ae(e,t,n,r){return e.resolveModuleName(r,n,{module:e.ModuleKind.Node16,moduleResolution:e.ModuleResolutionKind.Node16,noDtsResolution:!0},t,void 0,void 0,e.ModuleKind.CommonJS).resolvedModule?.resolvedFileName}function oe(e,t,n,r){let i=`${n}\0${r}`;if(P.has(i))return P.get(i)??null;if(!ee.test(r))return P.set(i,null),j(`Declared TSRX compiler must be a bare package specifier:`,r,`in ${n}`),null;try{let e=(0,f.createRequire)(n).resolve(r);return P.set(i,e),A(`Found declared tsrx compiler at:`,e,`from tsconfig:`,n),e}catch{let a=ae(e,t,n,r);return a===void 0?(j(`Unable to resolve declared TSRX compiler "${r}" from tsconfig`,n),null):(P.set(i,a),A(`Found declared tsrx compiler after uncached retry at:`,a,`from tsconfig:`,n),a)}}function se(e,t={}){let n=t.ts??l.default,r=t.configHost??n.sys,i=I(r),a=t.configFileName??ne(d.default.dirname(e),r,i);if(a===null)return;let o=re(n,r,a,i);for(let e of o.dependencies)t.dependencies?.add(e);let s=o.layers.filter(e=>e.raw_source===void 0);if(s.length>0){for(let e of s)j(`Unable to read tsconfig layer:`,e.path);return null}let c=o.layers.filter(e=>e.parse_diagnostics.length>0);if(c.length>0){let e=o.layers.some(e=>E(e.config,[`tsrx`]).state===`found`?!0:e.parse_diagnostics.length===0||e.raw_source===void 0?!1:te.test(e.raw_source)),t=e?j:M;for(let e of c)for(let r of e.parse_diagnostics)t(`Unable to parse tsconfig layer:`,e.path,n.flattenDiagnosticMessageText(r.messageText,`
3
+ `));return e?null:void 0}let u=D(o.layers,e=>R(e.config));if(u.state===`invalid`)return j(`Invalid TSRX ${u.target} declaration:`,u.actual_type,u.actual_value,`in ${u.config_path}`),null;let f=o.extends_failures.filter(e=>u.state!==`declared`||!ie(o.layers,e,u.config_path));if(f.length>0){for(let e of f){if(e.diagnostics.length===0){j(`Unable to resolve tsconfig extends entry:`,JSON.stringify(e.extends_value),`in ${e.config_path}`);continue}for(let t of e.diagnostics)j(`Unable to resolve tsconfig extends entry:`,JSON.stringify(e.extends_value),`in ${e.config_path}`,n.flattenDiagnosticMessageText(t.messageText,`
4
+ `))}return null}if(u.state===`declared`)return oe(n,r,u.config_path,u.value)}const ce=(0,f.createRequire)(require(`url`).pathToFileURL(__filename).href),le=d.default.dirname((0,p.fileURLToPath)(require(`url`).pathToFileURL(__filename).href)),{log:z,logWarning:B,logError:V}=k(`[Ripple Language]`),H=new Set,U=[`.tsrx`],W=[[`@tsrx/ripple`,[`node_modules`,`@tsrx`,`ripple`],[`.tsrx`],[`@tsrx/ripple`,`ripple`,`@ripple-ts/vite-plugin`]],[`@tsrx/react`,[`node_modules`,`@tsrx`,`react`],[`.tsrx`],[`@tsrx/react`,`@tsrx/vite-plugin-react`]],[`@tsrx/solid`,[`node_modules`,`@tsrx`,`solid`],[`.tsrx`],[`@tsrx/solid`,`@tsrx/vite-plugin-solid`]],[`@tsrx/preact`,[`node_modules`,`@tsrx`,`preact`],[`.tsrx`],[`@tsrx/preact`,`@tsrx/vite-plugin-preact`]],[`@tsrx/vue`,[`node_modules`,`@tsrx`,`vue`],[`.tsrx`],[`@tsrx/vue`,`@tsrx/vite-plugin-vue`]],[`octane`,[`node_modules`,`octane`],[`.tsrx`],[`octane`,`@octanejs/vite-plugin`],[`src`,`compiler`,`volar.js`]]],G=[`src`,`index.js`];function ue(e){return U.some(t=>e.endsWith(t))}function de(e={}){z(`Creating Ripple language plugin...`);let t=e.ts??l.default,n={...e,ts:t,configHost:e.configHost??t.sys};return{getLanguageId(e){let t=typeof e==`string`?e:e.fsPath.replace(/\\/g,`/`);if(ue(t))return z(`Identified Ripple file:`,t),`ripple`},createVirtualCode(e,t,r){if(t===`ripple`){let t=Z(e),i=ge(t,n);if(!i){V(`Ripple compiler not found for file: ${t}`);return}z(`Creating virtual code for:`,t);try{return new K(t,r,i)}catch(e){throw V(`Failed to create virtual code for:`,t,`:`,e),e}}},updateVirtualCode(e,t,n){if(t instanceof K)return z(`Updating existing virtual code for:`,t.fileName),t.update(n),t},typescript:{extraFileExtensions:U.map(e=>({extension:e.slice(1),isMixedContent:!1,scriptKind:7})),getServiceScript(e){for(let t of(0,w.forEachEmbeddedCode)(e))if(t.languageId===`ripple`)return{code:t,extension:`.tsx`,scriptKind:4}},...process.env.TSRX_TSC===`true`?null:{getExtraServiceScripts(e,t){let n=[];for(let r of(0,w.forEachEmbeddedCode)(t))r.languageId===`typescript`&&n.push({fileName:`${e}.${r.id}.ts`,code:r,extension:`.ts`,scriptKind:l.default.ScriptKind.TS});return n}}}}}var K=class{id=`root`;languageId=`ripple`;codegenStacks=[];tsrx;generatedCode=``;embeddedCodes=[];mappings=[];fatalErrors=[];usageErrors=[];snapshot;sourceSnapshot;originalCode=``;sourceAst=null;isDotCompletionMode=!1;diagnostics=[];#e=null;#t=null;constructor(e,t,n){if(z(`Initializing TSRXVirtualCode for:`,e),this.fileName=e,this.tsrx=n,this.snapshot=t,this.sourceSnapshot=t,this.originalCode=t.getText(0,t.getLength()),!n||typeof n.compile_to_volar_mappings!=`function`)throw V(`Invalid ripple compiler - missing compile_to_volar_mappings method`),Error(`Invalid ripple compiler`);this.update(t)}update(e){z(`Updating virtual code for:`,this.fileName);let t=e.getText(0,e.getLength()),n=e.getChangeRange(this.sourceSnapshot);this.sourceSnapshot=e,this.#e=null,this.#t=null,this.fatalErrors=[],this.usageErrors=[],this.sourceAst=null,this.isDotCompletionMode=!1;let r,i=!1,a=-1;if(z(`changeRange:`,JSON.stringify(n)),n){let e=n.span.start,r=e+n.span.length,o=e+n.newLength,s=this.originalCode.substring(e,r),c=t.substring(e,o);if(z(`Change details:`),z(` Position:`,e,`-`,r,`(length:`,n.span.length,`)`),z(` Old text:`,JSON.stringify(s)),z(` New text:`,JSON.stringify(c),`(length:`,n.newLength,`)`),c.endsWith(`.`)){let e=o>1?t[o-2]:``;z(` Char before dot:`,JSON.stringify(e)),/[$#_\u200C\u200D\p{ID_Continue}\)\]\}]/u.test(e)&&(i=!0,a=o-1,z(`ChangeRange detected dot typed at position`,a))}}try{if(i&&a>=0){this.isDotCompletionMode=!0;let e=t.substring(0,a)+t.substring(a+1);if(z(`Compiling without typed dot at position`,a),r=this.tsrx.compile_to_volar_mappings(e,this.fileName,{loose:!0}),z(`Compilation without dot successful`),r&&r.code&&r.mappings.length>0){let e=me(r,a);e===null?B(`Failed to restore typed dot into transpiled output`):z(`Inserted typed dot at generated position`,e)}}else z(`Compiling Ripple code...`),r=this.tsrx.compile_to_volar_mappings(t,this.fileName,{loose:!0}),z(`Compilation successful, generated code length:`,r?.code?.length||0)}catch(e){let t=e;V(`Ripple compilation failed for`,this.fileName,`:`,t),process.env.TSRX_TSC===`true`&&J(this.fileName,[t]),t.type=`fatal`,this.fatalErrors.push(t)}if(r&&r.code){this.originalCode=t,this.generatedCode=r.code,this.mappings=r.mappings??[],this.usageErrors=r.errors,this.sourceAst=r.sourceAst,process.env.TSRX_TSC===`true`&&r.errors.length>0&&J(this.fileName,r.errors);let e=r.cssMappings,n=r.scriptMappings??[];if(e.length>0||n.length>0){z(`Creating`,e.length,`CSS and`,n.length,`script embedded codes`);let t=[];for(let n of e)t.push(Y(n,`css`));for(let e of n)t.push(Y(e,`typescript`));this.embeddedCodes=t}else this.embeddedCodes=[];if(O){z(`CSS embedded codes:`,(this.embeddedCodes||[]).length),z(`Using transpiled code, mapping count:`,this.mappings.length),z(`Original code length:`,t.length),z(`Generated code length:`,this.generatedCode.length),z(`Last 100 chars of original:`,JSON.stringify(t.slice(-100))),z(`Last 200 chars of generated:`,JSON.stringify(this.generatedCode.slice(-200))),z(`Last few mappings:`);let e=Math.max(0,this.mappings.length-5);for(let t=e;t<this.mappings.length;t++){let e=this.mappings[t];z(` Mapping ${t}: source[${e.sourceOffsets[0]}:${e.sourceOffsets[0]+e.lengths[0]}] -> gen[${e.generatedOffsets[0]}:${e.generatedOffsets[0]+e.lengths[0]}], len=${e.lengths[0]}, completion=${e.data?.completion}`)}}this.snapshot={getText:(e,t)=>this.generatedCode.substring(e,t),getLength:()=>this.generatedCode.length,getChangeRange:()=>void 0}}else z(`Compilation failed, only display where the compilation error occurred.`),this.originalCode=t,this.generatedCode=t,this.mappings=[{sourceOffsets:[0],generatedOffsets:[0],lengths:[t.length],generatedLengths:[t.length],data:{completion:!0,verification:!0,customData:{}}}],this.embeddedCodes=[...fe(t),...pe(t)],this.snapshot={getText:(e,t)=>this.generatedCode.substring(e,t),getLength:()=>this.generatedCode.length,getChangeRange:()=>void 0}}#n(){if(!(this.#e||this.#t)){this.#e=new Map,this.#t=new Map;for(var e,t,n,r,i,a,o,s,c,l=0;l<this.mappings.length;l++)e=this.mappings[l],t=e.generatedOffsets[0],n=e.generatedLengths[0],r=t+n,i=`${t}-${r}`,this.#e.set(i,e),a=e.sourceOffsets[0],o=e.lengths[0],s=a+o,c=`${a}-${s}`,this.#t.set(c,e)}}findMappingByGeneratedRange(e,t){return this.#n(),this.#e.get(`${e}-${t}`)??null}findMappingBySourceRange(e,t){return this.#n(),this.#t.get(`${e}-${t}`)??null}findGeneratedRangeBySourceRange(e,t){let n=null,r=null;for(let i=0;i<this.mappings.length;i++){let a=this.mappings[i],o=a.sourceOffsets[0],s=o+a.lengths[0];s<=e||o>=t||((!n||o<n.sourceOffsets[0])&&(n=a),(!r||s>r.sourceOffsets[0]+r.lengths[0])&&(r=a))}if(!n||!r)return null;let i=n.generatedOffsets[0]+q(e-n.sourceOffsets[0],n.generatedLengths[0]),a=r.generatedOffsets[0]+q(t-r.sourceOffsets[0],r.generatedLengths[0]);return[i,Math.max(a,i+1)]}};function q(e,t){return Math.min(Math.max(e,0),t)}function J(e,t){for(let n of t){let t=n&&typeof n==`object`&&`message`in n?String(n.message):String(n),r=`${e}\0${t}`;H.has(r)||(H.add(r),console.error(`[tsrx-tsc] ${e}: ${t}`))}}function fe(e){let t=[],n=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,r,i=0;for(;(r=n.exec(e))!==null;){let e=r[0],n=r[1],a=r.index+(e.indexOf(`>`)+1),o=n.length;z(`Extracted CSS region ${i}: offset ${a}, length ${o}`);let s={sourceOffsets:[a],generatedOffsets:[0],lengths:[o],generatedLengths:[o],data:{verification:!0,completion:!0,semantic:!0,navigation:!0,structure:!0,format:!1,customData:{content:n,embeddedId:`style_${i}`}}};t.push({id:`style_${i}`,languageId:`css`,snapshot:{getText:(e,t)=>n.substring(e,t),getLength:()=>o,getChangeRange:()=>void 0},mappings:[s],embeddedCodes:[]}),i++}return t.length>0&&z(`Extracted ${t.length} CSS embedded codes from style tags`),t}function Y(e,t){let n=e.data?.customData?.content??``;return{id:e.data?.customData?.embeddedId,languageId:t,snapshot:{getText:(e,t)=>n.substring(e,t),getLength:()=>e.lengths[0],getChangeRange:()=>void 0},mappings:[e],embeddedCodes:[]}}function pe(e){let t=[],n=/<script\b((?:[^>"'/]|"[^"]*"|'[^']*'|\/(?!>))*)>([\s\S]*?)<\/script>/gi,r,i=0;for(;(r=n.exec(e))!==null;){let e=r[1],n=r[2],a=r.index+(7+e.length+1),o=n.length,s=`script_${i}`;z(`Extracted script region ${i}: offset ${a}, length ${o}`);let c={sourceOffsets:[a],generatedOffsets:[0],lengths:[o],generatedLengths:[o],data:{verification:!0,completion:!0,semantic:!0,navigation:!0,structure:!0,format:!1,customData:{content:n,embeddedId:s}}};t.push(Y(c,`typescript`)),i++}return t.length>0&&z(`Extracted ${t.length} script embedded codes from script tags`),t}function me(e,t){let n=null;for(let r of e.mappings)if(r.sourceOffsets[0]+r.lengths[0]===t){n=r;break}if(!n)return null;let r=n.generatedLengths[0],i=n.generatedOffsets[0]+r;e.code=e.code.substring(0,i)+`.`+e.code.substring(i);let a={sourceOffsets:[t],generatedOffsets:[i],lengths:[1],generatedLengths:[1],data:{...n.data}},o=e.mappings.indexOf(n);e.mappings.splice(o+1,0,a);for(let r of e.mappings)r!==n&&r!==a&&r.generatedOffsets[0]>=i&&(r.generatedOffsets[0]+=1),r!==n&&r!==a&&r.sourceOffsets[0]>=t&&(r.sourceOffsets[0]+=1);return i}const he=new Map,X=new Map;function Z(e){return typeof e==`string`?e:e.fsPath.replace(/\\/g,`/`)}function Q(e,t=u.default.existsSync){let n=e,r=[];for(;n;){if(X.has(n)){let e=X.get(n)??null;for(let t of r)X.set(t,e);return e}r.push(n);let e=d.default.join(n,`package.json`);if(t(e))try{let t=JSON.parse(u.default.readFileSync(e,`utf8`)),n=new Set([...Object.keys(t.dependencies??{}),...Object.keys(t.devDependencies??{}),...Object.keys(t.peerDependencies??{}),...Object.keys(t.optionalDependencies??{})]),i={name:typeof t.name==`string`?t.name:null,dependencies:n};for(let e of r)X.set(e,i);return i}catch{for(let e of r)X.set(e,null);return null}let i=d.default.dirname(n);if(i===n)break;n=i}for(let e of r)X.set(e,null);return null}function $(e,t,n){if(!e)return!1;if(e.name===t||n.includes(e.name??``)||e.dependencies.has(t))return!0;for(let t of n)if(e.dependencies.has(t))return!0;return!1}function ge(e,t){let n=ye(e,t);if(n)return _e(ce(n))}function _e(e){return typeof e?.compile_to_volar_mappings!=`function`&&typeof e?.compileToVolarMappings==`function`?{...e,compile_to_volar_mappings:e.compileToVolarMappings}:e}function ve(e,t=u.default.existsSync,n=he){let r=e.split(`/`),i=d.default.extname(e);for(let e=r.length-2;e>=0;e--){let a=r.slice(0,e+1).join(`/`),o=a+`\0`+i;if(!n.has(o)){let e=[];for(let[n,r,o,s,c=G]of W){if(!o.includes(i))continue;let l=[a,...r,...c].join(`/`);t(l)&&e.push([n,l,s])}let r=null;if(e.length>0){let n=Q(a,t);r=e.find(([e,,t])=>$(n,e,t))?.[1]??e[0][1],z(`Found tsrx compiler at:`,r,`for extension:`,i)}n.set(o,r)}let s=n.get(o);if(s)return s}}function ye(e,t){let n=d.default.extname(e),r=se(e,t);if(r!==void 0)return r??void 0;let i=Q(d.default.dirname(e)),a=ve(e);if(a)return a;let o=`No supported tsrx compiler found in workspace for ${e}.`,s=le;for(;s;){let e=[];for(let[t,r,i,a,o=G]of W){if(!i.includes(n))continue;let c=d.default.join(s,...r),l=d.default.join(c,...o);u.default.existsSync(l)&&e.push([t,l,a])}if(e.length>0){let t=e.find(([e,,t])=>$(i,e,t))?.[1]??e[0][1];return B(`${o} Using packaged version at ${t}`),t}let t=d.default.dirname(s);if(t===s)break;s=t}}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return de}});
5
+ //# sourceMappingURL=language-CAvT8e35.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language-CAvT8e35.js","names":["exports","exports","path","source_file_with_diagnostics","typescript","ts","logError","logWarning","require","typescript","ts","#mappingGenToSource","#mappingSourceToGen","#buildMappingCache"],"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/tsconfig-resolution.js","../src/utils.js","../src/consumer-compiler.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","import path from 'node:path';\n\n/**\n * @typedef {object} TsconfigHost\n * @property {(file_name: string) => boolean} fileExists\n * @property {(file_name: string) => string | undefined} readFile\n * @property {import('typescript').ParseConfigHost['readDirectory']} readDirectory\n * @property {boolean | (() => boolean)} useCaseSensitiveFileNames\n * @property {import('typescript').System['getModifiedTime']} [getModifiedTime]\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 {import('typescript').Diagnostic[]} 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 {import('typescript').Diagnostic[]} diagnostics\n */\n\n/**\n * @typedef {object} ResolvedTsconfigLayers\n * @property {TsconfigLayer[]} layers\n * @property {string[]} dependencies\n * @property {import('typescript').Diagnostic[]} 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\nconst no_inputs_found_diagnostic_code = 18003;\nconst circularity_diagnostic_code = 18000;\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 *\n * @param {typeof import('typescript')} ts\n * @param {TsconfigHost} host\n * @param {string} config_file_name\n * @returns {ResolvedTsconfigLayers}\n */\nexport function load_tsconfig_layers(ts, 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 {import('typescript').Diagnostic[]} */\n\tconst diagnostics = [];\n\t/** @type {TsconfigExtendsFailure[]} */\n\tconst extends_failures = [];\n\tconst diagnostic_keys = new Set();\n\tconst active_stack = 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/** @type {import('typescript').ParseConfigHost} */\n\tconst parse_host = {\n\t\tfileExists: host.fileExists,\n\t\treadFile: host.readFile,\n\t\treadDirectory: host.readDirectory,\n\t\tuseCaseSensitiveFileNames: use_case_sensitive_file_names,\n\t};\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 {import('typescript').Diagnostic[]} next_diagnostics */\n\tfunction add_diagnostics(next_diagnostics) {\n\t\tfor (const diagnostic of next_diagnostics) {\n\t\t\tconst message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n\t\t\tconst key = `${diagnostic.code}\\0${diagnostic.file?.fileName ?? ''}\\0${diagnostic.start ?? ''}\\0${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/**\n\t * TypeScript does not expose a failed lookup path for extensionless relative\n\t * extends entries. Preserve the conventional JSON candidate so creating it\n\t * later invalidates both the mtime cache and the language-server project.\n\t * @param {ParsedTsconfigLayer} parsed\n\t * @param {unknown} extends_value\n\t */\n\tfunction get_unresolved_relative_dependency(parsed, extends_value) {\n\t\tif (\n\t\t\ttypeof extends_value !== 'string' ||\n\t\t\t(!path.isAbsolute(extends_value) && !extends_value.startsWith('.'))\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst candidate_path = path.resolve(parsed.dir, extends_value);\n\t\treturn path.extname(candidate_path) === '' ? `${candidate_path}.json` : candidate_path;\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\tconst source_file = ts.readJsonConfigFile(normalized_path, host.readFile);\n\t\tconst source_file_with_diagnostics = /** @type {typeof source_file & {\n\t\t * \tparseDiagnostics: readonly import('typescript').Diagnostic[],\n\t\t * }} */ (source_file);\n\t\t/** @type {import('typescript').Diagnostic[]} */\n\t\tconst parse_diagnostics = [...source_file_with_diagnostics.parseDiagnostics];\n\t\tconst converted_config = ts.convertToObject(source_file, parse_diagnostics);\n\t\tconst config =\n\t\t\tconverted_config !== null &&\n\t\t\ttypeof converted_config === 'object' &&\n\t\t\t!Array.isArray(converted_config)\n\t\t\t\t? /** @type {Record<string, unknown>} */ (converted_config)\n\t\t\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 with TypeScript's own config resolver.\n\t * A synthetic config isolates the edge; inherited files remain available to\n\t * TypeScript so relative, absolute, package, optional-suffix, and cycle\n\t * semantics stay aligned with parseJsonSourceFileConfigFileContent.\n\t *\n\t * @param {ParsedTsconfigLayer} parsed\n\t * @param {unknown} extends_value\n\t */\n\tfunction resolve_extends_path(parsed, extends_value) {\n\t\tconst synthetic_source = JSON.stringify({ extends: extends_value, files: [] });\n\t\tconst source_file = ts.readJsonConfigFile(parsed.path, () => synthetic_source);\n\t\tconst parsed_command_line = ts.parseJsonSourceFileConfigFileContent(\n\t\t\tsource_file,\n\t\t\tparse_host,\n\t\t\tparsed.dir,\n\t\t\t{},\n\t\t\tparsed.path,\n\t\t);\n\t\tconst edge_diagnostics = parsed_command_line.errors.filter(\n\t\t\t(diagnostic) => diagnostic.code !== no_inputs_found_diagnostic_code,\n\t\t);\n\t\tadd_diagnostics(edge_diagnostics);\n\t\tconst resolved_path = source_file.extendedSourceFiles?.[0];\n\t\tconst dependency_path =\n\t\t\tresolved_path ?? get_unresolved_relative_dependency(parsed, extends_value);\n\t\tif (dependency_path !== undefined) {\n\t\t\tadd_dependency(dependency_path);\n\t\t}\n\n\t\tconst has_cycle = edge_diagnostics.some(\n\t\t\t(diagnostic) => diagnostic.code === circularity_diagnostic_code,\n\t\t);\n\t\tconst is_unresolved = resolved_path === undefined || !host.fileExists(resolved_path);\n\t\tif (is_unresolved || has_cycle) {\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: edge_diagnostics,\n\t\t\t});\n\t\t}\n\t\treturn is_unresolved ? undefined : resolved_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\tif (active_stack.has(key)) {\n\t\t\treturn;\n\t\t}\n\n\t\tactive_stack.add(key);\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.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.RIPPLE_DEBUG === 'true';\n// Matches valid JS/CSS identifier characters: word chars, dashes (CSS), $, and # (Ripple 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/**\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 {object} CompilerResolutionOptions\n * @property {typeof import('typescript')} [ts]\n * @property {string} [configFileName]\n * @property {import('./tsconfig-resolution.js').TsconfigHost} [configHost]\n * @property {Set<string>} [dependencies]\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 ts from 'typescript';\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('[Ripple 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 * 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 {typeof import('typescript')} typescript\n * @param {import('./tsconfig-resolution.js').TsconfigHost} host\n * @param {string} root_config_path\n * @param {ConfigHostResolutionCache} cache\n */\nfunction get_tsconfig_layers(typescript, 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(typescript, 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.\n * `noDtsResolution` ensures the runtime entry wins over a package's types.\n * @param {typeof import('typescript')} typescript\n * @param {import('./tsconfig-resolution.js').TsconfigHost} host\n * @param {string} config_path\n * @param {string} specifier\n */\nfunction resolve_uncached_declared_compiler(typescript, host, config_path, specifier) {\n\treturn typescript.resolveModuleName(\n\t\tspecifier,\n\t\tconfig_path,\n\t\t{\n\t\t\tmodule: typescript.ModuleKind.Node16,\n\t\t\tmoduleResolution: typescript.ModuleResolutionKind.Node16,\n\t\t\tnoDtsResolution: true,\n\t\t},\n\t\thost,\n\t\tundefined,\n\t\tundefined,\n\t\ttypescript.ModuleKind.CommonJS,\n\t).resolvedModule?.resolvedFileName;\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 {typeof import('typescript')} typescript\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(typescript, 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(\n\t\t\ttypescript,\n\t\t\thost,\n\t\t\tconfig_path,\n\t\t\tspecifier,\n\t\t);\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 typescript = options.ts ?? ts;\n\tconst config_host = options.configHost ?? typescript.sys;\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(\n\t\ttypescript,\n\t\tconfig_host,\n\t\troot_config_path,\n\t\thost_cache,\n\t);\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(\n\t\t\t\t\t'Unable to parse tsconfig layer:',\n\t\t\t\t\tlayer.path,\n\t\t\t\t\ttypescript.flattenDiagnosticMessageText(diagnostic.messageText, '\\n'),\n\t\t\t\t);\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\ttypescript.flattenDiagnosticMessageText(diagnostic.messageText, '\\n'),\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(\n\t\t\ttypescript,\n\t\t\tconfig_host,\n\t\t\tdeclaration.config_path,\n\t\t\tdeclaration.value,\n\t\t);\n\t}\n\treturn 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/** @typedef {{ code?: string, errors?: CompileError[] }} TSRXCompileResult */\n/** @typedef {{ compile?: (source: string, filename: string, options?: { loose?: boolean }) => TSRXCompileResult, compile_to_volar_mappings(source: string, filename: string, options?: { loose?: boolean }): VolarMappingsResult }} TSRXCompilerModule */\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>} RippleLanguagePlugin */\n\n/** @typedef {InstanceType<typeof import('./language.js')[\"TSRXVirtualCode\"]>} TSRXVirtualCodeInstance */\n\nimport ts from 'typescript';\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} from './consumer-compiler.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('[Ripple Language]');\n/** @type {Set<string>} */\nconst loggedCompilationFailures = new Set();\nexport const RIPPLE_EXTENSIONS = ['.tsrx'];\n/** @typedef {[string, string[], string[], string[], string[]?]} CompilerCandidate */\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'octane',\n\t\t['node_modules', 'octane'],\n\t\t['.tsrx'],\n\t\t['octane', '@octanejs/vite-plugin'],\n\t\t['src', 'compiler', 'volar.js'],\n\t],\n];\n\nconst DEFAULT_COMPILER_ENTRY_PARTS = ['src', 'index.js'];\n\n/**\n * @param {string} file_name\n * @returns {boolean}\n */\nexport function is_ripple_file(file_name) {\n\treturn RIPPLE_EXTENSIONS.some((extension) => file_name.endsWith(extension));\n}\n\n/**\n * @param {CompilerResolutionOptions} [options]\n * @returns {RippleLanguagePlugin}\n */\nexport function getRippleLanguagePlugin(options = {}) {\n\tlog('Creating Ripple language plugin...');\n\tconst typescript = options.ts ?? ts;\n\t/** @type {CompilerResolutionOptions} */\n\tconst compiler_resolution_options = {\n\t\t...options,\n\t\tts: typescript,\n\t\tconfigHost: options.configHost ?? typescript.sys,\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_ripple_file(file_name)) {\n\t\t\t\tlog('Identified Ripple file:', file_name);\n\t\t\t\treturn 'ripple';\n\t\t\t}\n\t\t},\n\t\tcreateVirtualCode(fileNameOrUri, languageId, snapshot) {\n\t\t\tif (languageId === 'ripple') {\n\t\t\t\tconst file_name = normalizeFileNameOrUri(fileNameOrUri);\n\t\t\t\tconst ripple = get_tsrx_compiler(file_name, compiler_resolution_options);\n\t\t\t\tif (!ripple) {\n\t\t\t\t\tlogError(`Ripple 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, ripple);\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: RIPPLE_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} ripple_code\n\t\t\t */\n\t\t\tgetServiceScript(ripple_code) {\n\t\t\t\tfor (const code of forEachEmbeddedCode(ripple_code)) {\n\t\t\t\t\tif (code.languageId === 'ripple') {\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\t// Volar's tsc program proxy (`proxyCreateProgram`) does not support\n\t\t\t// extra service scripts and warns ONCE PER PARSED FILE when the hook\n\t\t\t// is merely present — omit it entirely under tsrx-tsc (the bin sets\n\t\t\t// TSRX_TSC before loading this module).\n\t\t\t...(process.env.TSRX_TSC === 'true'\n\t\t\t\t? null\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Register each embedded `<script>` body as its own TypeScript service\n\t\t\t\t\t\t * script so volar-service-typescript's semantic features (type-aware\n\t\t\t\t\t\t * completions, hover, go-to-definition, diagnostics, imports) run against it\n\t\t\t\t\t\t * and map back to the `.tsrx` source — the same way `<style>` bodies get CSS\n\t\t\t\t\t\t * intellisense, except semantic TS additionally requires a service-script\n\t\t\t\t\t\t * registration (a self-contained languageId is not enough).\n\t\t\t\t\t\t *\n\t\t\t\t\t\t * The returned `code` must be the exact same instance stored in the root's\n\t\t\t\t\t\t * `embeddedCodes` (volar matches it by identity), and each `fileName` must be\n\t\t\t\t\t\t * unique. Only honored on the language-server (`createTypeScriptProject`)\n\t\t\t\t\t\t * path, not the tsserver-plugin path.\n\t\t\t\t\t\t * @param {string} fileName\n\t\t\t\t\t\t * @param {VirtualCode} ripple_code\n\t\t\t\t\t\t */\n\t\t\t\t\t\tgetExtraServiceScripts(fileName, ripple_code) {\n\t\t\t\t\t\t\t/** @type {Array<{ fileName: string, code: VirtualCode, extension: string, scriptKind: number }>} */\n\t\t\t\t\t\t\tconst scripts = [];\n\t\t\t\t\t\t\tfor (const code of forEachEmbeddedCode(ripple_code)) {\n\t\t\t\t\t\t\t\tif (code.languageId === 'typescript') {\n\t\t\t\t\t\t\t\t\tscripts.push({\n\t\t\t\t\t\t\t\t\t\tfileName: `${fileName}.${code.id}.ts`,\n\t\t\t\t\t\t\t\t\t\tcode,\n\t\t\t\t\t\t\t\t\t\textension: '.ts',\n\t\t\t\t\t\t\t\t\t\tscriptKind: ts.ScriptKind.TS,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn scripts;\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t},\n\t};\n}\n\n/**\n * @implements {VirtualCode}\n */\nexport class TSRXVirtualCode {\n\t/** @type {string} */\n\tid = 'root';\n\t/** @type {string} */\n\tlanguageId = 'ripple';\n\t/** @type {unknown[]} */\n\tcodegenStacks = [];\n\t/** @type {TSRXCompilerModule} */\n\ttsrx;\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 */\n\tconstructor(file_name, snapshot, tsrx) {\n\t\tlog('Initializing TSRXVirtualCode for:', file_name);\n\n\t\tthis.fileName = file_name;\n\t\tthis.tsrx = tsrx;\n\t\tthis.snapshot = snapshot;\n\t\tthis.sourceSnapshot = snapshot;\n\t\tthis.originalCode = snapshot.getText(0, snapshot.getLength());\n\n\t\t// Validate ripple compiler\n\t\tif (!tsrx || typeof tsrx.compile_to_volar_mappings !== 'function') {\n\t\t\tlogError('Invalid ripple compiler - missing compile_to_volar_mappings method');\n\t\t\tthrow new Error('Invalid ripple 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/** @type {VolarMappingsResult | undefined} */\n\t\tlet transpiled;\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\ttry {\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\ttranspiled = this.tsrx.compile_to_volar_mappings(codeWithoutDot, this.fileName, {\n\t\t\t\t\tloose: true,\n\t\t\t\t});\n\t\t\t\tlog('Compilation without dot successful');\n\n\t\t\t\tif (transpiled && transpiled.code && transpiled.mappings.length > 0) {\n\t\t\t\t\tconst insertedDotPosition = restore_typed_dot_in_transpiled_code(transpiled, 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\t// Normal compilation\n\t\t\t\tlog('Compiling Ripple code...');\n\t\t\t\ttranspiled = this.tsrx.compile_to_volar_mappings(newCode, this.fileName, {\n\t\t\t\t\tloose: true,\n\t\t\t\t});\n\t\t\t\tlog('Compilation successful, generated code length:', transpiled?.code?.length || 0);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconst error = /** @type {CompileError} */ (e);\n\t\t\tlogError('Ripple compilation failed for', this.fileName, ':', error);\n\t\t\tif (process.env.TSRX_TSC === 'true') {\n\t\t\t\tlogTSRXErrors(this.fileName, [error]);\n\t\t\t}\n\t\t\terror.type = 'fatal';\n\t\t\tthis.fatalErrors.push(error);\n\t\t}\n\n\t\tif (transpiled && transpiled.code) {\n\t\t\t// Successful compilation - update everything\n\t\t\tthis.originalCode = newCode;\n\t\t\tthis.generatedCode = transpiled.code;\n\t\t\tthis.mappings = transpiled.mappings ?? [];\n\t\t\tthis.usageErrors = transpiled.errors;\n\t\t\tthis.sourceAst = transpiled.sourceAst;\n\n\t\t\tif (process.env.TSRX_TSC === 'true' && transpiled.errors.length > 0) {\n\t\t\t\tlogTSRXErrors(this.fileName, transpiled.errors);\n\t\t\t}\n\n\t\t\tconst cssMappings = transpiled.cssMappings;\n\t\t\tconst scriptMappings = transpiled.scriptMappings ?? [];\n\t\t\tif (cssMappings.length > 0 || scriptMappings.length > 0) {\n\t\t\t\tlog(\n\t\t\t\t\t'Creating',\n\t\t\t\t\tcssMappings.length,\n\t\t\t\t\t'CSS and',\n\t\t\t\t\tscriptMappings.length,\n\t\t\t\t\t'script embedded codes',\n\t\t\t\t);\n\n\t\t\t\t/** @type {VirtualCode[]} */\n\t\t\t\tconst embedded = [];\n\t\t\t\tfor (const mapping of cssMappings) {\n\t\t\t\t\tembedded.push(create_embedded_code_from_mapping(mapping, 'css'));\n\t\t\t\t}\n\t\t\t\tfor (const mapping of scriptMappings) {\n\t\t\t\t\t// Every script body is treated as TypeScript in the editor — TS is a\n\t\t\t\t\t// superset of JS, and this matches the TextMate/tree-sitter/prettier\n\t\t\t\t\t// treatment. The `type` attribute only matters to the runtime\n\t\t\t\t\t// transforms, which read it off the AST.\n\t\t\t\t\tembedded.push(create_embedded_code_from_mapping(mapping, 'typescript'));\n\t\t\t\t}\n\t\t\t\tthis.embeddedCodes = embedded;\n\t\t\t} else {\n\t\t\t\tthis.embeddedCodes = [];\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\n\t\t\tthis.snapshot = /** @type {IScriptSnapshot} */ ({\n\t\t\t\tgetText: (start, end) => this.generatedCode.substring(start, end),\n\t\t\t\tgetLength: () => this.generatedCode.length,\n\t\t\t\tgetChangeRange: () => undefined,\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\tthis.originalCode = newCode;\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 Ripple 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> and JS/TS from <script> tags for embedded codes,\n\t\t\t// so CSS and script intellisense keep working while the file has a transient\n\t\t\t// compile error elsewhere.\n\t\t\tthis.embeddedCodes = [...extractCssFromSource(newCode), ...extractScriptFromSource(newCode)];\n\n\t\t\tthis.snapshot = /** @type {IScriptSnapshot} */ ({\n\t\t\t\tgetText: (start, end) => this.generatedCode.substring(start, end),\n\t\t\t\tgetLength: () => this.generatedCode.length,\n\t\t\t\tgetChangeRange: () => undefined,\n\t\t\t});\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 * Extract CSS content from <style>...</style> tags in source code\n * @param {string} code - The source code to extract CSS from\n * @returns {VirtualCode[]} Array of embedded CSS virtual codes\n */\nfunction extractCssFromSource(code) {\n\t/** @type {VirtualCode[]} */\n\tconst embeddedCodes = [];\n\tconst styleRegex = /<style\\b[^>]*>([\\s\\S]*?)<\\/style>/gi;\n\tlet match;\n\tlet index = 0;\n\n\twhile ((match = styleRegex.exec(code)) !== null) {\n\t\tconst fullMatch = match[0];\n\t\tconst cssContent = match[1];\n\t\tconst styleTagStart = match.index;\n\t\tconst openTagEnd = fullMatch.indexOf('>') + 1;\n\t\tconst cssStart = styleTagStart + openTagEnd;\n\t\tconst cssLength = cssContent.length;\n\n\t\tlog(`Extracted CSS region ${index}: offset ${cssStart}, length ${cssLength}`);\n\n\t\t/** @type {CodeMapping} */\n\t\tconst mapping = {\n\t\t\tsourceOffsets: [cssStart],\n\t\t\tgeneratedOffsets: [0],\n\t\t\tlengths: [cssLength],\n\t\t\tgeneratedLengths: [cssLength],\n\t\t\tdata: {\n\t\t\t\tverification: true,\n\t\t\t\tcompletion: true,\n\t\t\t\tsemantic: true,\n\t\t\t\tnavigation: true,\n\t\t\t\tstructure: true,\n\t\t\t\tformat: false,\n\t\t\t\tcustomData: {\n\t\t\t\t\tcontent: cssContent,\n\t\t\t\t\tembeddedId: `style_${index}`,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\tembeddedCodes.push({\n\t\t\tid: `style_${index}`,\n\t\t\tlanguageId: 'css',\n\t\t\tsnapshot: {\n\t\t\t\tgetText: (start, end) => cssContent.substring(start, end),\n\t\t\t\tgetLength: () => cssLength,\n\t\t\t\tgetChangeRange: () => undefined,\n\t\t\t},\n\t\t\tmappings: [mapping],\n\t\t\tembeddedCodes: [],\n\t\t});\n\n\t\tindex++;\n\t}\n\n\tif (embeddedCodes.length > 0) {\n\t\tlog(`Extracted ${embeddedCodes.length} CSS embedded codes from style tags`);\n\t}\n\n\treturn embeddedCodes;\n}\n\n/**\n * Build an embedded virtual code from a single mapping produced by the compiler\n * (`cssMappings` / `scriptMappings`). The embedded document text is the region's\n * `customData.content`; `languageId` selects which Volar service handles it\n * (`css`, `typescript`, or `javascript`).\n * @param {CodeMapping} mapping\n * @param {string} languageId\n * @returns {VirtualCode}\n */\nfunction create_embedded_code_from_mapping(mapping, languageId) {\n\tconst content = /** @type {string} */ (mapping.data?.customData?.content ?? '');\n\treturn {\n\t\tid: /** @type {string} */ (mapping.data?.customData?.embeddedId),\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: () => mapping.lengths[0],\n\t\t\tgetChangeRange: () => undefined,\n\t\t},\n\t\tmappings: [mapping],\n\t\tembeddedCodes: [],\n\t};\n}\n\n/**\n * Extract raw script content from `<script>...</script>` tags in source code, used\n * as a fallback for script intellisense while the file has a fatal compile error\n * (no AST available — the normal path derives regions from the compiler's\n * `scriptMappings` instead). Parallels {@link extractCssFromSource}.\n * Every body is treated as TypeScript (a superset of JS), so the attributes are\n * never inspected. The opening-tag pattern refuses to match self-closing\n * `<script src=... />` tags (the `/` before `>` must not close the tag), so they\n * can't swallow a later real script's body.\n * @param {string} code - The source code to extract scripts from\n * @returns {VirtualCode[]} Array of embedded TypeScript virtual codes\n */\nfunction extractScriptFromSource(code) {\n\t/** @type {VirtualCode[]} */\n\tconst embeddedCodes = [];\n\tconst scriptRegex = /<script\\b((?:[^>\"'/]|\"[^\"]*\"|'[^']*'|\\/(?!>))*)>([\\s\\S]*?)<\\/script>/gi;\n\tlet match;\n\tlet index = 0;\n\n\twhile ((match = scriptRegex.exec(code)) !== null) {\n\t\tconst attrs = match[1];\n\t\tconst scriptContent = match[2];\n\t\tconst scriptTagStart = match.index;\n\t\t// `<script` + attrs + `>`; attrs may contain a quoted `>`, so derive the\n\t\t// opening tag's end from the match structure rather than searching for `>`.\n\t\tconst openTagEnd = '<script'.length + attrs.length + 1;\n\t\tconst scriptStart = scriptTagStart + openTagEnd;\n\t\tconst scriptLength = scriptContent.length;\n\t\tconst id = `script_${index}`;\n\n\t\tlog(`Extracted script region ${index}: offset ${scriptStart}, length ${scriptLength}`);\n\n\t\t/** @type {CodeMapping} */\n\t\tconst mapping = {\n\t\t\tsourceOffsets: [scriptStart],\n\t\t\tgeneratedOffsets: [0],\n\t\t\tlengths: [scriptLength],\n\t\t\tgeneratedLengths: [scriptLength],\n\t\t\tdata: {\n\t\t\t\tverification: true,\n\t\t\t\tcompletion: true,\n\t\t\t\tsemantic: true,\n\t\t\t\tnavigation: true,\n\t\t\t\tstructure: true,\n\t\t\t\tformat: false,\n\t\t\t\tcustomData: {\n\t\t\t\t\tcontent: scriptContent,\n\t\t\t\t\tembeddedId: id,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\tembeddedCodes.push(create_embedded_code_from_mapping(mapping, 'typescript'));\n\n\t\tindex++;\n\t}\n\n\tif (embeddedCodes.length > 0) {\n\t\tlog(`Extracted ${embeddedCodes.length} script embedded codes from script tags`);\n\t}\n\n\treturn embeddedCodes;\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 {VolarMappingsResult} 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.code =\n\t\ttranspiled.code.substring(0, insertedDotPosition) +\n\t\t'.' +\n\t\ttranspiled.code.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// #ripple → _$__u0023_ripple), 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// 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/** @param {string} libName */\n\tconst normalizeLibName = (libName) => {\n\t\tif (typeof libName !== 'string' || libName.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst trimmed = libName.trim();\n\t\tif (trimmed.startsWith('lib.')) {\n\t\t\treturn trimmed.toLowerCase();\n\t\t}\n\t\treturn `lib.${trimmed.toLowerCase().replace(/\\s+/g, '').replace(/_/g, '.')}\\.d.ts`;\n\t};\n\n\tconst normalizedLibs = new Set(\n\t\t(options.lib ?? []).map(normalizeLibName).filter((lib) => typeof lib === 'string'),\n\t);\n\n\tif (normalizedLibs.size === 0) {\n\t\tconst host = ts.createCompilerHost(options);\n\t\tconst defaultLibFileName = host.getDefaultLibFileName(options).toLowerCase();\n\t\tnormalizedLibs.add(defaultLibFileName);\n\t\tnormalizedLibs.add('lib.dom.d.ts');\n\t\tnormalizedLibs.add('lib.dom.iterable.d.ts');\n\t}\n\n\toptions.lib = [...normalizedLibs];\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 path2RipplePathMap = 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 * @param {string} normalized_file_name\n * @param {CompilerResolutionOptions} [options]\n * @returns {TSRXCompilerModule | undefined}\n */\nfunction 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\tconst compiler_module = require(compiler_path);\n\t\treturn normalize_tsrx_compiler_module(compiler_module);\n\t}\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 = path2RipplePathMap,\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_parts = DEFAULT_COMPILER_ENTRY_PARTS,\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\tconst full_path = [dir, ...compiler_dir_parts, ...entry_parts].join('/');\n\t\t\t\tif (exists_sync(full_path)) {\n\t\t\t\t\tavailable_candidates.push([compiler_name, full_path, package_hints]);\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_parts = DEFAULT_COMPILER_ENTRY_PARTS,\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\tconst entry_path = path.join(full_path, ...entry_parts);\n\t\t\tif (fs.existsSync(entry_path)) {\n\t\t\t\tavailable_candidates.push([compiler_name, entry_path, package_hints]);\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_parts = DEFAULT_COMPILER_ENTRY_PARTS,\n\t] of COMPILER_CANDIDATES) {\n\t\tconst suffix = '/' + [...compiler_dir_parts, ...entry_parts].join('/');\n\t\tif (normalized_entry.endsWith(suffix)) {\n\t\t\treturn compiler_name;\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_platform_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 ripple 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 getRippleDirForFile };\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\tpath2RipplePathMap.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],"mappings":"wtBACA,OAAO,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GAAI,CAAC,EAAqB,SAAS,EAAI,CACtC,SAED,IAAM,EAAY,EAAA,QAAK,KAAK,EAAa,GAAG,EAAmB,CACzD,EAAa,EAAA,QAAK,KAAK,EAAW,GAAG,EAAY,CACnD,EAAA,QAAG,WAAW,EAAW,EAC5B,EAAqB,KAAK,CAAC,EAAe,EAAY,EAAc,CAAC,CAIvE,GAAI,EAAqB,OAAS,EAAG,CAIpC,IAAM,EAHsB,EAAqB,MAAM,CAAC,GAAiB,KACxE,EAAkC,EAAkB,EAAe,EAAc,CAE5C,GAAG,IAAM,EAAqB,GAAG,GAEvE,OADA,EAAW,GAAG,EAAa,6BAA6B,IAAa,CAC9D,EAGR,IAAM,EAAa,EAAA,QAAK,QAAQ,EAAY,CAC5C,GAAI,IAAe,EAClB,MAED,EAAc"}
package/dist/tsc.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- const e=require(`./language-D4ww-Lgr.js`),t=(0,require(`node:module`).createRequire)(require(`url`).pathToFileURL(__filename).href),{runTsc:n}=t(`@volar/typescript/lib/quickstart/runTsc.js`),r=t.resolve(`typescript/lib/tsc.js`);process.env.TSRX_TSC=`true`,n(r,{extraSupportedExtensions:[`.tsrx`],extraExtensionsToRemove:[`.tsrx`]},()=>[e.t()]);
2
+ const e=require(`./language-CAvT8e35.js`),t=(0,require(`node:module`).createRequire)(require(`url`).pathToFileURL(__filename).href),{runTsc:n}=t(`@volar/typescript/lib/quickstart/runTsc.js`),r=t.resolve(`typescript/lib/tsc.js`);process.env.TSRX_TSC=`true`,n(r,{extraSupportedExtensions:[`.tsrx`],extraExtensionsToRemove:[`.tsrx`]},(t,n)=>{let r=n.options;return[e.t({ts:t,configFileName:r.configFile?.fileName??r.configFilePath,configHost:t.sys})]});
3
3
  //# sourceMappingURL=tsc.js.map
package/dist/tsc.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tsc.js","names":["require","getRippleLanguagePlugin"],"sources":["../src/tsc.js"],"sourcesContent":["#!/usr/bin/env node\n\nimport { createRequire } from 'node:module';\nimport { getRippleLanguagePlugin } from './language.js';\n\nconst require = createRequire(import.meta.url);\nconst { runTsc } = /** @type {typeof import('@volar/typescript/lib/quickstart/runTsc.js')} */ (\n\trequire('@volar/typescript/lib/quickstart/runTsc.js')\n);\nconst tscPath = require.resolve('typescript/lib/tsc.js');\n\nprocess.env.TSRX_TSC = 'true';\n\nrunTsc(\n\ttscPath,\n\t{\n\t\textraSupportedExtensions: ['.tsrx'],\n\t\textraExtensionsToRemove: ['.tsrx'],\n\t},\n\t() => [getRippleLanguagePlugin()],\n);\n"],"mappings":";0CAKMA,GAAAA,wBAAAA,CAAAA,eAAAA,QAAAA,MAAAA,CAAAA,cAAAA,WAAAA,CAAAA,KAAwC,CACxC,CAAE,UACPA,EAAQ,6CAA6C,CAEhD,EAAUA,EAAQ,QAAQ,wBAAwB,CAExD,QAAQ,IAAI,SAAW,OAEvB,EACC,EACA,CACC,yBAA0B,CAAC,QAAQ,CACnC,wBAAyB,CAAC,QAAQ,CAClC,KACK,CAACC,EAAAA,GAAyB,CAAC,CACjC"}
1
+ {"version":3,"file":"tsc.js","names":["require","getRippleLanguagePlugin"],"sources":["../src/tsc.js"],"sourcesContent":["#!/usr/bin/env node\n\nimport { createRequire } from 'node:module';\nimport { getRippleLanguagePlugin } from './language.js';\n\nconst require = createRequire(import.meta.url);\nconst { runTsc } = /** @type {typeof import('@volar/typescript/lib/quickstart/runTsc.js')} */ (\n\trequire('@volar/typescript/lib/quickstart/runTsc.js')\n);\nconst tscPath = require.resolve('typescript/lib/tsc.js');\n\nprocess.env.TSRX_TSC = 'true';\n\nrunTsc(\n\ttscPath,\n\t{\n\t\textraSupportedExtensions: ['.tsrx'],\n\t\textraExtensionsToRemove: ['.tsrx'],\n\t},\n\t(ts, create_program_options) => {\n\t\tconst compiler_options = /** @type {import('typescript').CompilerOptions & {\n\t\t * configFile?: import('typescript').TsConfigSourceFile,\n\t\t * configFilePath?: string,\n\t\t * }} */ (create_program_options.options);\n\t\treturn [\n\t\t\tgetRippleLanguagePlugin({\n\t\t\t\tts,\n\t\t\t\tconfigFileName: compiler_options.configFile?.fileName ?? compiler_options.configFilePath,\n\t\t\t\tconfigHost: ts.sys,\n\t\t\t}),\n\t\t];\n\t},\n);\n"],"mappings":";0CAKMA,GAAAA,wBAAAA,CAAAA,eAAAA,QAAAA,MAAAA,CAAAA,cAAAA,WAAAA,CAAAA,KAAwC,CACxC,CAAE,UACPA,EAAQ,6CAA6C,CAEhD,EAAUA,EAAQ,QAAQ,wBAAwB,CAExD,QAAQ,IAAI,SAAW,OAEvB,EACC,EACA,CACC,yBAA0B,CAAC,QAAQ,CACnC,wBAAyB,CAAC,QAAQ,CAClC,EACA,EAAI,IAA2B,CAC/B,IAAM,EAGI,EAAuB,QACjC,MAAO,CACNC,EAAAA,EAAwB,CACvB,KACA,eAAgB,EAAiB,YAAY,UAAY,EAAiB,eAC1E,WAAY,EAAG,IACf,CAAC,CACF,EAEF"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "TypeScript plugin for TSRX",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.3.104",
6
+ "version": "0.3.105",
7
7
  "main": "dist/index.js",
8
8
  "bin": {
9
9
  "tsrx-tsc": "./dist/tsc.js"
@@ -36,8 +36,8 @@
36
36
  "octane": "*",
37
37
  "@tsrx/react": "0.2.44",
38
38
  "@tsrx/ripple": "0.1.45",
39
- "@tsrx/solid": "0.1.44",
40
39
  "@tsrx/preact": "0.1.44",
40
+ "@tsrx/solid": "0.1.44",
41
41
  "@tsrx/vue": "0.1.44"
42
42
  },
43
43
  "peerDependenciesMeta": {
@@ -1,2 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`typescript`);l=c(l,1);let u=require(`fs`);u=c(u,1);let d=require(`path`);d=c(d,1);let f=require(`module`),p=require(`url`);var m=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.binarySearch=t;function t(e,t){let n=0,r=e.length-1,i;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o<t)n=a+1;else if(o>t)r=a-1;else{n=a,r=a,i=a;break}}return{low:Math.max(Math.min(n,r,e.length-1),0),high:Math.min(Math.max(n,r,0),e.length-1),match:i}}})),h=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.translateOffset=n;let t=!1;function n(e,n,r,i,a=i,o=!1){if(!n.every((e,t)=>t===0||n[t-1]<=e)){for(let t=0;t<n.length;t++){let s=n[t],c=i[t];if(e>=s&&e<=s+c){let n=a[t],i=r[t],l,u=e-s;return l=o&&n>c&&u===c?n:Math.min(u,n),i+l}}t||(t=!0,console.warn(`fromOffsets should be sorted in ascending order`))}let s=0,c=n.length-1;for(;s<=c;){let t=Math.floor((s+c)/2),l=n[t],u=i[t];if(e>=l&&e<=l+u){let n=a[t],i=r[t],s,c=e-l;return s=o&&n>u&&c===u?n:Math.min(c,n),i+s}else e<l?c=t-1:s=t+1}}})),g=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SourceMap=void 0;let t=m(),n=h();e.SourceMap=class{constructor(e){this.mappings=e}toSourceRange(e,t,n,r){return this.findMatchingStartEnd(e,t,n,`generatedOffsets`,r)}toGeneratedRange(e,t,n,r){return this.findMatchingStartEnd(e,t,n,`sourceOffsets`,r)}toSourceLocation(e,t){return this.findMatchingOffsets(e,`generatedOffsets`,t)}toGeneratedLocation(e,t){return this.findMatchingOffsets(e,`sourceOffsets`,t)}*findMatchingOffsets(e,i,a,o=!1){let s=this.getMemoBasedOnRange(i);if(s.offsets.length===0)return;let{low:c,high:l}=(0,t.binarySearch)(s.offsets,e),u=new Set,d=i===`sourceOffsets`?`generatedOffsets`:`sourceOffsets`;for(let t=c;t<=l;t++)for(let c of s.mappings[t]){if(u.has(c)||(u.add(c),a&&!a(c.data)))continue;let t=(0,n.translateOffset)(e,c[i],c[d],r(c,i),r(c,d),o);t!==void 0&&(yield[t,c])}}*findMatchingStartEnd(e,t,i,a,o){let s=a===`sourceOffsets`?`generatedOffsets`:`sourceOffsets`,c=s===`sourceOffsets`,l=[],u=!1;for(let[i,d]of this.findMatchingOffsets(e,a)){if(o&&!o(d.data))continue;l.push([i,d]);let e=(0,n.translateOffset)(t,d[a],d[s],r(d,a),r(d,s),c);e!==void 0&&(u=!0,yield[i,e,d,d])}if(!u&&i){for(let[e,n]of l)for(let[r,i]of this.findMatchingOffsets(t,a,void 0,c))if(!(o&&!o(i.data)||r<e)){yield[e,r,n,i];break}}}getMemoBasedOnRange(e){return e===`sourceOffsets`?this.sourceCodeOffsetsMemo??=this.createMemo(`sourceOffsets`):this.generatedCodeOffsetsMemo??=this.createMemo(`generatedOffsets`)}createMemo(e){let n=new Set;for(let t of this.mappings)for(let i=0;i<t[e].length;i++)n.add(t[e][i]),n.add(t[e][i]+r(t,e)[i]);let i=[...n].sort((e,t)=>e-t),a=i.map(()=>new Set);for(let n of this.mappings)for(let o=0;o<n[e].length;o++){let s=(0,t.binarySearch)(i,n[e][o]).match,c=(0,t.binarySearch)(i,n[e][o]+r(n,e)[o]).match;for(let e=s;e<=c;e++)a[e].add(n)}return{offsets:i,mappings:a}}};function r(e,t){return t===`sourceOffsets`?e.lengths:e.generatedLengths??e.lengths}})),_=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(g(),e),n(h(),e)})),v=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isHoverEnabled=t,e.isInlayHintsEnabled=n,e.isCodeLensEnabled=r,e.isMonikerEnabled=i,e.isInlineValueEnabled=a,e.isSemanticTokensEnabled=o,e.isCallHierarchyEnabled=s,e.isTypeHierarchyEnabled=c,e.isRenameEnabled=l,e.isDefinitionEnabled=u,e.isTypeDefinitionEnabled=d,e.isReferencesEnabled=f,e.isImplementationEnabled=p,e.isHighlightEnabled=m,e.isSymbolsEnabled=h,e.isFoldingRangesEnabled=g,e.isSelectionRangesEnabled=_,e.isLinkedEditingEnabled=v,e.isColorEnabled=y,e.isDocumentLinkEnabled=b,e.isDiagnosticsEnabled=x,e.isCodeActionsEnabled=S,e.isFormattingEnabled=C,e.isCompletionEnabled=w,e.isAutoInsertEnabled=T,e.isSignatureHelpEnabled=E,e.shouldReportDiagnostics=D,e.resolveRenameNewName=O,e.resolveRenameEditText=k,e.findOverlapCodeRange=A;function t(e){return!!e.semantic}function n(e){return!!e.semantic}function r(e){return!!e.semantic}function i(e){return!!e.semantic}function a(e){return!!e.semantic}function o(e){return typeof e.semantic==`object`?e.semantic.shouldHighlight?.()??!0:!!e.semantic}function s(e){return!!e.navigation}function c(e){return!!e.navigation}function l(e){return typeof e.navigation==`object`?e.navigation.shouldRename?.()??!0:!!e.navigation}function u(e){return!!e.navigation}function d(e){return!!e.navigation}function f(e){return!!e.navigation}function p(e){return!!e.navigation}function m(e){return typeof e.navigation==`object`?e.navigation.shouldHighlight?.()??!0:!!e.navigation}function h(e){return!!e.structure}function g(e){return!!e.structure}function _(e){return!!e.structure}function v(e){return!!e.structure}function y(e){return!!e.structure}function b(e){return!!e.structure}function x(e){return!!e.verification}function S(e){return!!e.verification}function C(e){return!!e.format}function w(e){return!!e.completion}function T(e){return!!e.completion}function E(e){return!!e.completion}function D(e,t,n){return typeof e.verification==`object`?e.verification.shouldReport?.(t,n)??!0:!!e.verification}function O(e,t){return typeof t.navigation==`object`?t.navigation.resolveRenameNewName?.(e)??e:e}function k(e,t){return typeof t.navigation==`object`?t.navigation.resolveRenameEditText?.(e)??e:e}function A(e,t,n,r){let i,a;for(let[t,a]of n.toGeneratedLocation(e))if(r(a.data)){i=t;break}for(let[e,i]of n.toGeneratedLocation(t))if(r(i.data)){a=e;break}if(i===void 0||a===void 0){for(let o of n.mappings)if(r(o.data)){let n=o.sourceOffsets[0],r=j(e,t,n,o.sourceOffsets[o.sourceOffsets.length-1]+o.lengths[o.lengths.length-1]);if(r){let e=r.start-n+o.generatedOffsets[0],t=(o.generatedLengths??o.lengths)[o.generatedOffsets.length-1],s=Math.min(r.end-o.sourceOffsets[o.sourceOffsets.length-1],t),c=o.generatedOffsets[o.generatedOffsets.length-1]+s;i=i===void 0?e:Math.min(i,e),a=a===void 0?c:Math.max(a,c)}}}if(i!==void 0&&a!==void 0)return{start:i,end:a}}function j(e,t,n,r){let i=Math.max(e,n),a=Math.min(t,r);if(!(i>a))return{start:i,end:a}}})),y=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LinkedCodeMap=void 0;let t=_();e.LinkedCodeMap=class extends t.SourceMap{*getLinkedOffsets(e){for(let t of this.toGeneratedLocation(e))yield t[0];for(let t of this.toSourceLocation(e))yield t[0]}}})),b=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),x=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FileMap=void 0,e.FileMap=class extends Map{constructor(e){super(),this.caseSensitive=e,this.originalFileNames=new Map}keys(){return this.originalFileNames.values()}get(e){return super.get(this.normalizeId(e))}has(e){return super.has(this.normalizeId(e))}set(e,t){return this.originalFileNames.set(this.normalizeId(e),e),super.set(this.normalizeId(e),t)}delete(e){return this.originalFileNames.delete(this.normalizeId(e)),super.delete(this.normalizeId(e))}clear(){return this.originalFileNames.clear(),super.clear()}normalizeId(e){return this.caseSensitive?e:e.toLowerCase()}}})),S=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.defaultMapperFactory=e.SourceMap=void 0,e.createLanguage=o,e.forEachEmbeddedCode=s;var r=_();Object.defineProperty(e,`SourceMap`,{enumerable:!0,get:function(){return r.SourceMap}}),n(v(),e),n(y(),e),n(b(),e),n(x(),e);let i=_(),a=y();e.defaultMapperFactory=e=>new i.SourceMap(e);function o(t,n,r,i){let o=new WeakMap,c=new WeakMap,l=new WeakMap,u={mapperFactory:e.defaultMapperFactory,plugins:t,scripts:{fromVirtualCode(e){return o.get(e)},get(e,t=!0,i=!1){r(e,t,i);let a=n.get(e);return a?.isAssociationDirty&&this.set(e,a.snapshot,a.languageId),n.get(e)},set(e,r,i,a=t){if(!i){for(let n of t)if(i=n.getLanguageId?.(e),i)break}if(!i){console.warn(`languageId not found for ${String(e)}`);return}let c=!1;for(let n of t)if(n.isAssociatedFileOnly?.(e,i)){c=!0;break}if(n.has(e)){let t=n.get(e);if(t.languageId!==i||t.associatedOnly!==c)return this.delete(e),d(t),this.set(e,r,i);if(c)t.snapshot!==r&&(t.snapshot=r,d(t));else if(t.isAssociationDirty||t.snapshot!==r){t.snapshot!==r&&(t.snapshot=r,d(t));let n=f(t);if(t.generated){let{updateVirtualCode:a,createVirtualCode:c}=t.generated.languagePlugin,l=a?a(e,t.generated.root,r,n):c?.(e,i,r,n);if(l){t.generated.root=l,t.generated.embeddedCodes.clear();for(let e of s(t.generated.root))o.set(e,t),t.generated.embeddedCodes.set(e.id,e);return t}else{this.delete(e);return}}}else return t}else{let t={id:e,languageId:i,snapshot:r,associatedIds:new Set,targetIds:new Set,associatedOnly:c};if(n.set(e,t),c)return t;for(let n of a){let a=n.createVirtualCode?.(e,i,r,f(t));if(a){t.generated={root:a,languagePlugin:n,embeddedCodes:new Map};for(let e of s(a))o.set(e,t),t.generated.embeddedCodes.set(e.id,e);break}}return t}},delete(e){let t=n.get(e);t&&(t.generated?.languagePlugin.disposeVirtualCode?.(e,t.generated.root),n.delete(e),d(t))}},maps:{get(e,t){let n=c.get(e.snapshot);if(n||c.set(e.snapshot,n=new WeakMap),!n.has(t.snapshot)){let r=e.associatedScriptMappings?.get(t.id)??e.mappings;n.set(t.snapshot,u.mapperFactory(r))}return n.get(t.snapshot)},*forEach(e){let t=o.get(e);if(yield[t,this.get(e,t)],e.associatedScriptMappings)for(let[t]of e.associatedScriptMappings){let r=n.get(t);r&&(yield[r,this.get(e,r)])}}},linkedCodeMaps:{get(e){let t=o.get(e),n=l.get(e.snapshot);return n?.[0]!==t.snapshot&&l.set(e.snapshot,n=[t.snapshot,e.linkedCodeMappings?new a.LinkedCodeMap(e.linkedCodeMappings):void 0]),n[1]}}};return u;function d(e){e.targetIds.forEach(e=>{let t=n.get(e);t&&(t.isAssociationDirty=!0,i?.(t.id))})}function f(e){for(let t of e.associatedIds)n.get(t)?.targetIds.delete(e.id);return e.associatedIds.clear(),e.isAssociationDirty=!1,{getAssociatedScript(t){r(t,!0,!0);let i=n.get(t);return i&&(i.targetIds.add(e.id),e.associatedIds.add(i.id)),i}}}}function*s(e){if(yield e,e.embeddedCodes)for(let t of e.embeddedCodes)yield*s(t)}})),C=S();const w=process.env.RIPPLE_DEBUG===`true`;function T(e){return{log(...t){w&&console.log(e,...t)},logError(...t){w&&console.error(e,...t)},logWarning(...t){w&&console.warn(e,...t)}}}const E=(0,f.createRequire)(require(`url`).pathToFileURL(__filename).href),D=d.default.dirname((0,p.fileURLToPath)(require(`url`).pathToFileURL(__filename).href)),{log:O,logWarning:k,logError:A}=T(`[Ripple Language]`),j=new Set,M=[`.tsrx`],N=[[`@tsrx/ripple`,[`node_modules`,`@tsrx`,`ripple`],[`.tsrx`],[`@tsrx/ripple`,`ripple`,`@ripple-ts/vite-plugin`]],[`@tsrx/react`,[`node_modules`,`@tsrx`,`react`],[`.tsrx`],[`@tsrx/react`,`@tsrx/vite-plugin-react`]],[`@tsrx/solid`,[`node_modules`,`@tsrx`,`solid`],[`.tsrx`],[`@tsrx/solid`,`@tsrx/vite-plugin-solid`]],[`@tsrx/preact`,[`node_modules`,`@tsrx`,`preact`],[`.tsrx`],[`@tsrx/preact`,`@tsrx/vite-plugin-preact`]],[`@tsrx/vue`,[`node_modules`,`@tsrx`,`vue`],[`.tsrx`],[`@tsrx/vue`,`@tsrx/vite-plugin-vue`]],[`octane`,[`node_modules`,`octane`],[`.tsrx`],[`octane`,`@octanejs/vite-plugin`],[`src`,`compiler`,`volar.js`]]],P=[`src`,`index.js`];function F(e){return M.some(t=>e.endsWith(t))}function I(){return O(`Creating Ripple language plugin...`),{getLanguageId(e){let t=typeof e==`string`?e:e.fsPath.replace(/\\/g,`/`);if(F(t))return O(`Identified Ripple file:`,t),`ripple`},createVirtualCode(e,t,n){if(t===`ripple`){let t=K(e),r=Y(t);if(!r){A(`Ripple compiler not found for file: ${t}`);return}O(`Creating virtual code for:`,t);try{return new L(t,n,r)}catch(e){throw A(`Failed to create virtual code for:`,t,`:`,e),e}}},updateVirtualCode(e,t,n){if(t instanceof L)return O(`Updating existing virtual code for:`,t.fileName),t.update(n),t},typescript:{extraFileExtensions:M.map(e=>({extension:e.slice(1),isMixedContent:!1,scriptKind:7})),getServiceScript(e){for(let t of(0,C.forEachEmbeddedCode)(e))if(t.languageId===`ripple`)return{code:t,extension:`.tsx`,scriptKind:4}},...process.env.TSRX_TSC===`true`?null:{getExtraServiceScripts(e,t){let n=[];for(let r of(0,C.forEachEmbeddedCode)(t))r.languageId===`typescript`&&n.push({fileName:`${e}.${r.id}.ts`,code:r,extension:`.ts`,scriptKind:l.default.ScriptKind.TS});return n}}}}}var L=class{id=`root`;languageId=`ripple`;codegenStacks=[];tsrx;generatedCode=``;embeddedCodes=[];mappings=[];fatalErrors=[];usageErrors=[];snapshot;sourceSnapshot;originalCode=``;sourceAst=null;isDotCompletionMode=!1;diagnostics=[];#e=null;#t=null;constructor(e,t,n){if(O(`Initializing TSRXVirtualCode for:`,e),this.fileName=e,this.tsrx=n,this.snapshot=t,this.sourceSnapshot=t,this.originalCode=t.getText(0,t.getLength()),!n||typeof n.compile_to_volar_mappings!=`function`)throw A(`Invalid ripple compiler - missing compile_to_volar_mappings method`),Error(`Invalid ripple compiler`);this.update(t)}update(e){O(`Updating virtual code for:`,this.fileName);let t=e.getText(0,e.getLength()),n=e.getChangeRange(this.sourceSnapshot);this.sourceSnapshot=e,this.#e=null,this.#t=null,this.fatalErrors=[],this.usageErrors=[],this.sourceAst=null,this.isDotCompletionMode=!1;let r,i=!1,a=-1;if(O(`changeRange:`,JSON.stringify(n)),n){let e=n.span.start,r=e+n.span.length,o=e+n.newLength,s=this.originalCode.substring(e,r),c=t.substring(e,o);if(O(`Change details:`),O(` Position:`,e,`-`,r,`(length:`,n.span.length,`)`),O(` Old text:`,JSON.stringify(s)),O(` New text:`,JSON.stringify(c),`(length:`,n.newLength,`)`),c.endsWith(`.`)){let e=o>1?t[o-2]:``;O(` Char before dot:`,JSON.stringify(e)),/[$#_\u200C\u200D\p{ID_Continue}\)\]\}]/u.test(e)&&(i=!0,a=o-1,O(`ChangeRange detected dot typed at position`,a))}}try{if(i&&a>=0){this.isDotCompletionMode=!0;let e=t.substring(0,a)+t.substring(a+1);if(O(`Compiling without typed dot at position`,a),r=this.tsrx.compile_to_volar_mappings(e,this.fileName,{loose:!0}),O(`Compilation without dot successful`),r&&r.code&&r.mappings.length>0){let e=U(r,a);e===null?k(`Failed to restore typed dot into transpiled output`):O(`Inserted typed dot at generated position`,e)}}else O(`Compiling Ripple code...`),r=this.tsrx.compile_to_volar_mappings(t,this.fileName,{loose:!0}),O(`Compilation successful, generated code length:`,r?.code?.length||0)}catch(e){let t=e;A(`Ripple compilation failed for`,this.fileName,`:`,t),process.env.TSRX_TSC===`true`&&z(this.fileName,[t]),t.type=`fatal`,this.fatalErrors.push(t)}if(r&&r.code){this.originalCode=t,this.generatedCode=r.code,this.mappings=r.mappings??[],this.usageErrors=r.errors,this.sourceAst=r.sourceAst,process.env.TSRX_TSC===`true`&&r.errors.length>0&&z(this.fileName,r.errors);let e=r.cssMappings,n=r.scriptMappings??[];if(e.length>0||n.length>0){O(`Creating`,e.length,`CSS and`,n.length,`script embedded codes`);let t=[];for(let n of e)t.push(V(n,`css`));for(let e of n)t.push(V(e,`typescript`));this.embeddedCodes=t}else this.embeddedCodes=[];if(w){O(`CSS embedded codes:`,(this.embeddedCodes||[]).length),O(`Using transpiled code, mapping count:`,this.mappings.length),O(`Original code length:`,t.length),O(`Generated code length:`,this.generatedCode.length),O(`Last 100 chars of original:`,JSON.stringify(t.slice(-100))),O(`Last 200 chars of generated:`,JSON.stringify(this.generatedCode.slice(-200))),O(`Last few mappings:`);let e=Math.max(0,this.mappings.length-5);for(let t=e;t<this.mappings.length;t++){let e=this.mappings[t];O(` Mapping ${t}: source[${e.sourceOffsets[0]}:${e.sourceOffsets[0]+e.lengths[0]}] -> gen[${e.generatedOffsets[0]}:${e.generatedOffsets[0]+e.lengths[0]}], len=${e.lengths[0]}, completion=${e.data?.completion}`)}}this.snapshot={getText:(e,t)=>this.generatedCode.substring(e,t),getLength:()=>this.generatedCode.length,getChangeRange:()=>void 0}}else O(`Compilation failed, only display where the compilation error occurred.`),this.originalCode=t,this.generatedCode=t,this.mappings=[{sourceOffsets:[0],generatedOffsets:[0],lengths:[t.length],generatedLengths:[t.length],data:{completion:!0,verification:!0,customData:{}}}],this.embeddedCodes=[...B(t),...H(t)],this.snapshot={getText:(e,t)=>this.generatedCode.substring(e,t),getLength:()=>this.generatedCode.length,getChangeRange:()=>void 0}}#n(){if(!(this.#e||this.#t)){this.#e=new Map,this.#t=new Map;for(var e,t,n,r,i,a,o,s,c,l=0;l<this.mappings.length;l++)e=this.mappings[l],t=e.generatedOffsets[0],n=e.generatedLengths[0],r=t+n,i=`${t}-${r}`,this.#e.set(i,e),a=e.sourceOffsets[0],o=e.lengths[0],s=a+o,c=`${a}-${s}`,this.#t.set(c,e)}}findMappingByGeneratedRange(e,t){return this.#n(),this.#e.get(`${e}-${t}`)??null}findMappingBySourceRange(e,t){return this.#n(),this.#t.get(`${e}-${t}`)??null}findGeneratedRangeBySourceRange(e,t){let n=null,r=null;for(let i=0;i<this.mappings.length;i++){let a=this.mappings[i],o=a.sourceOffsets[0],s=o+a.lengths[0];s<=e||o>=t||((!n||o<n.sourceOffsets[0])&&(n=a),(!r||s>r.sourceOffsets[0]+r.lengths[0])&&(r=a))}if(!n||!r)return null;let i=n.generatedOffsets[0]+R(e-n.sourceOffsets[0],n.generatedLengths[0]),a=r.generatedOffsets[0]+R(t-r.sourceOffsets[0],r.generatedLengths[0]);return[i,Math.max(a,i+1)]}};function R(e,t){return Math.min(Math.max(e,0),t)}function z(e,t){for(let n of t){let t=n&&typeof n==`object`&&`message`in n?String(n.message):String(n),r=`${e}\0${t}`;j.has(r)||(j.add(r),console.error(`[tsrx-tsc] ${e}: ${t}`))}}function B(e){let t=[],n=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,r,i=0;for(;(r=n.exec(e))!==null;){let e=r[0],n=r[1],a=r.index+(e.indexOf(`>`)+1),o=n.length;O(`Extracted CSS region ${i}: offset ${a}, length ${o}`);let s={sourceOffsets:[a],generatedOffsets:[0],lengths:[o],generatedLengths:[o],data:{verification:!0,completion:!0,semantic:!0,navigation:!0,structure:!0,format:!1,customData:{content:n,embeddedId:`style_${i}`}}};t.push({id:`style_${i}`,languageId:`css`,snapshot:{getText:(e,t)=>n.substring(e,t),getLength:()=>o,getChangeRange:()=>void 0},mappings:[s],embeddedCodes:[]}),i++}return t.length>0&&O(`Extracted ${t.length} CSS embedded codes from style tags`),t}function V(e,t){let n=e.data?.customData?.content??``;return{id:e.data?.customData?.embeddedId,languageId:t,snapshot:{getText:(e,t)=>n.substring(e,t),getLength:()=>e.lengths[0],getChangeRange:()=>void 0},mappings:[e],embeddedCodes:[]}}function H(e){let t=[],n=/<script\b((?:[^>"'/]|"[^"]*"|'[^']*'|\/(?!>))*)>([\s\S]*?)<\/script>/gi,r,i=0;for(;(r=n.exec(e))!==null;){let e=r[1],n=r[2],a=r.index+(7+e.length+1),o=n.length,s=`script_${i}`;O(`Extracted script region ${i}: offset ${a}, length ${o}`);let c={sourceOffsets:[a],generatedOffsets:[0],lengths:[o],generatedLengths:[o],data:{verification:!0,completion:!0,semantic:!0,navigation:!0,structure:!0,format:!1,customData:{content:n,embeddedId:s}}};t.push(V(c,`typescript`)),i++}return t.length>0&&O(`Extracted ${t.length} script embedded codes from script tags`),t}function U(e,t){let n=null;for(let r of e.mappings)if(r.sourceOffsets[0]+r.lengths[0]===t){n=r;break}if(!n)return null;let r=n.generatedLengths[0],i=n.generatedOffsets[0]+r;e.code=e.code.substring(0,i)+`.`+e.code.substring(i);let a={sourceOffsets:[t],generatedOffsets:[i],lengths:[1],generatedLengths:[1],data:{...n.data}},o=e.mappings.indexOf(n);e.mappings.splice(o+1,0,a);for(let r of e.mappings)r!==n&&r!==a&&r.generatedOffsets[0]>=i&&(r.generatedOffsets[0]+=1),r!==n&&r!==a&&r.sourceOffsets[0]>=t&&(r.sourceOffsets[0]+=1);return i}const W=new Map,G=new Map;function K(e){return typeof e==`string`?e:e.fsPath.replace(/\\/g,`/`)}function q(e,t=u.default.existsSync){let n=e,r=[];for(;n;){if(G.has(n)){let e=G.get(n)??null;for(let t of r)G.set(t,e);return e}r.push(n);let e=d.default.join(n,`package.json`);if(t(e))try{let t=JSON.parse(u.default.readFileSync(e,`utf8`)),n=new Set([...Object.keys(t.dependencies??{}),...Object.keys(t.devDependencies??{}),...Object.keys(t.peerDependencies??{}),...Object.keys(t.optionalDependencies??{})]),i={name:typeof t.name==`string`?t.name:null,dependencies:n};for(let e of r)G.set(e,i);return i}catch{for(let e of r)G.set(e,null);return null}let i=d.default.dirname(n);if(i===n)break;n=i}for(let e of r)G.set(e,null);return null}function J(e,t,n){if(!e)return!1;if(e.name===t||n.includes(e.name??``)||e.dependencies.has(t))return!0;for(let t of n)if(e.dependencies.has(t))return!0;return!1}function Y(e){let t=Z(e);if(t){let e=E(t);return typeof e?.compile_to_volar_mappings!=`function`&&typeof e?.compileToVolarMappings==`function`?{...e,compile_to_volar_mappings:e.compileToVolarMappings}:e}}function X(e,t=u.default.existsSync,n=W){let r=e.split(`/`),i=d.default.extname(e);for(let e=r.length-2;e>=0;e--){let a=r.slice(0,e+1).join(`/`),o=a+`\0`+i;if(!n.has(o)){let e=[];for(let[n,r,o,s,c=P]of N){if(!o.includes(i))continue;let l=[a,...r,...c].join(`/`);t(l)&&e.push([n,l,s])}let r=null;if(e.length>0){let n=q(a,t);r=e.find(([e,,t])=>J(n,e,t))?.[1]??e[0][1],O(`Found tsrx compiler at:`,r,`for extension:`,i)}n.set(o,r)}let s=n.get(o);if(s)return s}}function Z(e){let t=d.default.extname(e),n=q(d.default.dirname(e)),r=X(e);if(r)return r;let i=`No supported tsrx compiler found in workspace for ${e}.`,a=D;for(;a;){let e=[];for(let[n,r,i,o,s=P]of N){if(!i.includes(t))continue;let c=d.default.join(a,...r),l=d.default.join(c,...s);u.default.existsSync(l)&&e.push([n,l,o])}if(e.length>0){let t=e.find(([e,,t])=>J(n,e,t))?.[1]??e[0][1];return k(`${i} Using packaged version at ${t}`),t}let r=d.default.dirname(a);if(r===a)break;a=r}}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return I}});
2
- //# sourceMappingURL=language-D4ww-Lgr.js.map