@ecopages/ecopages-jsx 0.2.0-alpha.22 → 0.2.0-alpha.23
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
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
- Patched the Ecopages JSX browser runtime bundle so nested SVG templates restore canonical camel-cased SVG tag names during client rendering.
|
|
12
12
|
- Aligned Ecopages JSX peer dependency ranges with the current `@ecopages/jsx` and `@ecopages/radiant` alpha releases.
|
|
13
13
|
- Aligned Radiant SSR and hydration wiring with the public `@ecopages/radiant/server/render-component` and `@ecopages/radiant/client/hydrator` entrypoints so JSX apps install an explicit client hydrator bootstrap instead of relying on implicit side effects.
|
|
14
|
+
- Updated the Ecopages JSX Radiant browser runtime for the `RadiantElement` and `RadiantController` API surface and switched the explicit hydrator bootstrap to `@ecopages/radiant/client/install-hydrator`.
|
|
14
15
|
- Fixed Radiant SSR page inspection to install the light-DOM shim before JSX page modules are imported outside the normal render pass.
|
|
15
16
|
- Restored direct `EcopagesJsxPlugin` construction so the exported class still accepts the public plugin options shape.
|
|
16
17
|
- Fixed intrinsic custom-element asset discovery so Ecopages JSX registers scripts declared with decorator and function-call `customElement(...)` syntax.
|
package/README.md
CHANGED
|
@@ -48,9 +48,9 @@ Radiant support is enabled by default. When `radiant: true`, the plugin keeps th
|
|
|
48
48
|
|
|
49
49
|
- Ecopages JSX owns page-level JSX SSR and container hydration.
|
|
50
50
|
- Radiant SSR is activated on the server through `@ecopages/radiant/server/render-component`.
|
|
51
|
-
- Radiant host hydration is activated on the client through an explicit head bootstrap that
|
|
51
|
+
- Radiant host hydration is activated on the client through an explicit head bootstrap that imports `@ecopages/radiant/client/install-hydrator` before intrinsic custom-element modules load.
|
|
52
52
|
|
|
53
|
-
That means server-rendered `
|
|
53
|
+
That means server-rendered `RadiantElement` hosts hydrate in place only when both the SSR markers and the explicit client hydrator are present. Without the client hydrator, Radiant intentionally falls back to a fresh client render on first connect.
|
|
54
54
|
|
|
55
55
|
```ts
|
|
56
56
|
ecopagesJsxPlugin({
|
|
@@ -60,7 +60,7 @@ ecopagesJsxPlugin({
|
|
|
60
60
|
|
|
61
61
|
Set `radiant: false` when your JSX pages do not need Radiant SSR or the Radiant browser runtime on a given app.
|
|
62
62
|
|
|
63
|
-
The plugin bootstrap is intentionally explicit rather than
|
|
63
|
+
The plugin bootstrap is intentionally explicit rather than depending on custom-element modules to install the Radiant hydrator opportunistically.
|
|
64
64
|
|
|
65
65
|
## MDX Support
|
|
66
66
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/ecopages-jsx",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.23",
|
|
4
4
|
"description": "JSX integration plugin for Ecopages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ecopages",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"vfile": "^6.0.3"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@ecopages/core": "0.2.0-alpha.
|
|
25
|
-
"@ecopages/jsx": "0.3.0-alpha.
|
|
26
|
-
"@ecopages/radiant": "0.3.0-alpha.
|
|
24
|
+
"@ecopages/core": "0.2.0-alpha.23",
|
|
25
|
+
"@ecopages/jsx": "0.3.0-alpha.5",
|
|
26
|
+
"@ecopages/radiant": "0.3.0-alpha.5"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -38,8 +38,9 @@ export type EcopagesJsxPluginOptions = Omit<IntegrationPluginConfig, 'name' | 'e
|
|
|
38
38
|
* When enabled, Ecopages JSX:
|
|
39
39
|
* - imports `@ecopages/radiant/server/render-component` before Radiant SSR
|
|
40
40
|
* - exposes browser-safe Radiant bare specifiers through the runtime import map
|
|
41
|
-
* - injects an explicit client bootstrap that
|
|
42
|
-
* before intrinsic
|
|
41
|
+
* - injects an explicit client bootstrap that imports
|
|
42
|
+
* `@ecopages/radiant/client/install-hydrator` before intrinsic
|
|
43
|
+
* custom-element modules load
|
|
43
44
|
*
|
|
44
45
|
* Set to `false` when pages do not use Radiant web components.
|
|
45
46
|
* @default true
|
|
@@ -20,6 +20,7 @@ export declare class JsxRuntimeBundleService {
|
|
|
20
20
|
private cachedSpecifierMap;
|
|
21
21
|
private cachedJsxEntryModulePath;
|
|
22
22
|
private cachedRadiantEntryModulePath;
|
|
23
|
+
private cachedRadiantInstallHydratorEntryModulePath;
|
|
23
24
|
constructor(config: JsxRuntimeBundleServiceConfig);
|
|
24
25
|
setRootDir(rootDir: string | undefined): void;
|
|
25
26
|
/**
|
|
@@ -54,4 +55,5 @@ export declare class JsxRuntimeBundleService {
|
|
|
54
55
|
private getRadiantBrowserRuntimeModules;
|
|
55
56
|
private resolvePackageExportModulePath;
|
|
56
57
|
private getOrCreateRadiantEntryModulePath;
|
|
58
|
+
private getOrCreateRadiantInstallHydratorEntryModulePath;
|
|
57
59
|
}
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
} from "@ecopages/core/services/asset-processing-service";
|
|
10
10
|
const VENDOR_FILE_NAMES = {
|
|
11
11
|
jsx: "ecopages-jsx-esm.js",
|
|
12
|
-
radiant: "ecopages-radiant-esm.js"
|
|
12
|
+
radiant: "ecopages-radiant-esm.js",
|
|
13
|
+
radiantInstallHydrator: "ecopages-radiant-install-hydrator-esm.js"
|
|
13
14
|
};
|
|
14
15
|
const RADIANT_HYDRATOR_BOOTSTRAP_ATTRIBUTE = "data-ecopages-jsx-radiant-hydrator";
|
|
15
16
|
const JSX_RUNTIME_NAMESPACE_REPAIR_SNIPPET = "function rG(W,G,J){let j=G instanceof Element?G:G?.parentElement,U=j?.namespaceURI??K9,$=j?.localName,X=W.firstElementChild;if(!X)return;let F=J??X.localName,Z=O9(U,$,F);if(X.namespaceURI===Z&&X.localName===F)return;W.replaceChild(tG(X,Z,F),X)}function tG(W,G,J){let j=document.createElementNS(G,J);for(let U of Array.from(W.attributes)){if(U.namespaceURI){j.setAttributeNS(U.namespaceURI,U.name,U.value);continue}n(j,U.name,U.value)}return j.append(...W.childNodes),j}";
|
|
@@ -50,13 +51,19 @@ function isBrowserRuntimeRadiantSpecifier(exportKey) {
|
|
|
50
51
|
if (exportKey === "." || exportKey.startsWith("./context/")) {
|
|
51
52
|
return true;
|
|
52
53
|
}
|
|
54
|
+
if (exportKey === "./controller-registry") {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
53
57
|
if (exportKey === "./client/hydrator") {
|
|
54
58
|
return true;
|
|
55
59
|
}
|
|
60
|
+
if (exportKey === "./client/install-hydrator") {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
56
63
|
if (exportKey.startsWith("./decorators/") || exportKey.startsWith("./helpers/")) {
|
|
57
64
|
return true;
|
|
58
65
|
}
|
|
59
|
-
return exportKey === "./core/radiant-
|
|
66
|
+
return exportKey === "./core/radiant-controller" || exportKey === "./core/radiant-element";
|
|
60
67
|
}
|
|
61
68
|
function replaceExactOnce(source, search, replacement, label) {
|
|
62
69
|
if (!source.includes(search)) {
|
|
@@ -92,6 +99,7 @@ class JsxRuntimeBundleService {
|
|
|
92
99
|
cachedSpecifierMap;
|
|
93
100
|
cachedJsxEntryModulePath;
|
|
94
101
|
cachedRadiantEntryModulePath;
|
|
102
|
+
cachedRadiantInstallHydratorEntryModulePath;
|
|
95
103
|
constructor(config) {
|
|
96
104
|
this.config = config;
|
|
97
105
|
}
|
|
@@ -149,11 +157,17 @@ class JsxRuntimeBundleService {
|
|
|
149
157
|
);
|
|
150
158
|
if (this.config.radiant) {
|
|
151
159
|
const radiantEntryModulePath = await this.getOrCreateRadiantEntryModulePath();
|
|
160
|
+
const radiantInstallHydratorEntryModulePath = await this.getOrCreateRadiantInstallHydratorEntryModulePath();
|
|
152
161
|
deps.push(
|
|
153
162
|
createBrowserRuntimeScriptAsset({
|
|
154
163
|
importPath: radiantEntryModulePath,
|
|
155
164
|
name: "ecopages-radiant-esm",
|
|
156
165
|
fileName: VENDOR_FILE_NAMES.radiant
|
|
166
|
+
}),
|
|
167
|
+
createBrowserRuntimeScriptAsset({
|
|
168
|
+
importPath: radiantInstallHydratorEntryModulePath,
|
|
169
|
+
name: "ecopages-radiant-install-hydrator-esm",
|
|
170
|
+
fileName: VENDOR_FILE_NAMES.radiantInstallHydrator
|
|
157
171
|
})
|
|
158
172
|
);
|
|
159
173
|
}
|
|
@@ -171,10 +185,7 @@ class JsxRuntimeBundleService {
|
|
|
171
185
|
});
|
|
172
186
|
}
|
|
173
187
|
createRadiantHydratorBootstrapSource() {
|
|
174
|
-
return
|
|
175
|
-
"import { installRadiantHydrator } from '@ecopages/radiant/client/hydrator';",
|
|
176
|
-
"installRadiantHydrator();"
|
|
177
|
-
].join("\n");
|
|
188
|
+
return "import '@ecopages/radiant/client/install-hydrator';";
|
|
178
189
|
}
|
|
179
190
|
getArtifactsDir() {
|
|
180
191
|
const rootDir = this.config.rootDir ?? process.cwd();
|
|
@@ -197,6 +208,9 @@ class JsxRuntimeBundleService {
|
|
|
197
208
|
};
|
|
198
209
|
if (this.config.radiant) {
|
|
199
210
|
const radiantVendorUrl = buildBrowserRuntimeAssetUrl(VENDOR_FILE_NAMES.radiant);
|
|
211
|
+
const radiantInstallHydratorVendorUrl = buildBrowserRuntimeAssetUrl(
|
|
212
|
+
VENDOR_FILE_NAMES.radiantInstallHydrator
|
|
213
|
+
);
|
|
200
214
|
const radiantPkg = JSON.parse(
|
|
201
215
|
readFileSync(findPackageManifestPath("@ecopages/radiant"), "utf8")
|
|
202
216
|
);
|
|
@@ -205,7 +219,7 @@ class JsxRuntimeBundleService {
|
|
|
205
219
|
continue;
|
|
206
220
|
}
|
|
207
221
|
const specifier = key === "." ? "@ecopages/radiant" : `@ecopages/radiant${key.slice(1)}`;
|
|
208
|
-
specifierMap[specifier] = radiantVendorUrl;
|
|
222
|
+
specifierMap[specifier] = key === "./client/install-hydrator" ? radiantInstallHydratorVendorUrl : radiantVendorUrl;
|
|
209
223
|
}
|
|
210
224
|
}
|
|
211
225
|
this.cachedSpecifierMap = specifierMap;
|
|
@@ -280,6 +294,31 @@ class JsxRuntimeBundleService {
|
|
|
280
294
|
this.cachedRadiantEntryModulePath = filePath;
|
|
281
295
|
return filePath;
|
|
282
296
|
}
|
|
297
|
+
async getOrCreateRadiantInstallHydratorEntryModulePath() {
|
|
298
|
+
if (this.cachedRadiantInstallHydratorEntryModulePath) {
|
|
299
|
+
return this.cachedRadiantInstallHydratorEntryModulePath;
|
|
300
|
+
}
|
|
301
|
+
const artifactsDir = this.getArtifactsDir();
|
|
302
|
+
const filePath = path.join(artifactsDir, "ecopages-radiant-install-hydrator-esm-entry.mjs");
|
|
303
|
+
const manifestPath = findPackageManifestPath("@ecopages/radiant");
|
|
304
|
+
const packageDir = path.dirname(realpathSync(manifestPath));
|
|
305
|
+
const radiantPkg = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
306
|
+
const modulePath = this.resolvePackageExportModulePath(
|
|
307
|
+
packageDir,
|
|
308
|
+
"./client/install-hydrator",
|
|
309
|
+
radiantPkg.exports?.["./client/install-hydrator"]
|
|
310
|
+
);
|
|
311
|
+
mkdirSync(artifactsDir, { recursive: true });
|
|
312
|
+
writeFileSync(
|
|
313
|
+
filePath,
|
|
314
|
+
`import '${this.getEntryImportPath(artifactsDir, modulePath)}';
|
|
315
|
+
export {};
|
|
316
|
+
`,
|
|
317
|
+
"utf8"
|
|
318
|
+
);
|
|
319
|
+
this.cachedRadiantInstallHydratorEntryModulePath = filePath;
|
|
320
|
+
return filePath;
|
|
321
|
+
}
|
|
283
322
|
}
|
|
284
323
|
export {
|
|
285
324
|
JsxRuntimeBundleService,
|