2 /* Build a page with its dependencies for ES5 browsers.
3 * ./bundle.js todov.js; cat .todov.js
4 * @license 0BSD 2020 k0tyk <k0tyk@pm.me> */
5 import * as os from "os";
6 import * as std from "std";
21 var out = std.loadFile(`.${scriptArgs[1]}`);
22 std.open(`.${scriptArgs[1]}`, "w").puts(`function System(x) {
23 if (!/^\\.\\//.test(x)) x = "./" + x;
24 if (!/\\.js$/.test(x)) x = x + ".js";
27 System.import = function (x) {
28 var s = System[(x = System(x))];
30 s.d.map(function (y, i) {
31 return s.m.setters[i](System.import(y));
33 return s.m.execute(), s.c++, s.v;
35 System.register = function (x, d, f) {
36 var s = { c: 0, d: d.map(System), m: {}, v: {} };
37 s.m = f(function (k, v) {
40 System[System(x)] = s;
42 ${out.replace(/^#!.*/, "")}`);