1 | import _asyncToGenerator from '@babel/runtime/helpers/esm/asyncToGenerator';
|
2 | import _regeneratorRuntime from '@babel/runtime/regenerator';
|
3 | import { cache } from '@emotion/css';
|
4 | import createEmotionServer from '@emotion/server/create-instance';
|
5 |
|
6 | var renderStatic = function () {
|
7 | var _ref = _asyncToGenerator( _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 |
|
38 | export { renderStatic };
|