字典嵌套调用测试

This commit is contained in:
Irene-Maxine
2024-10-24 22:30:13 +08:00
parent 73ba67166b
commit cf24029e6f
56 changed files with 80675 additions and 25 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
"use strict";(self.webpackChunk_mixly_python_pyodide=self.webpackChunk_mixly_python_pyodide||[]).push([[317],{1317:(e,p,y)=>{y.r(p)}}]);

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
(self.webpackChunk_mixly_python_pyodide=self.webpackChunk_mixly_python_pyodide||[]).push([[837],{8982:()=>{},7790:()=>{},3776:()=>{},7965:()=>{},6089:()=>{},9368:()=>{},4688:()=>{},1069:()=>{},5340:()=>{},9838:()=>{},6490:()=>{},3779:()=>{},7199:()=>{}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
(self.webpackChunk_mixly_python_pyodide=self.webpackChunk_mixly_python_pyodide||[]).push([[974],{4695:()=>{},8888:()=>{}}]);

View File

@@ -0,0 +1,247 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "?4f7e":
/*!********************************!*\
!*** ./util.inspect (ignored) ***!
\********************************/
/***/ (() => {
/* (ignored) */
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/******/ // the startup function
/******/ __webpack_require__.x = () => {
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["vendors-node_modules_basthon_kernel-base_lib_kernel_js","vendors-node_modules_comlink_dist_esm_comlink_mjs","vendors-node_modules_basthon_kernel-base_lib_worker_index_js","vendors-node_modules_basthon_kernel-javascript_lib_comlink-worker_js-node_modules_promise-del-2ae688"], () => (__webpack_require__("./node_modules/@basthon/kernel-javascript/lib/comlink-worker.js")))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/ return __webpack_exports__;
/******/ };
/******/
/************************************************************************/
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length; i++) {
/******/ var [chunkIds, fn, priority] = deferred[i];
/******/ var fulfilled = true;
/******/ for (var j = 0; j < chunkIds.length; j++) {
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/ensure chunk */
/******/ (() => {
/******/ __webpack_require__.f = {};
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = (chunkId) => {
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
/******/ __webpack_require__.f[key](chunkId, promises);
/******/ return promises;
/******/ }, []));
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/get javascript chunk filename */
/******/ (() => {
/******/ // This function allow to reference async chunks and sibling chunks for the entrypoint
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "" + chunkId + ".bundle.js";
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/get mini-css chunk filename */
/******/ (() => {
/******/ // This function allow to reference async chunks and sibling chunks for the entrypoint
/******/ __webpack_require__.miniCssF = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return undefined;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ var scriptUrl;
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
/******/ var document = __webpack_require__.g.document;
/******/ if (!scriptUrl && document) {
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
/******/ scriptUrl = document.currentScript.src;
/******/ if (!scriptUrl) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ if(scripts.length) {
/******/ var i = scripts.length - 1;
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
/******/ }
/******/ }
/******/ }
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
/******/ __webpack_require__.p = scriptUrl;
/******/ })();
/******/
/******/ /* webpack/runtime/importScripts chunk loading */
/******/ (() => {
/******/ __webpack_require__.b = self.location + "";
/******/
/******/ // object to store loaded chunks
/******/ // "1" means "already loaded"
/******/ var installedChunks = {
/******/ "_4f7e": 1
/******/ };
/******/
/******/ // importScripts chunk loading
/******/ var installChunk = (data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ for(var moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) runtime(__webpack_require__);
/******/ while(chunkIds.length)
/******/ installedChunks[chunkIds.pop()] = 1;
/******/ parentChunkLoadingFunction(data);
/******/ };
/******/ __webpack_require__.f.i = (chunkId, promises) => {
/******/ // "1" is the signal for "already loaded"
/******/ if(!installedChunks[chunkId]) {
/******/ if(true) { // all chunks have JS
/******/ importScripts(__webpack_require__.p + __webpack_require__.u(chunkId));
/******/ }
/******/ }
/******/ };
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || [];
/******/ var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);
/******/ chunkLoadingGlobal.push = installChunk;
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/ })();
/******/
/******/ /* webpack/runtime/startup chunk dependencies */
/******/ (() => {
/******/ var next = __webpack_require__.x;
/******/ __webpack_require__.x = () => {
/******/ return Promise.all(["vendors-node_modules_basthon_kernel-base_lib_kernel_js","vendors-node_modules_comlink_dist_esm_comlink_mjs","vendors-node_modules_basthon_kernel-base_lib_worker_index_js","vendors-node_modules_basthon_kernel-javascript_lib_comlink-worker_js-node_modules_promise-del-2ae688"].map(__webpack_require__.e, __webpack_require__)).then(next);
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // run startup
/******/ var __webpack_exports__ = __webpack_require__.x();
/******/
/******/ })()
;
//# sourceMappingURL=_4f7e.bundle.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,24 @@
(self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || []).push([["_fabf-_1224"],{
/***/ "?fabf":
/*!*******************************!*\
!*** child_process (ignored) ***!
\*******************************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?1224":
/*!********************!*\
!*** fs (ignored) ***!
\********************/
/***/ (() => {
/* (ignored) */
/***/ })
}]);
//# sourceMappingURL=_fabf-_1224.bundle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"_fabf-_1224.bundle.js","mappings":";;;;;;;;AAAA;;;;;;;;;;ACAA","sources":["webpack://@mixly/python-pyodide/ignored|/Users/maxine/Documents/GitHub/mixly3/boards/default_src/python_pyodide/node_modules/@basthon/kernel-ocaml/lib|child_process","webpack://@mixly/python-pyodide/ignored|/Users/maxine/Documents/GitHub/mixly3/boards/default_src/python_pyodide/node_modules/@basthon/kernel-ocaml/lib|fs"],"sourcesContent":["/* (ignored) */","/* (ignored) */"],"names":[],"sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,288 @@
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./node_modules/@basthon/kernel-base/lib/worker/comlink-proxy.js":
/*!***********************************************************************!*\
!*** ./node_modules/@basthon/kernel-base/lib/worker/comlink-proxy.js ***!
\***********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! comlink */ "./node_modules/comlink/dist/esm/comlink.mjs");
/* harmony import */ var _proxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./proxy */ "./node_modules/@basthon/kernel-base/lib/worker/proxy.js");
const proxy = new _proxy__WEBPACK_IMPORTED_MODULE_0__.ProxyFetch();
(0,comlink__WEBPACK_IMPORTED_MODULE_1__.expose)(proxy);
/***/ }),
/***/ "./node_modules/@basthon/kernel-base/lib/worker/proxy.js":
/*!***************************************************************!*\
!*** ./node_modules/@basthon/kernel-base/lib/worker/proxy.js ***!
\***************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ ProxyFetch: () => (/* binding */ ProxyFetch)
/* harmony export */ });
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! comlink */ "./node_modules/comlink/dist/esm/comlink.mjs");
/**
* A class for a proxy that allows a worker with opaque origin
* to fetch assets.
*/
class ProxyFetch {
async fetch(url, init) {
const parentURL = (s) => s.substring(0, s.lastIndexOf("/"));
const assetsURL = parentURL(new URL(globalThis.location.toString()).href);
const baseURL = parentURL(new URL(url).href);
if (!baseURL.startsWith(assetsURL))
throw new Error(`URL ${url} is outside of proxy' scope`);
// force credentials omition
if (init?.credentials !== "omit")
throw new Error("Request tries to use credentials");
const response = await globalThis.fetch(url, init);
const buffer = await response.arrayBuffer();
return {
body: (0,comlink__WEBPACK_IMPORTED_MODULE_0__.transfer)(buffer, [buffer]),
options: {
status: response.status,
statusText: response.statusText,
// wrong types for headers in worker...
// see https://github.com/microsoft/TypeScript/pull/15050/files#diff-1fe269c5fa7bcd3a57e9e6a91ce3566d3e3a5c38b21e6ff0d78ad0dd090f8d3aR24
// @ts-ignore
headers: new Map(response.headers), // Headers are not clonable
},
};
}
}
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/******/ // the startup function
/******/ __webpack_require__.x = () => {
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["vendors-node_modules_comlink_dist_esm_comlink_mjs"], () => (__webpack_require__("./node_modules/@basthon/kernel-base/lib/worker/comlink-proxy.js")))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/ return __webpack_exports__;
/******/ };
/******/
/************************************************************************/
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length; i++) {
/******/ var [chunkIds, fn, priority] = deferred[i];
/******/ var fulfilled = true;
/******/ for (var j = 0; j < chunkIds.length; j++) {
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/ensure chunk */
/******/ (() => {
/******/ __webpack_require__.f = {};
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = (chunkId) => {
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
/******/ __webpack_require__.f[key](chunkId, promises);
/******/ return promises;
/******/ }, []));
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/get javascript chunk filename */
/******/ (() => {
/******/ // This function allow to reference async chunks and sibling chunks for the entrypoint
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "" + chunkId + ".bundle.js";
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/get mini-css chunk filename */
/******/ (() => {
/******/ // This function allow to reference async chunks and sibling chunks for the entrypoint
/******/ __webpack_require__.miniCssF = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return undefined;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ var scriptUrl;
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
/******/ var document = __webpack_require__.g.document;
/******/ if (!scriptUrl && document) {
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
/******/ scriptUrl = document.currentScript.src;
/******/ if (!scriptUrl) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ if(scripts.length) {
/******/ var i = scripts.length - 1;
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
/******/ }
/******/ }
/******/ }
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
/******/ __webpack_require__.p = scriptUrl;
/******/ })();
/******/
/******/ /* webpack/runtime/importScripts chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded chunks
/******/ // "1" means "already loaded"
/******/ var installedChunks = {
/******/ "node_modules_basthon_kernel-base_lib_worker_comlink-proxy_js": 1
/******/ };
/******/
/******/ // importScripts chunk loading
/******/ var installChunk = (data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ for(var moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) runtime(__webpack_require__);
/******/ while(chunkIds.length)
/******/ installedChunks[chunkIds.pop()] = 1;
/******/ parentChunkLoadingFunction(data);
/******/ };
/******/ __webpack_require__.f.i = (chunkId, promises) => {
/******/ // "1" is the signal for "already loaded"
/******/ if(!installedChunks[chunkId]) {
/******/ if(true) { // all chunks have JS
/******/ importScripts(__webpack_require__.p + __webpack_require__.u(chunkId));
/******/ }
/******/ }
/******/ };
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || [];
/******/ var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);
/******/ chunkLoadingGlobal.push = installChunk;
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/ })();
/******/
/******/ /* webpack/runtime/startup chunk dependencies */
/******/ (() => {
/******/ var next = __webpack_require__.x;
/******/ __webpack_require__.x = () => {
/******/ return __webpack_require__.e("vendors-node_modules_comlink_dist_esm_comlink_mjs").then(next);
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // run startup
/******/ var __webpack_exports__ = __webpack_require__.x();
/******/
/******/ })()
;
//# sourceMappingURL=node_modules_basthon_kernel-base_lib_worker_comlink-proxy_js.bundle.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,64 @@
"use strict";
(self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || []).push([["node_modules_basthon_kernel-javascript_lib_index_js"],{
/***/ "./node_modules/@basthon/kernel-javascript/lib/index.js":
/*!**************************************************************!*\
!*** ./node_modules/@basthon/kernel-javascript/lib/index.js ***!
\**************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ JavaScriptKernel: () => (/* reexport safe */ _kernel__WEBPACK_IMPORTED_MODULE_0__.JavaScriptKernel)
/* harmony export */ });
/* harmony import */ var _kernel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./kernel */ "./node_modules/@basthon/kernel-javascript/lib/kernel.js");
/***/ }),
/***/ "./node_modules/@basthon/kernel-javascript/lib/kernel.js":
/*!***************************************************************!*\
!*** ./node_modules/@basthon/kernel-javascript/lib/kernel.js ***!
\***************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ JavaScriptKernel: () => (/* binding */ JavaScriptKernel)
/* harmony export */ });
/* harmony import */ var _basthon_kernel_base_worker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @basthon/kernel-base/worker */ "./node_modules/@basthon/kernel-base/lib/worker/index.js");
class JavaScriptKernel extends _basthon_kernel_base_worker__WEBPACK_IMPORTED_MODULE_0__.KernelMainBase {
constructor(options) {
super(options);
}
newWorker() {
return new Worker(new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u("_4f7e"), __webpack_require__.b), {
type: undefined,
//@ts-ignore
sandboxed: true, // removing this line will cause security issues
});
}
language() {
return "javascript";
}
languageName() {
return "Javascript";
}
moduleExts() {
return ["js"];
}
ps1() {
return " js> ";
}
ps2() {
return "...> ";
}
}
/***/ })
}]);
//# sourceMappingURL=node_modules_basthon_kernel-javascript_lib_index_js.bundle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"node_modules_basthon_kernel-javascript_lib_index_js.bundle.js","mappings":";;;;;;;;;;;;;;AAAyB;;;;;;;;;;;;;;;;ACAoC;AACtD,+BAA+B,uEAAc;AACpD;AACA;AACA;AACA;AACA,kCAAkC,iGAAsC;AACxE,kBAAkB,SAAQ;AAC1B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://@mixly/python-pyodide/./node_modules/@basthon/kernel-javascript/lib/index.js","webpack://@mixly/python-pyodide/./node_modules/@basthon/kernel-javascript/lib/kernel.js"],"sourcesContent":["export * from \"./kernel\";\n","import { KernelMainBase } from \"@basthon/kernel-base/worker\";\nexport class JavaScriptKernel extends KernelMainBase {\n constructor(options) {\n super(options);\n }\n newWorker() {\n return new Worker(new URL(\"./comlink-worker.js\", import.meta.url), {\n type: \"module\",\n //@ts-ignore\n sandboxed: true, // removing this line will cause security issues\n });\n }\n language() {\n return \"javascript\";\n }\n languageName() {\n return \"Javascript\";\n }\n moduleExts() {\n return [\"js\"];\n }\n ps1() {\n return \" js> \";\n }\n ps2() {\n return \"...> \";\n }\n}\n"],"names":[],"sourceRoot":""}

View File

