File tree 6 files changed +20
-17
lines changed
6 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import toml from '@iarna/toml';
7
7
export default function ( ) {
8
8
return {
9
9
name : '@sveltejs/adapter-netlify' ,
10
+ serverEntryPoint : '@sveltejs/adapter-netlify/entry' ,
10
11
11
12
async adapt ( { utils } ) {
12
13
// "build" is the default publish directory when Netlify detects SvelteKit
Original file line number Diff line number Diff line change 12
12
"." : {
13
13
"import" : " ./index.js"
14
14
},
15
+ "./entry" : {
16
+ "import" : " ./files/entry.js"
17
+ },
15
18
"./package.json" : " ./package.json"
16
19
},
17
20
"main" : " index.js" ,
18
- "adapter" : " files/entry.js" ,
19
21
"types" : " index.d.ts" ,
20
22
"files" : [
21
23
" files" ,
Original file line number Diff line number Diff line change @@ -8,10 +8,6 @@ import zlib from 'zlib';
8
8
9
9
const pipe = promisify ( pipeline ) ;
10
10
11
- /**
12
- * @typedef {import('esbuild').BuildOptions } BuildOptions
13
- */
14
-
15
11
/** @type {import('.') } */
16
12
export default function ( {
17
13
// TODO: add ability to customize entry point to build/index.js
@@ -22,6 +18,7 @@ export default function ({
22
18
} = { } ) {
23
19
return {
24
20
name : '@sveltejs/adapter-node' ,
21
+ serverEntryPoint : '@sveltejs/adapter-node/entry' ,
25
22
26
23
async adapt ( { utils } ) {
27
24
utils . rimraf ( out ) ;
Original file line number Diff line number Diff line change 10
10
"type" : " module" ,
11
11
"main" : " index.js" ,
12
12
"types" : " index.d.ts" ,
13
- "adapter" : " files/index.js" ,
13
+ "exports" : {
14
+ "." : {
15
+ "import" : " ./index.js"
16
+ },
17
+ "./entry" : {
18
+ "import" : " ./files/index.js"
19
+ },
20
+ "./middlewares" : {
21
+ "import" : " ./files/middlewares.js"
22
+ },
23
+ "./package.json" : " ./package.json"
24
+ },
14
25
"scripts" : {
15
26
"dev" : " rollup -cw" ,
16
27
"build" : " rollup -c" ,
Original file line number Diff line number Diff line change 1
1
import { svelte } from '@sveltejs/vite-plugin-svelte' ;
2
2
import fs from 'fs' ;
3
- import { createRequire } from 'module' ;
4
3
import path from 'path' ;
5
4
import glob from 'tiny-glob/sync.js' ;
6
5
import vite from 'vite' ;
@@ -463,23 +462,15 @@ async function build_server(
463
462
// don't warn on overriding defaults
464
463
const [ modified_vite_config ] = deep_merge ( default_config , vite_config ) ;
465
464
466
- const adapter = config . kit ?. adapter ?. name ;
465
+ const adapter = config . kit ?. adapter ?. serverEntryPoint ;
467
466
/**
468
467
* @type {{ app:string, index?:string } }
469
468
*/
470
469
const input = {
471
470
app : app_file
472
471
} ;
473
472
if ( adapter ) {
474
- const require = createRequire ( import . meta. url ) ;
475
- let pkg_path ;
476
- try {
477
- pkg_path = require . resolve ( `${ adapter } /package.json` ) ;
478
- } catch ( err ) {
479
- throw new Error ( `Could not resolve ${ adapter } /package.json while building ${ cwd } ` ) ;
480
- }
481
- const pkg = JSON . parse ( fs . readFileSync ( pkg_path , 'utf8' ) ) ;
482
- input . index = path . resolve ( pkg_path . substring ( 0 , pkg_path . lastIndexOf ( '/' ) ) , pkg . adapter ) ;
473
+ input . index = adapter ;
483
474
}
484
475
485
476
/** @type {[any, string[]] } */
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export interface AdapterUtils {
15
15
16
16
export interface Adapter {
17
17
name : string ;
18
+ serverEntryPoint ?: string ;
18
19
adapt ( context : { utils : AdapterUtils ; config : ValidatedConfig } ) : Promise < void > ;
19
20
}
20
21
You can’t perform that action at this time.
0 commit comments