@duckdb/duckdb-wasm-shell
Advanced tools
Comparing version 1.13.1-dev24.0 to 1.13.1-dev240.0
(() => { | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); | ||
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { | ||
@@ -9,6 +16,17 @@ get: (a, b) => (typeof require !== "undefined" ? require : a)[b] | ||
}); | ||
var __reExport = (target, module2, copyDefault, desc) => { | ||
if (module2 && typeof module2 === "object" || typeof module2 === "function") { | ||
for (let key of __getOwnPropNames(module2)) | ||
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) | ||
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable }); | ||
} | ||
return target; | ||
}; | ||
var __toESM = (module2, isNodeMode) => { | ||
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2); | ||
}; | ||
// package.json | ||
var name = "@duckdb/duckdb-wasm-shell"; | ||
var version = "1.13.1-dev24.0"; | ||
var version = "1.13.1-dev240.0"; | ||
var description = ""; | ||
@@ -37,15 +55,15 @@ var author = "Andre Kohn <kohn.a@outlook.com>"; | ||
var dependencies = { | ||
"@duckdb/duckdb-wasm": "^1.13.1-dev24.0", | ||
xterm: "^4.16.0", | ||
"@duckdb/duckdb-wasm": "^1.13.1-dev240.0", | ||
xterm: "^4.17.0", | ||
"xterm-addon-fit": "^0.5.0", | ||
"xterm-addon-web-links": "^0.5.0", | ||
"xterm-addon-web-links": "^0.5.1", | ||
"xterm-addon-webgl": "^0.11.4" | ||
}; | ||
var devDependencies = { | ||
esbuild: "^0.14.11", | ||
eslint: "^8.6.0", | ||
esbuild: "^0.14.23", | ||
eslint: "^8.10.0", | ||
"eslint-plugin-jasmine": "^4.1.3", | ||
"eslint-plugin-react": "^7.28.0", | ||
"eslint-plugin-react": "^7.29.2", | ||
jasmine: "^4.0.2", | ||
"jasmine-core": "^4.0.0", | ||
"jasmine-core": "^4.0.1", | ||
"jasmine-spec-reporter": "^7.0.0", | ||
@@ -58,2 +76,3 @@ "make-dir": "^3.1.0", | ||
var scripts = { | ||
"install:wasmpack": "node ../../node_modules/wasm-pack/install.js", | ||
"build:debug": "node bundle.mjs debug && tsc --emitDeclarationOnly", | ||
@@ -75,6 +94,6 @@ "build:release": "node bundle.mjs release && tsc --emitDeclarationOnly", | ||
"./dist/shell_bg.wasm": "./dist/shell_bg.wasm", | ||
"./dist/shell.js": "./dist/shell_bg.js", | ||
"./dist/shell.cjs": "./dist/shell_bg.cjs", | ||
"./dist/shell.mjs": "./dist/shell_bg.mjs", | ||
"./dist/shell": "./dist/shell_bg.mjs", | ||
"./dist/shell.js": "./dist/shell.js", | ||
"./dist/shell.cjs": "./dist/shell.cjs", | ||
"./dist/shell.mjs": "./dist/shell.mjs", | ||
"./dist/shell": "./dist/shell.mjs", | ||
".": { | ||
@@ -115,2 +134,5 @@ types: "./dist/shell.d.ts", | ||
// src/shell.ts | ||
var duckdb = __toESM(__require("@duckdb/duckdb-wasm")); | ||
// crate/pkg/shell.js | ||
@@ -312,2 +334,7 @@ var import_duckdb_wasm = __require("@duckdb/duckdb-wasm"); | ||
} | ||
function write(text) { | ||
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
var len0 = WASM_VECTOR_LEN; | ||
wasm.write(ptr0, len0); | ||
} | ||
function writeln(text) { | ||
@@ -358,3 +385,3 @@ var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
} | ||
function __wbg_adapter_195(arg0, arg1, arg2, arg3) { | ||
function __wbg_adapter_199(arg0, arg1, arg2, arg3) { | ||
wasm.wasm_bindgen__convert__closures__invoke2_mut__h445be38df5ff7a40(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3)); | ||
@@ -566,2 +593,8 @@ } | ||
}; | ||
imports.wbg.__wbg_copyFileToBuffer_e4a7050307f57c30 = function() { | ||
return handleError(function(arg0, arg1, arg2) { | ||
var ret = getObject(arg0).copyFileToBuffer(getStringFromWasm0(arg1, arg2)); | ||
return addHeapObject(ret); | ||
}, arguments); | ||
}; | ||
imports.wbg.__wbg_dropFiles_4d857401e3dd75ab = function() { | ||
@@ -591,2 +624,8 @@ return handleError(function(arg0) { | ||
}; | ||
imports.wbg.__wbg_downloadFile_223fed31724de5a9 = function() { | ||
return handleError(function(arg0, arg1, arg2, arg3) { | ||
var ret = getObject(arg0).downloadFile(getStringFromWasm0(arg1, arg2), takeObject(arg3)); | ||
return addHeapObject(ret); | ||
}, arguments); | ||
}; | ||
imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) { | ||
@@ -780,3 +819,3 @@ const obj = getObject(arg1); | ||
try { | ||
return __wbg_adapter_195(a, state0.b, arg02, arg12); | ||
return __wbg_adapter_199(a, state0.b, arg02, arg12); | ||
} finally { | ||
@@ -878,8 +917,8 @@ state0.a = a; | ||
}; | ||
imports.wbg.__wbindgen_closure_wrapper220 = function(arg0, arg1, arg2) { | ||
imports.wbg.__wbindgen_closure_wrapper222 = function(arg0, arg1, arg2) { | ||
var ret = makeMutClosure(arg0, arg1, 4, __wbg_adapter_24); | ||
return addHeapObject(ret); | ||
}; | ||
imports.wbg.__wbindgen_closure_wrapper905 = function(arg0, arg1, arg2) { | ||
var ret = makeMutClosure(arg0, arg1, 148, __wbg_adapter_27); | ||
imports.wbg.__wbindgen_closure_wrapper918 = function(arg0, arg1, arg2) { | ||
var ret = makeMutClosure(arg0, arg1, 150, __wbg_adapter_27); | ||
return addHeapObject(ret); | ||
@@ -1014,12 +1053,2 @@ }; | ||
// src/platform.ts | ||
var isNode = typeof navigator === "undefined" ? true : false; | ||
var userAgent = isNode ? "node" : navigator.userAgent; | ||
var isFirefox = userAgent.includes("Firefox"); | ||
var isSafari = /^((?!chrome|android).)*safari/i.test(userAgent); | ||
function getJsDelivrModule() { | ||
const jsdelivr_dist_url = `https://cdn.jsdelivr.net/npm/${PACKAGE_NAME}@${PACKAGE_VERSION}/dist/`; | ||
return new URL(`${jsdelivr_dist_url}dist/shell_bg.wasm`); | ||
} | ||
// src/utils/files.ts | ||
@@ -1065,3 +1094,3 @@ function pickFiles(db) { | ||
var hasWebGL = () => { | ||
if (isSafari) { | ||
if (duckdb.isSafari()) { | ||
return false; | ||
@@ -1093,2 +1122,9 @@ } | ||
} | ||
async downloadFile(name2, buffer) { | ||
const blob = new Blob([buffer]); | ||
const link = document.createElement("a"); | ||
link.href = URL.createObjectURL(blob); | ||
link.download = name2; | ||
link.click(); | ||
} | ||
async readClipboardText() { | ||
@@ -1104,4 +1140,10 @@ return await navigator.clipboard.readText(); | ||
}; | ||
function formatBytes(value) { | ||
const [multiple, k, suffix] = [1e3, "k", "B"]; | ||
const exp = Math.log(value) / Math.log(multiple) | 0; | ||
const size = Number((value / Math.pow(multiple, exp)).toFixed(2)); | ||
return `${size} ${exp ? `${k}MGTPEZY`[exp - 1] + suffix : `byte${size !== 1 ? "s" : ""}`}`; | ||
} | ||
async function embed2(props) { | ||
await shell_default(props.wasmSource); | ||
await shell_default(props.shellModule); | ||
const runtime = new ShellRuntime(props.container); | ||
@@ -1113,12 +1155,22 @@ embed(props.container, runtime, { | ||
props.container.onresize = runtime.resizeHandler; | ||
const TERM_BOLD = "\x1B[1m"; | ||
const TERM_NORMAL = "\x1B[m"; | ||
const TERM_CLEAR = "\x1B[2K\r"; | ||
const progressHandler = (progress) => { | ||
if (progress.bytesTotal > 0) { | ||
const blocks = Math.floor(progress.bytesLoaded / progress.bytesTotal * 10); | ||
const bar = `${"#".repeat(blocks)}${"-".repeat(10 - blocks)}`; | ||
write(`${TERM_CLEAR}${TERM_BOLD}[ RUN ]${TERM_NORMAL} Loading ${bar}`); | ||
} else { | ||
write(`${TERM_CLEAR}${TERM_BOLD}[ RUN ]${TERM_NORMAL} Loading ${formatBytes(progress.bytesLoaded)}`); | ||
} | ||
}; | ||
writeln(`${TERM_BOLD}[ RUN ]${TERM_NORMAL} Instantiating DuckDB`); | ||
runtime.database = await props.resolveDatabase(progressHandler); | ||
writeln(`${TERM_CLEAR}${TERM_BOLD}[ OK ]${TERM_NORMAL} Instantiating DuckDB`); | ||
const step = async (label, work) => { | ||
const TERM_BOLD = "\x1B[1m"; | ||
const TERM_NORMAL = "\x1B[m"; | ||
writeln(`${TERM_BOLD}[ RUN ]${TERM_NORMAL} ${label}`); | ||
writeln(`${TERM_BOLD}[ RUN ]${TERM_NORMAL} ${label}`); | ||
await work(); | ||
writeln(`${TERM_BOLD}[ OK ]${TERM_NORMAL} ${label}`); | ||
writeln(`${TERM_BOLD}[ OK ]${TERM_NORMAL} ${label}`); | ||
}; | ||
await step("Resolving DuckDB", async () => { | ||
runtime.database = await props.resolveDatabase(); | ||
}); | ||
await step("Loading Shell History", async () => { | ||
@@ -1133,3 +1185,9 @@ await runtime.history.open(); | ||
} | ||
// src/platform.ts | ||
function getJsDelivrModule() { | ||
const jsdelivr_dist_url = `https://cdn.jsdelivr.net/npm/${PACKAGE_NAME}@${PACKAGE_VERSION}/dist/`; | ||
return new URL(`${jsdelivr_dist_url}dist/shell_bg.wasm`); | ||
} | ||
})(); | ||
//# sourceMappingURL=shell.js.map |
@@ -1,3 +0,1 @@ | ||
export declare const isFirefox: boolean; | ||
export declare const isSafari: boolean; | ||
export declare function getJsDelivrModule(): URL; |
import * as duckdb from '@duckdb/duckdb-wasm'; | ||
interface ShellProps { | ||
wasmSource: RequestInfo | URL | Response | BufferSource | WebAssembly.Module; | ||
shellModule: RequestInfo | URL | Response | BufferSource | WebAssembly.Module; | ||
container: HTMLDivElement; | ||
resolveDatabase: () => Promise<duckdb.AsyncDuckDB>; | ||
resolveDatabase: (p: duckdb.InstantiationProgressHandler) => Promise<duckdb.AsyncDuckDB>; | ||
} | ||
export declare function embed(props: ShellProps): Promise<void>; | ||
export {}; |
{ | ||
"name": "@duckdb/duckdb-wasm-shell", | ||
"version": "1.13.1-dev24.0", | ||
"version": "1.13.1-dev240.0", | ||
"description": "", | ||
@@ -27,15 +27,15 @@ "author": "Andre Kohn <kohn.a@outlook.com>", | ||
"dependencies": { | ||
"@duckdb/duckdb-wasm": "^1.13.1-dev24.0", | ||
"xterm": "^4.16.0", | ||
"@duckdb/duckdb-wasm": "^1.13.1-dev240.0", | ||
"xterm": "^4.17.0", | ||
"xterm-addon-fit": "^0.5.0", | ||
"xterm-addon-web-links": "^0.5.0", | ||
"xterm-addon-web-links": "^0.5.1", | ||
"xterm-addon-webgl": "^0.11.4" | ||
}, | ||
"devDependencies": { | ||
"esbuild": "^0.14.11", | ||
"eslint": "^8.6.0", | ||
"esbuild": "^0.14.23", | ||
"eslint": "^8.10.0", | ||
"eslint-plugin-jasmine": "^4.1.3", | ||
"eslint-plugin-react": "^7.28.0", | ||
"eslint-plugin-react": "^7.29.2", | ||
"jasmine": "^4.0.2", | ||
"jasmine-core": "^4.0.0", | ||
"jasmine-core": "^4.0.1", | ||
"jasmine-spec-reporter": "^7.0.0", | ||
@@ -48,2 +48,3 @@ "make-dir": "^3.1.0", | ||
"scripts": { | ||
"install:wasmpack": "node ../../node_modules/wasm-pack/install.js", | ||
"build:debug": "node bundle.mjs debug && tsc --emitDeclarationOnly", | ||
@@ -65,6 +66,6 @@ "build:release": "node bundle.mjs release && tsc --emitDeclarationOnly", | ||
"./dist/shell_bg.wasm": "./dist/shell_bg.wasm", | ||
"./dist/shell.js": "./dist/shell_bg.js", | ||
"./dist/shell.cjs": "./dist/shell_bg.cjs", | ||
"./dist/shell.mjs": "./dist/shell_bg.mjs", | ||
"./dist/shell": "./dist/shell_bg.mjs", | ||
"./dist/shell.js": "./dist/shell.js", | ||
"./dist/shell.cjs": "./dist/shell.cjs", | ||
"./dist/shell.mjs": "./dist/shell.mjs", | ||
"./dist/shell": "./dist/shell.mjs", | ||
".": { | ||
@@ -71,0 +72,0 @@ "types": "./dist/shell.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2337546
837
3536
9
Updatedxterm@^4.17.0
Updatedxterm-addon-web-links@^0.5.1