sveltekit-adapter-deno
Advanced tools
Comparing version
import {Adapter} from '@sveltejs/kit'; | ||
import {BuildOptions} from 'esbuild'; | ||
interface AdapterOptions { | ||
out?: string; | ||
buildOptions?: BuildOptions; | ||
} | ||
export default function plugin(options?: AdapterOptions): Adapter; |
29
index.js
@@ -6,3 +6,3 @@ import {fileURLToPath} from 'node:url'; | ||
export default function (opts = {}) { | ||
const {out = 'build'} = opts; | ||
const {out = 'build', buildOptions = {}} = opts; | ||
@@ -39,11 +39,24 @@ return { | ||
const defaultOptions = { | ||
entryPoints: [`${out}/server.js`], | ||
outfile: `${out}/server.js`, | ||
bundle: true, | ||
format: 'esm', | ||
target: 'esnext', | ||
platform: 'node', | ||
allowOverwrite: true | ||
}; | ||
for (const key of Object.keys(buildOptions)) { | ||
if (Object.hasOwn(defaultOptions, key)) { | ||
console.warn( | ||
`Warning: "buildOptions" has override for default "${key}" this may break deployment.` | ||
); | ||
} | ||
} | ||
try { | ||
await build({ | ||
entryPoints: [`${out}/server.js`], | ||
outfile: `${out}/server.js`, | ||
bundle: true, | ||
format: 'esm', | ||
target: 'esnext', | ||
platform: 'node', | ||
allowOverwrite: true | ||
...defaultOptions, | ||
...buildOptions | ||
}); | ||
@@ -50,0 +63,0 @@ } catch (err) { |
{ | ||
"name": "sveltekit-adapter-deno", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -47,2 +47,6 @@ # sveltekit-adapter-deno | ||
## Adapter options | ||
See the [TypeScript definition](/index.d.ts) for `AdapterOptions`. You can specify the build output directory and provide additional esbuild options. | ||
## Node and NPM modules | ||
@@ -49,0 +53,0 @@ |
7968
8.13%139
10.32%76
5.56%