@ui5/builder 2.11.5 → 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 (70) hide show
  1. package/CHANGELOG.md +125 -12
  2. package/index.js +4 -59
  3. package/jsdoc.json +0 -1
  4. package/lib/lbt/analyzer/JSModuleAnalyzer.js +31 -5
  5. package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +2 -1
  6. package/lib/lbt/bundle/AutoSplitter.js +10 -24
  7. package/lib/lbt/bundle/Builder.js +367 -168
  8. package/lib/lbt/bundle/BundleWriter.js +17 -0
  9. package/lib/lbt/bundle/Resolver.js +3 -3
  10. package/lib/lbt/resources/LocatorResource.js +7 -9
  11. package/lib/lbt/resources/LocatorResourcePool.js +8 -4
  12. package/lib/lbt/resources/Resource.js +7 -0
  13. package/lib/lbt/resources/ResourceCollector.js +43 -18
  14. package/lib/lbt/resources/ResourceInfoList.js +0 -1
  15. package/lib/lbt/resources/ResourcePool.js +7 -6
  16. package/lib/lbt/utils/escapePropertiesFile.js +3 -6
  17. package/lib/lbt/utils/parseUtils.js +1 -1
  18. package/lib/processors/bundlers/moduleBundler.js +42 -17
  19. package/lib/processors/jsdoc/lib/createIndexFiles.js +1 -1
  20. package/lib/processors/jsdoc/lib/transformApiJson.js +7 -16
  21. package/lib/processors/jsdoc/lib/ui5/plugin.js +111 -6
  22. package/lib/processors/jsdoc/lib/ui5/template/publish.js +112 -91
  23. package/lib/processors/jsdoc/lib/ui5/template/utils/versionUtil.js +1 -1
  24. package/lib/processors/manifestCreator.js +8 -45
  25. package/lib/processors/minifier.js +90 -0
  26. package/lib/processors/resourceListCreator.js +2 -16
  27. package/lib/tasks/buildThemes.js +1 -1
  28. package/lib/tasks/bundlers/generateBundle.js +82 -14
  29. package/lib/tasks/bundlers/generateComponentPreload.js +31 -17
  30. package/lib/tasks/bundlers/generateFlexChangesBundle.js +7 -3
  31. package/lib/tasks/bundlers/generateLibraryPreload.js +127 -79
  32. package/lib/tasks/bundlers/generateManifestBundle.js +8 -10
  33. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +54 -15
  34. package/lib/tasks/bundlers/utils/createModuleNameMapping.js +31 -0
  35. package/lib/tasks/generateCachebusterInfo.js +7 -3
  36. package/lib/tasks/generateLibraryManifest.js +6 -8
  37. package/lib/tasks/generateResourcesJson.js +15 -9
  38. package/lib/tasks/generateThemeDesignerResources.js +118 -2
  39. package/lib/tasks/generateVersionInfo.js +5 -5
  40. package/lib/tasks/jsdoc/generateJsdoc.js +1 -1
  41. package/lib/tasks/minify.js +41 -0
  42. package/lib/tasks/replaceVersion.js +1 -1
  43. package/lib/tasks/taskRepository.js +7 -15
  44. package/lib/tasks/transformBootstrapHtml.js +6 -1
  45. package/package.json +20 -19
  46. package/lib/builder/BuildContext.js +0 -39
  47. package/lib/builder/ProjectBuildContext.js +0 -55
  48. package/lib/builder/builder.js +0 -420
  49. package/lib/processors/debugFileCreator.js +0 -52
  50. package/lib/processors/resourceCopier.js +0 -24
  51. package/lib/processors/uglifier.js +0 -45
  52. package/lib/tasks/TaskUtil.js +0 -160
  53. package/lib/tasks/createDebugFiles.js +0 -30
  54. package/lib/tasks/uglify.js +0 -33
  55. package/lib/types/AbstractBuilder.js +0 -270
  56. package/lib/types/AbstractFormatter.js +0 -66
  57. package/lib/types/AbstractUi5Formatter.js +0 -95
  58. package/lib/types/application/ApplicationBuilder.js +0 -220
  59. package/lib/types/application/ApplicationFormatter.js +0 -227
  60. package/lib/types/application/applicationType.js +0 -15
  61. package/lib/types/library/LibraryBuilder.js +0 -237
  62. package/lib/types/library/LibraryFormatter.js +0 -519
  63. package/lib/types/library/libraryType.js +0 -15
  64. package/lib/types/module/ModuleBuilder.js +0 -7
  65. package/lib/types/module/ModuleFormatter.js +0 -54
  66. package/lib/types/module/moduleType.js +0 -15
  67. package/lib/types/themeLibrary/ThemeLibraryBuilder.js +0 -62
  68. package/lib/types/themeLibrary/ThemeLibraryFormatter.js +0 -90
  69. package/lib/types/themeLibrary/themeLibraryType.js +0 -15
  70. package/lib/types/typeRepository.js +0 -46
