diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-05-06 00:19:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-06 00:19:18 +0200 |
commit | 2ecdbb62ae8f925b01e3e49f397d439a2f464a21 (patch) | |
tree | ca45ddcf322337affdf1bbb8f87139b373d2d93d /cli/js/ops/compiler.ts | |
parent | 9cd7d598405f8bf6600775827f870848fd3e120a (diff) |
refactor: merge TS compiler into single file (#5091)
Diffstat (limited to 'cli/js/ops/compiler.ts')
-rw-r--r-- | cli/js/ops/compiler.ts | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/cli/js/ops/compiler.ts b/cli/js/ops/compiler.ts deleted file mode 100644 index 60f814741..000000000 --- a/cli/js/ops/compiler.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. - -import { sendAsync, sendSync } from "./dispatch_json.ts"; -import { TextDecoder, TextEncoder } from "../web/text_encoding.ts"; -import { core } from "../core.ts"; - -export function resolveModules( - specifiers: string[], - referrer?: string -): string[] { - return sendSync("op_resolve_modules", { specifiers, referrer }); -} - -export function fetchSourceFiles( - specifiers: string[], - referrer?: string -): Promise< - Array<{ - url: string; - filename: string; - mediaType: number; - sourceCode: string; - }> -> { - return sendAsync("op_fetch_source_files", { - specifiers, - referrer, - }); -} - -const encoder = new TextEncoder(); -const decoder = new TextDecoder(); - -export function getAsset(name: string): string { - const opId = core.ops()["op_fetch_asset"]; - // We really don't want to depend on JSON dispatch during snapshotting, so - // this op exchanges strings with Rust as raw byte arrays. - const sourceCodeBytes = core.dispatch(opId, encoder.encode(name)); - return decoder.decode(sourceCodeBytes!); -} |