@orieljs/framework 0.1.0-alpha.14 → 0.1.0-alpha.16

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 (70) hide show
  1. package/dist/{chunk-X4N74JDO.js → chunk-3QHTNAMZ.js} +6 -4
  2. package/dist/{chunk-X4N74JDO.js.map → chunk-3QHTNAMZ.js.map} +1 -1
  3. package/dist/{chunk-BKA5F3TH.js → chunk-6AXJB4CD.js} +5 -1
  4. package/dist/chunk-6AXJB4CD.js.map +1 -0
  5. package/dist/{chunk-UBSIBGXR.js → chunk-MG4YEWMV.js} +1351 -497
  6. package/dist/chunk-MG4YEWMV.js.map +1 -0
  7. package/dist/{chunk-4NCMY3ZS.js → chunk-YNDMTTWL.js} +121 -8
  8. package/dist/chunk-YNDMTTWL.js.map +1 -0
  9. package/dist/contracts.d.ts +112 -1
  10. package/dist/contracts.js +5 -1
  11. package/dist/{index.d-lffxurFs.d.ts → index.d-DA-Iu2a2.d.ts} +39 -2
  12. package/dist/index.d.ts +2838 -2101
  13. package/dist/index.js +1805 -647
  14. package/dist/index.js.map +1 -1
  15. package/dist/{jsx-runtime-Bc5KJzwb.d.ts → jsx-runtime-CenT41Y0.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-CVpo7aRl.d.ts → testing-B8J_HhF4.d.ts} +6 -2
  19. package/dist/testing.d.ts +2 -2
  20. package/dist/testing.js +3 -3
  21. package/docs/authentication.md +45 -3
  22. package/docs/authorization.md +2 -4
  23. package/docs/cache.md +29 -5
  24. package/docs/configuration.md +84 -7
  25. package/docs/console.md +41 -2
  26. package/docs/container.md +4 -0
  27. package/docs/csrf.md +2 -2
  28. package/docs/database.md +27 -2
  29. package/docs/deployment.md +42 -18
  30. package/docs/eloquent-factories.md +7 -3
  31. package/docs/eloquent-mutators.md +2 -1
  32. package/docs/eloquent-observers.md +2 -0
  33. package/docs/eloquent-relationships.md +34 -1
  34. package/docs/eloquent-resources.md +253 -0
  35. package/docs/eloquent.md +47 -0
  36. package/docs/errors.md +12 -3
  37. package/docs/events.md +3 -1
  38. package/docs/export.md +3 -3
  39. package/docs/facades.md +1 -0
  40. package/docs/helpers.md +33 -2
  41. package/docs/inertia.md +11 -1
  42. package/docs/installation.md +6 -2
  43. package/docs/laravel.md +71 -0
  44. package/docs/lifecycle.md +9 -5
  45. package/docs/live.md +88 -8
  46. package/docs/mail.md +32 -5
  47. package/docs/middleware.md +20 -12
  48. package/docs/navigation.json +12 -0
  49. package/docs/notifications.md +22 -0
  50. package/docs/pagination.md +4 -0
  51. package/docs/passwords.md +4 -6
  52. package/docs/providers.md +4 -6
  53. package/docs/queues.md +70 -2
  54. package/docs/requests.md +42 -3
  55. package/docs/responses.md +9 -5
  56. package/docs/routing.md +118 -7
  57. package/docs/scheduling.md +27 -0
  58. package/docs/session.md +2 -2
  59. package/docs/starter-kits.md +26 -7
  60. package/docs/storage.md +10 -4
  61. package/docs/testing.md +10 -2
  62. package/docs/two-factor.md +38 -4
  63. package/docs/upgrade.md +182 -0
  64. package/docs/validation.md +70 -9
  65. package/docs/views.md +1 -0
  66. package/docs/vite.md +20 -1
  67. package/package.json +43 -35
  68. package/dist/chunk-4NCMY3ZS.js.map +0 -1
  69. package/dist/chunk-BKA5F3TH.js.map +0 -1
  70. package/dist/chunk-UBSIBGXR.js.map +0 -1
