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: imports #151

Merged
merged 16 commits into from
Dec 11, 2023
Merged

feat: imports #151

merged 16 commits into from
Dec 11, 2023

Conversation

andy-haynes
Copy link
Contributor

@andy-haynes andy-haynes commented Dec 8, 2023

This PR adds support for import statements in BOS Components. The functionality is pretty rigid but provides an accessible way to begin testing import compatibility.

The functionality being added is meant to make transitions from a React application simpler while granting the flexibility to provide direct URL imports for overriding default behavior and testing. Currently esm.sh is the default provider, as it supports dynamic bundling and specification of dependency versions - allowing hooks within the imported package to work within BWE.

Supported syntax:

// imports the current version from esm.sh with bundled Preact
import X from "x";

// imports the specified version from esm.sh with bundled Preact
import X from "[email protected]";

// imports the module at the URL directly
import X from "https://esm.sh/[email protected]?y=1";

This PR does not add the export syntax, which will be a breaking change when enforced.

Copy link

vercel bot commented Dec 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bos-web-engine ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2023 8:41pm

packages/compiler/src/import.ts Dismissed Show resolved Hide resolved
@andy-haynes andy-haynes merged commit 43ce792 into main Dec 11, 2023
4 of 5 checks passed
@andy-haynes andy-haynes deleted the feat/imports branch December 11, 2023 20:42
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.

1 participant