ReviewOS

also looking at this

stacks/dtsx

fix(generator): skip glob and relative entrypoints outside the root

#3126
Open mkantautas wants to merge fix/glob-entrypoint-outside-root into main
3 files +74 -2
packages/dtsx/src/generator.tsmodified+8-2
Changes to packages/dtsx/src/generator.ts
@@ -801,9 +801,15 @@ async function findFiles(config: DtsGenerationConfig): Promise<string[]> {
801801 absolute: true,
802802 onlyFiles: true,
803803 })) {
804 // Skip .d.ts files, node_modules, and excluded patterns
804 // Skip .d.ts files, node_modules, and excluded patterns. A pattern
805 // reaching above the root (`../*.ts`, `../index.ts`) matches files
806 // whose declarations would be written outside outdir; they are
807 // skipped as an absolute path outside the root is.
805808 if (isProcessableSourceFile(file) && !file.includes('node_modules')) {
806 if (!isExcluded(file, excludePatterns, rootPath)) {
809 if (!isWithinRoot(file, rootPath) && config.outputStructure !== 'flat') {
810 logger.warn(`Skipping entrypoint outside root: ${relative(config.cwd, file)}`)
811 }
812 else if (!isExcluded(file, excludePatterns, rootPath)) {
807813 files.push(file)
808814 }
809815 }