create-octane-xplat 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/template/package.json
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@nativescript-community/octane": "0.2.1",
|
|
21
21
|
"@nativescript-community/ui-drawer": "0.1.32",
|
|
22
22
|
"@nativescript/core": "9.1.2",
|
|
23
|
-
"@octane-xplat/effects": "^0.7.
|
|
24
|
-
"@octane-xplat/ui": "^0.7.
|
|
23
|
+
"@octane-xplat/effects": "^0.7.2",
|
|
24
|
+
"@octane-xplat/ui": "^0.7.2",
|
|
25
25
|
"@valor/nativescript-websockets": "2.0.3",
|
|
26
26
|
"octane": "0.6.3"
|
|
27
27
|
},
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@nativescript/ios": "9.1.0",
|
|
32
32
|
"@nativescript/types": "9.0.0",
|
|
33
33
|
"@nativescript/vite": "8.0.11",
|
|
34
|
-
"@octane-xplat/cli": "^0.7.
|
|
35
|
-
"@octane-xplat/lint": "^0.7.
|
|
34
|
+
"@octane-xplat/cli": "^0.7.2",
|
|
35
|
+
"@octane-xplat/lint": "^0.7.2",
|
|
36
36
|
"@octanejs/vite-plugin": "0.1.61",
|
|
37
37
|
"@tsrx/typescript-plugin": "0.4.7",
|
|
38
38
|
"nativescript": "9.1.1",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
diff --git a/dist/language-CofXAudP.js b/dist/language-CofXAudP.js
|
|
2
|
+
index 0d5504342813cd32b77bc834f9ed01bf6a353e3f..aff65966aba619c96f627474bb8e36c34d44f3e1 100644
|
|
3
|
+
--- a/dist/language-CofXAudP.js
|
|
4
|
+
+++ b/dist/language-CofXAudP.js
|
|
5
|
+
@@ -3,5 +3,5 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
6
|
+
`));return e?null:void 0}let u=D(o.layers,e=>ne(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`||!B(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,`
|
|
7
|
+
`))}return null}if(u.state===`declared`)return ae(n,r,u.config_path,u.value)}function se(e,t={}){let n=t.ts??l.default,r=t.configHost??n.sys,i=I(r),a=t.configFileName??R(d.default.dirname(e),r,i);if(a===null)return;let o=z(n,r,a,i);for(let e of o.dependencies)t.dependencies?.add(e);let s=o.layers.find(e=>e.raw_source===void 0);if(s){let e=`Unable to read tsconfig layer while resolving TSRX platform: ${s.path}`;throw j(e),Error(e)}let c=o.layers.filter(e=>e.parse_diagnostics.length>0);if(c.length>0){if(!o.layers.some(e=>E(e.config,[`tsrx`]).state===`found`?!0:e.parse_diagnostics.length>0&&e.raw_source!==void 0&&M.test(e.raw_source)))return;let e=c[0],t=n.flattenDiagnosticMessageText(e.parse_diagnostics[0].messageText,`
|
|
8
|
+
`),r=`Unable to parse tsconfig layer while resolving TSRX platform: ${e.path}: ${t}`;throw j(r),Error(r)}let u=D(o.layers,e=>re(e.config));if(u.state===`invalid`){let e=u.target===`platform`?` Expected "web", "ios", or "android".`:``,t=`Invalid TSRX ${u.target} declaration: ${u.actual_type} ${u.actual_value} in ${u.config_path}.${e}`;throw j(t),TypeError(t)}let f=o.extends_failures.filter(e=>u.state!==`declared`||!B(o.layers,e,u.config_path));if(f.length>0){if(!t.requirePlatformResolution)return u.state===`declared`?u.value:void 0;let e=f[0],r=e.diagnostics.length>0?`: ${n.flattenDiagnosticMessageText(e.diagnostics[0].messageText,`
|
|
9
|
+
-`)}`:``,i=`Unable to resolve tsconfig extends entry ${JSON.stringify(e.extends_value)} in ${e.config_path} while resolving TSRX platform${r}`;throw j(i),Error(i)}return u.state===`declared`?u.value:void 0}const ce=(0,f.createRequire)(require(`url`).pathToFileURL(__filename).href),le=d.default.dirname((0,p.fileURLToPath)(require(`url`).pathToFileURL(__filename).href)),{log:V,logWarning:H,logError:U}=k(`[TSRX Language]`),W=new Set,G=[`.tsrx`],K=[[`@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`]],[`@tsrx/hono`,[`node_modules`,`@tsrx`,`hono`],[`.tsrx`],[`@tsrx/hono`,`@tsrx/vite-plugin-hono`]],[`octane`,[`node_modules`,`octane`],[`.tsrx`],[`octane`,`@octanejs/vite-plugin`],[[`dist`,`compiler`,`volar.js`],[`src`,`compiler`,`volar.js`]]]],ue=[[`src`,`index.js`]];function de(e){return G.some(t=>e.endsWith(t))}function fe(e,t=l.default){let n=t.createScanner(t.ScriptTarget.Latest,!0,t.LanguageVariant.JSX,e),r=[];for(let e=n.scan();e!==t.SyntaxKind.EndOfFileToken;e=n.scan())r.push({kind:e,text:n.getTokenText()});let i=[`import`,`.`,`meta`,`.`,`env`,`.`,`platform`,`.`];for(let e=0;e+i.length<r.length;e+=1){if(e>0&&(r[e-1].kind===t.SyntaxKind.DotToken||r[e-1].kind===t.SyntaxKind.QuestionDotToken)||!i.every((t,n)=>r[e+n].text===t))continue;let n=r[e+i.length].text;if(n===`web`||n===`ios`||n===`android`)return!0}return!1}function pe(e={}){V(`Creating TSRX 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(de(t))return V(`Identified TSRX file:`,t),`tsrx`},createVirtualCode(e,t,r){if(t===`tsrx`){let t=ve(e),i=ye(t,n);if(!i){U(`TSRX compiler not found for file: ${t}`);return}V(`Creating virtual code for:`,t);try{return new q(t,r,i,e=>se(t,{...n,requirePlatformResolution:e}))}catch(e){throw U(`Failed to create virtual code for:`,t,`:`,e),e}}},updateVirtualCode(e,t,n){if(t instanceof q)return V(`Updating existing virtual code for:`,t.fileName),t.update(n),t},typescript:{extraFileExtensions:G.map(e=>({extension:e.slice(1),isMixedContent:!1,scriptKind:7})),getServiceScript(e){for(let t of(0,w.forEachEmbeddedCode)(e))if(t.languageId===`tsrx`)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 q=class{id=`root`;languageId=`tsrx`;codegenStacks=[];tsrx;platformProvider;generatedCode=``;embeddedCodes=[];mappings=[];fatalErrors=[];usageErrors=[];snapshot;sourceSnapshot;originalCode=``;sourceAst=null;isDotCompletionMode=!1;diagnostics=[];#e=null;#t=null;constructor(e,t,n,r){if(V(`Initializing TSRXVirtualCode for:`,e),this.fileName=e,this.tsrx=n,this.platformProvider=r,this.snapshot=t,this.sourceSnapshot=t,this.originalCode=t.getText(0,t.getLength()),!n||typeof n.compile_to_volar_mappings!=`function`)throw U(`Invalid TSRX compiler - missing compile_to_volar_mappings method`),Error(`Invalid TSRX compiler`);this.update(t)}update(e){V(`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(V(`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(V(`Change details:`),V(` Position:`,e,`-`,r,`(length:`,n.span.length,`)`),V(` Old text:`,JSON.stringify(s)),V(` New text:`,JSON.stringify(c),`(length:`,n.newLength,`)`),c.endsWith(`.`)){let e=o>1?t[o-2]:``;V(` Char before dot:`,JSON.stringify(e)),/[$#_\u200C\u200D\p{ID_Continue}\)\]\}]/u.test(e)&&(i=!0,a=o-1,V(`ChangeRange detected dot typed at position`,a))}}try{let e=this.platformProvider?.(fe(t));if(i&&a>=0){this.isDotCompletionMode=!0;let n=t.substring(0,a)+t.substring(a+1);if(V(`Compiling without typed dot at position`,a),r=this.tsrx.compile_to_volar_mappings(n,this.fileName,{loose:!0,platform:e}),V(`Compilation without dot successful`),r&&r.code&&r.mappings.length>0){let e=ge(r,a);e===null?H(`Failed to restore typed dot into transpiled output`):V(`Inserted typed dot at generated position`,e)}}else V(`Compiling TSRX code...`),r=this.tsrx.compile_to_volar_mappings(t,this.fileName,{loose:!0,platform:e}),V(`Compilation successful, generated code length:`,r?.code?.length||0)}catch(e){let t=e;U(`TSRX compilation failed for`,this.fileName,`:`,t),process.env.TSRX_TSC===`true`&&Y(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&&Y(this.fileName,r.errors);let e=r.cssMappings,n=r.scriptMappings??[];if(e.length>0||n.length>0){V(`Creating`,e.length,`CSS and`,n.length,`script embedded codes`);let t=[];for(let n of e)t.push(X(n,`css`));for(let e of n)t.push(X(e,`typescript`));this.embeddedCodes=t}else this.embeddedCodes=[];if(O){V(`CSS embedded codes:`,(this.embeddedCodes||[]).length),V(`Using transpiled code, mapping count:`,this.mappings.length),V(`Original code length:`,t.length),V(`Generated code length:`,this.generatedCode.length),V(`Last 100 chars of original:`,JSON.stringify(t.slice(-100))),V(`Last 200 chars of generated:`,JSON.stringify(this.generatedCode.slice(-200))),V(`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];V(` 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 V(`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=[...me(t),...he(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]+J(e-n.sourceOffsets[0],n.generatedLengths[0]),a=r.generatedOffsets[0]+J(t-r.sourceOffsets[0],r.generatedLengths[0]);return[i,Math.max(a,i+1)]}};function J(e,t){return Math.min(Math.max(e,0),t)}function Y(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}`;W.has(r)||(W.add(r),console.error(`[tsrx-tsc] ${e}: ${t}`))}}function me(e){let t=[],n=/<style\b((?:[^>"'{}/]|"[^"]*"|'[^']*'|\{(?:[^{}]|\{[^{}]*\})*\}|\/(?!>))*)>([\s\S]*?)<\/style>/gi,r,i=0;for(;(r=n.exec(e))!==null;){let e=r[1],n=r[2],a=r.index+(6+e.length+1),o=n.length,s=`style_${i}`;V(`Extracted CSS 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(X(c,`css`)),i++}return t.length>0&&V(`Extracted ${t.length} CSS embedded codes from style tags`),t}function X(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 he(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}`;V(`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(X(c,`typescript`)),i++}return t.length>0&&V(`Extracted ${t.length} script embedded codes from script tags`),t}function ge(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 _e=new Map,Z=new Map;function ve(e){return typeof e==`string`?e:e.fsPath.replace(/\\/g,`/`)}function Q(e,t=u.default.existsSync){let n=e,r=[];for(;n;){if(Z.has(n)){let e=Z.get(n)??null;for(let t of r)Z.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)Z.set(e,i);return i}catch{for(let e of r)Z.set(e,null);return null}let i=d.default.dirname(n);if(i===n)break;n=i}for(let e of r)Z.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 ye(e,t){let n=Se(e,t);if(n)return be(ce(n))}function be(e){return typeof e?.compile_to_volar_mappings!=`function`&&typeof e?.compileToVolarMappings==`function`?{...e,compile_to_volar_mappings:e.compileToVolarMappings}:e}function xe(e,t=u.default.existsSync,n=_e){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=ue]of K)if(o.includes(i))for(let i of c){let o=[a,...r,...i].join(`/`);if(t(o)){e.push([n,o,s]);break}}let r=null;if(e.length>0){let n=Q(a,t);r=e.find(([e,,t])=>$(n,e,t))?.[1]??e[0][1],V(`Found tsrx compiler at:`,r,`for extension:`,i)}n.set(o,r)}let s=n.get(o);if(s)return s}}function Se(e,t){let n=d.default.extname(e),r=oe(e,t);if(r!==void 0)return r??void 0;let i=Q(d.default.dirname(e)),a=xe(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=ue]of K){if(!i.includes(n))continue;let c=d.default.join(s,...r);for(let n of o){let r=d.default.join(c,...n);if(u.default.existsSync(r)){e.push([t,r,a]);break}}}if(e.length>0){let t=e.find(([e,,t])=>$(i,e,t))?.[1]??e[0][1];return H(`${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 pe}});
|
|
10
|
+
+`)}`:``,i=`Unable to resolve tsconfig extends entry ${JSON.stringify(e.extends_value)} in ${e.config_path} while resolving TSRX platform${r}`;throw j(i),Error(i)}return u.state===`declared`?u.value:void 0}const ce=(0,f.createRequire)(require(`url`).pathToFileURL(__filename).href),le=d.default.dirname((0,p.fileURLToPath)(require(`url`).pathToFileURL(__filename).href)),{log:V,logWarning:H,logError:U}=k(`[TSRX Language]`),W=new Set,G=[`.tsrx`],K=[[`@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`]],[`@tsrx/hono`,[`node_modules`,`@tsrx`,`hono`],[`.tsrx`],[`@tsrx/hono`,`@tsrx/vite-plugin-hono`]],[`octane`,[`node_modules`,`octane`],[`.tsrx`],[`octane`,`@octanejs/vite-plugin`],[[`dist`,`compiler`,`volar.js`],[`src`,`compiler`,`volar.js`]]]],ue=[[`src`,`index.js`]];function de(e){return G.some(t=>e.endsWith(t))}function fe(e,t=l.default){let n=t.createScanner(t.ScriptTarget.Latest,!0,t.LanguageVariant.JSX,e),r=[];for(let e=n.scan();e!==t.SyntaxKind.EndOfFileToken;e=n.scan())r.push({kind:e,text:n.getTokenText()});let i=[`import`,`.`,`meta`,`.`,`env`,`.`,`platform`,`.`];for(let e=0;e+i.length<r.length;e+=1){if(e>0&&(r[e-1].kind===t.SyntaxKind.DotToken||r[e-1].kind===t.SyntaxKind.QuestionDotToken)||!i.every((t,n)=>r[e+n].text===t))continue;let n=r[e+i.length].text;if(n===`web`||n===`ios`||n===`android`)return!0}return!1}function pe(e={}){V(`Creating TSRX 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(de(t))return V(`Identified TSRX file:`,t),`tsrx`},createVirtualCode(e,t,r){if(t===`tsrx`){let t=ve(e),i=ye(t,n);if(!i){U(`TSRX compiler not found for file: ${t}`);return}V(`Creating virtual code for:`,t);try{return new q(t,r,i,e=>se(t,{...n,requirePlatformResolution:e}))}catch(e){throw U(`Failed to create virtual code for:`,t,`:`,e),e}}},updateVirtualCode(e,t,n){if(t instanceof q)return V(`Updating existing virtual code for:`,t.fileName),t.update(n),t},typescript:{resolveHiddenExtensions:!0,extraFileExtensions:G.map(e=>({extension:e.slice(1),isMixedContent:!1,scriptKind:7})),getServiceScript(e){for(let t of(0,w.forEachEmbeddedCode)(e))if(t.languageId===`tsrx`)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 q=class{id=`root`;languageId=`tsrx`;codegenStacks=[];tsrx;platformProvider;generatedCode=``;embeddedCodes=[];mappings=[];fatalErrors=[];usageErrors=[];snapshot;sourceSnapshot;originalCode=``;sourceAst=null;isDotCompletionMode=!1;diagnostics=[];#e=null;#t=null;constructor(e,t,n,r){if(V(`Initializing TSRXVirtualCode for:`,e),this.fileName=e,this.tsrx=n,this.platformProvider=r,this.snapshot=t,this.sourceSnapshot=t,this.originalCode=t.getText(0,t.getLength()),!n||typeof n.compile_to_volar_mappings!=`function`)throw U(`Invalid TSRX compiler - missing compile_to_volar_mappings method`),Error(`Invalid TSRX compiler`);this.update(t)}update(e){V(`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(V(`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(V(`Change details:`),V(` Position:`,e,`-`,r,`(length:`,n.span.length,`)`),V(` Old text:`,JSON.stringify(s)),V(` New text:`,JSON.stringify(c),`(length:`,n.newLength,`)`),c.endsWith(`.`)){let e=o>1?t[o-2]:``;V(` Char before dot:`,JSON.stringify(e)),/[$#_\u200C\u200D\p{ID_Continue}\)\]\}]/u.test(e)&&(i=!0,a=o-1,V(`ChangeRange detected dot typed at position`,a))}}try{let e=this.platformProvider?.(fe(t));if(i&&a>=0){this.isDotCompletionMode=!0;let n=t.substring(0,a)+t.substring(a+1);if(V(`Compiling without typed dot at position`,a),r=this.tsrx.compile_to_volar_mappings(n,this.fileName,{loose:!0,platform:e}),V(`Compilation without dot successful`),r&&r.code&&r.mappings.length>0){let e=ge(r,a);e===null?H(`Failed to restore typed dot into transpiled output`):V(`Inserted typed dot at generated position`,e)}}else V(`Compiling TSRX code...`),r=this.tsrx.compile_to_volar_mappings(t,this.fileName,{loose:!0,platform:e}),V(`Compilation successful, generated code length:`,r?.code?.length||0)}catch(e){let t=e;U(`TSRX compilation failed for`,this.fileName,`:`,t),process.env.TSRX_TSC===`true`&&Y(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&&Y(this.fileName,r.errors);let e=r.cssMappings,n=r.scriptMappings??[];if(e.length>0||n.length>0){V(`Creating`,e.length,`CSS and`,n.length,`script embedded codes`);let t=[];for(let n of e)t.push(X(n,`css`));for(let e of n)t.push(X(e,`typescript`));this.embeddedCodes=t}else this.embeddedCodes=[];if(O){V(`CSS embedded codes:`,(this.embeddedCodes||[]).length),V(`Using transpiled code, mapping count:`,this.mappings.length),V(`Original code length:`,t.length),V(`Generated code length:`,this.generatedCode.length),V(`Last 100 chars of original:`,JSON.stringify(t.slice(-100))),V(`Last 200 chars of generated:`,JSON.stringify(this.generatedCode.slice(-200))),V(`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];V(` 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 V(`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=[...me(t),...he(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]+J(e-n.sourceOffsets[0],n.generatedLengths[0]),a=r.generatedOffsets[0]+J(t-r.sourceOffsets[0],r.generatedLengths[0]);return[i,Math.max(a,i+1)]}};function J(e,t){return Math.min(Math.max(e,0),t)}function Y(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}`;W.has(r)||(W.add(r),console.error(`[tsrx-tsc] ${e}: ${t}`))}}function me(e){let t=[],n=/<style\b((?:[^>"'{}/]|"[^"]*"|'[^']*'|\{(?:[^{}]|\{[^{}]*\})*\}|\/(?!>))*)>([\s\S]*?)<\/style>/gi,r,i=0;for(;(r=n.exec(e))!==null;){let e=r[1],n=r[2],a=r.index+(6+e.length+1),o=n.length,s=`style_${i}`;V(`Extracted CSS 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(X(c,`css`)),i++}return t.length>0&&V(`Extracted ${t.length} CSS embedded codes from style tags`),t}function X(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 he(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}`;V(`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(X(c,`typescript`)),i++}return t.length>0&&V(`Extracted ${t.length} script embedded codes from script tags`),t}function ge(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 _e=new Map,Z=new Map;function ve(e){return typeof e==`string`?e:e.fsPath.replace(/\\/g,`/`)}function Q(e,t=u.default.existsSync){let n=e,r=[];for(;n;){if(Z.has(n)){let e=Z.get(n)??null;for(let t of r)Z.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)Z.set(e,i);return i}catch{for(let e of r)Z.set(e,null);return null}let i=d.default.dirname(n);if(i===n)break;n=i}for(let e of r)Z.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 ye(e,t){let n=Se(e,t);if(n)return be(ce(n))}function be(e){return typeof e?.compile_to_volar_mappings!=`function`&&typeof e?.compileToVolarMappings==`function`?{...e,compile_to_volar_mappings:e.compileToVolarMappings}:e}function xe(e,t=u.default.existsSync,n=_e){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=ue]of K)if(o.includes(i))for(let i of c){let o=[a,...r,...i].join(`/`);if(t(o)){e.push([n,o,s]);break}}let r=null;if(e.length>0){let n=Q(a,t);r=e.find(([e,,t])=>$(n,e,t))?.[1]??e[0][1],V(`Found tsrx compiler at:`,r,`for extension:`,i)}n.set(o,r)}let s=n.get(o);if(s)return s}}function Se(e,t){let n=d.default.extname(e),r=oe(e,t);if(r!==void 0)return r??void 0;let i=Q(d.default.dirname(e)),a=xe(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=ue]of K){if(!i.includes(n))continue;let c=d.default.join(s,...r);for(let n of o){let r=d.default.join(c,...n);if(u.default.existsSync(r)){e.push([t,r,a]);break}}}if(e.length>0){let t=e.find(([e,,t])=>$(i,e,t))?.[1]??e[0][1];return H(`${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 pe}});
|
|
11
|
+
//# sourceMappingURL=language-CofXAudP.js.map
|
|
@@ -69,3 +69,8 @@ patchedDependencies:
|
|
|
69
69
|
# and the flexbox common measure-spec — applied to the @11468 preview. iOS/Android
|
|
70
70
|
# impl-file hunks are dead code on windows and were dropped.
|
|
71
71
|
"@nativescript/core@9.1.3-next.2": patches/@nativescript__core@9.1.3-next.2.patch
|
|
72
|
+
# Enables `resolveHiddenExtensions` on the language plugin's typescript facet so
|
|
73
|
+
# extensionless specifiers (e.g. './Text') probe `.tsrx` after moduleSuffixes — required
|
|
74
|
+
# for a single extensionless shared barrel to resolve per-platform leaves under tsrx-tsc
|
|
75
|
+
# and the IDE plugin.
|
|
76
|
+
"@tsrx/typescript-plugin@0.4.11": patches/@tsrx__typescript-plugin@0.4.11.patch
|