@vue-pdf-viewer/viewer 4.3.0-rc.4 → 4.4.0-beta.0

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/dist/license.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./VPdfViewer.vue_vue_type_style_index_1_scoped_1bbfb09f_lang-CIg28wCo.cjs");exports.LicenseProduct=e.L;exports.LicenseType=e.a;exports.useLicense=e.u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./VPdfViewer.vue_vue_type_style_index_1_scoped_1bbfb09f_lang-BbddZ1fa.cjs");exports.LicenseProduct=e.L;exports.LicenseType=e.a;exports.useLicense=e.u;
package/dist/license.js CHANGED
@@ -1,4 +1,4 @@
1
- import { L as a, a as c, u as L } from "./VPdfViewer.vue_vue_type_style_index_1_scoped_1bbfb09f_lang-BDhRLbBu.js";
1
+ import { L as a, a as c, u as L } from "./VPdfViewer.vue_vue_type_style_index_1_scoped_1bbfb09f_lang-CYnRwP6V.js";
2
2
  export {
3
3
  a as LicenseProduct,
4
4
  c as LicenseType,
@@ -1,6 +1,7 @@
1
1
  import type { MaybeRef } from 'vue';
2
2
  import { type PDFOptions, type PDFSrc, type PDFDocumentOptions } from '../utils/types';
3
3
  import { type PDFDocumentProxy, type PDFPageProxy } from 'pdfjs-dist/types/src/display/api';
4
+ export declare function configWorker(workerSrc?: string, legacy?: boolean): void;
4
5
  declare function usePdf(src: MaybeRef<PDFSrc>, options?: PDFOptions, workerUrl?: string, documentOptions?: PDFDocumentOptions, wasmUrl?: string): {
5
6
  pdfDocLoadingTask: import("vue").ShallowRef<import("pdfjs-dist/types/src/display/api").PDFDocumentLoadingTask | undefined, import("pdfjs-dist/types/src/display/api").PDFDocumentLoadingTask | undefined>;
6
7
  getPage: (doc: PDFDocumentProxy, pageIndex: number) => Promise<PDFPageProxy>;
@@ -375,8 +375,11 @@ export interface TextHighlight {
375
375
  export interface VPdfViewerProps {
376
376
  src: MaybeRef<VPVSrc>;
377
377
  /**
378
- * The path of your prefer pdfjs worker
379
- * If unspecified, the viewer will use the worker from pdfjs-dist@3.11.174
378
+ * The URL of the PDF.js worker.
379
+ * If unspecified, the viewer uses the worker shipped in `@vue-pdf-viewer/viewer/assets/`
380
+ * (same version as the bundled `pdfjs-dist`), loaded as a real file so a CSP of
381
+ * `script-src 'self'` is sufficient. Setting this disables the automatic legacy-worker
382
+ * fallback for browsers without `Promise.withResolvers`.
380
383
  */
381
384
  workerUrl?: string;
382
385
  /**
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Pure resolution of the PDF.js worker URL. No DOM, no PDF.js, no Vue — see
3
+ * specs/004-csp-safe-pdf-worker/contracts/worker-url-resolution.md.
4
+ */
5
+ export interface WorkerUrlInputs {
6
+ /** `workerUrl` prop. An empty string counts as absent. */
7
+ explicitUrl?: string;
8
+ /** `VPV:pdfLegacyWorker` session flag. */
9
+ legacy: boolean;
10
+ /** Default export of `virtual:vpv-pdf-worker-url`. */
11
+ bundledUrl: string;
12
+ /** Default export of `virtual:vpv-pdf-worker-legacy-url`. */
13
+ bundledLegacyUrl: string;
14
+ }
15
+ export interface WorkerUrlResult {
16
+ url: string;
17
+ /** True when the Vite/Nuxt dependency pre-bundle rewrite was applied. */
18
+ rewritten: boolean;
19
+ }
20
+ export declare function rewritePrebundledUrl(url: string): string;
21
+ export declare function resolveWorkerUrl(inputs: WorkerUrlInputs): WorkerUrlResult;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue-pdf-viewer/viewer",
3
3
  "private": false,
4
- "version": "4.3.0-rc.4",
4
+ "version": "4.4.0-beta.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
@@ -43,7 +43,8 @@
43
43
  "require": "./dist/license.cjs",
44
44
  "types": "./dist/types/license.d.ts"
45
45
  },
46
- "./assets": "./dist/assets"
46
+ "./assets": "./dist/assets",
47
+ "./assets/*": "./dist/assets/*"
47
48
  },
48
49
  "style": "./dist/style/index.css",
49
50
  "types": "./dist/types/index.d.ts",
@@ -57,15 +58,17 @@
57
58
  "format": "prettier --write .",
58
59
  "prebuild": "vitest run",
59
60
  "postbuild": "vue-tsc --declaration --emitDeclarationOnly -p tsconfig.build.json",
60
- "build": "vite build",
61
+ "build": "vite build && bun run verify:dist",
62
+ "verify:dist": "node scripts/verify-dist.mjs",
63
+ "typecheck:build": "tsc --noEmit -p tsconfig.node.json",
61
64
  "preview": "vite preview",
62
65
  "test": "vitest",
63
- "prepublishOnly": "bun run vite build && bun run postbuild",
66
+ "prepublishOnly": "bun run vite build && bun run verify:dist && bun run postbuild",
64
67
  "shadcn:add": "bunx shadcn-vue@latest add",
65
68
  "prepare": "husky"
66
69
  },
67
70
  "dependencies": {
68
- "@vue-pdf-viewer/shared": "1.6.1-rc.0",
71
+ "@vue-pdf-viewer/shared": "1.6.1",
69
72
  "@vueuse/core": "^13.6.0",
70
73
  "node-forge": "^1.3.2",
71
74
  "pdfjs-dist": "5.4.530",
@@ -114,7 +117,6 @@
114
117
  "unocss-preset-shadcn": "^0.3.1",
115
118
  "vite": "^5.2.8",
116
119
  "vite-plugin-node-polyfills": "^0.21.0",
117
- "vite-plugin-static-copy": "^3.1.2",
118
120
  "vite-svg-loader": "^5.1.0",
119
121
  "vitest": "^3.2.4",
120
122
  "vitest-browser-vue": "^1.1.0",
File without changes