-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (18 loc) · 686 Bytes
/
index.js
File metadata and controls
25 lines (18 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import paintWorkletURL from './paint-worklet.js?url';
if (typeof window !== 'undefined') {
const worker = new Worker(new URL('./worker.js', import.meta.url));
worker.postMessage({ type: 'init' });
CSS.paintWorklet.addModule(paintWorkletURL);
}
export async function prerender() {
return `<h1>Simple Test Result</h1>`;
}
// Basically mirror preact-www's repl worker
const PREPEND = `(function (module, exports) {\n`;
const APPEND = `\n});`;
export async function process() {
const code = `console.log('Hello World');`;
let transpiled = `${PREPEND}${code}${APPEND}`;
transpiled += '\n//# sourceMappingURL=' + 'some-url.js.map';
return transpiled;
}