File tree Expand file tree Collapse file tree 1 file changed +33
-17
lines changed Expand file tree Collapse file tree 1 file changed +33
-17
lines changed Original file line number Diff line number Diff line change 1
- import type { AdderConfig , AdderWithoutExplicitArgs , Question } from '@svelte-cli/core' ;
2
-
1
+ // Rolldown doesn't support dynamic import vars yet.
3
2
export async function getAdderDetails ( name : string ) {
4
- const adder : { default : AdderWithoutExplicitArgs } = await import ( `./${ name } /index.ts` ) ;
3
+ let adder ;
4
+ switch ( name ) {
5
+ case 'drizzle' :
6
+ adder = await import ( './drizzle/index' ) ;
7
+ break ;
8
+ case 'eslint' :
9
+ adder = await import ( './eslint/index' ) ;
10
+ break ;
11
+ case 'mdsvex' :
12
+ adder = await import ( './mdsvex/index' ) ;
13
+ break ;
14
+ case 'playwright' :
15
+ adder = await import ( './playwright/index' ) ;
16
+ break ;
17
+ case 'prettier' :
18
+ adder = await import ( './prettier/index' ) ;
19
+ break ;
20
+ case 'routify' :
21
+ adder = await import ( './routify/index' ) ;
22
+ break ;
23
+ case 'storybook' :
24
+ adder = await import ( './storybook/index' ) ;
25
+ break ;
26
+ case 'tailwindcss' :
27
+ adder = await import ( './tailwindcss/index' ) ;
28
+ break ;
29
+ case 'vitest' :
30
+ adder = await import ( './vitest/index' ) ;
31
+ break ;
32
+ default :
33
+ throw new Error ( `invalid adder name: ${ name } ` ) ;
34
+ }
5
35
6
36
return adder . default ;
7
37
}
8
-
9
- export async function getAdderConfig ( name : string ) {
10
- // Mainly used by the website
11
- // Either vite / rollup or esbuild are not able to process the shebangs
12
- // present on the `index.js` file. That's why we directly import the configuration
13
- // for the website here, as this is the only important part.
14
-
15
- const adder : Promise < { adder : AdderConfig < Record < string , Question > > } > = await import (
16
- `./${ name } /config/adder.ts`
17
- ) ;
18
- const { adder : adderConfig } = await adder ;
19
-
20
- return adderConfig ;
21
- }
You can’t perform that action at this time.
0 commit comments