@modern-js/prod-server 2.6.1-alpha.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +2 -2
  3. package/dist/cjs/libs/context/context.js +8 -9
  4. package/dist/cjs/libs/serveFile.js +3 -4
  5. package/dist/cjs/server/modernServer.js +25 -15
  6. package/dist/cjs/utils.js +4 -13
  7. package/dist/esm/libs/context/context.js +11 -12
  8. package/dist/esm/libs/serveFile.js +4 -5
  9. package/dist/esm/server/modernServer.js +50 -28
  10. package/dist/esm/utils.js +4 -8
  11. package/dist/esm-node/libs/context/context.js +8 -9
  12. package/dist/esm-node/libs/serveFile.js +3 -4
  13. package/dist/esm-node/server/modernServer.js +32 -16
  14. package/dist/esm-node/utils.js +4 -12
  15. package/dist/types/libs/context/context.d.ts +2 -4
  16. package/dist/types/libs/serveFile.d.ts +1 -2
  17. package/dist/types/server/modernServer.d.ts +1 -1
  18. package/dist/types/utils.d.ts +2 -3
  19. package/package.json +11 -11
  20. package/dist/js/modern/constants.js +0 -35
  21. package/dist/js/modern/index.js +0 -18
  22. package/dist/js/modern/libs/context/context.js +0 -160
  23. package/dist/js/modern/libs/context/index.js +0 -6
  24. package/dist/js/modern/libs/hook-api/index.js +0 -134
  25. package/dist/js/modern/libs/hook-api/route.js +0 -20
  26. package/dist/js/modern/libs/hook-api/template.js +0 -73
  27. package/dist/js/modern/libs/loadConfig.js +0 -62
  28. package/dist/js/modern/libs/logger.js +0 -111
  29. package/dist/js/modern/libs/metrics.js +0 -11
  30. package/dist/js/modern/libs/proxy.js +0 -92
  31. package/dist/js/modern/libs/render/cache/__tests__/cache.fun.test.js +0 -114
  32. package/dist/js/modern/libs/render/cache/__tests__/cache.test.js +0 -254
  33. package/dist/js/modern/libs/render/cache/__tests__/cacheable.js +0 -47
  34. package/dist/js/modern/libs/render/cache/__tests__/error-configuration.js +0 -37
  35. package/dist/js/modern/libs/render/cache/__tests__/matched-cache.js +0 -91
  36. package/dist/js/modern/libs/render/cache/index.js +0 -115
  37. package/dist/js/modern/libs/render/cache/page-caches/index.js +0 -32
  38. package/dist/js/modern/libs/render/cache/page-caches/lru.js +0 -29
  39. package/dist/js/modern/libs/render/cache/spr.js +0 -248
  40. package/dist/js/modern/libs/render/cache/type.js +0 -0
  41. package/dist/js/modern/libs/render/cache/util.js +0 -102
  42. package/dist/js/modern/libs/render/index.js +0 -86
  43. package/dist/js/modern/libs/render/measure.js +0 -68
  44. package/dist/js/modern/libs/render/reader.js +0 -107
  45. package/dist/js/modern/libs/render/ssr.js +0 -100
  46. package/dist/js/modern/libs/render/static.js +0 -60
  47. package/dist/js/modern/libs/render/type.js +0 -9
  48. package/dist/js/modern/libs/route/index.js +0 -54
  49. package/dist/js/modern/libs/route/matcher.js +0 -87
  50. package/dist/js/modern/libs/route/route.js +0 -16
  51. package/dist/js/modern/libs/serve-file.js +0 -67
  52. package/dist/js/modern/server/index.js +0 -208
  53. package/dist/js/modern/server/modern-server-split.js +0 -74
  54. package/dist/js/modern/server/modern-server.js +0 -554
  55. package/dist/js/modern/type.js +0 -0
  56. package/dist/js/modern/utils.js +0 -136
  57. package/dist/js/modern/worker-server.js +0 -89
  58. package/dist/js/node/constants.js +0 -62
  59. package/dist/js/node/index.js +0 -44
  60. package/dist/js/node/libs/context/context.js +0 -189
  61. package/dist/js/node/libs/context/index.js +0 -30
  62. package/dist/js/node/libs/hook-api/index.js +0 -164
  63. package/dist/js/node/libs/hook-api/route.js +0 -43
  64. package/dist/js/node/libs/hook-api/template.js +0 -97
  65. package/dist/js/node/libs/loadConfig.js +0 -91
  66. package/dist/js/node/libs/logger.js +0 -133
  67. package/dist/js/node/libs/metrics.js +0 -34
  68. package/dist/js/node/libs/proxy.js +0 -114
  69. package/dist/js/node/libs/render/cache/__tests__/cache.fun.test.js +0 -115
  70. package/dist/js/node/libs/render/cache/__tests__/cache.test.js +0 -245
  71. package/dist/js/node/libs/render/cache/__tests__/cacheable.js +0 -70
  72. package/dist/js/node/libs/render/cache/__tests__/error-configuration.js +0 -60
  73. package/dist/js/node/libs/render/cache/__tests__/matched-cache.js +0 -114
  74. package/dist/js/node/libs/render/cache/index.js +0 -134
  75. package/dist/js/node/libs/render/cache/page-caches/index.js +0 -55
  76. package/dist/js/node/libs/render/cache/page-caches/lru.js +0 -58
  77. package/dist/js/node/libs/render/cache/spr.js +0 -270
  78. package/dist/js/node/libs/render/cache/type.js +0 -15
  79. package/dist/js/node/libs/render/cache/util.js +0 -138
  80. package/dist/js/node/libs/render/index.js +0 -115
  81. package/dist/js/node/libs/render/measure.js +0 -90
  82. package/dist/js/node/libs/render/reader.js +0 -140
  83. package/dist/js/node/libs/render/ssr.js +0 -123
  84. package/dist/js/node/libs/render/static.js +0 -89
  85. package/dist/js/node/libs/render/type.js +0 -32
  86. package/dist/js/node/libs/route/index.js +0 -78
  87. package/dist/js/node/libs/route/matcher.js +0 -106
  88. package/dist/js/node/libs/route/route.js +0 -39
  89. package/dist/js/node/libs/serve-file.js +0 -97
  90. package/dist/js/node/server/index.js +0 -219
  91. package/dist/js/node/server/modern-server-split.js +0 -97
  92. package/dist/js/node/server/modern-server.js +0 -559
  93. package/dist/js/node/type.js +0 -15
  94. package/dist/js/node/utils.js +0 -166
  95. package/dist/js/node/worker-server.js +0 -113
  96. package/dist/js/treeshaking/constants.js +0 -29
  97. package/dist/js/treeshaking/index.js +0 -13
  98. package/dist/js/treeshaking/libs/context/context.js +0 -274
  99. package/dist/js/treeshaking/libs/context/index.js +0 -5
  100. package/dist/js/treeshaking/libs/hook-api/index.js +0 -281
  101. package/dist/js/treeshaking/libs/hook-api/route.js +0 -68
  102. package/dist/js/treeshaking/libs/hook-api/template.js +0 -127
  103. package/dist/js/treeshaking/libs/loadConfig.js +0 -82
  104. package/dist/js/treeshaking/libs/logger.js +0 -205
  105. package/dist/js/treeshaking/libs/metrics.js +0 -6
  106. package/dist/js/treeshaking/libs/proxy.js +0 -244
  107. package/dist/js/treeshaking/libs/render/cache/__tests__/cache.fun.test.js +0 -291
  108. package/dist/js/treeshaking/libs/render/cache/__tests__/cache.test.js +0 -781
  109. package/dist/js/treeshaking/libs/render/cache/__tests__/cacheable.js +0 -67
  110. package/dist/js/treeshaking/libs/render/cache/__tests__/error-configuration.js +0 -45
  111. package/dist/js/treeshaking/libs/render/cache/__tests__/matched-cache.js +0 -147
  112. package/dist/js/treeshaking/libs/render/cache/index.js +0 -346
  113. package/dist/js/treeshaking/libs/render/cache/page-caches/index.js +0 -154
  114. package/dist/js/treeshaking/libs/render/cache/page-caches/lru.js +0 -84
  115. package/dist/js/treeshaking/libs/render/cache/spr.js +0 -492
  116. package/dist/js/treeshaking/libs/render/cache/type.js +0 -1
  117. package/dist/js/treeshaking/libs/render/cache/util.js +0 -280
  118. package/dist/js/treeshaking/libs/render/index.js +0 -234
  119. package/dist/js/treeshaking/libs/render/measure.js +0 -146
  120. package/dist/js/treeshaking/libs/render/reader.js +0 -339
  121. package/dist/js/treeshaking/libs/render/ssr.js +0 -223
  122. package/dist/js/treeshaking/libs/render/static.js +0 -216
  123. package/dist/js/treeshaking/libs/render/type.js +0 -7
  124. package/dist/js/treeshaking/libs/route/index.js +0 -130
  125. package/dist/js/treeshaking/libs/route/matcher.js +0 -143
  126. package/dist/js/treeshaking/libs/route/route.js +0 -40
  127. package/dist/js/treeshaking/libs/serve-file.js +0 -184
  128. package/dist/js/treeshaking/server/index.js +0 -505
  129. package/dist/js/treeshaking/server/modern-server-split.js +0 -360
  130. package/dist/js/treeshaking/server/modern-server.js +0 -1089
  131. package/dist/js/treeshaking/type.js +0 -1
  132. package/dist/js/treeshaking/utils.js +0 -147
  133. package/dist/js/treeshaking/worker-server.js +0 -233
