@ryansann/okftool 0.1.5 → 0.1.6

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.
@@ -0,0 +1,14 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const init: () => void;
5
+ export const lint: (a: number, b: number, c: number, d: number) => void;
6
+ export const okf_version: (a: number) => void;
7
+ export const rules: (a: number) => void;
8
+ export const validate: (a: number, b: number) => void;
9
+ export const __wbindgen_export: (a: number, b: number) => number;
10
+ export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
11
+ export const __wbindgen_export3: (a: number) => void;
12
+ export const __wbindgen_export4: (a: number, b: number, c: number) => void;
13
+ export const __wbindgen_add_to_stack_pointer: (a: number) => number;
14
+ export const __wbindgen_start: () => void;
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "okftool-wasm",
3
+ "type": "module",
4
+ "description": "WebAssembly bindings for okftool-core (the @ryansann/okftool npm package).",
5
+ "version": "0.1.6",
6
+ "license": "Apache-2.0",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/ryansann/okftool"
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
+ }
@@ -0,0 +1,518 @@
1
+ /* @ts-self-types="./okftool.d.ts" */
2
+
3
+ /**
4
+ * Initialize panic forwarding to `console.error`. Safe to call more than once.
5
+ */
6
+ function init() {
7
+ wasm.init();
8
+ }
9
+ exports.init = init;
10
+
11
+ /**
12
+ * Validate *and* lint a bundle. `config_yaml` is the contents of a
13
+ * `.okftool.yaml` (empty string → the okf-recommended profile). Returns the
14
+ * serialized `Bundle` with spec + lint diagnostics merged.
15
+ * @param {any} files
16
+ * @param {string | null} [config_yaml]
17
+ * @returns {any}
18
+ */
19
+ function lint(files, config_yaml) {
20
+ try {
21
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
22
+ var ptr0 = isLikeNone(config_yaml) ? 0 : passStringToWasm0(config_yaml, wasm.__wbindgen_export, wasm.__wbindgen_export2);
23
+ var len0 = WASM_VECTOR_LEN;
24
+ wasm.lint(retptr, addHeapObject(files), ptr0, len0);
25
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
26
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
27
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
28
+ if (r2) {
29
+ throw takeObject(r1);
30
+ }
31
+ return takeObject(r0);
32
+ } finally {
33
+ wasm.__wbindgen_add_to_stack_pointer(16);
34
+ }
35
+ }
36
+ exports.lint = lint;
37
+
38
+ /**
39
+ * The OKF spec version this build targets.
40
+ * @returns {string}
41
+ */
42
+ function okf_version() {
43
+ let deferred1_0;
44
+ let deferred1_1;
45
+ try {
46
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
47
+ wasm.okf_version(retptr);
48
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
49
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
50
+ deferred1_0 = r0;
51
+ deferred1_1 = r1;
52
+ return getStringFromWasm0(r0, r1);
53
+ } finally {
54
+ wasm.__wbindgen_add_to_stack_pointer(16);
55
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
56
+ }
57
+ }
58
+ exports.okf_version = okf_version;
59
+
60
+ /**
61
+ * The rule manifest: `[{ id, category, summary, rationale, defaultSeverity, fixable }]`.
62
+ * Powers an in-app "explain" / rule browser.
63
+ * @returns {any}
64
+ */
65
+ function rules() {
66
+ try {
67
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
68
+ wasm.rules(retptr);
69
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
70
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
71
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
72
+ if (r2) {
73
+ throw takeObject(r1);
74
+ }
75
+ return takeObject(r0);
76
+ } finally {
77
+ wasm.__wbindgen_add_to_stack_pointer(16);
78
+ }
79
+ }
80
+ exports.rules = rules;
81
+
82
+ /**
83
+ * Validate a bundle against the OKF spec (§9). `files` is
84
+ * `Array<{ path, content }>`; returns the serialized `Bundle`.
85
+ * @param {any} files
86
+ * @returns {any}
87
+ */
88
+ function validate(files) {
89
+ try {
90
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
91
+ wasm.validate(retptr, addHeapObject(files));
92
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
93
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
94
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
95
+ if (r2) {
96
+ throw takeObject(r1);
97
+ }
98
+ return takeObject(r0);
99
+ } finally {
100
+ wasm.__wbindgen_add_to_stack_pointer(16);
101
+ }
102
+ }
103
+ exports.validate = validate;
104
+ function __wbg_get_imports() {
105
+ const import0 = {
106
+ __proto__: null,
107
+ __wbg_Error_fdd633d4bb5dd76a: function(arg0, arg1) {
108
+ const ret = Error(getStringFromWasm0(arg0, arg1));
109
+ return addHeapObject(ret);
110
+ },
111
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
112
+ const ret = String(getObject(arg1));
113
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
114
+ const len1 = WASM_VECTOR_LEN;
115
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
116
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
117
+ },
118
+ __wbg___wbindgen_boolean_get_edaed31a367ce1bd: function(arg0) {
119
+ const v = getObject(arg0);
120
+ const ret = typeof(v) === 'boolean' ? v : undefined;
121
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
122
+ },
123
+ __wbg___wbindgen_debug_string_8a447059637473e2: function(arg0, arg1) {
124
+ const ret = debugString(getObject(arg1));
125
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
126
+ const len1 = WASM_VECTOR_LEN;
127
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
128
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
129
+ },
130
+ __wbg___wbindgen_in_4990f46af709e33c: function(arg0, arg1) {
131
+ const ret = getObject(arg0) in getObject(arg1);
132
+ return ret;
133
+ },
134
+ __wbg___wbindgen_is_function_acc5528be2b923f2: function(arg0) {
135
+ const ret = typeof(getObject(arg0)) === 'function';
136
+ return ret;
137
+ },
138
+ __wbg___wbindgen_is_object_0beba4a1980d3eea: function(arg0) {
139
+ const val = getObject(arg0);
140
+ const ret = typeof(val) === 'object' && val !== null;
141
+ return ret;
142
+ },
143
+ __wbg___wbindgen_is_string_1fca8072260dd261: function(arg0) {
144
+ const ret = typeof(getObject(arg0)) === 'string';
145
+ return ret;
146
+ },
147
+ __wbg___wbindgen_is_undefined_721f8decd50c87a3: function(arg0) {
148
+ const ret = getObject(arg0) === undefined;
149
+ return ret;
150
+ },
151
+ __wbg___wbindgen_jsval_loose_eq_4b9aba9e5b3c4582: function(arg0, arg1) {
152
+ const ret = getObject(arg0) == getObject(arg1);
153
+ return ret;
154
+ },
155
+ __wbg___wbindgen_number_get_1cc01dd708740256: function(arg0, arg1) {
156
+ const obj = getObject(arg1);
157
+ const ret = typeof(obj) === 'number' ? obj : undefined;
158
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
159
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
160
+ },
161
+ __wbg___wbindgen_string_get_71bb4348194e31f0: function(arg0, arg1) {
162
+ const obj = getObject(arg1);
163
+ const ret = typeof(obj) === 'string' ? obj : undefined;
164
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
165
+ var len1 = WASM_VECTOR_LEN;
166
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
167
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
168
+ },
169
+ __wbg___wbindgen_throw_ea4887a5f8f9a9db: function(arg0, arg1) {
170
+ throw new Error(getStringFromWasm0(arg0, arg1));
171
+ },
172
+ __wbg_call_8e98ed2f3c86c4b5: function() { return handleError(function (arg0, arg1) {
173
+ const ret = getObject(arg0).call(getObject(arg1));
174
+ return addHeapObject(ret);
175
+ }, arguments); },
176
+ __wbg_done_b62d4a7d2286852a: function(arg0) {
177
+ const ret = getObject(arg0).done;
178
+ return ret;
179
+ },
180
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
181
+ let deferred0_0;
182
+ let deferred0_1;
183
+ try {
184
+ deferred0_0 = arg0;
185
+ deferred0_1 = arg1;
186
+ console.error(getStringFromWasm0(arg0, arg1));
187
+ } finally {
188
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
189
+ }
190
+ },
191
+ __wbg_get_9a29be2cb383ed9a: function() { return handleError(function (arg0, arg1) {
192
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
193
+ return addHeapObject(ret);
194
+ }, arguments); },
195
+ __wbg_get_unchecked_54a4374c38e08460: function(arg0, arg1) {
196
+ const ret = getObject(arg0)[arg1 >>> 0];
197
+ return addHeapObject(ret);
198
+ },
199
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
200
+ const ret = getObject(arg0)[getObject(arg1)];
201
+ return addHeapObject(ret);
202
+ },
203
+ __wbg_instanceof_ArrayBuffer_2a7bb09fee70c2da: function(arg0) {
204
+ let result;
205
+ try {
206
+ result = getObject(arg0) instanceof ArrayBuffer;
207
+ } catch (_) {
208
+ result = false;
209
+ }
210
+ const ret = result;
211
+ return ret;
212
+ },
213
+ __wbg_instanceof_Uint8Array_f080092dc70f5d58: function(arg0) {
214
+ let result;
215
+ try {
216
+ result = getObject(arg0) instanceof Uint8Array;
217
+ } catch (_) {
218
+ result = false;
219
+ }
220
+ const ret = result;
221
+ return ret;
222
+ },
223
+ __wbg_isArray_145a34fd0a38d37b: function(arg0) {
224
+ const ret = Array.isArray(getObject(arg0));
225
+ return ret;
226
+ },
227
+ __wbg_iterator_cc47ba25a2be735a: function() {
228
+ const ret = Symbol.iterator;
229
+ return addHeapObject(ret);
230
+ },
231
+ __wbg_length_589238bdcf171f0e: function(arg0) {
232
+ const ret = getObject(arg0).length;
233
+ return ret;
234
+ },
235
+ __wbg_length_c6054974c0a6cdb9: function(arg0) {
236
+ const ret = getObject(arg0).length;
237
+ return ret;
238
+ },
239
+ __wbg_new_227d7c05414eb861: function() {
240
+ const ret = new Error();
241
+ return addHeapObject(ret);
242
+ },
243
+ __wbg_new_2e117a478906f062: function() {
244
+ const ret = new Object();
245
+ return addHeapObject(ret);
246
+ },
247
+ __wbg_new_3444eb7412549f0b: function() {
248
+ const ret = new Map();
249
+ return addHeapObject(ret);
250
+ },
251
+ __wbg_new_36e147a8ced3c6e0: function() {
252
+ const ret = new Array();
253
+ return addHeapObject(ret);
254
+ },
255
+ __wbg_new_81880fb5002cb255: function(arg0) {
256
+ const ret = new Uint8Array(getObject(arg0));
257
+ return addHeapObject(ret);
258
+ },
259
+ __wbg_next_0c4066e251d2eff9: function() { return handleError(function (arg0) {
260
+ const ret = getObject(arg0).next();
261
+ return addHeapObject(ret);
262
+ }, arguments); },
263
+ __wbg_next_402fa10b59ab20c3: function(arg0) {
264
+ const ret = getObject(arg0).next;
265
+ return addHeapObject(ret);
266
+ },
267
+ __wbg_prototypesetcall_d721637c7ca66eb8: function(arg0, arg1, arg2) {
268
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
269
+ },
270
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
271
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
272
+ },
273
+ __wbg_set_9a1d61e17de7054c: function(arg0, arg1, arg2) {
274
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
275
+ return addHeapObject(ret);
276
+ },
277
+ __wbg_set_dc601f4a69da0bc2: function(arg0, arg1, arg2) {
278
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
279
+ },
280
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
281
+ const ret = getObject(arg1).stack;
282
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
283
+ const len1 = WASM_VECTOR_LEN;
284
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
285
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
286
+ },
287
+ __wbg_value_49f783bb59765962: function(arg0) {
288
+ const ret = getObject(arg0).value;
289
+ return addHeapObject(ret);
290
+ },
291
+ __wbindgen_cast_0000000000000001: function(arg0) {
292
+ // Cast intrinsic for `F64 -> Externref`.
293
+ const ret = arg0;
294
+ return addHeapObject(ret);
295
+ },
296
+ __wbindgen_cast_0000000000000002: function(arg0) {
297
+ // Cast intrinsic for `I64 -> Externref`.
298
+ const ret = arg0;
299
+ return addHeapObject(ret);
300
+ },
301
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
302
+ // Cast intrinsic for `Ref(String) -> Externref`.
303
+ const ret = getStringFromWasm0(arg0, arg1);
304
+ return addHeapObject(ret);
305
+ },
306
+ __wbindgen_cast_0000000000000004: function(arg0) {
307
+ // Cast intrinsic for `U64 -> Externref`.
308
+ const ret = BigInt.asUintN(64, arg0);
309
+ return addHeapObject(ret);
310
+ },
311
+ __wbindgen_object_clone_ref: function(arg0) {
312
+ const ret = getObject(arg0);
313
+ return addHeapObject(ret);
314
+ },
315
+ __wbindgen_object_drop_ref: function(arg0) {
316
+ takeObject(arg0);
317
+ },
318
+ };
319
+ return {
320
+ __proto__: null,
321
+ "./okftool_bg.js": import0,
322
+ };
323
+ }
324
+
325
+ function addHeapObject(obj) {
326
+ if (heap_next === heap.length) heap.push(heap.length + 1);
327
+ const idx = heap_next;
328
+ heap_next = heap[idx];
329
+
330
+ heap[idx] = obj;
331
+ return idx;
332
+ }
333
+
334
+ function debugString(val) {
335
+ // primitive types
336
+ const type = typeof val;
337
+ if (type == 'number' || type == 'boolean' || val == null) {
338
+ return `${val}`;
339
+ }
340
+ if (type == 'string') {
341
+ return `"${val}"`;
342
+ }
343
+ if (type == 'symbol') {
344
+ const description = val.description;
345
+ if (description == null) {
346
+ return 'Symbol';
347
+ } else {
348
+ return `Symbol(${description})`;
349
+ }
350
+ }
351
+ if (type == 'function') {
352
+ const name = val.name;
353
+ if (typeof name == 'string' && name.length > 0) {
354
+ return `Function(${name})`;
355
+ } else {
356
+ return 'Function';
357
+ }
358
+ }
359
+ // objects
360
+ if (Array.isArray(val)) {
361
+ const length = val.length;
362
+ let debug = '[';
363
+ if (length > 0) {
364
+ debug += debugString(val[0]);
365
+ }
366
+ for(let i = 1; i < length; i++) {
367
+ debug += ', ' + debugString(val[i]);
368
+ }
369
+ debug += ']';
370
+ return debug;
371
+ }
372
+ // Test for built-in
373
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
374
+ let className;
375
+ if (builtInMatches && builtInMatches.length > 1) {
376
+ className = builtInMatches[1];
377
+ } else {
378
+ // Failed to match the standard '[object ClassName]'
379
+ return toString.call(val);
380
+ }
381
+ if (className == 'Object') {
382
+ // we're a user defined class or Object
383
+ // JSON.stringify avoids problems with cycles, and is generally much
384
+ // easier than looping through ownProperties of `val`.
385
+ try {
386
+ return 'Object(' + JSON.stringify(val) + ')';
387
+ } catch (_) {
388
+ return 'Object';
389
+ }
390
+ }
391
+ // errors
392
+ if (val instanceof Error) {
393
+ return `${val.name}: ${val.message}\n${val.stack}`;
394
+ }
395
+ // TODO we could test for more things here, like `Set`s and `Map`s.
396
+ return className;
397
+ }
398
+
399
+ function dropObject(idx) {
400
+ if (idx < 1028) return;
401
+ heap[idx] = heap_next;
402
+ heap_next = idx;
403
+ }
404
+
405
+ function getArrayU8FromWasm0(ptr, len) {
406
+ ptr = ptr >>> 0;
407
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
408
+ }
409
+
410
+ let cachedDataViewMemory0 = null;
411
+ function getDataViewMemory0() {
412
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
413
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
414
+ }
415
+ return cachedDataViewMemory0;
416
+ }
417
+
418
+ function getStringFromWasm0(ptr, len) {
419
+ return decodeText(ptr >>> 0, len);
420
+ }
421
+
422
+ let cachedUint8ArrayMemory0 = null;
423
+ function getUint8ArrayMemory0() {
424
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
425
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
426
+ }
427
+ return cachedUint8ArrayMemory0;
428
+ }
429
+
430
+ function getObject(idx) { return heap[idx]; }
431
+
432
+ function handleError(f, args) {
433
+ try {
434
+ return f.apply(this, args);
435
+ } catch (e) {
436
+ wasm.__wbindgen_export3(addHeapObject(e));
437
+ }
438
+ }
439
+
440
+ let heap = new Array(1024).fill(undefined);
441
+ heap.push(undefined, null, true, false);
442
+
443
+ let heap_next = heap.length;
444
+
445
+ function isLikeNone(x) {
446
+ return x === undefined || x === null;
447
+ }
448
+
449
+ function passStringToWasm0(arg, malloc, realloc) {
450
+ if (realloc === undefined) {
451
+ const buf = cachedTextEncoder.encode(arg);
452
+ const ptr = malloc(buf.length, 1) >>> 0;
453
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
454
+ WASM_VECTOR_LEN = buf.length;
455
+ return ptr;
456
+ }
457
+
458
+ let len = arg.length;
459
+ let ptr = malloc(len, 1) >>> 0;
460
+
461
+ const mem = getUint8ArrayMemory0();
462
+
463
+ let offset = 0;
464
+
465
+ for (; offset < len; offset++) {
466
+ const code = arg.charCodeAt(offset);
467
+ if (code > 0x7F) break;
468
+ mem[ptr + offset] = code;
469
+ }
470
+ if (offset !== len) {
471
+ if (offset !== 0) {
472
+ arg = arg.slice(offset);
473
+ }
474
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
475
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
476
+ const ret = cachedTextEncoder.encodeInto(arg, view);
477
+
478
+ offset += ret.written;
479
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
480
+ }
481
+
482
+ WASM_VECTOR_LEN = offset;
483
+ return ptr;
484
+ }
485
+
486
+ function takeObject(idx) {
487
+ const ret = getObject(idx);
488
+ dropObject(idx);
489
+ return ret;
490
+ }
491
+
492
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
493
+ cachedTextDecoder.decode();
494
+ function decodeText(ptr, len) {
495
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
496
+ }
497
+
498
+ const cachedTextEncoder = new TextEncoder();
499
+
500
+ if (!('encodeInto' in cachedTextEncoder)) {
501
+ cachedTextEncoder.encodeInto = function (arg, view) {
502
+ const buf = cachedTextEncoder.encode(arg);
503
+ view.set(buf);
504
+ return {
505
+ read: arg.length,
506
+ written: buf.length
507
+ };
508
+ };
509
+ }
510
+
511
+ let WASM_VECTOR_LEN = 0;
512
+
513
+ const wasmPath = `${__dirname}/okftool_bg.wasm`;
514
+ const wasmBytes = require('fs').readFileSync(wasmPath);
515
+ const wasmModule = new WebAssembly.Module(wasmBytes);
516
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
517
+ let wasm = wasmInstance.exports;
518
+ wasm.__wbindgen_start();
@@ -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;
Binary file
@@ -0,0 +1,14 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const init: () => void;
5
+ export const lint: (a: number, b: number, c: number, d: number) => void;
6
+ export const okf_version: (a: number) => void;
7
+ export const rules: (a: number) => void;
8
+ export const validate: (a: number, b: number) => void;
9
+ export const __wbindgen_export: (a: number, b: number) => number;
10
+ export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
11
+ export const __wbindgen_export3: (a: number) => void;
12
+ export const __wbindgen_export4: (a: number, b: number, c: number) => void;
13
+ export const __wbindgen_add_to_stack_pointer: (a: number) => number;
14
+ export const __wbindgen_start: () => void;
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "okftool-wasm",
3
+ "description": "WebAssembly bindings for okftool-core (the @ryansann/okftool npm package).",
4
+ "version": "0.1.6",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/ryansann/okftool"
9
+ },
10
+ "files": [
11
+ "okftool_bg.wasm",
12
+ "okftool.js",
13
+ "okftool.d.ts"
14
+ ],
15
+ "main": "okftool.js",
16
+ "homepage": "https://github.com/ryansann/okftool",
17
+ "types": "okftool.d.ts"
18
+ }
package/package.json CHANGED
@@ -1,24 +1,35 @@
1
1
  {
2
2
  "name": "@ryansann/okftool",
3
+ "version": "0.1.6",
3
4
  "type": "module",
4
5
  "description": "WebAssembly bindings for okftool-core (the @ryansann/okftool npm package).",
5
- "version": "0.1.5",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/ryansann/okftool.git"
10
10
  },
11
+ "homepage": "https://github.com/ryansann/okftool",
12
+ "main": "./node/okftool.cjs",
13
+ "module": "./browser/okftool.js",
14
+ "types": "./browser/okftool.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "browser": "./browser/okftool.js",
18
+ "node": "./node/okftool.cjs",
19
+ "import": "./browser/okftool.js",
20
+ "default": "./browser/okftool.js"
21
+ },
22
+ "./node": "./node/okftool.cjs",
23
+ "./browser": "./browser/okftool.js"
24
+ },
11
25
  "files": [
12
- "okftool_bg.wasm",
13
- "okftool.js",
14
- "okftool_bg.js",
15
- "okftool.d.ts"
26
+ "browser",
27
+ "node",
28
+ "README.md",
29
+ "LICENSE"
16
30
  ],
17
- "main": "okftool.js",
18
- "homepage": "https://github.com/ryansann/okftool",
19
- "types": "okftool.d.ts",
20
31
  "sideEffects": [
21
- "./okftool.js",
22
- "./snippets/*"
32
+ "./browser/okftool.js",
33
+ "./browser/snippets/*"
23
34
  ]
24
35
  }
File without changes
File without changes
File without changes