@@ -11,12 +11,12 @@ import {
1111 type Plugin ,
1212 type RolldownPluginOption ,
1313} from 'rolldown'
14- import { filename_js_to_dts , RE_JS } from 'rolldown-plugin-dts/internal'
1514import { importGlobPlugin } from 'rolldown/experimental'
1615import pkg from '../../package.json' with { type : 'json' }
1716import { mergeUserOptions } from '../config/options.ts'
1817import { importWithError , pkgExists } from '../utils/general.ts'
1918import { LogLevels } from '../utils/logger.ts'
19+ import { CjsDtsReexportPlugin } from './cjs.ts'
2020import { DepsPlugin } from './deps.ts'
2121import { NodeProtocolPlugin } from './node-protocol.ts'
2222import { resolveChunkAddon , resolveChunkFilename } from './output.ts'
@@ -343,31 +343,6 @@ function handlePluginInspect(plugins: RolldownPluginOption) {
343343 }
344344}
345345
346- export function CjsDtsReexportPlugin ( ) : Plugin {
347- return {
348- name : 'tsdown:cjs-dts-reexport' ,
349- generateBundle ( _options , bundle ) {
350- for ( const chunk of Object . values ( bundle ) ) {
351- if ( chunk . type !== 'chunk' ) continue
352-
353- if ( ! chunk . fileName . endsWith ( '.cjs' ) && ! chunk . fileName . endsWith ( '.js' ) )
354- continue
355-
356- const dMtsBasename = path . basename (
357- chunk . fileName . replace ( RE_JS , '.d.mts' ) ,
358- )
359- const content = `export type * from './${ dMtsBasename } '\n`
360-
361- this . emitFile ( {
362- type : 'prebuilt-chunk' ,
363- fileName : filename_js_to_dts ( chunk . fileName ) ,
364- code : content ,
365- } )
366- }
367- } ,
368- }
369- }
370-
371346export function CssGuardPlugin ( ) : Plugin {
372347 return {
373348 name : 'tsdown:css-guard' ,
0 commit comments