@ui5/builder 2.11.4 → 3.0.0-alpha.2

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 +52 -9
  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/bundle/Resolver.js +1 -1
  13. package/lib/lbt/resources/LocatorResource.js +9 -7
  14. package/lib/lbt/resources/LocatorResourcePool.js +8 -4
  15. package/lib/lbt/resources/Resource.js +7 -0
  16. package/lib/lbt/resources/ResourceCollector.js +33 -15
  17. package/lib/lbt/utils/parseUtils.js +1 -1
  18. package/lib/processors/bundlers/moduleBundler.js +39 -14
  19. package/lib/processors/minifier.js +89 -0
  20. package/lib/processors/resourceListCreator.js +2 -16
  21. package/lib/tasks/TaskUtil.js +9 -9
  22. package/lib/tasks/bundlers/generateBundle.js +92 -6
  23. package/lib/tasks/bundlers/generateComponentPreload.js +20 -6
  24. package/lib/tasks/bundlers/generateLibraryPreload.js +77 -10
  25. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +58 -12
  26. package/lib/tasks/generateResourcesJson.js +14 -8
  27. package/lib/tasks/minify.js +39 -0
  28. package/lib/tasks/replaceVersion.js +1 -1
  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 +15 -13
  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 ModuleName = require("../../lbt/utils/ModuleName");
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,36 @@ 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
+ const 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
+ // For "unoptimized" bundles, the non-debug files have already been filtered out above.
326
+ // Now we need to create a mapping from the debug-variant resource path to the respective module
327
+ // name, which is basically the non-debug resource path, minus the "/resources/"" prefix.
328
+ // This mapping overwrites internal logic of the LocatorResourcePool which would otherwise determine
329
+ // the module name from the resource path, which would contain "-dbg" in this case. That would be
330
+ // incorrect since debug-variants should still keep the original module name.
331
+ for (let i = unoptimizedResources.length - 1; i >= 0; i--) {
332
+ const resourcePath = unoptimizedResources[i].getPath();
333
+ if (taskUtil.getTag(resourcePath, taskUtil.STANDARD_TAGS.IsDebugVariant)) {
334
+ const nonDbgPath = ModuleName.getNonDebugName(resourcePath);
335
+ if (!nonDbgPath) {
336
+ throw new Error(`Failed to resolve non-debug name for ${resourcePath}`);
337
+ }
338
+ unoptimizedModuleNameMapping[resourcePath] = nonDbgPath.slice("/resources/".length);
339
+ }
340
+ }
341
+ }
342
+
299
343
  let filters;
300
344
  if (isEvo) {
301
345
  filters = ["ui5loader-autoconfig.js"];
@@ -308,8 +352,11 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
308
352
  resources
309
353
  }),
310
354
  moduleBundler({
311
- options: getModuleBundlerOptions({name: "sap-ui-core-dbg.js", filters, preload: false}),
312
- resources
355
+ options: getModuleBundlerOptions({
356
+ name: "sap-ui-core-dbg.js", filters, preload: false,
357
+ moduleNameMapping: unoptimizedModuleNameMapping
358
+ }),
359
+ resources: unoptimizedResources
313
360
  }),
