mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 10:47:35 -05:00
committed by
GitHub
parent
1efd73af8f
commit
7ad7f0abfb
@@ -63,6 +63,9 @@ for (const [TYPE] of TYPES) {
|
||||
/** @type {Error | undefined} The error thrown when parsing the PyScript config, if any.*/
|
||||
let error;
|
||||
|
||||
/** @type {string | undefined} The `configURL` field to normalize all config operations as opposite of guessing it once resolved */
|
||||
let configURL;
|
||||
|
||||
let config,
|
||||
type,
|
||||
pyElement,
|
||||
@@ -105,6 +108,7 @@ for (const [TYPE] of TYPES) {
|
||||
if (!error && config) {
|
||||
try {
|
||||
const { json, toml, text, url } = await configDetails(config, type);
|
||||
if (url) configURL = new URL(url, location.href).href;
|
||||
config = text;
|
||||
if (json || type === "json") {
|
||||
try {
|
||||
@@ -146,7 +150,7 @@ for (const [TYPE] of TYPES) {
|
||||
// assign plugins as Promise.all only if needed
|
||||
plugins = Promise.all(toBeAwaited);
|
||||
|
||||
configs.set(TYPE, { config: parsed, plugins, error });
|
||||
configs.set(TYPE, { config: parsed, configURL, plugins, error });
|
||||
}
|
||||
|
||||
export default configs;
|
||||
|
||||
@@ -64,7 +64,7 @@ for (const [TYPE, interpreter] of TYPES) {
|
||||
else dispatch(element, TYPE, "done");
|
||||
};
|
||||
|
||||
const { config, plugins, error } = configs.get(TYPE);
|
||||
const { config, configURL, plugins, error } = configs.get(TYPE);
|
||||
|
||||
// create a unique identifier when/if needed
|
||||
let id = 0;
|
||||
@@ -259,6 +259,7 @@ for (const [TYPE, interpreter] of TYPES) {
|
||||
|
||||
define(TYPE, {
|
||||
config,
|
||||
configURL,
|
||||
interpreter,
|
||||
hooks,
|
||||
env: `${TYPE}-script`,
|
||||
|
||||
Reference in New Issue
Block a user