@ui5/builder 3.0.0-alpha.11 → 3.0.0-alpha.12
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 +18 -2
- package/jsdoc.json +2 -2
- package/lib/lbt/UI5ClientConstants.js +7 -8
- package/lib/lbt/analyzer/ComponentAnalyzer.js +10 -10
- package/lib/lbt/analyzer/FioriElementsAnalyzer.js +9 -9
- package/lib/lbt/analyzer/JSModuleAnalyzer.js +32 -25
- package/lib/lbt/analyzer/SmartTemplateAnalyzer.js +9 -9
- package/lib/lbt/analyzer/XMLCompositeAnalyzer.js +8 -8
- package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +19 -17
- package/lib/lbt/analyzer/analyzeLibraryJS.js +8 -7
- package/lib/lbt/bundle/AutoSplitter.js +10 -11
- package/lib/lbt/bundle/Builder.js +29 -32
- package/lib/lbt/bundle/BundleDefinition.js +1 -5
- package/lib/lbt/bundle/BundleWriter.js +1 -2
- package/lib/lbt/bundle/ResolvedBundleDefinition.js +6 -7
- package/lib/lbt/bundle/Resolver.js +9 -10
- package/lib/lbt/calls/SapUiDefine.js +5 -6
- package/lib/lbt/graph/dependencyGraph.js +3 -4
- package/lib/lbt/graph/dominatorTree.js +3 -3
- package/lib/lbt/graph/topologicalSort.js +3 -3
- package/lib/lbt/resources/LibraryFileAnalyzer.js +5 -8
- package/lib/lbt/resources/LocatorResource.js +2 -2
- package/lib/lbt/resources/LocatorResourcePool.js +3 -3
- package/lib/lbt/resources/ModuleInfo.js +1 -2
- package/lib/lbt/resources/Resource.js +3 -4
- package/lib/lbt/resources/ResourceCollector.js +7 -8
- package/lib/lbt/resources/ResourceFilterList.js +38 -40
- package/lib/lbt/resources/ResourceInfo.js +1 -1
- package/lib/lbt/resources/ResourceInfoList.js +2 -2
- package/lib/lbt/resources/ResourcePool.js +15 -21
- package/lib/lbt/utils/ASTUtils.js +17 -30
- package/lib/lbt/utils/JSTokenizer.js +4 -4
- package/lib/lbt/utils/ModuleName.js +10 -20
- package/lib/lbt/utils/escapePropertiesFile.js +3 -3
- package/lib/lbt/utils/parseUtils.js +4 -10
- package/lib/processors/bootstrapHtmlTransformer.js +15 -7
- package/lib/processors/bundlers/flexChangesBundler.js +16 -8
- package/lib/processors/bundlers/manifestBundler.js +19 -10
- package/lib/processors/bundlers/moduleBundler.js +26 -15
- package/lib/processors/jsdoc/apiIndexGenerator.js +16 -9
- package/lib/processors/jsdoc/jsdocGenerator.js +31 -17
- package/lib/processors/jsdoc/lib/{createIndexFiles.js → createIndexFiles.cjs} +0 -0
- package/lib/processors/jsdoc/lib/{transformApiJson.js → transformApiJson.cjs} +0 -0
- package/lib/processors/jsdoc/lib/ui5/{plugin.js → plugin.cjs} +0 -0
- package/lib/processors/jsdoc/lib/ui5/template/{publish.js → publish.cjs} +1 -1
- package/lib/processors/jsdoc/lib/ui5/template/utils/{versionUtil.js → versionUtil.cjs} +0 -0
- package/lib/processors/jsdoc/sdkTransformer.js +18 -11
- package/lib/processors/libraryLessGenerator.js +28 -16
- package/lib/processors/manifestCreator.js +14 -13
- package/lib/processors/minifier.js +21 -15
- package/lib/processors/nonAsciiEscaper.js +16 -6
- package/lib/processors/resourceListCreator.js +13 -13
- package/lib/processors/stringReplacer.js +13 -6
- package/lib/processors/themeBuilder.js +30 -22
- package/lib/processors/versionInfoGenerator.js +33 -23
- package/lib/tasks/buildThemes.js +17 -10
- package/lib/tasks/bundlers/generateBundle.js +23 -12
- package/lib/tasks/bundlers/generateComponentPreload.js +18 -10
- package/lib/tasks/bundlers/generateFlexChangesBundle.js +16 -8
- package/lib/tasks/bundlers/generateLibraryPreload.js +22 -12
- package/lib/tasks/bundlers/generateManifestBundle.js +15 -6
- package/lib/tasks/bundlers/generateStandaloneAppBundle.js +21 -13
- package/lib/tasks/bundlers/utils/createModuleNameMapping.js +6 -6
- package/lib/tasks/escapeNonAsciiCharacters.js +12 -5
- package/lib/tasks/generateCachebusterInfo.js +16 -8
- package/lib/tasks/generateLibraryManifest.js +14 -8
- package/lib/tasks/generateResourcesJson.js +15 -9
- package/lib/tasks/generateThemeDesignerResources.js +19 -9
- package/lib/tasks/generateVersionInfo.js +12 -5
- package/lib/tasks/jsdoc/executeJsdocSdkTransformation.js +17 -9
- package/lib/tasks/jsdoc/generateApiIndex.js +16 -10
- package/lib/tasks/jsdoc/generateJsdoc.js +131 -119
- package/lib/tasks/minify.js +13 -6
- package/lib/tasks/replaceBuildtime.js +12 -5
- package/lib/tasks/replaceCopyright.js +12 -5
- package/lib/tasks/replaceVersion.js +12 -5
- package/lib/tasks/taskRepository.js +24 -29
- package/lib/tasks/transformBootstrapHtml.js +6 -5
- package/package.json +29 -15
- package/index.js +0 -173
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,25 @@
|
|
|
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.12...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v3.0.0-alpha.12"></a>
|
|
8
|
+
## [v3.0.0-alpha.12] - 2022-10-24
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
- Transform to native ESM ([#790](https://github.com/SAP/ui5-builder/issues/790)) [`a439aa9`](https://github.com/SAP/ui5-builder/commit/a439aa9f679dfe2e18b8c540f54876f94c0de119)
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGE
|
|
13
|
+
|
|
14
|
+
This package has been transformed to native ESM. Therefore it no longer provides a CommonJS export.
|
|
15
|
+
If your project uses CommonJS, it needs to be converted to ESM or use a dynamic import.
|
|
16
|
+
|
|
17
|
+
For more information see also:
|
|
18
|
+
- https://sap.github.io/ui5-tooling/updates/migrate-v3/
|
|
19
|
+
- https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
|
20
|
+
|
|
6
21
|
|
|
7
22
|
<a name="v3.0.0-alpha.11"></a>
|
|
8
|
-
## [v3.0.0-alpha.11] - 2022-10-
|
|
23
|
+
## [v3.0.0-alpha.11] - 2022-10-20
|
|
9
24
|
### Bug Fixes
|
|
10
25
|
- **package.json:** Downgrade es5-ext dependency [`2b71707`](https://github.com/SAP/ui5-builder/commit/2b71707683480b26aab9957c09e5d22bce8a6450)
|
|
11
26
|
|
|
@@ -769,6 +784,7 @@ to load the custom bundle file instead.
|
|
|
769
784
|
- Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
|
|
770
785
|
|
|
771
786
|
|
|
787
|
+
[v3.0.0-alpha.12]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.11...v3.0.0-alpha.12
|
|
772
788
|
[v3.0.0-alpha.11]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.10...v3.0.0-alpha.11
|
|
773
789
|
[v3.0.0-alpha.10]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.9...v3.0.0-alpha.10
|
|
774
790
|
[v3.0.0-alpha.9]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.8...v3.0.0-alpha.9
|
package/jsdoc.json
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
"allowUnknownTags": false
|
|
4
4
|
},
|
|
5
5
|
"source": {
|
|
6
|
-
"include": ["README.md"
|
|
6
|
+
"include": ["README.md"],
|
|
7
7
|
"exclude": ["lib/lbt/utils/JSTokenizer.js"],
|
|
8
8
|
"includePattern": ".+\\.js$",
|
|
9
9
|
"excludePattern": "(node_modules(\\\\|/))"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
|
-
"./jsdoc-plugin"
|
|
12
|
+
"./jsdoc-plugin.cjs"
|
|
13
13
|
],
|
|
14
14
|
"opts": {
|
|
15
15
|
"encoding": "utf8",
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
export const MODULE__UI5LOADER = "ui5loader.js";
|
|
3
|
+
export const MODULE__UI5LOADER_AUTOCONFIG = "ui5loader-autoconfig.js";
|
|
4
|
+
export const MODULE__JQUERY_SAP_GLOBAL = "jquery.sap.global.js";
|
|
5
|
+
export const MODULE__SAP_UI_CORE_CORE = "sap/ui/core/Core.js";
|
|
6
|
+
export const EVO_MARKER_RESOURCE = MODULE__UI5LOADER;
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
export function getRendererName( module ) {
|
|
10
9
|
if ( /\.js$/.test(module) ) {
|
|
11
10
|
return module.replace(/\.js$/, "Renderer.js");
|
|
12
11
|
}
|
|
13
|
-
}
|
|
12
|
+
}
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
* This class can handle multiple concurrent analysis calls, it has no instance state
|
|
19
19
|
* other than the pool (which is readonly).
|
|
20
20
|
*/
|
|
21
|
-
"use strict";
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
import {fromUI5LegacyName} from "../utils/ModuleName.js";
|
|
23
|
+
import logger from "@ui5/logger";
|
|
24
|
+
const log = logger.getLogger("lbt:analyzer:ComponentAnalyzer");
|
|
25
25
|
|
|
26
26
|
// ---------------------------------------------------------------------------------------------------------
|
|
27
27
|
|
|
@@ -97,7 +97,7 @@ class ComponentAnalyzer {
|
|
|
97
97
|
} else {
|
|
98
98
|
rootView = ui5.rootView;
|
|
99
99
|
}
|
|
100
|
-
const module =
|
|
100
|
+
const module = fromUI5LegacyName(
|
|
101
101
|
rootView.viewName,
|
|
102
102
|
".view." + rootView.type.toLowerCase() );
|
|
103
103
|
log.verbose("adding root view dependency ", module);
|
|
@@ -105,13 +105,13 @@ class ComponentAnalyzer {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
each( ui5.dependencies && ui5.dependencies.libs, (options, lib) => {
|
|
108
|
-
const module =
|
|
108
|
+
const module = fromUI5LegacyName(lib, "/library.js");
|
|
109
109
|
log.verbose("adding library dependency ", module, options.lazy || false);
|
|
110
110
|
info.addDependency( module, options.lazy ); // lazy -> conditional dependency
|
|
111
111
|
});
|
|
112
112
|
|
|
113
113
|
each( ui5.dependencies && ui5.dependencies.components, (options, component) => {
|
|
114
|
-
const module =
|
|
114
|
+
const module = fromUI5LegacyName(component, "/Component.js");
|
|
115
115
|
log.verbose("adding component dependency ", module, options.lazy || false);
|
|
116
116
|
info.addDependency( module, options.lazy ); // lazy -> conditional dependency
|
|
117
117
|
});
|
|
@@ -163,7 +163,7 @@ class ComponentAnalyzer {
|
|
|
163
163
|
log.warn(`Neither a type nor a dataSource has been defined for model "${model}".`);
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
|
-
const module =
|
|
166
|
+
const module = fromUI5LegacyName( modelType );
|
|
167
167
|
log.verbose("derived model implementation dependency ", module);
|
|
168
168
|
info.addDependency(module);
|
|
169
169
|
});
|
|
@@ -175,7 +175,7 @@ class ComponentAnalyzer {
|
|
|
175
175
|
// See sap/ui/core/UIComponent#init
|
|
176
176
|
if (routing.routes) {
|
|
177
177
|
const routerClassName = routingConfig.routerClass || "sap.ui.core.routing.Router";
|
|
178
|
-
const routerClassModule =
|
|
178
|
+
const routerClassModule = fromUI5LegacyName(routerClassName);
|
|
179
179
|
log.verbose(`adding router dependency '${routerClassModule}'`);
|
|
180
180
|
info.addDependency(routerClassModule);
|
|
181
181
|
} else if (routing.targets) {
|
|
@@ -194,7 +194,7 @@ class ComponentAnalyzer {
|
|
|
194
194
|
if (target && target.viewName) {
|
|
195
195
|
// merge target config with default config
|
|
196
196
|
const config = Object.assign({}, routing.config, target);
|
|
197
|
-
const module =
|
|
197
|
+
const module = fromUI5LegacyName(
|
|
198
198
|
(config.viewPath ? config.viewPath + "." : "") +
|
|
199
199
|
config.viewName, ".view." + config.viewType.toLowerCase() );
|
|
200
200
|
log.verbose("converting routing target '%s' to view dependency '%s'", targetName, module);
|
|
@@ -209,4 +209,4 @@ class ComponentAnalyzer {
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
export default ComponentAnalyzer;
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
* This class can handle multiple concurrent analysis calls, it has no instance state other than the pool
|
|
57
57
|
* (which is readonly).
|
|
58
58
|
*/
|
|
59
|
-
"use strict";
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
import {fromUI5LegacyName} from "../utils/ModuleName.js";
|
|
61
|
+
import SapUiDefine from "../calls/SapUiDefine.js";
|
|
62
|
+
import {parseJS, Syntax} from "../utils/parseUtils.js";
|
|
63
|
+
import {getValue, isMethodCall, getStringValue} from "../utils/ASTUtils.js";
|
|
64
|
+
import logger from "@ui5/logger";
|
|
65
|
+
const log = logger.getLogger("lbt:analyzer:FioriElementAnalyzer");
|
|
66
66
|
|
|
67
67
|
// ---------------------------------------------------------------------------------------------------------
|
|
68
68
|
|
|
@@ -129,7 +129,7 @@ class FioriElementsAnalyzer {
|
|
|
129
129
|
}
|
|
130
130
|
each(activityCfg, (actionCfg) => {
|
|
131
131
|
if ( actionCfg.template ) {
|
|
132
|
-
const module =
|
|
132
|
+
const module = fromUI5LegacyName( "sap.fe.templates." +
|
|
133
133
|
actionCfg.template + ".Component" );
|
|
134
134
|
log.verbose("template app: add dependency to template component %s", module);
|
|
135
135
|
info.addDependency(module);
|
|
@@ -151,7 +151,7 @@ class FioriElementsAnalyzer {
|
|
|
151
151
|
const templateName = (pageConfig.component && pageConfig.component.settings &&
|
|
152
152
|
pageConfig.component.settings.templateName) || defaultTemplateName;
|
|
153
153
|
if ( templateName ) {
|
|
154
|
-
const templateModuleName =
|
|
154
|
+
const templateModuleName = fromUI5LegacyName( templateName, ".view.xml" );
|
|
155
155
|
log.verbose("template app: add dependency to template view %s", templateModuleName);
|
|
156
156
|
appInfo.addDependency(templateModuleName);
|
|
157
157
|
}
|
|
@@ -197,4 +197,4 @@ class FioriElementsAnalyzer {
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
export default FioriElementsAnalyzer;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import {Syntax, VisitorKeys} from "../utils/parseUtils.js";
|
|
2
|
+
import escope from "escope";
|
|
3
|
+
import {fromUI5LegacyName, fromRequireJSName, resolveRelativeRequireJSName} from "../utils/ModuleName.js";
|
|
4
|
+
import moduleInfo from "../resources/ModuleInfo.js";
|
|
5
|
+
const ModuleFormat = moduleInfo.Format;
|
|
6
|
+
import {MODULE__JQUERY_SAP_GLOBAL, MODULE__UI5LOADER_AUTOCONFIG} from "../UI5ClientConstants.js";
|
|
7
|
+
import {
|
|
8
|
+
findOwnProperty,
|
|
9
|
+
getLocation,
|
|
10
|
+
getPropertyKey,
|
|
11
|
+
isMethodCall,
|
|
12
|
+
isString,
|
|
13
|
+
getStringValue,
|
|
14
|
+
} from "../utils/ASTUtils.js";
|
|
15
|
+
|
|
16
|
+
import logger from "@ui5/logger";
|
|
17
|
+
|
|
18
|
+
const log = logger.getLogger("lbt:analyzer:JSModuleAnalyzer");
|
|
12
19
|
|
|
13
20
|
// ------------------------------------------------------------------------------------------------------------------
|
|
14
21
|
|
|
@@ -352,13 +359,13 @@ class JSModuleAnalyzer {
|
|
|
352
359
|
|
|
353
360
|
// depending on the used module APIs, add an implicit dependency to the loader entry module
|
|
354
361
|
if ( info.format === ModuleFormat.UI5_LEGACY ) {
|
|
355
|
-
info.addImplicitDependency(
|
|
362
|
+
info.addImplicitDependency(MODULE__JQUERY_SAP_GLOBAL);
|
|
356
363
|
} else if ( info.format === ModuleFormat.UI5_DEFINE ) {
|
|
357
364
|
// Note: the implicit dependency for sap.ui.define modules points to the standard UI5
|
|
358
365
|
// loader config module. A more general approach would be to add a dependency to the loader
|
|
359
366
|
// only, but then standard configuration would be missed by dependency resolution
|
|
360
367
|
// (to be clarified)
|
|
361
|
-
info.addImplicitDependency(
|
|
368
|
+
info.addImplicitDependency(MODULE__UI5LOADER_AUTOCONFIG);
|
|
362
369
|
}
|
|
363
370
|
|
|
364
371
|
if ( !bIsUi5Module ) {
|
|
@@ -546,7 +553,7 @@ class JSModuleAnalyzer {
|
|
|
546
553
|
if (args.length > 0) {
|
|
547
554
|
const value = getStringValue(args[0]);
|
|
548
555
|
if (value !== undefined) {
|
|
549
|
-
const name =
|
|
556
|
+
const name = fromUI5LegacyName(value);
|
|
550
557
|
if ( nModuleDeclarations === 1 && !mainModuleFound) {
|
|
551
558
|
// if this is the first declaration, then this is the main module declaration
|
|
552
559
|
// note that this overrides an already given name
|
|
@@ -580,7 +587,7 @@ class JSModuleAnalyzer {
|
|
|
580
587
|
if ( i < nArgs ) {
|
|
581
588
|
const value = getStringValue( args[i] );
|
|
582
589
|
if ( value !== undefined ) {
|
|
583
|
-
name =
|
|
590
|
+
name = fromRequireJSName(value);
|
|
584
591
|
if ( name === defaultName ) {
|
|
585
592
|
// hardcoded name equals the file name, so this definition qualifies as main module definition
|
|
586
593
|
setMainModuleInfo(name, desc);
|
|
@@ -630,17 +637,17 @@ class JSModuleAnalyzer {
|
|
|
630
637
|
const arg = args[i];
|
|
631
638
|
const value = getStringValue(arg);
|
|
632
639
|
if ( value !== undefined ) {
|
|
633
|
-
const requiredModuleName =
|
|
640
|
+
const requiredModuleName = fromUI5LegacyName( value );
|
|
634
641
|
info.addDependency(requiredModuleName, conditional);
|
|
635
642
|
} else if ( arg.type == Syntax.ConditionalExpression) {
|
|
636
643
|
const consequentValue = getStringValue(arg.consequent);
|
|
637
644
|
const alternateValue = getStringValue(arg.alternate);
|
|
638
645
|
if ( consequentValue !== undefined ) {
|
|
639
|
-
const requiredModuleName1 =
|
|
646
|
+
const requiredModuleName1 = fromUI5LegacyName( consequentValue );
|
|
640
647
|
info.addDependency(requiredModuleName1, true);
|
|
641
648
|
}
|
|
642
649
|
if ( alternateValue !== undefined ) {
|
|
643
|
-
const requiredModuleName2 =
|
|
650
|
+
const requiredModuleName2 = fromUI5LegacyName( alternateValue );
|
|
644
651
|
info.addDependency(requiredModuleName2, true);
|
|
645
652
|
}
|
|
646
653
|
if ( consequentValue === undefined || alternateValue === undefined ) {
|
|
@@ -664,7 +671,7 @@ class JSModuleAnalyzer {
|
|
|
664
671
|
const value = getStringValue(args[i]);
|
|
665
672
|
if ( value !== undefined ) {
|
|
666
673
|
// sap.ui.requireSync does not support relative dependencies
|
|
667
|
-
const moduleName =
|
|
674
|
+
const moduleName = fromRequireJSName( value );
|
|
668
675
|
info.addDependency(moduleName, conditional);
|
|
669
676
|
} else {
|
|
670
677
|
log.verbose("sap.ui.requireSync: cannot evaluate dynamic arguments: ", args[i] && args[i].type);
|
|
@@ -682,7 +689,7 @@ class JSModuleAnalyzer {
|
|
|
682
689
|
if ( i < nArgs ) {
|
|
683
690
|
const value = getStringValue(args[i++]);
|
|
684
691
|
if ( value !== undefined ) {
|
|
685
|
-
const moduleName =
|
|
692
|
+
const moduleName = fromRequireJSName( value );
|
|
686
693
|
info.addSubModule(moduleName);
|
|
687
694
|
|
|
688
695
|
// add dependencies
|
|
@@ -690,7 +697,7 @@ class JSModuleAnalyzer {
|
|
|
690
697
|
const elementArg = args[i++];
|
|
691
698
|
if (elementArg && elementArg.type === Syntax.ArrayExpression) {
|
|
692
699
|
elementArg.elements.forEach((element) => {
|
|
693
|
-
const dependencyName =
|
|
700
|
+
const dependencyName = resolveRelativeRequireJSName(moduleName,
|
|
694
701
|
getStringValue(element));
|
|
695
702
|
info.addDependency(dependencyName, conditional);
|
|
696
703
|
});
|
|
@@ -727,7 +734,7 @@ class JSModuleAnalyzer {
|
|
|
727
734
|
return;
|
|
728
735
|
}
|
|
729
736
|
if ( namesUseLegacyNotation ) {
|
|
730
|
-
moduleName =
|
|
737
|
+
moduleName = fromUI5LegacyName(moduleName);
|
|
731
738
|
}
|
|
732
739
|
info.addSubModule(moduleName);
|
|
733
740
|
});
|
|
@@ -747,9 +754,9 @@ class JSModuleAnalyzer {
|
|
|
747
754
|
}
|
|
748
755
|
let requiredModule;
|
|
749
756
|
if (name == null) {
|
|
750
|
-
requiredModule =
|
|
757
|
+
requiredModule = fromRequireJSName( value );
|
|
751
758
|
} else {
|
|
752
|
-
requiredModule =
|
|
759
|
+
requiredModule = resolveRelativeRequireJSName(name, value);
|
|
753
760
|
}
|
|
754
761
|
info.addDependency( requiredModule, conditional );
|
|
755
762
|
} else {
|
|
@@ -801,4 +808,4 @@ class JSModuleAnalyzer {
|
|
|
801
808
|
}
|
|
802
809
|
|
|
803
810
|
|
|
804
|
-
|
|
811
|
+
export default JSModuleAnalyzer;
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
* This class can handle multiple concurrent analysis calls, it has no instance state other than the pool
|
|
24
24
|
* (which is readonly).
|
|
25
25
|
*/
|
|
26
|
-
"use strict";
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
import {fromUI5LegacyName} from "../utils/ModuleName.js";
|
|
28
|
+
import SapUiDefine from "../calls/SapUiDefine.js";
|
|
29
|
+
import {parseJS, Syntax} from "../utils/parseUtils.js";
|
|
30
|
+
import {getValue, isMethodCall, getStringValue} from "../utils/ASTUtils.js";
|
|
31
|
+
import logger from "@ui5/logger";
|
|
32
|
+
const log = logger.getLogger("lbt:analyzer:SmartTemplateAnalyzer");
|
|
33
33
|
|
|
34
34
|
// ---------------------------------------------------------------------------------------------------------
|
|
35
35
|
|
|
@@ -84,7 +84,7 @@ class TemplateComponentAnalyzer {
|
|
|
84
84
|
const st = (manifest && manifest["sap.ui.generic.app"]) || {};
|
|
85
85
|
function recursePage(page) {
|
|
86
86
|
if ( page.component && page.component.name ) {
|
|
87
|
-
const module =
|
|
87
|
+
const module = fromUI5LegacyName( page.component.name + ".Component" );
|
|
88
88
|
log.verbose("template app: add dependency to template component %s", module);
|
|
89
89
|
info.addDependency(module);
|
|
90
90
|
promises.push( that._analyzeTemplateComponent(module, page, info) );
|
|
@@ -113,7 +113,7 @@ class TemplateComponentAnalyzer {
|
|
|
113
113
|
const templateName = (pageConfig.component && pageConfig.component.settings &&
|
|
114
114
|
pageConfig.component.settings.templateName) || defaultTemplateName;
|
|
115
115
|
if ( templateName ) {
|
|
116
|
-
const templateModuleName =
|
|
116
|
+
const templateModuleName = fromUI5LegacyName( templateName, ".view.xml" );
|
|
117
117
|
log.verbose("template app: add dependency to template view %s", templateModuleName);
|
|
118
118
|
appInfo.addDependency(templateModuleName);
|
|
119
119
|
}
|
|
@@ -166,4 +166,4 @@ class TemplateComponentAnalyzer {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
export default TemplateComponentAnalyzer;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import {Syntax} from "../utils/parseUtils.js";
|
|
3
|
+
import SapUiDefine from "../calls/SapUiDefine.js";
|
|
4
|
+
import {getValue, isMethodCall, getStringValue} from "../utils/ASTUtils.js";
|
|
5
|
+
import {fromUI5LegacyName} from "../utils/ModuleName.js";
|
|
6
|
+
import logger from "@ui5/logger";
|
|
7
|
+
const log = logger.getLogger("lbt:analyzer:XMLCompositeAnalyzer");
|
|
8
8
|
|
|
9
9
|
const CALL_DEFINE = ["define"];
|
|
10
10
|
const CALL_SAP_UI_DEFINE = ["sap", "ui", "define"];
|
|
@@ -42,7 +42,7 @@ class XMLCompositeAnalyzer {
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
if (fragmentName) {
|
|
45
|
-
const fragmentModule =
|
|
45
|
+
const fragmentModule = fromUI5LegacyName(fragmentName, ".control.xml");
|
|
46
46
|
log.verbose("fragment control: add dependency to template fragment %s", fragmentModule);
|
|
47
47
|
info.addDependency(fragmentModule);
|
|
48
48
|
}
|
|
@@ -72,4 +72,4 @@ class XMLCompositeAnalyzer {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
export default XMLCompositeAnalyzer;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import xml2js from "xml2js";
|
|
3
|
+
import {fromUI5LegacyName, fromRequireJSName} from "../utils/ModuleName.js";
|
|
4
|
+
import JSTokenizer from "../utils/JSTokenizer.js";
|
|
5
|
+
import logger from "@ui5/logger";
|
|
6
|
+
const log = logger.getLogger("lbt:analyzer:XMLTemplateAnalyzer");
|
|
7
|
+
|
|
8
|
+
// ---------------------------------------------------------------------------------------------------------
|
|
2
9
|
|
|
3
10
|
/*
|
|
4
11
|
* TODOS
|
|
@@ -10,11 +17,6 @@
|
|
|
10
17
|
* - move UI5 specific constants to UI5ClientConstants?
|
|
11
18
|
*/
|
|
12
19
|
|
|
13
|
-
const xml2js = require("xml2js");
|
|
14
|
-
const ModuleName = require("../utils/ModuleName");
|
|
15
|
-
const JSTokenizer = require("../utils/JSTokenizer");
|
|
16
|
-
const log = require("@ui5/logger").getLogger("lbt:analyzer:XMLTemplateAnalyzer");
|
|
17
|
-
|
|
18
20
|
// ---------------------------------------------------------------------------------------------------------
|
|
19
21
|
|
|
20
22
|
const XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
@@ -195,12 +197,12 @@ class XMLTemplateAnalyzer {
|
|
|
195
197
|
|
|
196
198
|
const controllerName = getAttribute(node, XMLVIEW_CONTROLLERNAME_ATTRIBUTE);
|
|
197
199
|
if ( controllerName ) {
|
|
198
|
-
this._addDependency(
|
|
200
|
+
this._addDependency( fromUI5LegacyName(controllerName, ".controller.js"), this.conditional );
|
|
199
201
|
}
|
|
200
202
|
|
|
201
203
|
const resourceBundleName = getAttribute(node, XMLVIEW_RESBUNDLENAME_ATTRIBUTE);
|
|
202
204
|
if ( resourceBundleName ) {
|
|
203
|
-
const resourceBundleModuleName =
|
|
205
|
+
const resourceBundleModuleName = fromUI5LegacyName(resourceBundleName, ".properties");
|
|
204
206
|
log.verbose("found dependency to resource bundle %s", resourceBundleModuleName);
|
|
205
207
|
// TODO locale dependent dependencies: this._addDependency(resourceBundleModuleName);
|
|
206
208
|
this._addDependency( resourceBundleModuleName, this.conditional );
|
|
@@ -229,7 +231,7 @@ class XMLTemplateAnalyzer {
|
|
|
229
231
|
|
|
230
232
|
} else if ( PATTERN_LIBRARY_NAMESPACES.test(namespace) ) {
|
|
231
233
|
// looks like a UI5 library or package name
|
|
232
|
-
const moduleName =
|
|
234
|
+
const moduleName = fromUI5LegacyName( (namespace ? namespace + "." : "") + localName );
|
|
233
235
|
|
|
234
236
|
this._analyzeCoreRequire(node);
|
|
235
237
|
|
|
@@ -283,7 +285,7 @@ class XMLTemplateAnalyzer {
|
|
|
283
285
|
Object.keys(requireContext).forEach((key) => {
|
|
284
286
|
const requireJsName = requireContext[key];
|
|
285
287
|
if ( requireJsName && typeof requireJsName === "string" ) {
|
|
286
|
-
this._addDependency(
|
|
288
|
+
this._addDependency(fromRequireJSName(requireJsName), this.conditional);
|
|
287
289
|
} else {
|
|
288
290
|
log.error(`Ignoring core:require: '${key}' refers to invalid module name '${requireJsName}'`);
|
|
289
291
|
}
|
|
@@ -307,7 +309,7 @@ class XMLTemplateAnalyzer {
|
|
|
307
309
|
const componentName = getAttribute(node, COMPONENTCONTAINER_COMPONENTNAME_ATTRIBUTE);
|
|
308
310
|
if ( componentName ) {
|
|
309
311
|
const componentModuleName =
|
|
310
|
-
|
|
312
|
+
fromUI5LegacyName( componentName, "/Component.js" );
|
|
311
313
|
this._addDependency(componentModuleName, conditional);
|
|
312
314
|
}
|
|
313
315
|
// TODO what about component.json? handle it transitively via Component.js?
|
|
@@ -316,35 +318,35 @@ class XMLTemplateAnalyzer {
|
|
|
316
318
|
const type = getAttribute(node, FRAGMENT_TYPE_ATTRIBUTE);
|
|
317
319
|
if ( fragmentName && type ) {
|
|
318
320
|
const fragmentModuleName =
|
|
319
|
-
|
|
321
|
+
fromUI5LegacyName( fragmentName, this._getFragmentExtension(type) );
|
|
320
322
|
// console.log("child fragment detected %s", fragmentModuleName);
|
|
321
323
|
this._addDependency(fragmentModuleName, conditional);
|
|
322
324
|
}
|
|
323
325
|
} else if ( moduleName === HTMLVIEW_MODULE ) {
|
|
324
326
|
const viewName = getAttribute(node, ANYVIEW_VIEWNAME_ATTRIBUTE);
|
|
325
327
|
if ( viewName ) {
|
|
326
|
-
const childViewModuleName =
|
|
328
|
+
const childViewModuleName = fromUI5LegacyName( viewName, ".view.html" );
|
|
327
329
|
// console.log("child view detected %s", childViewModuleName);
|
|
328
330
|
this._addDependency(childViewModuleName, conditional);
|
|
329
331
|
}
|
|
330
332
|
} else if ( moduleName === JSVIEW_MODULE ) {
|
|
331
333
|
const viewName = getAttribute(node, ANYVIEW_VIEWNAME_ATTRIBUTE);
|
|
332
334
|
if ( viewName ) {
|
|
333
|
-
const childViewModuleName =
|
|
335
|
+
const childViewModuleName = fromUI5LegacyName( viewName, ".view.js" );
|
|
334
336
|
// console.log("child view detected %s", childViewModuleName);
|
|
335
337
|
this._addDependency(childViewModuleName, conditional);
|
|
336
338
|
}
|
|
337
339
|
} else if ( moduleName === JSONVIEW_MODULE ) {
|
|
338
340
|
const viewName = getAttribute(node, ANYVIEW_VIEWNAME_ATTRIBUTE);
|
|
339
341
|
if ( viewName ) {
|
|
340
|
-
const childViewModuleName =
|
|
342
|
+
const childViewModuleName = fromUI5LegacyName( viewName, ".view.json" );
|
|
341
343
|
// console.log("child view detected %s", childViewModuleName);
|
|
342
344
|
this._addDependency(childViewModuleName, conditional);
|
|
343
345
|
}
|
|
344
346
|
} else if ( moduleName === XMLVIEW_MODULE ) {
|
|
345
347
|
const viewName = getAttribute(node, ANYVIEW_VIEWNAME_ATTRIBUTE);
|
|
346
348
|
if ( viewName ) {
|
|
347
|
-
const childViewModuleName =
|
|
349
|
+
const childViewModuleName = fromUI5LegacyName( viewName, ".view.xml" );
|
|
348
350
|
// console.log("child view detected %s", childViewModuleName);
|
|
349
351
|
this._addDependency(childViewModuleName, conditional);
|
|
350
352
|
}
|
|
@@ -361,4 +363,4 @@ class XMLTemplateAnalyzer {
|
|
|
361
363
|
}
|
|
362
364
|
|
|
363
365
|
|
|
364
|
-
|
|
366
|
+
export default XMLTemplateAnalyzer;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
|
|
2
|
+
import {parseJS, Syntax, VisitorKeys} from "../utils/parseUtils.js";
|
|
3
|
+
import {getPropertyKey, isMethodCall, isIdentifier, getStringArray} from "../utils/ASTUtils.js";
|
|
4
|
+
import logger from "@ui5/logger";
|
|
5
|
+
const log = logger.getLogger("lbt:analyzer:LibraryJS");
|
|
5
6
|
|
|
6
7
|
const CALL__SAP_UI_GETCORE = ["sap", "ui", "getCore"];
|
|
7
8
|
|
|
@@ -96,12 +97,12 @@ async function analyze(resource) {
|
|
|
96
97
|
*
|
|
97
98
|
* Note: only the first initLibrary() call that is found with a DFS on the AST, will be evaluated.
|
|
98
99
|
*
|
|
99
|
-
* @param {
|
|
100
|
+
* @param {@ui5/fs/Resource} resource library.js resource whose content should be analyzed
|
|
100
101
|
* @returns {Promise<object>} A Promise on the extract info object
|
|
101
102
|
*/
|
|
102
|
-
|
|
103
|
+
export default function(resource) {
|
|
103
104
|
if ( resource == null ) {
|
|
104
105
|
return Promise.resolve({});
|
|
105
106
|
}
|
|
106
107
|
return analyze(resource);
|
|
107
|
-
}
|
|
108
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const log =
|
|
2
|
+
import {pd} from "pretty-data";
|
|
3
|
+
import {toRequireJSName} from "../utils/ModuleName.js";
|
|
4
|
+
import {SectionType} from "./BundleDefinition.js";
|
|
5
|
+
import escapePropertiesFile from "../utils/escapePropertiesFile.js";
|
|
6
|
+
import logger from "@ui5/logger";
|
|
7
|
+
const log = logger.getLogger("lbt:bundle:AutoSplitter");
|
|
9
8
|
|
|
10
9
|
const xmlHtmlPrePattern = /<(?:\w+:)?pre\b/;
|
|
11
10
|
|
|
@@ -72,7 +71,7 @@ class AutoSplitter {
|
|
|
72
71
|
break;
|
|
73
72
|
case SectionType.Require:
|
|
74
73
|
section.modules.forEach( (module) => {
|
|
75
|
-
totalSize += "sap.ui.requireSync('');".length +
|
|
74
|
+
totalSize += "sap.ui.requireSync('');".length + toRequireJSName(module).length;
|
|
76
75
|
});
|
|
77
76
|
break;
|
|
78
77
|
default:
|
|
@@ -90,7 +89,7 @@ class AutoSplitter {
|
|
|
90
89
|
const splittedModules = [];
|
|
91
90
|
let moduleNameWithPart = moduleDef.name;
|
|
92
91
|
if ( !/__part__/.test(moduleNameWithPart) ) {
|
|
93
|
-
moduleNameWithPart =
|
|
92
|
+
moduleNameWithPart = toRequireJSName(moduleNameWithPart) + "-__part__.js";
|
|
94
93
|
}
|
|
95
94
|
// vars = Object.create(null);
|
|
96
95
|
|
|
@@ -177,7 +176,7 @@ class AutoSplitter {
|
|
|
177
176
|
currentModule.sections.push( currentSection );
|
|
178
177
|
section.modules.forEach( (module) => {
|
|
179
178
|
currentSection.filters.push( module );
|
|
180
|
-
totalSize += 21 +
|
|
179
|
+
totalSize += 21 + toRequireJSName(module).length;
|
|
181
180
|
});
|
|
182
181
|
break;
|
|
183
182
|
default:
|
|
@@ -257,4 +256,4 @@ class AutoSplitter {
|
|
|
257
256
|
} */
|
|
258
257
|
}
|
|
259
258
|
|
|
260
|
-
|
|
259
|
+
export default AutoSplitter;
|