From 7c8c0c9df09a30cc44c57b65c50a30227898be84 Mon Sep 17 00:00:00 2001 From: Steve Dunham Date: Wed, 20 Nov 2024 19:45:32 -0800 Subject: [PATCH] keep newt.js separate in playground --- playground/build | 3 ++- playground/src/global.d.ts | 2 ++ playground/src/main.ts | 1 + playground/src/worker.ts | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/playground/build b/playground/build index 9fca0f0..43239ab 100755 --- a/playground/build +++ b/playground/build @@ -4,6 +4,7 @@ esbuild --bundle node_modules/monaco-editor/esm/vs/editor/editor.worker.js > pub echo build newt worker esbuild src/worker.ts > public/worker.js echo copy newt -cat ../build/exec/newt.js |grep -v '^#'>> public/worker.js +cp ../build/exec/newt.js public +# cat ../build/exec/newt.js |grep -v '^#'>> public/worker.js cp samples/* public # esbuild --minify ../build/exec/newt.min.js > public/newt.js diff --git a/playground/src/global.d.ts b/playground/src/global.d.ts index 63db482..b8f0e38 100644 --- a/playground/src/global.d.ts +++ b/playground/src/global.d.ts @@ -1,6 +1,8 @@ declare module "*.css"; export {}; declare global { + // typescript doesn't know worker.ts is a worker + function importScripts(...scripts: string[]): void; interface Process { platform: string; stdout: { diff --git a/playground/src/main.ts b/playground/src/main.ts index 93c8f8a..7b4b703 100644 --- a/playground/src/main.ts +++ b/playground/src/main.ts @@ -74,6 +74,7 @@ function Editor({ initialValue }: EditorProps) { value, language: "newt", theme: "vs", + fontFamily: "Comic Code, Menlo, Monaco, Courier New, sans", automaticLayout: true, acceptSuggestionOnEnter: "off", unicodeHighlight: { ambiguousCharacters: false }, diff --git a/playground/src/worker.ts b/playground/src/worker.ts index 2cd2b3a..a8da97e 100644 --- a/playground/src/worker.ts +++ b/playground/src/worker.ts @@ -153,3 +153,4 @@ onmessage = async function (e) { let output = stdout postMessage({javascript, output, duration}) } +importScripts('newt.js')