"module" dependency specification

28 views
Skip to first unread message

Ben Hockey

unread,
Nov 28, 2012, 10:06:12 AM11/28/12
to amd-im...@googlegroups.com
it was brought to my attention (http://bugs.dojotoolkit.org/ticket/16400) that we might have not yet specified what is provided by the "module" dependency (at least i couldn't find it).

as part of the config specification we said that it should have a config function on it but that seems to be as much as we have done as part of the AMD spec.  i think we've probably been using parts of http://wiki.commonjs.org/wiki/Modules/1.1 as a de facto spec for some of the implementations (eg requirejs, curl and dojo all provide module.id, module.uri and module.exports) but given that AMD is quite independent of commonjs we should probably specify whatever it is we all agree on.

i'm not great at wording but i'd suggest that a module should at a minimum have config (as already specified), id, uri and exports as is already implemented in the previously mentioned loaders.  is there agreement and could someone put together some words to that effect?

ben...

James Burke

unread,
Nov 28, 2012, 2:25:29 PM11/28/12
to amd-im...@googlegroups.com
The mention about "module" is in this section:
https://github.com/amdjs/amdjs-api/wiki/AMD#wiki-define-dependencies

but it is very brief, and does not link to the CommonJS spec that
defines the .uri and .id properties, which for "module" is here:
http://wiki.commonjs.org/wiki/Modules/1.1.1#Module_Context

in item #3. That one only mandates .id as required, and .uri is
optional. In addition to those values, module.exports is used to match
Node's use, and then from the Common Config draft:

https://github.com/amdjs/amdjs-api/wiki/Common-Config

if module config is supported, then module.config() should be on the
"module" object.

I can update the AMD API page with this info, expanding that
define-dependencies section to link to the CJS spec part, mention .id
and .uri as should be supported, then mention the node motivation
behind module.exports and then the optional module.config() if that
common config option is supported.

If I do not hear anything by Monday to the contrary, then I will do so
next week.

James

Ben Hockey

unread,
Nov 28, 2012, 3:38:40 PM11/28/12
to amd-im...@googlegroups.com

On Nov 28, 2012, at 1:25 PM, James Burke <jrb...@gmail.com> wrote:

> The mention about "module" is in this section:
> https://github.com/amdjs/amdjs-api/wiki/AMD#wiki-define-dependencies

thank you - i missed it in my haste.

>
> but it is very brief, and does not link to the CommonJS spec that
> defines the .uri and .id properties, which for "module" is here:
> http://wiki.commonjs.org/wiki/Modules/1.1.1#Module_Context
>
> in item #3. That one only mandates .id as required, and .uri is
> optional. In addition to those values, module.exports is used to match
> Node's use, and then from the Common Config draft:
>
> https://github.com/amdjs/amdjs-api/wiki/Common-Config
>
> if module config is supported, then module.config() should be on the
> "module" object.
>
> I can update the AMD API page with this info, expanding that
> define-dependencies section to link to the CJS spec part, mention .id
> and .uri as should be supported, then mention the node motivation
> behind module.exports and then the optional module.config() if that
> common config option is supported.
>
> If I do not hear anything by Monday to the contrary, then I will do so
> next week.

sounds good.

thanks.
Reply all
Reply to author
Forward
0 new messages