@astroscope/boot 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.
- package/dist/index.cjs +12 -4
- package/dist/index.js +12 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -118,6 +118,14 @@ async function runShutdown(boot2, context) {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
// src/utils.ts
|
|
122
|
+
function serializeError(error) {
|
|
123
|
+
if (error instanceof Error) {
|
|
124
|
+
return error.stack ?? error.message;
|
|
125
|
+
}
|
|
126
|
+
return JSON.stringify(error);
|
|
127
|
+
}
|
|
128
|
+
|
|
121
129
|
// src/hmr.ts
|
|
122
130
|
function setupBootHmr(server, entry, logger, getBootContext) {
|
|
123
131
|
const bootModuleId = `/${entry}`;
|
|
@@ -152,14 +160,14 @@ function setupBootHmr(server, entry, logger, getBootContext) {
|
|
|
152
160
|
const oldModule = await server.ssrLoadModule(bootModuleId);
|
|
153
161
|
await runShutdown(oldModule, bootContext);
|
|
154
162
|
} catch (error) {
|
|
155
|
-
logger.error(`Error during boot HMR shutdown: ${error}`);
|
|
163
|
+
logger.error(`Error during boot HMR shutdown: ${serializeError(error)}`);
|
|
156
164
|
}
|
|
157
165
|
server.moduleGraph.invalidateAll();
|
|
158
166
|
try {
|
|
159
167
|
const newModule = await server.ssrLoadModule(bootModuleId);
|
|
160
168
|
await runStartup(newModule, bootContext);
|
|
161
169
|
} catch (error) {
|
|
162
|
-
logger.error(`Error during boot HMR startup: ${error}`);
|
|
170
|
+
logger.error(`Error during boot HMR startup: ${serializeError(error)}`);
|
|
163
171
|
}
|
|
164
172
|
}
|
|
165
173
|
});
|
|
@@ -244,7 +252,7 @@ function boot(options = {}) {
|
|
|
244
252
|
const module2 = await server.ssrLoadModule(`/${entry}`);
|
|
245
253
|
await runStartup(module2, bootContext);
|
|
246
254
|
} catch (error) {
|
|
247
|
-
logger.error(`Error running startup script: ${error}`);
|
|
255
|
+
logger.error(`Error running startup script: ${serializeError(error)}`);
|
|
248
256
|
}
|
|
249
257
|
server.httpServer?.once("close", async () => {
|
|
250
258
|
try {
|
|
@@ -252,7 +260,7 @@ function boot(options = {}) {
|
|
|
252
260
|
const module2 = await server.ssrLoadModule(`/${entry}`);
|
|
253
261
|
await runShutdown(module2, bootContext);
|
|
254
262
|
} catch (error) {
|
|
255
|
-
logger.error(`Error running shutdown script: ${error}`);
|
|
263
|
+
logger.error(`Error running shutdown script: ${serializeError(error)}`);
|
|
256
264
|
}
|
|
257
265
|
});
|
|
258
266
|
if (hmr) {
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,14 @@ var ignoredSuffixes = [
|
|
|
54
54
|
".less"
|
|
55
55
|
];
|
|
56
56
|
|
|
57
|
+
// src/utils.ts
|
|
58
|
+
function serializeError(error) {
|
|
59
|
+
if (error instanceof Error) {
|
|
60
|
+
return error.stack ?? error.message;
|
|
61
|
+
}
|
|
62
|
+
return JSON.stringify(error);
|
|
63
|
+
}
|
|
64
|
+
|
|
57
65
|
// src/hmr.ts
|
|
58
66
|
function setupBootHmr(server, entry, logger, getBootContext) {
|
|
59
67
|
const bootModuleId = `/${entry}`;
|
|
@@ -88,14 +96,14 @@ function setupBootHmr(server, entry, logger, getBootContext) {
|
|
|
88
96
|
const oldModule = await server.ssrLoadModule(bootModuleId);
|
|
89
97
|
await runShutdown(oldModule, bootContext);
|
|
90
98
|
} catch (error) {
|
|
91
|
-
logger.error(`Error during boot HMR shutdown: ${error}`);
|
|
99
|
+
logger.error(`Error during boot HMR shutdown: ${serializeError(error)}`);
|
|
92
100
|
}
|
|
93
101
|
server.moduleGraph.invalidateAll();
|
|
94
102
|
try {
|
|
95
103
|
const newModule = await server.ssrLoadModule(bootModuleId);
|
|
96
104
|
await runStartup(newModule, bootContext);
|
|
97
105
|
} catch (error) {
|
|
98
|
-
logger.error(`Error during boot HMR startup: ${error}`);
|
|
106
|
+
logger.error(`Error during boot HMR startup: ${serializeError(error)}`);
|
|
99
107
|
}
|
|
100
108
|
}
|
|
101
109
|
});
|
|
@@ -180,7 +188,7 @@ function boot(options = {}) {
|
|
|
180
188
|
const module = await server.ssrLoadModule(`/${entry}`);
|
|
181
189
|
await runStartup(module, bootContext);
|
|
182
190
|
} catch (error) {
|
|
183
|
-
logger.error(`Error running startup script: ${error}`);
|
|
191
|
+
logger.error(`Error running startup script: ${serializeError(error)}`);
|
|
184
192
|
}
|
|
185
193
|
server.httpServer?.once("close", async () => {
|
|
186
194
|
try {
|
|
@@ -188,7 +196,7 @@ function boot(options = {}) {
|
|
|
188
196
|
const module = await server.ssrLoadModule(`/${entry}`);
|
|
189
197
|
await runShutdown(module, bootContext);
|
|
190
198
|
} catch (error) {
|
|
191
|
-
logger.error(`Error running shutdown script: ${error}`);
|
|
199
|
+
logger.error(`Error running shutdown script: ${serializeError(error)}`);
|
|
192
200
|
}
|
|
193
201
|
});
|
|
194
202
|
if (hmr) {
|