switch to wasm-pack

This commit is contained in:
Moritz Hölting 2024-10-01 01:17:28 +02:00
parent be855e7136
commit f00f022e55
8 changed files with 226 additions and 77 deletions

View File

@ -28,8 +28,8 @@ jobs:
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
targets: wasm32-unknown-unknown targets: wasm32-unknown-unknown
- name: Install wasm-bindgen-cli - name: Install wasm-pack-cli
uses: jetli/wasm-bindgen-action@v0.2.0 uses: jetli/wasm-pack-action@v0.2.0
- name: Install, build, and upload your site output - name: Install, build, and upload your site output
uses: withastro/action@v2 uses: withastro/action@v2
with: with:

View File

@ -3,6 +3,8 @@ import starlight from "@astrojs/starlight";
import react from "@astrojs/react"; import react from "@astrojs/react";
import starlightLinksValidator from "starlight-links-validator"; import starlightLinksValidator from "starlight-links-validator";
import starlightUtils from "@lorenzo_lewis/starlight-utils"; import starlightUtils from "@lorenzo_lewis/starlight-utils";
import wasm from "vite-plugin-wasm";
import shikiConfig from "./src/utils/shiki"; import shikiConfig from "./src/utils/shiki";
const playgroundSidebarEntry = { const playgroundSidebarEntry = {
@ -119,4 +121,9 @@ export default defineConfig({
], ],
}), }),
], ],
vite: {
plugins: [
wasm(),
],
}
}); });

View File

@ -5,7 +5,7 @@
"scripts": { "scripts": {
"dev": "pnpm build-wasm && astro dev", "dev": "pnpm build-wasm && astro dev",
"start": "pnpm build-wasm && astro dev", "start": "pnpm build-wasm && astro dev",
"build-wasm": "cargo build --manifest-path ./src/wasm/webcompiler/Cargo.toml --release --target wasm32-unknown-unknown --target-dir ./target_rust && wasm-bindgen --target web --out-dir ./src/wasm/webcompiler/pkg/ --out-name webcompiler ./target_rust/wasm32-unknown-unknown/release/webcompiler.wasm", "build-wasm": "wasm-pack build --release ./src/wasm/webcompiler -- --features wee_alloc",
"build": "pnpm build-wasm && astro check && astro build", "build": "pnpm build-wasm && astro check && astro build",
"preview": "astro preview", "preview": "astro preview",
"astro": "astro" "astro": "astro"
@ -32,7 +32,8 @@
"starlight-links-validator": "^0.7.1", "starlight-links-validator": "^0.7.1",
"tm-themes": "^1.4.3", "tm-themes": "^1.4.3",
"typescript": "^5.4.5", "typescript": "^5.4.5",
"use-immer": "^0.10.0" "use-immer": "^0.10.0",
"vite-plugin-wasm": "^3.3.0"
}, },
"devDependencies": { "devDependencies": {
"sass": "^1.77.6" "sass": "^1.77.6"

View File

@ -13,28 +13,28 @@ importers:
version: 0.5.10(typescript@5.4.5) version: 0.5.10(typescript@5.4.5)
'@astrojs/react': '@astrojs/react':
specifier: ^3.6.0 specifier: ^3.6.0
version: 3.6.0(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1)(vite@5.2.13) version: 3.6.0(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(vite@5.2.13(sass@1.77.6))
'@astrojs/starlight': '@astrojs/starlight':
specifier: ^0.24.2 specifier: ^0.24.2
version: 0.24.2(astro@4.10.2) version: 0.24.2(astro@4.10.2(sass@1.77.6)(typescript@5.4.5))
'@emotion/react': '@emotion/react':
specifier: ^11.11.4 specifier: ^11.11.4
version: 11.11.4(@types/react@18.3.3)(react@18.3.1) version: 11.11.4(@types/react@18.3.3)(react@18.3.1)
'@emotion/styled': '@emotion/styled':
specifier: ^11.11.5 specifier: ^11.11.5
version: 11.11.5(@emotion/react@11.11.4)(@types/react@18.3.3)(react@18.3.1) version: 11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1)
'@lorenzo_lewis/starlight-utils': '@lorenzo_lewis/starlight-utils':
specifier: ^0.1.1 specifier: ^0.1.1
version: 0.1.1(@astrojs/starlight@0.24.2)(astro@4.10.2) version: 0.1.1(@astrojs/starlight@0.24.2(astro@4.10.2(sass@1.77.6)(typescript@5.4.5)))(astro@4.10.2(sass@1.77.6)(typescript@5.4.5))
'@monaco-editor/react': '@monaco-editor/react':
specifier: ^4.6.0 specifier: ^4.6.0
version: 4.6.0(monaco-editor@0.49.0)(react-dom@18.3.1)(react@18.3.1) version: 4.6.0(monaco-editor@0.49.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@mui/icons-material': '@mui/icons-material':
specifier: ^5.15.20 specifier: ^5.15.20
version: 5.15.20(@mui/material@5.15.20)(@types/react@18.3.3)(react@18.3.1) version: 5.15.20(@mui/material@5.15.20(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/react@18.3.3)(react@18.3.1)
'@mui/material': '@mui/material':
specifier: ^5.15.20 specifier: ^5.15.20
version: 5.15.20(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1) version: 5.15.20(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@shikijs/monaco': '@shikijs/monaco':
specifier: ^1.7.0 specifier: ^1.7.0
version: 1.7.0 version: 1.7.0
@ -64,7 +64,7 @@ importers:
version: 1.7.0 version: 1.7.0
starlight-links-validator: starlight-links-validator:
specifier: ^0.7.1 specifier: ^0.7.1
version: 0.7.1(@astrojs/starlight@0.24.2)(astro@4.10.2) version: 0.7.1(@astrojs/starlight@0.24.2(astro@4.10.2(sass@1.77.6)(typescript@5.4.5)))(astro@4.10.2(sass@1.77.6)(typescript@5.4.5))
tm-themes: tm-themes:
specifier: ^1.4.3 specifier: ^1.4.3
version: 1.4.3 version: 1.4.3
@ -74,6 +74,9 @@ importers:
use-immer: use-immer:
specifier: ^0.10.0 specifier: ^0.10.0
version: 0.10.0(immer@10.1.1)(react@18.3.1) version: 0.10.0(immer@10.1.1)(react@18.3.1)
vite-plugin-wasm:
specifier: ^3.3.0
version: 3.3.0(vite@5.2.13(sass@1.77.6))
devDependencies: devDependencies:
sass: sass:
specifier: ^1.77.6 specifier: ^1.77.6
@ -2823,6 +2826,11 @@ packages:
vfile@6.0.1: vfile@6.0.1:
resolution: {integrity: sha512-1bYqc7pt6NIADBJ98UiG0Bn/CHIVOoZ/IyEkqIruLg0mE1BKzkOXY2D6CSqQIcKqgadppE5lrxgWXJmXd7zZJw==} resolution: {integrity: sha512-1bYqc7pt6NIADBJ98UiG0Bn/CHIVOoZ/IyEkqIruLg0mE1BKzkOXY2D6CSqQIcKqgadppE5lrxgWXJmXd7zZJw==}
vite-plugin-wasm@3.3.0:
resolution: {integrity: sha512-tVhz6w+W9MVsOCHzxo6SSMSswCeIw4HTrXEi6qL3IRzATl83jl09JVO1djBqPSwfjgnpVHNLYcaMbaDX5WB/pg==}
peerDependencies:
vite: ^2 || ^3 || ^4 || ^5
vite@5.2.13: vite@5.2.13:
resolution: {integrity: sha512-SSq1noJfY9pR3I1TUENL3rQYDQCFqgD+lM6fTRAM8Nv6Lsg5hDLaXkjETVeBt+7vZBCMoibD+6IWnT2mJ+Zb/A==} resolution: {integrity: sha512-SSq1noJfY9pR3I1TUENL3rQYDQCFqgD+lM6fTRAM8Nv6Lsg5hDLaXkjETVeBt+7vZBCMoibD+6IWnT2mJ+Zb/A==}
engines: {node: ^18.0.0 || >=20.0.0} engines: {node: ^18.0.0 || >=20.0.0}
@ -3082,7 +3090,7 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
'@astrojs/mdx@3.1.0(astro@4.10.2)': '@astrojs/mdx@3.1.0(astro@4.10.2(sass@1.77.6)(typescript@5.4.5))':
dependencies: dependencies:
'@astrojs/markdown-remark': 5.1.0 '@astrojs/markdown-remark': 5.1.0
'@mdx-js/mdx': 3.0.1 '@mdx-js/mdx': 3.0.1
@ -3107,11 +3115,11 @@ snapshots:
dependencies: dependencies:
prismjs: 1.29.0 prismjs: 1.29.0
'@astrojs/react@3.6.0(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1)(vite@5.2.13)': '@astrojs/react@3.6.0(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(vite@5.2.13(sass@1.77.6))':
dependencies: dependencies:
'@types/react': 18.3.3 '@types/react': 18.3.3
'@types/react-dom': 18.3.0 '@types/react-dom': 18.3.0
'@vitejs/plugin-react': 4.3.1(vite@5.2.13) '@vitejs/plugin-react': 4.3.1(vite@5.2.13(sass@1.77.6))
react: 18.3.1 react: 18.3.1
react-dom: 18.3.1(react@18.3.1) react-dom: 18.3.1(react@18.3.1)
ultrahtml: 1.5.3 ultrahtml: 1.5.3
@ -3125,15 +3133,15 @@ snapshots:
stream-replace-string: 2.0.0 stream-replace-string: 2.0.0
zod: 3.23.8 zod: 3.23.8
'@astrojs/starlight@0.24.2(astro@4.10.2)': '@astrojs/starlight@0.24.2(astro@4.10.2(sass@1.77.6)(typescript@5.4.5))':
dependencies: dependencies:
'@astrojs/mdx': 3.1.0(astro@4.10.2) '@astrojs/mdx': 3.1.0(astro@4.10.2(sass@1.77.6)(typescript@5.4.5))
'@astrojs/sitemap': 3.1.5 '@astrojs/sitemap': 3.1.5
'@pagefind/default-ui': 1.1.0 '@pagefind/default-ui': 1.1.0
'@types/hast': 3.0.4 '@types/hast': 3.0.4
'@types/mdast': 4.0.4 '@types/mdast': 4.0.4
astro: 4.10.2(sass@1.77.6)(typescript@5.4.5) astro: 4.10.2(sass@1.77.6)(typescript@5.4.5)
astro-expressive-code: 0.35.3(astro@4.10.2) astro-expressive-code: 0.35.3(astro@4.10.2(sass@1.77.6)(typescript@5.4.5))
bcp-47: 2.1.0 bcp-47: 2.1.0
hast-util-from-html: 2.0.1 hast-util-from-html: 2.0.1
hast-util-select: 6.0.2 hast-util-select: 6.0.2
@ -3403,9 +3411,10 @@ snapshots:
'@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@18.3.1) '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@18.3.1)
'@emotion/utils': 1.2.1 '@emotion/utils': 1.2.1
'@emotion/weak-memoize': 0.3.1 '@emotion/weak-memoize': 0.3.1
'@types/react': 18.3.3
hoist-non-react-statics: 3.3.2 hoist-non-react-statics: 3.3.2
react: 18.3.1 react: 18.3.1
optionalDependencies:
'@types/react': 18.3.3
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
@ -3419,7 +3428,7 @@ snapshots:
'@emotion/sheet@1.2.2': {} '@emotion/sheet@1.2.2': {}
'@emotion/styled@11.11.5(@emotion/react@11.11.4)(@types/react@18.3.3)(react@18.3.1)': '@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1)':
dependencies: dependencies:
'@babel/runtime': 7.24.7 '@babel/runtime': 7.24.7
'@emotion/babel-plugin': 11.11.0 '@emotion/babel-plugin': 11.11.0
@ -3428,8 +3437,9 @@ snapshots:
'@emotion/serialize': 1.1.4 '@emotion/serialize': 1.1.4
'@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@18.3.1) '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@18.3.1)
'@emotion/utils': 1.2.1 '@emotion/utils': 1.2.1
'@types/react': 18.3.3
react: 18.3.1 react: 18.3.1
optionalDependencies:
'@types/react': 18.3.3
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
@ -3615,7 +3625,7 @@ snapshots:
'@floating-ui/core': 1.6.2 '@floating-ui/core': 1.6.2
'@floating-ui/utils': 0.2.2 '@floating-ui/utils': 0.2.2
'@floating-ui/react-dom@2.1.0(react-dom@18.3.1)(react@18.3.1)': '@floating-ui/react-dom@2.1.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies: dependencies:
'@floating-ui/dom': 1.6.5 '@floating-ui/dom': 1.6.5
react: 18.3.1 react: 18.3.1
@ -3722,11 +3732,11 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2 '@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/sourcemap-codec': 1.4.15
'@lorenzo_lewis/starlight-utils@0.1.1(@astrojs/starlight@0.24.2)(astro@4.10.2)': '@lorenzo_lewis/starlight-utils@0.1.1(@astrojs/starlight@0.24.2(astro@4.10.2(sass@1.77.6)(typescript@5.4.5)))(astro@4.10.2(sass@1.77.6)(typescript@5.4.5))':
dependencies: dependencies:
'@astrojs/starlight': 0.24.2(astro@4.10.2) '@astrojs/starlight': 0.24.2(astro@4.10.2(sass@1.77.6)(typescript@5.4.5))
astro: 4.10.2(sass@1.77.6)(typescript@5.4.5) astro: 4.10.2(sass@1.77.6)(typescript@5.4.5)
astro-integration-kit: 0.13.3(astro@4.10.2) astro-integration-kit: 0.13.3(astro@4.10.2(sass@1.77.6)(typescript@5.4.5))
transitivePeerDependencies: transitivePeerDependencies:
- '@astrojs/db' - '@astrojs/db'
@ -3763,46 +3773,45 @@ snapshots:
monaco-editor: 0.49.0 monaco-editor: 0.49.0
state-local: 1.0.7 state-local: 1.0.7
'@monaco-editor/react@4.6.0(monaco-editor@0.49.0)(react-dom@18.3.1)(react@18.3.1)': '@monaco-editor/react@4.6.0(monaco-editor@0.49.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies: dependencies:
'@monaco-editor/loader': 1.4.0(monaco-editor@0.49.0) '@monaco-editor/loader': 1.4.0(monaco-editor@0.49.0)
monaco-editor: 0.49.0 monaco-editor: 0.49.0
react: 18.3.1 react: 18.3.1
react-dom: 18.3.1(react@18.3.1) react-dom: 18.3.1(react@18.3.1)
'@mui/base@5.0.0-beta.40(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1)': '@mui/base@5.0.0-beta.40(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies: dependencies:
'@babel/runtime': 7.24.7 '@babel/runtime': 7.24.7
'@floating-ui/react-dom': 2.1.0(react-dom@18.3.1)(react@18.3.1) '@floating-ui/react-dom': 2.1.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@mui/types': 7.2.14(@types/react@18.3.3) '@mui/types': 7.2.14(@types/react@18.3.3)
'@mui/utils': 5.15.20(@types/react@18.3.3)(react@18.3.1) '@mui/utils': 5.15.20(@types/react@18.3.3)(react@18.3.1)
'@popperjs/core': 2.11.8 '@popperjs/core': 2.11.8
'@types/react': 18.3.3
clsx: 2.1.1 clsx: 2.1.1
prop-types: 15.8.1 prop-types: 15.8.1
react: 18.3.1 react: 18.3.1
react-dom: 18.3.1(react@18.3.1) react-dom: 18.3.1(react@18.3.1)
optionalDependencies:
'@types/react': 18.3.3
'@mui/core-downloads-tracker@5.15.20': {} '@mui/core-downloads-tracker@5.15.20': {}
'@mui/icons-material@5.15.20(@mui/material@5.15.20)(@types/react@18.3.3)(react@18.3.1)': '@mui/icons-material@5.15.20(@mui/material@5.15.20(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/react@18.3.3)(react@18.3.1)':
dependencies: dependencies:
'@babel/runtime': 7.24.7 '@babel/runtime': 7.24.7
'@mui/material': 5.15.20(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1) '@mui/material': 5.15.20(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@types/react': 18.3.3
react: 18.3.1 react: 18.3.1
optionalDependencies:
'@types/react': 18.3.3
'@mui/material@5.15.20(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1)': '@mui/material@5.15.20(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
dependencies: dependencies:
'@babel/runtime': 7.24.7 '@babel/runtime': 7.24.7
'@emotion/react': 11.11.4(@types/react@18.3.3)(react@18.3.1) '@mui/base': 5.0.0-beta.40(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@emotion/styled': 11.11.5(@emotion/react@11.11.4)(@types/react@18.3.3)(react@18.3.1)
'@mui/base': 5.0.0-beta.40(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1)
'@mui/core-downloads-tracker': 5.15.20 '@mui/core-downloads-tracker': 5.15.20
'@mui/system': 5.15.20(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@types/react@18.3.3)(react@18.3.1) '@mui/system': 5.15.20(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1)
'@mui/types': 7.2.14(@types/react@18.3.3) '@mui/types': 7.2.14(@types/react@18.3.3)
'@mui/utils': 5.15.20(@types/react@18.3.3)(react@18.3.1) '@mui/utils': 5.15.20(@types/react@18.3.3)(react@18.3.1)
'@types/react': 18.3.3
'@types/react-transition-group': 4.4.10 '@types/react-transition-group': 4.4.10
clsx: 2.1.1 clsx: 2.1.1
csstype: 3.1.3 csstype: 3.1.3
@ -3810,53 +3819,61 @@ snapshots:
react: 18.3.1 react: 18.3.1
react-dom: 18.3.1(react@18.3.1) react-dom: 18.3.1(react@18.3.1)
react-is: 18.3.1 react-is: 18.3.1
react-transition-group: 4.4.5(react-dom@18.3.1)(react@18.3.1) react-transition-group: 4.4.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
optionalDependencies:
'@emotion/react': 11.11.4(@types/react@18.3.3)(react@18.3.1)
'@emotion/styled': 11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1)
'@types/react': 18.3.3
'@mui/private-theming@5.15.20(@types/react@18.3.3)(react@18.3.1)': '@mui/private-theming@5.15.20(@types/react@18.3.3)(react@18.3.1)':
dependencies: dependencies:
'@babel/runtime': 7.24.7 '@babel/runtime': 7.24.7
'@mui/utils': 5.15.20(@types/react@18.3.3)(react@18.3.1) '@mui/utils': 5.15.20(@types/react@18.3.3)(react@18.3.1)
'@types/react': 18.3.3
prop-types: 15.8.1 prop-types: 15.8.1
react: 18.3.1 react: 18.3.1
optionalDependencies:
'@types/react': 18.3.3
'@mui/styled-engine@5.15.14(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(react@18.3.1)': '@mui/styled-engine@5.15.14(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(react@18.3.1)':
dependencies: dependencies:
'@babel/runtime': 7.24.7 '@babel/runtime': 7.24.7
'@emotion/cache': 11.11.0 '@emotion/cache': 11.11.0
'@emotion/react': 11.11.4(@types/react@18.3.3)(react@18.3.1)
'@emotion/styled': 11.11.5(@emotion/react@11.11.4)(@types/react@18.3.3)(react@18.3.1)
csstype: 3.1.3 csstype: 3.1.3
prop-types: 15.8.1 prop-types: 15.8.1
react: 18.3.1 react: 18.3.1
optionalDependencies:
'@emotion/react': 11.11.4(@types/react@18.3.3)(react@18.3.1)
'@emotion/styled': 11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1)
'@mui/system@5.15.20(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@types/react@18.3.3)(react@18.3.1)': '@mui/system@5.15.20(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1)':
dependencies: dependencies:
'@babel/runtime': 7.24.7 '@babel/runtime': 7.24.7
'@emotion/react': 11.11.4(@types/react@18.3.3)(react@18.3.1)
'@emotion/styled': 11.11.5(@emotion/react@11.11.4)(@types/react@18.3.3)(react@18.3.1)
'@mui/private-theming': 5.15.20(@types/react@18.3.3)(react@18.3.1) '@mui/private-theming': 5.15.20(@types/react@18.3.3)(react@18.3.1)
'@mui/styled-engine': 5.15.14(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(react@18.3.1) '@mui/styled-engine': 5.15.14(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@emotion/styled@11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1))(react@18.3.1)
'@mui/types': 7.2.14(@types/react@18.3.3) '@mui/types': 7.2.14(@types/react@18.3.3)
'@mui/utils': 5.15.20(@types/react@18.3.3)(react@18.3.1) '@mui/utils': 5.15.20(@types/react@18.3.3)(react@18.3.1)
'@types/react': 18.3.3
clsx: 2.1.1 clsx: 2.1.1
csstype: 3.1.3 csstype: 3.1.3
prop-types: 15.8.1 prop-types: 15.8.1
react: 18.3.1 react: 18.3.1
optionalDependencies:
'@emotion/react': 11.11.4(@types/react@18.3.3)(react@18.3.1)
'@emotion/styled': 11.11.5(@emotion/react@11.11.4(@types/react@18.3.3)(react@18.3.1))(@types/react@18.3.3)(react@18.3.1)
'@types/react': 18.3.3
'@mui/types@7.2.14(@types/react@18.3.3)': '@mui/types@7.2.14(@types/react@18.3.3)':
dependencies: optionalDependencies:
'@types/react': 18.3.3 '@types/react': 18.3.3
'@mui/utils@5.15.20(@types/react@18.3.3)(react@18.3.1)': '@mui/utils@5.15.20(@types/react@18.3.3)(react@18.3.1)':
dependencies: dependencies:
'@babel/runtime': 7.24.7 '@babel/runtime': 7.24.7
'@types/prop-types': 15.7.12 '@types/prop-types': 15.7.12
'@types/react': 18.3.3
prop-types: 15.8.1 prop-types: 15.8.1
react: 18.3.1 react: 18.3.1
react-is: 18.3.1 react-is: 18.3.1
optionalDependencies:
'@types/react': 18.3.3
'@nodelib/fs.scandir@2.1.5': '@nodelib/fs.scandir@2.1.5':
dependencies: dependencies:
@ -4029,7 +4046,7 @@ snapshots:
'@ungap/structured-clone@1.2.0': {} '@ungap/structured-clone@1.2.0': {}
'@vitejs/plugin-react@4.3.1(vite@5.2.13)': '@vitejs/plugin-react@4.3.1(vite@5.2.13(sass@1.77.6))':
dependencies: dependencies:
'@babel/core': 7.24.7 '@babel/core': 7.24.7
'@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/core@7.24.7) '@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/core@7.24.7)
@ -4149,12 +4166,12 @@ snapshots:
astring@1.8.6: {} astring@1.8.6: {}
astro-expressive-code@0.35.3(astro@4.10.2): astro-expressive-code@0.35.3(astro@4.10.2(sass@1.77.6)(typescript@5.4.5)):
dependencies: dependencies:
astro: 4.10.2(sass@1.77.6)(typescript@5.4.5) astro: 4.10.2(sass@1.77.6)(typescript@5.4.5)
rehype-expressive-code: 0.35.3 rehype-expressive-code: 0.35.3
astro-integration-kit@0.13.3(astro@4.10.2): astro-integration-kit@0.13.3(astro@4.10.2(sass@1.77.6)(typescript@5.4.5)):
dependencies: dependencies:
astro: 4.10.2(sass@1.77.6)(typescript@5.4.5) astro: 4.10.2(sass@1.77.6)(typescript@5.4.5)
pathe: 1.1.2 pathe: 1.1.2
@ -4220,7 +4237,7 @@ snapshots:
unist-util-visit: 5.0.0 unist-util-visit: 5.0.0
vfile: 6.0.1 vfile: 6.0.1
vite: 5.2.13(sass@1.77.6) vite: 5.2.13(sass@1.77.6)
vitefu: 0.2.5(vite@5.2.13) vitefu: 0.2.5(vite@5.2.13(sass@1.77.6))
which-pm: 2.2.0 which-pm: 2.2.0
yargs-parser: 21.1.1 yargs-parser: 21.1.1
zod: 3.23.8 zod: 3.23.8
@ -5780,7 +5797,7 @@ snapshots:
react-refresh@0.14.2: {} react-refresh@0.14.2: {}
react-transition-group@4.4.5(react-dom@18.3.1)(react@18.3.1): react-transition-group@4.4.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
dependencies: dependencies:
'@babel/runtime': 7.24.7 '@babel/runtime': 7.24.7
dom-helpers: 5.2.1 dom-helpers: 5.2.1
@ -6129,9 +6146,9 @@ snapshots:
sprintf-js@1.0.3: {} sprintf-js@1.0.3: {}
starlight-links-validator@0.7.1(@astrojs/starlight@0.24.2)(astro@4.10.2): starlight-links-validator@0.7.1(@astrojs/starlight@0.24.2(astro@4.10.2(sass@1.77.6)(typescript@5.4.5)))(astro@4.10.2(sass@1.77.6)(typescript@5.4.5)):
dependencies: dependencies:
'@astrojs/starlight': 0.24.2(astro@4.10.2) '@astrojs/starlight': 0.24.2(astro@4.10.2(sass@1.77.6)(typescript@5.4.5))
astro: 4.10.2(sass@1.77.6)(typescript@5.4.5) astro: 4.10.2(sass@1.77.6)(typescript@5.4.5)
github-slugger: 2.0.0 github-slugger: 2.0.0
hast-util-from-html: 2.0.1 hast-util-from-html: 2.0.1
@ -6262,7 +6279,7 @@ snapshots:
trough@2.2.0: {} trough@2.2.0: {}
tsconfck@3.1.0(typescript@5.4.5): tsconfck@3.1.0(typescript@5.4.5):
dependencies: optionalDependencies:
typescript: 5.4.5 typescript: 5.4.5
tslib@2.6.3: {} tslib@2.6.3: {}
@ -6420,57 +6437,66 @@ snapshots:
unist-util-stringify-position: 4.0.0 unist-util-stringify-position: 4.0.0
vfile-message: 4.0.2 vfile-message: 4.0.2
vite-plugin-wasm@3.3.0(vite@5.2.13(sass@1.77.6)):
dependencies:
vite: 5.2.13(sass@1.77.6)
vite@5.2.13(sass@1.77.6): vite@5.2.13(sass@1.77.6):
dependencies: dependencies:
esbuild: 0.20.2 esbuild: 0.20.2
postcss: 8.4.38 postcss: 8.4.38
rollup: 4.18.0 rollup: 4.18.0
sass: 1.77.6
optionalDependencies: optionalDependencies:
fsevents: 2.3.3 fsevents: 2.3.3
sass: 1.77.6
vitefu@0.2.5(vite@5.2.13): vitefu@0.2.5(vite@5.2.13(sass@1.77.6)):
dependencies: optionalDependencies:
vite: 5.2.13(sass@1.77.6) vite: 5.2.13(sass@1.77.6)
volar-service-css@0.0.45(@volar/language-service@2.2.5): volar-service-css@0.0.45(@volar/language-service@2.2.5):
dependencies: dependencies:
'@volar/language-service': 2.2.5
vscode-css-languageservice: 6.2.14 vscode-css-languageservice: 6.2.14
vscode-languageserver-textdocument: 1.0.11 vscode-languageserver-textdocument: 1.0.11
vscode-uri: 3.0.8 vscode-uri: 3.0.8
optionalDependencies:
'@volar/language-service': 2.2.5
volar-service-emmet@0.0.45(@volar/language-service@2.2.5): volar-service-emmet@0.0.45(@volar/language-service@2.2.5):
dependencies: dependencies:
'@emmetio/css-parser': 0.4.0 '@emmetio/css-parser': 0.4.0
'@emmetio/html-matcher': 1.3.0 '@emmetio/html-matcher': 1.3.0
'@volar/language-service': 2.2.5
'@vscode/emmet-helper': 2.9.3 '@vscode/emmet-helper': 2.9.3
optionalDependencies:
'@volar/language-service': 2.2.5
volar-service-html@0.0.45(@volar/language-service@2.2.5): volar-service-html@0.0.45(@volar/language-service@2.2.5):
dependencies: dependencies:
'@volar/language-service': 2.2.5
vscode-html-languageservice: '@johnsoncodehk/vscode-html-languageservice@5.2.0-34a5462' vscode-html-languageservice: '@johnsoncodehk/vscode-html-languageservice@5.2.0-34a5462'
vscode-languageserver-textdocument: 1.0.11 vscode-languageserver-textdocument: 1.0.11
vscode-uri: 3.0.8 vscode-uri: 3.0.8
optionalDependencies:
'@volar/language-service': 2.2.5
volar-service-prettier@0.0.45(@volar/language-service@2.2.5): volar-service-prettier@0.0.45(@volar/language-service@2.2.5):
dependencies: dependencies:
'@volar/language-service': 2.2.5
vscode-uri: 3.0.8 vscode-uri: 3.0.8
optionalDependencies:
'@volar/language-service': 2.2.5
volar-service-typescript-twoslash-queries@0.0.45(@volar/language-service@2.2.5): volar-service-typescript-twoslash-queries@0.0.45(@volar/language-service@2.2.5):
dependencies: optionalDependencies:
'@volar/language-service': 2.2.5 '@volar/language-service': 2.2.5
volar-service-typescript@0.0.45(@volar/language-service@2.2.5): volar-service-typescript@0.0.45(@volar/language-service@2.2.5):
dependencies: dependencies:
'@volar/language-service': 2.2.5
path-browserify: 1.0.1 path-browserify: 1.0.1
semver: 7.6.2 semver: 7.6.2
typescript-auto-import-cache: 0.3.2 typescript-auto-import-cache: 0.3.2
vscode-languageserver-textdocument: 1.0.11 vscode-languageserver-textdocument: 1.0.11
vscode-nls: 5.2.0 vscode-nls: 5.2.0
optionalDependencies:
'@volar/language-service': 2.2.5
vscode-css-languageservice@6.2.14: vscode-css-languageservice@6.2.14:
dependencies: dependencies:

View File

@ -7,7 +7,7 @@ import FileView from "./playground/FileView";
import Editor from "./playground/Editor"; import Editor from "./playground/Editor";
import Header from "./playground/Header"; import Header from "./playground/Header";
import initWasm, { import {
compile, compile,
compileZip, compileZip,
} from "@wasm/webcompiler/pkg/webcompiler"; } from "@wasm/webcompiler/pkg/webcompiler";
@ -52,10 +52,6 @@ export default function Playground({ lang }: { lang: PlaygroundLang }) {
}; };
}, []); }, []);
initWasm().catch((err) => {
console.error(err);
});
const [rootDir, updateRootDir] = useImmer( const [rootDir, updateRootDir] = useImmer(
getStorageOrDefault(FILE_STORAGE_KEY, DEFAULT_FILES) as Directory getStorageOrDefault(FILE_STORAGE_KEY, DEFAULT_FILES) as Directory
); );

