Fixup issues around generating module identifiers.
Previously a number of issues existed:
We only replaced / and -, but allowed through any other char. This resulted in invalid JS when files include . or # (which are commonly used by emacs/vim as swap files or lock files).
We would happily allow two module paths to generate the same identifier, only to later get a syntax error during Rollup due to the fact that { a: 'blah', a: 'blah' } is an error.
This fixes those two issues by:
Tracking the module identifiers that we have already seen, and ensuring that a unique one is generated each time.
Replace all non-word characters with _ (instead of only - and /).
Prevent duplicate specifiers from being generated.
Throw a helpful error when the same specifier is generated for two different modules.
Fixup issues around generating module identifiers.
Previously a number of issues existed:
/
and-
, but allowed through any other char. This resulted in invalid JS when files include.
or#
(which are commonly used by emacs/vim as swap files or lock files).{ a: 'blah', a: 'blah' }
is an error.This fixes those two issues by:
_
(instead of only-
and/
).Prevent duplicate specifiers from being generated.
Throw a helpful error when the same specifier is generated for two different modules.
Fixes https://github.com/glimmerjs/resolution-map-builder/issues/17