@modern-js/server-core 2.49.3 → 2.49.4-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/base/adapters/node/middlewares/serverPublic.js +1 -1
- package/dist/cjs/base/adapters/node/middlewares/serverStatic.js +1 -2
- package/dist/esm/base/adapters/node/middlewares/serverPublic.js +1 -1
- package/dist/esm/base/adapters/node/middlewares/serverStatic.js +1 -2
- package/dist/esm-node/base/adapters/node/middlewares/serverPublic.js +1 -1
- package/dist/esm-node/base/adapters/node/middlewares/serverStatic.js +1 -2
- package/package.json +5 -5
|
@@ -58,7 +58,7 @@ function createPublicMiddleware({ pwd, routes }) {
|
|
|
58
58
|
}
|
|
59
59
|
function matchRoute(req, routes) {
|
|
60
60
|
for (const route of routes.sort(import_utils.sortRoutes)) {
|
|
61
|
-
if (!route.isSSR &&
|
|
61
|
+
if (!route.isSSR && route.entryPath.startsWith("public") && req.path.startsWith(route.urlPath)) {
|
|
62
62
|
return route;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -35,7 +35,6 @@ var import_path = __toESM(require("path"));
|
|
|
35
35
|
var import_utils = require("@modern-js/utils");
|
|
36
36
|
var import_mime = require("hono/utils/mime");
|
|
37
37
|
var import_fileReader = require("@modern-js/runtime-utils/fileReader");
|
|
38
|
-
var import_utils2 = require("../../../utils");
|
|
39
38
|
var import_serverPublic = require("./serverPublic");
|
|
40
39
|
function createStaticMiddleware(options) {
|
|
41
40
|
const { pwd, routes } = options;
|
|
@@ -69,7 +68,7 @@ function createStaticMiddleware(options) {
|
|
|
69
68
|
if (hit) {
|
|
70
69
|
const filepath = import_path.default.join(pwd, pathname.replace(prefix, () => ""));
|
|
71
70
|
if (!await import_utils.fs.pathExists(filepath)) {
|
|
72
|
-
return
|
|
71
|
+
return next();
|
|
73
72
|
}
|
|
74
73
|
const mimeType = (0, import_mime.getMimeType)(filepath);
|
|
75
74
|
if (mimeType) {
|
|
@@ -65,7 +65,7 @@ function matchRoute(req, routes) {
|
|
|
65
65
|
try {
|
|
66
66
|
for (var _iterator = routes.sort(sortRoutes)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
67
67
|
var route = _step.value;
|
|
68
|
-
if (!route.isSSR &&
|
|
68
|
+
if (!route.isSSR && route.entryPath.startsWith("public") && req.path.startsWith(route.urlPath)) {
|
|
69
69
|
return route;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -5,7 +5,6 @@ import path from "path";
|
|
|
5
5
|
import { fs } from "@modern-js/utils";
|
|
6
6
|
import { getMimeType } from "hono/utils/mime";
|
|
7
7
|
import { fileReader } from "@modern-js/runtime-utils/fileReader";
|
|
8
|
-
import { createErrorHtml } from "../../../utils";
|
|
9
8
|
import { createPublicMiddleware } from "./serverPublic";
|
|
10
9
|
function createStaticMiddleware(options) {
|
|
11
10
|
var pwd = options.pwd, routes = options.routes;
|
|
@@ -54,7 +53,7 @@ function createStaticMiddleware(options) {
|
|
|
54
53
|
if (!_state.sent()) {
|
|
55
54
|
return [
|
|
56
55
|
2,
|
|
57
|
-
|
|
56
|
+
next()
|
|
58
57
|
];
|
|
59
58
|
}
|
|
60
59
|
mimeType = getMimeType(filepath);
|
|
@@ -25,7 +25,7 @@ function createPublicMiddleware({ pwd, routes }) {
|
|
|
25
25
|
}
|
|
26
26
|
function matchRoute(req, routes) {
|
|
27
27
|
for (const route of routes.sort(sortRoutes)) {
|
|
28
|
-
if (!route.isSSR &&
|
|
28
|
+
if (!route.isSSR && route.entryPath.startsWith("public") && req.path.startsWith(route.urlPath)) {
|
|
29
29
|
return route;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -2,7 +2,6 @@ import path from "path";
|
|
|
2
2
|
import { fs } from "@modern-js/utils";
|
|
3
3
|
import { getMimeType } from "hono/utils/mime";
|
|
4
4
|
import { fileReader } from "@modern-js/runtime-utils/fileReader";
|
|
5
|
-
import { createErrorHtml } from "../../../utils";
|
|
6
5
|
import { createPublicMiddleware } from "./serverPublic";
|
|
7
6
|
function createStaticMiddleware(options) {
|
|
8
7
|
const { pwd, routes } = options;
|
|
@@ -36,7 +35,7 @@ function createStaticMiddleware(options) {
|
|
|
36
35
|
if (hit) {
|
|
37
36
|
const filepath = path.join(pwd, pathname.replace(prefix, () => ""));
|
|
38
37
|
if (!await fs.pathExists(filepath)) {
|
|
39
|
-
return
|
|
38
|
+
return next();
|
|
40
39
|
}
|
|
41
40
|
const mimeType = getMimeType(filepath);
|
|
42
41
|
if (mimeType) {
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.49.
|
|
18
|
+
"version": "2.49.4-alpha.2",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"hono": "^3.12.2",
|
|
70
70
|
"isbot": "3.8.0",
|
|
71
71
|
"merge-deep": "^3.0.3",
|
|
72
|
-
"@modern-js/utils": "2.49.3",
|
|
73
72
|
"@modern-js/runtime-utils": "2.49.3",
|
|
74
|
-
"@modern-js/plugin": "2.49.3"
|
|
73
|
+
"@modern-js/plugin": "2.49.3",
|
|
74
|
+
"@modern-js/utils": "2.49.3"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/jest": "^29",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"ts-jest": "^29.1.0",
|
|
83
83
|
"typescript": "^5",
|
|
84
84
|
"@modern-js/types": "2.49.3",
|
|
85
|
-
"@scripts/
|
|
86
|
-
"@scripts/
|
|
85
|
+
"@scripts/build": "2.49.3",
|
|
86
|
+
"@scripts/jest-config": "2.49.3"
|
|
87
87
|
},
|
|
88
88
|
"sideEffects": false,
|
|
89
89
|
"publishConfig": {
|