@microsoft/api-documenter 7.23.10 → 7.23.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/LICENSE +23 -23
  2. package/README.md +19 -19
  3. package/bin/api-documenter +2 -2
  4. package/dist/tsdoc-metadata.json +1 -1
  5. package/lib/cli/ApiDocumenterCommandLine.js.map +1 -1
  6. package/lib/cli/BaseAction.js.map +1 -1
  7. package/lib/cli/GenerateAction.js.map +1 -1
  8. package/lib/cli/MarkdownAction.js.map +1 -1
  9. package/lib/cli/YamlAction.js.map +1 -1
  10. package/lib/documenters/DocumenterConfig.js.map +1 -1
  11. package/lib/documenters/ExperimentalYamlDocumenter.js.map +1 -1
  12. package/lib/documenters/IConfigFile.js.map +1 -1
  13. package/lib/documenters/MarkdownDocumenter.js.map +1 -1
  14. package/lib/documenters/OfficeYamlDocumenter.js.map +1 -1
  15. package/lib/documenters/YamlDocumenter.js.map +1 -1
  16. package/lib/index.js.map +1 -1
  17. package/lib/markdown/CustomMarkdownEmitter.js.map +1 -1
  18. package/lib/markdown/MarkdownEmitter.js.map +1 -1
  19. package/lib/nodes/CustomDocNodeKind.js.map +1 -1
  20. package/lib/nodes/DocEmphasisSpan.js.map +1 -1
  21. package/lib/nodes/DocHeading.js.map +1 -1
  22. package/lib/nodes/DocNoteBox.js.map +1 -1
  23. package/lib/nodes/DocTable.js.map +1 -1
  24. package/lib/nodes/DocTableCell.js.map +1 -1
  25. package/lib/nodes/DocTableRow.js.map +1 -1
  26. package/lib/plugin/IApiDocumenterPluginManifest.js.map +1 -1
  27. package/lib/plugin/MarkdownDocumenterAccessor.js.map +1 -1
  28. package/lib/plugin/MarkdownDocumenterFeature.js.map +1 -1
  29. package/lib/plugin/PluginFeature.js.map +1 -1
  30. package/lib/plugin/PluginLoader.js.map +1 -1
  31. package/lib/schemas/api-documenter-template.json +99 -99
  32. package/lib/schemas/api-documenter.schema.json +47 -47
  33. package/lib/start.js.map +1 -1
  34. package/lib/utils/IndentedWriter.js.map +1 -1
  35. package/lib/utils/ToSdpConvertHelper.js.map +1 -1
  36. package/lib/utils/Utilities.js.map +1 -1
  37. package/lib/yaml/ISDPYamlFile.js.map +1 -1
  38. package/lib/yaml/IYamlApiFile.js.map +1 -1
  39. package/lib/yaml/IYamlTocFile.js.map +1 -1
  40. package/lib/yaml/typescript.schema.json +643 -643
  41. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownDocumenterAccessor.js","sourceRoot":"","sources":["../../src/plugin/MarkdownDocumenterAccessor.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAS3D;;;;;;;;GAQG;AACH,MAAa,0BAA0B;IAGrC,gBAAgB;IAChB,YAAmB,cAAyD;QAC1E,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,OAAgB;QACvC,OAAO,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;CACF;AAhBD,gEAgBC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport type { ApiItem } from '@microsoft/api-extractor-model';\r\n\r\n/** @internal */\r\nexport interface IMarkdownDocumenterAccessorImplementation {\r\n getLinkForApiItem(apiItem: ApiItem): string | undefined;\r\n}\r\n\r\n/**\r\n * Provides access to the documenter that is generating the output.\r\n *\r\n * @privateRemarks\r\n * This class is wrapper that provides access to the underlying MarkdownDocumenter, while hiding the implementation\r\n * details to ensure that the plugin API contract is stable.\r\n *\r\n * @public\r\n */\r\nexport class MarkdownDocumenterAccessor {\r\n private _implementation: IMarkdownDocumenterAccessorImplementation;\r\n\r\n /** @internal */\r\n public constructor(implementation: IMarkdownDocumenterAccessorImplementation) {\r\n this._implementation = implementation;\r\n }\r\n\r\n /**\r\n * For a given `ApiItem`, return its markdown hyperlink.\r\n *\r\n * @returns The hyperlink, or `undefined` if the `ApiItem` object does not have a hyperlink.\r\n */\r\n public getLinkForApiItem(apiItem: ApiItem): string | undefined {\r\n return this._implementation.getLinkForApiItem(apiItem);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"MarkdownDocumenterAccessor.js","sourceRoot":"","sources":["../../src/plugin/MarkdownDocumenterAccessor.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAS3D;;;;;;;;GAQG;AACH,MAAa,0BAA0B;IAGrC,gBAAgB;IAChB,YAAmB,cAAyD;QAC1E,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,OAAgB;QACvC,OAAO,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;CACF;AAhBD,gEAgBC","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 type { ApiItem } from '@microsoft/api-extractor-model';\n\n/** @internal */\nexport interface IMarkdownDocumenterAccessorImplementation {\n getLinkForApiItem(apiItem: ApiItem): string | undefined;\n}\n\n/**\n * Provides access to the documenter that is generating the output.\n *\n * @privateRemarks\n * This class is wrapper that provides access to the underlying MarkdownDocumenter, while hiding the implementation\n * details to ensure that the plugin API contract is stable.\n *\n * @public\n */\nexport class MarkdownDocumenterAccessor {\n private _implementation: IMarkdownDocumenterAccessorImplementation;\n\n /** @internal */\n public constructor(implementation: IMarkdownDocumenterAccessorImplementation) {\n this._implementation = implementation;\n }\n\n /**\n * For a given `ApiItem`, return its markdown hyperlink.\n *\n * @returns The hyperlink, or `undefined` if the `ApiItem` object does not have a hyperlink.\n */\n public getLinkForApiItem(apiItem: ApiItem): string | undefined {\n return this._implementation.getLinkForApiItem(apiItem);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownDocumenterFeature.js","sourceRoot":"","sources":["../../src/plugin/MarkdownDocumenterFeature.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,oEAAwD;AACxD,mDAAgD;AAGhD;;;;;GAKG;AACH,MAAa,gCAAgC;IAgB3C,gBAAgB;IAChB,YAAmB,OAAyC;QAC1D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACvC,CAAC;CACF;AAtBD,4EAsBC;AA8BD,MAAM,6BAA6B,GAAW,sCAAsC,CAAC;AAErF;;;;;GAKG;AACH,MAAa,yBAA0B,SAAQ,6BAAa;IAI1D;;;;OAIG;IACI,iBAAiB,CAAC,SAA0D;QACjF,+BAA+B;IACjC,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,SAAmD;QACnE,+BAA+B;IACjC,CAAC;IAEM,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,QAAgB;QACjD,OAAO,4BAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,6BAA6B,CAAC,CAAC;IACxE,CAAC;CACF;AAxBD,8DAwBC;AAED,4BAAQ,CAAC,aAAa,CAAC,yBAAyB,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';\r\nimport { TypeUuid } from '@rushstack/node-core-library';\r\nimport { PluginFeature } from './PluginFeature';\r\nimport type { MarkdownDocumenterAccessor } from './MarkdownDocumenterAccessor';\r\n\r\n/**\r\n * Context object for {@link MarkdownDocumenterFeature}.\r\n * Exposes various services that can be used by a plugin.\r\n *\r\n * @public\r\n */\r\nexport class MarkdownDocumenterFeatureContext {\r\n /**\r\n * Provides access to the `ApiModel` for the documentation being generated.\r\n */\r\n public readonly apiModel: ApiModel;\r\n\r\n /**\r\n * The full path to the output folder.\r\n */\r\n public readonly outputFolder: string;\r\n\r\n /**\r\n * Exposes functionality of the documenter.\r\n */\r\n public readonly documenter: MarkdownDocumenterAccessor;\r\n\r\n /** @internal */\r\n public constructor(options: MarkdownDocumenterFeatureContext) {\r\n this.apiModel = options.apiModel;\r\n this.outputFolder = options.outputFolder;\r\n this.documenter = options.documenter;\r\n }\r\n}\r\n\r\n/**\r\n * Event arguments for MarkdownDocumenterFeature.onBeforeWritePage()\r\n * @public\r\n */\r\nexport interface IMarkdownDocumenterFeatureOnBeforeWritePageArgs {\r\n /**\r\n * The API item corresponding to this page.\r\n */\r\n readonly apiItem: ApiItem;\r\n\r\n /**\r\n * The page content. The {@link MarkdownDocumenterFeature.onBeforeWritePage} handler can reassign this\r\n * string to customize the page appearance.\r\n */\r\n pageContent: string;\r\n\r\n /**\r\n * The filename where the output will be written.\r\n */\r\n readonly outputFilename: string;\r\n}\r\n\r\n/**\r\n * Event arguments for MarkdownDocumenterFeature.onFinished()\r\n * @public\r\n */\r\nexport interface IMarkdownDocumenterFeatureOnFinishedArgs {}\r\n\r\nconst uuidMarkdownDocumenterFeature: string = '34196154-9eb3-4de0-a8c8-7e9539dfe216';\r\n\r\n/**\r\n * Inherit from this base class to implement an API Documenter plugin feature that customizes\r\n * the generation of markdown output.\r\n *\r\n * @public\r\n */\r\nexport class MarkdownDocumenterFeature extends PluginFeature {\r\n /** {@inheritdoc PluginFeature.context} */\r\n public context!: MarkdownDocumenterFeatureContext;\r\n\r\n /**\r\n * This event occurs before each markdown file is written. It provides an opportunity to customize the\r\n * content of the file.\r\n * @virtual\r\n */\r\n public onBeforeWritePage(eventArgs: IMarkdownDocumenterFeatureOnBeforeWritePageArgs): void {\r\n // (implemented by child class)\r\n }\r\n\r\n /**\r\n * This event occurs after all output files have been written.\r\n * @virtual\r\n */\r\n public onFinished(eventArgs: IMarkdownDocumenterFeatureOnFinishedArgs): void {\r\n // (implemented by child class)\r\n }\r\n\r\n public static [Symbol.hasInstance](instance: object): boolean {\r\n return TypeUuid.isInstanceOf(instance, uuidMarkdownDocumenterFeature);\r\n }\r\n}\r\n\r\nTypeUuid.registerClass(MarkdownDocumenterFeature, uuidMarkdownDocumenterFeature);\r\n"]}
1
+ {"version":3,"file":"MarkdownDocumenterFeature.js","sourceRoot":"","sources":["../../src/plugin/MarkdownDocumenterFeature.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,oEAAwD;AACxD,mDAAgD;AAGhD;;;;;GAKG;AACH,MAAa,gCAAgC;IAgB3C,gBAAgB;IAChB,YAAmB,OAAyC;QAC1D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACvC,CAAC;CACF;AAtBD,4EAsBC;AA8BD,MAAM,6BAA6B,GAAW,sCAAsC,CAAC;AAErF;;;;;GAKG;AACH,MAAa,yBAA0B,SAAQ,6BAAa;IAI1D;;;;OAIG;IACI,iBAAiB,CAAC,SAA0D;QACjF,+BAA+B;IACjC,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,SAAmD;QACnE,+BAA+B;IACjC,CAAC;IAEM,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,QAAgB;QACjD,OAAO,4BAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,6BAA6B,CAAC,CAAC;IACxE,CAAC;CACF;AAxBD,8DAwBC;AAED,4BAAQ,CAAC,aAAa,CAAC,yBAAyB,EAAE,6BAA6B,CAAC,CAAC","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 type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';\nimport { TypeUuid } from '@rushstack/node-core-library';\nimport { PluginFeature } from './PluginFeature';\nimport type { MarkdownDocumenterAccessor } from './MarkdownDocumenterAccessor';\n\n/**\n * Context object for {@link MarkdownDocumenterFeature}.\n * Exposes various services that can be used by a plugin.\n *\n * @public\n */\nexport class MarkdownDocumenterFeatureContext {\n /**\n * Provides access to the `ApiModel` for the documentation being generated.\n */\n public readonly apiModel: ApiModel;\n\n /**\n * The full path to the output folder.\n */\n public readonly outputFolder: string;\n\n /**\n * Exposes functionality of the documenter.\n */\n public readonly documenter: MarkdownDocumenterAccessor;\n\n /** @internal */\n public constructor(options: MarkdownDocumenterFeatureContext) {\n this.apiModel = options.apiModel;\n this.outputFolder = options.outputFolder;\n this.documenter = options.documenter;\n }\n}\n\n/**\n * Event arguments for MarkdownDocumenterFeature.onBeforeWritePage()\n * @public\n */\nexport interface IMarkdownDocumenterFeatureOnBeforeWritePageArgs {\n /**\n * The API item corresponding to this page.\n */\n readonly apiItem: ApiItem;\n\n /**\n * The page content. The {@link MarkdownDocumenterFeature.onBeforeWritePage} handler can reassign this\n * string to customize the page appearance.\n */\n pageContent: string;\n\n /**\n * The filename where the output will be written.\n */\n readonly outputFilename: string;\n}\n\n/**\n * Event arguments for MarkdownDocumenterFeature.onFinished()\n * @public\n */\nexport interface IMarkdownDocumenterFeatureOnFinishedArgs {}\n\nconst uuidMarkdownDocumenterFeature: string = '34196154-9eb3-4de0-a8c8-7e9539dfe216';\n\n/**\n * Inherit from this base class to implement an API Documenter plugin feature that customizes\n * the generation of markdown output.\n *\n * @public\n */\nexport class MarkdownDocumenterFeature extends PluginFeature {\n /** {@inheritdoc PluginFeature.context} */\n public context!: MarkdownDocumenterFeatureContext;\n\n /**\n * This event occurs before each markdown file is written. It provides an opportunity to customize the\n * content of the file.\n * @virtual\n */\n public onBeforeWritePage(eventArgs: IMarkdownDocumenterFeatureOnBeforeWritePageArgs): void {\n // (implemented by child class)\n }\n\n /**\n * This event occurs after all output files have been written.\n * @virtual\n */\n public onFinished(eventArgs: IMarkdownDocumenterFeatureOnFinishedArgs): void {\n // (implemented by child class)\n }\n\n public static [Symbol.hasInstance](instance: object): boolean {\n return TypeUuid.isInstanceOf(instance, uuidMarkdownDocumenterFeature);\n }\n}\n\nTypeUuid.registerClass(MarkdownDocumenterFeature, uuidMarkdownDocumenterFeature);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PluginFeature.js","sourceRoot":"","sources":["../../src/plugin/PluginFeature.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAwD;AAExD;;;;;;;GAOG;AACH,MAAa,2BAA2B;IAItC,gBAAgB;IAChB;QACE,0BAA0B;IAC5B,CAAC;CACF;AARD,kEAQC;AAED;;;;;GAKG;AACH,MAAa,oBAAoB;CAAG;AAApC,oDAAoC;AAEpC,MAAM,iBAAiB,GAAW,sCAAsC,CAAC;AAEzE;;;GAGG;AACH,MAAsB,aAAa;IAMjC;;;;;OAKG;IACH,YAAmB,cAA2C;QAC5D,gCAAgC;QAChC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC;IACzC,CAAC;IAED;;;OAGG;IACI,aAAa;QAClB,+BAA+B;IACjC,CAAC;IAEM,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,QAAgB;QACjD,OAAO,4BAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAC5D,CAAC;CACF;AA5BD,sCA4BC;AAED,4BAAQ,CAAC,aAAa,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { TypeUuid } from '@rushstack/node-core-library';\r\n\r\n/**\r\n * This is an internal part of the plugin infrastructure.\r\n *\r\n * @remarks\r\n * This object is the constructor parameter for API Documenter plugin features.\r\n *\r\n * @public\r\n */\r\nexport class PluginFeatureInitialization {\r\n /** @internal */\r\n public _context!: PluginFeatureContext;\r\n\r\n /** @internal */\r\n public constructor() {\r\n // reserved for future use\r\n }\r\n}\r\n\r\n/**\r\n * Context object for {@link PluginFeature}.\r\n * Exposes various services that can be used by a plugin.\r\n *\r\n * @public\r\n */\r\nexport class PluginFeatureContext {}\r\n\r\nconst uuidPluginFeature: string = '56876472-7134-4812-819e-533de0ee10e6';\r\n\r\n/**\r\n * The abstract base class for all API Documenter plugin features.\r\n * @public\r\n */\r\nexport abstract class PluginFeature {\r\n /**\r\n * Exposes various services that can be used by a plugin.\r\n */\r\n public context: PluginFeatureContext;\r\n\r\n /**\r\n * The subclass should pass the `initialization` through to the base class.\r\n * Do not put custom initialization code in the constructor. Instead perform your initialization in the\r\n * `onInitialized()` event function.\r\n * @internal\r\n */\r\n public constructor(initialization: PluginFeatureInitialization) {\r\n // reserved for future expansion\r\n this.context = initialization._context;\r\n }\r\n\r\n /**\r\n * This event function is called after the feature is initialized, but before any processing occurs.\r\n * @virtual\r\n */\r\n public onInitialized(): void {\r\n // (implemented by child class)\r\n }\r\n\r\n public static [Symbol.hasInstance](instance: object): boolean {\r\n return TypeUuid.isInstanceOf(instance, uuidPluginFeature);\r\n }\r\n}\r\n\r\nTypeUuid.registerClass(PluginFeature, uuidPluginFeature);\r\n"]}
1
+ {"version":3,"file":"PluginFeature.js","sourceRoot":"","sources":["../../src/plugin/PluginFeature.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAwD;AAExD;;;;;;;GAOG;AACH,MAAa,2BAA2B;IAItC,gBAAgB;IAChB;QACE,0BAA0B;IAC5B,CAAC;CACF;AARD,kEAQC;AAED;;;;;GAKG;AACH,MAAa,oBAAoB;CAAG;AAApC,oDAAoC;AAEpC,MAAM,iBAAiB,GAAW,sCAAsC,CAAC;AAEzE;;;GAGG;AACH,MAAsB,aAAa;IAMjC;;;;;OAKG;IACH,YAAmB,cAA2C;QAC5D,gCAAgC;QAChC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC;IACzC,CAAC;IAED;;;OAGG;IACI,aAAa;QAClB,+BAA+B;IACjC,CAAC;IAEM,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,QAAgB;QACjD,OAAO,4BAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAC5D,CAAC;CACF;AA5BD,sCA4BC;AAED,4BAAQ,CAAC,aAAa,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC","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 { TypeUuid } from '@rushstack/node-core-library';\n\n/**\n * This is an internal part of the plugin infrastructure.\n *\n * @remarks\n * This object is the constructor parameter for API Documenter plugin features.\n *\n * @public\n */\nexport class PluginFeatureInitialization {\n /** @internal */\n public _context!: PluginFeatureContext;\n\n /** @internal */\n public constructor() {\n // reserved for future use\n }\n}\n\n/**\n * Context object for {@link PluginFeature}.\n * Exposes various services that can be used by a plugin.\n *\n * @public\n */\nexport class PluginFeatureContext {}\n\nconst uuidPluginFeature: string = '56876472-7134-4812-819e-533de0ee10e6';\n\n/**\n * The abstract base class for all API Documenter plugin features.\n * @public\n */\nexport abstract class PluginFeature {\n /**\n * Exposes various services that can be used by a plugin.\n */\n public context: PluginFeatureContext;\n\n /**\n * The subclass should pass the `initialization` through to the base class.\n * Do not put custom initialization code in the constructor. Instead perform your initialization in the\n * `onInitialized()` event function.\n * @internal\n */\n public constructor(initialization: PluginFeatureInitialization) {\n // reserved for future expansion\n this.context = initialization._context;\n }\n\n /**\n * This event function is called after the feature is initialized, but before any processing occurs.\n * @virtual\n */\n public onInitialized(): void {\n // (implemented by child class)\n }\n\n public static [Symbol.hasInstance](instance: object): boolean {\n return TypeUuid.isInstanceOf(instance, uuidPluginFeature);\n }\n}\n\nTypeUuid.registerClass(PluginFeature, uuidPluginFeature);\n"]}
@@ -1 +1 @@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I,KAAK,CAAC,qCAAqC,iBAAiB,CAAC,IAAI,GAAG,CAAC,CAAC;qBACjF;iBACF;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,IAAI,KAAK,CAAC,wBAAwB,YAAY,CAAC,WAAW,IAAI,GAAI,CAAW,CAAC,OAAO,CAAC,CAAC;aAC9F;SACF;IACH,CAAC;CACF;AA/FD,oCA+FC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport * as path from 'path';\r\nimport * as resolve from 'resolve';\r\n\r\nimport type { IApiDocumenterPluginManifest, IFeatureDefinition } from './IApiDocumenterPluginManifest';\r\nimport {\r\n MarkdownDocumenterFeature,\r\n type MarkdownDocumenterFeatureContext\r\n} from './MarkdownDocumenterFeature';\r\nimport { PluginFeatureInitialization } from './PluginFeature';\r\nimport type { DocumenterConfig } from '../documenters/DocumenterConfig';\r\n\r\ninterface ILoadedPlugin {\r\n packageName: string;\r\n manifest: IApiDocumenterPluginManifest;\r\n}\r\n\r\nexport class PluginLoader {\r\n public markdownDocumenterFeature: MarkdownDocumenterFeature | undefined;\r\n\r\n public load(\r\n documenterConfig: DocumenterConfig,\r\n createContext: () => MarkdownDocumenterFeatureContext\r\n ): void {\r\n const configFileFolder: string = path.dirname(documenterConfig.configFilePath);\r\n for (const configPlugin of documenterConfig.configFile.plugins || []) {\r\n try {\r\n // Look for the package name in the same place as the config file\r\n const resolvedEntryPointPath: string = resolve.sync(configPlugin.packageName, {\r\n basedir: configFileFolder\r\n });\r\n\r\n // Load the package\r\n const entryPoint:\r\n | { apiDocumenterPluginManifest?: IApiDocumenterPluginManifest }\r\n | undefined = require(resolvedEntryPointPath);\r\n\r\n if (!entryPoint) {\r\n throw new Error('Invalid entry point');\r\n }\r\n\r\n if (!entryPoint.apiDocumenterPluginManifest) {\r\n throw new Error(\r\n `The package is not an API documenter plugin;` +\r\n ` the \"apiDocumenterPluginManifest\" export was not found`\r\n );\r\n }\r\n\r\n const manifest: IApiDocumenterPluginManifest = entryPoint.apiDocumenterPluginManifest;\r\n\r\n if (manifest.manifestVersion !== 1000) {\r\n throw new Error(\r\n `The plugin is not compatible with this version of API Documenter;` +\r\n ` unsupported manifestVersion`\r\n );\r\n }\r\n\r\n const loadedPlugin: ILoadedPlugin = {\r\n packageName: configPlugin.packageName,\r\n manifest\r\n };\r\n\r\n const featureDefinitionsByName: Map<string, IFeatureDefinition> = new Map<\r\n string,\r\n IFeatureDefinition\r\n >();\r\n for (const featureDefinition of manifest.features) {\r\n featureDefinitionsByName.set(featureDefinition.featureName, featureDefinition);\r\n }\r\n\r\n for (const featureName of configPlugin.enabledFeatureNames) {\r\n const featureDefinition: IFeatureDefinition | undefined = featureDefinitionsByName.get(featureName);\r\n if (!featureDefinition) {\r\n throw new Error(\r\n `The plugin ${loadedPlugin.packageName} does not have a feature with name \"${featureName}\"`\r\n );\r\n }\r\n\r\n if (featureDefinition.kind === 'MarkdownDocumenterFeature') {\r\n if (this.markdownDocumenterFeature) {\r\n throw new Error('A MarkdownDocumenterFeature is already loaded');\r\n }\r\n\r\n const initialization: PluginFeatureInitialization = new PluginFeatureInitialization();\r\n initialization._context = createContext();\r\n\r\n let markdownDocumenterFeature: MarkdownDocumenterFeature | undefined = undefined;\r\n try {\r\n markdownDocumenterFeature = new featureDefinition.subclass(initialization);\r\n } catch (e) {\r\n throw new Error(`Failed to construct feature subclass:\\n` + (e as Error).toString());\r\n }\r\n if (!(markdownDocumenterFeature instanceof MarkdownDocumenterFeature)) {\r\n throw new Error('The constructed subclass was not an instance of MarkdownDocumenterFeature');\r\n }\r\n\r\n try {\r\n markdownDocumenterFeature.onInitialized();\r\n } catch (e) {\r\n throw new Error('Error occurred during the onInitialized() event: ' + (e as Error).toString());\r\n }\r\n\r\n this.markdownDocumenterFeature = markdownDocumenterFeature;\r\n } else {\r\n throw new Error(`Unknown feature definition kind: \"${featureDefinition.kind}\"`);\r\n }\r\n }\r\n } catch (e) {\r\n throw new Error(`Error loading plugin ${configPlugin.packageName}: ` + (e as Error).message);\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PluginLoader.js","sourceRoot":"","sources":["../../src/plugin/PluginLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,iDAAmC;AAGnC,2EAGqC;AACrC,mDAA8D;AAQ9D,MAAa,YAAY;IAGhB,IAAI,CACT,gBAAkC,EAClC,aAAqD;QAErD,MAAM,gBAAgB,GAAW,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC/E,KAAK,MAAM,YAAY,IAAI,gBAAgB,CAAC,UAAU,CAAC,OAAO,IAAI,EAAE,EAAE;YACpE,IAAI;gBACF,iEAAiE;gBACjE,MAAM,sBAAsB,GAAW,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE;oBAC5E,OAAO,EAAE,gBAAgB;iBAC1B,CAAC,CAAC;gBAEH,mBAAmB;gBACnB,MAAM,UAAU,GAEA,OAAO,CAAC,sBAAsB,CAAC,CAAC;gBAEhD,IAAI,CAAC,UAAU,EAAE;oBACf,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;iBACxC;gBAED,IAAI,CAAC,UAAU,CAAC,2BAA2B,EAAE;oBAC3C,MAAM,IAAI,KAAK,CACb,8CAA8C;wBAC5C,yDAAyD,CAC5D,CAAC;iBACH;gBAED,MAAM,QAAQ,GAAiC,UAAU,CAAC,2BAA2B,CAAC;gBAEtF,IAAI,QAAQ,CAAC,eAAe,KAAK,IAAI,EAAE;oBACrC,MAAM,IAAI,KAAK,CACb,mEAAmE;wBACjE,8BAA8B,CACjC,CAAC;iBACH;gBAED,MAAM,YAAY,GAAkB;oBAClC,WAAW,EAAE,YAAY,CAAC,WAAW;oBACrC,QAAQ;iBACT,CAAC;gBAEF,MAAM,wBA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C;yBAChG;wBAED,IAAI,CAAC,yBAAyB,GAAG,yBAAyB,CAAC;qBAC5D;yBAAM;wBACL,MAAM,IAAI,KAAK,CAAC,qCAAqC,iBAAiB,CAAC,IAAI,GAAG,CAAC,CAAC;qBACjF;iBACF;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,IAAI,KAAK,CAAC,wBAAwB,YAAY,CAAC,WAAW,IAAI,GAAI,CAAW,CAAC,OAAO,CAAC,CAAC;aAC9F;SACF;IACH,CAAC;CACF;AA/FD,oCA+FC","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 * as path from 'path';\nimport * as resolve from 'resolve';\n\nimport type { IApiDocumenterPluginManifest, IFeatureDefinition } from './IApiDocumenterPluginManifest';\nimport {\n MarkdownDocumenterFeature,\n type MarkdownDocumenterFeatureContext\n} from './MarkdownDocumenterFeature';\nimport { PluginFeatureInitialization } from './PluginFeature';\nimport type { DocumenterConfig } from '../documenters/DocumenterConfig';\n\ninterface ILoadedPlugin {\n packageName: string;\n manifest: IApiDocumenterPluginManifest;\n}\n\nexport class PluginLoader {\n public markdownDocumenterFeature: MarkdownDocumenterFeature | undefined;\n\n public load(\n documenterConfig: DocumenterConfig,\n createContext: () => MarkdownDocumenterFeatureContext\n ): void {\n const configFileFolder: string = path.dirname(documenterConfig.configFilePath);\n for (const configPlugin of documenterConfig.configFile.plugins || []) {\n try {\n // Look for the package name in the same place as the config file\n const resolvedEntryPointPath: string = resolve.sync(configPlugin.packageName, {\n basedir: configFileFolder\n });\n\n // Load the package\n const entryPoint:\n | { apiDocumenterPluginManifest?: IApiDocumenterPluginManifest }\n | undefined = require(resolvedEntryPointPath);\n\n if (!entryPoint) {\n throw new Error('Invalid entry point');\n }\n\n if (!entryPoint.apiDocumenterPluginManifest) {\n throw new Error(\n `The package is not an API documenter plugin;` +\n ` the \"apiDocumenterPluginManifest\" export was not found`\n );\n }\n\n const manifest: IApiDocumenterPluginManifest = entryPoint.apiDocumenterPluginManifest;\n\n if (manifest.manifestVersion !== 1000) {\n throw new Error(\n `The plugin is not compatible with this version of API Documenter;` +\n ` unsupported manifestVersion`\n );\n }\n\n const loadedPlugin: ILoadedPlugin = {\n packageName: configPlugin.packageName,\n manifest\n };\n\n const featureDefinitionsByName: Map<string, IFeatureDefinition> = new Map<\n string,\n IFeatureDefinition\n >();\n for (const featureDefinition of manifest.features) {\n featureDefinitionsByName.set(featureDefinition.featureName, featureDefinition);\n }\n\n for (const featureName of configPlugin.enabledFeatureNames) {\n const featureDefinition: IFeatureDefinition | undefined = featureDefinitionsByName.get(featureName);\n if (!featureDefinition) {\n throw new Error(\n `The plugin ${loadedPlugin.packageName} does not have a feature with name \"${featureName}\"`\n );\n }\n\n if (featureDefinition.kind === 'MarkdownDocumenterFeature') {\n if (this.markdownDocumenterFeature) {\n throw new Error('A MarkdownDocumenterFeature is already loaded');\n }\n\n const initialization: PluginFeatureInitialization = new PluginFeatureInitialization();\n initialization._context = createContext();\n\n let markdownDocumenterFeature: MarkdownDocumenterFeature | undefined = undefined;\n try {\n markdownDocumenterFeature = new featureDefinition.subclass(initialization);\n } catch (e) {\n throw new Error(`Failed to construct feature subclass:\\n` + (e as Error).toString());\n }\n if (!(markdownDocumenterFeature instanceof MarkdownDocumenterFeature)) {\n throw new Error('The constructed subclass was not an instance of MarkdownDocumenterFeature');\n }\n\n try {\n markdownDocumenterFeature.onInitialized();\n } catch (e) {\n throw new Error('Error occurred during the onInitialized() event: ' + (e as Error).toString());\n }\n\n this.markdownDocumenterFeature = markdownDocumenterFeature;\n } else {\n throw new Error(`Unknown feature definition kind: \"${featureDefinition.kind}\"`);\n }\n }\n } catch (e) {\n throw new Error(`Error loading plugin ${configPlugin.packageName}: ` + (e as Error).message);\n }\n }\n }\n}\n"]}
@@ -1,99 +1,99 @@
1
- /**
2
- * Config file for API Documenter. For more info, please visit: https://api-extractor.com
3
- */
4
- {
5
- "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-documenter.schema.json",
6
-
7
- /**
8
- * Specifies the output target.
9
- * Supported values are "docfx" or "markdown"
10
- */
11
- // "outputTarget": "markdown",
12
-
13
- /**
14
- * Specifies what type of newlines API Documenter should use when writing output files. By default, the output files
15
- * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead.
16
- * To use the OS's default newline kind, specify "os".
17
- *
18
- * DEFAULT VALUE: "crlf"
19
- */
20
- // "newlineKind": "crlf",
21
-
22
- /**
23
- * This enables an experimental feature that will be officially released with the next major version
24
- * of API Documenter. It requires DocFX 2.46 or newer. It enables documentation for namespaces and
25
- * adds them to the table of contents. This will also affect file layout as namespaced items will be nested
26
- * under a directory for the namespace instead of just within the package.
27
- *
28
- * This setting currently only affects the 'docfx' output target. It is equivalent to the `--new-docfx-namespaces`
29
- * command-line parameter.
30
- */
31
- // "newDocfxNamespaces": false,
32
-
33
- /**
34
- * Describes plugin packages to be loaded, and which features to enable.
35
- */
36
- "plugins": [
37
- // {
38
- // "packageName": "doc-plugin-example",
39
- // "enabledFeatureNames": [ "example-feature" ]
40
- // }
41
- ],
42
-
43
- /**
44
- * Configures how the table of contents is generated.
45
- */
46
- "tableOfContents": {
47
- /**
48
- * Allows hand-coded items to be injected into the table of contents.
49
- *
50
- * DEFAULT VALUE: (none)
51
- */
52
- // "items": [
53
- // { "name": "Example Node", "href": "~/homepage/homepage.md" },
54
- // {
55
- // "name": "API Reference",
56
- // "items": [
57
- // { "name": "References" }
58
- // ]
59
- // }
60
- // ],
61
- /**
62
- * Optional category name that is recommended to include in the `tocConfig`,
63
- * along with one of the filters: `filterByApiItemName` or `filterByInlineTag`.
64
- * Any items that are not matched to the mentioned filters will be placed under this
65
- * catchAll category. If none provided the items will not be included in the final toc.yml file.
66
- *
67
- * DEFAULT VALUE: (none)
68
- */
69
- // "catchAllCategory": "References",
70
- /**
71
- * When loading more than one api.json files that might include the same API items,
72
- * toggle either to show duplicates or not.
73
- *
74
- * DEFAULT VALUE: false
75
- */
76
- // "noDuplicateEntries": true,
77
- /**
78
- * Toggle either sorting of the API items should be made based on category name presence
79
- * in the API item's name.
80
- *
81
- * DEFAULT VALUE: false
82
- */
83
- // "filterByApiItemName": false,
84
- /**
85
- * Filter that can be used to sort the API items according to an inline custom tag
86
- * that is present on them.
87
- *
88
- * DEFAULT VALUE: (none)
89
- */
90
- // "filterByInlineTag": "@docCategory"
91
- }
92
-
93
- /**
94
- * Specifies whether inherited members should also be shown on an API item's page.
95
- *
96
- * DEFAULT VALUE: false
97
- */
98
- // "showInheritedMembers": false
99
- }
1
+ /**
2
+ * Config file for API Documenter. For more info, please visit: https://api-extractor.com
3
+ */
4
+ {
5
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-documenter.schema.json",
6
+
7
+ /**
8
+ * Specifies the output target.
9
+ * Supported values are "docfx" or "markdown"
10
+ */
11
+ // "outputTarget": "markdown",
12
+
13
+ /**
14
+ * Specifies what type of newlines API Documenter should use when writing output files. By default, the output files
15
+ * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead.
16
+ * To use the OS's default newline kind, specify "os".
17
+ *
18
+ * DEFAULT VALUE: "crlf"
19
+ */
20
+ // "newlineKind": "crlf",
21
+
22
+ /**
23
+ * This enables an experimental feature that will be officially released with the next major version
24
+ * of API Documenter. It requires DocFX 2.46 or newer. It enables documentation for namespaces and
25
+ * adds them to the table of contents. This will also affect file layout as namespaced items will be nested
26
+ * under a directory for the namespace instead of just within the package.
27
+ *
28
+ * This setting currently only affects the 'docfx' output target. It is equivalent to the `--new-docfx-namespaces`
29
+ * command-line parameter.
30
+ */
31
+ // "newDocfxNamespaces": false,
32
+
33
+ /**
34
+ * Describes plugin packages to be loaded, and which features to enable.
35
+ */
36
+ "plugins": [
37
+ // {
38
+ // "packageName": "doc-plugin-example",
39
+ // "enabledFeatureNames": [ "example-feature" ]
40
+ // }
41
+ ],
42
+
43
+ /**
44
+ * Configures how the table of contents is generated.
45
+ */
46
+ "tableOfContents": {
47
+ /**
48
+ * Allows hand-coded items to be injected into the table of contents.
49
+ *
50
+ * DEFAULT VALUE: (none)
51
+ */
52
+ // "items": [
53
+ // { "name": "Example Node", "href": "~/homepage/homepage.md" },
54
+ // {
55
+ // "name": "API Reference",
56
+ // "items": [
57
+ // { "name": "References" }
58
+ // ]
59
+ // }
60
+ // ],
61
+ /**
62
+ * Optional category name that is recommended to include in the `tocConfig`,
63
+ * along with one of the filters: `filterByApiItemName` or `filterByInlineTag`.
64
+ * Any items that are not matched to the mentioned filters will be placed under this
65
+ * catchAll category. If none provided the items will not be included in the final toc.yml file.
66
+ *
67
+ * DEFAULT VALUE: (none)
68
+ */
69
+ // "catchAllCategory": "References",
70
+ /**
71
+ * When loading more than one api.json files that might include the same API items,
72
+ * toggle either to show duplicates or not.
73
+ *
74
+ * DEFAULT VALUE: false
75
+ */
76
+ // "noDuplicateEntries": true,
77
+ /**
78
+ * Toggle either sorting of the API items should be made based on category name presence
79
+ * in the API item's name.
80
+ *
81
+ * DEFAULT VALUE: false
82
+ */
83
+ // "filterByApiItemName": false,
84
+ /**
85
+ * Filter that can be used to sort the API items according to an inline custom tag
86
+ * that is present on them.
87
+ *
88
+ * DEFAULT VALUE: (none)
89
+ */
90
+ // "filterByInlineTag": "@docCategory"
91
+ }
92
+
93
+ /**
94
+ * Specifies whether inherited members should also be shown on an API item's page.
95
+ *
96
+ * DEFAULT VALUE: false
97
+ */
98
+ // "showInheritedMembers": false
99
+ }
@@ -1,47 +1,47 @@
1
- {
2
- "title": "API Documenter Configuration",
3
- "description": "Describes how the API Documenter tool will process a project.",
4
- "type": "object",
5
- "properties": {
6
- "$schema": {
7
- "description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
8
- "type": "string"
9
- },
10
-
11
- "outputTarget": {
12
- "description": "Specifies what type of documentation will be generated",
13
- "type": "string",
14
- "enum": ["docfx", "markdown"]
15
- },
16
-
17
- "newlineKind": {
18
- "description": "Specifies what type of newlines API Documenter should use when writing output files. By default, the output files will be written with Windows-style newlines. To use POSIX-style newlines, specify \"lf\" instead. To use the OS's default newline kind, specify \"os\".",
19
- "type": "string",
20
- "enum": ["crlf", "lf", "os"],
21
- "default": "crlf"
22
- },
23
-
24
- "newDocfxNamespaces": {
25
- "description": "This enables an experimental feature that will be officially released with the next major version of API Documenter. It requires DocFX 2.46 or newer. It enables documentation for namespaces and adds them to the table of contents. This will also affect file layout as namespaced items will be nested under a directory for the namespace instead of just within the package.",
26
- "type": "boolean"
27
- },
28
-
29
- "plugins": {
30
- "description": "Specifies plugin packages to be loaded",
31
- "type": "array"
32
- },
33
-
34
- "tableOfContents": {
35
- "description": "Configures how the table of contents is generated.",
36
- "type": "object",
37
- "additionalProperties": true
38
- },
39
-
40
- "showInheritedMembers": {
41
- "description": "Specifies whether inherited members should also be shown on an API item's page.",
42
- "type": "boolean"
43
- }
44
- },
45
-
46
- "additionalProperties": false
47
- }
1
+ {
2
+ "title": "API Documenter Configuration",
3
+ "description": "Describes how the API Documenter tool will process a project.",
4
+ "type": "object",
5
+ "properties": {
6
+ "$schema": {
7
+ "description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
8
+ "type": "string"
9
+ },
10
+
11
+ "outputTarget": {
12
+ "description": "Specifies what type of documentation will be generated",
13
+ "type": "string",
14
+ "enum": ["docfx", "markdown"]
15
+ },
16
+
17
+ "newlineKind": {
18
+ "description": "Specifies what type of newlines API Documenter should use when writing output files. By default, the output files will be written with Windows-style newlines. To use POSIX-style newlines, specify \"lf\" instead. To use the OS's default newline kind, specify \"os\".",
19
+ "type": "string",
20
+ "enum": ["crlf", "lf", "os"],
21
+ "default": "crlf"
22
+ },
23
+
24
+ "newDocfxNamespaces": {
25
+ "description": "This enables an experimental feature that will be officially released with the next major version of API Documenter. It requires DocFX 2.46 or newer. It enables documentation for namespaces and adds them to the table of contents. This will also affect file layout as namespaced items will be nested under a directory for the namespace instead of just within the package.",
26
+ "type": "boolean"
27
+ },
28
+
29
+ "plugins": {
30
+ "description": "Specifies plugin packages to be loaded",
31
+ "type": "array"
32
+ },
33
+
34
+ "tableOfContents": {
35
+ "description": "Configures how the table of contents is generated.",
36
+ "type": "object",
37
+ "additionalProperties": true
38
+ },
39
+
40
+ "showInheritedMembers": {
41
+ "description": "Specifies whether inherited members should also be shown on an API item's page.",
42
+ "type": "boolean"
43
+ }
44
+ },
45
+
46
+ "additionalProperties": false
47
+ }
package/lib/start.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,uCAAyB;AACzB,oDAA4B;AAE5B,oEAAiE;AAEjE,6EAA0E;AAE1E,MAAM,gBAAgB,GAAW,qCAAiB,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;AAEzF,OAAO,CAAC,GAAG,CACT,EAAE,CAAC,GAAG;IACJ,gBAAM,CAAC,IAAI,CAAC,kBAAkB,gBAAgB,GAAG,GAAG,gBAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAC7G,CAAC;AAEF,MAAM,MAAM,GAA6B,IAAI,mDAAwB,EAAE,CAAC;AAExE,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,8DAA8D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport * as os from 'os';\r\nimport colors from 'colors';\r\n\r\nimport { PackageJsonLookup } from '@rushstack/node-core-library';\r\n\r\nimport { ApiDocumenterCommandLine } from './cli/ApiDocumenterCommandLine';\r\n\r\nconst myPackageVersion: string = PackageJsonLookup.loadOwnPackageJson(__dirname).version;\r\n\r\nconsole.log(\r\n os.EOL +\r\n colors.bold(`api-documenter ${myPackageVersion} ` + colors.cyan(' - https://api-extractor.com/') + os.EOL)\r\n);\r\n\r\nconst parser: ApiDocumenterCommandLine = new ApiDocumenterCommandLine();\r\n\r\nparser.execute().catch(console.error); // CommandLineParser.execute() should never reject the promise\r\n"]}
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,uCAAyB;AACzB,oDAA4B;AAE5B,oEAAiE;AAEjE,6EAA0E;AAE1E,MAAM,gBAAgB,GAAW,qCAAiB,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;AAEzF,OAAO,CAAC,GAAG,CACT,EAAE,CAAC,GAAG;IACJ,gBAAM,CAAC,IAAI,CAAC,kBAAkB,gBAAgB,GAAG,GAAG,gBAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAC7G,CAAC;AAEF,MAAM,MAAM,GAA6B,IAAI,mDAAwB,EAAE,CAAC;AAExE,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,8DAA8D","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 * as os from 'os';\nimport colors from 'colors';\n\nimport { PackageJsonLookup } from '@rushstack/node-core-library';\n\nimport { ApiDocumenterCommandLine } from './cli/ApiDocumenterCommandLine';\n\nconst myPackageVersion: string = PackageJsonLookup.loadOwnPackageJson(__dirname).version;\n\nconsole.log(\n os.EOL +\n colors.bold(`api-documenter ${myPackageVersion} ` + colors.cyan(' - https://api-extractor.com/') + os.EOL)\n);\n\nconst parser: ApiDocumenterCommandLine = new ApiDocumenterCommandLine();\n\nparser.execute().catch(console.error); // CommandLineParser.execute() should never reject the promise\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IndentedWriter.js","sourceRoot":"","sources":["../../src/utils/IndentedWriter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAkF;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,cAAc;IAmBzB,YAAmB,OAAwB;QAlB3C;;;WAGG;QACI,wBAAmB,GAAW,IAAI,CAAC;QAexC,IAAI,CAAC,QAAQ,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,iCAAa,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QAEtE,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAChC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAE3B,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QAEtB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAC,YAAqB;QACzC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC7F,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACI,cAAc;QACnB,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;I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qB,GAAG,KAAK,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IACzB,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC;CACF;AAnPD,wCAmPC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { StringBuilder, type IStringBuilder } from '@rushstack/node-core-library';\r\n\r\n/**\r\n * A utility for writing indented text.\r\n *\r\n * @remarks\r\n *\r\n * Note that the indentation is inserted at the last possible opportunity.\r\n * For example, this code...\r\n *\r\n * ```ts\r\n * writer.write('begin\\n');\r\n * writer.increaseIndent();\r\n * writer.write('one\\ntwo\\n');\r\n * writer.decreaseIndent();\r\n * writer.increaseIndent();\r\n * writer.decreaseIndent();\r\n * writer.write('end');\r\n * ```\r\n *\r\n * ...would produce this output:\r\n *\r\n * ```\r\n * begin\r\n * one\r\n * two\r\n * end\r\n * ```\r\n */\r\nexport class IndentedWriter {\r\n /**\r\n * The text characters used to create one level of indentation.\r\n * Two spaces by default.\r\n */\r\n public defaultIndentPrefix: string = ' ';\r\n\r\n private readonly _builder: IStringBuilder;\r\n\r\n private _latestChunk: string | undefined;\r\n private _previousChunk: string | undefined;\r\n private _atStartOfLine: boolean;\r\n\r\n private readonly _indentStack: string[];\r\n private _indentText: string;\r\n\r\n private _beforeStack: string[];\r\n private _isWritingBeforeStack: boolean;\r\n\r\n public constructor(builder?: IStringBuilder) {\r\n this._builder = builder === undefined ? new StringBuilder() : builder;\r\n\r\n this._latestChunk = undefined;\r\n this._previousChunk = undefined;\r\n this._atStartOfLine = true;\r\n\r\n this._indentStack = [];\r\n this._indentText = '';\r\n\r\n this._beforeStack = [];\r\n this._isWritingBeforeStack = false;\r\n }\r\n\r\n /**\r\n * Retrieves the output that was built so far.\r\n */\r\n public getText(): string {\r\n return this._builder.toString();\r\n }\r\n\r\n public toString(): string {\r\n return this.getText();\r\n }\r\n\r\n /**\r\n * Increases the indentation. Normally the indentation is two spaces,\r\n * however an arbitrary prefix can optional be specified. (For example,\r\n * the prefix could be \"// \" to indent and comment simultaneously.)\r\n * Each call to IndentedWriter.increaseIndent() must be followed by a\r\n * corresponding call to IndentedWriter.decreaseIndent().\r\n */\r\n public increaseIndent(indentPrefix?: string): void {\r\n this._indentStack.push(indentPrefix !== undefined ? indentPrefix : this.defaultIndentPrefix);\r\n this._updateIndentText();\r\n }\r\n\r\n /**\r\n * Decreases the indentation, reverting the effect of the corresponding call\r\n * to IndentedWriter.increaseIndent().\r\n */\r\n public decreaseIndent(): void {\r\n this._indentStack.pop();\r\n this._updateIndentText();\r\n }\r\n\r\n /**\r\n * A shorthand for ensuring that increaseIndent()/decreaseIndent() occur\r\n * in pairs.\r\n */\r\n public indentScope(scope: () => void, indentPrefix?: string): void {\r\n this.increaseIndent(indentPrefix);\r\n scope();\r\n this.decreaseIndent();\r\n }\r\n\r\n /**\r\n * Adds a newline if the file pointer is not already at the start of the line (or start of the stream).\r\n */\r\n public ensureNewLine(): void {\r\n const lastCharacter: string = this.peekLastCharacter();\r\n if (lastCharacter !== '\\n' && lastCharacter !== '') {\r\n this._writeNewLine();\r\n }\r\n }\r\n\r\n /**\r\n * Adds up to two newlines to ensure that there is a blank line above the current line.\r\n */\r\n public ensureSkippedLine(): void {\r\n if (this.peekLastCharacter() !== '\\n') {\r\n this._writeNewLine();\r\n }\r\n\r\n const secondLastCharacter: string = this.peekSecondLastCharacter();\r\n if (secondLastCharacter !== '\\n' && secondLastCharacter !== '') {\r\n this._writeNewLine();\r\n }\r\n }\r\n\r\n /**\r\n * Returns the last character that was written, or an empty string if no characters have been written yet.\r\n */\r\n public peekLastCharacter(): string {\r\n if (this._latestChunk !== undefined) {\r\n return this._latestChunk.substr(-1, 1);\r\n }\r\n return '';\r\n }\r\n\r\n /**\r\n * Returns the second to last character that was written, or an empty string if less than one characters\r\n * have been written yet.\r\n */\r\n public peekSecondLastCharacter(): string {\r\n if (this._latestChunk !== undefined) {\r\n if (this._latestChunk.length > 1) {\r\n return this._latestChunk.substr(-2, 1);\r\n }\r\n if (this._previousChunk !== undefined) {\r\n return this._previousChunk.substr(-1, 1);\r\n }\r\n }\r\n return '';\r\n }\r\n\r\n /**\r\n * Writes `before` and `after` messages if and only if `mayWrite` writes anything.\r\n *\r\n * If `mayWrite` writes \"CONTENT\", this method will write \"<before>CONTENT<after>\".\r\n * If `mayWrite` writes nothing, this method will write nothing.\r\n */\r\n public writeTentative(before: string, after: string, mayWrite: () => void): void {\r\n this._beforeStack.push(before);\r\n\r\n // If this function writes anything, then _all_ messages in the \"before stack\" will also be\r\n // written. This means that the stack will be empty (as when we write a message from the stack,\r\n // we remove it from the stack).\r\n mayWrite();\r\n\r\n // If the stack is not empty, it means that `mayWrite` didn't write anything. Pop the last-\r\n // added message from the stack, we'll never write it. Otherwise, if the stack is empty, then\r\n // write the \"after\" message.\r\n if (this._beforeStack.length > 0) {\r\n this._beforeStack.pop();\r\n } else {\r\n this.write(after);\r\n }\r\n }\r\n\r\n /**\r\n * Writes some text to the internal string buffer, applying indentation according\r\n * to the current indentation level. If the string contains multiple newlines,\r\n * each line will be indented separately.\r\n */\r\n public write(message: string): void {\r\n if (message.length === 0) {\r\n return;\r\n }\r\n\r\n if (!this._isWritingBeforeStack) {\r\n this._writeBeforeStack();\r\n }\r\n\r\n // If there are no newline characters, then append the string verbatim\r\n if (!/[\\r\\n]/.test(message)) {\r\n this._writeLinePart(message);\r\n return;\r\n }\r\n\r\n // Otherwise split the lines and write each one individually\r\n let first: boolean = true;\r\n for (const linePart of message.split('\\n')) {\r\n if (!first) {\r\n this._writeNewLine();\r\n } else {\r\n first = false;\r\n }\r\n if (linePart) {\r\n this._writeLinePart(linePart.replace(/[\\r]/g, ''));\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * A shorthand for writing an optional message, followed by a newline.\r\n * Indentation is applied following the semantics of IndentedWriter.write().\r\n */\r\n public writeLine(message: string = ''): void {\r\n if (message.length > 0) {\r\n this.write(message);\r\n } else if (!this._isWritingBeforeStack) {\r\n this._writeBeforeStack();\r\n }\r\n\r\n this._writeNewLine();\r\n }\r\n\r\n /**\r\n * Writes a string that does not contain any newline characters.\r\n */\r\n private _writeLinePart(message: string): void {\r\n if (message.length > 0) {\r\n if (this._atStartOfLine && this._indentText.length > 0) {\r\n this._write(this._indentText);\r\n }\r\n this._write(message);\r\n this._atStartOfLine = false;\r\n }\r\n }\r\n\r\n private _writeNewLine(): void {\r\n if (this._atStartOfLine && this._indentText.length > 0) {\r\n this._write(this._indentText);\r\n }\r\n\r\n this._write('\\n');\r\n this._atStartOfLine = true;\r\n }\r\n\r\n private _write(s: string): void {\r\n this._previousChunk = this._latestChunk;\r\n this._latestChunk = s;\r\n this._builder.append(s);\r\n }\r\n\r\n /**\r\n * Writes all messages in our before stack, processing them in FIFO order. This stack is\r\n * populated by the `writeTentative` method.\r\n */\r\n private _writeBeforeStack(): void {\r\n this._isWritingBeforeStack = true;\r\n\r\n for (const message of this._beforeStack) {\r\n this.write(message);\r\n }\r\n\r\n this._isWritingBeforeStack = false;\r\n this._beforeStack = [];\r\n }\r\n\r\n private _updateIndentText(): void {\r\n this._indentText = this._indentStack.join('');\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"IndentedWriter.js","sourceRoot":"","sources":["../../src/utils/IndentedWriter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAkF;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,cAAc;IAmBzB,YAAmB,OAAwB;QAlB3C;;;WAGG;QACI,wBAAmB,GAAW,IAAI,CAAC;QAexC,IAAI,CAAC,QAAQ,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,iCAAa,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QAEtE,IAAI,CAAC,YAAY,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CAAC,WAAW,CAAC,CAAC;aAC/B;YACD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACrB,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;SAC7B;IACH,CAAC;IAEO,aAAa;QACnB,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YACtD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SAC/B;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC7B,CAAC;IAEO,MAAM,CAAC,CAAS;QACtB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACK,iBAAiB;QACvB,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAElC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,YAAY,EAAE;YACvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SACrB;QAED,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IACzB,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC;CACF;AAnPD,wCAmPC","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 { StringBuilder, type IStringBuilder } from '@rushstack/node-core-library';\n\n/**\n * A utility for writing indented text.\n *\n * @remarks\n *\n * Note that the indentation is inserted at the last possible opportunity.\n * For example, this code...\n *\n * ```ts\n * writer.write('begin\\n');\n * writer.increaseIndent();\n * writer.write('one\\ntwo\\n');\n * writer.decreaseIndent();\n * writer.increaseIndent();\n * writer.decreaseIndent();\n * writer.write('end');\n * ```\n *\n * ...would produce this output:\n *\n * ```\n * begin\n * one\n * two\n * end\n * ```\n */\nexport class IndentedWriter {\n /**\n * The text characters used to create one level of indentation.\n * Two spaces by default.\n */\n public defaultIndentPrefix: string = ' ';\n\n private readonly _builder: IStringBuilder;\n\n private _latestChunk: string | undefined;\n private _previousChunk: string | undefined;\n private _atStartOfLine: boolean;\n\n private readonly _indentStack: string[];\n private _indentText: string;\n\n private _beforeStack: string[];\n private _isWritingBeforeStack: boolean;\n\n public constructor(builder?: IStringBuilder) {\n this._builder = builder === undefined ? new StringBuilder() : builder;\n\n this._latestChunk = undefined;\n this._previousChunk = undefined;\n this._atStartOfLine = true;\n\n this._indentStack = [];\n this._indentText = '';\n\n this._beforeStack = [];\n this._isWritingBeforeStack = false;\n }\n\n /**\n * Retrieves the output that was built so far.\n */\n public getText(): string {\n return this._builder.toString();\n }\n\n public toString(): string {\n return this.getText();\n }\n\n /**\n * Increases the indentation. Normally the indentation is two spaces,\n * however an arbitrary prefix can optional be specified. (For example,\n * the prefix could be \"// \" to indent and comment simultaneously.)\n * Each call to IndentedWriter.increaseIndent() must be followed by a\n * corresponding call to IndentedWriter.decreaseIndent().\n */\n public increaseIndent(indentPrefix?: string): void {\n this._indentStack.push(indentPrefix !== undefined ? indentPrefix : this.defaultIndentPrefix);\n this._updateIndentText();\n }\n\n /**\n * Decreases the indentation, reverting the effect of the corresponding call\n * to IndentedWriter.increaseIndent().\n */\n public decreaseIndent(): void {\n this._indentStack.pop();\n this._updateIndentText();\n }\n\n /**\n * A shorthand for ensuring that increaseIndent()/decreaseIndent() occur\n * in pairs.\n */\n public indentScope(scope: () => void, indentPrefix?: string): void {\n this.increaseIndent(indentPrefix);\n scope();\n this.decreaseIndent();\n }\n\n /**\n * Adds a newline if the file pointer is not already at the start of the line (or start of the stream).\n */\n public ensureNewLine(): void {\n const lastCharacter: string = this.peekLastCharacter();\n if (lastCharacter !== '\\n' && lastCharacter !== '') {\n this._writeNewLine();\n }\n }\n\n /**\n * Adds up to two newlines to ensure that there is a blank line above the current line.\n */\n public ensureSkippedLine(): void {\n if (this.peekLastCharacter() !== '\\n') {\n this._writeNewLine();\n }\n\n const secondLastCharacter: string = this.peekSecondLastCharacter();\n if (secondLastCharacter !== '\\n' && secondLastCharacter !== '') {\n this._writeNewLine();\n }\n }\n\n /**\n * Returns the last character that was written, or an empty string if no characters have been written yet.\n */\n public peekLastCharacter(): string {\n if (this._latestChunk !== undefined) {\n return this._latestChunk.substr(-1, 1);\n }\n return '';\n }\n\n /**\n * Returns the second to last character that was written, or an empty string if less than one characters\n * have been written yet.\n */\n public peekSecondLastCharacter(): string {\n if (this._latestChunk !== undefined) {\n if (this._latestChunk.length > 1) {\n return this._latestChunk.substr(-2, 1);\n }\n if (this._previousChunk !== undefined) {\n return this._previousChunk.substr(-1, 1);\n }\n }\n return '';\n }\n\n /**\n * Writes `before` and `after` messages if and only if `mayWrite` writes anything.\n *\n * If `mayWrite` writes \"CONTENT\", this method will write \"<before>CONTENT<after>\".\n * If `mayWrite` writes nothing, this method will write nothing.\n */\n public writeTentative(before: string, after: string, mayWrite: () => void): void {\n this._beforeStack.push(before);\n\n // If this function writes anything, then _all_ messages in the \"before stack\" will also be\n // written. This means that the stack will be empty (as when we write a message from the stack,\n // we remove it from the stack).\n mayWrite();\n\n // If the stack is not empty, it means that `mayWrite` didn't write anything. Pop the last-\n // added message from the stack, we'll never write it. Otherwise, if the stack is empty, then\n // write the \"after\" message.\n if (this._beforeStack.length > 0) {\n this._beforeStack.pop();\n } else {\n this.write(after);\n }\n }\n\n /**\n * Writes some text to the internal string buffer, applying indentation according\n * to the current indentation level. If the string contains multiple newlines,\n * each line will be indented separately.\n */\n public write(message: string): void {\n if (message.length === 0) {\n return;\n }\n\n if (!this._isWritingBeforeStack) {\n this._writeBeforeStack();\n }\n\n // If there are no newline characters, then append the string verbatim\n if (!/[\\r\\n]/.test(message)) {\n this._writeLinePart(message);\n return;\n }\n\n // Otherwise split the lines and write each one individually\n let first: boolean = true;\n for (const linePart of message.split('\\n')) {\n if (!first) {\n this._writeNewLine();\n } else {\n first = false;\n }\n if (linePart) {\n this._writeLinePart(linePart.replace(/[\\r]/g, ''));\n }\n }\n }\n\n /**\n * A shorthand for writing an optional message, followed by a newline.\n * Indentation is applied following the semantics of IndentedWriter.write().\n */\n public writeLine(message: string = ''): void {\n if (message.length > 0) {\n this.write(message);\n } else if (!this._isWritingBeforeStack) {\n this._writeBeforeStack();\n }\n\n this._writeNewLine();\n }\n\n /**\n * Writes a string that does not contain any newline characters.\n */\n private _writeLinePart(message: string): void {\n if (message.length > 0) {\n if (this._atStartOfLine && this._indentText.length > 0) {\n this._write(this._indentText);\n }\n this._write(message);\n this._atStartOfLine = false;\n }\n }\n\n private _writeNewLine(): void {\n if (this._atStartOfLine && this._indentText.length > 0) {\n this._write(this._indentText);\n }\n\n this._write('\\n');\n this._atStartOfLine = true;\n }\n\n private _write(s: string): void {\n this._previousChunk = this._latestChunk;\n this._latestChunk = s;\n this._builder.append(s);\n }\n\n /**\n * Writes all messages in our before stack, processing them in FIFO order. This stack is\n * populated by the `writeTentative` method.\n */\n private _writeBeforeStack(): void {\n this._isWritingBeforeStack = true;\n\n for (const message of this._beforeStack) {\n this.write(message);\n }\n\n this._isWritingBeforeStack = false;\n this._beforeStack = [];\n }\n\n private _updateIndentText(): void {\n this._indentText = this._indentStack.join('');\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ToSdpConvertHelper.js","sourceRoot":"","sources":["../../src/utils/ToSdpConvertHelper.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAkB3D,gDAAwB;AACxB,oEAAiF;AACjF,gCAAiC;AAEjC,SAAgB,mBAAmB,CAAC,UAAkB;IACpD,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CA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AU,CAAC,GAAG,CAAC,EAAE;QACjC,2BAA2B;QAC3B,eAAe;QACf,8DAA8D;QAC9D,MAAM,GAAG,GAA+B,MAAA,gBAAgB,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACjF,OAAO,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE;YACnB,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC;SACnB;KACF;IACD,YAAY;IACZ,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAW,mCAAmC,CAAC;IAE7D,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AACvD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport type {\r\n IYamlItem,\r\n IYamlApiFile,\r\n IYamlSyntax,\r\n IYamlReferenceSpec,\r\n IYamlReference\r\n} from '../yaml/IYamlApiFile';\r\nimport type {\r\n PackageYamlModel,\r\n EnumYamlModel,\r\n TypeAliasYamlModel,\r\n TypeYamlModel,\r\n FieldYamlModel,\r\n FunctionYamlModel,\r\n CommonYamlModel\r\n} from '../yaml/ISDPYamlFile';\r\nimport path from 'path';\r\nimport { FileSystem, Encoding, NewlineKind } from '@rushstack/node-core-library';\r\nimport yaml = require('js-yaml');\r\n\r\nexport function convertUDPYamlToSDP(folderPath: string): void {\r\n convert(folderPath, folderPath);\r\n}\r\n\r\nfunction convert(inputPath: string, outputPath: string): void {\r\n console.log();\r\n if (!FileSystem.exists(inputPath)) {\r\n console.error(`input path: ${inputPath} is not exist`);\r\n return;\r\n }\r\n\r\n FileSystem.readFolderItemNames(inputPath).forEach((name) => {\r\n const fpath: string = path.join(inputPath, name);\r\n if (FileSystem.getStatistics(fpath).isFile()) {\r\n // only convert yaml\r\n if (!name.endsWith('.yml')) {\r\n return;\r\n }\r\n // parse file\r\n const yamlContent: string = FileSystem.readFile(fpath, { encoding: Encoding.Utf8 });\r\n // only convert universalreference yaml\r\n const isLegacyYaml: boolean = yamlContent.startsWith('### YamlMime:UniversalReference');\r\n if (!isLegacyYaml) {\r\n return;\r\n }\r\n\r\n console.log(`convert file ${fpath} from udp to sdp`);\r\n\r\n const file: IYamlApiFile = yaml.safeLoad(yamlContent) as IYamlApiFile;\r\n const result: { model: CommonYamlModel; type: string } | undefined = convertToSDP(file);\r\n if (result && result.model) {\r\n const stringified: string = `### YamlMime:TS${result.type}\\n${yaml.safeDump(result.model, {\r\n lineWidth: 120\r\n })}`;\r\n FileSystem.writeFile(`${outputPath}/${name}`, stringified, {\r\n convertLineEndings: NewlineKind.CrLf,\r\n ensureFolderExists: true\r\n });\r\n } else {\r\n console.log('not target file ', fpath);\r\n }\r\n } else {\r\n // read contents\r\n convert(fpath, path.join(outputPath, name));\r\n }\r\n });\r\n}\r\n\r\nfunction convertToPackageSDP(transfomredClass: IYamlApiFile): PackageYamlModel {\r\n const element: IYamlItem = transfomredClass.items[0];\r\n const packageModel: PackageYamlModel = {\r\n uid: element.uid,\r\n name: element.name!,\r\n type: 'package'\r\n };\r\n if (element.summary) {\r\n packageModel.summary = element.summary;\r\n } else {\r\n packageModel.summary = '';\r\n }\r\n\r\n // search in children\r\n if (element.children) {\r\n element.children.forEach((child) => {\r\n if (child.endsWith(':class')) {\r\n assignPackageModelFields(packageModel, 'classes', child);\r\n } else if (child.endsWith(':interface')) {\r\n assignPackageModelFields(packageModel, 'interfaces', child);\r\n } else if (child.endsWith(':enum')) {\r\n assignPackageModelFields(packageModel, 'enums', child);\r\n } else if (child.endsWith(':type')) {\r\n assignPackageModelFields(packageModel, 'typeAliases', child);\r\n } else {\r\n // console.log(\"other type: \", child)\r\n }\r\n });\r\n }\r\n\r\n for (let i: number = 1; i < transfomredClass.items.length; i++) {\r\n const ele: IYamlItem = transfomredClass.items[i];\r\n switch (ele.type) {\r\n case 'typealias':\r\n // need generate typeAlias file for this\r\n break;\r\n case 'function':\r\n if (!packageModel.functions) {\r\n packageModel.functions = [];\r\n }\r\n packageModel.functions.push(convertToFunctionSDP(ele, element.uid, transfomredClass));\r\n break;\r\n default:\r\n // console.log(transfomredClass.items[0].name)\r\n console.log('[warning] not applied type(package): ', ele.type);\r\n }\r\n }\r\n\r\n return packageModel;\r\n}\r\n\r\nfunction assignPackageModelFields(\r\n packageModel: PackageYamlModel,\r\n name: 'classes' | 'interfaces' | 'enums' | 'typeAliases',\r\n uid: string\r\n): void {\r\n if (!packageModel[name]) {\r\n packageModel[name] = [];\r\n }\r\n packageModel[name]!.push(uid);\r\n}\r\n\r\nfunction convertToSDP(transfomredClass: IYamlApiFile): { model: CommonYamlModel; type: string } | undefined {\r\n const element: IYamlItem = transfomredClass.items[0];\r\n switch (element.type) {\r\n case 'class':\r\n case 'interface':\r\n return {\r\n model: convertToTypeSDP(transfomredClass, element.type === 'class'),\r\n type: 'Type'\r\n };\r\n case 'enum':\r\n if (transfomredClass.items.length < 2) {\r\n console.log(`[warning] enum ${element.uid}/${element.name} does not have fields`);\r\n return undefined;\r\n }\r\n return { model: convertToEnumSDP(transfomredClass), type: 'Enum' };\r\n case 'typealias':\r\n return { model: convertToTypeAliasSDP(element, transfomredClass), type: 'TypeAlias' };\r\n case 'package':\r\n return {\r\n model: convertToPackageSDP(transfomredClass),\r\n type: 'Package'\r\n };\r\n default:\r\n console.log('not applied type: ', element.type);\r\n return undefined;\r\n }\r\n}\r\n\r\nfunction convertToEnumSDP(transfomredClass: IYamlApiFile): EnumYamlModel {\r\n const element: IYamlItem = transfomredClass.items[0];\r\n const fields: FieldYamlModel[] = [];\r\n for (let i: number = 1; i < transfomredClass.items.length; i++) {\r\n const ele: IYamlItem = transfomredClass.items[i];\r\n const field: FieldYamlModel = {\r\n name: ele.name!,\r\n uid: ele.uid,\r\n package: element.package!\r\n };\r\n\r\n if (ele.summary) {\r\n field.summary = ele.summary;\r\n } else {\r\n field.summary = '';\r\n }\r\n\r\n if (ele.numericValue) {\r\n field.value = ele.numericValue;\r\n }\r\n fields.push(field);\r\n }\r\n\r\n const result: EnumYamlModel = {\r\n ...convertCommonYamlModel(element, element.package!, transfomredClass),\r\n fields: fields\r\n };\r\n return result;\r\n}\r\n\r\nfunction convertToTypeAliasSDP(element: IYamlItem, transfomredClass: IYamlApiFile): TypeAliasYamlModel {\r\n const result: TypeAliasYamlModel = {\r\n ...convertCommonYamlModel(element, element.package!, transfomredClass)\r\n } as TypeAliasYamlModel;\r\n\r\n if (element.syntax) {\r\n result.syntax = element.syntax.content!;\r\n }\r\n return result;\r\n}\r\n\r\nfunction convertToTypeSDP(transfomredClass: IYamlApiFile, isClass: boolean): TypeYamlModel {\r\n const element: IYamlItem = transfomredClass.items[0];\r\n const constructors: CommonYamlModel[] = [];\r\n const properties: CommonYamlModel[] = [];\r\n const methods: CommonYamlModel[] = [];\r\n const events: CommonYamlModel[] = [];\r\n for (let i: number = 1; i < transfomredClass.items.length; i++) {\r\n const ele: IYamlItem = transfomredClass.items[i];\r\n const item: CommonYamlModel = convertCommonYamlModel(ele, element.package!, transfomredClass);\r\n if (ele.type === 'constructor') {\r\n // interface does not need this field\r\n if (isClass) {\r\n constructors.push(item);\r\n }\r\n } else if (ele.type === 'property') {\r\n properties.push(item);\r\n } else if (ele.type === 'method') {\r\n methods.push(item);\r\n } else if (ele.type === 'event') {\r\n events.push(item);\r\n } else {\r\n console.log(`[warning] ${ele.uid}#${ele.name} is not applied sub type ${ele.type} for type yaml`);\r\n }\r\n }\r\n const result: TypeYamlModel = {\r\n ...convertCommonYamlModel(element, element.package!, transfomredClass),\r\n type: isClass ? 'class' : 'interface'\r\n };\r\n delete result.syntax;\r\n\r\n if (constructors.length > 0) {\r\n result.constructors = constructors;\r\n }\r\n\r\n if (properties.length > 0) {\r\n result.properties = properties;\r\n }\r\n\r\n if (methods.length > 0) {\r\n result.methods = methods;\r\n }\r\n\r\n if (events.length > 0) {\r\n result.events = events;\r\n }\r\n\r\n if (element.extends && element.extends.length > 0) {\r\n result.extends = convertSelfTypeToXref(element.extends[0] as string, transfomredClass);\r\n }\r\n return result;\r\n}\r\n\r\nfunction convertToFunctionSDP(\r\n element: IYamlItem,\r\n packageName: string,\r\n transfomredClass: IYamlApiFile\r\n): FunctionYamlModel {\r\n const model: CommonYamlModel = convertCommonYamlModel(element, packageName, transfomredClass);\r\n // don't need these fields\r\n delete model.fullName;\r\n return model;\r\n}\r\n\r\nfunction convertCommonYamlModel(\r\n element: IYamlItem,\r\n packageName: string,\r\n transfomredClass: IYamlApiFile\r\n): CommonYamlModel {\r\n const result: CommonYamlModel = {\r\n name: element.name!,\r\n uid: element.uid,\r\n package: packageName\r\n };\r\n\r\n if (element.fullName) {\r\n result.fullName = element.fullName;\r\n }\r\n\r\n if (element.summary) {\r\n result.summary = element.summary;\r\n } else {\r\n result.summary = '';\r\n }\r\n\r\n // because mustache meet same variable in different level\r\n // such as: { \"pre\": true, \"list\": [{}]}\r\n // if item in list wants to use pre but the pre is not assigned, it will use outer pre field.\r\n // so, there need to set below variable explict\r\n\r\n if (element.remarks) {\r\n result.remarks = element.remarks;\r\n } else {\r\n result.remarks = '';\r\n }\r\n\r\n if (element.example) {\r\n result.example = element.example;\r\n } else {\r\n result.example = [];\r\n }\r\n\r\n result.isPreview = element.isPreview;\r\n if (!result.isPreview) {\r\n result.isPreview = false;\r\n }\r\n\r\n if (element.deprecated) {\r\n result.isDeprecated = true;\r\n result.customDeprecatedMessage = element.deprecated.content;\r\n } else {\r\n result.isDeprecated = false;\r\n }\r\n\r\n if (element.syntax) {\r\n result.syntax = {};\r\n\r\n const syntax: IYamlSyntax = element.syntax;\r\n result.syntax.content = syntax.content;\r\n if (syntax.parameters && syntax.parameters.length > 0) {\r\n syntax.parameters?.forEach((it) => {\r\n delete it.optional;\r\n delete it.defaultValue;\r\n });\r\n result.syntax.parameters = syntax.parameters.map((it) => {\r\n return {\r\n ...it,\r\n id: it.id!,\r\n type: convertSelfTypeToXref(escapeMarkdown(it.type![0] as string), transfomredClass)\r\n };\r\n });\r\n }\r\n\r\n if (syntax.return) {\r\n result.syntax.return = {\r\n ...syntax.return,\r\n type: convertSelfTypeToXref(escapeMarkdown(syntax.return.type![0] as string), transfomredClass)\r\n };\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction escapeMarkdown(name: string): string {\r\n // eg: [key: string]: string\r\n const markdownLinkRegEx: RegExp = /^\\s*(\\[.+\\]):(.+)/g;\r\n return name.replace(markdownLinkRegEx, `$1\\\\:$2`);\r\n}\r\n\r\nfunction convertSelfTypeToXref(name: string, transfomredClass: IYamlApiFile): string {\r\n let result: string = name;\r\n\r\n // if complex type, need to get real type from references\r\n if (result.endsWith(':complex')) {\r\n const specs: IYamlReferenceSpec[] | undefined = transfomredClass.references?.find((item) => {\r\n return item.uid === name;\r\n })?.['spec.typeScript'];\r\n\r\n if (specs && specs.length > 0) {\r\n result = '';\r\n for (const spec of specs) {\r\n // start with ! will be node base type\r\n if (spec.uid && !spec.uid.startsWith('!')) {\r\n result += spec.uid;\r\n } else {\r\n result += spec.name;\r\n }\r\n }\r\n }\r\n } else if (result.startsWith('!')) {\r\n // uid: '!Object:interface'\r\n // name: Object\r\n // start with !, not complex type, use reference name directly\r\n const ref: IYamlReference | undefined = transfomredClass.references?.find((item) => {\r\n return item.uid === name;\r\n });\r\n if (ref && ref.name) {\r\n result = ref.name;\r\n }\r\n }\r\n // parse < >\r\n result = result.replace(/</g, '&lt;').replace(/>/g, '&gt;');\r\n const uidRegEx: RegExp = /(@?[\\w\\d\\-/!~\\.]+\\:[\\w\\d\\-\\(/]+)/g;\r\n\r\n return result.replace(uidRegEx, `<xref uid=\"$1\" />`);\r\n}\r\n"]}
1
+ {"version":3,"file":"ToSdpConvertHelper.js","sourceRoot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AI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;oBACzC,MAAM,IAAI,IAAI,CAAC,GAAG,CAAC;iBACpB;qBAAM;oBACL,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC;iBACrB;aACF;SACF;KACF;SAAM,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACjC,2BAA2B;QAC3B,eAAe;QACf,8DAA8D;QAC9D,MAAM,GAAG,GAA+B,MAAA,gBAAgB,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACjF,OAAO,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE;YACnB,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC;SACnB;KACF;IACD,YAAY;IACZ,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAW,mCAAmC,CAAC;IAE7D,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AACvD,CAAC","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 type {\n IYamlItem,\n IYamlApiFile,\n IYamlSyntax,\n IYamlReferenceSpec,\n IYamlReference\n} from '../yaml/IYamlApiFile';\nimport type {\n PackageYamlModel,\n EnumYamlModel,\n TypeAliasYamlModel,\n TypeYamlModel,\n FieldYamlModel,\n FunctionYamlModel,\n CommonYamlModel\n} from '../yaml/ISDPYamlFile';\nimport path from 'path';\nimport { FileSystem, Encoding, NewlineKind } from '@rushstack/node-core-library';\nimport yaml = require('js-yaml');\n\nexport function convertUDPYamlToSDP(folderPath: string): void {\n convert(folderPath, folderPath);\n}\n\nfunction convert(inputPath: string, outputPath: string): void {\n console.log();\n if (!FileSystem.exists(inputPath)) {\n console.error(`input path: ${inputPath} is not exist`);\n return;\n }\n\n FileSystem.readFolderItemNames(inputPath).forEach((name) => {\n const fpath: string = path.join(inputPath, name);\n if (FileSystem.getStatistics(fpath).isFile()) {\n // only convert yaml\n if (!name.endsWith('.yml')) {\n return;\n }\n // parse file\n const yamlContent: string = FileSystem.readFile(fpath, { encoding: Encoding.Utf8 });\n // only convert universalreference yaml\n const isLegacyYaml: boolean = yamlContent.startsWith('### YamlMime:UniversalReference');\n if (!isLegacyYaml) {\n return;\n }\n\n console.log(`convert file ${fpath} from udp to sdp`);\n\n const file: IYamlApiFile = yaml.safeLoad(yamlContent) as IYamlApiFile;\n const result: { model: CommonYamlModel; type: string } | undefined = convertToSDP(file);\n if (result && result.model) {\n const stringified: string = `### YamlMime:TS${result.type}\\n${yaml.safeDump(result.model, {\n lineWidth: 120\n })}`;\n FileSystem.writeFile(`${outputPath}/${name}`, stringified, {\n convertLineEndings: NewlineKind.CrLf,\n ensureFolderExists: true\n });\n } else {\n console.log('not target file ', fpath);\n }\n } else {\n // read contents\n convert(fpath, path.join(outputPath, name));\n }\n });\n}\n\nfunction convertToPackageSDP(transfomredClass: IYamlApiFile): PackageYamlModel {\n const element: IYamlItem = transfomredClass.items[0];\n const packageModel: PackageYamlModel = {\n uid: element.uid,\n name: element.name!,\n type: 'package'\n };\n if (element.summary) {\n packageModel.summary = element.summary;\n } else {\n packageModel.summary = '';\n }\n\n // search in children\n if (element.children) {\n element.children.forEach((child) => {\n if (child.endsWith(':class')) {\n assignPackageModelFields(packageModel, 'classes', child);\n } else if (child.endsWith(':interface')) {\n assignPackageModelFields(packageModel, 'interfaces', child);\n } else if (child.endsWith(':enum')) {\n assignPackageModelFields(packageModel, 'enums', child);\n } else if (child.endsWith(':type')) {\n assignPackageModelFields(packageModel, 'typeAliases', child);\n } else {\n // console.log(\"other type: \", child)\n }\n });\n }\n\n for (let i: number = 1; i < transfomredClass.items.length; i++) {\n const ele: IYamlItem = transfomredClass.items[i];\n switch (ele.type) {\n case 'typealias':\n // need generate typeAlias file for this\n break;\n case 'function':\n if (!packageModel.functions) {\n packageModel.functions = [];\n }\n packageModel.functions.push(convertToFunctionSDP(ele, element.uid, transfomredClass));\n break;\n default:\n // console.log(transfomredClass.items[0].name)\n console.log('[warning] not applied type(package): ', ele.type);\n }\n }\n\n return packageModel;\n}\n\nfunction assignPackageModelFields(\n packageModel: PackageYamlModel,\n name: 'classes' | 'interfaces' | 'enums' | 'typeAliases',\n uid: string\n): void {\n if (!packageModel[name]) {\n packageModel[name] = [];\n }\n packageModel[name]!.push(uid);\n}\n\nfunction convertToSDP(transfomredClass: IYamlApiFile): { model: CommonYamlModel; type: string } | undefined {\n const element: IYamlItem = transfomredClass.items[0];\n switch (element.type) {\n case 'class':\n case 'interface':\n return {\n model: convertToTypeSDP(transfomredClass, element.type === 'class'),\n type: 'Type'\n };\n case 'enum':\n if (transfomredClass.items.length < 2) {\n console.log(`[warning] enum ${element.uid}/${element.name} does not have fields`);\n return undefined;\n }\n return { model: convertToEnumSDP(transfomredClass), type: 'Enum' };\n case 'typealias':\n return { model: convertToTypeAliasSDP(element, transfomredClass), type: 'TypeAlias' };\n case 'package':\n return {\n model: convertToPackageSDP(transfomredClass),\n type: 'Package'\n };\n default:\n console.log('not applied type: ', element.type);\n return undefined;\n }\n}\n\nfunction convertToEnumSDP(transfomredClass: IYamlApiFile): EnumYamlModel {\n const element: IYamlItem = transfomredClass.items[0];\n const fields: FieldYamlModel[] = [];\n for (let i: number = 1; i < transfomredClass.items.length; i++) {\n const ele: IYamlItem = transfomredClass.items[i];\n const field: FieldYamlModel = {\n name: ele.name!,\n uid: ele.uid,\n package: element.package!\n };\n\n if (ele.summary) {\n field.summary = ele.summary;\n } else {\n field.summary = '';\n }\n\n if (ele.numericValue) {\n field.value = ele.numericValue;\n }\n fields.push(field);\n }\n\n const result: EnumYamlModel = {\n ...convertCommonYamlModel(element, element.package!, transfomredClass),\n fields: fields\n };\n return result;\n}\n\nfunction convertToTypeAliasSDP(element: IYamlItem, transfomredClass: IYamlApiFile): TypeAliasYamlModel {\n const result: TypeAliasYamlModel = {\n ...convertCommonYamlModel(element, element.package!, transfomredClass)\n } as TypeAliasYamlModel;\n\n if (element.syntax) {\n result.syntax = element.syntax.content!;\n }\n return result;\n}\n\nfunction convertToTypeSDP(transfomredClass: IYamlApiFile, isClass: boolean): TypeYamlModel {\n const element: IYamlItem = transfomredClass.items[0];\n const constructors: CommonYamlModel[] = [];\n const properties: CommonYamlModel[] = [];\n const methods: CommonYamlModel[] = [];\n const events: CommonYamlModel[] = [];\n for (let i: number = 1; i < transfomredClass.items.length; i++) {\n const ele: IYamlItem = transfomredClass.items[i];\n const item: CommonYamlModel = convertCommonYamlModel(ele, element.package!, transfomredClass);\n if (ele.type === 'constructor') {\n // interface does not need this field\n if (isClass) {\n constructors.push(item);\n }\n } else if (ele.type === 'property') {\n properties.push(item);\n } else if (ele.type === 'method') {\n methods.push(item);\n } else if (ele.type === 'event') {\n events.push(item);\n } else {\n console.log(`[warning] ${ele.uid}#${ele.name} is not applied sub type ${ele.type} for type yaml`);\n }\n }\n const result: TypeYamlModel = {\n ...convertCommonYamlModel(element, element.package!, transfomredClass),\n type: isClass ? 'class' : 'interface'\n };\n delete result.syntax;\n\n if (constructors.length > 0) {\n result.constructors = constructors;\n }\n\n if (properties.length > 0) {\n result.properties = properties;\n }\n\n if (methods.length > 0) {\n result.methods = methods;\n }\n\n if (events.length > 0) {\n result.events = events;\n }\n\n if (element.extends && element.extends.length > 0) {\n result.extends = convertSelfTypeToXref(element.extends[0] as string, transfomredClass);\n }\n return result;\n}\n\nfunction convertToFunctionSDP(\n element: IYamlItem,\n packageName: string,\n transfomredClass: IYamlApiFile\n): FunctionYamlModel {\n const model: CommonYamlModel = convertCommonYamlModel(element, packageName, transfomredClass);\n // don't need these fields\n delete model.fullName;\n return model;\n}\n\nfunction convertCommonYamlModel(\n element: IYamlItem,\n packageName: string,\n transfomredClass: IYamlApiFile\n): CommonYamlModel {\n const result: CommonYamlModel = {\n name: element.name!,\n uid: element.uid,\n package: packageName\n };\n\n if (element.fullName) {\n result.fullName = element.fullName;\n }\n\n if (element.summary) {\n result.summary = element.summary;\n } else {\n result.summary = '';\n }\n\n // because mustache meet same variable in different level\n // such as: { \"pre\": true, \"list\": [{}]}\n // if item in list wants to use pre but the pre is not assigned, it will use outer pre field.\n // so, there need to set below variable explict\n\n if (element.remarks) {\n result.remarks = element.remarks;\n } else {\n result.remarks = '';\n }\n\n if (element.example) {\n result.example = element.example;\n } else {\n result.example = [];\n }\n\n result.isPreview = element.isPreview;\n if (!result.isPreview) {\n result.isPreview = false;\n }\n\n if (element.deprecated) {\n result.isDeprecated = true;\n result.customDeprecatedMessage = element.deprecated.content;\n } else {\n result.isDeprecated = false;\n }\n\n if (element.syntax) {\n result.syntax = {};\n\n const syntax: IYamlSyntax = element.syntax;\n result.syntax.content = syntax.content;\n if (syntax.parameters && syntax.parameters.length > 0) {\n syntax.parameters?.forEach((it) => {\n delete it.optional;\n delete it.defaultValue;\n });\n result.syntax.parameters = syntax.parameters.map((it) => {\n return {\n ...it,\n id: it.id!,\n type: convertSelfTypeToXref(escapeMarkdown(it.type![0] as string), transfomredClass)\n };\n });\n }\n\n if (syntax.return) {\n result.syntax.return = {\n ...syntax.return,\n type: convertSelfTypeToXref(escapeMarkdown(syntax.return.type![0] as string), transfomredClass)\n };\n }\n }\n\n return result;\n}\n\nfunction escapeMarkdown(name: string): string {\n // eg: [key: string]: string\n const markdownLinkRegEx: RegExp = /^\\s*(\\[.+\\]):(.+)/g;\n return name.replace(markdownLinkRegEx, `$1\\\\:$2`);\n}\n\nfunction convertSelfTypeToXref(name: string, transfomredClass: IYamlApiFile): string {\n let result: string = name;\n\n // if complex type, need to get real type from references\n if (result.endsWith(':complex')) {\n const specs: IYamlReferenceSpec[] | undefined = transfomredClass.references?.find((item) => {\n return item.uid === name;\n })?.['spec.typeScript'];\n\n if (specs && specs.length > 0) {\n result = '';\n for (const spec of specs) {\n // start with ! will be node base type\n if (spec.uid && !spec.uid.startsWith('!')) {\n result += spec.uid;\n } else {\n result += spec.name;\n }\n }\n }\n } else if (result.startsWith('!')) {\n // uid: '!Object:interface'\n // name: Object\n // start with !, not complex type, use reference name directly\n const ref: IYamlReference | undefined = transfomredClass.references?.find((item) => {\n return item.uid === name;\n });\n if (ref && ref.name) {\n result = ref.name;\n }\n }\n // parse < >\n result = result.replace(/</g, '&lt;').replace(/>/g, '&gt;');\n const uidRegEx: RegExp = /(@?[\\w\\d\\-/!~\\.]+\\:[\\w\\d\\-\\(/]+)/g;\n\n return result.replace(uidRegEx, `<xref uid=\"$1\" />`);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Utilities.js","sourceRoot":"","sources":["../../src/utils/Utilities.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,wEAAqF;AAErF,MAAa,SAAS;IAEpB;;OAEG;IACI,MAAM,CAAC,mBAAmB,CAAC,OAAgB;QAChD,IAAI,2CAAqB,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;YAChD,OAAO,OAAO,CAAC,WAAW,GAAG,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;SAC3F;QACD,OAAO,OAAO,CAAC,WAAW,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,sBAAsB,CAAC,IAAY;QAC/C,8CAA8C;QAC9C,iFAAiF;QACjF,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5E,CAAC;;AAlBuB,iCAAuB,GAAW,kBAAkB,CAAC;AADlE,8BAAS","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { ApiParameterListMixin, type ApiItem } from '@microsoft/api-extractor-model';\r\n\r\nexport class Utilities {\r\n private static readonly _badFilenameCharsRegExp: RegExp = /[^a-z0-9_\\-\\.]/gi;\r\n /**\r\n * Generates a concise signature for a function. Example: \"getArea(width, height)\"\r\n */\r\n public static getConciseSignature(apiItem: ApiItem): string {\r\n if (ApiParameterListMixin.isBaseClassOf(apiItem)) {\r\n return apiItem.displayName + '(' + apiItem.parameters.map((x) => x.name).join(', ') + ')';\r\n }\r\n return apiItem.displayName;\r\n }\r\n\r\n /**\r\n * Converts bad filename characters to underscores.\r\n */\r\n public static getSafeFilenameForName(name: string): string {\r\n // TODO: This can introduce naming collisions.\r\n // We will fix that as part of https://github.com/microsoft/rushstack/issues/1308\r\n return name.replace(Utilities._badFilenameCharsRegExp, '_').toLowerCase();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Utilities.js","sourceRoot":"","sources":["../../src/utils/Utilities.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,wEAAqF;AAErF,MAAa,SAAS;IAEpB;;OAEG;IACI,MAAM,CAAC,mBAAmB,CAAC,OAAgB;QAChD,IAAI,2CAAqB,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;YAChD,OAAO,OAAO,CAAC,WAAW,GAAG,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;SAC3F;QACD,OAAO,OAAO,CAAC,WAAW,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,sBAAsB,CAAC,IAAY;QAC/C,8CAA8C;QAC9C,iFAAiF;QACjF,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5E,CAAC;;AAlBuB,iCAAuB,GAAW,kBAAkB,CAAC;AADlE,8BAAS","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 { ApiParameterListMixin, type ApiItem } from '@microsoft/api-extractor-model';\n\nexport class Utilities {\n private static readonly _badFilenameCharsRegExp: RegExp = /[^a-z0-9_\\-\\.]/gi;\n /**\n * Generates a concise signature for a function. Example: \"getArea(width, height)\"\n */\n public static getConciseSignature(apiItem: ApiItem): string {\n if (ApiParameterListMixin.isBaseClassOf(apiItem)) {\n return apiItem.displayName + '(' + apiItem.parameters.map((x) => x.name).join(', ') + ')';\n }\n return apiItem.displayName;\n }\n\n /**\n * Converts bad filename characters to underscores.\n */\n public static getSafeFilenameForName(name: string): string {\n // TODO: This can introduce naming collisions.\n // We will fix that as part of https://github.com/microsoft/rushstack/issues/1308\n return name.replace(Utilities._badFilenameCharsRegExp, '_').toLowerCase();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ISDPYamlFile.js","sourceRoot":"","sources":["../../src/yaml/ISDPYamlFile.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\ninterface IBaseYamlModel {\r\n uid: string;\r\n name: string;\r\n package?: string;\r\n summary?: string;\r\n}\r\n\r\nexport type CommonYamlModel = IBaseYamlModel & {\r\n syntax?: ISyntax;\r\n fullName?: string;\r\n isPreview?: boolean;\r\n isDeprecated?: boolean;\r\n remarks?: string;\r\n example?: string[];\r\n customDeprecatedMessage?: string;\r\n};\r\n\r\nexport type PackageYamlModel = CommonYamlModel & {\r\n classes?: Array<string>;\r\n interfaces?: Array<string>;\r\n enums?: Array<string>;\r\n typeAliases?: Array<string>;\r\n properties?: Array<FunctionYamlModel>;\r\n type?: 'package' | 'module';\r\n functions?: Array<FunctionYamlModel>;\r\n};\r\n\r\nexport type FunctionYamlModel = CommonYamlModel;\r\n\r\nexport type TypeAliasYamlModel = CommonYamlModel & {\r\n syntax: string;\r\n};\r\n\r\nexport type TypeYamlModel = CommonYamlModel & {\r\n constructors?: Array<FunctionYamlModel>;\r\n properties?: Array<FunctionYamlModel>;\r\n methods?: Array<FunctionYamlModel>;\r\n events?: Array<FunctionYamlModel>;\r\n type: 'class' | 'interface';\r\n extends?: IType | string;\r\n};\r\n\r\nexport type EnumYamlModel = CommonYamlModel & {\r\n fields: Array<FieldYamlModel>;\r\n};\r\n\r\nexport type FieldYamlModel = IBaseYamlModel & {\r\n numericValue?: number;\r\n value?: string;\r\n};\r\n\r\nexport interface ISyntax {\r\n parameters?: Array<IYamlParameter>;\r\n content?: string;\r\n return?: IReturn;\r\n}\r\n\r\nexport interface IYamlParameter {\r\n id: string;\r\n type: IType | string;\r\n description?: string;\r\n}\r\n\r\ninterface IReturn {\r\n type: IType | string;\r\n description?: string;\r\n}\r\n\r\nexport interface IType {\r\n typeName?: string;\r\n typeId?: number;\r\n reflectedType?: IReflectedType;\r\n genericType?: IGenericType;\r\n intersectionType?: IIntersectionType;\r\n unionType?: IUnionType;\r\n arrayType?: IType | string;\r\n}\r\n\r\nexport interface IUnionType {\r\n types: Types;\r\n}\r\n\r\nexport interface IIntersectionType {\r\n types: Types;\r\n}\r\n\r\nexport interface IGenericType {\r\n outter: IType | string;\r\n inner: Types;\r\n}\r\n\r\nexport interface IReflectedType {\r\n key: IType | string;\r\n value: IType | string;\r\n}\r\n\r\nexport interface IException {\r\n type: string;\r\n description: string;\r\n}\r\n\r\ntype Types = IType[] | string[];\r\n"]}
1
+ {"version":3,"file":"ISDPYamlFile.js","sourceRoot":"","sources":["../../src/yaml/ISDPYamlFile.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\ninterface IBaseYamlModel {\n uid: string;\n name: string;\n package?: string;\n summary?: string;\n}\n\nexport type CommonYamlModel = IBaseYamlModel & {\n syntax?: ISyntax;\n fullName?: string;\n isPreview?: boolean;\n isDeprecated?: boolean;\n remarks?: string;\n example?: string[];\n customDeprecatedMessage?: string;\n};\n\nexport type PackageYamlModel = CommonYamlModel & {\n classes?: Array<string>;\n interfaces?: Array<string>;\n enums?: Array<string>;\n typeAliases?: Array<string>;\n properties?: Array<FunctionYamlModel>;\n type?: 'package' | 'module';\n functions?: Array<FunctionYamlModel>;\n};\n\nexport type FunctionYamlModel = CommonYamlModel;\n\nexport type TypeAliasYamlModel = CommonYamlModel & {\n syntax: string;\n};\n\nexport type TypeYamlModel = CommonYamlModel & {\n constructors?: Array<FunctionYamlModel>;\n properties?: Array<FunctionYamlModel>;\n methods?: Array<FunctionYamlModel>;\n events?: Array<FunctionYamlModel>;\n type: 'class' | 'interface';\n extends?: IType | string;\n};\n\nexport type EnumYamlModel = CommonYamlModel & {\n fields: Array<FieldYamlModel>;\n};\n\nexport type FieldYamlModel = IBaseYamlModel & {\n numericValue?: number;\n value?: string;\n};\n\nexport interface ISyntax {\n parameters?: Array<IYamlParameter>;\n content?: string;\n return?: IReturn;\n}\n\nexport interface IYamlParameter {\n id: string;\n type: IType | string;\n description?: string;\n}\n\ninterface IReturn {\n type: IType | string;\n description?: string;\n}\n\nexport interface IType {\n typeName?: string;\n typeId?: number;\n reflectedType?: IReflectedType;\n genericType?: IGenericType;\n intersectionType?: IIntersectionType;\n unionType?: IUnionType;\n arrayType?: IType | string;\n}\n\nexport interface IUnionType {\n types: Types;\n}\n\nexport interface IIntersectionType {\n types: Types;\n}\n\nexport interface IGenericType {\n outter: IType | string;\n inner: Types;\n}\n\nexport interface IReflectedType {\n key: IType | string;\n value: IType | string;\n}\n\nexport interface IException {\n type: string;\n description: string;\n}\n\ntype Types = IType[] | string[];\n"]}