keep newt.js separate in playground

This commit is contained in:
2024-11-20 19:45:32 -08:00
parent 1a9d44434c
commit 7c8c0c9df0
4 changed files with 6 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ esbuild --bundle node_modules/monaco-editor/esm/vs/editor/editor.worker.js > pub
echo build newt worker echo build newt worker
esbuild src/worker.ts > public/worker.js esbuild src/worker.ts > public/worker.js
echo copy newt 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 cp samples/* public
# esbuild --minify ../build/exec/newt.min.js > public/newt.js # esbuild --minify ../build/exec/newt.min.js > public/newt.js

View File

@@ -1,6 +1,8 @@
declare module "*.css"; declare module "*.css";
export {}; export {};
declare global { declare global {
// typescript doesn't know worker.ts is a worker
function importScripts(...scripts: string[]): void;
interface Process { interface Process {
platform: string; platform: string;
stdout: { stdout: {

View File

@@ -74,6 +74,7 @@ function Editor({ initialValue }: EditorProps) {
value, value,
language: "newt", language: "newt",
theme: "vs", theme: "vs",
fontFamily: "Comic Code, Menlo, Monaco, Courier New, sans",
automaticLayout: true, automaticLayout: true,
acceptSuggestionOnEnter: "off", acceptSuggestionOnEnter: "off",
unicodeHighlight: { ambiguousCharacters: false }, unicodeHighlight: { ambiguousCharacters: false },

View File

@@ -153,3 +153,4 @@ onmessage = async function (e) {
let output = stdout let output = stdout
postMessage({javascript, output, duration}) postMessage({javascript, output, duration})
} }
importScripts('newt.js')