folioscope 0.0.2 → 0.0.3

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.
@@ -3,7 +3,7 @@ import { Plugin } from "vite";
3
3
  export interface FolioscopeOptions {
4
4
  /**
5
5
  * Design files to bake, as globs relative to the Vite root. Each one is served as
6
- * `/<base>/<file name>.folio/`. Defaults to `**\/*.fig` outside `node_modules`.
6
+ * `/<base>/<file name>.folio/`. Defaults to `**\/*.{fig,sketch,penpot}` outside `node_modules`.
7
7
  */
8
8
  include?: string | string[];
9
9
  /** URL folder the baked prototypes are served from. Defaults to `folio`. */
@@ -15,6 +15,11 @@ export interface FolioscopeOptions {
15
15
  * to bake, lossy. Defaults to `true`.
16
16
  */
17
17
  avif?: boolean;
18
+ /**
19
+ * Fonts for text the design file stores no glyphs for: font files, folders of them, or globs,
20
+ * relative to the Vite root (TTF, OTF, TTC, WOFF, WOFF2). A `.fig` file rarely needs any.
21
+ */
22
+ fonts?: string | string[];
18
23
  }
19
24
  /**
20
25
  * Bakes design files into `.folio` folders while the site builds, and serves them in dev
@@ -1,133 +1 @@
1
- import { createHash } from "node:crypto";
2
- import { existsSync, globSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
3
- import { basename, dirname, extname, join, relative, resolve } from "node:path";
4
- //#region src/vite/index.ts
5
- /** Bumped when the bake's output changes, so stale cache entries are not reused. */
6
- const CACHE_VERSION = "2";
7
- const TYPES = {
8
- ".json": "application/json",
9
- ".png": "image/png",
10
- ".avif": "image/avif",
11
- ".webp": "image/webp"
12
- };
13
- /**
14
- * Bakes design files into `.folio` folders while the site builds, and serves them in dev
15
- * (ADR 0009: the bake runs as WebAssembly, so no Rust is needed).
16
- *
17
- * ```ts
18
- * import { folioscope } from "folioscope/vite";
19
- * export default { plugins: [folioscope({ include: "designs/*.fig" })] };
20
- * ```
21
- * then `<folioscope-player src="/folio/app.folio">` for `designs/app.fig`.
22
- */
23
- function folioscope(options = {}) {
24
- const base = (options.base ?? "folio").replace(/^\/+|\/+$/g, "");
25
- const include = [options.include ?? "**/*.fig"].flat();
26
- let config;
27
- let cacheDir;
28
- const baked = /* @__PURE__ */ new Map();
29
- /** Design files by the name they are served under (`app` for `designs/app.fig`). */
30
- const designs = () => {
31
- const found = /* @__PURE__ */ new Map();
32
- for (const file of globSync(include, {
33
- cwd: config.root,
34
- exclude: (f) => f.includes("node_modules")
35
- })) {
36
- const path = resolve(config.root, file);
37
- const name = basename(file, extname(file));
38
- const other = found.get(name);
39
- if (other && other !== path) throw new Error(`folioscope: ${relative(config.root, other)} and ${file} would both be served as ${name}.folio`);
40
- found.set(name, path);
41
- }
42
- return found;
43
- };
44
- const bake = (path) => {
45
- let folio = baked.get(path);
46
- if (!folio) {
47
- folio = bakeCached(path, cacheDir, options.avif ?? true);
48
- baked.set(path, folio);
49
- }
50
- return folio;
51
- };
52
- return {
53
- name: "folioscope",
54
- configResolved(resolved) {
55
- config = resolved;
56
- cacheDir = options.cacheDir ? resolve(config.root, options.cacheDir) : join(config.cacheDir, "folioscope");
57
- },
58
- async buildStart() {
59
- if (config.command !== "build") return;
60
- for (const [name, path] of designs()) {
61
- this.addWatchFile(path);
62
- for (const [file, source] of await bake(path)) this.emitFile({
63
- type: "asset",
64
- fileName: `${base}/${name}.folio/${file}`,
65
- source
66
- });
67
- }
68
- },
69
- configureServer(server) {
70
- const watched = designs();
71
- server.watcher.add([...watched.values()]);
72
- server.watcher.on("change", (path) => {
73
- if (baked.delete(resolve(path))) server.ws.send({ type: "full-reload" });
74
- });
75
- server.middlewares.use((req, res, next) => {
76
- const match = /^\/([^?#]+?)\.folio\/([^?#]+)/.exec(decodeURIComponent(req.url ?? ""));
77
- const prefix = `${base}/`;
78
- if (!match || !match[1].startsWith(prefix)) return next();
79
- const notFound = () => {
80
- res.statusCode = 404;
81
- res.end();
82
- };
83
- const path = designs().get(match[1].slice(prefix.length));
84
- if (!path) return notFound();
85
- bake(path).then((folio) => {
86
- const body = folio.get(match[2]);
87
- if (!body) return notFound();
88
- res.setHeader("content-type", TYPES[extname(match[2])] ?? "application/octet-stream");
89
- res.end(body);
90
- }, (error) => next(error));
91
- });
92
- }
93
- };
94
- }
95
- /** Bakes `path`, or reads the result of an earlier bake of the same bytes from `cacheDir`. */
96
- async function bakeCached(path, cacheDir, avif) {
97
- const source = readFileSync(path);
98
- const key = createHash("sha256").update(`${CACHE_VERSION}:${avif}`).update(source).digest("hex").slice(0, 32);
99
- const dir = join(cacheDir, key);
100
- if (existsSync(join(dir, "index.json"))) return readFolder(dir);
101
- const folio = (await loadWasm()).bake(source, avif);
102
- for (const [file, bytes] of folio) {
103
- mkdirSync(dirname(join(dir, file)), { recursive: true });
104
- writeFileSync(join(dir, file), bytes);
105
- }
106
- return folio;
107
- }
108
- function readFolder(dir) {
109
- const folio = /* @__PURE__ */ new Map();
110
- for (const file of readdirSync(dir, {
111
- recursive: true,
112
- withFileTypes: true
113
- })) if (file.isFile()) {
114
- const path = join(file.parentPath, file.name);
115
- folio.set(relative(dir, path).split("\\").join("/"), readFileSync(path));
116
- }
117
- return folio;
118
- }
119
- let wasm;
120
- /** Loads the WebAssembly bake once, on the first design that is not cached. */
121
- function loadWasm() {
122
- wasm ??= (async () => {
123
- const glue = new URL("../../wasm/folioscope_wasm.js", import.meta.url);
124
- const binary = new URL("../../wasm/folioscope_wasm_bg.wasm", import.meta.url);
125
- if (!existsSync(binary)) throw new Error("folioscope/vite: the WebAssembly bake is missing; in the folioscope repository, run `pnpm --filter folioscope build:wasm`");
126
- const module = await import(glue.href);
127
- module.initSync({ module: readFileSync(binary) });
128
- return module;
129
- })();
130
- return wasm;
131
- }
132
- //#endregion
133
- export { folioscope };
1
+ import{createHash as e}from"node:crypto";import{existsSync as t,globSync as n,mkdirSync as r,readFileSync as i,readdirSync as a,statSync as o,writeFileSync as s}from"node:fs";import{basename as c,dirname as l,extname as u,join as d,relative as f,resolve as p}from"node:path";const m=/\.(ttf|otf|ttc|woff2?)$/i,h={".json":`application/json`,".png":`image/png`,".avif":`image/avif`,".webp":`image/webp`};function g(e={}){let t=(e.base??`folio`).replace(/^\/+|\/+$/g,``),r=[e.include??`**/*.{fig,sketch,penpot}`].flat(),s,l,g=/* @__PURE__ */ new Map,v=()=>{let e=/* @__PURE__ */ new Map;for(let t of n(r,{cwd:s.root,exclude:e=>e.includes(`node_modules`)})){let n=p(s.root,t),r=c(t,u(t)),i=e.get(r);if(i&&i!==n)throw Error(`folioscope: ${f(s.root,i)} and ${t} would both be served as ${r}.folio`);e.set(r,n)}return e},y,b=()=>{if(y)return y;y=/* @__PURE__ */ new Map;for(let t of[e.fonts??[]].flat()){let e=n(t,{cwd:s.root});for(let t of e.toSorted()){let e=p(s.root,t),n=o(e).isDirectory()?a(e,{recursive:!0,encoding:`utf8`}).toSorted().map(t=>d(e,t)):[e];for(let e of n)m.test(e)&&y.set(f(s.root,e),i(e))}}return y},x=t=>{let n=g.get(t);return n||(n=_(t,l,e.avif??!0,b(),e=>s.logger.warn(`folioscope: ${f(s.root,t)}: no font for ${e}; its text is left out or keeps another style (fonts option)`)),g.set(t,n)),n};return{name:`folioscope`,configResolved(t){s=t,l=e.cacheDir?p(s.root,e.cacheDir):d(s.cacheDir,`folioscope`)},async buildStart(){if(s.command===`build`)for(let[e,n]of v()){this.addWatchFile(n);for(let[r,i]of await x(n))this.emitFile({type:`asset`,fileName:`${t}/${e}.folio/${r}`,source:i})}},configureServer(e){let n=v();e.watcher.add([...n.values()]),e.watcher.on(`change`,t=>{g.delete(p(t))&&e.ws.send({type:`full-reload`})}),e.middlewares.use((e,n,r)=>{let i=/^\/([^?#]+?)\.folio\/([^?#]+)/.exec(decodeURIComponent(e.url??``)),a=`${t}/`;if(!i||!i[1].startsWith(a))return r();let o=()=>{n.statusCode=404,n.end()},s=v().get(i[1].slice(a.length));if(!s)return o();x(s).then(e=>{let t=e.get(i[2]);if(!t)return o();n.setHeader(`content-type`,h[u(i[2])]??`application/octet-stream`),n.end(t)},e=>r(e))})}}}async function _(n,a,o,c,u){let f=i(n),p=e(`sha256`).update(`3:${o}`).update(f);for(let[e,t]of c)p.update(e).update(t);let m=p.digest(`hex`).slice(0,32),h=d(a,m);if(t(d(h,`index.json`)))return v(h);let{files:g,missingFonts:_}=(await b()).bake(f,o,c);_.forEach(u);for(let[e,t]of g)r(l(d(h,e)),{recursive:!0}),s(d(h,e),t);return g}function v(e){let t=/* @__PURE__ */ new Map;for(let n of a(e,{recursive:!0,withFileTypes:!0}))if(n.isFile()){let r=d(n.parentPath,n.name);t.set(f(e,r).split(`\\`).join(`/`),i(r))}return t}let y;function b(){return y??=(async()=>{let e=new URL(`../../wasm/folioscope_wasm.js`,import.meta.url),n=new URL(`../../wasm/folioscope_wasm_bg.wasm`,import.meta.url);if(!t(n))throw Error("folioscope/vite: the WebAssembly bake is missing; in the folioscope repository, run `pnpm --filter folioscope build:wasm`");let r=await import(e.href);return r.initSync({module:i(n)}),r})(),y}export{g as folioscope};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "folioscope",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Flip through your prototypes: a web component that plays interactive .fig, .sketch, .xd and .penpot prototypes",
5
5
  "keywords": [
6
6
  "custom-element",
@@ -41,6 +41,7 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^24",
44
+ "helpers4": "3.1.9",
44
45
  "playwright": "1.64.1",
45
46
  "thumbhash": "0.1.1",
46
47
  "typescript": "^7.0.2",
@@ -56,6 +57,9 @@
56
57
  }
57
58
  },
58
59
  "inlinedDependencies": {
60
+ "@helpers4/animation": "3.1.9",
61
+ "@helpers4/browser": "3.1.9",
62
+ "@helpers4/geometry": "3.1.9",
59
63
  "thumbhash": "0.1.1"
60
64
  },
61
65
  "scripts": {
@@ -2,14 +2,16 @@
2
2
  /* eslint-disable */
3
3
 
4
4
  /**
5
- * Bakes a `.fig` file; `avif` lets large, photo-like layers use AVIF. Returns a `Map` from paths
6
- * inside the `.folio` folder (`index.json`, `poster.webp`, `layers/…`) to their bytes.
5
+ * Bakes a `.fig`, `.sketch` or `.penpot` file; `avif` lets large, photo-like layers use AVIF; `fonts` maps font file
6
+ * names to their bytes, for text the file stores no glyphs for. Returns `{ files, missingFonts }`:
7
+ * a `Map` from paths inside the `.folio` folder (`index.json`, `poster.webp`, `layers/…`) to
8
+ * their bytes, and the fonts some text needed and was not given (`Family Style`).
7
9
  *
8
10
  * # Errors
9
11
  *
10
12
  * Throws when the file cannot be decoded or a frame cannot be rendered.
11
13
  */
12
- export function bake(input: Uint8Array, avif: boolean): Map<any, any>;
14
+ export function bake(input: Uint8Array, avif: boolean, fonts: Map<any, any>): object;
13
15
 
14
16
  /**
15
17
  * Summarizes the prototype of any supported design file, as `folioscope inspect` prints it.
@@ -24,10 +26,14 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
24
26
 
25
27
  export interface InitOutput {
26
28
  readonly memory: WebAssembly.Memory;
27
- readonly bake: (a: number, b: number, c: number) => [number, number, number];
29
+ readonly bake: (a: number, b: number, c: number, d: any) => [number, number, number];
28
30
  readonly inspect: (a: number, b: number) => [number, number, number, number];
29
- readonly __wbindgen_externrefs: WebAssembly.Table;
31
+ readonly wasm_bindgen_d3e99884cedca84d___convert__closures_____invoke___js_sys_6b7cddf73766d768___Function_fn_wasm_bindgen_d3e99884cedca84d___JsValue_____wasm_bindgen_d3e99884cedca84d___sys__Undefined___js_sys_6b7cddf73766d768___Function_fn_wasm_bindgen_d3e99884cedca84d___JsValue_____wasm_bindgen_d3e99884cedca84d___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
30
32
  readonly __wbindgen_malloc: (a: number, b: number) => number;
33
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
34
+ readonly __wbindgen_exn_store: (a: number) => void;
35
+ readonly __externref_table_alloc: () => number;
36
+ readonly __wbindgen_externrefs: WebAssembly.Table;
31
37
  readonly __externref_table_dealloc: (a: number) => void;
32
38
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
33
39
  readonly __wbindgen_start: () => void;
@@ -1,20 +1,23 @@
1
1
  /* @ts-self-types="./folioscope_wasm.d.ts" */
2
2
 
3
3
  /**
4
- * Bakes a `.fig` file; `avif` lets large, photo-like layers use AVIF. Returns a `Map` from paths
5
- * inside the `.folio` folder (`index.json`, `poster.webp`, `layers/…`) to their bytes.
4
+ * Bakes a `.fig`, `.sketch` or `.penpot` file; `avif` lets large, photo-like layers use AVIF; `fonts` maps font file
5
+ * names to their bytes, for text the file stores no glyphs for. Returns `{ files, missingFonts }`:
6
+ * a `Map` from paths inside the `.folio` folder (`index.json`, `poster.webp`, `layers/…`) to
7
+ * their bytes, and the fonts some text needed and was not given (`Family Style`).
6
8
  *
7
9
  * # Errors
8
10
  *
9
11
  * Throws when the file cannot be decoded or a frame cannot be rendered.
10
12
  * @param {Uint8Array} input
11
13
  * @param {boolean} avif
12
- * @returns {Map<any, any>}
14
+ * @param {Map<any, any>} fonts
15
+ * @returns {object}
13
16
  */
14
- export function bake(input, avif) {
17
+ export function bake(input, avif, fonts) {
15
18
  const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
16
19
  const len0 = WASM_VECTOR_LEN;
17
- const ret = wasm.bake(ptr0, len0, avif);
20
+ const ret = wasm.bake(ptr0, len0, avif, fonts);
18
21
  if (ret[2]) {
19
22
  throw takeFromExternrefTable0(ret[1]);
20
23
  }
@@ -57,17 +60,69 @@ function __wbg_get_imports() {
57
60
  const ret = Error(getStringFromWasm0(arg0, arg1));
58
61
  return ret;
59
62
  },
63
+ __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
64
+ const obj = arg1;
65
+ const ret = typeof(obj) === 'string' ? obj : undefined;
66
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
67
+ var len1 = WASM_VECTOR_LEN;
68
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
69
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
70
+ },
60
71
  __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
61
72
  throw new Error(getStringFromWasm0(arg0, arg1));
62
73
  },
74
+ __wbg_forEach_7ad975c8e42636ed: function(arg0, arg1, arg2) {
75
+ try {
76
+ var state0 = {a: arg1, b: arg2};
77
+ var cb0 = (arg0, arg1) => {
78
+ const a = state0.a;
79
+ state0.a = 0;
80
+ try {
81
+ return wasm_bindgen_d3e99884cedca84d___convert__closures_____invoke___js_sys_6b7cddf73766d768___Function_fn_wasm_bindgen_d3e99884cedca84d___JsValue_____wasm_bindgen_d3e99884cedca84d___sys__Undefined___js_sys_6b7cddf73766d768___Function_fn_wasm_bindgen_d3e99884cedca84d___JsValue_____wasm_bindgen_d3e99884cedca84d___sys__Undefined_______true_(a, state0.b, arg0, arg1);
82
+ } finally {
83
+ state0.a = a;
84
+ }
85
+ };
86
+ arg0.forEach(cb0);
87
+ } finally {
88
+ state0.a = 0;
89
+ }
90
+ },
91
+ __wbg_length_7f3c00c40364105e: function(arg0) {
92
+ const ret = arg0.length;
93
+ return ret;
94
+ },
95
+ __wbg_new_1dbf7428bba60a42: function(arg0) {
96
+ const ret = new Uint8Array(arg0);
97
+ return ret;
98
+ },
63
99
  __wbg_new_28744009d011f847: function() {
64
100
  const ret = new Map();
65
101
  return ret;
66
102
  },
103
+ __wbg_new_617a8cdb8bb1130e: function() {
104
+ const ret = new Object();
105
+ return ret;
106
+ },
107
+ __wbg_new_ee2291f50781bf1d: function() {
108
+ const ret = new Array();
109
+ return ret;
110
+ },
67
111
  __wbg_new_from_slice_9a868026ffa4208a: function(arg0, arg1) {
68
112
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
69
113
  return ret;
70
114
  },
115
+ __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
116
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
117
+ },
118
+ __wbg_push_2baf45db356cf468: function(arg0, arg1) {
119
+ const ret = arg0.push(arg1);
120
+ return ret;
121
+ },
122
+ __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
123
+ const ret = Reflect.set(arg0, arg1, arg2);
124
+ return ret;
125
+ }, arguments); },
71
126
  __wbg_set_6ae97e73113c4f0b: function(arg0, arg1, arg2) {
72
127
  const ret = arg0.set(arg1, arg2);
73
128
  return ret;
@@ -93,11 +148,29 @@ function __wbg_get_imports() {
93
148
  };
94
149
  }
95
150
 
151
+ function wasm_bindgen_d3e99884cedca84d___convert__closures_____invoke___js_sys_6b7cddf73766d768___Function_fn_wasm_bindgen_d3e99884cedca84d___JsValue_____wasm_bindgen_d3e99884cedca84d___sys__Undefined___js_sys_6b7cddf73766d768___Function_fn_wasm_bindgen_d3e99884cedca84d___JsValue_____wasm_bindgen_d3e99884cedca84d___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
152
+ wasm.wasm_bindgen_d3e99884cedca84d___convert__closures_____invoke___js_sys_6b7cddf73766d768___Function_fn_wasm_bindgen_d3e99884cedca84d___JsValue_____wasm_bindgen_d3e99884cedca84d___sys__Undefined___js_sys_6b7cddf73766d768___Function_fn_wasm_bindgen_d3e99884cedca84d___JsValue_____wasm_bindgen_d3e99884cedca84d___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
153
+ }
154
+
155
+ function addToExternrefTable0(obj) {
156
+ const idx = wasm.__externref_table_alloc();
157
+ wasm.__wbindgen_externrefs.set(idx, obj);
158
+ return idx;
159
+ }
160
+
96
161
  function getArrayU8FromWasm0(ptr, len) {
97
162
  ptr = ptr >>> 0;
98
163
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
99
164
  }
100
165
 
166
+ let cachedDataViewMemory0 = null;
167
+ function getDataViewMemory0() {
168
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
169
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
170
+ }
171
+ return cachedDataViewMemory0;
172
+ }
173
+
101
174
  function getStringFromWasm0(ptr, len) {
102
175
  return decodeText(ptr >>> 0, len);
103
176
  }
@@ -110,6 +183,19 @@ function getUint8ArrayMemory0() {
110
183
  return cachedUint8ArrayMemory0;
111
184
  }
112
185
 
186
+ function handleError(f, args) {
187
+ try {
188
+ return f.apply(this, args);
189
+ } catch (e) {
190
+ const idx = addToExternrefTable0(e);
191
+ wasm.__wbindgen_exn_store(idx);
192
+ }
193
+ }
194
+
195
+ function isLikeNone(x) {
196
+ return x === undefined || x === null;
197
+ }
198
+
113
199
  function passArray8ToWasm0(arg, malloc) {
114
200
  const ptr = malloc(arg.length * 1, 1) >>> 0;
115
201
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -117,6 +203,43 @@ function passArray8ToWasm0(arg, malloc) {
117
203
  return ptr;
118
204
  }
119
205
 
206
+ function passStringToWasm0(arg, malloc, realloc) {
207
+ if (realloc === undefined) {
208
+ const buf = cachedTextEncoder.encode(arg);
209
+ const ptr = malloc(buf.length, 1) >>> 0;
210
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
211
+ WASM_VECTOR_LEN = buf.length;
212
+ return ptr;
213
+ }
214
+
215
+ let len = arg.length;
216
+ let ptr = malloc(len, 1) >>> 0;
217
+
218
+ const mem = getUint8ArrayMemory0();
219
+
220
+ let offset = 0;
221
+
222
+ for (; offset < len; offset++) {
223
+ const code = arg.charCodeAt(offset);
224
+ if (code > 0x7F) break;
225
+ mem[ptr + offset] = code;
226
+ }
227
+ if (offset !== len) {
228
+ if (offset !== 0) {
229
+ arg = arg.slice(offset);
230
+ }
231
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
232
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
233
+ const ret = cachedTextEncoder.encodeInto(arg, view);
234
+
235
+ offset += ret.written;
236
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
237
+ }
238
+
239
+ WASM_VECTOR_LEN = offset;
240
+ return ptr;
241
+ }
242
+
120
243
  function takeFromExternrefTable0(idx) {
121
244
  const value = wasm.__wbindgen_externrefs.get(idx);
122
245
  wasm.__externref_table_dealloc(idx);
@@ -137,6 +260,19 @@ function decodeText(ptr, len) {
137
260
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
138
261
  }
139
262
 
263
+ const cachedTextEncoder = new TextEncoder();
264
+
265
+ if (!('encodeInto' in cachedTextEncoder)) {
266
+ cachedTextEncoder.encodeInto = function (arg, view) {
267
+ const buf = cachedTextEncoder.encode(arg);
268
+ view.set(buf);
269
+ return {
270
+ read: arg.length,
271
+ written: buf.length
272
+ };
273
+ };
274
+ }
275
+
140
276
  let WASM_VECTOR_LEN = 0;
141
277
 
142
278
  let wasmModule, wasmInstance, wasm;
@@ -144,6 +280,7 @@ function __wbg_finalize_init(instance, module) {
144
280
  wasmInstance = instance;
145
281
  wasm = instance.exports;
146
282
  wasmModule = module;
283
+ cachedDataViewMemory0 = null;
147
284
  cachedUint8ArrayMemory0 = null;
148
285
  wasm.__wbindgen_start();
149
286
  return wasm;
Binary file
@@ -1,10 +1,14 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const bake: (a: number, b: number, c: number) => [number, number, number];
4
+ export const bake: (a: number, b: number, c: number, d: any) => [number, number, number];
5
5
  export const inspect: (a: number, b: number) => [number, number, number, number];
6
- export const __wbindgen_externrefs: WebAssembly.Table;
6
+ export const wasm_bindgen_d3e99884cedca84d___convert__closures_____invoke___js_sys_6b7cddf73766d768___Function_fn_wasm_bindgen_d3e99884cedca84d___JsValue_____wasm_bindgen_d3e99884cedca84d___sys__Undefined___js_sys_6b7cddf73766d768___Function_fn_wasm_bindgen_d3e99884cedca84d___JsValue_____wasm_bindgen_d3e99884cedca84d___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
7
7
  export const __wbindgen_malloc: (a: number, b: number) => number;
8
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
9
+ export const __wbindgen_exn_store: (a: number) => void;
10
+ export const __externref_table_alloc: () => number;
11
+ export const __wbindgen_externrefs: WebAssembly.Table;
8
12
  export const __externref_table_dealloc: (a: number) => void;
9
13
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
10
14
  export const __wbindgen_start: () => void;