ReviewOS

also looking at this

stacks/ts-analytics

chore: remove subdir-resolve workaround plugin (core handles it now)

#122
Merged glennmichael123 wants to merge chore/remove-subdir-resolve-workaround into main
2 files +6 -17

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

stx-app-components.plugin.tsdeleted+0-16
Changes to stx-app-components.plugin.ts
@@ -1,16 +0,0 @@
1// Registers the app's own `resources/components` tree as a component source.
2//
3// Why this exists: stx 0.2.72 searches the configured `componentsDir` FLAT —
4// only its top level — so subdirectory kebab tags never resolve. Nearly all of
5// this app's components live in subdirs (`dashboard/`, `tabs/`), e.g.
6// `<site-selector>` → `resources/components/dashboard/SiteSelector.stx`. Without
7// this, the whole dashboard renders "Error loading component: ENOENT ...".
8//
9// Plugin component dirs, unlike `componentsDir`, ARE walked recursively by the
10// resolver (the same mechanism that lets `@stacksjs/components/src/ui/**`
11// resolve), so pointing one at `resources/components` makes the subdir tags
12// resolve again. See stx-components.plugin.ts for the library equivalent.
13export default {
14 name: 'app-components',
15 components: 'resources/components',
16}
stx.config.tsmodified+6-1
Changes to stx.config.ts
@@ -1,5 +1,10 @@
11export default {
2 plugins: ['./stx-app-components.plugin.ts', './stx-components.plugin.ts'] as const,
2 // stx-components.plugin registers the @stacksjs/components library (stx does
3 // not auto-resolve it). The app's own resources/components no longer needs a
4 // plugin — stx walks componentsDir recursively since stx@d914f3ab83, so subdir
5 // kebab tags (<site-selector> → components/dashboard/SiteSelector.stx) resolve
6 // natively. (Removed the old stx-app-components.plugin.ts workaround.)
7 plugins: ['./stx-components.plugin.ts'] as const,
38 // Paths relative to root ('resources', auto-detected).
49 // Don't include the 'resources/' prefix — it's already the root.
510 componentsDir: 'components',