@ossy/app 0.15.13 → 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,11 +25,7 @@ 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
- List **`modules: ['@your/npm-package', ...]`** in `src/config.js` to pull in every **`*.page.js`**, **`*.page.jsx`**, **`*.page.ts`**, and **`*.page.tsx`** file under each packages **`src/`** tree (any subfolder). Deprecated: **`pagesModules`** / **`pagesModule`** still read for now, with a deprecation warning.
29
-
30
- Optional **`src/page-shell.jsx`** (or `.js`): default export your site layout component. **`usePageShell()`** from `@ossy/connected-components` wraps module pages in that shell so packages do not import site paths.
31
-
32
- **Note:** **`@ossy/connected-components`** is slated for retirement; its responsibilities (app shell, routing wrapper, **`usePageShell`**, etc.) should move into **`@ossy/app`** or smaller focused packages over time. See that package’s README.
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 pagescomponents 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.).
33
29
 
34
30
  Add `src/config.js` for workspace and theme:
35
31
 
@@ -47,17 +43,15 @@ Config is loaded at build time and merged with request-time settings (e.g. user
47
43
 
48
44
  Run `npx @ossy/cli dev` or `npx @ossy/cli build`.
49
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
+
50
48
  ## API routes
51
49
 
52
50
  Define HTTP handlers as an array of `{ id, path, handle(req, res) }` objects (same shape the server passes to `@ossy/router`).
53
51
 
54
- **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.
55
-
56
- **Legacy single file:** `src/api.js` default export is still supported. If it exists, its routes are merged **first**, then every `*.api.js`.
57
-
58
- 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.
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.
59
53
 
60
- **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.
61
55
 
62
56
  Example `src/health.api.js`:
63
57
 
@@ -71,20 +65,6 @@ export default {
71
65
  }
72
66
  ```
73
67
 
74
- Example `src/api.js` (optional aggregate or empty `[]`):
75
-
76
- ```js
77
- export default [
78
- {
79
- id: 'users',
80
- path: '/api/users',
81
- handle(req, res) {
82
- res.json({ users: [] })
83
- },
84
- },
85
- ]
86
- ```
87
-
88
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).
89
69
 
90
70
  ## Background worker tasks (`*.task.js`)