@modern-js/server-core 3.0.0-alpha.1 → 3.0.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/dist/cjs/adapters/node/plugins/resource.js +7 -7
- package/dist/cjs/index.js +18 -10
- package/dist/esm/adapters/node/helper/index.mjs +5 -5
- package/dist/esm/adapters/node/hono.mjs +1 -1
- package/dist/esm/adapters/node/index.mjs +4 -4
- package/dist/esm/adapters/node/node.mjs +1 -1
- package/dist/esm/adapters/node/plugins/index.mjs +3 -3
- package/dist/esm/adapters/node/plugins/resource.mjs +8 -8
- package/dist/esm/adapters/node/plugins/static.mjs +2 -2
- package/dist/esm/context.mjs +1 -1
- package/dist/esm/index.mjs +12 -12
- package/dist/esm/plugins/compat/index.mjs +1 -1
- package/dist/esm/plugins/default.mjs +6 -6
- package/dist/esm/plugins/index.mjs +8 -8
- package/dist/esm/plugins/log.mjs +1 -1
- package/dist/esm/plugins/monitors.mjs +1 -1
- package/dist/esm/plugins/render/csrRscRender.mjs +1 -1
- package/dist/esm/plugins/render/index.mjs +4 -4
- package/dist/esm/plugins/render/inject.mjs +1 -1
- package/dist/esm/plugins/render/render.mjs +7 -7
- package/dist/esm/plugins/render/renderRscHandler.mjs +1 -1
- package/dist/esm/plugins/render/ssrCache.mjs +2 -2
- package/dist/esm/plugins/render/ssrRender.mjs +4 -4
- package/dist/esm/plugins/route.mjs +1 -1
- package/dist/esm/serverBase.mjs +3 -3
- package/dist/esm/types/config/index.mjs +6 -6
- package/dist/esm/types/index.mjs +4 -4
- package/dist/esm/types/plugins/index.mjs +1 -1
- package/dist/esm/utils/error.mjs +1 -1
- package/dist/esm/utils/index.mjs +9 -9
- package/dist/esm-node/adapters/node/helper/index.mjs +1 -0
- package/dist/esm-node/adapters/node/helper/loadCache.mjs +1 -0
- package/dist/esm-node/adapters/node/helper/loadConfig.mjs +1 -0
- package/dist/esm-node/adapters/node/helper/loadEnv.mjs +1 -0
- package/dist/esm-node/adapters/node/helper/loadPlugin.mjs +1 -0
- package/dist/esm-node/adapters/node/helper/utils.mjs +1 -0
- package/dist/esm-node/adapters/node/hono.mjs +1 -0
- package/dist/esm-node/adapters/node/index.mjs +1 -0
- package/dist/esm-node/adapters/node/node.mjs +1 -0
- package/dist/esm-node/adapters/node/plugins/index.mjs +1 -0
- package/dist/esm-node/adapters/node/plugins/nodeServer.mjs +1 -0
- package/dist/esm-node/adapters/node/plugins/resource.mjs +8 -7
- package/dist/esm-node/adapters/node/plugins/static.mjs +1 -0
- package/dist/esm-node/constants.mjs +1 -0
- package/dist/esm-node/context.mjs +1 -0
- package/dist/esm-node/helper.mjs +1 -0
- package/dist/esm-node/hono.mjs +1 -0
- package/dist/esm-node/index.mjs +3 -2
- package/dist/esm-node/plugins/compat/hooks.mjs +1 -0
- package/dist/esm-node/plugins/compat/index.mjs +1 -0
- package/dist/esm-node/plugins/default.mjs +1 -0
- package/dist/esm-node/plugins/favicon.mjs +1 -0
- package/dist/esm-node/plugins/index.mjs +1 -0
- package/dist/esm-node/plugins/log.mjs +1 -0
- package/dist/esm-node/plugins/middlewares.mjs +1 -0
- package/dist/esm-node/plugins/monitors.mjs +1 -0
- package/dist/esm-node/plugins/processedBy.mjs +1 -0
- package/dist/esm-node/plugins/render/csrRscRender.mjs +1 -0
- package/dist/esm-node/plugins/render/dataHandler.mjs +1 -0
- package/dist/esm-node/plugins/render/index.mjs +1 -0
- package/dist/esm-node/plugins/render/inject.mjs +1 -0
- package/dist/esm-node/plugins/render/render.mjs +1 -0
- package/dist/esm-node/plugins/render/renderRscHandler.mjs +1 -0
- package/dist/esm-node/plugins/render/serverActionHandler.mjs +1 -0
- package/dist/esm-node/plugins/render/ssrCache.mjs +1 -0
- package/dist/esm-node/plugins/render/ssrRender.mjs +1 -0
- package/dist/esm-node/plugins/render/utils.mjs +1 -0
- package/dist/esm-node/plugins/route.mjs +1 -0
- package/dist/esm-node/serverBase.mjs +1 -0
- package/dist/esm-node/types/config/bff.mjs +1 -0
- package/dist/esm-node/types/config/dev.mjs +1 -0
- package/dist/esm-node/types/config/html.mjs +1 -0
- package/dist/esm-node/types/config/index.mjs +1 -0
- package/dist/esm-node/types/config/output.mjs +1 -0
- package/dist/esm-node/types/config/security.mjs +1 -0
- package/dist/esm-node/types/config/server.mjs +1 -0
- package/dist/esm-node/types/config/share.mjs +1 -0
- package/dist/esm-node/types/config/source.mjs +1 -0
- package/dist/esm-node/types/config/tools.mjs +1 -0
- package/dist/esm-node/types/index.mjs +1 -0
- package/dist/esm-node/types/plugins/base.mjs +1 -0
- package/dist/esm-node/types/plugins/index.mjs +1 -0
- package/dist/esm-node/types/plugins/plugin.mjs +1 -0
- package/dist/esm-node/types/render.mjs +1 -0
- package/dist/esm-node/types/requestHandler.mjs +1 -0
- package/dist/esm-node/types/server.mjs +1 -0
- package/dist/esm-node/utils/entry.mjs +1 -0
- package/dist/esm-node/utils/env.mjs +1 -0
- package/dist/esm-node/utils/error.mjs +1 -0
- package/dist/esm-node/utils/index.mjs +1 -0
- package/dist/esm-node/utils/middlewareCollector.mjs +1 -0
- package/dist/esm-node/utils/publicDir.mjs +1 -0
- package/dist/esm-node/utils/request.mjs +1 -0
- package/dist/esm-node/utils/serverConfig.mjs +1 -0
- package/dist/esm-node/utils/storage.mjs +1 -0
- package/dist/esm-node/utils/transformStream.mjs +1 -0
- package/dist/esm-node/utils/warmup.mjs +1 -0
- package/dist/types/adapters/node/plugins/resource.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/config/server.d.ts +1 -1
- package/dist/types/types/config/tools.d.ts +1 -7
- package/package.json +23 -14
|
@@ -73,25 +73,25 @@ function injectTemplates(pwd, routes, htmlTemplatePromise) {
|
|
|
73
73
|
await next();
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
const loadBundle = async (filepath,
|
|
76
|
+
const loadBundle = async (filepath, monitors)=>{
|
|
77
77
|
if (!await utils_namespaceObject.fs.pathExists(filepath)) return;
|
|
78
78
|
try {
|
|
79
79
|
const module = await (0, utils_namespaceObject.compatibleRequire)(filepath, false);
|
|
80
80
|
return module;
|
|
81
81
|
} catch (e) {
|
|
82
|
-
|
|
82
|
+
monitors.error(`Load ${filepath} bundle failed, error = %s`, e instanceof Error ? e.stack || e.message : e);
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
async function getServerManifest(pwd, routes,
|
|
86
|
+
async function getServerManifest(pwd, routes, monitors) {
|
|
87
87
|
const loaderBundles = {};
|
|
88
88
|
const renderBundles = {};
|
|
89
89
|
await Promise.all(routes.filter((route)=>Boolean(route.bundle)).map(async (route)=>{
|
|
90
90
|
const entryName = route.entryName || utils_namespaceObject.MAIN_ENTRY_NAME;
|
|
91
91
|
const renderBundlePath = external_path_default().join(pwd, route.bundle || '');
|
|
92
92
|
const loaderBundlePath = external_path_default().join(pwd, utils_namespaceObject.SERVER_BUNDLE_DIRECTORY, `${entryName}-server-loaders.js`);
|
|
93
|
-
const renderBundle = await loadBundle(renderBundlePath,
|
|
94
|
-
const loaderBundle = await loadBundle(loaderBundlePath,
|
|
93
|
+
const renderBundle = await loadBundle(renderBundlePath, monitors);
|
|
94
|
+
const loaderBundle = await loadBundle(loaderBundlePath, monitors);
|
|
95
95
|
renderBundle && (renderBundles[entryName] = renderBundle);
|
|
96
96
|
loaderBundle && (loaderBundles[entryName] = loaderBundle?.loadModules ? await loaderBundle?.loadModules() : loaderBundle);
|
|
97
97
|
}));
|
|
@@ -112,8 +112,8 @@ async function getServerManifest(pwd, routes, logger) {
|
|
|
112
112
|
function injectServerManifest(pwd, routes, manifestPromise) {
|
|
113
113
|
return async (c, next)=>{
|
|
114
114
|
if (routes && !c.get('serverManifest')) {
|
|
115
|
-
const
|
|
116
|
-
const serverManifest = await (manifestPromise || getServerManifest(pwd, routes,
|
|
115
|
+
const monitors = c.get('monitors');
|
|
116
|
+
const serverManifest = await (manifestPromise || getServerManifest(pwd, routes, monitors));
|
|
117
117
|
c.set('serverManifest', serverManifest);
|
|
118
118
|
}
|
|
119
119
|
await next();
|
package/dist/cjs/index.js
CHANGED
|
@@ -94,6 +94,7 @@ var __webpack_exports__ = {};
|
|
|
94
94
|
normalizePublicDirPath: ()=>_utils_publicDir__rspack_import_1.normalizePublicDirPath,
|
|
95
95
|
onError: ()=>_utils__rspack_import_0.onError,
|
|
96
96
|
resolvePublicDirPaths: ()=>_utils_publicDir__rspack_import_1.resolvePublicDirPaths,
|
|
97
|
+
run: ()=>_context__rspack_import_4.run,
|
|
97
98
|
useHonoContext: ()=>_context__rspack_import_4.useHonoContext
|
|
98
99
|
});
|
|
99
100
|
var _utils__rspack_import_0 = __webpack_require__("./utils");
|
|
@@ -116,10 +117,11 @@ var __webpack_exports__ = {};
|
|
|
116
117
|
"normalizePublicDirPath",
|
|
117
118
|
"onError",
|
|
118
119
|
"ErrorDigest",
|
|
119
|
-
"getLoaderCtx",
|
|
120
|
-
"getPublicDirRoutePrefixes",
|
|
121
120
|
"getPublicDirPatterns",
|
|
121
|
+
"getPublicDirRoutePrefixes",
|
|
122
122
|
"getPublicDirConfig",
|
|
123
|
+
"getLoaderCtx",
|
|
124
|
+
"run",
|
|
123
125
|
"AGGRED_DIR"
|
|
124
126
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_plugins__rspack_import_7[__rspack_import_key];
|
|
125
127
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
@@ -136,10 +138,11 @@ var __webpack_exports__ = {};
|
|
|
136
138
|
"normalizePublicDirPath",
|
|
137
139
|
"onError",
|
|
138
140
|
"ErrorDigest",
|
|
139
|
-
"getLoaderCtx",
|
|
140
|
-
"getPublicDirRoutePrefixes",
|
|
141
141
|
"getPublicDirPatterns",
|
|
142
|
+
"getPublicDirRoutePrefixes",
|
|
142
143
|
"getPublicDirConfig",
|
|
144
|
+
"getLoaderCtx",
|
|
145
|
+
"run",
|
|
143
146
|
"AGGRED_DIR"
|
|
144
147
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types_plugins__rspack_import_8[__rspack_import_key];
|
|
145
148
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
@@ -156,10 +159,11 @@ var __webpack_exports__ = {};
|
|
|
156
159
|
"normalizePublicDirPath",
|
|
157
160
|
"onError",
|
|
158
161
|
"ErrorDigest",
|
|
159
|
-
"getLoaderCtx",
|
|
160
|
-
"getPublicDirRoutePrefixes",
|
|
161
162
|
"getPublicDirPatterns",
|
|
163
|
+
"getPublicDirRoutePrefixes",
|
|
162
164
|
"getPublicDirConfig",
|
|
165
|
+
"getLoaderCtx",
|
|
166
|
+
"run",
|
|
163
167
|
"AGGRED_DIR"
|
|
164
168
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types_render__rspack_import_9[__rspack_import_key];
|
|
165
169
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
@@ -176,10 +180,11 @@ var __webpack_exports__ = {};
|
|
|
176
180
|
"normalizePublicDirPath",
|
|
177
181
|
"onError",
|
|
178
182
|
"ErrorDigest",
|
|
179
|
-
"getLoaderCtx",
|
|
180
|
-
"getPublicDirRoutePrefixes",
|
|
181
183
|
"getPublicDirPatterns",
|
|
184
|
+
"getPublicDirRoutePrefixes",
|
|
182
185
|
"getPublicDirConfig",
|
|
186
|
+
"getLoaderCtx",
|
|
187
|
+
"run",
|
|
183
188
|
"AGGRED_DIR"
|
|
184
189
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types_config__rspack_import_10[__rspack_import_key];
|
|
185
190
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
@@ -196,10 +201,11 @@ var __webpack_exports__ = {};
|
|
|
196
201
|
"normalizePublicDirPath",
|
|
197
202
|
"onError",
|
|
198
203
|
"ErrorDigest",
|
|
199
|
-
"getLoaderCtx",
|
|
200
|
-
"getPublicDirRoutePrefixes",
|
|
201
204
|
"getPublicDirPatterns",
|
|
205
|
+
"getPublicDirRoutePrefixes",
|
|
202
206
|
"getPublicDirConfig",
|
|
207
|
+
"getLoaderCtx",
|
|
208
|
+
"run",
|
|
203
209
|
"AGGRED_DIR"
|
|
204
210
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types_requestHandler__rspack_import_11[__rspack_import_key];
|
|
205
211
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
@@ -217,6 +223,7 @@ exports.normalizePublicDir = __webpack_exports__.normalizePublicDir;
|
|
|
217
223
|
exports.normalizePublicDirPath = __webpack_exports__.normalizePublicDirPath;
|
|
218
224
|
exports.onError = __webpack_exports__.onError;
|
|
219
225
|
exports.resolvePublicDirPaths = __webpack_exports__.resolvePublicDirPaths;
|
|
226
|
+
exports.run = __webpack_exports__.run;
|
|
220
227
|
exports.useHonoContext = __webpack_exports__.useHonoContext;
|
|
221
228
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
222
229
|
"AGGRED_DIR",
|
|
@@ -232,6 +239,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
232
239
|
"normalizePublicDirPath",
|
|
233
240
|
"onError",
|
|
234
241
|
"resolvePublicDirPaths",
|
|
242
|
+
"run",
|
|
235
243
|
"useHonoContext"
|
|
236
244
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
237
245
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { loadServerEnv } from "./loadEnv";
|
|
2
|
-
import { loadServerPlugins } from "./loadPlugin";
|
|
3
|
-
import { loadServerCliConfig, loadServerRuntimeConfig } from "./loadConfig";
|
|
4
|
-
import { loadCacheConfig } from "./loadCache";
|
|
5
|
-
import { isResFinalized } from "./utils";
|
|
1
|
+
import { loadServerEnv } from "./loadEnv.mjs";
|
|
2
|
+
import { loadServerPlugins } from "./loadPlugin.mjs";
|
|
3
|
+
import { loadServerCliConfig, loadServerRuntimeConfig } from "./loadConfig.mjs";
|
|
4
|
+
import { loadCacheConfig } from "./loadCache.mjs";
|
|
5
|
+
import { isResFinalized } from "./utils.mjs";
|
|
6
6
|
export { isResFinalized, loadCacheConfig, loadServerCliConfig, loadServerEnv, loadServerPlugins, loadServerRuntimeConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { connectMid2HonoMid, connectMockMid2HonoMid, httpCallBack2HonoMid } from "./hono";
|
|
2
|
-
import { createNodeServer, createWebRequest, sendResponse } from "./node";
|
|
3
|
-
import { getHtmlTemplates, getServerManifest, injectNodeSeverPlugin, injectResourcePlugin, injectRscManifestPlugin, serverStaticPlugin } from "./plugins";
|
|
4
|
-
import { loadCacheConfig, loadServerCliConfig, loadServerEnv, loadServerPlugins, loadServerRuntimeConfig } from "./helper";
|
|
1
|
+
import { connectMid2HonoMid, connectMockMid2HonoMid, httpCallBack2HonoMid } from "./hono.mjs";
|
|
2
|
+
import { createNodeServer, createWebRequest, sendResponse } from "./node.mjs";
|
|
3
|
+
import { getHtmlTemplates, getServerManifest, injectNodeSeverPlugin, injectResourcePlugin, injectRscManifestPlugin, serverStaticPlugin } from "./plugins/index.mjs";
|
|
4
|
+
import { loadCacheConfig, loadServerCliConfig, loadServerEnv, loadServerPlugins, loadServerRuntimeConfig } from "./helper/index.mjs";
|
|
5
5
|
export { connectMid2HonoMid, connectMockMid2HonoMid, createNodeServer, createWebRequest, getHtmlTemplates, getServerManifest, httpCallBack2HonoMid, injectNodeSeverPlugin, injectResourcePlugin, injectRscManifestPlugin, loadCacheConfig, loadServerCliConfig, loadServerEnv, loadServerPlugins, loadServerRuntimeConfig, sendResponse, serverStaticPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ServerResponse } from "node:http";
|
|
2
2
|
import { Readable, Writable } from "node:stream";
|
|
3
3
|
import cloneable_readable from "cloneable-readable";
|
|
4
|
-
import { isResFinalized } from "./helper";
|
|
4
|
+
import { isResFinalized } from "./helper/index.mjs";
|
|
5
5
|
const createWebRequest = (req, res, body)=>{
|
|
6
6
|
const headerRecord = [];
|
|
7
7
|
for (const [key, value] of Object.entries(req.headers))if (!key.startsWith(':')) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./static";
|
|
2
|
-
export * from "./resource";
|
|
3
|
-
export * from "./nodeServer";
|
|
1
|
+
export * from "./static.mjs";
|
|
2
|
+
export * from "./resource.mjs";
|
|
3
|
+
export * from "./nodeServer.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { fileReader } from "@modern-js/runtime-utils/fileReader";
|
|
3
3
|
import { LOADABLE_STATS_FILE, MAIN_ENTRY_NAME, NESTED_ROUTE_SPEC_FILE, ROUTE_MANIFEST_FILE, SERVER_BUNDLE_DIRECTORY, compatibleRequire, fs, isProd } from "@modern-js/utils";
|
|
4
|
-
import { uniqueKeyByRoute } from "../../../utils";
|
|
4
|
+
import { uniqueKeyByRoute } from "../../../utils/index.mjs";
|
|
5
5
|
async function getHtmlTemplates(pwd, routes) {
|
|
6
6
|
const htmlRoutes = routes.filter((route)=>route.entryName);
|
|
7
7
|
const htmls = await Promise.all(htmlRoutes.map(async (route)=>{
|
|
@@ -27,25 +27,25 @@ function injectTemplates(pwd, routes, htmlTemplatePromise) {
|
|
|
27
27
|
await next();
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
const loadBundle = async (filepath,
|
|
30
|
+
const loadBundle = async (filepath, monitors)=>{
|
|
31
31
|
if (!await fs.pathExists(filepath)) return;
|
|
32
32
|
try {
|
|
33
33
|
const module = await compatibleRequire(filepath, false);
|
|
34
34
|
return module;
|
|
35
35
|
} catch (e) {
|
|
36
|
-
|
|
36
|
+
monitors.error(`Load ${filepath} bundle failed, error = %s`, e instanceof Error ? e.stack || e.message : e);
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
async function getServerManifest(pwd, routes,
|
|
40
|
+
async function getServerManifest(pwd, routes, monitors) {
|
|
41
41
|
const loaderBundles = {};
|
|
42
42
|
const renderBundles = {};
|
|
43
43
|
await Promise.all(routes.filter((route)=>Boolean(route.bundle)).map(async (route)=>{
|
|
44
44
|
const entryName = route.entryName || MAIN_ENTRY_NAME;
|
|
45
45
|
const renderBundlePath = path.join(pwd, route.bundle || '');
|
|
46
46
|
const loaderBundlePath = path.join(pwd, SERVER_BUNDLE_DIRECTORY, `${entryName}-server-loaders.js`);
|
|
47
|
-
const renderBundle = await loadBundle(renderBundlePath,
|
|
48
|
-
const loaderBundle = await loadBundle(loaderBundlePath,
|
|
47
|
+
const renderBundle = await loadBundle(renderBundlePath, monitors);
|
|
48
|
+
const loaderBundle = await loadBundle(loaderBundlePath, monitors);
|
|
49
49
|
renderBundle && (renderBundles[entryName] = renderBundle);
|
|
50
50
|
loaderBundle && (loaderBundles[entryName] = loaderBundle?.loadModules ? await loaderBundle?.loadModules() : loaderBundle);
|
|
51
51
|
}));
|
|
@@ -66,8 +66,8 @@ async function getServerManifest(pwd, routes, logger) {
|
|
|
66
66
|
function injectServerManifest(pwd, routes, manifestPromise) {
|
|
67
67
|
return async (c, next)=>{
|
|
68
68
|
if (routes && !c.get('serverManifest')) {
|
|
69
|
-
const
|
|
70
|
-
const serverManifest = await (manifestPromise || getServerManifest(pwd, routes,
|
|
69
|
+
const monitors = c.get('monitors');
|
|
70
|
+
const serverManifest = await (manifestPromise || getServerManifest(pwd, routes, monitors));
|
|
71
71
|
c.set('serverManifest', serverManifest);
|
|
72
72
|
}
|
|
73
73
|
await next();
|
|
@@ -2,8 +2,8 @@ import path from "path";
|
|
|
2
2
|
import { fileReader } from "@modern-js/runtime-utils/fileReader";
|
|
3
3
|
import { fs } from "@modern-js/utils";
|
|
4
4
|
import { getMimeType } from "hono/utils/mime";
|
|
5
|
-
import { sortRoutes } from "../../../utils";
|
|
6
|
-
import { getPublicDirPatterns } from "../../../utils/publicDir";
|
|
5
|
+
import { sortRoutes } from "../../../utils/index.mjs";
|
|
6
|
+
import { getPublicDirPatterns } from "../../../utils/publicDir.mjs";
|
|
7
7
|
const serverStaticPlugin = ()=>({
|
|
8
8
|
name: '@modern-js/plugin-server-static',
|
|
9
9
|
setup (api) {
|
package/dist/esm/context.mjs
CHANGED
package/dist/esm/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ErrorDigest, createErrorHtml, onError } from "./utils";
|
|
2
|
-
import { getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, resolvePublicDirPaths } from "./utils/publicDir";
|
|
3
|
-
import { AGGRED_DIR } from "./constants";
|
|
4
|
-
import { createServerBase } from "./serverBase";
|
|
5
|
-
import { useHonoContext } from "./context";
|
|
1
|
+
import { ErrorDigest, createErrorHtml, onError } from "./utils/index.mjs";
|
|
2
|
+
import { getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, resolvePublicDirPaths } from "./utils/publicDir.mjs";
|
|
3
|
+
import { AGGRED_DIR } from "./constants.mjs";
|
|
4
|
+
import { createServerBase } from "./serverBase.mjs";
|
|
5
|
+
import { run, useHonoContext } from "./context.mjs";
|
|
6
6
|
import { Hono } from "hono";
|
|
7
|
-
import { getLoaderCtx } from "./helper";
|
|
8
|
-
export * from "./plugins";
|
|
9
|
-
export * from "./types/plugins";
|
|
10
|
-
export * from "./types/render";
|
|
11
|
-
export * from "./types/config";
|
|
12
|
-
export * from "./types/requestHandler";
|
|
13
|
-
export { AGGRED_DIR, ErrorDigest, Hono, createErrorHtml, createServerBase, getLoaderCtx, getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, onError, resolvePublicDirPaths, useHonoContext };
|
|
7
|
+
import { getLoaderCtx } from "./helper.mjs";
|
|
8
|
+
export * from "./plugins/index.mjs";
|
|
9
|
+
export * from "./types/plugins/index.mjs";
|
|
10
|
+
export * from "./types/render.mjs";
|
|
11
|
+
export * from "./types/config/index.mjs";
|
|
12
|
+
export * from "./types/requestHandler.mjs";
|
|
13
|
+
export { AGGRED_DIR, ErrorDigest, Hono, createErrorHtml, createServerBase, getLoaderCtx, getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, onError, resolvePublicDirPaths, run, useHonoContext };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createAsyncHook, createAsyncPipelineHook } from "@modern-js/plugin";
|
|
2
|
-
import { getHookRunners, handleSetupResult } from "./hooks";
|
|
2
|
+
import { getHookRunners, handleSetupResult } from "./hooks.mjs";
|
|
3
3
|
const compatPlugin = ()=>({
|
|
4
4
|
name: '@modern-js/server-compat',
|
|
5
5
|
registryHooks: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { compatPlugin } from "./compat";
|
|
2
|
-
import { logPlugin } from "./log";
|
|
3
|
-
import { initMonitorsPlugin, injectServerTiming, injectloggerPlugin } from "./monitors";
|
|
4
|
-
import { processedByPlugin } from "./processedBy";
|
|
5
|
-
import { injectRenderHandlerPlugin } from "./render";
|
|
6
|
-
import { injectRoutePlugin } from "./route";
|
|
1
|
+
import { compatPlugin } from "./compat/index.mjs";
|
|
2
|
+
import { logPlugin } from "./log.mjs";
|
|
3
|
+
import { initMonitorsPlugin, injectServerTiming, injectloggerPlugin } from "./monitors.mjs";
|
|
4
|
+
import { processedByPlugin } from "./processedBy.mjs";
|
|
5
|
+
import { injectRenderHandlerPlugin } from "./render/index.mjs";
|
|
6
|
+
import { injectRoutePlugin } from "./route.mjs";
|
|
7
7
|
function createSilenceLogger() {
|
|
8
8
|
return new Proxy({}, {
|
|
9
9
|
get: ()=>()=>{}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getRenderHandler, injectRenderHandlerPlugin, renderPlugin } from "./render";
|
|
2
|
-
import { faviconPlugin } from "./favicon";
|
|
3
|
-
import { injectServerTiming, injectloggerPlugin } from "./monitors";
|
|
4
|
-
import { processedByPlugin } from "./processedBy";
|
|
5
|
-
import { logPlugin } from "./log";
|
|
6
|
-
import { createDefaultPlugins } from "./default";
|
|
7
|
-
import { compatPlugin, handleSetupResult } from "./compat";
|
|
8
|
-
import { injectConfigMiddlewarePlugin } from "./middlewares";
|
|
1
|
+
import { getRenderHandler, injectRenderHandlerPlugin, renderPlugin } from "./render/index.mjs";
|
|
2
|
+
import { faviconPlugin } from "./favicon.mjs";
|
|
3
|
+
import { injectServerTiming, injectloggerPlugin } from "./monitors.mjs";
|
|
4
|
+
import { processedByPlugin } from "./processedBy.mjs";
|
|
5
|
+
import { logPlugin } from "./log.mjs";
|
|
6
|
+
import { createDefaultPlugins } from "./default.mjs";
|
|
7
|
+
import { compatPlugin, handleSetupResult } from "./compat/index.mjs";
|
|
8
|
+
import { injectConfigMiddlewarePlugin } from "./middlewares.mjs";
|
|
9
9
|
export { compatPlugin, createDefaultPlugins, faviconPlugin, getRenderHandler, handleSetupResult, injectConfigMiddlewarePlugin, injectRenderHandlerPlugin, injectServerTiming, injectloggerPlugin, logPlugin, processedByPlugin, renderPlugin };
|
package/dist/esm/plugins/log.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { time } from "@modern-js/runtime-utils/time";
|
|
2
|
-
import { SERVER_TIMING, ServerTimings } from "../constants";
|
|
2
|
+
import { SERVER_TIMING, ServerTimings } from "../constants.mjs";
|
|
3
3
|
function createMonitors() {
|
|
4
4
|
const coreMonitors = [];
|
|
5
5
|
const log = (level, message, args)=>{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MAIN_ENTRY_NAME } from "@modern-js/utils/universal/constants";
|
|
2
|
-
import { createRequestHandlerConfig } from "./utils";
|
|
2
|
+
import { createRequestHandlerConfig } from "./utils.mjs";
|
|
3
3
|
const csrRscRender = async (req, options)=>{
|
|
4
4
|
const { routeInfo, serverManifest, rscSSRManifest, rscClientManifest, rscServerManifest, locals, params, loaderContext, reporter, monitors, onError, onTiming, staticGenerate, html } = options;
|
|
5
5
|
const serverBundle = serverManifest?.renderBundles?.[routeInfo.entryName || MAIN_ENTRY_NAME];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getLoaderCtx } from "../../helper";
|
|
2
|
-
import { sortRoutes } from "../../utils";
|
|
3
|
-
import { requestLatencyMiddleware } from "../monitors";
|
|
4
|
-
export * from "./inject";
|
|
1
|
+
import { getLoaderCtx } from "../../helper.mjs";
|
|
2
|
+
import { sortRoutes } from "../../utils/index.mjs";
|
|
3
|
+
import { requestLatencyMiddleware } from "../monitors.mjs";
|
|
4
|
+
export * from "./inject.mjs";
|
|
5
5
|
const DYNAMIC_ROUTE_REG = /\/:./;
|
|
6
6
|
function escapeRegexSpecialChars(path) {
|
|
7
7
|
return path.replace(/[()[\]{}*+?.^$|\\]/g, '\\$&');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as __rspack_external__modern_js_runtime_utils_router_2aa8d96f from "@modern-js/runtime-utils/router";
|
|
2
2
|
import { cutNameByHyphen } from "@modern-js/utils/universal";
|
|
3
3
|
import { TrieRouter } from "hono/router/trie-router";
|
|
4
|
-
import { X_MODERNJS_RENDER } from "../../constants";
|
|
5
|
-
import { ErrorDigest, createErrorHtml, getPathname, getRuntimeEnv, parseHeaders, parseQuery, sortRoutes, uniqueKeyByRoute } from "../../utils";
|
|
6
|
-
import { csrRscRender } from "./csrRscRender";
|
|
7
|
-
import { dataHandler } from "./dataHandler";
|
|
8
|
-
import { renderRscHandler } from "./renderRscHandler";
|
|
9
|
-
import { serverActionHandler } from "./serverActionHandler";
|
|
10
|
-
import { ssrRender } from "./ssrRender";
|
|
4
|
+
import { X_MODERNJS_RENDER } from "../../constants.mjs";
|
|
5
|
+
import { ErrorDigest, createErrorHtml, getPathname, getRuntimeEnv, parseHeaders, parseQuery, sortRoutes, uniqueKeyByRoute } from "../../utils/index.mjs";
|
|
6
|
+
import { csrRscRender } from "./csrRscRender.mjs";
|
|
7
|
+
import { dataHandler } from "./dataHandler.mjs";
|
|
8
|
+
import { renderRscHandler } from "./renderRscHandler.mjs";
|
|
9
|
+
import { serverActionHandler } from "./serverActionHandler.mjs";
|
|
10
|
+
import { ssrRender } from "./ssrRender.mjs";
|
|
11
11
|
var __webpack_modules__ = {
|
|
12
12
|
"@modern-js/runtime-utils/router" (module) {
|
|
13
13
|
module.exports = __rspack_external__modern_js_runtime_utils_router_2aa8d96f;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MAIN_ENTRY_NAME } from "@modern-js/utils/universal/constants";
|
|
2
|
-
import { createRequestHandlerConfig } from "./utils";
|
|
2
|
+
import { createRequestHandlerConfig } from "./utils.mjs";
|
|
3
3
|
const renderRscHandler = async (req, options)=>{
|
|
4
4
|
const { routeInfo, serverManifest, rscSSRManifest, rscClientManifest, rscServerManifest, locals, params, loaderContext, monitors, onError, onTiming, staticGenerate } = options;
|
|
5
5
|
const serverBundle = serverManifest?.renderBundles?.[routeInfo.entryName || MAIN_ENTRY_NAME];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createMemoryStorage } from "@modern-js/runtime-utils/storer";
|
|
2
|
-
import { X_RENDER_CACHE } from "../../constants";
|
|
3
|
-
import { createTransformStream, getPathname } from "../../utils";
|
|
2
|
+
import { X_RENDER_CACHE } from "../../constants.mjs";
|
|
3
|
+
import { createTransformStream, getPathname } from "../../utils/index.mjs";
|
|
4
4
|
const removeTailSlash = (s)=>s.replace(/\/+$/, '');
|
|
5
5
|
const ZERO_RENDER_LEVEL = /"renderLevel":0/;
|
|
6
6
|
const NO_SSR_CACHE = /<meta\s+[^>]*name=["']no-ssr-cache["'][^>]*>/i;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MAIN_ENTRY_NAME } from "@modern-js/utils/universal/constants";
|
|
2
|
-
import { X_MODERNJS_RENDER } from "../../constants";
|
|
3
|
-
import { getPathname, parseHeaders } from "../../utils";
|
|
4
|
-
import { getCacheResult, matchCacheControl, shouldUseCache } from "./ssrCache";
|
|
5
|
-
import { createRequestHandlerConfig } from "./utils";
|
|
2
|
+
import { X_MODERNJS_RENDER } from "../../constants.mjs";
|
|
3
|
+
import { getPathname, parseHeaders } from "../../utils/index.mjs";
|
|
4
|
+
import { getCacheResult, matchCacheControl, shouldUseCache } from "./ssrCache.mjs";
|
|
5
|
+
import { createRequestHandlerConfig } from "./utils.mjs";
|
|
6
6
|
const SERVER_RUNTIME_ENTRY = 'requestHandler';
|
|
7
7
|
async function ssrRender(request, { routeInfo, html, config: userConfig, staticGenerate, nodeReq, serverManifest, rscSSRManifest, rscClientManifest, rscServerManifest, locals, params, loaderContext, monitors, cacheConfig, onError, onTiming, reporter }) {
|
|
8
8
|
const { entryName } = routeInfo;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MAIN_ENTRY_NAME } from "@modern-js/utils/universal/constants";
|
|
2
|
-
import { sortRoutes } from "../utils";
|
|
2
|
+
import { sortRoutes } from "../utils/index.mjs";
|
|
3
3
|
function injectRoute(route) {
|
|
4
4
|
return async (c, next)=>{
|
|
5
5
|
if (route && !c.get('route')) c.set('route', route);
|
package/dist/esm/serverBase.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { server as server_server } from "@modern-js/plugin/server";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import { run } from "./context";
|
|
4
|
-
import { handleSetupResult } from "./plugins/compat/hooks";
|
|
5
|
-
import { loadConfig } from "./utils";
|
|
3
|
+
import { run } from "./context.mjs";
|
|
4
|
+
import { handleSetupResult } from "./plugins/compat/hooks.mjs";
|
|
5
|
+
import { loadConfig } from "./utils/index.mjs";
|
|
6
6
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
7
7
|
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
8
8
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./bff";
|
|
2
|
-
export * from "./html";
|
|
3
|
-
export * from "./output";
|
|
4
|
-
export * from "./server";
|
|
5
|
-
export * from "./source";
|
|
6
|
-
export * from "./tools";
|
|
1
|
+
export * from "./bff.mjs";
|
|
2
|
+
export * from "./html.mjs";
|
|
3
|
+
export * from "./output.mjs";
|
|
4
|
+
export * from "./server.mjs";
|
|
5
|
+
export * from "./source.mjs";
|
|
6
|
+
export * from "./tools.mjs";
|
package/dist/esm/types/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./config";
|
|
2
|
-
export * from "./plugins";
|
|
3
|
-
export * from "./render";
|
|
4
|
-
export * from "./server";
|
|
1
|
+
export * from "./config/index.mjs";
|
|
2
|
+
export * from "./plugins/index.mjs";
|
|
3
|
+
export * from "./render.mjs";
|
|
4
|
+
export * from "./server.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./plugin";
|
|
1
|
+
export * from "./plugin.mjs";
|
package/dist/esm/utils/error.mjs
CHANGED
package/dist/esm/utils/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./env";
|
|
2
|
-
export * from "./transformStream";
|
|
3
|
-
export * from "./middlewareCollector";
|
|
4
|
-
export * from "./error";
|
|
5
|
-
export * from "./warmup";
|
|
6
|
-
export * from "./entry";
|
|
7
|
-
export * from "./request";
|
|
8
|
-
export * from "./serverConfig";
|
|
9
|
-
export * from "./publicDir";
|
|
1
|
+
export * from "./env.mjs";
|
|
2
|
+
export * from "./transformStream.mjs";
|
|
3
|
+
export * from "./middlewareCollector.mjs";
|
|
4
|
+
export * from "./error.mjs";
|
|
5
|
+
export * from "./warmup.mjs";
|
|
6
|
+
export * from "./entry.mjs";
|
|
7
|
+
export * from "./request.mjs";
|
|
8
|
+
export * from "./serverConfig.mjs";
|
|
9
|
+
export * from "./publicDir.mjs";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "node:module";
|
|
1
2
|
import { connectMid2HonoMid, connectMockMid2HonoMid, httpCallBack2HonoMid } from "./hono.mjs";
|
|
2
3
|
import { createNodeServer, createWebRequest, sendResponse } from "./node.mjs";
|
|
3
4
|
import { getHtmlTemplates, getServerManifest, injectNodeSeverPlugin, injectResourcePlugin, injectRscManifestPlugin, serverStaticPlugin } from "./plugins/index.mjs";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "node:module";
|
|
1
2
|
import path from "path";
|
|
2
3
|
import { fileReader } from "@modern-js/runtime-utils/fileReader";
|
|
3
4
|
import { LOADABLE_STATS_FILE, MAIN_ENTRY_NAME, NESTED_ROUTE_SPEC_FILE, ROUTE_MANIFEST_FILE, SERVER_BUNDLE_DIRECTORY, compatibleRequire, fs, isProd } from "@modern-js/utils";
|
|
@@ -27,25 +28,25 @@ function injectTemplates(pwd, routes, htmlTemplatePromise) {
|
|
|
27
28
|
await next();
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
|
-
const loadBundle = async (filepath,
|
|
31
|
+
const loadBundle = async (filepath, monitors)=>{
|
|
31
32
|
if (!await fs.pathExists(filepath)) return;
|
|
32
33
|
try {
|
|
33
34
|
const module = await compatibleRequire(filepath, false);
|
|
34
35
|
return module;
|
|
35
36
|
} catch (e) {
|
|
36
|
-
|
|
37
|
+
monitors.error(`Load ${filepath} bundle failed, error = %s`, e instanceof Error ? e.stack || e.message : e);
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
|
-
async function getServerManifest(pwd, routes,
|
|
41
|
+
async function getServerManifest(pwd, routes, monitors) {
|
|
41
42
|
const loaderBundles = {};
|
|
42
43
|
const renderBundles = {};
|
|
43
44
|
await Promise.all(routes.filter((route)=>Boolean(route.bundle)).map(async (route)=>{
|
|
44
45
|
const entryName = route.entryName || MAIN_ENTRY_NAME;
|
|
45
46
|
const renderBundlePath = path.join(pwd, route.bundle || '');
|
|
46
47
|
const loaderBundlePath = path.join(pwd, SERVER_BUNDLE_DIRECTORY, `${entryName}-server-loaders.js`);
|
|
47
|
-
const renderBundle = await loadBundle(renderBundlePath,
|
|
48
|
-
const loaderBundle = await loadBundle(loaderBundlePath,
|
|
48
|
+
const renderBundle = await loadBundle(renderBundlePath, monitors);
|
|
49
|
+
const loaderBundle = await loadBundle(loaderBundlePath, monitors);
|
|
49
50
|
renderBundle && (renderBundles[entryName] = renderBundle);
|
|
50
51
|
loaderBundle && (loaderBundles[entryName] = loaderBundle?.loadModules ? await loaderBundle?.loadModules() : loaderBundle);
|
|
51
52
|
}));
|
|
@@ -66,8 +67,8 @@ async function getServerManifest(pwd, routes, logger) {
|
|
|
66
67
|
function injectServerManifest(pwd, routes, manifestPromise) {
|
|
67
68
|
return async (c, next)=>{
|
|
68
69
|
if (routes && !c.get('serverManifest')) {
|
|
69
|
-
const
|
|
70
|
-
const serverManifest = await (manifestPromise || getServerManifest(pwd, routes,
|
|
70
|
+
const monitors = c.get('monitors');
|
|
71
|
+
const serverManifest = await (manifestPromise || getServerManifest(pwd, routes, monitors));
|
|
71
72
|
c.set('serverManifest', serverManifest);
|
|
72
73
|
}
|
|
73
74
|
await next();
|
package/dist/esm-node/helper.mjs
CHANGED
package/dist/esm-node/hono.mjs
CHANGED
package/dist/esm-node/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import "node:module";
|
|
1
2
|
import { ErrorDigest, createErrorHtml, onError } from "./utils/index.mjs";
|
|
2
3
|
import { getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, resolvePublicDirPaths } from "./utils/publicDir.mjs";
|
|
3
4
|
import { AGGRED_DIR } from "./constants.mjs";
|
|
4
5
|
import { createServerBase } from "./serverBase.mjs";
|
|
5
|
-
import { useHonoContext } from "./context.mjs";
|
|
6
|
+
import { run, useHonoContext } from "./context.mjs";
|
|
6
7
|
import { Hono } from "hono";
|
|
7
8
|
import { getLoaderCtx } from "./helper.mjs";
|
|
8
9
|
export * from "./plugins/index.mjs";
|
|
@@ -10,4 +11,4 @@ export * from "./types/plugins/index.mjs";
|
|
|
10
11
|
export * from "./types/render.mjs";
|
|
11
12
|
export * from "./types/config/index.mjs";
|
|
12
13
|
export * from "./types/requestHandler.mjs";
|
|
13
|
-
export { AGGRED_DIR, ErrorDigest, Hono, createErrorHtml, createServerBase, getLoaderCtx, getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, onError, resolvePublicDirPaths, useHonoContext };
|
|
14
|
+
export { AGGRED_DIR, ErrorDigest, Hono, createErrorHtml, createServerBase, getLoaderCtx, getPublicDirConfig, getPublicDirPatterns, getPublicDirRoutePrefixes, normalizePublicDir, normalizePublicDirPath, onError, resolvePublicDirPaths, run, useHonoContext };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "node:module";
|
|
1
2
|
import { MAIN_ENTRY_NAME } from "@modern-js/utils/universal/constants";
|
|
2
3
|
const dataHandler = async (request, { routeInfo, serverRoutes, monitors, onError, onTiming, serverManifest, loaderContext })=>{
|
|
3
4
|
const serverLoaderModule = serverManifest?.loaderBundles?.[routeInfo.entryName || MAIN_ENTRY_NAME];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "node:module";
|
|
1
2
|
import { MAIN_ENTRY_NAME } from "@modern-js/utils/universal/constants";
|
|
2
3
|
const serverActionHandler = async (req, { serverManifest, routeInfo, rscClientManifest })=>{
|
|
3
4
|
const serverBundle = serverManifest?.renderBundles?.[routeInfo.entryName || MAIN_ENTRY_NAME];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Monitors, ServerRoute } from '@modern-js/types';
|
|
2
2
|
import type { Middleware, ServerEnv, ServerManifest, ServerPlugin } from '../../../types';
|
|
3
3
|
export declare function getHtmlTemplates(pwd: string, routes: ServerRoute[]): Promise<Record<string, string>>;
|
|
4
4
|
export declare function injectTemplates(pwd: string, routes?: ServerRoute[], htmlTemplatePromise?: ReturnType<typeof getHtmlTemplates>): Middleware<ServerEnv>;
|
|
5
|
-
export declare function getServerManifest(pwd: string, routes: ServerRoute[],
|
|
5
|
+
export declare function getServerManifest(pwd: string, routes: ServerRoute[], monitors: Monitors): Promise<ServerManifest>;
|
|
6
6
|
export declare function injectServerManifest(pwd: string, routes?: ServerRoute[], manifestPromise?: Promise<ServerManifest>): Middleware<ServerEnv>;
|
|
7
7
|
export declare function getRscServerManifest(pwd: string): Promise<any>;
|
|
8
8
|
export declare function getClientManifest(pwd: string): Promise<any>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { normalizePublicDir, normalizePublicDirPath, getPublicDirRoutePrefixes,
|
|
|
3
3
|
export { AGGRED_DIR } from './constants';
|
|
4
4
|
export type { ServerBase, ServerBaseOptions } from './serverBase';
|
|
5
5
|
export { createServerBase } from './serverBase';
|
|
6
|
-
export { useHonoContext } from './context';
|
|
6
|
+
export { run, useHonoContext } from './context';
|
|
7
7
|
export { Hono } from 'hono';
|
|
8
8
|
export type { Middleware, MiddlewareHandler, Context, Next, HonoRequest as InternalRequest, ServerEnv, ServerManifest, ServerLoaderBundle, } from './types';
|
|
9
9
|
export { getLoaderCtx } from './helper';
|
|
@@ -28,7 +28,7 @@ export interface ServerUserConfig {
|
|
|
28
28
|
baseUrl?: string | string[];
|
|
29
29
|
port?: number;
|
|
30
30
|
watchOptions?: WatchOptions;
|
|
31
|
-
compiler?: '
|
|
31
|
+
compiler?: 'typescript';
|
|
32
32
|
/**
|
|
33
33
|
* @description use json script tag instead of inline script
|
|
34
34
|
* @default false
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ConfigChain } from './share';
|
|
3
|
-
type ToolsBabelConfig = ConfigChain<BabelTransformOptions, any>;
|
|
4
|
-
export interface ToolsUserConfig {
|
|
5
|
-
babel?: ToolsBabelConfig;
|
|
6
|
-
}
|
|
1
|
+
export type ToolsUserConfig = Record<string, never>;
|
|
7
2
|
export type ToolsNormalizedConfig = ToolsUserConfig;
|
|
8
|
-
export {};
|
package/package.json
CHANGED
|
@@ -15,25 +15,34 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.0.0
|
|
19
|
-
"jsnext:source": "./src/index.ts",
|
|
18
|
+
"version": "3.0.0",
|
|
20
19
|
"types": "./dist/types/index.d.ts",
|
|
21
20
|
"main": "./dist/cjs/index.js",
|
|
22
|
-
"module": "./dist/esm-node/index.mjs",
|
|
23
21
|
"exports": {
|
|
24
22
|
".": {
|
|
25
23
|
"types": "./dist/types/index.d.ts",
|
|
26
|
-
"
|
|
24
|
+
"modern:source": "./src/index.ts",
|
|
25
|
+
"node": {
|
|
26
|
+
"import": "./dist/esm-node/index.mjs",
|
|
27
|
+
"require": "./dist/cjs/index.js"
|
|
28
|
+
},
|
|
27
29
|
"default": "./dist/cjs/index.js"
|
|
28
30
|
},
|
|
29
31
|
"./node": {
|
|
30
32
|
"types": "./dist/types/adapters/node/index.d.ts",
|
|
31
|
-
"
|
|
33
|
+
"modern:source": "./src/adapters/node/index.ts",
|
|
34
|
+
"node": {
|
|
35
|
+
"import": "./dist/esm-node/adapters/node/index.mjs",
|
|
36
|
+
"require": "./dist/cjs/adapters/node/index.js"
|
|
37
|
+
},
|
|
32
38
|
"default": "./dist/cjs/adapters/node/index.js"
|
|
33
39
|
},
|
|
34
40
|
"./hono": {
|
|
35
41
|
"types": "./dist/types/hono.d.ts",
|
|
36
|
-
"
|
|
42
|
+
"node": {
|
|
43
|
+
"import": "./dist/esm-node/hono.mjs",
|
|
44
|
+
"require": "./dist/cjs/hono.js"
|
|
45
|
+
},
|
|
37
46
|
"default": "./dist/cjs/hono.js"
|
|
38
47
|
}
|
|
39
48
|
},
|
|
@@ -60,22 +69,22 @@
|
|
|
60
69
|
"@web-std/stream": "^1.0.3",
|
|
61
70
|
"cloneable-readable": "^3.0.0",
|
|
62
71
|
"flatted": "^3.3.3",
|
|
63
|
-
"hono": "^4.
|
|
72
|
+
"hono": "^4.11.7",
|
|
64
73
|
"ts-deepmerge": "7.0.3",
|
|
65
|
-
"@modern-js/plugin": "3.0.0
|
|
66
|
-
"@modern-js/
|
|
67
|
-
"@modern-js/utils": "3.0.0
|
|
74
|
+
"@modern-js/plugin": "3.0.0",
|
|
75
|
+
"@modern-js/utils": "3.0.0",
|
|
76
|
+
"@modern-js/runtime-utils": "3.0.0"
|
|
68
77
|
},
|
|
69
78
|
"devDependencies": {
|
|
70
|
-
"@rslib/core": "0.19.
|
|
79
|
+
"@rslib/core": "0.19.4",
|
|
71
80
|
"@types/cloneable-readable": "^2.0.3",
|
|
72
81
|
"@types/merge-deep": "^3.0.3",
|
|
73
82
|
"@types/node": "^20",
|
|
74
83
|
"http-proxy-middleware": "^2.0.9",
|
|
75
84
|
"typescript": "^5",
|
|
76
|
-
"@modern-js/
|
|
77
|
-
"@
|
|
78
|
-
"@
|
|
85
|
+
"@modern-js/rslib": "2.68.10",
|
|
86
|
+
"@modern-js/types": "3.0.0",
|
|
87
|
+
"@scripts/rstest-config": "2.66.0"
|
|
79
88
|
},
|
|
80
89
|
"sideEffects": false,
|
|
81
90
|
"publishConfig": {
|