Skip to content

Commit

Permalink
fixed layer2 widget, modules name are set using create_new_name to re…
Browse files Browse the repository at this point in the history
…duce the final bundle size
  • Loading branch information
wpdas committed Apr 26, 2024
1 parent d14c1c1 commit 160bc8c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/actions/transformSchemaToWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const {
MORE_THAN_ONE_SPACE,
LINE_BREAKS,
} = require("../regexp");
const { log } = require("../utils");
const { log, create_new_name } = require("../utils");
const PROHIBITED_METHODS = require("../config/prohibitedMethods");
const hasWidgetPropsCheck = require("./hasWidgetPropsCheck");
const importableFiles = require("../config/importableFiles");
Expand Down Expand Up @@ -132,7 +132,8 @@ const processSchema = (fileSchema) => {
fileSchema.isModule = isModule;
if (isModule) {
fileSchema.moduleProps = {
name: fileSchema.filePath,
// name: fileSchema.filePath,
name: create_new_name(true), // Usando formato a_<number> para reduzir o bundle
// INFO: isso será trocado no final para usar o final bundle
module: wrapCodeInGetFunction(fileSchema.content, fileSchema.filePath),
values: getFunctionExportDeclarationKeys(
Expand Down
2 changes: 1 addition & 1 deletion lib/alem-vm/components/AppIndexer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const AlemApp = useMemo(() => {
MODULES_CODE: {},
},
}
}
};
return (
<Widget loading=" " code={props.alem.componentsCode.App} props={props} />
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const capitalize_first_letter = (word) => {
let nameChangeCounter = 0;
/**
* Generate new name
* @param {string} _toLowerCase
* @param {boolean} _toLowerCase
*/
const create_new_name = (_toLowerCase = false) => {
// let randomHexName = get_randon_hexadecimal(6);
Expand Down

0 comments on commit 160bc8c

Please sign in to comment.