Skip to content

Commit

Permalink
docs: Using absolute paths in jsdoc import statements (denoland#2762)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayame113 committed Oct 10, 2022
1 parent aa29870 commit e6189c0
Show file tree
Hide file tree
Showing 28 changed files with 84 additions and 84 deletions.
2 changes: 1 addition & 1 deletion async/debounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface DebouncedFunction<T extends Array<unknown>> {
* aborted.
*
* ```
* import { debounce } from "./debounce.ts";
* import { debounce } from "https://deno.land/std@$STD_VERSION/async/debounce.ts";
*
* const log = debounce(
* (event: Deno.FsEvent) =>
Expand Down
2 changes: 1 addition & 1 deletion async/deferred.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface Deferred<T> extends Promise<T> {
* placed as methods on the promise object itself. It allows you to do:
*
* ```ts
* import { deferred } from "./deferred.ts";
* import { deferred } from "https://deno.land/std@$STD_VERSION/async/deferred.ts";
*
* const p = deferred<number>();
* // ...
Expand Down
2 changes: 1 addition & 1 deletion async/tee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Queue<T> {
* Example:
*
* ```ts
* import { tee } from "./tee.ts";
* import { tee } from "https://deno.land/std@$STD_VERSION/async/tee.ts";
*
* const gen = async function* gen() {
* yield 1;
Expand Down
18 changes: 9 additions & 9 deletions bytes/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* The complexity of this function is O(source.lenth * needle.length).
*
* ```ts
* import { indexOfNeedle } from "./mod.ts";
* import { indexOfNeedle } from "https://deno.land/std@$STD_VERSION/bytes/mod.ts";
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
* const needle = new Uint8Array([1, 2]);
* console.log(indexOfNeedle(source, needle)); // 1
Expand Down Expand Up @@ -64,7 +64,7 @@ export function indexOfNeedle(
* The complexity of this function is O(source.lenth * needle.length).
*
* ```ts
* import { lastIndexOfNeedle } from "./mod.ts";
* import { lastIndexOfNeedle } from "https://deno.land/std@$STD_VERSION/bytes/mod.ts";
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
* const needle = new Uint8Array([1, 2]);
* console.log(lastIndexOfNeedle(source, needle)); // 5
Expand Down Expand Up @@ -108,7 +108,7 @@ export function lastIndexOfNeedle(
* The complexity of this function is O(prefix.length).
*
* ```ts
* import { startsWith } from "./mod.ts";
* import { startsWith } from "https://deno.land/std@$STD_VERSION/bytes/mod.ts";
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
* const prefix = new Uint8Array([0, 1, 2]);
* console.log(startsWith(source, prefix)); // true
Expand All @@ -127,7 +127,7 @@ export function startsWith(source: Uint8Array, prefix: Uint8Array): boolean {
* The complexity of this function is O(suffix.length).
*
* ```ts
* import { endsWith } from "./mod.ts";
* import { endsWith } from "https://deno.land/std@$STD_VERSION/bytes/mod.ts";
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
* const suffix = new Uint8Array([1, 2, 3]);
* console.log(endsWith(source, suffix)); // true
Expand All @@ -150,7 +150,7 @@ export function endsWith(source: Uint8Array, suffix: Uint8Array): boolean {
* If `count` is negative, a `RangeError` is thrown.
*
* ```ts
* import { repeat } from "./mod.ts";
* import { repeat } from "https://deno.land/std@$STD_VERSION/bytes/mod.ts";
* const source = new Uint8Array([0, 1, 2]);
* console.log(repeat(source, 3)); // [0, 1, 2, 0, 1, 2, 0, 1, 2]
* console.log(repeat(source, 0)); // []
Expand Down Expand Up @@ -188,7 +188,7 @@ export function repeat(source: Uint8Array, count: number): Uint8Array {
/** Concatenate the given arrays into a new Uint8Array.
*
* ```ts
* import { concat } from "./mod.ts";
* import { concat } from "https://deno.land/std@$STD_VERSION/bytes/mod.ts";
* const a = new Uint8Array([0, 1, 2]);
* const b = new Uint8Array([3, 4, 5]);
* console.log(concat(a, b)); // [0, 1, 2, 3, 4, 5]
Expand Down Expand Up @@ -217,7 +217,7 @@ export function concat(...buf: Uint8Array[]): Uint8Array {
* The complexity of this function is O(source.length * needle.length).
*
* ```ts
* import { includesNeedle } from "./mod.ts";
* import { includesNeedle } from "https://deno.land/std@$STD_VERSION/bytes/mod.ts";
* const source = new Uint8Array([0, 1, 2, 1, 2, 1, 2, 3]);
* const needle = new Uint8Array([1, 2]);
* console.log(includesNeedle(source, needle)); // true
Expand All @@ -243,15 +243,15 @@ export function includesNeedle(
* the array.
*
* ```ts
* import { copy } from "./mod.ts";
* import { copy } from "https://deno.land/std@$STD_VERSION/bytes/mod.ts";
* const src = new Uint8Array([9, 8, 7]);
* const dst = new Uint8Array([0, 1, 2, 3, 4, 5]);
* console.log(copy(src, dst)); // 3
* console.log(dst); // [9, 8, 7, 3, 4, 5]
* ```
*
* ```ts
* import { copy } from "./mod.ts";
* import { copy } from "https://deno.land/std@$STD_VERSION/bytes/mod.ts";
* const src = new Uint8Array([1, 1, 1, 1]);
* const dst = new Uint8Array([0, 0, 0, 0]);
* console.log(copy(src, dst, 1)); // 3
Expand Down
2 changes: 1 addition & 1 deletion datetime/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export type DifferenceOptions = {
* example :
*
* ```typescript
* import * as datetime from "./mod.ts";
* import * as datetime from "https://deno.land/std@$STD_VERSION/datetime/mod.ts";
*
* datetime.difference(new Date("2020/1/1"),new Date("2020/2/2"),{ units : ["days","months"] })
* ```
Expand Down
8 changes: 4 additions & 4 deletions encoding/varint/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const U64MAX = 18_446_744_073_709_551_615n;
/**
* Encodes the given `number` into `Uint8Array` with LEB128. The number needs to be in the range of `0` and `0xffffffff`.
* ```ts
* import { encodeU32 } from "./mod.ts";
* import { encodeU32 } from "https://deno.land/std@$STD_VERSION/encoding/varint/mod.ts";
*
* const encodedValue = encodeU32(42);
* // Do something with the encoded value
Expand All @@ -35,7 +35,7 @@ export function encodeU32(val: number): Uint8Array {
/**
* Encodes the given `BigInt` into `Uint8Array` with LEB128. The number needs to be in the range of `0` and `0xffffffffffffffff`.
* ```ts
* import { encodeU64 } from "./mod.ts";
* import { encodeU64 } from "https://deno.land/std@$STD_VERSION/encoding/varint/mod.ts";
*
* const encodedValue = encodeU64(42n);
* // Do something with the encoded value
Expand All @@ -55,7 +55,7 @@ export function encodeU64(val: bigint): Uint8Array {
/**
* Decodes the given `Uint8Array` into a `number` with LEB128.
* ```ts
* import { decodeU32 } from "./mod.ts";
* import { decodeU32 } from "https://deno.land/std@$STD_VERSION/encoding/varint/mod.ts";
* const bytes = Uint8Array.from([221, 199, 1]);
* const decodedValue = decodeU32(bytes);
*
Expand All @@ -76,7 +76,7 @@ export function decodeU32(val: Uint8Array): number {
/**
* Decodes the given `Uint8Array` into a `BigInt` with LEB128.
* ```ts
* import { decodeU64 } from "./mod.ts";
* import { decodeU64 } from "https://deno.land/std@$STD_VERSION/encoding/varint/mod.ts";
* const bytes = Uint8Array.from([221, 199, 1]);
* const decodedValue = decodeU64(bytes);
*
Expand Down
6 changes: 3 additions & 3 deletions flags/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export interface ParseOptions<
*
* ```ts
* // $ deno run example.ts -- a arg1
* import { parse } from "./mod.ts";
* import { parse } from "https://deno.land/std@$STD_VERSION/flags/mod.ts";
* console.dir(parse(Deno.args, { "--": false }));
* // output: { _: [ "a", "arg1" ] }
* console.dir(parse(Deno.args, { "--": true }));
Expand Down Expand Up @@ -332,12 +332,12 @@ function hasKey(obj: NestedMapping, keys: string[]): boolean {
* available in the `_` property of the returned object.
*
* ```ts
* import { parse } from "./mod.ts";
* import { parse } from "https://deno.land/std@$STD_VERSION/flags/mod.ts";
* const parsedArgs = parse(Deno.args);
* ```
*
* ```ts
* import { parse } from "./mod.ts";
* import { parse } from "https://deno.land/std@$STD_VERSION/flags/mod.ts";
* const parsedArgs = parse(["--foo", "--bar=baz", "./quux.txt"]);
* // parsedArgs: { foo: true, bar: "baz", _: ["./quux.txt"] }
* ```
Expand Down
4 changes: 2 additions & 2 deletions fmt/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export function bgRgb8(str: string, color: number): string {
* To produce the color magenta:
*
* ```ts
* import { rgb24 } from "./colors.ts";
* import { rgb24 } from "https://deno.land/std@$STD_VERSION/fmt/colors.ts";
* rgb24("foo", 0xff00ff);
* rgb24("foo", {r: 255, g: 0, b: 255});
* ```
Expand Down Expand Up @@ -488,7 +488,7 @@ export function rgb24(str: string, color: number | Rgb): string {
* To produce the color magenta:
*
* ```ts
* import { bgRgb24 } from "./colors.ts";
* import { bgRgb24 } from "https://deno.land/std@$STD_VERSION/fmt/colors.ts";
* bgRgb24("foo", 0xff00ff);
* bgRgb24("foo", {r: 255, g: 0, b: 255});
* ```
Expand Down
4 changes: 2 additions & 2 deletions fs/expand_glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function comparePath(a: WalkEntry, b: WalkEntry): number {
*
* Example:
* ```ts
* import { expandGlob } from "./expand_glob.ts";
* import { expandGlob } from "https://deno.land/std@$STD_VERSION/fs/expand_glob.ts";
* for await (const file of expandGlob("**\/*.ts")) {
* console.log(file);
* }
Expand Down Expand Up @@ -174,7 +174,7 @@ export async function* expandGlob(
* Example:
*
* ```ts
* import { expandGlobSync } from "./expand_glob.ts";
* import { expandGlobSync } from "https://deno.land/std@$STD_VERSION/fs/expand_glob.ts";
* for (const file of expandGlobSync("**\/*.ts")) {
* console.log(file);
* }
Expand Down
4 changes: 2 additions & 2 deletions fs/walk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export type { WalkEntry };
* - skip?: RegExp[];
*
* ```ts
* import { walk } from "./walk.ts";
* import { assert } from "../testing/asserts.ts";
* import { walk } from "https://deno.land/std@$STD_VERSION/fs/walk.ts";
* import { assert } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
*
* for await (const entry of walk(".")) {
* console.log(entry.path);
Expand Down
8 changes: 4 additions & 4 deletions io/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export interface ByteRange {
* range.
*
* ```ts
* import { assertEquals } from "../testing/asserts.ts";
* import { readRange } from "./files.ts";
* import { assertEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
* import { readRange } from "https://deno.land/std@$STD_VERSION/io/files.ts";
*
* // Read the first 10 bytes of a file
* const file = await Deno.open("example.txt", { read: true });
Expand Down Expand Up @@ -57,8 +57,8 @@ export async function readRange(
* within that range.
*
* ```ts
* import { assertEquals } from "../testing/asserts.ts";
* import { readRangeSync } from "./files.ts";
* import { assertEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
* import { readRangeSync } from "https://deno.land/std@$STD_VERSION/io/files.ts";
*
* // Read the first 10 bytes of a file
* const file = Deno.openSync("example.txt", { read: true });
Expand Down
4 changes: 2 additions & 2 deletions io/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface Reader {
*
* Implementations should not retain a reference to `p`.
*
* Use iterateReader() from https://deno.land/std/streams/conversion.ts to turn a Reader into an
* Use iterateReader() from https://deno.land/std@$STD_VERSION/streams/conversion.ts to turn a Reader into an
* AsyncIterator.
*/
read(p: Uint8Array): Promise<number | null>;
Expand All @@ -45,7 +45,7 @@ export interface ReaderSync {
*
* Implementations should not retain a reference to `p`.
*
* Use iterateReaderSync() from https://deno.land/std/streams/conversion.ts to turn a ReaderSync
* Use iterateReaderSync() from https://deno.land/std@$STD_VERSION/streams/conversion.ts to turn a ReaderSync
* into an Iterator.
*/
readSync(p: Uint8Array): number | null;
Expand Down
2 changes: 1 addition & 1 deletion node/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ class Module {
* Also injects available Node.js builtin module polyfills.
*
* ```ts
* import { createRequire } from "./module.ts";
* import { createRequire } from "https://deno.land/std@$STD_VERSION/node/module.ts";
* const require = createRequire(import.meta.url);
* const fs = require("fs");
* const leftPad = require("left-pad");
Expand Down
4 changes: 2 additions & 2 deletions node/path/posix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ export function parse(path: string): ParsedPath {
* Converts a file URL to a path string.
*
* ```ts
* import { fromFileUrl } from "./posix.ts";
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/node/path/posix.ts";
* fromFileUrl("file:https:///home/foo"); // "/home/foo"
* ```
* @param url of a file URL
Expand All @@ -497,7 +497,7 @@ export function fromFileUrl(url: string | URL): string {
* Converts a path string to a file URL.
*
* ```ts
* import { toFileUrl } from "./posix.ts";
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/node/path/posix.ts";
* toFileUrl("/home/foo"); // new URL("file:https:///home/foo")
* ```
* @param path to convert to file URL
Expand Down
4 changes: 2 additions & 2 deletions node/path/win32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ export function parse(path: string): ParsedPath {
* Converts a file URL to a path string.
*
* ```ts
* import { fromFileUrl } from "./win32.ts";
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/node/path/win32.ts";
* fromFileUrl("file:https:///home/foo"); // "\\home\\foo"
* fromFileUrl("file:https:///C:/Users/foo"); // "C:\\Users\\foo"
* fromFileUrl("file:https://localhost/home/foo"); // "\\\\localhost\\home\\foo"
Expand Down Expand Up @@ -980,7 +980,7 @@ export function fromFileUrl(url: string | URL): string {
* Converts a path string to a file URL.
*
* ```ts
* import { toFileUrl } from "./win32.ts";
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/node/path/win32.ts";
* toFileUrl("\\home\\foo"); // new URL("file:https:///home/foo")
* toFileUrl("C:\\Users\\foo"); // new URL("file:https:///C:/Users/foo")
* toFileUrl("\\\\127.0.0.1\\home\\foo"); // new URL("file:https://127.0.0.1/home/foo")
Expand Down
4 changes: 2 additions & 2 deletions path/posix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ export function parse(path: string): ParsedPath {
* Converts a file URL to a path string.
*
* ```ts
* import { fromFileUrl } from "./posix.ts";
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/posix.ts";
* fromFileUrl("file:https:///home/foo"); // "/home/foo"
* ```
* @param url of a file URL
Expand All @@ -500,7 +500,7 @@ export function fromFileUrl(url: string | URL): string {
* Converts a path string to a file URL.
*
* ```ts
* import { toFileUrl } from "./posix.ts";
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/path/posix.ts";
* toFileUrl("/home/foo"); // new URL("file:https:///home/foo")
* ```
* @param path to convert to file URL
Expand Down
4 changes: 2 additions & 2 deletions path/win32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ export function parse(path: string): ParsedPath {
* Converts a file URL to a path string.
*
* ```ts
* import { fromFileUrl } from "./win32.ts";
* import { fromFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
* fromFileUrl("file:https:///home/foo"); // "\\home\\foo"
* fromFileUrl("file:https:///C:/Users/foo"); // "C:\\Users\\foo"
* fromFileUrl("file:https://localhost/home/foo"); // "\\\\localhost\\home\\foo"
Expand Down Expand Up @@ -983,7 +983,7 @@ export function fromFileUrl(url: string | URL): string {
* Converts a path string to a file URL.
*
* ```ts
* import { toFileUrl } from "./win32.ts";
* import { toFileUrl } from "https://deno.land/std@$STD_VERSION/path/win32.ts";
* toFileUrl("\\home\\foo"); // new URL("file:https:///home/foo")
* toFileUrl("C:\\Users\\foo"); // new URL("file:https:///C:/Users/foo")
* toFileUrl("\\\\127.0.0.1\\home\\foo"); // new URL("file:https://127.0.0.1/home/foo")
Expand Down
8 changes: 4 additions & 4 deletions permissions/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function getPermissionString(descriptors: Deno.PermissionDescriptor[]): string {
* the permissions that are granted.
*
* ```ts
* import { grant } from "./mod.ts";
* import { grant } from "https://deno.land/std@$STD_VERSION/permissions/mod.ts";
* const perms = await grant({ name: "net" }, { name: "read" });
* if (perms && perms.length === 2) {
* // do something cool that connects to the net and reads files
Expand All @@ -52,7 +52,7 @@ export async function grant(
* the permissions that are granted.
*
* ```ts
* import { grant } from "./mod.ts";
* import { grant } from "https://deno.land/std@$STD_VERSION/permissions/mod.ts";
* const perms = await grant([{ name: "net" }, { name: "read" }]);
* if (perms && perms.length === 2) {
* // do something cool that connects to the net and reads files
Expand Down Expand Up @@ -89,7 +89,7 @@ export async function grant(
/** Attempts to grant a set of permissions or rejects.
*
* ```ts
* import { grantOrThrow } from "./mod.ts";
* import { grantOrThrow } from "https://deno.land/std@$STD_VERSION/permissions/mod.ts";
* await grantOrThrow({ name: "env" }, { name: "net" });
* ```
*
Expand All @@ -103,7 +103,7 @@ export async function grantOrThrow(
/** Attempts to grant a set of permissions or rejects.
*
* ```ts
* import { grantOrThrow } from "./mod.ts";
* import { grantOrThrow } from "https://deno.land/std@$STD_VERSION/permissions/mod.ts";
* await grantOrThrow([{ name: "env" }, { name: "net" }]);
* ```
*
Expand Down
2 changes: 1 addition & 1 deletion signal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Generates an AsyncIterable which can be awaited on for one or more signals.
`dispose()` can be called when you are finished waiting on the events.

```typescript
import { signal } from "https://deno.land/std/signal/mod.ts";
import { signal } from "https://deno.land/std@$STD_VERSION/signal/mod.ts";
const sig = signal("SIGUSR1", "SIGINT");
setTimeout(() => {}, 5000); // Prevents exiting immediately.

Expand Down
2 changes: 1 addition & 1 deletion signal/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type Disposable = { dispose: () => void };
* Example:
*
* ```ts
* import { signal } from "./mod.ts";
* import { signal } from "https://deno.land/std@$STD_VERSION/signal/mod.ts";
*
* const sig = signal("SIGUSR1", "SIGINT");
* setTimeout(() => {}, 5000); // Prevents exiting immediately
Expand Down
Loading

0 comments on commit e6189c0

Please sign in to comment.