{"version":3,"file":"DeserializerContext.js","sourceRoot":"","sources":["../../src/model/DeserializerContext.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,IAAY,oBA+GX;AA/GD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,sEAAa,CAAA;IAEb;;OAEG;IACH,sEAAa,CAAA;IAEb;;OAEG;IACH,sEAAa,CAAA;IAEb;;;;;OAKG;IACH,sEAAa,CAAA;IAEb;;;;;OAKG;IACH,sEAAa,CAAA;IAEb;;;;OAIG;IACH,sEAAa,CAAA;IAEb;;;;;;;;OAQG;IACH,sEAAa,CAAA;IAEb;;;;OAIG;IACH,sEAAa,CAAA;IAEb;;;;;OAKG;IACH,sEAAa,CAAA;IAEb;;;;OAIG;IACH,sEAAa,CAAA;IAEb;;;;OAIG;IACH,sEAAa,CAAA;IAEb;;;;;OAKG;IACH,sEAAa,CAAA;IAEb;;;;;OAKG;IACH,sEAAe,CAAA;IAEf;;;;;OAKG;IACH,0FAAyB,CAAA;IAEzB;;;;;;OAMG;IACH,8GAAmC,CAAA;AACrC,CAAC,EA/GW,oBAAoB,oCAApB,oBAAoB,QA+G/B;AAED,MAAa,mBAAmB;IA0B9B,YAAmB,OAA4B;QAC7C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QACzD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IACvD,CAAC;CACF;AAjCD,kDAiCC","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 { TSDocConfiguration } from '@microsoft/tsdoc';\n\nexport enum ApiJsonSchemaVersion {\n /**\n * The initial release.\n */\n V_1000 = 1000,\n\n /**\n * Add support for type parameters and type alias types.\n */\n V_1001 = 1001,\n\n /**\n * Remove `canonicalReference` field. This field was for diagnostic purposes only and was never deserialized.\n */\n V_1002 = 1002,\n\n /**\n * Reintroduce the `canonicalReference` field using the experimental new TSDoc declaration reference notation.\n *\n * This is not a breaking change because this field is never deserialized; it is provided for informational\n * purposes only.\n */\n V_1003 = 1003,\n\n /**\n * Add a `tsdocConfig` field that tracks the TSDoc configuration for parsing doc comments.\n *\n * This is not a breaking change because an older implementation will still work correctly. The\n * custom tags will be skipped over by the parser.\n */\n V_1004 = 1004,\n\n /**\n * Add an `isOptional` field to `Parameter` and `TypeParameter` to track whether a function parameter is optional.\n *\n * When loading older JSON files, the value defaults to `false`.\n */\n V_1005 = 1005,\n\n /**\n * Add an `isProtected` field to `ApiConstructor`, `ApiMethod`, and `ApiProperty` to\n * track whether a class member has the `protected` modifier.\n *\n * Add an `isReadonly` field to `ApiProperty`, `ApiPropertySignature`, and `ApiVariable` to\n * track whether the item is readonly.\n *\n * When loading older JSON files, the values default to `false`.\n */\n V_1006 = 1006,\n\n /**\n * Add `ApiItemContainerMixin.preserveMemberOrder` to support enums that preserve their original sort order.\n *\n * When loading older JSON files, the value default to `false`.\n */\n V_1007 = 1007,\n\n /**\n * Add an `initializerTokenRange` field to `ApiProperty` and `ApiVariable` to track the item's\n * initializer.\n *\n * When loading older JSON files, this range is empty.\n */\n V_1008 = 1008,\n\n /**\n * Add an `isReadonly` field to `ApiIndexSignature` to track whether the item is readonly.\n *\n * When loading older JSON files, the values defaults to `false`.\n */\n V_1009 = 1009,\n\n /**\n * Add a `fileUrlPath` field to `ApiDeclaredItem` to track the URL to a declared item's source file.\n *\n * When loading older JSON files, the value defaults to `undefined`.\n */\n V_1010 = 1010,\n\n /**\n * Add an `isAbstract` field to `ApiClass`, `ApiMethod`, and `ApiProperty` to\n * track whether the item is abstract.\n *\n * When loading older JSON files, the value defaults to `false`.\n */\n V_1011 = 1011,\n\n /**\n * The current latest .api.json schema version.\n *\n * IMPORTANT: When incrementing this number, consider whether `OLDEST_SUPPORTED` or `OLDEST_FORWARDS_COMPATIBLE`\n * should be updated.\n */\n LATEST = V_1011,\n\n /**\n * The oldest .api.json schema version that is still supported for backwards compatibility.\n *\n * This must be updated if you change to the file format and do not implement compatibility logic for\n * deserializing the older representation.\n */\n OLDEST_SUPPORTED = V_1001,\n\n /**\n * Used to assign `IApiPackageMetadataJson.oldestForwardsCompatibleVersion`.\n *\n * This value must be \\<= `ApiJsonSchemaVersion.LATEST`. It must be reset to the `LATEST` value\n * if the older library would not be able to deserialize your new file format. Adding a nonessential field\n * is generally okay. Removing, modifying, or reinterpreting existing fields is NOT safe.\n */\n OLDEST_FORWARDS_COMPATIBLE = V_1001\n}\n\nexport class DeserializerContext {\n /**\n * The path of the file being deserialized, which may be useful for diagnostic purposes.\n */\n public readonly apiJsonFilename: string;\n\n /**\n * Metadata from `IApiPackageMetadataJson.toolPackage`.\n */\n public readonly toolPackage: string;\n\n /**\n * Metadata from `IApiPackageMetadataJson.toolVersion`.\n */\n public readonly toolVersion: string;\n\n /**\n * The version of the schema being deserialized, as obtained from `IApiPackageMetadataJson.schemaVersion`.\n */\n public readonly versionToDeserialize: ApiJsonSchemaVersion;\n\n /**\n * The TSDoc configuration for the context.\n */\n public readonly tsdocConfiguration: TSDocConfiguration;\n\n public constructor(options: DeserializerContext) {\n this.apiJsonFilename = options.apiJsonFilename;\n this.toolPackage = options.toolPackage;\n this.toolVersion = options.toolVersion;\n this.versionToDeserialize = options.versionToDeserialize;\n this.tsdocConfiguration = options.tsdocConfiguration;\n }\n}\n"]}
{"version":3,"file":"HeritageType.js","sourceRoot":"","sources":["../../src/model/HeritageType.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,YAAY;IAiBvB,YAAmB,OAAgB;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AApBD,oCAoBC","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 { Excerpt } from '../mixins/Excerpt';\n\n/**\n * Represents a type referenced via an \"extends\" or \"implements\" heritage clause for a TypeScript class\n * or interface.\n *\n * @remarks\n *\n * For example, consider this declaration:\n *\n * ```ts\n * export class Widget extends Controls.WidgetBase implements Controls.IWidget, IDisposable {\n * // . . .\n * }\n * ```\n *\n * The heritage types are `Controls.WidgetBase`, `Controls.IWidget`, and `IDisposable`.\n * @public\n */\nexport class HeritageType {\n /**\n * An excerpt corresponding to the referenced type.\n * @remarks\n *\n * For example, consider this declaration:\n *\n * ```ts\n * export class Widget extends Controls.WidgetBase implements Controls.IWidget, IDisposable {\n * // . . .\n * }\n * ```\n *\n * The excerpt might be `Controls.WidgetBase`, `Controls.IWidget`, or `IDisposable`.\n */\n public readonly excerpt: Excerpt;\n\n public constructor(excerpt: Excerpt) {\n this.excerpt = excerpt;\n }\n}\n"]}
{"version":3,"file":"ModelReferenceResolver.js","sourceRoot":"","sources":["../../src/model/ModelReferenceResolver.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,4CAAsG;AAEtG,8CAA6D;AAI7D,2EAAwE;AACxE,2EAAwE;AAoBxE;;;;;;;GAOG;AACH,MAAa,sBAAsB;IAGjC,YAAmB,QAAkB;QACnC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAEM,OAAO,CACZ,oBAA6C,EAC7C,cAAmC;QAEnC,MAAM,MAAM,GAAuC;YACjD,eAAe,EAAE,SAAS;YAC1B,YAAY,EAAE,SAAS;SACxB,CAAC;QAEF,IAAI,UAAU,GAA2B,SAAS,CAAC;QAEnD,iCAAiC;QACjC,IAAI,oBAAoB,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACnD,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,mBAAmB,C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AChB,CAAC;QAED,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACjC,MAAM,CAAC,eAAe,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;YAC5C,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,CAAC,YAAY,GAAG,wBAAwB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,gBAAgB,CAAC;QACzF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AArMD,wDAqMC","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 DocDeclarationReference, type DocMemberSelector, SelectorKind } from '@microsoft/tsdoc';\n\nimport { type ApiItem, ApiItemKind } from '../items/ApiItem';\nimport type { ApiModel } from './ApiModel';\nimport type { ApiPackage } from './ApiPackage';\nimport type { ApiEntryPoint } from './ApiEntryPoint';\nimport { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin';\nimport { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';\n\n/**\n * Result object for {@link ApiModel.resolveDeclarationReference}.\n *\n * @public\n */\nexport interface IResolveDeclarationReferenceResult {\n /**\n * The referenced ApiItem, if the declaration reference could be resolved.\n */\n resolvedApiItem: ApiItem | undefined;\n\n /**\n * If resolvedApiItem is undefined, then this will always contain an error message explaining why the\n * resolution failed.\n */\n errorMessage: string | undefined;\n}\n\n/**\n * This resolves a TSDoc declaration reference by walking the `ApiModel` hierarchy.\n *\n * @remarks\n *\n * This class is analogous to `AstReferenceResolver` from the `@microsoft/api-extractor` project,\n * which resolves declaration references by walking the compiler state.\n */\nexport class ModelReferenceResolver {\n private readonly _apiModel: ApiModel;\n\n public constructor(apiModel: ApiModel) {\n this._apiModel = apiModel;\n }\n\n public resolve(\n declarationReference: DocDeclarationReference,\n contextApiItem: ApiItem | undefined\n ): IResolveDeclarationReferenceResult {\n const result: IResolveDeclarationReferenceResult = {\n resolvedApiItem: undefined,\n errorMessage: undefined\n };\n\n let apiPackage: ApiPackage | undefined = undefined;\n\n // Is this an absolute reference?\n if (declarationReference.packageName !== undefined) {\n apiPackage = this._apiModel.tryGetPackageByName(declarationReference.packageName);\n if (apiPackage === undefined) {\n result.errorMessage = `The package \"${declarationReference.packageName}\" could not be located`;\n return result;\n }\n } else {\n // If the package name is omitted, try to infer it from the context\n if (contextApiItem !== undefined) {\n apiPackage = contextApiItem.getAssociatedPackage();\n }\n\n if (apiPackage === undefined) {\n result.errorMessage =\n `The reference does not include a package name, and the package could not be inferred` +\n ` from the context`;\n return result;\n }\n }\n\n const importPath: string = declarationReference.importPath || '';\n\n const foundEntryPoints: ReadonlyArray<ApiEntryPoint> = apiPackage.findEntryPointsByPath(importPath);\n if (foundEntryPoints.length !== 1) {\n result.errorMessage = `The import path \"${importPath}\" could not be resolved`;\n return result;\n }\n\n let currentItem: ApiItem = foundEntryPoints[0];\n\n // Now search for the member reference\n for (const memberReference of declarationReference.memberReferences) {\n if (memberReference.memberSymbol !== undefined) {\n result.errorMessage = `Symbols are not yet supported in declaration references`;\n return result;\n }\n\n if (memberReference.memberIdentifier === undefined) {\n result.errorMessage = `Missing member identifier`;\n return result;\n }\n\n const identifier: string = memberReference.memberIdentifier.identifier;\n\n if (!ApiItemContainerMixin.isBaseClassOf(currentItem)) {\n // For example, {@link MyClass.myMethod.X} is invalid because methods cannot contain members\n result.errorMessage = `Unable to resolve ${JSON.stringify(\n identifier\n )} because ${currentItem.getScopedNameWithinPackage()} cannot act as a container`;\n return result;\n }\n\n const foundMembers: ReadonlyArray<ApiItem> = currentItem.findMembersByName(identifier);\n if (foundMembers.length === 0) {\n result.errorMessage = `The member reference ${JSON.stringify(identifier)} was not found`;\n return result;\n }\n\n const memberSelector: DocMemberSelector | undefined = memberReference.selector;\n if (memberSelector === undefined) {\n if (foundMembers.length > 1) {\n result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;\n return result;\n }\n currentItem = foundMembers[0];\n } else {\n let memberSelectorResult: IResolveDeclarationReferenceResult;\n switch (memberSelector.selectorKind) {\n case SelectorKind.System:\n memberSelectorResult = this._selectUsingSystemSelector(foundMembers, memberSelector, identifier);\n break;\n case SelectorKind.Index:\n memberSelectorResult = this._selectUsingIndexSelector(foundMembers, memberSelector, identifier);\n break;\n default:\n result.errorMessage = `The selector \"${memberSelector.selector}\" is not a supported selector type`;\n return result;\n }\n if (memberSelectorResult.resolvedApiItem === undefined) {\n return memberSelectorResult;\n }\n currentItem = memberSelectorResult.resolvedApiItem;\n }\n }\n result.resolvedApiItem = currentItem;\n return result;\n }\n\n private _selectUsingSystemSelector(\n foundMembers: ReadonlyArray<ApiItem>,\n memberSelector: DocMemberSelector,\n identifier: string\n ): IResolveDeclarationReferenceResult {\n const result: IResolveDeclarationReferenceResult = {\n resolvedApiItem: undefined,\n errorMessage: undefined\n };\n\n const selectorName: string = memberSelector.selector;\n\n let selectorItemKind: ApiItemKind;\n switch (selectorName) {\n case 'class':\n selectorItemKind = ApiItemKind.Class;\n break;\n case 'enum':\n selectorItemKind = ApiItemKind.Enum;\n break;\n case 'function':\n selectorItemKind = ApiItemKind.Function;\n break;\n case 'interface':\n selectorItemKind = ApiItemKind.Interface;\n break;\n case 'namespace':\n selectorItemKind = ApiItemKind.Namespace;\n break;\n case 'type':\n selectorItemKind = ApiItemKind.TypeAlias;\n break;\n case 'variable':\n selectorItemKind = ApiItemKind.Variable;\n break;\n default:\n result.errorMessage = `Unsupported system selector \"${selectorName}\"`;\n return result;\n }\n\n const matches: ApiItem[] = foundMembers.filter((x) => x.kind === selectorItemKind);\n if (matches.length === 0) {\n result.errorMessage =\n `A declaration for \"${identifier}\" was not found that matches the` +\n ` TSDoc selector \"${selectorName}\"`;\n return result;\n }\n if (matches.length > 1) {\n result.errorMessage = `More than one declaration \"${identifier}\" matches the TSDoc selector \"${selectorName}\"`;\n }\n result.resolvedApiItem = matches[0];\n return result;\n }\n\n private _selectUsingIndexSelector(\n foundMembers: ReadonlyArray<ApiItem>,\n memberSelector: DocMemberSelector,\n identifier: string\n ): IResolveDeclarationReferenceResult {\n const result: IResolveDeclarationReferenceResult = {\n resolvedApiItem: undefined,\n errorMessage: undefined\n };\n\n const selectedMembers: ApiItem[] = [];\n\n const selectorOverloadIndex: number = parseInt(memberSelector.selector, 10);\n for (const foundMember of foundMembers) {\n if (ApiParameterListMixin.isBaseClassOf(foundMember)) {\n if (foundMember.overloadIndex === selectorOverloadIndex) {\n selectedMembers.push(foundMember);\n }\n }\n }\n\n if (selectedMembers.length === 0) {\n result.errorMessage =\n `An overload for ${JSON.stringify(identifier)} was not found that matches` +\n ` the TSDoc selector \":${selectorOverloadIndex}\"`;\n return result;\n }\n\n if (selectedMembers.length === 1) {\n result.resolvedApiItem = selectedMembers[0];\n return result;\n }\n\n result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;\n return result;\n }\n}\n"]}
{"version":3,"file":"Parameter.js","sourceRoot":"","sources":["../../src/model/Parameter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,kEAA+D;AAe/D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,SAAS;IAkBpB,YAAmB,OAA0B;QAC3C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QACzD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAW,eAAe;QACxB,IAAI,IAAI,CAAC,OAAO,YAAY,qCAAiB,EAAE,CAAC;YAC9C,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;gBAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAnCD,8BAmCC","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 * as tsdoc from '@microsoft/tsdoc';\n\nimport { ApiDocumentedItem } from '../items/ApiDocumentedItem';\nimport type { Excerpt } from '../mixins/Excerpt';\nimport type { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';\n\n/**\n * Constructor options for {@link Parameter}.\n * @public\n */\nexport interface IParameterOptions {\n name: string;\n parameterTypeExcerpt: Excerpt;\n isOptional: boolean;\n parent: ApiParameterListMixin;\n}\n\n/**\n * Represents a named parameter for a function-like declaration.\n *\n * @remarks\n *\n * `Parameter` represents a TypeScript declaration such as `x: number` in this example:\n *\n * ```ts\n * export function add(x: number, y: number): number {\n * return x + y;\n * }\n * ```\n *\n * `Parameter` objects belong to the {@link (ApiParameterListMixin:interface).parameters} collection.\n *\n * @public\n */\nexport class Parameter {\n /**\n * An {@link Excerpt} that describes the type of the parameter.\n */\n public readonly parameterTypeExcerpt: Excerpt;\n\n /**\n * The parameter name.\n */\n public name: string;\n\n /**\n * Whether the parameter is optional.\n */\n public isOptional: boolean;\n\n private _parent: ApiParameterListMixin;\n\n public constructor(options: IParameterOptions) {\n this.name = options.name;\n this.parameterTypeExcerpt = options.parameterTypeExcerpt;\n this.isOptional = options.isOptional;\n this._parent = options.parent;\n }\n\n /**\n * Returns the `@param` documentation for this parameter, if present.\n */\n public get tsdocParamBlock(): tsdoc.DocParamBlock | undefined {\n if (this._parent instanceof ApiDocumentedItem) {\n if (this._parent.tsdocComment) {\n return this._parent.tsdocComment.params.tryGetBlockByName(this.name);\n }\n }\n }\n}\n"]}
{"version":3,"file":"SourceLocation.js","sourceRoot":"","sources":["../../src/model/SourceLocation.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,uCAA+B;AAoB/B;;;;;;;;;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,CAAC;YAC5E,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,gBAAgB,GAAW,IAAI,CAAC,iBAAiB,CAAC;QACtD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,gBAAgB,IAAI,GAAG,CAAC;QAC1B,CAAC;QAED,MAAM,GAAG,GAAQ,IAAI,cAAG,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 'node: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"]}