npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dts-gen-xx

v0.0.4

Published

.d.ts generator. Generates a single d.ts bundle containing external modules from TypeScript files.

Downloads

4

Readme

.d.ts generator

Forks of dts-generator, add params to replace the main module name

Usage

  1. npm install dts-gen-xx

  2. Generate your d.ts bundle:

    Programmatically:

require('dts-gen-xx').default({
		name: 'package-name',
		project: '/path/to/package-directory',
		out: 'package-name.d.ts'
});

Command-line:

dts-gen --name package-name --project /path/to/package-directory --out package-name.d.ts

Grunt:

module.exports = function (grunt) {
	grunt.loadNpmTasks('dts-gen-xx');
	grunt.initConfig({
		dtsGenerator: {
			options: {
				name: 'package-name',
				project: '/path/to/package-directory',
				out: 'package-name.d.ts'
			},
			default: {
				src: [ '/path/to/package-directory/**/*.ts' ]
			}
		}
	});
};
  1. Reference your generated d.ts bundle from somewhere in your consumer module and import away!:
/// <reference path="typings/package-name.d.ts" />

import Foo = require('package-name/Foo');

// ...

Options

  • baseDir?: string: The base directory for the package being bundled. Any dependencies discovered outside this directory will be excluded from the bundle. Note this is no longer the preferred way to configure dts-generator, please see project.
  • exclude?: string[]: A list of glob patterns, relative to baseDir, that should be excluded from the bundle. Use the --exclude flag one or more times on the command-line. Defaults to [ "node_modules/**/*.d.ts" ].
  • externs?: string[]: A list of external module reference paths that should be inserted as reference comments. Use the --extern flag one or more times on the command-line.
  • types?: string[]: A list of external @types package dependencies that should be inserted as reference comments. Use the --types flag one or more times on the command-line.
  • files: string[]: A list of files from the baseDir to bundle.
  • eol?: string: The end-of-line character that should be used when outputting code. Defaults to os.EOL.
  • indent?: string: The character(s) that should be used to indent the declarations in the output. Defaults to \t.
  • main?: string: The module ID that should be used as the exported value of the package’s “main” module.
  • moduleResolution?: ts.ModuleResolutionKind: The type of module resolution to use when generating the bundle.
  • name: string: The name of the package. Used to determine the correct exported package name for modules.
  • out: string: The filename where the generated bundle will be created.
  • 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
  • target?: ts.ScriptTarget: The target environment for generated code. Defaults to ts.ScriptTarget.Latest.
  • replaceModule?: string: The target main module name in your project.
  • mainModule?: string: The original main module name in your project.
  • 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.
  • 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.

Thanks

dts-generator for the open source code.