babel-plugin-essor 0.0.6-beta.1 → 0.0.6-beta.10
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/index.cjs +80 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +80 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -24,6 +24,16 @@ __export(src_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(src_exports);
|
|
26
26
|
|
|
27
|
+
// ../shared/dist/essor-shared.js
|
|
28
|
+
var isArray = Array.isArray;
|
|
29
|
+
var noop = Function.prototype;
|
|
30
|
+
function startsWith(str, searchString) {
|
|
31
|
+
return str.indexOf(searchString) === 0;
|
|
32
|
+
}
|
|
33
|
+
var capitalizeFirstLetter = (inputString) => {
|
|
34
|
+
return inputString.charAt(0).toUpperCase() + inputString.slice(1);
|
|
35
|
+
};
|
|
36
|
+
|
|
27
37
|
// src/jsx/server.ts
|
|
28
38
|
var import_core3 = require("@babel/core");
|
|
29
39
|
|
|
@@ -235,6 +245,7 @@ function transformChild(child, result) {
|
|
|
235
245
|
result.template += String(expression.node.value);
|
|
236
246
|
} else if (expression.isExpression()) {
|
|
237
247
|
replaceChild(expression.node, result);
|
|
248
|
+
} else if (import_core2.types.isJSXEmptyExpression(expression.node)) {
|
|
238
249
|
} else {
|
|
239
250
|
throw new Error("Unsupported child type");
|
|
240
251
|
}
|
|
@@ -289,7 +300,7 @@ function handleAttributes(props, result) {
|
|
|
289
300
|
delete props[prop];
|
|
290
301
|
continue;
|
|
291
302
|
}
|
|
292
|
-
if (prop
|
|
303
|
+
if (startsWith(prop, "class:")) {
|
|
293
304
|
if (value === true) {
|
|
294
305
|
const name = prop.replace(/^class:/, "");
|
|
295
306
|
klass += ` ${name}`;
|
|
@@ -306,7 +317,7 @@ function handleAttributes(props, result) {
|
|
|
306
317
|
delete props[prop];
|
|
307
318
|
continue;
|
|
308
319
|
}
|
|
309
|
-
if (prop
|
|
320
|
+
if (startsWith(prop, "style:") && (typeof value === "string" || typeof value === "number")) {
|
|
310
321
|
const name = prop.replace(/^style:/, "");
|
|
311
322
|
style += `${name}:${value};`;
|
|
312
323
|
delete props[prop];
|
|
@@ -397,7 +408,13 @@ function getAttrProps(path) {
|
|
|
397
408
|
if (/^key|ref|on.+$/.test(name)) {
|
|
398
409
|
props[name] = expression.node;
|
|
399
410
|
} else if (/^bind:.+/.test(name)) {
|
|
400
|
-
|
|
411
|
+
const value2 = path.scope.generateUidIdentifier("value");
|
|
412
|
+
const bindName = name.slice(5).toLocaleLowerCase();
|
|
413
|
+
props[bindName] = expression.node;
|
|
414
|
+
props[`update${capitalizeFirstLetter(bindName)}`] = import_core2.types.arrowFunctionExpression(
|
|
415
|
+
[value2],
|
|
416
|
+
import_core2.types.assignmentExpression("=", expression.node, value2)
|
|
417
|
+
);
|
|
401
418
|
} else {
|
|
402
419
|
if (expression.isConditionalExpression()) {
|
|
403
420
|
props[name] = import_core2.types.arrowFunctionExpression([], expression.node);
|
|
@@ -585,6 +602,7 @@ function transformChild2(child, result) {
|
|
|
585
602
|
result.template[result.template.length - 1] += String(expression.node.value);
|
|
586
603
|
} else if (expression.isExpression()) {
|
|
587
604
|
replaceChild2(expression.node, result);
|
|
605
|
+
} else if (import_core3.types.isJSXEmptyExpression(expression.node)) {
|
|
588
606
|
} else {
|
|
589
607
|
throw new Error("Unsupported child type");
|
|
590
608
|
}
|
|
@@ -627,7 +645,7 @@ function handleAttributes2(props, result) {
|
|
|
627
645
|
delete props[prop];
|
|
628
646
|
continue;
|
|
629
647
|
}
|
|
630
|
-
if (prop
|
|
648
|
+
if (startsWith(prop, "class:")) {
|
|
631
649
|
if (value === true) {
|
|
632
650
|
const name = prop.replace(/^class:/, "");
|
|
633
651
|
klass += ` ${name}`;
|
|
@@ -644,7 +662,7 @@ function handleAttributes2(props, result) {
|
|
|
644
662
|
delete props[prop];
|
|
645
663
|
continue;
|
|
646
664
|
}
|
|
647
|
-
if (prop
|
|
665
|
+
if (startsWith(prop, "style:") && (typeof value === "string" || typeof value === "number")) {
|
|
648
666
|
const name = prop.replace(/^style:/, "");
|
|
649
667
|
style += `${name}:${value};`;
|
|
650
668
|
delete props[prop];
|
|
@@ -735,7 +753,13 @@ function getAttrProps2(path) {
|
|
|
735
753
|
if (/^key|ref|on.+$/.test(name)) {
|
|
736
754
|
props[name] = expression.node;
|
|
737
755
|
} else if (/^bind:.+/.test(name)) {
|
|
738
|
-
|
|
756
|
+
const value2 = path.scope.generateUidIdentifier("value");
|
|
757
|
+
const bindName = name.slice(5).toLocaleLowerCase();
|
|
758
|
+
props[bindName] = expression.node;
|
|
759
|
+
props[`update${capitalizeFirstLetter(bindName)}`] = import_core3.types.arrowFunctionExpression(
|
|
760
|
+
[value2],
|
|
761
|
+
import_core3.types.assignmentExpression("=", expression.node, value2)
|
|
762
|
+
);
|
|
739
763
|
} else {
|
|
740
764
|
if (expression.isConditionalExpression()) {
|
|
741
765
|
props[name] = import_core3.types.arrowFunctionExpression([], expression.node);
|
|
@@ -778,7 +802,7 @@ function replaceSymbol(path) {
|
|
|
778
802
|
if (import_core4.types.isObjectPattern(path.node.id) || import_core4.types.isArrayPattern(path.node.id)) {
|
|
779
803
|
return;
|
|
780
804
|
}
|
|
781
|
-
if (!
|
|
805
|
+
if (!startsWith(variableName, "$")) {
|
|
782
806
|
return;
|
|
783
807
|
}
|
|
784
808
|
if (init && (import_core4.types.isFunctionExpression(init) || import_core4.types.isArrowFunctionExpression(init)) && path.parent.kind === "const") {
|
|
@@ -814,13 +838,59 @@ function replaceImportDeclaration(path) {
|
|
|
814
838
|
const imports2 = path.node.specifiers;
|
|
815
839
|
imports2.forEach((specifier) => {
|
|
816
840
|
const variableName = specifier.local.name;
|
|
817
|
-
if (variableName
|
|
841
|
+
if (startsWith(variableName, "$") && !isVariableUsedAsObject(path, variableName)) {
|
|
818
842
|
path.scope.rename(variableName, `${variableName}.value`);
|
|
819
843
|
specifier.local.name = `${variableName}`;
|
|
820
844
|
}
|
|
821
845
|
});
|
|
822
846
|
}
|
|
823
847
|
|
|
848
|
+
// src/signal/props.ts
|
|
849
|
+
var import_core6 = require("@babel/core");
|
|
850
|
+
function replaceProps(path) {
|
|
851
|
+
var _a;
|
|
852
|
+
const firstParam = path.node.params[0];
|
|
853
|
+
if (!firstParam || !import_core6.types.isObjectPattern(firstParam)) {
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
const returnStatement = path.get("body").get("body").find((statement) => statement.isReturnStatement());
|
|
857
|
+
if (!returnStatement) {
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
const returnValue = (_a = returnStatement.node) == null ? void 0 : _a.argument;
|
|
861
|
+
if (!import_core6.types.isJSXElement(returnValue)) {
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
function replaceProperties(properties2, parentPath) {
|
|
865
|
+
properties2.forEach((property) => {
|
|
866
|
+
if (import_core6.types.isObjectProperty(property)) {
|
|
867
|
+
const keyName = property.key.name;
|
|
868
|
+
if (import_core6.types.isIdentifier(property.value)) {
|
|
869
|
+
const propertyName = property.value.name;
|
|
870
|
+
const newName = `${parentPath}${keyName}`;
|
|
871
|
+
path.scope.rename(propertyName, newName);
|
|
872
|
+
} else if (import_core6.types.isObjectPattern(property.value)) {
|
|
873
|
+
replaceProperties(property.value.properties, `${parentPath}${keyName}.`);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
const properties = firstParam.properties;
|
|
879
|
+
replaceProperties(
|
|
880
|
+
properties.filter((property) => !import_core6.types.isRestElement(property)),
|
|
881
|
+
"__props."
|
|
882
|
+
);
|
|
883
|
+
const restElement = properties.find((property) => import_core6.types.isRestElement(property));
|
|
884
|
+
if (restElement) {
|
|
885
|
+
const restName = restElement.argument.name;
|
|
886
|
+
const restVariableDeclaration = import_core6.types.variableDeclaration("const", [
|
|
887
|
+
import_core6.types.variableDeclarator(import_core6.types.identifier(restName), import_core6.types.identifier("__props"))
|
|
888
|
+
]);
|
|
889
|
+
path.node.body.body.unshift(restVariableDeclaration);
|
|
890
|
+
}
|
|
891
|
+
path.node.params[0] = import_core6.types.identifier("__props");
|
|
892
|
+
}
|
|
893
|
+
|
|
824
894
|
// src/index.ts
|
|
825
895
|
function src_default() {
|
|
826
896
|
return {
|
|
@@ -835,6 +905,8 @@ function src_default() {
|
|
|
835
905
|
Program: transformProgram,
|
|
836
906
|
JSXElement: transformJSX,
|
|
837
907
|
JSXFragment: transformJSX,
|
|
908
|
+
FunctionDeclaration: replaceProps,
|
|
909
|
+
ArrowFunctionExpression: replaceProps,
|
|
838
910
|
VariableDeclarator: replaceSymbol,
|
|
839
911
|
ImportDeclaration: replaceImportDeclaration
|
|
840
912
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/jsx/server.ts","../src/program.ts","../src/jsx/constants.ts","../src/jsx/client.ts","../src/jsx/index.ts","../src/signal/symbol.ts","../src/signal/import.ts"],"sourcesContent":["import { transformJSX } from './jsx';\nimport { transformProgram } from './program';\nimport { replaceSymbol } from './signal/symbol';\nimport { replaceImportDeclaration } from './signal/import';\nimport type { PluginObj } from '@babel/core';\nexport { Options, State } from './types';\nexport default function (): PluginObj {\n return {\n name: 'babel-plugin-essor',\n manipulateOptions({ filename }, parserOpts) {\n if (filename.endsWith('.ts') || filename.endsWith('.tsx')) {\n parserOpts.plugins.push('typescript');\n }\n parserOpts.plugins.push('jsx');\n },\n visitor: {\n Program: transformProgram,\n JSXElement: transformJSX,\n JSXFragment: transformJSX,\n VariableDeclarator: replaceSymbol,\n ImportDeclaration: replaceImportDeclaration,\n },\n };\n}\n","import { types as t } from '@babel/core';\nimport { imports } from '../program';\nimport { selfClosingTags, svgTags } from './constants';\nimport { getAttrName, getTagName, isComponent, isTextChild } from './client';\nimport type { State } from '../types';\nimport type { NodePath } from '@babel/core';\ntype JSXElement = t.JSXElement | t.JSXFragment;\ninterface Result {\n index: number;\n isLastChild: boolean;\n parentIndex: number;\n props: Record<string, any>;\n template: string[];\n}\n\ntype JSXChild =\n | t.JSXElement\n | t.JSXFragment\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXText;\n\nexport function transformJSXService(path: NodePath<JSXElement>): void {\n const result: Result = {\n index: 0,\n isLastChild: false,\n parentIndex: 0,\n props: {},\n template: [], // 修改为数组\n };\n transformJSXServiceElement(path, result, true);\n path.replaceWith(createEssorNode(path, result));\n}\n\nfunction createEssorNode(path: NodePath<JSXElement>, result: Result): t.CallExpression {\n const state: State = path.state;\n\n let tmpl: t.Identifier;\n if (path.isJSXElement() && isComponent(getTagName(path.node))) {\n tmpl = t.identifier(getTagName(path.node));\n } else {\n tmpl = path.scope.generateUidIdentifier('_tmpl$');\n const template = t.callExpression(state.ssrtmpl, [\n t.arrayExpression(result.template.map(t.stringLiteral)),\n ]);\n const declarator = t.variableDeclarator(tmpl, template);\n state.tmplDeclaration.declarations.push(declarator);\n\n imports.add('ssrtmpl');\n }\n\n const args = [tmpl, createProps(result.props)];\n const key = result.props.key || result.props[0]?.key;\n if (key) {\n args.push(key);\n }\n imports.add('ssr');\n return t.callExpression(state.ssr, args);\n}\n\nfunction createProps(props: Record<string, any>): t.ObjectExpression {\n const result: (t.ObjectProperty | t.SpreadElement)[] = [];\n\n for (const prop in props) {\n let value = props[prop];\n\n if (prop === 'key') {\n continue;\n }\n\n if (Array.isArray(value)) {\n value = t.arrayExpression(value);\n }\n\n if (typeof value === 'object' && value !== null && !t.isNode(value)) {\n value = createProps(value);\n }\n\n if (typeof value === 'string') {\n value = t.stringLiteral(value);\n }\n\n if (typeof value === 'number') {\n value = t.numericLiteral(value);\n }\n\n if (typeof value === 'boolean') {\n value = t.booleanLiteral(value);\n }\n\n if (value === undefined) {\n value = t.tsUndefinedKeyword();\n }\n\n if (value === null) {\n value = t.nullLiteral();\n }\n\n if (prop === '_$spread$') {\n result.push(t.spreadElement(value));\n } else {\n result.push(t.objectProperty(t.stringLiteral(prop), value));\n }\n }\n\n return t.objectExpression(result);\n}\nfunction transformJSXServiceElement(\n path: NodePath<JSXElement>,\n result: Result,\n isRoot: boolean = false,\n): void {\n if (path.isJSXElement()) {\n const tagName = getTagName(path.node);\n const tagIsComponent = isComponent(tagName);\n const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);\n const isSvg = svgTags.includes(tagName) && result.index === 1;\n const { props, hasExpression } = getAttrProps(path);\n if (tagIsComponent) {\n if (isRoot) {\n result.props = props;\n const children = getChildren(path) as any;\n if (children.length > 0) {\n const childrenGenerator =\n children.length === 1 ? children[0] : t.arrayExpression(children);\n result.props.children = childrenGenerator;\n }\n } else {\n transformJSXService(path);\n replaceChild(path.node, result);\n }\n } else {\n if (isSvg) {\n result.template.push('<svg _svg_>');\n }\n result.template.push(`<${tagName}`);\n handleAttributes(props, result);\n\n if (hasExpression) {\n result.template.push(isSelfClose ? '/>' : '>');\n result.props ||= {};\n } else {\n result.template[result.template.length - 1] += isSelfClose ? '/>' : '>';\n }\n transformChildren(path, result);\n\n if (!isSelfClose) {\n result.template.push(`</${tagName}>`);\n }\n }\n } else {\n result.index--;\n transformChildren(path, result);\n }\n}\n\nfunction transformChildren(path: NodePath<JSXElement>, result: Result): void {\n const parentIndex = result.template.length;\n path\n .get('children')\n .reduce((pre, cur) => {\n if (isValidChild(cur)) {\n const lastChild = pre.at(-1);\n if (lastChild && isTextChild(cur) && isTextChild(lastChild)) {\n setNodeText(lastChild, getNodeText(lastChild) + getNodeText(cur));\n } else {\n pre.push(cur);\n }\n }\n return pre;\n }, [] as NodePath<JSXChild>[])\n .forEach((child, i, arr) => {\n result.parentIndex = parentIndex;\n result.isLastChild = i === arr.length - 1;\n transformChild(child, result);\n });\n}\n\nfunction transformChild(child: NodePath<JSXChild>, result: Result): void {\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXServiceElement(child, result, false);\n } else if (child.isJSXExpressionContainer()) {\n const expression = child.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n result.template[result.template.length - 1] += String(expression.node.value);\n } else if (expression.isExpression()) {\n replaceChild(expression.node, result);\n } else {\n throw new Error('Unsupported child type');\n }\n } else if (child.isJSXText()) {\n result.template.push(String(child.node.value));\n } else {\n throw new Error('Unsupported child type');\n }\n}\n\nfunction getNodeText(path: NodePath<JSXChild>): string {\n if (path.isJSXText()) {\n return path.node.value;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n return String(expression.node.value);\n }\n }\n return '';\n}\nfunction setNodeText(path: NodePath<JSXChild>, text: string): void {\n if (path.isJSXText()) {\n path.node.value = text;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n expression.replaceWith(t.stringLiteral(text));\n }\n }\n}\n\nfunction handleAttributes(props: Record<string, any>, result: Result): void {\n let klass = '';\n let style = '';\n\n for (const prop in props) {\n const value = props[prop];\n\n if (prop === 'class' && typeof value === 'string') {\n klass += ` ${value}`;\n delete props[prop];\n continue;\n }\n if (prop.indexOf('class:') === 0) {\n if (value === true) {\n const name = prop.replace(/^class:/, '');\n klass += ` ${name}`;\n delete props[prop];\n continue;\n }\n if (value === false) {\n delete props[prop];\n continue;\n }\n }\n\n if (prop === 'style' && typeof value === 'string') {\n style += `${value}${value.at(-1) === ';' ? '' : ';'}`;\n delete props[prop];\n continue;\n }\n if (prop.indexOf('style:') === 0 && (typeof value === 'string' || typeof value === 'number')) {\n const name = prop.replace(/^style:/, '');\n style += `${name}:${value};`;\n delete props[prop];\n continue;\n }\n\n if (value === true) {\n result.template[result.template.length - 1] += ` ${prop}`;\n delete props[prop];\n }\n if (value === false) {\n delete props[prop];\n }\n if (typeof value === 'string' || typeof value === 'number') {\n result.template[result.template.length - 1] += ` ${prop}=\"${value}\"`;\n delete props[prop];\n }\n }\n\n if (Object.keys(props).length > 0) {\n result.props[result.index] = props;\n }\n\n klass = klass.trim();\n style = style.trim();\n\n if (klass) {\n result.template[result.template.length - 1] += ` class=\"${klass}\"`;\n }\n if (style) {\n result.template[result.template.length - 1] += ` style=\"${style}\"`;\n }\n}\n\nfunction replaceChild(node: t.Expression, result: Result): void {\n if (result.isLastChild) {\n result.index--;\n }\n result.props[result.parentIndex] ??= {};\n result.props[result.parentIndex].children ??= [];\n result.props[result.parentIndex].children.push(\n t.arrayExpression([\n t.arrowFunctionExpression([], node),\n t.identifier(String(result.template.length)),\n ]),\n );\n}\n\nfunction getChildren(path: NodePath<JSXElement>): JSXChild[] {\n return path\n .get('children')\n .filter(child => isValidChild(child))\n .map(child => {\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXService(child);\n } else if (child.isJSXExpressionContainer()) {\n child.replaceWith(child.get('expression'));\n } else if (child.isJSXText()) {\n child.replaceWith(t.stringLiteral(child.node.value));\n } else {\n throw new Error('Unsupported child type');\n }\n return child.node;\n });\n}\n\nfunction isValidChild(path: NodePath<JSXChild>): boolean {\n const regex = /^\\s*$/;\n if (path.isStringLiteral() || path.isJSXText()) {\n return !regex.test(path.node.value);\n }\n return Object.keys(path.node).length > 0;\n}\nfunction getAttrProps(path: NodePath<t.JSXElement>): Record<string, any> {\n const props: Record<string, any> = {};\n let hasExpression = false;\n path\n .get('openingElement')\n .get('attributes')\n .forEach(attribute => {\n if (attribute.isJSXAttribute()) {\n const name = getAttrName(attribute.node);\n const value = attribute.get('value');\n\n if (!value.node) {\n props[name] = true;\n } else if (value.isStringLiteral()) {\n props[name] = value.node.value;\n } else {\n if (value.isJSXExpressionContainer()) {\n const expression = value.get('expression');\n\n if (expression.isStringLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isNumericLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isJSXElement() || expression.isJSXFragment()) {\n transformJSXService(expression);\n props[name] = expression.node;\n } else if (expression.isExpression()) {\n hasExpression = true;\n if (/^key|ref|on.+$/.test(name)) {\n props[name] = expression.node;\n } else if (/^bind:.+/.test(name)) {\n props[name] = t.arrowFunctionExpression([], expression.node);\n } else {\n if (expression.isConditionalExpression()) {\n props[name] = t.arrowFunctionExpression([], expression.node);\n } else {\n props[name] = expression.node;\n }\n }\n }\n } else if (value.isJSXElement() || value.isJSXFragment()) {\n transformJSXService(value);\n props[name] = value.node;\n }\n }\n } else if (attribute.isJSXSpreadAttribute()) {\n props._$spread$ = attribute.get('argument').node;\n hasExpression = true;\n } else {\n throw new Error('Unsupported attribute type');\n }\n });\n\n return {\n props,\n hasExpression,\n };\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport type { State } from './types';\nexport const imports = new Set<string>();\n\nexport const transformProgram = {\n enter(path: NodePath<t.Program>, state) {\n path.state = {\n h: path.scope.generateUidIdentifier('h$'),\n ssrtmpl: path.scope.generateUidIdentifier('ssrtmpl$'),\n ssr: path.scope.generateUidIdentifier('ssr$'),\n template: path.scope.generateUidIdentifier('template$'),\n\n useSignal: path.scope.generateUidIdentifier('signal$'),\n useComputed: path.scope.generateUidIdentifier('computed$'),\n\n tmplDeclaration: t.variableDeclaration('const', []),\n opts: state.opts,\n } as State;\n },\n exit(path: NodePath<t.Program>) {\n const state: State = path.state;\n if (state.tmplDeclaration.declarations.length > 0) {\n const index = path.node.body.findIndex(\n node => !t.isImportDeclaration(node) && !t.isExportDeclaration(node),\n );\n path.node.body.splice(index, 0, state.tmplDeclaration);\n }\n if (imports.size > 0) {\n path.node.body.unshift(createImport(state, 'essor'));\n }\n },\n};\nfunction createImport(state: State, from: string) {\n const ImportSpecifier: t.ImportSpecifier[] = [];\n imports.forEach(name => {\n const local = t.identifier(state[name].name);\n const imported = t.identifier(name);\n ImportSpecifier.push(t.importSpecifier(local, imported));\n });\n\n const importSource = t.stringLiteral(from);\n return t.importDeclaration(ImportSpecifier, importSource);\n}\n","export const selfClosingTags = [\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n];\n\nexport const svgTags = [\n 'circle',\n 'clipPath',\n 'defs',\n 'ellipse',\n 'filter',\n 'g',\n 'line',\n 'linearGradient',\n 'mask',\n 'path',\n 'pattern',\n 'polygon',\n 'polyline',\n 'radialGradient',\n 'rect',\n 'stop',\n 'symbol',\n 'text',\n 'use',\n];\n","import { types as t } from '@babel/core';\nimport { imports } from '../program';\nimport { selfClosingTags, svgTags } from './constants';\nimport type { State } from '../types';\nimport type { NodePath } from '@babel/core';\ntype JSXElement = t.JSXElement | t.JSXFragment;\ninterface Result {\n index: number;\n isLastChild: boolean;\n parentIndex: number;\n props: Record<string, any>;\n template: string;\n}\n\ntype JSXChild =\n | t.JSXElement\n | t.JSXFragment\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXText;\n\nexport function transformJSXClient(path: NodePath<JSXElement>): void {\n const result: Result = {\n index: 1,\n isLastChild: false,\n parentIndex: 0,\n props: {},\n template: '',\n };\n transformJSXElement(path, result, true);\n\n path.replaceWith(createEssorNode(path, result));\n}\n\nfunction createEssorNode(path: NodePath<JSXElement>, result: Result): t.CallExpression {\n const state: State = path.state;\n\n let tmpl: t.Identifier;\n if (path.isJSXElement() && isComponent(getTagName(path.node))) {\n tmpl = t.identifier(getTagName(path.node));\n } else {\n tmpl = path.scope.generateUidIdentifier('_tmpl$');\n const template = t.callExpression(state.template, [t.stringLiteral(result.template)]);\n const declarator = t.variableDeclarator(tmpl, template);\n state.tmplDeclaration.declarations.push(declarator);\n imports.add('template');\n }\n\n const args = [tmpl, createProps(result.props)];\n const key = result.props.key || result.props[0]?.key;\n if (key) {\n args.push(key);\n }\n imports.add('h');\n return t.callExpression(state.h, args);\n}\n\nfunction createProps(props) {\n const toAstNode = value => {\n if (Array.isArray(value)) {\n return t.arrayExpression(value.map(toAstNode));\n }\n if (value && typeof value === 'object' && !t.isNode(value)) {\n return createProps(value);\n }\n\n switch (typeof value) {\n case 'string':\n return t.stringLiteral(value);\n case 'number':\n return t.numericLiteral(value);\n case 'boolean':\n return t.booleanLiteral(value);\n case 'undefined':\n return t.tsUndefinedKeyword();\n case undefined:\n return t.tsUndefinedKeyword();\n case null:\n return t.nullLiteral();\n default:\n return value;\n }\n };\n\n const result = Object.keys(props)\n .filter(prop => prop !== 'key')\n .map(prop => {\n const value = toAstNode(props[prop]);\n return prop === '_$spread$'\n ? t.spreadElement(value)\n : t.objectProperty(t.stringLiteral(prop), value);\n });\n\n return t.objectExpression(result);\n}\nfunction transformJSXElement(\n path: NodePath<JSXElement>,\n result: Result,\n isRoot: boolean = false,\n): void {\n if (path.isJSXElement()) {\n const tagName = getTagName(path.node);\n const tagIsComponent = isComponent(tagName);\n const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);\n const isSvg = svgTags.includes(tagName) && result.index === 1;\n const props = getAttrProps(path);\n if (tagIsComponent) {\n if (isRoot) {\n result.props = props;\n const children = getChildren(path) as any;\n if (children.length > 0) {\n const childrenGenerator =\n children.length === 1 ? children[0] : t.arrayExpression(children);\n result.props.children = childrenGenerator;\n }\n } else {\n transformJSXClient(path);\n replaceChild(path.node, result);\n }\n } else {\n if (isSvg) {\n result.template = '<svg _svg_>';\n }\n result.template += `<${tagName}`;\n handleAttributes(props, result);\n result.template += isSelfClose ? '/>' : '>';\n if (!isSelfClose) {\n transformChildren(path, result);\n result.template += `</${tagName}>`;\n }\n }\n } else {\n result.index--;\n transformChildren(path, result);\n }\n}\n\nfunction transformChildren(path: NodePath<JSXElement>, result: Result): void {\n const parentIndex = result.index;\n path\n .get('children')\n .reduce((pre, cur) => {\n if (isValidChild(cur)) {\n const lastChild = pre.at(-1);\n if (lastChild && isTextChild(cur) && isTextChild(lastChild)) {\n setNodeText(lastChild, getNodeText(lastChild) + getNodeText(cur));\n } else {\n pre.push(cur);\n }\n }\n return pre;\n }, [] as NodePath<JSXChild>[])\n .forEach((child, i, arr) => {\n result.parentIndex = parentIndex;\n result.isLastChild = i === arr.length - 1;\n transformChild(child, result);\n });\n}\n\nfunction transformChild(child: NodePath<JSXChild>, result: Result): void {\n result.index++;\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXElement(child, result, false);\n } else if (child.isJSXExpressionContainer()) {\n const expression = child.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n result.template += String(expression.node.value);\n } else if (expression.isExpression()) {\n replaceChild(expression.node, result);\n } else {\n throw new Error('Unsupported child type');\n }\n } else if (child.isJSXText()) {\n result.template += String(child.node.value);\n } else {\n throw new Error('Unsupported child type');\n }\n}\n\nfunction getNodeText(path: NodePath<JSXChild>): string {\n if (path.isJSXText()) {\n return path.node.value;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n return String(expression.node.value);\n }\n }\n return '';\n}\nfunction setNodeText(path: NodePath<JSXChild>, text: string): void {\n if (path.isJSXText()) {\n path.node.value = text;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n expression.replaceWith(t.stringLiteral(text));\n }\n }\n}\n\nexport function isTextChild(path: NodePath<JSXChild>): boolean {\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isJSXText() || expression.isStringLiteral() || expression.isNumericLiteral()) {\n return true;\n }\n }\n if (path.isJSXText() || path.isStringLiteral() || path.isNullLiteral()) {\n return true;\n }\n return false;\n}\n\nfunction handleAttributes(props: Record<string, any>, result: Result): void {\n let klass = '';\n let style = '';\n\n for (const prop in props) {\n const value = props[prop];\n\n if (prop === 'class' && typeof value === 'string') {\n klass += ` ${value}`;\n delete props[prop];\n continue;\n }\n if (prop.indexOf('class:') === 0) {\n if (value === true) {\n const name = prop.replace(/^class:/, '');\n klass += ` ${name}`;\n delete props[prop];\n continue;\n }\n if (value === false) {\n delete props[prop];\n continue;\n }\n }\n\n if (prop === 'style' && typeof value === 'string') {\n style += `${value}${value.at(-1) === ';' ? '' : ';'}`;\n delete props[prop];\n continue;\n }\n if (prop.indexOf('style:') === 0 && (typeof value === 'string' || typeof value === 'number')) {\n const name = prop.replace(/^style:/, '');\n style += `${name}:${value};`;\n delete props[prop];\n continue;\n }\n\n if (value === true) {\n result.template += ` ${prop}`;\n delete props[prop];\n }\n if (value === false) {\n delete props[prop];\n }\n if (typeof value === 'string' || typeof value === 'number') {\n result.template += ` ${prop}=\"${value}\"`;\n delete props[prop];\n }\n }\n\n if (Object.keys(props).length > 0) {\n result.props[result.index] = props;\n }\n\n klass = klass.trim();\n style = style.trim();\n\n if (klass) {\n result.template += ` class=\"${klass}\"`;\n }\n if (style) {\n result.template += ` style=\"${style}\"`;\n }\n}\n\nfunction replaceChild(node: t.Expression, result: Result): void {\n if (result.isLastChild) {\n result.index--;\n } else {\n result.template += '<!-->';\n }\n result.props[result.parentIndex] ??= {};\n result.props[result.parentIndex].children ??= [];\n result.props[result.parentIndex].children.push(\n t.arrayExpression([\n t.arrowFunctionExpression([], node),\n result.isLastChild ? t.nullLiteral() : t.identifier(String(result.index)),\n ]),\n );\n}\n\nfunction getChildren(path: NodePath<JSXElement>): JSXChild[] {\n return path\n .get('children')\n .filter(child => isValidChild(child))\n .map(child => {\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXClient(child);\n } else if (child.isJSXExpressionContainer()) {\n child.replaceWith(child.get('expression'));\n } else if (child.isJSXText()) {\n child.replaceWith(t.stringLiteral(child.node.value));\n } else {\n throw new Error('Unsupported child type');\n }\n return child.node;\n });\n}\n\nexport function isValidChild(path: NodePath<JSXChild>): boolean {\n const regex = /^\\s*$/;\n if (path.isStringLiteral() || path.isJSXText()) {\n return !regex.test(path.node.value);\n }\n return Object.keys(path.node).length > 0;\n}\nexport function getAttrProps(path: NodePath<t.JSXElement>): Record<string, any> {\n const props: Record<string, any> = {};\n\n path\n .get('openingElement')\n .get('attributes')\n .forEach(attribute => {\n if (attribute.isJSXAttribute()) {\n const name = getAttrName(attribute.node);\n const value = attribute.get('value');\n\n if (!value.node) {\n props[name] = true;\n } else if (value.isStringLiteral()) {\n props[name] = value.node.value;\n } else {\n if (value.isJSXExpressionContainer()) {\n const expression = value.get('expression');\n\n if (expression.isStringLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isNumericLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isJSXElement() || expression.isJSXFragment()) {\n transformJSXClient(expression);\n props[name] = expression.node;\n } else if (expression.isExpression()) {\n if (/^key|ref|on.+$/.test(name)) {\n props[name] = expression.node;\n } else if (/^bind:.+/.test(name)) {\n props[name] = t.arrowFunctionExpression([], expression.node);\n } else {\n if (expression.isConditionalExpression()) {\n props[name] = t.arrowFunctionExpression([], expression.node);\n } else {\n props[name] = expression.node;\n }\n }\n }\n } else if (value.isJSXElement() || value.isJSXFragment()) {\n transformJSXClient(value);\n props[name] = value.node;\n }\n }\n } else if (attribute.isJSXSpreadAttribute()) {\n props._$spread$ = attribute.get('argument').node;\n } else {\n throw new Error('Unsupported attribute type');\n }\n });\n\n return props;\n}\nexport function getAttrName(attribute: t.JSXAttribute): string {\n if (t.isJSXIdentifier(attribute.name)) {\n return attribute.name.name;\n }\n if (t.isJSXNamespacedName(attribute.name)) {\n return `${attribute.name.namespace.name}:${attribute.name.name.name}`;\n }\n throw new Error('Unsupported attribute type');\n}\n/**\n * Determines if the given tagName is a component.\n *\n * case1: <MyComponent />\n * case2: <SomeLibrary.SomeComponent />;\n * case3: <_component />;\n *\n * @param {string} tagName - The name of the tag to check.\n * @return {boolean} True if the tagName is a component, false otherwise.\n */\nexport function isComponent(tagName: string): boolean {\n return (\n (tagName[0] && tagName[0].toLowerCase() !== tagName[0]) ||\n tagName.includes('.') ||\n /[^A-Za-z]/.test(tagName[0])\n );\n}\n\nexport function getTagName(node: t.JSXElement): string {\n const tag = node.openingElement.name;\n return jsxElementNameToString(tag);\n}\n\n/**\n * Converts a JSX element name to a string representation.\n *\n * case1: <MyComponent />\n * case2: <SomeLibrary.SomeComponent />;\n * case3: <namespace:ComponentName />;\n * case4: <SomeLibrary.Nested.ComponentName />;\n *\n * @param {t.JSXMemberExpression | t.JSXIdentifier | t.JSXNamespacedName} node The JSX element name to convert.\n * @returns {string} The string representation of the JSX element name.\n */\nexport function jsxElementNameToString(\n node: t.JSXMemberExpression | t.JSXIdentifier | t.JSXNamespacedName,\n) {\n if (t.isJSXMemberExpression(node)) {\n return `${jsxElementNameToString(node.object)}.${jsxElementNameToString(node.property)}`;\n }\n\n if (t.isJSXIdentifier(node) || t.isIdentifier(node)) {\n return node.name;\n }\n\n return `${node.namespace.name}:${node.name.name}`;\n}\n","import { transformJSXService } from './server';\nimport { transformJSXClient } from './client';\nimport type { NodePath, types as t } from '@babel/core';\nimport type { State } from '../types';\ntype JSXElement = t.JSXElement | t.JSXFragment;\nexport function transformJSX(path: NodePath<JSXElement>) {\n const state: State = path.state;\n const isSsr = state.opts.ssr;\n return isSsr ? transformJSXService(path) : transformJSXClient(path);\n}\n","import { types as t } from '@babel/core';\nimport { type Identifier, type VariableDeclarator, cloneNode } from '@babel/types';\nimport { imports } from '../program';\nimport type { NodePath } from '@babel/core';\n\nexport function replaceSymbol(path: NodePath<VariableDeclarator>) {\n const init = path.node.init;\n const variableName = (path.node.id as Identifier).name;\n\n if (t.isObjectPattern(path.node.id) || t.isArrayPattern(path.node.id)) {\n return;\n }\n\n if (!variableName.startsWith('$')) {\n return;\n }\n\n if (\n init &&\n (t.isFunctionExpression(init) || t.isArrowFunctionExpression(init)) &&\n (path.parent as t.VariableDeclaration).kind === 'const'\n ) {\n // 处理箭头函数表达式,将其转换为 _computed 调用\n const newInit = t.callExpression(t.identifier(path.state.useComputed.name), init ? [init] : []);\n imports.add('useComputed');\n path.node.init = newInit; // 直接替换 AST 节点\n } else {\n // 判断参数是否是基本数据类型 ,也可能没有参数\n const originalImportDeclarationNodes = cloneNode(path.get('id').node, true);\n\n const newInit = t.callExpression(t.identifier(path.state.useSignal.name), init ? [init] : []);\n imports.add('useSignal');\n path.node.init = newInit;\n\n path.scope.rename(variableName, `${variableName}.value`);\n\n path.get('id').replaceWith(originalImportDeclarationNodes);\n\n // // 这里需要确保只修改在当前作用域中的变量名\n // path.scope.traverse(path.scope.block, {\n // Identifier(innerPath) {\n // if (t.isExportSpecifier(innerPath.parent)) {\n // const { name } = innerPath.node;\n // if (name.endsWith('.value')) {\n // innerPath.node.name = name.slice(0, -6); // 删除 '.value' 部分\n // }\n // }\n // },\n // });\n }\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport type { ImportDeclaration } from '@babel/types';\n\nfunction isVariableUsedAsObject(path: NodePath<ImportDeclaration>, variableName: string) {\n const binding = path.scope.getBinding(variableName);\n let isUsedObject = false;\n if (!binding || !binding.referencePaths) {\n return isUsedObject;\n }\n\n for (const referencePath of binding.referencePaths) {\n if (t.isMemberExpression(referencePath.parent)) {\n // const memberExprParent = referencePath.parent;\n\n // if (memberExprParent.object && memberExprParent.property) {\n // const newMemberExpr = t.memberExpression(\n // memberExprParent.object,\n // t.identifier(`${(memberExprParent.property as t.Identifier).name}.value`),\n // );\n // referencePath.parentPath?.replaceWith(newMemberExpr);\n isUsedObject = true;\n // }\n }\n }\n\n return isUsedObject;\n}\n// TODO: 暂时不支持对象\nexport function replaceImportDeclaration(path: NodePath<ImportDeclaration>) {\n const imports = path.node.specifiers;\n imports.forEach(specifier => {\n const variableName = specifier.local.name;\n\n if (variableName.indexOf('$') === 0 && !isVariableUsedAsObject(path, variableName)) {\n path.scope.rename(variableName, `${variableName}.value`);\n specifier.local.name = `${variableName}`;\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA2B;;;ACA3B,kBAA0C;AAEnC,IAAM,UAAU,oBAAI,IAAY;AAEhC,IAAM,mBAAmB;AAAA,EAC9B,MAAM,MAA2B,OAAO;AACtC,SAAK,QAAQ;AAA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;AACH;;;APhCe,SAAR,cAA+B;AACpC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,kBAAkB,EAAE,SAAS,GAAG,YAAY;AAC1C,UAAI,SAAS,SAAS,KAAK,KAAK,SAAS,SAAS,MAAM,GAAG;AACzD,mBAAW,QAAQ,KAAK,YAAY;AAAA,MACtC;AACA,iBAAW,QAAQ,KAAK,KAAK;AAAA,IAC/B;AAAA,IACA,SAAS;AAAA,MACP,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,IACrB;AAAA,EACF;AACF;","names":["import_core","t","import_core","t","createEssorNode","t","createProps","getAttrProps","getChildren","replaceChild","handleAttributes","transformChildren","isValidChild","setNodeText","getNodeText","transformChild","import_core","t","import_core","t","imports"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../../shared/src/is.ts","../../shared/src/comm.ts","../../shared/src/name.ts","../src/jsx/server.ts","../src/program.ts","../src/jsx/constants.ts","../src/jsx/client.ts","../src/jsx/index.ts","../src/signal/symbol.ts","../src/signal/import.ts","../src/signal/props.ts"],"sourcesContent":["import { transformJSX } from './jsx';\nimport { transformProgram } from './program';\nimport { replaceSymbol } from './signal/symbol';\nimport { replaceImportDeclaration } from './signal/import';\nimport { replaceProps } from './signal/props';\nimport type { PluginObj } from '@babel/core';\nexport { Options, State } from './types';\nexport default function (): PluginObj {\n return {\n name: 'babel-plugin-essor',\n manipulateOptions({ filename }, parserOpts) {\n if (filename.endsWith('.ts') || filename.endsWith('.tsx')) {\n parserOpts.plugins.push('typescript');\n }\n parserOpts.plugins.push('jsx');\n },\n visitor: {\n Program: transformProgram,\n JSXElement: transformJSX,\n JSXFragment: transformJSX,\n FunctionDeclaration: replaceProps,\n ArrowFunctionExpression: replaceProps,\n VariableDeclarator: replaceSymbol,\n ImportDeclaration: replaceImportDeclaration,\n },\n };\n}\n","import { _toString } from './comm';\n\nexport const isObject = (val: unknown): val is Record<any, any> =>\n val !== null && typeof val === 'object';\nexport function isPromise(val: any): boolean {\n return _toString.call(val) === '[object Promise]';\n}\n\nexport const isArray = Array.isArray;\n\nexport function isString(val: unknown): val is string {\n return typeof val === 'string';\n}\nexport function isNull(val: any): val is null {\n return val === null;\n}\nexport function isSymbol(val: unknown): val is symbol {\n return typeof val === 'symbol';\n}\nexport function isMap(val: unknown): val is Map<any, any> {\n return _toString.call(val) === '[object Map]';\n}\nexport function isNil(x: any): x is null | undefined {\n return x === null || x === undefined;\n}\n\nexport const isFunction = (val: unknown): val is Function => typeof val === 'function';\n\nexport function isFalsy(x: any): x is false | null | undefined {\n return x === false || x === null || x === undefined || x === '';\n}\n\nexport const isPrimitive = (\n val: unknown,\n): val is string | number | boolean | symbol | null | undefined =>\n ['string', 'number', 'boolean', 'symbol', 'undefined'].includes(typeof val) || isNull(val);\n","import { isPrimitive } from './is';\n\nexport const _toString = Object.prototype.toString;\nexport const extend = Object.assign;\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\nexport const hasOwn = (val: object, key: string | symbol): key is keyof typeof val =>\n hasOwnProperty.call(val, key);\n\nexport function coerceArray<T>(data: T | T[]): T[] {\n return Array.isArray(data) ? (data.flat() as T[]) : [data];\n}\nexport function hasChanged(value, oldValue) {\n return !Object.is(value, oldValue);\n}\nexport const noop = Function.prototype as () => void;\n\n/**\n * A function that checks if a string starts with a specific substring.\n * indexOf faster under normal circumstances\n * @see https://www.measurethat.net/Benchmarks/Show/12350/0/startswith-vs-test-vs-match-vs-indexof#latest_results_block\n\n * @param {string} str - The input string to check.\n * @param {string} searchString - The substring to check for at the beginning of the input string.\n * @return {boolean} Returns true if the input string starts with the specified substring, otherwise false.\n */\nexport function startsWith(str, searchString) {\n return str.indexOf(searchString) === 0;\n}\n\n/**\n * Recursively clones an object, including its nested properties and special types like Date, RegExp, Map, and Set.\n *\n * @param {any} obj - The object to clone.\n * @param {WeakMap<object, object>} [hash] - A WeakMap used to track circular references.\n * @return {any} The cloned object.\n */\nexport function deepClone(obj, hash = new WeakMap()) {\n // Return primitives and functions as-is\n if (obj === null || typeof obj !== 'object') {\n return obj;\n }\n\n // Handle circular references\n if (hash.has(obj)) {\n return hash.get(obj);\n }\n\n // Handle special types\n if (obj instanceof Date) {\n return new Date(obj);\n }\n\n if (obj instanceof RegExp) {\n return new RegExp(obj);\n }\n\n if (obj instanceof Map) {\n const mapClone = new Map();\n hash.set(obj, mapClone);\n obj.forEach((value, key) => {\n mapClone.set(deepClone(key, hash), deepClone(value, hash));\n });\n return mapClone;\n }\n\n if (obj instanceof Set) {\n const setClone = new Set();\n hash.set(obj, setClone);\n obj.forEach(value => {\n setClone.add(deepClone(value, hash));\n });\n return setClone;\n }\n\n // Initialize the clone and store it in the WeakMap\n const cloneObj = Array.isArray(obj) ? [] : {};\n hash.set(obj, cloneObj);\n\n // Iterate over object keys\n const keys = Object.keys(obj);\n for (const key of keys) {\n cloneObj[key] = deepClone(obj[key], hash);\n }\n\n return cloneObj;\n}\n\n/**\n * Determines whether two values are deeply equal.\n *\n * @param {any} a - The first value to compare.\n * @param {any} b - The second value to compare.\n * @param {WeakMap<object, object>} [seen] - A WeakMap used to store previously seen objects to avoid infinite recursion.\n * @return {boolean} True if the values are deeply equal, false otherwise.\n */\nexport function deepEqual(a: any, b: any, seen = new WeakMap()): boolean {\n if (isPrimitive(a) && isPrimitive(b)) {\n return a === b;\n }\n\n if (a === b) {\n return true;\n }\n\n if (a == null || b == null || typeof a !== 'object' || typeof b !== 'object') {\n return false;\n }\n\n if (a.constructor !== b.constructor) {\n return false;\n }\n\n if (seen.has(a)) {\n return seen.get(a) === b;\n }\n\n seen.set(a, b);\n\n if (Array.isArray(a)) {\n if (a.length !== b.length) {\n return false;\n }\n for (const [i, element] of a.entries()) {\n if (!deepEqual(element, b[i], seen)) {\n return false;\n }\n }\n return true;\n }\n\n if (a instanceof Map) {\n if (a.size !== b.size) {\n return false;\n }\n for (const [key, value] of a) {\n if (!b.has(key) || !deepEqual(value, b.get(key), seen)) {\n return false;\n }\n }\n return true;\n }\n\n if (a instanceof Set) {\n if (a.size !== b.size) {\n return false;\n }\n const arrA = Array.from(a).sort();\n const arrB = Array.from(b).sort();\n for (const [i, element] of arrA.entries()) {\n if (!deepEqual(element, arrB[i], seen)) {\n return false;\n }\n }\n return true;\n }\n\n const keysA = Object.keys(a);\n const keysB = new Set(Object.keys(b));\n\n if (keysA.length !== keysB.size) {\n return false;\n }\n\n for (const key of keysA) {\n if (!keysB.has(key) || !deepEqual(a[key], b[key], seen)) {\n return false;\n }\n }\n\n return true;\n}\n","export const kebabCase = (string: string): string => {\n return string.replaceAll(/[A-Z]+/g, (match, offset) => {\n return `${offset > 0 ? '-' : ''}${match.toLocaleLowerCase()}`;\n });\n};\n\nexport const camelCase = (str: string): string => {\n const s = str.replaceAll(/[\\s_-]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''));\n return s[0].toLowerCase() + s.slice(1);\n};\n/**\n * Capitalizes the first letter of a string.\n *\n * @param {string} inputString - The input string to capitalize the first letter.\n * @return {string} The string with the first letter capitalized.\n */\nexport const capitalizeFirstLetter = (inputString: string): string => {\n return inputString.charAt(0).toUpperCase() + inputString.slice(1);\n};\n","import { capitalizeFirstLetter, startsWith } from 'essor-shared';\nimport { types as t } from '@babel/core';\nimport { imports } from '../program';\nimport { selfClosingTags, svgTags } from './constants';\nimport { getAttrName, getTagName, isComponent, isTextChild } from './client';\nimport type { OptionalMemberExpression } from '@babel/types';\nimport type { State } from '../types';\nimport type { NodePath } from '@babel/core';\ntype JSXElement = t.JSXElement | t.JSXFragment;\ninterface Result {\n index: number;\n isLastChild: boolean;\n parentIndex: number;\n props: Record<string, any>;\n template: string[];\n}\n\ntype JSXChild =\n | t.JSXElement\n | t.JSXFragment\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXText;\n\nexport function transformJSXService(path: NodePath<JSXElement>): void {\n const result: Result = {\n index: 0,\n isLastChild: false,\n parentIndex: 0,\n props: {},\n template: [], // 修改为数组\n };\n transformJSXServiceElement(path, result, true);\n path.replaceWith(createEssorNode(path, result));\n}\n\nfunction createEssorNode(path: NodePath<JSXElement>, result: Result): t.CallExpression {\n const state: State = path.state;\n\n let tmpl: t.Identifier;\n if (path.isJSXElement() && isComponent(getTagName(path.node))) {\n tmpl = t.identifier(getTagName(path.node));\n } else {\n tmpl = path.scope.generateUidIdentifier('_tmpl$');\n const template = t.callExpression(state.ssrtmpl, [\n t.arrayExpression(result.template.map(t.stringLiteral)),\n ]);\n const declarator = t.variableDeclarator(tmpl, template);\n state.tmplDeclaration.declarations.push(declarator);\n\n imports.add('ssrtmpl');\n }\n\n const args = [tmpl, createProps(result.props)];\n const key = result.props.key || result.props[0]?.key;\n if (key) {\n args.push(key);\n }\n imports.add('ssr');\n return t.callExpression(state.ssr, args);\n}\n\nfunction createProps(props: Record<string, any>): t.ObjectExpression {\n const result: (t.ObjectProperty | t.SpreadElement)[] = [];\n\n for (const prop in props) {\n let value = props[prop];\n\n if (prop === 'key') {\n continue;\n }\n\n if (Array.isArray(value)) {\n value = t.arrayExpression(value);\n }\n\n if (typeof value === 'object' && value !== null && !t.isNode(value)) {\n value = createProps(value);\n }\n\n if (typeof value === 'string') {\n value = t.stringLiteral(value);\n }\n\n if (typeof value === 'number') {\n value = t.numericLiteral(value);\n }\n\n if (typeof value === 'boolean') {\n value = t.booleanLiteral(value);\n }\n\n if (value === undefined) {\n value = t.tsUndefinedKeyword();\n }\n\n if (value === null) {\n value = t.nullLiteral();\n }\n\n if (prop === '_$spread$') {\n result.push(t.spreadElement(value));\n } else {\n result.push(t.objectProperty(t.stringLiteral(prop), value));\n }\n }\n\n return t.objectExpression(result);\n}\nfunction transformJSXServiceElement(\n path: NodePath<JSXElement>,\n result: Result,\n isRoot: boolean = false,\n): void {\n if (path.isJSXElement()) {\n const tagName = getTagName(path.node);\n const tagIsComponent = isComponent(tagName);\n const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);\n const isSvg = svgTags.includes(tagName) && result.index === 1;\n const { props, hasExpression } = getAttrProps(path);\n if (tagIsComponent) {\n if (isRoot) {\n result.props = props;\n const children = getChildren(path) as any;\n if (children.length > 0) {\n const childrenGenerator =\n children.length === 1 ? children[0] : t.arrayExpression(children);\n result.props.children = childrenGenerator;\n }\n } else {\n transformJSXService(path);\n replaceChild(path.node, result);\n }\n } else {\n if (isSvg) {\n result.template.push('<svg _svg_>');\n }\n result.template.push(`<${tagName}`);\n handleAttributes(props, result);\n\n if (hasExpression) {\n result.template.push(isSelfClose ? '/>' : '>');\n result.props ||= {};\n } else {\n result.template[result.template.length - 1] += isSelfClose ? '/>' : '>';\n }\n transformChildren(path, result);\n\n if (!isSelfClose) {\n result.template.push(`</${tagName}>`);\n }\n }\n } else {\n result.index--;\n transformChildren(path, result);\n }\n}\n\nfunction transformChildren(path: NodePath<JSXElement>, result: Result): void {\n const parentIndex = result.template.length;\n path\n .get('children')\n .reduce((pre, cur) => {\n if (isValidChild(cur)) {\n const lastChild = pre.at(-1);\n if (lastChild && isTextChild(cur) && isTextChild(lastChild)) {\n setNodeText(lastChild, getNodeText(lastChild) + getNodeText(cur));\n } else {\n pre.push(cur);\n }\n }\n return pre;\n }, [] as NodePath<JSXChild>[])\n .forEach((child, i, arr) => {\n result.parentIndex = parentIndex;\n result.isLastChild = i === arr.length - 1;\n transformChild(child, result);\n });\n}\n\nfunction transformChild(child: NodePath<JSXChild>, result: Result): void {\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXServiceElement(child, result, false);\n } else if (child.isJSXExpressionContainer()) {\n const expression = child.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n result.template[result.template.length - 1] += String(expression.node.value);\n } else if (expression.isExpression()) {\n replaceChild(expression.node, result);\n } else if (t.isJSXEmptyExpression(expression.node)) {\n // it is empty expression\n // do nothing\n } else {\n throw new Error('Unsupported child type');\n }\n } else if (child.isJSXText()) {\n result.template.push(String(child.node.value));\n } else {\n throw new Error('Unsupported child type');\n }\n}\n\nfunction getNodeText(path: NodePath<JSXChild>): string {\n if (path.isJSXText()) {\n return path.node.value;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n return String(expression.node.value);\n }\n }\n return '';\n}\nfunction setNodeText(path: NodePath<JSXChild>, text: string): void {\n if (path.isJSXText()) {\n path.node.value = text;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n expression.replaceWith(t.stringLiteral(text));\n }\n }\n}\n\nfunction handleAttributes(props: Record<string, any>, result: Result): void {\n let klass = '';\n let style = '';\n\n for (const prop in props) {\n const value = props[prop];\n\n if (prop === 'class' && typeof value === 'string') {\n klass += ` ${value}`;\n delete props[prop];\n continue;\n }\n if (startsWith(prop, 'class:')) {\n if (value === true) {\n const name = prop.replace(/^class:/, '');\n klass += ` ${name}`;\n delete props[prop];\n continue;\n }\n if (value === false) {\n delete props[prop];\n continue;\n }\n }\n\n if (prop === 'style' && typeof value === 'string') {\n style += `${value}${value.at(-1) === ';' ? '' : ';'}`;\n delete props[prop];\n continue;\n }\n if (startsWith(prop, 'style:') && (typeof value === 'string' || typeof value === 'number')) {\n const name = prop.replace(/^style:/, '');\n style += `${name}:${value};`;\n delete props[prop];\n continue;\n }\n\n if (value === true) {\n result.template[result.template.length - 1] += ` ${prop}`;\n delete props[prop];\n }\n if (value === false) {\n delete props[prop];\n }\n if (typeof value === 'string' || typeof value === 'number') {\n result.template[result.template.length - 1] += ` ${prop}=\"${value}\"`;\n delete props[prop];\n }\n }\n\n if (Object.keys(props).length > 0) {\n result.props[result.index] = props;\n }\n\n klass = klass.trim();\n style = style.trim();\n\n if (klass) {\n result.template[result.template.length - 1] += ` class=\"${klass}\"`;\n }\n if (style) {\n result.template[result.template.length - 1] += ` style=\"${style}\"`;\n }\n}\n\nfunction replaceChild(node: t.Expression, result: Result): void {\n if (result.isLastChild) {\n result.index--;\n }\n result.props[result.parentIndex] ??= {};\n result.props[result.parentIndex].children ??= [];\n result.props[result.parentIndex].children.push(\n t.arrayExpression([\n t.arrowFunctionExpression([], node),\n t.identifier(String(result.template.length)),\n ]),\n );\n}\n\nfunction getChildren(path: NodePath<JSXElement>): JSXChild[] {\n return path\n .get('children')\n .filter(child => isValidChild(child))\n .map(child => {\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXService(child);\n } else if (child.isJSXExpressionContainer()) {\n child.replaceWith(child.get('expression'));\n } else if (child.isJSXText()) {\n child.replaceWith(t.stringLiteral(child.node.value));\n } else {\n throw new Error('Unsupported child type');\n }\n return child.node;\n });\n}\n\nfunction isValidChild(path: NodePath<JSXChild>): boolean {\n const regex = /^\\s*$/;\n if (path.isStringLiteral() || path.isJSXText()) {\n return !regex.test(path.node.value);\n }\n return Object.keys(path.node).length > 0;\n}\nfunction getAttrProps(path: NodePath<t.JSXElement>): Record<string, any> {\n const props: Record<string, any> = {};\n let hasExpression = false;\n path\n .get('openingElement')\n .get('attributes')\n .forEach(attribute => {\n if (attribute.isJSXAttribute()) {\n const name = getAttrName(attribute.node);\n const value = attribute.get('value');\n\n if (!value.node) {\n props[name] = true;\n } else if (value.isStringLiteral()) {\n props[name] = value.node.value;\n } else {\n if (value.isJSXExpressionContainer()) {\n const expression = value.get('expression');\n\n if (expression.isStringLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isNumericLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isJSXElement() || expression.isJSXFragment()) {\n transformJSXService(expression);\n props[name] = expression.node;\n } else if (expression.isExpression()) {\n hasExpression = true;\n if (/^key|ref|on.+$/.test(name)) {\n props[name] = expression.node;\n } else if (/^bind:.+/.test(name)) {\n const value = path.scope.generateUidIdentifier('value');\n const bindName = name.slice(5).toLocaleLowerCase();\n props[bindName] = expression.node;\n props[`update${capitalizeFirstLetter(bindName)}`] = t.arrowFunctionExpression(\n [value],\n t.assignmentExpression('=', expression.node as OptionalMemberExpression, value),\n );\n } else {\n if (expression.isConditionalExpression()) {\n props[name] = t.arrowFunctionExpression([], expression.node);\n } else {\n props[name] = expression.node;\n }\n }\n }\n } else if (value.isJSXElement() || value.isJSXFragment()) {\n transformJSXService(value);\n props[name] = value.node;\n }\n }\n } else if (attribute.isJSXSpreadAttribute()) {\n props._$spread$ = attribute.get('argument').node;\n hasExpression = true;\n } else {\n throw new Error('Unsupported attribute type');\n }\n });\n\n return {\n props,\n hasExpression,\n };\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport type { State } from './types';\nexport const imports = new Set<string>();\n\nexport const transformProgram = {\n enter(path: NodePath<t.Program>, state) {\n path.state = {\n h: path.scope.generateUidIdentifier('h$'),\n ssrtmpl: path.scope.generateUidIdentifier('ssrtmpl$'),\n ssr: path.scope.generateUidIdentifier('ssr$'),\n template: path.scope.generateUidIdentifier('template$'),\n\n useSignal: path.scope.generateUidIdentifier('signal$'),\n useComputed: path.scope.generateUidIdentifier('computed$'),\n\n tmplDeclaration: t.variableDeclaration('const', []),\n opts: state.opts,\n } as State;\n },\n exit(path: NodePath<t.Program>) {\n const state: State = path.state;\n if (state.tmplDeclaration.declarations.length > 0) {\n const index = path.node.body.findIndex(\n node => !t.isImportDeclaration(node) && !t.isExportDeclaration(node),\n );\n path.node.body.splice(index, 0, state.tmplDeclaration);\n }\n if (imports.size > 0) {\n path.node.body.unshift(createImport(state, 'essor'));\n }\n },\n};\nfunction createImport(state: State, from: string) {\n const ImportSpecifier: t.ImportSpecifier[] = [];\n imports.forEach(name => {\n const local = t.identifier(state[name].name);\n const imported = t.identifier(name);\n ImportSpecifier.push(t.importSpecifier(local, imported));\n });\n\n const importSource = t.stringLiteral(from);\n return t.importDeclaration(ImportSpecifier, importSource);\n}\n","export const selfClosingTags = [\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n];\n\nexport const svgTags = [\n 'circle',\n 'clipPath',\n 'defs',\n 'ellipse',\n 'filter',\n 'g',\n 'line',\n 'linearGradient',\n 'mask',\n 'path',\n 'pattern',\n 'polygon',\n 'polyline',\n 'radialGradient',\n 'rect',\n 'stop',\n 'symbol',\n 'text',\n 'use',\n];\n","import { types as t } from '@babel/core';\nimport { capitalizeFirstLetter, startsWith } from 'essor-shared';\nimport { imports } from '../program';\nimport { selfClosingTags, svgTags } from './constants';\nimport type { OptionalMemberExpression } from '@babel/types';\nimport type { State } from '../types';\nimport type { NodePath } from '@babel/core';\ntype JSXElement = t.JSXElement | t.JSXFragment;\ninterface Result {\n index: number;\n isLastChild: boolean;\n parentIndex: number;\n props: Record<string, any>;\n template: string;\n}\n\ntype JSXChild =\n | t.JSXElement\n | t.JSXFragment\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXText;\n\nexport function transformJSXClient(path: NodePath<JSXElement>): void {\n const result: Result = {\n index: 1,\n isLastChild: false,\n parentIndex: 0,\n props: {},\n template: '',\n };\n transformJSXElement(path, result, true);\n\n path.replaceWith(createEssorNode(path, result));\n}\n\nfunction createEssorNode(path: NodePath<JSXElement>, result: Result): t.CallExpression {\n const state: State = path.state;\n\n let tmpl: t.Identifier;\n if (path.isJSXElement() && isComponent(getTagName(path.node))) {\n tmpl = t.identifier(getTagName(path.node));\n } else {\n tmpl = path.scope.generateUidIdentifier('_tmpl$');\n const template = t.callExpression(state.template, [t.stringLiteral(result.template)]);\n const declarator = t.variableDeclarator(tmpl, template);\n state.tmplDeclaration.declarations.push(declarator);\n imports.add('template');\n }\n\n const args = [tmpl, createProps(result.props)];\n const key = result.props.key || result.props[0]?.key;\n if (key) {\n args.push(key);\n }\n imports.add('h');\n return t.callExpression(state.h, args);\n}\n\nfunction createProps(props) {\n const toAstNode = value => {\n if (Array.isArray(value)) {\n return t.arrayExpression(value.map(toAstNode));\n }\n if (value && typeof value === 'object' && !t.isNode(value)) {\n return createProps(value);\n }\n\n switch (typeof value) {\n case 'string':\n return t.stringLiteral(value);\n case 'number':\n return t.numericLiteral(value);\n case 'boolean':\n return t.booleanLiteral(value);\n case 'undefined':\n return t.tsUndefinedKeyword();\n case undefined:\n return t.tsUndefinedKeyword();\n case null:\n return t.nullLiteral();\n default:\n return value;\n }\n };\n\n const result = Object.keys(props)\n .filter(prop => prop !== 'key')\n .map(prop => {\n const value = toAstNode(props[prop]);\n return prop === '_$spread$'\n ? t.spreadElement(value)\n : t.objectProperty(t.stringLiteral(prop), value);\n });\n\n return t.objectExpression(result);\n}\nfunction transformJSXElement(\n path: NodePath<JSXElement>,\n result: Result,\n isRoot: boolean = false,\n): void {\n if (path.isJSXElement()) {\n const tagName = getTagName(path.node);\n const tagIsComponent = isComponent(tagName);\n const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);\n const isSvg = svgTags.includes(tagName) && result.index === 1;\n const props = getAttrProps(path);\n if (tagIsComponent) {\n if (isRoot) {\n result.props = props;\n const children = getChildren(path) as any;\n if (children.length > 0) {\n const childrenGenerator =\n children.length === 1 ? children[0] : t.arrayExpression(children);\n result.props.children = childrenGenerator;\n }\n } else {\n transformJSXClient(path);\n replaceChild(path.node, result);\n }\n } else {\n if (isSvg) {\n result.template = '<svg _svg_>';\n }\n result.template += `<${tagName}`;\n handleAttributes(props, result);\n result.template += isSelfClose ? '/>' : '>';\n if (!isSelfClose) {\n transformChildren(path, result);\n result.template += `</${tagName}>`;\n }\n }\n } else {\n result.index--;\n transformChildren(path, result);\n }\n}\n\nfunction transformChildren(path: NodePath<JSXElement>, result: Result): void {\n const parentIndex = result.index;\n path\n .get('children')\n .reduce((pre, cur) => {\n if (isValidChild(cur)) {\n const lastChild = pre.at(-1);\n if (lastChild && isTextChild(cur) && isTextChild(lastChild)) {\n setNodeText(lastChild, getNodeText(lastChild) + getNodeText(cur));\n } else {\n pre.push(cur);\n }\n }\n return pre;\n }, [] as NodePath<JSXChild>[])\n .forEach((child, i, arr) => {\n result.parentIndex = parentIndex;\n result.isLastChild = i === arr.length - 1;\n transformChild(child, result);\n });\n}\n\nfunction transformChild(child: NodePath<JSXChild>, result: Result): void {\n result.index++;\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXElement(child, result, false);\n } else if (child.isJSXExpressionContainer()) {\n const expression = child.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n result.template += String(expression.node.value);\n } else if (expression.isExpression()) {\n replaceChild(expression.node, result);\n } else if (t.isJSXEmptyExpression(expression.node)) {\n // it is empty expression\n // do nothing\n } else {\n throw new Error('Unsupported child type');\n }\n } else if (child.isJSXText()) {\n result.template += String(child.node.value);\n } else {\n throw new Error('Unsupported child type');\n }\n}\n\nfunction getNodeText(path: NodePath<JSXChild>): string {\n if (path.isJSXText()) {\n return path.node.value;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n return String(expression.node.value);\n }\n }\n return '';\n}\nfunction setNodeText(path: NodePath<JSXChild>, text: string): void {\n if (path.isJSXText()) {\n path.node.value = text;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n expression.replaceWith(t.stringLiteral(text));\n }\n }\n}\n\nexport function isTextChild(path: NodePath<JSXChild>): boolean {\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isJSXText() || expression.isStringLiteral() || expression.isNumericLiteral()) {\n return true;\n }\n }\n if (path.isJSXText() || path.isStringLiteral() || path.isNullLiteral()) {\n return true;\n }\n return false;\n}\n\nfunction handleAttributes(props: Record<string, any>, result: Result): void {\n let klass = '';\n let style = '';\n\n for (const prop in props) {\n const value = props[prop];\n\n if (prop === 'class' && typeof value === 'string') {\n klass += ` ${value}`;\n delete props[prop];\n continue;\n }\n if (startsWith(prop, 'class:')) {\n if (value === true) {\n const name = prop.replace(/^class:/, '');\n klass += ` ${name}`;\n delete props[prop];\n continue;\n }\n if (value === false) {\n delete props[prop];\n continue;\n }\n }\n\n if (prop === 'style' && typeof value === 'string') {\n style += `${value}${value.at(-1) === ';' ? '' : ';'}`;\n delete props[prop];\n continue;\n }\n if (startsWith(prop, 'style:') && (typeof value === 'string' || typeof value === 'number')) {\n const name = prop.replace(/^style:/, '');\n style += `${name}:${value};`;\n delete props[prop];\n continue;\n }\n\n if (value === true) {\n result.template += ` ${prop}`;\n delete props[prop];\n }\n if (value === false) {\n delete props[prop];\n }\n if (typeof value === 'string' || typeof value === 'number') {\n result.template += ` ${prop}=\"${value}\"`;\n delete props[prop];\n }\n }\n\n if (Object.keys(props).length > 0) {\n result.props[result.index] = props;\n }\n\n klass = klass.trim();\n style = style.trim();\n\n if (klass) {\n result.template += ` class=\"${klass}\"`;\n }\n if (style) {\n result.template += ` style=\"${style}\"`;\n }\n}\n\nfunction replaceChild(node: t.Expression, result: Result): void {\n if (result.isLastChild) {\n result.index--;\n } else {\n result.template += '<!-->';\n }\n result.props[result.parentIndex] ??= {};\n result.props[result.parentIndex].children ??= [];\n result.props[result.parentIndex].children.push(\n t.arrayExpression([\n t.arrowFunctionExpression([], node),\n result.isLastChild ? t.nullLiteral() : t.identifier(String(result.index)),\n ]),\n );\n}\n\nfunction getChildren(path: NodePath<JSXElement>): JSXChild[] {\n return path\n .get('children')\n .filter(child => isValidChild(child))\n .map(child => {\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXClient(child);\n } else if (child.isJSXExpressionContainer()) {\n child.replaceWith(child.get('expression'));\n } else if (child.isJSXText()) {\n child.replaceWith(t.stringLiteral(child.node.value));\n } else {\n throw new Error('Unsupported child type');\n }\n return child.node;\n });\n}\n\nexport function isValidChild(path: NodePath<JSXChild>): boolean {\n const regex = /^\\s*$/;\n if (path.isStringLiteral() || path.isJSXText()) {\n return !regex.test(path.node.value);\n }\n return Object.keys(path.node).length > 0;\n}\nexport function getAttrProps(path: NodePath<t.JSXElement>): Record<string, any> {\n const props: Record<string, any> = {};\n\n path\n .get('openingElement')\n .get('attributes')\n .forEach(attribute => {\n if (attribute.isJSXAttribute()) {\n const name = getAttrName(attribute.node);\n const value = attribute.get('value');\n\n if (!value.node) {\n props[name] = true;\n } else if (value.isStringLiteral()) {\n props[name] = value.node.value;\n } else {\n if (value.isJSXExpressionContainer()) {\n const expression = value.get('expression');\n\n if (expression.isStringLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isNumericLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isJSXElement() || expression.isJSXFragment()) {\n transformJSXClient(expression);\n props[name] = expression.node;\n } else if (expression.isExpression()) {\n if (/^key|ref|on.+$/.test(name)) {\n props[name] = expression.node;\n } else if (/^bind:.+/.test(name)) {\n const value = path.scope.generateUidIdentifier('value');\n const bindName = name.slice(5).toLocaleLowerCase();\n props[bindName] = expression.node;\n props[`update${capitalizeFirstLetter(bindName)}`] = t.arrowFunctionExpression(\n [value],\n t.assignmentExpression('=', expression.node as OptionalMemberExpression, value),\n );\n } else {\n if (expression.isConditionalExpression()) {\n props[name] = t.arrowFunctionExpression([], expression.node);\n } else {\n props[name] = expression.node;\n }\n }\n }\n } else if (value.isJSXElement() || value.isJSXFragment()) {\n transformJSXClient(value);\n props[name] = value.node;\n }\n }\n } else if (attribute.isJSXSpreadAttribute()) {\n props._$spread$ = attribute.get('argument').node;\n } else {\n throw new Error('Unsupported attribute type');\n }\n });\n\n return props;\n}\nexport function getAttrName(attribute: t.JSXAttribute): string {\n if (t.isJSXIdentifier(attribute.name)) {\n return attribute.name.name;\n }\n if (t.isJSXNamespacedName(attribute.name)) {\n return `${attribute.name.namespace.name}:${attribute.name.name.name}`;\n }\n throw new Error('Unsupported attribute type');\n}\n/**\n * Determines if the given tagName is a component.\n *\n * case1: <MyComponent />\n * case2: <SomeLibrary.SomeComponent />;\n * case3: <_component />;\n *\n * @param {string} tagName - The name of the tag to check.\n * @return {boolean} True if the tagName is a component, false otherwise.\n */\nexport function isComponent(tagName: string): boolean {\n return (\n (tagName[0] && tagName[0].toLowerCase() !== tagName[0]) ||\n tagName.includes('.') ||\n /[^A-Za-z]/.test(tagName[0])\n );\n}\n\nexport function getTagName(node: t.JSXElement): string {\n const tag = node.openingElement.name;\n return jsxElementNameToString(tag);\n}\n\n/**\n * Converts a JSX element name to a string representation.\n *\n * case1: <MyComponent />\n * case2: <SomeLibrary.SomeComponent />;\n * case3: <namespace:ComponentName />;\n * case4: <SomeLibrary.Nested.ComponentName />;\n *\n * @param {t.JSXMemberExpression | t.JSXIdentifier | t.JSXNamespacedName} node The JSX element name to convert.\n * @returns {string} The string representation of the JSX element name.\n */\nexport function jsxElementNameToString(\n node: t.JSXMemberExpression | t.JSXIdentifier | t.JSXNamespacedName,\n) {\n if (t.isJSXMemberExpression(node)) {\n return `${jsxElementNameToString(node.object)}.${jsxElementNameToString(node.property)}`;\n }\n\n if (t.isJSXIdentifier(node) || t.isIdentifier(node)) {\n return node.name;\n }\n\n return `${node.namespace.name}:${node.name.name}`;\n}\n","import { transformJSXService } from './server';\nimport { transformJSXClient } from './client';\nimport type { NodePath, types as t } from '@babel/core';\nimport type { State } from '../types';\ntype JSXElement = t.JSXElement | t.JSXFragment;\nexport function transformJSX(path: NodePath<JSXElement>) {\n const state: State = path.state;\n const isSsr = state.opts.ssr;\n return isSsr ? transformJSXService(path) : transformJSXClient(path);\n}\n","import { types as t } from '@babel/core';\nimport { type Identifier, type VariableDeclarator, cloneNode } from '@babel/types';\nimport { startsWith } from 'essor-shared';\nimport { imports } from '../program';\nimport type { NodePath } from '@babel/core';\n\nexport function replaceSymbol(path: NodePath<VariableDeclarator>) {\n const init = path.node.init;\n const variableName = (path.node.id as Identifier).name;\n\n if (t.isObjectPattern(path.node.id) || t.isArrayPattern(path.node.id)) {\n return;\n }\n\n if (!startsWith(variableName, '$')) {\n return;\n }\n\n if (\n init &&\n (t.isFunctionExpression(init) || t.isArrowFunctionExpression(init)) &&\n (path.parent as t.VariableDeclaration).kind === 'const'\n ) {\n // 处理箭头函数表达式,将其转换为 _computed 调用\n const newInit = t.callExpression(t.identifier(path.state.useComputed.name), init ? [init] : []);\n imports.add('useComputed');\n path.node.init = newInit; // 直接替换 AST 节点\n } else {\n // 判断参数是否是基本数据类型 ,也可能没有参数\n const originalImportDeclarationNodes = cloneNode(path.get('id').node, true);\n\n const newInit = t.callExpression(t.identifier(path.state.useSignal.name), init ? [init] : []);\n imports.add('useSignal');\n path.node.init = newInit;\n\n path.scope.rename(variableName, `${variableName}.value`);\n\n path.get('id').replaceWith(originalImportDeclarationNodes);\n\n // // 这里需要确保只修改在当前作用域中的变量名\n // path.scope.traverse(path.scope.block, {\n // Identifier(innerPath) {\n // if (t.isExportSpecifier(innerPath.parent)) {\n // const { name } = innerPath.node;\n // if (name.endsWith('.value')) {\n // innerPath.node.name = name.slice(0, -6); // 删除 '.value' 部分\n // }\n // }\n // },\n // });\n }\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport { startsWith } from 'essor-shared';\nimport type { ImportDeclaration } from '@babel/types';\n\nfunction isVariableUsedAsObject(path: NodePath<ImportDeclaration>, variableName: string) {\n const binding = path.scope.getBinding(variableName);\n let isUsedObject = false;\n if (!binding || !binding.referencePaths) {\n return isUsedObject;\n }\n\n for (const referencePath of binding.referencePaths) {\n if (t.isMemberExpression(referencePath.parent)) {\n // const memberExprParent = referencePath.parent;\n\n // if (memberExprParent.object && memberExprParent.property) {\n // const newMemberExpr = t.memberExpression(\n // memberExprParent.object,\n // t.identifier(`${(memberExprParent.property as t.Identifier).name}.value`),\n // );\n // referencePath.parentPath?.replaceWith(newMemberExpr);\n isUsedObject = true;\n // }\n }\n }\n\n return isUsedObject;\n}\n// TODO: 暂时不支持对象\nexport function replaceImportDeclaration(path: NodePath<ImportDeclaration>) {\n const imports = path.node.specifiers;\n imports.forEach(specifier => {\n const variableName = specifier.local.name;\n\n if (startsWith(variableName, '$') && !isVariableUsedAsObject(path, variableName)) {\n path.scope.rename(variableName, `${variableName}.value`);\n specifier.local.name = `${variableName}`;\n }\n });\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport type {\n ArrowFunctionExpression,\n FunctionDeclaration,\n Identifier,\n ObjectProperty,\n RestElement,\n} from '@babel/types';\n\nexport function replaceProps(path: NodePath<FunctionDeclaration | ArrowFunctionExpression>) {\n const firstParam = path.node.params[0];\n\n if (!firstParam || !t.isObjectPattern(firstParam)) {\n return;\n }\n\n const returnStatement = path\n .get('body')\n .get('body')\n .find(statement => statement.isReturnStatement());\n\n if (!returnStatement) {\n return;\n }\n\n const returnValue = (returnStatement.node as any)?.argument;\n if (!t.isJSXElement(returnValue)) {\n return;\n }\n\n function replaceProperties(properties: (ObjectProperty | RestElement)[], parentPath: string) {\n properties.forEach(property => {\n if (t.isObjectProperty(property)) {\n const keyName = (property.key as Identifier).name;\n\n if (t.isIdentifier(property.value)) {\n const propertyName = property.value.name;\n const newName = `${parentPath}${keyName}`;\n path.scope.rename(propertyName, newName);\n } else if (t.isObjectPattern(property.value)) {\n replaceProperties(property.value.properties, `${parentPath}${keyName}.`);\n }\n }\n });\n }\n\n const properties = firstParam.properties;\n replaceProperties(\n properties.filter(property => !t.isRestElement(property)),\n '__props.',\n );\n\n const restElement = properties.find(property => t.isRestElement(property)) as\n | RestElement\n | undefined;\n\n if (restElement) {\n const restName = (restElement.argument as any).name;\n const restVariableDeclaration = t.variableDeclaration('const', [\n t.variableDeclarator(t.identifier(restName), t.identifier('__props')),\n ]);\n\n (path.node.body as any).body.unshift(restVariableDeclaration);\n }\n\n path.node.params[0] = t.identifier('__props');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQO,IAAM,UAAU,MAAM;ACMtB,IAAM,OAAO,SAAS;AAWtB,SAAS,WAAW,KAAK,cAAc;AAC5C,SAAO,IAAI,QAAQ,YAAY,MAAM;AACvC;ACXO,IAAM,wBAAwB,CAAC,gBAAgC;AACpE,SAAO,YAAY,OAAO,CAAC,EAAE,YAAY,IAAI,YAAY,MAAM,CAAC;AAClE;;;ACjBA,IAAAA,eAA2B;;;ACD3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,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,IACrB;AAAA,EACF;AACF;","names":["import_core","t","import_core","t","value","createEssorNode","t","createProps","getAttrProps","getChildren","replaceChild","handleAttributes","transformChildren","isValidChild","setNodeText","getNodeText","transformChild","value","import_core","t","import_core","t","imports","import_core","t","properties"]}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
// ../shared/dist/essor-shared.js
|
|
2
|
+
var isArray = Array.isArray;
|
|
3
|
+
var noop = Function.prototype;
|
|
4
|
+
function startsWith(str, searchString) {
|
|
5
|
+
return str.indexOf(searchString) === 0;
|
|
6
|
+
}
|
|
7
|
+
var capitalizeFirstLetter = (inputString) => {
|
|
8
|
+
return inputString.charAt(0).toUpperCase() + inputString.slice(1);
|
|
9
|
+
};
|
|
10
|
+
|
|
1
11
|
// src/jsx/server.ts
|
|
2
12
|
import { types as t3 } from "@babel/core";
|
|
3
13
|
|
|
@@ -209,6 +219,7 @@ function transformChild(child, result) {
|
|
|
209
219
|
result.template += String(expression.node.value);
|
|
210
220
|
} else if (expression.isExpression()) {
|
|
211
221
|
replaceChild(expression.node, result);
|
|
222
|
+
} else if (t2.isJSXEmptyExpression(expression.node)) {
|
|
212
223
|
} else {
|
|
213
224
|
throw new Error("Unsupported child type");
|
|
214
225
|
}
|
|
@@ -263,7 +274,7 @@ function handleAttributes(props, result) {
|
|
|
263
274
|
delete props[prop];
|
|
264
275
|
continue;
|
|
265
276
|
}
|
|
266
|
-
if (prop
|
|
277
|
+
if (startsWith(prop, "class:")) {
|
|
267
278
|
if (value === true) {
|
|
268
279
|
const name = prop.replace(/^class:/, "");
|
|
269
280
|
klass += ` ${name}`;
|
|
@@ -280,7 +291,7 @@ function handleAttributes(props, result) {
|
|
|
280
291
|
delete props[prop];
|
|
281
292
|
continue;
|
|
282
293
|
}
|
|
283
|
-
if (prop
|
|
294
|
+
if (startsWith(prop, "style:") && (typeof value === "string" || typeof value === "number")) {
|
|
284
295
|
const name = prop.replace(/^style:/, "");
|
|
285
296
|
style += `${name}:${value};`;
|
|
286
297
|
delete props[prop];
|
|
@@ -371,7 +382,13 @@ function getAttrProps(path) {
|
|
|
371
382
|
if (/^key|ref|on.+$/.test(name)) {
|
|
372
383
|
props[name] = expression.node;
|
|
373
384
|
} else if (/^bind:.+/.test(name)) {
|
|
374
|
-
|
|
385
|
+
const value2 = path.scope.generateUidIdentifier("value");
|
|
386
|
+
const bindName = name.slice(5).toLocaleLowerCase();
|
|
387
|
+
props[bindName] = expression.node;
|
|
388
|
+
props[`update${capitalizeFirstLetter(bindName)}`] = t2.arrowFunctionExpression(
|
|
389
|
+
[value2],
|
|
390
|
+
t2.assignmentExpression("=", expression.node, value2)
|
|
391
|
+
);
|
|
375
392
|
} else {
|
|
376
393
|
if (expression.isConditionalExpression()) {
|
|
377
394
|
props[name] = t2.arrowFunctionExpression([], expression.node);
|
|
@@ -559,6 +576,7 @@ function transformChild2(child, result) {
|
|
|
559
576
|
result.template[result.template.length - 1] += String(expression.node.value);
|
|
560
577
|
} else if (expression.isExpression()) {
|
|
561
578
|
replaceChild2(expression.node, result);
|
|
579
|
+
} else if (t3.isJSXEmptyExpression(expression.node)) {
|
|
562
580
|
} else {
|
|
563
581
|
throw new Error("Unsupported child type");
|
|
564
582
|
}
|
|
@@ -601,7 +619,7 @@ function handleAttributes2(props, result) {
|
|
|
601
619
|
delete props[prop];
|
|
602
620
|
continue;
|
|
603
621
|
}
|
|
604
|
-
if (prop
|
|
622
|
+
if (startsWith(prop, "class:")) {
|
|
605
623
|
if (value === true) {
|
|
606
624
|
const name = prop.replace(/^class:/, "");
|
|
607
625
|
klass += ` ${name}`;
|
|
@@ -618,7 +636,7 @@ function handleAttributes2(props, result) {
|
|
|
618
636
|
delete props[prop];
|
|
619
637
|
continue;
|
|
620
638
|
}
|
|
621
|
-
if (prop
|
|
639
|
+
if (startsWith(prop, "style:") && (typeof value === "string" || typeof value === "number")) {
|
|
622
640
|
const name = prop.replace(/^style:/, "");
|
|
623
641
|
style += `${name}:${value};`;
|
|
624
642
|
delete props[prop];
|
|
@@ -709,7 +727,13 @@ function getAttrProps2(path) {
|
|
|
709
727
|
if (/^key|ref|on.+$/.test(name)) {
|
|
710
728
|
props[name] = expression.node;
|
|
711
729
|
} else if (/^bind:.+/.test(name)) {
|
|
712
|
-
|
|
730
|
+
const value2 = path.scope.generateUidIdentifier("value");
|
|
731
|
+
const bindName = name.slice(5).toLocaleLowerCase();
|
|
732
|
+
props[bindName] = expression.node;
|
|
733
|
+
props[`update${capitalizeFirstLetter(bindName)}`] = t3.arrowFunctionExpression(
|
|
734
|
+
[value2],
|
|
735
|
+
t3.assignmentExpression("=", expression.node, value2)
|
|
736
|
+
);
|
|
713
737
|
} else {
|
|
714
738
|
if (expression.isConditionalExpression()) {
|
|
715
739
|
props[name] = t3.arrowFunctionExpression([], expression.node);
|
|
@@ -752,7 +776,7 @@ function replaceSymbol(path) {
|
|
|
752
776
|
if (t4.isObjectPattern(path.node.id) || t4.isArrayPattern(path.node.id)) {
|
|
753
777
|
return;
|
|
754
778
|
}
|
|
755
|
-
if (!
|
|
779
|
+
if (!startsWith(variableName, "$")) {
|
|
756
780
|
return;
|
|
757
781
|
}
|
|
758
782
|
if (init && (t4.isFunctionExpression(init) || t4.isArrowFunctionExpression(init)) && path.parent.kind === "const") {
|
|
@@ -788,13 +812,59 @@ function replaceImportDeclaration(path) {
|
|
|
788
812
|
const imports2 = path.node.specifiers;
|
|
789
813
|
imports2.forEach((specifier) => {
|
|
790
814
|
const variableName = specifier.local.name;
|
|
791
|
-
if (variableName
|
|
815
|
+
if (startsWith(variableName, "$") && !isVariableUsedAsObject(path, variableName)) {
|
|
792
816
|
path.scope.rename(variableName, `${variableName}.value`);
|
|
793
817
|
specifier.local.name = `${variableName}`;
|
|
794
818
|
}
|
|
795
819
|
});
|
|
796
820
|
}
|
|
797
821
|
|
|
822
|
+
// src/signal/props.ts
|
|
823
|
+
import { types as t6 } from "@babel/core";
|
|
824
|
+
function replaceProps(path) {
|
|
825
|
+
var _a;
|
|
826
|
+
const firstParam = path.node.params[0];
|
|
827
|
+
if (!firstParam || !t6.isObjectPattern(firstParam)) {
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
const returnStatement = path.get("body").get("body").find((statement) => statement.isReturnStatement());
|
|
831
|
+
if (!returnStatement) {
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
const returnValue = (_a = returnStatement.node) == null ? void 0 : _a.argument;
|
|
835
|
+
if (!t6.isJSXElement(returnValue)) {
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
function replaceProperties(properties2, parentPath) {
|
|
839
|
+
properties2.forEach((property) => {
|
|
840
|
+
if (t6.isObjectProperty(property)) {
|
|
841
|
+
const keyName = property.key.name;
|
|
842
|
+
if (t6.isIdentifier(property.value)) {
|
|
843
|
+
const propertyName = property.value.name;
|
|
844
|
+
const newName = `${parentPath}${keyName}`;
|
|
845
|
+
path.scope.rename(propertyName, newName);
|
|
846
|
+
} else if (t6.isObjectPattern(property.value)) {
|
|
847
|
+
replaceProperties(property.value.properties, `${parentPath}${keyName}.`);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
const properties = firstParam.properties;
|
|
853
|
+
replaceProperties(
|
|
854
|
+
properties.filter((property) => !t6.isRestElement(property)),
|
|
855
|
+
"__props."
|
|
856
|
+
);
|
|
857
|
+
const restElement = properties.find((property) => t6.isRestElement(property));
|
|
858
|
+
if (restElement) {
|
|
859
|
+
const restName = restElement.argument.name;
|
|
860
|
+
const restVariableDeclaration = t6.variableDeclaration("const", [
|
|
861
|
+
t6.variableDeclarator(t6.identifier(restName), t6.identifier("__props"))
|
|
862
|
+
]);
|
|
863
|
+
path.node.body.body.unshift(restVariableDeclaration);
|
|
864
|
+
}
|
|
865
|
+
path.node.params[0] = t6.identifier("__props");
|
|
866
|
+
}
|
|
867
|
+
|
|
798
868
|
// src/index.ts
|
|
799
869
|
function src_default() {
|
|
800
870
|
return {
|
|
@@ -809,6 +879,8 @@ function src_default() {
|
|
|
809
879
|
Program: transformProgram,
|
|
810
880
|
JSXElement: transformJSX,
|
|
811
881
|
JSXFragment: transformJSX,
|
|
882
|
+
FunctionDeclaration: replaceProps,
|
|
883
|
+
ArrowFunctionExpression: replaceProps,
|
|
812
884
|
VariableDeclarator: replaceSymbol,
|
|
813
885
|
ImportDeclaration: replaceImportDeclaration
|
|
814
886
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/jsx/server.ts","../src/program.ts","../src/jsx/constants.ts","../src/jsx/client.ts","../src/jsx/index.ts","../src/signal/symbol.ts","../src/signal/import.ts","../src/index.ts"],"sourcesContent":["import { types as t } from '@babel/core';\nimport { imports } from '../program';\nimport { selfClosingTags, svgTags } from './constants';\nimport { getAttrName, getTagName, isComponent, isTextChild } from './client';\nimport type { State } from '../types';\nimport type { NodePath } from '@babel/core';\ntype JSXElement = t.JSXElement | t.JSXFragment;\ninterface Result {\n index: number;\n isLastChild: boolean;\n parentIndex: number;\n props: Record<string, any>;\n template: string[];\n}\n\ntype JSXChild =\n | t.JSXElement\n | t.JSXFragment\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXText;\n\nexport function transformJSXService(path: NodePath<JSXElement>): void {\n const result: Result = {\n index: 0,\n isLastChild: false,\n parentIndex: 0,\n props: {},\n template: [], // 修改为数组\n };\n transformJSXServiceElement(path, result, true);\n path.replaceWith(createEssorNode(path, result));\n}\n\nfunction createEssorNode(path: NodePath<JSXElement>, result: Result): t.CallExpression {\n const state: State = path.state;\n\n let tmpl: t.Identifier;\n if (path.isJSXElement() && isComponent(getTagName(path.node))) {\n tmpl = t.identifier(getTagName(path.node));\n } else {\n tmpl = path.scope.generateUidIdentifier('_tmpl$');\n const template = t.callExpression(state.ssrtmpl, [\n t.arrayExpression(result.template.map(t.stringLiteral)),\n ]);\n const declarator = t.variableDeclarator(tmpl, template);\n state.tmplDeclaration.declarations.push(declarator);\n\n imports.add('ssrtmpl');\n }\n\n const args = [tmpl, createProps(result.props)];\n const key = result.props.key || result.props[0]?.key;\n if (key) {\n args.push(key);\n }\n imports.add('ssr');\n return t.callExpression(state.ssr, args);\n}\n\nfunction createProps(props: Record<string, any>): t.ObjectExpression {\n const result: (t.ObjectProperty | t.SpreadElement)[] = [];\n\n for (const prop in props) {\n let value = props[prop];\n\n if (prop === 'key') {\n continue;\n }\n\n if (Array.isArray(value)) {\n value = t.arrayExpression(value);\n }\n\n if (typeof value === 'object' && value !== null && !t.isNode(value)) {\n value = createProps(value);\n }\n\n if (typeof value === 'string') {\n value = t.stringLiteral(value);\n }\n\n if (typeof value === 'number') {\n value = t.numericLiteral(value);\n }\n\n if (typeof value === 'boolean') {\n value = t.booleanLiteral(value);\n }\n\n if (value === undefined) {\n value = t.tsUndefinedKeyword();\n }\n\n if (value === null) {\n value = t.nullLiteral();\n }\n\n if (prop === '_$spread$') {\n result.push(t.spreadElement(value));\n } else {\n result.push(t.objectProperty(t.stringLiteral(prop), value));\n }\n }\n\n return t.objectExpression(result);\n}\nfunction transformJSXServiceElement(\n path: NodePath<JSXElement>,\n result: Result,\n isRoot: boolean = false,\n): void {\n if (path.isJSXElement()) {\n const tagName = getTagName(path.node);\n const tagIsComponent = isComponent(tagName);\n const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);\n const isSvg = svgTags.includes(tagName) && result.index === 1;\n const { props, hasExpression } = getAttrProps(path);\n if (tagIsComponent) {\n if (isRoot) {\n result.props = props;\n const children = getChildren(path) as any;\n if (children.length > 0) {\n const childrenGenerator =\n children.length === 1 ? children[0] : t.arrayExpression(children);\n result.props.children = childrenGenerator;\n }\n } else {\n transformJSXService(path);\n replaceChild(path.node, result);\n }\n } else {\n if (isSvg) {\n result.template.push('<svg _svg_>');\n }\n result.template.push(`<${tagName}`);\n handleAttributes(props, result);\n\n if (hasExpression) {\n result.template.push(isSelfClose ? '/>' : '>');\n result.props ||= {};\n } else {\n result.template[result.template.length - 1] += isSelfClose ? '/>' : '>';\n }\n transformChildren(path, result);\n\n if (!isSelfClose) {\n result.template.push(`</${tagName}>`);\n }\n }\n } else {\n result.index--;\n transformChildren(path, result);\n }\n}\n\nfunction transformChildren(path: NodePath<JSXElement>, result: Result): void {\n const parentIndex = result.template.length;\n path\n .get('children')\n .reduce((pre, cur) => {\n if (isValidChild(cur)) {\n const lastChild = pre.at(-1);\n if (lastChild && isTextChild(cur) && isTextChild(lastChild)) {\n setNodeText(lastChild, getNodeText(lastChild) + getNodeText(cur));\n } else {\n pre.push(cur);\n }\n }\n return pre;\n }, [] as NodePath<JSXChild>[])\n .forEach((child, i, arr) => {\n result.parentIndex = parentIndex;\n result.isLastChild = i === arr.length - 1;\n transformChild(child, result);\n });\n}\n\nfunction transformChild(child: NodePath<JSXChild>, result: Result): void {\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXServiceElement(child, result, false);\n } else if (child.isJSXExpressionContainer()) {\n const expression = child.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n result.template[result.template.length - 1] += String(expression.node.value);\n } else if (expression.isExpression()) {\n replaceChild(expression.node, result);\n } else {\n throw new Error('Unsupported child type');\n }\n } else if (child.isJSXText()) {\n result.template.push(String(child.node.value));\n } else {\n throw new Error('Unsupported child type');\n }\n}\n\nfunction getNodeText(path: NodePath<JSXChild>): string {\n if (path.isJSXText()) {\n return path.node.value;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n return String(expression.node.value);\n }\n }\n return '';\n}\nfunction setNodeText(path: NodePath<JSXChild>, text: string): void {\n if (path.isJSXText()) {\n path.node.value = text;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n expression.replaceWith(t.stringLiteral(text));\n }\n }\n}\n\nfunction handleAttributes(props: Record<string, any>, result: Result): void {\n let klass = '';\n let style = '';\n\n for (const prop in props) {\n const value = props[prop];\n\n if (prop === 'class' && typeof value === 'string') {\n klass += ` ${value}`;\n delete props[prop];\n continue;\n }\n if (prop.indexOf('class:') === 0) {\n if (value === true) {\n const name = prop.replace(/^class:/, '');\n klass += ` ${name}`;\n delete props[prop];\n continue;\n }\n if (value === false) {\n delete props[prop];\n continue;\n }\n }\n\n if (prop === 'style' && typeof value === 'string') {\n style += `${value}${value.at(-1) === ';' ? '' : ';'}`;\n delete props[prop];\n continue;\n }\n if (prop.indexOf('style:') === 0 && (typeof value === 'string' || typeof value === 'number')) {\n const name = prop.replace(/^style:/, '');\n style += `${name}:${value};`;\n delete props[prop];\n continue;\n }\n\n if (value === true) {\n result.template[result.template.length - 1] += ` ${prop}`;\n delete props[prop];\n }\n if (value === false) {\n delete props[prop];\n }\n if (typeof value === 'string' || typeof value === 'number') {\n result.template[result.template.length - 1] += ` ${prop}=\"${value}\"`;\n delete props[prop];\n }\n }\n\n if (Object.keys(props).length > 0) {\n result.props[result.index] = props;\n }\n\n klass = klass.trim();\n style = style.trim();\n\n if (klass) {\n result.template[result.template.length - 1] += ` class=\"${klass}\"`;\n }\n if (style) {\n result.template[result.template.length - 1] += ` style=\"${style}\"`;\n }\n}\n\nfunction replaceChild(node: t.Expression, result: Result): void {\n if (result.isLastChild) {\n result.index--;\n }\n result.props[result.parentIndex] ??= {};\n result.props[result.parentIndex].children ??= [];\n result.props[result.parentIndex].children.push(\n t.arrayExpression([\n t.arrowFunctionExpression([], node),\n t.identifier(String(result.template.length)),\n ]),\n );\n}\n\nfunction getChildren(path: NodePath<JSXElement>): JSXChild[] {\n return path\n .get('children')\n .filter(child => isValidChild(child))\n .map(child => {\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXService(child);\n } else if (child.isJSXExpressionContainer()) {\n child.replaceWith(child.get('expression'));\n } else if (child.isJSXText()) {\n child.replaceWith(t.stringLiteral(child.node.value));\n } else {\n throw new Error('Unsupported child type');\n }\n return child.node;\n });\n}\n\nfunction isValidChild(path: NodePath<JSXChild>): boolean {\n const regex = /^\\s*$/;\n if (path.isStringLiteral() || path.isJSXText()) {\n return !regex.test(path.node.value);\n }\n return Object.keys(path.node).length > 0;\n}\nfunction getAttrProps(path: NodePath<t.JSXElement>): Record<string, any> {\n const props: Record<string, any> = {};\n let hasExpression = false;\n path\n .get('openingElement')\n .get('attributes')\n .forEach(attribute => {\n if (attribute.isJSXAttribute()) {\n const name = getAttrName(attribute.node);\n const value = attribute.get('value');\n\n if (!value.node) {\n props[name] = true;\n } else if (value.isStringLiteral()) {\n props[name] = value.node.value;\n } else {\n if (value.isJSXExpressionContainer()) {\n const expression = value.get('expression');\n\n if (expression.isStringLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isNumericLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isJSXElement() || expression.isJSXFragment()) {\n transformJSXService(expression);\n props[name] = expression.node;\n } else if (expression.isExpression()) {\n hasExpression = true;\n if (/^key|ref|on.+$/.test(name)) {\n props[name] = expression.node;\n } else if (/^bind:.+/.test(name)) {\n props[name] = t.arrowFunctionExpression([], expression.node);\n } else {\n if (expression.isConditionalExpression()) {\n props[name] = t.arrowFunctionExpression([], expression.node);\n } else {\n props[name] = expression.node;\n }\n }\n }\n } else if (value.isJSXElement() || value.isJSXFragment()) {\n transformJSXService(value);\n props[name] = value.node;\n }\n }\n } else if (attribute.isJSXSpreadAttribute()) {\n props._$spread$ = attribute.get('argument').node;\n hasExpression = true;\n } else {\n throw new Error('Unsupported attribute type');\n }\n });\n\n return {\n props,\n hasExpression,\n };\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport type { State } from './types';\nexport const imports = new Set<string>();\n\nexport const transformProgram = {\n enter(path: NodePath<t.Program>, state) {\n path.state = {\n h: path.scope.generateUidIdentifier('h$'),\n ssrtmpl: path.scope.generateUidIdentifier('ssrtmpl$'),\n ssr: path.scope.generateUidIdentifier('ssr$'),\n template: path.scope.generateUidIdentifier('template$'),\n\n useSignal: path.scope.generateUidIdentifier('signal$'),\n useComputed: path.scope.generateUidIdentifier('computed$'),\n\n tmplDeclaration: t.variableDeclaration('const', []),\n opts: state.opts,\n } as State;\n },\n exit(path: NodePath<t.Program>) {\n const state: State = path.state;\n if (state.tmplDeclaration.declarations.length > 0) {\n const index = path.node.body.findIndex(\n node => !t.isImportDeclaration(node) && !t.isExportDeclaration(node),\n );\n path.node.body.splice(index, 0, state.tmplDeclaration);\n }\n if (imports.size > 0) {\n path.node.body.unshift(createImport(state, 'essor'));\n }\n },\n};\nfunction createImport(state: State, from: string) {\n const ImportSpecifier: t.ImportSpecifier[] = [];\n imports.forEach(name => {\n const local = t.identifier(state[name].name);\n const imported = t.identifier(name);\n ImportSpecifier.push(t.importSpecifier(local, imported));\n });\n\n const importSource = t.stringLiteral(from);\n return t.importDeclaration(ImportSpecifier, importSource);\n}\n","export const selfClosingTags = [\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n];\n\nexport const svgTags = [\n 'circle',\n 'clipPath',\n 'defs',\n 'ellipse',\n 'filter',\n 'g',\n 'line',\n 'linearGradient',\n 'mask',\n 'path',\n 'pattern',\n 'polygon',\n 'polyline',\n 'radialGradient',\n 'rect',\n 'stop',\n 'symbol',\n 'text',\n 'use',\n];\n","import { types as t } from '@babel/core';\nimport { imports } from '../program';\nimport { selfClosingTags, svgTags } from './constants';\nimport type { State } from '../types';\nimport type { NodePath } from '@babel/core';\ntype JSXElement = t.JSXElement | t.JSXFragment;\ninterface Result {\n index: number;\n isLastChild: boolean;\n parentIndex: number;\n props: Record<string, any>;\n template: string;\n}\n\ntype JSXChild =\n | t.JSXElement\n | t.JSXFragment\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXText;\n\nexport function transformJSXClient(path: NodePath<JSXElement>): void {\n const result: Result = {\n index: 1,\n isLastChild: false,\n parentIndex: 0,\n props: {},\n template: '',\n };\n transformJSXElement(path, result, true);\n\n path.replaceWith(createEssorNode(path, result));\n}\n\nfunction createEssorNode(path: NodePath<JSXElement>, result: Result): t.CallExpression {\n const state: State = path.state;\n\n let tmpl: t.Identifier;\n if (path.isJSXElement() && isComponent(getTagName(path.node))) {\n tmpl = t.identifier(getTagName(path.node));\n } else {\n tmpl = path.scope.generateUidIdentifier('_tmpl$');\n const template = t.callExpression(state.template, [t.stringLiteral(result.template)]);\n const declarator = t.variableDeclarator(tmpl, template);\n state.tmplDeclaration.declarations.push(declarator);\n imports.add('template');\n }\n\n const args = [tmpl, createProps(result.props)];\n const key = result.props.key || result.props[0]?.key;\n if (key) {\n args.push(key);\n }\n imports.add('h');\n return t.callExpression(state.h, args);\n}\n\nfunction createProps(props) {\n const toAstNode = value => {\n if (Array.isArray(value)) {\n return t.arrayExpression(value.map(toAstNode));\n }\n if (value && typeof value === 'object' && !t.isNode(value)) {\n return createProps(value);\n }\n\n switch (typeof value) {\n case 'string':\n return t.stringLiteral(value);\n case 'number':\n return t.numericLiteral(value);\n case 'boolean':\n return t.booleanLiteral(value);\n case 'undefined':\n return t.tsUndefinedKeyword();\n case undefined:\n return t.tsUndefinedKeyword();\n case null:\n return t.nullLiteral();\n default:\n return value;\n }\n };\n\n const result = Object.keys(props)\n .filter(prop => prop !== 'key')\n .map(prop => {\n const value = toAstNode(props[prop]);\n return prop === '_$spread$'\n ? t.spreadElement(value)\n : t.objectProperty(t.stringLiteral(prop), value);\n });\n\n return t.objectExpression(result);\n}\nfunction transformJSXElement(\n path: NodePath<JSXElement>,\n result: Result,\n isRoot: boolean = false,\n): void {\n if (path.isJSXElement()) {\n const tagName = getTagName(path.node);\n const tagIsComponent = isComponent(tagName);\n const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);\n const isSvg = svgTags.includes(tagName) && result.index === 1;\n const props = getAttrProps(path);\n if (tagIsComponent) {\n if (isRoot) {\n result.props = props;\n const children = getChildren(path) as any;\n if (children.length > 0) {\n const childrenGenerator =\n children.length === 1 ? children[0] : t.arrayExpression(children);\n result.props.children = childrenGenerator;\n }\n } else {\n transformJSXClient(path);\n replaceChild(path.node, result);\n }\n } else {\n if (isSvg) {\n result.template = '<svg _svg_>';\n }\n result.template += `<${tagName}`;\n handleAttributes(props, result);\n result.template += isSelfClose ? '/>' : '>';\n if (!isSelfClose) {\n transformChildren(path, result);\n result.template += `</${tagName}>`;\n }\n }\n } else {\n result.index--;\n transformChildren(path, result);\n }\n}\n\nfunction transformChildren(path: NodePath<JSXElement>, result: Result): void {\n const parentIndex = result.index;\n path\n .get('children')\n .reduce((pre, cur) => {\n if (isValidChild(cur)) {\n const lastChild = pre.at(-1);\n if (lastChild && isTextChild(cur) && isTextChild(lastChild)) {\n setNodeText(lastChild, getNodeText(lastChild) + getNodeText(cur));\n } else {\n pre.push(cur);\n }\n }\n return pre;\n }, [] as NodePath<JSXChild>[])\n .forEach((child, i, arr) => {\n result.parentIndex = parentIndex;\n result.isLastChild = i === arr.length - 1;\n transformChild(child, result);\n });\n}\n\nfunction transformChild(child: NodePath<JSXChild>, result: Result): void {\n result.index++;\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXElement(child, result, false);\n } else if (child.isJSXExpressionContainer()) {\n const expression = child.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n result.template += String(expression.node.value);\n } else if (expression.isExpression()) {\n replaceChild(expression.node, result);\n } else {\n throw new Error('Unsupported child type');\n }\n } else if (child.isJSXText()) {\n result.template += String(child.node.value);\n } else {\n throw new Error('Unsupported child type');\n }\n}\n\nfunction getNodeText(path: NodePath<JSXChild>): string {\n if (path.isJSXText()) {\n return path.node.value;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n return String(expression.node.value);\n }\n }\n return '';\n}\nfunction setNodeText(path: NodePath<JSXChild>, text: string): void {\n if (path.isJSXText()) {\n path.node.value = text;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n expression.replaceWith(t.stringLiteral(text));\n }\n }\n}\n\nexport function isTextChild(path: NodePath<JSXChild>): boolean {\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isJSXText() || expression.isStringLiteral() || expression.isNumericLiteral()) {\n return true;\n }\n }\n if (path.isJSXText() || path.isStringLiteral() || path.isNullLiteral()) {\n return true;\n }\n return false;\n}\n\nfunction handleAttributes(props: Record<string, any>, result: Result): void {\n let klass = '';\n let style = '';\n\n for (const prop in props) {\n const value = props[prop];\n\n if (prop === 'class' && typeof value === 'string') {\n klass += ` ${value}`;\n delete props[prop];\n continue;\n }\n if (prop.indexOf('class:') === 0) {\n if (value === true) {\n const name = prop.replace(/^class:/, '');\n klass += ` ${name}`;\n delete props[prop];\n continue;\n }\n if (value === false) {\n delete props[prop];\n continue;\n }\n }\n\n if (prop === 'style' && typeof value === 'string') {\n style += `${value}${value.at(-1) === ';' ? '' : ';'}`;\n delete props[prop];\n continue;\n }\n if (prop.indexOf('style:') === 0 && (typeof value === 'string' || typeof value === 'number')) {\n const name = prop.replace(/^style:/, '');\n style += `${name}:${value};`;\n delete props[prop];\n continue;\n }\n\n if (value === true) {\n result.template += ` ${prop}`;\n delete props[prop];\n }\n if (value === false) {\n delete props[prop];\n }\n if (typeof value === 'string' || typeof value === 'number') {\n result.template += ` ${prop}=\"${value}\"`;\n delete props[prop];\n }\n }\n\n if (Object.keys(props).length > 0) {\n result.props[result.index] = props;\n }\n\n klass = klass.trim();\n style = style.trim();\n\n if (klass) {\n result.template += ` class=\"${klass}\"`;\n }\n if (style) {\n result.template += ` style=\"${style}\"`;\n }\n}\n\nfunction replaceChild(node: t.Expression, result: Result): void {\n if (result.isLastChild) {\n result.index--;\n } else {\n result.template += '<!-->';\n }\n result.props[result.parentIndex] ??= {};\n result.props[result.parentIndex].children ??= [];\n result.props[result.parentIndex].children.push(\n t.arrayExpression([\n t.arrowFunctionExpression([], node),\n result.isLastChild ? t.nullLiteral() : t.identifier(String(result.index)),\n ]),\n );\n}\n\nfunction getChildren(path: NodePath<JSXElement>): JSXChild[] {\n return path\n .get('children')\n .filter(child => isValidChild(child))\n .map(child => {\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXClient(child);\n } else if (child.isJSXExpressionContainer()) {\n child.replaceWith(child.get('expression'));\n } else if (child.isJSXText()) {\n child.replaceWith(t.stringLiteral(child.node.value));\n } else {\n throw new Error('Unsupported child type');\n }\n return child.node;\n });\n}\n\nexport function isValidChild(path: NodePath<JSXChild>): boolean {\n const regex = /^\\s*$/;\n if (path.isStringLiteral() || path.isJSXText()) {\n return !regex.test(path.node.value);\n }\n return Object.keys(path.node).length > 0;\n}\nexport function getAttrProps(path: NodePath<t.JSXElement>): Record<string, any> {\n const props: Record<string, any> = {};\n\n path\n .get('openingElement')\n .get('attributes')\n .forEach(attribute => {\n if (attribute.isJSXAttribute()) {\n const name = getAttrName(attribute.node);\n const value = attribute.get('value');\n\n if (!value.node) {\n props[name] = true;\n } else if (value.isStringLiteral()) {\n props[name] = value.node.value;\n } else {\n if (value.isJSXExpressionContainer()) {\n const expression = value.get('expression');\n\n if (expression.isStringLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isNumericLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isJSXElement() || expression.isJSXFragment()) {\n transformJSXClient(expression);\n props[name] = expression.node;\n } else if (expression.isExpression()) {\n if (/^key|ref|on.+$/.test(name)) {\n props[name] = expression.node;\n } else if (/^bind:.+/.test(name)) {\n props[name] = t.arrowFunctionExpression([], expression.node);\n } else {\n if (expression.isConditionalExpression()) {\n props[name] = t.arrowFunctionExpression([], expression.node);\n } else {\n props[name] = expression.node;\n }\n }\n }\n } else if (value.isJSXElement() || value.isJSXFragment()) {\n transformJSXClient(value);\n props[name] = value.node;\n }\n }\n } else if (attribute.isJSXSpreadAttribute()) {\n props._$spread$ = attribute.get('argument').node;\n } else {\n throw new Error('Unsupported attribute type');\n }\n });\n\n return props;\n}\nexport function getAttrName(attribute: t.JSXAttribute): string {\n if (t.isJSXIdentifier(attribute.name)) {\n return attribute.name.name;\n }\n if (t.isJSXNamespacedName(attribute.name)) {\n return `${attribute.name.namespace.name}:${attribute.name.name.name}`;\n }\n throw new Error('Unsupported attribute type');\n}\n/**\n * Determines if the given tagName is a component.\n *\n * case1: <MyComponent />\n * case2: <SomeLibrary.SomeComponent />;\n * case3: <_component />;\n *\n * @param {string} tagName - The name of the tag to check.\n * @return {boolean} True if the tagName is a component, false otherwise.\n */\nexport function isComponent(tagName: string): boolean {\n return (\n (tagName[0] && tagName[0].toLowerCase() !== tagName[0]) ||\n tagName.includes('.') ||\n /[^A-Za-z]/.test(tagName[0])\n );\n}\n\nexport function getTagName(node: t.JSXElement): string {\n const tag = node.openingElement.name;\n return jsxElementNameToString(tag);\n}\n\n/**\n * Converts a JSX element name to a string representation.\n *\n * case1: <MyComponent />\n * case2: <SomeLibrary.SomeComponent />;\n * case3: <namespace:ComponentName />;\n * case4: <SomeLibrary.Nested.ComponentName />;\n *\n * @param {t.JSXMemberExpression | t.JSXIdentifier | t.JSXNamespacedName} node The JSX element name to convert.\n * @returns {string} The string representation of the JSX element name.\n */\nexport function jsxElementNameToString(\n node: t.JSXMemberExpression | t.JSXIdentifier | t.JSXNamespacedName,\n) {\n if (t.isJSXMemberExpression(node)) {\n return `${jsxElementNameToString(node.object)}.${jsxElementNameToString(node.property)}`;\n }\n\n if (t.isJSXIdentifier(node) || t.isIdentifier(node)) {\n return node.name;\n }\n\n return `${node.namespace.name}:${node.name.name}`;\n}\n","import { transformJSXService } from './server';\nimport { transformJSXClient } from './client';\nimport type { NodePath, types as t } from '@babel/core';\nimport type { State } from '../types';\ntype JSXElement = t.JSXElement | t.JSXFragment;\nexport function transformJSX(path: NodePath<JSXElement>) {\n const state: State = path.state;\n const isSsr = state.opts.ssr;\n return isSsr ? transformJSXService(path) : transformJSXClient(path);\n}\n","import { types as t } from '@babel/core';\nimport { type Identifier, type VariableDeclarator, cloneNode } from '@babel/types';\nimport { imports } from '../program';\nimport type { NodePath } from '@babel/core';\n\nexport function replaceSymbol(path: NodePath<VariableDeclarator>) {\n const init = path.node.init;\n const variableName = (path.node.id as Identifier).name;\n\n if (t.isObjectPattern(path.node.id) || t.isArrayPattern(path.node.id)) {\n return;\n }\n\n if (!variableName.startsWith('$')) {\n return;\n }\n\n if (\n init &&\n (t.isFunctionExpression(init) || t.isArrowFunctionExpression(init)) &&\n (path.parent as t.VariableDeclaration).kind === 'const'\n ) {\n // 处理箭头函数表达式,将其转换为 _computed 调用\n const newInit = t.callExpression(t.identifier(path.state.useComputed.name), init ? [init] : []);\n imports.add('useComputed');\n path.node.init = newInit; // 直接替换 AST 节点\n } else {\n // 判断参数是否是基本数据类型 ,也可能没有参数\n const originalImportDeclarationNodes = cloneNode(path.get('id').node, true);\n\n const newInit = t.callExpression(t.identifier(path.state.useSignal.name), init ? [init] : []);\n imports.add('useSignal');\n path.node.init = newInit;\n\n path.scope.rename(variableName, `${variableName}.value`);\n\n path.get('id').replaceWith(originalImportDeclarationNodes);\n\n // // 这里需要确保只修改在当前作用域中的变量名\n // path.scope.traverse(path.scope.block, {\n // Identifier(innerPath) {\n // if (t.isExportSpecifier(innerPath.parent)) {\n // const { name } = innerPath.node;\n // if (name.endsWith('.value')) {\n // innerPath.node.name = name.slice(0, -6); // 删除 '.value' 部分\n // }\n // }\n // },\n // });\n }\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport type { ImportDeclaration } from '@babel/types';\n\nfunction isVariableUsedAsObject(path: NodePath<ImportDeclaration>, variableName: string) {\n const binding = path.scope.getBinding(variableName);\n let isUsedObject = false;\n if (!binding || !binding.referencePaths) {\n return isUsedObject;\n }\n\n for (const referencePath of binding.referencePaths) {\n if (t.isMemberExpression(referencePath.parent)) {\n // const memberExprParent = referencePath.parent;\n\n // if (memberExprParent.object && memberExprParent.property) {\n // const newMemberExpr = t.memberExpression(\n // memberExprParent.object,\n // t.identifier(`${(memberExprParent.property as t.Identifier).name}.value`),\n // );\n // referencePath.parentPath?.replaceWith(newMemberExpr);\n isUsedObject = true;\n // }\n }\n }\n\n return isUsedObject;\n}\n// TODO: 暂时不支持对象\nexport function replaceImportDeclaration(path: NodePath<ImportDeclaration>) {\n const imports = path.node.specifiers;\n imports.forEach(specifier => {\n const variableName = specifier.local.name;\n\n if (variableName.indexOf('$') === 0 && !isVariableUsedAsObject(path, variableName)) {\n path.scope.rename(variableName, `${variableName}.value`);\n specifier.local.name = `${variableName}`;\n }\n });\n}\n","import { transformJSX } from './jsx';\nimport { transformProgram } from './program';\nimport { replaceSymbol } from './signal/symbol';\nimport { replaceImportDeclaration } from './signal/import';\nimport type { PluginObj } from '@babel/core';\nexport { Options, State } from './types';\nexport default function (): PluginObj {\n return {\n name: 'babel-plugin-essor',\n manipulateOptions({ filename }, parserOpts) {\n if (filename.endsWith('.ts') || filename.endsWith('.tsx')) {\n parserOpts.plugins.push('typescript');\n }\n parserOpts.plugins.push('jsx');\n },\n visitor: {\n Program: transformProgram,\n JSXElement: transformJSX,\n JSXFragment: transformJSX,\n VariableDeclarator: replaceSymbol,\n ImportDeclaration: replaceImportDeclaration,\n },\n };\n}\n"],"mappings":";AAAA,SAAS,SAASA,UAAS;;;ACA3B,SAAwB,SAAS,SAAS;AAEnC,IAAM,UAAU,oBAAI,IAAY;AAEhC,IAAM,mBAAmB;AAAA,EAC9B,MAAM,MAA2B,OAAO;AACtC,SAAK,QAAQ;AAAA,MACX,GAAG,KAAK,MAAM,sBAAsB,IAAI;AAAA,MACxC,SAAS,KAAK,MAAM,sBAAsB,UAAU;AAAA,MACpD,KAAK,KAAK,MAAM,sBAAsB,MAAM;AAAA,MAC5C,UAAU,KAAK,MAAM,sBAAsB,WAAW;AAAA,MAEtD,WAAW,KAAK,MAAM,sBAAsB,SAAS;AAAA,MACrD,aAAa,KAAK,MAAM,sBAA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MAAI,eAAe;AACnB,MAAI,CAAC,WAAW,CAAC,QAAQ,gBAAgB;AACvC,WAAO;AAAA,EACT;AAEA,aAAW,iBAAiB,QAAQ,gBAAgB;AAClD,QAAIA,GAAE,mBAAmB,cAAc,MAAM,GAAG;AAS9C,qBAAe;AAAA,IAEjB;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,yBAAyB,MAAmC;AAC1E,QAAMC,WAAU,KAAK,KAAK;AAC1B,EAAAA,SAAQ,QAAQ,eAAa;AAC3B,UAAM,eAAe,UAAU,MAAM;AAErC,QAAI,aAAa,QAAQ,GAAG,MAAM,KAAK,CAAC,uBAAuB,MAAM,YAAY,GAAG;AAClF,WAAK,MAAM,OAAO,cAAc,GAAG,YAAY,QAAQ;AACvD,gBAAU,MAAM,OAAO,GAAG,YAAY;AAAA,IACxC;AAAA,EACF,CAAC;AACH;;;AChCe,SAAR,cAA+B;AACpC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,kBAAkB,EAAE,SAAS,GAAG,YAAY;AAC1C,UAAI,SAAS,SAAS,KAAK,KAAK,SAAS,SAAS,MAAM,GAAG;AACzD,mBAAW,QAAQ,KAAK,YAAY;AAAA,MACtC;AACA,iBAAW,QAAQ,KAAK,KAAK;AAAA,IAC/B;AAAA,IACA,SAAS;AAAA,MACP,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,IACrB;AAAA,EACF;AACF;","names":["t","t","t","createEssorNode","t","createProps","getAttrProps","getChildren","replaceChild","handleAttributes","transformChildren","isValidChild","setNodeText","getNodeText","transformChild","t","t","t","imports"]}
|
|
1
|
+
{"version":3,"sources":["../../shared/src/is.ts","../../shared/src/comm.ts","../../shared/src/name.ts","../src/jsx/server.ts","../src/program.ts","../src/jsx/constants.ts","../src/jsx/client.ts","../src/jsx/index.ts","../src/signal/symbol.ts","../src/signal/import.ts","../src/signal/props.ts","../src/index.ts"],"sourcesContent":["import { _toString } from './comm';\n\nexport const isObject = (val: unknown): val is Record<any, any> =>\n val !== null && typeof val === 'object';\nexport function isPromise(val: any): boolean {\n return _toString.call(val) === '[object Promise]';\n}\n\nexport const isArray = Array.isArray;\n\nexport function isString(val: unknown): val is string {\n return typeof val === 'string';\n}\nexport function isNull(val: any): val is null {\n return val === null;\n}\nexport function isSymbol(val: unknown): val is symbol {\n return typeof val === 'symbol';\n}\nexport function isMap(val: unknown): val is Map<any, any> {\n return _toString.call(val) === '[object Map]';\n}\nexport function isNil(x: any): x is null | undefined {\n return x === null || x === undefined;\n}\n\nexport const isFunction = (val: unknown): val is Function => typeof val === 'function';\n\nexport function isFalsy(x: any): x is false | null | undefined {\n return x === false || x === null || x === undefined || x === '';\n}\n\nexport const isPrimitive = (\n val: unknown,\n): val is string | number | boolean | symbol | null | undefined =>\n ['string', 'number', 'boolean', 'symbol', 'undefined'].includes(typeof val) || isNull(val);\n","import { isPrimitive } from './is';\n\nexport const _toString = Object.prototype.toString;\nexport const extend = Object.assign;\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\nexport const hasOwn = (val: object, key: string | symbol): key is keyof typeof val =>\n hasOwnProperty.call(val, key);\n\nexport function coerceArray<T>(data: T | T[]): T[] {\n return Array.isArray(data) ? (data.flat() as T[]) : [data];\n}\nexport function hasChanged(value, oldValue) {\n return !Object.is(value, oldValue);\n}\nexport const noop = Function.prototype as () => void;\n\n/**\n * A function that checks if a string starts with a specific substring.\n * indexOf faster under normal circumstances\n * @see https://www.measurethat.net/Benchmarks/Show/12350/0/startswith-vs-test-vs-match-vs-indexof#latest_results_block\n\n * @param {string} str - The input string to check.\n * @param {string} searchString - The substring to check for at the beginning of the input string.\n * @return {boolean} Returns true if the input string starts with the specified substring, otherwise false.\n */\nexport function startsWith(str, searchString) {\n return str.indexOf(searchString) === 0;\n}\n\n/**\n * Recursively clones an object, including its nested properties and special types like Date, RegExp, Map, and Set.\n *\n * @param {any} obj - The object to clone.\n * @param {WeakMap<object, object>} [hash] - A WeakMap used to track circular references.\n * @return {any} The cloned object.\n */\nexport function deepClone(obj, hash = new WeakMap()) {\n // Return primitives and functions as-is\n if (obj === null || typeof obj !== 'object') {\n return obj;\n }\n\n // Handle circular references\n if (hash.has(obj)) {\n return hash.get(obj);\n }\n\n // Handle special types\n if (obj instanceof Date) {\n return new Date(obj);\n }\n\n if (obj instanceof RegExp) {\n return new RegExp(obj);\n }\n\n if (obj instanceof Map) {\n const mapClone = new Map();\n hash.set(obj, mapClone);\n obj.forEach((value, key) => {\n mapClone.set(deepClone(key, hash), deepClone(value, hash));\n });\n return mapClone;\n }\n\n if (obj instanceof Set) {\n const setClone = new Set();\n hash.set(obj, setClone);\n obj.forEach(value => {\n setClone.add(deepClone(value, hash));\n });\n return setClone;\n }\n\n // Initialize the clone and store it in the WeakMap\n const cloneObj = Array.isArray(obj) ? [] : {};\n hash.set(obj, cloneObj);\n\n // Iterate over object keys\n const keys = Object.keys(obj);\n for (const key of keys) {\n cloneObj[key] = deepClone(obj[key], hash);\n }\n\n return cloneObj;\n}\n\n/**\n * Determines whether two values are deeply equal.\n *\n * @param {any} a - The first value to compare.\n * @param {any} b - The second value to compare.\n * @param {WeakMap<object, object>} [seen] - A WeakMap used to store previously seen objects to avoid infinite recursion.\n * @return {boolean} True if the values are deeply equal, false otherwise.\n */\nexport function deepEqual(a: any, b: any, seen = new WeakMap()): boolean {\n if (isPrimitive(a) && isPrimitive(b)) {\n return a === b;\n }\n\n if (a === b) {\n return true;\n }\n\n if (a == null || b == null || typeof a !== 'object' || typeof b !== 'object') {\n return false;\n }\n\n if (a.constructor !== b.constructor) {\n return false;\n }\n\n if (seen.has(a)) {\n return seen.get(a) === b;\n }\n\n seen.set(a, b);\n\n if (Array.isArray(a)) {\n if (a.length !== b.length) {\n return false;\n }\n for (const [i, element] of a.entries()) {\n if (!deepEqual(element, b[i], seen)) {\n return false;\n }\n }\n return true;\n }\n\n if (a instanceof Map) {\n if (a.size !== b.size) {\n return false;\n }\n for (const [key, value] of a) {\n if (!b.has(key) || !deepEqual(value, b.get(key), seen)) {\n return false;\n }\n }\n return true;\n }\n\n if (a instanceof Set) {\n if (a.size !== b.size) {\n return false;\n }\n const arrA = Array.from(a).sort();\n const arrB = Array.from(b).sort();\n for (const [i, element] of arrA.entries()) {\n if (!deepEqual(element, arrB[i], seen)) {\n return false;\n }\n }\n return true;\n }\n\n const keysA = Object.keys(a);\n const keysB = new Set(Object.keys(b));\n\n if (keysA.length !== keysB.size) {\n return false;\n }\n\n for (const key of keysA) {\n if (!keysB.has(key) || !deepEqual(a[key], b[key], seen)) {\n return false;\n }\n }\n\n return true;\n}\n","export const kebabCase = (string: string): string => {\n return string.replaceAll(/[A-Z]+/g, (match, offset) => {\n return `${offset > 0 ? '-' : ''}${match.toLocaleLowerCase()}`;\n });\n};\n\nexport const camelCase = (str: string): string => {\n const s = str.replaceAll(/[\\s_-]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''));\n return s[0].toLowerCase() + s.slice(1);\n};\n/**\n * Capitalizes the first letter of a string.\n *\n * @param {string} inputString - The input string to capitalize the first letter.\n * @return {string} The string with the first letter capitalized.\n */\nexport const capitalizeFirstLetter = (inputString: string): string => {\n return inputString.charAt(0).toUpperCase() + inputString.slice(1);\n};\n","import { capitalizeFirstLetter, startsWith } from 'essor-shared';\nimport { types as t } from '@babel/core';\nimport { imports } from '../program';\nimport { selfClosingTags, svgTags } from './constants';\nimport { getAttrName, getTagName, isComponent, isTextChild } from './client';\nimport type { OptionalMemberExpression } from '@babel/types';\nimport type { State } from '../types';\nimport type { NodePath } from '@babel/core';\ntype JSXElement = t.JSXElement | t.JSXFragment;\ninterface Result {\n index: number;\n isLastChild: boolean;\n parentIndex: number;\n props: Record<string, any>;\n template: string[];\n}\n\ntype JSXChild =\n | t.JSXElement\n | t.JSXFragment\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXText;\n\nexport function transformJSXService(path: NodePath<JSXElement>): void {\n const result: Result = {\n index: 0,\n isLastChild: false,\n parentIndex: 0,\n props: {},\n template: [], // 修改为数组\n };\n transformJSXServiceElement(path, result, true);\n path.replaceWith(createEssorNode(path, result));\n}\n\nfunction createEssorNode(path: NodePath<JSXElement>, result: Result): t.CallExpression {\n const state: State = path.state;\n\n let tmpl: t.Identifier;\n if (path.isJSXElement() && isComponent(getTagName(path.node))) {\n tmpl = t.identifier(getTagName(path.node));\n } else {\n tmpl = path.scope.generateUidIdentifier('_tmpl$');\n const template = t.callExpression(state.ssrtmpl, [\n t.arrayExpression(result.template.map(t.stringLiteral)),\n ]);\n const declarator = t.variableDeclarator(tmpl, template);\n state.tmplDeclaration.declarations.push(declarator);\n\n imports.add('ssrtmpl');\n }\n\n const args = [tmpl, createProps(result.props)];\n const key = result.props.key || result.props[0]?.key;\n if (key) {\n args.push(key);\n }\n imports.add('ssr');\n return t.callExpression(state.ssr, args);\n}\n\nfunction createProps(props: Record<string, any>): t.ObjectExpression {\n const result: (t.ObjectProperty | t.SpreadElement)[] = [];\n\n for (const prop in props) {\n let value = props[prop];\n\n if (prop === 'key') {\n continue;\n }\n\n if (Array.isArray(value)) {\n value = t.arrayExpression(value);\n }\n\n if (typeof value === 'object' && value !== null && !t.isNode(value)) {\n value = createProps(value);\n }\n\n if (typeof value === 'string') {\n value = t.stringLiteral(value);\n }\n\n if (typeof value === 'number') {\n value = t.numericLiteral(value);\n }\n\n if (typeof value === 'boolean') {\n value = t.booleanLiteral(value);\n }\n\n if (value === undefined) {\n value = t.tsUndefinedKeyword();\n }\n\n if (value === null) {\n value = t.nullLiteral();\n }\n\n if (prop === '_$spread$') {\n result.push(t.spreadElement(value));\n } else {\n result.push(t.objectProperty(t.stringLiteral(prop), value));\n }\n }\n\n return t.objectExpression(result);\n}\nfunction transformJSXServiceElement(\n path: NodePath<JSXElement>,\n result: Result,\n isRoot: boolean = false,\n): void {\n if (path.isJSXElement()) {\n const tagName = getTagName(path.node);\n const tagIsComponent = isComponent(tagName);\n const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);\n const isSvg = svgTags.includes(tagName) && result.index === 1;\n const { props, hasExpression } = getAttrProps(path);\n if (tagIsComponent) {\n if (isRoot) {\n result.props = props;\n const children = getChildren(path) as any;\n if (children.length > 0) {\n const childrenGenerator =\n children.length === 1 ? children[0] : t.arrayExpression(children);\n result.props.children = childrenGenerator;\n }\n } else {\n transformJSXService(path);\n replaceChild(path.node, result);\n }\n } else {\n if (isSvg) {\n result.template.push('<svg _svg_>');\n }\n result.template.push(`<${tagName}`);\n handleAttributes(props, result);\n\n if (hasExpression) {\n result.template.push(isSelfClose ? '/>' : '>');\n result.props ||= {};\n } else {\n result.template[result.template.length - 1] += isSelfClose ? '/>' : '>';\n }\n transformChildren(path, result);\n\n if (!isSelfClose) {\n result.template.push(`</${tagName}>`);\n }\n }\n } else {\n result.index--;\n transformChildren(path, result);\n }\n}\n\nfunction transformChildren(path: NodePath<JSXElement>, result: Result): void {\n const parentIndex = result.template.length;\n path\n .get('children')\n .reduce((pre, cur) => {\n if (isValidChild(cur)) {\n const lastChild = pre.at(-1);\n if (lastChild && isTextChild(cur) && isTextChild(lastChild)) {\n setNodeText(lastChild, getNodeText(lastChild) + getNodeText(cur));\n } else {\n pre.push(cur);\n }\n }\n return pre;\n }, [] as NodePath<JSXChild>[])\n .forEach((child, i, arr) => {\n result.parentIndex = parentIndex;\n result.isLastChild = i === arr.length - 1;\n transformChild(child, result);\n });\n}\n\nfunction transformChild(child: NodePath<JSXChild>, result: Result): void {\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXServiceElement(child, result, false);\n } else if (child.isJSXExpressionContainer()) {\n const expression = child.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n result.template[result.template.length - 1] += String(expression.node.value);\n } else if (expression.isExpression()) {\n replaceChild(expression.node, result);\n } else if (t.isJSXEmptyExpression(expression.node)) {\n // it is empty expression\n // do nothing\n } else {\n throw new Error('Unsupported child type');\n }\n } else if (child.isJSXText()) {\n result.template.push(String(child.node.value));\n } else {\n throw new Error('Unsupported child type');\n }\n}\n\nfunction getNodeText(path: NodePath<JSXChild>): string {\n if (path.isJSXText()) {\n return path.node.value;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n return String(expression.node.value);\n }\n }\n return '';\n}\nfunction setNodeText(path: NodePath<JSXChild>, text: string): void {\n if (path.isJSXText()) {\n path.node.value = text;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n expression.replaceWith(t.stringLiteral(text));\n }\n }\n}\n\nfunction handleAttributes(props: Record<string, any>, result: Result): void {\n let klass = '';\n let style = '';\n\n for (const prop in props) {\n const value = props[prop];\n\n if (prop === 'class' && typeof value === 'string') {\n klass += ` ${value}`;\n delete props[prop];\n continue;\n }\n if (startsWith(prop, 'class:')) {\n if (value === true) {\n const name = prop.replace(/^class:/, '');\n klass += ` ${name}`;\n delete props[prop];\n continue;\n }\n if (value === false) {\n delete props[prop];\n continue;\n }\n }\n\n if (prop === 'style' && typeof value === 'string') {\n style += `${value}${value.at(-1) === ';' ? '' : ';'}`;\n delete props[prop];\n continue;\n }\n if (startsWith(prop, 'style:') && (typeof value === 'string' || typeof value === 'number')) {\n const name = prop.replace(/^style:/, '');\n style += `${name}:${value};`;\n delete props[prop];\n continue;\n }\n\n if (value === true) {\n result.template[result.template.length - 1] += ` ${prop}`;\n delete props[prop];\n }\n if (value === false) {\n delete props[prop];\n }\n if (typeof value === 'string' || typeof value === 'number') {\n result.template[result.template.length - 1] += ` ${prop}=\"${value}\"`;\n delete props[prop];\n }\n }\n\n if (Object.keys(props).length > 0) {\n result.props[result.index] = props;\n }\n\n klass = klass.trim();\n style = style.trim();\n\n if (klass) {\n result.template[result.template.length - 1] += ` class=\"${klass}\"`;\n }\n if (style) {\n result.template[result.template.length - 1] += ` style=\"${style}\"`;\n }\n}\n\nfunction replaceChild(node: t.Expression, result: Result): void {\n if (result.isLastChild) {\n result.index--;\n }\n result.props[result.parentIndex] ??= {};\n result.props[result.parentIndex].children ??= [];\n result.props[result.parentIndex].children.push(\n t.arrayExpression([\n t.arrowFunctionExpression([], node),\n t.identifier(String(result.template.length)),\n ]),\n );\n}\n\nfunction getChildren(path: NodePath<JSXElement>): JSXChild[] {\n return path\n .get('children')\n .filter(child => isValidChild(child))\n .map(child => {\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXService(child);\n } else if (child.isJSXExpressionContainer()) {\n child.replaceWith(child.get('expression'));\n } else if (child.isJSXText()) {\n child.replaceWith(t.stringLiteral(child.node.value));\n } else {\n throw new Error('Unsupported child type');\n }\n return child.node;\n });\n}\n\nfunction isValidChild(path: NodePath<JSXChild>): boolean {\n const regex = /^\\s*$/;\n if (path.isStringLiteral() || path.isJSXText()) {\n return !regex.test(path.node.value);\n }\n return Object.keys(path.node).length > 0;\n}\nfunction getAttrProps(path: NodePath<t.JSXElement>): Record<string, any> {\n const props: Record<string, any> = {};\n let hasExpression = false;\n path\n .get('openingElement')\n .get('attributes')\n .forEach(attribute => {\n if (attribute.isJSXAttribute()) {\n const name = getAttrName(attribute.node);\n const value = attribute.get('value');\n\n if (!value.node) {\n props[name] = true;\n } else if (value.isStringLiteral()) {\n props[name] = value.node.value;\n } else {\n if (value.isJSXExpressionContainer()) {\n const expression = value.get('expression');\n\n if (expression.isStringLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isNumericLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isJSXElement() || expression.isJSXFragment()) {\n transformJSXService(expression);\n props[name] = expression.node;\n } else if (expression.isExpression()) {\n hasExpression = true;\n if (/^key|ref|on.+$/.test(name)) {\n props[name] = expression.node;\n } else if (/^bind:.+/.test(name)) {\n const value = path.scope.generateUidIdentifier('value');\n const bindName = name.slice(5).toLocaleLowerCase();\n props[bindName] = expression.node;\n props[`update${capitalizeFirstLetter(bindName)}`] = t.arrowFunctionExpression(\n [value],\n t.assignmentExpression('=', expression.node as OptionalMemberExpression, value),\n );\n } else {\n if (expression.isConditionalExpression()) {\n props[name] = t.arrowFunctionExpression([], expression.node);\n } else {\n props[name] = expression.node;\n }\n }\n }\n } else if (value.isJSXElement() || value.isJSXFragment()) {\n transformJSXService(value);\n props[name] = value.node;\n }\n }\n } else if (attribute.isJSXSpreadAttribute()) {\n props._$spread$ = attribute.get('argument').node;\n hasExpression = true;\n } else {\n throw new Error('Unsupported attribute type');\n }\n });\n\n return {\n props,\n hasExpression,\n };\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport type { State } from './types';\nexport const imports = new Set<string>();\n\nexport const transformProgram = {\n enter(path: NodePath<t.Program>, state) {\n path.state = {\n h: path.scope.generateUidIdentifier('h$'),\n ssrtmpl: path.scope.generateUidIdentifier('ssrtmpl$'),\n ssr: path.scope.generateUidIdentifier('ssr$'),\n template: path.scope.generateUidIdentifier('template$'),\n\n useSignal: path.scope.generateUidIdentifier('signal$'),\n useComputed: path.scope.generateUidIdentifier('computed$'),\n\n tmplDeclaration: t.variableDeclaration('const', []),\n opts: state.opts,\n } as State;\n },\n exit(path: NodePath<t.Program>) {\n const state: State = path.state;\n if (state.tmplDeclaration.declarations.length > 0) {\n const index = path.node.body.findIndex(\n node => !t.isImportDeclaration(node) && !t.isExportDeclaration(node),\n );\n path.node.body.splice(index, 0, state.tmplDeclaration);\n }\n if (imports.size > 0) {\n path.node.body.unshift(createImport(state, 'essor'));\n }\n },\n};\nfunction createImport(state: State, from: string) {\n const ImportSpecifier: t.ImportSpecifier[] = [];\n imports.forEach(name => {\n const local = t.identifier(state[name].name);\n const imported = t.identifier(name);\n ImportSpecifier.push(t.importSpecifier(local, imported));\n });\n\n const importSource = t.stringLiteral(from);\n return t.importDeclaration(ImportSpecifier, importSource);\n}\n","export const selfClosingTags = [\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr',\n];\n\nexport const svgTags = [\n 'circle',\n 'clipPath',\n 'defs',\n 'ellipse',\n 'filter',\n 'g',\n 'line',\n 'linearGradient',\n 'mask',\n 'path',\n 'pattern',\n 'polygon',\n 'polyline',\n 'radialGradient',\n 'rect',\n 'stop',\n 'symbol',\n 'text',\n 'use',\n];\n","import { types as t } from '@babel/core';\nimport { capitalizeFirstLetter, startsWith } from 'essor-shared';\nimport { imports } from '../program';\nimport { selfClosingTags, svgTags } from './constants';\nimport type { OptionalMemberExpression } from '@babel/types';\nimport type { State } from '../types';\nimport type { NodePath } from '@babel/core';\ntype JSXElement = t.JSXElement | t.JSXFragment;\ninterface Result {\n index: number;\n isLastChild: boolean;\n parentIndex: number;\n props: Record<string, any>;\n template: string;\n}\n\ntype JSXChild =\n | t.JSXElement\n | t.JSXFragment\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXText;\n\nexport function transformJSXClient(path: NodePath<JSXElement>): void {\n const result: Result = {\n index: 1,\n isLastChild: false,\n parentIndex: 0,\n props: {},\n template: '',\n };\n transformJSXElement(path, result, true);\n\n path.replaceWith(createEssorNode(path, result));\n}\n\nfunction createEssorNode(path: NodePath<JSXElement>, result: Result): t.CallExpression {\n const state: State = path.state;\n\n let tmpl: t.Identifier;\n if (path.isJSXElement() && isComponent(getTagName(path.node))) {\n tmpl = t.identifier(getTagName(path.node));\n } else {\n tmpl = path.scope.generateUidIdentifier('_tmpl$');\n const template = t.callExpression(state.template, [t.stringLiteral(result.template)]);\n const declarator = t.variableDeclarator(tmpl, template);\n state.tmplDeclaration.declarations.push(declarator);\n imports.add('template');\n }\n\n const args = [tmpl, createProps(result.props)];\n const key = result.props.key || result.props[0]?.key;\n if (key) {\n args.push(key);\n }\n imports.add('h');\n return t.callExpression(state.h, args);\n}\n\nfunction createProps(props) {\n const toAstNode = value => {\n if (Array.isArray(value)) {\n return t.arrayExpression(value.map(toAstNode));\n }\n if (value && typeof value === 'object' && !t.isNode(value)) {\n return createProps(value);\n }\n\n switch (typeof value) {\n case 'string':\n return t.stringLiteral(value);\n case 'number':\n return t.numericLiteral(value);\n case 'boolean':\n return t.booleanLiteral(value);\n case 'undefined':\n return t.tsUndefinedKeyword();\n case undefined:\n return t.tsUndefinedKeyword();\n case null:\n return t.nullLiteral();\n default:\n return value;\n }\n };\n\n const result = Object.keys(props)\n .filter(prop => prop !== 'key')\n .map(prop => {\n const value = toAstNode(props[prop]);\n return prop === '_$spread$'\n ? t.spreadElement(value)\n : t.objectProperty(t.stringLiteral(prop), value);\n });\n\n return t.objectExpression(result);\n}\nfunction transformJSXElement(\n path: NodePath<JSXElement>,\n result: Result,\n isRoot: boolean = false,\n): void {\n if (path.isJSXElement()) {\n const tagName = getTagName(path.node);\n const tagIsComponent = isComponent(tagName);\n const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);\n const isSvg = svgTags.includes(tagName) && result.index === 1;\n const props = getAttrProps(path);\n if (tagIsComponent) {\n if (isRoot) {\n result.props = props;\n const children = getChildren(path) as any;\n if (children.length > 0) {\n const childrenGenerator =\n children.length === 1 ? children[0] : t.arrayExpression(children);\n result.props.children = childrenGenerator;\n }\n } else {\n transformJSXClient(path);\n replaceChild(path.node, result);\n }\n } else {\n if (isSvg) {\n result.template = '<svg _svg_>';\n }\n result.template += `<${tagName}`;\n handleAttributes(props, result);\n result.template += isSelfClose ? '/>' : '>';\n if (!isSelfClose) {\n transformChildren(path, result);\n result.template += `</${tagName}>`;\n }\n }\n } else {\n result.index--;\n transformChildren(path, result);\n }\n}\n\nfunction transformChildren(path: NodePath<JSXElement>, result: Result): void {\n const parentIndex = result.index;\n path\n .get('children')\n .reduce((pre, cur) => {\n if (isValidChild(cur)) {\n const lastChild = pre.at(-1);\n if (lastChild && isTextChild(cur) && isTextChild(lastChild)) {\n setNodeText(lastChild, getNodeText(lastChild) + getNodeText(cur));\n } else {\n pre.push(cur);\n }\n }\n return pre;\n }, [] as NodePath<JSXChild>[])\n .forEach((child, i, arr) => {\n result.parentIndex = parentIndex;\n result.isLastChild = i === arr.length - 1;\n transformChild(child, result);\n });\n}\n\nfunction transformChild(child: NodePath<JSXChild>, result: Result): void {\n result.index++;\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXElement(child, result, false);\n } else if (child.isJSXExpressionContainer()) {\n const expression = child.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n result.template += String(expression.node.value);\n } else if (expression.isExpression()) {\n replaceChild(expression.node, result);\n } else if (t.isJSXEmptyExpression(expression.node)) {\n // it is empty expression\n // do nothing\n } else {\n throw new Error('Unsupported child type');\n }\n } else if (child.isJSXText()) {\n result.template += String(child.node.value);\n } else {\n throw new Error('Unsupported child type');\n }\n}\n\nfunction getNodeText(path: NodePath<JSXChild>): string {\n if (path.isJSXText()) {\n return path.node.value;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n return String(expression.node.value);\n }\n }\n return '';\n}\nfunction setNodeText(path: NodePath<JSXChild>, text: string): void {\n if (path.isJSXText()) {\n path.node.value = text;\n }\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isStringLiteral() || expression.isNumericLiteral()) {\n expression.replaceWith(t.stringLiteral(text));\n }\n }\n}\n\nexport function isTextChild(path: NodePath<JSXChild>): boolean {\n if (path.isJSXExpressionContainer()) {\n const expression = path.get('expression');\n if (expression.isJSXText() || expression.isStringLiteral() || expression.isNumericLiteral()) {\n return true;\n }\n }\n if (path.isJSXText() || path.isStringLiteral() || path.isNullLiteral()) {\n return true;\n }\n return false;\n}\n\nfunction handleAttributes(props: Record<string, any>, result: Result): void {\n let klass = '';\n let style = '';\n\n for (const prop in props) {\n const value = props[prop];\n\n if (prop === 'class' && typeof value === 'string') {\n klass += ` ${value}`;\n delete props[prop];\n continue;\n }\n if (startsWith(prop, 'class:')) {\n if (value === true) {\n const name = prop.replace(/^class:/, '');\n klass += ` ${name}`;\n delete props[prop];\n continue;\n }\n if (value === false) {\n delete props[prop];\n continue;\n }\n }\n\n if (prop === 'style' && typeof value === 'string') {\n style += `${value}${value.at(-1) === ';' ? '' : ';'}`;\n delete props[prop];\n continue;\n }\n if (startsWith(prop, 'style:') && (typeof value === 'string' || typeof value === 'number')) {\n const name = prop.replace(/^style:/, '');\n style += `${name}:${value};`;\n delete props[prop];\n continue;\n }\n\n if (value === true) {\n result.template += ` ${prop}`;\n delete props[prop];\n }\n if (value === false) {\n delete props[prop];\n }\n if (typeof value === 'string' || typeof value === 'number') {\n result.template += ` ${prop}=\"${value}\"`;\n delete props[prop];\n }\n }\n\n if (Object.keys(props).length > 0) {\n result.props[result.index] = props;\n }\n\n klass = klass.trim();\n style = style.trim();\n\n if (klass) {\n result.template += ` class=\"${klass}\"`;\n }\n if (style) {\n result.template += ` style=\"${style}\"`;\n }\n}\n\nfunction replaceChild(node: t.Expression, result: Result): void {\n if (result.isLastChild) {\n result.index--;\n } else {\n result.template += '<!-->';\n }\n result.props[result.parentIndex] ??= {};\n result.props[result.parentIndex].children ??= [];\n result.props[result.parentIndex].children.push(\n t.arrayExpression([\n t.arrowFunctionExpression([], node),\n result.isLastChild ? t.nullLiteral() : t.identifier(String(result.index)),\n ]),\n );\n}\n\nfunction getChildren(path: NodePath<JSXElement>): JSXChild[] {\n return path\n .get('children')\n .filter(child => isValidChild(child))\n .map(child => {\n if (child.isJSXElement() || child.isJSXFragment()) {\n transformJSXClient(child);\n } else if (child.isJSXExpressionContainer()) {\n child.replaceWith(child.get('expression'));\n } else if (child.isJSXText()) {\n child.replaceWith(t.stringLiteral(child.node.value));\n } else {\n throw new Error('Unsupported child type');\n }\n return child.node;\n });\n}\n\nexport function isValidChild(path: NodePath<JSXChild>): boolean {\n const regex = /^\\s*$/;\n if (path.isStringLiteral() || path.isJSXText()) {\n return !regex.test(path.node.value);\n }\n return Object.keys(path.node).length > 0;\n}\nexport function getAttrProps(path: NodePath<t.JSXElement>): Record<string, any> {\n const props: Record<string, any> = {};\n\n path\n .get('openingElement')\n .get('attributes')\n .forEach(attribute => {\n if (attribute.isJSXAttribute()) {\n const name = getAttrName(attribute.node);\n const value = attribute.get('value');\n\n if (!value.node) {\n props[name] = true;\n } else if (value.isStringLiteral()) {\n props[name] = value.node.value;\n } else {\n if (value.isJSXExpressionContainer()) {\n const expression = value.get('expression');\n\n if (expression.isStringLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isNumericLiteral()) {\n props[name] = expression.node.value;\n } else if (expression.isJSXElement() || expression.isJSXFragment()) {\n transformJSXClient(expression);\n props[name] = expression.node;\n } else if (expression.isExpression()) {\n if (/^key|ref|on.+$/.test(name)) {\n props[name] = expression.node;\n } else if (/^bind:.+/.test(name)) {\n const value = path.scope.generateUidIdentifier('value');\n const bindName = name.slice(5).toLocaleLowerCase();\n props[bindName] = expression.node;\n props[`update${capitalizeFirstLetter(bindName)}`] = t.arrowFunctionExpression(\n [value],\n t.assignmentExpression('=', expression.node as OptionalMemberExpression, value),\n );\n } else {\n if (expression.isConditionalExpression()) {\n props[name] = t.arrowFunctionExpression([], expression.node);\n } else {\n props[name] = expression.node;\n }\n }\n }\n } else if (value.isJSXElement() || value.isJSXFragment()) {\n transformJSXClient(value);\n props[name] = value.node;\n }\n }\n } else if (attribute.isJSXSpreadAttribute()) {\n props._$spread$ = attribute.get('argument').node;\n } else {\n throw new Error('Unsupported attribute type');\n }\n });\n\n return props;\n}\nexport function getAttrName(attribute: t.JSXAttribute): string {\n if (t.isJSXIdentifier(attribute.name)) {\n return attribute.name.name;\n }\n if (t.isJSXNamespacedName(attribute.name)) {\n return `${attribute.name.namespace.name}:${attribute.name.name.name}`;\n }\n throw new Error('Unsupported attribute type');\n}\n/**\n * Determines if the given tagName is a component.\n *\n * case1: <MyComponent />\n * case2: <SomeLibrary.SomeComponent />;\n * case3: <_component />;\n *\n * @param {string} tagName - The name of the tag to check.\n * @return {boolean} True if the tagName is a component, false otherwise.\n */\nexport function isComponent(tagName: string): boolean {\n return (\n (tagName[0] && tagName[0].toLowerCase() !== tagName[0]) ||\n tagName.includes('.') ||\n /[^A-Za-z]/.test(tagName[0])\n );\n}\n\nexport function getTagName(node: t.JSXElement): string {\n const tag = node.openingElement.name;\n return jsxElementNameToString(tag);\n}\n\n/**\n * Converts a JSX element name to a string representation.\n *\n * case1: <MyComponent />\n * case2: <SomeLibrary.SomeComponent />;\n * case3: <namespace:ComponentName />;\n * case4: <SomeLibrary.Nested.ComponentName />;\n *\n * @param {t.JSXMemberExpression | t.JSXIdentifier | t.JSXNamespacedName} node The JSX element name to convert.\n * @returns {string} The string representation of the JSX element name.\n */\nexport function jsxElementNameToString(\n node: t.JSXMemberExpression | t.JSXIdentifier | t.JSXNamespacedName,\n) {\n if (t.isJSXMemberExpression(node)) {\n return `${jsxElementNameToString(node.object)}.${jsxElementNameToString(node.property)}`;\n }\n\n if (t.isJSXIdentifier(node) || t.isIdentifier(node)) {\n return node.name;\n }\n\n return `${node.namespace.name}:${node.name.name}`;\n}\n","import { transformJSXService } from './server';\nimport { transformJSXClient } from './client';\nimport type { NodePath, types as t } from '@babel/core';\nimport type { State } from '../types';\ntype JSXElement = t.JSXElement | t.JSXFragment;\nexport function transformJSX(path: NodePath<JSXElement>) {\n const state: State = path.state;\n const isSsr = state.opts.ssr;\n return isSsr ? transformJSXService(path) : transformJSXClient(path);\n}\n","import { types as t } from '@babel/core';\nimport { type Identifier, type VariableDeclarator, cloneNode } from '@babel/types';\nimport { startsWith } from 'essor-shared';\nimport { imports } from '../program';\nimport type { NodePath } from '@babel/core';\n\nexport function replaceSymbol(path: NodePath<VariableDeclarator>) {\n const init = path.node.init;\n const variableName = (path.node.id as Identifier).name;\n\n if (t.isObjectPattern(path.node.id) || t.isArrayPattern(path.node.id)) {\n return;\n }\n\n if (!startsWith(variableName, '$')) {\n return;\n }\n\n if (\n init &&\n (t.isFunctionExpression(init) || t.isArrowFunctionExpression(init)) &&\n (path.parent as t.VariableDeclaration).kind === 'const'\n ) {\n // 处理箭头函数表达式,将其转换为 _computed 调用\n const newInit = t.callExpression(t.identifier(path.state.useComputed.name), init ? [init] : []);\n imports.add('useComputed');\n path.node.init = newInit; // 直接替换 AST 节点\n } else {\n // 判断参数是否是基本数据类型 ,也可能没有参数\n const originalImportDeclarationNodes = cloneNode(path.get('id').node, true);\n\n const newInit = t.callExpression(t.identifier(path.state.useSignal.name), init ? [init] : []);\n imports.add('useSignal');\n path.node.init = newInit;\n\n path.scope.rename(variableName, `${variableName}.value`);\n\n path.get('id').replaceWith(originalImportDeclarationNodes);\n\n // // 这里需要确保只修改在当前作用域中的变量名\n // path.scope.traverse(path.scope.block, {\n // Identifier(innerPath) {\n // if (t.isExportSpecifier(innerPath.parent)) {\n // const { name } = innerPath.node;\n // if (name.endsWith('.value')) {\n // innerPath.node.name = name.slice(0, -6); // 删除 '.value' 部分\n // }\n // }\n // },\n // });\n }\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport { startsWith } from 'essor-shared';\nimport type { ImportDeclaration } from '@babel/types';\n\nfunction isVariableUsedAsObject(path: NodePath<ImportDeclaration>, variableName: string) {\n const binding = path.scope.getBinding(variableName);\n let isUsedObject = false;\n if (!binding || !binding.referencePaths) {\n return isUsedObject;\n }\n\n for (const referencePath of binding.referencePaths) {\n if (t.isMemberExpression(referencePath.parent)) {\n // const memberExprParent = referencePath.parent;\n\n // if (memberExprParent.object && memberExprParent.property) {\n // const newMemberExpr = t.memberExpression(\n // memberExprParent.object,\n // t.identifier(`${(memberExprParent.property as t.Identifier).name}.value`),\n // );\n // referencePath.parentPath?.replaceWith(newMemberExpr);\n isUsedObject = true;\n // }\n }\n }\n\n return isUsedObject;\n}\n// TODO: 暂时不支持对象\nexport function replaceImportDeclaration(path: NodePath<ImportDeclaration>) {\n const imports = path.node.specifiers;\n imports.forEach(specifier => {\n const variableName = specifier.local.name;\n\n if (startsWith(variableName, '$') && !isVariableUsedAsObject(path, variableName)) {\n path.scope.rename(variableName, `${variableName}.value`);\n specifier.local.name = `${variableName}`;\n }\n });\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport type {\n ArrowFunctionExpression,\n FunctionDeclaration,\n Identifier,\n ObjectProperty,\n RestElement,\n} from '@babel/types';\n\nexport function replaceProps(path: NodePath<FunctionDeclaration | ArrowFunctionExpression>) {\n const firstParam = path.node.params[0];\n\n if (!firstParam || !t.isObjectPattern(firstParam)) {\n return;\n }\n\n const returnStatement = path\n .get('body')\n .get('body')\n .find(statement => statement.isReturnStatement());\n\n if (!returnStatement) {\n return;\n }\n\n const returnValue = (returnStatement.node as any)?.argument;\n if (!t.isJSXElement(returnValue)) {\n return;\n }\n\n function replaceProperties(properties: (ObjectProperty | RestElement)[], parentPath: string) {\n properties.forEach(property => {\n if (t.isObjectProperty(property)) {\n const keyName = (property.key as Identifier).name;\n\n if (t.isIdentifier(property.value)) {\n const propertyName = property.value.name;\n const newName = `${parentPath}${keyName}`;\n path.scope.rename(propertyName, newName);\n } else if (t.isObjectPattern(property.value)) {\n replaceProperties(property.value.properties, `${parentPath}${keyName}.`);\n }\n }\n });\n }\n\n const properties = firstParam.properties;\n replaceProperties(\n properties.filter(property => !t.isRestElement(property)),\n '__props.',\n );\n\n const restElement = properties.find(property => t.isRestElement(property)) as\n | RestElement\n | undefined;\n\n if (restElement) {\n const restName = (restElement.argument as any).name;\n const restVariableDeclaration = t.variableDeclaration('const', [\n t.variableDeclarator(t.identifier(restName), t.identifier('__props')),\n ]);\n\n (path.node.body as any).body.unshift(restVariableDeclaration);\n }\n\n path.node.params[0] = t.identifier('__props');\n}\n","import { transformJSX } from './jsx';\nimport { transformProgram } from './program';\nimport { replaceSymbol } from './signal/symbol';\nimport { replaceImportDeclaration } from './signal/import';\nimport { replaceProps } from './signal/props';\nimport type { PluginObj } from '@babel/core';\nexport { Options, State } from './types';\nexport default function (): PluginObj {\n return {\n name: 'babel-plugin-essor',\n manipulateOptions({ filename }, parserOpts) {\n if (filename.endsWith('.ts') || filename.endsWith('.tsx')) {\n parserOpts.plugins.push('typescript');\n }\n parserOpts.plugins.push('jsx');\n },\n visitor: {\n Program: transformProgram,\n JSXElement: transformJSX,\n JSXFragment: transformJSX,\n FunctionDeclaration: replaceProps,\n ArrowFunctionExpression: replaceProps,\n VariableDeclarator: replaceSymbol,\n ImportDeclaration: replaceImportDeclaration,\n },\n };\n}\n"],"mappings":";AAQO,IAAM,UAAU,MAAM;ACMtB,IAAM,OAAO,SAAS;AAWtB,SAAS,WAAW,KAAK,cAAc;AAC5C,SAAO,IAAI,QAAQ,YAAY,MAAM;AACvC;ACXO,IAAM,wBAAwB,CAAC,gBAAgC;AACpE,SAAO,YAAY,OAAO,CAAC,EAAE,YAAY,IAAI,YAAY,MAAM,CAAC;AAClE;;;ACjBA,SAAS,SAASA,UAAS;;;ACD3B,SAAwB,SAAS,SAAS;AAEnC,IAAM,UAAU,oBAAI,IAAY;AAEhC,IAAM,mBAAmB;AAAA,EAC9B,MAAM,MAA2B,OAAO;AACtC,SAAK,QAAQ;AAAA,MACX,GAAG,KAAK,MAAM,sBAAsB,IAAI;AAAA,MACxC,SAAS,KAAK,MAAM,sBAAsB,UAAU;AAAA,MACpD,KAAK,KAAK,MAAM,sBAAsB,MAAM;AAAA,MAC5C,UAAU,KAAK,MAAM,sBAAsB,WAAW;AAAA,MAEtD,WAAW,KAAK,MAAM,sBAAsB,SAAS;AAAA,MACrD,aAAa,KAAK,MAAM,sBAAsB,WAAW;AAAA,MAEzD,iBAAiB,EAAE,oBAAoB,SAAS,CAAC,CAAC;AAAA,MAClD,MAAM,MAAM;AAAA,IACd;AAAA,EACF;AAAA,EACA,KAAK,MAA2B;AAC9B,UAAM,QAAe,KAAK;AAC1B,QAAI,MAAM,gBAAgB,aAAa,SAAS,GAAG;AACjD,YAAM,QAAQ,KAAK,KAAK,KAAK;AAAA,QAC3B,UAAQ,CAAC,EAAE,oBAAoB,IAAI,KAAK,CAAC,EAAE,oBAAoB,IAAI;AAAA,MACrE;AACA,WAAK,KAAK,KAAK,OAAO,OAAO,GAAG,MAA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","t","t","value","createEssorNode","t","createProps","getAttrProps","getChildren","replaceChild","handleAttributes","transformChildren","isValidChild","setNodeText","getNodeText","transformChild","value","t","t","t","t","imports","t","properties"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-essor",
|
|
3
|
-
"version": "0.0.6-beta.
|
|
4
|
-
"packageManager": "pnpm@8.15.8",
|
|
3
|
+
"version": "0.0.6-beta.10",
|
|
5
4
|
"description": "",
|
|
6
5
|
"type": "module",
|
|
7
6
|
"keywords": [],
|
|
@@ -29,8 +28,9 @@
|
|
|
29
28
|
},
|
|
30
29
|
"sideEffects": false,
|
|
31
30
|
"dependencies": {
|
|
32
|
-
"@babel/core": "^7.24.
|
|
33
|
-
"@babel/types": "^7.24.
|
|
31
|
+
"@babel/core": "^7.24.6",
|
|
32
|
+
"@babel/types": "^7.24.6",
|
|
33
|
+
"essor-shared": "0.0.6-beta.10"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/babel__core": "^7.20.5",
|