Skip to content

Commit

Permalink
解决 fis.plugin 配置项覆盖问题
Browse files Browse the repository at this point in the history
  • Loading branch information
2betop committed Apr 18, 2016
1 parent 8a2d403 commit 49850cf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ function pipe(file, type, keep) {
delete settings.__name;
delete settings.__plugin;
delete settings.__pos;
delete settings.__isPlugin;

callback(processor, settings, key);
} else {
Expand Down
4 changes: 4 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@ var Config = Object.derive(/** @lends fis.config.Config.prototype */{
var properties = match.properties;

if (typeof pattern === 'string') {

// 去掉空格
pattern = pattern.replace(/\s+/g, '');

if (pattern[0] === '!') {
negate = true;
pattern = pattern.substring(1);
Expand Down
3 changes: 2 additions & 1 deletion lib/fis.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ fis.plugin = function(key, options, position) {
options = options || {};
options.__name = options.__plugin = key;
options.__pos = position;
options.__isPlugin = true;
return options;
};

Expand Down Expand Up @@ -345,7 +346,7 @@ fis.require = function() {
}
}
} catch (e) {
fis.log.error('load plugin [%s] config error : %s.', pluginName, e.message);
fis.log.error('load plugin [%s] config error : %s.', pluginName, e.stack);
}
}

Expand Down
10 changes: 8 additions & 2 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,13 @@ _.applyMatches = function(path, matches, allowed) {
k = k === '&' ? 0 : k;
return m[k] || '';
});
} else if (typeof(value) === 'function' && ~['release', 'url', 'relative'].indexOf(key)) {
} else if (typeof(value) === 'function' &&
~[
'release',
'url',
'relative',
'moduleId'
].indexOf(key)) {
value = value.call(null, m, path);
}

Expand All @@ -1531,7 +1537,7 @@ _.applyMatches = function(path, matches, allowed) {
pos = pos === 'prepend' ? 0 : (pos === 'append' ? obj[key].length : (parseInt(pos) || 0));
obj[key].splice(pos, 0, value);
}
} else if (_.isPlainObject(value) && _.isPlainObject(obj[key])) {
} else if (_.isPlainObject(value) && _.isPlainObject(obj[key]) && !value.__isPlugin && !obj[key].__isPlugin) {
fis.util.assign(obj[key], value);
} else {
obj[key] = value;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fis3",
"version": "3.3.26",
"version": "3.3.27",
"description": "fis 3.0",
"main": "index.js",
"bin": {
Expand Down

0 comments on commit 49850cf

Please sign in to comment.