index.js
function (file, match, literal) {

        // literal 可能是 'moduleId'、'[ "module1", "module2" ]'、xxx（非法 js 变量）

        literal = literal.trim();

        var resources;

        try {
            var factory = new Function('return ' + literal);
            resources = factory();
        }
        catch (e) {

            console.log('[INFO][amd id parse error]');
            console.log(match);
            console.log('');

            resources = literal;
        }

        if (!resources) {
            return;
        }

        if (!Array.isArray(resources)) {
            resources = [ resources ];
        }

        var me = this;
        var config = me.getAmdConfig(file);

        var result = [ ];

        resources.forEach(function (resourceId) {

            var filePath = resourceIdToFilePath(
                resourceId,
                config
            );

            if (filePath) {
                result.push({
                    amd: true,
                    raw: resourceId,
                    absolute: filePath
                });
            }

        });

        return result;

    }
function (file, match, literal) {

        // literal 可能是 'moduleId'、'[ "module1", "module2" ]'、xxx（非法 js 变量）

        literal = literal.trim();

        var resources;

        try {
            var factory = new Function('return ' + literal);
            resources = factory();
        }
        catch (e) {

            console.log('[INFO][amd id parse error]');
            console.log(match);
            console.log('');

            resources = literal;
        }

        if (!resources) {
            return;
        }

        if (!Array.isArray(resources)) {
            resources = [ resources ];
        }

        var me = this;
        var config = me.getAmdConfig(file);

        var result = [ ];

        resources.forEach(function (resourceId) {

            var filePath = resourceIdToFilePath(
                resourceId,
                config
            );

            if (filePath) {
                result.push({
                    amd: true,
                    raw: resourceId,
                    absolute: filePath
                });
            }

        });

        return result;

    }
解析 amd 依赖

@param {Object} file 文件
@param {string} match 文件中匹配到的原始字符串
@param {string} literal 从 match 中抽离出的符合 id 规则的字面量
@return {Array.<string>}