package/CHANGELOG.md CHANGED
@@ -2,21 +2,126 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.11.5...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.10...HEAD).
6
6
 
7
- <a name="v2.11.5"></a>
8
- ## [v2.11.5] - 2022-05-04
7
+ <a name="v3.0.0-alpha.10"></a>
8
+ ## [v3.0.0-alpha.10] - 2022-08-08
9
9
 
10
- <a name="v2.11.4"></a>
11
- ## [v2.11.4] - 2022-02-21
10
+ <a name="v3.0.0-alpha.9"></a>
11
+ ## [v3.0.0-alpha.9] - 2022-07-27
12
12
  ### Bug Fixes
13
- - **generateFlexChangesBundle:** Fix minUI5Version check for UI5 v1.100.0+ ([#706](https://github.com/SAP/ui5-builder/issues/706)) [`fb1217a`](https://github.com/SAP/ui5-builder/commit/fb1217ac536c20da81526f82f2ecb03686815942)
13
+ - **minify:** Change default to not omit source map resources [`6d75a49`](https://github.com/SAP/ui5-builder/commit/6d75a495224590097332fc061c66cfe0e8f4c151)
14
14
 
15
15
 
16
- <a name="v2.11.3"></a>
17
- ## [v2.11.3] - 2021-12-14
16
+ <a name="v3.0.0-alpha.8"></a>
17
+ ## [v3.0.0-alpha.8] - 2022-07-15
18
+
19
+ <a name="v3.0.0-alpha.7"></a>
20
+ ## [v3.0.0-alpha.7] - 2022-06-14
21
+ ### Breaking Changes
22
+ - Remove build execution ([#740](https://github.com/SAP/ui5-builder/issues/740)) [`af2e956`](https://github.com/SAP/ui5-builder/commit/af2e956f6cba1275669160328e32df3fffa782d0)
23
+
24
+ ### Bug Fixes
25
+ - Avoid redundant bundle creation ([#741](https://github.com/SAP/ui5-builder/issues/741)) [`13c8405`](https://github.com/SAP/ui5-builder/commit/13c840585946401d238936dfa38a6f70a73e9ed0)
26
+
27
+ ### Features
28
+ - Enable modern preload bundles without dependencies ([#739](https://github.com/SAP/ui5-builder/issues/739)) [`97cfa6c`](https://github.com/SAP/ui5-builder/commit/97cfa6cd3eadff57bcc18816534c7751551ebdb8)
29
+
30
+ ### BREAKING CHANGE
31
+
32
+ * builder.js has been removed. Use ui5-project builder instead
33
+ * Tasks now rely on Project instances being available on Resources (see https://github.com/SAP/ui5-fs/pull/381)
34
+ * TaskRepository#addTask has been removed. Custom tasks need to be added to the project graph instead
35
+ * TaskUtil#get/set/clearTag now requires a Project instance to be provided. Path strings are no longer sufficient
36
+ and will cause an exception to be thrown
37
+
38
+
39
+ <a name="v3.0.0-alpha.6"></a>
40
+ ## [v3.0.0-alpha.6] - 2022-04-26
41
+ ### Bug Fixes
42
+ - **JSModuleAnalyzer:** Fix detection of bundle name ([#705](https://github.com/SAP/ui5-builder/issues/705)) [`aaeafd4`](https://github.com/SAP/ui5-builder/commit/aaeafd4a1fd194dd08e5ae47c29d90f0b4c7d197)
43
+ - **generateResourcesJson:** Add raw-module info for debug bundles ([#736](https://github.com/SAP/ui5-builder/issues/736)) [`3b918e8`](https://github.com/SAP/ui5-builder/commit/3b918e83bfd38342778ecd4c58e648e99ad7cffc)
44
+
45
+
46
+ <a name="v3.0.0-alpha.5"></a>
47
+ ## [v3.0.0-alpha.5] - 2022-04-14
48
+ ### Bug Fixes
49
+ - **LibraryBuilder:** Align task order of "generateComponentPreload" [`aea061d`](https://github.com/SAP/ui5-builder/commit/aea061d9d6c2ac0c11484dcc08bdcda23ab62986)
50
+
51
+ ### Features
52
+ - **generateThemeDesignerResources task:** Create css_variables.less ([#730](https://github.com/SAP/ui5-builder/issues/730)) [`34e69be`](https://github.com/SAP/ui5-builder/commit/34e69be95fc8ec1961b24b7e2580c2c993d814d3)
53
+
54
+ ### BREAKING CHANGE
55
+
56
+ For library projects, the task "generateComponentPreload" is now
57
+ executed after tasks "generateLibraryManifest" and
58
+ "generateManifestBundle" instead of before them.
59
+
60
+
61
+ <a name="v3.0.0-alpha.4"></a>
62
+ ## [v3.0.0-alpha.4] - 2022-04-05
63
+ ### Features
64
+ - **builder:** Add cssVariables option ([#728](https://github.com/SAP/ui5-builder/issues/728)) [`30d58e1`](https://github.com/SAP/ui5-builder/commit/30d58e1081c1bdc665f13952ecbe5c400b5f4ed7)
65
+
66
+
67
+ <a name="v3.0.0-alpha.3"></a>
68
+ ## [v3.0.0-alpha.3] - 2022-03-10
69
+ ### Bug Fixes
70
+ - **LocatorResourcePool:** Wait for resources in prepare step ([#719](https://github.com/SAP/ui5-builder/issues/719)) [`1b7f93f`](https://github.com/SAP/ui5-builder/commit/1b7f93f4988340d7a6575be3191a02e6c295ebd0)
71
+
72
+
73
+ <a name="v3.0.0-alpha.2"></a>
74
+ ## [v3.0.0-alpha.2] - 2022-02-25
75
+ ### Bug Fixes
76
+ - **XMLTemplateAnalyzer:** Analyze core:require of FragmentDefinition [`af075ed`](https://github.com/SAP/ui5-builder/commit/af075edf784d9f1ba162a34f0bf150dbcbc0f479)
77
+
78
+ ### Features
79
+ - Generate source maps for bundles ([#695](https://github.com/SAP/ui5-builder/issues/695)) [`8a20c42`](https://github.com/SAP/ui5-builder/commit/8a20c4257a1ebe4d613b0595be93cd45d900f580)
80
+ - **replaceVersion/Copyright:** Also process test-resources ([#693](https://github.com/SAP/ui5-builder/issues/693)) [`a0d4bc2`](https://github.com/SAP/ui5-builder/commit/a0d4bc2a80d61e042786207af4bdbda6c3ddfe31)
81
+
82
+
83
+ <a name="v3.0.0-alpha.1"></a>
84
+ ## [v3.0.0-alpha.1] - 2022-01-25
85
+ ### Breaking Changes
86
+ - Require Node.js >= 16.13.2 / npm >= 8 [`dbf6c06`](https://github.com/SAP/ui5-builder/commit/dbf6c0694693070f73e9f96edef90f094d5bf721)
87
+ - **generateResourcesJson:** Make 'dependencies' parameter mandatory [`268dd16`](https://github.com/SAP/ui5-builder/commit/268dd16091c515ec0c922ea23af437d9aa8bf3ea)
88
+ - **moduleBundler:** Always default to `optimize: true` ([#685](https://github.com/SAP/ui5-builder/issues/685)) [`de5837c`](https://github.com/SAP/ui5-builder/commit/de5837c43449ea61deae3b2f02f9973f3fa37992)
89
+
90
+ ### Bug Fixes
91
+ - **Bundler:** Ensure reproducibility for bundles with multiple parts ([#689](https://github.com/SAP/ui5-builder/issues/689)) [`6f4588b`](https://github.com/SAP/ui5-builder/commit/6f4588b3eb687178e557ac4fb36481104f9681a0)
92
+ - **generateResourcesJson:** Don't list resources omitted from build result [`9608c51`](https://github.com/SAP/ui5-builder/commit/9608c5177f86494ba689d2e799b4378fec9ed6fa)
93
+ - **generateResourcesJson:** Analyze debug bundles ([#669](https://github.com/SAP/ui5-builder/issues/669)) [`f27513a`](https://github.com/SAP/ui5-builder/commit/f27513a259b30d39e260790781b6d435b4ab088b)
94
+
95
+ ### Features
96
+ - Support ES2021 language features [`e749b6a`](https://github.com/SAP/ui5-builder/commit/e749b6ae0838f923b27dd0d7d34da2174c433f5f)
97
+ - Add minify task and processor ([#666](https://github.com/SAP/ui5-builder/issues/666)) [`a3af604`](https://github.com/SAP/ui5-builder/commit/a3af604ff0a12fb9241dcd105cf0aec8d718a299)
98
+
99
+ ### BREAKING CHANGE
100
+
101
+ Support for older Node.js and npm releases has been dropped.
102
+ Only Node.js v16.13.2 and npm v8 or higher are supported.
103
+
104
+ The following tasks have been removed:
105
+ - createDebugFiles
106
+ - uglify
107
+
108
+ The following processors have been removed:
109
+ - debugFileCreator
110
+ - resourceCopier
111
+ - uglifier
112
+
113
+ As a replacement, the new 'minify' task and 'minifier' processor can be
114
+ used.
115
+
116
+ Note: The minify task is executed earlier, before the bundling
117
+ process takes place. Existing 'beforeTask' and 'afterTask' configuration of
118
+ custom tasks might need to be adapted to cater for this change.
119
+
120
+
121
+ <a name="v3.0.0-alpha.0"></a>
122
+ ## [v3.0.0-alpha.0] - 2021-12-14
18
123
  ### Bug Fixes
19
- - Enable buildThemes for libraries without .library [`7b941a7`](https://github.com/SAP/ui5-builder/commit/7b941a797210463a9fa8ca50753662c5db373aa6)
124
+ - **Bundler:** Sort raw modules by default [`0e11b69`](https://github.com/SAP/ui5-builder/commit/0e11b6965a1d2e63a96e9b738e38975b5ac755bc)
20
125
 
21
126
 
22
127
  <a name="v2.11.2"></a>
@@ -648,9 +753,17 @@ to load the custom bundle file instead.
648
753
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
649
754
 
650
755
 
651
- [v2.11.5]: https://github.com/SAP/ui5-builder/compare/v2.11.4...v2.11.5
652
- [v2.11.4]: https://github.com/SAP/ui5-builder/compare/v2.11.3...v2.11.4
653
- [v2.11.3]: https://github.com/SAP/ui5-builder/compare/v2.11.2...v2.11.3
756
+ [v3.0.0-alpha.10]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.9...v3.0.0-alpha.10
757
+ [v3.0.0-alpha.9]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.8...v3.0.0-alpha.9
758
+ [v3.0.0-alpha.8]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.7...v3.0.0-alpha.8
759
+ [v3.0.0-alpha.7]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.6...v3.0.0-alpha.7
760
+ [v3.0.0-alpha.6]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.5...v3.0.0-alpha.6
761
+ [v3.0.0-alpha.5]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.4...v3.0.0-alpha.5
762
+ [v3.0.0-alpha.4]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.3...v3.0.0-alpha.4
763
+ [v3.0.0-alpha.3]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.2...v3.0.0-alpha.3
764
+ [v3.0.0-alpha.2]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.1...v3.0.0-alpha.2
765
+ [v3.0.0-alpha.1]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.0...v3.0.0-alpha.1
766
+ [v3.0.0-alpha.0]: https://github.com/SAP/ui5-builder/compare/v2.11.2...v3.0.0-alpha.0
654
767
  [v2.11.2]: https://github.com/SAP/ui5-builder/compare/v2.11.1...v2.11.2
655
768
  [v2.11.1]: https://github.com/SAP/ui5-builder/compare/v2.11.0...v2.11.1
656
769
  [v2.11.0]: https://github.com/SAP/ui5-builder/compare/v2.10.0...v2.11.0
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
@@ -42,9 +38,9 @@ module.exports = {
42
38
  */
43
39
  bootstrapHtmlTransformer: "./lib/processors/bootstrapHtmlTransformer",
44
40
  /**
45
- * @type {import('./lib/processors/debugFileCreator')}
41
+ * @type {import('./lib/processors/minifier')}
46
42
  */
47
- debugFileCreator: "./lib/processors/debugFileCreator",
43
+ minifier: "./lib/processors/minifier",
48
44
  /**
49
45
  * @type {import('./lib/processors/libraryLessGenerator')}
50
46
  */
@@ -53,10 +49,6 @@ module.exports = {
53
49
  * @type {import('./lib/processors/manifestCreator')}
54
50
  */
55
51
  manifestCreator: "./lib/processors/manifestCreator",
56
- /**
57
- * @type {import('./lib/processors/resourceCopier')}
58
- */
59
- resourceCopier: "./lib/processors/resourceCopier",
60
52
  /**
61
53
  * @type {import('./lib/processors/nonAsciiEscaper')}
62
54
  */
@@ -69,10 +61,6 @@ module.exports = {
69
61
  * @type {import('./lib/processors/themeBuilder')}
70
62
  */
71
63
  themeBuilder: "./lib/processors/themeBuilder",
72
- /**
73
- * @type {import('./lib/processors/uglifier')}
74
- */
75
- uglifier: "./lib/processors/uglifier",
76
64
  /**
77
65
  * @type {import('./lib/processors/versionInfoGenerator')}
78
66
  */
@@ -121,9 +109,9 @@ module.exports = {
121
109
  */
122
110
  buildThemes: "./lib/tasks/buildThemes",
123
111
  /**
124
- * @type {import('./lib/tasks/createDebugFiles')}
112
+ * @type {import('./lib/tasks/minify')}
125
113
  */
126
- createDebugFiles: "./lib/tasks/createDebugFiles",
114
+ minify: "./lib/tasks/minify",
127
115
  /**
128
116
  * @type {import('./lib/tasks/jsdoc/executeJsdocSdkTransformation')}
129
117
  */
@@ -160,53 +148,10 @@ module.exports = {
160
148
  * @type {import('./lib/tasks/transformBootstrapHtml')}
161
149
  */
162
150
  transformBootstrapHtml: "./lib/tasks/transformBootstrapHtml",
163
- /**
164
- * @type {import('./lib/tasks/uglify')}
165
- */
166
- uglify: "./lib/tasks/uglify",
167
151
  /**
168
152
  * @type {import('./lib/tasks/taskRepository')}
169
153
  */
170
154
  taskRepository: "./lib/tasks/taskRepository",
171
- /**
172
- * @type {import('./lib/tasks/TaskUtil')}
173
- */
174
- TaskUtil: "./lib/tasks/TaskUtil"
175
- },
176
- /**
177
- * @private
178
- * @alias module:@ui5/builder.types
179
- * @namespace
180
- */
181
- types: {
182
- /**
183
- * @type {typeof import('./lib/types/AbstractBuilder')}
184
- */
185
- AbstractBuilder: "./lib/types/AbstractBuilder",
186
- /**
187
- * @type {typeof import('./lib/types/AbstractFormatter')}
188
- */
189
- AbstractFormatter: "./lib/types/AbstractFormatter",
190
- /**
191
- * @type {import('./lib/types/application/applicationType')}
192
- */
193
- application: "./lib/types/application/applicationType",
194
- /**
195
- * @type {import('./lib/types/library/libraryType')}
196
- */
197
- library: "./lib/types/library/libraryType",
198
- /**
199
- * @type {import('./lib/types/themeLibrary/themeLibraryType')}
200
- */
201
- themeLibrary: "./lib/types/themeLibrary/themeLibraryType",
202
- /**
203
- * @type {import('./lib/types/module/moduleType')}
204
- */
205
- module: "./lib/types/module/moduleType",
206
- /**
207
- * @type {import('./lib/types/typeRepository')}
208
- */
209
- typeRepository: "./lib/types/typeRepository"
210
155
  }
211
156
  };
212
157
 
package/jsdoc.json CHANGED
@@ -12,7 +12,6 @@
12
12
  "./jsdoc-plugin"
13
13
  ],
14
14
  "opts": {
15
- "template": "node_modules/docdash/",
16
15
  "encoding": "utf8",
17
16
  "destination": "jsdocs/",
18
17
  "recurse": true,
@@ -64,6 +64,7 @@ const EnrichedVisitorKeys = (function() {
64
64
  BreakStatement: [],
65
65
  CallExpression: [], // special handling
66
66
  CatchClause: ["param", "body"],
67
+ ChainExpression: [],
67
68
  ClassBody: [],
68
69
  ClassDeclaration: [],
69
70
  ClassExpression: [],
@@ -125,8 +126,10 @@ const EnrichedVisitorKeys = (function() {
125
126
  * All properties in an object pattern are executed.
126
127
  */
127
128
  ObjectPattern: [], // properties
129
+ // PrivateIdentifier: [], // will come with ES2022
128
130
  Program: [],
129
131
  Property: [],
132
+ // PropertyDefinition: [], // will come with ES2022
130
133
  /*
131
134
  * argument of the rest element is always executed under the same condition as the rest element itself
132
135
  */
@@ -134,6 +137,7 @@ const EnrichedVisitorKeys = (function() {
134
137
  ReturnStatement: [],
135
138
  SequenceExpression: [],
136
139
  SpreadElement: [], // the argument of the spread operator always needs to be evaluated - argument
140
+ // StaticBlock: [], // will come with ES2022
137
141
  Super: [],
138
142
  SwitchStatement: [],
139
143
  SwitchCase: ["test", "consequent"], // test and consequent are executed only conditionally
@@ -171,9 +175,11 @@ const EnrichedVisitorKeys = (function() {
171
175
 
172
176
  // merge with 'official' visitor keys
173
177
  Object.keys(VisitorKeys).forEach( (type) => {
174
- // Check if the visitor-key exists in the available Syntax because
175
- // the list of visitor-keys does not match the available Syntax.
176
- if (!Syntax[type]) {
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") {
177
183
  return;
178
184
  }
179
185
  // Ignore JSX visitor-keys because they aren't used.
@@ -181,6 +187,15 @@ const EnrichedVisitorKeys = (function() {
181
187
  return;
182
188
  }
183
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
+
184
199
  const visitorKeys = VisitorKeys[type];
185
200
  const condKeys = TempKeys[type];
186
201
  if ( condKeys === undefined ) {
@@ -286,6 +301,9 @@ class JSModuleAnalyzer {
286
301
  */
287
302
  let bIsUi5Module = false;
288
303
 
304
+ // Module name via @ui5-bundle comment in first line. Overrides all other main module candidates.
305
+ let firstLineBundleName;
306
+
289
307
  // first analyze the whole AST...
290
308
  visit(ast, false);
291
309
 
@@ -299,7 +317,12 @@ class JSModuleAnalyzer {
299
317
  log.verbose(`bundle include directive ${subModule}`);
300
318
  } else if ( comment.value.startsWith("@ui5-bundle ") ) {
301
319
  const bundleName = comment.value.slice("@ui5-bundle ".length);
302
- 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
+ }
303
326
  log.verbose(`bundle name directive ${bundleName}`);
304
327
  } else {
305
328
  log.warn(`unrecognized bundle directive ${comment.value}`);
@@ -309,7 +332,10 @@ class JSModuleAnalyzer {
309
332
  }
310
333
 
311
334
  // ...and finally take conclusions about the file's content
312
- 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 ) {
313
339
  // if there's exactly one module definition in this file but it didn't
314
340
  // immediately qualify as main module, make it now the main module
315
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
  }
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- const terser = require("terser");
4
3
  const {pd} = require("pretty-data");
5
4
 
6
5
  const ModuleName = require("../utils/ModuleName");
@@ -8,7 +7,6 @@ const {SectionType} = require("./BundleDefinition");
8
7
  const escapePropertiesFile = require("../utils/escapePropertiesFile");
9
8
  const log = require("@ui5/logger").getLogger("lbt:bundle:AutoSplitter");
10
9
 
11
- const copyrightCommentsPattern = /copyright|\(c\)(?:[0-9]+|\s+[0-9A-za-z])|released under|license|\u00a9/i;
12
10
  const xmlHtmlPrePattern = /<(?:\w+:)?pre\b/;
13
11
 
14
12
  /**
@@ -112,6 +110,7 @@ class AutoSplitter {
112
110
 
113
111
  resolvedModule.sections.forEach( (section) => {
114
112
  let currentSection;
113
+ let sequence;
115
114
  switch ( section.mode ) {
116
115
  case SectionType.Provided:
117
116
  // 'provided' sections are no longer needed in a fully resolved module
@@ -131,16 +130,20 @@ class AutoSplitter {
131
130
  });
132
131
  break;
133
132
  case SectionType.Preload:
133
+ sequence = section.modules.slice();
134
+ // simple version: just sort alphabetically
135
+ sequence.sort();
136
+
134
137
  // NODE_TODO: sort by copyright:
135
- // sequence = section.modules.slice();
136
138
  // jsBuilder.beforeWriteFunctionPreloadSection((List<ModuleName>) sequence);
139
+
137
140
  currentSection = {
138
141
  mode: SectionType.Preload,
139
142
  filters: []
140
143
  };
141
144
  currentSection.name = section.name;
142
145
  currentModule.sections.push( currentSection );
143
- section.modules.forEach( (module) => {
146
+ sequence.forEach( (module) => {
144
147
  const moduleSize = moduleSizes[module];
145
148
  if ( part + 1 < numberOfParts && totalSize + moduleSize / 2 > partSize ) {
146
149
  part++;
@@ -195,26 +198,9 @@ class AutoSplitter {
195
198
  }
196
199
 
197
200
  if ( /\.js$/.test(module) ) {
198
- // console.log("determining compressed size for %s", module);
199
- let fileContent = await resource.buffer();
200
- if ( this.optimize ) {
201
- // console.log("uglify %s start", module);
202
- const result = await terser.minify({
203
- [resource.name]: String(fileContent)
204
- }, {
205
- warnings: false, // TODO configure?
206
- compress: false, // TODO configure?
207
- output: {
208
- comments: copyrightCommentsPattern,
209
- wrap_func_args: false
210
- }
211
- // , outFileName: resource.name
212
- // , outSourceMap: true
213
- });
214
- // console.log("uglify %s end", module);
215
- fileContent = result.code;
216
- }
217
- // trace.debug("analyzed %s:%d%n", module, mw.getTargetLength());
201
+ // No optimize / minify step here as the input should be
202
+ // either already optimized or not, based on the bundle options
203
+ const fileContent = await resource.buffer();
218
204
  return fileContent.length;
219
205
  } else if ( /\.properties$/.test(module) ) {
220
206
  /* NODE-TODO minimize *.properties