@@ -0,0 +1,182 @@
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.16
29
+
30
+ - **A route middleware that returns nothing is an error**, as a global one is: a 500, "Middleware must return a
31
+ Response.", not an empty 204. Return what `next(request)` gives.
32
+ - **`throttle` runs before route model binding**, as Laravel's: a throttled request no longer looks its model up, and a
33
+ request for a missing model counts toward the limit.
34
+ - **`api/*` routes send CORS headers**, as in Laravel 11: a browser app on another origin can call them (no cookies or
35
+ credentials), and a preflight `OPTIONS` there answers 204. `node oriel install:api` writes `config/cors.ts` to change
36
+ it; `paths: []` or `middleware.remove(HandleCors)` turns it off. An app with its own CORS middleware keeps one of the
37
+ two.
38
+ - **Form fields and query keys nested deeper than 64 brackets answer 400**, as PHP stops at 64.
39
+ - **`serve()` reads `HOST`** (then `SERVER_HOST`) when it's given no `hostname`, and so does `node oriel serve` without
40
+ `--host`. If your server's environment sets `HOST` to something else, pass `hostname`. Node's keep-alive is now 65
41
+ seconds, past common load balancers' 60.
42
+ - **Every command takes Laravel's global options**: `-n`, `-q`, `-v`, `-V` and `--env`. A command that declares one of
43
+ those names keeps it, but `--env=<e>` also runs the app under that environment, loading `.env.<e>`: rename a
44
+ command's own `--env` option if it means something else.
45
+ - **`oriel serve` boots your app as `public/index.ts` does**: `runningInConsole()` is false, so factories,
46
+ `app/Console/Commands` and `routes/console.ts` aren't loaded in the server. Code that relied on them there imports
47
+ what it needs.
48
+ - **`make:policy` without `--model` writes an empty policy**, not one whose methods allow everything. Policies you
49
+ already have are unchanged.
50
+ - **`@orieljs/framework` no longer exports Oriel's internal helpers**, none of them meant for apps: from routing,
51
+ `orderForBindings`, `substituteBindings`, `dispatchRoute`, `mergeGroup`, `renderError`, `resolveMiddleware`,
52
+ `runMiddleware`, `resourceRoutes`, `compareRoutes`, `normalizePath`, `normalizeUri`, `parseParameters`, `toResponse`
53
+ and `healthResponse`; from the HTTP layer, `currentRequest`, `optionalCookieJar`, `optionalSession`, `requestScope`,
54
+ `clientAddress`, `setClientAddress`, `ipMatches`, `fromEntries`, `isBlank`, `mergeRecursive`, `normalizeLists`,
55
+ `parseBracketKey`, `sanitize`, `transformLeaves`, `extensionFromMime`, `exceedsJsonDepth`,
56
+ `applyMiddlewareCallbacks`, `applyExceptionCallbacks`, `statusFor`, `summarizeValidation`, `debugPage`, `escapeHtml`,
57
+ `minimalPage`, `stackFrames`, `statusText`, `bunRuntime`, `serveBun`, `serveNode`, `toWebRequest`, `writeResponse`,
58
+ `detectRuntime`, `servePublicFile`, `addApiRouting`, `API_ROUTES_STUB`, `filterRouteList`, `formatRouteList`,
59
+ `registerHttpCommands` and `routeListRows`; from the console, `suggest`, `parseArgv`, `parseSignature`,
60
+ `resolveArguments`, `resolveOptions` and `validateRequiredArguments`; their types; and the old `ClosureKernel`. If
61
+ you used one, copy it into your app.
62
+ - **A queue connection's `after_commit: true` now holds jobs dispatched inside a database transaction until it
63
+ commits**, a `DB.transaction()` or one `DB.beginTransaction()` opened, and drops them if it rolls back, as
64
+ Laravel's; it was ignored. The transaction `RefreshDatabase` opens around a test holds none. Queued listeners, mail and notifications
65
+ wait too. Inside the transaction, such a dispatch resolves with an empty job ID. A new app's connections have it off.
66
+ - **A route parameter whose `where()` pattern takes slashes keeps them in `route()`'s URLs**, as Laravel's:
67
+ `{path}` with `.*` gives `/docs/guides/intro.md`, not `/docs/guides%2Fintro.md`. Each segment is still encoded.
68
+ - **`alpha`, `alpha_num` and `alpha_dash` accept letters of every script**, as Laravel's: `José` and `中文` pass
69
+ `alpha` now. Write `alpha:ascii` (or `alpha_num:ascii`, `alpha_dash:ascii`) to keep accepting only ASCII.
70
+ - **A form request's `prepareForValidation()`, `after()` and `stopOnFirstFailure` are used**, as Laravel's: if one of
71
+ yours has a member of those names for something else, rename it. A test fake of `ValidationFactory` must return a
72
+ `Validator` with `safe()` and `stopOnFirstFailure()`.
73
+ - **The queue dispatches Laravel's job events**: `JobQueued`, `JobProcessing`, `JobProcessed` and `JobFailed`.
74
+ `Event.fake()` with no list records them too, so a test that queues or runs a job and then calls
75
+ `assertNothingDispatched()` fails: give `Event.fake()` the events the test is about.
76
+ - **Mail and notifications dispatch Laravel's events too**: `MessageSending` and `MessageSent`, and
77
+ `NotificationSending`, `NotificationSent` and `NotificationFailed`. A `MessageSending` listener that returns `false`
78
+ stops the message, so `sendNow()` may resolve `undefined`: `MailerImpl.sendNow()` is typed that way now, as the
79
+ `Mailer` contract already was.
80
+ - **The scheduler dispatches Laravel's task events**: `ScheduledTaskStarting`, `ScheduledTaskFinished`,
81
+ `ScheduledTaskFailed` and `ScheduledTaskSkipped`, so `Event.fake()` with no list records them as well.
82
+ - **On Vercel, work after the response goes to Vercel's `waitUntil()`**: `dispatchAfterResponse()` jobs, terminable
83
+ middleware and `terminating()` callbacks run once the function has answered, within its time limit.
84
+ - **`ioredis` and `nodemailer` no longer come with Oriel.** Install `ioredis` if your app uses a Redis cache store,
85
+ session driver or queue connection (`npm install ioredis`), and `nodemailer` for the `smtp` mailer in an app made
86
+ before 0.1.0-alpha.16 (`npm install nodemailer`; new apps list it). Each is loaded the first time it's needed, and
87
+ an app without it gets an error naming the package to install. `makeRedisClient()`, from the cache, queue and
88
+ session packages, now returns a promise, and `RedisRepository` takes only its store.
89
+ - **Seven contracts gained members**: `DatabaseConnection` has `afterCommit()`; `QueueManager` `before()`, `after()`
90
+ and `failing()`; `RateLimiter` `for()`, `limiter()` and `attempt()`; `HttpRequest` `safe()`;
91
+ `MiddlewareConfigurator` `remove()`, `trimStrings()`, `convertEmptyStringsToNull()`, `trustHosts()` and
92
+ `preventRequestsDuringMaintenance()`; `Application` `maintenanceMode()` and `isDownForMaintenance()`; and
93
+ `Validator` `safe()` and `stopOnFirstFailure()`. A test double of one in your app must add them; TypeScript lists
94
+ what's missing.
95
+ - **Some classes' signatures changed**: `SessionManager.redis()` returns a promise; `RedisStore` takes a client, a
96
+ connection or a function that makes one; `RedisSessionHandler` takes a function that makes its client;
97
+ `ThrottleRequests.handle()` takes its parameters as a rest; `MailManager.sendNow()` and `PendingMail.sendNow()`
98
+ resolve `SentMessage | undefined`; and the auth mixin no longer declares `getKey()`, so a model's own is used. A
99
+ subclass or a test stub of one takes the new shape.
100
+ - **The Live client reloads the page when an update answers 423**, as it does on 401: that is `password.confirm`'s
101
+ answer once a confirmation runs out. An action of yours that answers 423 for its own reason gets a reload.
102
+ - **A new app's `User` casts `password` as `hashed`.** To do the same in yours, add `password: 'hashed'` to the
103
+ model's `casts`: your `Hash.make()` calls keep working, as a hash is kept as it is.
104
+ - **An eager-load `limit()` on a `hasManyThrough` applies to each model too**, as on the other relations: each country
105
+ gets its own latest post, not one post for all the countries together.
106
+ - **Factory results with a count, `createMany()`, a relation's `createMany()` and an Eloquent paginator's
107
+ `getCollection()` are Eloquent collections**, as Laravel's. A relation's `createMany()` returned an array: use
108
+ `.all()`, `.first()` or `.count()` on it. On these, `only()`, `except()`, `unique()`, `diff()` and `contains(key)`
109
+ compare models by key.
110
+ - **`find()` and `findOrFail()` given a key typed `unknown` return a model or a collection**, as they do when the
111
+ key is an array when the request runs (`?id[]=1`): pass `String(id)`, or check the result. A model's `getKey()` is
112
+ now typed as a string, a number or a bigint (or nothing before the model is saved), so `find(model.getKey())`
113
+ still gives a model.
114
+ - **With `types/models.d.ts`, model writes are checked**: `create()`, `make()`, `fill()`, `forceFill()`, `update()`,
115
+ `forceCreate()`, `firstOrNew()`, `firstOrCreate()` and `updateOrCreate()` refuse a key that isn't a column (or a set
116
+ mutator's) and a value of the wrong type. Fix the key; keys known only at run time go in a `Record<string, unknown>`.
117
+ A validated field that isn't a column, which `fill()` would drop, is refused too: leave it out by name,
118
+ `const { tags, ...attributes } = validated`. Run `node oriel model:types` again: the file now gives each model a
119
+ `$self`, so its own methods' `this.update()` and `this.load()` are checked as well. A model method that returns
120
+ `this.load(…)` needs its return type written (TypeScript says it "implicitly has return type 'any'"). Models without
121
+ generated types, and a generic helper's `M extends Model`, take any attributes and relations, as before.
122
+ - **With `types/models.d.ts`, relation names are checked** in `with()`, `load()`, `loadMissing()`, `has()`,
123
+ `whereHas()`, `withCount()` and the aggregates: fix a misspelt one. A name held in a `string` still passes.
124
+ - **Page prop types follow a model's `visible` list, and leave out hidden appends and relations**, as `toJSON()` does,
125
+ and they type the relations `with()` and `load()` loaded and the model's appends: code reading a key the JSON
126
+ doesn't have no longer typechecks. Run `node oriel model:types` (or `migrate`) to regenerate `types/models.d.ts`.
127
+ - **`with()` and `load()` return types carry what they load**: a type test expecting exactly `EloquentCollection<Post>`
128
+ from them takes the new type.
129
+
130
+ New starter kits have two-factor login and password confirmation. An app made from a kit before alpha.16 keeps its
131
+ pages, and nobody is asked for a code: [Adding two-factor to an app made before
132
+ alpha.16](two-factor.md#adding-two-factor-to-an-app-made-before-alpha16) says what to copy.
133
+
134
+ ## 0.1.0-alpha.15
135
+
136
+ - **Oriel's packages are pinned in new apps.** Nothing to do in an existing app, but you can pin it the same way
137
+ (above).
138
+ - **`find()` with an array returns a collection** of the models it found, as Laravel's does. Code that called
139
+ `find([1, 2])` expecting one model takes `.first()` of the result.
140
+ - **Two app classes with the same name are stored in a queued job by their folder**, as `Events.OrderShipped` and
141
+ `Mail.OrderShipped`. A class whose name is its own keeps it. Deploy your app and its workers together.
142
+ - **A `limit()` in an eager-load constraint applies to each model**, as in Laravel 11: `Post.with({ comments: (query) =>
143
+ query.limit(3) })` gives each post three comments. It needs SQLite 3.25, MySQL 8 or PostgreSQL.
144
+ - **`increment()` and `decrement()` on a model dispatch `updating` and `updated`.** An observer that should ignore them
145
+ checks `wasChanged()` for the columns it cares about.
146
+ - **Two-factor counts wrong codes in the cache.** On several servers, or on Vercel, the cache store must be shared:
147
+ `database` or `redis`.
148
+ - **`public/` publishes the same files everywhere:** `serve()`, `vercel:build` and `oriel export` leave out TypeScript
149
+ files and dotfiles, except `.well-known/` and `.nojekyll`. `serve()` now serves `.well-known/`; the builds no longer
150
+ copy other dotfiles, such as `.htaccess`, or `public/index.ts`.
151
+ - **Inner transactions started at once under one transaction run one after the other.** One that waits for a sibling
152
+ started beside it never finishes: await them in turn, or start them from separate transactions.
153
+ - **Two-factor sign-in rehashes the password** when your hashing settings changed, as `Auth.attempt()` does, so with
154
+ `auth.session` the user's other sessions end at their next sign-in after the change.
155
+ - **A password saved in the signed-in browser keeps that browser signed in**, a password reset included, whichever
156
+ instance of the user saves it (with `auth.session`). A test that resets the password in its signed-in session, to
157
+ stand for another browser, stays signed in now: reset in another session.
158
+ - **A chain's `catch` jobs and a batch's `then`, `catch` and `finally` go to the chain's or batch's connection and
159
+ queue**, not the default: run a worker there.
160
+ - **`where(column, 'like', …)` on PostgreSQL compares the column as text**, as Laravel does, so it works on numbers and
161
+ dates; a `citext` column compares case-sensitively there, so use `whereLike()` or `ilike` for those.
162
+ - **Page prop types leave out a model's hidden columns**, which never reached the page: code reading
163
+ `props.user.password` no longer typechecks.
164
+ - **`inertia:stop-ssr` exits 1** with "Unable to connect to Inertia SSR server." when none is running, and
165
+ **`inertia:start-ssr` exits 1** when its server is killed by a signal: a deploy script that stops SSR before starting
166
+ it should allow the first to fail.
167
+
168
+ ## 0.1.0-alpha.14
169
+
170
+ - **Database sessions keep no IP address or browser.** Set `client_details: true` in `config/session.ts` to keep
171
+ storing them; the columns are already there.
172
+ - **Drivers are installed separately:** `better-sqlite3` for SQLite on Node, `@aws-sdk/client-s3` and
173
+ `@aws-sdk/s3-request-presigner` for an `s3` disk, `@vercel/blob` for a `blob` disk. A missing one says which package
174
+ to install.
175
+ - **A Live upload's `store()` moves the file.** Reset the property after storing it: a second `store()`, or
176
+ `temporaryUrl()` after it, throws `UploadAlreadyStoredError`.
177
+ - **`TwoFactor.enableApp()` refuses an app that already works,** with `TwoFactorAppAlreadyEnabledError`: call
178
+ `disableApp()` first.
179
+ - **`DB_URL` and `DB_CONNECTION` no longer reach your tests.** Use `TEST_DATABASE_URL` to test on PostgreSQL or MySQL.
180
+ - **A command registered as a class gets a new instance for each run.**
181
+ - Add `AuthenticateSession` to the `web` group in `bootstrap/app.ts` to end other sessions on a new password, and in
182
+ `vitest.config.ts` replace `env: { ...TESTING_ENVIRONMENT }` with `...testingConfig()`.
@@ -570,9 +570,53 @@ export class StorePostRequest extends FormRequest {
570
570
  }
571
571
  ```
572
572
 
573
- Laravel's form requests also have `after()`, `stopOnFirstFailure`, `$redirect`, `prepareForValidation()` and
574
- `passedValidation()`, which Oriel's don't. Change the input before you validate with `request().merge()`, and check
575
- more with a [validator of your own](#performing-additional-validation).
573
+ #### Preparing input for validation
574
+
575
+ `prepareForValidation()` runs first, before `authorize()` and the rules, to change the input. What it merges is
576
+ validated with the rest:
577
+
578
+ ```ts title="app/Http/Requests/StorePostRequest.ts"
579
+ import { FormRequest, request, Str } from '@orieljs/framework'
580
+
581
+ export class StorePostRequest extends FormRequest {
582
+ rules() {
583
+ return { title: 'required|string', slug: 'required|alpha_dash' } as const
584
+ }
585
+
586
+ protected override prepareForValidation(): void {
587
+ request().merge({ slug: Str.slug(String(request().input('title') ?? '')) })
588
+ }
589
+ }
590
+ ```
591
+
592
+ #### Additional checks and stopping early
593
+
594
+ `after()` returns functions that run once the rules have, whether they passed or not, as the validator's
595
+ [`after()`](#performing-additional-validation) does: each receives the validator, whose `fail()` adds a message. With
596
+ `stopOnFirstFailure = true`, the request stops at the first field that fails:
597
+
598
+ ```ts title="app/Http/Requests/StorePostRequest.ts"
599
+ import { FormRequest, request } from '@orieljs/framework'
600
+ import type { Validator } from '@orieljs/framework/contracts'
601
+
602
+ export class StorePostRequest extends FormRequest {
603
+ protected override stopOnFirstFailure = true
604
+
605
+ rules() {
606
+ return { title: 'required|string', body: 'required|string' } as const
607
+ }
608
+
609
+ protected override after() {
610
+ return [
611
+ (validator: Validator) => {
612
+ if (String(request().input('title')).includes('spam')) validator.fail('title', 'Something is wrong with this title!')
613
+ },
614
+ ]
615
+ }
616
+ }
617
+ ```
618
+
619
+ Laravel's `$redirect` and `passedValidation()` aren't in Oriel's form requests.
576
620
 
577
621
  ## Manually creating validators
578
622
 
@@ -733,8 +777,23 @@ const validated = await request().validate({ name: 'required|string', email: 're
733
777
  const { name, email } = validated
734
778
  ```
735
779
 
736
- The data is a plain object. Laravel's `safe()`, with `only()`, `except()` and `merge()`, isn't in Oriel: pick the
737
- keys you want from the object.
780
+ The data is a plain object. `request().safe()` gives what the last `validate()` returned, the request's own or a form
781
+ request's, as a `ValidatedInput`, to pick from:
782
+
783
+ ```ts
784
+ await request().validate({ name: 'required|string', email: 'required|email', tags: 'array' })
785
+
786
+ const safe = request().safe()
787
+
788
+ safe.only('name', 'email')
789
+ safe.except('tags')
790
+ safe.merge({ role: 'member' }).all()
791
+ safe.collect('tags')
792
+ ```
793
+
794
+ `only()` and `except()` take dotted keys too, `has()` says whether every key given is there, and `input()` reads one
795
+ key, with a default. A validator's `safe()` gives the same, typed from its rules: `(await validator.safe()).only('name')`
796
+ is `{ name: string }`. Called before any `validate()`, `request().safe()` throws.
738
797
 
739
798
  ### The validated data's type
740
799
 
@@ -948,16 +1007,18 @@ word, such as `monday`, for a field's name. A number passes as a timestamp, as i
948
1007
 
949
1008
  #### alpha
950
1009
 
951
- Only the letters `A` to `Z` and `a` to `z`. Laravel's accepts letters of any script unless you write `alpha:ascii`;
952
- Oriel's accepts these letters only.
1010
+ Only letters, of any script, and the marks that go with them (Unicode's `\p{L}` and `\p{M}`): `José`, `Ελλάδα` and
1011
+ `中文` pass, a space or a digit doesn't. `alpha:ascii` accepts only the letters `A` to `Z` and `a` to `z`.
953
1012
 
954
1013
  #### alpha_dash
955
1014
 
956
- Only the letters `A` to `Z` and `a` to `z`, digits, `-` and `_`.
1015
+ Only letters and marks, numbers (Unicode's `\p{N}`), `-` and `_`. `alpha_dash:ascii` accepts only `A` to `Z`, `a` to
1016
+ `z`, `0` to `9`, `-` and `_`.
957
1017
 
958
1018
  #### alpha_num
959
1019
 
960
- Only the letters `A` to `Z` and `a` to `z`, and digits.
1020
+ Only letters and marks, and numbers of any script. `alpha_num:ascii` accepts only `A` to `Z`, `a` to `z` and `0` to
1021
+ `9`.
961
1022
 
962
1023
  #### array
963
1024
 
package/docs/views.md CHANGED
@@ -165,6 +165,7 @@ values.
165
165
  > [!WARNING]
166
166
  > Shared data belongs to the app, not to a request: every request's views see the same values. Share what doesn't
167
167
  > change from one user to the next, and give a view the current user's data with a [view composer](#view-composers).
168
+ > In the `local` environment, `View.share()` inside a request logs a warning that says so.
168
169
 
169
170
  ## View composers
170
171
 
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
 
@@ -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.
@@ -312,7 +330,8 @@ URLs inside your scripts and styles start with it:
312
330
  ASSET_URL=https://cdn.example.com
313
331
  ```
314
332
 
315
- The tags `vite()` writes, and `asset()`, use `app.asset_url`. A new app's `config/app.ts` doesn't have it, so add it:
333
+ The tags `vite()` writes, and `asset()`, use `app.asset_url`, which a new app's `config/app.ts` reads from `ASSET_URL`.
334
+ An app made before 0.1.0-alpha.16 adds the line:
316
335
 
317
336
  ```ts title="config/app.ts"
318
337
  import { env } from '@orieljs/framework'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orieljs/framework",
3
- "version": "0.1.0-alpha.14",
3
+ "version": "0.1.0-alpha.16",
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",
@@ -48,9 +48,7 @@
48
48
  "bcryptjs": "3.0.3",
49
49
  "cron-parser": "5.10.1",
50
50
  "dotenv": "18.0.3",
51
- "ioredis": "6.0.0",
52
51
  "kysely": "0.29.6",
53
- "nodemailer": "10.3.1",
54
52
  "pino": "10.3.1",
55
53
  "pluralize": "8.0.0",
56
54
  "uqr": "0.1.3"
@@ -60,37 +58,39 @@
60
58
  "@aws-sdk/client-s3": "3.1139.0",
61
59
  "@aws-sdk/s3-request-presigner": "3.1139.0",
62
60
  "@vercel/blob": "2.8.2",
63
- "@orieljs/collections": "0.1.0-alpha.14",
64
- "@orieljs/config": "0.1.0-alpha.14",
65
- "@orieljs/auth": "0.1.0-alpha.14",
66
- "@orieljs/cache": "0.1.0-alpha.14",
67
- "@orieljs/bus": "0.1.0-alpha.14",
68
- "@orieljs/console": "0.1.0-alpha.14",
69
- "@orieljs/container": "0.1.0-alpha.14",
70
- "@orieljs/contracts": "0.1.0-alpha.14",
71
- "@orieljs/cookie": "0.1.0-alpha.14",
72
- "@orieljs/database": "0.1.0-alpha.14",
73
- "@orieljs/encryption": "0.1.0-alpha.14",
74
- "@orieljs/events": "0.1.0-alpha.14",
75
- "@orieljs/filesystem": "0.1.0-alpha.14",
76
- "@orieljs/hashing": "0.1.0-alpha.14",
77
- "@orieljs/http": "0.1.0-alpha.14",
78
- "@orieljs/inertia": "0.1.0-alpha.14",
79
- "@orieljs/log": "0.1.0-alpha.14",
80
- "@orieljs/mail": "0.1.0-alpha.14",
81
- "@orieljs/notifications": "0.1.0-alpha.14",
82
- "@orieljs/obfuscate": "0.1.0-alpha.14",
83
- "@orieljs/pipeline": "0.1.0-alpha.14",
84
- "@orieljs/queue": "0.1.0-alpha.14",
85
- "@orieljs/foundation": "0.1.0-alpha.14",
86
- "@orieljs/live": "0.1.0-alpha.14",
87
- "@orieljs/support": "0.1.0-alpha.14",
88
- "@orieljs/routing": "0.1.0-alpha.14",
89
- "@orieljs/session": "0.1.0-alpha.14",
90
- "@orieljs/testing": "0.1.0-alpha.14",
91
- "@orieljs/validation": "0.1.0-alpha.14",
92
- "@orieljs/vercel": "0.1.0-alpha.14",
93
- "@orieljs/view": "0.1.0-alpha.14"
61
+ "ioredis": "6.0.0",
62
+ "nodemailer": "10.3.1",
63
+ "@orieljs/cache": "0.1.0-alpha.16",
64
+ "@orieljs/collections": "0.1.0-alpha.16",
65
+ "@orieljs/console": "0.1.0-alpha.16",
66
+ "@orieljs/config": "0.1.0-alpha.16",
67
+ "@orieljs/container": "0.1.0-alpha.16",
68
+ "@orieljs/contracts": "0.1.0-alpha.16",
69
+ "@orieljs/auth": "0.1.0-alpha.16",
70
+ "@orieljs/database": "0.1.0-alpha.16",
71
+ "@orieljs/cookie": "0.1.0-alpha.16",
72
+ "@orieljs/encryption": "0.1.0-alpha.16",
73
+ "@orieljs/events": "0.1.0-alpha.16",
74
+ "@orieljs/filesystem": "0.1.0-alpha.16",
75
+ "@orieljs/foundation": "0.1.0-alpha.16",
76
+ "@orieljs/bus": "0.1.0-alpha.16",
77
+ "@orieljs/inertia": "0.1.0-alpha.16",
78
+ "@orieljs/hashing": "0.1.0-alpha.16",
79
+ "@orieljs/http": "0.1.0-alpha.16",
80
+ "@orieljs/log": "0.1.0-alpha.16",
81
+ "@orieljs/mail": "0.1.0-alpha.16",
82
+ "@orieljs/notifications": "0.1.0-alpha.16",
83
+ "@orieljs/pipeline": "0.1.0-alpha.16",
84
+ "@orieljs/obfuscate": "0.1.0-alpha.16",
85
+ "@orieljs/queue": "0.1.0-alpha.16",
86
+ "@orieljs/session": "0.1.0-alpha.16",
87
+ "@orieljs/support": "0.1.0-alpha.16",
88
+ "@orieljs/testing": "0.1.0-alpha.16",
89
+ "@orieljs/validation": "0.1.0-alpha.16",
90
+ "@orieljs/view": "0.1.0-alpha.16",
91
+ "@orieljs/vercel": "0.1.0-alpha.16",
92
+ "@orieljs/live": "0.1.0-alpha.16",
93
+ "@orieljs/routing": "0.1.0-alpha.16"
94
94
  },
95
95
  "peerDependencies": {
96
96
  "pg": "^8.23.0",
@@ -98,7 +98,9 @@
98
98
  "better-sqlite3": "^13.0.3",
99
99
  "@aws-sdk/client-s3": "^3.1139.0",
100
100
  "@aws-sdk/s3-request-presigner": "^3.1139.0",
101
- "@vercel/blob": "^2.8.2"
101
+ "@vercel/blob": "^2.8.2",
102
+ "ioredis": "^6.0.0",
103
+ "nodemailer": "^10.3.1"
102
104
  },
103
105
  "peerDependenciesMeta": {
104
106
  "pg": {
@@ -118,6 +120,12 @@
118
120
  },
119
121
  "@vercel/blob": {
120
122
  "optional": true
123
+ },
124
+ "ioredis": {
125
+ "optional": true
126
+ },
127
+ "nodemailer": {
128
+ "optional": true
121
129
  }
122
130
  },
123
131
  "scripts": {