@orieljs/framework 0.1.0-alpha.13 → 0.1.0-alpha.15

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.
Files changed (56) hide show
  1. package/dist/{chunk-OTCTQVDQ.js → chunk-7GPMFMS7.js} +349 -67
  2. package/dist/chunk-7GPMFMS7.js.map +1 -0
  3. package/dist/{chunk-CKH4KCYF.js → chunk-BKA5F3TH.js} +1 -1
  4. package/dist/{chunk-CKH4KCYF.js.map → chunk-BKA5F3TH.js.map} +1 -1
  5. package/dist/{chunk-6GMXKQ6O.js → chunk-FVI6X3VJ.js} +55 -2
  6. package/dist/chunk-FVI6X3VJ.js.map +1 -0
  7. package/dist/{chunk-ZRTWDJKD.js → chunk-GCMPAXIK.js} +98 -4
  8. package/dist/chunk-GCMPAXIK.js.map +1 -0
  9. package/dist/contracts.d.ts +4 -1
  10. package/dist/contracts.js +1 -1
  11. package/dist/{index.d-WQpfdIbG.d.ts → index.d-lffxurFs.d.ts} +10 -1
  12. package/dist/index.d.ts +233 -37
  13. package/dist/index.js +823 -307
  14. package/dist/index.js.map +1 -1
  15. package/dist/{jsx-runtime-6um4Mwfb.d.ts → jsx-runtime-Bc5KJzwb.d.ts} +1 -1
  16. package/dist/jsx-runtime.d.ts +2 -2
  17. package/dist/jsx-runtime.js +3 -3
  18. package/dist/{testing-B8NOiQC9.d.ts → testing-CVpo7aRl.d.ts} +41 -7
  19. package/dist/testing.d.ts +2 -2
  20. package/dist/testing.js +5 -3
  21. package/docs/authentication.md +40 -1
  22. package/docs/console.md +16 -5
  23. package/docs/database-testing.md +21 -0
  24. package/docs/database.md +17 -2
  25. package/docs/deployment.md +12 -3
  26. package/docs/eloquent-factories.md +3 -0
  27. package/docs/eloquent-observers.md +2 -0
  28. package/docs/eloquent-relationships.md +8 -0
  29. package/docs/eloquent.md +6 -0
  30. package/docs/encryption.md +2 -0
  31. package/docs/export.md +3 -3
  32. package/docs/inertia.md +2 -1
  33. package/docs/installation.md +4 -1
  34. package/docs/lifecycle.md +5 -4
  35. package/docs/live-tests.md +20 -0
  36. package/docs/live.md +2 -0
  37. package/docs/mail.md +4 -2
  38. package/docs/navigation.json +4 -0
  39. package/docs/pagination.md +10 -0
  40. package/docs/providers.md +1 -1
  41. package/docs/queues.md +6 -0
  42. package/docs/responses.md +2 -1
  43. package/docs/routing.md +33 -0
  44. package/docs/scheduling.md +2 -0
  45. package/docs/session.md +19 -2
  46. package/docs/starter-kits.md +4 -0
  47. package/docs/storage.md +21 -3
  48. package/docs/testing.md +9 -6
  49. package/docs/two-factor.md +14 -4
  50. package/docs/upgrade.md +73 -0
  51. package/docs/views.md +2 -0
  52. package/docs/vite.md +19 -1
  53. package/package.json +54 -38
  54. package/dist/chunk-6GMXKQ6O.js.map +0 -1
  55. package/dist/chunk-OTCTQVDQ.js.map +0 -1
  56. package/dist/chunk-ZRTWDJKD.js.map +0 -1
@@ -217,6 +217,16 @@ The page number is the component's `page`: its actions `nextPage`, `previousPage
217
217
  move it. It isn't written to the address bar, so a reload shows page 1. `Pagination` takes `paginate()` and
218
218
  `simplePaginate()` paginators, not cursor ones.
219
219
 
220
+ Its buttons have the starter kits' classes, `btn btn-secondary`, and `btn` on the current page. On a site with its own CSS,
221
+ give it yours, or `''` for none. Write them in your file, so Tailwind generates them. `class` is for the `<nav>` around them:
222
+
223
+ ```tsx
224
+ import { Pagination, type PaginationSource } from '@orieljs/framework'
225
+ declare const posts: PaginationSource
226
+ // ---cut---
227
+ <Pagination paginator={posts} class="flex gap-2" buttonClass="pager" currentClass="pager is-current" />
228
+ ```
229
+
220
230
  ## Converting results to JSON
