@ui5/builder 3.0.0-alpha.1 → 3.0.0-alpha.10

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 (60) hide show
  1. package/CHANGELOG.md +850 -0
  2. package/index.js +0 -43
  3. package/lib/lbt/analyzer/JSModuleAnalyzer.js +27 -8
  4. package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +2 -1
  5. package/lib/lbt/bundle/Builder.js +364 -137
  6. package/lib/lbt/bundle/BundleWriter.js +17 -0
  7. package/lib/lbt/bundle/Resolver.js +2 -2
  8. package/lib/lbt/resources/LocatorResource.js +7 -7
  9. package/lib/lbt/resources/LocatorResourcePool.js +8 -4
  10. package/lib/lbt/resources/ResourceCollector.js +22 -15
  11. package/lib/lbt/resources/ResourceInfoList.js +0 -1
  12. package/lib/lbt/resources/ResourcePool.js +7 -6
  13. package/lib/lbt/utils/escapePropertiesFile.js +3 -6
  14. package/lib/lbt/utils/parseUtils.js +1 -1
  15. package/lib/processors/bundlers/moduleBundler.js +31 -10
  16. package/lib/processors/jsdoc/lib/createIndexFiles.js +1 -1
  17. package/lib/processors/jsdoc/lib/transformApiJson.js +20 -20
  18. package/lib/processors/jsdoc/lib/ui5/plugin.js +111 -6
  19. package/lib/processors/jsdoc/lib/ui5/template/publish.js +112 -91
  20. package/lib/processors/jsdoc/lib/ui5/template/utils/versionUtil.js +1 -1
  21. package/lib/processors/manifestCreator.js +8 -45
  22. package/lib/processors/minifier.js +11 -5
  23. package/lib/tasks/buildThemes.js +1 -1
  24. package/lib/tasks/bundlers/generateBundle.js +70 -30
  25. package/lib/tasks/bundlers/generateComponentPreload.js +26 -19
  26. package/lib/tasks/bundlers/generateFlexChangesBundle.js +10 -5
  27. package/lib/tasks/bundlers/generateLibraryPreload.js +113 -94
  28. package/lib/tasks/bundlers/generateManifestBundle.js +8 -10
  29. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +42 -10
  30. package/lib/tasks/bundlers/utils/createModuleNameMapping.js +31 -0
  31. package/lib/tasks/generateCachebusterInfo.js +7 -3
  32. package/lib/tasks/generateLibraryManifest.js +6 -8
  33. package/lib/tasks/generateResourcesJson.js +3 -3
  34. package/lib/tasks/generateThemeDesignerResources.js +118 -2
  35. package/lib/tasks/generateVersionInfo.js +5 -5
  36. package/lib/tasks/jsdoc/generateJsdoc.js +1 -1
  37. package/lib/tasks/minify.js +14 -4
  38. package/lib/tasks/taskRepository.js +1 -13
  39. package/lib/tasks/transformBootstrapHtml.js +6 -1
  40. package/package.json +11 -10
  41. package/lib/builder/BuildContext.js +0 -56
  42. package/lib/builder/ProjectBuildContext.js +0 -57
  43. package/lib/builder/builder.js +0 -419
  44. package/lib/tasks/TaskUtil.js +0 -160
  45. package/lib/types/AbstractBuilder.js +0 -270
  46. package/lib/types/AbstractFormatter.js +0 -66
  47. package/lib/types/AbstractUi5Formatter.js +0 -95
  48. package/lib/types/application/ApplicationBuilder.js +0 -211
  49. package/lib/types/application/ApplicationFormatter.js +0 -227
  50. package/lib/types/application/applicationType.js +0 -15
  51. package/lib/types/library/LibraryBuilder.js +0 -231
  52. package/lib/types/library/LibraryFormatter.js +0 -519
  53. package/lib/types/library/libraryType.js +0 -15
  54. package/lib/types/module/ModuleBuilder.js +0 -7
  55. package/lib/types/module/ModuleFormatter.js +0 -54
  56. package/lib/types/module/moduleType.js +0 -15
  57. package/lib/types/themeLibrary/ThemeLibraryBuilder.js +0 -63
  58. package/lib/types/themeLibrary/ThemeLibraryFormatter.js +0 -90
  59. package/lib/types/themeLibrary/themeLibraryType.js +0 -15
  60. package/lib/types/typeRepository.js +0 -46
package/index.js CHANGED
@@ -3,10 +3,6 @@
3
3
  * @public
4
4
  */
