summaryrefslogtreecommitdiff
path: root/cli/state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/state.rs')
-rw-r--r--cli/state.rs21
1 files changed, 15 insertions, 6 deletions
diff --git a/cli/state.rs b/cli/state.rs
index 40662b563..32c027c03 100644
--- a/cli/state.rs
+++ b/cli/state.rs
@@ -240,15 +240,19 @@ impl State {
// stack trace in JS.
let s = self.0.borrow();
if !s.global_state.flags.unstable {
- eprintln!(
- "Unstable API '{}'. The --unstable flag must be provided.",
- api_name
- );
- std::process::exit(70);
+ exit_unstable(api_name);
}
}
}
+fn exit_unstable(api_name: &str) {
+ eprintln!(
+ "Unstable API '{}'. The --unstable flag must be provided.",
+ api_name
+ );
+ std::process::exit(70);
+}
+
impl ModuleLoader for State {
fn resolve(
&self,
@@ -318,7 +322,12 @@ impl State {
let import_map: Option<ImportMap> =
match global_state.flags.import_map_path.as_ref() {
None => None,
- Some(file_path) => Some(ImportMap::load(file_path)?),
+ Some(file_path) => {
+ if !global_state.flags.unstable {
+ exit_unstable("--importmap")
+ }
+ Some(ImportMap::load(file_path)?)
+ }
};
let seeded_rng = match global_state.flags.seed {