diff --git a/CHANGELOG.md b/CHANGELOG.md index 27f7db5..f08fd28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.6.1] - 2026-03-08 + +### Fixed + +- TypeScript declaration files (`.d.ts`) for the public API were missing + from the published package, breaking type resolution for consumers. + ## [0.6.0] - 2026-02-28 ### Added @@ -318,6 +325,7 @@ a build error. Do to npm's policy, the version number cannot be reused. First public version. +[0.6.1]: https://github.com/eclipsesource/pdf-maker/releases/tag/v0.6.1 [0.6.0]: https://github.com/eclipsesource/pdf-maker/releases/tag/v0.6.0 [0.1.0]: https://github.com/eclipsesource/pdf-maker/releases/tag/v0.1.0 [0.2.0]: https://github.com/eclipsesource/pdf-maker/releases/tag/v0.2.0 diff --git a/package-lock.json b/package-lock.json index e982052..255d6ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pdfmkr", - "version": "0.6.0", + "version": "0.6.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pdfmkr", - "version": "0.6.0", + "version": "0.6.1", "license": "MIT", "dependencies": { "@ralfstx/pdf-core": "^0.1.0" @@ -1183,7 +1183,6 @@ "integrity": "sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~7.16.0" } @@ -1233,7 +1232,6 @@ "integrity": "sha512-hM5faZwg7aVNa819m/5r7D0h0c9yC4DUlWAOvHAtISdFTc8xB86VmX5Xqabrama3wIPJ/q9RbGS1worb6JfnMg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.50.1", "@typescript-eslint/types": "8.50.1", @@ -1607,7 +1605,6 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2342,7 +2339,6 @@ "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -3979,7 +3975,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -4715,7 +4710,6 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -4790,7 +4784,6 @@ "integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", @@ -4866,7 +4859,6 @@ "integrity": "sha512-E4t7DJ9pESL6E3I8nFjPa4xGUd3PmiWDLsDztS2qXSJWfHtbQnwAWylaBvSNY48I3vr8PTqIZlyK8TE3V3CA4Q==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@vitest/expect": "4.0.16", "@vitest/mocker": "4.0.16", diff --git a/package.json b/package.json index d60eac5..91a15bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfmkr", - "version": "0.6.0", + "version": "0.6.1", "description": "Generate PDF documents from JavaScript objects", "license": "MIT", "repository": { @@ -25,7 +25,7 @@ "npm": ">=10" }, "scripts": { - "build": "rm -rf build/ dist/ && tsc -p tsconfig.build.json && esbuild src/index.ts --bundle --sourcemap --platform=browser --target=es2022 --outdir=dist --format=esm --external:@ralfstx/pdf-core && cp -a build/index.d.ts build/api/ dist/", + "build": "./scripts/build.sh", "lint": "eslint . --max-warnings=0 && prettier --check .", "test": "vitest run test", "verify": "npm run lint && npm run test && npm run examples && npm run build", diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..c21b484 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -e + +cd "$(dirname "$0")/.." + +rm -rf build/ dist/ + +# Generate declaration files +tsc -p tsconfig.build.json + +# Bundle the library +esbuild src/index.ts \ + --bundle \ + --sourcemap \ + --platform=browser \ + --target=es2022 \ + --outdir=dist \ + --format=esm \ + --external:@ralfstx/pdf-core + +# Copy declaration files to dist +cp build/index.d.ts dist/ +cp -a build/api dist/api + +# Verify that all references in dist/index.d.ts resolve +node scripts/check-dist.ts diff --git a/scripts/check-dist.ts b/scripts/check-dist.ts new file mode 100644 index 0000000..ad4d7ff --- /dev/null +++ b/scripts/check-dist.ts @@ -0,0 +1,33 @@ +/** + * Verifies that all module references in dist/index.d.ts resolve to + * existing files. Catches packaging bugs where declaration files are + * missing from the dist/ directory. + */ +import { existsSync, readFileSync } from 'node:fs'; +import { dirname, resolve } from 'node:path'; + +const indexDts = 'dist/index.d.ts'; +const content = readFileSync(indexDts, 'utf-8'); +const dir = dirname(indexDts); + +// Match all from/import specifiers that are relative paths +const pattern = /from\s+['"](\.[^'"]+)['"]/g; +const errors: string[] = []; + +for (const match of content.matchAll(pattern)) { + const specifier = match[1]; + // TypeScript resolves ./foo.ts to ./foo.d.ts in declaration files + const resolved = specifier.replace(/\.ts$/, '.d.ts'); + const fullPath = resolve(dir, resolved); + if (!existsSync(fullPath)) { + errors.push(`${indexDts}: unresolved reference '${specifier}' (expected ${fullPath})`); + } +} + +if (errors.length > 0) { + console.error('dist check failed:'); + for (const error of errors) { + console.error(` ${error}`); + } + process.exit(1); +}