@modern-js/prod-server 2.58.1 → 2.58.2
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/dist/cjs/apply.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/apply.js +39 -31
- package/dist/esm/index.js +9 -4
- package/dist/esm-node/apply.js +1 -1
- package/dist/esm-node/index.js +1 -1
- package/dist/types/apply.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/netlify.d.ts +1 -1
- package/dist/types/types.d.ts +3 -3
- package/package.json +7 -8
package/dist/cjs/apply.js
CHANGED
|
@@ -36,7 +36,7 @@ function getLogger() {
|
|
|
36
36
|
async function applyPlugins(serverBase, options, nodeServer) {
|
|
37
37
|
const { pwd, appContext } = options;
|
|
38
38
|
const loadCachePwd = (0, import_utils.isProd)() ? pwd : appContext.appDirectory || pwd;
|
|
39
|
-
const cacheConfig = (0, import_node.loadCacheConfig)(loadCachePwd);
|
|
39
|
+
const cacheConfig = await (0, import_node.loadCacheConfig)(loadCachePwd);
|
|
40
40
|
serverBase.notFound((c) => {
|
|
41
41
|
const logger = c.get("logger");
|
|
42
42
|
(0, import_server_core.onError)(import_server_core.ErrorDigest.ENOTF, "404 not found", logger, c.req.raw);
|
package/dist/cjs/index.js
CHANGED
|
@@ -48,7 +48,7 @@ const createProdServer = async (options) => {
|
|
|
48
48
|
if (serverCliConfig) {
|
|
49
49
|
serverBaseOptions.config = serverCliConfig;
|
|
50
50
|
}
|
|
51
|
-
const serverRuntimeConfig = (0, import_node.loadServerRuntimeConfig)(options.pwd, options.serverConfigFile, options.serverConfigPath);
|
|
51
|
+
const serverRuntimeConfig = await (0, import_node.loadServerRuntimeConfig)(options.pwd, options.serverConfigFile, options.serverConfigPath);
|
|
52
52
|
if (serverRuntimeConfig) {
|
|
53
53
|
serverBaseOptions.serverConfig = serverRuntimeConfig;
|
|
54
54
|
}
|
package/dist/esm/apply.js
CHANGED
|
@@ -20,37 +20,45 @@ function _applyPlugins() {
|
|
|
20
20
|
_applyPlugins = _async_to_generator(function(serverBase, options, nodeServer) {
|
|
21
21
|
var pwd, appContext, loadCachePwd, cacheConfig, plugins;
|
|
22
22
|
return _ts_generator(this, function(_state) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
23
|
+
switch (_state.label) {
|
|
24
|
+
case 0:
|
|
25
|
+
pwd = options.pwd, appContext = options.appContext;
|
|
26
|
+
loadCachePwd = isProd() ? pwd : appContext.appDirectory || pwd;
|
|
27
|
+
return [
|
|
28
|
+
4,
|
|
29
|
+
loadCacheConfig(loadCachePwd)
|
|
30
|
+
];
|
|
31
|
+
case 1:
|
|
32
|
+
cacheConfig = _state.sent();
|
|
33
|
+
serverBase.notFound(function(c) {
|
|
34
|
+
var logger = c.get("logger");
|
|
35
|
+
onError(ErrorDigest.ENOTF, "404 not found", logger, c.req.raw);
|
|
36
|
+
return c.html(createErrorHtml(404), 404);
|
|
37
|
+
});
|
|
38
|
+
serverBase.onError(function(err, c) {
|
|
39
|
+
var logger = c.get("logger");
|
|
40
|
+
onError(ErrorDigest.EINTER, err, logger, c.req.raw);
|
|
41
|
+
return c.html(createErrorHtml(500), 500);
|
|
42
|
+
});
|
|
43
|
+
plugins = _to_consumable_array(nodeServer ? [
|
|
44
|
+
injectNodeSeverPlugin({
|
|
45
|
+
nodeServer
|
|
46
|
+
})
|
|
47
|
+
] : []).concat(_to_consumable_array(createDefaultPlugins({
|
|
48
|
+
cacheConfig,
|
|
49
|
+
staticGenerate: options.staticGenerate,
|
|
50
|
+
logger: getLogger()
|
|
51
|
+
})), _to_consumable_array(options.plugins || []), [
|
|
52
|
+
injectResourcePlugin(),
|
|
53
|
+
serverStaticPlugin(),
|
|
54
|
+
faviconPlugin(),
|
|
55
|
+
renderPlugin()
|
|
56
|
+
]);
|
|
57
|
+
serverBase.addPlugins(plugins);
|
|
58
|
+
return [
|
|
59
|
+
2
|
|
60
|
+
];
|
|
61
|
+
}
|
|
54
62
|
});
|
|
55
63
|
});
|
|
56
64
|
return _applyPlugins.apply(this, arguments);
|
package/dist/esm/index.js
CHANGED
|
@@ -24,7 +24,12 @@ var createProdServer = function() {
|
|
|
24
24
|
if (serverCliConfig) {
|
|
25
25
|
serverBaseOptions.config = serverCliConfig;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
return [
|
|
28
|
+
4,
|
|
29
|
+
loadServerRuntimeConfig(options.pwd, options.serverConfigFile, options.serverConfigPath)
|
|
30
|
+
];
|
|
31
|
+
case 2:
|
|
32
|
+
serverRuntimeConfig = _state.sent();
|
|
28
33
|
if (serverRuntimeConfig) {
|
|
29
34
|
serverBaseOptions.serverConfig = serverRuntimeConfig;
|
|
30
35
|
}
|
|
@@ -33,19 +38,19 @@ var createProdServer = function() {
|
|
|
33
38
|
4,
|
|
34
39
|
createNodeServer(server.handle.bind(server))
|
|
35
40
|
];
|
|
36
|
-
case
|
|
41
|
+
case 3:
|
|
37
42
|
nodeServer = _state.sent();
|
|
38
43
|
return [
|
|
39
44
|
4,
|
|
40
45
|
applyPlugins(server, options, nodeServer)
|
|
41
46
|
];
|
|
42
|
-
case
|
|
47
|
+
case 4:
|
|
43
48
|
_state.sent();
|
|
44
49
|
return [
|
|
45
50
|
4,
|
|
46
51
|
server.init()
|
|
47
52
|
];
|
|
48
|
-
case
|
|
53
|
+
case 5:
|
|
49
54
|
_state.sent();
|
|
50
55
|
return [
|
|
51
56
|
2,
|
package/dist/esm-node/apply.js
CHANGED
|
@@ -13,7 +13,7 @@ function getLogger() {
|
|
|
13
13
|
async function applyPlugins(serverBase, options, nodeServer) {
|
|
14
14
|
const { pwd, appContext } = options;
|
|
15
15
|
const loadCachePwd = isProd() ? pwd : appContext.appDirectory || pwd;
|
|
16
|
-
const cacheConfig = loadCacheConfig(loadCachePwd);
|
|
16
|
+
const cacheConfig = await loadCacheConfig(loadCachePwd);
|
|
17
17
|
serverBase.notFound((c) => {
|
|
18
18
|
const logger = c.get("logger");
|
|
19
19
|
onError(ErrorDigest.ENOTF, "404 not found", logger, c.req.raw);
|
package/dist/esm-node/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const createProdServer = async (options) => {
|
|
|
12
12
|
if (serverCliConfig) {
|
|
13
13
|
serverBaseOptions.config = serverCliConfig;
|
|
14
14
|
}
|
|
15
|
-
const serverRuntimeConfig = loadServerRuntimeConfig(options.pwd, options.serverConfigFile, options.serverConfigPath);
|
|
15
|
+
const serverRuntimeConfig = await loadServerRuntimeConfig(options.pwd, options.serverConfigFile, options.serverConfigPath);
|
|
16
16
|
if (serverRuntimeConfig) {
|
|
17
17
|
serverBaseOptions.serverConfig = serverRuntimeConfig;
|
|
18
18
|
}
|
package/dist/types/apply.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { ServerBase, NodeServer } from '@modern-js/server-core';
|
|
3
|
-
import { ProdServerOptions } from './types';
|
|
2
|
+
import { type ServerBase, type NodeServer } from '@modern-js/server-core';
|
|
3
|
+
import type { ProdServerOptions } from './types';
|
|
4
4
|
export type ApplyPlugins = typeof applyPlugins;
|
|
5
5
|
export declare function applyPlugins(serverBase: ServerBase, options: ProdServerOptions, nodeServer?: NodeServer): Promise<void>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { ProdServerOptions } from './types';
|
|
3
|
+
import type { ProdServerOptions } from './types';
|
|
4
4
|
export { applyPlugins, type ApplyPlugins } from './apply';
|
|
5
5
|
export { loadServerPlugins, loadServerRuntimeConfig, } from '@modern-js/server-core/node';
|
|
6
6
|
export type { ServerPlugin } from '@modern-js/server-core';
|
package/dist/types/netlify.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ProdServerOptions } from './types';
|
|
1
|
+
import type { ProdServerOptions } from './types';
|
|
2
2
|
export type { ProdServerOptions, BaseEnv } from './types';
|
|
3
3
|
export declare const createNetlifyFunction: (options: ProdServerOptions) => Promise<(request: Request, context: unknown) => Response | Promise<Response>>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ServerBaseOptions, CreateDefaultPluginsOptions, ServerPlugin } from '@modern-js/server-core';
|
|
2
|
-
import { Reporter } from '@modern-js/types';
|
|
3
|
-
import { Logger } from '@modern-js/utils';
|
|
1
|
+
import type { ServerBaseOptions, CreateDefaultPluginsOptions, ServerPlugin } from '@modern-js/server-core';
|
|
2
|
+
import type { Reporter } from '@modern-js/types';
|
|
3
|
+
import type { Logger } from '@modern-js/utils';
|
|
4
4
|
interface ProdServerExtraOptions {
|
|
5
5
|
logger?: Logger;
|
|
6
6
|
/** compat modern.server-runtime.config.ts */
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.58.
|
|
18
|
+
"version": "2.58.2",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@swc/helpers": "0.5.3",
|
|
44
44
|
"source-map-support": "0.5.21",
|
|
45
|
-
"@modern-js/runtime-utils": "2.58.
|
|
46
|
-
"@modern-js/
|
|
47
|
-
"@modern-js/
|
|
45
|
+
"@modern-js/runtime-utils": "2.58.2",
|
|
46
|
+
"@modern-js/utils": "2.58.2",
|
|
47
|
+
"@modern-js/server-core": "2.58.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/jest": "^29",
|
|
@@ -58,10 +58,9 @@
|
|
|
58
58
|
"rimraf": "^3.0.2",
|
|
59
59
|
"tsx": "^3.12.7",
|
|
60
60
|
"typescript": "~5.0.4",
|
|
61
|
-
"@
|
|
62
|
-
"@modern-js/types": "2.58.
|
|
63
|
-
"@scripts/jest-config": "2.58.
|
|
64
|
-
"@scripts/build": "2.58.1"
|
|
61
|
+
"@scripts/build": "2.58.2",
|
|
62
|
+
"@modern-js/types": "2.58.2",
|
|
63
|
+
"@scripts/jest-config": "2.58.2"
|
|
65
64
|
},
|
|
66
65
|
"sideEffects": [],
|
|
67
66
|
"engines": {
|