@eclipse-docks/extension-python-runtime 0.7.97 → 0.7.99
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/{api-CpA1OGOM.js → api-C6Mnm5y_.js} +1 -1
- package/dist/api.js +2 -2
- package/dist/assets/pyworker-CSZ-Rp_9.js.map +1 -0
- package/dist/{commands-BOpt2gSk.js → commands-D0y3XxCw.js} +2 -2
- package/dist/{commands-BOpt2gSk.js.map → commands-D0y3XxCw.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/pyservice-DGwNXWO4.js +267 -0
- package/dist/pyservice-DGwNXWO4.js.map +1 -0
- package/dist/pyservice.d.ts.map +1 -1
- package/dist/{python-editor-Ctze4gva.js → python-editor-BpEUhgXs.js} +3 -3
- package/dist/{python-editor-Ctze4gva.js.map → python-editor-BpEUhgXs.js.map} +1 -1
- package/dist/{python-runtime-extension-Cq6sUjv7.js → python-runtime-extension-qSvGLwAk.js} +3 -3
- package/dist/{python-runtime-extension-Cq6sUjv7.js.map → python-runtime-extension-qSvGLwAk.js.map} +1 -1
- package/package.json +1 -1
- package/dist/assets/__vite-browser-external-CeeQihCx.js +0 -9
- package/dist/assets/__vite-browser-external-CeeQihCx.js.map +0 -1
- package/dist/assets/chunk-Bv4aU9fc.js +0 -28
- package/dist/assets/pyworker-BXXy_GIK.js.map +0 -1
- package/dist/pyservice-DyVO8QVd.js +0 -265
- package/dist/pyservice-DyVO8QVd.js.map +0 -1
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import { Directory, File, createLogger, workspaceService } from "@eclipse-docks/core";
|
|
2
|
-
//#region src/pyworker.ts?worker&inline
|
|
3
|
-
var jsContent = "import { n as __require, r as __toESM } from \"./chunk-Bv4aU9fc.js\";\nvar package_default = {\n name: \"pyodide\",\n version: \"0.29.3\",\n description: \"The Pyodide JavaScript package\",\n keywords: [\"python\", \"webassembly\"],\n homepage: \"https://github.com/pyodide/pyodide\",\n repository: {\n \"type\": \"git\",\n \"url\": \"https://github.com/pyodide/pyodide\"\n },\n bugs: { \"url\": \"https://github.com/pyodide/pyodide/issues\" },\n license: \"MPL-2.0\",\n dependencies: {\n \"@types/emscripten\": \"^1.41.4\",\n \"ws\": \"^8.5.0\"\n },\n devDependencies: {\n \"@biomejs/biome\": \"2.1.1\",\n \"@playwright/test\": \"^1.55.1\",\n \"@types/assert\": \"^1.5.6\",\n \"@types/expect\": \"^24.3.0\",\n \"@types/node\": \"^20.8.4\",\n \"@types/ws\": \"^8.5.3\",\n \"cross-env\": \"^7.0.3\",\n \"dts-bundle-generator\": \"^8.1.1\",\n \"esbuild\": \"^0.25.0\",\n \"express\": \"^4.17.3\",\n \"mocha\": \"^9.0.2\",\n \"npm-run-all\": \"^4.1.5\",\n \"nyc\": \"^15.1.0\",\n \"playwright\": \"^1.55.1\",\n \"prettier\": \"^2.2.1\",\n \"tsd\": \"^0.24.1\",\n \"tsx\": \"^4.20.5\",\n \"typedoc\": \"^0.27.6\",\n \"typescript\": \"5.7\",\n \"wabt\": \"^1.0.32\"\n },\n main: \"pyodide.js\",\n exports: {\n \".\": {\n \"types\": \"./pyodide.d.ts\",\n \"require\": \"./pyodide.js\",\n \"import\": \"./pyodide.mjs\"\n },\n \"./ffi\": { \"types\": \"./ffi.d.ts\" },\n \"./pyodide.asm.wasm\": \"./pyodide.asm.wasm\",\n \"./pyodide.asm.js\": \"./pyodide.asm.js\",\n \"./python_stdlib.zip\": \"./python_stdlib.zip\",\n \"./pyodide.mjs\": \"./pyodide.mjs\",\n \"./pyodide.js\": \"./pyodide.js\",\n \"./package.json\": \"./package.json\",\n \"./pyodide-lock.json\": \"./pyodide-lock.json\"\n },\n files: [\n \"pyodide.asm.js\",\n \"pyodide.asm.wasm\",\n \"python_stdlib.zip\",\n \"pyodide.mjs\",\n \"pyodide.js.map\",\n \"pyodide.mjs.map\",\n \"pyodide.d.ts\",\n \"ffi.d.ts\",\n \"pyodide-lock.json\",\n \"console.html\",\n \"console-v2.html\"\n ],\n browser: {\n \"child_process\": false,\n \"crypto\": false,\n \"fs\": false,\n \"fs/promises\": false,\n \"path\": false,\n \"url\": false,\n \"vm\": false,\n \"ws\": false\n },\n scripts: {\n \"build-inner\": \"node esbuild.config.inner.mjs\",\n \"build\": \"tsc --noEmit && node esbuild.config.outer.mjs\",\n \"test\": \"npm-run-all test:*\",\n \"test:unit\": \"cross-env TEST_NODE=1 node --import tsx --experimental-wasm-stack-switching --test 'test/unit/**/*.test.*'\",\n \"test:node\": \"cross-env TEST_NODE=1 npx playwright test\",\n \"test:browser\": \"npx playwright test\",\n \"tsc\": \"tsc --noEmit\",\n \"coverage\": \"cross-env TEST_NODE=1 npm-run-all coverage:*\",\n \"coverage:build\": \"nyc npm run test:node\"\n },\n nyc: {\n \"reporter\": [\"html\", \"text-summary\"],\n \"include\": [\"*.ts\"],\n \"all\": true,\n \"clean\": true,\n \"cache\": false,\n \"instrument\": false,\n \"checkCoverage\": true,\n \"statements\": 95,\n \"functions\": 95,\n \"branches\": 80,\n \"lines\": 95\n },\n tsd: { \"compilerOptions\": { \"lib\": [\"ES2017\", \"DOM\"] } },\n types: \"./pyodide.d.ts\",\n engines: { \"node\": \">=18.0.0\" }\n};\n//#endregion\n//#region ../../node_modules/pyodide/pyodide.mjs\nvar Z = Object.defineProperty;\nvar o = (e, t) => Z(e, \"name\", {\n value: t,\n configurable: !0\n}), A = ((e) => typeof __require < \"u\" ? __require : typeof Proxy < \"u\" ? new Proxy(e, { get: (t, n) => (typeof __require < \"u\" ? __require : t)[n] }) : e)(function(e) {\n if (typeof __require < \"u\") return __require.apply(this, arguments);\n throw Error(\"Dynamic require of \\\"\" + e + \"\\\" is not supported\");\n});\nvar W = (() => {\n for (var e = new Uint8Array(128), t = 0; t < 64; t++) e[t < 26 ? t + 65 : t < 52 ? t + 71 : t < 62 ? t - 4 : t * 4 - 205] = t;\n return (n) => {\n for (var i = n.length, s = new Uint8Array((i - (n[i - 1] == \"=\") - (n[i - 2] == \"=\")) * 3 / 4 | 0), r = 0, a = 0; r < i;) {\n var l = e[n.charCodeAt(r++)], c = e[n.charCodeAt(r++)], d = e[n.charCodeAt(r++)], u = e[n.charCodeAt(r++)];\n s[a++] = l << 2 | c >> 4, s[a++] = c << 4 | d >> 2, s[a++] = d << 6 | u;\n }\n return s;\n };\n})();\nfunction ee(e) {\n return !isNaN(parseFloat(e)) && isFinite(e);\n}\no(ee, \"_isNumber\");\nfunction P(e) {\n return e.charAt(0).toUpperCase() + e.substring(1);\n}\no(P, \"_capitalize\");\nfunction x(e) {\n return function() {\n return this[e];\n };\n}\no(x, \"_getter\");\nvar N = [\n \"isConstructor\",\n \"isEval\",\n \"isNative\",\n \"isToplevel\"\n], S = [\"columnNumber\", \"lineNumber\"], I = [\n \"fileName\",\n \"functionName\",\n \"source\"\n], F = N.concat(S, I, [\"args\"], [\"evalOrigin\"]);\nfunction p(e) {\n if (e) for (var t = 0; t < F.length; t++) e[F[t]] !== void 0 && this[\"set\" + P(F[t])](e[F[t]]);\n}\no(p, \"StackFrame\");\np.prototype = {\n getArgs: o(function() {\n return this.args;\n }, \"getArgs\"),\n setArgs: o(function(e) {\n if (Object.prototype.toString.call(e) !== \"[object Array]\") throw new TypeError(\"Args must be an Array\");\n this.args = e;\n }, \"setArgs\"),\n getEvalOrigin: o(function() {\n return this.evalOrigin;\n }, \"getEvalOrigin\"),\n setEvalOrigin: o(function(e) {\n if (e instanceof p) this.evalOrigin = e;\n else if (e instanceof Object) this.evalOrigin = new p(e);\n else throw new TypeError(\"Eval Origin must be an Object or StackFrame\");\n }, \"setEvalOrigin\"),\n toString: o(function() {\n var e = this.getFileName() || \"\", t = this.getLineNumber() || \"\", n = this.getColumnNumber() || \"\", i = this.getFunctionName() || \"\";\n return this.getIsEval() ? e ? \"[eval] (\" + e + \":\" + t + \":\" + n + \")\" : \"[eval]:\" + t + \":\" + n : i ? i + \" (\" + e + \":\" + t + \":\" + n + \")\" : e + \":\" + t + \":\" + n;\n }, \"toString\")\n};\np.fromString = o(function(t) {\n var n = t.indexOf(\"(\"), i = t.lastIndexOf(\")\"), s = t.substring(0, n), r = t.substring(n + 1, i).split(\",\"), a = t.substring(i + 1);\n if (a.indexOf(\"@\") === 0) var l = /@(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(a, \"\"), c = l[1], d = l[2], u = l[3];\n return new p({\n functionName: s,\n args: r || void 0,\n fileName: c,\n lineNumber: d || void 0,\n columnNumber: u || void 0\n });\n}, \"StackFrame$$fromString\");\nfor (b = 0; b < N.length; b++) p.prototype[\"get\" + P(N[b])] = x(N[b]), p.prototype[\"set\" + P(N[b])] = function(e) {\n return function(t) {\n this[e] = !!t;\n };\n}(N[b]);\nvar b;\nfor (v = 0; v < S.length; v++) p.prototype[\"get\" + P(S[v])] = x(S[v]), p.prototype[\"set\" + P(S[v])] = function(e) {\n return function(t) {\n if (!ee(t)) throw new TypeError(e + \" must be a Number\");\n this[e] = Number(t);\n };\n}(S[v]);\nvar v;\nfor (E = 0; E < I.length; E++) p.prototype[\"get\" + P(I[E])] = x(I[E]), p.prototype[\"set\" + P(I[E])] = function(e) {\n return function(t) {\n this[e] = String(t);\n };\n}(I[E]);\nvar E, O = p;\nfunction re() {\n var e = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m, t = /^(eval@)?(\\[native code])?$/;\n return {\n parse: o(function(i) {\n if (i.stack && i.stack.match(e)) return this.parseV8OrIE(i);\n if (i.stack) return this.parseFFOrSafari(i);\n throw new Error(\"Cannot parse given Error object\");\n }, \"ErrorStackParser$$parse\"),\n extractLocation: o(function(i) {\n if (i.indexOf(\":\") === -1) return [i];\n var r = /(.+?)(?::(\\d+))?(?::(\\d+))?$/.exec(i.replace(/[()]/g, \"\"));\n return [\n r[1],\n r[2] || void 0,\n r[3] || void 0\n ];\n }, \"ErrorStackParser$$extractLocation\"),\n parseV8OrIE: o(function(i) {\n return i.stack.split(`\n`).filter(function(r) {\n return !!r.match(e);\n }, this).map(function(r) {\n r.indexOf(\"(eval \") > -1 && (r = r.replace(/eval code/g, \"eval\").replace(/(\\(eval at [^()]*)|(,.*$)/g, \"\"));\n var a = r.replace(/^\\s+/, \"\").replace(/\\(eval code/g, \"(\").replace(/^.*?\\s+/, \"\"), l = a.match(/ (\\(.+\\)$)/);\n a = l ? a.replace(l[0], \"\") : a;\n var c = this.extractLocation(l ? l[1] : a);\n return new O({\n functionName: l && a || void 0,\n fileName: [\"eval\", \"<anonymous>\"].indexOf(c[0]) > -1 ? void 0 : c[0],\n lineNumber: c[1],\n columnNumber: c[2],\n source: r\n });\n }, this);\n }, \"ErrorStackParser$$parseV8OrIE\"),\n parseFFOrSafari: o(function(i) {\n return i.stack.split(`\n`).filter(function(r) {\n return !r.match(t);\n }, this).map(function(r) {\n if (r.indexOf(\" > eval\") > -1 && (r = r.replace(/ line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g, \":$1\")), r.indexOf(\"@\") === -1 && r.indexOf(\":\") === -1) return new O({ functionName: r });\n var a = /((.*\".+\"[^@]*)?[^@]*)(?:@)/, l = r.match(a), c = l && l[1] ? l[1] : void 0, d = this.extractLocation(r.replace(a, \"\"));\n return new O({\n functionName: c,\n fileName: d[0],\n lineNumber: d[1],\n columnNumber: d[2],\n source: r\n });\n }, this);\n }, \"ErrorStackParser$$parseFFOrSafari\")\n };\n}\no(re, \"ErrorStackParser\");\nvar M = new re();\nfunction oe() {\n if (typeof API < \"u\" && API !== globalThis.API) return API.runtimeEnv;\n return ae({\n IN_BUN: typeof Bun < \"u\",\n IN_DENO: typeof Deno < \"u\",\n IN_NODE: typeof process == \"object\" && typeof process.versions == \"object\" && typeof process.versions.node == \"string\" && !process.browser,\n IN_SAFARI: typeof navigator == \"object\" && typeof navigator.userAgent == \"string\" && navigator.userAgent.indexOf(\"Chrome\") === -1 && navigator.userAgent.indexOf(\"Safari\") > -1,\n IN_SHELL: typeof read == \"function\" && typeof load == \"function\"\n });\n}\no(oe, \"getGlobalRuntimeEnv\");\nvar f = oe();\nfunction ae(e) {\n let t = e.IN_NODE && typeof module < \"u\" && module.exports && typeof A == \"function\" && typeof __dirname == \"string\", n = e.IN_NODE && !t, i = !e.IN_NODE && !e.IN_DENO && !e.IN_BUN, s = i && typeof window < \"u\" && typeof window.document < \"u\" && typeof document.createElement == \"function\" && \"sessionStorage\" in window && typeof globalThis.importScripts != \"function\", r = i && typeof globalThis.WorkerGlobalScope < \"u\" && typeof globalThis.self < \"u\" && globalThis.self instanceof globalThis.WorkerGlobalScope;\n return {\n ...e,\n IN_BROWSER: i,\n IN_BROWSER_MAIN_THREAD: s,\n IN_BROWSER_WEB_WORKER: r,\n IN_NODE_COMMONJS: t,\n IN_NODE_ESM: n\n };\n}\no(ae, \"calculateDerivedFlags\");\nvar $, D, H, B, L;\nasync function T() {\n if (!f.IN_NODE || ($ = (await import(\"./__vite-browser-external-CeeQihCx.js\").then((m) => /* @__PURE__ */ __toESM(m.default, 1))).default, B = await import(\"./__vite-browser-external-CeeQihCx.js\").then((m) => /* @__PURE__ */ __toESM(m.default, 1)), L = await import(\"./__vite-browser-external-CeeQihCx.js\").then((m) => /* @__PURE__ */ __toESM(m.default, 1)), H = (await import(\"./__vite-browser-external-CeeQihCx.js\").then((m) => /* @__PURE__ */ __toESM(m.default, 1))).default, D = await import(\"./__vite-browser-external-CeeQihCx.js\").then((m) => /* @__PURE__ */ __toESM(m.default, 1)), C = D.sep, typeof A < \"u\")) return;\n let s = {\n fs: B,\n crypto: await import(\"./__vite-browser-external-CeeQihCx.js\").then((m) => /* @__PURE__ */ __toESM(m.default, 1)),\n ws: await import(\"./__vite-browser-external-CeeQihCx.js\").then((m) => /* @__PURE__ */ __toESM(m.default, 1)),\n child_process: await import(\"./__vite-browser-external-CeeQihCx.js\").then((m) => /* @__PURE__ */ __toESM(m.default, 1))\n };\n globalThis.require = function(r) {\n return s[r];\n };\n}\no(T, \"initNodeModules\");\nfunction se(e, t) {\n return D.resolve(t || \".\", e);\n}\no(se, \"node_resolvePath\");\nfunction le(e, t) {\n return t === void 0 && (t = location), new URL(e, t).toString();\n}\no(le, \"browser_resolvePath\");\nvar _;\nf.IN_NODE ? _ = se : f.IN_SHELL ? _ = o((e) => e, \"resolvePath\") : _ = le;\nvar C;\nf.IN_NODE || (C = \"/\");\nfunction ce(e, t) {\n return e.startsWith(\"file://\") && (e = e.slice(7)), e.includes(\"://\") ? { response: fetch(e) } : { binary: L.readFile(e).then((n) => new Uint8Array(n.buffer, n.byteOffset, n.byteLength)) };\n}\no(ce, \"node_getBinaryResponse\");\nfunction de(e, t) {\n if (e.startsWith(\"file://\") && (e = e.slice(7)), e.includes(\"://\")) throw new Error(\"Shell cannot fetch urls\");\n return { binary: Promise.resolve(new Uint8Array(readbuffer(e))) };\n}\no(de, \"shell_getBinaryResponse\");\nfunction ue(e, t) {\n let n = new URL(e, location);\n return { response: fetch(n, t ? { integrity: t } : {}) };\n}\no(ue, \"browser_getBinaryResponse\");\nvar R;\nf.IN_NODE ? R = ce : f.IN_SHELL ? R = de : R = ue;\nasync function j(e, t) {\n let { response: n, binary: i } = R(e, t);\n if (i) return i;\n let s = await n;\n if (!s.ok) throw new Error(`Failed to load '${e}': request failed.`);\n return new Uint8Array(await s.arrayBuffer());\n}\no(j, \"loadBinaryFile\");\nvar w;\nif (f.IN_BROWSER_MAIN_THREAD) w = o(async (e) => await import(e), \"loadScript\");\nelse if (f.IN_BROWSER_WEB_WORKER) w = o(async (e) => {\n try {\n globalThis.importScripts(e);\n } catch (t) {\n if (t instanceof TypeError) await import(e);\n else throw t;\n }\n}, \"loadScript\");\nelse if (f.IN_NODE) w = fe;\nelse if (f.IN_SHELL) w = load;\nelse throw new Error(\"Cannot determine runtime environment\");\nasync function fe(e) {\n e.startsWith(\"file://\") && (e = e.slice(7)), e.includes(\"://\") ? H.runInThisContext(await (await fetch(e)).text()) : await import($.pathToFileURL(e).href);\n}\no(fe, \"nodeLoadScript\");\nasync function V(e) {\n if (f.IN_NODE) {\n await T();\n let t = await L.readFile(e, { encoding: \"utf8\" });\n return JSON.parse(t);\n } else if (f.IN_SHELL) {\n let t = read(e);\n return JSON.parse(t);\n } else return await (await fetch(e)).json();\n}\no(V, \"loadLockFile\");\nasync function z() {\n if (f.IN_NODE_COMMONJS) return __dirname;\n let e;\n try {\n throw new Error();\n } catch (i) {\n e = i;\n }\n let t = M.parse(e)[0].fileName;\n if (f.IN_NODE && !t.startsWith(\"file://\") && (t = `file://${t}`), f.IN_NODE_ESM) {\n let i = await import(\"./__vite-browser-external-CeeQihCx.js\").then((m) => /* @__PURE__ */ __toESM(m.default, 1));\n return (await import(\"./__vite-browser-external-CeeQihCx.js\").then((m) => /* @__PURE__ */ __toESM(m.default, 1))).fileURLToPath(i.dirname(t));\n }\n let n = t.lastIndexOf(C);\n if (n === -1) throw new Error(\"Could not extract indexURL path from pyodide module location. Please pass the indexURL explicitly to loadPyodide.\");\n return t.slice(0, n);\n}\no(z, \"calculateDirname\");\nfunction J(e) {\n return e.substring(0, e.lastIndexOf(\"/\") + 1) || globalThis.location?.toString() || \".\";\n}\no(J, \"calculateInstallBaseUrl\");\nfunction q(e) {\n let t = e.FS, n = e.FS.filesystems.MEMFS, i = e.PATH, s = {\n DIR_MODE: 16895,\n FILE_MODE: 33279,\n mount: o(function(r) {\n if (!r.opts.fileSystemHandle) throw new Error(\"opts.fileSystemHandle is required\");\n return n.mount.apply(null, arguments);\n }, \"mount\"),\n syncfs: o(async (r, a, l) => {\n try {\n let c = s.getLocalSet(r), d = await s.getRemoteSet(r), u = a ? d : c, y = a ? c : d;\n await s.reconcile(r, u, y), l(null);\n } catch (c) {\n l(c);\n }\n }, \"syncfs\"),\n getLocalSet: o((r) => {\n let a = Object.create(null);\n function l(u) {\n return u !== \".\" && u !== \"..\";\n }\n o(l, \"isRealDir\");\n function c(u) {\n return (y) => i.join2(u, y);\n }\n o(c, \"toAbsolute\");\n let d = t.readdir(r.mountpoint).filter(l).map(c(r.mountpoint));\n for (; d.length;) {\n let u = d.pop(), y = t.stat(u);\n t.isDir(y.mode) && d.push.apply(d, t.readdir(u).filter(l).map(c(u))), a[u] = {\n timestamp: y.mtime,\n mode: y.mode\n };\n }\n return {\n type: \"local\",\n entries: a\n };\n }, \"getLocalSet\"),\n getRemoteSet: o(async (r) => {\n let a = Object.create(null), l = await me(r.opts.fileSystemHandle);\n for (let [c, d] of l) c !== \".\" && (a[i.join2(r.mountpoint, c)] = {\n timestamp: d.kind === \"file\" ? new Date((await d.getFile()).lastModified) : /* @__PURE__ */ new Date(),\n mode: d.kind === \"file\" ? s.FILE_MODE : s.DIR_MODE\n });\n return {\n type: \"remote\",\n entries: a,\n handles: l\n };\n }, \"getRemoteSet\"),\n loadLocalEntry: o((r) => {\n let l = t.lookupPath(r, {}).node, c = t.stat(r);\n if (t.isDir(c.mode)) return {\n timestamp: c.mtime,\n mode: c.mode\n };\n if (t.isFile(c.mode)) return l.contents = n.getFileDataAsTypedArray(l), {\n timestamp: c.mtime,\n mode: c.mode,\n contents: l.contents\n };\n throw new Error(\"node type not supported\");\n }, \"loadLocalEntry\"),\n storeLocalEntry: o((r, a) => {\n if (t.isDir(a.mode)) t.mkdirTree(r, a.mode);\n else if (t.isFile(a.mode)) t.writeFile(r, a.contents, { canOwn: !0 });\n else throw new Error(\"node type not supported\");\n t.chmod(r, a.mode), t.utime(r, a.timestamp, a.timestamp);\n }, \"storeLocalEntry\"),\n removeLocalEntry: o((r) => {\n var a = t.stat(r);\n t.isDir(a.mode) ? t.rmdir(r) : t.isFile(a.mode) && t.unlink(r);\n }, \"removeLocalEntry\"),\n loadRemoteEntry: o(async (r) => {\n if (r.kind === \"file\") {\n let a = await r.getFile();\n return {\n contents: new Uint8Array(await a.arrayBuffer()),\n mode: s.FILE_MODE,\n timestamp: new Date(a.lastModified)\n };\n } else {\n if (r.kind === \"directory\") return {\n mode: s.DIR_MODE,\n timestamp: /* @__PURE__ */ new Date()\n };\n throw new Error(\"unknown kind: \" + r.kind);\n }\n }, \"loadRemoteEntry\"),\n storeRemoteEntry: o(async (r, a, l) => {\n let c = r.get(i.dirname(a)), d = t.isFile(l.mode) ? await c.getFileHandle(i.basename(a), { create: !0 }) : await c.getDirectoryHandle(i.basename(a), { create: !0 });\n if (d.kind === \"file\") {\n let u = await d.createWritable();\n await u.write(l.contents), await u.close();\n }\n r.set(a, d);\n }, \"storeRemoteEntry\"),\n removeRemoteEntry: o(async (r, a) => {\n await r.get(i.dirname(a)).removeEntry(i.basename(a)), r.delete(a);\n }, \"removeRemoteEntry\"),\n reconcile: o(async (r, a, l) => {\n let c = 0, d = [];\n Object.keys(a.entries).forEach(function(m) {\n let g = a.entries[m], h = l.entries[m];\n (!h || t.isFile(g.mode) && g.timestamp.getTime() > h.timestamp.getTime()) && (d.push(m), c++);\n }), d.sort();\n let u = [];\n if (Object.keys(l.entries).forEach(function(m) {\n a.entries[m] || (u.push(m), c++);\n }), u.sort().reverse(), !c) return;\n let y = a.type === \"remote\" ? a.handles : l.handles;\n for (let m of d) {\n let g = i.normalize(m.replace(r.mountpoint, \"/\")).substring(1);\n if (l.type === \"local\") {\n let h = y.get(g), Q = await s.loadRemoteEntry(h);\n s.storeLocalEntry(m, Q);\n } else {\n let h = s.loadLocalEntry(m);\n await s.storeRemoteEntry(y, g, h);\n }\n }\n for (let m of u) if (l.type === \"local\") s.removeLocalEntry(m);\n else {\n let g = i.normalize(m.replace(r.mountpoint, \"/\")).substring(1);\n await s.removeRemoteEntry(y, g);\n }\n }, \"reconcile\")\n };\n e.FS.filesystems.NATIVEFS_ASYNC = s;\n}\no(q, \"initializeNativeFS\");\nvar me = o(async (e) => {\n let t = [];\n async function n(s) {\n for await (let r of s.values()) t.push(r), r.kind === \"directory\" && await n(r);\n }\n o(n, \"collect\"), await n(e);\n let i = /* @__PURE__ */ new Map();\n i.set(\".\", e);\n for (let s of t) {\n let r = (await e.resolve(s)).join(\"/\");\n i.set(r, s);\n }\n return i;\n}, \"getFsHandles\");\nvar G = W(\"AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECByECD2NyZWF0ZV9zZW50aW5lbAAAC2lzX3NlbnRpbmVsAAEKEwIHAPsBAPsbCwkAIAD7GvsUAAs=\");\nvar ye = async function() {\n if (!(globalThis.navigator && (/iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === \"MacIntel\" && typeof navigator.maxTouchPoints < \"u\" && navigator.maxTouchPoints > 1))) try {\n let t = await WebAssembly.compile(G);\n return await WebAssembly.instantiate(t);\n } catch (t) {\n if (t instanceof WebAssembly.CompileError) return;\n throw t;\n }\n}();\nasync function K() {\n let e = await ye;\n if (e) return e.exports;\n let t = Symbol(\"error marker\");\n return {\n create_sentinel: o(() => t, \"create_sentinel\"),\n is_sentinel: o((n) => n === t, \"is_sentinel\")\n };\n}\no(K, \"getSentinelImport\");\nfunction Y(e) {\n let t = {\n config: e,\n runtimeEnv: f\n }, n = {\n noImageDecoding: !0,\n noAudioDecoding: !0,\n noWasmDecoding: !1,\n preRun: he(e),\n print: e.stdout,\n printErr: e.stderr,\n onExit(i) {\n n.exitCode = i;\n },\n thisProgram: e._sysExecutable,\n arguments: e.args,\n API: t,\n locateFile: o((i) => e.indexURL + i, \"locateFile\"),\n instantiateWasm: Ne(e.indexURL)\n };\n return n;\n}\no(Y, \"createSettings\");\nfunction ge(e) {\n return function(t) {\n let n = \"/\";\n try {\n t.FS.mkdirTree(e);\n } catch (i) {\n console.error(`Error occurred while making a home directory '${e}':`), console.error(i), console.error(`Using '${n}' for a home directory instead`), e = n;\n }\n t.FS.chdir(e);\n };\n}\no(ge, \"createHomeDirectory\");\nfunction be(e) {\n return function(t) {\n Object.assign(t.ENV, e);\n };\n}\no(be, \"setEnvironment\");\nfunction ve(e) {\n return e ? [async (t) => {\n t.addRunDependency(\"fsInitHook\");\n try {\n await e(t.FS, { sitePackages: t.API.sitePackages });\n } finally {\n t.removeRunDependency(\"fsInitHook\");\n }\n }] : [];\n}\no(ve, \"callFsInitHook\");\nfunction Ee(e) {\n let t = e.HEAPU32[e._Py_Version >>> 2];\n return [\n t >>> 24 & 255,\n t >>> 16 & 255,\n t >>> 8 & 255\n ];\n}\no(Ee, \"computeVersionTuple\");\nfunction Pe(e) {\n let t = j(e);\n return async (n) => {\n n.API.pyVersionTuple = Ee(n);\n let [i, s] = n.API.pyVersionTuple;\n n.FS.mkdirTree(\"/lib\"), n.API.sitePackages = `/lib/python${i}.${s}/site-packages`, n.FS.mkdirTree(n.API.sitePackages), n.addRunDependency(\"install-stdlib\");\n try {\n let r = await t;\n n.FS.writeFile(`/lib/python${i}${s}.zip`, r);\n } catch (r) {\n console.error(\"Error occurred while installing the standard library:\"), console.error(r);\n } finally {\n n.removeRunDependency(\"install-stdlib\");\n }\n };\n}\no(Pe, \"installStdlib\");\nfunction he(e) {\n let t;\n return e.stdLibURL != null ? t = e.stdLibURL : t = e.indexURL + \"python_stdlib.zip\", [\n Pe(t),\n ge(e.env.HOME),\n be(e.env),\n q,\n ...ve(e.fsInit)\n ];\n}\no(he, \"getFileSystemInitializationFuncs\");\nfunction Ne(e) {\n if (typeof WasmOffsetConverter < \"u\") return;\n let { binary: t, response: n } = R(e + \"pyodide.asm.wasm\"), i = K();\n return function(s, r) {\n return async function() {\n s.sentinel = await i;\n try {\n let a;\n n ? a = await WebAssembly.instantiateStreaming(n, s) : a = await WebAssembly.instantiate(await t, s);\n let { instance: l, module: c } = a;\n r(l, c);\n } catch (a) {\n console.warn(\"wasm instantiation failed!\"), console.warn(a);\n }\n }(), {};\n };\n}\no(Ne, \"getInstantiateWasmFunc\");\nvar X = \"0.29.3\";\nfunction k(e) {\n return e === void 0 || e.endsWith(\"/\") ? e : e + \"/\";\n}\no(k, \"withTrailingSlash\");\nvar U = X;\nasync function Se(e = {}) {\n if (await T(), e.lockFileContents && e.lockFileURL) throw new Error(\"Can't pass both lockFileContents and lockFileURL\");\n let t = e.indexURL || await z();\n if (t = k(_(t)), e.packageBaseUrl = k(e.packageBaseUrl), e.cdnUrl = k(e.packageBaseUrl ?? `https://cdn.jsdelivr.net/pyodide/v0.29.3/full/`), !e.lockFileContents) {\n let s = e.lockFileURL ?? t + \"pyodide-lock.json\";\n e.lockFileContents = V(s), e.packageBaseUrl ??= J(s);\n }\n e.indexURL = t, e.packageCacheDir && (e.packageCacheDir = k(_(e.packageCacheDir)));\n let n = {\n fullStdLib: !1,\n jsglobals: globalThis,\n stdin: globalThis.prompt ? () => globalThis.prompt() : void 0,\n args: [],\n env: {},\n packages: [],\n packageCacheDir: e.packageBaseUrl,\n enableRunUntilComplete: !0,\n checkAPIVersion: !0,\n BUILD_ID: \"b7b7b0f46eb68e65c029c0dc739270e8a5d35251e9aab6014ee1c2f630e5d1d0\"\n }, i = Object.assign(n, e);\n return i.env.HOME ??= \"/home/pyodide\", i.env.PYTHONINSPECT ??= \"1\", i;\n}\no(Se, \"initializeConfiguration\");\nfunction Ie(e) {\n let t = Y(e), n = t.API;\n return n.lockFilePromise = Promise.resolve(e.lockFileContents), t;\n}\no(Ie, \"createEmscriptenSettings\");\nasync function we(e) {\n if (typeof _createPyodideModule != \"function\") {\n let t = `${e.indexURL}pyodide.asm.js`;\n await w(t);\n }\n}\no(we, \"loadWasmScript\");\nasync function _e(e, t) {\n if (!e._loadSnapshot) return;\n let n = await e._loadSnapshot, i = ArrayBuffer.isView(n) ? n : new Uint8Array(n);\n return t.noInitialRun = !0, t.INITIAL_MEMORY = i.length, i;\n}\no(_e, \"prepareSnapshot\");\nasync function Re(e) {\n let t = await _createPyodideModule(e);\n if (e.exitCode !== void 0) throw new t.ExitStatus(e.exitCode);\n return t;\n}\no(Re, \"createPyodideModule\");\nfunction ke(e, t) {\n let n = e.API;\n if (t.pyproxyToStringRepr && n.setPyProxyToStringMethod(!0), t.convertNullToNone && n.setCompatNullToNone(!0), t.toJsLiteralMap && n.setCompatToJsLiteralMap(!0), n.version !== \"0.29.3\" && t.checkAPIVersion) throw new Error(`Pyodide version does not match: '${U}' <==> '${n.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);\n e.locateFile = (i) => {\n throw i.endsWith(\".so\") ? /* @__PURE__ */ new Error(`Failed to find dynamic library \"${i}\"`) : /* @__PURE__ */ new Error(`Unexpected call to locateFile(\"${i}\")`);\n };\n}\no(ke, \"configureAPI\");\nfunction Ae(e, t, n) {\n let i = e.API, s;\n return t && (s = i.restoreSnapshot(t)), i.finalizeBootstrap(s, n._snapshotDeserializer);\n}\no(Ae, \"bootstrapPyodide\");\nasync function Fe(e, t) {\n let n = e._api;\n return n.sys.path.insert(0, \"\"), n._pyodide.set_excepthook(), await n.packageIndexReady, n.initializeStreams(t.stdin, t.stdout, t.stderr), e;\n}\no(Fe, \"finalizeSetup\");\nasync function ct(e = {}) {\n let t = await Se(e), n = Ie(t);\n await we(t);\n let i = await _e(t, n), s = await Re(n);\n ke(s, t);\n return await Fe(Ae(s, i, t), t);\n}\no(ct, \"loadPyodide\");\n//#endregion\n//#region src/pyworker.ts\nlet pyodide = null;\nlet interruptBuffer = null;\nlet inputCounter = 0;\nlet workspaceRequestCounter = 0;\nconst pendingInputRequests = /* @__PURE__ */ new Map();\nconst pendingWorkspaceRequests = /* @__PURE__ */ new Map();\nconst originalConsole = {\n log: console.log.bind(console),\n info: console.info.bind(console),\n warn: console.warn.bind(console),\n error: console.error.bind(console),\n debug: console.debug.bind(console)\n};\nfunction formatArg(arg) {\n if (arg === null) return \"null\";\n if (arg === void 0) return \"undefined\";\n if (typeof arg === \"string\") return arg;\n if (typeof arg === \"number\" || typeof arg === \"boolean\") return String(arg);\n if (arg instanceof Error) return `${arg.name}: ${arg.message}`;\n try {\n return JSON.stringify(arg);\n } catch {\n return String(arg);\n }\n}\nconsole.log = function(...args) {\n originalConsole.log.apply(console, args);\n self.postMessage({\n id: \"console-log\",\n type: \"console\",\n payload: {\n level: \"info\",\n message: args.map((a) => formatArg(a)).join(\" \")\n }\n });\n};\nconsole.info = function(...args) {\n originalConsole.info.apply(console, args);\n self.postMessage({\n id: \"console-log\",\n type: \"console\",\n payload: {\n level: \"info\",\n message: args.map((a) => formatArg(a)).join(\" \")\n }\n });\n};\nconsole.warn = function(...args) {\n originalConsole.warn.apply(console, args);\n self.postMessage({\n id: \"console-log\",\n type: \"console\",\n payload: {\n level: \"warning\",\n message: args.map((a) => formatArg(a)).join(\" \")\n }\n });\n};\nconsole.error = function(...args) {\n originalConsole.error.apply(console, args);\n self.postMessage({\n id: \"console-log\",\n type: \"console\",\n payload: {\n level: \"error\",\n message: args.map((a) => formatArg(a)).join(\" \")\n }\n });\n};\nconsole.debug = function(...args) {\n originalConsole.debug.apply(console, args);\n self.postMessage({\n id: \"console-log\",\n type: \"console\",\n payload: {\n level: \"debug\",\n message: args.map((a) => formatArg(a)).join(\" \")\n }\n });\n};\nconst consoleBuffer = [];\nfunction sendMessage(response) {\n self.postMessage(response);\n}\nfunction createWorkspaceRequest(op, path, extra) {\n const id = `ws-${workspaceRequestCounter++}`;\n return new Promise((resolve, reject) => {\n pendingWorkspaceRequests.set(id, {\n resolve,\n reject\n });\n sendMessage({\n id,\n type: \"workspaceRequest\",\n payload: {\n op,\n path: path ?? \"\",\n ...extra\n }\n });\n });\n}\nfunction createDocksBridge() {\n return {\n read_file: (path, binary) => createWorkspaceRequest(\"read\", path, { binary: !!binary }),\n write_file: (path, content) => createWorkspaceRequest(\"write\", path, { content }),\n list_dir: (path) => createWorkspaceRequest(\"list\", path || \".\"),\n exists: (path) => createWorkspaceRequest(\"exists\", path),\n is_file: (path) => createWorkspaceRequest(\"is_file\", path),\n is_dir: (path) => createWorkspaceRequest(\"is_dir\", path),\n get_uri: (path) => createWorkspaceRequest(\"get_uri\", path),\n revoke_uri: (uri) => createWorkspaceRequest(\"revoke_uri\", void 0, { uri }),\n fetch: async (pathOrUri) => {\n const isBlobUrl = typeof pathOrUri === \"string\" && pathOrUri.startsWith(\"blob:\");\n let url;\n if (isBlobUrl) url = pathOrUri;\n else url = await createWorkspaceRequest(\"get_uri\", pathOrUri);\n const r = await fetch(url);\n if (!isBlobUrl) await createWorkspaceRequest(\"revoke_uri\", void 0, { uri: url });\n return r;\n },\n uri: (path) => {\n const state = {};\n return {\n async __aenter__() {\n state._url = await createWorkspaceRequest(\"get_uri\", path);\n return state._url;\n },\n async __aexit__(_excType, _excVal, _excTb) {\n if (state._url) {\n await createWorkspaceRequest(\"revoke_uri\", void 0, { uri: state._url });\n state._url = void 0;\n }\n }\n };\n }\n };\n}\nasync function initPyodide(payload) {\n const poVersion = package_default.version;\n pyodide = await ct({ indexURL: `https://cdn.jsdelivr.net/pyodide/v${poVersion}/full/` });\n if (typeof SharedArrayBuffer !== \"undefined\") try {\n const interruptBufferShared = new SharedArrayBuffer(1);\n interruptBuffer = new Uint8Array(interruptBufferShared);\n pyodide.setInterruptBuffer(interruptBuffer);\n sendMessage({\n id: \"interrupt-buffer\",\n type: \"success\",\n payload: interruptBufferShared\n });\n } catch (error) {\n console.warn(\"Failed to set up interrupt buffer:\", error);\n sendMessage({\n id: \"interrupt-buffer\",\n type: \"success\",\n payload: void 0\n });\n }\n else {\n console.warn(\"SharedArrayBuffer not available - interrupt functionality will be limited\");\n sendMessage({\n id: \"interrupt-buffer\",\n type: \"success\",\n payload: void 0\n });\n }\n pyodide.globals.set(\"input\", (promptText) => {\n const inputId = `input-${inputCounter++}`;\n sendMessage({\n id: inputId,\n type: \"inputRequest\",\n payload: { prompt: promptText || \"\" }\n });\n return new Promise((resolve, reject) => {\n pendingInputRequests.set(inputId, {\n resolve,\n reject\n });\n });\n });\n pyodide.setStderr({ batched: (s) => {\n consoleBuffer.push(s);\n sendMessage({\n id: \"stream\",\n type: \"stderr\",\n payload: s\n });\n } });\n pyodide.setStdout({ batched: (s) => {\n consoleBuffer.push(s);\n sendMessage({\n id: \"stream\",\n type: \"stdout\",\n payload: s\n });\n } });\n const docksBridge = createDocksBridge();\n pyodide.globals.set(\"__docks_bridge__\", docksBridge);\n pyodide.runPython(`\nimport sys\nimport types\n__bridge__ = __docks_bridge__\n__m__ = types.ModuleType('docks')\nfor __a__ in ('read_file', 'write_file', 'list_dir', 'exists', 'is_file', 'is_dir', 'get_uri', 'revoke_uri', 'fetch', 'uri'):\n setattr(__m__, __a__, getattr(__bridge__, __a__))\nsys.modules['docks'] = __m__\ndel __docks_bridge__, __bridge__, __m__, __a__\n`);\n if (payload.vars) for (const [key, value] of Object.entries(payload.vars)) pyodide.globals.set(key, value);\n}\nasync function loadPackages(payload) {\n if (!pyodide) throw new Error(\"Pyodide not initialized\");\n if (payload.packages.length > 0) await pyodide.loadPackage(payload.packages, { checkIntegrity: false });\n}\nfunction convertResult(result) {\n if (result === void 0 || result === null) return result;\n const resultType = typeof result;\n if (resultType === \"string\" || resultType === \"number\" || resultType === \"boolean\") return result;\n if (result && typeof result === \"object\") {\n if (typeof result.toJs === \"function\") try {\n const jsValue = result.toJs({\n dict_converter: Object.fromEntries,\n create_pyproxies: false\n });\n if (typeof result.destroy === \"function\") result.destroy();\n return jsValue;\n } catch (error) {\n try {\n const strValue = String(result);\n if (typeof result.destroy === \"function\") result.destroy();\n return strValue;\n } catch {\n return \"[Python object]\";\n }\n }\n try {\n structuredClone(result);\n return result;\n } catch {\n try {\n return JSON.parse(JSON.stringify(result));\n } catch {\n return String(result);\n }\n }\n }\n return result;\n}\nasync function execCode(payload) {\n if (!pyodide) throw new Error(\"Pyodide not initialized\");\n consoleBuffer.length = 0;\n if (interruptBuffer) interruptBuffer[0] = 0;\n let result;\n try {\n result = await pyodide.runPythonAsync(payload.code);\n } catch (error) {\n if (interruptBuffer) interruptBuffer[0] = 0;\n throw error;\n }\n if (interruptBuffer) interruptBuffer[0] = 0;\n return {\n result: convertResult(result),\n console: consoleBuffer.slice()\n };\n}\nasync function execModule(payload) {\n if (!pyodide) throw new Error(\"Pyodide not initialized\");\n consoleBuffer.length = 0;\n const mod = pyodide.pyimport(payload.moduleName);\n const entryName = payload.entryName ?? \"main\";\n let result;\n if (entryName in mod) {\n const func = mod[entryName];\n if (!(func instanceof Function)) throw new Error(`Module entry point is not a function: ${entryName}`);\n result = func.callKwargs(payload.vars || {});\n }\n return {\n result: convertResult(result),\n console: consoleBuffer.slice()\n };\n}\nasync function runFunction(payload) {\n if (!pyodide) throw new Error(\"Pyodide not initialized\");\n consoleBuffer.length = 0;\n const func = pyodide.globals.get(payload.name);\n const result = func.callKwargs(payload.args);\n func.destroy();\n return {\n result: convertResult(result),\n console: consoleBuffer.slice()\n };\n}\nasync function setGlobal(payload) {\n if (!pyodide) throw new Error(\"Pyodide not initialized\");\n pyodide.globals.set(payload.key, payload.value);\n}\nasync function getVersion() {\n if (!pyodide) throw new Error(\"Pyodide not initialized\");\n const result = await pyodide.runPythonAsync(\"import sys; sys.version.split()[0]\");\n return result != null ? String(result) : String(pyodide.version);\n}\nself.onmessage = async (event) => {\n const { id, type, payload } = event.data;\n if (type === \"inputResponse\") {\n const pending = pendingInputRequests.get(id);\n if (pending) {\n pendingInputRequests.delete(id);\n if (payload.cancelled) pending.resolve(\"\");\n else pending.resolve(payload.value || \"\");\n }\n return;\n }\n if (type === \"workspaceResponse\") {\n const pending = pendingWorkspaceRequests.get(id);\n if (pending) {\n pendingWorkspaceRequests.delete(id);\n if (payload?.success === false) pending.reject(new Error(payload.error ?? \"Workspace request failed\"));\n else pending.resolve(payload?.data);\n }\n return;\n }\n try {\n let result;\n switch (type) {\n case \"init\":\n await initPyodide(payload);\n result = { initialized: true };\n break;\n case \"loadPackages\":\n await loadPackages(payload);\n result = { loaded: true };\n break;\n case \"execCode\":\n result = await execCode(payload);\n break;\n case \"execModule\":\n result = await execModule(payload);\n break;\n case \"runFunction\":\n result = await runFunction(payload);\n break;\n case \"setGlobal\":\n await setGlobal(payload);\n result = { set: true };\n break;\n case \"getVersion\":\n result = await getVersion();\n break;\n default: throw new Error(`Unknown message type: ${type}`);\n }\n sendMessage({\n id,\n type: \"success\",\n payload: result\n });\n } catch (error) {\n sendMessage({\n id,\n type: \"error\",\n payload: {\n message: error instanceof Error ? error.message : String(error),\n stack: error instanceof Error ? error.stack : void 0\n }\n });\n }\n};\n//#endregion\n\n//# sourceMappingURL=pyworker-BXXy_GIK.js.map";
|
|
4
|
-
var blob = typeof self !== "undefined" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", jsContent], { type: "text/javascript;charset=utf-8" });
|
|
5
|
-
function WorkerWrapper(options) {
|
|
6
|
-
let objURL;
|
|
7
|
-
try {
|
|
8
|
-
objURL = blob && (self.URL || self.webkitURL).createObjectURL(blob);
|
|
9
|
-
if (!objURL) throw "";
|
|
10
|
-
const worker = new Worker(objURL, {
|
|
11
|
-
type: "module",
|
|
12
|
-
name: options?.name
|
|
13
|
-
});
|
|
14
|
-
worker.addEventListener("error", () => {
|
|
15
|
-
(self.URL || self.webkitURL).revokeObjectURL(objURL);
|
|
16
|
-
});
|
|
17
|
-
return worker;
|
|
18
|
-
} catch (e) {
|
|
19
|
-
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(jsContent), {
|
|
20
|
-
type: "module",
|
|
21
|
-
name: options?.name
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/pyservice.ts
|
|
27
|
-
var logger = createLogger("PyService");
|
|
28
|
-
var messageId = 0;
|
|
29
|
-
var PyEnv = class {
|
|
30
|
-
constructor() {
|
|
31
|
-
this.pendingMessages = /* @__PURE__ */ new Map();
|
|
32
|
-
}
|
|
33
|
-
async init(vars) {
|
|
34
|
-
this.vars = vars ?? {};
|
|
35
|
-
const worker = new WorkerWrapper();
|
|
36
|
-
this.worker = worker;
|
|
37
|
-
worker.onmessage = (event) => {
|
|
38
|
-
this.handleWorkerMessage(event.data);
|
|
39
|
-
};
|
|
40
|
-
worker.onerror = (ev) => {
|
|
41
|
-
const where = [
|
|
42
|
-
ev.message,
|
|
43
|
-
ev.filename,
|
|
44
|
-
ev.lineno,
|
|
45
|
-
ev.colno
|
|
46
|
-
].filter(Boolean).join(" ");
|
|
47
|
-
logger.error(`Python worker failed (script load or uncaught exception)${where ? `: ${where}` : ""}`, ev.error);
|
|
48
|
-
};
|
|
49
|
-
await this.sendMessage("init", { vars: this.vars });
|
|
50
|
-
}
|
|
51
|
-
async handleWorkspaceRequest(response) {
|
|
52
|
-
const { id, payload } = response;
|
|
53
|
-
const { op, path, ...extra } = payload ?? {};
|
|
54
|
-
const send = (success, data, error) => {
|
|
55
|
-
this.worker.postMessage({
|
|
56
|
-
id,
|
|
57
|
-
type: "workspaceResponse",
|
|
58
|
-
payload: {
|
|
59
|
-
success,
|
|
60
|
-
data,
|
|
61
|
-
error
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
try {
|
|
66
|
-
const workspace = await workspaceService.getWorkspace();
|
|
67
|
-
if (!workspace) {
|
|
68
|
-
send(false, void 0, "No workspace selected");
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const resolvePath = (p) => p === "" || p === "." ? "" : p;
|
|
72
|
-
switch (op) {
|
|
73
|
-
case "read": {
|
|
74
|
-
const resource = await workspace.getResource(resolvePath(path));
|
|
75
|
-
if (!resource || !(resource instanceof File)) {
|
|
76
|
-
send(false, void 0, `File not found: ${path}`);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (!!extra.binary) {
|
|
80
|
-
const blob = await resource.getContents({ blob: true });
|
|
81
|
-
send(true, blob instanceof Blob ? await blob.arrayBuffer() : /* @__PURE__ */ new ArrayBuffer(0));
|
|
82
|
-
} else {
|
|
83
|
-
const content = await resource.getContents();
|
|
84
|
-
send(true, typeof content === "string" ? content : String(content ?? ""));
|
|
85
|
-
}
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
case "write": {
|
|
89
|
-
let content = extra.content;
|
|
90
|
-
if (content instanceof ArrayBuffer || ArrayBuffer.isView(content)) content = new Blob([content]);
|
|
91
|
-
const target = await workspace.getResource(resolvePath(path), { create: true });
|
|
92
|
-
if (!target || !(target instanceof File)) {
|
|
93
|
-
send(false, void 0, `Failed to create file: ${path}`);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
await target.saveContents(content);
|
|
97
|
-
send(true);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
case "list": {
|
|
101
|
-
const resource = await workspace.getResource(resolvePath(path));
|
|
102
|
-
if (!resource || !(resource instanceof Directory)) {
|
|
103
|
-
send(false, void 0, `Directory not found: ${path}`);
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
send(true, (await resource.listChildren(false)).map((r) => r.getName()));
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
case "exists":
|
|
110
|
-
send(true, await workspace.getResource(resolvePath(path)) != null);
|
|
111
|
-
return;
|
|
112
|
-
case "is_file":
|
|
113
|
-
send(true, await workspace.getResource(resolvePath(path)) instanceof File);
|
|
114
|
-
return;
|
|
115
|
-
case "is_dir":
|
|
116
|
-
send(true, await workspace.getResource(resolvePath(path)) instanceof Directory);
|
|
117
|
-
return;
|
|
118
|
-
case "get_uri": {
|
|
119
|
-
const resource = await workspace.getResource(resolvePath(path));
|
|
120
|
-
if (!resource || !(resource instanceof File)) {
|
|
121
|
-
send(false, void 0, `File not found: ${path}`);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const uri = await resource.getContents({ uri: true });
|
|
125
|
-
send(true, typeof uri === "string" ? uri : void 0);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
case "revoke_uri": {
|
|
129
|
-
const uri = extra.uri;
|
|
130
|
-
if (typeof uri === "string") URL.revokeObjectURL(uri);
|
|
131
|
-
send(true);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
default: send(false, void 0, `Unknown workspace op: ${op}`);
|
|
135
|
-
}
|
|
136
|
-
} catch (err) {
|
|
137
|
-
send(false, void 0, err instanceof Error ? err.message : String(err));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
handleWorkerMessage(response) {
|
|
141
|
-
if (response.id === "interrupt-buffer") {
|
|
142
|
-
const buf = response.type === "success" ? response.payload : void 0;
|
|
143
|
-
this.interruptBuffer = buf instanceof SharedArrayBuffer ? new Uint8Array(buf) : void 0;
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (response.type === "workspaceRequest") {
|
|
147
|
-
this.handleWorkspaceRequest(response);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (response.type === "inputRequest") {
|
|
151
|
-
const promptText = response.payload.prompt || "Input:";
|
|
152
|
-
const userInput = window.prompt(promptText);
|
|
153
|
-
this.worker.postMessage({
|
|
154
|
-
id: response.id,
|
|
155
|
-
type: "inputResponse",
|
|
156
|
-
payload: {
|
|
157
|
-
value: userInput,
|
|
158
|
-
cancelled: userInput === null
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (response.type === "stdout") {
|
|
164
|
-
if (this.stdoutCallback) this.stdoutCallback(response.payload);
|
|
165
|
-
else logger.debug(response.payload);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
if (response.type === "stderr") {
|
|
169
|
-
if (this.stderrCallback) this.stderrCallback(response.payload);
|
|
170
|
-
else logger.error(response.payload);
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
if (response.type === "console") {
|
|
174
|
-
const { level, message } = response.payload;
|
|
175
|
-
if (typeof window !== "undefined" && window.logToTerminal) window.logToTerminal("Python Worker", message, level);
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
const pending = this.pendingMessages.get(response.id);
|
|
179
|
-
if (pending) {
|
|
180
|
-
this.pendingMessages.delete(response.id);
|
|
181
|
-
if (response.type === "success") pending.resolve(response.payload);
|
|
182
|
-
else if (response.type === "error") pending.reject(new Error(response.payload.message));
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
async sendMessage(type, payload) {
|
|
186
|
-
if (!this.worker) throw new Error("PyEnv not initialized yet: see init()");
|
|
187
|
-
const id = `msg-${messageId++}`;
|
|
188
|
-
const message = {
|
|
189
|
-
id,
|
|
190
|
-
type,
|
|
191
|
-
payload
|
|
192
|
-
};
|
|
193
|
-
return new Promise((resolve, reject) => {
|
|
194
|
-
this.pendingMessages.set(id, {
|
|
195
|
-
resolve,
|
|
196
|
-
reject
|
|
197
|
-
});
|
|
198
|
-
this.worker.postMessage(message);
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
setStdoutCallback(callback) {
|
|
202
|
-
this.stdoutCallback = callback;
|
|
203
|
-
}
|
|
204
|
-
setStderrCallback(callback) {
|
|
205
|
-
this.stderrCallback = callback;
|
|
206
|
-
}
|
|
207
|
-
async runFunction(name, args) {
|
|
208
|
-
return await this.sendMessage("runFunction", {
|
|
209
|
-
name,
|
|
210
|
-
args
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
async setGlobal(key, value) {
|
|
214
|
-
await this.sendMessage("setGlobal", {
|
|
215
|
-
key,
|
|
216
|
-
value
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
async loadPackages(packages) {
|
|
220
|
-
if (packages.length > 0) await this.sendMessage("loadPackages", { packages });
|
|
221
|
-
}
|
|
222
|
-
async execCode(code) {
|
|
223
|
-
return await this.sendMessage("execCode", { code });
|
|
224
|
-
}
|
|
225
|
-
async execScript(path, _installDependencies = false) {
|
|
226
|
-
const moduleName = path.split(".")[0];
|
|
227
|
-
const entryName = path.includes(":") ? path.split(":").reverse()[0] : void 0;
|
|
228
|
-
return await this.execModule(moduleName, entryName);
|
|
229
|
-
}
|
|
230
|
-
async execModule(moduleName, entryName) {
|
|
231
|
-
return await this.sendMessage("execModule", {
|
|
232
|
-
moduleName,
|
|
233
|
-
entryName,
|
|
234
|
-
vars: this.vars
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
async getVersion() {
|
|
238
|
-
return await this.sendMessage("getVersion");
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Check if interrupt functionality is available (requires SharedArrayBuffer).
|
|
242
|
-
*/
|
|
243
|
-
canInterrupt() {
|
|
244
|
-
return this.interruptBuffer !== void 0;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Interrupts any currently running Python code.
|
|
248
|
-
* This will cause a KeyboardInterrupt to be raised in the Python code.
|
|
249
|
-
* Only works if SharedArrayBuffer is available (check with canInterrupt()).
|
|
250
|
-
*/
|
|
251
|
-
interrupt() {
|
|
252
|
-
if (this.interruptBuffer) this.interruptBuffer[0] = 2;
|
|
253
|
-
}
|
|
254
|
-
close() {
|
|
255
|
-
if (this.worker) {
|
|
256
|
-
this.worker.terminate();
|
|
257
|
-
this.worker = void 0;
|
|
258
|
-
}
|
|
259
|
-
this.pendingMessages.clear();
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
//#endregion
|
|
263
|
-
export { PyEnv as t };
|
|
264
|
-
|
|
265
|
-
//# sourceMappingURL=pyservice-DyVO8QVd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pyservice-DyVO8QVd.js","names":[],"sources":["../src/pyservice.ts"],"sourcesContent":["import { createLogger, workspaceService, File, Directory } from \"@eclipse-docks/core\";\n\nconst logger = createLogger('PyService');\nimport type { PyWorkerMessage, PyWorkerResponse } from \"./pyworker\";\nimport PyWorker from \"./pyworker?worker&inline\";\n\nlet messageId = 0;\n\nexport class PyEnv {\n private worker?: Worker;\n private vars: any;\n private pendingMessages: Map<string, { resolve: (value: any) => void, reject: (error: any) => void }> = new Map();\n private stdoutCallback?: (text: string) => void;\n private stderrCallback?: (text: string) => void;\n private interruptBuffer?: Uint8Array;\n\n public async init(vars?: any) {\n this.vars = vars ?? {};\n\n const worker = new PyWorker();\n this.worker = worker;\n\n worker.onmessage = (event: MessageEvent<PyWorkerResponse>) => {\n this.handleWorkerMessage(event.data);\n };\n\n worker.onerror = (ev: ErrorEvent) => {\n const where = [ev.message, ev.filename, ev.lineno, ev.colno].filter(Boolean).join(' ');\n logger.error(\n `Python worker failed (script load or uncaught exception)${where ? `: ${where}` : ''}`,\n ev.error,\n );\n };\n\n await this.sendMessage('init', { vars: this.vars });\n }\n\n private async handleWorkspaceRequest(response: PyWorkerResponse) {\n const { id, payload } = response;\n const { op, path, ...extra } = payload ?? {};\n const send = (success: boolean, data?: unknown, error?: string) => {\n this.worker!.postMessage({\n id,\n type: 'workspaceResponse',\n payload: { success, data, error }\n } as PyWorkerMessage);\n };\n\n try {\n const workspace = await workspaceService.getWorkspace();\n if (!workspace) {\n send(false, undefined, 'No workspace selected');\n return;\n }\n\n const resolvePath = (p: string) => (p === '' || p === '.') ? '' : p;\n\n switch (op) {\n case 'read': {\n const resource = await workspace.getResource(resolvePath(path));\n if (!resource || !(resource instanceof File)) {\n send(false, undefined, `File not found: ${path}`);\n return;\n }\n const binary = !!extra.binary;\n if (binary) {\n const blob = await (resource as File).getContents({ blob: true });\n const buf = blob instanceof Blob ? await blob.arrayBuffer() : new ArrayBuffer(0);\n send(true, buf);\n } else {\n const content = await (resource as File).getContents();\n send(true, typeof content === 'string' ? content : String(content ?? ''));\n }\n return;\n }\n case 'write': {\n let content = extra.content;\n if (content instanceof ArrayBuffer || ArrayBuffer.isView(content)) {\n content = new Blob([content as unknown as BlobPart]);\n }\n const target = await workspace.getResource(resolvePath(path), { create: true });\n if (!target || !(target instanceof File)) {\n send(false, undefined, `Failed to create file: ${path}`);\n return;\n }\n await (target as File).saveContents(content);\n send(true);\n return;\n }\n case 'list': {\n const resource = await workspace.getResource(resolvePath(path));\n if (!resource || !(resource instanceof Directory)) {\n send(false, undefined, `Directory not found: ${path}`);\n return;\n }\n const children = await (resource as Directory).listChildren(false);\n send(true, children.map((r) => r.getName()));\n return;\n }\n case 'exists': {\n const resource = await workspace.getResource(resolvePath(path));\n send(true, resource != null);\n return;\n }\n case 'is_file': {\n const resource = await workspace.getResource(resolvePath(path));\n send(true, resource instanceof File);\n return;\n }\n case 'is_dir': {\n const resource = await workspace.getResource(resolvePath(path));\n send(true, resource instanceof Directory);\n return;\n }\n case 'get_uri': {\n const resource = await workspace.getResource(resolvePath(path));\n if (!resource || !(resource instanceof File)) {\n send(false, undefined, `File not found: ${path}`);\n return;\n }\n const uri = await (resource as File).getContents({ uri: true });\n send(true, typeof uri === 'string' ? uri : undefined);\n return;\n }\n case 'revoke_uri': {\n const uri = extra.uri;\n if (typeof uri === 'string') {\n URL.revokeObjectURL(uri);\n }\n send(true);\n return;\n }\n default:\n send(false, undefined, `Unknown workspace op: ${op}`);\n }\n } catch (err) {\n send(false, undefined, err instanceof Error ? err.message : String(err));\n }\n }\n\n private handleWorkerMessage(response: PyWorkerResponse) {\n // Handle interrupt buffer initialization\n if (response.id === 'interrupt-buffer') {\n const buf = response.type === 'success' ? response.payload : undefined;\n this.interruptBuffer =\n buf instanceof SharedArrayBuffer ? new Uint8Array(buf) : undefined;\n return;\n }\n \n if (response.type === 'workspaceRequest') {\n this.handleWorkspaceRequest(response);\n return;\n }\n\n // Handle input requests\n if (response.type === 'inputRequest') {\n const promptText = response.payload.prompt || 'Input:';\n const userInput = window.prompt(promptText);\n \n // Send response back to worker\n this.worker!.postMessage({\n id: response.id,\n type: 'inputResponse',\n payload: {\n value: userInput,\n cancelled: userInput === null\n }\n } as PyWorkerMessage);\n return;\n }\n \n // Handle stdout/stderr streams\n if (response.type === 'stdout') {\n if (this.stdoutCallback) {\n this.stdoutCallback(response.payload);\n } else {\n logger.debug(response.payload);\n }\n return;\n }\n \n if (response.type === 'stderr') {\n if (this.stderrCallback) {\n this.stderrCallback(response.payload);\n } else {\n logger.error(response.payload);\n }\n return;\n }\n \n // Handle console messages from worker\n if (response.type === 'console') {\n const { level, message } = response.payload;\n // Forward to log terminal\n if (typeof window !== 'undefined' && (window as any).logToTerminal) {\n (window as any).logToTerminal('Python Worker', message, level);\n }\n return;\n }\n\n // Handle regular responses\n const pending = this.pendingMessages.get(response.id);\n if (pending) {\n this.pendingMessages.delete(response.id);\n \n if (response.type === 'success') {\n pending.resolve(response.payload);\n } else if (response.type === 'error') {\n pending.reject(new Error(response.payload.message));\n }\n }\n }\n\n private async sendMessage(type: PyWorkerMessage['type'], payload?: any): Promise<any> {\n if (!this.worker) {\n throw new Error('PyEnv not initialized yet: see init()');\n }\n\n const id = `msg-${messageId++}`;\n const message: PyWorkerMessage = { id, type, payload };\n\n return new Promise((resolve, reject) => {\n this.pendingMessages.set(id, { resolve, reject });\n this.worker!.postMessage(message);\n });\n }\n\n public setStdoutCallback(callback: (text: string) => void) {\n this.stdoutCallback = callback;\n }\n\n public setStderrCallback(callback: (text: string) => void) {\n this.stderrCallback = callback;\n }\n\n public async runFunction(name: string, args: any) {\n return await this.sendMessage('runFunction', { name, args });\n }\n\n public async setGlobal(key: string, value: any) {\n await this.sendMessage('setGlobal', { key, value });\n }\n\n public async loadPackages(packages: string[]) {\n if (packages.length > 0) {\n await this.sendMessage('loadPackages', { packages });\n }\n }\n\n public async execCode(code: string) {\n return await this.sendMessage('execCode', { code });\n }\n\n public async execScript(path: string, _installDependencies: boolean = false) {\n const moduleName = path.split(\".\")[0];\n const entryName = path.includes(\":\") ? path.split(\":\").reverse()[0] : undefined;\n return await this.execModule(moduleName, entryName);\n }\n\n public async execModule(moduleName: string, entryName?: string) {\n return await this.sendMessage('execModule', {\n moduleName,\n entryName,\n vars: this.vars\n });\n }\n\n public async getVersion() {\n return await this.sendMessage('getVersion');\n }\n\n /**\n * Check if interrupt functionality is available (requires SharedArrayBuffer).\n */\n public canInterrupt(): boolean {\n return this.interruptBuffer !== undefined;\n }\n\n /**\n * Interrupts any currently running Python code.\n * This will cause a KeyboardInterrupt to be raised in the Python code.\n * Only works if SharedArrayBuffer is available (check with canInterrupt()).\n */\n public interrupt() {\n if (this.interruptBuffer) {\n // Set the interrupt flag (2 = SIGINT)\n this.interruptBuffer[0] = 2;\n }\n }\n\n close() {\n if (this.worker) {\n this.worker.terminate();\n this.worker = undefined;\n }\n this.pendingMessages.clear();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,SAAS,aAAa,YA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