@@ -1,339 +0,0 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
- try {
3
- var info = gen[key](arg);
4
- var value = info.value;
5
- } catch (error) {
6
- reject(error);
7
- return;
8
- }
9
- if (info.done) {
10
- resolve(value);
11
- } else {
12
- Promise.resolve(value).then(_next, _throw);
13
- }
14
- }
15
- function _asyncToGenerator(fn) {
16
- return function() {
17
- var self = this, args = arguments;
18
- return new Promise(function(resolve, reject) {
19
- var gen = fn.apply(self, args);
20
- function _next(value) {
21
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
- }
23
- function _throw(err) {
24
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
- }
26
- _next(undefined);
27
- });
28
- };
29
- }
30
- function _classCallCheck(instance, Constructor) {
31
- if (!(instance instanceof Constructor)) {
32
- throw new TypeError("Cannot call a class as a function");
33
- }
34
- }
35
- function _defineProperties(target, props) {
36
- for(var i = 0; i < props.length; i++){
37
- var descriptor = props[i];
38
- descriptor.enumerable = descriptor.enumerable || false;
39
- descriptor.configurable = true;
40
- if ("value" in descriptor) descriptor.writable = true;
41
- Object.defineProperty(target, descriptor.key, descriptor);
42
- }
43
- }
44
- function _createClass(Constructor, protoProps, staticProps) {
45
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
46
- if (staticProps) _defineProperties(Constructor, staticProps);
47
- return Constructor;
48
- }
49
- function _defineProperty(obj, key, value) {
50
- if (key in obj) {
51
- Object.defineProperty(obj, key, {
52
- value: value,
53
- enumerable: true,
54
- configurable: true,
55
- writable: true
56
- });
57
- } else {
58
- obj[key] = value;
59
- }
60
- return obj;
61
- }
62
- var __generator = this && this.__generator || function(thisArg, body) {
63
- var f, y, t, g, _ = {
64
- label: 0,
65
- sent: function() {
66
- if (t[0] & 1) throw t[1];
67
- return t[1];
68
- },
69
- trys: [],
70
- ops: []
71
- };
72
- return(g = {
73
- next: verb(0),
74
- "throw": verb(1),
75
- "return": verb(2)
76
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
77
- return this;
78
- }), g);
79
- function verb(n) {
80
- return function(v) {
81
- return step([
82
- n,
83
- v
84
- ]);
85
- };
86
- }
87
- function step(op) {
88
- if (f) throw new TypeError("Generator is already executing.");
89
- while(_)try {
90
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
91
- if (y = 0, t) op = [
92
- op[0] & 2,
93
- t.value
94
- ];
95
- switch(op[0]){
96
- case 0:
97
- case 1:
98
- t = op;
99
- break;
100
- case 4:
101
- _.label++;
102
- return {
103
- value: op[1],
104
- done: false
105
- };
106
- case 5:
107
- _.label++;
108
- y = op[1];
109
- op = [
110
- 0
111
- ];
112
- continue;
113
- case 7:
114
- op = _.ops.pop();
115
- _.trys.pop();
116
- continue;
117
- default:
118
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
119
- _ = 0;
120
- continue;
121
- }
122
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
123
- _.label = op[1];
124
- break;
125
- }
126
- if (op[0] === 6 && _.label < t[1]) {
127
- _.label = t[1];
128
- t = op;
129
- break;
130
- }
131
- if (t && _.label < t[2]) {
132
- _.label = t[2];
133
- _.ops.push(op);
134
- break;
135
- }
136
- if (t[2]) _.ops.pop();
137
- _.trys.pop();
138
- continue;
139
- }
140
- op = body.call(thisArg, _);
141
- } catch (e) {
142
- op = [
143
- 6,
144
- e
145
- ];
146
- y = 0;
147
- } finally{
148
- f = t = 0;
149
- }
150
- if (op[0] & 5) throw op[1];
151
- return {
152
- value: op[0] ? op[1] : void 0,
153
- done: true
154
- };
155
- }
156
- };
157
- import { fs } from "@modern-js/utils";
158
- import LRU from "lru-cache";
159
- var Byte = 1;
160
- var KB = 1024 * Byte;
161
- var MB = 1024 * KB;
162
- var getContentLength = function(cache) {
163
- return cache.content.length;
164
- };
165
- var createCacheItem = function() {
166
- var _ref = _asyncToGenerator(function(filepath, mtime) {
167
- var content;
168
- return __generator(this, function(_state) {
169
- switch(_state.label){
170
- case 0:
171
- return [
172
- 4,
173
- fs.readFile(filepath)
174
- ];
175
- case 1:
176
- content = _state.sent();
177
- return [
178
- 2,
179
- {
180
- content: content,
181
- mtime: mtime
182
- }
183
- ];
184
- }
185
- });
186
- });
187
- return function createCacheItem(filepath, mtime) {
188
- return _ref.apply(this, arguments);
189
- };
190
- }();
191
- var LruReader = /*#__PURE__*/ function() {
192
- "use strict";
193
- function LruReader() {
194
- _classCallCheck(this, LruReader);
195
- _defineProperty(this, "cache", void 0);
196
- this.cache = new LRU({
197
- max: 256 * MB,
198
- length: getContentLength,
199
- maxAge: 5 * 60 * 5e3
200
- });
201
- }
202
- _createClass(LruReader, [
203
- {
204
- key: "init",
205
- value: function init() {}
206
- },
207
- {
208
- key: "close",
209
- value: function close() {}
210
- },
211
- {
212
- key: "read",
213
- value: function read(filepath) {
214
- var _this = this;
215
- return _asyncToGenerator(function() {
216
- var content, stat, item;
217
- return __generator(this, function(_state) {
218
- switch(_state.label){
219
- case 0:
220
- if (_this.cache.has(filepath)) {
221
- content = _this.cache.get(filepath).content;
222
- return [
223
- 2,
224
- {
225
- content: content
226
- }
227
- ];
228
- }
229
- if (!fs.existsSync(filepath)) {
230
- return [
231
- 2,
232
- null
233
- ];
234
- }
235
- stat = fs.statSync(filepath);
236
- if (stat.isDirectory()) {
237
- return [
238
- 2,
239
- null
240
- ];
241
- }
242
- if (stat.size > 20 * MB) {
243
- return [
244
- 2,
245
- null
246
- ];
247
- }
248
- return [
249
- 4,
250
- createCacheItem(filepath, stat.mtime)
251
- ];
252
- case 1:
253
- item = _state.sent();
254
- _this.cache.set(filepath, item);
255
- return [
256
- 2,
257
- item
258
- ];
259
- }
260
- });
261
- })();
262
- }
263
- },
264
- {
265
- key: "update",
266
- value: function update() {
267
- var cache = this.cache;
268
- var files = cache.keys();
269
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
270
- try {
271
- for(var _iterator = files[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
272
- var filepath = _step.value;
273
- if (!fs.existsSync(filepath)) {
274
- cache.del(filepath);
275
- }
276
- try {
277
- var item = cache.get(filepath);
278
- var stat = fs.statSync(filepath);
279
- var mtime = stat.mtime;
280
- if (item.mtime < mtime) {
281
- cache.del(filepath);
282
- }
283
- } catch (e) {
284
- cache.del(filepath);
285
- }
286
- }
287
- } catch (err) {
288
- _didIteratorError = true;
289
- _iteratorError = err;
290
- } finally{
291
- try {
292
- if (!_iteratorNormalCompletion && _iterator.return != null) {
293
- _iterator.return();
294
- }
295
- } finally{
296
- if (_didIteratorError) {
297
- throw _iteratorError;
298
- }
299
- }
300
- }
301
- }
302
- }
303
- ]);
304
- return LruReader;
305
- }();
306
- var reader = new LruReader();
307
- var readFile = function() {
308
- var _ref = _asyncToGenerator(function(filepath) {
309
- var file;
310
- return __generator(this, function(_state) {
311
- switch(_state.label){
312
- case 0:
313
- return [
314
- 4,
315
- reader.read(filepath)
316
- ];
317
- case 1:
318
- file = _state.sent();
319
- return [
320
- 2,
321
- file === null || file === void 0 ? void 0 : file.content
322
- ];
323
- }
324
- });
325
- });
326
- return function readFile(filepath) {
327
- return _ref.apply(this, arguments);
328
- };
329
- }();
330
- var updateFile = function() {
331
- reader.update();
332
- };
333
- var init = function() {
334
- reader.init();
335
- };
336
- var close = function() {
337
- reader.close();
338
- };
339
- export { LruReader, close, init, readFile, updateFile };
@@ -1,223 +0,0 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
- try {
3
- var info = gen[key](arg);
4
- var value = info.value;
5
- } catch (error) {
6
- reject(error);
7
- return;
8
- }
9
- if (info.done) {
10
- resolve(value);
11
- } else {
12
- Promise.resolve(value).then(_next, _throw);
13
- }
14
- }
15
- function _asyncToGenerator(fn) {
16
- return function() {
17
- var self = this, args = arguments;
18
- return new Promise(function(resolve, reject) {
19
- var gen = fn.apply(self, args);
20
- function _next(value) {
21
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
- }
23
- function _throw(err) {
24
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
- }
26
- _next(undefined);
27
- });
28
- };
29
- }
30
- var __generator = this && this.__generator || function(thisArg, body) {
31
- var f, y, t, g, _ = {
32
- label: 0,
33
- sent: function() {
34
- if (t[0] & 1) throw t[1];
35
- return t[1];
36
- },
37
- trys: [],
38
- ops: []
39
- };
40
- return(g = {
41
- next: verb(0),
42
- "throw": verb(1),
43
- "return": verb(2)
44
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
45
- return this;
46
- }), g);
47
- function verb(n) {
48
- return function(v) {
49
- return step([
50
- n,
51
- v
52
- ]);
53
- };
54
- }
55
- function step(op) {
56
- if (f) throw new TypeError("Generator is already executing.");
57
- while(_)try {
58
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
59
- if (y = 0, t) op = [
60
- op[0] & 2,
61
- t.value
62
- ];
63
- switch(op[0]){
64
- case 0:
65
- case 1:
66
- t = op;
67
- break;
68
- case 4:
69
- _.label++;
70
- return {
71
- value: op[1],
72
- done: false
73
- };
74
- case 5:
75
- _.label++;
76
- y = op[1];
77
- op = [
78
- 0
79
- ];
80
- continue;
81
- case 7:
82
- op = _.ops.pop();
83
- _.trys.pop();
84
- continue;
85
- default:
86
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
87
- _ = 0;
88
- continue;
89
- }
90
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
91
- _.label = op[1];
92
- break;
93
- }
94
- if (op[0] === 6 && _.label < t[1]) {
95
- _.label = t[1];
96
- t = op;
97
- break;
98
- }
99
- if (t && _.label < t[2]) {
100
- _.label = t[2];
101
- _.ops.push(op);
102
- break;
103
- }
104
- if (t[2]) _.ops.pop();
105
- _.trys.pop();
106
- continue;
107
- }
108
- op = body.call(thisArg, _);
109
- } catch (e) {
110
- op = [
111
- 6,
112
- e
113
- ];
114
- y = 0;
115
- } finally{
116
- f = t = 0;
117
- }
118
- if (op[0] & 5) throw op[1];
119
- return {
120
- value: op[0] ? op[1] : void 0,
121
- done: true
122
- };
123
- }
124
- };
125
- import path from "path";
126
- import { fs, LOADABLE_STATS_FILE, mime, ROUTE_MINIFEST_FILE, SERVER_RENDER_FUNCTION_NAME } from "@modern-js/utils";
127
- import cookie from "cookie";
128
- import cache from "./cache";
129
- import { createLogger, createMetrics } from "./measure";
130
- var render = function() {
131
- var _ref = _asyncToGenerator(function(ctx, renderOptions, runner) {
132
- var _ctx_res, urlPath, bundle, distDir, template, entryName, staticGenerate, bundleJS, loadableUri, loadableStats, routesManifestUri, routeManifest, context, serverRender, content, _context_redirection, url, _context_redirection_status, status;
133
- return __generator(this, function(_state) {
134
- switch(_state.label){
135
- case 0:
136
- urlPath = renderOptions.urlPath, bundle = renderOptions.bundle, distDir = renderOptions.distDir, template = renderOptions.template, entryName = renderOptions.entryName, staticGenerate = renderOptions.staticGenerate;
137
- bundleJS = path.join(distDir, bundle);
138
- loadableUri = path.join(distDir, LOADABLE_STATS_FILE);
139
- loadableStats = fs.existsSync(loadableUri) ? require(loadableUri) : "";
140
- routesManifestUri = path.join(distDir, ROUTE_MINIFEST_FILE);
141
- routeManifest = fs.existsSync(routesManifestUri) ? require(routesManifestUri) : void 0;
142
- context = {
143
- request: {
144
- baseUrl: urlPath,
145
- params: ctx.params,
146
- pathname: ctx.path,
147
- host: ctx.host,
148
- query: ctx.query,
149
- url: ctx.href,
150
- cookieMap: cookie.parse(ctx.headers.cookie || ""),
151
- headers: ctx.headers
152
- },
153
- response: {
154
- setHeader: function(key, value) {
155
- return ctx.res.setHeader(key, value);
156
- },
157
- status: function(code) {
158
- ctx.res.statusCode = code;
159
- },
160
- locals: ((_ctx_res = ctx.res) === null || _ctx_res === void 0 ? void 0 : _ctx_res.locals) || {}
161
- },
162
- redirection: {},
163
- template: template,
164
- loadableStats: loadableStats,
165
- routeManifest: routeManifest,
166
- entryName: entryName,
167
- staticGenerate: staticGenerate,
168
- logger: void 0,
169
- metrics: void 0,
170
- req: ctx.req,
171
- res: ctx.res
172
- };
173
- context.logger = createLogger(context, ctx.logger);
174
- context.metrics = createMetrics(context, ctx.metrics);
175
- runner.extendSSRContext(context);
176
- serverRender = require(bundleJS)[SERVER_RENDER_FUNCTION_NAME];
177
- return [
178
- 4,
179
- cache(serverRender, ctx)(context)
180
- ];
181
- case 1:
182
- content = _state.sent();
183
- _context_redirection = context.redirection, url = _context_redirection.url, _context_redirection_status = _context_redirection.status, status = _context_redirection_status === void 0 ? 302 : _context_redirection_status;
184
- if (url) {
185
- return [
186
- 2,
187
- {
188
- content: url,
189
- contentType: "",
190
- statusCode: status,
191
- redirect: true
192
- }
193
- ];
194
- }
195
- if (typeof content === "string") {
196
- return [
197
- 2,
198
- {
199
- content: content,
200
- contentType: mime.contentType("html")
201
- }
202
- ];
203
- } else {
204
- return [
205
- 2,
206
- {
207
- content: "",
208
- contentStream: content,
209
- contentType: mime.contentType("html")
210
- }
211
- ];
212
- }
213
- return [
214
- 2
215
- ];
216
- }
217
- });
218
- });
219
- return function render(ctx, renderOptions, runner) {
220
- return _ref.apply(this, arguments);
221
- };
222
- }();
223
- export { render };