@ossy/app 0.15.12 → 1.0.1

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/README.md CHANGED
@@ -25,6 +25,8 @@ For a single-file setup, use `src/pages.jsx` (legacy).
25
25
 
26
26
  Split pages are merged into **`build/.ossy/pages.generated.jsx`** (next to other build output) during `dev` / `build`.
27
27
 
28
+ **Client JS (per-page):** For each `*.page.jsx`, the build emits **`build/.ossy/hydrate-<pageId>.jsx`** → **`public/static/hydrate-<pageId>.js`**. The HTML for a request only loads the hydrate script for the **current** route (full document navigation), so other pages’ components are not part of that entry. React and shared dependencies still go into hashed shared chunks. The inline config (`window.__INITIAL_APP_CONFIG__`) no longer includes the full `pages` list—only request-time fields (theme, `apiUrl`, etc.).
29
+
28
30
  Add `src/config.js` for workspace and theme:
29
31
 
30
32
  ```js
@@ -41,17 +43,15 @@ Config is loaded at build time and merged with request-time settings (e.g. user
41
43
 
42
44
  Run `npx @ossy/cli dev` or `npx @ossy/cli build`.
43
45
 
46
+ If the package has **`src/resource-templates/`**, the build also writes **`.ossy-system-templates.generated.js`** there (merging `*.resource.js` into `SystemTemplates`, ordered by filename).
47
+
44
48
  ## API routes
45
49
 
46
50
  Define HTTP handlers as an array of `{ id, path, handle(req, res) }` objects (same shape the server passes to `@ossy/router`).
47
51
 
48
- **Split files (recommended):** add any number of `*.api.js` (or `.api.mjs` / `.api.cjs`) files under `src/` (nested dirs allowed). Each file’s **default export** is either one route object or an array of routes. They are merged: `src/api.js` first (if present), then each `*.api.js` in lexicographic file path order.
49
-
50
- **Legacy single file:** `src/api.js` default export is still supported. If it exists, its routes are merged **first**, then every `*.api.js`.
52
+ Add any number of `*.api.js` (or `.api.mjs` / `.api.cjs`) files under `src/` (nested dirs allowed). Each file’s **default export** is either one route object or an array of routes. Files are merged in lexicographic path order.
51
53
 
52
- At build/dev time this becomes **`build/.ossy/api.generated.js`** (under your `--destination` / `build` output, typically gitignored with the rest of `build/`) whenever you have `src/api.js` and/or any `*.api.js`, so the Rollup entry stays stable when you add or remove split files.
53
-
54
- **Override:** pass `--api-source ./path/to/file.js` to use a single file and skip discovery.
54
+ Build/dev always writes **`build/.ossy/api.generated.js`** (typically gitignored with `build/`). With no API files it exports an empty array.
55
55
 
56
56
  Example `src/health.api.js`:
57
57
 
@@ -65,20 +65,6 @@ export default {
65
65
  }
66
66
  ```
67
67
 
68
- Example `src/api.js` (optional aggregate or empty `[]`):
69
-
70
- ```js
71
- export default [
72
- {
73
- id: 'users',
74
- path: '/api/users',
75
- handle(req, res) {
76
- res.json({ users: [] })
77
- },
78
- },
79
- ]
80
- ```
81
-
82
68
  API routes are matched before the app is rendered. The router supports dynamic segments (e.g. `path: '/api/users/:id'`); extract params from `req.originalUrl` if needed. Use paths that don't conflict with `/@ossy/*` (reserved for the internal proxy).
83
69
 
84
70
  ## Background worker tasks (`*.task.js`)