angular / dgeni-packages

A collection of dgeni packages for generating documentation from source code.
MIT License
142 stars 106 forks source link

Handle import #251

Closed stofolus closed 6 years ago

stofolus commented 6 years ago

A fix for #250

By looking at https://astexplorer.net/ I think this is the best way to get a good enough name out of all import statements.

This matcher should return the following:

import './file';                     // returns null
import foo from './file';            // returns foo
import { foo } from './file';        // returns foo
import { foo, bar } from './file';   // returns foo
petebacondarwin commented 6 years ago

This seems weird, especially the import { foo, bar } from './file' resulting in foo. I would say that the "name" of the import, if anything, is actually the name of the file being imported.

stofolus commented 6 years ago

So it should be file instead? How should other cases be handled? Here are some examples: ./path/to/file => file? ./path/to/file.js => file?

petebacondarwin commented 6 years ago

Why not just the full string that is provided?

./file => ./file
./path/to/file => ./path/to/file
./path/to/file.js => ./path/to/file.js
stofolus commented 6 years ago

I've changed it to return the full path now

stofolus commented 6 years ago

Done!

petebacondarwin commented 6 years ago

Thanks!