@@ -61,47 +61,40 @@ const moveTypescriptDeclarationsPlugin = (packagePath) => ({
61
61
}
62
62
} ) ;
63
63
64
- const files = [
65
- // custom handling for StimulusBundle
66
- 'src/StimulusBundle/assets/src/loader.ts' ,
67
- 'src/StimulusBundle/assets/src/controllers.ts' ,
68
- ...glob . sync ( 'src/*/assets/src/*controller.ts' ) ,
69
- ]
70
- module . exports = files . map ( ( file ) => {
71
- const packageRoot = path . join ( file , '..' , '..' ) ;
72
- const packagePath = path . join ( packageRoot , 'package.json' ) ;
73
- const packageData = JSON . parse ( fs . readFileSync ( packagePath , 'utf8' ) ) ;
74
- const peerDependencies = [
75
- '@hotwired/stimulus' ,
76
- ...( packageData . peerDependencies ? Object . keys ( packageData . peerDependencies ) : [ ] )
77
- ] ;
64
+ const file = process . env . INPUT_FILE ;
65
+ const packageRoot = path . join ( file , '..' , '..' ) ;
66
+ const packagePath = path . join ( packageRoot , 'package.json' ) ;
67
+ const packageData = JSON . parse ( fs . readFileSync ( packagePath , 'utf8' ) ) ;
68
+ const peerDependencies = [
69
+ '@hotwired/stimulus' ,
70
+ ...( packageData . peerDependencies ? Object . keys ( packageData . peerDependencies ) : [ ] )
71
+ ] ;
78
72
79
- // custom handling for StimulusBundle
80
- if ( file . includes ( 'StimulusBundle/assets/src/loader.ts' ) ) {
81
- peerDependencies . push ( './controllers.js' ) ;
82
- }
73
+ // custom handling for StimulusBundle
74
+ if ( file . includes ( 'StimulusBundle/assets/src/loader.ts' ) ) {
75
+ peerDependencies . push ( './controllers.js' ) ;
76
+ }
83
77
84
- return {
85
- input : file ,
86
- output : {
87
- file : path . join ( packageRoot , 'dist' , path . basename ( file , '.ts' ) + '.js' ) ,
88
- format : 'esm' ,
89
- } ,
90
- external : peerDependencies ,
91
- plugins : [
92
- resolve ( ) ,
93
- typescript ( {
94
- filterRoot : packageRoot ,
95
- include : [ 'src/**/*.ts' ] ,
96
- compilerOptions : {
97
- outDir : 'dist' ,
98
- declaration : true ,
99
- emitDeclarationOnly : true ,
100
- }
101
- } ) ,
102
- commonjs ( ) ,
103
- wildcardExternalsPlugin ( peerDependencies ) ,
104
- moveTypescriptDeclarationsPlugin ( packageRoot ) ,
105
- ] ,
106
- } ;
107
- } ) ;
78
+ module . exports = {
79
+ input : file ,
80
+ output : {
81
+ file : path . join ( packageRoot , 'dist' , path . basename ( file , '.ts' ) + '.js' ) ,
82
+ format : 'esm' ,
83
+ } ,
84
+ external : peerDependencies ,
85
+ plugins : [
86
+ resolve ( ) ,
87
+ typescript ( {
88
+ filterRoot : packageRoot ,
89
+ include : [ 'src/**/*.ts' ] ,
90
+ compilerOptions : {
91
+ outDir : 'dist' ,
92
+ declaration : true ,
93
+ emitDeclarationOnly : true ,
94
+ }
95
+ } ) ,
96
+ commonjs ( ) ,
97
+ wildcardExternalsPlugin ( peerDependencies ) ,
98
+ moveTypescriptDeclarationsPlugin ( packageRoot ) ,
99
+ ] ,
100
+ } ;
0 commit comments