{"name":"dts-generator","description":".d.ts generator. Generates a single d.ts bundle containing external modules from TypeScript files.","version":"1.3.0","bugs":{"url":"https://github.com/SitePen/dts-generator/issues"},"license":"BSD-3-Clause","repository":{"type":"git","url":"https://github.com/SitePen/dts-generator.git"},"bin":{"dts-generator":"bin/dts-generator"},"dependencies":{"bluebird":"2.9.4","glob":"4.3.2","mkdirp":"0.5.0","typescript":"1.5.0-alpha"},"devDependencies":{"tsd":"0.5.7"},"scripts":{"prepublish":"tsc -m commonjs -t es5 typings/tsd.d.ts index.ts bin/dts-generator.ts"},"gitHead":"6d67846e81b86a303350f1589349ad5d8fdad886","_id":"dts-generator@1.3.0","_shasum":"f581ac4a0f8f783b7ebe8a1e95226ab89dd4e58c","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"sitepen","email":"labs@sitepen.com"},"maintainers":[{"name":"sitepen","email":"labs@sitepen.com"}],"dist":{"shasum":"f581ac4a0f8f783b7ebe8a1e95226ab89dd4e58c","tarball":"http://registry-npm.ywwl.com/dts-generator/download/dts-generator-1.3.0.tgz","integrity":"sha512-1jaa1SRj+6NCIVv5zL6gFlQc4j6SFuXitesX3LMbjQOoVnR+nyxCCRiFW4+Tv2O7L2CYBL028+5gOJ1+3XxiSA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICX/JGXoDy3wXbLo43Vblgw4zVHK2fPLBnboekiyQQXEAiAWyrJ1jasijjq/9bvfgyaP8eHjl79BoSEv1R9TSFR2UQ=="}],"size":4194,"noattachment":false,"key":"/dts-generator/-/dts-generator-1.3.0.tgz"},"directories":{},"readme":".d.ts generator\n===============\n\n[![Build Status](https://travis-ci.org/SitePen/dts-generator.svg?branch=master)](https://travis-ci.org/SitePen/dts-generator)\n\nGenerates a single `.d.ts` bundle containing external module declarations exported from TypeScript module files.\n\n## What does this mean?\n\nIf you have a project with lots of individual TypeScript files that are designed to be consumed as external modules,\nthe TypeScript compiler doesn’t allow you to actually create a single bundle out of them. This package leverages the\nTypeScript language services in TypeScript 1.4+ to generate a single `.d.ts` file containing multiple\n`declare module 'foo'` declarations. This allows you to distribute a single `.d.ts` file along with your compiled\nJavaScript that users can simply reference from the TypeScript compiler using a `/// <reference path />` comment.\n\n`.d.ts` generator will also correctly merge non-external-module files, and any already-existing `.d.ts` files.\n\n## Usage\n\n1. `npm install dts-generator`\n\n2. Generate your `d.ts` bundle:\n\n   Programmatically:\n\n```js\nrequire('dts-generator').default({\n\t\tname: 'package-name',\n\t\tproject: '/path/to/package-directory',\n\t\tout: 'package-name.d.ts'\n});\n```\n\n   Command-line:\n\n```bash\ndts-generator --name package-name --project /path/to/package-directory --out package-name.d.ts\n```\n\n   Grunt:\n\n```js\nmodule.exports = function (grunt) {\n\tgrunt.loadNpmTasks('dts-generator');\n\tgrunt.initConfig({\n\t\tdtsGenerator: {\n\t\t\toptions: {\n\t\t\t\tname: 'package-name',\n\t\t\t\tproject: '/path/to/package-directory',\n\t\t\t\tout: 'package-name.d.ts'\n\t\t\t},\n\t\t\tdefault: {\n\t\t\t\tsrc: [ '/path/to/package-directory/**/*.ts' ]\n\t\t\t}\n\t\t}\n\t});\n};\n```\n\n3. Reference your generated d.ts bundle from somewhere in your consumer module and import away!:\n\n```ts\n/// <reference path=\"typings/package-name.d.ts\" />\n\nimport Foo = require('package-name/Foo');\n\n// ...\n```\n\n## Options\n\n* `baseDir?: string`: The base directory for the package being bundled. Any dependencies discovered outside this\n  directory will be excluded from the bundle.  *Note* this is no longer the preferred way to configure `dts-generator`, \n  it automatically gets its value from compiler option `rootDir` if specified in `tsconfig.json`, otherwise it gets value from `project`. Please see option `project`.\n* `exclude?: string[]`: A list of glob patterns, relative to `baseDir`, that should be excluded from the bundle. Use\n  the `--exclude` flag one or more times on the command-line. Defaults to `[ \"node_modules/**/*.d.ts\" ]`.\n* `externs?: string[]`: A list of external module reference paths that should be inserted as reference comments. Use\n  the `--extern` flag one or more times on the command-line.\n* `types?: string[]`: A list of external @types package dependencies that should be inserted as reference comments. Use\n  the `--types` flag one or more times on the command-line.\n* `files: string[]`: A list of files from the baseDir to bundle.\n* `eol?: string`: The end-of-line character that should be used when outputting code. Defaults to `os.EOL`.\n* `indent?: string`: The character(s) that should be used to indent the declarations in the output. Defaults to `\\t`.\n* `main?: string`: The module ID that should be used as the exported value of the package’s “main” module.\n* `moduleResolution?: ts.ModuleResolutionKind`: The type of module resolution to use when generating the bundle.\n* `name: string`: The name of the package. Used to determine the correct exported package name for modules.\n* `out: string`: The filename where the generated bundle will be created.\n* `project?: string`: The base directory for the project being bundled.  It is assumed that this directory contains a `tsconfig.json` which will be parsed to determine the files that should be bundled as well as other configuration information like `target`\n* `target?: ts.ScriptTarget`: The target environment for generated code. Defaults to `ts.ScriptTarget.Latest`.\n* `resolveModuleId: (params: ResolveModuleIdParams) => string`: An optional callback provided by the invoker to customize the declared module ids the output d.ts files. For details see [resolving module ids](docs/resolving-module-ids.md).\n* `resolveModuleImport: (params: ResolveModuleImportParams) => string`: An optional callback provided by the invoker to customize the imported module ids in the output d.ts files. For details see [resolving module ids](docs/resolving-module-ids.md).\n\n## Known issues\n\n* Output bundle code formatting is not perfect yet\n\n## Thanks\n\n[@fdecampredon](https://github.com/fdecampredon) for the idea to dump output from the compiler emitter back into the compiler parser instead of trying to\nfigure out how to influence the code emitter.\n\n## Licensing\n\n© 2015-2019 SitePen, Inc. New BSD License.\n","publish_time":1428464091662,"_cnpm_publish_time":1428464091662,"dist-tags":{"latest":"3.0.0"}}