Comments (14)
I don't think that's productive; I'd rather keep the discussion in the issue.
from import-maps.
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.
@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.
I must be getting confused on terminology, what is the term of a specifier like:
<img src="foo?bar">
from import-maps.
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.
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.
@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.
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.
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.
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.
@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.
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.
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.
it looks like no progress can be made on the issue, moving responsibility of matching to Node instead.
from import-maps.
Related Issues (20)
- Modulepreload error caching HOT 9
- Should HTMLScriptElement.supports("importmap") return true? HOT 1
- Fire a load event or an error event when the script element of the import map is from an external file? HOT 2
- preparation-time document check should be done first at #register-an-import-map HOT 2
- Throwing TypeError in resolve a module specifier? HOT 2
- calling onerror of the script element if the import map string cannot be parsed HOT 1
- What should 'parse an import map string' return when it throws an Error? HOT 8
- Speculatively parsing with import map if there's a dynmic import before, HOT 4
- Official file extension? HOT 2
- Support stars in imports besides trailing slashes HOT 1
- `importmap` cannot resolve dependencies entered relatively. HOT 3
- [feat] `script.integrity` and import map HOT 2
- Specification is not restricting address from containing query- or fragment parts not ending with "/" HOT 3
- global variables (f.e. map `"jquery"` specifier to `globalThis.jquery` variable) HOT 1
- Specify package.json path in <script>, and then generate the import map from package.json. HOT 7
- Unable to create folder alias to use in further alias. HOT 2
- ability to specify a default extension for extensionless URLs HOT 3
- Fallbacks for failed URLs? HOT 1
- import maps for `import()` statements HOT 1
- Support for "package.json browser" style file replacement/removal within modules? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from import-maps.