@repdf/preview 0.5.0 → 0.5.2

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/index.mjs CHANGED
@@ -12,8 +12,11 @@ import * as chokidar from "chokidar";
12
12
  import path$1 from "node:path";
13
13
  import dependencyTree from "dependency-tree";
14
14
  import { glob } from "glob";
15
+ import "esbuild";
16
+ import "source-map-js";
17
+ import "stacktrace-parser";
15
18
  //#region package.json
16
- var version = "0.4.0";
19
+ var version = "0.5.1";
17
20
  //#endregion
18
21
  //#region src/logger.ts
19
22
  const logger = pino({
@@ -152,6 +155,22 @@ function pdfTemplateWatcher() {
152
155
  }
153
156
  }
154
157
  //#endregion
158
+ //#region src/template-loader/get-pdf-component.ts
159
+ const COMPONENT_CACHE_STORE_KEY = "__repdf_preview_getPdfComponentCacheStore__";
160
+ const getComponentCacheStore = () => {
161
+ const globalWithStore = globalThis;
162
+ if (!globalWithStore[COMPONENT_CACHE_STORE_KEY]) globalWithStore[COMPONENT_CACHE_STORE_KEY] = {
163
+ componentCache: /* @__PURE__ */ new Map(),
164
+ inflightBuilds: /* @__PURE__ */ new Map()
165
+ };
166
+ return globalWithStore[COMPONENT_CACHE_STORE_KEY];
167
+ };
168
+ const { componentCache, inflightBuilds } = getComponentCacheStore();
169
+ const clearPdfComponentCache = () => {
170
+ componentCache.clear();
171
+ inflightBuilds.clear();
172
+ };
173
+ //#endregion
155
174
  //#region src/cli/commands/server.ts
156
175
  const __filename = fileURLToPath(import.meta.url);
157
176
  const __dirname = path.dirname(__filename);
@@ -260,6 +279,7 @@ const startPreviewServer = async (pdfsDirRelativePath, port) => {
260
279
  };
261
280
  templateWatcher = pdfTemplateWatcher();
262
281
  templateWatcher.on("all", (event, filePath) => {
282
+ clearPdfComponentCache();
263
283
  const absolutePath = path.isAbsolute(filePath) ? filePath : path.resolve(absolutePathToPdfsDir, filePath);
264
284
  const relPath = path.relative(absolutePathToPdfsDir, absolutePath);
265
285
  pendingChanges.push({
@@ -1 +1 @@
1
- uQjdkl4yTW6Zpf-3uNg2P
1
+ FZ6aXlqGO-aLj-TH9yD3I
@@ -4,8 +4,8 @@
4
4
  ],
5
5
  "devFiles": [],
6
6
  "lowPriorityFiles": [
7
- "static/uQjdkl4yTW6Zpf-3uNg2P/_buildManifest.js",
8
- "static/uQjdkl4yTW6Zpf-3uNg2P/_ssgManifest.js"
7
+ "static/FZ6aXlqGO-aLj-TH9yD3I/_buildManifest.js",
8
+ "static/FZ6aXlqGO-aLj-TH9yD3I/_ssgManifest.js"
9
9
  ],
10
10
  "rootMainFiles": [],
11
11
  "rootMainFilesTree": {},
@@ -1 +1 @@
1
- {"previewModeId":"5f739dd66df2bf0113e6397704146612","previewModeSigningKey":"3e30d460d9841ae936dac02de5699520f6320e828e4abd538d486f9690129811","previewModeEncryptionKey":"72ee6230aaed11e742c6358be39da1f9ca4c55d1ddf746837e23a6e493d02856","expireAt":1774379152992}
1
+ {"previewModeId":"d40fbb4329b168784ada0b1c1125cf04","previewModeSigningKey":"1e1cd48697872824c45c6464b49bc34748c039459df1cef5c4c1d00c8a6dc4a2","previewModeEncryptionKey":"9483644439aa7b04a3f4bf6cd6ba0f4c32bee40d1ae63923eca381e3d11d31dc","expireAt":1774391804415}
@@ -1 +1 @@
1
- {"encryption.key":"y8rBNN9f5CqnZkTMrMg2bW1z7Z+WN1OTeLAibgr6Wpg=","encryption.expire_at":1774379152987}
1
+ {"encryption.key":"aqaHf46LGw8Qjd/GOveOjiYrkQfNjF4RY1HJKPB6r2Y=","encryption.expire_at":1774391804411}