@repdf/preview 0.3.1 → 0.3.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.
Files changed (51) hide show
  1. package/dist/index.js +14 -6
  2. package/dist/preview/.next/BUILD_ID +1 -1
  3. package/dist/preview/.next/build-manifest.json +6 -5
  4. package/dist/preview/.next/cache/.tsbuildinfo +1 -1
  5. package/dist/preview/.next/cache/webpack/client-production/0.pack +0 -0
  6. package/dist/preview/.next/cache/webpack/client-production/index.pack +0 -0
  7. package/dist/preview/.next/cache/webpack/edge-server-production/index.pack +0 -0
  8. package/dist/preview/.next/cache/webpack/server-production/0.pack +0 -0
  9. package/dist/preview/.next/cache/webpack/server-production/index.pack +0 -0
  10. package/dist/preview/.next/next-minimal-server.js.nft.json +1 -1
  11. package/dist/preview/.next/next-server.js.nft.json +1 -1
  12. package/dist/preview/.next/prerender-manifest.json +1 -1
  13. package/dist/preview/.next/routes-manifest.json +1 -1
  14. package/dist/preview/.next/server/chunks/239.js +3 -3
  15. package/dist/preview/.next/server/chunks/276.js +1 -0
  16. package/dist/preview/.next/server/chunks/444.js +2 -2
  17. package/dist/preview/.next/server/chunks/478.js +1 -0
  18. package/dist/preview/.next/server/functions-config-manifest.json +1 -1
  19. package/dist/preview/.next/server/middleware-build-manifest.js +1 -1
  20. package/dist/preview/.next/server/pages/_app.js +1 -1
  21. package/dist/preview/.next/server/pages/_app.js.nft.json +1 -1
  22. package/dist/preview/.next/server/pages/_document.js +1 -1
  23. package/dist/preview/.next/server/pages/_document.js.nft.json +1 -1
  24. package/dist/preview/.next/server/pages/_error.js +1 -1
  25. package/dist/preview/.next/server/pages/_error.js.nft.json +1 -1
  26. package/dist/preview/.next/server/pages/api/component.js +2 -63
  27. package/dist/preview/.next/server/pages/api/component.js.nft.json +1 -1
  28. package/dist/preview/.next/server/pages/api/pdf.js +2 -2
  29. package/dist/preview/.next/server/pages/api/trpc/[trpc].js +1 -1
  30. package/dist/preview/.next/server/pages/api/trpc/[trpc].js.nft.json +1 -1
  31. package/dist/preview/.next/server/pages/en/404.html +1 -1
  32. package/dist/preview/.next/server/pages/en/500.html +1 -1
  33. package/dist/preview/.next/server/pages/en/test.html +1 -1
  34. package/dist/preview/.next/server/pages/index.js +2 -2
  35. package/dist/preview/.next/server/pages/index.js.nft.json +1 -1
  36. package/dist/preview/.next/server/pages/preview/[...relTemplatePath].js +1 -1
  37. package/dist/preview/.next/server/pages/preview/[...relTemplatePath].js.nft.json +1 -1
  38. package/dist/preview/.next/server/pages/test.js.nft.json +1 -1
  39. package/dist/preview/.next/server/pages-manifest.json +1 -1
  40. package/dist/preview/.next/static/2qhpHXmKu1a7HPYW0h8qX/_buildManifest.js +1 -0
  41. package/dist/preview/.next/static/chunks/837-9d4cc2d57e81e85c.js +1 -0
  42. package/dist/preview/.next/static/chunks/pages/{_app-fb23116bf8c2175a.js → _app-1fae2008e3549d5a.js} +28 -27
  43. package/dist/preview/.next/static/chunks/pages/preview/[...relTemplatePath]-e0152b67b748423c.js +1 -0
  44. package/dist/preview/.next/static/css/{c7f6a8bc767cd2f6.css → 35ecb02d4842937d.css} +1 -1
  45. package/dist/preview/.next/trace +13 -13
  46. package/package.json +4 -3
  47. package/dist/preview/.next/server/chunks/865.js +0 -1
  48. package/dist/preview/.next/server/chunks/900.js +0 -1
  49. package/dist/preview/.next/static/7nZIXWS8ShPv20tmMeSGr/_buildManifest.js +0 -1
  50. package/dist/preview/.next/static/chunks/pages/preview/[...relTemplatePath]-d13b73e31965195a.js +0 -1
  51. /package/dist/preview/.next/static/{7nZIXWS8ShPv20tmMeSGr → 2qhpHXmKu1a7HPYW0h8qX}/_ssgManifest.js +0 -0
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import http$1 from "node:http";
11
11
 
12
12
  //#region package.json
13
13
  var name = "@repdf/preview";
14
- var version = "0.3.0";
14
+ var version = "0.3.2";
15
15
  var type = "module";
16
16
  var main = "dist/index.js";
17
17
  var bin = { "repdf": "./dist/index.js" };
@@ -65,6 +65,7 @@ var dependencies = {
65
65
  "js-dependency-extractor": "^1.0.3",
66
66
  "lucide-react": "^0.453.0",
67
67
  "next": "^14.2.17",
68
+ "nuqs": "^2.8.9",
68
69
  "ora": "^8.1.0",
69
70
  "pino": "^9.4.0",
70
71
  "pino-pretty": "^11.2.2",
@@ -129,15 +130,14 @@ var logger_default = logger;
129
130
  //#endregion
130
131
  //#region src/utils/checkPortAvailability.ts
131
132
  function checkPortAvailability(port) {
132
- return new Promise((resolve) => {
133
+ return new Promise((resolve, reject) => {
133
134
  const server = http.createServer();
134
135
  server.once("error", (err) => {
135
136
  if (err.code === "EADDRINUSE") resolve(false);
136
- else resolve(false);
137
+ else reject(err);
137
138
  });
138
139
  server.once("listening", () => {
139
- server.close();
140
- resolve(true);
140
+ server.close(() => resolve(true));
141
141
  });
142
142
  server.listen(port);
143
143
  });
@@ -161,10 +161,18 @@ const getEnvVariablesForPreviewApp = (relativePathToPdfsDirectory, cwd) => {
161
161
  let previewServer;
162
162
  const startPreviewServer = async (pdfsDirRelativePath, port) => {
163
163
  let actualPort = port;
164
- while (!await checkPortAvailability(actualPort)) {
164
+ while (actualPort <= 65535) {
165
+ let isAvailable = false;
166
+ try {
167
+ isAvailable = await checkPortAvailability(actualPort);
168
+ } catch (error) {
169
+ throw new Error(`Failed to check port ${actualPort}: ${error.message}`);
170
+ }
171
+ if (isAvailable) break;
165
172
  logger_default.info(`port ${actualPort} in use, trying ${actualPort + 1}`);
166
173
  actualPort++;
167
174
  }
175
+ if (actualPort > 65535) throw new Error(`No available ports found starting from ${port} (checked through 65535)`);
168
176
  process.env = {
169
177
  ...process.env,
170
178
  NODE_ENV: "development",
@@ -1 +1 @@
1
- 7nZIXWS8ShPv20tmMeSGr
1
+ 2qhpHXmKu1a7HPYW0h8qX
@@ -5,8 +5,8 @@
5
5
  "devFiles": [],
6
6
  "ampDevFiles": [],
7
7
  "lowPriorityFiles": [
8
- "static/7nZIXWS8ShPv20tmMeSGr/_buildManifest.js",
9
- "static/7nZIXWS8ShPv20tmMeSGr/_ssgManifest.js"
8
+ "static/2qhpHXmKu1a7HPYW0h8qX/_buildManifest.js",
9
+ "static/2qhpHXmKu1a7HPYW0h8qX/_ssgManifest.js"
10
10
  ],
11
11
  "rootMainFiles": [],
12
12
  "pages": {
@@ -21,8 +21,8 @@
21
21
  "static/chunks/webpack-0b5d8249fb15f5f3.js",
22
22
  "static/chunks/framework-e0f347a11a70369e.js",
23
23
  "static/chunks/main-32f0addb06a02100.js",
24
- "static/css/c7f6a8bc767cd2f6.css",
25
- "static/chunks/pages/_app-fb23116bf8c2175a.js"
24
+ "static/css/35ecb02d4842937d.css",
25
+ "static/chunks/pages/_app-1fae2008e3549d5a.js"
26
26
  ],
27
27
  "/_error": [
28
28
  "static/chunks/webpack-0b5d8249fb15f5f3.js",
@@ -35,7 +35,8 @@
35
35
  "static/chunks/framework-e0f347a11a70369e.js",
36
36
  "static/chunks/main-32f0addb06a02100.js",
37
37
  "static/chunks/64-33135d2a0b032c99.js",
38
- "static/chunks/pages/preview/[...relTemplatePath]-d13b73e31965195a.js"
38
+ "static/chunks/837-9d4cc2d57e81e85c.js",
39
+ "static/chunks/pages/preview/[...relTemplatePath]-e0152b67b748423c.js"
39
40
  ],
40
41
  "/test": [
41
42
  "static/chunks/webpack-0b5d8249fb15f5f3.js",