| import pkg from './package.json' with { type: 'json' }; | ||
| import { babel } from '@rollup/plugin-babel'; | ||
| import copy from 'rollup-plugin-copy'; | ||
| const external = [ | ||
| 'stream', | ||
| 'fs', | ||
| 'zlib', | ||
| 'fontkit', | ||
| 'events', | ||
| 'linebreak', | ||
| 'png-js', | ||
| 'js-md5', | ||
| '@noble/hashes/utils', | ||
| '@noble/hashes/sha256', | ||
| '@noble/ciphers/aes', | ||
| 'crypto', | ||
| 'saslprep', | ||
| ]; | ||
| const supportedBrowsers = [ | ||
| 'Firefox 115', // ESR from 2023 | ||
| 'iOS 16', // from 2022 | ||
| 'Safari 16', // from 2022 | ||
| ]; | ||
| export default [ | ||
| // CommonJS build for Node | ||
| { | ||
| input: 'lib/document.js', | ||
| external, | ||
| output: { | ||
| name: 'pdfkit', | ||
| file: pkg.main, | ||
| format: 'cjs', | ||
| sourcemap: true, | ||
| interop: 'default', | ||
| }, | ||
| plugins: [ | ||
| babel({ | ||
| babelHelpers: 'bundled', | ||
| babelrc: false, | ||
| presets: [ | ||
| [ | ||
| '@babel/preset-env', | ||
| { | ||
| modules: false, | ||
| targets: { | ||
| node: '20', | ||
| }, | ||
| }, | ||
| ], | ||
| ], | ||
| comments: false, | ||
| }), | ||
| copy({ | ||
| targets: [ | ||
| { | ||
| src: ['lib/font/data/*.afm', 'lib/mixins/data/*.icc'], | ||
| dest: 'js/data', | ||
| }, | ||
| ], | ||
| }), | ||
| ], | ||
| }, | ||
| // ES for green browsers | ||
| { | ||
| input: 'lib/document.js', | ||
| external, | ||
| output: { | ||
| name: 'pdfkit.es', | ||
| file: pkg.module, | ||
| format: 'es', | ||
| sourcemap: true, | ||
| }, | ||
| plugins: [ | ||
| babel({ | ||
| babelHelpers: 'bundled', | ||
| babelrc: false, | ||
| presets: [ | ||
| [ | ||
| '@babel/preset-env', | ||
| { | ||
| modules: false, | ||
| bugfixes: true, | ||
| targets: { | ||
| browsers: supportedBrowsers, | ||
| }, | ||
| }, | ||
| ], | ||
| ], | ||
| comments: false, | ||
| }), | ||
| ], | ||
| }, | ||
| { | ||
| input: 'lib/virtual-fs.js', | ||
| external, | ||
| output: { | ||
| name: 'virtual-fs', | ||
| file: 'js/virtual-fs.js', | ||
| format: 'es', | ||
| sourcemap: false, | ||
| }, | ||
| plugins: [ | ||
| babel({ | ||
| babelHelpers: 'bundled', | ||
| babelrc: false, | ||
| presets: [ | ||
| [ | ||
| '@babel/preset-env', | ||
| { | ||
| loose: true, | ||
| modules: false, | ||
| targets: { | ||
| browsers: supportedBrowsers, | ||
| }, | ||
| }, | ||
| ], | ||
| ], | ||
| }), | ||
| ], | ||
| }, | ||
| ]; |
| import { defineConfig } from 'vitest/config'; | ||
| export default defineConfig({ | ||
| test: { | ||
| globals: true, | ||
| environment: 'node', | ||
| include: ['tests/**/*.spec.js'], | ||
| exclude: ['**/node_modules/**', 'examples/**'], | ||
| setupFiles: ['./tests/unit/setupTests.js'], | ||
| }, | ||
| }); |
+15
-2
@@ -5,2 +5,15 @@ ## pdfkit changelog | ||
| ### [v0.19.0] - 2026-06-07 | ||
| - Bump node version requirement to 20+ | ||
| - Bump minimum supported browsers to Firefox 115, iOS/Safari 16 | ||
| - Fix text with input x as null | ||
| - Add opacity option to `doc.image()` to control image transparency | ||
| - Fix corrupted PDF when mixing standard and embedded fonts that share postscript name | ||
| - Fix PDF/UA compliance issues in kitchen-sink-accessible example | ||
| - Add bbox and placement options to PDFStructureElement for PDF/UA compliance | ||
| - Extend `roundedRect` with `borderRadius` as number for all corners or per-corner array (CSS order) | ||
| - Fix accessibility: scope in TH element | ||
| - Fix PDF Name escaping for spot colors with spaces ([#1644](https://github.com/foliojs/pdfkit/issues/1644)) | ||
| ### [v0.18.0] - 2026-03-14 | ||
@@ -20,3 +33,3 @@ | ||
| - Replace outdated crypto-js with maintained small alternatives | ||
| - Fix issue with indentation with `indentAllLines: true` when a new page is created | ||
| - Fix issue with indentation with `indentAllLines: true` when a new page is created | ||
@@ -32,3 +45,3 @@ ### [v0.17.2] - 2025-08-30 | ||
| - Optmize standard font handling. Less code, less memory usage | ||
| ### [v0.17.0] - 2025-04-12 | ||
@@ -35,0 +48,0 @@ |
+1
-3
@@ -1,3 +0,1 @@ | ||
| 'use strict'; | ||
| class VirtualFileSystem { | ||
@@ -51,2 +49,2 @@ constructor() { | ||
| module.exports = virtualFs; | ||
| export { virtualFs as default }; |
+24
-34
@@ -12,3 +12,3 @@ { | ||
| ], | ||
| "version": "0.18.0", | ||
| "version": "0.19.0", | ||
| "homepage": "http://pdfkit.org/", | ||
@@ -27,8 +27,7 @@ "author": { | ||
| "devDependencies": { | ||
| "@babel/core": "^7.26.0", | ||
| "@babel/plugin-external-helpers": "^7.25.9", | ||
| "@babel/preset-env": "^7.26.0", | ||
| "@eslint/js": "^9.17.0", | ||
| "@rollup/plugin-babel": "^6.0.4", | ||
| "babel-jest": "^29.7.0", | ||
| "@babel/core": "^7.29.7", | ||
| "@babel/plugin-external-helpers": "^7.29.7", | ||
| "@babel/preset-env": "^7.29.7", | ||
| "@eslint/js": "^10.0.1", | ||
| "@rollup/plugin-babel": "^7.1.0", | ||
| "blob-stream": "^0.1.3", | ||
@@ -38,15 +37,16 @@ "brace": "^0.11.1", | ||
| "browserify": "^17.0.1", | ||
| "canvas": "^3.2.0", | ||
| "codemirror": "~5.65.18", | ||
| "eslint": "^9.17.0", | ||
| "gh-pages": "^6.2.0", | ||
| "globals": "^15.14.0", | ||
| "jest": "^29.7.0", | ||
| "jest-image-snapshot": "^6.4.0", | ||
| "canvas": "^3.2.3", | ||
| "codemirror": "~5.65.21", | ||
| "eslint": "^10.4.1", | ||
| "gh-pages": "^6.3.0", | ||
| "globals": "^17.6.0", | ||
| "jest-diff": "^30.4.1", | ||
| "jest-image-snapshot": "^6.5.2", | ||
| "markdown": "~0.5.0", | ||
| "pdfjs-dist": "^2.14.305", | ||
| "pdfjs-dist": "^5.7.284", | ||
| "prettier": "3.4.2", | ||
| "pug": "^3.0.3", | ||
| "rollup": "^2.79.2", | ||
| "rollup-plugin-copy": "^3.5.0" | ||
| "pug": "^3.0.4", | ||
| "rollup": "^4.61.1", | ||
| "rollup-plugin-copy": "^3.5.0", | ||
| "vitest": "^4.1.8" | ||
| }, | ||
@@ -59,3 +59,3 @@ "dependencies": { | ||
| "linebreak": "^1.1.0", | ||
| "png-js": "^1.0.0" | ||
| "png-js": "^1.1.0" | ||
| }, | ||
@@ -72,6 +72,6 @@ "scripts": { | ||
| "lint": "eslint {lib,tests}/**/*.js", | ||
| "prettier": "prettier lib tests docs", | ||
| "test": "jest", | ||
| "test:visual": "jest visual/", | ||
| "test:unit": "jest unit/" | ||
| "prettier": "prettier --check lib tests docs", | ||
| "test": "vitest --testTimeout 8000 run", | ||
| "test:visual": "vitest --testTimeout 8000 run tests/visual", | ||
| "test:unit": "vitest run tests/unit" | ||
| }, | ||
@@ -86,15 +86,5 @@ "main": "js/pdfkit.js", | ||
| "engine": [ | ||
| "node >= v18.0.0" | ||
| "node >= v20.0.0" | ||
| ], | ||
| "jest": { | ||
| "testEnvironment": "node", | ||
| "testPathIgnorePatterns": [ | ||
| "/node_modules/", | ||
| "<rootDir>/examples/" | ||
| ], | ||
| "setupFilesAfterEnv": [ | ||
| "<rootDir>/tests/unit/setupTests.js" | ||
| ] | ||
| }, | ||
| "packageManager": "yarn@4.10.3" | ||
| } |
@@ -1,2 +0,2 @@ | ||
| // Ambient typings to make custom Jest matchers available to the TS language server in tests. | ||
| // Ambient typings to make custom Vitest matchers available to the TS language server in tests. | ||
| // No external @types packages required. | ||
@@ -16,11 +16,11 @@ | ||
| type TextStreamMatcher = PartialExceptTheseRequired<TextStream, 'text'>; | ||
| } | ||
| namespace jest { | ||
| interface Matchers<R> { | ||
| // Expect the PDF data array to contain a specific chunk sequence | ||
| toContainChunk(chunk: Array<string | RegExp>): R; | ||
| declare module 'vitest' { | ||
| interface Matchers<R> { | ||
| // Expect the PDF data array to contain a specific chunk sequence | ||
| toContainChunk(chunk: Array<string | RegExp>): R; | ||
| // Expect the PDF data array to contain a text stream matching the TextStream | ||
| toContainText(textStream: TextStreamMatcher): R; | ||
| } | ||
| // Expect the PDF data array to contain a text stream matching the TextStream | ||
| toContainText(textStream: TextStreamMatcher): R; | ||
| } | ||
@@ -27,0 +27,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
32
6.67%70615
0.4%5
-16.67%8392427
-0.7%Updated