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

support subpath pattern exports #2265

Open
turadg opened this issue May 2, 2024 · 1 comment
Open

support subpath pattern exports #2265

turadg opened this issue May 2, 2024 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers review-queue Queued for review at the next Endo meeting

Comments

@turadg
Copy link
Member

turadg commented May 2, 2024

What is the Problem Being Solved?

Endo's bundler doesn't yet support subpath patterns in the package exports property.

This breaks imports from packages that use it. E.g. in this build

Description of the Design

Support it. :)

Security Considerations

Scaling Considerations

Test Plan

Compatibility Considerations

Upgrade Considerations

@turadg turadg added the enhancement New feature or request label May 2, 2024
turadg added a commit to Agoric/agoric-sdk that referenced this issue May 2, 2024
turadg added a commit to Agoric/agoric-sdk that referenced this issue May 2, 2024
dckc added a commit to Agoric/agoric-sdk that referenced this issue May 2, 2024
dckc added a commit to Agoric/agoric-sdk that referenced this issue May 3, 2024
dckc added a commit to Agoric/agoric-sdk that referenced this issue May 3, 2024
@kriskowal
Copy link
Member

I took a moment to look into this, to gauge how much of a lift it really would be.

A closer read of the docs tells me that the DSL for subpath patterns seems to merely be strings split on '*', with no affordance for escaping asterisks and not the much more sophisticated glob DSL. So, the problem reduces to RegExp.escape. We don’t have RegExp.escape yet and the shim is a little overwrought for our needs. So I grabbed a copy and whittled it down to the essential core and got it to pass all the same tests.

https://gist.github.com/kriskowal/35c435f2d99b57a3f1cd00e2b4c407aa

This largely reduces because we’re able to rely on code point iteration and can safely dispatch methods of intrinsics under Hardened JavaScript.

I think it’d be reasonable to @endo/regexp-escape a ponyfill and just inline the subpath matching in @endo/compartment-mapper.

@kriskowal kriskowal added good first issue Good for newcomers review-queue Queued for review at the next Endo meeting labels Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers review-queue Queued for review at the next Endo meeting
Projects
None yet
Development

No branches or pull requests

2 participants