@rushstack/typings-generator 0.12.62 → 0.13.0

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/CHANGELOG.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "@rushstack/typings-generator",
3
3
  "entries": [
4
+ {
5
+ "version": "0.13.0",
6
+ "tag": "@rushstack/typings-generator_v0.13.0",
7
+ "date": "Wed, 21 Aug 2024 05:43:04 GMT",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "comment": "Expand the `exportAsDefault` option for `StringValuesTypingsGenerator` to take an object with the following properties: `interfaceName` and `documentationComment`. Note that the `exportAsDefaultInterfaceName` option has been deprecated."
12
+ },
13
+ {
14
+ "comment": "Add an optional `exportAsDefault` property to the return value of `parseAndGenerateTypings` that overrides options provided by the same property in the `StringValuesTypingsGenerator`'s options object."
15
+ }
16
+ ],
17
+ "dependency": [
18
+ {
19
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `5.7.0`"
20
+ },
21
+ {
22
+ "comment": "Updating dependency \"@rushstack/terminal\" to `0.14.0`"
23
+ },
24
+ {
25
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.67.0`"
26
+ }
27
+ ]
28
+ }
29
+ },
30
+ {
31
+ "version": "0.12.63",
32
+ "tag": "@rushstack/typings-generator_v0.12.63",
33
+ "date": "Mon, 12 Aug 2024 22:16:04 GMT",
34
+ "comments": {
35
+ "dependency": [
36
+ {
37
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `5.6.0`"
38
+ },
39
+ {
40
+ "comment": "Updating dependency \"@rushstack/terminal\" to `0.13.4`"
41
+ },
42
+ {
43
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.66.26`"
44
+ }
45
+ ]
46
+ }
47
+ },
4
48
  {
5
49
  "version": "0.12.62",
6
50
  "tag": "@rushstack/typings-generator_v0.12.62",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,19 @@
1
1
  # Change Log - @rushstack/typings-generator
2
2
 
3
- This log was last generated on Fri, 02 Aug 2024 17:26:42 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 21 Aug 2024 05:43:04 GMT and should not be manually modified.
4
+
5
+ ## 0.13.0
6
+ Wed, 21 Aug 2024 05:43:04 GMT
7
+
8
+ ### Minor changes
9
+
10
+ - Expand the `exportAsDefault` option for `StringValuesTypingsGenerator` to take an object with the following properties: `interfaceName` and `documentationComment`. Note that the `exportAsDefaultInterfaceName` option has been deprecated.
11
+ - Add an optional `exportAsDefault` property to the return value of `parseAndGenerateTypings` that overrides options provided by the same property in the `StringValuesTypingsGenerator`'s options object.
12
+
13
+ ## 0.12.63
14
+ Mon, 12 Aug 2024 22:16:04 GMT
15
+
16
+ _Version update only_
4
17
 
5
18
  ## 0.12.62
6
19
  Fri, 02 Aug 2024 17:26:42 GMT
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.47.4"
8
+ "packageVersion": "7.47.6"
9
9
  }
10
10
  ]
11
11
  }
@@ -8,6 +8,23 @@
8
8
 
9
9
  import { ITerminal } from '@rushstack/terminal';
10
10
 
11
+ /**
12
+ * @public
13
+ */
14
+ export declare interface IExportAsDefaultOptions {
15
+ /**
16
+ * This setting overrides the the interface name for the default wrapped export.
17
+ *
18
+ * @defaultValue "IExport"
19
+ */
20
+ interfaceName?: string;
21
+ /**
22
+ * This value is placed in a documentation comment for the
23
+ * exported default interface.
24
+ */
25
+ documentationComment?: string;
26
+ }
27
+
11
28
  /**
12
29
  * @public
13
30
  */
@@ -15,10 +32,10 @@ export declare interface IStringValuesTypingsGeneratorBaseOptions {
15
32
  /**
16
33
  * Setting this option wraps the typings export in a default property.
17
34
  */
18
- exportAsDefault?: boolean;
35
+ exportAsDefault?: boolean | IExportAsDefaultOptions;
19
36
  /**
20
- * When `exportAsDefault` is true, this optional setting determines the interface name
21
- * for the default wrapped export. Ignored when `exportAsDefault` is false.
37
+ * @deprecated Use {@link IStringValuesTypingsGeneratorBaseOptions.exportAsDefault}'s
38
+ * {@link IExportAsDefaultOptions.interfaceName} instead.
22
39
  */
23
40
  exportAsDefaultInterfaceName?: string;
24
41
  }
@@ -48,6 +65,11 @@ export declare interface IStringValueTyping {
48
65
  */
49
66
  export declare interface IStringValueTypings {
50
67
  typings: IStringValueTyping[];
68
+ /**
69
+ * Options for default exports. Note that options provided here will override
70
+ * options provided in {@link IStringValuesTypingsGeneratorBaseOptions.exportAsDefault}.
71
+ */
72
+ exportAsDefault?: boolean | IExportAsDefaultOptions;
51
73
  }
52
74
 
53
75
  /**
@@ -84,12 +106,6 @@ export declare interface ITypingsGeneratorOptionsWithoutReadFile<TTypingsResult
84
106
  fileExtensions: string[];
85
107
  parseAndGenerateTypings: (fileContents: TFileContents, filePath: string, relativePath: string) => TTypingsResult | Promise<TTypingsResult>;
86
108
  getAdditionalOutputFiles?: (relativePath: string) => string[];
87
- /**
88
- * @deprecated
89
- *
90
- * TODO: Remove when version 1.0.0 is released.
91
- */
92
- filesToIgnore?: string[];
93
109
  }
94
110
 
95
111
  /**
@@ -117,7 +133,8 @@ export declare class TypingsGenerator<TFileContents = string> {
117
133
  private readonly _dependenciesOfFile;
118
134
  private readonly _consumersOfFile;
119
135
  private readonly _relativePaths;
120
- protected _options: ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents>;
136
+ protected readonly _options: ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents>;
137
+ protected readonly terminal: ITerminal;
121
138
  /**
122
139
  * The folder path that contains all input source files.
123
140
  */
