@ui5/builder 3.0.0-alpha.5 → 3.0.0-alpha.8
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 +34 -1
- package/index.js +0 -39
- package/lib/lbt/analyzer/JSModuleAnalyzer.js +13 -2
- package/lib/lbt/bundle/Builder.js +19 -49
- package/lib/lbt/resources/LocatorResource.js +1 -1
- package/lib/lbt/resources/ResourceCollector.js +22 -15
- package/lib/lbt/resources/ResourceInfoList.js +0 -1
- package/lib/lbt/resources/ResourcePool.js +7 -6
- package/lib/lbt/utils/escapePropertiesFile.js +3 -6
- package/lib/processors/bundlers/moduleBundler.js +2 -3
- package/lib/processors/jsdoc/lib/createIndexFiles.js +1 -1
- package/lib/processors/jsdoc/lib/transformApiJson.js +20 -20
- package/lib/processors/jsdoc/lib/ui5/plugin.js +111 -6
- package/lib/processors/jsdoc/lib/ui5/template/publish.js +112 -91
- package/lib/processors/jsdoc/lib/ui5/template/utils/versionUtil.js +1 -1
- package/lib/processors/manifestCreator.js +8 -45
- package/lib/tasks/TaskUtil.js +82 -17
- package/lib/tasks/bundlers/generateComponentPreload.js +14 -14
- package/lib/tasks/bundlers/generateFlexChangesBundle.js +6 -2
- package/lib/tasks/bundlers/generateLibraryPreload.js +84 -91
- package/lib/tasks/bundlers/generateManifestBundle.js +8 -10
- package/lib/tasks/bundlers/generateStandaloneAppBundle.js +7 -2
- package/lib/tasks/bundlers/utils/createModuleNameMapping.js +3 -2
- package/lib/tasks/generateCachebusterInfo.js +7 -3
- package/lib/tasks/generateLibraryManifest.js +6 -8
- package/lib/tasks/generateResourcesJson.js +1 -1
- package/lib/tasks/generateThemeDesignerResources.js +8 -2
- package/lib/tasks/generateVersionInfo.js +5 -5
- package/lib/tasks/taskRepository.js +1 -13
- package/lib/tasks/transformBootstrapHtml.js +6 -1
- package/package.json +6 -7
- package/lib/builder/BuildContext.js +0 -60
- package/lib/builder/ProjectBuildContext.js +0 -61
- package/lib/builder/builder.js +0 -425
- package/lib/types/AbstractBuilder.js +0 -270
- package/lib/types/AbstractFormatter.js +0 -66
- package/lib/types/AbstractUi5Formatter.js +0 -95
- package/lib/types/application/ApplicationBuilder.js +0 -211
- package/lib/types/application/ApplicationFormatter.js +0 -227
- package/lib/types/application/applicationType.js +0 -15
- package/lib/types/library/LibraryBuilder.js +0 -232
- package/lib/types/library/LibraryFormatter.js +0 -519
- package/lib/types/library/libraryType.js +0 -15
- package/lib/types/module/ModuleBuilder.js +0 -7
- package/lib/types/module/ModuleFormatter.js +0 -54
- package/lib/types/module/moduleType.js +0 -15
- package/lib/types/themeLibrary/ThemeLibraryBuilder.js +0 -64
- package/lib/types/themeLibrary/ThemeLibraryFormatter.js +0 -90
- package/lib/types/themeLibrary/themeLibraryType.js +0 -15
- package/lib/types/typeRepository.js +0 -46
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const log = require("@ui5/logger").getLogger("builder:tasks:generateLibraryManifest");
|
|
4
4
|
const manifestCreator = require("../processors/manifestCreator");
|
|
5
|
-
const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritized;
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -12,23 +11,19 @@ const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritiz
|
|
|
12
11
|
* @alias module:@ui5/builder.tasks.generateLibraryManifest
|
|
13
12
|
* @param {object} parameters Parameters
|
|
14
13
|
* @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
|
|
15
|
-
* @param {module:@ui5/
|
|
14
|
+
* @param {module:@ui5/builder.tasks.TaskUtil|object} [parameters.taskUtil] TaskUtil
|
|
16
15
|
* @param {object} parameters.options Options
|
|
17
16
|
* @param {string} parameters.options.projectName Project name
|
|
18
17
|
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
19
18
|
*/
|
|
20
|
-
module.exports = function({workspace,
|
|
21
|
-
const combo = new ReaderCollectionPrioritized({
|
|
22
|
-
name: `libraryManifestGenerator - prioritize workspace over dependencies: ${projectName}`,
|
|
23
|
-
readers: [workspace, dependencies]
|
|
24
|
-
});
|
|
19
|
+
module.exports = function({workspace, taskUtil, options: {projectName}}) {
|
|
25
20
|
// Note:
|
|
26
21
|
// *.library files are needed to identify libraries
|
|
27
22
|
// *.json files are needed to avoid overwriting them
|
|
28
23
|
// *.js files are needed to identify nested components
|
|
29
24
|
// *.less, *.css, *.theming and *.theme files are needed to identify supported themes
|
|
30
25
|
// *.properties to identify existence of i18n bundles (e.g. messagebundle.properties)
|
|
31
|
-
return
|
|
26
|
+
return workspace.byGlob("/resources/**/*.{js,json,library,less,css,theming,theme,properties}").then((resources) => {
|
|
32
27
|
// Find all libraries and create a manifest.json file
|
|
33
28
|
return workspace.byGlob("/resources/**/.library").then((libraryIndicatorResources) => {
|
|
34
29
|
if (libraryIndicatorResources.length < 1) {
|
|
@@ -51,6 +46,9 @@ module.exports = function({workspace, dependencies, options: {projectName}}) {
|
|
|
51
46
|
libraryResource: libraryIndicatorResource,
|
|
52
47
|
namespace: libraryNamespace,
|
|
53
48
|
resources,
|
|
49
|
+
getProjectVersion: (projectName) => {
|
|
50
|
+
return taskUtil?.getProject(projectName)?.getVersion();
|
|
51
|
+
},
|
|
54
52
|
options: {
|
|
55
53
|
}
|
|
56
54
|
}).then((manifest) => {
|
|
@@ -43,7 +43,7 @@ function getCreatorOptions(projectName) {
|
|
|
43
43
|
*
|
|
44
44
|
* <p>
|
|
45
45
|
* The detailed structure can be found in the documentation:
|
|
46
|
-
* {@link https://openui5.
|
|
46
|
+
* {@link https://sdk.openui5.org/topic/adcbcf8b50924556ab3f321fcd9353ea}
|
|
47
47
|
* </p>
|
|
48
48
|
*
|
|
49
49
|
* <p>
|
|
@@ -187,6 +187,7 @@ async function generateCssVariablesLess({workspace, combo, namespace}) {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
/* eslint "jsdoc/check-param-names": ["error", {"disableExtraPropertyReporting":true}] */
|
|
190
191
|
/**
|
|
191
192
|
* Generates resources required for integration with the SAP Theme Designer.
|
|
192
193
|
*
|
|
@@ -198,11 +199,16 @@ async function generateCssVariablesLess({workspace, combo, namespace}) {
|
|
|
198
199
|
* @param {object} parameters.options Options
|
|
199
200
|
* @param {string} parameters.options.projectName Project name
|
|
200
201
|
* @param {string} parameters.options.version Project version
|
|
201
|
-
* @param {string} [parameters.options.
|
|
202
|
+
* @param {string} [parameters.options.projectNamespace] If the project is of type <code>library</code>,
|
|
203
|
+
* provide its namespace.
|
|
202
204
|
* Omit for type <code>theme-library</code>
|
|
203
205
|
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
204
206
|
*/
|
|
205
|
-
module.exports = async function({workspace, dependencies, options
|
|
207
|
+
module.exports = async function({workspace, dependencies, options}) {
|
|
208
|
+
const {projectName, version} = options;
|
|
209
|
+
// Backward compatibility: "namespace" option got renamed to "projectNamespace"
|
|
210
|
+
const namespace = options.projectNamespace || options.namespace;
|
|
211
|
+
|
|
206
212
|
// Skip sap.ui.documentation since it is not intended to be available in SAP Theme Designer to create custom themes
|
|
207
213
|
if (namespace === "sap/ui/documentation") {
|
|
208
214
|
return;
|
|
@@ -19,7 +19,7 @@ module.exports = async ({workspace, dependencies, options: {rootProject, pattern
|
|
|
19
19
|
const resources = await dependencies.byGlob(pattern);
|
|
20
20
|
|
|
21
21
|
const libraryInfosPromises = resources.map((dotLibResource) => {
|
|
22
|
-
const namespace = dotLibResource.
|
|
22
|
+
const namespace = dotLibResource.getProject().getNamespace();
|
|
23
23
|
// pass all required resources to the processor
|
|
24
24
|
// the processor will then filter
|
|
25
25
|
return dependencies.byGlob(`/resources/${namespace}/**/${MANIFEST_JSON}`).then((manifestResources) => {
|
|
@@ -31,8 +31,8 @@ module.exports = async ({workspace, dependencies, options: {rootProject, pattern
|
|
|
31
31
|
return {
|
|
32
32
|
libraryManifest,
|
|
33
33
|
embeddedManifests,
|
|
34
|
-
name: dotLibResource.
|
|
35
|
-
version: dotLibResource.
|
|
34
|
+
name: dotLibResource.getProject().getName(),
|
|
35
|
+
version: dotLibResource.getProject().getVersion()
|
|
36
36
|
};
|
|
37
37
|
});
|
|
38
38
|
});
|
|
@@ -40,8 +40,8 @@ module.exports = async ({workspace, dependencies, options: {rootProject, pattern
|
|
|
40
40
|
|
|
41
41
|
const [versionInfoResource] = await versionInfoGenerator({
|
|
42
42
|
options: {
|
|
43
|
-
rootProjectName: rootProject.
|
|
44
|
-
rootProjectVersion: rootProject.
|
|
43
|
+
rootProjectName: rootProject.getName(),
|
|
44
|
+
rootProjectVersion: rootProject.getVersion(),
|
|
45
45
|
libraryInfos
|
|
46
46
|
}
|
|
47
47
|
});
|
|
@@ -36,30 +36,18 @@ function getTask(taskName) {
|
|
|
36
36
|
try {
|
|
37
37
|
const task = require(taskInfo.path);
|
|
38
38
|
return {
|
|
39
|
-
task
|
|
40
|
-
specVersion: taskInfo.specVersion
|
|
39
|
+
task
|
|
41
40
|
};
|
|
42
41
|
} catch (err) {
|
|
43
42
|
throw new Error(`taskRepository: Failed to require task module for ${taskName}: ${err.message}`);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
function addTask({name, specVersion, taskPath}) {
|
|
48
|
-
if (taskInfos[name]) {
|
|
49
|
-
throw new Error(`taskRepository: A task with the name ${name} has already been registered`);
|
|
50
|
-
}
|
|
51
|
-
taskInfos[name] = {
|
|
52
|
-
path: taskPath,
|
|
53
|
-
specVersion
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
46
|
function getAllTaskNames() {
|
|
58
47
|
return Object.keys(taskInfos);
|
|
59
48
|
}
|
|
60
49
|
|
|
61
50
|
module.exports = {
|
|
62
51
|
getTask,
|
|
63
|
-
addTask,
|
|
64
52
|
getAllTaskNames
|
|
65
53
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const log = require("@ui5/logger").getLogger("builder:tasks:transformBootstrapHtml");
|
|
2
2
|
const bootstrapHtmlTransformer = require("../processors/bootstrapHtmlTransformer");
|
|
3
3
|
|
|
4
|
+
/* eslint "jsdoc/check-param-names": ["error", {"disableExtraPropertyReporting":true}] */
|
|
4
5
|
/**
|
|
5
6
|
* Task for transforming the application bootstrap HTML file.
|
|
6
7
|
*
|
|
@@ -12,7 +13,11 @@ const bootstrapHtmlTransformer = require("../processors/bootstrapHtmlTransformer
|
|
|
12
13
|
* @param {string} [parameters.options.namespace] Project namespace
|
|
13
14
|
* @returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
|
|
14
15
|
*/
|
|
15
|
-
module.exports = async function({workspace, options
|
|
16
|
+
module.exports = async function({workspace, options}) {
|
|
17
|
+
const {projectName} = options;
|
|
18
|
+
// Backward compatibility: "namespace" option got renamed to "projectNamespace"
|
|
19
|
+
const namespace = options.projectNamespace || options.namespace;
|
|
20
|
+
|
|
16
21
|
let indexPath;
|
|
17
22
|
if (namespace) {
|
|
18
23
|
indexPath = `/resources/${namespace}/index.html`;
|
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.8",
|
|
4
4
|
"description": "UI5 Tooling - Builder",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
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
42
|
"release-note": "git-chglog --sort semver -c .chglog/release-config.yml v$npm_package_version",
|
|
43
|
-
"depcheck": "depcheck --ignores docdash"
|
|
43
|
+
"depcheck": "depcheck --ignores docdash --ignore-patterns lib/processors/jsdoc/lib/ui5"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"index.js",
|
|
@@ -105,28 +105,27 @@
|
|
|
105
105
|
"url": "git@github.com:SAP/ui5-builder.git"
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
|
-
"@
|
|
108
|
+
"@jridgewell/sourcemap-codec": "^1.4.14",
|
|
109
|
+
"@ui5/fs": "^3.0.0-alpha.5",
|
|
109
110
|
"@ui5/logger": "^3.0.1-alpha.1",
|
|
110
111
|
"cheerio": "1.0.0-rc.9",
|
|
111
112
|
"escape-unicode": "^0.2.0",
|
|
112
113
|
"escope": "^3.6.0",
|
|
113
114
|
"espree": "^9.3.1",
|
|
114
|
-
"globby": "^11.1.0",
|
|
115
115
|
"graceful-fs": "^4.2.9",
|
|
116
116
|
"jsdoc": "^3.6.7",
|
|
117
117
|
"less-openui5": "^0.11.2",
|
|
118
118
|
"make-dir": "^3.1.0",
|
|
119
119
|
"pretty-data": "^0.40.0",
|
|
120
|
-
"pretty-hrtime": "^1.0.3",
|
|
121
120
|
"replacestream": "^4.0.3",
|
|
122
121
|
"rimraf": "^3.0.2",
|
|
123
122
|
"semver": "^7.3.5",
|
|
124
|
-
"
|
|
125
|
-
"terser": "^5.10.0",
|
|
123
|
+
"terser": "^5.14.2",
|
|
126
124
|
"xml2js": "^0.4.23",
|
|
127
125
|
"yazl": "^2.5.1"
|
|
128
126
|
},
|
|
129
127
|
"devDependencies": {
|
|
128
|
+
"@ui5/project": "github:SAP/ui5-project#178dedbfe80ab890d134ce12ccb29fc709595a52",
|
|
130
129
|
"ava": "^3.15.0",
|
|
131
130
|
"chai": "^4.3.4",
|
|
132
131
|
"chai-fs": "^2.0.0",
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const ResourceTagCollection = require("@ui5/fs").ResourceTagCollection;
|
|
2
|
-
const ProjectBuildContext = require("./ProjectBuildContext");
|
|
3
|
-
|
|
4
|
-
// Note: When adding standard tags, always update the public documentation in TaskUtil
|
|
5
|
-
// (Type "module:@ui5/builder.tasks.TaskUtil~StandardBuildTags")
|
|
6
|
-
const GLOBAL_TAGS = Object.freeze({
|
|
7
|
-
IsDebugVariant: "ui5:IsDebugVariant",
|
|
8
|
-
HasDebugVariant: "ui5:HasDebugVariant",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Context of a build process
|
|
13
|
-
*
|
|
14
|
-
* @private
|
|
15
|
-
* @memberof module:@ui5/builder.builder
|
|
16
|
-
*/
|
|
17
|
-
class BuildContext {
|
|
18
|
-
constructor({rootProject, options = {}}) {
|
|
19
|
-
if (!rootProject) {
|
|
20
|
-
throw new Error(`Missing parameter 'rootProject'`);
|
|
21
|
-
}
|
|
22
|
-
this.rootProject = rootProject;
|
|
23
|
-
this.projectBuildContexts = [];
|
|
24
|
-
this._resourceTagCollection = new ResourceTagCollection({
|
|
25
|
-
allowedTags: Object.values(GLOBAL_TAGS)
|
|
26
|
-
});
|
|
27
|
-
this.options = options;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
getRootProject() {
|
|
31
|
-
return this.rootProject;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
getOption(key) {
|
|
35
|
-
return this.options[key];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
createProjectContext({project, resources}) {
|
|
39
|
-
const projectBuildContext = new ProjectBuildContext({
|
|
40
|
-
buildContext: this,
|
|
41
|
-
globalTags: GLOBAL_TAGS,
|
|
42
|
-
project,
|
|
43
|
-
resources
|
|
44
|
-
});
|
|
45
|
-
this.projectBuildContexts.push(projectBuildContext);
|
|
46
|
-
return projectBuildContext;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async executeCleanupTasks() {
|
|
50
|
-
await Promise.all(this.projectBuildContexts.map((ctx) => {
|
|
51
|
-
return ctx.executeCleanupTasks();
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getResourceTagCollection() {
|
|
56
|
-
return this._resourceTagCollection;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
module.exports = BuildContext;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
const ResourceTagCollection = require("@ui5/fs").ResourceTagCollection;
|
|
2
|
-
|
|
3
|
-
// Note: When adding standard tags, always update the public documentation in TaskUtil
|
|
4
|
-
// (Type "module:@ui5/builder.tasks.TaskUtil~StandardBuildTags")
|
|
5
|
-
const STANDARD_TAGS = {
|
|
6
|
-
OmitFromBuildResult: "ui5:OmitFromBuildResult",
|
|
7
|
-
IsBundle: "ui5:IsBundle",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Build context of a single project. Always part of an overall
|
|
12
|
-
* [Build Context]{@link module:@ui5/builder.builder.BuildContext}
|
|
13
|
-
*
|
|
14
|
-
* @private
|
|
15
|
-
* @memberof module:@ui5/builder.builder
|
|
16
|
-
*/
|
|
17
|
-
class ProjectBuildContext {
|
|
18
|
-
constructor({buildContext, globalTags, project, resources}) {
|
|
19
|
-
if (!buildContext || !globalTags || !project || !resources) {
|
|
20
|
-
throw new Error(`One or more mandatory parameters are missing`);
|
|
21
|
-
}
|
|
22
|
-
this._buildContext = buildContext;
|
|
23
|
-
this._project = project;
|
|
24
|
-
// this.resources = resources;
|
|
25
|
-
this.queues = {
|
|
26
|
-
cleanup: []
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
this.STANDARD_TAGS = Object.assign({}, STANDARD_TAGS, globalTags);
|
|
30
|
-
Object.freeze(this.STANDARD_TAGS);
|
|
31
|
-
|
|
32
|
-
this._resourceTagCollection = new ResourceTagCollection({
|
|
33
|
-
allowedTags: Object.values(this.STANDARD_TAGS),
|
|
34
|
-
superCollection: this._buildContext.getResourceTagCollection()
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
isRootProject() {
|
|
39
|
-
return this._project === this._buildContext.getRootProject();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
getOption(key) {
|
|
43
|
-
return this._buildContext.getOption(key);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
registerCleanupTask(callback) {
|
|
47
|
-
this.queues.cleanup.push(callback);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async executeCleanupTasks() {
|
|
51
|
-
await Promise.all(this.queues.cleanup.map((callback) => {
|
|
52
|
-
return callback();
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
getResourceTagCollection() {
|
|
57
|
-
return this._resourceTagCollection;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
module.exports = ProjectBuildContext;
|