GithubHelp home page GithubHelp logo

Comments (14)

domenic avatar domenic commented on August 18, 2024 2

I don't think that's productive; I'd rather keep the discussion in the issue.

from import-maps.

domenic avatar domenic commented on August 18, 2024 1

I don't think there's a reason to start blocking characters at the spec level, but if you find them confusing I definitely can understand you not wanting to use them in your own package names.

from import-maps.

bmeck avatar bmeck commented on August 18, 2024 1

@domenic I would state that they should be blocked if they do not act like separators do in other specifiers. I'm not convinced of the need for package name map specifiers to not be parsed as base URLs and would seek guidance on why they shouldn't be treated as such otherwise.

from import-maps.

bmeck avatar bmeck commented on August 18, 2024 1

I must be getting confused on terminology, what is the term of a specifier like:

<img src="foo?bar">

from import-maps.

domenic avatar domenic commented on August 18, 2024 1

That is a relative URL-string; it is resolved relative to the document's base URL.

Such strings are prohibited for modules; relative URLs can only appear with a ./, ../, or / prefix.

from import-maps.

domenic avatar domenic commented on August 18, 2024

Hmm, I don't think this is how it should behave. Instead that should expand to look for a package named "moment?tz=utc".

from import-maps.

bmeck avatar bmeck commented on August 18, 2024

@domenic I would disagree given that import.meta.url is propagating the fragments and you can add fragments via import '/node_modules/src/moment.js?tz=utc'. What is being gained by expansion using package name maps treating ? and # not as fragments and propagating them like other specifiers? Why should it behave differently?

from import-maps.

domenic avatar domenic commented on August 18, 2024

Package names are not URLs; they are opaque strings.

If you use a URL, you can use URL features like ? and #. If you use a package name, then you're supplying a package name for lookup in the map, and URL characters don't have a special meaning.

from import-maps.

bmeck avatar bmeck commented on August 18, 2024

It seems from the discussion in the other issue that you can do import 'foo/bar?baz' though? import 'foo/?baz' as well. Specifiers such as foo/?bar, /foo?bar, ./foo?bar, etc. passing these around but not if you exclude the / for package name mapped specifiers seems odd. They might not be URLs but is there a reason to neither reserve the characters nor preserve consistency of being able to use these features?

from import-maps.

domenic avatar domenic commented on August 18, 2024

Right, the portion after the package name is a URL.

I don't think it's consistency to treat certain characters specially in this one case; I think it's rather inconsistent. We're not going to do full URL parsing (e.g. percent decoding and friends), so pulling out a few characters that the URL parser treats specially and then adding our own new semantics (different from the URL parser) on top decreases consistency.

from import-maps.

bmeck avatar bmeck commented on August 18, 2024

@domenic in that case it seems like prohibiting those characters in package names would prevent confusion without adding new semantics. Allowing those characters seems unnecessary and confusing when you can end up with x?x/?x. It seems fine to take that approach as well, but doesn't really get into the fact that you have a main Module that cannot be passed fragments like other module specifiers.

from import-maps.

domenic avatar domenic commented on August 18, 2024

They cannot be parsed as base URLs, since they do not conform to the URL syntax (e.g. there is no protocol or colon).

from import-maps.

bmeck avatar bmeck commented on August 18, 2024

I'll make a PR about banning the characters for now due to both confusion and potential future reservation I guess and we can continue discussion there.

from import-maps.

bmeck avatar bmeck commented on August 18, 2024

it looks like no progress can be made on the issue, moving responsibility of matching to Node instead.

from import-maps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.