jlens-wasm 0.23.0 → 0.24.1
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.js +16 -12
- package/jlens_bg.wasm +0 -0
- package/package.json +1 -1
- package/snippets/{jlens-wasm-a39ae774a5261ead → jlens-wasm-93c023f9b8304973}/inline2.js +26 -17
- /package/snippets/{jlens-wasm-a39ae774a5261ead → jlens-wasm-93c023f9b8304973}/inline0.js +0 -0
- /package/snippets/{jlens-wasm-a39ae774a5261ead → jlens-wasm-93c023f9b8304973}/inline1.js +0 -0
- /package/snippets/{jlens-wasm-a39ae774a5261ead → jlens-wasm-93c023f9b8304973}/inline3.js +0 -0
package/jlens.js
CHANGED
|
@@ -1,9 +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 {
|
|
5
|
-
import { jlensNow, jlensOptions } from './snippets/jlens-wasm-
|
|
6
|
-
import * as import1 from "./snippets/jlens-wasm-
|
|
2
|
+
import { jlensCallable } from './snippets/jlens-wasm-93c023f9b8304973/inline0.js';
|
|
3
|
+
import { jlensBuild } from './snippets/jlens-wasm-93c023f9b8304973/inline1.js';
|
|
4
|
+
import { jlensLength, jlensRead } from './snippets/jlens-wasm-93c023f9b8304973/inline2.js';
|
|
5
|
+
import { jlensNow, jlensOptions } from './snippets/jlens-wasm-93c023f9b8304973/inline3.js';
|
|
6
|
+
import * as import1 from "./snippets/jlens-wasm-93c023f9b8304973/inline3.js"
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -466,29 +466,33 @@ function __wbg_get_imports() {
|
|
|
466
466
|
const ret = Array.isArray(arg0);
|
|
467
467
|
return ret;
|
|
468
468
|
},
|
|
469
|
-
|
|
469
|
+
__wbg_jlensBuild_6db03a103e2f22ea: function(arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
470
470
|
const ret = jlensBuild(getArrayU32FromWasm0(arg0, arg1), getArrayF64FromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
|
|
471
471
|
return ret;
|
|
472
472
|
},
|
|
473
|
-
|
|
473
|
+
__wbg_jlensCallable_a8b11b221fede990: function(arg0, arg1) {
|
|
474
474
|
const ret = jlensCallable(arg0, arg1 >>> 0);
|
|
475
475
|
return ret;
|
|
476
476
|
},
|
|
477
|
-
|
|
478
|
-
const ret =
|
|
477
|
+
__wbg_jlensLength_e8459f8ad8e2f638: function() { return handleError(function (arg0, arg1) {
|
|
478
|
+
const ret = jlensLength(arg0, arg1 >>> 0);
|
|
479
479
|
return ret;
|
|
480
480
|
}, arguments); },
|
|
481
|
-
|
|
481
|
+
__wbg_jlensNow_cd0ff626292ebeee: function(arg0) {
|
|
482
482
|
const ret = jlensNow();
|
|
483
483
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
484
484
|
const len1 = WASM_VECTOR_LEN;
|
|
485
485
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
486
486
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
487
487
|
},
|
|
488
|
-
|
|
488
|
+
__wbg_jlensOptions_6862510bbf76fe61: function() { return handleError(function (arg0) {
|
|
489
489
|
const ret = jlensOptions(arg0);
|
|
490
490
|
return ret;
|
|
491
491
|
}, arguments); },
|
|
492
|
+
__wbg_jlensRead_4a0fa5e2154c0a88: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
493
|
+
const ret = jlensRead(arg0, arg1 >>> 0, arg2 >>> 0, arg3 >>> 0);
|
|
494
|
+
return ret;
|
|
495
|
+
}, arguments); },
|
|
492
496
|
__wbg_length_3121141f8e1c8c58: function(arg0) {
|
|
493
497
|
const ret = arg0.length;
|
|
494
498
|
return ret;
|
|
@@ -601,7 +605,7 @@ function __wbg_get_imports() {
|
|
|
601
605
|
return {
|
|
602
606
|
__proto__: null,
|
|
603
607
|
"./jlens_bg.js": import0,
|
|
604
|
-
"./snippets/jlens-wasm-
|
|
608
|
+
"./snippets/jlens-wasm-93c023f9b8304973/inline3.js": import1,
|
|
605
609
|
};
|
|
606
610
|
}
|
|
607
611
|
|
package/jlens_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
const CIRCULAR = "Converting circular structure to JSON";
|
|
3
3
|
const BIGINT = "Do not know how to serialize a BigInt";
|
|
4
4
|
|
|
5
|
-
// Reads
|
|
6
|
-
// object
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
// Reads values: with `kind` 0 the input itself (`node` is the value); with 1 the array or
|
|
6
|
+
// object of the node `node[index]`, the nodes of a level; with 2 the item `n` of that array.
|
|
7
|
+
// A node is {v, up}: an array or object and its parent's node, to detect cycles. Returns the
|
|
8
|
+
// numbers, starting with twice the number of values, plus 1 for the fields of an object (a
|
|
9
|
+
// second leading number made this function half as slow again in V8), then each value's tag
|
|
10
|
+
// and number; the strings and keys as one text (lengths in UTF-16 code units); and the nodes
|
|
11
|
+
// of the nested arrays and objects. In an object, each value is followed by the length of its
|
|
12
|
+
// key. An array or object of more than `n` values is returned as its JSON text instead (a
|
|
13
|
+
// cycle back to an ancestor passes through it again, so JSON.stringify sees it).
|
|
14
|
+
export function jlensRead(node, kind, index, n) {
|
|
15
|
+
const nums = [2];
|
|
14
16
|
let text = "";
|
|
15
17
|
const nested = [];
|
|
16
|
-
const up = kind === 0 ? null : node;
|
|
18
|
+
const up = kind === 0 ? null : node[index];
|
|
17
19
|
const put = (v, key) => {
|
|
18
20
|
if ((typeof v === "object" && v !== null) || typeof v === "bigint") {
|
|
19
21
|
const toJSON = v.toJSON;
|
|
@@ -56,18 +58,20 @@ export function jlensLevel(node, kind, whole) {
|
|
|
56
58
|
};
|
|
57
59
|
if (kind === 0) {
|
|
58
60
|
put(node, "");
|
|
59
|
-
} else if (kind ===
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
} else if (kind === 2) {
|
|
62
|
+
if (!put(up.v[n], String(n))) nums.push(1);
|
|
63
|
+
} else if (Array.isArray(up.v)) {
|
|
64
|
+
const items = up.v;
|
|
65
|
+
if (items.length > n) return JSON.stringify(items);
|
|
66
|
+
nums[0] = items.length * 2;
|
|
63
67
|
for (let i = 0; i < items.length; i++) {
|
|
64
68
|
if (!put(items[i], String(i))) nums.push(1);
|
|
65
69
|
}
|
|
66
70
|
} else {
|
|
67
|
-
const fields =
|
|
71
|
+
const fields = up.v;
|
|
68
72
|
const keys = Object.keys(fields);
|
|
69
|
-
if (keys.length >
|
|
70
|
-
nums[0] = keys.length;
|
|
73
|
+
if (keys.length > n) return JSON.stringify(fields);
|
|
74
|
+
nums[0] = keys.length * 2 + 1;
|
|
71
75
|
for (const key of keys) {
|
|
72
76
|
if (put(fields[key], key)) {
|
|
73
77
|
nums.push(key.length);
|
|
@@ -77,3 +81,8 @@ export function jlensLevel(node, kind, whole) {
|
|
|
77
81
|
}
|
|
78
82
|
return [new Float64Array(nums), text, nested];
|
|
79
83
|
}
|
|
84
|
+
|
|
85
|
+
// The length of the array of the node `nodes[index]`.
|
|
86
|
+
export function jlensLength(nodes, index) {
|
|
87
|
+
return nodes[index].v.length;
|
|
88
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|