@astroscope/boot 0.6.1 → 0.6.3
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 +27 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,7 +33,6 @@ __export(index_exports, {
|
|
|
33
33
|
WARMUP_MIDDLEWARE_MODULES: () => WARMUP_MIDDLEWARE_MODULES,
|
|
34
34
|
WARMUP_MODULES: () => WARMUP_MODULES,
|
|
35
35
|
WARMUP_PAGE_MODULES: () => WARMUP_PAGE_MODULES,
|
|
36
|
-
boot: () => boot,
|
|
37
36
|
default: () => boot,
|
|
38
37
|
prepend: () => prepend
|
|
39
38
|
});
|
|
@@ -166,11 +165,16 @@ function setupBootHmr(server, entry, logger, getBootContext2) {
|
|
|
166
165
|
const p = filePath.toLowerCase();
|
|
167
166
|
return ignoredSuffixes.some((suffix) => p.endsWith(suffix));
|
|
168
167
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (
|
|
173
|
-
|
|
168
|
+
let running = false;
|
|
169
|
+
let pendingReason;
|
|
170
|
+
const rerunBoot = async (reason) => {
|
|
171
|
+
if (running) {
|
|
172
|
+
pendingReason = reason;
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
running = true;
|
|
176
|
+
try {
|
|
177
|
+
logger.info(`${reason}, rerunning hooks...`);
|
|
174
178
|
const bootContext = getBootContext2();
|
|
175
179
|
try {
|
|
176
180
|
const oldModule = await ssrImport(server, bootModuleId);
|
|
@@ -185,7 +189,24 @@ function setupBootHmr(server, entry, logger, getBootContext2) {
|
|
|
185
189
|
} catch (error) {
|
|
186
190
|
logger.error(`Error during boot HMR startup: ${serializeError(error)}`);
|
|
187
191
|
}
|
|
192
|
+
} finally {
|
|
193
|
+
running = false;
|
|
194
|
+
}
|
|
195
|
+
if (pendingReason) {
|
|
196
|
+
const nextReason = pendingReason;
|
|
197
|
+
pendingReason = void 0;
|
|
198
|
+
await rerunBoot(nextReason);
|
|
188
199
|
}
|
|
200
|
+
};
|
|
201
|
+
server.watcher.on("change", async (changedPath) => {
|
|
202
|
+
if (shouldIgnore(changedPath)) return;
|
|
203
|
+
const bootDeps = getBootDependencies();
|
|
204
|
+
if (bootDeps.has(changedPath)) {
|
|
205
|
+
await rerunBoot(`boot dependency changed: ${changedPath}`);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
server.hot.on("vite:beforeFullReload", async () => {
|
|
209
|
+
await rerunBoot("full reload detected");
|
|
189
210
|
});
|
|
190
211
|
}
|
|
191
212
|
|
|
@@ -384,6 +405,5 @@ ${warmupEnd}`;
|
|
|
384
405
|
WARMUP_MIDDLEWARE_MODULES,
|
|
385
406
|
WARMUP_MODULES,
|
|
386
407
|
WARMUP_PAGE_MODULES,
|
|
387
|
-
boot,
|
|
388
408
|
prepend
|
|
389
409
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -42,4 +42,4 @@ declare const WARMUP_MIDDLEWARE_MODULES: string[];
|
|
|
42
42
|
*/
|
|
43
43
|
declare const WARMUP_MODULES: string[];
|
|
44
44
|
|
|
45
|
-
export { type BootOptions, WARMUP_MIDDLEWARE_MODULES, WARMUP_MODULES, WARMUP_PAGE_MODULES, boot
|
|
45
|
+
export { type BootOptions, WARMUP_MIDDLEWARE_MODULES, WARMUP_MODULES, WARMUP_PAGE_MODULES, boot as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -42,4 +42,4 @@ declare const WARMUP_MIDDLEWARE_MODULES: string[];
|
|
|
42
42
|
*/
|
|
43
43
|
declare const WARMUP_MODULES: string[];
|
|
44
44
|
|
|
45
|
-
export { type BootOptions, WARMUP_MIDDLEWARE_MODULES, WARMUP_MODULES, WARMUP_PAGE_MODULES, boot
|
|
45
|
+
export { type BootOptions, WARMUP_MIDDLEWARE_MODULES, WARMUP_MODULES, WARMUP_PAGE_MODULES, boot as default };
|
package/dist/index.js
CHANGED
|
@@ -102,11 +102,16 @@ function setupBootHmr(server, entry, logger, getBootContext2) {
|
|
|
102
102
|
const p = filePath.toLowerCase();
|
|
103
103
|
return ignoredSuffixes.some((suffix) => p.endsWith(suffix));
|
|
104
104
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (
|
|
109
|
-
|
|
105
|
+
let running = false;
|
|
106
|
+
let pendingReason;
|
|
107
|
+
const rerunBoot = async (reason) => {
|
|
108
|
+
if (running) {
|
|
109
|
+
pendingReason = reason;
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
running = true;
|
|
113
|
+
try {
|
|
114
|
+
logger.info(`${reason}, rerunning hooks...`);
|
|
110
115
|
const bootContext = getBootContext2();
|
|
111
116
|
try {
|
|
112
117
|
const oldModule = await ssrImport(server, bootModuleId);
|
|
@@ -121,7 +126,24 @@ function setupBootHmr(server, entry, logger, getBootContext2) {
|
|
|
121
126
|
} catch (error) {
|
|
122
127
|
logger.error(`Error during boot HMR startup: ${serializeError(error)}`);
|
|
123
128
|
}
|
|
129
|
+
} finally {
|
|
130
|
+
running = false;
|
|
131
|
+
}
|
|
132
|
+
if (pendingReason) {
|
|
133
|
+
const nextReason = pendingReason;
|
|
134
|
+
pendingReason = void 0;
|
|
135
|
+
await rerunBoot(nextReason);
|
|
124
136
|
}
|
|
137
|
+
};
|
|
138
|
+
server.watcher.on("change", async (changedPath) => {
|
|
139
|
+
if (shouldIgnore(changedPath)) return;
|
|
140
|
+
const bootDeps = getBootDependencies();
|
|
141
|
+
if (bootDeps.has(changedPath)) {
|
|
142
|
+
await rerunBoot(`boot dependency changed: ${changedPath}`);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
server.hot.on("vite:beforeFullReload", async () => {
|
|
146
|
+
await rerunBoot("full reload detected");
|
|
125
147
|
});
|
|
126
148
|
}
|
|
127
149
|
|
|
@@ -310,7 +332,6 @@ export {
|
|
|
310
332
|
WARMUP_MIDDLEWARE_MODULES,
|
|
311
333
|
WARMUP_MODULES,
|
|
312
334
|
WARMUP_PAGE_MODULES,
|
|
313
|
-
boot,
|
|
314
335
|
boot as default,
|
|
315
336
|
prepend
|
|
316
337
|
};
|