Skip to content

Commit adabaa8

Browse files
committed
chore: update inline template highlighting
1 parent bad69a5 commit adabaa8

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/plugin/runtime.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ import {
1212
UnwasmPluginOptions,
1313
} from "./shared";
1414

15-
// https://marketplace.visualstudio.com/items?itemName=Tobermory.es6-string-html
16-
const js = String.raw;
17-
1815
/**
1916
* Returns ESM compatible exports binding
2017
*/
@@ -27,15 +24,15 @@ export async function getWasmESMBinding(
2724

2825
// --- Environment dependent code to initialize the wasm module using inlined base 64 or dynamic import ---
2926
const envCode: string = opts.esmImport
30-
? js`
27+
? /* js */ `
3128
${autoImports.code};
3229
3330
async function _instantiate(imports = _imports) {
3431
const _mod = await import("${UNWASM_EXTERNAL_PREFIX}${asset.name}").then(r => r.default || r);
3532
return WebAssembly.instantiate(_mod, imports)
3633
}
3734
`
38-
: js`
35+
: /* js */ `
3936
import { base64ToUint8Array } from "${UMWASM_HELPERS_ID}";
4037
${autoImports.code};
4138
@@ -51,7 +48,7 @@ function _instantiate(imports = _imports) {
5148
// eslint-disable-next-line unicorn/prefer-ternary
5249
if (canTopAwait) {
5350
// -- Non proxied exports when no imports are needed and we can have top-level await ---
54-
return js`
51+
return /* js */ `
5552
import { getExports } from "${UMWASM_HELPERS_ID}";
5653
${envCode}
5754
@@ -67,7 +64,7 @@ export default defaultExport;
6764
`;
6865
} else {
6966
// --- Proxied exports when imports are needed or we can't have top-level await ---
70-
return js`
67+
return /* js */ `
7168
import { createLazyWasmModule } from "${UMWASM_HELPERS_ID}";
7269
${envCode}
7370
@@ -90,11 +87,11 @@ export function getWasmModuleBinding(
9087
opts: UnwasmPluginOptions,
9188
) {
9289
return opts.esmImport
93-
? js`
90+
? /* js */ `
9491
const _mod = ${opts.lazy === true ? "" : `await`} import("${UNWASM_EXTERNAL_PREFIX}${asset.name}").then(r => r.default || r);
9592
export default _mod;
9693
`
97-
: js`
94+
: /* js */ `
9895
import { base64ToUint8Array } from "${UMWASM_HELPERS_ID}";
9996
const _data = base64ToUint8Array("${asset.source.toString("base64")}");
10097
const _mod = new WebAssembly.Module(_data);
@@ -104,7 +101,7 @@ export default _mod;
104101

105102
export function getPluginUtils() {
106103
// --- Shared utils for the generated code ---
107-
return js`
104+
return /* js */ `
108105
export function debug(...args) {
109106
console.log('[wasm] [debug]', ...args);
110107
}

0 commit comments

Comments
 (0)