fix: meta charSet -> charset (#1875)

This commit is contained in:
Marvin Hagemeister
2023-10-06 15:59:13 +02:00
committed by GitHub
parent 77ed10078c
commit e9717ed911
16 changed files with 152 additions and 38 deletions
+4 -4
View File
@@ -1,7 +1,7 @@
export const RECOMMENDED_PREACT_VERSION = "10.15.1";
export const RECOMMENDED_PREACT_RTS_VERSION = "6.2.1";
export const RECOMMENDED_PREACT_SIGNALS_VERSION = "1.1.3";
export const RECOMMENDED_PREACT_SIGNALS_CORE_VERSION = "1.2.3";
export const RECOMMENDED_PREACT_VERSION = "10.18.1";
export const RECOMMENDED_PREACT_RTS_VERSION = "6.2.2";
export const RECOMMENDED_PREACT_SIGNALS_VERSION = "1.2.1";
export const RECOMMENDED_PREACT_SIGNALS_CORE_VERSION = "1.5.0";
export const RECOMMENDED_TWIND_VERSION = "0.16.19";
export const RECOMMENDED_STD_VERSION = "0.193.0";
+6 -6
View File
@@ -97,7 +97,7 @@ export function revive(
[],
// Keep a root node in the vnode stack to save a couple of checks
// later during iteration
[h(Fragment, null)],
[h(Fragment, null) as VNode],
document.body,
result,
);
@@ -324,11 +324,11 @@ function _walkInner(
});
vnodeStack.push(
h(PartialComp, { name, key, mode: +mode }),
h(PartialComp, { name, key, mode: +mode }) as VNode,
);
} else if (comment.startsWith("frsh-key")) {
const key = comment.slice("frsh-key:".length);
vnodeStack.push(h(Fragment, { key }));
vnodeStack.push(h(Fragment, { key }) as VNode);
} else if (comment.startsWith("/frsh-key")) {
const vnode = vnodeStack.pop();
const parent = vnodeStack[vnodeStack.length - 1]!;
@@ -453,7 +453,7 @@ function _walkInner(
kind: MarkerKind.Island,
});
const vnode = h(islands[id][exportName], islandProps);
const vnode = h(islands[id][exportName], islandProps) as VNode;
if (key) vnode.key = key;
vnodeStack.push(vnode);
}
@@ -510,7 +510,7 @@ function _walkInner(
// Remove internal fresh key
if (hasKey) sib.removeAttribute(DATA_KEY_ATTR);
const vnode = h(sib.localName, newProps);
const vnode = h(sib.localName, newProps) as VNode;
addPropsChild(parentVNode, vnode);
vnodeStack.push(vnode);
} else {
@@ -621,7 +621,7 @@ function collectPartials(
islands,
state[0] ?? [],
[],
[h(Fragment, null)],
[h(Fragment, null) as VNode],
rootFrag,
encounteredPartials,
);
+2 -2
View File
@@ -82,7 +82,7 @@ export function setRenderState(state: RenderState | null): void {
const supportsUnstableComments = renderToString(h(Fragment, {
// @ts-ignore unstable features not supported in types
UNSTABLE_comment: "foo",
})) !== "";
}) as VNode) !== "";
if (!supportsUnstableComments) {
console.warn(
@@ -347,7 +347,7 @@ options.__b = (vnode: VNode<Record<string, unknown>>) => {
);
}
const child = h(originalType, props);
const child = h(originalType, props) as VNode;
patched.add(child);
islandProps.push(props);
+16 -8
View File
@@ -1,7 +1,14 @@
import { RenderState } from "./state.ts";
import { setRenderState } from "./preact_hooks.ts";
import { renderToString } from "preact-render-to-string";
import { Fragment, h, isValidElement, toChildArray, VNode } from "preact";
import {
ComponentType,
Fragment,
h,
isValidElement,
toChildArray,
VNode,
} from "preact";
import { HEAD_CONTEXT } from "../../runtime/head.ts";
import { CSP_CONTEXT } from "../../runtime/csp.ts";
@@ -13,12 +20,12 @@ export function renderHtml(state: RenderState) {
const componentStack = state.componentStack;
try {
const routeComponent = componentStack[componentStack.length - 1];
let finalComp = h(routeComponent, state.routeOptions);
let finalComp = h(routeComponent, state.routeOptions) as VNode;
// Skip page component
let i = componentStack.length - 1;
while (i--) {
const component = componentStack[i];
const component = componentStack[i] as ComponentType;
const curComp = finalComp;
finalComp = h(component, {
@@ -26,7 +33,8 @@ export function renderHtml(state: RenderState) {
Component() {
return curComp;
},
});
// deno-lint-ignore no-explicit-any
} as any) as VNode;
}
const app = h(
@@ -37,12 +45,12 @@ export function renderHtml(state: RenderState) {
value: state.headVNodes,
children: finalComp,
}),
);
) as VNode;
let html = renderToString(app);
for (const [id, children] of state.slots.entries()) {
const slotHtml = renderToString(h(Fragment, null, children));
const slotHtml = renderToString(h(Fragment, null, children) as VNode);
const templateId = id.replace(/:/g, "-");
html += `<template id="${templateId}">${slotHtml}</template>`;
}
@@ -103,7 +111,7 @@ export function renderOuterDocument(
h(
"head",
docHead,
!renderedHtmlTag ? h("meta", { charSet: "utf-8" }) : null,
!renderedHtmlTag ? h("meta", { charset: "utf-8" }) : null,
!renderedHtmlTag
? (h("meta", {
name: "viewport",
@@ -124,7 +132,7 @@ export function renderOuterDocument(
...docBody,
dangerouslySetInnerHTML: { __html: opts.bodyHtml },
}),
);
) as VNode;
try {
setRenderState(state);