@@ -11,6 +11,27 @@ export interface IStringValueTyping {
11
11
  */
12
12
  export interface IStringValueTypings {
13
13
  typings: IStringValueTyping[];
14
+ /**
15
+ * Options for default exports. Note that options provided here will override
16
+ * options provided in {@link IStringValuesTypingsGeneratorBaseOptions.exportAsDefault}.
17
+ */
18
+ exportAsDefault?: boolean | IExportAsDefaultOptions;
19
+ }
20
+ /**
21
+ * @public
22
+ */
23
+ export interface IExportAsDefaultOptions {
24
+ /**
25
+ * This setting overrides the the interface name for the default wrapped export.
26
+ *
27
+ * @defaultValue "IExport"
28
+ */
29
+ interfaceName?: string;
30
+ /**
31
+ * This value is placed in a documentation comment for the
32
+ * exported default interface.
33
+ */
34
+ documentationComment?: string;
14
35
  }
15
36
  /**
16
37
  * @public
@@ -19,10 +40,10 @@ export interface IStringValuesTypingsGeneratorBaseOptions {
19
40
  /**
20
41
  * Setting this option wraps the typings export in a default property.
21
42
  */
22
- exportAsDefault?: boolean;
43
+ exportAsDefault?: boolean | IExportAsDefaultOptions;
23
44
  /**
24
- * When `exportAsDefault` is true, this optional setting determines the interface name
25
- * for the default wrapped export. Ignored when `exportAsDefault` is false.
45
+ * @deprecated Use {@link IStringValuesTypingsGeneratorBaseOptions.exportAsDefault}'s
46
+ * {@link IExportAsDefaultOptions.interfaceName} instead.
26
47
  */
27
48
  exportAsDefaultInterfaceName?: string;
28
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StringValuesTypingsGenerator.d.ts","sourceRoot":"","sources":["../src/StringValuesTypingsGenerator.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,wBAAwB,EAC7B,gBAAgB,EAChB,KAAK,0CAA0C,EAChD,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,wCAAwC;IACvD;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,oCAAoC,CAAC,aAAa,SAAS,MAAM,GAAG,MAAM,CACzF,SAA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G;AACH,MAAM,WAAW,oCAAoC,CAAC,aAAa,SAAS,MAAM,GAAG,MAAM,CACzF,SAAQ,wBAAwB,CAAC,mBAAmB,GAAG,SAAS,EAAE,aAAa,CAAC,EAC9E,wCAAwC;CAE3C;AAED;;GAEG;AACH,MAAM,WAAW,sDAAsD,CAAC,aAAa,GAAG,MAAM,CAC5F,SAAQ,0CAA0C,CAAC,mBAAmB,GAAG,SAAS,EAAE,aAAa,CAAC,EAChG,wCAAwC;CAE3C;AAiHD;;;;;GAKG;AACH,qBAAa,4BAA4B,CAAC,aAAa,GAAG,MAAM,CAAE,SAAQ,gBAAgB,CAAC,aAAa,CAAC;gBAErG,OAAO,EAAE,aAAa,SAAS,MAAM,GAAG,oCAAoC,CAAC,aAAa,CAAC,GAAG,KAAK;gBAElF,OAAO,EAAE,sDAAsD,CAAC,aAAa,CAAC;CAIlG"}
@@ -4,41 +4,81 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.StringValuesTypingsGenerator = void 0;
6
6
  const os_1 = require("os");
7
+ const node_core_library_1 = require("@rushstack/node-core-library");
7
8
  const TypingsGenerator_1 = require("./TypingsGenerator");
8
9
  const EXPORT_AS_DEFAULT_INTERFACE_NAME = 'IExport';
9
10
  function convertToTypingsGeneratorOptions(options) {
10
- async function parseAndGenerateTypings(fileContents, filePath, relativePath) {
11
- const stringValueTypings = await options.parseAndGenerateTypings(fileContents, filePath, relativePath);
11
+ var _a, _b;
12
+ const { exportAsDefault: exportAsDefaultOptions, exportAsDefaultInterfaceName: exportAsDefaultInterfaceName_deprecated, parseAndGenerateTypings } = options;
13
+ let defaultSplitExportAsDefaultDocumentationComment;
14
+ let defaultExportAsDefaultInterfaceName;
15
+ if (typeof exportAsDefaultOptions === 'object') {
16
+ defaultSplitExportAsDefaultDocumentationComment = node_core_library_1.Text.splitByNewLines(exportAsDefaultOptions.documentationComment);
17
+ defaultExportAsDefaultInterfaceName =
18
+ (_b = (_a = exportAsDefaultOptions.interfaceName) !== null && _a !== void 0 ? _a : exportAsDefaultInterfaceName_deprecated) !== null && _b !== void 0 ? _b : EXPORT_AS_DEFAULT_INTERFACE_NAME;
19
+ }
20
+ else if (exportAsDefaultOptions) {
21
+ defaultExportAsDefaultInterfaceName =
22
+ exportAsDefaultInterfaceName_deprecated !== null && exportAsDefaultInterfaceName_deprecated !== void 0 ? exportAsDefaultInterfaceName_deprecated : EXPORT_AS_DEFAULT_INTERFACE_NAME;
23
+ }
24
+ async function parseAndGenerateTypingsOuter(fileContents, filePath, relativePath) {
25
+ var _a, _b;
26
+ const stringValueTypings = await parseAndGenerateTypings(fileContents, filePath, relativePath);
12
27
  if (stringValueTypings === undefined) {
13
28
  return;
14
29
  }
30
+ const { exportAsDefault: exportAsDefaultOptionsOverride, typings } = stringValueTypings;
31
+ let exportAsDefaultInterfaceName;
32
+ let interfaceDocumentationCommentLines;
33
+ if (typeof exportAsDefaultOptionsOverride === 'boolean') {
34
+ if (exportAsDefaultOptionsOverride) {
35
+ exportAsDefaultInterfaceName =
36
+ defaultExportAsDefaultInterfaceName !== null && defaultExportAsDefaultInterfaceName !== void 0 ? defaultExportAsDefaultInterfaceName : EXPORT_AS_DEFAULT_INTERFACE_NAME;
37
+ interfaceDocumentationCommentLines = defaultSplitExportAsDefaultDocumentationComment;
38
+ }
39
+ }
40
+ else if (exportAsDefaultOptionsOverride) {
41
+ const { interfaceName, documentationComment } = exportAsDefaultOptionsOverride;
42
+ exportAsDefaultInterfaceName =
43
+ (_a = interfaceName !== null && interfaceName !== void 0 ? interfaceName : defaultExportAsDefaultInterfaceName) !== null && _a !== void 0 ? _a : EXPORT_AS_DEFAULT_INTERFACE_NAME;
44
+ interfaceDocumentationCommentLines =
45
+ (_b = node_core_library_1.Text.splitByNewLines(documentationComment)) !== null && _b !== void 0 ? _b : defaultSplitExportAsDefaultDocumentationComment;
46
+ }
47
+ else {
48
+ exportAsDefaultInterfaceName = defaultExportAsDefaultInterfaceName;
49
+ interfaceDocumentationCommentLines = defaultSplitExportAsDefaultDocumentationComment;
50
+ }
15
51
  const outputLines = [];
16
- const interfaceName = options.exportAsDefaultInterfaceName
17
- ? options.exportAsDefaultInterfaceName
18
- : EXPORT_AS_DEFAULT_INTERFACE_NAME;
19
52
  let indent = '';
20
- if (options.exportAsDefault) {
21
- outputLines.push(`export interface ${interfaceName} {`);
53
+ if (exportAsDefaultInterfaceName) {
54
+ if (interfaceDocumentationCommentLines) {
55
+ outputLines.push(`/**`);
56
+ for (const line of interfaceDocumentationCommentLines) {
57
+ outputLines.push(` * ${line}`);
58
+ }
59
+ outputLines.push(` */`);
60
+ }
61
+ outputLines.push(`export interface ${exportAsDefaultInterfaceName} {`);
22
62
  indent = ' ';
23
63
  }
24
- for (const stringValueTyping of stringValueTypings.typings) {
64
+ for (const stringValueTyping of typings) {
25
65
  const { exportName, comment } = stringValueTyping;
26
66
  if (comment && comment.trim() !== '') {
27
67
  outputLines.push(`${indent}/**`, `${indent} * ${comment.replace(/\*\//g, '*\\/')}`, `${indent} */`);
28
68
  }
29
- if (options.exportAsDefault) {
69
+ if (exportAsDefaultInterfaceName) {
30
70
  outputLines.push(`${indent}'${exportName}': string;`, '');
31
71
  }
32
72
  else {
33
73
  outputLines.push(`export declare const ${exportName}: string;`, '');
34
74
  }
35
75
  }
36
- if (options.exportAsDefault) {
37
- outputLines.push('}', '', `declare const strings: ${interfaceName};`, '', 'export default strings;');
76
+ if (exportAsDefaultInterfaceName) {
77
+ outputLines.push('}', '', `declare const strings: ${exportAsDefaultInterfaceName};`, '', 'export default strings;');
38
78
  }
39
79
  return outputLines.join(os_1.EOL);
40
80
  }
41
- const convertedOptions = Object.assign(Object.assign({}, options), { parseAndGenerateTypings });
81
+ const convertedOptions = Object.assign(Object.assign({}, options), { parseAndGenerateTypings: parseAndGenerateTypingsOuter });
42
82
  return convertedOptions;
43
83
  }
44
84
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"StringValuesTypingsGenerator.js","sourceRoot":"","sources":["../src/StringValuesT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CAAC,CAAC;YAC5D,CAAC;iBAAM,CAAC;gBACN,WAAW,CAAC,IAAI,CAAC,wBAAwB,UAAU,WAAW,EAAE,EAAE,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;QAED,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;YAC5B,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,0BAA0B,aAAa,GAAG,EAAE,EAAE,EAAE,yBAAyB,CAAC,CAAC;QACvG,CAAC;QAED,OAAO,WAAW,CAAC,IAAI,CAAC,QAAG,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,gBAAgB,mCACjB,OAAO,KACV,uBAAuB,GACxB,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,MAAa,4BAAqD,SAAQ,mCAA+B;IAKvG,YAAmB,OAA8E;QAC/F,KAAK,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,CAAC;CACF;AARD,oEAQC","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 { EOL } from 'os';\n\nimport {\n type ITypingsGeneratorOptions,\n TypingsGenerator,\n type ITypingsGeneratorOptionsWithCustomReadFile\n} from './TypingsGenerator';\n\n/**\n * @public\n */\nexport interface IStringValueTyping {\n exportName: string;\n comment?: string;\n}\n\n/**\n * @public\n */\nexport interface IStringValueTypings {\n typings: IStringValueTyping[];\n}\n\n/**\n * @public\n */\nexport interface IStringValuesTypingsGeneratorBaseOptions {\n /**\n * Setting this option wraps the typings export in a default property.\n */\n exportAsDefault?: boolean;\n\n /**\n * When `exportAsDefault` is true, this optional setting determines the interface name\n * for the default wrapped export. Ignored when `exportAsDefault` is false.\n */\n exportAsDefaultInterfaceName?: string;\n}\n\n/**\n * @public\n */\nexport interface IStringValuesTypingsGeneratorOptions<TFileContents extends string = string>\n extends ITypingsGeneratorOptions<IStringValueTypings | undefined, TFileContents>,\n IStringValuesTypingsGeneratorBaseOptions {\n // Nothing added.\n}\n\n/**\n * @public\n */\nexport interface IStringValuesTypingsGeneratorOptionsWithCustomReadFile<TFileContents = string>\n extends ITypingsGeneratorOptionsWithCustomReadFile<IStringValueTypings | undefined, TFileContents>,\n IStringValuesTypingsGeneratorBaseOptions {\n // Nothing added.\n}\n\nconst EXPORT_AS_DEFAULT_INTERFACE_NAME: string = 'IExport';\n\nfunction convertToTypingsGeneratorOptions<TFileContents>(\n options: IStringValuesTypingsGeneratorOptionsWithCustomReadFile<TFileContents>\n): ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents> {\n async function parseAndGenerateTypings(\n fileContents: TFileContents,\n filePath: string,\n relativePath: string\n ): Promise<string | undefined> {\n const stringValueTypings: IStringValueTypings | undefined = await options.parseAndGenerateTypings(\n fileContents,\n filePath,\n relativePath\n );\n\n if (stringValueTypings === undefined) {\n return;\n }\n\n const outputLines: string[] = [];\n const interfaceName: string = options.exportAsDefaultInterfaceName\n ? options.exportAsDefaultInterfaceName\n : EXPORT_AS_DEFAULT_INTERFACE_NAME;\n let indent: string = '';\n if (options.exportAsDefault) {\n outputLines.push(`export interface ${interfaceName} {`);\n indent = ' ';\n }\n\n for (const stringValueTyping of stringValueTypings.typings) {\n const { exportName, comment } = stringValueTyping;\n\n if (comment && comment.trim() !== '') {\n outputLines.push(`${indent}/**`, `${indent} * ${comment.replace(/\\*\\//g, '*\\\\/')}`, `${indent} */`);\n }\n\n if (options.exportAsDefault) {\n outputLines.push(`${indent}'${exportName}': string;`, '');\n } else {\n outputLines.push(`export declare const ${exportName}: string;`, '');\n }\n }\n\n if (options.exportAsDefault) {\n outputLines.push('}', '', `declare const strings: ${interfaceName};`, '', 'export default strings;');\n }\n\n return outputLines.join(EOL);\n }\n\n const convertedOptions: ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents> = {\n ...options,\n parseAndGenerateTypings\n };\n\n return convertedOptions;\n}\n\n/**\n * This is a simple tool that generates .d.ts files for non-TS files that can be represented as\n * a simple set of named string exports.\n *\n * @public\n */\nexport class StringValuesTypingsGenerator<TFileContents = string> extends TypingsGenerator<TFileContents> {\n public constructor(\n options: TFileContents extends string ? IStringValuesTypingsGeneratorOptions<TFileContents> : never\n );\n public constructor(options: IStringValuesTypingsGeneratorOptionsWithCustomReadFile<TFileContents>);\n public constructor(options: IStringValuesTypingsGeneratorOptionsWithCustomReadFile<TFileContents>) {\n super(convertToTypingsGeneratorOptions(options));\n }\n}\n"]}
1
+ {"version":3,"file":"StringValuesTypingsGenerator.js","sourceRoot":"","sources":["../src/StringValuesTypingsGenerator.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,2BAAyB;AACzB,oEAAoD;AAEpD,yDAI4B;AA2E5B,MAAM,gCAAgC,GAAW,SAAS,CAAC;AAE3D,SAAS,gCAAgC,CACvC,OAA8E;;IAE9E,MAAM,EACJ,eAAe,EAAE,sBAAsB,EACvC,4BAA4B,EAAE,uCAAuC,EACrE,uBAAuB,EACxB,GAAG,OAAO,CAAC;IACZ,IAAI,+CAAqE,CAAC;IAC1E,IAAI,mCAAuD,CAAC;IAC5D,IAAI,OAAO,sBAAsB,KAAK,QAAQ,EAAE,CAAC;QAC/C,+CAA+C,GAAG,wBAAI,CAAC,eAAe,CACpE,sBAAsB,CAAC,oBAAoB,CAC5C,CAAC;QACF,mCAAmC;YACjC,MAAA,MAAA,sBAAsB,CAAC,aAAa,mCACpC,uCAAuC,mCACvC,gCAAgC,CAAC;IACrC,CAAC;SAAM,IAAI,sBAAsB,EAAE,CAAC;QAClC,mCAAmC;YACjC,uCAAuC,aAAvC,uCAAuC,cAAvC,uCAAuC,GAAI,gCAAgC,CAAC;IAChF,CAAC;IAED,KAAK,UAAU,4BAA4B,CACzC,YAA2B,EAC3B,QAAgB,EAChB,YAAoB;;QAEpB,MAAM,kBAAkB,GAAoC,MAAM,uBAAuB,CACvF,YAAY,EACZ,QAAQ,EACR,Y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oBAAoB,4BAA4B,IAAI,CAAC,CAAC;YACvE,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;QAED,KAAK,MAAM,iBAAiB,IAAI,OAAO,EAAE,CAAC;YACxC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC;YAElD,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;gBACrC,WAAW,CAAC,IAAI,CAAC,GAAG,MAAM,KAAK,EAAE,GAAG,MAAM,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,MAAM,KAAK,CAAC,CAAC;YACtG,CAAC;YAED,IAAI,4BAA4B,EAAE,CAAC;gBACjC,WAAW,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,UAAU,YAAY,EAAE,EAAE,CAAC,CAAC;YAC5D,CAAC;iBAAM,CAAC;gBACN,WAAW,CAAC,IAAI,CAAC,wBAAwB,UAAU,WAAW,EAAE,EAAE,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;QAED,IAAI,4BAA4B,EAAE,CAAC;YACjC,WAAW,CAAC,IAAI,CACd,GAAG,EACH,EAAE,EACF,0BAA0B,4BAA4B,GAAG,EACzD,EAAE,EACF,yBAAyB,CAC1B,CAAC;QACJ,CAAC;QAED,OAAO,WAAW,CAAC,IAAI,CAAC,QAAG,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,gBAAgB,mCACjB,OAAO,KACV,uBAAuB,EAAE,4BAA4B,GACtD,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,MAAa,4BAAqD,SAAQ,mCAA+B;IAKvG,YAAmB,OAA8E;QAC/F,KAAK,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,CAAC;CACF;AARD,oEAQC","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 { EOL } from 'os';\nimport { Text } from '@rushstack/node-core-library';\n\nimport {\n type ITypingsGeneratorOptions,\n TypingsGenerator,\n type ITypingsGeneratorOptionsWithCustomReadFile\n} from './TypingsGenerator';\n\n/**\n * @public\n */\nexport interface IStringValueTyping {\n exportName: string;\n comment?: string;\n}\n\n/**\n * @public\n */\nexport interface IStringValueTypings {\n typings: IStringValueTyping[];\n\n /**\n * Options for default exports. Note that options provided here will override\n * options provided in {@link IStringValuesTypingsGeneratorBaseOptions.exportAsDefault}.\n */\n exportAsDefault?: boolean | IExportAsDefaultOptions;\n}\n\n/**\n * @public\n */\nexport interface IExportAsDefaultOptions {\n /**\n * This setting overrides the the interface name for the default wrapped export.\n *\n * @defaultValue \"IExport\"\n */\n interfaceName?: string;\n\n /**\n * This value is placed in a documentation comment for the\n * exported default interface.\n */\n documentationComment?: string;\n}\n\n/**\n * @public\n */\nexport interface IStringValuesTypingsGeneratorBaseOptions {\n /**\n * Setting this option wraps the typings export in a default property.\n */\n exportAsDefault?: boolean | IExportAsDefaultOptions;\n\n /**\n * @deprecated Use {@link IStringValuesTypingsGeneratorBaseOptions.exportAsDefault}'s\n * {@link IExportAsDefaultOptions.interfaceName} instead.\n */\n exportAsDefaultInterfaceName?: string;\n}\n\n/**\n * @public\n */\nexport interface IStringValuesTypingsGeneratorOptions<TFileContents extends string = string>\n extends ITypingsGeneratorOptions<IStringValueTypings | undefined, TFileContents>,\n IStringValuesTypingsGeneratorBaseOptions {\n // Nothing added.\n}\n\n/**\n * @public\n */\nexport interface IStringValuesTypingsGeneratorOptionsWithCustomReadFile<TFileContents = string>\n extends ITypingsGeneratorOptionsWithCustomReadFile<IStringValueTypings | undefined, TFileContents>,\n IStringValuesTypingsGeneratorBaseOptions {\n // Nothing added.\n}\n\nconst EXPORT_AS_DEFAULT_INTERFACE_NAME: string = 'IExport';\n\nfunction convertToTypingsGeneratorOptions<TFileContents>(\n options: IStringValuesTypingsGeneratorOptionsWithCustomReadFile<TFileContents>\n): ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents> {\n const {\n exportAsDefault: exportAsDefaultOptions,\n exportAsDefaultInterfaceName: exportAsDefaultInterfaceName_deprecated,\n parseAndGenerateTypings\n } = options;\n let defaultSplitExportAsDefaultDocumentationComment: string[] | undefined;\n let defaultExportAsDefaultInterfaceName: string | undefined;\n if (typeof exportAsDefaultOptions === 'object') {\n defaultSplitExportAsDefaultDocumentationComment = Text.splitByNewLines(\n exportAsDefaultOptions.documentationComment\n );\n defaultExportAsDefaultInterfaceName =\n exportAsDefaultOptions.interfaceName ??\n exportAsDefaultInterfaceName_deprecated ??\n EXPORT_AS_DEFAULT_INTERFACE_NAME;\n } else if (exportAsDefaultOptions) {\n defaultExportAsDefaultInterfaceName =\n exportAsDefaultInterfaceName_deprecated ?? EXPORT_AS_DEFAULT_INTERFACE_NAME;\n }\n\n async function parseAndGenerateTypingsOuter(\n fileContents: TFileContents,\n filePath: string,\n relativePath: string\n ): Promise<string | undefined> {\n const stringValueTypings: IStringValueTypings | undefined = await parseAndGenerateTypings(\n fileContents,\n filePath,\n relativePath\n );\n\n if (stringValueTypings === undefined) {\n return;\n }\n\n const { exportAsDefault: exportAsDefaultOptionsOverride, typings } = stringValueTypings;\n let exportAsDefaultInterfaceName: string | undefined;\n let interfaceDocumentationCommentLines: string[] | undefined;\n if (typeof exportAsDefaultOptionsOverride === 'boolean') {\n if (exportAsDefaultOptionsOverride) {\n exportAsDefaultInterfaceName =\n defaultExportAsDefaultInterfaceName ?? EXPORT_AS_DEFAULT_INTERFACE_NAME;\n interfaceDocumentationCommentLines = defaultSplitExportAsDefaultDocumentationComment;\n }\n } else if (exportAsDefaultOptionsOverride) {\n const { interfaceName, documentationComment } = exportAsDefaultOptionsOverride;\n exportAsDefaultInterfaceName =\n interfaceName ?? defaultExportAsDefaultInterfaceName ?? EXPORT_AS_DEFAULT_INTERFACE_NAME;\n interfaceDocumentationCommentLines =\n Text.splitByNewLines(documentationComment) ?? defaultSplitExportAsDefaultDocumentationComment;\n } else {\n exportAsDefaultInterfaceName = defaultExportAsDefaultInterfaceName;\n interfaceDocumentationCommentLines = defaultSplitExportAsDefaultDocumentationComment;\n }\n\n const outputLines: string[] = [];\n let indent: string = '';\n if (exportAsDefaultInterfaceName) {\n if (interfaceDocumentationCommentLines) {\n outputLines.push(`/**`);\n for (const line of interfaceDocumentationCommentLines) {\n outputLines.push(` * ${line}`);\n }\n\n outputLines.push(` */`);\n }\n\n outputLines.push(`export interface ${exportAsDefaultInterfaceName} {`);\n indent = ' ';\n }\n\n for (const stringValueTyping of typings) {\n const { exportName, comment } = stringValueTyping;\n\n if (comment && comment.trim() !== '') {\n outputLines.push(`${indent}/**`, `${indent} * ${comment.replace(/\\*\\//g, '*\\\\/')}`, `${indent} */`);\n }\n\n if (exportAsDefaultInterfaceName) {\n outputLines.push(`${indent}'${exportName}': string;`, '');\n } else {\n outputLines.push(`export declare const ${exportName}: string;`, '');\n }\n }\n\n if (exportAsDefaultInterfaceName) {\n outputLines.push(\n '}',\n '',\n `declare const strings: ${exportAsDefaultInterfaceName};`,\n '',\n 'export default strings;'\n );\n }\n\n return outputLines.join(EOL);\n }\n\n const convertedOptions: ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents> = {\n ...options,\n parseAndGenerateTypings: parseAndGenerateTypingsOuter\n };\n\n return convertedOptions;\n}\n\n/**\n * This is a simple tool that generates .d.ts files for non-TS files that can be represented as\n * a simple set of named string exports.\n *\n * @public\n */\nexport class StringValuesTypingsGenerator<TFileContents = string> extends TypingsGenerator<TFileContents> {\n public constructor(\n options: TFileContents extends string ? IStringValuesTypingsGeneratorOptions<TFileContents> : never\n );\n public constructor(options: IStringValuesTypingsGeneratorOptionsWithCustomReadFile<TFileContents>);\n public constructor(options: IStringValuesTypingsGeneratorOptionsWithCustomReadFile<TFileContents>) {\n super(convertToTypingsGeneratorOptions(options));\n }\n}\n"]}
@@ -16,12 +16,6 @@ export interface ITypingsGeneratorOptionsWithoutReadFile<TTypingsResult = string
16
16
  fileExtensions: string[];
17
17
  parseAndGenerateTypings: (fileContents: TFileContents, filePath: string, relativePath: string) => TTypingsResult | Promise<TTypingsResult>;
18
18
  getAdditionalOutputFiles?: (relativePath: string) => string[];
19
- /**
20
- * @deprecated
21
- *
22
- * TODO: Remove when version 1.0.0 is released.
23
- */
24
- filesToIgnore?: string[];
25
19
  }
26
20
  /**
27
21
  * @public
@@ -50,7 +44,8 @@ export declare class TypingsGenerator<TFileContents = string> {
50
44
  private readonly _dependenciesOfFile;
51
45
  private readonly _consumersOfFile;
52
46
  private readonly _relativePaths;
53
- protected _options: ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents>;
47
+ protected readonly _options: ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents>;
48
+ protected readonly terminal: ITerminal;
54
49
  /**
55
50
  * The folder path that contains all input source files.
56
51
  */
@@ -1 +1 @@
1
- {"version":3,"file":"TypingsGenerator.d.ts","sourceRoot":"","sources":["../src/TypingsGenerator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAqC,MAAM,qBAAqB,CAAC;AAMxF;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,uCAAuC,CACtD,cAAc,GAAG,MAAM,GAAG,SAAS,EACnC,aAAa,GAAG,MAAM,CACtB,SAAQ,4BAA4B;IACpC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,uBAAuB,EAAE,CACvB,YAAY,EAAE,aAAa,EAC3B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,KACjB,cAAc,GAAG,OAAO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G;IACH,SAAgB,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;gBAGlD,OAAO,EAAE,aAAa,SAAS,MAAM,GACjC,wBAAwB,CAAC,MAAM,GAAG,SAAS,EAAE,aAAa,CAAC,GAC3D,KAAK;gBAEQ,OAAO,EAAE,0CAA0C,CAAC,MAAM,GAAG,SAAS,EAAE,aAAa,CAAC;IA4CzG;;;;;OAKG;IACU,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAcjE,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAiE7C;;;;;OAKG;IACI,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;IAmBjE,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE;IAQzD,OAAO,CAAC,+BAA+B;YAMzB,oBAAoB;YAyCpB,iCAAiC;IAqC/C;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAE,oBAAoB;IAW7B,OAAO,CAAC,wBAAwB;CAYjC"}
@@ -42,11 +42,8 @@ const chokidar = __importStar(require("chokidar"));
42
42
  */
43
43
  class TypingsGenerator {
44
44
  constructor(options) {
45
- var _a;
45
+ var _a, _b;
46
46
  this._options = Object.assign(Object.assign({}, options), { readFile: (_a = options.readFile) !== null && _a !== void 0 ? _a : ((filePath, relativePath) => node_core_library_1.FileSystem.readFileAsync(filePath)) });
47
- if (options.filesToIgnore) {
48
- throw new Error('The filesToIgnore option is no longer supported. Please use globsToIgnore instead.');
49
- }
50
47
  if (!options.generatedTsFolder) {
51
48
  throw new Error('generatedTsFolder must be provided');
52
49
  }
@@ -64,9 +61,7 @@ class TypingsGenerator {
64
61
  throw new Error('At least one file extension must be provided.');
65
62
  }
66
63
  this.ignoredFileGlobs = options.globsToIgnore || [];
67
- if (!options.terminal) {
68
- this._options.terminal = new terminal_1.Terminal(new terminal_1.ConsoleTerminalProvider({ verboseEnabled: true }));
69
- }
64
+ this.terminal = (_b = options.terminal) !== null && _b !== void 0 ? _b : new terminal_1.Terminal(new terminal_1.ConsoleTerminalProvider({ verboseEnabled: true }));
70
65
  this._options.fileExtensions = this._normalizeFileExtensions(options.fileExtensions);
71
66
  this._dependenciesOfFile = new Map();
72
67
  this._consumersOfFile = new Map();
@@ -232,7 +227,7 @@ class TypingsGenerator {
232
227
  }
233
228
  }
234
229
  catch (e) {
235
- this._options.terminal.writeError(`Error occurred parsing and generating typings for file "${resolvedPath}": ${e}`);
230
+ this.terminal.writeError(`Error occurred parsing and generating typings for file "${resolvedPath}": ${e}`);
236
231
  }
237
232
  }
238
233
  /**
@@ -250,10 +245,10 @@ class TypingsGenerator {
250
245
  *_getTypingsFilePaths(relativePath) {
251
246
  const { generatedTsFolder, secondaryGeneratedTsFolders } = this._options;
252
247
  const dtsFilename = `${relativePath}.d.ts`;
253
- yield path.resolve(generatedTsFolder, dtsFilename);
248
+ yield `${generatedTsFolder}/${dtsFilename}`;
254
249
  if (secondaryGeneratedTsFolders) {
255
250
  for (const secondaryGeneratedTsFolder of secondaryGeneratedTsFolders) {
256
- yield path.resolve(secondaryGeneratedTsFolder, dtsFilename);
251
+ yield `${secondaryGeneratedTsFolder}/${dtsFilename}`;
257
252
  }
258
253
  }
259
254
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TypingsGenerator.js","sourceRoot":"","sources":["../src/TypingsGenerator.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,oEAAoF;AACpF,kDAAwF;AACxF,0DAA6B;AAC7B,2CAA6B;AAC7B,2BAAyB;AACzB,mDAAqC;AAiErC;;;;GAIG;AACH,MAAa,gBAAgB;IAiC3B,YAAmB,OAAsF;;QACvG,IAAI,CAAC,QAAQ,mCACR,OAAO,KACV,QAAQ,EACN,MAAA,OAAO,CAAC,QAAQ,mCAChB,CAAC,CAAC,QAAgB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;QACH,CAAC;IACH,CAAC;IAEO,wBAAwB,CAAC,cAAwB;QACvD,MAAM,MAAM,GAAgB,IAAI,GAAG,EAAE,CAAC;QACtC,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;YAC3C,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnC,MAAM,CAAC,GAAG,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;CACF;AAhUD,4CAgUC","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 { FileSystem, Path, NewlineKind, Async } from '@rushstack/node-core-library';\nimport { type ITerminal, Terminal, ConsoleTerminalProvider } from '@rushstack/terminal';\nimport glob from 'fast-glob';\nimport * as path from 'path';\nimport { EOL } from 'os';\nimport * as chokidar from 'chokidar';\n\n/**\n * @public\n */\nexport interface ITypingsGeneratorBaseOptions {\n srcFolder: string;\n generatedTsFolder: string;\n secondaryGeneratedTsFolders?: string[];\n globsToIgnore?: string[];\n terminal?: ITerminal;\n}\n\n/**\n * @public\n */\nexport interface ITypingsGeneratorOptionsWithoutReadFile<\n TTypingsResult = string | undefined,\n TFileContents = string\n> extends ITypingsGeneratorBaseOptions {\n fileExtensions: string[];\n parseAndGenerateTypings: (\n fileContents: TFileContents,\n filePath: string,\n relativePath: string\n ) => TTypingsResult | Promise<TTypingsResult>;\n getAdditionalOutputFiles?: (relativePath: string) => string[];\n /**\n * @deprecated\n *\n * TODO: Remove when version 1.0.0 is released.\n */\n filesToIgnore?: string[];\n}\n\n/**\n * @public\n */\nexport type ReadFile<TFileContents = string> = (\n filePath: string,\n relativePath: string\n) => Promise<TFileContents> | TFileContents;\n\n/**\n * @public\n */\nexport interface ITypingsGeneratorOptions<\n TTypingsResult = string | undefined,\n TFileContents extends string = string\n> extends ITypingsGeneratorOptionsWithoutReadFile<TTypingsResult, TFileContents> {\n readFile?: ReadFile<TFileContents>;\n}\n\n/**\n * Options for a TypingsGenerator that needs to customize how files are read.\n *\n * @public\n */\nexport interface ITypingsGeneratorOptionsWithCustomReadFile<\n TTypingsResult = string | undefined,\n TFileContents = string\n> extends ITypingsGeneratorOptionsWithoutReadFile<TTypingsResult, TFileContents> {\n readFile: ReadFile<TFileContents>;\n}\n\n/**\n * This is a simple tool that generates .d.ts files for non-TS files.\n *\n * @public\n */\nexport class TypingsGenerator<TFileContents = string> {\n // Map of resolved consumer file path -> Set<resolved dependency file path>\n private readonly _dependenciesOfFile: Map<string, Set<string>>;\n\n // Map of resolved dependency file path -> Set<resolved consumer file path>\n private readonly _consumersOfFile: Map<string, Set<string>>;\n\n // Map of resolved file path -> relative file path\n private readonly _relativePaths: Map<string, string>;\n\n protected _options: ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents>;\n\n /**\n * The folder path that contains all input source files.\n */\n public readonly sourceFolderPath: string;\n\n /**\n * The glob pattern used to find input files to process.\n */\n public readonly inputFileGlob: string;\n\n /**\n * The glob patterns that should be ignored when finding input files to process.\n */\n public readonly ignoredFileGlobs: readonly string[];\n\n public constructor(\n options: TFileContents extends string\n ? ITypingsGeneratorOptions<string | undefined, TFileContents>\n : never\n );\n public constructor(options: ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents>);\n public constructor(options: ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents>) {\n this._options = {\n ...options,\n readFile:\n options.readFile ??\n ((filePath: string, relativePath: string): Promise<TFileContents> =>\n FileSystem.readFileAsync(filePath) as Promise<TFileContents>)\n };\n\n if (options.filesToIgnore) {\n throw new Error('The filesToIgnore option is no longer supported. Please use globsToIgnore instead.');\n }\n\n if (!options.generatedTsFolder) {\n throw new Error('generatedTsFolder must be provided');\n }\n\n if (!options.srcFolder) {\n throw new Error('srcFolder must be provided');\n }\n this.sourceFolderPath = options.srcFolder;\n\n if (Path.isUnder(options.srcFolder, options.generatedTsFolder)) {\n throw new Error('srcFolder must not be under generatedTsFolder');\n }\n\n if (Path.isUnder(options.generatedTsFolder, options.srcFolder)) {\n throw new Error('generatedTsFolder must not be under srcFolder');\n }\n\n if (!options.fileExtensions || options.fileExtensions.length === 0) {\n throw new Error('At least one file extension must be provided.');\n }\n\n this.ignoredFileGlobs = options.globsToIgnore || [];\n\n if (!options.terminal) {\n this._options.terminal = new Terminal(new ConsoleTerminalProvider({ verboseEnabled: true }));\n }\n\n this._options.fileExtensions = this._normalizeFileExtensions(options.fileExtensions);\n\n this._dependenciesOfFile = new Map();\n this._consumersOfFile = new Map();\n this._relativePaths = new Map();\n\n this.inputFileGlob = `**/*+(${this._options.fileExtensions.join('|')})`;\n }\n\n /**\n * Generate typings for the provided input files.\n *\n * @param relativeFilePaths - The input files to process, relative to the source folder. If not provided,\n * all input files will be processed.\n */\n public async generateTypingsAsync(relativeFilePaths?: string[]): Promise<void> {\n let checkFilePaths: boolean = true;\n if (!relativeFilePaths?.length) {\n checkFilePaths = false; // Don't check file paths if we generate them\n relativeFilePaths = await glob(this.inputFileGlob, {\n cwd: this.sourceFolderPath,\n ignore: this.ignoredFileGlobs as string[],\n onlyFiles: true\n });\n }\n\n await this._reprocessFilesAsync(relativeFilePaths!, checkFilePaths);\n }\n\n public async runWatcherAsync(): Promise<void> {\n await FileSystem.ensureFolderAsync(this._options.generatedTsFolder);\n\n await new Promise((resolve, reject): void => {\n const watcher: chokidar.FSWatcher = chokidar.watch(this.inputFileGlob, {\n cwd: this.sourceFolderPath,\n ignored: this.ignoredFileGlobs\n });\n\n const queue: Set<string> = new Set();\n let timeout: NodeJS.Timeout | undefined;\n let processing: boolean = false;\n let flushAfterCompletion: boolean = false;\n\n const flushInternal: () => void = () => {\n processing = true;\n\n const toProcess: string[] = Array.from(queue);\n queue.clear();\n this._reprocessFilesAsync(toProcess, false)\n .then(() => {\n processing = false;\n // If the timeout was invoked again, immediately reexecute with the changed files.\n if (flushAfterCompletion) {\n flushAfterCompletion = false;\n flushInternal();\n }\n })\n .catch(reject);\n };\n\n const debouncedFlush: () => void = () => {\n timeout = undefined;\n if (processing) {\n // If the callback was invoked while processing is ongoing, indicate that we should flush immediately\n // upon completion of the current change batch.\n flushAfterCompletion = true;\n return;\n }\n\n flushInternal();\n };\n\n const onChange: (relativePath: string) => void = (relativePath: string) => {\n queue.add(relativePath);\n if (timeout) {\n clearTimeout(timeout);\n }\n\n setTimeout(debouncedFlush, 100);\n };\n\n watcher.on('add', onChange);\n watcher.on('change', onChange);\n watcher.on('unlink', async (relativePath) => {\n await Promise.all(\n this._getOutputFilePathsWithoutCheck(relativePath).map(async (outputFile: string) => {\n await FileSystem.deleteFileAsync(outputFile);\n })\n );\n });\n watcher.on('error', reject);\n });\n }\n\n /**\n * Register file dependencies that may effect the typings of a consumer file.\n * Note: This feature is only useful in watch mode.\n * The registerDependency method must be called in the body of parseAndGenerateTypings every\n * time because the registry for a file is cleared at the beginning of processing.\n */\n public registerDependency(consumer: string, rawDependency: string): void {\n // Need to normalize slashes in the dependency path\n const dependency: string = path.resolve(this._options.srcFolder, rawDependency);\n\n let dependencies: Set<string> | undefined = this._dependenciesOfFile.get(consumer);\n if (!dependencies) {\n dependencies = new Set();\n this._dependenciesOfFile.set(consumer, dependencies);\n }\n dependencies.add(dependency);\n\n let consumers: Set<string> | undefined = this._consumersOfFile.get(dependency);\n if (!consumers) {\n consumers = new Set();\n this._consumersOfFile.set(dependency, consumers);\n }\n consumers.add(consumer);\n }\n\n public getOutputFilePaths(relativePath: string): string[] {\n if (path.isAbsolute(relativePath)) {\n throw new Error(`\"${relativePath}\" must be relative`);\n }\n\n return this._getOutputFilePathsWithoutCheck(relativePath);\n }\n\n private _getOutputFilePathsWithoutCheck(relativePath: string): string[] {\n const typingsFilePaths: Iterable<string> = this._getTypingsFilePaths(relativePath);\n const additionalPaths: string[] | undefined = this._options.getAdditionalOutputFiles?.(relativePath);\n return additionalPaths ? [...typingsFilePaths, ...additionalPaths] : Array.from(typingsFilePaths);\n }\n\n private async _reprocessFilesAsync(\n relativePaths: Iterable<string>,\n checkFilePaths: boolean\n ): Promise<void> {\n // Build a queue of resolved paths\n const toProcess: Set<string> = new Set();\n for (const rawPath of relativePaths) {\n if (checkFilePaths && path.isAbsolute(rawPath)) {\n throw new Error(`\"${rawPath}\" must be relative`);\n }\n\n const relativePath: string = Path.convertToSlashes(rawPath);\n const resolvedPath: string = path.resolve(this._options.srcFolder, rawPath);\n this._relativePaths.set(resolvedPath, relativePath);\n toProcess.add(resolvedPath);\n }\n\n // Expand out all registered consumers, according to the current dependency graph\n for (const file of toProcess) {\n const consumers: Set<string> | undefined = this._consumersOfFile.get(file);\n if (consumers) {\n for (const consumer of consumers) {\n toProcess.add(consumer);\n }\n }\n }\n\n // Map back to the relative paths so that the information is available\n await Async.forEachAsync(\n toProcess,\n async (resolvedPath: string) => {\n const relativePath: string | undefined = this._relativePaths.get(resolvedPath);\n if (!relativePath) {\n throw new Error(`Missing relative path for file ${resolvedPath}`);\n }\n await this._parseFileAndGenerateTypingsAsync(relativePath, resolvedPath);\n },\n { concurrency: 20 }\n );\n }\n\n private async _parseFileAndGenerateTypingsAsync(relativePath: string, resolvedPath: string): Promise<void> {\n // Clear registered dependencies prior to reprocessing.\n this._clearDependencies(resolvedPath);\n\n try {\n const fileContents: TFileContents = await this._options.readFile(resolvedPath, relativePath);\n const typingsData: string | undefined = await this._options.parseAndGenerateTypings(\n fileContents,\n resolvedPath,\n relativePath\n );\n\n // Typings data will be undefined when no types should be generated for the parsed file.\n if (typingsData === undefined) {\n return;\n }\n\n const prefixedTypingsData: string = [\n '// This file was generated by a tool. Modifying it will produce unexpected behavior',\n '',\n typingsData\n ].join(EOL);\n\n const generatedTsFilePaths: Iterable<string> = this._getTypingsFilePaths(relativePath);\n for (const generatedTsFilePath of generatedTsFilePaths) {\n await FileSystem.writeFileAsync(generatedTsFilePath, prefixedTypingsData, {\n ensureFolderExists: true,\n convertLineEndings: NewlineKind.OsDefault\n });\n }\n } catch (e) {\n this._options.terminal!.writeError(\n `Error occurred parsing and generating typings for file \"${resolvedPath}\": ${e}`\n );\n }\n }\n\n /**\n * Removes the consumer from all extant dependencies\n */\n private _clearDependencies(consumer: string): void {\n const dependencies: Set<string> | undefined = this._dependenciesOfFile.get(consumer);\n if (dependencies) {\n for (const dependency of dependencies) {\n this._consumersOfFile.get(dependency)!.delete(consumer);\n }\n dependencies.clear();\n }\n }\n\n private *_getTypingsFilePaths(relativePath: string): Iterable<string> {\n const { generatedTsFolder, secondaryGeneratedTsFolders } = this._options;\n const dtsFilename: string = `${relativePath}.d.ts`;\n yield path.resolve(generatedTsFolder, dtsFilename);\n if (secondaryGeneratedTsFolders) {\n for (const secondaryGeneratedTsFolder of secondaryGeneratedTsFolders) {\n yield path.resolve(secondaryGeneratedTsFolder, dtsFilename);\n }\n }\n }\n\n private _normalizeFileExtensions(fileExtensions: string[]): string[] {\n const result: Set<string> = new Set();\n for (const fileExtension of fileExtensions) {\n if (!fileExtension.startsWith('.')) {\n result.add(`.${fileExtension}`);\n } else {\n result.add(fileExtension);\n }\n }\n\n return Array.from(result);\n }\n}\n"]}
1
+ {"version":3,"file":"TypingsGenerator.js","sourceRoot":"","sources":["../src/TypingsGenerator.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,oEAAoF;AACpF,kDAAwF;AACxF,0DAA6B;AAC7B,2CAA6B;AAC7B,2BAAyB;AACzB,mDAAqC;AA2DrC;;;;GAIG;AACH,MAAa,gBAAgB;IAmC3B,YAAmB,OAAsF;;QACvG,IAAI,CAAC,QAAQ,mCACR,OAAO,KACV,QAAQ,EACN,MAAA,OAAO,CAAC,QAAQ,mCAChB,CAAC,CAAC,QAAgB,EAAE,YAA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AE,CAAC;gBACnC,MAAM,CAAC,GAAG,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;CACF;AA5TD,4CA4TC","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 { FileSystem, Path, NewlineKind, Async } from '@rushstack/node-core-library';\nimport { type ITerminal, Terminal, ConsoleTerminalProvider } from '@rushstack/terminal';\nimport glob from 'fast-glob';\nimport * as path from 'path';\nimport { EOL } from 'os';\nimport * as chokidar from 'chokidar';\n\n/**\n * @public\n */\nexport interface ITypingsGeneratorBaseOptions {\n srcFolder: string;\n generatedTsFolder: string;\n secondaryGeneratedTsFolders?: string[];\n globsToIgnore?: string[];\n terminal?: ITerminal;\n}\n\n/**\n * @public\n */\nexport interface ITypingsGeneratorOptionsWithoutReadFile<\n TTypingsResult = string | undefined,\n TFileContents = string\n> extends ITypingsGeneratorBaseOptions {\n fileExtensions: string[];\n parseAndGenerateTypings: (\n fileContents: TFileContents,\n filePath: string,\n relativePath: string\n ) => TTypingsResult | Promise<TTypingsResult>;\n getAdditionalOutputFiles?: (relativePath: string) => string[];\n}\n\n/**\n * @public\n */\nexport type ReadFile<TFileContents = string> = (\n filePath: string,\n relativePath: string\n) => Promise<TFileContents> | TFileContents;\n\n/**\n * @public\n */\nexport interface ITypingsGeneratorOptions<\n TTypingsResult = string | undefined,\n TFileContents extends string = string\n> extends ITypingsGeneratorOptionsWithoutReadFile<TTypingsResult, TFileContents> {\n readFile?: ReadFile<TFileContents>;\n}\n\n/**\n * Options for a TypingsGenerator that needs to customize how files are read.\n *\n * @public\n */\nexport interface ITypingsGeneratorOptionsWithCustomReadFile<\n TTypingsResult = string | undefined,\n TFileContents = string\n> extends ITypingsGeneratorOptionsWithoutReadFile<TTypingsResult, TFileContents> {\n readFile: ReadFile<TFileContents>;\n}\n\n/**\n * This is a simple tool that generates .d.ts files for non-TS files.\n *\n * @public\n */\nexport class TypingsGenerator<TFileContents = string> {\n // Map of resolved consumer file path -> Set<resolved dependency file path>\n private readonly _dependenciesOfFile: Map<string, Set<string>>;\n\n // Map of resolved dependency file path -> Set<resolved consumer file path>\n private readonly _consumersOfFile: Map<string, Set<string>>;\n\n // Map of resolved file path -> relative file path\n private readonly _relativePaths: Map<string, string>;\n\n protected readonly _options: ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents>;\n\n protected readonly terminal: ITerminal;\n\n /**\n * The folder path that contains all input source files.\n */\n public readonly sourceFolderPath: string;\n\n /**\n * The glob pattern used to find input files to process.\n */\n public readonly inputFileGlob: string;\n\n /**\n * The glob patterns that should be ignored when finding input files to process.\n */\n public readonly ignoredFileGlobs: readonly string[];\n\n public constructor(\n options: TFileContents extends string\n ? ITypingsGeneratorOptions<string | undefined, TFileContents>\n : never\n );\n public constructor(options: ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents>);\n public constructor(options: ITypingsGeneratorOptionsWithCustomReadFile<string | undefined, TFileContents>) {\n this._options = {\n ...options,\n readFile:\n options.readFile ??\n ((filePath: string, relativePath: string): Promise<TFileContents> =>\n FileSystem.readFileAsync(filePath) as Promise<TFileContents>)\n };\n\n if (!options.generatedTsFolder) {\n throw new Error('generatedTsFolder must be provided');\n }\n\n if (!options.srcFolder) {\n throw new Error('srcFolder must be provided');\n }\n this.sourceFolderPath = options.srcFolder;\n\n if (Path.isUnder(options.srcFolder, options.generatedTsFolder)) {\n throw new Error('srcFolder must not be under generatedTsFolder');\n }\n\n if (Path.isUnder(options.generatedTsFolder, options.srcFolder)) {\n throw new Error('generatedTsFolder must not be under srcFolder');\n }\n\n if (!options.fileExtensions || options.fileExtensions.length === 0) {\n throw new Error('At least one file extension must be provided.');\n }\n\n this.ignoredFileGlobs = options.globsToIgnore || [];\n\n this.terminal = options.terminal ?? new Terminal(new ConsoleTerminalProvider({ verboseEnabled: true }));\n\n this._options.fileExtensions = this._normalizeFileExtensions(options.fileExtensions);\n\n this._dependenciesOfFile = new Map();\n this._consumersOfFile = new Map();\n this._relativePaths = new Map();\n\n this.inputFileGlob = `**/*+(${this._options.fileExtensions.join('|')})`;\n }\n\n /**\n * Generate typings for the provided input files.\n *\n * @param relativeFilePaths - The input files to process, relative to the source folder. If not provided,\n * all input files will be processed.\n */\n public async generateTypingsAsync(relativeFilePaths?: string[]): Promise<void> {\n let checkFilePaths: boolean = true;\n if (!relativeFilePaths?.length) {\n checkFilePaths = false; // Don't check file paths if we generate them\n relativeFilePaths = await glob(this.inputFileGlob, {\n cwd: this.sourceFolderPath,\n ignore: this.ignoredFileGlobs as string[],\n onlyFiles: true\n });\n }\n\n await this._reprocessFilesAsync(relativeFilePaths!, checkFilePaths);\n }\n\n public async runWatcherAsync(): Promise<void> {\n await FileSystem.ensureFolderAsync(this._options.generatedTsFolder);\n\n await new Promise((resolve, reject): void => {\n const watcher: chokidar.FSWatcher = chokidar.watch(this.inputFileGlob, {\n cwd: this.sourceFolderPath,\n ignored: this.ignoredFileGlobs\n });\n\n const queue: Set<string> = new Set();\n let timeout: NodeJS.Timeout | undefined;\n let processing: boolean = false;\n let flushAfterCompletion: boolean = false;\n\n const flushInternal: () => void = () => {\n processing = true;\n\n const toProcess: string[] = Array.from(queue);\n queue.clear();\n this._reprocessFilesAsync(toProcess, false)\n .then(() => {\n processing = false;\n // If the timeout was invoked again, immediately reexecute with the changed files.\n if (flushAfterCompletion) {\n flushAfterCompletion = false;\n flushInternal();\n }\n })\n .catch(reject);\n };\n\n const debouncedFlush: () => void = () => {\n timeout = undefined;\n if (processing) {\n // If the callback was invoked while processing is ongoing, indicate that we should flush immediately\n // upon completion of the current change batch.\n flushAfterCompletion = true;\n return;\n }\n\n flushInternal();\n };\n\n const onChange: (relativePath: string) => void = (relativePath: string) => {\n queue.add(relativePath);\n if (timeout) {\n clearTimeout(timeout);\n }\n\n setTimeout(debouncedFlush, 100);\n };\n\n watcher.on('add', onChange);\n watcher.on('change', onChange);\n watcher.on('unlink', async (relativePath) => {\n await Promise.all(\n this._getOutputFilePathsWithoutCheck(relativePath).map(async (outputFile: string) => {\n await FileSystem.deleteFileAsync(outputFile);\n })\n );\n });\n watcher.on('error', reject);\n });\n }\n\n /**\n * Register file dependencies that may effect the typings of a consumer file.\n * Note: This feature is only useful in watch mode.\n * The registerDependency method must be called in the body of parseAndGenerateTypings every\n * time because the registry for a file is cleared at the beginning of processing.\n */\n public registerDependency(consumer: string, rawDependency: string): void {\n // Need to normalize slashes in the dependency path\n const dependency: string = path.resolve(this._options.srcFolder, rawDependency);\n\n let dependencies: Set<string> | undefined = this._dependenciesOfFile.get(consumer);\n if (!dependencies) {\n dependencies = new Set();\n this._dependenciesOfFile.set(consumer, dependencies);\n }\n dependencies.add(dependency);\n\n let consumers: Set<string> | undefined = this._consumersOfFile.get(dependency);\n if (!consumers) {\n consumers = new Set();\n this._consumersOfFile.set(dependency, consumers);\n }\n consumers.add(consumer);\n }\n\n public getOutputFilePaths(relativePath: string): string[] {\n if (path.isAbsolute(relativePath)) {\n throw new Error(`\"${relativePath}\" must be relative`);\n }\n\n return this._getOutputFilePathsWithoutCheck(relativePath);\n }\n\n private _getOutputFilePathsWithoutCheck(relativePath: string): string[] {\n const typingsFilePaths: Iterable<string> = this._getTypingsFilePaths(relativePath);\n const additionalPaths: string[] | undefined = this._options.getAdditionalOutputFiles?.(relativePath);\n return additionalPaths ? [...typingsFilePaths, ...additionalPaths] : Array.from(typingsFilePaths);\n }\n\n private async _reprocessFilesAsync(\n relativePaths: Iterable<string>,\n checkFilePaths: boolean\n ): Promise<void> {\n // Build a queue of resolved paths\n const toProcess: Set<string> = new Set();\n for (const rawPath of relativePaths) {\n if (checkFilePaths && path.isAbsolute(rawPath)) {\n throw new Error(`\"${rawPath}\" must be relative`);\n }\n\n const relativePath: string = Path.convertToSlashes(rawPath);\n const resolvedPath: string = path.resolve(this._options.srcFolder, rawPath);\n this._relativePaths.set(resolvedPath, relativePath);\n toProcess.add(resolvedPath);\n }\n\n // Expand out all registered consumers, according to the current dependency graph\n for (const file of toProcess) {\n const consumers: Set<string> | undefined = this._consumersOfFile.get(file);\n if (consumers) {\n for (const consumer of consumers) {\n toProcess.add(consumer);\n }\n }\n }\n\n // Map back to the relative paths so that the information is available\n await Async.forEachAsync(\n toProcess,\n async (resolvedPath: string) => {\n const relativePath: string | undefined = this._relativePaths.get(resolvedPath);\n if (!relativePath) {\n throw new Error(`Missing relative path for file ${resolvedPath}`);\n }\n await this._parseFileAndGenerateTypingsAsync(relativePath, resolvedPath);\n },\n { concurrency: 20 }\n );\n }\n\n private async _parseFileAndGenerateTypingsAsync(relativePath: string, resolvedPath: string): Promise<void> {\n // Clear registered dependencies prior to reprocessing.\n this._clearDependencies(resolvedPath);\n\n try {\n const fileContents: TFileContents = await this._options.readFile(resolvedPath, relativePath);\n const typingsData: string | undefined = await this._options.parseAndGenerateTypings(\n fileContents,\n resolvedPath,\n relativePath\n );\n\n // Typings data will be undefined when no types should be generated for the parsed file.\n if (typingsData === undefined) {\n return;\n }\n\n const prefixedTypingsData: string = [\n '// This file was generated by a tool. Modifying it will produce unexpected behavior',\n '',\n typingsData\n ].join(EOL);\n\n const generatedTsFilePaths: Iterable<string> = this._getTypingsFilePaths(relativePath);\n for (const generatedTsFilePath of generatedTsFilePaths) {\n await FileSystem.writeFileAsync(generatedTsFilePath, prefixedTypingsData, {\n ensureFolderExists: true,\n convertLineEndings: NewlineKind.OsDefault\n });\n }\n } catch (e) {\n this.terminal.writeError(\n `Error occurred parsing and generating typings for file \"${resolvedPath}\": ${e}`\n );\n }\n }\n\n /**\n * Removes the consumer from all extant dependencies\n */\n private _clearDependencies(consumer: string): void {\n const dependencies: Set<string> | undefined = this._dependenciesOfFile.get(consumer);\n if (dependencies) {\n for (const dependency of dependencies) {\n this._consumersOfFile.get(dependency)!.delete(consumer);\n }\n dependencies.clear();\n }\n }\n\n private *_getTypingsFilePaths(relativePath: string): Iterable<string> {\n const { generatedTsFolder, secondaryGeneratedTsFolders } = this._options;\n const dtsFilename: string = `${relativePath}.d.ts`;\n yield `${generatedTsFolder}/${dtsFilename}`;\n if (secondaryGeneratedTsFolders) {\n for (const secondaryGeneratedTsFolder of secondaryGeneratedTsFolders) {\n yield `${secondaryGeneratedTsFolder}/${dtsFilename}`;\n }\n }\n }\n\n private _normalizeFileExtensions(fileExtensions: string[]): string[] {\n const result: Set<string> = new Set();\n for (const fileExtension of fileExtensions) {\n if (!fileExtension.startsWith('.')) {\n result.add(`.${fileExtension}`);\n } else {\n result.add(fileExtension);\n }\n }\n\n return Array.from(result);\n }\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -6,5 +6,5 @@
6
6
  * @packageDocumentation
7
7
  */
8
8
  export { type ReadFile, type ITypingsGeneratorBaseOptions, type ITypingsGeneratorOptionsWithoutReadFile, type ITypingsGeneratorOptions, type ITypingsGeneratorOptionsWithCustomReadFile, TypingsGenerator } from './TypingsGenerator';
9
- export { type IStringValueTyping, type IStringValueTypings, type IStringValuesTypingsGeneratorBaseOptions, type IStringValuesTypingsGeneratorOptions, type IStringValuesTypingsGeneratorOptionsWithCustomReadFile, StringValuesTypingsGenerator } from './StringValuesTypingsGenerator';
9
+ export { type IStringValueTyping, type IStringValueTypings, type IExportAsDefaultOptions, type IStringValuesTypingsGeneratorBaseOptions, type IStringValuesTypingsGeneratorOptions, type IStringValuesTypingsGeneratorOptionsWithCustomReadFile, StringValuesTypingsGenerator } from './StringValuesTypingsGenerator';
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,4BAA4B,EACjC,KAAK,uCAAuC,EAC5C,KAAK,wBAAwB,EAC7B,KAAK,0CAA0C,EAC/C,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,wCAAwC,EAC7C,KAAK,oCAAoC,EACzC,KAAK,sDAAsD,EAC3D,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,4BAA4B,EACjC,KAAK,uCAAuC,EAC5C,KAAK,wBAAwB,EAC7B,KAAK,0CAA0C,EAC/C,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,wCAAwC,EAC7C,KAAK,oCAAoC,EACzC,KAAK,sDAAsD,EAC3D,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;;GAMG;AAEH,uDAO4B;AAD1B,oHAAA,gBAAgB,OAAA;AAGlB,+EAOwC;AADtC,4IAAA,4BAA4B,OAAA","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/**\n * An engine for generating TypeScript .d.ts files that provide type signatures\n * for non-TypeScript modules such as generated JavaScript or CSS. It can operate\n * in either a single-run mode or a watch mode.\n *\n * @packageDocumentation\n */\n\nexport {\n type ReadFile,\n type ITypingsGeneratorBaseOptions,\n type ITypingsGeneratorOptionsWithoutReadFile,\n type ITypingsGeneratorOptions,\n type ITypingsGeneratorOptionsWithCustomReadFile,\n TypingsGenerator\n} from './TypingsGenerator';\n\nexport {\n type IStringValueTyping,\n type IStringValueTypings,\n type IStringValuesTypingsGeneratorBaseOptions,\n type IStringValuesTypingsGeneratorOptions,\n type IStringValuesTypingsGeneratorOptionsWithCustomReadFile,\n StringValuesTypingsGenerator\n} from './StringValuesTypingsGenerator';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;;GAMG;AAEH,uDAO4B;AAD1B,oHAAA,gBAAgB,OAAA;AAGlB,+EAQwC;AADtC,4IAAA,4BAA4B,OAAA","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/**\n * An engine for generating TypeScript .d.ts files that provide type signatures\n * for non-TypeScript modules such as generated JavaScript or CSS. It can operate\n * in either a single-run mode or a watch mode.\n *\n * @packageDocumentation\n */\n\nexport {\n type ReadFile,\n type ITypingsGeneratorBaseOptions,\n type ITypingsGeneratorOptionsWithoutReadFile,\n type ITypingsGeneratorOptions,\n type ITypingsGeneratorOptionsWithCustomReadFile,\n TypingsGenerator\n} from './TypingsGenerator';\n\nexport {\n type IStringValueTyping,\n type IStringValueTypings,\n type IExportAsDefaultOptions,\n type IStringValuesTypingsGeneratorBaseOptions,\n type IStringValuesTypingsGeneratorOptions,\n type IStringValuesTypingsGeneratorOptionsWithCustomReadFile,\n StringValuesTypingsGenerator\n} from './StringValuesTypingsGenerator';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/typings-generator",
3
- "version": "0.12.62",
3
+ "version": "0.13.0",
4
4
  "description": "This library provides functionality for automatically generating typings for non-TS files.",
5
5
  "keywords": [
6
6
  "dts",
@@ -18,13 +18,13 @@
18
18
  "dependencies": {
19
19
  "chokidar": "~3.4.0",
20
20
  "fast-glob": "~3.3.1",
21
- "@rushstack/node-core-library": "5.5.1",
22
- "@rushstack/terminal": "0.13.3"
21
+ "@rushstack/node-core-library": "5.7.0",
22
+ "@rushstack/terminal": "0.14.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/glob": "7.1.1",
26
- "@rushstack/heft": "0.66.25",
27
- "local-node-rig": "1.0.0"
26
+ "local-node-rig": "1.0.0",
27
+ "@rushstack/heft": "0.67.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@types/node": "*"
@@ -36,6 +36,7 @@
36
36
  },
37
37
  "scripts": {
38
38
  "build": "heft build --clean",
39
- "_phase:build": "heft run --only build -- --clean"
39
+ "_phase:build": "heft run --only build -- --clean",
40
+ "_phase:test": "heft run --only test -- --clean"
40
41
  }
41
42
  }