Skip to content

Commit f87b352

Browse files
committed
docs: fix SSG build errors in multi-file examples
- Fix resolveMultiple to handle extensionless entry paths (try .vue) - Reorder bookmark example so entry component is last in source order - Replace picker.first() with seek('first')?.select() in theme-picker
1 parent 328facd commit f87b352

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

apps/docs/src/composables/useExamples.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,26 @@ export function useExamples () {
8181
for (const path of paths) {
8282
const normalized = path.startsWith('/') ? path.slice(1) : path
8383
const suffix = `/${normalized}`
84+
const isExtensionless = !normalized.includes('.')
8485

85-
const rawKey = findKey(rawKeys, suffix)
86+
// Try exact match first, then with .vue extension for extensionless paths
87+
const rawKey = findKey(rawKeys, suffix) ?? (isExtensionless ? findKey(rawKeys, `${suffix}.vue`) : undefined)
8688
const code = rawKey ? raw[rawKey] : undefined
8789

8890
if (code) {
91+
const fileName = normalized.split('/').pop() || normalized
8992
files.push({
90-
name: normalized.split('/').pop() || normalized,
93+
name: rawKey?.split('/').pop() || fileName,
9194
code,
92-
language: getLanguage(normalized),
95+
language: getLanguage(rawKey || normalized),
9396
})
9497
}
9598

9699
// Track last .vue file as the component (entry point)
97-
if (normalized.endsWith('.vue')) {
98-
const moduleKey = findKey(moduleKeys, suffix)
99-
if (moduleKey) {
100-
lastVueKey = moduleKey
101-
}
100+
const vueSuffix = normalized.endsWith('.vue') ? suffix : (isExtensionless ? `${suffix}.vue` : undefined)
101+
if (vueSuffix) {
102+
const moduleKey = findKey(moduleKeys, vueSuffix)
103+
if (moduleKey) lastVueKey = moduleKey
102104
}
103105
}
104106

apps/docs/src/examples/composables/create-single/theme-picker.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
const tickets = picker.onboard(
2222
themes.map(t => ({ id: t.name.toLowerCase(), value: t })),
2323
)
24-
picker.first()
24+
picker.seek('first')?.select()
2525
2626
const selected = toRef(() => picker.selectedValue.value as Theme | undefined)
2727
</script>

apps/docs/src/pages/composables/selection/create-selection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ Selection state is **always reactive**. Collection methods follow the base `crea
107107
## Examples
108108
109109
::: example
110-
/composables/create-selection/bookmark-manager 1
111110
/composables/create-selection/context.ts 2
112111
/composables/create-selection/BookmarkProvider.vue 3
113112
/composables/create-selection/BookmarkConsumer.vue 4
113+
/composables/create-selection/bookmark-manager.vue 1
114114
115115
### Bookmark Manager
116116

0 commit comments

Comments
 (0)