forked from WebReflection/uhtml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpony.js
31 lines (26 loc) · 1.08 KB
/
pony.js
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
26
27
28
29
30
31
import {readFileSync, writeFileSync} from 'fs';
const dropIE = s => s.replace(/^import\s+.+/mg, '').replace(/^export\s+/mg, '');
const createContent = readFileSync('./node_modules/@ungap/create-content/esm/index.js').toString();
const uwire = readFileSync('./node_modules/uwire/esm/index.js').toString();
const uhandlers = readFileSync('./node_modules/uhandlers/esm/index.js').toString();
const init = readFileSync('./esm/init.js').toString();
const node = readFileSync('./esm/node.js').toString();
const handlers = readFileSync('./esm/handlers.js').toString();
const rabbit = readFileSync('./esm/rabbit.js').toString();
const index = readFileSync('./esm/index.js').toString();
const outcome = [
createContent.replace(/^export\s+.*/mg, ''),
dropIE(uwire),
dropIE(uhandlers),
dropIE(node).replace(/^\{.+?\};/mg, ''),
dropIE(handlers),
dropIE(rabbit),
dropIE(index).replace(/\bcache\b/g, '_cache').replace(/^\{/m, 'return {')
];
writeFileSync(
'./esm/init.js',
init.replace(
/\/\*\*start\*\*\/[\s\S]*?\/\*\*end\*\*\//,
`/**start**/\n${outcome.join('\n')}\n/**end**/`
)
);