@reearth/ezu 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,7 +14,7 @@ npm install @reearth/ezu
14
14
 
15
15
  ## Usage
16
16
 
17
- The package ships three builds and picks one automatically via the
17
+ The package ships four builds and picks one automatically via the
18
18
  `exports` map:
19
19
 
20
20
  | Runtime | Build used |
@@ -22,7 +22,7 @@ The package ships three builds and picks one automatically via the
22
22
  | Vite / Webpack / Rollup | `bundler` |
23
23
  | Browser (native ESM) | `web` |
24
24
  | Node.js | `nodejs` |
25
- | Cloudflare Workers | `bundler` (via `workerd` condition) |
25
+ | Cloudflare Workers | `workerd` (via the `workerd` condition) |
26
26
 
27
27
  ### Bundler / Cloudflare Workers / Node.js
28
28
 
@@ -47,7 +47,18 @@ const renderer = new Renderer(styleJson);
47
47
  ### Explicit build selection
48
48
 
49
49
  If the auto-resolved entry doesn't fit your toolchain, import a build
50
- directly: `@reearth/ezu/web`, `@reearth/ezu/bundler`, or `@reearth/ezu/nodejs`.
50
+ directly: `@reearth/ezu/web`, `@reearth/ezu/bundler`, `@reearth/ezu/nodejs`,
51
+ or `@reearth/ezu/workerd`.
52
+
53
+ `workerd` reuses the `bundler` glue but instantiates the wasm itself,
54
+ because Cloudflare Workers resolve a `.wasm` import to an uninstantiated
55
+ `WebAssembly.Module` rather than to live exports. Importing
56
+ `@reearth/ezu/bundler` on Workers therefore fails with
57
+ `__wbindgen_start is not a function`.
58
+
59
+ The raw artifacts are exported too, for hosts that need to wire up
60
+ instantiation themselves: `@reearth/ezu/bundler/ezu_bg.js`,
61
+ `@reearth/ezu/bundler/ezu_bg.wasm`, and `@reearth/ezu/web/ezu_bg.wasm`.
51
62
 
52
63
  ## API
53
64
 
package/bundler/ezu.d.ts CHANGED
@@ -38,6 +38,10 @@ export class LogSink {
38
38
  /**
39
39
  * Set (or clear with `null` / `undefined`) the per-event JS
40
40
  * callback. The callback receives a structured record object.
41
+ *
42
+ * No-op in multithreaded (`threads`) builds — events can originate
43
+ * on rayon worker threads, so live forwarding to a main-thread JS
44
+ * callback isn't available. Use `drain` / `drainLines` instead.
41
45
  */
42
46
  onEvent(callback?: Function | null): void;
43
47
  /**
@@ -61,11 +65,16 @@ export class Renderer {
61
65
  * Bind raw tile bytes under a `sources.<name>` entry from the style.
62
66
  * The renderer dispatches on the source's declared `type`:
63
67
  *
64
- * - `mvt` / `pmtiles` → decode MVT layers eagerly; layers are bound
65
- * as `tile.<layer>` when [`render_tile`] runs.
66
- * - `dem` → store the raw raster-DEM bytes per `(dx, dy)` neighbour
68
+ * - `mvt` / `pmtiles` → store raw MVT bytes per `(dx, dy)` neighbour
69
+ * offset (centre `coord: [0, 0]`, the default). Layers are bound as
70
+ * `<source>.<layer>` (centre) or `<source>.<layer>@dx,dy`
71
+ * (neighbours) when [`render_tile`] runs. Binding only the centre
72
+ * degrades cross-tile label collision to centre-only at borders.
73
+ * - `dem` / `raster` → store the raw bytes per `(dx, dy)` neighbour
67
74
  * offset. The centre tile is `coord: [0, 0]` (default). Decoding
68
75
  * and 3×3 stitching happen at render time once the tile id is known.
76
+ * - `geojson` (remote) → store raw bytes per `(dx, dy)` offset;
77
+ * projected per tile (and neighbour) at render time.
69
78
  *
70
79
  * `opts` is a JS object: `{ coord?: [dx, dy] }`. Throws
71
80
  * `UnknownSource` if `name` doesn't match any entry in the style's
@@ -83,6 +92,28 @@ export class Renderer {
83
92
  * Drop every pending source binding. Call between tile renders.
84
93
  */
85
94
  clearSources(): void;
95
+ /**
96
+ * Glyph ranges the currently bound features can require, as
97
+ * `{ [glyphsSourceName]: number[] }` where each number is a range
98
+ * start (`0`, `256`, `512`, …) — i.e. the `{range}` in a
99
+ * `…/{fontstack}/{range}.pbf` URL is `<start>-<start + 255>`.
100
+ *
101
+ * This host cannot fetch glyph ranges lazily, so every range a
102
+ * tile's labels touch must be bound before `renderTile`. Rather than
103
+ * scraping every string in the MVT, call this after binding the
104
+ * vector sources and bind exactly the listed ranges.
105
+ *
106
+ * It is an over-approximation, deliberately: a range is listed if
107
+ * *any* feature in a text layer carries the codepoint in a property
108
+ * the layer's `text` expression reads, without evaluating filters,
109
+ * zoom ranges, or the expression itself, and it is listed for every
110
+ * fontstack in that layer's fallback chain. So it never omits a
111
+ * range a label needs, and it may name a few that go unused. Text
112
+ * layers that build their string from something other than a `get`
113
+ * of a feature property (a literal, a `concat` of formatted values)
114
+ * contribute their literal text where it is a plain string.
115
+ */
116
+ neededGlyphRanges(): object;
86
117
  /**
87
118
  * Build a renderer from a style JSON document.
88
119
  */
@@ -97,11 +128,33 @@ export class Renderer {
97
128
  * - `png`: `{ compression?: "fast" | "default" | "best" }`
98
129
  */
99
130
  renderTile(z: number, x: number, y: number, opts?: object | null): Uint8Array;
131
+ /**
132
+ * Neighbour tile offsets the active style actually asks for from
133
+ * `source`, as an array of `[dx, dy]` pairs (never including the
134
+ * centre `[0, 0]`).
135
+ *
136
+ * Cross-tile label collision and edge-continuous DEM shading are the
137
+ * only things that read neighbours, and only for the sources they
138
+ * name. A host that fetches the full 3×3 window unconditionally
139
+ * therefore pays for up to eight tiles it will not look at; passing
140
+ * each offset from this list to `bindSource(name, bytes, { coord })`
141
+ * fetches exactly what the recipe needs. An empty array means the
142
+ * centre tile is enough.
143
+ *
144
+ * Throws `UnknownSource` if `name` is not declared in the style.
145
+ */
146
+ requestedNeighborOffsets(name: string): Array<any>;
100
147
  /**
101
148
  * Replace the active style. Returns the new node count. Invalidates
102
149
  * the intermediate cache and drops any pending source bindings.
103
150
  */
104
151
  setStyle(style_json: string): number;
152
+ /**
153
+ * Effective attribution declared by the style (document +
154
+ * sources), joined with ` | `. Upstream TileJSON / PMTiles
155
+ * metadata is the JS host's concern — merge it on that side.
156
+ */
157
+ readonly attribution: string | undefined;
105
158
  /**
106
159
  * `tile-size` declared by the current style.
107
160
  */
@@ -113,3 +166,11 @@ export class Renderer {
113
166
  * page label the renderer build accurately.
114
167
  */
115
168
  export function simdEnabled(): boolean;
169
+
170
+ /**
171
+ * Whether this build supports multithreaded rendering (compiled with
172
+ * the `threads` feature). When `false`, `initThreadPool` is absent and
173
+ * `renderTile`'s `parallel` option is a no-op. Mirrors `simdEnabled` so
174
+ * the host can label the build.
175
+ */
176
+ export function threadsEnabled(): boolean;
package/bundler/ezu.js CHANGED
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./ezu_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
8
- LogSink, Renderer, simdEnabled
8
+ LogSink, Renderer, simdEnabled, threadsEnabled
9
9
  } from "./ezu_bg.js";
package/bundler/ezu_bg.js CHANGED
@@ -78,6 +78,10 @@ export class LogSink {
78
78
  /**
79
79
  * Set (or clear with `null` / `undefined`) the per-event JS
80
80
  * callback. The callback receives a structured record object.
81
+ *
82
+ * No-op in multithreaded (`threads`) builds — events can originate
83
+ * on rayon worker threads, so live forwarding to a main-thread JS
84
+ * callback isn't available. Use `drain` / `drainLines` instead.
81
85
  * @param {Function | null} [callback]
82
86
  */
83
87
  onEvent(callback) {
@@ -108,15 +112,35 @@ export class Renderer {
108
112
  const ptr = this.__destroy_into_raw();
109
113
  wasm.__wbg_renderer_free(ptr, 0);
110
114
  }
115
+ /**
116
+ * Effective attribution declared by the style (document +
117
+ * sources), joined with ` | `. Upstream TileJSON / PMTiles
118
+ * metadata is the JS host's concern — merge it on that side.
119
+ * @returns {string | undefined}
120
+ */
121
+ get attribution() {
122
+ const ret = wasm.renderer_attribution(this.__wbg_ptr);
123
+ let v1;
124
+ if (ret[0] !== 0) {
125
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
126
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
127
+ }
128
+ return v1;
129
+ }
111
130
  /**
112
131
  * Bind raw tile bytes under a `sources.<name>` entry from the style.
113
132
  * The renderer dispatches on the source's declared `type`:
114
133
  *
115
- * - `mvt` / `pmtiles` → decode MVT layers eagerly; layers are bound
116
- * as `tile.<layer>` when [`render_tile`] runs.
117
- * - `dem` → store the raw raster-DEM bytes per `(dx, dy)` neighbour
134
+ * - `mvt` / `pmtiles` → store raw MVT bytes per `(dx, dy)` neighbour
135
+ * offset (centre `coord: [0, 0]`, the default). Layers are bound as
136
+ * `<source>.<layer>` (centre) or `<source>.<layer>@dx,dy`
137
+ * (neighbours) when [`render_tile`] runs. Binding only the centre
138
+ * degrades cross-tile label collision to centre-only at borders.
139
+ * - `dem` / `raster` → store the raw bytes per `(dx, dy)` neighbour
118
140
  * offset. The centre tile is `coord: [0, 0]` (default). Decoding
119
141
  * and 3×3 stitching happen at render time once the tile id is known.
142
+ * - `geojson` (remote) → store raw bytes per `(dx, dy)` offset;
143
+ * projected per tile (and neighbour) at render time.
120
144
  *
121
145
  * `opts` is a JS object: `{ coord?: [dx, dy] }`. Throws
122
146
  * `UnknownSource` if `name` doesn't match any entry in the style's
@@ -154,6 +178,35 @@ export class Renderer {
154
178
  clearSources() {
155
179
  wasm.renderer_clearSources(this.__wbg_ptr);
156
180
  }
181
+ /**
182
+ * Glyph ranges the currently bound features can require, as
183
+ * `{ [glyphsSourceName]: number[] }` where each number is a range
184
+ * start (`0`, `256`, `512`, …) — i.e. the `{range}` in a
185
+ * `…/{fontstack}/{range}.pbf` URL is `<start>-<start + 255>`.
186
+ *
187
+ * This host cannot fetch glyph ranges lazily, so every range a
188
+ * tile's labels touch must be bound before `renderTile`. Rather than
189
+ * scraping every string in the MVT, call this after binding the
190
+ * vector sources and bind exactly the listed ranges.
191
+ *
192
+ * It is an over-approximation, deliberately: a range is listed if
193
+ * *any* feature in a text layer carries the codepoint in a property
194
+ * the layer's `text` expression reads, without evaluating filters,
195
+ * zoom ranges, or the expression itself, and it is listed for every
196
+ * fontstack in that layer's fallback chain. So it never omits a
197
+ * range a label needs, and it may name a few that go unused. Text
198
+ * layers that build their string from something other than a `get`
199
+ * of a feature property (a literal, a `concat` of formatted values)
200
+ * contribute their literal text where it is a plain string.
201
+ * @returns {object}
202
+ */
203
+ neededGlyphRanges() {
204
+ const ret = wasm.renderer_neededGlyphRanges(this.__wbg_ptr);
205
+ if (ret[2]) {
206
+ throw takeFromExternrefTable0(ret[1]);
207
+ }
208
+ return takeFromExternrefTable0(ret[0]);
209
+ }
157
210
  /**
158
211
  * Build a renderer from a style JSON document.
159
212
  * @param {string} style_json
@@ -192,6 +245,32 @@ export class Renderer {
192
245
  wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
193
246
  return v1;
194
247
  }
248
+ /**
249
+ * Neighbour tile offsets the active style actually asks for from
250
+ * `source`, as an array of `[dx, dy]` pairs (never including the
251
+ * centre `[0, 0]`).
252
+ *
253
+ * Cross-tile label collision and edge-continuous DEM shading are the
254
+ * only things that read neighbours, and only for the sources they
255
+ * name. A host that fetches the full 3×3 window unconditionally
256
+ * therefore pays for up to eight tiles it will not look at; passing
257
+ * each offset from this list to `bindSource(name, bytes, { coord })`
258
+ * fetches exactly what the recipe needs. An empty array means the
259
+ * centre tile is enough.
260
+ *
261
+ * Throws `UnknownSource` if `name` is not declared in the style.
262
+ * @param {string} name
263
+ * @returns {Array<any>}
264
+ */
265
+ requestedNeighborOffsets(name) {
266
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
267
+ const len0 = WASM_VECTOR_LEN;
268
+ const ret = wasm.renderer_requestedNeighborOffsets(this.__wbg_ptr, ptr0, len0);
269
+ if (ret[2]) {
270
+ throw takeFromExternrefTable0(ret[1]);
271
+ }
272
+ return takeFromExternrefTable0(ret[0]);
273
+ }
195
274
  /**
196
275
  * Replace the active style. Returns the new node count. Invalidates
197
276
  * the intermediate cache and drops any pending source bindings.
@@ -227,6 +306,23 @@ export function simdEnabled() {
227
306
  const ret = wasm.simdEnabled();
228
307
  return ret !== 0;
229
308
  }
309
+
310
+ /**
311
+ * Whether this build supports multithreaded rendering (compiled with
312
+ * the `threads` feature). When `false`, `initThreadPool` is absent and
313
+ * `renderTile`'s `parallel` option is a no-op. Mirrors `simdEnabled` so
314
+ * the host can label the build.
315
+ * @returns {boolean}
316
+ */
317
+ export function threadsEnabled() {
318
+ const ret = wasm.threadsEnabled();
319
+ return ret !== 0;
320
+ }
321
+ export function __wbg___wbindgen_boolean_get_2304fb8c853028c8(arg0) {
322
+ const v = arg0;
323
+ const ret = typeof(v) === 'boolean' ? v : undefined;
324
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
325
+ }
230
326
  export function __wbg___wbindgen_is_null_2042690d351e14f0(arg0) {
231
327
  const ret = arg0 === null;
232
328
  return ret;
@@ -241,6 +337,9 @@ export function __wbg___wbindgen_number_get_f73a1244370fcc2c(arg0, arg1) {
241
337
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
242
338
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
243
339
  }
340
+ export function __wbg___wbindgen_rethrow_2b7cc655458909c2(arg0) {
341
+ throw arg0;
342
+ }
244
343
  export function __wbg___wbindgen_string_get_d109740c0d18f4d7(arg0, arg1) {
245
344
  const obj = arg1;
246
345
  const ret = typeof(obj) === 'string' ? obj : undefined;
Binary file
@@ -11,14 +11,18 @@ export const logsink_len: (a: number) => number;
11
11
  export const logsink_new: (a: number, b: number) => [number, number, number];
12
12
  export const logsink_onEvent: (a: number, b: number) => void;
13
13
  export const logsink_setCapacity: (a: number, b: number) => void;
14
+ export const renderer_attribution: (a: number) => [number, number];
14
15
  export const renderer_bindSource: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
15
16
  export const renderer_boundSources: (a: number) => [number, number];
16
17
  export const renderer_clearSources: (a: number) => void;
18
+ export const renderer_neededGlyphRanges: (a: number) => [number, number, number];
17
19
  export const renderer_new: (a: number, b: number) => [number, number, number];
18
20
  export const renderer_renderTile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
21
+ export const renderer_requestedNeighborOffsets: (a: number, b: number, c: number) => [number, number, number];
19
22
  export const renderer_setStyle: (a: number, b: number, c: number) => [number, number, number];
20
23
  export const renderer_tileSize: (a: number) => number;
21
24
  export const simdEnabled: () => number;
25
+ export const threadsEnabled: () => number;
22
26
  export const __wbindgen_malloc_command_export: (a: number, b: number) => number;
23
27
  export const __wbindgen_realloc_command_export: (a: number, b: number, c: number, d: number) => number;
24
28
  export const __wbindgen_exn_store_command_export: (a: number) => void;
package/nodejs/ezu.d.ts CHANGED
@@ -38,6 +38,10 @@ export class LogSink {
38
38
  /**
39
39
  * Set (or clear with `null` / `undefined`) the per-event JS
40
40
  * callback. The callback receives a structured record object.
41
+ *
42
+ * No-op in multithreaded (`threads`) builds — events can originate
43
+ * on rayon worker threads, so live forwarding to a main-thread JS
44
+ * callback isn't available. Use `drain` / `drainLines` instead.
41
45
  */
42
46
  onEvent(callback?: Function | null): void;
43
47
  /**
@@ -61,11 +65,16 @@ export class Renderer {
61
65
  * Bind raw tile bytes under a `sources.<name>` entry from the style.
62
66
  * The renderer dispatches on the source's declared `type`:
63
67
  *
64
- * - `mvt` / `pmtiles` → decode MVT layers eagerly; layers are bound
65
- * as `tile.<layer>` when [`render_tile`] runs.
66
- * - `dem` → store the raw raster-DEM bytes per `(dx, dy)` neighbour
68
+ * - `mvt` / `pmtiles` → store raw MVT bytes per `(dx, dy)` neighbour
69
+ * offset (centre `coord: [0, 0]`, the default). Layers are bound as
70
+ * `<source>.<layer>` (centre) or `<source>.<layer>@dx,dy`
71
+ * (neighbours) when [`render_tile`] runs. Binding only the centre
72
+ * degrades cross-tile label collision to centre-only at borders.
73
+ * - `dem` / `raster` → store the raw bytes per `(dx, dy)` neighbour
67
74
  * offset. The centre tile is `coord: [0, 0]` (default). Decoding
68
75
  * and 3×3 stitching happen at render time once the tile id is known.
76
+ * - `geojson` (remote) → store raw bytes per `(dx, dy)` offset;
77
+ * projected per tile (and neighbour) at render time.
69
78
  *
70
79
  * `opts` is a JS object: `{ coord?: [dx, dy] }`. Throws
71
80
  * `UnknownSource` if `name` doesn't match any entry in the style's
@@ -83,6 +92,28 @@ export class Renderer {
83
92
  * Drop every pending source binding. Call between tile renders.
84
93
  */
85
94
  clearSources(): void;
95
+ /**
96
+ * Glyph ranges the currently bound features can require, as
97
+ * `{ [glyphsSourceName]: number[] }` where each number is a range
98
+ * start (`0`, `256`, `512`, …) — i.e. the `{range}` in a
99
+ * `…/{fontstack}/{range}.pbf` URL is `<start>-<start + 255>`.
100
+ *
101
+ * This host cannot fetch glyph ranges lazily, so every range a
102
+ * tile's labels touch must be bound before `renderTile`. Rather than
103
+ * scraping every string in the MVT, call this after binding the
104
+ * vector sources and bind exactly the listed ranges.
105
+ *
106
+ * It is an over-approximation, deliberately: a range is listed if
107
+ * *any* feature in a text layer carries the codepoint in a property
108
+ * the layer's `text` expression reads, without evaluating filters,
109
+ * zoom ranges, or the expression itself, and it is listed for every
110
+ * fontstack in that layer's fallback chain. So it never omits a
111
+ * range a label needs, and it may name a few that go unused. Text
112
+ * layers that build their string from something other than a `get`
113
+ * of a feature property (a literal, a `concat` of formatted values)
114
+ * contribute their literal text where it is a plain string.
115
+ */
116
+ neededGlyphRanges(): object;
86
117
  /**
87
118
  * Build a renderer from a style JSON document.
88
119
  */
@@ -97,11 +128,33 @@ export class Renderer {
97
128
  * - `png`: `{ compression?: "fast" | "default" | "best" }`
98
129
  */
99
130
  renderTile(z: number, x: number, y: number, opts?: object | null): Uint8Array;
131
+ /**
132
+ * Neighbour tile offsets the active style actually asks for from
133
+ * `source`, as an array of `[dx, dy]` pairs (never including the
134
+ * centre `[0, 0]`).
135
+ *
136
+ * Cross-tile label collision and edge-continuous DEM shading are the
137
+ * only things that read neighbours, and only for the sources they
138
+ * name. A host that fetches the full 3×3 window unconditionally
139
+ * therefore pays for up to eight tiles it will not look at; passing
140
+ * each offset from this list to `bindSource(name, bytes, { coord })`
141
+ * fetches exactly what the recipe needs. An empty array means the
142
+ * centre tile is enough.
143
+ *
144
+ * Throws `UnknownSource` if `name` is not declared in the style.
145
+ */
146
+ requestedNeighborOffsets(name: string): Array<any>;
100
147
  /**
101
148
  * Replace the active style. Returns the new node count. Invalidates
102
149
  * the intermediate cache and drops any pending source bindings.
103
150
  */
104
151
  setStyle(style_json: string): number;
152
+ /**
153
+ * Effective attribution declared by the style (document +
154
+ * sources), joined with ` | `. Upstream TileJSON / PMTiles
155
+ * metadata is the JS host's concern — merge it on that side.
156
+ */
157
+ readonly attribution: string | undefined;
105
158
  /**
106
159
  * `tile-size` declared by the current style.
107
160
  */
@@ -113,3 +166,11 @@ export class Renderer {
113
166
  * page label the renderer build accurately.
114
167
  */
115
168
  export function simdEnabled(): boolean;
169
+
170
+ /**
171
+ * Whether this build supports multithreaded rendering (compiled with
172
+ * the `threads` feature). When `false`, `initThreadPool` is absent and
173
+ * `renderTile`'s `parallel` option is a no-op. Mirrors `simdEnabled` so
174
+ * the host can label the build.
175
+ */
176
+ export function threadsEnabled(): boolean;
package/nodejs/ezu.js CHANGED
@@ -80,6 +80,10 @@ class LogSink {
80
80
  /**
81
81
  * Set (or clear with `null` / `undefined`) the per-event JS
82
82
  * callback. The callback receives a structured record object.
83
+ *
84
+ * No-op in multithreaded (`threads`) builds — events can originate
85
+ * on rayon worker threads, so live forwarding to a main-thread JS
86
+ * callback isn't available. Use `drain` / `drainLines` instead.
83
87
  * @param {Function | null} [callback]
84
88
  */
85
89
  onEvent(callback) {
@@ -111,15 +115,35 @@ class Renderer {
111
115
  const ptr = this.__destroy_into_raw();
112
116
  wasm.__wbg_renderer_free(ptr, 0);
113
117
  }
118
+ /**
119
+ * Effective attribution declared by the style (document +
120
+ * sources), joined with ` | `. Upstream TileJSON / PMTiles
121
+ * metadata is the JS host's concern — merge it on that side.
122
+ * @returns {string | undefined}
123
+ */
124
+ get attribution() {
125
+ const ret = wasm.renderer_attribution(this.__wbg_ptr);
126
+ let v1;
127
+ if (ret[0] !== 0) {
128
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
129
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
130
+ }
131
+ return v1;
132
+ }
114
133
  /**
115
134
  * Bind raw tile bytes under a `sources.<name>` entry from the style.
116
135
  * The renderer dispatches on the source's declared `type`:
117
136
  *
118
- * - `mvt` / `pmtiles` → decode MVT layers eagerly; layers are bound
119
- * as `tile.<layer>` when [`render_tile`] runs.
120
- * - `dem` → store the raw raster-DEM bytes per `(dx, dy)` neighbour
137
+ * - `mvt` / `pmtiles` → store raw MVT bytes per `(dx, dy)` neighbour
138
+ * offset (centre `coord: [0, 0]`, the default). Layers are bound as
139
+ * `<source>.<layer>` (centre) or `<source>.<layer>@dx,dy`
140
+ * (neighbours) when [`render_tile`] runs. Binding only the centre
141
+ * degrades cross-tile label collision to centre-only at borders.
142
+ * - `dem` / `raster` → store the raw bytes per `(dx, dy)` neighbour
121
143
  * offset. The centre tile is `coord: [0, 0]` (default). Decoding
122
144
  * and 3×3 stitching happen at render time once the tile id is known.
145
+ * - `geojson` (remote) → store raw bytes per `(dx, dy)` offset;
146
+ * projected per tile (and neighbour) at render time.
123
147
  *
124
148
  * `opts` is a JS object: `{ coord?: [dx, dy] }`. Throws
125
149
  * `UnknownSource` if `name` doesn't match any entry in the style's
@@ -157,6 +181,35 @@ class Renderer {
157
181
  clearSources() {
158
182
  wasm.renderer_clearSources(this.__wbg_ptr);
159
183
  }
184
+ /**
185
+ * Glyph ranges the currently bound features can require, as
186
+ * `{ [glyphsSourceName]: number[] }` where each number is a range
187
+ * start (`0`, `256`, `512`, …) — i.e. the `{range}` in a
188
+ * `…/{fontstack}/{range}.pbf` URL is `<start>-<start + 255>`.
189
+ *
190
+ * This host cannot fetch glyph ranges lazily, so every range a
191
+ * tile's labels touch must be bound before `renderTile`. Rather than
192
+ * scraping every string in the MVT, call this after binding the
193
+ * vector sources and bind exactly the listed ranges.
194
+ *
195
+ * It is an over-approximation, deliberately: a range is listed if
196
+ * *any* feature in a text layer carries the codepoint in a property
197
+ * the layer's `text` expression reads, without evaluating filters,
198
+ * zoom ranges, or the expression itself, and it is listed for every
199
+ * fontstack in that layer's fallback chain. So it never omits a
200
+ * range a label needs, and it may name a few that go unused. Text
201
+ * layers that build their string from something other than a `get`
202
+ * of a feature property (a literal, a `concat` of formatted values)
203
+ * contribute their literal text where it is a plain string.
204
+ * @returns {object}
205
+ */
206
+ neededGlyphRanges() {
207
+ const ret = wasm.renderer_neededGlyphRanges(this.__wbg_ptr);
208
+ if (ret[2]) {
209
+ throw takeFromExternrefTable0(ret[1]);
210
+ }
211
+ return takeFromExternrefTable0(ret[0]);
212
+ }
160
213
  /**
161
214
  * Build a renderer from a style JSON document.
162
215
  * @param {string} style_json
@@ -195,6 +248,32 @@ class Renderer {
195
248
  wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
196
249
  return v1;
197
250
  }
251
+ /**
252
+ * Neighbour tile offsets the active style actually asks for from
253
+ * `source`, as an array of `[dx, dy]` pairs (never including the
254
+ * centre `[0, 0]`).
255
+ *
256
+ * Cross-tile label collision and edge-continuous DEM shading are the
257
+ * only things that read neighbours, and only for the sources they
258
+ * name. A host that fetches the full 3×3 window unconditionally
259
+ * therefore pays for up to eight tiles it will not look at; passing
260
+ * each offset from this list to `bindSource(name, bytes, { coord })`
261
+ * fetches exactly what the recipe needs. An empty array means the
262
+ * centre tile is enough.
263
+ *
264
+ * Throws `UnknownSource` if `name` is not declared in the style.
265
+ * @param {string} name
266
+ * @returns {Array<any>}
267
+ */
268
+ requestedNeighborOffsets(name) {
269
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
270
+ const len0 = WASM_VECTOR_LEN;
271
+ const ret = wasm.renderer_requestedNeighborOffsets(this.__wbg_ptr, ptr0, len0);
272
+ if (ret[2]) {
273
+ throw takeFromExternrefTable0(ret[1]);
274
+ }
275
+ return takeFromExternrefTable0(ret[0]);
276
+ }
198
277
  /**
199
278
  * Replace the active style. Returns the new node count. Invalidates
200
279
  * the intermediate cache and drops any pending source bindings.
@@ -232,9 +311,27 @@ function simdEnabled() {
232
311
  return ret !== 0;
233
312
  }
234
313
  exports.simdEnabled = simdEnabled;
314
+
315
+ /**
316
+ * Whether this build supports multithreaded rendering (compiled with
317
+ * the `threads` feature). When `false`, `initThreadPool` is absent and
318
+ * `renderTile`'s `parallel` option is a no-op. Mirrors `simdEnabled` so
319
+ * the host can label the build.
320
+ * @returns {boolean}
321
+ */
322
+ function threadsEnabled() {
323
+ const ret = wasm.threadsEnabled();
324
+ return ret !== 0;
325
+ }
326
+ exports.threadsEnabled = threadsEnabled;
235
327
  function __wbg_get_imports() {
236
328
  const import0 = {
237
329
  __proto__: null,
330
+ __wbg___wbindgen_boolean_get_2304fb8c853028c8: function(arg0) {
331
+ const v = arg0;
332
+ const ret = typeof(v) === 'boolean' ? v : undefined;
333
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
334
+ },
238
335
  __wbg___wbindgen_is_null_2042690d351e14f0: function(arg0) {
239
336
  const ret = arg0 === null;
240
337
  return ret;
@@ -249,6 +346,9 @@ function __wbg_get_imports() {
249
346
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
250
347
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
251
348
  },
349
+ __wbg___wbindgen_rethrow_2b7cc655458909c2: function(arg0) {
350
+ throw arg0;
351
+ },
252
352
  __wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
253
353
  const obj = arg1;
254
354
  const ret = typeof(obj) === 'string' ? obj : undefined;
Binary file
@@ -11,14 +11,18 @@ export const logsink_len: (a: number) => number;
11
11
  export const logsink_new: (a: number, b: number) => [number, number, number];
12
12
  export const logsink_onEvent: (a: number, b: number) => void;
13
13
  export const logsink_setCapacity: (a: number, b: number) => void;
14
+ export const renderer_attribution: (a: number) => [number, number];
14
15
  export const renderer_bindSource: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
15
16
  export const renderer_boundSources: (a: number) => [number, number];
16
17
  export const renderer_clearSources: (a: number) => void;
18
+ export const renderer_neededGlyphRanges: (a: number) => [number, number, number];
17
19
  export const renderer_new: (a: number, b: number) => [number, number, number];
18
20
  export const renderer_renderTile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
21
+ export const renderer_requestedNeighborOffsets: (a: number, b: number, c: number) => [number, number, number];
19
22
  export const renderer_setStyle: (a: number, b: number, c: number) => [number, number, number];
20
23
  export const renderer_tileSize: (a: number) => number;
21
24
  export const simdEnabled: () => number;
25
+ export const threadsEnabled: () => number;
22
26
  export const __wbindgen_malloc_command_export: (a: number, b: number) => number;
23
27
  export const __wbindgen_realloc_command_export: (a: number, b: number, c: number, d: number) => number;
24
28
  export const __wbindgen_exn_store_command_export: (a: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reearth/ezu",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Painterly map renderer — WebAssembly bindings",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "repository": {
@@ -24,8 +24,8 @@
24
24
  "exports": {
25
25
  ".": {
26
26
  "workerd": {
27
- "types": "./bundler/ezu.d.ts",
28
- "default": "./bundler/ezu.js"
27
+ "types": "./workerd/ezu.d.ts",
28
+ "default": "./workerd/ezu.js"
29
29
  },
30
30
  "browser": {
31
31
  "types": "./web/ezu.d.ts",
@@ -51,12 +51,22 @@
51
51
  "./nodejs": {
52
52
  "types": "./nodejs/ezu.d.ts",
53
53
  "default": "./nodejs/ezu.js"
54
- }
54
+ },
55
+ "./workerd": {
56
+ "types": "./workerd/ezu.d.ts",
57
+ "default": "./workerd/ezu.js"
58
+ },
59
+ "./workerd/ezu.js": "./workerd/ezu.js",
60
+ "./bundler/ezu_bg.js": "./bundler/ezu_bg.js",
61
+ "./bundler/ezu_bg.wasm": "./bundler/ezu_bg.wasm",
62
+ "./web/ezu_bg.wasm": "./web/ezu_bg.wasm",
63
+ "./package.json": "./package.json"
55
64
  },
56
65
  "files": [
57
66
  "web",
58
67
  "bundler",
59
68
  "nodejs",
69
+ "workerd",
60
70
  "README.md",
61
71
  "LICENSE-MIT",
62
72
  "LICENSE-APACHE"
@@ -65,6 +75,7 @@
65
75
  "*.wasm",
66
76
  "./web/ezu.js",
67
77
  "./bundler/ezu.js",
68
- "./nodejs/ezu.js"
78
+ "./nodejs/ezu.js",
79
+ "./workerd/ezu.js"
69
80
  ]
70
81
  }
package/web/ezu.d.ts CHANGED
@@ -38,6 +38,10 @@ export class LogSink {
38
38
  /**
39
39
  * Set (or clear with `null` / `undefined`) the per-event JS
40
40
  * callback. The callback receives a structured record object.
41
+ *
42
+ * No-op in multithreaded (`threads`) builds — events can originate
43
+ * on rayon worker threads, so live forwarding to a main-thread JS
44
+ * callback isn't available. Use `drain` / `drainLines` instead.
41
45
  */
42
46
  onEvent(callback?: Function | null): void;
43
47
  /**
@@ -61,11 +65,16 @@ export class Renderer {
61
65
  * Bind raw tile bytes under a `sources.<name>` entry from the style.
62
66
  * The renderer dispatches on the source's declared `type`:
63
67
  *
64
- * - `mvt` / `pmtiles` → decode MVT layers eagerly; layers are bound
65
- * as `tile.<layer>` when [`render_tile`] runs.
66
- * - `dem` → store the raw raster-DEM bytes per `(dx, dy)` neighbour
68
+ * - `mvt` / `pmtiles` → store raw MVT bytes per `(dx, dy)` neighbour
69
+ * offset (centre `coord: [0, 0]`, the default). Layers are bound as
70
+ * `<source>.<layer>` (centre) or `<source>.<layer>@dx,dy`
71
+ * (neighbours) when [`render_tile`] runs. Binding only the centre
72
+ * degrades cross-tile label collision to centre-only at borders.
73
+ * - `dem` / `raster` → store the raw bytes per `(dx, dy)` neighbour
67
74
  * offset. The centre tile is `coord: [0, 0]` (default). Decoding
68
75
  * and 3×3 stitching happen at render time once the tile id is known.
76
+ * - `geojson` (remote) → store raw bytes per `(dx, dy)` offset;
77
+ * projected per tile (and neighbour) at render time.
69
78
  *
70
79
  * `opts` is a JS object: `{ coord?: [dx, dy] }`. Throws
71
80
  * `UnknownSource` if `name` doesn't match any entry in the style's
@@ -83,6 +92,28 @@ export class Renderer {
83
92
  * Drop every pending source binding. Call between tile renders.
84
93
  */
85
94
  clearSources(): void;
95
+ /**
96
+ * Glyph ranges the currently bound features can require, as
97
+ * `{ [glyphsSourceName]: number[] }` where each number is a range
98
+ * start (`0`, `256`, `512`, …) — i.e. the `{range}` in a
99
+ * `…/{fontstack}/{range}.pbf` URL is `<start>-<start + 255>`.
100
+ *
101
+ * This host cannot fetch glyph ranges lazily, so every range a
102
+ * tile's labels touch must be bound before `renderTile`. Rather than
103
+ * scraping every string in the MVT, call this after binding the
104
+ * vector sources and bind exactly the listed ranges.
105
+ *
106
+ * It is an over-approximation, deliberately: a range is listed if
107
+ * *any* feature in a text layer carries the codepoint in a property
108
+ * the layer's `text` expression reads, without evaluating filters,
109
+ * zoom ranges, or the expression itself, and it is listed for every
110
+ * fontstack in that layer's fallback chain. So it never omits a
111
+ * range a label needs, and it may name a few that go unused. Text
112
+ * layers that build their string from something other than a `get`
113
+ * of a feature property (a literal, a `concat` of formatted values)
114
+ * contribute their literal text where it is a plain string.
115
+ */
116
+ neededGlyphRanges(): object;
86
117
  /**
87
118
  * Build a renderer from a style JSON document.
88
119
  */
@@ -97,11 +128,33 @@ export class Renderer {
97
128
  * - `png`: `{ compression?: "fast" | "default" | "best" }`
98
129
  */
99
130
  renderTile(z: number, x: number, y: number, opts?: object | null): Uint8Array;
131
+ /**
132
+ * Neighbour tile offsets the active style actually asks for from
133
+ * `source`, as an array of `[dx, dy]` pairs (never including the
134
+ * centre `[0, 0]`).
135
+ *
136
+ * Cross-tile label collision and edge-continuous DEM shading are the
137
+ * only things that read neighbours, and only for the sources they
138
+ * name. A host that fetches the full 3×3 window unconditionally
139
+ * therefore pays for up to eight tiles it will not look at; passing
140
+ * each offset from this list to `bindSource(name, bytes, { coord })`
141
+ * fetches exactly what the recipe needs. An empty array means the
142
+ * centre tile is enough.
143
+ *
144
+ * Throws `UnknownSource` if `name` is not declared in the style.
145
+ */
146
+ requestedNeighborOffsets(name: string): Array<any>;
100
147
  /**
101
148
  * Replace the active style. Returns the new node count. Invalidates
102
149
  * the intermediate cache and drops any pending source bindings.
103
150
  */
104
151
  setStyle(style_json: string): number;
152
+ /**
153
+ * Effective attribution declared by the style (document +
154
+ * sources), joined with ` | `. Upstream TileJSON / PMTiles
155
+ * metadata is the JS host's concern — merge it on that side.
156
+ */
157
+ readonly attribution: string | undefined;
105
158
  /**
106
159
  * `tile-size` declared by the current style.
107
160
  */
@@ -114,6 +167,14 @@ export class Renderer {
114
167
  */
115
168
  export function simdEnabled(): boolean;
116
169
 
170
+ /**
171
+ * Whether this build supports multithreaded rendering (compiled with
172
+ * the `threads` feature). When `false`, `initThreadPool` is absent and
173
+ * `renderTile`'s `parallel` option is a no-op. Mirrors `simdEnabled` so
174
+ * the host can label the build.
175
+ */
176
+ export function threadsEnabled(): boolean;
177
+
117
178
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
118
179
 
119
180
  export interface InitOutput {
@@ -128,14 +189,18 @@ export interface InitOutput {
128
189
  readonly logsink_new: (a: number, b: number) => [number, number, number];
129
190
  readonly logsink_onEvent: (a: number, b: number) => void;
130
191
  readonly logsink_setCapacity: (a: number, b: number) => void;
192
+ readonly renderer_attribution: (a: number) => [number, number];
131
193
  readonly renderer_bindSource: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
132
194
  readonly renderer_boundSources: (a: number) => [number, number];
133
195
  readonly renderer_clearSources: (a: number) => void;
196
+ readonly renderer_neededGlyphRanges: (a: number) => [number, number, number];
134
197
  readonly renderer_new: (a: number, b: number) => [number, number, number];
135
198
  readonly renderer_renderTile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
199
+ readonly renderer_requestedNeighborOffsets: (a: number, b: number, c: number) => [number, number, number];
136
200
  readonly renderer_setStyle: (a: number, b: number, c: number) => [number, number, number];
137
201
  readonly renderer_tileSize: (a: number) => number;
138
202
  readonly simdEnabled: () => number;
203
+ readonly threadsEnabled: () => number;
139
204
  readonly __wbindgen_malloc_command_export: (a: number, b: number) => number;
140
205
  readonly __wbindgen_realloc_command_export: (a: number, b: number, c: number, d: number) => number;
141
206
  readonly __wbindgen_exn_store_command_export: (a: number) => void;
package/web/ezu.js CHANGED
@@ -80,6 +80,10 @@ export class LogSink {
80
80
  /**
81
81
  * Set (or clear with `null` / `undefined`) the per-event JS
82
82
  * callback. The callback receives a structured record object.
83
+ *
84
+ * No-op in multithreaded (`threads`) builds — events can originate
85
+ * on rayon worker threads, so live forwarding to a main-thread JS
86
+ * callback isn't available. Use `drain` / `drainLines` instead.
83
87
  * @param {Function | null} [callback]
84
88
  */
85
89
  onEvent(callback) {
@@ -110,15 +114,35 @@ export class Renderer {
110
114
  const ptr = this.__destroy_into_raw();
111
115
  wasm.__wbg_renderer_free(ptr, 0);
112
116
  }
117
+ /**
118
+ * Effective attribution declared by the style (document +
119
+ * sources), joined with ` | `. Upstream TileJSON / PMTiles
120
+ * metadata is the JS host's concern — merge it on that side.
121
+ * @returns {string | undefined}
122
+ */
123
+ get attribution() {
124
+ const ret = wasm.renderer_attribution(this.__wbg_ptr);
125
+ let v1;
126
+ if (ret[0] !== 0) {
127
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
128
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
129
+ }
130
+ return v1;
131
+ }
113
132
  /**
114
133
  * Bind raw tile bytes under a `sources.<name>` entry from the style.
115
134
  * The renderer dispatches on the source's declared `type`:
116
135
  *
117
- * - `mvt` / `pmtiles` → decode MVT layers eagerly; layers are bound
118
- * as `tile.<layer>` when [`render_tile`] runs.
119
- * - `dem` → store the raw raster-DEM bytes per `(dx, dy)` neighbour
136
+ * - `mvt` / `pmtiles` → store raw MVT bytes per `(dx, dy)` neighbour
137
+ * offset (centre `coord: [0, 0]`, the default). Layers are bound as
138
+ * `<source>.<layer>` (centre) or `<source>.<layer>@dx,dy`
139
+ * (neighbours) when [`render_tile`] runs. Binding only the centre
140
+ * degrades cross-tile label collision to centre-only at borders.
141
+ * - `dem` / `raster` → store the raw bytes per `(dx, dy)` neighbour
120
142
  * offset. The centre tile is `coord: [0, 0]` (default). Decoding
121
143
  * and 3×3 stitching happen at render time once the tile id is known.
144
+ * - `geojson` (remote) → store raw bytes per `(dx, dy)` offset;
145
+ * projected per tile (and neighbour) at render time.
122
146
  *
123
147
  * `opts` is a JS object: `{ coord?: [dx, dy] }`. Throws
124
148
  * `UnknownSource` if `name` doesn't match any entry in the style's
@@ -156,6 +180,35 @@ export class Renderer {
156
180
  clearSources() {
157
181
  wasm.renderer_clearSources(this.__wbg_ptr);
158
182
  }
183
+ /**
184
+ * Glyph ranges the currently bound features can require, as
185
+ * `{ [glyphsSourceName]: number[] }` where each number is a range
186
+ * start (`0`, `256`, `512`, …) — i.e. the `{range}` in a
187
+ * `…/{fontstack}/{range}.pbf` URL is `<start>-<start + 255>`.
188
+ *
189
+ * This host cannot fetch glyph ranges lazily, so every range a
190
+ * tile's labels touch must be bound before `renderTile`. Rather than
191
+ * scraping every string in the MVT, call this after binding the
192
+ * vector sources and bind exactly the listed ranges.
193
+ *
194
+ * It is an over-approximation, deliberately: a range is listed if
195
+ * *any* feature in a text layer carries the codepoint in a property
196
+ * the layer's `text` expression reads, without evaluating filters,
197
+ * zoom ranges, or the expression itself, and it is listed for every
198
+ * fontstack in that layer's fallback chain. So it never omits a
199
+ * range a label needs, and it may name a few that go unused. Text
200
+ * layers that build their string from something other than a `get`
201
+ * of a feature property (a literal, a `concat` of formatted values)
202
+ * contribute their literal text where it is a plain string.
203
+ * @returns {object}
204
+ */
205
+ neededGlyphRanges() {
206
+ const ret = wasm.renderer_neededGlyphRanges(this.__wbg_ptr);
207
+ if (ret[2]) {
208
+ throw takeFromExternrefTable0(ret[1]);
209
+ }
210
+ return takeFromExternrefTable0(ret[0]);
211
+ }
159
212
  /**
160
213
  * Build a renderer from a style JSON document.
161
214
  * @param {string} style_json
@@ -194,6 +247,32 @@ export class Renderer {
194
247
  wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
195
248
  return v1;
196
249
  }
250
+ /**
251
+ * Neighbour tile offsets the active style actually asks for from
252
+ * `source`, as an array of `[dx, dy]` pairs (never including the
253
+ * centre `[0, 0]`).
254
+ *
255
+ * Cross-tile label collision and edge-continuous DEM shading are the
256
+ * only things that read neighbours, and only for the sources they
257
+ * name. A host that fetches the full 3×3 window unconditionally
258
+ * therefore pays for up to eight tiles it will not look at; passing
259
+ * each offset from this list to `bindSource(name, bytes, { coord })`
260
+ * fetches exactly what the recipe needs. An empty array means the
261
+ * centre tile is enough.
262
+ *
263
+ * Throws `UnknownSource` if `name` is not declared in the style.
264
+ * @param {string} name
265
+ * @returns {Array<any>}
266
+ */
267
+ requestedNeighborOffsets(name) {
268
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
269
+ const len0 = WASM_VECTOR_LEN;
270
+ const ret = wasm.renderer_requestedNeighborOffsets(this.__wbg_ptr, ptr0, len0);
271
+ if (ret[2]) {
272
+ throw takeFromExternrefTable0(ret[1]);
273
+ }
274
+ return takeFromExternrefTable0(ret[0]);
275
+ }
197
276
  /**
198
277
  * Replace the active style. Returns the new node count. Invalidates
199
278
  * the intermediate cache and drops any pending source bindings.
@@ -229,9 +308,26 @@ export function simdEnabled() {
229
308
  const ret = wasm.simdEnabled();
230
309
  return ret !== 0;
231
310
  }
311
+
312
+ /**
313
+ * Whether this build supports multithreaded rendering (compiled with
314
+ * the `threads` feature). When `false`, `initThreadPool` is absent and
315
+ * `renderTile`'s `parallel` option is a no-op. Mirrors `simdEnabled` so
316
+ * the host can label the build.
317
+ * @returns {boolean}
318
+ */
319
+ export function threadsEnabled() {
320
+ const ret = wasm.threadsEnabled();
321
+ return ret !== 0;
322
+ }
232
323
  function __wbg_get_imports() {
233
324
  const import0 = {
234
325
  __proto__: null,
326
+ __wbg___wbindgen_boolean_get_2304fb8c853028c8: function(arg0) {
327
+ const v = arg0;
328
+ const ret = typeof(v) === 'boolean' ? v : undefined;
329
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
330
+ },
235
331
  __wbg___wbindgen_is_null_2042690d351e14f0: function(arg0) {
236
332
  const ret = arg0 === null;
237
333
  return ret;
@@ -246,6 +342,9 @@ function __wbg_get_imports() {
246
342
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
247
343
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
248
344
  },
345
+ __wbg___wbindgen_rethrow_2b7cc655458909c2: function(arg0) {
346
+ throw arg0;
347
+ },
249
348
  __wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
250
349
  const obj = arg1;
251
350
  const ret = typeof(obj) === 'string' ? obj : undefined;
package/web/ezu_bg.wasm CHANGED
Binary file
@@ -11,14 +11,18 @@ export const logsink_len: (a: number) => number;
11
11
  export const logsink_new: (a: number, b: number) => [number, number, number];
12
12
  export const logsink_onEvent: (a: number, b: number) => void;
13
13
  export const logsink_setCapacity: (a: number, b: number) => void;
14
+ export const renderer_attribution: (a: number) => [number, number];
14
15
  export const renderer_bindSource: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
15
16
  export const renderer_boundSources: (a: number) => [number, number];
16
17
  export const renderer_clearSources: (a: number) => void;
18
+ export const renderer_neededGlyphRanges: (a: number) => [number, number, number];
17
19
  export const renderer_new: (a: number, b: number) => [number, number, number];
18
20
  export const renderer_renderTile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
21
+ export const renderer_requestedNeighborOffsets: (a: number, b: number, c: number) => [number, number, number];
19
22
  export const renderer_setStyle: (a: number, b: number, c: number) => [number, number, number];
20
23
  export const renderer_tileSize: (a: number) => number;
21
24
  export const simdEnabled: () => number;
25
+ export const threadsEnabled: () => number;
22
26
  export const __wbindgen_malloc_command_export: (a: number, b: number) => number;
23
27
  export const __wbindgen_realloc_command_export: (a: number, b: number, c: number, d: number) => number;
24
28
  export const __wbindgen_exn_store_command_export: (a: number) => void;
@@ -0,0 +1,3 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export * from "../bundler/ezu.js";
package/workerd/ezu.js ADDED
@@ -0,0 +1,13 @@
1
+ /* @ts-self-types="./ezu.d.ts" */
2
+ import * as glue from "../bundler/ezu_bg.js";
3
+ import wasmModule from "../bundler/ezu_bg.wasm";
4
+
5
+ // Synchronous instantiation is allowed at module scope on workerd; it
6
+ // would be rejected inside a request handler.
7
+ const instance = new WebAssembly.Instance(wasmModule, { "./ezu_bg.js": glue });
8
+ glue.__wbg_set_wasm(instance.exports);
9
+ instance.exports.__wbindgen_start();
10
+
11
+ export {
12
+ LogSink, Renderer, simdEnabled, threadsEnabled
13
+ } from "../bundler/ezu_bg.js";