@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.
- package/CHANGELOG.md +125 -12
- package/index.js +4 -59
- package/jsdoc.json +0 -1
- package/lib/lbt/analyzer/JSModuleAnalyzer.js +31 -5
- package/lib/lbt/analyzer/XMLTemplateAnalyzer.js +2 -1
- package/lib/lbt/bundle/AutoSplitter.js +10 -24
- package/lib/lbt/bundle/Builder.js +367 -168
- package/lib/lbt/bundle/BundleWriter.js +17 -0
- package/lib/lbt/bundle/Resolver.js +3 -3
- package/lib/lbt/resources/LocatorResource.js +7 -9
- package/lib/lbt/resources/LocatorResourcePool.js +8 -4
- package/lib/lbt/resources/Resource.js +7 -0
- package/lib/lbt/resources/ResourceCollector.js +43 -18
- 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/lbt/utils/parseUtils.js +1 -1
- package/lib/processors/bundlers/moduleBundler.js +42 -17
- package/lib/processors/jsdoc/lib/createIndexFiles.js +1 -1
- package/lib/processors/jsdoc/lib/transformApiJson.js +7 -16
- 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/processors/minifier.js +90 -0
- package/lib/processors/resourceListCreator.js +2 -16
- package/lib/tasks/buildThemes.js +1 -1
- package/lib/tasks/bundlers/generateBundle.js +82 -14
- package/lib/tasks/bundlers/generateComponentPreload.js +31 -17
- package/lib/tasks/bundlers/generateFlexChangesBundle.js +7 -3
- package/lib/tasks/bundlers/generateLibraryPreload.js +127 -79
- package/lib/tasks/bundlers/generateManifestBundle.js +8 -10
- package/lib/tasks/bundlers/generateStandaloneAppBundle.js +54 -15
- package/lib/tasks/bundlers/utils/createModuleNameMapping.js +31 -0
- package/lib/tasks/generateCachebusterInfo.js +7 -3
- package/lib/tasks/generateLibraryManifest.js +6 -8
- package/lib/tasks/generateResourcesJson.js +15 -9
- package/lib/tasks/generateThemeDesignerResources.js +118 -2
- package/lib/tasks/generateVersionInfo.js +5 -5
- package/lib/tasks/jsdoc/generateJsdoc.js +1 -1
- package/lib/tasks/minify.js +41 -0
- package/lib/tasks/replaceVersion.js +1 -1
- package/lib/tasks/taskRepository.js +7 -15
- package/lib/tasks/transformBootstrapHtml.js +6 -1
- package/package.json +20 -19
- package/lib/builder/BuildContext.js +0 -39
- package/lib/builder/ProjectBuildContext.js +0 -55
- package/lib/builder/builder.js +0 -420
- package/lib/processors/debugFileCreator.js +0 -52
- package/lib/processors/resourceCopier.js +0 -24
- package/lib/processors/uglifier.js +0 -45
- package/lib/tasks/TaskUtil.js +0 -160
- package/lib/tasks/createDebugFiles.js +0 -30
- package/lib/tasks/uglify.js +0 -33
- 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 -220
- package/lib/types/application/ApplicationFormatter.js +0 -227
- package/lib/types/application/applicationType.js +0 -15
- package/lib/types/library/LibraryBuilder.js +0 -237
- 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 -62
- package/lib/types/themeLibrary/ThemeLibraryFormatter.js +0 -90
- package/lib/types/themeLibrary/themeLibraryType.js +0 -15
- package/lib/types/typeRepository.js +0 -46
|
@@ -11,6 +11,8 @@ const SPACES_OR_TABS_ONLY = /^[ \t]+$/;
|
|
|
11
11
|
*
|
|
12
12
|
* Most methods have been extracted from JSMergeWriter.
|
|
13
13
|
*
|
|
14
|
+
* columnOffset and lineOffset are used for sourcemap merging as reference to where we are at a given point in time
|
|
15
|
+
*
|
|
14
16
|
* @author Frank Weigel
|
|
15
17
|
* @since 1.27.0
|
|
16
18
|
* @private
|
|
@@ -18,6 +20,8 @@ const SPACES_OR_TABS_ONLY = /^[ \t]+$/;
|
|
|
18
20
|
class BundleWriter {
|
|
19
21
|
constructor() {
|
|
20
22
|
this.buf = "";
|
|
23
|
+
this.lineOffset = 0;
|
|
24
|
+
this.columnOffset = 0;
|
|
21
25
|
this.segments = [];
|
|
22
26
|
this.currentSegment = null;
|
|
23
27
|
this.currentSourceIndex = 0;
|
|
@@ -28,6 +32,11 @@ class BundleWriter {
|
|
|
28
32
|
let writeBuf = "";
|
|
29
33
|
for ( let i = 0; i < str.length; i++ ) {
|
|
30
34
|
writeBuf += str[i];
|
|
35
|
+
if (str[i] != null && str[i].split) {
|
|
36
|
+
const strSplit = str[i].split(NL);
|
|
37
|
+
this.lineOffset += strSplit.length - 1;
|
|
38
|
+
this.columnOffset += strSplit[strSplit.length - 1].length;
|
|
39
|
+
}
|
|
31
40
|
}
|
|
32
41
|
if ( writeBuf.length >= 1 ) {
|
|
33
42
|
this.buf += writeBuf;
|
|
@@ -40,15 +49,23 @@ class BundleWriter {
|
|
|
40
49
|
writeln(...str) {
|
|
41
50
|
for ( let i = 0; i < str.length; i++ ) {
|
|
42
51
|
this.buf += str[i];
|
|
52
|
+
if (str[i] != null && str[i].split) {
|
|
53
|
+
const strSplit = str[i].split(NL);
|
|
54
|
+
this.lineOffset += strSplit.length - 1;
|
|
55
|
+
}
|
|
43
56
|
}
|
|
44
57
|
this.buf += NL;
|
|
45
58
|
this.endsWithNewLine = true;
|
|
59
|
+
this.lineOffset += 1;
|
|
60
|
+
this.columnOffset = 0;
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
ensureNewLine() {
|
|
49
64
|
if ( !this.endsWithNewLine ) {
|
|
50
65
|
this.buf += NL;
|
|
51
66
|
this.endsWithNewLine = true;
|
|
67
|
+
this.lineOffset += 1;
|
|
68
|
+
this.columnOffset = 0;
|
|
52
69
|
}
|
|
53
70
|
}
|
|
54
71
|
|
|
@@ -289,15 +289,15 @@ class BundleResolver {
|
|
|
289
289
|
|
|
290
290
|
return collectModulesForSection(section).
|
|
291
291
|
then( (modules) => {
|
|
292
|
-
if ( section.mode == SectionType.Raw && section.sort ) {
|
|
292
|
+
if ( section.mode == SectionType.Raw && section.sort !== false ) {
|
|
293
293
|
// sort the modules in topological order
|
|
294
294
|
return topologicalSort(pool, modules).then( (modules) => {
|
|
295
|
-
log.
|
|
295
|
+
log.silly(" resolved modules (sorted): %s", modules);
|
|
296
296
|
return modules;
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
log.
|
|
300
|
+
log.silly(" resolved modules: %s", modules);
|
|
301
301
|
return modules;
|
|
302
302
|
}).then( function(modules) {
|
|
303
303
|
resolvedSection.modules = modules;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
const Resource = require("./Resource");
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
function extractName(path) {
|
|
5
|
-
return path.slice( "/resources/".length);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
3
|
class LocatorResource extends Resource {
|
|
10
|
-
constructor(pool, resource) {
|
|
11
|
-
super(pool,
|
|
4
|
+
constructor(pool, resource, moduleName) {
|
|
5
|
+
super(pool, moduleName, null, resource.getStatInfo());
|
|
12
6
|
this.resource = resource;
|
|
13
7
|
}
|
|
14
8
|
|
|
@@ -17,7 +11,11 @@ class LocatorResource extends Resource {
|
|
|
17
11
|
}
|
|
18
12
|
|
|
19
13
|
getProject() {
|
|
20
|
-
return this.resource.
|
|
14
|
+
return this.resource.getProject();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getPath() {
|
|
18
|
+
return this.resource.getPath();
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
|
|
@@ -2,12 +2,16 @@ const ResourcePool = require("./ResourcePool");
|
|
|
2
2
|
const LocatorResource = require("./LocatorResource");
|
|
3
3
|
|
|
4
4
|
class LocatorResourcePool extends ResourcePool {
|
|
5
|
-
prepare(resources) {
|
|
5
|
+
prepare(resources, moduleNameMapping) {
|
|
6
6
|
resources = resources.filter( (res) => !res.getStatInfo().isDirectory() );
|
|
7
7
|
return Promise.all(
|
|
8
|
-
resources.map(
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
resources.map((resource) => {
|
|
9
|
+
let moduleName = moduleNameMapping && moduleNameMapping[resource.getPath()];
|
|
10
|
+
if (!moduleName) {
|
|
11
|
+
moduleName = resource.getPath().slice("/resources/".length);
|
|
12
|
+
}
|
|
13
|
+
return this.addResource(new LocatorResource(this, resource, moduleName));
|
|
14
|
+
}).filter(Boolean)
|
|
11
15
|
);
|
|
12
16
|
}
|
|
13
17
|
}
|
|
@@ -18,6 +18,13 @@ class Resource {
|
|
|
18
18
|
async buffer() {
|
|
19
19
|
return readFile(this.file);
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @returns {Promise<string>} String of the file content
|
|
24
|
+
*/
|
|
25
|
+
async string() {
|
|
26
|
+
return (await this.buffer()).toString();
|
|
27
|
+
}
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
module.exports = Resource;
|
|
@@ -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
|
}
|
|
@@ -193,17 +194,16 @@ class ResourceCollector {
|
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
async determineResourceDetails({
|
|
196
|
-
debugResources, mergedResources, designtimeResources, supportResources
|
|
197
|
+
debugResources, mergedResources, designtimeResources, supportResources
|
|
197
198
|
}) {
|
|
198
199
|
const baseNames = new Set();
|
|
199
200
|
const debugFilter = new ResourceFilterList(debugResources);
|
|
200
201
|
const mergeFilter = new ResourceFilterList(mergedResources);
|
|
201
202
|
const designtimeFilter = new ResourceFilterList(designtimeResources);
|
|
202
203
|
const supportFilter = new ResourceFilterList(supportResources);
|
|
203
|
-
const debugBundleFilter = new ResourceFilterList(debugBundles);
|
|
204
204
|
|
|
205
205
|
const promises = [];
|
|
206
|
-
const
|
|
206
|
+
const debugResourcesInfo = [];
|
|
207
207
|
|
|
208
208
|
for (const [name, info] of this._resources.entries()) {
|
|
209
209
|
if ( debugFilter.matches(name) ) {
|
|
@@ -231,13 +231,14 @@ class ResourceCollector {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
if ( /(?:\.js|\.view\.xml|\.control\.xml|\.fragment\.xml)$/.test(name) ) {
|
|
234
|
-
if (
|
|
235
|
-
// Only analyze non-
|
|
234
|
+
if ( !info.isDebug ) {
|
|
235
|
+
// Only analyze non-dbg files in first run
|
|
236
236
|
promises.push(
|
|
237
237
|
this.enrichWithDependencyInfo(info)
|
|
238
238
|
);
|
|
239
239
|
} else {
|
|
240
|
-
|
|
240
|
+
// Collect dbg files to be handled in a second step (see below)
|
|
241
|
+
debugResourcesInfo.push(info);
|
|
241
242
|
}
|
|
242
243
|
}
|
|
243
244
|
|
|
@@ -279,19 +280,43 @@ class ResourceCollector {
|
|
|
279
280
|
|
|
280
281
|
await Promise.all(promises);
|
|
281
282
|
|
|
282
|
-
|
|
283
|
-
const
|
|
284
|
-
const nonDebugName = ResourceInfoList.getNonDebugName(
|
|
283
|
+
await Promise.all(debugResourcesInfo.map(async (dbgInfo) => {
|
|
284
|
+
const debugName = dbgInfo.name;
|
|
285
|
+
const nonDebugName = ResourceInfoList.getNonDebugName(debugName);
|
|
285
286
|
const nonDbgInfo = this._resources.get(nonDebugName);
|
|
286
|
-
const newDbgInfo = new ResourceInfo(dbgInfo.name);
|
|
287
287
|
|
|
288
|
-
//
|
|
289
|
-
|
|
290
|
-
// Then copy over info from dbg file to properly set name, isDebug, etc.
|
|
291
|
-
newDbgInfo.copyFrom(null, dbgInfo);
|
|
288
|
+
// FIXME: "merged" property is only calculated in ResourceInfo#copyFrom
|
|
289
|
+
// Therefore using the same logic here to compute it.
|
|
292
290
|
|
|
293
|
-
|
|
294
|
-
|
|
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
|
+
|
|
295
|
+
if (!nonDbgInfo || (nonDbgInfo.included != null && nonDbgInfo.included.size > 0)) {
|
|
296
|
+
// We need to analyze the dbg resource if there is no non-dbg variant or
|
|
297
|
+
// it is a bundle because we will (usually) have different content.
|
|
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);
|
|
304
|
+
} else {
|
|
305
|
+
// If the non-dbg resource is not a bundle, we can just copy over the info and skip
|
|
306
|
+
// analyzing the dbg variant as both should have the same info.
|
|
307
|
+
|
|
308
|
+
const newDbgInfo = new ResourceInfo(debugName);
|
|
309
|
+
|
|
310
|
+
// First copy info of analysis from non-dbg file (included, required, condRequired, ...)
|
|
311
|
+
newDbgInfo.copyFrom(null, nonDbgInfo);
|
|
312
|
+
// Then copy over info from dbg file to properly set name, isDebug, etc.
|
|
313
|
+
newDbgInfo.copyFrom(null, dbgInfo);
|
|
314
|
+
// Finally, set the module name to the non-dbg name
|
|
315
|
+
newDbgInfo.module = nonDbgInfo.module;
|
|
316
|
+
|
|
317
|
+
this._resources.set(debugName, newDbgInfo);
|
|
318
|
+
}
|
|
319
|
+
}));
|
|
295
320
|
}
|
|
296
321
|
|
|
297
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 {
|
|
@@ -9,7 +9,7 @@ function parseJS(code, userOptions = {}) {
|
|
|
9
9
|
// allowed options and their defaults
|
|
10
10
|
const options = {
|
|
11
11
|
comment: false,
|
|
12
|
-
ecmaVersion:
|
|
12
|
+
ecmaVersion: 2021, // NOTE: Adopt JSModuleAnalyzer.js to allow new Syntax when upgrading to newer ECMA versions
|
|
13
13
|
range: false,
|
|
14
14
|
sourceType: "script",
|
|
15
15
|
};
|
|
@@ -89,10 +89,11 @@ const log = require("@ui5/logger").getLogger("builder:processors:bundlers:module
|
|
|
89
89
|
*
|
|
90
90
|
* @public
|
|
91
91
|
* @typedef {object} ModuleBundleOptions
|
|
92
|
-
* @property {boolean} [optimize=
|
|
93
|
-
* @property {boolean} [
|
|
92
|
+
* @property {boolean} [optimize=true] Whether the module bundle gets minified
|
|
93
|
+
* @property {boolean} [sourceMap=true] Whether to generate a source map file for the bundle
|
|
94
|
+
* @property {boolean} [decorateBootstrapModule=false] If set to 'false', bootable bundles won't be decorated
|
|
94
95
|
* with an optimization marker
|
|
95
|
-
* @property {boolean} [addTryCatchRestartWrapper=false] Whether to wrap bootable
|
|
96
|
+
* @property {boolean} [addTryCatchRestartWrapper=false] Whether to wrap bootable bundles with
|
|
96
97
|
* a try/catch to filter out "Restart" errors
|
|
97
98
|
* @property {boolean} [usePredefineCalls=false] If set to 'true', sap.ui.predefine is used for UI5 modules
|
|
98
99
|
* @property {number} [numberOfParts=1] The number of parts the module bundle should be splitted
|
|
@@ -101,23 +102,41 @@ const log = require("@ui5/logger").getLogger("builder:processors:bundlers:module
|
|
|
101
102
|
*/
|
|
102
103
|
|
|
103
104
|
/**
|
|
104
|
-
*
|
|
105
|
+
* Result set
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
* @typedef {object} ModuleBundlerResult
|
|
109
|
+
* @property {module:@ui5/fs.Resource} bundle Bundle resource
|
|
110
|
+
* @property {module:@ui5/fs.Resource} sourceMap Source Map
|
|
111
|
+
* @memberof module:@ui5/builder.processors
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Legacy module bundler.
|
|
105
116
|
*
|
|
106
117
|
* @public
|
|
107
118
|
* @alias module:@ui5/builder.processors.moduleBundler
|
|
108
119
|
* @param {object} parameters Parameters
|
|
109
120
|
* @param {module:@ui5/fs.Resource[]} parameters.resources Resources
|
|
110
121
|
* @param {object} parameters.options Options
|
|
122
|
+
* @param {object} [parameters.options.moduleNameMapping]
|
|
123
|
+
Optional mapping of resource paths to module name in order to overwrite the default determination
|
|
111
124
|
* @param {ModuleBundleDefinition} parameters.options.bundleDefinition Module bundle definition
|
|
112
|
-
* @param {ModuleBundleOptions} parameters.options.bundleOptions Module bundle options
|
|
113
|
-
* @returns {Promise<module:@ui5/
|
|
125
|
+
* @param {ModuleBundleOptions} [parameters.options.bundleOptions] Module bundle options
|
|
126
|
+
* @returns {Promise<module:@ui5/builder.processors.ModuleBundlerResult[]>}
|
|
127
|
+
* Promise resolving with module bundle resources
|
|
114
128
|
*/
|
|
115
|
-
module.exports = function({resources, options: {bundleDefinition, bundleOptions}}) {
|
|
116
|
-
//
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
module.exports = function({resources, options: {bundleDefinition, bundleOptions, moduleNameMapping}}) {
|
|
130
|
+
// Apply defaults without modifying the passed object
|
|
131
|
+
bundleOptions = Object.assign({}, {
|
|
132
|
+
optimize: true,
|
|
133
|
+
sourceMap: true,
|
|
134
|
+
decorateBootstrapModule: false,
|
|
135
|
+
addTryCatchRestartWrapper: false,
|
|
136
|
+
usePredefineCalls: false,
|
|
137
|
+
numberOfParts: 1,
|
|
138
|
+
ignoreMissingModules: false
|
|
139
|
+
}, bundleOptions);
|
|
121
140
|
|
|
122
141
|
const pool = new LocatorResourcePool({
|
|
123
142
|
ignoreMissingModules: bundleOptions.ignoreMissingModules
|
|
@@ -129,8 +148,7 @@ module.exports = function({resources, options: {bundleDefinition, bundleOptions}
|
|
|
129
148
|
log.verbose(`bundleDefinition: ${JSON.stringify(bundleDefinition, null, 2)}`);
|
|
130
149
|
log.verbose(`bundleOptions: ${JSON.stringify(bundleOptions, null, 2)}`);
|
|
131
150
|
}
|
|
132
|
-
|
|
133
|
-
return pool.prepare( resources ).
|
|
151
|
+
return pool.prepare( resources, moduleNameMapping ).
|
|
134
152
|
then( () => builder.createBundle(bundleDefinition, bundleOptions) ).
|
|
135
153
|
then( (results) => {
|
|
136
154
|
let bundles;
|
|
@@ -142,13 +160,20 @@ module.exports = function({resources, options: {bundleDefinition, bundleOptions}
|
|
|
142
160
|
|
|
143
161
|
return Promise.all(bundles.map((bundleObj) => {
|
|
144
162
|
if ( bundleObj ) {
|
|
145
|
-
const {name, content} = bundleObj;
|
|
163
|
+
const {name, content, sourceMap} = bundleObj;
|
|
146
164
|
// console.log("creating bundle as '%s'", "/resources/" + name);
|
|
147
|
-
const
|
|
165
|
+
const res = {};
|
|
166
|
+
res.bundle = new EvoResource({
|
|
148
167
|
path: "/resources/" + name,
|
|
149
168
|
string: content
|
|
150
169
|
});
|
|
151
|
-
|
|
170
|
+
if (sourceMap) {
|
|
171
|
+
res.sourceMap = new EvoResource({
|
|
172
|
+
path: "/resources/" + name + ".map",
|
|
173
|
+
string: sourceMap
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return res;
|
|
152
177
|
}
|
|
153
178
|
}));
|
|
154
179
|
});
|
|
@@ -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 + '(';
|
|
@@ -1508,8 +1508,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1508
1508
|
name: oResult.static ? [self.name, oResult.name].join(".") : oResult.name,
|
|
1509
1509
|
type: "methods",
|
|
1510
1510
|
className: className,
|
|
1511
|
-
text: text
|
|
1512
|
-
local: true
|
|
1511
|
+
text: text
|
|
1513
1512
|
});
|
|
1514
1513
|
}
|
|
1515
1514
|
}
|
|
@@ -1549,7 +1548,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1549
1548
|
* @param {string} [hrefAppend=""]
|
|
1550
1549
|
* @returns {string} link
|
|
1551
1550
|
*/
|
|
1552
|
-
createLink: function ({name, type, className, text=name,
|
|
1551
|
+
createLink: function ({name, type, className, text=name, hrefAppend=""}) {
|
|
1553
1552
|
let sLink;
|
|
1554
1553
|
|
|
1555
1554
|
// handling module's
|
|
@@ -1564,12 +1563,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1564
1563
|
sLink += hrefAppend;
|
|
1565
1564
|
}
|
|
1566
1565
|
|
|
1567
|
-
|
|
1568
|
-
let sScrollClass = "scrollTo" + type[0].toUpperCase() + type.slice(1, -1);
|
|
1569
|
-
return `<a target="_self" class="jsdoclink ${sScrollClass}" data-target="${name}" href="api/${sLink}">${text}</a>`;
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
return `<a target="_self" class="jsdoclink" href="api/${sLink}">${text}</a>`;
|
|
1566
|
+
return `<a target="_self" href="api/${sLink}">${text}</a>`;
|
|
1573
1567
|
},
|
|
1574
1568
|
|
|
1575
1569
|
/**
|
|
@@ -1597,7 +1591,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1597
1591
|
}
|
|
1598
1592
|
|
|
1599
1593
|
// topic:xxx Topic
|
|
1600
|
-
aMatch = sTarget.match(/^topic:(\w{32})$/);
|
|
1594
|
+
aMatch = sTarget.match(/^topic:(\w{32}(?:#\w*)?(?:\/\w*)?)$/);
|
|
1601
1595
|
if (aMatch) {
|
|
1602
1596
|
return '<a target="_self" href="topic/' + aMatch[1] + '">' + sText + '</a>';
|
|
1603
1597
|
}
|
|
@@ -1665,7 +1659,6 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1665
1659
|
name: aMatch[1] ? `${oSelf.name}.${aMatch[2]}` : aMatch[2],
|
|
1666
1660
|
type: "methods",
|
|
1667
1661
|
className: oSelf.name,
|
|
1668
|
-
local: true,
|
|
1669
1662
|
text: sText
|
|
1670
1663
|
});
|
|
1671
1664
|
}
|
|
@@ -1677,7 +1670,6 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1677
1670
|
name: aMatch[1],
|
|
1678
1671
|
type: "annotations",
|
|
1679
1672
|
className: oSelf.name,
|
|
1680
|
-
local: true,
|
|
1681
1673
|
text: sText
|
|
1682
1674
|
});
|
|
1683
1675
|
}
|
|
@@ -1704,7 +1696,6 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
|
|
|
1704
1696
|
name: aMatch[1],
|
|
1705
1697
|
type: "events",
|
|
1706
1698
|
className: oSelf.name,
|
|
1707
|
-
local: true,
|
|
1708
1699
|
text: sText
|
|
1709
1700
|
});
|
|
1710
1701
|
}
|