@leafage/server
Version:
The React Server Side Render Framework
88 lines (85 loc) • 3.01 kB
JavaScript
/**
* @leafage/server v1.3.2
*
* Copyright (c) Leafage.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
import { asyncToGenerator as _asyncToGenerator, regenerator as _regenerator } from '../_virtual/_rollupPluginBabelHelpers.js';
import { utils, imports } from '@leafage/toolkit';
var serverPreset = /*#__PURE__*/function () {
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(ctx) {
var importServer;
return _regenerator().w(function (_context3) {
while (1) switch (_context3.n) {
case 0:
importServer = /*#__PURE__*/function () {
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
var _yield$imports$import, Component;
return _regenerator().w(function (_context) {
while (1) switch (_context.p = _context.n) {
case 0:
_context.p = 0;
_context.n = 1;
return imports.importServerModule('server', ctx.options);
case 1:
_yield$imports$import = _context.v;
Component = _yield$imports$import.Component;
utils.applyPresets(ctx, [Component]);
_context.n = 3;
break;
case 2:
_context.p = 2;
_context.v;
case 3:
return _context.a(2);
}
}, _callee, null, [[0, 2]]);
}));
return function importServer() {
return _ref2.apply(this, arguments);
};
}();
if (!ctx.isDev) {
_context3.n = 1;
break;
}
ctx.context.hook('bundle:compiled', /*#__PURE__*/function () {
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref3) {
var name;
return _regenerator().w(function (_context2) {
while (1) switch (_context2.n) {
case 0:
name = _ref3.name;
if (!(name === 'server')) {
_context2.n = 1;
break;
}
_context2.n = 1;
return importServer();
case 1:
return _context2.a(2);
}
}, _callee2);
}));
return function (_x2) {
return _ref4.apply(this, arguments);
};
}());
return _context3.a(2);
case 1:
_context3.n = 2;
return importServer();
case 2:
return _context3.a(2);
}
}, _callee3);
}));
return function serverPreset(_x) {
return _ref.apply(this, arguments);
};
}();
export { serverPreset };