Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(publish): support import equals #23421

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 43,7 @@ license = "MIT"
repository = "https://github.com/denoland/deno"

[workspace.dependencies]
deno_ast = { version = "=0.36.2", features = ["transpiling"] }
deno_ast = { version = "0.37.0", features = ["transpiling"] }
dsherret marked this conversation as resolved.
Show resolved Hide resolved
deno_core = { version = "0.275.0" }

deno_bench_util = { version = "0.141.0", path = "./bench_util" }
Expand Down
12 changes: 6 additions & 6 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 66,17 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposa
deno_cache_dir = { workspace = true }
deno_config = "=0.15.0"
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_doc = { version = "=0.123.1", features = ["html"] }
deno_emit = "=0.39.0"
deno_graph = { version = "=0.71.5", features = ["tokio_executor"] }
deno_lint = { version = "=0.58.2", features = ["docs"] }
deno_doc = { version = "0.124.0", features = ["html"] }
deno_emit = "0.39.1"
deno_graph = { version = "0.72.0", features = ["tokio_executor"] }
deno_lint = { version = "0.58.3", features = ["docs"] }
dsherret marked this conversation as resolved.
Show resolved Hide resolved
deno_lockfile.workspace = true
deno_npm = "=0.17.0"
deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_semver = "=0.5.4"
deno_task_shell = "=0.16.0"
deno_terminal.workspace = true
eszip = "=0.66.0"
eszip = "0.67.0"
dsherret marked this conversation as resolved.
Show resolved Hide resolved
napi_sym.workspace = true

async-trait.workspace = true
Expand All @@ -98,7 98,7 @@ dotenvy = "0.15.7"
dprint-plugin-json = "=0.19.2"
dprint-plugin-jupyter = "=0.1.3"
dprint-plugin-markdown = "=0.16.4"
dprint-plugin-typescript = "=0.90.1"
dprint-plugin-typescript = "0.90.2"
dsherret marked this conversation as resolved.
Show resolved Hide resolved
env_logger = "=0.10.0"
fancy-regex = "=0.10.0"
faster-hex.workspace = true
Expand Down
18 changes: 9 additions & 9 deletions cli/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 5,7 @@ use crate::cache::FastInsecureHasher;
use crate::cache::ParsedSourceCache;

use deno_ast::SourceMapOption;
use deno_ast::TranspileResult;
use deno_core::error::AnyError;
use deno_core::ModuleCodeString;
use deno_core::ModuleSpecifier;
Expand Down Expand Up @@ -32,7 33,7 @@ impl Emitter {
let transpile_and_emit_options_hash = {
let mut hasher = FastInsecureHasher::default();
hasher.write_hashable(&transpile_options);
hasher.write_hashable(emit_options);
hasher.write_hashable(&emit_options);
hasher.finish()
};
Self {
Expand Down Expand Up @@ -101,14 102,12 @@ impl Emitter {
media_type,
)?;
let transpiled_source = match parsed_source
.transpile_owned(&self.transpile_options, &self.emit_options)
.transpile(&self.transpile_options, &self.emit_options)?
{
Ok(result) => result?,
Err(parsed_source) => {
// transpile_owned is more efficient and should be preferred
TranspileResult::Owned(source) => source,
TranspileResult::Cloned(source) => {
debug_assert!(false, "Transpile owned failed.");
parsed_source
.transpile(&self.transpile_options, &self.emit_options)?
source
}
};
debug_assert!(transpiled_source.source_map.is_none());
Expand All @@ -135,10 134,11 @@ impl Emitter {
let parsed_source = self
.parsed_source_cache
.remove_or_parse_module(specifier, source_arc, media_type)?;
let mut options = self.emit_options;
let mut options = self.emit_options.clone();
options.source_map = SourceMapOption::None;
let transpiled_source = parsed_source
.transpile_owned_with_fallback(&self.transpile_options, &options)?;
.transpile(&self.transpile_options, &options)?
.into_source();
Ok(transpiled_source.text)
}

Expand Down
1 change: 1 addition & 0 deletions cli/tools/repl/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 640,7 @@ impl ReplSession {
keep_comments: false,
},
)?
.into_source()
.text;

let value = self
Expand Down
6 changes: 3 additions & 3 deletions runtime/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 96,7 @@ pub fn maybe_transpile_source(
maybe_syntax: None,
})?;
let transpiled_source = parsed
.transpile_owned(
.transpile(
&deno_ast::TranspileOptions {
imports_not_used_as_values: deno_ast::ImportsNotUsedAsValues::Remove,
..Default::default()
Expand All @@ -109,8 109,8 @@ pub fn maybe_transpile_source(
},
..Default::default()
},
)
.unwrap()?;
)?
.into_source();

let maybe_source_map: Option<SourceMapData> = transpiled_source
.source_map
Expand Down