jorendorff / js-loaders

Pseudoimplementation of the proposed ES6 module loaders.
54 stars 7 forks source link

RELATIVE MODULE NAMES #4

Closed samth closed 11 years ago

samth commented 11 years ago

P1 ISSUE: RELATIVE MODULE NAMES. Suppose we have a module "a/b/c" loaded from the url "http://example.com/scripts/a/b/c.js", and it does:

import "x" as x, "../y" as y, "/z" as z;

What full module names and urls are generated by the system loader's default normalize/resolve behavior? According to @samth, the default normalize behavior is to return the name unchanged, so the full module names would be "x", "../y", and "/z" respectively. But samth has also said that those aren't valid module names.

https://github.com/jorendorff/js-loaders/blob/master/loaders.js#L1435

samth commented 11 years ago

What full module names and urls are generated by the system loader's default normalize/resolve behavior?

"x" -> "x" "../y" -> "a/y" "/z" -> "z" (although @dherman wonders if we should just not allow the leading "/")

The only question here is at which point in the pipeline this transformation happens. Options:

We will have an answer for this in a couple days.

jorendorff commented 11 years ago

I vote for making the normalize hook do it.

jorendorff commented 11 years ago

This (making the normalize hook do it) is now implemented in the repo, just waiting for explicit agreement from @dherman / @samth to close it.

samth commented 11 years ago

I say close it. On May 10, 2013 3:19 PM, "Jason Orendorff" notifications@github.com wrote: