|
|
@@ -33,10 +33,10 @@ export const enum StringifyThresholds {
|
|
|
NODE_COUNT = 20
|
|
|
}
|
|
|
|
|
|
-type StringiableNode = PlainElementNode | TextCallNode
|
|
|
+type StringifiableNode = PlainElementNode | TextCallNode
|
|
|
|
|
|
/**
|
|
|
- * Turn eligible hoisted static trees into stringied static nodes, e.g.
|
|
|
+ * Turn eligible hoisted static trees into stringified static nodes, e.g.
|
|
|
*
|
|
|
* ```js
|
|
|
* const _hoisted_1 = createStaticVNode(`<div class="foo">bar</div>`)
|
|
|
@@ -61,7 +61,7 @@ type StringiableNode = PlainElementNode | TextCallNode
|
|
|
export const stringifyStatic: HoistTransform = (children, context) => {
|
|
|
let nc = 0 // current node count
|
|
|
let ec = 0 // current element with binding count
|
|
|
- const currentChunk: StringiableNode[] = []
|
|
|
+ const currentChunk: StringifiableNode[] = []
|
|
|
|
|
|
const stringifyCurrentChunk = (currentIndex: number): number => {
|
|
|
if (
|
|
|
@@ -101,7 +101,7 @@ export const stringifyStatic: HoistTransform = (children, context) => {
|
|
|
const hoisted = getHoistedNode(child)
|
|
|
if (hoisted) {
|
|
|
// presence of hoisted means child must be a stringifiable node
|
|
|
- const node = child as StringiableNode
|
|
|
+ const node = child as StringifiableNode
|
|
|
const result = analyzeNode(node)
|
|
|
if (result) {
|
|
|
// node is stringifiable, record state
|
|
|
@@ -137,7 +137,7 @@ const isStringifiableAttr = (name: string) => {
|
|
|
}
|
|
|
|
|
|
const replaceHoist = (
|
|
|
- node: StringiableNode,
|
|
|
+ node: StringifiableNode,
|
|
|
replacement: JSChildNode | null,
|
|
|
context: TransformContext
|
|
|
) => {
|
|
|
@@ -152,7 +152,7 @@ const replaceHoist = (
|
|
|
* - nc is the number of nodes inside
|
|
|
* - ec is the number of element with bindings inside
|
|
|
*/
|
|
|
-function analyzeNode(node: StringiableNode): [number, number] | false {
|
|
|
+function analyzeNode(node: StringifiableNode): [number, number] | false {
|
|
|
if (node.type === NodeTypes.TEXT_CALL) {
|
|
|
return [1, 0]
|
|
|
}
|