@ecopages/kitajs 0.2.0-alpha.10 → 0.2.0-alpha.11
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/CHANGELOG.md +1 -1
- package/package.json +2 -2
- package/src/kitajs-renderer.js +5 -3
- package/src/kitajs.plugin.d.ts +2 -1
- package/src/kitajs.plugin.js +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,7 @@ All notable changes to `@ecopages/kitajs` are documented here.
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
|
-
- Fixed
|
|
11
|
+
- Fixed direct `ctx.render()` flows and mixed-integration Kita boundaries to resolve through the marker pipeline.
|
|
12
12
|
|
|
13
13
|
### Features
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/kitajs",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.11",
|
|
4
4
|
"description": "Kitajs plugin for Ecopages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ecopages",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"directory": "packages/integrations/kitajs"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@ecopages/core": "0.2.0-alpha.
|
|
20
|
+
"@ecopages/core": "0.2.0-alpha.11",
|
|
21
21
|
"@kitajs/html": "^4.1.0",
|
|
22
22
|
"@kitajs/ts-html-plugin": "^4.0.1"
|
|
23
23
|
}
|
package/src/kitajs-renderer.js
CHANGED
|
@@ -36,7 +36,8 @@ class KitaRenderer extends IntegrationRenderer {
|
|
|
36
36
|
}) {
|
|
37
37
|
try {
|
|
38
38
|
const pageContent = await Page({ params, query, ...props, locals: pageLocals });
|
|
39
|
-
const
|
|
39
|
+
const pageHtml = String(pageContent);
|
|
40
|
+
const children = Layout && typeof Layout === "function" ? await Layout({ children: pageHtml, locals }) : pageHtml;
|
|
40
41
|
const body = await HtmlTemplate({
|
|
41
42
|
metadata,
|
|
42
43
|
pageProps: props ?? {},
|
|
@@ -63,10 +64,11 @@ class KitaRenderer extends IntegrationRenderer {
|
|
|
63
64
|
const viewFn = view;
|
|
64
65
|
const renderExecution = await this.captureHtmlRender(async () => {
|
|
65
66
|
const pageContent = await viewFn(props);
|
|
67
|
+
const pageHtml = String(pageContent);
|
|
66
68
|
if (ctx.partial) {
|
|
67
|
-
return
|
|
69
|
+
return pageHtml;
|
|
68
70
|
}
|
|
69
|
-
const children = Layout ? await Layout({ children:
|
|
71
|
+
const children = Layout ? await Layout({ children: pageHtml }) : pageHtml;
|
|
70
72
|
return this.DOC_TYPE + await HtmlTemplate({
|
|
71
73
|
metadata: metadata ?? this.appConfig.defaultMetadata,
|
|
72
74
|
pageProps: props ?? {},
|
package/src/kitajs.plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IntegrationPlugin, type IntegrationPluginConfig } from '@ecopages/core/plugins/integration-plugin';
|
|
1
|
+
import { IntegrationPlugin, type ComponentBoundaryPolicyInput, type IntegrationPluginConfig } from '@ecopages/core/plugins/integration-plugin';
|
|
2
2
|
import { KitaRenderer } from './kitajs-renderer.js';
|
|
3
3
|
/**
|
|
4
4
|
* The name of the Kita.js plugin
|
|
@@ -11,6 +11,7 @@ export declare const PLUGIN_NAME = "kitajs";
|
|
|
11
11
|
export declare class KitaHtmlPlugin extends IntegrationPlugin {
|
|
12
12
|
renderer: typeof KitaRenderer;
|
|
13
13
|
constructor(options?: Omit<IntegrationPluginConfig, 'name'>);
|
|
14
|
+
shouldDeferComponentBoundary(input: ComponentBoundaryPolicyInput): boolean;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Factory function to create a Kita.js plugin instance.
|
package/src/kitajs.plugin.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
IntegrationPlugin
|
|
3
|
+
} from "@ecopages/core/plugins/integration-plugin";
|
|
2
4
|
import { KitaRenderer } from "./kitajs-renderer.js";
|
|
3
5
|
const PLUGIN_NAME = "kitajs";
|
|
4
6
|
class KitaHtmlPlugin extends IntegrationPlugin {
|
|
@@ -7,9 +9,13 @@ class KitaHtmlPlugin extends IntegrationPlugin {
|
|
|
7
9
|
super({
|
|
8
10
|
name: PLUGIN_NAME,
|
|
9
11
|
extensions: [".kita.tsx"],
|
|
12
|
+
jsxImportSource: "@kitajs/html",
|
|
10
13
|
...options
|
|
11
14
|
});
|
|
12
15
|
}
|
|
16
|
+
shouldDeferComponentBoundary(input) {
|
|
17
|
+
return input.targetIntegration === this.name && input.currentIntegration !== this.name;
|
|
18
|
+
}
|
|
13
19
|
}
|
|
14
20
|
function kitajsPlugin(options) {
|
|
15
21
|
return new KitaHtmlPlugin(options);
|