| 25 | * @returns {string} - The JSON serialized config. |
| 26 | */ |
| 27 | const normalize = async (config, base) => { |
| 28 | if (typeof config === 'string') { |
| 29 | base = config; |
| 30 | config = await fetch(config).then(res => res.json()); |
| 31 | } |
| 32 | if (typeof config.files === 'object') { |
| 33 | const files = {}; |
| 34 | for (const [key, value] of entries(config.files)) { |
| 35 | files[key.startsWith('{') ? key : new URL(key, base)] = value; |
| 36 | } |
| 37 | config.files = files; |
| 38 | } |
| 39 | return stringify(config); |
| 40 | }; |
| 41 | |
| 42 | // this logic is based on a 3 levels cache ... |
| 43 | const cache = new Map; |