@ui5/builder 3.0.0-alpha.8 → 3.0.0-beta.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.
Files changed (84) hide show
  1. package/.reuse/dep5 +2 -2
  2. package/CHANGELOG.md +50 -2
  3. package/CONTRIBUTING.md +1 -1
  4. package/README.md +4 -4
  5. package/jsdoc.json +2 -2
  6. package/lib/lbt/UI5ClientConstants.js +7 -8
  7. package/lib/lbt/analyzer/ComponentAnalyzer.js +60 -22
  8. package/lib/lbt/analyzer/FioriElementsAnalyzer.js +31 -20
  9. package/lib/lbt/analyzer/JSModuleAnalyzer.js +107 -65
  10. package/lib/lbt/analyzer/SmartTemplateAnalyzer.js +31 -20
  11. package/lib/lbt/analyzer/XMLCompositeAnalyzer.js +35 -25
  12. package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +71 -18
  13. package/lib/lbt/analyzer/analyzeLibraryJS.js +22 -6
  14. package/lib/lbt/bundle/AutoSplitter.js +10 -11
  15. package/lib/lbt/bundle/Builder.js +33 -36
  16. package/lib/lbt/bundle/BundleDefinition.js +1 -5
  17. package/lib/lbt/bundle/BundleWriter.js +1 -2
  18. package/lib/lbt/bundle/ResolvedBundleDefinition.js +6 -7
  19. package/lib/lbt/bundle/Resolver.js +11 -12
  20. package/lib/lbt/calls/SapUiDefine.js +16 -11
  21. package/lib/lbt/graph/dependencyGraph.js +3 -4
  22. package/lib/lbt/graph/dominatorTree.js +3 -3
  23. package/lib/lbt/graph/topologicalSort.js +3 -3
  24. package/lib/lbt/resources/LibraryFileAnalyzer.js +5 -8
  25. package/lib/lbt/resources/LocatorResource.js +2 -2
  26. package/lib/lbt/resources/LocatorResourcePool.js +3 -3
  27. package/lib/lbt/resources/ModuleInfo.js +1 -2
  28. package/lib/lbt/resources/Resource.js +3 -4
  29. package/lib/lbt/resources/ResourceCollector.js +7 -8
  30. package/lib/lbt/resources/ResourceFilterList.js +38 -40
  31. package/lib/lbt/resources/ResourceInfo.js +1 -1
  32. package/lib/lbt/resources/ResourceInfoList.js +5 -3
  33. package/lib/lbt/resources/ResourcePool.js +15 -21
  34. package/lib/lbt/utils/ASTUtils.js +58 -44
  35. package/lib/lbt/utils/JSTokenizer.js +4 -4
  36. package/lib/lbt/utils/ModuleName.js +10 -20
  37. package/lib/lbt/utils/escapePropertiesFile.js +3 -3
  38. package/lib/lbt/utils/parseUtils.js +4 -10
  39. package/lib/processors/bootstrapHtmlTransformer.js +15 -7
  40. package/lib/processors/bundlers/flexChangesBundler.js +16 -8
  41. package/lib/processors/bundlers/manifestBundler.js +19 -10
  42. package/lib/processors/bundlers/moduleBundler.js +26 -15
  43. package/lib/processors/jsdoc/apiIndexGenerator.js +16 -9
  44. package/lib/processors/jsdoc/jsdocGenerator.js +31 -17
  45. package/lib/processors/jsdoc/lib/{createIndexFiles.js → createIndexFiles.cjs} +0 -0
  46. package/lib/processors/jsdoc/lib/{transformApiJson.js → transformApiJson.cjs} +58 -2
  47. package/lib/processors/jsdoc/lib/ui5/{plugin.js → plugin.cjs} +306 -119
  48. package/lib/processors/jsdoc/lib/ui5/template/{publish.js → publish.cjs} +1 -1
  49. package/lib/processors/jsdoc/lib/ui5/template/utils/{versionUtil.js → versionUtil.cjs} +0 -0
  50. package/lib/processors/jsdoc/sdkTransformer.js +18 -11
  51. package/lib/processors/libraryLessGenerator.js +28 -16
  52. package/lib/processors/manifestCreator.js +14 -13
  53. package/lib/processors/minifier.js +22 -16
  54. package/lib/processors/nonAsciiEscaper.js +16 -6
  55. package/lib/processors/resourceListCreator.js +13 -13
  56. package/lib/processors/stringReplacer.js +13 -6
  57. package/lib/processors/themeBuilder.js +33 -24
  58. package/lib/processors/versionInfoGenerator.js +33 -23
  59. package/lib/tasks/buildThemes.js +18 -11
  60. package/lib/tasks/bundlers/generateBundle.js +23 -12
  61. package/lib/tasks/bundlers/generateComponentPreload.js +18 -10
  62. package/lib/tasks/bundlers/generateFlexChangesBundle.js +16 -8
  63. package/lib/tasks/bundlers/generateLibraryPreload.js +22 -12
  64. package/lib/tasks/bundlers/generateManifestBundle.js +15 -6
  65. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +21 -13
  66. package/lib/tasks/bundlers/utils/createModuleNameMapping.js +6 -6
  67. package/lib/tasks/escapeNonAsciiCharacters.js +12 -5
  68. package/lib/tasks/generateCachebusterInfo.js +16 -8
  69. package/lib/tasks/generateLibraryManifest.js +14 -8
  70. package/lib/tasks/generateResourcesJson.js +15 -9
  71. package/lib/tasks/generateThemeDesignerResources.js +19 -9
  72. package/lib/tasks/generateVersionInfo.js +12 -5
  73. package/lib/tasks/jsdoc/executeJsdocSdkTransformation.js +17 -9
  74. package/lib/tasks/jsdoc/generateApiIndex.js +16 -10
  75. package/lib/tasks/jsdoc/generateJsdoc.js +131 -119
  76. package/lib/tasks/minify.js +14 -7
  77. package/lib/tasks/replaceBuildtime.js +12 -5
  78. package/lib/tasks/replaceCopyright.js +12 -5
  79. package/lib/tasks/replaceVersion.js +12 -5
  80. package/lib/tasks/taskRepository.js +24 -29
  81. package/lib/tasks/transformBootstrapHtml.js +6 -5
  82. package/package.json +33 -18
  83. package/index.js +0 -177
  84. package/lib/tasks/TaskUtil.js +0 -237
