@modern-js/server-core 2.58.3-alpha.0 → 2.58.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/hono.js +8 -5
- package/dist/cjs/adapters/node/node.js +1 -1
- package/dist/cjs/adapters/node/plugins/resource.js +1 -1
- package/dist/cjs/adapters/node/plugins/static.js +1 -1
- package/dist/cjs/adapters/node/polyfills/install.js +1 -1
- package/dist/cjs/plugins/customServer/base.js +3 -1
- package/dist/cjs/plugins/customServer/context.js +1 -1
- package/dist/cjs/plugins/customServer/index.js +4 -11
- package/dist/cjs/plugins/default.js +2 -2
- package/dist/cjs/plugins/render/index.js +5 -3
- package/dist/cjs/plugins/render/render.js +17 -17
- package/dist/cjs/plugins/render/ssrRender.js +1 -1
- package/dist/cjs/serverBase.js +1 -1
- package/dist/esm/adapters/node/helper/loadConfig.js +1 -1
- package/dist/esm/adapters/node/hono.js +23 -13
- package/dist/esm/adapters/node/node.js +1 -1
- package/dist/esm/adapters/node/plugins/resource.js +31 -3
- package/dist/esm/adapters/node/plugins/static.js +1 -1
- package/dist/esm/adapters/node/polyfills/install.js +3 -3
- package/dist/esm/plugins/customServer/base.js +7 -1
- package/dist/esm/plugins/customServer/context.js +1 -1
- package/dist/esm/plugins/customServer/index.js +5 -15
- package/dist/esm/plugins/default.js +3 -3
- package/dist/esm/plugins/render/index.js +6 -4
- package/dist/esm/plugins/render/render.js +8 -8
- package/dist/esm/plugins/render/ssrRender.js +2 -2
- package/dist/esm/serverBase.js +1 -1
- package/dist/esm-node/adapters/node/helper/loadConfig.js +1 -1
- package/dist/esm-node/adapters/node/hono.js +8 -5
- package/dist/esm-node/adapters/node/node.js +1 -1
- package/dist/esm-node/adapters/node/plugins/resource.js +2 -2
- package/dist/esm-node/adapters/node/plugins/static.js +1 -1
- package/dist/esm-node/adapters/node/polyfills/install.js +3 -3
- package/dist/esm-node/plugins/customServer/base.js +3 -1
- package/dist/esm-node/plugins/customServer/context.js +1 -1
- package/dist/esm-node/plugins/customServer/index.js +4 -11
- package/dist/esm-node/plugins/default.js +3 -3
- package/dist/esm-node/plugins/render/index.js +5 -3
- package/dist/esm-node/plugins/render/render.js +7 -7
- package/dist/esm-node/plugins/render/ssrRender.js +2 -2
- package/dist/esm-node/serverBase.js +1 -1
- package/dist/types/adapters/node/hono.d.ts +1 -1
- package/dist/types/adapters/node/plugins/nodeServer.d.ts +1 -1
- package/dist/types/adapters/node/plugins/static.d.ts +1 -1
- package/dist/types/pluginManager.d.ts +1 -1
- package/dist/types/plugins/customServer/context.d.ts +2 -2
- package/dist/types/plugins/customServer/index.d.ts +2 -2
- package/dist/types/plugins/render/ssrRender.d.ts +2 -2
- package/dist/types/serverBase.d.ts +1 -0
- package/dist/types/types/config/bff.d.ts +1 -1
- package/dist/types/types/config/server.d.ts +0 -23
- package/dist/types/types/plugin.d.ts +2 -2
- package/dist/types/types/render.d.ts +2 -0
- package/dist/types/types/requestHandler.d.ts +1 -1
- package/dist/types/types/server.d.ts +2 -1
- package/package.json +7 -7
|
@@ -32,11 +32,14 @@ const httpCallBack2HonoMid = (handler) => {
|
|
|
32
32
|
req.__honoRequest = context.req;
|
|
33
33
|
req.__templates = context.get("templates") || {};
|
|
34
34
|
req.__serverManifest = context.get("serverManifest") || {};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
try {
|
|
36
|
+
await handler(req, res);
|
|
37
|
+
} finally {
|
|
38
|
+
delete req.__honoRequest;
|
|
39
|
+
delete req.__templates;
|
|
40
|
+
delete req.__serverManifest;
|
|
41
|
+
res.removeListener("pipe", onPipe);
|
|
42
|
+
}
|
|
40
43
|
if (res.headersSent || res._modernBodyPiped) {
|
|
41
44
|
context.finalized = true;
|
|
42
45
|
} else {
|
|
@@ -35,8 +35,8 @@ __export(node_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(node_exports);
|
|
37
37
|
var import_node_http = require("node:http");
|
|
38
|
-
var import_stream = require("./polyfills/stream");
|
|
39
38
|
var import_install = require("./polyfills/install");
|
|
39
|
+
var import_stream = require("./polyfills/stream");
|
|
40
40
|
var import_polyfills = require("./polyfills");
|
|
41
41
|
(0, import_install.installGlobals)();
|
|
42
42
|
const createWebRequest = (req, res, body) => {
|
|
@@ -86,7 +86,7 @@ async function getServerManifest(pwd, routes, logger) {
|
|
|
86
86
|
const renderBundle = await loadBundle(renderBundlePath, logger);
|
|
87
87
|
const loaderBundle = await loadBundle(loaderBundlePath, logger);
|
|
88
88
|
renderBundle && (renderBundles[entryName] = renderBundle);
|
|
89
|
-
loaderBundle && (loaderBundles[entryName] = loaderBundle);
|
|
89
|
+
loaderBundle && (loaderBundles[entryName] = (loaderBundle === null || loaderBundle === void 0 ? void 0 : loaderBundle.loadModules) ? await (loaderBundle === null || loaderBundle === void 0 ? void 0 : loaderBundle.loadModules()) : loaderBundle);
|
|
90
90
|
}));
|
|
91
91
|
const loadableUri = import_path.default.join(pwd, import_utils.LOADABLE_STATS_FILE);
|
|
92
92
|
const loadableStats = await (0, import_utils.compatibleRequire)(loadableUri).catch((_) => ({}));
|
|
@@ -34,9 +34,9 @@ __export(static_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(static_exports);
|
|
36
36
|
var import_path = __toESM(require("path"));
|
|
37
|
+
var import_fileReader = require("@modern-js/runtime-utils/fileReader");
|
|
37
38
|
var import_utils = require("@modern-js/utils");
|
|
38
39
|
var import_mime = require("hono/utils/mime");
|
|
39
|
-
var import_fileReader = require("@modern-js/runtime-utils/fileReader");
|
|
40
40
|
var import_utils2 = require("../../../utils");
|
|
41
41
|
const serverStaticPlugin = () => ({
|
|
42
42
|
name: "@modern-js/plugin-server-static",
|
|
@@ -22,8 +22,8 @@ __export(install_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(install_exports);
|
|
24
24
|
var import_fetch = require("@web-std/fetch");
|
|
25
|
-
var import_stream = require("@web-std/stream");
|
|
26
25
|
var import_file = require("@web-std/file");
|
|
26
|
+
var import_stream = require("@web-std/stream");
|
|
27
27
|
if (!Object.getOwnPropertyDescriptor(import_fetch.Headers.prototype, "getSetCookie")) {
|
|
28
28
|
Object.defineProperty(import_fetch.Headers.prototype, "getSetCookie", {
|
|
29
29
|
value: function getSetCookie() {
|
|
@@ -39,7 +39,9 @@ function createBaseHookContext(c, resParams) {
|
|
|
39
39
|
var _req = /* @__PURE__ */ new WeakMap(), _c = /* @__PURE__ */ new WeakMap(), _headersData = /* @__PURE__ */ new WeakMap(), _headers = /* @__PURE__ */ new WeakMap();
|
|
40
40
|
class BaseHookRequest {
|
|
41
41
|
get url() {
|
|
42
|
-
|
|
42
|
+
const query = (0, import_class_private_field_get._)(this, _c).req.query();
|
|
43
|
+
const q = Object.entries(query).map(([key, value]) => `${key}=${value}`).join("&");
|
|
44
|
+
return q ? `${(0, import_class_private_field_get._)(this, _c).req.path}?${q}` : (0, import_class_private_field_get._)(this, _c).req.path;
|
|
43
45
|
}
|
|
44
46
|
// TODO: remove next major version
|
|
45
47
|
set url(_u) {
|
|
@@ -24,9 +24,9 @@ __export(context_exports, {
|
|
|
24
24
|
getAfterRenderCtx: () => getAfterRenderCtx
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(context_exports);
|
|
27
|
+
var import_base = require("./base");
|
|
27
28
|
var import_routerApi = require("./routerApi");
|
|
28
29
|
var import_template = require("./template");
|
|
29
|
-
var import_base = require("./base");
|
|
30
30
|
function getAfterMatchCtx(entryName, baseHookCtx) {
|
|
31
31
|
const afterMatchCtx = baseHookCtx;
|
|
32
32
|
afterMatchCtx.router = new import_routerApi.RouterAPI(entryName);
|
|
@@ -33,11 +33,11 @@ __export(customServer_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(customServer_exports);
|
|
35
35
|
var import_time = require("@modern-js/runtime-utils/time");
|
|
36
|
-
var import_utils = require("../../utils");
|
|
37
|
-
var import_helper = require("../../helper");
|
|
38
36
|
var import_constants = require("../../constants");
|
|
39
|
-
var
|
|
37
|
+
var import_helper = require("../../helper");
|
|
38
|
+
var import_utils = require("../../utils");
|
|
40
39
|
var import_base = require("./base");
|
|
40
|
+
var import_context = require("./context");
|
|
41
41
|
const noop = () => {
|
|
42
42
|
};
|
|
43
43
|
const isHtmlResponse = (response) => {
|
|
@@ -65,14 +65,7 @@ class CustomServer {
|
|
|
65
65
|
if (current !== entryName) {
|
|
66
66
|
const rewriteRoute = routes.find((route) => route.entryName === current);
|
|
67
67
|
if (rewriteRoute) {
|
|
68
|
-
|
|
69
|
-
const url2 = new URL(c.req.url);
|
|
70
|
-
const newUrl = new URL(rewriteRoute.urlPath, url2.origin);
|
|
71
|
-
return this.serverBase.request(newUrl, {
|
|
72
|
-
headers,
|
|
73
|
-
method,
|
|
74
|
-
signal
|
|
75
|
-
}, c.env);
|
|
68
|
+
c.set("matchPathname", rewriteRoute.urlPath);
|
|
76
69
|
}
|
|
77
70
|
}
|
|
78
71
|
if (c.finalized) {
|
|
@@ -21,10 +21,10 @@ __export(default_exports, {
|
|
|
21
21
|
createDefaultPlugins: () => createDefaultPlugins
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(default_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_log = require("./log");
|
|
25
25
|
var import_monitors = require("./monitors");
|
|
26
26
|
var import_processedBy = require("./processedBy");
|
|
27
|
-
var
|
|
27
|
+
var import_render = require("./render");
|
|
28
28
|
function createDefaultPlugins(options = {}) {
|
|
29
29
|
const plugins = [
|
|
30
30
|
(0, import_monitors.initMonitorsPlugin)(),
|
|
@@ -23,10 +23,10 @@ __export(render_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(render_exports);
|
|
25
25
|
var import_constants = require("@modern-js/utils/universal/constants");
|
|
26
|
-
var
|
|
26
|
+
var import_helper = require("../../helper");
|
|
27
27
|
var import_utils = require("../../utils");
|
|
28
28
|
var import_customServer = require("../customServer");
|
|
29
|
-
var
|
|
29
|
+
var import_monitors = require("../monitors");
|
|
30
30
|
__reExport(render_exports, require("./inject"), module.exports);
|
|
31
31
|
const renderPlugin = () => ({
|
|
32
32
|
name: "@modern-js/plugin-render",
|
|
@@ -85,6 +85,7 @@ function createRenderHandler(render) {
|
|
|
85
85
|
const serverManifest = c.get("serverManifest") || {};
|
|
86
86
|
const locals = c.get("locals");
|
|
87
87
|
const metrics = c.get("metrics");
|
|
88
|
+
const matchPathname = c.get("matchPathname");
|
|
88
89
|
const loaderContext = (0, import_helper.getLoaderCtx)(c);
|
|
89
90
|
const request = c.req.raw;
|
|
90
91
|
const nodeReq = (_c_env_node = c.env.node) === null || _c_env_node === void 0 ? void 0 : _c_env_node.req;
|
|
@@ -97,7 +98,8 @@ function createRenderHandler(render) {
|
|
|
97
98
|
metrics,
|
|
98
99
|
serverManifest,
|
|
99
100
|
loaderContext,
|
|
100
|
-
locals
|
|
101
|
+
locals,
|
|
102
|
+
matchPathname
|
|
101
103
|
});
|
|
102
104
|
const { body, status, headers } = res;
|
|
103
105
|
const headersData = {};
|
|
@@ -31,13 +31,13 @@ __export(render_exports, {
|
|
|
31
31
|
createRender: () => createRender
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(render_exports);
|
|
34
|
+
var import_utils = require("@modern-js/utils");
|
|
34
35
|
var import_universal = require("@modern-js/utils/universal");
|
|
35
36
|
var import_trie_router = require("hono/router/trie-router");
|
|
36
|
-
var import_utils = require("../../utils");
|
|
37
37
|
var import_constants = require("../../constants");
|
|
38
|
+
var import_utils2 = require("../../utils");
|
|
38
39
|
var import_dataHandler = require("./dataHandler");
|
|
39
40
|
var import_ssrRender = require("./ssrRender");
|
|
40
|
-
var import_utils2 = require("@modern-js/utils");
|
|
41
41
|
const DYNAMIC_ROUTE_REG = /\/:./;
|
|
42
42
|
function getRouter(routes) {
|
|
43
43
|
const dynamicRoutes = [];
|
|
@@ -50,8 +50,8 @@ function getRouter(routes) {
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
const finalRoutes = [
|
|
53
|
-
...normalRoutes.sort(
|
|
54
|
-
...dynamicRoutes.sort(
|
|
53
|
+
...normalRoutes.sort(import_utils2.sortRoutes),
|
|
54
|
+
...dynamicRoutes.sort(import_utils2.sortRoutes)
|
|
55
55
|
];
|
|
56
56
|
const router = new import_trie_router.TrieRouter();
|
|
57
57
|
for (const route of finalRoutes) {
|
|
@@ -61,8 +61,7 @@ function getRouter(routes) {
|
|
|
61
61
|
}
|
|
62
62
|
return router;
|
|
63
63
|
}
|
|
64
|
-
function matchRoute(router,
|
|
65
|
-
const pathname = (0, import_utils.getPathname)(request);
|
|
64
|
+
function matchRoute(router, pathname) {
|
|
66
65
|
const matched = router.match("*", pathname);
|
|
67
66
|
const result = matched[0][0];
|
|
68
67
|
return result || [];
|
|
@@ -77,8 +76,9 @@ function getHeadersWithoutCookie(headers) {
|
|
|
77
76
|
}
|
|
78
77
|
async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig, forceCSR, config, onFallback: onFallbackFn }) {
|
|
79
78
|
const router = getRouter(routes);
|
|
80
|
-
return async (req, { logger, reporter, metrics, monitors, nodeReq, templates, serverManifest, locals, loaderContext }) => {
|
|
81
|
-
const
|
|
79
|
+
return async (req, { logger, reporter, metrics, monitors, nodeReq, templates, serverManifest, locals, matchPathname, loaderContext }) => {
|
|
80
|
+
const forMatchpathname = matchPathname !== null && matchPathname !== void 0 ? matchPathname : (0, import_utils2.getPathname)(req);
|
|
81
|
+
const [routeInfo, params] = matchRoute(router, forMatchpathname);
|
|
82
82
|
const onFallback = async (reason, error) => {
|
|
83
83
|
return onFallbackFn === null || onFallbackFn === void 0 ? void 0 : onFallbackFn(reason, {
|
|
84
84
|
logger,
|
|
@@ -87,7 +87,7 @@ async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig
|
|
|
87
87
|
}, error);
|
|
88
88
|
};
|
|
89
89
|
if (!routeInfo) {
|
|
90
|
-
return new Response((0,
|
|
90
|
+
return new Response((0, import_utils2.createErrorHtml)(404), {
|
|
91
91
|
status: 404,
|
|
92
92
|
headers: {
|
|
93
93
|
"content-type": "text/html; charset=UTF-8"
|
|
@@ -96,7 +96,7 @@ async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig
|
|
|
96
96
|
}
|
|
97
97
|
const html = templates[routeInfo.entryName];
|
|
98
98
|
if (!html) {
|
|
99
|
-
return new Response((0,
|
|
99
|
+
return new Response((0, import_utils2.createErrorHtml)(404), {
|
|
100
100
|
status: 404,
|
|
101
101
|
headers: {
|
|
102
102
|
"content-type": "text/html; charset=UTF-8"
|
|
@@ -104,16 +104,16 @@ async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig
|
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
const renderMode = await getRenderMode(req, metaName || "modern-js", routeInfo.isSSR, forceCSR, nodeReq, onFallback);
|
|
107
|
-
const pathname = (0,
|
|
108
|
-
const headerData = (0,
|
|
107
|
+
const pathname = (0, import_utils2.getPathname)(req);
|
|
108
|
+
const headerData = (0, import_utils2.parseHeaders)(req);
|
|
109
109
|
const onError = (e) => {
|
|
110
|
-
monitors === null || monitors === void 0 ? void 0 : monitors.error(`SSR Error - ${e instanceof Error ? e.name : e}, error = %s, req.url = %s, req.headers = %o`, e instanceof Error ? e.stack || e.message : e,
|
|
110
|
+
monitors === null || monitors === void 0 ? void 0 : monitors.error(`SSR Error - ${e instanceof Error ? e.name : e}, error = %s, req.url = %s, req.headers = %o`, e instanceof Error ? e.stack || e.message : e, forMatchpathname, getHeadersWithoutCookie(headerData));
|
|
111
111
|
};
|
|
112
112
|
const onTiming = (name, dur) => {
|
|
113
113
|
monitors === null || monitors === void 0 ? void 0 : monitors.timing(name, dur, "SSR");
|
|
114
114
|
};
|
|
115
115
|
const onBoundError = async (e) => {
|
|
116
|
-
(0,
|
|
116
|
+
(0, import_utils2.onError)(import_utils2.ErrorDigest.ERENDER, e, monitors, req);
|
|
117
117
|
await (onFallback === null || onFallback === void 0 ? void 0 : onFallback("error", e));
|
|
118
118
|
};
|
|
119
119
|
const renderOptions = {
|
|
@@ -165,7 +165,7 @@ async function renderHandler(request, options, mode, onError) {
|
|
|
165
165
|
const { nestedRoutesJson } = serverManifest;
|
|
166
166
|
const routes = nestedRoutesJson === null || nestedRoutesJson === void 0 ? void 0 : nestedRoutesJson[options.routeInfo.entryName];
|
|
167
167
|
if (routes) {
|
|
168
|
-
const { matchRoutes } = await (0,
|
|
168
|
+
const { matchRoutes } = await (0, import_utils.compatibleRequire)(require.resolve("@modern-js/runtime-utils/remix-router"), false);
|
|
169
169
|
const url = new URL(request.url);
|
|
170
170
|
const matchedRoutes = matchRoutes(routes, url.pathname, options.routeInfo.urlPath);
|
|
171
171
|
if (!matchedRoutes) {
|
|
@@ -189,7 +189,7 @@ async function renderHandler(request, options, mode, onError) {
|
|
|
189
189
|
} else {
|
|
190
190
|
response = csrRender(options.html);
|
|
191
191
|
}
|
|
192
|
-
const newRes = (0,
|
|
192
|
+
const newRes = (0, import_utils2.transformResponse)(response, injectServerData(serverData));
|
|
193
193
|
const { routeInfo } = options;
|
|
194
194
|
applyExtendHeaders(newRes, routeInfo);
|
|
195
195
|
return newRes;
|
|
@@ -200,7 +200,7 @@ async function renderHandler(request, options, mode, onError) {
|
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
async function getRenderMode(req, framework, isSSR, forceCSR, nodeReq, onFallback) {
|
|
203
|
-
const query = (0,
|
|
203
|
+
const query = (0, import_utils2.parseQuery)(req);
|
|
204
204
|
const fallbackHeader = `x-${(0, import_universal.cutNameByHyphen)(framework)}-ssr-fallback`;
|
|
205
205
|
if (isSSR) {
|
|
206
206
|
if (query.__loader) {
|
|
@@ -22,8 +22,8 @@ __export(ssrRender_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(ssrRender_exports);
|
|
24
24
|
var import_constants = require("@modern-js/utils/universal/constants");
|
|
25
|
-
var import_utils = require("../../utils");
|
|
26
25
|
var import_constants2 = require("../../constants");
|
|
26
|
+
var import_utils = require("../../utils");
|
|
27
27
|
var import_ssrCache = require("./ssrCache");
|
|
28
28
|
const SERVER_RUNTIME_ENTRY = "requestHandler";
|
|
29
29
|
async function ssrRender(request, { routeInfo, html, config: userConfig, staticGenerate, nodeReq, serverManifest, locals, params, loaderContext, reporter, cacheConfig, logger, metrics, onError, onTiming }) {
|
package/dist/cjs/serverBase.js
CHANGED
|
@@ -24,8 +24,8 @@ __export(serverBase_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(serverBase_exports);
|
|
25
25
|
var import_class_private_method_get = require("@swc/helpers/_/_class_private_method_get");
|
|
26
26
|
var import_class_private_method_init = require("@swc/helpers/_/_class_private_method_init");
|
|
27
|
-
var import_hono = require("hono");
|
|
28
27
|
var import_plugin = require("@modern-js/plugin");
|
|
28
|
+
var import_hono = require("hono");
|
|
29
29
|
var import_pluginManager = require("./pluginManager");
|
|
30
30
|
var _getAppContext = /* @__PURE__ */ new WeakSet(), _applyMiddlewares = /* @__PURE__ */ new WeakSet();
|
|
31
31
|
class ServerBase {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import { fs, DEFAULT_SERVER_CONFIG,
|
|
4
|
+
import { fs, DEFAULT_SERVER_CONFIG, OUTPUT_CONFIG_FILE, lodash as _, compatibleRequire, ensureAbsolutePath, requireExistModule } from "@modern-js/utils";
|
|
5
5
|
import { parse } from "flatted";
|
|
6
6
|
var requireConfig = function() {
|
|
7
7
|
var _ref = _async_to_generator(function(serverConfigPath) {
|
|
@@ -15,42 +15,52 @@ var httpCallBack2HonoMid = function(handler) {
|
|
|
15
15
|
req.__honoRequest = context.req;
|
|
16
16
|
req.__templates = context.get("templates") || {};
|
|
17
17
|
req.__serverManifest = context.get("serverManifest") || {};
|
|
18
|
+
_state.label = 1;
|
|
19
|
+
case 1:
|
|
20
|
+
_state.trys.push([
|
|
21
|
+
1,
|
|
22
|
+
,
|
|
23
|
+
3,
|
|
24
|
+
4
|
|
25
|
+
]);
|
|
18
26
|
return [
|
|
19
27
|
4,
|
|
20
28
|
handler(req, res)
|
|
21
29
|
];
|
|
22
|
-
case
|
|
30
|
+
case 2:
|
|
23
31
|
_state.sent();
|
|
24
32
|
return [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return setTimeout(resolve, 0);
|
|
28
|
-
})
|
|
33
|
+
3,
|
|
34
|
+
4
|
|
29
35
|
];
|
|
30
|
-
case
|
|
31
|
-
_state.sent();
|
|
36
|
+
case 3:
|
|
32
37
|
delete req.__honoRequest;
|
|
33
38
|
delete req.__templates;
|
|
34
39
|
delete req.__serverManifest;
|
|
40
|
+
res.removeListener("pipe", onPipe);
|
|
41
|
+
return [
|
|
42
|
+
7
|
|
43
|
+
];
|
|
44
|
+
case 4:
|
|
35
45
|
if (!(res.headersSent || res._modernBodyPiped))
|
|
36
46
|
return [
|
|
37
47
|
3,
|
|
38
|
-
|
|
48
|
+
5
|
|
39
49
|
];
|
|
40
50
|
context.finalized = true;
|
|
41
51
|
return [
|
|
42
52
|
3,
|
|
43
|
-
|
|
53
|
+
7
|
|
44
54
|
];
|
|
45
|
-
case
|
|
55
|
+
case 5:
|
|
46
56
|
return [
|
|
47
57
|
4,
|
|
48
58
|
next()
|
|
49
59
|
];
|
|
50
|
-
case
|
|
60
|
+
case 6:
|
|
51
61
|
_state.sent();
|
|
52
|
-
_state.label =
|
|
53
|
-
case
|
|
62
|
+
_state.label = 7;
|
|
63
|
+
case 7:
|
|
54
64
|
return [
|
|
55
65
|
2
|
|
56
66
|
];
|
|
@@ -3,8 +3,8 @@ import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
|
|
|
3
3
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
4
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
5
5
|
import { ServerResponse } from "node:http";
|
|
6
|
-
import { createReadableStreamFromReadable, writeReadableStreamToWritable } from "./polyfills/stream";
|
|
7
6
|
import { installGlobals } from "./polyfills/install";
|
|
7
|
+
import { createReadableStreamFromReadable, writeReadableStreamToWritable } from "./polyfills/stream";
|
|
8
8
|
import { writeReadableStreamToWritable as writeReadableStreamToWritable2 } from "./polyfills";
|
|
9
9
|
installGlobals();
|
|
10
10
|
var createWebRequest = function(req, res, body) {
|
|
@@ -3,7 +3,7 @@ import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
|
|
|
3
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import { fileReader } from "@modern-js/runtime-utils/fileReader";
|
|
6
|
-
import { LOADABLE_STATS_FILE, MAIN_ENTRY_NAME, NESTED_ROUTE_SPEC_FILE, ROUTE_MANIFEST_FILE, SERVER_BUNDLE_DIRECTORY,
|
|
6
|
+
import { fs, LOADABLE_STATS_FILE, MAIN_ENTRY_NAME, NESTED_ROUTE_SPEC_FILE, ROUTE_MANIFEST_FILE, SERVER_BUNDLE_DIRECTORY, compatibleRequire } from "@modern-js/utils";
|
|
7
7
|
function getHtmlTemplates(pwd, routes) {
|
|
8
8
|
return _getHtmlTemplates.apply(this, arguments);
|
|
9
9
|
}
|
|
@@ -180,7 +180,7 @@ function _getServerManifest() {
|
|
|
180
180
|
return Boolean(route.bundle);
|
|
181
181
|
}).map(function() {
|
|
182
182
|
var _ref = _async_to_generator(function(route) {
|
|
183
|
-
var entryName, renderBundlePath, loaderBundlePath, renderBundle, loaderBundle;
|
|
183
|
+
var entryName, renderBundlePath, loaderBundlePath, renderBundle, loaderBundle, _tmp, _tmp1;
|
|
184
184
|
return _ts_generator(this, function(_state2) {
|
|
185
185
|
switch (_state2.label) {
|
|
186
186
|
case 0:
|
|
@@ -200,7 +200,35 @@ function _getServerManifest() {
|
|
|
200
200
|
case 2:
|
|
201
201
|
loaderBundle = _state2.sent();
|
|
202
202
|
renderBundle && (renderBundles[entryName] = renderBundle);
|
|
203
|
-
|
|
203
|
+
_tmp = loaderBundle;
|
|
204
|
+
if (!_tmp)
|
|
205
|
+
return [
|
|
206
|
+
3,
|
|
207
|
+
6
|
|
208
|
+
];
|
|
209
|
+
if (!(loaderBundle === null || loaderBundle === void 0 ? void 0 : loaderBundle.loadModules))
|
|
210
|
+
return [
|
|
211
|
+
3,
|
|
212
|
+
4
|
|
213
|
+
];
|
|
214
|
+
return [
|
|
215
|
+
4,
|
|
216
|
+
loaderBundle === null || loaderBundle === void 0 ? void 0 : loaderBundle.loadModules()
|
|
217
|
+
];
|
|
218
|
+
case 3:
|
|
219
|
+
_tmp1 = _state2.sent();
|
|
220
|
+
return [
|
|
221
|
+
3,
|
|
222
|
+
5
|
|
223
|
+
];
|
|
224
|
+
case 4:
|
|
225
|
+
_tmp1 = loaderBundle;
|
|
226
|
+
_state2.label = 5;
|
|
227
|
+
case 5:
|
|
228
|
+
_tmp = loaderBundles[entryName] = _tmp1;
|
|
229
|
+
_state2.label = 6;
|
|
230
|
+
case 6:
|
|
231
|
+
_tmp;
|
|
204
232
|
return [
|
|
205
233
|
2
|
|
206
234
|
];
|
|
@@ -3,9 +3,9 @@ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
|
3
3
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
4
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
5
5
|
import path from "path";
|
|
6
|
+
import { fileReader } from "@modern-js/runtime-utils/fileReader";
|
|
6
7
|
import { fs } from "@modern-js/utils";
|
|
7
8
|
import { getMimeType } from "hono/utils/mime";
|
|
8
|
-
import { fileReader } from "@modern-js/runtime-utils/fileReader";
|
|
9
9
|
import { sortRoutes } from "../../../utils";
|
|
10
10
|
var serverStaticPlugin = function() {
|
|
11
11
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { FormData as NodeFormData, Headers as NodeHeaders, Request as NodeRequest, Response as NodeResponse } from "@web-std/fetch";
|
|
2
|
+
import { Blob as NodeBlob, File as NodeFile } from "@web-std/file";
|
|
3
|
+
import { ReadableStream as NodeReadableStream, TransformStream as NodeTransformStream, WritableStream as NodeWritableStream } from "@web-std/stream";
|
|
4
4
|
if (!Object.getOwnPropertyDescriptor(NodeHeaders.prototype, "getSetCookie")) {
|
|
5
5
|
Object.defineProperty(NodeHeaders.prototype, "getSetCookie", {
|
|
6
6
|
value: function getSetCookie() {
|
|
@@ -3,6 +3,7 @@ import { _ as _class_private_field_get } from "@swc/helpers/_/_class_private_fie
|
|
|
3
3
|
import { _ as _class_private_field_init } from "@swc/helpers/_/_class_private_field_init";
|
|
4
4
|
import { _ as _class_private_field_set } from "@swc/helpers/_/_class_private_field_set";
|
|
5
5
|
import { _ as _create_class } from "@swc/helpers/_/_create_class";
|
|
6
|
+
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
6
7
|
import { getCookie } from "hono/cookie";
|
|
7
8
|
import { getHost } from "../../utils";
|
|
8
9
|
function createBaseHookContext(c, resParams) {
|
|
@@ -59,7 +60,12 @@ var BaseHookRequest = /* @__PURE__ */ function() {
|
|
|
59
60
|
{
|
|
60
61
|
key: "url",
|
|
61
62
|
get: function get() {
|
|
62
|
-
|
|
63
|
+
var query = _class_private_field_get(this, _c).req.query();
|
|
64
|
+
var q = Object.entries(query).map(function(param) {
|
|
65
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
66
|
+
return "".concat(key, "=").concat(value);
|
|
67
|
+
}).join("&");
|
|
68
|
+
return q ? "".concat(_class_private_field_get(this, _c).req.path, "?").concat(q) : _class_private_field_get(this, _c).req.path;
|
|
63
69
|
},
|
|
64
70
|
set: (
|
|
65
71
|
// TODO: remove next major version
|
|
@@ -2,9 +2,9 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
|
2
2
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
3
3
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
4
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
5
|
+
import { createBaseHookContext } from "./base";
|
|
5
6
|
import { RouterAPI } from "./routerApi";
|
|
6
7
|
import { TemplateApi } from "./template";
|
|
7
|
-
import { createBaseHookContext } from "./base";
|
|
8
8
|
function getAfterMatchCtx(entryName, baseHookCtx) {
|
|
9
9
|
var afterMatchCtx = baseHookCtx;
|
|
10
10
|
afterMatchCtx.router = new RouterAPI(entryName);
|
|
@@ -2,11 +2,11 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
|
2
2
|
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
|
|
3
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
4
4
|
import { time } from "@modern-js/runtime-utils/time";
|
|
5
|
-
import { transformResponse } from "../../utils";
|
|
6
|
-
import { getLoaderCtx } from "../../helper";
|
|
7
5
|
import { ServerTimings } from "../../constants";
|
|
8
|
-
import {
|
|
6
|
+
import { getLoaderCtx } from "../../helper";
|
|
7
|
+
import { transformResponse } from "../../utils";
|
|
9
8
|
import { createBaseHookContext } from "./base";
|
|
9
|
+
import { createAfterStreamingRenderContext, createCustomMiddlewaresCtx, getAfterMatchCtx, getAfterRenderCtx } from "./context";
|
|
10
10
|
var noop = function() {
|
|
11
11
|
};
|
|
12
12
|
var isHtmlResponse = function(response) {
|
|
@@ -36,7 +36,7 @@ var CustomServer = /* @__PURE__ */ function() {
|
|
|
36
36
|
var _this = this;
|
|
37
37
|
return function() {
|
|
38
38
|
var _ref = _async_to_generator(function(c, next) {
|
|
39
|
-
var routeInfo, monitors, baseHookCtx, afterMatchCtx, getCost, cost, _afterMatchCtx_router, url, status, current, rewriteRoute,
|
|
39
|
+
var routeInfo, monitors, baseHookCtx, afterMatchCtx, getCost, cost, _afterMatchCtx_router, url, status, current, rewriteRoute, afterStreamingRenderContext, afterRenderCtx, getCost1, cost1, newBody;
|
|
40
40
|
return _ts_generator(this, function(_state) {
|
|
41
41
|
switch (_state.label) {
|
|
42
42
|
case 0:
|
|
@@ -70,17 +70,7 @@ var CustomServer = /* @__PURE__ */ function() {
|
|
|
70
70
|
return route.entryName === current;
|
|
71
71
|
});
|
|
72
72
|
if (rewriteRoute) {
|
|
73
|
-
|
|
74
|
-
url1 = new URL(c.req.url);
|
|
75
|
-
newUrl = new URL(rewriteRoute.urlPath, url1.origin);
|
|
76
|
-
return [
|
|
77
|
-
2,
|
|
78
|
-
_this.serverBase.request(newUrl, {
|
|
79
|
-
headers,
|
|
80
|
-
method,
|
|
81
|
-
signal
|
|
82
|
-
}, c.env)
|
|
83
|
-
];
|
|
73
|
+
c.set("matchPathname", rewriteRoute.urlPath);
|
|
84
74
|
}
|
|
85
75
|
}
|
|
86
76
|
if (c.finalized) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { injectRenderHandlerPlugin } from "./render";
|
|
2
|
-
import { initMonitorsPlugin, injectloggerPluigin, injectServerTiming } from "./monitors";
|
|
3
|
-
import { processedByPlugin } from "./processedBy";
|
|
4
1
|
import { logPlugin } from "./log";
|
|
2
|
+
import { initMonitorsPlugin, injectServerTiming, injectloggerPluigin } from "./monitors";
|
|
3
|
+
import { processedByPlugin } from "./processedBy";
|
|
4
|
+
import { injectRenderHandlerPlugin } from "./render";
|
|
5
5
|
function createDefaultPlugins() {
|
|
6
6
|
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
7
7
|
var plugins = [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
3
3
|
import { MAIN_ENTRY_NAME } from "@modern-js/utils/universal/constants";
|
|
4
|
-
import {
|
|
4
|
+
import { getLoaderCtx } from "../../helper";
|
|
5
5
|
import { sortRoutes } from "../../utils";
|
|
6
6
|
import { CustomServer, getServerMidFromUnstableMid } from "../customServer";
|
|
7
|
-
import {
|
|
7
|
+
import { initReporter } from "../monitors";
|
|
8
8
|
export * from "./inject";
|
|
9
9
|
var renderPlugin = function() {
|
|
10
10
|
return {
|
|
@@ -136,7 +136,7 @@ function getPageRoutes(routes) {
|
|
|
136
136
|
function createRenderHandler(render) {
|
|
137
137
|
return function() {
|
|
138
138
|
var _ref = _async_to_generator(function(c, _) {
|
|
139
|
-
var _c_env_node, logger, reporter, monitors, templates, serverManifest, locals, metrics, loaderContext, request, nodeReq, res, body, status, headers, headersData;
|
|
139
|
+
var _c_env_node, logger, reporter, monitors, templates, serverManifest, locals, metrics, matchPathname, loaderContext, request, nodeReq, res, body, status, headers, headersData;
|
|
140
140
|
return _ts_generator(this, function(_state) {
|
|
141
141
|
switch (_state.label) {
|
|
142
142
|
case 0:
|
|
@@ -147,6 +147,7 @@ function createRenderHandler(render) {
|
|
|
147
147
|
serverManifest = c.get("serverManifest") || {};
|
|
148
148
|
locals = c.get("locals");
|
|
149
149
|
metrics = c.get("metrics");
|
|
150
|
+
matchPathname = c.get("matchPathname");
|
|
150
151
|
loaderContext = getLoaderCtx(c);
|
|
151
152
|
request = c.req.raw;
|
|
152
153
|
nodeReq = (_c_env_node = c.env.node) === null || _c_env_node === void 0 ? void 0 : _c_env_node.req;
|
|
@@ -161,7 +162,8 @@ function createRenderHandler(render) {
|
|
|
161
162
|
metrics,
|
|
162
163
|
serverManifest,
|
|
163
164
|
loaderContext,
|
|
164
|
-
locals
|
|
165
|
+
locals,
|
|
166
|
+
matchPathname
|
|
165
167
|
})
|
|
166
168
|
];
|
|
167
169
|
case 1:
|
|
@@ -6,13 +6,13 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
6
6
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
7
7
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
8
8
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
9
|
+
import { compatibleRequire } from "@modern-js/utils";
|
|
9
10
|
import { cutNameByHyphen } from "@modern-js/utils/universal";
|
|
10
11
|
import { TrieRouter } from "hono/router/trie-router";
|
|
11
|
-
import { parseQuery, getPathname, createErrorHtml, sortRoutes, transformResponse, onError as onErrorFn, ErrorDigest, parseHeaders } from "../../utils";
|
|
12
12
|
import { REPLACE_REG, X_MODERNJS_RENDER } from "../../constants";
|
|
13
|
+
import { ErrorDigest, createErrorHtml, getPathname, onError as onErrorFn, parseHeaders, parseQuery, sortRoutes, transformResponse } from "../../utils";
|
|
13
14
|
import { dataHandler } from "./dataHandler";
|
|
14
15
|
import { ssrRender } from "./ssrRender";
|
|
15
|
-
import { compatibleRequire } from "@modern-js/utils";
|
|
16
16
|
var DYNAMIC_ROUTE_REG = /\/:./;
|
|
17
17
|
function getRouter(routes) {
|
|
18
18
|
var dynamicRoutes = [];
|
|
@@ -50,8 +50,7 @@ function getRouter(routes) {
|
|
|
50
50
|
}
|
|
51
51
|
return router;
|
|
52
52
|
}
|
|
53
|
-
function matchRoute(router,
|
|
54
|
-
var pathname = getPathname(request);
|
|
53
|
+
function matchRoute(router, pathname) {
|
|
55
54
|
var matched = router.match("*", pathname);
|
|
56
55
|
var result = matched[0][0];
|
|
57
56
|
return result || [];
|
|
@@ -76,12 +75,13 @@ function _createRender() {
|
|
|
76
75
|
2,
|
|
77
76
|
function() {
|
|
78
77
|
var _ref = _async_to_generator(function(req, param2) {
|
|
79
|
-
var logger, reporter, metrics, monitors, nodeReq, templates, serverManifest, locals, loaderContext, _matchRoute, routeInfo, params, onFallback, html, renderMode, pathname, headerData, onError, onTiming, onBoundError, renderOptions, response, _tmp;
|
|
78
|
+
var logger, reporter, metrics, monitors, nodeReq, templates, serverManifest, locals, matchPathname, loaderContext, forMatchpathname, _matchRoute, routeInfo, params, onFallback, html, renderMode, pathname, headerData, onError, onTiming, onBoundError, renderOptions, response, _tmp;
|
|
80
79
|
return _ts_generator(this, function(_state2) {
|
|
81
80
|
switch (_state2.label) {
|
|
82
81
|
case 0:
|
|
83
|
-
logger = param2.logger, reporter = param2.reporter, metrics = param2.metrics, monitors = param2.monitors, nodeReq = param2.nodeReq, templates = param2.templates, serverManifest = param2.serverManifest, locals = param2.locals, loaderContext = param2.loaderContext;
|
|
84
|
-
|
|
82
|
+
logger = param2.logger, reporter = param2.reporter, metrics = param2.metrics, monitors = param2.monitors, nodeReq = param2.nodeReq, templates = param2.templates, serverManifest = param2.serverManifest, locals = param2.locals, matchPathname = param2.matchPathname, loaderContext = param2.loaderContext;
|
|
83
|
+
forMatchpathname = matchPathname !== null && matchPathname !== void 0 ? matchPathname : getPathname(req);
|
|
84
|
+
_matchRoute = _sliced_to_array(matchRoute(router, forMatchpathname), 2), routeInfo = _matchRoute[0], params = _matchRoute[1];
|
|
85
85
|
onFallback = function() {
|
|
86
86
|
var _ref2 = _async_to_generator(function(reason, error) {
|
|
87
87
|
return _ts_generator(this, function(_state3) {
|
|
@@ -131,7 +131,7 @@ function _createRender() {
|
|
|
131
131
|
pathname = getPathname(req);
|
|
132
132
|
headerData = parseHeaders(req);
|
|
133
133
|
onError = function(e) {
|
|
134
|
-
monitors === null || monitors === void 0 ? void 0 : monitors.error("SSR Error - ".concat(_instanceof(e, Error) ? e.name : e, ", error = %s, req.url = %s, req.headers = %o"), _instanceof(e, Error) ? e.stack || e.message : e,
|
|
134
|
+
monitors === null || monitors === void 0 ? void 0 : monitors.error("SSR Error - ".concat(_instanceof(e, Error) ? e.name : e, ", error = %s, req.url = %s, req.headers = %o"), _instanceof(e, Error) ? e.stack || e.message : e, forMatchpathname, getHeadersWithoutCookie(headerData));
|
|
135
135
|
};
|
|
136
136
|
onTiming = function(name, dur) {
|
|
137
137
|
monitors === null || monitors === void 0 ? void 0 : monitors.timing(name, dur, "SSR");
|
|
@@ -2,9 +2,9 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
|
2
2
|
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
|
|
3
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
4
4
|
import { MAIN_ENTRY_NAME } from "@modern-js/utils/universal/constants";
|
|
5
|
-
import { parseHeaders, getPathname } from "../../utils";
|
|
6
5
|
import { X_MODERNJS_RENDER } from "../../constants";
|
|
7
|
-
import {
|
|
6
|
+
import { getPathname, parseHeaders } from "../../utils";
|
|
7
|
+
import { getCacheResult, matchCacheControl } from "./ssrCache";
|
|
8
8
|
var SERVER_RUNTIME_ENTRY = "requestHandler";
|
|
9
9
|
function ssrRender(request, _) {
|
|
10
10
|
return _ssrRender.apply(this, arguments);
|
package/dist/esm/serverBase.js
CHANGED
|
@@ -5,8 +5,8 @@ import { _ as _class_private_method_init } from "@swc/helpers/_/_class_private_m
|
|
|
5
5
|
import { _ as _create_class } from "@swc/helpers/_/_create_class";
|
|
6
6
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
7
7
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
8
|
-
import { Hono } from "hono";
|
|
9
8
|
import { createContext } from "@modern-js/plugin";
|
|
9
|
+
import { Hono } from "hono";
|
|
10
10
|
import { PluginManager } from "./pluginManager";
|
|
11
11
|
var _getAppContext = /* @__PURE__ */ new WeakSet(), _applyMiddlewares = /* @__PURE__ */ new WeakSet();
|
|
12
12
|
var ServerBase = /* @__PURE__ */ function() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import { fs, DEFAULT_SERVER_CONFIG,
|
|
2
|
+
import { fs, DEFAULT_SERVER_CONFIG, OUTPUT_CONFIG_FILE, lodash as _, compatibleRequire, ensureAbsolutePath, requireExistModule } from "@modern-js/utils";
|
|
3
3
|
import { parse } from "flatted";
|
|
4
4
|
const requireConfig = async (serverConfigPath) => {
|
|
5
5
|
if (fs.pathExistsSync(serverConfigPath)) {
|
|
@@ -8,11 +8,14 @@ const httpCallBack2HonoMid = (handler) => {
|
|
|
8
8
|
req.__honoRequest = context.req;
|
|
9
9
|
req.__templates = context.get("templates") || {};
|
|
10
10
|
req.__serverManifest = context.get("serverManifest") || {};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
try {
|
|
12
|
+
await handler(req, res);
|
|
13
|
+
} finally {
|
|
14
|
+
delete req.__honoRequest;
|
|
15
|
+
delete req.__templates;
|
|
16
|
+
delete req.__serverManifest;
|
|
17
|
+
res.removeListener("pipe", onPipe);
|
|
18
|
+
}
|
|
16
19
|
if (res.headersSent || res._modernBodyPiped) {
|
|
17
20
|
context.finalized = true;
|
|
18
21
|
} else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ServerResponse } from "node:http";
|
|
2
|
-
import { createReadableStreamFromReadable, writeReadableStreamToWritable } from "./polyfills/stream";
|
|
3
2
|
import { installGlobals } from "./polyfills/install";
|
|
3
|
+
import { createReadableStreamFromReadable, writeReadableStreamToWritable } from "./polyfills/stream";
|
|
4
4
|
import { writeReadableStreamToWritable as writeReadableStreamToWritable2 } from "./polyfills";
|
|
5
5
|
installGlobals();
|
|
6
6
|
const createWebRequest = (req, res, body) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { fileReader } from "@modern-js/runtime-utils/fileReader";
|
|
3
|
-
import { LOADABLE_STATS_FILE, MAIN_ENTRY_NAME, NESTED_ROUTE_SPEC_FILE, ROUTE_MANIFEST_FILE, SERVER_BUNDLE_DIRECTORY,
|
|
3
|
+
import { fs, LOADABLE_STATS_FILE, MAIN_ENTRY_NAME, NESTED_ROUTE_SPEC_FILE, ROUTE_MANIFEST_FILE, SERVER_BUNDLE_DIRECTORY, compatibleRequire } from "@modern-js/utils";
|
|
4
4
|
async function getHtmlTemplates(pwd, routes) {
|
|
5
5
|
const htmls = await Promise.all(routes.map(async (route) => {
|
|
6
6
|
let html;
|
|
@@ -49,7 +49,7 @@ async function getServerManifest(pwd, routes, logger) {
|
|
|
49
49
|
const renderBundle = await loadBundle(renderBundlePath, logger);
|
|
50
50
|
const loaderBundle = await loadBundle(loaderBundlePath, logger);
|
|
51
51
|
renderBundle && (renderBundles[entryName] = renderBundle);
|
|
52
|
-
loaderBundle && (loaderBundles[entryName] = loaderBundle);
|
|
52
|
+
loaderBundle && (loaderBundles[entryName] = (loaderBundle === null || loaderBundle === void 0 ? void 0 : loaderBundle.loadModules) ? await (loaderBundle === null || loaderBundle === void 0 ? void 0 : loaderBundle.loadModules()) : loaderBundle);
|
|
53
53
|
}));
|
|
54
54
|
const loadableUri = path.join(pwd, LOADABLE_STATS_FILE);
|
|
55
55
|
const loadableStats = await compatibleRequire(loadableUri).catch((_) => ({}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
+
import { fileReader } from "@modern-js/runtime-utils/fileReader";
|
|
2
3
|
import { fs } from "@modern-js/utils";
|
|
3
4
|
import { getMimeType } from "hono/utils/mime";
|
|
4
|
-
import { fileReader } from "@modern-js/runtime-utils/fileReader";
|
|
5
5
|
import { sortRoutes } from "../../../utils";
|
|
6
6
|
const serverStaticPlugin = () => ({
|
|
7
7
|
name: "@modern-js/plugin-server-static",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { FormData as NodeFormData, Headers as NodeHeaders, Request as NodeRequest, Response as NodeResponse } from "@web-std/fetch";
|
|
2
|
+
import { Blob as NodeBlob, File as NodeFile } from "@web-std/file";
|
|
3
|
+
import { ReadableStream as NodeReadableStream, TransformStream as NodeTransformStream, WritableStream as NodeWritableStream } from "@web-std/stream";
|
|
4
4
|
if (!Object.getOwnPropertyDescriptor(NodeHeaders.prototype, "getSetCookie")) {
|
|
5
5
|
Object.defineProperty(NodeHeaders.prototype, "getSetCookie", {
|
|
6
6
|
value: function getSetCookie() {
|
|
@@ -16,7 +16,9 @@ function createBaseHookContext(c, resParams) {
|
|
|
16
16
|
var _req = /* @__PURE__ */ new WeakMap(), _c = /* @__PURE__ */ new WeakMap(), _headersData = /* @__PURE__ */ new WeakMap(), _headers = /* @__PURE__ */ new WeakMap();
|
|
17
17
|
class BaseHookRequest {
|
|
18
18
|
get url() {
|
|
19
|
-
|
|
19
|
+
const query = _class_private_field_get(this, _c).req.query();
|
|
20
|
+
const q = Object.entries(query).map(([key, value]) => `${key}=${value}`).join("&");
|
|
21
|
+
return q ? `${_class_private_field_get(this, _c).req.path}?${q}` : _class_private_field_get(this, _c).req.path;
|
|
20
22
|
}
|
|
21
23
|
// TODO: remove next major version
|
|
22
24
|
set url(_u) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { createBaseHookContext } from "./base";
|
|
1
2
|
import { RouterAPI } from "./routerApi";
|
|
2
3
|
import { TemplateApi } from "./template";
|
|
3
|
-
import { createBaseHookContext } from "./base";
|
|
4
4
|
function getAfterMatchCtx(entryName, baseHookCtx) {
|
|
5
5
|
const afterMatchCtx = baseHookCtx;
|
|
6
6
|
afterMatchCtx.router = new RouterAPI(entryName);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { time } from "@modern-js/runtime-utils/time";
|
|
2
|
-
import { transformResponse } from "../../utils";
|
|
3
|
-
import { getLoaderCtx } from "../../helper";
|
|
4
2
|
import { ServerTimings } from "../../constants";
|
|
5
|
-
import {
|
|
3
|
+
import { getLoaderCtx } from "../../helper";
|
|
4
|
+
import { transformResponse } from "../../utils";
|
|
6
5
|
import { createBaseHookContext } from "./base";
|
|
6
|
+
import { createAfterStreamingRenderContext, createCustomMiddlewaresCtx, getAfterMatchCtx, getAfterRenderCtx } from "./context";
|
|
7
7
|
const noop = () => {
|
|
8
8
|
};
|
|
9
9
|
const isHtmlResponse = (response) => {
|
|
@@ -31,14 +31,7 @@ class CustomServer {
|
|
|
31
31
|
if (current !== entryName) {
|
|
32
32
|
const rewriteRoute = routes.find((route) => route.entryName === current);
|
|
33
33
|
if (rewriteRoute) {
|
|
34
|
-
|
|
35
|
-
const url2 = new URL(c.req.url);
|
|
36
|
-
const newUrl = new URL(rewriteRoute.urlPath, url2.origin);
|
|
37
|
-
return this.serverBase.request(newUrl, {
|
|
38
|
-
headers,
|
|
39
|
-
method,
|
|
40
|
-
signal
|
|
41
|
-
}, c.env);
|
|
34
|
+
c.set("matchPathname", rewriteRoute.urlPath);
|
|
42
35
|
}
|
|
43
36
|
}
|
|
44
37
|
if (c.finalized) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { injectRenderHandlerPlugin } from "./render";
|
|
2
|
-
import { initMonitorsPlugin, injectloggerPluigin, injectServerTiming } from "./monitors";
|
|
3
|
-
import { processedByPlugin } from "./processedBy";
|
|
4
1
|
import { logPlugin } from "./log";
|
|
2
|
+
import { initMonitorsPlugin, injectServerTiming, injectloggerPluigin } from "./monitors";
|
|
3
|
+
import { processedByPlugin } from "./processedBy";
|
|
4
|
+
import { injectRenderHandlerPlugin } from "./render";
|
|
5
5
|
function createDefaultPlugins(options = {}) {
|
|
6
6
|
const plugins = [
|
|
7
7
|
initMonitorsPlugin(),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MAIN_ENTRY_NAME } from "@modern-js/utils/universal/constants";
|
|
2
|
-
import {
|
|
2
|
+
import { getLoaderCtx } from "../../helper";
|
|
3
3
|
import { sortRoutes } from "../../utils";
|
|
4
4
|
import { CustomServer, getServerMidFromUnstableMid } from "../customServer";
|
|
5
|
-
import {
|
|
5
|
+
import { initReporter } from "../monitors";
|
|
6
6
|
export * from "./inject";
|
|
7
7
|
const renderPlugin = () => ({
|
|
8
8
|
name: "@modern-js/plugin-render",
|
|
@@ -61,6 +61,7 @@ function createRenderHandler(render) {
|
|
|
61
61
|
const serverManifest = c.get("serverManifest") || {};
|
|
62
62
|
const locals = c.get("locals");
|
|
63
63
|
const metrics = c.get("metrics");
|
|
64
|
+
const matchPathname = c.get("matchPathname");
|
|
64
65
|
const loaderContext = getLoaderCtx(c);
|
|
65
66
|
const request = c.req.raw;
|
|
66
67
|
const nodeReq = (_c_env_node = c.env.node) === null || _c_env_node === void 0 ? void 0 : _c_env_node.req;
|
|
@@ -73,7 +74,8 @@ function createRenderHandler(render) {
|
|
|
73
74
|
metrics,
|
|
74
75
|
serverManifest,
|
|
75
76
|
loaderContext,
|
|
76
|
-
locals
|
|
77
|
+
locals,
|
|
78
|
+
matchPathname
|
|
77
79
|
});
|
|
78
80
|
const { body, status, headers } = res;
|
|
79
81
|
const headersData = {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { compatibleRequire } from "@modern-js/utils";
|
|
1
2
|
import { cutNameByHyphen } from "@modern-js/utils/universal";
|
|
2
3
|
import { TrieRouter } from "hono/router/trie-router";
|
|
3
|
-
import { parseQuery, getPathname, createErrorHtml, sortRoutes, transformResponse, onError as onErrorFn, ErrorDigest, parseHeaders } from "../../utils";
|
|
4
4
|
import { REPLACE_REG, X_MODERNJS_RENDER } from "../../constants";
|
|
5
|
+
import { ErrorDigest, createErrorHtml, getPathname, onError as onErrorFn, parseHeaders, parseQuery, sortRoutes, transformResponse } from "../../utils";
|
|
5
6
|
import { dataHandler } from "./dataHandler";
|
|
6
7
|
import { ssrRender } from "./ssrRender";
|
|
7
|
-
import { compatibleRequire } from "@modern-js/utils";
|
|
8
8
|
const DYNAMIC_ROUTE_REG = /\/:./;
|
|
9
9
|
function getRouter(routes) {
|
|
10
10
|
const dynamicRoutes = [];
|
|
@@ -28,8 +28,7 @@ function getRouter(routes) {
|
|
|
28
28
|
}
|
|
29
29
|
return router;
|
|
30
30
|
}
|
|
31
|
-
function matchRoute(router,
|
|
32
|
-
const pathname = getPathname(request);
|
|
31
|
+
function matchRoute(router, pathname) {
|
|
33
32
|
const matched = router.match("*", pathname);
|
|
34
33
|
const result = matched[0][0];
|
|
35
34
|
return result || [];
|
|
@@ -44,8 +43,9 @@ function getHeadersWithoutCookie(headers) {
|
|
|
44
43
|
}
|
|
45
44
|
async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig, forceCSR, config, onFallback: onFallbackFn }) {
|
|
46
45
|
const router = getRouter(routes);
|
|
47
|
-
return async (req, { logger, reporter, metrics, monitors, nodeReq, templates, serverManifest, locals, loaderContext }) => {
|
|
48
|
-
const
|
|
46
|
+
return async (req, { logger, reporter, metrics, monitors, nodeReq, templates, serverManifest, locals, matchPathname, loaderContext }) => {
|
|
47
|
+
const forMatchpathname = matchPathname !== null && matchPathname !== void 0 ? matchPathname : getPathname(req);
|
|
48
|
+
const [routeInfo, params] = matchRoute(router, forMatchpathname);
|
|
49
49
|
const onFallback = async (reason, error) => {
|
|
50
50
|
return onFallbackFn === null || onFallbackFn === void 0 ? void 0 : onFallbackFn(reason, {
|
|
51
51
|
logger,
|
|
@@ -74,7 +74,7 @@ async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig
|
|
|
74
74
|
const pathname = getPathname(req);
|
|
75
75
|
const headerData = parseHeaders(req);
|
|
76
76
|
const onError = (e) => {
|
|
77
|
-
monitors === null || monitors === void 0 ? void 0 : monitors.error(`SSR Error - ${e instanceof Error ? e.name : e}, error = %s, req.url = %s, req.headers = %o`, e instanceof Error ? e.stack || e.message : e,
|
|
77
|
+
monitors === null || monitors === void 0 ? void 0 : monitors.error(`SSR Error - ${e instanceof Error ? e.name : e}, error = %s, req.url = %s, req.headers = %o`, e instanceof Error ? e.stack || e.message : e, forMatchpathname, getHeadersWithoutCookie(headerData));
|
|
78
78
|
};
|
|
79
79
|
const onTiming = (name, dur) => {
|
|
80
80
|
monitors === null || monitors === void 0 ? void 0 : monitors.timing(name, dur, "SSR");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MAIN_ENTRY_NAME } from "@modern-js/utils/universal/constants";
|
|
2
|
-
import { parseHeaders, getPathname } from "../../utils";
|
|
3
2
|
import { X_MODERNJS_RENDER } from "../../constants";
|
|
4
|
-
import {
|
|
3
|
+
import { getPathname, parseHeaders } from "../../utils";
|
|
4
|
+
import { getCacheResult, matchCacheControl } from "./ssrCache";
|
|
5
5
|
const SERVER_RUNTIME_ENTRY = "requestHandler";
|
|
6
6
|
async function ssrRender(request, { routeInfo, html, config: userConfig, staticGenerate, nodeReq, serverManifest, locals, params, loaderContext, reporter, cacheConfig, logger, metrics, onError, onTiming }) {
|
|
7
7
|
var _serverManifest_renderBundles;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as _class_private_method_get } from "@swc/helpers/_/_class_private_method_get";
|
|
2
2
|
import { _ as _class_private_method_init } from "@swc/helpers/_/_class_private_method_init";
|
|
3
|
-
import { Hono } from "hono";
|
|
4
3
|
import { createContext } from "@modern-js/plugin";
|
|
4
|
+
import { Hono } from "hono";
|
|
5
5
|
import { PluginManager } from "./pluginManager";
|
|
6
6
|
var _getAppContext = /* @__PURE__ */ new WeakSet(), _applyMiddlewares = /* @__PURE__ */ new WeakSet();
|
|
7
7
|
class ServerBase {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Context, HonoRequest, Middleware, Next, NodeRequest, NodeResponse, ServerEnv, ServerManifest } from '../../types';
|
|
2
2
|
type NodeBindings = {
|
|
3
3
|
node: {
|
|
4
4
|
req: NodeRequest & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ServerRoute } from '@modern-js/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { HtmlNormalizedConfig, Middleware, OutputNormalizedConfig, ServerPlugin } from '../../../types';
|
|
3
3
|
export declare const serverStaticPlugin: () => ServerPlugin;
|
|
4
4
|
export type PublicMiddlwareOptions = {
|
|
5
5
|
pwd: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AfterMatchContext, AfterRenderContext,
|
|
2
|
-
import type { Context, ServerEnv } from '../../types';
|
|
1
|
+
import type { AfterMatchContext, AfterRenderContext, AfterStreamingRenderContext, HookContext, MiddlewareContext, ServerRoute } from '@modern-js/types';
|
|
3
2
|
import type { ServerNodeEnv } from '../../adapters/node/hono';
|
|
3
|
+
import type { Context, ServerEnv } from '../../types';
|
|
4
4
|
import { type ResArgs } from './base';
|
|
5
5
|
export declare function getAfterMatchCtx(entryName: string, baseHookCtx: HookContext): AfterMatchContext;
|
|
6
6
|
export declare function getAfterRenderCtx(c: Context, baseHookCtx: HookContext, route: Partial<ServerRoute>): Promise<AfterRenderContext>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ServerRoute, UnstableMiddleware } from '@modern-js/types';
|
|
2
|
-
import type { ServerBase } from '../../serverBase';
|
|
3
|
-
import type { ServerHookRunner, Middleware, ServerEnv } from '../../types';
|
|
4
2
|
import type { ServerNodeEnv } from '../../adapters/node/hono';
|
|
3
|
+
import type { ServerBase } from '../../serverBase';
|
|
4
|
+
import type { Middleware, ServerEnv, ServerHookRunner } from '../../types';
|
|
5
5
|
export declare class CustomServer {
|
|
6
6
|
private runner;
|
|
7
7
|
private serverMiddlewarePromise;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { IncomingMessage } from 'http';
|
|
3
|
-
import type {
|
|
4
|
-
import type { OnError, OnTiming, Params } from '../../types/requestHandler';
|
|
3
|
+
import type { Logger, Metrics, Reporter, ServerRoute } from '@modern-js/types';
|
|
5
4
|
import type { CacheConfig, ServerManifest, UserConfig } from '../../types';
|
|
5
|
+
import type { OnError, OnTiming, Params } from '../../types/requestHandler';
|
|
6
6
|
export interface SSRRenderOptions {
|
|
7
7
|
pwd: string;
|
|
8
8
|
html: string;
|
|
@@ -6,32 +6,9 @@ type Route = string | string[] | {
|
|
|
6
6
|
resHeaders?: Record<string, unknown>;
|
|
7
7
|
};
|
|
8
8
|
export type Routes = Record<string, Route>;
|
|
9
|
-
type PreloadLink = {
|
|
10
|
-
url: string;
|
|
11
|
-
as?: string;
|
|
12
|
-
rel?: string;
|
|
13
|
-
};
|
|
14
|
-
type PreloadInclude = Array<string | PreloadLink>;
|
|
15
|
-
interface PreloadAttributes {
|
|
16
|
-
script?: Record<string, boolean | string>;
|
|
17
|
-
style?: Record<string, boolean | string>;
|
|
18
|
-
image?: Record<string, boolean | string>;
|
|
19
|
-
font?: Record<string, boolean | string>;
|
|
20
|
-
}
|
|
21
|
-
export type SSRPreload = {
|
|
22
|
-
/** Include external preload links to enhance the page's performance by preloading additional resources. */
|
|
23
|
-
include?: PreloadInclude;
|
|
24
|
-
/** Utilize string matching to exclude specific preload links. */
|
|
25
|
-
exclude?: RegExp | string;
|
|
26
|
-
/** Disable preload when the User-Agent is matched. */
|
|
27
|
-
userAgentFilter?: RegExp | string;
|
|
28
|
-
/** Include additional attributes to the Header Link. */
|
|
29
|
-
attributes?: PreloadAttributes;
|
|
30
|
-
};
|
|
31
9
|
export type SSR = boolean | {
|
|
32
10
|
forceCSR?: boolean;
|
|
33
11
|
mode?: SSRMode;
|
|
34
|
-
preload?: boolean | SSRPreload;
|
|
35
12
|
inlineScript?: boolean;
|
|
36
13
|
disablePrerender?: boolean;
|
|
37
14
|
unsafeHeaders?: string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/** Hooks */
|
|
3
|
-
import type { Server as NodeServer,
|
|
4
|
-
import type {
|
|
3
|
+
import type { IncomingMessage, Server as NodeServer, ServerResponse } from 'http';
|
|
4
|
+
import type { AsyncPipeline, AsyncSetup, AsyncWaterfall, CommonAPI, ParallelWorkflow, PluginOptions, ToRunners, ToThreads, createContext } from '@modern-js/plugin';
|
|
5
5
|
import type { AfterMatchContext, AfterRenderContext, AfterStreamingRenderContext, CacheOption, Container, HttpMethodDecider, ISAppContext, Logger, Metrics, MiddlewareContext, Reporter, ServerRoute, UnstableMiddleware } from '@modern-js/types';
|
|
6
6
|
import type { MiddlewareHandler } from 'hono';
|
|
7
7
|
import type { UserConfig } from './config';
|
|
@@ -14,6 +14,8 @@ export interface RenderOptions {
|
|
|
14
14
|
metrics?: Metrics;
|
|
15
15
|
/** @deprecated */
|
|
16
16
|
reporter?: Reporter;
|
|
17
|
+
/** For compat rewrite MPA, while not modify request */
|
|
18
|
+
matchPathname?: string;
|
|
17
19
|
monitors?: Monitors;
|
|
18
20
|
serverManifest: ServerManifest;
|
|
19
21
|
nodeReq?: IncomingMessage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Metrics, Reporter, ServerRoute
|
|
1
|
+
import type { Logger, Metrics, Reporter, ServerRoute } from '@modern-js/types';
|
|
2
2
|
import type { ServerUserConfig } from './config';
|
|
3
3
|
export type Resource = {
|
|
4
4
|
loadableStats: Record<string, any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { Readable } from 'node:stream';
|
|
3
|
-
import type {
|
|
3
|
+
import type { BaseSSRServerContext, Logger, Metrics, Monitors, NestedRoute, Reporter, ServerRoute } from '@modern-js/types';
|
|
4
4
|
import type { RequestHandler as BundleRequestHandler, OnError, OnTiming } from './requestHandler';
|
|
5
5
|
export type SSRServerContext = BaseSSRServerContext & {
|
|
6
6
|
staticGenerate?: boolean;
|
|
@@ -40,6 +40,7 @@ type ServerVariables = {
|
|
|
40
40
|
monitors: Monitors;
|
|
41
41
|
serverManifest?: ServerManifest;
|
|
42
42
|
templates?: Record<string, string>;
|
|
43
|
+
matchPathname?: string;
|
|
43
44
|
/**
|
|
44
45
|
* Communicating with custom server hook & modern ssrContext.
|
|
45
46
|
*
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.58.3
|
|
18
|
+
"version": "2.58.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
|
"flatted": "^3.2.9",
|
|
54
54
|
"hono": "^3.12.2",
|
|
55
55
|
"ts-deepmerge": "7.0.0",
|
|
56
|
-
"@modern-js/plugin": "2.58.
|
|
57
|
-
"@modern-js/utils": "2.58.
|
|
58
|
-
"@modern-js/
|
|
56
|
+
"@modern-js/plugin": "2.58.3",
|
|
57
|
+
"@modern-js/runtime-utils": "2.58.3",
|
|
58
|
+
"@modern-js/utils": "2.58.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
|
-
"@
|
|
69
|
-
"@
|
|
70
|
-
"@scripts/jest-config": "2.58.
|
|
68
|
+
"@modern-js/types": "2.58.3",
|
|
69
|
+
"@scripts/build": "2.58.3",
|
|
70
|
+
"@scripts/jest-config": "2.58.3"
|
|
71
71
|
},
|
|
72
72
|
"sideEffects": false,
|
|
73
73
|
"publishConfig": {
|