@ui5/builder 3.0.0-alpha.0 → 3.0.0-alpha.3
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 +58 -1
- 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 +18 -3
- package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +2 -1
- package/lib/lbt/bundle/AutoSplitter.js +10 -24
- package/lib/lbt/bundle/Builder.js +363 -134
- package/lib/lbt/bundle/BundleWriter.js +17 -0
- package/lib/lbt/resources/LocatorResource.js +6 -8
- package/lib/lbt/resources/LocatorResourcePool.js +8 -4
- 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 +40 -14
- package/lib/processors/minifier.js +90 -0
- package/lib/processors/resourceListCreator.js +2 -16
- package/lib/tasks/TaskUtil.js +9 -9
- package/lib/tasks/bundlers/generateBundle.js +81 -13
- package/lib/tasks/bundlers/generateComponentPreload.js +20 -6
- package/lib/tasks/bundlers/generateFlexChangesBundle.js +3 -2
- package/lib/tasks/bundlers/generateLibraryPreload.js +65 -10
- package/lib/tasks/bundlers/generateStandaloneAppBundle.js +46 -12
- package/lib/tasks/bundlers/utils/createModuleNameMapping.js +30 -0
- package/lib/tasks/generateResourcesJson.js +14 -8
- package/lib/tasks/minify.js +41 -0
- package/lib/tasks/taskRepository.js +6 -2
- package/lib/types/application/ApplicationBuilder.js +22 -31
- package/lib/types/library/LibraryBuilder.js +23 -29
- package/lib/types/themeLibrary/ThemeLibraryBuilder.js +1 -0
- package/package.json +16 -14
- 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/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,61 @@
|
|
|
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/v3.0.0-alpha.
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.3...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v3.0.0-alpha.3"></a>
|
|
8
|
+
## [v3.0.0-alpha.3] - 2022-03-10
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
- **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)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<a name="v3.0.0-alpha.2"></a>
|
|
14
|
+
## [v3.0.0-alpha.2] - 2022-02-25
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
- **XMLTemplateAnalyzer:** Analyze core:require of FragmentDefinition [`af075ed`](https://github.com/SAP/ui5-builder/commit/af075edf784d9f1ba162a34f0bf150dbcbc0f479)
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
- Generate source maps for bundles ([#695](https://github.com/SAP/ui5-builder/issues/695)) [`8a20c42`](https://github.com/SAP/ui5-builder/commit/8a20c4257a1ebe4d613b0595be93cd45d900f580)
|
|
20
|
+
- **replaceVersion/Copyright:** Also process test-resources ([#693](https://github.com/SAP/ui5-builder/issues/693)) [`a0d4bc2`](https://github.com/SAP/ui5-builder/commit/a0d4bc2a80d61e042786207af4bdbda6c3ddfe31)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<a name="v3.0.0-alpha.1"></a>
|
|
24
|
+
## [v3.0.0-alpha.1] - 2022-01-25
|
|
25
|
+
### Breaking Changes
|
|
26
|
+
- Require Node.js >= 16.13.2 / npm >= 8 [`dbf6c06`](https://github.com/SAP/ui5-builder/commit/dbf6c0694693070f73e9f96edef90f094d5bf721)
|
|
27
|
+
- **generateResourcesJson:** Make 'dependencies' parameter mandatory [`268dd16`](https://github.com/SAP/ui5-builder/commit/268dd16091c515ec0c922ea23af437d9aa8bf3ea)
|
|
28
|
+
- **moduleBundler:** Always default to `optimize: true` ([#685](https://github.com/SAP/ui5-builder/issues/685)) [`de5837c`](https://github.com/SAP/ui5-builder/commit/de5837c43449ea61deae3b2f02f9973f3fa37992)
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
- **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)
|
|
32
|
+
- **generateResourcesJson:** Don't list resources omitted from build result [`9608c51`](https://github.com/SAP/ui5-builder/commit/9608c5177f86494ba689d2e799b4378fec9ed6fa)
|
|
33
|
+
- **generateResourcesJson:** Analyze debug bundles ([#669](https://github.com/SAP/ui5-builder/issues/669)) [`f27513a`](https://github.com/SAP/ui5-builder/commit/f27513a259b30d39e260790781b6d435b4ab088b)
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
- Support ES2021 language features [`e749b6a`](https://github.com/SAP/ui5-builder/commit/e749b6ae0838f923b27dd0d7d34da2174c433f5f)
|
|
37
|
+
- Add minify task and processor ([#666](https://github.com/SAP/ui5-builder/issues/666)) [`a3af604`](https://github.com/SAP/ui5-builder/commit/a3af604ff0a12fb9241dcd105cf0aec8d718a299)
|
|
38
|
+
|
|
39
|
+
### BREAKING CHANGE
|
|
40
|
+
|
|
41
|
+
Support for older Node.js and npm releases has been dropped.
|
|
42
|
+
Only Node.js v16.13.2 and npm v8 or higher are supported.
|
|
43
|
+
|
|
44
|
+
The following tasks have been removed:
|
|
45
|
+
- createDebugFiles
|
|
46
|
+
- uglify
|
|
47
|
+
|
|
48
|
+
The following processors have been removed:
|
|
49
|
+
- debugFileCreator
|
|
50
|
+
- resourceCopier
|
|
51
|
+
- uglifier
|
|
52
|
+
|
|
53
|
+
As a replacement, the new 'minify' task and 'minifier' processor can be
|
|
54
|
+
used.
|
|
55
|
+
|
|
56
|
+
Note: The minify task is executed earlier, before the bundling
|
|
57
|
+
process takes place. Existing 'beforeTask' and 'afterTask' configuration of
|
|
58
|
+
custom tasks might need to be adapted to cater for this change.
|
|
59
|
+
|
|
6
60
|
|
|
7
61
|
<a name="v3.0.0-alpha.0"></a>
|
|
8
62
|
## [v3.0.0-alpha.0] - 2021-12-14
|
|
@@ -639,6 +693,9 @@ to load the custom bundle file instead.
|
|
|
639
693
|
- Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
|
|
640
694
|
|
|
641
695
|
|
|
696
|
+
[v3.0.0-alpha.3]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.2...v3.0.0-alpha.3
|
|
697
|
+
[v3.0.0-alpha.2]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.1...v3.0.0-alpha.2
|
|
698
|
+
[v3.0.0-alpha.1]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.0...v3.0.0-alpha.1
|
|
642
699
|
[v3.0.0-alpha.0]: https://github.com/SAP/ui5-builder/compare/v2.11.2...v3.0.0-alpha.0
|
|
643
700
|
[v2.11.2]: https://github.com/SAP/ui5-builder/compare/v2.11.1...v2.11.2
|
|
644
701
|
[v2.11.1]: https://github.com/SAP/ui5-builder/compare/v2.11.0...v2.11.1
|
package/index.js
CHANGED
|
@@ -42,9 +42,9 @@ module.exports = {
|
|
|
42
42
|
*/
|
|
43
43
|
bootstrapHtmlTransformer: "./lib/processors/bootstrapHtmlTransformer",
|
|
44
44
|
/**
|
|
45
|
-
* @type {import('./lib/processors/
|
|
45
|
+
* @type {import('./lib/processors/minifier')}
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
minifier: "./lib/processors/minifier",
|
|
48
48
|
/**
|
|
49
49
|
* @type {import('./lib/processors/libraryLessGenerator')}
|
|
50
50
|
*/
|
|
@@ -53,10 +53,6 @@ module.exports = {
|
|
|
53
53
|
* @type {import('./lib/processors/manifestCreator')}
|
|
54
54
|
*/
|
|
55
55
|
manifestCreator: "./lib/processors/manifestCreator",
|
|
56
|
-
/**
|
|
57
|
-
* @type {import('./lib/processors/resourceCopier')}
|
|
58
|
-
*/
|
|
59
|
-
resourceCopier: "./lib/processors/resourceCopier",
|
|
60
56
|
/**
|
|
61
57
|
* @type {import('./lib/processors/nonAsciiEscaper')}
|
|
62
58
|
*/
|
|
@@ -69,10 +65,6 @@ module.exports = {
|
|
|
69
65
|
* @type {import('./lib/processors/themeBuilder')}
|
|
70
66
|
*/
|
|
71
67
|
themeBuilder: "./lib/processors/themeBuilder",
|
|
72
|
-
/**
|
|
73
|
-
* @type {import('./lib/processors/uglifier')}
|
|
74
|
-
*/
|
|
75
|
-
uglifier: "./lib/processors/uglifier",
|
|
76
68
|
/**
|
|
77
69
|
* @type {import('./lib/processors/versionInfoGenerator')}
|
|
78
70
|
*/
|
|
@@ -121,9 +113,9 @@ module.exports = {
|
|
|
121
113
|
*/
|
|
122
114
|
buildThemes: "./lib/tasks/buildThemes",
|
|
123
115
|
/**
|
|
124
|
-
* @type {import('./lib/tasks/
|
|
116
|
+
* @type {import('./lib/tasks/minify')}
|
|
125
117
|
*/
|
|
126
|
-
|
|
118
|
+
minify: "./lib/tasks/minify",
|
|
127
119
|
/**
|
|
128
120
|
* @type {import('./lib/tasks/jsdoc/executeJsdocSdkTransformation')}
|
|
129
121
|
*/
|
|
@@ -160,10 +152,6 @@ module.exports = {
|
|
|
160
152
|
* @type {import('./lib/tasks/transformBootstrapHtml')}
|
|
161
153
|
*/
|
|
162
154
|
transformBootstrapHtml: "./lib/tasks/transformBootstrapHtml",
|
|
163
|
-
/**
|
|
164
|
-
* @type {import('./lib/tasks/uglify')}
|
|
165
|
-
*/
|
|
166
|
-
uglify: "./lib/tasks/uglify",
|
|
167
155
|
/**
|
|
168
156
|
* @type {import('./lib/tasks/taskRepository')}
|
|
169
157
|
*/
|
package/jsdoc.json
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
const ResourceTagCollection = require("@ui5/fs").ResourceTagCollection;
|
|
1
2
|
const ProjectBuildContext = require("./ProjectBuildContext");
|
|
2
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
|
+
|
|
3
11
|
/**
|
|
4
12
|
* Context of a build process
|
|
5
13
|
*
|
|
@@ -13,6 +21,10 @@ class BuildContext {
|
|
|
13
21
|
}
|
|
14
22
|
this.rootProject = rootProject;
|
|
15
23
|
this.projectBuildContexts = [];
|
|
24
|
+
|
|
25
|
+
this._resourceTagCollection = new ResourceTagCollection({
|
|
26
|
+
allowedTags: Object.values(GLOBAL_TAGS)
|
|
27
|
+
});
|
|
16
28
|
}
|
|
17
29
|
|
|
18
30
|
getRootProject() {
|
|
@@ -22,6 +34,7 @@ class BuildContext {
|
|
|
22
34
|
createProjectContext({project, resources}) {
|
|
23
35
|
const projectBuildContext = new ProjectBuildContext({
|
|
24
36
|
buildContext: this,
|
|
37
|
+
globalTags: GLOBAL_TAGS,
|
|
25
38
|
project,
|
|
26
39
|
resources
|
|
27
40
|
});
|
|
@@ -34,6 +47,10 @@ class BuildContext {
|
|
|
34
47
|
return ctx.executeCleanupTasks();
|
|
35
48
|
}));
|
|
36
49
|
}
|
|
50
|
+
|
|
51
|
+
getResourceTagCollection() {
|
|
52
|
+
return this._resourceTagCollection;
|
|
53
|
+
}
|
|
37
54
|
}
|
|
38
55
|
|
|
39
56
|
module.exports = BuildContext;
|
|
@@ -2,10 +2,10 @@ const ResourceTagCollection = require("@ui5/fs").ResourceTagCollection;
|
|
|
2
2
|
|
|
3
3
|
// Note: When adding standard tags, always update the public documentation in TaskUtil
|
|
4
4
|
// (Type "module:@ui5/builder.tasks.TaskUtil~StandardBuildTags")
|
|
5
|
-
const STANDARD_TAGS =
|
|
5
|
+
const STANDARD_TAGS = {
|
|
6
6
|
OmitFromBuildResult: "ui5:OmitFromBuildResult",
|
|
7
|
-
IsBundle: "ui5:IsBundle"
|
|
8
|
-
}
|
|
7
|
+
IsBundle: "ui5:IsBundle",
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Build context of a single project. Always part of an overall
|
|
@@ -15,8 +15,8 @@ const STANDARD_TAGS = Object.freeze({
|
|
|
15
15
|
* @memberof module:@ui5/builder.builder
|
|
16
16
|
*/
|
|
17
17
|
class ProjectBuildContext {
|
|
18
|
-
constructor({buildContext, project, resources}) {
|
|
19
|
-
if (!buildContext || !project || !resources) {
|
|
18
|
+
constructor({buildContext, globalTags, project, resources}) {
|
|
19
|
+
if (!buildContext || !globalTags || !project || !resources) {
|
|
20
20
|
throw new Error(`One or more mandatory parameters are missing`);
|
|
21
21
|
}
|
|
22
22
|
this._buildContext = buildContext;
|
|
@@ -26,10 +26,12 @@ class ProjectBuildContext {
|
|
|
26
26
|
cleanup: []
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
this.STANDARD_TAGS = STANDARD_TAGS;
|
|
29
|
+
this.STANDARD_TAGS = Object.assign({}, STANDARD_TAGS, globalTags);
|
|
30
|
+
Object.freeze(this.STANDARD_TAGS);
|
|
30
31
|
|
|
31
32
|
this._resourceTagCollection = new ResourceTagCollection({
|
|
32
|
-
allowedTags: Object.values(this.STANDARD_TAGS)
|
|
33
|
+
allowedTags: Object.values(this.STANDARD_TAGS),
|
|
34
|
+
superCollection: this._buildContext.getResourceTagCollection()
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
37
|
|
package/lib/builder/builder.js
CHANGED
|
@@ -94,8 +94,7 @@ function composeTaskList({dev, selfContained, jsdoc, includedTasks, excludedTask
|
|
|
94
94
|
selectedTasks.generateComponentPreload = false;
|
|
95
95
|
selectedTasks.generateLibraryPreload = false;
|
|
96
96
|
selectedTasks.generateLibraryManifest = false;
|
|
97
|
-
selectedTasks.
|
|
98
|
-
selectedTasks.uglify = false;
|
|
97
|
+
selectedTasks.minify = false;
|
|
99
98
|
selectedTasks.generateFlexChangesBundle = false;
|
|
100
99
|
selectedTasks.generateManifestBundle = false;
|
|
101
100
|
}
|
|
@@ -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
|
-
//
|
|
175
|
-
//
|
|
176
|
-
|
|
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 ) {
|
|
@@ -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
|
-
|
|
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
|
-
//
|
|
199
|
-
|
|
200
|
-
|
|
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
|