@modern-js/render 3.1.0 → 3.1.1
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/rsc-html-stream/server.js +3 -3
- package/dist/cjs/server/rsc/csr.js +1 -1
- package/dist/esm/rsc-html-stream/server.js +3 -3
- package/dist/esm/server/rsc/csr.js +1 -1
- package/dist/esm-node/rsc-html-stream/server.mjs +3 -3
- package/dist/esm-node/server/rsc/csr.mjs +1 -1
- package/package.json +6 -6
|
@@ -23,7 +23,7 @@ __export(server_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(server_exports);
|
|
25
25
|
const encoder = new TextEncoder();
|
|
26
|
-
const
|
|
26
|
+
const closingTagsPattern = /<\/body>\s*<\/html>\s*$/i;
|
|
27
27
|
function injectRSCPayload(rscStream, { injectClosingTags = true }) {
|
|
28
28
|
const decoder = new TextDecoder();
|
|
29
29
|
let resolveFlightDataPromise;
|
|
@@ -34,8 +34,8 @@ function injectRSCPayload(rscStream, { injectClosingTags = true }) {
|
|
|
34
34
|
function flushBufferedChunks(controller) {
|
|
35
35
|
for (const chunk of buffered) {
|
|
36
36
|
let buf = decoder.decode(chunk);
|
|
37
|
-
if (
|
|
38
|
-
buf = buf.
|
|
37
|
+
if (closingTagsPattern.test(buf)) {
|
|
38
|
+
buf = buf.replace(closingTagsPattern, "");
|
|
39
39
|
}
|
|
40
40
|
controller.enqueue(encoder.encode(buf));
|
|
41
41
|
}
|
|
@@ -39,7 +39,7 @@ async function renderCSRWithRSC(options) {
|
|
|
39
39
|
const stream = htmlStream.pipeThrough((0, import_server.injectCSS)(cssFiles, {
|
|
40
40
|
injectClosingTags: false
|
|
41
41
|
})).pipeThrough((0, import_server.injectRSCPayload)(rscPayloadStream, {
|
|
42
|
-
injectClosingTags:
|
|
42
|
+
injectClosingTags: true
|
|
43
43
|
}));
|
|
44
44
|
return new Response(stream, {
|
|
45
45
|
status: 200,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const encoder = new TextEncoder();
|
|
2
|
-
const
|
|
2
|
+
const closingTagsPattern = /<\/body>\s*<\/html>\s*$/i;
|
|
3
3
|
function injectRSCPayload(rscStream, { injectClosingTags = true }) {
|
|
4
4
|
const decoder = new TextDecoder();
|
|
5
5
|
let resolveFlightDataPromise;
|
|
@@ -10,8 +10,8 @@ function injectRSCPayload(rscStream, { injectClosingTags = true }) {
|
|
|
10
10
|
function flushBufferedChunks(controller) {
|
|
11
11
|
for (const chunk of buffered) {
|
|
12
12
|
let buf = decoder.decode(chunk);
|
|
13
|
-
if (
|
|
14
|
-
buf = buf.
|
|
13
|
+
if (closingTagsPattern.test(buf)) {
|
|
14
|
+
buf = buf.replace(closingTagsPattern, "");
|
|
15
15
|
}
|
|
16
16
|
controller.enqueue(encoder.encode(buf));
|
|
17
17
|
}
|
|
@@ -16,7 +16,7 @@ async function renderCSRWithRSC(options) {
|
|
|
16
16
|
const stream = htmlStream.pipeThrough(injectCSS(cssFiles, {
|
|
17
17
|
injectClosingTags: false
|
|
18
18
|
})).pipeThrough(injectRSCPayload(rscPayloadStream, {
|
|
19
|
-
injectClosingTags:
|
|
19
|
+
injectClosingTags: true
|
|
20
20
|
}));
|
|
21
21
|
return new Response(stream, {
|
|
22
22
|
status: 200,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const encoder = new TextEncoder();
|
|
2
|
-
const
|
|
2
|
+
const closingTagsPattern = /<\/body>\s*<\/html>\s*$/i;
|
|
3
3
|
function injectRSCPayload(rscStream, { injectClosingTags = true }) {
|
|
4
4
|
const decoder = new TextDecoder();
|
|
5
5
|
let resolveFlightDataPromise;
|
|
@@ -10,8 +10,8 @@ function injectRSCPayload(rscStream, { injectClosingTags = true }) {
|
|
|
10
10
|
function flushBufferedChunks(controller) {
|
|
11
11
|
for (const chunk of buffered) {
|
|
12
12
|
let buf = decoder.decode(chunk);
|
|
13
|
-
if (
|
|
14
|
-
buf = buf.
|
|
13
|
+
if (closingTagsPattern.test(buf)) {
|
|
14
|
+
buf = buf.replace(closingTagsPattern, "");
|
|
15
15
|
}
|
|
16
16
|
controller.enqueue(encoder.encode(buf));
|
|
17
17
|
}
|
|
@@ -16,7 +16,7 @@ async function renderCSRWithRSC(options) {
|
|
|
16
16
|
const stream = htmlStream.pipeThrough(injectCSS(cssFiles, {
|
|
17
17
|
injectClosingTags: false
|
|
18
18
|
})).pipeThrough(injectRSCPayload(rscPayloadStream, {
|
|
19
|
-
injectClosingTags:
|
|
19
|
+
injectClosingTags: true
|
|
20
20
|
}));
|
|
21
21
|
return new Response(stream, {
|
|
22
22
|
status: 200,
|
package/package.json
CHANGED
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.1.
|
|
18
|
+
"version": "3.1.1",
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
21
21
|
"hook.d.ts"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@swc/helpers": "^0.5.17",
|
|
25
|
-
"@modern-js/types": "3.1.
|
|
26
|
-
"@modern-js/utils": "3.1.
|
|
25
|
+
"@modern-js/types": "3.1.1",
|
|
26
|
+
"@modern-js/utils": "3.1.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@rslib/core": "0.
|
|
29
|
+
"@rslib/core": "0.20.0",
|
|
30
30
|
"@types/react": "^19.2.14",
|
|
31
31
|
"@types/react-dom": "^19.2.3",
|
|
32
32
|
"react": "^19.2.4",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"react-server-dom-rspack": "0.0.1-beta.1",
|
|
35
35
|
"typescript": "^5",
|
|
36
36
|
"@modern-js/rslib": "2.68.10",
|
|
37
|
-
"@modern-js/server-core": "3.1.0",
|
|
38
37
|
"@scripts/rstest-config": "2.66.0",
|
|
39
|
-
"@scripts/build": "2.66.0"
|
|
38
|
+
"@scripts/build": "2.66.0",
|
|
39
|
+
"@modern-js/server-core": "3.1.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=17.0.2",
|