From fa7f34eb8cec07f4c68ca4e9c46a983bc3e2308f Mon Sep 17 00:00:00 2001 From: Ry Dahl Date: Tue, 21 Jan 2020 14:57:56 -0500 Subject: Revert "Create an old program to be used in snapshot. (#3644)" Ref #3712. This change allowed the deno_typescript crate to reference cli/js/lib.deno_runtime.d.ts which breaks "cargo package". We intend to reintroduce a revised version of this patch later once "cargo package" is working and tested. This reverts commit 737ab94ea1bdf65eeef323ea37e84bcf430fb92c. --- cli/js/compiler_bundler.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'cli/js/compiler_bundler.ts') diff --git a/cli/js/compiler_bundler.ts b/cli/js/compiler_bundler.ts index 8fb68cc7a..a4e4557ca 100644 --- a/cli/js/compiler_bundler.ts +++ b/cli/js/compiler_bundler.ts @@ -1,6 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -import { bundleLoader } from "./compiler_bootstrap.ts"; +import * as dispatch from "./dispatch.ts"; +import { sendSync } from "./dispatch_json.ts"; import { assert, commonPath, @@ -8,6 +9,11 @@ import { CHAR_FORWARD_SLASH } from "./util.ts"; +const BUNDLE_LOADER = "bundle_loader.js"; + +/** A loader of bundled modules that we will inline into any bundle outputs. */ +let bundleLoader: string; + /** Local state of what the root exports are of a root module. */ let rootExports: string[] | undefined; @@ -34,6 +40,12 @@ export function buildBundle( data: string, sourceFiles: readonly ts.SourceFile[] ): string { + // we can only do this once we are bootstrapped and easiest way to do it is + // inline here + if (!bundleLoader) { + bundleLoader = sendSync(dispatch.OP_FETCH_ASSET, { name: BUNDLE_LOADER }); + } + // when outputting to AMD and a single outfile, TypeScript makes up the module // specifiers which are used to define the modules, and doesn't expose them // publicly, so we have to try to replicate -- cgit v1.2.3