@nitronjs/framework 0.2.8 → 0.2.10

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.
@@ -96,18 +96,28 @@ function getWrappedComponent(Component) {
96
96
  return componentCache.get(Component);
97
97
  }
98
98
 
99
+ function extractKey(props, key) {
100
+ if (props == null || !('key' in props)) {
101
+ return [props, key];
102
+ }
103
+ const { key: propKey, ...rest } = props;
104
+ return [rest, key ?? propKey];
105
+ }
106
+
99
107
  export function jsx(type, props, key) {
108
+ const [cleanProps, finalKey] = extractKey(props, key);
100
109
  if (typeof type === 'function' && type[MARK]) {
101
- return OriginalJsx.jsx(getWrappedComponent(type), props, key);
110
+ return OriginalJsx.jsx(getWrappedComponent(type), cleanProps, finalKey);
102
111
  }
103
- return OriginalJsx.jsx(type, props, key);
112
+ return OriginalJsx.jsx(type, cleanProps, finalKey);
104
113
  }
105
114
 
106
115
  export function jsxs(type, props, key) {
116
+ const [cleanProps, finalKey] = extractKey(props, key);
107
117
  if (typeof type === 'function' && type[MARK]) {
108
- return OriginalJsx.jsx(getWrappedComponent(type), props, key);
118
+ return OriginalJsx.jsx(getWrappedComponent(type), cleanProps, finalKey);
109
119
  }
110
- return OriginalJsx.jsxs(type, props, key);
120
+ return OriginalJsx.jsxs(type, cleanProps, finalKey);
111
121
  }
112
122
 
113
123
  export const Fragment = OriginalJsx.Fragment;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitronjs/framework",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
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"