Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: HasIslands supports nested components #102

Merged
merged 18 commits into from
Mar 1, 2024
Merged

feat: HasIslands supports nested components #102

merged 18 commits into from
Mar 1, 2024

Conversation

bruceharrison1984
Copy link
Contributor

@bruceharrison1984 bruceharrison1984 commented Feb 28, 2024

This makes a change to the Islands scanning code so that it walks the dependency tree. The current implementation only allows for islands to work if they are directly within the Route. This change allows Islands to be anywhere in the hierarchy.

This PR is more of a working session to try and get this sorted out, because the current implementation is extremely limited and negatively impacts the way users can structure their components. The other alternative is to just always ship the client libraries, but that seems to run counter to why Islands was implemented in the first place.

Current shortfalls:

  • Slightly increases transformation time
  • Only scans for tsx files

This works was based on conversations from #46

@bruceharrison1984 bruceharrison1984 marked this pull request as ready for review February 28, 2024 19:02
bruceharrison1984 and others added 6 commits February 28, 2024 13:02
* Remove `precinct.d.ts` to build successfully.
* Don't use `magic-string` to reduce dependencies.
* Fix `precinct` opions.
@yusukebe yusukebe changed the title Support Island components outside of Route files feat: HasIslands supports nested components Feb 29, 2024
@yusukebe
Copy link
Member

yusukebe commented Feb 29, 2024

Hey @bruceharrison1984 !

I have made changes to 7099fba. Anyway, this PR must be completed. What do you think about my change?

@bruceharrison1984
Copy link
Contributor Author

bruceharrison1984 commented Feb 29, 2024

@yusukebe Is this also working with alias imports? That was one issue with what currently exists. I think that by using this.resolve, we should be able to get that working as well.

As an opinion, while I realize removing magic-string to reduce dependencies makes sense, it greatly simplifies a lot of operations that are being done currently. It's use is fairly standard in the vite and rollup plugin space. At the end of the day this is your baby, but I just wanted to make my motivations known.

@yusukebe
Copy link
Member

yusukebe commented Mar 1, 2024

@bruceharrison1984

Is this also working with alias imports?

Yeah. I added tests for alias importing. 8612936. It seems to be working! Can you see this again?

@yusukebe
Copy link
Member

yusukebe commented Mar 1, 2024

After merge this, we have to resolve this matter: #105

@bruceharrison1984
Copy link
Contributor Author

@yusukebe LGTM

Was the only piece I was missing adding the alias to the vite.config.js? I feel like a fool 😄

@yusukebe
Copy link
Member

yusukebe commented Mar 1, 2024

@bruceharrison1984 Thanks!

Land it!

@yusukebe yusukebe merged commit 28bf1b9 into honojs:main Mar 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants