@repdf/preview 0.0.25 → 0.1.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/index.js +42 -221
- package/dist/preview/.next/BUILD_ID +1 -1
- package/dist/preview/.next/build-manifest.json +20 -20
- package/dist/preview/.next/cache/.tsbuildinfo +1 -1
- package/dist/preview/.next/cache/webpack/client-production/0.pack +0 -0
- package/dist/preview/.next/cache/webpack/client-production/index.pack +0 -0
- package/dist/preview/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/dist/preview/.next/cache/webpack/server-production/0.pack +0 -0
- package/dist/preview/.next/cache/webpack/server-production/index.pack +0 -0
- package/dist/preview/.next/next-minimal-server.js.nft.json +1 -1
- package/dist/preview/.next/next-server.js.nft.json +1 -1
- package/dist/preview/.next/prerender-manifest.json +1 -1
- package/dist/preview/.next/react-loadable-manifest.json +2 -2
- package/dist/preview/.next/required-server-files.json +1 -1
- package/dist/preview/.next/routes-manifest.json +1 -1
- package/dist/preview/.next/server/chunks/204.js +1 -0
- package/dist/preview/.next/server/chunks/239.js +6 -0
- package/dist/preview/.next/server/chunks/370.js +1 -1
- package/dist/preview/.next/server/chunks/476.js +1 -1
- package/dist/preview/.next/server/chunks/81.js +1 -1
- package/dist/preview/.next/server/chunks/865.js +1 -0
- package/dist/preview/.next/server/chunks/975.js +4 -0
- package/dist/preview/.next/server/functions-config-manifest.json +1 -1
- package/dist/preview/.next/server/middleware-build-manifest.js +1 -1
- package/dist/preview/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/preview/.next/server/pages/_app.js +1 -1
- package/dist/preview/.next/server/pages/_app.js.nft.json +1 -1
- package/dist/preview/.next/server/pages/_document.js +1 -1
- package/dist/preview/.next/server/pages/_document.js.nft.json +1 -1
- package/dist/preview/.next/server/pages/_error.js +1 -1
- package/dist/preview/.next/server/pages/_error.js.nft.json +1 -1
- package/dist/preview/.next/server/pages/api/component.js +2 -2
- package/dist/preview/.next/server/pages/api/component.js.nft.json +1 -1
- package/dist/preview/.next/server/pages/api/pdf.js +1 -1
- package/dist/preview/.next/server/pages/api/pdf.js.nft.json +1 -1
- package/dist/preview/.next/server/pages/api/trpc/[trpc].js +82 -2
- package/dist/preview/.next/server/pages/api/trpc/[trpc].js.nft.json +1 -1
- package/dist/preview/.next/server/pages/en/404.html +1 -1
- package/dist/preview/.next/server/pages/en/500.html +1 -1
- package/dist/preview/.next/server/pages/en/test.html +1 -1
- package/dist/preview/.next/server/pages/index.js +2 -2
- package/dist/preview/.next/server/pages/index.js.nft.json +1 -1
- package/dist/preview/.next/server/pages/preview/[...relTemplatePath].js +1 -1
- package/dist/preview/.next/server/pages/preview/[...relTemplatePath].js.nft.json +1 -1
- package/dist/preview/.next/server/pages/test.js.nft.json +1 -1
- package/dist/preview/.next/server/pages-manifest.json +1 -1
- package/dist/preview/.next/server/webpack-api-runtime.js +1 -1
- package/dist/preview/.next/static/3KzSbw8453o_mkesYso5R/_buildManifest.js +1 -0
- package/dist/preview/.next/static/chunks/64-33135d2a0b032c99.js +1 -0
- package/dist/preview/.next/static/chunks/main-32f0addb06a02100.js +1 -0
- package/dist/preview/.next/static/chunks/pages/_app-7207fb686c7ea292.js +184 -0
- package/dist/preview/.next/static/chunks/pages/_error-0577f827b4afb66a.js +1 -0
- package/dist/preview/.next/static/chunks/pages/{index-7e306d1513d09a1a.js → index-59cca326edb25e5b.js} +1 -1
- package/dist/preview/.next/static/chunks/pages/preview/[...relTemplatePath]-3e7bbb1e7746e61f.js +1 -0
- package/dist/preview/.next/static/chunks/pages/{test-6c9d6a5f356c21ea.js → test-1b0ec700afcdd64b.js} +1 -1
- package/dist/preview/.next/static/chunks/webpack-8fa1640cc84ba8fe.js +1 -0
- package/dist/preview/.next/static/css/3beae5d5e23b91e8.css +3 -0
- package/dist/preview/.next/trace +20 -16
- package/package.json +17 -19
- package/dist/preview/.next/cache/webpack/client-development/0.pack.gz +0 -0
- package/dist/preview/.next/cache/webpack/client-development/index.pack.gz +0 -0
- package/dist/preview/.next/server/chunks/515.js +0 -1
- package/dist/preview/.next/server/chunks/76.js +0 -6
- package/dist/preview/.next/server/chunks/787.js +0 -4
- package/dist/preview/.next/server/chunks/992.js +0 -1
- package/dist/preview/.next/static/chunks/138-c24eca17d1ad2527.js +0 -1
- package/dist/preview/.next/static/chunks/main-58cc12cfc6868a7a.js +0 -1
- package/dist/preview/.next/static/chunks/pages/_app-0f9241fc03d167e5.js +0 -8
- package/dist/preview/.next/static/chunks/pages/_error-4ad10ca9d415501b.js +0 -1
- package/dist/preview/.next/static/chunks/pages/preview/[...relTemplatePath]-54953a42a234e88f.js +0 -1
- package/dist/preview/.next/static/chunks/webpack-b8f8d6679aaa5f42.js +0 -1
- package/dist/preview/.next/static/css/e697c978240c2fce.css +0 -3
- package/dist/preview/.next/static/r14XpRGeqXRkqt8lq1z_x/_buildManifest.js +0 -1
- /package/dist/preview/.next/static/{r14XpRGeqXRkqt8lq1z_x → 3KzSbw8453o_mkesYso5R}/_ssgManifest.js +0 -0
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
|
|
9
|
+
version: "0.1.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -27,36 +27,37 @@ var package_default = {
|
|
|
27
27
|
scripts: {
|
|
28
28
|
tsup: "tsup --tsconfig tsconfig.build.json && node build-preview-server.js",
|
|
29
29
|
build: "next build",
|
|
30
|
-
dev: "next dev",
|
|
31
|
-
"dev:live": "tsx
|
|
30
|
+
dev: "next dev -p 3000",
|
|
31
|
+
"dev:live": "tsx src/cli/index.ts dev",
|
|
32
32
|
"dev:live:notused": "tsup --tsconfig tsconfig.build.json --watch",
|
|
33
33
|
lint: "next lint",
|
|
34
34
|
start: "next start",
|
|
35
35
|
"check-exports": "attw --pack .",
|
|
36
36
|
format: "biome check --write .",
|
|
37
|
-
|
|
37
|
+
"local-release": "bun publish --access public",
|
|
38
|
+
clean: "rm -rf dist",
|
|
39
|
+
typecheck: "tsc --noEmit"
|
|
38
40
|
},
|
|
39
41
|
dependencies: {
|
|
40
42
|
"@repdf/core": "workspace:*",
|
|
41
43
|
"@react-email/render": "1.0.2",
|
|
42
44
|
"@react-email/tailwind": "1.0.2",
|
|
43
|
-
"@tanstack/react-query": "^5.59.
|
|
44
|
-
"@tanstack/react-query-devtools": "^5.59.
|
|
45
|
-
"@trpc/client": "
|
|
46
|
-
"@trpc/next": "
|
|
47
|
-
"@trpc/react-query": "
|
|
48
|
-
"@trpc/server": "
|
|
45
|
+
"@tanstack/react-query": "^5.59.20",
|
|
46
|
+
"@tanstack/react-query-devtools": "^5.59.20",
|
|
47
|
+
"@trpc/client": "11.0.0-rc.630",
|
|
48
|
+
"@trpc/next": "11.0.0-rc.630",
|
|
49
|
+
"@trpc/react-query": "11.0.0-rc.630",
|
|
50
|
+
"@trpc/server": "11.0.0-rc.630",
|
|
49
51
|
chokidar: "4.0.1",
|
|
50
52
|
clsx: "^2.1.1",
|
|
51
53
|
commander: "^12.1.0",
|
|
52
54
|
"dependency-tree": "^11.0.1",
|
|
53
55
|
esbuild: "0.24.0",
|
|
54
|
-
express: "^4.21.1",
|
|
55
56
|
glob: "^11.0.0",
|
|
56
57
|
"js-beautify": "^1.15.1",
|
|
57
58
|
"js-dependency-extractor": "^1.0.3",
|
|
58
59
|
"lucide-react": "^0.453.0",
|
|
59
|
-
next: "^14.2.
|
|
60
|
+
next: "^14.2.17",
|
|
60
61
|
ora: "^8.1.0",
|
|
61
62
|
pino: "^9.4.0",
|
|
62
63
|
"pino-pretty": "^11.2.2",
|
|
@@ -64,13 +65,12 @@ var package_default = {
|
|
|
64
65
|
puppeteer: "^23.4.1",
|
|
65
66
|
react: "^18.3.1",
|
|
66
67
|
"react-dom": "^18.3.1",
|
|
67
|
-
"react-
|
|
68
|
+
"react-hot-toast": "^2.4.1",
|
|
68
69
|
"source-map-js": "^1.2.1",
|
|
69
70
|
"stacktrace-parser": "^0.1.10",
|
|
70
71
|
superjson: "^2.2.1",
|
|
71
72
|
"tailwind-merge": "^2.5.4",
|
|
72
73
|
webpack: "^5.95.0",
|
|
73
|
-
ws: "^8.18.0",
|
|
74
74
|
zod: "^3.23.8"
|
|
75
75
|
},
|
|
76
76
|
devDependencies: {
|
|
@@ -79,22 +79,20 @@ var package_default = {
|
|
|
79
79
|
"@changesets/cli": "2.27.9",
|
|
80
80
|
"@arethetypeswrong/cli": "0.16.4",
|
|
81
81
|
"@biomejs/biome": "1.9.3",
|
|
82
|
-
"@types/express": "^5.0.0",
|
|
83
82
|
"@types/js-beautify": "^1.14.3",
|
|
84
83
|
"@types/node": "^20.14.10",
|
|
85
84
|
"@types/react": "^18.3.12",
|
|
86
85
|
"@types/react-dom": "^18.3.1",
|
|
87
|
-
"@types/ws": "^8.5.12",
|
|
88
86
|
postcss: "^8.4.39",
|
|
89
87
|
"react-email": "3.0.1",
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
typescript: "^5.6.3",
|
|
89
|
+
tailwindcss: "^3.4.14"
|
|
92
90
|
},
|
|
93
91
|
packageManager: "pnpm@9.7.1"
|
|
94
92
|
};
|
|
95
93
|
|
|
96
94
|
// src/cli/commands/dev.ts
|
|
97
|
-
import
|
|
95
|
+
import fs from "node:fs";
|
|
98
96
|
|
|
99
97
|
// src/logger.ts
|
|
100
98
|
import pino from "pino";
|
|
@@ -108,152 +106,9 @@ var logger_default = logger;
|
|
|
108
106
|
|
|
109
107
|
// src/cli/commands/server.ts
|
|
110
108
|
import { parse } from "node:url";
|
|
111
|
-
import
|
|
109
|
+
import path from "path";
|
|
112
110
|
import { fileURLToPath } from "url";
|
|
113
|
-
import express from "express";
|
|
114
111
|
import next from "next";
|
|
115
|
-
import WebSocket from "ws";
|
|
116
|
-
import { WebSocketServer } from "ws";
|
|
117
|
-
|
|
118
|
-
// src/utils/files/pdfTemplateWatcher.ts
|
|
119
|
-
import * as chokidar from "chokidar";
|
|
120
|
-
|
|
121
|
-
// src/constants.ts
|
|
122
|
-
var RELATIVE_PATH_TO_PDF_FOLDER = () => {
|
|
123
|
-
if (!process.env.RELATIVE_PATH_TO_PDF_FOLDER) {
|
|
124
|
-
throw new Error("RELATIVE_PATH_TO_PDF_FOLDER is not set");
|
|
125
|
-
}
|
|
126
|
-
return process.env.RELATIVE_PATH_TO_PDF_FOLDER;
|
|
127
|
-
};
|
|
128
|
-
var ABSOLUTE_PATH_TO_PDF_FOLDER = () => {
|
|
129
|
-
if (!process.env.ABSOLUTE_PATH_TO_PDF_FOLDER) {
|
|
130
|
-
throw new Error("ABSOLUTE_PATH_TO_PDF_FOLDER is not set");
|
|
131
|
-
}
|
|
132
|
-
return process.env.ABSOLUTE_PATH_TO_PDF_FOLDER;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
// src/utils/files/dependencyTree.ts
|
|
136
|
-
import dependencyTree from "dependency-tree";
|
|
137
|
-
function getDependencyTree({
|
|
138
|
-
relViewerPath,
|
|
139
|
-
outputType
|
|
140
|
-
}) {
|
|
141
|
-
const options = {
|
|
142
|
-
filename: relViewerPath,
|
|
143
|
-
//TODO does this work with absolute paths?
|
|
144
|
-
directory: ".",
|
|
145
|
-
// requireConfig: 'path/to/requirejs/config', // optional
|
|
146
|
-
// webpackConfig: 'path/to/webpack/config', // optional
|
|
147
|
-
tsConfig: "tsconfig.json",
|
|
148
|
-
// optional
|
|
149
|
-
// nodeModulesConfig: {
|
|
150
|
-
// entry: 'module'
|
|
151
|
-
// }, // optional
|
|
152
|
-
filter: (path3) => path3.indexOf("node_modules") === -1,
|
|
153
|
-
// remove node_node modules from tree
|
|
154
|
-
// nonExistent: [], // optional
|
|
155
|
-
noTypeDefinitions: false
|
|
156
|
-
// optional
|
|
157
|
-
};
|
|
158
|
-
if (outputType === "list") {
|
|
159
|
-
return dependencyTree.toList(options);
|
|
160
|
-
}
|
|
161
|
-
return dependencyTree(options);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// src/utils/files/getPdfTemplates.ts
|
|
165
|
-
import fs from "node:fs";
|
|
166
|
-
import path from "node:path";
|
|
167
|
-
import { glob } from "glob";
|
|
168
|
-
function isPotentialPdfTemplate(relViewerPath) {
|
|
169
|
-
const stat = fs.statSync(relViewerPath);
|
|
170
|
-
if (stat.isDirectory()) return false;
|
|
171
|
-
const fileName = path.basename(relViewerPath);
|
|
172
|
-
if (fileName.startsWith("_")) {
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
const extension = path.extname(relViewerPath);
|
|
176
|
-
if (![".tsx", ".ts", ".jsx", ".js"].includes(extension)) {
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
const absoluteFilePath = path.resolve(relViewerPath);
|
|
180
|
-
if (!fs.existsSync(absoluteFilePath)) {
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
const fileContents = fs.readFileSync(absoluteFilePath, "utf8");
|
|
184
|
-
const hasDefaultExport = fileContents.includes("export default");
|
|
185
|
-
return hasDefaultExport;
|
|
186
|
-
}
|
|
187
|
-
function getPdfTemplates() {
|
|
188
|
-
const potentialTemplateFilePaths = glob.sync(
|
|
189
|
-
`${RELATIVE_PATH_TO_PDF_FOLDER()}/**/*.{tsx,jsx,js}`,
|
|
190
|
-
{ nodir: true }
|
|
191
|
-
);
|
|
192
|
-
const filteredTemplateFilePaths = potentialTemplateFilePaths.filter(
|
|
193
|
-
isPotentialPdfTemplate
|
|
194
|
-
);
|
|
195
|
-
return filteredTemplateFilePaths.map((file) => {
|
|
196
|
-
const relTemplatePath = file.replace(
|
|
197
|
-
`${RELATIVE_PATH_TO_PDF_FOLDER()}/`,
|
|
198
|
-
""
|
|
199
|
-
);
|
|
200
|
-
const pathParts = relTemplatePath.split("/");
|
|
201
|
-
let topParentFolder = null;
|
|
202
|
-
if (pathParts.length > 1 && pathParts[0]) {
|
|
203
|
-
topParentFolder = pathParts[0];
|
|
204
|
-
}
|
|
205
|
-
return {
|
|
206
|
-
fileName: path.basename(file),
|
|
207
|
-
// just the file name
|
|
208
|
-
relTemplatePath,
|
|
209
|
-
relViewerPath: file,
|
|
210
|
-
// to where script is being run
|
|
211
|
-
absolutePath: path.resolve(file),
|
|
212
|
-
// file system
|
|
213
|
-
topParentFolder
|
|
214
|
-
};
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// src/utils/files/pdfTemplateWatcher.ts
|
|
219
|
-
function pdfTemplateWatcher() {
|
|
220
|
-
console.log("running template watcher");
|
|
221
|
-
const pdfTemplates = getPdfTemplates();
|
|
222
|
-
try {
|
|
223
|
-
const allFiles = /* @__PURE__ */ new Set();
|
|
224
|
-
for (const pdfTemplate of pdfTemplates) {
|
|
225
|
-
allFiles.add(pdfTemplate.absolutePath);
|
|
226
|
-
const dependencyTree2 = getDependencyTree({
|
|
227
|
-
relViewerPath: pdfTemplate.relViewerPath,
|
|
228
|
-
outputType: "list"
|
|
229
|
-
});
|
|
230
|
-
for (const absoluteFilePath of dependencyTree2) {
|
|
231
|
-
allFiles.add(absoluteFilePath);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
const watcher2 = chokidar.watch(ABSOLUTE_PATH_TO_PDF_FOLDER(), {
|
|
235
|
-
persistent: true,
|
|
236
|
-
ignoreInitial: true,
|
|
237
|
-
ignored: /(^|[\/\\])\../
|
|
238
|
-
// Ignore dot files
|
|
239
|
-
});
|
|
240
|
-
watcher2.add(Array.from(allFiles));
|
|
241
|
-
console.log("added files to watcher", Array.from(allFiles));
|
|
242
|
-
watcher2.on("add", (filePath) => {
|
|
243
|
-
console.log(`File ${filePath} has been added`);
|
|
244
|
-
}).on("change", (filePath) => {
|
|
245
|
-
console.log(`File ${filePath} has been changed`);
|
|
246
|
-
}).on("unlink", (filePath) => {
|
|
247
|
-
console.log(`File ${filePath} has been removed`);
|
|
248
|
-
}).on("error", (error) => {
|
|
249
|
-
console.error(`Watcher error: ${error}`);
|
|
250
|
-
});
|
|
251
|
-
return watcher2;
|
|
252
|
-
} catch (error) {
|
|
253
|
-
console.error("issue", error);
|
|
254
|
-
throw error;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
112
|
|
|
258
113
|
// src/utils/checkPortAvailability.ts
|
|
259
114
|
import http from "http";
|
|
@@ -276,40 +131,36 @@ function checkPortAvailability(port) {
|
|
|
276
131
|
}
|
|
277
132
|
|
|
278
133
|
// src/cli/commands/server.ts
|
|
134
|
+
import http2 from "node:http";
|
|
279
135
|
var __filename = fileURLToPath(import.meta.url);
|
|
280
|
-
var __dirname =
|
|
136
|
+
var __dirname = path.dirname(__filename);
|
|
281
137
|
var isDev = !__filename.endsWith("index.js");
|
|
282
138
|
console.log("cli script is in dev mode", isDev);
|
|
283
|
-
var cliPackageLocation = isDev ?
|
|
284
|
-
var previewServerLocation = isDev ?
|
|
139
|
+
var cliPackageLocation = isDev ? path.resolve(__dirname, "../..") : path.resolve(__dirname, "../..");
|
|
140
|
+
var previewServerLocation = isDev ? path.resolve(__dirname, "../../..") : path.resolve(__dirname, "./preview");
|
|
285
141
|
var getEnvVariablesForPreviewApp = (relativePathToPdfsDirectory, cwd) => {
|
|
286
142
|
return {
|
|
287
143
|
RELATIVE_PATH_TO_PDF_FOLDER: relativePathToPdfsDirectory,
|
|
288
|
-
ABSOLUTE_PATH_TO_PDF_FOLDER:
|
|
144
|
+
ABSOLUTE_PATH_TO_PDF_FOLDER: path.resolve(cwd, relativePathToPdfsDirectory),
|
|
289
145
|
USER_PROJECT_LOCATION: cwd
|
|
290
146
|
// TODO what is this used for if anything
|
|
291
147
|
};
|
|
292
148
|
};
|
|
293
149
|
var previewServer;
|
|
294
|
-
var clients = /* @__PURE__ */ new Set();
|
|
295
|
-
var watcher;
|
|
296
150
|
var startPreviewServer = async (pdfsDirRelativePath, port) => {
|
|
297
151
|
let actualPort = port;
|
|
298
152
|
while (!await checkPortAvailability(actualPort)) {
|
|
299
153
|
console.log("port is in use, trying next port");
|
|
300
154
|
actualPort++;
|
|
301
155
|
}
|
|
302
|
-
previewServer = express();
|
|
303
|
-
const server = previewServer.listen(actualPort);
|
|
304
|
-
const wss = new WebSocketServer({ noServer: true });
|
|
305
156
|
process.env = {
|
|
306
157
|
...process.env,
|
|
307
|
-
NODE_ENV:
|
|
308
|
-
// TODO: why is this set to
|
|
158
|
+
NODE_ENV: "development",
|
|
159
|
+
//isDev ? "development" : "production", // TODO: why is this set to development and is that right?
|
|
309
160
|
PORT: actualPort.toString(),
|
|
310
161
|
...getEnvVariablesForPreviewApp(
|
|
311
162
|
// If we don't do normalization here, stuff like https://github.com/resend/react-email/issues/1354 happens.
|
|
312
|
-
|
|
163
|
+
path.normalize(pdfsDirRelativePath),
|
|
313
164
|
process.cwd()
|
|
314
165
|
)
|
|
315
166
|
};
|
|
@@ -326,51 +177,21 @@ var startPreviewServer = async (pdfsDirRelativePath, port) => {
|
|
|
326
177
|
dir: previewServerLocation
|
|
327
178
|
});
|
|
328
179
|
logger_default.info("preparing next app");
|
|
329
|
-
nextApp.prepare()
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
});
|
|
345
|
-
wss.on("connection", (ws) => {
|
|
346
|
-
clients.add(ws);
|
|
347
|
-
logger_default.info("New client connected");
|
|
348
|
-
ws.on("message", (message, isBinary) => {
|
|
349
|
-
logger_default.info(`Message received: ${message}`);
|
|
350
|
-
for (const client of Array.from(clients)) {
|
|
351
|
-
if (client.readyState === WebSocket.OPEN && message.toString() !== `{"event":"ping"}`) {
|
|
352
|
-
client.send(message, { binary: isBinary });
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
ws.on("close", () => {
|
|
357
|
-
clients.delete(ws);
|
|
358
|
-
logger_default.info("Client disconnected");
|
|
359
|
-
});
|
|
360
|
-
});
|
|
361
|
-
server.on("upgrade", (req, socket, head) => {
|
|
362
|
-
logger_default.info("upgrading to websockets", req.url);
|
|
363
|
-
const { pathname } = parse(req.url || "/", true);
|
|
364
|
-
if (pathname === "/_next/webpack-hmr") {
|
|
365
|
-
logger_default.info("inside nextjs hot module reloading path");
|
|
366
|
-
nextApp.getUpgradeHandler()(req, socket, head);
|
|
367
|
-
}
|
|
368
|
-
if (pathname === "/api/ws") {
|
|
369
|
-
wss.handleUpgrade(req, socket, head, (ws) => {
|
|
370
|
-
wss.emit("connection", ws, req);
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
});
|
|
180
|
+
await nextApp.prepare();
|
|
181
|
+
previewServer = http2.createServer((req, res) => {
|
|
182
|
+
nextApp.getRequestHandler()(req, res, parse(req.url || "/", true));
|
|
183
|
+
});
|
|
184
|
+
const server = previewServer.listen(actualPort);
|
|
185
|
+
const url = `http://localhost:${actualPort}`;
|
|
186
|
+
const clickableUrl = `\x1B]8;;${url}\x07${url}\x1B]8;;\x07`;
|
|
187
|
+
console.log(clickableUrl);
|
|
188
|
+
server.on("upgrade", (req, socket, head) => {
|
|
189
|
+
logger_default.info("upgrading to websockets", req.url);
|
|
190
|
+
const { pathname } = parse(req.url || "/", true);
|
|
191
|
+
if (pathname === "/_next/webpack-hmr") {
|
|
192
|
+
logger_default.info("inside nextjs hot module reloading path");
|
|
193
|
+
nextApp.getUpgradeHandler()(req, socket, head);
|
|
194
|
+
}
|
|
374
195
|
});
|
|
375
196
|
return server;
|
|
376
197
|
};
|
|
@@ -381,7 +202,7 @@ var dev = async ({
|
|
|
381
202
|
port
|
|
382
203
|
}) => {
|
|
383
204
|
try {
|
|
384
|
-
if (!
|
|
205
|
+
if (!fs.existsSync(relativePathToPdfFolder)) {
|
|
385
206
|
throw new Error(`Missing ${relativePathToPdfFolder} folder`);
|
|
386
207
|
}
|
|
387
208
|
const devServer = await startPreviewServer(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3KzSbw8453o_mkesYso5R
|
|
@@ -5,43 +5,43 @@
|
|
|
5
5
|
"devFiles": [],
|
|
6
6
|
"ampDevFiles": [],
|
|
7
7
|
"lowPriorityFiles": [
|
|
8
|
-
"static/
|
|
9
|
-
"static/
|
|
8
|
+
"static/3KzSbw8453o_mkesYso5R/_buildManifest.js",
|
|
9
|
+
"static/3KzSbw8453o_mkesYso5R/_ssgManifest.js"
|
|
10
10
|
],
|
|
11
11
|
"rootMainFiles": [],
|
|
12
12
|
"pages": {
|
|
13
13
|
"/": [
|
|
14
|
-
"static/chunks/webpack-
|
|
14
|
+
"static/chunks/webpack-8fa1640cc84ba8fe.js",
|
|
15
15
|
"static/chunks/framework-e0f347a11a70369e.js",
|
|
16
|
-
"static/chunks/main-
|
|
17
|
-
"static/chunks/
|
|
18
|
-
"static/chunks/pages/index-
|
|
16
|
+
"static/chunks/main-32f0addb06a02100.js",
|
|
17
|
+
"static/chunks/64-33135d2a0b032c99.js",
|
|
18
|
+
"static/chunks/pages/index-59cca326edb25e5b.js"
|
|
19
19
|
],
|
|
20
20
|
"/_app": [
|
|
21
|
-
"static/chunks/webpack-
|
|
21
|
+
"static/chunks/webpack-8fa1640cc84ba8fe.js",
|
|
22
22
|
"static/chunks/framework-e0f347a11a70369e.js",
|
|
23
|
-
"static/chunks/main-
|
|
24
|
-
"static/css/
|
|
25
|
-
"static/chunks/pages/_app-
|
|
23
|
+
"static/chunks/main-32f0addb06a02100.js",
|
|
24
|
+
"static/css/3beae5d5e23b91e8.css",
|
|
25
|
+
"static/chunks/pages/_app-7207fb686c7ea292.js"
|
|
26
26
|
],
|
|
27
27
|
"/_error": [
|
|
28
|
-
"static/chunks/webpack-
|
|
28
|
+
"static/chunks/webpack-8fa1640cc84ba8fe.js",
|
|
29
29
|
"static/chunks/framework-e0f347a11a70369e.js",
|
|
30
|
-
"static/chunks/main-
|
|
31
|
-
"static/chunks/pages/_error-
|
|
30
|
+
"static/chunks/main-32f0addb06a02100.js",
|
|
31
|
+
"static/chunks/pages/_error-0577f827b4afb66a.js"
|
|
32
32
|
],
|
|
33
33
|
"/preview/[...relTemplatePath]": [
|
|
34
|
-
"static/chunks/webpack-
|
|
34
|
+
"static/chunks/webpack-8fa1640cc84ba8fe.js",
|
|
35
35
|
"static/chunks/framework-e0f347a11a70369e.js",
|
|
36
|
-
"static/chunks/main-
|
|
37
|
-
"static/chunks/
|
|
38
|
-
"static/chunks/pages/preview/[...relTemplatePath]-
|
|
36
|
+
"static/chunks/main-32f0addb06a02100.js",
|
|
37
|
+
"static/chunks/64-33135d2a0b032c99.js",
|
|
38
|
+
"static/chunks/pages/preview/[...relTemplatePath]-3e7bbb1e7746e61f.js"
|
|
39
39
|
],
|
|
40
40
|
"/test": [
|
|
41
|
-
"static/chunks/webpack-
|
|
41
|
+
"static/chunks/webpack-8fa1640cc84ba8fe.js",
|
|
42
42
|
"static/chunks/framework-e0f347a11a70369e.js",
|
|
43
|
-
"static/chunks/main-
|
|
44
|
-
"static/chunks/pages/test-
|
|
43
|
+
"static/chunks/main-32f0addb06a02100.js",
|
|
44
|
+
"static/chunks/pages/test-1b0ec700afcdd64b.js"
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
47
|
"ampFirstPages": []
|