jlens-wasm 0.24.1 → 0.26.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
@@ -115,7 +115,7 @@ export interface CaptureLimits {
115
115
  maxDepth: number;
116
116
  /** Rejected items kept as samples per filter. Default 5. */
117
117
  maxRejected: number;
118
- /** Nodes recorded in the tree. Default 10000. */
118
+ /** Nodes recorded in the tree, the root included; past it, a node is dropped, its parent adopting its recorded descendants and filters. Default 10000. */
119
119
  maxNodes: number;
120
120
  /** Characters of source text kept per node. Default 200. */
121
121
  maxSource: number;
@@ -540,14 +540,14 @@ export interface InitOutput {
540
540
  readonly parseRecover: (a: number, b: number) => any;
541
541
  readonly unionReads: (a: any) => [number, number, number];
542
542
  readonly version: () => [number, number];
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];
543
+ readonly wasm_bindgen_a0105adc92475806___convert__closures_____invoke___js_sys_3aa434bd356a4a0e___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_a0105adc92475806___JsValue__wasm_bindgen_a0105adc92475806___JsValue___false_: (a: number, b: number, c: any) => [number, number, number];
544
544
  readonly __wbindgen_malloc: (a: number, b: number) => number;
545
545
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
546
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
546
547
  readonly __wbindgen_exn_store: (a: number) => void;
547
548
  readonly __externref_table_alloc: () => number;
548
549
  readonly __wbindgen_externrefs: WebAssembly.Table;
549
550
  readonly __externref_table_dealloc: (a: number) => void;
550
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
551
551
  readonly __wbindgen_start: () => void;
552
552
  }
553
553
 
package/jlens.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /* @ts-self-types="./jlens.d.ts" */
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"
2
+ import { jlensCallable } from './snippets/jlens-wasm-d34e61c49be60f98/inline0.js';
3
+ import { jlensBuild } from './snippets/jlens-wasm-d34e61c49be60f98/inline1.js';
4
+ import { jlensField, jlensItems, jlensLength, jlensRead } from './snippets/jlens-wasm-d34e61c49be60f98/inline2.js';
5
+ import { jlensNow, jlensOptions } from './snippets/jlens-wasm-d34e61c49be60f98/inline3.js';
6
+ import * as import1 from "./snippets/jlens-wasm-d34e61c49be60f98/inline3.js"
7
7
 
8
8
 
9
9
  /**
@@ -199,10 +199,17 @@ export class Expression {
199
199
  * @param {string | null} [signature]
200
200
  */
