@swc-contrib/mut-cjs-exports 11.5.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -2
- package/src/local_export_strip.rs +7 -1
- package/src/utils.rs +11 -2
- package/swc_mut_cjs_exports.wasm +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc-contrib/mut-cjs-exports",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"url": "https://github.com/swc-project/plugins/issues"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@swc/core": "^1.10.0",
|
|
33
32
|
"@swc/jest": "^0.2.37",
|
|
34
33
|
"@types/jest": "^29.5.11",
|
|
35
34
|
"jest": "^29.7.0"
|
|
@@ -191,7 +191,13 @@ impl VisitMut for LocalExportStrip {
|
|
|
191
191
|
if let Some(exported) = exported {
|
|
192
192
|
let (export_name, export_name_span) = match exported {
|
|
193
193
|
ModuleExportName::Ident(Ident { span, sym, .. }) => (sym, span),
|
|
194
|
-
ModuleExportName::Str(Str { span, value, .. }) => (
|
|
194
|
+
ModuleExportName::Str(Str { span, value, .. }) => (
|
|
195
|
+
match value.as_atom() {
|
|
196
|
+
Some(s) => s.clone(),
|
|
197
|
+
None => panic!("non-utf8 export name: {value:?}"),
|
|
198
|
+
},
|
|
199
|
+
span,
|
|
200
|
+
),
|
|
195
201
|
};
|
|
196
202
|
|
|
197
203
|
(export_name, ExportItem::new(export_name_span, orig))
|
package/src/utils.rs
CHANGED
|
@@ -126,14 +126,23 @@ pub(crate) fn emit_export_stmts(exports: Ident, export: Export) -> Vec<Stmt> {
|
|
|
126
126
|
pub(crate) fn key_from_export_name(n: &ModuleExportName) -> (Atom, Span) {
|
|
127
127
|
match n {
|
|
128
128
|
ModuleExportName::Ident(ident) => (ident.sym.clone(), ident.span),
|
|
129
|
-
ModuleExportName::Str(s) => (
|
|
129
|
+
ModuleExportName::Str(s) => (
|
|
130
|
+
match s.value.as_atom() {
|
|
131
|
+
Some(s) => s.clone(),
|
|
132
|
+
None => panic!("non-utf8 export name: {:?}", s.value),
|
|
133
|
+
},
|
|
134
|
+
s.span,
|
|
135
|
+
),
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
138
|
|
|
133
139
|
pub(crate) fn local_ident_from_export_name(n: ModuleExportName) -> Ident {
|
|
134
140
|
let name = match n {
|
|
135
141
|
ModuleExportName::Ident(ident) => ident.sym,
|
|
136
|
-
ModuleExportName::Str(s) => s.value
|
|
142
|
+
ModuleExportName::Str(s) => match s.value.as_atom() {
|
|
143
|
+
Some(s) => s.clone(),
|
|
144
|
+
None => panic!("non-utf8 export name: {:?}", s.value),
|
|
145
|
+
},
|
|
137
146
|
};
|
|
138
147
|
|
|
139
148
|
match Ident::verify_symbol(&name) {
|
package/swc_mut_cjs_exports.wasm
CHANGED
|
Binary file
|