Skip to content

Commit

Permalink
feat: add commonjs type definition file generation
Browse files Browse the repository at this point in the history
  • Loading branch information
grainrigi committed Sep 15, 2024
1 parent f15ef20 commit 6872b2c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rollup/bundle-pdfjs-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,9 @@ if (!fs.existsSync(targetDir)) {
fs.mkdirSync(targetDir);
}
fs.copyFileSync(path.join(__dirname, "../pdfparser.d.ts"), path.join(targetDir, "pdfparser.d.ts"));
// .d.cts should have "export =" instead of "export default"
const typeDefContent = fs.readFileSync(path.join(__dirname, "../pdfparser.d.ts"), "utf8");
fs.writeFileSync(
path.join(targetDir, "pdfparser.d.cts"),
typeDefContent.replace("export default", "export =")
);

0 comments on commit 6872b2c

Please sign in to comment.