Giter Site home page Giter Site logo

Comments (11)

tolemac avatar tolemac commented on July 28, 2024

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.

iby avatar iby commented on July 28, 2024

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.

tolemac avatar tolemac commented on July 28, 2024

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.

iby avatar iby commented on July 28, 2024

Yes, 0.4.1.

from dts-bundle.

tolemac avatar tolemac commented on July 28, 2024

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.

tolemac avatar tolemac commented on July 28, 2024

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.

tolemac avatar tolemac commented on July 28, 2024

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.

iby avatar iby commented on July 28, 2024

Thanks! That's the one I'm trying to convert into a pretty ts npm package 😊

from dts-bundle.

tolemac avatar tolemac commented on July 28, 2024

@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.

tolemac avatar tolemac commented on July 28, 2024

0.4.3 version solve your problem.
Thanks ;)

from dts-bundle.

iby avatar iby commented on July 28, 2024

seinfelddance

from dts-bundle.

Related Issues (20)

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.