Really glad to see progress happening on the transport standard. One piece I see missing here is any accommodation for packages.
The problem is that when packages come into play you may actually have the same moduleId appear in multiple packages at once. You could also potentially load multiple versions of the same package. Hence, simply defining modules based on their moduleId alone is insufficient.
I think we need to address this somehow in the Transport API in a way that can optionally implemented.
For reference, I did implement a solution for this in the Tiki loader (http://github.com/sproutit/tiki). In tiki moduleIds can optionally also include the packageId, separated by a colon. For example, the "html" module from the "markdown" package would be registered like this:
require.def('markdown:html', { ... })
I also support an additional API to register information about a package itself including dependent scripts, etc. so the first time you try to require a module from the package, tiki can know where to go load the asset.
-Charles
> require.def('markdown:html', { ... })
Why not just require.def('markdown/html', {....})? The package name
can be a top level namespace separator.
James
--
You received this message because you are subscribed to the Google Groups "CommonJS" group.
To post to this group, send email to comm...@googlegroups.com.
To unsubscribe from this group, send email to commonjs+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/commonjs?hl=en.
-C
We'll get in trouble with module name spaces that are extended to
accept arbitrary URL's, since colon indicates a URL schema. I
wouldn't want to preclude this.
Charles, I agree we need an extension for packages, but CommonJS
hasn't even agreed on a coupling for packaging and require, so I think
this is premature. I think there are ample options for this in a
future revision. Can we table this until we have as much as we've
argued about so far locked down?
Kris Kowal
I have been meaning to bring up the packages issue with the transport
proposal. Without having considered it in more detail I like:
<packageID>:<moduleID>
as suggested.
Christoph