@agent-ix/quire-wasm 0.3.0
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/LICENSE +21 -0
- package/README.md +80 -0
- package/package.json +32 -0
- package/pkg/LICENSE +21 -0
- package/pkg/README.md +80 -0
- package/pkg/package.json +24 -0
- package/pkg/quire_wasm.d.ts +87 -0
- package/pkg/quire_wasm.js +644 -0
- package/pkg/quire_wasm_bg.wasm +0 -0
- package/pkg/quire_wasm_bg.wasm.d.ts +17 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Agent IX
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="logo.png" alt="Quire" width="100%" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# quire-wasm
|
|
6
|
+
|
|
7
|
+
[](https://discord.gg/6qsdhSPE)
|
|
8
|
+
|
|
9
|
+
WebAssembly bindings for [quire-rs](https://github.com/agent-ix/quire-rs) —
|
|
10
|
+
the parsing, extraction, and validation engine that powers the
|
|
11
|
+
Filament/Quire spec-artifact ecosystem.
|
|
12
|
+
|
|
13
|
+
**Purpose:** give `spec-editor` and other browser/Node consumers the
|
|
14
|
+
canonical parse/extract/validate pipeline so the editor agrees
|
|
15
|
+
byte-for-byte with the `quire` CLI and the Python reference parser.
|
|
16
|
+
|
|
17
|
+
> **No render surface.** The render/templating feature was removed from
|
|
18
|
+
> `quire-rs` (commit `e0811a8`). There is no `render` or `renderFromBlob`
|
|
19
|
+
> export; the module blob is `{ manifest, schemas }` (no `templates`).
|
|
20
|
+
|
|
21
|
+
## Public surface
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import init, {
|
|
25
|
+
parseDocument,
|
|
26
|
+
extract,
|
|
27
|
+
validate_archetype as validate,
|
|
28
|
+
extractFromBlob,
|
|
29
|
+
validateFromBlob,
|
|
30
|
+
} from "@agent-ix/quire-wasm";
|
|
31
|
+
|
|
32
|
+
await init(); // load the .wasm
|
|
33
|
+
|
|
34
|
+
const doc = parseDocument(md);
|
|
35
|
+
|
|
36
|
+
// Filesystem-rooted (Node target):
|
|
37
|
+
const records = extract("FR", "/path/to/module", md);
|
|
38
|
+
validate("FR", "/path/to/module", { id: "FR-001", /* ... */ }); // throws on violation
|
|
39
|
+
|
|
40
|
+
// In-memory module blob (browser / --target web):
|
|
41
|
+
const moduleBlob = {
|
|
42
|
+
manifest: "<raw manifest.yaml text>",
|
|
43
|
+
schemas: { "schemas/fr-frontmatter.schema.json": "<schema json>" },
|
|
44
|
+
};
|
|
45
|
+
const recs = extractFromBlob("FR", moduleBlob, md);
|
|
46
|
+
validateFromBlob("FR", moduleBlob, { id: "FR-001", /* ... */ });
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Two shapes
|
|
50
|
+
|
|
51
|
+
- **Module-blob** (`extractFromBlob`, `validateFromBlob`): pass an
|
|
52
|
+
in-memory `{ manifest, schemas }` object — the filesystem-free path
|
|
53
|
+
used by `--target web`. Builds an inline `Registry` via
|
|
54
|
+
`quire_rs::Registry::from_inline_parts(manifest, schemas)`.
|
|
55
|
+
- **Filesystem-rooted** (`extract`, `validate_archetype`): pass a
|
|
56
|
+
`moduleRoot` path string. Works under `wasm-pack --target nodejs`
|
|
57
|
+
(real fs) and any embedding that polyfills `fs` via WASI.
|
|
58
|
+
|
|
59
|
+
`parseDocument` is filesystem-free and works everywhere.
|
|
60
|
+
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm install @agent-ix/quire-wasm # from GitHub Packages
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Build
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
make build # wasm-pack build --target web --release (browser)
|
|
71
|
+
make build-node # wasm-pack build --target nodejs --release (Node)
|
|
72
|
+
make test # wasm-pack test --node (extract/validate parity vs quire-rs)
|
|
73
|
+
make ci # full local CI gate (fmt + lint + test + deny + audit)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`wasm-pack` is required: `cargo install wasm-pack`.
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agent-ix/quire-wasm",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "WebAssembly bindings for quire-rs (parse, extract, validate) — powers spec-editor live preview.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "pkg/quire_wasm.js",
|
|
7
|
+
"module": "pkg/quire_wasm.js",
|
|
8
|
+
"types": "pkg/quire_wasm.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./pkg/quire_wasm.d.ts",
|
|
12
|
+
"import": "./pkg/quire_wasm.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"pkg/",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "wasm-pack build --target web --release",
|
|
21
|
+
"test": "wasm-pack test --node"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"registry": "https://registry.npmjs.org/",
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/agent-ix/quire-wasm.git"
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT"
|
|
32
|
+
}
|
package/pkg/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Agent IX
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/pkg/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="logo.png" alt="Quire" width="100%" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# quire-wasm
|
|
6
|
+
|
|
7
|
+
[](https://discord.gg/6qsdhSPE)
|
|
8
|
+
|
|
9
|
+
WebAssembly bindings for [quire-rs](https://github.com/agent-ix/quire-rs) —
|
|
10
|
+
the parsing, extraction, and validation engine that powers the
|
|
11
|
+
Filament/Quire spec-artifact ecosystem.
|
|
12
|
+
|
|
13
|
+
**Purpose:** give `spec-editor` and other browser/Node consumers the
|
|
14
|
+
canonical parse/extract/validate pipeline so the editor agrees
|
|
15
|
+
byte-for-byte with the `quire` CLI and the Python reference parser.
|
|
16
|
+
|
|
17
|
+
> **No render surface.** The render/templating feature was removed from
|
|
18
|
+
> `quire-rs` (commit `e0811a8`). There is no `render` or `renderFromBlob`
|
|
19
|
+
> export; the module blob is `{ manifest, schemas }` (no `templates`).
|
|
20
|
+
|
|
21
|
+
## Public surface
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import init, {
|
|
25
|
+
parseDocument,
|
|
26
|
+
extract,
|
|
27
|
+
validate_archetype as validate,
|
|
28
|
+
extractFromBlob,
|
|
29
|
+
validateFromBlob,
|
|
30
|
+
} from "@agent-ix/quire-wasm";
|
|
31
|
+
|
|
32
|
+
await init(); // load the .wasm
|
|
33
|
+
|
|
34
|
+
const doc = parseDocument(md);
|
|
35
|
+
|
|
36
|
+
// Filesystem-rooted (Node target):
|
|
37
|
+
const records = extract("FR", "/path/to/module", md);
|
|
38
|
+
validate("FR", "/path/to/module", { id: "FR-001", /* ... */ }); // throws on violation
|
|
39
|
+
|
|
40
|
+
// In-memory module blob (browser / --target web):
|
|
41
|
+
const moduleBlob = {
|
|
42
|
+
manifest: "<raw manifest.yaml text>",
|
|
43
|
+
schemas: { "schemas/fr-frontmatter.schema.json": "<schema json>" },
|
|
44
|
+
};
|
|
45
|
+
const recs = extractFromBlob("FR", moduleBlob, md);
|
|
46
|
+
validateFromBlob("FR", moduleBlob, { id: "FR-001", /* ... */ });
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Two shapes
|
|
50
|
+
|
|
51
|
+
- **Module-blob** (`extractFromBlob`, `validateFromBlob`): pass an
|
|
52
|
+
in-memory `{ manifest, schemas }` object — the filesystem-free path
|
|
53
|
+
used by `--target web`. Builds an inline `Registry` via
|
|
54
|
+
`quire_rs::Registry::from_inline_parts(manifest, schemas)`.
|
|
55
|
+
- **Filesystem-rooted** (`extract`, `validate_archetype`): pass a
|
|
56
|
+
`moduleRoot` path string. Works under `wasm-pack --target nodejs`
|
|
57
|
+
(real fs) and any embedding that polyfills `fs` via WASI.
|
|
58
|
+
|
|
59
|
+
`parseDocument` is filesystem-free and works everywhere.
|
|
60
|
+
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm install @agent-ix/quire-wasm # from GitHub Packages
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Build
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
make build # wasm-pack build --target web --release (browser)
|
|
71
|
+
make build-node # wasm-pack build --target nodejs --release (Node)
|
|
72
|
+
make test # wasm-pack test --node (extract/validate parity vs quire-rs)
|
|
73
|
+
make ci # full local CI gate (fmt + lint + test + deny + audit)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`wasm-pack` is required: `cargo install wasm-pack`.
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT
|
package/pkg/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "quire-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"collaborators": [
|
|
5
|
+
"Agent IX <kreneskyp@gmail.com>"
|
|
6
|
+
],
|
|
7
|
+
"description": "WebAssembly bindings for quire-rs (parse, extract, validate) — powers spec-editor live preview.",
|
|
8
|
+
"version": "0.3.0",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/agent-ix/quire-wasm"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"quire_wasm_bg.wasm",
|
|
16
|
+
"quire_wasm.js",
|
|
17
|
+
"quire_wasm.d.ts"
|
|
18
|
+
],
|
|
19
|
+
"main": "quire_wasm.js",
|
|
20
|
+
"types": "quire_wasm.d.ts",
|
|
21
|
+
"sideEffects": [
|
|
22
|
+
"./snippets/*"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Install a panic hook that surfaces Rust panics as console.error in JS.
|
|
6
|
+
* No-op when the `panic-hook` feature is disabled.
|
|
7
|
+
*/
|
|
8
|
+
export function _start(): void;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Run the archetype's body-extraction DSL over `doc` markdown and
|
|
12
|
+
* return the extraction result (records + diagnostics) as a JS object.
|
|
13
|
+
*/
|
|
14
|
+
export function extract(archetype: string, module_root: string, doc: string): any;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Extract from an in-memory module blob.
|
|
18
|
+
*
|
|
19
|
+
* `moduleBlob` shape:
|
|
20
|
+
* ```json
|
|
21
|
+
* {
|
|
22
|
+
* "manifest": "name: spec_artifacts_iso\nartifact_types:\n- ...",
|
|
23
|
+
* "schemas": { "schemas/FR-frontmatter.schema.json": "{...}" }
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function extractFromBlob(archetype: string, module_blob: any, doc: string): any;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Parse a markdown document into the `QuireDocument` JSON shape.
|
|
31
|
+
* No filesystem access; pure string-in/JSON-out (live-preview hot path).
|
|
32
|
+
*/
|
|
33
|
+
export function parseDocument(text: string): any;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Validate `data` against an archetype defined inside `moduleBlob`.
|
|
37
|
+
* See [`extract_from_blob`] for the blob shape.
|
|
38
|
+
*/
|
|
39
|
+
export function validateFromBlob(archetype: string, module_blob: any, data: any): void;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Validate `data` against the archetype schema. Returns undefined on
|
|
43
|
+
* success; throws JsError carrying the violation chain on failure.
|
|
44
|
+
*/
|
|
45
|
+
export function validate_archetype(archetype: string, module_root: string, data: any): void;
|
|
46
|
+
|
|
47
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
48
|
+
|
|
49
|
+
export interface InitOutput {
|
|
50
|
+
readonly memory: WebAssembly.Memory;
|
|
51
|
+
readonly _start: () => void;
|
|
52
|
+
readonly extract: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
53
|
+
readonly extractFromBlob: (a: number, b: number, c: any, d: number, e: number) => [number, number, number];
|
|
54
|
+
readonly parseDocument: (a: number, b: number) => [number, number, number];
|
|
55
|
+
readonly validateFromBlob: (a: number, b: number, c: any, d: any) => [number, number];
|
|
56
|
+
readonly validate_archetype: (a: number, b: number, c: number, d: number, e: any) => [number, number];
|
|
57
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
58
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
59
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
60
|
+
readonly __externref_table_alloc: () => number;
|
|
61
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
62
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
63
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
64
|
+
readonly __wbindgen_start: () => void;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
71
|
+
* a precompiled `WebAssembly.Module`.
|
|
72
|
+
*
|
|
73
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
74
|
+
*
|
|
75
|
+
* @returns {InitOutput}
|
|
76
|
+
*/
|
|
77
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
81
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
82
|
+
*
|
|
83
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
84
|
+
*
|
|
85
|
+
* @returns {Promise<InitOutput>}
|
|
86
|
+
*/
|
|
87
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
/* @ts-self-types="./quire_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Install a panic hook that surfaces Rust panics as console.error in JS.
|
|
5
|
+
* No-op when the `panic-hook` feature is disabled.
|
|
6
|
+
*/
|
|
7
|
+
export function _start() {
|
|
8
|
+
wasm._start();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Run the archetype's body-extraction DSL over `doc` markdown and
|
|
13
|
+
* return the extraction result (records + diagnostics) as a JS object.
|
|
14
|
+
* @param {string} archetype
|
|
15
|
+
* @param {string} module_root
|
|
16
|
+
* @param {string} doc
|
|
17
|
+
* @returns {any}
|
|
18
|
+
*/
|
|
19
|
+
export function extract(archetype, module_root, doc) {
|
|
20
|
+
const ptr0 = passStringToWasm0(archetype, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
21
|
+
const len0 = WASM_VECTOR_LEN;
|
|
22
|
+
const ptr1 = passStringToWasm0(module_root, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
23
|
+
const len1 = WASM_VECTOR_LEN;
|
|
24
|
+
const ptr2 = passStringToWasm0(doc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
25
|
+
const len2 = WASM_VECTOR_LEN;
|
|
26
|
+
const ret = wasm.extract(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
27
|
+
if (ret[2]) {
|
|
28
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
29
|
+
}
|
|
30
|
+
return takeFromExternrefTable0(ret[0]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Extract from an in-memory module blob.
|
|
35
|
+
*
|
|
36
|
+
* `moduleBlob` shape:
|
|
37
|
+
* ```json
|
|
38
|
+
* {
|
|
39
|
+
* "manifest": "name: spec_artifacts_iso\nartifact_types:\n- ...",
|
|
40
|
+
* "schemas": { "schemas/FR-frontmatter.schema.json": "{...}" }
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
* @param {string} archetype
|
|
44
|
+
* @param {any} module_blob
|
|
45
|
+
* @param {string} doc
|
|
46
|
+
* @returns {any}
|
|
47
|
+
*/
|
|
48
|
+
export function extractFromBlob(archetype, module_blob, doc) {
|
|
49
|
+
const ptr0 = passStringToWasm0(archetype, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
50
|
+
const len0 = WASM_VECTOR_LEN;
|
|
51
|
+
const ptr1 = passStringToWasm0(doc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
52
|
+
const len1 = WASM_VECTOR_LEN;
|
|
53
|
+
const ret = wasm.extractFromBlob(ptr0, len0, module_blob, ptr1, len1);
|
|
54
|
+
if (ret[2]) {
|
|
55
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
56
|
+
}
|
|
57
|
+
return takeFromExternrefTable0(ret[0]);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Parse a markdown document into the `QuireDocument` JSON shape.
|
|
62
|
+
* No filesystem access; pure string-in/JSON-out (live-preview hot path).
|
|
63
|
+
* @param {string} text
|
|
64
|
+
* @returns {any}
|
|
65
|
+
*/
|
|
66
|
+
export function parseDocument(text) {
|
|
67
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
68
|
+
const len0 = WASM_VECTOR_LEN;
|
|
69
|
+
const ret = wasm.parseDocument(ptr0, len0);
|
|
70
|
+
if (ret[2]) {
|
|
71
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
72
|
+
}
|
|
73
|
+
return takeFromExternrefTable0(ret[0]);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Validate `data` against an archetype defined inside `moduleBlob`.
|
|
78
|
+
* See [`extract_from_blob`] for the blob shape.
|
|
79
|
+
* @param {string} archetype
|
|
80
|
+
* @param {any} module_blob
|
|
81
|
+
* @param {any} data
|
|
82
|
+
*/
|
|
83
|
+
export function validateFromBlob(archetype, module_blob, data) {
|
|
84
|
+
const ptr0 = passStringToWasm0(archetype, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
85
|
+
const len0 = WASM_VECTOR_LEN;
|
|
86
|
+
const ret = wasm.validateFromBlob(ptr0, len0, module_blob, data);
|
|
87
|
+
if (ret[1]) {
|
|
88
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Validate `data` against the archetype schema. Returns undefined on
|
|
94
|
+
* success; throws JsError carrying the violation chain on failure.
|
|
95
|
+
* @param {string} archetype
|
|
96
|
+
* @param {string} module_root
|
|
97
|
+
* @param {any} data
|
|
98
|
+
*/
|
|
99
|
+
export function validate_archetype(archetype, module_root, data) {
|
|
100
|
+
const ptr0 = passStringToWasm0(archetype, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
101
|
+
const len0 = WASM_VECTOR_LEN;
|
|
102
|
+
const ptr1 = passStringToWasm0(module_root, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
103
|
+
const len1 = WASM_VECTOR_LEN;
|
|
104
|
+
const ret = wasm.validate_archetype(ptr0, len0, ptr1, len1, data);
|
|
105
|
+
if (ret[1]) {
|
|
106
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function __wbg_get_imports() {
|
|
110
|
+
const import0 = {
|
|
111
|
+
__proto__: null,
|
|
112
|
+
__wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
|
|
113
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
114
|
+
return ret;
|
|
115
|
+
},
|
|
116
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
117
|
+
const ret = String(arg1);
|
|
118
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
119
|
+
const len1 = WASM_VECTOR_LEN;
|
|
120
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
121
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
122
|
+
},
|
|
123
|
+
__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d: function(arg0, arg1) {
|
|
124
|
+
const v = arg1;
|
|
125
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
126
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
127
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
128
|
+
},
|
|
129
|
+
__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9: function(arg0) {
|
|
130
|
+
const v = arg0;
|
|
131
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
132
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
133
|
+
},
|
|
134
|
+
__wbg___wbindgen_debug_string_0accd80f45e5faa2: function(arg0, arg1) {
|
|
135
|
+
const ret = debugString(arg1);
|
|
136
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
137
|
+
const len1 = WASM_VECTOR_LEN;
|
|
138
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
139
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
140
|
+
},
|
|
141
|
+
__wbg___wbindgen_in_70a403a56e771704: function(arg0, arg1) {
|
|
142
|
+
const ret = arg0 in arg1;
|
|
143
|
+
return ret;
|
|
144
|
+
},
|
|
145
|
+
__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9: function(arg0) {
|
|
146
|
+
const ret = typeof(arg0) === 'bigint';
|
|
147
|
+
return ret;
|
|
148
|
+
},
|
|
149
|
+
__wbg___wbindgen_is_function_754e9f305ff6029e: function(arg0) {
|
|
150
|
+
const ret = typeof(arg0) === 'function';
|
|
151
|
+
return ret;
|
|
152
|
+
},
|
|
153
|
+
__wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
|
|
154
|
+
const val = arg0;
|
|
155
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
156
|
+
return ret;
|
|
157
|
+
},
|
|
158
|
+
__wbg___wbindgen_is_string_c236cabd84a4d769: function(arg0) {
|
|
159
|
+
const ret = typeof(arg0) === 'string';
|
|
160
|
+
return ret;
|
|
161
|
+
},
|
|
162
|
+
__wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
|
|
163
|
+
const ret = arg0 === undefined;
|
|
164
|
+
return ret;
|
|
165
|
+
},
|
|
166
|
+
__wbg___wbindgen_jsval_eq_1068e624fa87f6ab: function(arg0, arg1) {
|
|
167
|
+
const ret = arg0 === arg1;
|
|
168
|
+
return ret;
|
|
169
|
+
},
|
|
170
|
+
__wbg___wbindgen_jsval_loose_eq_2c56564c75129511: function(arg0, arg1) {
|
|
171
|
+
const ret = arg0 == arg1;
|
|
172
|
+
return ret;
|
|
173
|
+
},
|
|
174
|
+
__wbg___wbindgen_number_get_9bb1761122181af2: function(arg0, arg1) {
|
|
175
|
+
const obj = arg1;
|
|
176
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
177
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
178
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
179
|
+
},
|
|
180
|
+
__wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
|
|
181
|
+
const obj = arg1;
|
|
182
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
183
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
184
|
+
var len1 = WASM_VECTOR_LEN;
|
|
185
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
186
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
187
|
+
},
|
|
188
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
189
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
190
|
+
},
|
|
191
|
+
__wbg_call_8a89609d89f6608a: function() { return handleError(function (arg0, arg1) {
|
|
192
|
+
const ret = arg0.call(arg1);
|
|
193
|
+
return ret;
|
|
194
|
+
}, arguments); },
|
|
195
|
+
__wbg_done_60cf307fcc680536: function(arg0) {
|
|
196
|
+
const ret = arg0.done;
|
|
197
|
+
return ret;
|
|
198
|
+
},
|
|
199
|
+
__wbg_entries_04b37a02507f1713: function(arg0) {
|
|
200
|
+
const ret = Object.entries(arg0);
|
|
201
|
+
return ret;
|
|
202
|
+
},
|
|
203
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
204
|
+
let deferred0_0;
|
|
205
|
+
let deferred0_1;
|
|
206
|
+
try {
|
|
207
|
+
deferred0_0 = arg0;
|
|
208
|
+
deferred0_1 = arg1;
|
|
209
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
210
|
+
} finally {
|
|
211
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
__wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
|
|
215
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
216
|
+
}, arguments); },
|
|
217
|
+
__wbg_get_1f8f054ddbaa7db2: function() { return handleError(function (arg0, arg1) {
|
|
218
|
+
const ret = Reflect.get(arg0, arg1);
|
|
219
|
+
return ret;
|
|
220
|
+
}, arguments); },
|
|
221
|
+
__wbg_get_2b48c7d0d006a781: function(arg0, arg1) {
|
|
222
|
+
const ret = arg0[arg1 >>> 0];
|
|
223
|
+
return ret;
|
|
224
|
+
},
|
|
225
|
+
__wbg_get_unchecked_33f6e5c9e2f2d6b2: function(arg0, arg1) {
|
|
226
|
+
const ret = arg0[arg1 >>> 0];
|
|
227
|
+
return ret;
|
|
228
|
+
},
|
|
229
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
230
|
+
const ret = arg0[arg1];
|
|
231
|
+
return ret;
|
|
232
|
+
},
|
|
233
|
+
__wbg_instanceof_ArrayBuffer_8f49811467741499: function(arg0) {
|
|
234
|
+
let result;
|
|
235
|
+
try {
|
|
236
|
+
result = arg0 instanceof ArrayBuffer;
|
|
237
|
+
} catch (_) {
|
|
238
|
+
result = false;
|
|
239
|
+
}
|
|
240
|
+
const ret = result;
|
|
241
|
+
return ret;
|
|
242
|
+
},
|
|
243
|
+
__wbg_instanceof_Map_9fc06d9a951bcee6: function(arg0) {
|
|
244
|
+
let result;
|
|
245
|
+
try {
|
|
246
|
+
result = arg0 instanceof Map;
|
|
247
|
+
} catch (_) {
|
|
248
|
+
result = false;
|
|
249
|
+
}
|
|
250
|
+
const ret = result;
|
|
251
|
+
return ret;
|
|
252
|
+
},
|
|
253
|
+
__wbg_instanceof_Uint8Array_86f30649f63ef9c2: function(arg0) {
|
|
254
|
+
let result;
|
|
255
|
+
try {
|
|
256
|
+
result = arg0 instanceof Uint8Array;
|
|
257
|
+
} catch (_) {
|
|
258
|
+
result = false;
|
|
259
|
+
}
|
|
260
|
+
const ret = result;
|
|
261
|
+
return ret;
|
|
262
|
+
},
|
|
263
|
+
__wbg_isArray_67c2c9c4313f4448: function(arg0) {
|
|
264
|
+
const ret = Array.isArray(arg0);
|
|
265
|
+
return ret;
|
|
266
|
+
},
|
|
267
|
+
__wbg_isSafeInteger_66acec27e09e99a7: function(arg0) {
|
|
268
|
+
const ret = Number.isSafeInteger(arg0);
|
|
269
|
+
return ret;
|
|
270
|
+
},
|
|
271
|
+
__wbg_iterator_8732428d309e270e: function() {
|
|
272
|
+
const ret = Symbol.iterator;
|
|
273
|
+
return ret;
|
|
274
|
+
},
|
|
275
|
+
__wbg_length_4a591ecaa01354d9: function(arg0) {
|
|
276
|
+
const ret = arg0.length;
|
|
277
|
+
return ret;
|
|
278
|
+
},
|
|
279
|
+
__wbg_length_66f1a4b2e9026940: function(arg0) {
|
|
280
|
+
const ret = arg0.length;
|
|
281
|
+
return ret;
|
|
282
|
+
},
|
|
283
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
284
|
+
const ret = new Error();
|
|
285
|
+
return ret;
|
|
286
|
+
},
|
|
287
|
+
__wbg_new_578aeef4b6b94378: function(arg0) {
|
|
288
|
+
const ret = new Uint8Array(arg0);
|
|
289
|
+
return ret;
|
|
290
|
+
},
|
|
291
|
+
__wbg_new_622fc80556be2e26: function() {
|
|
292
|
+
const ret = new Map();
|
|
293
|
+
return ret;
|
|
294
|
+
},
|
|
295
|
+
__wbg_new_ce1ab61c1c2b300d: function() {
|
|
296
|
+
const ret = new Object();
|
|
297
|
+
return ret;
|
|
298
|
+
},
|
|
299
|
+
__wbg_new_d90091b82fdf5b91: function() {
|
|
300
|
+
const ret = new Array();
|
|
301
|
+
return ret;
|
|
302
|
+
},
|
|
303
|
+
__wbg_next_9e03acdf51c4960d: function(arg0) {
|
|
304
|
+
const ret = arg0.next;
|
|
305
|
+
return ret;
|
|
306
|
+
},
|
|
307
|
+
__wbg_next_eb8ca7351fa27906: function() { return handleError(function (arg0) {
|
|
308
|
+
const ret = arg0.next();
|
|
309
|
+
return ret;
|
|
310
|
+
}, arguments); },
|
|
311
|
+
__wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
|
|
312
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
313
|
+
},
|
|
314
|
+
__wbg_set_52b1e1eb5bed906a: function(arg0, arg1, arg2) {
|
|
315
|
+
const ret = arg0.set(arg1, arg2);
|
|
316
|
+
return ret;
|
|
317
|
+
},
|
|
318
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
319
|
+
arg0[arg1] = arg2;
|
|
320
|
+
},
|
|
321
|
+
__wbg_set_dca99999bba88a9a: function(arg0, arg1, arg2) {
|
|
322
|
+
arg0[arg1 >>> 0] = arg2;
|
|
323
|
+
},
|
|
324
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
325
|
+
const ret = arg1.stack;
|
|
326
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
327
|
+
const len1 = WASM_VECTOR_LEN;
|
|
328
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
329
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
330
|
+
},
|
|
331
|
+
__wbg_value_f3625092ee4b37f4: function(arg0) {
|
|
332
|
+
const ret = arg0.value;
|
|
333
|
+
return ret;
|
|
334
|
+
},
|
|
335
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
336
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
337
|
+
const ret = arg0;
|
|
338
|
+
return ret;
|
|
339
|
+
},
|
|
340
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
341
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
342
|
+
const ret = arg0;
|
|
343
|
+
return ret;
|
|
344
|
+
},
|
|
345
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
346
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
347
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
348
|
+
return ret;
|
|
349
|
+
},
|
|
350
|
+
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
351
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
352
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
353
|
+
return ret;
|
|
354
|
+
},
|
|
355
|
+
__wbindgen_init_externref_table: function() {
|
|
356
|
+
const table = wasm.__wbindgen_externrefs;
|
|
357
|
+
const offset = table.grow(4);
|
|
358
|
+
table.set(0, undefined);
|
|
359
|
+
table.set(offset + 0, undefined);
|
|
360
|
+
table.set(offset + 1, null);
|
|
361
|
+
table.set(offset + 2, true);
|
|
362
|
+
table.set(offset + 3, false);
|
|
363
|
+
},
|
|
364
|
+
};
|
|
365
|
+
return {
|
|
366
|
+
__proto__: null,
|
|
367
|
+
"./quire_wasm_bg.js": import0,
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function addToExternrefTable0(obj) {
|
|
372
|
+
const idx = wasm.__externref_table_alloc();
|
|
373
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
374
|
+
return idx;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function debugString(val) {
|
|
378
|
+
// primitive types
|
|
379
|
+
const type = typeof val;
|
|
380
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
381
|
+
return `${val}`;
|
|
382
|
+
}
|
|
383
|
+
if (type == 'string') {
|
|
384
|
+
return `"${val}"`;
|
|
385
|
+
}
|
|
386
|
+
if (type == 'symbol') {
|
|
387
|
+
const description = val.description;
|
|
388
|
+
if (description == null) {
|
|
389
|
+
return 'Symbol';
|
|
390
|
+
} else {
|
|
391
|
+
return `Symbol(${description})`;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if (type == 'function') {
|
|
395
|
+
const name = val.name;
|
|
396
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
397
|
+
return `Function(${name})`;
|
|
398
|
+
} else {
|
|
399
|
+
return 'Function';
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
// objects
|
|
403
|
+
if (Array.isArray(val)) {
|
|
404
|
+
const length = val.length;
|
|
405
|
+
let debug = '[';
|
|
406
|
+
if (length > 0) {
|
|
407
|
+
debug += debugString(val[0]);
|
|
408
|
+
}
|
|
409
|
+
for(let i = 1; i < length; i++) {
|
|
410
|
+
debug += ', ' + debugString(val[i]);
|
|
411
|
+
}
|
|
412
|
+
debug += ']';
|
|
413
|
+
return debug;
|
|
414
|
+
}
|
|
415
|
+
// Test for built-in
|
|
416
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
417
|
+
let className;
|
|
418
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
419
|
+
className = builtInMatches[1];
|
|
420
|
+
} else {
|
|
421
|
+
// Failed to match the standard '[object ClassName]'
|
|
422
|
+
return toString.call(val);
|
|
423
|
+
}
|
|
424
|
+
if (className == 'Object') {
|
|
425
|
+
// we're a user defined class or Object
|
|
426
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
427
|
+
// easier than looping through ownProperties of `val`.
|
|
428
|
+
try {
|
|
429
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
430
|
+
} catch (_) {
|
|
431
|
+
return 'Object';
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
// errors
|
|
435
|
+
if (val instanceof Error) {
|
|
436
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
437
|
+
}
|
|
438
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
439
|
+
return className;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
443
|
+
ptr = ptr >>> 0;
|
|
444
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
let cachedDataViewMemory0 = null;
|
|
448
|
+
function getDataViewMemory0() {
|
|
449
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
450
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
451
|
+
}
|
|
452
|
+
return cachedDataViewMemory0;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function getStringFromWasm0(ptr, len) {
|
|
456
|
+
return decodeText(ptr >>> 0, len);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
let cachedUint8ArrayMemory0 = null;
|
|
460
|
+
function getUint8ArrayMemory0() {
|
|
461
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
462
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
463
|
+
}
|
|
464
|
+
return cachedUint8ArrayMemory0;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
function handleError(f, args) {
|
|
468
|
+
try {
|
|
469
|
+
return f.apply(this, args);
|
|
470
|
+
} catch (e) {
|
|
471
|
+
const idx = addToExternrefTable0(e);
|
|
472
|
+
wasm.__wbindgen_exn_store(idx);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function isLikeNone(x) {
|
|
477
|
+
return x === undefined || x === null;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
481
|
+
if (realloc === undefined) {
|
|
482
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
483
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
484
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
485
|
+
WASM_VECTOR_LEN = buf.length;
|
|
486
|
+
return ptr;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
let len = arg.length;
|
|
490
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
491
|
+
|
|
492
|
+
const mem = getUint8ArrayMemory0();
|
|
493
|
+
|
|
494
|
+
let offset = 0;
|
|
495
|
+
|
|
496
|
+
for (; offset < len; offset++) {
|
|
497
|
+
const code = arg.charCodeAt(offset);
|
|
498
|
+
if (code > 0x7F) break;
|
|
499
|
+
mem[ptr + offset] = code;
|
|
500
|
+
}
|
|
501
|
+
if (offset !== len) {
|
|
502
|
+
if (offset !== 0) {
|
|
503
|
+
arg = arg.slice(offset);
|
|
504
|
+
}
|
|
505
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
506
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
507
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
508
|
+
|
|
509
|
+
offset += ret.written;
|
|
510
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
WASM_VECTOR_LEN = offset;
|
|
514
|
+
return ptr;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
function takeFromExternrefTable0(idx) {
|
|
518
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
519
|
+
wasm.__externref_table_dealloc(idx);
|
|
520
|
+
return value;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
524
|
+
cachedTextDecoder.decode();
|
|
525
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
526
|
+
let numBytesDecoded = 0;
|
|
527
|
+
function decodeText(ptr, len) {
|
|
528
|
+
numBytesDecoded += len;
|
|
529
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
530
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
531
|
+
cachedTextDecoder.decode();
|
|
532
|
+
numBytesDecoded = len;
|
|
533
|
+
}
|
|
534
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
const cachedTextEncoder = new TextEncoder();
|
|
538
|
+
|
|
539
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
540
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
541
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
542
|
+
view.set(buf);
|
|
543
|
+
return {
|
|
544
|
+
read: arg.length,
|
|
545
|
+
written: buf.length
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
let WASM_VECTOR_LEN = 0;
|
|
551
|
+
|
|
552
|
+
let wasmModule, wasmInstance, wasm;
|
|
553
|
+
function __wbg_finalize_init(instance, module) {
|
|
554
|
+
wasmInstance = instance;
|
|
555
|
+
wasm = instance.exports;
|
|
556
|
+
wasmModule = module;
|
|
557
|
+
cachedDataViewMemory0 = null;
|
|
558
|
+
cachedUint8ArrayMemory0 = null;
|
|
559
|
+
wasm.__wbindgen_start();
|
|
560
|
+
return wasm;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
async function __wbg_load(module, imports) {
|
|
564
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
565
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
566
|
+
try {
|
|
567
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
568
|
+
} catch (e) {
|
|
569
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
570
|
+
|
|
571
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
572
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
573
|
+
|
|
574
|
+
} else { throw e; }
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
const bytes = await module.arrayBuffer();
|
|
579
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
580
|
+
} else {
|
|
581
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
582
|
+
|
|
583
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
584
|
+
return { instance, module };
|
|
585
|
+
} else {
|
|
586
|
+
return instance;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
function expectedResponseType(type) {
|
|
591
|
+
switch (type) {
|
|
592
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
593
|
+
}
|
|
594
|
+
return false;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
function initSync(module) {
|
|
599
|
+
if (wasm !== undefined) return wasm;
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
if (module !== undefined) {
|
|
603
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
604
|
+
({module} = module)
|
|
605
|
+
} else {
|
|
606
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
const imports = __wbg_get_imports();
|
|
611
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
612
|
+
module = new WebAssembly.Module(module);
|
|
613
|
+
}
|
|
614
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
615
|
+
return __wbg_finalize_init(instance, module);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
async function __wbg_init(module_or_path) {
|
|
619
|
+
if (wasm !== undefined) return wasm;
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
if (module_or_path !== undefined) {
|
|
623
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
624
|
+
({module_or_path} = module_or_path)
|
|
625
|
+
} else {
|
|
626
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
if (module_or_path === undefined) {
|
|
631
|
+
module_or_path = new URL('quire_wasm_bg.wasm', import.meta.url);
|
|
632
|
+
}
|
|
633
|
+
const imports = __wbg_get_imports();
|
|
634
|
+
|
|
635
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
636
|
+
module_or_path = fetch(module_or_path);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
640
|
+
|
|
641
|
+
return __wbg_finalize_init(instance, module);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const _start: () => void;
|
|
5
|
+
export const extract: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
6
|
+
export const extractFromBlob: (a: number, b: number, c: any, d: number, e: number) => [number, number, number];
|
|
7
|
+
export const parseDocument: (a: number, b: number) => [number, number, number];
|
|
8
|
+
export const validateFromBlob: (a: number, b: number, c: any, d: any) => [number, number];
|
|
9
|
+
export const validate_archetype: (a: number, b: number, c: number, d: number, e: any) => [number, number];
|
|
10
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
11
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
12
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
13
|
+
export const __externref_table_alloc: () => number;
|
|
14
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
15
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
16
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
17
|
+
export const __wbindgen_start: () => void;
|