break-stuff / cem-tools

Tooling for generating features based on the Custom Elements Manifest
MIT License
95 stars 11 forks source link

[expanded-types]: Types from dependencies in node_modules #101

Open r3dDoX opened 5 months ago

r3dDoX commented 5 months ago

I noticed that one union type in my project is not getting expanded as I would've expected. It is a union type from a 3rd party dependency that is installed as a node module. I am importing this type like this: import { Placement } from '@floating-ui/dom';

Then in my lit component I have a property like this: @property() public placement?: Placement;

What ends up in my custom-elements-manifest.json looks like this:

{
  "text": "Placement | undefined"
}

I would have expected this type to be expanded like local union types.

break-stuff commented 5 months ago

This plugin is not currently configured to resolve types outside of the project.

r3dDoX commented 5 months ago

Alright, thanks for the response!

I quickly checked out the code and saw, that getResolvedImportPath is currently using path.resolve which is not able to resolve node_module imports. Other than that, it should probably be possible IMO. Do you know if there is any other issue I didn't see, preventing this? Maybe if I can find time in the coming days I could have a look at it.

break-stuff commented 5 months ago

I believe it was initially added but removed due to performance issues. That was early on and the plugin has changed significantly since then, so it may no longer be an issue.