init
This commit is contained in:
8
node_modules/@microsoft/api-extractor/lib/cli/ApiExtractorCommandLine.d.ts
generated
vendored
Normal file
8
node_modules/@microsoft/api-extractor/lib/cli/ApiExtractorCommandLine.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
import { CommandLineParser } from '@rushstack/ts-command-line';
|
||||
export declare class ApiExtractorCommandLine extends CommandLineParser {
|
||||
private readonly _debugParameter;
|
||||
constructor();
|
||||
protected onExecute(): Promise<void>;
|
||||
private _populateActions;
|
||||
}
|
||||
//# sourceMappingURL=ApiExtractorCommandLine.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/cli/ApiExtractorCommandLine.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/cli/ApiExtractorCommandLine.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"ApiExtractorCommandLine.d.ts","sourceRoot":"","sources":["../../src/cli/ApiExtractorCommandLine.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAiC,MAAM,4BAA4B,CAAC;AAM9F,qBAAa,uBAAwB,SAAQ,iBAAiB;IAC5D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2B;;IAqB3D,SAAS,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBpC,OAAO,CAAC,gBAAgB;CAIzB"}
|
76
node_modules/@microsoft/api-extractor/lib/cli/ApiExtractorCommandLine.js
generated
vendored
Normal file
76
node_modules/@microsoft/api-extractor/lib/cli/ApiExtractorCommandLine.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApiExtractorCommandLine = void 0;
|
||||
const colors_1 = __importDefault(require("colors"));
|
||||
const os = __importStar(require("os"));
|
||||
const ts_command_line_1 = require("@rushstack/ts-command-line");
|
||||
const node_core_library_1 = require("@rushstack/node-core-library");
|
||||
const RunAction_1 = require("./RunAction");
|
||||
const InitAction_1 = require("./InitAction");
|
||||
class ApiExtractorCommandLine extends ts_command_line_1.CommandLineParser {
|
||||
constructor() {
|
||||
super({
|
||||
toolFilename: 'api-extractor',
|
||||
toolDescription: 'API Extractor helps you build better TypeScript libraries. It analyzes the main entry' +
|
||||
' point for your package, collects the inventory of exported declarations, and then generates three kinds' +
|
||||
' of output: an API report file (.api.md) to facilitate reviews, a declaration rollup (.d.ts) to be' +
|
||||
' published with your NPM package, and a doc model file (.api.json) to be used with a documentation' +
|
||||
' tool such as api-documenter. For details, please visit the web site.'
|
||||
});
|
||||
this._populateActions();
|
||||
this._debugParameter = this.defineFlagParameter({
|
||||
parameterLongName: '--debug',
|
||||
parameterShortName: '-d',
|
||||
description: 'Show the full call stack if an error occurs while executing the tool'
|
||||
});
|
||||
}
|
||||
onExecute() {
|
||||
// override
|
||||
if (this._debugParameter.value) {
|
||||
node_core_library_1.InternalError.breakInDebugger = true;
|
||||
}
|
||||
return super.onExecute().catch((error) => {
|
||||
if (this._debugParameter.value) {
|
||||
console.error(os.EOL + error.stack);
|
||||
}
|
||||
else {
|
||||
console.error(os.EOL + colors_1.default.red('ERROR: ' + error.message.trim()));
|
||||
}
|
||||
process.exitCode = 1;
|
||||
});
|
||||
}
|
||||
_populateActions() {
|
||||
this.addAction(new InitAction_1.InitAction(this));
|
||||
this.addAction(new RunAction_1.RunAction(this));
|
||||
}
|
||||
}
|
||||
exports.ApiExtractorCommandLine = ApiExtractorCommandLine;
|
||||
//# sourceMappingURL=ApiExtractorCommandLine.js.map
|
1
node_modules/@microsoft/api-extractor/lib/cli/ApiExtractorCommandLine.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/cli/ApiExtractorCommandLine.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"ApiExtractorCommandLine.js","sourceRoot":"","sources":["../../src/cli/ApiExtractorCommandLine.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,oDAA4B;AAC5B,uCAAyB;AAEzB,gEAA8F;AAC9F,oEAA6D;AAE7D,2CAAwC;AACxC,6CAA0C;AAE1C,MAAa,uBAAwB,SAAQ,mCAAiB;IAG5D;QACE,KAAK,CAAC;YACJ,YAAY,EAAE,eAAe;YAC7B,eAAe,EACb,wFAAwF;gBACxF,0GAA0G;gBAC1G,qGAAqG;gBACrG,oGAAoG;gBACpG,wEAAwE;SAC3E,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAExB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC;YAC9C,iBAAiB,EAAE,SAAS;YAC5B,kBAAkB,EAAE,IAAI;YACxB,WAAW,EAAE,sEAAsE;SACpF,CAAC,CAAC;IACL,CAAC;IAES,SAAS;QACjB,WAAW;QACX,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE;YAC9B,iCAAa,CAAC,eAAe,GAAG,IAAI,CAAC;SACtC;QAED,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACvC,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE;gBAC9B,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;aACrC;iBAAM;gBACL,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,GAAG,gBAAM,CAAC,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;aACtE;YAED,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,SAAS,CAAC,IAAI,uBAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QACrC,IAAI,CAAC,SAAS,CAAC,IAAI,qBAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC;CACF;AA3CD,0DA2CC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport colors from 'colors';\nimport * as os from 'os';\n\nimport { CommandLineParser, type CommandLineFlagParameter } from '@rushstack/ts-command-line';\nimport { InternalError } from '@rushstack/node-core-library';\n\nimport { RunAction } from './RunAction';\nimport { InitAction } from './InitAction';\n\nexport class ApiExtractorCommandLine extends CommandLineParser {\n private readonly _debugParameter: CommandLineFlagParameter;\n\n public constructor() {\n super({\n toolFilename: 'api-extractor',\n toolDescription:\n 'API Extractor helps you build better TypeScript libraries. It analyzes the main entry' +\n ' point for your package, collects the inventory of exported declarations, and then generates three kinds' +\n ' of output: an API report file (.api.md) to facilitate reviews, a declaration rollup (.d.ts) to be' +\n ' published with your NPM package, and a doc model file (.api.json) to be used with a documentation' +\n ' tool such as api-documenter. For details, please visit the web site.'\n });\n this._populateActions();\n\n this._debugParameter = this.defineFlagParameter({\n parameterLongName: '--debug',\n parameterShortName: '-d',\n description: 'Show the full call stack if an error occurs while executing the tool'\n });\n }\n\n protected onExecute(): Promise<void> {\n // override\n if (this._debugParameter.value) {\n InternalError.breakInDebugger = true;\n }\n\n return super.onExecute().catch((error) => {\n if (this._debugParameter.value) {\n console.error(os.EOL + error.stack);\n } else {\n console.error(os.EOL + colors.red('ERROR: ' + error.message.trim()));\n }\n\n process.exitCode = 1;\n });\n }\n\n private _populateActions(): void {\n this.addAction(new InitAction(this));\n this.addAction(new RunAction(this));\n }\n}\n"]}
|
7
node_modules/@microsoft/api-extractor/lib/cli/InitAction.d.ts
generated
vendored
Normal file
7
node_modules/@microsoft/api-extractor/lib/cli/InitAction.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import { CommandLineAction } from '@rushstack/ts-command-line';
|
||||
import type { ApiExtractorCommandLine } from './ApiExtractorCommandLine';
|
||||
export declare class InitAction extends CommandLineAction {
|
||||
constructor(parser: ApiExtractorCommandLine);
|
||||
protected onExecute(): Promise<void>;
|
||||
}
|
||||
//# sourceMappingURL=InitAction.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/cli/InitAction.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/cli/InitAction.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"InitAction.d.ts","sourceRoot":"","sources":["../../src/cli/InitAction.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGzE,qBAAa,UAAW,SAAQ,iBAAiB;gBAC5B,MAAM,EAAE,uBAAuB;cAWlC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAsB3C"}
|
66
node_modules/@microsoft/api-extractor/lib/cli/InitAction.js
generated
vendored
Normal file
66
node_modules/@microsoft/api-extractor/lib/cli/InitAction.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.InitAction = void 0;
|
||||
const colors_1 = __importDefault(require("colors"));
|
||||
const path = __importStar(require("path"));
|
||||
const node_core_library_1 = require("@rushstack/node-core-library");
|
||||
const ts_command_line_1 = require("@rushstack/ts-command-line");
|
||||
const ExtractorConfig_1 = require("../api/ExtractorConfig");
|
||||
class InitAction extends ts_command_line_1.CommandLineAction {
|
||||
constructor(parser) {
|
||||
super({
|
||||
actionName: 'init',
|
||||
summary: `Create an ${ExtractorConfig_1.ExtractorConfig.FILENAME} config file`,
|
||||
documentation: `Use this command when setting up API Extractor for a new project. It writes an` +
|
||||
` ${ExtractorConfig_1.ExtractorConfig.FILENAME} config file template with code comments that describe all the settings.` +
|
||||
` The file will be written in the current directory.`
|
||||
});
|
||||
}
|
||||
async onExecute() {
|
||||
// override
|
||||
const inputFilePath = path.resolve(__dirname, '../schemas/api-extractor-template.json');
|
||||
const outputFilePath = path.resolve(ExtractorConfig_1.ExtractorConfig.FILENAME);
|
||||
if (node_core_library_1.FileSystem.exists(outputFilePath)) {
|
||||
console.log(colors_1.default.red('The output file already exists:'));
|
||||
console.log('\n ' + outputFilePath + '\n');
|
||||
throw new Error('Unable to write output file');
|
||||
}
|
||||
console.log(colors_1.default.green('Writing file: ') + outputFilePath);
|
||||
node_core_library_1.FileSystem.copyFile({
|
||||
sourcePath: inputFilePath,
|
||||
destinationPath: outputFilePath
|
||||
});
|
||||
console.log('\nThe recommended location for this file is in the project\'s "config" subfolder,\n' +
|
||||
'or else in the top-level folder with package.json.');
|
||||
}
|
||||
}
|
||||
exports.InitAction = InitAction;
|
||||
//# sourceMappingURL=InitAction.js.map
|
1
node_modules/@microsoft/api-extractor/lib/cli/InitAction.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/cli/InitAction.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"InitAction.js","sourceRoot":"","sources":["../../src/cli/InitAction.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,oDAA4B;AAC5B,2CAA6B;AAC7B,oEAA0D;AAC1D,gEAA+D;AAG/D,4DAAyD;AAEzD,MAAa,UAAW,SAAQ,mCAAiB;IAC/C,YAAmB,MAA+B;QAChD,KAAK,CAAC;YACJ,UAAU,EAAE,MAAM;YAClB,OAAO,EAAE,aAAa,iCAAe,CAAC,QAAQ,cAAc;YAC5D,aAAa,EACX,iFAAiF;gBACjF,IAAI,iCAAe,CAAC,QAAQ,0EAA0E;gBACtG,qDAAqD;SACxD,CAAC,CAAC;IACL,CAAC;IAES,KAAK,CAAC,SAAS;QACvB,WAAW;QACX,MAAM,aAAa,GAAW,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,wCAAwC,CAAC,CAAC;QAChG,MAAM,cAAc,GAAW,IAAI,CAAC,OAAO,CAAC,iCAAe,CAAC,QAAQ,CAAC,CAAC;QAEtE,IAAI,8BAAU,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;YACrC,OAAO,CAAC,GAAG,CAAC,gBAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC,CAAC;YAC3D,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,cAAc,GAAG,IAAI,CAAC,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAChD;QAED,OAAO,CAAC,GAAG,CAAC,gBAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,cAAc,CAAC,CAAC;QAC7D,8BAAU,CAAC,QAAQ,CAAC;YAClB,UAAU,EAAE,aAAa;YACzB,eAAe,EAAE,cAAc;SAChC,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CACT,qFAAqF;YACnF,oDAAoD,CACvD,CAAC;IACJ,CAAC;CACF;AAlCD,gCAkCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport colors from 'colors';\nimport * as path from 'path';\nimport { FileSystem } from '@rushstack/node-core-library';\nimport { CommandLineAction } from '@rushstack/ts-command-line';\n\nimport type { ApiExtractorCommandLine } from './ApiExtractorCommandLine';\nimport { ExtractorConfig } from '../api/ExtractorConfig';\n\nexport class InitAction extends CommandLineAction {\n public constructor(parser: ApiExtractorCommandLine) {\n super({\n actionName: 'init',\n summary: `Create an ${ExtractorConfig.FILENAME} config file`,\n documentation:\n `Use this command when setting up API Extractor for a new project. It writes an` +\n ` ${ExtractorConfig.FILENAME} config file template with code comments that describe all the settings.` +\n ` The file will be written in the current directory.`\n });\n }\n\n protected async onExecute(): Promise<void> {\n // override\n const inputFilePath: string = path.resolve(__dirname, '../schemas/api-extractor-template.json');\n const outputFilePath: string = path.resolve(ExtractorConfig.FILENAME);\n\n if (FileSystem.exists(outputFilePath)) {\n console.log(colors.red('The output file already exists:'));\n console.log('\\n ' + outputFilePath + '\\n');\n throw new Error('Unable to write output file');\n }\n\n console.log(colors.green('Writing file: ') + outputFilePath);\n FileSystem.copyFile({\n sourcePath: inputFilePath,\n destinationPath: outputFilePath\n });\n\n console.log(\n '\\nThe recommended location for this file is in the project\\'s \"config\" subfolder,\\n' +\n 'or else in the top-level folder with package.json.'\n );\n }\n}\n"]}
|
12
node_modules/@microsoft/api-extractor/lib/cli/RunAction.d.ts
generated
vendored
Normal file
12
node_modules/@microsoft/api-extractor/lib/cli/RunAction.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { CommandLineAction } from '@rushstack/ts-command-line';
|
||||
import type { ApiExtractorCommandLine } from './ApiExtractorCommandLine';
|
||||
export declare class RunAction extends CommandLineAction {
|
||||
private readonly _configFileParameter;
|
||||
private readonly _localParameter;
|
||||
private readonly _verboseParameter;
|
||||
private readonly _diagnosticsParameter;
|
||||
private readonly _typescriptCompilerFolder;
|
||||
constructor(parser: ApiExtractorCommandLine);
|
||||
protected onExecute(): Promise<void>;
|
||||
}
|
||||
//# sourceMappingURL=RunAction.d.ts.map
|
1
node_modules/@microsoft/api-extractor/lib/cli/RunAction.d.ts.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/cli/RunAction.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"RunAction.d.ts","sourceRoot":"","sources":["../../src/cli/RunAction.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,iBAAiB,EAGlB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGzE,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA6B;IAClE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2B;IAC3D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA2B;IAC7D,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAA2B;IACjE,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAA6B;gBAEpD,MAAM,EAAE,uBAAuB;cAiDlC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CA6E3C"}
|
147
node_modules/@microsoft/api-extractor/lib/cli/RunAction.js
generated
vendored
Normal file
147
node_modules/@microsoft/api-extractor/lib/cli/RunAction.js
generated
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
"use strict";
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RunAction = void 0;
|
||||
const colors_1 = __importDefault(require("colors"));
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
const node_core_library_1 = require("@rushstack/node-core-library");
|
||||
const ts_command_line_1 = require("@rushstack/ts-command-line");
|
||||
const Extractor_1 = require("../api/Extractor");
|
||||
const ExtractorConfig_1 = require("../api/ExtractorConfig");
|
||||
class RunAction extends ts_command_line_1.CommandLineAction {
|
||||
constructor(parser) {
|
||||
super({
|
||||
actionName: 'run',
|
||||
summary: 'Invoke API Extractor on a project',
|
||||
documentation: 'Invoke API Extractor on a project'
|
||||
});
|
||||
this._configFileParameter = this.defineStringParameter({
|
||||
parameterLongName: '--config',
|
||||
parameterShortName: '-c',
|
||||
argumentName: 'FILE',
|
||||
description: `Use the specified ${ExtractorConfig_1.ExtractorConfig.FILENAME} file path, rather than guessing its location`
|
||||
});
|
||||
this._localParameter = this.defineFlagParameter({
|
||||
parameterLongName: '--local',
|
||||
parameterShortName: '-l',
|
||||
description: 'Indicates that API Extractor is running as part of a local build,' +
|
||||
" e.g. on a developer's machine. This disables certain validation that would" +
|
||||
' normally be performed for a ship/production build. For example, the *.api.md' +
|
||||
' report file is automatically copied in a local build.'
|
||||
});
|
||||
this._verboseParameter = this.defineFlagParameter({
|
||||
parameterLongName: '--verbose',
|
||||
parameterShortName: '-v',
|
||||
description: 'Show additional informational messages in the output.'
|
||||
});
|
||||
this._diagnosticsParameter = this.defineFlagParameter({
|
||||
parameterLongName: '--diagnostics',
|
||||
description: 'Show diagnostic messages used for troubleshooting problems with API Extractor.' +
|
||||
' This flag also enables the "--verbose" flag.'
|
||||
});
|
||||
this._typescriptCompilerFolder = this.defineStringParameter({
|
||||
parameterLongName: '--typescript-compiler-folder',
|
||||
argumentName: 'PATH',
|
||||
description: 'API Extractor uses its own TypeScript compiler engine to analyze your project. If your project' +
|
||||
' is built with a significantly different TypeScript version, sometimes API Extractor may report compilation' +
|
||||
' errors due to differences in the system typings (e.g. lib.dom.d.ts). You can use the' +
|
||||
' "--typescriptCompilerFolder" option to specify the folder path where you installed the TypeScript package,' +
|
||||
" and API Extractor's compiler will use those system typings instead."
|
||||
});
|
||||
}
|
||||
async onExecute() {
|
||||
// override
|
||||
const lookup = new node_core_library_1.PackageJsonLookup();
|
||||
let configFilename;
|
||||
let typescriptCompilerFolder = this._typescriptCompilerFolder.value;
|
||||
if (typescriptCompilerFolder) {
|
||||
typescriptCompilerFolder = path.normalize(typescriptCompilerFolder);
|
||||
if (node_core_library_1.FileSystem.exists(typescriptCompilerFolder)) {
|
||||
typescriptCompilerFolder = lookup.tryGetPackageFolderFor(typescriptCompilerFolder);
|
||||
const typescriptCompilerPackageJson = typescriptCompilerFolder
|
||||
? lookup.tryLoadPackageJsonFor(typescriptCompilerFolder)
|
||||
: undefined;
|
||||
if (!typescriptCompilerPackageJson) {
|
||||
throw new Error(`The path specified in the ${this._typescriptCompilerFolder.longName} parameter is not a package.`);
|
||||
}
|
||||
else if (typescriptCompilerPackageJson.name !== 'typescript') {
|
||||
throw new Error(`The path specified in the ${this._typescriptCompilerFolder.longName} parameter is not a TypeScript` +
|
||||
' compiler package.');
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Error(`The path specified in the ${this._typescriptCompilerFolder.longName} parameter does not exist.`);
|
||||
}
|
||||
}
|
||||
let extractorConfig;
|
||||
if (this._configFileParameter.value) {
|
||||
configFilename = path.normalize(this._configFileParameter.value);
|
||||
if (!node_core_library_1.FileSystem.exists(configFilename)) {
|
||||
throw new Error('Config file not found: ' + this._configFileParameter.value);
|
||||
}
|
||||
extractorConfig = ExtractorConfig_1.ExtractorConfig.loadFileAndPrepare(configFilename);
|
||||
}
|
||||
else {
|
||||
const prepareOptions = ExtractorConfig_1.ExtractorConfig.tryLoadForFolder({
|
||||
startingFolder: '.'
|
||||
});
|
||||
if (!prepareOptions || !prepareOptions.configObjectFullPath) {
|
||||
throw new Error(`Unable to find an ${ExtractorConfig_1.ExtractorConfig.FILENAME} file`);
|
||||
}
|
||||
const configObjectShortPath = node_core_library_1.Path.formatConcisely({
|
||||
pathToConvert: prepareOptions.configObjectFullPath,
|
||||
baseFolder: process.cwd()
|
||||
});
|
||||
console.log(`Using configuration from ${configObjectShortPath}`);
|
||||
extractorConfig = ExtractorConfig_1.ExtractorConfig.prepare(prepareOptions);
|
||||
}
|
||||
const extractorResult = Extractor_1.Extractor.invoke(extractorConfig, {
|
||||
localBuild: this._localParameter.value,
|
||||
showVerboseMessages: this._verboseParameter.value,
|
||||
showDiagnostics: this._diagnosticsParameter.value,
|
||||
typescriptCompilerFolder: typescriptCompilerFolder
|
||||
});
|
||||
if (extractorResult.succeeded) {
|
||||
console.log(os.EOL + 'API Extractor completed successfully');
|
||||
}
|
||||
else {
|
||||
process.exitCode = 1;
|
||||
if (extractorResult.errorCount > 0) {
|
||||
console.log(os.EOL + colors_1.default.red('API Extractor completed with errors'));
|
||||
}
|
||||
else {
|
||||
console.log(os.EOL + colors_1.default.yellow('API Extractor completed with warnings'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.RunAction = RunAction;
|
||||
//# sourceMappingURL=RunAction.js.map
|
1
node_modules/@microsoft/api-extractor/lib/cli/RunAction.js.map
generated
vendored
Normal file
1
node_modules/@microsoft/api-extractor/lib/cli/RunAction.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user