@lupinum/nuxt-pdf 0.4.0-beta.3 → 0.4.0-beta.4

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,28 @@ 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.4
8
+
9
+ [compare changes](https://github.com/lupinum-dev/nuxt-pdf/compare/v0.4.0-beta.3...0.4.0-beta.4)
10
+
11
+ ### Fixed
12
+
13
+ - **deps:** Enforce quarantine in package consumers ([#48](https://github.com/lupinum-dev/nuxt-pdf/pull/48))
14
+ - **assets:** Revalidate disk images across renders ([#49](https://github.com/lupinum-dev/nuxt-pdf/pull/49))
15
+ - **dev:** Export registered PDF component guards ([#50](https://github.com/lupinum-dev/nuxt-pdf/pull/50))
16
+ - **preview:** Rebuild watched templates before refreshing ([#51](https://github.com/lupinum-dev/nuxt-pdf/pull/51))
17
+ - **release:** Bind package evidence to its source graph ([#52](https://github.com/lupinum-dev/nuxt-pdf/pull/52))
18
+
19
+ ### Maintenance
20
+
21
+ - **maintenance:** Verify PDF commands without repeated work ([#53](https://github.com/lupinum-dev/nuxt-pdf/pull/53))
22
+
23
+ ### Tests
24
+
25
+ - **compatibility:** Verify declared PDF consumer versions ([#54](https://github.com/lupinum-dev/nuxt-pdf/pull/54))
26
+ - **assets:** Describe per-render disk validation ([#55](https://github.com/lupinum-dev/nuxt-pdf/pull/55))
27
+ - **production:** Tolerate fixture text whitespace ([#56](https://github.com/lupinum-dev/nuxt-pdf/pull/56))
28
+
7
29
  ## 0.4.0-beta.3 - 2026-09-03
8
30
 
9
31
  ### Added
package/CONFORMANCE.md CHANGED
@@ -1,11 +1,11 @@
1
- # Nuxt PDF 0.4.0-beta.3 conformance
1
+ # Nuxt PDF 0.4.0-beta.4 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.3 boundary |
8
+ | Layer | 0.4.0-beta.4 boundary |
9
9
  |---|---|
10
10
  | Node.js | `^22.14.0`, `^24.0.0`, or `^26.0.0` |
11
11
  | Nuxt | `^4.4.8` |
@@ -261,6 +261,10 @@ The 0.4.0-beta.2 tests verify:
261
261
  content type;
262
262
  - development preview index, viewer, raw PDF, and named scenarios, backed by a
263
263
  separate internal development sidecar;
264
+ - development guards for every global PDF component, including Nuxt
265
+ auto-import misuse outside a PDF template;
266
+ - watched template rebuilds and whole-viewer refreshes that keep the selected
267
+ scenario and replace document bytes with their matching diagnostics;
264
268
  - a production Nitro route rendering through the generated registry;
265
269
  - structural removal of `sampleData` and `scenarios` during production SFC
266
270
  compilation, with unique fixture canaries and preview-only API tokens rejected
@@ -342,6 +346,8 @@ shows up without a restart. The tested boundary includes:
342
346
  - TTF, OTF, and WOFF2 signature/extension/structure validation,
343
347
  registration validation, source byte limits, and source-removal rendering;
344
348
  - explicit local `pdfs/assets` and `pdfs/fonts` roots;
349
+ - independent image validation across roots and after same-size,
350
+ same-timestamp development edits;
345
351
  - rejection of absolute paths, traversal, missing assets, ambiguous sources,
346
352
  unsupported URLs, and symlink escapes; and
347
353
  - font rendering after its source file is removed, and image resolution from
package/dist/build.mjs CHANGED
@@ -5,9 +5,9 @@ import { join, relative, dirname, resolve, isAbsolute } from 'node:path';
5
5
  import { promisify } from 'node:util';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { build } from 'esbuild';
8
- import { d as discoverPdfTemplates, a as discoverPdfImageFiles, b as bundlePdfFonts, c as compilePdfSfc } from './shared/nuxt-pdf.DMC_Rdsz.mjs';
8
+ import { d as discoverPdfTemplates, a as discoverPdfImageFiles, b as bundlePdfFonts, c as compilePdfSfc } from './shared/nuxt-pdf.C-E8MM_K.mjs';
9
9
  import ts from 'typescript';
10
- import { p as preparePdfImageAssets, g as generatePdfRuntimeRegistry, a as generateAuthoringTypes, b as generatePdfRegistryTypes } from './shared/nuxt-pdf.D3hUPqOJ.mjs';
10
+ import { p as preparePdfImageAssets, g as generatePdfRuntimeRegistry, a as generateAuthoringTypes, b as generatePdfRegistryTypes } from './shared/nuxt-pdf.CjVyPF31.mjs';
11
11
  import { normalizeRemoteAssetPolicy } from '../dist/runtime/server/assets/remote.js';
12
12
  import { normalizePdfLimits, DEFAULT_PDF_RENDER_LIMITS } from '../dist/runtime/server/render-limits.js';
13
13
  import 'node:buffer';
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lupinum/nuxt-pdf",
3
- "version": "0.4.0-beta.3",
3
+ "version": "0.4.0-beta.4",
4
4
  "configKey": "pdf",
5
5
  "docs": "https://nuxt-pdf.lupinum.com",
6
6
  "compatibility": {
package/dist/module.mjs CHANGED
@@ -2,9 +2,9 @@ import { stat } from 'node:fs/promises';
2
2
  import { join, isAbsolute, resolve, relative } from 'node:path';
3
3
  import { defineNuxtModule, createResolver, getLayerDirectories, createIsIgnored, addServerTemplate, addTemplate, addImports, addTypeTemplate, logger, addServerHandler, addComponent } from '@nuxt/kit';
4
4
  import { joinURL } from 'ufo';
5
- import { d as discoverPdfTemplates, e as discoverPdfComponentFiles, a as discoverPdfImageFiles, b as bundlePdfFonts, f as createPdfSfcPlugin, g as classifyPdfWatchEvent } from './shared/nuxt-pdf.DMC_Rdsz.mjs';
6
- import { p as preparePdfImageAssets, g as generatePdfRuntimeRegistry, b as generatePdfRegistryTypes, a as generateAuthoringTypes, c as generatePdfPreviewConfig } from './shared/nuxt-pdf.D3hUPqOJ.mjs';
7
- import { PDF_STUB_NAMES } from '../dist/runtime/components/stubs.js';
5
+ import { d as discoverPdfTemplates, e as discoverPdfComponentFiles, a as discoverPdfImageFiles, b as bundlePdfFonts, f as createPdfSfcPlugin, g as classifyPdfWatchEvent } from './shared/nuxt-pdf.C-E8MM_K.mjs';
6
+ import { p as preparePdfImageAssets, g as generatePdfRuntimeRegistry, b as generatePdfRegistryTypes, a as generateAuthoringTypes, c as generatePdfPreviewConfig } from './shared/nuxt-pdf.CjVyPF31.mjs';
7
+ import * as pdfStubs from '../dist/runtime/components/stubs.js';
8
8
  import { normalizeRemoteAssetPolicy } from '../dist/runtime/server/assets/remote.js';
9
9
  import { normalizePdfLimits, DEFAULT_PDF_RENDER_LIMITS } from '../dist/runtime/server/render-limits.js';
10
10
  import 'node:buffer';
@@ -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.3";
19
+ const version = "0.4.0-beta.4";
20
20
 
21
21
  const existingDirectories = async (directories) => {
22
22
  const result = [];
@@ -143,6 +143,14 @@ const module$1 = defineNuxtModule({
143
143
  nuxt.hook("vite:serverCreated", (viteServer, environment) => {
144
144
  if (environment.isClient) clientViteServer = viteServer;
145
145
  });
146
+ const refreshPreview = () => clientViteServer?.ws.send({
147
+ type: "custom",
148
+ event: "nuxt-pdf:update",
149
+ data: {}
150
+ });
151
+ nuxt.hook("nitro:init", (nitro) => {
152
+ nitro.hooks.hook("dev:reload", refreshPreview);
153
+ });
146
154
  nuxt.hook("builder:watch", async (event, path) => {
147
155
  const absolutePath = isAbsolute(path) ? path : resolve(nuxt.options.srcDir, path);
148
156
  const action = classifyPdfWatchEvent(
@@ -158,12 +166,7 @@ const module$1 = defineNuxtModule({
158
166
  await nuxt.callHook("restart");
159
167
  return;
160
168
  }
161
- if (action !== "refresh") return;
162
- clientViteServer?.ws.send({
163
- type: "custom",
164
- event: "nuxt-pdf:update",
165
- data: {}
166
- });
169
+ if (action === "refresh" && /\.(?:png|jpe?g)$/i.test(absolutePath)) refreshPreview();
167
170
  });
168
171
  addServerTemplate({
169
172
  filename: "#pdf-preview-config",
@@ -182,7 +185,7 @@ const module$1 = defineNuxtModule({
182
185
  view: { type: "iframe", src: joinURL(nuxt.options.app.baseURL || "/", "_pdf") }
183
186
  });
184
187
  });
185
- for (const name of PDF_STUB_NAMES) {
188
+ for (const name of Object.keys(pdfStubs)) {
186
189
  addComponent({
187
190
  name,
188
191
  export: name,
@@ -1,10 +1,22 @@
1
- import { defineComponent } from 'vue';
2
- /**
3
- * Development-only guards for the global `Pdf*` component names. Types declare
4
- * these names globally so `pdfs/*.vue` templates typecheck, which means an
5
- * accidental `<PdfText>` inside an ordinary app component also typechecks
6
- * while resolving to nothing at runtime. Registering these stubs turns that
7
- * silent failure into an immediate, actionable error.
8
- */
9
- export declare const PDF_STUB_NAMES: readonly ["PdfCircle", "PdfClipPath", "PdfDefs", "PdfDocument", "PdfEllipse", "PdfG", "PdfImage", "PdfLine", "PdfLinearGradient", "PdfLink", "PdfNote", "PdfPage", "PdfPath", "PdfPolygon", "PdfPolyline", "PdfRadialGradient", "PdfRect", "PdfStop", "PdfSvg", "PdfText", "PdfTspan", "PdfView"];
10
- export declare const createPdfStubs: () => Record<string, ReturnType<typeof defineComponent>>;
1
+ export declare const PdfCircle: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export declare const PdfClipPath: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
3
+ export declare const PdfDefs: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
4
+ export declare const PdfDocument: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
5
+ export declare const PdfEllipse: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ export declare const PdfG: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ export declare const PdfImage: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ export declare const PdfLine: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
9
+ export declare const PdfLinearGradient: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
10
+ export declare const PdfLink: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
+ export declare const PdfNote: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
12
+ export declare const PdfPage: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
13
+ export declare const PdfPath: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
14
+ export declare const PdfPolygon: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
15
+ export declare const PdfPolyline: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
16
+ export declare const PdfRadialGradient: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
17
+ export declare const PdfRect: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
18
+ export declare const PdfStop: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
19
+ export declare const PdfSvg: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
20
+ export declare const PdfText: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
21
+ export declare const PdfTspan: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
22
+ export declare const PdfView: import("vue").DefineComponent<{}, never, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -1,29 +1,5 @@
1
1
  import { defineComponent } from "vue";
2
2
  import { NuxtPdfError, PDF_ERROR_CODES } from "../shared/errors.js";
3
- export const PDF_STUB_NAMES = [
4
- "PdfCircle",
5
- "PdfClipPath",
6
- "PdfDefs",
7
- "PdfDocument",
8
- "PdfEllipse",
9
- "PdfG",
10
- "PdfImage",
11
- "PdfLine",
12
- "PdfLinearGradient",
13
- "PdfLink",
14
- "PdfNote",
15
- "PdfPage",
16
- "PdfPath",
17
- "PdfPolygon",
18
- "PdfPolyline",
19
- "PdfRadialGradient",
20
- "PdfRect",
21
- "PdfStop",
22
- "PdfSvg",
23
- "PdfText",
24
- "PdfTspan",
25
- "PdfView"
26
- ];
27
3
  const stubMessage = (name) => `<${name}> only works inside a discovered pdfs/*.vue template rendered by @lupinum/nuxt-pdf. Move this component under pdfs/, or replace it with ordinary Vue/HTML components.`;
28
4
  const createPdfStub = (name) => defineComponent({
29
5
  name,
@@ -32,6 +8,25 @@ const createPdfStub = (name) => defineComponent({
32
8
  },
33
9
  render: () => null
34
10
  });
35
- export const createPdfStubs = () => Object.fromEntries(
36
- PDF_STUB_NAMES.map((name) => [name, createPdfStub(name)])
37
- );
11
+ export const PdfCircle = createPdfStub("PdfCircle");
12
+ export const PdfClipPath = createPdfStub("PdfClipPath");
13
+ export const PdfDefs = createPdfStub("PdfDefs");
14
+ export const PdfDocument = createPdfStub("PdfDocument");
15
+ export const PdfEllipse = createPdfStub("PdfEllipse");
16
+ export const PdfG = createPdfStub("PdfG");
17
+ export const PdfImage = createPdfStub("PdfImage");
18
+ export const PdfLine = createPdfStub("PdfLine");
19
+ export const PdfLinearGradient = createPdfStub("PdfLinearGradient");
20
+ export const PdfLink = createPdfStub("PdfLink");
21
+ export const PdfNote = createPdfStub("PdfNote");
22
+ export const PdfPage = createPdfStub("PdfPage");
23
+ export const PdfPath = createPdfStub("PdfPath");
24
+ export const PdfPolygon = createPdfStub("PdfPolygon");
25
+ export const PdfPolyline = createPdfStub("PdfPolyline");
26
+ export const PdfRadialGradient = createPdfStub("PdfRadialGradient");
27
+ export const PdfRect = createPdfStub("PdfRect");
28
+ export const PdfStop = createPdfStub("PdfStop");
29
+ export const PdfSvg = createPdfStub("PdfSvg");
30
+ export const PdfText = createPdfStub("PdfText");
31
+ export const PdfTspan = createPdfStub("PdfTspan");
32
+ export const PdfView = createPdfStub("PdfView");
@@ -276,29 +276,7 @@ export const loadPdfImageAsset = async (relativePath, options) => {
276
276
  "The local PDF image was not found in a configured asset root."
277
277
  );
278
278
  };
279
- const RESOLVED_IMAGE_CACHE_BYTES = 32 * 1024 * 1024;
280
- const resolvedImageCache = /* @__PURE__ */ new Map();
281
- let resolvedImageCacheBytes = 0;
282
279
  const embeddedImageCache = /* @__PURE__ */ new WeakMap();
283
- const rememberResolvedImage = (cacheKey, image) => {
284
- if (resolvedImageCache.has(cacheKey)) return;
285
- resolvedImageCache.set(cacheKey, image);
286
- resolvedImageCacheBytes += image.data.byteLength;
287
- while (resolvedImageCacheBytes > RESOLVED_IMAGE_CACHE_BYTES && resolvedImageCache.size > 1) {
288
- const oldest = resolvedImageCache.keys().next().value;
289
- if (oldest === void 0) break;
290
- resolvedImageCacheBytes -= resolvedImageCache.get(oldest).data.byteLength;
291
- resolvedImageCache.delete(oldest);
292
- }
293
- };
294
- const cachedResolvedImage = (cacheKey) => {
295
- const cached = resolvedImageCache.get(cacheKey);
296
- if (!cached) return void 0;
297
- return {
298
- ...cached,
299
- data: Buffer.from(cached.data)
300
- };
301
- };
302
280
  const resolveLocalImage = async (source, assets, maxBytes, maxPixels, declaredFormat) => {
303
281
  const key = canonicalAssetKey(source);
304
282
  const pathFormat = formatFromExtension(key);
@@ -328,8 +306,8 @@ const resolveLocalImage = async (source, assets, maxBytes, maxPixels, declaredFo
328
306
  byLimits = /* @__PURE__ */ new Map();
329
307
  embeddedImageCache.set(entry, byLimits);
330
308
  }
331
- const cached2 = byLimits.get(limitsKey);
332
- if (cached2) return { ...cached2, data: Buffer.from(cached2.data) };
309
+ const cached = byLimits.get(limitsKey);
310
+ if (cached) return { ...cached, data: Buffer.from(cached.data) };
333
311
  const resolved2 = validateImageBytes(
334
312
  Buffer.from(entry.dataB64, "base64"),
335
313
  maxBytes,
@@ -339,21 +317,6 @@ const resolveLocalImage = async (source, assets, maxBytes, maxPixels, declaredFo
339
317
  byLimits.set(limitsKey, resolved2);
340
318
  return { ...resolved2, data: Buffer.from(resolved2.data) };
341
319
  }
342
- let fileStat;
343
- try {
344
- fileStat = await stat(resolve(entry.root, ...key.split("/")));
345
- } catch (error) {
346
- if (isMissingFileError(error)) {
347
- return invalid(`The local PDF image "${key}" was not found under pdfs/assets.`);
348
- }
349
- return invalid("The local PDF image cannot be inspected.", error);
350
- }
351
- if (!fileStat.isFile()) {
352
- return invalid("The local PDF image is not a regular file.");
353
- }
354
- const cacheKey = `disk\0${key}\0${fileStat.mtimeMs}\0${fileStat.size}\0${maxBytes}\0${maxPixels}`;
355
- const cached = cachedResolvedImage(cacheKey);
356
- if (cached) return cached;
357
320
  const loaded = await loadPdfImageAsset(key, {
358
321
  roots: [entry.root],
359
322
  maxBytes,
@@ -366,7 +329,6 @@ const resolveLocalImage = async (source, assets, maxBytes, maxPixels, declaredFo
366
329
  pixels: loaded.pixels,
367
330
  width: loaded.width
368
331
  });
369
- rememberResolvedImage(cacheKey, resolved);
370
332
  return { ...resolved, data: Buffer.from(resolved.data) };
371
333
  };
372
334
  const isRemoteCandidate = (source) => /^https?:/i.test(source);
@@ -233,7 +233,7 @@ const viewerPage = async (template, props, rootPath, scenario, hmrClientPath2 =
233
233
  }
234
234
  return htmlResponse(
235
235
  title,
236
- `<header><h1>${escapeHtml(title)}</h1>${actions}</header>${nav}${body}<script type="module">import { createHotContext } from ${JSON.stringify(hmrClientPath2)};createHotContext('/_pdf').on('nuxt-pdf:update',()=>{const frame=document.querySelector('iframe');if(frame&&frame.contentWindow){frame.contentWindow.location.reload();}else{location.reload();}});<\/script>`
236
+ `<header><h1>${escapeHtml(title)}</h1>${actions}</header>${nav}${body}<script type="module">import { createHotContext } from ${JSON.stringify(hmrClientPath2)};createHotContext('/_pdf').on('nuxt-pdf:update',()=>{location.reload();});<\/script>`
237
237
  );
238
238
  };
239
239
  export const renderPdfPreview = async (registry, request = {}) => {
@@ -540,6 +540,7 @@ const createPdfSfcPlugin = (options) => ({
540
540
  if (!filename) return null;
541
541
  const kind = options.files.get(filename);
542
542
  if (!kind) return null;
543
+ this.addWatchFile(filename);
543
544
  return compilePdfSfc(
544
545
  await readFile(filename, "utf8"),
545
546
  filename,
@@ -1,4 +1,4 @@
1
- import { PDF_STUB_NAMES } from '../../dist/runtime/components/stubs.js';
1
+ import * as pdfStubs from '../../dist/runtime/components/stubs.js';
2
2
  import { joinURL } from 'ufo';
3
3
  import { Buffer } from 'node:buffer';
4
4
  import { pdfImageFormatFromKey, loadPdfImageAsset } from '../../dist/runtime/server/assets/resolve-asset.js';
@@ -10,7 +10,7 @@ const generateAuthoringTypes = (componentsImport, composablesImport, definePdfIm
10
10
 
11
11
  declare module 'vue' {
12
12
  interface GlobalComponents {
13
- ${PDF_STUB_NAMES.map((name) => ` ${name}: typeof import(${JSON.stringify(componentsImport)})['${name}']`).join("\n")}
13
+ ${Object.keys(pdfStubs).map((name) => ` ${name}: typeof import(${JSON.stringify(componentsImport)})['${name}']`).join("\n")}
14
14
  }
15
15
  }
16
16
 
package/dist/test.mjs CHANGED
@@ -10,7 +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 { t as templateKeyFromRelativePath, a as discoverPdfImageFiles, b as bundlePdfFonts, c as compilePdfSfc } from './shared/nuxt-pdf.DMC_Rdsz.mjs';
13
+ import { t as templateKeyFromRelativePath, a as discoverPdfImageFiles, b as bundlePdfFonts, c as compilePdfSfc } from './shared/nuxt-pdf.C-E8MM_K.mjs';
14
14
  import { pdfImageFormatFromKey } from '../dist/runtime/server/assets/resolve-asset.js';
15
15
  import '@vue/compiler-sfc';
16
16
  import '@jridgewell/remapping';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lupinum/nuxt-pdf",
3
- "version": "0.4.0-beta.3",
3
+ "version": "0.4.0-beta.4",
4
4
  "description": "Author and render PDFs with Vue components in Nuxt",
5
5
  "keywords": [
6
6
  "nuxt",
@@ -76,12 +76,11 @@
76
76
  "release:notes": "node scripts/write-release-notes.mjs",
77
77
  "release:pack": "pnpm build && node scripts/check-release-artifact.mjs release-artifacts",
78
78
  "release:prepare": "changelogen --bump --clean",
79
- "release:verify": "pnpm verify && pnpm release:pack",
79
+ "release:verify": "pnpm check:dependencies && pnpm audit:all && pnpm check:source && node scripts/check-release-artifact.mjs release-artifacts",
80
80
  "test:artifact": "node scripts/check-release-artifact.mjs",
81
81
  "test:dependencies": "node scripts/check-production-dependencies.mjs",
82
- "test:docs": "node scripts/check-documentation.mjs && pnpm docs:theme && pnpm --dir docs check",
82
+ "test:docs": "node scripts/check-documentation.mjs && pnpm --dir docs check",
83
83
  "test:package": "node scripts/check-package.mjs",
84
- "test:package-metadata": "node scripts/check-api-report.mjs",
85
84
  "test:performance": "node --expose-gc ./node_modules/vitest/vitest.mjs run --config vitest.performance.config.ts",
86
85
  "test:prepare": "pnpm dev:prepare && nuxt prepare test/fixtures/layers",
87
86
  "test:production": "pnpm build && vitest run --config vitest.production.config.ts",
@@ -94,8 +93,10 @@
94
93
  "test:watch": "vitest watch",
95
94
  "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",
96
95
  "audit:all": "pnpm audit",
97
- "verify": "pnpm audit:all && pnpm check",
98
- "check": "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:package-metadata && pnpm dev:build && pnpm test:artifact"
96
+ "check:dependencies": "node scripts/check-dependency-policy.mjs",
97
+ "verify": "pnpm check:dependencies && pnpm audit:all && pnpm check",
98
+ "check": "pnpm check:source && pnpm test:artifact",
99
+ "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"
99
100
  },
100
101
  "dependencies": {
101
102
  "@jridgewell/remapping": "2.3.5",