@@ -0,0 +1,17 @@
"use strict";
(self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || []).push([["node_modules_basthon_kernel-loader_lib_style_css"],{
/***/ "./node_modules/@basthon/kernel-loader/lib/style.css":
/*!***********************************************************!*\
!*** ./node_modules/@basthon/kernel-loader/lib/style.css ***!
\***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
// extracted by mini-css-extract-plugin
/***/ })
}]);
//# sourceMappingURL=node_modules_basthon_kernel-loader_lib_style_css.bundle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"node_modules_basthon_kernel-loader_lib_style_css.bundle.js","mappings":";;;;;;;;;;AAAA","sources":["webpack://@mixly/python-pyodide/./node_modules/@basthon/kernel-loader/lib/style.css?ed68"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport {};"],"names":[],"sourceRoot":""}

View File

@@ -0,0 +1,493 @@
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./node_modules/@basthon/kernel-ocaml/lib/comlink-worker.js":
/*!******************************************************************!*\
!*** ./node_modules/@basthon/kernel-ocaml/lib/comlink-worker.js ***!
\******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! comlink */ "./node_modules/comlink/dist/esm/comlink.mjs");
/* harmony import */ var _worker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./worker */ "./node_modules/@basthon/kernel-ocaml/lib/worker.js");
(0,comlink__WEBPACK_IMPORTED_MODULE_1__.expose)(_worker__WEBPACK_IMPORTED_MODULE_0__.OCamlKernelWorker);
/***/ }),
/***/ "./node_modules/@basthon/kernel-ocaml/lib/worker.js":
/*!**********************************************************!*\
!*** ./node_modules/@basthon/kernel-ocaml/lib/worker.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ OCamlKernelWorker: () => (/* binding */ OCamlKernelWorker)
/* harmony export */ });
/* harmony import */ var _basthon_kernel_base_worker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @basthon/kernel-base/worker */ "./node_modules/@basthon/kernel-base/lib/worker/index.js");
class OCamlKernelWorker extends _basthon_kernel_base_worker__WEBPACK_IMPORTED_MODULE_0__.KernelWorkerBase {
constructor(options) {
// do not forget to call the parent constructor
super(options);
// the window object is not available in a webworker...
self.window = self;
this._initInnerCode = `\
open Js_of_ocaml
module Basthon = struct
let download (path: string): unit = ignore((Js.Unsafe.eval_string "self.basthon.__kernel__")##download path)
let sleep (duration: float): unit = ignore((Js.Unsafe.eval_string "self.basthon")##sleep duration)
let create_canvas () = (Js.Unsafe.eval_string "self.basthon.__kernel__")##createcanvas()
let display_canvas canvas: unit = ignore((Js.Unsafe.eval_string "self.basthon")##displayCanvas canvas)
let save_canvas canvas (path: string): unit = ignore((Js.Unsafe.eval_string "self.basthon.__kernel__")##savecanvas canvas path)
let download_canvas ?(format = "png") canvas: unit = ignore((Js.Unsafe.eval_string "self.basthon")##downloadCanvas canvas (Js.string format))
let display_image (path: string): unit = ignore((Js.Unsafe.eval_string "self.basthon.__kernel__")##displayimage path)
let version () : string = (Js.Unsafe.eval_string "self.basthon.__kernel__")##version()
let help () : unit = print_endline {ext|\
Basthon module
help: Show this help.
download path: Download a file from the local filesystem.
sleep duration: Sleep for a certain amount of seconds.
display_image path: Display a PNG image from the local filesystem.
create_canvas: Create a HTML5 canvas to be displayed with display_canvas.
display_canvas canvas: Display a HTML5 canvas created with create_canvas.
save_canvas canvas path: Save a canvas to a PNG/JPG file to the local filesystem.
download_canvas ?(format = "png") canvas: Download a canvas to a PNG/JPG file.
|ext}
end`;
}
/*
* Initialize the kernel.
*/
async _init(options) {
// io redirections
console.info = (...args) => console.log(...args);
console.warn = (...args) => console.error(...args);
globalThis.addEventListener("error", (e) => console.error(e.toString()));
// kernel loading
const { __kernel__ } = await Promise.all(/*! import() */[__webpack_require__.e("vendors-node_modules_basthon_kernel-ocaml_lib___kernel___js"), __webpack_require__.e("_fabf-_1224")]).then(__webpack_require__.t.bind(__webpack_require__, /*! ./__kernel__ */ "./node_modules/@basthon/kernel-ocaml/lib/__kernel__.js", 23));
this.__kernel__ = __kernel__;
if (this.__kernel__?.init() !== 0)
throw new Error("Can't start OCaml kernel!");
// mock Graphics_js.draw_image for use in worker
// see https://github.com/ocsigen/js_of_ocaml/blob/1c43da9a925a9df247548158879439ef4039eb38/runtime/graphics.js#L442
self.jsoo_runtime.caml_gr_draw_image = (im, x, y) => {
const s = self.jsoo_runtime.caml_gr_state_get();
s.context.putImageData(im, x, s.height - im.height - y);
return 0;
};
// execute magic init code
this.__kernel__?.exec(this._initInnerCode);
}
async _eval(data, code) {
if (this.__kernel__ == null)
return;
this.__eval_data__ = data;
this.__kernel__.io.stdout = (...args) => {
this.sendStdoutStream(data, args.join(" "));
};
this.__kernel__.io.stderr = (...args) => {
this.sendStderrStream(data, args.join(" "));
};
const result = this.__kernel__?.exec(code);
if (typeof result === "string" && result.length > 0)
return { "text/plain": result.replace(/\n$/, "") };
return undefined;
}
/**
* Is the source ready to be evaluated or want we more?
* Usefull to set ps1/ps2 in teminal prompt.
*/
async more(code) {
return false;
}
/**
* Put a file on the local (emulated) filesystem.
*/
putFile(filename, content) {
if (this.__kernel__ == null)
return;
this.__kernel__.createfile(filename, content);
}
/**
* Put an importable module on the local (emulated) filesystem
* and load dependencies.
*/
putModule(filename, content) {
this.putFile(filename, content);
/* why is this needed?
* even if path is already added using the #directory directive,
* one should recall the directive each time the folder is modified...
*/
this.__kernel__?.loadmodule(filename);
}
/**
* OCaml wrapper arround Kernel.download (to be called by __kernel__.ml).
*/
ocamlDownload(content, filename) {
const array = self.jsoo_runtime.caml_convert_bytes_to_array(content);
this.download(array, filename);
}
/**
* Send eval.display event with the given canvas
* and ocaml-canvas as display_type.
*/
displayCanvas(canvas) {
this.display(canvas);
}
/**
* Save a canvas to a file on the local FS.
*/
async saveCanvas(canvas, path) {
if (this.__kernel__ == null)
return;
const ext = path.split(".").pop()?.toLowerCase();
let mime = "image/png";
if (ext === "jpg" || ext === "jpeg")
mime = "image/jpeg";
const blob = await canvas.convertToBlob({ type: mime });
const content = await blob.arrayBuffer();
this.__kernel__.createfile(path, content);
}
/**
* Download a canvas as an image file (png or jpg).
*/
downloadCanvas(canvas, format) {
if (format == null)
format = "png";
//@ts-ignore
format = format.toString().toLowerCase();
const types = { jpg: "image/jpeg", jpeg: "images/jpeg", png: "image/png" };
if (!(format in types))
format = "png";
const mime = types[format];
(async () => {
const blob = await canvas.convertToBlob({ type: mime });
let image = await this.blobToDataURL(blob);
// image = image.replace(mime, "image/octet-stream");
this.download(image, `canvas.${format}`);
})();
}
/**
* Display a PNG image.
*/
displayImage(content) {
const data = this.clone(this.__eval_data__);
const array = self.jsoo_runtime.caml_convert_bytes_to_array(content);
const blob = new Blob([array], { type: "image/png" });
this.displayBlob(blob, data);
}
}
/***/ }),
/***/ "./node_modules/promise-delegate/dist/es/PromiseDelegate.js":
/*!******************************************************************!*\
!*** ./node_modules/promise-delegate/dist/es/PromiseDelegate.js ***!
\******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ PromiseDelegate: () => (/* binding */ PromiseDelegate)
/* harmony export */ });
var PromiseDelegate = (function () {
function PromiseDelegate(ignoreMultipleSettles) {
var _this = this;
if (ignoreMultipleSettles === void 0) { ignoreMultipleSettles = false; }
this.ignoreMultipleSettles = ignoreMultipleSettles;
this.isSettled = false;
this.promise = new Promise(function (resolve, reject) {
_this.resolveCallback = resolve;
_this.rejectCallback = reject;
});
}
PromiseDelegate.prototype.markAsSettled = function () {
var wasSettled = this.isSettled;
if (wasSettled && !this.ignoreMultipleSettles) {
throw new Error("PromiseDelegate is already settled!");
}
this.isSettled = true;
return !wasSettled;
};
Object.defineProperty(PromiseDelegate.prototype, "settled", {
get: function () {
return this.isSettled;
},
enumerable: false,
configurable: true
});
PromiseDelegate.prototype.resolve = function (value) {
if (this.markAsSettled()) {
this.resolveCallback(value);
}
};
PromiseDelegate.prototype.reject = function (reason) {
if (this.markAsSettled()) {
this.rejectCallback(reason);
}
};
return PromiseDelegate;
}());
//# sourceMappingURL=PromiseDelegate.js.map
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/******/ // the startup function
/******/ __webpack_require__.x = () => {
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["vendors-node_modules_basthon_kernel-base_lib_kernel_js","vendors-node_modules_comlink_dist_esm_comlink_mjs","vendors-node_modules_basthon_kernel-base_lib_worker_index_js"], () => (__webpack_require__("./node_modules/@basthon/kernel-ocaml/lib/comlink-worker.js")))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/ return __webpack_exports__;
/******/ };
/******/
/************************************************************************/
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length; i++) {
/******/ var [chunkIds, fn, priority] = deferred[i];
/******/ var fulfilled = true;
/******/ for (var j = 0; j < chunkIds.length; j++) {
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/create fake namespace object */
/******/ (() => {
/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
/******/ var leafPrototypes;
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 16: return value when it's Promise-like
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = this(value);
/******/ if(mode & 8) return value;
/******/ if(typeof value === 'object' && value) {
/******/ if((mode & 4) && value.__esModule) return value;
/******/ if((mode & 16) && typeof value.then === 'function') return value;
/******/ }
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ var def = {};
/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
/******/ }
/******/ def['default'] = () => (value);
/******/ __webpack_require__.d(ns, def);
/******/ return ns;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/ensure chunk */
/******/ (() => {
/******/ __webpack_require__.f = {};
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = (chunkId) => {
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
/******/ __webpack_require__.f[key](chunkId, promises);
/******/ return promises;
/******/ }, []));
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/get javascript chunk filename */
/******/ (() => {
/******/ // This function allow to reference async chunks and sibling chunks for the entrypoint
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "" + chunkId + ".bundle.js";
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/get mini-css chunk filename */
/******/ (() => {
/******/ // This function allow to reference async chunks and sibling chunks for the entrypoint
/******/ __webpack_require__.miniCssF = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return undefined;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ var scriptUrl;
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
/******/ var document = __webpack_require__.g.document;
/******/ if (!scriptUrl && document) {
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
/******/ scriptUrl = document.currentScript.src;
/******/ if (!scriptUrl) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ if(scripts.length) {
/******/ var i = scripts.length - 1;
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
/******/ }
/******/ }
/******/ }
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
/******/ __webpack_require__.p = scriptUrl;
/******/ })();
/******/
/******/ /* webpack/runtime/importScripts chunk loading */
/******/ (() => {
/******/ __webpack_require__.b = self.location + "";
/******/
/******/ // object to store loaded chunks
/******/ // "1" means "already loaded"
/******/ var installedChunks = {
/******/ "node_modules_basthon_kernel-ocaml_lib_comlink-worker_js-node_modules_promise-delegate_dist_es-e9af62": 1
/******/ };
/******/
/******/ // importScripts chunk loading
/******/ var installChunk = (data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ for(var moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) runtime(__webpack_require__);
/******/ while(chunkIds.length)
/******/ installedChunks[chunkIds.pop()] = 1;
/******/ parentChunkLoadingFunction(data);
/******/ };
/******/ __webpack_require__.f.i = (chunkId, promises) => {
/******/ // "1" is the signal for "already loaded"
/******/ if(!installedChunks[chunkId]) {
/******/ if(true) { // all chunks have JS
/******/ importScripts(__webpack_require__.p + __webpack_require__.u(chunkId));
/******/ }
/******/ }
/******/ };
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || [];
/******/ var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);
/******/ chunkLoadingGlobal.push = installChunk;
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/ })();
/******/
/******/ /* webpack/runtime/startup chunk dependencies */
/******/ (() => {
/******/ var next = __webpack_require__.x;
/******/ __webpack_require__.x = () => {
/******/ return Promise.all(["vendors-node_modules_basthon_kernel-base_lib_kernel_js","vendors-node_modules_comlink_dist_esm_comlink_mjs","vendors-node_modules_basthon_kernel-base_lib_worker_index_js"].map(__webpack_require__.e, __webpack_require__)).then(next);
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // run startup
/******/ var __webpack_exports__ = __webpack_require__.x();
/******/
/******/ })()
;
//# sourceMappingURL=node_modules_basthon_kernel-ocaml_lib_comlink-worker_js-node_modules_promise-delegate_dist_es-e9af62.bundle.js.map

View File

@@ -0,0 +1,91 @@
"use strict";
(self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || []).push([["node_modules_basthon_kernel-ocaml_lib_index_js"],{
/***/ "./node_modules/@basthon/kernel-ocaml/lib/index.js":
/*!*********************************************************!*\
!*** ./node_modules/@basthon/kernel-ocaml/lib/index.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ OCamlKernel: () => (/* reexport safe */ _kernel__WEBPACK_IMPORTED_MODULE_0__.OCamlKernel)
/* harmony export */ });
/* harmony import */ var _kernel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./kernel */ "./node_modules/@basthon/kernel-ocaml/lib/kernel.js");
/***/ }),
/***/ "./node_modules/@basthon/kernel-ocaml/lib/kernel.js":
/*!**********************************************************!*\
!*** ./node_modules/@basthon/kernel-ocaml/lib/kernel.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ OCamlKernel: () => (/* binding */ OCamlKernel)
/* harmony export */ });
/* harmony import */ var _basthon_kernel_base_worker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @basthon/kernel-base/worker */ "./node_modules/@basthon/kernel-base/lib/worker/index.js");
/**
* An OCaml kernel that satisfies Basthon's API.
*/
class OCamlKernel extends _basthon_kernel_base_worker__WEBPACK_IMPORTED_MODULE_0__.KernelMainBase {
constructor(options) {
super(options);
}
newWorker() {
return new Worker(new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u("node_modules_basthon_kernel-ocaml_lib_comlink-worker_js-node_modules_promise-delegate_dist_es-e9af62"), __webpack_require__.b), {
type: undefined,
//@ts-ignore
sandboxed: true, // removing this line will cause security issues
});
}
language() {
return "ocaml";
}
languageName() {
return "OCaml";
}
moduleExts() {
return ["ml"];
}
/**
* List modules launched via putModule.
*/
userModules() {
return [];
}
/**
* Download a file from the VFS.
*/
getFile(path) {
return new Uint8Array([]);
}
/**
* Download a user module file.
*/
getUserModuleFile(filename) {
return new Uint8Array([]);
}
/**
* Mimic the OCaml's REPL banner.
*/
banner() {
return " OCaml version 4.11.1\n";
}
ps1() {
return "# ";
}
ps2() {
return " ";
}
}
/***/ })
}]);
//# sourceMappingURL=node_modules_basthon_kernel-ocaml_lib_index_js.bundle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"node_modules_basthon_kernel-ocaml_lib_index_js.bundle.js","mappings":";;;;;;;;;;;;;;AAAyB;;;;;;;;;;;;;;;;ACAoC;AAC7D;AACA;AACA;AACO,0BAA0B,uEAAc;AAC/C;AACA;AACA;AACA;AACA,kCAAkC,gMAAsC;AACxE,kBAAkB,SAAQ;AAC1B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://@mixly/python-pyodide/./node_modules/@basthon/kernel-ocaml/lib/index.js","webpack://@mixly/python-pyodide/./node_modules/@basthon/kernel-ocaml/lib/kernel.js"],"sourcesContent":["export * from \"./kernel\";\n","import { KernelMainBase } from \"@basthon/kernel-base/worker\";\n/**\n * An OCaml kernel that satisfies Basthon's API.\n */\nexport class OCamlKernel extends KernelMainBase {\n constructor(options) {\n super(options);\n }\n newWorker() {\n return new Worker(new URL(\"./comlink-worker.js\", import.meta.url), {\n type: \"module\",\n //@ts-ignore\n sandboxed: true, // removing this line will cause security issues\n });\n }\n language() {\n return \"ocaml\";\n }\n languageName() {\n return \"OCaml\";\n }\n moduleExts() {\n return [\"ml\"];\n }\n /**\n * List modules launched via putModule.\n */\n userModules() {\n return [];\n }\n /**\n * Download a file from the VFS.\n */\n getFile(path) {\n return new Uint8Array([]);\n }\n /**\n * Download a user module file.\n */\n getUserModuleFile(filename) {\n return new Uint8Array([]);\n }\n /**\n * Mimic the OCaml's REPL banner.\n */\n banner() {\n return \" OCaml version 4.11.1\\n\";\n }\n ps1() {\n return \"# \";\n }\n ps2() {\n return \" \";\n }\n}\n"],"names":[],"sourceRoot":""}

