jslike 1.5.0 → 1.6.1
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/dist/esm/interpreter/interpreter.js +312 -20
- package/dist/esm/parser.js +781 -3
- package/dist/esm/runtime/builtins.js +14 -0
- package/dist/index.cjs +931 -20
- package/dist/index.d.cts +1070 -30
- package/dist/index.d.ts +1070 -30
- package/dist/index.js +931 -20
- package/dist/validator/index.cjs +669 -5
- package/dist/validator/index.js +669 -5
- package/package.json +5 -2
|
@@ -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);
|