How to use the @microsoft/api-extractor-model.ReleaseTag.Internal function in @microsoft/api-extractor-model

To help you get started, we’ve selected a few @microsoft/api-extractor-model examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / rushstack / apps / api-extractor / src / generators / ApiModelGenerator.ts View on Github external
private _processDeclaration(astDeclaration: AstDeclaration, exportedName: string | undefined,
    parentApiItem: ApiItemContainerMixin): void {

    if ((astDeclaration.modifierFlags & ts.ModifierFlags.Private) !== 0) {
      return; // trim out private declarations
    }

    const releaseTag: ReleaseTag = this._collector.fetchMetadata(astDeclaration.astSymbol).releaseTag;
    if (releaseTag === ReleaseTag.Internal || releaseTag === ReleaseTag.Alpha) {
      return; // trim out items marked as "@internal" or "@alpha"
    }

    switch (astDeclaration.declaration.kind) {
      case ts.SyntaxKind.CallSignature:
        this._processApiCallSignature(astDeclaration, exportedName, parentApiItem);
        break;

      case ts.SyntaxKind.Constructor:
        this._processApiConstructor(astDeclaration, exportedName, parentApiItem);
        break;

      case ts.SyntaxKind.ConstructSignature:
        this._processApiConstructSignature(astDeclaration, exportedName, parentApiItem);
        break;
github microsoft / rushstack / apps / api-extractor / src / generators / ApiModelGenerator.ts View on Github external
const nodesToCapture: IExcerptBuilderNodeToCapture[] = [];

      const returnTypeTokenRange: IExcerptTokenRange = ExcerptBuilder.createEmptyTokenRange();
      nodesToCapture.push({ node: functionDeclaration.type, tokenRange: returnTypeTokenRange });

      const typeParameters: IApiTypeParameterOptions[] = this._captureTypeParameters(nodesToCapture,
        functionDeclaration.typeParameters);

      const parameters: IApiParameterOptions[] = this._captureParameters(nodesToCapture,
        functionDeclaration.parameters);

      const excerptTokens: IExcerptToken[] = this._buildExcerptTokens(astDeclaration, nodesToCapture);
      const declarationMetadata: DeclarationMetadata = this._collector.fetchMetadata(astDeclaration);
      const docComment: tsdoc.DocComment | undefined = declarationMetadata.tsdocComment;
      const releaseTag: ReleaseTag = declarationMetadata.effectiveReleaseTag;
      if (releaseTag === ReleaseTag.Internal || releaseTag === ReleaseTag.Alpha) {
        return; // trim out items marked as "@internal" or "@alpha"
      }

      apiFunction = new ApiFunction({
        name,
        docComment,
        releaseTag,
        typeParameters,
        parameters,
        overloadIndex,
        excerptTokens,
        returnTypeTokenRange
      });

      parentApiItem.addMember(apiFunction);
    }
github microsoft / rushstack / apps / api-extractor / src / enhancers / DocCommentEnhancer.ts View on Github external
metadata.tsdocComment = new tsdoc.DocComment({ configuration });
      }

      if (!tsdoc.PlainTextEmitter.hasAnyTextContent(metadata.tsdocComment.summarySection)) {
        metadata.tsdocComment.summarySection.appendNodesInParagraph([
          new tsdoc.DocPlainText({ configuration, text: 'Constructs a new instance of the ' }),
          new tsdoc.DocCodeSpan({
            configuration,
            code: classDeclaration.astSymbol.localName
          }),
          new tsdoc.DocPlainText({ configuration, text: ' class' })
        ]);
      }

      const declarationMetadata: DeclarationMetadata = this._collector.fetchMetadata(astDeclaration);
      if (declarationMetadata.effectiveReleaseTag === ReleaseTag.Internal) {
        // If the constructor is marked as internal, then add a boilerplate notice for the containing class
        const classMetadata: DeclarationMetadata = this._collector.fetchMetadata(classDeclaration);

        if (!classMetadata.tsdocComment) {
          classMetadata.tsdocComment = new tsdoc.DocComment({ configuration });
        }

        if (classMetadata.tsdocComment.remarksBlock === undefined) {
          classMetadata.tsdocComment.remarksBlock = new tsdoc.DocBlock({
            configuration,
            blockTag: new tsdoc.DocBlockTag({
              configuration,
              tagName: tsdoc.StandardTags.remarks.tagName
            })
          });
        }
github microsoft / rushstack / apps / api-extractor / src / generators / ApiModelGenerator.ts View on Github external
private _processDeclaration(astDeclaration: AstDeclaration, exportedName: string | undefined,
    parentApiItem: ApiItemContainerMixin): void {

    if ((astDeclaration.modifierFlags & ts.ModifierFlags.Private) !== 0) {
      return; // trim out private declarations
    }

    const declarationMetadata: DeclarationMetadata = this._collector.fetchMetadata(astDeclaration);
    if (declarationMetadata.isAncillary) {
      // Skip ancillary declarations; we will process them with the main declaration
      return;
    }

    const releaseTag: ReleaseTag = declarationMetadata.effectiveReleaseTag;
    if (releaseTag === ReleaseTag.Internal || releaseTag === ReleaseTag.Alpha) {
      return; // trim out items marked as "@internal" or "@alpha"
    }

    switch (astDeclaration.declaration.kind) {
      case ts.SyntaxKind.CallSignature:
        this._processApiCallSignature(astDeclaration, exportedName, parentApiItem);
        break;

      case ts.SyntaxKind.Constructor:
        this._processApiConstructor(astDeclaration, exportedName, parentApiItem);
        break;

      case ts.SyntaxKind.ConstructSignature:
        this._processApiConstructSignature(astDeclaration, exportedName, parentApiItem);
        break;
github microsoft / rushstack / apps / api-extractor / src / enhancers / ValidationEnhancer.ts View on Github external
private static _checkForInternalUnderscore(
    collector: Collector,
    collectorEntity: CollectorEntity,
    astSymbol: AstSymbol
  ): void {
    const astSymbolMetadata: SymbolMetadata = collector.fetchMetadata(astSymbol);

    if (astSymbolMetadata.releaseTag === ReleaseTag.Internal && !astSymbolMetadata.releaseTagSameAsParent) {
      for (const exportName of collectorEntity.exportNames) {
        if (exportName[0] !== '_') {
          collector.messageRouter.addAnalyzerIssue(
            ExtractorMessageId.InternalMissingUnderscore,
            `The name "${exportName}" should be prefixed with an underscore` +
              ` because the declaration is marked as @internal`,
            astSymbol,
            { exportName }
          );
        }
      }
    }
  }