Giter Site home page Giter Site logo

dts-bundle's Issues

Add support for bundling without a main module

Sometimes you just want to export a couple of modules but with their interfaces, separately, and from one file. probably something like gts-generator project does it.
One example is the angular2 project they dont have a main module. You always have to import from 'angular2/....' something.
thanks!

Feature: option to use nodejs streams

Thanks for developing this. Finding it extremely useful in a project for untangling the madness that is the process of bundling a TypeScript lib for node with generated d.ts files.

One thing that would make things easier for integrating dts-bundle into build scripts is an option to use node streams:

gulp.src('build/index.d.ts')
.pipe(dts.bundle({
      name: 'cool-project',
      stream: true
  }))
.pipe(gulp.dest('dist/lib.d.ts'));

@Bartvds Is this a good idea? Would it be a pain to implement (I haven't taken a look at how dts-bundle is implemented)? I'm happy to take a stab at it.

Unable to reference external typings

I'm trying to use the "externals" flag to get the d.ts bundle to include typings for external libraries that exist in my node_modules folder, however for the life of my I cannot get this to work properly. I continually get : TypeError: Cannot read property 'file' of undefined. I've looked through other issues here and it seems some involve the author manually hacking the project, and others just seem to not have been resolved. Anyone else having trouble with this? I'd appreciate any help.

support es6 imports

es6 imports are coming in 1.5 it would be great to support them

import { ModuleA } from '../module';

classic module resolution with non-relative path.

It wasn't working if the files are in the non-relative path.

//index.ts
export {default as Foo} 'src/foo';
export {default as Foo2} 'src/foo2';

//src/foo.ts
export default class Foo
{
    bar():boolean
    {
    	return true;
    }
}

//src/foo2.ts
import Foo 'src/foo';

export default class Foo2 extends Foo
{
    bar():boolean
    {
    	return true;
    }
}

Infinite loop while processing references

The loop around https://github.com/grunt-ts/dts-bundle/blob/master/lib/index.js#L323 causes the process to hang, as it is constantly pushing the same file over-and-over into the queue.

Although pushUnique(queue, p); should prevent this, it did not work in this case, as we just popped something from the queue (node.d.ts), which tries to add "events", "net", etc. back onto the queue (in turn re-adding node.d.ts).

My quick fix was to keep an extra dictionary, which contains true for every p.file that we processed there, but again, I'm not completely sure this matches the use cases you have in mind.

Multiline import / export

Multiline import / exports are currently not processed:

export {
    ChangeHook,
    EnterHook,
    InjectedRouter,
    LeaveHook,
    ParseQueryString,
    RouteComponent,
    RouteComponents,
    RouteComponentProps,
    RouteConfig,
    RoutePattern,
    RouterProps,
    RouterState,
    RedirectFunction,
    StringifyQuery
} from "./lib/Router";

jsdoc comments aborts processing

If a typescript file contains a simple jsdoc single line comment processing on that file is aborted midway through. Example

export interface IFoo {
    /** comment */
    doSomething();
}

This would generate:

declare module '__proj/mod' {

    export interface IFoo {

}

Note the mismatch braces as processing has been aborted midway through the interface.

does not work with multi-file projects (+proposed solution)

Hi, looks like dts-bundle works great for single file projects.

But unfortunately if a project has multiple files, the relative import references are not transformed.

for example, if my original input lib.d.ts is:

export import logging = require("./misc/logging")

Solution?

As I'm using grunt-dts-bundle, I think a solution might be to transform this file to something like

/// <reference path="./misc/ambient_misc_logging.d.ts" /> //add this line
declare module "ambient_lib" {
export import logging = require("ambient_misc_logging") //trim+prefiex + non-alphanumeric characters converted to underscore
}

and then I can walk my project, processing all my d.ts files this way, naming the dts-bundle output in a way that conforms with this additional transform.

De-uglify Typescript's doc-comment indentation

Typescript removes the first space before the stars of doc comments, e.g.:

class Foo {
    /**
     * Bars the foo.
     */
    bar() {
    }
}

is mangled to:

class Foo {
    /**
    * Bars the foo.
    */
    bar() {
    }
}

It would be nice to be able to automatically produce quality typings that look great, so maybe some extra re-indenting would help here.

CLI tests not passed on travis

The test doesn't pass because needs to npm install -g dts-bundle and travis dont found dts-bundle command.

I have added this:

before_script:
  - npm install -g

to .travis.yml but doesn't work ...
I can't install via npm install -g dts-bundle because the published npm package don't have the CLI feature ...

Need help about that ๐Ÿ™
@basarat ๐Ÿ†˜ ;)

Private doc comments remain

dts-bundle strips out private declarations, but it leaves their doc comments. This looks a bit weird in the resulting typing.

Maybe just comment-out these declarations?

Reexporting module as named export for module library

Hi,

I am trying to use dts-bundle to export a bundle as a module library. I am re-exporting all the exports from another file, and while this works without bundling it doesn't seem to when bundled.

My question is really 2-fold.

  1. Is this a gap/bug in the dts-bundle library?
  2. What should the bundle.d.ts look like?

This is my minimal example. Consider I am trying to publish an 'animals' npm package. It's very simple consisting of the following.

mammals.ts

export class Monkey { }
export class Lion { }
export class Tiger { }

index.ts

import * as mammals from './mammals';
export { mammals }

I want to use it as follows within some other code in another module somewhere

zoo.ts

import { mammals } from 'animals';
new mammals.Lion();

If you create a bundle this using the command

dts-bundle --name bundle --main index.d.ts --outputAsModuleFolder

You get the file

bundle.d.ts

export { mammals };

export class Monkey {
}
export class Lion {
}
export class Tiger {
}

which leads to a typescript error 'Cannot find name mammals'

The initial d.ts files look like this:-

mammals.d.ts

export declare class Monkey {
}
export declare class Lion {
}
export declare class Tiger {
}

index.d.ts

import * as mammals from './mammals';
export { mammals };

Switch to default no prefix?

Maybe set prefix to empty string by default?

Not sure, but I think that would still be valid and sensible, as many modules use submodules that look like a path (eg: without leading dots/slash).

I originally had '__' to make the sub modules look 'private' but maybe that's not really necessary.

So this:

declare module 'foo/bar' {}

Instead of:

declare module '__foo/bar' {}

@poelstra What do you think?

Bundle includes more than it should when using main

I'm using the latest dts-bundle to combine the d.ts files generated by typescript compiler.
When setting main to my index.d.ts file I expect the output in the bundle to match what's actually exported in my index.ts file. It seems however that it treats all exports as a wildcard.
So this:
export { destruct } from 'module'
in practice becomes this
export * from 'modules'

Which is unfortunately really bad since my IDE now thinks certain things are exported, based on the d.ts file, when they are not, which leads to false positives in the type checker. And you wont notice until you get weird runtime errors. I don't know if this is intended or a limitation/bug.

file not found error if both .d.ts file and a folder with the same name exist

Hello,

I run into an issue, using the following command :
dts-bundle --name myApp --main dts/**/*.d.ts --out bundle.d.ts

in dts folder, I have both a file called application.d.ts and a folder application.
I get the following error, and don't know how to solve it (excepted by renaming the folder or the file) :

Error: ENOENT: no such file or directory, open 'D:\(...)\dts\application\index.d.ts'

Thanks !

wrong parameter for "All .d.ts files" feature

Instruction under All .d.ts files section of README.md states name parameter should be used:

If you set name parameter to some path ended with */.d.ts then dts-bundle load all .d.ts files and generate a bundle.

I was able to enable this feature using main but not name parameter. Shouldn't this be main parameter?

bug? declare module 'yargs2/index//yargs'

import { Arguments, Argv } from 'yargs';

declare module 'yargs'
{
}

output

declare module 'yargs2/core' {
    /**
      * Created by user on 2018/6/1/001.
      */
    import { Argv } from 'yargs';
    declare module 'yargs2/index//yargs' {
}
}

should is module 'yargs' not module 'yargs2/index//yargs'

tsconfig.json paths

Here's our tsconfig.json file:

{
    "compilerOptions": {
        "sourceMap": true,
        "baseUrl": ".",
        "declaration": true,
        "paths": {
            "@/*": [
                "src/*"
            ]
        },
        "strictNullChecks": true
    }
}

When I generate the bundle, the imports like this one are not working as expected:

import { initSDK } from '@/core';

Looks like dts-bundle doesn't parse our tsconfig.json file. Is there a way to do that?

Cannot bundle express.d.ts references

in the current version of express.d.ts is the following code block:

/* =================== USAGE ===================
    import express = require('express');
    var app = express();
 =============================================== */

because the end of a comment is detected with the following regex: /^[ \t]*\*+\/ it means that dts-bundle never detects the end of the comment and thinks, the whole files is commented out.

Duplicated imports after bundle into single .d.ts file

I successfully bundle multiple .d.ts files into a single file. But in the bundle.d.ts file, there are duplicated imports. In Angular4, using the bundled .d.ts file seems to be ok. But Angular5, webpack shows a duplicated identifier error. Here's my dts-bundle options:
{ name: 'babylon-juyee-engine', main:rootDir + '/dist/index.d.ts', out: rootDir + '/babylon-juyee-engine.d.ts', removeSource: true, outputAsModuleFolder: true }
And here's part of the .d.ts file with duplicated imports:
import { BoundingBoxRenderer, Matrix, Scene, Engine, RenderTargetTexture, Vector3, Nullable } from 'babylonjs'; import { TargetCamera, Camera, Vector3, Vector2, AbstractMesh, Scene, Matrix, Collider } from "babylonjs"; import { Engine, Mesh, Scene, Vector3, Matrix, Node, SubMesh, _InstancesBatch, Material, Effect, Geometry, AbstractMesh, BoundingInfo, Ray, PickingInfo } from 'babylonjs'; import { Mesh, Scene, Vector3, Matrix, Node, Geometry, BoundingInfo, Ray, PickingInfo } from 'babylonjs';
There are several Vector3 and Scene imported.
Is there any compile option can help me avoid duplicated imports?

"already got export for:"

When augmenting an interface two different times in to different files, instead of grouping the augmentations, dts-bundle complains of duplicates

Fails to process when it has non relative imports

It seems to blow up when I have a reference in one d.ts to Bluebird which looks like this:

import * as Promise from "bluebird";

It gives the error:

TypeError: Cannot read property 'file' of undefined
    at C:\Code\Web\test\node_modules\dts-bundle\lib\index.js:125:55

The config being used is:

dtsBundle.bundle({
        name: pkg.name, // Lets call it "test"
        main: paths.output + "/definitions/index.d.ts", // Lets call it dist/definitions/index.d.ts
        out: paths.output + "/" + pkg.name + '.d.ts' // dist/definitions/test.d.ts
    });

Much like you I have a typings folder, but it is external to where the d.ts files are spat out, do I need to provide a link to them in the options somehow?

Version 0.4.3 is still using CRLF

npm i dts-bundle -g
dts-bundle 
env: node\r: No such file or directory

I have to edit global node_modules/dts-bundle/lib/dts-bundle.js, replace all CRLF to LF, to use dts-bundle

it is not possible to set out relative to gruntfile.js/package.json root

My build outputs typesscript files and declarations to /artifacts/dev/ relative to project root (location of gruntfile.js or package.json). (I am using vs2015 and tsconfig.json).

Here is my grunt task:

dts_bundle: {
            build: {
                options: {
                    name: 'si-portal-framework',
                    main: 'artifacts/dev/index.d.ts',
                   // baseDir: 'artifacts/dev',
                    out: 'dist/si-portal-framework.d.ts',
                    verbose:true
                }
            }
        }

Running "dts_bundle:build" (dts_bundle) task
### settings ###
main:         artifacts/dev/index.d.ts
name:         si-portal-framework
out:          dist/si-portal-framework.d.ts
baseDir:      C:\dev\S-Innovations\S-Innovations.PortalFramework\src\artifacts\dev
mainFile:     C:\dev\S-Innovations\S-Innovations.PortalFramework\src\artifacts\dev\index.d.ts
outFile:      C:\dev\S-Innovations\S-Innovations.PortalFramework\src\artifacts\dev\dist\si-portal-framework.d.ts
externals:    no
exclude:      null
removeSource: no
comments:     no

alternative

dts_bundle: {
            build: {
                options: {
                    name: 'si-portal-framework',
                    main: 'artifacts/dev/index.d.ts',
                   // baseDir: 'artifacts/dev',
                    out: '/dist/si-portal-framework.d.ts',
                    verbose:true
                }
            }
        }

Innovations.PortalFramework\src\Gruntfile.js" dts_bundle:build
Running "dts_bundle:build" (dts_bundle) task
### settings ###
main:         artifacts/dev/index.d.ts
name:         si-portal-framework
out:          /dist/si-portal-framework.d.ts
baseDir:      C:\dev\S-Innovations\S-Innovations.PortalFramework\src\artifacts\dev
mainFile:     C:\dev\S-Innovations\S-Innovations.PortalFramework\src\artifacts\dev\index.d.ts
outFile:      C:\dist\si-portal-framework.d.ts
externals:    no
exclude:      null
removeSource: no
comments:     no

Is this how it was intended to work? I would assume that the out option would be relative to the project root and not the baseDir?

and the second case of using "/" makees it relative to disk entry point.

fs.writeFileSync passes the encoding the wrong way

Failed to compile the project:

Running "ts:main" (ts) task
Compiling...
Using tsc v2.9.2
lib/index.ts(186,53): error TS2559: Type '"utf8"' has no properties in common with type '{ encoding?: string; mode?: string; flag?: string; }'.
lib/index.ts(427,44): error TS2559: Type '"utf8"' has no properties in common with type '{ encoding?: string; mode?: string; flag?: string; }'.

The gues the encoding should be passed wrapped in an option object.

Add support to export as namespace

Thanks for the awesome plugin.
It will be cool if we also have support for typings exported as namespace as well.
We are creating a bundle with var as library target using webpack, allowing users to use symbol from global namespace directly, without importing. We want to generate d.ts file for this as well.

Exclude 'external' typings

Hi Bart,

We just started creating our own 'definition merger', also string-based. Yours seems much more elaborate though, so thanks for this!

I tried it out on one of our modules, but I stumbled across the fact that 'external' typings (such as node.d.ts, but basically any module that's being required with a non-relative path) are being included in the generated output.

This is problematic if I want to use these typings in another module, which will highly likely also include e.g. node.d.ts in its typings file (managed by tsd).

I hacked something in your code to leave these typings out, and to not mangle the require("...") statements in these cases, and that seems to work, but I have the feeling that I'm missing something, or that you may have a better idea to handle this.

For your reference, here's basically what I did:

  • Around https://github.com/grunt-ts/dts-bundle/blob/master/lib/index.js#L219, I don't push the path on res.refs if it starts with my /typings folder (currently hardcoded, but could be made part of configuration)
  • I replaced "getLibName" in parse.importLineRef[i][0] = replaceImportExport(String(line), getLibName); by function(name) { return name; }

So this basically leaves every 'external module' import intact, but seeing that you explicitly put some code in there to mangle them, I must be missing a use-case.

What's your take on this?

Export declaration conflicts

Say I have a main index.d.ts generated by the TS compiler such as:

import { Logger } from "logger";
import { Cache } from "cache;
export { Logger, Cache };

then dts-bundle produces this:

declare module "my-module" {
    import { Logger } from "logger";
    import { Cache } from "cache;
    export { Logger, Cache };
}

which throws this error when seen by the compiler:

Export declaration conflicts with exported declaration of 'Logger'"
Export declaration conflicts with exported declaration of 'Cache'"

After removing the export { Logger, Cache }; line, it works.

Consider optional "name" setting

If "name" option is not defined, dts-bundle does not wrap output with module definition:

instead of

// Generated by dts-bundle v0.4.3

declare module 'MyBundle' {
    module Module1 {
        function validateGuid(guid: any): boolean;
    }
    module Module2 {
        function validateGuid(guid: any): boolean;
    }
}    

generate just

// Generated by dts-bundle v0.4.3

module Module1 {
    function validateGuid(guid: any): boolean;
}
module Module2 {
    function validateGuid(guid: any): boolean;
}

Houston, we have a problem

Trying to compile a bundle and either I'm doing something wrong or something wrong with dts-bundle. It all gets stuck on the last line with CPU through the roof.

../../dependency/typings/node/node (/Users/ianbytchek/Development/ianbytchek/guild/dependency/typings/node/node.d.ts)
 - declare buffer
 - declare querystring
 - declare events
 - declare http
 - import external events
 - import external net
 - import external stream
 - declare cluster
 - import external child_process
 - import external events
 - declare zlib
 - import external stream
 - declare os

I assume that I don't need anything from the typings that I installed with tsd command, my config looks like this:

{
    baseDir: '../product/js',
    exclude: /typings/,
    externals: false,
    main: '../product/js/guild.d.ts',
    name: 'tst',
    referenceExternals: false,
    verbose: true
}

If I understand it right, externals should not include anything from the baseDir, and referenceExternals should not include /// <reference path="โ€ฆ"/> stuff. Both fail?

// guild.d.ts aka main

/// <reference path="../../dependency/typings/reference.d.ts" />
/// <reference path="../../source/dts/reference.d.ts" />
export { PathConfiguration } from './Configuration/PathConfiguration';
import { GuildConfiguration } from './Configuration/GuildConfiguration';
import { GulpHelp } from 'gulp-help';
export declare function guild(gulp: GulpHelp, configuration: GuildConfiguration): void;

support for absolute imports

currently any absolute imports (resolved relative to the baseDir) - e.g.

import { NestedNavLevel } from 'modules/clean/react/maestro_nav/maestro_nav_src/nested-nav';

are not followed by dts-bundle; instead, they seem to always be ignored - copied to the output as is, with no declare module ... {...} generated in the output for them. AFAICT dts-bundle only understands relative imports (used mainly in commonjs).

I was looking for a config-only workaround to this and discovered that if I use externals: true and try to exclude: /^react$/ I get fairly close to what I want, but it still ends up crashing here: https://github.com/TypeStrong/dts-bundle/blob/master/lib/index.ts#L270

/srv/server/metaserver/build_static/js_tools/node_modules/dts-bundle/lib/index.js:173
                if (isExclude(path.relative(baseDir, p.file), true)) {
                                                      ^
TypeError: Cannot read property 'file' of undefined
    at /srv/server/metaserver/build_static/js_tools/node_modules/dts-bundle/lib/index.js:173:55
    at Array.forEach (native)
    at Object.bundle (/srv/server/metaserver/build_static/js_tools/node_modules/dts-bundle/lib/index.js:166:35)
    at Object.<anonymous> (/srv/server/metaserver/build_static/js_tools/declaration_bundler.js:12:15)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)

A few console.log's later and I've learned that exportMap is empty, but I don't really understand what it is expected to represent. I've attempted to change baseDir to make things work but from reading the code it doesn't seem like it'll help at all. My best guess is that it doesn't understand that these are actually local files - it thinks they are node_modules - and is somehow hoping I've given some instructions as to how to handle them.

At the moment it seems like my best option is to attempt to fork this project (and maybe send a patch?) as I can't tell that any possible configuration values will solve my conundrum. If there's some configuration options I could use to accomplish this that I've missed, please let me know.

CLI breaks on OS X due to CRLF line breaks

The CLI does not work when run on OS X, and probably all Unix-based systems.

> dts-bundle
env: node\r: No such file or directory

This is because dts-bundle.js is using Windows-style CRLF (\r\n) line breaks, confusing bash. It doesn't see the hidden character CR (\r) in #!/usr/bin/env node\r\n, interpreting it as part of the name. This hidden character must be removed for the file to execute successfully.

See npm/npm#4607

Cannot read property 'file' of undefined

I'm having this error:

  TypeError: Cannot read property 'file' of undefined
    at node_modules\dts-bundle\lib\index.js:124:55
    at Array.forEach (native)
    at Object.bundle (node_modules\dts-bundle\lib\index.js:122:35)

this is the verbose output:

> ### settings ###
main:         dist\dts\index.d.ts
name:         tss-angular
out:          D:\SVN TSS\_github\tss-ar\angular\dist\app\index.d.ts
baseDir:      D:\SVN TSS\_github\tss-ar\angular\dist\dts
mainFile:     D:\SVN TSS\_github\tss-ar\angular\dist\dts\index.d.ts
outFile:      D:\SVN TSS\_github\tss-ar\angular\dist\app\index.d.ts
externals:    no
exclude:      null
removeSource: no
comments:     no

> ### find typings ###
source typings (will be included in output if actually used)
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\app.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\components.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\components\feedback\feedback.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\components\sort\sort.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\directives.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\directives\datepickerPopup.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\directives\datetimepicker.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\directives\draggable.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\directives\fileModel.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\directives\focusMe.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\directives\ngEnter.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\directives\preview.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\directives\pxStyle.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\directives\rcDisabled.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\directives\removeHref.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\directives\webcam.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\alertType.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\feedback.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\feedbackType.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\filters\tssHighlight.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\index.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\servicies.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\servicies\alertService.d.ts
 - D:\SVN TSS\_github\tss-ar\angular\dist\dts\servicies\rcDisabled.d.ts
excluded typings (will always be excluded from output)

> ### parse files ###
index (D:\SVN TSS\_github\tss-ar\angular\dist\dts\index.d.ts)
 - import relative ./entities (D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities.d.ts)
 - import relative ./servicies/alertService (D:\SVN TSS\_github\tss-ar\angular\dist\dts\servicies\alertService.d.ts)
entities (D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities.d.ts)
 - import relative ./entities/alertType (D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\alertType.d.ts)
 - import relative ./entities/feedback (D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\feedback.d.ts)
 - import relative ./entities/feedbackType (D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\feedbackType.d.ts)
servicies\alertService (D:\SVN TSS\_github\tss-ar\angular\dist\dts\servicies\alertService.d.ts)
 - import external tss-angular/entities
entities\alertType (D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\alertType.d.ts)
entities\feedback (D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\feedback.d.ts)
 - import relative ./feedbackType (D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\feedbackType.d.ts)
entities\feedbackType (D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\feedbackType.d.ts)

> ### map exports ###

> ### determine typings to include ###
queue
[ { file: 'D:\\SVN TSS\\_github\\tss-ar\\angular\\dist\\dts\\index.d.ts',
    name: 'index',
    indent: '    ',
    exp: 'tss-angular',
    refs: [],
    externalImports: [],
    relativeImports:
     [ 'D:\\SVN TSS\\_github\\tss-ar\\angular\\dist\\dts\\entities.d.ts',
       'D:\\SVN TSS\\_github\\tss-ar\\angular\\dist\\dts\\servicies\\alertService.d.ts' ],
    exports: [],
    lines: [ [Object], [Object] ],
    importLineRef: [ [Object], [Object] ],
    relativeRef: [] } ]
index (D:\SVN TSS\_github\tss-ar\angular\dist\dts\index.d.ts)
 - import relative D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities.d.ts
 - import relative D:\SVN TSS\_github\tss-ar\angular\dist\dts\servicies\alertService.d.ts
entities (D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities.d.ts)
 - import relative D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\alertType.d.ts
 - import relative D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\feedback.d.ts
 - import relative D:\SVN TSS\_github\tss-ar\angular\dist\dts\entities\feedbackType.d.ts
servicies\alertService (D:\SVN TSS\_github\tss-ar\angular\dist\dts\servicies\alertService.d.ts)

CLI ?

Running using npm script would be very convenient

Duplicate Identifiers for Extended Classes

When bundling definitions for two classes (in separate files) that extend one another, the output definition file ends up with duplicate identifiers:

export declare class SomeClass { }
export class SomeClass { }

Can these two be merged automatically?

Cannot read property 'file' of undefined

Getting the following exception, when I'm trying to bundle my precompiled d.ts files:

[19:33:57] TypeError: Cannot read property 'file' of undefined
    at C:\project\node_modules\dts-bundle\lib\index.js:489:42
    at Array.forEach (native)
    at Object.bundle (C:\project\node_modules\dts-bundle\lib\index.js:487:25)
    at Gulp.<anonymous> (C:\project\gulp\build.js:39:9)
    at module.exports (C:\project\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7)
    at Gulp.Orchestrator._runTask (C:\project\node_modules\gulp\node_modules\orchestrator\index.js:273:3)
    at Gulp.Orchestrator._runStep (C:\project\node_modules\gulp\node_modules\orchestrator\index.js:214:10)
    at C:\project\node_modules\gulp\node_modules\orchestrator\index.js:279:18
    at finish (C:\project\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:21:8)
    at C:\project\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:52:4

Not sure if this is relevant, but I've noticed that in map exports express is missing - here the map exports dts-bundle is reporting:

### map exports ###
- buffer -> C:\project\typings\node\node.d.ts
- querystring -> C:\project\typings\node\node.d.ts
- events -> C:\project\typings\node\node.d.ts
- http -> C:\project\typings\node\node.d.ts
- cluster -> C:\project\typings\node\node.d.ts
- zlib -> C:\project\typings\node\node.d.ts
- os -> C:\project\typings\node\node.d.ts
- https -> C:\project\typings\node\node.d.ts
- punycode -> C:\project\typings\node\node.d.ts
- repl -> C:\project\typings\node\node.d.ts
- readline -> C:\project\typings\node\node.d.ts
- vm -> C:\project\typings\node\node.d.ts
- child_process -> C:\project\typings\node\node.d.ts
- url -> C:\project\typings\node\node.d.ts
- dns -> C:\project\typings\node\node.d.ts
- net -> C:\project\typings\node\node.d.ts
- dgram -> C:\project\typings\node\node.d.ts
- fs -> C:\project\typings\node\node.d.ts
- path -> C:\project\typings\node\node.d.ts
- string_decoder -> C:\project\typings\node\node.d.ts
- tls -> C:\project\typings\node\node.d.ts
- crypto -> C:\project\typings\node\node.d.ts
- stream -> C:\project\typings\node\node.d.ts
- util -> C:\project\typings\node\node.d.ts
- assert -> C:\project\typings\node\node.d.ts
- tty -> C:\project\typings\node\node.d.ts
- domain -> C:\project\typings\node\node.d.ts
- mysql -> C:\project\typings\mysql\mysql.d.ts
- bluebird -> C:\project\typings\bluebird\bluebird.d.ts
- chai -> C:\project\typings\chai\chai.d.ts
- chai-http -> C:\project\typings\chai-http\chai-http.d.ts
- mocha -> C:\project\typings\mocha\mocha.d.ts
- morgan -> C:\project\typings\morgan\morgan.d.ts
- body-parser -> C:\project\typings\body-parser\body-parser.d.ts

but I'm using also express, can that be the problem? any more information I can provide you with which would help?

Tests for 0.4.0

Needs to have test for new features.

For example:

  • Relative out using "~" in out parameter
  • referenceExternals parameter

Union Types breaking bundling

Hi, it looks like union types are breaking the bundling process.

original:

export type MyType = "a" | "b" | "c";

export const AnotherType = {

    One: "a" as MyType,

    Two: "b" as MyType,

    Three: "c" as MyType

};

Output (from the top of the file, there is a blank line first):

    One: "a" | "b" | "c";

    Two: "a" | "b" | "c";

    Three: "a" | "b" | "c";
};

I'll try to dig in more and see if I can find the bug, but could someone take a look?

Export as default edge case

Hi!
I have a question/suggestion. Noticed a case that's not working for me.

index.ts:
export { Foo as default } from './foo'

foo.ts:
export class Foo {
}

When using verbose flag i get this:

index
 - export { Foo as default } from 'foo/foo'; was skipped.

In the definition bundle I don't get Foo as default. So there will be a mismatch between runtime and compile time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.