@tsrx/typescript-plugin 0.6.3 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/module-format-CDeoefY0.js +5 -0
- package/dist/module-format-CDeoefY0.js.map +1 -0
- package/dist/tsc.js +1 -1
- package/dist/tsc.js.map +1 -1
- package/package.json +7 -7
- package/dist/language-C8Cl5qyV.js +0 -5
- package/dist/language-C8Cl5qyV.js.map +0 -1
package/dist/tsc.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const e=require("./
|
|
2
|
+
const e=require("./module-format-CDeoefY0.js");let t=require("node:fs");t=e.f(t,1);let n=require("node:url"),r=require("node:path");r=e.f(r,1);let i=require("node:module");i=e.f(i,1);let a=require("node:os");a=e.f(a,1);let o=require("node:child_process");const s=/\.d\.[cm]?ts$/,c=/^declareglobal\{interfaceImportMetaEnv\{readonlyplatform:string&\{readonlyweb:(?:true|false|boolean);readonlyios:(?:true|false|boolean);readonlyandroid:(?:true|false|boolean);\};\}interfaceImportMeta\{readonly\[key:`env\$\{string\}`\]:ImportMetaEnv;\}\}$/;function l(e,t,n){return e.isModuleDeclaration(n)&&e.isIdentifier(n.name)&&e.idText(n.name)===`global`&&c.test(t.slice(n.pos,n.end).replace(/\s+/g,``))}function u(e,t){if(!t.includes(`ImportMetaEnv`))return t;let n=e.createSourceFile(`output.d.ts`,t,99),r=t;for(let i of[...n.statements].reverse())l(e,t,i)&&(r=r.slice(0,i.pos)+r.slice(i.end));return r}const d=/* @__PURE__ */ new WeakSet;function f(e){let t=e.sys;if(d.has(t))return;d.add(t);let n=t.writeFile;t.writeFile=(r,i,a)=>n.call(t,r,s.test(r)?u(e,i):i,a)}const p=`TypeScript 7 support for .tsrx files is not complete yet; the gaps and the upstream TypeScript issues behind them are tracked in https://github.com/tsrx-org/tsrx/issues/136. If you run into one that is not listed there, please file a new issue on the tsrx repository.`;function m(e){return Number.parseInt(e,10)}function h(e){return m(e)>=7}function g(e){let[t,n]=e.trim().split(`-`,2),r=t.split(`.`).map(e=>Number.parseInt(e,10)||0);for(;r.length<3;)r.push(0);if(n===void 0||n===``)return{core:r,channel:`release`,prerelease:[]};let i=n.split(`.`).map(e=>/^\d+$/.test(e)?Number.parseInt(e,10):e);return{core:r,channel:i[0]===`dev`?`nightly`:`prerelease`,prerelease:i}}const _={nightly:0,prerelease:1,release:2};function v(e,t){let n=g(e),r=g(t);for(let e=0;e<3;e++)if(n.core[e]!==r.core[e])return n.core[e]-r.core[e];if(n.channel!==r.channel)return _[n.channel]-_[r.channel];let i=Math.max(n.prerelease.length,r.prerelease.length);for(let e=0;e<i;e++){let t=n.prerelease[e],i=r.prerelease[e];if(t!==i)return t===void 0?-1:i===void 0?1:typeof t==`number`&&typeof i==`number`?t-i:typeof t==`number`?-1:typeof i==`number`?1:t<i?-1:1}return 0}function y(e){return h(e)&&v(e,`7.1.0-dev.20260923.1`)>=0}function b(e,t){let n=typeof e==`string`?e:e?.version;if(typeof n!=`string`||!h(n))return;let r=`resolved typescript@${n}, the native TypeScript compiler, whose npm package has no JavaScript API.`;if(t===`tsrx-tsc`)return y(n)?void 0:`tsrx-tsc ${r} tsrx-tsc runs TypeScript 7 through "tsc --runExternalCode" and @tsrx/content-mapper, which needs a 7.1 nightly with the content-mapper protocol (7.1.0-dev.20260923.1 or newer; install typescript@next), or TypeScript ^5.9.3 || ^6.0.0 through Volar. ${p}`}const x=`--runExternalCode`,S=`@tsrx/content-mapper`;function C(){return`@typescript/typescript-${process.platform}-${process.arch}`}function w(e){let n=C(),a=(0,i.createRequire)(e),o;try{o=a.resolve(`${n}/package.json`)}catch{throw Error(`tsrx-tsc could not resolve ${n} next to ${e}. Either this platform is unsupported by TypeScript 7, or the package is missing on disk (the typescript package lists it as an optional dependency; reinstall with optional dependencies enabled).`)}let s=r.default.join(r.default.dirname(o),`lib`,process.platform===`win32`?`tsc.exe`:`tsc`);if(!t.default.existsSync(s))throw Error(`tsrx-tsc found ${n} but not its compiler at ${s}.`);return s}function T(e){return e.includes(`--runExternalCode`)?[...e]:E(e)?[...e,x]:[x,...e]}function E(e){return e[0]===`--build`||e[0]===`-b`}const D=/\.(?:[cm]?[jt]sx?|tsrx|d\.[cm]?ts)$/i,O=/* @__PURE__ */ new Set([`--version`,`-v`,`--help`,`-h`,`--init`]);function k(n,i,a=e.l){let o=[];if(n.some(e=>O.has(e)))return o;function s(e){let n=r.default.resolve(i,e),a=t.default.statSync(n,{throwIfNoEntry:!1});if(a?.isDirectory()){let e=r.default.join(n,`tsconfig.json`);t.default.existsSync(e)&&o.push(e)}else a?.isFile()&&o.push(n)}if(E(n)){for(let e of n.slice(1))!e.startsWith(`-`)&&!D.test(e)&&s(e);return o.length===0&&s(`.`),A(o,a)}for(let e=0;e<n.length;e++){let t=n[e];if(t===`-p`||t===`--project`)return n[e+1]!==void 0&&s(n[e+1]),o}return n.some(e=>!e.startsWith(`-`)&&D.test(e))||s(`.`),o}function A(n,i){let a=[],o=/* @__PURE__ */ new Set;function s(n){if(o.has(n))return;o.add(n);let{layers:c,diagnostics:l,extends_failures:u}=e.s(i,n),d=c[c.length-1],f=e.o(d.config,[`references`]);if(f.state===`found`&&Array.isArray(f.value))for(let n of f.value){let i=e.o(n,[`path`]);if(i.state!==`found`||typeof i.value!=`string`)continue;let a=r.default.resolve(d.dir,i.value),o=t.default.statSync(a,{throwIfNoEntry:!1});if(o?.isDirectory()){let e=r.default.join(a,`tsconfig.json`);t.default.existsSync(e)&&s(e)}else o?.isFile()&&s(a)}let p=t=>{let n=e.c(c,n=>e.o(n.config,[t]));return n.state===`found`&&Array.isArray(n.value)&&n.value.length===0},m=e.c(c,t=>e.o(t.config,[`include`]));(l.length!==0||u.length!==0||!p(`files`)||m.state!==`absent`&&!p(`include`))&&a.push(n)}for(let e of n)s(e);return a}function ee(t,n=e.l){let{layers:r,diagnostics:i,extends_failures:a}=e.s(n,t);if(i.length>0||a.length>0)return!0;let o=e.c(r,t=>e.o(t.config,[`contentMappers`]));return o.state===`absent`?!1:!Array.isArray(o.value)||o.value.some(e=>typeof e==`object`&&!!e&&Array.isArray(e.extensions)&&e.extensions.some(e=>typeof e==`string`&&e.toLowerCase()===`.tsrx`))}function j(e){return`tsrx-tsc: ${e} declares no content mapper for .tsrx files, so TypeScript 7 would not check them. Install ${S} next to the project and add "contentMappers": [{ "package": "${S}", "extensions": [".tsrx"] }] at the top level of tsconfig.json (TypeScript 5 and 6 ignore the key, so the same file keeps working with the classic path). ${p}`}function M(e){let t=e.cwd??process.cwd(),n=e.stderr??process.stderr,r;try{r=w(e.typescript_package_json_path)}catch(e){return n.write(`${e instanceof Error?e.message:String(e)}\n`),1}for(let r of k(e.args,t,e.host))if(!ee(r,e.host))return n.write(`${j(r)}\n`),1;let i=(0,o.spawnSync)(r,T(e.args),{cwd:t,env:e.env??process.env,stdio:`inherit`,windowsHide:!0});return i.error?(n.write(`tsrx-tsc could not start ${r}: ${i.error.message}\n`),1):i.status===null?(n.write(`tsrx-tsc: ${r} was terminated by signal ${i.signal}.\n`),1):i.status}const N=/^TS(\d+)$/,P=/\r\n?|[\n\u2028\u2029]/g;function F(e,t,n,r){let i=!1,a;for(let o of t.getSourceFiles()){if(!n.some(e=>o.fileName.endsWith(e)))continue;let s=e.scripts.get(o.fileName)?.generated?.root;if(s?.languageId!==`tsrx`)continue;let c=[...s.fatalErrors,...s.usageErrors];if(c.length===0)continue;let l,u=/* @__PURE__ */ new Set,d=R(o.fileName);for(let e of c){let n=z(e,s.originalCode);if(n.severity===`error`&&n.code&&n.offset!==void 0){let e=N.exec(n.code);if(e&&(a??=I(t),l??=L(t,o,a),l.has(`${e[1]}@${n.offset}`)))continue}let c=B(d,n);u.has(c)||(u.add(c),r(c),n.severity===`error`&&(i=!0))}}return i}function I(e){return!e.getCompilerOptions().listFilesOnly&&e.getSyntacticDiagnostics().length===0&&e.getOptionsDiagnostics().length===0&&e.getGlobalDiagnostics().length===0}function L(e,t,n){let r=/* @__PURE__ */ new Set,i=[e.getSyntacticDiagnostics(t)];n&&i.push(e.getSemanticDiagnostics(t));for(let e of i)for(let n of e)n.file?.fileName===t.fileName&&n.start!==void 0&&r.add(`${n.code}@${n.start}`);return r}function R(e){let t=r.default.relative(process.cwd(),e);return(r.default.isAbsolute(t)?e:t).replaceAll(`\\`,`/`)}function z(e,t){let n=e&&typeof e==`object`?e:void 0,r=n&&`message`in n?String(n.message):String(e),i=n?.severity===`warning`&&n.type!==`fatal`?`warning`:`error`,a=typeof n?.code==`string`&&n.code.length>0?n.code:void 0,o=V(n,t);return{message:r,severity:i,code:a,start:o,offset:o?H(o,t):void 0}}function B(e,{message:t,severity:n,code:r,start:i}){let a=r===void 0?n:`${n} ${r}`;return`${e}${i?`(${i.line},${i.column+1})`:``}: ${a}: ${t}`}function V(e,t){let n=e?.loc?.start??e?.loc;if(typeof n?.line==`number`&&typeof n?.column==`number`)return{line:n.line,column:n.column};let r=e?.pos;if(typeof r!=`number`||r<0||r>t.length)return;let i=1,a=0;for(let e of t.slice(0,r).matchAll(P))i++,a=e.index+e[0].length;return{line:i,column:r-a}}function H({line:e,column:t},n){let r=0,i=1;for(let t of n.matchAll(P)){if(i===e)break;i++,r=t.index+t[0].length}return i===e?r+t:void 0}const U=(0,i.createRequire)(require("url").pathToFileURL(__filename).href);let W;try{W=U.resolve(`typescript/package.json`)}catch{console.error(`tsrx-tsc needs the typescript package installed next to @tsrx/typescript-plugin. In the project: npm install -D typescript, or pnpm add -D typescript.`),process.exit(1)}const G=U(W).version,K=b(G,`tsrx-tsc`);K&&(console.error(K),process.exit(1)),h(G)&&process.exit(M({typescript_package_json_path:W,args:process.argv.slice(2)}));const{runTsc:q}=U(`@volar/typescript/lib/quickstart/runTsc.js`),J=U.resolve(`typescript/lib/tsc.js`);process.env.TSRX_TSC=`true`;const Y=U(`@volar/typescript/lib/node/decorateProgram.js`),X=Y.decorateProgram;let Z=!1;Y.decorateProgram=(t,n)=>{X(t,n);let r=F(t,n,e.r,e=>process.stdout.write(`${e}${a.default.EOL}`));Z||=r};const Q=process.exit;process.exit=e=>Q.call(process,Z&&(e===void 0||e===0)?2:e);const te=(0,n.pathToFileURL)(J).href,$=i.default.registerHooks?.({load(e,n,r){if(e!==te)return r(e,n);let i=t.default.readFileSync(J,`utf8`);return $?.deregister(),{format:`commonjs`,source:i,shortCircuit:!0}}});try{q(J,{extraSupportedExtensions:[`.tsrx`],extraExtensionsToRemove:[`.tsrx`]},(t,n)=>{let r=n.options;return n.host&&e.n(t,n.host,r),f(t),[e.i({ts:t,configFileName:r.configFile?.fileName??r.configFilePath,configHost:t.sys})]})}finally{$?.deregister()}
|
|
3
3
|
//# sourceMappingURL=tsc.js.map
|
package/dist/tsc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsc.js","names":["require","createRequire","path","fs","NODE_CONFIG_HOST","load_tsconfig_layers","get_own_config_value","resolve_inherited_config_value","spawnSync","require","createRequire","pathToFileURL","fs","getTsrxLanguagePlugin"],"sources":["../src/typescript-version.js","../src/native-tsc.js","../src/tsc.js"],"sourcesContent":["/**\n * The TypeScript versions TSRX's JavaScript tooling runs on, and the messages\n * shown when a project resolves a `typescript` package it cannot use.\n *\n * TypeScript 7 (`typescript@7`) is the native compiler: its npm package only\n * launches the platform binary and exposes no JavaScript API. Everything that\n * hosts TypeScript through Volar (the tsserver plugin, the classic TSRX language\n * server, and `tsrx-tsc` on the classic path) therefore needs TypeScript 5.9 or\n * 6 installed. The native path needs no other TypeScript: `@tsrx/content-mapper`\n * and the TSRX language server's native backend read `tsconfig.json` and resolve\n * compilers themselves (`tsconfig-resolution.js`, `package-resolution.js`), and\n * TypeScript 7 type-checks `.tsrx` files through the mapper, which needs a 7.1\n * nightly: the stable 7.0 releases have no content-mapper protocol. `tsrx-tsc`\n * runs that native path itself when the installed `typescript` is such a build\n * (`native-tsc.js`), so one command serves every supported TypeScript line.\n */\n\n/** The `typescript` versions whose JavaScript API TSRX runs on. */\nexport const SUPPORTED_TYPESCRIPT_RANGE = '^5.9.3 || ^6.0.0';\n\n/**\n * The oldest TypeScript 7 build `@tsrx/content-mapper` supports (`tsc\n * --runExternalCode`, `tsc --lsp`): the first 7.1 nightly whose `tsc --watch`\n * recompiles after an edit (microsoft/TypeScript#64351). The content-mapper\n * protocol itself arrived in `7.1.0-dev.20260822.1`. The VS Code \"TypeScript 7\n * Nightly\" extension version that bundles it is `0.<date>.<n>` for the same date.\n */\nexport const MINIMUM_NATIVE_TYPESCRIPT_VERSION = '7.1.0-dev.20260923.1';\n\n/**\n * Where the gaps in TypeScript 7 support and their upstream issues are tracked:\n * the tracking issue, which outlives the pull request that added the support.\n */\nexport const TYPESCRIPT_7_TRACKING_URL = 'https://github.com/tsrx-org/tsrx/issues/136';\n\n/** One sentence to append to every message that mentions TypeScript 7. */\nexport const TYPESCRIPT_7_SUPPORT_NOTE = `TypeScript 7 support for .tsrx files is not complete yet; the gaps and the upstream TypeScript issues behind them are tracked in ${TYPESCRIPT_7_TRACKING_URL}. If you run into one that is not listed there, please file a new issue on the tsrx repository.`;\n\n/**\n * @param {string} version\n * @returns {number}\n */\nexport function typescript_major(version) {\n\treturn Number.parseInt(version, 10);\n}\n\n/**\n * Whether a `typescript` package version is the native compiler (7 and up),\n * whose package has no JavaScript API.\n * @param {string} version\n * @returns {boolean}\n */\nexport function is_native_typescript_package(version) {\n\treturn typescript_major(version) >= 7;\n}\n\n/**\n * @typedef {object} ParsedTypeScriptVersion\n * @property {number[]} core `major.minor.patch` as numbers.\n * @property {'nightly' | 'prerelease' | 'release'} channel\n * @property {Array<number | string>} prerelease The dot-separated prerelease\n * identifiers, numeric ones as numbers.\n */\n\n/**\n * @param {string} version\n * @returns {ParsedTypeScriptVersion}\n */\nfunction parse_typescript_version(version) {\n\tconst [core_part, prerelease_part] = version.trim().split('-', 2);\n\tconst core = core_part.split('.').map((part) => Number.parseInt(part, 10) || 0);\n\twhile (core.length < 3) core.push(0);\n\tif (prerelease_part === undefined || prerelease_part === '') {\n\t\treturn { core, channel: 'release', prerelease: [] };\n\t}\n\tconst prerelease = prerelease_part\n\t\t.split('.')\n\t\t.map((part) => (/^\\d+$/.test(part) ? Number.parseInt(part, 10) : part));\n\treturn { core, channel: prerelease[0] === 'dev' ? 'nightly' : 'prerelease', prerelease };\n}\n\nconst CHANNEL_ORDER = { nightly: 0, prerelease: 1, release: 2 };\n\n/**\n * Order two `typescript` package versions. Semantic versioning except in one\n * respect: TypeScript's `-dev.<yyyymmdd>.<n>` nightlies are cut before the\n * betas and release candidates of the same `major.minor.patch`, so a\n * `-beta` or `-rc` build ranks above every nightly of that version, not\n * below it as plain identifier order would say.\n * @param {string} a\n * @param {string} b\n * @returns {number} Negative when `a` is older than `b`, positive when newer, `0` when equal.\n */\nexport function compare_typescript_versions(a, b) {\n\tconst left = parse_typescript_version(a);\n\tconst right = parse_typescript_version(b);\n\tfor (let index = 0; index < 3; index++) {\n\t\tif (left.core[index] !== right.core[index]) {\n\t\t\treturn left.core[index] - right.core[index];\n\t\t}\n\t}\n\tif (left.channel !== right.channel) {\n\t\treturn CHANNEL_ORDER[left.channel] - CHANNEL_ORDER[right.channel];\n\t}\n\tconst length = Math.max(left.prerelease.length, right.prerelease.length);\n\tfor (let index = 0; index < length; index++) {\n\t\tconst left_part = left.prerelease[index];\n\t\tconst right_part = right.prerelease[index];\n\t\tif (left_part === right_part) continue;\n\t\tif (left_part === undefined) return -1;\n\t\tif (right_part === undefined) return 1;\n\t\tif (typeof left_part === 'number' && typeof right_part === 'number') {\n\t\t\treturn left_part - right_part;\n\t\t}\n\t\tif (typeof left_part === 'number') return -1;\n\t\tif (typeof right_part === 'number') return 1;\n\t\treturn left_part < right_part ? -1 : 1;\n\t}\n\treturn 0;\n}\n\n/**\n * Whether a `typescript` package version is a native TypeScript 7 build that\n * speaks the content-mapper protocol and is at least\n * {@link MINIMUM_NATIVE_TYPESCRIPT_VERSION}, so `tsc --runExternalCode` can\n * type-check `.tsrx` files through `@tsrx/content-mapper`.\n * @param {string} version\n * @returns {boolean}\n */\nexport function has_content_mapper_protocol(version) {\n\treturn (\n\t\tis_native_typescript_package(version) &&\n\t\tcompare_typescript_versions(version, MINIMUM_NATIVE_TYPESCRIPT_VERSION) >= 0\n\t);\n}\n\n/** @typedef {'tsrx-tsc'} TypeScriptConsumer The language server finds its own (`find-typescript.js`). */\n\n/**\n * The message to show when `typescript` resolved to a package the given tool\n * cannot run on, or `undefined` when it can. `tsrx-tsc` runs on the classic\n * range through Volar and on TypeScript 7 builds with the content-mapper\n * protocol through native `tsc`; only a TypeScript 7 build older than\n * {@link MINIMUM_NATIVE_TYPESCRIPT_VERSION} (the stable 7.0 releases and the\n * earlier 7.1 nightlies) is unsupported there.\n * @param {{ version?: string } | string | undefined} typescript The `typescript` module, or its version.\n * @param {TypeScriptConsumer} tool\n * @returns {string | undefined}\n */\nexport function unsupported_typescript_message(typescript, tool) {\n\tconst version = typeof typescript === 'string' ? typescript : typescript?.version;\n\tif (typeof version !== 'string' || !is_native_typescript_package(version)) {\n\t\treturn undefined;\n\t}\n\tconst resolved = `resolved typescript@${version}, the native TypeScript compiler, whose npm package has no JavaScript API.`;\n\tswitch (tool) {\n\t\tcase 'tsrx-tsc':\n\t\t\tif (has_content_mapper_protocol(version)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn `tsrx-tsc ${resolved} tsrx-tsc runs TypeScript 7 through \"tsc --runExternalCode\" and @tsrx/content-mapper, which needs a 7.1 nightly with the content-mapper protocol (${MINIMUM_NATIVE_TYPESCRIPT_VERSION} or newer; install typescript@next), or TypeScript ${SUPPORTED_TYPESCRIPT_RANGE} through Volar. ${TYPESCRIPT_7_SUPPORT_NOTE}`;\n\t}\n}\n","/**\n * `tsrx-tsc` on TypeScript 7. The `typescript@7` package is a launcher for the\n * native compiler without a JavaScript API, so Volar cannot host it; instead\n * this module runs the platform binary itself with `--runExternalCode`, which\n * lets TypeScript start `@tsrx/content-mapper` for the `.tsrx` files the\n * project's `tsconfig.json` declares under `contentMappers`. The mapper is\n * never enabled on the command line by TypeScript itself (TS100024 without the\n * flag); `tsrx-tsc` turns it on because running it is already the decision to\n * execute the project's TSRX compiler, exactly as the classic path does\n * in-process.\n */\n\nimport { spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport { NODE_CONFIG_HOST } from './config-host.js';\nimport {\n\tget_own_config_value,\n\tload_tsconfig_layers,\n\tresolve_inherited_config_value,\n} from './tsconfig-resolution.js';\nimport { TYPESCRIPT_7_SUPPORT_NOTE } from './typescript-version.js';\n\nexport const RUN_EXTERNAL_CODE_FLAG = '--runExternalCode';\nexport const CONTENT_MAPPER_PACKAGE = '@tsrx/content-mapper';\n\n/**\n * The platform package the `typescript@7` launcher resolves its binary from:\n * `@typescript/typescript-<os>-<arch>`, listed as an optional dependency of the\n * launcher so package managers install only the matching one.\n * @returns {string}\n */\nexport function native_platform_package_name() {\n\treturn `@typescript/typescript-${process.platform}-${process.arch}`;\n}\n\n/**\n * Locate the native `tsc` binary the way the launcher's `lib/getExePath.js`\n * does, resolving the platform package from the launcher's own location.\n * @param {string} typescript_package_json_path The resolved `typescript/package.json`.\n * @returns {string}\n */\nexport function resolve_native_tsc_binary(typescript_package_json_path) {\n\tconst platform_package = native_platform_package_name();\n\tconst require = createRequire(typescript_package_json_path);\n\t/** @type {string} */\n\tlet platform_package_json;\n\ttry {\n\t\tplatform_package_json = require.resolve(`${platform_package}/package.json`);\n\t} catch {\n\t\tthrow new Error(\n\t\t\t`tsrx-tsc could not resolve ${platform_package} next to ${typescript_package_json_path}. Either this platform is unsupported by TypeScript 7, or the package is missing on disk (the typescript package lists it as an optional dependency; reinstall with optional dependencies enabled).`,\n\t\t);\n\t}\n\tconst binary = path.join(\n\t\tpath.dirname(platform_package_json),\n\t\t'lib',\n\t\tprocess.platform === 'win32' ? 'tsc.exe' : 'tsc',\n\t);\n\tif (!fs.existsSync(binary)) {\n\t\tthrow new Error(`tsrx-tsc found ${platform_package} but not its compiler at ${binary}.`);\n\t}\n\treturn binary;\n}\n\n/**\n * The argument list for native `tsc`: the user's arguments with\n * `--runExternalCode` added once. `--build` must stay the first argument, so\n * the flag follows the arguments in build mode and leads otherwise.\n * @param {readonly string[]} args\n * @returns {string[]}\n */\nexport function native_tsc_arguments(args) {\n\tif (args.includes(RUN_EXTERNAL_CODE_FLAG)) {\n\t\treturn [...args];\n\t}\n\treturn is_build_mode(args)\n\t\t? [...args, RUN_EXTERNAL_CODE_FLAG]\n\t\t: [RUN_EXTERNAL_CODE_FLAG, ...args];\n}\n\n/** @param {readonly string[]} args */\nfunction is_build_mode(args) {\n\treturn args[0] === '--build' || args[0] === '-b';\n}\n\nconst SOURCE_FILE_EXTENSIONS = /\\.(?:[cm]?[jt]sx?|tsrx|d\\.[cm]?ts)$/i;\n\n/** Flags after which `tsc` prints or writes something and never reads a project. */\nconst INFORMATIONAL_FLAGS = new Set(['--version', '-v', '--help', '-h', '--init']);\n\n/**\n * The `tsconfig.json` files whose sources a `tsc` invocation compiles,\n * mirroring how the compiler picks them: `-p`/`--project` (a file, or a\n * directory holding `tsconfig.json`; TypeScript accepts no `--project=path`\n * form); otherwise `tsconfig.json` in the working directory unless source\n * files are passed, which makes `tsc` ignore every tsconfig. In build mode the\n * roots are each positional argument that is a directory or a config file, or\n * the working directory when there is none, and the result is every project\n * in their `references` graph that compiles something: a solution-style config\n * (`files: []`) only points at other projects and is left out. Paths that do\n * not exist are left out, so `tsc` reports them itself, and `--version`,\n * `--help` and `--init` read none.\n * @param {readonly string[]} args\n * @param {string} cwd\n * @param {import('./config-host.js').ConfigHost} [host]\n * @returns {string[]}\n */\nexport function project_config_paths(args, cwd, host = NODE_CONFIG_HOST) {\n\t/** @type {string[]} */\n\tconst configs = [];\n\tif (args.some((arg) => INFORMATIONAL_FLAGS.has(arg))) {\n\t\treturn configs;\n\t}\n\t/** @param {string} candidate A file or a directory. */\n\tfunction add(candidate) {\n\t\tconst resolved = path.resolve(cwd, candidate);\n\t\tconst stats = fs.statSync(resolved, { throwIfNoEntry: false });\n\t\tif (stats?.isDirectory()) {\n\t\t\tconst nested = path.join(resolved, 'tsconfig.json');\n\t\t\tif (fs.existsSync(nested)) configs.push(nested);\n\t\t} else if (stats?.isFile()) {\n\t\t\tconfigs.push(resolved);\n\t\t}\n\t}\n\tif (is_build_mode(args)) {\n\t\tfor (const arg of args.slice(1)) {\n\t\t\tif (!arg.startsWith('-') && !SOURCE_FILE_EXTENSIONS.test(arg)) add(arg);\n\t\t}\n\t\tif (configs.length === 0) add('.');\n\t\treturn build_graph_projects(configs, host);\n\t}\n\tfor (let index = 0; index < args.length; index++) {\n\t\tconst arg = args[index];\n\t\tif (arg === '-p' || arg === '--project') {\n\t\t\tif (args[index + 1] !== undefined) add(args[index + 1]);\n\t\t\treturn configs;\n\t\t}\n\t}\n\tif (args.some((arg) => !arg.startsWith('-') && SOURCE_FILE_EXTENSIONS.test(arg))) {\n\t\treturn configs;\n\t}\n\tadd('.');\n\treturn configs;\n}\n\n/**\n * Walk the `references` graph of the build roots, in build order, and return\n * the projects that compile sources. `references` is the one top-level key\n * TypeScript does not inherit through `extends`, so each config's own entry is\n * read; `files` and `include` are inherited, and a config whose resolved\n * `files` is empty with no `include` is a solution that compiles nothing\n * (TypeScript unions the two lists). Configs that cannot be read are kept for\n * `tsc` to report.\n * @param {readonly string[]} roots\n * @param {import('./config-host.js').ConfigHost} host\n * @returns {string[]}\n */\nfunction build_graph_projects(roots, host) {\n\t/** @type {string[]} */\n\tconst projects = [];\n\tconst seen = new Set();\n\t/** @param {string} config_path */\n\tfunction visit(config_path) {\n\t\tif (seen.has(config_path)) return;\n\t\tseen.add(config_path);\n\t\tconst { layers, diagnostics, extends_failures } = load_tsconfig_layers(host, config_path);\n\t\tconst own = layers[layers.length - 1];\n\t\tconst references = get_own_config_value(own.config, ['references']);\n\t\tif (references.state === 'found' && Array.isArray(references.value)) {\n\t\t\tfor (const reference of references.value) {\n\t\t\t\tconst target = get_own_config_value(reference, ['path']);\n\t\t\t\tif (target.state !== 'found' || typeof target.value !== 'string') continue;\n\t\t\t\tconst resolved = path.resolve(own.dir, target.value);\n\t\t\t\tconst stats = fs.statSync(resolved, { throwIfNoEntry: false });\n\t\t\t\tif (stats?.isDirectory()) {\n\t\t\t\t\tconst nested = path.join(resolved, 'tsconfig.json');\n\t\t\t\t\tif (fs.existsSync(nested)) visit(nested);\n\t\t\t\t} else if (stats?.isFile()) {\n\t\t\t\t\tvisit(resolved);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// TypeScript unions `files` and `include`, so a solution is a config\n\t\t// whose `files` is empty and that has no `include` to add anything.\n\t\t/** @param {'files' | 'include'} key */\n\t\tconst is_empty_list = (key) => {\n\t\t\tconst value = resolve_inherited_config_value(layers, (layer) =>\n\t\t\t\tget_own_config_value(layer.config, [key]),\n\t\t\t);\n\t\t\treturn value.state === 'found' && Array.isArray(value.value) && value.value.length === 0;\n\t\t};\n\t\tconst include = resolve_inherited_config_value(layers, (layer) =>\n\t\t\tget_own_config_value(layer.config, ['include']),\n\t\t);\n\t\tconst is_solution =\n\t\t\tdiagnostics.length === 0 &&\n\t\t\textends_failures.length === 0 &&\n\t\t\tis_empty_list('files') &&\n\t\t\t(include.state === 'absent' || is_empty_list('include'));\n\t\tif (!is_solution) projects.push(config_path);\n\t}\n\tfor (const root of roots) visit(root);\n\treturn projects;\n}\n\n/**\n * Whether a tsconfig, through its `extends` chain, declares a content mapper\n * for `.tsrx` files. Without one, native `tsc` never spawns the mapper: `.tsrx`\n * files are silently not checked and their importers report TS2307, which a\n * type-check command must not let pass. A config that does not parse, or whose\n * `extends` chain does not resolve, counts as declared so that `tsc` reports\n * the real problem instead of this guard.\n * @param {string} config_path\n * @param {import('./config-host.js').ConfigHost} [host]\n * @returns {boolean}\n */\nexport function declares_tsrx_content_mapper(config_path, host = NODE_CONFIG_HOST) {\n\tconst { layers, diagnostics, extends_failures } = load_tsconfig_layers(host, config_path);\n\tif (diagnostics.length > 0 || extends_failures.length > 0) {\n\t\treturn true;\n\t}\n\tconst mappers = resolve_inherited_config_value(layers, (layer) =>\n\t\tget_own_config_value(layer.config, ['contentMappers']),\n\t);\n\tif (mappers.state === 'absent') {\n\t\treturn false;\n\t}\n\tif (!Array.isArray(mappers.value)) {\n\t\t// Let TypeScript report the malformed entry.\n\t\treturn true;\n\t}\n\treturn mappers.value.some(\n\t\t(entry) =>\n\t\t\tentry !== null &&\n\t\t\ttypeof entry === 'object' &&\n\t\t\tArray.isArray(/** @type {{ extensions?: unknown }} */ (entry).extensions) &&\n\t\t\t/** @type {{ extensions: unknown[] }} */ (entry).extensions.some(\n\t\t\t\t(extension) => typeof extension === 'string' && extension.toLowerCase() === '.tsrx',\n\t\t\t),\n\t);\n}\n\n/**\n * @param {string} config_path\n * @returns {string}\n */\nexport function missing_content_mapper_message(config_path) {\n\treturn `tsrx-tsc: ${config_path} declares no content mapper for .tsrx files, so TypeScript 7 would not check them. Install ${CONTENT_MAPPER_PACKAGE} next to the project and add \"contentMappers\": [{ \"package\": \"${CONTENT_MAPPER_PACKAGE}\", \"extensions\": [\".tsrx\"] }] at the top level of tsconfig.json (TypeScript 5 and 6 ignore the key, so the same file keeps working with the classic path). ${TYPESCRIPT_7_SUPPORT_NOTE}`;\n}\n\n/**\n * Run native `tsc --runExternalCode` for a `tsrx-tsc` invocation and return the\n * exit code. Output streams through untouched.\n * @param {{\n * \ttypescript_package_json_path: string,\n * \targs: readonly string[],\n * \tcwd?: string,\n * \tenv?: NodeJS.ProcessEnv,\n * \thost?: import('./config-host.js').ConfigHost,\n * \tstderr?: { write: (chunk: string) => unknown },\n * }} options\n * @returns {number}\n */\nexport function run_native_tsc(options) {\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst stderr = options.stderr ?? process.stderr;\n\t/** @type {string} */\n\tlet binary;\n\ttry {\n\t\tbinary = resolve_native_tsc_binary(options.typescript_package_json_path);\n\t} catch (error) {\n\t\tstderr.write(`${error instanceof Error ? error.message : String(error)}\\n`);\n\t\treturn 1;\n\t}\n\tfor (const config_path of project_config_paths(options.args, cwd, options.host)) {\n\t\tif (!declares_tsrx_content_mapper(config_path, options.host)) {\n\t\t\tstderr.write(`${missing_content_mapper_message(config_path)}\\n`);\n\t\t\treturn 1;\n\t\t}\n\t}\n\tconst result = spawnSync(binary, native_tsc_arguments(options.args), {\n\t\tcwd,\n\t\tenv: options.env ?? process.env,\n\t\tstdio: 'inherit',\n\t\twindowsHide: true,\n\t});\n\tif (result.error) {\n\t\tstderr.write(`tsrx-tsc could not start ${binary}: ${result.error.message}\\n`);\n\t\treturn 1;\n\t}\n\tif (result.status === null) {\n\t\tstderr.write(`tsrx-tsc: ${binary} was terminated by signal ${result.signal}.\\n`);\n\t\treturn 1;\n\t}\n\treturn result.status;\n}\n","#!/usr/bin/env node\n\nimport fs from 'node:fs';\nimport node_module, { createRequire } from 'node:module';\nimport { pathToFileURL } from 'node:url';\nimport { getTsrxLanguagePlugin } from './language.js';\nimport { run_native_tsc } from './native-tsc.js';\nimport {\n\tis_native_typescript_package,\n\tunsupported_typescript_message,\n} from './typescript-version.js';\n\nconst require = createRequire(import.meta.url);\n// `typescript` is an optional peer dependency: npm and pnpm do not install one.\n/** @type {string} */\nlet typescript_package_json_path;\ntry {\n\ttypescript_package_json_path = require.resolve('typescript/package.json');\n} catch {\n\tconsole.error(\n\t\t'tsrx-tsc needs the typescript package installed next to @tsrx/typescript-plugin. In the project: npm install -D typescript, or pnpm add -D typescript.',\n\t);\n\tprocess.exit(1);\n}\nconst typescript_version = /** @type {{ version: string }} */ (\n\trequire(typescript_package_json_path)\n).version;\n\n// The TypeScript 7 package is a launcher for the native binary without\n// `lib/tsc.js` or any other JavaScript entry. A build with the content-mapper\n// protocol is run natively with `--runExternalCode`; an older one (the stable\n// 7.0 releases, earlier nightlies) is explained instead of failing on the\n// export map.\nconst unsupported_typescript = unsupported_typescript_message(typescript_version, 'tsrx-tsc');\nif (unsupported_typescript) {\n\tconsole.error(unsupported_typescript);\n\tprocess.exit(1);\n}\nif (is_native_typescript_package(typescript_version)) {\n\tprocess.exit(run_native_tsc({ typescript_package_json_path, args: process.argv.slice(2) }));\n}\n\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\n// Deno's CommonJS loader bypasses Volar's fs.readFileSync patch. Read the CLI\n// through that patch explicitly, keeping Volar responsible for transforming it.\n// Older Node versions without registerHooks retain Volar's default loader.\nconst tsc_url = pathToFileURL(tscPath).href;\nconst hook = node_module.registerHooks?.({\n\tload(url, context, nextLoad) {\n\t\tif (url !== tsc_url) {\n\t\t\treturn nextLoad(url, context);\n\t\t}\n\t\tconst source = fs.readFileSync(tscPath, 'utf8');\n\t\t// Only the CLI entry needs interception. Restore normal loading before\n\t\t// it resolves the consumer's compiler and its dependencies.\n\t\thook?.deregister();\n\t\treturn { format: 'commonjs', source, shortCircuit: true };\n\t},\n});\n\ntry {\n\trunTsc(\n\t\ttscPath,\n\t\t{\n\t\t\textraSupportedExtensions: ['.tsrx'],\n\t\t\textraExtensionsToRemove: ['.tsrx'],\n\t\t},\n\t\t(ts, create_program_options) => {\n\t\t\tconst compiler_options =\n\t\t\t\t/** @type {import('typescript').CompilerOptions & {\n\t\t\t\t * configFile?: import('typescript').TsConfigSourceFile,\n\t\t\t\t * configFilePath?: string,\n\t\t\t\t * }} */ (create_program_options.options);\n\t\t\treturn [\n\t\t\t\tgetTsrxLanguagePlugin({\n\t\t\t\t\tts,\n\t\t\t\t\tconfigFileName: compiler_options.configFile?.fileName ?? compiler_options.configFilePath,\n\t\t\t\t\tconfigHost: ts.sys,\n\t\t\t\t}),\n\t\t\t];\n\t\t},\n\t);\n} finally {\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ClC,wBAAyB,CAAC,OAAO,CAClC,GACC,EAAI,IAA2B,CAC/B,IAAM,EAIK,EAAuB,QAClC,MAAO,CACNC,EAAAA,EAAsB,CACrB,KACA,eAAgB,EAAiB,YAAY,UAAY,EAAiB,eAC1E,WAAY,EAAG,GAChB,CAAC,CACF,CACD,CACD,CACD,QAAU,CACT,GAAM,WAAW,CAClB"}
|
|
1
|
+
{"version":3,"file":"tsc.js","names":["require","createRequire","path","fs","NODE_CONFIG_HOST","load_tsconfig_layers","get_own_config_value","resolve_inherited_config_value","spawnSync","path","require","createRequire","TSRX_EXTENSIONS","os","pathToFileURL","fs","getTsrxLanguagePlugin"],"sources":["../src/declaration-output.js","../src/typescript-version.js","../src/native-tsc.js","../src/tsc-diagnostics.js","../src/tsc.js"],"sourcesContent":["/**\n * A target compiler appends editor-only `ImportMetaEnv` / `ImportMeta` globals\n * (`withPlatformTypes` in `@tsrx/core`) to the virtual TSX of a module that\n * uses platform flags, so the flags type-check without `vite/client`. TypeScript\n * keeps every `declare global` block in declaration output, so each emitted\n * `.d.ts` would carry the block: two of them conflict in a consumer (TS2374,\n * duplicate index signature), and they pin the library's platform onto the\n * consumer's `import.meta.env`.\n */\n\nconst DECLARATION_FILE = /\\.d\\.[cm]?ts$/;\n\n/**\n * The generated block with every whitespace character removed, for each flag\n * value type it can print: `boolean` without a platform, else `true`/`false`.\n * Only this exact block is editor-only; an authored augmentation of the same\n * interfaces, which a library may ship on purpose, never matches.\n */\nconst PLATFORM_GLOBALS =\n\t/^declareglobal\\{interfaceImportMetaEnv\\{readonlyplatform:string&\\{readonlyweb:(?:true|false|boolean);readonlyios:(?:true|false|boolean);readonlyandroid:(?:true|false|boolean);\\};\\}interfaceImportMeta\\{readonly\\[key:`env\\$\\{string\\}`\\]:ImportMetaEnv;\\}\\}$/;\n\n/**\n * @param {typeof import('typescript')} ts\n * @param {string} text\n * @param {import('typescript').Statement} statement\n */\nfunction is_platform_globals(ts, text, statement) {\n\treturn (\n\t\tts.isModuleDeclaration(statement) &&\n\t\tts.isIdentifier(statement.name) &&\n\t\tts.idText(statement.name) === 'global' &&\n\t\tPLATFORM_GLOBALS.test(text.slice(statement.pos, statement.end).replace(/\\s+/g, ''))\n\t);\n}\n\n/**\n * @param {typeof import('typescript')} ts\n * @param {string} text\n * @returns {string}\n */\nexport function strip_platform_globals(ts, text) {\n\tif (!text.includes('ImportMetaEnv')) return text;\n\t// `ts` is the classic CLI's compiler-only module scope: it has no\n\t// `ScriptTarget` binding (99 is `ScriptTarget.Latest`), and its nodes lack the\n\t// language-service accessors (`text`, `getFullStart()`).\n\tconst source = ts.createSourceFile('output.d.ts', text, 99);\n\tlet result = text;\n\tfor (const statement of [...source.statements].reverse()) {\n\t\tif (is_platform_globals(ts, text, statement)) {\n\t\t\tresult = result.slice(0, statement.pos) + result.slice(statement.end);\n\t\t}\n\t}\n\treturn result;\n}\n\n/** @type {WeakSet<object>} */\nconst patched_systems = new WeakSet();\n\n/**\n * Strip the platform globals from every declaration file `ts.sys` writes. Every\n * `tsc` mode (`-p`, `--watch`, `--build`) writes through `ts.sys.writeFile`.\n *\n * @param {typeof import('typescript')} ts\n */\nexport function strip_platform_globals_from_declaration_output(ts) {\n\tconst system = ts.sys;\n\tif (patched_systems.has(system)) return;\n\tpatched_systems.add(system);\n\tconst write_file = system.writeFile;\n\tsystem.writeFile = (file_name, data, write_byte_order_mark) =>\n\t\twrite_file.call(\n\t\t\tsystem,\n\t\t\tfile_name,\n\t\t\tDECLARATION_FILE.test(file_name) ? strip_platform_globals(ts, data) : data,\n\t\t\twrite_byte_order_mark,\n\t\t);\n}\n","/**\n * The TypeScript versions TSRX's JavaScript tooling runs on, and the messages\n * shown when a project resolves a `typescript` package it cannot use.\n *\n * TypeScript 7 (`typescript@7`) is the native compiler: its npm package only\n * launches the platform binary and exposes no JavaScript API. Everything that\n * hosts TypeScript through Volar (the tsserver plugin, the classic TSRX language\n * server, and `tsrx-tsc` on the classic path) therefore needs TypeScript 5.9 or\n * 6 installed. The native path needs no other TypeScript: `@tsrx/content-mapper`\n * and the TSRX language server's native backend read `tsconfig.json` and resolve\n * compilers themselves (`tsconfig-resolution.js`, `package-resolution.js`), and\n * TypeScript 7 type-checks `.tsrx` files through the mapper, which needs a 7.1\n * nightly: the stable 7.0 releases have no content-mapper protocol. `tsrx-tsc`\n * runs that native path itself when the installed `typescript` is such a build\n * (`native-tsc.js`), so one command serves every supported TypeScript line.\n */\n\n/** The `typescript` versions whose JavaScript API TSRX runs on. */\nexport const SUPPORTED_TYPESCRIPT_RANGE = '^5.9.3 || ^6.0.0';\n\n/**\n * The oldest TypeScript 7 build `@tsrx/content-mapper` supports (`tsc\n * --runExternalCode`, `tsc --lsp`): the first 7.1 nightly whose `tsc --watch`\n * recompiles after an edit (microsoft/TypeScript#64351). The content-mapper\n * protocol itself arrived in `7.1.0-dev.20260822.1`. The VS Code \"TypeScript 7\n * Nightly\" extension version that bundles it is `0.<date>.<n>` for the same date.\n */\nexport const MINIMUM_NATIVE_TYPESCRIPT_VERSION = '7.1.0-dev.20260923.1';\n\n/**\n * Where the gaps in TypeScript 7 support and their upstream issues are tracked:\n * the tracking issue, which outlives the pull request that added the support.\n */\nexport const TYPESCRIPT_7_TRACKING_URL = 'https://github.com/tsrx-org/tsrx/issues/136';\n\n/** One sentence to append to every message that mentions TypeScript 7. */\nexport const TYPESCRIPT_7_SUPPORT_NOTE = `TypeScript 7 support for .tsrx files is not complete yet; the gaps and the upstream TypeScript issues behind them are tracked in ${TYPESCRIPT_7_TRACKING_URL}. If you run into one that is not listed there, please file a new issue on the tsrx repository.`;\n\n/**\n * @param {string} version\n * @returns {number}\n */\nexport function typescript_major(version) {\n\treturn Number.parseInt(version, 10);\n}\n\n/**\n * Whether a `typescript` package version is the native compiler (7 and up),\n * whose package has no JavaScript API.\n * @param {string} version\n * @returns {boolean}\n */\nexport function is_native_typescript_package(version) {\n\treturn typescript_major(version) >= 7;\n}\n\n/**\n * @typedef {object} ParsedTypeScriptVersion\n * @property {number[]} core `major.minor.patch` as numbers.\n * @property {'nightly' | 'prerelease' | 'release'} channel\n * @property {Array<number | string>} prerelease The dot-separated prerelease\n * identifiers, numeric ones as numbers.\n */\n\n/**\n * @param {string} version\n * @returns {ParsedTypeScriptVersion}\n */\nfunction parse_typescript_version(version) {\n\tconst [core_part, prerelease_part] = version.trim().split('-', 2);\n\tconst core = core_part.split('.').map((part) => Number.parseInt(part, 10) || 0);\n\twhile (core.length < 3) core.push(0);\n\tif (prerelease_part === undefined || prerelease_part === '') {\n\t\treturn { core, channel: 'release', prerelease: [] };\n\t}\n\tconst prerelease = prerelease_part\n\t\t.split('.')\n\t\t.map((part) => (/^\\d+$/.test(part) ? Number.parseInt(part, 10) : part));\n\treturn { core, channel: prerelease[0] === 'dev' ? 'nightly' : 'prerelease', prerelease };\n}\n\nconst CHANNEL_ORDER = { nightly: 0, prerelease: 1, release: 2 };\n\n/**\n * Order two `typescript` package versions. Semantic versioning except in one\n * respect: TypeScript's `-dev.<yyyymmdd>.<n>` nightlies are cut before the\n * betas and release candidates of the same `major.minor.patch`, so a\n * `-beta` or `-rc` build ranks above every nightly of that version, not\n * below it as plain identifier order would say.\n * @param {string} a\n * @param {string} b\n * @returns {number} Negative when `a` is older than `b`, positive when newer, `0` when equal.\n */\nexport function compare_typescript_versions(a, b) {\n\tconst left = parse_typescript_version(a);\n\tconst right = parse_typescript_version(b);\n\tfor (let index = 0; index < 3; index++) {\n\t\tif (left.core[index] !== right.core[index]) {\n\t\t\treturn left.core[index] - right.core[index];\n\t\t}\n\t}\n\tif (left.channel !== right.channel) {\n\t\treturn CHANNEL_ORDER[left.channel] - CHANNEL_ORDER[right.channel];\n\t}\n\tconst length = Math.max(left.prerelease.length, right.prerelease.length);\n\tfor (let index = 0; index < length; index++) {\n\t\tconst left_part = left.prerelease[index];\n\t\tconst right_part = right.prerelease[index];\n\t\tif (left_part === right_part) continue;\n\t\tif (left_part === undefined) return -1;\n\t\tif (right_part === undefined) return 1;\n\t\tif (typeof left_part === 'number' && typeof right_part === 'number') {\n\t\t\treturn left_part - right_part;\n\t\t}\n\t\tif (typeof left_part === 'number') return -1;\n\t\tif (typeof right_part === 'number') return 1;\n\t\treturn left_part < right_part ? -1 : 1;\n\t}\n\treturn 0;\n}\n\n/**\n * Whether a `typescript` package version is a native TypeScript 7 build that\n * speaks the content-mapper protocol and is at least\n * {@link MINIMUM_NATIVE_TYPESCRIPT_VERSION}, so `tsc --runExternalCode` can\n * type-check `.tsrx` files through `@tsrx/content-mapper`.\n * @param {string} version\n * @returns {boolean}\n */\nexport function has_content_mapper_protocol(version) {\n\treturn (\n\t\tis_native_typescript_package(version) &&\n\t\tcompare_typescript_versions(version, MINIMUM_NATIVE_TYPESCRIPT_VERSION) >= 0\n\t);\n}\n\n/** @typedef {'tsrx-tsc'} TypeScriptConsumer The language server finds its own (`find-typescript.js`). */\n\n/**\n * The message to show when `typescript` resolved to a package the given tool\n * cannot run on, or `undefined` when it can. `tsrx-tsc` runs on the classic\n * range through Volar and on TypeScript 7 builds with the content-mapper\n * protocol through native `tsc`; only a TypeScript 7 build older than\n * {@link MINIMUM_NATIVE_TYPESCRIPT_VERSION} (the stable 7.0 releases and the\n * earlier 7.1 nightlies) is unsupported there.\n * @param {{ version?: string } | string | undefined} typescript The `typescript` module, or its version.\n * @param {TypeScriptConsumer} tool\n * @returns {string | undefined}\n */\nexport function unsupported_typescript_message(typescript, tool) {\n\tconst version = typeof typescript === 'string' ? typescript : typescript?.version;\n\tif (typeof version !== 'string' || !is_native_typescript_package(version)) {\n\t\treturn undefined;\n\t}\n\tconst resolved = `resolved typescript@${version}, the native TypeScript compiler, whose npm package has no JavaScript API.`;\n\tswitch (tool) {\n\t\tcase 'tsrx-tsc':\n\t\t\tif (has_content_mapper_protocol(version)) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn `tsrx-tsc ${resolved} tsrx-tsc runs TypeScript 7 through \"tsc --runExternalCode\" and @tsrx/content-mapper, which needs a 7.1 nightly with the content-mapper protocol (${MINIMUM_NATIVE_TYPESCRIPT_VERSION} or newer; install typescript@next), or TypeScript ${SUPPORTED_TYPESCRIPT_RANGE} through Volar. ${TYPESCRIPT_7_SUPPORT_NOTE}`;\n\t}\n}\n","/**\n * `tsrx-tsc` on TypeScript 7. The `typescript@7` package is a launcher for the\n * native compiler without a JavaScript API, so Volar cannot host it; instead\n * this module runs the platform binary itself with `--runExternalCode`, which\n * lets TypeScript start `@tsrx/content-mapper` for the `.tsrx` files the\n * project's `tsconfig.json` declares under `contentMappers`. The mapper is\n * never enabled on the command line by TypeScript itself (TS100024 without the\n * flag); `tsrx-tsc` turns it on because running it is already the decision to\n * execute the project's TSRX compiler, exactly as the classic path does\n * in-process.\n */\n\nimport { spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport { NODE_CONFIG_HOST } from './config-host.js';\nimport {\n\tget_own_config_value,\n\tload_tsconfig_layers,\n\tresolve_inherited_config_value,\n} from './tsconfig-resolution.js';\nimport { TYPESCRIPT_7_SUPPORT_NOTE } from './typescript-version.js';\n\nexport const RUN_EXTERNAL_CODE_FLAG = '--runExternalCode';\nexport const CONTENT_MAPPER_PACKAGE = '@tsrx/content-mapper';\n\n/**\n * The platform package the `typescript@7` launcher resolves its binary from:\n * `@typescript/typescript-<os>-<arch>`, listed as an optional dependency of the\n * launcher so package managers install only the matching one.\n * @returns {string}\n */\nexport function native_platform_package_name() {\n\treturn `@typescript/typescript-${process.platform}-${process.arch}`;\n}\n\n/**\n * Locate the native `tsc` binary the way the launcher's `lib/getExePath.js`\n * does, resolving the platform package from the launcher's own location.\n * @param {string} typescript_package_json_path The resolved `typescript/package.json`.\n * @returns {string}\n */\nexport function resolve_native_tsc_binary(typescript_package_json_path) {\n\tconst platform_package = native_platform_package_name();\n\tconst require = createRequire(typescript_package_json_path);\n\t/** @type {string} */\n\tlet platform_package_json;\n\ttry {\n\t\tplatform_package_json = require.resolve(`${platform_package}/package.json`);\n\t} catch {\n\t\tthrow new Error(\n\t\t\t`tsrx-tsc could not resolve ${platform_package} next to ${typescript_package_json_path}. Either this platform is unsupported by TypeScript 7, or the package is missing on disk (the typescript package lists it as an optional dependency; reinstall with optional dependencies enabled).`,\n\t\t);\n\t}\n\tconst binary = path.join(\n\t\tpath.dirname(platform_package_json),\n\t\t'lib',\n\t\tprocess.platform === 'win32' ? 'tsc.exe' : 'tsc',\n\t);\n\tif (!fs.existsSync(binary)) {\n\t\tthrow new Error(`tsrx-tsc found ${platform_package} but not its compiler at ${binary}.`);\n\t}\n\treturn binary;\n}\n\n/**\n * The argument list for native `tsc`: the user's arguments with\n * `--runExternalCode` added once. `--build` must stay the first argument, so\n * the flag follows the arguments in build mode and leads otherwise.\n * @param {readonly string[]} args\n * @returns {string[]}\n */\nexport function native_tsc_arguments(args) {\n\tif (args.includes(RUN_EXTERNAL_CODE_FLAG)) {\n\t\treturn [...args];\n\t}\n\treturn is_build_mode(args)\n\t\t? [...args, RUN_EXTERNAL_CODE_FLAG]\n\t\t: [RUN_EXTERNAL_CODE_FLAG, ...args];\n}\n\n/** @param {readonly string[]} args */\nfunction is_build_mode(args) {\n\treturn args[0] === '--build' || args[0] === '-b';\n}\n\nconst SOURCE_FILE_EXTENSIONS = /\\.(?:[cm]?[jt]sx?|tsrx|d\\.[cm]?ts)$/i;\n\n/** Flags after which `tsc` prints or writes something and never reads a project. */\nconst INFORMATIONAL_FLAGS = new Set(['--version', '-v', '--help', '-h', '--init']);\n\n/**\n * The `tsconfig.json` files whose sources a `tsc` invocation compiles,\n * mirroring how the compiler picks them: `-p`/`--project` (a file, or a\n * directory holding `tsconfig.json`; TypeScript accepts no `--project=path`\n * form); otherwise `tsconfig.json` in the working directory unless source\n * files are passed, which makes `tsc` ignore every tsconfig. In build mode the\n * roots are each positional argument that is a directory or a config file, or\n * the working directory when there is none, and the result is every project\n * in their `references` graph that compiles something: a solution-style config\n * (`files: []`) only points at other projects and is left out. Paths that do\n * not exist are left out, so `tsc` reports them itself, and `--version`,\n * `--help` and `--init` read none.\n * @param {readonly string[]} args\n * @param {string} cwd\n * @param {import('./config-host.js').ConfigHost} [host]\n * @returns {string[]}\n */\nexport function project_config_paths(args, cwd, host = NODE_CONFIG_HOST) {\n\t/** @type {string[]} */\n\tconst configs = [];\n\tif (args.some((arg) => INFORMATIONAL_FLAGS.has(arg))) {\n\t\treturn configs;\n\t}\n\t/** @param {string} candidate A file or a directory. */\n\tfunction add(candidate) {\n\t\tconst resolved = path.resolve(cwd, candidate);\n\t\tconst stats = fs.statSync(resolved, { throwIfNoEntry: false });\n\t\tif (stats?.isDirectory()) {\n\t\t\tconst nested = path.join(resolved, 'tsconfig.json');\n\t\t\tif (fs.existsSync(nested)) configs.push(nested);\n\t\t} else if (stats?.isFile()) {\n\t\t\tconfigs.push(resolved);\n\t\t}\n\t}\n\tif (is_build_mode(args)) {\n\t\tfor (const arg of args.slice(1)) {\n\t\t\tif (!arg.startsWith('-') && !SOURCE_FILE_EXTENSIONS.test(arg)) add(arg);\n\t\t}\n\t\tif (configs.length === 0) add('.');\n\t\treturn build_graph_projects(configs, host);\n\t}\n\tfor (let index = 0; index < args.length; index++) {\n\t\tconst arg = args[index];\n\t\tif (arg === '-p' || arg === '--project') {\n\t\t\tif (args[index + 1] !== undefined) add(args[index + 1]);\n\t\t\treturn configs;\n\t\t}\n\t}\n\tif (args.some((arg) => !arg.startsWith('-') && SOURCE_FILE_EXTENSIONS.test(arg))) {\n\t\treturn configs;\n\t}\n\tadd('.');\n\treturn configs;\n}\n\n/**\n * Walk the `references` graph of the build roots, in build order, and return\n * the projects that compile sources. `references` is the one top-level key\n * TypeScript does not inherit through `extends`, so each config's own entry is\n * read; `files` and `include` are inherited, and a config whose resolved\n * `files` is empty with no `include` is a solution that compiles nothing\n * (TypeScript unions the two lists). Configs that cannot be read are kept for\n * `tsc` to report.\n * @param {readonly string[]} roots\n * @param {import('./config-host.js').ConfigHost} host\n * @returns {string[]}\n */\nfunction build_graph_projects(roots, host) {\n\t/** @type {string[]} */\n\tconst projects = [];\n\tconst seen = new Set();\n\t/** @param {string} config_path */\n\tfunction visit(config_path) {\n\t\tif (seen.has(config_path)) return;\n\t\tseen.add(config_path);\n\t\tconst { layers, diagnostics, extends_failures } = load_tsconfig_layers(host, config_path);\n\t\tconst own = layers[layers.length - 1];\n\t\tconst references = get_own_config_value(own.config, ['references']);\n\t\tif (references.state === 'found' && Array.isArray(references.value)) {\n\t\t\tfor (const reference of references.value) {\n\t\t\t\tconst target = get_own_config_value(reference, ['path']);\n\t\t\t\tif (target.state !== 'found' || typeof target.value !== 'string') continue;\n\t\t\t\tconst resolved = path.resolve(own.dir, target.value);\n\t\t\t\tconst stats = fs.statSync(resolved, { throwIfNoEntry: false });\n\t\t\t\tif (stats?.isDirectory()) {\n\t\t\t\t\tconst nested = path.join(resolved, 'tsconfig.json');\n\t\t\t\t\tif (fs.existsSync(nested)) visit(nested);\n\t\t\t\t} else if (stats?.isFile()) {\n\t\t\t\t\tvisit(resolved);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// TypeScript unions `files` and `include`, so a solution is a config\n\t\t// whose `files` is empty and that has no `include` to add anything.\n\t\t/** @param {'files' | 'include'} key */\n\t\tconst is_empty_list = (key) => {\n\t\t\tconst value = resolve_inherited_config_value(layers, (layer) =>\n\t\t\t\tget_own_config_value(layer.config, [key]),\n\t\t\t);\n\t\t\treturn value.state === 'found' && Array.isArray(value.value) && value.value.length === 0;\n\t\t};\n\t\tconst include = resolve_inherited_config_value(layers, (layer) =>\n\t\t\tget_own_config_value(layer.config, ['include']),\n\t\t);\n\t\tconst is_solution =\n\t\t\tdiagnostics.length === 0 &&\n\t\t\textends_failures.length === 0 &&\n\t\t\tis_empty_list('files') &&\n\t\t\t(include.state === 'absent' || is_empty_list('include'));\n\t\tif (!is_solution) projects.push(config_path);\n\t}\n\tfor (const root of roots) visit(root);\n\treturn projects;\n}\n\n/**\n * Whether a tsconfig, through its `extends` chain, declares a content mapper\n * for `.tsrx` files. Without one, native `tsc` never spawns the mapper: `.tsrx`\n * files are silently not checked and their importers report TS2307, which a\n * type-check command must not let pass. A config that does not parse, or whose\n * `extends` chain does not resolve, counts as declared so that `tsc` reports\n * the real problem instead of this guard.\n * @param {string} config_path\n * @param {import('./config-host.js').ConfigHost} [host]\n * @returns {boolean}\n */\nexport function declares_tsrx_content_mapper(config_path, host = NODE_CONFIG_HOST) {\n\tconst { layers, diagnostics, extends_failures } = load_tsconfig_layers(host, config_path);\n\tif (diagnostics.length > 0 || extends_failures.length > 0) {\n\t\treturn true;\n\t}\n\tconst mappers = resolve_inherited_config_value(layers, (layer) =>\n\t\tget_own_config_value(layer.config, ['contentMappers']),\n\t);\n\tif (mappers.state === 'absent') {\n\t\treturn false;\n\t}\n\tif (!Array.isArray(mappers.value)) {\n\t\t// Let TypeScript report the malformed entry.\n\t\treturn true;\n\t}\n\treturn mappers.value.some(\n\t\t(entry) =>\n\t\t\tentry !== null &&\n\t\t\ttypeof entry === 'object' &&\n\t\t\tArray.isArray(/** @type {{ extensions?: unknown }} */ (entry).extensions) &&\n\t\t\t/** @type {{ extensions: unknown[] }} */ (entry).extensions.some(\n\t\t\t\t(extension) => typeof extension === 'string' && extension.toLowerCase() === '.tsrx',\n\t\t\t),\n\t);\n}\n\n/**\n * @param {string} config_path\n * @returns {string}\n */\nexport function missing_content_mapper_message(config_path) {\n\treturn `tsrx-tsc: ${config_path} declares no content mapper for .tsrx files, so TypeScript 7 would not check them. Install ${CONTENT_MAPPER_PACKAGE} next to the project and add \"contentMappers\": [{ \"package\": \"${CONTENT_MAPPER_PACKAGE}\", \"extensions\": [\".tsrx\"] }] at the top level of tsconfig.json (TypeScript 5 and 6 ignore the key, so the same file keeps working with the classic path). ${TYPESCRIPT_7_SUPPORT_NOTE}`;\n}\n\n/**\n * Run native `tsc --runExternalCode` for a `tsrx-tsc` invocation and return the\n * exit code. Output streams through untouched.\n * @param {{\n * \ttypescript_package_json_path: string,\n * \targs: readonly string[],\n * \tcwd?: string,\n * \tenv?: NodeJS.ProcessEnv,\n * \thost?: import('./config-host.js').ConfigHost,\n * \tstderr?: { write: (chunk: string) => unknown },\n * }} options\n * @returns {number}\n */\nexport function run_native_tsc(options) {\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst stderr = options.stderr ?? process.stderr;\n\t/** @type {string} */\n\tlet binary;\n\ttry {\n\t\tbinary = resolve_native_tsc_binary(options.typescript_package_json_path);\n\t} catch (error) {\n\t\tstderr.write(`${error instanceof Error ? error.message : String(error)}\\n`);\n\t\treturn 1;\n\t}\n\tfor (const config_path of project_config_paths(options.args, cwd, options.host)) {\n\t\tif (!declares_tsrx_content_mapper(config_path, options.host)) {\n\t\t\tstderr.write(`${missing_content_mapper_message(config_path)}\\n`);\n\t\t\treturn 1;\n\t\t}\n\t}\n\tconst result = spawnSync(binary, native_tsc_arguments(options.args), {\n\t\tcwd,\n\t\tenv: options.env ?? process.env,\n\t\tstdio: 'inherit',\n\t\twindowsHide: true,\n\t});\n\tif (result.error) {\n\t\tstderr.write(`tsrx-tsc could not start ${binary}: ${result.error.message}\\n`);\n\t\treturn 1;\n\t}\n\tif (result.status === null) {\n\t\tstderr.write(`tsrx-tsc: ${binary} was terminated by signal ${result.signal}.\\n`);\n\t\treturn 1;\n\t}\n\treturn result.status;\n}\n","/** @import { Language } from '@volar/language-core' */\n/** @import { Diagnostic, Program, SourceFile } from 'typescript' */\n\nimport path from 'node:path';\n\n/**\n * @typedef {{\n * \tmessage?: unknown,\n * \tcode?: unknown,\n * \tseverity?: unknown,\n * \ttype?: unknown,\n * \tpos?: unknown,\n * \tloc?: { line?: unknown, column?: unknown, start?: { line?: unknown, column?: unknown } },\n * }} LoggedDiagnostic\n *\n * The parts of a `.tsrx` file's virtual code (`TSRXVirtualCode`) this reads.\n * @typedef {{\n * \tlanguageId: string,\n * \toriginalCode: string,\n * \tfatalErrors: ReadonlyArray<unknown>,\n * \tusageErrors: ReadonlyArray<unknown>,\n * }} CompiledFile\n */\n\nconst TYPESCRIPT_CODE = /^TS(\\d+)$/;\nconst LINE_BREAK = /\\r\\n?|[\\n\\u2028\\u2029]/g;\n\n/**\n * Print the compile errors and warnings of each `.tsrx` file in a program the way\n * tsc prints a diagnostic, `App.tsrx(2,13): error TS1186: message`: the path\n * relative to the current directory, the 1-based line and column when the\n * diagnostic has a position, then the severity and the diagnostic `code`. A\n * thrown (fatal) error stops the compile, so it prints as an error whatever its\n * `severity`, as the language server shows it.\n *\n * An error with a TypeScript code is a mistake the parser collects where\n * TypeScript's parser goes on (#415). When tsc reports the same code at the\n * same place in the file, its line is the one tsc prints, so this one is left\n * out, as the language server leaves it to TypeScript (#946).\n *\n * `tsrx-tsc` calls this once for each program it checks, after Volar has\n * decorated it, so its diagnostics point at the `.tsrx` source.\n * @param {Language<string>} language\n * @param {Program} program\n * @param {readonly string[]} extensions the file extensions the TSRX language plugin serves\n * @param {(line: string) => void} write\n * @returns {boolean} whether an error was printed\n */\nexport function report_tsrx_diagnostics(language, program, extensions, write) {\n\tlet printed_error = false;\n\t/** @type {boolean | undefined} */\n\tlet semantic_reported;\n\tfor (const source_file of program.getSourceFiles()) {\n\t\tif (!extensions.some((extension) => source_file.fileName.endsWith(extension))) continue;\n\t\tconst root = /** @type {CompiledFile | undefined} */ (\n\t\t\tlanguage.scripts.get(source_file.fileName)?.generated?.root\n\t\t);\n\t\tif (root?.languageId !== 'tsrx') continue;\n\t\tconst errors = [...root.fatalErrors, ...root.usageErrors];\n\t\tif (errors.length === 0) continue;\n\n\t\t/** @type {Set<string> | undefined} */\n\t\tlet reported_by_typescript;\n\t\t/** @type {Set<string>} */\n\t\tconst printed = new Set();\n\t\tconst file_name = relative_file_name(source_file.fileName);\n\t\tfor (const error of errors) {\n\t\t\tconst diagnostic = describe_diagnostic(error, root.originalCode);\n\t\t\tif (diagnostic.severity === 'error' && diagnostic.code && diagnostic.offset !== undefined) {\n\t\t\t\tconst match = TYPESCRIPT_CODE.exec(diagnostic.code);\n\t\t\t\tif (match) {\n\t\t\t\t\tsemantic_reported ??= reports_semantic_diagnostics(program);\n\t\t\t\t\treported_by_typescript ??= typescript_places(program, source_file, semantic_reported);\n\t\t\t\t\tif (reported_by_typescript.has(`${match[1]}@${diagnostic.offset}`)) continue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst line = format_diagnostic(file_name, diagnostic);\n\t\t\tif (printed.has(line)) continue;\n\t\t\tprinted.add(line);\n\t\t\twrite(line);\n\t\t\tif (diagnostic.severity === 'error') printed_error = true;\n\t\t}\n\t}\n\treturn printed_error;\n}\n\n/**\n * Whether tsc reports the program's semantic diagnostics: as\n * `emitFilesAndReportErrors` decides, not with `--listFilesOnly`, and only when\n * no file has a syntax error and the options and globals have no errors. The\n * diagnostics are cached, so tsc reuses them when it asks next.\n * @param {Program} program\n * @returns {boolean}\n */\nfunction reports_semantic_diagnostics(program) {\n\treturn (\n\t\t!program.getCompilerOptions().listFilesOnly &&\n\t\tprogram.getSyntacticDiagnostics().length === 0 &&\n\t\tprogram.getOptionsDiagnostics().length === 0 &&\n\t\tprogram.getGlobalDiagnostics().length === 0\n\t);\n}\n\n/**\n * The codes and source offsets of the diagnostics tsc reports for a file, as\n * `<code>@<offset>`: its syntactic diagnostics, and its semantic ones when tsc\n * reports those.\n * @param {Program} program\n * @param {SourceFile} source_file\n * @param {boolean} semantic_reported\n * @returns {Set<string>}\n */\nfunction typescript_places(program, source_file, semantic_reported) {\n\t/** @type {Set<string>} */\n\tconst places = new Set();\n\t/** @type {ReadonlyArray<Diagnostic>[]} */\n\tconst lists = [program.getSyntacticDiagnostics(source_file)];\n\tif (semantic_reported) lists.push(program.getSemanticDiagnostics(source_file));\n\tfor (const diagnostics of lists) {\n\t\tfor (const diagnostic of diagnostics) {\n\t\t\tif (diagnostic.file?.fileName !== source_file.fileName) continue;\n\t\t\tif (diagnostic.start === undefined) continue;\n\t\t\tplaces.add(`${diagnostic.code}@${diagnostic.start}`);\n\t\t}\n\t}\n\treturn places;\n}\n\n/**\n * The path tsc prints for a file: relative to the current directory, with `/`.\n * @param {string} file_name\n * @returns {string}\n */\nfunction relative_file_name(file_name) {\n\tconst relative = path.relative(process.cwd(), file_name);\n\treturn (path.isAbsolute(relative) ? file_name : relative).replaceAll('\\\\', '/');\n}\n\n/**\n * @param {unknown} error\n * @param {string} source the compiled text, which a diagnostic's `pos` indexes\n * @returns {{\n * \tmessage: string,\n * \tseverity: 'error' | 'warning',\n * \tcode: string | undefined,\n * \tstart: { line: number, column: number } | undefined,\n * \toffset: number | undefined,\n * }}\n */\nfunction describe_diagnostic(error, source) {\n\tconst details =\n\t\terror && typeof error === 'object' ? /** @type {LoggedDiagnostic} */ (error) : undefined;\n\tconst message = details && 'message' in details ? String(details.message) : String(error);\n\tconst severity =\n\t\tdetails?.severity === 'warning' && details.type !== 'fatal' ? 'warning' : 'error';\n\tconst code =\n\t\ttypeof details?.code === 'string' && details.code.length > 0 ? details.code : undefined;\n\tconst start = diagnostic_start(details, source);\n\treturn {\n\t\tmessage,\n\t\tseverity,\n\t\tcode,\n\t\tstart,\n\t\toffset: start ? offset_of(start, source) : undefined,\n\t};\n}\n\n/**\n * @param {string} file_name\n * @param {ReturnType<typeof describe_diagnostic>} diagnostic\n * @returns {string}\n */\nfunction format_diagnostic(file_name, { message, severity, code, start }) {\n\tconst label = code === undefined ? severity : `${severity} ${code}`;\n\tconst position = start ? `(${start.line},${start.column + 1})` : '';\n\treturn `${file_name}${position}: ${label}: ${message}`;\n}\n\n/**\n * Where a diagnostic starts, as a 1-based line and a 0-based column. A\n * collected error's `loc` is a range, and a parse error acorn throws gives its\n * position as `loc` itself (`{ line, column }`). A diagnostic without `loc`,\n * such as one a consumer compiler builds with only `pos` and `end`, is placed\n * by `pos` in `source`, breaking lines where tsc does.\n * @param {LoggedDiagnostic | undefined} details\n * @param {string} source\n * @returns {{ line: number, column: number } | undefined}\n */\nfunction diagnostic_start(details, source) {\n\tconst start = details?.loc?.start ?? details?.loc;\n\tif (typeof start?.line === 'number' && typeof start?.column === 'number') {\n\t\treturn { line: start.line, column: start.column };\n\t}\n\tconst pos = details?.pos;\n\tif (typeof pos !== 'number' || pos < 0 || pos > source.length) return undefined;\n\tlet line = 1;\n\tlet line_start = 0;\n\tfor (const match of source.slice(0, pos).matchAll(LINE_BREAK)) {\n\t\tline++;\n\t\tline_start = match.index + match[0].length;\n\t}\n\treturn { line, column: pos - line_start };\n}\n\n/**\n * The offset in `source` of a 1-based line and 0-based column.\n * @param {{ line: number, column: number }} start\n * @param {string} source\n * @returns {number | undefined}\n */\nfunction offset_of({ line, column }, source) {\n\tlet line_start = 0;\n\tlet current = 1;\n\tfor (const match of source.matchAll(LINE_BREAK)) {\n\t\tif (current === line) break;\n\t\tcurrent++;\n\t\tline_start = match.index + match[0].length;\n\t}\n\treturn current === line ? line_start + column : undefined;\n}\n","#!/usr/bin/env node\n\nimport fs from 'node:fs';\nimport node_module, { createRequire } from 'node:module';\nimport os from 'node:os';\nimport { pathToFileURL } from 'node:url';\nimport { strip_platform_globals_from_declaration_output } from './declaration-output.js';\nimport { TSRX_EXTENSIONS, getTsrxLanguagePlugin } from './language.js';\nimport { with_tsrx_module_format_on_host } from './module-format.js';\nimport { run_native_tsc } from './native-tsc.js';\nimport { report_tsrx_diagnostics } from './tsc-diagnostics.js';\nimport {\n\tis_native_typescript_package,\n\tunsupported_typescript_message,\n} from './typescript-version.js';\n\nconst require = createRequire(import.meta.url);\n// `typescript` is an optional peer dependency: npm and pnpm do not install one.\n/** @type {string} */\nlet typescript_package_json_path;\ntry {\n\ttypescript_package_json_path = require.resolve('typescript/package.json');\n} catch {\n\tconsole.error(\n\t\t'tsrx-tsc needs the typescript package installed next to @tsrx/typescript-plugin. In the project: npm install -D typescript, or pnpm add -D typescript.',\n\t);\n\tprocess.exit(1);\n}\nconst typescript_version = /** @type {{ version: string }} */ (\n\trequire(typescript_package_json_path)\n).version;\n\n// The TypeScript 7 package is a launcher for the native binary without\n// `lib/tsc.js` or any other JavaScript entry. A build with the content-mapper\n// protocol is run natively with `--runExternalCode`; an older one (the stable\n// 7.0 releases, earlier nightlies) is explained instead of failing on the\n// export map.\nconst unsupported_typescript = unsupported_typescript_message(typescript_version, 'tsrx-tsc');\nif (unsupported_typescript) {\n\tconsole.error(unsupported_typescript);\n\tprocess.exit(1);\n}\nif (is_native_typescript_package(typescript_version)) {\n\tprocess.exit(run_native_tsc({ typescript_package_json_path, args: process.argv.slice(2) }));\n}\n\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\n// Volar decorates each program tsc creates so that its diagnostics point at the\n// `.tsrx` source. Print the TSRX compile errors and warnings of the program's\n// `.tsrx` files then, before tsc reports its own diagnostics.\nconst decorate_program_module =\n\t/** @type {typeof import('@volar/typescript/lib/node/decorateProgram.js')} */ (\n\t\trequire('@volar/typescript/lib/node/decorateProgram.js')\n\t);\nconst decorate_program = decorate_program_module.decorateProgram;\nlet printed_tsrx_error = false;\ndecorate_program_module.decorateProgram = (language, program) => {\n\tdecorate_program(language, program);\n\t// tsc writes to standard output, with the platform's line break.\n\tconst printed_error = report_tsrx_diagnostics(language, program, TSRX_EXTENSIONS, (line) =>\n\t\tprocess.stdout.write(`${line}${os.EOL}`),\n\t);\n\tprinted_tsrx_error ||= printed_error;\n};\n\n// TypeScript knows nothing of the TSRX errors, so a run where they are the only\n// errors would exit 0. Exit 2 then, as tsc does when it reports an error and\n// emits; a nonzero code of tsc's own stays. A warning doesn't change the exit\n// code. tsc exits through `sys.exit`, which calls `process.exit`; in watch mode\n// it doesn't exit.\nconst exit = process.exit;\nprocess.exit = (code) =>\n\texit.call(process, printed_tsrx_error && (code === undefined || code === 0) ? 2 : code);\n\n// Deno's CommonJS loader bypasses Volar's fs.readFileSync patch. Read the CLI\n// through that patch explicitly, keeping Volar responsible for transforming it.\n// Older Node versions without registerHooks retain Volar's default loader.\nconst tsc_url = pathToFileURL(tscPath).href;\nconst hook = node_module.registerHooks?.({\n\tload(url, context, nextLoad) {\n\t\tif (url !== tsc_url) {\n\t\t\treturn nextLoad(url, context);\n\t\t}\n\t\tconst source = fs.readFileSync(tscPath, 'utf8');\n\t\t// Only the CLI entry needs interception. Restore normal loading before\n\t\t// it resolves the consumer's compiler and its dependencies.\n\t\thook?.deregister();\n\t\treturn { format: 'commonjs', source, shortCircuit: true };\n\t},\n});\n\ntry {\n\trunTsc(\n\t\ttscPath,\n\t\t{\n\t\t\textraSupportedExtensions: ['.tsrx'],\n\t\t\textraExtensionsToRemove: ['.tsrx'],\n\t\t},\n\t\t(ts, create_program_options) => {\n\t\t\tconst compiler_options =\n\t\t\t\t/** @type {import('typescript').CompilerOptions & {\n\t\t\t\t * configFile?: import('typescript').TsConfigSourceFile,\n\t\t\t\t * configFilePath?: string,\n\t\t\t\t * }} */ (create_program_options.options);\n\t\t\tif (create_program_options.host) {\n\t\t\t\twith_tsrx_module_format_on_host(ts, create_program_options.host, compiler_options);\n\t\t\t}\n\t\t\tstrip_platform_globals_from_declaration_output(ts);\n\t\t\treturn [\n\t\t\t\tgetTsrxLanguagePlugin({\n\t\t\t\t\tts,\n\t\t\t\t\tconfigFileName: compiler_options.configFile?.fileName ?? compiler_options.configFilePath,\n\t\t\t\t\tconfigHost: ts.sys,\n\t\t\t\t}),\n\t\t\t];\n\t\t},\n\t);\n} finally {\n\thook?.deregister();\n}\n"],"mappings":";+PAUA,MAAM,EAAmB,gBAQnB,EACL,iQAOD,SAAS,EAAoB,EAAI,EAAM,EAAW,CACjD,OACC,EAAG,oBAAoB,CAAS,GAChC,EAAG,aAAa,EAAU,IAAI,GAC9B,EAAG,OAAO,EAAU,IAAI,IAAM,UAC9B,EAAiB,KAAK,EAAK,MAAM,EAAU,IAAK,EAAU,GAAG,CAAC,CAAC,QAAQ,OAAQ,EAAE,CAAC,CAEpF,CAOA,SAAgB,EAAuB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AA,cAAAA,CAAc,CAAO,CAAC,CAAC,KACjC,EAAO,EAAA,QAAY,gBAAgB,CACxC,KAAK,EAAK,EAAS,EAAU,CAC5B,GAAI,IAAQ,GACX,OAAO,EAAS,EAAK,CAAO,EAE7B,IAAM,EAASC,EAAAA,QAAG,aAAa,EAAS,MAAM,EAI9C,OADA,GAAM,WAAW,EACV,CAAE,OAAQ,WAAY,SAAQ,aAAc,EAAK,CACzD,CACD,CAAC,EAED,GAAI,CACH,EACC,EACA,CACC,yBAA0B,CAAC,OAAO,EAClC,wBAAyB,CAAC,OAAO,CAClC,GACC,EAAI,IAA2B,CAC/B,IAAM,EAIK,EAAuB,QAKlC,OAJI,EAAuB,MAC1B,EAAA,EAAgC,EAAI,EAAuB,KAAM,CAAgB,EAElF,EAA+C,CAAE,EAC1C,CACNC,EAAAA,EAAsB,CACrB,KACA,eAAgB,EAAiB,YAAY,UAAY,EAAiB,eAC1E,WAAY,EAAG,GAChB,CAAC,CACF,CACD,CACD,CACD,QAAU,CACT,GAAM,WAAW,CAClB"}
|
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.
|
|
6
|
+
"version": "0.7.1",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"bin": {
|
|
9
9
|
"tsrx-tsc": "./dist/tsc.js"
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"@types/node": "^24.3.0",
|
|
33
33
|
"tsdown": "^0.23.0",
|
|
34
34
|
"typescript": "^5.9.3",
|
|
35
|
-
"@tsrx/core": "0.
|
|
35
|
+
"@tsrx/core": "0.6.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"typescript": "^5.9.3 || ^6.0.0 || ^7.1.0-dev.20260923.1",
|
|
39
39
|
"@tsrx/ripple": "^0.2.0",
|
|
40
40
|
"octane": "*",
|
|
41
|
-
"@tsrx/content-mapper": "0.1.
|
|
42
|
-
"@tsrx/react": "0.
|
|
43
|
-
"@tsrx/solid": "0.
|
|
44
|
-
"@tsrx/preact": "0.
|
|
45
|
-
"@tsrx/vue": "0.
|
|
41
|
+
"@tsrx/content-mapper": "0.1.4",
|
|
42
|
+
"@tsrx/react": "0.5.1",
|
|
43
|
+
"@tsrx/solid": "0.4.1",
|
|
44
|
+
"@tsrx/preact": "0.4.1",
|
|
45
|
+
"@tsrx/vue": "0.4.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"typescript": {
|
|
@@ -1,5 +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,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));let l=require("fs");l=c(l,1);let u=require("path");u=c(u,1);let d=require("module"),f=require("url"),p=require("node:fs");p=c(p,1);let m=require("node:url"),h=require("node:path");h=c(h,1);let g=require("jsonc-parser");var _=/* @__PURE__ */ 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}}})),v=/* @__PURE__ */ 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}e<l?c=t-1:s=t+1}}})),y=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SourceMap=void 0;let t=_(),n=v();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=/* @__PURE__ */ 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=/* @__PURE__ */ 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(()=>/* @__PURE__ */ 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}})),b=/* @__PURE__ */ 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(y(),e),n(v(),e)})),x=/* @__PURE__ */ 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=ee,e.isCompletionEnabled=C,e.isAutoInsertEnabled=w,e.isSignatureHelpEnabled=te,e.shouldReportDiagnostics=ne,e.resolveRenameNewName=T,e.resolveRenameEditText=E,e.findOverlapCodeRange=D;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 ee(e){return!!e.format}function C(e){return!!e.completion}function w(e){return!!e.completion}function te(e){return!!e.completion}function ne(e,t,n){return typeof e.verification==`object`?e.verification.shouldReport?.(t,n)??!0:!!e.verification}function T(e,t){return typeof t.navigation==`object`?t.navigation.resolveRenameNewName?.(e)??e:e}function E(e,t){return typeof t.navigation==`object`?t.navigation.resolveRenameEditText?.(e)??e:e}function D(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=O(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 O(e,t,n,r){let i=Math.max(e,n),a=Math.min(t,r);if(!(i>a))return{start:i,end:a}}})),S=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LinkedCodeMap=void 0;let t=b();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]}}})),ee=/* @__PURE__ */ o((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),C=/* @__PURE__ */ 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=/* @__PURE__ */ 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()}}})),w=/* @__PURE__ */ 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=b();Object.defineProperty(e,"SourceMap",{enumerable:!0,get:function(){return r.SourceMap}}),n(x(),e),n(S(),e),n(ee(),e),n(C(),e);let i=b(),a=S();e.defaultMapperFactory=e=>new i.SourceMap(e);function o(t,n,r,i){let o=/* @__PURE__ */ new WeakMap,c=/* @__PURE__ */ new WeakMap,l=/* @__PURE__ */ 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}this.delete(e);return}}else return t}else{let t={id:e,languageId:i,snapshot:r,associatedIds:/* @__PURE__ */ new Set,targetIds:/* @__PURE__ */ 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:/* @__PURE__ */ 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=/* @__PURE__ */ 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)}})),te=w();function ne(){let e=(0,m.fileURLToPath)(require("url").pathToFileURL(__filename).href),t=e.replace(/[a-zA-Z]/g,e=>e===e.toLowerCase()?e.toUpperCase():e.toLowerCase());return t===e||!p.default.existsSync(t)}let T;function E(){return T??=ne(),T}function D(e){try{return p.default.statSync(e,{throwIfNoEntry:!1})}catch{return}}function O(){return{fileExists:e=>D(e)?.isFile()===!0,directoryExists:e=>D(e)?.isDirectory()===!0,readFile:e=>{try{return p.default.readFileSync(e,`utf8`)}catch{return}},useCaseSensitiveFileNames:E,getModifiedTime:e=>D(e)?.mtime,realpath:e=>{try{return p.default.realpathSync(e)}catch{return e}}}}const k=O(),re=e=>typeof e==`object`&&!!e,A=(e,t)=>Object.assign(/* @__PURE__ */ Error(`[${e}]: ${t}`),{code:e}),ie=`ERR_INVALID_PACKAGE_CONFIG`,j=`ERR_INVALID_PACKAGE_TARGET`,ae=/^\d+$/,oe=/^(\.{1,2}|node_modules)$/i,se=/\/|\\/;var ce=(e=>(e.Export=`exports`,e.Import=`imports`,e))(ce||{});const M=(e,t,n,r,i)=>{if(t==null)return[];if(typeof t==`string`){let[n,...r]=t.split(se);if(n===`..`||r.some(e=>oe.test(e)))throw A(j,`Invalid "${e}" target "${t}" defined in the package config`);return[i?t.replace(/\*/g,i):t]}if(Array.isArray(t))return t.flatMap(t=>M(e,t,n,r,i));if(re(t)){for(let a of Object.keys(t)){if(ae.test(a))throw A(ie,`Cannot contain numeric property keys`);if(a==="default"||r.includes(a))return M(e,t[a],n,r,i)}return[]}throw A(j,`Invalid "${e}" target "${t}"`)},le=(e,t)=>{let n=e.indexOf(`*`),r=t.indexOf(`*`);return n===r?t.length>e.length:r>n};function ue(e,t){if(!t.includes(`*`)&&e.hasOwnProperty(t))return[t];let n,r;for(let i of Object.keys(e))if(i.includes(`*`)){let[e,a,o]=i.split(`*`);if(o===void 0&&t.startsWith(e)&&t.endsWith(a)){let o=t.slice(e.length,-a.length||void 0);o&&(!n||le(n,i))&&(n=i,r=o)}}return[n,r]}const de=e=>Object.keys(e).reduce((e,t)=>{let n=t===``||t[0]!==`.`;if(e===void 0||e===n)return n;throw A(ie,`"exports" cannot contain some keys starting with "." and some not`)},void 0),fe=/^\w+:/,pe=(e,t,n)=>{if(!e)throw Error(`"exports" is required`);t=t===``?`.`:`./${t}`,(typeof e==`string`||Array.isArray(e)||re(e)&&de(e))&&(e={".":e});let[r,i]=ue(e,t),a=M(ce.Export,e[r],t,n,i);if(a.length===0)throw A(`ERR_PACKAGE_PATH_NOT_EXPORTED`,t===`.`?`No "exports" main defined`:`Package subpath '${t}' is not defined by "exports"`);for(let e of a)if(!e.startsWith(`./`)&&!fe.test(e))throw A(j,`Invalid "exports" target "${e}" defined in the package config`);return a};function N(e){if(e===``||e.startsWith(`.`)||h.default.isAbsolute(e))return;let t=e.split(`/`),n=e.startsWith(`@`)?2:1;if(!(t.length<n||t.slice(0,n).some(e=>e===``)))return{name:t.slice(0,n).join(`/`),subpath:t.slice(n).join(`/`)}}function P(e,t){return e.directoryExists?e.directoryExists(t):e.fileExists(h.default.join(t,`package.json`))}function F(e,t){let n=e.readFile(h.default.join(t,`package.json`));if(n!==void 0)try{let e=JSON.parse(n);return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}catch{return}}function I(e,t,n){let r=[],i=h.default.resolve(t);for(;;){if(h.default.basename(i)!==`node_modules`){let t=h.default.join(i,`node_modules`,n);P(e,t)&&r.push(t)}let t=h.default.dirname(i);if(t===i)return r;i=t}}function L(e,t,n){let r=e?.exports;if(r==null)return[];try{return pe(r,t,n)}catch{return[]}}function me(e,t,n={}){let r=N(e);if(!r)return;let i=n.host??k,a=n.conditions??[`node`,`require`,`default`];for(let e of I(i,t,r.name)){let t=F(i,e);for(let n of L(t,r.subpath,a)){let t=h.default.resolve(e,n);if(i.fileExists(t))return t}if(t?.exports!==void 0&&t.exports!==null)continue;let n=typeof t?.main==`string`?t.main:void 0,o=r.subpath===``?n===void 0?[`index`]:[n,`index`]:[r.subpath];for(let t of o){let n=h.default.resolve(e,t);for(let e of[n,`${n}.js`,`${n}.cjs`,`${n}.mjs`,`${n}.json`,h.default.join(n,`index.js`)])if(i.fileExists(e))return e}}}function R(e,t,n){let r=typeof n?.tsconfig==`string`?n.tsconfig:`tsconfig.json`,i=h.default.resolve(t,r);return!e.fileExists(i)&&!i.endsWith(`.json`)&&(i=`${i}.json`),e.fileExists(i)?i:void 0}function he(e,t,n=k){let r=e===`..`?h.default.join(`..`,`tsconfig.json`):e;if(r.startsWith(`.`)&&(r=h.default.resolve(t,r)),h.default.isAbsolute(r)){if(n.fileExists(r))return{path:r,candidate:r};let e=r.endsWith(`.json`)?r:`${r}.json`;return n.fileExists(e)?{path:e,candidate:e}:{candidate:e}}let i=N(e);if(!i)return{};for(let e of I(n,t,i.name)){let t=n.realpath?n.realpath(e):e,r=F(n,t);if(r?.exports!==void 0&&r.exports!==null){let[e]=L(r,i.subpath,[`require`,`types`]);if(e===void 0)return{};let a=h.default.resolve(t,e);return n.fileExists(a)?{path:a}:{}}if(i.subpath===``){let e=R(n,t,r);if(e!==void 0)return{path:e}}let a=h.default.join(t,i.subpath);if(!a.endsWith(`.json`)&&n.fileExists(`${a}.json`))return{path:`${a}.json`};if(P(n,a)){let e=R(n,a,F(n,a));if(e!==void 0)return{path:e}}else if(a.endsWith(`.json`)&&n.fileExists(a))return{path:a}}return{}}function ge(e){let t=e.charCodeAt(0)===65279?e.slice(1):e;if(t.trim()===``)return{value:{}};let n=[],r=(0,g.parse)(t,n,{allowTrailingComma:!0,disallowComments:!1});if(n.length>0){let[e]=n;return{value:void 0,error:{message:`${(0,g.printParseErrorCode)(e.error)} at offset ${e.offset}`,offset:e.offset}}}return{value:r}}const z=1005;function B(e,t){let n=/* @__PURE__ */ new Map,r=[],i=[],a=/* @__PURE__ */ new Set,o=[],s=[],c=/* @__PURE__ */ new Set,l=[],u=/* @__PURE__ */ new Set,d=typeof e.useCaseSensitiveFileNames==`function`?e.useCaseSensitiveFileNames():e.useCaseSensitiveFileNames;function f(e){return h.default.normalize(h.default.resolve(e))}function p(e){let t=f(e);return d?t:t.toLowerCase()}function m(e){for(let t of e){let e=`${t.code}\0${t.file??``}\0${t.message}`;c.has(e)||(c.add(e),o.push(t))}}function g(e){let t=f(e),n=p(t);a.has(n)||(a.add(n),i.push(t))}function _(t){let r=f(t),i=p(r),a=n.get(i);if(a)return a;let o=e.readFile(r),s=[],c={};if(o!==void 0){let e=ge(o);e.error?s.push({code:z,message:`Failed to parse ${r}: ${e.error.message}`,file:r}):e.value!==null&&typeof e.value==`object`&&!Array.isArray(e.value)?c=e.value:s.push({code:z,message:`The root value of ${r} must be an object.`,file:r})}let l=c.extends,u=Array.isArray(l)?l:l===void 0?[]:[l],d={path:r,dir:h.default.dirname(r),config:c,raw_source:o,parse_diagnostics:s,extends_values:u};return n.set(i,d),m(s),d}function v(t,n){if(typeof n!=`string`){let e={code:5024,message:`Compiler option 'extends' requires a value of type string.`,file:t.path};m([e]),s.push({config_path:t.path,extends_value:n,resolved_path:void 0,diagnostics:[e]});return}let r=he(n,t.dir,e),i=r.path??r.candidate;if(i!==void 0&&g(i),r.path===void 0){let e={code:6053,message:`File '${r.candidate??n}' not found.`,file:t.path};m([e]),s.push({config_path:t.path,extends_value:n,resolved_path:i,diagnostics:[e]});return}if(u.has(p(r.path))){let e={code:18e3,message:`Circularity detected while resolving configuration: ${[...l,f(r.path)].join(` -> `)}`,file:t.path};m([e]),s.push({config_path:t.path,extends_value:n,resolved_path:i,diagnostics:[e]});return}return r.path}function y(e){let t=f(e),n=p(t);u.add(n),l.push(t),g(t);let i=_(t);for(let e of i.extends_values){let t=v(i,e);t!==void 0&&y(t)}r.push({path:i.path,dir:i.dir,config:i.config,raw_source:i.raw_source,parse_diagnostics:i.parse_diagnostics}),l.pop(),u.delete(n)}return y(t),{layers:r,dependencies:i,diagnostics:o,extends_failures:s}}function V(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 H(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 U=process.env.TSRX_DEBUG===`true`;function W(e){return{log(...t){U&&console.log(e,...t)},logError(...t){U&&console.error(e,...t)},logWarning(...t){U&&console.warn(e,...t)}}}const{log:_e,logError:G,logWarning:ve}=W(`[TSRX Language]`),ye=/^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*(?:\/[A-Za-z0-9][A-Za-z0-9._~-]*)*$/,be=/["']tsrx["']\s*:/;let K=/* @__PURE__ */ new WeakMap;const q=/* @__PURE__ */ new Map;function J(e){return{actual_type:e===null?`null`:Array.isArray(e)?`array`:typeof e,actual_value:JSON.stringify(e)??String(e)}}function xe(e){let t=K.get(e);return t||(t={nearest_config_paths:/* @__PURE__ */ new Map,resolved_config_layers:/* @__PURE__ */ new Map},K.set(e,t)),t}function Se(e,t){let n=u.default.normalize(u.default.resolve(e));return(typeof t.useCaseSensitiveFileNames==`function`?t.useCaseSensitiveFileNames():t.useCaseSensitiveFileNames)?n:n.toLowerCase()}function Ce(e){let t=V(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`,...J(n)};let r=V(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`,...J(i)}}function we(e){let t=V(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`,...J(n)};let r=V(n,[`platform`]);if(r.state===`absent`)return{state:`absent`};let i=r.value;return i===`web`||i===`ios`||i===`android`?{state:`declared`,value:i}:{state:`invalid`,target:`platform`,...J(i)}}function Te(e,t,n){let r=e,i=[];for(;r;){let e=Se(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=u.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=u.default.dirname(r);if(o===r)break;r=o}for(let e of i)n.nearest_config_paths.set(e,null);return null}function Ee(e,t,n){let r=Se(t,e),i=n.resolved_config_layers.get(r);if(i&&(i.dependency_modified_times===void 0||[...i.dependency_modified_times].every(([t,n])=>e.getModifiedTime?.(t)?.valueOf()===n)))return i.value;let a=B(e,t),o=e.getModifiedTime?new Map(a.dependencies.map(t=>[t,e.getModifiedTime?.(t)?.valueOf()])):void 0;return n.resolved_config_layers.set(r,{value:a,dependency_modified_times:o}),a}function De(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 Oe(e,t,n){return me(n,u.default.dirname(t),{host:e})}function ke(e,t,n){let r=`${t}\0${n}`;if(q.has(r))return q.get(r)??null;if(!ye.test(n))return q.set(r,null),G(`Declared TSRX compiler must be a bare package specifier:`,n,`in ${t}`),null;try{let e=(0,d.createRequire)(t).resolve(n);return q.set(r,e),_e(`Found declared tsrx compiler at:`,e,`from tsconfig:`,t),e}catch{let i=Oe(e,t,n);return i===void 0?(G(`Unable to resolve declared TSRX compiler "${n}" from tsconfig`,t),null):(q.set(r,i),_e(`Found declared tsrx compiler after uncached retry at:`,i,`from tsconfig:`,t),i)}}function Ae(e,t={}){let n=t.configHost??k,r=xe(n),i=t.configFileName??Te(u.default.dirname(e),n,r);if(i===null)return;let a=Ee(n,i,r);for(let e of a.dependencies)t.dependencies?.add(e);let o=a.layers.filter(e=>e.raw_source===void 0);if(o.length>0){for(let e of o)G(`Unable to read tsconfig layer:`,e.path);return null}let s=a.layers.filter(e=>e.parse_diagnostics.length>0);if(s.length>0){let e=a.layers.some(e=>V(e.config,[`tsrx`]).state===`found`?!0:e.parse_diagnostics.length===0||e.raw_source===void 0?!1:be.test(e.raw_source)),t=e?G:ve;for(let e of s)for(let n of e.parse_diagnostics)t(`Unable to parse tsconfig layer:`,e.path,n.message);return e?null:void 0}let c=H(a.layers,e=>Ce(e.config));if(c.state===`invalid`)return G(`Invalid TSRX ${c.target} declaration:`,c.actual_type,c.actual_value,`in ${c.config_path}`),null;let l=a.extends_failures.filter(e=>c.state!==`declared`||!De(a.layers,e,c.config_path));if(l.length>0){for(let e of l){if(e.diagnostics.length===0){G(`Unable to resolve tsconfig extends entry:`,JSON.stringify(e.extends_value),`in ${e.config_path}`);continue}for(let t of e.diagnostics)G(`Unable to resolve tsconfig extends entry:`,JSON.stringify(e.extends_value),`in ${e.config_path}`,t.message)}return null}if(c.state===`declared`)return ke(n,c.config_path,c.value)}function je(e,t={}){let n=t.configHost??k,r=xe(n),i=t.configFileName??Te(u.default.dirname(e),n,r);if(i===null)return;let a=Ee(n,i,r);for(let e of a.dependencies)t.dependencies?.add(e);let o=a.layers.find(e=>e.raw_source===void 0);if(o){let e=`Unable to read tsconfig layer while resolving TSRX platform: ${o.path}`;throw G(e),Error(e)}let s=a.layers.filter(e=>e.parse_diagnostics.length>0);if(s.length>0){if(!a.layers.some(e=>V(e.config,[`tsrx`]).state===`found`||e.parse_diagnostics.length>0&&e.raw_source!==void 0&&be.test(e.raw_source)))return;let e=s[0],t=e.parse_diagnostics[0].message,n=`Unable to parse tsconfig layer while resolving TSRX platform: ${e.path}: ${t}`;throw G(n),Error(n)}let c=H(a.layers,e=>we(e.config));if(c.state===`invalid`){let e=c.target===`platform`?` Expected "web", "ios", or "android".`:``,t=`Invalid TSRX ${c.target} declaration: ${c.actual_type} ${c.actual_value} in ${c.config_path}.${e}`;throw G(t),TypeError(t)}let l=a.extends_failures.filter(e=>c.state!==`declared`||!De(a.layers,e,c.config_path));if(l.length>0){if(!t.requirePlatformResolution)return c.state===`declared`?c.value:void 0;let e=l[0],n=e.diagnostics.length>0?`: ${e.diagnostics[0].message}`:``,r=`Unable to resolve tsconfig extends entry ${JSON.stringify(e.extends_value)} in ${e.config_path} while resolving TSRX platform${n}`;throw G(r),Error(r)}return c.state===`declared`?c.value:void 0}function Me(e,t,n,r={}){let i;try{i=e.compile_to_volar_mappings(n,t,{loose:!0,platform:r.platform})}catch(e){let t=e;return t.type=`fatal`,{text:``,mappings:[],cssRegions:[],scriptRegions:[],errors:[],fatalError:t,sourceAst:null}}let a=Ue(i.scriptMappings??[]),o=Ve(He(i.code??``,a),i.mappings??[],a);return{text:o.text,mappings:o.mappings,cssRegions:Ue(i.cssMappings??[]),scriptRegions:a,errors:i.errors??[],fatalError:null,sourceAst:i.sourceAst??null}}const Ne={verification:!0,completion:!0,semantic:!0,navigation:!0,structure:!0,format:!1,customData:{}},Pe=/^[ \t]*import\s+(?:type\s+)?(?:(?:[\w$]+\s*,\s*)?(?:\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s+)?(['"])[^'"\n]*\1(?:\s+with\s*\{[^}]*\})?[ \t]*;?/gm,Fe=/^[ \t]*export\s+(?:type\s+)?(?:(?:\{[^}]*\}|\*(?:\s+as\s+[\w$]+)?)(?:\s+from\s+(['"])[^'"\n]*\1(?:\s+with\s*\{[^}]*\})?)?|=\s*[^;\n]*)[ \t]*;?/gm,Ie=/^([ \t]*)(export[ \t]+default[ \t]+)(?=(?:async[ \t]+)?function[ \t]*\*?[ \t]*[A-Za-z_$]|(?:abstract[ \t]+)?class[ \t]+(?!(?:extends|implements)\b)[A-Za-z_$])/gm,Le=/^([ \t]*)(export[ \t]+default[ \t]+)(?=\S)/gm,Re=/^([ \t]*)(export[ \t]+)(?=(?:async[ \t]+)?(?:const|let|var|function|class|type|interface|enum|abstract|declare|namespace|module)\b)/gm;function ze(e){return e.replace(Fe,e=>e.replace(/[^\r\n]/g,` `)).replace(Ie,(e,t,n)=>t+` `.repeat(n.length)).replace(Le,(e,t,n)=>`${t}const ${`_default`.padEnd(n.length-6-1,`_`)}=`).replace(Re,(e,t,n)=>t+` `.repeat(n.length))}function Be(e){let t=[];for(let n of e.matchAll(Pe)){let e=n.index+n[0].length-n[0].trimStart().length;t.push({start:e,end:n.index+n[0].length})}return t}function Ve(e,t,n){let r=[...t];for(let t of n){if(t.length===0||t.content.length!==t.length)continue;let n=Be(t.content),i=[],a=[],o=[],s=``,c=ze(t.content);for(let{start:r,end:l}of n)i.push(t.start+r),a.push(e.length+1+s.length),o.push(l-r),s+=t.content.slice(r,l)+`
|
|
2
|
-
`,c=c.slice(0,r)+` `.repeat(l-r)+c.slice(l);let l=`\n${s};{\n`,u=e.length+l.length,d=0;for(let{start:e,end:r}of[...n,{start:t.length,end:t.length}])e>d&&(i.push(t.start+d),a.push(u+d),o.push(e-d)),d=r;e+=`${l}${c}\n}\n`,i.length>0&&r.push({sourceOffsets:i,generatedOffsets:a,lengths:o,generatedLengths:[...o],data:{...Ne,customData:{embeddedId:t.id}}})}return{text:e,mappings:r}}function He(e,t){let n=0;for(let r of t){if(r.length===0)continue;let t=`${r.content}<\/script>`,i=e.indexOf(t,n);if(i<0)continue;let a=r.content.replace(/[^\r\n]/g,` `);e=e.slice(0,i)+a+e.slice(i+r.content.length),n=i+t.length}return e}function Ue(e){return e.map(e=>({id:String(e.data?.customData?.embeddedId??``),start:e.sourceOffsets[0],length:e.lengths[0],content:String(e.data?.customData?.content??``)}))}function We(e){return Ge(e,/<style\b((?:[^>"'{}/]|"[^"]*"|'[^']*'|\{(?:[^{}]|\{[^{}]*\})*\}|\/(?!>))*)>([\s\S]*?)<\/style>/gi,6,`style`)}function Ge(e,t,n,r){let i=[],a;for(;(a=t.exec(e))!==null;){let e=a[1],t=a[2],o=a.index+n+e.length+1;i.push({id:`${r}_${i.length}`,start:o,length:t.length,content:t})}return i}const Ke=(0,d.createRequire)(require("url").pathToFileURL(__filename).href),qe=u.default.dirname((0,f.fileURLToPath)(require("url").pathToFileURL(__filename).href)),{log:Y,logWarning:Je,logError:X}=W(`[TSRX Language]`),Ye=/* @__PURE__ */ new Set,Xe=[`.tsrx`],Ze=[[`@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`]]]],Qe=[[`src`,`index.js`]];function $e(e){return Xe.some(t=>e.endsWith(t))}function et(e){let t=[],n=e.length,r=0,i=[],a=0;function o(){for(;r<n&&e[r]!=="`";){if(e[r]===`\\`){r+=2;continue}if(e[r]===`$`&&e[r+1]===`{`){i.push(a),r+=2;return}r+=1}r<n&&(r+=1)}for(;r<n;){let s=e[r],c=e[r+1];if(/\s/.test(s))r+=1;else if(s===`/`&&c===`/`)for(;r<n&&e[r]!==`
|
|
3
|
-
`;)r+=1;else if(s===`/`&&c===`*`){let t=e.indexOf(`*/`,r+2);r=t<0?n:t+2}else if(s===`"`||s===`'`){for(r+=1;r<n&&e[r]!==s&&e[r]!==`
|
|
4
|
-
`;)e[r]===`\\`&&(r+=1),r+=1;r+=1}else if(s==="`")r+=1,o();else if(s===`}`&&i.length>0&&i[i.length-1]===a)i.pop(),r+=1,o();else if(/[A-Za-z_$]/.test(s)){let i=r+1;for(;i<n&&/[\w$]/.test(e[i]);)i+=1;t.push({kind:`word`,text:e.slice(r,i)}),r=i}else s===`?`&&c===`.`?(t.push({kind:`question-dot`,text:`?.`}),r+=2):s===`.`?(t.push({kind:`dot`,text:`.`}),r+=1):(s===`{`?a+=1:s===`}`&&--a,t.push({kind:`other`,text:s}),r+=1)}return t}function tt(e,t){let n=et(e),r=[`import`,`.`,`meta`,`.`,`env`,`.`,`platform`,`.`];for(let e=0;e+r.length<n.length;e+=1){if(e>0&&(n[e-1].kind===`dot`||n[e-1].kind===`question-dot`)||!r.every((t,r)=>n[e+r].text===t))continue;let t=n[e+r.length].text;if(t===`web`||t===`ios`||t===`android`)return!0}return!1}function nt(e={}){Y(`Creating TSRX language plugin...`),e.ts;let t={...e,configHost:e.configHost??k};return{getLanguageId(e){let t=typeof e==`string`?e:e.fsPath.replace(/\\/g,`/`);if($e(t))return Y(`Identified TSRX file:`,t),`tsrx`},createVirtualCode(e,n,r){if(n===`tsrx`){let n=ut(e),i=pt(n,t);if(!i){X(`TSRX compiler not found for file: ${n}`);return}Y(`Creating virtual code for:`,n);try{return new it(n,r,i,e=>je(n,{...t,requirePlatformResolution:e}))}catch(e){throw X(`Failed to create virtual code for:`,n,`:`,e),e}}},updateVirtualCode(e,t,n){if(t instanceof it)return Y(`Updating existing virtual code for:`,t.fileName),t.update(n),t},typescript:{extraFileExtensions:Xe.map(e=>({extension:e.slice(1),isMixedContent:!1,scriptKind:7})),getServiceScript(e){for(let t of(0,te.forEachEmbeddedCode)(e))if(t.languageId===`tsrx`)return{code:t,extension:`.tsx`,scriptKind:4}}}}}const Z=/* @__PURE__ */ new Set;function rt(e){return Z.has(Q(e))}function Q(e){return e.replace(/\\/g,`/`).toLowerCase()}var it=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(Y(`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 X(`Invalid TSRX compiler - missing compile_to_volar_mappings method`),Error(`Invalid TSRX compiler`);this.update(t)}update(e){Y(`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=!1,i=-1;if(Y(`changeRange:`,JSON.stringify(n)),n){let e=n.span.start,a=e+n.span.length,o=e+n.newLength,s=this.originalCode.substring(e,a),c=t.substring(e,o);if(Y(`Change details:`),Y(` Position:`,e,`-`,a,`(length:`,n.span.length,`)`),Y(` Old text:`,JSON.stringify(s)),Y(` New text:`,JSON.stringify(c),`(length:`,n.newLength,`)`),c.endsWith(`.`)){let e=o>1?t[o-2]:``;Y(` Char before dot:`,JSON.stringify(e)),/[$#_\u200C\u200D\p{ID_Continue}\)\]\}]/u.test(e)&&(r=!0,i=o-1,Y(`ChangeRange detected dot typed at position`,i))}}let a;try{let e=this.platformProvider?.(tt(t));if(r&&i>=0){this.isDotCompletionMode=!0;let n=t.substring(0,i)+t.substring(i+1);if(Y(`Compiling without typed dot at position`,i),a=Me(this.tsrx,this.fileName,n,{platform:e}),!a.fatalError&&a.text&&a.mappings.length>0){Y(`Compilation without dot successful`);let e=ct(a,i);e===null?Je(`Failed to restore typed dot into transpiled output`):Y(`Inserted typed dot at generated position`,e)}}else Y(`Compiling TSRX code...`),a=Me(this.tsrx,this.fileName,t,{platform:e})}catch(e){let t=e;t.type=`fatal`,a={text:``,mappings:[],cssRegions:[],scriptRegions:[],errors:[],fatalError:t,sourceAst:null}}if(a.fatalError?(X(`TSRX compilation failed for`,this.fileName,`:`,a.fatalError),process.env.TSRX_TSC===`true`&&ot(this.fileName,[a.fatalError]),this.fatalErrors.push(a.fatalError),Z.add(Q(this.fileName))):(Y(`Compilation successful, generated code length:`,a.text.length),Z.delete(Q(this.fileName))),this.originalCode=t,!a.fatalError&&a.text){if(this.generatedCode=a.text,this.mappings=a.mappings,this.usageErrors=a.errors,this.sourceAst=a.sourceAst,process.env.TSRX_TSC===`true`&&a.errors.length>0&&ot(this.fileName,a.errors),a.cssRegions.length>0&&Y(`Creating`,a.cssRegions.length,`CSS embedded codes`),this.embeddedCodes=a.cssRegions.map(e=>st(e,`css`)),U){Y(`CSS embedded codes:`,(this.embeddedCodes||[]).length),Y(`Using transpiled code, mapping count:`,this.mappings.length),Y(`Original code length:`,t.length),Y(`Generated code length:`,this.generatedCode.length),Y(`Last 100 chars of original:`,JSON.stringify(t.slice(-100))),Y(`Last 200 chars of generated:`,JSON.stringify(this.generatedCode.slice(-200))),Y(`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];Y(` 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}`)}}}else Y(`Compilation failed, only display where the compilation error occurred.`),this.generatedCode=t,this.mappings=[{sourceOffsets:[0],generatedOffsets:[0],lengths:[t.length],generatedLengths:[t.length],data:{completion:!0,verification:!0,customData:{}}}],this.embeddedCodes=We(t).map(e=>st(e,`css`));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=/* @__PURE__ */ new Map,this.#t=/* @__PURE__ */ 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]+at(e-n.sourceOffsets[0],n.generatedLengths[0]),a=r.generatedOffsets[0]+at(t-r.sourceOffsets[0],r.generatedLengths[0]);return[i,Math.max(a,i+1)]}};function at(e,t){return Math.min(Math.max(e,0),t)}function ot(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}`;Ye.has(r)||(Ye.add(r),console.error(`[tsrx-tsc] ${e}: ${t}`))}}function st(e,t){let n=e.content,r={sourceOffsets:[e.start],generatedOffsets:[0],lengths:[e.length],generatedLengths:[e.length],data:{verification:!0,completion:!0,semantic:!0,navigation:!0,structure:!0,format:!1,customData:{content:n,embeddedId:e.id}}};return{id:e.id,languageId:t,snapshot:{getText:(e,t)=>n.substring(e,t),getLength:()=>e.length,getChangeRange:()=>void 0},mappings:[r],embeddedCodes:[]}}function ct(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.text=e.text.substring(0,i)+`.`+e.text.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 lt=/* @__PURE__ */ new Map,$=/* @__PURE__ */ new Map;function ut(e){return typeof e==`string`?e:e.fsPath.replace(/\\/g,`/`)}function dt(e,t=l.default.existsSync){let n=e,r=[];for(;n;){if($.has(n)){let e=$.get(n)??null;for(let t of r)$.set(t,e);return e}r.push(n);let e=u.default.join(n,`package.json`);if(t(e))try{let t=JSON.parse(l.default.readFileSync(e,`utf8`)),n=/* @__PURE__ */ 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)$.set(e,i);return i}catch{for(let e of r)$.set(e,null);return null}let i=u.default.dirname(n);if(i===n)break;n=i}for(let e of r)$.set(e,null);return null}function ft(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 pt(e,t){let n=_t(e,t);if(n)return mt(n)}function mt(e){return ht(Ke(e))}function ht(e){return typeof e?.compile_to_volar_mappings!=`function`&&typeof e?.compileToVolarMappings==`function`?{...e,compile_to_volar_mappings:e.compileToVolarMappings}:e}function gt(e,t=l.default.existsSync,n=lt){let r=e.split(`/`),i=u.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=Qe]of Ze)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=dt(a,t);r=e.find(([e,,t])=>ft(n,e,t))?.[1]??e[0][1],Y(`Found tsrx compiler at:`,r,`for extension:`,i)}n.set(o,r)}let s=n.get(o);if(s)return s}}function _t(e,t){let n=u.default.extname(e),r=Ae(e,t);if(r!==void 0)return r??void 0;let i=dt(u.default.dirname(e)),a=gt(e);if(a)return a;let o=`No supported tsrx compiler found in workspace for ${e}.`,s=qe;for(;s;){let e=[];for(let[t,r,i,a,o=Qe]of Ze){if(!i.includes(n))continue;let c=u.default.join(s,...r);for(let n of o){let r=u.default.join(c,...n);if(l.default.existsSync(r)){e.push([t,r,a]);break}}}if(e.length>0){let t=e.find(([e,,t])=>ft(i,e,t))?.[1]??e[0][1];return Je(`${o} Using packaged version at ${t}`),t}let t=u.default.dirname(s);if(t===s)break;s=t}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return nt}});
|
|
5
|
-
//# sourceMappingURL=language-C8Cl5qyV.js.map
|