@orieljs/framework 0.1.0-alpha.2 → 0.1.0-alpha.4
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-TIE5OAMF.js → chunk-3DETYZMZ.js} +7 -3
- package/dist/{chunk-TIE5OAMF.js.map → chunk-3DETYZMZ.js.map} +1 -1
- package/dist/{chunk-IRHK7GH7.js → chunk-DCI2T7WJ.js} +24 -3
- package/dist/chunk-DCI2T7WJ.js.map +1 -0
- package/dist/{chunk-UPZAML2Q.js → chunk-SBZQ6L3Z.js} +3312 -196
- package/dist/chunk-SBZQ6L3Z.js.map +1 -0
- package/dist/{chunk-3ZRPBRAE.js → chunk-WSGWYXAO.js} +3 -1
- package/dist/chunk-WSGWYXAO.js.map +1 -0
- package/dist/contracts.d.ts +185 -144
- package/dist/contracts.js +3 -1
- package/dist/index.d-DOlTeG-8.d.ts +99 -0
- package/dist/index.d.ts +593 -326
- package/dist/index.js +844 -2053
- package/dist/index.js.map +1 -1
- package/dist/{jsx-runtime-CZ6JqBQo.d.ts → jsx-runtime-WKTl3EEw.d.ts} +8 -99
- package/dist/jsx-runtime.d.ts +2 -1
- package/dist/jsx-runtime.js +3 -3
- package/dist/testing-D3dCOkTm.d.ts +2190 -0
- package/dist/testing.d.ts +3 -1553
- package/dist/testing.js +7 -3
- package/package.json +31 -29
- package/dist/chunk-3ZRPBRAE.js.map +0 -1
- package/dist/chunk-IRHK7GH7.js.map +0 -1
- package/dist/chunk-UPZAML2Q.js.map +0 -1
|
@@ -1,100 +1,5 @@
|
|
|
1
|
-
import { Token
|
|
2
|
-
|
|
3
|
-
/** A typed, runtime-unique key for container bindings. */
|
|
4
|
-
interface Token<T> {
|
|
5
|
-
readonly id: symbol;
|
|
6
|
-
readonly description: string;
|
|
7
|
-
/** Phantom field: only carries T at the type level. Never set at runtime. */
|
|
8
|
-
readonly __type?: T;
|
|
9
|
-
}
|
|
10
|
-
type Class<T> = abstract new (...args: any[]) => T;
|
|
11
|
-
type Abstract<T> = Token<T> | Class<T>;
|
|
12
|
-
type Factory$1<T> = (container: Container) => T;
|
|
13
|
-
type Concrete<T> = Factory$1<T> | (new () => T);
|
|
14
|
-
interface Container {
|
|
15
|
-
/** New instance on every make(). A class with no concrete binds to itself (constructed with no args). Root only; throws on a scope. */
|
|
16
|
-
bind<T>(abstract: Abstract<T>, concrete?: Concrete<T>): void;
|
|
17
|
-
/** One instance for the life of this container and its scopes. Root only; throws on a scope. */
|
|
18
|
-
singleton<T>(abstract: Abstract<T>, concrete?: Concrete<T>): void;
|
|
19
|
-
/** One instance per scope (e.g. per HTTP request or queue job). Root only; throws on a scope. */
|
|
20
|
-
scoped<T>(abstract: Abstract<T>, concrete?: Concrete<T>): void;
|
|
21
|
-
/** Register an existing object as a shared instance. Returns it. On a scope it stays local to that scope. */
|
|
22
|
-
instance<T>(abstract: Abstract<T>, instance: T): T;
|
|
23
|
-
/** Resolve. Unbound classes are constructed with `new Class()`. Unbound tokens throw BindingResolutionError. */
|
|
24
|
-
make<T>(abstract: Abstract<T>): T;
|
|
25
|
-
bound(abstract: Abstract<unknown>): boolean;
|
|
26
|
-
resolved(abstract: Abstract<unknown>): boolean;
|
|
27
|
-
/** Decorate or replace an instance each time it's resolved (applied before resolving callbacks). Root only; throws on a scope. */
|
|
28
|
-
extend<T>(abstract: Abstract<T>, extender: (instance: T, container: Container) => T): void;
|
|
29
|
-
/** Called after each resolution of the abstract. Root only; throws on a scope. */
|
|
30
|
-
resolving<T>(abstract: Abstract<T>, callback: (instance: T, container: Container) => void): void;
|
|
31
|
-
forgetInstance(abstract: Abstract<unknown>): void;
|
|
32
|
-
/** A child container: shares bindings and singletons with its parent, and has its own scoped instances. Bindings can't be registered on it. */
|
|
33
|
-
createScope(): Container;
|
|
34
|
-
/** Run fn with this container as the "current" one for inject(), helpers and facades (AsyncLocalStorage). */
|
|
35
|
-
run<R>(fn: () => R): R;
|
|
36
|
-
}
|
|
37
|
-
declare const Container: Token<Container>;
|
|
38
|
-
|
|
39
|
-
interface ServiceProvider$1 {
|
|
40
|
-
/** Bind things into the container. Synchronous. Don't resolve other services here. */
|
|
41
|
-
register?(): void;
|
|
42
|
-
/** Runs after every provider is registered. May be async (e.g. importing route files). */
|
|
43
|
-
boot?(): void | Promise<void>;
|
|
44
|
-
}
|
|
45
|
-
type ServiceProviderClass = new (app: Application) => ServiceProvider$1;
|
|
46
|
-
interface Application extends Container {
|
|
47
|
-
readonly version: string;
|
|
48
|
-
basePath(path?: string): string;
|
|
49
|
-
appPath(path?: string): string;
|
|
50
|
-
bootstrapPath(path?: string): string;
|
|
51
|
-
configPath(path?: string): string;
|
|
52
|
-
databasePath(path?: string): string;
|
|
53
|
-
publicPath(path?: string): string;
|
|
54
|
-
resourcePath(path?: string): string;
|
|
55
|
-
storagePath(path?: string): string;
|
|
56
|
-
/** With no args returns the environment name. With args returns whether it matches any of them. */
|
|
57
|
-
environment(): string;
|
|
58
|
-
environment(...environments: string[]): boolean;
|
|
59
|
-
isProduction(): boolean;
|
|
60
|
-
isLocal(): boolean;
|
|
61
|
-
runningInConsole(): boolean;
|
|
62
|
-
/** Mark the app as running in the console (the CLI entry point calls this). Defaults to true. */
|
|
63
|
-
setRunningInConsole(value?: boolean): void;
|
|
64
|
-
runningUnitTests(): boolean;
|
|
65
|
-
/** Registers the provider. If the app is already booted, the provider is booted immediately. */
|
|
66
|
-
register(provider: ServiceProvider$1 | ServiceProviderClass): Promise<ServiceProvider$1>;
|
|
67
|
-
getProviders(): ServiceProvider$1[];
|
|
68
|
-
boot(): Promise<void>;
|
|
69
|
-
isBooted(): boolean;
|
|
70
|
-
booting(callback: (app: Application) => void | Promise<void>): void;
|
|
71
|
-
booted(callback: (app: Application) => void | Promise<void>): void;
|
|
72
|
-
/** Handle one HTTP request in a fresh request scope via the bound HttpKernel. */
|
|
73
|
-
handle(request: Request): Promise<Response>;
|
|
74
|
-
/** Register a callback that terminate() runs, in registration order. */
|
|
75
|
-
terminating(callback: () => void | Promise<void>): void;
|
|
76
|
-
terminate(): Promise<void>;
|
|
77
|
-
}
|
|
78
|
-
declare const Application: Token$1<Application>;
|
|
79
|
-
|
|
80
|
-
interface ConfigRepository {
|
|
81
|
-
has(key: string): boolean;
|
|
82
|
-
/** Dot notation: get('database.connections.sqlite.database'). */
|
|
83
|
-
get<T = unknown>(key: string, defaultValue?: T): T;
|
|
84
|
-
set(key: string, value: unknown): void;
|
|
85
|
-
set(values: Record<string, unknown>): void;
|
|
86
|
-
push(key: string, value: unknown): void;
|
|
87
|
-
all(): Record<string, unknown>;
|
|
88
|
-
}
|
|
89
|
-
declare const ConfigRepository: Token$1<ConfigRepository>;
|
|
90
|
-
interface ClassRegistry {
|
|
91
|
-
/** Registers under `name` (default: cls.name). Throws if the name is already taken by a different class. */
|
|
92
|
-
register(cls: Class<unknown>, name?: string): string;
|
|
93
|
-
nameOf(cls: Class<unknown>): string | undefined;
|
|
94
|
-
resolve<T = unknown>(name: string): Class<T>;
|
|
95
|
-
has(name: string): boolean;
|
|
96
|
-
}
|
|
97
|
-
declare const ClassRegistry: Token$1<ClassRegistry>;
|
|
1
|
+
import { Token } from './contracts.js';
|
|
2
|
+
import { S as ServiceProvider$1, A as Application } from './index.d-DOlTeG-8.js';
|
|
98
3
|
|
|
99
4
|
interface Htmlable {
|
|
100
5
|
toHtml(): string;
|
|
@@ -111,8 +16,10 @@ interface ViewFactory {
|
|
|
111
16
|
exists(name: string): boolean;
|
|
112
17
|
share(key: string | Record<string, unknown>, value?: unknown): void;
|
|
113
18
|
composer(views: string | string[], composer: (view: View$1) => void | Promise<void>): void;
|
|
19
|
+
/** Renders TSX (an element, a string, an Htmlable, a View, promises of them) to HTML, like Blade::render(). */
|
|
20
|
+
renderToString(node: unknown): Promise<string>;
|
|
114
21
|
}
|
|
115
|
-
declare const ViewFactory: Token
|
|
22
|
+
declare const ViewFactory: Token<ViewFactory>;
|
|
116
23
|
|
|
117
24
|
type ErrorKind = 'Http' | 'Server' | 'ModelNotFound' | 'Validation' | 'Authentication' | 'Authorization' | 'TokenMismatch' | 'BindingResolution' | 'CircularDependency' | 'ContainerNotAvailable';
|
|
118
25
|
/** Every error thrown by the framework implements this. The exception handler switches on `kind`. */
|
|
@@ -319,6 +226,8 @@ declare class Factory implements ViewFactory, ViewEnvironment {
|
|
|
319
226
|
/** Runs before matching views render. Patterns use `*` wildcards: 'posts.*', '*'. */
|
|
320
227
|
composer(views: string | string[], composer: Composer): void;
|
|
321
228
|
callComposer(view: View$1): Promise<void>;
|
|
229
|
+
/** Renders TSX, a string, an Htmlable or a View (or promises of them) to HTML, like Laravel's Blade::render(). */
|
|
230
|
+
renderToString(node: unknown): Promise<string>;
|
|
322
231
|
/** Imports the view file (Node's module cache keeps it) and returns its default-export component. */
|
|
323
232
|
load(path: string, name: string): Promise<Component>;
|
|
324
233
|
addLocation(path: string): void;
|
|
@@ -342,4 +251,4 @@ declare class ViewServiceProvider extends ServiceProvider {
|
|
|
342
251
|
register(): void;
|
|
343
252
|
}
|
|
344
253
|
|
|
345
|
-
export {
|
|
254
|
+
export { type ClassValue as C, ELEMENT as E, FileViewFinder as F, type HtmlAttributes as H, InvalidViewError as I, JSX as J, type OrielElement as O, type Props as P, type Renderable as R, type StyleObject as S, TsxView as T, View as V, Fragment as a, HtmlString as b, type Component as c, type ViewEnvironment as d, Factory as e, ViewNotFoundError as f, ViewRenderError as g, ViewServiceProvider as h, classNames as i, createElement as j, csrfField as k, e as l, isElement as m, isHtmlable as n, methodField as o, renderToStream as p, renderToString as q, raw as r, styleString as s, jsx as t, jsxs as u, view as v };
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a as Fragment, H as HtmlAttributes, J as JSX, t as jsx, u as jsxs } from './jsx-runtime-WKTl3EEw.js';
|
|
2
2
|
import './contracts.js';
|
|
3
|
+
import './index.d-DOlTeG-8.js';
|
package/dist/jsx-runtime.js
CHANGED