@modern-js/prod-server 2.48.0 → 2.48.1

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 (47) hide show
  1. package/dist/cjs/libs/context/context.js +4 -8
  2. package/dist/cjs/libs/hook-api/base.js +0 -11
  3. package/dist/cjs/libs/hook-api/index.worker.js +0 -3
  4. package/dist/cjs/libs/hook-api/route.js +0 -4
  5. package/dist/cjs/libs/hook-api/template.js +0 -2
  6. package/dist/cjs/libs/render/ssrCache/cacheMod.js +0 -5
  7. package/dist/cjs/libs/render/ssrCache/manager.js +2 -3
  8. package/dist/cjs/libs/route/index.js +1 -3
  9. package/dist/cjs/libs/route/matcher.js +1 -5
  10. package/dist/cjs/libs/route/route.js +1 -10
  11. package/dist/cjs/libs/serverTiming.js +0 -3
  12. package/dist/cjs/renderHtml.js +0 -7
  13. package/dist/cjs/server/index.js +1 -7
  14. package/dist/cjs/server/modernServer.js +4 -20
  15. package/dist/cjs/workerServer.js +4 -8
  16. package/dist/esm/libs/context/context.js +66 -98
  17. package/dist/esm/libs/hook-api/base.js +36 -71
  18. package/dist/esm/libs/hook-api/index.worker.js +15 -29
  19. package/dist/esm/libs/hook-api/route.js +12 -27
  20. package/dist/esm/libs/hook-api/template.js +33 -61
  21. package/dist/esm/libs/render/ssrCache/cacheMod.js +10 -18
  22. package/dist/esm/libs/render/ssrCache/manager.js +145 -157
  23. package/dist/esm/libs/route/index.js +62 -96
  24. package/dist/esm/libs/route/matcher.js +58 -94
  25. package/dist/esm/libs/route/route.js +1 -10
  26. package/dist/esm/libs/serverTiming.js +8 -16
  27. package/dist/esm/renderHtml.js +22 -39
  28. package/dist/esm/server/index.js +307 -383
  29. package/dist/esm/server/modernServer.js +802 -942
  30. package/dist/esm/server/modernServerSplit.js +61 -86
  31. package/dist/esm/workerServer.js +87 -82
  32. package/dist/esm-node/libs/context/context.js +4 -8
  33. package/dist/esm-node/libs/hook-api/base.js +0 -11
  34. package/dist/esm-node/libs/hook-api/index.worker.js +0 -3
  35. package/dist/esm-node/libs/hook-api/route.js +0 -4
  36. package/dist/esm-node/libs/hook-api/template.js +0 -2
  37. package/dist/esm-node/libs/render/ssrCache/cacheMod.js +0 -5
  38. package/dist/esm-node/libs/render/ssrCache/manager.js +2 -3
  39. package/dist/esm-node/libs/route/index.js +1 -3
  40. package/dist/esm-node/libs/route/matcher.js +1 -5
  41. package/dist/esm-node/libs/route/route.js +1 -10
  42. package/dist/esm-node/libs/serverTiming.js +0 -3
  43. package/dist/esm-node/renderHtml.js +0 -7
  44. package/dist/esm-node/server/index.js +1 -7
  45. package/dist/esm-node/server/modernServer.js +4 -20
  46. package/dist/esm-node/workerServer.js +4 -8
  47. package/package.json +8 -8
@@ -1,17 +1,8 @@
1
1
  import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
2
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
3
2
  var ModernRoute = function ModernRoute2(routeSpec) {
4
3
  "use strict";
5
4
  _class_call_check(this, ModernRoute2);
6
- _define_property(this, "entryName", void 0);
7
- _define_property(this, "urlPath", void 0);
8
- _define_property(this, "entryPath", void 0);
9
- _define_property(this, "bundle", void 0);
10
- _define_property(this, "isApi", void 0);
11
- _define_property(this, "isSSR", void 0);
12
- _define_property(this, "isSPA", void 0);
13
- _define_property(this, "params", {});
14
- _define_property(this, "responseHeaders", void 0);
5
+ this.params = {};
15
6
  this.entryName = routeSpec.entryName || "";
16
7
  this.urlPath = routeSpec.urlPath;
17
8
  this.entryPath = routeSpec.entryPath || "";
@@ -1,28 +1,20 @@
1
1
  import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
2
- import { _ as _create_class } from "@swc/helpers/_/_create_class";
3
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
4
2
  var SERVER_TIMING = "Server-Timing";
5
3
  var ServerTiming = /* @__PURE__ */ function() {
6
4
  "use strict";
7
5
  function ServerTiming2(res, meta) {
8
6
  _class_call_check(this, ServerTiming2);
9
- _define_property(this, "meta", void 0);
10
- _define_property(this, "res", void 0);
11
7
  this.meta = meta;
12
8
  this.res = res;
13
9
  }
14
- _create_class(ServerTiming2, [
15
- {
16
- key: "addServeTiming",
17
- value: function addServeTiming(name, dur, desc) {
18
- var _name = "bd-".concat(this.meta, "-").concat(name);
19
- var serverTiming = this.res.getHeader(SERVER_TIMING) || this.res.getHeader(SERVER_TIMING.toLocaleLowerCase());
20
- var value = "".concat(_name, ";").concat(desc ? 'decs="'.concat(desc, '";') : "", " dur=").concat(dur);
21
- this.res.set(SERVER_TIMING, serverTiming ? "".concat(serverTiming, ", ").concat(value) : value);
22
- return this;
23
- }
24
- }
25
- ]);
10
+ var _proto = ServerTiming2.prototype;
11
+ _proto.addServeTiming = function addServeTiming(name, dur, desc) {
12
+ var _name = "bd-".concat(this.meta, "-").concat(name);
13
+ var serverTiming = this.res.getHeader(SERVER_TIMING) || this.res.getHeader(SERVER_TIMING.toLocaleLowerCase());
14
+ var value = "".concat(_name, ";").concat(desc ? 'decs="'.concat(desc, '";') : "", " dur=").concat(dur);
15
+ this.res.set(SERVER_TIMING, serverTiming ? "".concat(serverTiming, ", ").concat(value) : value);
16
+ return this;
17
+ };
26
18
  return ServerTiming2;
27
19
  }();
28
20
  export {
@@ -2,11 +2,8 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
2
2
  var __commonJS = (cb, mod) => function __require() {
3
3
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
4
  };
5
- import { _ as _assert_this_initialized } from "@swc/helpers/_/_assert_this_initialized";
6
5
  import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
7
6
  import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
8
- import { _ as _create_class } from "@swc/helpers/_/_create_class";
9
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
10
7
  import { _ as _inherits } from "@swc/helpers/_/_inherits";
11
8
  import { _ as _create_super } from "@swc/helpers/_/_create_super";
12
9
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
@@ -26,10 +23,6 @@ var require_renderHtml = __commonJS({
26
23
  _class_call_check(this, IncomingMessageLike2);
27
24
  var _this;
28
25
  _this = _super.call(this);
29
- _define_property(_assert_this_initialized(_this), "headers", void 0);
30
- _define_property(_assert_this_initialized(_this), "method", void 0);
31
- _define_property(_assert_this_initialized(_this), "url", void 0);
32
- _define_property(_assert_this_initialized(_this), "socket", void 0);
33
26
  _this.socket = new Socket();
34
27
  _this.headers = headers || {};
35
28
  _this.headers.host = "localhost:8080";
@@ -47,23 +40,17 @@ var require_renderHtml = __commonJS({
47
40
  _class_call_check(this, ServerResponseLike2);
48
41
  var _this;
49
42
  _this = _super.call(this);
50
- _define_property(_assert_this_initialized(_this), "statusCode", void 0);
51
- _define_property(_assert_this_initialized(_this), "data", void 0);
52
43
  _this.statusCode = 200;
53
44
  _this.data = [];
54
45
  return _this;
55
46
  }
56
- _create_class(ServerResponseLike2, [
57
- {
58
- key: "end",
59
- value: function end(chunk, _encoding, cb) {
60
- this.data.push(chunk.toString());
61
- cb && cb();
62
- this.emit("finish");
63
- return this;
64
- }
65
- }
66
- ]);
47
+ var _proto = ServerResponseLike2.prototype;
48
+ _proto.end = function end(chunk, _encoding, cb) {
49
+ this.data.push(chunk.toString());
50
+ cb && cb();
51
+ this.emit("finish");
52
+ return this;
53
+ };
67
54
  return ServerResponseLike2;
68
55
  }(OutgoingMessage);
69
56
  var CustomServer = /* @__PURE__ */ function(Server2) {
@@ -74,25 +61,21 @@ var require_renderHtml = __commonJS({
74
61
  _class_call_check(this, CustomServer2);
75
62
  return _super.apply(this, arguments);
76
63
  }
77
- _create_class(CustomServer2, [
78
- {
79
- key: "render",
80
- value: function render(req, res, _url) {
81
- var _this = this;
82
- return _async_to_generator(function() {
83
- var handler;
84
- return _ts_generator(this, function(_state) {
85
- handler = _this.getRequestHandler();
86
- handler(req, res);
87
- return [
88
- 2,
89
- null
90
- ];
91
- });
92
- })();
93
- }
94
- }
95
- ]);
64
+ var _proto = CustomServer2.prototype;
65
+ _proto.render = function render(req, res, _url) {
66
+ var _this = this;
67
+ return _async_to_generator(function() {
68
+ var handler;
69
+ return _ts_generator(this, function(_state) {
70
+ handler = _this.getRequestHandler();
71
+ handler(req, res);
72
+ return [
73
+ 2,
74
+ null
75
+ ];
76
+ });
77
+ })();
78
+ };
96
79
  return CustomServer2;
97
80
  }(Server);
98
81
  function renderHtml(_) {