@nitronjs/framework 0.1.23 → 0.1.24

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.
@@ -102,6 +102,7 @@ function wrapWithDepth(children) {
102
102
 
103
103
  function createIsland(Component, name) {
104
104
  function IslandBoundary(props) {
105
+ // Nested client components render normally (already inside an island)
105
106
  if (React.useContext(DepthContext)) {
106
107
  return OriginalJsx.jsx(Component, props);
107
108
  }
@@ -115,6 +116,8 @@ function createIsland(Component, name) {
115
116
  ctx.props[id] = safeProps;
116
117
  }
117
118
 
119
+ // SSR: Render full HTML for SEO and initial paint
120
+ // Client: Will re-render with createRoot for animations to work
118
121
  return OriginalJsx.jsx('div', {
119
122
  'data-cid': id,
120
123
  'data-island': name,
@@ -445,12 +448,16 @@ class Builder {
445
448
  const importName = sanitizeName(baseName) + "_" + index++;
446
449
  imports.push(`import ${importName} from "${relativePath}";`);
447
450
  manifestEntries.push(` "${baseName}": ${importName}`);
451
+ // Also add displayName entry
452
+ manifestEntries.push(` [${importName}.displayName || ${importName}.name || "${baseName}"]: ${importName}`);
448
453
  }
449
454
 
450
455
  for (const namedExport of componentMeta.named || []) {
451
456
  const importName = sanitizeName(namedExport) + "_" + index++;
452
457
  imports.push(`import { ${namedExport} as ${importName} } from "${relativePath}";`);
453
458
  manifestEntries.push(` "${namedExport}": ${importName}`);
459
+ // Also add displayName entry
460
+ manifestEntries.push(` [${importName}.displayName || ${importName}.name || "${namedExport}"]: ${importName}`);
454
461
  }
455
462
  }
456
463
 
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { hydrateRoot } from "react-dom/client";
2
+ import { createRoot } from "react-dom/client";
3
3
 
4
4
  // __COMPONENT_IMPORTS__
5
5
 
@@ -13,7 +13,7 @@ const componentManifest: Record<string, React.ComponentType<any>> = {};
13
13
 
14
14
  // __COMPONENT_MANIFEST__
15
15
 
16
- function hydrate() {
16
+ function mount() {
17
17
  const props = window.__NITRON_PROPS__ || {};
18
18
 
19
19
  const islands = document.querySelectorAll<HTMLElement>("[data-cid]");
@@ -35,11 +35,10 @@ function hydrate() {
35
35
  const componentProps = props[componentId] || {};
36
36
 
37
37
  try {
38
- hydrateRoot(
39
- element,
40
- React.createElement(Component, componentProps),
41
- { identifierPrefix: componentId }
42
- );
38
+ // Use createRoot for full client-side rendering
39
+ // This ensures animations and effects work correctly
40
+ const root = createRoot(element);
41
+ root.render(React.createElement(Component, componentProps));
43
42
  } catch {
44
43
  }
45
44
  });
@@ -48,7 +47,8 @@ function hydrate() {
48
47
  }
49
48
 
50
49
  if (document.readyState === "loading") {
51
- document.addEventListener("DOMContentLoaded", hydrate);
50
+ document.addEventListener("DOMContentLoaded", mount);
52
51
  } else {
53
- hydrate();
52
+ mount();
54
53
  }
54
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitronjs/framework",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "NitronJS is a modern and extensible Node.js MVC framework built on Fastify. It focuses on clean architecture, modular structure, and developer productivity, offering built-in routing, middleware, configuration management, CLI tooling, and native React integration for scalable full-stack applications.",
5
5
  "bin": {
6
6
  "njs": "./cli/njs.js"