MCPcopy Create free account
hub / github.com/csound/csound / inlineWebworker

Function inlineWebworker

wasm/browser/script/inline-webworker.js:45–70  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

43`;
44
45export default function inlineWebworker(options = {}) {
46 const filter = createFilter(options.include, options.exclude);
47 const dataUrl = options.dataUrl;
48 return {
49 name: "inline-webworker",
50 load(id) {
51 if (filter(id)) {
52 const filename = basename(id);
53 id = resolve("./dist", `__compiled.${filename}`);
54 return {
55 code: dataUrl
56 ? `
57 export default () => "data:application/javascript;base64,${readFileSync(id, {
58 encoding: "base64",
59 })}";
60 `
61 : `
62 export default () => (window.URL || window.webkitURL).createObjectURL(new Blob([${JSON.stringify(
63 readFileSync(id).toString("utf8"),
64 )}]));`,
65 map: { mappings: "" },
66 };
67 }
68 },
69 };
70}

Callers 1

compile.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected