From fcc610b0cd7a1204359c903f85a18d7896d3f22b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sat, 19 Nov 2022 21:43:18 +0100 Subject: [PATCH] vscode-extension: Fix web support --- .vscode/launch.json | 13 +++++++ src/web/vscode-extension/Makefile | 3 +- src/web/vscode-extension/README.md | 4 +-- src/web/vscode-extension/build.js | 51 +++++++++++++++++---------- src/web/vscode-extension/package.json | 7 ++-- 5 files changed, 52 insertions(+), 26 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 516d27a..056f6c8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,6 +12,19 @@ "${workspaceFolder}/src/web/vscode-extension/examples" ], "outFiles": ["${workspaceFolder}/src/web/vscode-extension/dist/*.js"] + }, + { + "name": "Run VS Code Extension (Web)", + "type": "extensionHost", + "debugWebWorkerHost": true, + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}/src/web/vscode-extension", + "--extensionDevelopmentKind=web", + "${workspaceFolder}/src/web/vscode-extension/examples" + ], + "outFiles": ["${workspaceFolder}/src/web/vscode-extension/dist/*.js"] } ] } diff --git a/src/web/vscode-extension/Makefile b/src/web/vscode-extension/Makefile index ebf27ba..a4ba096 100644 --- a/src/web/vscode-extension/Makefile +++ b/src/web/vscode-extension/Makefile @@ -8,9 +8,8 @@ install-deps: .PHONY: prepackage prepackage: all LICENSE.txt icon.png - .PHONY: package -package: prepackage +package: vsce package .PHONY: publish diff --git a/src/web/vscode-extension/README.md b/src/web/vscode-extension/README.md index 7c17d53..70df1f3 100644 --- a/src/web/vscode-extension/README.md +++ b/src/web/vscode-extension/README.md @@ -8,7 +8,7 @@ Logo-like Forth Turtle graphics.
-WAForth notebook +WAForth notebook
-
WAForth notebook
+
WAForth notebook
\ No newline at end of file diff --git a/src/web/vscode-extension/build.js b/src/web/vscode-extension/build.js index ee2faf9..3b712ec 100755 --- a/src/web/vscode-extension/build.js +++ b/src/web/vscode-extension/build.js @@ -15,22 +15,35 @@ for (const arg of process.argv.slice(2)) { } } -esbuild - .build({ - bundle: true, - logLevel: "info", - entryPoints: [path.join(__dirname, "src/extension.ts")], - outfile: path.join(__dirname, "dist/extension.js"), - format: "cjs", - minify: !dev, - sourcemap: true, - platform: "node", - external: ["vscode"], - loader: { - ".wasm": "binary", - ".fs": "text", - ".svg": "dataurl", - }, - plugins: [wasmTextPlugin({ debug: true })], - }) - .catch(() => process.exit(1)); +const config = { + bundle: true, + logLevel: "info", + entryPoints: [path.join(__dirname, "src/extension.ts")], + format: "cjs", + minify: !dev, + sourcemap: true, + external: ["vscode"], + loader: { + ".wasm": "binary", + ".fs": "text", + ".svg": "dataurl", + }, + plugins: [wasmTextPlugin({ debug: true })], +}; + +(async () => { + try { + await esbuild.build({ + ...config, + outfile: path.join(__dirname, "dist/extension.js"), + platform: "node", + }); + await esbuild.build({ + ...config, + outfile: path.join(__dirname, "dist/extension.web.js"), + platform: "browser", + }); + } catch (e) { + process.exit(1); + } +})(); diff --git a/src/web/vscode-extension/package.json b/src/web/vscode-extension/package.json index 85e1e54..73d1133 100644 --- a/src/web/vscode-extension/package.json +++ b/src/web/vscode-extension/package.json @@ -1,6 +1,6 @@ { "name": "waforth-vscode-extension", - "version": "0.1.3", + "version": "0.1.5", "displayName": "WAForth", "description": "WAForth interactive notebooks", "categories": [ @@ -8,14 +8,15 @@ "Notebooks" ], "keywords": [ - "forth" + "forth", + "wafnb" ], "publisher": "remko", "license": "MIT", "repository": "github:remko/waforth", "icon": "icon.png", "main": "dist/extension.js", - "browser": "dist/extension.js", + "browser": "dist/extension.web.js", "engines": { "vscode": "^1.61.0" },