@microsoft/api-extractor
Advanced tools
Comparing version 2.3.5 to 2.3.6
@@ -5,2 +5,14 @@ { | ||
{ | ||
"version": "2.3.6", | ||
"tag": "@microsoft/api-extractor_v2.3.6", | ||
"date": "Wed, 30 Aug 2017 01:04:34 GMT", | ||
"comments": { | ||
"dependency": [ | ||
{ | ||
"comment": "Updating dependency \"@microsoft/node-core-library\" from `~0.1.3` to `~0.2.0`" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"version": "2.3.5", | ||
@@ -7,0 +19,0 @@ "tag": "@microsoft/api-extractor_v2.3.5", |
# Change Log - @microsoft/api-extractor | ||
This log was last generated on Thu, 24 Aug 2017 22:44:12 GMT and should not be manually modified. | ||
This log was last generated on Wed, 30 Aug 2017 01:04:34 GMT and should not be manually modified. | ||
## 2.3.6 | ||
Wed, 30 Aug 2017 01:04:34 GMT | ||
*Changes not tracked* | ||
## 2.3.5 | ||
@@ -6,0 +11,0 @@ Thu, 24 Aug 2017 22:44:12 GMT |
@@ -392,3 +392,3 @@ "use strict"; | ||
var typeReferencePackagePath = this.extractor.packageJsonLookup | ||
.tryFindPackagePathUpwards(sourceFile.fileName); | ||
.tryGetPackageFolder(sourceFile.fileName); | ||
// Example: "@microsoft/sp-core-library" | ||
@@ -403,3 +403,3 @@ var typeReferencePackageName = ''; | ||
typeReferencePackageName = this.extractor.packageJsonLookup | ||
.readPackageName(typeReferencePackagePath); | ||
.getPackageName(typeReferencePackagePath); | ||
typingsScopeNames.every(function (typingScopeName) { | ||
@@ -406,0 +406,0 @@ if (typeReferencePackageName.indexOf(typingScopeName) > -1) { |
@@ -35,3 +35,3 @@ "use strict"; | ||
// The scoped package name. (E.g. "@microsoft/api-extractor") | ||
_this.name = _this.extractor.packageJsonLookup.readPackageName(_this.extractor.packageFolder); | ||
_this.name = _this.extractor.packageJsonLookup.getPackageName(_this.extractor.packageFolder); | ||
var exportSymbols = _this.typeChecker.getExportsOfModule(_this.declarationSymbol); | ||
@@ -38,0 +38,0 @@ if (exportSymbols) { |
@@ -8,5 +8,6 @@ "use strict"; | ||
var path = require("path"); | ||
var node_core_library_1 = require("@microsoft/node-core-library"); | ||
var ApiItemContainer_1 = require("./definitions/ApiItemContainer"); | ||
var ResolvedApiItem_1 = require("./ResolvedApiItem"); | ||
var JsonFile_1 = require("./JsonFile"); | ||
var ApiJsonGenerator_1 = require("./generators/ApiJsonGenerator"); | ||
/** | ||
@@ -169,8 +170,6 @@ * A loader for locating the IDocItem associated with a given project and API item, or | ||
DocItemLoader.prototype.loadPackageIntoCache = function (apiJsonFilePath, cachePackageName) { | ||
var apiPackage = JsonFile_1.default.loadJsonFile(apiJsonFilePath); | ||
// Validate that the output conforms to our JSON schema | ||
var apiJsonSchema = JsonFile_1.default.loadJsonFile(path.join(__dirname, './schemas/api-json-schema.json')); | ||
JsonFile_1.default.validateSchema(apiPackage, apiJsonSchema, function (errorDetail) { | ||
var errorMessage = "ApiJsonGenerator validation error - output does not conform to api-json-schema.json:" + os.EOL | ||
+ errorDetail; | ||
var apiPackage = node_core_library_1.JsonFile.loadAndValidateWithCallback(apiJsonFilePath, ApiJsonGenerator_1.default.jsonSchema, function (errorInfo) { | ||
var errorMessage = path.basename(apiJsonFilePath) + ' does not conform to the expected schema.' + os.EOL | ||
+ '(Was it created by an incompatible release of API Extractor?)' + os.EOL | ||
+ errorInfo.details; | ||
console.log(os.EOL + 'ERROR: ' + errorMessage + os.EOL + os.EOL); | ||
@@ -177,0 +176,0 @@ throw new Error(errorMessage); |
import * as ts from 'typescript'; | ||
import { PackageJsonLookup } from '@microsoft/node-core-library'; | ||
import ApiPackage from './definitions/ApiPackage'; | ||
import DocItemLoader from './DocItemLoader'; | ||
import PackageJsonLookup from './PackageJsonLookup'; | ||
export declare type ApiErrorHandler = (message: string, fileName: string, lineNumber: number) => void; | ||
@@ -6,0 +6,0 @@ /** |
@@ -8,5 +8,5 @@ "use strict"; | ||
var path = require("path"); | ||
var node_core_library_1 = require("@microsoft/node-core-library"); | ||
var ApiPackage_1 = require("./definitions/ApiPackage"); | ||
var DocItemLoader_1 = require("./DocItemLoader"); | ||
var PackageJsonLookup_1 = require("./PackageJsonLookup"); | ||
/** | ||
@@ -23,3 +23,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.packageJsonLookup = new node_core_library_1.PackageJsonLookup(); | ||
this.errorHandler = options.errorHandler || Extractor.defaultErrorHandler; | ||
@@ -64,3 +64,3 @@ } | ||
// This is guaranteed to succeed since we do check prior to this point | ||
this._packageFolder = this.packageJsonLookup.tryFindPackagePathUpwards(currentPath); | ||
this._packageFolder = this.packageJsonLookup.tryGetPackageFolder(currentPath); | ||
this.package = new ApiPackage_1.default(this, rootFile); // construct members | ||
@@ -67,0 +67,0 @@ this.package.completeInitialization(); // creates ApiDocumentation |
@@ -0,1 +1,2 @@ | ||
import { JsonSchema } from '@microsoft/node-core-library'; | ||
import Extractor from '../Extractor'; | ||
@@ -30,2 +31,7 @@ import ApiStructuredType from '../definitions/ApiStructuredType'; | ||
private static _EXPORTS_KEY; | ||
private static _jsonSchema; | ||
/** | ||
* The JSON schema for the *.api.json file format. | ||
*/ | ||
static readonly jsonSchema: JsonSchema; | ||
protected jsonOutput: Object; | ||
@@ -32,0 +38,0 @@ writeJsonFile(reportFilename: string, extractor: Extractor): void; |
@@ -18,2 +18,3 @@ "use strict"; | ||
var ts = require("typescript"); | ||
var node_core_library_1 = require("@microsoft/node-core-library"); | ||
var ApiItem_1 = require("../definitions/ApiItem"); | ||
@@ -23,3 +24,2 @@ var ApiItemVisitor_1 = require("../ApiItemVisitor"); | ||
var ApiDocumentation_1 = require("../definitions/ApiDocumentation"); | ||
var JsonFile_1 = require("../JsonFile"); | ||
var ApiJsonFile_1 = require("./ApiJsonFile"); | ||
@@ -44,12 +44,24 @@ /** | ||
} | ||
Object.defineProperty(ApiJsonGenerator, "jsonSchema", { | ||
/** | ||
* The JSON schema for the *.api.json file format. | ||
*/ | ||
get: function () { | ||
if (!ApiJsonGenerator._jsonSchema) { | ||
ApiJsonGenerator._jsonSchema = node_core_library_1.JsonSchema.fromFile(path.join(__dirname, '../schemas/api-json-schema.json')); | ||
} | ||
return ApiJsonGenerator._jsonSchema; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
ApiJsonGenerator.prototype.writeJsonFile = function (reportFilename, extractor) { | ||
this.visit(extractor.package, this.jsonOutput); | ||
// Write the output before validating the schema, so we can debug it | ||
JsonFile_1.default.saveJsonFile(reportFilename, this.jsonOutput); | ||
node_core_library_1.JsonFile.save(this.jsonOutput, reportFilename); | ||
// Validate that the output conforms to our JSON schema | ||
var apiJsonSchema = JsonFile_1.default.loadJsonFile(path.join(__dirname, '../schemas/api-json-schema.json')); | ||
JsonFile_1.default.validateSchema(this.jsonOutput, apiJsonSchema, function (errorDetail) { | ||
var errorMessage = "ApiJsonGenerator validation error - output does not conform to api-json-schema.json:" + os.EOL | ||
+ reportFilename + os.EOL | ||
+ errorDetail; | ||
ApiJsonGenerator.jsonSchema.validateObjectWithCallback(this.jsonOutput, function (errorInfo) { | ||
var errorMessage = path.basename(reportFilename) | ||
+ " does not conform to the expected schema -- please report this API Extractor bug:" | ||
+ os.EOL + errorInfo.details; | ||
console.log(os.EOL + 'ERROR: ' + errorMessage + os.EOL + os.EOL); | ||
@@ -282,2 +294,3 @@ throw new Error(errorMessage); | ||
ApiJsonGenerator._EXPORTS_KEY = 'exports'; | ||
ApiJsonGenerator._jsonSchema = undefined; | ||
return ApiJsonGenerator; | ||
@@ -284,0 +297,0 @@ }(ApiItemVisitor_1.default)); |
@@ -19,5 +19,5 @@ "use strict"; | ||
var path = require("path"); | ||
var node_core_library_1 = require("@microsoft/node-core-library"); | ||
var DocElementParser_1 = require("../DocElementParser"); | ||
var TestFileComparer_1 = require("../TestFileComparer"); | ||
var JsonFile_1 = require("../JsonFile"); | ||
var ApiDocumentation_1 = require("../definitions/ApiDocumentation"); | ||
@@ -95,4 +95,4 @@ var Extractor_1 = require("./../Extractor"); | ||
var actualSummary = DocElementParser_1.default.parse(myDocumentedClass.documentation, tokenizer); | ||
JsonFile_1.default.saveJsonFile('./lib/basicDocExpected.json', JSON.stringify(expectedSummary)); | ||
JsonFile_1.default.saveJsonFile('./lib/basicDocActual.json', JSON.stringify(actualSummary)); | ||
node_core_library_1.JsonFile.save(JSON.stringify(expectedSummary), './lib/basicDocExpected.json'); | ||
node_core_library_1.JsonFile.save(JSON.stringify(actualSummary), './lib/basicDocActual.json'); | ||
TestFileComparer_1.default.assertFileMatchesExpected('./lib/basicDocActual.json', './lib/basicDocExpected.json'); | ||
@@ -105,4 +105,4 @@ // Testing Returns Doc Elements | ||
var actualReturn = DocElementParser_1.default.parse(myDocumentedClass.documentation, tokenizer); | ||
JsonFile_1.default.saveJsonFile('./lib/returnDocExpected.json', JSON.stringify(expectedReturn)); | ||
JsonFile_1.default.saveJsonFile('./lib/returnDocActual.json', JSON.stringify(actualReturn)); | ||
node_core_library_1.JsonFile.save(JSON.stringify(expectedReturn), './lib/returnDocExpected.json'); | ||
node_core_library_1.JsonFile.save(JSON.stringify(actualReturn), './lib/returnDocActual.json'); | ||
TestFileComparer_1.default.assertFileMatchesExpected('./lib/returnDocActual.json', './lib/returnDocExpected.json'); | ||
@@ -125,4 +125,4 @@ // Testing Params Doc Elements | ||
actualParam.push(apiDoc.parseParam(tokenizer)); | ||
JsonFile_1.default.saveJsonFile('./lib/paramDocExpected.json', JSON.stringify(expectedParam)); | ||
JsonFile_1.default.saveJsonFile('./lib/paramDocActual.json', JSON.stringify(actualParam)); | ||
node_core_library_1.JsonFile.save(JSON.stringify(expectedParam), './lib/paramDocExpected.json'); | ||
node_core_library_1.JsonFile.save(JSON.stringify(actualParam), './lib/paramDocActual.json'); | ||
TestFileComparer_1.default.assertFileMatchesExpected('./lib/paramDocActual.json', './lib/paramDocExpected.json'); | ||
@@ -141,4 +141,4 @@ assertCapturedErrors([]); | ||
var actualDeprecated = DocElementParser_1.default.parse(myDocumentedClass.documentation, tokenizer); | ||
JsonFile_1.default.saveJsonFile('./lib/deprecatedDocExpected.json', JSON.stringify(expectedDeprecated)); | ||
JsonFile_1.default.saveJsonFile('./lib/deprecatedDocActual.json', JSON.stringify(actualDeprecated)); | ||
node_core_library_1.JsonFile.save(JSON.stringify(expectedDeprecated), './lib/deprecatedDocExpected.json'); | ||
node_core_library_1.JsonFile.save(JSON.stringify(actualDeprecated), './lib/deprecatedDocActual.json'); | ||
TestFileComparer_1.default.assertFileMatchesExpected('./lib/deprecatedDocActual.json', './lib/deprecatedDocExpected.json'); | ||
@@ -168,4 +168,4 @@ assertCapturedErrors([]); | ||
var actualSummary = DocElementParser_1.default.parse(myDocumentedClass.documentation, tokenizer); | ||
JsonFile_1.default.saveJsonFile('./lib/seeDocExpected.json', JSON.stringify(expectedSummary)); | ||
JsonFile_1.default.saveJsonFile('./lib/seeDocActual.json', JSON.stringify(actualSummary)); | ||
node_core_library_1.JsonFile.save(JSON.stringify(expectedSummary), './lib/seeDocExpected.json'); | ||
node_core_library_1.JsonFile.save(JSON.stringify(actualSummary), './lib/seeDocActual.json'); | ||
TestFileComparer_1.default.assertFileMatchesExpected('./lib/seeDocExpected.json', './lib/seeDocActual.json'); | ||
@@ -196,4 +196,4 @@ assertCapturedErrors([]); | ||
var actualParam = apiDoc.parseParam(tokenizer); | ||
JsonFile_1.default.saveJsonFile('./lib/nestedParamDocExpected.json', JSON.stringify(expectedParam)); | ||
JsonFile_1.default.saveJsonFile('./lib/nestedParamDocActual.json', JSON.stringify(actualParam)); | ||
node_core_library_1.JsonFile.save(JSON.stringify(expectedParam), './lib/nestedParamDocExpected.json'); | ||
node_core_library_1.JsonFile.save(JSON.stringify(actualParam), './lib/nestedParamDocActual.json'); | ||
TestFileComparer_1.default.assertFileMatchesExpected('./lib/nestedParamDocActual.json', './lib/nestedParamDocExpected.json'); | ||
@@ -200,0 +200,0 @@ assertCapturedErrors([]); |
@@ -17,3 +17,3 @@ "use strict"; | ||
var chai_1 = require("chai"); | ||
var JsonFile_1 = require("../JsonFile"); | ||
var node_core_library_1 = require("@microsoft/node-core-library"); | ||
var TestFileComparer_1 = require("../TestFileComparer"); | ||
@@ -56,4 +56,4 @@ var Token_1 = require("../Token"); | ||
var actualTokens = testTokenizer.tokenizeDocs(docs); | ||
JsonFile_1.default.saveJsonFile('./lib/tokenizeDocsExpected.json', JSON.stringify(expectedTokens)); | ||
JsonFile_1.default.saveJsonFile('./lib/tokenizeDocsActual.json', JSON.stringify(actualTokens)); | ||
node_core_library_1.JsonFile.save(JSON.stringify(expectedTokens), './lib/tokenizeDocsExpected.json'); | ||
node_core_library_1.JsonFile.save(JSON.stringify(actualTokens), './lib/tokenizeDocsActual.json'); | ||
TestFileComparer_1.default.assertFileMatchesExpected('./lib/tokenizeDocsActual.json', './lib/tokenizeDocsExpected.json'); | ||
@@ -60,0 +60,0 @@ }); |
{ | ||
"name": "@microsoft/api-extractor", | ||
"version": "2.3.5", | ||
"version": "2.3.6", | ||
"description": "Validate, document, and review the exported API for a TypeScript library", | ||
@@ -35,2 +35,3 @@ "keywords": [ | ||
"mocha": "~3.4.2", | ||
"@microsoft/node-core-library": "~0.2.0", | ||
"@microsoft/node-library-build": "~3.2.0" | ||
@@ -37,0 +38,0 @@ }, |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5
771455
7
157
9826