feat: refactoring project
This commit is contained in:
12
node_modules/webpack/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js
generated
vendored
12
node_modules/webpack/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js
generated
vendored
@@ -44,7 +44,7 @@ class AsyncWasmLoadingRuntimeModule extends RuntimeModule {
|
||||
`" + ${RuntimeGlobals.getFullHash}}().slice(0, ${length}) + "`,
|
||||
module: {
|
||||
id: '" + wasmModuleId + "',
|
||||
hash: `" + wasmModuleHash + "`,
|
||||
hash: '" + wasmModuleHash + "',
|
||||
hashWithLength(length) {
|
||||
return `" + wasmModuleHash.slice(0, ${length}) + "`;
|
||||
}
|
||||
@@ -75,18 +75,18 @@ class AsyncWasmLoadingRuntimeModule extends RuntimeModule {
|
||||
concat(
|
||||
"return req.then(",
|
||||
runtimeTemplate.basicFunction("res", [
|
||||
`if (typeof WebAssembly.instantiateStreaming === "function") {`,
|
||||
'if (typeof WebAssembly.instantiateStreaming === "function") {',
|
||||
Template.indent([
|
||||
"return WebAssembly.instantiateStreaming(res, importsObj)",
|
||||
Template.indent([
|
||||
".then(",
|
||||
Template.indent([
|
||||
runtimeTemplate.returningFunction(
|
||||
`${runtimeTemplate.returningFunction(
|
||||
"Object.assign(exports, res.instance.exports)",
|
||||
"res"
|
||||
) + ",",
|
||||
)},`,
|
||||
runtimeTemplate.basicFunction("e", [
|
||||
`if(res.headers.get("Content-Type") !== "application/wasm") {`,
|
||||
'if(res.headers.get("Content-Type") !== "application/wasm") {',
|
||||
Template.indent([
|
||||
'console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n", e);',
|
||||
"return fallback();"
|
||||
@@ -110,7 +110,7 @@ class AsyncWasmLoadingRuntimeModule extends RuntimeModule {
|
||||
"exports, wasmModuleId, wasmModuleHash, importsObj",
|
||||
this.supportsStreaming
|
||||
? getStreaming()
|
||||
: [`return ${loader}`, Template.indent(fallback) + ";"]
|
||||
: [`return ${loader}`, `${Template.indent(fallback)};`]
|
||||
)};`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user