-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] Node.js API: TypeScript type definition support (#475)
Lazy-loading in the index.js breaks the automatic type definition detection from TypeScript when using the module via require. Therefore we need to manually declare the exported types. Adds a small jsdoc-plugin to remove the import() comments as JSDoc is unable to parse them.
- Loading branch information
Showing
3 changed files
with
199 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Removes JSDoc comments with TypeScript import() declarations (used in index.js) | ||
*/ | ||
|
||
const IMPORT_PATTERN = /{(?:typeof )?import\(["'][^"']*["']\)[ .|}><,)=#\n]/; | ||
|
||
exports.handlers = { | ||
jsdocCommentFound: function(e) { | ||
if (IMPORT_PATTERN.test(e.comment)) { | ||
e.comment = ""; | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,63 @@ | ||
{ | ||
"tags": { | ||
"allowUnknownTags": false | ||
}, | ||
"source": { | ||
"include": ["README.md", "index.js"], | ||
"exclude": ["lib/lbt/utils/JSTokenizer.js"], | ||
"includePattern": ".+\\.js$", | ||
"excludePattern": "(node_modules(\\\\|/))" | ||
}, | ||
"plugins": [], | ||
"opts": { | ||
"template": "node_modules/docdash/", | ||
"encoding": "utf8", | ||
"destination": "jsdocs/", | ||
"recurse": true, | ||
"verbose": true, | ||
"access": "public" | ||
}, | ||
"templates": { | ||
"cleverLinks": false, | ||
"monospaceLinks": false, | ||
"default": { | ||
"useLongnameInNav": true | ||
} | ||
}, | ||
"openGraph": { | ||
"title": "UI5 Tooling - API Reference", | ||
"type": "website", | ||
"image": "https://sap.github.io/ui5-tooling/docs/images/UI5_logo_wide.png", | ||
"site_name": "UI5 Tooling - API Reference", | ||
"url": "https://sap.github.io/ui5-tooling/" | ||
}, | ||
"docdash": { | ||
"sectionOrder": [ | ||
"Modules", | ||
"Namespaces", | ||
"Classes", | ||
"Externals", | ||
"Events", | ||
"Mixins", | ||
"Tutorials", | ||
"Interfaces" | ||
], | ||
"meta": { | ||
"title": "UI5 Tooling - API Reference - UI5 Builder", | ||
"description": "UI5 Tooling - API Reference - UI5 Builder", | ||
"keyword": "openui5 sapui5 ui5 build development tool api reference" | ||
}, | ||
"search": true, | ||
"wrap": true, | ||
"menu": { | ||
"GitHub": { | ||
"href": "https://github.com/SAP/ui5-builder", | ||
"target": "_blank", | ||
"class": "menu-item", | ||
"id": "github_link" | ||
} | ||
} | ||
} | ||
"tags": { | ||
"allowUnknownTags": false | ||
}, | ||
"source": { | ||
"include": ["README.md", "index.js"], | ||
"exclude": ["lib/lbt/utils/JSTokenizer.js"], | ||
"includePattern": ".+\\.js$", | ||
"excludePattern": "(node_modules(\\\\|/))" | ||
}, | ||
"plugins": [ | ||
"./jsdoc-plugin" | ||
], | ||
"opts": { | ||
"template": "node_modules/docdash/", | ||
"encoding": "utf8", | ||
"destination": "jsdocs/", | ||
"recurse": true, | ||
"verbose": true, | ||
"access": "public" | ||
}, | ||
"templates": { | ||
"cleverLinks": false, | ||
"monospaceLinks": false, | ||
"default": { | ||
"useLongnameInNav": true | ||
} | ||
}, | ||
"openGraph": { | ||
"title": "UI5 Tooling - API Reference", | ||
"type": "website", | ||
"image": "https://sap.github.io/ui5-tooling/docs/images/UI5_logo_wide.png", | ||
"site_name": "UI5 Tooling - API Reference", | ||
"url": "https://sap.github.io/ui5-tooling/" | ||
}, | ||
"docdash": { | ||
"sectionOrder": [ | ||
"Modules", | ||
"Namespaces", | ||
"Classes", | ||
"Externals", | ||
"Events", | ||
"Mixins", | ||
"Tutorials", | ||
"Interfaces" | ||
], | ||
"meta": { | ||
"title": "UI5 Tooling - API Reference - UI5 Builder", | ||
"description": "UI5 Tooling - API Reference - UI5 Builder", | ||
"keyword": "openui5 sapui5 ui5 build development tool api reference" | ||
}, | ||
"search": true, | ||
"wrap": true, | ||
"menu": { | ||
"GitHub": { | ||
"href": "https://github.com/SAP/ui5-builder", | ||
"target": "_blank", | ||
"class": "menu-item", | ||
"id": "github_link" | ||
} | ||
} | ||
} | ||
} |