@ryansann/okftool 0.1.5
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 +201 -0
- package/README.md +97 -0
- package/okftool.d.ts +31 -0
- package/okftool.js +9 -0
- package/okftool_bg.js +508 -0
- package/okftool_bg.wasm +0 -0
- package/package.json +24 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 okftool contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# okftool
|
|
2
|
+
|
|
3
|
+
[](https://github.com/ryansann/okftool/actions/workflows/ci.yml)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
|
|
6
|
+
A fast, embeddable **validator and linter** for [OKF](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md)
|
|
7
|
+
(Open Knowledge Format) bundles, written in Rust.
|
|
8
|
+
|
|
9
|
+
One core, three surfaces:
|
|
10
|
+
|
|
11
|
+
| Surface | Crate | Use |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| **Native CLI** | `okftool-cli` → `okftool` | CI, local `okftool validate` / `okftool lint` |
|
|
14
|
+
| **wasm / npm** | `okftool-wasm` → `@ryansann/okftool` npm package | embed in JS hosts (a desktop app, a Node/edge API, the browser) |
|
|
15
|
+
| **Rust crate** | `okftool-core` | embed directly in a Rust host |
|
|
16
|
+
|
|
17
|
+
The brain — parsing, spec validation, and the lint engine — lives in `okftool-core`
|
|
18
|
+
and is filesystem-agnostic (callers pass `(path, content)`), so it compiles
|
|
19
|
+
unchanged to native and `wasm32`. There is exactly one implementation.
|
|
20
|
+
|
|
21
|
+
## Two layers
|
|
22
|
+
|
|
23
|
+
okftool mirrors the OKF spec's MUST/SHOULD split:
|
|
24
|
+
|
|
25
|
+
- **`validate`** enforces what the spec says MUST be true (§9 conformance:
|
|
26
|
+
parseable frontmatter, a non-empty `type`). These are non-disableable errors.
|
|
27
|
+
- **`lint`** enforces what SHOULD be true plus everything the spec leaves to
|
|
28
|
+
judgment. Every lint rule is configurable and disableable. A lint rule may
|
|
29
|
+
never flag something the spec mandates tolerating (broken links, unknown
|
|
30
|
+
`type` values, missing optional fields) as a non-disableable error.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
# from source (requires a Rust toolchain)
|
|
36
|
+
cargo install --path crates/okftool-cli
|
|
37
|
+
# or, once published
|
|
38
|
+
cargo install okftool-cli
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Prebuilt binaries for macOS/Linux/Windows are attached to each
|
|
42
|
+
[GitHub release](https://github.com/ryansann/okftool/releases).
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
okftool validate <bundle> # §9 conformance only (exit 1 if non-conformant)
|
|
48
|
+
okftool lint <bundle> # spec + lint rules; --config, --format pretty|json|sarif
|
|
49
|
+
okftool rules # list all rules by category
|
|
50
|
+
okftool explain <rule> # a rule's rationale, category, default severity
|
|
51
|
+
okftool init [dir] # scaffold a .okftool.yaml
|
|
52
|
+
okftool build <bundle> # package the bundle as <name>.tar.gz (-o, --prefix)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`lint` reads `<bundle>/.okftool.yaml` (or `--config`), else the `okf-recommended`
|
|
56
|
+
profile. Exit is non-zero on non-conformance or any diagnostic at/above
|
|
57
|
+
`ci.fail-on` (default `error`). `--format sarif` emits SARIF 2.1.0 for inline
|
|
58
|
+
GitHub PR annotations.
|
|
59
|
+
|
|
60
|
+
## Rules & configuration
|
|
61
|
+
|
|
62
|
+
okftool ships **18 lint rules** across six categories (frontmatter,
|
|
63
|
+
type-vocabulary, linking, topology, body, index/log). `.okftool.yaml` selects a
|
|
64
|
+
profile with `extends`, sets per-rule severity/options, scopes rules with glob
|
|
65
|
+
`overrides`, and gates CI with `ci.fail-on`. Concepts can opt out inline via an
|
|
66
|
+
`okf-lint-disable` frontmatter list.
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
# .okftool.yaml
|
|
70
|
+
extends: okf-recommended # or okf-strict / okf-minimal
|
|
71
|
+
rules:
|
|
72
|
+
no-dangling-links: warn # off | info | warn | error
|
|
73
|
+
max-out-degree: { severity: warn, options: { max: 20 } }
|
|
74
|
+
ci:
|
|
75
|
+
fail-on: error
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The full format, every rule, and the **okf-recommended / okf-strict / okf-minimal**
|
|
79
|
+
profiles are documented in okftool's own OKF bundle (it dogfoods itself) — see
|
|
80
|
+
[`docs/okf`](docs/okf), in particular
|
|
81
|
+
[reference/configuration](docs/okf/reference/configuration.md),
|
|
82
|
+
[reference/profiles](docs/okf/reference/profiles.md), and
|
|
83
|
+
[reference/rules](docs/okf/reference/rules/index.md).
|
|
84
|
+
|
|
85
|
+
## Develop
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
make ci # fmt + clippy + test + wasm build + dogfood lint
|
|
89
|
+
make lint-self # lint okftool's own OKF docs bundle under the strict profile
|
|
90
|
+
make help # list all targets
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to add a rule.
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
Licensed under the [Apache License, Version 2.0](LICENSE).
|
package/okftool.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Initialize panic forwarding to `console.error`. Safe to call more than once.
|
|
6
|
+
*/
|
|
7
|
+
export function init(): void;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Validate *and* lint a bundle. `config_yaml` is the contents of a
|
|
11
|
+
* `.okftool.yaml` (empty string → the okf-recommended profile). Returns the
|
|
12
|
+
* serialized `Bundle` with spec + lint diagnostics merged.
|
|
13
|
+
*/
|
|
14
|
+
export function lint(files: any, config_yaml?: string | null): any;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The OKF spec version this build targets.
|
|
18
|
+
*/
|
|
19
|
+
export function okf_version(): string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The rule manifest: `[{ id, category, summary, rationale, defaultSeverity, fixable }]`.
|
|
23
|
+
* Powers an in-app "explain" / rule browser.
|
|
24
|
+
*/
|
|
25
|
+
export function rules(): any;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Validate a bundle against the OKF spec (§9). `files` is
|
|
29
|
+
* `Array<{ path, content }>`; returns the serialized `Bundle`.
|
|
30
|
+
*/
|
|
31
|
+
export function validate(files: any): any;
|
package/okftool.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./okftool.d.ts" */
|
|
2
|
+
import * as wasm from "./okftool_bg.wasm";
|
|
3
|
+
import { __wbg_set_wasm } from "./okftool_bg.js";
|
|
4
|
+
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
init, lint, okf_version, rules, validate
|
|
9
|
+
} from "./okftool_bg.js";
|
package/okftool_bg.js
ADDED
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialize panic forwarding to `console.error`. Safe to call more than once.
|
|
3
|
+
*/
|
|
4
|
+
export function init() {
|
|
5
|
+
wasm.init();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Validate *and* lint a bundle. `config_yaml` is the contents of a
|
|
10
|
+
* `.okftool.yaml` (empty string → the okf-recommended profile). Returns the
|
|
11
|
+
* serialized `Bundle` with spec + lint diagnostics merged.
|
|
12
|
+
* @param {any} files
|
|
13
|
+
* @param {string | null} [config_yaml]
|
|
14
|
+
* @returns {any}
|
|
15
|
+
*/
|
|
16
|
+
export function lint(files, config_yaml) {
|
|
17
|
+
try {
|
|
18
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
19
|
+
var ptr0 = isLikeNone(config_yaml) ? 0 : passStringToWasm0(config_yaml, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
20
|
+
var len0 = WASM_VECTOR_LEN;
|
|
21
|
+
wasm.lint(retptr, addHeapObject(files), ptr0, len0);
|
|
22
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
23
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
24
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
25
|
+
if (r2) {
|
|
26
|
+
throw takeObject(r1);
|
|
27
|
+
}
|
|
28
|
+
return takeObject(r0);
|
|
29
|
+
} finally {
|
|
30
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The OKF spec version this build targets.
|
|
36
|
+
* @returns {string}
|
|
37
|
+
*/
|
|
38
|
+
export function okf_version() {
|
|
39
|
+
let deferred1_0;
|
|
40
|
+
let deferred1_1;
|
|
41
|
+
try {
|
|
42
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
43
|
+
wasm.okf_version(retptr);
|
|
44
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
45
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
46
|
+
deferred1_0 = r0;
|
|
47
|
+
deferred1_1 = r1;
|
|
48
|
+
return getStringFromWasm0(r0, r1);
|
|
49
|
+
} finally {
|
|
50
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
51
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The rule manifest: `[{ id, category, summary, rationale, defaultSeverity, fixable }]`.
|
|
57
|
+
* Powers an in-app "explain" / rule browser.
|
|
58
|
+
* @returns {any}
|
|
59
|
+
*/
|
|
60
|
+
export function rules() {
|
|
61
|
+
try {
|
|
62
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
63
|
+
wasm.rules(retptr);
|
|
64
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
65
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
66
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
67
|
+
if (r2) {
|
|
68
|
+
throw takeObject(r1);
|
|
69
|
+
}
|
|
70
|
+
return takeObject(r0);
|
|
71
|
+
} finally {
|
|
72
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Validate a bundle against the OKF spec (§9). `files` is
|
|
78
|
+
* `Array<{ path, content }>`; returns the serialized `Bundle`.
|
|
79
|
+
* @param {any} files
|
|
80
|
+
* @returns {any}
|
|
81
|
+
*/
|
|
82
|
+
export function validate(files) {
|
|
83
|
+
try {
|
|
84
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
85
|
+
wasm.validate(retptr, addHeapObject(files));
|
|
86
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
87
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
88
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
89
|
+
if (r2) {
|
|
90
|
+
throw takeObject(r1);
|
|
91
|
+
}
|
|
92
|
+
return takeObject(r0);
|
|
93
|
+
} finally {
|
|
94
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export function __wbg_Error_fdd633d4bb5dd76a(arg0, arg1) {
|
|
98
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
99
|
+
return addHeapObject(ret);
|
|
100
|
+
}
|
|
101
|
+
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
102
|
+
const ret = String(getObject(arg1));
|
|
103
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
104
|
+
const len1 = WASM_VECTOR_LEN;
|
|
105
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
106
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
107
|
+
}
|
|
108
|
+
export function __wbg___wbindgen_boolean_get_edaed31a367ce1bd(arg0) {
|
|
109
|
+
const v = getObject(arg0);
|
|
110
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
111
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
112
|
+
}
|
|
113
|
+
export function __wbg___wbindgen_debug_string_8a447059637473e2(arg0, arg1) {
|
|
114
|
+
const ret = debugString(getObject(arg1));
|
|
115
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
116
|
+
const len1 = WASM_VECTOR_LEN;
|
|
117
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
118
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
119
|
+
}
|
|
120
|
+
export function __wbg___wbindgen_in_4990f46af709e33c(arg0, arg1) {
|
|
121
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
122
|
+
return ret;
|
|
123
|
+
}
|
|
124
|
+
export function __wbg___wbindgen_is_function_acc5528be2b923f2(arg0) {
|
|
125
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
126
|
+
return ret;
|
|
127
|
+
}
|
|
128
|
+
export function __wbg___wbindgen_is_object_0beba4a1980d3eea(arg0) {
|
|
129
|
+
const val = getObject(arg0);
|
|
130
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
131
|
+
return ret;
|
|
132
|
+
}
|
|
133
|
+
export function __wbg___wbindgen_is_string_1fca8072260dd261(arg0) {
|
|
134
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
135
|
+
return ret;
|
|
136
|
+
}
|
|
137
|
+
export function __wbg___wbindgen_is_undefined_721f8decd50c87a3(arg0) {
|
|
138
|
+
const ret = getObject(arg0) === undefined;
|
|
139
|
+
return ret;
|
|
140
|
+
}
|
|
141
|
+
export function __wbg___wbindgen_jsval_loose_eq_4b9aba9e5b3c4582(arg0, arg1) {
|
|
142
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
143
|
+
return ret;
|
|
144
|
+
}
|
|
145
|
+
export function __wbg___wbindgen_number_get_1cc01dd708740256(arg0, arg1) {
|
|
146
|
+
const obj = getObject(arg1);
|
|
147
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
148
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
149
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
150
|
+
}
|
|
151
|
+
export function __wbg___wbindgen_string_get_71bb4348194e31f0(arg0, arg1) {
|
|
152
|
+
const obj = getObject(arg1);
|
|
153
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
154
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
155
|
+
var len1 = WASM_VECTOR_LEN;
|
|
156
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
157
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
158
|
+
}
|
|
159
|
+
export function __wbg___wbindgen_throw_ea4887a5f8f9a9db(arg0, arg1) {
|
|
160
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
161
|
+
}
|
|
162
|
+
export function __wbg_call_8e98ed2f3c86c4b5() { return handleError(function (arg0, arg1) {
|
|
163
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
164
|
+
return addHeapObject(ret);
|
|
165
|
+
}, arguments); }
|
|
166
|
+
export function __wbg_done_b62d4a7d2286852a(arg0) {
|
|
167
|
+
const ret = getObject(arg0).done;
|
|
168
|
+
return ret;
|
|
169
|
+
}
|
|
170
|
+
export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
171
|
+
let deferred0_0;
|
|
172
|
+
let deferred0_1;
|
|
173
|
+
try {
|
|
174
|
+
deferred0_0 = arg0;
|
|
175
|
+
deferred0_1 = arg1;
|
|
176
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
177
|
+
} finally {
|
|
178
|
+
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export function __wbg_get_9a29be2cb383ed9a() { return handleError(function (arg0, arg1) {
|
|
182
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
183
|
+
return addHeapObject(ret);
|
|
184
|
+
}, arguments); }
|
|
185
|
+
export function __wbg_get_unchecked_54a4374c38e08460(arg0, arg1) {
|
|
186
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
187
|
+
return addHeapObject(ret);
|
|
188
|
+
}
|
|
189
|
+
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
190
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
191
|
+
return addHeapObject(ret);
|
|
192
|
+
}
|
|
193
|
+
export function __wbg_instanceof_ArrayBuffer_2a7bb09fee70c2da(arg0) {
|
|
194
|
+
let result;
|
|
195
|
+
try {
|
|
196
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
197
|
+
} catch (_) {
|
|
198
|
+
result = false;
|
|
199
|
+
}
|
|
200
|
+
const ret = result;
|
|
201
|
+
return ret;
|
|
202
|
+
}
|
|
203
|
+
export function __wbg_instanceof_Uint8Array_f080092dc70f5d58(arg0) {
|
|
204
|
+
let result;
|
|
205
|
+
try {
|
|
206
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
207
|
+
} catch (_) {
|
|
208
|
+
result = false;
|
|
209
|
+
}
|
|
210
|
+
const ret = result;
|
|
211
|
+
return ret;
|
|
212
|
+
}
|
|
213
|
+
export function __wbg_isArray_145a34fd0a38d37b(arg0) {
|
|
214
|
+
const ret = Array.isArray(getObject(arg0));
|
|
215
|
+
return ret;
|
|
216
|
+
}
|
|
217
|
+
export function __wbg_iterator_cc47ba25a2be735a() {
|
|
218
|
+
const ret = Symbol.iterator;
|
|
219
|
+
return addHeapObject(ret);
|
|
220
|
+
}
|
|
221
|
+
export function __wbg_length_589238bdcf171f0e(arg0) {
|
|
222
|
+
const ret = getObject(arg0).length;
|
|
223
|
+
return ret;
|
|
224
|
+
}
|
|
225
|
+
export function __wbg_length_c6054974c0a6cdb9(arg0) {
|
|
226
|
+
const ret = getObject(arg0).length;
|
|
227
|
+
return ret;
|
|
228
|
+
}
|
|
229
|
+
export function __wbg_new_227d7c05414eb861() {
|
|
230
|
+
const ret = new Error();
|
|
231
|
+
return addHeapObject(ret);
|
|
232
|
+
}
|
|
233
|
+
export function __wbg_new_2e117a478906f062() {
|
|
234
|
+
const ret = new Object();
|
|
235
|
+
return addHeapObject(ret);
|
|
236
|
+
}
|
|
237
|
+
export function __wbg_new_3444eb7412549f0b() {
|
|
238
|
+
const ret = new Map();
|
|
239
|
+
return addHeapObject(ret);
|
|
240
|
+
}
|
|
241
|
+
export function __wbg_new_36e147a8ced3c6e0() {
|
|
242
|
+
const ret = new Array();
|
|
243
|
+
return addHeapObject(ret);
|
|
244
|
+
}
|
|
245
|
+
export function __wbg_new_81880fb5002cb255(arg0) {
|
|
246
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
247
|
+
return addHeapObject(ret);
|
|
248
|
+
}
|
|
249
|
+
export function __wbg_next_0c4066e251d2eff9() { return handleError(function (arg0) {
|
|
250
|
+
const ret = getObject(arg0).next();
|
|
251
|
+
return addHeapObject(ret);
|
|
252
|
+
}, arguments); }
|
|
253
|
+
export function __wbg_next_402fa10b59ab20c3(arg0) {
|
|
254
|
+
const ret = getObject(arg0).next;
|
|
255
|
+
return addHeapObject(ret);
|
|
256
|
+
}
|
|
257
|
+
export function __wbg_prototypesetcall_d721637c7ca66eb8(arg0, arg1, arg2) {
|
|
258
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
259
|
+
}
|
|
260
|
+
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
261
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
262
|
+
}
|
|
263
|
+
export function __wbg_set_9a1d61e17de7054c(arg0, arg1, arg2) {
|
|
264
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
265
|
+
return addHeapObject(ret);
|
|
266
|
+
}
|
|
267
|
+
export function __wbg_set_dc601f4a69da0bc2(arg0, arg1, arg2) {
|
|
268
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
269
|
+
}
|
|
270
|
+
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
271
|
+
const ret = getObject(arg1).stack;
|
|
272
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
273
|
+
const len1 = WASM_VECTOR_LEN;
|
|
274
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
275
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
276
|
+
}
|
|
277
|
+
export function __wbg_value_49f783bb59765962(arg0) {
|
|
278
|
+
const ret = getObject(arg0).value;
|
|
279
|
+
return addHeapObject(ret);
|
|
280
|
+
}
|
|
281
|
+
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
282
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
283
|
+
const ret = arg0;
|
|
284
|
+
return addHeapObject(ret);
|
|
285
|
+
}
|
|
286
|
+
export function __wbindgen_cast_0000000000000002(arg0) {
|
|
287
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
288
|
+
const ret = arg0;
|
|
289
|
+
return addHeapObject(ret);
|
|
290
|
+
}
|
|
291
|
+
export function __wbindgen_cast_0000000000000003(arg0, arg1) {
|
|
292
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
293
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
294
|
+
return addHeapObject(ret);
|
|
295
|
+
}
|
|
296
|
+
export function __wbindgen_cast_0000000000000004(arg0) {
|
|
297
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
298
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
299
|
+
return addHeapObject(ret);
|
|
300
|
+
}
|
|
301
|
+
export function __wbindgen_object_clone_ref(arg0) {
|
|
302
|
+
const ret = getObject(arg0);
|
|
303
|
+
return addHeapObject(ret);
|
|
304
|
+
}
|
|
305
|
+
export function __wbindgen_object_drop_ref(arg0) {
|
|
306
|
+
takeObject(arg0);
|
|
307
|
+
}
|
|
308
|
+
function addHeapObject(obj) {
|
|
309
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
310
|
+
const idx = heap_next;
|
|
311
|
+
heap_next = heap[idx];
|
|
312
|
+
|
|
313
|
+
heap[idx] = obj;
|
|
314
|
+
return idx;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function debugString(val) {
|
|
318
|
+
// primitive types
|
|
319
|
+
const type = typeof val;
|
|
320
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
321
|
+
return `${val}`;
|
|
322
|
+
}
|
|
323
|
+
if (type == 'string') {
|
|
324
|
+
return `"${val}"`;
|
|
325
|
+
}
|
|
326
|
+
if (type == 'symbol') {
|
|
327
|
+
const description = val.description;
|
|
328
|
+
if (description == null) {
|
|
329
|
+
return 'Symbol';
|
|
330
|
+
} else {
|
|
331
|
+
return `Symbol(${description})`;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (type == 'function') {
|
|
335
|
+
const name = val.name;
|
|
336
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
337
|
+
return `Function(${name})`;
|
|
338
|
+
} else {
|
|
339
|
+
return 'Function';
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
// objects
|
|
343
|
+
if (Array.isArray(val)) {
|
|
344
|
+
const length = val.length;
|
|
345
|
+
let debug = '[';
|
|
346
|
+
if (length > 0) {
|
|
347
|
+
debug += debugString(val[0]);
|
|
348
|
+
}
|
|
349
|
+
for(let i = 1; i < length; i++) {
|
|
350
|
+
debug += ', ' + debugString(val[i]);
|
|
351
|
+
}
|
|
352
|
+
debug += ']';
|
|
353
|
+
return debug;
|
|
354
|
+
}
|
|
355
|
+
// Test for built-in
|
|
356
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
357
|
+
let className;
|
|
358
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
359
|
+
className = builtInMatches[1];
|
|
360
|
+
} else {
|
|
361
|
+
// Failed to match the standard '[object ClassName]'
|
|
362
|
+
return toString.call(val);
|
|
363
|
+
}
|
|
364
|
+
if (className == 'Object') {
|
|
365
|
+
// we're a user defined class or Object
|
|
366
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
367
|
+
// easier than looping through ownProperties of `val`.
|
|
368
|
+
try {
|
|
369
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
370
|
+
} catch (_) {
|
|
371
|
+
return 'Object';
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
// errors
|
|
375
|
+
if (val instanceof Error) {
|
|
376
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
377
|
+
}
|
|
378
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
379
|
+
return className;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function dropObject(idx) {
|
|
383
|
+
if (idx < 1028) return;
|
|
384
|
+
heap[idx] = heap_next;
|
|
385
|
+
heap_next = idx;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
389
|
+
ptr = ptr >>> 0;
|
|
390
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
let cachedDataViewMemory0 = null;
|
|
394
|
+
function getDataViewMemory0() {
|
|
395
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
396
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
397
|
+
}
|
|
398
|
+
return cachedDataViewMemory0;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function getStringFromWasm0(ptr, len) {
|
|
402
|
+
return decodeText(ptr >>> 0, len);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
let cachedUint8ArrayMemory0 = null;
|
|
406
|
+
function getUint8ArrayMemory0() {
|
|
407
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
408
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
409
|
+
}
|
|
410
|
+
return cachedUint8ArrayMemory0;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function getObject(idx) { return heap[idx]; }
|
|
414
|
+
|
|
415
|
+
function handleError(f, args) {
|
|
416
|
+
try {
|
|
417
|
+
return f.apply(this, args);
|
|
418
|
+
} catch (e) {
|
|
419
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
let heap = new Array(1024).fill(undefined);
|
|
424
|
+
heap.push(undefined, null, true, false);
|
|
425
|
+
|
|
426
|
+
let heap_next = heap.length;
|
|
427
|
+
|
|
428
|
+
function isLikeNone(x) {
|
|
429
|
+
return x === undefined || x === null;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
433
|
+
if (realloc === undefined) {
|
|
434
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
435
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
436
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
437
|
+
WASM_VECTOR_LEN = buf.length;
|
|
438
|
+
return ptr;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
let len = arg.length;
|
|
442
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
443
|
+
|
|
444
|
+
const mem = getUint8ArrayMemory0();
|
|
445
|
+
|
|
446
|
+
let offset = 0;
|
|
447
|
+
|
|
448
|
+
for (; offset < len; offset++) {
|
|
449
|
+
const code = arg.charCodeAt(offset);
|
|
450
|
+
if (code > 0x7F) break;
|
|
451
|
+
mem[ptr + offset] = code;
|
|
452
|
+
}
|
|
453
|
+
if (offset !== len) {
|
|
454
|
+
if (offset !== 0) {
|
|
455
|
+
arg = arg.slice(offset);
|
|
456
|
+
}
|
|
457
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
458
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
459
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
460
|
+
|
|
461
|
+
offset += ret.written;
|
|
462
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
WASM_VECTOR_LEN = offset;
|
|
466
|
+
return ptr;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function takeObject(idx) {
|
|
470
|
+
const ret = getObject(idx);
|
|
471
|
+
dropObject(idx);
|
|
472
|
+
return ret;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
476
|
+
cachedTextDecoder.decode();
|
|
477
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
478
|
+
let numBytesDecoded = 0;
|
|
479
|
+
function decodeText(ptr, len) {
|
|
480
|
+
numBytesDecoded += len;
|
|
481
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
482
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
483
|
+
cachedTextDecoder.decode();
|
|
484
|
+
numBytesDecoded = len;
|
|
485
|
+
}
|
|
486
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
const cachedTextEncoder = new TextEncoder();
|
|
490
|
+
|
|
491
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
492
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
493
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
494
|
+
view.set(buf);
|
|
495
|
+
return {
|
|
496
|
+
read: arg.length,
|
|
497
|
+
written: buf.length
|
|
498
|
+
};
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
let WASM_VECTOR_LEN = 0;
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
let wasm;
|
|
506
|
+
export function __wbg_set_wasm(val) {
|
|
507
|
+
wasm = val;
|
|
508
|
+
}
|
package/okftool_bg.wasm
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ryansann/okftool",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "WebAssembly bindings for okftool-core (the @ryansann/okftool npm package).",
|
|
5
|
+
"version": "0.1.5",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/ryansann/okftool.git"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"okftool_bg.wasm",
|
|
13
|
+
"okftool.js",
|
|
14
|
+
"okftool_bg.js",
|
|
15
|
+
"okftool.d.ts"
|
|
16
|
+
],
|
|
17
|
+
"main": "okftool.js",
|
|
18
|
+
"homepage": "https://github.com/ryansann/okftool",
|
|
19
|
+
"types": "okftool.d.ts",
|
|
20
|
+
"sideEffects": [
|
|
21
|
+
"./okftool.js",
|
|
22
|
+
"./snippets/*"
|
|
23
|
+
]
|
|
24
|
+
}
|