@ui5/builder 3.0.0-alpha.6 → 3.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/index.js +0 -43
  3. package/lib/lbt/bundle/Builder.js +19 -49
  4. package/lib/lbt/resources/LocatorResource.js +1 -1
  5. package/lib/lbt/utils/escapePropertiesFile.js +3 -6
  6. package/lib/processors/bundlers/moduleBundler.js +2 -3
  7. package/lib/processors/jsdoc/lib/createIndexFiles.js +1 -1
  8. package/lib/processors/jsdoc/lib/transformApiJson.js +20 -20
  9. package/lib/processors/jsdoc/lib/ui5/plugin.js +111 -6
  10. package/lib/processors/jsdoc/lib/ui5/template/publish.js +112 -91
  11. package/lib/processors/jsdoc/lib/ui5/template/utils/versionUtil.js +1 -1
  12. package/lib/processors/manifestCreator.js +8 -45
  13. package/lib/tasks/bundlers/generateBundle.js +1 -1
  14. package/lib/tasks/bundlers/generateComponentPreload.js +15 -15
  15. package/lib/tasks/bundlers/generateFlexChangesBundle.js +7 -3
  16. package/lib/tasks/bundlers/generateLibraryPreload.js +84 -91
  17. package/lib/tasks/bundlers/generateManifestBundle.js +8 -10
  18. package/lib/tasks/bundlers/generateStandaloneAppBundle.js +8 -3
  19. package/lib/tasks/bundlers/utils/createModuleNameMapping.js +4 -3
  20. package/lib/tasks/generateCachebusterInfo.js +7 -3
  21. package/lib/tasks/generateLibraryManifest.js +5 -1
  22. package/lib/tasks/generateResourcesJson.js +2 -2
  23. package/lib/tasks/generateThemeDesignerResources.js +8 -2
  24. package/lib/tasks/generateVersionInfo.js +5 -5
  25. package/lib/tasks/jsdoc/generateJsdoc.js +1 -1
  26. package/lib/tasks/minify.js +3 -3
  27. package/lib/tasks/taskRepository.js +1 -13
  28. package/lib/tasks/transformBootstrapHtml.js +6 -1
  29. package/package.json +6 -7
  30. package/lib/builder/BuildContext.js +0 -60
  31. package/lib/builder/ProjectBuildContext.js +0 -61
  32. package/lib/builder/builder.js +0 -425
  33. package/lib/tasks/TaskUtil.js +0 -172
  34. package/lib/types/AbstractBuilder.js +0 -270
  35. package/lib/types/AbstractFormatter.js +0 -66
  36. package/lib/types/AbstractUi5Formatter.js +0 -95
  37. package/lib/types/application/ApplicationBuilder.js +0 -211
  38. package/lib/types/application/ApplicationFormatter.js +0 -227
  39. package/lib/types/application/applicationType.js +0 -15
  40. package/lib/types/library/LibraryBuilder.js +0 -231
  41. package/lib/types/library/LibraryFormatter.js +0 -519
  42. package/lib/types/library/libraryType.js +0 -15
  43. package/lib/types/module/ModuleBuilder.js +0 -7
  44. package/lib/types/module/ModuleFormatter.js +0 -54
  45. package/lib/types/module/moduleType.js +0 -15
  46. package/lib/types/themeLibrary/ThemeLibraryBuilder.js +0 -64
  47. package/lib/types/themeLibrary/ThemeLibraryFormatter.js +0 -90
  48. package/lib/types/themeLibrary/themeLibraryType.js +0 -15
  49. package/lib/types/typeRepository.js +0 -46
