@duckdb/duckdb-wasm-shell 1.13.1-dev20.0 → 1.13.1-dev230.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/img/duckdb_version_badge.svg +1 -1
- package/dist/shell.cjs +208 -52
- package/dist/shell.cjs.map +3 -3
- package/dist/shell.d.ts +1 -1
- package/dist/shell.js +202 -39
- package/dist/shell.js.map +3 -3
- package/dist/shell.mjs +194 -43
- package/dist/shell.mjs.map +3 -3
- package/dist/shell_bg.wasm +0 -0
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/platform.d.ts +1 -0
- package/dist/types/{shell.d.ts → src/shell.d.ts} +2 -2
- package/dist/types/{utils → src/utils}/files.d.ts +0 -0
- package/dist/types/{utils → src/utils}/format.d.ts +0 -0
- package/dist/types/{utils → src/utils}/history_store.d.ts +0 -0
- package/dist/types/src/version.d.ts +5 -0
- package/package.json +12 -11
- package/dist/types/utils/platform.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="140" height="20" role="img" aria-label="duckdb: v0.3.
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="140" height="20" role="img" aria-label="duckdb: v0.3.2-dev149"><title>duckdb: v0.3.2-dev149</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="140" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="49" height="20" fill="#555"/><rect x="49" width="91" height="20" fill="#007ec6"/><rect width="140" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="255" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="390">duckdb</text><text x="255" y="140" transform="scale(.1)" fill="#fff" textLength="390">duckdb</text><text aria-hidden="true" x="935" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="810">v0.3.2-dev149</text><text x="935" y="140" transform="scale(.1)" fill="#fff" textLength="810">v0.3.2-dev149</text></g></svg>
|
package/dist/shell.cjs
CHANGED
|
@@ -1,32 +1,148 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
6
8
|
var __export = (target, all) => {
|
|
7
|
-
for (var
|
|
8
|
-
__defProp(target,
|
|
9
|
+
for (var name2 in all)
|
|
10
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
9
11
|
};
|
|
10
|
-
var __reExport = (target,
|
|
11
|
-
if (
|
|
12
|
-
for (let key of __getOwnPropNames(
|
|
12
|
+
var __reExport = (target, module3, copyDefault, desc) => {
|
|
13
|
+
if (module3 && typeof module3 === "object" || typeof module3 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module3))
|
|
13
15
|
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
14
|
-
__defProp(target, key, { get: () =>
|
|
16
|
+
__defProp(target, key, { get: () => module3[key], enumerable: !(desc = __getOwnPropDesc(module3, key)) || desc.enumerable });
|
|
15
17
|
}
|
|
16
18
|
return target;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (module3, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module3 != null ? __create(__getProtoOf(module3)) : {}, "default", !isNodeMode && module3 && module3.__esModule ? { get: () => module3.default, enumerable: true } : { value: module3, enumerable: true })), module3);
|
|
22
|
+
};
|
|
18
23
|
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
19
|
-
return (
|
|
20
|
-
return cache && cache.get(
|
|
24
|
+
return (module3, temp) => {
|
|
25
|
+
return cache && cache.get(module3) || (temp = __reExport(__markAsModule({}), module3, 1), cache && cache.set(module3, temp), temp);
|
|
21
26
|
};
|
|
22
27
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
23
28
|
|
|
24
|
-
// src/
|
|
25
|
-
var
|
|
26
|
-
__export(
|
|
27
|
-
|
|
29
|
+
// src/index.ts
|
|
30
|
+
var src_exports = {};
|
|
31
|
+
__export(src_exports, {
|
|
32
|
+
PACKAGE_NAME: () => PACKAGE_NAME,
|
|
33
|
+
PACKAGE_VERSION: () => PACKAGE_VERSION,
|
|
34
|
+
PACKAGE_VERSION_MAJOR: () => PACKAGE_VERSION_MAJOR,
|
|
35
|
+
PACKAGE_VERSION_MINOR: () => PACKAGE_VERSION_MINOR,
|
|
36
|
+
PACKAGE_VERSION_PATCH: () => PACKAGE_VERSION_PATCH,
|
|
37
|
+
embed: () => embed2,
|
|
38
|
+
getJsDelivrModule: () => getJsDelivrModule
|
|
28
39
|
});
|
|
29
40
|
|
|
41
|
+
// package.json
|
|
42
|
+
var name = "@duckdb/duckdb-wasm-shell";
|
|
43
|
+
var version = "1.13.1-dev230.0";
|
|
44
|
+
var description = "";
|
|
45
|
+
var author = "Andre Kohn <kohn.a@outlook.com>";
|
|
46
|
+
var license = "MPL-2.0";
|
|
47
|
+
var repository = {
|
|
48
|
+
type: "git",
|
|
49
|
+
url: "https://github.com/duckdb/duckdb-wasm.git"
|
|
50
|
+
};
|
|
51
|
+
var keywords = [
|
|
52
|
+
"sql",
|
|
53
|
+
"duckdb",
|
|
54
|
+
"relational",
|
|
55
|
+
"database",
|
|
56
|
+
"data",
|
|
57
|
+
"query",
|
|
58
|
+
"wasm",
|
|
59
|
+
"analytics",
|
|
60
|
+
"olap",
|
|
61
|
+
"arrow",
|
|
62
|
+
"parquet",
|
|
63
|
+
"json",
|
|
64
|
+
"csv"
|
|
65
|
+
];
|
|
66
|
+
var dependencies = {
|
|
67
|
+
"@duckdb/duckdb-wasm": "^1.13.1-dev230.0",
|
|
68
|
+
xterm: "^4.17.0",
|
|
69
|
+
"xterm-addon-fit": "^0.5.0",
|
|
70
|
+
"xterm-addon-web-links": "^0.5.1",
|
|
71
|
+
"xterm-addon-webgl": "^0.11.4"
|
|
72
|
+
};
|
|
73
|
+
var devDependencies = {
|
|
74
|
+
esbuild: "^0.14.23",
|
|
75
|
+
eslint: "^8.9.0",
|
|
76
|
+
"eslint-plugin-jasmine": "^4.1.3",
|
|
77
|
+
"eslint-plugin-react": "^7.28.0",
|
|
78
|
+
jasmine: "^4.0.2",
|
|
79
|
+
"jasmine-core": "^4.0.1",
|
|
80
|
+
"jasmine-spec-reporter": "^7.0.0",
|
|
81
|
+
"make-dir": "^3.1.0",
|
|
82
|
+
prettier: "^2.5.1",
|
|
83
|
+
rimraf: "^3.0.2",
|
|
84
|
+
"wasm-pack": "^0.10.2"
|
|
85
|
+
};
|
|
86
|
+
var scripts = {
|
|
87
|
+
"install:wasmpack": "node ../../node_modules/wasm-pack/install.js",
|
|
88
|
+
"build:debug": "node bundle.mjs debug && tsc --emitDeclarationOnly",
|
|
89
|
+
"build:release": "node bundle.mjs release && tsc --emitDeclarationOnly",
|
|
90
|
+
lint: "eslint src"
|
|
91
|
+
};
|
|
92
|
+
var files = [
|
|
93
|
+
"dist",
|
|
94
|
+
"!dist/types/test"
|
|
95
|
+
];
|
|
96
|
+
var main = "dist/shell.cjs";
|
|
97
|
+
var module2 = "dist/shell.mjs";
|
|
98
|
+
var types = "dist/shell.d.ts";
|
|
99
|
+
var jsdelivr = "dist/shell.cjs";
|
|
100
|
+
var unpkg = "dist/shell.mjs";
|
|
101
|
+
var sideEffects = false;
|
|
102
|
+
var exports = {
|
|
103
|
+
"./dist/shell_bg.wasm": "./dist/shell_bg.wasm",
|
|
104
|
+
"./dist/shell.js": "./dist/shell.js",
|
|
105
|
+
"./dist/shell.cjs": "./dist/shell.cjs",
|
|
106
|
+
"./dist/shell.mjs": "./dist/shell.mjs",
|
|
107
|
+
"./dist/shell": "./dist/shell.mjs",
|
|
108
|
+
".": {
|
|
109
|
+
types: "./dist/shell.d.ts",
|
|
110
|
+
import: "./dist/shell.mjs",
|
|
111
|
+
require: "./dist/shell.cjs"
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
var package_default = {
|
|
115
|
+
name,
|
|
116
|
+
version,
|
|
117
|
+
description,
|
|
118
|
+
author,
|
|
119
|
+
license,
|
|
120
|
+
repository,
|
|
121
|
+
keywords,
|
|
122
|
+
dependencies,
|
|
123
|
+
devDependencies,
|
|
124
|
+
scripts,
|
|
125
|
+
files,
|
|
126
|
+
main,
|
|
127
|
+
module: module2,
|
|
128
|
+
types,
|
|
129
|
+
jsdelivr,
|
|
130
|
+
unpkg,
|
|
131
|
+
sideEffects,
|
|
132
|
+
exports
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// src/version.ts
|
|
136
|
+
var PACKAGE_NAME = package_default.name;
|
|
137
|
+
var PACKAGE_VERSION = package_default.version;
|
|
138
|
+
var VERSION_PARTS = package_default.version.split(".");
|
|
139
|
+
var PACKAGE_VERSION_MAJOR = VERSION_PARTS[0];
|
|
140
|
+
var PACKAGE_VERSION_MINOR = VERSION_PARTS[1];
|
|
141
|
+
var PACKAGE_VERSION_PATCH = VERSION_PARTS[2];
|
|
142
|
+
|
|
143
|
+
// src/shell.ts
|
|
144
|
+
var duckdb = __toESM(require("@duckdb/duckdb-wasm"));
|
|
145
|
+
|
|
30
146
|
// crate/pkg/shell.js
|
|
31
147
|
var import_duckdb_wasm = require("@duckdb/duckdb-wasm");
|
|
32
148
|
var import_xterm = require("xterm");
|
|
@@ -135,17 +251,17 @@ function debugString(val) {
|
|
|
135
251
|
return `"${val}"`;
|
|
136
252
|
}
|
|
137
253
|
if (type == "symbol") {
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
254
|
+
const description2 = val.description;
|
|
255
|
+
if (description2 == null) {
|
|
140
256
|
return "Symbol";
|
|
141
257
|
} else {
|
|
142
|
-
return `Symbol(${
|
|
258
|
+
return `Symbol(${description2})`;
|
|
143
259
|
}
|
|
144
260
|
}
|
|
145
261
|
if (type == "function") {
|
|
146
|
-
const
|
|
147
|
-
if (typeof
|
|
148
|
-
return `Function(${
|
|
262
|
+
const name2 = val.name;
|
|
263
|
+
if (typeof name2 == "string" && name2.length > 0) {
|
|
264
|
+
return `Function(${name2})`;
|
|
149
265
|
} else {
|
|
150
266
|
return "Function";
|
|
151
267
|
}
|
|
@@ -223,6 +339,11 @@ function handleError(f, args) {
|
|
|
223
339
|
function embed(elem, runtime, options) {
|
|
224
340
|
wasm.embed(addHeapObject(elem), addHeapObject(runtime), addHeapObject(options));
|
|
225
341
|
}
|
|
342
|
+
function write(text) {
|
|
343
|
+
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
344
|
+
var len0 = WASM_VECTOR_LEN;
|
|
345
|
+
wasm.write(ptr0, len0);
|
|
346
|
+
}
|
|
226
347
|
function writeln(text) {
|
|
227
348
|
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
228
349
|
var len0 = WASM_VECTOR_LEN;
|
|
@@ -268,30 +389,30 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
268
389
|
WASM_VECTOR_LEN = arg.length;
|
|
269
390
|
return ptr;
|
|
270
391
|
}
|
|
271
|
-
function
|
|
392
|
+
function __wbg_adapter_199(arg0, arg1, arg2, arg3) {
|
|
272
393
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h445be38df5ff7a40(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
273
394
|
}
|
|
274
395
|
var ShellInputContext = Object.freeze({ FileInput: 0, "0": "FileInput" });
|
|
275
396
|
var WcWidth = Object.freeze({ Width0: 0, "0": "Width0", Width1: 1, "1": "Width1", Width2: 2, "2": "Width2" });
|
|
276
|
-
async function load(
|
|
277
|
-
if (typeof Response === "function" &&
|
|
397
|
+
async function load(module3, imports) {
|
|
398
|
+
if (typeof Response === "function" && module3 instanceof Response) {
|
|
278
399
|
if (typeof WebAssembly.instantiateStreaming === "function") {
|
|
279
400
|
try {
|
|
280
|
-
return await WebAssembly.instantiateStreaming(
|
|
401
|
+
return await WebAssembly.instantiateStreaming(module3, imports);
|
|
281
402
|
} catch (e) {
|
|
282
|
-
if (
|
|
403
|
+
if (module3.headers.get("Content-Type") != "application/wasm") {
|
|
283
404
|
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
284
405
|
} else {
|
|
285
406
|
throw e;
|
|
286
407
|
}
|
|
287
408
|
}
|
|
288
409
|
}
|
|
289
|
-
const bytes = await
|
|
410
|
+
const bytes = await module3.arrayBuffer();
|
|
290
411
|
return await WebAssembly.instantiate(bytes, imports);
|
|
291
412
|
} else {
|
|
292
|
-
const instance = await WebAssembly.instantiate(
|
|
413
|
+
const instance = await WebAssembly.instantiate(module3, imports);
|
|
293
414
|
if (instance instanceof WebAssembly.Instance) {
|
|
294
|
-
return { instance, module:
|
|
415
|
+
return { instance, module: module3 };
|
|
295
416
|
} else {
|
|
296
417
|
return instance;
|
|
297
418
|
}
|
|
@@ -475,6 +596,12 @@ async function init(input) {
|
|
|
475
596
|
return addHeapObject(ret);
|
|
476
597
|
}, arguments);
|
|
477
598
|
};
|
|
599
|
+
imports.wbg.__wbg_copyFileToBuffer_e4a7050307f57c30 = function() {
|
|
600
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
601
|
+
var ret = getObject(arg0).copyFileToBuffer(getStringFromWasm0(arg1, arg2));
|
|
602
|
+
return addHeapObject(ret);
|
|
603
|
+
}, arguments);
|
|
604
|
+
};
|
|
478
605
|
imports.wbg.__wbg_dropFiles_4d857401e3dd75ab = function() {
|
|
479
606
|
return handleError(function(arg0) {
|
|
480
607
|
var ret = getObject(arg0).dropFiles();
|
|
@@ -499,6 +626,12 @@ async function init(input) {
|
|
|
499
626
|
return addHeapObject(ret);
|
|
500
627
|
}, arguments);
|
|
501
628
|
};
|
|
629
|
+
imports.wbg.__wbg_downloadFile_223fed31724de5a9 = function() {
|
|
630
|
+
return handleError(function(arg0, arg1, arg2, arg3) {
|
|
631
|
+
var ret = getObject(arg0).downloadFile(getStringFromWasm0(arg1, arg2), takeObject(arg3));
|
|
632
|
+
return addHeapObject(ret);
|
|
633
|
+
}, arguments);
|
|
634
|
+
};
|
|
502
635
|
imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
|
|
503
636
|
const obj = getObject(arg1);
|
|
504
637
|
var ret = JSON.stringify(obj === void 0 ? null : obj);
|
|
@@ -687,7 +820,7 @@ async function init(input) {
|
|
|
687
820
|
const a = state0.a;
|
|
688
821
|
state0.a = 0;
|
|
689
822
|
try {
|
|
690
|
-
return
|
|
823
|
+
return __wbg_adapter_199(a, state0.b, arg02, arg12);
|
|
691
824
|
} finally {
|
|
692
825
|
state0.a = a;
|
|
693
826
|
}
|
|
@@ -784,20 +917,20 @@ async function init(input) {
|
|
|
784
917
|
var ret = wasm.memory;
|
|
785
918
|
return addHeapObject(ret);
|
|
786
919
|
};
|
|
787
|
-
imports.wbg.
|
|
920
|
+
imports.wbg.__wbindgen_closure_wrapper222 = function(arg0, arg1, arg2) {
|
|
788
921
|
var ret = makeMutClosure(arg0, arg1, 4, __wbg_adapter_24);
|
|
789
922
|
return addHeapObject(ret);
|
|
790
923
|
};
|
|
791
|
-
imports.wbg.
|
|
792
|
-
var ret = makeMutClosure(arg0, arg1,
|
|
924
|
+
imports.wbg.__wbindgen_closure_wrapper918 = function(arg0, arg1, arg2) {
|
|
925
|
+
var ret = makeMutClosure(arg0, arg1, 150, __wbg_adapter_27);
|
|
793
926
|
return addHeapObject(ret);
|
|
794
927
|
};
|
|
795
928
|
if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
|
|
796
929
|
input = fetch(input);
|
|
797
930
|
}
|
|
798
|
-
const { instance, module:
|
|
931
|
+
const { instance, module: module3 } = await load(await input, imports);
|
|
799
932
|
wasm = instance.exports;
|
|
800
|
-
init.__wbindgen_wasm_module =
|
|
933
|
+
init.__wbindgen_wasm_module = module3;
|
|
801
934
|
wasm.__wbindgen_start();
|
|
802
935
|
return wasm;
|
|
803
936
|
}
|
|
@@ -919,12 +1052,6 @@ var HistoryStore = class {
|
|
|
919
1052
|
}
|
|
920
1053
|
};
|
|
921
1054
|
|
|
922
|
-
// src/utils/platform.ts
|
|
923
|
-
var isNode = typeof navigator === "undefined" ? true : false;
|
|
924
|
-
var userAgent = isNode ? "node" : navigator.userAgent;
|
|
925
|
-
var isFirefox = userAgent.includes("Firefox");
|
|
926
|
-
var isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);
|
|
927
|
-
|
|
928
1055
|
// src/utils/files.ts
|
|
929
1056
|
function pickFiles(db) {
|
|
930
1057
|
return new Promise((resolve, _reject) => {
|
|
@@ -934,13 +1061,13 @@ function pickFiles(db) {
|
|
|
934
1061
|
const finish = async () => {
|
|
935
1062
|
console.log(input.files);
|
|
936
1063
|
closed = true;
|
|
937
|
-
const
|
|
938
|
-
for (let i = 0; i <
|
|
939
|
-
const file =
|
|
1064
|
+
const files2 = input.files;
|
|
1065
|
+
for (let i = 0; i < files2.length; ++i) {
|
|
1066
|
+
const file = files2.item(i);
|
|
940
1067
|
await db.dropFile(file.name);
|
|
941
1068
|
await db.registerFileHandle(file.name, file);
|
|
942
1069
|
}
|
|
943
|
-
resolve(
|
|
1070
|
+
resolve(files2.length);
|
|
944
1071
|
};
|
|
945
1072
|
const deferredFinish = async () => {
|
|
946
1073
|
window.removeEventListener("focus", deferredFinish);
|
|
@@ -965,7 +1092,7 @@ function pickFiles(db) {
|
|
|
965
1092
|
|
|
966
1093
|
// src/shell.ts
|
|
967
1094
|
var hasWebGL = () => {
|
|
968
|
-
if (isSafari) {
|
|
1095
|
+
if (duckdb.isSafari()) {
|
|
969
1096
|
return false;
|
|
970
1097
|
}
|
|
971
1098
|
const canvas = document.createElement("canvas");
|
|
@@ -992,6 +1119,13 @@ var ShellRuntime = class {
|
|
|
992
1119
|
}
|
|
993
1120
|
return await pickFiles(this.database);
|
|
994
1121
|
}
|
|
1122
|
+
async downloadFile(name2, buffer) {
|
|
1123
|
+
const blob = new Blob([buffer]);
|
|
1124
|
+
const link = document.createElement("a");
|
|
1125
|
+
link.href = URL.createObjectURL(blob);
|
|
1126
|
+
link.download = name2;
|
|
1127
|
+
link.click();
|
|
1128
|
+
}
|
|
995
1129
|
async readClipboardText() {
|
|
996
1130
|
return await navigator.clipboard.readText();
|
|
997
1131
|
}
|
|
@@ -1002,24 +1136,40 @@ var ShellRuntime = class {
|
|
|
1002
1136
|
this.history.push(value);
|
|
1003
1137
|
}
|
|
1004
1138
|
};
|
|
1139
|
+
function formatBytes(value) {
|
|
1140
|
+
const [multiple, k, suffix] = [1e3, "k", "B"];
|
|
1141
|
+
const exp = Math.log(value) / Math.log(multiple) | 0;
|
|
1142
|
+
const size = Number((value / Math.pow(multiple, exp)).toFixed(2));
|
|
1143
|
+
return `${size} ${exp ? `${k}MGTPEZY`[exp - 1] + suffix : `byte${size !== 1 ? "s" : ""}`}`;
|
|
1144
|
+
}
|
|
1005
1145
|
async function embed2(props) {
|
|
1006
|
-
await shell_default(props.
|
|
1146
|
+
await shell_default(props.shellModule);
|
|
1007
1147
|
const runtime = new ShellRuntime(props.container);
|
|
1008
1148
|
embed(props.container, runtime, {
|
|
1009
1149
|
backgroundColor: "#333",
|
|
1010
1150
|
withWebGL: hasWebGL()
|
|
1011
1151
|
});
|
|
1012
1152
|
props.container.onresize = runtime.resizeHandler;
|
|
1153
|
+
const TERM_BOLD = "\x1B[1m";
|
|
1154
|
+
const TERM_NORMAL = "\x1B[m";
|
|
1155
|
+
const TERM_CLEAR = "\x1B[2K\r";
|
|
1156
|
+
const progressHandler = (progress) => {
|
|
1157
|
+
if (progress.bytesTotal > 0) {
|
|
1158
|
+
const blocks = Math.floor(progress.bytesLoaded / progress.bytesTotal * 10);
|
|
1159
|
+
const bar = `${"#".repeat(blocks)}${"-".repeat(10 - blocks)}`;
|
|
1160
|
+
write(`${TERM_CLEAR}${TERM_BOLD}[ RUN ]${TERM_NORMAL} Loading ${bar}`);
|
|
1161
|
+
} else {
|
|
1162
|
+
write(`${TERM_CLEAR}${TERM_BOLD}[ RUN ]${TERM_NORMAL} Loading ${formatBytes(progress.bytesLoaded)}`);
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
writeln(`${TERM_BOLD}[ RUN ]${TERM_NORMAL} Instantiating DuckDB`);
|
|
1166
|
+
runtime.database = await props.resolveDatabase(progressHandler);
|
|
1167
|
+
writeln(`${TERM_CLEAR}${TERM_BOLD}[ OK ]${TERM_NORMAL} Instantiating DuckDB`);
|
|
1013
1168
|
const step = async (label, work) => {
|
|
1014
|
-
|
|
1015
|
-
const TERM_NORMAL = "\x1B[m";
|
|
1016
|
-
writeln(`${TERM_BOLD}[ RUN ]${TERM_NORMAL} ${label}`);
|
|
1169
|
+
writeln(`${TERM_BOLD}[ RUN ]${TERM_NORMAL} ${label}`);
|
|
1017
1170
|
await work();
|
|
1018
|
-
writeln(`${TERM_BOLD}[ OK
|
|
1171
|
+
writeln(`${TERM_BOLD}[ OK ]${TERM_NORMAL} ${label}`);
|
|
1019
1172
|
};
|
|
1020
|
-
await step("Resolving DuckDB", async () => {
|
|
1021
|
-
runtime.database = await props.resolveDatabase();
|
|
1022
|
-
});
|
|
1023
1173
|
await step("Loading Shell History", async () => {
|
|
1024
1174
|
await runtime.history.open();
|
|
1025
1175
|
const [hist, histCursor] = await runtime.history.load();
|
|
@@ -1029,5 +1179,11 @@ async function embed2(props) {
|
|
|
1029
1179
|
configureDatabase(runtime.database);
|
|
1030
1180
|
});
|
|
1031
1181
|
}
|
|
1032
|
-
|
|
1182
|
+
|
|
1183
|
+
// src/platform.ts
|
|
1184
|
+
function getJsDelivrModule() {
|
|
1185
|
+
const jsdelivr_dist_url = `https://cdn.jsdelivr.net/npm/${PACKAGE_NAME}@${PACKAGE_VERSION}/dist/`;
|
|
1186
|
+
return new URL(`${jsdelivr_dist_url}dist/shell_bg.wasm`);
|
|
1187
|
+
}
|
|
1188
|
+
module.exports = __toCommonJS(src_exports);
|
|
1033
1189
|
//# sourceMappingURL=shell.cjs.map
|