mirror of
https://github.com/denoland/deno.git
synced 2024-12-24 16:19:12 -05:00
Replace deno.land/x/ with deno.land/std/ (denoland/deno_std#239)
Original: 0fc13fffbd
This commit is contained in:
parent
c6075f373e
commit
d29957ad17
13 changed files with 27 additions and 27 deletions
|
@ -1,4 +1,4 @@
|
||||||
// https://deno.land/x/benching/mod.ts
|
// https://deno.land/std/benching/mod.ts
|
||||||
import { BenchmarkTimer, runBenchmarks, bench } from "./mod.ts";
|
import { BenchmarkTimer, runBenchmarks, bench } from "./mod.ts";
|
||||||
|
|
||||||
// Simple
|
// Simple
|
||||||
|
|
|
@ -5,7 +5,7 @@ Basic benchmarking module. Provides flintstone millisecond resolution.
|
||||||
## Import
|
## Import
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import * as benching from "https://deno.land/x/benching/mod.ts";
|
import * as benching from "https://deno.land/std/benching/mod.ts";
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
@ -15,7 +15,7 @@ import {
|
||||||
BenchmarkTimer,
|
BenchmarkTimer,
|
||||||
runBenchmarks,
|
runBenchmarks,
|
||||||
bench
|
bench
|
||||||
} from "https://deno.land/x/benching/mod.ts";
|
} from "https://deno.land/std/benching/mod.ts";
|
||||||
|
|
||||||
// Simple
|
// Simple
|
||||||
bench(function forIncrementX1e9(b: BenchmarkTimer) {
|
bench(function forIncrementX1e9(b: BenchmarkTimer) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ The main modules exports several functions which can color the output to the
|
||||||
console:
|
console:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { bgBlue, red, bold } from "https://deno.land/x/std/colors/mod.ts";
|
import { bgBlue, red, bold } from "https://deno.land/std/colors/mod.ts";
|
||||||
|
|
||||||
console.log(bgBlue(red(bold("Hello world!"))));
|
console.log(bgBlue(red(bold("Hello world!"))));
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# Deno Example Programs
|
# Deno Example Programs
|
||||||
|
|
||||||
These files are accessible for import via "https://deno.land/x/examples/".
|
These files are accessible for import via "https://deno.land/std/examples/".
|
||||||
|
|
||||||
Try it:
|
Try it:
|
||||||
|
|
||||||
```
|
```
|
||||||
> deno https://deno.land/x/examples/gist.ts README.md
|
> deno https://deno.land/std/examples/gist.ts README.md
|
||||||
```
|
```
|
||||||
|
|
||||||
## Alias Based Installation
|
## Alias Based Installation
|
||||||
|
@ -14,5 +14,5 @@ Add this to your `.bash_profile`
|
||||||
|
|
||||||
```
|
```
|
||||||
export GIST_TOKEN=ABC # Generate at https://github.com/settings/tokens
|
export GIST_TOKEN=ABC # Generate at https://github.com/settings/tokens
|
||||||
alias gist="deno https://deno.land/x/examples/gist.ts --allow-net --allow-env"
|
alias gist="deno https://deno.land/std/examples/gist.ts --allow-net --allow-env"
|
||||||
```
|
```
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
const { args, env, exit, readFile } = Deno;
|
const { args, env, exit, readFile } = Deno;
|
||||||
import { parse } from "https://deno.land/x/flags/mod.ts";
|
import { parse } from "https://deno.land/std/flags/mod.ts";
|
||||||
|
|
||||||
function pathBase(p: string): string {
|
function pathBase(p: string): string {
|
||||||
const parts = p.split("/");
|
const parts = p.split("/");
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import { serve } from "https://deno.land/x/http/mod.ts";
|
import { serve } from "https://deno.land/std/http/mod.ts";
|
||||||
import {
|
import {
|
||||||
acceptWebSocket,
|
acceptWebSocket,
|
||||||
isWebSocketCloseEvent,
|
isWebSocketCloseEvent,
|
||||||
isWebSocketPingEvent
|
isWebSocketPingEvent
|
||||||
} from "https://deno.land/x/ws/mod.ts";
|
} from "https://deno.land/std/ws/mod.ts";
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
console.log("websocket server is running on 0.0.0.0:8080");
|
console.log("websocket server is running on 0.0.0.0:8080");
|
||||||
|
|
|
@ -6,7 +6,7 @@ Command line arguments parser for Deno based on minimist
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const { args } = Deno;
|
const { args } = Deno;
|
||||||
import { parse } from "https://deno.land/x/flags/mod.ts";
|
import { parse } from "https://deno.land/std/flags/mod.ts";
|
||||||
|
|
||||||
console.dir(parse(args));
|
console.dir(parse(args));
|
||||||
```
|
```
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import * as path from "https://deno.land/x/fs/path.ts";
|
import * as path from "https://deno.land/std/fs/path.ts";
|
||||||
```
|
```
|
||||||
|
|
|
@ -5,7 +5,7 @@ A framework for creating HTTP/HTTPS server.
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { serve } from "https://deno.land/x/http/server.ts";
|
import { serve } from "https://deno.land/std/http/server.ts";
|
||||||
const s = serve("0.0.0.0:8000");
|
const s = serve("0.0.0.0:8000");
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
@ -24,5 +24,5 @@ A small program for serving local files over HTTP.
|
||||||
Add the following to your `.bash_profile`
|
Add the following to your `.bash_profile`
|
||||||
|
|
||||||
```
|
```
|
||||||
alias file_server="deno https://deno.land/x/http/file_server.ts --allow-net"
|
alias file_server="deno https://deno.land/std/http/file_server.ts --allow-net"
|
||||||
```
|
```
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import * as log from "https://deno.land/x/std/log/mod.ts";
|
import * as log from "https://deno.land/std/log/mod.ts";
|
||||||
|
|
||||||
// simple default logger, you can customize it
|
// simple default logger, you can customize it
|
||||||
// by overriding logger and handler named "default"
|
// by overriding logger and handler named "default"
|
||||||
|
|
|
@ -13,7 +13,7 @@ extension or the full path name. If the content type cannot be determined the
|
||||||
function returns `undefined`:
|
function returns `undefined`:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { lookup } from "https://deno.land/x/std/media_types/mod.ts";
|
import { lookup } from "https://deno.land/std/media_types/mod.ts";
|
||||||
|
|
||||||
lookup("json"); // "application/json"
|
lookup("json"); // "application/json"
|
||||||
lookup(".md"); // "text/markdown"
|
lookup(".md"); // "text/markdown"
|
||||||
|
@ -29,8 +29,8 @@ content type first. A default charset is added if not present. The
|
||||||
function will return `undefined` if the content type cannot be resolved:
|
function will return `undefined` if the content type cannot be resolved:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { contentType } from "https://deno.land/x/std/media_types/mod.ts";
|
import { contentType } from "https://deno.land/std/media_types/mod.ts";
|
||||||
import * as path from "https://deno.land/x/std/path/mod.ts";
|
import * as path from "https://deno.land/std/path/mod.ts";
|
||||||
|
|
||||||
contentType("markdown"); // "text/markdown; charset=utf-8"
|
contentType("markdown"); // "text/markdown; charset=utf-8"
|
||||||
contentType("file.json"); // "application/json; charset=utf-8"
|
contentType("file.json"); // "application/json; charset=utf-8"
|
||||||
|
@ -46,7 +46,7 @@ Return a default extension for a given content type. If there is not an
|
||||||
appropriate extension, `undefined` is returned:
|
appropriate extension, `undefined` is returned:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { extension } from "https://deno.land/x/std/media_types/mod.ts";
|
import { extension } from "https://deno.land/std/media_types/mod.ts";
|
||||||
|
|
||||||
extension("application/octet-stream"); // "bin"
|
extension("application/octet-stream"); // "bin"
|
||||||
```
|
```
|
||||||
|
@ -57,7 +57,7 @@ Lookup the implied default charset for a given content type. If the content
|
||||||
type cannot be resolved, `undefined` is returned:
|
type cannot be resolved, `undefined` is returned:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { charset } from "https://deno.land/x/std/media_types/mod.ts";
|
import { charset } from "https://deno.land/std/media_types/mod.ts";
|
||||||
|
|
||||||
charset("text/markdown"); // "UTF-8"
|
charset("text/markdown"); // "UTF-8"
|
||||||
```
|
```
|
||||||
|
@ -67,7 +67,7 @@ charset("text/markdown"); // "UTF-8"
|
||||||
A `Map` of extensions by content type, in priority order:
|
A `Map` of extensions by content type, in priority order:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { extensions } from "https://deno.land/x/std/media_types/mod.ts";
|
import { extensions } from "https://deno.land/std/media_types/mod.ts";
|
||||||
|
|
||||||
extensions.get("application/javascript"); // [ "js", "mjs" ]
|
extensions.get("application/javascript"); // [ "js", "mjs" ]
|
||||||
```
|
```
|
||||||
|
@ -77,7 +77,7 @@ extensions.get("application/javascript"); // [ "js", "mjs" ]
|
||||||
A `Map` of content types by extension:
|
A `Map` of content types by extension:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { types } from "https://deno.land/x/std/media_types/mod.ts";
|
import { types } from "https://deno.land/std/media_types/mod.ts";
|
||||||
|
|
||||||
types.get("ts"); // "application/javascript"
|
types.get("ts"); // "application/javascript"
|
||||||
```
|
```
|
||||||
|
|
|
@ -7,19 +7,19 @@ Prettier APIs and tools for deno
|
||||||
To formats the source files, run:
|
To formats the source files, run:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
deno --allow-run --allow-write https://deno.land/x/std/prettier/main.ts
|
deno --allow-run --allow-write https://deno.land/std/prettier/main.ts
|
||||||
```
|
```
|
||||||
|
|
||||||
You can format only specific files by passing the arguments.
|
You can format only specific files by passing the arguments.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
deno --allow-run --allow-write https://deno.land/x/std/prettier/main.ts path/to/script.ts
|
deno --allow-run --allow-write https://deno.land/std/prettier/main.ts path/to/script.ts
|
||||||
```
|
```
|
||||||
|
|
||||||
You can format files on specific directory by passing the directory's path.
|
You can format files on specific directory by passing the directory's path.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
deno --allow-run --allow-write https://deno.land/x/std/prettier/main.ts path/to/script.ts
|
deno --allow-run --allow-write https://deno.land/std/prettier/main.ts path/to/script.ts
|
||||||
```
|
```
|
||||||
|
|
||||||
## Use API
|
## Use API
|
||||||
|
@ -30,7 +30,7 @@ You can use APIs of prettier as the following:
|
||||||
import {
|
import {
|
||||||
prettier,
|
prettier,
|
||||||
prettierPlugins
|
prettierPlugins
|
||||||
} from "https://deno.land/x/std/prettier/prettier.ts";
|
} from "https://deno.land/std/prettier/prettier.ts";
|
||||||
|
|
||||||
prettier.format("const x = 1", {
|
prettier.format("const x = 1", {
|
||||||
parser: "babel",
|
parser: "babel",
|
||||||
|
|
|
@ -47,7 +47,7 @@ import {
|
||||||
test,
|
test,
|
||||||
assert,
|
assert,
|
||||||
equal
|
equal
|
||||||
} from "https://deno.land/x/testing/mod.ts";
|
} from "https://deno.land/std/testing/mod.ts";
|
||||||
|
|
||||||
test({
|
test({
|
||||||
name: "testing example",
|
name: "testing example",
|
||||||
|
|
Loading…
Reference in a new issue