Skip to content

Commit f5a23ea

Browse files
committed
add config and types
1 parent 7ef2e66 commit f5a23ea

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

packages/svelte/scripts/generate-types.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ await createBundle({
4545
[`${pkg.name}/store`]: `${dir}/src/store/public.d.ts`,
4646
[`${pkg.name}/transition`]: `${dir}/src/transition/public.d.ts`,
4747
[`${pkg.name}/events`]: `${dir}/src/events/public.d.ts`,
48+
[`${pkg.name}/devtool`]: `${dir}/src/devtool/public.d.ts`,
49+
4850
// TODO remove in Svelte 6
4951
[`${pkg.name}/types/compiler/preprocess`]: `${dir}/src/compiler/preprocess/legacy-public.d.ts`,
5052
[`${pkg.name}/types/compiler/interfaces`]: `${dir}/src/compiler/types/legacy-interfaces.d.ts`
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* devtools config
3+
* @type {import('./public.d.ts').Config}
4+
*/
5+
const config = {};
6+
7+
/**
8+
* @param {Partial<import('./public.d.ts').Config>} options
9+
*/
10+
export function configure(options){
11+
// TODO deep merge?
12+
for(const [key,value] of options){
13+
config[key]=value;
14+
}
15+
}
16+
17+
/**
18+
*
19+
* @return {import('./public.d.ts').Config}
20+
*/
21+
export function getConfig(){
22+
// TODO clone to avoid direct manipulation
23+
return config;
24+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export {default as DevTool} from './DevTool.svelte'
2+
export * from './configure.js'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export * from './index.js'
2+
3+
export interface Config {
4+
position: 'top'|'bottom'
5+
}

0 commit comments

Comments
 (0)