File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -102,15 +102,19 @@ export async function generate(entryPoints: string | string[], options?: DtsOpti
102102
103103 const host = ts . createCompilerHost ( compilerOptions )
104104
105- // console.log('Debug:', {
106- // cwd,
107- // rootDir,
108- // outDir,
109- // entryPoints: Array.isArray(entryPoints) ? entryPoints : [entryPoints],
110- // })
105+ // Filter entry points to only include files within the current package
106+ const filteredEntryPoints = ( Array . isArray ( entryPoints ) ? entryPoints : [ entryPoints ] ) . filter ( ( entryPoint ) => {
107+ const relativePath = p . relative ( cwd , entryPoint )
108+ return ! relativePath . startsWith ( '..' ) && ! p . isAbsolute ( relativePath )
109+ } )
110+
111+ if ( filteredEntryPoints . length === 0 ) {
112+ console . warn ( 'No valid entry points found within the current package.' )
113+ return
114+ }
111115
112116 const program = ts . createProgram ( {
113- rootNames : Array . isArray ( entryPoints ) ? entryPoints : [ entryPoints ] ,
117+ rootNames : filteredEntryPoints ,
114118 options : compilerOptions ,
115119 host,
116120 } )
@@ -123,7 +127,6 @@ export async function generate(entryPoints: string | string[], options?: DtsOpti
123127 fs . mkdirSync ( dir , { recursive : true } )
124128 }
125129 fs . writeFileSync ( outputPath , data )
126- // console.log(`Generated: ${outputPath}`)
127130 }
128131 } )
129132
You can’t perform that action at this time.
0 commit comments