diff --git a/moonbit-tour/package.json b/moonbit-tour/package.json index 9996b6a6..5c782fe1 100644 --- a/moonbit-tour/package.json +++ b/moonbit-tour/package.json @@ -28,7 +28,7 @@ "vite": "^6.0.1" }, "dependencies": { - "@moonbit/moonpad-monaco": "^0.1.202412060", + "@moonbit/moonpad-monaco": "^0.1.202412160", "monaco-editor-core": "^0.52.0" } } diff --git a/moonbit-tour/src/main.ts b/moonbit-tour/src/main.ts index eac671d5..0a76d67a 100644 --- a/moonbit-tour/src/main.ts +++ b/moonbit-tour/src/main.ts @@ -67,26 +67,6 @@ const codePre = document.querySelector(".shiki")!; const model = monaco.editor.createModel(codePre.textContent ?? "", "moonbit"); -function lineTransformStream() { - let buffer = ""; - return new TransformStream({ - transform(chunk, controller) { - buffer += chunk; - const lines = buffer.split("\n"); - buffer = lines.pop() ?? buffer; - for (const line of lines) { - controller.enqueue(line); - } - }, - flush(controller) { - if (buffer.length > 0) { - controller.enqueue(buffer); - } - controller.terminate(); - }, - }); -} - const output = document.querySelector("#output")!; async function run() { @@ -94,19 +74,16 @@ async function run() { const result = await moon.compile({ libContents: [content] }); switch (result.kind) { case "success": { - const wasm = result.wasm; - const stream = await moon.run(wasm); + const js = result.js; + const stream = await moon.run(js); let buffer = ""; - await stream - .pipeThrough(new TextDecoderStream("utf-16")) - .pipeThrough(lineTransformStream()) - .pipeTo( - new WritableStream({ - write(chunk) { - buffer += `${chunk}\n`; - }, - }), - ); + await stream.pipeTo( + new WritableStream({ + write(chunk) { + buffer += `${chunk}\n`; + }, + }), + ); output.textContent = buffer; return; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a7a3f067..1bb17f8c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -82,8 +82,8 @@ importers: moonbit-tour: dependencies: '@moonbit/moonpad-monaco': - specifier: ^0.1.202412060 - version: 0.1.202412060(monaco-editor-core@0.52.2) + specifier: ^0.1.202412160 + version: 0.1.202412160(monaco-editor-core@0.52.2) monaco-editor-core: specifier: ^0.52.0 version: 0.52.2 @@ -1770,14 +1770,14 @@ packages: '@moonbit/analyzer@0.1.202408140': resolution: {integrity: sha512-p1bBR9G7vnuBzKDF/y7MENA8ks4BlyxQX6Pdu9/WezqMs6MZQL0KbwL1z1Oo1MGuxYXLJKV0mXUX2NXpqy2n1A==} - '@moonbit/analyzer@0.1.202412100': - resolution: {integrity: sha512-DmAkytsK/btbYa32REv28rWpvBZfJ9/HSvADhkLV5kXmpiIvOtpzmjzrYPjBmNhY+JqqKRjAC7YeXYMBNuGoxQ==} + '@moonbit/analyzer@0.1.202412160': + resolution: {integrity: sha512-jSMgnVk5NDi3lms67lS8ex2y2LS713pIzLDaIk5+kO6BY4+9hLl6dcW0ZxL9OVh3I1DDOHmbPIY/NIVoTR2NcQ==} - '@moonbit/moonc-worker@0.1.202412100': - resolution: {integrity: sha512-InT6BHHEoP0Yj06uXahtoQs8oqSDFXY4R1+bwfWeRrRIIJJbVQ8PC2QmQDGEk0ZV6DsAK40qBcvoWe7ZN9p3eg==} + '@moonbit/moonc-worker@0.1.202412160': + resolution: {integrity: sha512-pbGeRGKCxgvor7sEduA2XXowl6x9k3EXRa/oL3XFw+FxR0osLQ8WqUGBymzMsD0MP2uo34NfnSTQ49qmwtp06w==} - '@moonbit/moonpad-monaco@0.1.202412060': - resolution: {integrity: sha512-evvUrxHIb/J5tlZOChlqPAV68qwCA+Ce988O7QjeS3Lds0nUMunOAB/iv6Nmd6eq7VCDcwlrBQgqws9zWdTmyA==} + '@moonbit/moonpad-monaco@0.1.202412160': + resolution: {integrity: sha512-gbDN1bA2h1RagvcIt9e31sLxgMt6TBqBQ5PDncQ0WczoG5jMiNYwf1OL3vJZLhKT+Z27fz7KdGmgkma13/Hh/Q==} peerDependencies: monaco-editor-core: ^0.52.0 @@ -2433,12 +2433,17 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + acorn@8.14.0: + resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} + engines: {node: '>=0.4.0'} + hasBin: true + address@1.2.2: resolution: {integrity: sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==} engines: {node: '>= 10.0.0'} - agent-base@7.1.1: - resolution: {integrity: sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==} + agent-base@7.1.3: + resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==} engines: {node: '>= 14'} aggregate-error@3.1.0: @@ -3073,8 +3078,8 @@ packages: resolution: {integrity: sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==} engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0, npm: '>=7.0.0'} - cssstyle@4.0.1: - resolution: {integrity: sha512-8ZYiJ3A/3OkDd093CBT/0UKDWry7ak4BdPTFP2+QEP7cmhouyq/Up709ASSj2cK02BbZiMgk7kYjZNS4QP5qrQ==} + cssstyle@4.1.0: + resolution: {integrity: sha512-h66W1URKpBS5YMI/V8PyXvTMFT8SupJ1IzoIV8IeBC/ji8WVmrO8dGlTi+2dh6whmdk6BiKJLD/ZBkhWbcg6nA==} engines: {node: '>=18'} csstype@3.1.3: @@ -3116,8 +3121,8 @@ packages: supports-color: optional: true - debug@4.3.6: - resolution: {integrity: sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==} + debug@4.4.0: + resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==} engines: {node: '>=6.0'} peerDependencies: supports-color: '*' @@ -3572,8 +3577,8 @@ packages: resolution: {integrity: sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw==} engines: {node: '>= 14.17'} - form-data@4.0.0: - resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} + form-data@4.0.1: + resolution: {integrity: sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==} engines: {node: '>= 6'} format@0.2.2: @@ -3897,8 +3902,8 @@ packages: resolution: {integrity: sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==} engines: {node: '>=10.19.0'} - https-proxy-agent@7.0.5: - resolution: {integrity: sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==} + https-proxy-agent@7.0.6: + resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} engines: {node: '>= 14'} human-signals@2.1.0: @@ -4788,8 +4793,8 @@ packages: nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} - nwsapi@2.2.12: - resolution: {integrity: sha512-qXDmcVlZV4XRtKFzddidpfVP4oMSGhga+xdMc25mv8kaLUHtgzCDhUxkrN8exkGdTlLNaXj7CV3GtON7zuGZ+w==} + nwsapi@2.2.16: + resolution: {integrity: sha512-F1I/bimDpj3ncaNDhfyMWuFqmQDBwDB0Fogc2qpL3BWvkQteFD/8BzWuIRl83rq0DXfm8SGt/HFhLXZyljTXcQ==} object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} @@ -4918,6 +4923,9 @@ packages: parse5@7.1.2: resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} + parse5@7.2.1: + resolution: {integrity: sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ==} + parseurl@1.3.3: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} engines: {node: '>= 0.8'} @@ -5591,8 +5599,8 @@ packages: resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} engines: {node: '>= 0.10'} - psl@1.9.0: - resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} + psl@1.15.0: + resolution: {integrity: sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==} punycode@1.4.1: resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==} @@ -5890,9 +5898,6 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true - rrweb-cssom@0.6.0: - resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} - rrweb-cssom@0.7.1: resolution: {integrity: sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==} @@ -6797,8 +6802,8 @@ packages: resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==} engines: {node: '>=18'} - whatwg-url@14.0.0: - resolution: {integrity: sha512-1lfMEm2IEr7RIV+f4lUNPOqfFL+pO+Xw3fJSqmjX9AbXcXcYOkCe1P6+9VBZB6n94af16NfZf+sSk0JCBZC9aw==} + whatwg-url@14.1.0: + resolution: {integrity: sha512-jlf/foYIKywAt3x/XWKZ/3rz8OSJPiWktjmk891alJUEjiVxKX9LEO92qH3hv4aJ0mN3MWPvGMCy8jQi95xK4w==} engines: {node: '>=18'} which-boxed-primitive@1.0.2: @@ -9016,14 +9021,14 @@ snapshots: '@moonbit/analyzer@0.1.202408140': {} - '@moonbit/analyzer@0.1.202412100': {} + '@moonbit/analyzer@0.1.202412160': {} - '@moonbit/moonc-worker@0.1.202412100': {} + '@moonbit/moonc-worker@0.1.202412160': {} - '@moonbit/moonpad-monaco@0.1.202412060(monaco-editor-core@0.52.2)': + '@moonbit/moonpad-monaco@0.1.202412160(monaco-editor-core@0.52.2)': dependencies: - '@moonbit/analyzer': 0.1.202412100 - '@moonbit/moonc-worker': 0.1.202412100 + '@moonbit/analyzer': 0.1.202412160 + '@moonbit/moonc-worker': 0.1.202412160 comlink: 4.4.2 monaco-editor-core: 0.52.2 vscode-jsonrpc: 8.2.1 @@ -9712,13 +9717,12 @@ snapshots: acorn@8.12.1: {} + acorn@8.14.0: + optional: true + address@1.2.2: {} - agent-base@7.1.1: - dependencies: - debug: 4.3.6 - transitivePeerDependencies: - - supports-color + agent-base@7.1.3: optional: true aggregate-error@3.1.0: @@ -10499,9 +10503,9 @@ snapshots: dependencies: css-tree: 2.2.1 - cssstyle@4.0.1: + cssstyle@4.1.0: dependencies: - rrweb-cssom: 0.6.0 + rrweb-cssom: 0.7.1 optional: true csstype@3.1.3: {} @@ -10509,7 +10513,7 @@ snapshots: data-urls@5.0.0: dependencies: whatwg-mimetype: 4.0.0 - whatwg-url: 14.0.0 + whatwg-url: 14.1.0 optional: true data-view-buffer@1.0.1: @@ -10540,9 +10544,9 @@ snapshots: dependencies: ms: 2.1.2 - debug@4.3.6: + debug@4.4.0: dependencies: - ms: 2.1.2 + ms: 2.1.3 optional: true decimal.js@10.4.3: @@ -11155,7 +11159,7 @@ snapshots: form-data-encoder@2.1.4: {} - form-data@4.0.0: + form-data@4.0.1: dependencies: asynckit: 0.4.0 combined-stream: 1.0.8 @@ -11597,8 +11601,8 @@ snapshots: http-proxy-agent@7.0.2: dependencies: - agent-base: 7.1.1 - debug: 4.3.6 + agent-base: 7.1.3 + debug: 4.4.0 transitivePeerDependencies: - supports-color optional: true @@ -11628,10 +11632,10 @@ snapshots: quick-lru: 5.1.1 resolve-alpn: 1.2.1 - https-proxy-agent@7.0.5: + https-proxy-agent@7.0.6: dependencies: - agent-base: 7.1.1 - debug: 4.3.6 + agent-base: 7.1.3 + debug: 4.4.0 transitivePeerDependencies: - supports-color optional: true @@ -11918,16 +11922,16 @@ snapshots: jsdom@24.1.1: dependencies: - cssstyle: 4.0.1 + cssstyle: 4.1.0 data-urls: 5.0.0 decimal.js: 10.4.3 - form-data: 4.0.0 + form-data: 4.0.1 html-encoding-sniffer: 4.0.0 http-proxy-agent: 7.0.2 - https-proxy-agent: 7.0.5 + https-proxy-agent: 7.0.6 is-potential-custom-element-name: 1.0.1 - nwsapi: 2.2.12 - parse5: 7.1.2 + nwsapi: 2.2.16 + parse5: 7.2.1 rrweb-cssom: 0.7.1 saxes: 6.0.0 symbol-tree: 3.2.4 @@ -11936,7 +11940,7 @@ snapshots: webidl-conversions: 7.0.0 whatwg-encoding: 3.1.1 whatwg-mimetype: 4.0.0 - whatwg-url: 14.0.0 + whatwg-url: 14.1.0 ws: 8.18.0 xml-name-validator: 5.0.0 transitivePeerDependencies: @@ -12741,7 +12745,7 @@ snapshots: dependencies: boolbase: 1.0.0 - nwsapi@2.2.12: + nwsapi@2.2.16: optional: true object-assign@4.1.1: {} @@ -12882,6 +12886,11 @@ snapshots: dependencies: entities: 4.5.0 + parse5@7.2.1: + dependencies: + entities: 4.5.0 + optional: true + parseurl@1.3.3: {} pascal-case@3.1.2: @@ -13577,7 +13586,9 @@ snapshots: forwarded: 0.2.0 ipaddr.js: 1.9.1 - psl@1.9.0: + psl@1.15.0: + dependencies: + punycode: 2.3.1 optional: true punycode@1.4.1: {} @@ -14016,9 +14027,6 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.28.1 fsevents: 2.3.3 - rrweb-cssom@0.6.0: - optional: true - rrweb-cssom@0.7.1: optional: true @@ -14529,7 +14537,7 @@ snapshots: terser@5.31.6: dependencies: '@jridgewell/source-map': 0.3.6 - acorn: 8.12.1 + acorn: 8.14.0 commander: 2.20.3 source-map-support: 0.5.21 optional: true @@ -14570,7 +14578,7 @@ snapshots: tough-cookie@4.1.4: dependencies: - psl: 1.9.0 + psl: 1.15.0 punycode: 2.3.1 universalify: 0.2.0 url-parse: 1.5.10 @@ -15098,7 +15106,7 @@ snapshots: whatwg-mimetype@4.0.0: optional: true - whatwg-url@14.0.0: + whatwg-url@14.1.0: dependencies: tr46: 5.0.0 webidl-conversions: 7.0.0