Wait for plugins before defining the custom type (#1788)

This commit is contained in:
Andrea Giammarchi
2023-10-05 13:54:55 +02:00
committed by GitHub
parent b4503ef729
commit d5b6935c0b
2 changed files with 149 additions and 149 deletions

View File

@@ -50,7 +50,7 @@ const syntaxError = (type, url, { message }) => {
const configs = new Map();
for (const [TYPE] of TYPES) {
/** @type {Promise<any> | undefined} A Promise wrapping any plugins which should be loaded. */
/** @type {Promise<[...any]>} A Promise wrapping any plugins which should be loaded. */
let plugins;
/** @type {any} The PyScript configuration parsed from the JSON or TOML object*. May be any of the return types of JSON.parse() or toml-j0.4's parse() ( {number | string | boolean | null | object | Array} ) */
@@ -119,7 +119,7 @@ for (const [TYPE] of TYPES) {
}
// assign plugins as Promise.all only if needed
if (toBeAwaited.length) plugins = Promise.all(toBeAwaited);
plugins = Promise.all(toBeAwaited);
configs.set(TYPE, { config: parsed, plugins, error });
}