Socket
Socket
Sign inDemoInstall

@microsoft/api-extractor

Package Overview
Dependencies
Maintainers
2
Versions
487
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/api-extractor - npm Package Compare versions

Comparing version 2.0.8 to 2.0.9

lib/PackageJsonLookup.d.ts

17

CHANGELOG.json

@@ -5,2 +5,17 @@ {

{
"version": "2.0.9",
"tag": "@microsoft/api-extractor_v2.0.9",
"date": "Sat, 17 Jun 2017 01:02:59 GMT",
"comments": {
"patch": [
{
"comment": "The unsupported @summary tag is now reported as an error"
},
{
"comment": "Use a cache to speed up package.json lookups"
}
]
}
},
{
"version": "2.0.8",

@@ -342,3 +357,3 @@ "tag": "@microsoft/api-extractor_v2.0.8",

{
"comment": "Check for missing JsDoc sequences changed."
"comment": "Check for missing JSDoc sequences changed."
},

@@ -345,0 +360,0 @@ {

# Change Log - @microsoft/api-extractor
This log was last generated on Wed, 14 Jun 2017 13:03:40 GMT and should not be manually modified.
This log was last generated on Sat, 17 Jun 2017 01:02:59 GMT and should not be manually modified.
## 2.0.9
Sat, 17 Jun 2017 01:02:59 GMT
### Patches
- The unsupported @summary tag is now reported as an error
- Use a cache to speed up package.json lookups
## 2.0.8

@@ -199,3 +207,3 @@ Wed, 14 Jun 2017 13:03:40 GMT

- Check for missing JsDoc sequences changed.
- Check for missing JSDoc sequences changed.
- Improved error messages

@@ -202,0 +210,0 @@

4

lib/ApiDefinitionReference.js

@@ -26,5 +26,3 @@ "use strict";

if (!apiReferenceExpr || apiReferenceExpr.split(' ').length > 1) {
reportError('API reference expression must be of the form: ' +
'\'scopeName/packageName:exportName.memberName | display text\'' +
'where the \'|\' is required if a display text is provided');
reportError('An API item reference must use the notation: "@scopeName/packageName:exportName.memberName"');
return;

@@ -31,0 +29,0 @@ }

@@ -10,3 +10,3 @@ /// <reference types="es6-collections" />

/**
* An "API Tag" is a custom JSDoc tag which indicates whether an ApiItem definition
* A "release tag" is an AEDoc tag which indicates whether an ApiItem definition
* is considered Public API for third party developers, as well as its release

@@ -17,25 +17,27 @@ * stage (alpha, beta, etc).

*/
export declare enum ApiTag {
export declare enum ReleaseTag {
/**
* No API Tag was specified in the JSDoc summary.
* No release tag was specified in the AEDoc summary.
*/
None = 0,
/**
* The API was documented as internal, i.e. not callable by third party developers.
* Indicates that an API item is meant only for usage by other NPM packages from the same
* maintainer. Third parties should never use "internal" APIs. (To emphasize this, their
* names are prefixed by underscores.)
*/
Internal = 1,
/**
* The API was documented as "alpha." This status is not generally used. See the
* ApiPrinciplesAndProcess.md for details.
* Indicates that an API item is eventually intended to be public, but currently is in an
* early stage of development. Third parties should not use "alpha" APIs.
*/
Alpha = 2,
/**
* The API was documented as callable by third party developers, but at their own risk.
* Web parts that call beta APIs should only be used for experimentation, because the Web Part
* will break if Microsoft changes the API signature later.
* Indicates that an API item has been released in an experimental state. Third parties are
* encouraged to try it and provide feedback. However, a "beta" API should NOT be used
* in production.
*/
Beta = 3,
/**
* The API was documented as callable by third party developers, with a guarantee that Microsoft will
* never make any breaking changes once the API is published.
* Indicates that an API item has been officially released. It is part of the supported
* contract (e.g. SemVer) for a package.
*/

@@ -60,17 +62,17 @@ Public = 4,

/**
* Match JsDoc block tags and inline tags
* Match AEDoc block tags and inline tags
* Example "@a @b@c d@e @f {whatever} {@link a} { @something } \@g" => ["@a", "@f", "{@link a}", "{ @something }"]
*/
static readonly _jsdocTagsRegex: RegExp;
private static _allowedRegularJsdocTags;
private static _allowedInlineJsdocTags;
static readonly _aedocTagsRegex: RegExp;
private static _allowedRegularAedocTags;
private static _allowedInlineAedocTags;
/**
* The original JsDoc comment.
* The original AEDoc comment.
*
* Example: "This is a summary. \{\@link a\} \@remarks These are remarks."
*/
originalJsDoc: string;
originalAedoc: string;
/**
* The docComment text string split into an array of ITokenItems. The tokens are essentially either
* JSDoc tags (which start with the "@" character) or substrings containing the
* AEDoc tags (which start with the "@" character) or substrings containing the
* remaining text. The array can be empty, but not undefined.

@@ -99,6 +101,6 @@ * Example:

* A list of link elements to be processed after all basic documentation has been created
* for all items in the project. We save the processing for later because we need ApiTag
* for all items in the project. We save the processing for later because we need ReleaseTag
* information before we can deem a link element is valid.
* Example: If API item A has a link in it's documentation to API item B, then B must not
* have ApiTag.Internal.
* have ReleaseTag.Internal.
*/

@@ -109,11 +111,11 @@ incompleteLinks: ICodeLinkElement[];

* after the basic documentation for all API items is complete. We save the processing for after
* because we need ApiTag information before we can deem an inheritdoc token as valid.
* because we need ReleaseTag information before we can deem an inheritdoc token as valid.
*/
incompleteInheritdocs: Token[];
/**
* An "API Tag" is a custom JSDoc tag which indicates whether this definition
* A "release tag" is an AEDoc tag which indicates whether this definition
* is considered Public API for third party developers, as well as its release
* stage (alpha, beta, etc).
*/
apiTag: ApiTag;
releaseTag: ReleaseTag;
/**

@@ -169,4 +171,4 @@ * True if the "@preapproved" tag was specified.

private _completeInheritdocs(warnings);
private _reportBadJSDocTag(token);
private _reportBadAedocTag(token);
private _checkInheritDocStatus();
}

@@ -9,3 +9,3 @@ /* tslint:disable:no-bitwise */

/**
* An "API Tag" is a custom JSDoc tag which indicates whether an ApiItem definition
* A "release tag" is an AEDoc tag which indicates whether an ApiItem definition
* is considered Public API for third party developers, as well as its release

@@ -16,32 +16,34 @@ * stage (alpha, beta, etc).

*/
var ApiTag;
(function (ApiTag) {
var ReleaseTag;
(function (ReleaseTag) {
/**
* No API Tag was specified in the JSDoc summary.
* No release tag was specified in the AEDoc summary.
*/
ApiTag[ApiTag["None"] = 0] = "None";
ReleaseTag[ReleaseTag["None"] = 0] = "None";
/**
* The API was documented as internal, i.e. not callable by third party developers.
* Indicates that an API item is meant only for usage by other NPM packages from the same
* maintainer. Third parties should never use "internal" APIs. (To emphasize this, their
* names are prefixed by underscores.)
*/
ApiTag[ApiTag["Internal"] = 1] = "Internal";
ReleaseTag[ReleaseTag["Internal"] = 1] = "Internal";
/**
* The API was documented as "alpha." This status is not generally used. See the
* ApiPrinciplesAndProcess.md for details.
* Indicates that an API item is eventually intended to be public, but currently is in an
* early stage of development. Third parties should not use "alpha" APIs.
*/
ApiTag[ApiTag["Alpha"] = 2] = "Alpha";
ReleaseTag[ReleaseTag["Alpha"] = 2] = "Alpha";
/**
* The API was documented as callable by third party developers, but at their own risk.
* Web parts that call beta APIs should only be used for experimentation, because the Web Part
* will break if Microsoft changes the API signature later.
* Indicates that an API item has been released in an experimental state. Third parties are
* encouraged to try it and provide feedback. However, a "beta" API should NOT be used
* in production.
*/
ApiTag[ApiTag["Beta"] = 3] = "Beta";
ReleaseTag[ReleaseTag["Beta"] = 3] = "Beta";
/**
* The API was documented as callable by third party developers, with a guarantee that Microsoft will
* never make any breaking changes once the API is published.
* Indicates that an API item has been officially released. It is part of the supported
* contract (e.g. SemVer) for a package.
*/
ApiTag[ApiTag["Public"] = 4] = "Public";
})(ApiTag = exports.ApiTag || (exports.ApiTag = {}));
ReleaseTag[ReleaseTag["Public"] = 4] = "Public";
})(ReleaseTag = exports.ReleaseTag || (exports.ReleaseTag = {}));
var ApiDocumentation = (function () {
function ApiDocumentation(docComment, referenceResolver, extractor, errorLogger, warnings) {
this.originalJsDoc = docComment;
this.originalAedoc = docComment;
this.referenceResolver = referenceResolver;

@@ -71,6 +73,6 @@ this.extractor = extractor;

this.incompleteInheritdocs = [];
this.apiTag = ApiTag.None;
var tokenizer = new Tokenizer_1.default(this.originalJsDoc, this.reportError);
this.releaseTag = ReleaseTag.None;
var tokenizer = new Tokenizer_1.default(this.originalAedoc, this.reportError);
this.summary = DocElementParser_1.default.parse(this, tokenizer);
var apiTagCount = 0;
var releaseTagCount = 0;
var parsing = true;

@@ -114,3 +116,3 @@ while (parsing) {

if (!this.deprecatedMessage || this.deprecatedMessage.length === 0) {
this.reportError("deprecated description required after @deprecated JSDoc tag.");
this.reportError("deprecated description required after @deprecated AEDoc tag.");
}

@@ -125,19 +127,19 @@ break;

tokenizer.getToken();
this.apiTag = ApiTag.Public;
++apiTagCount;
this.releaseTag = ReleaseTag.Public;
++releaseTagCount;
break;
case '@internal':
tokenizer.getToken();
this.apiTag = ApiTag.Internal;
++apiTagCount;
this.releaseTag = ReleaseTag.Internal;
++releaseTagCount;
break;
case '@alpha':
tokenizer.getToken();
this.apiTag = ApiTag.Alpha;
++apiTagCount;
this.releaseTag = ReleaseTag.Alpha;
++releaseTagCount;
break;
case '@beta':
tokenizer.getToken();
this.apiTag = ApiTag.Beta;
++apiTagCount;
this.releaseTag = ReleaseTag.Beta;
++releaseTagCount;
break;

@@ -158,3 +160,3 @@ case '@preapproved':

tokenizer.getToken();
this._reportBadJSDocTag(token);
this._reportBadAedocTag(token);
}

@@ -172,3 +174,3 @@ }

tokenizer.getToken();
this._reportBadJSDocTag(token);
this._reportBadAedocTag(token);
break;

@@ -185,3 +187,3 @@ }

}
this.reportError("Unexpected text in JSDoc comment: \"" + problemText + "\"");
this.reportError("Unexpected text in AEDoc comment: \"" + problemText + "\"");
}

@@ -194,6 +196,6 @@ else {

}
if (apiTagCount > 1) {
this.reportError('More than one API Tag was specified');
if (releaseTagCount > 1) {
this.reportError('More than one release tag was specified');
}
if (this.preapproved && this.apiTag !== ApiTag.Internal) {
if (this.preapproved && this.releaseTag !== ReleaseTag.Internal) {
this.reportError('The @preapproved tag may only be applied to @internal defintions');

@@ -250,3 +252,3 @@ this.preapproved = false;

// undefined and an error will have been reported via this.reportError
if (resolvedApiItem && resolvedApiItem.apiTag === ApiTag.Internal) {
if (resolvedApiItem && resolvedApiItem.releaseTag === ReleaseTag.Internal) {
this.reportError('Unable to link to \"Internal\" API item');

@@ -266,18 +268,18 @@ }

};
ApiDocumentation.prototype._reportBadJSDocTag = function (token) {
var supportsRegular = ApiDocumentation._allowedRegularJsdocTags.indexOf(token.tag) >= 0;
var supportsInline = ApiDocumentation._allowedInlineJsdocTags.indexOf(token.tag) >= 0;
ApiDocumentation.prototype._reportBadAedocTag = function (token) {
var supportsRegular = ApiDocumentation._allowedRegularAedocTags.indexOf(token.tag) >= 0;
var supportsInline = ApiDocumentation._allowedInlineAedocTags.indexOf(token.tag) >= 0;
if (!supportsRegular && !supportsInline) {
this.reportError("Unknown JSDoc tag \"" + token.tag + "\"");
this.reportError("Unknown AEDoc tag \"" + token.tag + "\"");
return;
}
if (token.type === Token_1.TokenType.Inline && !supportsInline) {
this.reportError("The JSDoc tag \"" + token.tag + "\" must not use the non-inline syntax (no curly braces)");
this.reportError("The AEDoc tag \"" + token.tag + "\" must not use the non-inline syntax (no curly braces)");
return;
}
if (token.type === Token_1.TokenType.Tag && !supportsRegular) {
this.reportError("The JSDoc tag \"" + token.tag + "\" must use the inline syntax (with curly braces)");
this.reportError("The AEDoc tag \"" + token.tag + "\" must use the inline syntax (with curly braces)");
return;
}
this.reportError("The JSDoc tag \"" + token.tag + "\" is not supported in this context");
this.reportError("The AEDoc tag \"" + token.tag + "\" is not supported in this context");
return;

@@ -287,3 +289,3 @@ };

if (this.isDocInherited) {
this.reportError('Cannot provide additional JSDoc tags if @inheritdoc tag is present');
this.reportError('Cannot provide additional AEDoc tags if @inheritdoc tag is present');
}

@@ -294,10 +296,9 @@ };

/**
* Match JsDoc block tags and inline tags
* Match AEDoc block tags and inline tags
* Example "@a @b@c d@e @f {whatever} {@link a} { @something } \@g" => ["@a", "@f", "{@link a}", "{ @something }"]
*/
ApiDocumentation._jsdocTagsRegex = /{\s*@(\\{|\\}|[^{}])*}|(?:^|\s)(\@[a-z_]+)(?=\s|$)/gi;
// For guidance about using these tags, please see this document:
// https://onedrive.visualstudio.com/DefaultCollection/SPPPlat/_git/sp-client
// ?path=/common/docs/ApiPrinciplesAndProcess.md
ApiDocumentation._allowedRegularJsdocTags = [
ApiDocumentation._aedocTagsRegex = /{\s*@(\\{|\\}|[^{}])*}|(?:^|\s)(\@[a-z_]+)(?=\s|$)/gi;
// For guidance about using these tags, please see this documentation:
// https://github.com/Microsoft/web-build-tools/wiki/API-Extractor-~-AEDoc-tags
ApiDocumentation._allowedRegularAedocTags = [
// (alphabetical order)

@@ -314,3 +315,2 @@ '@alpha',

'@see',
'@summary',
'@deprecated',

@@ -320,3 +320,3 @@ '@readonly',

];
ApiDocumentation._allowedInlineJsdocTags = [
ApiDocumentation._allowedInlineAedocTags = [
// (alphabetical order)

@@ -323,0 +323,0 @@ '@inheritdoc',

@@ -154,6 +154,6 @@ import * as ts from 'typescript';

/**
* Indicates that this ApiItem does not have adequate JSDoc comments. If shouldHaveDocumentation()=true,
* and there is less than 10 characters of summary text in the JSDoc, then this will be set to true and
* Indicates that this ApiItem does not have adequate AEDoc comments. If shouldHaveDocumentation()=true,
* and there is less than 10 characters of summary text in the AEDoc, then this will be set to true and
* noted in the API file produced by ApiFileGenerator.
* (The JSDoc text itself is not included in that report, because documentation
* (The AEDoc text itself is not included in that report, because documentation
* changes do not require an API review, and thus should not cause a diff for that report.)

@@ -160,0 +160,0 @@ */

@@ -9,3 +9,2 @@ /* tslint:disable:no-bitwise */

var DocElementParser_1 = require("../DocElementParser");
var PackageJsonHelpers_1 = require("../PackageJsonHelpers");
var ApiDefinitionReference_1 = require("../ApiDefinitionReference");

@@ -141,7 +140,7 @@ /**

this.name = this.exportSymbol.name || '???';
var originalJsDoc = '';
var originalJsdoc = '';
if (this.jsdocNode) {
originalJsDoc = TypeScriptHelpers_1.default.getJsDocComments(this.jsdocNode, this.reportError);
originalJsdoc = TypeScriptHelpers_1.default.getJsdocComments(this.jsdocNode, this.reportError);
}
this.documentation = new ApiDocumentation_1.default(originalJsDoc, this.extractor.docItemLoader, this.extractor, this.reportError, this.warnings);
this.documentation = new ApiDocumentation_1.default(originalJsdoc, this.extractor.docItemLoader, this.extractor, this.reportError, this.warnings);
}

@@ -231,4 +230,4 @@ /**

if (this.kind === ApiItemKind.Package) {
if (this.documentation.apiTag !== ApiDocumentation_1.ApiTag.None) {
var tag = '@' + ApiDocumentation_1.ApiTag[this.documentation.apiTag].toLowerCase();
if (this.documentation.releaseTag !== ApiDocumentation_1.ReleaseTag.None) {
var tag = '@' + ApiDocumentation_1.ReleaseTag[this.documentation.releaseTag].toLowerCase();
this.reportError("The " + tag + " tag is not allowed on the package, which is always public");

@@ -347,3 +346,4 @@ }

// Example: "c:\users\<username>\sp-client\spfx-core\sp-core-library"
var typeReferencePackagePath = PackageJsonHelpers_1.default.tryFindPackagePathUpwards(sourceFile.path);
var typeReferencePackagePath = this.extractor.packageJsonLookup
.tryFindPackagePathUpwards(sourceFile.path);
// Example: "@microsoft/sp-core-library"

@@ -357,3 +357,4 @@ var typeReferencePackageName = '';

else {
typeReferencePackageName = PackageJsonHelpers_1.default.readPackageName(typeReferencePackagePath);
typeReferencePackageName = this.extractor.packageJsonLookup
.readPackageName(typeReferencePackagePath);
typingsScopeNames.every(function (typingScopeName) {

@@ -360,0 +361,0 @@ if (typeReferencePackageName.indexOf(typingScopeName) > -1) {

@@ -75,13 +75,13 @@ /* tslint:disable:no-bitwise */

// the VariableDeclarationList exists within a VariableStatement and
// this is where the JsDoc comment Node exists.
// this is where the JSDoc comment Node exists.
// If there is no parent or grandparent of this VariableDeclartion then
// we do not know how to obtain the JsDoc comment.
var jsDocNode = void 0;
// we do not know how to obtain the JSDoc comment.
var jsdocNode = void 0;
if (!declaration.parent || !declaration.parent.parent ||
declaration.parent.parent.kind !== ts.SyntaxKind.VariableStatement) {
_this.reportWarning("Export \"" + exportSymbol.name + "\" expected to have a 'grand' parent " +
'"VariableStatement" in order to obtain JsDoc comment');
'"VariableStatement" in order to obtain JSDoc comment');
}
else {
jsDocNode = declaration.parent.parent;
jsdocNode = declaration.parent.parent;
}

@@ -92,3 +92,3 @@ var exportMemberOptions = {

declarationSymbol: followedSymbol,
jsdocNode: jsDocNode,
jsdocNode: jsdocNode,
exportSymbol: exportSymbol

@@ -95,0 +95,0 @@ };

@@ -22,3 +22,2 @@ /* tslint:disable:no-bitwise */

var TypeScriptHelpers_1 = require("../TypeScriptHelpers");
var PackageJsonHelpers_1 = require("../PackageJsonHelpers");
/**

@@ -35,3 +34,3 @@ * This class is part of the ApiItem abstract syntax tree. It represents the top-level

// The scoped package name. (E.g. "@microsoft/api-extractor")
_this.name = PackageJsonHelpers_1.default.readPackageName(_this.extractor.packageFolder);
_this.name = _this.extractor.packageJsonLookup.readPackageName(_this.extractor.packageFolder);
var exportSymbols = _this.typeChecker.getExportsOfModule(_this.declarationSymbol);

@@ -38,0 +37,0 @@ if (exportSymbols) {

@@ -154,3 +154,3 @@ /* tslint:disable:no-bitwise */

// Throw an error for duplicate names, because we use names as identifiers
// @todo #261549 Define a JsDoc tag to allow defining an identifier for overloaded methods eg. @overload method2
// @todo #261549 Define an AEDoc tag to allow defining an identifier for overloaded methods eg. @overload method2
return;

@@ -157,0 +157,0 @@ }

@@ -47,20 +47,17 @@ /// <reference types="mocha" />

*/
chai_1.assert.equal(capturedErrors.length, 10);
chai_1.assert.equal(capturedErrors[0].message, 'Cannot provide summary in JsDoc if @inheritdoc tag is given');
chai_1.assert.equal(capturedErrors[1].message, 'The JSDoc tag "@summary" is not supported in this context');
chai_1.assert.equal(capturedErrors[2].message, 'Unexpected text in JSDoc comment: "Mock class for testing JsDoc parser"');
chai_1.assert.equal(capturedErrors[3].message, 'Unknown JSDoc tag "@badJsDocTag"');
chai_1.assert.equal(capturedErrors[4].message, 'Unknown tag name for inline tag.');
chai_1.assert.equal(capturedErrors[5].message, 'Too few parameters for @link inline tag.');
chai_1.assert.equal(capturedErrors[6].message, 'Unexpected text in JSDoc comment: "can not contain a tag"');
chai_1.assert.equal(capturedErrors[7].message, 'More than one API Tag was specified');
chai_1.assert.equal(capturedErrors[8].message, 'API reference expression must be of the form: \'scopeName/packageName:exportName.memberName ' +
'| display text\'where the \'|\' is required if a display text is provided');
chai_1.assert.equal(capturedErrors[9].message, 'inheritdoc source item is deprecated. Must provide @deprecated message or remove @inheritdoc inline tag.');
chai_1.assert.equal(capturedErrors.length, 8);
chai_1.assert.equal(capturedErrors[0].message, 'Cannot provide summary in AEDoc if @inheritdoc tag is given');
chai_1.assert.equal(capturedErrors[1].message, 'Unknown AEDoc tag "@badAedocTag"');
chai_1.assert.equal(capturedErrors[2].message, 'Unknown tag name for inline tag.');
chai_1.assert.equal(capturedErrors[3].message, 'Too few parameters for @link inline tag.');
chai_1.assert.equal(capturedErrors[4].message, 'Unexpected text in AEDoc comment: "can not contain a tag"');
chai_1.assert.equal(capturedErrors[5].message, 'More than one release tag was specified');
chai_1.assert.equal(capturedErrors[6].message, 'An API item reference must use the notation: "@scopeName/packageName:exportName.memberName"');
chai_1.assert.equal(capturedErrors[7].message, 'inheritdoc source item is deprecated. Must provide @deprecated message or remove @inheritdoc inline tag.');
});
it('Should parse API tag', function () {
var expecedApiTag = ApiDocumentation_1.ApiTag.Public;
it('Should parse release tag', function () {
var expectedReleaseTag = ApiDocumentation_1.ReleaseTag.Public;
var actualDoc = myDocumentedClass ? myDocumentedClass.documentation : undefined;
chai_1.assert.isObject(actualDoc);
chai_1.assert.equal(actualDoc.apiTag, expecedApiTag);
chai_1.assert.equal(actualDoc.releaseTag, expectedReleaseTag);
});

@@ -67,0 +64,0 @@ });

@@ -64,3 +64,3 @@ "use strict";

if (docElements.length > 0 || documentation.summary.length > 0) {
documentation.reportError('Cannot provide summary in JsDoc if @inheritdoc tag is given');
documentation.reportError('Cannot provide summary in AEDoc if @inheritdoc tag is given');
}

@@ -67,0 +67,0 @@ documentation.incompleteInheritdocs.push(token);

@@ -82,3 +82,3 @@ {

"kind": "textDocElement",
"value": "JSDOc for AliasClass"
"value": "AEDoc for AliasClass"
}

@@ -85,0 +85,0 @@ ],

@@ -132,3 +132,3 @@ {

"kind": "textDocElement",
"value": "This is a class to test JsDoc parser and this is description that can span to multiple lines and we need to make sure we parse this block correctly. It can contain a"
"value": "This is a class to test AEDoc parser and this is description that can span to multiple lines and we need to make sure we parse this block correctly. It can contain a"
},

@@ -146,3 +146,8 @@ {

],
"remarks": [],
"remarks": [
{
"kind": "textDocElement",
"value": "Mock class for testing JsDoc parser"
}
],
"isBeta": false,

@@ -149,0 +154,0 @@ "members": {

import * as ts from 'typescript';
import ApiPackage from './definitions/ApiPackage';
import DocItemLoader from './DocItemLoader';
import PackageJsonLookup from './PackageJsonLookup';
export declare type ApiErrorHandler = (message: string, fileName: string, lineNumber: number) => void;

@@ -44,3 +45,3 @@ /**

export default class Extractor {
errorHandler: ApiErrorHandler;
readonly errorHandler: ApiErrorHandler;
typeChecker: ts.TypeChecker;

@@ -52,3 +53,4 @@ package: ApiPackage;

*/
docItemLoader: DocItemLoader;
readonly docItemLoader: DocItemLoader;
readonly packageJsonLookup: PackageJsonLookup;
private _compilerOptions;

@@ -55,0 +57,0 @@ private _packageFolder;

@@ -8,3 +8,3 @@ "use strict";

var DocItemLoader_1 = require("./DocItemLoader");
var PackageJsonHelpers_1 = require("./PackageJsonHelpers");
var PackageJsonLookup_1 = require("./PackageJsonLookup");
/**

@@ -19,2 +19,3 @@ * The main entry point for the "api-extractor" utility. The Analyzer object invokes the

this.docItemLoader = new DocItemLoader_1.default(options.compilerOptions.rootDir);
this.packageJsonLookup = new PackageJsonLookup_1.default();
this.errorHandler = options.errorHandler || Extractor.defaultErrorHandler;

@@ -59,3 +60,3 @@ }

// This is guaranteed to succeed since we do check prior to this point
this._packageFolder = PackageJsonHelpers_1.default.tryFindPackagePathUpwards(currentPath);
this._packageFolder = this.packageJsonLookup.tryFindPackagePathUpwards(currentPath);
this.package = new ApiPackage_1.default(this, rootFile); // construct members

@@ -62,0 +63,0 @@ this.package.completeInitialization(); // creates ApiDocumentation

@@ -56,9 +56,9 @@ import Extractor from '../Extractor';

/**
* Writes a synopsis of the JSDoc comments, which indicates the API tag,
* Writes a synopsis of the AEDoc comments, which indicates the release tag,
* whether the item has been documented, and any warnings that were detected
* by the Analzer.
* by the analysis.
*/
private _writeJsdocSynopsis(apiItem);
private _writeAedocSynopsis(apiItem);
private _writeWarnings(apiItem);
private _writeLinesAsComments(lines);
}

@@ -75,3 +75,3 @@ "use strict";

if (apiStructuredType.kind !== ApiItem_1.ApiItemKind.TypeLiteral) {
this._writeJsdocSynopsis(apiStructuredType);
this._writeAedocSynopsis(apiStructuredType);
}

@@ -95,3 +95,3 @@ this._indentedWriter.writeLine(declarationLine + ' {');

var _this = this;
this._writeJsdocSynopsis(apiEnum);
this._writeAedocSynopsis(apiEnum);
this._indentedWriter.writeLine("enum " + apiEnum.name + " {");

@@ -108,3 +108,3 @@ this._indentedWriter.indentScope(function () {

ApiFileGenerator.prototype.visitApiEnumValue = function (apiEnumValue) {
this._writeJsdocSynopsis(apiEnumValue);
this._writeAedocSynopsis(apiEnumValue);
this._indentedWriter.write(apiEnumValue.getDeclarationLine());

@@ -119,7 +119,7 @@ };

}
this._writeJsdocSynopsis(apiPackage);
this._writeAedocSynopsis(apiPackage);
};
ApiFileGenerator.prototype.visitApiNamespace = function (apiNamespace) {
var _this = this;
this._writeJsdocSynopsis(apiNamespace);
this._writeAedocSynopsis(apiNamespace);
// We have decided to call the apiNamespace a 'module' in our

@@ -139,3 +139,3 @@ // public API documentation.

ApiFileGenerator.prototype.visitApiModuleVariable = function (apiModuleVariable) {
this._writeJsdocSynopsis(apiModuleVariable);
this._writeAedocSynopsis(apiModuleVariable);
this._indentedWriter.write(apiModuleVariable.name + ": " + apiModuleVariable.type + " = " + apiModuleVariable.value + ";");

@@ -145,3 +145,3 @@ };

if (apiMember.documentation) {
this._writeJsdocSynopsis(apiMember);
this._writeAedocSynopsis(apiMember);
}

@@ -156,3 +156,3 @@ this._indentedWriter.write(apiMember.getDeclarationLine());

ApiFileGenerator.prototype.visitApiFunction = function (apiFunction) {
this._writeJsdocSynopsis(apiFunction);
this._writeAedocSynopsis(apiFunction);
this._indentedWriter.write(apiFunction.getDeclarationLine());

@@ -164,7 +164,7 @@ };

/**
* Writes a synopsis of the JSDoc comments, which indicates the API tag,
* Writes a synopsis of the AEDoc comments, which indicates the release tag,
* whether the item has been documented, and any warnings that were detected
* by the Analzer.
* by the analysis.
*/
ApiFileGenerator.prototype._writeJsdocSynopsis = function (apiItem) {
ApiFileGenerator.prototype._writeAedocSynopsis = function (apiItem) {
this._writeWarnings(apiItem);

@@ -177,13 +177,13 @@ var lines = [];

var footer = '';
switch (apiItem.documentation.apiTag) {
case ApiDocumentation_1.ApiTag.Internal:
switch (apiItem.documentation.releaseTag) {
case ApiDocumentation_1.ReleaseTag.Internal:
footer += '@internal';
break;
case ApiDocumentation_1.ApiTag.Alpha:
case ApiDocumentation_1.ReleaseTag.Alpha:
footer += '@alpha';
break;
case ApiDocumentation_1.ApiTag.Beta:
case ApiDocumentation_1.ReleaseTag.Beta:
footer += '@beta';
break;
case ApiDocumentation_1.ApiTag.Public:
case ApiDocumentation_1.ReleaseTag.Public:
footer += '@public';

@@ -190,0 +190,0 @@ break;

@@ -40,6 +40,6 @@ "use strict";

ApiJsonGenerator.prototype.visit = function (apiItem, refObject) {
switch (apiItem.documentation.apiTag) {
case ApiDocumentation_1.ApiTag.None:
case ApiDocumentation_1.ApiTag.Beta:
case ApiDocumentation_1.ApiTag.Public:
switch (apiItem.documentation.releaseTag) {
case ApiDocumentation_1.ReleaseTag.None:
case ApiDocumentation_1.ReleaseTag.Beta:
case ApiDocumentation_1.ReleaseTag.Public:
break;

@@ -80,3 +80,3 @@ default:

remarks: apiStructuredType.documentation.remarks || [],
isBeta: apiStructuredType.documentation.apiTag === ApiDocumentation_1.ApiTag.Beta
isBeta: apiStructuredType.documentation.releaseTag === ApiDocumentation_1.ReleaseTag.Beta
};

@@ -106,3 +106,3 @@ refObject[apiStructuredType.name] = structureNode;

remarks: apiEnum.documentation.remarks || [],
isBeta: apiEnum.documentation.apiTag === ApiDocumentation_1.ApiTag.Beta
isBeta: apiEnum.documentation.releaseTag === ApiDocumentation_1.ReleaseTag.Beta
};

@@ -129,3 +129,3 @@ refObject[apiEnum.name] = enumNode;

remarks: apiEnumValue.documentation.remarks || [],
isBeta: apiEnumValue.documentation.apiTag === ApiDocumentation_1.ApiTag.Beta
isBeta: apiEnumValue.documentation.releaseTag === ApiDocumentation_1.ReleaseTag.Beta
};

@@ -152,3 +152,3 @@ };

remarks: apiFunction.documentation.remarks || [],
isBeta: apiFunction.documentation.apiTag === ApiDocumentation_1.ApiTag.Beta
isBeta: apiFunction.documentation.releaseTag === ApiDocumentation_1.ReleaseTag.Beta
};

@@ -184,3 +184,3 @@ refObject[apiFunction.name] = newNode;

remarks: apiNamespace.documentation.remarks || [],
isBeta: apiNamespace.documentation.apiTag === ApiDocumentation_1.ApiTag.Beta,
isBeta: apiNamespace.documentation.releaseTag === ApiDocumentation_1.ReleaseTag.Beta,
exports: membersNode

@@ -212,3 +212,3 @@ };

remarks: apiProperty.documentation.remarks || [],
isBeta: apiProperty.documentation.apiTag === ApiDocumentation_1.ApiTag.Beta
isBeta: apiProperty.documentation.releaseTag === ApiDocumentation_1.ReleaseTag.Beta
};

@@ -225,3 +225,3 @@ refObject[apiProperty.name] = newNode;

remarks: apiModuleVariable.documentation.remarks || [],
isBeta: apiModuleVariable.documentation.apiTag === ApiDocumentation_1.ApiTag.Beta
isBeta: apiModuleVariable.documentation.releaseTag === ApiDocumentation_1.ReleaseTag.Beta
};

@@ -265,3 +265,3 @@ refObject[apiModuleVariable.name] = newNode;

remarks: apiMethod.documentation.remarks || [],
isBeta: apiMethod.documentation.apiTag === ApiDocumentation_1.ApiTag.Beta
isBeta: apiMethod.documentation.releaseTag === ApiDocumentation_1.ReleaseTag.Beta
};

@@ -268,0 +268,0 @@ }

@@ -50,4 +50,4 @@ /// <reference types="mocha" />

chai_1.assert.equal(capturedErrors.length, 2);
chai_1.assert.equal(capturedErrors[0].message, 'Unknown JSDoc tag "@badjsdoctag"');
chai_1.assert.equal(capturedErrors[1].message, 'Unexpected text in JSDoc comment: '
chai_1.assert.equal(capturedErrors[0].message, 'Unknown AEDoc tag "@badAedocTag"');
chai_1.assert.equal(capturedErrors[1].message, 'Unexpected text in AEDoc comment: '
+ '"(Error #1 is the bad tag) Text can no..."');

@@ -54,0 +54,0 @@ });

import ApiItem, { ApiItemKind } from './definitions/ApiItem';
import { ApiTag } from './definitions/ApiDocumentation';
import { ReleaseTag } from './definitions/ApiDocumentation';
import { IDocElement, IParam } from './IDocElement';

@@ -14,3 +14,3 @@ import { IDocItem } from './IDocItem';

deprecatedMessage: IDocElement[];
apiTag: ApiTag;
releaseTag: ReleaseTag;
isBeta: boolean;

@@ -35,3 +35,3 @@ params: {

static createFromJson(docItem: IDocItem): ResolvedApiItem;
private constructor(kind, summary, remarks, deprecatedMessage, isBeta, params, returnsMessage, apiTag, apiItem);
private constructor(kind, summary, remarks, deprecatedMessage, isBeta, params, returnsMessage, releaseTag, apiItem);
}

@@ -10,3 +10,3 @@ "use strict";

var ResolvedApiItem = (function () {
function ResolvedApiItem(kind, summary, remarks, deprecatedMessage, isBeta, params, returnsMessage, apiTag, apiItem) {
function ResolvedApiItem(kind, summary, remarks, deprecatedMessage, isBeta, params, returnsMessage, releaseTag, apiItem) {
this.kind = kind;

@@ -19,3 +19,3 @@ this.summary = summary;

this.returnsMessage = returnsMessage;
this.apiTag = apiTag;
this.releaseTag = releaseTag;
this.apiItem = apiItem;

@@ -28,3 +28,3 @@ }

ResolvedApiItem.createFromApiItem = function (apiItem) {
return new ResolvedApiItem(apiItem.kind, apiItem.documentation.summary, apiItem.documentation.remarks, apiItem.documentation.deprecatedMessage, apiItem.documentation.apiTag === ApiDocumentation_1.ApiTag.Beta, apiItem.documentation.parameters, apiItem.documentation.returnsMessage, apiItem.documentation.apiTag, apiItem);
return new ResolvedApiItem(apiItem.kind, apiItem.documentation.summary, apiItem.documentation.remarks, apiItem.documentation.deprecatedMessage, apiItem.documentation.releaseTag === ApiDocumentation_1.ReleaseTag.Beta, apiItem.documentation.parameters, apiItem.documentation.returnsMessage, apiItem.documentation.releaseTag, apiItem);
};

@@ -50,3 +50,3 @@ /**

}
return new ResolvedApiItem(ApiJsonFile_1.default.convertJsonToKind(docItem.kind), docItem.summary, docItem.remarks, docItem.deprecatedMessage, docItem.isBeta, parameters, returnsMessage, ApiDocumentation_1.ApiTag.Public, undefined);
return new ResolvedApiItem(ApiJsonFile_1.default.convertJsonToKind(docItem.kind), docItem.summary, docItem.remarks, docItem.deprecatedMessage, docItem.isBeta, parameters, returnsMessage, ApiDocumentation_1.ReleaseTag.Public, undefined);
};

@@ -53,0 +53,0 @@ return ResolvedApiItem;

@@ -27,2 +27,8 @@ /// <reference types="mocha" />

}
function clearCapturedErrors() {
capturedErrors = [];
}
function assertCapturedErrors(expectedMessages) {
chai_1.assert.deepEqual(capturedErrors.map(function (x) { return x.message; }), expectedMessages, 'The captured errors did not match the expected output.');
}
var inputFolder = './testInputs/example2';

@@ -67,2 +73,3 @@ var myDocumentedClass;

it('Should parse basic doc comment stream', function () {
clearCapturedErrors();
var apiDoc = new TestApiDocumentation();

@@ -118,4 +125,6 @@ var docs = 'This function parses docTokens for the apiLint website ' +

TestFileComparer_1.default.assertFileMatchesExpected('./lib/paramDocActual.json', './lib/paramDocExpected.json');
assertCapturedErrors([]);
});
it('Should parse @deprecated correctly', function () {
clearCapturedErrors();
var docs = '@deprecated - description of the deprecation';

@@ -132,4 +141,6 @@ var tokenizer = new Tokenizer_1.default(docs, console.log);

TestFileComparer_1.default.assertFileMatchesExpected('./lib/deprecatedDocActual.json', './lib/deprecatedDocExpected.json');
assertCapturedErrors([]);
});
it('Should parse @see with nested link and/or text', function () {
clearCapturedErrors();
var docs = 'Text describing the function’s purpose/nuances/context. \n' +

@@ -157,4 +168,6 @@ '@see {@link https://github.com/OfficeDev/office-ui-fabric-react | The link will provide context}';

TestFileComparer_1.default.assertFileMatchesExpected('./lib/seeDocExpected.json', './lib/seeDocActual.json');
assertCapturedErrors([]);
});
it('Should parse @param with nested link and/or text', function () {
clearCapturedErrors();
var apiDoc = new TestApiDocumentation();

@@ -183,4 +196,6 @@ // Don't include the "@param" in the doc string, parseParam() expects this to be processed in a

TestFileComparer_1.default.assertFileMatchesExpected('./lib/nestedParamDocActual.json', './lib/nestedParamDocExpected.json');
assertCapturedErrors([]);
});
it('Should parse @link with url', function () {
clearCapturedErrors();
var docs = '{@link https://microsoft.com}';

@@ -202,4 +217,6 @@ var tokenizer = new Tokenizer_1.default(docs, console.log);

chai_1.assert.equal(linkDocElement.value, '');
assertCapturedErrors([]);
});
it('Should parse @link with url and text', function () {
clearCapturedErrors();
var docs = '{@link https://microsoft.com | microsoft home}';

@@ -221,4 +238,22 @@ var tokenizer = new Tokenizer_1.default(docs, console.log);

chai_1.assert.equal(linkDocElement.value, 'microsoft home');
assertCapturedErrors([]);
});
it('Should reject @link with missing pipe', function () {
clearCapturedErrors();
var docs = '{@link https://microsoft.com microsoft home}';
var tokenizer = new Tokenizer_1.default(docs, console.log);
var docElements;
/* tslint:disable-next-line:no-any */
var errorMessage;
try {
docElements = DocElementParser_1.default.parse(myDocumentedClass.documentation, tokenizer);
}
catch (error) {
errorMessage = error;
}
chai_1.assert.isUndefined(errorMessage);
assertCapturedErrors(['Invalid @link parameter, url must be a single string.']);
});
it('Should parse @link with API defintion reference', function () {
clearCapturedErrors();
var docs = '{@link @microsoft/sp-core-library:Guid.equals}';

@@ -242,4 +277,6 @@ var tokenizer = new Tokenizer_1.default(docs, console.log);

chai_1.assert.equal(linkDocElement.memberName, 'equals');
assertCapturedErrors([]);
});
it('Should parse @link with API defintion reference and text', function () {
clearCapturedErrors();
var docs = '{@link @microsoft/sp-core-library:Guid.equals | Guid equals}';

@@ -264,4 +301,6 @@ var tokenizer = new Tokenizer_1.default(docs, console.log);

chai_1.assert.equal(linkDocElement.value, 'Guid equals');
assertCapturedErrors([]);
});
it('Should report errors @link', function () {
clearCapturedErrors();
var docs = '{@link @microsoft/sp-core-library:Guid.equals | Guid equals | something}';

@@ -279,2 +318,3 @@ var tokenizer = new Tokenizer_1.default(docs, console.log);

chai_1.assert.isNotNull(errorMessage);
assertCapturedErrors(['Invalid @link parameters, at most one pipe character allowed.']);
});

@@ -281,0 +321,0 @@ });

@@ -23,3 +23,3 @@ /// <reference types="mocha" />

it('degenerate comment', function () {
chai_1.assert.equal(TypeScriptHelpers_1.default.removeJsDocSequences(['/**', '* degenerate comment', 'star missing here', '* end of comment', '*/']), 'degenerate comment\nstar missing here\nend of comment');
chai_1.assert.equal(TypeScriptHelpers_1.default.removeJsdocSequences(['/**', '* degenerate comment', 'star missing here', '* end of comment', '*/']), 'degenerate comment\nstar missing here\nend of comment');
});

@@ -26,0 +26,0 @@ });

