Skip to content

Commit 3e7235a

Browse files
Merge pull request #506 from gridaco/canary
emsdk 5.0.0
2 parents 37c0fec + f9d1423 commit 3e7235a

File tree

12 files changed

+38
-99
lines changed

12 files changed

+38
-99
lines changed

.github/workflows/build-canvas.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77
- main
88
pull_request:
99
paths:
10-
- ".github/workflows/*"
11-
- "crates/*"
10+
- ".github/workflows/**"
11+
- "crates/**"
1212

1313
concurrency:
1414
group: ${{ github.workflow }}-${{ github.ref }}

.github/workflows/test-crates.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
- main
77
pull_request:
88
paths:
9-
- ".github/workflows/*"
10-
- "crates/*"
9+
- ".github/workflows/**"
10+
- "crates/**"
1111

1212
concurrency:
1313
group: ${{ github.workflow }}-${{ github.ref }}

bin/activate-emsdk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ EMSDK_ROOT = os.path.join('third_party', 'externals', 'emsdk')
1414

1515
EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py')
1616

17-
# This should match what's in //MODULE.bazel
18-
EMSDK_VERSION = '4.0.7'
17+
# Keep this aligned with the emsdk submodule and local builds.
18+
# (The emsdk git submodule is currently at 5.0.0.)
19+
EMSDK_VERSION = '5.0.0'
1920

2021
def main():
2122
if sysconfig.get_platform() in ['linux-aarch64', 'linux-arm64']:

crates/grida-canvas-wasm/.cargo/config.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ rustflags = [
3737
# Allow undefined symbols (useful for dynamic linking and Skia integration)
3838
"-C",
3939
"link-arg=-sERROR_ON_UNDEFINED_SYMBOLS=0",
40-
# Currently only targeting web (fs=false)
4140
# Target both web (browser) and Node.js.
4241
# NOTE: this affects the generated Emscripten JS glue (loader/runtime selection).
4342
"-C",

crates/grida-canvas-wasm/AGENTS.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,16 @@ Note: the artifacts are git included for faster CI builds.
1414

1515
When building the WASM glue with `-sENVIRONMENT=web,node`, Emscripten emits a Node-only branch that uses Node built-ins (`fs`, `path`, sometimes `crypto`). Some bundlers (notably **Next.js Turbopack**) will still try to resolve those built-ins when the module is imported from a Client Component and fail with **"Can't resolve 'fs'"**.
1616

17-
We keep a **single package** that works in both browser and Node by combining three measures:
18-
19-
- **Patch Emscripten glue to use `node:*` built-ins**
20-
- Script: `scripts/prebuild-patch-emscripten-js-glue.cjs`
21-
- Patched file: `lib/bin/grida-canvas-wasm.js`
22-
- Rewrites `require("fs")``require("node:fs")`, `require("path")``require("node:path")`, `require("crypto")``require("node:crypto")`
23-
- Reference issue: `https://github.com/emscripten-core/emscripten/issues/26134`
17+
We keep a **single package** that works in both browser and Node by ensuring the Emscripten glue is not bundled into `dist/index.*`:
2418

2519
- **Do NOT bundle the Emscripten glue into `dist/index.*`**
2620
- `lib/index.ts` imports `./grida-canvas-wasm` (a thin wrapper)
2721
- Wrapper: `lib/grida-canvas-wasm.ts` imports `./bin/grida-canvas-wasm`
2822
- `tsup.config.ts` sets `external: ["./grida-canvas-wasm"]` and copies `lib/bin/*` via `publicDir`
2923
- Result: `dist/index.js` only imports `./grida-canvas-wasm`, and the actual glue stays as `dist/grida-canvas-wasm.js` (copied), so Turbopack never sees Node built-ins inside the bundled entry.
3024

31-
- **Run the glue patch before bundling**
32-
- `package.json` uses `prebuild` to patch `lib/bin/grida-canvas-wasm.js` before `tsup` runs.
33-
3425
⚠️ Notes:
35-
- Simply setting `tsup.external` to `["node:fs", "node:path", ...]` is **not sufficient** here; bundling the glue can still produce `require("fs")` in `dist/index.js`, which breaks Turbopack.
26+
- Simply setting `tsup.external` to `["node:fs", "node:path", ...]` is **not sufficient** here; bundling the glue can still produce Node built-in imports in `dist/index.js`, which breaks Turbopack.
3627
- If you change `lib/index.ts` to import `./bin/grida-canvas-wasm` directly (no wrapper + external), re-verify `pnpm --filter editor build` with Turbopack.
3728

3829
## Build System

crates/grida-canvas-wasm/lib/bin/grida-canvas-wasm.js

Lines changed: 21 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:efe80841ff082eae434cad346ece1ad6d91fa10fc4ae3e0a7a400cf13c88c3c8
3-
size 12868264
2+
oid sha256:16bc581263902e9085c4275cad54587f8018f81e1f63e74c667adb09b9b92b6a
3+
size 12867497

crates/grida-canvas-wasm/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grida/canvas-wasm",
3-
"version": "0.90.0-canary.0",
3+
"version": "0.90.0-canary.2",
44
"private": false,
55
"description": "WASM bindings for Grida Canvas",
66
"keywords": [
@@ -21,7 +21,6 @@
2121
"main": "dist/index.js",
2222
"scripts": {
2323
"build": "tsup",
24-
"prebuild": "node ./scripts/prebuild-patch-emscripten-js-glue.cjs",
2524
"dev": "tsup --watch",
2625
"serve": "serve -p 4020",
2726
"test": "vitest run",

crates/grida-canvas-wasm/scripts/prebuild-patch-emscripten-js-glue.cjs

Lines changed: 0 additions & 64 deletions
This file was deleted.

crates/grida-canvas/src/io/io_grida.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,9 +1206,6 @@ pub struct JSONBooleanOperationNode {
12061206
fn default_active() -> bool {
12071207
true
12081208
}
1209-
fn default_locked() -> bool {
1210-
false
1211-
}
12121209
fn default_false() -> bool {
12131210
false
12141211
}
@@ -1218,10 +1215,6 @@ fn default_opacity() -> f32 {
12181215
fn default_rotation() -> f32 {
12191216
0.0
12201217
}
1221-
fn default_z_index() -> i32 {
1222-
0
1223-
}
1224-
12251218
fn default_stroke_width() -> f32 {
12261219
0.0
12271220
}

0 commit comments

Comments
 (0)