Refactor snapshot build (#2825)

Instead of using core/snapshot_creator.rs, instead two crates are
introduced which allow building the snapshot during build.rs.

Rollup is removed and replaced with our own bundler. This removes
the Node build dependency. Modules in //js now use Deno-style imports
with file extensions, rather than Node style extensionless imports.

This improves incremental build time when changes are made to //js files
by about 40 seconds.
This commit is contained in:
Ryan Dahl 2019-09-02 17:07:11 -04:00 committed by GitHub
parent 56508f113d
commit d43b43ca78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
110 changed files with 1548 additions and 1043 deletions

View file

@ -1,8 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
// Public deno module.
export { noColor, pid, env, exit, isTTY, execPath, homeDir } from "./os";
export { chdir, cwd } from "./dir";
export { env, exit, isTTY, execPath, homeDir } from "./os.ts";
export { chdir, cwd } from "./dir.ts";
export {
File,
open,
@ -18,7 +18,7 @@ export {
seekSync,
close,
OpenMode
} from "./files";
} from "./files.ts";
export {
EOF,
copy,
@ -37,40 +37,46 @@ export {
WriteSeeker,
ReadWriteCloser,
ReadWriteSeeker
} from "./io";
export { Buffer, readAll, readAllSync, writeAll, writeAllSync } from "./buffer";
export { mkdirSync, mkdir } from "./mkdir";
} from "./io.ts";
export {
Buffer,
readAll,
readAllSync,
writeAll,
writeAllSync
} from "./buffer.ts";
export { mkdirSync, mkdir } from "./mkdir.ts";
export {
makeTempDirSync,
makeTempDir,
MakeTempDirOptions
} from "./make_temp_dir";
export { chmodSync, chmod } from "./chmod";
export { chownSync, chown } from "./chown";
export { utimeSync, utime } from "./utime";
export { removeSync, remove, RemoveOption } from "./remove";
export { renameSync, rename } from "./rename";
export { readFileSync, readFile } from "./read_file";
export { readDirSync, readDir } from "./read_dir";
export { copyFileSync, copyFile } from "./copy_file";
export { readlinkSync, readlink } from "./read_link";
export { statSync, lstatSync, stat, lstat } from "./stat";
export { linkSync, link } from "./link";
export { symlinkSync, symlink } from "./symlink";
export { writeFileSync, writeFile, WriteFileOptions } from "./write_file";
export { applySourceMap } from "./error_stack";
export { ErrorKind, DenoError } from "./errors";
} from "./make_temp_dir.ts";
export { chmodSync, chmod } from "./chmod.ts";
export { chownSync, chown } from "./chown.ts";
export { utimeSync, utime } from "./utime.ts";
export { removeSync, remove, RemoveOption } from "./remove.ts";
export { renameSync, rename } from "./rename.ts";
export { readFileSync, readFile } from "./read_file.ts";
export { readDirSync, readDir } from "./read_dir.ts";
export { copyFileSync, copyFile } from "./copy_file.ts";
export { readlinkSync, readlink } from "./read_link.ts";
export { statSync, lstatSync, stat, lstat } from "./stat.ts";
export { linkSync, link } from "./link.ts";
export { symlinkSync, symlink } from "./symlink.ts";
export { writeFileSync, writeFile, WriteFileOptions } from "./write_file.ts";
export { applySourceMap } from "./error_stack.ts";
export { ErrorKind, DenoError } from "./errors.ts";
export {
permissions,
revokePermission,
Permission,
Permissions
} from "./permissions";
export { truncateSync, truncate } from "./truncate";
export { FileInfo } from "./file_info";
export { connect, dial, listen, Listener, Conn } from "./net";
export { metrics, Metrics } from "./metrics";
export { resources } from "./resources";
} from "./permissions.ts";
export { truncateSync, truncate } from "./truncate.ts";
export { FileInfo } from "./file_info.ts";
export { connect, dial, listen, Listener, Conn } from "./net.ts";
export { metrics, Metrics } from "./metrics.ts";
export { resources } from "./resources.ts";
export {
kill,
run,
@ -78,23 +84,35 @@ export {
Process,
ProcessStatus,
Signal
} from "./process";
export { inspect, customInspect } from "./console";
export { build, platform, OperatingSystem, Arch } from "./build";
export { version } from "./version";
} from "./process.ts";
export { inspect, customInspect } from "./console.ts";
export { build, platform, OperatingSystem, Arch } from "./build.ts";
export { version } from "./version.ts";
export const args: string[] = [];
// These are internal Deno APIs. We are marking them as internal so they do not
// appear in the runtime type library.
/** @internal */
export { core } from "./core";
export { core } from "./core.ts";
/** @internal */
export { setPrepareStackTrace } from "./error_stack";
export { setPrepareStackTrace } from "./error_stack.ts";
// TODO Don't expose Console nor stringifyArgs.
/** @internal */
export { Console, stringifyArgs } from "./console";
export { Console, stringifyArgs } from "./console.ts";
// TODO Don't expose DomIterableMixin.
/** @internal */
export { DomIterableMixin } from "./mixins/dom_iterable";
export { DomIterableMixin } from "./mixins/dom_iterable.ts";
/** The current process id of the runtime. */
export let pid: number;
/** Reflects the NO_COLOR environment variable: https://no-color.org/ */
export let noColor: boolean;
// TODO(ry) This should not be exposed to Deno.
export function _setGlobals(pid_: number, noColor_: boolean): void {
pid = pid_;
noColor = noColor_;
}