Skip to content

Commit

Permalink
fix: changed to have exclude options take precedence over comment dir…
Browse files Browse the repository at this point in the history
…ectives
  • Loading branch information
imjuni committed Aug 19, 2024
1 parent 02593fd commit c19c68d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
16 changes: 9 additions & 7 deletions src/modules/commands/bundling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,16 @@ export async function bundling(buildOptions: TCommandBuildOptions, bundleOption:
project,
filePaths,
keyword: CE_INLINE_COMMENT_KEYWORD.FILE_DECLARATION_KEYWORD,
}).filter((declaration) => {
const sourceFile = project.getSourceFile(declaration.filePath);
if (sourceFile == null) {
return false;
}
})
.filter((declaration) => !exclude.isExclude(declaration.filePath))
.filter((declaration) => {
const sourceFile = project.getSourceFile(declaration.filePath);
if (sourceFile == null) {
return false;
}

return isDeclarationFile(sourceFile);
});
return isDeclarationFile(sourceFile);
});

const filenames = filePaths
.filter((filename) => include.isInclude(filename))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('getInlineDeclarationRenderData', () => {
tag: '@ctix-declaration',
pos: { line: 0, column: 0, start: 0 },
workspaces: undefined,
relativePath: '../c/d/a.ts',
relativePath: '../c/d/a',
extname: { origin: '.ts', render: '.js' },
},
{
Expand All @@ -52,7 +52,7 @@ describe('getInlineDeclarationRenderData', () => {
tag: '@ctix-declaration',
pos: { line: 0, column: 0, start: 0 },
workspaces: undefined,
relativePath: '../c/e/b.ts',
relativePath: '../c/e/b',
extname: { origin: '.ts', render: '.js' },
},
]);
Expand Down Expand Up @@ -95,7 +95,7 @@ describe('getInlineDeclarationRenderData', () => {
tag: '@ctix-declaration',
pos: { line: 0, column: 0, start: 0 },
workspaces: undefined,
relativePath: `./${pathe.join(process.cwd(), '/a/b/c/d/a.ts')}`,
relativePath: `./${pathe.join(process.cwd(), '/a/b/c/d/a')}`,
extname: { origin: '.ts', render: '.js' },
},
{
Expand All @@ -104,7 +104,7 @@ describe('getInlineDeclarationRenderData', () => {
tag: '@ctix-declaration',
pos: { line: 0, column: 0, start: 0 },
workspaces: undefined,
relativePath: `./${pathe.join(process.cwd(), '/a/b/c/e/b.ts')}`,
relativePath: `./${pathe.join(process.cwd(), '/a/b/c/e/b')}`,
extname: { origin: '.ts', render: '.js' },
},
]);
Expand Down
6 changes: 2 additions & 4 deletions src/templates/modules/getInlineDeclarationRenderData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ export function getInlineDeclarationRenderData(

const relativePath =
options.output != null
? addCurrentDirPrefix(
posixRelative(options.output, pathe.join(dirname, `${basename}${extname}`)),
)
: replaceSepToPosix(`.${path.posix.sep}${pathe.join(dirname, `${basename}${extname}`)}`);
? addCurrentDirPrefix(posixRelative(options.output, pathe.join(dirname, basename)))
: replaceSepToPosix(`.${path.posix.sep}${pathe.join(dirname, basename)}`);

return {
...declaration,
Expand Down

0 comments on commit c19c68d

Please sign in to comment.