utils/node_modules/@microsoft/api-extractor-model/lib/model/SourceLocation.js.map
2024-02-07 01:33:07 -05:00

1 line
2.5 KiB
Plaintext

{"version":3,"file":"SourceLocation.js","sourceRoot":"","sources":["../../src/model/SourceLocation.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,6BAA0B;AAoB1B;;;;;;;;;GASG;AACH,MAAa,cAAc;IAIzB,YAAmB,OAA+B;QAChD,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QAClD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,IAAW,OAAO;QAChB,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE;YAC3E,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,gBAAgB,GAAW,IAAI,CAAC,iBAAiB,CAAC;QACtD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACnC,gBAAgB,IAAI,GAAG,CAAC;SACzB;QAED,MAAM,GAAG,GAAQ,IAAI,SAAG,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;QAC9D,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;CACF;AA1BD,wCA0BC","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 { URL } from 'url';\n\n/**\n * Constructor options for `SourceLocation`.\n * @public\n */\nexport interface ISourceLocationOptions {\n /**\n * The project folder URL as defined by the `api-extractor.json` config `projectFolderUrl`\n * setting.\n */\n projectFolderUrl?: string;\n\n /**\n * The file URL path relative to the `projectFolder` and `projectFolderURL` fields as\n * defined in the `api-extractor.json` config.\n */\n fileUrlPath?: string;\n}\n\n/**\n * The source location where a given API item is declared.\n *\n * @remarks\n * The source location points to the `.ts` source file where the API item was originally\n declared. However, in some cases, if source map resolution fails, it falls back to pointing\n to the `.d.ts` file instead.\n *\n * @public\n */\nexport class SourceLocation {\n private readonly _projectFolderUrl?: string;\n private readonly _fileUrlPath?: string;\n\n public constructor(options: ISourceLocationOptions) {\n this._projectFolderUrl = options.projectFolderUrl;\n this._fileUrlPath = options.fileUrlPath;\n }\n\n /**\n * Returns the file URL to the given source location. Returns `undefined` if the file URL\n * cannot be determined.\n */\n public get fileUrl(): string | undefined {\n if (this._projectFolderUrl === undefined || this._fileUrlPath === undefined) {\n return undefined;\n }\n\n let projectFolderUrl: string = this._projectFolderUrl;\n if (!projectFolderUrl.endsWith('/')) {\n projectFolderUrl += '/';\n }\n\n const url: URL = new URL(this._fileUrlPath, projectFolderUrl);\n return url.href;\n }\n}\n"]}