dsh-skill-harbor 0.5.1 → 0.5.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/dsh.plugin.json +1 -1
- package/lib/index.js +9 -2
- package/lib/routes/index.js +2 -1
- package/package.json +1 -1
- package/src/index.js +9 -2
- package/src/routes/index.js +2 -1
package/dsh.plugin.json
CHANGED
package/lib/index.js
CHANGED
|
@@ -27,8 +27,15 @@ export function apply(ctx, rawConfig = {}) {
|
|
|
27
27
|
installProvider(ctx, config)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
// webServer **不是**静态 inject:它只存在于 Web composition,纯 CLI 里没有。
|
|
31
|
+
// 写进静态 inject 会让无 Web 的 profile 把整插件判成「等不到的依赖」而不激活;
|
|
32
|
+
// 直接读 ctx.webServer 又会撞上 Cordis 的严格代理(`cannot get property
|
|
33
|
+
// "webServer" without inject`,0.5.1 的真实事故)。
|
|
34
|
+
// 因此路由挂在动态注入的子 fiber 上:webServer 就绪才注册,缺席则安静跳过。
|
|
35
|
+
ctx.inject(['skills', 'webServer'], (webCtx) => {
|
|
36
|
+
const disposeRoutes = registerRoutes(webCtx, config)
|
|
37
|
+
webCtx.effect(() => disposeRoutes, 'dsh-skill-harbor.routes')
|
|
38
|
+
})
|
|
32
39
|
|
|
33
40
|
return { name, managementOnly: config.managementOnly }
|
|
34
41
|
}
|
package/lib/routes/index.js
CHANGED
|
@@ -76,7 +76,8 @@ function atomicWrite(path, content) {
|
|
|
76
76
|
export function registerRoutes(ctx, config = {}, deps = {}) {
|
|
77
77
|
const webServer = deps.webServer ?? ctx.webServer
|
|
78
78
|
if (webServer === undefined || webServer === null || typeof webServer.register !== 'function') {
|
|
79
|
-
//
|
|
79
|
+
// 兜底:正常路径由 apply() 的动态注入保证 webServer 就绪(纯 CLI 根本不会进来)。
|
|
80
|
+
// 单测可传 deps.webServer 绕过;形状不符时安静跳过,provider 仍然工作。
|
|
80
81
|
return () => {}
|
|
81
82
|
}
|
|
82
83
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -27,8 +27,15 @@ export function apply(ctx, rawConfig = {}) {
|
|
|
27
27
|
installProvider(ctx, config)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
// webServer **不是**静态 inject:它只存在于 Web composition,纯 CLI 里没有。
|
|
31
|
+
// 写进静态 inject 会让无 Web 的 profile 把整插件判成「等不到的依赖」而不激活;
|
|
32
|
+
// 直接读 ctx.webServer 又会撞上 Cordis 的严格代理(`cannot get property
|
|
33
|
+
// "webServer" without inject`,0.5.1 的真实事故)。
|
|
34
|
+
// 因此路由挂在动态注入的子 fiber 上:webServer 就绪才注册,缺席则安静跳过。
|
|
35
|
+
ctx.inject(['skills', 'webServer'], (webCtx) => {
|
|
36
|
+
const disposeRoutes = registerRoutes(webCtx, config)
|
|
37
|
+
webCtx.effect(() => disposeRoutes, 'dsh-skill-harbor.routes')
|
|
38
|
+
})
|
|
32
39
|
|
|
33
40
|
return { name, managementOnly: config.managementOnly }
|
|
34
41
|
}
|
package/src/routes/index.js
CHANGED
|
@@ -76,7 +76,8 @@ function atomicWrite(path, content) {
|
|
|
76
76
|
export function registerRoutes(ctx, config = {}, deps = {}) {
|
|
77
77
|
const webServer = deps.webServer ?? ctx.webServer
|
|
78
78
|
if (webServer === undefined || webServer === null || typeof webServer.register !== 'function') {
|
|
79
|
-
//
|
|
79
|
+
// 兜底:正常路径由 apply() 的动态注入保证 webServer 就绪(纯 CLI 根本不会进来)。
|
|
80
|
+
// 单测可传 deps.webServer 绕过;形状不符时安静跳过,provider 仍然工作。
|
|
80
81
|
return () => {}
|
|
81
82
|
}
|
|
82
83
|
|