jlens-wasm 0.18.0 → 0.19.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 CHANGED
@@ -527,7 +527,7 @@ export interface InitOutput {
527
527
  readonly parseRecover: (a: number, b: number) => any;
528
528
  readonly unionReads: (a: any) => [number, number, number];
529
529
  readonly version: () => [number, number];
530
- readonly wasm_bindgen_dfd3dc8039a2d669___convert__closures_____invoke___js_sys_94575574b531b35c___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_dfd3dc8039a2d669___JsValue__wasm_bindgen_dfd3dc8039a2d669___JsValue___false_: (a: number, b: number, c: any) => [number, number, number];
530
+ 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
531
  readonly __wbindgen_malloc: (a: number, b: number) => number;
532
532
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
533
533
  readonly __wbindgen_exn_store: (a: number) => void;
package/jlens.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /* @ts-self-types="./jlens.d.ts" */
2
- import { jlensCallable } from './snippets/jlens-wasm-b5dd6593a6f87d95/inline0.js';
3
- import { jlensLevel } from './snippets/jlens-wasm-b5dd6593a6f87d95/inline1.js';
2
+ import { jlensCallable } from './snippets/jlens-wasm-14c70486967a4dac/inline0.js';
3
+ import { jlensBuild } from './snippets/jlens-wasm-14c70486967a4dac/inline1.js';
4
+ import { jlensLevel } from './snippets/jlens-wasm-14c70486967a4dac/inline2.js';
4
5
 
5
6
 
6
7
  /**
@@ -463,11 +464,15 @@ function __wbg_get_imports() {
463
464
  const ret = Array.isArray(arg0);
464
465
  return ret;
465
466
  },
466
- __wbg_jlensCallable_7d9ffbb6d82e5c6e: function(arg0, arg1) {
467
+ __wbg_jlensBuild_de18e2fe951ffbb5: function(arg0, arg1, arg2, arg3, arg4, arg5) {
468
+ const ret = jlensBuild(getArrayU32FromWasm0(arg0, arg1), getArrayF64FromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
469
+ return ret;
470
+ },
471
+ __wbg_jlensCallable_089c61626da1df71: function(arg0, arg1) {
467
472
  const ret = jlensCallable(arg0, arg1 >>> 0);
468
473
  return ret;
469
474
  },
470
- __wbg_jlensLevel_7fc665e0f96eeefc: function() { return handleError(function (arg0, arg1, arg2) {
475
+ __wbg_jlensLevel_7fa2a312bee944b5: function() { return handleError(function (arg0, arg1, arg2) {
471
476
  const ret = jlensLevel(arg0, arg1 >>> 0, arg2 >>> 0);
472
477
  return ret;
473
478
  }, arguments); },
@@ -554,7 +559,7 @@ function __wbg_get_imports() {
554
559
  }, arguments); },
555
560
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
556
561
  var state0 = {a: arg0, b: arg1};
557
- var cb0 = (arg0) => wasm_bindgen_dfd3dc8039a2d669___convert__closures_____invoke___js_sys_94575574b531b35c___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_dfd3dc8039a2d669___JsValue__wasm_bindgen_dfd3dc8039a2d669___JsValue___false_(state0.a, state0.b, arg0);
562
+ 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
563
  cb0._wbg_cb_unref = () => state0.a = 0;
559
564
  // Cast intrinsic for `Closure(Closure { owned: false, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 10, ret: Result(Externref), inner_ret: Some(Result(Externref)) }, mutable: false }) -> Externref`.
560
565
  const ret = cb0;
@@ -586,8 +591,8 @@ function __wbg_get_imports() {
586
591
  };
587
592
  }
588
593
 
589
- function wasm_bindgen_dfd3dc8039a2d669___convert__closures_____invoke___js_sys_94575574b531b35c___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_dfd3dc8039a2d669___JsValue__wasm_bindgen_dfd3dc8039a2d669___JsValue___false_(arg0, arg1, arg2) {
590
- const ret = wasm.wasm_bindgen_dfd3dc8039a2d669___convert__closures_____invoke___js_sys_94575574b531b35c___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_dfd3dc8039a2d669___JsValue__wasm_bindgen_dfd3dc8039a2d669___JsValue___false_(arg0, arg1, arg2);
594
+ 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) {
595
+ 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
596
  if (ret[2]) {
592
597
  throw takeFromExternrefTable0(ret[1]);
593
598
  }
@@ -686,6 +691,11 @@ function getArrayF64FromWasm0(ptr, len) {
686
691
  return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
687
692
  }
688
693
 
694
+ function getArrayU32FromWasm0(ptr, len) {
695
+ ptr = ptr >>> 0;
696
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
697
+ }
698
+
689
699
  let cachedDataViewMemory0 = null;
690
700
  function getDataViewMemory0() {
691
701
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -706,6 +716,14 @@ function getStringFromWasm0(ptr, len) {
706
716
  return decodeText(ptr >>> 0, len);
707
717
  }
708
718
 
719
+ let cachedUint32ArrayMemory0 = null;
720
+ function getUint32ArrayMemory0() {
721
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
722
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
723
+ }
724
+ return cachedUint32ArrayMemory0;
725
+ }
726
+
709
727
  let cachedUint8ArrayMemory0 = null;
710
728
  function getUint8ArrayMemory0() {
711
729
  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
@@ -806,6 +824,7 @@ function __wbg_finalize_init(instance, module) {
806
824
  wasmModule = module;
807
825
  cachedDataViewMemory0 = null;
808
826
  cachedFloat64ArrayMemory0 = null;
827
+ cachedUint32ArrayMemory0 = null;
809
828
  cachedUint8ArrayMemory0 = null;
810
829
  wasm.__wbindgen_start();
811
830
  return wasm;
package/jlens_bg.wasm CHANGED
Binary file
@@ -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 wasm_bindgen_dfd3dc8039a2d669___convert__closures_____invoke___js_sys_94575574b531b35c___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_dfd3dc8039a2d669___JsValue__wasm_bindgen_dfd3dc8039a2d669___JsValue___false_: (a: number, b: number, c: any) => [number, number, number];
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jlens-wasm",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "JSONata in WebAssembly, with evaluation audits and schema-driven autocomplete",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -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
+ }