@modern-js/server-core 2.63.6 → 2.63.7
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.
|
@@ -23,9 +23,9 @@ __export(ssrCache_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(ssrCache_exports);
|
|
25
25
|
var import_storer = require("@modern-js/runtime-utils/storer");
|
|
26
|
-
var import_utils = require("@modern-js/utils");
|
|
27
26
|
var import_constants = require("../../constants");
|
|
28
|
-
var
|
|
27
|
+
var import_utils = require("../../utils");
|
|
28
|
+
const removeTailSlash = (s) => s.replace(/\/+$/, "");
|
|
29
29
|
const ZERO_RENDER_LEVEL = /"renderLevel":0/;
|
|
30
30
|
const NO_SSR_CACHE = /<meta\s+[^>]*name=["']no-ssr-cache["'][^>]*>/i;
|
|
31
31
|
async function processCache({ request, key, requestHandler, requestHandlerOptions, ttl, container, cacheStatus }) {
|
|
@@ -33,7 +33,7 @@ async function processCache({ request, key, requestHandler, requestHandlerOption
|
|
|
33
33
|
const { onError } = requestHandlerOptions;
|
|
34
34
|
const decoder = new TextDecoder();
|
|
35
35
|
if (response.body) {
|
|
36
|
-
const stream = (0,
|
|
36
|
+
const stream = (0, import_utils.createTransformStream)();
|
|
37
37
|
const reader = response.body.getReader();
|
|
38
38
|
const writer = stream.writable.getWriter();
|
|
39
39
|
let html = "";
|
|
@@ -78,9 +78,9 @@ async function processCache({ request, key, requestHandler, requestHandlerOption
|
|
|
78
78
|
const CACHE_NAMESPACE = "__ssr__cache";
|
|
79
79
|
const storage = (0, import_storer.createMemoryStorage)(CACHE_NAMESPACE);
|
|
80
80
|
function computedKey(req, cacheControl) {
|
|
81
|
-
const pathname = (0,
|
|
81
|
+
const pathname = (0, import_utils.getPathname)(req);
|
|
82
82
|
const { customKey } = cacheControl;
|
|
83
|
-
const defaultKey = pathname === "/" ? pathname :
|
|
83
|
+
const defaultKey = pathname === "/" ? pathname : removeTailSlash(pathname);
|
|
84
84
|
if (customKey) {
|
|
85
85
|
if (typeof customKey === "string") {
|
|
86
86
|
return customKey;
|
|
@@ -4,9 +4,11 @@ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
|
4
4
|
import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
|
5
5
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
6
6
|
import { createMemoryStorage } from "@modern-js/runtime-utils/storer";
|
|
7
|
-
import { removeTailSlash } from "@modern-js/utils";
|
|
8
7
|
import { X_RENDER_CACHE } from "../../constants";
|
|
9
8
|
import { createTransformStream, getPathname } from "../../utils";
|
|
9
|
+
var removeTailSlash = function(s) {
|
|
10
|
+
return s.replace(/\/+$/, "");
|
|
11
|
+
};
|
|
10
12
|
var ZERO_RENDER_LEVEL = /"renderLevel":0/;
|
|
11
13
|
var NO_SSR_CACHE = /<meta\s+[^>]*name=["']no-ssr-cache["'][^>]*>/i;
|
|
12
14
|
function processCache(_) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createMemoryStorage } from "@modern-js/runtime-utils/storer";
|
|
2
|
-
import { removeTailSlash } from "@modern-js/utils";
|
|
3
2
|
import { X_RENDER_CACHE } from "../../constants";
|
|
4
3
|
import { createTransformStream, getPathname } from "../../utils";
|
|
4
|
+
const removeTailSlash = (s) => s.replace(/\/+$/, "");
|
|
5
5
|
const ZERO_RENDER_LEVEL = /"renderLevel":0/;
|
|
6
6
|
const NO_SSR_CACHE = /<meta\s+[^>]*name=["']no-ssr-cache["'][^>]*>/i;
|
|
7
7
|
async function processCache({ request, key, requestHandler, requestHandlerOptions, ttl, container, cacheStatus }) {
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.63.
|
|
18
|
+
"version": "2.63.7",
|
|
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.2",
|
|
56
|
-
"@modern-js/plugin": "2.63.
|
|
57
|
-
"@modern-js/runtime-utils": "2.63.
|
|
58
|
-
"@modern-js/utils": "2.63.
|
|
56
|
+
"@modern-js/plugin": "2.63.7",
|
|
57
|
+
"@modern-js/runtime-utils": "2.63.7",
|
|
58
|
+
"@modern-js/utils": "2.63.7"
|
|
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
|
-
"@modern-js/types": "2.63.
|
|
69
|
-
"@scripts/build": "2.63.
|
|
70
|
-
"@scripts/jest-config": "2.63.
|
|
68
|
+
"@modern-js/types": "2.63.7",
|
|
69
|
+
"@scripts/build": "2.63.7",
|
|
70
|
+
"@scripts/jest-config": "2.63.7"
|
|
71
71
|
},
|
|
72
72
|
"sideEffects": false,
|
|
73
73
|
"publishConfig": {
|