@modern-js/server-core 2.54.2 → 2.54.3
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/adapters/node/helper/index.js +6 -4
- package/dist/cjs/adapters/node/helper/loadConfig.js +26 -3
- package/dist/cjs/adapters/node/index.js +4 -2
- package/dist/esm/adapters/node/helper/index.js +4 -3
- package/dist/esm/adapters/node/helper/loadConfig.js +26 -3
- package/dist/esm/adapters/node/index.js +3 -2
- package/dist/esm-node/adapters/node/helper/index.js +4 -3
- package/dist/esm-node/adapters/node/helper/loadConfig.js +25 -3
- package/dist/esm-node/adapters/node/index.js +3 -2
- package/dist/types/adapters/node/helper/index.d.ts +1 -1
- package/dist/types/adapters/node/helper/loadConfig.d.ts +3 -2
- package/dist/types/adapters/node/index.d.ts +1 -1
- package/package.json +7 -7
|
@@ -19,9 +19,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var helper_exports = {};
|
|
20
20
|
__export(helper_exports, {
|
|
21
21
|
loadCacheConfig: () => import_loadCache.loadCacheConfig,
|
|
22
|
-
|
|
22
|
+
loadServerCliConfig: () => import_loadConfig.loadServerCliConfig,
|
|
23
23
|
loadServerEnv: () => import_loadEnv.loadServerEnv,
|
|
24
|
-
loadServerPlugins: () => import_loadPlugin.loadServerPlugins
|
|
24
|
+
loadServerPlugins: () => import_loadPlugin.loadServerPlugins,
|
|
25
|
+
loadServerRuntimeConfig: () => import_loadConfig.loadServerRuntimeConfig
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(helper_exports);
|
|
27
28
|
var import_loadEnv = require("./loadEnv");
|
|
@@ -31,7 +32,8 @@ var import_loadCache = require("./loadCache");
|
|
|
31
32
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
33
|
0 && (module.exports = {
|
|
33
34
|
loadCacheConfig,
|
|
34
|
-
|
|
35
|
+
loadServerCliConfig,
|
|
35
36
|
loadServerEnv,
|
|
36
|
-
loadServerPlugins
|
|
37
|
+
loadServerPlugins,
|
|
38
|
+
loadServerRuntimeConfig
|
|
37
39
|
});
|
|
@@ -28,7 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var loadConfig_exports = {};
|
|
30
30
|
__export(loadConfig_exports, {
|
|
31
|
-
|
|
31
|
+
loadServerCliConfig: () => loadServerCliConfig,
|
|
32
|
+
loadServerRuntimeConfig: () => loadServerRuntimeConfig
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(loadConfig_exports);
|
|
34
35
|
var import_path = __toESM(require("path"));
|
|
@@ -51,7 +52,7 @@ function loadServerConfigOld(pwd, configFile) {
|
|
|
51
52
|
const serverConfig = requireConfig(serverConfigPath);
|
|
52
53
|
return serverConfig;
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function loadServerRuntimeConfig(pwd, oldServerFile = import_utils.DEFAULT_SERVER_CONFIG, newServerConfigPath) {
|
|
55
56
|
const newServerConfig = newServerConfigPath && loadServerConfigNew(newServerConfigPath);
|
|
56
57
|
if (newServerConfig) {
|
|
57
58
|
return newServerConfig;
|
|
@@ -59,7 +60,29 @@ function loadServerConfig(pwd, oldServerFile = import_utils.DEFAULT_SERVER_CONFI
|
|
|
59
60
|
const oldServerConfig = loadServerConfigOld(pwd, oldServerFile);
|
|
60
61
|
return oldServerConfig;
|
|
61
62
|
}
|
|
63
|
+
function loadServerCliConfig(pwd, defaultConfig = {}) {
|
|
64
|
+
var _defaultConfig_output;
|
|
65
|
+
const cliConfigPath = (0, import_utils.ensureAbsolutePath)(pwd, import_path.default.join(((_defaultConfig_output = defaultConfig.output) === null || _defaultConfig_output === void 0 ? void 0 : _defaultConfig_output.path) || "dist", import_utils.OUTPUT_CONFIG_FILE));
|
|
66
|
+
let cliConfig = {
|
|
67
|
+
output: {},
|
|
68
|
+
source: {},
|
|
69
|
+
tools: {},
|
|
70
|
+
server: {},
|
|
71
|
+
security: {},
|
|
72
|
+
runtime: {},
|
|
73
|
+
bff: {},
|
|
74
|
+
html: {},
|
|
75
|
+
dev: {}
|
|
76
|
+
};
|
|
77
|
+
try {
|
|
78
|
+
cliConfig = require(cliConfigPath);
|
|
79
|
+
} catch (_2) {
|
|
80
|
+
}
|
|
81
|
+
const mergedCliConfig = import_utils.lodash.merge(defaultConfig, cliConfig);
|
|
82
|
+
return mergedCliConfig;
|
|
83
|
+
}
|
|
62
84
|
// Annotate the CommonJS export names for ESM import in node:
|
|
63
85
|
0 && (module.exports = {
|
|
64
|
-
|
|
86
|
+
loadServerCliConfig,
|
|
87
|
+
loadServerRuntimeConfig
|
|
65
88
|
});
|
|
@@ -27,9 +27,10 @@ __export(node_exports, {
|
|
|
27
27
|
injectNodeSeverPlugin: () => import_plugins.injectNodeSeverPlugin,
|
|
28
28
|
injectResourcePlugin: () => import_plugins.injectResourcePlugin,
|
|
29
29
|
loadCacheConfig: () => import_helper.loadCacheConfig,
|
|
30
|
-
|
|
30
|
+
loadServerCliConfig: () => import_helper.loadServerCliConfig,
|
|
31
31
|
loadServerEnv: () => import_helper.loadServerEnv,
|
|
32
32
|
loadServerPlugins: () => import_helper.loadServerPlugins,
|
|
33
|
+
loadServerRuntimeConfig: () => import_helper.loadServerRuntimeConfig,
|
|
33
34
|
sendResponse: () => import_node.sendResponse,
|
|
34
35
|
serverStaticPlugin: () => import_plugins.serverStaticPlugin,
|
|
35
36
|
writeReadableStreamToWritable: () => import_node.writeReadableStreamToWritable
|
|
@@ -50,9 +51,10 @@ var import_helper = require("./helper");
|
|
|
50
51
|
injectNodeSeverPlugin,
|
|
51
52
|
injectResourcePlugin,
|
|
52
53
|
loadCacheConfig,
|
|
53
|
-
|
|
54
|
+
loadServerCliConfig,
|
|
54
55
|
loadServerEnv,
|
|
55
56
|
loadServerPlugins,
|
|
57
|
+
loadServerRuntimeConfig,
|
|
56
58
|
sendResponse,
|
|
57
59
|
serverStaticPlugin,
|
|
58
60
|
writeReadableStreamToWritable
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { loadServerEnv } from "./loadEnv";
|
|
2
2
|
import { loadServerPlugins } from "./loadPlugin";
|
|
3
|
-
import {
|
|
3
|
+
import { loadServerRuntimeConfig, loadServerCliConfig } from "./loadConfig";
|
|
4
4
|
import { loadCacheConfig } from "./loadCache";
|
|
5
5
|
export {
|
|
6
6
|
loadCacheConfig,
|
|
7
|
-
|
|
7
|
+
loadServerCliConfig,
|
|
8
8
|
loadServerEnv,
|
|
9
|
-
loadServerPlugins
|
|
9
|
+
loadServerPlugins,
|
|
10
|
+
loadServerRuntimeConfig
|
|
10
11
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { compatRequire, fs, DEFAULT_SERVER_CONFIG, requireExistModule } from "@modern-js/utils";
|
|
2
|
+
import { compatRequire, fs, DEFAULT_SERVER_CONFIG, requireExistModule, ensureAbsolutePath, OUTPUT_CONFIG_FILE, lodash as _ } from "@modern-js/utils";
|
|
3
3
|
var requireConfig = function(serverConfigPath) {
|
|
4
4
|
if (fs.pathExistsSync(serverConfigPath)) {
|
|
5
5
|
return compatRequire(serverConfigPath);
|
|
@@ -18,7 +18,7 @@ function loadServerConfigOld(pwd, configFile) {
|
|
|
18
18
|
var serverConfig = requireConfig(serverConfigPath);
|
|
19
19
|
return serverConfig;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function loadServerRuntimeConfig(pwd) {
|
|
22
22
|
var oldServerFile = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DEFAULT_SERVER_CONFIG, newServerConfigPath = arguments.length > 2 ? arguments[2] : void 0;
|
|
23
23
|
var newServerConfig = newServerConfigPath && loadServerConfigNew(newServerConfigPath);
|
|
24
24
|
if (newServerConfig) {
|
|
@@ -27,6 +27,29 @@ function loadServerConfig(pwd) {
|
|
|
27
27
|
var oldServerConfig = loadServerConfigOld(pwd, oldServerFile);
|
|
28
28
|
return oldServerConfig;
|
|
29
29
|
}
|
|
30
|
+
function loadServerCliConfig(pwd) {
|
|
31
|
+
var defaultConfig = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
32
|
+
var _defaultConfig_output;
|
|
33
|
+
var cliConfigPath = ensureAbsolutePath(pwd, path.join(((_defaultConfig_output = defaultConfig.output) === null || _defaultConfig_output === void 0 ? void 0 : _defaultConfig_output.path) || "dist", OUTPUT_CONFIG_FILE));
|
|
34
|
+
var cliConfig = {
|
|
35
|
+
output: {},
|
|
36
|
+
source: {},
|
|
37
|
+
tools: {},
|
|
38
|
+
server: {},
|
|
39
|
+
security: {},
|
|
40
|
+
runtime: {},
|
|
41
|
+
bff: {},
|
|
42
|
+
html: {},
|
|
43
|
+
dev: {}
|
|
44
|
+
};
|
|
45
|
+
try {
|
|
46
|
+
cliConfig = require(cliConfigPath);
|
|
47
|
+
} catch (_2) {
|
|
48
|
+
}
|
|
49
|
+
var mergedCliConfig = _.merge(defaultConfig, cliConfig);
|
|
50
|
+
return mergedCliConfig;
|
|
51
|
+
}
|
|
30
52
|
export {
|
|
31
|
-
|
|
53
|
+
loadServerCliConfig,
|
|
54
|
+
loadServerRuntimeConfig
|
|
32
55
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { httpCallBack2HonoMid, connectMid2HonoMid } from "./hono";
|
|
2
2
|
import { createNodeServer, sendResponse, createWebRequest, writeReadableStreamToWritable } from "./node";
|
|
3
3
|
import { serverStaticPlugin, injectResourcePlugin, getHtmlTemplates, getServerManifest, injectNodeSeverPlugin } from "./plugins";
|
|
4
|
-
import { loadServerPlugins, loadServerEnv,
|
|
4
|
+
import { loadServerPlugins, loadServerEnv, loadServerRuntimeConfig, loadServerCliConfig, loadCacheConfig } from "./helper";
|
|
5
5
|
export {
|
|
6
6
|
connectMid2HonoMid,
|
|
7
7
|
createNodeServer,
|
|
@@ -12,9 +12,10 @@ export {
|
|
|
12
12
|
injectNodeSeverPlugin,
|
|
13
13
|
injectResourcePlugin,
|
|
14
14
|
loadCacheConfig,
|
|
15
|
-
|
|
15
|
+
loadServerCliConfig,
|
|
16
16
|
loadServerEnv,
|
|
17
17
|
loadServerPlugins,
|
|
18
|
+
loadServerRuntimeConfig,
|
|
18
19
|
sendResponse,
|
|
19
20
|
serverStaticPlugin,
|
|
20
21
|
writeReadableStreamToWritable
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { loadServerEnv } from "./loadEnv";
|
|
2
2
|
import { loadServerPlugins } from "./loadPlugin";
|
|
3
|
-
import {
|
|
3
|
+
import { loadServerRuntimeConfig, loadServerCliConfig } from "./loadConfig";
|
|
4
4
|
import { loadCacheConfig } from "./loadCache";
|
|
5
5
|
export {
|
|
6
6
|
loadCacheConfig,
|
|
7
|
-
|
|
7
|
+
loadServerCliConfig,
|
|
8
8
|
loadServerEnv,
|
|
9
|
-
loadServerPlugins
|
|
9
|
+
loadServerPlugins,
|
|
10
|
+
loadServerRuntimeConfig
|
|
10
11
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { compatRequire, fs, DEFAULT_SERVER_CONFIG, requireExistModule } from "@modern-js/utils";
|
|
2
|
+
import { compatRequire, fs, DEFAULT_SERVER_CONFIG, requireExistModule, ensureAbsolutePath, OUTPUT_CONFIG_FILE, lodash as _ } from "@modern-js/utils";
|
|
3
3
|
const requireConfig = (serverConfigPath) => {
|
|
4
4
|
if (fs.pathExistsSync(serverConfigPath)) {
|
|
5
5
|
return compatRequire(serverConfigPath);
|
|
@@ -18,7 +18,7 @@ function loadServerConfigOld(pwd, configFile) {
|
|
|
18
18
|
const serverConfig = requireConfig(serverConfigPath);
|
|
19
19
|
return serverConfig;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function loadServerRuntimeConfig(pwd, oldServerFile = DEFAULT_SERVER_CONFIG, newServerConfigPath) {
|
|
22
22
|
const newServerConfig = newServerConfigPath && loadServerConfigNew(newServerConfigPath);
|
|
23
23
|
if (newServerConfig) {
|
|
24
24
|
return newServerConfig;
|
|
@@ -26,6 +26,28 @@ function loadServerConfig(pwd, oldServerFile = DEFAULT_SERVER_CONFIG, newServerC
|
|
|
26
26
|
const oldServerConfig = loadServerConfigOld(pwd, oldServerFile);
|
|
27
27
|
return oldServerConfig;
|
|
28
28
|
}
|
|
29
|
+
function loadServerCliConfig(pwd, defaultConfig = {}) {
|
|
30
|
+
var _defaultConfig_output;
|
|
31
|
+
const cliConfigPath = ensureAbsolutePath(pwd, path.join(((_defaultConfig_output = defaultConfig.output) === null || _defaultConfig_output === void 0 ? void 0 : _defaultConfig_output.path) || "dist", OUTPUT_CONFIG_FILE));
|
|
32
|
+
let cliConfig = {
|
|
33
|
+
output: {},
|
|
34
|
+
source: {},
|
|
35
|
+
tools: {},
|
|
36
|
+
server: {},
|
|
37
|
+
security: {},
|
|
38
|
+
runtime: {},
|
|
39
|
+
bff: {},
|
|
40
|
+
html: {},
|
|
41
|
+
dev: {}
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
cliConfig = require(cliConfigPath);
|
|
45
|
+
} catch (_2) {
|
|
46
|
+
}
|
|
47
|
+
const mergedCliConfig = _.merge(defaultConfig, cliConfig);
|
|
48
|
+
return mergedCliConfig;
|
|
49
|
+
}
|
|
29
50
|
export {
|
|
30
|
-
|
|
51
|
+
loadServerCliConfig,
|
|
52
|
+
loadServerRuntimeConfig
|
|
31
53
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { httpCallBack2HonoMid, connectMid2HonoMid } from "./hono";
|
|
2
2
|
import { createNodeServer, sendResponse, createWebRequest, writeReadableStreamToWritable } from "./node";
|
|
3
3
|
import { serverStaticPlugin, injectResourcePlugin, getHtmlTemplates, getServerManifest, injectNodeSeverPlugin } from "./plugins";
|
|
4
|
-
import { loadServerPlugins, loadServerEnv,
|
|
4
|
+
import { loadServerPlugins, loadServerEnv, loadServerRuntimeConfig, loadServerCliConfig, loadCacheConfig } from "./helper";
|
|
5
5
|
export {
|
|
6
6
|
connectMid2HonoMid,
|
|
7
7
|
createNodeServer,
|
|
@@ -12,9 +12,10 @@ export {
|
|
|
12
12
|
injectNodeSeverPlugin,
|
|
13
13
|
injectResourcePlugin,
|
|
14
14
|
loadCacheConfig,
|
|
15
|
-
|
|
15
|
+
loadServerCliConfig,
|
|
16
16
|
loadServerEnv,
|
|
17
17
|
loadServerPlugins,
|
|
18
|
+
loadServerRuntimeConfig,
|
|
18
19
|
sendResponse,
|
|
19
20
|
serverStaticPlugin,
|
|
20
21
|
writeReadableStreamToWritable
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { loadServerEnv } from './loadEnv';
|
|
2
2
|
export { loadServerPlugins } from './loadPlugin';
|
|
3
|
-
export {
|
|
3
|
+
export { loadServerRuntimeConfig, loadServerCliConfig } from './loadConfig';
|
|
4
4
|
export { loadCacheConfig } from './loadCache';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { ServerConfig } from '../../../types';
|
|
2
|
-
export declare function
|
|
1
|
+
import { CliConfig, ServerConfig, UserConfig } from '../../../types';
|
|
2
|
+
export declare function loadServerRuntimeConfig(pwd: string, oldServerFile?: string, newServerConfigPath?: string): ServerConfig | undefined;
|
|
3
|
+
export declare function loadServerCliConfig(pwd: string, defaultConfig?: UserConfig): CliConfig;
|
|
@@ -2,4 +2,4 @@ export { httpCallBack2HonoMid, connectMid2HonoMid } from './hono';
|
|
|
2
2
|
export type { ServerNodeContext, ServerNodeMiddleware } from './hono';
|
|
3
3
|
export { createNodeServer, sendResponse, createWebRequest, writeReadableStreamToWritable, } from './node';
|
|
4
4
|
export { serverStaticPlugin, injectResourcePlugin, getHtmlTemplates, getServerManifest, injectNodeSeverPlugin, } from './plugins';
|
|
5
|
-
export { loadServerPlugins, loadServerEnv,
|
|
5
|
+
export { loadServerPlugins, loadServerEnv, loadServerRuntimeConfig, loadServerCliConfig, loadCacheConfig, } from './helper';
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.54.
|
|
18
|
+
"version": "2.54.3",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"hono": "^3.12.2",
|
|
54
54
|
"ts-deepmerge": "7.0.0",
|
|
55
55
|
"isbot": "3.8.0",
|
|
56
|
-
"@modern-js/plugin": "2.54.
|
|
57
|
-
"@modern-js/utils": "2.54.
|
|
58
|
-
"@modern-js/
|
|
56
|
+
"@modern-js/plugin": "2.54.3",
|
|
57
|
+
"@modern-js/runtime-utils": "2.54.3",
|
|
58
|
+
"@modern-js/utils": "2.54.3"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/jest": "^29",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"jest": "^29",
|
|
66
66
|
"ts-jest": "^29.1.0",
|
|
67
67
|
"typescript": "^5",
|
|
68
|
-
"@scripts/
|
|
69
|
-
"@
|
|
70
|
-
"@
|
|
68
|
+
"@scripts/jest-config": "2.54.3",
|
|
69
|
+
"@scripts/build": "2.54.3",
|
|
70
|
+
"@modern-js/types": "2.54.3"
|
|
71
71
|
},
|
|
72
72
|
"sideEffects": false,
|
|
73
73
|
"publishConfig": {
|