@siddharatha/adapter-node-rolldown 1.0.7 → 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 -1
- 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
|
@@ -19,7 +19,6 @@ const files = fileURLToPath(new URL('./files', import.meta.url).href);
|
|
|
19
19
|
* @param {AdapterOptions} options
|
|
20
20
|
*/
|
|
21
21
|
export default function (options = {}) {
|
|
22
|
-
console.log('Using @siddharatha/adapter-node-rolldown v1.0.6 at 15 jan 11:58');
|
|
23
22
|
const {
|
|
24
23
|
out = 'build',
|
|
25
24
|
precompress = true,
|
|
@@ -160,6 +159,7 @@ export default function (options = {}) {
|
|
|
160
159
|
MANIFEST: './server/manifest.js',
|
|
161
160
|
SERVER: './server/index.js',
|
|
162
161
|
SHIMS: './shims.js',
|
|
162
|
+
MIDDLEWARES: './middlewares.js',
|
|
163
163
|
ENV_PREFIX: JSON.stringify(envPrefix),
|
|
164
164
|
POLYFILL: JSON.stringify(polyfill)
|
|
165
165
|
}
|