From ec3d92e69508ec57ea9bb29aab30e8b9f94bcce6 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Sat, 15 Mar 2025 15:12:39 +0900 Subject: [PATCH 1/2] chore: add oxc-wasi-vite2 --- oxc-wasi-vite-2/.gitignore | 2 + oxc-wasi-vite-2/README.md | 11 + oxc-wasi-vite-2/index.html | 21 ++ oxc-wasi-vite-2/package.json | 19 ++ oxc-wasi-vite-2/pnpm-lock.yaml | 605 +++++++++++++++++++++++++++++++++ oxc-wasi-vite-2/src/main.js | 15 + oxc-wasi-vite-2/vite.config.ts | 43 +++ 7 files changed, 716 insertions(+) create mode 100644 oxc-wasi-vite-2/.gitignore create mode 100644 oxc-wasi-vite-2/README.md create mode 100644 oxc-wasi-vite-2/index.html create mode 100644 oxc-wasi-vite-2/package.json create mode 100644 oxc-wasi-vite-2/pnpm-lock.yaml create mode 100644 oxc-wasi-vite-2/src/main.js create mode 100644 oxc-wasi-vite-2/vite.config.ts diff --git a/oxc-wasi-vite-2/.gitignore b/oxc-wasi-vite-2/.gitignore new file mode 100644 index 00000000..f06235c4 --- /dev/null +++ b/oxc-wasi-vite-2/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist diff --git a/oxc-wasi-vite-2/README.md b/oxc-wasi-vite-2/README.md new file mode 100644 index 00000000..db2281af --- /dev/null +++ b/oxc-wasi-vite-2/README.md @@ -0,0 +1,11 @@ +## context + +- https://github.com/oxc-project/oxc/pull/9630 + +## example + +```sh +pnpm dev +pnpm build +pnpm preview +``` diff --git a/oxc-wasi-vite-2/index.html b/oxc-wasi-vite-2/index.html new file mode 100644 index 00000000..4cf6f1a4 --- /dev/null +++ b/oxc-wasi-vite-2/index.html @@ -0,0 +1,21 @@ + + + + + + Vite App + + +

@oxc-parser/binding-wasm32-wasi example

