@siddharatha/adapter-node-rolldown 1.0.8 → 1.0.9
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/files/index.js +7 -13
- package/index.js +1 -0
- package/package.json +1 -1
package/files/index.js
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
import polka from 'polka';
|
|
2
|
-
import sirv from 'sirv';
|
|
3
2
|
import { handler } from 'HANDLER';
|
|
3
|
+
import { createCompressionMiddleware, createStaticMiddleware } from 'MIDDLEWARES';
|
|
4
4
|
|
|
5
5
|
const app = polka();
|
|
6
6
|
|
|
7
|
-
// Serve static assets
|
|
8
|
-
app.use(
|
|
9
|
-
etag: true,
|
|
10
|
-
maxAge: 31536000,
|
|
11
|
-
immutable: true,
|
|
12
|
-
gzip: true,
|
|
13
|
-
brotli: true
|
|
14
|
-
}));
|
|
7
|
+
// Serve static assets (use optimized static middleware)
|
|
8
|
+
app.use(createStaticMiddleware('client'));
|
|
15
9
|
|
|
16
10
|
// Serve prerendered pages if they exist
|
|
17
11
|
try {
|
|
18
12
|
const { existsSync } = await import('node:fs');
|
|
19
13
|
if (existsSync('prerendered')) {
|
|
20
|
-
app.use(
|
|
21
|
-
etag: true,
|
|
22
|
-
maxAge: 0
|
|
23
|
-
}));
|
|
14
|
+
app.use(createStaticMiddleware('prerendered', false));
|
|
24
15
|
}
|
|
25
16
|
} catch (e) {
|
|
26
17
|
// Skip if prerendered doesn't exist
|
|
27
18
|
}
|
|
28
19
|
|
|
20
|
+
// Register compression for dynamic responses
|
|
21
|
+
app.use(createCompressionMiddleware());
|
|
22
|
+
|
|
29
23
|
// Handle all SvelteKit requests
|
|
30
24
|
app.use(handler);
|
|
31
25
|
|
package/index.js
CHANGED
|
@@ -159,6 +159,7 @@ export default function (options = {}) {
|
|
|
159
159
|
MANIFEST: './server/manifest.js',
|
|
160
160
|
SERVER: './server/index.js',
|
|
161
161
|
SHIMS: './shims.js',
|
|
162
|
+
MIDDLEWARES: './middlewares.js',
|
|
162
163
|
ENV_PREFIX: JSON.stringify(envPrefix),
|
|
163
164
|
POLYFILL: JSON.stringify(polyfill)
|
|
164
165
|
}
|