Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett committed Oct 8, 2024
1 parent d523d9f commit d3977ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ parcel-macros = { git = "https://github.com/parcel-bundler/parcel.git", features
indexmap = "1.9.2"
rayon = "1.7.0"
crossbeam-channel = "0.5.6"
swc_core = { version = "0.89.6", features = [
swc_core = { version = "0.106", features = [
"common",
"common_ahash",
"common_sourcemap",
"common_concurrent",
"ecma_ast",
"ecma_parser",
"ecma_visit",
"ecma_transforms",
"ecma_codegen",
"ecma_utils"
] }
swc_error_reporters = "0.17.12"
swc_error_reporters = "1.0.0"

[build-dependencies]
napi-build = "2.0.1"
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const enum Type {
TS = 2,
TSX = 3
}
export function transform(ty: Type, code: string, callMacro: (...args: any[]) => any): object
export declare function transform(ty: Type, code: string, callMacro: (...args: any[]) => any): object
export interface TransformResult {
code: string
map: string
Expand Down
9 changes: 4 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::sync::{Arc, Mutex};
use swc_core::common::{BytePos, LineCol};
use swc_core::ecma::codegen::text_writer::JsWriter;
use swc_core::ecma::codegen::Emitter;
use swc_core::ecma::parser::EsConfig;
use swc_core::{common::errors::Handler, ecma::visit::FoldWith};
use swc_core::{
common::{
Expand All @@ -14,7 +13,7 @@ use swc_core::{
},
ecma::{
ast::{Module, ModuleItem, Program},
parser::{Parser, StringInput, Syntax, TsConfig},
parser::{EsSyntax, Parser, StringInput, Syntax, TsSyntax},
transforms::base::resolver,
},
};
Expand Down Expand Up @@ -61,19 +60,19 @@ fn transform_internal(
call_macro: MacroCallback,
) -> Result<TransformResult, napi::Error> {
let source_map = Lrc::new(SourceMap::default());
let source_file = source_map.new_source_file(FileName::Real("test.js".into()), code);
let source_file = source_map.new_source_file(Lrc::new(FileName::Real("test.js".into())), code);
let comments = SingleThreadedComments::default();
let mut parser = Parser::new(
match ty {
Type::JS | Type::JSX => {
Syntax::Es(EsConfig {
Syntax::Es(EsSyntax {
// always enable JSX in .js files?
jsx: true,
import_attributes: true,
..Default::default()
})
}
Type::TS | Type::TSX => Syntax::Typescript(TsConfig {
Type::TS | Type::TSX => Syntax::Typescript(TsSyntax {
tsx: matches!(ty, Type::TSX),
..Default::default()
}),
Expand Down

0 comments on commit d3977ab

Please sign in to comment.