Skip to content

Commit 9dcbb64

Browse files
committed
Flatten result of bundling (array of arrays of resources) before writing
Console logging needs to be removed in a later change.
1 parent c199760 commit 9dcbb64

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

lib/tasks/bundlers/generateComponentPreload.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require("path");
22
const moduleBundler = require("../../processors/bundlers/moduleBundler");
33
const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritized;
4+
const flatten = require("arr-flatten");
45

56
/**
67
* Task to for application bundling.
@@ -20,9 +21,10 @@ module.exports = function({workspace, dependencies, options}) {
2021
name: `generateComponentPreload - prioritize workspace over dependencies: ${options.projectName}`,
2122
readers: [workspace, dependencies]
2223
});
23-
24+
console.log(workspace);
2425
return combo.byGlob("/resources/**/*.{js,json,xml,html,properties,library}")
2526
.then(async (resources) => {
27+
console.log(resources.map((res) => res.getPath()));
2628
let namespaces = [];
2729
if (options.paths) {
2830
namespaces = await Promise.all(options.paths.map(async (componentPath) => {
@@ -103,7 +105,7 @@ module.exports = function({workspace, dependencies, options}) {
103105
}
104106
}
105107
})
106-
]);
108+
]).then(flatten);
107109
}));
108110
})
109111
.then((processedResources) => {

lib/tasks/bundlers/generateLibraryPreload.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const log = require("@ui5/logger").getLogger("builder:tasks:bundlers:generateLibraryPreload");
22
const moduleBundler = require("../../processors/bundlers/moduleBundler");
33
const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritized;
4+
const flatten = require("arr-flatten");
45

56
function getBundleDefinition(namespace, h2) {
67
let h2infix = h2 ? "h2-" : "";
@@ -213,7 +214,7 @@ module.exports = function({workspace, dependencies, options}) {
213214
log.verbose(`Could not determine library namespace from file "${libraryIndicatorPath}" for project ${options.projectName}. Skipping library preload bundling.`);
214215
return Promise.resolve();
215216
}
216-
}));
217+
})).then(flatten);
217218
});
218219
});
219220
});

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"@ui5/fs": "^0.0.1",
102102
"@ui5/logger": "^0.0.1",
103103
"archiver": "^2.1.0",
104+
"arr-flatten": "1.1.0",
104105
"escope": "^3.6.0",
105106
"esprima": "^2.7.2",
106107
"estraverse": "^4.2.0",

0 commit comments

Comments
 (0)