Skip to content

Commit

Permalink
fix: update swc_ecma_transforms_typescript 0.197 (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret authored Aug 24, 2024
1 parent 61cc2f4 commit 6b2dc3a
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 29 deletions.
36 changes: 18 additions & 18 deletions Cargo.lock

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

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ base64 = { version = "0.21.6", optional = true }
deno_media_type = "0.1.4"
deno_terminal = "0.1.1"

dprint-swc-ext = "0.19.0"
dprint-swc-ext = "0.20.0"
once_cell = "1.19.0"
percent-encoding = "2.3.1"
serde = { version = "1.0.144", features = ["derive"] }
Expand All @@ -49,26 +49,26 @@ unicode-width = "0.1.13" # 0.1.13 because control characters have a width of 1 t
#
# NOTE: You can automatically update these dependencies by running ./scripts/update_swc_deps.ts
swc_atoms = "=0.6.7"
swc_common = "=0.37.2"
swc_common = "=0.37.5"
swc_config = { version = "=0.1.15", optional = true }
swc_config_macro = { version = "=0.1.4", optional = true }
swc_ecma_ast = { version = "=0.118.1", features = ["serde-impl"] }
swc_ecma_ast = { version = "=0.118.2", features = ["serde-impl"] }
swc_ecma_codegen = { version = "=0.155.0", optional = true }
swc_ecma_codegen_macros = { version = "=0.7.7", optional = true }
swc_ecma_loader = { version = "=0.49.1", optional = true }
swc_ecma_parser = "=0.149.0"
swc_ecma_parser = "=0.149.1"
swc_ecma_transforms_base = { version = "=0.144.0", optional = true }
swc_ecma_transforms_classes = { version = "=0.133.0", optional = true }
swc_ecma_transforms_compat = { version = "=0.170.0", optional = true }
swc_ecma_transforms_macros = { version = "=0.5.5", optional = true }
swc_ecma_transforms_optimization = { version = "=0.205.0", optional = true }
swc_ecma_transforms_proposal = { version = "=0.178.0", optional = true }
swc_ecma_transforms_optimization = { version = "=0.207.1", optional = true }
swc_ecma_transforms_proposal = { version = "=0.178.1", optional = true }
swc_ecma_transforms_react = { version = "=0.190.0", optional = true }
swc_ecma_transforms_typescript = { version = "=0.195.1", optional = true }
swc_ecma_transforms_typescript = { version = "=0.197.3", optional = true }
swc_ecma_utils = { version = "=0.134.1", optional = true }
swc_ecma_visit = { version = "=0.104.5", optional = true }
swc_ecma_visit = { version = "=0.104.8", optional = true }
swc_eq_ignore_macros = "=0.1.4"
swc_bundler = { version = "=0.234.0", optional = true }
swc_bundler = { version = "=0.236.0", optional = true }
swc_graph_analyzer = { version = "=0.26.0", optional = true }
swc_macros_common = { version = "=0.3.13", optional = true }
swc_trace_macro = { version = "=0.1.3", optional = true }
Expand Down
11 changes: 11 additions & 0 deletions src/parsed_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::sync::Arc;
use dprint_swc_ext::common::SourceRange;
use dprint_swc_ext::common::SourceRanged;
use dprint_swc_ext::common::SourceTextInfo;
use dprint_swc_ext::common::SourceTextProvider;
use dprint_swc_ext::common::StartSourcePos;
use swc_common::Mark;

Expand Down Expand Up @@ -253,6 +254,16 @@ impl ParsedSource {
}
}

impl<'a> SourceTextProvider<'a> for &'a ParsedSource {
fn text(&self) -> &'a Arc<str> {
ParsedSource::text(self)
}

fn start_pos(&self) -> StartSourcePos {
StartSourcePos::START_SOURCE_POS
}
}

impl SourceRanged for ParsedSource {
fn start(&self) -> dprint_swc_ext::common::SourcePos {
StartSourcePos::START_SOURCE_POS.as_source_pos()
Expand Down
4 changes: 2 additions & 2 deletions src/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,10 +703,10 @@ function _bar(...Foo: Foo) {

#[test]
fn should_diganotic_when_var_stmts_sep_by_comma() {
let diagnostic = parse_for_diagnostic("let a = 0, let b = 1;");
let diagnostic = parse_ts_module("let a = 0, let b = 1;").err().unwrap();
assert_eq!(
diagnostic.message().to_string(),
"`let` cannot be used as an identifier in strict mode"
"Unexpected token `let`. Expected let is reserved in const, let, class declaration"
);
}

Expand Down
1 change: 1 addition & 0 deletions src/transpiling/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ impl TranspileOptions {
// Do not opt into swc's optimization to inline enum member values
// in the same module as it might cause bugs in certain code.
ts_enum_is_mutable: true,
native_class_properties: false,
}
}
}
Expand Down

0 comments on commit 6b2dc3a

Please sign in to comment.