@specglass/core 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/content/mdx-loader.js +2 -2
- package/dist/integration.js +15 -0
- package/package.json +1 -1
- package/src/pages/index.astro +16 -1
|
@@ -24,9 +24,9 @@ import { SpecglassError } from "../errors/specglass-error.js";
|
|
|
24
24
|
* @returns Collection configuration object for the docs collection
|
|
25
25
|
*/
|
|
26
26
|
export function defineDocsCollection(options) {
|
|
27
|
-
const contentDir = options?.contentDir ?? "./src/content";
|
|
27
|
+
const contentDir = options?.contentDir ?? "./src/content/docs";
|
|
28
28
|
return {
|
|
29
|
-
loader: glob({ pattern: "
|
|
29
|
+
loader: glob({ pattern: "**/*.{mdx,md}", base: contentDir }),
|
|
30
30
|
schema: frontmatterSchema,
|
|
31
31
|
};
|
|
32
32
|
}
|
package/dist/integration.js
CHANGED
|
@@ -188,11 +188,26 @@ export const specglassIntegration = defineIntegration({
|
|
|
188
188
|
// Inject auto-import remark plugin directly into markdown config.
|
|
189
189
|
// This avoids integration ordering issues — the plugin is added
|
|
190
190
|
// to the remark pipeline regardless of where mdx() appears.
|
|
191
|
+
//
|
|
192
|
+
// Also register @tailwindcss/vite so Tailwind CSS v4 processing
|
|
193
|
+
// works out-of-the-box. Without this, consumers would need to
|
|
194
|
+
// manually add it to their vite.plugins in astro.config.ts.
|
|
195
|
+
let tailwindPlugin = [];
|
|
196
|
+
try {
|
|
197
|
+
const tw = await import("@tailwindcss/vite");
|
|
198
|
+
tailwindPlugin = [(tw.default ?? tw)()];
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
// @tailwindcss/vite not installed — skip (non-Tailwind setup)
|
|
202
|
+
}
|
|
191
203
|
params.updateConfig({
|
|
192
204
|
markdown: {
|
|
193
205
|
remarkPlugins: [createAutoImportPlugin(COMPONENT_IMPORTS)],
|
|
194
206
|
rehypePlugins: [rehypeCodeBlocks],
|
|
195
207
|
},
|
|
208
|
+
vite: {
|
|
209
|
+
plugins: tailwindPlugin,
|
|
210
|
+
},
|
|
196
211
|
});
|
|
197
212
|
params.injectRoute({
|
|
198
213
|
pattern: "/",
|
package/package.json
CHANGED
package/src/pages/index.astro
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* Since there is no content at `/`, this page finds the first navigable
|
|
6
6
|
* page and redirects the user there. Falls back to `/getting-started`
|
|
7
7
|
* if the navigation tree is empty (shouldn't happen in practice).
|
|
8
|
+
*
|
|
9
|
+
* Uses a meta-refresh + JS redirect instead of `Astro.redirect()` so that
|
|
10
|
+
* it works in Astro's default static output mode (no SSR required).
|
|
8
11
|
*/
|
|
9
12
|
import { navigation } from "virtual:specglass/navigation";
|
|
10
13
|
import type { NavItem } from "@specglass/core";
|
|
@@ -23,5 +26,17 @@ function findFirstPage(items: NavItem[]): string | null {
|
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
const target = findFirstPage(navigation.items) ?? "/getting-started";
|
|
26
|
-
return Astro.redirect(target);
|
|
27
29
|
---
|
|
30
|
+
|
|
31
|
+
<html>
|
|
32
|
+
<head>
|
|
33
|
+
<meta http-equiv="refresh" content={`0;url=${target}`} />
|
|
34
|
+
<title>Redirecting…</title>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<script define:vars={{ target }}>
|
|
38
|
+
window.location.replace(target);
|
|
39
|
+
</script>
|
|
40
|
+
<p>Redirecting to <a href={target}>{target}</a>…</p>
|
|
41
|
+
</body>
|
|
42
|
+
</html>
|