Skip to content

Commit

Permalink
chore: update references to deno_std to use JSR (denoland#23239)
Browse files Browse the repository at this point in the history
There are more uses of `deno.land/std` in the codebase, but for URL
parsing purposes rather than network calls or documentation.
  • Loading branch information
iuioiua authored Apr 10, 2024
1 parent 7c5745a commit c6f1107
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 93 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.generate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run --allow-write=. --lock=./tools/deno.lock.json
// 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.
// Note: the tools/release/01_bump_crate_versions.ts script will update this version
Expand Down Expand Up @@ -1091,7 +1091,7 @@ const ci = {

export function generate() {
let finalText = `# GENERATED BY ./ci.generate.ts -- DO NOT DIRECTLY EDIT\n\n`;
finalText += yaml.stringify(ci, {
finalText += stringify(ci, {
noRefs: true,
lineWidth: 10_000,
noCompatMode: true,
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ Learn more about writing and running Deno programs

- **[Deno Docs](https://docs.deno.com)**: official guides and reference docs for
the Deno runtime, [Deno Deploy](https://deno.com/deploy), and beyond.
- **[Deno Standard Library](https://deno.land/std)**: officially supported
common utilities for Deno programs.
- **[Deno Standard Library](https://jsr.io/@std)**: officially supported common
utilities for Deno programs.
- **[deno.land/x](https://deno.land/x)**: registry for third-party Deno modules.
- **[Developer Blog](https://deno.com/blog)**: Product updates, tutorials, and
more from the Deno team.
Expand Down
52 changes: 25 additions & 27 deletions cli/args/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,8 @@ Docs: https://deno.land/manual@v",
env!("CARGO_PKG_VERSION"),
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
To start the REPL:
Expand Down Expand Up @@ -1319,11 +1320,11 @@ Use an alternative bundler like \"deno_emit\", \"esbuild\" or \"rollup\" instead
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:
deno bundle https://deno.land/std/http/file_server.ts",
deno bundle jsr:@std/http/file-server",
)
.defer(|cmd| {
compile_args(cmd)
Expand Down Expand Up @@ -1351,7 +1352,7 @@ fn cache_subcommand() -> Command {
Download and compile a module with all of its static dependencies and save
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
--reload is specified.",
Expand All @@ -1372,7 +1373,7 @@ fn check_subcommand() -> Command {
.long_about(
"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.",
)
Expand Down Expand Up @@ -1407,8 +1408,8 @@ fn compile_subcommand() -> Command {
.long_about(
"Compiles the given script into a self contained executable.
deno compile -A https://deno.land/std/http/file_server.ts
deno compile --output file_server https://deno.land/std/http/file_server.ts
deno compile -A jsr:@std/http/file-server
deno compile --output file_server jsr:@std/http/file-server
Any flags passed which affect runtime behavior, such as '--unstable',
'--allow-*', '--v8-flags', etc. are encoded into the output executable and
Expand Down Expand Up @@ -1900,7 +1901,7 @@ fn info_subcommand() -> Command {
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:
Expand Down Expand Up @@ -1949,12 +1950,12 @@ fn install_subcommand() -> Command {
.long_about(
"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
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:
- Attempt to take the file stem of the URL path. The above example would
Expand All @@ -1966,7 +1967,7 @@ The executable name is inferred by default:
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:
- --root option
Expand Down Expand Up @@ -2243,15 +2244,15 @@ ability to spawn subprocesses.
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:
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:
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.
Expand Down Expand Up @@ -2506,7 +2507,7 @@ maps remote specifiers to the downloaded files.
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
.arg(
Expand Down Expand Up @@ -3059,9 +3060,9 @@ fn reload_arg() -> Arg {
"Reload source code cache (recompile TypeScript)
--reload
Reload everything
--reload=https://deno.land/std
--reload=jsr:@std/http/file-server
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
--reload=npm:
Reload all npm modules
Expand Down Expand Up @@ -6772,18 +6773,15 @@ mod tests {

#[test]
fn install() {
let r = flags_from_vec(svec![
"deno",
"install",
"https://deno.land/std/http/file_server.ts"
]);
let r =
flags_from_vec(svec!["deno", "install", "jsr:@std/http/file-server"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Install(InstallFlags {
kind: InstallKind::Global(InstallFlagsGlobal {
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![],
root: None,
force: false,
Expand All @@ -6798,15 +6796,15 @@ mod tests {
"deno",
"install",
"-g",
"https://deno.land/std/http/file_server.ts"
"jsr:@std/http/file-server"
]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Install(InstallFlags {
kind: InstallKind::Global(InstallFlagsGlobal {
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![],
root: None,
force: false,
Expand All @@ -6821,14 +6819,14 @@ mod tests {
#[test]
fn install_with_flags() {
#[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!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Install(InstallFlags {
kind: InstallKind::Global(InstallFlagsGlobal {
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"],
root: Some("/foo".to_string()),
force: true,
Expand Down
4 changes: 2 additions & 2 deletions cli/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ pub enum CacheSetting {
/// This is the equivalent of `--reload` in the CLI.
ReloadAll,
/// Only some cached resources should be used. This is the equivalent of
/// `--reload=https://deno.land/std` or
/// `--reload=https://deno.land/std,https://deno.land/x/example`.
/// `--reload=jsr:@std/http/file-server` or
/// `--reload=jsr:@std/http/file-server,jsr:@std/assert/assert-equals`.
ReloadSome(Vec<String>),
/// The usability of a cached value is determined by analyzing the cached
/// headers and other metadata associated with a cached response, reloading
Expand Down
2 changes: 1 addition & 1 deletion cli/js/40_jupyter.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { core, internals } from "ext:core/mod.js";

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 = [
["&", "&amp;"],
["<", "&lt;"],
Expand Down
Loading

0 comments on commit c6f1107

Please sign in to comment.