201
201
  registerFunction(name, implementation, signature) {
202
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
203
- const len0 = WASM_VECTOR_LEN;
204
- var ptr1 = isLikeNone(signature) ? 0 : passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
205
- var len1 = WASM_VECTOR_LEN;
202
+ let ptr0, len0, ptr1, len1;
203
+ try {
204
+ ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
205
+ len0 = WASM_VECTOR_LEN;
206
+ ptr1 = isLikeNone(signature) ? 0 : passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
207
+ len1 = WASM_VECTOR_LEN;
208
+ } catch (e) {
209
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
210
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
211
+ throw e;
212
+ }
206
213
  const ret = wasm.expression_registerFunction(this.__wbg_ptr, ptr0, len0, implementation, ptr1, len1);
207
214
  if (ret[1]) {
208
215
  throw takeFromExternrefTable0(ret[0]);
@@ -249,9 +256,10 @@ export class LanguageService {
249
256
  * @returns {any}
250
257
  */
251
258
  complete(text, offset) {
259
+ const val2 = +offset;
252
260
  const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
253
261
  const len0 = WASM_VECTOR_LEN;
254
- const ret = wasm.languageservice_complete(this.__wbg_ptr, ptr0, len0, offset);
262
+ const ret = wasm.languageservice_complete(this.__wbg_ptr, ptr0, len0, val2);
255
263
  return ret;
256
264
  }
257
265
  /**
@@ -272,9 +280,10 @@ export class LanguageService {
272
280
  * @returns {any}
273
281
  */
274
282
  hover(text, offset) {
283
+ const val2 = +offset;
275
284
  const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
276
285
  const len0 = WASM_VECTOR_LEN;
277
- const ret = wasm.languageservice_hover(this.__wbg_ptr, ptr0, len0, offset);
286
+ const ret = wasm.languageservice_hover(this.__wbg_ptr, ptr0, len0, val2);
278
287
  return ret;
279
288
  }
280
289
  /**
@@ -302,9 +311,10 @@ export class LanguageService {
302
311
  * @returns {any}
303
312
  */
304
313
  signatureHelp(text, offset) {
314
+ const val2 = +offset;
305
315
  const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
306
316
  const len0 = WASM_VECTOR_LEN;
307
- const ret = wasm.languageservice_signatureHelp(this.__wbg_ptr, ptr0, len0, offset);
317
+ const ret = wasm.languageservice_signatureHelp(this.__wbg_ptr, ptr0, len0, val2);
308
318
  return ret;
309
319
  }
310
320
  }
@@ -382,77 +392,88 @@ export function version() {
382
392
  function __wbg_get_imports() {
383
393
  const import0 = {
384
394
  __proto__: null,
385
- __wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) {
395
+ __wbg___wbindgen_boolean_get_4f1baf9a00be3c74: function(arg0) {
396
+ const v = arg0;
397
+ const ret = typeof(v) === 'boolean' ? v : undefined;
398
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
399
+ },
400
+ __wbg___wbindgen_debug_string_f249a2a76caa9a55: function(arg0, arg1) {
386
401
  const ret = debugString(arg1);
387
402
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
388
403
  const len1 = WASM_VECTOR_LEN;
389
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
390
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
404
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
405
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
391
406
  },
392
- __wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
407
+ __wbg___wbindgen_is_function_741ff2bb612836f5: function(arg0) {
393
408
  const ret = typeof(arg0) === 'function';
394
409
  return ret;
395
410
  },
396
- __wbg___wbindgen_is_null_e343b7d08827ba72: function(arg0) {
411
+ __wbg___wbindgen_is_null_c22311b1cc228e3a: function(arg0) {
397
412
  const ret = arg0 === null;
398
413
  return ret;
399
414
  },
400
- __wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
415
+ __wbg___wbindgen_is_object_8b968c3ab8e96595: function(arg0) {
401
416
  const val = arg0;
402
417
  const ret = typeof(val) === 'object' && val !== null;
403
418
  return ret;
404
419
  },
405
- __wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
420
+ __wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(arg0) {
406
421
  const ret = arg0 === undefined;
407
422
  return ret;
408
423
  },
409
- __wbg___wbindgen_jsval_eq_02babf21faa37971: function(arg0, arg1) {
424
+ __wbg___wbindgen_jsval_eq_38d7bfbe4cc84039: function(arg0, arg1) {
410
425
  const ret = arg0 === arg1;
411
426
  return ret;
412
427
  },
413
- __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
428
+ __wbg___wbindgen_number_get_934b640d0889af78: function(arg0, arg1) {
429
+ const obj = arg1;
430
+ const ret = typeof(obj) === 'number' ? obj : undefined;
431
+ getDataViewMemory0().setFloat64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
432
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
433
+ },
434
+ __wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
414
435
  const obj = arg1;
415
436
  const ret = typeof(obj) === 'string' ? obj : undefined;
416
437
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
417
438
  var len1 = WASM_VECTOR_LEN;
418
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
419
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
439
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
440
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
420
441
  },
421
- __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
442
+ __wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
422
443
  throw new Error(getStringFromWasm0(arg0, arg1));
423
444
  },
424
- __wbg__wbg_cb_unref_dcc1a90847f04c41: function(arg0) {
445
+ __wbg__wbg_cb_unref_09736879a3f67559: function(arg0) {
425
446
  arg0._wbg_cb_unref();
426
447
  },
427
- __wbg_apply_a910804df6e1e433: function() { return handleError(function (arg0, arg1, arg2) {
448
+ __wbg_apply_bfe2b07b146427e2: function() { return handleError(function (arg0, arg1, arg2) {
428
449
  const ret = arg0.apply(arg1, arg2);
429
450
  return ret;
430
451
  }, arguments); },
431
- __wbg_call_187d372bd5fdd4aa: function() { return handleError(function (arg0, arg1, arg2) {
452
+ __wbg_call_a410eb4b59ed5965: function() { return handleError(function (arg0, arg1, arg2) {
432
453
  const ret = arg0.call(arg1, arg2);
433
454
  return ret;
434
455
  }, arguments); },
435
- __wbg_entries_fb6397112b1de25f: function(arg0) {
456
+ __wbg_entries_7bb1459bd9b5c2b9: function(arg0) {
436
457
  const ret = Object.entries(arg0);
437
458
  return ret;
438
459
  },
439
- __wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
460
+ __wbg_get_2080c49015e35254: function() { return handleError(function (arg0, arg1) {
440
461
  const ret = Reflect.get(arg0, arg1);
441
462
  return ret;
442
463
  }, arguments); },
443
- __wbg_get_6c896e0571ddae51: function(arg0, arg1) {
464
+ __wbg_get_d7176cfb76d71114: function(arg0, arg1) {
444
465
  const ret = arg0[arg1 >>> 0];
445
466
  return ret;
446
467
  },
447
- __wbg_get_unchecked_288889d017702237: function(arg0, arg1) {
468
+ __wbg_get_unchecked_e6325ad374eff861: function(arg0, arg1) {
448
469
  const ret = arg0[arg1 >>> 0];
449
470
  return ret;
450
471
  },
451
- __wbg_has_5d6706e5209576c1: function() { return handleError(function (arg0, arg1) {
472
+ __wbg_has_2c4d5cf25ec8c1cf: function() { return handleError(function (arg0, arg1) {
452
473
  const ret = Reflect.has(arg0, arg1);
453
474
  return ret;
454
475
  }, arguments); },
455
- __wbg_instanceof_Error_80a725f81f2e102d: function(arg0) {
476
+ __wbg_instanceof_Error_74e3cca0c4a69161: function(arg0) {
456
477
  let result;
457
478
  try {
458
479
  result = arg0 instanceof Error;
@@ -462,66 +483,74 @@ function __wbg_get_imports() {
462
483
  const ret = result;
463
484
  return ret;
464
485
  },
465
- __wbg_isArray_e15a2ff68ffdbef2: function(arg0) {
486
+ __wbg_isArray_bcf1376d0d732d08: function(arg0) {
466
487
  const ret = Array.isArray(arg0);
467
488
  return ret;
468
489
  },
469
- __wbg_jlensBuild_6db03a103e2f22ea: function(arg0, arg1, arg2, arg3, arg4, arg5) {
490
+ __wbg_jlensBuild_68a0c9c5ee67d67a: function(arg0, arg1, arg2, arg3, arg4, arg5) {
470
491
  const ret = jlensBuild(getArrayU32FromWasm0(arg0, arg1), getArrayF64FromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
471
492
  return ret;
472
493
  },
473
- __wbg_jlensCallable_a8b11b221fede990: function(arg0, arg1) {
494
+ __wbg_jlensCallable_42f65e28cca9f44a: function(arg0, arg1) {
474
495
  const ret = jlensCallable(arg0, arg1 >>> 0);
475
496
  return ret;
476
497
  },
477
- __wbg_jlensLength_e8459f8ad8e2f638: function() { return handleError(function (arg0, arg1) {
498
+ __wbg_jlensField_0049e3294ae49405: function() { return handleError(function (arg0, arg1, arg2, arg3) {
499
+ const ret = jlensField(arg0, arg1 >>> 0, getStringFromWasm0(arg2, arg3));
500
+ return ret;
501
+ }, arguments); },
502
+ __wbg_jlensItems_9049a697b0a31ba8: function() { return handleError(function (arg0, arg1, arg2, arg3) {
503
+ const ret = jlensItems(arg0, arg1 >>> 0, arg2 >>> 0, arg3);
504
+ return ret;
505
+ }, arguments); },
506
+ __wbg_jlensLength_4aa88b1509663572: function() { return handleError(function (arg0, arg1) {
478
507
  const ret = jlensLength(arg0, arg1 >>> 0);
479
508
  return ret;
480
509
  }, arguments); },
481
- __wbg_jlensNow_cd0ff626292ebeee: function(arg0) {
510
+ __wbg_jlensNow_07b637046c22796a: function(arg0) {
482
511
  const ret = jlensNow();
483
512
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
484
513
  const len1 = WASM_VECTOR_LEN;
485
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
486
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
514
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
515
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
487
516
  },
488
- __wbg_jlensOptions_6862510bbf76fe61: function() { return handleError(function (arg0) {
517
+ __wbg_jlensOptions_2d0827275d39a2eb: function() { return handleError(function (arg0) {
489
518
  const ret = jlensOptions(arg0);
490
519
  return ret;
491
520
  }, arguments); },
492
- __wbg_jlensRead_4a0fa5e2154c0a88: function() { return handleError(function (arg0, arg1, arg2, arg3) {
521
+ __wbg_jlensRead_ba57b347e5e09cb5: function() { return handleError(function (arg0, arg1, arg2, arg3) {
493
522
  const ret = jlensRead(arg0, arg1 >>> 0, arg2 >>> 0, arg3 >>> 0);
494
523
  return ret;
495
524
  }, arguments); },
496
- __wbg_length_3121141f8e1c8c58: function(arg0) {
525
+ __wbg_length_5a8bb8abe1e54e15: function(arg0) {
497
526
  const ret = arg0.length;
498
527
  return ret;
499
528
  },
500
- __wbg_length_b5f0008bbf60cf59: function(arg0) {
529
+ __wbg_length_aa9b3d4585e24045: function(arg0) {
501
530
  const ret = arg0.length;
502
531
  return ret;
503
532
  },
504
- __wbg_length_d4bdea10311bd9cf: function(arg0) {
533
+ __wbg_length_b03a0fabb109b1e9: function(arg0) {
505
534
  const ret = arg0.length;
506
535
  return ret;
507
536
  },
508
- __wbg_message_5f8387f0c32b90a7: function(arg0) {
537
+ __wbg_message_43d8c8f1d543a349: function(arg0) {
509
538
  const ret = arg0.message;
510
539
  return ret;
511
540
  },
512
- __wbg_new_2bdcdfcebdfc34d2: function(arg0, arg1) {
513
- const ret = new TypeError(getStringFromWasm0(arg0, arg1));
541
+ __wbg_new_37eb45aaf5eeb820: function() {
542
+ const ret = new Array();
514
543
  return ret;
515
544
  },
516
- __wbg_new_343a093a3c2ffb4e: function(arg0, arg1) {
517
- const ret = new Error(getStringFromWasm0(arg0, arg1));
545
+ __wbg_new_4416a2fe2fac9c65: function(arg0, arg1) {
546
+ const ret = new TypeError(getStringFromWasm0(arg0, arg1));
518
547
  return ret;
519
548
  },
520
- __wbg_new_ee2291f50781bf1d: function() {
521
- const ret = new Array();
549
+ __wbg_new_787b9fb330d55d78: function(arg0, arg1) {
550
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
522
551
  return ret;
523
552
  },
524
- __wbg_now_aa4ccb83129e9e55: function() {
553
+ __wbg_now_463ac581d2fc7ea3: function() {
525
554
  const ret = Date.now();
526
555
  return ret;
527
556
  },
@@ -529,54 +558,54 @@ function __wbg_get_imports() {
529
558
  const ret = arg0.now();
530
559
  return ret;
531
560
  },
532
- __wbg_parse_0fc53dead14b3b42: function() { return handleError(function (arg0, arg1) {
561
+ __wbg_parse_c3f72b5a24f83c01: function() { return handleError(function (arg0, arg1) {
533
562
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
534
563
  return ret;
535
564
  }, arguments); },
536
- __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
565
+ __wbg_performance_7e4e4494fdc9d07a: function(arg0) {
537
566
  const ret = arg0.performance;
538
567
  return ret;
539
568
  },
540
- __wbg_prototypesetcall_d49a4fab5ca427bc: function(arg0, arg1, arg2) {
569
+ __wbg_prototypesetcall_a366c038a3918afa: function(arg0, arg1, arg2) {
541
570
  Float64Array.prototype.set.call(getArrayF64FromWasm0(arg0, arg1), arg2);
542
571
  },
543
- __wbg_push_2baf45db356cf468: function(arg0, arg1) {
572
+ __wbg_push_c9f4893fc209f768: function(arg0, arg1) {
544
573
  const ret = arg0.push(arg1);
545
574
  return ret;
546
575
  },
547
- __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
576
+ __wbg_set_2793479888329cb6: function() { return handleError(function (arg0, arg1, arg2) {
548
577
  const ret = Reflect.set(arg0, arg1, arg2);
549
578
  return ret;
550
579
  }, arguments); },
551
- __wbg_set_bea140a88be9b277: function(arg0, arg1, arg2) {
580
+ __wbg_set_d2d33b52458e984a: function(arg0, arg1, arg2) {
552
581
  arg0[arg1 >>> 0] = arg2;
553
582
  },
554
- __wbg_set_name_2c630595dc90a7aa: function(arg0, arg1, arg2) {
583
+ __wbg_set_name_822e3903f3184979: function(arg0, arg1, arg2) {
555
584
  arg0.name = getStringFromWasm0(arg1, arg2);
556
585
  },
557
- __wbg_static_accessor_GLOBAL_266715b9d96ba635: function() {
558
- const ret = typeof global === 'undefined' ? null : global;
586
+ __wbg_static_accessor_GLOBAL_THIS_003ee833af9699fc: function() {
587
+ const ret = typeof globalThis === 'undefined' ? undefined : globalThis;
559
588
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
560
589
  },
561
- __wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179: function() {
562
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
590
+ __wbg_static_accessor_GLOBAL_e4293fb22cbe77da: function() {
591
+ const ret = typeof global === 'undefined' ? undefined : global;
563
592
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
564
593
  },
565
- __wbg_static_accessor_SELF_0b583911f537483a: function() {
566
- const ret = typeof self === 'undefined' ? null : self;
594
+ __wbg_static_accessor_SELF_53bb20457401453d: function() {
595
+ const ret = typeof self === 'undefined' ? undefined : self;
567
596
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
568
597
  },
569
- __wbg_static_accessor_WINDOW_d7f903d1508cbdc4: function() {
570
- const ret = typeof window === 'undefined' ? null : window;
598
+ __wbg_static_accessor_WINDOW_b5e0810bfecb7feb: function() {
599
+ const ret = typeof window === 'undefined' ? undefined : window;
571
600
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
572
601
  },
573
- __wbg_stringify_52ff602c1cc4fbb6: function() { return handleError(function (arg0) {
602
+ __wbg_stringify_0a0fbf2ef722380a: function() { return handleError(function (arg0) {
574
603
  const ret = JSON.stringify(arg0);
575
604
  return ret;
576
605
  }, arguments); },
577
606
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
578
607
  var state0 = {a: arg0, b: arg1};
579
- 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);
608
+ var cb0 = (arg0) => wasm_bindgen_a0105adc92475806___convert__closures_____invoke___js_sys_3aa434bd356a4a0e___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_a0105adc92475806___JsValue__wasm_bindgen_a0105adc92475806___JsValue___false_(state0.a, state0.b, arg0);
580
609
  cb0._wbg_cb_unref = () => state0.a = 0;
581
610
  // 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`.
582
611
  const ret = cb0;
@@ -594,23 +623,22 @@ function __wbg_get_imports() {
594
623
  },
595
624
  __wbindgen_init_externref_table: function() {
596
625
  const table = wasm.__wbindgen_externrefs;
597
- const offset = table.grow(4);
598
626
  table.set(0, undefined);
599
- table.set(offset + 0, undefined);
600
- table.set(offset + 1, null);
601
- table.set(offset + 2, true);
602
- table.set(offset + 3, false);
627
+ table.set(1024, undefined);
628
+ table.set(1025, null);
629
+ table.set(1026, true);
630
+ table.set(1027, false);
603
631
  },
604
632
  };
605
633
  return {
606
634
  __proto__: null,
607
635
  "./jlens_bg.js": import0,
608
- "./snippets/jlens-wasm-93c023f9b8304973/inline3.js": import1,
636
+ "./snippets/jlens-wasm-d34e61c49be60f98/inline3.js": import1,
609
637
  };
610
638
  }
611
639
 
612
- 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) {
613
- 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);
640
+ function wasm_bindgen_a0105adc92475806___convert__closures_____invoke___js_sys_3aa434bd356a4a0e___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_a0105adc92475806___JsValue__wasm_bindgen_a0105adc92475806___JsValue___false_(arg0, arg1, arg2) {
641
+ const ret = wasm.wasm_bindgen_a0105adc92475806___convert__closures_____invoke___js_sys_3aa434bd356a4a0e___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_a0105adc92475806___JsValue__wasm_bindgen_a0105adc92475806___JsValue___false_(arg0, arg1, arg2);
614
642
  if (ret[2]) {
615
643
  throw takeFromExternrefTable0(ret[1]);
616
644
  }
@@ -640,68 +668,61 @@ function _assertClass(instance, klass) {
640
668
  }
641
669
 
642
670
  function debugString(val) {
643
- // primitive types
644
- const type = typeof val;
645
- if (type == 'number' || type == 'boolean' || val == null) {
646
- return `${val}`;
647
- }
648
- if (type == 'string') {
649
- return `"${val}"`;
650
- }
651
- if (type == 'symbol') {
652
- const description = val.description;
653
- if (description == null) {
654
- return 'Symbol';
655
- } else {
656
- return `Symbol(${description})`;
657
- }
658
- }
659
- if (type == 'function') {
660
- const name = val.name;
661
- if (typeof name == 'string' && name.length > 0) {
662
- return `Function(${name})`;
663
- } else {
664
- return 'Function';
665
- }
666
- }
667
- // objects
668
- if (Array.isArray(val)) {
669
- const length = val.length;
670
- let debug = '[';
671
- if (length > 0) {
672
- debug += debugString(val[0]);
673
- }
674
- for(let i = 1; i < length; i++) {
675
- debug += ', ' + debugString(val[i]);
676
- }
677
- debug += ']';
678
- return debug;
679
- }
680
- // Test for built-in
681
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
682
- let className;
683
- if (builtInMatches && builtInMatches.length > 1) {
684
- className = builtInMatches[1];
685
- } else {
686
- // Failed to match the standard '[object ClassName]'
687
- return toString.call(val);
688
- }
689
- if (className == 'Object') {
690
- // we're a user defined class or Object
691
- // JSON.stringify avoids problems with cycles, and is generally much
692
- // easier than looping through ownProperties of `val`.
693
- try {
694
- return 'Object(' + JSON.stringify(val) + ')';
695
- } catch (_) {
696
- return 'Object';
671
+ switch (typeof val) {
672
+ // primitive types
673
+ case 'number':
674
+ case 'boolean':
675
+ case 'undefined':
676
+ return `${val}`;
677
+ case 'string':
678
+ return JSON.stringify(val);
679
+ case 'bigint':
680
+ return `${val}n`;
681
+ case 'symbol':
682
+ return val.description !== undefined
683
+ ? `Symbol(${val.description})`
684
+ : 'Symbol';
685
+ case 'function':
686
+ return typeof val.name === 'string' && val.name !== ''
687
+ ? `Function(${val.name})`
688
+ : 'Function';
689
+ case 'object': {
690
+ if (val === null) {
691
+ return 'null';
692
+ }
693
+ // objects
694
+ if (Array.isArray(val)) {
695
+ return '[' + Array.from(val, debugString).join(', ') + ']';
696
+ }
697
+ // errors
698
+ if (val instanceof Error) {
699
+ return `${val.name}: ${val.message}\n${val.stack}`;
700
+ }
701
+
702
+ const toStringOutput = toString.call(val);
703
+ // Test for built-in
704
+ const className = /\[object ([^\]]+)\]/.exec(toStringOutput)?.[1];
705
+
706
+ // Failed to match the standard '[object ClassName]'
707
+ if (className === undefined) {
708
+ return toStringOutput;
709
+ }
710
+ if (className === 'Object') {
711
+ // we're a user defined class or Object
712
+ // JSON.stringify avoids problems with cycles, and is generally much
713
+ // easier than looping through ownProperties of `val`.
714
+ try {
715
+ return 'Object(' + JSON.stringify(val) + ')';
716
+ } catch (_) {
717
+ return 'Object';
718
+ }
719
+ }
720
+ // TODO we could test for more things here, like `Set`s and `Map`s.
721
+ return className;
697
722
  }
723
+ // Per MDN: 'This list of values is exhaustive.'
724
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
698
725
  }
699
- // errors
700
- if (val instanceof Error) {
701
- return `${val.name}: ${val.message}\n${val.stack}`;
702
- }
703
- // TODO we could test for more things here, like `Set`s and `Map`s.
704
- return className;
705
726
  }
706
727
 
707
728
  function getArrayF64FromWasm0(ptr, len) {
@@ -731,7 +752,8 @@ function getFloat64ArrayMemory0() {
731
752
  }
732
753
 
733
754
  function getStringFromWasm0(ptr, len) {
734
- return decodeText(ptr >>> 0, len);
755
+ ptr = ptr >>> 0;
756
+ return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
735
757
  }
736
758
 
737
759
  let cachedUint32ArrayMemory0 = null;
@@ -806,18 +828,18 @@ function takeFromExternrefTable0(idx) {
806
828
  return value;
807
829
  }
808
830
 
809
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
831
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
810
832
  cachedTextDecoder.decode();
811
833
  const MAX_SAFARI_DECODE_BYTES = 2146435072;
812
834
  let numBytesDecoded = 0;
813
- function decodeText(ptr, len) {
814
- numBytesDecoded += len;
835
+ function decodeText(bytes) {
836
+ numBytesDecoded += bytes.length;
815
837
  if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
816
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
838
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
817
839
  cachedTextDecoder.decode();
818
- numBytesDecoded = len;
840
+ numBytesDecoded = bytes.length;
819
841
  }
820
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
842
+ return cachedTextDecoder.decode(bytes);
821
843
  }
822
844
 
823
845
  const cachedTextEncoder = new TextEncoder();
@@ -907,9 +929,17 @@ function initSync(module) {
907
929
  return __wbg_finalize_init(instance, module);
908
930
  }
909
931
 
932
+ let __wbg_init_promise;
910
933
  async function __wbg_init(module_or_path) {
911
934
  if (wasm !== undefined) return wasm;
935
+ if (__wbg_init_promise === undefined) {
936
+ __wbg_init_promise = __wbg_init_once(module_or_path);
937
+ __wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
938
+ }
939
+ return __wbg_init_promise;
940
+ }
912
941
 
942
+ async function __wbg_init_once(module_or_path) {
913
943
 
914
944
  if (module_or_path !== undefined) {
915
945
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
package/jlens_bg.wasm CHANGED
Binary file
@@ -25,12 +25,12 @@ 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_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];
28
+ export const wasm_bindgen_a0105adc92475806___convert__closures_____invoke___js_sys_3aa434bd356a4a0e___Array__core_37ee0ce0c4cd57d5___result__Result_wasm_bindgen_a0105adc92475806___JsValue__wasm_bindgen_a0105adc92475806___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
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
31
32
  export const __wbindgen_exn_store: (a: number) => void;
32
33
  export const __externref_table_alloc: () => number;
33
34
  export const __wbindgen_externrefs: WebAssembly.Table;
34
35
  export const __externref_table_dealloc: (a: number) => void;
35
- export const __wbindgen_free: (a: number, b: number, c: number) => void;
36
36
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jlens-wasm",
3
- "version": "0.24.1",
3
+ "version": "0.26.0",
4
4
  "description": "JSONata in WebAssembly, with evaluation audits and schema-driven autocomplete",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -0,0 +1,193 @@
1
+
2
+ const CIRCULAR = "Converting circular structure to JSON";
3
+ const BIGINT = "Do not know how to serialize a BigInt";
4
+
5
+ // The value JSON.stringify writes for `v`, the value of `key`: what `toJSON` returns, and a
6
+ // boxed primitive unwrapped.
7
+ function unwrap(v, key) {
8
+ if ((typeof v === "object" && v !== null) || typeof v === "bigint") {
9
+ const toJSON = v.toJSON;
10
+ if (typeof toJSON === "function") v = toJSON.call(v, key);
11
+ }
12
+ if (typeof v === "object" && v !== null) {
13
+ if (v instanceof Number) v = Number(v);
14
+ else if (v instanceof String) v = String(v);
15
+ else if (v instanceof Boolean) v = v.valueOf();
16
+ else if (v instanceof BigInt) throw new TypeError(BIGINT);
17
+ }
18
+ return v;
19
+ }
20
+
21
+ // Whether `v` is an object that is not an array.
22
+ function isObject(v) {
23
+ return typeof v === "object" && v !== null && !Array.isArray(v);
24
+ }
25
+
26
+ // Throws as JSON.stringify does when `v` is the array or object of the node `up` or of one of
27
+ // its ancestors.
28
+ function checkCycle(v, up) {
29
+ for (let n = up; n !== null; n = n.up) {
30
+ if (n.v === v) throw new TypeError(CIRCULAR);
31
+ }
32
+ }
33
+
34
+ // Reads values: with `kind` 0 the input itself (`node` is the value); with 1 the array or
35
+ // object of the node `node[index]`, the nodes of a level; with 2 the item `n` of that array.
36
+ // A node is {v, up}: an array or object and its parent's node, to detect cycles. Returns the
37
+ // numbers, starting with twice the number of values, plus 1 for the fields of an object (a
38
+ // second leading number made this function half as slow again in V8), then each value's tag
39
+ // and number; the strings and keys as one text (lengths in UTF-16 code units); and the nodes
40
+ // of the nested arrays and objects. In an object, each value is followed by the length of its
41
+ // key. An array or object of more than `n` values is returned as its JSON text instead (a
42
+ // cycle back to an ancestor passes through it again, so JSON.stringify sees it).
43
+ export function jlensRead(node, kind, index, n) {
44
+ const nums = [2];
45
+ let text = "";
46
+ const nested = [];
47
+ const up = kind === 0 ? null : node[index];
48
+ const put = (v, key) => {
49
+ v = unwrap(v, key);
50
+ switch (typeof v) {
51
+ case "string":
52
+ nums.push(5, v.length);
53
+ text += v;
54
+ return true;
55
+ case "number":
56
+ if (isFinite(v)) nums.push(4, v);
57
+ else nums.push(1);
58
+ return true;
59
+ case "boolean":
60
+ nums.push(v ? 3 : 2);
61
+ return true;
62
+ case "bigint":
63
+ throw new TypeError(BIGINT);
64
+ case "object":
65
+ if (v === null) {
66
+ nums.push(1);
67
+ return true;
68
+ }
69
+ checkCycle(v, up);
70
+ nums.push(Array.isArray(v) ? 6 : 7);
71
+ nested.push({ v, up });
72
+ return true;
73
+ default:
74
+ return false;
75
+ }
76
+ };
77
+ if (kind === 0) {
78
+ put(node, "");
79
+ } else if (kind === 2) {
80
+ if (!put(up.v[n], String(n))) nums.push(1);
81
+ } else if (Array.isArray(up.v)) {
82
+ const items = up.v;
83
+ if (items.length > n) return JSON.stringify(items);
84
+ nums[0] = items.length * 2;
85
+ for (let i = 0; i < items.length; i++) {
86
+ if (!put(items[i], String(i))) nums.push(1);
87
+ }
88
+ } else {
89
+ const fields = up.v;
90
+ const keys = Object.keys(fields);
91
+ if (keys.length > n) return JSON.stringify(fields);
92
+ nums[0] = keys.length * 2 + 1;
93
+ for (const key of keys) {
94
+ if (put(fields[key], key)) {
95
+ nums.push(key.length);
96
+ text += key;
97
+ }
98
+ }
99
+ }
100
+ return [new Float64Array(nums), text, nested];
101
+ }
102
+
103
+ // Reads the items of the array of the node `nodes[index]`, of which the expression reads the
104
+ // fields `keys` of each object, as jlensRead does a level of `n` values or fewer. A longer
105
+ // array of objects (its first item one) is not returned as JSON text: each object is tag 8,
106
+ // its node, and the value of each key in turn, 0 for one JSON.stringify leaves out.
107
+ export function jlensItems(nodes, index, n, keys) {
108
+ const up = nodes[index];
109
+ const items = up.v;
110
+ if (items.length <= n) return jlensRead(nodes, 1, index, n);
111
+ const first = items[0];
112
+ if (!isObject(first)) return JSON.stringify(items);
113
+ const nums = [items.length * 2];
114
+ let text = "";
115
+ const nested = [];
116
+ // Writes `v`, unwrapped, an array or object as a node under `parent`: false when
117
+ // JSON.stringify leaves it out.
118
+ const put = (v, parent) => {
119
+ switch (typeof v) {
120
+ case "string":
121
+ nums.push(5, v.length);
122
+ text += v;
123
+ return true;
124
+ case "number":
125
+ if (isFinite(v)) nums.push(4, v);
126
+ else nums.push(1);
127
+ return true;
128
+ case "boolean":
129
+ nums.push(v ? 3 : 2);
130
+ return true;
131
+ case "bigint":
132
+ throw new TypeError(BIGINT);
133
+ case "object":
134
+ if (v === null) {
135
+ nums.push(1);
136
+ return true;
137
+ }
138
+ checkCycle(v, parent);
139
+ nums.push(Array.isArray(v) ? 6 : 7);
140
+ nested.push({ v, up: parent });
141
+ return true;
142
+ default:
143
+ return false;
144
+ }
145
+ };
146
+ for (let i = 0; i < items.length; i++) {
147
+ const v = unwrap(i === 0 ? first : items[i], String(i));
148
+ if (!isObject(v)) {
149
+ if (!put(v, up)) nums.push(1);
150
+ continue;
151
+ }
152
+ checkCycle(v, up);
153
+ const item = { v, up };
154
+ nums.push(8);
155
+ nested.push(item);
156
+ for (const key of keys) {
157
+ const has = Object.prototype.propertyIsEnumerable.call(v, key);
158
+ if (!(has && put(unwrap(v[key], key), item))) nums.push(0);
159
+ }
160
+ }
161
+ return [new Float64Array(nums), text, nested];
162
+ }
163
+
164
+ // Reads the field `key` of the object of the node `nodes[index]`, as JSON.stringify sees it:
165
+ // undefined when the object has no own enumerable field `key`, or when JSON.stringify leaves
166
+ // its value out; a string, a boolean or null as itself; a number, or null when it is not
167
+ // finite; an array or object as [6 or 7, its node], so that the node is member 1.
168
+ export function jlensField(nodes, index, key) {
169
+ const up = nodes[index];
170
+ const fields = up.v;
171
+ if (!Object.prototype.propertyIsEnumerable.call(fields, key)) return undefined;
172
+ const v = unwrap(fields[key], key);
173
+ switch (typeof v) {
174
+ case "string":
175
+ case "boolean":
176
+ return v;
177
+ case "number":
178
+ return isFinite(v) ? v : null;
179
+ case "bigint":
180
+ throw new TypeError(BIGINT);
181
+ case "object":
182
+ if (v === null) return null;
183
+ checkCycle(v, up);
184
+ return [Array.isArray(v) ? 6 : 7, { v, up }];
185
+ default:
186
+ return undefined;
187
+ }
188
+ }
189
+
190
+ // The length of the array of the node `nodes[index]`.
191
+ export function jlensLength(nodes, index) {
192
+ return nodes[index].v.length;
193
+ }
@@ -1,88 +0,0 @@
1
-
2
- const CIRCULAR = "Converting circular structure to JSON";
3
- const BIGINT = "Do not know how to serialize a BigInt";
4
-
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];
16
- let text = "";
17
- const nested = [];
18
- const up = kind === 0 ? null : node[index];
19
- const put = (v, key) => {
20
- if ((typeof v === "object" && v !== null) || typeof v === "bigint") {
21
- const toJSON = v.toJSON;
22
- if (typeof toJSON === "function") v = toJSON.call(v, key);
23
- }
24
- if (typeof v === "object" && v !== null) {
25
- if (v instanceof Number) v = Number(v);
26
- else if (v instanceof String) v = String(v);
27
- else if (v instanceof Boolean) v = v.valueOf();
28
- else if (v instanceof BigInt) throw new TypeError(BIGINT);
29
- }
30
- switch (typeof v) {
31
- case "string":
32
- nums.push(5, v.length);
33
- text += v;
34
- return true;
35
- case "number":
36
- if (isFinite(v)) nums.push(4, v);
37
- else nums.push(1);
38
- return true;
39
- case "boolean":
40
- nums.push(v ? 3 : 2);
41
- return true;
42
- case "bigint":
43
- throw new TypeError(BIGINT);
44
- case "object":
45
- if (v === null) {
46
- nums.push(1);
47
- return true;
48
- }
49
- for (let n = up; n !== null; n = n.up) {
50
- if (n.v === v) throw new TypeError(CIRCULAR);
51
- }
52
- nums.push(Array.isArray(v) ? 6 : 7);
53
- nested.push({ v, up });
54
- return true;
55
- default:
56
- return false;
57
- }
58
- };
59
- if (kind === 0) {
60
- put(node, "");
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;
67
- for (let i = 0; i < items.length; i++) {
68
- if (!put(items[i], String(i))) nums.push(1);
69
- }
70
- } else {
71
- const fields = up.v;
72
- const keys = Object.keys(fields);
73
- if (keys.length > n) return JSON.stringify(fields);
74
- nums[0] = keys.length * 2 + 1;
75
- for (const key of keys) {
76
- if (put(fields[key], key)) {
77
- nums.push(key.length);
78
- text += key;
79
- }
80
- }
81
- }
82
- return [new Float64Array(nums), text, nested];
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
- }