Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

modules wrapping template #4

Closed
yyfrankyy opened this issue May 26, 2011 · 4 comments
Closed

modules wrapping template #4

yyfrankyy opened this issue May 26, 2011 · 4 comments
Assignees

Comments

@yyfrankyy
Copy link
Contributor

模板结构modules/{name}/sea-pkg.js

/**
 * @name frank
 * @desc desc
 * @url http://dafdsa
 *
 * @tags a,b,c,c
 *
 * @src http://ababa
 * @min http://fdsafdsa
 */
define(function(require, exports, module) {
    exports.version = $.jquery;
    'code';
});

输出为

modules/{name}/{version}/{name}-debug.js
modules/{name}/{version}/{name}.js

{version}从exports.version中寻找依赖获得。

其他信息从页头的annotation 处获得

@ghost ghost assigned yyfrankyy May 26, 2011
@lifesinger
Copy link

文河,这个我昨天晚上在你的基础上,针对 jquery 写了一份:

https://github.com/seajs/spm/blob/master/modules/jquery/transport.js

输出有些变化,只需提取依赖信息就好,比如生成的 jquery.js 里:

define([], function])

@yyfrankyy
Copy link
Contributor Author

根据exports.version 然后解析文件获取版本号,不是一般麻烦,先放到annotation里。

因为一旦这些元信息需要在js里提供,那name,author等其他属性也都可以这么做,wrapping部分保持必需的兼容封装代码即可。

@lifesinger
Copy link

可以的, @src @min 里,看了看,好多也是版本依赖的
因此 @Version 手动指定就好了

@yyfrankyy
Copy link
Contributor Author

parser部分功能已经完成,回头需要再继续调整。close

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants