@modern-js/prod-server 2.10.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
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @modern-js/prod-server
|
|
2
2
|
|
|
3
|
+
## 2.11.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 381a3b9: feat(utils): move universal utils to the universal folder
|
|
8
|
+
|
|
9
|
+
feat(utils): 将运行时使用的 utils 移动到 universal 目录
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [cfb058f]
|
|
12
|
+
- Updated dependencies [0bd018b]
|
|
13
|
+
- Updated dependencies [5d624fd]
|
|
14
|
+
- Updated dependencies [e2466a1]
|
|
15
|
+
- Updated dependencies [02bb383]
|
|
16
|
+
- Updated dependencies [381a3b9]
|
|
17
|
+
- Updated dependencies [7a60f10]
|
|
18
|
+
- Updated dependencies [274b2e5]
|
|
19
|
+
- Updated dependencies [b9e1c54]
|
|
20
|
+
- @modern-js/utils@2.11.0
|
|
21
|
+
- @modern-js/server-core@2.11.0
|
|
22
|
+
|
|
3
23
|
## 2.10.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -32,6 +32,7 @@ __export(ssr_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(ssr_exports);
|
|
33
33
|
var import_path = __toESM(require("path"));
|
|
34
34
|
var import_utils = require("@modern-js/utils");
|
|
35
|
+
var import_constants = require("@modern-js/utils/constants");
|
|
35
36
|
var import_cache = __toESM(require("./cache"));
|
|
36
37
|
var import_measure = require("./measure");
|
|
37
38
|
var import_utils2 = require("./utils");
|
|
@@ -47,9 +48,9 @@ const render = async (ctx, renderOptions, runner) => {
|
|
|
47
48
|
enableUnsafeCtx = false
|
|
48
49
|
} = renderOptions;
|
|
49
50
|
const bundleJS = import_path.default.join(distDir, bundle);
|
|
50
|
-
const loadableUri = import_path.default.join(distDir,
|
|
51
|
+
const loadableUri = import_path.default.join(distDir, import_constants.LOADABLE_STATS_FILE);
|
|
51
52
|
const loadableStats = import_utils.fs.existsSync(loadableUri) ? require(loadableUri) : "";
|
|
52
|
-
const routesManifestUri = import_path.default.join(distDir,
|
|
53
|
+
const routesManifestUri = import_path.default.join(distDir, import_constants.ROUTE_MANIFEST_FILE);
|
|
53
54
|
const routeManifest = import_utils.fs.existsSync(routesManifestUri) ? require(routesManifestUri) : void 0;
|
|
54
55
|
const context = {
|
|
55
56
|
request: {
|
|
@@ -86,7 +87,7 @@ const render = async (ctx, renderOptions, runner) => {
|
|
|
86
87
|
context.logger = (0, import_measure.createLogger)(context, ctx.logger);
|
|
87
88
|
context.metrics = (0, import_measure.createMetrics)(context, ctx.metrics);
|
|
88
89
|
runner.extendSSRContext(context);
|
|
89
|
-
const serverRender = require(bundleJS)[
|
|
90
|
+
const serverRender = require(bundleJS)[import_constants.SERVER_RENDER_FUNCTION_NAME];
|
|
90
91
|
const content = await (0, import_cache.default)(serverRender, ctx)(context);
|
|
91
92
|
const { url, status = 302 } = context.redirection;
|
|
92
93
|
if (url) {
|
|
@@ -123,7 +123,8 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
import path from "path";
|
|
126
|
-
import { fs,
|
|
126
|
+
import { fs, mime } from "@modern-js/utils";
|
|
127
|
+
import { LOADABLE_STATS_FILE, ROUTE_MANIFEST_FILE, SERVER_RENDER_FUNCTION_NAME } from "@modern-js/utils/constants";
|
|
127
128
|
import cache from "./cache";
|
|
128
129
|
import { createLogger, createMetrics } from "./measure";
|
|
129
130
|
import { injectServerDataStream, injectSeverData } from "./utils";
|
|
@@ -137,7 +138,7 @@ var render = function() {
|
|
|
137
138
|
bundleJS = path.join(distDir, bundle);
|
|
138
139
|
loadableUri = path.join(distDir, LOADABLE_STATS_FILE);
|
|
139
140
|
loadableStats = fs.existsSync(loadableUri) ? require(loadableUri) : "";
|
|
140
|
-
routesManifestUri = path.join(distDir,
|
|
141
|
+
routesManifestUri = path.join(distDir, ROUTE_MANIFEST_FILE);
|
|
141
142
|
routeManifest = fs.existsSync(routesManifestUri) ? require(routesManifestUri) : void 0;
|
|
142
143
|
context = {
|
|
143
144
|
request: {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
+
import { fs, mime } from "@modern-js/utils";
|
|
2
3
|
import {
|
|
3
|
-
fs,
|
|
4
4
|
LOADABLE_STATS_FILE,
|
|
5
|
-
|
|
6
|
-
ROUTE_MINIFEST_FILE,
|
|
5
|
+
ROUTE_MANIFEST_FILE,
|
|
7
6
|
SERVER_RENDER_FUNCTION_NAME
|
|
8
|
-
} from "@modern-js/utils";
|
|
7
|
+
} from "@modern-js/utils/constants";
|
|
9
8
|
import cache from "./cache";
|
|
10
9
|
import { createLogger, createMetrics } from "./measure";
|
|
11
10
|
import { injectServerDataStream, injectSeverData } from "./utils";
|
|
@@ -23,7 +22,7 @@ const render = async (ctx, renderOptions, runner) => {
|
|
|
23
22
|
const bundleJS = path.join(distDir, bundle);
|
|
24
23
|
const loadableUri = path.join(distDir, LOADABLE_STATS_FILE);
|
|
25
24
|
const loadableStats = fs.existsSync(loadableUri) ? require(loadableUri) : "";
|
|
26
|
-
const routesManifestUri = path.join(distDir,
|
|
25
|
+
const routesManifestUri = path.join(distDir, ROUTE_MANIFEST_FILE);
|
|
27
26
|
const routeManifest = fs.existsSync(routesManifestUri) ? require(routesManifestUri) : void 0;
|
|
28
27
|
const context = {
|
|
29
28
|
request: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
/// <reference types="node/http" />
|
|
5
|
-
/// <reference types=".dts-temp/
|
|
5
|
+
/// <reference types=".dts-temp/k52V3rAmkkpigea7EM0nH/src/type" />
|
|
6
6
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
7
7
|
import qs from 'querystring';
|
|
8
8
|
import type { ModernServerContext as ModernServerContextInterface } from '@modern-js/types';
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node/http" />
|
|
3
|
-
/// <reference types=".dts-temp/
|
|
3
|
+
/// <reference types=".dts-temp/k52V3rAmkkpigea7EM0nH/src/type" />
|
|
4
4
|
import { IncomingMessage } from 'http';
|
|
5
5
|
import type { OutputNormalizedConfig, HtmlNormalizedConfig } from '@modern-js/server-core';
|
|
6
6
|
export declare const debug: any;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.11.0",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/cjs/index.js",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"merge-deep": "^3.0.3",
|
|
57
57
|
"path-to-regexp": "^6.2.0",
|
|
58
58
|
"serve-static": "^1.14.1",
|
|
59
|
-
"@modern-js/utils": "2.
|
|
60
|
-
"@modern-js/server-core": "2.
|
|
59
|
+
"@modern-js/utils": "2.11.0",
|
|
60
|
+
"@modern-js/server-core": "2.11.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/cookie": "^0.4.1",
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"node-mocks-http": "^1.11.0",
|
|
74
74
|
"portfinder": "^1.0.28",
|
|
75
75
|
"typescript": "^4",
|
|
76
|
-
"@modern-js/types": "2.
|
|
77
|
-
"@modern-js/server-core": "2.
|
|
78
|
-
"@scripts/
|
|
79
|
-
"@scripts/
|
|
76
|
+
"@modern-js/types": "2.11.0",
|
|
77
|
+
"@modern-js/server-core": "2.11.0",
|
|
78
|
+
"@scripts/jest-config": "2.11.0",
|
|
79
|
+
"@scripts/build": "2.11.0"
|
|
80
80
|
},
|
|
81
81
|
"sideEffects": false,
|
|
82
82
|
"publishConfig": {
|