View File

@ -54,6 +54,12 @@ version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.0" version = "1.0.0"
@ -112,7 +118,7 @@ version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 1.0.0",
"wasm-bindgen", "wasm-bindgen",
] ]
@ -122,7 +128,7 @@ version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 1.0.0",
] ]
[[package]] [[package]]
@ -271,6 +277,12 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
version = "0.2.159"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
[[package]] [[package]]
name = "lockfree-object-pool" name = "lockfree-object-pool"
version = "0.1.6" version = "0.1.6"
@ -289,6 +301,12 @@ version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "memory_units"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3"
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.8.0" version = "0.8.0"
@ -467,6 +485,15 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "serde_spanned"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "shulkerbox" name = "shulkerbox"
version = "0.1.0" version = "0.1.0"
@ -566,6 +593,40 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "toml"
version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.22.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]] [[package]]
name = "tracing" name = "tracing"
version = "0.1.40" version = "0.1.40"
@ -609,7 +670,7 @@ version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
dependencies = [ dependencies = [
"cfg-if", "cfg-if 1.0.0",
"once_cell", "once_cell",
"wasm-bindgen-macro", "wasm-bindgen-macro",
] ]
@ -665,15 +726,52 @@ dependencies = [
"ansi-to-html", "ansi-to-html",
"anyhow", "anyhow",
"base64", "base64",
"cfg-if 1.0.0",
"colored", "colored",
"console_error_panic_hook", "console_error_panic_hook",
"serde", "serde",
"serde-wasm-bindgen", "serde-wasm-bindgen",
"shulkerscript", "shulkerscript",
"toml",
"wasm-bindgen", "wasm-bindgen",
"wee_alloc",
"zip", "zip",
] ]
[[package]]
name = "wee_alloc"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e"
dependencies = [
"cfg-if 0.1.10",
"libc",
"memory_units",
"winapi",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.48.0" version = "0.48.0"
@ -740,6 +838,15 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "winnow"
version = "0.6.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "zip" name = "zip"
version = "2.2.0" version = "2.2.0"

View File

@ -7,7 +7,10 @@ edition = "2021"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[profile.release] [profile.release]
opt-level = "s" opt-level = "z"
[features]
wee_alloc = ["dep:wee_alloc"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -15,11 +18,13 @@ opt-level = "s"
ansi-to-html = "0.2.1" ansi-to-html = "0.2.1"
anyhow = "1.0.86" anyhow = "1.0.86"
base64 = "0.22.1" base64 = "0.22.1"
cfg-if = "1.0.0"
colored = "2.1.0" colored = "2.1.0"
console_error_panic_hook = "0.1.7" console_error_panic_hook = "0.1.7"
serde = "1.0" serde = "1.0"
serde-wasm-bindgen = "0.6.5" serde-wasm-bindgen = "0.6.5"
shulkerscript = { git = "https://github.com/moritz-hoelting/shulkerscript-lang.git", default-features = false, features = ["serde", "shulkerbox"], rev = "a9a8aff13b0ad0986ee1bdf3d44b74676385dfcd" } shulkerscript = { git = "https://github.com/moritz-hoelting/shulkerscript-lang.git", default-features = false, features = ["serde", "shulkerbox"], rev = "a9a8aff13b0ad0986ee1bdf3d44b74676385dfcd" }
toml = "0.8.19" toml = "0.8.19"
wasm-bindgen = "0.2.92" wasm-bindgen = "0.2.93"
wee_alloc = { version = "0.4.5", optional = true }
zip = { version = "2.1.3", default-features = false, features = ["deflate"] } zip = { version = "2.1.3", default-features = false, features = ["deflate"] }

View File

@ -18,6 +18,13 @@ use zip::{write::SimpleFileOptions, ZipWriter};
mod fs; mod fs;
mod pack_toml; mod pack_toml;
cfg_if::cfg_if! {
if #[cfg(feature = "wee_alloc")] {
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
}
}
#[wasm_bindgen] #[wasm_bindgen]
extern "C" { extern "C" {
#[wasm_bindgen(js_namespace = console)] #[wasm_bindgen(js_namespace = console)]