{"name":"dts-generator","description":".d.ts generator. Generates a single d.ts bundle containing external modules from TypeScript files.","version":"2.0.0","bugs":{"url":"https://github.com/SitePen/dts-generator/issues"},"license":"BSD-3-Clause","repository":{"type":"git","url":"git+https://github.com/SitePen/dts-generator.git"},"bin":{"dts-generator":"bin/dts-generator"},"dependencies":{"bluebird":"3.3.3","glob":"7.0.0","mkdirp":"0.5.1"},"devDependencies":{"dojo-loader":">=2.0.0-beta.5","intern":"~3.0.0","tsd":"0.6.5","tslint":"3.11.0","typescript":"~2.0.3"},"scripts":{"prepublish":"tsc --module umd --target es5 --moduleResolution node typings/tsd.d.ts index.ts bin/dts-generator.ts","test":"tests/run.sh"},"gitHead":"39f06bc9bcb9d11cf93c0642042a4771c8bfce36","homepage":"https://github.com/SitePen/dts-generator#readme","_id":"dts-generator@2.0.0","_shasum":"d27a4116eaff7009cbbed9de2b933b5c5f7c6b60","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.5.0","_npmUser":{"name":"sitepen","email":"labs@sitepen.com"},"dist":{"shasum":"d27a4116eaff7009cbbed9de2b933b5c5f7c6b60","tarball":"http://registry-npm.ywwl.com/dts-generator/download/dts-generator-2.0.0.tgz","integrity":"sha512-CW1fxS1CGChJYbKVBDpD7R4fTj6PKZfOKvJVeOK0amZ6bFqpvbNHXBwj7lHQFPXWUsQevafHNZ9lxvSkhLNAvg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDsqjxUAajN2RTkaTGzN2ZbtvJvCjhfALshdSwnsZ/1iAiB+SCL9HFNNAYFFvLxcIVWvQQ770UXATBwa9lPzBiGsZg=="}],"size":11303,"noattachment":false,"key":"/dts-generator/-/dts-generator-2.0.0.tgz"},"maintainers":[{"name":"sitepen","email":"labs@sitepen.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/dts-generator-2.0.0.tgz_1476212832250_0.3914473906625062"},"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":1476212833771,"_cnpm_publish_time":1476212833771,"dist-tags":{"latest":"3.0.0"}}