package/CHANGELOG.md CHANGED
@@ -2,7 +2,36 @@
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.6...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.9...HEAD).
6
+
7
+ <a name="v3.0.0-alpha.9"></a>
8
+ ## [v3.0.0-alpha.9] - 2022-07-27
9
+ ### Bug Fixes
10
+ - **minify:** Change default to not omit source map resources [`6d75a49`](https://github.com/SAP/ui5-builder/commit/6d75a495224590097332fc061c66cfe0e8f4c151)
11
+
12
+
13
+ <a name="v3.0.0-alpha.8"></a>
14
+ ## [v3.0.0-alpha.8] - 2022-07-15
15
+
16
+ <a name="v3.0.0-alpha.7"></a>
17
+ ## [v3.0.0-alpha.7] - 2022-06-14
18
+ ### Breaking Changes
19
+ - Remove build execution ([#740](https://github.com/SAP/ui5-builder/issues/740)) [`af2e956`](https://github.com/SAP/ui5-builder/commit/af2e956f6cba1275669160328e32df3fffa782d0)
20
+
21
+ ### Bug Fixes
22
+ - Avoid redundant bundle creation ([#741](https://github.com/SAP/ui5-builder/issues/741)) [`13c8405`](https://github.com/SAP/ui5-builder/commit/13c840585946401d238936dfa38a6f70a73e9ed0)
23
+
24
+ ### Features
25
+ - Enable modern preload bundles without dependencies ([#739](https://github.com/SAP/ui5-builder/issues/739)) [`97cfa6c`](https://github.com/SAP/ui5-builder/commit/97cfa6cd3eadff57bcc18816534c7751551ebdb8)
26
+
27
+ ### BREAKING CHANGE
28
+
29
+ * builder.js has been removed. Use ui5-project builder instead
30
+ * Tasks now rely on Project instances being available on Resources (see https://github.com/SAP/ui5-fs/pull/381)
31
+ * TaskRepository#addTask has been removed. Custom tasks need to be added to the project graph instead
32
+ * TaskUtil#get/set/clearTag now requires a Project instance to be provided. Path strings are no longer sufficient
33
+ and will cause an exception to be thrown
34
+
6
35
 
7
36
  <a name="v3.0.0-alpha.6"></a>
8
37
  ## [v3.0.0-alpha.6] - 2022-04-26
@@ -721,6 +750,9 @@ to load the custom bundle file instead.
721
750
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
722
751
 
723
752
 
753
+ [v3.0.0-alpha.9]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.8...v3.0.0-alpha.9
754
+ [v3.0.0-alpha.8]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.7...v3.0.0-alpha.8
755
+ [v3.0.0-alpha.7]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.6...v3.0.0-alpha.7
724
756
  [v3.0.0-alpha.6]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.5...v3.0.0-alpha.6
725
757
  [v3.0.0-alpha.5]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.4...v3.0.0-alpha.5
726
758
  [v3.0.0-alpha.4]: https://github.com/SAP/ui5-builder/compare/v3.0.0-alpha.3...v3.0.0-alpha.4
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
@@ -156,45 +152,6 @@ module.exports = {
156
152
  * @type {import('./lib/tasks/taskRepository')}
157
153
  */
158
154
  taskRepository: "./lib/tasks/taskRepository",
159
- /**
160
- * @type {import('./lib/tasks/TaskUtil')}
161
- */
162
- 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
155
  }
199
156
  };
200
157
 
@@ -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
- // when decorateBootstrapModule is set to false, we don't write the optimized flag
157
- // and don't write the try catch wrapper
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
- (((this.optimizedSources && !this.options.debugMode) || this.optimize) &&
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({
@@ -11,7 +11,7 @@ class LocatorResource extends Resource {
11
11
  }
12
12
 
13
13
  getProject() {
14
- return this.resource._project;
14
+ return this.resource.getProject();
15
15
  }
16
16
 
17
17
  getPath() {
@@ -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 "ISO-8859-1".
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.specVersion)) {
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', the module won't be decorated
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 module bundles with
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-2021 SAP SE or an SAP affiliate company.
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-2021 SAP SE or an SAP affiliate company.
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 class="prettyprint">' + sName + '(';
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 class="prettyprint">new ';
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, local=false, hrefAppend=""}) {
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
- if (local) {
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
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * JSDoc3 plugin for UI5 documentation generation.
3
3
  *
4
- * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
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
 
@@ -288,10 +288,11 @@ function collectShortcuts(body) {
288
288
  } else if ( valueNode.type === Syntax.MemberExpression ) {
289
289
  const _import = getLeftmostName(valueNode);
290
290
  const local = _import && currentModule.localNames[_import];
291
- if ( typeof local === 'object' && local.module ) {
291
+ const objectName = getObjectName(valueNode);
292
+ if ( objectName && typeof local === 'object' && local.module ) {
292
293
  currentModule.localNames[name] = {
293
294
  module: local.module,
294
- path: getObjectName(valueNode).split('.').slice(1).join('.') // TODO chaining if local has path
295
+ path: objectName.split('.').slice(1).join('.') // TODO chaining if local has path
295
296
  };
296
297
  debug(` found local shortcut: ${name} ${currentModule.localNames[name]}`);
297
298
  }
@@ -1617,7 +1618,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1617
1618
  "Removes a " + n1 + " from the aggregation " + link + ".",
1618
1619
  "",
1619
1620
  "@param {int | string | " + makeTypeString(info, true) + "} " + varname(n1, "variant") + " The " + n1 + " to remove or its index or id",
1620
- "@returns {" + makeTypeString(info, true) + "} The removed " + n1 + " or <code>null</code>",
1621
+ "@returns {" + makeTypeString(info, true) + "|null} The removed " + n1 + " or <code>null</code>",
1621
1622
  info.since ? "@since " + info.since : "",
1622
1623
  info.deprecation ? "@deprecated " + info.deprecation : "",
1623
1624
  info.experimental ? "@experimental " + info.experimental : "",
@@ -1812,7 +1813,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1812
1813
  "",
1813
1814
  "@param {object}",
1814
1815
  " [oData] An application-specific payload object that will be passed to the event handler along with the event object when firing the event",
1815
- "@param {function}",
1816
+ "@param {function(sap.ui.base.Event):void}",
1816
1817
  " fnFunction The function to be called when the event occurs",
1817
1818
  "@param {object}",
1818
1819
  " [oListener] Context object to call the event handler with. Defaults to this <code>" + oClassInfo.name + "</code> itself",
@@ -1830,7 +1831,7 @@ function createAutoDoc(oClassInfo, classComment, doclet, node, parser, filename,
1830
1831
  "",
1831
1832
  "The passed function and listener object must match the ones used for event registration.",
1832
1833
  "",
1833
- "@param {function}",
1834
+ "@param {function(sap.ui.base.Event):void}",
1834
1835
  " fnFunction The function to be called, when the event occurs",
1835
1836
  "@param {object}",
1836
1837
  " [oListener] Context object on which the given function had to be called",
@@ -2677,3 +2678,107 @@ exports.astNodeVisitor = {
2677
2678
  }
2678
2679
 
2679
2680
  };
2681
+
2682
+ (function() {
2683
+ const jsdocType = require("jsdoc/lib/jsdoc/tag/type");
2684
+ const catharsis = require('catharsis');
2685
+ const TYPES = catharsis.Types;
2686
+
2687
+ const toTypeString = (type) => getTypeStrings(type).join("|");
2688
+
2689
+ /*
2690
+ * This function has been copied from jsdoc/lib/jsdoc/tag/type (version 3.6.7)
2691
+ * The copy has been enhanced with the changes from https://github.com/jsdoc/jsdoc/pull/1735
2692
+ * to retain the full function signature for function types.
2693
+ *
2694
+ * JSDoc is copyright (c) 2011-present Michael Mathews micmath@gmail.com and the contributors to JSDoc.
2695
+ */
2696
+ function getTypeStrings(parsedType, isOutermostType) {
2697
+ let applications;
2698
+ let typeString;
2699
+ let types = [];
2700
+ switch (parsedType.type) {
2701
+ case TYPES.AllLiteral:
2702
+ types.push('*');
2703
+ break;
2704
+ case TYPES.FunctionType:
2705
+ typeString = 'function';
2706
+ // #### BEGIN: MODIFIED BY SAP
2707
+ const paramTypes = [];
2708
+ if (parsedType.new) {
2709
+ paramTypes.push(toTypeString(parsedType.new));
2710
+ }
2711
+ if (Array.isArray(parsedType.params)) {
2712
+ paramTypes.push(...parsedType.params.map(toTypeString));
2713
+ }
2714
+ if (paramTypes.length || parsedType.result) {
2715
+ typeString += `(${paramTypes.join(", ")})`;
2716
+ }
2717
+ if (parsedType.result) {
2718
+ typeString += `:${toTypeString(parsedType.result)}`;
2719
+ }
2720
+ types.push(typeString);
2721
+ // #### END: MODIFIED BY SAP
2722
+ break;
2723
+ case TYPES.NameExpression:
2724
+ types.push(parsedType.name);
2725
+ break;
2726
+ case TYPES.NullLiteral:
2727
+ types.push('null');
2728
+ break;
2729
+ case TYPES.RecordType:
2730
+ // #### BEGIN: MODIFIED BY SAP
2731
+ // types.push('Object');
2732
+ if (Array.isArray(parsedType.fields)) {
2733
+ typeString = `{${parsedType.fields.map(
2734
+ ({key,value}) => `${catharsis.stringify(key)}: ${toTypeString(value)}`
2735
+ ).join(', ')}}`;
2736
+ types.push(typeString);
2737
+ } else {
2738
+ types.push('Object');
2739
+ }
2740
+ // #### END: MODIFIED BY SAP
2741
+ break;
2742
+ case TYPES.TypeApplication:
2743
+ // if this is the outermost type, we strip the modifiers; otherwise, we keep them
2744
+ if (isOutermostType) {
2745
+ applications = parsedType.applications.map(application =>
2746
+ catharsis.stringify(application)).join(', ');
2747
+ typeString = `${getTypeStrings(parsedType.expression)[0]}.<${applications}>`;
2748
+ types.push(typeString);
2749
+ }
2750
+ else {
2751
+ types.push( catharsis.stringify(parsedType) );
2752
+ }
2753
+ break;
2754
+ case TYPES.TypeUnion:
2755
+ parsedType.elements.forEach(element => {
2756
+ types = types.concat( getTypeStrings(element) );
2757
+ });
2758
+ break;
2759
+ case TYPES.UndefinedLiteral:
2760
+ types.push('undefined');
2761
+ break;
2762
+ case TYPES.UnknownLiteral:
2763
+ types.push('?');
2764
+ break;
2765
+ default:
2766
+ // this shouldn't happen
2767
+ throw new Error(`unrecognized type ${parsedType.type} in parsed type: ${parsedType}`);
2768
+ }
2769
+ return types;
2770
+ }
2771
+
2772
+ const origParse = jsdocType.parse;
2773
+ jsdocType.parse = function() {
2774
+ const tagInfo = origParse.apply(this, arguments);
2775
+ if ( tagInfo && /function/.test(tagInfo.typeExpression) && tagInfo.parsedType ) {
2776
+ // console.info("old typeExpression", tagInfo.typeExpression);
2777
+ // console.info("old parse tree", tagInfo.parsedType);
2778
+ // console.info("old parse result", tagInfo.type);
2779
+ tagInfo.type = getTypeStrings(tagInfo.parsedType);
2780
+ // console.info("new parse result", tagInfo.type);
2781
+ }
2782
+ return tagInfo;
2783
+ }
2784
+ }());