1
+ import path from 'node:path' ;
1
2
import terser from '@rollup/plugin-terser' ;
2
3
import typescript from '@rollup/plugin-typescript' ;
3
4
import { externalsForPlugin } from '../configs/externals.mjs' ;
4
5
import { apiExtractor } from '../transforms/api-extractor.mjs' ;
5
6
import { nodeCoverageDisable } from '../transforms/node-coverage-disable.mjs' ;
7
+ import { move } from '../transforms/move.mjs' ;
6
8
7
9
export function packageTypescript ( options ) {
8
10
options = options || { } ;
9
11
return [
10
12
{
11
- input : 'src/ index.ts' ,
13
+ input : path . join ( 'src' , ' index.ts') ,
12
14
output : [
13
- { file : 'dist/ index.cjs' , format : 'cjs' , sourcemap : false , exports : 'auto' } ,
15
+ { file : path . join ( 'dist' , ' index.cjs') , format : 'cjs' , sourcemap : false , exports : 'auto' } ,
14
16
] ,
15
17
external : externalsForPlugin ,
16
18
plugins : [
@@ -32,9 +34,9 @@ export function packageTypescript(options) {
32
34
] ,
33
35
} ,
34
36
{
35
- input : 'src/ index.ts' ,
37
+ input : path . join ( 'src' , ' index.ts') ,
36
38
output : [
37
- { file : 'dist/ index.mjs' , format : 'esm' , sourcemap : false , exports : 'auto' } ,
39
+ { file : path . join ( 'dist' , '_types' , ' index.mjs') , format : 'esm' , sourcemap : false , exports : 'auto' } ,
38
40
] ,
39
41
external : externalsForPlugin ,
40
42
plugins : [
@@ -53,6 +55,10 @@ export function packageTypescript(options) {
53
55
keep_fnames : true ,
54
56
} ) ,
55
57
options . nodeCoverageDisable ? nodeCoverageDisable ( ) : undefined ,
58
+ move (
59
+ path . join ( 'dist' , '_types' , 'index.mjs' ) ,
60
+ path . join ( 'dist' , 'index.mjs' ) ,
61
+ ) ,
56
62
apiExtractor ( ) ,
57
63
] ,
58
64
} ,
0 commit comments