@@ -31,6 +31,8 @@ use swc_ecma_transforms_base::{
31
31
} ;
32
32
use swc_ecma_transforms_typescript:: typescript;
33
33
use swc_ecma_visit:: { Visit , VisitMutWith , VisitWith } ;
34
+ #[ cfg( feature = "wasm-bindgen" ) ]
35
+ use wasm_bindgen:: prelude:: * ;
34
36
35
37
#[ derive( Default , Deserialize ) ]
36
38
#[ serde( rename_all = "camelCase" ) ]
@@ -53,6 +55,17 @@ pub struct Options {
53
55
pub source_map : bool ,
54
56
}
55
57
58
+ #[ cfg( feature = "wasm-bindgen" ) ]
59
+ #[ wasm_bindgen( typescript_custom_section) ]
60
+ const Type_Options : & ' static str = r#"
61
+ interface Options {
62
+ module?: boolean;
63
+ filename?: string;
64
+ mode?: Mode;
65
+ sourceMap?: boolean;
66
+ }
67
+ "# ;
68
+
56
69
#[ derive( Debug , Default , Deserialize ) ]
57
70
#[ serde( rename_all = "kebab-case" ) ]
58
71
pub enum Mode {
@@ -61,6 +74,12 @@ pub enum Mode {
61
74
Transform ,
62
75
}
63
76
77
+ #[ cfg( feature = "wasm-bindgen" ) ]
78
+ #[ wasm_bindgen( typescript_custom_section) ]
79
+ const Type_Mode : & ' static str = r#"
80
+ type Mode = "strip-only" | "transform";
81
+ "# ;
82
+
64
83
fn default_ts_syntax ( ) -> TsSyntax {
65
84
TsSyntax {
66
85
decorators : true ,
@@ -74,6 +93,15 @@ pub struct TransformOutput {
74
93
pub map : Option < String > ,
75
94
}
76
95
96
+ #[ cfg( feature = "wasm-bindgen" ) ]
97
+ #[ wasm_bindgen( typescript_custom_section) ]
98
+ const Type_TransformOutput : & ' static str = r#"
99
+ interface TransformOutput {
100
+ code: string;
101
+ map?: string;
102
+ }
103
+ "# ;
104
+
77
105
pub fn operate (
78
106
cm : & Lrc < SourceMap > ,
79
107
handler : & Handler ,
0 commit comments