jlens-wasm 0.19.0 → 0.21.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 +16 -3
- package/jlens.js +21 -7
- package/jlens_bg.wasm +0 -0
- package/package.json +1 -1
- package/snippets/jlens-wasm-d4783d7d6cebe07e/inline3.js +45 -0
- /package/snippets/{jlens-wasm-14c70486967a4dac → jlens-wasm-d4783d7d6cebe07e}/inline0.js +0 -0
- /package/snippets/{jlens-wasm-14c70486967a4dac → jlens-wasm-d4783d7d6cebe07e}/inline1.js +0 -0
- /package/snippets/{jlens-wasm-14c70486967a4dac → jlens-wasm-d4783d7d6cebe07e}/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 };
|
package/jlens.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* @ts-self-types="./jlens.d.ts" */
|
|
2
|
-
import { jlensCallable } from './snippets/jlens-wasm-
|
|
3
|
-
import { jlensBuild } from './snippets/jlens-wasm-
|
|
4
|
-
import { jlensLevel } from './snippets/jlens-wasm-
|
|
2
|
+
import { jlensCallable } from './snippets/jlens-wasm-d4783d7d6cebe07e/inline0.js';
|
|
3
|
+
import { jlensBuild } from './snippets/jlens-wasm-d4783d7d6cebe07e/inline1.js';
|
|
4
|
+
import { jlensLevel } from './snippets/jlens-wasm-d4783d7d6cebe07e/inline2.js';
|
|
5
|
+
import { jlensNow, jlensOptions } from './snippets/jlens-wasm-d4783d7d6cebe07e/inline3.js';
|
|
6
|
+
import * as import1 from "./snippets/jlens-wasm-d4783d7d6cebe07e/inline3.js"
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -464,18 +466,29 @@ function __wbg_get_imports() {
|
|
|
464
466
|
const ret = Array.isArray(arg0);
|
|
465
467
|
return ret;
|
|
466
468
|
},
|
|
467
|
-
|
|
469
|
+
__wbg_jlensBuild_b8de9b665926fc61: function(arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
468
470
|
const ret = jlensBuild(getArrayU32FromWasm0(arg0, arg1), getArrayF64FromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
|
|
469
471
|
return ret;
|
|
470
472
|
},
|
|
471
|
-
|
|
473
|
+
__wbg_jlensCallable_9bec7c0b503c2b7d: function(arg0, arg1) {
|
|
472
474
|
const ret = jlensCallable(arg0, arg1 >>> 0);
|
|
473
475
|
return ret;
|
|
474
476
|
},
|
|
475
|
-
|
|
477
|
+
__wbg_jlensLevel_319402d78614099e: function() { return handleError(function (arg0, arg1, arg2) {
|
|
476
478
|
const ret = jlensLevel(arg0, arg1 >>> 0, arg2 >>> 0);
|
|
477
479
|
return ret;
|
|
478
480
|
}, arguments); },
|
|
481
|
+
__wbg_jlensNow_2769e85eef0351ca: 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_ba25cea9fc1b1435: function() { return handleError(function (arg0) {
|
|
489
|
+
const ret = jlensOptions(arg0);
|
|
490
|
+
return ret;
|
|
491
|
+
}, arguments); },
|
|
479
492
|
__wbg_length_3121141f8e1c8c58: function(arg0) {
|
|
480
493
|
const ret = arg0.length;
|
|
481
494
|
return ret;
|
|
@@ -561,7 +574,7 @@ function __wbg_get_imports() {
|
|
|
561
574
|
var state0 = {a: arg0, b: arg1};
|
|
562
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);
|
|
563
576
|
cb0._wbg_cb_unref = () => state0.a = 0;
|
|
564
|
-
// 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`.
|
|
565
578
|
const ret = cb0;
|
|
566
579
|
return ret;
|
|
567
580
|
},
|
|
@@ -588,6 +601,7 @@ function __wbg_get_imports() {
|
|
|
588
601
|
return {
|
|
589
602
|
__proto__: null,
|
|
590
603
|
"./jlens_bg.js": import0,
|
|
604
|
+
"./snippets/jlens-wasm-d4783d7d6cebe07e/inline3.js": import1,
|
|
591
605
|
};
|
|
592
606
|
}
|
|
593
607
|
|
package/jlens_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -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
|
|
File without changes
|
|
File without changes
|