1 Star 0 Fork 0

animalcoder/Vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Use.js 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
animalcoder 提交于 2020-03-23 09:59 +08:00 . Vue6
const merge = require('deepmerge');
const ChainedMap = require('./ChainedMap');
const Orderable = require('./Orderable');
module.exports = Orderable(
class extends ChainedMap {
constructor(parent, name) {
super(parent);
this.name = name;
this.extend(['loader', 'options']);
}
tap(f) {
this.options(f(this.get('options')));
return this;
}
merge(obj, omit = []) {
if (!omit.includes('loader') && 'loader' in obj) {
this.loader(obj.loader);
}
if (!omit.includes('options') && 'options' in obj) {
this.options(merge(this.store.get('options') || {}, obj.options));
}
return super.merge(obj, [...omit, 'loader', 'options']);
}
toConfig() {
const config = this.clean(this.entries() || {});
Object.defineProperties(config, {
__useName: { value: this.name },
__ruleNames: { value: this.parent && this.parent.names },
__ruleTypes: { value: this.parent && this.parent.ruleTypes },
});
return config;
}
},
);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/animalcoder/Vue.git
git@gitee.com:animalcoder/Vue.git
animalcoder
Vue
Vue
master

搜索帮助