Skip to content

Commit

Permalink
move more Web APIs to cli/js/web/
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Mar 10, 2020
1 parent 4d6e269 commit 91e5e22
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 26 deletions.
2 changes: 1 addition & 1 deletion cli/js/deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export { build, OperatingSystem, Arch } from "./build.ts";
export { chmodSync, chmod } from "./ops/fs/chmod.ts";
export { chownSync, chown } from "./ops/fs/chown.ts";
export { transpileOnly, compile, bundle } from "./compiler/api.ts";
export { inspect } from "./console.ts";
export { inspect } from "./web/console.ts";
export { copyFileSync, copyFile } from "./ops/fs/copy_file.ts";
export {
Diagnostic,
Expand Down
8 changes: 4 additions & 4 deletions cli/js/globals.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.

import * as blob from "./web/blob.ts";
import * as consoleTypes from "./console.ts";
import * as consoleTypes from "./web/console.ts";
import * as customEvent from "./web/custom_event.ts";
import * as domTypes from "./web/dom_types.ts";
import * as domFile from "./web/dom_file.ts";
Expand All @@ -11,11 +11,11 @@ import * as formData from "./web/form_data.ts";
import * as fetchTypes from "./web/fetch.ts";
import * as headers from "./web/headers.ts";
import * as textEncoding from "./web/text_encoding.ts";
import * as timers from "./timers.ts";
import * as timers from "./web/timers.ts";
import * as url from "./web/url.ts";
import * as urlSearchParams from "./web/url_search_params.ts";
import * as workers from "./workers.ts";
import * as performanceUtil from "./performance.ts";
import * as workers from "./web/workers.ts";
import * as performanceUtil from "./web/performance.ts";
import * as request from "./web/request.ts";

// These imports are not exposed and therefore are fine to just import the
Expand Down
2 changes: 1 addition & 1 deletion cli/js/repl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { exit } from "./ops/os.ts";
import { core } from "./core.ts";
import { stringifyArgs } from "./console.ts";
import { stringifyArgs } from "./web/console.ts";
import { startRepl, readline } from "./ops/repl.ts";
import { close } from "./ops/resources.ts";

Expand Down
2 changes: 1 addition & 1 deletion cli/js/symbols.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { internalSymbol } from "./internals.ts";
import { customInspect } from "./console.ts";
import { customInspect } from "./web/console.ts";

/** Special Deno related symbols. */
export const symbols = {
Expand Down
2 changes: 1 addition & 1 deletion cli/js/testing.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { red, green, bgRed, gray, italic } from "./colors.ts";
import { exit } from "./ops/os.ts";
import { Console } from "./console.ts";
import { Console } from "./web/console.ts";

function formatDuration(time = 0): string {
const timeStr = `(${time}ms)`;
Expand Down
8 changes: 8 additions & 0 deletions cli/js/web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Deno Web APIs

This directory facilities Web APIs that are available in Deno.

Please note, that some of implementations might not be completely aligned with
specification.

Some of the Web APIs are using ops under the hood, eg. `console`, `performance`.
10 changes: 5 additions & 5 deletions cli/js/console.ts → cli/js/web/console.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { isTypedArray } from "./util.ts";
import { TypedArray } from "./types.ts";
import { TextEncoder } from "./web/text_encoding.ts";
import { File, stdout } from "./files.ts";
import { isTypedArray } from "../util.ts";
import { TypedArray } from "../types.ts";
import { TextEncoder } from "./text_encoding.ts";
import { File, stdout } from "../files.ts";
import { cliTable } from "./console_table.ts";
import { exposeForTest } from "./internals.ts";
import { exposeForTest } from "../internals.ts";

type ConsoleContext = Set<unknown>;
type ConsoleOptions = Partial<{
Expand Down
4 changes: 2 additions & 2 deletions cli/js/console_table.ts → cli/js/web/console_table.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright Joyent, Inc. and other Node contributors. MIT license.
// Forked from Node's lib/internal/cli_table.js

import { TextEncoder } from "./web/text_encoding.ts";
import { hasOwnProperty } from "./util.ts";
import { TextEncoder } from "./text_encoding.ts";
import { hasOwnProperty } from "../util.ts";

const encoder = new TextEncoder();

Expand Down
2 changes: 1 addition & 1 deletion cli/js/web/headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as domTypes from "./dom_types.ts";
import { DomIterableMixin } from "./dom_iterable.ts";
import { requiredArguments } from "../util.ts";
import { customInspect } from "../console.ts";
import { customInspect } from "./console.ts";

// From node-fetch
// Copyright (c) 2016 David Frank. MIT License.
Expand Down
2 changes: 1 addition & 1 deletion cli/js/performance.ts → cli/js/web/performance.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { now as opNow } from "./ops/timers.ts";
import { now as opNow } from "../ops/timers.ts";

export class Performance {
/** Returns a current time from Deno's start in milliseconds.
Expand Down
6 changes: 3 additions & 3 deletions cli/js/timers.ts → cli/js/web/timers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { assert } from "./util.ts";
import { startGlobalTimer, stopGlobalTimer } from "./ops/timers.ts";
import { RBTree } from "./rbtree.ts";
import { assert } from "../util.ts";
import { startGlobalTimer, stopGlobalTimer } from "../ops/timers.ts";
import { RBTree } from "../rbtree.ts";

const { console } = globalThis;

Expand Down
2 changes: 1 addition & 1 deletion cli/js/web/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as urlSearchParams from "./url_search_params.ts";
import * as domTypes from "./dom_types.ts";
import { getRandomValues } from "../ops/get_random_values.ts";
import { customInspect } from "../console.ts";
import { customInspect } from "./console.ts";

interface URLParts {
protocol: string;
Expand Down
10 changes: 5 additions & 5 deletions cli/js/workers.ts → cli/js/web/workers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import {
hostTerminateWorker,
hostPostMessage,
hostGetMessage
} from "./ops/worker_host.ts";
import { log } from "./util.ts";
import { TextDecoder, TextEncoder } from "./web/text_encoding.ts";
} from "../ops/worker_host.ts";
import { log } from "../util.ts";
import { TextDecoder, TextEncoder } from "./text_encoding.ts";
/*
import { blobURLMap } from "./web/url.ts";
import { blobBytesWeakMap } from "./web/blob.ts";
*/
import { Event } from "./web/event.ts";
import { EventTarget } from "./web/event_target.ts";
import { Event } from "./event.ts";
import { EventTarget } from "./event_target.ts";

const encoder = new TextEncoder();
const decoder = new TextDecoder();
Expand Down

0 comments on commit 91e5e22

Please sign in to comment.