221
231
 
222
232
  A paginator returned from a route, or given to `JSON.stringify()`, becomes Laravel's JSON shape:
package/docs/providers.md CHANGED
@@ -9,7 +9,7 @@ Service providers are the central place of your app's setup. Your own app, and e
9
9
  through them. Setting up here means registering things: bindings in the [service container](container.md), event
10
10
  listeners, view composers, route patterns and bindings.
11
11
 
12
- Oriel uses 22 service providers of its own, for the mailer, the queue, the cache and the rest. [Request
12
+ Oriel uses 24 service providers of its own, for the mailer, the queue, the cache and the rest. [Request
13
13
  lifecycle](lifecycle.md#service-providers) lists them, and shows where providers fit in how your app starts. Your own
14
14
  providers are listed in `bootstrap/providers.ts`. This page shows how to write them and register them.
15
15
 
package/docs/queues.md CHANGED
@@ -306,6 +306,12 @@ process manager such as systemd or Supervisor, and after each deploy run `node o
306
306
  worker to stop after its current job so the process manager starts it again on the new code
307
307
  ([Deployment](deployment.md#queue-workers) shows a Supervisor program).
308
308
 
309
+ A queued job stores the names of the classes it carries, and the worker finds them again in `app/Jobs`, `app/Events`,
310
+ `app/Listeners`, `app/Mail` and `app/Notifications`. A class keeps its own name, unless two classes there share it, an
311
+ `OrderShipped` event and an `OrderShipped` mailable: then each is stored by its folder, `Events.OrderShipped` and
312
+ `Mail.OrderShipped`. Your app and its workers find the same names, so deploy them together, and restart the workers
313
+ when you add a class whose name another one already has.
314
+
309
315
  `queue:restart` leaves its signal in your default cache store, which each worker reads after every job. While the
310
316
  cache can't be read, a worker goes on working and reports the error once per outage; it sees the next signal once
311
317
  the cache is back.
package/docs/responses.md CHANGED
@@ -107,7 +107,8 @@ export class AddFrameOptions implements Middleware {
107
107
  }
108
108
  ```
109
109
 
110
- Oriel has no `cache.headers` middleware: set `Cache-Control` as any other header.
110
+ Set `Cache-Control` as any other header, or let the `cache.headers` middleware set it for a route, as
111
+ `cache.headers:public;max_age=3600;etag` ([the middleware aliases](middleware.md#middleware-aliases) list its options).
111
112
 
112
113
  ### Attaching cookies to responses
113
114
 
package/docs/routing.md CHANGED
@@ -494,6 +494,39 @@ if (request().routeIs('admin.*')) {
494
494
  }
495
495
  ```
496
496
 
497
+ #### Signed URLs
498
+
499
+ A signed URL carries a signature in its query string, made with your app key, so your app can tell that nobody changed
500
+ it: a link to unsubscribe from a list, or to confirm something, sent by email to someone who isn't signed in.
501
+ `url().signedRoute()` signs a named route's URL, and `temporarySignedRoute()` one that expires, at a `Date` or a number
502
+ of seconds from now:
503
+
504
+ ```ts
505
+ import { Route, url } from '@orieljs/framework'
506
+
507
+ Route.get('/unsubscribe/{user}', () => 'Unsubscribed').middleware('signed').name('unsubscribe')
508
+
509
+ const link = url().signedRoute('unsubscribe', { user: 1 })
510
+
511
+ const forAnHour = url().temporarySignedRoute('unsubscribe', 3600, { user: 1 })
512
+ ```
513
+
514
+ The `signed` middleware answers a request whose signature is missing, wrong or expired with a 403, so the route only
515
+ runs for a URL your app signed. To check one yourself, for a response of your own:
516
+
517
+ ```ts
518
+ import { abort, request, Route, url } from '@orieljs/framework'
519
+
520
+ Route.get('/unsubscribe/{user}', () => {
521
+ if (!url().hasValidSignature(request())) abort(401)
522
+ return 'Unsubscribed'
523
+ }).name('unsubscribe')
524
+ ```
525
+
526
+ A URL signed with `false` as the last argument signs only its path, so it works behind any host; check it with
527
+ `signed:relative`. A signature made with your previous app key (`APP_PREVIOUS_KEYS`) still checks out after you rotate
528
+ the key.
529
+
497
530
  ## Route groups
498
531
 
499
532
  A group shares middleware, a controller, a URI prefix or a name prefix between its routes. Groups can be nested: a
@@ -252,6 +252,8 @@ node oriel schedule:work
252
252
  ```
253
253
 
254
254
  When one minute's run fails, as when the cache can't be read, it reports the error and goes on with the next minute.
255
+ Ctrl-C, or a `SIGTERM` from a deploy, stops it: no task starts after that, and the tasks still running give up their
256
+ `withoutOverlapping()` locks, so their next run isn't blocked.
255
257
  [Deployment](deployment.md#task-scheduling) shows both ways in production.
256
258
 
257
259
  ## Task hooks
package/docs/session.md CHANGED
@@ -79,8 +79,25 @@ await Schema.create('sessions', (t) => {
79
79
  })
80
80
  ```
81
81
 
82
- Each row also records the signed-in user's id, the IP address and the user agent of the session's last request.
83
- `connection` names the database connection to use, the default one when it is `null`, and `table` the table.
82
+ Each row also records the signed-in user's id. `connection` names the database connection to use, the default one when
83
+ it is `null`, and `table` the table.
84
+
85
+ The `ip_address` and `user_agent` columns stay empty unless you turn on `client_details`, in `config/session.ts`:
86
+
87
+ ```ts
88
+ import { env } from '@orieljs/framework'
89
+
90
+ export default {
91
+ client_details: env('SESSION_CLIENT_DETAILS', false),
92
+ }
93
+ ```
94
+
95
+ The columns are there either way, so turning it on needs no migration. Turning it off clears a session's values the next
96
+ time that session is written.
97
+
98
+ > [!NOTE]
99
+ > Laravel stores both on every write. Oriel doesn't by default, because Live on a cached page gives anonymous readers a
100
+ > session, and storing them would keep every reader's address.
84
101
 
85
102
  #### Redis
86
103
 
@@ -12,6 +12,10 @@ need. There is nothing to keep in sync with the kit afterwards.
12
12
  The kits sign users in with Oriel's own authentication, without a separate package such as Laravel's Fortify: the
13
13
  controllers, or the Live components, are in your app.
14
14
 
15
+ A new password ends the user's other sessions, while the session that changed it stays signed in: the kits add the
16
+ [`auth.session` middleware](authentication.md#invalidating-sessions-on-other-devices) to the `web` group. An app made before
17
+ alpha.14 adds it with one line in `bootstrap/app.ts`, and nobody is signed out by doing so.
18
+
15
19
  ## Creating an application using a starter kit
16
20
 
17
21
  The installer asks which kit you want, or takes it as an option (see
package/docs/storage.md CHANGED
@@ -36,7 +36,13 @@ app's `config/filesystems.ts` isn't read yet.
36
36
 
37
37
  ### The S3 driver
38
38
 
39
- The `s3` disk reads `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_DEFAULT_REGION`, `AWS_BUCKET`, `AWS_URL`,
39
+ The `s3` disk needs the AWS SDK, which you install yourself:
40
+
41
+ ```sh
42
+ npm install @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
43
+ ```
44
+
45
+ It reads `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_DEFAULT_REGION`, `AWS_BUCKET`, `AWS_URL`,
40
46
  `AWS_ENDPOINT` and `AWS_USE_PATH_STYLE_ENDPOINT` from your `.env`. For an S3-compatible service, such as MinIO or
41
47
  Cloudflare R2, set `endpoint`, and `usePathStyleEndpoint` if it wants the bucket in the path.
42
48
 
@@ -44,7 +50,17 @@ Cloudflare R2, set `endpoint`, and `usePathStyleEndpoint` if it wants the bucket
44
50
 
45
51
  On Vercel, files your app stores need a disk that outlives the function: the `blob` disk keeps them in a
46
52
  [Vercel Blob](https://vercel.com/docs/vercel-blob) store. Create a store in your Vercel project's Storage tab and
47
- connect it to the project: Vercel then sets `BLOB_READ_WRITE_TOKEN`, which the disk reads.
53
+ connect it to the project: Vercel then sets `BLOB_READ_WRITE_TOKEN`, which the disk reads. The disk needs
54
+ `@vercel/blob` in your dependencies: `npm install @vercel/blob`.
55
+
56
+ > [!NOTE]
57
+ > `npm audit` reports an advisory in `zod`, which `@vercel/blob` brings in through Vercel's own packages (`@vercel/oidc`,
58
+ > then `@vercel/cli-config`). Until Vercel releases a fix there, an override in your `package.json` gives them the fixed
59
+ > version (`pnpm.overrides` for pnpm, `resolutions` for Yarn):
60
+ >
61
+ > ```json
62
+ > { "overrides": { "zod": "^4.6.6" } }
63
+ > ```
48
64
 
49
65
  ```ts
50
66
  import { Storage } from '@orieljs/framework'
@@ -187,7 +203,9 @@ same for folders. `makeDirectory()` creates a folder and `deleteDirectory()` del
187
203
  ## Live uploads
188
204
 
189
205
  A Live component's upload is first stored as a temporary file, under `live-tmp` on your default disk, with a random
190
- name. Your component's `store()` moves it to its place. When an upload finishes, temporary files older than a day are
206
+ name. Your component's `store()` moves it to its place, or copies it there and deletes the temporary file when you store it
207
+ on another disk, so nothing is left behind. An upload stores once: a second `store()`, or a `temporaryUrl()` after it,
208
+ throws `UploadAlreadyStoredError`, so reset the property afterwards. When an upload finishes, temporary files older than a day are
191
209
  deleted, except on an S3 disk, where listing the folder on every upload would be slow: give the bucket a lifecycle rule
192
210
  for `live-tmp` instead. `live.temporary_file_upload.disk` and `directory` choose another place.
193
211
 
package/docs/testing.md CHANGED
@@ -39,14 +39,18 @@ Before each application is created, the test case sets these variables, unless t
39
39
  | `CACHE_STORE` | `array` |
40
40
  | `DB_CONNECTION` | `sqlite` |
41
41
  | `DB_DATABASE` | `:memory:` |
42
+ | `DB_URL` | empty |
42
43
  | `MAIL_MAILER` | `array` |
43
44
  | `QUEUE_CONNECTION` | `sync` |
44
45
  | `SESSION_DRIVER` | `array` |
45
46
 
46
47
  So your tests send no mail, run jobs at once, and each test gets its own empty in-memory database. A new app's
47
- `vitest.config.ts` sets the same values as Vitest's `env`, because Bun reads `.env` before the tests start. Vitest's
48
- `env` replaces what your shell or your CI sets, so to run your tests with another value, such as a MySQL database,
49
- change it in `vitest.config.ts`.
48
+ `vitest.config.ts` sets the same values through `testingConfig()`, because Bun reads `.env` before the tests start. They
49
+ replace what your shell or your CI sets, and each run prints which database it is on. To run your tests on MySQL or
50
+ PostgreSQL, see [Running the tests on another database](database-testing.md#running-the-tests-on-another-database).
51
+
52
+ An app made before alpha.14 has `env: { ...TESTING_ENVIRONMENT }` in `vitest.config.ts`. Replace it with `...testingConfig()`,
53
+ imported from `@orieljs/framework/testing`, to get that.
50
54
 
51
55
  With `APP_ENV` set to `testing`, a `.env.testing` file, when you add one, is read in place of `.env`. For the other
52
56
  variables, what you set in your shell or your CI wins over both files.
@@ -128,9 +132,8 @@ Vitest runs your test files at the same time, in several workers. With the defau
128
132
  test has its own database, so tests can't see each other's rows.
129
133
 
130
134
  > [!WARNING]
131
- > On a database in a file, or a MySQL or PostgreSQL server (set in `vitest.config.ts`), every worker uses the same
132
- > database. Run those tests one
133
- > file at a time, with `node oriel test -- --no-file-parallelism`, or give each worker its own database.
135
+ > On a database in a file every worker uses the same database, so run those tests one file at a time, with `node oriel
136
+ > test -- --no-file-parallelism`. `TEST_DATABASE_URL` does that for you.
134
137
 
135
138
  ## Test traits
136
139
 
@@ -57,8 +57,9 @@ A user is asked only by a method open to them: email, or an app they have set up
57
57
  hasn't set up an app has no method open, so their password alone signs them in, as in Fortify, where two-factor is each
58
58
  user's choice. Keep `'email'` in `methods` to ask every user for a second factor.
59
59
 
60
- The secret and the recovery codes are encrypted with your app key; emailed codes are kept hashed, in the cache, so the
61
- cache must be shared by your servers (`database` or `redis`, as on Vercel).
60
+ The secret and the recovery codes are encrypted with your app key; emailed codes are kept hashed, in the cache, and so
61
+ is the count of wrong codes, so the cache must be shared by your servers (`database` or `redis`, as on Vercel). With
62
+ `file` or `array` on several servers, each one would count on its own.
62
63
 
63
64
  ## Signing in
64
65
 
@@ -103,7 +104,7 @@ Route.middleware('two-factor.challenge').group(() => {
103
104
  return redirect().intended('dashboard')
104
105
  }
105
106
  return back().withErrors({ code: 'That code is not right.' })
106
- })
107
+ }).middleware('throttle:5,1')
107
108
 
108
109
  Route.post('/two-factor-challenge/email', async () => {
109
110
  await TwoFactor.useMethod('email')
@@ -143,7 +144,10 @@ import type { User } from '../app/Models/User'
143
144
  // ---cut---
144
145
  Route.middleware('auth').group(() => {
145
146
  Route.post('/account/two-factor/app', async () => {
146
- const { svg, secret } = await TwoFactor.enableApp((await request().user<User>())!)
147
+ const user = (await request().user<User>())!
148
+ // A form sent again after the app is set up: enableApp() would refuse.
149
+ if (TwoFactor.hasApp(user)) return back().with('status', 'Your app is set up already.')
150
+ const { svg, secret } = await TwoFactor.enableApp(user)
147
151
  return view('account.two-factor-app', { svg, secret })
148
152
  })
149
153
 
@@ -158,6 +162,12 @@ Route.middleware('auth').group(() => {
158
162
  `confirmApp()` makes the app the user's method and gives them recovery codes. `disableApp()` removes it, and
159
163
  `setMethod()` lets a user who has both choose which is asked for.
160
164
 
165
+ `TwoFactor.hasApp(user)` says whether the user's app works, so a page can offer to set one up or to remove it. `enableApp()`
166
+ on a working app throws `TwoFactorAppAlreadyEnabledError`, since a new secret would silently stop the old app's codes: call
167
+ `disableApp(user)` first. Before the app is confirmed, calling `enableApp()` again just replaces the secret.
168
+
169
+ In a test, `totpCode(secret, Date.now())` from `@orieljs/framework` gives the code the app would show.
170
+
161
171
  ## Recovery codes
162
172
 
163
173
  `TwoFactor.recoveryCodes(user)` returns the user's codes, making them on first ask; show them once and ask the user to
@@ -0,0 +1,73 @@
1
+ # Upgrade guide
2
+
3
+ Oriel is in alpha, so a release can change something your app relies on. Each release's breaking changes are listed
4
+ below, newest first, each with what to do about it.
5
+
6
+ ## Moving to a new version
7
+
8
+ A new app takes each Oriel package at the exact version of the installer that made it, so a later release changes
9
+ nothing in your app until you move to it. To move, set every `@orieljs/*` package in your `package.json` to the same
10
+ new version, exactly:
11
+
12
+ ```sh
13
+ npm install --save-exact @orieljs/framework@0.1.0-alpha.15 @orieljs/vite@0.1.0-alpha.15
14
+ ```
15
+
16
+ List your kit's own packages in the same command: `@orieljs/inertia-client` and your framework's adapter
17
+ (`@orieljs/inertia-react`, `-vue`, `-svelte`, `-solid` or `-angular`), or `@orieljs/live-client`. With the other
18
+ package managers, `-E` pins the version the same way: `pnpm add -E …`, `yarn add -E …`, `bun add -E …`. Then run your
19
+ migrations and work through the sections below, from the version you had to the one you moved to:
20
+
21
+ ```sh
22
+ node oriel migrate
23
+ ```
24
+
25
+ An app made before 0.1.0-alpha.15 has `^` ranges, which take a later release by themselves the next time the
26
+ dependencies are installed without a lockfile. Pinning its packages as above stops that.
27
+
28
+ ## 0.1.0-alpha.15
29
+
30
+ - **Oriel's packages are pinned in new apps.** Nothing to do in an existing app, but you can pin it the same way
31
+ (above).
32
+ - **`find()` with an array returns a collection** of the models it found, as Laravel's does. Code that called
33
+ `find([1, 2])` expecting one model takes `.first()` of the result.
34
+ - **Two app classes with the same name are stored in a queued job by their folder**, as `Events.OrderShipped` and
35
+ `Mail.OrderShipped`. A class whose name is its own keeps it. Deploy your app and its workers together.
36
+ - **A `limit()` in an eager-load constraint applies to each model**, as in Laravel 11: `Post.with({ comments: (q) =>
37
+ q.limit(3) })` gives each post three comments. It needs SQLite 3.25, MySQL 8 or PostgreSQL.
38
+ - **`increment()` and `decrement()` on a model dispatch `updating` and `updated`.** An observer that should ignore them
39
+ checks `wasChanged()` for the columns it cares about.
40
+ - **Two-factor counts wrong codes in the cache.** On several servers, or on Vercel, the cache store must be shared:
41
+ `database` or `redis`.
42
+ - **`public/` publishes the same files everywhere:** `serve()`, `vercel:build` and `oriel export` leave out TypeScript
43
+ files and dotfiles, except `.well-known/` and `.nojekyll`. `serve()` now serves `.well-known/`; the builds no longer
44
+ copy other dotfiles, such as `.htaccess`, or `public/index.ts`.
45
+ - **Inner transactions started at once under one transaction run one after the other.** One that waits for a sibling
46
+ started beside it never finishes: await them in turn, or start them from separate transactions.
47
+ - **Two-factor sign-in rehashes the password** when your hashing settings changed, as `Auth.attempt()` does, so with
48
+ `auth.session` the user's other sessions end at their next sign-in after the change.
49
+ - **A chain's `catch` jobs and a batch's `then`, `catch` and `finally` go to the chain's or batch's connection and
50
+ queue**, not the default: run a worker there.
51
+ - **`where(column, 'like', …)` on PostgreSQL compares the column as text**, as Laravel does, so it works on numbers and
52
+ dates; a `citext` column compares case-sensitively there, so use `whereLike()` or `ilike` for those.
53
+ - **Page prop types leave out a model's hidden columns**, which never reached the page: code reading
54
+ `props.user.password` no longer typechecks.
55
+ - **`inertia:stop-ssr` exits 1** with "Unable to connect to Inertia SSR server." when none is running, and
56
+ **`inertia:start-ssr` exits 1** when its server is killed by a signal: a deploy script that stops SSR before starting
57
+ it should allow the first to fail.
58
+
59
+ ## 0.1.0-alpha.14
60
+
61
+ - **Database sessions keep no IP address or browser.** Set `client_details: true` in `config/session.ts` to keep
62
+ storing them; the columns are already there.
63
+ - **Drivers are installed separately:** `better-sqlite3` for SQLite on Node, `@aws-sdk/client-s3` and
64
+ `@aws-sdk/s3-request-presigner` for an `s3` disk, `@vercel/blob` for a `blob` disk. A missing one says which package
65
+ to install.
66
+ - **A Live upload's `store()` moves the file.** Reset the property after storing it: a second `store()`, or
67
+ `temporaryUrl()` after it, throws `UploadAlreadyStoredError`.
68
+ - **`TwoFactor.enableApp()` refuses an app that already works,** with `TwoFactorAppAlreadyEnabledError`: call
69
+ `disableApp()` first.
70
+ - **`DB_URL` and `DB_CONNECTION` no longer reach your tests.** Use `TEST_DATABASE_URL` to test on PostgreSQL or MySQL.
71
+ - **A command registered as a class gets a new instance for each run.**
72
+ - Add `AuthenticateSession` to the `web` group in `bootstrap/app.ts` to end other sessions on a new password, and in
73
+ `vitest.config.ts` replace `env: { ...TESTING_ENVIRONMENT }` with `...testingConfig()`.
package/docs/views.md CHANGED
@@ -336,6 +336,8 @@ Attributes take values as in HTML, with a few conveniences:
336
336
  - `true` writes a boolean attribute such as `disabled`, and `false`, `null` and `undefined` leave it out. `aria-*`
337
337
  and `data-*` attributes write `true` and `false` as text.
338
338
  - `htmlFor` is written `for`, and `for` works too.
339
+ - React's SVG names work: `strokeWidth` is written `stroke-width`, `clipPath` `clip-path`, `xlinkHref` `xlink:href`. Names SVG
340
+ itself writes in camelCase, such as `viewBox`, stay as they are.
339
341
 
340
342
  An `<html>` element is preceded by `<!DOCTYPE html>`, as TSX has no way to write one.
341
343
 
package/docs/vite.md CHANGED
@@ -197,6 +197,12 @@ In your scripts, the names in class positions: `class` and `className` props, pr
197
197
  `classList`, Angular's `[class.name]`. A string anywhere else keeps its words, so `type: 'hidden'` is still a hidden
198
198
  input, and a name your CSS doesn't define keeps its name.
199
199
 
200
+ In the HTML your views render, Oriel renames the `class` attributes, and Alpine's too: the names in a `:class` or
201
+ `x-bind:class` expression (in its strings and as the keys of an object) and the class lists of `x-transition:enter`,
202
+ `-start`, `-end` and their `leave` forms. In a template literal, its whole words and the strings inside each `${…}` are
203
+ renamed. A string an expression compares, `tab === 'hidden'`, keeps its words, and so does a class a function returns.
204
+ A class glued to a `${…}`, `` `text-${tone}` ``, can't be renamed: the build lists it, like the classes below.
205
+
200
206
  The build follows a class value back to its strings when they're in the same file: a variable, a list you join
201
207
  yourself, a value standing alone in a template, a function's result, a table of classes, and a memo or a ref:
202
208
 
@@ -221,7 +227,7 @@ Vue's `computed()` and `ref()`, Svelte's `$derived` and Solid's `createMemo()` c
221
227
  like `buttonClass` or `classes` holds classes wherever it's used.
222
228
 
223
229
  Your dependencies keep their class names, and so do the classes their style sheets define, so a library's markup
224
- always matches its CSS, whether you import it or the library injects it. CSS modules' names are hashed already, and
230
+ always matches its CSS, whether you import it from a script, `@import` it from your own CSS, or the library injects it. CSS modules' names are hashed already, and
225
231
  stay as Vite wrote them. `dark` is never renamed: the kits' appearance script sets it before the page draws.
226
232
 
227
233
  ### Classes the build can't rename
@@ -260,6 +266,18 @@ import { oriel } from '@orieljs/vite'
260
266
  oriel({ input: ['resources/css/app.css', 'resources/js/app.ts'], obfuscate: { keep: ['btn-primary', 'btn-danger'] } })
261
267
  ```
262
268
 
269
+ Two kinds of class names reach the browser without going through the build or the HTML Oriel renames: a class your
270
+ server code sends as data, such as an Inertia prop (`statusClass: 'text-green-600'`), and one an inline `<script>` in a
271
+ view adds. The production build reads your `app` and `routes` folders and your views' inline scripts for strings made of
272
+ your CSS's class names, and lists each one with its file and line:
273
+
274
+ ```text
275
+ These class names reach the browser where scrambling can't rename them:
276
+ The class "text-green-600" in app/Http/Controllers/OrderController.ts:14 is renamed in the CSS but not there. Add it to obfuscate.keep in vite.config.ts.
277
+ ```
278
+
279
+ Add those names to `keep`, as above.
280
+
263
281
  `keep` is also for a class something outside the build looks for, such as a script on another site. Browser tests
264
282
  that run against a production build see the short names, so find elements by role, label or text, as Playwright
265
283
  recommends, rather than by class.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orieljs/framework",
3
- "version": "0.1.0-alpha.13",
3
+ "version": "0.1.0-alpha.15",
4
4
  "description": "Oriel: a Laravel-style, full-stack TypeScript framework for Node.js and Bun.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -44,57 +44,61 @@
44
44
  "TRADEMARKS.md"
45
45
  ],
46
46
  "dependencies": {
47
- "@aws-sdk/client-s3": "3.1139.0",
48
- "@aws-sdk/s3-request-presigner": "3.1139.0",
49
47
  "@node-rs/argon2": "2.2.1",
50
- "@vercel/blob": "2.8.2",
51
48
  "bcryptjs": "3.0.3",
52
- "better-sqlite3": "13.0.3",
53
49
  "cron-parser": "5.10.1",
54
50
  "dotenv": "18.0.3",
55
51
  "ioredis": "6.0.0",
56
52
  "kysely": "0.29.6",
57
- "nodemailer": "10.0.10",
53
+ "nodemailer": "10.3.1",
58
54
  "pino": "10.3.1",
59
55
  "pluralize": "8.0.0",
60
56
  "uqr": "0.1.3"
61
57
  },
62
58
  "devDependencies": {
63
- "@orieljs/auth": "0.1.0-alpha.13",
64
- "@orieljs/bus": "0.1.0-alpha.13",
65
- "@orieljs/cache": "0.1.0-alpha.13",
66
- "@orieljs/config": "0.1.0-alpha.13",
67
- "@orieljs/collections": "0.1.0-alpha.13",
68
- "@orieljs/console": "0.1.0-alpha.13",
69
- "@orieljs/container": "0.1.0-alpha.13",
70
- "@orieljs/database": "0.1.0-alpha.13",
71
- "@orieljs/cookie": "0.1.0-alpha.13",
72
- "@orieljs/encryption": "0.1.0-alpha.13",
73
- "@orieljs/events": "0.1.0-alpha.13",
74
- "@orieljs/filesystem": "0.1.0-alpha.13",
75
- "@orieljs/hashing": "0.1.0-alpha.13",
76
- "@orieljs/http": "0.1.0-alpha.13",
77
- "@orieljs/inertia": "0.1.0-alpha.13",
78
- "@orieljs/live": "0.1.0-alpha.13",
79
- "@orieljs/log": "0.1.0-alpha.13",
80
- "@orieljs/mail": "0.1.0-alpha.13",
81
- "@orieljs/obfuscate": "0.1.0-alpha.13",
82
- "@orieljs/notifications": "0.1.0-alpha.13",
83
- "@orieljs/pipeline": "0.1.0-alpha.13",
84
- "@orieljs/queue": "0.1.0-alpha.13",
85
- "@orieljs/routing": "0.1.0-alpha.13",
86
- "@orieljs/session": "0.1.0-alpha.13",
87
- "@orieljs/support": "0.1.0-alpha.13",
88
- "@orieljs/testing": "0.1.0-alpha.13",
89
- "@orieljs/validation": "0.1.0-alpha.13",
90
- "@orieljs/vercel": "0.1.0-alpha.13",
91
- "@orieljs/view": "0.1.0-alpha.13",
92
- "@orieljs/contracts": "0.1.0-alpha.13",
93
- "@orieljs/foundation": "0.1.0-alpha.13"
59
+ "better-sqlite3": "13.0.3",
60
+ "@aws-sdk/client-s3": "3.1139.0",
61
+ "@aws-sdk/s3-request-presigner": "3.1139.0",
62
+ "@vercel/blob": "2.8.2",
63
+ "@orieljs/collections": "0.1.0-alpha.15",
64
+ "@orieljs/config": "0.1.0-alpha.15",
65
+ "@orieljs/cache": "0.1.0-alpha.15",
66
+ "@orieljs/auth": "0.1.0-alpha.15",
67
+ "@orieljs/console": "0.1.0-alpha.15",
68
+ "@orieljs/bus": "0.1.0-alpha.15",
69
+ "@orieljs/contracts": "0.1.0-alpha.15",
70
+ "@orieljs/cookie": "0.1.0-alpha.15",
71
+ "@orieljs/container": "0.1.0-alpha.15",
72
+ "@orieljs/encryption": "0.1.0-alpha.15",
73
+ "@orieljs/database": "0.1.0-alpha.15",
74
+ "@orieljs/events": "0.1.0-alpha.15",
75
+ "@orieljs/filesystem": "0.1.0-alpha.15",
76
+ "@orieljs/hashing": "0.1.0-alpha.15",
77
+ "@orieljs/inertia": "0.1.0-alpha.15",
78
+ "@orieljs/http": "0.1.0-alpha.15",
79
+ "@orieljs/live": "0.1.0-alpha.15",
80
+ "@orieljs/mail": "0.1.0-alpha.15",
81
+ "@orieljs/notifications": "0.1.0-alpha.15",
82
+ "@orieljs/log": "0.1.0-alpha.15",
83
+ "@orieljs/obfuscate": "0.1.0-alpha.15",
84
+ "@orieljs/pipeline": "0.1.0-alpha.15",
85
+ "@orieljs/queue": "0.1.0-alpha.15",
86
+ "@orieljs/support": "0.1.0-alpha.15",
87
+ "@orieljs/foundation": "0.1.0-alpha.15",
88
+ "@orieljs/session": "0.1.0-alpha.15",
89
+ "@orieljs/routing": "0.1.0-alpha.15",
90
+ "@orieljs/validation": "0.1.0-alpha.15",
91
+ "@orieljs/testing": "0.1.0-alpha.15",
92
+ "@orieljs/view": "0.1.0-alpha.15",
93
+ "@orieljs/vercel": "0.1.0-alpha.15"
94
94
  },
95
95
  "peerDependencies": {
96
96
  "pg": "^8.23.0",
97
- "mysql2": "^3.24.4"
97
+ "mysql2": "^3.24.4",
98
+ "better-sqlite3": "^13.0.3",
99
+ "@aws-sdk/client-s3": "^3.1139.0",
100
+ "@aws-sdk/s3-request-presigner": "^3.1139.0",
101
+ "@vercel/blob": "^2.8.2"
98
102
  },
99
103
  "peerDependenciesMeta": {
100
104
  "pg": {
@@ -102,6 +106,18 @@
102
106
  },
103
107
  "mysql2": {
104
108
  "optional": true
109
+ },
110
+ "better-sqlite3": {
111
+ "optional": true
112
+ },
113
+ "@aws-sdk/client-s3": {
114
+ "optional": true
115
+ },
116
+ "@aws-sdk/s3-request-presigner": {
117
+ "optional": true
118
+ },
119
+ "@vercel/blob": {
120
+ "optional": true
105
121
  }
106
122
  },
107
123
  "scripts": {