@repdf/preview 0.0.3 → 0.0.5

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 (68) hide show
  1. package/dist/index.cjs +20 -7
  2. package/dist/index.js +19 -7
  3. package/dist/preview/.next/BUILD_ID +1 -0
  4. package/dist/preview/.next/build-manifest.json +41 -0
  5. package/dist/preview/.next/cache/.tsbuildinfo +1 -0
  6. package/dist/preview/.next/cache/webpack/client-production/0.pack +0 -0
  7. package/dist/preview/.next/cache/webpack/client-production/index.pack +0 -0
  8. package/dist/preview/.next/cache/webpack/edge-server-production/0.pack +0 -0
  9. package/dist/preview/.next/cache/webpack/edge-server-production/index.pack +0 -0
  10. package/dist/preview/.next/cache/webpack/server-production/0.pack +0 -0
  11. package/dist/preview/.next/cache/webpack/server-production/index.pack +0 -0
  12. package/dist/preview/.next/export-marker.json +1 -0
  13. package/dist/preview/.next/images-manifest.json +1 -0
  14. package/dist/preview/.next/next-minimal-server.js.nft.json +1 -0
  15. package/dist/preview/.next/next-server.js.nft.json +1 -0
  16. package/dist/preview/.next/package.json +1 -0
  17. package/dist/preview/.next/prerender-manifest.json +1 -0
  18. package/dist/preview/.next/react-loadable-manifest.json +10 -0
  19. package/dist/preview/.next/required-server-files.json +1 -0
  20. package/dist/preview/.next/routes-manifest.json +1 -0
  21. package/dist/preview/.next/server/chunks/240.js +1 -0
  22. package/dist/preview/.next/server/chunks/559.js +1 -0
  23. package/dist/preview/.next/server/chunks/587.js +4 -0
  24. package/dist/preview/.next/server/chunks/701.js +6 -0
  25. package/dist/preview/.next/server/chunks/font-manifest.json +1 -0
  26. package/dist/preview/.next/server/font-manifest.json +1 -0
  27. package/dist/preview/.next/server/functions-config-manifest.json +1 -0
  28. package/dist/preview/.next/server/interception-route-rewrite-manifest.js +1 -0
  29. package/dist/preview/.next/server/middleware-build-manifest.js +1 -0
  30. package/dist/preview/.next/server/middleware-manifest.json +6 -0
  31. package/dist/preview/.next/server/middleware-react-loadable-manifest.js +1 -0
  32. package/dist/preview/.next/server/next-font-manifest.js +1 -0
  33. package/dist/preview/.next/server/next-font-manifest.json +1 -0
  34. package/dist/preview/.next/server/pages/_app.js +1 -0
  35. package/dist/preview/.next/server/pages/_app.js.nft.json +1 -0
  36. package/dist/preview/.next/server/pages/_document.js +1 -0
  37. package/dist/preview/.next/server/pages/_document.js.nft.json +1 -0
  38. package/dist/preview/.next/server/pages/_error.js +1 -0
  39. package/dist/preview/.next/server/pages/_error.js.nft.json +1 -0
  40. package/dist/preview/.next/server/pages/api/component.js +42 -0
  41. package/dist/preview/.next/server/pages/api/component.js.nft.json +1 -0
  42. package/dist/preview/.next/server/pages/api/pdf.js +1 -0
  43. package/dist/preview/.next/server/pages/api/pdf.js.nft.json +1 -0
  44. package/dist/preview/.next/server/pages/api/trpc/[trpc].js +1 -0
  45. package/dist/preview/.next/server/pages/api/trpc/[trpc].js.nft.json +1 -0
  46. package/dist/preview/.next/server/pages/en/404.html +1 -0
  47. package/dist/preview/.next/server/pages/en/500.html +1 -0
  48. package/dist/preview/.next/server/pages/en.html +1 -0
  49. package/dist/preview/.next/server/pages/index.js.nft.json +1 -0
  50. package/dist/preview/.next/server/pages/preview/[...relTemplatePath].js +1 -0
  51. package/dist/preview/.next/server/pages/preview/[...relTemplatePath].js.nft.json +1 -0
  52. package/dist/preview/.next/server/pages-manifest.json +1 -0
  53. package/dist/preview/.next/server/webpack-api-runtime.js +1 -0
  54. package/dist/preview/.next/server/webpack-runtime.js +1 -0
  55. package/dist/preview/.next/static/1Jhp0TAJqxKhIl75SUMGt/_buildManifest.js +1 -0
  56. package/dist/preview/.next/static/1Jhp0TAJqxKhIl75SUMGt/_ssgManifest.js +1 -0
  57. package/dist/preview/.next/static/chunks/160-515f2678c7e1d9ce.js +2 -0
  58. package/dist/preview/.next/static/chunks/framework-0cbe3b56a5f66701.js +1 -0
  59. package/dist/preview/.next/static/chunks/main-b2d89a266d271543.js +1 -0
  60. package/dist/preview/.next/static/chunks/pages/_app-d770e97b1da9a6b5.js +8 -0
  61. package/dist/preview/.next/static/chunks/pages/_error-f68c2d645fc907f4.js +1 -0
  62. package/dist/preview/.next/static/chunks/pages/index-74f4892551876c76.js +1 -0
  63. package/dist/preview/.next/static/chunks/pages/preview/[...relTemplatePath]-04ae2b195e233717.js +1 -0
  64. package/dist/preview/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  65. package/dist/preview/.next/static/chunks/webpack-b8f8d6679aaa5f42.js +1 -0
  66. package/dist/preview/.next/static/css/f94a2eea64dc55ea.css +3 -0
  67. package/dist/preview/.next/trace +13 -0
  68. package/package.json +4 -4
