mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-21 03:05:38 -05:00
Use Promise.all to fetch files part of py-config (#1322)
This is a first step towards loading more stuff simultaneously rather than sequentially. The functional part of this is pretty small: call `calculateFetchPaths` and then `Promise.all(fetchPaths.map(loadFileFromURL));`. I also transposed the return type of `calculateFetchPaths` since it's more convenient to consume this way. I redid the logic in `calculateFetchPaths` a bit. I renamed `src/plugins/fetch.ts` to `calculateFetchPaths.ts` since the file performs no fetching. I also renamed `loadFromFile` to `loadFileFromURL`.
This commit is contained in:
@@ -80,7 +80,7 @@ export function joinPaths(parts: string[], separator = '/') {
|
||||
.map(function (part) {
|
||||
return part.trim().replace(/(^[/]*|[/]*$)/g, '');
|
||||
})
|
||||
.filter(p => p !== '')
|
||||
.filter(p => p !== '' && p !== '.')
|
||||
.join(separator || '/');
|
||||
if (parts[0].startsWith('/')) {
|
||||
return '/' + res;
|
||||
|
||||
Reference in New Issue
Block a user