314
361
  moduleBundler({
315
362
  options: getModuleBundlerOptions({
@@ -319,17 +366,27 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
319
366
  }),
320
367
  moduleBundler({
321
368
  options: getModuleBundlerOptions({
322
- name: "sap-ui-core-nojQuery-dbg.js", filters, preload: false, provided: true
369
+ name: "sap-ui-core-nojQuery-dbg.js", filters, preload: false, provided: true,
370
+ moduleNameMapping: unoptimizedModuleNameMapping
323
371
  }),
324
- resources
372
+ resources: unoptimizedResources
325
373
  }),
326
374
  ]).then((results) => {
327
375
  const bundles = Array.prototype.concat.apply([], results);
328
- return Promise.all(bundles.map((bundle) => {
376
+ return Promise.all(bundles.map(({bundle, sourceMap}) => {
329
377
  if (taskUtil) {
330
378
  taskUtil.setTag(bundle, taskUtil.STANDARD_TAGS.IsBundle);
379
+ if (sourceMap) {
380
+ // Clear tag that might have been set by the minify task, in cases where
381
+ // the bundle name is identical to a source file
382
+ taskUtil.clearTag(sourceMap, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
383
+ }
331
384
  }
332
- return workspace.write(bundle);
385
+ const writes = [workspace.write(bundle)];
386
+ if (sourceMap) {
387
+ writes.push(workspace.write(sourceMap));
388
+ }
389
+ return Promise.all(writes);
333
390
  }));
334
391
  });
335
392
  }
@@ -367,12 +424,22 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
367
424
  return createLibraryBundles(libraryNamespace, resources, excludes)
368
425
  .then((results) => {
369
426
  const bundles = Array.prototype.concat.apply([], results);
370
- return Promise.all(bundles.map((bundle) => {
427
+ return Promise.all(bundles.map(({bundle, sourceMap} = {}) => {
371
428
  if (bundle) {
372
429
  if (taskUtil) {
373
430
  taskUtil.setTag(bundle, taskUtil.STANDARD_TAGS.IsBundle);
431
+ if (sourceMap) {
432
+ // Clear tag that might have been set by the minify task, in cases where
433
+ // the bundle name is identical to a source file
434
+ taskUtil.clearTag(sourceMap,
435
+ taskUtil.STANDARD_TAGS.OmitFromBuildResult);
436
+ }
437
+ }
438
+ const writes = [workspace.write(bundle)];
439
+ if (sourceMap) {
440
+ writes.push(workspace.write(sourceMap));
374
441
  }
375
- return workspace.write(bundle);
442
+ return Promise.all(writes);
376
443
  }
377
444
  }));
378
445
  });
@@ -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 ModuleName = require("../../lbt/utils/ModuleName");
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,35 @@ module.exports = async function({workspace, dependencies, taskUtil, options: {pr
94
101
  filters = ["jquery.sap.global.js"];
95
102
  }
96
103
 
104
+ const 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
+ // For "unoptimized" bundles, the non-debug files have already been filtered out above.
116
+ // Now we need to create a mapping from the debug-variant resource path to the respective module name,
117
+ // which is basically the non-debug resource path, minus the "/resources/"" prefix.
118
+ // This mapping overwrites internal logic of the LocatorResourcePool which would otherwise determine
119
+ // the module name from the resource path, which would contain "-dbg" in this case. That would be
120
+ // incorrect since debug-variants should still keep the original module name.
121
+ for (let i = unoptimizedResources.length - 1; i >= 0; i--) {
122
+ const resourcePath = unoptimizedResources[i].getPath();
123
+ if (taskUtil.getTag(resourcePath, taskUtil.STANDARD_TAGS.IsDebugVariant)) {
124
+ const nonDbgPath = ModuleName.getNonDebugName(resourcePath);
125
+ if (!nonDbgPath) {
126
+ throw new Error(`Failed to resolve non-debug name for ${resourcePath}`);
127
+ }
128
+ unoptimizedModuleNameMapping[resourcePath] = nonDbgPath.slice("/resources/".length);
129
+ }
130
+ }
131
+ }
132
+
97
133
  await Promise.all([
98
134
  moduleBundler({
99
135
  resources,
@@ -107,7 +143,7 @@ module.exports = async function({workspace, dependencies, taskUtil, options: {pr
107
143
  }
108
144
  }),
109
145
  moduleBundler({
110
- resources,
146
+ resources: unoptimizedResources,
111
147
  options: {
112
148
  bundleDefinition: getBundleDefinition({
113
149
  name: "sap-ui-custom-dbg.js",
@@ -116,16 +152,26 @@ module.exports = async function({workspace, dependencies, taskUtil, options: {pr
116
152
  }),
117
153
  bundleOptions: {
118
154
  optimize: false
119
- }
155
+ },
156
+ moduleNameMapping: unoptimizedModuleNameMapping
120
157
  }
121
158
  })
122
159
  ]).then((results) => {
123
160
  const bundles = Array.prototype.concat.apply([], results);
124
- return Promise.all(bundles.map((resource) => {
161
+ return Promise.all(bundles.map(({bundle, sourceMap}) => {
125
162
  if (taskUtil) {
126
- taskUtil.setTag(resource, taskUtil.STANDARD_TAGS.IsBundle);
163
+ taskUtil.setTag(bundle, taskUtil.STANDARD_TAGS.IsBundle);
164
+ if (sourceMap) {
165
+ // Clear tag that might have been set by the minify task, in cases where
166
+ // the bundle name is identical to a source file
167
+ taskUtil.clearTag(sourceMap, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
168
+ }
169
+ }
170
+ const writes = [workspace.write(bundle)];
171
+ if (sourceMap) {
172
+ writes.push(workspace.write(sourceMap));
127
173
  }
128
- return workspace.write(resource);
174
+ return Promise.all(writes);
129
175
  }));
130
176
  });
131
177
  };
@@ -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,39 @@
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
+ addSourceMappingUrl: !omitSourceMapResources
22
+ });
23
+
24
+ return Promise.all(processedResources.map(async ({resource, dbgResource, sourceMapResource}) => {
25
+ if (taskUtil) {
26
+ taskUtil.setTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
27
+ taskUtil.setTag(dbgResource, taskUtil.STANDARD_TAGS.IsDebugVariant);
28
+ taskUtil.setTag(sourceMapResource, taskUtil.STANDARD_TAGS.HasDebugVariant);
29
+ if (omitSourceMapResources) {
30
+ taskUtil.setTag(sourceMapResource, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
31
+ }
32
+ }
33
+ return Promise.all([
34
+ workspace.write(resource),
35
+ workspace.write(dbgResource),
36
+ workspace.write(sourceMapResource)
37
+ ]);
38
+ }));
39
+ };
@@ -18,7 +18,7 @@ module.exports = function({workspace, options: {pattern, version}}) {
18
18
  return stringReplacer({
19
19
  resources: allResources,
20
20
  options: {
21
- pattern: "${version}",
21
+ pattern: /\$\{(?:project\.)?version\}/g,
22
22
  replacement: version
23
23
  }
24
24
  });
@@ -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,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": "2.11.4",
3
+ "version": "3.0.0-alpha.2",
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,15 +105,15 @@
104
105
  "url": "git@github.com:SAP/ui5-builder.git"
105
106
  },
106
107
  "dependencies": {
107
- "@ui5/fs": "^2.0.6",
108
- "@ui5/logger": "^2.0.1",
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
+ "espree": "^9.3.1",
113
114
  "globby": "^11.1.0",
114
115
  "graceful-fs": "^4.2.9",
115
- "jsdoc": "^3.6.10",
116
+ "jsdoc": "^3.6.7",
116
117
  "less-openui5": "^0.11.2",
117
118
  "make-dir": "^3.1.0",
118
119
  "pretty-data": "^0.40.0",
@@ -120,21 +121,22 @@
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"
126
128
  },
127
129
  "devDependencies": {
128
130
  "ava": "^3.15.0",
129
- "chai": "^4.3.6",
131
+ "chai": "^4.3.4",
130
132
  "chai-fs": "^2.0.0",
131
133
  "chokidar-cli": "^3.0.0",
132
134
  "cross-env": "^7.0.3",
133
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.9.4",
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",