@@ -12,9 +12,6 @@ import {
12
12
UnwasmPluginOptions ,
13
13
} from "./shared" ;
14
14
15
- // https://marketplace.visualstudio.com/items?itemName=Tobermory.es6-string-html
16
- const js = String . raw ;
17
-
18
15
/**
19
16
* Returns ESM compatible exports binding
20
17
*/
@@ -27,15 +24,15 @@ export async function getWasmESMBinding(
27
24
28
25
// --- Environment dependent code to initialize the wasm module using inlined base 64 or dynamic import ---
29
26
const envCode : string = opts . esmImport
30
- ? js `
27
+ ? /* js */ `
31
28
${ autoImports . code } ;
32
29
33
30
async function _instantiate(imports = _imports) {
34
31
const _mod = await import("${ UNWASM_EXTERNAL_PREFIX } ${ asset . name } ").then(r => r.default || r);
35
32
return WebAssembly.instantiate(_mod, imports)
36
33
}
37
34
`
38
- : js `
35
+ : /* js */ `
39
36
import { base64ToUint8Array } from "${ UMWASM_HELPERS_ID } ";
40
37
${ autoImports . code } ;
41
38
@@ -51,7 +48,7 @@ function _instantiate(imports = _imports) {
51
48
// eslint-disable-next-line unicorn/prefer-ternary
52
49
if ( canTopAwait ) {
53
50
// -- Non proxied exports when no imports are needed and we can have top-level await ---
54
- return js `
51
+ return /* js */ `
55
52
import { getExports } from "${ UMWASM_HELPERS_ID } ";
56
53
${ envCode }
57
54
@@ -67,7 +64,7 @@ export default defaultExport;
67
64
` ;
68
65
} else {
69
66
// --- Proxied exports when imports are needed or we can't have top-level await ---
70
- return js `
67
+ return /* js */ `
71
68
import { createLazyWasmModule } from "${ UMWASM_HELPERS_ID } ";
72
69
${ envCode }
73
70
@@ -90,11 +87,11 @@ export function getWasmModuleBinding(
90
87
opts : UnwasmPluginOptions ,
91
88
) {
92
89
return opts . esmImport
93
- ? js `
90
+ ? /* js */ `
94
91
const _mod = ${ opts . lazy === true ? "" : `await` } import("${ UNWASM_EXTERNAL_PREFIX } ${ asset . name } ").then(r => r.default || r);
95
92
export default _mod;
96
93
`
97
- : js `
94
+ : /* js */ `
98
95
import { base64ToUint8Array } from "${ UMWASM_HELPERS_ID } ";
99
96
const _data = base64ToUint8Array("${ asset . source . toString ( "base64" ) } ");
100
97
const _mod = new WebAssembly.Module(_data);
@@ -104,7 +101,7 @@ export default _mod;
104
101
105
102
export function getPluginUtils ( ) {
106
103
// --- Shared utils for the generated code ---
107
- return js `
104
+ return /* js */ `
108
105
export function debug(...args) {
109
106
console.log('[wasm] [debug]', ...args);
110
107
}
0 commit comments