@@ -1,237 +0,0 @@
1
- /**
2
- * Convenience functions for UI5 Builder tasks.
3
- * An instance of this class is passed to every standard UI5 Builder task that requires it.
4
- *
5
- * Custom tasks that define a specification version >= 2.2 will receive an interface
6
- * to an instance of this class when called.
7
- * The set of available functions on that interface depends on the specification
8
- * version defined for the extension.
9
- *
10
- * @public
11
- * @memberof module:@ui5/builder.tasks
12
- */
13
- class TaskUtil {
14
- /**
15
- * Standard Build Tags. See UI5 Tooling
16
- * [RFC 0008]{@link https://github.com/SAP/ui5-tooling/blob/master/rfcs/0008-resource-tagging-during-build.md}
17
- * for details.
18
- *
19
- * @public
20
- * @typedef {object} module:@ui5/builder.tasks.TaskUtil~StandardBuildTags
21
- * @property {string} OmitFromBuildResult
22
- * Setting this tag to true will prevent the resource from being written to the build target directory
23
- * @property {string} IsBundle
24
- * This tag identifies resources that contain (i.e. bundle) multiple other resources
25
- * @property {string} IsDebugVariant
26
- * This tag identifies resources that are a debug variant (typically named with a "-dbg" suffix)
27
- * of another resource. This tag is part of the build manifest.
28
- * @property {string} HasDebugVariant
29
- * This tag identifies resources for which a debug variant has been created.
30
- * This tag is part of the build manifest.
31
- */
32
-
33
- /**
34
- * Since <code>@ui5/builder.builder.ProjectBuildContext</code> is a private class, TaskUtil must not be
35
- * instantiated by modules other than @ui5/builder itself.
36
- *
37
- * @param {object} parameters
38
- * @param {module:@ui5/builder.builder.ProjectBuildContext} parameters.projectBuildContext ProjectBuildContext
39
- * @public
40
- */
41
- constructor({projectBuildContext}) {
42
- this._projectBuildContext = projectBuildContext;
43
- /**
44
- * @member {module:@ui5/builder.tasks.TaskUtil~StandardBuildTags}
45
- * @public
46
- */
47
- this.STANDARD_TAGS = Object.freeze({
48
- // "Project" tags:
49
- // Will be stored on project instance and are hence part of the build manifest
50
- IsDebugVariant: "ui5:IsDebugVariant",
51
- HasDebugVariant: "ui5:HasDebugVariant",
52
-
53
- // "Build" tags:
54
- // Will be stored on the project build context
55
- // They are only available to the build tasks of a single project
56
- OmitFromBuildResult: "ui5:OmitFromBuildResult",
57
- IsBundle: "ui5:IsBundle"
58
- });
59
- }
60
-
61
- /**
62
- * Stores a tag with value for a given resource's path. Note that the tag is independent of the supplied
63
- * resource instance. For two resource instances with the same path, the same tag value is returned.
64
- * If the path of a resource is changed, any tag information previously stored for that resource is lost.
65
- *
66
- * </br></br>
67
- * This method is only available to custom task extensions defining
68
- * <b>Specification Version 2.2 and above</b>.
69
- *
70
- * @param {module:@ui5/fs.Resource} resource Resource-instance the tag should be stored for
71
- * @param {string} tag Name of the tag.
72
- * Currently only the [STANDARD_TAGS]{@link module:@ui5/builder.tasks.TaskUtil#STANDARD_TAGS} are allowed
73
- * @param {string|boolean|integer} [value=true] Tag value. Must be primitive
74
- * @public
75
- */
76
- setTag(resource, tag, value) {
77
- if (typeof resource === "string") {
78
- throw new Error("Deprecated parameter: " +
79
- "Since UI5 Tooling 3.0, #setTag requires a resource instance. Strings are no longer accepted");
80
- }
81
-
82
- const collection = this._projectBuildContext.getResourceTagCollection(resource, tag);
83
- return collection.setTag(resource, tag, value);
84
- }
85
-
86
- /**
87
- * Retrieves the value for a stored tag. If no value is stored, <code>undefined</code> is returned.
88
- *
89
- * </br></br>
90
- * This method is only available to custom task extensions defining
91
- * <b>Specification Version 2.2 and above</b>.
92
- *
93
- * @param {module:@ui5/fs.Resource} resource Resource-instance the tag should be retrieved for
94
- * @param {string} tag Name of the tag
95
- * @returns {string|boolean|integer|undefined} Tag value for the given resource.
96
- * <code>undefined</code> if no value is available
97
- * @public
98
- */
99
- getTag(resource, tag) {
100
- if (typeof resource === "string") {
101
- throw new Error("Deprecated parameter: " +
102
- "Since UI5 Tooling 3.0, #getTag requires a resource instance. Strings are no longer accepted");
103
- }
104
- const collection = this._projectBuildContext.getResourceTagCollection(resource, tag);
105
- return collection.getTag(resource, tag);
106
- }
107
-
108
- /**
109
- * Clears the value of a tag stored for the given resource's path.
110
- * It's like the tag was never set for that resource.
111
- *
112
- * </br></br>
113
- * This method is only available to custom task extensions defining
114
- * <b>Specification Version 2.2 and above</b>.
115
- *
116
- * @param {module:@ui5/fs.Resource} resource Resource-instance the tag should be cleared for
117
- * @param {string} tag Tag
118
- * @public
119
- */
120
- clearTag(resource, tag) {
121
- if (typeof resource === "string") {
122
- throw new Error("Deprecated parameter: " +
123
- "Since UI5 Tooling 3.0, #clearTag requires a resource instance. Strings are no longer accepted");
124
- }
125
- const collection = this._projectBuildContext.getResourceTagCollection(resource, tag);
126
- return collection.clearTag(resource, tag);
127
- }
128
-
129
- /**
130
- * Check whether the project currently being built is the root project.
131
- *
132
- * </br></br>
133
- * This method is only available to custom task extensions defining
134
- * <b>Specification Version 2.2 and above</b>.
135
- *
136
- * @returns {boolean} <code>true</code> if the currently built project is the root project
137
- * @public
138
- */
139
- isRootProject() {
140
- return this._projectBuildContext.isRootProject();
141
- }
142
-
143
- /**
144
- * Retrieves a build option defined by its <code>key</code.
145
- * If no option with the given <code>key</code> is stored, <code>undefined</code> is returned.
146
- *
147
- * @param {string} key The option key
148
- * @returns {any|undefined} The build option (or undefined)
149
- * @private
150
- */
151
- getBuildOption(key) {
152
- return this._projectBuildContext.getOption(key);
153
- }
154
-
155
- /**
156
- * Register a function that must be executed once the build is finished. This can be used to, for example,
157
- * clean up files temporarily created on the file system. If the callback returns a Promise, it will be waited for.
158
- * It will also be executed in cases where the build has failed or has been aborted.
159
- *
160
- * </br></br>
161
- * This method is only available to custom task extensions defining
162
- * <b>Specification Version 2.2 and above</b>.
163
- *
164
- * @param {Function} callback Callback to register. If it returns a Promise, it will be waited for
165
- * @public
166
- */
167
- registerCleanupTask(callback) {
168
- return this._projectBuildContext.registerCleanupTask(callback);
169
- }
170
-
171
- /**
172
- * Retrieve a single project from the dependency graph
173
- *
174
- * </br></br>
175
- * This method is only available to custom task extensions defining
176
- * <b>Specification Version 3.0 and above</b>.
177
- *
178
- * @param {string} projectName Name of the project to retrieve
179
- * @returns {module:@ui5/project.specifications.Project|undefined}
180
- * project instance or undefined if the project is unknown to the graph
181
- * @public
182
- */
183
- getProject(projectName) {
184
- return this._projectBuildContext.getProject(projectName);
185
- }
186
-
187
- /**
188
- * Get an interface to an instance of this class that only provides those functions
189
- * that are supported by the given custom task extension specification version.
190
- *
191
- * @param {string} specVersion Specification version of custom task extension
192
- * @returns {object} An object with bound instance methods supported by the given specification version
193
- */
194
- getInterface(specVersion) {
195
- if (["0.1", "1.0", "1.1", "2.0", "2.1"].includes(specVersion)) {
196
- return undefined;
197
- }
198
-
199
- const baseInterface = {
200
- STANDARD_TAGS: this.STANDARD_TAGS,
201
- };
202
- bindFunctions(this, baseInterface, [
203
- "setTag", "clearTag", "getTag", "isRootProject", "registerCleanupTask"
204
- ]);
205
- switch (specVersion) {
206
- case "2.2":
207
- case "2.3":
208
- case "2.4":
209
- case "2.5":
210
- case "2.6":
211
- return baseInterface;
212
- case "3.0":
213
- baseInterface.getProject = (projectName) => {
214
- const project = this.getProject(projectName);
215
- const baseProjectInterface = {};
216
- bindFunctions(project, baseProjectInterface, [
217
- "getName", "getVersion", "getNamespace"
218
- ]);
219
- switch (specVersion) {
220
- case "3.0":
221
- return baseProjectInterface;
222
- }
223
- };
224
- return baseInterface;
225
- default:
226
- throw new Error(`TaskUtil: Unknown or unsupported Specification Version ${specVersion}`);
227
- }
228
- }
229
- }
230
-
231
- function bindFunctions(sourceObject, targetObject, funcNames) {
232
- funcNames.forEach((funcName) => {
233
- targetObject[funcName] = sourceObject[funcName].bind(sourceObject);
234
- });
235
- }
236
-
237
- module.exports = TaskUtil;