Skip to content

Commit

Permalink
Update transform_files.mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Oct 31, 2022
1 parent f23227f commit e86aa95
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions scripts/transform_files.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,12 @@ function parseClassBase(raw, find) {
variableNode.type === 'ExpressionStatement'
? variableNode.expression.left
: variableNode.declarations[0].id
);
).trim();

const declaration = found.arguments.pop();
const superClasses = found.arguments.map((node) => printASTNode(raw, node));
const superClasses = found.arguments.map((node) =>
printASTNode(raw, node).replaceAll(',', '').trim()
);
const [methods, properties] = _.partition(
found.properties,
(node) =>
Expand Down Expand Up @@ -365,12 +367,15 @@ function transformClass(type, raw, options = {}) {
raw = `${raw.slice(0, match.index)}${classDirective}${raw
.slice(end + 1)
.replace(/\s*\)\s*;?/, '')}`;
if (type === 'mixin') {
// in case of multiple mixins in one file
try {
return transformClass(type, raw, options);
} catch (error) {}
}

// in case of multiple declaration in one file
try {
return transformClass('class', raw, options);
} catch (error) {}
try {
return transformClass('mixin', raw, options);
} catch (error) {}

if (type === 'class' && !useExports) {
raw = `${raw}\n/** @todo TODO_JS_MIGRATION remove next line after refactoring build */\n${namespace} = ${name};\n`;
}
Expand Down

0 comments on commit e86aa95

Please sign in to comment.