summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-11-01 19:04:54 -0400
committerGitHub <noreply@github.com>2023-11-01 23:04:54 +0000
commit58d543a480463ed24de77ec155f1d7e87bb7b234 (patch)
treeeffd93acd92a5bfe2a3422ecc30c3119d61bca14
parentab72019a17ccc077384c37eaeae15fffc9ce4d92 (diff)
fix(repl): jsxImportSource was not working (#21049)
I made some fixes in deno_ast to make this possible and we forgot to update this.
-rw-r--r--Cargo.lock4
-rw-r--r--cli/Cargo.toml2
-rw-r--r--cli/args/flags.rs4
-rw-r--r--cli/args/mod.rs4
-rw-r--r--cli/factory.rs2
-rw-r--r--cli/tests/integration/repl_tests.rs17
-rw-r--r--cli/tools/repl/session.rs6
7 files changed, 29 insertions, 10 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 06f4415f2..2f8e61d90 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1213,9 +1213,9 @@ dependencies = [
[[package]]
name = "deno_doc"
-version = "0.72.1"
+version = "0.72.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6bea5dacf0b7739d8e829e7c1ccd236929d9ff9a9fd63fb8aefb0c0b5e64fa86"
+checksum = "48c00aff446bb7a0b9ef34418420650ee803e41251c034b9a944538dc80f1b65"
dependencies = [
"anyhow",
"cfg-if",
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index c9eb3aa3c..52ceb7c7a 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -49,7 +49,7 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "dep_gra
deno_cache_dir = "=0.6.1"
deno_config = "=0.5.0"
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
-deno_doc = { version = "=0.72.1", features = ["html"] }
+deno_doc = { version = "=0.72.2", features = ["html"] }
deno_emit = "=0.31.1"
deno_graph = "=0.59.2"
deno_lint = { version = "=0.52.2", features = ["docs"] }
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index e558fe391..fa1534e0c 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -417,7 +417,7 @@ pub struct Flags {
pub reload: bool,
pub seed: Option<u64>,
pub unstable: bool,
- pub unstable_bare_node_builtlins: bool,
+ pub unstable_bare_node_builtins: bool,
pub unstable_byonm: bool,
pub unstable_features: Vec<String>,
pub unsafely_ignore_certificate_errors: Option<Vec<String>>,
@@ -856,7 +856,7 @@ pub fn flags_from_vec(args: Vec<String>) -> clap::error::Result<Flags> {
.push(deno_runtime::deno_cron::UNSTABLE_FEATURE_NAME.to_string());
}
- flags.unstable_bare_node_builtlins =
+ flags.unstable_bare_node_builtins =
matches.get_flag("unstable-bare-node-builtins");
flags.unstable_byonm = matches.get_flag("unstable-byonm");
diff --git a/cli/args/mod.rs b/cli/args/mod.rs
index 1d28df124..fa8d94de5 100644
--- a/cli/args/mod.rs
+++ b/cli/args/mod.rs
@@ -1249,8 +1249,8 @@ impl CliOptions {
self.flags.unstable
}
- pub fn unstable_bare_node_builtlins(&self) -> bool {
- self.flags.unstable_bare_node_builtlins
+ pub fn unstable_bare_node_builtins(&self) -> bool {
+ self.flags.unstable_bare_node_builtins
|| self
.maybe_config_file()
.as_ref()
diff --git a/cli/factory.rs b/cli/factory.rs
index 06c9472fa..037ba4e2f 100644
--- a/cli/factory.rs
+++ b/cli/factory.rs
@@ -392,7 +392,7 @@ impl CliFactory {
maybe_vendor_dir: self.options.vendor_dir_path(),
bare_node_builtins_enabled: self
.options
- .unstable_bare_node_builtlins(),
+ .unstable_bare_node_builtins(),
})))
})
.await
diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs
index fe075d37c..c161477d5 100644
--- a/cli/tests/integration/repl_tests.rs
+++ b/cli/tests/integration/repl_tests.rs
@@ -505,6 +505,23 @@ fn jsx_errors_without_pragma() {
}
#[test]
+fn jsx_import_source() {
+ let context = TestContextBuilder::default()
+ .use_temp_cwd()
+ .use_http_server()
+ .build();
+ context
+ .new_command()
+ .args_vec(["repl", "-A"])
+ .with_pty(|mut console| {
+ console.write_line("/** @jsxImportSource http://localhost:4545/jsx */");
+ console.expect("undefined");
+ console.write_line("const element = <div />;");
+ console.expect("undefined");
+ });
+}
+
+#[test]
fn type_error() {
util::with_pty(&["repl"], |mut console| {
console.write_line("console()");
diff --git a/cli/tools/repl/session.rs b/cli/tools/repl/session.rs
index 65f45652d..df9a63772 100644
--- a/cli/tools/repl/session.rs
+++ b/cli/tools/repl/session.rs
@@ -590,11 +590,11 @@ impl ReplSession {
imports_not_used_as_values: ImportsNotUsedAsValues::Preserve,
transform_jsx: true,
precompile_jsx: false,
- jsx_automatic: false,
+ jsx_automatic: self.jsx.import_source.is_some(),
jsx_development: false,
jsx_factory: self.jsx.factory.clone(),
jsx_fragment_factory: self.jsx.frag_factory.clone(),
- jsx_import_source: None,
+ jsx_import_source: self.jsx.import_source.clone(),
var_decl_imports: true,
})?
.text;
@@ -620,9 +620,11 @@ impl ReplSession {
if let Some(jsx) = analyzed_pragmas.jsx {
self.jsx.factory = jsx.text;
+ self.jsx.import_source = None;
}
if let Some(jsx_frag) = analyzed_pragmas.jsx_fragment {
self.jsx.frag_factory = jsx_frag.text;
+ self.jsx.import_source = None;
}
if let Some(jsx_import_source) = analyzed_pragmas.jsx_import_source {
self.jsx.import_source = Some(jsx_import_source.text);