package/dist/index.cjs CHANGED
@@ -29,7 +29,7 @@ var import_commander = require("commander");
29
29
  // package.json
30
30
  var package_default = {
31
31
  name: "@repdf/preview",
32
- version: "0.0.3",
32
+ version: "0.0.5",
33
33
  type: "module",
34
34
  main: "dist/index.js",
35
35
  bin: {
@@ -49,7 +49,7 @@ var package_default = {
49
49
  files: ["dist"],
50
50
  license: "MIT",
51
51
  scripts: {
52
- tsup: "tsup --tsconfig tsconfig.build.json",
52
+ tsup: "tsup --tsconfig tsconfig.build.json && node build-preview-server.js",
53
53
  build: "next build",
54
54
  dev: "next dev",
55
55
  lint: "next lint",
@@ -77,8 +77,8 @@ var package_default = {
77
77
  "js-beautify": "^1.15.1",
78
78
  "js-dependency-extractor": "^1.0.3",
79
79
  "lucide-react": "^0.445.0",
80
- next: "^14.2.14",
81
- nuqs: "^1.19.3",
80
+ next: "^14.2.15",
81
+ nuqs: "^1.20.0",
82
82
  ora: "^8.1.0",
83
83
  pino: "^9.4.0",
84
84
  "pino-pretty": "^11.2.2",
@@ -135,6 +135,7 @@ var import_node_url = require("url");
135
135
  var import_path = __toESM(require("path"), 1);
136
136
  var import_express = __toESM(require("express"), 1);
137
137
  var import_next = __toESM(require("next"), 1);
138
+ var import_url = require("url");
138
139
  var import_ws = __toESM(require("ws"), 1);
139
140
  var import_ws2 = require("ws");
140
141
 
@@ -271,6 +272,12 @@ function pdfTemplateWatcher() {
271
272
  }
272
273
 
273
274
  // src/cli/commands/server.ts
275
+ var import_meta = {};
276
+ var __filename = (0, import_url.fileURLToPath)(import_meta.url);
277
+ var __dirname = import_path.default.dirname(__filename);
278
+ var isDev = !__filename.endsWith("index.js");
279
+ var cliPackageLocation = isDev ? import_path.default.resolve(__dirname, "../..") : import_path.default.resolve(__dirname, "../..");
280
+ var previewServerLocation = isDev ? import_path.default.resolve(__dirname, "../..") : import_path.default.resolve(__dirname, "./preview");
274
281
  var getEnvVariablesForPreviewApp = (relativePathToPdfsDirectory, cwd) => {
275
282
  return {
276
283
  RELATIVE_PATH_TO_PDF_FOLDER: relativePathToPdfsDirectory,
@@ -296,14 +303,16 @@ var startPreviewServer = async (pdfsDirRelativePath, port) => {
296
303
  )
297
304
  };
298
305
  const nextApp = (0, import_next.default)({
299
- dev: true,
300
- //process.env.NODE_ENV !== "production",
306
+ dev: isDev,
301
307
  conf: {
302
308
  images: {
303
309
  // This is to avoid the warning with sharp
304
310
  unoptimized: true
305
311
  }
306
- }
312
+ },
313
+ hostname: "localhost",
314
+ port,
315
+ dir: previewServerLocation
307
316
  });
308
317
  nextApp.prepare().then(() => {
309
318
  previewServer.use((req, res, next2) => {
@@ -372,4 +381,8 @@ var dev = async ({
372
381
  var PACKAGE_NAME = "repdf";
373
382
  import_commander.program.name(PACKAGE_NAME).description("A live preview of your pdf templates").version(package_default.version);
374
383
  import_commander.program.command("dev").description("Starts the preview pdf development app").option("-d --dir <path>", "Directory containing pdf templates", "./src/pdfs").option("-p --port <port>", "Port to run dev server on", "3000").action(dev);
384
+ if (!process.argv.slice(2).length) {
385
+ import_commander.program.outputHelp();
386
+ process.exit(0);
387
+ }
375
388
  import_commander.program.parse();
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { program } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@repdf/preview",
9
- version: "0.0.3",
9
+ version: "0.0.5",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -26,7 +26,7 @@ var package_default = {
26
26
  files: ["dist"],
27
27
  license: "MIT",
28
28
  scripts: {
29
- tsup: "tsup --tsconfig tsconfig.build.json",
29
+ tsup: "tsup --tsconfig tsconfig.build.json && node build-preview-server.js",
30
30
  build: "next build",
31
31
  dev: "next dev",
32
32
  lint: "next lint",
@@ -54,8 +54,8 @@ var package_default = {
54
54
  "js-beautify": "^1.15.1",
55
55
  "js-dependency-extractor": "^1.0.3",
56
56
  "lucide-react": "^0.445.0",
57
- next: "^14.2.14",
58
- nuqs: "^1.19.3",
57
+ next: "^14.2.15",
58
+ nuqs: "^1.20.0",
59
59
  ora: "^8.1.0",
60
60
  pino: "^9.4.0",
61
61
  "pino-pretty": "^11.2.2",
@@ -112,6 +112,7 @@ import { parse } from "node:url";
112
112
  import path2 from "path";
113
113
  import express from "express";
114
114
  import next from "next";
115
+ import { fileURLToPath } from "url";
115
116
  import WebSocket from "ws";
116
117
  import { WebSocketServer } from "ws";
117
118
 
@@ -248,6 +249,11 @@ function pdfTemplateWatcher() {
248
249
  }
249
250
 
250
251
  // src/cli/commands/server.ts
252
+ var __filename = fileURLToPath(import.meta.url);
253
+ var __dirname = path2.dirname(__filename);
254
+ var isDev = !__filename.endsWith("index.js");
255
+ var cliPackageLocation = isDev ? path2.resolve(__dirname, "../..") : path2.resolve(__dirname, "../..");
256
+ var previewServerLocation = isDev ? path2.resolve(__dirname, "../..") : path2.resolve(__dirname, "./preview");
251
257
  var getEnvVariablesForPreviewApp = (relativePathToPdfsDirectory, cwd) => {
252
258
  return {
253
259
  RELATIVE_PATH_TO_PDF_FOLDER: relativePathToPdfsDirectory,
@@ -273,14 +279,16 @@ var startPreviewServer = async (pdfsDirRelativePath, port) => {
273
279
  )
274
280
  };
275
281
  const nextApp = next({
276
- dev: true,
277
- //process.env.NODE_ENV !== "production",
282
+ dev: isDev,
278
283
  conf: {
279
284
  images: {
280
285
  // This is to avoid the warning with sharp
281
286
  unoptimized: true
282
287
  }
283
- }
288
+ },
289
+ hostname: "localhost",
290
+ port,
291
+ dir: previewServerLocation
284
292
  });
285
293
  nextApp.prepare().then(() => {
286
294
  previewServer.use((req, res, next2) => {
@@ -349,4 +357,8 @@ var dev = async ({
349
357
  var PACKAGE_NAME = "repdf";
350
358
  program.name(PACKAGE_NAME).description("A live preview of your pdf templates").version(package_default.version);
351
359
  program.command("dev").description("Starts the preview pdf development app").option("-d --dir <path>", "Directory containing pdf templates", "./src/pdfs").option("-p --port <port>", "Port to run dev server on", "3000").action(dev);
360
+ if (!process.argv.slice(2).length) {
361
+ program.outputHelp();
362
+ process.exit(0);
363
+ }
352
364
  program.parse();
@@ -0,0 +1 @@
1
+ 1Jhp0TAJqxKhIl75SUMGt
@@ -0,0 +1,41 @@
1
+ {
2
+ "polyfillFiles": [
3
+ "static/chunks/polyfills-42372ed130431b0a.js"
4
+ ],
5
+ "devFiles": [],
6
+ "ampDevFiles": [],
7
+ "lowPriorityFiles": [
8
+ "static/1Jhp0TAJqxKhIl75SUMGt/_buildManifest.js",
9
+ "static/1Jhp0TAJqxKhIl75SUMGt/_ssgManifest.js"
10
+ ],
11
+ "rootMainFiles": [],
12
+ "pages": {
13
+ "/": [
14
+ "static/chunks/webpack-b8f8d6679aaa5f42.js",
15
+ "static/chunks/framework-0cbe3b56a5f66701.js",
16
+ "static/chunks/main-b2d89a266d271543.js",
17
+ "static/chunks/pages/index-74f4892551876c76.js"
18
+ ],
19
+ "/_app": [
20
+ "static/chunks/webpack-b8f8d6679aaa5f42.js",
21
+ "static/chunks/framework-0cbe3b56a5f66701.js",
22
+ "static/chunks/main-b2d89a266d271543.js",
23
+ "static/css/f94a2eea64dc55ea.css",
24
+ "static/chunks/pages/_app-d770e97b1da9a6b5.js"
25
+ ],
26
+ "/_error": [
27
+ "static/chunks/webpack-b8f8d6679aaa5f42.js",
28
+ "static/chunks/framework-0cbe3b56a5f66701.js",
29
+ "static/chunks/main-b2d89a266d271543.js",
30
+ "static/chunks/pages/_error-f68c2d645fc907f4.js"
31
+ ],
32
+ "/preview/[...relTemplatePath]": [
33
+ "static/chunks/webpack-b8f8d6679aaa5f42.js",
34
+ "static/chunks/framework-0cbe3b56a5f66701.js",
35
+ "static/chunks/main-b2d89a266d271543.js",
36
+ "static/chunks/160-515f2678c7e1d9ce.js",
37
+ "static/chunks/pages/preview/[...relTemplatePath]-04ae2b195e233717.js"
38
+ ]
39
+ },
40
+ "ampFirstPages": []
41
+ }