@ui5/builder 3.0.0-alpha.0 → 3.0.0-alpha.3

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +58 -1
  2. package/index.js +4 -16
  3. package/jsdoc.json +0 -1
  4. package/lib/builder/BuildContext.js +17 -0
  5. package/lib/builder/ProjectBuildContext.js +9 -7
  6. package/lib/builder/builder.js +1 -2
  7. package/lib/lbt/analyzer/JSModuleAnalyzer.js +18 -3
  8. package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +2 -1
  9. package/lib/lbt/bundle/AutoSplitter.js +10 -24
  10. package/lib/lbt/bundle/Builder.js +363 -134
  11. package/lib/lbt/bundle/BundleWriter.js +17 -0
  12. package/lib/lbt/resources/LocatorResource.js +6 -8
  13. package/lib/lbt/resources/LocatorResourcePool.js +8 -4
  14. package/lib/lbt/resources/Resource.js +7 -0
  15. package/lib/lbt/resources/ResourceCollector.js +33 -15
  16. package/lib/lbt/utils/parseUtils.js +1 -1
  17. package/lib/processors/bundlers/moduleBundler.js +40 -14
  18. package/lib/processors/minifier.js +90 -0
  19. package/lib/processors/resourceListCreator.js +2 -16
  20. package/lib/tasks/TaskUtil.js +9 -9
  21. package/lib/tasks/bundlers/generateBundle.js +81 -13
  22. package/lib/tasks/bundlers/generateComponentPreload.js +20 -6
  23. package/lib/tasks/bundlers/generateFlexChangesBundle.js +3 -2
  24. package/lib/tasks/bundlers/generateLibraryPreload.js +65 -10
  25. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +46 -12
  26. package/lib/tasks/bundlers/utils/createModuleNameMapping.js +30 -0
  27. package/lib/tasks/generateResourcesJson.js +14 -8
  28. package/lib/tasks/minify.js +41 -0
  29. package/lib/tasks/taskRepository.js +6 -2
  30. package/lib/types/application/ApplicationBuilder.js +22 -31
  31. package/lib/types/library/LibraryBuilder.js +23 -29
  32. package/lib/types/themeLibrary/ThemeLibraryBuilder.js +1 -0
  33. package/package.json +16 -14
  34. package/lib/processors/debugFileCreator.js +0 -52
  35. package/lib/processors/resourceCopier.js +0 -24
  36. package/lib/processors/uglifier.js +0 -45
  37. package/lib/tasks/createDebugFiles.js +0 -30
  38. package/lib/tasks/uglify.js +0 -33
@@ -2,6 +2,7 @@ const log = require("@ui5/logger").getLogger("builder:tasks:bundlers:generateLib
2
2
  const moduleBundler = require("../../processors/bundlers/moduleBundler");
3
3
  const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritized;
4
4
  const {negateFilters} = require("../../lbt/resources/ResourceFilterList");
5
+ const createModuleNameMapping = require("./utils/createModuleNameMapping");
5
6
 
6
7
  function getDefaultLibraryPreloadFilters(namespace, excludes) {
7
8
  const filters = [
@@ -176,6 +177,8 @@ function createLibraryBundles(libraryNamespace, resources, excludes) {
176
177
  ignoreMissingModules: true,
177
178
  skipIfEmpty: true
178
179
  }
180
+ // Note: Although the bundle uses optimize=false, there is
181
+ // no moduleNameMapping needed, as support files are excluded from minification.
179
182
  },
180
183
  resources
181
184
  })
@@ -211,6 +214,10 @@ function getModuleBundlerOptions(config) {
211
214
  moduleBundlerOptions.bundleDefinition.sections.unshift(providedSection);
212
215
  }
213
216
 
217
+ if (config.moduleNameMapping) {
218
+ moduleBundlerOptions.moduleNameMapping = config.moduleNameMapping;
219
+ }
220
+
214
221
  return moduleBundlerOptions;
215
222
  }
216
223
 
