@dokebi/module 0.4.5 → 0.4.6

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/AI.md CHANGED
@@ -174,7 +174,18 @@ export default defineModule({
174
174
  5. the app's views (layouts and partials)
175
175
  6. shared `src/shared/views`
176
176
 
177
- To change a module page, an app never edits the module file; it puts a file with the same name into `src/apps/<app>/views/<template>/<module>/`. When an Inertia app mounts the module, the module produces props with `page.inertia.render(request, reply, 'Component', props)` and the Vue pages live in the app's `views/<template>/Pages/`.
177
+ To change a module page, an app never edits the module file; it puts a file with the same name into `src/apps/<app>/views/<template>/<module>/`.
178
+
179
+ ### 4a. Inertia (Vue) pages of a module (D-0218, @dokebi/module 0.4.6, @dokebi/app 0.4.9, @dokebi/template-inertia 0.4.8)
180
+
181
+ A module keeps its Vue pages in its own views folder, beside its EJS views: `views/<template>/Pages/**/*.vue` (`views/default/` is still required). They travel with the module, and an app that does not mount the module (or a set of it) does not carry them.
182
+
183
+ - **Name**: a page is named after the module: the module renders `page.inertia.render(request, reply, 'board/List', props)` and the file is `<module>/views/<template>/Pages/List.vue`. Components the pages import with a relative path (`../components/Row.vue`) come along.
184
+ - **Lookup** (the same order as the EJS views above): the app's `views/<template>/Pages/board/List.vue`, the app's `views/default/Pages/board/List.vue`, the module's `views/<template>/Pages/List.vue`, the module's `views/default/Pages/List.vue`. To change a module page an app puts a file of the same name under its own `Pages/<module>/`. A module page the app overrides in `default` is left out of the app's bundle.
185
+ - **Sets** (§2a): in a module of named sets, the first folder under `Pages/` that names a set holds that set's pages (`Pages/site/List.vue` is `board/site/List`); an app bundles only the sets it mounts. Other files under `Pages/` belong to every app that mounts the module.
186
+ - **Build**: `dokebiInertia()` of `@dokebi/template-inertia/vite` writes `virtual:dokebi/module-pages` for each app's `views/app.js` and `views/ssr.js`: it imports the app's `app.ts` and reads the views folders of the modules in its `modules`. The files `dokebi app add --inertia` writes (@dokebi/app 0.4.9) use it; an older `app.js` and `ssr.js` look up the app's own pages only, and `npx dokebi doctor` names them (`TEMPLATE_FIX_MISSING`, `module-pages`). `vite.ssr.config.ts` needs `dokebiInertia()` as well (`module-pages-plugin`).
187
+ - **Switch** (§2b): a switched-off module answers 404, so its pages are not reachable; they stay in the build (a running bundle cannot drop files). An app that should never carry them does not mount the module.
188
+ - `dokebi dev` reloads the browser when a page is added to or removed from a module folder; a change to `app.ts` (a module mounted or removed) is read again too.
178
189
 
179
190
  ## 5. Group plugin and lifecycle
180
191
 
package/dist/index.d.ts CHANGED
@@ -143,6 +143,11 @@ export interface ModuleMount {
143
143
  readonly name: string;
144
144
  /** Template prefix of the module views (`module.<name>`), when the module has views. */
145
145
  readonly views: string | undefined;
146
+ /**
147
+ * D-0218 (0.4.6): the module's views folder (`views` of the definition), where its Inertia pages
148
+ * live (`<template>/Pages/**`); undefined without views (and in older module packages).
149
+ */
150
+ readonly folder?: URL | undefined;
146
151
  /**
147
152
  * The hooks of a module mounted whole. For a module of named sets these are guards that fail
148
153
  * the start: an app package older than the sets (before @dokebi/app 0.4.8) would call them.
package/dist/index.js CHANGED
@@ -315,6 +315,7 @@ export function defineModule(definition) {
315
315
  const mount = Object.freeze({
316
316
  name,
317
317
  views: views ? prefix : undefined,
318
+ folder: views ? new URL(views.href) : undefined,
318
319
  routes: whole(definition.routes),
319
320
  sockets: whole(definition.sockets),
320
321
  events: whole(definition.events),
@@ -390,7 +391,7 @@ class ModuleGroupRuntime {
390
391
  }
391
392
  export const createPlugin = definePlugin({
392
393
  name: 'dokebi-module',
393
- version: '0.4.5',
394
+ version: '0.4.6',
394
395
  core: '^0.4.0',
395
396
  options,
396
397
  entry: parseEntry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dokebi/module",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Feature modules for Dokebi apps: controllers, models, views and routes in one folder mounted under a prefix.",
5
5
  "keywords": [
6
6
  "dokebi",
@@ -95,7 +95,7 @@
95
95
  "devDependencies": {
96
96
  "@dokebi/controller": "0.4.2",
97
97
  "@dokebi/template-ejs": "0.4.3",
98
- "@dokebi/template-inertia": "0.4.7",
98
+ "@dokebi/template-inertia": "0.4.8",
99
99
  "@dokebi/web": "0.4.7"
100
100
  },
101
101
  "publishConfig": {