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

What exact characters are allowed in the map #63

Closed
domenic opened this issue Nov 2, 2018 · 2 comments
Closed

What exact characters are allowed in the map #63

domenic opened this issue Nov 2, 2018 · 2 comments

Comments

@domenic
Copy link
Collaborator

domenic commented Nov 2, 2018

Both on the left and right-hand sides?

The only restriction stated in README.md right now is that the right-hand side either starts with ./, ../, or /, or is interpreted as a built-in module.

Do we want to add URL-based constraints? Does percent-decoding happen? Needs an algorithm, either for parsing or validation or both.

domenic added a commit that referenced this issue Nov 5, 2018
So far this includes the type-level schema validation and normalization logic. No domain-level validation is in place yet (i.e. checks on the contents of the strings involved; see #63).
@domenic
Copy link
Collaborator Author

domenic commented Nov 7, 2018

The algorithm so far in #67 normalizes and validates roughly so:

  • No validation of the left-hand side
  • Right hand side branches:
    • If it starts with @std/: new URL(`import:${rhs}`)
    • If it starts with ./, ../, or /: new URL(rhs, baseURL)
    • Try to parse as new URL(rhs) (NB: no base URL)
    • If parsing fails, or the parsed URL's scheme is not a fetch scheme, failure

I am happy with the RHS algorithm. For the LHS, probably we should not allow the empty string? But otherwise, as discussed in some previous issues, I think it should be pretty free-form... I should probably re-read them to make sure there wasn't something I missed though.

@domenic
Copy link
Collaborator Author

domenic commented Nov 9, 2018

Parser is merged, good to go here. The above remains accurate except now empty string specifier keys are disallowed.

@domenic domenic closed this as completed Nov 9, 2018
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

No branches or pull requests

1 participant