pretext-pdf 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,239 +1,239 @@
1
- {
2
- "name": "pretext-pdf",
3
- "version": "2.1.0",
4
- "description": "Generate PDFs from JSON — declarative, serverless, no Chromium. TypeScript-first with professional typography. Ideal for invoices, reports, and AI agents.",
5
- "keywords": [
6
- "pdf",
7
- "pdf-generation",
8
- "pdf-generator",
9
- "json-to-pdf",
10
- "create-pdf",
11
- "invoice-pdf",
12
- "report-pdf",
13
- "typescript-pdf",
14
- "serverless-pdf",
15
- "no-chromium",
16
- "declarative-pdf",
17
- "ai-pdf",
18
- "llm-pdf",
19
- "mcp",
20
- "invoice",
21
- "report",
22
- "resume",
23
- "template",
24
- "typography",
25
- "typescript",
26
- "nodejs",
27
- "type-safe",
28
- "forms",
29
- "rtl",
30
- "hyphenation",
31
- "pretext"
32
- ],
33
- "author": "Himanshu Jain <himanshu@antigravity.dev>",
34
- "license": "MIT",
35
- "homepage": "https://github.com/Himaan1998Y/pretext-pdf#readme",
36
- "bugs": {
37
- "url": "https://github.com/Himaan1998Y/pretext-pdf/issues"
38
- },
39
- "repository": {
40
- "type": "git",
41
- "url": "git+https://github.com/Himaan1998Y/pretext-pdf.git"
42
- },
43
- "engines": {
44
- "node": ">=20.0.0"
45
- },
46
- "sideEffects": false,
47
- "type": "module",
48
- "main": "./dist/index.js",
49
- "types": "./dist/index.d.ts",
50
- "bin": {
51
- "pretext-pdf": "dist/cli.js"
52
- },
53
- "files": [
54
- "dist/",
55
- "fonts/",
56
- "README.md",
57
- "LICENSE",
58
- "CHANGELOG.md",
59
- "UPSTREAM.md"
60
- ],
61
- "exports": {
62
- ".": {
63
- "types": "./dist/index.d.ts",
64
- "import": "./dist/index.js"
65
- },
66
- "./markdown": {
67
- "types": "./dist/markdown.d.ts",
68
- "import": "./dist/markdown.js"
69
- },
70
- "./templates": {
71
- "types": "./dist/templates.d.ts",
72
- "import": "./dist/templates.js"
73
- },
74
- "./compat": {
75
- "types": "./dist/compat.d.ts",
76
- "import": "./dist/compat.js"
77
- },
78
- "./plugin-types": {
79
- "types": "./dist/plugin-types.d.ts",
80
- "import": "./dist/plugin-types.js"
81
- },
82
- "./schema": {
83
- "types": "./dist/schema.d.ts",
84
- "import": "./dist/schema.js"
85
- },
86
- "./signing": {
87
- "types": "./dist/signing/index.d.ts",
88
- "import": "./dist/signing/index.js"
89
- },
90
- "./package.json": "./package.json"
91
- },
92
- "scripts": {
93
- "build": "tsc",
94
- "api:extract": "api-extractor run --local",
95
- "api:check": "api-extractor run",
96
- "test:unit": "tsx --test test/validate.test.ts test/validate-document.test.ts test/validate-document-snapshot.test.ts test/validate-concurrent.test.ts test/builder.test.ts test/rich-text.test.ts test/layout-contract.test.ts test/hard-text-contract.test.ts test/validate-strict.test.ts test/logger-routing.test.ts test/compat.test.ts test/cli.test.ts",
97
- "pretest:unit": "npm run build",
98
- "test:validate": "tsx --test test/validate.test.ts test/builder.test.ts",
99
- "test:e2e": "tsx --test test/e2e.test.ts",
100
- "test:phase-3": "tsx --test test/signatures-validation.test.ts",
101
- "test:10a": "tsx --test test/qr-barcode.test.ts",
102
- "test:10b": "tsx --test test/charts.test.ts",
103
- "test:10c": "tsx --test test/markdown-entry.test.ts",
104
- "test:10d": "tsx --test test/templates.test.ts",
105
- "test:phase-4": "tsx --test test/footnotes.test.ts",
106
- "test:phase-5": "tsx --test test/image-floats.test.ts",
107
- "test:phases": "tsx --test test/footnotes.test.ts test/image-floats.test.ts test/bookmarks.test.ts test/watermarks.test.ts test/hyphenation.test.ts test/toc.test.ts test/svg.test.ts test/rtl.test.ts test/encryption.test.ts test/integration.test.ts test/hyperlinks.test.ts test/inline-formatting.test.ts test/annotations.test.ts test/assembly.test.ts test/metadata.test.ts test/signatures-visual.test.ts test/forms.test.ts test/callout.test.ts test/signatures-crypto.test.ts test/signatures-snapshot.test.ts test/float-groups.test.ts test/font-subsetting.test.ts test/performance.test.ts test/signatures-validation.test.ts test/cross-cutting.test.ts test/qr-barcode.test.ts test/charts.test.ts test/markdown-entry.test.ts test/templates.test.ts test/security-ssrf.test.ts test/security-ipv4-bypass.test.ts test/markdown-gfm.test.ts test/assets-dns-dedup.test.ts test/measure-text-cache.test.ts test/public-api-surface.test.ts test/assets-split-tripwire.test.ts test/assets-concurrency.test.ts test/assets-errorcode-stability.test.ts test/assets-perf-coldstart.test.ts test/svg-sanitizer.test.ts test/error-coverage.test.ts test/edge-cases.test.ts",
108
- "test:phase-7": "tsx --test test/bookmarks.test.ts test/watermarks.test.ts test/hyphenation.test.ts test/toc.test.ts test/svg.test.ts test/rtl.test.ts test/encryption.test.ts test/integration.test.ts",
109
- "test:phase-8": "tsx --test test/hyperlinks.test.ts test/inline-formatting.test.ts test/annotations.test.ts test/assembly.test.ts test/forms.test.ts test/callout.test.ts test/signatures-visual.test.ts test/metadata.test.ts",
110
- "test:8d": "tsx --test test/callout.test.ts",
111
- "test:8f": "tsx --test test/metadata.test.ts",
112
- "test:8e": "tsx --test test/signatures-visual.test.ts",
113
- "test:8b": "tsx --test test/forms.test.ts",
114
- "test:plugin": "tsx --test test/plugin-registry.test.ts",
115
- "test:contract": "tsx --test test/drift-guards.test.ts test/plugin-registry.test.ts test/benchmark-corpora.test.ts test/smoke-staging.test.ts test/table-determinism.test.ts",
116
- "test:benchmark": "tsx --test test/benchmark-baseline.test.ts",
117
- "test:2f": "cross-env NODE_OPTIONS=--max-old-space-size=4096 tsx --test test/stress.test.ts",
118
- "test": "node scripts/test-all.mjs",
119
- "coverage": "c8 --reporter=text --reporter=lcov npm test",
120
- "coverage:check": "c8 check-coverage --lines 75 --branches 65 --functions 75",
121
- "verify:badges": "cross-env SKIP_TEST_RUN=1 node scripts/verify-badges.js",
122
- "verify:badges:full": "node scripts/verify-badges.js",
123
- "test:rich": "tsx --test test/rich-text.test.ts",
124
- "test:visual": "tsx --test test/visual/visual.test.ts",
125
- "test:visual:update": "cross-env UPDATE_BASELINES=1 tsx test/visual/visual.test.ts",
126
- "example": "tsx examples/invoice.ts",
127
- "example:watermark": "tsx examples/phase7-watermark.ts",
128
- "example:bookmarks": "tsx examples/phase7-bookmarks.ts",
129
- "example:toc": "tsx examples/phase7-toc.ts",
130
- "example:rtl": "tsx examples/phase7-rtl.ts",
131
- "example:encryption": "tsx examples/phase7-encryption.ts",
132
- "example:hyperlinks": "tsx examples/phase8-hyperlinks.ts",
133
- "example:annotations": "tsx examples/phase8-annotations.ts",
134
- "example:assembly": "tsx examples/phase8-assembly.ts",
135
- "example:inline": "tsx examples/phase8-inline.ts",
136
- "example:forms": "tsx examples/phase8-forms.ts",
137
- "example:callout": "tsx examples/phase8-callout.ts",
138
- "example:gst": "tsx examples/gst-invoice-india.ts",
139
- "example:plugin": "tsx examples/plugin-custom-element.ts",
140
- "example:floats": "tsx examples/phase9b-float-groups.ts",
141
- "example:showcase-invoice": "tsx examples/showcase-invoice.ts",
142
- "example:showcase-report": "tsx examples/showcase-report.ts",
143
- "example:showcase-resume": "tsx examples/showcase-resume.ts",
144
- "screenshots": "npm run example:showcase-invoice && npm run example:showcase-report && npm run example:showcase-resume && node scripts/screenshot.cjs",
145
- "typecheck": "tsc --noEmit",
146
- "docs": "typedoc"
147
- },
148
- "dependencies": {
149
- "@cantoo/pdf-lib": "^2.6.5",
150
- "@fontsource-variable/inter": "^5.2.8",
151
- "@fontsource/inter": "^5.0.0",
152
- "@pdf-lib/fontkit": "^1.1.1",
153
- "bidi-js": "^1.0.3",
154
- "hyphenation.en-us": "^0.2.1",
155
- "hypher": "^0.2.5",
156
- "undici": "^6.25.0"
157
- },
158
- "peerDependencies": {
159
- "@napi-rs/canvas": "^0.1.57",
160
- "@signpdf/placeholder-pdf-lib": "^3.3.0",
161
- "@signpdf/signer-p12": "^3.3.0",
162
- "@signpdf/signpdf": "^3.3.0",
163
- "bwip-js": "^4.0.0",
164
- "highlight.js": "^11.0.0",
165
- "marked": ">=9.0.0",
166
- "pdf-lib": "^1.17.1",
167
- "qrcode": "^1.5.0",
168
- "vega": "^5.0.0 || ^6.0.0",
169
- "vega-lite": "^5.0.0 || ^6.0.0"
170
- },
171
- "peerDependenciesMeta": {
172
- "@napi-rs/canvas": {
173
- "optional": true
174
- },
175
- "@signpdf/signpdf": {
176
- "optional": true
177
- },
178
- "@signpdf/placeholder-pdf-lib": {
179
- "optional": true
180
- },
181
- "@signpdf/signer-p12": {
182
- "optional": true
183
- },
184
- "pdf-lib": {
185
- "optional": true
186
- },
187
- "highlight.js": {
188
- "optional": true
189
- },
190
- "qrcode": {
191
- "optional": true
192
- },
193
- "bwip-js": {
194
- "optional": true
195
- },
196
- "marked": {
197
- "optional": true
198
- },
199
- "vega": {
200
- "optional": true
201
- },
202
- "vega-lite": {
203
- "optional": true
204
- }
205
- },
206
- "devDependencies": {
207
- "@microsoft/api-extractor": "^7.58.7",
208
- "@signpdf/placeholder-pdf-lib": "^3.3.0",
209
- "@signpdf/signer-p12": "^3.3.0",
210
- "@signpdf/signpdf": "^3.3.0",
211
- "@types/bwip-js": "^3.2.3",
212
- "@types/node": "^22.0.0",
213
- "@types/node-forge": "^1.3.14",
214
- "@types/pixelmatch": "^5.2.6",
215
- "@types/pngjs": "^6.0.5",
216
- "@types/qrcode": "^1.5.6",
217
- "bwip-js": "^4.9.2",
218
- "c8": "^10.1.3",
219
- "cross-env": "^10.1.0",
220
- "highlight.js": "^11.11.1",
221
- "marked": "^18.0.2",
222
- "node-forge": "^1.4.0",
223
- "pdfjs-dist": "^5.6.205",
224
- "qrcode": "^1.5.4",
225
- "ts-node": "^10.9.2",
226
- "tsx": "^4.7.0",
227
- "typedoc": "^0.28.0",
228
- "typescript": "^5.5.0",
229
- "vega": "^6.2.0",
230
- "vega-lite": "^6.4.2"
231
- },
232
- "optionalDependencies": {
233
- "pixelmatch": "^7.1.0",
234
- "pngjs": "^7.0.0"
235
- },
236
- "pretextPdf": {
237
- "mcpCompat": ">=1.5.0 <3.0.0"
238
- }
239
- }
1
+ {
2
+ "name": "pretext-pdf",
3
+ "version": "2.1.1",
4
+ "description": "Generate PDFs from JSON — declarative, serverless, no Chromium. TypeScript-first with professional typography. Ideal for invoices, reports, and AI agents.",
5
+ "keywords": [
6
+ "pdf",
7
+ "pdf-generation",
8
+ "pdf-generator",
9
+ "json-to-pdf",
10
+ "create-pdf",
11
+ "invoice-pdf",
12
+ "report-pdf",
13
+ "typescript-pdf",
14
+ "serverless-pdf",
15
+ "no-chromium",
16
+ "declarative-pdf",
17
+ "ai-pdf",
18
+ "llm-pdf",
19
+ "mcp",
20
+ "invoice",
21
+ "report",
22
+ "resume",
23
+ "template",
24
+ "typography",
25
+ "typescript",
26
+ "nodejs",
27
+ "type-safe",
28
+ "forms",
29
+ "rtl",
30
+ "hyphenation",
31
+ "pretext"
32
+ ],
33
+ "author": "Himanshu Jain <himanshu@antigravity.dev>",
34
+ "license": "MIT",
35
+ "homepage": "https://github.com/Himaan1998Y/pretext-pdf#readme",
36
+ "bugs": {
37
+ "url": "https://github.com/Himaan1998Y/pretext-pdf/issues"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/Himaan1998Y/pretext-pdf.git"
42
+ },
43
+ "engines": {
44
+ "node": ">=20.0.0"
45
+ },
46
+ "sideEffects": false,
47
+ "type": "module",
48
+ "main": "./dist/index.js",
49
+ "types": "./dist/index.d.ts",
50
+ "bin": {
51
+ "pretext-pdf": "dist/cli.js"
52
+ },
53
+ "files": [
54
+ "dist/",
55
+ "fonts/",
56
+ "README.md",
57
+ "LICENSE",
58
+ "CHANGELOG.md",
59
+ "UPSTREAM.md"
60
+ ],
61
+ "exports": {
62
+ ".": {
63
+ "types": "./dist/index.d.ts",
64
+ "import": "./dist/index.js"
65
+ },
66
+ "./markdown": {
67
+ "types": "./dist/markdown.d.ts",
68
+ "import": "./dist/markdown.js"
69
+ },
70
+ "./templates": {
71
+ "types": "./dist/templates.d.ts",
72
+ "import": "./dist/templates.js"
73
+ },
74
+ "./compat": {
75
+ "types": "./dist/compat.d.ts",
76
+ "import": "./dist/compat.js"
77
+ },
78
+ "./plugin-types": {
79
+ "types": "./dist/plugin-types.d.ts",
80
+ "import": "./dist/plugin-types.js"
81
+ },
82
+ "./schema": {
83
+ "types": "./dist/schema.d.ts",
84
+ "import": "./dist/schema.js"
85
+ },
86
+ "./signing": {
87
+ "types": "./dist/signing/index.d.ts",
88
+ "import": "./dist/signing/index.js"
89
+ },
90
+ "./package.json": "./package.json"
91
+ },
92
+ "scripts": {
93
+ "build": "tsc",
94
+ "api:extract": "api-extractor run --local",
95
+ "api:check": "api-extractor run",
96
+ "test:unit": "tsx --test test/validate.test.ts test/validate-document.test.ts test/validate-document-snapshot.test.ts test/validate-concurrent.test.ts test/builder.test.ts test/rich-text.test.ts test/layout-contract.test.ts test/hard-text-contract.test.ts test/validate-strict.test.ts test/logger-routing.test.ts test/compat.test.ts test/cli.test.ts",
97
+ "pretest:unit": "npm run build",
98
+ "test:validate": "tsx --test test/validate.test.ts test/builder.test.ts",
99
+ "test:e2e": "tsx --test test/e2e.test.ts",
100
+ "test:phase-3": "tsx --test test/signatures-validation.test.ts",
101
+ "test:10a": "tsx --test test/qr-barcode.test.ts",
102
+ "test:10b": "tsx --test test/charts.test.ts",
103
+ "test:10c": "tsx --test test/markdown-entry.test.ts",
104
+ "test:10d": "tsx --test test/templates.test.ts",
105
+ "test:phase-4": "tsx --test test/footnotes.test.ts",
106
+ "test:phase-5": "tsx --test test/image-floats.test.ts",
107
+ "test:phases": "tsx --test test/footnotes.test.ts test/image-floats.test.ts test/bookmarks.test.ts test/watermarks.test.ts test/hyphenation.test.ts test/toc.test.ts test/svg.test.ts test/rtl.test.ts test/encryption.test.ts test/integration.test.ts test/hyperlinks.test.ts test/inline-formatting.test.ts test/annotations.test.ts test/assembly.test.ts test/metadata.test.ts test/signatures-visual.test.ts test/forms.test.ts test/callout.test.ts test/signatures-crypto.test.ts test/signatures-snapshot.test.ts test/float-groups.test.ts test/font-subsetting.test.ts test/performance.test.ts test/signatures-validation.test.ts test/cross-cutting.test.ts test/qr-barcode.test.ts test/charts.test.ts test/markdown-entry.test.ts test/templates.test.ts test/security-ssrf.test.ts test/security-ipv4-bypass.test.ts test/markdown-gfm.test.ts test/assets-dns-dedup.test.ts test/measure-text-cache.test.ts test/public-api-surface.test.ts test/assets-split-tripwire.test.ts test/assets-concurrency.test.ts test/assets-errorcode-stability.test.ts test/assets-perf-coldstart.test.ts test/svg-sanitizer.test.ts test/error-coverage.test.ts test/edge-cases.test.ts",
108
+ "test:phase-7": "tsx --test test/bookmarks.test.ts test/watermarks.test.ts test/hyphenation.test.ts test/toc.test.ts test/svg.test.ts test/rtl.test.ts test/encryption.test.ts test/integration.test.ts",
109
+ "test:phase-8": "tsx --test test/hyperlinks.test.ts test/inline-formatting.test.ts test/annotations.test.ts test/assembly.test.ts test/forms.test.ts test/callout.test.ts test/signatures-visual.test.ts test/metadata.test.ts",
110
+ "test:8d": "tsx --test test/callout.test.ts",
111
+ "test:8f": "tsx --test test/metadata.test.ts",
112
+ "test:8e": "tsx --test test/signatures-visual.test.ts",
113
+ "test:8b": "tsx --test test/forms.test.ts",
114
+ "test:plugin": "tsx --test test/plugin-registry.test.ts",
115
+ "test:contract": "tsx --test test/drift-guards.test.ts test/plugin-registry.test.ts test/benchmark-corpora.test.ts test/smoke-staging.test.ts test/table-determinism.test.ts",
116
+ "test:benchmark": "tsx --test test/benchmark-baseline.test.ts",
117
+ "test:2f": "cross-env NODE_OPTIONS=--max-old-space-size=4096 tsx --test test/stress.test.ts",
118
+ "test": "node scripts/test-all.mjs",
119
+ "coverage": "c8 --reporter=text --reporter=lcov npm test",
120
+ "coverage:check": "c8 check-coverage --lines 75 --branches 65 --functions 75",
121
+ "verify:badges": "cross-env SKIP_TEST_RUN=1 node scripts/verify-badges.js",
122
+ "verify:badges:full": "node scripts/verify-badges.js",
123
+ "test:rich": "tsx --test test/rich-text.test.ts",
124
+ "test:visual": "tsx --test test/visual/visual.test.ts",
125
+ "test:visual:update": "cross-env UPDATE_BASELINES=1 tsx test/visual/visual.test.ts",
126
+ "example": "tsx examples/invoice.ts",
127
+ "example:watermark": "tsx examples/phase7-watermark.ts",
128
+ "example:bookmarks": "tsx examples/phase7-bookmarks.ts",
129
+ "example:toc": "tsx examples/phase7-toc.ts",
130
+ "example:rtl": "tsx examples/phase7-rtl.ts",
131
+ "example:encryption": "tsx examples/phase7-encryption.ts",
132
+ "example:hyperlinks": "tsx examples/phase8-hyperlinks.ts",
133
+ "example:annotations": "tsx examples/phase8-annotations.ts",
134
+ "example:assembly": "tsx examples/phase8-assembly.ts",
135
+ "example:inline": "tsx examples/phase8-inline.ts",
136
+ "example:forms": "tsx examples/phase8-forms.ts",
137
+ "example:callout": "tsx examples/phase8-callout.ts",
138
+ "example:gst": "tsx examples/gst-invoice-india.ts",
139
+ "example:plugin": "tsx examples/plugin-custom-element.ts",
140
+ "example:floats": "tsx examples/phase9b-float-groups.ts",
141
+ "example:showcase-invoice": "tsx examples/showcase-invoice.ts",
142
+ "example:showcase-report": "tsx examples/showcase-report.ts",
143
+ "example:showcase-resume": "tsx examples/showcase-resume.ts",
144
+ "screenshots": "npm run example:showcase-invoice && npm run example:showcase-report && npm run example:showcase-resume && node scripts/screenshot.cjs",
145
+ "typecheck": "tsc --noEmit",
146
+ "docs": "typedoc"
147
+ },
148
+ "dependencies": {
149
+ "@cantoo/pdf-lib": "^2.6.5",
150
+ "@fontsource-variable/inter": "^5.2.8",
151
+ "@fontsource/inter": "^5.0.0",
152
+ "@pdf-lib/fontkit": "^1.1.1",
153
+ "bidi-js": "^1.0.3",
154
+ "hyphenation.en-us": "^0.2.1",
155
+ "hypher": "^0.2.5",
156
+ "undici": "^6.27.0"
157
+ },
158
+ "peerDependencies": {
159
+ "@napi-rs/canvas": "^0.1.57",
160
+ "@signpdf/placeholder-pdf-lib": "^3.3.0",
161
+ "@signpdf/signer-p12": "^3.3.0",
162
+ "@signpdf/signpdf": "^3.3.0",
163
+ "bwip-js": "^4.0.0",
164
+ "highlight.js": "^11.0.0",
165
+ "marked": ">=9.0.0",
166
+ "pdf-lib": "^1.17.1",
167
+ "qrcode": "^1.5.0",
168
+ "vega": "^5.0.0 || ^6.0.0",
169
+ "vega-lite": "^5.0.0 || ^6.0.0"
170
+ },
171
+ "peerDependenciesMeta": {
172
+ "@napi-rs/canvas": {
173
+ "optional": true
174
+ },
175
+ "@signpdf/signpdf": {
176
+ "optional": true
177
+ },
178
+ "@signpdf/placeholder-pdf-lib": {
179
+ "optional": true
180
+ },
181
+ "@signpdf/signer-p12": {
182
+ "optional": true
183
+ },
184
+ "pdf-lib": {
185
+ "optional": true
186
+ },
187
+ "highlight.js": {
188
+ "optional": true
189
+ },
190
+ "qrcode": {
191
+ "optional": true
192
+ },
193
+ "bwip-js": {
194
+ "optional": true
195
+ },
196
+ "marked": {
197
+ "optional": true
198
+ },
199
+ "vega": {
200
+ "optional": true
201
+ },
202
+ "vega-lite": {
203
+ "optional": true
204
+ }
205
+ },
206
+ "devDependencies": {
207
+ "@microsoft/api-extractor": "^7.58.7",
208
+ "@signpdf/placeholder-pdf-lib": "^3.3.0",
209
+ "@signpdf/signer-p12": "^3.3.0",
210
+ "@signpdf/signpdf": "^3.3.0",
211
+ "@types/bwip-js": "^3.2.3",
212
+ "@types/node": "^22.0.0",
213
+ "@types/node-forge": "^1.3.14",
214
+ "@types/pixelmatch": "^5.2.6",
215
+ "@types/pngjs": "^6.0.5",
216
+ "@types/qrcode": "^1.5.6",
217
+ "bwip-js": "^4.9.2",
218
+ "c8": "^10.1.3",
219
+ "cross-env": "^10.1.0",
220
+ "highlight.js": "^11.11.1",
221
+ "marked": "^18.0.2",
222
+ "node-forge": "^1.4.0",
223
+ "pdfjs-dist": "^5.6.205",
224
+ "qrcode": "^1.5.4",
225
+ "ts-node": "^10.9.2",
226
+ "tsx": "^4.7.0",
227
+ "typedoc": "^0.28.0",
228
+ "typescript": "^5.5.0",
229
+ "vega": "^6.2.0",
230
+ "vega-lite": "^6.4.2"
231
+ },
232
+ "optionalDependencies": {
233
+ "pixelmatch": "^7.1.0",
234
+ "pngjs": "^7.0.0"
235
+ },
236
+ "pretextPdf": {
237
+ "mcpCompat": ">=1.5.0 <3.0.0"
238
+ }
239
+ }
@@ -1,16 +0,0 @@
1
- import type { PdfDocument } from './types-public/index.js';
2
- /**
3
- * Apply PKCS#7 digital signature to pre-rendered PDF bytes.
4
- * Requires the @signpdf/signpdf peer dependency.
5
- */
6
- export declare function applySignature(pdfBytes: Uint8Array, sig: NonNullable<PdfDocument['signature']>, allowedFileDirs?: string[]): Promise<Uint8Array>;
7
- /**
8
- * Apply AES-128 or AES-256 encryption to pre-rendered PDF bytes.
9
- */
10
- export declare function applyEncryption(pdfBytes: Uint8Array, enc: NonNullable<PdfDocument['encryption']>): Promise<Uint8Array>;
11
- /**
12
- * Apply signature and encryption post-processing to raw pipeline bytes.
13
- * Called by both render() in index.ts and PdfBuilder.build() in builder.ts.
14
- */
15
- export declare function applyPostProcessing(rawBytes: Uint8Array, doc: PdfDocument): Promise<Uint8Array>;
16
- //# sourceMappingURL=post-process.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"post-process.d.ts","sourceRoot":"","sources":["../src/post-process.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAI1D;;;GAGG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,EAC1C,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,UAAU,CAAC,CA0GrB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,GAC1C,OAAO,CAAC,UAAU,CAAC,CAarB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,UAAU,CAAC,CAGrB"}
@@ -1,117 +0,0 @@
1
- import path from 'node:path';
2
- import { PDFDocument } from '@cantoo/pdf-lib';
3
- import { PretextPdfError } from './errors.js';
4
- import { assertPathAllowed } from './assets.js';
5
- /**
6
- * Apply PKCS#7 digital signature to pre-rendered PDF bytes.
7
- * Requires the @signpdf/signpdf peer dependency.
8
- */
9
- export async function applySignature(pdfBytes, sig, allowedFileDirs) {
10
- let signpdfMod;
11
- let placeholderMod;
12
- let signerP12Mod;
13
- let pdfLibMod;
14
- // NOTE: upstream `pdf-lib` (not @cantoo/pdf-lib) is used here for the
15
- // placeholder hop only. @signpdf/placeholder-pdf-lib builds its placeholder
16
- // objects with upstream pdf-lib classes (see pdflibAddPlaceholder.js), so
17
- // the doc fed into it must be loaded with the matching pdf-lib variant to
18
- // produce a serializer-compatible /ByteRange dictionary. Encryption stays
19
- // on @cantoo/pdf-lib in applyEncryption — the two paths are mutually
20
- // exclusive via the SIGNATURE_CERT_AND_ENCRYPTION guard.
21
- const signpdfPackages = [
22
- { name: '@signpdf/signpdf', load: () => import('@signpdf/signpdf') },
23
- { name: '@signpdf/placeholder-pdf-lib', load: () => import('@signpdf/placeholder-pdf-lib') },
24
- { name: '@signpdf/signer-p12', load: () => import('@signpdf/signer-p12') },
25
- { name: 'pdf-lib', load: () => import('pdf-lib') },
26
- ];
27
- const missing = [];
28
- const loaded = {};
29
- for (const pkg of signpdfPackages) {
30
- try {
31
- loaded[pkg.name] = await pkg.load();
32
- }
33
- catch {
34
- missing.push(pkg.name);
35
- }
36
- }
37
- if (missing.length > 0) {
38
- throw new PretextPdfError('SIGNATURE_DEP_MISSING', `Cryptographic signing requires the @signpdf/signpdf, @signpdf/placeholder-pdf-lib, @signpdf/signer-p12, and pdf-lib packages. Missing: ${missing.join(', ')}. Install: npm install ${missing.join(' ')}.`);
39
- }
40
- signpdfMod = loaded['@signpdf/signpdf'];
41
- placeholderMod = loaded['@signpdf/placeholder-pdf-lib'];
42
- signerP12Mod = loaded['@signpdf/signer-p12'];
43
- pdfLibMod = loaded['pdf-lib'];
44
- const { SignPdf } = signpdfMod;
45
- const { pdflibAddPlaceholder } = placeholderMod;
46
- const { P12Signer } = signerP12Mod;
47
- let p12Buffer;
48
- try {
49
- if (sig.p12 instanceof Uint8Array) {
50
- p12Buffer = Buffer.from(sig.p12);
51
- }
52
- else {
53
- const p12Path = sig.p12;
54
- if (!path.isAbsolute(p12Path)) {
55
- throw new PretextPdfError('SIGNATURE_P12_LOAD_FAILED', 'P12 path must be absolute');
56
- }
57
- const resolvedPath = path.resolve(p12Path);
58
- assertPathAllowed(resolvedPath, allowedFileDirs, 'P12 certificate');
59
- const { promises: fs } = await import('node:fs');
60
- p12Buffer = await fs.readFile(resolvedPath);
61
- }
62
- }
63
- catch (e) {
64
- if (e instanceof PretextPdfError)
65
- throw e;
66
- throw new PretextPdfError('SIGNATURE_P12_LOAD_FAILED', 'Failed to load P12 certificate');
67
- }
68
- // Load with upstream pdf-lib (not @cantoo/pdf-lib) so the doc instance
69
- // shares the exact same PDFArray/PDFNumber/PDFName classes that
70
- // placeholder-pdf-lib uses internally — otherwise the serializer emits a
71
- // /ByteRange dict the signpdf parser cannot find.
72
- const pdfDoc = await pdfLibMod.PDFDocument.load(pdfBytes);
73
- pdflibAddPlaceholder({
74
- pdfDoc,
75
- reason: sig.reason ?? 'Signed',
76
- contactInfo: sig.contactInfo ?? '',
77
- name: sig.signerName ?? '',
78
- location: sig.location ?? '',
79
- });
80
- const pdfWithPlaceholder = await pdfDoc.save({ useObjectStreams: false });
81
- const signer = new SignPdf();
82
- const p12Signer = new P12Signer(p12Buffer, sig.passphrase !== undefined ? { passphrase: sig.passphrase } : undefined);
83
- let signedBuffer;
84
- try {
85
- signedBuffer = await signer.sign(Buffer.from(pdfWithPlaceholder), p12Signer);
86
- }
87
- catch (e) {
88
- throw new PretextPdfError('SIGNATURE_FAILED', `PDF signing failed: ${e instanceof Error ? e.message : String(e)}`);
89
- }
90
- return new Uint8Array(signedBuffer);
91
- }
92
- /**
93
- * Apply AES-128 or AES-256 encryption to pre-rendered PDF bytes.
94
- */
95
- export async function applyEncryption(pdfBytes, enc) {
96
- const encDoc = await PDFDocument.load(pdfBytes);
97
- encDoc.encrypt({
98
- userPassword: enc.userPassword ?? '',
99
- ownerPassword: enc.ownerPassword ?? (await import('node:crypto')).randomUUID(),
100
- permissions: {
101
- printing: enc.permissions?.printing ?? true,
102
- copying: enc.permissions?.copying ?? true,
103
- modifying: enc.permissions?.modifying ?? false,
104
- annotating: enc.permissions?.annotating ?? true,
105
- },
106
- });
107
- return encDoc.save({ useObjectStreams: false });
108
- }
109
- /**
110
- * Apply signature and encryption post-processing to raw pipeline bytes.
111
- * Called by both render() in index.ts and PdfBuilder.build() in builder.ts.
112
- */
113
- export async function applyPostProcessing(rawBytes, doc) {
114
- const signedBytes = doc.signature?.p12 ? await applySignature(rawBytes, doc.signature, doc.allowedFileDirs) : rawBytes;
115
- return doc.encryption ? await applyEncryption(signedBytes, doc.encryption) : signedBytes;
116
- }
117
- //# sourceMappingURL=post-process.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"post-process.js","sourceRoot":"","sources":["../src/post-process.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAE/C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAoB,EACpB,GAA0C,EAC1C,eAA0B;IAc1B,IAAI,UAAyB,CAAA;IAC7B,IAAI,cAAiC,CAAA;IACrC,IAAI,YAA6B,CAAA;IACjC,IAAI,SAAuB,CAAA;IAC3B,sEAAsE;IACtE,4EAA4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,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,EAAE;QAC9E,WAAW,EAAE;YACX,QAAQ,EAAI,GAAG,CAAC,WAAW,EAAE,QAAQ,IAAM,IAAI;YAC/C,OAAO,EAAK,GAAG,CAAC,WAAW,EAAE,OAAO,IAAO,IAAI;YAC/C,SAAS,EAAG,GAAG,CAAC,WAAW,EAAE,SAAS,IAAK,KAAK;YAChD,UAAU,EAAE,GAAG,CAAC,WAAW,EAAE,UAAU,IAAI,IAAI;SAChD;KACF,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC,CAAA;AACjD,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,QAAoB,EACpB,GAAgB;IAEhB,MAAM,WAAW,GAAG,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;IACtH,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,eAAe,CAAC,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;AAC1F,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * pretext-pdf — Public TypeScript types (legacy shim).
3
- *
4
- * The contents of this file moved into src/types-public/ as separate
5
- * domain-grouped modules. This shim preserves the old import path during
6
- * v1.4.0. It will be removed once internal consumers are updated.
7
- */
8
- export type * from './types-public/index.js';
9
- //# sourceMappingURL=types-public.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-public.d.ts","sourceRoot":"","sources":["../src/types-public.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,mBAAmB,yBAAyB,CAAA"}