View File

@@ -0,0 +1,249 @@
"use strict";
(self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || []).push([["node_modules_basthon_kernel-python3-old_lib_index_js"],{
/***/ "./node_modules/@basthon/kernel-base/lib/index.js":
/*!********************************************************!*\
!*** ./node_modules/@basthon/kernel-base/lib/index.js ***!
\********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ KernelBase: () => (/* reexport safe */ _kernel__WEBPACK_IMPORTED_MODULE_0__.KernelBase),
/* harmony export */ VERSION: () => (/* reexport safe */ _kernel__WEBPACK_IMPORTED_MODULE_0__.VERSION)
/* harmony export */ });
/* harmony import */ var _kernel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./kernel */ "./node_modules/@basthon/kernel-base/lib/kernel.js");
/***/ }),
/***/ "./node_modules/@basthon/kernel-python3-old/lib/index.js":
/*!***************************************************************!*\
!*** ./node_modules/@basthon/kernel-python3-old/lib/index.js ***!
\***************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Python3OldKernel: () => (/* reexport safe */ _kernel__WEBPACK_IMPORTED_MODULE_0__.Python3OldKernel)
/* harmony export */ });
/* harmony import */ var _kernel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./kernel */ "./node_modules/@basthon/kernel-python3-old/lib/kernel.js");
/***/ }),
/***/ "./node_modules/@basthon/kernel-python3-old/lib/kernel.js":
/*!****************************************************************!*\
!*** ./node_modules/@basthon/kernel-python3-old/lib/kernel.js ***!
\****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Python3OldKernel: () => (/* binding */ Python3OldKernel)
/* harmony export */ });
/* harmony import */ var _basthon_kernel_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @basthon/kernel-base */ "./node_modules/@basthon/kernel-base/lib/index.js");
const PYODIDE_VERSION = "0.16.1";
/**
* A Python kernel that satisfies Basthon's API.
*/
class Python3OldKernel extends _basthon_kernel_base__WEBPACK_IMPORTED_MODULE_0__.KernelBase {
constructor(options) {
super(options);
/**
* Where to find pyodide.js (private).
*/
this._pyodideURLs = [
`https://cdn.jsdelivr.net/pyodide/v{PYODIDE_VERSION}/full/pyodide.js`,
];
this.__kernel__ = null;
this.pythonVersion = "";
// for locally installed Pyodide
this._pyodideURLs.unshift(`${this.basthonRoot()}/pyodide/pyodide.js`);
this._pyodideURLs = options?.pyodideURLs ?? this._pyodideURLs;
}
/**
* Get the URL of Basthon modules dir.
*/
basthonModulesRoot(absolute = false) {
return this.basthonRoot(absolute) + "/modules";
}
language() {
return "python3-old";
}
languageName() {
return "Python 3 Old";
}
moduleExts() {
return ["py"];
}
/**
* What to do when loaded (private).
*/
async _onload() {
const pyodide = window.pyodide;
// get the version of Python from Python
this.pythonVersion = pyodide.runPython("import platform ; platform.python_version()");
// this is for avoiding "Unknown package 'basthon'" error
// but can be removed with 0.17.0 since it is fixed upstream
const consoleErrorBck = console.error;
console.error = () => { };
await pyodide.loadPackage(this.basthonRoot(true) + "/basthon.js");
console.error = consoleErrorBck;
// importing basthon to get it's kernel
await pyodide.runPythonAsync("import basthon as __basthon__");
// kernel lookup
this.__kernel__ = pyodide.globals.__basthon__.__kernel__;
// removing basthon from global namespace
await pyodide.runPythonAsync("del __basthon__");
}
/**
* Start the Basthon kernel asynchronously.
*/
async _init() {
await super._init();
let pyodideURL = this._pyodideURLs[0];
for (let url of this._pyodideURLs) {
url = url.replace("{PYODIDE_VERSION}", PYODIDE_VERSION);
try {
const response = await fetch(url, { method: "HEAD" });
if (response.ok) {
pyodideURL = url;
break;
}
}
catch (e) { }
}
// forcing Pyodide to look at the right location for other files
window.languagePluginUrl =
pyodideURL.substr(0, pyodideURL.lastIndexOf("/")) + "/";
try {
await Python3OldKernel.loadScript(pyodideURL);
}
catch (error) {
console.log(error);
console.error("Can't load pyodide.js");
throw error;
}
if (window.languagePluginLoader == null) {
throw new Error("Can't load pyodide.js");
}
await window.languagePluginLoader;
await this._onload();
}
/**
* Execution count getter overload.
*/
get execution_count() {
return this.__kernel__.execution_count();
}
/**
* Basthon async code evaluation function.
*/
async evalAsync(code, outCallback, errCallback, data = null) {
if (typeof outCallback === "undefined") {
outCallback = function (text) {
console.log(text);
};
}
if (typeof errCallback === "undefined") {
errCallback = function (text) {
console.error(text);
};
}
// loading dependencies are loaded by eval
return await this.__kernel__.eval(code, outCallback, errCallback, data);
}
/**
* Start the kernel.
*/
async _start() {
await super._start();
return this.__kernel__.start();
}
/**
* Stop the kernel.
*/
async _stop() {
this.__kernel__.stop();
await super._stop();
}
/**
* Put a file on the local (emulated) filesystem.
*/
async putFile(filename, content) {
this.__kernel__.put_file(filename, content);
}
/**
* Put an importable module on the local (emulated) filesystem
* and load dependencies.
*/
async putModule(filename, content) {
return this.__kernel__.put_module(filename, content);
}
/**
* List modules launched via putModule.
*/
userModules() {
return this.__kernel__.user_modules();
}
/**
* Get a file content from the VFS.
*/
getFile(path) {
return this.__kernel__.get_file(path);
}
/**
* Get a user module file content.
*/
getUserModuleFile(filename) {
return this.__kernel__.get_user_module_file(filename);
}
/**
* Is the source ready to be evaluated or want we more?
* Usefull to set ps1/ps2 for teminal prompt.
*/
async more(source) {
return this.__kernel__.more(source);
}
/**
* Mimic the CPython's REPL banner.
*/
banner() {
/* We don't return this.__kernel__.banner();
* since the banner should be available ASAP.
* In tests, we check this.banner() === this.__kernel__.banner().
*/
return `Python 3.8.2 (default, Dec 25 2020 21:20:57) on WebAssembly VM\nType "help", "copyright", "credits" or "license" for more information.`;
}
/**
* Complete a code at the end (usefull for tab completion).
*
* Returns an array of two elements: the list of completions
* and the start index.
*/
async complete(code) {
return this.__kernel__.complete(code);
}
/**
* Change current directory (Python's virtual FS).
*/
chdir(path) {
window.pyodide._module.FS.chdir(path);
}
/**
* Create directory (Python's virtual FS).
*/
mkdir(path) {
window.pyodide._module.FS.mkdir(path);
}
}
/***/ })
}]);
//# sourceMappingURL=node_modules_basthon_kernel-python3-old_lib_index_js.bundle.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,273 @@
"use strict";
(self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || []).push([["node_modules_basthon_kernel-python3_lib_index_js"],{
/***/ "./node_modules/@basthon/kernel-base/lib/index.js":
/*!********************************************************!*\
!*** ./node_modules/@basthon/kernel-base/lib/index.js ***!
\********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ KernelBase: () => (/* reexport safe */ _kernel__WEBPACK_IMPORTED_MODULE_0__.KernelBase),
/* harmony export */ VERSION: () => (/* reexport safe */ _kernel__WEBPACK_IMPORTED_MODULE_0__.VERSION)
/* harmony export */ });
/* harmony import */ var _kernel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./kernel */ "./node_modules/@basthon/kernel-base/lib/kernel.js");
/***/ }),
/***/ "./node_modules/@basthon/kernel-python3/lib/index.js":
/*!***********************************************************!*\
!*** ./node_modules/@basthon/kernel-python3/lib/index.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Python3Kernel: () => (/* reexport safe */ _kernel__WEBPACK_IMPORTED_MODULE_0__.Python3Kernel)
/* harmony export */ });
/* harmony import */ var _kernel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./kernel */ "./node_modules/@basthon/kernel-python3/lib/kernel.js");
/***/ }),
/***/ "./node_modules/@basthon/kernel-python3/lib/kernel.js":
/*!************************************************************!*\
!*** ./node_modules/@basthon/kernel-python3/lib/kernel.js ***!
\************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ Python3Kernel: () => (/* binding */ Python3Kernel)
/* harmony export */ });
/* harmony import */ var _basthon_kernel_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @basthon/kernel-base */ "./node_modules/@basthon/kernel-base/lib/index.js");
const PYODIDE_VERSION = "0.23.2";
/**
* A Python kernel that satisfies Basthon's API.
*/
class Python3Kernel extends _basthon_kernel_base__WEBPACK_IMPORTED_MODULE_0__.KernelBase {
constructor(options) {
super(options);
/**
* Where to find pyodide.js (private).
*/
this._pyodideURLs = [
`https://cdn.jsdelivr.net/pyodide/v{PYODIDE_VERSION}/full/pyodide.js`,
];
this.__kernel__ = null;
this.pythonVersion = "";
// for locally installed Pyodide
this._pyodideURLs.unshift(`${this.basthonRoot()}/pyodide/pyodide.js`);
this._pyodideURLs = options?.pyodideURLs ?? this._pyodideURLs;
}
/**
* Get the URL of Basthon modules dir.
*/
basthonModulesRoot(absolute = false) {
return this.basthonRoot(absolute) + "/modules";
}
language() {
return "python3";
}
languageName() {
return "Python 3";
}
moduleExts() {
return ["py"];
}
/**
* What to do when loaded (private).
*/
async _onload() {
const pyodide = window.pyodide;
// reformat repodata
const packages = pyodide._api.repodata_packages;
for (let p of Object.keys(packages)) {
const item = packages[p];
item.file_name = item.file_name.replace("{basthonRoot}", this.basthonRoot(true));
}
// get the version of Python from Python
this.pythonVersion = pyodide.runPython("import platform ; platform.python_version()");
// load basthon and get kernel
await pyodide.loadPackage("basthon");
this.__kernel__ = pyodide.pyimport("basthon").__kernel__;
}
/**
* Start the Basthon kernel asynchronously.
*/
async _init() {
await super._init();
let pyodideURL = this._pyodideURLs[0];
for (let url of this._pyodideURLs) {
url = url.replace("{PYODIDE_VERSION}", PYODIDE_VERSION);
try {
const response = await fetch(url, { method: "HEAD" });
if (response.ok) {
pyodideURL = url;
break;
}
}
catch (e) { }
}
try {
await Python3Kernel.loadScript(pyodideURL);
}
catch (error) {
console.log(error);
console.error("Can't load pyodide.js");
throw error;
}
if (window.loadPyodide == null) {
console.log("window.loadPyodide is null!");
throw new Error("Can't load pyodide.js");
}
try {
// loading with custom repodata.json
window.pyodide = await window.loadPyodide({
lockFileURL: this.basthonRoot() + "/repodata.json",
});
}
catch (error) {
console.log(error);
console.error("Can't load Python from Pyodide");
throw error;
}
await this._onload();
}
/**
* Execution count getter overload.
*/
get execution_count() {
return this.__kernel__.execution_count();
}
/**
* Basthon async code evaluation function.
*/
async evalAsync(code, outCallback, errCallback, data = null) {
if (typeof outCallback === "undefined") {
outCallback = function (text) {
console.log(text);
};
}
if (typeof errCallback === "undefined") {
errCallback = function (text) {
console.error(text);
};
}
// dependencies are loaded by eval
const proxy = await this.__kernel__.eval(code, outCallback, errCallback, data);
// when an error occures, proxy should be the error message
if (!(proxy instanceof window.pyodide.ffi.PyProxy))
throw proxy;
const res = proxy.toJs({
create_proxies: false,
dict_converter: Object.fromEntries,
});
proxy.destroy();
return res;
}
/**
* Start the kernel.
*/
async _start() {
await super._start();
this.__kernel__.start();
}
/**
* Stop the kernel.
*/
async _stop() {
this.__kernel__.stop();
await super._stop();
}
/**
* Put a file on the local (emulated) filesystem.
*/
async putFile(filename, content) {
this.__kernel__.put_file(filename, content);
}
/**
* Put an importable module on the local (emulated) filesystem
* and load dependencies.
*/
async putModule(filename, content) {
return await this.__kernel__.put_module(filename, content);
}
/**
* List modules launched via putModule.
*/
userModules() {
const proxy = this.__kernel__.user_modules();
if (!(proxy instanceof window.pyodide.ffi.PyProxy))
return proxy;
const res = proxy.toJs();
proxy.destroy();
return res;
}
/**
* Get a file content from the VFS.
*/
getFile(path) {
return this.__kernel__.get_file(path).toJs();
}
/**
* Get a user module file content.
*/
getUserModuleFile(filename) {
return this.__kernel__.get_user_module_file(filename).toJs();
}
/**
* Is the source ready to be evaluated or want we more?
* Usefull to set ps1/ps2 for teminal prompt.
*/
async more(source) {
return this.__kernel__.more(source);
}
/**
* Mimic the CPython's REPL banner.
*/
banner() {
/* We don't return this.__kernel__.banner();
* since the banner should be available ASAP.
* In tests, we check this.banner() === this.__kernel__.banner().
*/
return `Python 3.11.2 (main, May 3 2023 04:00:05) on WebAssembly/Emscripten\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.`;
}
/**
* Complete a code at the end (usefull for tab completion).
*
* Returns an array of two elements: the list of completions
* and the start index.
*/
async complete(code) {
const proxy = this.__kernel__.complete(code);
if (!(proxy instanceof window.pyodide.ffi.PyProxy))
return proxy;
const res = proxy.toJs();
proxy.destroy();
return res;
}
/**
* Change current directory (Python's virtual FS).
*/
chdir(path) {
window.pyodide._module.FS.chdir(path);
}
/**
* Create directory (Python's virtual FS).
*/
mkdir(path) {
window.pyodide._module.FS.mkdir(path);
}
}
/***/ })
}]);
//# sourceMappingURL=node_modules_basthon_kernel-python3_lib_index_js.bundle.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,64 @@
"use strict";
(self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || []).push([["node_modules_basthon_kernel-sql_lib_index_js"],{
/***/ "./node_modules/@basthon/kernel-sql/lib/index.js":
/*!*******************************************************!*\
!*** ./node_modules/@basthon/kernel-sql/lib/index.js ***!
\*******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ SQLKernel: () => (/* reexport safe */ _kernel__WEBPACK_IMPORTED_MODULE_0__.SQLKernel)
/* harmony export */ });
/* harmony import */ var _kernel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./kernel */ "./node_modules/@basthon/kernel-sql/lib/kernel.js");
/***/ }),
/***/ "./node_modules/@basthon/kernel-sql/lib/kernel.js":
/*!********************************************************!*\
!*** ./node_modules/@basthon/kernel-sql/lib/kernel.js ***!
\********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ SQLKernel: () => (/* binding */ SQLKernel)
/* harmony export */ });
/* harmony import */ var _basthon_kernel_base_worker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @basthon/kernel-base/worker */ "./node_modules/@basthon/kernel-base/lib/worker/index.js");
class SQLKernel extends _basthon_kernel_base_worker__WEBPACK_IMPORTED_MODULE_0__.KernelMainBase {
constructor(options) {
super(options);
}
newWorker() {
return new Worker(new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u("path"), __webpack_require__.b), {
type: undefined,
//@ts-ignore
sandboxed: true, // removing this line will cause security issues
});
}
language() {
return "sql";
}
languageName() {
return "SQL";
}
moduleExts() {
return ["sql", "db", "sqlite"];
}
ps1() {
return "sql> ";
}
ps2() {
return "...> ";
}
}
/***/ })
}]);
//# sourceMappingURL=node_modules_basthon_kernel-sql_lib_index_js.bundle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"node_modules_basthon_kernel-sql_lib_index_js.bundle.js","mappings":";;;;;;;;;;;;;;AAAyB;;;;;;;;;;;;;;;;ACAoC;AACtD,wBAAwB,uEAAc;AAC7C;AACA;AACA;AACA;AACA,kCAAkC,gGAAsC;AACxE,kBAAkB,SAAQ;AAC1B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://@mixly/python-pyodide/./node_modules/@basthon/kernel-sql/lib/index.js","webpack://@mixly/python-pyodide/./node_modules/@basthon/kernel-sql/lib/kernel.js"],"sourcesContent":["export * from \"./kernel\";\n","import { KernelMainBase } from \"@basthon/kernel-base/worker\";\nexport class SQLKernel extends KernelMainBase {\n constructor(options) {\n super(options);\n }\n newWorker() {\n return new Worker(new URL(\"./comlink-worker.js\", import.meta.url), {\n type: \"module\",\n //@ts-ignore\n sandboxed: true, // removing this line will cause security issues\n });\n }\n language() {\n return \"sql\";\n }\n languageName() {\n return \"SQL\";\n }\n moduleExts() {\n return [\"sql\", \"db\", \"sqlite\"];\n }\n ps1() {\n return \"sql> \";\n }\n ps2() {\n return \"...> \";\n }\n}\n"],"names":[],"sourceRoot":""}

