@orieljs/foundation 0.1.0-alpha.1 → 0.1.0-alpha.11
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/NOTICE +7 -0
- package/README.md +33 -0
- package/TRADEMARKS.md +33 -0
- package/dist/index.d.ts +129 -5
- package/dist/index.js +444 -22
- package/dist/index.js.map +1 -1
- package/package.json +9 -6
package/NOTICE
CHANGED
|
@@ -7,3 +7,10 @@ This product includes software developed by the Oriel project
|
|
|
7
7
|
Oriel is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
8
8
|
The Oriel name and logo are not covered by that license; see TRADEMARKS.md
|
|
9
9
|
(https://github.com/orieljs/framework/blob/main/TRADEMARKS.md).
|
|
10
|
+
|
|
11
|
+
@orieljs/support (and @orieljs/framework, which bundles it) includes transliteration data from
|
|
12
|
+
voku/portable-ascii (https://github.com/voku/portable-ascii), Copyright (C) 2019 Lars Moelleken, MIT License.
|
|
13
|
+
|
|
14
|
+
@orieljs/notifications (and @orieljs/framework, which bundles it) includes the HTML and CSS of
|
|
15
|
+
Laravel's default notification mail (laravel/framework, https://github.com/laravel/framework),
|
|
16
|
+
Copyright (c) Taylor Otwell, MIT License.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @orieljs/foundation
|
|
2
|
+
|
|
3
|
+
The Oriel application: the container every app runs in, service providers, the boot lifecycle, request handling and the Vite tags. It is Oriel's counterpart of Laravel's foundation. Foundation is part of `@orieljs/framework`, which every Oriel app already installs, and is re-exported from it. In an app, import it from `@orieljs/framework`, whose `Application.configure()` also registers the framework's providers; `@orieljs/foundation` is also published on its own.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @orieljs/framework
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts title="bootstrap/app.ts"
|
|
10
|
+
import { dirname } from 'node:path'
|
|
11
|
+
import { Application } from '@orieljs/framework'
|
|
12
|
+
import providers from './providers'
|
|
13
|
+
|
|
14
|
+
export function createApplication(): Promise<Application> {
|
|
15
|
+
return Application.configure({ basePath: dirname(import.meta.dirname) })
|
|
16
|
+
.withRouting({ web: 'routes/web.ts', console: 'routes/console.ts', health: '/up' })
|
|
17
|
+
.withMiddleware((middleware) => middleware.redirectGuestsTo('/login'))
|
|
18
|
+
.withProviders(providers)
|
|
19
|
+
.create()
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`Application.configure()` returns an `ApplicationBuilder`, whose `withRouting()`, `withMiddleware()`, `withExceptions()`, `withProviders()`, `booting()` and `booted()` set up the app, and `create()` loads `.env` and `config/` and registers the providers. `await app.boot()` boots the providers once, and `await app.handle(request)` boots the app and turns a web `Request` into a `Response`. `vite()` writes the script and style tags for Vite's entry points.
|
|
24
|
+
|
|
25
|
+
Documentation: https://orieljs.vercel.app/docs/lifecycle
|
|
26
|
+
|
|
27
|
+
Status: early alpha. APIs will change.
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
Oriel is open-source software licensed under the Apache License 2.0 (Apache-2.0; see `LICENSE` and `NOTICE`). The Oriel name and logo are trademarks; see `TRADEMARKS.md`.
|
|
32
|
+
|
|
33
|
+
Website: https://orieljs.vercel.app
|
package/TRADEMARKS.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Oriel trademark policy
|
|
2
|
+
|
|
3
|
+
The Oriel code is open source under the Apache License 2.0. The **Oriel name and logo** are not: the license covers
|
|
4
|
+
the code only (section 6 of the license says so), and the name and logo stay with the project. This page explains
|
|
5
|
+
what you can and can't do with them. The goal is simple: people should always be able to tell what is the real Oriel
|
|
6
|
+
and what isn't.
|
|
7
|
+
|
|
8
|
+
## You can, without asking
|
|
9
|
+
|
|
10
|
+
- Use, change, ship and sell the code, as the license allows.
|
|
11
|
+
- Say that your app or package is "built with Oriel", "for Oriel" or "compatible with Oriel".
|
|
12
|
+
- Name a package `oriel-<something>` or `<something>-for-oriel` when it works with Oriel, as long as it is clear that
|
|
13
|
+
it is not official (for example, don't publish it under the `@orieljs` npm scope).
|
|
14
|
+
- Use the name and logo to write about Oriel, teach it, or link to it, in articles, talks, videos and courses.
|
|
15
|
+
- Use the unmodified logo to point to the project, as it is (no recolouring, cropping or
|
|
16
|
+
distortion).
|
|
17
|
+
|
|
18
|
+
## You can't, without written permission
|
|
19
|
+
|
|
20
|
+
- Call a fork, a modified copy or a competing product "Oriel", or anything likely to be confused with it.
|
|
21
|
+
- Use the name or logo as the name, logo or domain of your own product, company or service.
|
|
22
|
+
- Suggest that the Oriel project made, endorses or supports your work when it doesn't.
|
|
23
|
+
- Sell merchandise with the name or logo.
|
|
24
|
+
|
|
25
|
+
## Forks
|
|
26
|
+
|
|
27
|
+
Forks are welcome. Please give yours a different name and logo, keep the `LICENSE` and `NOTICE` files, and say that
|
|
28
|
+
it is based on Oriel.
|
|
29
|
+
|
|
30
|
+
## Questions
|
|
31
|
+
|
|
32
|
+
Open an issue at https://github.com/orieljs/framework or email meeeet.dev@gmail.com. If you're unsure whether a use
|
|
33
|
+
is fine, ask; the answer is usually yes.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ServiceProvider, ServiceProviderClass, MiddlewareConfigurator, ExceptionsConfigurator, Application as Application$1, HttpKernel } from '@orieljs/contracts';
|
|
1
|
+
import { ServiceProvider, ServiceProviderClass, MiddlewareConfigurator, ExceptionsConfigurator, Application as Application$1, ClassNames, HttpKernel, Middleware, HttpRequest, Next, Htmlable, OrielError } from '@orieljs/contracts';
|
|
2
2
|
import { Container } from '@orieljs/container';
|
|
3
3
|
|
|
4
4
|
interface RoutingOptions {
|
|
5
|
-
web
|
|
6
|
-
|
|
5
|
+
/** One route file or several, loaded in order: web: ['routes/web.ts', 'routes/settings.ts', 'routes/auth.ts']. */
|
|
6
|
+
web?: string | string[];
|
|
7
|
+
api?: string | string[];
|
|
7
8
|
console?: string;
|
|
8
9
|
/** A URI such as '/up', not a file. */
|
|
9
10
|
health?: string;
|
|
@@ -29,11 +30,13 @@ declare class ApplicationBuilder {
|
|
|
29
30
|
type LifecycleCallback = (app: Application$1) => void | Promise<void>;
|
|
30
31
|
declare class Application extends Container implements Application$1 {
|
|
31
32
|
private readonly base;
|
|
32
|
-
readonly version = "0.1.0-alpha.
|
|
33
|
+
readonly version = "0.1.0-alpha.11";
|
|
33
34
|
private readonly providers;
|
|
34
35
|
private readonly bootingCallbacks;
|
|
35
36
|
private readonly bootedCallbacks;
|
|
36
37
|
private readonly terminatingCallbacks;
|
|
38
|
+
private readonly shutdownCallbacks;
|
|
39
|
+
private shutdownPromise;
|
|
37
40
|
private bootPromise;
|
|
38
41
|
private hasBooted;
|
|
39
42
|
private inConsole;
|
|
@@ -67,10 +70,39 @@ declare class Application extends Container implements Application$1 {
|
|
|
67
70
|
terminating(callback: () => void | Promise<void>): void;
|
|
68
71
|
handle(request: Request): Promise<Response>;
|
|
69
72
|
terminate(): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* A callback for the end of the process (the CLI after its command, the server on SIGTERM): close DB pools, Redis
|
|
75
|
+
* clients and log files. Not in Laravel, whose PHP processes end with each request.
|
|
76
|
+
*/
|
|
77
|
+
onShutdown(callback: () => void | Promise<void>): void;
|
|
78
|
+
/**
|
|
79
|
+
* Runs the shutdown callbacks once (a second call returns the same promise), newest first: an app's own callbacks
|
|
80
|
+
* run before the framework closes what they use, then the framework's in the reverse of its providers' order (the
|
|
81
|
+
* queue, database and cache connections close, then the log is written, then the session store closes). A failing
|
|
82
|
+
* callback is printed with console.error (the log may be closed already) and the others still run; after 10 seconds
|
|
83
|
+
* the rest are given up on, so the process can still exit. Never rejects.
|
|
84
|
+
*/
|
|
85
|
+
shutdown(): Promise<void>;
|
|
86
|
+
private runShutdown;
|
|
70
87
|
private runBoot;
|
|
71
88
|
private bootProvider;
|
|
72
89
|
}
|
|
73
90
|
|
|
91
|
+
/**
|
|
92
|
+
* The class names of a scrambled production build, read from `bootstrap/cache/classes.json`. The file is read again when
|
|
93
|
+
* a new build replaces it, and ignored while `public/hot` exists (the Vite dev server's CSS keeps the names as written)
|
|
94
|
+
* and while the app runs its tests, which check the HTML its views write.
|
|
95
|
+
*/
|
|
96
|
+
declare class ClassNameMap implements ClassNames {
|
|
97
|
+
#private;
|
|
98
|
+
private readonly app;
|
|
99
|
+
constructor(app: Application$1);
|
|
100
|
+
/** The map, or undefined: no scrambled build, the dev server is running, or the app is running its tests. */
|
|
101
|
+
classes(): Record<string, string> | undefined;
|
|
102
|
+
get active(): boolean;
|
|
103
|
+
html(html: string): string;
|
|
104
|
+
}
|
|
105
|
+
|
|
74
106
|
type Handler = (request: Request) => unknown;
|
|
75
107
|
/** Wave 0 stand-in for the Http kernel: exact "METHOD /path" matching only. Replaced by Wave 1's router. */
|
|
76
108
|
declare class ClosureKernel implements HttpKernel {
|
|
@@ -79,6 +111,16 @@ declare class ClosureKernel implements HttpKernel {
|
|
|
79
111
|
handle(request: Request): Promise<Response>;
|
|
80
112
|
}
|
|
81
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Renames the classes in the HTML pages the app sends, as a scrambled production build renamed them in its CSS
|
|
116
|
+
* (`ClassNames`). JSON, files and every other response are left alone, and so is every page when there's no
|
|
117
|
+
* scrambled build. A streamed page is renamed chunk by chunk, each chunk cut after its last whole tag.
|
|
118
|
+
*/
|
|
119
|
+
declare class RenameClasses implements Middleware {
|
|
120
|
+
#private;
|
|
121
|
+
handle(request: HttpRequest, next: Next): Promise<Response>;
|
|
122
|
+
}
|
|
123
|
+
|
|
82
124
|
declare class ProviderBootError extends Error {
|
|
83
125
|
readonly provider: string;
|
|
84
126
|
readonly name = "ProviderBootError";
|
|
@@ -90,4 +132,86 @@ declare class ProviderRegisterError extends Error {
|
|
|
90
132
|
constructor(provider: string, cause: unknown);
|
|
91
133
|
}
|
|
92
134
|
|
|
93
|
-
|
|
135
|
+
/** One entry of Vite's build manifest (vite's ManifestChunk). */
|
|
136
|
+
interface ManifestChunk {
|
|
137
|
+
file: string;
|
|
138
|
+
src?: string;
|
|
139
|
+
name?: string;
|
|
140
|
+
isEntry?: boolean;
|
|
141
|
+
isDynamicEntry?: boolean;
|
|
142
|
+
imports?: string[];
|
|
143
|
+
dynamicImports?: string[];
|
|
144
|
+
css?: string[];
|
|
145
|
+
assets?: string[];
|
|
146
|
+
[key: string]: unknown;
|
|
147
|
+
}
|
|
148
|
+
type Manifest = Record<string, ManifestChunk>;
|
|
149
|
+
type TagAttributes = Record<string, string | boolean | null | undefined>;
|
|
150
|
+
type AttributesResolver = (src: string, url: string, chunk: ManifestChunk | undefined, manifest: Manifest | undefined) => TagAttributes;
|
|
151
|
+
type PreloadAttributesResolver = (src: string, url: string, chunk: ManifestChunk | undefined, manifest: Manifest | undefined) => TagAttributes | false;
|
|
152
|
+
/** A missing manifest or chunk (Laravel's ViteException / ViteManifestNotFoundException). */
|
|
153
|
+
declare class ViteError extends Error implements OrielError {
|
|
154
|
+
readonly kind: "Server";
|
|
155
|
+
readonly status = 500;
|
|
156
|
+
constructor(message: string);
|
|
157
|
+
}
|
|
158
|
+
/** Markup the view renderer emits unescaped (Htmlable; Foundation can't import View's HtmlString). */
|
|
159
|
+
declare class ViteHtml implements Htmlable {
|
|
160
|
+
private readonly html;
|
|
161
|
+
constructor(html: string);
|
|
162
|
+
toHtml(): string;
|
|
163
|
+
toString(): string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Laravel's Illuminate\Foundation\Vite: the script, style and preload tags for Vite entry points. While the dev
|
|
167
|
+
* server runs (public/hot holds its URL) it points at the dev server; otherwise it reads public/build/manifest.json.
|
|
168
|
+
*/
|
|
169
|
+
declare class Vite {
|
|
170
|
+
#private;
|
|
171
|
+
protected readonly app: Application$1;
|
|
172
|
+
constructor(app: Application$1);
|
|
173
|
+
useCspNonce(nonce?: string): string;
|
|
174
|
+
cspNonce(): string | undefined;
|
|
175
|
+
useIntegrityKey(key: string | false): this;
|
|
176
|
+
withEntryPoints(entryPoints: string[]): this;
|
|
177
|
+
useHotFile(path: string): this;
|
|
178
|
+
useBuildDirectory(path: string): this;
|
|
179
|
+
useManifestFilename(filename: string): this;
|
|
180
|
+
useScriptTagAttributes(attributes: TagAttributes | AttributesResolver): this;
|
|
181
|
+
useStyleTagAttributes(attributes: TagAttributes | AttributesResolver): this;
|
|
182
|
+
/** Extra preload attributes; a resolver returning false drops that preload. */
|
|
183
|
+
usePreloadTagAttributes(attributes: TagAttributes | PreloadAttributesResolver | false): this;
|
|
184
|
+
createAssetPathsUsing(resolver: (path: string) => string): this;
|
|
185
|
+
hotFile(): string;
|
|
186
|
+
isRunningHot(): boolean;
|
|
187
|
+
/** The dev server URL written by @orieljs/vite, or undefined when it isn't running. */
|
|
188
|
+
devServerUrl(): string | undefined;
|
|
189
|
+
/** Laravel's @vite([...]): preloads (styles first), then stylesheets, then scripts. */
|
|
190
|
+
tags(entryPoints: string | string[], buildDirectory?: string): ViteHtml;
|
|
191
|
+
/** Laravel's @viteReactRefresh: the React Refresh preamble while the dev server runs; nothing otherwise. */
|
|
192
|
+
reactRefresh(): ViteHtml | undefined;
|
|
193
|
+
/** The URL of a processed asset (Vite::asset('resources/images/logo.svg')). */
|
|
194
|
+
asset(path: string, buildDirectory?: string): string;
|
|
195
|
+
/** The built file's contents (Vite::content()). */
|
|
196
|
+
content(path: string, buildDirectory?: string): string;
|
|
197
|
+
/** md5 of the manifest (a cache-busting asset version); undefined while hot or without a build. */
|
|
198
|
+
manifestHash(buildDirectory?: string): string | undefined;
|
|
199
|
+
manifestPath(buildDirectory?: string): string;
|
|
200
|
+
manifest(buildDirectory?: string): Manifest;
|
|
201
|
+
/** URL → the attributes of the preload tags rendered so far (without href), for Link headers. */
|
|
202
|
+
preloadedAssets(): Record<string, string[]>;
|
|
203
|
+
/** Renders withEntryPoints() (Vite is Htmlable, like Laravel's). */
|
|
204
|
+
toHtml(): string;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* The Vite instance for the current context: the request's own (scoped, so a CSP nonce stays in its request),
|
|
208
|
+
* else a fresh one for the application (a mail view rendered by a queue worker).
|
|
209
|
+
*/
|
|
210
|
+
declare function currentVite(): Vite;
|
|
211
|
+
/** vite(['resources/js/app.tsx']) → the tags (Laravel's @vite); vite() → the Vite instance. */
|
|
212
|
+
declare function vite(): Vite;
|
|
213
|
+
declare function vite(entryPoints: string | string[], buildDirectory?: string): ViteHtml;
|
|
214
|
+
/** Laravel's @viteReactRefresh: put it before vite([...]) in the root view of a React app. */
|
|
215
|
+
declare function viteReactRefresh(): ViteHtml | undefined;
|
|
216
|
+
|
|
217
|
+
export { Application, ApplicationBuilder, type AttributesResolver, ClassNameMap, ClosureKernel, type Manifest, type ManifestChunk, type PreloadAttributesResolver, ProviderBootError, ProviderRegisterError, RenameClasses, type RoutingOptions, type TagAttributes, Vite, ViteError, ViteHtml, currentVite, vite, viteReactRefresh };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// Application.ts
|
|
2
|
-
import { join as
|
|
2
|
+
import { join as join3 } from "path";
|
|
3
3
|
import {
|
|
4
|
-
Application as
|
|
4
|
+
Application as ApplicationToken2,
|
|
5
|
+
ClassNames as ClassNames2,
|
|
5
6
|
ClassRegistry as ClassRegistryToken,
|
|
6
|
-
ConfigRepository as
|
|
7
|
+
ConfigRepository as ConfigRepository3,
|
|
7
8
|
HttpKernel
|
|
8
9
|
} from "@orieljs/contracts";
|
|
9
|
-
import { Container } from "@orieljs/container";
|
|
10
|
+
import { Container as Container2 } from "@orieljs/container";
|
|
10
11
|
import { ClassRegistry, Str } from "@orieljs/support";
|
|
11
12
|
|
|
12
13
|
// ApplicationBuilder.ts
|
|
@@ -18,6 +19,53 @@ import {
|
|
|
18
19
|
RoutingPaths
|
|
19
20
|
} from "@orieljs/contracts";
|
|
20
21
|
import { loadConfiguration, loadEnvironment, Repository } from "@orieljs/config";
|
|
22
|
+
|
|
23
|
+
// Http/RenameClasses.ts
|
|
24
|
+
import { ClassNames, Container } from "@orieljs/contracts";
|
|
25
|
+
import { inject } from "@orieljs/container";
|
|
26
|
+
var RAW_TEXT = /<(script|style|textarea|title|xmp|noembed|noframes)\b[^>]*>(?![\s\S]*<\/\1)/i;
|
|
27
|
+
var RenameClasses = class {
|
|
28
|
+
#container = inject(Container);
|
|
29
|
+
async handle(request, next) {
|
|
30
|
+
const response = await next(request);
|
|
31
|
+
if (response.body === null || !/^text\/html\b/i.test(response.headers.get("content-type") ?? "") || response.headers.has("content-encoding")) return response;
|
|
32
|
+
if (!this.#container.bound(ClassNames)) return response;
|
|
33
|
+
const classNames = this.#container.make(ClassNames);
|
|
34
|
+
if (!classNames.active) return response;
|
|
35
|
+
const headers = new Headers(response.headers);
|
|
36
|
+
headers.delete("content-length");
|
|
37
|
+
return new Response(response.body.pipeThrough(renamer((html) => classNames.html(html))), { status: response.status, statusText: response.statusText, headers });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function renamer(rename) {
|
|
41
|
+
const decoder = new TextDecoder();
|
|
42
|
+
const encoder = new TextEncoder();
|
|
43
|
+
let carry = "";
|
|
44
|
+
return new TransformStream({
|
|
45
|
+
transform(chunk, controller) {
|
|
46
|
+
const text = carry + decoder.decode(chunk, { stream: true });
|
|
47
|
+
const cut = safeCut(text);
|
|
48
|
+
carry = text.slice(cut);
|
|
49
|
+
if (cut > 0) controller.enqueue(encoder.encode(rename(text.slice(0, cut))));
|
|
50
|
+
},
|
|
51
|
+
flush(controller) {
|
|
52
|
+
const text = carry + decoder.decode();
|
|
53
|
+
if (text !== "") controller.enqueue(encoder.encode(rename(text)));
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function safeCut(text) {
|
|
58
|
+
let cut = text.lastIndexOf(">") + 1;
|
|
59
|
+
if (cut === 0) return 0;
|
|
60
|
+
const head = text.slice(0, cut);
|
|
61
|
+
const comment = head.lastIndexOf("<!--");
|
|
62
|
+
if (comment !== -1 && head.indexOf("-->", comment + 4) === -1) cut = comment;
|
|
63
|
+
const raw = RAW_TEXT.exec(text.slice(0, cut));
|
|
64
|
+
if (raw !== null) cut = raw.index;
|
|
65
|
+
return cut;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ApplicationBuilder.ts
|
|
21
69
|
var ApplicationBuilder = class {
|
|
22
70
|
constructor(app) {
|
|
23
71
|
this.app = app;
|
|
@@ -32,10 +80,11 @@ var ApplicationBuilder = class {
|
|
|
32
80
|
return this;
|
|
33
81
|
}
|
|
34
82
|
withRouting(options) {
|
|
35
|
-
const abs = (p) =>
|
|
83
|
+
const abs = (p) => isAbsolute(p) ? p : join(this.app.basePath(), p);
|
|
84
|
+
const each = (p) => Array.isArray(p) ? p.map(abs) : abs(p);
|
|
36
85
|
const paths = { apiPrefix: options.apiPrefix ?? "api" };
|
|
37
|
-
if (options.web !== void 0) paths.web =
|
|
38
|
-
if (options.api !== void 0) paths.api =
|
|
86
|
+
if (options.web !== void 0) paths.web = each(options.web);
|
|
87
|
+
if (options.api !== void 0) paths.api = each(options.api);
|
|
39
88
|
if (options.console !== void 0) paths.console = abs(options.console);
|
|
40
89
|
if (options.health !== void 0) paths.health = options.health;
|
|
41
90
|
this.routing = paths;
|
|
@@ -61,13 +110,53 @@ var ApplicationBuilder = class {
|
|
|
61
110
|
loadEnvironment(this.app.basePath());
|
|
62
111
|
this.app.instance(ConfigRepository, new Repository(await loadConfiguration(this.app.configPath())));
|
|
63
112
|
if (this.routing) this.app.instance(RoutingPaths, this.routing);
|
|
64
|
-
|
|
113
|
+
const middleware = [(m) => void m.prepend(RenameClasses), ...this.middleware];
|
|
114
|
+
this.app.instance(MiddlewareCallbacks, middleware);
|
|
65
115
|
this.app.instance(ExceptionCallbacks, this.exceptions);
|
|
66
116
|
for (const provider of this.providers) await this.app.register(provider);
|
|
67
117
|
return this.app;
|
|
68
118
|
}
|
|
69
119
|
};
|
|
70
120
|
|
|
121
|
+
// ClassNames.ts
|
|
122
|
+
import { existsSync, readFileSync, statSync } from "fs";
|
|
123
|
+
import { rewriteHtml } from "@orieljs/obfuscate";
|
|
124
|
+
var ClassNameMap = class {
|
|
125
|
+
constructor(app) {
|
|
126
|
+
this.app = app;
|
|
127
|
+
}
|
|
128
|
+
app;
|
|
129
|
+
#loaded;
|
|
130
|
+
/** The map, or undefined: no scrambled build, the dev server is running, or the app is running its tests. */
|
|
131
|
+
classes() {
|
|
132
|
+
if (this.#testing() || existsSync(this.app.publicPath("hot"))) return void 0;
|
|
133
|
+
const file = this.app.bootstrapPath("cache/classes.json");
|
|
134
|
+
let modified;
|
|
135
|
+
try {
|
|
136
|
+
modified = statSync(file).mtimeMs;
|
|
137
|
+
} catch {
|
|
138
|
+
this.#loaded = void 0;
|
|
139
|
+
return void 0;
|
|
140
|
+
}
|
|
141
|
+
if (this.#loaded?.modified !== modified) {
|
|
142
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
143
|
+
this.#loaded = { modified, classes: parsed.classes ?? {} };
|
|
144
|
+
}
|
|
145
|
+
return Object.keys(this.#loaded.classes).length === 0 ? void 0 : this.#loaded.classes;
|
|
146
|
+
}
|
|
147
|
+
/** The app runs its tests: Oriel's TestCase sets APP_ENV=testing, which a test that switches app.env leaves set. */
|
|
148
|
+
#testing() {
|
|
149
|
+
return this.app.runningUnitTests() || process.env.APP_ENV === "testing";
|
|
150
|
+
}
|
|
151
|
+
get active() {
|
|
152
|
+
return this.classes() !== void 0;
|
|
153
|
+
}
|
|
154
|
+
html(html) {
|
|
155
|
+
const classes = this.classes();
|
|
156
|
+
return classes === void 0 ? html : rewriteHtml(html, classes);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
71
160
|
// errors.ts
|
|
72
161
|
var ProviderBootError = class extends Error {
|
|
73
162
|
constructor(provider, cause) {
|
|
@@ -86,22 +175,309 @@ var ProviderRegisterError = class extends Error {
|
|
|
86
175
|
name = "ProviderRegisterError";
|
|
87
176
|
};
|
|
88
177
|
|
|
178
|
+
// Vite.ts
|
|
179
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, statSync as statSync2 } from "fs";
|
|
180
|
+
import { createHash, randomBytes } from "crypto";
|
|
181
|
+
import { join as join2 } from "path";
|
|
182
|
+
import { Application as ApplicationToken, ConfigRepository as ConfigRepository2, HttpRequest, UrlGenerator } from "@orieljs/contracts";
|
|
183
|
+
import { ContainerNotAvailableError, currentContainer } from "@orieljs/container";
|
|
184
|
+
var ViteError = class extends Error {
|
|
185
|
+
kind = "Server";
|
|
186
|
+
status = 500;
|
|
187
|
+
constructor(message) {
|
|
188
|
+
super(message);
|
|
189
|
+
this.name = "ViteError";
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
var ViteHtml = class {
|
|
193
|
+
constructor(html) {
|
|
194
|
+
this.html = html;
|
|
195
|
+
}
|
|
196
|
+
html;
|
|
197
|
+
toHtml() {
|
|
198
|
+
return this.html;
|
|
199
|
+
}
|
|
200
|
+
toString() {
|
|
201
|
+
return this.html;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
var TRACKED = { "data-navigate-track": true };
|
|
205
|
+
var CSS_PATH = /\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\?[^.]*)?$/;
|
|
206
|
+
var manifests = /* @__PURE__ */ new Map();
|
|
207
|
+
var escapeAttribute = (value) => value.replace(/&/g, "&").replace(/"/g, """);
|
|
208
|
+
var Vite = class {
|
|
209
|
+
constructor(app) {
|
|
210
|
+
this.app = app;
|
|
211
|
+
}
|
|
212
|
+
app;
|
|
213
|
+
#hotFile;
|
|
214
|
+
#buildDirectory = "build";
|
|
215
|
+
#manifestFilename = "manifest.json";
|
|
216
|
+
#nonce;
|
|
217
|
+
#integrityKey = "integrity";
|
|
218
|
+
#entryPoints = [];
|
|
219
|
+
#scriptResolvers = [];
|
|
220
|
+
#styleResolvers = [];
|
|
221
|
+
#preloadResolvers = [];
|
|
222
|
+
#assetPathResolver;
|
|
223
|
+
#preloaded = {};
|
|
224
|
+
// Configuration --------------------------------------------------------------------------------------------
|
|
225
|
+
useCspNonce(nonce) {
|
|
226
|
+
this.#nonce = nonce ?? randomBytes(30).toString("base64url").slice(0, 40);
|
|
227
|
+
return this.#nonce;
|
|
228
|
+
}
|
|
229
|
+
cspNonce() {
|
|
230
|
+
return this.#nonce;
|
|
231
|
+
}
|
|
232
|
+
useIntegrityKey(key) {
|
|
233
|
+
this.#integrityKey = key;
|
|
234
|
+
return this;
|
|
235
|
+
}
|
|
236
|
+
withEntryPoints(entryPoints) {
|
|
237
|
+
this.#entryPoints = entryPoints;
|
|
238
|
+
return this;
|
|
239
|
+
}
|
|
240
|
+
useHotFile(path) {
|
|
241
|
+
this.#hotFile = path;
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
244
|
+
useBuildDirectory(path) {
|
|
245
|
+
this.#buildDirectory = path;
|
|
246
|
+
return this;
|
|
247
|
+
}
|
|
248
|
+
useManifestFilename(filename) {
|
|
249
|
+
this.#manifestFilename = filename;
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
useScriptTagAttributes(attributes) {
|
|
253
|
+
this.#scriptResolvers.push(typeof attributes === "function" ? attributes : () => attributes);
|
|
254
|
+
return this;
|
|
255
|
+
}
|
|
256
|
+
useStyleTagAttributes(attributes) {
|
|
257
|
+
this.#styleResolvers.push(typeof attributes === "function" ? attributes : () => attributes);
|
|
258
|
+
return this;
|
|
259
|
+
}
|
|
260
|
+
/** Extra preload attributes; a resolver returning false drops that preload. */
|
|
261
|
+
usePreloadTagAttributes(attributes) {
|
|
262
|
+
this.#preloadResolvers.push(typeof attributes === "function" ? attributes : () => attributes);
|
|
263
|
+
return this;
|
|
264
|
+
}
|
|
265
|
+
createAssetPathsUsing(resolver) {
|
|
266
|
+
this.#assetPathResolver = resolver;
|
|
267
|
+
return this;
|
|
268
|
+
}
|
|
269
|
+
// Dev server -----------------------------------------------------------------------------------------------
|
|
270
|
+
hotFile() {
|
|
271
|
+
return this.#hotFile ?? this.app.publicPath("hot");
|
|
272
|
+
}
|
|
273
|
+
isRunningHot() {
|
|
274
|
+
return existsSync2(this.hotFile());
|
|
275
|
+
}
|
|
276
|
+
/** The dev server URL written by @orieljs/vite, or undefined when it isn't running. */
|
|
277
|
+
devServerUrl() {
|
|
278
|
+
return this.isRunningHot() ? readFileSync2(this.hotFile(), "utf8").trimEnd() : void 0;
|
|
279
|
+
}
|
|
280
|
+
// Tags -----------------------------------------------------------------------------------------------------
|
|
281
|
+
/** Laravel's @vite([...]): preloads (styles first), then stylesheets, then scripts. */
|
|
282
|
+
tags(entryPoints, buildDirectory = this.#buildDirectory) {
|
|
283
|
+
const entries = [entryPoints].flat();
|
|
284
|
+
if (this.isRunningHot()) {
|
|
285
|
+
return new ViteHtml(["@vite/client", ...entries].map((entry) => this.#tagForChunk(entry, this.#hotAsset(entry), void 0, void 0)).join(""));
|
|
286
|
+
}
|
|
287
|
+
const manifest = this.manifest(buildDirectory);
|
|
288
|
+
const tags = [];
|
|
289
|
+
const preloads = [];
|
|
290
|
+
const cssChunk = (css) => {
|
|
291
|
+
const found = Object.entries(manifest).find(([, chunk]) => chunk.file === css);
|
|
292
|
+
return found === void 0 ? [css, void 0] : [found[0], found[1]];
|
|
293
|
+
};
|
|
294
|
+
for (const entry of entries) {
|
|
295
|
+
const chunk = this.#chunk(manifest, entry);
|
|
296
|
+
preloads.push([chunk.src ?? entry, this.#assetPath(`${buildDirectory}/${chunk.file}`), chunk]);
|
|
297
|
+
for (const name of this.#resolveImports(manifest, chunk)) {
|
|
298
|
+
const imported = manifest[name];
|
|
299
|
+
preloads.push([name, this.#assetPath(`${buildDirectory}/${imported.file}`), imported]);
|
|
300
|
+
for (const css of imported.css ?? []) {
|
|
301
|
+
const [key, partial] = cssChunk(css);
|
|
302
|
+
preloads.push([key, this.#assetPath(`${buildDirectory}/${css}`), partial]);
|
|
303
|
+
tags.push(this.#tagForChunk(key, this.#assetPath(`${buildDirectory}/${css}`), partial, manifest));
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
tags.push(this.#tagForChunk(entry, this.#assetPath(`${buildDirectory}/${chunk.file}`), chunk, manifest));
|
|
307
|
+
for (const css of chunk.css ?? []) {
|
|
308
|
+
const [key, partial] = cssChunk(css);
|
|
309
|
+
preloads.push([key, this.#assetPath(`${buildDirectory}/${css}`), partial]);
|
|
310
|
+
tags.push(this.#tagForChunk(key, this.#assetPath(`${buildDirectory}/${css}`), partial, manifest));
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
const uniqueTags = [...new Set(tags)];
|
|
314
|
+
const stylesheets = uniqueTags.filter((tag) => tag.startsWith("<link"));
|
|
315
|
+
const scripts = uniqueTags.filter((tag) => !tag.startsWith("<link"));
|
|
316
|
+
const seen = /* @__PURE__ */ new Set();
|
|
317
|
+
const uniquePreloads = preloads.filter(([, url]) => seen.has(url) ? false : (seen.add(url), true));
|
|
318
|
+
const sorted = [...uniquePreloads.filter(([, url]) => CSS_PATH.test(url)), ...uniquePreloads.filter(([, url]) => !CSS_PATH.test(url))];
|
|
319
|
+
const preloadTags = sorted.map(([src, url, chunk]) => this.#preloadTag(src, url, chunk, manifest));
|
|
320
|
+
return new ViteHtml(preloadTags.join("") + stylesheets.join("") + scripts.join(""));
|
|
321
|
+
}
|
|
322
|
+
/** Laravel's @viteReactRefresh: the React Refresh preamble while the dev server runs; nothing otherwise. */
|
|
323
|
+
reactRefresh() {
|
|
324
|
+
if (!this.isRunningHot()) return void 0;
|
|
325
|
+
const attributes = this.#parseAttributes({ nonce: this.#nonce ?? false });
|
|
326
|
+
return new ViteHtml(
|
|
327
|
+
[
|
|
328
|
+
`<script type="module" ${attributes.join(" ")}>`,
|
|
329
|
+
` import RefreshRuntime from '${this.#hotAsset("@react-refresh")}'`,
|
|
330
|
+
" RefreshRuntime.injectIntoGlobalHook(window)",
|
|
331
|
+
" window.$RefreshReg$ = () => {}",
|
|
332
|
+
" window.$RefreshSig$ = () => (type) => type",
|
|
333
|
+
" window.__vite_plugin_react_preamble_installed__ = true",
|
|
334
|
+
"</script>"
|
|
335
|
+
].join("\n")
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
/** The URL of a processed asset (Vite::asset('resources/images/logo.svg')). */
|
|
339
|
+
asset(path, buildDirectory = this.#buildDirectory) {
|
|
340
|
+
if (this.isRunningHot()) return this.#hotAsset(path);
|
|
341
|
+
return this.#assetPath(`${buildDirectory}/${this.#chunk(this.manifest(buildDirectory), path).file}`);
|
|
342
|
+
}
|
|
343
|
+
/** The built file's contents (Vite::content()). */
|
|
344
|
+
content(path, buildDirectory = this.#buildDirectory) {
|
|
345
|
+
const chunk = this.#chunk(this.manifest(buildDirectory), path);
|
|
346
|
+
const file = this.app.publicPath(join2(buildDirectory, chunk.file));
|
|
347
|
+
if (!existsSync2(file)) throw new ViteError(`Unable to locate file from Vite manifest: ${file}.`);
|
|
348
|
+
return readFileSync2(file, "utf8");
|
|
349
|
+
}
|
|
350
|
+
/** md5 of the manifest (a cache-busting asset version); undefined while hot or without a build. */
|
|
351
|
+
manifestHash(buildDirectory = this.#buildDirectory) {
|
|
352
|
+
if (this.isRunningHot()) return void 0;
|
|
353
|
+
const path = this.manifestPath(buildDirectory);
|
|
354
|
+
return existsSync2(path) ? createHash("md5").update(readFileSync2(path)).digest("hex") : void 0;
|
|
355
|
+
}
|
|
356
|
+
manifestPath(buildDirectory = this.#buildDirectory) {
|
|
357
|
+
return this.app.publicPath(join2(buildDirectory, this.#manifestFilename));
|
|
358
|
+
}
|
|
359
|
+
manifest(buildDirectory = this.#buildDirectory) {
|
|
360
|
+
const path = this.manifestPath(buildDirectory);
|
|
361
|
+
if (!existsSync2(path)) throw new ViteError(`Vite manifest not found at: ${path}`);
|
|
362
|
+
const { mtimeMs } = statSync2(path);
|
|
363
|
+
const cached = manifests.get(path);
|
|
364
|
+
if (cached !== void 0 && cached.mtimeMs === mtimeMs) return cached.manifest;
|
|
365
|
+
const manifest = JSON.parse(readFileSync2(path, "utf8"));
|
|
366
|
+
manifests.set(path, { mtimeMs, manifest });
|
|
367
|
+
return manifest;
|
|
368
|
+
}
|
|
369
|
+
/** URL → the attributes of the preload tags rendered so far (without href), for Link headers. */
|
|
370
|
+
preloadedAssets() {
|
|
371
|
+
return { ...this.#preloaded };
|
|
372
|
+
}
|
|
373
|
+
/** Renders withEntryPoints() (Vite is Htmlable, like Laravel's). */
|
|
374
|
+
toHtml() {
|
|
375
|
+
return this.tags(this.#entryPoints).toHtml();
|
|
376
|
+
}
|
|
377
|
+
// Internals ------------------------------------------------------------------------------------------------
|
|
378
|
+
#hotAsset(path) {
|
|
379
|
+
return `${this.devServerUrl() ?? ""}/${path}`;
|
|
380
|
+
}
|
|
381
|
+
#assetPath(path) {
|
|
382
|
+
if (this.#assetPathResolver !== void 0) return this.#assetPathResolver(path);
|
|
383
|
+
if (this.app.bound(UrlGenerator)) return this.app.make(UrlGenerator).asset(path);
|
|
384
|
+
const base = this.app.bound(ConfigRepository2) ? this.app.make(ConfigRepository2).get("app.asset_url", null) : null;
|
|
385
|
+
return `${(base ?? "").replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
|
|
386
|
+
}
|
|
387
|
+
#chunk(manifest, file) {
|
|
388
|
+
const chunk = manifest[file];
|
|
389
|
+
if (chunk === void 0) throw new ViteError(`Unable to locate file in Vite manifest: ${file}.`);
|
|
390
|
+
return chunk;
|
|
391
|
+
}
|
|
392
|
+
/** Every static import, depth first, each once. */
|
|
393
|
+
#resolveImports(manifest, chunk, seen = /* @__PURE__ */ new Set()) {
|
|
394
|
+
const imports = [];
|
|
395
|
+
for (const name of chunk.imports ?? []) {
|
|
396
|
+
if (seen.has(name)) continue;
|
|
397
|
+
seen.add(name);
|
|
398
|
+
imports.push(name);
|
|
399
|
+
const imported = manifest[name];
|
|
400
|
+
if (imported !== void 0) imports.push(...this.#resolveImports(manifest, imported, seen));
|
|
401
|
+
}
|
|
402
|
+
return imports;
|
|
403
|
+
}
|
|
404
|
+
#tagForChunk(src, url, chunk, manifest) {
|
|
405
|
+
if (CSS_PATH.test(url)) {
|
|
406
|
+
const attributes2 = this.#parseAttributes({ rel: "stylesheet", href: url, nonce: this.#nonce ?? false, ...TRACKED, ...this.#styleAttributes(src, url, chunk, manifest) });
|
|
407
|
+
return `<link ${attributes2.join(" ")} />`;
|
|
408
|
+
}
|
|
409
|
+
const attributes = this.#parseAttributes({ type: "module", src: url, nonce: this.#nonce ?? false, ...TRACKED, ...this.#scriptAttributes(src, url, chunk, manifest) });
|
|
410
|
+
return `<script ${attributes.join(" ")}></script>`;
|
|
411
|
+
}
|
|
412
|
+
#preloadTag(src, url, chunk, manifest) {
|
|
413
|
+
const css = CSS_PATH.test(url);
|
|
414
|
+
let attributes = {
|
|
415
|
+
rel: css ? "preload" : "modulepreload",
|
|
416
|
+
as: css ? "style" : "script",
|
|
417
|
+
href: url,
|
|
418
|
+
nonce: this.#nonce ?? false,
|
|
419
|
+
crossorigin: (css ? this.#styleAttributes(src, url, chunk, manifest) : this.#scriptAttributes(src, url, chunk, manifest)).crossorigin ?? false
|
|
420
|
+
};
|
|
421
|
+
if (this.#integrityKey !== false) attributes.integrity = chunk?.[this.#integrityKey] ?? false;
|
|
422
|
+
for (const resolver of this.#preloadResolvers) {
|
|
423
|
+
const resolved = resolver(src, url, chunk, manifest);
|
|
424
|
+
if (resolved === false) return "";
|
|
425
|
+
attributes = { ...attributes, ...resolved };
|
|
426
|
+
}
|
|
427
|
+
const { href: _href, ...rest } = attributes;
|
|
428
|
+
this.#preloaded[url] = this.#parseAttributes(rest);
|
|
429
|
+
return `<link ${this.#parseAttributes(attributes).join(" ")} />`;
|
|
430
|
+
}
|
|
431
|
+
#scriptAttributes(src, url, chunk, manifest) {
|
|
432
|
+
let attributes = this.#integrityKey !== false ? { integrity: chunk?.[this.#integrityKey] ?? false } : {};
|
|
433
|
+
for (const resolver of this.#scriptResolvers) attributes = { ...attributes, ...resolver(src, url, chunk, manifest) };
|
|
434
|
+
return attributes;
|
|
435
|
+
}
|
|
436
|
+
#styleAttributes(src, url, chunk, manifest) {
|
|
437
|
+
let attributes = this.#integrityKey !== false ? { integrity: chunk?.[this.#integrityKey] ?? false } : {};
|
|
438
|
+
for (const resolver of this.#styleResolvers) attributes = { ...attributes, ...resolver(src, url, chunk, manifest) };
|
|
439
|
+
return attributes;
|
|
440
|
+
}
|
|
441
|
+
/** false/null/undefined are dropped, true is a bare attribute, anything else name="value". */
|
|
442
|
+
#parseAttributes(attributes) {
|
|
443
|
+
return Object.entries(attributes).filter(([, value]) => value !== false && value !== null && value !== void 0).map(([name, value]) => value === true ? name : `${name}="${escapeAttribute(String(value))}"`);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
function currentVite() {
|
|
447
|
+
const container = currentContainer();
|
|
448
|
+
if (container === void 0) throw new ContainerNotAvailableError("Vite");
|
|
449
|
+
if (container.bound(HttpRequest)) return container.make(Vite);
|
|
450
|
+
return new Vite(container.make(ApplicationToken));
|
|
451
|
+
}
|
|
452
|
+
function vite(entryPoints, buildDirectory) {
|
|
453
|
+
const instance = currentVite();
|
|
454
|
+
return entryPoints === void 0 ? instance : instance.tags(entryPoints, buildDirectory);
|
|
455
|
+
}
|
|
456
|
+
function viteReactRefresh() {
|
|
457
|
+
return currentVite().reactRefresh();
|
|
458
|
+
}
|
|
459
|
+
|
|
89
460
|
// Application.ts
|
|
90
|
-
var
|
|
461
|
+
var SHUTDOWN_TIMEOUT_MS = 1e4;
|
|
462
|
+
var Application = class _Application extends Container2 {
|
|
91
463
|
constructor(base) {
|
|
92
464
|
super();
|
|
93
465
|
this.base = base;
|
|
94
|
-
|
|
95
|
-
this.instance(
|
|
466
|
+
Container2.setInstance(this);
|
|
467
|
+
this.instance(ApplicationToken2, this);
|
|
96
468
|
this.instance(_Application, this);
|
|
97
469
|
this.singleton(ClassRegistryToken, ClassRegistry);
|
|
470
|
+
this.scoped(Vite, () => new Vite(this));
|
|
471
|
+
this.singleton(ClassNames2, () => new ClassNameMap(this));
|
|
98
472
|
}
|
|
99
473
|
base;
|
|
100
|
-
version = "0.1.0-alpha.
|
|
474
|
+
version = "0.1.0-alpha.11";
|
|
101
475
|
providers = [];
|
|
102
476
|
bootingCallbacks = [];
|
|
103
477
|
bootedCallbacks = [];
|
|
104
478
|
terminatingCallbacks = [];
|
|
479
|
+
shutdownCallbacks = [];
|
|
480
|
+
shutdownPromise;
|
|
105
481
|
bootPromise;
|
|
106
482
|
hasBooted = false;
|
|
107
483
|
inConsole = false;
|
|
@@ -110,32 +486,32 @@ var Application = class _Application extends Container {
|
|
|
110
486
|
return new ApplicationBuilder(new _Application(options.basePath));
|
|
111
487
|
}
|
|
112
488
|
basePath(path = "") {
|
|
113
|
-
return
|
|
489
|
+
return join3(this.base, path);
|
|
114
490
|
}
|
|
115
491
|
appPath(path = "") {
|
|
116
|
-
return this.basePath(
|
|
492
|
+
return this.basePath(join3("app", path));
|
|
117
493
|
}
|
|
118
494
|
bootstrapPath(path = "") {
|
|
119
|
-
return this.basePath(
|
|
495
|
+
return this.basePath(join3("bootstrap", path));
|
|
120
496
|
}
|
|
121
497
|
configPath(path = "") {
|
|
122
|
-
return this.basePath(
|
|
498
|
+
return this.basePath(join3("config", path));
|
|
123
499
|
}
|
|
124
500
|
databasePath(path = "") {
|
|
125
|
-
return this.basePath(
|
|
501
|
+
return this.basePath(join3("database", path));
|
|
126
502
|
}
|
|
127
503
|
publicPath(path = "") {
|
|
128
|
-
return this.basePath(
|
|
504
|
+
return this.basePath(join3("public", path));
|
|
129
505
|
}
|
|
130
506
|
resourcePath(path = "") {
|
|
131
|
-
return this.basePath(
|
|
507
|
+
return this.basePath(join3("resources", path));
|
|
132
508
|
}
|
|
133
509
|
storagePath(path = "") {
|
|
134
|
-
return this.basePath(
|
|
510
|
+
return this.basePath(join3("storage", path));
|
|
135
511
|
}
|
|
136
512
|
environment(...environments) {
|
|
137
513
|
const fallback = process.env.APP_ENV ?? "production";
|
|
138
|
-
const current = this.bound(
|
|
514
|
+
const current = this.bound(ConfigRepository3) ? String(this.make(ConfigRepository3).get("app.env", fallback)) : fallback;
|
|
139
515
|
return environments.length === 0 ? current : environments.some((pattern) => Str.is(pattern, current));
|
|
140
516
|
}
|
|
141
517
|
isProduction() {
|
|
@@ -195,6 +571,44 @@ var Application = class _Application extends Container {
|
|
|
195
571
|
async terminate() {
|
|
196
572
|
for (const callback of this.terminatingCallbacks) await callback();
|
|
197
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* A callback for the end of the process (the CLI after its command, the server on SIGTERM): close DB pools, Redis
|
|
576
|
+
* clients and log files. Not in Laravel, whose PHP processes end with each request.
|
|
577
|
+
*/
|
|
578
|
+
onShutdown(callback) {
|
|
579
|
+
this.shutdownCallbacks.push(callback);
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Runs the shutdown callbacks once (a second call returns the same promise), newest first: an app's own callbacks
|
|
583
|
+
* run before the framework closes what they use, then the framework's in the reverse of its providers' order (the
|
|
584
|
+
* queue, database and cache connections close, then the log is written, then the session store closes). A failing
|
|
585
|
+
* callback is printed with console.error (the log may be closed already) and the others still run; after 10 seconds
|
|
586
|
+
* the rest are given up on, so the process can still exit. Never rejects.
|
|
587
|
+
*/
|
|
588
|
+
shutdown() {
|
|
589
|
+
return this.shutdownPromise ??= this.runShutdown();
|
|
590
|
+
}
|
|
591
|
+
async runShutdown() {
|
|
592
|
+
if (this.shutdownCallbacks.length === 0) return;
|
|
593
|
+
const callbacks = [...this.shutdownCallbacks].reverse();
|
|
594
|
+
const run = (async () => {
|
|
595
|
+
for (const callback of callbacks) {
|
|
596
|
+
try {
|
|
597
|
+
await callback();
|
|
598
|
+
} catch (error) {
|
|
599
|
+
console.error(error);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return "done";
|
|
603
|
+
})();
|
|
604
|
+
let timer;
|
|
605
|
+
const deadline = new Promise((resolve) => timer = setTimeout(() => resolve("timeout"), SHUTDOWN_TIMEOUT_MS));
|
|
606
|
+
const outcome = await Promise.race([run, deadline]);
|
|
607
|
+
clearTimeout(timer);
|
|
608
|
+
if (outcome === "timeout") {
|
|
609
|
+
console.error(`The shutdown callbacks did not finish within ${SHUTDOWN_TIMEOUT_MS / 1e3} seconds; carrying on with the exit.`);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
198
612
|
async runBoot() {
|
|
199
613
|
for (const callback of this.bootingCallbacks) await callback(this);
|
|
200
614
|
for (let i = 0; i < this.providers.length; i++) await this.bootProvider(this.providers[i]);
|
|
@@ -232,8 +646,16 @@ function toResponse(output) {
|
|
|
232
646
|
export {
|
|
233
647
|
Application,
|
|
234
648
|
ApplicationBuilder,
|
|
649
|
+
ClassNameMap,
|
|
235
650
|
ClosureKernel,
|
|
236
651
|
ProviderBootError,
|
|
237
|
-
ProviderRegisterError
|
|
652
|
+
ProviderRegisterError,
|
|
653
|
+
RenameClasses,
|
|
654
|
+
Vite,
|
|
655
|
+
ViteError,
|
|
656
|
+
ViteHtml,
|
|
657
|
+
currentVite,
|
|
658
|
+
vite,
|
|
659
|
+
viteReactRefresh
|
|
238
660
|
};
|
|
239
661
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../Application.ts","../ApplicationBuilder.ts","../errors.ts","../Http/ClosureKernel.ts"],"sourcesContent":["import { join } from 'node:path'\nimport {\n Application as ApplicationToken,\n ClassRegistry as ClassRegistryToken,\n ConfigRepository,\n HttpKernel,\n type Application as ApplicationContract,\n type ServiceProvider,\n type ServiceProviderClass,\n} from '@orieljs/contracts'\nimport { Container } from '@orieljs/container'\nimport { ClassRegistry, Str } from '@orieljs/support'\nimport { ApplicationBuilder } from './ApplicationBuilder'\nimport { ProviderBootError, ProviderRegisterError } from './errors'\n\ntype LifecycleCallback = (app: ApplicationContract) => void | Promise<void>\n\nexport class Application extends Container implements ApplicationContract {\n readonly version = '0.1.0-alpha.1'\n\n private readonly providers: ServiceProvider[] = []\n private readonly bootingCallbacks: LifecycleCallback[] = []\n private readonly bootedCallbacks: LifecycleCallback[] = []\n private readonly terminatingCallbacks: Array<() => void | Promise<void>> = []\n private bootPromise: Promise<void> | undefined\n private hasBooted = false\n private inConsole = false\n\n constructor(private readonly base: string) {\n super()\n Container.setInstance(this)\n this.instance(ApplicationToken, this)\n // The class too: otherwise inject(Application) would build a second app and hijack the global instance.\n this.instance(Application, this)\n this.singleton(ClassRegistryToken, ClassRegistry)\n }\n\n /** Entry point used by bootstrap/app.ts. */\n static configure(options: { basePath: string }): ApplicationBuilder {\n return new ApplicationBuilder(new Application(options.basePath))\n }\n\n basePath(path = ''): string { return join(this.base, path) }\n appPath(path = ''): string { return this.basePath(join('app', path)) }\n bootstrapPath(path = ''): string { return this.basePath(join('bootstrap', path)) }\n configPath(path = ''): string { return this.basePath(join('config', path)) }\n databasePath(path = ''): string { return this.basePath(join('database', path)) }\n publicPath(path = ''): string { return this.basePath(join('public', path)) }\n resourcePath(path = ''): string { return this.basePath(join('resources', path)) }\n storagePath(path = ''): string { return this.basePath(join('storage', path)) }\n\n environment(): string\n environment(...environments: string[]): boolean\n environment(...environments: string[]): string | boolean {\n const fallback = process.env.APP_ENV ?? 'production'\n const current = this.bound(ConfigRepository)\n ? String(this.make(ConfigRepository).get('app.env', fallback))\n : fallback\n return environments.length === 0 ? current : environments.some((pattern) => Str.is(pattern, current))\n }\n\n isProduction(): boolean { return this.environment('production') }\n isLocal(): boolean { return this.environment('local') }\n runningUnitTests(): boolean { return this.environment('testing') }\n runningInConsole(): boolean { return this.inConsole }\n setRunningInConsole(value = true): void { this.inConsole = value }\n\n async register(provider: ServiceProvider | ServiceProviderClass): Promise<ServiceProvider> {\n const cls = typeof provider === 'function' ? provider : provider.constructor\n const existing = this.providers.find((p) => p.constructor === cls)\n if (existing) return existing\n\n const instance = typeof provider === 'function' ? new provider(this) : provider\n try {\n instance.register?.()\n } catch (error) {\n throw new ProviderRegisterError(instance.constructor.name, error)\n }\n this.providers.push(instance)\n if (this.hasBooted) await this.bootProvider(instance)\n return instance\n }\n\n getProviders(): ServiceProvider[] {\n return [...this.providers]\n }\n\n boot(): Promise<void> {\n return (this.bootPromise ??= this.runBoot())\n }\n\n isBooted(): boolean {\n return this.hasBooted\n }\n\n booting(callback: LifecycleCallback): void {\n this.bootingCallbacks.push(callback)\n }\n\n /** If already booted, the callback runs immediately (a rejection surfaces as an unhandled rejection). */\n booted(callback: LifecycleCallback): void {\n this.bootedCallbacks.push(callback)\n if (this.hasBooted) void callback(this)\n }\n\n terminating(callback: () => void | Promise<void>): void {\n this.terminatingCallbacks.push(callback)\n }\n\n async handle(request: Request): Promise<Response> {\n await this.boot()\n const scope = this.createScope()\n return scope.run(() => scope.make(HttpKernel).handle(request))\n }\n\n async terminate(): Promise<void> {\n for (const callback of this.terminatingCallbacks) await callback()\n }\n\n private async runBoot(): Promise<void> {\n for (const callback of this.bootingCallbacks) await callback(this)\n // Index loop on purpose: providers registered during boot are appended and booted in this pass.\n for (let i = 0; i < this.providers.length; i++) await this.bootProvider(this.providers[i]!)\n this.hasBooted = true\n for (const callback of this.bootedCallbacks) await callback(this)\n }\n\n private async bootProvider(provider: ServiceProvider): Promise<void> {\n try {\n await provider.boot?.()\n } catch (error) {\n throw new ProviderBootError(provider.constructor.name, error)\n }\n }\n}\n","import { isAbsolute, join } from 'node:path'\nimport {\n ConfigRepository,\n ExceptionCallbacks,\n MiddlewareCallbacks,\n RoutingPaths,\n type Application as ApplicationContract,\n type ExceptionsConfigurator,\n type MiddlewareConfigurator,\n type ServiceProvider,\n type ServiceProviderClass,\n} from '@orieljs/contracts'\nimport { loadConfiguration, loadEnvironment, Repository } from '@orieljs/config'\nimport type { Application } from './Application'\n\nexport interface RoutingOptions {\n web?: string\n api?: string\n console?: string\n /** A URI such as '/up', not a file. */\n health?: string\n apiPrefix?: string\n}\n\ntype Lifecycle = (app: ApplicationContract) => void | Promise<void>\n\nexport class ApplicationBuilder {\n private readonly providers: Array<ServiceProvider | ServiceProviderClass> = []\n private readonly middleware: Array<(middleware: MiddlewareConfigurator) => void> = []\n private readonly exceptions: Array<(exceptions: ExceptionsConfigurator) => void> = []\n private routing: RoutingPaths | undefined\n\n constructor(private readonly app: Application) {}\n\n withProviders(providers: Array<ServiceProvider | ServiceProviderClass> = []): this {\n this.providers.push(...providers)\n return this\n }\n\n withRouting(options: RoutingOptions): this {\n const abs = (p?: string) => (p === undefined ? undefined : isAbsolute(p) ? p : join(this.app.basePath(), p))\n const paths: RoutingPaths = { apiPrefix: options.apiPrefix ?? 'api' }\n if (options.web !== undefined) paths.web = abs(options.web)\n if (options.api !== undefined) paths.api = abs(options.api)\n if (options.console !== undefined) paths.console = abs(options.console)\n if (options.health !== undefined) paths.health = options.health\n this.routing = paths\n return this\n }\n\n withMiddleware(callback: (middleware: MiddlewareConfigurator) => void): this {\n this.middleware.push(callback)\n return this\n }\n\n withExceptions(callback: (exceptions: ExceptionsConfigurator) => void): this {\n this.exceptions.push(callback)\n return this\n }\n\n booting(callback: Lifecycle): this {\n this.app.booting(callback)\n return this\n }\n\n booted(callback: Lifecycle): this {\n this.app.booted(callback)\n return this\n }\n\n async create(): Promise<Application> {\n loadEnvironment(this.app.basePath())\n this.app.instance(ConfigRepository, new Repository(await loadConfiguration(this.app.configPath())))\n if (this.routing) this.app.instance(RoutingPaths, this.routing)\n this.app.instance(MiddlewareCallbacks, this.middleware as Array<(configurator: unknown) => void>)\n this.app.instance(ExceptionCallbacks, this.exceptions)\n for (const provider of this.providers) await this.app.register(provider)\n return this.app\n }\n}\n","export class ProviderBootError extends Error {\n override readonly name = 'ProviderBootError'\n constructor(readonly provider: string, cause: unknown) {\n super(`Service provider [${provider}] failed to boot: ${cause instanceof Error ? cause.message : String(cause)}`, { cause })\n }\n}\n\nexport class ProviderRegisterError extends Error {\n override readonly name = 'ProviderRegisterError'\n constructor(readonly provider: string, cause: unknown) {\n super(`Service provider [${provider}] failed to register: ${cause instanceof Error ? cause.message : String(cause)}`, { cause })\n }\n}\n","import type { HttpKernel } from '@orieljs/contracts'\n\ntype Handler = (request: Request) => unknown\n\n/** Wave 0 stand-in for the Http kernel: exact \"METHOD /path\" matching only. Replaced by Wave 1's router. */\nexport class ClosureKernel implements HttpKernel {\n private readonly routes = new Map<string, Handler>()\n\n on(method: string, path: string, handler: Handler): this {\n this.routes.set(`${method.toUpperCase()} ${path}`, handler)\n return this\n }\n\n async handle(request: Request): Promise<Response> {\n const handler = this.routes.get(`${request.method} ${new URL(request.url).pathname}`)\n if (!handler) return new Response('Not Found', { status: 404, headers: { 'content-type': 'text/plain; charset=utf-8' } })\n return toResponse(await handler(request))\n }\n}\n\nfunction toResponse(output: unknown): Response {\n if (output instanceof Response) return output\n if (output === undefined || output === null) return new Response(null, { status: 204 })\n if (typeof output === 'string') return new Response(output, { headers: { 'content-type': 'text/html; charset=utf-8' } })\n return Response.json(output)\n}\n"],"mappings":";AAAA,SAAS,QAAAA,aAAY;AACrB;AAAA,EACE,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,oBAAAC;AAAA,EACA;AAAA,OAIK;AACP,SAAS,iBAAiB;AAC1B,SAAS,eAAe,WAAW;;;ACXnC,SAAS,YAAY,YAAY;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AACP,SAAS,mBAAmB,iBAAiB,kBAAkB;AAcxD,IAAM,qBAAN,MAAyB;AAAA,EAM9B,YAA6B,KAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA,EALZ,YAA2D,CAAC;AAAA,EAC5D,aAAkE,CAAC;AAAA,EACnE,aAAkE,CAAC;AAAA,EAC5E;AAAA,EAIR,cAAc,YAA2D,CAAC,GAAS;AACjF,SAAK,UAAU,KAAK,GAAG,SAAS;AAChC,WAAO;AAAA,EACT;AAAA,EAEA,YAAY,SAA+B;AACzC,UAAM,MAAM,CAAC,MAAgB,MAAM,SAAY,SAAY,WAAW,CAAC,IAAI,IAAI,KAAK,KAAK,IAAI,SAAS,GAAG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;;;AGjIO,IAAM,gBAAN,MAA0C;AAAA,EAC9B,SAAS,oBAAI,IAAqB;AAAA,EAEnD,GAAG,QAAgB,MAAc,SAAwB;AACvD,SAAK,OAAO,IAAI,GAAG,OAAO,YAAY,CAAC,IAAI,IAAI,IAAI,OAAO;AAC1D,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,OAAO,SAAqC;AAChD,UAAM,UAAU,KAAK,OAAO,IAAI,GAAG,QAAQ,MAAM,IAAI,IAAI,IAAI,QAAQ,GAAG,EAAE,QAAQ,EAAE;AACpF,QAAI,CAAC,QAAS,QAAO,IAAI,SAAS,aAAa,EAAE,QAAQ,KAAK,SAAS,EAAE,gBAAgB,4BAA4B,EAAE,CAAC;AACxH,WAAO,WAAW,MAAM,QAAQ,OAAO,CAAC;AAAA,EAC1C;AACF;AAEA,SAAS,WAAW,QAA2B;AAC7C,MAAI,kBAAkB,SAAU,QAAO;AACvC,MAAI,WAAW,UAAa,WAAW,KAAM,QAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;AACtF,MAAI,OAAO,WAAW,SAAU,QAAO,IAAI,SAAS,QAAQ,EAAE,SAAS,EAAE,gBAAgB,2BAA2B,EAAE,CAAC;AACvH,SAAO,SAAS,KAAK,MAAM;AAC7B;","names":["join","ConfigRepository","join","ConfigRepository"]}
|
|
1
|
+
{"version":3,"sources":["../Application.ts","../ApplicationBuilder.ts","../Http/RenameClasses.ts","../ClassNames.ts","../errors.ts","../Vite.ts","../Http/ClosureKernel.ts"],"sourcesContent":["import { join } from 'node:path'\nimport {\n Application as ApplicationToken,\n ClassNames,\n ClassRegistry as ClassRegistryToken,\n ConfigRepository,\n HttpKernel,\n type Application as ApplicationContract,\n type ServiceProvider,\n type ServiceProviderClass,\n} from '@orieljs/contracts'\nimport { Container } from '@orieljs/container'\nimport { ClassRegistry, Str } from '@orieljs/support'\nimport { ApplicationBuilder } from './ApplicationBuilder'\nimport { ClassNameMap } from './ClassNames'\nimport { ProviderBootError, ProviderRegisterError } from './errors'\nimport { Vite } from './Vite'\n\ntype LifecycleCallback = (app: ApplicationContract) => void | Promise<void>\n\n/** How long shutdown() waits for its callbacks before giving up, so a hung close never keeps the process alive. */\nconst SHUTDOWN_TIMEOUT_MS = 10_000\n\nexport class Application extends Container implements ApplicationContract {\n readonly version = '0.1.0-alpha.11'\n\n private readonly providers: ServiceProvider[] = []\n private readonly bootingCallbacks: LifecycleCallback[] = []\n private readonly bootedCallbacks: LifecycleCallback[] = []\n private readonly terminatingCallbacks: Array<() => void | Promise<void>> = []\n private readonly shutdownCallbacks: Array<() => void | Promise<void>> = []\n private shutdownPromise: Promise<void> | undefined\n private bootPromise: Promise<void> | undefined\n private hasBooted = false\n private inConsole = false\n\n constructor(private readonly base: string) {\n super()\n Container.setInstance(this)\n this.instance(ApplicationToken, this)\n // The class too: otherwise inject(Application) would build a second app and hijack the global instance.\n this.instance(Application, this)\n this.singleton(ClassRegistryToken, ClassRegistry)\n // One per request: a CSP nonce set with vite().useCspNonce() must not leak into other requests.\n this.scoped(Vite, () => new Vite(this))\n this.singleton(ClassNames, () => new ClassNameMap(this))\n }\n\n /** Entry point used by bootstrap/app.ts. */\n static configure(options: { basePath: string }): ApplicationBuilder {\n return new ApplicationBuilder(new Application(options.basePath))\n }\n\n basePath(path = ''): string { return join(this.base, path) }\n appPath(path = ''): string { return this.basePath(join('app', path)) }\n bootstrapPath(path = ''): string { return this.basePath(join('bootstrap', path)) }\n configPath(path = ''): string { return this.basePath(join('config', path)) }\n databasePath(path = ''): string { return this.basePath(join('database', path)) }\n publicPath(path = ''): string { return this.basePath(join('public', path)) }\n resourcePath(path = ''): string { return this.basePath(join('resources', path)) }\n storagePath(path = ''): string { return this.basePath(join('storage', path)) }\n\n environment(): string\n environment(...environments: string[]): boolean\n environment(...environments: string[]): string | boolean {\n const fallback = process.env.APP_ENV ?? 'production'\n const current = this.bound(ConfigRepository)\n ? String(this.make(ConfigRepository).get('app.env', fallback))\n : fallback\n return environments.length === 0 ? current : environments.some((pattern) => Str.is(pattern, current))\n }\n\n isProduction(): boolean { return this.environment('production') }\n isLocal(): boolean { return this.environment('local') }\n runningUnitTests(): boolean { return this.environment('testing') }\n runningInConsole(): boolean { return this.inConsole }\n setRunningInConsole(value = true): void { this.inConsole = value }\n\n async register(provider: ServiceProvider | ServiceProviderClass): Promise<ServiceProvider> {\n const cls = typeof provider === 'function' ? provider : provider.constructor\n const existing = this.providers.find((p) => p.constructor === cls)\n if (existing) return existing\n\n const instance = typeof provider === 'function' ? new provider(this) : provider\n try {\n instance.register?.()\n } catch (error) {\n throw new ProviderRegisterError(instance.constructor.name, error)\n }\n this.providers.push(instance)\n if (this.hasBooted) await this.bootProvider(instance)\n return instance\n }\n\n getProviders(): ServiceProvider[] {\n return [...this.providers]\n }\n\n boot(): Promise<void> {\n return (this.bootPromise ??= this.runBoot())\n }\n\n isBooted(): boolean {\n return this.hasBooted\n }\n\n booting(callback: LifecycleCallback): void {\n this.bootingCallbacks.push(callback)\n }\n\n /** If already booted, the callback runs immediately (a rejection surfaces as an unhandled rejection). */\n booted(callback: LifecycleCallback): void {\n this.bootedCallbacks.push(callback)\n if (this.hasBooted) void callback(this)\n }\n\n terminating(callback: () => void | Promise<void>): void {\n this.terminatingCallbacks.push(callback)\n }\n\n async handle(request: Request): Promise<Response> {\n await this.boot()\n const scope = this.createScope()\n return scope.run(() => scope.make(HttpKernel).handle(request))\n }\n\n async terminate(): Promise<void> {\n for (const callback of this.terminatingCallbacks) await callback()\n }\n\n /**\n * A callback for the end of the process (the CLI after its command, the server on SIGTERM): close DB pools, Redis\n * clients and log files. Not in Laravel, whose PHP processes end with each request.\n */\n onShutdown(callback: () => void | Promise<void>): void {\n this.shutdownCallbacks.push(callback)\n }\n\n /**\n * Runs the shutdown callbacks once (a second call returns the same promise), newest first: an app's own callbacks\n * run before the framework closes what they use, then the framework's in the reverse of its providers' order (the\n * queue, database and cache connections close, then the log is written, then the session store closes). A failing\n * callback is printed with console.error (the log may be closed already) and the others still run; after 10 seconds\n * the rest are given up on, so the process can still exit. Never rejects.\n */\n shutdown(): Promise<void> {\n return (this.shutdownPromise ??= this.runShutdown())\n }\n\n private async runShutdown(): Promise<void> {\n if (this.shutdownCallbacks.length === 0) return\n const callbacks = [...this.shutdownCallbacks].reverse()\n const run = (async () => {\n for (const callback of callbacks) {\n try {\n await callback()\n } catch (error) {\n console.error(error)\n }\n }\n return 'done' as const\n })()\n let timer: ReturnType<typeof setTimeout> | undefined\n // Not unref'd: if a callback hangs on a promise and nothing else is left, the process must still reach its exit.\n const deadline = new Promise<'timeout'>((resolve) => (timer = setTimeout(() => resolve('timeout'), SHUTDOWN_TIMEOUT_MS)))\n const outcome = await Promise.race([run, deadline])\n clearTimeout(timer)\n if (outcome === 'timeout') {\n console.error(`The shutdown callbacks did not finish within ${SHUTDOWN_TIMEOUT_MS / 1000} seconds; carrying on with the exit.`)\n }\n }\n\n private async runBoot(): Promise<void> {\n for (const callback of this.bootingCallbacks) await callback(this)\n // Index loop on purpose: providers registered during boot are appended and booted in this pass.\n for (let i = 0; i < this.providers.length; i++) await this.bootProvider(this.providers[i]!)\n this.hasBooted = true\n for (const callback of this.bootedCallbacks) await callback(this)\n }\n\n private async bootProvider(provider: ServiceProvider): Promise<void> {\n try {\n await provider.boot?.()\n } catch (error) {\n throw new ProviderBootError(provider.constructor.name, error)\n }\n }\n}\n","import { isAbsolute, join } from 'node:path'\nimport {\n ConfigRepository,\n ExceptionCallbacks,\n MiddlewareCallbacks,\n RoutingPaths,\n type Application as ApplicationContract,\n type ExceptionsConfigurator,\n type MiddlewareConfigurator,\n type ServiceProvider,\n type ServiceProviderClass,\n} from '@orieljs/contracts'\nimport { loadConfiguration, loadEnvironment, Repository } from '@orieljs/config'\nimport type { Application } from './Application'\nimport { RenameClasses } from './Http/RenameClasses'\n\nexport interface RoutingOptions {\n /** One route file or several, loaded in order: web: ['routes/web.ts', 'routes/settings.ts', 'routes/auth.ts']. */\n web?: string | string[]\n api?: string | string[]\n console?: string\n /** A URI such as '/up', not a file. */\n health?: string\n apiPrefix?: string\n}\n\ntype Lifecycle = (app: ApplicationContract) => void | Promise<void>\n\nexport class ApplicationBuilder {\n private readonly providers: Array<ServiceProvider | ServiceProviderClass> = []\n private readonly middleware: Array<(middleware: MiddlewareConfigurator) => void> = []\n private readonly exceptions: Array<(exceptions: ExceptionsConfigurator) => void> = []\n private routing: RoutingPaths | undefined\n\n constructor(private readonly app: Application) {}\n\n withProviders(providers: Array<ServiceProvider | ServiceProviderClass> = []): this {\n this.providers.push(...providers)\n return this\n }\n\n withRouting(options: RoutingOptions): this {\n const abs = (p: string) => (isAbsolute(p) ? p : join(this.app.basePath(), p))\n const each = (p: string | string[]) => (Array.isArray(p) ? p.map(abs) : abs(p))\n const paths: RoutingPaths = { apiPrefix: options.apiPrefix ?? 'api' }\n if (options.web !== undefined) paths.web = each(options.web)\n if (options.api !== undefined) paths.api = each(options.api)\n if (options.console !== undefined) paths.console = abs(options.console)\n if (options.health !== undefined) paths.health = options.health\n this.routing = paths\n return this\n }\n\n withMiddleware(callback: (middleware: MiddlewareConfigurator) => void): this {\n this.middleware.push(callback)\n return this\n }\n\n withExceptions(callback: (exceptions: ExceptionsConfigurator) => void): this {\n this.exceptions.push(callback)\n return this\n }\n\n booting(callback: Lifecycle): this {\n this.app.booting(callback)\n return this\n }\n\n booted(callback: Lifecycle): this {\n this.app.booted(callback)\n return this\n }\n\n async create(): Promise<Application> {\n loadEnvironment(this.app.basePath())\n this.app.instance(ConfigRepository, new Repository(await loadConfiguration(this.app.configPath())))\n if (this.routing) this.app.instance(RoutingPaths, this.routing)\n // Outermost, so it sees every page as it leaves: the classes of a scrambled build renamed.\n const middleware = [(m: MiddlewareConfigurator) => void m.prepend(RenameClasses), ...this.middleware]\n this.app.instance(MiddlewareCallbacks, middleware as Array<(configurator: unknown) => void>)\n this.app.instance(ExceptionCallbacks, this.exceptions)\n for (const provider of this.providers) await this.app.register(provider)\n return this.app\n }\n}\n","import { ClassNames, Container, type HttpRequest, type Middleware, type Next } from '@orieljs/contracts'\nimport { inject } from '@orieljs/container'\n\n/** Elements whose content isn't markup: a chunk is never cut inside one, so its text is never read as tags. */\nconst RAW_TEXT = /<(script|style|textarea|title|xmp|noembed|noframes)\\b[^>]*>(?![\\s\\S]*<\\/\\1)/i\n\n/**\n * Renames the classes in the HTML pages the app sends, as a scrambled production build renamed them in its CSS\n * (`ClassNames`). JSON, files and every other response are left alone, and so is every page when there's no\n * scrambled build. A streamed page is renamed chunk by chunk, each chunk cut after its last whole tag.\n */\nexport class RenameClasses implements Middleware {\n readonly #container = inject(Container)\n\n async handle(request: HttpRequest, next: Next): Promise<Response> {\n const response = await next(request)\n if (response.body === null || !/^text\\/html\\b/i.test(response.headers.get('content-type') ?? '') || response.headers.has('content-encoding')) return response\n if (!this.#container.bound(ClassNames)) return response\n const classNames = this.#container.make(ClassNames)\n if (!classNames.active) return response\n const headers = new Headers(response.headers)\n headers.delete('content-length')\n return new Response(response.body.pipeThrough(renamer((html) => classNames.html(html))), { status: response.status, statusText: response.statusText, headers })\n }\n}\n\n/** Decodes the page, renames each whole run of tags, and keeps the rest for the next chunk. */\nfunction renamer(rename: (html: string) => string): TransformStream<Uint8Array, Uint8Array> {\n const decoder = new TextDecoder()\n const encoder = new TextEncoder()\n let carry = ''\n return new TransformStream({\n transform(chunk, controller) {\n const text = carry + decoder.decode(chunk, { stream: true })\n const cut = safeCut(text)\n carry = text.slice(cut)\n if (cut > 0) controller.enqueue(encoder.encode(rename(text.slice(0, cut))))\n },\n flush(controller) {\n const text = carry + decoder.decode()\n if (text !== '') controller.enqueue(encoder.encode(rename(text)))\n },\n })\n}\n\n/** Where a chunk of HTML can be cut: after its last `>`, but before a comment or a raw-text element still open there. */\nfunction safeCut(text: string): number {\n let cut = text.lastIndexOf('>') + 1\n if (cut === 0) return 0\n const head = text.slice(0, cut)\n const comment = head.lastIndexOf('<!--')\n if (comment !== -1 && head.indexOf('-->', comment + 4) === -1) cut = comment\n const raw = RAW_TEXT.exec(text.slice(0, cut))\n if (raw !== null) cut = raw.index\n return cut\n}\n","import { existsSync, readFileSync, statSync } from 'node:fs'\nimport type { Application, ClassNames as ClassNamesContract } from '@orieljs/contracts'\nimport { rewriteHtml } from '@orieljs/obfuscate'\n\n/**\n * The class names of a scrambled production build, read from `bootstrap/cache/classes.json`. The file is read again when\n * a new build replaces it, and ignored while `public/hot` exists (the Vite dev server's CSS keeps the names as written)\n * and while the app runs its tests, which check the HTML its views write.\n */\nexport class ClassNameMap implements ClassNamesContract {\n #loaded: { modified: number; classes: Record<string, string> } | undefined\n\n constructor(private readonly app: Application) {}\n\n /** The map, or undefined: no scrambled build, the dev server is running, or the app is running its tests. */\n classes(): Record<string, string> | undefined {\n if (this.#testing() || existsSync(this.app.publicPath('hot'))) return undefined\n const file = this.app.bootstrapPath('cache/classes.json')\n let modified: number\n try {\n modified = statSync(file).mtimeMs\n } catch {\n this.#loaded = undefined\n return undefined\n }\n if (this.#loaded?.modified !== modified) {\n const parsed = JSON.parse(readFileSync(file, 'utf8')) as { classes?: Record<string, string> }\n this.#loaded = { modified, classes: parsed.classes ?? {} }\n }\n return Object.keys(this.#loaded.classes).length === 0 ? undefined : this.#loaded.classes\n }\n\n /** The app runs its tests: Oriel's TestCase sets APP_ENV=testing, which a test that switches app.env leaves set. */\n #testing(): boolean {\n return this.app.runningUnitTests() || process.env.APP_ENV === 'testing'\n }\n\n get active(): boolean {\n return this.classes() !== undefined\n }\n\n html(html: string): string {\n const classes = this.classes()\n return classes === undefined ? html : rewriteHtml(html, classes)\n }\n}\n","export class ProviderBootError extends Error {\n override readonly name = 'ProviderBootError'\n constructor(readonly provider: string, cause: unknown) {\n super(`Service provider [${provider}] failed to boot: ${cause instanceof Error ? cause.message : String(cause)}`, { cause })\n }\n}\n\nexport class ProviderRegisterError extends Error {\n override readonly name = 'ProviderRegisterError'\n constructor(readonly provider: string, cause: unknown) {\n super(`Service provider [${provider}] failed to register: ${cause instanceof Error ? cause.message : String(cause)}`, { cause })\n }\n}\n","import { existsSync, readFileSync, statSync } from 'node:fs'\nimport { createHash, randomBytes } from 'node:crypto'\nimport { join } from 'node:path'\nimport { Application as ApplicationToken, ConfigRepository, HttpRequest, UrlGenerator, type Application, type Htmlable, type OrielError } from '@orieljs/contracts'\nimport { ContainerNotAvailableError, currentContainer } from '@orieljs/container'\n\n/** One entry of Vite's build manifest (vite's ManifestChunk). */\nexport interface ManifestChunk {\n file: string\n src?: string\n name?: string\n isEntry?: boolean\n isDynamicEntry?: boolean\n imports?: string[]\n dynamicImports?: string[]\n css?: string[]\n assets?: string[]\n [key: string]: unknown\n}\nexport type Manifest = Record<string, ManifestChunk>\n\nexport type TagAttributes = Record<string, string | boolean | null | undefined>\nexport type AttributesResolver = (src: string, url: string, chunk: ManifestChunk | undefined, manifest: Manifest | undefined) => TagAttributes\nexport type PreloadAttributesResolver = (src: string, url: string, chunk: ManifestChunk | undefined, manifest: Manifest | undefined) => TagAttributes | false\n\n/** A missing manifest or chunk (Laravel's ViteException / ViteManifestNotFoundException). */\nexport class ViteError extends Error implements OrielError {\n readonly kind = 'Server' as const\n readonly status = 500\n\n constructor(message: string) {\n super(message)\n this.name = 'ViteError'\n }\n}\n\n/** Markup the view renderer emits unescaped (Htmlable; Foundation can't import View's HtmlString). */\nexport class ViteHtml 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\n/**\n * Marks the tags as tracked assets: when o:navigate reaches a page whose tracked URLs changed (a new build), it loads\n * the page in full rather than run the new bundle beside the old one. A tag attribute of `false` takes it off.\n */\nconst TRACKED: TagAttributes = { 'data-navigate-track': true }\nconst CSS_PATH = /\\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\\?[^.]*)?$/\n\n/** Parsed manifests by path, reloaded when the file changes (a long-running server outlives a `vite build`). */\nconst manifests = new Map<string, { mtimeMs: number; manifest: Manifest }>()\n\nconst escapeAttribute = (value: string): string => value.replace(/&/g, '&').replace(/\"/g, '"')\n\n/**\n * Laravel's Illuminate\\Foundation\\Vite: the script, style and preload tags for Vite entry points. While the dev\n * server runs (public/hot holds its URL) it points at the dev server; otherwise it reads public/build/manifest.json.\n */\nexport class Vite {\n #hotFile: string | undefined\n #buildDirectory = 'build'\n #manifestFilename = 'manifest.json'\n #nonce: string | undefined\n #integrityKey: string | false = 'integrity'\n #entryPoints: string[] = []\n readonly #scriptResolvers: AttributesResolver[] = []\n readonly #styleResolvers: AttributesResolver[] = []\n readonly #preloadResolvers: PreloadAttributesResolver[] = []\n #assetPathResolver: ((path: string) => string) | undefined\n readonly #preloaded: Record<string, string[]> = {}\n\n constructor(protected readonly app: Application) {}\n\n // Configuration --------------------------------------------------------------------------------------------\n\n useCspNonce(nonce?: string): string {\n this.#nonce = nonce ?? randomBytes(30).toString('base64url').slice(0, 40)\n return this.#nonce\n }\n\n cspNonce(): string | undefined {\n return this.#nonce\n }\n\n useIntegrityKey(key: string | false): this {\n this.#integrityKey = key\n return this\n }\n\n withEntryPoints(entryPoints: string[]): this {\n this.#entryPoints = entryPoints\n return this\n }\n\n useHotFile(path: string): this {\n this.#hotFile = path\n return this\n }\n\n useBuildDirectory(path: string): this {\n this.#buildDirectory = path\n return this\n }\n\n useManifestFilename(filename: string): this {\n this.#manifestFilename = filename\n return this\n }\n\n useScriptTagAttributes(attributes: TagAttributes | AttributesResolver): this {\n this.#scriptResolvers.push(typeof attributes === 'function' ? attributes : () => attributes)\n return this\n }\n\n useStyleTagAttributes(attributes: TagAttributes | AttributesResolver): this {\n this.#styleResolvers.push(typeof attributes === 'function' ? attributes : () => attributes)\n return this\n }\n\n /** Extra preload attributes; a resolver returning false drops that preload. */\n usePreloadTagAttributes(attributes: TagAttributes | PreloadAttributesResolver | false): this {\n this.#preloadResolvers.push(typeof attributes === 'function' ? attributes : () => attributes)\n return this\n }\n\n createAssetPathsUsing(resolver: (path: string) => string): this {\n this.#assetPathResolver = resolver\n return this\n }\n\n // Dev server -----------------------------------------------------------------------------------------------\n\n hotFile(): string {\n return this.#hotFile ?? this.app.publicPath('hot')\n }\n\n isRunningHot(): boolean {\n return existsSync(this.hotFile())\n }\n\n /** The dev server URL written by @orieljs/vite, or undefined when it isn't running. */\n devServerUrl(): string | undefined {\n return this.isRunningHot() ? readFileSync(this.hotFile(), 'utf8').trimEnd() : undefined\n }\n\n // Tags -----------------------------------------------------------------------------------------------------\n\n /** Laravel's @vite([...]): preloads (styles first), then stylesheets, then scripts. */\n tags(entryPoints: string | string[], buildDirectory = this.#buildDirectory): ViteHtml {\n const entries = [entryPoints].flat()\n if (this.isRunningHot()) {\n return new ViteHtml(['@vite/client', ...entries].map((entry) => this.#tagForChunk(entry, this.#hotAsset(entry), undefined, undefined)).join(''))\n }\n const manifest = this.manifest(buildDirectory)\n const tags: string[] = []\n const preloads: Array<[string, string, ManifestChunk | undefined]> = []\n const cssChunk = (css: string): [string, ManifestChunk | undefined] => {\n const found = Object.entries(manifest).find(([, chunk]) => chunk.file === css)\n return found === undefined ? [css, undefined] : [found[0], found[1]]\n }\n for (const entry of entries) {\n const chunk = this.#chunk(manifest, entry)\n preloads.push([chunk.src ?? entry, this.#assetPath(`${buildDirectory}/${chunk.file}`), chunk])\n for (const name of this.#resolveImports(manifest, chunk)) {\n const imported = manifest[name]!\n preloads.push([name, this.#assetPath(`${buildDirectory}/${imported.file}`), imported])\n for (const css of imported.css ?? []) {\n const [key, partial] = cssChunk(css)\n preloads.push([key, this.#assetPath(`${buildDirectory}/${css}`), partial])\n tags.push(this.#tagForChunk(key, this.#assetPath(`${buildDirectory}/${css}`), partial, manifest))\n }\n }\n tags.push(this.#tagForChunk(entry, this.#assetPath(`${buildDirectory}/${chunk.file}`), chunk, manifest))\n for (const css of chunk.css ?? []) {\n const [key, partial] = cssChunk(css)\n preloads.push([key, this.#assetPath(`${buildDirectory}/${css}`), partial])\n tags.push(this.#tagForChunk(key, this.#assetPath(`${buildDirectory}/${css}`), partial, manifest))\n }\n }\n const uniqueTags = [...new Set(tags)]\n const stylesheets = uniqueTags.filter((tag) => tag.startsWith('<link'))\n const scripts = uniqueTags.filter((tag) => !tag.startsWith('<link'))\n const seen = new Set<string>()\n const uniquePreloads = preloads.filter(([, url]) => (seen.has(url) ? false : (seen.add(url), true)))\n const sorted = [...uniquePreloads.filter(([, url]) => CSS_PATH.test(url)), ...uniquePreloads.filter(([, url]) => !CSS_PATH.test(url))]\n const preloadTags = sorted.map(([src, url, chunk]) => this.#preloadTag(src, url, chunk, manifest))\n return new ViteHtml(preloadTags.join('') + stylesheets.join('') + scripts.join(''))\n }\n\n /** Laravel's @viteReactRefresh: the React Refresh preamble while the dev server runs; nothing otherwise. */\n reactRefresh(): ViteHtml | undefined {\n if (!this.isRunningHot()) return undefined\n const attributes = this.#parseAttributes({ nonce: this.#nonce ?? false })\n return new ViteHtml(\n [\n `<script type=\"module\" ${attributes.join(' ')}>`,\n ` import RefreshRuntime from '${this.#hotAsset('@react-refresh')}'`,\n ' RefreshRuntime.injectIntoGlobalHook(window)',\n ' window.$RefreshReg$ = () => {}',\n ' window.$RefreshSig$ = () => (type) => type',\n ' window.__vite_plugin_react_preamble_installed__ = true',\n '</script>',\n ].join('\\n'),\n )\n }\n\n /** The URL of a processed asset (Vite::asset('resources/images/logo.svg')). */\n asset(path: string, buildDirectory = this.#buildDirectory): string {\n if (this.isRunningHot()) return this.#hotAsset(path)\n return this.#assetPath(`${buildDirectory}/${this.#chunk(this.manifest(buildDirectory), path).file}`)\n }\n\n /** The built file's contents (Vite::content()). */\n content(path: string, buildDirectory = this.#buildDirectory): string {\n const chunk = this.#chunk(this.manifest(buildDirectory), path)\n const file = this.app.publicPath(join(buildDirectory, chunk.file))\n if (!existsSync(file)) throw new ViteError(`Unable to locate file from Vite manifest: ${file}.`)\n return readFileSync(file, 'utf8')\n }\n\n /** md5 of the manifest (a cache-busting asset version); undefined while hot or without a build. */\n manifestHash(buildDirectory = this.#buildDirectory): string | undefined {\n if (this.isRunningHot()) return undefined\n const path = this.manifestPath(buildDirectory)\n return existsSync(path) ? createHash('md5').update(readFileSync(path)).digest('hex') : undefined\n }\n\n manifestPath(buildDirectory = this.#buildDirectory): string {\n return this.app.publicPath(join(buildDirectory, this.#manifestFilename))\n }\n\n manifest(buildDirectory = this.#buildDirectory): Manifest {\n const path = this.manifestPath(buildDirectory)\n if (!existsSync(path)) throw new ViteError(`Vite manifest not found at: ${path}`)\n const { mtimeMs } = statSync(path)\n const cached = manifests.get(path)\n if (cached !== undefined && cached.mtimeMs === mtimeMs) return cached.manifest\n const manifest = JSON.parse(readFileSync(path, 'utf8')) as Manifest\n manifests.set(path, { mtimeMs, manifest })\n return manifest\n }\n\n /** URL → the attributes of the preload tags rendered so far (without href), for Link headers. */\n preloadedAssets(): Record<string, string[]> {\n return { ...this.#preloaded }\n }\n\n /** Renders withEntryPoints() (Vite is Htmlable, like Laravel's). */\n toHtml(): string {\n return this.tags(this.#entryPoints).toHtml()\n }\n\n // Internals ------------------------------------------------------------------------------------------------\n\n #hotAsset(path: string): string {\n return `${this.devServerUrl() ?? ''}/${path}`\n }\n\n #assetPath(path: string): string {\n if (this.#assetPathResolver !== undefined) return this.#assetPathResolver(path)\n if (this.app.bound(UrlGenerator)) return this.app.make(UrlGenerator).asset(path)\n const base = this.app.bound(ConfigRepository) ? this.app.make(ConfigRepository).get<string | null>('app.asset_url', null) : null\n return `${(base ?? '').replace(/\\/+$/, '')}/${path.replace(/^\\/+/, '')}`\n }\n\n #chunk(manifest: Manifest, file: string): ManifestChunk {\n const chunk = manifest[file]\n if (chunk === undefined) throw new ViteError(`Unable to locate file in Vite manifest: ${file}.`)\n return chunk\n }\n\n /** Every static import, depth first, each once. */\n #resolveImports(manifest: Manifest, chunk: ManifestChunk, seen = new Set<string>()): string[] {\n const imports: string[] = []\n for (const name of chunk.imports ?? []) {\n if (seen.has(name)) continue\n seen.add(name)\n imports.push(name)\n const imported = manifest[name]\n if (imported !== undefined) imports.push(...this.#resolveImports(manifest, imported, seen))\n }\n return imports\n }\n\n #tagForChunk(src: string, url: string, chunk: ManifestChunk | undefined, manifest: Manifest | undefined): string {\n if (CSS_PATH.test(url)) {\n const attributes = this.#parseAttributes({ rel: 'stylesheet', href: url, nonce: this.#nonce ?? false, ...TRACKED, ...this.#styleAttributes(src, url, chunk, manifest) })\n return `<link ${attributes.join(' ')} />`\n }\n const attributes = this.#parseAttributes({ type: 'module', src: url, nonce: this.#nonce ?? false, ...TRACKED, ...this.#scriptAttributes(src, url, chunk, manifest) })\n return `<script ${attributes.join(' ')}></script>`\n }\n\n #preloadTag(src: string, url: string, chunk: ManifestChunk | undefined, manifest: Manifest): string {\n const css = CSS_PATH.test(url)\n let attributes: TagAttributes = {\n rel: css ? 'preload' : 'modulepreload',\n as: css ? 'style' : 'script',\n href: url,\n nonce: this.#nonce ?? false,\n crossorigin: (css ? this.#styleAttributes(src, url, chunk, manifest) : this.#scriptAttributes(src, url, chunk, manifest)).crossorigin ?? false,\n }\n if (this.#integrityKey !== false) attributes.integrity = (chunk?.[this.#integrityKey] as string | undefined) ?? false\n for (const resolver of this.#preloadResolvers) {\n const resolved = resolver(src, url, chunk, manifest)\n if (resolved === false) return ''\n attributes = { ...attributes, ...resolved }\n }\n const { href: _href, ...rest } = attributes\n this.#preloaded[url] = this.#parseAttributes(rest)\n return `<link ${this.#parseAttributes(attributes).join(' ')} />`\n }\n\n #scriptAttributes(src: string, url: string, chunk: ManifestChunk | undefined, manifest: Manifest | undefined): TagAttributes {\n let attributes: TagAttributes = this.#integrityKey !== false ? { integrity: (chunk?.[this.#integrityKey] as string | undefined) ?? false } : {}\n for (const resolver of this.#scriptResolvers) attributes = { ...attributes, ...resolver(src, url, chunk, manifest) }\n return attributes\n }\n\n #styleAttributes(src: string, url: string, chunk: ManifestChunk | undefined, manifest: Manifest | undefined): TagAttributes {\n let attributes: TagAttributes = this.#integrityKey !== false ? { integrity: (chunk?.[this.#integrityKey] as string | undefined) ?? false } : {}\n for (const resolver of this.#styleResolvers) attributes = { ...attributes, ...resolver(src, url, chunk, manifest) }\n return attributes\n }\n\n /** false/null/undefined are dropped, true is a bare attribute, anything else name=\"value\". */\n #parseAttributes(attributes: TagAttributes): string[] {\n return Object.entries(attributes)\n .filter(([, value]) => value !== false && value !== null && value !== undefined)\n .map(([name, value]) => (value === true ? name : `${name}=\"${escapeAttribute(String(value))}\"`))\n }\n}\n\n/**\n * The Vite instance for the current context: the request's own (scoped, so a CSP nonce stays in its request),\n * else a fresh one for the application (a mail view rendered by a queue worker).\n */\nexport function currentVite(): Vite {\n const container = currentContainer()\n if (container === undefined) throw new ContainerNotAvailableError('Vite')\n if (container.bound(HttpRequest)) return container.make(Vite)\n return new Vite(container.make(ApplicationToken))\n}\n\n/** vite(['resources/js/app.tsx']) → the tags (Laravel's @vite); vite() → the Vite instance. */\nexport function vite(): Vite\nexport function vite(entryPoints: string | string[], buildDirectory?: string): ViteHtml\nexport function vite(entryPoints?: string | string[], buildDirectory?: string): Vite | ViteHtml {\n const instance = currentVite()\n return entryPoints === undefined ? instance : instance.tags(entryPoints, buildDirectory)\n}\n\n/** Laravel's @viteReactRefresh: put it before vite([...]) in the root view of a React app. */\nexport function viteReactRefresh(): ViteHtml | undefined {\n return currentVite().reactRefresh()\n}\n","import type { HttpKernel } from '@orieljs/contracts'\n\ntype Handler = (request: Request) => unknown\n\n/** Wave 0 stand-in for the Http kernel: exact \"METHOD /path\" matching only. Replaced by Wave 1's router. */\nexport class ClosureKernel implements HttpKernel {\n private readonly routes = new Map<string, Handler>()\n\n on(method: string, path: string, handler: Handler): this {\n this.routes.set(`${method.toUpperCase()} ${path}`, handler)\n return this\n }\n\n async handle(request: Request): Promise<Response> {\n const handler = this.routes.get(`${request.method} ${new URL(request.url).pathname}`)\n if (!handler) return new Response('Not Found', { status: 404, headers: { 'content-type': 'text/plain; charset=utf-8' } })\n return toResponse(await handler(request))\n }\n}\n\nfunction toResponse(output: unknown): Response {\n if (output instanceof Response) return output\n if (output === undefined || output === null) return new Response(null, { status: 204 })\n if (typeof output === 'string') return new Response(output, { headers: { 'content-type': 'text/html; charset=utf-8' } })\n return Response.json(output)\n}\n"],"mappings":";AAAA,SAAS,QAAAA,aAAY;AACrB;AAAA,EACE,eAAeC;AAAA,EACf,cAAAC;AAAA,EACA,iBAAiB;AAAA,EACjB,oBAAAC;AAAA,EACA;AAAA,OAIK;AACP,SAAS,aAAAC,kBAAiB;AAC1B,SAAS,eAAe,WAAW;;;ACZnC,SAAS,YAAY,YAAY;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AACP,SAAS,mBAAmB,iBAAiB,kBAAkB;;;ACZ/D,SAAS,YAAY,iBAA+D;AACpF,SAAS,cAAc;AAGvB,IAAM,WAAW;AAOV,IAAM,gBAAN,MAA0C;AAAA,EACtC,aAAa,OAAO,SAAS;AAAA,EAEtC,MAAM,OAAO,SAAsB,MAA+B;AAChE,UAAM,WAAW,MAAM,KAAK,OAAO;AACnC,QAAI,SAAS,SAAS,QAAQ,CAAC,iBAAiB,KAAK,SAAS,QAAQ,IAAI,cAAc,KAAK,EAAE,KAAK,SAAS,QAAQ,IAAI,kBAAkB,EAAG,QAAO;AACrJ,QAAI,CAAC,KAAK,WAAW,MAAM,UAAU,EAAG,QAAO;AAC/C,UAAM,aAAa,KAAK,WAAW,KAAK,UAAU;AAClD,QAAI,CAAC,WAAW,OAAQ,QAAO;AAC/B,UAAM,UAAU,IAAI,QAAQ,SAAS,OAAO;AAC5C,YAAQ,OAAO,gBAAgB;AAC/B,WAAO,IAAI,SAAS,SAAS,KAAK,YAAY,QAAQ,CAAC,SAAS,WAAW,KAAK,IAAI,CAAC,CAAC,GAAG,EAAE,QAAQ,SAAS,QAAQ,YAAY,SAAS,YAAY,QAAQ,CAAC;AAAA,EAChK;AACF;AAGA,SAAS,QAAQ,QAA2E;AAC1F,QAAM,UAAU,IAAI,YAAY;AAChC,QAAM,UAAU,IAAI,YAAY;AAChC,MAAI,QAAQ;AACZ,SAAO,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WAAO;AAAA,EACT;AAAA,EAEA,MAAM,OAAO,SAAqC;AAChD,UAAM,UAAU,KAAK,OAAO,IAAI,GAAG,QAAQ,MAAM,IAAI,IAAI,IAAI,QAAQ,GAAG,EAAE,QAAQ,EAAE;AACpF,QAAI,CAAC,QAAS,QAAO,IAAI,SAAS,aAAa,EAAE,QAAQ,KAAK,SAAS,EAAE,gBAAgB,4BAA4B,EAAE,CAAC;AACxH,WAAO,WAAW,MAAM,QAAQ,OAAO,CAAC;AAAA,EAC1C;AACF;AAEA,SAAS,WAAW,QAA2B;AAC7C,MAAI,kBAAkB,SAAU,QAAO;AACvC,MAAI,WAAW,UAAa,WAAW,KAAM,QAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;AACtF,MAAI,OAAO,WAAW,SAAU,QAAO,IAAI,SAAS,QAAQ,EAAE,SAAS,EAAE,gBAAgB,2BAA2B,EAAE,CAAC;AACvH,SAAO,SAAS,KAAK,MAAM;AAC7B;","names":["join","ApplicationToken","ClassNames","ConfigRepository","Container","existsSync","readFileSync","statSync","join","ConfigRepository","attributes","Container","ApplicationToken","ClassNames","join","ConfigRepository"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orieljs/foundation",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.11",
|
|
4
4
|
"description": "The Oriel application: service providers, lifecycle and request handling.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
+
"homepage": "https://orieljs.vercel.app",
|
|
7
8
|
"sideEffects": false,
|
|
8
9
|
"repository": {
|
|
9
10
|
"type": "git",
|
|
@@ -26,13 +27,15 @@
|
|
|
26
27
|
"files": [
|
|
27
28
|
"dist",
|
|
28
29
|
"LICENSE",
|
|
29
|
-
"NOTICE"
|
|
30
|
+
"NOTICE",
|
|
31
|
+
"TRADEMARKS.md"
|
|
30
32
|
],
|
|
31
33
|
"dependencies": {
|
|
32
|
-
"@orieljs/config": "0.1.0-alpha.
|
|
33
|
-
"@orieljs/
|
|
34
|
-
"@orieljs/
|
|
35
|
-
"@orieljs/support": "0.1.0-alpha.
|
|
34
|
+
"@orieljs/config": "0.1.0-alpha.11",
|
|
35
|
+
"@orieljs/container": "0.1.0-alpha.11",
|
|
36
|
+
"@orieljs/contracts": "0.1.0-alpha.11",
|
|
37
|
+
"@orieljs/support": "0.1.0-alpha.11",
|
|
38
|
+
"@orieljs/obfuscate": "0.1.0-alpha.11"
|
|
36
39
|
},
|
|
37
40
|
"scripts": {
|
|
38
41
|
"build": "tsup && node ../../../scripts/copy-license.mjs"
|