1 Star 0 Fork 0

animalcoder/Vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.js 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
animalcoder 提交于 2020-03-17 14:52 +08:00 . Vueinit
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.warmup = exports.pitch = undefined;
var _loaderUtils = require('loader-utils');
var _loaderUtils2 = _interopRequireDefault(_loaderUtils);
var _workerPools = require('./workerPools');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function pitch() {
const options = _loaderUtils2.default.getOptions(this) || {};
const workerPool = (0, _workerPools.getPool)(options);
if (!workerPool.isAbleToRun()) {
return;
}
const callback = this.async();
workerPool.run({
loaders: this.loaders.slice(this.loaderIndex + 1).map(l => {
return {
loader: l.path,
options: l.options,
ident: l.ident
};
}),
resource: this.resourcePath + (this.resourceQuery || ''),
sourceMap: this.sourceMap,
emitError: this.emitError,
emitWarning: this.emitWarning,
resolve: this.resolve,
target: this.target,
minimize: this.minimize,
resourceQuery: this.resourceQuery,
optionsContext: this.rootContext || this.options.context
}, (err, r) => {
if (r) {
r.fileDependencies.forEach(d => this.addDependency(d));
r.contextDependencies.forEach(d => this.addContextDependency(d));
}
if (err) {
callback(err);
return;
}
callback(null, ...r.result);
});
}
function warmup(options, requires) {
const workerPool = (0, _workerPools.getPool)(options);
workerPool.warmup(requires);
}
exports.pitch = pitch;
exports.warmup = warmup; // eslint-disable-line import/prefer-default-export
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/animalcoder/Vue.git
git@gitee.com:animalcoder/Vue.git
animalcoder
Vue
Vue
master

搜索帮助