@ui5/dts-generator
Advanced tools
Comparing version 1.60.5 to 2.0.0
@@ -0,1 +1,5 @@ | ||
## 2.0.0 | ||
Support skipping/ignoring symbols by fqn. | ||
## 1.60.5 | ||
@@ -2,0 +6,0 @@ |
@@ -21,7 +21,2 @@ # Contribution Guide | ||
With hundred of thousands of lines of (not well defined) input. | ||
And a very complex output structure (d.ts format), unit-test is very nearly impossible | ||
for the package. Instead we employ end-to-end testing via snapshot testing methodology in | ||
the main(only) consumer of this package (@openui5/ts-types). | ||
See [@openui5/ts-types contribution guide](../ts-types/CONTRIBUTING.md) for details. | ||
TODO: implement E2E snapshot testing |
export interface IDirectives { | ||
/** | ||
* Full Qualified Symbol names from the UI5 SDK to completely ignore/skip during generation. | ||
*/ | ||
badSymbols: string[]; | ||
/** | ||
* names (**not** FQNs) of class methods which should be excluded from the generation | ||
@@ -4,0 +9,0 @@ * - TODO: This is very inaccurate due to not using FQNs, consider improving the implementation. |
@@ -12,2 +12,3 @@ const _ = require("lodash"); | ||
directives: { | ||
badSymbols: [], | ||
badMethods: [], | ||
@@ -23,6 +24,7 @@ badInterfaces: [], | ||
const actualOptions = _.defaultsDeep(options, defaultOptions); | ||
const targetLibFixedJson = fixApiJson(targetLibJson); | ||
const depsFixedJsons = timer(function fixJson() { | ||
return _.map(actualOptions.dependencies, fixApiJson); | ||
return _.map(actualOptions.dependencies, _ => | ||
fixApiJson(_, actualOptions.directives.badSymbols) | ||
); | ||
}); | ||
@@ -29,0 +31,0 @@ |
@@ -30,3 +30,3 @@ const _ = require("lodash"); | ||
function genMsettingInterfaceName(className) { | ||
return `${className}Opts`; | ||
return `$${className}Settings`; | ||
} | ||
@@ -33,0 +33,0 @@ |
const _ = require("lodash"); | ||
function fixApiJson(json) { | ||
function fixApiJson(json, badSymbols) { | ||
addImplicitNamespaces(json); | ||
removeBadData(json); | ||
removeBadSymbols(json, badSymbols); | ||
removeRestrictedInterface(json); | ||
@@ -43,10 +43,14 @@ return json; | ||
// TODO: extract this to directives. | ||
const badData = { | ||
// "sap.ui.test.Opa5": true | ||
}; | ||
function removeBadSymbols(json, badSymbols) { | ||
const badSymbolsRecords = _.reduce( | ||
badSymbols, | ||
(result, fqn) => { | ||
result[fqn] = true; | ||
return result; | ||
}, | ||
{} | ||
); | ||
function removeBadData(json) { | ||
json.symbols = _.reject(json.symbols, sym => { | ||
return badData[sym.name]; | ||
return badSymbolsRecords[sym.name]; | ||
}); | ||
@@ -53,0 +57,0 @@ } |
{ | ||
"name": "@ui5/dts-generator", | ||
"description": "Generates TypeScript Definitions from UI5 api.json files", | ||
"version": "1.60.5", | ||
"version": "2.0.0", | ||
"license": "Apache-2.0", | ||
@@ -28,3 +28,3 @@ "repository": { | ||
}, | ||
"gitHead": "34ecef21bf4d69bd95bed7a7e839f5ad89bb813a" | ||
"gitHead": "ad677836eb5cd12ad65c68bc8b7aece1e024097a" | ||
} |
@@ -8,4 +8,4 @@ [](https://www.npmjs.com/package/@ui5/dts-generator) | ||
It is used by the [@openui5/ts-types](../types) package to generate the TypeScript signatures | ||
For OpenUI5. | ||
It is used by the [@sapui5/ts-types](https://www.npmjs.com/package/@sapui5/ts-types) package to generate the TypeScript signatures | ||
For UI5. | ||
@@ -12,0 +12,0 @@ ## Status |
72024
1940