@c9up/aurora 0.1.30 → 0.1.31
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/AuroraProvider.d.ts +1 -14
- package/dist/AuroraProvider.js +4 -4
- package/dist/Pages.d.ts +1 -1
- package/dist/Pages.js +3 -3
- package/package.json +1 -1
- package/src/AuroraProvider.ts +4 -4
- package/src/Pages.ts +3 -3
package/dist/AuroraProvider.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export interface AuroraAppContext {
|
|
|
28
28
|
config: AuroraConfigStore;
|
|
29
29
|
}
|
|
30
30
|
export default class AuroraProvider {
|
|
31
|
+
#private;
|
|
31
32
|
protected app: AuroraAppContext;
|
|
32
33
|
constructor(app: AuroraAppContext);
|
|
33
34
|
register(): void;
|
|
@@ -35,19 +36,5 @@ export default class AuroraProvider {
|
|
|
35
36
|
start(): Promise<void>;
|
|
36
37
|
ready(): Promise<void>;
|
|
37
38
|
shutdown(): Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Resolve the user-supplied config:
|
|
40
|
-
* - relative `pages.root` (e.g. `./resources/pages`) is joined to
|
|
41
|
-
* the project's `appRoot` URL — same convention `modules.path`
|
|
42
|
-
* uses;
|
|
43
|
-
* - absolute paths are passed through;
|
|
44
|
-
* - missing config falls back to `<appRoot>/resources/pages`.
|
|
45
|
-
*
|
|
46
|
-
* `appRoot` is fetched from the container if the host registered
|
|
47
|
-
* one (Ream does, since v0.x — see Ignitor); other hosts get the
|
|
48
|
-
* `process.cwd()` fallback.
|
|
49
|
-
*/
|
|
50
|
-
private resolveConfig;
|
|
51
|
-
private readAppRoot;
|
|
52
39
|
}
|
|
53
40
|
export {};
|
package/dist/AuroraProvider.js
CHANGED
|
@@ -29,7 +29,7 @@ export default class AuroraProvider {
|
|
|
29
29
|
register() {
|
|
30
30
|
this.app.container.singleton(AuroraManager, async () => {
|
|
31
31
|
const raw = this.app.config.get("aurora");
|
|
32
|
-
const config = await this
|
|
32
|
+
const config = await this.#resolveConfig(raw);
|
|
33
33
|
const manager = new AuroraManager(config);
|
|
34
34
|
setAurora(manager);
|
|
35
35
|
return manager;
|
|
@@ -89,8 +89,8 @@ export default class AuroraProvider {
|
|
|
89
89
|
* one (Ream does, since v0.x — see Ignitor); other hosts get the
|
|
90
90
|
* `process.cwd()` fallback.
|
|
91
91
|
*/
|
|
92
|
-
async resolveConfig(raw) {
|
|
93
|
-
const appRoot = await this
|
|
92
|
+
async #resolveConfig(raw) {
|
|
93
|
+
const appRoot = await this.#readAppRoot();
|
|
94
94
|
const userRoot = raw?.pages?.root;
|
|
95
95
|
const root = typeof userRoot === "string" && userRoot.length > 0
|
|
96
96
|
? isAbsolute(userRoot)
|
|
@@ -102,7 +102,7 @@ export default class AuroraProvider {
|
|
|
102
102
|
pages: { ...(raw?.pages ?? {}), root },
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
async readAppRoot() {
|
|
105
|
+
async #readAppRoot() {
|
|
106
106
|
try {
|
|
107
107
|
const raw = await this.app.container.resolve("appRoot");
|
|
108
108
|
if (raw instanceof URL)
|
package/dist/Pages.d.ts
CHANGED
|
@@ -45,10 +45,10 @@ export interface PagesConfig {
|
|
|
45
45
|
* call `register()` to short-circuit the disk lookup.
|
|
46
46
|
*/
|
|
47
47
|
export declare class Pages {
|
|
48
|
+
#private;
|
|
48
49
|
readonly root: string;
|
|
49
50
|
readonly urlPrefix: string;
|
|
50
51
|
readonly extension: string;
|
|
51
|
-
private readonly registry;
|
|
52
52
|
constructor(config: PagesConfig);
|
|
53
53
|
/**
|
|
54
54
|
* Pre-register a page factory under `name`, bypassing the disk
|
package/dist/Pages.js
CHANGED
|
@@ -26,7 +26,7 @@ export class Pages {
|
|
|
26
26
|
root;
|
|
27
27
|
urlPrefix;
|
|
28
28
|
extension;
|
|
29
|
-
registry = new Map();
|
|
29
|
+
#registry = new Map();
|
|
30
30
|
constructor(config) {
|
|
31
31
|
// Normalize the root ONCE so the `startsWith(root + sep)` containment
|
|
32
32
|
// check below compares like-for-like against the resolved page path.
|
|
@@ -47,7 +47,7 @@ export class Pages {
|
|
|
47
47
|
* back as `unknown` — the renderer JSON.stringifies them either way.
|
|
48
48
|
*/
|
|
49
49
|
register(name, factory) {
|
|
50
|
-
this
|
|
50
|
+
this.#registry.set(name, factory);
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Resolve a page name to its factory function. Throws when the
|
|
@@ -58,7 +58,7 @@ export class Pages {
|
|
|
58
58
|
* under `root` — defense in depth against URL-decoding tricks.
|
|
59
59
|
*/
|
|
60
60
|
async resolve(name) {
|
|
61
|
-
const preset = this
|
|
61
|
+
const preset = this.#registry.get(name);
|
|
62
62
|
if (preset)
|
|
63
63
|
return preset;
|
|
64
64
|
assertSafeName(name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c9up/aurora",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"description": "Aurora — reactive UI runtime for the Ream framework. Tagged-template DOM, signal-based state, isomorphic SSR + hydration, zero build step.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/AuroraProvider.ts
CHANGED
|
@@ -54,7 +54,7 @@ export default class AuroraProvider {
|
|
|
54
54
|
register(): void {
|
|
55
55
|
this.app.container.singleton(AuroraManager, async () => {
|
|
56
56
|
const raw = this.app.config.get<AuroraManagerConfig>("aurora");
|
|
57
|
-
const config = await this
|
|
57
|
+
const config = await this.#resolveConfig(raw);
|
|
58
58
|
const manager = new AuroraManager(config);
|
|
59
59
|
setAurora(manager);
|
|
60
60
|
return manager;
|
|
@@ -127,10 +127,10 @@ export default class AuroraProvider {
|
|
|
127
127
|
* one (Ream does, since v0.x — see Ignitor); other hosts get the
|
|
128
128
|
* `process.cwd()` fallback.
|
|
129
129
|
*/
|
|
130
|
-
|
|
130
|
+
async #resolveConfig(
|
|
131
131
|
raw: AuroraManagerConfig | undefined,
|
|
132
132
|
): Promise<AuroraManagerConfig> {
|
|
133
|
-
const appRoot = await this
|
|
133
|
+
const appRoot = await this.#readAppRoot();
|
|
134
134
|
const userRoot = raw?.pages?.root;
|
|
135
135
|
const root =
|
|
136
136
|
typeof userRoot === "string" && userRoot.length > 0
|
|
@@ -144,7 +144,7 @@ export default class AuroraProvider {
|
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
async #readAppRoot(): Promise<string> {
|
|
148
148
|
try {
|
|
149
149
|
const raw = await this.app.container.resolve<unknown>("appRoot");
|
|
150
150
|
if (raw instanceof URL) return fileURLToPath(raw);
|
package/src/Pages.ts
CHANGED
|
@@ -59,7 +59,7 @@ export class Pages {
|
|
|
59
59
|
readonly urlPrefix: string;
|
|
60
60
|
readonly extension: string;
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
readonly #registry = new Map<string, PageFactory>();
|
|
63
63
|
|
|
64
64
|
constructor(config: PagesConfig) {
|
|
65
65
|
// Normalize the root ONCE so the `startsWith(root + sep)` containment
|
|
@@ -82,7 +82,7 @@ export class Pages {
|
|
|
82
82
|
* back as `unknown` — the renderer JSON.stringifies them either way.
|
|
83
83
|
*/
|
|
84
84
|
register<P>(name: string, factory: PageFactory<P>): void {
|
|
85
|
-
this
|
|
85
|
+
this.#registry.set(name, factory as PageFactory);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/**
|
|
@@ -94,7 +94,7 @@ export class Pages {
|
|
|
94
94
|
* under `root` — defense in depth against URL-decoding tricks.
|
|
95
95
|
*/
|
|
96
96
|
async resolve(name: string): Promise<PageFactory> {
|
|
97
|
-
const preset = this
|
|
97
|
+
const preset = this.#registry.get(name);
|
|
98
98
|
if (preset) return preset;
|
|
99
99
|
|
|
100
100
|
assertSafeName(name);
|