summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/flags.rs53
-rw-r--r--cli/installer.rs2
-rw-r--r--cli/program_state.rs2
-rw-r--r--cli/tests/doc/import_map.json (renamed from cli/tests/doc/importmap.json)0
-rw-r--r--cli/tests/doc/use_import_map.js (renamed from cli/tests/doc/use_importmap.js)0
-rw-r--r--cli/tests/doc/use_import_map.out (renamed from cli/tests/doc/use_importmap.out)0
-rw-r--r--cli/tests/import_map_no_unstable.out1
-rw-r--r--cli/tests/import_maps/import_map.json (renamed from cli/tests/importmaps/import_map.json)0
-rw-r--r--cli/tests/import_maps/lodash/lodash.ts (renamed from cli/tests/importmaps/lodash/lodash.ts)0
-rw-r--r--cli/tests/import_maps/lodash/other_file.ts (renamed from cli/tests/importmaps/lodash/other_file.ts)0
-rw-r--r--cli/tests/import_maps/moment/moment.ts (renamed from cli/tests/importmaps/moment/moment.ts)0
-rw-r--r--cli/tests/import_maps/moment/other_file.ts (renamed from cli/tests/importmaps/moment/other_file.ts)0
-rw-r--r--cli/tests/import_maps/scope/scoped.ts (renamed from cli/tests/importmaps/scope/scoped.ts)0
-rw-r--r--cli/tests/import_maps/scoped_moment.ts (renamed from cli/tests/importmaps/scoped_moment.ts)0
-rw-r--r--cli/tests/import_maps/test.ts (renamed from cli/tests/importmaps/test.ts)0
-rw-r--r--cli/tests/import_maps/vue.ts (renamed from cli/tests/importmaps/vue.ts)0
-rw-r--r--cli/tests/integration_tests.rs14
-rw-r--r--docs/getting_started/command_line_interface.md2
-rw-r--r--docs/linking_to_external_code/import_maps.md4
19 files changed, 40 insertions, 38 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index 63bad9f14..440c2aeea 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -468,7 +468,7 @@ fn eval_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
reload_arg_parse(flags, matches);
- importmap_arg_parse(flags, matches);
+ import_map_arg_parse(flags, matches);
ca_file_arg_parse(flags, matches);
let json = matches.is_present("json");
flags.subcommand = DenoSubcommand::Info {
@@ -499,7 +499,7 @@ fn lock_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
fn compile_args<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b> {
app
- .arg(importmap_arg())
+ .arg(import_map_arg())
.arg(no_remote_arg())
.arg(config_arg())
.arg(no_check_arg())
@@ -510,7 +510,7 @@ fn compile_args<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b> {
}
fn compile_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
- importmap_arg_parse(flags, matches);
+ import_map_arg_parse(flags, matches);
no_remote_arg_parse(flags, matches);
config_arg_parse(flags, matches);
no_check_arg_parse(flags, matches);
@@ -622,7 +622,7 @@ fn upgrade_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
}
fn doc_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
- importmap_arg_parse(flags, matches);
+ import_map_arg_parse(flags, matches);
reload_arg_parse(flags, matches);
let source_file = matches.value_of("source_file").map(String::from);
@@ -861,7 +861,7 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
.arg(ca_file_arg())
// TODO(lucacasonato): remove for 2.0
.arg(no_check_arg().hidden(true))
- .arg(importmap_arg())
+ .arg(import_map_arg())
.arg(
Arg::with_name("json")
.long("json")
@@ -954,7 +954,7 @@ Show documentation for runtime built-ins:
deno doc
deno doc --builtin Deno.Listener",
)
- .arg(importmap_arg())
+ .arg(import_map_arg())
.arg(reload_arg())
.arg(
Arg::with_name("json")
@@ -1320,9 +1320,10 @@ fn reload_arg_parse(flags: &mut Flags, matches: &ArgMatches) {
}
}
-fn importmap_arg<'a, 'b>() -> Arg<'a, 'b> {
- Arg::with_name("importmap")
- .long("importmap")
+fn import_map_arg<'a, 'b>() -> Arg<'a, 'b> {
+ Arg::with_name("import-map")
+ .long("import-map")
+ .alias("importmap")
.value_name("FILE")
.requires("unstable")
.help("UNSTABLE: Load import map file")
@@ -1336,8 +1337,8 @@ Examples: https://github.com/WICG/import-maps#the-import-map",
.takes_value(true)
}
-fn importmap_arg_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
- flags.import_map_path = matches.value_of("importmap").map(ToOwned::to_owned);
+fn import_map_arg_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
+ flags.import_map_path = matches.value_of("import-map").map(ToOwned::to_owned);
}
fn v8_flags_arg<'a, 'b>() -> Arg<'a, 'b> {
@@ -2082,7 +2083,7 @@ mod tests {
#[test]
fn eval_with_flags() {
#[rustfmt::skip]
- let r = flags_from_vec_safe(svec!["deno", "eval", "--unstable", "--importmap", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--reload", "--lock", "lock.json", "--lock-write", "--cert", "example.crt", "--cached-only", "--v8-flags=--help", "--seed", "1", "--inspect=127.0.0.1:9229", "42"]);
+ let r = flags_from_vec_safe(svec!["deno", "eval", "--unstable", "--import-map", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--reload", "--lock", "lock.json", "--lock-write", "--cert", "example.crt", "--cached-only", "--v8-flags=--help", "--seed", "1", "--inspect=127.0.0.1:9229", "42"]);
assert_eq!(
r.unwrap(),
Flags {
@@ -2139,7 +2140,7 @@ mod tests {
#[test]
fn repl_with_flags() {
#[rustfmt::skip]
- let r = flags_from_vec_safe(svec!["deno", "repl", "--unstable", "--importmap", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--reload", "--lock", "lock.json", "--lock-write", "--cert", "example.crt", "--cached-only", "--v8-flags=--help", "--seed", "1", "--inspect=127.0.0.1:9229"]);
+ let r = flags_from_vec_safe(svec!["deno", "repl", "--unstable", "--import-map", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--reload", "--lock", "lock.json", "--lock-write", "--cert", "example.crt", "--cached-only", "--v8-flags=--help", "--seed", "1", "--inspect=127.0.0.1:9229"]);
assert_eq!(
r.unwrap(),
Flags {
@@ -2356,12 +2357,12 @@ mod tests {
}
#[test]
- fn run_importmap() {
+ fn run_import_map() {
let r = flags_from_vec_safe(svec![
"deno",
"run",
"--unstable",
- "--importmap=importmap.json",
+ "--import-map=import_map.json",
"script.ts"
]);
assert_eq!(
@@ -2371,19 +2372,19 @@ mod tests {
script: "script.ts".to_string(),
},
unstable: true,
- import_map_path: Some("importmap.json".to_owned()),
+ import_map_path: Some("import_map.json".to_owned()),
..Flags::default()
}
);
}
#[test]
- fn info_importmap() {
+ fn info_import_map() {
let r = flags_from_vec_safe(svec![
"deno",
"info",
"--unstable",
- "--importmap=importmap.json",
+ "--import-map=import_map.json",
"script.ts"
]);
assert_eq!(
@@ -2394,19 +2395,19 @@ mod tests {
json: false,
},
unstable: true,
- import_map_path: Some("importmap.json".to_owned()),
+ import_map_path: Some("import_map.json".to_owned()),
..Flags::default()
}
);
}
#[test]
- fn cache_importmap() {
+ fn cache_import_map() {
let r = flags_from_vec_safe(svec![
"deno",
"cache",
"--unstable",
- "--importmap=importmap.json",
+ "--import-map=import_map.json",
"script.ts"
]);
assert_eq!(
@@ -2416,19 +2417,19 @@ mod tests {
files: svec!["script.ts"],
},
unstable: true,
- import_map_path: Some("importmap.json".to_owned()),
+ import_map_path: Some("import_map.json".to_owned()),
..Flags::default()
}
);
}
#[test]
- fn doc_importmap() {
+ fn doc_import_map() {
let r = flags_from_vec_safe(svec![
"deno",
"doc",
"--unstable",
- "--importmap=importmap.json",
+ "--import-map=import_map.json",
"script.ts"
]);
assert_eq!(
@@ -2441,7 +2442,7 @@ mod tests {
filter: None,
},
unstable: true,
- import_map_path: Some("importmap.json".to_owned()),
+ import_map_path: Some("import_map.json".to_owned()),
..Flags::default()
}
);
@@ -2527,7 +2528,7 @@ mod tests {
#[test]
fn install_with_flags() {
#[rustfmt::skip]
- let r = flags_from_vec_safe(svec!["deno", "install", "--unstable", "--importmap", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--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", "https://deno.land/std/http/file_server.ts", "foo", "bar"]);
+ let r = flags_from_vec_safe(svec!["deno", "install", "--unstable", "--import-map", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--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", "https://deno.land/std/http/file_server.ts", "foo", "bar"]);
assert_eq!(
r.unwrap(),
Flags {
diff --git a/cli/installer.rs b/cli/installer.rs
index 120facaf1..969572e1b 100644
--- a/cli/installer.rs
+++ b/cli/installer.rs
@@ -242,7 +242,7 @@ pub fn install(
if let Some(import_map_path) = flags.import_map_path {
let mut copy_path = file_path.clone();
copy_path.set_extension("import_map.json");
- executable_args.push("--importmap".to_string());
+ executable_args.push("--import-map".to_string());
executable_args.push(copy_path.to_str().unwrap().to_string());
extra_files.push((copy_path, fs::read_to_string(import_map_path)?));
}
diff --git a/cli/program_state.rs b/cli/program_state.rs
index c4dee3818..b921b6807 100644
--- a/cli/program_state.rs
+++ b/cli/program_state.rs
@@ -84,7 +84,7 @@ impl ProgramState {
None => None,
Some(file_path) => {
if !flags.unstable {
- exit_unstable("--importmap")
+ exit_unstable("--import-map")
}
Some(ImportMap::load(file_path)?)
}
diff --git a/cli/tests/doc/importmap.json b/cli/tests/doc/import_map.json
index 244a30296..244a30296 100644
--- a/cli/tests/doc/importmap.json
+++ b/cli/tests/doc/import_map.json
diff --git a/cli/tests/doc/use_importmap.js b/cli/tests/doc/use_import_map.js
index 672a7a7bd..672a7a7bd 100644
--- a/cli/tests/doc/use_importmap.js
+++ b/cli/tests/doc/use_import_map.js
diff --git a/cli/tests/doc/use_importmap.out b/cli/tests/doc/use_import_map.out
index 0b27ccf18..0b27ccf18 100644
--- a/cli/tests/doc/use_importmap.out
+++ b/cli/tests/doc/use_import_map.out
diff --git a/cli/tests/import_map_no_unstable.out b/cli/tests/import_map_no_unstable.out
new file mode 100644
index 000000000..4f202613e
--- /dev/null
+++ b/cli/tests/import_map_no_unstable.out
@@ -0,0 +1 @@
+Unstable API '--import-map'. The --unstable flag must be provided.
diff --git a/cli/tests/importmaps/import_map.json b/cli/tests/import_maps/import_map.json
index 601874aab..601874aab 100644
--- a/cli/tests/importmaps/import_map.json
+++ b/cli/tests/import_maps/import_map.json
diff --git a/cli/tests/importmaps/lodash/lodash.ts b/cli/tests/import_maps/lodash/lodash.ts
index 2ec04ed3c..2ec04ed3c 100644
--- a/cli/tests/importmaps/lodash/lodash.ts
+++ b/cli/tests/import_maps/lodash/lodash.ts
diff --git a/cli/tests/importmaps/lodash/other_file.ts b/cli/tests/import_maps/lodash/other_file.ts
index 714adae3f..714adae3f 100644
--- a/cli/tests/importmaps/lodash/other_file.ts
+++ b/cli/tests/import_maps/lodash/other_file.ts
diff --git a/cli/tests/importmaps/moment/moment.ts b/cli/tests/import_maps/moment/moment.ts
index 2b54a431e..2b54a431e 100644
--- a/cli/tests/importmaps/moment/moment.ts
+++ b/cli/tests/import_maps/moment/moment.ts
diff --git a/cli/tests/importmaps/moment/other_file.ts b/cli/tests/import_maps/moment/other_file.ts
index 24f3a0226..24f3a0226 100644
--- a/cli/tests/importmaps/moment/other_file.ts
+++ b/cli/tests/import_maps/moment/other_file.ts
diff --git a/cli/tests/importmaps/scope/scoped.ts b/cli/tests/import_maps/scope/scoped.ts
index 9a0b5d8e3..9a0b5d8e3 100644
--- a/cli/tests/importmaps/scope/scoped.ts
+++ b/cli/tests/import_maps/scope/scoped.ts
diff --git a/cli/tests/importmaps/scoped_moment.ts b/cli/tests/import_maps/scoped_moment.ts
index 9f67f88d4..9f67f88d4 100644
--- a/cli/tests/importmaps/scoped_moment.ts
+++ b/cli/tests/import_maps/scoped_moment.ts
diff --git a/cli/tests/importmaps/test.ts b/cli/tests/import_maps/test.ts
index 9b09e9953..9b09e9953 100644
--- a/cli/tests/importmaps/test.ts
+++ b/cli/tests/import_maps/test.ts
diff --git a/cli/tests/importmaps/vue.ts b/cli/tests/import_maps/vue.ts
index 76dbe1917..76dbe1917 100644
--- a/cli/tests/importmaps/vue.ts
+++ b/cli/tests/import_maps/vue.ts
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 0c11ea75e..f7edf5a42 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -1059,7 +1059,7 @@ fn bundle_import_map() {
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.arg("bundle")
- .arg("--importmap")
+ .arg("--import-map")
.arg(import_map_path)
.arg("--unstable")
.arg(import)
@@ -1957,7 +1957,7 @@ itest!(_031_info_ts_error {
itest!(_033_import_map {
args:
- "run --quiet --reload --importmap=importmaps/import_map.json --unstable importmaps/test.ts",
+ "run --quiet --reload --import-map=import_maps/import_map.json --unstable import_maps/test.ts",
output: "033_import_map.out",
});
@@ -1976,7 +1976,7 @@ itest!(_035_cached_only_flag {
itest!(_036_import_map_fetch {
args:
- "cache --quiet --reload --importmap=importmaps/import_map.json --unstable importmaps/test.ts",
+ "cache --quiet --reload --import-map=import_maps/import_map.json --unstable import_maps/test.ts",
output: "036_import_map_fetch.out",
});
@@ -2121,7 +2121,7 @@ itest!(_064_permissions_revoke_global {
itest!(_065_import_map_info {
args:
- "info --quiet --importmap=importmaps/import_map.json --unstable importmaps/test.ts",
+ "info --quiet --import-map=import_maps/import_map.json --unstable import_maps/test.ts",
output: "065_import_map_info.out",
});
@@ -2886,9 +2886,9 @@ itest!(deno_doc {
output: "deno_doc.out",
});
-itest!(deno_doc_importmap {
- args: "doc --unstable --importmap=doc/importmap.json doc/use_importmap.js",
- output: "doc/use_importmap.out",
+itest!(deno_doc_import_map {
+ args: "doc --unstable --import-map=doc/import_map.json doc/use_import_map.js",
+ output: "doc/use_import_map.out",
});
itest!(compiler_js_error {
diff --git a/docs/getting_started/command_line_interface.md b/docs/getting_started/command_line_interface.md
index adc984971..49f90a834 100644
--- a/docs/getting_started/command_line_interface.md
+++ b/docs/getting_started/command_line_interface.md
@@ -115,7 +115,7 @@ resolution, compilation configuration etc.
```
--config <FILE> Load tsconfig.json configuration file
---importmap <FILE> UNSTABLE: Load import map file
+--import-map <FILE> UNSTABLE: Load import map file
--no-remote Do not resolve remote modules
--reload=<CACHE_BLOCKLIST> Reload source code cache (recompile TypeScript)
--unstable Enable unstable APIs
diff --git a/docs/linking_to_external_code/import_maps.md b/docs/linking_to_external_code/import_maps.md
index 4ddbdbc10..72705fd61 100644
--- a/docs/linking_to_external_code/import_maps.md
+++ b/docs/linking_to_external_code/import_maps.md
@@ -5,7 +5,7 @@
Deno supports [import maps](https://github.com/WICG/import-maps).
-You can use import maps with the `--importmap=<FILE>` CLI flag.
+You can use import maps with the `--import-map=<FILE>` CLI flag.
Current limitations:
@@ -37,7 +37,7 @@ console.log(red("hello world"));
Then:
```shell
-$ deno run --importmap=import_map.json --unstable color.ts
+$ deno run --import-map=import_map.json --unstable color.ts
```
To use starting directory for absolute imports: