forked from svelte-add/svelte-add
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
22 lines (17 loc) · 823 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import type { AdderConfig, AdderWithoutExplicitArgs } from '@svelte-add/core/adder/config';
import type { Question } from '@svelte-add/core/adder/options';
export async function getAdderDetails(name: string) {
const adder: { default: AdderWithoutExplicitArgs } = await import(`./${name}/index.ts`);
return adder.default;
}
export async function getAdderConfig(name: string) {
// Mainly used by the website
// Either vite / rollup or esbuild are not able to process the shebangs
// present on the `index.js` file. That's why we directly import the configuration
// for the website here, as this is the only important part.
const adder: Promise<{ adder: AdderConfig<Record<string, Question>> }> = await import(
`./${name}/config/adder.ts`
);
const { adder: adderConfig } = await adder;
return adderConfig;
}