Allow PyScript to fully run locally (#1805)

This commit is contained in:
Andrea Giammarchi
2023-10-20 15:02:05 +02:00
committed by GitHub
parent 88fa82c61a
commit 6dd242f3ce
8 changed files with 113 additions and 70 deletions

View File

@@ -19,6 +19,7 @@ module.exports = {
ecmaVersion: "latest",
sourceType: "module",
},
ignorePatterns: ["toml.js"],
rules: {
"no-implicit-globals": ["error"],
},

View File

@@ -1,24 +1,25 @@
{
"name": "@pyscript/core",
"version": "0.2.8",
"version": "0.2.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@pyscript/core",
"version": "0.2.8",
"version": "0.2.9",
"license": "APACHE-2.0",
"dependencies": {
"@ungap/with-resolvers": "^0.1.0",
"basic-devtools": "^0.1.6",
"polyscript": "^0.4.13",
"polyscript": "^0.4.20",
"type-checked-collections": "^0.1.7"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@webreflection/toml-j0.4": "^1.1.3",
"eslint": "^8.51.0",
"rollup": "^4.0.2",
"rollup": "^4.1.4",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-string": "^3.0.0",
"static-handler": "^0.4.3",
@@ -286,9 +287,9 @@
}
},
"node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.0.2.tgz",
"integrity": "sha512-xDvk1pT4vaPU2BOLy0MqHMdYZyntqpaBf8RhBiezlqG9OjY8F50TyctHo8znigYKd+QCFhCmlmXHOL/LoaOl3w==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.1.4.tgz",
"integrity": "sha512-WlzkuFvpKl6CLFdc3V6ESPt7gq5Vrimd2Yv9IzKXdOpgbH4cdDSS1JLiACX8toygihtH5OlxyQzhXOph7Ovlpw==",
"cpu": [
"arm"
],
@@ -299,9 +300,9 @@
]
},
"node_modules/@rollup/rollup-android-arm64": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.0.2.tgz",
"integrity": "sha512-lqCglytY3E6raze27DD9VQJWohbwCxzqs9aSHcj5X/8hJpzZfNdbsr4Ja9Hqp6iPyF53+5PtPx0pKRlkSvlHZg==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.1.4.tgz",
"integrity": "sha512-D1e+ABe56T9Pq2fD+R3ybe1ylCDzu3tY4Qm2Mj24R9wXNCq35+JbFbOpc2yrroO2/tGhTobmEl2Bm5xfE/n8RA==",
"cpu": [
"arm64"
],
@@ -312,9 +313,9 @@
]
},
"node_modules/@rollup/rollup-darwin-arm64": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.0.2.tgz",
"integrity": "sha512-nkBKItS6E6CCzvRwgiKad+j+1ibmL7SIInj7oqMWmdkCjiSX6VeVZw2mLlRKIUL+JjsBgpATTfo7BiAXc1v0jA==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.1.4.tgz",
"integrity": "sha512-7vTYrgEiOrjxnjsgdPB+4i7EMxbVp7XXtS+50GJYj695xYTTEMn3HZVEvgtwjOUkAP/Q4HDejm4fIAjLeAfhtg==",
"cpu": [
"arm64"
],
@@ -325,9 +326,9 @@
]
},
"node_modules/@rollup/rollup-darwin-x64": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.0.2.tgz",
"integrity": "sha512-vX2C8xvWPIbpEgQht95+dY6BReKAvtDgPDGi0XN0kWJKkm4WdNmq5dnwscv/zxvi+n6jUTBhs6GtpkkWT4q8Gg==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.1.4.tgz",
"integrity": "sha512-eGJVZScKSLZkYjhTAESCtbyTBq9SXeW9+TX36ki5gVhDqJtnQ5k0f9F44jNK5RhAMgIj0Ht9+n6HAgH0gUUyWQ==",
"cpu": [
"x64"
],
@@ -338,9 +339,9 @@
]
},
"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.0.2.tgz",
"integrity": "sha512-DVFIfcHOjgmeHOAqji4xNz2wczt1Bmzy9MwBZKBa83SjBVO/i38VHDR+9ixo8QpBOiEagmNw12DucG+v55tCrg==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.1.4.tgz",
"integrity": "sha512-HnigYSEg2hOdX1meROecbk++z1nVJDpEofw9V2oWKqOWzTJlJf1UXVbDE6Hg30CapJxZu5ga4fdAQc/gODDkKg==",
"cpu": [
"arm"
],
@@ -351,9 +352,9 @@
]
},
"node_modules/@rollup/rollup-linux-arm64-gnu": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.0.2.tgz",
"integrity": "sha512-GCK/a9ItUxPI0V5hQEJjH4JtOJO90GF2Hja7TO+EZ8rmkGvEi8/ZDMhXmcuDpQT7/PWrTT9RvnG8snMd5SrhBQ==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.1.4.tgz",
"integrity": "sha512-TzJ+N2EoTLWkaClV2CUhBlj6ljXofaYzF/R9HXqQ3JCMnCHQZmQnbnZllw7yTDp0OG5whP4gIPozR4QiX+00MQ==",
"cpu": [
"arm64"
],
@@ -364,9 +365,9 @@
]
},
"node_modules/@rollup/rollup-linux-arm64-musl": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.0.2.tgz",
"integrity": "sha512-cLuBp7rOjIB1R2j/VazjCmHC7liWUur2e9mFflLJBAWCkrZ+X0+QwHLvOQakIwDymungzAKv6W9kHZnTp/Mqrg==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.1.4.tgz",
"integrity": "sha512-aVPmNMdp6Dlo2tWkAduAD/5TL/NT5uor290YvjvFvCv0Q3L7tVdlD8MOGDL+oRSw5XKXKAsDzHhUOPUNPRHVTQ==",
"cpu": [
"arm64"
],
@@ -377,9 +378,9 @@
]
},
"node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.0.2.tgz",
"integrity": "sha512-Zqw4iVnJr2naoyQus0yLy7sLtisCQcpdMKUCeXPBjkJtpiflRime/TMojbnl8O3oxUAj92mxr+t7im/RbgA20w==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.1.4.tgz",
"integrity": "sha512-77Fb79ayiDad0grvVsz4/OB55wJRyw9Ao+GdOBA9XywtHpuq5iRbVyHToGxWquYWlEf6WHFQQnFEttsAzboyKg==",
"cpu": [
"x64"
],
@@ -390,9 +391,9 @@
]
},
"node_modules/@rollup/rollup-linux-x64-musl": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.0.2.tgz",
"integrity": "sha512-jJRU9TyUD/iMqjf8aLAp7XiN3pIj5v6Qcu+cdzBfVTKDD0Fvua4oUoK8eVJ9ZuKBEQKt3WdlcwJXFkpmMLk6kg==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.1.4.tgz",
"integrity": "sha512-/t6C6niEQTqmQTVTD9TDwUzxG91Mlk69/v0qodIPUnjjB3wR4UA3klg+orR2SU3Ux2Cgf2pWPL9utK80/1ek8g==",
"cpu": [
"x64"
],
@@ -403,9 +404,9 @@
]
},
"node_modules/@rollup/rollup-win32-arm64-msvc": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.0.2.tgz",
"integrity": "sha512-ZkS2NixCxHKC4zbOnw64ztEGGDVIYP6nKkGBfOAxEPW71Sji9v8z3yaHNuae/JHPwXA+14oDefnOuVfxl59SmQ==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.1.4.tgz",
"integrity": "sha512-ZY5BHHrOPkMbCuGWFNpJH0t18D2LU6GMYKGaqaWTQ3CQOL57Fem4zE941/Ek5pIsVt70HyDXssVEFQXlITI5Gg==",
"cpu": [
"arm64"
],
@@ -416,9 +417,9 @@
]
},
"node_modules/@rollup/rollup-win32-ia32-msvc": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.0.2.tgz",
"integrity": "sha512-3SKjj+tvnZ0oZq2BKB+fI+DqYI83VrRzk7eed8tJkxeZ4zxJZcLSE8YDQLYGq1tZAnAX+H076RHHB4gTZXsQzw==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.1.4.tgz",
"integrity": "sha512-XG2mcRfFrJvYyYaQmvCIvgfkaGinfXrpkBuIbJrTl9SaIQ8HumheWTIwkNz2mktCKwZfXHQNpO7RgXLIGQ7HXA==",
"cpu": [
"ia32"
],
@@ -429,9 +430,9 @@
]
},
"node_modules/@rollup/rollup-win32-x64-msvc": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.0.2.tgz",
"integrity": "sha512-MBdJIOxRauKkry7t2q+rTHa3aWjVez2eioWg+etRVS3dE4tChhmt5oqZYr48R6bPmcwEhxQr96gVRfeQrLbqng==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.1.4.tgz",
"integrity": "sha512-ANFqWYPwkhIqPmXw8vm0GpBEHiPpqcm99jiiAp71DbCSqLDhrtr019C5vhD0Bw4My+LmMvciZq6IsWHqQpl2ZQ==",
"cpu": [
"x64"
],
@@ -472,6 +473,12 @@
"resolved": "https://registry.npmjs.org/@ungap/with-resolvers/-/with-resolvers-0.1.0.tgz",
"integrity": "sha512-g7f0IkJdPW2xhY7H4iE72DAsIyfuwEFc6JWc2tYFwKDMWWAF699vGjrM348cwQuOXgHpe1gWFe+Eiyjx/ewvvw=="
},
"node_modules/@webreflection/toml-j0.4": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@webreflection/toml-j0.4/-/toml-j0.4-1.1.3.tgz",
"integrity": "sha512-ragv0U1Hy9JTyFpUqApu/UwF4Qhn0Y5GnQR4Bmy/+wYLKbHNS6hLN6bJR44v5DumaocJ4vpF6HVtYWeDJVs3qg==",
"dev": true
},
"node_modules/acorn": {
"version": "8.10.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz",
@@ -682,9 +689,9 @@
}
},
"node_modules/coincident": {
"version": "0.13.5",
"resolved": "https://registry.npmjs.org/coincident/-/coincident-0.13.5.tgz",
"integrity": "sha512-ujm9XQ8JS6MXarwFc1ZJ+lM9N5pvV/Pt+vdLe9m9SyUm1pgmIdLDzTh51zxXWL6jVl0uPIfLjCdBV0jSbcB5LA==",
"version": "0.13.10",
"resolved": "https://registry.npmjs.org/coincident/-/coincident-0.13.10.tgz",
"integrity": "sha512-gzSTDRMMVvo40+zj7sRUFMsc5Fpu865qn4gf/FUAaukBal+c2lxvnTigT7HSZLGPYEj6Sm5vPDTik31Uqei3qg==",
"dependencies": {
"@ungap/structured-clone": "^1.2.0",
"@ungap/with-resolvers": "^0.1.0"
@@ -1929,16 +1936,17 @@
"integrity": "sha512-yyVAOFKTAElc7KdLt2+UKGExNYwYb/Y/WE9i+1ezCQsJE8gbKSjewfpRqK2nQgZ4d4hhAAGgDCOcIZVilqE5UA=="
},
"node_modules/polyscript": {
"version": "0.4.13",
"resolved": "https://registry.npmjs.org/polyscript/-/polyscript-0.4.13.tgz",
"integrity": "sha512-vGlTk4MthM3bVxR5MLhdcBNl/4P5eCocwWwCct+1UmVrhJuY+npYm6Wem9+iENLBVsBLH8KVShbGAO8eRM6h2A==",
"version": "0.4.20",
"resolved": "https://registry.npmjs.org/polyscript/-/polyscript-0.4.20.tgz",
"integrity": "sha512-MNpZQPcJ0047Gq/SXZTw8H929nMKcc3dqxbegd42remBJ0y2UwrKXiE0NMhlO85cbxLrV+sGD2ZCt8+/2m55EQ==",
"dependencies": {
"@ungap/structured-clone": "^1.2.0",
"@ungap/with-resolvers": "^0.1.0",
"basic-devtools": "^0.1.6",
"codedent": "^0.1.2",
"coincident": "^0.13.5",
"html-escaper": "^3.0.3"
"coincident": "^0.13.10",
"html-escaper": "^3.0.3",
"sticky-module": "^0.1.0"
}
},
"node_modules/postcss": {
@@ -2609,9 +2617,9 @@
}
},
"node_modules/rollup": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.0.2.tgz",
"integrity": "sha512-MCScu4usMPCeVFaiLcgMDaBQeYi1z6vpWxz0r0hq0Hv77Y2YuOTZldkuNJ54BdYBH3e+nkrk6j0Rre/NLDBYzg==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.1.4.tgz",
"integrity": "sha512-U8Yk1lQRKqCkDBip/pMYT+IKaN7b7UesK3fLSTuHBoBJacCE+oBqo/dfG/gkUdQNNB2OBmRP98cn2C2bkYZkyw==",
"dev": true,
"bin": {
"rollup": "dist/bin/rollup"
@@ -2621,18 +2629,18 @@
"npm": ">=8.0.0"
},
"optionalDependencies": {
"@rollup/rollup-android-arm-eabi": "4.0.2",
"@rollup/rollup-android-arm64": "4.0.2",
"@rollup/rollup-darwin-arm64": "4.0.2",
"@rollup/rollup-darwin-x64": "4.0.2",
"@rollup/rollup-linux-arm-gnueabihf": "4.0.2",
"@rollup/rollup-linux-arm64-gnu": "4.0.2",
"@rollup/rollup-linux-arm64-musl": "4.0.2",
"@rollup/rollup-linux-x64-gnu": "4.0.2",
"@rollup/rollup-linux-x64-musl": "4.0.2",
"@rollup/rollup-win32-arm64-msvc": "4.0.2",
"@rollup/rollup-win32-ia32-msvc": "4.0.2",
"@rollup/rollup-win32-x64-msvc": "4.0.2",
"@rollup/rollup-android-arm-eabi": "4.1.4",
"@rollup/rollup-android-arm64": "4.1.4",
"@rollup/rollup-darwin-arm64": "4.1.4",
"@rollup/rollup-darwin-x64": "4.1.4",
"@rollup/rollup-linux-arm-gnueabihf": "4.1.4",
"@rollup/rollup-linux-arm64-gnu": "4.1.4",
"@rollup/rollup-linux-arm64-musl": "4.1.4",
"@rollup/rollup-linux-x64-gnu": "4.1.4",
"@rollup/rollup-linux-x64-musl": "4.1.4",
"@rollup/rollup-win32-arm64-msvc": "4.1.4",
"@rollup/rollup-win32-ia32-msvc": "4.1.4",
"@rollup/rollup-win32-x64-msvc": "4.1.4",
"fsevents": "~2.3.2"
}
},
@@ -2823,6 +2831,11 @@
"node": ">=16"
}
},
"node_modules/sticky-module": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/sticky-module/-/sticky-module-0.1.0.tgz",
"integrity": "sha512-MYmkk/ihfpzQjOPfxbqScT2JS72H/8ueUtnBxxZiJbHopmJ1Lw62Lq/IimL34czVf1oQoG0Be/TDtJUyNVdEvA=="
},
"node_modules/string-hash": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/string-hash/-/string-hash-1.1.3.tgz",

