2019-01-21 14:03:30 -05:00
|
|
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2018-10-11 17:23:13 -04:00
|
|
|
import * as path from "path";
|
|
|
|
import { main as buildRuntimeLib } from "./build_library";
|
|
|
|
|
|
|
|
// this is very simplistic argument parsing, just enough to integrate into
|
|
|
|
// the build scripts, versus being very robust
|
|
|
|
let basePath = process.cwd();
|
2019-03-30 14:45:36 -04:00
|
|
|
let buildPath = path.join(basePath, "target", "debug");
|
2018-10-11 17:23:13 -04:00
|
|
|
let outFile = path.join(buildPath, "gen", "lib", "lib.d.ts");
|
2019-02-05 08:12:58 -05:00
|
|
|
let inline: string[] = [];
|
2018-10-11 17:23:13 -04:00
|
|
|
let debug = false;
|
|
|
|
let silent = false;
|
|
|
|
|
|
|
|
process.argv.forEach((arg, i, argv) => {
|
|
|
|
switch (arg) {
|
|
|
|
case "--basePath":
|
|
|
|
basePath = path.resolve(argv[i + 1]);
|
|
|
|
break;
|
|
|
|
case "--buildPath":
|
|
|
|
buildPath = path.resolve(argv[i + 1]);
|
|
|
|
break;
|
2019-02-05 08:12:58 -05:00
|
|
|
case "--inline":
|
|
|
|
inline = argv[i + 1].split(",").map(filename => {
|
|
|
|
return path.resolve(filename);
|
|
|
|
});
|
|
|
|
break;
|
2018-10-11 17:23:13 -04:00
|
|
|
case "--outFile":
|
|
|
|
outFile = path.resolve(argv[i + 1]);
|
|
|
|
break;
|
|
|
|
case "--debug":
|
|
|
|
debug = true;
|
|
|
|
break;
|
|
|
|
case "--silent":
|
|
|
|
silent = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
buildRuntimeLib({
|
|
|
|
basePath,
|
|
|
|
buildPath,
|
|
|
|
debug,
|
2019-02-05 08:12:58 -05:00
|
|
|
inline,
|
2019-03-07 08:53:56 -05:00
|
|
|
inputs: [
|
|
|
|
"node_modules/typescript/lib/lib.esnext.d.ts",
|
|
|
|
"js/deno.ts",
|
|
|
|
"js/globals.ts"
|
|
|
|
],
|
2019-04-01 15:09:59 -04:00
|
|
|
declareAsLet: ["onmessage"],
|
2018-10-11 17:23:13 -04:00
|
|
|
outFile,
|
|
|
|
silent
|
|
|
|
});
|