Skip to content

Commit fa8ee15

Browse files
authored
chore: fix playground launches slowly (#295)
1 parent 99efd3a commit fa8ee15

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

docs-svelte-kit/src/lib/eslint/scripts/ts-create-program.mts

+19-10
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,28 @@ export async function createVirtualCompilerHost(
7171
)
7272

7373
// Setup svelte type definition modules
74-
for (const [key, get] of Object.entries(
75-
// @ts-expect-error -- ignore
76-
import.meta.glob("../../../../../node_modules/svelte/**/*.d.ts", {
77-
as: "raw",
78-
}),
74+
for (const [key, module] of await Promise.all(
75+
Object.entries({
76+
// @ts-expect-error -- ignore
77+
...import.meta.glob("../../../../../node_modules/svelte/*/*.d.ts", {
78+
as: "raw",
79+
}),
80+
// @ts-expect-error -- ignore
81+
...import.meta.glob(
82+
"../../../../../node_modules/svelte/types/{runtime,shared}/**/*.d.ts",
83+
{
84+
as: "raw",
85+
},
86+
),
87+
}).map(async ([key, get]) => [
88+
key,
89+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ignore
90+
await (get as any)(),
91+
]),
7992
)) {
8093
const modulePath = key.slice("../../../../..".length)
8194

82-
fsMap.set(
83-
modulePath,
84-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ignore
85-
await (get as any)(),
86-
)
95+
fsMap.set(modulePath, module)
8796
}
8897

8998
const system = tsvfs.createSystem(fsMap)

0 commit comments

Comments
 (0)