jlens-wasm 0.18.0 → 0.20.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/jlens.d.ts +17 -4
- package/jlens.js +41 -8
- package/jlens_bg.wasm +0 -0
- package/jlens_bg.wasm.d.ts +1 -1
- package/package.json +1 -1
- package/snippets/jlens-wasm-f9fad0160b1217f6/inline1.js +48 -0
- package/snippets/jlens-wasm-f9fad0160b1217f6/inline3.js +45 -0
- /package/snippets/{jlens-wasm-b5dd6593a6f87d95 → jlens-wasm-f9fad0160b1217f6}/inline0.js +0 -0
- /package/snippets/{jlens-wasm-b5dd6593a6f87d95/inline1.js → jlens-wasm-f9fad0160b1217f6/inline2.js} +0 -0
package/jlens.d.ts
CHANGED
|
@@ -27,12 +27,23 @@ export type HostFunction = (...args: any[]) => unknown;
|
|
|
27
27
|
*/
|
|
28
28
|
export type Callable = ((...args: any[]) => unknown) & { readonly arity: number };
|
|
29
29
|
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Evaluation guardrails, and the clock and seed that make an evaluation reproducible. Each
|
|
32
|
+
* option is read once, as a property (getters and inherited properties included, `toJSON` not
|
|
33
|
+
* called); `undefined` and `null` mean the default. A number must be finite: `NaN` and
|
|
34
|
+
* `Infinity` throw a `TypeError`, as other invalid values do.
|
|
35
|
+
*/
|
|
31
36
|
export interface EvaluateOptions {
|
|
32
37
|
/** Maximum duration of one evaluation, in milliseconds (error `D1012`). */
|
|
33
38
|
timeout?: number;
|
|
34
39
|
/** Maximum evaluation depth (default 500; error `D1011`). */
|
|
35
40
|
maxDepth?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Maximum number of evaluation steps (error `U1006`): each node evaluated, each function
|
|
43
|
+
* called back and each 1,024 steps of a regular expression's backtracking. The same
|
|
44
|
+
* expression, input and options take the same steps on every machine and natively.
|
|
45
|
+
*/
|
|
46
|
+
maxSteps?: number;
|
|
36
47
|
/** Maximum length, in bytes of UTF-8, of a string the evaluation builds (default 256 MiB; error `U1001`). */
|
|
37
48
|
maxStringLength?: number;
|
|
38
49
|
/** Maximum number of items of an array the evaluation builds (default 16,777,216; error `U1001`). */
|
|
@@ -44,8 +55,8 @@ export interface EvaluateOptions {
|
|
|
44
55
|
*/
|
|
45
56
|
maxResultSize?: number;
|
|
46
57
|
/**
|
|
47
|
-
* The evaluation's timestamp for `$now()` and `$millis()`:
|
|
48
|
-
* `Date` or an ISO 8601 timestamp. Default: the system clock.
|
|
58
|
+
* The evaluation's timestamp for `$now()` and `$millis()`: an integer number of milliseconds
|
|
59
|
+
* since the epoch, a valid `Date` or an ISO 8601 timestamp. Default: the system clock.
|
|
49
60
|
*/
|
|
50
61
|
now?: number | Date | string;
|
|
51
62
|
/** Seed for `$random()` and `$shuffle()`: the same seed gives the same results. */
|
|
@@ -150,6 +161,8 @@ export interface AuditHeader {
|
|
|
150
161
|
/** The evaluation timestamp (`$now()`), in ISO 8601. */
|
|
151
162
|
timestamp: string;
|
|
152
163
|
durationMs: number;
|
|
164
|
+
/** The steps the evaluation took, which an evaluation without an audit takes too. */
|
|
165
|
+
steps: number;
|
|
153
166
|
level: AuditLevel;
|
|
154
167
|
result?: unknown;
|
|
155
168
|
error?: { code: string; message: string };
|
|
@@ -527,7 +540,7 @@ export interface InitOutput {
|
|
|
527
540
|
readonly parseRecover: (a: number, b: number) => any;
|
|
528
541
|
readonly unionReads: (a: any) => [number, number, number];
|
|
529
542
|
readonly version: () => [number, number];
|
|
530
|
-
readonly
|
|
543
|
+
readonly wasm_bindgen_83299752791f6fbb___convert__closures_____invoke___js_sys_f067e63b4fcf480b___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_83299752791f6fbb___JsValue__wasm_bindgen_83299752791f6fbb___JsValue___false_: (a: number, b: number, c: any) => [number, number, number];
|
|
531
544
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
532
545
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
533
546
|
readonly __wbindgen_exn_store: (a: number) => void;
|
package/jlens.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/* @ts-self-types="./jlens.d.ts" */
|
|
2
|
-
import { jlensCallable } from './snippets/jlens-wasm-
|
|
3
|
-
import {
|
|
2
|
+
import { jlensCallable } from './snippets/jlens-wasm-f9fad0160b1217f6/inline0.js';
|
|
3
|
+
import { jlensBuild } from './snippets/jlens-wasm-f9fad0160b1217f6/inline1.js';
|
|
4
|
+
import { jlensLevel } from './snippets/jlens-wasm-f9fad0160b1217f6/inline2.js';
|
|
5
|
+
import { jlensNow, jlensOptions } from './snippets/jlens-wasm-f9fad0160b1217f6/inline3.js';
|
|
6
|
+
import * as import1 from "./snippets/jlens-wasm-f9fad0160b1217f6/inline3.js"
|
|
4
7
|
|
|
5
8
|
|
|
6
9
|
/**
|
|
@@ -463,14 +466,29 @@ function __wbg_get_imports() {
|
|
|
463
466
|
const ret = Array.isArray(arg0);
|
|
464
467
|
return ret;
|
|
465
468
|
},
|
|
466
|
-
|
|
469
|
+
__wbg_jlensBuild_180aed8bd26138d4: function(arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
470
|
+
const ret = jlensBuild(getArrayU32FromWasm0(arg0, arg1), getArrayF64FromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
|
|
471
|
+
return ret;
|
|
472
|
+
},
|
|
473
|
+
__wbg_jlensCallable_0776c9a0a6a3f726: function(arg0, arg1) {
|
|
467
474
|
const ret = jlensCallable(arg0, arg1 >>> 0);
|
|
468
475
|
return ret;
|
|
469
476
|
},
|
|
470
|
-
|
|
477
|
+
__wbg_jlensLevel_8f4ed9a19341e81e: function() { return handleError(function (arg0, arg1, arg2) {
|
|
471
478
|
const ret = jlensLevel(arg0, arg1 >>> 0, arg2 >>> 0);
|
|
472
479
|
return ret;
|
|
473
480
|
}, arguments); },
|
|
481
|
+
__wbg_jlensNow_f5fae1a30a449dc2: function(arg0) {
|
|
482
|
+
const ret = jlensNow();
|
|
483
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
484
|
+
const len1 = WASM_VECTOR_LEN;
|
|
485
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
486
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
487
|
+
},
|
|
488
|
+
__wbg_jlensOptions_3891f02712705fec: function() { return handleError(function (arg0) {
|
|
489
|
+
const ret = jlensOptions(arg0);
|
|
490
|
+
return ret;
|
|
491
|
+
}, arguments); },
|
|
474
492
|
__wbg_length_3121141f8e1c8c58: function(arg0) {
|
|
475
493
|
const ret = arg0.length;
|
|
476
494
|
return ret;
|
|
@@ -554,9 +572,9 @@ function __wbg_get_imports() {
|
|
|
554
572
|
}, arguments); },
|
|
555
573
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
556
574
|
var state0 = {a: arg0, b: arg1};
|
|
557
|
-
var cb0 = (arg0) =>
|
|
575
|
+
var cb0 = (arg0) => wasm_bindgen_83299752791f6fbb___convert__closures_____invoke___js_sys_f067e63b4fcf480b___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_83299752791f6fbb___JsValue__wasm_bindgen_83299752791f6fbb___JsValue___false_(state0.a, state0.b, arg0);
|
|
558
576
|
cb0._wbg_cb_unref = () => state0.a = 0;
|
|
559
|
-
// Cast intrinsic for `Closure(Closure { owned: false, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx:
|
|
577
|
+
// Cast intrinsic for `Closure(Closure { owned: false, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 9, ret: Result(Externref), inner_ret: Some(Result(Externref)) }, mutable: false }) -> Externref`.
|
|
560
578
|
const ret = cb0;
|
|
561
579
|
return ret;
|
|
562
580
|
},
|
|
@@ -583,11 +601,12 @@ function __wbg_get_imports() {
|
|
|
583
601
|
return {
|
|
584
602
|
__proto__: null,
|
|
585
603
|
"./jlens_bg.js": import0,
|
|
604
|
+
"./snippets/jlens-wasm-f9fad0160b1217f6/inline3.js": import1,
|
|
586
605
|
};
|
|
587
606
|
}
|
|
588
607
|
|
|
589
|
-
function
|
|
590
|
-
const ret = wasm.
|
|
608
|
+
function wasm_bindgen_83299752791f6fbb___convert__closures_____invoke___js_sys_f067e63b4fcf480b___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_83299752791f6fbb___JsValue__wasm_bindgen_83299752791f6fbb___JsValue___false_(arg0, arg1, arg2) {
|
|
609
|
+
const ret = wasm.wasm_bindgen_83299752791f6fbb___convert__closures_____invoke___js_sys_f067e63b4fcf480b___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_83299752791f6fbb___JsValue__wasm_bindgen_83299752791f6fbb___JsValue___false_(arg0, arg1, arg2);
|
|
591
610
|
if (ret[2]) {
|
|
592
611
|
throw takeFromExternrefTable0(ret[1]);
|
|
593
612
|
}
|
|
@@ -686,6 +705,11 @@ function getArrayF64FromWasm0(ptr, len) {
|
|
|
686
705
|
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
687
706
|
}
|
|
688
707
|
|
|
708
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
709
|
+
ptr = ptr >>> 0;
|
|
710
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
711
|
+
}
|
|
712
|
+
|
|
689
713
|
let cachedDataViewMemory0 = null;
|
|
690
714
|
function getDataViewMemory0() {
|
|
691
715
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
@@ -706,6 +730,14 @@ function getStringFromWasm0(ptr, len) {
|
|
|
706
730
|
return decodeText(ptr >>> 0, len);
|
|
707
731
|
}
|
|
708
732
|
|
|
733
|
+
let cachedUint32ArrayMemory0 = null;
|
|
734
|
+
function getUint32ArrayMemory0() {
|
|
735
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
736
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
737
|
+
}
|
|
738
|
+
return cachedUint32ArrayMemory0;
|
|
739
|
+
}
|
|
740
|
+
|
|
709
741
|
let cachedUint8ArrayMemory0 = null;
|
|
710
742
|
function getUint8ArrayMemory0() {
|
|
711
743
|
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
@@ -806,6 +838,7 @@ function __wbg_finalize_init(instance, module) {
|
|
|
806
838
|
wasmModule = module;
|
|
807
839
|
cachedDataViewMemory0 = null;
|
|
808
840
|
cachedFloat64ArrayMemory0 = null;
|
|
841
|
+
cachedUint32ArrayMemory0 = null;
|
|
809
842
|
cachedUint8ArrayMemory0 = null;
|
|
810
843
|
wasm.__wbindgen_start();
|
|
811
844
|
return wasm;
|
package/jlens_bg.wasm
CHANGED
|
Binary file
|
package/jlens_bg.wasm.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export const languageservice_signatureHelp: (a: number, b: number, c: number, d:
|
|
|
25
25
|
export const parseRecover: (a: number, b: number) => any;
|
|
26
26
|
export const unionReads: (a: any) => [number, number, number];
|
|
27
27
|
export const version: () => [number, number];
|
|
28
|
-
export const
|
|
28
|
+
export const wasm_bindgen_83299752791f6fbb___convert__closures_____invoke___js_sys_f067e63b4fcf480b___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_83299752791f6fbb___JsValue__wasm_bindgen_83299752791f6fbb___JsValue___false_: (a: number, b: number, c: any) => [number, number, number];
|
|
29
29
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
30
30
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
31
31
|
export const __wbindgen_exn_store: (a: number) => void;
|
package/package.json
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
// Builds the values that `ops` describes, in order: a stack holds the values built, and the
|
|
3
|
+
// arrays and objects being filled. `text` holds the strings and the new keys, one after the
|
|
4
|
+
// other (lengths in UTF-16 code units). Returns the last value built: the result.
|
|
5
|
+
export function jlensBuild(ops, nums, text) {
|
|
6
|
+
const stack = [];
|
|
7
|
+
const keys = [];
|
|
8
|
+
// The index of the key `__proto__`, which an assignment would take for the prototype.
|
|
9
|
+
let proto = -1;
|
|
10
|
+
let num = 0, pos = 0;
|
|
11
|
+
for (let i = 0; i < ops.length; i++) {
|
|
12
|
+
switch (ops[i]) {
|
|
13
|
+
case 0: stack.push(null); break;
|
|
14
|
+
case 1: stack.push(false); break;
|
|
15
|
+
case 2: stack.push(true); break;
|
|
16
|
+
case 3: stack.push(nums[num++]); break;
|
|
17
|
+
case 4: { const end = pos + ops[++i]; stack.push(text.slice(pos, end)); pos = end; break; }
|
|
18
|
+
case 5: stack.push([]); break;
|
|
19
|
+
case 6: { const item = stack.pop(); stack[stack.length - 1].push(item); break; }
|
|
20
|
+
case 7: stack.push({}); break;
|
|
21
|
+
case 8: {
|
|
22
|
+
const key = ops[++i];
|
|
23
|
+
const value = stack.pop();
|
|
24
|
+
if (key === proto) own(stack[stack.length - 1], keys[key], value);
|
|
25
|
+
else stack[stack.length - 1][keys[key]] = value;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
case 9: {
|
|
29
|
+
const end = pos + ops[++i];
|
|
30
|
+
const key = text.slice(pos, end);
|
|
31
|
+
pos = end;
|
|
32
|
+
const value = stack.pop();
|
|
33
|
+
if (key === "__proto__") {
|
|
34
|
+
proto = keys.length;
|
|
35
|
+
own(stack[stack.length - 1], key, value);
|
|
36
|
+
} else stack[stack.length - 1][key] = value;
|
|
37
|
+
keys.push(key);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return stack.pop();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Defines an own property, as JSON.parse does.
|
|
46
|
+
function own(object, key, value) {
|
|
47
|
+
Object.defineProperty(object, key, { value, writable: true, enumerable: true, configurable: true });
|
|
48
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
const read = new Float64Array(16);
|
|
3
|
+
let now = "";
|
|
4
|
+
let set = 0;
|
|
5
|
+
|
|
6
|
+
// Writes the tag and number of option `i` into `read`. The tag is 0 for undefined or null, 1 for
|
|
7
|
+
// a number, 2 for a Date (its time, NaN when invalid), 3 for a string (`now` only, kept for
|
|
8
|
+
// jlensNow) and 4 for anything else.
|
|
9
|
+
function put(i, v) {
|
|
10
|
+
let tag = 4;
|
|
11
|
+
let n = 0;
|
|
12
|
+
if (v === undefined || v === null) tag = 0;
|
|
13
|
+
else if (typeof v === "number") (tag = 1), (n = v);
|
|
14
|
+
else if (typeof v === "string" && i === 6) (tag = 3), (now = v);
|
|
15
|
+
else if (Object.prototype.toString.call(v) === "[object Date]") (tag = 2), (n = Date.prototype.getTime.call(v));
|
|
16
|
+
read[2 * i] = tag;
|
|
17
|
+
read[2 * i + 1] = n;
|
|
18
|
+
if (tag !== 0) set = 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Reads the evaluation options into `read`, in the order of `convert::options`. Each option is
|
|
22
|
+
// read once, as a property (getters and inherited properties included, `toJSON` not called),
|
|
23
|
+
// each at its own site, which V8 caches for the shape of the options. Returns -1 when `options`
|
|
24
|
+
// is not a plain object, 0 when no option is set, and 1 otherwise.
|
|
25
|
+
export function jlensOptions(options) {
|
|
26
|
+
if (typeof options !== "object" || Array.isArray(options)) return -1;
|
|
27
|
+
set = 0;
|
|
28
|
+
put(0, options.timeout);
|
|
29
|
+
put(1, options.maxDepth);
|
|
30
|
+
put(2, options.maxSteps);
|
|
31
|
+
put(3, options.maxStringLength);
|
|
32
|
+
put(4, options.maxArrayLength);
|
|
33
|
+
put(5, options.maxResultSize);
|
|
34
|
+
put(6, options.now);
|
|
35
|
+
put(7, options.seed);
|
|
36
|
+
return set;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function jlensOptionsRead() {
|
|
40
|
+
return read;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function jlensNow() {
|
|
44
|
+
return now;
|
|
45
|
+
}
|
|
File without changes
|
/package/snippets/{jlens-wasm-b5dd6593a6f87d95/inline1.js → jlens-wasm-f9fad0160b1217f6/inline2.js}
RENAMED
|
File without changes
|