1 | 'use strict';
|
2 |
|
3 | function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
|
4 |
|
5 | require('v8-compile-cache');
|
6 | const Pipeline = require('./Pipeline');
|
7 |
|
8 | let pipeline;
|
9 |
|
10 | exports.init = function (options, callback) {
|
11 | pipeline = new Pipeline(options || {});
|
12 | Object.assign(process.env, options.env || {});
|
13 | process.env.HMR_PORT = options.hmrPort;
|
14 | process.env.HMR_HOSTNAME = options.hmrHostname;
|
15 | callback();
|
16 | };
|
17 |
|
18 | exports.run = (() => {
|
19 | var _ref = _asyncToGenerator(function* (path, pkg, options, isWarmUp, callback) {
|
20 | try {
|
21 | options.isWarmUp = isWarmUp;
|
22 | var result = yield pipeline.process(path, pkg, options);
|
23 |
|
24 | callback(null, result);
|
25 | } catch (err) {
|
26 | let returned = err;
|
27 | returned.fileName = path;
|
28 | callback(returned);
|
29 | }
|
30 | });
|
31 |
|
32 | return function (_x, _x2, _x3, _x4, _x5) {
|
33 | return _ref.apply(this, arguments);
|
34 | };
|
35 | })();
|
36 |
|
37 | process.on('unhandledRejection', function (err) {
|
38 |
|
39 | if (err.code !== 'ERR_IPC_CHANNEL_CLOSED') {
|
40 | console.error('Unhandled promise rejection:', err.stack);
|
41 | }
|
42 | }); |
\ | No newline at end of file |