@c9up/aurora 0.1.24 → 0.1.25
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 -1
- package/dist/AuroraProvider.js +9 -9
- package/package.json +1 -1
- package/src/AuroraProvider.ts +13 -11
package/dist/AuroraProvider.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
interface AuroraContainer {
|
|
19
19
|
singleton(token: unknown, factory: () => unknown): void;
|
|
20
|
-
resolve<T = unknown>(token: unknown): T
|
|
20
|
+
resolve<T = unknown>(token: unknown): Promise<T>;
|
|
21
21
|
has(token: unknown): boolean;
|
|
22
22
|
}
|
|
23
23
|
interface AuroraConfigStore {
|
package/dist/AuroraProvider.js
CHANGED
|
@@ -27,9 +27,9 @@ export default class AuroraProvider {
|
|
|
27
27
|
this.app = app;
|
|
28
28
|
}
|
|
29
29
|
register() {
|
|
30
|
-
this.app.container.singleton(AuroraManager, () => {
|
|
30
|
+
this.app.container.singleton(AuroraManager, async () => {
|
|
31
31
|
const raw = this.app.config.get("aurora");
|
|
32
|
-
const config = this.resolveConfig(raw);
|
|
32
|
+
const config = await this.resolveConfig(raw);
|
|
33
33
|
const manager = new AuroraManager(config);
|
|
34
34
|
setAurora(manager);
|
|
35
35
|
return manager;
|
|
@@ -44,7 +44,7 @@ export default class AuroraProvider {
|
|
|
44
44
|
async boot() {
|
|
45
45
|
// Force-resolve so `setAurora` runs even if the app never
|
|
46
46
|
// touches the singleton from a preload.
|
|
47
|
-
const manager = this.app.container.resolve(AuroraManager);
|
|
47
|
+
const manager = await this.app.container.resolve(AuroraManager);
|
|
48
48
|
setAurora(manager);
|
|
49
49
|
}
|
|
50
50
|
async start() {
|
|
@@ -61,8 +61,8 @@ export default class AuroraProvider {
|
|
|
61
61
|
// instead of being misread as "the asset routes just stopped mounting".
|
|
62
62
|
if (!this.app.container.has("router"))
|
|
63
63
|
return;
|
|
64
|
-
const router = this.app.container.resolve("router");
|
|
65
|
-
const manager = this.app.container.resolve(AuroraManager);
|
|
64
|
+
const router = await this.app.container.resolve("router");
|
|
65
|
+
const manager = await this.app.container.resolve(AuroraManager);
|
|
66
66
|
// Mount paths derive from the configured `assetsPrefix` (default
|
|
67
67
|
// `/__assets`) — set `config.aurora.assetsPrefix` to change the scheme.
|
|
68
68
|
router.get(`${manager.auroraAssetPath}/*`, adaptHandler(manager.auroraAssetsHandler()));
|
|
@@ -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
|
-
resolveConfig(raw) {
|
|
93
|
-
const appRoot = this.readAppRoot();
|
|
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,9 +102,9 @@ export default class AuroraProvider {
|
|
|
102
102
|
pages: { ...(raw?.pages ?? {}), root },
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
readAppRoot() {
|
|
105
|
+
async readAppRoot() {
|
|
106
106
|
try {
|
|
107
|
-
const raw = this.app.container.resolve("appRoot");
|
|
107
|
+
const raw = await this.app.container.resolve("appRoot");
|
|
108
108
|
if (raw instanceof URL)
|
|
109
109
|
return fileURLToPath(raw);
|
|
110
110
|
if (typeof raw === "string")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c9up/aurora",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
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
|
@@ -30,7 +30,7 @@ import { renderToString } from "./ssr.js";
|
|
|
30
30
|
|
|
31
31
|
interface AuroraContainer {
|
|
32
32
|
singleton(token: unknown, factory: () => unknown): void;
|
|
33
|
-
resolve<T = unknown>(token: unknown): T
|
|
33
|
+
resolve<T = unknown>(token: unknown): Promise<T>;
|
|
34
34
|
has(token: unknown): boolean;
|
|
35
35
|
}
|
|
36
36
|
interface AuroraConfigStore {
|
|
@@ -52,9 +52,9 @@ export default class AuroraProvider {
|
|
|
52
52
|
constructor(protected app: AuroraAppContext) {}
|
|
53
53
|
|
|
54
54
|
register(): void {
|
|
55
|
-
this.app.container.singleton(AuroraManager, () => {
|
|
55
|
+
this.app.container.singleton(AuroraManager, async () => {
|
|
56
56
|
const raw = this.app.config.get<AuroraManagerConfig>("aurora");
|
|
57
|
-
const config = this.resolveConfig(raw);
|
|
57
|
+
const config = await this.resolveConfig(raw);
|
|
58
58
|
const manager = new AuroraManager(config);
|
|
59
59
|
setAurora(manager);
|
|
60
60
|
return manager;
|
|
@@ -72,7 +72,8 @@ export default class AuroraProvider {
|
|
|
72
72
|
async boot(): Promise<void> {
|
|
73
73
|
// Force-resolve so `setAurora` runs even if the app never
|
|
74
74
|
// touches the singleton from a preload.
|
|
75
|
-
const manager =
|
|
75
|
+
const manager =
|
|
76
|
+
await this.app.container.resolve<AuroraManager>(AuroraManager);
|
|
76
77
|
setAurora(manager);
|
|
77
78
|
}
|
|
78
79
|
|
|
@@ -89,8 +90,9 @@ export default class AuroraProvider {
|
|
|
89
90
|
// failures (slug collision, AuroraManager crash) propagate with a stack
|
|
90
91
|
// instead of being misread as "the asset routes just stopped mounting".
|
|
91
92
|
if (!this.app.container.has("router")) return;
|
|
92
|
-
const router = this.app.container.resolve<ReamRouter>("router");
|
|
93
|
-
const manager =
|
|
93
|
+
const router = await this.app.container.resolve<ReamRouter>("router");
|
|
94
|
+
const manager =
|
|
95
|
+
await this.app.container.resolve<AuroraManager>(AuroraManager);
|
|
94
96
|
// Mount paths derive from the configured `assetsPrefix` (default
|
|
95
97
|
// `/__assets`) — set `config.aurora.assetsPrefix` to change the scheme.
|
|
96
98
|
router.get(
|
|
@@ -125,10 +127,10 @@ export default class AuroraProvider {
|
|
|
125
127
|
* one (Ream does, since v0.x — see Ignitor); other hosts get the
|
|
126
128
|
* `process.cwd()` fallback.
|
|
127
129
|
*/
|
|
128
|
-
private resolveConfig(
|
|
130
|
+
private async resolveConfig(
|
|
129
131
|
raw: AuroraManagerConfig | undefined,
|
|
130
|
-
): AuroraManagerConfig {
|
|
131
|
-
const appRoot = this.readAppRoot();
|
|
132
|
+
): Promise<AuroraManagerConfig> {
|
|
133
|
+
const appRoot = await this.readAppRoot();
|
|
132
134
|
const userRoot = raw?.pages?.root;
|
|
133
135
|
const root =
|
|
134
136
|
typeof userRoot === "string" && userRoot.length > 0
|
|
@@ -142,9 +144,9 @@ export default class AuroraProvider {
|
|
|
142
144
|
};
|
|
143
145
|
}
|
|
144
146
|
|
|
145
|
-
private readAppRoot(): string {
|
|
147
|
+
private async readAppRoot(): Promise<string> {
|
|
146
148
|
try {
|
|
147
|
-
const raw = this.app.container.resolve<unknown>("appRoot");
|
|
149
|
+
const raw = await this.app.container.resolve<unknown>("appRoot");
|
|
148
150
|
if (raw instanceof URL) return fileURLToPath(raw);
|
|
149
151
|
if (typeof raw === "string") return raw;
|
|
150
152
|
} catch {
|