Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
wpdas committed Apr 22, 2024
1 parent 387212e commit 46510fc
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 58 deletions.
1 change: 0 additions & 1 deletion lib/actions/loadFilesInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ const processFileSchema = (filePath, processOnlyThisFile) => {
}
}

// let fileContent = fs.readFileSync(filePath, "utf8");
let fileContent = filesContentCache.getFileContent(filePath);

// Remove comments from file
Expand Down
1 change: 0 additions & 1 deletion lib/actions/transformSchemaToWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ const swapComponentsForStatelessFiles = (fileSchemas, fileSchema) => {
.replaceAll(MORE_THAN_ONE_SPACE, " ");

let childProps = extractPropsFromJSX(htmlElementString);
// TODO: fazer isso dentro do "processChildrenWidget" também
const childSpreads = extractSpreadsFromJSX(htmlElementString);

// get the children
Expand Down
56 changes: 0 additions & 56 deletions lib/parsers/extractJSX.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
// const babel = require("@babel/core");
// const presetReact = require("@babel/preset-react");
// const presetTypeScript = require("@babel/preset-typescript"); // Suporte TypeScript
// const traverse = require("@babel/traverse").default;
// const generate = require("@babel/generator").default;
const babel = require("@babel/core");
const presetReact = require("@babel/preset-react");
const presetTypeScript = require("@babel/preset-typescript");
Expand Down Expand Up @@ -66,56 +61,5 @@ function extractJSXFromNode(node, jsxList) {
extractJSXFromNode(node.alternate, jsxList);
}
}
// function extractJSX(code) {
// let jsxList = [];

// const ast = babel.parse(code, {
// presets: [presetReact, presetTypeScript], // Usando presets React e TypeScript
// filename: "input.tsx", // Nome de arquivo fictício necessário para presets
// });

// traverse(ast, {
// ReturnStatement(path) {
// let returnArg = path.node.argument;

// // Manipula retorno de JSX dentro de blocos de código (ex: { return <JSX> })
// if (returnArg && returnArg.type === "BlockStatement") {
// returnArg.body.forEach((statement) => {
// if (statement.type === "ReturnStatement") {
// if (
// statement.argument.type === "JSXElement" ||
// statement.argument.type === "JSXFragment"
// ) {
// const jsxCode = generate(statement.argument, {
// concise: true,
// }).code;
// jsxList.push(jsxCode);
// }
// }
// });
// }
// // Manipula retorno direto de JSX (ex: () => <JSX>)
// else if (
// returnArg &&
// (returnArg.type === "JSXElement" || returnArg.type === "JSXFragment")
// ) {
// const jsxCode = generate(returnArg, { concise: true }).code;
// jsxList.push(jsxCode);
// }
// },
// ArrowFunctionExpression(path) {
// // Diretamente retorna JSX ou fragmento JSX
// if (
// path.node.body.type === "JSXElement" ||
// path.node.body.type === "JSXFragment"
// ) {
// const jsxCode = generate(path.node.body, { concise: true }).code;
// jsxList.push(jsxCode);
// }
// },
// });

// return jsxList;
// }

module.exports = extractJSX;

0 comments on commit 46510fc

Please sign in to comment.