mirror of
https://github.com/pyscript/pyscript.git
synced 2026-05-20 12:00:18 -04:00
[next] Fix regressions around config (#1720)
This commit is contained in:
committed by
GitHub
parent
c330a623b2
commit
19214901f9
20
pyscript.core/package-lock.json
generated
20
pyscript.core/package-lock.json
generated
@@ -1,22 +1,22 @@
|
||||
{
|
||||
"name": "@pyscript/core",
|
||||
"version": "0.1.19",
|
||||
"version": "0.1.21",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@pyscript/core",
|
||||
"version": "0.1.19",
|
||||
"version": "0.1.21",
|
||||
"license": "APACHE-2.0",
|
||||
"dependencies": {
|
||||
"@ungap/with-resolvers": "^0.1.0",
|
||||
"basic-devtools": "^0.1.6",
|
||||
"polyscript": "^0.3.6"
|
||||
"polyscript": "^0.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-node-resolve": "^15.2.1",
|
||||
"@rollup/plugin-terser": "^0.4.3",
|
||||
"rollup": "^3.29.1",
|
||||
"rollup": "^3.29.2",
|
||||
"rollup-plugin-postcss": "^4.0.2",
|
||||
"rollup-plugin-string": "^3.0.0",
|
||||
"static-handler": "^0.4.2",
|
||||
@@ -948,9 +948,9 @@
|
||||
"integrity": "sha512-yyVAOFKTAElc7KdLt2+UKGExNYwYb/Y/WE9i+1ezCQsJE8gbKSjewfpRqK2nQgZ4d4hhAAGgDCOcIZVilqE5UA=="
|
||||
},
|
||||
"node_modules/polyscript": {
|
||||
"version": "0.3.6",
|
||||
"resolved": "https://registry.npmjs.org/polyscript/-/polyscript-0.3.6.tgz",
|
||||
"integrity": "sha512-g5xUYASdftAIzfdr7jIK3zSI5GaePkTaaFjJfApoCpOYOGWkAdAEcb9IKHGlOrhLADkPoQ9YS6YLM9X7h9Z+AQ==",
|
||||
"version": "0.3.8",
|
||||
"resolved": "https://registry.npmjs.org/polyscript/-/polyscript-0.3.8.tgz",
|
||||
"integrity": "sha512-LXf1WQxhXiCud4VFCl4TUNFqTHghhpUYxSAAlCdb5XbxQs+0HSaC+1PuyrfsKDEM0WSZXa3xCH1LOxQl2aHDbg==",
|
||||
"dependencies": {
|
||||
"@ungap/structured-clone": "^1.2.0",
|
||||
"@ungap/with-resolvers": "^0.1.0",
|
||||
@@ -1564,9 +1564,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "3.29.1",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.1.tgz",
|
||||
"integrity": "sha512-c+ebvQz0VIH4KhhCpDsI+Bik0eT8ZFEVZEYw0cGMVqIP8zc+gnwl7iXCamTw7vzv2MeuZFZfdx5JJIq+ehzDlg==",
|
||||
"version": "3.29.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.2.tgz",
|
||||
"integrity": "sha512-CJouHoZ27v6siztc21eEQGo0kIcE5D1gVPA571ez0mMYb25LGYGKnVNXpEj5MGlepmDWGXNjDB5q7uNiPHC11A==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pyscript/core",
|
||||
"version": "0.1.19",
|
||||
"version": "0.1.21",
|
||||
"type": "module",
|
||||
"description": "PyScript",
|
||||
"module": "./index.js",
|
||||
@@ -33,12 +33,12 @@
|
||||
"dependencies": {
|
||||
"@ungap/with-resolvers": "^0.1.0",
|
||||
"basic-devtools": "^0.1.6",
|
||||
"polyscript": "^0.3.6"
|
||||
"polyscript": "^0.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-node-resolve": "^15.2.1",
|
||||
"@rollup/plugin-terser": "^0.4.3",
|
||||
"rollup": "^3.29.1",
|
||||
"rollup": "^3.29.2",
|
||||
"rollup-plugin-postcss": "^4.0.2",
|
||||
"rollup-plugin-string": "^3.0.0",
|
||||
"static-handler": "^0.4.2",
|
||||
|
||||
@@ -48,36 +48,44 @@ const syntaxError = (type, url, { message }) => {
|
||||
// find the shared config for all py-script elements
|
||||
let config, plugins, parsed, error, type;
|
||||
let pyConfig = $("py-config");
|
||||
if (pyConfig) config = pyConfig.getAttribute("src") || pyConfig.textContent;
|
||||
else {
|
||||
pyConfig = $('script[type="py"][config]');
|
||||
if (pyConfig) {
|
||||
config = pyConfig.getAttribute("src") || pyConfig.textContent;
|
||||
type = pyConfig.getAttribute("type");
|
||||
} else {
|
||||
pyConfig = $(
|
||||
[
|
||||
'script[type="py"][config]:not([worker])',
|
||||
"py-script[config]:not([worker])",
|
||||
].join(","),
|
||||
);
|
||||
if (pyConfig) config = pyConfig.getAttribute("config");
|
||||
}
|
||||
if (pyConfig) type = pyConfig.getAttribute("type");
|
||||
|
||||
// catch possible fetch errors
|
||||
try {
|
||||
const { json, toml, text, url } = await configDetails(config);
|
||||
config = text;
|
||||
if (json || type === "json") {
|
||||
try {
|
||||
parsed = JSON.parse(text);
|
||||
} catch (e) {
|
||||
error = syntaxError("JSON", url, e);
|
||||
}
|
||||
} else if (toml || type === "toml") {
|
||||
try {
|
||||
const { parse } = await import(
|
||||
/* webpackIgnore: true */
|
||||
"https://cdn.jsdelivr.net/npm/@webreflection/toml-j0.4/toml.js"
|
||||
);
|
||||
parsed = parse(text);
|
||||
} catch (e) {
|
||||
error = syntaxError("TOML", url, e);
|
||||
if (config) {
|
||||
try {
|
||||
const { json, toml, text, url } = await configDetails(config);
|
||||
config = text;
|
||||
if (json || type === "json") {
|
||||
try {
|
||||
parsed = JSON.parse(text);
|
||||
} catch (e) {
|
||||
error = syntaxError("JSON", url, e);
|
||||
}
|
||||
} else if (toml || type === "toml") {
|
||||
try {
|
||||
const { parse } = await import(
|
||||
/* webpackIgnore: true */
|
||||
"https://cdn.jsdelivr.net/npm/@webreflection/toml-j0.4/toml.js"
|
||||
);
|
||||
parsed = parse(text);
|
||||
} catch (e) {
|
||||
error = syntaxError("TOML", url, e);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
// parse all plugins and optionally ignore only
|
||||
|
||||
Reference in New Issue
Block a user