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 4.0.0 to 4.0.1

lib/extractor/Extractor.d.ts

19

CHANGELOG.json

@@ -5,2 +5,21 @@ {

{
"version": "4.0.1",
"tag": "@microsoft/api-extractor_v4.0.1",
"date": "Fri, 20 Oct 2017 01:52:54 GMT",
"comments": {
"patch": [
{
"author": "pgonzal <pgonzal@users.noreply.github.com>",
"commit": "7f9f66ba071e2bcf77f224f784c14efbe627ba40",
"comment": "Rename ApiExtractor class to Extractor"
}
],
"dependency": [
{
"comment": "Updating dependency \"@microsoft/node-core-library\" from `~0.3.5` to `~0.3.6`"
}
]
}
},
{
"version": "4.0.0",

@@ -7,0 +26,0 @@ "tag": "@microsoft/api-extractor_v4.0.0",

9

CHANGELOG.md
# Change Log - @microsoft/api-extractor
This log was last generated on Fri, 20 Oct 2017 01:04:44 GMT and should not be manually modified.
This log was last generated on Fri, 20 Oct 2017 01:52:54 GMT and should not be manually modified.
## 4.0.1
Fri, 20 Oct 2017 01:52:54 GMT
### Patches
- Rename ApiExtractor class to Extractor
## 4.0.0

@@ -6,0 +13,0 @@ Fri, 20 Oct 2017 01:04:44 GMT

6

lib/aedoc/ApiDocumentation.d.ts

@@ -6,3 +6,3 @@ import AstPackage from '../ast/AstPackage';

import Tokenizer from './Tokenizer';
import Extractor from '../Extractor';
import { ExtractorContext } from '../ExtractorContext';
import ResolvedApiItem from '../ResolvedApiItem';

@@ -120,3 +120,3 @@ import { ReleaseTag } from './ReleaseTag';

*/
extractor: Extractor;
context: ExtractorContext;
/**

@@ -129,3 +129,3 @@ * True if any errors were encountered while parsing the AEDoc tokens.

readonly reportError: (message: string) => void;
constructor(docComment: string, referenceResolver: IReferenceResolver, extractor: Extractor, errorLogger: (message: string) => void, warnings: string[]);
constructor(docComment: string, referenceResolver: IReferenceResolver, context: ExtractorContext, errorLogger: (message: string) => void, warnings: string[]);
/**

@@ -132,0 +132,0 @@ * Executes the implementation details involved in completing the documentation initialization.

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

class ApiDocumentation {
constructor(docComment, referenceResolver, extractor, errorLogger, warnings) {
constructor(docComment, referenceResolver, context, errorLogger, warnings) {
this.reportError = (message) => {

@@ -19,3 +19,3 @@ errorLogger(message);

this.referenceResolver = referenceResolver;
this.extractor = extractor;
this.context = context;
this.reportError = errorLogger;

@@ -214,3 +214,3 @@ this.parameters = {};

const apiDefinitionRef = ApiDefinitionReference_1.default.createFromParts(parts);
const resolvedAstItem = this.referenceResolver.resolve(apiDefinitionRef, this.extractor.package, this.warnings);
const resolvedAstItem = this.referenceResolver.resolve(apiDefinitionRef, this.context.package, this.warnings);
// If the apiDefinitionRef can not be found the resolvedAstItem will be

@@ -217,0 +217,0 @@ // undefined and an error will have been reported via this.reportError

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

const memberOptions = {
extractor: this.extractor,
context: this.context,
declaration: memberDeclaration,

@@ -23,0 +23,0 @@ declarationSymbol: memberSymbol,

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

const astParameter = new AstParameter_1.default({
extractor: this.extractor,
context: this.context,
declaration: param,

@@ -29,0 +29,0 @@ declarationSymbol: declarationSymbol,

import * as ts from 'typescript';
import Extractor from '../Extractor';
import { ExtractorContext } from '../ExtractorContext';
import ApiDocumentation from '../aedoc/ApiDocumentation';

@@ -69,5 +69,5 @@ import { IDocElement } from '../markup/OldMarkup';

/**
* The associated Extractor object for this AstItem
* The associated ExtractorContext object for this AstItem
*/
extractor: Extractor;
context: ExtractorContext;
/**

@@ -185,5 +185,6 @@ * The declaration node for the main syntax item that this AstItem is associated with.

/**
* The Extractor object that acts as the root of the abstract syntax tree that this item belongs to.
* The ExtractorContext object provides common contextual information for all of
* items in the AstItem tree.
*/
protected extractor: Extractor;
protected context: ExtractorContext;
/**

@@ -248,3 +249,3 @@ * Syntax information from the TypeScript Compiler API, corresponding to the place

/**
* This function is a second stage that happens after Extractor.analyze() calls AstItem constructor to build up
* This function is a second stage that happens after ExtractorContext.analyze() calls AstItem constructor to build up
* the abstract syntax tree. In this second stage, we are creating the documentation for each AstItem.

@@ -251,0 +252,0 @@ *

@@ -153,4 +153,4 @@ "use strict";

this.warnings = [];
this.extractor = options.extractor;
this.typeChecker = this.extractor.typeChecker;
this.context = options.context;
this.typeChecker = this.context.typeChecker;
this.declarationSymbol = options.declarationSymbol;

@@ -163,3 +163,3 @@ this.exportSymbol = options.exportSymbol || this.declarationSymbol;

}
this.documentation = new ApiDocumentation_1.default(originalJsdoc, this.extractor.docItemLoader, this.extractor, this.reportError, this.warnings);
this.documentation = new ApiDocumentation_1.default(originalJsdoc, this.context.docItemLoader, this.context, this.reportError, this.warnings);
}

@@ -212,3 +212,3 @@ /**

/**
* This function is a second stage that happens after Extractor.analyze() calls AstItem constructor to build up
* This function is a second stage that happens after ExtractorContext.analyze() calls AstItem constructor to build up
* the abstract syntax tree. In this second stage, we are creating the documentation for each AstItem.

@@ -294,3 +294,3 @@ *

reportError(message) {
this.extractor.reportError(message, this._errorNode.getSourceFile(), this._errorNode.getStart());
this.context.reportError(message, this._errorNode.getSourceFile(), this._errorNode.getStart());
}

@@ -400,3 +400,3 @@ /**

_analyzeTypeReference(typeReferenceNode) {
const symbol = this.extractor.typeChecker.getSymbolAtLocation(typeReferenceNode.typeName);
const symbol = this.context.typeChecker.getSymbolAtLocation(typeReferenceNode.typeName);
if (!symbol) {

@@ -420,3 +420,3 @@ // Is this bad?

// Example: "c:\users\<username>\sp-client\spfx-core\sp-core-library"
const typeReferencePackagePath = this.extractor.packageJsonLookup
const typeReferencePackagePath = this.context.packageJsonLookup
.tryGetPackageFolder(sourceFile.fileName);

@@ -428,6 +428,6 @@ // Example: "@microsoft/sp-core-library"

if (!typeReferencePackagePath) {
typeReferencePackageName = this.extractor.package.name;
typeReferencePackageName = this.context.package.name;
}
else {
typeReferencePackageName = this.extractor.packageJsonLookup
typeReferencePackageName = this.context.packageJsonLookup
.getPackageName(typeReferencePackagePath);

@@ -444,7 +444,7 @@ typingsScopeNames.every(typingScopeName => {

// belongs to. If it is your own AstPackage.name/version, then you know it's a local symbol.
const currentPackageName = this.extractor.package.name;
const currentPackageName = this.context.package.name;
const typeName = typeReferenceNode.typeName.getText();
if (!typeReferencePackagePath || typeReferencePackageName === currentPackageName) {
// The type is defined in this project. Did the person remember to export it?
const exportedLocalName = this.extractor.package.tryGetExportedSymbolName(currentSymbol);
const exportedLocalName = this.context.package.tryGetExportedSymbolName(currentSymbol);
if (exportedLocalName) {

@@ -487,3 +487,3 @@ // [CASE 1] Local/Exported

const referenceResolutionWarnings = [];
const resolvedAstItem = this.extractor.docItemLoader.resolveJsonReferences(apiDefinitionRef, referenceResolutionWarnings);
const resolvedAstItem = this.context.docItemLoader.resolveJsonReferences(apiDefinitionRef, referenceResolutionWarnings);
if (resolvedAstItem) {

@@ -490,0 +490,0 @@ // [CASE 3] External/Resolved

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

const typeLiteralOptions = {
extractor: this.extractor,
context: this.context,
declaration: propertyTypeDeclaration,

@@ -57,0 +57,0 @@ declarationSymbol: propertyTypeSymbol,

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

const astParameter = new AstParameter_1.default({
extractor: this.extractor,
context: this.context,
declaration: param,

@@ -70,3 +70,3 @@ declarationSymbol: declarationSymbol,

const scopedPackageName = ApiDefinitionReference_1.default
.parseScopedPackageName(this.extractor.package.name);
.parseScopedPackageName(this.context.package.name);
this.documentation.summary.push({

@@ -73,0 +73,0 @@ kind: 'linkDocElement',

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

const exportMemberOptions = {
extractor: this.extractor,
context: this.context,
declaration,

@@ -84,0 +84,0 @@ declarationSymbol: followedSymbol,

import * as ts from 'typescript';
import Extractor from '../Extractor';
import { ExtractorContext } from '../ExtractorContext';
import AstItemContainer from './AstItemContainer';

@@ -10,4 +10,4 @@ /**

private _exportedNormalizedSymbols;
private static _getOptions(extractor, rootFile);
constructor(extractor: Extractor, rootFile: ts.SourceFile);
private static _getOptions(context, rootFile);
constructor(context: ExtractorContext, rootFile: ts.SourceFile);
/**

@@ -14,0 +14,0 @@ * Finds and returns the original symbol name.

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

class AstPackage extends AstItemContainer_1.default {
constructor(extractor, rootFile) {
super(AstPackage._getOptions(extractor, rootFile));
constructor(context, rootFile) {
super(AstPackage._getOptions(context, rootFile));
this._exportedNormalizedSymbols = [];
this.kind = AstItem_1.AstItemKind.Package;
// The scoped package name. (E.g. "@microsoft/api-extractor")
this.name = extractor.packageName;
this.name = context.packageName;
const exportSymbols = this.typeChecker.getExportsOfModule(this.declarationSymbol);

@@ -39,3 +39,3 @@ if (exportSymbols) {

const options = {
extractor: this.extractor,
context: this.context,
declaration,

@@ -69,3 +69,3 @@ declarationSymbol: followedSymbol,

}
static _getOptions(extractor, rootFile) {
static _getOptions(context, rootFile) {
const rootFileSymbol = TypeScriptHelpers_1.default.getSymbolForDeclaration(rootFile);

@@ -85,3 +85,3 @@ let statement;

return {
extractor,
context,
declaration: rootFileSymbol.declarations[0],

@@ -88,0 +88,0 @@ declarationSymbol: rootFileSymbol,

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

const memberOptions = {
extractor: this.extractor,
context: this.context,
declaration: memberDeclaration,

@@ -151,0 +151,0 @@ declarationSymbol: memberSymbol,

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

const ts_command_line_1 = require("@microsoft/ts-command-line");
const ApiExtractor_1 = require("../extractor/ApiExtractor");
const Extractor_1 = require("../extractor/Extractor");
const AE_CONFIG_FILENAME = 'api-extractor-config.json';

@@ -63,7 +63,7 @@ class RunAction extends ts_command_line_1.CommandLineAction {

}
const config = node_core_library_1.JsonFile.loadAndValidate(configFilename, ApiExtractor_1.ApiExtractor.jsonSchema);
const apiExtractor = new ApiExtractor_1.ApiExtractor(config, {
const config = node_core_library_1.JsonFile.loadAndValidate(configFilename, Extractor_1.Extractor.jsonSchema);
const extractor = new Extractor_1.Extractor(config, {
localBuild: this._localParameter.value
});
apiExtractor.analyzeProject();
extractor.analyzeProject();
}

@@ -70,0 +70,0 @@ }

@@ -7,4 +7,4 @@ "use strict";

// IT IS INVOKED BY THE "Run.cmd" AND "Debug.cmd" BATCH FILES.
const ApiExtractor_1 = require("./extractor/ApiExtractor");
const apiExtractor = new ApiExtractor_1.ApiExtractor({
const Extractor_1 = require("./extractor/Extractor");
const extractor = new Extractor_1.Extractor({
compiler: {

@@ -26,5 +26,5 @@ configType: 'tsconfig',

});
apiExtractor.analyzeProject();
extractor.analyzeProject();
console.log('DebugRun completed.');
//# sourceMappingURL=DebugRun.js.map

@@ -181,7 +181,7 @@ "use strict";

if (!linkDocElement.packageName) {
if (!documentation.extractor.packageName) {
if (!documentation.context.packageName) {
throw new Error('Unable to resolve API reference without a package name');
}
// If the package name is unspecified, assume it is the current package
const scopePackageName = ApiDefinitionReference_1.default.parseScopedPackageName(documentation.extractor.packageName);
const scopePackageName = ApiDefinitionReference_1.default.parseScopedPackageName(documentation.context.packageName);
linkDocElement.scopeName = scopePackageName.scope;

@@ -233,3 +233,3 @@ linkDocElement.packageName = scopePackageName.package;

// Atempt to locate the apiDefinitionRef
const resolvedAstItem = documentation.referenceResolver.resolve(apiDefinitionRef, documentation.extractor.package, warnings);
const resolvedAstItem = documentation.referenceResolver.resolve(apiDefinitionRef, documentation.context.package, warnings);
// If no resolvedAstItem found then nothing to inherit

@@ -236,0 +236,0 @@ // But for the time being set the summary to a text object

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

const fs = require("fs");
const ApiExtractor_1 = require("./extractor/ApiExtractor");
const Extractor_1 = require("./extractor/Extractor");
/**

@@ -46,3 +46,3 @@ * ExternalApiHelper has the specific use case of generating an API json file from third-party definition files.

}
const apiExtractor = new ApiExtractor_1.ApiExtractor({
const extractor = new Extractor_1.Extractor({
compiler: {

@@ -68,3 +68,3 @@ configType: 'tsconfig',

});
apiExtractor.analyzeProject();
extractor.analyzeProject();
}

@@ -71,0 +71,0 @@ }

@@ -1,2 +0,2 @@

import Extractor from '../Extractor';
import { ExtractorContext } from '../ExtractorContext';
import AstStructuredType from '../ast/AstStructuredType';

@@ -45,4 +45,4 @@ import AstEnum from '../ast/AstEnum';

*/
writeApiFile(reportFilename: string, extractor: Extractor): void;
generateApiFileContent(extractor: Extractor): string;
writeApiFile(reportFilename: string, context: ExtractorContext): void;
generateApiFileContent(context: ExtractorContext): string;
protected visitAstStructuredType(astStructuredType: AstStructuredType): void;

@@ -49,0 +49,0 @@ protected visitAstEnum(astEnum: AstEnum): void;

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

*/
writeApiFile(reportFilename, extractor) {
const fileContent = this.generateApiFileContent(extractor);
writeApiFile(reportFilename, context) {
const fileContent = this.generateApiFileContent(context);
fs.writeFileSync(reportFilename, fileContent);
}
generateApiFileContent(extractor) {
generateApiFileContent(context) {
this._insideTypeLiteral = 0;
// Normalize to CRLF
this.visit(extractor.package);
this.visit(context.package);
const fileContent = this._indentedWriter.toString().replace(/\r?\n/g, '\r\n');

@@ -56,0 +56,0 @@ return fileContent;

@@ -1,2 +0,2 @@

import Extractor from '../Extractor';
import { ExtractorContext } from '../ExtractorContext';
import AstStructuredType from '../ast/AstStructuredType';

@@ -30,3 +30,3 @@ import AstEnum from '../ast/AstEnum';

protected jsonOutput: Object;
writeJsonFile(reportFilename: string, extractor: Extractor): void;
writeJsonFile(reportFilename: string, context: ExtractorContext): void;
protected visit(astItem: AstItem, refObject?: Object): void;

@@ -33,0 +33,0 @@ protected visitAstStructuredType(astStructuredType: AstStructuredType, refObject?: Object): void;

@@ -31,4 +31,4 @@ "use strict";

}
writeJsonFile(reportFilename, extractor) {
this.visit(extractor.package, this.jsonOutput);
writeJsonFile(reportFilename, context) {
this.visit(context.package, this.jsonOutput);
// Write the output before validating the schema, so we can debug it

@@ -35,0 +35,0 @@ node_core_library_1.JsonFile.save(this.jsonOutput, reportFilename);

export { default as ExternalApiHelper } from './ExternalApiHelper';
export { ApiExtractor, IAnalyzeProjectOptions, IExtractorOptions } from './extractor/ApiExtractor';
export { Extractor, IAnalyzeProjectOptions, IExtractorOptions } from './extractor/Extractor';
export { IExtractorTsconfigCompilerConfig, IExtractorRuntimeCompilerConfig, IExtractorProjectConfig, IExtractorApiReviewFileConfig, IExtractorApiJsonFileConfig, IExtractorConfig } from './extractor/IExtractorConfig';

@@ -4,0 +4,0 @@ export { ILogger } from './extractor/ILogger';

@@ -7,4 +7,4 @@ "use strict";

exports.ExternalApiHelper = ExternalApiHelper_1.default;
var ApiExtractor_1 = require("./extractor/ApiExtractor");
exports.ApiExtractor = ApiExtractor_1.ApiExtractor;
var Extractor_1 = require("./extractor/Extractor");
exports.Extractor = Extractor_1.Extractor;
var ApiJsonFile_1 = require("./api/ApiJsonFile");

@@ -11,0 +11,0 @@ exports.ApiJsonFile = ApiJsonFile_1.ApiJsonFile;

{
"name": "@microsoft/api-extractor",
"version": "4.0.0",
"version": "4.0.1",
"description": "Validate, document, and review the exported API for a TypeScript library",

@@ -23,2 +23,5 @@ "keywords": [

"typings": "lib/index.d.ts",
"bin": {
"api-extractor": "./bin/api-extractor"
},
"license": "MIT",

@@ -31,3 +34,3 @@ "scripts": {

"dependencies": {
"@microsoft/node-core-library": "~0.3.5",
"@microsoft/node-core-library": "~0.3.6",
"@microsoft/ts-command-line": "~2.1.0",

@@ -34,0 +37,0 @@ "@types/fs-extra": "0.0.37",

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