Description
Hi,
Currently the ability to define LibrariesOptions
is static, you can define inlinedLibraries
, importedLibraries
and allowedTypesLibraries
as static array of strings,
If I want all libraries under an organization (namespace) to be inlined, I would need to maintain a huge list of possible libraries (I can see that if inlinedLibraries
is not provided it is defaulted to []
), so by default none are inlined
I was thinking about allowing each of these to be a string array (as today) or a method, and if it is a method the logic of isLibraryAllowed
would check if the type is a function and if so would invoke the callback with the name of the library in question allowing the user to implement custom logic.
Obviously I can hack it around by using:
const inlinedLibraries = [];
inlinedLibraries.indexOf = (library) => library.startsWith('@namespace') ? 1 : -1;
But this is obviously not recommended :)
This would only work in javascript-based configuration and not in the command line,
We can also consider a regex instead of string equality but I believe allowing the user to implement their logic as code is better.
What do you think? if you are fine with such an approach I don't mind creating the PR for it