diff --git a/playground/package.json b/playground/package.json index 7e538a5..a1da044 100644 --- a/playground/package.json +++ b/playground/package.json @@ -8,7 +8,8 @@ "start": "astro dev", "build": "astro check && astro build", "preview": "astro preview", - "astro": "astro" + "astro": "astro", + "typecheck": "tsc --noEmit" }, "dependencies": { "@astrojs/check": "^0.9.3", diff --git a/src/index.ts b/src/index.ts index 87031d8..fa3fe5d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,8 +3,10 @@ * loaded when a user imports the Vitesse integration in their Astro configuration file. These * directives must be first at the top of the file and can only be preceded by this comment. */ +/// /// /// +/// import type { AstroIntegration } from 'astro' import type { PluginTranslations, VitesseUserConfigWithPlugins } from './utils/plugins' diff --git a/src/virtual-internal.d.ts b/src/virtual-internal.d.ts new file mode 100644 index 0000000..120958c --- /dev/null +++ b/src/virtual-internal.d.ts @@ -0,0 +1,47 @@ +declare module 'virtual:vitesse/project-context' { + const ProjectContext: { + root: string + srcDir: string + trailingSlash: import('astro').AstroConfig['trailingSlash'] + build: { + format: import('astro').AstroConfig['build']['format'] + } + } + export default ProjectContext +} + +declare module 'virtual:vitesse/user-css' { } + +declare module 'virtual:vitesse/user-images' { + type ImageMetadata = import('astro').ImageMetadata + export const logos: { + dark?: ImageMetadata + light?: ImageMetadata + } +} + +declare module 'virtual:vitesse/collection-config' { + export const collections: import('astro:content').ContentConfig['collections'] | undefined +} + +// components +declare module 'virtual:vitesse/components/ToggleTheme' { + const ToggleTheme: typeof import('./components/ToggleTheme.astro').default + export default ToggleTheme +} +declare module 'virtual:vitesse/components/Footer' { + const Footer: typeof import('./components/Footer.astro').default + export default Footer +} +declare module 'virtual:vitesse/components/ScrollToTop' { + const ScrollToTop: typeof import('./components/ScrollToTop.astro').default + export default ScrollToTop +} +declare module 'virtual:vitesse/components/SiteTitle' { + const SiteTitle: typeof import('./components/SiteTitle.astro').default + export default SiteTitle +} +declare module 'virtual:vitesse/components/NavBar' { + const NavBar: typeof import('./components/NavBar.astro').default + export default NavBar +} diff --git a/src/virtual.d.ts b/src/virtual.d.ts index 7c5c11c..a954589 100644 --- a/src/virtual.d.ts +++ b/src/virtual.d.ts @@ -3,55 +3,7 @@ declare module 'virtual:vitesse/user-config' { export default Config } -declare module 'virtual:vitesse/project-context' { - const ProjectContext: { - root: string - srcDir: string - trailingSlash: import('astro').AstroConfig['trailingSlash'] - build: { - format: import('astro').AstroConfig['build']['format'] - } - } - export default ProjectContext -} - -declare module 'virtual:vitesse/user-css' { } - -declare module 'virtual:vitesse/user-images' { - type ImageMetadata = import('astro').ImageMetadata - export const logos: { - dark?: ImageMetadata - light?: ImageMetadata - } -} - declare module 'virtual:vitesse/plugin-translations' { const PluginTranslations: import('./utils/plugins').PluginTranslations export default PluginTranslations } - -declare module 'virtual:vitesse/collection-config' { - export const collections: import('astro:content').ContentConfig['collections'] | undefined -} - -// components -declare module 'virtual:vitesse/components/ToggleTheme' { - const ToggleTheme: typeof import('./components/ToggleTheme.astro').default - export default ToggleTheme -} -declare module 'virtual:vitesse/components/Footer' { - const Footer: typeof import('./components/Footer.astro').default - export default Footer -} -declare module 'virtual:vitesse/components/ScrollToTop' { - const ScrollToTop: typeof import('./components/ScrollToTop.astro').default - export default ScrollToTop -} -declare module 'virtual:vitesse/components/SiteTitle' { - const SiteTitle: typeof import('./components/SiteTitle.astro').default - export default SiteTitle -} -declare module 'virtual:vitesse/components/NavBar' { - const NavBar: typeof import('./components/NavBar.astro').default - export default NavBar -}