@eslym/sveltekit-adapter-bun 1.0.3 → 1.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.
- package/dist/index.js +12 -1
- package/dist/types.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -93,6 +93,8 @@ async function startDevServer({
|
|
|
93
93
|
},
|
|
94
94
|
appType: "custom"
|
|
95
95
|
});
|
|
96
|
+
const hooks = await vite.ssrLoadModule("./src/hooks.server.ts").catch(() => ({}));
|
|
97
|
+
await hooks.beforeServe?.();
|
|
96
98
|
const server = Bun.serve({
|
|
97
99
|
hostname: host,
|
|
98
100
|
port,
|
|
@@ -159,6 +161,7 @@ async function startDevServer({
|
|
|
159
161
|
}
|
|
160
162
|
});
|
|
161
163
|
globalThis[symServer] = server;
|
|
164
|
+
await hooks.afterServe?.(server);
|
|
162
165
|
console.log(`Serving on ${server.url}`);
|
|
163
166
|
}
|
|
164
167
|
var getRequestPatch = `
|
|
@@ -223,6 +226,7 @@ function adapter(userOpts = {}) {
|
|
|
223
226
|
out: "./build",
|
|
224
227
|
transpileBun: false,
|
|
225
228
|
precompress: false,
|
|
229
|
+
exportPrerender: false,
|
|
226
230
|
websocketOptions: {},
|
|
227
231
|
staticIgnores: ["**/.*"],
|
|
228
232
|
...userOpts
|
|
@@ -307,6 +311,7 @@ function adapter(userOpts = {}) {
|
|
|
307
311
|
exportSetupCLI(tmp);
|
|
308
312
|
writeFileSync(`${tmp}/manifest.js`, `export const manifest = ${builder.generateManifest({ relativePath: "./" })};\n\n` + `export const prerendered = new Set(${JSON.stringify(builder.prerendered.paths)});\n`);
|
|
309
313
|
const pkg = JSON.parse(readFileSync("package.json", "utf8"));
|
|
314
|
+
builder.log.minor("Bundling...");
|
|
310
315
|
const bundle = await rollup({
|
|
311
316
|
input: {
|
|
312
317
|
index: `${tmp}/index.js`,
|
|
@@ -322,7 +327,10 @@ function adapter(userOpts = {}) {
|
|
|
322
327
|
}),
|
|
323
328
|
commonjs({ strictRequires: true }),
|
|
324
329
|
json()
|
|
325
|
-
]
|
|
330
|
+
],
|
|
331
|
+
onLog(level, log) {
|
|
332
|
+
builder.log[level === "debug" ? "minor" : level](log.message);
|
|
333
|
+
}
|
|
326
334
|
});
|
|
327
335
|
await bundle.write({
|
|
328
336
|
dir: `${out}/server`,
|
|
@@ -367,6 +375,9 @@ function adapter(userOpts = {}) {
|
|
|
367
375
|
}
|
|
368
376
|
delete pkg.devDependencies;
|
|
369
377
|
writeFileSync(`${out}/package.json`, JSON.stringify(pkg, null, 2) + "\n");
|
|
378
|
+
if (opts.exportPrerender) {
|
|
379
|
+
writeFileSync(`${out}/prerendered.json`, JSON.stringify(builder.prerendered, null, 2) + "\n");
|
|
380
|
+
}
|
|
370
381
|
builder.log.success(`Build done.`);
|
|
371
382
|
},
|
|
372
383
|
emulate() {
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED