Skip to content

Commit f17f32a

Browse files
committedSep 7, 2021
fix: Fix d.ts compile issue.
1 parent f429045 commit f17f32a

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed
 

‎packages/tsbb/src/utils/compile.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function compile(
2121
try {
2222
await FS.remove(outDir);
2323
const dirToFiles = await recursiveReaddirFiles(path.dirname(entry), {
24-
exclude: /(tsconfig.json|.(test|spec).(ts|tsx|js|jsx))$/,
24+
exclude: /(tsconfig.json|.d.ts|.(test|spec).(ts|tsx|js|jsx))$/,
2525
});
2626
if (!disableBabel) {
2727
await Promise.all(

‎packages/tsbb/src/utils/watchCompile.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,26 @@ export async function watchCompile(
3030
watcher.on('change', async (filepath) => {
3131
if (esm) {
3232
const output = filepath.replace(entryDir, esm);
33-
if (!disableBabel && isMatch(output, ['**/*.[jt]s?(x)']) && !isMatch(output, ['**/?(*.)+(spec|test).[jt]s?(x)', '**/?(*.)+d.ts'])) {
33+
if (
34+
!disableBabel &&
35+
isMatch(output, ['**/*.[jt]s?(x)']) &&
36+
!isMatch(output, ['**/?(*.)+(spec|test).[jt]s?(x)', '**/*.d.ts'])
37+
) {
3438
transform(filepath, { entryDir, esm, ...other });
35-
} else if (!isMatch(output, ['**/?(*.)+(spec|test).[jt]s?(x)', 'tsconfig.json', '**/?(*.)+d.ts'])) {
39+
} else if (!isMatch(output, ['**/?(*.)+(spec|test).[jt]s?(x)', 'tsconfig.json', '**/*.d.ts'])) {
3640
const result = ts.sys.readFile(filepath);
3741
outputFiles(output, result);
3842
}
3943
}
4044
if (cjs) {
4145
const output = filepath.replace(entryDir, cjs);
42-
if (!disableBabel && isMatch(output, ['**/*.[jt]s?(x)']) && !isMatch(output, ['**/?(*.)+(spec|test).[jt]s?(x)', '**/?(*.)+d.ts'])) {
46+
if (
47+
!disableBabel &&
48+
isMatch(output, ['**/*.[jt]s?(x)']) &&
49+
!isMatch(output, ['**/?(*.)+(spec|test).[jt]s?(x)', '**/*.d.ts'])
50+
) {
4351
transform(filepath, { entryDir, cjs, ...other });
44-
} else if (!isMatch(output, ['**/?(*.)+(spec|test).[jt]s?(x)', 'tsconfig.json', '**/?(*.)+d.ts'])) {
52+
} else if (!isMatch(output, ['**/?(*.)+(spec|test).[jt]s?(x)', 'tsconfig.json', '**/*.d.ts'])) {
4553
const result = ts.sys.readFile(filepath);
4654
outputFiles(output, result);
4755
}

0 commit comments

Comments
 (0)
Please sign in to comment.