@lupinum/nuxt-pdf 0.4.0-beta.5 → 0.4.0-beta.6

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/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to `@lupinum/nuxt-pdf` are recorded here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project adheres
5
5
  to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 0.4.0-beta.6
8
+
9
+ ### Patch Changes
10
+
11
+ - [#68](https://github.com/lupinum-dev/nuxt-pdf/pull/68) [`11d711a`](https://github.com/lupinum-dev/nuxt-pdf/commit/11d711ac83c69d3f468fb7983a15075398fa100e) Thanks [@Mat4m0](https://github.com/Mat4m0)! - Fix `renderPdfSfc()` to use the fonts from the application's Nuxt configuration, including inherited layers, when the test passes no `fonts` option.
12
+
7
13
  ## 0.4.0-beta.5
8
14
 
9
15
  [compare changes](https://github.com/lupinum-dev/nuxt-pdf/compare/v0.4.0-beta.4...0.4.0-beta.5)
package/CONFORMANCE.md CHANGED
@@ -1,11 +1,11 @@
1
- # Nuxt PDF 0.4.0-beta.5 conformance
1
+ # Nuxt PDF conformance
2
2
 
3
3
  Nuxt PDF claims behavioral compatibility for a deliberately small, tested
4
4
  corpus. It does not claim full React PDF API or test-suite compatibility.
5
5
 
6
6
  ## Version boundary
7
7
 
8
- | Layer | 0.4.0-beta.5 boundary |
8
+ | Layer | Tested boundary |
9
9
  |---|---|
10
10
  | Node.js | `^22.14.0`, `^24.0.0`, or `^26.0.0` |
11
11
  | Nuxt | `^4.4.8` |
@@ -217,7 +217,7 @@ checking.
217
217
 
218
218
  ### Vue and Nuxt authoring
219
219
 
220
- The 0.4.0-beta.5 tests verify:
220
+ The tests verify:
221
221
 
222
222
  - `PdfDocument`, `PdfPage`, `PdfView`, `PdfText`, `PdfImage`, `PdfLink`, and
223
223
  `PdfNote`;
@@ -456,7 +456,7 @@ parser, not two. Claimed:
456
456
  Verified end-to-end against a real rendered template, including assertion
457
457
  failure messages, in `test/test-utils-public.test.ts`.
458
458
 
459
- ## Explicitly not claimed in 0.4.0-beta.5
459
+ ## Explicitly not claimed
460
460
 
461
461
  - Full React PDF component, hook, browser-helper, or test-suite parity.
462
462
  - React runtime compatibility or React-shaped dynamic callback results.
package/README.md CHANGED
@@ -22,7 +22,7 @@
22
22
  <a href="https://www.npmjs.com/package/@lupinum/nuxt-pdf"><img src="https://img.shields.io/npm/v/@lupinum/nuxt-pdf?color=00DC82" alt="npm version"></a>
23
23
  <a href="https://github.com/lupinum-dev/nuxt-pdf/actions/workflows/ci.yml"><img src="https://github.com/lupinum-dev/nuxt-pdf/actions/workflows/ci.yml/badge.svg" alt="CI status"></a>
24
24
  <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-00DC82" alt="MIT license"></a>
25
- <a href="https://discord.gg/RPH6SeA36N"><img src="https://img.shields.io/badge/Discord-18181B?logo=discord" alt="Discord"></a>
25
+ <a href="https://discord.lupinum.com"><img src="https://img.shields.io/badge/Discord-18181B?logo=discord" alt="Discord"></a>
26
26
  <a href="https://deepwiki.com/lupinum-dev/nuxt-pdf"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
27
27
  </p>
28
28
 
@@ -73,34 +73,6 @@ export default defineNuxtConfig({
73
73
  })
74
74
  ```
75
75
 
76
- <!-- BEGIN:consumer-onboarding -->
77
-
78
- ### Use a coding agent
79
-
80
- A coding agent is a development tool that can inspect and change your project.
81
- After installation, copy this prompt into your coding agent:
82
-
83
- ```text
84
- Add Nuxt PDF to this Nuxt application and render one PDF from a Vue template.
85
- Read the project's existing instructions first. Resolve
86
- @lupinum/nuxt-pdf/agent-docs from this application's directory and read its
87
- starting pages. Use the installed version's examples and public types. Preserve
88
- existing routes, security limits, conventions, and AGENTS.md instructions. Add
89
- or update one short Nuxt PDF pointer in AGENTS.md if the project allows it; do
90
- not duplicate the documentation. If the file is absent, create only that
91
- pointer. Report missing guidance. Verify the server route, PDF output, and one
92
- invalid request.
93
- ```
94
-
95
- If the installed package has no `agent-docs` export, read its packaged README,
96
- types, and `CONFORMANCE.md`. Use documentation from the matching source tag when
97
- more detail is needed. Installing or updating the package does not edit project
98
- instructions. The pointer resolves the installed package, so upgrades and
99
- rollbacks select the matching documentation without copying it into your
100
- application.
101
-
102
- <!-- END:consumer-onboarding -->
103
-
104
76
  ## Quick start
105
77
 
106
78
  Create `pdfs/invoice.vue`:
@@ -186,13 +158,58 @@ Nuxt PDF regenerates the typed `#pdf` registry whenever templates change. If
186
158
  your editor still shows `#pdf` as untyped, run `nuxt prepare` once to refresh
187
159
  the generated types.
188
160
 
161
+ ## Agent setup
162
+
163
+ `@lupinum/nuxt-pdf` ships its documentation inside the package for coding
164
+ agents such as Claude Code, Codex and Cursor. The pages match the installed
165
+ version, so an agent does not follow the website for a different version.
166
+
167
+ To set it up, give your coding agent this task:
168
+
169
+ ```text
170
+ Set up @lupinum/nuxt-pdf for coding agents as described under "Agent setup" in its README.
171
+ ```
172
+
173
+ ### Steps for the agent
174
+
175
+ 1. Find `node_modules/@lupinum/nuxt-pdf/dist/agent/AGENTS.md`. Look in the
176
+ directory of the project that depends on `@lupinum/nuxt-pdf` first, then
177
+ in its parent directories up to the repository root (workspaces can hoist
178
+ packages). Read it; it lists the documentation pages.
179
+ 2. Add the section below to the project's agent instructions: `AGENTS.md`, or
180
+ `CLAUDE.md` if the project has only that file. If it has neither, create
181
+ `AGENTS.md`. Write the path relative to the repository root, through
182
+ `node_modules/@lupinum/nuxt-pdf` (for example
183
+ `apps/web/node_modules/@lupinum/nuxt-pdf/...` in a workspace). Never write
184
+ a resolved path such as `node_modules/.pnpm/...`: it contains the version and
185
+ breaks after an upgrade. If a section for `@lupinum/nuxt-pdf` already
186
+ exists, leave it as it is.
187
+
188
+ Use the path you found in place of the sample path:
189
+
190
+ ```md
191
+ ## @lupinum/nuxt-pdf
192
+
193
+ Before you change code that uses @lupinum/nuxt-pdf, read
194
+ `node_modules/@lupinum/nuxt-pdf/dist/agent/AGENTS.md` and the pages it
195
+ lists. They document the installed version. Prefer them over what you
196
+ remember about this package and over the website.
197
+ ```
198
+
199
+ 3. Do not copy the documentation into the project and do not install a skill.
200
+ The section points into the installed package, so it stays correct after
201
+ every upgrade or downgrade.
202
+
203
+ If the file does not exist, the installed version has no packaged
204
+ documentation. Read the package README and its TypeScript types instead.
205
+
189
206
  ## Discord
190
207
 
191
208
  Join the Lupinum OSS community to discuss Nuxt PDF, ask questions, and share
192
209
  what you build.
193
210
 
194
211
  <p align="center">
195
- <a href="https://discord.gg/RPH6SeA36N">
212
+ <a href="https://discord.lupinum.com">
196
213
  <picture>
197
214
  <source media="(prefers-color-scheme: dark)" srcset="docs/public/discord-dark.svg">
198
215
  <source media="(prefers-color-scheme: light)" srcset="docs/public/discord-light.svg">
@@ -262,23 +279,20 @@ pnpm dev
262
279
  pnpm verify
263
280
  ```
264
281
 
265
- Use `pnpm docs:dev` to run the documentation site. Run `pnpm docs:build` before
266
- you hand off a documentation change. Use `pnpm release:verify` only for release
267
- preparation.
282
+ Use `pnpm docs:dev` to run the documentation site. `pnpm verify` runs the same
283
+ checks as CI.
268
284
 
269
- Read [CONTRIBUTING.md](./CONTRIBUTING.md) before you open a pull request.
270
- Maintainers use [MAINTAINING.md](./MAINTAINING.md) for release and recovery
271
- procedures.
285
+ Read [CONTRIBUTING.md](.github/CONTRIBUTING.md) before you open a pull request.
272
286
 
273
287
  ## Support and security
274
288
 
275
289
  - Read the [documentation](https://nuxt-pdf.lupinum.com).
276
- - Join the [Lupinum OSS Discord](https://discord.gg/RPH6SeA36N).
277
- - Open a [bug report](https://github.com/lupinum-dev/nuxt-pdf/issues/new?template=bug.md)
290
+ - Join the [Lupinum OSS Discord](https://discord.lupinum.com).
291
+ - Open a [bug report](https://github.com/lupinum-dev/nuxt-pdf/issues/new?template=bug.yml)
278
292
  for a reproducible defect.
279
- - Open a [feature request](https://github.com/lupinum-dev/nuxt-pdf/issues/new?template=proposal.md)
293
+ - Open a [feature request](https://github.com/lupinum-dev/nuxt-pdf/issues/new?template=feature.yml)
280
294
  before you plan a larger change.
281
- - Follow [SECURITY.md](./SECURITY.md) for a private vulnerability report.
295
+ - Follow [SECURITY.md](.github/SECURITY.md) for a private vulnerability report.
282
296
 
283
297
  ## License
284
298
 
@@ -1,48 +1,44 @@
1
- # @lupinum/nuxt-pdf
1
+ # @lupinum/nuxt-pdf 0.4.0-beta.6 documentation
2
2
 
3
- Documentation for installed version 0.4.0-beta.5.
3
+ These pages document the installed version 0.4.0-beta.6. Prefer them over what you
4
+ remember about this package and over the website, which may describe another version.
5
+ Read the pages that match the task before you write code. If they do not answer a question,
6
+ the user can ask in the Lupinum OSS Discord: https://discord.lupinum.com
4
7
 
5
- Read the relevant local pages before changing this package’s integration.
6
- Project instructions govern architecture, style and permissions.
8
+ > Author and render PDFs with Vue components in Nuxt.
7
9
 
8
- ## Start here
10
+ ## When to use
9
11
 
10
- - [Install Nuxt PDF](./pages/docs/getting-started/installation.md) — /docs/getting-started/installation
11
- - [Module options](./pages/docs/reference/module-options.md) — /docs/reference/module-options
12
+ Use this site to author and render PDF documents with Nuxt PDF.
12
13
 
13
- ## Find a page
14
+ ## Documentation
14
15
 
15
- The index below maps public documentation routes to this installed snapshot.
16
- For links to this documentation site, use the matching local page in manifest.json
17
- instead of fetching a possibly different website version. Preserve URL fragments.
18
- External dependencies have their own versioned contracts. Report missing guidance.
19
-
20
- - [Example gallery](./pages/docs/examples.md) — /docs/examples
21
- - [Supported behavior and limitations](./pages/docs/examples/supported-behavior.md) — /docs/examples/supported-behavior
22
- - [Overview](./pages/docs/getting-started.md) — /docs/getting-started
23
- - [Install Nuxt PDF](./pages/docs/getting-started/installation.md) — /docs/getting-started/installation
24
- - [Render your first PDF](./pages/docs/getting-started/quickstart.md) — /docs/getting-started/quickstart
25
- - [Add links, bookmarks, and a table of contents](./pages/docs/guides/contents-links-bookmarks.md) — /docs/guides/contents-links-bookmarks
26
- - [Deploy and operate](./pages/docs/guides/deployment.md) — /docs/guides/deployment
27
- - [Diagnose render failures](./pages/docs/guides/errors-and-debugging.md) — /docs/guides/errors-and-debugging
28
- - [Add images and fonts](./pages/docs/guides/images-and-fonts.md) — /docs/guides/images-and-fonts
29
- - [Production recipes](./pages/docs/guides/recipes.md) — /docs/guides/recipes
30
- - [Configure remote images](./pages/docs/guides/remote-images.md) — /docs/guides/remote-images
31
- - [Build reusable document components](./pages/docs/guides/reusable-components.md) — /docs/guides/reusable-components
32
- - [Render outside Nitro](./pages/docs/guides/standalone-node.md) — /docs/guides/standalone-node
33
- - [Draw SVG graphics](./pages/docs/guides/svg-graphics.md) — /docs/guides/svg-graphics
34
- - [Test a PDF](./pages/docs/guides/testing.md) — /docs/guides/testing
35
- - [The document tree](./pages/docs/learn/document-tree.md) — /docs/learn/document-tree
36
- - [Runtime and data loading](./pages/docs/learn/runtime-and-data.md) — /docs/learn/runtime-and-data
37
- - [Styling and layout](./pages/docs/learn/styling-and-layout.md) — /docs/learn/styling-and-layout
38
- - [Templates and the registry](./pages/docs/learn/templates-and-registry.md) — /docs/learn/templates-and-registry
39
- - [Composables](./pages/docs/reference/composables.md) — /docs/reference/composables
40
- - [definePdf](./pages/docs/reference/define-pdf.md) — /docs/reference/define-pdf
41
- - [Errors and limits](./pages/docs/reference/errors-and-limits.md) — /docs/reference/errors-and-limits
42
- - [Module options](./pages/docs/reference/module-options.md) — /docs/reference/module-options
43
- - [Page sizes](./pages/docs/reference/page-sizes.md) — /docs/reference/page-sizes
44
- - [Primitives](./pages/docs/reference/primitives.md) — /docs/reference/primitives
45
- - [Registry and render result](./pages/docs/reference/registry.md) — /docs/reference/registry
46
- - [Standalone build and runtime](./pages/docs/reference/standalone.md) — /docs/reference/standalone
47
- - [Styles](./pages/docs/reference/styles.md) — /docs/reference/styles
48
- - [Test utilities](./pages/docs/reference/test-utilities.md) — /docs/reference/test-utilities
16
+ - [Overview](./pages/docs/getting-started.md): Decide whether Nuxt PDF fits the document you need to create.
17
+ - [Install Nuxt PDF](./pages/docs/getting-started/installation.md): Add server-side PDF rendering to an existing Nuxt 4 application.
18
+ - [Render your first PDF](./pages/docs/getting-started/quickstart.md): Create, download, and preview a small invoice in a Nuxt application.
19
+ - [Templates and the registry](./pages/docs/learn/templates-and-registry.md): How files under pdfs become typed server-side render functions.
20
+ - [The document tree](./pages/docs/learn/document-tree.md): PDF primitives, valid nesting, Vue composition, and dynamic text.
21
+ - [Styling and layout](./pages/docs/learn/styling-and-layout.md): The PDF style model, flex layout, units, inheritance, and shared geometry.
22
+ - [Runtime and data loading](./pages/docs/learn/runtime-and-data.md): Where PDF templates execute and how data enters a render.
23
+ - [Build reusable document components](./pages/docs/guides/reusable-components.md): Organize repeated PDF sections without creating a second component system.
24
+ - [Add images and fonts](./pages/docs/guides/images-and-fonts.md): Bundle local PNG, JPEG, TTF, OTF, and WOFF2 resources with a PDF template.
25
+ - [Configure remote images](./pages/docs/guides/remote-images.md): Admit specific HTTPS image paths and understand the request boundary.
26
+ - [Add links, bookmarks, and a table of contents](./pages/docs/guides/contents-links-bookmarks.md): usePdfPageNumbers, the multi-pass layout loop, convergence and maxPasses, internal links, and the bookmark outline.
27
+ - [Draw SVG graphics](./pages/docs/guides/svg-graphics.md): The SVG primitive set, direct presentation props, scoped definitions, SVG text, and the supported numeric boundary.
28
+ - [Test a PDF](./pages/docs/guides/testing.md): Assert against your own templates with a real render using @lupinum/nuxt-pdf/test, plus a realistic Vitest example.
29
+ - [Diagnose render failures](./pages/docs/guides/errors-and-debugging.md): Use template attribution, preview diagnostics, and exact error messages to recover from a failed render.
30
+ - [Deploy and operate](./pages/docs/guides/deployment.md): Size, cache, queue, and monitor PDF rendering on a tested Node target.
31
+ - [Production recipes](./pages/docs/guides/recipes.md): Copyable Vue patterns for invoices, statements, reports, repeating matter, and payment QR codes.
32
+ - [Render outside Nitro](./pages/docs/guides/standalone-node.md): Compile PDF templates once and render the generated registry in a Node worker.
33
+ - [Module options](./pages/docs/reference/module-options.md): Build-time configuration for registered fonts, remote images, and render budgets.
34
+ - [definePdf](./pages/docs/reference/define-pdf.md): The compile-time definition for render metadata, development preview data, and the multi-pass limit.
35
+ - [Registry and render result](./pages/docs/reference/registry.md): The typed #pdf server module, runtime dispatch, and completed render conversions.
36
+ - [Primitives](./pages/docs/reference/primitives.md): Prop tables for every document and SVG primitive, drawn from the shipped type definitions.
37
+ - [Styles](./pages/docs/reference/styles.md): Accepted style keys, values, units, inheritance, and primitive support.
38
+ - [Page sizes](./pages/docs/reference/page-sizes.md): Named and custom page dimensions accepted by PdfPage.
39
+ - [Composables](./pages/docs/reference/composables.md): The auto-imported usePdfPageNumbers map that activates multi-pass layout.
40
+ - [Errors and limits](./pages/docs/reference/errors-and-limits.md): Error classes, exact codes, render-budget defaults, and when each failure occurs.
41
+ - [Test utilities](./pages/docs/reference/test-utilities.md): The render, parse, assert, and snapshot exports of @lupinum/nuxt-pdf/test.
42
+ - [Standalone build and runtime](./pages/docs/reference/standalone.md): Production registry generation and Node runtime exports outside Nitro.
43
+ - [Example gallery](./pages/docs/examples.md): Six playground templates and the technique that each template demonstrates.
44
+ - [Supported behavior and limitations](./pages/docs/examples/supported-behavior.md): The public compatibility boundary and where to find its executable evidence.
@@ -42,30 +42,15 @@ export default defineNuxtConfig({
42
42
  })
43
43
  ```
44
44
 
45
- ### Use a coding agent
45
+ ### Set up your coding agent
46
46
 
47
- A coding agent is a development tool that can inspect and change your project.
48
- After installation, copy this prompt into your coding agent:
47
+ Nuxt PDF ships its documentation inside the package, so coding agents read the
48
+ pages that match the installed version. Give your coding agent this task:
49
49
 
50
50
  ```text
51
- Add Nuxt PDF to this Nuxt application and render one PDF from a Vue template.
52
- Read the project's existing instructions first. Resolve
53
- @lupinum/nuxt-pdf/agent-docs from this application's directory and read its
54
- starting pages. Use the installed version's examples and public types. Preserve
55
- existing routes, security limits, conventions, and AGENTS.md instructions. Add
56
- or update one short Nuxt PDF pointer in AGENTS.md if the project allows it; do
57
- not duplicate the documentation. If the file is absent, create only that
58
- pointer. Report missing guidance. Verify the server route, PDF output, and one
59
- invalid request.
51
+ Set up @lupinum/nuxt-pdf for coding agents as described under "Agent setup" in its README.
60
52
  ```
61
53
 
62
- If the installed package has no `agent-docs` export, read its packaged README,
63
- types, and `CONFORMANCE.md`. Use documentation from the matching source tag when
64
- more detail is needed. Installing or updating the package does not edit project
65
- instructions. The pointer resolves the installed package, so upgrades and
66
- rollbacks select the matching documentation without copying it into your
67
- application.
68
-
69
54
  The module now discovers Vue templates under `pdfs/`, generates the typed
70
55
  server-only `#pdf` registry, and adds the `/_pdf` development preview.
71
56
 
@@ -59,3 +59,5 @@ contains the maintainer-grade evidence.
59
59
 
60
60
  <card title="Render your first PDF" description="Create and download a small invoice." icon="lucide:rocket" to="/docs/getting-started/quickstart" />
61
61
  </cards>
62
+
63
+ Questions? Ask in the [Lupinum OSS Discord](https://discord.lupinum.com).
@@ -36,9 +36,7 @@ attribution are registry internals and are not public test configuration.
36
36
  ## renderPdfSfc
37
37
 
38
38
  ```ts
39
- const rendered = await renderPdfSfc('./pdfs/invoice.vue', props, {
40
- fonts: [{ family: 'Invoice Sans', src: 'InvoiceSans-Regular.ttf' }],
41
- })
39
+ const rendered = await renderPdfSfc('./pdfs/invoice.vue', props)
42
40
  ```
43
41
 
44
42
  Compiles a real template and its nested child SFCs with the production
@@ -48,6 +46,12 @@ the application root and template identity are inferred from the `pdfs/*.vue`
48
46
  path. `loadPdfSfc` exposes only the compile step when a test needs the Vue
49
47
  component separately.
50
48
 
49
+ When `fonts` is omitted, the helper reads `pdf.fonts` from the application's
50
+ Nuxt configuration, including its layers. It does not start Nuxt modules or
51
+ load dotenv files. Explicit `fonts` replaces that list; pass `fonts: []` for
52
+ built-in fonts only. Invalid configured fonts fail the test. The helper still
53
+ takes `remote` and `limits` explicitly.
54
+
51
55
  ## parsePdf
52
56
 
53
57
  ```ts
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lupinum/nuxt-pdf",
3
- "version": "0.4.0-beta.5",
3
+ "version": "0.4.0-beta.6",
4
4
  "configKey": "pdf",
5
5
  "docs": "https://nuxt-pdf.lupinum.com",
6
6
  "compatibility": {
package/dist/module.mjs CHANGED
@@ -16,7 +16,7 @@ import 'unimport';
16
16
  import '../dist/runtime/shared/template.js';
17
17
  import '../dist/runtime/server/assets/resolve-asset.js';
18
18
 
19
- const version = "0.4.0-beta.5";
19
+ const version = "0.4.0-beta.6";
20
20
 
21
21
  const existingDirectories = async (directories) => {
22
22
  const result = [];
package/dist/test.mjs CHANGED
@@ -10,6 +10,7 @@ import { mkdir, writeFile, rm, readFile, readdir } from 'node:fs/promises';
10
10
  import { resolve, dirname, join, relative, basename } from 'node:path';
11
11
  import { pathToFileURL, fileURLToPath } from 'node:url';
12
12
  import { build } from 'esbuild';
13
+ import { loadNuxtConfig } from '@nuxt/kit';
13
14
  import { t as templateKeyFromRelativePath, a as discoverPdfImageFiles, b as bundlePdfFonts, c as compilePdfSfc } from './shared/nuxt-pdf.C-E8MM_K.mjs';
14
15
  import { pdfImageFormatFromKey } from '../dist/runtime/server/assets/resolve-asset.js';
15
16
  import '@vue/compiler-sfc';
@@ -571,10 +572,21 @@ async function renderPdfSfc(filename, props, options = {}) {
571
572
  throw new Error(`PDF SFC ${JSON.stringify(entry)} must be a template directly inside pdfs/ or one of its feature directories.`);
572
573
  }
573
574
  const normalizedLimits = normalizePdfLimits(options.limits);
575
+ const config = options.fonts === void 0 ? await loadNuxtConfig({ cwd: rootDir, dotenv: false, globalRc: false }) : void 0;
576
+ const pdfConfig = config && "pdf" in config ? config.pdf : void 0;
577
+ if (pdfConfig !== void 0 && (typeof pdfConfig !== "object" || pdfConfig === null || Array.isArray(pdfConfig))) {
578
+ throw new TypeError("pdf configuration must be an object.");
579
+ }
580
+ const configuredFonts = pdfConfig && "fonts" in pdfConfig ? pdfConfig.fonts : void 0;
581
+ const declaredFonts = options.fonts ?? (configuredFonts === void 0 ? [] : configuredFonts);
582
+ if (!Array.isArray(declaredFonts)) {
583
+ throw new TypeError("pdf.fonts must be an array of local font declarations.");
584
+ }
585
+ const fontRoots = (config?._layers.map((layer) => layer.config.rootDir || layer.cwd) ?? [rootDir]).map((directory) => join(directory, "pdfs", "fonts")).filter((directory) => existsSync(directory));
574
586
  const [component, imageFiles, fonts] = await Promise.all([
575
587
  loadPdfSfc(entry),
576
588
  discoverPdfImageFiles([{ name: "test", rootDir }]),
577
- bundlePdfFonts(options.fonts ?? [], { fontRoots: [join(rootDir, "pdfs", "fonts")] })
589
+ bundlePdfFonts(declaredFonts, { fontRoots })
578
590
  ]);
579
591
  const assets = Object.fromEntries(imageFiles.map((image) => [
580
592
  image.key,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lupinum/nuxt-pdf",
3
- "version": "0.4.0-beta.5",
3
+ "version": "0.4.0-beta.6",
4
4
  "description": "Author and render PDFs with Vue components in Nuxt",
5
5
  "keywords": [
6
6
  "nuxt",
@@ -19,7 +19,6 @@
19
19
  },
20
20
  "author": "Lupinum OG <info@lupinum.com> (https://lupinum.com)",
21
21
  "license": "MIT",
22
- "packageManager": "pnpm@11.21.0",
23
22
  "type": "module",
24
23
  "sideEffects": false,
25
24
  "exports": {
@@ -56,51 +55,6 @@
56
55
  "engines": {
57
56
  "node": "^22.14.0 || ^24.0.0 || ^26.0.0"
58
57
  },
59
- "scripts": {
60
- "prepack": "pnpm docs:build && pnpm docs:package",
61
- "prepublishOnly": "node scripts/block-source-publish.mjs",
62
- "dev": "npm run dev:prepare && nuxt dev playground",
63
- "dev:build": "nuxt build playground",
64
- "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
65
- "build": "nuxt prepare && nuxt-module-build build",
66
- "api:write": "node scripts/check-api-report.mjs --write",
67
- "changelog": "changelogen --no-output",
68
- "docs:build": "pnpm docs:theme && pnpm build && pnpm --dir docs build",
69
- "docs:build:vercel": "node scripts/build-docs-vercel.mjs",
70
- "docs:dev": "pnpm --dir docs dev",
71
- "docs:onboarding": "node scripts/sync-consumer-onboarding.mjs --write",
72
- "docs:package": "node scripts/build-agent-docs.mjs",
73
- "docs:theme": "node scripts/check-docs-theme.mjs",
74
- "format": "eslint . --fix",
75
- "format:check": "node scripts/sync-consumer-onboarding.mjs && eslint .",
76
- "lint": "node scripts/sync-consumer-onboarding.mjs && eslint .",
77
- "test": "pnpm test:prepare && vitest run",
78
- "test:api": "node scripts/check-api-report.mjs",
79
- "release:notes": "node scripts/write-release-notes.mjs",
80
- "release:pack": "pnpm docs:build && pnpm docs:package && node scripts/check-release-artifact.mjs release-artifacts",
81
- "release:prepare": "changelogen --bump --prerelease beta --clean",
82
- "release:verify": "pnpm check:dependencies && pnpm audit:all && pnpm check:source && pnpm docs:build && pnpm docs:package && node scripts/check-release-artifact.mjs release-artifacts",
83
- "test:artifact": "pnpm docs:build && pnpm docs:package && node scripts/check-release-artifact.mjs",
84
- "test:dependencies": "node scripts/check-production-dependencies.mjs",
85
- "test:docs": "node scripts/check-documentation.mjs && pnpm --dir docs check",
86
- "test:package": "node scripts/check-package.mjs",
87
- "test:performance": "node --expose-gc ./node_modules/vitest/vitest.mjs run --config vitest.performance.config.ts",
88
- "test:prepare": "pnpm dev:prepare && nuxt prepare test/fixtures/layers",
89
- "test:production": "pnpm build && vitest run --config vitest.production.config.ts",
90
- "test:quickstart": "node scripts/test-package-quickstart.mjs",
91
- "test:raster": "vitest run --config vitest.raster.config.ts",
92
- "test:version-headings": "node scripts/check-version-headings.mjs",
93
- "test:workflows": "node scripts/check-workflow-policy.mjs && node scripts/test-npm-recovery.mjs && node scripts/test-release-recovery.mjs",
94
- "check:vercel": "node scripts/check-vercel-config.mjs",
95
- "test:serverless": "vitest run --config vitest.serverless.config.ts",
96
- "test:watch": "vitest watch",
97
- "typecheck": "pnpm test:prepare && nuxt prepare && vue-tsc --noEmit && nuxt prepare test/fixtures/basic && vue-tsc --noEmit -p test/fixtures/basic/tsconfig.json && pnpm --dir playground exec vue-tsc --noEmit",
98
- "audit:all": "pnpm audit",
99
- "check:dependencies": "node scripts/check-dependency-policy.mjs",
100
- "verify": "pnpm check:dependencies && pnpm audit:all && pnpm check",
101
- "check": "pnpm check:source && pnpm test:artifact",
102
- "check:source": "pnpm format:check && pnpm check:vercel && pnpm typecheck && pnpm test:docs && pnpm test:version-headings && pnpm test:workflows && pnpm test:dependencies && pnpm test && pnpm test:production && pnpm test:serverless && pnpm build && pnpm test:api && pnpm dev:build"
103
- },
104
58
  "dependencies": {
105
59
  "@jridgewell/remapping": "2.3.5",
106
60
  "@nuxt/kit": "^4.5.2",
@@ -133,6 +87,8 @@
133
87
  },
134
88
  "devDependencies": {
135
89
  "@arethetypeswrong/cli": "^0.18.5",
90
+ "@changesets/changelog-github": "1.0.1",
91
+ "@changesets/cli": "3.0.3",
136
92
  "@jridgewell/trace-mapping": "0.3.31",
137
93
  "@napi-rs/canvas": "0.1.97",
138
94
  "@nuxt/devtools": "^3.3.1",
@@ -143,7 +99,6 @@
143
99
  "@react-pdf/renderer": "4.5.1",
144
100
  "@types/node": "26.1.1",
145
101
  "@types/react": "19.2.14",
146
- "changelogen": "0.6.2",
147
102
  "eslint": "^10.4.1",
148
103
  "nuxt": "^4.5.2",
149
104
  "pdfjs-dist": "6.2.108",
@@ -154,5 +109,26 @@
154
109
  "vitest": "^4.1.8",
155
110
  "vue": "3.5.42",
156
111
  "yaml": "2.9.0"
112
+ },
113
+ "scripts": {
114
+ "dev": "pnpm dev:prepare && nuxt dev playground",
115
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
116
+ "build": "nuxt-module-build prepare && nuxt-module-build build && pnpm docs:build && node scripts/agent-docs.mjs && publint",
117
+ "lint": "eslint . && node scripts/lint-changesets.mjs",
118
+ "format": "eslint . --fix",
119
+ "typecheck": "pnpm test:prepare && nuxt prepare && vue-tsc --noEmit && nuxt prepare test/fixtures/basic && vue-tsc --noEmit -p test/fixtures/basic/tsconfig.json && pnpm --dir playground exec vue-tsc --noEmit",
120
+ "test": "pnpm test:prepare && vitest run",
121
+ "test:prepare": "pnpm dev:prepare && nuxt prepare test/fixtures/layers",
122
+ "test:production": "nuxt-module-build prepare && nuxt-module-build build && vitest run --config vitest.production.config.ts && vitest run --config vitest.serverless.config.ts && nuxt build playground",
123
+ "test:raster": "vitest run --config vitest.raster.config.ts",
124
+ "test:performance": "node --expose-gc ./node_modules/vitest/vitest.mjs run --config vitest.performance.config.ts",
125
+ "test:docs": "node scripts/check-docs-snippets.mjs && node scripts/check-docs-contracts.mjs && pnpm --dir docs check",
126
+ "test:api": "node scripts/check-api-report.mjs",
127
+ "test:packed": "node scripts/check-package.mjs && node scripts/test-package-quickstart.mjs",
128
+ "api:write": "node scripts/check-api-report.mjs --write",
129
+ "docs:dev": "pnpm --dir docs dev",
130
+ "docs:build": "nuxt-module-build prepare && pnpm --dir docs build",
131
+ "verify": "pnpm lint && pnpm typecheck && pnpm test:docs && pnpm test && pnpm test:production && pnpm build && pnpm test:api && pnpm test:packed && node scripts/audit-deps.mjs",
132
+ "changeset": "changeset"
157
133
  }
158
- }
134
+ }
@@ -1,215 +0,0 @@
1
- {
2
- "schemaVersion": 1,
3
- "name": "@lupinum/nuxt-pdf",
4
- "version": "0.4.0-beta.5",
5
- "entrySha256": "51269576487bbfde32f8e920ae5e3cb6915af6d39f4da33149bbe87695507ee9",
6
- "startRoutes": [
7
- "/docs/getting-started/installation",
8
- "/docs/reference/module-options"
9
- ],
10
- "pages": [
11
- {
12
- "title": "Example gallery",
13
- "route": "/docs/examples",
14
- "url": "https://nuxt-pdf.lupinum.com/docs/examples",
15
- "file": "pages/docs/examples.md",
16
- "sha256": "ef7a42c0ce6140e02375fd4435455424d7c6cfea47a68529c6f6d2520d797c8f"
17
- },
18
- {
19
- "title": "Supported behavior and limitations",
20
- "route": "/docs/examples/supported-behavior",
21
- "url": "https://nuxt-pdf.lupinum.com/docs/examples/supported-behavior",
22
- "file": "pages/docs/examples/supported-behavior.md",
23
- "sha256": "a6911a6f48321d1f40367de827d268aa5da563b205066f4558e23f37db96622e"
24
- },
25
- {
26
- "title": "Overview",
27
- "route": "/docs/getting-started",
28
- "url": "https://nuxt-pdf.lupinum.com/docs/getting-started",
29
- "file": "pages/docs/getting-started.md",
30
- "sha256": "2b4b8cf86ebd7f07f4e66050e025e81e0e987ae0f102ac99a9b62e2ec70fc00d"
31
- },
32
- {
33
- "title": "Install Nuxt PDF",
34
- "route": "/docs/getting-started/installation",
35
- "url": "https://nuxt-pdf.lupinum.com/docs/getting-started/installation",
36
- "file": "pages/docs/getting-started/installation.md",
37
- "sha256": "4f5e64077d1de654b6cf073f1dbb8bb28eb81df7955dc74ec99dcf015599f9de"
38
- },
39
- {
40
- "title": "Render your first PDF",
41
- "route": "/docs/getting-started/quickstart",
42
- "url": "https://nuxt-pdf.lupinum.com/docs/getting-started/quickstart",
43
- "file": "pages/docs/getting-started/quickstart.md",
44
- "sha256": "a48711287b894ed1b63d4b8bf3c68afec6d855b42dc317b6d0bc25eac7b861ce"
45
- },
46
- {
47
- "title": "Add links, bookmarks, and a table of contents",
48
- "route": "/docs/guides/contents-links-bookmarks",
49
- "url": "https://nuxt-pdf.lupinum.com/docs/guides/contents-links-bookmarks",
50
- "file": "pages/docs/guides/contents-links-bookmarks.md",
51
- "sha256": "1a1041552abf36aeebbda896890f8f0eedda9802aeeb8b35c525f0306f52827f"
52
- },
53
- {
54
- "title": "Deploy and operate",
55
- "route": "/docs/guides/deployment",
56
- "url": "https://nuxt-pdf.lupinum.com/docs/guides/deployment",
57
- "file": "pages/docs/guides/deployment.md",
58
- "sha256": "86a74925ec588c75ba1ccc08e833203c76a279ddc2ea31936eecd6fd905f274f"
59
- },
60
- {
61
- "title": "Diagnose render failures",
62
- "route": "/docs/guides/errors-and-debugging",
63
- "url": "https://nuxt-pdf.lupinum.com/docs/guides/errors-and-debugging",
64
- "file": "pages/docs/guides/errors-and-debugging.md",
65
- "sha256": "3353c927d400557e6e7b7e861a49abc1a6a01240fa5e9c4a8fd621cc8baa6424"
66
- },
67
- {
68
- "title": "Add images and fonts",
69
- "route": "/docs/guides/images-and-fonts",
70
- "url": "https://nuxt-pdf.lupinum.com/docs/guides/images-and-fonts",
71
- "file": "pages/docs/guides/images-and-fonts.md",
72
- "sha256": "cc31e2b4143060aaa4eaa78092864da7a6e3321a97474815be576497e203ef9c"
73
- },
74
- {
75
- "title": "Production recipes",
76
- "route": "/docs/guides/recipes",
77
- "url": "https://nuxt-pdf.lupinum.com/docs/guides/recipes",
78
- "file": "pages/docs/guides/recipes.md",
79
- "sha256": "5146c107305561922599290216f2eba21dc0ca887a2863376a4ca46ef176e3d9"
80
- },
81
- {
82
- "title": "Configure remote images",
83
- "route": "/docs/guides/remote-images",
84
- "url": "https://nuxt-pdf.lupinum.com/docs/guides/remote-images",
85
- "file": "pages/docs/guides/remote-images.md",
86
- "sha256": "1b7a05b48cfac8049c89d60310c2be078b86689a07968a54f31a0530bea16ee2"
87
- },
88
- {
89
- "title": "Build reusable document components",
90
- "route": "/docs/guides/reusable-components",
91
- "url": "https://nuxt-pdf.lupinum.com/docs/guides/reusable-components",
92
- "file": "pages/docs/guides/reusable-components.md",
93
- "sha256": "9a269143397420d8a879a4657c0ab960d303203af561648d63ba58052eb3519c"
94
- },
95
- {
96
- "title": "Render outside Nitro",
97
- "route": "/docs/guides/standalone-node",
98
- "url": "https://nuxt-pdf.lupinum.com/docs/guides/standalone-node",
99
- "file": "pages/docs/guides/standalone-node.md",
100
- "sha256": "e88d80f0bd0d67a46e6cafad12eb167f7a1377b56015686ffd131dc0f49dc55e"
101
- },
102
- {
103
- "title": "Draw SVG graphics",
104
- "route": "/docs/guides/svg-graphics",
105
- "url": "https://nuxt-pdf.lupinum.com/docs/guides/svg-graphics",
106
- "file": "pages/docs/guides/svg-graphics.md",
107
- "sha256": "bbec519d3597b93b61b3c9e51f1b225ddf4cdecb96a311e6320ca68db309a313"
108
- },
109
- {
110
- "title": "Test a PDF",
111
- "route": "/docs/guides/testing",
112
- "url": "https://nuxt-pdf.lupinum.com/docs/guides/testing",
113
- "file": "pages/docs/guides/testing.md",
114
- "sha256": "6682ecc97f05cb034ca9ca3c066312b340847daf4ce96c239977d9b222310a9b"
115
- },
116
- {
117
- "title": "The document tree",
118
- "route": "/docs/learn/document-tree",
119
- "url": "https://nuxt-pdf.lupinum.com/docs/learn/document-tree",
120
- "file": "pages/docs/learn/document-tree.md",
121
- "sha256": "68ed0fa2e2e12b4d29314be363d10cb43cb928cfff3480b0210544bfc3d0d436"
122
- },
123
- {
124
- "title": "Runtime and data loading",
125
- "route": "/docs/learn/runtime-and-data",
126
- "url": "https://nuxt-pdf.lupinum.com/docs/learn/runtime-and-data",
127
- "file": "pages/docs/learn/runtime-and-data.md",
128
- "sha256": "9165121817b58159a1d49a2d92c98d40a30b2a78e05f95b28bb7b089ff5dbbcb"
129
- },
130
- {
131
- "title": "Styling and layout",
132
- "route": "/docs/learn/styling-and-layout",
133
- "url": "https://nuxt-pdf.lupinum.com/docs/learn/styling-and-layout",
134
- "file": "pages/docs/learn/styling-and-layout.md",
135
- "sha256": "9d622634064c18e76e1be2e6dfe33cdff45ff42c249c655fdb5702d846deb851"
136
- },
137
- {
138
- "title": "Templates and the registry",
139
- "route": "/docs/learn/templates-and-registry",
140
- "url": "https://nuxt-pdf.lupinum.com/docs/learn/templates-and-registry",
141
- "file": "pages/docs/learn/templates-and-registry.md",
142
- "sha256": "89cb41b292e81984bdfd087fe12a6838590b0e38a967d72823c5493a8833c564"
143
- },
144
- {
145
- "title": "Composables",
146
- "route": "/docs/reference/composables",
147
- "url": "https://nuxt-pdf.lupinum.com/docs/reference/composables",
148
- "file": "pages/docs/reference/composables.md",
149
- "sha256": "cbd079540924ceee433d783ac43d5b4d1d35b15675f0f08f474042650fbc8b9a"
150
- },
151
- {
152
- "title": "definePdf",
153
- "route": "/docs/reference/define-pdf",
154
- "url": "https://nuxt-pdf.lupinum.com/docs/reference/define-pdf",
155
- "file": "pages/docs/reference/define-pdf.md",
156
- "sha256": "056dc09669d8cc4ea7a9e7e6dc0021e047e39ea546c610893cdcefeca4c0dce2"
157
- },
158
- {
159
- "title": "Errors and limits",
160
- "route": "/docs/reference/errors-and-limits",
161
- "url": "https://nuxt-pdf.lupinum.com/docs/reference/errors-and-limits",
162
- "file": "pages/docs/reference/errors-and-limits.md",
163
- "sha256": "1b762cb9222cd5f71ab28fdfdb047000bf2359c7aa6702e8fa79b220d4015ea0"
164
- },
165
- {
166
- "title": "Module options",
167
- "route": "/docs/reference/module-options",
168
- "url": "https://nuxt-pdf.lupinum.com/docs/reference/module-options",
169
- "file": "pages/docs/reference/module-options.md",
170
- "sha256": "7bd4db4121d02c8ec95a8e36788eb769baff4c6260357e1700ce16f35f3cbaad"
171
- },
172
- {
173
- "title": "Page sizes",
174
- "route": "/docs/reference/page-sizes",
175
- "url": "https://nuxt-pdf.lupinum.com/docs/reference/page-sizes",
176
- "file": "pages/docs/reference/page-sizes.md",
177
- "sha256": "11421ac6d9ead36da06c839022a4be259fcf75f0d6db0d6860cdc5a4acaf2fbf"
178
- },
179
- {
180
- "title": "Primitives",
181
- "route": "/docs/reference/primitives",
182
- "url": "https://nuxt-pdf.lupinum.com/docs/reference/primitives",
183
- "file": "pages/docs/reference/primitives.md",
184
- "sha256": "10d1ab379ffd44aae6a1f28123824ab1b8708809bc503a223c27ac31c0e97236"
185
- },
186
- {
187
- "title": "Registry and render result",
188
- "route": "/docs/reference/registry",
189
- "url": "https://nuxt-pdf.lupinum.com/docs/reference/registry",
190
- "file": "pages/docs/reference/registry.md",
191
- "sha256": "a37db3268164ecb17745c18f6ef008fd24e8e568d24eed8747bdfcd169e311fb"
192
- },
193
- {
194
- "title": "Standalone build and runtime",
195
- "route": "/docs/reference/standalone",
196
- "url": "https://nuxt-pdf.lupinum.com/docs/reference/standalone",
197
- "file": "pages/docs/reference/standalone.md",
198
- "sha256": "cd7b4e5e68c372fb1ca4f02642abad01040d115504f6eb18ff307d94f495cf4d"
199
- },
200
- {
201
- "title": "Styles",
202
- "route": "/docs/reference/styles",
203
- "url": "https://nuxt-pdf.lupinum.com/docs/reference/styles",
204
- "file": "pages/docs/reference/styles.md",
205
- "sha256": "b59ef442049b49504b3f0938c89baeff4ebbbe0522d36e18be2ab2a6a32d6eb8"
206
- },
207
- {
208
- "title": "Test utilities",
209
- "route": "/docs/reference/test-utilities",
210
- "url": "https://nuxt-pdf.lupinum.com/docs/reference/test-utilities",
211
- "file": "pages/docs/reference/test-utilities.md",
212
- "sha256": "81dc793263f88b0238fcba3717afa4a2b829e8f7bbdb713ec312e2b43b44ca1a"
213
- }
214
- ]
215
- }