utils/node_modules/@microsoft/api-extractor-model/lib/mixins/ApiNameMixin.js.map

1 line
5.3 KiB
Plaintext
Raw Normal View History

2024-02-07 01:33:07 -05:00
{"version":3,"file":"ApiNameMixin.js","sourceRoot":"","sources":["../../src/mixins/ApiNameMixin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAmB3D,MAAM,KAAK,GAAkB,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAgC1D;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC1B,SAAqB;AACrB,8DAA8D;;IAE9D,MAAM,UAAW,SAAQ,SAAS;QAGhC,8DAA8D;QAC9D,YAAmB,GAAG,IAAW;YAC/B,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAEf,MAAM,OAAO,GAAyB,IAAI,CAAC,CAAC,CAAC,CAAC;YAC9C,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;QAC7B,CAAC;QAED,gBAAgB;QACT,MAAM,CAAC,iBAAiB,CAC7B,OAAsC,EACtC,OAA4B,EAC5B,UAA6B;YAE7B,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YAE1D,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QACjC,CAAC;QAED,IAAW,IAAI;YACb,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;QAED,gBAAgB;QAChB,IAAW,WAAW;YACpB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;QAED,gBAAgB;QACT,aAAa,CAAC,UAAsC;YACzD,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAEhC,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC9B,CAAC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AA5CD,oCA4CC;AAED;;;GAGG;AACH,WAAiB,YAAY;IAC3B;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAgB;QAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAFe,0BAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAa5B","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport type { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';\nimport type { DeserializerContext } from '../model/DeserializerContext';\n\n/**\n * Constructor options for {@link (IApiNameMixinOptions:interface)}.\n * @public\n */\nexport interface IApiNameMixinOptions extends IApiItemOptions {\n name: string;\n}\n\nexport interface IApiNameMixinJson extends IApiItemJson {\n name: string;\n}\n\nconst _name: unique symbol = Symbol('ApiNameMixin._name');\n\n/**\n * The mixin base class for API items that have a name. For example, a class has a name, but a class constructor\n * does not.\n *\n * @remarks\n *\n * This is part of the {@link ApiModel} hierarchy of classes, which are serializable representations of\n * API declarations. The non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\n * TypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\n * features that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\n * to extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\n * the function that generates a subclass, an interface that describes the members of the subclass, and\n * a namespace containing static members of the class.\n *\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface ApiNameMixin extends ApiItem {\n /**\n * The exported name of this API item.\n *\n * @remarks\n * Note that due tue type aliasing, the exported name may be different from the locally declared name.\n */\n readonly name: string;\n\n /** @override */\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link (ApiNameMixin:interface)}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiNameMixin:interface)} functionality.\n *\n * @public\n */\nexport function ApiNameMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiNameMixin) {\n class MixedClass extends baseClass implements ApiNameMixin {\n public readonly [_name]: string;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n\n const options: IApiNameMixinOptions = args[0];\n this[_name] = options.name;\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiN