@ui5/builder 3.0.0-alpha.1 → 3.0.0-alpha.4
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/CHANGELOG.md +790 -0
- package/lib/builder/BuildContext.js +6 -2
- package/lib/builder/ProjectBuildContext.js +4 -0
- package/lib/builder/builder.js +8 -2
- package/lib/lbt/analyzer/JSModuleAnalyzer.js +14 -6
- package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +2 -1
- package/lib/lbt/bundle/Builder.js +360 -103
- package/lib/lbt/bundle/BundleWriter.js +17 -0
- package/lib/lbt/resources/LocatorResource.js +6 -6
- package/lib/lbt/resources/LocatorResourcePool.js +8 -4
- package/lib/lbt/utils/parseUtils.js +1 -1
- package/lib/processors/bundlers/moduleBundler.js +29 -7
- package/lib/processors/minifier.js +11 -5
- package/lib/tasks/TaskUtil.js +12 -0
- package/lib/tasks/bundlers/generateBundle.js +69 -29
- package/lib/tasks/bundlers/generateComponentPreload.js +12 -5
- package/lib/tasks/bundlers/generateFlexChangesBundle.js +3 -2
- package/lib/tasks/bundlers/generateLibraryPreload.js +44 -18
- package/lib/tasks/bundlers/generateStandaloneAppBundle.js +34 -7
- package/lib/tasks/bundlers/utils/createModuleNameMapping.js +30 -0
- package/lib/tasks/generateResourcesJson.js +1 -1
- package/lib/tasks/minify.js +13 -3
- package/lib/types/library/LibraryBuilder.js +4 -3
- package/lib/types/themeLibrary/ThemeLibraryBuilder.js +2 -1
- package/package.json +6 -4
|
@@ -15,22 +15,26 @@ const GLOBAL_TAGS = Object.freeze({
|
|
|
15
15
|
* @memberof module:@ui5/builder.builder
|
|
16
16
|
*/
|
|
17
17
|
class BuildContext {
|
|
18
|
-
constructor({rootProject}) {
|
|
18
|
+
constructor({rootProject, options = {}}) {
|
|
19
19
|
if (!rootProject) {
|
|
20
20
|
throw new Error(`Missing parameter 'rootProject'`);
|
|
21
21
|
}
|
|
22
22
|
this.rootProject = rootProject;
|
|
23
23
|
this.projectBuildContexts = [];
|
|
24
|
-
|
|
25
24
|
this._resourceTagCollection = new ResourceTagCollection({
|
|
26
25
|
allowedTags: Object.values(GLOBAL_TAGS)
|
|
27
26
|
});
|
|
27
|
+
this.options = options;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
getRootProject() {
|
|
31
31
|
return this.rootProject;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
getOption(key) {
|
|
35
|
+
return this.options[key];
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
createProjectContext({project, resources}) {
|
|
35
39
|
const projectBuildContext = new ProjectBuildContext({
|
|
36
40
|
buildContext: this,
|
package/lib/builder/builder.js
CHANGED
|
@@ -224,6 +224,7 @@ module.exports = {
|
|
|
224
224
|
* @param {boolean} [parameters.dev=false]
|
|
225
225
|
* Decides whether a development build should be activated (skips non-essential and time-intensive tasks)
|
|
226
226
|
* @param {boolean} [parameters.selfContained=false] Flag to activate self contained build
|
|
227
|
+
* @param {boolean} [parameters.cssVariables=false] Flag to activate CSS variables generation
|
|
227
228
|
* @param {boolean} [parameters.jsdoc=false] Flag to activate JSDoc build
|
|
228
229
|
* @param {Array.<string>} [parameters.includedTasks=[]] List of tasks to be included
|
|
229
230
|
* @param {Array.<string>} [parameters.excludedTasks=[]] List of tasks to be excluded.
|
|
@@ -234,7 +235,7 @@ module.exports = {
|
|
|
234
235
|
async build({
|
|
235
236
|
tree, destPath, cleanDest = false,
|
|
236
237
|
buildDependencies = false, includedDependencies = [], excludedDependencies = [],
|
|
237
|
-
dev = false, selfContained = false, jsdoc = false,
|
|
238
|
+
dev = false, selfContained = false, cssVariables = false, jsdoc = false,
|
|
238
239
|
includedTasks = [], excludedTasks = [], devExcludeProject = []
|
|
239
240
|
}) {
|
|
240
241
|
const startTime = process.hrtime();
|
|
@@ -249,7 +250,12 @@ module.exports = {
|
|
|
249
250
|
virBasePath: "/"
|
|
250
251
|
});
|
|
251
252
|
|
|
252
|
-
const buildContext = new BuildContext({
|
|
253
|
+
const buildContext = new BuildContext({
|
|
254
|
+
rootProject: tree,
|
|
255
|
+
options: {
|
|
256
|
+
cssVariables: cssVariables
|
|
257
|
+
}
|
|
258
|
+
});
|
|
253
259
|
const cleanupSigHooks = registerCleanupSigHooks(buildContext);
|
|
254
260
|
|
|
255
261
|
const projects = {}; // Unique project index to prevent building the same project multiple times
|
|
@@ -175,12 +175,11 @@ const EnrichedVisitorKeys = (function() {
|
|
|
175
175
|
|
|
176
176
|
// merge with 'official' visitor keys
|
|
177
177
|
Object.keys(VisitorKeys).forEach( (type) => {
|
|
178
|
-
//
|
|
179
|
-
//
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
// ExperimentalSpreadProperty
|
|
178
|
+
// Ignore deprecated keys:
|
|
179
|
+
// - ExperimentalSpreadProperty => SpreadElement
|
|
180
|
+
// - ExperimentalRestProperty => RestElement
|
|
181
|
+
// They are about to be removed, see: https://github.com/eslint/eslint-visitor-keys/pull/36
|
|
182
|
+
if (type === "ExperimentalSpreadProperty" || type === "ExperimentalRestProperty") {
|
|
184
183
|
return;
|
|
185
184
|
}
|
|
186
185
|
// Ignore JSX visitor-keys because they aren't used.
|
|
@@ -188,6 +187,15 @@ const EnrichedVisitorKeys = (function() {
|
|
|
188
187
|
return;
|
|
189
188
|
}
|
|
190
189
|
|
|
190
|
+
// Ignore new ES2022 syntax as we currently use ES2021 (see parseUtils.js)
|
|
191
|
+
if (
|
|
192
|
+
type === "PrivateIdentifier" ||
|
|
193
|
+
type === "PropertyDefinition" ||
|
|
194
|
+
type === "StaticBlock"
|
|
195
|
+
) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
191
199
|
const visitorKeys = VisitorKeys[type];
|
|
192
200
|
const condKeys = TempKeys[type];
|
|
193
201
|
if ( condKeys === undefined ) {
|
|
@@ -231,9 +231,10 @@ class XMLTemplateAnalyzer {
|
|
|
231
231
|
// looks like a UI5 library or package name
|
|
232
232
|
const moduleName = ModuleName.fromUI5LegacyName( (namespace ? namespace + "." : "") + localName );
|
|
233
233
|
|
|
234
|
+
this._analyzeCoreRequire(node);
|
|
235
|
+
|
|
234
236
|
// ignore FragmentDefinition (also skipped by runtime XMLTemplateProcessor)
|
|
235
237
|
if ( FRAGMENTDEFINITION_MODULE !== moduleName ) {
|
|
236
|
-
this._analyzeCoreRequire(node);
|
|
237
238
|
this.promises.push(this._analyzeModuleDependency(node, moduleName, this.conditional));
|
|
238
239
|
}
|
|
239
240
|
}
|