UNPKG

1.22 kBJavaScriptView Raw
1import _asyncToGenerator from '@babel/runtime/helpers/esm/asyncToGenerator';
2import _regeneratorRuntime from '@babel/runtime/regenerator';
3import { cache } from '@emotion/css';
4import createEmotionServer from '@emotion/server/create-instance';
5
6var renderStatic = /*#__PURE__*/function () {
7 var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(html) {
8 var _createEmotionServer, extractCritical;
9
10 return _regeneratorRuntime.wrap(function _callee$(_context) {
11 while (1) {
12 switch (_context.prev = _context.next) {
13 case 0:
14 if (!(html === undefined)) {
15 _context.next = 2;
16 break;
17 }
18
19 throw new Error('did you forget to return html from renderToString?');
20
21 case 2:
22 _createEmotionServer = createEmotionServer(cache), extractCritical = _createEmotionServer.extractCritical;
23 return _context.abrupt("return", extractCritical(html));
24
25 case 4:
26 case "end":
27 return _context.stop();
28 }
29 }
30 }, _callee);
31 }));
32
33 return function renderStatic(_x) {
34 return _ref.apply(this, arguments);
35 };
36}();
37
38export { renderStatic };