5
5
  module.exports = {
6
- /**
7
- * @type {import('./lib/builder/builder')}
8
- */
9
- builder: "./lib/builder/builder",
10
6
  /**
11
7
  * @public
12
8
  * @alias module:@ui5/builder.processors
@@ -156,45 +152,6 @@ module.exports = {
156
152
  * @type {import('./lib/tasks/taskRepository')}
157
153
  */
158
154
  taskRepository: "./lib/tasks/taskRepository",
159
- /**
160
- * @type {import('./lib/tasks/TaskUtil')}
161
- */
162
- TaskUtil: "./lib/tasks/TaskUtil"
163
- },
164
- /**
165
- * @private
166
- * @alias module:@ui5/builder.types
167
- * @namespace
168
- */
169
- types: {
170
- /**
171
- * @type {typeof import('./lib/types/AbstractBuilder')}
172
- */
173
- AbstractBuilder: "./lib/types/AbstractBuilder",
174
- /**
175
- * @type {typeof import('./lib/types/AbstractFormatter')}
176
- */
177
- AbstractFormatter: "./lib/types/AbstractFormatter",
178
- /**
179
- * @type {import('./lib/types/application/applicationType')}
180
- */
181
- application: "./lib/types/application/applicationType",
182
- /**
183
- * @type {import('./lib/types/library/libraryType')}
184
- */
185
- library: "./lib/types/library/libraryType",
186
- /**
187
- * @type {import('./lib/types/themeLibrary/themeLibraryType')}
188
- */
189
- themeLibrary: "./lib/types/themeLibrary/themeLibraryType",
190
- /**
191
- * @type {import('./lib/types/module/moduleType')}
192
- */
193
- module: "./lib/types/module/moduleType",
194
- /**
195
- * @type {import('./lib/types/typeRepository')}
196
- */
197
- typeRepository: "./lib/types/typeRepository"
198
155
  }
199
156
  };
200
157
 
@@ -175,12 +175,11 @@ const EnrichedVisitorKeys = (function() {
175
175
 
176
176
  // merge with 'official' visitor keys
177
177
  Object.keys(VisitorKeys).forEach( (type) => {
178
- // Check if the visitor-key exists in the available Syntax because
179
- // the list of visitor-keys does not match the available Syntax.
180
- if (!Syntax[type]) {
181
- // Deprecated / removed:
182
- // ExperimentalRestProperty
183
- // ExperimentalSpreadProperty
178
+ // Ignore deprecated keys:
179
+ // - ExperimentalSpreadProperty => SpreadElement
180
+ // - ExperimentalRestProperty => RestElement
181
+ // They are about to be removed, see: https://github.com/eslint/eslint-visitor-keys/pull/36
182
+ if (type === "ExperimentalSpreadProperty" || type === "ExperimentalRestProperty") {
184
183
  return;
185
184
  }
186
185
  // Ignore JSX visitor-keys because they aren't used.
@@ -188,6 +187,15 @@ const EnrichedVisitorKeys = (function() {
188
187
  return;
189
188
  }
190
189
 
190
+ // Ignore new ES2022 syntax as we currently use ES2021 (see parseUtils.js)
191
+ if (
192
+ type === "PrivateIdentifier" ||
193
+ type === "PropertyDefinition" ||
194
+ type === "StaticBlock"
195
+ ) {
196
+ return;
197
+ }
198
+
191
199
  const visitorKeys = VisitorKeys[type];
192
200
  const condKeys = TempKeys[type];
193
201
  if ( condKeys === undefined ) {
@@ -293,6 +301,9 @@ class JSModuleAnalyzer {
293
301
  */
294
302
  let bIsUi5Module = false;
295
303
 
304
+ // Module name via @ui5-bundle comment in first line. Overrides all other main module candidates.
305
+ let firstLineBundleName;
306
+
296
307
  // first analyze the whole AST...
297
308
  visit(ast, false);
298
309
 
@@ -306,7 +317,12 @@ class JSModuleAnalyzer {
306
317
  log.verbose(`bundle include directive ${subModule}`);
307
318
  } else if ( comment.value.startsWith("@ui5-bundle ") ) {
308
319
  const bundleName = comment.value.slice("@ui5-bundle ".length);
309
- setMainModuleInfo(bundleName, null);
320
+ if (comment.start === 0) {
321
+ // Remember the name from the first line to use it as final name
322
+ firstLineBundleName = bundleName;
323
+ } else {
324
+ setMainModuleInfo(bundleName, null);
325
+ }
310
326
  log.verbose(`bundle name directive ${bundleName}`);
311
327
  } else {
312
328
  log.warn(`unrecognized bundle directive ${comment.value}`);
@@ -316,7 +332,10 @@ class JSModuleAnalyzer {
316
332
  }
317
333
 
318
334
  // ...and finally take conclusions about the file's content
319
- if ( !mainModuleFound ) {
335
+ if ( firstLineBundleName ) {
336
+ // If the first line has a bundle name, use it and override all other found names
337
+ info.name = firstLineBundleName;
338
+ } else if ( !mainModuleFound ) {
320
339
  // if there's exactly one module definition in this file but it didn't
321
340
  // immediately qualify as main module, make it now the main module
322
341
  if ( candidateName != null && nModuleDeclarations == 1 ) {
@@ -231,9 +231,10 @@ class XMLTemplateAnalyzer {
231
231
  // looks like a UI5 library or package name
232
232
  const moduleName = ModuleName.fromUI5LegacyName( (namespace ? namespace + "." : "") + localName );
233
233
 
234
+ this._analyzeCoreRequire(node);
235
+
234
236
  // ignore FragmentDefinition (also skipped by runtime XMLTemplateProcessor)
235
237
  if ( FRAGMENTDEFINITION_MODULE !== moduleName ) {
236
- this._analyzeCoreRequire(node);
237
238
  this.promises.push(this._analyzeModuleDependency(node, moduleName, this.conditional));
238
239
  }
239
240
  }