From da1bbb839dd4e84c7f8dd25605c76e1f18763a0c Mon Sep 17 00:00:00 2001 From: Pafnooty Date: Thu, 8 May 2025 23:39:40 +0300 Subject: [PATCH] Remove asmscript from build --- .gitignore | 2 ++ build/wasmPlugin.ts | 27 ++------------------------- package.json | 1 - 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 9b1ee42..3e6b333 100644 --- a/.gitignore +++ b/.gitignore @@ -173,3 +173,5 @@ dist # Finder (MacOS) folder config .DS_Store +error.log +package-lock.json diff --git a/build/wasmPlugin.ts b/build/wasmPlugin.ts index 95f8d32..8c9c2bd 100644 --- a/build/wasmPlugin.ts +++ b/build/wasmPlugin.ts @@ -1,6 +1,5 @@ import { plugin, $, type BunPlugin } from "bun"; import path from 'path'; -import asc from 'assemblyscript/asc'; interface WasmLoaderConfig { production?: boolean; @@ -11,7 +10,7 @@ const wasmPlugin = ({ production, portable }: WasmLoaderConfig = {}): BunPlugin const p: BunPlugin = { name: "WASM loader", async setup(build) { - build.onLoad({ filter: /\.(c(pp)?|wasm(\.ts)?)$/ }, async (args) => { + build.onLoad({ filter: /\.(c(pp)?|wasm)$/ }, async (args) => { let wasmPath = path.resolve(import.meta.dir, '..', 'dist', 'tmp.wasm'); let jsContent: string = ` async function instantiate(url) { @@ -45,29 +44,7 @@ const wasmPlugin = ({ production, portable }: WasmLoaderConfig = {}): BunPlugin export default module; `; - if (args.path.endsWith('.ts')) { - if (portable) { - const contents = await Bun.file(args.path).text(); - return { - contents: `import "assemblyscript/std/portable/index.js";\n${contents}`, - loader: 'tsx', - } - } - const jsPath = wasmPath.replace(/\.wasm$/, '.js'); - const ascArgs = [ - args.path, - '--outFile', wasmPath, - '--bindings', 'esm', - '-Ospeed' - ]; - - const { error, stderr } = await asc.main(ascArgs); - if (error) { - console.error(stderr.toString(), error.message); - throw error; - } - jsContent = await Bun.file(jsPath).text(); - } else if (args.path.endsWith('.wasm')) { + if (args.path.endsWith('.wasm')) { wasmPath = args.path; } else { const buildAssets = path.resolve(import.meta.dir, 'assets'); diff --git a/package.json b/package.json index 4883d75..61f7831 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "@types/bun": "latest", "@types/html-minifier": "4.0.5", "@types/inquirer": "9.0.7", - "assemblyscript": "0.27.29", "browser-detect": "0.2.28", "eruda": "3.2.3", "html-minifier": "4.0.0",