mirror of
https://github.com/denoland/deno.git
synced 2024-12-27 17:49:08 -05:00
Change import { x } from "deno"
to const { x } = Deno
(#218)
This commit is contained in:
parent
d441a7dbf0
commit
6063378a92
32 changed files with 43 additions and 55 deletions
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
import { exit, noColor } from "deno";
|
const { exit, noColor } = Deno;
|
||||||
|
|
||||||
interface BenchmarkClock {
|
interface BenchmarkClock {
|
||||||
start: number;
|
start: number;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { noColor } from "deno";
|
const { noColor } = Deno;
|
||||||
|
|
||||||
interface Code {
|
interface Code {
|
||||||
open: string;
|
open: string;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { listen, copy } from "deno";
|
const { listen, copy } = Deno;
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const addr = "0.0.0.0:8080";
|
const addr = "0.0.0.0:8080";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env deno --allow-net --allow-env
|
#!/usr/bin/env deno --allow-net --allow-env
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
import { args, env, exit, readFile } from "deno";
|
const { args, env, exit, readFile } = Deno;
|
||||||
import { parse } from "https://deno.land/x/flags/mod.ts";
|
import { parse } from "https://deno.land/x/flags/mod.ts";
|
||||||
|
|
||||||
function pathBase(p: string): string {
|
function pathBase(p: string): string {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { run } from "deno";
|
const { run } = Deno;
|
||||||
import { test, assertEqual } from "../testing/mod.ts";
|
import { test, assertEqual } from "../testing/mod.ts";
|
||||||
|
|
||||||
/** Example of how to do basic tests */
|
/** Example of how to do basic tests */
|
||||||
|
|
|
@ -5,7 +5,7 @@ Command line arguments parser for Deno based on minimist
|
||||||
# Example
|
# Example
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { args } from "deno";
|
const { args } = Deno;
|
||||||
import { parse } from "https://deno.land/x/flags/mod.ts";
|
import { parse } from "https://deno.land/x/flags/mod.ts";
|
||||||
|
|
||||||
console.dir(parse(args));
|
console.dir(parse(args));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { args } from "deno";
|
const { args } = Deno;
|
||||||
import { parse } from "./mod.ts";
|
import { parse } from "./mod.ts";
|
||||||
|
|
||||||
console.dir(parse(args));
|
console.dir(parse(args));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env deno --allow-run --allow-write --allow-read
|
#!/usr/bin/env deno --allow-run --allow-write --allow-read
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { exit, args } from "deno";
|
const { exit, args } = Deno;
|
||||||
import { parse } from "./flags/mod.ts";
|
import { parse } from "./flags/mod.ts";
|
||||||
import { xrun, executableSuffix } from "./prettier/util.ts";
|
import { xrun, executableSuffix } from "./prettier/util.ts";
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright the Browserify authors. MIT License.
|
// Copyright the Browserify authors. MIT License.
|
||||||
// Ported from https://github.com/browserify/path-browserify/
|
// Ported from https://github.com/browserify/path-browserify/
|
||||||
|
|
||||||
import { platform } from "deno";
|
const { platform } = Deno;
|
||||||
|
|
||||||
// Alphabet chars.
|
// Alphabet chars.
|
||||||
export const CHAR_UPPERCASE_A = 65; /* A */
|
export const CHAR_UPPERCASE_A = 65; /* A */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright the Browserify authors. MIT License.
|
// Copyright the Browserify authors. MIT License.
|
||||||
// Ported from https://github.com/browserify/path-browserify/
|
// Ported from https://github.com/browserify/path-browserify/
|
||||||
|
|
||||||
import { cwd, env } from "deno";
|
const { cwd, env } = Deno;
|
||||||
import { FormatInputPathObject, ParsedPath } from "./interface.ts";
|
import { FormatInputPathObject, ParsedPath } from "./interface.ts";
|
||||||
import {
|
import {
|
||||||
isWindows,
|
isWindows,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// Copyright the Browserify authors. MIT License.
|
// Copyright the Browserify authors. MIT License.
|
||||||
// Ported from https://github.com/browserify/path-browserify/
|
// Ported from https://github.com/browserify/path-browserify/
|
||||||
|
|
||||||
|
const { cwd } = Deno;
|
||||||
import { test, assertEqual } from "../../testing/mod.ts";
|
import { test, assertEqual } from "../../testing/mod.ts";
|
||||||
import * as path from "./mod.ts";
|
import * as path from "./mod.ts";
|
||||||
import { cwd } from "deno";
|
|
||||||
|
|
||||||
const windowsTests =
|
const windowsTests =
|
||||||
// arguments result
|
// arguments result
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// Copyright the Browserify authors. MIT License.
|
// Copyright the Browserify authors. MIT License.
|
||||||
// Ported from https://github.com/browserify/path-browserify/
|
// Ported from https://github.com/browserify/path-browserify/
|
||||||
|
|
||||||
|
const { cwd } = Deno;
|
||||||
import { test, assertEqual } from "../../testing/mod.ts";
|
import { test, assertEqual } from "../../testing/mod.ts";
|
||||||
import * as path from "./mod.ts";
|
import * as path from "./mod.ts";
|
||||||
import { cwd } from "deno";
|
|
||||||
|
|
||||||
const pwd = cwd();
|
const pwd = cwd();
|
||||||
|
|
||||||
|
|
13
fs/walk.ts
13
fs/walk.ts
|
@ -1,14 +1,5 @@
|
||||||
import {
|
const { readDir, readDirSync, readlink, readlinkSync, stat, statSync } = Deno;
|
||||||
FileInfo,
|
import { FileInfo } from "deno";
|
||||||
cwd,
|
|
||||||
readDir,
|
|
||||||
readDirSync,
|
|
||||||
readlink,
|
|
||||||
readlinkSync,
|
|
||||||
stat,
|
|
||||||
statSync
|
|
||||||
} from "deno";
|
|
||||||
import { relative } from "path.ts";
|
|
||||||
|
|
||||||
export interface WalkOptions {
|
export interface WalkOptions {
|
||||||
maxDepth?: number;
|
maxDepth?: number;
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
import {
|
const {
|
||||||
cwd,
|
cwd,
|
||||||
chdir,
|
chdir,
|
||||||
FileInfo,
|
|
||||||
makeTempDir,
|
makeTempDir,
|
||||||
mkdir,
|
mkdir,
|
||||||
open,
|
open,
|
||||||
platform,
|
platform,
|
||||||
remove,
|
remove,
|
||||||
symlink
|
symlink
|
||||||
} from "deno";
|
} = Deno;
|
||||||
|
import { FileInfo } from "deno";
|
||||||
import { walk, walkSync, WalkOptions } from "./walk.ts";
|
import { walk, walkSync, WalkOptions } from "./walk.ts";
|
||||||
import { test, assert, TestFunction } from "../testing/mod.ts";
|
import { test, assert, TestFunction } from "../testing/mod.ts";
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,14 @@
|
||||||
// TODO Add tests like these:
|
// TODO Add tests like these:
|
||||||
// https://github.com/indexzero/http-server/blob/master/test/http-server-test.js
|
// https://github.com/indexzero/http-server/blob/master/test/http-server-test.js
|
||||||
|
|
||||||
|
const { ErrorKind, cwd, args, stat, readDir, open } = Deno;
|
||||||
|
import { DenoError } from "deno";
|
||||||
import {
|
import {
|
||||||
listenAndServe,
|
listenAndServe,
|
||||||
ServerRequest,
|
ServerRequest,
|
||||||
setContentLength,
|
setContentLength,
|
||||||
Response
|
Response
|
||||||
} from "./server.ts";
|
} from "./server.ts";
|
||||||
import { cwd, DenoError, ErrorKind, args, stat, readDir, open } from "deno";
|
|
||||||
import { extname } from "../fs/path.ts";
|
import { extname } from "../fs/path.ts";
|
||||||
import { contentType } from "../media_types/mod.ts";
|
import { contentType } from "../media_types/mod.ts";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { readFile, run } from "deno";
|
const { readFile, run } = Deno;
|
||||||
|
|
||||||
import { test, assert, assertEqual } from "../testing/mod.ts";
|
import { test, assert, assertEqual } from "../testing/mod.ts";
|
||||||
import { BufReader } from "../io/bufio.ts";
|
import { BufReader } from "../io/bufio.ts";
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { listen, Conn, toAsyncIterator, Reader, Writer, copy } from "deno";
|
const { listen, toAsyncIterator, copy } = Deno;
|
||||||
|
import { Conn, Reader, Writer } from "deno";
|
||||||
import { BufReader, BufState, BufWriter } from "../io/bufio.ts";
|
import { BufReader, BufState, BufWriter } from "../io/bufio.ts";
|
||||||
import { TextProtoReader } from "../textproto/mod.ts";
|
import { TextProtoReader } from "../textproto/mod.ts";
|
||||||
import { STATUS_TEXT } from "./http_status.ts";
|
import { STATUS_TEXT } from "./http_status.ts";
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// Ported from
|
// Ported from
|
||||||
// https://github.com/golang/go/blob/master/src/net/http/responsewrite_test.go
|
// https://github.com/golang/go/blob/master/src/net/http/responsewrite_test.go
|
||||||
|
|
||||||
import { Buffer } from "deno";
|
const { Buffer } = Deno;
|
||||||
import { assertEqual, test } from "../testing/mod.ts";
|
import { assertEqual, test } from "../testing/mod.ts";
|
||||||
import { Response, ServerRequest } from "./server.ts";
|
import { Response, ServerRequest } from "./server.ts";
|
||||||
import { BufReader, BufWriter } from "../io/bufio.ts";
|
import { BufReader, BufWriter } from "../io/bufio.ts";
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
import { Buffer, Reader, ReadResult } from "deno";
|
const { Buffer } = Deno;
|
||||||
|
import { Reader, ReadResult } from "deno";
|
||||||
import { test, assert, assertEqual } from "../testing/mod.ts";
|
import { test, assert, assertEqual } from "../testing/mod.ts";
|
||||||
import { BufReader, BufState, BufWriter } from "./bufio.ts";
|
import { BufReader, BufState, BufWriter } from "./bufio.ts";
|
||||||
import * as iotest from "./iotest.ts";
|
import * as iotest from "./iotest.ts";
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { Buffer, Reader, ReadResult } from "deno";
|
const { Buffer } = Deno;
|
||||||
|
import { Reader, ReadResult } from "deno";
|
||||||
import { assert, assertEqual, runTests, test } from "../testing/mod.ts";
|
import { assert, assertEqual, runTests, test } from "../testing/mod.ts";
|
||||||
import {
|
import {
|
||||||
copyN,
|
copyN,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
const { copy } = Deno;
|
||||||
import { assert, test } from "../testing/mod.ts";
|
import { assert, test } from "../testing/mod.ts";
|
||||||
import { MultiReader, StringReader } from "./readers.ts";
|
import { MultiReader, StringReader } from "./readers.ts";
|
||||||
import { StringWriter } from "./writers.ts";
|
import { StringWriter } from "./writers.ts";
|
||||||
import { copy } from "deno";
|
|
||||||
import { copyN } from "./ioutil.ts";
|
import { copyN } from "./ioutil.ts";
|
||||||
import { decode } from "../strings/strings.ts";
|
import { decode } from "../strings/strings.ts";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { Buffer, File, mkdir, open, Reader } from "deno";
|
const { Buffer, mkdir, open } = Deno;
|
||||||
|
import { File, Reader } from "deno";
|
||||||
import { encode } from "../strings/strings.ts";
|
import { encode } from "../strings/strings.ts";
|
||||||
import * as path from "../fs/path.ts";
|
import * as path from "../fs/path.ts";
|
||||||
// `off` is the offset into `dst` where it will at which to begin writing values
|
// `off` is the offset into `dst` where it will at which to begin writing values
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
|
const { remove } = Deno;
|
||||||
import { test, assert } from "../testing/mod.ts";
|
import { test, assert } from "../testing/mod.ts";
|
||||||
import { copyBytes, tempFile } from "./util.ts";
|
import { copyBytes, tempFile } from "./util.ts";
|
||||||
import { remove } from "deno";
|
|
||||||
import * as path from "../fs/path.ts";
|
import * as path from "../fs/path.ts";
|
||||||
|
|
||||||
test(function testCopyBytes() {
|
test(function testCopyBytes() {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
const { copy } = Deno;
|
||||||
import { assert, test } from "../testing/mod.ts";
|
import { assert, test } from "../testing/mod.ts";
|
||||||
import { StringWriter } from "./writers.ts";
|
import { StringWriter } from "./writers.ts";
|
||||||
import { StringReader } from "./readers.ts";
|
import { StringReader } from "./readers.ts";
|
||||||
import { copyN } from "./ioutil.ts";
|
import { copyN } from "./ioutil.ts";
|
||||||
import { copy } from "deno";
|
|
||||||
|
|
||||||
test(async function ioStringWriter() {
|
test(async function ioStringWriter() {
|
||||||
const w = new StringWriter("base");
|
const w = new StringWriter("base");
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { open, File, Writer } from "deno";
|
const { open } = Deno;
|
||||||
|
import { File, Writer } from "deno";
|
||||||
import { getLevelByName, LogLevel } from "./levels.ts";
|
import { getLevelByName, LogLevel } from "./levels.ts";
|
||||||
import { LogRecord } from "./logger.ts";
|
import { LogRecord } from "./logger.ts";
|
||||||
import { red, yellow, blue, bold } from "../colors/mod.ts";
|
import { red, yellow, blue, bold } from "../colors/mod.ts";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
import { Buffer, Closer, copy, Reader, ReadResult, remove, Writer } from "deno";
|
const { Buffer, copy, remove } = Deno;
|
||||||
|
import { Closer, Reader, ReadResult, Writer } from "deno";
|
||||||
import { FormFile } from "./formfile.ts";
|
import { FormFile } from "./formfile.ts";
|
||||||
import {
|
import {
|
||||||
bytesFindIndex,
|
bytesFindIndex,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
|
const { Buffer, copy, open, remove } = Deno;
|
||||||
import { assert, test } from "../testing/mod.ts";
|
import { assert, test } from "../testing/mod.ts";
|
||||||
import {
|
import {
|
||||||
matchAfterPrefix,
|
matchAfterPrefix,
|
||||||
|
@ -7,7 +8,6 @@ import {
|
||||||
MultipartWriter,
|
MultipartWriter,
|
||||||
scanUntilBoundary
|
scanUntilBoundary
|
||||||
} from "./multipart.ts";
|
} from "./multipart.ts";
|
||||||
import { Buffer, copy, open, remove } from "deno";
|
|
||||||
import * as path from "../fs/path.ts";
|
import * as path from "../fs/path.ts";
|
||||||
import { FormFile, isFormFile } from "./formfile.ts";
|
import { FormFile, isFormFile } from "./formfile.ts";
|
||||||
import { StringWriter } from "../io/writers.ts";
|
import { StringWriter } from "../io/writers.ts";
|
||||||
|
|
|
@ -2,16 +2,7 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
// This script formats the given source files. If the files are omitted, it
|
// This script formats the given source files. If the files are omitted, it
|
||||||
// formats the all files in the repository.
|
// formats the all files in the repository.
|
||||||
import {
|
const { args, platform, readAll, lstat, exit, run, readFile, writeFile } = Deno;
|
||||||
args,
|
|
||||||
platform,
|
|
||||||
readAll,
|
|
||||||
lstat,
|
|
||||||
exit,
|
|
||||||
run,
|
|
||||||
readFile,
|
|
||||||
writeFile
|
|
||||||
} from "deno";
|
|
||||||
import { xrun } from "./util.ts";
|
import { xrun } from "./util.ts";
|
||||||
import { parse } from "../flags/mod.ts";
|
import { parse } from "../flags/mod.ts";
|
||||||
import { prettier, prettierPlugins } from "./prettier.ts";
|
import { prettier, prettierPlugins } from "./prettier.ts";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { test, assertEqual } from "../testing/mod.ts";
|
import { test, assertEqual } from "../testing/mod.ts";
|
||||||
import { xrun, executableSuffix } from "./util.ts";
|
import { xrun, executableSuffix } from "./util.ts";
|
||||||
import { readAll } from "deno";
|
const { readAll } = Deno;
|
||||||
|
|
||||||
const decoder = new TextDecoder();
|
const decoder = new TextDecoder();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { platform, run } from "deno";
|
const { platform, run } = Deno;
|
||||||
|
|
||||||
// Runs a command in cross-platform way
|
// Runs a command in cross-platform way
|
||||||
export function xrun(opts) {
|
export function xrun(opts) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { Buffer, Writer, Conn } from "deno";
|
const { Buffer } = Deno;
|
||||||
|
import { Writer, Conn } from "deno";
|
||||||
import { BufReader, BufWriter } from "../io/bufio.ts";
|
import { BufReader, BufWriter } from "../io/bufio.ts";
|
||||||
import { readLong, readShort, sliceLongToBytes } from "../io/ioutil.ts";
|
import { readLong, readShort, sliceLongToBytes } from "../io/ioutil.ts";
|
||||||
import { Sha1 } from "./sha1.ts";
|
import { Sha1 } from "./sha1.ts";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import "./sha1_test.ts";
|
import "./sha1_test.ts";
|
||||||
|
|
||||||
import { Buffer } from "deno";
|
const { Buffer } = Deno;
|
||||||
import { BufReader } from "../io/bufio.ts";
|
import { BufReader } from "../io/bufio.ts";
|
||||||
import { assert, assertEqual, test } from "../testing/mod.ts";
|
import { assert, assertEqual, test } from "../testing/mod.ts";
|
||||||
import {
|
import {
|
||||||
|
|
Loading…
Reference in a new issue