diff --git a/bindings/wasm/package-lock.json b/bindings/wasm/package-lock.json index 995ae103f..c9c61605d 100644 --- a/bindings/wasm/package-lock.json +++ b/bindings/wasm/package-lock.json @@ -8,7 +8,8 @@ "name": "limbo-wasm", "version": "0.0.11", "workspaces": [ - "packages/*" + "node", + "web" ], "devDependencies": { "@playwright/test": "^1.49.1", @@ -21,6 +22,9 @@ "wasm-pack": "^0.13.1" } }, + "node": { + "version": "0.0.11" + }, "node_modules/@esbuild/darwin-arm64": { "version": "0.24.2", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz", @@ -46,11 +50,11 @@ "license": "MIT" }, "node_modules/@limbo-wasm/node": { - "resolved": "packages/node", + "resolved": "node", "link": true }, "node_modules/@limbo-wasm/web": { - "resolved": "packages/web", + "resolved": "web", "link": true }, "node_modules/@playwright/test": { @@ -1464,10 +1468,24 @@ "license": "ISC" }, "packages/node": { - "version": "0.0.11" + "version": "0.0.11", + "extraneous": true }, "packages/web": { - "version": "0.0.11" + "version": "0.0.11", + "extraneous": true + }, + "web": { + "version": "0.0.11", + "devDependencies": { + "@playwright/test": "^1.49.1", + "@vitest/ui": "^2.1.8", + "happy-dom": "^16.3.0", + "playwright": "^1.49.1", + "vite": "^6.0.7", + "vite-plugin-wasm": "^3.4.1", + "vitest": "^2.1.8" + } } } } diff --git a/bindings/wasm/vite.config.js b/bindings/wasm/vite.config.js deleted file mode 100644 index d86194560..000000000 --- a/bindings/wasm/vite.config.js +++ /dev/null @@ -1,29 +0,0 @@ -import { defineConfig } from "vite"; -import wasm from "vite-plugin-wasm"; - -export default defineConfig({ - publicDir: "./html", - root: ".", - plugins: [wasm()], - test: { - globals: true, - environment: "happy-dom", - setupFiles: ["./test/setup.js"], - include: ["test/*.test.js"], - }, - server: { - headers: { - "Cross-Origin-Embedder-Policy": "require-corp", - "Cross-Origin-Opener-Policy": "same-origin", - "Cross-Origin-Resource-Policy": "cross-origin", - }, - }, - worker: { - format: "es", - rollupOptions: { - output: { - format: "es", - }, - }, - }, -}); diff --git a/bindings/wasm/test-web/html/index.html b/bindings/wasm/web/html/index.html similarity index 63% rename from bindings/wasm/test-web/html/index.html rename to bindings/wasm/web/html/index.html index 11a46531d..0097d61f8 100644 --- a/bindings/wasm/test-web/html/index.html +++ b/bindings/wasm/web/html/index.html @@ -2,7 +2,7 @@ diff --git a/bindings/wasm/test-web/html/limbo-opfs-test.html b/bindings/wasm/web/html/limbo-opfs-test.html similarity index 100% rename from bindings/wasm/test-web/html/limbo-opfs-test.html rename to bindings/wasm/web/html/limbo-opfs-test.html diff --git a/bindings/wasm/test-web/html/limbo-test.html b/bindings/wasm/web/html/limbo-test.html similarity index 100% rename from bindings/wasm/test-web/html/limbo-test.html rename to bindings/wasm/web/html/limbo-test.html diff --git a/bindings/wasm/web/package.json b/bindings/wasm/web/package.json index 10dd46d77..b96c60973 100644 --- a/bindings/wasm/web/package.json +++ b/bindings/wasm/web/package.json @@ -10,5 +10,19 @@ "import": "./dist/index.mjs", "types": "./dist/index.d.ts" } + }, + "scripts": { + "dev": "vite", + "test": "vitest --sequence.shuffle=false", + "test:ui": "vitest --ui" + }, + "devDependencies": { + "@playwright/test": "^1.49.1", + "@vitest/ui": "^2.1.8", + "happy-dom": "^16.3.0", + "playwright": "^1.49.1", + "vite": "^6.0.7", + "vite-plugin-wasm": "^3.4.1", + "vitest": "^2.1.8" } } diff --git a/bindings/wasm/playwright.config.js b/bindings/wasm/web/playwright.config.js similarity index 100% rename from bindings/wasm/playwright.config.js rename to bindings/wasm/web/playwright.config.js diff --git a/bindings/wasm/test-web/test/helpers.js b/bindings/wasm/web/test/helpers.js similarity index 100% rename from bindings/wasm/test-web/test/helpers.js rename to bindings/wasm/web/test/helpers.js diff --git a/bindings/wasm/test-web/test/limbo.test.js b/bindings/wasm/web/test/limbo.test.js similarity index 100% rename from bindings/wasm/test-web/test/limbo.test.js rename to bindings/wasm/web/test/limbo.test.js diff --git a/bindings/wasm/test-web/test/opfs.test.js b/bindings/wasm/web/test/opfs.test.js similarity index 94% rename from bindings/wasm/test-web/test/opfs.test.js rename to bindings/wasm/web/test/opfs.test.js index cdf087ef7..e039c8c3c 100644 --- a/bindings/wasm/test-web/test/opfs.test.js +++ b/bindings/wasm/web/test/opfs.test.js @@ -21,7 +21,7 @@ afterAll(async () => { test("basic read/write functionality", async () => { const { page } = testEnv; const result = await page.evaluate(async () => { - const vfs = new window.VFSInterface("./opfs-worker.js"); + const vfs = new window.VFSInterface("../src/opfs-worker.js"); let fd; try { fd = await vfs.open("test.txt", {}); @@ -47,7 +47,7 @@ test("basic read/write functionality", async () => { test("larger data read/write", async () => { const { page } = testEnv; const result = await page.evaluate(async () => { - const vfs = new window.VFSInterface("./opfs-worker.js"); + const vfs = new window.VFSInterface("../src/opfs-worker.js"); let fd; try { fd = await vfs.open("large.txt", {}); @@ -74,7 +74,7 @@ test("larger data read/write", async () => { test("partial reads and writes", async () => { const { page } = testEnv; const result = await page.evaluate(async () => { - const vfs = new window.VFSInterface("./opfs-worker.js"); + const vfs = new window.VFSInterface("../src/opfs-worker.js"); let fd; try { fd = await vfs.open("partial.txt", {}); @@ -113,7 +113,7 @@ test("partial reads and writes", async () => { test("file size operations", async () => { const { page } = testEnv; const result = await page.evaluate(async () => { - const vfs = new window.VFSInterface("./opfs-worker.js"); + const vfs = new window.VFSInterface("../src/opfs-worker.js"); let fd; try { fd = await vfs.open("size.txt", {}); diff --git a/bindings/wasm/test-web/test/setup.js b/bindings/wasm/web/test/setup.js similarity index 100% rename from bindings/wasm/test-web/test/setup.js rename to bindings/wasm/web/test/setup.js diff --git a/bindings/wasm/test-web/vite.config.js b/bindings/wasm/web/vite.config.js similarity index 100% rename from bindings/wasm/test-web/vite.config.js rename to bindings/wasm/web/vite.config.js