@@ -164,101 +164,6 @@ const createAntTransform = (env) => [
164
164
`ant-${ env } `
165
165
] ;
166
166
167
- const carbonMapper = ( importName ) =>
168
- ( {
169
- StructuredListWrapper : 'StructuredList' ,
170
- StructuredListBody : 'StructuredList' ,
171
- StructuredListRow : 'StructuredList' ,
172
- StructuredListCell : 'StructuredList' ,
173
- ProgressStep : 'ProgressIndicator'
174
- } [ importName ] || importName ) ;
175
-
176
- const createCarbonCJSTransform = ( env ) => [
177
- 'transform-imports' ,
178
- {
179
- 'carbon-components-react' : {
180
- transform : ( importName ) => {
181
- let res ;
182
- const files = glob . sync (
183
- path . resolve ( __dirname , `../{..,carbon-component-mapper}/node_modules/carbon-components-react/${ env === 'cjs' ? 'lib' : 'es' } /**/${ carbonMapper ( importName ) } .js` )
184
- ) . filter ( path => ! path . includes ( '/next/' ) ) ;
185
- if ( files . length > 0 ) {
186
- res = files [ 0 ] ;
187
- } else {
188
- throw new Error ( `File with importName ${ importName } does not exist` ) ;
189
- }
190
-
191
- res = res . replace ( / ^ .* n o d e _ m o d u l e s \/ / , '' ) ;
192
- res = res . replace ( / ^ \/ / , '' ) ;
193
- return res ;
194
- } ,
195
- preventFullImport : false ,
196
- skipDefaultConversion : false
197
- } ,
198
- 'carbon-components-react/lib/components/StructuredList/StructuredList' : {
199
- transform : ( importName ) => {
200
- let res ;
201
- const files = glob . sync (
202
- path . resolve ( __dirname , `../{..,carbon-component-mapper}/node_modules/carbon-components-react/${ env === 'cjs' ? 'lib' : 'es' } /**/${ carbonMapper ( importName ) } .js` )
203
- ) . filter ( path => ! path . includes ( '/next/' ) ) ;
204
- if ( files . length > 0 ) {
205
- res = files [ 0 ] ;
206
- } else {
207
- throw new Error ( `File with importName ${ importName } does not exist` ) ;
208
- }
209
-
210
- res = res . replace ( / ^ .* n o d e _ m o d u l e s \/ / , '' ) ;
211
- res = res . replace ( / ^ \/ / , '' ) ;
212
- return res ;
213
- } ,
214
- preventFullImport : false ,
215
- skipDefaultConversion : true
216
- } ,
217
- 'carbon-components-react/lib/components/ProgressIndicator/ProgressIndicator' : {
218
- transform : ( importName ) => {
219
- let res ;
220
- const files = glob . sync (
221
- path . resolve ( __dirname , `../{..,carbon-component-mapper}/node_modules/carbon-components-react/${ env === 'cjs' ? 'lib' : 'es' } /**/${ carbonMapper ( importName ) } .js` )
222
- ) . filter ( path => ! path . includes ( '/next/' ) ) ;
223
- if ( files . length > 0 ) {
224
- res = files [ 0 ] ;
225
- } else {
226
- throw new Error ( `File with importName ${ importName } does not exist` ) ;
227
- }
228
-
229
- res = res . replace ( / ^ .* n o d e _ m o d u l e s \/ / , '' ) ;
230
- res = res . replace ( / ^ \/ / , '' ) ;
231
- return res ;
232
- } ,
233
- preventFullImport : false ,
234
- skipDefaultConversion : true
235
- } ,
236
- '@carbon/icons-react' : {
237
- transform : ( importName ) => {
238
- let size = importName . match ( / \d + / ) [ 0 ] ;
239
- let iconName = pascalToKebabCaseCarbonIcons ( importName . replace ( / \d + / , '' ) ) ;
240
-
241
- let res ;
242
- const files = glob . sync (
243
- path . resolve ( __dirname , `../{..,carbon-component-mapper}/node_modules/@carbon/icons-react/${ env === 'cjs' ? 'lib' : 'es' } /${ iconName } /${ size } .js` )
244
- ) ;
245
- if ( files . length > 0 ) {
246
- res = files [ 0 ] ;
247
- } else {
248
- throw new Error ( `File with importName ${ importName } does not exist` ) ;
249
- }
250
-
251
- res = res . replace ( / ^ .* n o d e _ m o d u l e s \/ / , '' ) ;
252
- res = res . replace ( / ^ \/ / , '' ) ;
253
- return res ;
254
- } ,
255
- preventFullImport : false ,
256
- skipDefaultConversion : false
257
- }
258
- } ,
259
- `carbon-components-react-${ env } `
260
- ] ;
261
-
262
167
const createReactJSSTransform = ( env ) => [
263
168
'transform-imports' ,
264
169
{
@@ -298,7 +203,6 @@ module.exports = {
298
203
createPfReactTransform ( 'js' ) ,
299
204
createBluePrintTransform ( 'cjs' ) ,
300
205
createAntTransform ( 'cjs' ) ,
301
- createCarbonCJSTransform ( 'cjs' ) ,
302
206
createReactJSSTransform ( 'cjs' )
303
207
]
304
208
} ,
@@ -310,7 +214,6 @@ module.exports = {
310
214
createPfReactTransform ( 'esm' ) ,
311
215
createBluePrintTransform ( 'esm' ) ,
312
216
createAntTransform ( 'esm' ) ,
313
- createCarbonCJSTransform ( 'esm' ) ,
314
217
createReactJSSTransform ( 'esm' )
315
218
]
316
219
}
0 commit comments