@@ -25,3 +25,3 @@ /**

/**
* A structured object created from a doc comment string within a JSDoc comment block.
* A structured object created from a doc comment string within an AEDoc comment block.
*/

@@ -28,0 +28,0 @@ export default class Token {

@@ -28,3 +28,3 @@ "use strict";

/**
* A structured object created from a doc comment string within a JSDoc comment block.
* A structured object created from a doc comment string within an AEDoc comment block.
*/

@@ -31,0 +31,0 @@ var Token = (function () {

import Token from './Token';
/**
* Handles the tokenization of a JSDoc comment.
* Handles the tokenization of an AEDoc comment.
*/
export default class Tokenizer {
/**
* Match JsDoc block tags and inline tags
* Match AEDoc block tags and inline tags
* Example "@a @b@c d@e @f {whatever} {@link a} { @something } \@g" => ["@a", "@f", "{@link a}", "{ @something }"]
*/
private static _jsdocTagsRegex;
private static _aedocTagsRegex;
/**

@@ -20,7 +20,7 @@ * List of Tokens that have been tokenized.

* can be processed more strictly.
* Example: "This is a JsDoc description with a {@link URL} and more text. \@summary example \@public"
* Example: "This is an AEDoc description with a {@link URL} and more text. \@remarks example \@public"
* => [
* {tokenType: 'text', parameter: 'This is a JsDoc description with a'},
* {tokenType: 'text', parameter: 'This is an AEDoc description with a'},
* {tokenType: '@link', parameter: 'URL'},
* {tokenType: '\@summary', parameter: ''},
* {tokenType: '\@remarks', parameter: ''},
* {tokenType: 'text', parameter: 'example'},

@@ -27,0 +27,0 @@ * {tokenType: '\@public', parameter: ''}

@@ -6,3 +6,3 @@ "use strict";

/**
* Handles the tokenization of a JSDoc comment.
* Handles the tokenization of an AEDoc comment.
*/

@@ -17,7 +17,7 @@ var Tokenizer = (function () {

* can be processed more strictly.
* Example: "This is a JsDoc description with a {@link URL} and more text. \@summary example \@public"
* Example: "This is an AEDoc description with a {@link URL} and more text. \@remarks example \@public"
* => [
* {tokenType: 'text', parameter: 'This is a JsDoc description with a'},
* {tokenType: 'text', parameter: 'This is an AEDoc description with a'},
* {tokenType: '@link', parameter: 'URL'},
* {tokenType: '\@summary', parameter: ''},
* {tokenType: '\@remarks', parameter: ''},
* {tokenType: 'text', parameter: 'example'},

@@ -31,3 +31,3 @@ * {tokenType: '\@public', parameter: ''}

}
var docEntries = TypeScriptHelpers_1.default.splitStringWithRegEx(docs, Tokenizer._jsdocTagsRegex);
var docEntries = TypeScriptHelpers_1.default.splitStringWithRegEx(docs, Tokenizer._aedocTagsRegex);
var sanitizedTokens = this._sanitizeDocEntries(docEntries); // remove white space and empty entries

@@ -123,8 +123,8 @@ // process each sanitized doc string to a Token object

/**
* Match JsDoc block tags and inline tags
* Match AEDoc block tags and inline tags
* Example "@a @b@c d@e @f {whatever} {@link a} { @something } \@g" => ["@a", "@f", "{@link a}", "{ @something }"]
*/
Tokenizer._jsdocTagsRegex = /{\s*@(\\{|\\}|[^{}])*}|(?:^|\s)(\@[a-z_]+)(?=\s|$)/gi;
Tokenizer._aedocTagsRegex = /{\s*@(\\{|\\}|[^{}])*}|(?:^|\s)(\@[a-z_]+)(?=\s|$)/gi;
exports.default = Tokenizer;
//# sourceMappingURL=Tokenizer.js.map

@@ -10,11 +10,11 @@ import * as ts from 'typescript';

*/
static jsDocStartRegEx: RegExp;
static jsdocStartRegEx: RegExp;
/**
* End sequence is '*\/'.
*/
static jsDocEndRegEx: RegExp;
static jsdocEndRegEx: RegExp;
/**
* Intermediate lines of JSDoc comment character.
*/
static jsDocIntermediateRegEx: RegExp;
static jsdocIntermediateRegEx: RegExp;
/**

@@ -40,3 +40,3 @@ * Returns the Symbol for the provided Declaration. This is a workaround for a missing

*/
static getJsDocComments(node: ts.Node, errorLogger: (message: string) => void): string;
static getJsdocComments(node: ts.Node, errorLogger: (message: string) => void): string;
/**

@@ -48,3 +48,3 @@ * Helper function to remove the comment stars ('/**'. '*', '/*) from lines of comment text.

*/
static removeJsDocSequences(textLines: string[]): string;
static removeJsdocSequences(textLines: string[]): string;
/**

@@ -51,0 +51,0 @@ * Similar to calling string.split() with a RegExp, except that the delimiters

@@ -39,25 +39,25 @@ /* tslint:disable:no-bitwise */

*/
TypeScriptHelpers.getJsDocComments = function (node, errorLogger) {
var jsDoc = '';
TypeScriptHelpers.getJsdocComments = function (node, errorLogger) {
var jsdoc = '';
// tslint:disable-next-line:no-any
var nodeJsDocObjects = node.jsDoc;
if (nodeJsDocObjects && nodeJsDocObjects.length > 0) {
var nodeJsdocObjects = node.jsDoc;
if (nodeJsdocObjects && nodeJsdocObjects.length > 0) {
// Use the JSDoc closest to the declaration
var lastJsDocIndex = nodeJsDocObjects.length - 1;
var jsDocFullText = nodeJsDocObjects[lastJsDocIndex].getText();
var jsDocLines = jsDocFullText.split(TypeScriptHelpers.newLineRegEx);
var jsDocStartSeqExists = TypeScriptHelpers.jsDocStartRegEx.test(jsDocLines[0].toString());
var lastJsdocIndex = nodeJsdocObjects.length - 1;
var jsdocFullText = nodeJsdocObjects[lastJsdocIndex].getText();
var jsdocLines = jsdocFullText.split(TypeScriptHelpers.newLineRegEx);
var jsdocStartSeqExists = TypeScriptHelpers.jsdocStartRegEx.test(jsdocLines[0].toString());
// Report error for each missing sequence seperately
if (!jsDocStartSeqExists) {
errorLogger('JsDoc comment must begin with a \"/**\" sequence.');
if (!jsdocStartSeqExists) {
errorLogger('Jsdoc comment must begin with a \"/**\" sequence.');
return '';
}
var jsDocEndSeqExists = TypeScriptHelpers.jsDocEndRegEx.test(jsDocLines[jsDocLines.length - 1].toString());
if (!jsDocEndSeqExists) {
errorLogger('JsDoc comment must end with a \"*/\" sequence.');
var jsdocEndSeqExists = TypeScriptHelpers.jsdocEndRegEx.test(jsdocLines[jsdocLines.length - 1].toString());
if (!jsdocEndSeqExists) {
errorLogger('Jsdoc comment must end with a \"*/\" sequence.');
return '';
}
jsDoc = TypeScriptHelpers.removeJsDocSequences(jsDocLines);
jsdoc = TypeScriptHelpers.removeJsdocSequences(jsdocLines);
}
return jsDoc;
return jsdoc;
};

@@ -70,5 +70,5 @@ /**

*/
TypeScriptHelpers.removeJsDocSequences = function (textLines) {
TypeScriptHelpers.removeJsdocSequences = function (textLines) {
// Remove '/**'
textLines[0] = textLines[0].replace(TypeScriptHelpers.jsDocStartRegEx, '');
textLines[0] = textLines[0].replace(TypeScriptHelpers.jsdocStartRegEx, '');
if (textLines[0] === '') {

@@ -78,3 +78,3 @@ textLines.shift();

// Remove '*/'
textLines[textLines.length - 1] = textLines[textLines.length - 1].replace(TypeScriptHelpers.jsDocEndRegEx, '');
textLines[textLines.length - 1] = textLines[textLines.length - 1].replace(TypeScriptHelpers.jsdocEndRegEx, '');
if (textLines[textLines.length - 1] === '') {

@@ -86,3 +86,3 @@ textLines.pop();

for (var i = 0; i < textLines.length; i++) {
textLines[i] = textLines[i].replace(TypeScriptHelpers.jsDocIntermediateRegEx, '');
textLines[i] = textLines[i].replace(TypeScriptHelpers.jsdocIntermediateRegEx, '');
}

@@ -211,13 +211,13 @@ }

*/
TypeScriptHelpers.jsDocStartRegEx = /^\s*\/\*\*\s?/g;
TypeScriptHelpers.jsdocStartRegEx = /^\s*\/\*\*\s?/g;
/**
* End sequence is '*\/'.
*/
TypeScriptHelpers.jsDocEndRegEx = /\s*\*\/\s*$/g;
TypeScriptHelpers.jsdocEndRegEx = /\s*\*\/\s*$/g;
/**
* Intermediate lines of JSDoc comment character.
*/
TypeScriptHelpers.jsDocIntermediateRegEx = /^\s*[*]\s?/g;
TypeScriptHelpers.jsdocIntermediateRegEx = /^\s*[*]\s?/g;
exports.default = TypeScriptHelpers;
//# sourceMappingURL=TypeScriptHelpers.js.map
{
"name": "@microsoft/api-extractor",
"version": "2.0.8",
"version": "2.0.9",
"description": "Validate, document, and review the exported API for a TypeScript library",

@@ -9,2 +9,3 @@ "keywords": [

"JSDoc",
"AEDoc",
"generate",

@@ -11,0 +12,0 @@ "documentation",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc