hadars 0.1.16 → 0.1.18
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/chunk-TGSIYGY2.js +40 -0
- package/dist/cli.js +695 -165
- package/dist/index.cjs +61 -6
- package/dist/index.d.ts +40 -1
- package/dist/index.js +58 -6
- package/dist/jsx-runtime-97ca74a5.d.ts +18 -0
- package/dist/slim-react/index.cjs +874 -0
- package/dist/slim-react/index.d.ts +180 -0
- package/dist/slim-react/index.js +784 -0
- package/dist/slim-react/jsx-runtime.cjs +51 -0
- package/dist/slim-react/jsx-runtime.d.ts +1 -0
- package/dist/slim-react/jsx-runtime.js +10 -0
- package/dist/ssr-render-worker.js +619 -108
- package/dist/ssr-watch.js +37 -13
- package/dist/utils/Head.tsx +3 -6
- package/index.ts +1 -1
- package/package.json +2 -2
- package/src/build.ts +55 -49
- package/src/components/CacheSegment.tsx +67 -0
- package/src/index.tsx +2 -0
- package/src/slim-react/context.ts +52 -0
- package/src/slim-react/hooks.ts +137 -0
- package/src/slim-react/index.ts +225 -0
- package/src/slim-react/jsx-runtime.ts +7 -0
- package/src/slim-react/jsx.ts +53 -0
- package/src/slim-react/render.ts +686 -0
- package/src/slim-react/renderContext.ts +105 -0
- package/src/slim-react/types.ts +27 -0
- package/src/ssr-render-worker.ts +83 -118
- package/src/utils/Head.tsx +3 -6
- package/src/utils/response.tsx +42 -105
- package/src/utils/rspack.ts +45 -15
- package/src/utils/segmentCache.ts +87 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/slim-react/types.ts
|
|
2
|
+
var SLIM_ELEMENT = Symbol.for("react.element");
|
|
3
|
+
var FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
4
|
+
var SUSPENSE_TYPE = Symbol.for("react.suspense");
|
|
5
|
+
|
|
6
|
+
// src/slim-react/jsx.ts
|
|
7
|
+
var Fragment = FRAGMENT_TYPE;
|
|
8
|
+
function jsx(type, props, key) {
|
|
9
|
+
return {
|
|
10
|
+
$$typeof: SLIM_ELEMENT,
|
|
11
|
+
type,
|
|
12
|
+
props: props || {},
|
|
13
|
+
key: key ?? (props?.key ?? null)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function createElement(type, props, ...children) {
|
|
17
|
+
const normalizedProps = { ...props || {} };
|
|
18
|
+
if (children.length === 1) {
|
|
19
|
+
normalizedProps.children = children[0];
|
|
20
|
+
} else if (children.length > 1) {
|
|
21
|
+
normalizedProps.children = children;
|
|
22
|
+
}
|
|
23
|
+
const key = normalizedProps.key ?? null;
|
|
24
|
+
delete normalizedProps.key;
|
|
25
|
+
return {
|
|
26
|
+
$$typeof: SLIM_ELEMENT,
|
|
27
|
+
type,
|
|
28
|
+
props: normalizedProps,
|
|
29
|
+
key
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
SLIM_ELEMENT,
|
|
35
|
+
FRAGMENT_TYPE,
|
|
36
|
+
SUSPENSE_TYPE,
|
|
37
|
+
Fragment,
|
|
38
|
+
jsx,
|
|
39
|
+
createElement
|
|
40
|
+
};
|