Module naming and declarations

Sam Tobin-Hochstadt samth at ccs.neu.edu
Tue May 7 14:00:22 PDT 2013


On Tue, May 7, 2013 at 4:54 PM, Anne van Kesteren <annevk at annevk.nl> wrote:
> On Tue, May 7, 2013 at 1:47 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>> On Tue, May 7, 2013 at 4:33 PM, Anne van Kesteren <annevk at annevk.nl> wrote:
>>> "Adding"? What's the actual processing model for the default loader
>>> here? I thought it was:
>>>
>>>  1. Append ".js" to module name.
>>>  2. Use the URL parser to parse module name relative to base URL.
>>>  3. Fetch result of that operation.
>>
>> The actual processing model is:
>>
>> 1. Produce a string that is, roughly, System.baseURL + moduleName + ".js".
>> 2. Pass that to the fetch hook (which by default fetches that URL).
>
> Could you be more specific? That seems broken. E.g. often a document's
> base URL will be something like "http://example.org/file.html".

Sorry, this was overly quick of me. The correct steps are:

0. If we have an absolute URL, skip steps 1-3.
1. Split the module name on "/", url-encode, and rejoin.
2. Append ".js" to module name.
3. Use the URL parser with the base URL to produce an absolute URL.
4. Pass the absolute URL to the fetch hook.

Sam


More information about the es-discuss mailing list