From 2426615a1ed6df5739cb1f6b8a378bdd84e853c3 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Sun, 24 Nov 2024 23:57:14 +0800 Subject: [PATCH] feat(core): import wasm file --- .vscode/settings.json | 3 + Cargo.lock | 179 ++++++++- Cargo.toml | 41 +- package.json | 2 + packages/cli/package.json | 4 +- packages/integrate-module/.gitignore | 1 + packages/integrate-module/src/add.wasm | Bin 0 -> 41 bytes packages/integrate-module/src/index.ts | 3 +- packages/integrate-module/tsconfig.json | 2 + packages/ts-wasm-language-service/Cargo.toml | 23 ++ packages/ts-wasm-language-service/build.rs | 3 + packages/ts-wasm-language-service/example.mjs | 9 + packages/ts-wasm-language-service/index.d.ts | 4 + packages/ts-wasm-language-service/index.js | 364 ++++++++++++++++++ .../ts-wasm-language-service/package.json | 13 + packages/ts-wasm-language-service/src/lib.rs | 56 +++ packages/ts-wasm-language-service/ts/index.ts | 58 +++ .../ts-wasm-language-service/tsconfig.json | 10 + pnpm-lock.yaml | 147 ++++--- tsconfig.json | 11 +- 20 files changed, 854 insertions(+), 79 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 packages/integrate-module/.gitignore create mode 100644 packages/integrate-module/src/add.wasm create mode 100644 packages/ts-wasm-language-service/Cargo.toml create mode 100644 packages/ts-wasm-language-service/build.rs create mode 100644 packages/ts-wasm-language-service/example.mjs create mode 100644 packages/ts-wasm-language-service/index.d.ts create mode 100644 packages/ts-wasm-language-service/index.js create mode 100644 packages/ts-wasm-language-service/package.json create mode 100644 packages/ts-wasm-language-service/src/lib.rs create mode 100644 packages/ts-wasm-language-service/ts/index.ts create mode 100644 packages/ts-wasm-language-service/tsconfig.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..25fa621 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "typescript.tsdk": "node_modules/typescript/lib" +} diff --git a/Cargo.lock b/Cargo.lock index fa9acc3..813a718 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,30 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "allocator-api2" version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" +[[package]] +name = "anyhow" +version = "1.0.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" + [[package]] name = "assert-unchecked" version = "0.1.2" @@ -212,6 +230,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + [[package]] name = "fixedbitset" version = "0.4.2" @@ -228,11 +252,32 @@ dependencies = [ "version_check", ] +[[package]] +name = "gimli" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "indexmap 1.9.3", + "stable_deref_trait", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "serde", +] [[package]] name = "hashbrown" @@ -240,6 +285,28 @@ version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + [[package]] name = "indexmap" version = "2.6.0" @@ -281,6 +348,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + [[package]] name = "libc" version = "0.2.164" @@ -317,6 +390,12 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + [[package]] name = "memchr" version = "2.7.4" @@ -723,7 +802,7 @@ checksum = "da33ec82d0f4770f4b5c120d6a1d8e45de2d99ae2672a7ee6bd29092ada945f2" dependencies = [ "cfg-if", "dashmap", - "indexmap", + "indexmap 2.6.0", "json-strip-comments", "once_cell", "rustc-hash", @@ -741,7 +820,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc4b663c28a86d18d36ddf3847b6b33ee09fc808659c30966e95dd3810195f91" dependencies = [ "assert-unchecked", - "indexmap", + "indexmap 2.6.0", "itertools", "oxc_allocator", "oxc_ast", @@ -814,7 +893,7 @@ dependencies = [ "compact_str", "cow-utils", "dashmap", - "indexmap", + "indexmap 2.6.0", "itoa", "oxc-browserslist", "oxc_allocator", @@ -874,7 +953,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 2.6.0", ] [[package]] @@ -1071,7 +1150,7 @@ version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ - "indexmap", + "indexmap 2.6.0", "itoa", "memchr", "ryu", @@ -1128,6 +1207,12 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -1253,6 +1338,19 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "ts-wasm-language-service" +version = "0.1.0" +dependencies = [ + "mimalloc", + "napi", + "napi-build", + "napi-derive", + "serde", + "serde_json", + "walrus", +] + [[package]] name = "typenum" version = "1.17.0" @@ -1307,6 +1405,57 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" +[[package]] +name = "walrus" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0654ee28b7febcbe12fb3db23c69fde0a6a41c538147bfbd8412aee586728cb" +dependencies = [ + "anyhow", + "gimli", + "id-arena", + "leb128", + "log", + "walrus-macro", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "walrus-macro" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ad39ff894c43c9649fa724cdde9a6fc50b855d517ef071a93e5df82fe51d3" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "wasm-encoder" +version = "0.214.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff694f02a8d7a50b6922b197ae03883fbf18cdb2ae9fbee7b6148456f5f44041" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasmparser" +version = "0.214.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5309c1090e3e84dad0d382f42064e9933fdaedb87e468cc239f0eabea73ddcb6" +dependencies = [ + "ahash", + "bitflags", + "hashbrown 0.14.5", + "indexmap 2.6.0", + "semver", + "serde", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -1370,3 +1519,23 @@ name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index dbb4a52..bfbbc7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,6 @@ +[workspace] +members = [".", "packages/ts-wasm-language-service"] + [package] authors = ["LongYinan "] edition = "2021" @@ -7,25 +10,39 @@ version = "0.0.0" [lib] crate-type = ["cdylib"] + [workspace.dependencies] + mimalloc = "0.1" + napi = { version = "3.0.0-alpha", default-features = false, features = ["serde-json", "napi3"] } + napi-build = "2" + napi-derive = { version = "3.0.0-alpha", default-features = false, features = ["type-def"] } + oxc = { version = "0.37", features = ["codegen", "transformer", "sourcemap_concurrent", "semantic"] } + oxc_resolver = "2" + phf = "0.11" + serde = { version = "1.0", features = ["derive"] } + serde_json = "1" + tracing = "0.1" + tracing-subscriber = { version = "0.3", default-features = false, features = ["std", "fmt"] } + walrus = "0.23" + [dependencies] -napi = { version = "3.0.0-alpha", default-features = false, features = ["serde-json", "napi3"] } -napi-derive = { version = "3.0.0-alpha", default-features = false, features = ["type-def"] } -oxc = { version = "0.37", features = ["codegen", "transformer", "sourcemap_concurrent", "semantic"] } -oxc_resolver = "2" -phf = "0.11" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1" -tracing = "0.1" -tracing-subscriber = { version = "0.3", default-features = false, features = ["std", "fmt"] } # Omit the `regex` feature +napi = { workspace = true } +napi-derive = { workspace = true } +oxc = { workspace = true } +oxc_resolver = { workspace = true } +phf = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } # Omit the `regex` feature [target.'cfg(all(not(target_os = "linux"), not(target_family = "wasm")))'.dependencies] -mimalloc = "0.1" +mimalloc = { workspace = true } [target.'cfg(all(target_os = "linux", not(target_arch = "arm")))'.dependencies] -mimalloc = { version = "0.1", features = ["local_dynamic_tls"] } +mimalloc = { workspace = true, features = ["local_dynamic_tls"] } [build-dependencies] -napi-build = "2" +napi-build = { workspace = true } [profile.release] codegen-units = 1 diff --git a/package.json b/package.json index 0c0b486..7a2fcc5 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "@napi-rs/wasm-runtime": "^0.2.5", "@oxc-node/cli": "workspace:*", "@oxc-node/core": "workspace:*", + "@oxc-node/ts-wasm-language-service": "workspace:*", "@taplo/cli": "^0.7.0", "@types/node": "^22.9.3", "ava": "^6.2.0", @@ -23,6 +24,7 @@ }, "scripts": { "bench": "pnpm --filter=bench bench", + "build:ts": "tsc -b ./tsconfig.json", "format": "taplo fmt && prettier --write . && cargo fmt", "lint": "oxlint", "test": "pnpm --sequential --filter=integrate* run test", diff --git a/packages/cli/package.json b/packages/cli/package.json index 32708ec..9a9fd9a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -11,8 +11,8 @@ "@oxc-node/core": "workspace:*" }, "devDependencies": { - "clipanion": "^4.0.0-rc.3", - "rolldown": "^0.13.0" + "clipanion": "^4.0.0-rc.4", + "rolldown": "^0.14.0" }, "files": [ "dist" diff --git a/packages/integrate-module/.gitignore b/packages/integrate-module/.gitignore new file mode 100644 index 0000000..6636660 --- /dev/null +++ b/packages/integrate-module/.gitignore @@ -0,0 +1 @@ +!src/add.wasm diff --git a/packages/integrate-module/src/add.wasm b/packages/integrate-module/src/add.wasm new file mode 100644 index 0000000000000000000000000000000000000000..357f72da7a0db8add83699082fd51d46bf3352fb GIT binary patch literal 41 wcmZQbEY4+QU|?WmXG~zKuV<`hW@2PuXJ=$iOi5v2;NoOtXHZ~JV9eqM0DJxgJ^%m! literal 0 HcmV?d00001 diff --git a/packages/integrate-module/src/index.ts b/packages/integrate-module/src/index.ts index cd49262..09f7c96 100644 --- a/packages/integrate-module/src/index.ts +++ b/packages/integrate-module/src/index.ts @@ -19,6 +19,7 @@ import { Component } from './component.js' import './js-module.mjs' import pkgJson from '../package.json' import { version } from '../package.json' +import { add } from './add.wasm' const { foo: fooWithQuery } = await import(`./foo.mjs?q=${Date.now()}`) @@ -85,7 +86,7 @@ await test('resolve canvaskit-wasm', async () => { assert.ok('skipping test on s390x') return } - // @ts-expect-error + const canvas = await canvaskit() assert.ok(canvas.MakeSurface(100, 100)) }) diff --git a/packages/integrate-module/tsconfig.json b/packages/integrate-module/tsconfig.json index 912956c..c7f178b 100644 --- a/packages/integrate-module/tsconfig.json +++ b/packages/integrate-module/tsconfig.json @@ -6,6 +6,8 @@ "jsx": "react-jsx", "outDir": "dist", "resolveJsonModule": true, + "module": "ESNext", + "moduleResolution": "bundler", "baseUrl": "./", "paths": { "@subdirectory/*": ["./src/subdirectory/*"] diff --git a/packages/ts-wasm-language-service/Cargo.toml b/packages/ts-wasm-language-service/Cargo.toml new file mode 100644 index 0000000..195e50d --- /dev/null +++ b/packages/ts-wasm-language-service/Cargo.toml @@ -0,0 +1,23 @@ +[package] +edition = "2021" +name = "ts-wasm-language-service" +version = "0.1.0" + +[lib] +crate-type = ["rlib", "cdylib"] + +[dependencies] +napi = { workspace = true } +napi-derive = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +walrus = { workspace = true } + +[target.'cfg(all(not(target_os = "linux"), not(target_family = "wasm")))'.dependencies] +mimalloc = { workspace = true } + +[target.'cfg(all(target_os = "linux", not(target_arch = "arm")))'.dependencies] +mimalloc = { workspace = true, features = ["local_dynamic_tls"] } + +[build-dependencies] +napi-build = { workspace = true } diff --git a/packages/ts-wasm-language-service/build.rs b/packages/ts-wasm-language-service/build.rs new file mode 100644 index 0000000..0f1b010 --- /dev/null +++ b/packages/ts-wasm-language-service/build.rs @@ -0,0 +1,3 @@ +fn main() { + napi_build::setup(); +} diff --git a/packages/ts-wasm-language-service/example.mjs b/packages/ts-wasm-language-service/example.mjs new file mode 100644 index 0000000..3acbafe --- /dev/null +++ b/packages/ts-wasm-language-service/example.mjs @@ -0,0 +1,9 @@ +import { readFile } from 'node:fs/promises' + +import { getTypesFromWasm } from './index.js' + +const wasm = await readFile( + import.meta.dirname + '/node_modules/@rollup/wasm-node/dist/wasm-node/bindings_wasm_bg.wasm', +) + +console.log(getTypesFromWasm(wasm)) diff --git a/packages/ts-wasm-language-service/index.d.ts b/packages/ts-wasm-language-service/index.d.ts new file mode 100644 index 0000000..0546e65 --- /dev/null +++ b/packages/ts-wasm-language-service/index.d.ts @@ -0,0 +1,4 @@ +/* auto-generated by NAPI-RS */ +/* eslint-disable */ +export declare function getTypesFromWasm(input: string | Uint8Array): string + diff --git a/packages/ts-wasm-language-service/index.js b/packages/ts-wasm-language-service/index.js new file mode 100644 index 0000000..2f5b1ae --- /dev/null +++ b/packages/ts-wasm-language-service/index.js @@ -0,0 +1,364 @@ +// prettier-ignore +/* eslint-disable */ +/* auto-generated by NAPI-RS */ + +const { readFileSync } = require('fs') + +let nativeBinding = null +const loadErrors = [] + +const isMusl = () => { + let musl = false + if (process.platform === 'linux') { + musl = isMuslFromFilesystem() + if (musl === null) { + musl = isMuslFromReport() + } + if (musl === null) { + musl = isMuslFromChildProcess() + } + } + return musl +} + +const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-') + +const isMuslFromFilesystem = () => { + try { + return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl') + } catch { + return null + } +} + +const isMuslFromReport = () => { + const report = typeof process.report.getReport === 'function' ? process.report.getReport() : null + if (!report) { + return null + } + if (report.header && report.header.glibcVersionRuntime) { + return false + } + if (Array.isArray(report.sharedObjects)) { + if (report.sharedObjects.some(isFileMusl)) { + return true + } + } + return false +} + +const isMuslFromChildProcess = () => { + try { + return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl') + } catch (e) { + // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false + return false + } +} + +function requireNative() { + if (process.platform === 'android') { + if (process.arch === 'arm64') { + try { + return require('./index.android-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-android-arm64') + } catch (e) { + loadErrors.push(e) + } + + } else if (process.arch === 'arm') { + try { + return require('./index.android-arm-eabi.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-android-arm-eabi') + } catch (e) { + loadErrors.push(e) + } + + } else { + loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`)) + } + } else if (process.platform === 'win32') { + if (process.arch === 'x64') { + try { + return require('./index.win32-x64-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-win32-x64-msvc') + } catch (e) { + loadErrors.push(e) + } + + } else if (process.arch === 'ia32') { + try { + return require('./index.win32-ia32-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-win32-ia32-msvc') + } catch (e) { + loadErrors.push(e) + } + + } else if (process.arch === 'arm64') { + try { + return require('./index.win32-arm64-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-win32-arm64-msvc') + } catch (e) { + loadErrors.push(e) + } + + } else { + loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`)) + } + } else if (process.platform === 'darwin') { + try { + return require('./index.darwin-universal.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-darwin-universal') + } catch (e) { + loadErrors.push(e) + } + + if (process.arch === 'x64') { + try { + return require('./index.darwin-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-darwin-x64') + } catch (e) { + loadErrors.push(e) + } + + } else if (process.arch === 'arm64') { + try { + return require('./index.darwin-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-darwin-arm64') + } catch (e) { + loadErrors.push(e) + } + + } else { + loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`)) + } + } else if (process.platform === 'freebsd') { + if (process.arch === 'x64') { + try { + return require('./index.freebsd-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-freebsd-x64') + } catch (e) { + loadErrors.push(e) + } + + } else if (process.arch === 'arm64') { + try { + return require('./index.freebsd-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-freebsd-arm64') + } catch (e) { + loadErrors.push(e) + } + + } else { + loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`)) + } + } else if (process.platform === 'linux') { + if (process.arch === 'x64') { + if (isMusl()) { + try { + return require('./index.linux-x64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-linux-x64-musl') + } catch (e) { + loadErrors.push(e) + } + + } else { + try { + return require('./index.linux-x64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-linux-x64-gnu') + } catch (e) { + loadErrors.push(e) + } + + } + } else if (process.arch === 'arm64') { + if (isMusl()) { + try { + return require('./index.linux-arm64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-linux-arm64-musl') + } catch (e) { + loadErrors.push(e) + } + + } else { + try { + return require('./index.linux-arm64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-linux-arm64-gnu') + } catch (e) { + loadErrors.push(e) + } + + } + } else if (process.arch === 'arm') { + if (isMusl()) { + try { + return require('./index.linux-arm-musleabihf.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-linux-arm-musleabihf') + } catch (e) { + loadErrors.push(e) + } + + } else { + try { + return require('./index.linux-arm-gnueabihf.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-linux-arm-gnueabihf') + } catch (e) { + loadErrors.push(e) + } + + } + } else if (process.arch === 'riscv64') { + if (isMusl()) { + try { + return require('./index.linux-riscv64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-linux-riscv64-musl') + } catch (e) { + loadErrors.push(e) + } + + } else { + try { + return require('./index.linux-riscv64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-linux-riscv64-gnu') + } catch (e) { + loadErrors.push(e) + } + + } + } else if (process.arch === 'ppc64') { + try { + return require('./index.linux-ppc64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-linux-ppc64-gnu') + } catch (e) { + loadErrors.push(e) + } + + } else if (process.arch === 's390x') { + try { + return require('./index.linux-s390x-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@oxc-node/ts-wasm-language-service-linux-s390x-gnu') + } catch (e) { + loadErrors.push(e) + } + + } else { + loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`)) + } + } else { + loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`)) + } +} + +nativeBinding = requireNative() + +if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) { + try { + nativeBinding = require('./index.wasi.cjs') + } catch (err) { + if (process.env.NAPI_RS_FORCE_WASI) { + loadErrors.push(err) + } + } + if (!nativeBinding) { + try { + nativeBinding = require('@oxc-node/ts-wasm-language-service-wasm32-wasi') + } catch (err) { + if (process.env.NAPI_RS_FORCE_WASI) { + loadErrors.push(err) + } + } + } +} + +if (!nativeBinding) { + if (loadErrors.length > 0) { + // TODO Link to documentation with potential fixes + // - The package owner could build/publish bindings for this arch + // - The user may need to bundle the correct files + // - The user may need to re-install node_modules to get new packages + throw new Error('Failed to load native binding', { cause: loadErrors }) + } + throw new Error(`Failed to load native binding`) +} + +module.exports.getTypesFromWasm = nativeBinding.getTypesFromWasm diff --git a/packages/ts-wasm-language-service/package.json b/packages/ts-wasm-language-service/package.json new file mode 100644 index 0000000..2b582a0 --- /dev/null +++ b/packages/ts-wasm-language-service/package.json @@ -0,0 +1,13 @@ +{ + "name": "@oxc-node/ts-wasm-language-service", + "version": "0.0.0", + "main": "dist/index.js", + "scripts": { + "build": "napi build --platform --release" + }, + "devDependencies": { + "@napi-rs/cli": "^3.0.0-alpha.62", + "@rollup/wasm-node": "^4.27.4", + "typescript": "5.7.2" + } +} diff --git a/packages/ts-wasm-language-service/src/lib.rs b/packages/ts-wasm-language-service/src/lib.rs new file mode 100644 index 0000000..174de5e --- /dev/null +++ b/packages/ts-wasm-language-service/src/lib.rs @@ -0,0 +1,56 @@ +use napi::Either; +use napi_derive::napi; +use std::fmt::Write; + +#[napi] +pub fn get_types_from_wasm(input: Either) -> String { + let wasm_module = walrus::Module::from_buffer(input.as_ref()).unwrap(); + let mut d_ts = String::new(); + + for walrus::Export { name, item, .. } in wasm_module.exports.iter() { + if let walrus::ExportItem::Function(func) = item { + let func_type = wasm_module.types.get(wasm_module.funcs.get(*func).ty()); + + write!(&mut d_ts, "export function {}(", name).unwrap(); + + for (i, param) in func_type.params().iter().enumerate() { + if i > 0 { + write!(&mut d_ts, ", ").unwrap(); + } + write!(&mut d_ts, "param{}: {}", i, wasm_type_to_ts(param)).unwrap(); + } + + write!(&mut d_ts, "): ").unwrap(); + + match func_type.results().len() { + 0 => write!(&mut d_ts, "void").unwrap(), + 1 => write!(&mut d_ts, "{}", wasm_type_to_ts(&func_type.results()[0])).unwrap(), + _ => { + write!(&mut d_ts, "[").unwrap(); + for (i, result) in func_type.results().iter().enumerate() { + if i > 0 { + write!(&mut d_ts, ", ").unwrap(); + } + write!(&mut d_ts, "{}", wasm_type_to_ts(result)).unwrap(); + } + write!(&mut d_ts, "]").unwrap(); + } + } + + writeln!(&mut d_ts, ";").unwrap(); + } + } + + d_ts +} + +fn wasm_type_to_ts(ty: &walrus::ValType) -> &'static str { + match ty { + walrus::ValType::I32 => "number", + walrus::ValType::I64 => "bigint", + walrus::ValType::F32 => "number", + walrus::ValType::F64 => "number", + walrus::ValType::V128 => "BigInt64Array", + walrus::ValType::Ref(_) => "any", + } +} diff --git a/packages/ts-wasm-language-service/ts/index.ts b/packages/ts-wasm-language-service/ts/index.ts new file mode 100644 index 0000000..aface3c --- /dev/null +++ b/packages/ts-wasm-language-service/ts/index.ts @@ -0,0 +1,58 @@ +import type tsserver from 'typescript/lib/tsserverlibrary' + +import { getTypesFromWasm } from '../index.js' + +function init({ typescript: ts }: { typescript: typeof tsserver }) { + function create(info: tsserver.server.PluginCreateInfo) { + // Set up decorator object + const proxy: tsserver.LanguageService = Object.create(null) + + const readFile = ts.sys.readFile + const fileExists = ts.sys.fileExists + ts.sys.fileExists = (path) => { + if (path.endsWith('.wasm.d.ts')) { + return true + } + return fileExists.call(ts.sys, path) + } + ts.sys.readFile = (filename, encoding) => { + info.project.log(`readFile: ${filename}`) + if (filename.endsWith('.wasm.d.ts')) { + const wasm = readFile.call(ts.sys, filename.slice(0, -5), encoding) + return wasm ? getTypesFromWasm(wasm) : '' + } + return readFile.call(ts.sys, filename, encoding) + } + + for (let k of Object.keys(info.languageService) as Array) { + const x = info.languageService[k]! + if (k === 'getSemanticDiagnostics') { + proxy[k] = (fileName) => { + const diagnostics = (x as tsserver.LanguageService['getSemanticDiagnostics']).call( + info.languageService, + fileName, + ) + return diagnostics.filter((diagnostic) => { + if (diagnostic.code === 2307) { + for (const statement of diagnostic.file?.statements ?? []) { + if (statement.kind === ts.SyntaxKind.ImportDeclaration) { + return false + } + } + } + return diagnostic + }) + } + } else { + // @ts-expect-error - JS runtime trickery which is tricky to type tersely + proxy[k] = (...args: Array<{}>) => x.apply(info.languageService, args) + } + } + + return proxy + } + + return { create } +} + +export = init diff --git a/packages/ts-wasm-language-service/tsconfig.json b/packages/ts-wasm-language-service/tsconfig.json new file mode 100644 index 0000000..eed6691 --- /dev/null +++ b/packages/ts-wasm-language-service/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./dist", + "composite": true, + "rootDir": "./ts" + }, + "include": ["ts"], + "exclude": ["dist"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 01b0652..7adcc38 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: '@oxc-node/core': specifier: workspace:* version: link:packages/core + '@oxc-node/ts-wasm-language-service': + specifier: workspace:* + version: link:packages/ts-wasm-language-service '@taplo/cli': specifier: ^0.7.0 version: 0.7.0 @@ -85,11 +88,11 @@ importers: version: link:../core devDependencies: clipanion: - specifier: ^4.0.0-rc.3 - version: 4.0.0-rc.3(typanion@3.14.0) + specifier: ^4.0.0-rc.4 + version: 4.0.0-rc.4(typanion@3.14.0) rolldown: - specifier: ^0.13.0 - version: 0.13.2 + specifier: ^0.14.0 + version: 0.14.0 packages/core: {} @@ -194,6 +197,18 @@ importers: specifier: ^4.16.2 version: 4.16.5 + packages/ts-wasm-language-service: + devDependencies: + '@napi-rs/cli': + specifier: ^3.0.0-alpha.62 + version: 3.0.0-alpha.62(@emnapi/runtime@1.2.0)(emnapi@1.3.1) + '@rollup/wasm-node': + specifier: ^4.27.4 + version: 4.27.4 + typescript: + specifier: 5.7.2 + version: 5.7.2 + packages: '@babel/code-frame@7.24.7': @@ -1201,63 +1216,63 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} - '@rolldown/binding-darwin-arm64@0.13.2': - resolution: {integrity: sha512-84C2ITL3AmuCZmBSrRy6Z38pwBGQqHIhCp5gVGIP7U20tUVJMFj2g8gt608e9kltkRxw4PM3vSujRAoN5PsGuA==} + '@rolldown/binding-darwin-arm64@0.14.0': + resolution: {integrity: sha512-0GneNB1lW+k6VyBeKZAAyjoJ27r+gCDV+xI56aifQteaHAhFb0q8etJE5KpOOt65Hz0xXVjENilDKS+ibn1lcA==} cpu: [arm64] os: [darwin] - '@rolldown/binding-darwin-x64@0.13.2': - resolution: {integrity: sha512-h1zv1C+RJ8xzlohUNdbtXayh3/fcxsp7RjeahfPDM/FEtFCmuM7WZBiAuF0TklKYqgs2YwGl8iA3gpnGuhzgFg==} + '@rolldown/binding-darwin-x64@0.14.0': + resolution: {integrity: sha512-MG+pbDhufD2Fkua7J32XAkK6OoHzS/P1KFwDv+J7YvD6KZ/vEz8GklXtM4Woby+rbvbNmgoT4MV1BtHENONr3A==} cpu: [x64] os: [darwin] - '@rolldown/binding-freebsd-x64@0.13.2': - resolution: {integrity: sha512-VGBwYe/fgnIG7SWXPr6VOTPrr5d0fjYCoqM/abhUt729L3nlSaAaJOmcOvOg40KcrSJIEGgt+R0DcGNKuJ0kwA==} + '@rolldown/binding-freebsd-x64@0.14.0': + resolution: {integrity: sha512-ojbJdM8f6+099WfFL/ggQ0F5o2/lHypQBj7WgIPL2Iqr3KleRVN57YTZPu0SJ/bK0OWrx2ZaWBLb6WpDsIx2zg==} cpu: [x64] os: [freebsd] - '@rolldown/binding-linux-arm-gnueabihf@0.13.2': - resolution: {integrity: sha512-thIyywEvUlEgRlG6s0GBH04eFGKsHl59HTsL6nlILbeafizuPOw2oY+jf1NZ117ju083W5Uo6htqxKBzBeOUpg==} + '@rolldown/binding-linux-arm-gnueabihf@0.14.0': + resolution: {integrity: sha512-cI8UBQDS6xFWg6Pe5gPXZYXskt2BQ4nVEoGGaHZsav8PWC31cEZhSkUj814anbmGoi7wl23/T2gNuCNysdWHxg==} cpu: [arm] os: [linux] - '@rolldown/binding-linux-arm64-gnu@0.13.2': - resolution: {integrity: sha512-wTg4GKHFTcjlY+5jLycweIm95ttfQj3BFNxY28Y3uIaIxonF6hwFw15yz4MyhCqL0S3DV9wRcgxZemdykil+eA==} + '@rolldown/binding-linux-arm64-gnu@0.14.0': + resolution: {integrity: sha512-vA2ewz6nun7mkW4lMwO3TzCuUi3mpcAo3xXhAwmIPT6yz7+ofJGLkq3N7oYfJQhH9ktHSEPA8JzPHvZ1ozAfgA==} cpu: [arm64] os: [linux] - '@rolldown/binding-linux-arm64-musl@0.13.2': - resolution: {integrity: sha512-9g180TIoU8U/CBbL8Ci6duuO6cvAL9misrJV5ng1G2QD7XNVrp9FG+mXbbmPuJSCz4ZjXDlM3RnpOwhmBuc+HQ==} + '@rolldown/binding-linux-arm64-musl@0.14.0': + resolution: {integrity: sha512-uEoG+tzi0JqCVhuWmaOLR7hjuyDQ+a9OudYDeArkeAD2tY8fNyd9gAOfjzyYhgBcYvOLCo+4w2C3GnoSKy88FA==} cpu: [arm64] os: [linux] - '@rolldown/binding-linux-x64-gnu@0.13.2': - resolution: {integrity: sha512-cmXSW6lNCq7lmggGZFucezfDqCC3XkMnzCuM6uYJMX11PU6/HS0xRTL7FjAQAwtUNyhI5/OgOv5KSqfQhHodsQ==} + '@rolldown/binding-linux-x64-gnu@0.14.0': + resolution: {integrity: sha512-WSeo4JfiXCTRJDT5VG5Ohp3nhZittMrRA42wZjcHRajsuG7YsikmkSbTI88TXVjMSdXJBQK1zsBVOIpYfzKltQ==} cpu: [x64] os: [linux] - '@rolldown/binding-linux-x64-musl@0.13.2': - resolution: {integrity: sha512-Y157t4Vjyo253GbjdjMHcJfeaVhcLFZ49qcWkdjRx65rzggKyXVx1C8NFX0ER1Fyse/ZP60bhOvhlq5+R1wxnA==} + '@rolldown/binding-linux-x64-musl@0.14.0': + resolution: {integrity: sha512-gR9Xz+k2E5Xjd/6d+109Jpdwtaepa4Y0UvAA1hwMBM7LsDR0tMpryRYJlrKqaFvhFyzMfd45HunrX4dttQV5hQ==} cpu: [x64] os: [linux] - '@rolldown/binding-wasm32-wasi@0.13.2': - resolution: {integrity: sha512-o3vLuYsBYcNjkPQcgzValjeQILeuZ0YdzimHXABaCliGKHLVRcZv/yH3WDQ9SSBf7lK6cYSzHSInlcYqETqxWg==} + '@rolldown/binding-wasm32-wasi@0.14.0': + resolution: {integrity: sha512-5tEWnRnWlxgn45Z/LGL0Ds/gZ/B8dY84PfKNq6S1elweLGgjlhDSRbNaZiX/umvELa9e1dbYNPCFZiEhHSUvkQ==} engines: {node: '>=14.21.3'} cpu: [wasm32] - '@rolldown/binding-win32-arm64-msvc@0.13.2': - resolution: {integrity: sha512-Czx5vzeFKOmW9AbPirP3kEJ390P9esiRhkHotVtfiPeRPz3gh6pKUiMxbeZqyvxB+3cDzbPftMtGIH9D/DylBA==} + '@rolldown/binding-win32-arm64-msvc@0.14.0': + resolution: {integrity: sha512-VIdWQkE0vvaORRy0NXW+z+IuqTZ96/FbVKVFKlsOMcrhBOibzvy8LobKaxUIOPJ/WzPEyrmhnMRHJpWbtaPJmw==} cpu: [arm64] os: [win32] - '@rolldown/binding-win32-ia32-msvc@0.13.2': - resolution: {integrity: sha512-2cHEcOnHMhsTp+7eMsTcqypr+Wt82HFEuhfwyxSI1TOGHOwqYMPis842qGhRjg2/y0jD9WYTNflnSTWAYBrVDQ==} + '@rolldown/binding-win32-ia32-msvc@0.14.0': + resolution: {integrity: sha512-0nOHZhjcX93FiY6SLk0iMTqFf3wzRXYsneGstfIlkob8tEncukMdS+iv9JfG9k15e5fRYcwfHu8wW55qmLYj/w==} cpu: [ia32] os: [win32] - '@rolldown/binding-win32-x64-msvc@0.13.2': - resolution: {integrity: sha512-P6Sd579+ZGEZaF05XHKE6RdPe27YlrEa1FeujcI9job+xtq3hpJ/ebKTYPqcEMt05ssR5Ervmbz5SHsrOes1wQ==} + '@rolldown/binding-win32-x64-msvc@0.14.0': + resolution: {integrity: sha512-RKNpJKIG5J6dgR/0IpxHmZkYYnHJE8vDm3qL8Zq9EY7kxOsCNZbrj5leU7qbibqfHHR+9Ij4vhTL1YuLz/ch5Q==} cpu: [x64] os: [win32] @@ -1265,6 +1280,11 @@ packages: resolution: {integrity: sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==} engines: {node: '>= 8.0.0'} + '@rollup/wasm-node@4.27.4': + resolution: {integrity: sha512-Q1b1A1RAP4Pp4qwU59n4819nJ4v4CDgBbY1/FbC1pW5PmHHI36yyqDMB0BW/F+3lLDt0KDd+t7tBrki9oSEg/w==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + '@sec-ant/readable-stream@0.4.1': resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} @@ -1404,6 +1424,9 @@ packages: '@tybys/wasm-util@0.9.0': resolution: {integrity: sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==} + '@types/estree@1.0.6': + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + '@types/minimatch@3.0.5': resolution: {integrity: sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==} @@ -1772,8 +1795,8 @@ packages: peerDependencies: typanion: '*' - clipanion@4.0.0-rc.3: - resolution: {integrity: sha512-+rJOJMt2N6Oikgtfqmo/Duvme7uz3SIedL2b6ycgCztQMiTfr3aQh2DDyLHl+QUPClKMNpSg3gDJFvNQYIcq1g==} + clipanion@4.0.0-rc.4: + resolution: {integrity: sha512-CXkMQxU6s9GklO/1f714dkKBMu1lopS1WFF0B8o4AxPykR1hpozxSiUZ5ZUeBjfPgCWqbcNOtZVFhB8Lkfp1+Q==} peerDependencies: typanion: '*' @@ -3452,8 +3475,8 @@ packages: engines: {node: '>=14'} hasBin: true - rolldown@0.13.2: - resolution: {integrity: sha512-vIWIgy7LR82EU/Gv8/iUJOT6Kq/o/72mv0DEYJAlkmOTABN5S9DkWgScDUzy1s0gLiFzh220qRNfWYTdKaZ8IQ==} + rolldown@0.14.0: + resolution: {integrity: sha512-9mb66Rwe3iGFBxFGQLahhoPzL2655VyObBParkFZ8EoH4rAYF67D4oKEqQKri5Fl8pAgtgLBt1wDCS54cBgmnw==} hasBin: true run-async@2.4.1: @@ -4990,42 +5013,42 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@rolldown/binding-darwin-arm64@0.13.2': + '@rolldown/binding-darwin-arm64@0.14.0': optional: true - '@rolldown/binding-darwin-x64@0.13.2': + '@rolldown/binding-darwin-x64@0.14.0': optional: true - '@rolldown/binding-freebsd-x64@0.13.2': + '@rolldown/binding-freebsd-x64@0.14.0': optional: true - '@rolldown/binding-linux-arm-gnueabihf@0.13.2': + '@rolldown/binding-linux-arm-gnueabihf@0.14.0': optional: true - '@rolldown/binding-linux-arm64-gnu@0.13.2': + '@rolldown/binding-linux-arm64-gnu@0.14.0': optional: true - '@rolldown/binding-linux-arm64-musl@0.13.2': + '@rolldown/binding-linux-arm64-musl@0.14.0': optional: true - '@rolldown/binding-linux-x64-gnu@0.13.2': + '@rolldown/binding-linux-x64-gnu@0.14.0': optional: true - '@rolldown/binding-linux-x64-musl@0.13.2': + '@rolldown/binding-linux-x64-musl@0.14.0': optional: true - '@rolldown/binding-wasm32-wasi@0.13.2': + '@rolldown/binding-wasm32-wasi@0.14.0': dependencies: '@napi-rs/wasm-runtime': 0.2.5 optional: true - '@rolldown/binding-win32-arm64-msvc@0.13.2': + '@rolldown/binding-win32-arm64-msvc@0.14.0': optional: true - '@rolldown/binding-win32-ia32-msvc@0.13.2': + '@rolldown/binding-win32-ia32-msvc@0.14.0': optional: true - '@rolldown/binding-win32-x64-msvc@0.13.2': + '@rolldown/binding-win32-x64-msvc@0.14.0': optional: true '@rollup/pluginutils@4.2.1': @@ -5033,6 +5056,12 @@ snapshots: estree-walker: 2.0.2 picomatch: 2.3.1 + '@rollup/wasm-node@4.27.4': + dependencies: + '@types/estree': 1.0.6 + optionalDependencies: + fsevents: 2.3.3 + '@sec-ant/readable-stream@0.4.1': {} '@sigstore/bundle@2.3.2': @@ -5146,6 +5175,8 @@ snapshots: dependencies: tslib: 2.6.3 + '@types/estree@1.0.6': {} + '@types/minimatch@3.0.5': {} '@types/minimist@1.2.5': {} @@ -5582,7 +5613,7 @@ snapshots: dependencies: typanion: 3.14.0 - clipanion@4.0.0-rc.3(typanion@3.14.0): + clipanion@4.0.0-rc.4(typanion@3.14.0): dependencies: typanion: 3.14.0 @@ -7424,22 +7455,22 @@ snapshots: dependencies: glob: 9.3.5 - rolldown@0.13.2: + rolldown@0.14.0: dependencies: zod: 3.23.8 optionalDependencies: - '@rolldown/binding-darwin-arm64': 0.13.2 - '@rolldown/binding-darwin-x64': 0.13.2 - '@rolldown/binding-freebsd-x64': 0.13.2 - '@rolldown/binding-linux-arm-gnueabihf': 0.13.2 - '@rolldown/binding-linux-arm64-gnu': 0.13.2 - '@rolldown/binding-linux-arm64-musl': 0.13.2 - '@rolldown/binding-linux-x64-gnu': 0.13.2 - '@rolldown/binding-linux-x64-musl': 0.13.2 - '@rolldown/binding-wasm32-wasi': 0.13.2 - '@rolldown/binding-win32-arm64-msvc': 0.13.2 - '@rolldown/binding-win32-ia32-msvc': 0.13.2 - '@rolldown/binding-win32-x64-msvc': 0.13.2 + '@rolldown/binding-darwin-arm64': 0.14.0 + '@rolldown/binding-darwin-x64': 0.14.0 + '@rolldown/binding-freebsd-x64': 0.14.0 + '@rolldown/binding-linux-arm-gnueabihf': 0.14.0 + '@rolldown/binding-linux-arm64-gnu': 0.14.0 + '@rolldown/binding-linux-arm64-musl': 0.14.0 + '@rolldown/binding-linux-x64-gnu': 0.14.0 + '@rolldown/binding-linux-x64-musl': 0.14.0 + '@rolldown/binding-wasm32-wasi': 0.14.0 + '@rolldown/binding-win32-arm64-msvc': 0.14.0 + '@rolldown/binding-win32-ia32-msvc': 0.14.0 + '@rolldown/binding-win32-x64-msvc': 0.14.0 run-async@2.4.1: {} diff --git a/tsconfig.json b/tsconfig.json index adcab35..cd4a8c7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,13 @@ "strict": true, "target": "ESNext", "moduleResolution": "NodeNext", - "module": "NodeNext" + "module": "NodeNext", + "skipLibCheck": true, + "plugins": [ + { + "name": "@oxc-node/ts-wasm-language-service" + } + ] }, "references": [ { @@ -17,6 +23,9 @@ }, { "path": "./packages/integrate-module-bundler" + }, + { + "path": "./packages/ts-wasm-language-service" } ], "include": []