1
- import type TSNode from "ts-node" ;
1
+ import TSNode from "ts-node" ;
2
2
import type { REGISTER_INSTANCE } from "ts-node" ;
3
3
import ts from "typescript" ;
4
4
import transformer from "./transformer" ;
@@ -7,11 +7,18 @@ import transformer from "./transformer";
7
7
// region: Helpers
8
8
/* ****************************************************************************************************************** */
9
9
10
+ type PluginExtended = ts . PluginImport & {
11
+ transform ?: string ;
12
+ after ?: boolean ;
13
+ before ?: boolean ;
14
+ afterDeclarations ?: boolean ;
15
+ } ;
16
+
10
17
function getProjectTransformerConfig ( pcl : ts . ParsedCommandLine ) {
11
- const plugins = pcl . options . plugins as Record < string , string > [ ] | undefined ;
18
+ const plugins = pcl . options . plugins as PluginExtended [ ] ;
12
19
if ( ! plugins ) return ;
13
20
14
- const res : { afterDeclarations ?: Record < string , string > ; before ?: Record < string , string > } = { } ;
21
+ const res : { afterDeclarations ?: PluginExtended ; before ?: PluginExtended } = { } ;
15
22
for ( const plugin of plugins ) {
16
23
if ( plugin . transform === "typescript-transform-paths" && ! plugin . after )
17
24
res [ plugin . afterDeclarations ? "afterDeclarations" : "before" ] = plugin ;
@@ -22,8 +29,8 @@ function getProjectTransformerConfig(pcl: ts.ParsedCommandLine) {
22
29
23
30
function getTransformers (
24
31
program ?: ts . Program ,
25
- beforeConfig ?: Record < string , string > ,
26
- afterDeclarationsConfig ?: Record < string , string > ,
32
+ beforeConfig ?: PluginExtended ,
33
+ afterDeclarationsConfig ?: PluginExtended ,
27
34
) : ts . CustomTransformers {
28
35
return {
29
36
...( beforeConfig && { before : [ transformer ( program , beforeConfig ) ] } ) ,
0 commit comments