@ui5/builder 3.0.0-alpha.0 → 3.0.0-alpha.1
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/index.js +4 -16
- package/jsdoc.json +0 -1
- package/lib/builder/BuildContext.js +17 -0
- package/lib/builder/ProjectBuildContext.js +9 -7
- package/lib/builder/builder.js +1 -2
- package/lib/lbt/analyzer/JSModuleAnalyzer.js +7 -0
- package/lib/lbt/bundle/AutoSplitter.js +10 -24
- package/lib/lbt/bundle/Builder.js +13 -41
- package/lib/lbt/resources/LocatorResource.js +0 -2
- package/lib/lbt/resources/Resource.js +7 -0
- package/lib/lbt/resources/ResourceCollector.js +33 -15
- package/lib/lbt/utils/parseUtils.js +1 -1
- package/lib/processors/bundlers/moduleBundler.js +11 -7
- package/lib/processors/minifier.js +84 -0
- package/lib/processors/resourceListCreator.js +2 -16
- package/lib/tasks/TaskUtil.js +9 -9
- package/lib/tasks/bundlers/generateBundle.js +30 -2
- package/lib/tasks/bundlers/generateComponentPreload.js +8 -1
- package/lib/tasks/bundlers/generateLibraryPreload.js +33 -4
- package/lib/tasks/bundlers/generateStandaloneAppBundle.js +13 -6
- package/lib/tasks/generateResourcesJson.js +14 -8
- package/lib/tasks/minify.js +31 -0
- package/lib/tasks/taskRepository.js +6 -2
- package/lib/types/application/ApplicationBuilder.js +22 -31
- package/lib/types/library/LibraryBuilder.js +21 -27
- package/lib/types/themeLibrary/ThemeLibraryBuilder.js +1 -0
- package/package.json +12 -12
- package/CHANGELOG.md +0 -726
- package/lib/processors/debugFileCreator.js +0 -52
- package/lib/processors/resourceCopier.js +0 -24
- package/lib/processors/uglifier.js +0 -45
- package/lib/tasks/createDebugFiles.js +0 -30
- package/lib/tasks/uglify.js +0 -33
package/lib/tasks/TaskUtil.js
CHANGED
|
@@ -51,14 +51,14 @@ class TaskUtil {
|
|
|
51
51
|
* This method is only available to custom task extensions defining
|
|
52
52
|
* <b>Specification Version 2.2 and above</b>.
|
|
53
53
|
*
|
|
54
|
-
* @param {module:@ui5/fs.Resource}
|
|
54
|
+
* @param {string|module:@ui5/fs.Resource} resourcePath Path or resource-instance the tag should be stored for
|
|
55
55
|
* @param {string} tag Name of the tag.
|
|
56
56
|
* Currently only the [STANDARD_TAGS]{@link module:@ui5/builder.tasks.TaskUtil#STANDARD_TAGS} are allowed
|
|
57
57
|
* @param {string|boolean|integer} [value=true] Tag value. Must be primitive
|
|
58
58
|
* @public
|
|
59
59
|
*/
|
|
60
|
-
setTag(
|
|
61
|
-
return this._projectBuildContext.getResourceTagCollection().setTag(
|
|
60
|
+
setTag(resourcePath, tag, value) {
|
|
61
|
+
return this._projectBuildContext.getResourceTagCollection().setTag(resourcePath, tag, value);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
@@ -68,14 +68,14 @@ class TaskUtil {
|
|
|
68
68
|
* This method is only available to custom task extensions defining
|
|
69
69
|
* <b>Specification Version 2.2 and above</b>.
|
|
70
70
|
*
|
|
71
|
-
* @param {module:@ui5/fs.Resource}
|
|
71
|
+
* @param {string|module:@ui5/fs.Resource} resourcePath Path or resource-instance the tag should be retrieved for
|
|
72
72
|
* @param {string} tag Name of the tag
|
|
73
73
|
* @returns {string|boolean|integer|undefined} Tag value for the given resource.
|
|
74
74
|
* <code>undefined</code> if no value is available
|
|
75
75
|
* @public
|
|
76
76
|
*/
|
|
77
|
-
getTag(
|
|
78
|
-
return this._projectBuildContext.getResourceTagCollection().getTag(
|
|
77
|
+
getTag(resourcePath, tag) {
|
|
78
|
+
return this._projectBuildContext.getResourceTagCollection().getTag(resourcePath, tag);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/**
|
|
@@ -86,12 +86,12 @@ class TaskUtil {
|
|
|
86
86
|
* This method is only available to custom task extensions defining
|
|
87
87
|
* <b>Specification Version 2.2 and above</b>.
|
|
88
88
|
*
|
|
89
|
-
* @param {module:@ui5/fs.Resource}
|
|
89
|
+
* @param {string|module:@ui5/fs.Resource} resourcePath Path or resource-instance the tag should be cleared for
|
|
90
90
|
* @param {string} tag Tag
|
|
91
91
|
* @public
|
|
92
92
|
*/
|
|
93
|
-
clearTag(
|
|
94
|
-
return this._projectBuildContext.getResourceTagCollection().clearTag(
|
|
93
|
+
clearTag(resourcePath, tag) {
|
|
94
|
+
return this._projectBuildContext.getResourceTagCollection().clearTag(resourcePath, tag);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const moduleBundler = require("../../processors/bundlers/moduleBundler");
|
|
2
|
+
const ModuleName = require("../../lbt/utils/ModuleName");
|
|
2
3
|
const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritized;
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -13,17 +14,44 @@ const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritiz
|
|
|
13
14
|
* @param {object} parameters.options Options
|
|
14
15
|
* @param {string} parameters.options.projectName Project name
|
|
15
16
|
* @param {ModuleBundleDefinition} parameters.options.bundleDefinition Module bundle definition
|
|
16
|
-
* @param {ModuleBundleOptions} parameters.options.bundleOptions Module bundle options
|
|
17
|
+
* @param {ModuleBundleOptions} [parameters.options.bundleOptions] Module bundle options
|
|
17
18
|
* @returns {Promise} Promise resolving with <code>undefined</code> once data has been written
|
|
18
19
|
*/
|
|
19
20
|
module.exports = function({
|
|
20
21
|
workspace, dependencies, taskUtil, options: {projectName, bundleDefinition, bundleOptions}
|
|
21
22
|
}) {
|
|
22
|
-
|
|
23
|
+
let combo = new ReaderCollectionPrioritized({
|
|
23
24
|
name: `libraryBundler - prioritize workspace over dependencies: ${projectName}`,
|
|
24
25
|
readers: [workspace, dependencies]
|
|
25
26
|
});
|
|
26
27
|
|
|
28
|
+
if (taskUtil) {
|
|
29
|
+
const optimize = !bundleOptions || bundleOptions.optimize !== false;
|
|
30
|
+
|
|
31
|
+
// Omit -dbg files for optimize bundles and vice versa
|
|
32
|
+
const filterTag = optimize ?
|
|
33
|
+
taskUtil.STANDARD_TAGS.IsDebugVariant : taskUtil.STANDARD_TAGS.HasDebugVariant;
|
|
34
|
+
combo = combo.filter(function(resource) {
|
|
35
|
+
return !taskUtil.getTag(resource, filterTag);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (!optimize) {
|
|
39
|
+
// For "unoptimized" bundles, the non-debug files have already been filtered out
|
|
40
|
+
// Now rename the debug variants to the same name so that they appear like the original
|
|
41
|
+
// resource to the bundler
|
|
42
|
+
combo = combo.transformer(async function(resourcePath, getResource) {
|
|
43
|
+
if (taskUtil.getTag(resourcePath, taskUtil.STANDARD_TAGS.IsDebugVariant)) {
|
|
44
|
+
const resource = await getResource();
|
|
45
|
+
const nonDbgPath = ModuleName.getNonDebugName(resource.getPath());
|
|
46
|
+
if (!nonDbgPath) {
|
|
47
|
+
throw new Error(`Failed to resolve non-debug name for ${resource.getPath()}`);
|
|
48
|
+
}
|
|
49
|
+
resource.setPath(nonDbgPath);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
27
55
|
return combo.byGlob("/resources/**/*.{js,json,xml,html,properties,library}").then((resources) => {
|
|
28
56
|
return moduleBundler({
|
|
29
57
|
options: {
|
|
@@ -28,11 +28,18 @@ const {negateFilters} = require("../../lbt/resources/ResourceFilterList");
|
|
|
28
28
|
module.exports = function({
|
|
29
29
|
workspace, dependencies, taskUtil, options: {projectName, paths, namespaces, excludes = []}
|
|
30
30
|
}) {
|
|
31
|
-
|
|
31
|
+
let combo = new ReaderCollectionPrioritized({
|
|
32
32
|
name: `generateComponentPreload - prioritize workspace over dependencies: ${projectName}`,
|
|
33
33
|
readers: [workspace, dependencies]
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
+
if (taskUtil) {
|
|
37
|
+
combo = combo.filter(function(resource) {
|
|
38
|
+
// Remove any debug variants
|
|
39
|
+
return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.IsDebugVariant);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
36
43
|
// TODO 3.0: Limit to workspace resources?
|
|
37
44
|
return combo.byGlob("/resources/**/*.{js,json,xml,html,properties,library}")
|
|
38
45
|
.then(async (resources) => {
|
|
@@ -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 = [
|
|
@@ -272,12 +273,19 @@ function getSapUiCoreBunDef(name, filters, preload) {
|
|
|
272
273
|
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
273
274
|
*/
|
|
274
275
|
module.exports = function({workspace, dependencies, taskUtil, options: {projectName, excludes = []}}) {
|
|
275
|
-
|
|
276
|
+
let combo = new ReaderCollectionPrioritized({
|
|
276
277
|
name: `libraryBundler - prioritize workspace over dependencies: ${projectName}`,
|
|
277
278
|
readers: [workspace, dependencies]
|
|
278
279
|
});
|
|
279
280
|
|
|
280
|
-
|
|
281
|
+
if (taskUtil) {
|
|
282
|
+
combo = combo.filter(function(resource) {
|
|
283
|
+
// Remove any debug variants
|
|
284
|
+
return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.IsDebugVariant);
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return combo.byGlob("/**/*.{js,json,xml,html,properties,library}").then(async (resources) => {
|
|
281
289
|
// Find all libraries and create a library-preload.js bundle
|
|
282
290
|
|
|
283
291
|
let p = Promise.resolve();
|
|
@@ -296,6 +304,27 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
|
|
|
296
304
|
const isEvo = resources.find((resource) => {
|
|
297
305
|
return resource.getPath() === "/resources/ui5loader.js";
|
|
298
306
|
});
|
|
307
|
+
|
|
308
|
+
let unoptimizedResources = resources;
|
|
309
|
+
if (taskUtil) {
|
|
310
|
+
unoptimizedResources = await new ReaderCollectionPrioritized({
|
|
311
|
+
name: `libraryBundler - prioritize workspace over dependencies: ${projectName}`,
|
|
312
|
+
readers: [workspace, dependencies]
|
|
313
|
+
}).filter(function(resource) {
|
|
314
|
+
// Remove any non-debug variants
|
|
315
|
+
return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
|
|
316
|
+
}).transformer(async function(resourcePath, getResource) {
|
|
317
|
+
if (taskUtil.getTag(resourcePath, taskUtil.STANDARD_TAGS.IsDebugVariant)) {
|
|
318
|
+
const resource = await getResource();
|
|
319
|
+
const nonDbgPath = ModuleName.getNonDebugName(resource.getPath());
|
|
320
|
+
if (!nonDbgPath) {
|
|
321
|
+
throw new Error(`Failed to resolve non-debug name for ${resource.getPath()}`);
|
|
322
|
+
}
|
|
323
|
+
resource.setPath(nonDbgPath);
|
|
324
|
+
}
|
|
325
|
+
}).byGlob("/**/*.{js,json,xml,html,properties,library}");
|
|
326
|
+
}
|
|
327
|
+
|
|
299
328
|
let filters;
|
|
300
329
|
if (isEvo) {
|
|
301
330
|
filters = ["ui5loader-autoconfig.js"];
|
|
@@ -309,7 +338,7 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
|
|
|
309
338
|
}),
|
|
310
339
|
moduleBundler({
|
|
311
340
|
options: getModuleBundlerOptions({name: "sap-ui-core-dbg.js", filters, preload: false}),
|
|
312
|
-
resources
|
|
341
|
+
resources: unoptimizedResources
|
|
313
342
|
}),
|
|
314
343
|
moduleBundler({
|
|
315
344
|
options: getModuleBundlerOptions({
|
|
@@ -321,7 +350,7 @@ module.exports = function({workspace, dependencies, taskUtil, options: {projectN
|
|
|
321
350
|
options: getModuleBundlerOptions({
|
|
322
351
|
name: "sap-ui-core-nojQuery-dbg.js", filters, preload: false, provided: true
|
|
323
352
|
}),
|
|
324
|
-
resources
|
|
353
|
+
resources: unoptimizedResources
|
|
325
354
|
}),
|
|
326
355
|
]).then((results) => {
|
|
327
356
|
const bundles = Array.prototype.concat.apply([], results);
|
|
@@ -1,4 +1,5 @@
|
|
|
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");
|
|
3
4
|
|
|
4
5
|
function getBundleDefinition(config) {
|
|
@@ -76,12 +77,18 @@ module.exports = async function({workspace, dependencies, taskUtil, options: {pr
|
|
|
76
77
|
`unable to generate complete bundles for such projects.`);
|
|
77
78
|
}
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
let combo = new ReaderCollectionPrioritized({
|
|
81
|
+
name: `generateStandaloneAppBundle - prioritize workspace over dependencies: ${projectName}`,
|
|
82
|
+
readers: [workspace, dependencies]
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
if (taskUtil) {
|
|
86
|
+
// Omit -dbg files
|
|
87
|
+
combo = combo.filter(function(resource) {
|
|
88
|
+
return !taskUtil.getTag(resource, taskUtil.STANDARD_TAGS.IsDebugVariant);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const results = await combo.byGlob("/resources/**/*.{js,json,xml,html,properties,library}");
|
|
85
92
|
const resources = Array.prototype.concat.apply([], results);
|
|
86
93
|
|
|
87
94
|
const isEvo = resources.find((resource) => {
|
|
@@ -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}
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
// TODO 3.0: Make dependencies parameter mandatory
|
|
108
|
-
let dependencyResources;
|
|
109
|
-
if (dependencies) {
|
|
110
|
-
dependencyResources =
|
|
105
|
+
module.exports = async function({workspace, dependencies, taskUtil, options: {projectName}}) {
|
|
106
|
+
let resources = await workspace.byGlob(["/resources/**/*"].concat(DEFAULT_EXCLUDES));
|
|
107
|
+
let dependencyResources =
|
|
111
108
|
await dependencies.byGlob("/resources/**/*.{js,json,xml,html,properties,library}");
|
|
109
|
+
|
|
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,31 @@
|
|
|
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
|
+
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
14
|
+
*/
|
|
15
|
+
module.exports = async function({workspace, taskUtil, options: {pattern}}) {
|
|
16
|
+
const resources = await workspace.byGlob(pattern);
|
|
17
|
+
const processedResources = await minifier({resources});
|
|
18
|
+
|
|
19
|
+
return Promise.all(processedResources.map(async ({resource, dbgResource, sourceMapResource}) => {
|
|
20
|
+
if (taskUtil) {
|
|
21
|
+
taskUtil.setTag(resource, taskUtil.STANDARD_TAGS.HasDebugVariant);
|
|
22
|
+
taskUtil.setTag(dbgResource, taskUtil.STANDARD_TAGS.IsDebugVariant);
|
|
23
|
+
taskUtil.setTag(sourceMapResource, taskUtil.STANDARD_TAGS.OmitFromBuildResult);
|
|
24
|
+
}
|
|
25
|
+
return Promise.all([
|
|
26
|
+
workspace.write(resource),
|
|
27
|
+
workspace.write(dbgResource),
|
|
28
|
+
workspace.write(sourceMapResource)
|
|
29
|
+
]);
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
@@ -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
|
-
|
|
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
|
}
|
|
@@ -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.
|
|
3
|
+
"version": "3.0.0-alpha.1",
|
|
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": ">=
|
|
22
|
-
"npm": ">=
|
|
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,7 +34,7 @@
|
|
|
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": "
|
|
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
40
|
"version": "git-chglog --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
|
|
@@ -104,14 +104,14 @@
|
|
|
104
104
|
"url": "git@github.com:SAP/ui5-builder.git"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"@ui5/fs": "^3.0.0-alpha.
|
|
108
|
-
"@ui5/logger": "^3.0.
|
|
107
|
+
"@ui5/fs": "^3.0.0-alpha.2",
|
|
108
|
+
"@ui5/logger": "^3.0.1-alpha.1",
|
|
109
109
|
"cheerio": "1.0.0-rc.9",
|
|
110
110
|
"escape-unicode": "^0.2.0",
|
|
111
111
|
"escope": "^3.6.0",
|
|
112
|
-
"espree": "^
|
|
113
|
-
"globby": "^11.0
|
|
114
|
-
"graceful-fs": "^4.2.
|
|
112
|
+
"espree": "^9.3.0",
|
|
113
|
+
"globby": "^11.1.0",
|
|
114
|
+
"graceful-fs": "^4.2.9",
|
|
115
115
|
"jsdoc": "^3.6.7",
|
|
116
116
|
"less-openui5": "^0.11.2",
|
|
117
117
|
"make-dir": "^3.1.0",
|
|
@@ -130,11 +130,11 @@
|
|
|
130
130
|
"chai-fs": "^2.0.0",
|
|
131
131
|
"chokidar-cli": "^3.0.0",
|
|
132
132
|
"cross-env": "^7.0.3",
|
|
133
|
-
"depcheck": "^1.4.
|
|
133
|
+
"depcheck": "^1.4.3",
|
|
134
134
|
"docdash": "^1.2.0",
|
|
135
|
-
"eslint": "^7.
|
|
135
|
+
"eslint": "^8.7.0",
|
|
136
136
|
"eslint-config-google": "^0.14.0",
|
|
137
|
-
"eslint-plugin-jsdoc": "^37.
|
|
137
|
+
"eslint-plugin-jsdoc": "^37.6.3",
|
|
138
138
|
"extract-zip": "^2.0.1",
|
|
139
139
|
"mock-require": "^3.0.3",
|
|
140
140
|
"nyc": "^15.1.0",
|