1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

chore: update references to deno_std to use JSR (#23239)

There are more uses of `deno.land/std` in the codebase, but for URL
parsing purposes rather than network calls or documentation.
This commit is contained in:
Asher Gomez 2024-04-11 07:26:35 +10:00 committed by GitHub
parent 7c5745a204
commit c6f1107e9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 104 additions and 93 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run --allow-write=. --lock=./tools/deno.lock.json #!/usr/bin/env -S deno run --allow-write=. --lock=./tools/deno.lock.json
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import * as yaml from "https://deno.land/std@0.173.0/encoding/yaml.ts"; import { stringify } from "jsr:@std/yaml@^0.221/stringify";
// Bump this number when you want to purge the cache. // Bump this number when you want to purge the cache.
// Note: the tools/release/01_bump_crate_versions.ts script will update this version // Note: the tools/release/01_bump_crate_versions.ts script will update this version
@ -1091,7 +1091,7 @@ const ci = {
export function generate() { export function generate() {
let finalText = `# GENERATED BY ./ci.generate.ts -- DO NOT DIRECTLY EDIT\n\n`; let finalText = `# GENERATED BY ./ci.generate.ts -- DO NOT DIRECTLY EDIT\n\n`;
finalText += yaml.stringify(ci, { finalText += stringify(ci, {
noRefs: true, noRefs: true,
lineWidth: 10_000, lineWidth: 10_000,
noCompatMode: true, noCompatMode: true,

View file

@ -79,8 +79,8 @@ Learn more about writing and running Deno programs
- **[Deno Docs](https://docs.deno.com)**: official guides and reference docs for - **[Deno Docs](https://docs.deno.com)**: official guides and reference docs for
the Deno runtime, [Deno Deploy](https://deno.com/deploy), and beyond. the Deno runtime, [Deno Deploy](https://deno.com/deploy), and beyond.
- **[Deno Standard Library](https://deno.land/std)**: officially supported - **[Deno Standard Library](https://jsr.io/@std)**: officially supported common
common utilities for Deno programs. utilities for Deno programs.
- **[deno.land/x](https://deno.land/x)**: registry for third-party Deno modules. - **[deno.land/x](https://deno.land/x)**: registry for third-party Deno modules.
- **[Developer Blog](https://deno.com/blog)**: Product updates, tutorials, and - **[Developer Blog](https://deno.com/blog)**: Product updates, tutorials, and
more from the Deno team. more from the Deno team.

View file

@ -985,7 +985,8 @@ Docs: https://deno.land/manual@v",
env!("CARGO_PKG_VERSION"), env!("CARGO_PKG_VERSION"),
color_print::cstr!( color_print::cstr!(
" "
Modules: https://deno.land/std/ https://deno.land/x/ Standard Library: https://jsr.io/@std
Modules: https://jsr.io/ https://deno.land/x/
Bugs: https://github.com/denoland/deno/issues Bugs: https://github.com/denoland/deno/issues
To start the REPL: To start the REPL:
@ -1319,11 +1320,11 @@ Use an alternative bundler like \"deno_emit\", \"esbuild\" or \"rollup\" instead
Output a single JavaScript file with all dependencies. Output a single JavaScript file with all dependencies.
deno bundle https://deno.land/std/http/file_server.ts file_server.bundle.js deno bundle jsr:@std/http/file-server file_server.bundle.js
If no output file is given, the output is written to standard output: If no output file is given, the output is written to standard output:
deno bundle https://deno.land/std/http/file_server.ts", deno bundle jsr:@std/http/file-server",
) )
.defer(|cmd| { .defer(|cmd| {
compile_args(cmd) compile_args(cmd)
@ -1351,7 +1352,7 @@ fn cache_subcommand() -> Command {
Download and compile a module with all of its static dependencies and save Download and compile a module with all of its static dependencies and save
them in the local cache, without running any code: them in the local cache, without running any code:
deno cache https://deno.land/std/http/file_server.ts deno cache jsr:@std/http/file-server
Future runs of this module will trigger no downloads or compilation unless Future runs of this module will trigger no downloads or compilation unless
--reload is specified.", --reload is specified.",
@ -1372,7 +1373,7 @@ fn check_subcommand() -> Command {
.long_about( .long_about(
"Download and type-check without execution. "Download and type-check without execution.
deno check https://deno.land/std/http/file_server.ts deno check jsr:@std/http/file-server
Unless --reload is specified, this command will not re-download already cached dependencies.", Unless --reload is specified, this command will not re-download already cached dependencies.",
) )
@ -1407,8 +1408,8 @@ fn compile_subcommand() -> Command {
.long_about( .long_about(
"Compiles the given script into a self contained executable. "Compiles the given script into a self contained executable.
deno compile -A https://deno.land/std/http/file_server.ts deno compile -A jsr:@std/http/file-server
deno compile --output file_server https://deno.land/std/http/file_server.ts deno compile --output file_server jsr:@std/http/file-server
Any flags passed which affect runtime behavior, such as '--unstable', Any flags passed which affect runtime behavior, such as '--unstable',
'--allow-*', '--v8-flags', etc. are encoded into the output executable and '--allow-*', '--v8-flags', etc. are encoded into the output executable and
@ -1900,7 +1901,7 @@ fn info_subcommand() -> Command {
Get information about a module: Get information about a module:
deno info https://deno.land/std/http/file_server.ts deno info jsr:@std/http/file-server
The following information is shown: The following information is shown:
@ -1949,12 +1950,12 @@ fn install_subcommand() -> Command {
.long_about( .long_about(
"Installs a script as an executable in the installation root's bin directory. "Installs a script as an executable in the installation root's bin directory.
deno install --global --allow-net --allow-read https://deno.land/std/http/file_server.ts deno install --global --allow-net --allow-read jsr:@std/http/file-server
deno install -g https://examples.deno.land/color-logging.ts deno install -g https://examples.deno.land/color-logging.ts
To change the executable name, use -n/--name: To change the executable name, use -n/--name:
deno install -g --allow-net --allow-read -n serve https://deno.land/std/http/file_server.ts deno install -g --allow-net --allow-read -n serve jsr:@std/http/file-server
The executable name is inferred by default: The executable name is inferred by default:
- Attempt to take the file stem of the URL path. The above example would - Attempt to take the file stem of the URL path. The above example would
@ -1966,7 +1967,7 @@ The executable name is inferred by default:
To change the installation root, use --root: To change the installation root, use --root:
deno install -g --allow-net --allow-read --root /usr/local https://deno.land/std/http/file_server.ts deno install -g --allow-net --allow-read --root /usr/local jsr:@std/http/file-server
The installation root is determined, in order of precedence: The installation root is determined, in order of precedence:
- --root option - --root option
@ -2243,15 +2244,15 @@ ability to spawn subprocesses.
Grant all permissions: Grant all permissions:
deno run -A https://deno.land/std/http/file_server.ts deno run -A jsr:@std/http/file-server
Grant permission to read from disk and listen to network: Grant permission to read from disk and listen to network:
deno run --allow-read --allow-net https://deno.land/std/http/file_server.ts deno run --allow-read --allow-net jsr:@std/http/file-server
Grant permission to read allow-listed files from disk: Grant permission to read allow-listed files from disk:
deno run --allow-read=/etc https://deno.land/std/http/file_server.ts deno run --allow-read=/etc jsr:@std/http/file-server
Specifying the filename '-' to read the file from stdin. Specifying the filename '-' to read the file from stdin.
@ -2506,7 +2507,7 @@ maps remote specifiers to the downloaded files.
Remote modules and multiple modules may also be specified: Remote modules and multiple modules may also be specified:
deno vendor main.ts test.deps.ts https://deno.land/std/path/mod.ts", deno vendor main.ts test.deps.ts jsr:@std/path",
) )
.defer(|cmd| cmd .defer(|cmd| cmd
.arg( .arg(
@ -3059,9 +3060,9 @@ fn reload_arg() -> Arg {
"Reload source code cache (recompile TypeScript) "Reload source code cache (recompile TypeScript)
--reload --reload
Reload everything Reload everything
--reload=https://deno.land/std --reload=jsr:@std/http/file-server
Reload only standard modules Reload only standard modules
--reload=https://deno.land/std/fs/utils.ts,https://deno.land/std/fmt/colors.ts --reload=jsr:@std/http/file-server,jsr:@std/assert/assert-equals
Reloads specific modules Reloads specific modules
--reload=npm: --reload=npm:
Reload all npm modules Reload all npm modules
@ -6772,18 +6773,15 @@ mod tests {
#[test] #[test]
fn install() { fn install() {
let r = flags_from_vec(svec![ let r =
"deno", flags_from_vec(svec!["deno", "install", "jsr:@std/http/file-server"]);
"install",
"https://deno.land/std/http/file_server.ts"
]);
assert_eq!( assert_eq!(
r.unwrap(), r.unwrap(),
Flags { Flags {
subcommand: DenoSubcommand::Install(InstallFlags { subcommand: DenoSubcommand::Install(InstallFlags {
kind: InstallKind::Global(InstallFlagsGlobal { kind: InstallKind::Global(InstallFlagsGlobal {
name: None, name: None,
module_url: "https://deno.land/std/http/file_server.ts".to_string(), module_url: "jsr:@std/http/file-server".to_string(),
args: vec![], args: vec![],
root: None, root: None,
force: false, force: false,
@ -6798,7 +6796,7 @@ mod tests {
"deno", "deno",
"install", "install",
"-g", "-g",
"https://deno.land/std/http/file_server.ts" "jsr:@std/http/file-server"
]); ]);
assert_eq!( assert_eq!(
r.unwrap(), r.unwrap(),
@ -6806,7 +6804,7 @@ mod tests {
subcommand: DenoSubcommand::Install(InstallFlags { subcommand: DenoSubcommand::Install(InstallFlags {
kind: InstallKind::Global(InstallFlagsGlobal { kind: InstallKind::Global(InstallFlagsGlobal {
name: None, name: None,
module_url: "https://deno.land/std/http/file_server.ts".to_string(), module_url: "jsr:@std/http/file-server".to_string(),
args: vec![], args: vec![],
root: None, root: None,
force: false, force: false,
@ -6821,14 +6819,14 @@ mod tests {
#[test] #[test]
fn install_with_flags() { fn install_with_flags() {
#[rustfmt::skip] #[rustfmt::skip]
let r = flags_from_vec(svec!["deno", "install", "--import-map", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--unsafely-ignore-certificate-errors", "--reload", "--lock", "lock.json", "--lock-write", "--cert", "example.crt", "--cached-only", "--allow-read", "--allow-net", "--v8-flags=--help", "--seed", "1", "--inspect=127.0.0.1:9229", "--name", "file_server", "--root", "/foo", "--force", "--env=.example.env", "https://deno.land/std/http/file_server.ts", "foo", "bar"]); let r = flags_from_vec(svec!["deno", "install", "--import-map", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--unsafely-ignore-certificate-errors", "--reload", "--lock", "lock.json", "--lock-write", "--cert", "example.crt", "--cached-only", "--allow-read", "--allow-net", "--v8-flags=--help", "--seed", "1", "--inspect=127.0.0.1:9229", "--name", "file_server", "--root", "/foo", "--force", "--env=.example.env", "jsr:@std/http/file-server", "foo", "bar"]);
assert_eq!( assert_eq!(
r.unwrap(), r.unwrap(),
Flags { Flags {
subcommand: DenoSubcommand::Install(InstallFlags { subcommand: DenoSubcommand::Install(InstallFlags {
kind: InstallKind::Global(InstallFlagsGlobal { kind: InstallKind::Global(InstallFlagsGlobal {
name: Some("file_server".to_string()), name: Some("file_server".to_string()),
module_url: "https://deno.land/std/http/file_server.ts".to_string(), module_url: "jsr:@std/http/file-server".to_string(),
args: svec!["foo", "bar"], args: svec!["foo", "bar"],
root: Some("/foo".to_string()), root: Some("/foo".to_string()),
force: true, force: true,

View file

@ -194,8 +194,8 @@ pub enum CacheSetting {
/// This is the equivalent of `--reload` in the CLI. /// This is the equivalent of `--reload` in the CLI.
ReloadAll, ReloadAll,
/// Only some cached resources should be used. This is the equivalent of /// Only some cached resources should be used. This is the equivalent of
/// `--reload=https://deno.land/std` or /// `--reload=jsr:@std/http/file-server` or
/// `--reload=https://deno.land/std,https://deno.land/x/example`. /// `--reload=jsr:@std/http/file-server,jsr:@std/assert/assert-equals`.
ReloadSome(Vec<String>), ReloadSome(Vec<String>),
/// The usability of a cached value is determined by analyzing the cached /// The usability of a cached value is determined by analyzing the cached
/// headers and other metadata associated with a cached response, reloading /// headers and other metadata associated with a cached response, reloading

View file

@ -40,7 +40,7 @@ import { core, internals } from "ext:core/mod.js";
const $display = Symbol.for("Jupyter.display"); const $display = Symbol.for("Jupyter.display");
/** Escape copied from https://deno.land/std@0.192.0/html/entities.ts */ /** Escape copied from https://jsr.io/@std/html/0.221.0/entities.ts */
const rawToEntityEntries = [ const rawToEntityEntries = [
["&", "&amp;"], ["&", "&amp;"],
["<", "&lt;"], ["<", "&lt;"],

View file

@ -574,7 +574,7 @@ declare namespace Deno {
* Examples: * Examples:
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.test({ * Deno.test({
* name: "inherit", * name: "inherit",
@ -589,7 +589,7 @@ declare namespace Deno {
* ``` * ```
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.test({ * Deno.test({
* name: "true", * name: "true",
@ -604,7 +604,7 @@ declare namespace Deno {
* ``` * ```
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.test({ * Deno.test({
* name: "false", * name: "false",
@ -619,7 +619,7 @@ declare namespace Deno {
* ``` * ```
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.test({ * Deno.test({
* name: "localhost:8080", * name: "localhost:8080",
@ -848,7 +848,7 @@ declare namespace Deno {
* `fn` can be async if required. * `fn` can be async if required.
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.test({ * Deno.test({
* name: "example test", * name: "example test",
@ -889,7 +889,7 @@ declare namespace Deno {
* `fn` can be async if required. * `fn` can be async if required.
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.test({ * Deno.test({
* name: "example test", * name: "example test",
@ -926,7 +926,7 @@ declare namespace Deno {
* `fn` can be async if required. * `fn` can be async if required.
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.test("My test description", () => { * Deno.test("My test description", () => {
* assertEquals("hello", "hello"); * assertEquals("hello", "hello");
@ -952,7 +952,7 @@ declare namespace Deno {
* `fn` can be async if required. Declared function must have a name. * `fn` can be async if required. Declared function must have a name.
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.test(function myTestName() { * Deno.test(function myTestName() {
* assertEquals("hello", "hello"); * assertEquals("hello", "hello");
@ -975,7 +975,7 @@ declare namespace Deno {
* `fn` can be async if required. * `fn` can be async if required.
* *
* ```ts * ```ts
* import {assert, fail, assertEquals} from "https://deno.land/std/assert/mod.ts"; * import { assert, fail, assertEquals } from "jsr:@std/assert";
* *
* Deno.test("My test description", { permissions: { read: true } }, (): void => { * Deno.test("My test description", { permissions: { read: true } }, (): void => {
* assertEquals("hello", "hello"); * assertEquals("hello", "hello");
@ -1002,7 +1002,7 @@ declare namespace Deno {
* `fn` can be async if required. * `fn` can be async if required.
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.test( * Deno.test(
* { * {
@ -1040,7 +1040,7 @@ declare namespace Deno {
* `fn` can be async if required. Declared function must have a name. * `fn` can be async if required. Declared function must have a name.
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.test( * Deno.test(
* { permissions: { read: true } }, * { permissions: { read: true } },
@ -1263,7 +1263,7 @@ declare namespace Deno {
* will await resolution to consider the test complete. * will await resolution to consider the test complete.
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.bench({ * Deno.bench({
* name: "example test", * name: "example test",
@ -1302,7 +1302,7 @@ declare namespace Deno {
* will await resolution to consider the test complete. * will await resolution to consider the test complete.
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.bench("My test description", () => { * Deno.bench("My test description", () => {
* assertEquals("hello", "hello"); * assertEquals("hello", "hello");
@ -1330,7 +1330,7 @@ declare namespace Deno {
* will await resolution to consider the test complete. * will await resolution to consider the test complete.
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.bench(function myTestName() { * Deno.bench(function myTestName() {
* assertEquals("hello", "hello"); * assertEquals("hello", "hello");
@ -1355,7 +1355,7 @@ declare namespace Deno {
* will await resolution to consider the test complete. * will await resolution to consider the test complete.
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.bench( * Deno.bench(
* "My test description", * "My test description",
@ -1392,7 +1392,7 @@ declare namespace Deno {
* will await resolution to consider the test complete. * will await resolution to consider the test complete.
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.bench( * Deno.bench(
* { name: "My test description", permissions: { read: true } }, * { name: "My test description", permissions: { read: true } },
@ -1426,7 +1426,7 @@ declare namespace Deno {
* will await resolution to consider the test complete. * will await resolution to consider the test complete.
* *
* ```ts * ```ts
* import { assertEquals } from "https://deno.land/std/assert/mod.ts"; * import { assertEquals } from "jsr:@std/assert";
* *
* Deno.bench( * Deno.bench(
* { permissions: { read: true } }, * { permissions: { read: true } },
@ -1679,10 +1679,8 @@ declare namespace Deno {
* Implementations should not retain a reference to `p`. * Implementations should not retain a reference to `p`.
* *
* Use * Use
* [`itereateReader`](https://deno.land/std/streams/iterate_reader.ts?s=iterateReader) * {@linkcode https://jsr.io/@std/io/doc/iterate-reader/~/iterateReader | iterateReader}
* from * to turn {@linkcode Reader} into an {@linkcode AsyncIterator}.
* [`std/streams/iterate_reader.ts`](https://deno.land/std/streams/iterate_reader.ts)
* to turn a `Reader` into an {@linkcode AsyncIterator}.
*/ */
read(p: Uint8Array): Promise<number | null>; read(p: Uint8Array): Promise<number | null>;
} }
@ -1717,10 +1715,8 @@ declare namespace Deno {
* Implementations should not retain a reference to `p`. * Implementations should not retain a reference to `p`.
* *
* Use * Use
* [`itereateReaderSync`](https://deno.land/std/streams/iterate_reader.ts?s=iterateReaderSync) * {@linkcode https://jsr.io/@std/io/doc/iterate-reader/~/iterateReaderSync | iterateReaderSync}
* from from * to turn {@linkcode ReaderSync} into an {@linkcode Iterator}.
* [`std/streams/iterate_reader.ts`](https://deno.land/std/streams/iterate_reader.ts)
* to turn a `ReaderSync` into an {@linkcode Iterator}.
*/ */
readSync(p: Uint8Array): number | null; readSync(p: Uint8Array): number | null;
} }
@ -1743,9 +1739,8 @@ declare namespace Deno {
* slice data, even temporarily. * slice data, even temporarily.
* *
* This function is one of the lowest * This function is one of the lowest
* level APIs and most users should not work with this directly, but rather use * level APIs and most users should not work with this directly, but rather
* [`writeAll()`](https://deno.land/std/streams/write_all.ts?s=writeAll) from * use {@linkcode https://jsr.io/@std/io/doc/write-all/~/writeAll | writeAll}
* [`std/streams/write_all.ts`](https://deno.land/std/streams/write_all.ts)
* instead. * instead.
* *
* Implementations should not retain a reference to `p`. * Implementations should not retain a reference to `p`.
@ -1978,7 +1973,7 @@ declare namespace Deno {
* *
* This function is one of the lowest level APIs and most users should not * This function is one of the lowest level APIs and most users should not
* work with this directly, but rather use {@linkcode ReadableStream} and * work with this directly, but rather use {@linkcode ReadableStream} and
* {@linkcode https://deno.land/std/streams/mod.ts?s=toArrayBuffer|toArrayBuffer} * {@linkcode https://jsr.io/@std/streams/doc/to-array-buffer/~/toArrayBuffer | toArrayBuffer}
* instead. * instead.
* *
* **It is not guaranteed that the full buffer will be read in a single call.** * **It is not guaranteed that the full buffer will be read in a single call.**
@ -2010,7 +2005,7 @@ declare namespace Deno {
* *
* This function is one of the lowest level APIs and most users should not * This function is one of the lowest level APIs and most users should not
* work with this directly, but rather use {@linkcode ReadableStream} and * work with this directly, but rather use {@linkcode ReadableStream} and
* {@linkcode https://deno.land/std/streams/mod.ts?s=toArrayBuffer|toArrayBuffer} * {@linkcode https://jsr.io/@std/streams/doc/to-array-buffer/~/toArrayBuffer | toArrayBuffer}
* instead. * instead.
* *
* **It is not guaranteed that the full buffer will be read in a single * **It is not guaranteed that the full buffer will be read in a single
@ -2549,7 +2544,7 @@ declare namespace Deno {
/** Resolves to a {@linkcode Deno.FileInfo} for the file. /** Resolves to a {@linkcode Deno.FileInfo} for the file.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/assert/mod.ts"; * import { assert } from "jsr:@std/assert";
* *
* using file = await Deno.open("hello.txt"); * using file = await Deno.open("hello.txt");
* const fileInfo = await file.stat(); * const fileInfo = await file.stat();
@ -2560,7 +2555,7 @@ declare namespace Deno {
/** Synchronously returns a {@linkcode Deno.FileInfo} for the file. /** Synchronously returns a {@linkcode Deno.FileInfo} for the file.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/assert/mod.ts"; * import { assert } from "jsr:@std/assert";
* *
* using file = Deno.openSync("hello.txt") * using file = Deno.openSync("hello.txt")
* const fileInfo = file.statSync(); * const fileInfo = file.statSync();
@ -3809,7 +3804,7 @@ declare namespace Deno {
* of what it points to. * of what it points to.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/assert/mod.ts"; * import { assert } from "jsr:@std/assert";
* const fileInfo = await Deno.lstat("hello.txt"); * const fileInfo = await Deno.lstat("hello.txt");
* assert(fileInfo.isFile); * assert(fileInfo.isFile);
* ``` * ```
@ -3826,7 +3821,7 @@ declare namespace Deno {
* returned instead of what it points to. * returned instead of what it points to.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/assert/mod.ts"; * import { assert } from "jsr:@std/assert";
* const fileInfo = Deno.lstatSync("hello.txt"); * const fileInfo = Deno.lstatSync("hello.txt");
* assert(fileInfo.isFile); * assert(fileInfo.isFile);
* ``` * ```
@ -3842,7 +3837,7 @@ declare namespace Deno {
* always follow symlinks. * always follow symlinks.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/assert/mod.ts"; * import { assert } from "jsr:@std/assert";
* const fileInfo = await Deno.stat("hello.txt"); * const fileInfo = await Deno.stat("hello.txt");
* assert(fileInfo.isFile); * assert(fileInfo.isFile);
* ``` * ```
@ -3858,7 +3853,7 @@ declare namespace Deno {
* `path`. Will always follow symlinks. * `path`. Will always follow symlinks.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/assert/mod.ts"; * import { assert } from "jsr:@std/assert";
* const fileInfo = Deno.statSync("hello.txt"); * const fileInfo = Deno.statSync("hello.txt");
* assert(fileInfo.isFile); * assert(fileInfo.isFile);
* ``` * ```
@ -5111,7 +5106,7 @@ declare namespace Deno {
/** Revokes a permission, and resolves to the state of the permission. /** Revokes a permission, and resolves to the state of the permission.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/assert/mod.ts"; * import { assert } from "jsr:@std/assert";
* *
* const status = await Deno.permissions.revoke({ name: "run" }); * const status = await Deno.permissions.revoke({ name: "run" });
* assert(status.state !== "granted") * assert(status.state !== "granted")
@ -5122,7 +5117,7 @@ declare namespace Deno {
/** Revokes a permission, and returns the state of the permission. /** Revokes a permission, and returns the state of the permission.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/assert/mod.ts"; * import { assert } from "jsr:@std/assert";
* *
* const status = Deno.permissions.revokeSync({ name: "run" }); * const status = Deno.permissions.revokeSync({ name: "run" });
* assert(status.state !== "granted") * assert(status.state !== "granted")
@ -5200,14 +5195,14 @@ declare namespace Deno {
* ### Revoking * ### Revoking
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/assert/mod.ts"; * import { assert } from "jsr:@std/assert";
* *
* const status = await Deno.permissions.revoke({ name: "run" }); * const status = await Deno.permissions.revoke({ name: "run" });
* assert(status.state !== "granted") * assert(status.state !== "granted")
* ``` * ```
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/assert/mod.ts"; * import { assert } from "jsr:@std/assert";
* *
* const status = Deno.permissions.revokeSync({ name: "run" }); * const status = Deno.permissions.revokeSync({ name: "run" });
* assert(status.state !== "granted") * assert(status.state !== "granted")
@ -5313,9 +5308,9 @@ declare namespace Deno {
* [ "Sushi" ] * [ "Sushi" ]
* ``` * ```
* *
* If you are looking for a structured way to parse arguments, there is the * If you are looking for a structured way to parse arguments, there is
* [`std/flags`](https://deno.land/std/flags) module as part of the Deno * [`parseArgs()`](https://jsr.io/@std/cli/doc/parse-args/~/parseArgs) from
* standard library. * the Deno Standard Library.
* *
* @category Runtime Environment * @category Runtime Environment
*/ */
@ -5535,7 +5530,7 @@ declare namespace Deno {
* Returns a `Deno.FileInfo` for the given file stream. * Returns a `Deno.FileInfo` for the given file stream.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/assert/mod.ts"; * import { assert } from "jsr:@std/assert";
* *
* const file = await Deno.open("file.txt", { read: true }); * const file = await Deno.open("file.txt", { read: true });
* const fileInfo = await Deno.fstat(file.rid); * const fileInfo = await Deno.fstat(file.rid);
@ -5555,7 +5550,7 @@ declare namespace Deno {
* stream. * stream.
* *
* ```ts * ```ts
* import { assert } from "https://deno.land/std/assert/mod.ts"; * import { assert } from "jsr:@std/assert";
* *
* const file = Deno.openSync("file.txt", { read: true }); * const file = Deno.openSync("file.txt", { read: true });
* const fileInfo = Deno.fstatSync(file.rid); * const fileInfo = Deno.fstatSync(file.rid);

View file

@ -40,7 +40,7 @@ async function copy(
internals.warnOnDeprecatedApi( internals.warnOnDeprecatedApi(
"Deno.copy()", "Deno.copy()",
new Error().stack, new Error().stack,
"Use `copy()` from `https://deno.land/std/io/copy.ts` instead.", "Use `copy()` from `https://jsr.io/@std/io/doc/copy/~` instead.",
); );
let n = 0; let n = 0;
const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE; const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE;

View file

@ -48,7 +48,7 @@ class Buffer {
internals.warnOnDeprecatedApi( internals.warnOnDeprecatedApi(
"new Deno.Buffer()", "new Deno.Buffer()",
new Error().stack, new Error().stack,
"Use `Buffer` from `https://deno.land/std/io/buffer.ts` instead.", "Use `Buffer` from `https://jsr.io/@std/io/doc/buffer/~` instead.",
); );
if (ab == null) { if (ab == null) {
this.#buf = new Uint8Array(0); this.#buf = new Uint8Array(0);
@ -238,7 +238,7 @@ async function readAll(r) {
internals.warnOnDeprecatedApi( internals.warnOnDeprecatedApi(
"Deno.readAll()", "Deno.readAll()",
new Error().stack, new Error().stack,
"Use `readAll()` from `https://deno.land/std/io/read_all.ts` instead.", "Use `readAll()` from `https://jsr.io/@std/io/doc/read-all/~` instead.",
); );
const buf = new Buffer(); const buf = new Buffer();
await buf.readFrom(r); await buf.readFrom(r);
@ -249,7 +249,7 @@ function readAllSync(r) {
internals.warnOnDeprecatedApi( internals.warnOnDeprecatedApi(
"Deno.readAllSync()", "Deno.readAllSync()",
new Error().stack, new Error().stack,
"Use `readAllSync()` from `https://deno.land/std/io/read_all.ts` instead.", "Use `readAllSync()` from `https://jsr.io/@std/io/doc/read-all/~` instead.",
); );
const buf = new Buffer(); const buf = new Buffer();
buf.readFromSync(r); buf.readFromSync(r);
@ -260,7 +260,7 @@ async function writeAll(w, arr) {
internals.warnOnDeprecatedApi( internals.warnOnDeprecatedApi(
"Deno.writeAll()", "Deno.writeAll()",
new Error().stack, new Error().stack,
"Use `writeAll()` from `https://deno.land/std/io/write_all.ts` instead.", "Use `writeAll()` from `https://jsr.io/@std/io/doc/write-all/~` instead.",
); );
let nwritten = 0; let nwritten = 0;
while (nwritten < arr.length) { while (nwritten < arr.length) {
@ -272,7 +272,7 @@ function writeAllSync(w, arr) {
internals.warnOnDeprecatedApi( internals.warnOnDeprecatedApi(
"Deno.writeAllSync()", "Deno.writeAllSync()",
new Error().stack, new Error().stack,
"Use `writeAllSync()` from `https://deno.land/std/io/write_all.ts` instead.", "Use `writeAllSync()` from `https://jsr.io/@std/io/doc/write-all/~` instead.",
); );
let nwritten = 0; let nwritten = 0;
while (nwritten < arr.length) { while (nwritten < arr.length) {

View file

@ -215,7 +215,7 @@ fn reload_flag() {
#[test] #[test]
fn typecheck_declarations_ns() { fn typecheck_declarations_ns() {
let context = TestContext::default(); let context = TestContextBuilder::for_jsr().build();
let args = vec![ let args = vec![
"test".to_string(), "test".to_string(),
"--doc".to_string(), "--doc".to_string(),
@ -224,7 +224,12 @@ fn typecheck_declarations_ns() {
.to_string_lossy() .to_string_lossy()
.into_owned(), .into_owned(),
]; ];
let output = context.new_command().args_vec(args).split_output().run(); let output = context
.new_command()
.args_vec(args)
.envs(util::env_vars_for_jsr_tests())
.split_output()
.run();
println!("stdout: {}", output.stdout()); println!("stdout: {}", output.stdout());
println!("stderr: {}", output.stderr()); println!("stderr: {}", output.stderr());

View file

@ -1400,7 +1400,7 @@ fn lsp_hover() {
"language": "typescript", "language": "typescript",
"value": "const Deno.args: string[]" "value": "const Deno.args: string[]"
}, },
"Returns the script arguments to the program.\n\nGive the following command line invocation of Deno:\n\n```sh\ndeno run --allow-read https://examples.deno.land/command-line-arguments.ts Sushi\n```\n\nThen `Deno.args` will contain:\n\n```ts\n[ \"Sushi\" ]\n```\n\nIf you are looking for a structured way to parse arguments, there is the\n[`std/flags`](https://deno.land/std/flags) module as part of the Deno\nstandard library.", "Returns the script arguments to the program.\n\nGive the following command line invocation of Deno:\n\n```sh\ndeno run --allow-read https://examples.deno.land/command-line-arguments.ts Sushi\n```\n\nThen `Deno.args` will contain:\n\n```ts\n[ \"Sushi\" ]\n```\n\nIf you are looking for a structured way to parse arguments, there is\n[`parseArgs()`](https://jsr.io/@std/cli/doc/parse-args/~/parseArgs) from\nthe Deno Standard Library.",
"\n\n*@category* - Runtime Environment", "\n\n*@category* - Runtime Environment",
], ],
"range": { "range": {

View file

@ -4,12 +4,12 @@ Deno.bench("noop2", { group: "noop", baseline: true }, () => {});
Deno.bench("noop3", { group: "url" }, () => {}); Deno.bench("noop3", { group: "url" }, () => {});
Deno.bench("parse url 2x", { group: "url", baseline: true }, () => { Deno.bench("parse url 2x", { group: "url", baseline: true }, () => {
new URL("https://deno.land/std/http/server.ts"); new URL("https://jsr.io/@std/http/0.221.0/file_server.ts");
new URL("https://deno.land/std/http/server.ts"); new URL("https://jsr.io/@std/http/0.221.0/file_server.ts");
}); });
Deno.bench("parse url 200x", { group: "url" }, () => { Deno.bench("parse url 200x", { group: "url" }, () => {
for (let i = 0; i < 200; i++) { for (let i = 0; i < 200; i++) {
new URL("https://deno.land/std/http/server.ts"); new URL("https://jsr.io/@std/http/0.221.0/file_server.ts");
} }
}); });

View file

@ -0,0 +1,4 @@
// deno-lint-ignore-file
export function assert(expr: unknown) {
return true;
}

View file

@ -0,0 +1,5 @@
// deno-lint-ignore-file
export function fail() {
return true;
}

View file

@ -18,3 +18,5 @@
*/ */
export * from "./assert_equals.ts"; export * from "./assert_equals.ts";
export * from "./assert.ts";
export * from "./fail.ts";

View file

@ -1,6 +1,8 @@
{ {
"exports": { "exports": {
".": "./mod.ts", ".": "./mod.ts",
"./assert_equals": "./assert_equals.ts" "./assert": "./assert.ts",
"./assert-equals": "./assert-equals.ts",
"./fail": "./fail.ts"
} }
} }

View file

@ -1,4 +1,4 @@
import { ServerRequest } from "https://deno.land/std/http/server.ts"; import { ServerRequest } from "jsr:@std/http/server";
export default (req: ServerRequest) => { export default (req: ServerRequest) => {
req.respond({ body: `Hello, from Deno v${Deno.version.deno}!` }); req.respond({ body: `Hello, from Deno v${Deno.version.deno}!` });