View File

@@ -0,0 +1,390 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "path":
/*!***********************!*\
!*** external "path" ***!
\***********************/
/***/ ((module) => {
"use strict";
module.exports = path;
/***/ }),
/***/ "?d546":
/*!************************!*\
!*** buffer (ignored) ***!
\************************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?8131":
/*!************************!*\
!*** buffer (ignored) ***!
\************************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?3fc0":
/*!************************!*\
!*** crypto (ignored) ***!
\************************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?4068":
/*!************************!*\
!*** buffer (ignored) ***!
\************************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?e7e4":
/*!************************!*\
!*** buffer (ignored) ***!
\************************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?7bec":
/*!************************!*\
!*** buffer (ignored) ***!
\************************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?0aec":
/*!************************!*\
!*** buffer (ignored) ***!
\************************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?fbf1":
/*!************************!*\
!*** buffer (ignored) ***!
\************************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?ed1b":
/*!**********************!*\
!*** util (ignored) ***!
\**********************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?d17e":
/*!**********************!*\
!*** util (ignored) ***!
\**********************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?5041":
/*!********************!*\
!*** fs (ignored) ***!
\********************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?3e83":
/*!**********************!*\
!*** util (ignored) ***!
\**********************/
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ "?19e6":
/*!**********************!*\
!*** util (ignored) ***!
\**********************/
/***/ (() => {
/* (ignored) */
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ id: moduleId,
/******/ loaded: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/******/ // the startup function
/******/ __webpack_require__.x = () => {
/******/ // Load entry module and return exports
/******/ // This entry module depends on other loaded chunks and execution need to be delayed
/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["vendors-node_modules_basthon_kernel-base_lib_kernel_js","vendors-node_modules_comlink_dist_esm_comlink_mjs","vendors-node_modules_basthon_kernel-base_lib_worker_index_js","vendors-node_modules_basthon_kernel-sql_lib_comlink-worker_js-node_modules_promise-delegate_d-e9fad7"], () => (__webpack_require__("./node_modules/@basthon/kernel-sql/lib/comlink-worker.js")))
/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
/******/ return __webpack_exports__;
/******/ };
/******/
/************************************************************************/
/******/ /* webpack/runtime/chunk loaded */
/******/ (() => {
/******/ var deferred = [];
/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
/******/ if(chunkIds) {
/******/ priority = priority || 0;
/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
/******/ deferred[i] = [chunkIds, fn, priority];
/******/ return;
/******/ }
/******/ var notFulfilled = Infinity;
/******/ for (var i = 0; i < deferred.length; i++) {
/******/ var [chunkIds, fn, priority] = deferred[i];
/******/ var fulfilled = true;
/******/ for (var j = 0; j < chunkIds.length; j++) {
/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
/******/ chunkIds.splice(j--, 1);
/******/ } else {
/******/ fulfilled = false;
/******/ if(priority < notFulfilled) notFulfilled = priority;
/******/ }
/******/ }
/******/ if(fulfilled) {
/******/ deferred.splice(i--, 1)
/******/ var r = fn();
/******/ if (r !== undefined) result = r;
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/ensure chunk */
/******/ (() => {
/******/ __webpack_require__.f = {};
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = (chunkId) => {
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
/******/ __webpack_require__.f[key](chunkId, promises);
/******/ return promises;
/******/ }, []));
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/get javascript chunk filename */
/******/ (() => {
/******/ // This function allow to reference async chunks and sibling chunks for the entrypoint
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "" + chunkId + ".bundle.js";
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/get mini-css chunk filename */
/******/ (() => {
/******/ // This function allow to reference async chunks and sibling chunks for the entrypoint
/******/ __webpack_require__.miniCssF = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return undefined;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/node module decorator */
/******/ (() => {
/******/ __webpack_require__.nmd = (module) => {
/******/ module.paths = [];
/******/ if (!module.children) module.children = [];
/******/ return module;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ var scriptUrl;
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
/******/ var document = __webpack_require__.g.document;
/******/ if (!scriptUrl && document) {
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
/******/ scriptUrl = document.currentScript.src;
/******/ if (!scriptUrl) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ if(scripts.length) {
/******/ var i = scripts.length - 1;
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
/******/ }
/******/ }
/******/ }
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
/******/ __webpack_require__.p = scriptUrl;
/******/ })();
/******/
/******/ /* webpack/runtime/importScripts chunk loading */
/******/ (() => {
/******/ __webpack_require__.b = self.location + "";
/******/
/******/ // object to store loaded chunks
/******/ // "1" means "already loaded"
/******/ var installedChunks = {
/******/ "path": 1
/******/ };
/******/
/******/ // importScripts chunk loading
/******/ var installChunk = (data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ for(var moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) runtime(__webpack_require__);
/******/ while(chunkIds.length)
/******/ installedChunks[chunkIds.pop()] = 1;
/******/ parentChunkLoadingFunction(data);
/******/ };
/******/ __webpack_require__.f.i = (chunkId, promises) => {
/******/ // "1" is the signal for "already loaded"
/******/ if(!installedChunks[chunkId]) {
/******/ if(true) { // all chunks have JS
/******/ importScripts(__webpack_require__.p + __webpack_require__.u(chunkId));
/******/ }
/******/ }
/******/ };
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || [];
/******/ var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);
/******/ chunkLoadingGlobal.push = installChunk;
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/ })();
/******/
/******/ /* webpack/runtime/startup chunk dependencies */
/******/ (() => {
/******/ var next = __webpack_require__.x;
/******/ __webpack_require__.x = () => {
/******/ return Promise.all(["vendors-node_modules_basthon_kernel-base_lib_kernel_js","vendors-node_modules_comlink_dist_esm_comlink_mjs","vendors-node_modules_basthon_kernel-base_lib_worker_index_js","vendors-node_modules_basthon_kernel-sql_lib_comlink-worker_js-node_modules_promise-delegate_d-e9fad7"].map(__webpack_require__.e, __webpack_require__)).then(next);
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // run startup
/******/ var __webpack_exports__ = __webpack_require__.x();
/******/
/******/ })()
;
//# sourceMappingURL=path.bundle.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,6 @@
/*!*************************************************************************************************************************************************************!*\
!*** css ../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/postcss-loader/dist/cjs.js!./node_modules/@basthon/kernel-loader/lib/style.css ***!
\*************************************************************************************************************************************************************/
.basthon-loader-root {
position: fixed;
bottom: 0px;
@@ -144,3 +147,5 @@
transform: rotate(-45deg);
}
/*# sourceMappingURL=node_modules_basthon_kernel-loader_lib_style_css.1da6949d.css.map*/

View File

@@ -0,0 +1 @@
{"version":3,"file":"styles/node_modules_basthon_kernel-loader_lib_style_css.1da6949d.css","mappings":";;;AAAA;EACE,eAAe;EACf,WAAW;EACX,SAAS;EACT,WAAW;EACX,kBAAkB;EAClB,aAAa;EACb,aAAa;EACb,iBAAiB;EACjB,0BAA0B;AAC5B;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,uBAAuB;EACvB,mBAAmB;EACnB,YAAY;AACd;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,aAAa;EACb,mBAAmB;AACrB;;AAEA;EACE,uBAAuB;EACvB,eAAe;EACf,WAAW;AACb;;AAEA;EACE,kBAAkB;EAClB,SAAS;AACX;;AAEA;EACE;IACE,uBAAuB;EACzB;EACA;IACE,yBAAyB;EAC3B;AACF;;AAEA;EACE,kBAAkB;EAClB,qBAAqB;EACrB,yBAAyB;EACzB,4BAA4B;EAC5B,mBAAmB;EACnB,kBAAkB;EAClB,iDAAiD;EACjD,cAAc;EACd,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,aAAa;AACf;;AAEA;EACE,iBAAiB;EACjB,WAAW;EACX,YAAY;AACd;;AAEA;EACE,gBAAgB;EAChB,YAAY;AACd;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,aAAa;EACb,kBAAkB;EAClB,uBAAuB;EACvB,UAAU;EACV,WAAW;EACX,+BAA+B;EAC/B,gCAAgC;EAChC,kBAAkB;EAClB,gBAAgB;EAChB,eAAe;EACf,uBAAuB;EACvB,iBAAiB;EACjB,kBAAkB,EAAE,uBAAuB;EAC3C,qBAAqB;AACvB;;AAEA;EACE,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,cAAc;EACd,kBAAkB;EAClB,aAAa;EACb,eAAe;EACf,gBAAgB;EAChB,sBAAsB;EACtB,yBAAyB;EACzB,cAAc;EACd,wBAAwB;AAC1B;;AAEA;EACE,cAAc;EACd,kBAAkB;EAClB,aAAa;EACb,eAAe;EACf,gBAAgB;EAChB,sBAAsB;EACtB,yBAAyB;AAC3B;;AAEA;EACE,cAAc;EACd,wBAAwB;AAC1B;;AAEA;EACE,UAAU;EACV,yBAAyB;AAC3B","sources":["webpack://@mixly/python-pyodide/./node_modules/@basthon/kernel-loader/lib/style.css"],"sourcesContent":[".basthon-loader-root {\n position: fixed;\n bottom: 0px;\n left: 0px;\n width: 100%;\n text-align: center;\n display: flex;\n z-index: 2000;\n user-select: none;\n transition: bottom 1s ease;\n}\n\n.basthon-loader-root.basthon-loader-full.basthon-loader-hide {\n display: none;\n}\n\n.basthon-loader-root.basthon-loader-foot.basthon-loader-hide {\n bottom: -30px;\n}\n\n.basthon-loader-root.basthon-loader-full {\n justify-content: center;\n align-items: center;\n height: 100%;\n}\n\n.basthon-loader-root.basthon-loader-foot {\n height: 30px;\n}\n\n.basthon-loader-container {\n display: flex;\n align-items: center;\n}\n\n.basthon-loader-container.basthon-loader-full {\n justify-content: center;\n flex-wrap: wrap;\n width: 100%;\n}\n\n.basthon-loader-container.basthon-loader-foot {\n position: relative;\n left: 41%;\n}\n\n@keyframes basthon-loader-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n.basthon-loader-spinner {\n position: relative;\n border-color: #fcc24a;\n border-top-color: #3b749c;\n border-bottom-color: #3b749c;\n border-style: solid;\n border-radius: 50%;\n animation: basthon-loader-spin 2s linear infinite;\n overflow: auto;\n opacity: 0.8;\n}\n\n.basthon-loader-spinner.basthon-loader-full {\n border-width: 16px;\n width: 120px;\n height: 120px;\n}\n\n.basthon-loader-spinner.basthon-loader-foot {\n border-width: 3px;\n width: 16px;\n height: 16px;\n}\n\n.basthon-loader-break.basthon-loader-full {\n flex-basis: 100%;\n height: 20px;\n}\n\n.basthon-loader-break.basthon-loader-foot {\n width: 10px;\n}\n\n.basthon-loader-text.basthon-loader-foot {\n font-size: 16px;\n}\n\n.basthon-loader-error {\n display: flex;\n position: relative;\n justify-content: center;\n width: 5em;\n height: 5em;\n /*margin: 1.25em auto 1.875em;*/\n border: 0.25em solid transparent;\n border-radius: 50%;\n line-height: 5em;\n cursor: default;\n box-sizing: content-box;\n user-select: none;\n /* zoom: normal; */ /* zoom is deprecated */\n border-color: #f27474;\n}\n\n.basthon-loader-error > span {\n position: relative;\n flex-grow: 1;\n}\n\n.basthon-loader-error > span > span {\n display: block;\n position: absolute;\n top: 2.3125em;\n width: 2.9375em;\n height: 0.3125em;\n border-radius: 0.125em;\n background-color: #f27474;\n left: 1.0625em;\n transform: rotate(45deg);\n}\n\n.basthon-loader-error > span > span {\n display: block;\n position: absolute;\n top: 2.3125em;\n width: 2.9375em;\n height: 0.3125em;\n border-radius: 0.125em;\n background-color: #f27474;\n}\n\n.basthon-loader-error > span > span:first-child {\n left: 1.0625em;\n transform: rotate(45deg);\n}\n\n.basthon-loader-error > span > span:last-child {\n right: 1em;\n transform: rotate(-45deg);\n}\n"],"names":[],"sourceRoot":""}

View File

@@ -0,0 +1,520 @@
"use strict";
(self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || []).push([["vendors-node_modules_basthon_kernel-base_lib_kernel_js"],{
/***/ "./node_modules/@basthon/kernel-base/lib/commons.js":
/*!**********************************************************!*\
!*** ./node_modules/@basthon/kernel-base/lib/commons.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ NotImplementedError: () => (/* binding */ NotImplementedError),
/* harmony export */ mockFetch: () => (/* binding */ mockFetch)
/* harmony export */ });
/**
* An error thrown by not implemented API functions.
*/
class NotImplementedError extends Error {
constructor(funcName) {
super(`Function ${funcName} not implemented!`);
this.name = "NotImplementedError";
}
}
/* fetch from local FS */
const fetchFromLocalFS = async (localfsScheme, url) => {
const toDataURL = async (content) => {
return await new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onloadend = () => {
resolve(reader.result);
};
reader.onerror = reject;
reader.readAsDataURL(new Blob([content]));
});
};
const prefix = localfsScheme;
const path = url.slice(prefix.length);
let content = null;
const options = {
status: 200,
statusText: "OK",
headers: new Headers(),
};
try {
//@ts-ignore
content = self.Basthon.getFile(path);
const dataURL = await toDataURL(content);
const mime = dataURL.substring(dataURL.indexOf(":") + 1, dataURL.indexOf(";"));
content = content.buffer;
options.headers.append("Content-Type", mime);
options.headers.append("Content-Length", content.byteLength);
}
catch (e) {
options.status = 404;
options.statusText = "Not Found";
}
return new Response(content, options);
};
/**
* Get the origin of an url.
*/
const origin = (url) => new URL(url).origin;
/**
* Get the parent path of an url.
*/
const parent = (url) => {
const abs = new URL(url).href;
return abs.substring(0, abs.lastIndexOf("/"));
};
/**
* we mock the fetch function to:
* - redirect queries to local FS
* - bypass the worker's opaque origin
*/
const mockFetch = () => {
// already mocked?
if (self.fetch.name === "mockedFetch")
return;
const trueFetch = self.fetch;
async function mockedFetch(request, init) {
if (self.importScripts == null || self._assetsURL == null)
return Response.error();
// force all params to init object
if (request instanceof Request)
init = { ...request, ...init };
// ensure credentials are not sent
init = { ...init, ...{ credentials: "omit" } };
const url = request.url ?? request.toString();
const localfsScheme = "filesystem:/";
try {
// requests towards localfs
if (url.startsWith(localfsScheme)) {
return await fetchFromLocalFS(localfsScheme, url);
}
else if (origin(url) === origin(self._assetsURL)) {
// requests towards same origin
// only url under the assets folder are proxyied
if (parent(url).startsWith(self._assetsURL)) {
const proxy = self._remoteProxy;
const { body, options } = await proxy.fetch(url, init);
return new Response(body, options);
}
throw new Error("Ressource is outside the proxy' scope");
}
return await trueFetch(url, init);
}
catch (e) {
console.error(`security proxy: request to ${url} throw error: ${e.toString()}`);
return Response.error();
}
}
self.fetch = mockedFetch;
};
/***/ }),
/***/ "./node_modules/@basthon/kernel-base/lib/kernel.js":
/*!*********************************************************!*\
!*** ./node_modules/@basthon/kernel-base/lib/kernel.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ KernelBase: () => (/* binding */ KernelBase),
/* harmony export */ VERSION: () => (/* reexport safe */ _version__WEBPACK_IMPORTED_MODULE_1__.VERSION)
/* harmony export */ });
/* harmony import */ var promise_delegate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! promise-delegate */ "./node_modules/promise-delegate/dist/es/PromiseDelegate.js");
/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./version */ "./node_modules/@basthon/kernel-base/lib/version.js");
/* harmony import */ var _commons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./commons */ "./node_modules/@basthon/kernel-base/lib/commons.js");
// const desc = Object.getOwnPropertyDescriptor(
// HTMLImageElement.prototype,
// "src"
// );
// Object.defineProperty(HTMLImageElement.prototype, "src", {
// ...desc,
// get: function () {
// return desc?.get?.call(this);
// },
// set: function (e) {
// const prefix = _localfsScheme;
// if (e.startsWith(prefix)) {
// const path = e.slice(prefix.length);
// //@ts-ignore
// const content = window.Basthon.getFile(path).buffer;
// (async () => desc?.set?.call(this, await toDataURL(content)))();
// } else {
// desc?.set?.call(this, e);
// }
// },
// });
/**
* Event for Basthon's dispatch/listen.
*/
class BasthonEvent extends Event {
constructor(id, data) {
super(id);
this.detail = data;
}
}
/**
* API that any Basthon kernel should fill to be supported
* in console/notebook.
*/
class KernelBase {
constructor(options) {
this._isReady = false;
this._ready = new promise_delegate__WEBPACK_IMPORTED_MODULE_0__.PromiseDelegate();
this._stopped = Promise.resolve();
this._execution_count = 0;
this._pendingInput = undefined;
// a map to register wrapped listeners to allow later remove
this._listeners = new Map();
this._files = new Map();
this._modules = new Map();
this._options = this.clone(options);
// root path where kernel is installed
this._rootPath = options.rootPath;
if (!this.safeKernel())
console.warn(`%c⚠ DANGER ⚠: kernel ${this.language()} not safe!` +
" Please consider using a safe kernel.", "color: red; font-size: 20px;");
}
/**
* Is this kernel safe? (loaded from an isolated web worker)
*/
safeKernel() {
return false;
}
/**
* Kernel version number (string).
*/
version() {
return _version__WEBPACK_IMPORTED_MODULE_1__.VERSION;
}
/**
* Language implemented in the kernel (string).
* Generally lower case.
*/
language() {
throw new _commons__WEBPACK_IMPORTED_MODULE_2__.NotImplementedError("language");
}
/**
* Language name implemented in the kernel (string).
* As it should be displayed in text.
*/
languageName() {
throw new _commons__WEBPACK_IMPORTED_MODULE_2__.NotImplementedError("languageName");
}
/**
* Script (module) file extensions
*/
moduleExts() {
throw new _commons__WEBPACK_IMPORTED_MODULE_2__.NotImplementedError("moduleExts");
}
/**
* Execution count getter.
*/
get execution_count() {
return this._execution_count;
}
/**
* Async code evaluation that resolves with the result.
*/
evalAsync(code, outCallback, errCallback, data = null) {
throw new _commons__WEBPACK_IMPORTED_MODULE_2__.NotImplementedError("evalAsync");
}
async putFile(filename, content) {
this._files.set(filename, content);
}
async putModule(filename, content) {
this._modules.set(filename, content);
}
userModules() {
return [];
}
/**
* Get a file content from the VFS.
*/
getFile(path) {
throw new _commons__WEBPACK_IMPORTED_MODULE_2__.NotImplementedError("getFile");
}
/**
* Get a user module file content.
*/
getUserModuleFile(filename) {
throw new _commons__WEBPACK_IMPORTED_MODULE_2__.NotImplementedError("getUserModuleFile");
}
async more(source) {
throw new _commons__WEBPACK_IMPORTED_MODULE_2__.NotImplementedError("more");
}
async complete(code) {
return [];
}
banner() {
return `Welcome to the ${this.languageName()} REPL!`;
}
ps1() {
return ">>> ";
}
ps2() {
return "... ";
}
/**
* Launch the kernel (used to wrap a promise around init).
*/
async _init() { }
/**
* Initialize the kernel and start it.
*/
async init() {
try {
await this._init();
}
catch (error) {
this._ready.reject(error);
return;
}
// connecting eval to basthon.eval.request event.
this.addEventListener("eval.request", this.evalFromEvent.bind(this));
await this.start();
}
/**
* Start the kernel (used to wrap a promise around start).
*/
async _start() { }
/**
* Start the kernel.
*/
async start() {
await this._stopped;
this._execution_count = 0;
try {
await this._start();
}
catch (error) {
this._ready.reject(error);
return;
}
this._files.forEach((v, k) => this.putFile(k, v));
this._modules.forEach((v, k) => this.putModule(k, v));
this._isReady = true;
this._ready.resolve();
}
/**
* Perform async part of the stoping process.
*/
async _stop() { }
/**
* Stop the kernel synchronously (to ensure kernel is stopped after the call).
*/
stop() {
this._isReady = false;
this._ready = new promise_delegate__WEBPACK_IMPORTED_MODULE_0__.PromiseDelegate();
this._stopped = this._stop();
}
/**
* Restart the kernel (stop and start).
* Use await this.ready() to ensure kernel is started
*/
restart() {
this.stop(); // sync
this.start(); // async
}
/**
* Is the kernel ready?
*/
get isReady() {
return this._isReady;
}
/**
* Promise that resolves when the kernel is ready (started).
*/
async ready() {
return this._ready.promise;
}
/**
* Root for kernel files. This is always the language directory
* inside the version number directory inside the kernel directory.
*/
basthonRoot(absolute = false) {
let url = this._rootPath + "/" + this.version() + "/" + this.language();
if (absolute && !url.startsWith("http")) {
const base = window.location.origin + window.location.pathname;
url = base.substring(0, base.lastIndexOf("/")) + "/" + url;
}
return url;
}
/**
* Downloading data (bytes array or data URL) as filename
* (opening browser dialog).
*/
download(data, filename) {
if (!(typeof data === "string" || data instanceof String)) {
const blob = new Blob([data], { type: "application/octet-stream" });
data = window.URL.createObjectURL(blob);
}
const anchor = document.createElement("a");
anchor.download = filename;
anchor.href = data;
anchor.target = "_blank";
anchor.style.display = "none"; // just to be safe!
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
}
/**
* Dynamically load a script asynchronously.
*/
static loadScript(url) {
return new Promise(function (resolve, reject) {
let script = document.createElement("script");
script.onload = resolve;
script.onerror = reject;
script.src = url;
document.head.appendChild(script);
});
}
/**
* Wrapper around document.dispatchEvent.
* It adds the 'basthon.' prefix to each event name and
* manage the event lookup to retreive relevent data.
*/
dispatchEvent(eventName, data) {
document.dispatchEvent(new BasthonEvent(`basthon.${eventName}`, data));
}
/**
* Wrapper around document.addEventListener.
* It manages the 'basthon.' prefix to each event name and
* manage the event lookup to retreive relevent data.
*/
addEventListener(eventName, callback) {
// wrapped callback
const _callback = (event) => callback(event.detail);
document.addEventListener(`basthon.${eventName}`, _callback);
// register the wrapped callback in order to remove it
let listeners = this._listeners.get(eventName);
if (listeners == null) {
listeners = new Map();
this._listeners.set(eventName, listeners);
}
listeners.set(callback, _callback);
}
/**
* Wrapper around document.removeEventListener.
* It manages the 'basthon.' prefix to each event name.
*/
removeEventListener(eventName, callback) {
// get the wrapped callback
const listeners = this._listeners.get(eventName);
document.removeEventListener(`basthon.${eventName}`, listeners?.get(callback));
}
/**
* Send eval.input event then wait for the user response and return it.
*/
async inputAsync(prompt, password = false, data = undefined) {
data = this.clone(data);
data.content = { prompt, password };
const pd = new promise_delegate__WEBPACK_IMPORTED_MODULE_0__.PromiseDelegate();
data.resolve = pd.resolve.bind(pd);
data.reject = pd.reject.bind(pd);
this._pendingInput = pd;
this.dispatchEvent("eval.input", data);
const res = await pd.promise;
this._pendingInput = undefined;
return res;
}
/**
* Close a pending input.
*/
resolvePendingInput() {
this._pendingInput?.resolve("");
}
/**
* Simple clone via JSON copy.
*/
clone(obj) {
// simple trick that is enough for our purpose.
return JSON.parse(JSON.stringify(obj));
}
/**
* Put a ressource (file or module).
* Detection is based on extension.
*/
async putRessource(filename, content) {
const ext = filename.split(".").pop() ?? "";
if (this.moduleExts().includes(ext)) {
return await this.putModule(filename, content);
}
else {
return await this.putFile(filename, content);
}
}
/**
* Is an input pending?
*/
pendingInput() {
return this._pendingInput != null;
}
/**
* Internal. Code evaluation after an eval.request event.
*/
async evalFromEvent(data) {
const stdCallback = (std) => (text) => {
let dataEvent = this.clone(data);
dataEvent.stream = std;
dataEvent.content = text;
this.dispatchEvent("eval.output", dataEvent);
};
const outCallback = stdCallback("stdout");
const errCallback = stdCallback("stderr");
let args;
try {
args = await this.evalAsync(data.code, outCallback, errCallback, data);
}
catch (error) {
errCallback(error.toString());
const dataEvent = this.clone(data);
dataEvent.error = error;
dataEvent.execution_count = this.execution_count;
this.dispatchEvent("eval.error", dataEvent);
return;
}
if (args == null)
return; // this should not happend
const result = args[0];
const executionCount = args[1];
let dataEvent = this.clone(data);
dataEvent.execution_count = executionCount;
if (result != null)
dataEvent.result = result;
this.dispatchEvent("eval.finished", dataEvent);
}
}
/***/ }),
/***/ "./node_modules/@basthon/kernel-base/lib/version.js":
/*!**********************************************************!*\
!*** ./node_modules/@basthon/kernel-base/lib/version.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ VERSION: () => (/* binding */ VERSION)
/* harmony export */ });
const VERSION = "0.62.22";
/***/ })
}]);
//# sourceMappingURL=vendors-node_modules_basthon_kernel-base_lib_kernel_js.bundle.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,465 @@
"use strict";
(self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || []).push([["vendors-node_modules_basthon_kernel-base_lib_worker_index_js"],{
/***/ "./node_modules/@basthon/kernel-base/lib/worker/index.js":
/*!***************************************************************!*\
!*** ./node_modules/@basthon/kernel-base/lib/worker/index.js ***!
\***************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ KernelMainBase: () => (/* reexport safe */ _kernel_main__WEBPACK_IMPORTED_MODULE_0__.KernelMainBase),
/* harmony export */ KernelWorkerBase: () => (/* reexport safe */ _kernel_worker__WEBPACK_IMPORTED_MODULE_1__.KernelWorkerBase)
/* harmony export */ });
/* harmony import */ var _kernel_main__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./kernel-main */ "./node_modules/@basthon/kernel-base/lib/worker/kernel-main.js");
/* harmony import */ var _kernel_worker__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./kernel-worker */ "./node_modules/@basthon/kernel-base/lib/worker/kernel-worker.js");
/***/ }),
/***/ "./node_modules/@basthon/kernel-base/lib/worker/kernel-main.js":
/*!*********************************************************************!*\
!*** ./node_modules/@basthon/kernel-base/lib/worker/kernel-main.js ***!
\*********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ KernelMainBase: () => (/* binding */ KernelMainBase)
/* harmony export */ });
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! comlink */ "./node_modules/comlink/dist/esm/comlink.mjs");
/* harmony import */ var _commons__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../commons */ "./node_modules/@basthon/kernel-base/lib/commons.js");
/* harmony import */ var _kernel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../kernel */ "./node_modules/@basthon/kernel-base/lib/kernel.js");
// mock Worker to support sandboxing and keep webpack compatibility
if (globalThis.Worker.name !== "SandboxedWorker") {
class SandboxedWorker extends Worker {
constructor(url, options) {
if (options.sandboxed) {
const absURL = new URL(url).href;
const assetsURL = absURL.substring(0, absURL.lastIndexOf("/"));
// worker created with a 'data' url scheme has opaque origin
// https://html.spec.whatwg.org/multipage/workers.html#script-settings-for-workers:concept-origin-opaque
const workerScript = `self._assetsURL = "${assetsURL}";
globalThis = {importScripts: self.importScripts, location: "${url}"};
importScripts("${url}");
globalThis = self;`.replace(/\s/g, "");
super(`data:text/javascript;base64,${btoa(workerScript)}`);
}
else {
super(url, options);
}
}
}
globalThis.Worker = SandboxedWorker;
}
class KernelMainBase extends _kernel__WEBPACK_IMPORTED_MODULE_1__.KernelBase {
constructor(options) {
super(options);
}
/**
* Is this kernel safe? (loaded in an isolated web worker)
*/
safeKernel() {
return true;
}
/**
* Get a new worker (should be overloaded).
*/
newWorker() {
throw new _commons__WEBPACK_IMPORTED_MODULE_0__.NotImplementedError("newWorker");
}
/**
* Start the worker.
*/
async _start() {
await super._start();
const worker = this.newWorker();
// setup the proxy worker
const proxyWorker = new Worker(new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u("node_modules_basthon_kernel-base_lib_worker_comlink-proxy_js"), __webpack_require__.b), {
type: undefined,
});
const proxy = (0,comlink__WEBPACK_IMPORTED_MODULE_2__.wrap)(proxyWorker);
// setup the kernel worker
this._worker = worker;
worker.onmessage = (e) => this.processWorkerMessage(e.data);
const KernelWorker = (0,comlink__WEBPACK_IMPORTED_MODULE_2__.wrap)(worker);
// why typescript complains about this call? yet, this is advertised in
// https://github.com/GoogleChromeLabs/comlink/blob/dffe9050f63b1b39f30213adeb1dd4b9ed7d2594/docs/examples/03-classes-example/index.html#L15
//@ts-ignore
this._remote = await new KernelWorker(this._options);
// bind ports
const port = await proxy[comlink__WEBPACK_IMPORTED_MODULE_2__.createEndpoint]();
await this.remote?.setProxyPort((0,comlink__WEBPACK_IMPORTED_MODULE_2__.transfer)(port, [port]));
// init remote
await this.remote?.init();
}
/**
* Comlink remote getter.
*/
get remote() {
return this._remote;
}
/**
* Stop the worker.
*/
async _stop() {
this._worker?.terminate();
this._worker = undefined;
this._remote = undefined;
await super._stop();
}
/**
* Process messages from worker (if any).
*/
processWorkerMessage(msg) {
switch (msg.type) {
case "stream":
const { stream, text } = msg.content;
const dataEvent = this.clone(msg.data);
dataEvent.stream = stream;
dataEvent.content = text;
this.dispatchEvent("eval.output", dataEvent);
break;
case "download":
const { content, filename } = msg.content;
this.download(content, filename);
break;
case "display":
this.dispatchEvent("eval.display", msg.data);
break;
case "input":
const { prompt, password, data, sab } = msg.content;
(async () => {
const res = (await this.inputAsync(prompt, password, data));
const encodedRes = new TextEncoder().encode(res);
new Uint8Array(sab).set(encodedRes.subarray(0, sab.byteLength));
Atomics.notify(new Int32Array(sab), 0, 1);
})();
break;
default: // ignoring (probably a comlink message)
}
}
async evalAsync(code, outCallback, errCallback, data = null) {
// force interactivity in all modes
data.interactive = true;
this._execution_count++;
// evaluation
const execResult = (await this.remote?.eval(data, code));
// return result
let result;
switch (execResult?.status) {
case "ok":
result = execResult.result;
break;
case "error":
break;
}
return [result, this._execution_count];
}
/**
* Put a file on the local (emulated) filesystem.
*/
async putFile(filename, content) {
await super.putFile(filename, content);
await this.remote?.putFile(filename, content);
}
/**
* Put an importable module on the local (emulated) filesystem
* and load dependencies.
*/
async putModule(filename, content) {
await super.putModule(filename, content);
await this.remote?.putModule(filename, content);
}
/**
* Complete a code at the end (usefull for tab completion).
*
* Returns an array of two elements: the list of completions
* and the start index.
*/
async complete(code) {
return (await this.remote?.complete(code)) ?? [];
}
/**
* Tell wether we should wait for more code or if it can
* be run as is.
*
* Useful to set ps1/ps2 in console prompt.
*/
async more(code) {
return (await this.remote?.more(code)) ?? false;
}
}
/***/ }),
/***/ "./node_modules/@basthon/kernel-base/lib/worker/kernel-worker.js":
/*!***********************************************************************!*\
!*** ./node_modules/@basthon/kernel-base/lib/worker/kernel-worker.js ***!
\***********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ KernelWorkerBase: () => (/* binding */ KernelWorkerBase)
/* harmony export */ });
/* harmony import */ var promise_delegate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! promise-delegate */ "./node_modules/promise-delegate/dist/es/PromiseDelegate.js");
/* harmony import */ var _commons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../commons */ "./node_modules/@basthon/kernel-base/lib/commons.js");
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! comlink */ "./node_modules/comlink/dist/esm/comlink.mjs");
class KernelWorkerBase {
constructor(options) {
this._ready = new promise_delegate__WEBPACK_IMPORTED_MODULE_0__.PromiseDelegate();
/* we mock the fetch function to:
* - redirect queries to local FS
* - bypass the worker's opaque origin
*/
(0,_commons__WEBPACK_IMPORTED_MODULE_1__.mockFetch)();
// useful for ffi
self.basthon = this;
// global prompt redirected to our input
if (self._prompt == null)
self._prompt = globalThis.prompt;
globalThis.prompt = (prompt) => this.input(prompt);
}
/*
* Initialize the kernel. Should be overloaded.
*/
async _init() { }
/**
* Initialize the kernel. It is called by initWorker in KernelBase.
*/
async init() {
try {
await this._init();
this._ready.resolve();
}
catch (e) {
this._ready.reject(e);
}
}
/**
* Wait for the kernel to be ready.
*/
ready() {
return this._ready.promise;
}
/**
* Set the comlink communication port to proxy fetch.
*/
setProxyPort(port) {
self._remoteProxy = (0,comlink__WEBPACK_IMPORTED_MODULE_2__.wrap)(port);
}
/**
* Send stream to stdout/stderr.
*/
sendStream(data, stream, text) {
globalThis.postMessage({
data,
type: "stream",
content: { stream, text },
});
}
/**
* Send stream to stdout.
*/
sendStdoutStream(data, text) {
this.sendStream(data, "stdout", text);
}
/**
* Send stream to stderr.
*/
sendStderrStream(data, text) {
this.sendStream(data, "stderr", text);
}
async blobToDataURL(blob) {
return await new Promise((resolve) => {
const reader = new FileReader();
reader.onloadend = () => resolve(reader.result);
reader.readAsDataURL(blob);
});
}
/**
* Display a blob (only png images are supported).
*/
async displayBlob(blob, data) {
if (data == null)
data = this.clone(this.__eval_data__);
const dataURL = await this.blobToDataURL(blob);
const pngPrefix = "data:image/png;base64,";
if (dataURL.startsWith(pngPrefix)) {
const png = dataURL.slice(pngPrefix.length);
data["display_type"] = "multiple";
data["content"] = { "image/png": png };
}
else {
return;
}
globalThis.postMessage({ data, type: "display" });
}
/**
* Display an element like a canvas, ... in the frontend.
*/
display(element) {
const data = this.clone(this.__eval_data__);
if (globalThis.OffscreenCanvas != null &&
element instanceof OffscreenCanvas) {
element
.convertToBlob()
.then((blob) => this.displayBlob(blob, data));
}
else {
data["display_type"] = "multiple";
data["content"] = element;
globalThis.postMessage({ data, type: "display" });
}
}
/**
* Evaluate code and return an object with mime type keys and string value.
* To be overloaded.
*/
async _eval(data, code) {
throw new _commons__WEBPACK_IMPORTED_MODULE_1__.NotImplementedError("_eval");
}
/**
* Evaluate a string of code. To be called by main thread (through comlink).
*/
async eval(data, code) {
this.__eval_data__ = data;
try {
const result = await this._eval(data, code);
return { data, status: "ok", result };
}
catch (e) {
const { name, stack, message } = e;
this.sendStderrStream(data, e.toString());
return {
data,
status: "error",
error: {
name: name,
value: message,
traceback: stack?.toString(),
},
};
}
}
/**
* Put a file on the local (emulated) filesystem.
*/
putFile(filename, content) {
throw new _commons__WEBPACK_IMPORTED_MODULE_1__.NotImplementedError("putFile");
}
/**
* Put an importable module on the local (emulated) filesystem
* and load dependencies.
*/
putModule(filename, content) {
throw new _commons__WEBPACK_IMPORTED_MODULE_1__.NotImplementedError("putModule");
}
/**
* Complete the submited code.
*/
async complete(code) {
return [];
}
/**
* Tell wether we should wait for more code or if it can
* be run as is.
*
* Useful to set ps1/ps2 in console prompt.
*/
async more(code) {
throw new _commons__WEBPACK_IMPORTED_MODULE_1__.NotImplementedError("more");
}
/**
* Send a message to the main thread to download a file.
*/
download(content, filename) {
globalThis.postMessage({
type: "download",
content: { content, filename },
});
}
/**
* Use JSON stringify/parse to copy an object.
*/
clone(data) {
return JSON.parse(JSON.stringify(data));
}
/**
* Sync sleep for a certain duration in seconds.
*/
sleep(duration) {
duration = duration * 1000; // to milliseconds
if (globalThis.crossOriginIsolated) {
const sab = new Int32Array(new SharedArrayBuffer(4));
Atomics.wait(sab, 0, 0, duration);
return;
}
else {
const t0 = Date.now();
// active sleep
while (Date.now() - t0 < duration)
;
}
}
/**
* Decode the string contained in a SharedArrayBuffer to
* bypas this issue:
* https://github.com/whatwg/encoding/issues/172
*/
decodeSharedArrayBuffer(sab) {
const array = new Uint8Array(sab);
let length = array.length;
for (; length > 0 && array[length - 1] === 0; length--)
;
if (length === 0)
return "";
const cropped = new Uint8Array(length);
cropped.set(array.subarray(0, length));
try {
return new TextDecoder().decode(cropped);
}
catch (e) {
if (array.length === length)
throw new Error("String too long, can't decode");
throw e;
}
}
/**
* Sync input that does not use the ugly prompt but send
* an eval.input event tho the main thread and wait for the response.
*/
input(prompt, password = false) {
if (globalThis.crossOriginIsolated) {
const data = this.clone(this.__eval_data__);
const sab = new SharedArrayBuffer(1024);
globalThis.postMessage({
type: "input",
content: { data, prompt, password, sab },
});
Atomics.wait(new Int32Array(sab), 0, 0);
return this.decodeSharedArrayBuffer(sab);
}
else {
return self._prompt(prompt ?? "") ?? "";
}
}
}
/***/ })
}]);
//# sourceMappingURL=vendors-node_modules_basthon_kernel-base_lib_worker_index_js.bundle.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,688 @@
(self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || []).push([["vendors-node_modules_basthon_kernel-javascript_lib_comlink-worker_js-node_modules_promise-del-2ae688"],{
/***/ "./node_modules/@basthon/kernel-javascript/lib/comlink-worker.js":
/*!***********************************************************************!*\
!*** ./node_modules/@basthon/kernel-javascript/lib/comlink-worker.js ***!
\***********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! comlink */ "./node_modules/comlink/dist/esm/comlink.mjs");
/* harmony import */ var _worker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./worker */ "./node_modules/@basthon/kernel-javascript/lib/worker.js");
(0,comlink__WEBPACK_IMPORTED_MODULE_1__.expose)(_worker__WEBPACK_IMPORTED_MODULE_0__.JavaScriptKernelWorker);
/***/ }),
/***/ "./node_modules/@basthon/kernel-javascript/lib/worker.js":
/*!***************************************************************!*\
!*** ./node_modules/@basthon/kernel-javascript/lib/worker.js ***!
\***************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ JavaScriptKernelWorker: () => (/* binding */ JavaScriptKernelWorker)
/* harmony export */ });
/* harmony import */ var object_inspect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! object-inspect */ "./node_modules/object-inspect/index.js");
/* harmony import */ var object_inspect__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(object_inspect__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _basthon_kernel_base_worker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @basthon/kernel-base/worker */ "./node_modules/@basthon/kernel-base/lib/worker/index.js");
class JavaScriptKernelWorker extends _basthon_kernel_base_worker__WEBPACK_IMPORTED_MODULE_0__.KernelWorkerBase {
constructor(options) {
// do not forget to call the parent constructor
super(options);
// the window object is not available in a webworker...
self.window = self;
self.Canvas = globalThis.OffscreenCanvas;
}
/*
* Initialize the kernel.
*/
async _init() {
console.info = (...args) => console.log(...args);
console.warn = (...args) => console.error(...args);
globalThis.addEventListener("error", (e) => console.error(e.toString()));
}
async _eval(data, code) {
console.log = (...args) => {
this.sendStdoutStream(data, args.join(" ") + "\n");
};
console.error = (...args) => {
this.sendStderrStream(data, args.join(" ") + "\n");
};
const result = await globalThis.eval(code); // if a promise is returned, wait for it
return typeof result === "undefined"
? undefined
: { "text/plain": object_inspect__WEBPACK_IMPORTED_MODULE_1___default()(result) };
}
putFile(filename, content) {
console.error(`Fichier ${filename} not added since putFile has no mean in the JS context.`);
}
async putModule(filename, content) {
content = new Uint8Array(content);
const ext = filename.split(".").pop();
switch (ext) {
case "js":
let decoder = new TextDecoder("utf-8");
const _content = decoder.decode(content);
await globalThis.eval(_content);
break;
default:
throw { message: "Only '.js' files supported." };
}
}
async complete(code) {
// basic completion based on global object
const vars = Object.getOwnPropertyNames(self);
const words = code.match(/(\w+)$/) ?? [];
const word = words[0] ?? "";
const matches = vars.filter((v) => v.startsWith(word));
return [matches, code.length - word.length];
}
async more(code) {
return false;
}
}
/***/ }),
/***/ "./node_modules/object-inspect/index.js":
/*!**********************************************!*\
!*** ./node_modules/object-inspect/index.js ***!
\**********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var hasMap = typeof Map === 'function' && Map.prototype;
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
var mapForEach = hasMap && Map.prototype.forEach;
var hasSet = typeof Set === 'function' && Set.prototype;
var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
var setForEach = hasSet && Set.prototype.forEach;
var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
var booleanValueOf = Boolean.prototype.valueOf;
var objectToString = Object.prototype.toString;
var functionToString = Function.prototype.toString;
var $match = String.prototype.match;
var $slice = String.prototype.slice;
var $replace = String.prototype.replace;
var $toUpperCase = String.prototype.toUpperCase;
var $toLowerCase = String.prototype.toLowerCase;
var $test = RegExp.prototype.test;
var $concat = Array.prototype.concat;
var $join = Array.prototype.join;
var $arrSlice = Array.prototype.slice;
var $floor = Math.floor;
var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
var gOPS = Object.getOwnPropertySymbols;
var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
// ie, `has-tostringtag/shams
var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
? Symbol.toStringTag
: null;
var isEnumerable = Object.prototype.propertyIsEnumerable;
var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
[].__proto__ === Array.prototype // eslint-disable-line no-proto
? function (O) {
return O.__proto__; // eslint-disable-line no-proto
}
: null
);
function addNumericSeparator(num, str) {
if (
num === Infinity
|| num === -Infinity
|| num !== num
|| (num && num > -1000 && num < 1000)
|| $test.call(/e/, str)
) {
return str;
}
var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
if (typeof num === 'number') {
var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
if (int !== num) {
var intStr = String(int);
var dec = $slice.call(str, intStr.length + 1);
return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
}
}
return $replace.call(str, sepRegex, '$&_');
}
var utilInspect = __webpack_require__(/*! ./util.inspect */ "?4f7e");
var inspectCustom = utilInspect.custom;
var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
module.exports = function inspect_(obj, options, depth, seen) {
var opts = options || {};
if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
throw new TypeError('option "quoteStyle" must be "single" or "double"');
}
if (
has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
: opts.maxStringLength !== null
)
) {
throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
}
var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
}
if (
has(opts, 'indent')
&& opts.indent !== null
&& opts.indent !== '\t'
&& !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
) {
throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
}
if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
}
var numericSeparator = opts.numericSeparator;
if (typeof obj === 'undefined') {
return 'undefined';
}
if (obj === null) {
return 'null';
}
if (typeof obj === 'boolean') {
return obj ? 'true' : 'false';
}
if (typeof obj === 'string') {
return inspectString(obj, opts);
}
if (typeof obj === 'number') {
if (obj === 0) {
return Infinity / obj > 0 ? '0' : '-0';
}
var str = String(obj);
return numericSeparator ? addNumericSeparator(obj, str) : str;
}
if (typeof obj === 'bigint') {
var bigIntStr = String(obj) + 'n';
return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
}
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
if (typeof depth === 'undefined') { depth = 0; }
if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
return isArray(obj) ? '[Array]' : '[Object]';
}
var indent = getIndent(opts, depth);
if (typeof seen === 'undefined') {
seen = [];
} else if (indexOf(seen, obj) >= 0) {
return '[Circular]';
}
function inspect(value, from, noIndent) {
if (from) {
seen = $arrSlice.call(seen);
seen.push(from);
}
if (noIndent) {
var newOpts = {
depth: opts.depth
};
if (has(opts, 'quoteStyle')) {
newOpts.quoteStyle = opts.quoteStyle;
}
return inspect_(value, newOpts, depth + 1, seen);
}
return inspect_(value, opts, depth + 1, seen);
}
if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable
var name = nameOf(obj);
var keys = arrObjKeys(obj, inspect);
return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
}
if (isSymbol(obj)) {
var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
}
if (isElement(obj)) {
var s = '<' + $toLowerCase.call(String(obj.nodeName));
var attrs = obj.attributes || [];
for (var i = 0; i < attrs.length; i++) {
s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
}
s += '>';
if (obj.childNodes && obj.childNodes.length) { s += '...'; }
s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
return s;
}
if (isArray(obj)) {
if (obj.length === 0) { return '[]'; }
var xs = arrObjKeys(obj, inspect);
if (indent && !singleLineValues(xs)) {
return '[' + indentedJoin(xs, indent) + ']';
}
return '[ ' + $join.call(xs, ', ') + ' ]';
}
if (isError(obj)) {
var parts = arrObjKeys(obj, inspect);
if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
}
if (parts.length === 0) { return '[' + String(obj) + ']'; }
return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
}
if (typeof obj === 'object' && customInspect) {
if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
return utilInspect(obj, { depth: maxDepth - depth });
} else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
return obj.inspect();
}
}
if (isMap(obj)) {
var mapParts = [];
if (mapForEach) {
mapForEach.call(obj, function (value, key) {
mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
});
}
return collectionOf('Map', mapSize.call(obj), mapParts, indent);
}
if (isSet(obj)) {
var setParts = [];
if (setForEach) {
setForEach.call(obj, function (value) {
setParts.push(inspect(value, obj));
});
}
return collectionOf('Set', setSize.call(obj), setParts, indent);
}
if (isWeakMap(obj)) {
return weakCollectionOf('WeakMap');
}
if (isWeakSet(obj)) {
return weakCollectionOf('WeakSet');
}
if (isWeakRef(obj)) {
return weakCollectionOf('WeakRef');
}
if (isNumber(obj)) {
return markBoxed(inspect(Number(obj)));
}
if (isBigInt(obj)) {
return markBoxed(inspect(bigIntValueOf.call(obj)));
}
if (isBoolean(obj)) {
return markBoxed(booleanValueOf.call(obj));
}
if (isString(obj)) {
return markBoxed(inspect(String(obj)));
}
// note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
/* eslint-env browser */
if (typeof window !== 'undefined' && obj === window) {
return '{ [object Window] }';
}
if (
(typeof globalThis !== 'undefined' && obj === globalThis)
|| (typeof __webpack_require__.g !== 'undefined' && obj === __webpack_require__.g)
) {
return '{ [object globalThis] }';
}
if (!isDate(obj) && !isRegExp(obj)) {
var ys = arrObjKeys(obj, inspect);
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
var protoTag = obj instanceof Object ? '' : 'null prototype';
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
if (ys.length === 0) { return tag + '{}'; }
if (indent) {
return tag + '{' + indentedJoin(ys, indent) + '}';
}
return tag + '{ ' + $join.call(ys, ', ') + ' }';
}
return String(obj);
};
function wrapQuotes(s, defaultStyle, opts) {
var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
return quoteChar + s + quoteChar;
}
function quote(s) {
return $replace.call(String(s), /"/g, '&quot;');
}
function isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
function isSymbol(obj) {
if (hasShammedSymbols) {
return obj && typeof obj === 'object' && obj instanceof Symbol;
}
if (typeof obj === 'symbol') {
return true;
}
if (!obj || typeof obj !== 'object' || !symToString) {
return false;
}
try {
symToString.call(obj);
return true;
} catch (e) {}
return false;
}
function isBigInt(obj) {
if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
return false;
}
try {
bigIntValueOf.call(obj);
return true;
} catch (e) {}
return false;
}
var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
function has(obj, key) {
return hasOwn.call(obj, key);
}
function toStr(obj) {
return objectToString.call(obj);
}
function nameOf(f) {
if (f.name) { return f.name; }
var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
if (m) { return m[1]; }
return null;
}
function indexOf(xs, x) {
if (xs.indexOf) { return xs.indexOf(x); }
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x) { return i; }
}
return -1;
}
function isMap(x) {
if (!mapSize || !x || typeof x !== 'object') {
return false;
}
try {
mapSize.call(x);
try {
setSize.call(x);
} catch (s) {
return true;
}
return x instanceof Map; // core-js workaround, pre-v2.5.0
} catch (e) {}
return false;
}
function isWeakMap(x) {
if (!weakMapHas || !x || typeof x !== 'object') {
return false;
}
try {
weakMapHas.call(x, weakMapHas);
try {
weakSetHas.call(x, weakSetHas);
} catch (s) {
return true;
}
return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
} catch (e) {}
return false;
}
function isWeakRef(x) {
if (!weakRefDeref || !x || typeof x !== 'object') {
return false;
}
try {
weakRefDeref.call(x);
return true;
} catch (e) {}
return false;
}
function isSet(x) {
if (!setSize || !x || typeof x !== 'object') {
return false;
}
try {
setSize.call(x);
try {
mapSize.call(x);
} catch (m) {
return true;
}
return x instanceof Set; // core-js workaround, pre-v2.5.0
} catch (e) {}
return false;
}
function isWeakSet(x) {
if (!weakSetHas || !x || typeof x !== 'object') {
return false;
}
try {
weakSetHas.call(x, weakSetHas);
try {
weakMapHas.call(x, weakMapHas);
} catch (s) {
return true;
}
return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
} catch (e) {}
return false;
}
function isElement(x) {
if (!x || typeof x !== 'object') { return false; }
if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
return true;
}
return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
}
function inspectString(str, opts) {
if (str.length > opts.maxStringLength) {
var remaining = str.length - opts.maxStringLength;
var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
}
// eslint-disable-next-line no-control-regex
var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
return wrapQuotes(s, 'single', opts);
}
function lowbyte(c) {
var n = c.charCodeAt(0);
var x = {
8: 'b',
9: 't',
10: 'n',
12: 'f',
13: 'r'
}[n];
if (x) { return '\\' + x; }
return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
}
function markBoxed(str) {
return 'Object(' + str + ')';
}
function weakCollectionOf(type) {
return type + ' { ? }';
}
function collectionOf(type, size, entries, indent) {
var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
return type + ' (' + size + ') {' + joinedEntries + '}';
}
function singleLineValues(xs) {
for (var i = 0; i < xs.length; i++) {
if (indexOf(xs[i], '\n') >= 0) {
return false;
}
}
return true;
}
function getIndent(opts, depth) {
var baseIndent;
if (opts.indent === '\t') {
baseIndent = '\t';
} else if (typeof opts.indent === 'number' && opts.indent > 0) {
baseIndent = $join.call(Array(opts.indent + 1), ' ');
} else {
return null;
}
return {
base: baseIndent,
prev: $join.call(Array(depth + 1), baseIndent)
};
}
function indentedJoin(xs, indent) {
if (xs.length === 0) { return ''; }
var lineJoiner = '\n' + indent.prev + indent.base;
return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
}
function arrObjKeys(obj, inspect) {
var isArr = isArray(obj);
var xs = [];
if (isArr) {
xs.length = obj.length;
for (var i = 0; i < obj.length; i++) {
xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
}
}
var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
var symMap;
if (hasShammedSymbols) {
symMap = {};
for (var k = 0; k < syms.length; k++) {
symMap['$' + syms[k]] = syms[k];
}
}
for (var key in obj) { // eslint-disable-line no-restricted-syntax
if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
// this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
continue; // eslint-disable-line no-restricted-syntax, no-continue
} else if ($test.call(/[^\w$]/, key)) {
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
} else {
xs.push(key + ': ' + inspect(obj[key], obj));
}
}
if (typeof gOPS === 'function') {
for (var j = 0; j < syms.length; j++) {
if (isEnumerable.call(obj, syms[j])) {
xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
}
}
}
return xs;
}
/***/ }),
/***/ "./node_modules/promise-delegate/dist/es/PromiseDelegate.js":
/*!******************************************************************!*\
!*** ./node_modules/promise-delegate/dist/es/PromiseDelegate.js ***!
\******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ PromiseDelegate: () => (/* binding */ PromiseDelegate)
/* harmony export */ });
var PromiseDelegate = (function () {
function PromiseDelegate(ignoreMultipleSettles) {
var _this = this;
if (ignoreMultipleSettles === void 0) { ignoreMultipleSettles = false; }
this.ignoreMultipleSettles = ignoreMultipleSettles;
this.isSettled = false;
this.promise = new Promise(function (resolve, reject) {
_this.resolveCallback = resolve;
_this.rejectCallback = reject;
});
}
PromiseDelegate.prototype.markAsSettled = function () {
var wasSettled = this.isSettled;
if (wasSettled && !this.ignoreMultipleSettles) {
throw new Error("PromiseDelegate is already settled!");
}
this.isSettled = true;
return !wasSettled;
};
Object.defineProperty(PromiseDelegate.prototype, "settled", {
get: function () {
return this.isSettled;
},
enumerable: false,
configurable: true
});
PromiseDelegate.prototype.resolve = function (value) {
if (this.markAsSettled()) {
this.resolveCallback(value);
}
};
PromiseDelegate.prototype.reject = function (reason) {
if (this.markAsSettled()) {
this.rejectCallback(reason);
}
};
return PromiseDelegate;
}());
//# sourceMappingURL=PromiseDelegate.js.map
/***/ })
}]);
//# sourceMappingURL=vendors-node_modules_basthon_kernel-javascript_lib_comlink-worker_js-node_modules_promise-del-2ae688.bundle.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,374 @@
"use strict";
(self["webpackChunk_mixly_python_pyodide"] = self["webpackChunk_mixly_python_pyodide"] || []).push([["vendors-node_modules_comlink_dist_esm_comlink_mjs"],{
/***/ "./node_modules/comlink/dist/esm/comlink.mjs":
/*!***************************************************!*\
!*** ./node_modules/comlink/dist/esm/comlink.mjs ***!
\***************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ createEndpoint: () => (/* binding */ createEndpoint),
/* harmony export */ expose: () => (/* binding */ expose),
/* harmony export */ finalizer: () => (/* binding */ finalizer),
/* harmony export */ proxy: () => (/* binding */ proxy),
/* harmony export */ proxyMarker: () => (/* binding */ proxyMarker),
/* harmony export */ releaseProxy: () => (/* binding */ releaseProxy),
/* harmony export */ transfer: () => (/* binding */ transfer),
/* harmony export */ transferHandlers: () => (/* binding */ transferHandlers),
/* harmony export */ windowEndpoint: () => (/* binding */ windowEndpoint),
/* harmony export */ wrap: () => (/* binding */ wrap)
/* harmony export */ });
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
const proxyMarker = Symbol("Comlink.proxy");
const createEndpoint = Symbol("Comlink.endpoint");
const releaseProxy = Symbol("Comlink.releaseProxy");
const finalizer = Symbol("Comlink.finalizer");
const throwMarker = Symbol("Comlink.thrown");
const isObject = (val) => (typeof val === "object" && val !== null) || typeof val === "function";
/**
* Internal transfer handle to handle objects marked to proxy.
*/
const proxyTransferHandler = {
canHandle: (val) => isObject(val) && val[proxyMarker],
serialize(obj) {
const { port1, port2 } = new MessageChannel();
expose(obj, port1);
return [port2, [port2]];
},
deserialize(port) {
port.start();
return wrap(port);
},
};
/**
* Internal transfer handler to handle thrown exceptions.
*/
const throwTransferHandler = {
canHandle: (value) => isObject(value) && throwMarker in value,
serialize({ value }) {
let serialized;
if (value instanceof Error) {
serialized = {
isError: true,
value: {
message: value.message,
name: value.name,
stack: value.stack,
},
};
}
else {
serialized = { isError: false, value };
}
return [serialized, []];
},
deserialize(serialized) {
if (serialized.isError) {
throw Object.assign(new Error(serialized.value.message), serialized.value);
}
throw serialized.value;
},
};
/**
* Allows customizing the serialization of certain values.
*/
const transferHandlers = new Map([
["proxy", proxyTransferHandler],
["throw", throwTransferHandler],
]);
function isAllowedOrigin(allowedOrigins, origin) {
for (const allowedOrigin of allowedOrigins) {
if (origin === allowedOrigin || allowedOrigin === "*") {
return true;
}
if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {
return true;
}
}
return false;
}
function expose(obj, ep = globalThis, allowedOrigins = ["*"]) {
ep.addEventListener("message", function callback(ev) {
if (!ev || !ev.data) {
return;
}
if (!isAllowedOrigin(allowedOrigins, ev.origin)) {
console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);
return;
}
const { id, type, path } = Object.assign({ path: [] }, ev.data);
const argumentList = (ev.data.argumentList || []).map(fromWireValue);
let returnValue;
try {
const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);
const rawValue = path.reduce((obj, prop) => obj[prop], obj);
switch (type) {
case "GET" /* MessageType.GET */:
{
returnValue = rawValue;
}
break;
case "SET" /* MessageType.SET */:
{
parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);
returnValue = true;
}
break;
case "APPLY" /* MessageType.APPLY */:
{
returnValue = rawValue.apply(parent, argumentList);
}
break;
case "CONSTRUCT" /* MessageType.CONSTRUCT */:
{
const value = new rawValue(...argumentList);
returnValue = proxy(value);
}
break;
case "ENDPOINT" /* MessageType.ENDPOINT */:
{
const { port1, port2 } = new MessageChannel();
expose(obj, port2);
returnValue = transfer(port1, [port1]);
}
break;
case "RELEASE" /* MessageType.RELEASE */:
{
returnValue = undefined;
}
break;
default:
return;
}
}
catch (value) {
returnValue = { value, [throwMarker]: 0 };
}
Promise.resolve(returnValue)
.catch((value) => {
return { value, [throwMarker]: 0 };
})
.then((returnValue) => {
const [wireValue, transferables] = toWireValue(returnValue);
ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);
if (type === "RELEASE" /* MessageType.RELEASE */) {
// detach and deactive after sending release response above.
ep.removeEventListener("message", callback);
closeEndPoint(ep);
if (finalizer in obj && typeof obj[finalizer] === "function") {
obj[finalizer]();
}
}
})
.catch((error) => {
// Send Serialization Error To Caller
const [wireValue, transferables] = toWireValue({
value: new TypeError("Unserializable return value"),
[throwMarker]: 0,
});
ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);
});
});
if (ep.start) {
ep.start();
}
}
function isMessagePort(endpoint) {
return endpoint.constructor.name === "MessagePort";
}
function closeEndPoint(endpoint) {
if (isMessagePort(endpoint))
endpoint.close();
}
function wrap(ep, target) {
return createProxy(ep, [], target);
}
function throwIfProxyReleased(isReleased) {
if (isReleased) {
throw new Error("Proxy has been released and is not useable");
}
}
function releaseEndpoint(ep) {
return requestResponseMessage(ep, {
type: "RELEASE" /* MessageType.RELEASE */,
}).then(() => {
closeEndPoint(ep);
});
}
const proxyCounter = new WeakMap();
const proxyFinalizers = "FinalizationRegistry" in globalThis &&
new FinalizationRegistry((ep) => {
const newCount = (proxyCounter.get(ep) || 0) - 1;
proxyCounter.set(ep, newCount);
if (newCount === 0) {
releaseEndpoint(ep);
}
});
function registerProxy(proxy, ep) {
const newCount = (proxyCounter.get(ep) || 0) + 1;
proxyCounter.set(ep, newCount);
if (proxyFinalizers) {
proxyFinalizers.register(proxy, ep, proxy);
}
}
function unregisterProxy(proxy) {
if (proxyFinalizers) {
proxyFinalizers.unregister(proxy);
}
}
function createProxy(ep, path = [], target = function () { }) {
let isProxyReleased = false;
const proxy = new Proxy(target, {
get(_target, prop) {
throwIfProxyReleased(isProxyReleased);
if (prop === releaseProxy) {
return () => {
unregisterProxy(proxy);
releaseEndpoint(ep);
isProxyReleased = true;
};
}
if (prop === "then") {
if (path.length === 0) {
return { then: () => proxy };
}
const r = requestResponseMessage(ep, {
type: "GET" /* MessageType.GET */,
path: path.map((p) => p.toString()),
}).then(fromWireValue);
return r.then.bind(r);
}
return createProxy(ep, [...path, prop]);
},
set(_target, prop, rawValue) {
throwIfProxyReleased(isProxyReleased);
// FIXME: ES6 Proxy Handler `set` methods are supposed to return a
// boolean. To show good will, we return true asynchronously ¯\_(ツ)_/¯
const [value, transferables] = toWireValue(rawValue);
return requestResponseMessage(ep, {
type: "SET" /* MessageType.SET */,
path: [...path, prop].map((p) => p.toString()),
value,
}, transferables).then(fromWireValue);
},
apply(_target, _thisArg, rawArgumentList) {
throwIfProxyReleased(isProxyReleased);
const last = path[path.length - 1];
if (last === createEndpoint) {
return requestResponseMessage(ep, {
type: "ENDPOINT" /* MessageType.ENDPOINT */,
}).then(fromWireValue);
}
// We just pretend that `bind()` didnt happen.
if (last === "bind") {
return createProxy(ep, path.slice(0, -1));
}
const [argumentList, transferables] = processArguments(rawArgumentList);
return requestResponseMessage(ep, {
type: "APPLY" /* MessageType.APPLY */,
path: path.map((p) => p.toString()),
argumentList,
}, transferables).then(fromWireValue);
},
construct(_target, rawArgumentList) {
throwIfProxyReleased(isProxyReleased);
const [argumentList, transferables] = processArguments(rawArgumentList);
return requestResponseMessage(ep, {
type: "CONSTRUCT" /* MessageType.CONSTRUCT */,
path: path.map((p) => p.toString()),
argumentList,
}, transferables).then(fromWireValue);
},
});
registerProxy(proxy, ep);
return proxy;
}
function myFlat(arr) {
return Array.prototype.concat.apply([], arr);
}
function processArguments(argumentList) {
const processed = argumentList.map(toWireValue);
return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];
}
const transferCache = new WeakMap();
function transfer(obj, transfers) {
transferCache.set(obj, transfers);
return obj;
}
function proxy(obj) {
return Object.assign(obj, { [proxyMarker]: true });
}
function windowEndpoint(w, context = globalThis, targetOrigin = "*") {
return {
postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),
addEventListener: context.addEventListener.bind(context),
removeEventListener: context.removeEventListener.bind(context),
};
}
function toWireValue(value) {
for (const [name, handler] of transferHandlers) {
if (handler.canHandle(value)) {
const [serializedValue, transferables] = handler.serialize(value);
return [
{
type: "HANDLER" /* WireValueType.HANDLER */,
name,
value: serializedValue,
},
transferables,
];
}
}
return [
{
type: "RAW" /* WireValueType.RAW */,
value,
},
transferCache.get(value) || [],
];
}
function fromWireValue(value) {
switch (value.type) {
case "HANDLER" /* WireValueType.HANDLER */:
return transferHandlers.get(value.name).deserialize(value.value);
case "RAW" /* WireValueType.RAW */:
return value.value;
}
}
function requestResponseMessage(ep, msg, transfers) {
return new Promise((resolve) => {
const id = generateUUID();
ep.addEventListener("message", function l(ev) {
if (!ev.data || !ev.data.id || ev.data.id !== id) {
return;
}
ep.removeEventListener("message", l);
resolve(ev.data);
});
if (ep.start) {
ep.start();
}
ep.postMessage(Object.assign({ id }, msg), transfers);
});
}
function generateUUID() {
return new Array(4)
.fill(0)
.map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))
.join("-");
}
//# sourceMappingURL=comlink.mjs.map
/***/ })
}]);
//# sourceMappingURL=vendors-node_modules_comlink_dist_esm_comlink_mjs.bundle.js.map

File diff suppressed because one or more lines are too long