TypeStrong / dts-bundle

Export TypeScript .d.ts files as an external module definition
MIT License
308 stars 57 forks source link

Infinite loop while processing references #2

Closed poelstra closed 10 years ago

poelstra commented 10 years ago

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.

Bartvds commented 10 years ago

My use-case was very ad-hoc, I'm not sure if this every worked with node.d.ts at all. I probably should add some better test cases.

If you have a clean fix then just send a PR.

poelstra commented 10 years ago

Ok, I'll fix it they way I described above and send you a PR later.

poelstra commented 10 years ago

Fixed by #3.