@server/next 0.21.6 → 0.21.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@server/next",
3
- "version": "0.21.6",
3
+ "version": "0.21.8",
4
4
  "description": "A fully-fledged web server with routing, file uploads, sessions, static files, schema validation, websockets, testing, etc.",
5
5
  "homepage": "https://server-js.com/",
6
6
  "repository": "https://github.com/franciscop/server-next.git",
@@ -13,6 +13,9 @@ const altAttrs = {
13
13
  classname: "class",
14
14
  };
15
15
 
16
+ // "" and 0 are valid children, false and null and undefined are not
17
+ const isValidChild = (child) => child || child === "" || child === 0;
18
+
16
19
  const minifyCss = (str) =>
17
20
  str
18
21
  .replace(/\s+/g, " ")
@@ -38,13 +41,14 @@ export const jsx = (tag, { children, ...props }) => {
38
41
  const src = children;
39
42
  children = () => src;
40
43
  }
41
- if (tag === "style" && children) {
44
+ if (tag === "style" && children && typeof children === "string") {
42
45
  const src = minifyCss(children);
43
46
  children = () => src;
44
47
  }
45
48
  if (props.dangerouslySetInnerHTML)
46
49
  children = () => props.dangerouslySetInnerHTML.__html;
47
- if (!children) children = [];
50
+
51
+ if (!isValidChild(children)) children = [];
48
52
  if (typeof children === "string") children = [children];
49
53
  children = (Array.isArray(children) ? children : [children])
50
54
  .flat()