babel-plugin-essor 0.0.14-beta.11 → 0.0.14-beta.13
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 +41 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +41 -36
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -91,9 +91,9 @@ var transformProgram = {
|
|
|
91
91
|
template: path.scope.generateUidIdentifier("template$"),
|
|
92
92
|
ssg: path.scope.generateUidIdentifier("ssg$"),
|
|
93
93
|
Fragment: path.scope.generateUidIdentifier("fragment$"),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
signal: path.scope.generateUidIdentifier("signal$"),
|
|
95
|
+
computed: path.scope.generateUidIdentifier("computed$"),
|
|
96
|
+
reactive: path.scope.generateUidIdentifier("reactive$"),
|
|
97
97
|
tmplDeclaration: import_core.types.variableDeclaration("const", []),
|
|
98
98
|
opts: state.opts
|
|
99
99
|
};
|
|
@@ -254,6 +254,7 @@ function replaceSpace(node) {
|
|
|
254
254
|
return node.value.replaceAll(/\s+/g, " ").trim();
|
|
255
255
|
}
|
|
256
256
|
function createEssorNode(path, result) {
|
|
257
|
+
var _a, _b;
|
|
257
258
|
const state = path.state;
|
|
258
259
|
const isJSXFragment = path.isJSXFragment();
|
|
259
260
|
const isComponent2 = path.isJSXElement() && isComponent(getTagName(path.node));
|
|
@@ -266,8 +267,7 @@ function createEssorNode(path, result) {
|
|
|
266
267
|
imports.add("template");
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
|
-
const key = result.props.key;
|
|
270
|
-
delete result.props.key;
|
|
270
|
+
const key = (_b = result.props.key) != null ? _b : (_a = result.props[0]) == null ? void 0 : _a.key;
|
|
271
271
|
const propsArg = createProps(result.props);
|
|
272
272
|
const args = isComponent2 && getTagName(path.node) === "Fragment" ? [import_core3.types.stringLiteral(""), propsArg] : [tmpl, propsArg];
|
|
273
273
|
if (key) {
|
|
@@ -278,32 +278,39 @@ function createEssorNode(path, result) {
|
|
|
278
278
|
return import_core3.types.callExpression(state[fnName], args);
|
|
279
279
|
}
|
|
280
280
|
function createProps(props) {
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
281
|
+
const result = [];
|
|
282
|
+
for (const prop in props) {
|
|
283
|
+
let value = props[prop];
|
|
284
|
+
if (prop === "key") {
|
|
285
|
+
continue;
|
|
284
286
|
}
|
|
285
|
-
if (
|
|
286
|
-
|
|
287
|
+
if (Array.isArray(value)) {
|
|
288
|
+
value = import_core3.types.arrayExpression(value);
|
|
287
289
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
return import_core3.types.stringLiteral(value);
|
|
291
|
-
case "number":
|
|
292
|
-
return import_core3.types.numericLiteral(value);
|
|
293
|
-
case "boolean":
|
|
294
|
-
return import_core3.types.booleanLiteral(value);
|
|
295
|
-
case "undefined":
|
|
296
|
-
case void 0:
|
|
297
|
-
return import_core3.types.tsUndefinedKeyword();
|
|
298
|
-
case null:
|
|
299
|
-
return import_core3.types.nullLiteral();
|
|
300
|
-
default:
|
|
301
|
-
return value;
|
|
290
|
+
if (typeof value === "object" && value !== null && !import_core3.types.isNode(value)) {
|
|
291
|
+
value = createProps(value);
|
|
302
292
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
293
|
+
if (typeof value === "string") {
|
|
294
|
+
value = import_core3.types.stringLiteral(value);
|
|
295
|
+
}
|
|
296
|
+
if (typeof value === "number") {
|
|
297
|
+
value = import_core3.types.numericLiteral(value);
|
|
298
|
+
}
|
|
299
|
+
if (typeof value === "boolean") {
|
|
300
|
+
value = import_core3.types.booleanLiteral(value);
|
|
301
|
+
}
|
|
302
|
+
if (value === void 0) {
|
|
303
|
+
value = import_core3.types.tsUndefinedKeyword();
|
|
304
|
+
}
|
|
305
|
+
if (value === null) {
|
|
306
|
+
value = import_core3.types.nullLiteral();
|
|
307
|
+
}
|
|
308
|
+
if (prop === "_$spread$") {
|
|
309
|
+
result.push(import_core3.types.spreadElement(value));
|
|
310
|
+
} else {
|
|
311
|
+
result.push(import_core3.types.objectProperty(import_core3.types.stringLiteral(prop), value));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
307
314
|
return import_core3.types.objectExpression(result);
|
|
308
315
|
}
|
|
309
316
|
function transformJSXElement(path, result, isRoot = false) {
|
|
@@ -313,10 +320,6 @@ function transformJSXElement(path, result, isRoot = false) {
|
|
|
313
320
|
const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);
|
|
314
321
|
const isSvg = svgTags.includes(tagName) && result.index === 1;
|
|
315
322
|
const { props, hasExpression } = getAttrProps(path);
|
|
316
|
-
if (props.key) {
|
|
317
|
-
result.props.key = props.key;
|
|
318
|
-
delete props.key;
|
|
319
|
-
}
|
|
320
323
|
if (tagIsComponent) {
|
|
321
324
|
handleComponentElement(path, result, isRoot, props);
|
|
322
325
|
} else {
|
|
@@ -573,7 +576,7 @@ function replaceSymbol(path) {
|
|
|
573
576
|
const variableName = id.name;
|
|
574
577
|
if (import_core4.types.isObjectPattern(id) || import_core4.types.isArrayPattern(id) || !isSymbolStart(path, variableName)) return;
|
|
575
578
|
const isComputed = init && (import_core4.types.isFunctionExpression(init) || import_core4.types.isArrowFunctionExpression(init)) && path.parent.kind === "const";
|
|
576
|
-
const hookName = isComputed ? "
|
|
579
|
+
const hookName = isComputed ? "computed" : "signal";
|
|
577
580
|
const newInit = import_core4.types.callExpression(import_core4.types.identifier(path.state[hookName].name), init ? [init] : []);
|
|
578
581
|
imports.add(hookName);
|
|
579
582
|
path.node.init = newInit;
|
|
@@ -657,7 +660,9 @@ function replaceProps(path) {
|
|
|
657
660
|
});
|
|
658
661
|
};
|
|
659
662
|
const properties = firstParam.properties;
|
|
660
|
-
const notRestProperties = properties.filter(
|
|
663
|
+
const notRestProperties = properties.filter(
|
|
664
|
+
(property) => !import_core6.types.isRestElement(property)
|
|
665
|
+
);
|
|
661
666
|
replaceProperties(notRestProperties, "__props.");
|
|
662
667
|
const notRestNames = notRestProperties.map((property) => property.key.name);
|
|
663
668
|
if (notRestNames.some((name) => startsWith(name, "$"))) {
|
|
@@ -675,7 +680,7 @@ function handleRestElement(path, state, properties, notRestNames) {
|
|
|
675
680
|
path.node.params[0] = import_core6.types.identifier(restName);
|
|
676
681
|
} else {
|
|
677
682
|
const restVariableDeclaration = createRestVariableDeclaration(state, restName, notRestNames);
|
|
678
|
-
imports.add("
|
|
683
|
+
imports.add("reactive");
|
|
679
684
|
path.node.body.body.unshift(restVariableDeclaration);
|
|
680
685
|
}
|
|
681
686
|
}
|
|
@@ -684,7 +689,7 @@ function createRestVariableDeclaration(state, restName, notRestNames) {
|
|
|
684
689
|
return import_core6.types.variableDeclaration("const", [
|
|
685
690
|
import_core6.types.variableDeclarator(
|
|
686
691
|
import_core6.types.identifier(restName),
|
|
687
|
-
import_core6.types.callExpression(state.
|
|
692
|
+
import_core6.types.callExpression(state.reactive, [
|
|
688
693
|
import_core6.types.identifier("__props"),
|
|
689
694
|
import_core6.types.arrayExpression(notRestNames.map((name) => import_core6.types.stringLiteral(name)))
|
|
690
695
|
])
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/jsx/index.ts","../../shared/src/is.ts","../../shared/src/comm.ts","../../shared/src/name.ts","../../shared/src/console.ts","../src/program.ts","../src/shared.ts","../src/jsx/constants.ts","../src/signal/symbol.ts","../src/signal/import.ts","../src/signal/props.ts"],"sourcesContent":["import { transformJSX } from './jsx';\nimport { transformProgram } from './program';\nimport {\n replaceSymbol,\n symbolArrayPattern,\n symbolIdentifier,\n symbolObjectPattern,\n} 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\n FunctionDeclaration: replaceProps,\n ArrowFunctionExpression: replaceProps,\n VariableDeclarator: replaceSymbol,\n ImportDeclaration: replaceImportDeclaration,\n Identifier: symbolIdentifier,\n ObjectPattern: symbolObjectPattern,\n ArrayPattern: symbolArrayPattern,\n\n JSXElement: transformJSX,\n JSXFragment: transformJSX,\n },\n };\n}\n","import { types as t } from '@babel/core';\nimport { capitalize, isArray } from '@estjs/shared';\nimport { imports } from '../program';\nimport {\n type JSXChild,\n type JSXElement,\n getAttrName,\n getTagName,\n hasSiblingElement,\n isComponent as isComponentName,\n isTextChild,\n setNodeText,\n} from '../shared';\nimport { selfClosingTags, svgTags } from './constants';\nimport type { Identifier, OptionalMemberExpression, StringLiteral } from '@babel/types';\nimport type { State } from '../types';\nimport type { NodePath } from '@babel/core';\n\nexport interface Result {\n index: number;\n isLastChild: boolean;\n parentIndex: number;\n props: Record<string, any>;\n template: string | string[];\n}\n\nlet isSSG = false;\n\nfunction addToTemplate(result: Result, content: string, join = false): void {\n if (isSSG) {\n if (join && result.template.length > 0) {\n (result.template as string[])[result.template.length - 1] += content;\n } else {\n (result.template as string[]).push(content);\n }\n } else {\n result.template += content;\n }\n}\n\nexport function transformJSX(path: NodePath<JSXElement>): void {\n const state: State = path.state;\n isSSG = state.opts.ssg;\n\n const result: Result = {\n index: 1,\n isLastChild: false,\n parentIndex: 0,\n props: {},\n template: isSSG ? [] : '',\n };\n transformJSXElement(path, result, true);\n\n path.replaceWith(createEssorNode(path, result));\n}\n// Trim and replace multiple spaces/newlines with a single space\nfunction replaceSpace(node: t.JSXText): string {\n return node.value.replaceAll(/\\s+/g, ' ').trim();\n}\n\n/**\n * Creates an expression node for a JSX element or fragment.\n * @param path - The path to the JSX element.\n * @param result - The result containing template and props.\n * @returns A CallExpression representing the JSX element or fragment.\n */\nfunction createEssorNode(path: NodePath<JSXElement>, result: Result): t.CallExpression {\n const state: State = path.state;\n const isJSXFragment = path.isJSXFragment();\n const isComponent = path.isJSXElement() && isComponentName(getTagName(path.node));\n\n const tmpl = isComponent\n ? t.identifier(getTagName(path.node))\n : path.scope.generateUidIdentifier('_tmpl$');\n\n let templateNode;\n if (!isComponent) {\n templateNode = isSSG\n ? t.arrayExpression((result.template as string[]).map(t.stringLiteral))\n : t.callExpression(state.template, [t.stringLiteral(result.template as string)]);\n\n state.tmplDeclaration.declarations.push(t.variableDeclarator(tmpl, templateNode));\n if (!isSSG) {\n imports.add('template');\n }\n }\n\n const key = result.props.key;\n delete result.props.key;\n\n const propsArg = createProps(result.props);\n const args =\n isComponent && getTagName(path.node) === 'Fragment'\n ? [t.stringLiteral(''), propsArg]\n : [tmpl, propsArg];\n\n if (key) {\n args.push(key);\n }\n\n const fnName = isSSG\n ? 'ssg'\n : isJSXFragment || (isComponent && getTagName(path.node) === 'Fragment')\n ? 'Fragment'\n : 'h';\n imports.add(fnName);\n\n return t.callExpression(state[fnName], args);\n}\n\nfunction createProps(props: Record<string, any>): t.ObjectExpression {\n const toAstNode = value => {\n if (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 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.entries(props).map(([prop, value]) =>\n prop === '_$spread$'\n ? t.spreadElement(toAstNode(value))\n : t.objectProperty(t.stringLiteral(prop), toAstNode(value)),\n );\n\n return t.objectExpression(result);\n}\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 = isComponentName(tagName);\n const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);\n const isSvg = svgTags.includes(tagName) && result.index === 1;\n const { props, hasExpression } = getAttrProps(path);\n\n // key\n if (props.key) {\n result.props.key = props.key;\n delete props.key;\n }\n\n if (tagIsComponent) {\n handleComponentElement(path, result, isRoot, props);\n } else {\n handleHTMLElement(path, result, tagName, isSelfClose, isSvg, props, hasExpression);\n }\n } else {\n result.index--;\n transformChildren(path, result);\n }\n}\n\nfunction handleComponentElement(\n path: NodePath<JSXElement>,\n result: Result,\n isRoot: boolean,\n props: Record<string, any>,\n): void {\n if (isRoot) {\n result.props = props;\n const children = getChildren(path);\n if (children.length > 0) {\n const childrenGenerator =\n children.length === 1 ? children[0] : t.arrayExpression(children as JSXElement[]);\n\n // Check if children is a conditional expression\n if (t.isConditionalExpression(childrenGenerator)) {\n result.props.children = t.arrowFunctionExpression([], childrenGenerator);\n } else {\n result.props.children = childrenGenerator;\n }\n }\n } else {\n transformJSX(path);\n replaceChild(path.node, result);\n }\n}\n\nfunction handleHTMLElement(\n path: NodePath<JSXElement>,\n result: Result,\n tagName: string,\n isSelfClose: boolean,\n isSvg: boolean,\n props: Record<string, any>,\n hasExpression: boolean,\n): void {\n if (isSvg) {\n result.template = isSSG ? [`<svg _svg_ data-hk=\"${result.index}\">`] : `<svg _svg_ >`;\n }\n\n addToTemplate(result, `<${tagName}${isSSG ? ` data-hk=\"${result.index}\"` : ''}`, true);\n handleAttributes(props, result);\n addToTemplate(result, isSelfClose ? '/>' : '>', !hasExpression);\n\n if (!isSelfClose) {\n transformChildren(path, result);\n if (hasSiblingElement(path) || isSSG) {\n addToTemplate(result, `</${tagName}>`);\n }\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 addToTemplate(result, `${expression.node.value}`, true);\n } else if (expression.isExpression()) {\n replaceChild(expression.node, result);\n } else if (t.isJSXEmptyExpression(expression.node)) {\n // it is empty expression\n // just for tracking value\n } else {\n throw new Error('Unsupported child type');\n }\n } else if (child.isJSXText()) {\n addToTemplate(result, replaceSpace(child.node), true);\n } else {\n throw new Error('Unsupported child type');\n }\n}\nfunction getNodeText(path: NodePath<JSXChild>): string {\n if (path.isJSXText()) {\n return replaceSpace(path.node);\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}\n\nfunction isStyleClassName(name: string): name is 'style' | 'class' {\n return name === 'class' || name === 'style';\n}\n\nfunction handleAttributes(props: Record<string, any>, result: Result): void {\n let klass = '';\n let style = '';\n\n for (const [prop, value] of Object.entries(props)) {\n if (prop === 'class' && typeof value === 'string') {\n klass += ` ${value}`;\n delete props[prop];\n } else if (prop === 'style' && typeof value === 'string') {\n style += `${value}${value.at(-1) === ';' ? '' : ';'}`;\n delete props[prop];\n } else if (value === true) {\n addToTemplate(result, ` ${prop}`);\n delete props[prop];\n } else if (value === false) {\n delete props[prop];\n } else if (typeof value === 'string' || typeof value === 'number') {\n addToTemplate(result, ` ${prop}=\"${value}\"`);\n delete props[prop];\n } else if (t.isConditionalExpression(value)) {\n props[prop] = t.arrowFunctionExpression([], value);\n } else if (t.isObjectExpression(value)) {\n const val = handleObjectExpression(prop, value, props, isStyleClassName(prop));\n if (val) {\n if (prop === 'class') {\n klass += ` ${val}`;\n }\n if (prop === 'style') {\n style += `${val}${val.at(-1) === ';' ? '' : ';'}`;\n }\n }\n }\n }\n\n if (Object.keys(props).length > 0) {\n result.props[result.index] = props;\n }\n\n if (klass.trim()) {\n addToTemplate(result, ` class=\"${klass.trim()}\"`);\n }\n if (style.trim()) {\n addToTemplate(result, ` style=\"${style.trim()}\"`);\n }\n}\n\nfunction handleObjectExpression(\n prop: string,\n value: t.ObjectExpression,\n props: Record<string, any>,\n isCt = false,\n): string {\n let ct = '';\n const hasConditional = value.properties.some(\n property => t.isObjectProperty(property) && t.isConditionalExpression(property.value),\n );\n\n if (hasConditional) {\n props[prop] = t.arrowFunctionExpression([], value);\n } else if (isCt) {\n value.properties.forEach(property => {\n if (t.isObjectProperty(property)) {\n ct += `${(property.key as Identifier).name || (property.key as StringLiteral).value}:${(property.value as StringLiteral).value};`;\n }\n });\n\n delete props[prop];\n }\n return ct;\n}\n\nfunction replaceChild(node: t.Expression, result: Result): void {\n if (result.isLastChild) {\n result.index--;\n } else {\n addToTemplate(result, '<!>');\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 transformJSX(child);\n } else if (child.isJSXExpressionContainer()) {\n child.replaceWith(child.get('expression'));\n } else if (child.isJSXText()) {\n child.replaceWith(t.stringLiteral(replaceSpace(child.node)));\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}\n\nexport function 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 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 transformJSX(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[bindName] = t.memberExpression(\n // t.identifier((expression.node as Identifier).name),\n // t.identifier('value'),\n // );\n props[`update${capitalize(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 transformJSX(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 return {\n props,\n hasExpression,\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): val is Promise<any> {\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}\n\nexport function isSet(val: any): val is Set<any> {\n return _toString.call(val) === '[object Set]';\n}\nexport function isWeakMap(val: any): val is WeakMap<any, any> {\n return _toString.call(val) === '[object WeakMap]';\n}\nexport function isWeakSet(val: any): val is WeakSet<any> {\n return _toString.call(val) === '[object WeakSet]';\n}\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;\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\nexport function isHTMLElement(obj) {\n if (!obj) return false;\n return obj && typeof obj === 'object' && obj.nodeType === 1 && typeof obj.nodeName === 'string';\n}\n\nexport const isPlainObject = (val: unknown): val is object =>\n _toString.call(val) === '[object Object]';\n\nexport type StringNumber = `${number}`;\nexport function isStringNumber(val: unknown): val is StringNumber {\n if (!isString(val)) {\n return false;\n }\n return !Number.isNaN(Number(val));\n}\n","import { isArray, isFunction, isString } 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 isArray(data) ? (data.flat() as T[]) : [data];\n}\nexport const hasChanged = (value, oldValue) =>\n value !== oldValue && (value === value || oldValue === oldValue);\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 if (!isString(str)) {\n return false;\n }\n return str.indexOf(searchString) === 0;\n}\n\n/**\n * Escapes special HTML characters in a string.\n * @param str - The string to escape.\n * @returns The escaped string.\n */\nexport function escape(str: string): string {\n return str.replaceAll(/[\"&'<>]/g, char => {\n switch (char) {\n case '&':\n return '&';\n case '<':\n return '<';\n case '>':\n return '>';\n case '\"':\n return '"';\n case \"'\":\n return ''';\n default:\n return char;\n }\n });\n}\n\nexport type ExcludeType = ((key: string | symbol) => boolean) | (string | symbol)[];\n\n/**\n * Checks if a key should be excluded based on the provided exclude criteria.\n * @param key - The key to check.\n * @param exclude - The exclusion criteria.\n * @returns True if the key should be excluded, otherwise false.\n */\nexport function isExclude(key: string | symbol, exclude?: ExcludeType): boolean {\n return isArray(exclude) ? exclude.includes(key) : isFunction(exclude) ? exclude(key) : false;\n}\n\n/**\n * Generates a unique random 8 character string ID.\n * The generated IDs only contain alphanumeric characters.\n * @returns A unique random 8 character string ID.\n */\nexport function generateUniqueId() {\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n const charactersLength = characters.length;\n for (let i = 0; i < 8; i++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n }\n return result;\n}\n\n/**\n * Checks if the current environment is a browser.\n * @returns True if the current environment is a browser, otherwise false.\n */\nexport function isBrowser() {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\nexport const cacheStringFunction = <T extends (str: string) => string>(fn: T): T => {\n const cache: Record<string, string> = Object.create(null);\n return ((str: string) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n }) as T;\n};\n","import { cacheStringFunction } from './comm';\n\nconst hyphenateRE = /\\B([A-Z])/g;\nexport const kebabCase: (str: string) => string = cacheStringFunction((str: string) =>\n str.replaceAll(hyphenateRE, '-$1').toLowerCase(),\n);\n\nconst camelizeRE = /-(\\w)/g;\nexport const camelCase: (str: string) => string = cacheStringFunction((str: string): string => {\n return str.replaceAll(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));\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 capitalize: <T extends string>(str: T) => Capitalize<T> = cacheStringFunction(\n <T extends string>(str: T) => {\n return (str.charAt(0).toUpperCase() + str.slice(1)) as Capitalize<T>;\n },\n);\n","export function warn(msg: string, ..._args: any[]): void;\nexport function warn(msg: string, ...args): void {\n // eslint-disable-next-line prefer-spread\n console.warn.apply(console, [`[Essor warn]: ${msg}`].concat(args) as [string, ...any[]]);\n}\n\nexport function info(msg: string, ..._args: any[]): void;\nexport function info(msg: string, ...args): void {\n // eslint-disable-next-line prefer-spread, no-console\n console.info.apply(console, [`[Essor info]: ${msg}`].concat(args) as [string, ...any[]]);\n}\n\nexport function error(msg: string, ..._args: any[]): void;\nexport function error(msg: string, ...args): void {\n // eslint-disable-next-line prefer-spread\n console.error.apply(console, [`[Essor error]: ${msg}`].concat(args) as [string, ...any[]]);\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport type { Options, State } from './types';\nexport const imports = new Set<string>();\n\nconst defaultOption: Options = {\n ssg: false,\n symbol: '$',\n props: true,\n};\n\nexport const transformProgram = {\n enter(path: NodePath<t.Program>, state) {\n imports.clear();\n\n // merge options\n state.opts = { ...defaultOption, ...state.opts };\n\n path.state = {\n h: path.scope.generateUidIdentifier('h$'),\n template: path.scope.generateUidIdentifier('template$'),\n ssg: path.scope.generateUidIdentifier('ssg$'),\n Fragment: path.scope.generateUidIdentifier('fragment$'),\n\n useSignal: path.scope.generateUidIdentifier('signal$'),\n useComputed: path.scope.generateUidIdentifier('computed$'),\n useReactive: path.scope.generateUidIdentifier('reactive$'),\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","import { type NodePath, types as t } from '@babel/core';\nimport { startsWith } from '@estjs/shared';\nimport type { State } from './types';\n\nexport type JSXElement = t.JSXElement | t.JSXFragment;\n\nexport type JSXChild =\n | t.JSXElement\n | t.JSXFragment\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXText;\n\n/**\n * Checks if the given Babel path has a sibling element.\n *\n * @param {NodePath} path - The Babel path to check.\n * @return {boolean} True if the path has a sibling element, false otherwise.\n */\nexport function hasSiblingElement(path) {\n // Get all siblings (both previous and next)\n const siblings = path.getAllPrevSiblings().concat(path.getAllNextSiblings());\n\n // Check for non-self-closing sibling elements or JSXExpressionContainer\n const hasSibling = siblings.some(\n siblingPath => siblingPath.isJSXElement() || siblingPath.isJSXExpressionContainer(),\n );\n\n return hasSibling;\n}\n/**\n * Retrieves the name of a JSX attribute.\n *\n * @param {t.JSXAttribute} attribute - The JSX attribute to retrieve the name from.\n * @return {string} The name of the attribute.\n * @throws {Error} If the attribute type is unsupported.\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/**\n * Retrieves the tag name of a JSX element.\n *\n * @param {t.JSXElement} node - The JSX element.\n * @return {string} The tag name of the JSX element.\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\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-z]/i.test(tagName[0])\n );\n}\n\n/**\n * Determines if the given path represents a text child node in a JSX expression.\n *\n * @param {NodePath<JSXChild>} path - The path to the potential text child node.\n * @return {boolean} True if the path represents a text child node, false otherwise.\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\n/**\n * Sets the text content of a JSX node.\n *\n * @param {NodePath<JSXChild>} path - The path to the JSX node.\n * @param {string} text - The text to set.\n * @return {void}\n */\nexport function 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\n/**\n * get the symbol start with\n */\nexport function isSymbolStart(path: NodePath<any>, name: string) {\n const state: State = path.state;\n const { symbol } = state?.opts || '$';\n\n return startsWith(name, symbol);\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 { isSymbolStart } from '../shared';\nimport type { Identifier, VariableDeclarator } from '@babel/types';\nimport type { NodePath } from '@babel/core';\n\n/**\n * Replaces the symbol in a variable declarator with a computed or signal expression.\n *\n * case 1: let $a = 1 => let $a = useSignal(1);\n * case 2: const $a = ()=>{return $a} => const $a = useComputed(()=>{return $a})\n *\n * @param {NodePath<VariableDeclarator>} path - The path to the variable declarator node.\n * @return {void}\n */\nexport function replaceSymbol(path: NodePath<VariableDeclarator>) {\n const { init, id } = path.node;\n const variableName = (id as Identifier).name;\n\n if (t.isObjectPattern(id) || t.isArrayPattern(id) || !isSymbolStart(path, variableName)) return;\n\n const isComputed =\n init &&\n (t.isFunctionExpression(init) || t.isArrowFunctionExpression(init)) &&\n (path.parent as t.VariableDeclaration).kind === 'const';\n\n const hookName = isComputed ? 'useComputed' : 'useSignal';\n const newInit = t.callExpression(t.identifier(path.state[hookName].name), init ? [init] : []);\n\n imports.add(hookName);\n path.node.init = newInit;\n}\n\nexport function symbolIdentifier(path) {\n const parentPath = path.parentPath;\n if (!shouldProcessIdentifier(parentPath)) return;\n\n const { node } = path;\n if (!isSymbolStart(path, node.name)) return;\n\n if (!path.findParent(p => p.isMemberExpression() && p.node.property.name === 'value')) {\n path.replaceWith(t.memberExpression(t.identifier(node.name), t.identifier('value')));\n }\n}\n\nfunction shouldProcessIdentifier(parentPath) {\n return (\n parentPath &&\n !t.isVariableDeclarator(parentPath) &&\n !t.isImportSpecifier(parentPath) &&\n !t.isObjectProperty(parentPath) &&\n !t.isArrayPattern(parentPath) &&\n !t.isObjectPattern(parentPath)\n );\n}\n\nexport function symbolObjectPattern(path) {\n path.node.properties.forEach(property => {\n if (\n t.isObjectProperty(property) &&\n t.isIdentifier(property.key) &&\n isSymbolStart(path, property.key.name)\n ) {\n property.key = t.identifier(property.key.name);\n }\n });\n}\n\nexport function symbolArrayPattern(path) {\n path.node.elements.forEach(element => {\n if (t.isIdentifier(element) && element.name.startsWith('$')) {\n element.name = t.identifier(element.name).name;\n } else if (t.isObjectPattern(element)) {\n symbolObjectPattern({ node: element } as NodePath);\n }\n });\n}\n","import { types as t } from '@babel/core';\nimport { startsWith } from '@estjs/shared';\n\n/**\n * Replaces import declarations\n *\n * case1: import { $a } from 'a';console.log(a) => import { $a } from 'a';console.log($a.value)\n * case2: import $a from 'a';console.log(a) => import $a from 'a';console.log($a.value)\n *\n * @param {object} path - The path to replace import declarations.\n * @return {void}\n */\nexport function replaceImportDeclaration(path) {\n path.node.specifiers.forEach(specifier => {\n const variableName = specifier.local.name;\n if (startsWith(variableName, '$') && !isVariableUsedAsObject(path, variableName)) {\n path.scope.rename(variableName, `${variableName}.value`);\n specifier.local.name = variableName;\n }\n });\n}\n\n/**\n * Checks if a variable is used as an object.\n *\n * @param path - The path to the variable.\n * @param variableName - The name of the variable.\n * @returns {boolean} - Whether the variable is used as an object.\n */\nfunction isVariableUsedAsObject(path, variableName) {\n const binding = path.scope.getBinding(variableName);\n return (\n binding?.referencePaths?.some(referencePath => {\n if (t.isMemberExpression(referencePath.parent)) {\n const { object, property } = referencePath.parent;\n if (t.isIdentifier(object, { name: variableName })) {\n referencePath.parentPath.replaceWith(\n t.memberExpression(t.memberExpression(object, t.identifier('value')), property),\n );\n return true;\n }\n }\n return false;\n }) || false\n );\n}\n","import { startsWith } from '@estjs/shared';\nimport { type NodePath, types as t } from '@babel/core';\nimport { imports } from '../program';\nimport type { State } from '../types';\nimport type {\n ArrowFunctionExpression,\n FunctionDeclaration,\n Identifier,\n ObjectProperty,\n RestElement,\n} from '@babel/types';\n\n/**\n * Replaces the properties of a function's first parameter with new names.\n *\n * auto replace pattern to props object\n *\n * rule1: function argument\n * rule2: first argument is object and it pattern\n * rule3: function has return\n *\n * transform case\n * case1 ({a, b}) => <div>{a.value}</div> to=> (_props)=><div>{_props.a.value}</div>\n * case2 ({a, b, ...rest}) => <div>{a.value}{rest}</div> to=> (_props)=> {const restProps = reactive(props,[a,b]);return <div>{_props.a.value}{reset}</div>}\n *\n * not transform case\n * case1 ([a,b])=> <div>{a.value}</div>\n * case2 ({a.,b}) ={}\n *\n * @param {NodePath<FunctionDeclaration | ArrowFunctionExpression>} path - The path to the function node.\n * @return {void}\n */\nexport function replaceProps(path: NodePath<FunctionDeclaration | ArrowFunctionExpression>) {\n const state: State = path.state;\n const firstParam = path.node.params[0];\n\n if (!firstParam || !t.isObjectPattern(firstParam)) return;\n\n const returnStatement = path\n .get('body')\n .get('body')\n .find(statement => statement.isReturnStatement());\n\n if (!returnStatement || !t.isJSXElement((returnStatement.node as any)?.argument)) return;\n\n const replaceProperties = (properties: (ObjectProperty | RestElement)[], parentPath: string) => {\n properties.forEach(property => {\n if (t.isObjectProperty(property) && t.isIdentifier(property.key)) {\n const keyName = property.key.name;\n if (t.isIdentifier(property.value)) {\n path.scope.rename(property.value.name, `${parentPath}${keyName}`);\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 const notRestProperties = properties.filter(property => !t.isRestElement(property)) as ObjectProperty[];\n replaceProperties(notRestProperties, '__props.');\n\n const notRestNames = notRestProperties.map(property => (property.key as Identifier).name);\n if (__DEV__ && notRestNames.some(name => startsWith(name, '$'))) {\n console.warn('props name can not start with $');\n return;\n }\n\n handleRestElement(path, state, properties, notRestNames);\n}\n\nfunction handleRestElement(path, state: State, properties, notRestNames) {\n const restElement = properties.find(property => t.isRestElement(property)) as RestElement | undefined;\n path.node.params[0] = t.identifier('__props');\n\n if (restElement) {\n const restName = (restElement.argument as Identifier).name;\n if (notRestNames.length === 0) {\n path.node.params[0] = t.identifier(restName);\n } else {\n const restVariableDeclaration = createRestVariableDeclaration(state, restName, notRestNames);\n imports.add('useReactive');\n (path.node.body as t.BlockStatement).body.unshift(restVariableDeclaration);\n }\n }\n}\n\nfunction createRestVariableDeclaration(state: State, restName: string, notRestNames: string[]) {\n return t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(restName),\n t.callExpression(state.useReactive, [\n t.identifier('__props'),\n t.arrayExpression(notRestNames.map(name => t.stringLiteral(name))),\n ])\n ),\n ]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA2B;;;ACQpB,IAAM,UAAU,MAAM;AAEtB,SAAS,SAAS,KAA6B;AACpD,SAAO,OAAO,QAAQ;AACxB;ACCO,IAAM,OAAO,SAAS;AAWtB,SAAS,WAAW,KAAK,cAAc;AAC5C,MAAI,CAAC,SAAS,GAAG,GAAG;AAClB,WAAO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,KAAK,YAAY;AAAA,MACtC;AACA,iBAAW,QAAQ,KAAK,KAAK;AAAA,IAC/B;AAAA,IACA,SAAS;AAAA,MACP,SAAS;AAAA,MAET,qBAAqB;AAAA,MACrB,yBAAyB;AAAA,MACzB,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,MACnB,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,cAAc;AAAA,MAEd,YAAY;AAAA,MACZ,aAAa;AAAA,IACf;AAAA,EACF;AACF;","names":["import_core","t","import_core","t","isComponent","t","value","import_core","t","import_core","t","import_core","t","properties"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/jsx/index.ts","../../shared/src/is.ts","../../shared/src/comm.ts","../../shared/src/name.ts","../../shared/src/console.ts","../src/program.ts","../src/shared.ts","../src/jsx/constants.ts","../src/signal/symbol.ts","../src/signal/import.ts","../src/signal/props.ts"],"sourcesContent":["import { transformJSX } from './jsx';\nimport { transformProgram } from './program';\nimport {\n replaceSymbol,\n symbolArrayPattern,\n symbolIdentifier,\n symbolObjectPattern,\n} 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\n FunctionDeclaration: replaceProps,\n ArrowFunctionExpression: replaceProps,\n VariableDeclarator: replaceSymbol,\n ImportDeclaration: replaceImportDeclaration,\n Identifier: symbolIdentifier,\n ObjectPattern: symbolObjectPattern,\n ArrayPattern: symbolArrayPattern,\n\n JSXElement: transformJSX,\n JSXFragment: transformJSX,\n },\n };\n}\n","import { types as t } from '@babel/core';\nimport { capitalize } from '@estjs/shared';\nimport { imports } from '../program';\nimport {\n type JSXChild,\n type JSXElement,\n getAttrName,\n getTagName,\n hasSiblingElement,\n isComponent as isComponentName,\n isTextChild,\n setNodeText,\n} from '../shared';\nimport { selfClosingTags, svgTags } from './constants';\nimport type { Identifier, OptionalMemberExpression, StringLiteral } from '@babel/types';\nimport type { State } from '../types';\nimport type { NodePath } from '@babel/core';\n\nexport interface Result {\n index: number;\n isLastChild: boolean;\n parentIndex: number;\n props: Record<string, any>;\n template: string | string[];\n}\n\nlet isSSG = false;\n\nfunction addToTemplate(result: Result, content: string, join = false): void {\n if (isSSG) {\n if (join && result.template.length > 0) {\n (result.template as string[])[result.template.length - 1] += content;\n } else {\n (result.template as string[]).push(content);\n }\n } else {\n result.template += content;\n }\n}\n\nexport function transformJSX(path: NodePath<JSXElement>): void {\n const state: State = path.state;\n isSSG = state.opts.ssg;\n\n const result: Result = {\n index: 1,\n isLastChild: false,\n parentIndex: 0,\n props: {},\n template: isSSG ? [] : '',\n };\n transformJSXElement(path, result, true);\n\n path.replaceWith(createEssorNode(path, result));\n}\n// Trim and replace multiple spaces/newlines with a single space\nfunction replaceSpace(node: t.JSXText): string {\n return node.value.replaceAll(/\\s+/g, ' ').trim();\n}\n\n/**\n * Creates an expression node for a JSX element or fragment.\n * @param path - The path to the JSX element.\n * @param result - The result containing template and props.\n * @returns A CallExpression representing the JSX element or fragment.\n */\nfunction createEssorNode(path: NodePath<JSXElement>, result: Result): t.CallExpression {\n const state: State = path.state;\n const isJSXFragment = path.isJSXFragment();\n const isComponent = path.isJSXElement() && isComponentName(getTagName(path.node));\n\n const tmpl = isComponent\n ? t.identifier(getTagName(path.node))\n : path.scope.generateUidIdentifier('_tmpl$');\n\n let templateNode;\n if (!isComponent) {\n templateNode = isSSG\n ? t.arrayExpression((result.template as string[]).map(t.stringLiteral))\n : t.callExpression(state.template, [t.stringLiteral(result.template as string)]);\n\n state.tmplDeclaration.declarations.push(t.variableDeclarator(tmpl, templateNode));\n if (!isSSG) {\n imports.add('template');\n }\n }\n\n const key = result.props.key ?? result.props[0]?.key;\n\n const propsArg = createProps(result.props);\n const args =\n isComponent && getTagName(path.node) === 'Fragment'\n ? [t.stringLiteral(''), propsArg]\n : [tmpl, propsArg];\n\n if (key) {\n args.push(key);\n }\n\n const fnName = isSSG\n ? 'ssg'\n : isJSXFragment || (isComponent && getTagName(path.node) === 'Fragment')\n ? 'Fragment'\n : 'h';\n imports.add(fnName);\n\n return t.callExpression(state[fnName], args);\n}\n\nfunction createProps(props: Record<string, any>): t.ObjectExpression {\n const result: (t.ObjectProperty | t.SpreadElement)[] = [];\n for (const prop in props) {\n let value = props[prop];\n if (prop === 'key') {\n continue;\n }\n if (Array.isArray(value)) {\n value = t.arrayExpression(value);\n }\n if (typeof value === 'object' && value !== null && !t.isNode(value)) {\n value = createProps(value);\n }\n if (typeof value === 'string') {\n value = t.stringLiteral(value);\n }\n if (typeof value === 'number') {\n value = t.numericLiteral(value);\n }\n if (typeof value === 'boolean') {\n value = t.booleanLiteral(value);\n }\n if (value === undefined) {\n value = t.tsUndefinedKeyword();\n }\n if (value === null) {\n value = t.nullLiteral();\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 return t.objectExpression(result);\n}\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 = isComponentName(tagName);\n const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);\n const isSvg = svgTags.includes(tagName) && result.index === 1;\n const { props, hasExpression } = getAttrProps(path);\n\n if (tagIsComponent) {\n handleComponentElement(path, result, isRoot, props);\n } else {\n handleHTMLElement(path, result, tagName, isSelfClose, isSvg, props, hasExpression);\n }\n } else {\n result.index--;\n transformChildren(path, result);\n }\n}\n\nfunction handleComponentElement(\n path: NodePath<JSXElement>,\n result: Result,\n isRoot: boolean,\n props: Record<string, any>,\n): void {\n if (isRoot) {\n result.props = props;\n const children = getChildren(path);\n if (children.length > 0) {\n const childrenGenerator =\n children.length === 1 ? children[0] : t.arrayExpression(children as JSXElement[]);\n\n // Check if children is a conditional expression\n if (t.isConditionalExpression(childrenGenerator)) {\n result.props.children = t.arrowFunctionExpression([], childrenGenerator);\n } else {\n result.props.children = childrenGenerator;\n }\n }\n } else {\n transformJSX(path);\n replaceChild(path.node, result);\n }\n}\n\nfunction handleHTMLElement(\n path: NodePath<JSXElement>,\n result: Result,\n tagName: string,\n isSelfClose: boolean,\n isSvg: boolean,\n props: Record<string, any>,\n hasExpression: boolean,\n): void {\n if (isSvg) {\n result.template = isSSG ? [`<svg _svg_ data-hk=\"${result.index}\">`] : `<svg _svg_ >`;\n }\n\n addToTemplate(result, `<${tagName}${isSSG ? ` data-hk=\"${result.index}\"` : ''}`, true);\n handleAttributes(props, result);\n addToTemplate(result, isSelfClose ? '/>' : '>', !hasExpression);\n\n if (!isSelfClose) {\n transformChildren(path, result);\n if (hasSiblingElement(path) || isSSG) {\n addToTemplate(result, `</${tagName}>`);\n }\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 addToTemplate(result, `${expression.node.value}`, true);\n } else if (expression.isExpression()) {\n replaceChild(expression.node, result);\n } else if (t.isJSXEmptyExpression(expression.node)) {\n // it is empty expression\n // just for tracking value\n } else {\n throw new Error('Unsupported child type');\n }\n } else if (child.isJSXText()) {\n addToTemplate(result, replaceSpace(child.node), true);\n } else {\n throw new Error('Unsupported child type');\n }\n}\nfunction getNodeText(path: NodePath<JSXChild>): string {\n if (path.isJSXText()) {\n return replaceSpace(path.node);\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}\n\nfunction isStyleClassName(name: string): name is 'style' | 'class' {\n return name === 'class' || name === 'style';\n}\n\nfunction handleAttributes(props: Record<string, any>, result: Result): void {\n let klass = '';\n let style = '';\n\n for (const [prop, value] of Object.entries(props)) {\n if (prop === 'class' && typeof value === 'string') {\n klass += ` ${value}`;\n delete props[prop];\n } else if (prop === 'style' && typeof value === 'string') {\n style += `${value}${value.at(-1) === ';' ? '' : ';'}`;\n delete props[prop];\n } else if (value === true) {\n addToTemplate(result, ` ${prop}`);\n delete props[prop];\n } else if (value === false) {\n delete props[prop];\n } else if (typeof value === 'string' || typeof value === 'number') {\n addToTemplate(result, ` ${prop}=\"${value}\"`);\n delete props[prop];\n } else if (t.isConditionalExpression(value)) {\n props[prop] = t.arrowFunctionExpression([], value);\n } else if (t.isObjectExpression(value)) {\n const val = handleObjectExpression(prop, value, props, isStyleClassName(prop));\n if (val) {\n if (prop === 'class') {\n klass += ` ${val}`;\n }\n if (prop === 'style') {\n style += `${val}${val.at(-1) === ';' ? '' : ';'}`;\n }\n }\n }\n }\n\n if (Object.keys(props).length > 0) {\n result.props[result.index] = props;\n }\n\n if (klass.trim()) {\n addToTemplate(result, ` class=\"${klass.trim()}\"`);\n }\n if (style.trim()) {\n addToTemplate(result, ` style=\"${style.trim()}\"`);\n }\n}\n\nfunction handleObjectExpression(\n prop: string,\n value: t.ObjectExpression,\n props: Record<string, any>,\n isCt = false,\n): string {\n let ct = '';\n const hasConditional = value.properties.some(\n property => t.isObjectProperty(property) && t.isConditionalExpression(property.value),\n );\n\n if (hasConditional) {\n props[prop] = t.arrowFunctionExpression([], value);\n } else if (isCt) {\n value.properties.forEach(property => {\n if (t.isObjectProperty(property)) {\n ct += `${(property.key as Identifier).name || (property.key as StringLiteral).value}:${(property.value as StringLiteral).value};`;\n }\n });\n\n delete props[prop];\n }\n return ct;\n}\n\nfunction replaceChild(node: t.Expression, result: Result): void {\n if (result.isLastChild) {\n result.index--;\n } else {\n addToTemplate(result, '<!>');\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 transformJSX(child);\n } else if (child.isJSXExpressionContainer()) {\n child.replaceWith(child.get('expression'));\n } else if (child.isJSXText()) {\n child.replaceWith(t.stringLiteral(replaceSpace(child.node)));\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}\n\nexport function 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 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 transformJSX(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[bindName] = t.memberExpression(\n // t.identifier((expression.node as Identifier).name),\n // t.identifier('value'),\n // );\n props[`update${capitalize(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 transformJSX(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 return {\n props,\n hasExpression,\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): val is Promise<any> {\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}\n\nexport function isSet(val: any): val is Set<any> {\n return _toString.call(val) === '[object Set]';\n}\nexport function isWeakMap(val: any): val is WeakMap<any, any> {\n return _toString.call(val) === '[object WeakMap]';\n}\nexport function isWeakSet(val: any): val is WeakSet<any> {\n return _toString.call(val) === '[object WeakSet]';\n}\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;\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\nexport function isHTMLElement(obj) {\n if (!obj) return false;\n return obj && typeof obj === 'object' && obj.nodeType === 1 && typeof obj.nodeName === 'string';\n}\n\nexport const isPlainObject = (val: unknown): val is object =>\n _toString.call(val) === '[object Object]';\n\nexport type StringNumber = `${number}`;\nexport function isStringNumber(val: unknown): val is StringNumber {\n if (!isString(val)) {\n return false;\n }\n return !Number.isNaN(Number(val));\n}\n","import { isArray, isFunction, isString } 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 isArray(data) ? (data.flat() as T[]) : [data];\n}\nexport const hasChanged = (value, oldValue) =>\n value !== oldValue && (value === value || oldValue === oldValue);\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 if (!isString(str)) {\n return false;\n }\n return str.indexOf(searchString) === 0;\n}\n\n/**\n * Escapes special HTML characters in a string.\n * @param str - The string to escape.\n * @returns The escaped string.\n */\nexport function escape(str: string): string {\n return str.replaceAll(/[\"&'<>]/g, char => {\n switch (char) {\n case '&':\n return '&';\n case '<':\n return '<';\n case '>':\n return '>';\n case '\"':\n return '"';\n case \"'\":\n return ''';\n default:\n return char;\n }\n });\n}\n\nexport type ExcludeType = ((key: string | symbol) => boolean) | (string | symbol)[];\n\n/**\n * Checks if a key should be excluded based on the provided exclude criteria.\n * @param key - The key to check.\n * @param exclude - The exclusion criteria.\n * @returns True if the key should be excluded, otherwise false.\n */\nexport function isExclude(key: string | symbol, exclude?: ExcludeType): boolean {\n return isArray(exclude) ? exclude.includes(key) : isFunction(exclude) ? exclude(key) : false;\n}\n\n/**\n * Generates a unique random 8 character string ID.\n * The generated IDs only contain alphanumeric characters.\n * @returns A unique random 8 character string ID.\n */\nexport function generateUniqueId() {\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n const charactersLength = characters.length;\n for (let i = 0; i < 8; i++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n }\n return result;\n}\n\n/**\n * Checks if the current environment is a browser.\n * @returns True if the current environment is a browser, otherwise false.\n */\nexport function isBrowser() {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\nexport const cacheStringFunction = <T extends (str: string) => string>(fn: T): T => {\n const cache: Record<string, string> = Object.create(null);\n return ((str: string) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n }) as T;\n};\n","import { cacheStringFunction } from './comm';\n\nconst hyphenateRE = /\\B([A-Z])/g;\nexport const kebabCase: (str: string) => string = cacheStringFunction((str: string) =>\n str.replaceAll(hyphenateRE, '-$1').toLowerCase(),\n);\n\nconst camelizeRE = /-(\\w)/g;\nexport const camelCase: (str: string) => string = cacheStringFunction((str: string): string => {\n return str.replaceAll(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));\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 capitalize: <T extends string>(str: T) => Capitalize<T> = cacheStringFunction(\n <T extends string>(str: T) => {\n return (str.charAt(0).toUpperCase() + str.slice(1)) as Capitalize<T>;\n },\n);\n","export function warn(msg: string, ..._args: any[]): void;\nexport function warn(msg: string, ...args): void {\n // eslint-disable-next-line prefer-spread\n console.warn.apply(console, [`[Essor warn]: ${msg}`].concat(args) as [string, ...any[]]);\n}\n\nexport function info(msg: string, ..._args: any[]): void;\nexport function info(msg: string, ...args): void {\n // eslint-disable-next-line prefer-spread, no-console\n console.info.apply(console, [`[Essor info]: ${msg}`].concat(args) as [string, ...any[]]);\n}\n\nexport function error(msg: string, ..._args: any[]): void;\nexport function error(msg: string, ...args): void {\n // eslint-disable-next-line prefer-spread\n console.error.apply(console, [`[Essor error]: ${msg}`].concat(args) as [string, ...any[]]);\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport type { Options, State } from './types';\nexport const imports = new Set<string>();\n\nconst defaultOption: Options = {\n ssg: false,\n symbol: '$',\n props: true,\n};\n\nexport const transformProgram = {\n enter(path: NodePath<t.Program>, state) {\n imports.clear();\n\n // merge options\n state.opts = { ...defaultOption, ...state.opts };\n\n path.state = {\n h: path.scope.generateUidIdentifier('h$'),\n template: path.scope.generateUidIdentifier('template$'),\n ssg: path.scope.generateUidIdentifier('ssg$'),\n Fragment: path.scope.generateUidIdentifier('fragment$'),\n\n signal: path.scope.generateUidIdentifier('signal$'),\n computed: path.scope.generateUidIdentifier('computed$'),\n reactive: path.scope.generateUidIdentifier('reactive$'),\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","import { type NodePath, types as t } from '@babel/core';\nimport { startsWith } from '@estjs/shared';\nimport type { State } from './types';\n\nexport type JSXElement = t.JSXElement | t.JSXFragment;\n\nexport type JSXChild =\n | t.JSXElement\n | t.JSXFragment\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXText;\n\n/**\n * Checks if the given Babel path has a sibling element.\n *\n * @param {NodePath} path - The Babel path to check.\n * @return {boolean} True if the path has a sibling element, false otherwise.\n */\nexport function hasSiblingElement(path) {\n // Get all siblings (both previous and next)\n const siblings = path.getAllPrevSiblings().concat(path.getAllNextSiblings());\n\n // Check for non-self-closing sibling elements or JSXExpressionContainer\n const hasSibling = siblings.some(\n siblingPath => siblingPath.isJSXElement() || siblingPath.isJSXExpressionContainer(),\n );\n\n return hasSibling;\n}\n/**\n * Retrieves the name of a JSX attribute.\n *\n * @param {t.JSXAttribute} attribute - The JSX attribute to retrieve the name from.\n * @return {string} The name of the attribute.\n * @throws {Error} If the attribute type is unsupported.\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/**\n * Retrieves the tag name of a JSX element.\n *\n * @param {t.JSXElement} node - The JSX element.\n * @return {string} The tag name of the JSX element.\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\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-z]/i.test(tagName[0])\n );\n}\n\n/**\n * Determines if the given path represents a text child node in a JSX expression.\n *\n * @param {NodePath<JSXChild>} path - The path to the potential text child node.\n * @return {boolean} True if the path represents a text child node, false otherwise.\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\n/**\n * Sets the text content of a JSX node.\n *\n * @param {NodePath<JSXChild>} path - The path to the JSX node.\n * @param {string} text - The text to set.\n * @return {void}\n */\nexport function 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\n/**\n * get the symbol start with\n */\nexport function isSymbolStart(path: NodePath<any>, name: string) {\n const state: State = path.state;\n const { symbol } = state?.opts || '$';\n\n return startsWith(name, symbol);\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 { isSymbolStart } from '../shared';\nimport type { Identifier, VariableDeclarator } from '@babel/types';\nimport type { NodePath } from '@babel/core';\n\n/**\n * Replaces the symbol in a variable declarator with a computed or signal expression.\n *\n * case 1: let $a = 1 => let $a = signal(1);\n * case 2: const $a = ()=>{return $a} => const $a = computed(()=>{return $a})\n *\n * @param {NodePath<VariableDeclarator>} path - The path to the variable declarator node.\n * @return {void}\n */\nexport function replaceSymbol(path: NodePath<VariableDeclarator>) {\n const { init, id } = path.node;\n const variableName = (id as Identifier).name;\n\n if (t.isObjectPattern(id) || t.isArrayPattern(id) || !isSymbolStart(path, variableName)) return;\n\n const isComputed =\n init &&\n (t.isFunctionExpression(init) || t.isArrowFunctionExpression(init)) &&\n (path.parent as t.VariableDeclaration).kind === 'const';\n\n const hookName = isComputed ? 'computed' : 'signal';\n const newInit = t.callExpression(t.identifier(path.state[hookName].name), init ? [init] : []);\n\n imports.add(hookName);\n path.node.init = newInit;\n}\n\nexport function symbolIdentifier(path) {\n const parentPath = path.parentPath;\n if (!shouldProcessIdentifier(parentPath)) return;\n\n const { node } = path;\n if (!isSymbolStart(path, node.name)) return;\n\n if (!path.findParent(p => p.isMemberExpression() && p.node.property.name === 'value')) {\n path.replaceWith(t.memberExpression(t.identifier(node.name), t.identifier('value')));\n }\n}\n\nfunction shouldProcessIdentifier(parentPath) {\n return (\n parentPath &&\n !t.isVariableDeclarator(parentPath) &&\n !t.isImportSpecifier(parentPath) &&\n !t.isObjectProperty(parentPath) &&\n !t.isArrayPattern(parentPath) &&\n !t.isObjectPattern(parentPath)\n );\n}\n\nexport function symbolObjectPattern(path) {\n path.node.properties.forEach(property => {\n if (\n t.isObjectProperty(property) &&\n t.isIdentifier(property.key) &&\n isSymbolStart(path, property.key.name)\n ) {\n property.key = t.identifier(property.key.name);\n }\n });\n}\n\nexport function symbolArrayPattern(path) {\n path.node.elements.forEach(element => {\n if (t.isIdentifier(element) && element.name.startsWith('$')) {\n element.name = t.identifier(element.name).name;\n } else if (t.isObjectPattern(element)) {\n symbolObjectPattern({ node: element } as NodePath);\n }\n });\n}\n","import { types as t } from '@babel/core';\nimport { startsWith } from '@estjs/shared';\n\n/**\n * Replaces import declarations\n *\n * case1: import { $a } from 'a';console.log(a) => import { $a } from 'a';console.log($a.value)\n * case2: import $a from 'a';console.log(a) => import $a from 'a';console.log($a.value)\n *\n * @param {object} path - The path to replace import declarations.\n * @return {void}\n */\nexport function replaceImportDeclaration(path) {\n path.node.specifiers.forEach(specifier => {\n const variableName = specifier.local.name;\n if (startsWith(variableName, '$') && !isVariableUsedAsObject(path, variableName)) {\n path.scope.rename(variableName, `${variableName}.value`);\n specifier.local.name = variableName;\n }\n });\n}\n\n/**\n * Checks if a variable is used as an object.\n *\n * @param path - The path to the variable.\n * @param variableName - The name of the variable.\n * @returns {boolean} - Whether the variable is used as an object.\n */\nfunction isVariableUsedAsObject(path, variableName) {\n const binding = path.scope.getBinding(variableName);\n return (\n binding?.referencePaths?.some(referencePath => {\n if (t.isMemberExpression(referencePath.parent)) {\n const { object, property } = referencePath.parent;\n if (t.isIdentifier(object, { name: variableName })) {\n referencePath.parentPath.replaceWith(\n t.memberExpression(t.memberExpression(object, t.identifier('value')), property),\n );\n return true;\n }\n }\n return false;\n }) || false\n );\n}\n","import { startsWith } from '@estjs/shared';\nimport { type NodePath, types as t } from '@babel/core';\nimport { imports } from '../program';\nimport type { State } from '../types';\nimport type {\n ArrowFunctionExpression,\n FunctionDeclaration,\n Identifier,\n ObjectProperty,\n RestElement,\n} from '@babel/types';\n\n/**\n * Replaces the properties of a function's first parameter with new names.\n *\n * auto replace pattern to props object\n *\n * rule1: function argument\n * rule2: first argument is object and it pattern\n * rule3: function has return\n *\n * transform case\n * case1 ({a, b}) => <div>{a.value}</div> to=> (_props)=><div>{_props.a.value}</div>\n * case2 ({a, b, ...rest}) => <div>{a.value}{rest}</div> to=> (_props)=> {const restProps = reactive(props,[a,b]);return <div>{_props.a.value}{reset}</div>}\n *\n * not transform case\n * case1 ([a,b])=> <div>{a.value}</div>\n * case2 ({a.,b}) ={}\n *\n * @param {NodePath<FunctionDeclaration | ArrowFunctionExpression>} path - The path to the function node.\n * @return {void}\n */\nexport function replaceProps(path: NodePath<FunctionDeclaration | ArrowFunctionExpression>) {\n const state: State = path.state;\n const firstParam = path.node.params[0];\n\n if (!firstParam || !t.isObjectPattern(firstParam)) return;\n\n const returnStatement = path\n .get('body')\n .get('body')\n .find(statement => statement.isReturnStatement());\n\n if (!returnStatement || !t.isJSXElement((returnStatement.node as any)?.argument)) return;\n\n const replaceProperties = (properties: (ObjectProperty | RestElement)[], parentPath: string) => {\n properties.forEach(property => {\n if (t.isObjectProperty(property) && t.isIdentifier(property.key)) {\n const keyName = property.key.name;\n if (t.isIdentifier(property.value)) {\n path.scope.rename(property.value.name, `${parentPath}${keyName}`);\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 const notRestProperties = properties.filter(\n property => !t.isRestElement(property),\n ) as ObjectProperty[];\n replaceProperties(notRestProperties, '__props.');\n\n const notRestNames = notRestProperties.map(property => (property.key as Identifier).name);\n if (__DEV__ && notRestNames.some(name => startsWith(name, '$'))) {\n console.warn('props name can not start with $');\n return;\n }\n\n handleRestElement(path, state, properties, notRestNames);\n}\n\nfunction handleRestElement(path, state: State, properties, notRestNames) {\n const restElement = properties.find(property => t.isRestElement(property)) as\n | RestElement\n | undefined;\n path.node.params[0] = t.identifier('__props');\n\n if (restElement) {\n const restName = (restElement.argument as Identifier).name;\n if (notRestNames.length === 0) {\n path.node.params[0] = t.identifier(restName);\n } else {\n const restVariableDeclaration = createRestVariableDeclaration(state, restName, notRestNames);\n imports.add('reactive');\n (path.node.body as t.BlockStatement).body.unshift(restVariableDeclaration);\n }\n }\n}\n\nfunction createRestVariableDeclaration(state: State, restName: string, notRestNames: string[]) {\n return t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(restName),\n t.callExpression(state.reactive, [\n t.identifier('__props'),\n t.arrayExpression(notRestNames.map(name => t.stringLiteral(name))),\n ]),\n ),\n ]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA2B;;;ACQpB,IAAM,UAAU,MAAM;AAEtB,SAAS,SAAS,KAA6B;AACpD,SAAO,OAAO,QAAQ;AACxB;ACCO,IAAM,OAAO,SAAS;AAWtB,SAAS,WAAW,KAAK,cAAc;AAC5C,MAAI,CAAC,SAAS,GAAG,GAAG;AAClB,WAAO;EACT;AACA,SAAO,IAAI,QAAQ,YAAY,MAAM;AACvC;AA6DO,IAAM,sBAAsB,CAAoC,OAAa;AAClF,QAAM,QAAgC,uBAAO,OAAO,IAAI;AACxD,SAAQ,CAAC,QAAgB;AACvB,UAAM,MAAM,MAAM,GAAG;AACrB,WAAO,QAAQ,MAAM,GAAG,IAAI,GAAG,GAAG;EACpC;AACF;AC9FA,IAAM,cAAc;AACb,IAAM,YAAqC;EAAoB,CAAC,QACrE,IAAI,WAAW,aAAa,KAAK,EAAE,YAAY;AACjD;AAEA,IAAM,aAAa;AACZ,IAAM,YAAqC,oBAAoB,CAAC,QAAwB;AAC7F,SAAO,IAAI,WAAW,YAAY,CAAC,GAAG,MAAO,IAAI,EAAE,Y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,WAAY,YAAY,SAAwB;AACtD,QAAI,aAAa,WAAW,GAAG;AAC7B,WAAK,KAAK,OAAO,CAAC,IAAI,aAAAA,MAAE,WAAW,QAAQ;AAAA,IAC7C,OAAO;AACL,YAAM,0BAA0B,8BAA8B,OAAO,UAAU,YAAY;AAC3F,cAAQ,IAAI,UAAU;AACtB,MAAC,KAAK,KAAK,KAA0B,KAAK,QAAQ,uBAAuB;AAAA,IAC3E;AAAA,EACF;AACF;AAEA,SAAS,8BAA8B,OAAc,UAAkB,cAAwB;AAC7F,SAAO,aAAAA,MAAE,oBAAoB,SAAS;AAAA,IACpC,aAAAA,MAAE;AAAA,MACA,aAAAA,MAAE,WAAW,QAAQ;AAAA,MACrB,aAAAA,MAAE,eAAe,MAAM,UAAU;AAAA,QAC/B,aAAAA,MAAE,WAAW,SAAS;AAAA,QACtB,aAAAA,MAAE,gBAAgB,aAAa,IAAI,UAAQ,aAAAA,MAAE,cAAc,IAAI,CAAC,CAAC;AAAA,MACnE,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;;;AXzFe,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,MAET,qBAAqB;AAAA,MACrB,yBAAyB;AAAA,MACzB,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,MACnB,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,cAAc;AAAA,MAEd,YAAY;AAAA,MACZ,aAAa;AAAA,IACf;AAAA,EACF;AACF;","names":["import_core","t","import_core","t","isComponent","t","value","import_core","t","import_core","t","import_core","t","properties"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -5,9 +5,9 @@ interface State {
|
|
|
5
5
|
template: types.Identifier;
|
|
6
6
|
ssg: types.Identifier;
|
|
7
7
|
Fragment: types.Identifier;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
signal: types.Identifier;
|
|
9
|
+
computed: types.Identifier;
|
|
10
|
+
reactive: types.Identifier;
|
|
11
11
|
tmplDeclaration: types.VariableDeclaration;
|
|
12
12
|
opts: Options;
|
|
13
13
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ interface State {
|
|
|
5
5
|
template: types.Identifier;
|
|
6
6
|
ssg: types.Identifier;
|
|
7
7
|
Fragment: types.Identifier;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
signal: types.Identifier;
|
|
9
|
+
computed: types.Identifier;
|
|
10
|
+
reactive: types.Identifier;
|
|
11
11
|
tmplDeclaration: types.VariableDeclaration;
|
|
12
12
|
opts: Options;
|
|
13
13
|
}
|
package/dist/index.js
CHANGED
|
@@ -68,9 +68,9 @@ var transformProgram = {
|
|
|
68
68
|
template: path.scope.generateUidIdentifier("template$"),
|
|
69
69
|
ssg: path.scope.generateUidIdentifier("ssg$"),
|
|
70
70
|
Fragment: path.scope.generateUidIdentifier("fragment$"),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
signal: path.scope.generateUidIdentifier("signal$"),
|
|
72
|
+
computed: path.scope.generateUidIdentifier("computed$"),
|
|
73
|
+
reactive: path.scope.generateUidIdentifier("reactive$"),
|
|
74
74
|
tmplDeclaration: t.variableDeclaration("const", []),
|
|
75
75
|
opts: state.opts
|
|
76
76
|
};
|
|
@@ -231,6 +231,7 @@ function replaceSpace(node) {
|
|
|
231
231
|
return node.value.replaceAll(/\s+/g, " ").trim();
|
|
232
232
|
}
|
|
233
233
|
function createEssorNode(path, result) {
|
|
234
|
+
var _a, _b;
|
|
234
235
|
const state = path.state;
|
|
235
236
|
const isJSXFragment = path.isJSXFragment();
|
|
236
237
|
const isComponent2 = path.isJSXElement() && isComponent(getTagName(path.node));
|
|
@@ -243,8 +244,7 @@ function createEssorNode(path, result) {
|
|
|
243
244
|
imports.add("template");
|
|
244
245
|
}
|
|
245
246
|
}
|
|
246
|
-
const key = result.props.key;
|
|
247
|
-
delete result.props.key;
|
|
247
|
+
const key = (_b = result.props.key) != null ? _b : (_a = result.props[0]) == null ? void 0 : _a.key;
|
|
248
248
|
const propsArg = createProps(result.props);
|
|
249
249
|
const args = isComponent2 && getTagName(path.node) === "Fragment" ? [t3.stringLiteral(""), propsArg] : [tmpl, propsArg];
|
|
250
250
|
if (key) {
|
|
@@ -255,32 +255,39 @@ function createEssorNode(path, result) {
|
|
|
255
255
|
return t3.callExpression(state[fnName], args);
|
|
256
256
|
}
|
|
257
257
|
function createProps(props) {
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
|
|
258
|
+
const result = [];
|
|
259
|
+
for (const prop in props) {
|
|
260
|
+
let value = props[prop];
|
|
261
|
+
if (prop === "key") {
|
|
262
|
+
continue;
|
|
261
263
|
}
|
|
262
|
-
if (
|
|
263
|
-
|
|
264
|
+
if (Array.isArray(value)) {
|
|
265
|
+
value = t3.arrayExpression(value);
|
|
264
266
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
return t3.stringLiteral(value);
|
|
268
|
-
case "number":
|
|
269
|
-
return t3.numericLiteral(value);
|
|
270
|
-
case "boolean":
|
|
271
|
-
return t3.booleanLiteral(value);
|
|
272
|
-
case "undefined":
|
|
273
|
-
case void 0:
|
|
274
|
-
return t3.tsUndefinedKeyword();
|
|
275
|
-
case null:
|
|
276
|
-
return t3.nullLiteral();
|
|
277
|
-
default:
|
|
278
|
-
return value;
|
|
267
|
+
if (typeof value === "object" && value !== null && !t3.isNode(value)) {
|
|
268
|
+
value = createProps(value);
|
|
279
269
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
270
|
+
if (typeof value === "string") {
|
|
271
|
+
value = t3.stringLiteral(value);
|
|
272
|
+
}
|
|
273
|
+
if (typeof value === "number") {
|
|
274
|
+
value = t3.numericLiteral(value);
|
|
275
|
+
}
|
|
276
|
+
if (typeof value === "boolean") {
|
|
277
|
+
value = t3.booleanLiteral(value);
|
|
278
|
+
}
|
|
279
|
+
if (value === void 0) {
|
|
280
|
+
value = t3.tsUndefinedKeyword();
|
|
281
|
+
}
|
|
282
|
+
if (value === null) {
|
|
283
|
+
value = t3.nullLiteral();
|
|
284
|
+
}
|
|
285
|
+
if (prop === "_$spread$") {
|
|
286
|
+
result.push(t3.spreadElement(value));
|
|
287
|
+
} else {
|
|
288
|
+
result.push(t3.objectProperty(t3.stringLiteral(prop), value));
|
|
289
|
+
}
|
|
290
|
+
}
|
|
284
291
|
return t3.objectExpression(result);
|
|
285
292
|
}
|
|
286
293
|
function transformJSXElement(path, result, isRoot = false) {
|
|
@@ -290,10 +297,6 @@ function transformJSXElement(path, result, isRoot = false) {
|
|
|
290
297
|
const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);
|
|
291
298
|
const isSvg = svgTags.includes(tagName) && result.index === 1;
|
|
292
299
|
const { props, hasExpression } = getAttrProps(path);
|
|
293
|
-
if (props.key) {
|
|
294
|
-
result.props.key = props.key;
|
|
295
|
-
delete props.key;
|
|
296
|
-
}
|
|
297
300
|
if (tagIsComponent) {
|
|
298
301
|
handleComponentElement(path, result, isRoot, props);
|
|
299
302
|
} else {
|
|
@@ -550,7 +553,7 @@ function replaceSymbol(path) {
|
|
|
550
553
|
const variableName = id.name;
|
|
551
554
|
if (t4.isObjectPattern(id) || t4.isArrayPattern(id) || !isSymbolStart(path, variableName)) return;
|
|
552
555
|
const isComputed = init && (t4.isFunctionExpression(init) || t4.isArrowFunctionExpression(init)) && path.parent.kind === "const";
|
|
553
|
-
const hookName = isComputed ? "
|
|
556
|
+
const hookName = isComputed ? "computed" : "signal";
|
|
554
557
|
const newInit = t4.callExpression(t4.identifier(path.state[hookName].name), init ? [init] : []);
|
|
555
558
|
imports.add(hookName);
|
|
556
559
|
path.node.init = newInit;
|
|
@@ -634,7 +637,9 @@ function replaceProps(path) {
|
|
|
634
637
|
});
|
|
635
638
|
};
|
|
636
639
|
const properties = firstParam.properties;
|
|
637
|
-
const notRestProperties = properties.filter(
|
|
640
|
+
const notRestProperties = properties.filter(
|
|
641
|
+
(property) => !t6.isRestElement(property)
|
|
642
|
+
);
|
|
638
643
|
replaceProperties(notRestProperties, "__props.");
|
|
639
644
|
const notRestNames = notRestProperties.map((property) => property.key.name);
|
|
640
645
|
if (notRestNames.some((name) => startsWith(name, "$"))) {
|
|
@@ -652,7 +657,7 @@ function handleRestElement(path, state, properties, notRestNames) {
|
|
|
652
657
|
path.node.params[0] = t6.identifier(restName);
|
|
653
658
|
} else {
|
|
654
659
|
const restVariableDeclaration = createRestVariableDeclaration(state, restName, notRestNames);
|
|
655
|
-
imports.add("
|
|
660
|
+
imports.add("reactive");
|
|
656
661
|
path.node.body.body.unshift(restVariableDeclaration);
|
|
657
662
|
}
|
|
658
663
|
}
|
|
@@ -661,7 +666,7 @@ function createRestVariableDeclaration(state, restName, notRestNames) {
|
|
|
661
666
|
return t6.variableDeclaration("const", [
|
|
662
667
|
t6.variableDeclarator(
|
|
663
668
|
t6.identifier(restName),
|
|
664
|
-
t6.callExpression(state.
|
|
669
|
+
t6.callExpression(state.reactive, [
|
|
665
670
|
t6.identifier("__props"),
|
|
666
671
|
t6.arrayExpression(notRestNames.map((name) => t6.stringLiteral(name)))
|
|
667
672
|
])
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/jsx/index.ts","../../shared/src/is.ts","../../shared/src/comm.ts","../../shared/src/name.ts","../../shared/src/console.ts","../src/program.ts","../src/shared.ts","../src/jsx/constants.ts","../src/signal/symbol.ts","../src/signal/import.ts","../src/signal/props.ts","../src/index.ts"],"sourcesContent":["import { types as t } from '@babel/core';\nimport { capitalize, isArray } from '@estjs/shared';\nimport { imports } from '../program';\nimport {\n type JSXChild,\n type JSXElement,\n getAttrName,\n getTagName,\n hasSiblingElement,\n isComponent as isComponentName,\n isTextChild,\n setNodeText,\n} from '../shared';\nimport { selfClosingTags, svgTags } from './constants';\nimport type { Identifier, OptionalMemberExpression, StringLiteral } from '@babel/types';\nimport type { State } from '../types';\nimport type { NodePath } from '@babel/core';\n\nexport interface Result {\n index: number;\n isLastChild: boolean;\n parentIndex: number;\n props: Record<string, any>;\n template: string | string[];\n}\n\nlet isSSG = false;\n\nfunction addToTemplate(result: Result, content: string, join = false): void {\n if (isSSG) {\n if (join && result.template.length > 0) {\n (result.template as string[])[result.template.length - 1] += content;\n } else {\n (result.template as string[]).push(content);\n }\n } else {\n result.template += content;\n }\n}\n\nexport function transformJSX(path: NodePath<JSXElement>): void {\n const state: State = path.state;\n isSSG = state.opts.ssg;\n\n const result: Result = {\n index: 1,\n isLastChild: false,\n parentIndex: 0,\n props: {},\n template: isSSG ? [] : '',\n };\n transformJSXElement(path, result, true);\n\n path.replaceWith(createEssorNode(path, result));\n}\n// Trim and replace multiple spaces/newlines with a single space\nfunction replaceSpace(node: t.JSXText): string {\n return node.value.replaceAll(/\\s+/g, ' ').trim();\n}\n\n/**\n * Creates an expression node for a JSX element or fragment.\n * @param path - The path to the JSX element.\n * @param result - The result containing template and props.\n * @returns A CallExpression representing the JSX element or fragment.\n */\nfunction createEssorNode(path: NodePath<JSXElement>, result: Result): t.CallExpression {\n const state: State = path.state;\n const isJSXFragment = path.isJSXFragment();\n const isComponent = path.isJSXElement() && isComponentName(getTagName(path.node));\n\n const tmpl = isComponent\n ? t.identifier(getTagName(path.node))\n : path.scope.generateUidIdentifier('_tmpl$');\n\n let templateNode;\n if (!isComponent) {\n templateNode = isSSG\n ? t.arrayExpression((result.template as string[]).map(t.stringLiteral))\n : t.callExpression(state.template, [t.stringLiteral(result.template as string)]);\n\n state.tmplDeclaration.declarations.push(t.variableDeclarator(tmpl, templateNode));\n if (!isSSG) {\n imports.add('template');\n }\n }\n\n const key = result.props.key;\n delete result.props.key;\n\n const propsArg = createProps(result.props);\n const args =\n isComponent && getTagName(path.node) === 'Fragment'\n ? [t.stringLiteral(''), propsArg]\n : [tmpl, propsArg];\n\n if (key) {\n args.push(key);\n }\n\n const fnName = isSSG\n ? 'ssg'\n : isJSXFragment || (isComponent && getTagName(path.node) === 'Fragment')\n ? 'Fragment'\n : 'h';\n imports.add(fnName);\n\n return t.callExpression(state[fnName], args);\n}\n\nfunction createProps(props: Record<string, any>): t.ObjectExpression {\n const toAstNode = value => {\n if (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 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.entries(props).map(([prop, value]) =>\n prop === '_$spread$'\n ? t.spreadElement(toAstNode(value))\n : t.objectProperty(t.stringLiteral(prop), toAstNode(value)),\n );\n\n return t.objectExpression(result);\n}\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 = isComponentName(tagName);\n const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);\n const isSvg = svgTags.includes(tagName) && result.index === 1;\n const { props, hasExpression } = getAttrProps(path);\n\n // key\n if (props.key) {\n result.props.key = props.key;\n delete props.key;\n }\n\n if (tagIsComponent) {\n handleComponentElement(path, result, isRoot, props);\n } else {\n handleHTMLElement(path, result, tagName, isSelfClose, isSvg, props, hasExpression);\n }\n } else {\n result.index--;\n transformChildren(path, result);\n }\n}\n\nfunction handleComponentElement(\n path: NodePath<JSXElement>,\n result: Result,\n isRoot: boolean,\n props: Record<string, any>,\n): void {\n if (isRoot) {\n result.props = props;\n const children = getChildren(path);\n if (children.length > 0) {\n const childrenGenerator =\n children.length === 1 ? children[0] : t.arrayExpression(children as JSXElement[]);\n\n // Check if children is a conditional expression\n if (t.isConditionalExpression(childrenGenerator)) {\n result.props.children = t.arrowFunctionExpression([], childrenGenerator);\n } else {\n result.props.children = childrenGenerator;\n }\n }\n } else {\n transformJSX(path);\n replaceChild(path.node, result);\n }\n}\n\nfunction handleHTMLElement(\n path: NodePath<JSXElement>,\n result: Result,\n tagName: string,\n isSelfClose: boolean,\n isSvg: boolean,\n props: Record<string, any>,\n hasExpression: boolean,\n): void {\n if (isSvg) {\n result.template = isSSG ? [`<svg _svg_ data-hk=\"${result.index}\">`] : `<svg _svg_ >`;\n }\n\n addToTemplate(result, `<${tagName}${isSSG ? ` data-hk=\"${result.index}\"` : ''}`, true);\n handleAttributes(props, result);\n addToTemplate(result, isSelfClose ? '/>' : '>', !hasExpression);\n\n if (!isSelfClose) {\n transformChildren(path, result);\n if (hasSiblingElement(path) || isSSG) {\n addToTemplate(result, `</${tagName}>`);\n }\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 addToTemplate(result, `${expression.node.value}`, true);\n } else if (expression.isExpression()) {\n replaceChild(expression.node, result);\n } else if (t.isJSXEmptyExpression(expression.node)) {\n // it is empty expression\n // just for tracking value\n } else {\n throw new Error('Unsupported child type');\n }\n } else if (child.isJSXText()) {\n addToTemplate(result, replaceSpace(child.node), true);\n } else {\n throw new Error('Unsupported child type');\n }\n}\nfunction getNodeText(path: NodePath<JSXChild>): string {\n if (path.isJSXText()) {\n return replaceSpace(path.node);\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}\n\nfunction isStyleClassName(name: string): name is 'style' | 'class' {\n return name === 'class' || name === 'style';\n}\n\nfunction handleAttributes(props: Record<string, any>, result: Result): void {\n let klass = '';\n let style = '';\n\n for (const [prop, value] of Object.entries(props)) {\n if (prop === 'class' && typeof value === 'string') {\n klass += ` ${value}`;\n delete props[prop];\n } else if (prop === 'style' && typeof value === 'string') {\n style += `${value}${value.at(-1) === ';' ? '' : ';'}`;\n delete props[prop];\n } else if (value === true) {\n addToTemplate(result, ` ${prop}`);\n delete props[prop];\n } else if (value === false) {\n delete props[prop];\n } else if (typeof value === 'string' || typeof value === 'number') {\n addToTemplate(result, ` ${prop}=\"${value}\"`);\n delete props[prop];\n } else if (t.isConditionalExpression(value)) {\n props[prop] = t.arrowFunctionExpression([], value);\n } else if (t.isObjectExpression(value)) {\n const val = handleObjectExpression(prop, value, props, isStyleClassName(prop));\n if (val) {\n if (prop === 'class') {\n klass += ` ${val}`;\n }\n if (prop === 'style') {\n style += `${val}${val.at(-1) === ';' ? '' : ';'}`;\n }\n }\n }\n }\n\n if (Object.keys(props).length > 0) {\n result.props[result.index] = props;\n }\n\n if (klass.trim()) {\n addToTemplate(result, ` class=\"${klass.trim()}\"`);\n }\n if (style.trim()) {\n addToTemplate(result, ` style=\"${style.trim()}\"`);\n }\n}\n\nfunction handleObjectExpression(\n prop: string,\n value: t.ObjectExpression,\n props: Record<string, any>,\n isCt = false,\n): string {\n let ct = '';\n const hasConditional = value.properties.some(\n property => t.isObjectProperty(property) && t.isConditionalExpression(property.value),\n );\n\n if (hasConditional) {\n props[prop] = t.arrowFunctionExpression([], value);\n } else if (isCt) {\n value.properties.forEach(property => {\n if (t.isObjectProperty(property)) {\n ct += `${(property.key as Identifier).name || (property.key as StringLiteral).value}:${(property.value as StringLiteral).value};`;\n }\n });\n\n delete props[prop];\n }\n return ct;\n}\n\nfunction replaceChild(node: t.Expression, result: Result): void {\n if (result.isLastChild) {\n result.index--;\n } else {\n addToTemplate(result, '<!>');\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 transformJSX(child);\n } else if (child.isJSXExpressionContainer()) {\n child.replaceWith(child.get('expression'));\n } else if (child.isJSXText()) {\n child.replaceWith(t.stringLiteral(replaceSpace(child.node)));\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}\n\nexport function 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 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 transformJSX(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[bindName] = t.memberExpression(\n // t.identifier((expression.node as Identifier).name),\n // t.identifier('value'),\n // );\n props[`update${capitalize(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 transformJSX(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 return {\n props,\n hasExpression,\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): val is Promise<any> {\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}\n\nexport function isSet(val: any): val is Set<any> {\n return _toString.call(val) === '[object Set]';\n}\nexport function isWeakMap(val: any): val is WeakMap<any, any> {\n return _toString.call(val) === '[object WeakMap]';\n}\nexport function isWeakSet(val: any): val is WeakSet<any> {\n return _toString.call(val) === '[object WeakSet]';\n}\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;\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\nexport function isHTMLElement(obj) {\n if (!obj) return false;\n return obj && typeof obj === 'object' && obj.nodeType === 1 && typeof obj.nodeName === 'string';\n}\n\nexport const isPlainObject = (val: unknown): val is object =>\n _toString.call(val) === '[object Object]';\n\nexport type StringNumber = `${number}`;\nexport function isStringNumber(val: unknown): val is StringNumber {\n if (!isString(val)) {\n return false;\n }\n return !Number.isNaN(Number(val));\n}\n","import { isArray, isFunction, isString } 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 isArray(data) ? (data.flat() as T[]) : [data];\n}\nexport const hasChanged = (value, oldValue) =>\n value !== oldValue && (value === value || oldValue === oldValue);\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 if (!isString(str)) {\n return false;\n }\n return str.indexOf(searchString) === 0;\n}\n\n/**\n * Escapes special HTML characters in a string.\n * @param str - The string to escape.\n * @returns The escaped string.\n */\nexport function escape(str: string): string {\n return str.replaceAll(/[\"&'<>]/g, char => {\n switch (char) {\n case '&':\n return '&';\n case '<':\n return '<';\n case '>':\n return '>';\n case '\"':\n return '"';\n case \"'\":\n return ''';\n default:\n return char;\n }\n });\n}\n\nexport type ExcludeType = ((key: string | symbol) => boolean) | (string | symbol)[];\n\n/**\n * Checks if a key should be excluded based on the provided exclude criteria.\n * @param key - The key to check.\n * @param exclude - The exclusion criteria.\n * @returns True if the key should be excluded, otherwise false.\n */\nexport function isExclude(key: string | symbol, exclude?: ExcludeType): boolean {\n return isArray(exclude) ? exclude.includes(key) : isFunction(exclude) ? exclude(key) : false;\n}\n\n/**\n * Generates a unique random 8 character string ID.\n * The generated IDs only contain alphanumeric characters.\n * @returns A unique random 8 character string ID.\n */\nexport function generateUniqueId() {\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n const charactersLength = characters.length;\n for (let i = 0; i < 8; i++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n }\n return result;\n}\n\n/**\n * Checks if the current environment is a browser.\n * @returns True if the current environment is a browser, otherwise false.\n */\nexport function isBrowser() {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\nexport const cacheStringFunction = <T extends (str: string) => string>(fn: T): T => {\n const cache: Record<string, string> = Object.create(null);\n return ((str: string) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n }) as T;\n};\n","import { cacheStringFunction } from './comm';\n\nconst hyphenateRE = /\\B([A-Z])/g;\nexport const kebabCase: (str: string) => string = cacheStringFunction((str: string) =>\n str.replaceAll(hyphenateRE, '-$1').toLowerCase(),\n);\n\nconst camelizeRE = /-(\\w)/g;\nexport const camelCase: (str: string) => string = cacheStringFunction((str: string): string => {\n return str.replaceAll(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));\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 capitalize: <T extends string>(str: T) => Capitalize<T> = cacheStringFunction(\n <T extends string>(str: T) => {\n return (str.charAt(0).toUpperCase() + str.slice(1)) as Capitalize<T>;\n },\n);\n","export function warn(msg: string, ..._args: any[]): void;\nexport function warn(msg: string, ...args): void {\n // eslint-disable-next-line prefer-spread\n console.warn.apply(console, [`[Essor warn]: ${msg}`].concat(args) as [string, ...any[]]);\n}\n\nexport function info(msg: string, ..._args: any[]): void;\nexport function info(msg: string, ...args): void {\n // eslint-disable-next-line prefer-spread, no-console\n console.info.apply(console, [`[Essor info]: ${msg}`].concat(args) as [string, ...any[]]);\n}\n\nexport function error(msg: string, ..._args: any[]): void;\nexport function error(msg: string, ...args): void {\n // eslint-disable-next-line prefer-spread\n console.error.apply(console, [`[Essor error]: ${msg}`].concat(args) as [string, ...any[]]);\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport type { Options, State } from './types';\nexport const imports = new Set<string>();\n\nconst defaultOption: Options = {\n ssg: false,\n symbol: '$',\n props: true,\n};\n\nexport const transformProgram = {\n enter(path: NodePath<t.Program>, state) {\n imports.clear();\n\n // merge options\n state.opts = { ...defaultOption, ...state.opts };\n\n path.state = {\n h: path.scope.generateUidIdentifier('h$'),\n template: path.scope.generateUidIdentifier('template$'),\n ssg: path.scope.generateUidIdentifier('ssg$'),\n Fragment: path.scope.generateUidIdentifier('fragment$'),\n\n useSignal: path.scope.generateUidIdentifier('signal$'),\n useComputed: path.scope.generateUidIdentifier('computed$'),\n useReactive: path.scope.generateUidIdentifier('reactive$'),\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","import { type NodePath, types as t } from '@babel/core';\nimport { startsWith } from '@estjs/shared';\nimport type { State } from './types';\n\nexport type JSXElement = t.JSXElement | t.JSXFragment;\n\nexport type JSXChild =\n | t.JSXElement\n | t.JSXFragment\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXText;\n\n/**\n * Checks if the given Babel path has a sibling element.\n *\n * @param {NodePath} path - The Babel path to check.\n * @return {boolean} True if the path has a sibling element, false otherwise.\n */\nexport function hasSiblingElement(path) {\n // Get all siblings (both previous and next)\n const siblings = path.getAllPrevSiblings().concat(path.getAllNextSiblings());\n\n // Check for non-self-closing sibling elements or JSXExpressionContainer\n const hasSibling = siblings.some(\n siblingPath => siblingPath.isJSXElement() || siblingPath.isJSXExpressionContainer(),\n );\n\n return hasSibling;\n}\n/**\n * Retrieves the name of a JSX attribute.\n *\n * @param {t.JSXAttribute} attribute - The JSX attribute to retrieve the name from.\n * @return {string} The name of the attribute.\n * @throws {Error} If the attribute type is unsupported.\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/**\n * Retrieves the tag name of a JSX element.\n *\n * @param {t.JSXElement} node - The JSX element.\n * @return {string} The tag name of the JSX element.\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\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-z]/i.test(tagName[0])\n );\n}\n\n/**\n * Determines if the given path represents a text child node in a JSX expression.\n *\n * @param {NodePath<JSXChild>} path - The path to the potential text child node.\n * @return {boolean} True if the path represents a text child node, false otherwise.\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\n/**\n * Sets the text content of a JSX node.\n *\n * @param {NodePath<JSXChild>} path - The path to the JSX node.\n * @param {string} text - The text to set.\n * @return {void}\n */\nexport function 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\n/**\n * get the symbol start with\n */\nexport function isSymbolStart(path: NodePath<any>, name: string) {\n const state: State = path.state;\n const { symbol } = state?.opts || '$';\n\n return startsWith(name, symbol);\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 { isSymbolStart } from '../shared';\nimport type { Identifier, VariableDeclarator } from '@babel/types';\nimport type { NodePath } from '@babel/core';\n\n/**\n * Replaces the symbol in a variable declarator with a computed or signal expression.\n *\n * case 1: let $a = 1 => let $a = useSignal(1);\n * case 2: const $a = ()=>{return $a} => const $a = useComputed(()=>{return $a})\n *\n * @param {NodePath<VariableDeclarator>} path - The path to the variable declarator node.\n * @return {void}\n */\nexport function replaceSymbol(path: NodePath<VariableDeclarator>) {\n const { init, id } = path.node;\n const variableName = (id as Identifier).name;\n\n if (t.isObjectPattern(id) || t.isArrayPattern(id) || !isSymbolStart(path, variableName)) return;\n\n const isComputed =\n init &&\n (t.isFunctionExpression(init) || t.isArrowFunctionExpression(init)) &&\n (path.parent as t.VariableDeclaration).kind === 'const';\n\n const hookName = isComputed ? 'useComputed' : 'useSignal';\n const newInit = t.callExpression(t.identifier(path.state[hookName].name), init ? [init] : []);\n\n imports.add(hookName);\n path.node.init = newInit;\n}\n\nexport function symbolIdentifier(path) {\n const parentPath = path.parentPath;\n if (!shouldProcessIdentifier(parentPath)) return;\n\n const { node } = path;\n if (!isSymbolStart(path, node.name)) return;\n\n if (!path.findParent(p => p.isMemberExpression() && p.node.property.name === 'value')) {\n path.replaceWith(t.memberExpression(t.identifier(node.name), t.identifier('value')));\n }\n}\n\nfunction shouldProcessIdentifier(parentPath) {\n return (\n parentPath &&\n !t.isVariableDeclarator(parentPath) &&\n !t.isImportSpecifier(parentPath) &&\n !t.isObjectProperty(parentPath) &&\n !t.isArrayPattern(parentPath) &&\n !t.isObjectPattern(parentPath)\n );\n}\n\nexport function symbolObjectPattern(path) {\n path.node.properties.forEach(property => {\n if (\n t.isObjectProperty(property) &&\n t.isIdentifier(property.key) &&\n isSymbolStart(path, property.key.name)\n ) {\n property.key = t.identifier(property.key.name);\n }\n });\n}\n\nexport function symbolArrayPattern(path) {\n path.node.elements.forEach(element => {\n if (t.isIdentifier(element) && element.name.startsWith('$')) {\n element.name = t.identifier(element.name).name;\n } else if (t.isObjectPattern(element)) {\n symbolObjectPattern({ node: element } as NodePath);\n }\n });\n}\n","import { types as t } from '@babel/core';\nimport { startsWith } from '@estjs/shared';\n\n/**\n * Replaces import declarations\n *\n * case1: import { $a } from 'a';console.log(a) => import { $a } from 'a';console.log($a.value)\n * case2: import $a from 'a';console.log(a) => import $a from 'a';console.log($a.value)\n *\n * @param {object} path - The path to replace import declarations.\n * @return {void}\n */\nexport function replaceImportDeclaration(path) {\n path.node.specifiers.forEach(specifier => {\n const variableName = specifier.local.name;\n if (startsWith(variableName, '$') && !isVariableUsedAsObject(path, variableName)) {\n path.scope.rename(variableName, `${variableName}.value`);\n specifier.local.name = variableName;\n }\n });\n}\n\n/**\n * Checks if a variable is used as an object.\n *\n * @param path - The path to the variable.\n * @param variableName - The name of the variable.\n * @returns {boolean} - Whether the variable is used as an object.\n */\nfunction isVariableUsedAsObject(path, variableName) {\n const binding = path.scope.getBinding(variableName);\n return (\n binding?.referencePaths?.some(referencePath => {\n if (t.isMemberExpression(referencePath.parent)) {\n const { object, property } = referencePath.parent;\n if (t.isIdentifier(object, { name: variableName })) {\n referencePath.parentPath.replaceWith(\n t.memberExpression(t.memberExpression(object, t.identifier('value')), property),\n );\n return true;\n }\n }\n return false;\n }) || false\n );\n}\n","import { startsWith } from '@estjs/shared';\nimport { type NodePath, types as t } from '@babel/core';\nimport { imports } from '../program';\nimport type { State } from '../types';\nimport type {\n ArrowFunctionExpression,\n FunctionDeclaration,\n Identifier,\n ObjectProperty,\n RestElement,\n} from '@babel/types';\n\n/**\n * Replaces the properties of a function's first parameter with new names.\n *\n * auto replace pattern to props object\n *\n * rule1: function argument\n * rule2: first argument is object and it pattern\n * rule3: function has return\n *\n * transform case\n * case1 ({a, b}) => <div>{a.value}</div> to=> (_props)=><div>{_props.a.value}</div>\n * case2 ({a, b, ...rest}) => <div>{a.value}{rest}</div> to=> (_props)=> {const restProps = reactive(props,[a,b]);return <div>{_props.a.value}{reset}</div>}\n *\n * not transform case\n * case1 ([a,b])=> <div>{a.value}</div>\n * case2 ({a.,b}) ={}\n *\n * @param {NodePath<FunctionDeclaration | ArrowFunctionExpression>} path - The path to the function node.\n * @return {void}\n */\nexport function replaceProps(path: NodePath<FunctionDeclaration | ArrowFunctionExpression>) {\n const state: State = path.state;\n const firstParam = path.node.params[0];\n\n if (!firstParam || !t.isObjectPattern(firstParam)) return;\n\n const returnStatement = path\n .get('body')\n .get('body')\n .find(statement => statement.isReturnStatement());\n\n if (!returnStatement || !t.isJSXElement((returnStatement.node as any)?.argument)) return;\n\n const replaceProperties = (properties: (ObjectProperty | RestElement)[], parentPath: string) => {\n properties.forEach(property => {\n if (t.isObjectProperty(property) && t.isIdentifier(property.key)) {\n const keyName = property.key.name;\n if (t.isIdentifier(property.value)) {\n path.scope.rename(property.value.name, `${parentPath}${keyName}`);\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 const notRestProperties = properties.filter(property => !t.isRestElement(property)) as ObjectProperty[];\n replaceProperties(notRestProperties, '__props.');\n\n const notRestNames = notRestProperties.map(property => (property.key as Identifier).name);\n if (__DEV__ && notRestNames.some(name => startsWith(name, '$'))) {\n console.warn('props name can not start with $');\n return;\n }\n\n handleRestElement(path, state, properties, notRestNames);\n}\n\nfunction handleRestElement(path, state: State, properties, notRestNames) {\n const restElement = properties.find(property => t.isRestElement(property)) as RestElement | undefined;\n path.node.params[0] = t.identifier('__props');\n\n if (restElement) {\n const restName = (restElement.argument as Identifier).name;\n if (notRestNames.length === 0) {\n path.node.params[0] = t.identifier(restName);\n } else {\n const restVariableDeclaration = createRestVariableDeclaration(state, restName, notRestNames);\n imports.add('useReactive');\n (path.node.body as t.BlockStatement).body.unshift(restVariableDeclaration);\n }\n }\n}\n\nfunction createRestVariableDeclaration(state: State, restName: string, notRestNames: string[]) {\n return t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(restName),\n t.callExpression(state.useReactive, [\n t.identifier('__props'),\n t.arrayExpression(notRestNames.map(name => t.stringLiteral(name))),\n ])\n ),\n ]);\n}\n","import { transformJSX } from './jsx';\nimport { transformProgram } from './program';\nimport {\n replaceSymbol,\n symbolArrayPattern,\n symbolIdentifier,\n symbolObjectPattern,\n} 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\n FunctionDeclaration: replaceProps,\n ArrowFunctionExpression: replaceProps,\n VariableDeclarator: replaceSymbol,\n ImportDeclaration: replaceImportDeclaration,\n Identifier: symbolIdentifier,\n ObjectPattern: symbolObjectPattern,\n ArrayPattern: symbolArrayPattern,\n\n JSXElement: transformJSX,\n JSXFragment: transformJSX,\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,SAASA,UAAS;;;ACQpB,IAAM,UAAU,MAAM;AAEtB,SAAS,SAAS,KAA6B;AACpD,SAAO,OAAO,QAAQ;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Y,YAAY,SAAwB;AACtD,QAAI,aAAa,WAAW,GAAG;AAC7B,WAAK,KAAK,OAAO,CAAC,IAAIA,GAAE,WAAW,QAAQ;AAAA,IAC7C,OAAO;AACL,YAAM,0BAA0B,8BAA8B,OAAO,UAAU,YAAY;AAC3F,cAAQ,IAAI,aAAa;AACzB,MAAC,KAAK,KAAK,KAA0B,KAAK,QAAQ,uBAAuB;AAAA,IAC3E;AAAA,EACF;AACF;AAEA,SAAS,8BAA8B,OAAc,UAAkB,cAAwB;AAC7F,SAAOA,GAAE,oBAAoB,SAAS;AAAA,IACpCA,GAAE;AAAA,MACAA,GAAE,WAAW,QAAQ;AAAA,MACrBA,GAAE,eAAe,MAAM,aAAa;AAAA,QAClCA,GAAE,WAAW,SAAS;AAAA,QACtBA,GAAE,gBAAgB,aAAa,IAAI,UAAQA,GAAE,cAAc,IAAI,CAAC,CAAC;AAAA,MACnE,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;;;ACrFe,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,MAET,qBAAqB;AAAA,MACrB,yBAAyB;AAAA,MACzB,oBAAoB;AAAA,MACpB,mBAAmB;AAAA,MACnB,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,cAAc;AAAA,MAEd,YAAY;AAAA,MACZ,aAAa;AAAA,IACf;AAAA,EACF;AACF;","names":["t","t","t","isComponent","t","value","t","t","t","t","t","t","properties"]}
|
|
1
|
+
{"version":3,"sources":["../src/jsx/index.ts","../../shared/src/is.ts","../../shared/src/comm.ts","../../shared/src/name.ts","../../shared/src/console.ts","../src/program.ts","../src/shared.ts","../src/jsx/constants.ts","../src/signal/symbol.ts","../src/signal/import.ts","../src/signal/props.ts","../src/index.ts"],"sourcesContent":["import { types as t } from '@babel/core';\nimport { capitalize } from '@estjs/shared';\nimport { imports } from '../program';\nimport {\n type JSXChild,\n type JSXElement,\n getAttrName,\n getTagName,\n hasSiblingElement,\n isComponent as isComponentName,\n isTextChild,\n setNodeText,\n} from '../shared';\nimport { selfClosingTags, svgTags } from './constants';\nimport type { Identifier, OptionalMemberExpression, StringLiteral } from '@babel/types';\nimport type { State } from '../types';\nimport type { NodePath } from '@babel/core';\n\nexport interface Result {\n index: number;\n isLastChild: boolean;\n parentIndex: number;\n props: Record<string, any>;\n template: string | string[];\n}\n\nlet isSSG = false;\n\nfunction addToTemplate(result: Result, content: string, join = false): void {\n if (isSSG) {\n if (join && result.template.length > 0) {\n (result.template as string[])[result.template.length - 1] += content;\n } else {\n (result.template as string[]).push(content);\n }\n } else {\n result.template += content;\n }\n}\n\nexport function transformJSX(path: NodePath<JSXElement>): void {\n const state: State = path.state;\n isSSG = state.opts.ssg;\n\n const result: Result = {\n index: 1,\n isLastChild: false,\n parentIndex: 0,\n props: {},\n template: isSSG ? [] : '',\n };\n transformJSXElement(path, result, true);\n\n path.replaceWith(createEssorNode(path, result));\n}\n// Trim and replace multiple spaces/newlines with a single space\nfunction replaceSpace(node: t.JSXText): string {\n return node.value.replaceAll(/\\s+/g, ' ').trim();\n}\n\n/**\n * Creates an expression node for a JSX element or fragment.\n * @param path - The path to the JSX element.\n * @param result - The result containing template and props.\n * @returns A CallExpression representing the JSX element or fragment.\n */\nfunction createEssorNode(path: NodePath<JSXElement>, result: Result): t.CallExpression {\n const state: State = path.state;\n const isJSXFragment = path.isJSXFragment();\n const isComponent = path.isJSXElement() && isComponentName(getTagName(path.node));\n\n const tmpl = isComponent\n ? t.identifier(getTagName(path.node))\n : path.scope.generateUidIdentifier('_tmpl$');\n\n let templateNode;\n if (!isComponent) {\n templateNode = isSSG\n ? t.arrayExpression((result.template as string[]).map(t.stringLiteral))\n : t.callExpression(state.template, [t.stringLiteral(result.template as string)]);\n\n state.tmplDeclaration.declarations.push(t.variableDeclarator(tmpl, templateNode));\n if (!isSSG) {\n imports.add('template');\n }\n }\n\n const key = result.props.key ?? result.props[0]?.key;\n\n const propsArg = createProps(result.props);\n const args =\n isComponent && getTagName(path.node) === 'Fragment'\n ? [t.stringLiteral(''), propsArg]\n : [tmpl, propsArg];\n\n if (key) {\n args.push(key);\n }\n\n const fnName = isSSG\n ? 'ssg'\n : isJSXFragment || (isComponent && getTagName(path.node) === 'Fragment')\n ? 'Fragment'\n : 'h';\n imports.add(fnName);\n\n return t.callExpression(state[fnName], args);\n}\n\nfunction createProps(props: Record<string, any>): t.ObjectExpression {\n const result: (t.ObjectProperty | t.SpreadElement)[] = [];\n for (const prop in props) {\n let value = props[prop];\n if (prop === 'key') {\n continue;\n }\n if (Array.isArray(value)) {\n value = t.arrayExpression(value);\n }\n if (typeof value === 'object' && value !== null && !t.isNode(value)) {\n value = createProps(value);\n }\n if (typeof value === 'string') {\n value = t.stringLiteral(value);\n }\n if (typeof value === 'number') {\n value = t.numericLiteral(value);\n }\n if (typeof value === 'boolean') {\n value = t.booleanLiteral(value);\n }\n if (value === undefined) {\n value = t.tsUndefinedKeyword();\n }\n if (value === null) {\n value = t.nullLiteral();\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 return t.objectExpression(result);\n}\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 = isComponentName(tagName);\n const isSelfClose = !tagIsComponent && selfClosingTags.includes(tagName);\n const isSvg = svgTags.includes(tagName) && result.index === 1;\n const { props, hasExpression } = getAttrProps(path);\n\n if (tagIsComponent) {\n handleComponentElement(path, result, isRoot, props);\n } else {\n handleHTMLElement(path, result, tagName, isSelfClose, isSvg, props, hasExpression);\n }\n } else {\n result.index--;\n transformChildren(path, result);\n }\n}\n\nfunction handleComponentElement(\n path: NodePath<JSXElement>,\n result: Result,\n isRoot: boolean,\n props: Record<string, any>,\n): void {\n if (isRoot) {\n result.props = props;\n const children = getChildren(path);\n if (children.length > 0) {\n const childrenGenerator =\n children.length === 1 ? children[0] : t.arrayExpression(children as JSXElement[]);\n\n // Check if children is a conditional expression\n if (t.isConditionalExpression(childrenGenerator)) {\n result.props.children = t.arrowFunctionExpression([], childrenGenerator);\n } else {\n result.props.children = childrenGenerator;\n }\n }\n } else {\n transformJSX(path);\n replaceChild(path.node, result);\n }\n}\n\nfunction handleHTMLElement(\n path: NodePath<JSXElement>,\n result: Result,\n tagName: string,\n isSelfClose: boolean,\n isSvg: boolean,\n props: Record<string, any>,\n hasExpression: boolean,\n): void {\n if (isSvg) {\n result.template = isSSG ? [`<svg _svg_ data-hk=\"${result.index}\">`] : `<svg _svg_ >`;\n }\n\n addToTemplate(result, `<${tagName}${isSSG ? ` data-hk=\"${result.index}\"` : ''}`, true);\n handleAttributes(props, result);\n addToTemplate(result, isSelfClose ? '/>' : '>', !hasExpression);\n\n if (!isSelfClose) {\n transformChildren(path, result);\n if (hasSiblingElement(path) || isSSG) {\n addToTemplate(result, `</${tagName}>`);\n }\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 addToTemplate(result, `${expression.node.value}`, true);\n } else if (expression.isExpression()) {\n replaceChild(expression.node, result);\n } else if (t.isJSXEmptyExpression(expression.node)) {\n // it is empty expression\n // just for tracking value\n } else {\n throw new Error('Unsupported child type');\n }\n } else if (child.isJSXText()) {\n addToTemplate(result, replaceSpace(child.node), true);\n } else {\n throw new Error('Unsupported child type');\n }\n}\nfunction getNodeText(path: NodePath<JSXChild>): string {\n if (path.isJSXText()) {\n return replaceSpace(path.node);\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}\n\nfunction isStyleClassName(name: string): name is 'style' | 'class' {\n return name === 'class' || name === 'style';\n}\n\nfunction handleAttributes(props: Record<string, any>, result: Result): void {\n let klass = '';\n let style = '';\n\n for (const [prop, value] of Object.entries(props)) {\n if (prop === 'class' && typeof value === 'string') {\n klass += ` ${value}`;\n delete props[prop];\n } else if (prop === 'style' && typeof value === 'string') {\n style += `${value}${value.at(-1) === ';' ? '' : ';'}`;\n delete props[prop];\n } else if (value === true) {\n addToTemplate(result, ` ${prop}`);\n delete props[prop];\n } else if (value === false) {\n delete props[prop];\n } else if (typeof value === 'string' || typeof value === 'number') {\n addToTemplate(result, ` ${prop}=\"${value}\"`);\n delete props[prop];\n } else if (t.isConditionalExpression(value)) {\n props[prop] = t.arrowFunctionExpression([], value);\n } else if (t.isObjectExpression(value)) {\n const val = handleObjectExpression(prop, value, props, isStyleClassName(prop));\n if (val) {\n if (prop === 'class') {\n klass += ` ${val}`;\n }\n if (prop === 'style') {\n style += `${val}${val.at(-1) === ';' ? '' : ';'}`;\n }\n }\n }\n }\n\n if (Object.keys(props).length > 0) {\n result.props[result.index] = props;\n }\n\n if (klass.trim()) {\n addToTemplate(result, ` class=\"${klass.trim()}\"`);\n }\n if (style.trim()) {\n addToTemplate(result, ` style=\"${style.trim()}\"`);\n }\n}\n\nfunction handleObjectExpression(\n prop: string,\n value: t.ObjectExpression,\n props: Record<string, any>,\n isCt = false,\n): string {\n let ct = '';\n const hasConditional = value.properties.some(\n property => t.isObjectProperty(property) && t.isConditionalExpression(property.value),\n );\n\n if (hasConditional) {\n props[prop] = t.arrowFunctionExpression([], value);\n } else if (isCt) {\n value.properties.forEach(property => {\n if (t.isObjectProperty(property)) {\n ct += `${(property.key as Identifier).name || (property.key as StringLiteral).value}:${(property.value as StringLiteral).value};`;\n }\n });\n\n delete props[prop];\n }\n return ct;\n}\n\nfunction replaceChild(node: t.Expression, result: Result): void {\n if (result.isLastChild) {\n result.index--;\n } else {\n addToTemplate(result, '<!>');\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 transformJSX(child);\n } else if (child.isJSXExpressionContainer()) {\n child.replaceWith(child.get('expression'));\n } else if (child.isJSXText()) {\n child.replaceWith(t.stringLiteral(replaceSpace(child.node)));\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}\n\nexport function 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 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 transformJSX(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[bindName] = t.memberExpression(\n // t.identifier((expression.node as Identifier).name),\n // t.identifier('value'),\n // );\n props[`update${capitalize(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 transformJSX(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 return {\n props,\n hasExpression,\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): val is Promise<any> {\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}\n\nexport function isSet(val: any): val is Set<any> {\n return _toString.call(val) === '[object Set]';\n}\nexport function isWeakMap(val: any): val is WeakMap<any, any> {\n return _toString.call(val) === '[object WeakMap]';\n}\nexport function isWeakSet(val: any): val is WeakSet<any> {\n return _toString.call(val) === '[object WeakSet]';\n}\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;\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\nexport function isHTMLElement(obj) {\n if (!obj) return false;\n return obj && typeof obj === 'object' && obj.nodeType === 1 && typeof obj.nodeName === 'string';\n}\n\nexport const isPlainObject = (val: unknown): val is object =>\n _toString.call(val) === '[object Object]';\n\nexport type StringNumber = `${number}`;\nexport function isStringNumber(val: unknown): val is StringNumber {\n if (!isString(val)) {\n return false;\n }\n return !Number.isNaN(Number(val));\n}\n","import { isArray, isFunction, isString } 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 isArray(data) ? (data.flat() as T[]) : [data];\n}\nexport const hasChanged = (value, oldValue) =>\n value !== oldValue && (value === value || oldValue === oldValue);\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 if (!isString(str)) {\n return false;\n }\n return str.indexOf(searchString) === 0;\n}\n\n/**\n * Escapes special HTML characters in a string.\n * @param str - The string to escape.\n * @returns The escaped string.\n */\nexport function escape(str: string): string {\n return str.replaceAll(/[\"&'<>]/g, char => {\n switch (char) {\n case '&':\n return '&';\n case '<':\n return '<';\n case '>':\n return '>';\n case '\"':\n return '"';\n case \"'\":\n return ''';\n default:\n return char;\n }\n });\n}\n\nexport type ExcludeType = ((key: string | symbol) => boolean) | (string | symbol)[];\n\n/**\n * Checks if a key should be excluded based on the provided exclude criteria.\n * @param key - The key to check.\n * @param exclude - The exclusion criteria.\n * @returns True if the key should be excluded, otherwise false.\n */\nexport function isExclude(key: string | symbol, exclude?: ExcludeType): boolean {\n return isArray(exclude) ? exclude.includes(key) : isFunction(exclude) ? exclude(key) : false;\n}\n\n/**\n * Generates a unique random 8 character string ID.\n * The generated IDs only contain alphanumeric characters.\n * @returns A unique random 8 character string ID.\n */\nexport function generateUniqueId() {\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n const charactersLength = characters.length;\n for (let i = 0; i < 8; i++) {\n result += characters.charAt(Math.floor(Math.random() * charactersLength));\n }\n return result;\n}\n\n/**\n * Checks if the current environment is a browser.\n * @returns True if the current environment is a browser, otherwise false.\n */\nexport function isBrowser() {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\nexport const cacheStringFunction = <T extends (str: string) => string>(fn: T): T => {\n const cache: Record<string, string> = Object.create(null);\n return ((str: string) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n }) as T;\n};\n","import { cacheStringFunction } from './comm';\n\nconst hyphenateRE = /\\B([A-Z])/g;\nexport const kebabCase: (str: string) => string = cacheStringFunction((str: string) =>\n str.replaceAll(hyphenateRE, '-$1').toLowerCase(),\n);\n\nconst camelizeRE = /-(\\w)/g;\nexport const camelCase: (str: string) => string = cacheStringFunction((str: string): string => {\n return str.replaceAll(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));\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 capitalize: <T extends string>(str: T) => Capitalize<T> = cacheStringFunction(\n <T extends string>(str: T) => {\n return (str.charAt(0).toUpperCase() + str.slice(1)) as Capitalize<T>;\n },\n);\n","export function warn(msg: string, ..._args: any[]): void;\nexport function warn(msg: string, ...args): void {\n // eslint-disable-next-line prefer-spread\n console.warn.apply(console, [`[Essor warn]: ${msg}`].concat(args) as [string, ...any[]]);\n}\n\nexport function info(msg: string, ..._args: any[]): void;\nexport function info(msg: string, ...args): void {\n // eslint-disable-next-line prefer-spread, no-console\n console.info.apply(console, [`[Essor info]: ${msg}`].concat(args) as [string, ...any[]]);\n}\n\nexport function error(msg: string, ..._args: any[]): void;\nexport function error(msg: string, ...args): void {\n // eslint-disable-next-line prefer-spread\n console.error.apply(console, [`[Essor error]: ${msg}`].concat(args) as [string, ...any[]]);\n}\n","import { type NodePath, types as t } from '@babel/core';\nimport type { Options, State } from './types';\nexport const imports = new Set<string>();\n\nconst defaultOption: Options = {\n ssg: false,\n symbol: '$',\n props: true,\n};\n\nexport const transformProgram = {\n enter(path: NodePath<t.Program>, state) {\n imports.clear();\n\n // merge options\n state.opts = { ...defaultOption, ...state.opts };\n\n path.state = {\n h: path.scope.generateUidIdentifier('h$'),\n template: path.scope.generateUidIdentifier('template$'),\n ssg: path.scope.generateUidIdentifier('ssg$'),\n Fragment: path.scope.generateUidIdentifier('fragment$'),\n\n signal: path.scope.generateUidIdentifier('signal$'),\n computed: path.scope.generateUidIdentifier('computed$'),\n reactive: path.scope.generateUidIdentifier('reactive$'),\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","import { type NodePath, types as t } from '@babel/core';\nimport { startsWith } from '@estjs/shared';\nimport type { State } from './types';\n\nexport type JSXElement = t.JSXElement | t.JSXFragment;\n\nexport type JSXChild =\n | t.JSXElement\n | t.JSXFragment\n | t.JSXExpressionContainer\n | t.JSXSpreadChild\n | t.JSXText;\n\n/**\n * Checks if the given Babel path has a sibling element.\n *\n * @param {NodePath} path - The Babel path to check.\n * @return {boolean} True if the path has a sibling element, false otherwise.\n */\nexport function hasSiblingElement(path) {\n // Get all siblings (both previous and next)\n const siblings = path.getAllPrevSiblings().concat(path.getAllNextSiblings());\n\n // Check for non-self-closing sibling elements or JSXExpressionContainer\n const hasSibling = siblings.some(\n siblingPath => siblingPath.isJSXElement() || siblingPath.isJSXExpressionContainer(),\n );\n\n return hasSibling;\n}\n/**\n * Retrieves the name of a JSX attribute.\n *\n * @param {t.JSXAttribute} attribute - The JSX attribute to retrieve the name from.\n * @return {string} The name of the attribute.\n * @throws {Error} If the attribute type is unsupported.\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/**\n * Retrieves the tag name of a JSX element.\n *\n * @param {t.JSXElement} node - The JSX element.\n * @return {string} The tag name of the JSX element.\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\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-z]/i.test(tagName[0])\n );\n}\n\n/**\n * Determines if the given path represents a text child node in a JSX expression.\n *\n * @param {NodePath<JSXChild>} path - The path to the potential text child node.\n * @return {boolean} True if the path represents a text child node, false otherwise.\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\n/**\n * Sets the text content of a JSX node.\n *\n * @param {NodePath<JSXChild>} path - The path to the JSX node.\n * @param {string} text - The text to set.\n * @return {void}\n */\nexport function 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\n/**\n * get the symbol start with\n */\nexport function isSymbolStart(path: NodePath<any>, name: string) {\n const state: State = path.state;\n const { symbol } = state?.opts || '$';\n\n return startsWith(name, symbol);\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 { isSymbolStart } from '../shared';\nimport type { Identifier, VariableDeclarator } from '@babel/types';\nimport type { NodePath } from '@babel/core';\n\n/**\n * Replaces the symbol in a variable declarator with a computed or signal expression.\n *\n * case 1: let $a = 1 => let $a = signal(1);\n * case 2: const $a = ()=>{return $a} => const $a = computed(()=>{return $a})\n *\n * @param {NodePath<VariableDeclarator>} path - The path to the variable declarator node.\n * @return {void}\n */\nexport function replaceSymbol(path: NodePath<VariableDeclarator>) {\n const { init, id } = path.node;\n const variableName = (id as Identifier).name;\n\n if (t.isObjectPattern(id) || t.isArrayPattern(id) || !isSymbolStart(path, variableName)) return;\n\n const isComputed =\n init &&\n (t.isFunctionExpression(init) || t.isArrowFunctionExpression(init)) &&\n (path.parent as t.VariableDeclaration).kind === 'const';\n\n const hookName = isComputed ? 'computed' : 'signal';\n const newInit = t.callExpression(t.identifier(path.state[hookName].name), init ? [init] : []);\n\n imports.add(hookName);\n path.node.init = newInit;\n}\n\nexport function symbolIdentifier(path) {\n const parentPath = path.parentPath;\n if (!shouldProcessIdentifier(parentPath)) return;\n\n const { node } = path;\n if (!isSymbolStart(path, node.name)) return;\n\n if (!path.findParent(p => p.isMemberExpression() && p.node.property.name === 'value')) {\n path.replaceWith(t.memberExpression(t.identifier(node.name), t.identifier('value')));\n }\n}\n\nfunction shouldProcessIdentifier(parentPath) {\n return (\n parentPath &&\n !t.isVariableDeclarator(parentPath) &&\n !t.isImportSpecifier(parentPath) &&\n !t.isObjectProperty(parentPath) &&\n !t.isArrayPattern(parentPath) &&\n !t.isObjectPattern(parentPath)\n );\n}\n\nexport function symbolObjectPattern(path) {\n path.node.properties.forEach(property => {\n if (\n t.isObjectProperty(property) &&\n t.isIdentifier(property.key) &&\n isSymbolStart(path, property.key.name)\n ) {\n property.key = t.identifier(property.key.name);\n }\n });\n}\n\nexport function symbolArrayPattern(path) {\n path.node.elements.forEach(element => {\n if (t.isIdentifier(element) && element.name.startsWith('$')) {\n element.name = t.identifier(element.name).name;\n } else if (t.isObjectPattern(element)) {\n symbolObjectPattern({ node: element } as NodePath);\n }\n });\n}\n","import { types as t } from '@babel/core';\nimport { startsWith } from '@estjs/shared';\n\n/**\n * Replaces import declarations\n *\n * case1: import { $a } from 'a';console.log(a) => import { $a } from 'a';console.log($a.value)\n * case2: import $a from 'a';console.log(a) => import $a from 'a';console.log($a.value)\n *\n * @param {object} path - The path to replace import declarations.\n * @return {void}\n */\nexport function replaceImportDeclaration(path) {\n path.node.specifiers.forEach(specifier => {\n const variableName = specifier.local.name;\n if (startsWith(variableName, '$') && !isVariableUsedAsObject(path, variableName)) {\n path.scope.rename(variableName, `${variableName}.value`);\n specifier.local.name = variableName;\n }\n });\n}\n\n/**\n * Checks if a variable is used as an object.\n *\n * @param path - The path to the variable.\n * @param variableName - The name of the variable.\n * @returns {boolean} - Whether the variable is used as an object.\n */\nfunction isVariableUsedAsObject(path, variableName) {\n const binding = path.scope.getBinding(variableName);\n return (\n binding?.referencePaths?.some(referencePath => {\n if (t.isMemberExpression(referencePath.parent)) {\n const { object, property } = referencePath.parent;\n if (t.isIdentifier(object, { name: variableName })) {\n referencePath.parentPath.replaceWith(\n t.memberExpression(t.memberExpression(object, t.identifier('value')), property),\n );\n return true;\n }\n }\n return false;\n }) || false\n );\n}\n","import { startsWith } from '@estjs/shared';\nimport { type NodePath, types as t } from '@babel/core';\nimport { imports } from '../program';\nimport type { State } from '../types';\nimport type {\n ArrowFunctionExpression,\n FunctionDeclaration,\n Identifier,\n ObjectProperty,\n RestElement,\n} from '@babel/types';\n\n/**\n * Replaces the properties of a function's first parameter with new names.\n *\n * auto replace pattern to props object\n *\n * rule1: function argument\n * rule2: first argument is object and it pattern\n * rule3: function has return\n *\n * transform case\n * case1 ({a, b}) => <div>{a.value}</div> to=> (_props)=><div>{_props.a.value}</div>\n * case2 ({a, b, ...rest}) => <div>{a.value}{rest}</div> to=> (_props)=> {const restProps = reactive(props,[a,b]);return <div>{_props.a.value}{reset}</div>}\n *\n * not transform case\n * case1 ([a,b])=> <div>{a.value}</div>\n * case2 ({a.,b}) ={}\n *\n * @param {NodePath<FunctionDeclaration | ArrowFunctionExpression>} path - The path to the function node.\n * @return {void}\n */\nexport function replaceProps(path: NodePath<FunctionDeclaration | ArrowFunctionExpression>) {\n const state: State = path.state;\n const firstParam = path.node.params[0];\n\n if (!firstParam || !t.isObjectPattern(firstParam)) return;\n\n const returnStatement = path\n .get('body')\n .get('body')\n .find(statement => statement.isReturnStatement());\n\n if (!returnStatement || !t.isJSXElement((returnStatement.node as any)?.argument)) return;\n\n const replaceProperties = (properties: (ObjectProperty | RestElement)[], parentPath: string) => {\n properties.forEach(property => {\n if (t.isObjectProperty(property) && t.isIdentifier(property.key)) {\n const keyName = property.key.name;\n if (t.isIdentifier(property.value)) {\n path.scope.rename(property.value.name, `${parentPath}${keyName}`);\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 const notRestProperties = properties.filter(\n property => !t.isRestElement(property),\n ) as ObjectProperty[];\n replaceProperties(notRestProperties, '__props.');\n\n const notRestNames = notRestProperties.map(property => (property.key as Identifier).name);\n if (__DEV__ && notRestNames.some(name => startsWith(name, '$'))) {\n console.warn('props name can not start with $');\n return;\n }\n\n handleRestElement(path, state, properties, notRestNames);\n}\n\nfunction handleRestElement(path, state: State, properties, notRestNames) {\n const restElement = properties.find(property => t.isRestElement(property)) as\n | RestElement\n | undefined;\n path.node.params[0] = t.identifier('__props');\n\n if (restElement) {\n const restName = (restElement.argument as Identifier).name;\n if (notRestNames.length === 0) {\n path.node.params[0] = t.identifier(restName);\n } else {\n const restVariableDeclaration = createRestVariableDeclaration(state, restName, notRestNames);\n imports.add('reactive');\n (path.node.body as t.BlockStatement).body.unshift(restVariableDeclaration);\n }\n }\n}\n\nfunction createRestVariableDeclaration(state: State, restName: string, notRestNames: string[]) {\n return t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(restName),\n t.callExpression(state.reactive, [\n t.identifier('__props'),\n t.arrayExpression(notRestNames.map(name => t.stringLiteral(name))),\n ]),\n ),\n ]);\n}\n","import { transformJSX } from './jsx';\nimport { transformProgram } from './program';\nimport {\n replaceSymbol,\n symbolArrayPattern,\n symbolIdentifier,\n symbolObjectPattern,\n} 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\n FunctionDeclaration: replaceProps,\n ArrowFunctionExpression: replaceProps,\n VariableDeclarator: replaceSymbol,\n ImportDeclaration: replaceImportDeclaration,\n Identifier: symbolIdentifier,\n ObjectPattern: symbolObjectPattern,\n ArrayPattern: symbolArrayPattern,\n\n JSXElement: transformJSX,\n JSXFragment: transformJSX,\n },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,aAAa;AAAA,IACf;AAAA,EACF;AACF;","names":["t","t","t","isComponent","t","value","t","t","t","t","t","t","properties"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-plugin-essor",
|
|
3
|
-
"version": "0.0.14-beta.
|
|
3
|
+
"version": "0.0.14-beta.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [],
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/core": "^7.26.0",
|
|
36
36
|
"@babel/types": "^7.26.0",
|
|
37
|
-
"@estjs/shared": "0.0.14-beta.
|
|
37
|
+
"@estjs/shared": "0.0.14-beta.13"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/babel__core": "^7.20.5",
|