Skip to content

Commit

Permalink
Rename *.d.ts to *.d.mts. Close #17241
Browse files Browse the repository at this point in the history
  • Loading branch information
tamuratak committed Nov 11, 2023
1 parent 1b88aad commit 61ed77c
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 12 deletions.
File renamed without changes.
1 change: 1 addition & 0 deletions external/dist/legacy/web/pdf_viewer.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "../../types/web/pdf_viewer.component.js";
1 change: 0 additions & 1 deletion external/dist/legacy/web/pdf_viewer.d.ts

This file was deleted.

1 change: 1 addition & 0 deletions external/dist/web/pdf_viewer.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "../types/web/pdf_viewer.component.js";
1 change: 0 additions & 1 deletion external/dist/web/pdf_viewer.d.ts

This file was deleted.

10 changes: 5 additions & 5 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1846,11 +1846,11 @@ gulp.task(
return merge([
packageJson().pipe(gulp.dest(TYPESTEST_DIR)),
gulp
.src([
GENERIC_DIR + "build/pdf.mjs",
GENERIC_DIR + "build/pdf.worker.mjs",
])
.pipe(gulp.dest(TYPESTEST_DIR + "build/")),
.src("external/dist/**/*", {
base: "external/dist",
removeBOM: false,
})
.pipe(gulp.dest(TYPESTEST_DIR)),
gulp
.src(TYPES_DIR + "**/*", { base: TYPES_DIR })
.pipe(gulp.dest(TYPESTEST_DIR + "types/")),
Expand Down
23 changes: 23 additions & 0 deletions test/types/legacy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { getDocument } from "pdfjs-dist/legacy/build/pdf.mjs";
import { EventBus } from "pdfjs-dist/legacy/web/pdf_viewer.mjs";

class MainTest {
eventBus: EventBus;
task: ReturnType<typeof getDocument> | undefined;

constructor(public file: string) {
this.eventBus = new EventBus();
}

loadPdf() {
this.task = getDocument("file://" + this.file);
return this.task.promise;
}
}

// This is actually never called, as the test only consists in compiling the file.
// The compilation will crawl through all files and make sure that the types are consistent.
const mt = new MainTest("../pdfs/basicapi.pdf");
mt.loadPdf().then(() => {
console.log("loaded");
});
2 changes: 1 addition & 1 deletion test/types/main.ts → test/types/modern.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getDocument } from "pdfjs-dist";
import { EventBus } from "pdfjs-dist/web/pdf_viewer.component";
import { EventBus } from "pdfjs-dist/web/pdf_viewer.mjs";

class MainTest {
eventBus: EventBus;
Expand Down
6 changes: 6 additions & 0 deletions test/types/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "module",
"dependencies": {
"pdfjs-dist": "../../build/typestest/"
}
}
8 changes: 4 additions & 4 deletions test/types/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"outDir": "../../build/tmp",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"moduleResolution": "node10",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "ESNext",
Expand All @@ -17,10 +17,10 @@
],
"paths": {
"pdfjs-dist": ["../../build/typestest"],
"pdfjs-dist/*": ["../../build/typestest/types/*"]
"pdfjs-dist/*": ["../../build/typestest/*"]
}
},
"files": [
"main.ts"
"exclude": [
"node_modules"
]
}

0 comments on commit 61ed77c

Please sign in to comment.