@oneie/frontend 0.1.0 → 0.1.2
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/package.json +17 -2
- package/src/config.ts +17 -1
- package/tsconfig.json +1 -1
package/package.json
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneie/frontend",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "defineOne()
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Astro integration that connects a site to the ONE substrate — one defineOne() config surface that wires in the blog, docs, pages and tracking plugins.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"astro-integration",
|
|
8
|
+
"astro",
|
|
9
|
+
"withastro",
|
|
10
|
+
"one",
|
|
11
|
+
"substrate",
|
|
12
|
+
"plugins",
|
|
13
|
+
"typescript"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/one-ie/one",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/one-ie/packages.git",
|
|
19
|
+
"directory": "frontend"
|
|
20
|
+
},
|
|
6
21
|
"type": "module",
|
|
7
22
|
"main": "src/index.ts",
|
|
8
23
|
"exports": {
|
package/src/config.ts
CHANGED
|
@@ -46,7 +46,8 @@ export function defineOne(config: OneConfig): AstroIntegration {
|
|
|
46
46
|
return {
|
|
47
47
|
name: '@oneie/frontend',
|
|
48
48
|
hooks: {
|
|
49
|
-
'astro:config:setup': (
|
|
49
|
+
'astro:config:setup': async (params) => {
|
|
50
|
+
const { updateConfig, logger } = params
|
|
50
51
|
const plugins = config.plugins ?? []
|
|
51
52
|
|
|
52
53
|
// Validate each plugin's config slice
|
|
@@ -56,6 +57,21 @@ export function defineOne(config: OneConfig): AstroIntegration {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
// Merge each plugin's own AstroIntegration into THIS build pass —
|
|
61
|
+
// Astro resolves the integrations array before any 'astro:config:setup'
|
|
62
|
+
// runs, so a nested integration can't just be pushed onto config; its
|
|
63
|
+
// hooks are invoked directly here, given the same params this hook
|
|
64
|
+
// received (injectRoute, updateConfig, addRenderer, ...).
|
|
65
|
+
for (const plugin of plugins) {
|
|
66
|
+
if (!plugin.integration) continue
|
|
67
|
+
const childIntegration = plugin.integration(undefined as never)
|
|
68
|
+
const setup = childIntegration.hooks?.['astro:config:setup']
|
|
69
|
+
if (setup) {
|
|
70
|
+
logger.debug(`[one] merging integration: ${plugin.name}`)
|
|
71
|
+
await setup(params)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
59
75
|
// Expose resolved config as virtual module
|
|
60
76
|
updateConfig({
|
|
61
77
|
vite: {
|
package/tsconfig.json
CHANGED