summaryrefslogtreecommitdiff
path: root/cli/js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js')
-rw-r--r--cli/js/compiler_api_test.ts8
-rw-r--r--cli/js/compiler_bootstrap.ts2
-rw-r--r--cli/js/compiler_bundler.ts13
-rw-r--r--cli/js/compiler_host.ts2
4 files changed, 13 insertions, 12 deletions
diff --git a/cli/js/compiler_api_test.ts b/cli/js/compiler_api_test.ts
index 72b65ab5d..eef12c8cc 100644
--- a/cli/js/compiler_api_test.ts
+++ b/cli/js/compiler_api_test.ts
@@ -78,15 +78,15 @@ test(async function bundleApiSources() {
"/bar.ts": `export const bar = "bar";\n`
});
assert(diagnostics == null);
- assert(actual.includes(`instantiate("foo")`));
- assert(actual.includes(`__rootExports["bar"]`));
+ assert(actual.includes(`__inst("foo")`));
+ assert(actual.includes(`__exp["bar"]`));
});
test(async function bundleApiNoSources() {
const [diagnostics, actual] = await bundle("./cli/tests/subdir/mod1.ts");
assert(diagnostics == null);
- assert(actual.includes(`instantiate("mod1")`));
- assert(actual.includes(`__rootExports["printHello3"]`));
+ assert(actual.includes(`__inst("mod1")`));
+ assert(actual.includes(`__exp["printHello3"]`));
});
test(async function bundleApiConfig() {
diff --git a/cli/js/compiler_bootstrap.ts b/cli/js/compiler_bootstrap.ts
index 585aec016..817486d12 100644
--- a/cli/js/compiler_bootstrap.ts
+++ b/cli/js/compiler_bootstrap.ts
@@ -55,4 +55,4 @@ export const TS_SNAPSHOT_PROGRAM = ts.createProgram({
* We read all static assets during the snapshotting process, which is
* why this is located in compiler_bootstrap.
*/
-export const BUNDLE_LOADER = getAsset("bundle_loader.js");
+export const SYSTEM_LOADER = getAsset("system_loader.js");
diff --git a/cli/js/compiler_bundler.ts b/cli/js/compiler_bundler.ts
index d334b0fc3..b9893620a 100644
--- a/cli/js/compiler_bundler.ts
+++ b/cli/js/compiler_bundler.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { BUNDLE_LOADER } from "./compiler_bootstrap.ts";
+import { SYSTEM_LOADER } from "./compiler_bootstrap.ts";
import {
assert,
commonPath,
@@ -44,18 +44,18 @@ export function buildBundle(
.replace(/\.\w+$/i, "");
let instantiate: string;
if (rootExports && rootExports.length) {
- instantiate = `const __rootExports = instantiate("${rootName}");\n`;
+ instantiate = `const __exp = await __inst("${rootName}");\n`;
for (const rootExport of rootExports) {
if (rootExport === "default") {
- instantiate += `export default __rootExports["${rootExport}"];\n`;
+ instantiate += `export default __exp["${rootExport}"];\n`;
} else {
- instantiate += `export const ${rootExport} = __rootExports["${rootExport}"];\n`;
+ instantiate += `export const ${rootExport} = __exp["${rootExport}"];\n`;
}
}
} else {
- instantiate = `instantiate("${rootName}");\n`;
+ instantiate = `await __inst("${rootName}");\n`;
}
- return `${BUNDLE_LOADER}\n${data}\n${instantiate}`;
+ return `${SYSTEM_LOADER}\n${data}\n${instantiate}`;
}
/** Set the rootExports which will by the `emitBundle()` */
@@ -80,6 +80,7 @@ export function setRootExports(program: ts.Program, rootModule: string): void {
// out, so inspecting SymbolFlags that might be present that are type only
.filter(
sym =>
+ sym.flags & ts.SymbolFlags.Class ||
!(
sym.flags & ts.SymbolFlags.Interface ||
sym.flags & ts.SymbolFlags.TypeLiteral ||
diff --git a/cli/js/compiler_host.ts b/cli/js/compiler_host.ts
index 291f6fbc5..0f6aa4d08 100644
--- a/cli/js/compiler_host.ts
+++ b/cli/js/compiler_host.ts
@@ -34,7 +34,7 @@ export const ASSETS = "$asset$";
* runtime). */
export const defaultBundlerOptions: ts.CompilerOptions = {
inlineSourceMap: false,
- module: ts.ModuleKind.AMD,
+ module: ts.ModuleKind.System,
outDir: undefined,
outFile: `${OUT_DIR}/bundle.js`,
// disabled until we have effective way to modify source maps