Comments (11)
I have to confirm it but I think '../*' and '. /' aren't externals. If you use relative path then it isn't external, I think this is the rule.
from dts-bundle.
The documentation says on externals
:
include typings outside of the 'baseDir' (i.e. like node.d.ts)
Also forgot to mention, that I've tried using exclude
pattern, which also failed in all variations. And maybe it's worth checking why the typings/node/node
itself fails – it feels there's a recursion.
from dts-bundle.
Yes, however the code is:
// import() statement or es6 import
if ((match = line.match(importExp) || line.match(importEs6Exp))) {
const [_, lead, quote, moduleName, trail] = match;
assert(moduleName);
const impPath = path.resolve(path.dirname(file), moduleName);
// filename (i.e. starts with a dot, slash or windows drive letter)
if (fileExp.test(moduleName)) {
// TODO: some module replacing is handled here, whereas the rest is
// done in the "rewrite global external modules" step. It may be
// more clear to do all of it in that step.
let modLine: ModLine = {
original: lead + quote + getExpName(impPath) + trail
};
res.lines.push(modLine);
const full = path.resolve(path.dirname(file), impPath + '.d.ts');
trace(' - import relative %s (%s)', moduleName, full);
pushUnique(res.relativeImports, full);
res.importLineRef.push(modLine);
}
// identifier
else {
let modLine: ModLine = {
original: line
};
res.lines.push(modLine);
trace(' - import external %s', moduleName);
pushUnique(res.externalImports, moduleName);
if (externals) {
res.importLineRef.push(modLine);
}
}
}
Anyway I will test it.
PS: do you use 0.4.1 version?
from dts-bundle.
Yes, 0.4.1.
from dts-bundle.
I have created a github repository to test dts-bundle with examples from issues.
I have tried to reproduce your env and this is the result: https://github.com/tolemac/dts-test-cases/blob/master/ianbytchek/code-tree/product/js/tst.d.ts
### settings object passed ###
{ baseDir: 'code-tree/product/js',
exclude: /typings/,
externals: false,
main: 'code-tree/product/js/guild.d.ts',
name: 'tst',
referenceExternals: false,
verbose: true }
### settings ###
main: code-tree/product/js/guild.d.ts
name: tst
out: tst.d.ts
baseDir: c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js
mainFile: c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\guild.d.ts
outFile: c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\tst.d.ts
externals: no
exclude: /typings/
removeSource: no
comments: no
emitOnIncludedFileNotFound: no
emitOnNoIncludedFileNotFound: no
### find typings ###
source typings (will be included in output if actually used)
- c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\Configuration\GuildConfiguration.d.ts
- c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\Configuration\PathConfiguration.d.ts
- c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\guild.d.ts
- c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\tst.d.ts
excluded typings (will always be excluded from output)
### parse files ###
guild (c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\guild.d.ts)
- reference external typing ../../dependency/typings/reference.d.ts (c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\dependency\typings\reference.d.ts) (relative: ../../dependency/typings/reference.d.ts)
- reference external typing ../../source/dts/reference.d.ts (c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\source\dts\reference.d.ts) (relative: ../../source/dts/reference.d.ts)
- import relative ./Configuration/PathConfiguration (c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\Configuration\PathConfiguration.d.ts)
- import relative ./Configuration/GuildConfiguration (c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\Configuration\GuildConfiguration.d.ts)
- import external gulp-help
..\..\dependency\typings\reference (c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\dependency\typings\reference.d.ts)
..\..\source\dts\reference (c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\source\dts\reference.d.ts)
Configuration\PathConfiguration (c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\Configuration\PathConfiguration.d.ts)
Configuration\GuildConfiguration (c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\Configuration\GuildConfiguration.d.ts)
### map exports ###
### determine typings to include ###
queue
[ { file: 'c:\\Users\\jros\\Desarrollo\\GitHub\\tolemaC\\dts-test-cases\\ianbytchek\\code-tree\\product\\js\\guild.d.ts',
name: 'guild',
indent: ' ',
exp: 'tst',
refs:
[ 'c:\\Users\\jros\\Desarrollo\\GitHub\\tolemaC\\dts-test-cases\\ianbytchek\\code-tree\\dependency\\typings\\reference.d.ts',
'c:\\Users\\jros\\Desarrollo\\GitHub\\tolemaC\\dts-test-cases\\ianbytchek\\code-tree\\source\\dts\\reference.d.ts' ],
externalImports: [ 'gulp-help' ],
relativeImports:
[ 'c:\\Users\\jros\\Desarrollo\\GitHub\\tolemaC\\dts-test-cases\\ianbytchek\\code-tree\\product\\js\\Configuration\\PathConfiguration.d.ts',
'c:\\Users\\jros\\Desarrollo\\GitHub\\tolemaC\\dts-test-cases\\ianbytchek\\code-tree\\product\\js\\Configuration\\GuildConfiguration.d.ts' ],
exports: [],
lines: [ [Object], [Object], [Object], [Object], [Object] ],
fileExists: true,
importLineRef: [ [Object], [Object] ],
relativeRef: [] } ]
guild (c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\guild.d.ts)
- exclude external gulp-help
- import relative c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\Configuration\PathConfiguration.d.ts
- import relative c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\Configuration\GuildConfiguration.d.ts
Configuration\PathConfiguration (c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\Configuration\PathConfiguration.d.ts)
Configuration\GuildConfiguration (c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\Configuration\GuildConfiguration.d.ts)
### rewrite global external modules ###
guild
- export { PathConfiguration } from 'tst/Configuration/PathConfiguration'; ==> export { PathConfiguration } from 'tst/Configuration/PathConfiguration';
- import { GuildConfiguration } from 'tst/Configuration/GuildConfiguration'; ==> import { GuildConfiguration } from 'tst/Configuration/GuildConfiguration';
Configuration\PathConfiguration
Configuration\GuildConfiguration
### build output ###
## files not found ##
### write output ###
c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\tst.d.ts
### statistics ###
used sourceTypings
- c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\Configuration\GuildConfiguration.d.ts
- c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\Configuration\PathConfiguration.d.ts
- c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\guild.d.ts
unused sourceTypings
- c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\product\js\tst.d.ts
excludedTypings
used external typings
unused external typings
- c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\dependency\typings\reference.d.ts
- c:\Users\jros\Desarrollo\GitHub\tolemaC\dts-test-cases\ianbytchek\code-tree\source\dts\reference.d.ts
external dependencies
- gulp-help
### done ###
from dts-bundle.
I have found your repository (guild), I have download it and I'm testing.
Seems like a infinite loop, ... continue testing ;)
Stay tuned ;)
from dts-bundle.
Seems that there is a problem matching this regular expression /^([ \t]*(?:export|import) ?(?:(?:\* (?:as [^ ,]+)?)|.*)?,? ?(?:[^ ,]+ ?,?)(?:\{(?:[^ ,]+ ?,?)*\})? ?from )(['"])([^ ,]+)(\2;.*)$/
with this text: export function networkInterfaces(): {[index: string]: NetworkInterfaceInfo[]};
regex101.com
says:
Catastrophic backtracking
Catastrophic backtracking has been detected and the execution of your expression has been halted. To find out more what this is, please read the following article: Runaway Regular Expressions.
I recommend you launch the debugger in the menu to the left and analyze the data to find out the cause.
Seems that exists problems running the regular expression ... it's the first time that its occurs me.
In addition, this happens when parse node.d.ts
file, and I think this file don't have to be processed.
dts-bundle
parse all files recursivelly and decide to exclude or include after parse all files. I think it shouldn't parse the exclude files. I work on it, testing and I will make a decision.
from dts-bundle.
Thanks! That's the one I'm trying to convert into a pretty ts npm package 😊
from dts-bundle.
@ianbytchek, if you need to bundle it, you can change the name of 'node.d.ts' in order to 'dts-bundle' doesn't find it. You can see 'files not found' section of the readme file to emit the result when there are files not found.
from dts-bundle.
0.4.3 version solve your problem.
Thanks ;)
from dts-bundle.
from dts-bundle.
Related Issues (20)
- file not found error if both .d.ts file and a folder with the same name exist HOT 8
- removeSource option deletes .d.ts files within node modules HOT 3
- Export as default edge case
- A 'declare' modifier is required for a top level declaration in a .d.ts file. HOT 4
- Unable to reference external typings HOT 2
- Duplicated imports after bundle into single .d.ts file HOT 3
- Reexporting module as named export for module library HOT 4
- bug? declare module 'yargs2/index//yargs' HOT 2
- Bundle includes more than it should when using main
- dts-bundle generates circular dependencies HOT 1
- fs.writeFileSync passes the encoding the wrong way
- tsconfig.json paths HOT 2
- Add support to export as namespace HOT 1
- "already got export for:"
- All d.ts files bug with scoped package
- Interfaces with same name in separate files are combined
- Bundler fails for all declarations if project name contains slash HOT 1
- Declaration for style files
- Relative import error with namespace
- Project seems dead. dts-bundle-generator looks like an alternative.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dts-bundle.