@openworkers/adapter-sveltekit 0.5.2 → 0.5.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/README.md +10 -9
- package/dist/index.d.ts +10 -3
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,8 +17,8 @@ import adapter from '@openworkers/adapter-sveltekit';
|
|
|
17
17
|
export default {
|
|
18
18
|
kit: {
|
|
19
19
|
adapter: adapter({
|
|
20
|
-
|
|
21
|
-
functions:
|
|
20
|
+
outDir: 'build', // Output directory (default: 'build')
|
|
21
|
+
functions: true // Generate mini-workers for API routes (default: false)
|
|
22
22
|
})
|
|
23
23
|
}
|
|
24
24
|
};
|
|
@@ -26,15 +26,16 @@ export default {
|
|
|
26
26
|
|
|
27
27
|
## Options
|
|
28
28
|
|
|
29
|
-
| Option
|
|
30
|
-
|
|
|
31
|
-
| `
|
|
32
|
-
| `functions`
|
|
29
|
+
| Option | Type | Default | Description |
|
|
30
|
+
| ------------ | --------- | --------- | ------------------------------------------------- |
|
|
31
|
+
| `outDir` | `string` | `'build'` | Output directory for the build |
|
|
32
|
+
| `functions` | `boolean` | `false` | Generate separate mini-workers for each API route |
|
|
33
|
+
| `nodeCompat` | `boolean` | `false` | Include shims for Node.js built-in modules |
|
|
33
34
|
|
|
34
35
|
## Output
|
|
35
36
|
|
|
36
37
|
```
|
|
37
|
-
|
|
38
|
+
build/
|
|
38
39
|
├── _worker.js # Main SSR worker
|
|
39
40
|
├── _routes.json # Route manifest for edge routing
|
|
40
41
|
├── assets/ # Static assets and prerendered pages
|
|
@@ -99,7 +100,7 @@ Build your SvelteKit app, then deploy it with the [OpenWorkers CLI](https://gith
|
|
|
99
100
|
bun run build
|
|
100
101
|
|
|
101
102
|
# Deploy
|
|
102
|
-
ow workers upload my-app ./
|
|
103
|
+
ow workers upload my-app ./build
|
|
103
104
|
```
|
|
104
105
|
|
|
105
106
|
For a first deployment, you'll need to set up the worker and its assets binding:
|
|
@@ -119,7 +120,7 @@ ow env bind my-app-env ASSETS my-storage --type assets
|
|
|
119
120
|
ow workers link my-app my-app-env
|
|
120
121
|
# Build and upload
|
|
121
122
|
bun run build
|
|
122
|
-
ow workers upload my-app ./
|
|
123
|
+
ow workers upload my-app ./build
|
|
123
124
|
```
|
|
124
125
|
|
|
125
126
|
## Examples
|
package/dist/index.d.ts
CHANGED
|
@@ -3,16 +3,23 @@ import { Adapter } from '@sveltejs/kit';
|
|
|
3
3
|
export interface AdapterOptions {
|
|
4
4
|
/**
|
|
5
5
|
* Output directory for the build
|
|
6
|
-
* @default '
|
|
6
|
+
* @default 'build'
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
outDir?: string;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Generate separate mini-workers for each API route.
|
|
12
|
-
* Outputs to `
|
|
12
|
+
* Outputs to `build/functions/` with routing info in `routes.js`.
|
|
13
13
|
* @default false
|
|
14
14
|
*/
|
|
15
15
|
functions?: boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Include shims for Node.js built-in modules (e.g. `path`, `fs`, `url`) to improve compatibility with existing npm packages.
|
|
19
|
+
* Note: This may increase bundle size and is not necessary for all packages.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
nodeCompat?: boolean;
|
|
16
23
|
}
|
|
17
24
|
|
|
18
25
|
export default function plugin(options?: AdapterOptions): Adapter;
|
package/dist/index.js
CHANGED
|
@@ -257,11 +257,11 @@ export { Server, manifest, prerendered, base_path };
|
|
|
257
257
|
MANIFEST: entryPoint,
|
|
258
258
|
"node:async_hooks": `${libDir}/async-hooks.js`,
|
|
259
259
|
...nodeCompat ? {
|
|
260
|
-
|
|
260
|
+
path: `${libDir}/node-path.js`,
|
|
261
261
|
"node:path": `${libDir}/node-path.js`,
|
|
262
|
-
|
|
262
|
+
fs: `${libDir}/node-fs.js`,
|
|
263
263
|
"node:fs": `${libDir}/node-fs.js`,
|
|
264
|
-
|
|
264
|
+
url: `${libDir}/node-url.js`,
|
|
265
265
|
"node:url": `${libDir}/node-url.js`
|
|
266
266
|
} : {}
|
|
267
267
|
},
|