wasm-bindgen-rayon and new OMT plugin (#1007)

* WIP: wasm-bindgen-rayon and new OMT plugin

* Bump package-lock

* Make OMT work again

* Update year

* Restore accidental change

* Prevent minification of `nextDefineUri`

* Delay loading external deps

This gives inline `define` calls a chance to define dependencies for earlier `define` calls on the same page.

* Add comment
This commit is contained in:
Ingvar Stepanyan
2021-05-13 13:50:31 +01:00
committed by GitHub
parent ff9dea465f
commit b9b6e57581
24 changed files with 441 additions and 308 deletions

View File

@@ -137,10 +137,24 @@ export default function (inputOptions, outputOptions, resolveFileUrl) {
const dependencies = getDependencies(clientOutput, clientEntry);
if (property.startsWith(allSrcPlaceholder)) {
const depCodes = dependencies.map(
(name) => clientOutput.find((item) => item.fileName === name).code,
);
return JSON.stringify([clientEntry.code, ...depCodes].join(';'));
const allModules = [
clientEntry,
...dependencies.map((name) =>
clientOutput.find((item) => item.fileName === name),
),
];
const inlineDefines = [
...allModules.map(
(item) =>
`self.nextDefineUri=location.origin+${resolveFileUrl(item)};${
item.code
}`,
),
'self.nextDefineUri=""',
];
return JSON.stringify(inlineDefines.join(''));
}
return (