@orieljs/framework 0.1.0-alpha.12 → 0.1.0-alpha.14
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/dist/{chunk-MURTCTRH.js → chunk-4NCMY3ZS.js} +48 -2
- package/dist/chunk-4NCMY3ZS.js.map +1 -0
- package/dist/{chunk-HTJKT2R2.js → chunk-BKA5F3TH.js} +1 -1
- package/dist/{chunk-HTJKT2R2.js.map → chunk-BKA5F3TH.js.map} +1 -1
- package/dist/{chunk-7NA4HALO.js → chunk-UBSIBGXR.js} +236 -54
- package/dist/chunk-UBSIBGXR.js.map +1 -0
- package/dist/{chunk-24673JQF.js → chunk-X4N74JDO.js} +98 -4
- package/dist/chunk-X4N74JDO.js.map +1 -0
- package/dist/contracts.d.ts +11 -1
- package/dist/contracts.js +1 -1
- package/dist/{index.d-WQpfdIbG.d.ts → index.d-lffxurFs.d.ts} +10 -1
- package/dist/index.d.ts +363 -19
- package/dist/index.js +1193 -189
- package/dist/index.js.map +1 -1
- package/dist/{jsx-runtime-6um4Mwfb.d.ts → jsx-runtime-Bc5KJzwb.d.ts} +1 -1
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.js +3 -3
- package/dist/{testing-CKwfWJGn.d.ts → testing-CVpo7aRl.d.ts} +46 -7
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +5 -3
- package/docs/authentication.md +42 -1
- package/docs/console.md +17 -6
- package/docs/database-testing.md +21 -0
- package/docs/database.md +12 -0
- package/docs/deployment.md +33 -6
- package/docs/encryption.md +2 -0
- package/docs/installation.md +2 -1
- package/docs/live-tests.md +20 -0
- package/docs/live.md +22 -0
- package/docs/navigation.json +4 -0
- package/docs/pagination.md +10 -0
- package/docs/routing.md +1 -1
- package/docs/scheduling.md +3 -0
- package/docs/session.md +19 -2
- package/docs/starter-kits.md +4 -0
- package/docs/storage.md +44 -5
- package/docs/testing.md +9 -6
- package/docs/two-factor.md +192 -0
- package/docs/views.md +2 -0
- package/docs/vite.md +1 -1
- package/package.json +56 -38
- package/dist/chunk-24673JQF.js.map +0 -1
- package/dist/chunk-7NA4HALO.js.map +0 -1
- package/dist/chunk-MURTCTRH.js.map +0 -1
package/docs/storage.md
CHANGED
|
@@ -5,9 +5,9 @@ service), through one API.
|
|
|
5
5
|
|
|
6
6
|
## Configuration
|
|
7
7
|
|
|
8
|
-
Your disks are in `config/filesystems.ts`. Each disk names its driver, `local` or `
|
|
9
|
-
names the disk `Storage` uses when you don't name one (`FILESYSTEM_DISK`, else `local`). A new app
|
|
10
|
-
`local`, `public` and `
|
|
8
|
+
Your disks are in `config/filesystems.ts`. Each disk names its driver, `local`, `s3` or `vercel-blob`, and its
|
|
9
|
+
settings; `default` names the disk `Storage` uses when you don't name one (`FILESYSTEM_DISK`, else `local`). A new app
|
|
10
|
+
has four disks: `local`, `public`, `s3` and `blob`.
|
|
11
11
|
|
|
12
12
|
### The local driver
|
|
13
13
|
|
|
@@ -36,10 +36,47 @@ app's `config/filesystems.ts` isn't read yet.
|
|
|
36
36
|
|
|
37
37
|
### The S3 driver
|
|
38
38
|
|
|
39
|
-
The `s3` disk
|
|
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
|
|
|
49
|
+
### The Vercel Blob driver
|
|
50
|
+
|
|
51
|
+
On Vercel, files your app stores need a disk that outlives the function: the `blob` disk keeps them in a
|
|
52
|
+
[Vercel Blob](https://vercel.com/docs/vercel-blob) store. Create a store in your Vercel project's Storage tab and
|
|
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
|
+
> ```
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { Storage } from '@orieljs/framework'
|
|
67
|
+
declare const cover: Uint8Array
|
|
68
|
+
// ---cut---
|
|
69
|
+
await Storage.disk('blob').put('covers/launch.png', cover)
|
|
70
|
+
|
|
71
|
+
const address = Storage.disk('blob').url('covers/launch.png')
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`url()` gives the file's public address in the store, worked out from the token; set `BLOB_URL` to use another one
|
|
75
|
+
(a custom domain). `root` (`BLOB_ROOT`) keeps every path under a folder, so preview deployments can write under
|
|
76
|
+
`preview` and never touch production's files. Blob stores here are public: a `private` disk or file is refused, and
|
|
77
|
+
`temporaryUrl()` returns the public address. A Vercel function accepts request bodies up to 4.5 MB, which limits what
|
|
78
|
+
a form can upload through it.
|
|
79
|
+
|
|
43
80
|
## Obtaining disk instances
|
|
44
81
|
|
|
45
82
|
`Storage` works on the default disk; `Storage.disk(name)` on another:
|
|
@@ -166,7 +203,9 @@ same for folders. `makeDirectory()` creates a folder and `deleteDirectory()` del
|
|
|
166
203
|
## Live uploads
|
|
167
204
|
|
|
168
205
|
A Live component's upload is first stored as a temporary file, under `live-tmp` on your default disk, with a random
|
|
169
|
-
name. Your component's `store()` moves it to its place
|
|
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
|
|
170
209
|
deleted, except on an S3 disk, where listing the folder on every upload would be slow: give the bucket a lifecycle rule
|
|
171
210
|
for `live-tmp` instead. `live.temporary_file_upload.disk` and `directory` choose another place.
|
|
172
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
|
|
48
|
-
|
|
49
|
-
|
|
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,
|
|
132
|
-
>
|
|
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
|
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Two-factor login
|
|
2
|
+
|
|
3
|
+
Ask for a second factor after the password: a 6-digit code sent by email, or one from an authenticator app, with
|
|
4
|
+
one-time recovery codes for when the phone or the mailbox is gone.
|
|
5
|
+
|
|
6
|
+
## Introduction
|
|
7
|
+
|
|
8
|
+
With two-factor login on, a correct password no longer signs the user in. It starts a pending login, kept in the
|
|
9
|
+
session, and your app shows a page that asks for the code. Only the right code (or a recovery code) completes the
|
|
10
|
+
login. This is Laravel Fortify's two-factor login, with an emailed code as well.
|
|
11
|
+
|
|
12
|
+
Each user has a method:
|
|
13
|
+
|
|
14
|
+
- **Email**, the default: a code is mailed to the user when their password is accepted. It needs no setup, so every
|
|
15
|
+
user has it from the start.
|
|
16
|
+
- **Authenticator app**: the user scans a QR code with an app such as Google Authenticator or 1Password and confirms
|
|
17
|
+
it with one code; from then on, the app's code is asked for.
|
|
18
|
+
|
|
19
|
+
The starter kits don't have two-factor pages yet: you add the routes and pages your app needs, as below.
|
|
20
|
+
|
|
21
|
+
## Turning it on
|
|
22
|
+
|
|
23
|
+
Add the four columns two-factor login keeps on `users`, then turn it on in `config/auth.ts`:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
node oriel two-factor:install
|
|
27
|
+
node oriel migrate
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```ts title="config/auth.ts"
|
|
31
|
+
import { User } from '../app/Models/User'
|
|
32
|
+
// ---cut---
|
|
33
|
+
export default {
|
|
34
|
+
defaults: { guard: 'web', passwords: 'users' },
|
|
35
|
+
guards: { web: { driver: 'session', provider: 'users' } },
|
|
36
|
+
providers: { users: { driver: 'eloquent', model: User } },
|
|
37
|
+
two_factor: { enabled: true },
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`two_factor` takes these settings, each with its default:
|
|
42
|
+
|
|
43
|
+
| Setting | Default | |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| `enabled` | `false` | Ask for a second factor after the password |
|
|
46
|
+
| `methods` | `['email', 'app']` | The methods users may use (see below) |
|
|
47
|
+
| `default` | `'email'` | The method a user has until they set up another |
|
|
48
|
+
| `code_ttl` | `600` | Seconds an emailed code works |
|
|
49
|
+
| `pending_ttl` | `600` | Seconds a pending login waits for its code |
|
|
50
|
+
| `max_attempts` | `5` | Wrong codes a pending login allows; then the user signs in again |
|
|
51
|
+
| `resend_after` | `30` | Seconds before another email code may be sent |
|
|
52
|
+
| `window` | `1` | Authenticator steps (30 seconds each) of clock drift accepted either way |
|
|
53
|
+
| `recovery_codes` | `8` | How many recovery codes a user gets |
|
|
54
|
+
| `issuer` | `app.name` | The name authenticator apps show |
|
|
55
|
+
|
|
56
|
+
A user is asked only by a method open to them: email, or an app they have set up. With `methods: ['app']`, a user who
|
|
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
|
+
user's choice. Keep `'email'` in `methods` to ask every user for a second factor.
|
|
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).
|
|
62
|
+
|
|
63
|
+
## Signing in
|
|
64
|
+
|
|
65
|
+
Your login controller calls `TwoFactor.attempt()` instead of `Auth.attempt()`. It has three outcomes: `'authenticated'`
|
|
66
|
+
(the user is signed in: two-factor is off, or not asked of this user), `'challenge'` (the password was right and the
|
|
67
|
+
code is asked for), and `false` (wrong credentials):
|
|
68
|
+
|
|
69
|
+
```ts title="app/Http/Controllers/LoginController.ts"
|
|
70
|
+
import { back, redirect, request, TwoFactor } from '@orieljs/framework'
|
|
71
|
+
import { Controller } from './Controller'
|
|
72
|
+
|
|
73
|
+
export class LoginController extends Controller {
|
|
74
|
+
async authenticate() {
|
|
75
|
+
const credentials = await request().validate({ email: 'required|email', password: 'required' })
|
|
76
|
+
|
|
77
|
+
const result = await TwoFactor.attempt(credentials, request().boolean('remember'))
|
|
78
|
+
if (result === 'challenge') return redirect('/two-factor-challenge')
|
|
79
|
+
if (result === 'authenticated') {
|
|
80
|
+
await request().session().regenerate()
|
|
81
|
+
return redirect().intended('dashboard')
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return back().withErrors({ email: 'The provided credentials do not match our records.' }).withInput(request().only('email'))
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## The challenge page
|
|
90
|
+
|
|
91
|
+
The challenge page's routes take the `two-factor.challenge` middleware: only a login waiting for its code reaches them,
|
|
92
|
+
and anyone else is sent to log in.
|
|
93
|
+
|
|
94
|
+
```ts title="routes/web.ts"
|
|
95
|
+
import { back, redirect, request, Route, TwoFactor, view } from '@orieljs/framework'
|
|
96
|
+
|
|
97
|
+
Route.middleware('two-factor.challenge').group(() => {
|
|
98
|
+
Route.get('/two-factor-challenge', async () => view('auth.two-factor', { challenge: await TwoFactor.challenge() }))
|
|
99
|
+
|
|
100
|
+
Route.post('/two-factor-challenge', async () => {
|
|
101
|
+
if (await TwoFactor.verify(String(request().input('code', '')))) {
|
|
102
|
+
await request().session().regenerate()
|
|
103
|
+
return redirect().intended('dashboard')
|
|
104
|
+
}
|
|
105
|
+
return back().withErrors({ code: 'That code is not right.' })
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
Route.post('/two-factor-challenge/email', async () => {
|
|
109
|
+
await TwoFactor.useMethod('email')
|
|
110
|
+
return back()
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
Route.post('/two-factor-challenge/resend', async () => {
|
|
114
|
+
return back().with('status', (await TwoFactor.resend()) ? 'We sent you a new code.' : 'Wait a moment before asking again.')
|
|
115
|
+
})
|
|
116
|
+
})
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`TwoFactor.challenge()` gives the page what to say: the method asked for, the other methods the user has (`methods`),
|
|
120
|
+
and where an emailed code went, masked (`a***@example.com`). `verify()` takes the 6-digit code for that method, or a
|
|
121
|
+
recovery code, read leniently: spaces, dashes and capitals don't matter. A code works once; five wrong codes end the
|
|
122
|
+
pending login, and the user signs in again.
|
|
123
|
+
|
|
124
|
+
The emailed code is the `TwoFactorCode` notification, sent with your mailer, so on Vercel your app needs a mail service
|
|
125
|
+
over SMTP. `TwoFactorCode.toMailUsing()` lets you write the mail yourself:
|
|
126
|
+
|
|
127
|
+
```ts title="app/Providers/AppServiceProvider.ts"
|
|
128
|
+
import { MailMessage, TwoFactorCode } from '@orieljs/framework'
|
|
129
|
+
// ---cut---
|
|
130
|
+
TwoFactorCode.toMailUsing((_user, code, minutes) =>
|
|
131
|
+
new MailMessage().subject('Your sign-in code').line(`Your code is ${code}.`).line(`It works for ${minutes} minutes.`),
|
|
132
|
+
)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Setting up an authenticator app
|
|
136
|
+
|
|
137
|
+
On an account page, a signed-in user sets up their app in two steps: show the QR code, then confirm with a code from
|
|
138
|
+
the app. Until it is confirmed, the app doesn't count, and the user is still asked by email:
|
|
139
|
+
|
|
140
|
+
```ts title="routes/web.ts"
|
|
141
|
+
import { back, request, Route, TwoFactor, view } from '@orieljs/framework'
|
|
142
|
+
import type { User } from '../app/Models/User'
|
|
143
|
+
// ---cut---
|
|
144
|
+
Route.middleware('auth').group(() => {
|
|
145
|
+
Route.post('/account/two-factor/app', async () => {
|
|
146
|
+
const user = (await request().user<User>())!
|
|
147
|
+
// A form sent again after the app is set up: enableApp() would refuse.
|
|
148
|
+
if (TwoFactor.hasApp(user)) return back().with('status', 'Your app is set up already.')
|
|
149
|
+
const { svg, secret } = await TwoFactor.enableApp(user)
|
|
150
|
+
return view('account.two-factor-app', { svg, secret })
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
Route.post('/account/two-factor/app/confirm', async () => {
|
|
154
|
+
const confirmed = await TwoFactor.confirmApp((await request().user<User>())!, String(request().input('code', '')))
|
|
155
|
+
return confirmed ? back().with('status', 'Your app is set up.') : back().withErrors({ code: 'That code is not right.' })
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`enableApp()` returns the secret (for typing in by hand), its `otpauth://` URL and the QR code as an SVG image.
|
|
161
|
+
`confirmApp()` makes the app the user's method and gives them recovery codes. `disableApp()` removes it, and
|
|
162
|
+
`setMethod()` lets a user who has both choose which is asked for.
|
|
163
|
+
|
|
164
|
+
`TwoFactor.hasApp(user)` says whether the user's app works, so a page can offer to set one up or to remove it. `enableApp()`
|
|
165
|
+
on a working app throws `TwoFactorAppAlreadyEnabledError`, since a new secret would silently stop the old app's codes: call
|
|
166
|
+
`disableApp(user)` first. Before the app is confirmed, calling `enableApp()` again just replaces the secret.
|
|
167
|
+
|
|
168
|
+
In a test, `totpCode(secret, Date.now())` from `@orieljs/framework` gives the code the app would show.
|
|
169
|
+
|
|
170
|
+
## Recovery codes
|
|
171
|
+
|
|
172
|
+
`TwoFactor.recoveryCodes(user)` returns the user's codes, making them on first ask; show them once and ask the user to
|
|
173
|
+
keep them somewhere safe. Each works once, in place of a code. `regenerateRecoveryCodes(user)` makes new ones, and the
|
|
174
|
+
old ones stop working.
|
|
175
|
+
|
|
176
|
+
## Choosing who is asked
|
|
177
|
+
|
|
178
|
+
By default every user is asked for a second factor once two-factor is on. `requireWhen()` narrows it, for instance to
|
|
179
|
+
admins:
|
|
180
|
+
|
|
181
|
+
```ts title="app/Providers/AppServiceProvider.ts"
|
|
182
|
+
import { TwoFactor } from '@orieljs/framework'
|
|
183
|
+
import type { User } from '../Models/User'
|
|
184
|
+
// ---cut---
|
|
185
|
+
TwoFactor.requireWhen((user) => (user as User).getAttribute('is_admin') === true)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Events
|
|
189
|
+
|
|
190
|
+
`TwoFactorChallenged` (the code was asked for), `TwoFactorFailed` (a wrong code), `TwoFactorAuthenticated` (the user is
|
|
191
|
+
signed in), `RecoveryCodeUsed`, `TwoFactorAppEnabled` and `TwoFactorAppDisabled`, each with the user. The password step
|
|
192
|
+
fires `Attempting` and `Failed`, as `Auth.attempt()` does, and the login fires `Login`.
|
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
|
@@ -221,7 +221,7 @@ Vue's `computed()` and `ref()`, Svelte's `$derived` and Solid's `createMemo()` c
|
|
|
221
221
|
like `buttonClass` or `classes` holds classes wherever it's used.
|
|
222
222
|
|
|
223
223
|
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
|
|
224
|
+
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
225
|
stay as Vite wrote them. `dark` is never renamed: the kits' appearance script sets it before the page draws.
|
|
226
226
|
|
|
227
227
|
### Classes the build can't rename
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orieljs/framework",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.14",
|
|
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,55 +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
48
|
"bcryptjs": "3.0.3",
|
|
51
|
-
"better-sqlite3": "13.0.3",
|
|
52
49
|
"cron-parser": "5.10.1",
|
|
53
50
|
"dotenv": "18.0.3",
|
|
54
51
|
"ioredis": "6.0.0",
|
|
55
52
|
"kysely": "0.29.6",
|
|
56
|
-
"nodemailer": "10.
|
|
53
|
+
"nodemailer": "10.3.1",
|
|
57
54
|
"pino": "10.3.1",
|
|
58
|
-
"pluralize": "8.0.0"
|
|
55
|
+
"pluralize": "8.0.0",
|
|
56
|
+
"uqr": "0.1.3"
|
|
59
57
|
},
|
|
60
58
|
"devDependencies": {
|
|
61
|
-
"
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"@orieljs/
|
|
66
|
-
"@orieljs/
|
|
67
|
-
"@orieljs/
|
|
68
|
-
"@orieljs/
|
|
69
|
-
"@orieljs/
|
|
70
|
-
"@orieljs/
|
|
71
|
-
"@orieljs/
|
|
72
|
-
"@orieljs/
|
|
73
|
-
"@orieljs/
|
|
74
|
-
"@orieljs/
|
|
75
|
-
"@orieljs/
|
|
76
|
-
"@orieljs/
|
|
77
|
-
"@orieljs/
|
|
78
|
-
"@orieljs/
|
|
79
|
-
"@orieljs/
|
|
80
|
-
"@orieljs/
|
|
81
|
-
"@orieljs/
|
|
82
|
-
"@orieljs/
|
|
83
|
-
"@orieljs/
|
|
84
|
-
"@orieljs/
|
|
85
|
-
"@orieljs/
|
|
86
|
-
"@orieljs/
|
|
87
|
-
"@orieljs/
|
|
88
|
-
"@orieljs/
|
|
89
|
-
"@orieljs/
|
|
90
|
-
"@orieljs/
|
|
91
|
-
"@orieljs/session": "0.1.0-alpha.
|
|
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.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"
|
|
92
94
|
},
|
|
93
95
|
"peerDependencies": {
|
|
94
96
|
"pg": "^8.23.0",
|
|
95
|
-
"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"
|
|
96
102
|
},
|
|
97
103
|
"peerDependenciesMeta": {
|
|
98
104
|
"pg": {
|
|
@@ -100,6 +106,18 @@
|
|
|
100
106
|
},
|
|
101
107
|
"mysql2": {
|
|
102
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
|
|
103
121
|
}
|
|
104
122
|
},
|
|
105
123
|
"scripts": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../View/Element.ts","../../View/jsx-runtime.ts","../../View/Html.ts","../../View/errors.ts","../../View/attributes.ts","../../View/render.ts","../../View/FileViewFinder.ts","../../View/TsxView.ts","../../View/Factory.ts","../../View/helpers.ts","../../View/facade.ts","../../View/ViewServiceProvider.ts"],"sourcesContent":["import type { Htmlable } from '@orieljs/contracts'\n\n/** Marks the objects jsx() returns (Symbol.for, so two copies of the package agree). */\nexport const ELEMENT: unique symbol = Symbol.for('oriel:view.element')\n\nexport type Props = Record<string, unknown>\n\n/** Anything that can appear as a child: text is escaped, Htmlable is emitted as-is, promises are awaited. */\nexport type Renderable =\n | OrielElement\n | string\n | number\n | bigint\n | boolean\n | null\n | undefined\n | Htmlable\n | Promise<Renderable>\n | Iterable<Renderable>\n\n/** A function component. It may be async: the renderer awaits it. */\nexport type Component<P = Props> = (props: P) => Renderable | Promise<Renderable>\n\n/**\n * `<>…</>` and `<Fragment>`: renders its children only. A symbol at runtime; typed as a component so that\n * `<Fragment>` type-checks as a JSX tag.\n */\nexport const Fragment = Symbol.for('oriel:view.fragment') as unknown as (props: { children?: Renderable }) => Renderable\n\nexport type ElementType = string | Component<never>\n\n/** What `<div />` evaluates to: an inert description, rendered later by renderToString()/renderToStream(). */\nexport interface OrielElement {\n readonly [ELEMENT]: true\n readonly type: ElementType\n readonly props: Props\n readonly key: string | number | undefined\n}\n\nexport function createElement(type: ElementType, props: Props | null | undefined, key?: string | number): OrielElement {\n return { [ELEMENT]: true, type, props: props ?? {}, key }\n}\n\nexport function isElement(value: unknown): value is OrielElement {\n return typeof value === 'object' && value !== null && (value as Record<symbol, unknown>)[ELEMENT] === true\n}\n","/**\n * The automatic JSX runtime (`jsxImportSource: \"@orieljs/view\"`). jsx() only describes elements; rendering\n * (escaping, async components) happens in renderToString()/renderToStream().\n */\nimport type { ClassValue, StyleObject } from './attributes'\nimport type { LiveDirectiveAttributes, LiveEventAttributes, OtherAttributes } from './directives'\nimport { createElement, Fragment, type Component, type ElementType, type OrielElement, type Props, type Renderable } from './Element'\n\nexport { Fragment }\n\nexport function jsx(type: ElementType, props: Props | null, key?: string | number): OrielElement {\n return createElement(type, props, key)\n}\n\n/** Same as jsx(); the compiler uses it when there are several static children. */\nexport const jsxs = jsx\n\n/**\n * Attributes every intrinsic element accepts. Any attribute is allowed (hx-*, x-*, data-*, …) except an `o:` name\n * that isn't a Live directive or `o:<event>` (directives.ts), so a typo such as `o:clik` doesn't compile. An `o:` form\n * with a `-` that the type doesn't list compiles unchecked (TypeScript doesn't check a hyphenated JSX name the type\n * leaves out), and a custom event name is spread: `<div {...{ 'o:saved': 'refresh' }} />`.\n */\nexport interface HtmlAttributes extends OtherAttributes, LiveDirectiveAttributes, LiveEventAttributes {\n children?: Renderable\n class?: ClassValue\n className?: ClassValue\n style?: string | StyleObject\n dangerouslySetInnerHTML?: { __html: string }\n}\n\nexport declare namespace JSX {\n type Element = OrielElement\n /** Lets components be async: `async function Posts() { … }` is a valid element type. */\n type ElementType = string | Component<never>\n interface ElementChildrenAttribute {\n children: unknown\n }\n interface IntrinsicAttributes {\n key?: string | number\n }\n interface IntrinsicElements {\n [element: string]: HtmlAttributes\n }\n}\n","import type { Htmlable } from '@orieljs/contracts'\n\nconst ESCAPES: Record<string, string> = { '&': '&', '<': '<', '>': '>', '\"': '"', \"'\": ''' }\nconst UNSAFE = /[&<>\"']/g\n\n/** Markup that must not be escaped again (Laravel's Illuminate\\Support\\HtmlString). */\nexport class HtmlString implements Htmlable {\n constructor(private readonly html: string = '') {}\n\n toHtml(): string {\n return this.html\n }\n\n toString(): string {\n return this.html\n }\n\n isEmpty(): boolean {\n return this.html === ''\n }\n}\n\n/** Marks trusted markup so the renderer emits it unescaped: {raw(markdownHtml)}. Never pass user input. */\nexport function raw(html: string): HtmlString {\n return new HtmlString(html)\n}\n\nexport function isHtmlable(value: unknown): value is Htmlable {\n return typeof value === 'object' && value !== null && typeof (value as Htmlable).toHtml === 'function'\n}\n\n/** Laravel's e(): htmlspecialchars(ENT_QUOTES, double-encode). Htmlable values pass through; null is ''. */\nexport function e(value: unknown): string {\n if (value === null || value === undefined) return ''\n if (isHtmlable(value)) return value.toHtml()\n return String(value).replace(UNSAFE, (char) => ESCAPES[char]!)\n}\n","import type { ErrorKind, OrielError } from '@orieljs/contracts'\n\n/**\n * Programmer errors (Laravel throws InvalidArgumentException for these). Not an HTTP condition, so kind 'Server':\n * the exception handler reports them and renders a 500 whose message is hidden unless app.debug is on.\n */\nexport class ViewRenderError extends Error implements OrielError {\n override readonly name: string = 'ViewRenderError'\n readonly kind: ErrorKind = 'Server'\n readonly status = 500\n}\n\n/** Laravel's \"View [x] not found.\" (InvalidArgumentException). */\nexport class ViewNotFoundError extends Error implements OrielError {\n override readonly name: string = 'ViewNotFoundError'\n readonly kind: ErrorKind = 'Server'\n readonly status = 500\n constructor(readonly view: string, readonly searched: string[] = []) {\n super(`View [${view}] not found.`)\n }\n}\n\n/** A view file that doesn't default-export a component. */\nexport class InvalidViewError extends Error implements OrielError {\n override readonly name: string = 'InvalidViewError'\n readonly kind: ErrorKind = 'Server'\n readonly status = 500\n}\n","import { e, isHtmlable } from './Html'\nimport { ViewRenderError } from './errors'\n\n/** Props that are never attributes. */\nconst SKIPPED = new Set(['children', 'dangerouslySetInnerHTML', 'key', 'ref'])\n/** React-style prop names that map to a different HTML attribute. */\nconst RENAMED: Record<string, string> = { className: 'class', htmlFor: 'for' }\n/** HTML attribute names: no whitespace, quotes, `<`, `>`, `/`, `=` or control characters (WHATWG). */\nconst VALID_NAME = /^[^\\s\"'<>/=\\u0000-\\u001f\\u007f]+$/\n/** CSS properties whose numbers get no `px` (React's list, trimmed to what HTML pages use). */\nconst UNITLESS = new Set([\n 'animation-iteration-count', 'aspect-ratio', 'border-image-outset', 'border-image-slice', 'border-image-width',\n 'column-count', 'columns', 'fill-opacity', 'flex', 'flex-grow', 'flex-shrink', 'flex-order', 'font-weight',\n 'grid-area', 'grid-column', 'grid-column-end', 'grid-column-start', 'grid-row', 'grid-row-end', 'grid-row-start',\n 'line-clamp', 'line-height', 'opacity', 'order', 'orphans', 'scale', 'stop-opacity', 'stroke-dashoffset',\n 'stroke-opacity', 'stroke-width', 'tab-size', 'widows', 'z-index', 'zoom',\n])\n\nexport type ClassValue = string | number | null | undefined | false | ClassValue[] | Record<string, unknown>\nexport type StyleObject = Record<string, string | number | null | undefined | false>\n\n/** `class` accepts strings, arrays and `{ name: condition }` objects, like Blade's @class. */\nexport function classNames(value: ClassValue): string {\n if (value === null || value === undefined || value === false || value === '') return ''\n if (typeof value === 'string' || typeof value === 'number') return String(value).trim()\n if (Array.isArray(value)) return value.map(classNames).filter((name) => name !== '').join(' ')\n return Object.entries(value).filter(([, on]) => Boolean(on)).map(([name]) => name).join(' ')\n}\n\nconst kebab = (property: string) =>\n property.startsWith('--') ? property : property.replace(/^ms([A-Z])/, '-ms-$1').replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)\n\n/** `{ marginTop: 4, '--gap': '1rem' }` → `margin-top:4px;--gap:1rem`. */\nexport function styleString(style: StyleObject): string {\n const parts: string[] = []\n for (const [property, value] of Object.entries(style)) {\n if (value === null || value === undefined || value === false || value === '') continue\n const name = kebab(property)\n const text = typeof value === 'number' && value !== 0 && !UNITLESS.has(name) && !name.startsWith('--') ? `${value}px` : String(value)\n parts.push(`${name}:${text}`)\n }\n return parts.join(';')\n}\n\nexport function assertValidName(name: string, what: 'attribute' | 'tag'): void {\n if (!VALID_NAME.test(name)) throw new ViewRenderError(`Invalid ${what} name [${name}].`)\n}\n\n/** Serializes props to ` name=\"value\"` pairs. Every value is escaped (HtmlString too); names are validated, never escaped. */\nexport function renderAttributes(props: Record<string, unknown>): string {\n let out = ''\n let classes = ''\n for (const [prop, value] of Object.entries(props)) {\n if (SKIPPED.has(prop)) continue\n if (value === undefined || value === null) continue\n if (typeof value === 'function' || typeof value === 'symbol') continue // event handlers do nothing on the server\n const name = RENAMED[prop] ?? prop\n assertValidName(name, 'attribute')\n // aria-*/data-* are string attributes: booleans are written out, like React.\n if (typeof value === 'boolean' && (name.startsWith('aria-') || name.startsWith('data-'))) {\n out += ` ${name}=\"${value}\"`\n continue\n }\n if (value === false) continue\n if (name === 'class') {\n const joined = classNames(value as ClassValue)\n classes = classes === '' ? joined : joined === '' ? classes : `${classes} ${joined}`\n continue\n }\n // Boolean attributes (disabled, checked, …) are present or absent.\n if (value === true) {\n out += ` ${name}`\n continue\n }\n const text = name === 'style' && typeof value === 'object' ? styleString(value as StyleObject) : attributeText(value)\n out += ` ${name}=\"${e(text)}\"`\n }\n return classes === '' ? out : ` class=\"${e(classes)}\"${out}`\n}\n\n/** Attribute values are text: objects become JSON (x-data, data-*), Htmlable its markup; the caller escapes all of it. */\nfunction attributeText(value: unknown): string {\n if (typeof value !== 'object' || value === null) return String(value)\n if (isHtmlable(value)) return value.toHtml()\n if (value instanceof Date) return value.toISOString()\n return JSON.stringify(value)\n}\n","import { Fragment, isElement, type OrielElement, type Renderable } from './Element'\nimport { e, isHtmlable } from './Html'\nimport { assertValidName, renderAttributes } from './attributes'\nimport { ViewRenderError } from './errors'\n\n/** Elements that never have children or a closing tag. */\nconst VOID = new Set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'source', 'track', 'wbr'])\n\n/** Where rendered HTML goes. flush() is called before every await, so a stream sends what is ready. */\ninterface Sink {\n write(html: string): void\n flush(): void\n}\n\ninterface Renderer {\n render(): Promise<string>\n}\n\nconst isThenable = (value: unknown): value is PromiseLike<unknown> =>\n typeof value === 'object' && value !== null && typeof (value as PromiseLike<unknown>).then === 'function'\n\n/** A View (or anything with an async render() and toHtml()) used as a child, like Blade's @include. */\nconst isRenderer = (value: object): value is Renderer =>\n typeof (value as Partial<Renderer>).render === 'function' && isHtmlable(value)\n\nasync function write(node: Renderable, sink: Sink): Promise<void> {\n if (node === null || node === undefined || typeof node === 'boolean') return\n if (typeof node === 'string') return sink.write(e(node))\n if (typeof node === 'number' || typeof node === 'bigint') return sink.write(String(node))\n if (isElement(node)) return writeElement(node, sink)\n if (isThenable(node)) {\n sink.flush()\n const resolved: unknown = await (node as PromiseLike<unknown>)\n return write(resolved as Renderable, sink)\n }\n if (isRenderer(node)) {\n sink.flush()\n return sink.write(await node.render())\n }\n if (isHtmlable(node)) return sink.write(node.toHtml())\n if (typeof (node as Iterable<Renderable>)[Symbol.iterator] === 'function') {\n for (const child of node as Iterable<Renderable>) await write(child, sink)\n return\n }\n throw new ViewRenderError(`Objects are not valid as a child (found: object with keys {${Object.keys(node).join(', ')}}).`)\n}\n\nasync function writeElement(element: OrielElement, sink: Sink): Promise<void> {\n const { type, props } = element\n if (type === Fragment) return write(props.children as Renderable, sink)\n if (typeof type === 'function') {\n const result = (type as (props: unknown) => unknown)(props)\n if (isThenable(result)) sink.flush()\n const resolved: unknown = await result\n return write(resolved as Renderable, sink)\n }\n if (typeof type !== 'string') throw new ViewRenderError(`Invalid element type [${String(type)}].`)\n assertValidName(type, 'tag')\n\n const inner = props.dangerouslySetInnerHTML as { __html?: unknown } | undefined\n const hasChildren = props.children !== undefined && props.children !== null\n if (inner !== undefined && hasChildren) {\n throw new ViewRenderError(`<${type}> can't have both children and dangerouslySetInnerHTML.`)\n }\n // A document root gets its doctype: TSX has no syntax for <!DOCTYPE html>.\n if (type === 'html') sink.write('<!DOCTYPE html>')\n sink.write(`<${type}${renderAttributes(props)}>`)\n if (VOID.has(type.toLowerCase())) {\n if (hasChildren || inner !== undefined) throw new ViewRenderError(`<${type}> is a void element and can't have children.`)\n return\n }\n if (inner !== undefined) sink.write(String(inner.__html ?? ''))\n else await write(props.children as Renderable, sink)\n sink.write(`</${type}>`)\n}\n\n/** Renders JSX (or any Renderable) to an HTML string. Async components and promises are awaited in order. */\nexport async function renderToString(node: Renderable): Promise<string> {\n const parts: string[] = []\n await write(node, { write: (html) => void parts.push(html), flush: () => {} })\n return parts.join('')\n}\n\n/** Renders to a UTF-8 byte stream, sending everything rendered so far each time rendering waits on a promise. */\nexport function renderToStream(node: Renderable): ReadableStream<Uint8Array> {\n const encoder = new TextEncoder()\n return new ReadableStream<Uint8Array>({\n async start(controller) {\n let buffer = ''\n const sink: Sink = {\n write: (html) => void (buffer += html),\n flush: () => {\n if (buffer === '') return\n controller.enqueue(encoder.encode(buffer))\n buffer = ''\n },\n }\n try {\n await write(node, sink)\n sink.flush()\n controller.close()\n } catch (error) {\n controller.error(error)\n }\n },\n })\n}\n","import { existsSync } from 'node:fs'\nimport { isAbsolute, join, resolve } from 'node:path'\nimport { ViewNotFoundError } from './errors'\n\n/** `mail::message` → namespace `mail`, view `message` (Laravel's hint path delimiter). */\nconst HINT = '::'\n\n/**\n * Laravel's FileViewFinder: 'posts.index' → <location>/posts/index.<ext> for the first location and extension\n * that exist. Found paths are cached; misses are not, so a view created later is found.\n */\nexport class FileViewFinder {\n static readonly defaultExtensions = ['tsx', 'ts', 'jsx', 'js', 'mjs']\n\n private readonly locations: string[]\n private readonly hints = new Map<string, string[]>()\n private readonly views = new Map<string, string>()\n\n constructor(paths: string[], private readonly extensions: string[] = FileViewFinder.defaultExtensions) {\n this.locations = paths.map((path) => resolve(path))\n }\n\n /** The absolute path of the view file. Throws ViewNotFoundError. */\n find(name: string): string {\n const cached = this.views.get(name)\n if (cached !== undefined) return cached\n const [locations, view] = this.parse(name)\n const searched: string[] = []\n for (const location of locations) {\n for (const extension of this.extensions) {\n const file = join(location, `${view}.${extension}`)\n searched.push(file)\n if (existsSync(file)) {\n this.views.set(name, file)\n return file\n }\n }\n }\n throw new ViewNotFoundError(name, searched)\n }\n\n addLocation(path: string): void {\n this.locations.push(resolve(path))\n }\n\n prependLocation(path: string): void {\n this.locations.unshift(resolve(path))\n }\n\n /** Views under a namespace: addNamespace('mail', dir) makes 'mail::message' resolve to <dir>/message.tsx. */\n addNamespace(namespace: string, hints: string | string[]): void {\n const existing = this.hints.get(namespace) ?? []\n this.hints.set(namespace, [...existing, ...[hints].flat().map((path) => resolve(path))])\n }\n\n replaceNamespace(namespace: string, hints: string | string[]): void {\n this.hints.set(namespace, [hints].flat().map((path) => resolve(path)))\n this.flush()\n }\n\n getPaths(): string[] {\n return [...this.locations]\n }\n\n getHints(): Record<string, string[]> {\n return Object.fromEntries(this.hints)\n }\n\n /** Forget cached lookups. */\n flush(): void {\n this.views.clear()\n }\n\n /** [locations to search, relative file stem]. Dots become directories, so '..' can't climb out of a location. */\n private parse(name: string): [string[], string] {\n let locations = this.locations\n let view = name\n const at = name.indexOf(HINT)\n if (at !== -1) {\n const namespace = name.slice(0, at)\n view = name.slice(at + HINT.length)\n const hints = this.hints.get(namespace)\n if (hints === undefined) throw new ViewNotFoundError(name)\n locations = hints\n }\n const stem = view.replaceAll('.', '/')\n if (view === '' || stem.includes('\\0') || isAbsolute(stem) || stem.split(/[\\\\/]/).some((segment) => segment === '')) {\n throw new ViewNotFoundError(name)\n }\n return [locations, stem]\n }\n}\n","import type { View } from '@orieljs/contracts'\nimport { createElement, type Component } from './Element'\nimport { ViewRenderError } from './errors'\nimport { renderToString } from './render'\n\n/** What TsxView needs from its factory. */\nexport interface ViewEnvironment {\n getShared(): Record<string, unknown>\n callComposer(view: View): Promise<void>\n load(path: string, name: string): Promise<Component>\n}\n\n/**\n * One view: its name, file and data. render() runs the composers, imports the file and renders its default\n * export with { ...shared, ...data } as props. toHtml() returns the HTML of the last render().\n */\nexport class TsxView implements View {\n private data: Record<string, unknown>\n private html: string | undefined\n\n constructor(\n private readonly environment: ViewEnvironment,\n readonly name: string,\n readonly path: string,\n data: Record<string, unknown> = {},\n ) {\n this.data = { ...data }\n }\n\n with(key: string | Record<string, unknown>, value?: unknown): this {\n if (typeof key === 'string') this.data[key] = value\n else Object.assign(this.data, key)\n return this\n }\n\n /** The view's own data (Laravel's getData()). */\n getData(): Record<string, unknown> {\n return { ...this.data }\n }\n\n /** Shared data overlaid with the view's data: exactly the props the component receives. */\n gatherData(): Record<string, unknown> {\n return { ...this.environment.getShared(), ...this.data }\n }\n\n async render(): Promise<string> {\n await this.environment.callComposer(this)\n const component = await this.environment.load(this.path, this.name)\n this.html = await renderToString(createElement(component as Component<never>, this.gatherData()))\n return this.html\n }\n\n toHtml(): string {\n if (this.html === undefined) {\n throw new ViewRenderError(`View [${this.name}] has not been rendered: await view.render() before toHtml().`)\n }\n return this.html\n }\n}\n","import { pathToFileURL } from 'node:url'\nimport type { View, ViewFactory } from '@orieljs/contracts'\nimport { Str } from '@orieljs/support'\nimport type { Component, Renderable } from './Element'\nimport { InvalidViewError, ViewNotFoundError } from './errors'\nimport type { FileViewFinder } from './FileViewFinder'\nimport { renderToString } from './render'\nimport { TsxView, type ViewEnvironment } from './TsxView'\n\ntype Composer = (view: View) => void | Promise<void>\n\n/** Laravel's view Factory: finds views by dotted name, shares data app-wide and runs view composers. */\nexport class Factory implements ViewFactory, ViewEnvironment {\n private readonly shared: Record<string, unknown> = {}\n private readonly composers: Array<{ patterns: string[]; composer: Composer }> = []\n\n constructor(private readonly finder: FileViewFinder) {}\n\n /** Throws ViewNotFoundError (\"View [x] not found.\") when no file matches. */\n make(name: string, data: Record<string, unknown> = {}): TsxView {\n return new TsxView(this, name, this.finder.find(name), data)\n }\n\n /** The first view that exists (Laravel's View::first()). */\n first(names: string[], data: Record<string, unknown> = {}): TsxView {\n const name = names.find((candidate) => this.exists(candidate))\n if (name === undefined) throw new ViewNotFoundError(names.join(', '))\n return this.make(name, data)\n }\n\n exists(name: string): boolean {\n try {\n this.finder.find(name)\n return true\n } catch (error) {\n if (error instanceof ViewNotFoundError) return false\n throw error\n }\n }\n\n /** App-wide data every view receives as props (view data wins on conflicts). */\n share(key: string | Record<string, unknown>, value?: unknown): void {\n if (typeof key === 'string') this.shared[key] = value\n else Object.assign(this.shared, key)\n }\n\n getShared(): Record<string, unknown> {\n return { ...this.shared }\n }\n\n /** Runs before matching views render. Patterns use `*` wildcards: 'posts.*', '*'. */\n composer(views: string | string[], composer: Composer): void {\n this.composers.push({ patterns: [views].flat(), composer })\n }\n\n async callComposer(view: View): Promise<void> {\n for (const { patterns, composer } of this.composers) {\n if (patterns.some((pattern) => Str.is(pattern, view.name))) await composer(view)\n }\n }\n\n /** Renders TSX, a string, an Htmlable or a View (or promises of them) to HTML, like Laravel's Blade::render(). */\n renderToString(node: unknown): Promise<string> {\n return renderToString(node as Renderable)\n }\n\n /** Imports the view file (Node's module cache keeps it) and returns its default-export component. */\n async load(path: string, name: string): Promise<Component> {\n const module = (await import(pathToFileURL(path).href)) as { default?: unknown }\n if (typeof module.default !== 'function') {\n throw new InvalidViewError(`View [${name}] (${path}) must default-export a component function.`)\n }\n return module.default as Component\n }\n\n addLocation(path: string): void {\n this.finder.addLocation(path)\n }\n\n addNamespace(namespace: string, hints: string | string[]): this {\n this.finder.addNamespace(namespace, hints)\n return this\n }\n\n getFinder(): FileViewFinder {\n return this.finder\n }\n}\n","import { Session, ViewFactory, type View } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\nimport { e, HtmlString } from './Html'\n\n/** view() → the ViewFactory; view('posts.index', data) → a View to return from a route or render. */\nexport function view(): ViewFactory\nexport function view(name: string, data?: Record<string, unknown>): View\nexport function view(name?: string, data: Record<string, unknown> = {}): ViewFactory | View {\n const factory = inject(ViewFactory)\n return name === undefined ? factory : factory.make(name, data)\n}\n\n/** Blade's @csrf / csrf_field(): the hidden _token input for the current request's session. */\nexport function csrfField(): HtmlString {\n return new HtmlString(`<input type=\"hidden\" name=\"_token\" value=\"${e(inject(Session).token())}\" autocomplete=\"off\">`)\n}\n\n/** Blade's @method('PUT') / method_field(): spoofs PUT/PATCH/DELETE from an HTML form. */\nexport function methodField(method: string): HtmlString {\n return new HtmlString(`<input type=\"hidden\" name=\"_method\" value=\"${e(method.toUpperCase())}\">`)\n}\n","import { ViewFactory, type Token } from '@orieljs/contracts'\nimport { facade } from '@orieljs/support'\nimport type { Factory } from './Factory'\n\n/** The View facade: View.make(), View.exists(), View.share(), View.composer(), View.first(), View.addNamespace(). */\nexport const View = facade(ViewFactory as unknown as Token<Factory>)\n","import { ConfigRepository, ViewFactory } from '@orieljs/contracts'\nimport { ServiceProvider } from '@orieljs/support'\nimport { Factory } from './Factory'\nimport { FileViewFinder } from './FileViewFinder'\n\n/** Binds the ViewFactory (resources/views by default) and merges the `view` config, like Laravel's config/view.php. */\nexport class ViewServiceProvider extends ServiceProvider {\n override register(): void {\n this.mergeConfigFrom({ paths: [this.app.resourcePath('views')] }, 'view')\n this.app.singleton(ViewFactory, () => {\n const paths = this.app.make(ConfigRepository).get<string[]>('view.paths', [this.app.resourcePath('views')])\n return new Factory(new FileViewFinder(paths))\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAGO,IAAM,UAAyB,uBAAO,IAAI,oBAAoB;AAwB9D,IAAM,WAAW,uBAAO,IAAI,qBAAqB;AAYjD,SAAS,cAAc,MAAmB,OAAiC,KAAqC;AACrH,SAAO,EAAE,CAAC,OAAO,GAAG,MAAM,MAAM,OAAO,SAAS,CAAC,GAAG,IAAI;AAC1D;AAEO,SAAS,UAAU,OAAuC;AAC/D,SAAO,OAAO,UAAU,YAAY,UAAU,QAAS,MAAkC,OAAO,MAAM;AACxG;ACnCO,SAAS,IAAI,MAAmB,OAAqB,KAAqC;AAC/F,SAAO,cAAc,MAAM,OAAO,GAAG;AACvC;AAGO,IAAM,OAAO;;;AKfpB,SAAS,kBAAkB;AAC3B,SAAS,YAAY,MAAM,eAAe;AED1C,SAAS,qBAAqB;ANE9B,IAAM,UAAkC,EAAE,KAAK,SAAS,KAAK,QAAQ,KAAK,QAAQ,KAAK,UAAU,KAAK,SAAS;AAC/G,IAAM,SAAS;AAGR,IAAM,aAAN,MAAqC;EAC1C,YAA6B,OAAe,IAAI;AAAnB,SAAA,OAAA;EAAoB;EAApB;EAE7B,SAAiB;AACf,WAAO,KAAK;EACd;EAEA,WAAmB;AACjB,WAAO,KAAK;EACd;EAEA,UAAmB;AACjB,WAAO,KAAK,SAAS;EACvB;AACF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