@bleedingdev/modern-js-server-core 3.2.0-ultramodern.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/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/cjs/adapters/node/helper/index.js +55 -0
- package/dist/cjs/adapters/node/helper/loadCache.js +58 -0
- package/dist/cjs/adapters/node/helper/loadConfig.js +78 -0
- package/dist/cjs/adapters/node/helper/loadEnv.js +66 -0
- package/dist/cjs/adapters/node/helper/loadPlugin.js +47 -0
- package/dist/cjs/adapters/node/helper/utils.js +39 -0
- package/dist/cjs/adapters/node/hono.js +95 -0
- package/dist/cjs/adapters/node/index.js +87 -0
- package/dist/cjs/adapters/node/node.js +180 -0
- package/dist/cjs/adapters/node/plugins/index.js +72 -0
- package/dist/cjs/adapters/node/plugins/nodeServer.js +43 -0
- package/dist/cjs/adapters/node/plugins/resource.js +206 -0
- package/dist/cjs/adapters/node/plugins/static.js +379 -0
- package/dist/cjs/constants.js +77 -0
- package/dist/cjs/context.js +41 -0
- package/dist/cjs/helper.js +45 -0
- package/dist/cjs/hono.js +46 -0
- package/dist/cjs/index.js +247 -0
- package/dist/cjs/plugins/compat/hooks.js +80 -0
- package/dist/cjs/plugins/compat/index.js +64 -0
- package/dist/cjs/plugins/contractGateAutopilot.js +158 -0
- package/dist/cjs/plugins/contractGateSnapshotStore.js +239 -0
- package/dist/cjs/plugins/default.js +61 -0
- package/dist/cjs/plugins/favicon.js +48 -0
- package/dist/cjs/plugins/index.js +157 -0
- package/dist/cjs/plugins/log.js +92 -0
- package/dist/cjs/plugins/mfCache.js +78 -0
- package/dist/cjs/plugins/middlewares.js +49 -0
- package/dist/cjs/plugins/monitors.js +192 -0
- package/dist/cjs/plugins/processedBy.js +50 -0
- package/dist/cjs/plugins/render/csrRscRender.js +74 -0
- package/dist/cjs/plugins/render/dataHandler.js +53 -0
- package/dist/cjs/plugins/render/index.js +158 -0
- package/dist/cjs/plugins/render/inject.js +92 -0
- package/dist/cjs/plugins/render/render.js +273 -0
- package/dist/cjs/plugins/render/renderRscHandler.js +72 -0
- package/dist/cjs/plugins/render/serverActionHandler.js +47 -0
- package/dist/cjs/plugins/render/ssrCache.js +198 -0
- package/dist/cjs/plugins/render/ssrRender.js +96 -0
- package/dist/cjs/plugins/render/utils.js +49 -0
- package/dist/cjs/plugins/route.js +68 -0
- package/dist/cjs/plugins/telemetry.js +1283 -0
- package/dist/cjs/serverBase.js +176 -0
- package/dist/cjs/types/config/bff.js +18 -0
- package/dist/cjs/types/config/dev.js +18 -0
- package/dist/cjs/types/config/html.js +18 -0
- package/dist/cjs/types/config/index.js +93 -0
- package/dist/cjs/types/config/output.js +18 -0
- package/dist/cjs/types/config/security.js +18 -0
- package/dist/cjs/types/config/server.js +18 -0
- package/dist/cjs/types/config/share.js +18 -0
- package/dist/cjs/types/config/source.js +18 -0
- package/dist/cjs/types/config/tools.js +18 -0
- package/dist/cjs/types/index.js +79 -0
- package/dist/cjs/types/plugins/base.js +18 -0
- package/dist/cjs/types/plugins/index.js +58 -0
- package/dist/cjs/types/plugins/plugin.js +18 -0
- package/dist/cjs/types/render.js +18 -0
- package/dist/cjs/types/requestHandler.js +18 -0
- package/dist/cjs/types/server.js +18 -0
- package/dist/cjs/utils/entry.js +40 -0
- package/dist/cjs/utils/env.js +51 -0
- package/dist/cjs/utils/error.js +93 -0
- package/dist/cjs/utils/index.js +114 -0
- package/dist/cjs/utils/middlewareCollector.js +63 -0
- package/dist/cjs/utils/publicDir.js +92 -0
- package/dist/cjs/utils/request.js +86 -0
- package/dist/cjs/utils/serverConfig.js +43 -0
- package/dist/cjs/utils/storage.js +69 -0
- package/dist/cjs/utils/transformStream.js +65 -0
- package/dist/cjs/utils/warmup.js +40 -0
- package/dist/esm/adapters/node/helper/index.mjs +5 -0
- package/dist/esm/adapters/node/helper/loadCache.mjs +14 -0
- package/dist/esm/adapters/node/helper/loadConfig.mjs +31 -0
- package/dist/esm/adapters/node/helper/loadEnv.mjs +22 -0
- package/dist/esm/adapters/node/helper/loadPlugin.mjs +13 -0
- package/dist/esm/adapters/node/helper/utils.mjs +5 -0
- package/dist/esm/adapters/node/hono.mjs +55 -0
- package/dist/esm/adapters/node/index.mjs +4 -0
- package/dist/esm/adapters/node/node.mjs +130 -0
- package/dist/esm/adapters/node/plugins/index.mjs +3 -0
- package/dist/esm/adapters/node/plugins/nodeServer.mjs +9 -0
- package/dist/esm/adapters/node/plugins/resource.mjs +138 -0
- package/dist/esm/adapters/node/plugins/static.mjs +329 -0
- package/dist/esm/constants.mjs +28 -0
- package/dist/esm/context.mjs +4 -0
- package/dist/esm/helper.mjs +11 -0
- package/dist/esm/hono.mjs +2 -0
- package/dist/esm/index.mjs +12 -0
- package/dist/esm/plugins/compat/hooks.mjs +40 -0
- package/dist/esm/plugins/compat/index.mjs +27 -0
- package/dist/esm/plugins/contractGateAutopilot.mjs +124 -0
- package/dist/esm/plugins/contractGateSnapshotStore.mjs +180 -0
- package/dist/esm/plugins/default.mjs +27 -0
- package/dist/esm/plugins/favicon.mjs +14 -0
- package/dist/esm/plugins/index.mjs +11 -0
- package/dist/esm/plugins/log.mjs +58 -0
- package/dist/esm/plugins/mfCache.mjs +35 -0
- package/dist/esm/plugins/middlewares.mjs +15 -0
- package/dist/esm/plugins/monitors.mjs +149 -0
- package/dist/esm/plugins/processedBy.mjs +16 -0
- package/dist/esm/plugins/render/csrRscRender.mjs +40 -0
- package/dist/esm/plugins/render/dataHandler.mjs +19 -0
- package/dist/esm/plugins/render/index.mjs +84 -0
- package/dist/esm/plugins/render/inject.mjs +55 -0
- package/dist/esm/plugins/render/render.mjs +230 -0
- package/dist/esm/plugins/render/renderRscHandler.mjs +38 -0
- package/dist/esm/plugins/render/serverActionHandler.mjs +13 -0
- package/dist/esm/plugins/render/ssrCache.mjs +158 -0
- package/dist/esm/plugins/render/ssrRender.mjs +62 -0
- package/dist/esm/plugins/render/utils.mjs +15 -0
- package/dist/esm/plugins/route.mjs +34 -0
- package/dist/esm/plugins/telemetry.mjs +1195 -0
- package/dist/esm/rslib-runtime.mjs +18 -0
- package/dist/esm/serverBase.mjs +139 -0
- package/dist/esm/types/config/bff.mjs +0 -0
- package/dist/esm/types/config/dev.mjs +0 -0
- package/dist/esm/types/config/html.mjs +0 -0
- package/dist/esm/types/config/index.mjs +6 -0
- package/dist/esm/types/config/output.mjs +0 -0
- package/dist/esm/types/config/security.mjs +0 -0
- package/dist/esm/types/config/server.mjs +0 -0
- package/dist/esm/types/config/share.mjs +0 -0
- package/dist/esm/types/config/source.mjs +0 -0
- package/dist/esm/types/config/tools.mjs +0 -0
- package/dist/esm/types/index.mjs +4 -0
- package/dist/esm/types/plugins/base.mjs +0 -0
- package/dist/esm/types/plugins/index.mjs +1 -0
- package/dist/esm/types/plugins/plugin.mjs +0 -0
- package/dist/esm/types/render.mjs +0 -0
- package/dist/esm/types/requestHandler.mjs +0 -0
- package/dist/esm/types/server.mjs +0 -0
- package/dist/esm/utils/entry.mjs +3 -0
- package/dist/esm/utils/env.mjs +14 -0
- package/dist/esm/utils/error.mjs +53 -0
- package/dist/esm/utils/index.mjs +9 -0
- package/dist/esm/utils/middlewareCollector.mjs +26 -0
- package/dist/esm/utils/publicDir.mjs +33 -0
- package/dist/esm/utils/request.mjs +40 -0
- package/dist/esm/utils/serverConfig.mjs +9 -0
- package/dist/esm/utils/storage.mjs +35 -0
- package/dist/esm/utils/transformStream.mjs +28 -0
- package/dist/esm/utils/warmup.mjs +6 -0
- package/dist/esm-node/adapters/node/helper/index.mjs +6 -0
- package/dist/esm-node/adapters/node/helper/loadCache.mjs +15 -0
- package/dist/esm-node/adapters/node/helper/loadConfig.mjs +32 -0
- package/dist/esm-node/adapters/node/helper/loadEnv.mjs +23 -0
- package/dist/esm-node/adapters/node/helper/loadPlugin.mjs +14 -0
- package/dist/esm-node/adapters/node/helper/utils.mjs +6 -0
- package/dist/esm-node/adapters/node/hono.mjs +56 -0
- package/dist/esm-node/adapters/node/index.mjs +5 -0
- package/dist/esm-node/adapters/node/node.mjs +131 -0
- package/dist/esm-node/adapters/node/plugins/index.mjs +4 -0
- package/dist/esm-node/adapters/node/plugins/nodeServer.mjs +10 -0
- package/dist/esm-node/adapters/node/plugins/resource.mjs +139 -0
- package/dist/esm-node/adapters/node/plugins/static.mjs +330 -0
- package/dist/esm-node/constants.mjs +29 -0
- package/dist/esm-node/context.mjs +5 -0
- package/dist/esm-node/helper.mjs +12 -0
- package/dist/esm-node/hono.mjs +3 -0
- package/dist/esm-node/index.mjs +13 -0
- package/dist/esm-node/plugins/compat/hooks.mjs +41 -0
- package/dist/esm-node/plugins/compat/index.mjs +28 -0
- package/dist/esm-node/plugins/contractGateAutopilot.mjs +125 -0
- package/dist/esm-node/plugins/contractGateSnapshotStore.mjs +182 -0
- package/dist/esm-node/plugins/default.mjs +28 -0
- package/dist/esm-node/plugins/favicon.mjs +15 -0
- package/dist/esm-node/plugins/index.mjs +12 -0
- package/dist/esm-node/plugins/log.mjs +59 -0
- package/dist/esm-node/plugins/mfCache.mjs +36 -0
- package/dist/esm-node/plugins/middlewares.mjs +16 -0
- package/dist/esm-node/plugins/monitors.mjs +150 -0
- package/dist/esm-node/plugins/processedBy.mjs +17 -0
- package/dist/esm-node/plugins/render/csrRscRender.mjs +41 -0
- package/dist/esm-node/plugins/render/dataHandler.mjs +20 -0
- package/dist/esm-node/plugins/render/index.mjs +85 -0
- package/dist/esm-node/plugins/render/inject.mjs +56 -0
- package/dist/esm-node/plugins/render/render.mjs +231 -0
- package/dist/esm-node/plugins/render/renderRscHandler.mjs +39 -0
- package/dist/esm-node/plugins/render/serverActionHandler.mjs +14 -0
- package/dist/esm-node/plugins/render/ssrCache.mjs +159 -0
- package/dist/esm-node/plugins/render/ssrRender.mjs +63 -0
- package/dist/esm-node/plugins/render/utils.mjs +16 -0
- package/dist/esm-node/plugins/route.mjs +35 -0
- package/dist/esm-node/plugins/telemetry.mjs +1196 -0
- package/dist/esm-node/rslib-runtime.mjs +19 -0
- package/dist/esm-node/serverBase.mjs +140 -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 +7 -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 +5 -0
- package/dist/esm-node/types/plugins/base.mjs +1 -0
- package/dist/esm-node/types/plugins/index.mjs +2 -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 +4 -0
- package/dist/esm-node/utils/env.mjs +15 -0
- package/dist/esm-node/utils/error.mjs +54 -0
- package/dist/esm-node/utils/index.mjs +10 -0
- package/dist/esm-node/utils/middlewareCollector.mjs +27 -0
- package/dist/esm-node/utils/publicDir.mjs +34 -0
- package/dist/esm-node/utils/request.mjs +41 -0
- package/dist/esm-node/utils/serverConfig.mjs +10 -0
- package/dist/esm-node/utils/storage.mjs +36 -0
- package/dist/esm-node/utils/transformStream.mjs +29 -0
- package/dist/esm-node/utils/warmup.mjs +7 -0
- package/dist/types/adapters/node/helper/index.d.ts +6 -0
- package/dist/types/adapters/node/helper/loadCache.d.ts +2 -0
- package/dist/types/adapters/node/helper/loadConfig.d.ts +3 -0
- package/dist/types/adapters/node/helper/loadEnv.d.ts +3 -0
- package/dist/types/adapters/node/helper/loadPlugin.d.ts +3 -0
- package/dist/types/adapters/node/helper/utils.d.ts +21 -0
- package/dist/types/adapters/node/hono.d.ts +19 -0
- package/dist/types/adapters/node/index.d.ts +5 -0
- package/dist/types/adapters/node/node.d.ts +17 -0
- package/dist/types/adapters/node/plugins/index.d.ts +3 -0
- package/dist/types/adapters/node/plugins/nodeServer.d.ts +6 -0
- package/dist/types/adapters/node/plugins/resource.d.ts +11 -0
- package/dist/types/adapters/node/plugins/static.d.ts +25 -0
- package/dist/types/constants.d.ts +26 -0
- package/dist/types/context.d.ts +3 -0
- package/dist/types/helper.d.ts +10 -0
- package/dist/types/hono.d.ts +3 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/plugins/compat/hooks.d.ts +8 -0
- package/dist/types/plugins/compat/index.d.ts +3 -0
- package/dist/types/plugins/contractGateAutopilot.d.ts +35 -0
- package/dist/types/plugins/contractGateSnapshotStore.d.ts +57 -0
- package/dist/types/plugins/default.d.ts +7 -0
- package/dist/types/plugins/favicon.d.ts +2 -0
- package/dist/types/plugins/index.d.ts +11 -0
- package/dist/types/plugins/log.d.ts +2 -0
- package/dist/types/plugins/mfCache.d.ts +12 -0
- package/dist/types/plugins/middlewares.d.ts +2 -0
- package/dist/types/plugins/monitors.d.ts +6 -0
- package/dist/types/plugins/processedBy.d.ts +2 -0
- package/dist/types/plugins/render/csrRscRender.d.ts +2 -0
- package/dist/types/plugins/render/dataHandler.d.ts +5 -0
- package/dist/types/plugins/render/index.d.ts +3 -0
- package/dist/types/plugins/render/inject.d.ts +7 -0
- package/dist/types/plugins/render/render.d.ts +16 -0
- package/dist/types/plugins/render/renderRscHandler.d.ts +2 -0
- package/dist/types/plugins/render/serverActionHandler.d.ts +2 -0
- package/dist/types/plugins/render/ssrCache.d.ts +18 -0
- package/dist/types/plugins/render/ssrRender.d.ts +26 -0
- package/dist/types/plugins/render/utils.d.ts +3 -0
- package/dist/types/plugins/route.d.ts +2 -0
- package/dist/types/plugins/telemetry.d.ts +309 -0
- package/dist/types/serverBase.d.ts +38 -0
- package/dist/types/types/config/bff.d.ts +142 -0
- package/dist/types/types/config/dev.d.ts +4 -0
- package/dist/types/types/config/html.d.ts +15 -0
- package/dist/types/types/config/index.d.ts +35 -0
- package/dist/types/types/config/output.d.ts +20 -0
- package/dist/types/types/config/security.d.ts +4 -0
- package/dist/types/types/config/server.d.ts +402 -0
- package/dist/types/types/config/share.d.ts +3 -0
- package/dist/types/types/config/source.d.ts +7 -0
- package/dist/types/types/config/tools.d.ts +2 -0
- package/dist/types/types/index.d.ts +4 -0
- package/dist/types/types/plugins/base.d.ts +57 -0
- package/dist/types/types/plugins/index.d.ts +2 -0
- package/dist/types/types/plugins/plugin.d.ts +31 -0
- package/dist/types/types/render.d.ts +24 -0
- package/dist/types/types/requestHandler.d.ts +48 -0
- package/dist/types/types/server.d.ts +67 -0
- package/dist/types/utils/entry.d.ts +3 -0
- package/dist/types/utils/env.d.ts +2 -0
- package/dist/types/utils/error.d.ts +8 -0
- package/dist/types/utils/index.d.ts +9 -0
- package/dist/types/utils/middlewareCollector.d.ts +12 -0
- package/dist/types/utils/publicDir.d.ts +40 -0
- package/dist/types/utils/request.d.ts +17 -0
- package/dist/types/utils/serverConfig.d.ts +8 -0
- package/dist/types/utils/storage.d.ts +5 -0
- package/dist/types/utils/transformStream.d.ts +5 -0
- package/dist/types/utils/warmup.d.ts +1 -0
- package/package.json +103 -0
- package/rslib.config.mts +4 -0
- package/rstest.config.mts +7 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
createPublicMiddleware: ()=>createPublicMiddleware,
|
|
37
|
+
createStaticMiddleware: ()=>createStaticMiddleware,
|
|
38
|
+
serverStaticPlugin: ()=>serverStaticPlugin
|
|
39
|
+
});
|
|
40
|
+
const fileReader_namespaceObject = require("@modern-js/runtime-utils/fileReader");
|
|
41
|
+
const utils_namespaceObject = require("@modern-js/utils");
|
|
42
|
+
const mime_namespaceObject = require("hono/utils/mime");
|
|
43
|
+
const external_path_namespaceObject = require("path");
|
|
44
|
+
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
45
|
+
const index_js_namespaceObject = require("../../../utils/index.js");
|
|
46
|
+
const publicDir_js_namespaceObject = require("../../../utils/publicDir.js");
|
|
47
|
+
const serverStaticPlugin = ()=>({
|
|
48
|
+
name: '@modern-js/plugin-server-static',
|
|
49
|
+
setup (api) {
|
|
50
|
+
api.onPrepare(()=>{
|
|
51
|
+
const { middlewares, distDirectory: pwd, routes } = api.getServerContext();
|
|
52
|
+
const config = api.getServerConfig();
|
|
53
|
+
const serverStaticMiddleware = createStaticMiddleware({
|
|
54
|
+
pwd: pwd,
|
|
55
|
+
routes,
|
|
56
|
+
output: config.output || {},
|
|
57
|
+
html: config.html || {},
|
|
58
|
+
server: config.server || {}
|
|
59
|
+
});
|
|
60
|
+
middlewares.push({
|
|
61
|
+
name: 'server-static',
|
|
62
|
+
handler: serverStaticMiddleware
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const PRE_COMPRESSED_ASSET_EXTENSIONS = {
|
|
68
|
+
br: '.br',
|
|
69
|
+
gzip: '.gz'
|
|
70
|
+
};
|
|
71
|
+
const PRE_COMPRESSED_SUPPORTED_ENCODINGS = [
|
|
72
|
+
'br',
|
|
73
|
+
'gzip'
|
|
74
|
+
];
|
|
75
|
+
const parseAcceptEncoding = (value)=>value.split(',').map((item)=>item.trim()).filter(Boolean).map((item)=>{
|
|
76
|
+
const [rawName, ...params] = item.split(';');
|
|
77
|
+
const name = rawName.trim().toLowerCase();
|
|
78
|
+
let q = 1;
|
|
79
|
+
for (const param of params){
|
|
80
|
+
const [key, rawValue] = param.split('=').map((v)=>v.trim());
|
|
81
|
+
if ('q' !== key.toLowerCase() || null == rawValue) continue;
|
|
82
|
+
const parsedQ = Number(rawValue);
|
|
83
|
+
if (!Number.isNaN(parsedQ)) q = Math.max(0, Math.min(parsedQ, 1));
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
name,
|
|
87
|
+
q
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
const getAcceptedEncodings = (value)=>{
|
|
91
|
+
if (!value) return [];
|
|
92
|
+
const parsed = parseAcceptEncoding(value);
|
|
93
|
+
const qualityByEncoding = new Map();
|
|
94
|
+
let wildcardQuality;
|
|
95
|
+
for (const { name, q } of parsed){
|
|
96
|
+
if ('*' === name) {
|
|
97
|
+
wildcardQuality = q;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
qualityByEncoding.set(name, q);
|
|
101
|
+
}
|
|
102
|
+
const getQuality = (encoding)=>{
|
|
103
|
+
const explicit = qualityByEncoding.get(encoding);
|
|
104
|
+
if (void 0 !== explicit) return explicit;
|
|
105
|
+
return wildcardQuality ?? 0;
|
|
106
|
+
};
|
|
107
|
+
return PRE_COMPRESSED_SUPPORTED_ENCODINGS.map((encoding)=>({
|
|
108
|
+
encoding,
|
|
109
|
+
quality: getQuality(encoding)
|
|
110
|
+
})).filter((item)=>item.quality > 0).sort((a, b)=>b.quality - a.quality).map((item)=>item.encoding);
|
|
111
|
+
};
|
|
112
|
+
const appendVaryHeader = (c, value)=>{
|
|
113
|
+
const current = c.res.headers.get('Vary');
|
|
114
|
+
if (!current) return void c.header('Vary', value);
|
|
115
|
+
const values = current.split(',').map((item)=>item.trim().toLowerCase()).filter(Boolean);
|
|
116
|
+
if (!values.includes(value.toLowerCase())) c.header('Vary', `${current}, ${value}`);
|
|
117
|
+
};
|
|
118
|
+
const resolvePreCompressedAsset = async (c, filepath)=>{
|
|
119
|
+
const brPath = `${filepath}${PRE_COMPRESSED_ASSET_EXTENSIONS.br}`;
|
|
120
|
+
const gzipPath = `${filepath}${PRE_COMPRESSED_ASSET_EXTENSIONS.gzip}`;
|
|
121
|
+
const [hasBr, hasGzip] = await Promise.all([
|
|
122
|
+
utils_namespaceObject.fs.pathExists(brPath),
|
|
123
|
+
utils_namespaceObject.fs.pathExists(gzipPath)
|
|
124
|
+
]);
|
|
125
|
+
const hasVariant = hasBr || hasGzip;
|
|
126
|
+
if (!hasVariant) return {
|
|
127
|
+
selected: null,
|
|
128
|
+
hasVariant: false
|
|
129
|
+
};
|
|
130
|
+
const acceptedEncodings = getAcceptedEncodings(c.req.header('accept-encoding'));
|
|
131
|
+
for (const encoding of acceptedEncodings){
|
|
132
|
+
if ('br' === encoding && hasBr) return {
|
|
133
|
+
selected: {
|
|
134
|
+
filepath: brPath,
|
|
135
|
+
encoding
|
|
136
|
+
},
|
|
137
|
+
hasVariant: true
|
|
138
|
+
};
|
|
139
|
+
if ('gzip' === encoding && hasGzip) return {
|
|
140
|
+
selected: {
|
|
141
|
+
filepath: gzipPath,
|
|
142
|
+
encoding
|
|
143
|
+
},
|
|
144
|
+
hasVariant: true
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
selected: null,
|
|
149
|
+
hasVariant: true
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
function createPublicMiddleware({ pwd, routes }) {
|
|
153
|
+
return async (c, next)=>{
|
|
154
|
+
const route = matchPublicRoute(c.req, routes);
|
|
155
|
+
if (route) {
|
|
156
|
+
const { entryPath } = route;
|
|
157
|
+
const originFilename = external_path_default().join(pwd, entryPath);
|
|
158
|
+
const preCompressedAsset = await resolvePreCompressedAsset(c, originFilename);
|
|
159
|
+
const filename = preCompressedAsset.selected?.filepath ?? originFilename;
|
|
160
|
+
const data = await fileReader_namespaceObject.fileReader.readFile(filename, 'buffer');
|
|
161
|
+
const mimeType = (0, mime_namespaceObject.getMimeType)(originFilename);
|
|
162
|
+
if (null !== data) {
|
|
163
|
+
const body = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
164
|
+
if (mimeType) c.header('Content-Type', mimeType);
|
|
165
|
+
Object.entries(route.responseHeaders || {}).forEach(([k, v])=>{
|
|
166
|
+
c.header(k, v);
|
|
167
|
+
});
|
|
168
|
+
if (preCompressedAsset.hasVariant) appendVaryHeader(c, 'Accept-Encoding');
|
|
169
|
+
if (preCompressedAsset.selected) c.header('Content-Encoding', preCompressedAsset.selected.encoding);
|
|
170
|
+
c.header('Content-Length', String(data.byteLength));
|
|
171
|
+
return c.body(body, 200);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return await next();
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function matchPublicRoute(req, routes) {
|
|
178
|
+
for (const route of routes.sort(index_js_namespaceObject.sortRoutes))if (!route.isSSR && route.entryPath.startsWith('public') && req.path.startsWith(route.urlPath)) return route;
|
|
179
|
+
}
|
|
180
|
+
const extractPathname = (url)=>{
|
|
181
|
+
try {
|
|
182
|
+
if (url.includes('://')) return new URL(url).pathname || '/';
|
|
183
|
+
if (url.startsWith('//')) return new URL(`http:${url}`).pathname || '/';
|
|
184
|
+
return url;
|
|
185
|
+
} catch (e) {
|
|
186
|
+
return url;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const MODULE_FEDERATION_MANIFEST_FILE = 'mf-manifest.json';
|
|
190
|
+
const MODULE_FEDERATION_OPTIONAL_FILES = [
|
|
191
|
+
'mf-stats.json'
|
|
192
|
+
];
|
|
193
|
+
const trimLeadingSlash = (value)=>value.replace(/^\/+/, '');
|
|
194
|
+
const joinModuleFederationAssetPath = (assetPath, assetName)=>{
|
|
195
|
+
if (!assetName) return '';
|
|
196
|
+
return trimLeadingSlash(external_path_default().posix.join(assetPath || '', assetName));
|
|
197
|
+
};
|
|
198
|
+
const appendModuleFederationAsset = (set, assetPath)=>{
|
|
199
|
+
if (!assetPath) return;
|
|
200
|
+
set.add(trimLeadingSlash(assetPath));
|
|
201
|
+
};
|
|
202
|
+
const appendModuleFederationAssets = (set, assets)=>{
|
|
203
|
+
assets?.js?.sync?.forEach((asset)=>appendModuleFederationAsset(set, asset));
|
|
204
|
+
assets?.js?.async?.forEach((asset)=>appendModuleFederationAsset(set, asset));
|
|
205
|
+
assets?.css?.sync?.forEach((asset)=>appendModuleFederationAsset(set, asset));
|
|
206
|
+
assets?.css?.async?.forEach((asset)=>appendModuleFederationAsset(set, asset));
|
|
207
|
+
};
|
|
208
|
+
const hasAbsoluteProtocol = (value)=>/^https?:\/\//i.test(value) || value.startsWith('//');
|
|
209
|
+
const ensureLeadingSlash = (value)=>{
|
|
210
|
+
if ('' === value) return '/';
|
|
211
|
+
return value.startsWith('/') ? value : `/${value}`;
|
|
212
|
+
};
|
|
213
|
+
const ensureTrailingSlash = (value)=>value.endsWith('/') ? value : `${value}/`;
|
|
214
|
+
const patchModuleFederationManifestPublicPath = (c, manifestBuffer, pathPrefix)=>{
|
|
215
|
+
try {
|
|
216
|
+
const manifest = JSON.parse(manifestBuffer.toString('utf-8'));
|
|
217
|
+
const publicPath = manifest.metaData?.publicPath;
|
|
218
|
+
if (!publicPath || hasAbsoluteProtocol(publicPath)) return manifestBuffer;
|
|
219
|
+
const requestURL = new URL(c.req.url);
|
|
220
|
+
const prefixPath = ensureTrailingSlash(ensureLeadingSlash(pathPrefix || '/'));
|
|
221
|
+
manifest.metaData = {
|
|
222
|
+
...manifest.metaData,
|
|
223
|
+
publicPath: `${requestURL.origin}${prefixPath}`
|
|
224
|
+
};
|
|
225
|
+
return Buffer.from(JSON.stringify(manifest), 'utf-8');
|
|
226
|
+
} catch {
|
|
227
|
+
return manifestBuffer;
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
const patchModuleFederationRemoteEntryPublicPath = (c, remoteEntryBuffer, pathPrefix)=>{
|
|
231
|
+
const requestURL = new URL(c.req.url);
|
|
232
|
+
const prefixPath = ensureTrailingSlash(ensureLeadingSlash(pathPrefix || '/'));
|
|
233
|
+
const publicPath = `${requestURL.origin}${prefixPath}`;
|
|
234
|
+
const source = remoteEntryBuffer.toString('utf-8');
|
|
235
|
+
const patched = source.replace(/__webpack_require__\.p\s*=\s*(['"`])[^'"`]*\1;/, `__webpack_require__.p = ${JSON.stringify(publicPath)};`).replace(/__rspack_require__\.p\s*=\s*(['"`])[^'"`]*\1;/, `__rspack_require__.p = ${JSON.stringify(publicPath)};`);
|
|
236
|
+
if (patched === source) return remoteEntryBuffer;
|
|
237
|
+
return Buffer.from(patched, 'utf-8');
|
|
238
|
+
};
|
|
239
|
+
const getModuleFederationAssetList = async (pwd)=>{
|
|
240
|
+
const assets = new Set();
|
|
241
|
+
const manifestPath = external_path_default().join(pwd, MODULE_FEDERATION_MANIFEST_FILE);
|
|
242
|
+
if (!await utils_namespaceObject.fs.pathExists(manifestPath)) return {
|
|
243
|
+
assets,
|
|
244
|
+
remoteEntry: null
|
|
245
|
+
};
|
|
246
|
+
assets.add(MODULE_FEDERATION_MANIFEST_FILE);
|
|
247
|
+
const manifestBuffer = await fileReader_namespaceObject.fileReader.readFileFromSystem(manifestPath, 'buffer');
|
|
248
|
+
if (null === manifestBuffer) return {
|
|
249
|
+
assets,
|
|
250
|
+
remoteEntry: null
|
|
251
|
+
};
|
|
252
|
+
for (const filename of MODULE_FEDERATION_OPTIONAL_FILES)if (await utils_namespaceObject.fs.pathExists(external_path_default().join(pwd, filename))) assets.add(filename);
|
|
253
|
+
let remoteEntryFile = null;
|
|
254
|
+
try {
|
|
255
|
+
const manifest = JSON.parse(manifestBuffer.toString('utf-8'));
|
|
256
|
+
const remoteEntry = joinModuleFederationAssetPath(manifest.metaData?.remoteEntry?.path, manifest.metaData?.remoteEntry?.name);
|
|
257
|
+
const dtsZip = joinModuleFederationAssetPath(manifest.metaData?.types?.path, manifest.metaData?.types?.zip);
|
|
258
|
+
const dtsApi = joinModuleFederationAssetPath(manifest.metaData?.types?.path, manifest.metaData?.types?.api);
|
|
259
|
+
if (remoteEntry) {
|
|
260
|
+
assets.add(remoteEntry);
|
|
261
|
+
remoteEntryFile = remoteEntry;
|
|
262
|
+
}
|
|
263
|
+
if (dtsZip) assets.add(dtsZip);
|
|
264
|
+
if (dtsApi) assets.add(dtsApi);
|
|
265
|
+
manifest.shared?.forEach((item)=>appendModuleFederationAssets(assets, item.assets));
|
|
266
|
+
manifest.remotes?.forEach((item)=>appendModuleFederationAssets(assets, item.assets));
|
|
267
|
+
manifest.exposes?.forEach((item)=>appendModuleFederationAssets(assets, item.assets));
|
|
268
|
+
} catch {}
|
|
269
|
+
return {
|
|
270
|
+
assets,
|
|
271
|
+
remoteEntry: remoteEntryFile
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
function createStaticMiddleware(options) {
|
|
275
|
+
const { pwd, routes } = options;
|
|
276
|
+
const prefix = options.output.assetPrefix || '/';
|
|
277
|
+
const pathPrefix = extractPathname(prefix);
|
|
278
|
+
const { distPath: { css: cssPath, js: jsPath, media: mediaPath } = {} } = options.output;
|
|
279
|
+
const { favicon } = options.html;
|
|
280
|
+
const { publicDir } = options.server;
|
|
281
|
+
const favicons = prepareFavicons(favicon);
|
|
282
|
+
const staticFiles = [
|
|
283
|
+
cssPath,
|
|
284
|
+
jsPath,
|
|
285
|
+
mediaPath
|
|
286
|
+
].filter((v)=>Boolean(v));
|
|
287
|
+
const publicDirPatterns = (0, publicDir_js_namespaceObject.getPublicDirPatterns)(publicDir);
|
|
288
|
+
const staticReg = [
|
|
289
|
+
'static/',
|
|
290
|
+
'upload/',
|
|
291
|
+
...staticFiles,
|
|
292
|
+
...publicDirPatterns
|
|
293
|
+
];
|
|
294
|
+
const iconReg = [
|
|
295
|
+
'favicon.ico',
|
|
296
|
+
'icon.png',
|
|
297
|
+
...favicons
|
|
298
|
+
];
|
|
299
|
+
const regPrefix = pathPrefix.endsWith('/') ? pathPrefix : `${pathPrefix}/`;
|
|
300
|
+
const staticPathRegExp = new RegExp(`^${regPrefix}(${[
|
|
301
|
+
...staticReg,
|
|
302
|
+
...iconReg
|
|
303
|
+
].join('|')})`);
|
|
304
|
+
const publicMiddleware = createPublicMiddleware({
|
|
305
|
+
pwd,
|
|
306
|
+
routes: routes || []
|
|
307
|
+
});
|
|
308
|
+
let moduleFederationAssetsPromise = null;
|
|
309
|
+
const getModuleFederationAssets = async ()=>{
|
|
310
|
+
if (!moduleFederationAssetsPromise) moduleFederationAssetsPromise = getModuleFederationAssetList(pwd);
|
|
311
|
+
return moduleFederationAssetsPromise;
|
|
312
|
+
};
|
|
313
|
+
const serveFile = async (c, filepath, moduleFederationAsset = false, moduleFederationRemoteEntry = false, requestPath = '')=>{
|
|
314
|
+
if (moduleFederationAsset) {
|
|
315
|
+
c.header('Access-Control-Allow-Origin', '*');
|
|
316
|
+
c.header('Access-Control-Allow-Headers', '*');
|
|
317
|
+
c.header('Access-Control-Allow-Methods', 'GET,HEAD,OPTIONS');
|
|
318
|
+
}
|
|
319
|
+
const mimeType = (0, mime_namespaceObject.getMimeType)(filepath);
|
|
320
|
+
if (mimeType) c.header('Content-Type', mimeType);
|
|
321
|
+
const shouldPatchManifest = moduleFederationAsset && requestPath === MODULE_FEDERATION_MANIFEST_FILE;
|
|
322
|
+
const shouldPatchRemoteEntry = moduleFederationRemoteEntry;
|
|
323
|
+
const canUsePreCompressed = !shouldPatchManifest && !shouldPatchRemoteEntry;
|
|
324
|
+
const preCompressedAsset = canUsePreCompressed ? await resolvePreCompressedAsset(c, filepath) : {
|
|
325
|
+
selected: null,
|
|
326
|
+
hasVariant: false
|
|
327
|
+
};
|
|
328
|
+
const targetFilepath = preCompressedAsset.selected?.filepath ?? filepath;
|
|
329
|
+
const chunk = await fileReader_namespaceObject.fileReader.readFileFromSystem(targetFilepath, 'buffer');
|
|
330
|
+
if (null === chunk) return null;
|
|
331
|
+
const responseChunk = shouldPatchManifest ? patchModuleFederationManifestPublicPath(c, chunk, pathPrefix) : shouldPatchRemoteEntry ? patchModuleFederationRemoteEntryPublicPath(c, chunk, pathPrefix) : chunk;
|
|
332
|
+
if (preCompressedAsset.hasVariant) appendVaryHeader(c, 'Accept-Encoding');
|
|
333
|
+
if (preCompressedAsset.selected) c.header('Content-Encoding', preCompressedAsset.selected.encoding);
|
|
334
|
+
c.header('Content-Length', String(responseChunk.byteLength));
|
|
335
|
+
const body = new Uint8Array(responseChunk.buffer, responseChunk.byteOffset, responseChunk.byteLength);
|
|
336
|
+
return c.body(body, 200);
|
|
337
|
+
};
|
|
338
|
+
return async (c, next)=>{
|
|
339
|
+
const pageRoute = c.get('route');
|
|
340
|
+
const pathname = c.req.path;
|
|
341
|
+
if (pageRoute && '' === external_path_default().extname(pathname)) return next();
|
|
342
|
+
const hit = staticPathRegExp.test(pathname);
|
|
343
|
+
const requestPath = trimLeadingSlash(pathname.replace(pathPrefix, ()=>''));
|
|
344
|
+
if (requestPath.includes('..')) return next();
|
|
345
|
+
const moduleFederationAssetMeta = await getModuleFederationAssets();
|
|
346
|
+
const isModuleFederationAsset = moduleFederationAssetMeta.assets.has(requestPath);
|
|
347
|
+
const isModuleFederationRemoteEntry = moduleFederationAssetMeta.remoteEntry === requestPath;
|
|
348
|
+
const serveByPath = async (filepath, moduleFederationAsset = false, moduleFederationRemoteEntry = false)=>{
|
|
349
|
+
if (!await utils_namespaceObject.fs.pathExists(filepath)) return null;
|
|
350
|
+
return serveFile(c, filepath, moduleFederationAsset, moduleFederationRemoteEntry, requestPath);
|
|
351
|
+
};
|
|
352
|
+
if (hit) {
|
|
353
|
+
const response = await serveByPath(external_path_default().join(pwd, requestPath), isModuleFederationAsset, isModuleFederationRemoteEntry);
|
|
354
|
+
if (null !== response) return response;
|
|
355
|
+
return next();
|
|
356
|
+
}
|
|
357
|
+
if (isModuleFederationAsset) {
|
|
358
|
+
const response = await serveByPath(external_path_default().join(pwd, requestPath), true, isModuleFederationRemoteEntry);
|
|
359
|
+
if (null !== response) return response;
|
|
360
|
+
}
|
|
361
|
+
return publicMiddleware(c, next);
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
const prepareFavicons = (favicon)=>{
|
|
365
|
+
const faviconNames = [];
|
|
366
|
+
if (favicon && 'string' == typeof favicon) faviconNames.push(favicon.substring(favicon.lastIndexOf('/') + 1));
|
|
367
|
+
return faviconNames;
|
|
368
|
+
};
|
|
369
|
+
exports.createPublicMiddleware = __webpack_exports__.createPublicMiddleware;
|
|
370
|
+
exports.createStaticMiddleware = __webpack_exports__.createStaticMiddleware;
|
|
371
|
+
exports.serverStaticPlugin = __webpack_exports__.serverStaticPlugin;
|
|
372
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
373
|
+
"createPublicMiddleware",
|
|
374
|
+
"createStaticMiddleware",
|
|
375
|
+
"serverStaticPlugin"
|
|
376
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
377
|
+
Object.defineProperty(exports, '__esModule', {
|
|
378
|
+
value: true
|
|
379
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
AGGRED_DIR: ()=>AGGRED_DIR,
|
|
28
|
+
REPLACE_REG: ()=>REPLACE_REG,
|
|
29
|
+
SERVER_TIMING: ()=>SERVER_TIMING,
|
|
30
|
+
ServerTimings: ()=>ServerTimings,
|
|
31
|
+
X_MODERNJS_RENDER: ()=>X_MODERNJS_RENDER,
|
|
32
|
+
X_RENDER_CACHE: ()=>X_RENDER_CACHE
|
|
33
|
+
});
|
|
34
|
+
const AGGRED_DIR = {
|
|
35
|
+
mock: 'config/mock',
|
|
36
|
+
server: 'server',
|
|
37
|
+
api: 'api',
|
|
38
|
+
shared: 'shared',
|
|
39
|
+
lambda: 'lambda'
|
|
40
|
+
};
|
|
41
|
+
const REPLACE_REG = {
|
|
42
|
+
before: {
|
|
43
|
+
head: '<head\\b[^>]*>',
|
|
44
|
+
body: '<body\\b[^>]*>'
|
|
45
|
+
},
|
|
46
|
+
after: {
|
|
47
|
+
head: '</head>',
|
|
48
|
+
body: '</body>'
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var ServerTimings = /*#__PURE__*/ function(ServerTimings) {
|
|
52
|
+
ServerTimings["SERVER_HANDLE_REQUEST"] = "server-handle-request";
|
|
53
|
+
ServerTimings["SERVER_MIDDLEWARE"] = "server-middleware";
|
|
54
|
+
ServerTimings["SERVER_HOOK_AFTER_RENDER"] = "server-hook-after-render";
|
|
55
|
+
ServerTimings["SERVER_HOOK_AFTER_MATCH"] = "server-hook-after-match";
|
|
56
|
+
return ServerTimings;
|
|
57
|
+
}({});
|
|
58
|
+
const SERVER_TIMING = 'Server-Timing';
|
|
59
|
+
const X_RENDER_CACHE = 'x-render-cache';
|
|
60
|
+
const X_MODERNJS_RENDER = 'x-modernjs-render';
|
|
61
|
+
exports.AGGRED_DIR = __webpack_exports__.AGGRED_DIR;
|
|
62
|
+
exports.REPLACE_REG = __webpack_exports__.REPLACE_REG;
|
|
63
|
+
exports.SERVER_TIMING = __webpack_exports__.SERVER_TIMING;
|
|
64
|
+
exports.ServerTimings = __webpack_exports__.ServerTimings;
|
|
65
|
+
exports.X_MODERNJS_RENDER = __webpack_exports__.X_MODERNJS_RENDER;
|
|
66
|
+
exports.X_RENDER_CACHE = __webpack_exports__.X_RENDER_CACHE;
|
|
67
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
68
|
+
"AGGRED_DIR",
|
|
69
|
+
"REPLACE_REG",
|
|
70
|
+
"SERVER_TIMING",
|
|
71
|
+
"ServerTimings",
|
|
72
|
+
"X_MODERNJS_RENDER",
|
|
73
|
+
"X_RENDER_CACHE"
|
|
74
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
75
|
+
Object.defineProperty(exports, '__esModule', {
|
|
76
|
+
value: true
|
|
77
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
run: ()=>run,
|
|
28
|
+
useHonoContext: ()=>useHonoContext
|
|
29
|
+
});
|
|
30
|
+
const storage_js_namespaceObject = require("./utils/storage.js");
|
|
31
|
+
const kHonoContextStorage = Symbol.for('modernjs.server-core.honoContextStorage');
|
|
32
|
+
const { run, useContext: useHonoContext } = (0, storage_js_namespaceObject.createStorage)(kHonoContextStorage);
|
|
33
|
+
exports.run = __webpack_exports__.run;
|
|
34
|
+
exports.useHonoContext = __webpack_exports__.useHonoContext;
|
|
35
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
36
|
+
"run",
|
|
37
|
+
"useHonoContext"
|
|
38
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
39
|
+
Object.defineProperty(exports, '__esModule', {
|
|
40
|
+
value: true
|
|
41
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
getLoaderCtx: ()=>getLoaderCtx
|
|
28
|
+
});
|
|
29
|
+
const LOADER_CONTEXT = 'loaderContext';
|
|
30
|
+
function getLoaderCtx(c) {
|
|
31
|
+
const loaderContext = c.get(LOADER_CONTEXT);
|
|
32
|
+
if (loaderContext) return loaderContext;
|
|
33
|
+
{
|
|
34
|
+
const loaderContext = new Map();
|
|
35
|
+
c.set(LOADER_CONTEXT, loaderContext);
|
|
36
|
+
return loaderContext;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.getLoaderCtx = __webpack_exports__.getLoaderCtx;
|
|
40
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
41
|
+
"getLoaderCtx"
|
|
42
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
43
|
+
Object.defineProperty(exports, '__esModule', {
|
|
44
|
+
value: true
|
|
45
|
+
});
|
package/dist/cjs/hono.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
deleteCookie: ()=>cookie_namespaceObject.deleteCookie,
|
|
28
|
+
getCookie: ()=>cookie_namespaceObject.getCookie,
|
|
29
|
+
languageDetector: ()=>language_namespaceObject.languageDetector,
|
|
30
|
+
setCookie: ()=>cookie_namespaceObject.setCookie
|
|
31
|
+
});
|
|
32
|
+
const cookie_namespaceObject = require("hono/cookie");
|
|
33
|
+
const language_namespaceObject = require("hono/language");
|
|
34
|
+
exports.deleteCookie = __webpack_exports__.deleteCookie;
|
|
35
|
+
exports.getCookie = __webpack_exports__.getCookie;
|
|
36
|
+
exports.languageDetector = __webpack_exports__.languageDetector;
|
|
37
|
+
exports.setCookie = __webpack_exports__.setCookie;
|
|
38
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
39
|
+
"deleteCookie",
|
|
40
|
+
"getCookie",
|
|
41
|
+
"languageDetector",
|
|
42
|
+
"setCookie"
|
|
43
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
44
|
+
Object.defineProperty(exports, '__esModule', {
|
|
45
|
+
value: true
|
|
46
|
+
});
|