@ui5/builder 3.0.0-alpha.5 → 3.0.0-alpha.8
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 +34 -1
- package/index.js +0 -39
- package/lib/lbt/analyzer/JSModuleAnalyzer.js +13 -2
- package/lib/lbt/bundle/Builder.js +19 -49
- package/lib/lbt/resources/LocatorResource.js +1 -1
- package/lib/lbt/resources/ResourceCollector.js +22 -15
- package/lib/lbt/resources/ResourceInfoList.js +0 -1
- package/lib/lbt/resources/ResourcePool.js +7 -6
- package/lib/lbt/utils/escapePropertiesFile.js +3 -6
- package/lib/processors/bundlers/moduleBundler.js +2 -3
- package/lib/processors/jsdoc/lib/createIndexFiles.js +1 -1
- package/lib/processors/jsdoc/lib/transformApiJson.js +20 -20
- package/lib/processors/jsdoc/lib/ui5/plugin.js +111 -6
- package/lib/processors/jsdoc/lib/ui5/template/publish.js +112 -91
- package/lib/processors/jsdoc/lib/ui5/template/utils/versionUtil.js +1 -1
- package/lib/processors/manifestCreator.js +8 -45
- package/lib/tasks/TaskUtil.js +82 -17
- package/lib/tasks/bundlers/generateComponentPreload.js +14 -14
- package/lib/tasks/bundlers/generateFlexChangesBundle.js +6 -2
- package/lib/tasks/bundlers/generateLibraryPreload.js +84 -91
- package/lib/tasks/bundlers/generateManifestBundle.js +8 -10
- package/lib/tasks/bundlers/generateStandaloneAppBundle.js +7 -2
- package/lib/tasks/bundlers/utils/createModuleNameMapping.js +3 -2
- package/lib/tasks/generateCachebusterInfo.js +7 -3
- package/lib/tasks/generateLibraryManifest.js +6 -8
- package/lib/tasks/generateResourcesJson.js +1 -1
- package/lib/tasks/generateThemeDesignerResources.js +8 -2
- package/lib/tasks/generateVersionInfo.js +5 -5
- package/lib/tasks/taskRepository.js +1 -13
- package/lib/tasks/transformBootstrapHtml.js +6 -1
- package/package.json +6 -7
- package/lib/builder/BuildContext.js +0 -60
- package/lib/builder/ProjectBuildContext.js +0 -61
- package/lib/builder/builder.js +0 -425
- package/lib/types/AbstractBuilder.js +0 -270
- package/lib/types/AbstractFormatter.js +0 -66
- package/lib/types/AbstractUi5Formatter.js +0 -95
- package/lib/types/application/ApplicationBuilder.js +0 -211
- package/lib/types/application/ApplicationFormatter.js +0 -227
- package/lib/types/application/applicationType.js +0 -15
- package/lib/types/library/LibraryBuilder.js +0 -232
- package/lib/types/library/LibraryFormatter.js +0 -519
- package/lib/types/library/libraryType.js +0 -15
- package/lib/types/module/ModuleBuilder.js +0 -7
- package/lib/types/module/ModuleFormatter.js +0 -54
- package/lib/types/module/moduleType.js +0 -15
- package/lib/types/themeLibrary/ThemeLibraryBuilder.js +0 -64
- package/lib/types/themeLibrary/ThemeLibraryFormatter.js +0 -90
- package/lib/types/themeLibrary/themeLibraryType.js +0 -15
- package/lib/types/typeRepository.js +0 -46
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,37 @@
|
|
|
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.8...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v3.0.0-alpha.8"></a>
|
|
8
|
+
## [v3.0.0-alpha.8] - 2022-07-14
|
|
9
|
+
|
|
10
|
+
<a name="v3.0.0-alpha.7"></a>
|
|
11
|
+
## [v3.0.0-alpha.7] - 2022-06-14
|
|
12
|
+
### Breaking Changes
|
|
13
|
+
- Remove build execution ([#740](https://github.com/SAP/ui5-builder/issues/740)) [`af2e956`](https://github.com/SAP/ui5-builder/commit/af2e956f6cba1275669160328e32df3fffa782d0)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
- Avoid redundant bundle creation ([#741](https://github.com/SAP/ui5-builder/issues/741)) [`13c8405`](https://github.com/SAP/ui5-builder/commit/13c840585946401d238936dfa38a6f70a73e9ed0)
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
- Enable modern preload bundles without dependencies ([#739](https://github.com/SAP/ui5-builder/issues/739)) [`97cfa6c`](https://github.com/SAP/ui5-builder/commit/97cfa6cd3eadff57bcc18816534c7751551ebdb8)
|
|
20
|
+
|
|
21
|
+
### BREAKING CHANGE
|
|
22
|
+
|
|
23
|
+
* builder.js has been removed. Use ui5-project builder instead
|
|
24
|
+
* Tasks now rely on Project instances being available on Resources (see https://github.com/SAP/ui5-fs/pull/381)
|
|
25
|
+
* TaskRepository#addTask has been removed. Custom tasks need to be added to the project graph instead
|
|
26
|
+
* TaskUtil#get/set/clearTag now requires a Project instance to be provided. Path strings are no longer sufficient
|
|
27
|
+
and will cause an exception to be thrown
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
<a name="v3.0.0-alpha.6"></a>
|
|
31
|
+
## [v3.0.0-alpha.6] - 2022-04-26
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
- **JSModuleAnalyzer:** Fix detection of bundle name ([#705](https://github.com/SAP/ui5-builder/issues/705)) [`aaeafd4`](https://github.com/SAP/ui5-builder/commit/aaeafd4a1fd194dd08e5ae47c29d90f0b4c7d197)
|
|
34
|
+
- **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)
|
|
35
|
+
|
|
6
36
|
|
|
7
37
|
<a name="v3.0.0-alpha.5"></a>
|
|
8
38
|
## [v3.0.0-alpha.5] - 2022-04-14
|
|
@@ -714,6 +744,9 @@ to load the custom bundle file instead.
|
|
|
714
744
|
- Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
|
|
715
745
|
|
|
716
746
|
|
|
747
|
+
[v3.0.0-alpha.8]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.7...v3.0.0-alpha.8
|
|
748
|
+
[v3.0.0-alpha.7]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.6...v3.0.0-alpha.7
|
|
749
|
+
[v3.0.0-alpha.6]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.5...v3.0.0-alpha.6
|
|
717
750
|
[v3.0.0-alpha.5]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.4...v3.0.0-alpha.5
|
|
718
751
|
[v3.0.0-alpha.4]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.3...v3.0.0-alpha.4
|
|
719
752
|
[v3.0.0-alpha.3]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.2...v3.0.0-alpha.3
|
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
|
|
@@ -160,41 +156,6 @@ module.exports = {
|
|
|
160
156
|
* @type {import('./lib/tasks/TaskUtil')}
|
|
161
157
|
*/
|
|
162
158
|
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
159
|
}
|
|
199
160
|
};
|
|
200
161
|
|
|
@@ -301,6 +301,9 @@ class JSModuleAnalyzer {
|
|
|
301
301
|
*/
|
|
302
302
|
let bIsUi5Module = false;
|
|
303
303
|
|
|
304
|
+
// Module name via @ui5-bundle comment in first line. Overrides all other main module candidates.
|
|
305
|
+
let firstLineBundleName;
|
|
306
|
+
|
|
304
307
|
// first analyze the whole AST...
|
|
305
308
|
visit(ast, false);
|
|
306
309
|
|
|
@@ -314,7 +317,12 @@ class JSModuleAnalyzer {
|
|
|
314
317
|
log.verbose(`bundle include directive ${subModule}`);
|
|
315
318
|
} else if ( comment.value.startsWith("@ui5-bundle ") ) {
|
|
316
319
|
const bundleName = comment.value.slice("@ui5-bundle ".length);
|
|
317
|
-
|
|
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
|
+
}
|
|
318
326
|
log.verbose(`bundle name directive ${bundleName}`);
|
|
319
327
|
} else {
|
|
320
328
|
log.warn(`unrecognized bundle directive ${comment.value}`);
|
|
@@ -324,7 +332,10 @@ class JSModuleAnalyzer {
|
|
|
324
332
|
}
|
|
325
333
|
|
|
326
334
|
// ...and finally take conclusions about the file's content
|
|
327
|
-
if (
|
|
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 ) {
|
|
328
339
|
// if there's exactly one module definition in this file but it didn't
|
|
329
340
|
// immediately qualify as main module, make it now the main module
|
|
330
341
|
if ( candidateName != null && nModuleDeclarations == 1 ) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const {pd} = require("pretty-data");
|
|
7
7
|
const {parseJS, Syntax} = require("../utils/parseUtils");
|
|
8
|
-
const {encode: encodeMappings, decode: decodeMappings} = require("sourcemap-codec");
|
|
8
|
+
const {encode: encodeMappings, decode: decodeMappings} = require("@jridgewell/sourcemap-codec");
|
|
9
9
|
|
|
10
10
|
const {isMethodCall} = require("../utils/ASTUtils");
|
|
11
11
|
const ModuleName = require("../utils/ModuleName");
|
|
@@ -40,38 +40,6 @@ function isEmptyBundle(resolvedBundle) {
|
|
|
40
40
|
return resolvedBundle.sections.every((section) => section.modules.length === 0);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const UI5BundleFormat = {
|
|
44
|
-
beforePreloads(section) {
|
|
45
|
-
let str = `jQuery.sap.registerPreloadedModules({\n`;
|
|
46
|
-
if ( section.name ) {
|
|
47
|
-
str += `"name":"${section.name}",\n`;
|
|
48
|
-
}
|
|
49
|
-
str += `"version":"2.0",\n`;
|
|
50
|
-
str += `"modules":{\n`;
|
|
51
|
-
return str;
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
afterPreloads(section) {
|
|
55
|
-
return `}});\n`;
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
beforeBundleInfo() {
|
|
59
|
-
return `"unsupported"; /* 'bundleInfo' section mode not supported (requires ui5loader)\n`;
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
afterBundleInfo() {
|
|
63
|
-
return "*/\n";
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
requireSync(moduleName) {
|
|
67
|
-
return `sap.ui.requireSync("${ModuleName.toRequireJSName(moduleName)}");\n`;
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
shouldDecorate(resolvedModule) {
|
|
71
|
-
return resolvedModule.executes(UI5ClientConstants.MODULE__JQUERY_SAP_GLOBAL);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
|
|
75
43
|
const EVOBundleFormat = {
|
|
76
44
|
beforePreloads(section) {
|
|
77
45
|
return `sap.ui.require.preload({\n`;
|
|
@@ -115,7 +83,6 @@ class BundleBuilder {
|
|
|
115
83
|
}
|
|
116
84
|
|
|
117
85
|
async createBundle(module, options) {
|
|
118
|
-
await this._prepare();
|
|
119
86
|
if ( options.numberOfParts > 1 ) {
|
|
120
87
|
const bundleInfos = [];
|
|
121
88
|
const submodules = await this.splitter.run( module, options );
|
|
@@ -128,17 +95,6 @@ class BundleBuilder {
|
|
|
128
95
|
}
|
|
129
96
|
}
|
|
130
97
|
|
|
131
|
-
_prepare() {
|
|
132
|
-
return Promise.all([
|
|
133
|
-
// check whether the resource pool contains debug and optimized sources
|
|
134
|
-
this.pool.findResource( ModuleName.getDebugName(UI5ClientConstants.MODULE__JQUERY_SAP_GLOBAL) ).
|
|
135
|
-
then( () => this.optimizedSources = true, () => this.optimizedSources = false ),
|
|
136
|
-
// check whether EVO modules are available. If so, use EVO APIs, else use old UI5 APIs.
|
|
137
|
-
this.pool.findResource(UI5ClientConstants.EVO_MARKER_RESOURCE).
|
|
138
|
-
then( () => this.targetBundleFormat = EVOBundleFormat, () => this.targetBundleFormat = UI5BundleFormat )
|
|
139
|
-
]);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
98
|
async _createBundle(module, options) {
|
|
143
99
|
const resolvedModule = await this.resolver.resolve(module);
|
|
144
100
|
if ( options.skipIfEmpty && isEmptyBundle(resolvedModule) ) {
|
|
@@ -153,11 +109,13 @@ class BundleBuilder {
|
|
|
153
109
|
this.options.sourceMap = true;
|
|
154
110
|
}
|
|
155
111
|
|
|
156
|
-
//
|
|
157
|
-
|
|
112
|
+
// Since UI5 Tooling 3.0: Always use modern API
|
|
113
|
+
this.targetBundleFormat = EVOBundleFormat;
|
|
114
|
+
|
|
115
|
+
// when decorateBootstrapModule is false,
|
|
116
|
+
// we don't write the optimized flag and don't write the try catch wrapper
|
|
158
117
|
this.shouldDecorate = this.options.decorateBootstrapModule &&
|
|
159
|
-
|
|
160
|
-
this.targetBundleFormat.shouldDecorate(resolvedModule));
|
|
118
|
+
this.targetBundleFormat.shouldDecorate(resolvedModule);
|
|
161
119
|
// TODO is the following condition ok or should the availability of jquery.sap.global.js be configurable?
|
|
162
120
|
this.jqglobalAvailable = !resolvedModule.containsGlobal;
|
|
163
121
|
this.openModule(resolvedModule.name);
|
|
@@ -636,6 +594,18 @@ class BundleBuilder {
|
|
|
636
594
|
|
|
637
595
|
if (moduleSourceMap) {
|
|
638
596
|
moduleSourceMap = JSON.parse(moduleSourceMap);
|
|
597
|
+
|
|
598
|
+
// Check for index map, which is currently not supported
|
|
599
|
+
if (Array.isArray(moduleSourceMap.sections)) {
|
|
600
|
+
log.warn(
|
|
601
|
+
`Module ${moduleName} references an index source map which is currently not supported. ` +
|
|
602
|
+
`A transient source map will be created instead...`
|
|
603
|
+
);
|
|
604
|
+
moduleSourceMap = createTransientSourceMap({
|
|
605
|
+
moduleName: path.posix.basename(resourcePath),
|
|
606
|
+
moduleContent
|
|
607
|
+
});
|
|
608
|
+
}
|
|
639
609
|
} else {
|
|
640
610
|
log.verbose(`No source map available for module ${moduleName}. Creating transient source map...`);
|
|
641
611
|
moduleSourceMap = createTransientSourceMap({
|
|
@@ -110,10 +110,11 @@ class ResourceCollector {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
async enrichWithDependencyInfo(resourceInfo) {
|
|
113
|
-
return this._pool.getModuleInfo(resourceInfo.name).then(async (moduleInfo) => {
|
|
114
|
-
if ( moduleInfo.name ) {
|
|
113
|
+
return this._pool.getModuleInfo(resourceInfo.name, resourceInfo.module).then(async (moduleInfo) => {
|
|
114
|
+
if ( !resourceInfo.module && moduleInfo.name ) {
|
|
115
115
|
resourceInfo.module = moduleInfo.name;
|
|
116
116
|
}
|
|
117
|
+
|
|
117
118
|
if ( moduleInfo.dynamicDependencies ) {
|
|
118
119
|
resourceInfo.dynRequired = true;
|
|
119
120
|
}
|
|
@@ -279,37 +280,43 @@ class ResourceCollector {
|
|
|
279
280
|
|
|
280
281
|
await Promise.all(promises);
|
|
281
282
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const dbgInfo = debugResourcesInfo[i];
|
|
286
|
-
const nonDebugName = ResourceInfoList.getNonDebugName(dbgInfo.name);
|
|
283
|
+
await Promise.all(debugResourcesInfo.map(async (dbgInfo) => {
|
|
284
|
+
const debugName = dbgInfo.name;
|
|
285
|
+
const nonDebugName = ResourceInfoList.getNonDebugName(debugName);
|
|
287
286
|
const nonDbgInfo = this._resources.get(nonDebugName);
|
|
288
287
|
|
|
289
288
|
// FIXME: "merged" property is only calculated in ResourceInfo#copyFrom
|
|
290
289
|
// Therefore using the same logic here to compute it.
|
|
290
|
+
|
|
291
|
+
// TODO: Idea: Use IsDebugVariant tag to decide whether to analyze the resource
|
|
292
|
+
// If the tag is set, we don't expect different analysis results so we can copy the info (else-path)
|
|
293
|
+
// Only when the tag is not set, we analyze the resource with its name (incl. -dbg)
|
|
294
|
+
|
|
291
295
|
if (!nonDbgInfo || (nonDbgInfo.included != null && nonDbgInfo.included.size > 0)) {
|
|
292
296
|
// We need to analyze the dbg resource if there is no non-dbg variant or
|
|
293
297
|
// it is a bundle because we will (usually) have different content.
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
298
|
+
|
|
299
|
+
if (nonDbgInfo) {
|
|
300
|
+
// Always use the non-debug module name, if available
|
|
301
|
+
dbgInfo.module = nonDbgInfo.module;
|
|
302
|
+
}
|
|
303
|
+
await this.enrichWithDependencyInfo(dbgInfo);
|
|
297
304
|
} else {
|
|
298
305
|
// If the non-dbg resource is not a bundle, we can just copy over the info and skip
|
|
299
306
|
// analyzing the dbg variant as both should have the same info.
|
|
300
307
|
|
|
301
|
-
const newDbgInfo = new ResourceInfo(
|
|
308
|
+
const newDbgInfo = new ResourceInfo(debugName);
|
|
302
309
|
|
|
303
310
|
// First copy info of analysis from non-dbg file (included, required, condRequired, ...)
|
|
304
311
|
newDbgInfo.copyFrom(null, nonDbgInfo);
|
|
305
312
|
// Then copy over info from dbg file to properly set name, isDebug, etc.
|
|
306
313
|
newDbgInfo.copyFrom(null, dbgInfo);
|
|
314
|
+
// Finally, set the module name to the non-dbg name
|
|
315
|
+
newDbgInfo.module = nonDbgInfo.module;
|
|
307
316
|
|
|
308
|
-
this._resources.set(
|
|
317
|
+
this._resources.set(debugName, newDbgInfo);
|
|
309
318
|
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
await Promise.all(debugBundlePromises);
|
|
319
|
+
}));
|
|
313
320
|
}
|
|
314
321
|
|
|
315
322
|
createOrphanFilters() {
|
|
@@ -48,7 +48,6 @@ class ResourceInfoList {
|
|
|
48
48
|
if ( myInfo == null ) {
|
|
49
49
|
myInfo = new ResourceInfo(relativeName);
|
|
50
50
|
myInfo.size = info.size;
|
|
51
|
-
myInfo.module = ResourceInfoList.getNonDebugName(info.name);
|
|
52
51
|
this.resources.push(myInfo);
|
|
53
52
|
this.resourcesByName.set(relativeName, myInfo);
|
|
54
53
|
}
|
|
@@ -176,17 +176,18 @@ class ResourcePool {
|
|
|
176
176
|
/**
|
|
177
177
|
* Retrieves the module info
|
|
178
178
|
*
|
|
179
|
-
* @param {string}
|
|
179
|
+
* @param {string} resourceName resource/module name
|
|
180
|
+
* @param {string} [moduleName] module name, in case it differs from the resource name (e.g. for -dbg resources)
|
|
180
181
|
* @returns {Promise<ModuleInfo>}
|
|
181
182
|
*/
|
|
182
|
-
async getModuleInfo(
|
|
183
|
-
let info = this._dependencyInfos.get(
|
|
183
|
+
async getModuleInfo(resourceName, moduleName) {
|
|
184
|
+
let info = this._dependencyInfos.get(resourceName);
|
|
184
185
|
if ( info == null ) {
|
|
185
186
|
info = Promise.resolve().then(async () => {
|
|
186
|
-
const resource = await this.findResource(
|
|
187
|
-
return determineDependencyInfo( resource, this._rawModuleInfos.get(
|
|
187
|
+
const resource = await this.findResource(resourceName);
|
|
188
|
+
return determineDependencyInfo( resource, this._rawModuleInfos.get(moduleName || resourceName), this );
|
|
188
189
|
});
|
|
189
|
-
this._dependencyInfos.set(
|
|
190
|
+
this._dependencyInfos.set(resourceName, info);
|
|
190
191
|
}
|
|
191
192
|
return info;
|
|
192
193
|
}
|
|
@@ -4,7 +4,7 @@ const nonAsciiEscaper = require("../../processors/nonAsciiEscaper");
|
|
|
4
4
|
* Can be used to escape *.properties files.
|
|
5
5
|
*
|
|
6
6
|
* Input encoding is read from project configuration.
|
|
7
|
-
* In case the resource belongs to no project (e.g. bundler is used standalone) the default is "
|
|
7
|
+
* In case the resource belongs to no project (e.g. bundler is used standalone) the default is "UTF-8".
|
|
8
8
|
*
|
|
9
9
|
* @private
|
|
10
10
|
* @param {Resource} resource the resource for which the content will be escaped
|
|
@@ -12,13 +12,10 @@ const nonAsciiEscaper = require("../../processors/nonAsciiEscaper");
|
|
|
12
12
|
*/
|
|
13
13
|
module.exports = async function(resource) {
|
|
14
14
|
const project = resource.getProject();
|
|
15
|
-
let propertiesFileSourceEncoding = project &&
|
|
16
|
-
project.resources &&
|
|
17
|
-
project.resources.configuration &&
|
|
18
|
-
project.resources.configuration.propertiesFileSourceEncoding;
|
|
15
|
+
let propertiesFileSourceEncoding = project && project.getPropertiesFileSourceEncoding();
|
|
19
16
|
|
|
20
17
|
if (!propertiesFileSourceEncoding) {
|
|
21
|
-
if (project && ["0.1", "1.0", "1.1"].includes(project.
|
|
18
|
+
if (project && ["0.1", "1.0", "1.1"].includes(project.getSpecVersion())) {
|
|
22
19
|
// default encoding to "ISO-8859-1" for old specVersions
|
|
23
20
|
propertiesFileSourceEncoding = "ISO-8859-1";
|
|
24
21
|
} else {
|
|
@@ -91,9 +91,9 @@ const log = require("@ui5/logger").getLogger("builder:processors:bundlers:module
|
|
|
91
91
|
* @typedef {object} ModuleBundleOptions
|
|
92
92
|
* @property {boolean} [optimize=true] Whether the module bundle gets minified
|
|
93
93
|
* @property {boolean} [sourceMap=true] Whether to generate a source map file for the bundle
|
|
94
|
-
* @property {boolean} [decorateBootstrapModule=false] If set to 'false',
|
|
94
|
+
* @property {boolean} [decorateBootstrapModule=false] If set to 'false', bootable bundles won't be decorated
|
|
95
95
|
* with an optimization marker
|
|
96
|
-
* @property {boolean} [addTryCatchRestartWrapper=false] Whether to wrap bootable
|
|
96
|
+
* @property {boolean} [addTryCatchRestartWrapper=false] Whether to wrap bootable bundles with
|
|
97
97
|
* a try/catch to filter out "Restart" errors
|
|
98
98
|
* @property {boolean} [usePredefineCalls=false] If set to 'true', sap.ui.predefine is used for UI5 modules
|
|
99
99
|
* @property {number} [numberOfParts=1] The number of parts the module bundle should be splitted
|
|
@@ -148,7 +148,6 @@ module.exports = function({resources, options: {bundleDefinition, bundleOptions,
|
|
|
148
148
|
log.verbose(`bundleDefinition: ${JSON.stringify(bundleDefinition, null, 2)}`);
|
|
149
149
|
log.verbose(`bundleOptions: ${JSON.stringify(bundleOptions, null, 2)}`);
|
|
150
150
|
}
|
|
151
|
-
|
|
152
151
|
return pool.prepare( resources, moduleNameMapping ).
|
|
153
152
|
then( () => builder.createBundle(bundleDefinition, bundleOptions) ).
|
|
154
153
|
then( (results) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Node script to create cross-library API index files for use in the UI5 SDKs.
|
|
3
3
|
*
|
|
4
|
-
* (c) Copyright 2009-
|
|
4
|
+
* (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Node script to preprocess api.json files for use in the UI5 SDKs.
|
|
3
3
|
*
|
|
4
|
-
* (c) Copyright 2009-
|
|
4
|
+
* (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -1154,7 +1154,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1154
1154
|
},
|
|
1155
1155
|
|
|
1156
1156
|
formatMethodCode: function (sName, aParams, aReturnValue) {
|
|
1157
|
-
var result = '<pre
|
|
1157
|
+
var result = '<pre>' + sName + '(';
|
|
1158
1158
|
|
|
1159
1159
|
if (aParams && aParams.length > 0) {
|
|
1160
1160
|
/* We consider only root level parameters so we get rid of all that are not on the root level */
|
|
@@ -1258,7 +1258,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1258
1258
|
* @returns string - The code needed to create an object of that class
|
|
1259
1259
|
*/
|
|
1260
1260
|
formatConstructor: function (name, params) {
|
|
1261
|
-
var result = '<pre
|
|
1261
|
+
var result = '<pre>new ';
|
|
1262
1262
|
|
|
1263
1263
|
if (name) {
|
|
1264
1264
|
result += name + '(';
|
|
@@ -1386,13 +1386,16 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1386
1386
|
|
|
1387
1387
|
},
|
|
1388
1388
|
|
|
1389
|
+
formatUrlToLink: function(sTarget, sText, bSAPHosted){
|
|
1390
|
+
return `<a target="_blank" rel="noopener noreferrer" href="${sTarget}">${sText}</a>
|
|
1391
|
+
<img src="./resources/sap/ui/documentation/sdk/images/${bSAPHosted ? 'link-sap' : 'link-external'}.png"
|
|
1392
|
+
title="Information published on ${bSAPHosted ? '' : 'non '}SAP site" class="sapUISDKExternalLink"/>`;
|
|
1393
|
+
},
|
|
1394
|
+
|
|
1389
1395
|
handleExternalUrl: function (sTarget, sText) {
|
|
1390
1396
|
// Check if the external domain is SAP hosted
|
|
1391
1397
|
let bSAPHosted = /^https?:\/\/([\w.]*\.)?(?:sap|hana\.ondemand|sapfioritrial)\.com/.test(sTarget);
|
|
1392
|
-
|
|
1393
|
-
return `<a target="_blank" rel="noopener noreferrer" href="${sTarget}">${sText}</a>
|
|
1394
|
-
<img src="./resources/sap/ui/documentation/sdk/images/${bSAPHosted ? 'link-sap' : 'link-external'}.png"
|
|
1395
|
-
title="Information published on ${bSAPHosted ? '' : 'non '}SAP site" class="sapUISDKExternalLink"/>`;
|
|
1398
|
+
return this.formatUrlToLink(sTarget, sText, bSAPHosted);
|
|
1396
1399
|
},
|
|
1397
1400
|
|
|
1398
1401
|
/**
|
|
@@ -1505,8 +1508,7 @@ title="Information published on ${bSAPHosted ? '' : 'non '}SAP site" class="sapU
|
|
|
1505
1508
|
name: oResult.static ? [self.name, oResult.name].join(".") : oResult.name,
|
|
1506
1509
|
type: "methods",
|
|
1507
1510
|
className: className,
|
|
1508
|
-
text: text
|
|
1509
|
-
local: true
|
|
1511
|
+
text: text
|
|
1510
1512
|
});
|
|
1511
1513
|
}
|
|
1512
1514
|
}
|
|
@@ -1546,7 +1548,7 @@ title="Information published on ${bSAPHosted ? '' : 'non '}SAP site" class="sapU
|
|
|
1546
1548
|
* @param {string} [hrefAppend=""]
|
|
1547
1549
|
* @returns {string} link
|
|
1548
1550
|
*/
|
|
1549
|
-
createLink: function ({name, type, className, text=name,
|
|
1551
|
+
createLink: function ({name, type, className, text=name, hrefAppend=""}) {
|
|
1550
1552
|
let sLink;
|
|
1551
1553
|
|
|
1552
1554
|
// handling module's
|
|
@@ -1561,12 +1563,7 @@ title="Information published on ${bSAPHosted ? '' : 'non '}SAP site" class="sapU
|
|
|
1561
1563
|
sLink += hrefAppend;
|
|
1562
1564
|
}
|
|
1563
1565
|
|
|
1564
|
-
|
|
1565
|
-
let sScrollClass = "scrollTo" + type[0].toUpperCase() + type.slice(1, -1);
|
|
1566
|
-
return `<a target="_self" class="jsdoclink ${sScrollClass}" data-target="${name}" href="api/${sLink}">${text}</a>`;
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
return `<a target="_self" class="jsdoclink" href="api/${sLink}">${text}</a>`;
|
|
1566
|
+
return `<a target="_self" href="api/${sLink}">${text}</a>`;
|
|
1570
1567
|
},
|
|
1571
1568
|
|
|
1572
1569
|
/**
|
|
@@ -1594,11 +1591,17 @@ title="Information published on ${bSAPHosted ? '' : 'non '}SAP site" class="sapU
|
|
|
1594
1591
|
}
|
|
1595
1592
|
|
|
1596
1593
|
// topic:xxx Topic
|
|
1597
|
-
aMatch = sTarget.match(/^topic:(\w{32})$/);
|
|
1594
|
+
aMatch = sTarget.match(/^topic:(\w{32}(?:#\w*)?(?:\/\w*)?)$/);
|
|
1598
1595
|
if (aMatch) {
|
|
1599
1596
|
return '<a target="_self" href="topic/' + aMatch[1] + '">' + sText + '</a>';
|
|
1600
1597
|
}
|
|
1601
1598
|
|
|
1599
|
+
// demo:xxx Demo, open the demonstration page in a new window
|
|
1600
|
+
aMatch = sTarget.match(/^demo:([a-zA-Z0-9\/.]*)$/);
|
|
1601
|
+
if (aMatch) {
|
|
1602
|
+
return this.formatUrlToLink("test-resources/" + aMatch[1], sText, true);
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1602
1605
|
// sap.x.Xxx.prototype.xxx - In case of prototype we have a link to method
|
|
1603
1606
|
aMatch = sTarget.match(/([a-zA-Z0-9.$_]+?)\.prototype\.([a-zA-Z0-9.$_]+)$/);
|
|
1604
1607
|
if (aMatch) {
|
|
@@ -1656,7 +1659,6 @@ title="Information published on ${bSAPHosted ? '' : 'non '}SAP site" class="sapU
|
|
|
1656
1659
|
name: aMatch[1] ? `${oSelf.name}.${aMatch[2]}` : aMatch[2],
|
|
1657
1660
|
type: "methods",
|
|
1658
1661
|
className: oSelf.name,
|
|
1659
|
-
local: true,
|
|
1660
1662
|
text: sText
|
|
1661
1663
|
});
|
|
1662
1664
|
}
|
|
@@ -1668,7 +1670,6 @@ title="Information published on ${bSAPHosted ? '' : 'non '}SAP site" class="sapU
|
|
|
1668
1670
|
name: aMatch[1],
|
|
1669
1671
|
type: "annotations",
|
|
1670
1672
|
className: oSelf.name,
|
|
1671
|
-
local: true,
|
|
1672
1673
|
text: sText
|
|
1673
1674
|
});
|
|
1674
1675
|
}
|
|
@@ -1695,7 +1696,6 @@ title="Information published on ${bSAPHosted ? '' : 'non '}SAP site" class="sapU
|
|
|
1695
1696
|
name: aMatch[1],
|
|
1696
1697
|
type: "events",
|
|
1697
1698
|
className: oSelf.name,
|
|
1698
|
-
local: true,
|
|
1699
1699
|
text: sText
|
|
1700
1700
|
});
|
|
1701
1701
|
}
|