@modern-js/prod-server 2.9.1-alpha.0 → 2.11.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.
- package/CHANGELOG.md +45 -0
- package/dist/cjs/libs/hook-api/index.js +7 -26
- package/dist/cjs/libs/render/index.js +2 -1
- package/dist/cjs/libs/render/ssr.js +7 -5
- package/dist/{js/node/libs/metrics.js → cjs/libs/render/utils.js} +25 -12
- package/dist/cjs/server/index.js +1 -1
- package/dist/cjs/server/modernServer.js +75 -80
- package/dist/esm/libs/hook-api/index.js +9 -37
- package/dist/esm/libs/render/index.js +2 -1
- package/dist/esm/libs/render/ssr.js +6 -4
- package/dist/esm/libs/render/utils.js +12 -0
- package/dist/esm/server/index.js +2 -2
- package/dist/esm/server/modernServer.js +108 -103
- package/dist/esm-node/libs/hook-api/index.js +7 -26
- package/dist/esm-node/libs/render/index.js +2 -1
- package/dist/esm-node/libs/render/ssr.js +7 -7
- package/dist/esm-node/libs/render/utils.js +23 -0
- package/dist/esm-node/server/index.js +1 -1
- package/dist/esm-node/server/modernServer.js +75 -80
- package/dist/types/libs/context/context.d.ts +1 -1
- package/dist/types/libs/render/utils.d.ts +5 -0
- package/dist/types/server/index.d.ts +2 -1
- package/dist/types/server/modernServer.d.ts +4 -4
- package/dist/types/type.d.ts +1 -1
- package/dist/types/utils.d.ts +1 -1
- package/package.json +9 -7
- package/dist/js/modern/constants.js +0 -35
- package/dist/js/modern/index.js +0 -18
- package/dist/js/modern/libs/context/context.js +0 -160
- package/dist/js/modern/libs/context/index.js +0 -6
- package/dist/js/modern/libs/hook-api/index.js +0 -134
- package/dist/js/modern/libs/hook-api/route.js +0 -20
- package/dist/js/modern/libs/hook-api/template.js +0 -73
- package/dist/js/modern/libs/loadConfig.js +0 -62
- package/dist/js/modern/libs/logger.js +0 -111
- package/dist/js/modern/libs/metrics.js +0 -11
- package/dist/js/modern/libs/proxy.js +0 -92
- package/dist/js/modern/libs/render/cache/__tests__/cache.fun.test.js +0 -114
- package/dist/js/modern/libs/render/cache/__tests__/cache.test.js +0 -254
- package/dist/js/modern/libs/render/cache/__tests__/cacheable.js +0 -47
- package/dist/js/modern/libs/render/cache/__tests__/error-configuration.js +0 -37
- package/dist/js/modern/libs/render/cache/__tests__/matched-cache.js +0 -91
- package/dist/js/modern/libs/render/cache/index.js +0 -115
- package/dist/js/modern/libs/render/cache/page-caches/index.js +0 -32
- package/dist/js/modern/libs/render/cache/page-caches/lru.js +0 -29
- package/dist/js/modern/libs/render/cache/spr.js +0 -248
- package/dist/js/modern/libs/render/cache/type.js +0 -0
- package/dist/js/modern/libs/render/cache/util.js +0 -102
- package/dist/js/modern/libs/render/index.js +0 -86
- package/dist/js/modern/libs/render/measure.js +0 -68
- package/dist/js/modern/libs/render/reader.js +0 -107
- package/dist/js/modern/libs/render/ssr.js +0 -100
- package/dist/js/modern/libs/render/static.js +0 -60
- package/dist/js/modern/libs/render/type.js +0 -9
- package/dist/js/modern/libs/route/index.js +0 -54
- package/dist/js/modern/libs/route/matcher.js +0 -87
- package/dist/js/modern/libs/route/route.js +0 -16
- package/dist/js/modern/libs/serve-file.js +0 -67
- package/dist/js/modern/server/index.js +0 -208
- package/dist/js/modern/server/modern-server-split.js +0 -74
- package/dist/js/modern/server/modern-server.js +0 -554
- package/dist/js/modern/type.js +0 -0
- package/dist/js/modern/utils.js +0 -136
- package/dist/js/modern/worker-server.js +0 -89
- package/dist/js/node/constants.js +0 -62
- package/dist/js/node/index.js +0 -44
- package/dist/js/node/libs/context/context.js +0 -189
- package/dist/js/node/libs/context/index.js +0 -30
- package/dist/js/node/libs/hook-api/index.js +0 -164
- package/dist/js/node/libs/hook-api/route.js +0 -43
- package/dist/js/node/libs/hook-api/template.js +0 -97
- package/dist/js/node/libs/loadConfig.js +0 -91
- package/dist/js/node/libs/logger.js +0 -133
- package/dist/js/node/libs/proxy.js +0 -114
- package/dist/js/node/libs/render/cache/__tests__/cache.fun.test.js +0 -115
- package/dist/js/node/libs/render/cache/__tests__/cache.test.js +0 -245
- package/dist/js/node/libs/render/cache/__tests__/cacheable.js +0 -70
- package/dist/js/node/libs/render/cache/__tests__/error-configuration.js +0 -60
- package/dist/js/node/libs/render/cache/__tests__/matched-cache.js +0 -114
- package/dist/js/node/libs/render/cache/index.js +0 -134
- package/dist/js/node/libs/render/cache/page-caches/index.js +0 -55
- package/dist/js/node/libs/render/cache/page-caches/lru.js +0 -58
- package/dist/js/node/libs/render/cache/spr.js +0 -270
- package/dist/js/node/libs/render/cache/type.js +0 -15
- package/dist/js/node/libs/render/cache/util.js +0 -138
- package/dist/js/node/libs/render/index.js +0 -115
- package/dist/js/node/libs/render/measure.js +0 -90
- package/dist/js/node/libs/render/reader.js +0 -140
- package/dist/js/node/libs/render/ssr.js +0 -123
- package/dist/js/node/libs/render/static.js +0 -89
- package/dist/js/node/libs/render/type.js +0 -32
- package/dist/js/node/libs/route/index.js +0 -78
- package/dist/js/node/libs/route/matcher.js +0 -106
- package/dist/js/node/libs/route/route.js +0 -39
- package/dist/js/node/libs/serve-file.js +0 -97
- package/dist/js/node/server/index.js +0 -219
- package/dist/js/node/server/modern-server-split.js +0 -97
- package/dist/js/node/server/modern-server.js +0 -559
- package/dist/js/node/type.js +0 -15
- package/dist/js/node/utils.js +0 -166
- package/dist/js/node/worker-server.js +0 -113
- package/dist/js/treeshaking/constants.js +0 -29
- package/dist/js/treeshaking/index.js +0 -13
- package/dist/js/treeshaking/libs/context/context.js +0 -274
- package/dist/js/treeshaking/libs/context/index.js +0 -5
- package/dist/js/treeshaking/libs/hook-api/index.js +0 -281
- package/dist/js/treeshaking/libs/hook-api/route.js +0 -68
- package/dist/js/treeshaking/libs/hook-api/template.js +0 -127
- package/dist/js/treeshaking/libs/loadConfig.js +0 -82
- package/dist/js/treeshaking/libs/logger.js +0 -205
- package/dist/js/treeshaking/libs/metrics.js +0 -6
- package/dist/js/treeshaking/libs/proxy.js +0 -244
- package/dist/js/treeshaking/libs/render/cache/__tests__/cache.fun.test.js +0 -291
- package/dist/js/treeshaking/libs/render/cache/__tests__/cache.test.js +0 -781
- package/dist/js/treeshaking/libs/render/cache/__tests__/cacheable.js +0 -67
- package/dist/js/treeshaking/libs/render/cache/__tests__/error-configuration.js +0 -45
- package/dist/js/treeshaking/libs/render/cache/__tests__/matched-cache.js +0 -147
- package/dist/js/treeshaking/libs/render/cache/index.js +0 -346
- package/dist/js/treeshaking/libs/render/cache/page-caches/index.js +0 -154
- package/dist/js/treeshaking/libs/render/cache/page-caches/lru.js +0 -84
- package/dist/js/treeshaking/libs/render/cache/spr.js +0 -492
- package/dist/js/treeshaking/libs/render/cache/type.js +0 -1
- package/dist/js/treeshaking/libs/render/cache/util.js +0 -280
- package/dist/js/treeshaking/libs/render/index.js +0 -234
- package/dist/js/treeshaking/libs/render/measure.js +0 -146
- package/dist/js/treeshaking/libs/render/reader.js +0 -339
- package/dist/js/treeshaking/libs/render/ssr.js +0 -223
- package/dist/js/treeshaking/libs/render/static.js +0 -216
- package/dist/js/treeshaking/libs/render/type.js +0 -7
- package/dist/js/treeshaking/libs/route/index.js +0 -130
- package/dist/js/treeshaking/libs/route/matcher.js +0 -143
- package/dist/js/treeshaking/libs/route/route.js +0 -40
- package/dist/js/treeshaking/libs/serve-file.js +0 -184
- package/dist/js/treeshaking/server/index.js +0 -505
- package/dist/js/treeshaking/server/modern-server-split.js +0 -360
- package/dist/js/treeshaking/server/modern-server.js +0 -1089
- package/dist/js/treeshaking/type.js +0 -1
- package/dist/js/treeshaking/utils.js +0 -147
- package/dist/js/treeshaking/worker-server.js +0 -233
|
@@ -1,154 +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 { LRUCaches } from "./lru";
|
|
126
|
-
function createPageCaches(max) {
|
|
127
|
-
return _createPageCaches.apply(this, arguments);
|
|
128
|
-
}
|
|
129
|
-
function _createPageCaches() {
|
|
130
|
-
_createPageCaches = _asyncToGenerator(function(max) {
|
|
131
|
-
var constructorOptions, cacheInstance;
|
|
132
|
-
return __generator(this, function(_state) {
|
|
133
|
-
switch(_state.label){
|
|
134
|
-
case 0:
|
|
135
|
-
constructorOptions = {
|
|
136
|
-
max: max
|
|
137
|
-
};
|
|
138
|
-
cacheInstance = new LRUCaches(constructorOptions);
|
|
139
|
-
return [
|
|
140
|
-
4,
|
|
141
|
-
cacheInstance.init()
|
|
142
|
-
];
|
|
143
|
-
case 1:
|
|
144
|
-
_state.sent();
|
|
145
|
-
return [
|
|
146
|
-
2,
|
|
147
|
-
cacheInstance
|
|
148
|
-
];
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
return _createPageCaches.apply(this, arguments);
|
|
153
|
-
}
|
|
154
|
-
export { createPageCaches };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
function _classCallCheck(instance, Constructor) {
|
|
2
|
-
if (!(instance instanceof Constructor)) {
|
|
3
|
-
throw new TypeError("Cannot call a class as a function");
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
function _defineProperties(target, props) {
|
|
7
|
-
for(var i = 0; i < props.length; i++){
|
|
8
|
-
var descriptor = props[i];
|
|
9
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
-
descriptor.configurable = true;
|
|
11
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
16
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
-
return Constructor;
|
|
19
|
-
}
|
|
20
|
-
function _defineProperty(obj, key, value) {
|
|
21
|
-
if (key in obj) {
|
|
22
|
-
Object.defineProperty(obj, key, {
|
|
23
|
-
value: value,
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
obj[key] = value;
|
|
30
|
-
}
|
|
31
|
-
return obj;
|
|
32
|
-
}
|
|
33
|
-
import LRU from "lru-cache";
|
|
34
|
-
var LRUCaches = /*#__PURE__*/ function() {
|
|
35
|
-
"use strict";
|
|
36
|
-
function LRUCaches(options) {
|
|
37
|
-
_classCallCheck(this, LRUCaches);
|
|
38
|
-
_defineProperty(this, "caches", void 0);
|
|
39
|
-
_defineProperty(this, "max", void 0);
|
|
40
|
-
this.max = options.max;
|
|
41
|
-
this.caches = new LRU(this.max);
|
|
42
|
-
}
|
|
43
|
-
_createClass(LRUCaches, [
|
|
44
|
-
{
|
|
45
|
-
key: "init",
|
|
46
|
-
value: function init() {
|
|
47
|
-
return Promise.resolve();
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
key: "keys",
|
|
52
|
-
value: function keys() {
|
|
53
|
-
return this.caches.keys();
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
key: "get",
|
|
58
|
-
value: function get(key) {
|
|
59
|
-
return Promise.resolve(this.caches.get(key) || null);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
key: "peek",
|
|
64
|
-
value: function peek(key) {
|
|
65
|
-
return this.caches.peek(key) || null;
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
key: "set",
|
|
70
|
-
value: function set(key, cache) {
|
|
71
|
-
this.caches.set(key, cache);
|
|
72
|
-
return Promise.resolve();
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
key: "del",
|
|
77
|
-
value: function del(key) {
|
|
78
|
-
this.caches.del(key);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
]);
|
|
82
|
-
return LRUCaches;
|
|
83
|
-
}();
|
|
84
|
-
export { LRUCaches };
|