@rushstack/typings-generator
Advanced tools
Comparing version 0.6.12 to 0.6.13
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.20.1" | ||
"packageVersion": "7.21.0" | ||
} | ||
] | ||
} |
{ | ||
"name": "@rushstack/typings-generator", | ||
"version": "0.6.12", | ||
"version": "0.6.13", | ||
"description": "This library provides functionality for automatically generating typings for non-TS files.", | ||
@@ -19,3 +19,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@rushstack/node-core-library": "3.45.1", | ||
"@rushstack/node-core-library": "3.45.2", | ||
"@types/node": "12.20.24", | ||
@@ -26,5 +26,5 @@ "chokidar": "~3.4.0", | ||
"devDependencies": { | ||
"@rushstack/eslint-config": "2.5.2", | ||
"@rushstack/heft": "0.44.7", | ||
"@rushstack/heft-node-rig": "1.8.5", | ||
"@rushstack/eslint-config": "2.5.3", | ||
"@rushstack/heft": "0.44.8", | ||
"@rushstack/heft-node-rig": "1.8.6", | ||
"@types/glob": "7.1.1" | ||
@@ -36,3 +36,3 @@ }, | ||
}, | ||
"readme": "# @rushstack/typings-generator\n\n## Installation\n\n`npm install @rushstack/typings-generator --save-dev`\n\n## Overview\n\nThis is a utility for generating typings for non-TS files. It can operate in either a single-run mode or\na watch mode. It is designed to generate `.d.ts` files with a specified generation function for all files matching\nspecified file extensions, with an option to ignore individual files.\n\n## Usage\n\n```TypeScript\nimport { TypingsGenerator } from '@rushstack/typings-generator';\n\nconst typingsGenerator: TypingsGenerator = new TypingsGenerator({\n srcFolder: '/repo/package/src',\n generatedTsFolder: '/repo/package/temp/generated-typings',\n fileExtensions: ['file-extension'],\n parseAndGenerateTypings: (fileContents: string, filePath: string) => {\n const parsedFile = parseFile(fileContents);\n const typings: string = generateTypings(parsedFile);\n return typings;\n }\n});\n\n// To run once before a compilation:\nawait typingsGenerator.generateTypings();\n\n// To start a watcher:\nawait typingsGenerator.runWatcher();\n```\n\n## Options\n\n### `srcFolder = '...'`\n\nThis property is used as the source root folder for discovery of files for which typings should be generated.\n\n### `generatedTsFolder = '...'`\n\nThis property specifies the folder in which `.d.ts` files should be dropped. It is recommended\nthat this be a folder parallel to the source folder, specified in addition to the source folder in the\n[`rootDirs` `tsconfig.json` option](https://www.typescriptlang.org/docs/handbook/compiler-options.html).\n**The folder specified by this option is emptied when the utility is invoked.**\n\n### `fileExtensions = [...]`\n\nThis property enumerates the file extensions that should be handled.\n\n### `parseAndGenerateTypings = (fileContents: string, filePath: string) => string | Promise<string>`\n\nThis property is used to specify the function that should be called on every file for which typings\nare being generated. In watch mode, this is called on every file creation and file update. It should\nreturn TypeScript declarations for the file it is called with.\n\n### `terminal`\n\nOptionally provide a [Terminal](https://github.com/microsoft/rushstack/blob/master/libraries/node-core-library/src/Terminal/Terminal.ts)\nobject for logging. If one isn't provided, logs will go to the console.\n\n### `globsToIgnore`\n\nOptionally, provide an array of globs matching files that should be ignored. These globs are evaluated\nunder [`srcFolder`](#srcFolder--)\n\n## `StringValuesTypingsGenerator`\n\nThere is an extension of this utility specifically for file types where typings should be a simple\nset of exported string values. This is useful for file types like CSS and RESX. This class takes\nthe same options as the standard `TypingsGenerator`, with one additional option ([`exportAsDefault`](#exportAsDefault--)) and a different return value for `parseAndGenerateTypings`.\n\n### `parseAndGenerateTypings = (fileContents: string, filePath: string) => { typings: ({ exportName: string, comment?: string })[] } | Promise<{ typings: ({ exportName: string, comment?: string })[] }>`\n\nThis function should behave the same as the `parseAndGenerateTypings` function for the standard\n`TypingsGenerator`, except that it should return an object with a `typings` property, set to\nan array of objects with an `exportName` property and an optional `comment` property.\nSee the example below.\n\n#### Example return value:\n\n```TypeScript\n{\n typings: [\n {\n exportName: 'myExport'\n },\n {\n exportName: 'myOtherExport',\n comment: 'This is the other export'\n }\n ]\n}\n```\n\n#### Example generated declaration file:\n\n```TypeScript\n// This file was generated by a tool. Modifying it will produce unexpected behavior\n\nexport declare const myExport: string;\n\n/**\n * This is the other export\n */\nexport declare const myOtherExport: string;\n\n```\n\n### `exportAsDefault = true | false`\n\nIf this option is set to `true`, the typings will be exported wrapped in a `default` property. This\nallows the file to be imported by using the `import myFile from './myFile.my-extension';` syntax instead of\nthe `import { myExport } from './myFile.my-extension';` or the `import * as myFile from './myFile.my-extension';`\nsyntax. This style of export is not recommended as it can prevent tree-shaking optimization.\n\n### `exportAsDefaultInterfaceName = true | false`\n\nWhen `exportAsDefault` is true, this optional setting determines the interface name\nfor the default wrapped export. For example, in the Sass Typings plugin, the interface name\nis set to `IExportStyles`. If not specified, the interface name will be `IExport`.\n(This setting is ignored when `exportAsDefault` is false).\n\n## Links\n\n- [CHANGELOG.md](https://github.com/microsoft/rushstack/blob/master/libraries/typings-generator/CHANGELOG.md) - Find\n out what's new in the latest version\n- [API Reference](https://rushstack.io/pages/api/typings-generator/)\n\n`@rushstack/typings-generator` is part of the [Rush Stack](https://rushstack.io/) family of projects.\n" | ||
"readme": "# @rushstack/typings-generator\n\n## Installation\n\n`npm install @rushstack/typings-generator --save-dev`\n\n## Overview\n\nThis is a utility for generating typings for non-TS files. It can operate in either a single-run mode or\na watch mode. It is designed to generate `.d.ts` files with a specified generation function for all files matching\nspecified file extensions, with an option to ignore individual files.\n\n## Usage\n\n```TypeScript\nimport { TypingsGenerator } from '@rushstack/typings-generator';\n\nconst typingsGenerator: TypingsGenerator = new TypingsGenerator({\n srcFolder: '/repo/package/src',\n generatedTsFolder: '/repo/package/temp/generated-typings',\n fileExtensions: ['file-extension'],\n parseAndGenerateTypings: (fileContents: string, filePath: string) => {\n const parsedFile = parseFile(fileContents);\n const typings: string = generateTypings(parsedFile);\n return typings;\n }\n});\n\n// To run once before a compilation:\nawait typingsGenerator.generateTypings();\n\n// To start a watcher:\nawait typingsGenerator.runWatcher();\n```\n\n## Options\n\n### `srcFolder = '...'`\n\nThis property is used as the source root folder for discovery of files for which typings should be generated.\n\n### `generatedTsFolder = '...'`\n\nThis property specifies the folder in which `.d.ts` files should be dropped. It is recommended\nthat this be a folder parallel to the source folder, specified in addition to the source folder in the\n[`rootDirs` `tsconfig.json` option](https://www.typescriptlang.org/docs/handbook/compiler-options.html).\n**The folder specified by this option is emptied when the utility is invoked.**\n\n### `fileExtensions = [...]`\n\nThis property enumerates the file extensions that should be handled.\n\n### `parseAndGenerateTypings = (fileContents: string, filePath: string) => string | Promise<string>`\n\nThis property is used to specify the function that should be called on every file for which typings\nare being generated. In watch mode, this is called on every file creation and file update. It should\nreturn TypeScript declarations for the file it is called with.\n\n### `terminal`\n\nOptionally provide a [Terminal](https://github.com/microsoft/rushstack/blob/main/libraries/node-core-library/src/Terminal/Terminal.ts)\nobject for logging. If one isn't provided, logs will go to the console.\n\n### `globsToIgnore`\n\nOptionally, provide an array of globs matching files that should be ignored. These globs are evaluated\nunder [`srcFolder`](#srcFolder--)\n\n## `StringValuesTypingsGenerator`\n\nThere is an extension of this utility specifically for file types where typings should be a simple\nset of exported string values. This is useful for file types like CSS and RESX. This class takes\nthe same options as the standard `TypingsGenerator`, with one additional option ([`exportAsDefault`](#exportAsDefault--)) and a different return value for `parseAndGenerateTypings`.\n\n### `parseAndGenerateTypings = (fileContents: string, filePath: string) => { typings: ({ exportName: string, comment?: string })[] } | Promise<{ typings: ({ exportName: string, comment?: string })[] }>`\n\nThis function should behave the same as the `parseAndGenerateTypings` function for the standard\n`TypingsGenerator`, except that it should return an object with a `typings` property, set to\nan array of objects with an `exportName` property and an optional `comment` property.\nSee the example below.\n\n#### Example return value:\n\n```TypeScript\n{\n typings: [\n {\n exportName: 'myExport'\n },\n {\n exportName: 'myOtherExport',\n comment: 'This is the other export'\n }\n ]\n}\n```\n\n#### Example generated declaration file:\n\n```TypeScript\n// This file was generated by a tool. Modifying it will produce unexpected behavior\n\nexport declare const myExport: string;\n\n/**\n * This is the other export\n */\nexport declare const myOtherExport: string;\n\n```\n\n### `exportAsDefault = true | false`\n\nIf this option is set to `true`, the typings will be exported wrapped in a `default` property. This\nallows the file to be imported by using the `import myFile from './myFile.my-extension';` syntax instead of\nthe `import { myExport } from './myFile.my-extension';` or the `import * as myFile from './myFile.my-extension';`\nsyntax. This style of export is not recommended as it can prevent tree-shaking optimization.\n\n### `exportAsDefaultInterfaceName = true | false`\n\nWhen `exportAsDefault` is true, this optional setting determines the interface name\nfor the default wrapped export. For example, in the Sass Typings plugin, the interface name\nis set to `IExportStyles`. If not specified, the interface name will be `IExport`.\n(This setting is ignored when `exportAsDefault` is false).\n\n## Links\n\n- [CHANGELOG.md](https://github.com/microsoft/rushstack/blob/main/libraries/typings-generator/CHANGELOG.md) - Find\n out what's new in the latest version\n- [API Reference](https://rushstack.io/pages/api/typings-generator/)\n\n`@rushstack/typings-generator` is part of the [Rush Stack](https://rushstack.io/) family of projects.\n" | ||
} |
@@ -61,3 +61,3 @@ # @rushstack/typings-generator | ||
Optionally provide a [Terminal](https://github.com/microsoft/rushstack/blob/master/libraries/node-core-library/src/Terminal/Terminal.ts) | ||
Optionally provide a [Terminal](https://github.com/microsoft/rushstack/blob/main/libraries/node-core-library/src/Terminal/Terminal.ts) | ||
object for logging. If one isn't provided, logs will go to the console. | ||
@@ -129,3 +129,3 @@ | ||
- [CHANGELOG.md](https://github.com/microsoft/rushstack/blob/master/libraries/typings-generator/CHANGELOG.md) - Find | ||
- [CHANGELOG.md](https://github.com/microsoft/rushstack/blob/main/libraries/typings-generator/CHANGELOG.md) - Find | ||
out what's new in the latest version | ||
@@ -132,0 +132,0 @@ - [API Reference](https://rushstack.io/pages/api/typings-generator/) |
58169
+ Added@rushstack/node-core-library@3.45.2(transitive)
- Removed@rushstack/node-core-library@3.45.1(transitive)