jslike 1.5.0 → 1.6.0

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.
@@ -114,6 +114,20 @@ export function createGlobalEnvironment(env) {
114
114
  env.define('SyntaxError', SyntaxError);
115
115
  env.define('RangeError', RangeError);
116
116
 
117
+ // JSX Runtime Support
118
+ env.define('createElement', (type, props, ...children) => ({
119
+ $$typeof: Symbol.for('react.element'),
120
+ type,
121
+ props: {
122
+ ...props,
123
+ children: children.length === 0 ? undefined : children.length === 1 ? children[0] : children
124
+ },
125
+ key: props?.key ?? null,
126
+ ref: props?.ref ?? null
127
+ }));
128
+
129
+ env.define('Fragment', Symbol.for('react.fragment'));
130
+
117
131
  // Global console functions (shortcuts for console.log/warn/error)
118
132
  env.define('log', (...args) => {
119
133
  console.log(...args);