@@ -272,12 +279,19 @@ function getSapUiCoreBunDef(name, filters, preload) {
272
279
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
273
280
  */
274
281
  module.exports = function({workspace, dependencies, taskUtil, options: {projectName, excludes = []}}) {
275
- const combo = new ReaderCollectionPrioritized({
282
+ let combo = new ReaderCollectionPrioritized({
276
283
  name: `libraryBundler - prioritize workspace over dependencies: ${projectName}`,
277
284
  readers: [workspace, dependencies]
278
285
  });
279
286
 
280
- return combo.byGlob("/**/*.{js,json,xml,html,properties,library}").then((resources) => {
287
+ if (taskUtil) {
288
+ combo = combo.filter(function(resource) {
289
+ // Remove any debug variants
290
+ return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.IsDebugVariant);
291
+ });
292
+ }
293
+
294
+ return combo.byGlob("/**/*.{js,json,xml,html,properties,library,js.map}").then(async (resources) => {
281
295
  // Find all libraries and create a library-preload.js bundle
282
296
 
283
297
  let p = Promise.resolve();
@@ -296,6 +310,24 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
296
310
  const isEvo = resources.find((resource) => {
297
311
  return resource.getPath() === "/resources/ui5loader.js";
298
312
  });
313
+
314
+ let unoptimizedModuleNameMapping;
315
+ let unoptimizedResources = resources;
316
+ if (taskUtil) {
317
+ unoptimizedResources = await new ReaderCollectionPrioritized({
318
+ name: `libraryBundler - prioritize workspace over dependencies: ${projectName}`,
319
+ readers: [workspace, dependencies]
320
+ }).filter(function(resource) {
321
+ // Remove any non-debug variants
322
+ return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
323
+ }).byGlob("/**/*.{js,json,xml,html,properties,library,js.map}");
324
+
325
+ unoptimizedModuleNameMapping = createModuleNameMapping({
326
+ resources: unoptimizedResources,
327
+ taskUtil
328
+ });
329
+ }
330
+
299
331
  let filters;
300
332
  if (isEvo) {
301
333
  filters = ["ui5loader-autoconfig.js"];
@@ -308,8 +340,11 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
308
340
  resources
309
341
  }),
310
342
  moduleBundler({
311
- options: getModuleBundlerOptions({name: "sap-ui-core-dbg.js", filters, preload: false}),
312
- resources
343
+ options: getModuleBundlerOptions({
344
+ name: "sap-ui-core-dbg.js", filters, preload: false,
345
+ moduleNameMapping: unoptimizedModuleNameMapping
346
+ }),
347
+ resources: unoptimizedResources
313
348
  }),
314
349
  moduleBundler({
315
350
  options: getModuleBundlerOptions({
@@ -319,17 +354,27 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
319
354
  }),
320
355
  moduleBundler({
321
356
  options: getModuleBundlerOptions({
322
- name: "sap-ui-core-nojQuery-dbg.js", filters, preload: false, provided: true
357
+ name: "sap-ui-core-nojQuery-dbg.js", filters, preload: false, provided: true,
358
+ moduleNameMapping: unoptimizedModuleNameMapping
323
359
  }),
324
- resources
360
+ resources: unoptimizedResources
325
361
  }),
326
362
  ]).then((results) => {
327
363
  const bundles = Array.prototype.concat.apply([], results);
328
- return Promise.all(bundles.map((bundle) => {
364
+ return Promise.all(bundles.map(({bundle, sourceMap}) => {
329
365
  if (taskUtil) {
330
366
  taskUtil.setTag(bundle, taskUtil.STANDARD_TAGS.IsBundle);
367
+ if (sourceMap) {
368
+ // Clear tag that might have been set by the minify task, in cases where
369
+ // the bundle name is identical to a source file
370
+ taskUtil.clearTag(sourceMap, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
371
+ }
372
+ }
373
+ const writes = [workspace.write(bundle)];
374
+ if (sourceMap) {
375
+ writes.push(workspace.write(sourceMap));
331
376
  }
332
- return workspace.write(bundle);
377
+ return Promise.all(writes);
333
378
  }));
334
379
  });
335
380
  }
@@ -367,12 +412,22 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
367
412
  return createLibraryBundles(libraryNamespace, resources, excludes)
368
413
  .then((results) => {
369
414
  const bundles = Array.prototype.concat.apply([], results);
370
- return Promise.all(bundles.map((bundle) => {
415
+ return Promise.all(bundles.map(({bundle, sourceMap} = {}) => {
371
416
  if (bundle) {
372
417
  if (taskUtil) {
373
418
  taskUtil.setTag(bundle, taskUtil.STANDARD_TAGS.IsBundle);
419
+ if (sourceMap) {
420
+ // Clear tag that might have been set by the minify task, in cases where
421
+ // the bundle name is identical to a source file
422
+ taskUtil.clearTag(sourceMap,
423
+ taskUtil.STANDARD_TAGS.OmitFromBuildResult);
424
+ }
425
+ }
426
+ const writes = [workspace.write(bundle)];
427
+ if (sourceMap) {
428
+ writes.push(workspace.write(sourceMap));
374
429
  }
375
- return workspace.write(bundle);
430
+ return Promise.all(writes);
376
431
  }
377
432
  }));
378
433
  });
@@ -1,5 +1,7 @@
1
1
  const log = require("@ui5/logger").getLogger("builder:tasks:bundlers:generateStandaloneAppBundle");
2
+ const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritized;
2
3
  const moduleBundler = require("../../processors/bundlers/moduleBundler");
4
+ const createModuleNameMapping = require("./utils/createModuleNameMapping");
3
5
 
4
6
  function getBundleDefinition(config) {
5
7
  const bundleDefinition = {
@@ -76,13 +78,18 @@ module.exports = async function({workspace, dependencies, taskUtil, options: {pr
76
78
  `unable to generate complete bundles for such projects.`);
77
79
  }
78
80
 
79
- // If an application does not have a namespace, its resources are located at the root. Otherwise in /resources
80
- // For dependencies, we do not want to search in their test-resources
81
- const results = await Promise.all([
82
- workspace.byGlob("/**/*.{js,json,xml,html,properties,library}"),
83
- dependencies.byGlob("/resources/**/*.{js,json,xml,html,properties,library}")
84
- ]);
85
- const resources = Array.prototype.concat.apply([], results);
81
+ let combo = new ReaderCollectionPrioritized({
82
+ name: `generateStandaloneAppBundle - prioritize workspace over dependencies: ${projectName}`,
83
+ readers: [workspace, dependencies]
84
+ });
85
+
86
+ if (taskUtil) {
87
+ // Omit -dbg files
88
+ combo = combo.filter(function(resource) {
89
+ return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.IsDebugVariant);
90
+ });
91
+ }
92
+ const resources = await combo.byGlob("/resources/**/*.{js,json,xml,html,properties,library,js.map}");
86
93
 
87
94
  const isEvo = resources.find((resource) => {
88
95
  return resource.getPath() === "/resources/ui5loader.js";
@@ -94,6 +101,23 @@ module.exports = async function({workspace, dependencies, taskUtil, options: {pr
94
101
  filters = ["jquery.sap.global.js"];
95
102
  }
96
103
 
104
+ let unoptimizedModuleNameMapping;
105
+ let unoptimizedResources = resources;
106
+ if (taskUtil) {
107
+ unoptimizedResources = await new ReaderCollectionPrioritized({
108
+ name: `generateStandaloneAppBundle - prioritize workspace over dependencies: ${projectName}`,
109
+ readers: [workspace, dependencies]
110
+ }).filter(function(resource) {
111
+ // Remove any non-debug variants
112
+ return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
113
+ }).byGlob("/resources/**/*.{js,json,xml,html,properties,library,js.map}");
114
+
115
+ unoptimizedModuleNameMapping = createModuleNameMapping({
116
+ resources: unoptimizedResources,
117
+ taskUtil
118
+ });
119
+ }
120
+
97
121
  await Promise.all([
98
122
  moduleBundler({
99
123
  resources,
@@ -107,7 +131,7 @@ module.exports = async function({workspace, dependencies, taskUtil, options: {pr
107
131
  }
108
132
  }),
109
133
  moduleBundler({
110
- resources,
134
+ resources: unoptimizedResources,
111
135
  options: {
112
136
  bundleDefinition: getBundleDefinition({
113
137
  name: "sap-ui-custom-dbg.js",
@@ -116,16 +140,26 @@ module.exports = async function({workspace, dependencies, taskUtil, options: {pr
116
140
  }),
117
141
  bundleOptions: {
118
142
  optimize: false
119
- }
143
+ },
144
+ moduleNameMapping: unoptimizedModuleNameMapping
120
145
  }
121
146
  })
122
147
  ]).then((results) => {
123
148
  const bundles = Array.prototype.concat.apply([], results);
124
- return Promise.all(bundles.map((resource) => {
149
+ return Promise.all(bundles.map(({bundle, sourceMap}) => {
125
150
  if (taskUtil) {
126
- taskUtil.setTag(resource, taskUtil.STANDARD_TAGS.IsBundle);
151
+ taskUtil.setTag(bundle, taskUtil.STANDARD_TAGS.IsBundle);
152
+ if (sourceMap) {
153
+ // Clear tag that might have been set by the minify task, in cases where
154
+ // the bundle name is identical to a source file
155
+ taskUtil.clearTag(sourceMap, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
156
+ }
157
+ }
158
+ const writes = [workspace.write(bundle)];
159
+ if (sourceMap) {
160
+ writes.push(workspace.write(sourceMap));
127
161
  }
128
- return workspace.write(resource);
162
+ return Promise.all(writes);
129
163
  }));
130
164
  });
131
165
  };
@@ -0,0 +1,30 @@
1
+ const ModuleName = require("../../../lbt/utils/ModuleName");
2
+
3
+ /**
4
+ * For "unoptimized" bundles, the non-debug files have already been filtered out above.
5
+ * Now we need to create a mapping from the debug-variant resource path to the respective module
6
+ * name, which is basically the non-debug resource path, minus the "/resources/"" prefix.
7
+ * This mapping overwrites internal logic of the LocatorResourcePool which would otherwise determine
8
+ * the module name from the resource path, which would contain "-dbg" in this case. That would be
9
+ * incorrect since debug-variants should still keep the original module name.
10
+ *
11
+ * @private
12
+ * @param {object} parameters Parameters
13
+ * @param {module:@ui5/fs.Resource[]} parameters.resources List of resources
14
+ * @param {module:@ui5/builder.tasks.TaskUtil|object} parameters.taskUtil TaskUtil
15
+ * @returns {object} Module name mapping
16
+ */
17
+ module.exports = function({resources, taskUtil}) {
18
+ const moduleNameMapping = {};
19
+ for (let i = resources.length - 1; i >= 0; i--) {
20
+ const resourcePath = resources[i].getPath();
21
+ if (taskUtil.getTag(resourcePath, taskUtil.STANDARD_TAGS.IsDebugVariant)) {
22
+ const nonDbgPath = ModuleName.getNonDebugName(resourcePath);
23
+ if (!nonDbgPath) {
24
+ throw new Error(`Failed to resolve non-debug name for ${resourcePath}`);
25
+ }
26
+ moduleNameMapping[resourcePath] = nonDbgPath.slice("/resources/".length);
27
+ }
28
+ }
29
+ return moduleNameMapping;
30
+ };
@@ -96,19 +96,25 @@ function getCreatorOptions(projectName) {
96
96
  * @alias module:@ui5/builder.tasks.generateResourcesJson
97
97
  * @param {object} parameters Parameters
98
98
  * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
99
- * @param {module:@ui5/fs.AbstractReader} [parameters.dependencies] Reader or Collection to read dependency files
99
+ * @param {module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
100
+ * @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
100
101
  * @param {object} parameters.options Options
101
102
  * @param {string} parameters.options.projectName Project name
102
103
  * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
103
104
  */
104
- module.exports = async function({workspace, dependencies, options: {projectName}}) {
105
- const resources = await workspace.byGlob(["/resources/**/*"].concat(DEFAULT_EXCLUDES));
105
+ module.exports = async function({workspace, dependencies, taskUtil, options: {projectName}}) {
106
+ let resources = await workspace.byGlob(["/resources/**/*"].concat(DEFAULT_EXCLUDES));
107
+ let dependencyResources =
108
+ await dependencies.byGlob("/resources/**/*.{js,json,xml,html,properties,library,js.map}");
106
109
 
107
- // TODO 3.0: Make dependencies parameter mandatory
108
- let dependencyResources;
109
- if (dependencies) {
110
- dependencyResources =
111
- await dependencies.byGlob("/resources/**/*.{js,json,xml,html,properties,library}");
110
+ if (taskUtil) {
111
+ // Filter out resources that will be omitted from the build results
112
+ resources = resources.filter((resource) => {
113
+ return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
114
+ });
115
+ dependencyResources = dependencyResources.filter((resource) => {
116
+ return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
117
+ });
112
118
  }
113
119
 
114
120
  const resourceLists = await resourceListCreator({
@@ -0,0 +1,41 @@
1
+ const minifier = require("../processors/minifier");
2
+
3
+ /**
4
+ * Task to minify resources.
5
+ *
6
+ * @public
7
+ * @alias module:@ui5/builder.tasks.minify
8
+ * @param {object} parameters Parameters
9
+ * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
10
+ * @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
11
+ * @param {object} parameters.options Options
12
+ * @param {string} parameters.options.pattern Pattern to locate the files to be processed
13
+ * @param {boolean} [parameters.options.omitSourceMapResources=true] Whether source map resources shall
14
+ * be tagged as "OmitFromBuildResult" and no sourceMappingURL shall be added to the minified resource
15
+ * @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
16
+ */
17
+ module.exports = async function({workspace, taskUtil, options: {pattern, omitSourceMapResources = true}}) {
18
+ const resources = await workspace.byGlob(pattern);
19
+ const processedResources = await minifier({
20
+ resources,
21
+ options: {
22
+ addSourceMappingUrl: !omitSourceMapResources
23
+ }
24
+ });
25
+
26
+ return Promise.all(processedResources.map(async ({resource, dbgResource, sourceMapResource}) => {
27
+ if (taskUtil) {
28
+ taskUtil.setTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
29
+ taskUtil.setTag(dbgResource, taskUtil.STANDARD_TAGS.IsDebugVariant);
30
+ taskUtil.setTag(sourceMapResource, taskUtil.STANDARD_TAGS.HasDebugVariant);
31
+ if (omitSourceMapResources) {
32
+ taskUtil.setTag(sourceMapResource, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
33
+ }
34
+ }
35
+ return Promise.all([
36
+ workspace.write(resource),
37
+ workspace.write(dbgResource),
38
+ workspace.write(sourceMapResource)
39
+ ]);
40
+ }));
41
+ };
@@ -2,12 +2,11 @@ const taskInfos = {
2
2
  replaceCopyright: {path: "./replaceCopyright"},
3
3
  replaceVersion: {path: "./replaceVersion"},
4
4
  replaceBuildtime: {path: "./replaceBuildtime"},
5
- createDebugFiles: {path: "./createDebugFiles"},
6
5
  escapeNonAsciiCharacters: {path: "./escapeNonAsciiCharacters"},
7
6
  executeJsdocSdkTransformation: {path: "./jsdoc/executeJsdocSdkTransformation"},
8
7
  generateApiIndex: {path: "./jsdoc/generateApiIndex"},
9
8
  generateJsdoc: {path: "./jsdoc/generateJsdoc"},
10
- uglify: {path: "./uglify"},
9
+ minify: {path: "./minify"},
11
10
  buildThemes: {path: "./buildThemes"},
12
11
  transformBootstrapHtml: {path: "./transformBootstrapHtml"},
13
12
  generateLibraryManifest: {path: "./generateLibraryManifest"},
@@ -27,6 +26,11 @@ function getTask(taskName) {
27
26
  const taskInfo = taskInfos[taskName];
28
27
 
29
28
  if (!taskInfo) {
29
+ if (["createDebugFiles", "uglify"].includes(taskName)) {
30
+ throw new Error(
31
+ `Standard task ${taskName} has been removed in UI5 Tooling 3.0. ` +
32
+ `Please see the migration guide at https://sap.github.io/ui5-tooling/updates/migrate-v3/`);
33
+ }
30
34
  throw new Error(`taskRepository: Unknown Task ${taskName}`);
31
35
  }
32
36
  try {
@@ -67,6 +67,27 @@ class ApplicationBuilder extends AbstractBuilder {
67
67
  });
68
68
  }
69
69
 
70
+ // Support rules should not be minified to have readable code in the Support Assistant
71
+ const minificationPattern = ["/**/*.js", "!**/*.support.js"];
72
+ if (["2.6"].includes(project.specVersion)) {
73
+ const minificationExcludes = project.builder && project.builder.minification &&
74
+ project.builder.minification.excludes;
75
+ if (minificationExcludes) {
76
+ // TODO 3.0: namespaces should become mandatory, see existing check above
77
+ const patternPrefix = project.metadata.namespace ? "/resources/" : "/";
78
+ this.enhancePatternWithExcludes(minificationPattern, minificationExcludes, patternPrefix);
79
+ }
80
+ }
81
+ this.addTask("minify", async () => {
82
+ return getTask("minify").task({
83
+ workspace: resourceCollections.workspace,
84
+ taskUtil,
85
+ options: {
86
+ pattern: minificationPattern
87
+ }
88
+ });
89
+ });
90
+
70
91
  const componentPreload = project.builder && project.builder.componentPreload;
71
92
  if (componentPreload && (componentPreload.namespaces || componentPreload.paths)) {
72
93
  this.addTask("generateComponentPreload", async () => {
@@ -138,37 +159,6 @@ class ApplicationBuilder extends AbstractBuilder {
138
159
  });
139
160
  }
140
161
 
141
- const minificationPattern = ["/**/*.js"];
142
- if (["2.6"].includes(project.specVersion)) {
143
- const minificationExcludes = project.builder && project.builder.minification &&
144
- project.builder.minification.excludes;
145
- if (minificationExcludes) {
146
- // TODO 3.0: namespaces should become mandatory, see existing check above
147
- const patternPrefix = project.metadata.namespace ? "/resources/" : "/";
148
- this.enhancePatternWithExcludes(minificationPattern, minificationExcludes, patternPrefix);
149
- }
150
- }
151
- this.addTask("createDebugFiles", async () => {
152
- const createDebugFiles = getTask("createDebugFiles").task;
153
- return createDebugFiles({
154
- workspace: resourceCollections.workspace,
155
- options: {
156
- pattern: minificationPattern
157
- }
158
- });
159
- });
160
-
161
- this.addTask("uglify", async () => {
162
- const uglify = getTask("uglify").task;
163
- return uglify({
164
- workspace: resourceCollections.workspace,
165
- taskUtil,
166
- options: {
167
- pattern: minificationPattern
168
- }
169
- });
170
- });
171
-
172
162
  this.addTask("generateVersionInfo", async () => {
173
163
  return getTask("generateVersionInfo").task({
174
164
  workspace: resourceCollections.workspace,
@@ -209,6 +199,7 @@ class ApplicationBuilder extends AbstractBuilder {
209
199
  return getTask("generateResourcesJson").task({
210
200
  workspace: resourceCollections.workspace,
211
201
  dependencies: resourceCollections.dependencies,
202
+ taskUtil,
212
203
  options: {
213
204
  projectName: project.metadata.name
214
205
  }
@@ -28,7 +28,7 @@ class LibraryBuilder extends AbstractBuilder {
28
28
  workspace: resourceCollections.workspace,
29
29
  options: {
30
30
  copyright: project.metadata.copyright,
31
- pattern: "/resources/**/*.{js,library,less,theme}"
31
+ pattern: "/**/*.{js,library,css,less,theme,html}"
32
32
  }
33
33
  });
34
34
  });
@@ -38,7 +38,7 @@ class LibraryBuilder extends AbstractBuilder {
38
38
  workspace: resourceCollections.workspace,
39
39
  options: {
40
40
  version: project.version,
41
- pattern: "/resources/**/*.{js,json,library,less,theme}"
41
+ pattern: "/**/*.{js,json,library,css,less,theme,html}"
42
42
  }
43
43
  });
44
44
  });
@@ -89,6 +89,26 @@ class LibraryBuilder extends AbstractBuilder {
89
89
  });
90
90
  }
91
91
 
92
+ // Support rules should not be minified to have readable code in the Support Assistant
93
+ const minificationPattern = ["/resources/**/*.js", "!**/*.support.js"];
94
+ if (["2.6"].includes(project.specVersion)) {
95
+ const minificationExcludes = project.builder && project.builder.minification &&
96
+ project.builder.minification.excludes;
97
+ if (minificationExcludes) {
98
+ this.enhancePatternWithExcludes(minificationPattern, minificationExcludes, "/resources/");
99
+ }
100
+ }
101
+
102
+ this.addTask("minify", async () => {
103
+ return getTask("minify").task({
104
+ workspace: resourceCollections.workspace,
105
+ taskUtil,
106
+ options: {
107
+ pattern: minificationPattern
108
+ }
109
+ });
110
+ });
111
+
92
112
  const componentPreload = project.builder && project.builder.componentPreload;
93
113
  if (componentPreload) {
94
114
  this.addTask("generateComponentPreload", async () => {
@@ -195,37 +215,11 @@ class LibraryBuilder extends AbstractBuilder {
195
215
  });
196
216
  });
197
217
 
198
- const minificationPattern = ["/resources/**/*.js"];
199
- if (["2.6"].includes(project.specVersion)) {
200
- const minificationExcludes = project.builder && project.builder.minification &&
201
- project.builder.minification.excludes;
202
- if (minificationExcludes) {
203
- this.enhancePatternWithExcludes(minificationPattern, minificationExcludes, "/resources/");
204
- }
205
- }
206
- this.addTask("createDebugFiles", async () => {
207
- return getTask("createDebugFiles").task({
208
- workspace: resourceCollections.workspace,
209
- options: {
210
- pattern: minificationPattern
211
- }
212
- });
213
- });
214
-
215
- this.addTask("uglify", async () => {
216
- return getTask("uglify").task({
217
- workspace: resourceCollections.workspace,
218
- taskUtil,
219
- options: {
220
- pattern: minificationPattern
221
- }
222
- });
223
- });
224
-
225
218
  this.addTask("generateResourcesJson", () => {
226
219
  return getTask("generateResourcesJson").task({
227
220
  workspace: resourceCollections.workspace,
228
221
  dependencies: resourceCollections.dependencies,
222
+ taskUtil,
229
223
  options: {
230
224
  projectName: project.metadata.name
231
225
  }
@@ -51,6 +51,7 @@ class ThemeLibraryBuilder extends AbstractBuilder {
51
51
  return getTask("generateResourcesJson").task({
52
52
  workspace: resourceCollections.workspace,
53
53
  dependencies: resourceCollections.dependencies,
54
+ taskUtil,
54
55
  options: {
55
56
  projectName: project.metadata.name
56
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.0-alpha.3",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -18,8 +18,8 @@
18
18
  ],
19
19
  "main": "index.js",
20
20
  "engines": {
21
- "node": ">= 10",
22
- "npm": ">= 5"
21
+ "node": ">= 16.13.2",
22
+ "npm": ">= 8"
23
23
  },
24
24
  "scripts": {
25
25
  "test": "npm run lint && npm run jsdoc-generate && npm run coverage && npm run depcheck",
@@ -34,16 +34,17 @@
34
34
  "coverage": "nyc npm run unit",
35
35
  "coverage-xunit": "nyc --reporter=text --reporter=text-summary --reporter=cobertura npm run unit-xunit",
36
36
  "jsdoc": "npm run jsdoc-generate && open-cli jsdocs/index.html",
37
- "jsdoc-generate": "node_modules/.bin/jsdoc -c ./jsdoc.json ./lib/ || (echo 'Error during JSDoc generation! Check log.' && exit 1)",
37
+ "jsdoc-generate": "jsdoc -c ./jsdoc.json -t $(node -p 'path.dirname(require.resolve(\"docdash\"))') ./lib/ || (echo 'Error during JSDoc generation! Check log.' && exit 1)",
38
38
  "jsdoc-watch": "npm run jsdoc && chokidar \"./lib/**/*.js\" -c \"npm run jsdoc-generate\"",
39
39
  "preversion": "npm test",
40
- "version": "git-chglog --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
40
+ "version": "git-chglog --sort semver --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
41
41
  "postversion": "git push --follow-tags",
42
- "release-note": "git-chglog -c .chglog/release-config.yml v$npm_package_version",
42
+ "release-note": "git-chglog --sort semver -c .chglog/release-config.yml v$npm_package_version",
43
43
  "depcheck": "depcheck --ignores docdash"
44
44
  },
45
45
  "files": [
46
46
  "index.js",
47
+ "CHANGELOG.md",
47
48
  "CONTRIBUTING.md",
48
49
  "jsdoc.json",
49
50
  "lib/**",
@@ -104,14 +105,14 @@
104
105
  "url": "git@github.com:SAP/ui5-builder.git"
105
106
  },
106
107
  "dependencies": {
107
- "@ui5/fs": "^3.0.0-alpha.0",
108
- "@ui5/logger": "^3.0.0-alpha.0",
108
+ "@ui5/fs": "^3.0.0-alpha.2",
109
+ "@ui5/logger": "^3.0.1-alpha.1",
109
110
  "cheerio": "1.0.0-rc.9",
110
111
  "escape-unicode": "^0.2.0",
111
112
  "escope": "^3.6.0",
112
- "espree": "^6.2.1",
113
- "globby": "^11.0.4",
114
- "graceful-fs": "^4.2.8",
113
+ "espree": "^9.3.1",
114
+ "globby": "^11.1.0",
115
+ "graceful-fs": "^4.2.9",
115
116
  "jsdoc": "^3.6.7",
116
117
  "less-openui5": "^0.11.2",
117
118
  "make-dir": "^3.1.0",
@@ -120,6 +121,7 @@
120
121
  "replacestream": "^4.0.3",
121
122
  "rimraf": "^3.0.2",
122
123
  "semver": "^7.3.5",
124
+ "sourcemap-codec": "^1.4.8",
123
125
  "terser": "^5.10.0",
124
126
  "xml2js": "^0.4.23",
125
127
  "yazl": "^2.5.1"
@@ -130,11 +132,11 @@
130
132
  "chai-fs": "^2.0.0",
131
133
  "chokidar-cli": "^3.0.0",
132
134
  "cross-env": "^7.0.3",
133
- "depcheck": "^1.4.2",
135
+ "depcheck": "^1.4.3",
134
136
  "docdash": "^1.2.0",
135
- "eslint": "^7.32.0",
137
+ "eslint": "^8.7.0",
136
138
  "eslint-config-google": "^0.14.0",
137
- "eslint-plugin-jsdoc": "^37.2.0",
139
+ "eslint-plugin-jsdoc": "^37.6.3",
138
140
  "extract-zip": "^2.0.1",
139
141
  "mock-require": "^3.0.3",
140
142
  "nyc": "^15.1.0",