Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for .d.mts and .d.cts files everywhere we check for .d.ts files #335

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/definitions-parser/src/lib/definition-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ function getTypingDataForSingleTypesVersion(
}
}
checkAllFilesUsed(ls, usedFiles, otherFiles, packageName, fs);
for (const untestedTypeFile of filter(otherFiles, name => name.endsWith(".d.ts"))) {
for (const untestedTypeFile of filter(otherFiles, name => name.endsWith(".d.ts") || name.endsWith(".d.mts") || name.endsWith(".d.cts"))) {
// add d.ts files from OTHER_FILES.txt in order get their dependencies
// tslint:disable-next-line:non-literal-fs-path -- Not a reference to the fs package
types.set(untestedTypeFile, createSourceFile(untestedTypeFile, fs.readFile(untestedTypeFile)));
Expand Down
2 changes: 1 addition & 1 deletion packages/definitions-parser/src/lib/module-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export function allReferencedFiles(
// tslint:disable-next-line:non-literal-fs-path -- Not a reference to the fs package
if (fs.exists(resolvedFilename)) {
const src = createSourceFile(resolvedFilename, readFileAndThrowOnBOM(resolvedFilename, fs));
if (resolvedFilename.endsWith(".d.ts")) {
if (resolvedFilename.endsWith(".d.ts") || resolvedFilename.endsWith(".d.mts") || resolvedFilename.endsWith(".d.cts")) {
types.set(resolvedFilename, src);
} else {
tests.set(resolvedFilename, src);
Expand Down
2 changes: 1 addition & 1 deletion packages/definitions-parser/src/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ export class TypingsData extends PackageBase {
return this.data.files;
}
get dtsFiles(): readonly string[] {
return this.data.files.filter(f => f.endsWith(".d.ts"));
return this.data.files.filter(f => f.endsWith(".d.ts") || f.endsWith(".d.mts") || f.endsWith(".d.cts"));
}
get license(): License {
return this.data.license;
Expand Down