@file-viewer/pptx 3.0.1 → 3.0.3

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.
@@ -0,0 +1,2 @@
1
+ /** Distinguish an emitted asset from an untouched dependency-relative URL. */
2
+ export declare const isResolvedPptxWorkerLocation: (moduleUrl: URL, assetUrl: URL) => boolean;
@@ -0,0 +1,8 @@
1
+ /** Distinguish an emitted asset from an untouched dependency-relative URL. */
2
+ export const isResolvedPptxWorkerLocation = (moduleUrl, assetUrl) => {
3
+ // Keep the comparison URL dynamic: a bundler must only rewrite the static
4
+ // new URL reference in worker.ts, not both sides of this comparison.
5
+ const relativePath = ['worker', 'pptx.worker.js'].join('/');
6
+ const dependencyRelativeUrl = new URL(relativePath, moduleUrl);
7
+ return assetUrl.href !== dependencyRelativeUrl.href || /\/dist\/worker\.[cm]?js$/.test(moduleUrl.pathname);
8
+ };
package/dist/worker.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  import type { PptxWorkerFactoryOptions } from './types';
2
+ /** A package-owned asset needs no speculative requests to a copied-asset manifest. */
3
+ export declare const resolvePptxPackageWorkerUrl: () => string | undefined;
2
4
  export declare const createPptxWorker: (options?: PptxWorkerFactoryOptions) => Worker;
package/dist/worker.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { isResolvedPptxWorkerLocation } from './worker-location.js';
1
2
  const viteOptimizedWorkerPathPattern = /\/\.?vite\/deps\/worker\/pptx\.worker\.js$/;
2
3
  const viteSourceWorkerModulePattern = /\/src\/worker\.[cm]?[jt]s$/;
3
4
  const angularCachePath = '/.angular/cache/';
@@ -73,6 +74,24 @@ const resolveDefaultPptxWorkerUrl = () => {
73
74
  }
74
75
  return defaultPptxWorkerUrl;
75
76
  };
77
+ /** A package-owned asset needs no speculative requests to a copied-asset manifest. */
78
+ export const resolvePptxPackageWorkerUrl = () => {
79
+ try {
80
+ const moduleUrl = new URL(import.meta.url);
81
+ const workerUrl = resolveBundledPptxWorkerUrl();
82
+ if (isResolvedPptxWorkerLocation(moduleUrl, workerUrl))
83
+ return workerUrl.href;
84
+ if (viteOptimizedWorkerPathPattern.test(workerUrl.pathname)) {
85
+ const optimizedUrl = resolveViteOptimizedPptxWorkerUrl(workerUrl);
86
+ return optimizedUrl ? String(optimizedUrl) : undefined;
87
+ }
88
+ }
89
+ catch {
90
+ // An inlined module without a resolvable package base can still use the
91
+ // host's standard copied assets or an explicitly configured Worker URL.
92
+ }
93
+ return undefined;
94
+ };
76
95
  export const createPptxWorker = (options = {}) => {
77
96
  var _a;
78
97
  if (options.workerFactory) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/pptx",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Native PPTX renderer extracted from File Viewer",
@@ -24,12 +24,12 @@
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",
27
- "url": "git+https://github.com/flyfish-dev/pptxjs.git",
27
+ "url": "git+https://github.com/flyfish-dev/file-viewer.git",
28
28
  "directory": "packages/renderers/pptx"
29
29
  },
30
30
  "homepage": "https://doc.file-viewer.app/",
31
31
  "bugs": {
32
- "url": "https://github.com/flyfish-dev/pptxjs/issues"
32
+ "url": "https://github.com/flyfish-dev/file-viewer/issues"
33
33
  },
34
34
  "funding": {
35
35
  "type": "individual",
@@ -61,8 +61,8 @@
61
61
  ],
62
62
  "dependencies": {
63
63
  "dingbat-to-unicode": "^1.0.1",
64
- "dompurify": "^3.4.14",
65
- "jszip": "^3.10.1",
64
+ "dompurify": "3.4.15",
65
+ "jszip": "3.10.2",
66
66
  "tinycolor2": "^1.6.0",
67
67
  "utif": "^3.1.0"
68
68
  },