@duckdb/duckdb-wasm-shell 1.28.0 → 1.28.1-dev105.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/dist/shell.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@duckdb/duckdb-wasm-shell",
4
- version: "1.28.0",
4
+ version: "1.28.1-dev105.0",
5
5
  description: "",
6
6
  author: "Andre Kohn <kohn.a@outlook.com>",
7
7
  license: "MIT",
@@ -25,22 +25,22 @@ var package_default = {
25
25
  "csv"
26
26
  ],
27
27
  dependencies: {
28
- "@duckdb/duckdb-wasm": "^1.28.0",
29
- xterm: "^5.1.0",
30
- "xterm-addon-fit": "^0.7.0",
28
+ "@duckdb/duckdb-wasm": "^1.28.1-dev105.0",
29
+ xterm: "^5.3.0",
30
+ "xterm-addon-fit": "^0.8.0",
31
31
  "xterm-addon-web-links": "^0.9.0",
32
32
  "xterm-addon-webgl": "^0.16.0"
33
33
  },
34
34
  devDependencies: {
35
- esbuild: "^0.19.5",
36
- eslint: "^8.50.0",
35
+ esbuild: "^0.20.0",
36
+ eslint: "^8.56.0",
37
37
  "eslint-plugin-jasmine": "^4.1.3",
38
38
  "eslint-plugin-react": "^7.33.2",
39
39
  jasmine: "^5.1.0",
40
40
  "jasmine-core": "^5.1.1",
41
41
  "jasmine-spec-reporter": "^7.0.0",
42
42
  "make-dir": "^4.0.0",
43
- prettier: "^3.0.2",
43
+ prettier: "^3.2.4",
44
44
  rimraf: "^5.0.5",
45
45
  "wasm-pack": "^0.12.1"
46
46
  },
@@ -270,11 +270,18 @@ function makeMutClosure(arg0, arg1, dtor, f) {
270
270
  return real;
271
271
  }
272
272
  function __wbg_adapter_22(arg0, arg1, arg2) {
273
- const ret = wasm.wasm_bindgen__convert__closures__invoke1_mut__h823dff921dec94a7(arg0, arg1, addHeapObject(arg2));
273
+ const ret = wasm.wasm_bindgen__convert__closures__invoke1_mut__h7e625be7026adc7c(arg0, arg1, addHeapObject(arg2));
274
274
  return ret !== 0;
275
275
  }
276
276
  function __wbg_adapter_25(arg0, arg1, arg2) {
277
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hebc947492fd4d2e2(arg0, arg1, addHeapObject(arg2));
277
+ wasm.wasm_bindgen__convert__closures__invoke1_mut__hc13282646fd8976d(arg0, arg1, addHeapObject(arg2));
278
+ }
279
+ function handleError(f, args) {
280
+ try {
281
+ return f.apply(this, args);
282
+ } catch (e) {
283
+ wasm.__wbindgen_exn_store(addHeapObject(e));
284
+ }
278
285
  }
279
286
  var cachedUint32Memory0 = null;
280
287
  function getUint32Memory0() {
@@ -335,19 +342,16 @@ function loadHistory(history, cursor) {
335
342
  heap[stack_pointer++] = void 0;
336
343
  }
337
344
  }
345
+ function passInitQueries(queries) {
346
+ const ret = wasm.passInitQueries(addHeapObject(queries));
347
+ return takeObject(ret);
348
+ }
338
349
  function configureDatabase(db) {
339
350
  const ret = wasm.configureDatabase(addHeapObject(db));
340
351
  return takeObject(ret);
341
352
  }
342
- function handleError(f, args) {
343
- try {
344
- return f.apply(this, args);
345
- } catch (e) {
346
- wasm.__wbindgen_exn_store(addHeapObject(e));
347
- }
348
- }
349
- function __wbg_adapter_213(arg0, arg1, arg2, arg3) {
350
- wasm.wasm_bindgen__convert__closures__invoke2_mut__hb4a89eef713a072f(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
353
+ function __wbg_adapter_214(arg0, arg1, arg2, arg3) {
354
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h085319ab0941bbff(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
351
355
  }
352
356
  var ShellInputContext = Object.freeze({ FileInput: 0, "0": "FileInput" });
353
357
  var WcWidth = Object.freeze({ Width0: 0, "0": "Width0", Width1: 1, "1": "Width1", Width2: 2, "2": "Width2" });
@@ -477,9 +481,9 @@ function __wbg_get_imports() {
477
481
  return addHeapObject(ret);
478
482
  }, arguments);
479
483
  };
480
- imports.wbg.__wbg_copyFileToBuffer_8303548b5434aa38 = function() {
484
+ imports.wbg.__wbg_dropFile_377dfecd7aafe02e = function() {
481
485
  return handleError(function(arg0, arg1, arg2) {
482
- const ret = getObject(arg0).copyFileToBuffer(getStringFromWasm0(arg1, arg2));
486
+ const ret = getObject(arg0).dropFile(getStringFromWasm0(arg1, arg2));
483
487
  return addHeapObject(ret);
484
488
  }, arguments);
485
489
  };
@@ -489,9 +493,9 @@ function __wbg_get_imports() {
489
493
  return addHeapObject(ret);
490
494
  }, arguments);
491
495
  };
492
- imports.wbg.__wbg_dropFile_377dfecd7aafe02e = function() {
496
+ imports.wbg.__wbg_copyFileToBuffer_8303548b5434aa38 = function() {
493
497
  return handleError(function(arg0, arg1, arg2) {
494
- const ret = getObject(arg0).dropFile(getStringFromWasm0(arg1, arg2));
498
+ const ret = getObject(arg0).copyFileToBuffer(getStringFromWasm0(arg1, arg2));
495
499
  return addHeapObject(ret);
496
500
  }, arguments);
497
501
  };
@@ -607,41 +611,41 @@ function __wbg_get_imports() {
607
611
  imports.wbg.__wbg_fit_cdd1076e3e5970b7 = function(arg0) {
608
612
  getObject(arg0).fit();
609
613
  };
610
- imports.wbg.__wbg_log_8bb2c010ce15af48 = function(arg0, arg1) {
611
- console.log(getStringFromWasm0(arg0, arg1));
612
- };
613
- imports.wbg.__wbg_error_a84695ce32854879 = function(arg0, arg1) {
614
- console.error(getStringFromWasm0(arg0, arg1));
615
- };
616
- imports.wbg.__wbg_warn_d85b304f0e70f5ac = function(arg0, arg1) {
617
- console.warn(getStringFromWasm0(arg0, arg1));
618
- };
619
- imports.wbg.__wbg_backgroundColor_17a9784f0207d5b0 = function(arg0, arg1) {
620
- const ret = getObject(arg1).backgroundColor;
614
+ imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
615
+ const obj = getObject(arg1);
616
+ const ret = JSON.stringify(obj === void 0 ? null : obj);
621
617
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
622
618
  const len1 = WASM_VECTOR_LEN;
623
619
  getInt32Memory0()[arg0 / 4 + 1] = len1;
624
620
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
625
621
  };
626
- imports.wbg.__wbg_fontFamily_204223b3338f8381 = function(arg0, arg1) {
627
- const ret = getObject(arg1).fontFamily;
622
+ imports.wbg.__wbg_new_79cc836771d68198 = function() {
623
+ const ret = new FitAddon();
624
+ return addHeapObject(ret);
625
+ };
626
+ imports.wbg.__wbg_static_accessor_PACKAGE_VERSION_549ba11794cf5003 = function(arg0) {
627
+ const ret = PACKAGE_VERSION2;
628
628
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
629
629
  const len1 = WASM_VECTOR_LEN;
630
630
  getInt32Memory0()[arg0 / 4 + 1] = len1;
631
631
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
632
632
  };
633
- imports.wbg.__wbg_new_79cc836771d68198 = function() {
634
- const ret = new FitAddon();
635
- return addHeapObject(ret);
636
- };
637
- imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
638
- const obj = getObject(arg1);
639
- const ret = JSON.stringify(obj === void 0 ? null : obj);
633
+ imports.wbg.__wbg_static_accessor_PACKAGE_NAME_0af717684e189e55 = function(arg0) {
634
+ const ret = PACKAGE_NAME2;
640
635
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
641
636
  const len1 = WASM_VECTOR_LEN;
642
637
  getInt32Memory0()[arg0 / 4 + 1] = len1;
643
638
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
644
639
  };
640
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
641
+ const obj = takeObject(arg0).original;
642
+ if (obj.cnt-- == 1) {
643
+ obj.a = 0;
644
+ return true;
645
+ }
646
+ const ret = false;
647
+ return ret;
648
+ };
645
649
  imports.wbg.__wbg_setrows_6b947e6079c486dc = function(arg0, arg1) {
646
650
  getObject(arg0).rows = arg1 >>> 0;
647
651
  };
@@ -651,6 +655,13 @@ function __wbg_get_imports() {
651
655
  imports.wbg.__wbg_setcursorWidth_55abde268dea1312 = function(arg0, arg1) {
652
656
  getObject(arg0).cursorWidth = arg1 >>> 0;
653
657
  };
658
+ imports.wbg.__wbg_fontFamily_204223b3338f8381 = function(arg0, arg1) {
659
+ const ret = getObject(arg1).fontFamily;
660
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
661
+ const len1 = WASM_VECTOR_LEN;
662
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
663
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
664
+ };
654
665
  imports.wbg.__wbg_setfontFamily_a0645fa4f7aaaf21 = function(arg0, arg1, arg2) {
655
666
  getObject(arg0).fontFamily = getStringFromWasm0(arg1, arg2);
656
667
  };
@@ -672,6 +683,13 @@ function __wbg_get_imports() {
672
683
  imports.wbg.__wbg_setforeground_87dc40b78955df05 = function(arg0, arg1, arg2) {
673
684
  getObject(arg0).foreground = getStringFromWasm0(arg1, arg2);
674
685
  };
686
+ imports.wbg.__wbg_backgroundColor_17a9784f0207d5b0 = function(arg0, arg1) {
687
+ const ret = getObject(arg1).backgroundColor;
688
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
689
+ const len1 = WASM_VECTOR_LEN;
690
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
691
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
692
+ };
675
693
  imports.wbg.__wbg_setbackground_550386b829ec5c24 = function(arg0, arg1, arg2) {
676
694
  getObject(arg0).background = getStringFromWasm0(arg1, arg2);
677
695
  };
@@ -712,6 +730,21 @@ function __wbg_get_imports() {
712
730
  const ret = result;
713
731
  return ret;
714
732
  };
733
+ imports.wbg.__wbg_disconnect_d9855433758f0afc = function() {
734
+ return handleError(function(arg0, arg1) {
735
+ const ret = getObject(arg0).disconnect(arg1 >>> 0);
736
+ return addHeapObject(ret);
737
+ }, arguments);
738
+ };
739
+ imports.wbg.__wbg_log_8bb2c010ce15af48 = function(arg0, arg1) {
740
+ console.log(getStringFromWasm0(arg0, arg1));
741
+ };
742
+ imports.wbg.__wbg_error_a84695ce32854879 = function(arg0, arg1) {
743
+ console.error(getStringFromWasm0(arg0, arg1));
744
+ };
745
+ imports.wbg.__wbg_warn_d85b304f0e70f5ac = function(arg0, arg1) {
746
+ console.warn(getStringFromWasm0(arg0, arg1));
747
+ };
715
748
  imports.wbg.__wbg_blockStats_14f17a14c4573f3d = function(arg0) {
716
749
  const ret = getObject(arg0).blockStats;
717
750
  return addHeapObject(ret);
@@ -744,35 +777,6 @@ function __wbg_get_imports() {
744
777
  const ret = getObject(arg0).blockSize;
745
778
  return addHeapObject(ret);
746
779
  };
747
- imports.wbg.__wbg_static_accessor_PACKAGE_VERSION_549ba11794cf5003 = function(arg0) {
748
- const ret = PACKAGE_VERSION2;
749
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
750
- const len1 = WASM_VECTOR_LEN;
751
- getInt32Memory0()[arg0 / 4 + 1] = len1;
752
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
753
- };
754
- imports.wbg.__wbg_static_accessor_PACKAGE_NAME_0af717684e189e55 = function(arg0) {
755
- const ret = PACKAGE_NAME2;
756
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
757
- const len1 = WASM_VECTOR_LEN;
758
- getInt32Memory0()[arg0 / 4 + 1] = len1;
759
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
760
- };
761
- imports.wbg.__wbg_disconnect_d9855433758f0afc = function() {
762
- return handleError(function(arg0, arg1) {
763
- const ret = getObject(arg0).disconnect(arg1 >>> 0);
764
- return addHeapObject(ret);
765
- }, arguments);
766
- };
767
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
768
- const obj = takeObject(arg0).original;
769
- if (obj.cnt-- == 1) {
770
- obj.a = 0;
771
- return true;
772
- }
773
- const ret = false;
774
- return ret;
775
- };
776
780
  imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
777
781
  const ret = new Error();
778
782
  return addHeapObject(ret);
@@ -809,6 +813,17 @@ function __wbg_get_imports() {
809
813
  const ret = getObject(arg0).performance;
810
814
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
811
815
  };
816
+ imports.wbg.__wbg_type_4197dff653b7d208 = function(arg0, arg1) {
817
+ const ret = getObject(arg1).type;
818
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
819
+ const len1 = WASM_VECTOR_LEN;
820
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
821
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
822
+ };
823
+ imports.wbg.__wbg_now_0cfdc90c97d0c24b = function(arg0) {
824
+ const ret = getObject(arg0).now();
825
+ return ret;
826
+ };
812
827
  imports.wbg.__wbg_ctrlKey_582686fb2263dd3c = function(arg0) {
813
828
  const ret = getObject(arg0).ctrlKey;
814
829
  return ret;
@@ -824,17 +839,6 @@ function __wbg_get_imports() {
824
839
  getInt32Memory0()[arg0 / 4 + 1] = len1;
825
840
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
826
841
  };
827
- imports.wbg.__wbg_type_4197dff653b7d208 = function(arg0, arg1) {
828
- const ret = getObject(arg1).type;
829
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
830
- const len1 = WASM_VECTOR_LEN;
831
- getInt32Memory0()[arg0 / 4 + 1] = len1;
832
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
833
- };
834
- imports.wbg.__wbg_now_0cfdc90c97d0c24b = function(arg0) {
835
- const ret = getObject(arg0).now();
836
- return ret;
837
- };
838
842
  imports.wbg.__wbg_get_44be0491f933a435 = function(arg0, arg1) {
839
843
  const ret = getObject(arg0)[arg1 >>> 0];
840
844
  return addHeapObject(ret);
@@ -918,7 +922,7 @@ function __wbg_get_imports() {
918
922
  const a = state0.a;
919
923
  state0.a = 0;
920
924
  try {
921
- return __wbg_adapter_213(a, state0.b, arg02, arg12);
925
+ return __wbg_adapter_214(a, state0.b, arg02, arg12);
922
926
  } finally {
923
927
  state0.a = a;
924
928
  }
@@ -970,12 +974,12 @@ function __wbg_get_imports() {
970
974
  const ret = wasm.memory;
971
975
  return addHeapObject(ret);
972
976
  };
973
- imports.wbg.__wbindgen_closure_wrapper633 = function(arg0, arg1, arg2) {
974
- const ret = makeMutClosure(arg0, arg1, 131, __wbg_adapter_22);
977
+ imports.wbg.__wbindgen_closure_wrapper369 = function(arg0, arg1, arg2) {
978
+ const ret = makeMutClosure(arg0, arg1, 119, __wbg_adapter_22);
975
979
  return addHeapObject(ret);
976
980
  };
977
- imports.wbg.__wbindgen_closure_wrapper956 = function(arg0, arg1, arg2) {
978
- const ret = makeMutClosure(arg0, arg1, 150, __wbg_adapter_25);
981
+ imports.wbg.__wbindgen_closure_wrapper967 = function(arg0, arg1, arg2) {
982
+ const ret = makeMutClosure(arg0, arg1, 202, __wbg_adapter_25);
979
983
  return addHeapObject(ret);
980
984
  };
981
985
  return imports;
@@ -1197,6 +1201,7 @@ var ShellRuntime = class {
1197
1201
  const rect = container.getBoundingClientRect();
1198
1202
  resize(rect.width, rect.height);
1199
1203
  };
1204
+ this.hash = "";
1200
1205
  }
1201
1206
  async pickFiles() {
1202
1207
  if (this.database == null) {
@@ -1219,6 +1224,16 @@ var ShellRuntime = class {
1219
1224
  return await navigator.clipboard.writeText(value);
1220
1225
  }
1221
1226
  async pushInputToHistory(value) {
1227
+ const encode = encodeURIComponent(extraswaps(value));
1228
+ if (this.hash === "")
1229
+ this.hash = "queries=v0";
1230
+ this.hash += ",";
1231
+ this.hash += encode;
1232
+ if (window.location.hash.startsWith("#savequeries"))
1233
+ window.location.hash = "savequeries&" + this.hash;
1234
+ const a = document.getElementById("hashencoded");
1235
+ if (a && a instanceof HTMLAnchorElement)
1236
+ a.href = "/#" + this.hash;
1222
1237
  this.history.push(value);
1223
1238
  }
1224
1239
  };
@@ -1228,6 +1243,22 @@ function formatBytes(value) {
1228
1243
  const size = Number((value / Math.pow(multiple, exp)).toFixed(2));
1229
1244
  return "".concat(size, " ").concat(exp ? "".concat(k, "MGTPEZY")[exp - 1] + suffix : "byte".concat(size !== 1 ? "s" : ""));
1230
1245
  }
1246
+ function extraswaps(input) {
1247
+ let res = "";
1248
+ for (let i = 0; i < input.length; i++) {
1249
+ if (input[i] == " ")
1250
+ res += "-";
1251
+ else if (input[i] == "-")
1252
+ res += " ";
1253
+ else if (input[i] == ";")
1254
+ res += "~";
1255
+ else if (input[i] == "~")
1256
+ res += ";";
1257
+ else
1258
+ res += input[i];
1259
+ }
1260
+ return res;
1261
+ }
1231
1262
  async function embed2(props) {
1232
1263
  var _a, _b;
1233
1264
  await shell_default(props.shellModule);
@@ -1266,6 +1297,15 @@ async function embed2(props) {
1266
1297
  await step("Attaching Shell", async () => {
1267
1298
  configureDatabase(runtime.database);
1268
1299
  });
1300
+ const hash = window.location.hash;
1301
+ const splits = hash.split(",");
1302
+ const sqls = [];
1303
+ for (let i = 1; i < splits.length; i++) {
1304
+ sqls.push(extraswaps(decodeURIComponent(splits[i])));
1305
+ }
1306
+ await step("Rewinding history!", async () => {
1307
+ passInitQueries(sqls);
1308
+ });
1269
1309
  }
1270
1310
 
1271
1311
  // src/platform.ts