+ +
Parsing...
+ + + diff --git a/oxc-wasi-vite-2/package.json b/oxc-wasi-vite-2/package.json new file mode 100644 index 00000000..c7befae4 --- /dev/null +++ b/oxc-wasi-vite-2/package.json @@ -0,0 +1,19 @@ +{ + "name": "oxc-wasi-vite", + "version": "0.0.0", + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "@oxc-parser/binding-wasm32-wasi": "file:/home/hiroshi/code/others/oxc/napi/parser/npm-dir/wasm32-wasi", + "oxc-parser": "link:/home/hiroshi/code/others/oxc/napi/parser" + }, + "devDependencies": { + "vite": "^6.2.0" + }, + "packageManager": "pnpm@10.6.1+sha512.40ee09af407fa9fbb5fbfb8e1cb40fbb74c0af0c3e10e9224d7b53c7658528615b2c92450e74cfad91e3a2dcafe3ce4050d80bda71d757756d2ce2b66213e9a3" +} diff --git a/oxc-wasi-vite-2/pnpm-lock.yaml b/oxc-wasi-vite-2/pnpm-lock.yaml new file mode 100644 index 00000000..051c7c0a --- /dev/null +++ b/oxc-wasi-vite-2/pnpm-lock.yaml @@ -0,0 +1,605 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@oxc-parser/binding-wasm32-wasi': + specifier: file:/home/hiroshi/code/others/oxc/napi/parser/npm-dir/wasm32-wasi + version: file:../../../others/oxc/napi/parser/npm-dir/wasm32-wasi + oxc-parser: + specifier: link:/home/hiroshi/code/others/oxc/napi/parser + version: link:../../../others/oxc/napi/parser + devDependencies: + vite: + specifier: ^6.2.0 + version: 6.2.2 + +packages: + + '@emnapi/core@1.3.1': + resolution: {integrity: sha512-pVGjBIt1Y6gg3EJN8jTcfpP/+uuRksIo055oE/OBkDNcjZqVbfkWCksG1Jp4yZnj3iKWyWX8fdG/j6UDYPbFog==} + + '@emnapi/runtime@1.3.1': + resolution: {integrity: sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==} + + '@emnapi/wasi-threads@1.0.1': + resolution: {integrity: sha512-iIBu7mwkq4UQGeMEM8bLwNK962nXdhodeScX4slfQnRhEMMzvYivHhutCIk8uojvmASXXPC2WNEjwxFWk72Oqw==} + + '@esbuild/aix-ppc64@0.25.1': + resolution: {integrity: sha512-kfYGy8IdzTGy+z0vFGvExZtxkFlA4zAxgKEahG9KE1ScBjpQnFsNOX8KTU5ojNru5ed5CVoJYXFtoxaq5nFbjQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.25.1': + resolution: {integrity: sha512-50tM0zCJW5kGqgG7fQ7IHvQOcAn9TKiVRuQ/lN0xR+T2lzEFvAi1ZcS8DiksFcEpf1t/GYOeOfCAgDHFpkiSmA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.25.1': + resolution: {integrity: sha512-dp+MshLYux6j/JjdqVLnMglQlFu+MuVeNrmT5nk6q07wNhCdSnB7QZj+7G8VMUGh1q+vj2Bq8kRsuyA00I/k+Q==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.25.1': + resolution: {integrity: sha512-GCj6WfUtNldqUzYkN/ITtlhwQqGWu9S45vUXs7EIYf+7rCiiqH9bCloatO9VhxsL0Pji+PF4Lz2XXCES+Q8hDw==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.25.1': + resolution: {integrity: sha512-5hEZKPf+nQjYoSr/elb62U19/l1mZDdqidGfmFutVUjjUZrOazAtwK+Kr+3y0C/oeJfLlxo9fXb1w7L+P7E4FQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.25.1': + resolution: {integrity: sha512-hxVnwL2Dqs3fM1IWq8Iezh0cX7ZGdVhbTfnOy5uURtao5OIVCEyj9xIzemDi7sRvKsuSdtCAhMKarxqtlyVyfA==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.25.1': + resolution: {integrity: sha512-1MrCZs0fZa2g8E+FUo2ipw6jw5qqQiH+tERoS5fAfKnRx6NXH31tXBKI3VpmLijLH6yriMZsxJtaXUyFt/8Y4A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.25.1': + resolution: {integrity: sha512-0IZWLiTyz7nm0xuIs0q1Y3QWJC52R8aSXxe40VUxm6BB1RNmkODtW6LHvWRrGiICulcX7ZvyH6h5fqdLu4gkww==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.25.1': + resolution: {integrity: sha512-jaN3dHi0/DDPelk0nLcXRm1q7DNJpjXy7yWaWvbfkPvI+7XNSc/lDOnCLN7gzsyzgu6qSAmgSvP9oXAhP973uQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.25.1': + resolution: {integrity: sha512-NdKOhS4u7JhDKw9G3cY6sWqFcnLITn6SqivVArbzIaf3cemShqfLGHYMx8Xlm/lBit3/5d7kXvriTUGa5YViuQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.25.1': + resolution: {integrity: sha512-OJykPaF4v8JidKNGz8c/q1lBO44sQNUQtq1KktJXdBLn1hPod5rE/Hko5ugKKZd+D2+o1a9MFGUEIUwO2YfgkQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.25.1': + resolution: {integrity: sha512-nGfornQj4dzcq5Vp835oM/o21UMlXzn79KobKlcs3Wz9smwiifknLy4xDCLUU0BWp7b/houtdrgUz7nOGnfIYg==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.25.1': + resolution: {integrity: sha512-1osBbPEFYwIE5IVB/0g2X6i1qInZa1aIoj1TdL4AaAb55xIIgbg8Doq6a5BzYWgr+tEcDzYH67XVnTmUzL+nXg==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.25.1': + resolution: {integrity: sha512-/6VBJOwUf3TdTvJZ82qF3tbLuWsscd7/1w+D9LH0W/SqUgM5/JJD0lrJ1fVIfZsqB6RFmLCe0Xz3fmZc3WtyVg==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.25.1': + resolution: {integrity: sha512-nSut/Mx5gnilhcq2yIMLMe3Wl4FK5wx/o0QuuCLMtmJn+WeWYoEGDN1ipcN72g1WHsnIbxGXd4i/MF0gTcuAjQ==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.25.1': + resolution: {integrity: sha512-cEECeLlJNfT8kZHqLarDBQso9a27o2Zd2AQ8USAEoGtejOrCYHNtKP8XQhMDJMtthdF4GBmjR2au3x1udADQQQ==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.25.1': + resolution: {integrity: sha512-xbfUhu/gnvSEg+EGovRc+kjBAkrvtk38RlerAzQxvMzlB4fXpCFCeUAYzJvrnhFtdeyVCDANSjJvOvGYoeKzFA==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.25.1': + resolution: {integrity: sha512-O96poM2XGhLtpTh+s4+nP7YCCAfb4tJNRVZHfIE7dgmax+yMP2WgMd2OecBuaATHKTHsLWHQeuaxMRnCsH8+5g==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.25.1': + resolution: {integrity: sha512-X53z6uXip6KFXBQ+Krbx25XHV/NCbzryM6ehOAeAil7X7oa4XIq+394PWGnwaSQ2WRA0KI6PUO6hTO5zeF5ijA==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.25.1': + resolution: {integrity: sha512-Na9T3szbXezdzM/Kfs3GcRQNjHzM6GzFBeU1/6IV/npKP5ORtp9zbQjvkDJ47s6BCgaAZnnnu/cY1x342+MvZg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.25.1': + resolution: {integrity: sha512-T3H78X2h1tszfRSf+txbt5aOp/e7TAz3ptVKu9Oyir3IAOFPGV6O9c2naym5TOriy1l0nNf6a4X5UXRZSGX/dw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/sunos-x64@0.25.1': + resolution: {integrity: sha512-2H3RUvcmULO7dIE5EWJH8eubZAI4xw54H1ilJnRNZdeo8dTADEZ21w6J22XBkXqGJbe0+wnNJtw3UXRoLJnFEg==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.25.1': + resolution: {integrity: sha512-GE7XvrdOzrb+yVKB9KsRMq+7a2U/K5Cf/8grVFRAGJmfADr/e/ODQ134RK2/eeHqYV5eQRFxb1hY7Nr15fv1NQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.25.1': + resolution: {integrity: sha512-uOxSJCIcavSiT6UnBhBzE8wy3n0hOkJsBOzy7HDAuTDE++1DJMRRVCPGisULScHL+a/ZwdXPpXD3IyFKjA7K8A==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.25.1': + resolution: {integrity: sha512-Y1EQdcfwMSeQN/ujR5VayLOJ1BHaK+ssyk0AEzPjC+t1lITgsnccPqFjb6V+LsTp/9Iov4ysfjxLaGJ9RPtkVg==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@napi-rs/wasm-runtime@0.2.7': + resolution: {integrity: sha512-5yximcFK5FNompXfJFoWanu5l8v1hNGqNHh9du1xETp9HWk/B/PzvchX55WYOPaIeNglG8++68AAiauBAtbnzw==} + + '@oxc-parser/binding-wasm32-wasi@file:../../../others/oxc/napi/parser/npm-dir/wasm32-wasi': + resolution: {directory: ../../../others/oxc/napi/parser/npm-dir/wasm32-wasi, type: directory} + engines: {node: '>=14.0.0'} + cpu: [wasm32] + + '@rollup/rollup-android-arm-eabi@4.35.0': + resolution: {integrity: sha512-uYQ2WfPaqz5QtVgMxfN6NpLD+no0MYHDBywl7itPYd3K5TjjSghNKmX8ic9S8NU8w81NVhJv/XojcHptRly7qQ==} + cpu: [arm] + os: [android] + + '@rollup/rollup-android-arm64@4.35.0': + resolution: {integrity: sha512-FtKddj9XZudurLhdJnBl9fl6BwCJ3ky8riCXjEw3/UIbjmIY58ppWwPEvU3fNu+W7FUsAsB1CdH+7EQE6CXAPA==} + cpu: [arm64] + os: [android] + + '@rollup/rollup-darwin-arm64@4.35.0': + resolution: {integrity: sha512-Uk+GjOJR6CY844/q6r5DR/6lkPFOw0hjfOIzVx22THJXMxktXG6CbejseJFznU8vHcEBLpiXKY3/6xc+cBm65Q==} + cpu: [arm64] + os: [darwin] + + '@rollup/rollup-darwin-x64@4.35.0': + resolution: {integrity: sha512-3IrHjfAS6Vkp+5bISNQnPogRAW5GAV1n+bNCrDwXmfMHbPl5EhTmWtfmwlJxFRUCBZ+tZ/OxDyU08aF6NI/N5Q==} + cpu: [x64] + os: [darwin] + + '@rollup/rollup-freebsd-arm64@4.35.0': + resolution: {integrity: sha512-sxjoD/6F9cDLSELuLNnY0fOrM9WA0KrM0vWm57XhrIMf5FGiN8D0l7fn+bpUeBSU7dCgPV2oX4zHAsAXyHFGcQ==} + cpu: [arm64] + os: [freebsd] + + '@rollup/rollup-freebsd-x64@4.35.0': + resolution: {integrity: sha512-2mpHCeRuD1u/2kruUiHSsnjWtHjqVbzhBkNVQ1aVD63CcexKVcQGwJ2g5VphOd84GvxfSvnnlEyBtQCE5hxVVw==} + cpu: [x64] + os: [freebsd] + + '@rollup/rollup-linux-arm-gnueabihf@4.35.0': + resolution: {integrity: sha512-mrA0v3QMy6ZSvEuLs0dMxcO2LnaCONs1Z73GUDBHWbY8tFFocM6yl7YyMu7rz4zS81NDSqhrUuolyZXGi8TEqg==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm-musleabihf@4.35.0': + resolution: {integrity: sha512-DnYhhzcvTAKNexIql8pFajr0PiDGrIsBYPRvCKlA5ixSS3uwo/CWNZxB09jhIapEIg945KOzcYEAGGSmTSpk7A==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm64-gnu@4.35.0': + resolution: {integrity: sha512-uagpnH2M2g2b5iLsCTZ35CL1FgyuzzJQ8L9VtlJ+FckBXroTwNOaD0z0/UF+k5K3aNQjbm8LIVpxykUOQt1m/A==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-arm64-musl@4.35.0': + resolution: {integrity: sha512-XQxVOCd6VJeHQA/7YcqyV0/88N6ysSVzRjJ9I9UA/xXpEsjvAgDTgH3wQYz5bmr7SPtVK2TsP2fQ2N9L4ukoUg==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-loongarch64-gnu@4.35.0': + resolution: {integrity: sha512-5pMT5PzfgwcXEwOaSrqVsz/LvjDZt+vQ8RT/70yhPU06PTuq8WaHhfT1LW+cdD7mW6i/J5/XIkX/1tCAkh1W6g==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-powerpc64le-gnu@4.35.0': + resolution: {integrity: sha512-c+zkcvbhbXF98f4CtEIP1EBA/lCic5xB0lToneZYvMeKu5Kamq3O8gqrxiYYLzlZH6E3Aq+TSW86E4ay8iD8EA==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-riscv64-gnu@4.35.0': + resolution: {integrity: sha512-s91fuAHdOwH/Tad2tzTtPX7UZyytHIRR6V4+2IGlV0Cej5rkG0R61SX4l4y9sh0JBibMiploZx3oHKPnQBKe4g==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-s390x-gnu@4.35.0': + resolution: {integrity: sha512-hQRkPQPLYJZYGP+Hj4fR9dDBMIM7zrzJDWFEMPdTnTy95Ljnv0/4w/ixFw3pTBMEuuEuoqtBINYND4M7ujcuQw==} + cpu: [s390x] + os: [linux] + + '@rollup/rollup-linux-x64-gnu@4.35.0': + resolution: {integrity: sha512-Pim1T8rXOri+0HmV4CdKSGrqcBWX0d1HoPnQ0uw0bdp1aP5SdQVNBy8LjYncvnLgu3fnnCt17xjWGd4cqh8/hA==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-linux-x64-musl@4.35.0': + resolution: {integrity: sha512-QysqXzYiDvQWfUiTm8XmJNO2zm9yC9P/2Gkrwg2dH9cxotQzunBHYr6jk4SujCTqnfGxduOmQcI7c2ryuW8XVg==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-win32-arm64-msvc@4.35.0': + resolution: {integrity: sha512-OUOlGqPkVJCdJETKOCEf1mw848ZyJ5w50/rZ/3IBQVdLfR5jk/6Sr5m3iO2tdPgwo0x7VcncYuOvMhBWZq8ayg==} + cpu: [arm64] + os: [win32] + + '@rollup/rollup-win32-ia32-msvc@4.35.0': + resolution: {integrity: sha512-2/lsgejMrtwQe44glq7AFFHLfJBPafpsTa6JvP2NGef/ifOa4KBoglVf7AKN7EV9o32evBPRqfg96fEHzWo5kw==} + cpu: [ia32] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.35.0': + resolution: {integrity: sha512-PIQeY5XDkrOysbQblSW7v3l1MDZzkTEzAfTPkj5VAu3FW8fS4ynyLg2sINp0fp3SjZ8xkRYpLqoKcYqAkhU1dw==} + cpu: [x64] + os: [win32] + + '@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==} + + esbuild@0.25.1: + resolution: {integrity: sha512-BGO5LtrGC7vxnqucAe/rmvKdJllfGaYWdyABvyMoXQlfYMb2bbRuReWR5tEGE//4LcNJj9XrkovTqNYRFZHAMQ==} + engines: {node: '>=18'} + hasBin: true + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + nanoid@3.3.9: + resolution: {integrity: sha512-SppoicMGpZvbF1l3z4x7No3OlIjP7QJvC9XR7AhZr1kL133KHnKPztkKDc+Ir4aJ/1VhTySrtKhrsycmrMQfvg==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + postcss@8.5.3: + resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==} + engines: {node: ^10 || ^12 || >=14} + + rollup@4.35.0: + resolution: {integrity: sha512-kg6oI4g+vc41vePJyO6dHt/yl0Rz3Thv0kJeVQ3D1kS3E5XSuKbPc29G4IpT/Kv1KQwgHVcN+HtyS+HYLNSvQg==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + + source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + + vite@6.2.2: + resolution: {integrity: sha512-yW7PeMM+LkDzc7CgJuRLMW2Jz0FxMOsVJ8Lv3gpgW9WLcb9cTW+121UEr1hvmfR7w3SegR5ItvYyzVz1vxNJgQ==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + peerDependencies: + '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 + jiti: '>=1.21.0' + less: '*' + lightningcss: ^1.21.0 + sass: '*' + sass-embedded: '*' + stylus: '*' + sugarss: '*' + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + jiti: + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + +snapshots: + + '@emnapi/core@1.3.1': + dependencies: + '@emnapi/wasi-threads': 1.0.1 + tslib: 2.8.1 + + '@emnapi/runtime@1.3.1': + dependencies: + tslib: 2.8.1 + + '@emnapi/wasi-threads@1.0.1': + dependencies: + tslib: 2.8.1 + + '@esbuild/aix-ppc64@0.25.1': + optional: true + + '@esbuild/android-arm64@0.25.1': + optional: true + + '@esbuild/android-arm@0.25.1': + optional: true + + '@esbuild/android-x64@0.25.1': + optional: true + + '@esbuild/darwin-arm64@0.25.1': + optional: true + + '@esbuild/darwin-x64@0.25.1': + optional: true + + '@esbuild/freebsd-arm64@0.25.1': + optional: true + + '@esbuild/freebsd-x64@0.25.1': + optional: true + + '@esbuild/linux-arm64@0.25.1': + optional: true + + '@esbuild/linux-arm@0.25.1': + optional: true + + '@esbuild/linux-ia32@0.25.1': + optional: true + + '@esbuild/linux-loong64@0.25.1': + optional: true + + '@esbuild/linux-mips64el@0.25.1': + optional: true + + '@esbuild/linux-ppc64@0.25.1': + optional: true + + '@esbuild/linux-riscv64@0.25.1': + optional: true + + '@esbuild/linux-s390x@0.25.1': + optional: true + + '@esbuild/linux-x64@0.25.1': + optional: true + + '@esbuild/netbsd-arm64@0.25.1': + optional: true + + '@esbuild/netbsd-x64@0.25.1': + optional: true + + '@esbuild/openbsd-arm64@0.25.1': + optional: true + + '@esbuild/openbsd-x64@0.25.1': + optional: true + + '@esbuild/sunos-x64@0.25.1': + optional: true + + '@esbuild/win32-arm64@0.25.1': + optional: true + + '@esbuild/win32-ia32@0.25.1': + optional: true + + '@esbuild/win32-x64@0.25.1': + optional: true + + '@napi-rs/wasm-runtime@0.2.7': + dependencies: + '@emnapi/core': 1.3.1 + '@emnapi/runtime': 1.3.1 + '@tybys/wasm-util': 0.9.0 + + '@oxc-parser/binding-wasm32-wasi@file:../../../others/oxc/napi/parser/npm-dir/wasm32-wasi': + dependencies: + '@napi-rs/wasm-runtime': 0.2.7 + + '@rollup/rollup-android-arm-eabi@4.35.0': + optional: true + + '@rollup/rollup-android-arm64@4.35.0': + optional: true + + '@rollup/rollup-darwin-arm64@4.35.0': + optional: true + + '@rollup/rollup-darwin-x64@4.35.0': + optional: true + + '@rollup/rollup-freebsd-arm64@4.35.0': + optional: true + + '@rollup/rollup-freebsd-x64@4.35.0': + optional: true + + '@rollup/rollup-linux-arm-gnueabihf@4.35.0': + optional: true + + '@rollup/rollup-linux-arm-musleabihf@4.35.0': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.35.0': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.35.0': + optional: true + + '@rollup/rollup-linux-loongarch64-gnu@4.35.0': + optional: true + + '@rollup/rollup-linux-powerpc64le-gnu@4.35.0': + optional: true + + '@rollup/rollup-linux-riscv64-gnu@4.35.0': + optional: true + + '@rollup/rollup-linux-s390x-gnu@4.35.0': + optional: true + + '@rollup/rollup-linux-x64-gnu@4.35.0': + optional: true + + '@rollup/rollup-linux-x64-musl@4.35.0': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.35.0': + optional: true + + '@rollup/rollup-win32-ia32-msvc@4.35.0': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.35.0': + optional: true + + '@tybys/wasm-util@0.9.0': + dependencies: + tslib: 2.8.1 + + '@types/estree@1.0.6': {} + + esbuild@0.25.1: + optionalDependencies: + '@esbuild/aix-ppc64': 0.25.1 + '@esbuild/android-arm': 0.25.1 + '@esbuild/android-arm64': 0.25.1 + '@esbuild/android-x64': 0.25.1 + '@esbuild/darwin-arm64': 0.25.1 + '@esbuild/darwin-x64': 0.25.1 + '@esbuild/freebsd-arm64': 0.25.1 + '@esbuild/freebsd-x64': 0.25.1 + '@esbuild/linux-arm': 0.25.1 + '@esbuild/linux-arm64': 0.25.1 + '@esbuild/linux-ia32': 0.25.1 + '@esbuild/linux-loong64': 0.25.1 + '@esbuild/linux-mips64el': 0.25.1 + '@esbuild/linux-ppc64': 0.25.1 + '@esbuild/linux-riscv64': 0.25.1 + '@esbuild/linux-s390x': 0.25.1 + '@esbuild/linux-x64': 0.25.1 + '@esbuild/netbsd-arm64': 0.25.1 + '@esbuild/netbsd-x64': 0.25.1 + '@esbuild/openbsd-arm64': 0.25.1 + '@esbuild/openbsd-x64': 0.25.1 + '@esbuild/sunos-x64': 0.25.1 + '@esbuild/win32-arm64': 0.25.1 + '@esbuild/win32-ia32': 0.25.1 + '@esbuild/win32-x64': 0.25.1 + + fsevents@2.3.3: + optional: true + + nanoid@3.3.9: {} + + picocolors@1.1.1: {} + + postcss@8.5.3: + dependencies: + nanoid: 3.3.9 + picocolors: 1.1.1 + source-map-js: 1.2.1 + + rollup@4.35.0: + dependencies: + '@types/estree': 1.0.6 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.35.0 + '@rollup/rollup-android-arm64': 4.35.0 + '@rollup/rollup-darwin-arm64': 4.35.0 + '@rollup/rollup-darwin-x64': 4.35.0 + '@rollup/rollup-freebsd-arm64': 4.35.0 + '@rollup/rollup-freebsd-x64': 4.35.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.35.0 + '@rollup/rollup-linux-arm-musleabihf': 4.35.0 + '@rollup/rollup-linux-arm64-gnu': 4.35.0 + '@rollup/rollup-linux-arm64-musl': 4.35.0 + '@rollup/rollup-linux-loongarch64-gnu': 4.35.0 + '@rollup/rollup-linux-powerpc64le-gnu': 4.35.0 + '@rollup/rollup-linux-riscv64-gnu': 4.35.0 + '@rollup/rollup-linux-s390x-gnu': 4.35.0 + '@rollup/rollup-linux-x64-gnu': 4.35.0 + '@rollup/rollup-linux-x64-musl': 4.35.0 + '@rollup/rollup-win32-arm64-msvc': 4.35.0 + '@rollup/rollup-win32-ia32-msvc': 4.35.0 + '@rollup/rollup-win32-x64-msvc': 4.35.0 + fsevents: 2.3.3 + + source-map-js@1.2.1: {} + + tslib@2.8.1: {} + + vite@6.2.2: + dependencies: + esbuild: 0.25.1 + postcss: 8.5.3 + rollup: 4.35.0 + optionalDependencies: + fsevents: 2.3.3 diff --git a/oxc-wasi-vite-2/src/main.js b/oxc-wasi-vite-2/src/main.js new file mode 100644 index 00000000..2dd43832 --- /dev/null +++ b/oxc-wasi-vite-2/src/main.js @@ -0,0 +1,15 @@ +// NOTE +// this uses top-level-await of full wasm binary, +// so static import should be probably avoided in practice. +import { parseSync, parseAsync } from "oxc-parser"; + +async function main() { + const parse = window.location.search.includes("async") + ? parseAsync + : parseSync; + const result = await parse("test.js", `let foo;`); + const astJson = JSON.stringify(result.program, null, 2); + document.querySelector("#app").innerHTML = `
${astJson}
`; +} + +main(); diff --git a/oxc-wasi-vite-2/vite.config.ts b/oxc-wasi-vite-2/vite.config.ts new file mode 100644 index 00000000..09563894 --- /dev/null +++ b/oxc-wasi-vite-2/vite.config.ts @@ -0,0 +1,43 @@ +import { defineConfig } from "vite"; + +export default defineConfig({ + optimizeDeps: { + exclude: ["oxc-parser", "@oxc-parser/binding-wasm32-wasi"], + }, + server: { + headers: { + "Cross-Origin-Embedder-Policy": "require-corp", + "Cross-Origin-Opener-Policy": "same-origin", + }, + }, + resolve: { + // requires when testing linked package of oxc/napi/parser + alias: { + "oxc-parser": "oxc-parser/wasm.js", + }, + dedupe: ["@oxc-parser/binding-wasm32-wasi"], + }, + plugins: [ + { + name: "wasi-workaround", + enforce: "pre", + transform(code, id) { + // TODO: Vite bug? sometimes, the request with `?import&url` fails as Vite responds wasm binary. + // node_modules/@oxc-parser/binding-wasm32-wasi/parser.wasm32-wasi.wasm?import&url + // Using `new URL(...)` seems to work more consistently. + if ( + id.includes("@oxc-parser/binding-wasm32-wasi/parser.wasi-browser.js") + ) { + return code.replace( + `import __wasmUrl from './parser.wasm32-wasi.wasm?url'`, + `const __wasmUrl = new URL("./parser.wasm32-wasi.wasm", import.meta.url);`, + ); + } + }, + }, + ], + build: { + // napi-rs wasi-browser.js output relies on top-level await + target: "es2022", + }, +}); From 0df1f303207717f60c0ebf8ca74f2b3eb370d5d8 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Sat, 15 Mar 2025 18:37:12 +0900 Subject: [PATCH 2/2] chore: test tar package --- oxc-wasi-vite-2/package.json | 4 +-- oxc-wasi-vite-2/pnpm-lock.yaml | 30 ++++++++++++----- oxc-wasi-vite-2/vite.config.ts | 61 ++++++++++++++++++---------------- 3 files changed, 57 insertions(+), 38 deletions(-) diff --git a/oxc-wasi-vite-2/package.json b/oxc-wasi-vite-2/package.json index c7befae4..3fd83416 100644 --- a/oxc-wasi-vite-2/package.json +++ b/oxc-wasi-vite-2/package.json @@ -9,8 +9,8 @@ "preview": "vite preview" }, "dependencies": { - "@oxc-parser/binding-wasm32-wasi": "file:/home/hiroshi/code/others/oxc/napi/parser/npm-dir/wasm32-wasi", - "oxc-parser": "link:/home/hiroshi/code/others/oxc/napi/parser" + "@oxc-parser/binding-wasm32-wasi": "file:/home/hiroshi/code/others/oxc/napi/parser/npm-dir/wasm32-wasi/oxc-parser-binding-wasm32-wasi-0.58.1.tgz", + "oxc-parser": "file:/home/hiroshi/code/others/oxc/napi/parser/oxc-parser-0.58.1.tgz" }, "devDependencies": { "vite": "^6.2.0" diff --git a/oxc-wasi-vite-2/pnpm-lock.yaml b/oxc-wasi-vite-2/pnpm-lock.yaml index 051c7c0a..9e842460 100644 --- a/oxc-wasi-vite-2/pnpm-lock.yaml +++ b/oxc-wasi-vite-2/pnpm-lock.yaml @@ -9,11 +9,11 @@ importers: .: dependencies: '@oxc-parser/binding-wasm32-wasi': - specifier: file:/home/hiroshi/code/others/oxc/napi/parser/npm-dir/wasm32-wasi - version: file:../../../others/oxc/napi/parser/npm-dir/wasm32-wasi + specifier: file:/home/hiroshi/code/others/oxc/napi/parser/npm-dir/wasm32-wasi/oxc-parser-binding-wasm32-wasi-0.58.1.tgz + version: file:../../../others/oxc/napi/parser/npm-dir/wasm32-wasi/oxc-parser-binding-wasm32-wasi-0.58.1.tgz oxc-parser: - specifier: link:/home/hiroshi/code/others/oxc/napi/parser - version: link:../../../others/oxc/napi/parser + specifier: file:/home/hiroshi/code/others/oxc/napi/parser/oxc-parser-0.58.1.tgz + version: file:../../../others/oxc/napi/parser/oxc-parser-0.58.1.tgz devDependencies: vite: specifier: ^6.2.0 @@ -183,10 +183,13 @@ packages: '@napi-rs/wasm-runtime@0.2.7': resolution: {integrity: sha512-5yximcFK5FNompXfJFoWanu5l8v1hNGqNHh9du1xETp9HWk/B/PzvchX55WYOPaIeNglG8++68AAiauBAtbnzw==} - '@oxc-parser/binding-wasm32-wasi@file:../../../others/oxc/napi/parser/npm-dir/wasm32-wasi': - resolution: {directory: ../../../others/oxc/napi/parser/npm-dir/wasm32-wasi, type: directory} + '@oxc-parser/binding-wasm32-wasi@file:../../../others/oxc/napi/parser/npm-dir/wasm32-wasi/oxc-parser-binding-wasm32-wasi-0.58.1.tgz': + resolution: {integrity: sha512-yILqQN2L+1spoqV7c8PTEIcbX1tlBqwR93/D5zCJlDJfAuCEN/si+bGHj0WGV7dWzTvtFze+hA7e7dmlBbqrNQ==, tarball: file:../../../others/oxc/napi/parser/npm-dir/wasm32-wasi/oxc-parser-binding-wasm32-wasi-0.58.1.tgz} + version: 0.58.1 engines: {node: '>=14.0.0'} - cpu: [wasm32] + + '@oxc-project/types@0.58.1': + resolution: {integrity: sha512-/412rL5TIAsZJ428FvFsZCKYsnnKsABv9Z7xZmdtUylGT+qiN240wHU++HdHwYj2j1A5SeScB4O4t8EjjcPlUw==} '@rollup/rollup-android-arm-eabi@4.35.0': resolution: {integrity: sha512-uYQ2WfPaqz5QtVgMxfN6NpLD+no0MYHDBywl7itPYd3K5TjjSghNKmX8ic9S8NU8w81NVhJv/XojcHptRly7qQ==} @@ -304,6 +307,11 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + oxc-parser@file:../../../others/oxc/napi/parser/oxc-parser-0.58.1.tgz: + resolution: {integrity: sha512-WeyGRb7BeKtxTk/HGWMn3CeTm39PMoDGLp+TLDtKdMUPn04Vo5s+N8mDIcSRAE8lD0yrJxUe3fE7yFUxvL770g==, tarball: file:../../../others/oxc/napi/parser/oxc-parser-0.58.1.tgz} + version: 0.58.1 + engines: {node: '>=14.0.0'} + picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -459,10 +467,12 @@ snapshots: '@emnapi/runtime': 1.3.1 '@tybys/wasm-util': 0.9.0 - '@oxc-parser/binding-wasm32-wasi@file:../../../others/oxc/napi/parser/npm-dir/wasm32-wasi': + '@oxc-parser/binding-wasm32-wasi@file:../../../others/oxc/napi/parser/npm-dir/wasm32-wasi/oxc-parser-binding-wasm32-wasi-0.58.1.tgz': dependencies: '@napi-rs/wasm-runtime': 0.2.7 + '@oxc-project/types@0.58.1': {} + '@rollup/rollup-android-arm-eabi@4.35.0': optional: true @@ -559,6 +569,10 @@ snapshots: nanoid@3.3.9: {} + oxc-parser@file:../../../others/oxc/napi/parser/oxc-parser-0.58.1.tgz: + dependencies: + '@oxc-project/types': 0.58.1 + picocolors@1.1.1: {} postcss@8.5.3: diff --git a/oxc-wasi-vite-2/vite.config.ts b/oxc-wasi-vite-2/vite.config.ts index 09563894..3f77e1b1 100644 --- a/oxc-wasi-vite-2/vite.config.ts +++ b/oxc-wasi-vite-2/vite.config.ts @@ -2,7 +2,12 @@ import { defineConfig } from "vite"; export default defineConfig({ optimizeDeps: { - exclude: ["oxc-parser", "@oxc-parser/binding-wasm32-wasi"], + esbuildOptions: { + // napi-rs wasi-browser.js output relies on top-level await + target: "esnext", + }, + // force optimize if linked dep + // include: ["oxc-parser"], }, server: { headers: { @@ -10,34 +15,34 @@ export default defineConfig({ "Cross-Origin-Opener-Policy": "same-origin", }, }, - resolve: { - // requires when testing linked package of oxc/napi/parser - alias: { - "oxc-parser": "oxc-parser/wasm.js", - }, - dedupe: ["@oxc-parser/binding-wasm32-wasi"], - }, - plugins: [ - { - name: "wasi-workaround", - enforce: "pre", - transform(code, id) { - // TODO: Vite bug? sometimes, the request with `?import&url` fails as Vite responds wasm binary. - // node_modules/@oxc-parser/binding-wasm32-wasi/parser.wasm32-wasi.wasm?import&url - // Using `new URL(...)` seems to work more consistently. - if ( - id.includes("@oxc-parser/binding-wasm32-wasi/parser.wasi-browser.js") - ) { - return code.replace( - `import __wasmUrl from './parser.wasm32-wasi.wasm?url'`, - `const __wasmUrl = new URL("./parser.wasm32-wasi.wasm", import.meta.url);`, - ); - } - }, - }, - ], + // requires when testing linked package of oxc/napi/parser + // resolve: { + // alias: { + // "oxc-parser": "oxc-parser/wasm.js", + // }, + // dedupe: ["@oxc-parser/binding-wasm32-wasi"], + // }, + // plugins: [ + // { + // name: "wasi-workaround", + // enforce: "pre", + // transform(code, id) { + // // TODO: Vite bug? sometimes, the request with `?import&url` fails as Vite responds wasm binary. + // // node_modules/@oxc-parser/binding-wasm32-wasi/parser.wasm32-wasi.wasm?import&url + // // Using `new URL(...)` seems to work more consistently. + // if ( + // id.includes("@oxc-parser/binding-wasm32-wasi/parser.wasi-browser.js") + // ) { + // return code.replace( + // `import __wasmUrl from './parser.wasm32-wasi.wasm?url'`, + // `const __wasmUrl = new URL("./parser.wasm32-wasi.wasm", import.meta.url);`, + // ); + // } + // }, + // }, + // ], build: { // napi-rs wasi-browser.js output relies on top-level await - target: "es2022", + target: "esnext", }, });