@microsoft/api-extractor-model 7.15.3 → 7.16.1

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.
package/README.md CHANGED
@@ -61,7 +61,7 @@ a namespace containing static members of the class.
61
61
  ## Links
62
62
 
63
63
  - [CHANGELOG.md](
64
- https://github.com/microsoft/rushstack/blob/master/apps/api-extractor-model/CHANGELOG.md) - Find
64
+ https://github.com/microsoft/rushstack/blob/main/libraries/api-extractor-model/CHANGELOG.md) - Find
65
65
  out what's new in the latest version
66
66
  - [API Reference](https://rushstack.io/pages/api/api-extractor-model/)
67
67
 
package/dist/rollup.d.ts CHANGED
@@ -735,30 +735,36 @@ declare enum ApiJsonSchemaVersion {
735
735
  */
736
736
  V_1001 = 1001,
737
737
  /**
738
- * Remove "canonicalReference" field. This field was for diagnostic purposes only and was never deserialized.
738
+ * Remove `canonicalReference` field. This field was for diagnostic purposes only and was never deserialized.
739
739
  */
740
740
  V_1002 = 1002,
741
741
  /**
742
- * Reintroduce the "canonicalReference" field using the experimental new TSDoc declaration reference notation.
742
+ * Reintroduce the `canonicalReference` field using the experimental new TSDoc declaration reference notation.
743
743
  *
744
744
  * This is not a breaking change because this field is never deserialized; it is provided for informational
745
745
  * purposes only.
746
746
  */
747
747
  V_1003 = 1003,
748
748
  /**
749
- * Add a "tsdocConfig" field that tracks the TSDoc configuration for parsing doc comments.
749
+ * Add a `tsdocConfig` field that tracks the TSDoc configuration for parsing doc comments.
750
750
  *
751
751
  * This is not a breaking change because an older implementation will still work correctly. The
752
752
  * custom tags will be skipped over by the parser.
753
753
  */
754
754
  V_1004 = 1004,
755
+ /**
756
+ * Add an `isOptional` field to `IApiParameterOptions` to track whether a function parameter is optional.
757
+ *
758
+ * When loading older JSON files, the value defaults to `false`.
759
+ */
760
+ V_1005 = 1005,
755
761
  /**
756
762
  * The current latest .api.json schema version.
757
763
  *
758
764
  * IMPORTANT: When incrementing this number, consider whether `OLDEST_SUPPORTED` or `OLDEST_FORWARDS_COMPATIBLE`
759
765
  * should be updated.
760
766
  */
761
- LATEST = 1004,
767
+ LATEST = 1005,
762
768
  /**
763
769
  * The oldest .api.json schema version that is still supported for backwards compatibility.
764
770
  *
@@ -1981,6 +1987,7 @@ export declare interface IApiParameterListMixinOptions extends IApiItemOptions {
1981
1987
  export declare interface IApiParameterOptions {
1982
1988
  parameterName: string;
1983
1989
  parameterTypeTokenRange: IExcerptTokenRange;
1990
+ isOptional: boolean;
1984
1991
  }
1985
1992
 
1986
1993
  declare interface IApiPropertyItemJson extends IApiDeclaredItemJson {
@@ -2121,6 +2128,7 @@ export declare interface IExcerptTokenRange {
2121
2128
  export declare interface IParameterOptions {
2122
2129
  name: string;
2123
2130
  parameterTypeExcerpt: Excerpt;
2131
+ isOptional: boolean;
2124
2132
  parent: ApiParameterListMixin;
2125
2133
  }
2126
2134
 
@@ -2178,6 +2186,10 @@ export declare class Parameter {
2178
2186
  * The parameter name.
2179
2187
  */
2180
2188
  name: string;
2189
+ /**
2190
+ * Whether the parameter is optional.
2191
+ */
2192
+ isOptional: boolean;
2181
2193
  private _parent;
2182
2194
  constructor(options: IParameterOptions);
2183
2195
  /**
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.19.2"
8
+ "packageVersion": "7.19.4"
9
9
  }
10
10
  ]
11
11
  }
@@ -8,6 +8,7 @@ import { IExcerptTokenRange } from './Excerpt';
8
8
  export interface IApiParameterOptions {
9
9
  parameterName: string;
10
10
  parameterTypeTokenRange: IExcerptTokenRange;
11
+ isOptional: boolean;
11
12
  }
12
13
  /**
13
14
  * Constructor options for {@link (ApiParameterListMixin:interface)}.
@@ -1 +1 @@
1
- {"version":3,"file":"ApiParameterListMixin.d.ts","sourceRoot":"","sources":["../../src/mixins/ApiParameterListMixin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE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
32
  const parameter = new Parameter_1.Parameter({
33
33
  name: parameterOptions.parameterName,
34
34
  parameterTypeExcerpt: this.buildExcerpt(parameterOptions.parameterTypeTokenRange),
35
+ // Prior to ApiJsonSchemaVersion.V_1005 this input will be undefined
36
+ isOptional: !!parameterOptions.isOptional,
35
37
  parent: this
36
38
  });
37
39
  this[_parameters].push(parameter);
@@ -62,7 +64,8 @@ function ApiParameterListMixin(baseClass
62
64
  for (const parameter of this.parameters) {
63
65
  parameterObjects.push({
64
66
  parameterName: parameter.name,
65
- parameterTypeTokenRange: parameter.parameterTypeExcerpt.tokenRange
67
+ parameterTypeTokenRange: parameter.parameterTypeExcerpt.tokenRange,
68
+ isOptional: parameter.isOptional
66
69
  });
67
70
  }
68
71
  jsonObject.parameters = parameterObjects;
@@ -1 +1 @@
1
- {"version":3,"file":"ApiParameterListMixin.js","sourceRoot":"","sources":["../../src/mixins/ApiParameterListMixin.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,4DAA4D;;;AAG5D,kDAA+C;AAC/C,8DAA2D;AAE3D,oEAA6D;AA0B7D,MAAM,cAAc,GAAkB,MAAM,CAAC,sCAAsC,CAAC,CAAC;AACrF,MAAM,WAAW,GAAkB,MAAM,CAAC,mCAAmC,CAAC,CAAC;AAwD/E;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,SAAqB;AACrB,8DAA8D;;IAE9D,MAAM,UAAW,SAAQ,SAAS;QAIhC,8DAA8D;QAC9D,YAAmB,GAAG,IAAW;YAC/B,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YAEf,MAAM,OAAO,GAAkC,IAAI,CAAC,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;YAE7C,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;YAEvB,IAAI,IAAI,YAAY,iCAAe,EAAE;gBACnC,IAAI,OAAO,CAAC,UAAU,EAAE;oBACtB,KAAK,MAAM,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AAU,CAAC,UAAU,GAAG,gBAAgB,CAAC;QAC3C,CAAC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAzED,sDAyEC;AAED;;;GAGG;AACH,WAAiB,qBAAqB;IACpC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAgB;QAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IAFe,mCAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAarC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.s\n\nimport { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';\nimport { Parameter } from '../model/Parameter';\nimport { ApiDeclaredItem } from '../items/ApiDeclaredItem';\nimport { IExcerptTokenRange } from './Excerpt';\nimport { InternalError } from '@rushstack/node-core-library';\nimport { DeserializerContext } from '../model/DeserializerContext';\n\n/**\n * Represents parameter information that is part of {@link IApiParameterListMixinOptions}\n * @public\n */\nexport interface IApiParameterOptions {\n parameterName: string;\n parameterTypeTokenRange: IExcerptTokenRange;\n}\n\n/**\n * Constructor options for {@link (ApiParameterListMixin:interface)}.\n * @public\n */\nexport interface IApiParameterListMixinOptions extends IApiItemOptions {\n overloadIndex: number;\n parameters: IApiParameterOptions[];\n}\n\nexport interface IApiParameterListJson extends IApiItemJson {\n overloadIndex: number;\n parameters: IApiParameterOptions[];\n}\n\nconst _overloadIndex: unique symbol = Symbol('ApiParameterListMixin._overloadIndex');\nconst _parameters: unique symbol = Symbol('ApiParameterListMixin._parameters');\n\n/**\n * The mixin base class for API items that can have function parameters (but not necessarily a return value).\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 ApiParameterListMixin extends ApiItem {\n /**\n * When a function has multiple overloaded declarations, this zero-based integer index can be used to unqiuely\n * identify them.\n *\n * @remarks\n *\n * Consider this overloaded declaration:\n *\n * ```ts\n * export namespace Versioning {\n * // TSDoc: Versioning.(addVersions:1)\n * export function addVersions(x: number, y: number): number;\n *\n * // TSDoc: Versioning.(addVersions:2)\n * export function addVersions(x: string, y: string): string;\n *\n * // (implementation)\n * export function addVersions(x: number|string, y: number|string): number|string {\n * // . . .\n * }\n * }\n * ```\n *\n * In the above example, there are two overloaded declarations. The overload using numbers will have\n * `overloadIndex = 1`. The overload using strings will have `overloadIndex = 2`. The third declaration that\n * accepts all possible inputs is considered part of the implementation, and is not processed by API Extractor.\n */\n readonly overloadIndex: number;\n\n /**\n * The function parameters.\n */\n readonly parameters: ReadonlyArray<Parameter>;\n\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link (ApiParameterListMixin:interface)}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiParameterListMixin:interface)} functionality.\n *\n * @public\n */\nexport function ApiParameterListMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiParameterListMixin) {\n class MixedClass extends baseClass implements ApiParameterListMixin {\n public readonly [_overloadIndex]: number;\n public readonly [_parameters]: Parameter[];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n\n const options: IApiParameterListMixinOptions = args[0];\n this[_overloadIndex] = options.overloadIndex;\n\n this[_parameters] = [];\n\n if (this instanceof ApiDeclaredItem) {\n if (options.parameters) {\n for (const parameterOptions of options.parameters) {\n const parameter: Parameter = new Parameter({\n name: parameterOptions.parameterName,\n parameterTypeExcerpt: this.buildExcerpt(parameterOptions.parameterTypeTokenRange),\n parent: this\n });\n\n this[_parameters].push(parameter);\n }\n }\n } else {\n throw new InternalError('ApiReturnTypeMixin expects a base class that inherits from ApiDeclaredItem');\n }\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiParameterListMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiParameterListJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n\n options.overloadIndex = jsonObject.overloadIndex;\n options.parameters = jsonObject.parameters || [];\n }\n\n public get overloadIndex(): number {\n return this[_overloadIndex];\n }\n\n public get parameters(): ReadonlyArray<Parameter> {\n return this[_parameters];\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiParameterListJson>): void {\n super.serializeInto(jsonObject);\n\n jsonObject.overloadIndex = this.overloadIndex;\n\n const parameterObjects: IApiParameterOptions[] = [];\n for (const parameter of this.parameters) {\n parameterObjects.push({\n parameterName: parameter.name,\n parameterTypeTokenRange: parameter.parameterTypeExcerpt.tokenRange\n });\n }\n\n jsonObject.parameters = parameterObjects;\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Static members for {@link (ApiParameterListMixin:interface)}.\n * @public\n */\nexport namespace ApiParameterListMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiParameterListMixin {\n return apiItem.hasOwnProperty(_parameters);\n }\n}\n"]}
1
+ {"version":3,"file":"ApiParameterListMixin.js","s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AA4B,EAC5B,UAAiC;YAEjC,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YAE1D,OAAO,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC;YACjD,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;QACnD,CAAC;QAED,IAAW,aAAa;YACtB,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC;QAC9B,CAAC;QAED,IAAW,UAAU;YACnB,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3B,CAAC;QAED,gBAAgB;QACT,aAAa,CAAC,UAA0C;YAC7D,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAEhC,UAAU,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;YAE9C,MAAM,gBAAgB,GAA2B,EAAE,CAAC;YACpD,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE;gBACvC,gBAAgB,CAAC,IAAI,CAAC;oBACpB,aAAa,EAAE,SAAS,CAAC,IAAI;oBAC7B,uBAAuB,EAAE,SAAS,CAAC,oBAAoB,CAAC,UAAU;oBAClE,UAAU,EAAE,SAAS,CAAC,UAAU;iBACjC,CAAC,CAAC;aACJ;YAED,UAAU,CAAC,UAAU,GAAG,gBAAgB,CAAC;QAC3C,CAAC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AA5ED,sDA4EC;AAED;;;GAGG;AACH,WAAiB,qBAAqB;IACpC;;;;;;;;OAQG;IACH,SAAgB,aAAa,CAAC,OAAgB;QAC5C,OAAO,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IAFe,mCAAa,gBAE5B,CAAA;AACH,CAAC,EAbgB,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAarC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.s\n\nimport { ApiItem, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../items/ApiItem';\nimport { Parameter } from '../model/Parameter';\nimport { ApiDeclaredItem } from '../items/ApiDeclaredItem';\nimport { IExcerptTokenRange } from './Excerpt';\nimport { InternalError } from '@rushstack/node-core-library';\nimport { DeserializerContext } from '../model/DeserializerContext';\n\n/**\n * Represents parameter information that is part of {@link IApiParameterListMixinOptions}\n * @public\n */\nexport interface IApiParameterOptions {\n parameterName: string;\n parameterTypeTokenRange: IExcerptTokenRange;\n isOptional: boolean;\n}\n\n/**\n * Constructor options for {@link (ApiParameterListMixin:interface)}.\n * @public\n */\nexport interface IApiParameterListMixinOptions extends IApiItemOptions {\n overloadIndex: number;\n parameters: IApiParameterOptions[];\n}\n\nexport interface IApiParameterListJson extends IApiItemJson {\n overloadIndex: number;\n parameters: IApiParameterOptions[];\n}\n\nconst _overloadIndex: unique symbol = Symbol('ApiParameterListMixin._overloadIndex');\nconst _parameters: unique symbol = Symbol('ApiParameterListMixin._parameters');\n\n/**\n * The mixin base class for API items that can have function parameters (but not necessarily a return value).\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 ApiParameterListMixin extends ApiItem {\n /**\n * When a function has multiple overloaded declarations, this zero-based integer index can be used to unqiuely\n * identify them.\n *\n * @remarks\n *\n * Consider this overloaded declaration:\n *\n * ```ts\n * export namespace Versioning {\n * // TSDoc: Versioning.(addVersions:1)\n * export function addVersions(x: number, y: number): number;\n *\n * // TSDoc: Versioning.(addVersions:2)\n * export function addVersions(x: string, y: string): string;\n *\n * // (implementation)\n * export function addVersions(x: number|string, y: number|string): number|string {\n * // . . .\n * }\n * }\n * ```\n *\n * In the above example, there are two overloaded declarations. The overload using numbers will have\n * `overloadIndex = 1`. The overload using strings will have `overloadIndex = 2`. The third declaration that\n * accepts all possible inputs is considered part of the implementation, and is not processed by API Extractor.\n */\n readonly overloadIndex: number;\n\n /**\n * The function parameters.\n */\n readonly parameters: ReadonlyArray<Parameter>;\n\n serializeInto(jsonObject: Partial<IApiItemJson>): void;\n}\n\n/**\n * Mixin function for {@link (ApiParameterListMixin:interface)}.\n *\n * @param baseClass - The base class to be extended\n * @returns A child class that extends baseClass, adding the {@link (ApiParameterListMixin:interface)} functionality.\n *\n * @public\n */\nexport function ApiParameterListMixin<TBaseClass extends IApiItemConstructor>(\n baseClass: TBaseClass\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): TBaseClass & (new (...args: any[]) => ApiParameterListMixin) {\n class MixedClass extends baseClass implements ApiParameterListMixin {\n public readonly [_overloadIndex]: number;\n public readonly [_parameters]: Parameter[];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public constructor(...args: any[]) {\n super(...args);\n\n const options: IApiParameterListMixinOptions = args[0];\n this[_overloadIndex] = options.overloadIndex;\n\n this[_parameters] = [];\n\n if (this instanceof ApiDeclaredItem) {\n if (options.parameters) {\n for (const parameterOptions of options.parameters) {\n const parameter: Parameter = new Parameter({\n name: parameterOptions.parameterName,\n parameterTypeExcerpt: this.buildExcerpt(parameterOptions.parameterTypeTokenRange),\n // Prior to ApiJsonSchemaVersion.V_1005 this input will be undefined\n isOptional: !!parameterOptions.isOptional,\n parent: this\n });\n\n this[_parameters].push(parameter);\n }\n }\n } else {\n throw new InternalError('ApiReturnTypeMixin expects a base class that inherits from ApiDeclaredItem');\n }\n }\n\n /** @override */\n public static onDeserializeInto(\n options: Partial<IApiParameterListMixinOptions>,\n context: DeserializerContext,\n jsonObject: IApiParameterListJson\n ): void {\n baseClass.onDeserializeInto(options, context, jsonObject);\n\n options.overloadIndex = jsonObject.overloadIndex;\n options.parameters = jsonObject.parameters || [];\n }\n\n public get overloadIndex(): number {\n return this[_overloadIndex];\n }\n\n public get parameters(): ReadonlyArray<Parameter> {\n return this[_parameters];\n }\n\n /** @override */\n public serializeInto(jsonObject: Partial<IApiParameterListJson>): void {\n super.serializeInto(jsonObject);\n\n jsonObject.overloadIndex = this.overloadIndex;\n\n const parameterObjects: IApiParameterOptions[] = [];\n for (const parameter of this.parameters) {\n parameterObjects.push({\n parameterName: parameter.name,\n parameterTypeTokenRange: parameter.parameterTypeExcerpt.tokenRange,\n isOptional: parameter.isOptional\n });\n }\n\n jsonObject.parameters = parameterObjects;\n }\n }\n\n return MixedClass;\n}\n\n/**\n * Static members for {@link (ApiParameterListMixin:interface)}.\n * @public\n */\nexport namespace ApiParameterListMixin {\n /**\n * A type guard that tests whether the specified `ApiItem` subclass extends the `ApiParameterListMixin` mixin.\n *\n * @remarks\n *\n * The JavaScript `instanceof` operator cannot be used to test for mixin inheritance, because each invocation of\n * the mixin function produces a different subclass. (This could be mitigated by `Symbol.hasInstance`, however\n * the TypeScript type system cannot invoke a runtime test.)\n */\n export function isBaseClassOf(apiItem: ApiItem): apiItem is ApiParameterListMixin {\n return apiItem.hasOwnProperty(_parameters);\n }\n}\n"]}
@@ -9,30 +9,36 @@ export declare enum ApiJsonSchemaVersion {
9
9
  */
10
10
  V_1001 = 1001,
11
11
  /**
12
- * Remove "canonicalReference" field. This field was for diagnostic purposes only and was never deserialized.
12
+ * Remove `canonicalReference` field. This field was for diagnostic purposes only and was never deserialized.
13
13
  */
14
14
  V_1002 = 1002,
15
15
  /**
16
- * Reintroduce the "canonicalReference" field using the experimental new TSDoc declaration reference notation.
16
+ * Reintroduce the `canonicalReference` field using the experimental new TSDoc declaration reference notation.
17
17
  *
18
18
  * This is not a breaking change because this field is never deserialized; it is provided for informational
19
19
  * purposes only.
20
20
  */
21
21
  V_1003 = 1003,
22
22
  /**
23
- * Add a "tsdocConfig" field that tracks the TSDoc configuration for parsing doc comments.
23
+ * Add a `tsdocConfig` field that tracks the TSDoc configuration for parsing doc comments.
24
24
  *
25
25
  * This is not a breaking change because an older implementation will still work correctly. The
26
26
  * custom tags will be skipped over by the parser.
27
27
  */
28
28
  V_1004 = 1004,
29
+ /**
30
+ * Add an `isOptional` field to `IApiParameterOptions` to track whether a function parameter is optional.
31
+ *
32
+ * When loading older JSON files, the value defaults to `false`.
33
+ */
34
+ V_1005 = 1005,
29
35
  /**
30
36
  * The current latest .api.json schema version.
31
37
  *
32
38
  * IMPORTANT: When incrementing this number, consider whether `OLDEST_SUPPORTED` or `OLDEST_FORWARDS_COMPATIBLE`
33
39
  * should be updated.
34
40
  */
35
- LATEST = 1004,
41
+ LATEST = 1005,
36
42
  /**
37
43
  * The oldest .api.json schema version that is still supported for backwards compatibility.
38
44
  *
@@ -1 +1 @@
1
- {"version":3,"file":"DeserializerContext.d.ts","sourceRoot":"","sources":["../../src/model/DeserializerContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,oBAAY,oBAAoB;IAC9B;;OAEG;IACH,MAAM,OAAO;IAEb;;OAEG;IACH,MAAM,OAAO;IAEb;;OAEG;IACH,MAAM,OAAO;IAEb;;;;;OAKG;IACH,MAAM,OAAO;IAEb;;;;;OAKG;IACH,MAAM,OAAO;IAEb;;;;;OAKG;IACH,MAAM,OAAS;IAEf;;;;;OAKG;IACH,gBAAgB,OAAS;IAEzB;;;;;;OAMG;IACH,0BAA0B,OAAS;CACpC;AAED,qBAAa,mBAAmB;IAC9B;;OAEG;IACH,SAAgB,eAAe,EAAE,MAAM,CAAC;IAExC;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,SAAgB,oBAAoB,EAAE,oBAAoB,CAAC;IAE3D;;OAEG;IACH,SAAgB,kBAAkB,EAAE,kBAAkB,CAAC;gBAEpC,OAAO,EAAE,mBAAmB;CAOhD"}
1
+ {"version":3,"file":"DeserializerContext.d.ts","sourceRoot":"","sources":["../../src/model/DeserializerContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,oBAAY,oBAAoB;IAC9B;;OAEG;IACH,MAAM,OAAO;IAEb;;OAEG;IACH,MAAM,OAAO;IAEb;;OAEG;IACH,MAAM,OAAO;IAEb;;;;;OAKG;IACH,MAAM,OAAO;IAEb;;;;;OAKG;IACH,MAAM,OAAO;IAEb;;;;OAIG;IACH,MAAM,OAAO;IAEb;;;;;OAKG;IACH,MAAM,OAAS;IAEf;;;;;OAKG;IACH,gBAAgB,OAAS;IAEzB;;;;;;OAMG;IACH,0BAA0B,OAAS;CACpC;AAED,qBAAa,mBAAmB;IAC9B;;OAEG;IACH,SAAgB,eAAe,EAAE,MAAM,CAAC;IAExC;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,SAAgB,oBAAoB,EAAE,oBAAoB,CAAC;IAE3D;;OAEG;IACH,SAAgB,kBAAkB,EAAE,kBAAkB,CAAC;gBAEpC,OAAO,EAAE,mBAAmB;CAOhD"}
@@ -14,30 +14,36 @@ var ApiJsonSchemaVersion;
14
14
  */
15
15
  ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1001"] = 1001] = "V_1001";
16
16
  /**
17
- * Remove "canonicalReference" field. This field was for diagnostic purposes only and was never deserialized.
17
+ * Remove `canonicalReference` field. This field was for diagnostic purposes only and was never deserialized.
18
18
  */
19
19
  ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1002"] = 1002] = "V_1002";
20
20
  /**
21
- * Reintroduce the "canonicalReference" field using the experimental new TSDoc declaration reference notation.
21
+ * Reintroduce the `canonicalReference` field using the experimental new TSDoc declaration reference notation.
22
22
  *
23
23
  * This is not a breaking change because this field is never deserialized; it is provided for informational
24
24
  * purposes only.
25
25
  */
26
26
  ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1003"] = 1003] = "V_1003";
27
27
  /**
28
- * Add a "tsdocConfig" field that tracks the TSDoc configuration for parsing doc comments.
28
+ * Add a `tsdocConfig` field that tracks the TSDoc configuration for parsing doc comments.
29
29
  *
30
30
  * This is not a breaking change because an older implementation will still work correctly. The
31
31
  * custom tags will be skipped over by the parser.
32
32
  */
33
33
  ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1004"] = 1004] = "V_1004";
34
+ /**
35
+ * Add an `isOptional` field to `IApiParameterOptions` to track whether a function parameter is optional.
36
+ *
37
+ * When loading older JSON files, the value defaults to `false`.
38
+ */
39
+ ApiJsonSchemaVersion[ApiJsonSchemaVersion["V_1005"] = 1005] = "V_1005";
34
40
  /**
35
41
  * The current latest .api.json schema version.
36
42
  *
37
43
  * IMPORTANT: When incrementing this number, consider whether `OLDEST_SUPPORTED` or `OLDEST_FORWARDS_COMPATIBLE`
38
44
  * should be updated.
39
45
  */
40
- ApiJsonSchemaVersion[ApiJsonSchemaVersion["LATEST"] = 1004] = "LATEST";
46
+ ApiJsonSchemaVersion[ApiJsonSchemaVersion["LATEST"] = 1005] = "LATEST";
41
47
  /**
42
48
  * The oldest .api.json schema version that is still supported for backwards compatibility.
43
49
  *
@@ -1 +1 @@
1
- {"version":3,"file":"DeserializerContext.js","sourceRoot":"","sources":["../../src/model/DeserializerContext.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,IAAY,oBAwDX;AAxDD,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;;;;;OAKG;IACH,sEAAe,CAAA;IAEf;;;;;OAKG;IACH,0FAAyB,CAAA;IAEzB;;;;;;OAMG;IACH,8GAAmC,CAAA;AACrC,CAAC,EAxDW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAwD/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 { 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 * 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_1004,\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"]}
1
+ {"version":3,"file":"DeserializerContext.js","sourceRoot":"","sources":["../../src/model/DeserializerContext.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,IAAY,oBA+DX;AA/DD,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;;;;;OAKG;IACH,sEAAe,CAAA;IAEf;;;;;OAKG;IACH,0FAAyB,CAAA;IAEzB;;;;;;OAMG;IACH,8GAAmC,CAAA;AACrC,CAAC,EA/DW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QA+D/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 { 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 `IApiParameterOptions` 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 * 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_1005,\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"]}
@@ -8,6 +8,7 @@ import { ApiParameterListMixin } from '../mixins/ApiParameterListMixin';
8
8
  export interface IParameterOptions {
9
9
  name: string;
10
10
  parameterTypeExcerpt: Excerpt;
11
+ isOptional: boolean;
11
12
  parent: ApiParameterListMixin;
12
13
  }
13
14
  /**
@@ -36,6 +37,10 @@ export declare class Parameter {
36
37
  * The parameter name.
37
38
  */
38
39
  name: string;
40
+ /**
41
+ * Whether the parameter is optional.
42
+ */
43
+ isOptional: boolean;
39
44
  private _parent;
40
45
  constructor(options: IParameterOptions);
41
46
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Parameter.d.ts","sourceRoot":"","sources":["../../src/model/Parameter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB,EAAE,OAAO,CAAC;IAC9B,MAAM,EAAE,qBAAqB,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,SAAgB,oBAAoB,EAAE,OAAO,CAAC;IAE9C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAC;IAEpB,OAAO,CAAC,OAAO,CAAwB;gBAEpB,OAAO,EAAE,iBAAiB;IAM7C;;OAEG;IACH,IAAW,eAAe,IAAI,KAAK,CAAC,aAAa,GAAG,SAAS,CAM5D;CACF"}
1
+ {"version":3,"file":"Parameter.d.ts","sourceRoot":"","sources":["../../src/model/Parameter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,qBAAqB,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,SAAgB,oBAAoB,EAAE,OAAO,CAAC;IAE9C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACI,UAAU,EAAE,OAAO,CAAC;IAE3B,OAAO,CAAC,OAAO,CAAwB;gBAEpB,OAAO,EAAE,iBAAiB;IAO7C;;OAEG;IACH,IAAW,eAAe,IAAI,KAAK,CAAC,aAAa,GAAG,SAAS,CAM5D;CACF"}
@@ -25,6 +25,7 @@ class Parameter {
25
25
  constructor(options) {
26
26
  this.name = options.name;
27
27
  this.parameterTypeExcerpt = options.parameterTypeExcerpt;
28
+ this.isOptional = options.isOptional;
28
29
  this._parent = options.parent;
29
30
  }
30
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Parameter.js","sourceRoot":"","sources":["../../src/model/Parameter.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,kEAA+D;AAc/D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,SAAS;IAapB,YAAmB,OAA0B;QAC3C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QACzD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAW,eAAe;QACxB,IAAI,IAAI,CAAC,OAAO,YAAY,qCAAiB,EAAE;YAC7C,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;gBAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACtE;SACF;IACH,CAAC;CACF;AA7BD,8BA6BC","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 tsdoc from '@microsoft/tsdoc';\n\nimport { ApiDocumentedItem } from '../items/ApiDocumentedItem';\nimport { Excerpt } from '../mixins/Excerpt';\nimport { 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 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 private _parent: ApiParameterListMixin;\n\n public constructor(options: IParameterOptions) {\n this.name = options.name;\n this.parameterTypeExcerpt = options.parameterTypeExcerpt;\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"]}
1
+ {"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;YAC7C,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;gBAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACtE;SACF;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 * as tsdoc from '@microsoft/tsdoc';\n\nimport { ApiDocumentedItem } from '../items/ApiDocumentedItem';\nimport { Excerpt } from '../mixins/Excerpt';\nimport { 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"]}
package/package.json CHANGED
@@ -1,29 +1,32 @@
1
1
  {
2
- "name": "@microsoft/api-extractor-model",
3
- "version": "7.15.3",
4
- "description": "A helper library for loading and saving the .api.json files created by API Extractor",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://github.com/microsoft/rushstack.git",
8
- "directory": "apps/api-extractor-model"
9
- },
10
- "homepage": "https://api-extractor.com",
11
- "main": "lib/index.js",
12
- "typings": "dist/rollup.d.ts",
13
- "license": "MIT",
14
- "dependencies": {
15
- "@microsoft/tsdoc": "0.13.2",
16
- "@microsoft/tsdoc-config": "~0.15.2",
17
- "@rushstack/node-core-library": "3.45.0"
18
- },
19
- "devDependencies": {
20
- "@rushstack/eslint-config": "2.5.1",
21
- "@rushstack/heft": "0.43.2",
22
- "@rushstack/heft-node-rig": "1.4.3",
23
- "@types/heft-jest": "1.0.1",
24
- "@types/node": "12.20.24"
25
- },
26
- "scripts": {
27
- "build": "heft test --clean"
28
- }
29
- }
2
+ "name": "@microsoft/api-extractor-model",
3
+ "version": "7.16.1",
4
+ "description": "A helper library for loading and saving the .api.json files created by API Extractor",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/microsoft/rushstack.git",
8
+ "directory": "libraries/api-extractor-model"
9
+ },
10
+ "homepage": "https://api-extractor.com",
11
+ "main": "lib/index.js",
12
+ "typings": "dist/rollup.d.ts",
13
+ "license": "MIT",
14
+ "dependencies": {
15
+ "@microsoft/tsdoc": "0.13.2",
16
+ "@microsoft/tsdoc-config": "~0.15.2",
17
+ "@rushstack/node-core-library": "3.45.2"
18
+ },
19
+ "devDependencies": {
20
+ "@rushstack/eslint-config": "2.5.3",
21
+ "@rushstack/heft": "0.44.2",
22
+ "@rushstack/heft-node-rig": "1.7.1",
23
+ "@types/heft-jest": "1.0.1",
24
+ "@types/node": "12.20.24"
25
+ },
26
+ "scripts": {
27
+ "build": "heft build --clean",
28
+ "_phase:build": "heft build --clean",
29
+ "_phase:test": "heft test --no-build"
30
+ },
31
+ "readme": "# @microsoft/api-extractor-model\n\nUse this library to read and write *.api.json files as defined by the [API Extractor](https://api-extractor.com/) tool.\nThese files are used to generate a documentation website for your TypeScript package. The files store the\nAPI signatures and doc comments that were extracted from your package.\n\nAPI documentation for this package: https://rushstack.io/pages/api/api-extractor-model/\n\n## Example Usage\n\nThe following code sample shows how to load `example.api.json`, which would be generated by API Extractor\nwhen it analyzes a hypothetical NPM package called `example`:\n\n```ts\nimport { ApiModel, ApiPackage } from '@microsoft/api-extractor-model';\n\nconst apiModel: ApiModel = new ApiModel();\nconst apiPackage: ApiPackage = apiModel.loadPackage('example.api.json');\n\nfor (const member of apiPackage.members) {\n console.log(member.displayName);\n}\n```\n\nThe `ApiModel` is acts as a container for various packages that are loaded and operated on as a group.\nFor example, a documentation tool may need to resolve `@link` references across different packages.\nIn this case we would load the various packages into the `ApiModel`, and then use\nthe `ApiModel.resolveDeclarationReference()` to resolve the `@link` targets.\n\nThe data structure forms a tree of various classes that start with the `Api` prefix. The nesting hierarchy\nmight look like this:\n\n```\n- ApiModel\n - ApiPackage\n - ApiEntryPoint\n - ApiClass\n - ApiMethod\n - ApiProperty\n - ApiEnum\n - ApiEnumMember\n - ApiInterface\n - ApiMethodSignature\n - ApiPropertySignature\n - ApiNamespace\n - (ApiClass, ApiEnum, ApiInterface, ...)\n```\n\nYou can use the `ApiItem.members` property to traverse this tree.\n\nNote that the non-abstract classes (e.g. `ApiClass`, `ApiEnum`, `ApiInterface`, etc.) use\nTypeScript \"mixin\" functions (e.g. `ApiDeclaredItem`, `ApiItemContainerMixin`, etc.) to add various\nfeatures that cannot be represented as a normal inheritance chain (since TypeScript does not allow a child class\nto extend more than one base class). The \"mixin\" is a TypeScript merged declaration with three components:\nthe function that generates a subclass, an interface that describes the members of the subclass, and\na namespace containing static members of the class.\n\n> For a complete project that uses these APIs to generate an API reference web site,\n> see the [@microsoft/api-documenter](https://www.npmjs.com/package/@microsoft/api-documenter) source code.\n\n## Links\n\n- [CHANGELOG.md](\n https://github.com/microsoft/rushstack/blob/main/libraries/api-extractor-model/CHANGELOG.md) - Find\n out what's new in the latest version\n- [API Reference](https://rushstack.io/pages/api/api-extractor-model/)\n\nAPI Extractor is part of the [Rush Stack](https://rushstack.io/) family of projects.\n"
32
+ }