>
>
>On Tuesday, May 27, 2014 8:51 PM, Ian Hickson <[email protected]> wrote:
>
>
>Is there a description of what the non-ES spec should say? That is, what 
>is the interface that System exposes that needs to be "implemented" by 
>this non-ES spec? What are the spec hooks that this non-ES spec would need 
>to invoke?
The W3C System would have to provide the following hooks in a way that matches 
what the web platform is supposed to do:
        * normalize hook: take a module ID string (like from import 'some-id' 
and normalize it to a unique ID through out the system
        * locate hook: based on the module ID, locate the asset to be fetched 
somehow (find its URL)
        * fetch hook: make the necessary network request
        * translate hook: probably not something the web platform will care 
about for now since its intended to translate other languages into EcmaScript
        * instantiate hook: if the fetched source is an ES6 module, then 
everything is covered. But if it's any other asset or a dynamic module (read 
AMD or similar) the instantiate hook is in charge of creating the necessary 
Module instance. For example, it would deal with things like importing CSS 
files by returning an empty module.
Ah so the ES6 "import" statement can import anything, even things that 
>aren't ES6 modules?
>
>
>It would certainly be cool if that was possible.
It could. You can avoid importing anything into the ES scope by doing `import 
"foo"`without specifying what exactly you would be importing. Based on that, 
you could implement the previous hooks so that the fetch hook knows how to 
fetch assets other than scripts and the instantiate hook knows how to insert 
the asset into the page.

> I believe that such an extension of the ES6 Loader has a chance to 
>> provide value to the community. I guess it won't solve all problems ;-)
>
>
>Would this be a replacement to the aforementioned "System"?
It would probably be an extension to System or any other ES Loader instance. 
See https://github.com/systemjs/systemjs for an example.

  
Given all this and the previously mentioned <module> tag, <script needs=""> 
probably doesn't make much sense, does it?


Juan Dopazo
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to