View File

@@ -1,6 +1,6 @@
{
"name": "@pyscript/core",
"version": "0.2.8",
"version": "0.2.9",
"type": "module",
"description": "PyScript",
"module": "./index.js",
@@ -20,7 +20,7 @@
},
"scripts": {
"server": "npx static-handler --coi .",
"build": "node rollup/stdlib.cjs && node rollup/plugins.cjs && rm -rf dist && rollup --config rollup/core.config.js && eslint src/ && npm run ts",
"build": "node rollup/toml.cjs && node rollup/stdlib.cjs && node rollup/plugins.cjs && rm -rf dist && rollup --config rollup/core.config.js && eslint src/ && npm run ts",
"size": "echo -e \"\\033[1mdist/*.js file size\\033[0m\"; for js in $(ls dist/*.js); do echo -e \"\\033[2m$js:\\033[0m $(cat $js | brotli | wc -c) bytes\"; done",
"ts": "tsc -p ."
},
@@ -33,14 +33,15 @@
"dependencies": {
"@ungap/with-resolvers": "^0.1.0",
"basic-devtools": "^0.1.6",
"polyscript": "^0.4.13",
"polyscript": "^0.4.20",
"type-checked-collections": "^0.1.7"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@webreflection/toml-j0.4": "^1.1.3",
"eslint": "^8.51.0",
"rollup": "^4.0.2",
"rollup": "^4.1.4",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-string": "^3.0.0",
"static-handler": "^0.4.3",

View File

@@ -0,0 +1,14 @@
const { copyFileSync } = require("node:fs");
const { join } = require("node:path");
copyFileSync(
join(
__dirname,
"..",
"node_modules",
"@webreflection",
"toml-j0.4",
"toml.js",
),
join(__dirname, "..", "src", "toml.js"),
);

View File

@@ -89,8 +89,7 @@ for (const [TYPE] of TYPES) {
} else if (toml || type === "toml") {
try {
const { parse } = await import(
/* webpackIgnore: true */
"https://cdn.jsdelivr.net/npm/@webreflection/toml-j0.4/toml.js"
/* webpackIgnore: true */ "./toml.js"
);
parsed = parse(text);
} catch (e) {

File diff suppressed because one or more lines are too long

12
pyscript.core/types/toml.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
/*! (c) Jak Wings - MIT */ declare class e extends SyntaxError {
constructor(r: any, { offset: t, line: e, column: n }: {
offset: any;
line: any;
column: any;
});
offset: any;
line: any;
column: any;
}
declare function n(n: any): any;
export { e as SyntaxError, n as parse };