@file-viewer/pptx 2.3.0 → 2.4.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/worker.js +12 -1
- package/package.json +1 -1
package/dist/worker.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
const viteOptimizedWorkerPathPattern = /\/\.?vite\/deps\/worker\/pptx\.worker\.js$/;
|
|
2
|
+
const viteSourceWorkerModulePattern = /\/src\/worker\.[cm]?[jt]s$/;
|
|
2
3
|
const angularCachePath = '/.angular/cache/';
|
|
3
4
|
const viteOptimizedPptxSourcePattern = /\/\/\s+(node_modules\/(?:\.pnpm\/[^\n]+?\/node_modules\/)?@file-viewer\/pptx\/dist\/worker\.js)\b/;
|
|
4
|
-
const resolveBundledPptxWorkerUrl = () =>
|
|
5
|
+
const resolveBundledPptxWorkerUrl = () => {
|
|
6
|
+
const moduleUrl = new URL(import.meta.url);
|
|
7
|
+
// Workspace demos and source-linked consumer projects let Vite serve this
|
|
8
|
+
// TypeScript module directly from /@fs/.../src/worker.ts. The built Worker
|
|
9
|
+
// remains under dist/worker, so resolving ./worker from the source module
|
|
10
|
+
// points at a directory that does not exist.
|
|
11
|
+
if (viteSourceWorkerModulePattern.test(moduleUrl.pathname)) {
|
|
12
|
+
return new URL('../dist/worker/pptx.worker.js', moduleUrl);
|
|
13
|
+
}
|
|
14
|
+
return new URL('./worker/pptx.worker.js', import.meta.url);
|
|
15
|
+
};
|
|
5
16
|
const canResolveAbsolutePathFrom = (url) => url.protocol !== 'data:' && url.protocol !== 'blob:';
|
|
6
17
|
const resolveViteDevPptxWorkerUrl = (baseUrl) => new URL('/node_modules/@file-viewer/pptx/dist/worker/pptx.worker.js', canResolveAbsolutePathFrom(baseUrl)
|
|
7
18
|
? baseUrl
|