File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import ts from 'typescript'
55
66interface TsOptions {
77 rootDir : string
8+ base : string
89 declaration : boolean
910 emitDeclarationOnly : boolean
1011 noEmit : boolean
@@ -14,6 +15,13 @@ interface TsOptions {
1415}
1516
1617interface DtsOptions {
18+ /**
19+ * The base directory of the source files. If not provided, it
20+ * will use the current working directory of the process.
21+ * @default process.cwd()
22+ */
23+ base ?: string
24+
1725 /**
1826 * The TypeScript compiler options. If not provided, it will use
1927 * the `tsconfig.json` file in the current working directory.
@@ -71,11 +79,13 @@ export async function generate(entryPoints: string | string[], options?: DtsOpti
7179 try {
7280 const configJson = ts . readConfigFile ( path , ts . sys . readFile ) . config
7381 const cwd = options ?. cwd ?? process . cwd ( )
82+ const base = options ?. base ?? cwd
7483 const rootDir = `${ cwd } /${ root } `
7584 const outDir = options ?. outdir ?? 'dist/types'
7685 const declarationMap = options ?. withSourceMap ?? false
7786
7887 const opts : TsOptions = {
88+ base,
7989 rootDir,
8090 outDir,
8191 declarationMap,
You can’t perform that action at this time.
0 commit comments