@modern-js/render 3.0.0-alpha.1 → 3.0.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.
@@ -30,6 +30,7 @@ var client_exports = {};
30
30
  __export(client_exports, {
31
31
  ElementsContext: () => ElementsContext,
32
32
  RSCServerSlot: () => RSCServerSlot,
33
+ ResetRootContext: () => ResetRootContext,
33
34
  RscClientRoot: () => RscClientRoot,
34
35
  ServerElementsProvider: () => ServerElementsProvider,
35
36
  callServer: () => import_callServer.callServer,
@@ -46,10 +47,14 @@ var import_client = require("react-server-dom-webpack/client.browser");
46
47
  var import_client2 = require("../rsc-html-stream/client");
47
48
  var import_callServer = require("./callServer");
48
49
  var import_client3 = require("react-server-dom-webpack/client.browser");
50
+ const ResetRootContext = /* @__PURE__ */ (0, import_react2.createContext)(void 0);
49
51
  function RscClientRoot({ rscPayload }) {
50
52
  const elements = import_react.default.use(rscPayload);
51
53
  const [root, setRoot] = (0, import_react2.useState)(elements);
52
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResetRootContext.Provider, {
55
+ value: {
56
+ setRoot
57
+ },
53
58
  children: root
54
59
  });
55
60
  }
@@ -70,6 +75,7 @@ const RSCServerSlot = () => {
70
75
  0 && (module.exports = {
71
76
  ElementsContext,
72
77
  RSCServerSlot,
78
+ ResetRootContext,
73
79
  RscClientRoot,
74
80
  ServerElementsProvider,
75
81
  callServer,
@@ -21,6 +21,9 @@ __export(processRSCStream_exports, {
21
21
  processRSCStream: () => processRSCStream
22
22
  });
23
23
  module.exports = __toCommonJS(processRSCStream_exports);
24
+ function escapeScript(script) {
25
+ return script.replace(/<!--/g, "<\\!--").replace(/<\/(script)/gi, "</\\$1");
26
+ }
24
27
  async function processRSCStream(rscStream, controller, encoder) {
25
28
  try {
26
29
  const reader = rscStream.getReader();
@@ -29,23 +32,25 @@ async function processRSCStream(rscStream, controller, encoder) {
29
32
  });
30
33
  while (true) {
31
34
  const { done, value } = await reader.read();
32
- if (done)
33
- break;
35
+ if (done) break;
34
36
  try {
35
37
  const chunk = JSON.stringify(decoder.decode(value, {
36
38
  stream: true
37
39
  }));
38
- const scriptTag = `<script>(self.__FLIGHT_DATA||=[]).push(${chunk})</script>`;
40
+ const scriptContent = `(self.__FLIGHT_DATA||=[]).push(${chunk})`;
41
+ const scriptTag = `<script>${escapeScript(scriptContent)}</script>`;
39
42
  controller.enqueue(encoder.encode(scriptTag));
40
43
  } catch (err) {
41
44
  const base64 = JSON.stringify(btoa(String.fromCodePoint(...value)));
42
- const scriptTag = `<script>(self.__FLIGHT_DATA||=[]).push(Uint8Array.from(atob(${base64}), m => m.codePointAt(0)))</script>`;
45
+ const scriptContent = `(self.__FLIGHT_DATA||=[]).push(Uint8Array.from(atob(${base64}), m => m.codePointAt(0)))`;
46
+ const scriptTag = `<script>${escapeScript(scriptContent)}</script>`;
43
47
  controller.enqueue(encoder.encode(scriptTag));
44
48
  }
45
49
  }
46
50
  const remaining = decoder.decode();
47
51
  if (remaining.length) {
48
- const scriptTag = `<script>(self.__FLIGHT_DATA||=[]).push(${JSON.stringify(remaining)})</script>`;
52
+ const scriptContent = `(self.__FLIGHT_DATA||=[]).push(${JSON.stringify(remaining)})`;
53
+ const scriptTag = `<script>${escapeScript(scriptContent)}</script>`;
49
54
  controller.enqueue(encoder.encode(scriptTag));
50
55
  }
51
56
  controller.close();
@@ -40,7 +40,7 @@ const handleAction = async (req, options) => {
40
40
  if (serverReference) {
41
41
  const [filepath, name] = serverReference.split("#");
42
42
  const action = __webpack_require__(filepath)[name || "default"];
43
- if (action.$$typeof !== Symbol.for("react.server.reference")) {
43
+ if (action.$$typeof !== /* @__PURE__ */ Symbol.for("react.server.reference")) {
44
44
  throw new Error("Invalid action");
45
45
  }
46
46
  const { clientManifest } = options;
@@ -33,7 +33,7 @@ __export(ssr_exports, {
33
33
  module.exports = __toCommonJS(ssr_exports);
34
34
  var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var import_server = require("react-dom/server.edge");
36
- var import_client = require("../../client");
36
+ var import_client = require("../../client/index");
37
37
  function wrapStream(stream, originalStream) {
38
38
  const wrappedStream = Object.create(stream);
39
39
  for (const prop of Object.keys(originalStream)) {
@@ -50,7 +50,7 @@ const renderSSRStream = async (children, options) => {
50
50
  }
51
51
  try {
52
52
  const [{ renderRsc }, { createFromReadableStream }, { injectRSCPayload }] = await Promise.all([
53
- Promise.resolve().then(() => __toESM(require("../rsc"))),
53
+ Promise.resolve().then(() => __toESM(require("../rsc/index"))),
54
54
  Promise.resolve().then(() => __toESM(require("react-server-dom-webpack/client.edge"))),
55
55
  Promise.resolve().then(() => __toESM(require("../../rsc-html-stream/server")))
56
56
  ]);
@@ -1,45 +1,21 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _call_super } from "@swc/helpers/_/_call_super";
3
- import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
4
1
  import { _ as _class_private_field_get } from "@swc/helpers/_/_class_private_field_get";
5
2
  import { _ as _class_private_field_init } from "@swc/helpers/_/_class_private_field_init";
6
3
  import { _ as _class_private_field_set } from "@swc/helpers/_/_class_private_field_set";
7
- import { _ as _create_class } from "@swc/helpers/_/_create_class";
8
- import { _ as _inherits } from "@swc/helpers/_/_inherits";
9
- import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
10
- import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
11
- import { _ as _wrap_native_super } from "@swc/helpers/_/_wrap_native_super";
12
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
13
4
  import { createFromFetch, encodeReply } from "react-server-dom-webpack/client.browser";
14
5
  var _statusCode = /* @__PURE__ */ new WeakMap(), _url = /* @__PURE__ */ new WeakMap(), _details = /* @__PURE__ */ new WeakMap();
15
- var CallServerError = /* @__PURE__ */ function(Error1) {
16
- "use strict";
17
- _inherits(CallServerError2, Error1);
18
- function CallServerError2(message, statusCode) {
19
- var url = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "", details = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
20
- _class_call_check(this, CallServerError2);
21
- var _this;
22
- var formattedMessage = "Call Server Action failed (".concat(statusCode, "): ").concat(message, "\nURL: ").concat(url);
23
- _this = _call_super(this, CallServerError2, [
24
- formattedMessage
25
- ]), _class_private_field_init(_this, _statusCode, {
26
- writable: true,
27
- value: void 0
28
- }), _class_private_field_init(_this, _url, {
29
- writable: true,
30
- value: void 0
31
- }), _class_private_field_init(_this, _details, {
32
- writable: true,
33
- value: void 0
34
- });
35
- _this.name = "CallServerError";
36
- _class_private_field_set(_this, _statusCode, statusCode);
37
- _class_private_field_set(_this, _url, url);
38
- _class_private_field_set(_this, _details, details);
39
- return _this;
6
+ class CallServerError extends Error {
7
+ get statusCode() {
8
+ return _class_private_field_get(this, _statusCode);
40
9
  }
41
- var _proto = CallServerError2.prototype;
42
- _proto.toJSON = function toJSON() {
10
+ get url() {
11
+ return _class_private_field_get(this, _url);
12
+ }
13
+ get details() {
14
+ return {
15
+ ..._class_private_field_get(this, _details)
16
+ };
17
+ }
18
+ toJSON() {
43
19
  return {
44
20
  name: this.name,
45
21
  message: this.message,
@@ -47,117 +23,61 @@ var CallServerError = /* @__PURE__ */ function(Error1) {
47
23
  url: _class_private_field_get(this, _url),
48
24
  details: _class_private_field_get(this, _details)
49
25
  };
50
- };
51
- _create_class(CallServerError2, [
52
- {
53
- key: "statusCode",
54
- get: function get() {
55
- return _class_private_field_get(this, _statusCode);
56
- }
57
- },
58
- {
59
- key: "url",
60
- get: function get() {
61
- return _class_private_field_get(this, _url);
62
- }
63
- },
64
- {
65
- key: "details",
66
- get: function get() {
67
- return _object_spread({}, _class_private_field_get(this, _details));
68
- }
69
- }
70
- ]);
71
- return CallServerError2;
72
- }(_wrap_native_super(Error));
73
- function requestCallServer(id, args) {
74
- return _requestCallServer.apply(this, arguments);
75
- }
76
- function _requestCallServer() {
77
- _requestCallServer = _async_to_generator(function(id, args) {
78
- var entryName, url, response, _tmp, _tmp1, error;
79
- return _ts_generator(this, function(_state) {
80
- switch (_state.label) {
81
- case 0:
82
- entryName = window.__MODERN_JS_ENTRY_NAME;
83
- url = entryName === "main" ? "/" : "/".concat(entryName);
84
- _state.label = 1;
85
- case 1:
86
- _state.trys.push([
87
- 1,
88
- 4,
89
- ,
90
- 5
91
- ]);
92
- _tmp = [
93
- url
94
- ];
95
- _tmp1 = {
96
- method: "POST",
97
- headers: {
98
- Accept: "text/x-component",
99
- "x-rsc-action": id
100
- }
101
- };
102
- return [
103
- 4,
104
- encodeReply(args)
105
- ];
106
- case 2:
107
- return [
108
- 4,
109
- fetch.apply(void 0, _tmp.concat([
110
- (_tmp1.body = _state.sent(), _tmp1)
111
- ]))
112
- ];
113
- case 3:
114
- response = _state.sent();
115
- if (!response.ok) {
116
- throw new CallServerError(response.statusText, response.status, url, {
117
- id,
118
- args
119
- });
120
- }
121
- return [
122
- 2,
123
- response
124
- ];
125
- case 4:
126
- error = _state.sent();
127
- if (_instanceof(error, CallServerError)) {
128
- throw error;
129
- }
130
- throw new CallServerError(_instanceof(error, Error) ? error.message : "Unknown error", 1, url, {
131
- id,
132
- args
133
- });
134
- case 5:
135
- return [
136
- 2
137
- ];
138
- }
26
+ }
27
+ constructor(message, statusCode, url = "", details = {}) {
28
+ const formattedMessage = `Call Server Action failed (${statusCode}): ${message}
29
+ URL: ${url}`;
30
+ super(formattedMessage), _class_private_field_init(this, _statusCode, {
31
+ writable: true,
32
+ value: void 0
33
+ }), _class_private_field_init(this, _url, {
34
+ writable: true,
35
+ value: void 0
36
+ }), _class_private_field_init(this, _details, {
37
+ writable: true,
38
+ value: void 0
139
39
  });
140
- });
141
- return _requestCallServer.apply(this, arguments);
142
- }
143
- function callServer(id, args) {
144
- return _callServer.apply(this, arguments);
40
+ this.name = "CallServerError";
41
+ _class_private_field_set(this, _statusCode, statusCode);
42
+ _class_private_field_set(this, _url, url);
43
+ _class_private_field_set(this, _details, details);
44
+ }
145
45
  }
146
- function _callServer() {
147
- _callServer = _async_to_generator(function(id, args) {
148
- var response, res;
149
- return _ts_generator(this, function(_state) {
150
- response = requestCallServer(id, args);
151
- res = createFromFetch(response, {
152
- callServer
46
+ async function requestCallServer(id, args) {
47
+ const entryName = window.__MODERN_JS_ENTRY_NAME;
48
+ const url = entryName === "main" ? "/" : `/${entryName}`;
49
+ try {
50
+ const response = await fetch(url, {
51
+ method: "POST",
52
+ headers: {
53
+ Accept: "text/x-component",
54
+ "x-rsc-action": id
55
+ },
56
+ body: await encodeReply(args)
57
+ });
58
+ if (!response.ok) {
59
+ throw new CallServerError(response.statusText, response.status, url, {
60
+ id,
61
+ args
153
62
  });
154
- return [
155
- 2,
156
- res
157
- ];
63
+ }
64
+ return response;
65
+ } catch (error) {
66
+ if (error instanceof CallServerError) {
67
+ throw error;
68
+ }
69
+ throw new CallServerError(error instanceof Error ? error.message : "Unknown error", 1, url, {
70
+ id,
71
+ args
158
72
  });
73
+ }
74
+ }
75
+ async function callServer(id, args) {
76
+ const response = requestCallServer(id, args);
77
+ const res = createFromFetch(response, {
78
+ callServer
159
79
  });
160
- return _callServer.apply(this, arguments);
80
+ return res;
161
81
  }
162
82
  export {
163
83
  callServer,
@@ -1,4 +1,3 @@
1
- import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
2
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
2
  import React from "react";
4
3
  import { createContext, useState } from "react";
@@ -6,17 +5,19 @@ import { createFromReadableStream, createServerReference } from "react-server-do
6
5
  import { rscStream } from "../rsc-html-stream/client";
7
6
  import { callServer } from "./callServer";
8
7
  import { createFromFetch } from "react-server-dom-webpack/client.browser";
9
- function RscClientRoot(param) {
10
- var rscPayload = param.rscPayload;
11
- var elements = React.use(rscPayload);
12
- var _useState = _sliced_to_array(useState(elements), 2), root = _useState[0], setRoot = _useState[1];
13
- return /* @__PURE__ */ _jsx(_Fragment, {
8
+ const ResetRootContext = /* @__PURE__ */ createContext(void 0);
9
+ function RscClientRoot({ rscPayload }) {
10
+ const elements = React.use(rscPayload);
11
+ const [root, setRoot] = useState(elements);
12
+ return /* @__PURE__ */ _jsx(ResetRootContext.Provider, {
13
+ value: {
14
+ setRoot
15
+ },
14
16
  children: root
15
17
  });
16
18
  }
17
- var ElementsContext = /* @__PURE__ */ createContext(null);
18
- var ServerElementsProvider = function(param) {
19
- var elements = param.elements, children = param.children;
19
+ const ElementsContext = /* @__PURE__ */ createContext(null);
20
+ const ServerElementsProvider = ({ elements, children }) => {
20
21
  return /* @__PURE__ */ _jsx(_Fragment, {
21
22
  children: /* @__PURE__ */ _jsx(ElementsContext.Provider, {
22
23
  value: elements,
@@ -24,13 +25,14 @@ var ServerElementsProvider = function(param) {
24
25
  })
25
26
  });
26
27
  };
27
- var RSCServerSlot = function() {
28
- var elements = React.use(ElementsContext);
28
+ const RSCServerSlot = () => {
29
+ const elements = React.use(ElementsContext);
29
30
  return elements;
30
31
  };
31
32
  export {
32
33
  ElementsContext,
33
34
  RSCServerSlot,
35
+ ResetRootContext,
34
36
  RscClientRoot,
35
37
  ServerElementsProvider,
36
38
  callServer,
@@ -1,11 +1,11 @@
1
- var encoder = new TextEncoder();
2
- var streamController;
3
- var rscStream = new ReadableStream({
4
- start: function start(controller) {
1
+ const encoder = new TextEncoder();
2
+ let streamController;
3
+ const rscStream = new ReadableStream({
4
+ start(controller) {
5
5
  if (typeof window === "undefined") {
6
6
  return;
7
7
  }
8
- var handleChunk = function(chunk) {
8
+ const handleChunk = (chunk) => {
9
9
  if (typeof chunk === "string") {
10
10
  controller.enqueue(encoder.encode(chunk));
11
11
  } else {
@@ -14,14 +14,14 @@ var rscStream = new ReadableStream({
14
14
  };
15
15
  window.__FLIGHT_DATA = window.__FLIGHT_DATA || [];
16
16
  window.__FLIGHT_DATA.forEach(handleChunk);
17
- window.__FLIGHT_DATA.push = function(chunk) {
17
+ window.__FLIGHT_DATA.push = (chunk) => {
18
18
  handleChunk(chunk);
19
19
  };
20
20
  streamController = controller;
21
21
  }
22
22
  });
23
23
  if (typeof document !== "undefined" && document.readyState === "loading") {
24
- document.addEventListener("DOMContentLoaded", function() {
24
+ document.addEventListener("DOMContentLoaded", () => {
25
25
  streamController === null || streamController === void 0 ? void 0 : streamController.close();
26
26
  });
27
27
  } else {
@@ -1,212 +1,70 @@
1
- import { _ as _async_iterator } from "@swc/helpers/_/_async_iterator";
2
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
3
- import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
4
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
5
- var encoder = new TextEncoder();
6
- var trailer = "</body></html>";
7
- function injectRSCPayload(rscStream, param) {
8
- var _param_injectClosingTags = param.injectClosingTags, injectClosingTags = _param_injectClosingTags === void 0 ? true : _param_injectClosingTags;
9
- var decoder = new TextDecoder();
10
- var resolveFlightDataPromise;
11
- var flightDataPromise = new Promise(function(resolve) {
12
- return resolveFlightDataPromise = resolve;
13
- });
14
- var startedRSC = false;
15
- var buffered = [];
16
- var timeout = null;
1
+ const encoder = new TextEncoder();
2
+ const trailer = "</body></html>";
3
+ function injectRSCPayload(rscStream, { injectClosingTags = true }) {
4
+ const decoder = new TextDecoder();
5
+ let resolveFlightDataPromise;
6
+ const flightDataPromise = new Promise((resolve) => resolveFlightDataPromise = resolve);
7
+ let startedRSC = false;
8
+ const buffered = [];
9
+ let timeout = null;
17
10
  function flushBufferedChunks(controller) {
18
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
19
- try {
20
- for (var _iterator = buffered[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
21
- var chunk = _step.value;
22
- var buf = decoder.decode(chunk);
23
- if (buf.endsWith(trailer)) {
24
- buf = buf.slice(0, -trailer.length);
25
- }
26
- controller.enqueue(encoder.encode(buf));
27
- }
28
- } catch (err) {
29
- _didIteratorError = true;
30
- _iteratorError = err;
31
- } finally {
32
- try {
33
- if (!_iteratorNormalCompletion && _iterator.return != null) {
34
- _iterator.return();
35
- }
36
- } finally {
37
- if (_didIteratorError) {
38
- throw _iteratorError;
39
- }
11
+ for (const chunk of buffered) {
12
+ let buf = decoder.decode(chunk);
13
+ if (buf.endsWith(trailer)) {
14
+ buf = buf.slice(0, -trailer.length);
40
15
  }
16
+ controller.enqueue(encoder.encode(buf));
41
17
  }
42
18
  buffered.length = 0;
43
19
  timeout = null;
44
20
  }
45
21
  return new TransformStream({
46
- transform: function transform(chunk, controller) {
22
+ transform(chunk, controller) {
47
23
  buffered.push(chunk);
48
24
  if (timeout) {
49
25
  return;
50
26
  }
51
- timeout = setTimeout(/* @__PURE__ */ _async_to_generator(function() {
52
- return _ts_generator(this, function(_state) {
53
- flushBufferedChunks(controller);
54
- if (!startedRSC) {
55
- startedRSC = true;
56
- writeRSCStream(rscStream, controller).catch(function(err) {
57
- return controller.error(err);
58
- }).then(function() {
59
- return resolveFlightDataPromise();
60
- });
61
- }
62
- return [
63
- 2
64
- ];
65
- });
66
- }), 0);
27
+ timeout = setTimeout(async () => {
28
+ flushBufferedChunks(controller);
29
+ if (!startedRSC) {
30
+ startedRSC = true;
31
+ writeRSCStream(rscStream, controller).catch((err) => controller.error(err)).then(() => resolveFlightDataPromise());
32
+ }
33
+ }, 0);
67
34
  },
68
- flush: function flush(controller) {
69
- return _async_to_generator(function() {
70
- return _ts_generator(this, function(_state) {
71
- switch (_state.label) {
72
- case 0:
73
- return [
74
- 4,
75
- flightDataPromise
76
- ];
77
- case 1:
78
- _state.sent();
79
- if (timeout) {
80
- clearTimeout(timeout);
81
- flushBufferedChunks(controller);
82
- }
83
- if (injectClosingTags) {
84
- controller.enqueue(encoder.encode("</body></html>"));
85
- }
86
- return [
87
- 2
88
- ];
89
- }
90
- });
91
- })();
35
+ async flush(controller) {
36
+ await flightDataPromise;
37
+ if (timeout) {
38
+ clearTimeout(timeout);
39
+ flushBufferedChunks(controller);
40
+ }
41
+ if (injectClosingTags) {
42
+ controller.enqueue(encoder.encode("</body></html>"));
43
+ }
92
44
  }
93
45
  });
94
46
  }
95
- function writeRSCStream(rscStream, controller) {
96
- return _writeRSCStream.apply(this, arguments);
97
- }
98
- function _writeRSCStream() {
99
- _writeRSCStream = _async_to_generator(function(rscStream, controller) {
100
- var decoder, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, _String, base64, err, remaining;
101
- return _ts_generator(this, function(_state) {
102
- switch (_state.label) {
103
- case 0:
104
- decoder = new TextDecoder("utf-8", {
105
- fatal: true
106
- });
107
- _iteratorAbruptCompletion = false, _didIteratorError = false;
108
- _state.label = 1;
109
- case 1:
110
- _state.trys.push([
111
- 1,
112
- 6,
113
- 7,
114
- 12
115
- ]);
116
- _iterator = _async_iterator(rscStream);
117
- _state.label = 2;
118
- case 2:
119
- return [
120
- 4,
121
- _iterator.next()
122
- ];
123
- case 3:
124
- if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done))
125
- return [
126
- 3,
127
- 5
128
- ];
129
- _value = _step.value;
130
- chunk = _value;
131
- try {
132
- writeChunk(JSON.stringify(decoder.decode(chunk, {
133
- stream: true
134
- })), controller);
135
- } catch (err2) {
136
- ;
137
- base64 = JSON.stringify(btoa((_String = String).fromCodePoint.apply(_String, _to_consumable_array(chunk))));
138
- writeChunk("Uint8Array.from(atob(".concat(base64, "), m => m.codePointAt(0))"), controller);
139
- }
140
- _state.label = 4;
141
- case 4:
142
- _iteratorAbruptCompletion = false;
143
- return [
144
- 3,
145
- 2
146
- ];
147
- case 5:
148
- return [
149
- 3,
150
- 12
151
- ];
152
- case 6:
153
- err = _state.sent();
154
- _didIteratorError = true;
155
- _iteratorError = err;
156
- return [
157
- 3,
158
- 12
159
- ];
160
- case 7:
161
- _state.trys.push([
162
- 7,
163
- ,
164
- 10,
165
- 11
166
- ]);
167
- if (!(_iteratorAbruptCompletion && _iterator.return != null))
168
- return [
169
- 3,
170
- 9
171
- ];
172
- return [
173
- 4,
174
- _iterator.return()
175
- ];
176
- case 8:
177
- _state.sent();
178
- _state.label = 9;
179
- case 9:
180
- return [
181
- 3,
182
- 11
183
- ];
184
- case 10:
185
- if (_didIteratorError) {
186
- throw _iteratorError;
187
- }
188
- return [
189
- 7
190
- ];
191
- case 11:
192
- return [
193
- 7
194
- ];
195
- case 12:
196
- remaining = decoder.decode();
197
- if (remaining.length) {
198
- writeChunk(JSON.stringify(remaining), controller);
199
- }
200
- return [
201
- 2
202
- ];
203
- }
204
- });
47
+ async function writeRSCStream(rscStream, controller) {
48
+ const decoder = new TextDecoder("utf-8", {
49
+ fatal: true
205
50
  });
206
- return _writeRSCStream.apply(this, arguments);
51
+ for await (const chunk of rscStream) {
52
+ try {
53
+ writeChunk(JSON.stringify(decoder.decode(chunk, {
54
+ stream: true
55
+ })), controller);
56
+ } catch (err) {
57
+ const base64 = JSON.stringify(btoa(String.fromCodePoint(...chunk)));
58
+ writeChunk(`Uint8Array.from(atob(${base64}), m => m.codePointAt(0))`, controller);
59
+ }
60
+ }
61
+ const remaining = decoder.decode();
62
+ if (remaining.length) {
63
+ writeChunk(JSON.stringify(remaining), controller);
64
+ }
207
65
  }
208
66
  function writeChunk(chunk, controller) {
209
- controller.enqueue(encoder.encode("<script>".concat(escapeScript("(self.__FLIGHT_DATA||=[]).push(".concat(chunk, ")")), "</script>")));
67
+ controller.enqueue(encoder.encode(`<script>${escapeScript(`(self.__FLIGHT_DATA||=[]).push(${chunk})`)}</script>`));
210
68
  }
211
69
  function escapeScript(script) {
212
70
  return script.replace(/<!--/g, "<\\!--").replace(/<\/(script)/gi, "</\\$1");
@@ -1,85 +1,39 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
3
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
- function processRSCStream(rscStream, controller, encoder) {
5
- return _processRSCStream.apply(this, arguments);
1
+ function escapeScript(script) {
2
+ return script.replace(/<!--/g, "<\\!--").replace(/<\/(script)/gi, "</\\$1");
6
3
  }
7
- function _processRSCStream() {
8
- _processRSCStream = _async_to_generator(function(rscStream, controller, encoder) {
9
- var reader, decoder, _ref, done, value, chunk, scriptTag, _String, base64, scriptTag1, remaining, scriptTag2, error;
10
- return _ts_generator(this, function(_state) {
11
- switch (_state.label) {
12
- case 0:
13
- _state.trys.push([
14
- 0,
15
- 4,
16
- ,
17
- 5
18
- ]);
19
- reader = rscStream.getReader();
20
- decoder = new TextDecoder("utf-8", {
21
- fatal: true
22
- });
23
- _state.label = 1;
24
- case 1:
25
- if (false)
26
- return [
27
- 3,
28
- 3
29
- ];
30
- return [
31
- 4,
32
- reader.read()
33
- ];
34
- case 2:
35
- _ref = _state.sent(), done = _ref.done, value = _ref.value;
36
- if (done)
37
- return [
38
- 3,
39
- 3
40
- ];
41
- try {
42
- chunk = JSON.stringify(decoder.decode(value, {
43
- stream: true
44
- }));
45
- scriptTag = "<script>(self.__FLIGHT_DATA||=[]).push(".concat(chunk, ")</script>");
46
- controller.enqueue(encoder.encode(scriptTag));
47
- } catch (err) {
48
- ;
49
- base64 = JSON.stringify(btoa((_String = String).fromCodePoint.apply(_String, _to_consumable_array(value))));
50
- scriptTag1 = "<script>(self.__FLIGHT_DATA||=[]).push(Uint8Array.from(atob(".concat(base64, "), m => m.codePointAt(0)))</script>");
51
- controller.enqueue(encoder.encode(scriptTag1));
52
- }
53
- return [
54
- 3,
55
- 1
56
- ];
57
- case 3:
58
- remaining = decoder.decode();
59
- if (remaining.length) {
60
- scriptTag2 = "<script>(self.__FLIGHT_DATA||=[]).push(".concat(JSON.stringify(remaining), ")</script>");
61
- controller.enqueue(encoder.encode(scriptTag2));
62
- }
63
- controller.close();
64
- return [
65
- 3,
66
- 5
67
- ];
68
- case 4:
69
- error = _state.sent();
70
- controller.error(error);
71
- return [
72
- 3,
73
- 5
74
- ];
75
- case 5:
76
- return [
77
- 2
78
- ];
79
- }
4
+ async function processRSCStream(rscStream, controller, encoder) {
5
+ try {
6
+ const reader = rscStream.getReader();
7
+ const decoder = new TextDecoder("utf-8", {
8
+ fatal: true
80
9
  });
81
- });
82
- return _processRSCStream.apply(this, arguments);
10
+ while (true) {
11
+ const { done, value } = await reader.read();
12
+ if (done) break;
13
+ try {
14
+ const chunk = JSON.stringify(decoder.decode(value, {
15
+ stream: true
16
+ }));
17
+ const scriptContent = `(self.__FLIGHT_DATA||=[]).push(${chunk})`;
18
+ const scriptTag = `<script>${escapeScript(scriptContent)}</script>`;
19
+ controller.enqueue(encoder.encode(scriptTag));
20
+ } catch (err) {
21
+ const base64 = JSON.stringify(btoa(String.fromCodePoint(...value)));
22
+ const scriptContent = `(self.__FLIGHT_DATA||=[]).push(Uint8Array.from(atob(${base64}), m => m.codePointAt(0)))`;
23
+ const scriptTag = `<script>${escapeScript(scriptContent)}</script>`;
24
+ controller.enqueue(encoder.encode(scriptTag));
25
+ }
26
+ }
27
+ const remaining = decoder.decode();
28
+ if (remaining.length) {
29
+ const scriptContent = `(self.__FLIGHT_DATA||=[]).push(${JSON.stringify(remaining)})`;
30
+ const scriptTag = `<script>${escapeScript(scriptContent)}</script>`;
31
+ controller.enqueue(encoder.encode(scriptTag));
32
+ }
33
+ controller.close();
34
+ } catch (error) {
35
+ controller.error(error);
36
+ }
83
37
  }
84
38
  export {
85
39
  processRSCStream
@@ -1,99 +1,47 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
3
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
1
  import { renderToReadableStream } from "react-server-dom-webpack/server.edge";
5
2
  import { renderToReadableStream as renderToReadableStream2 } from "react-server-dom-webpack/server.edge";
6
3
  import { decodeReply } from "react-server-dom-webpack/server.edge";
7
4
  import { createFromReadableStream } from "react-server-dom-webpack/client.edge";
8
5
  import { registerClientReference, registerServerReference } from "react-server-dom-webpack/server";
9
- var renderRsc = function(options) {
10
- var readable = renderToReadableStream2(options.element, options.clientManifest);
6
+ const renderRsc = (options) => {
7
+ const readable = renderToReadableStream2(options.element, options.clientManifest);
11
8
  return readable;
12
9
  };
13
- var handleAction = function() {
14
- var _ref = _async_to_generator(function(req, options) {
15
- var serverReference, _serverReference_split, filepath, name, action, clientManifest, contentType, args, formData, text, result, stream, response;
16
- return _ts_generator(this, function(_state) {
17
- switch (_state.label) {
18
- case 0:
19
- serverReference = req.headers.get("x-rsc-action");
20
- if (!serverReference)
21
- return [
22
- 3,
23
- 7
24
- ];
25
- _serverReference_split = _sliced_to_array(serverReference.split("#"), 2), filepath = _serverReference_split[0], name = _serverReference_split[1];
26
- action = __webpack_require__(filepath)[name || "default"];
27
- if (action.$$typeof !== Symbol.for("react.server.reference")) {
28
- throw new Error("Invalid action");
29
- }
30
- clientManifest = options.clientManifest;
31
- contentType = req.headers.get("content-type");
32
- if (!(contentType === null || contentType === void 0 ? void 0 : contentType.includes("multipart/form-data")))
33
- return [
34
- 3,
35
- 3
36
- ];
37
- return [
38
- 4,
39
- req.formData()
40
- ];
41
- case 1:
42
- formData = _state.sent();
43
- return [
44
- 4,
45
- decodeReply(formData)
46
- ];
47
- case 2:
48
- args = _state.sent();
49
- return [
50
- 3,
51
- 6
52
- ];
53
- case 3:
54
- return [
55
- 4,
56
- req.text()
57
- ];
58
- case 4:
59
- text = _state.sent();
60
- return [
61
- 4,
62
- decodeReply(text)
63
- ];
64
- case 5:
65
- args = _state.sent();
66
- _state.label = 6;
67
- case 6:
68
- result = action.apply(null, args);
69
- stream = renderRsc({
70
- element: result,
71
- clientManifest
72
- });
73
- response = new Response(stream, {
74
- status: 200,
75
- headers: {
76
- "Content-Type": "text/html"
77
- }
78
- });
79
- return [
80
- 2,
81
- response
82
- ];
83
- case 7:
84
- return [
85
- 2,
86
- new Response("Cannot find server reference", {
87
- status: 404
88
- })
89
- ];
10
+ const handleAction = async (req, options) => {
11
+ const serverReference = req.headers.get("x-rsc-action");
12
+ if (serverReference) {
13
+ const [filepath, name] = serverReference.split("#");
14
+ const action = __webpack_require__(filepath)[name || "default"];
15
+ if (action.$$typeof !== /* @__PURE__ */ Symbol.for("react.server.reference")) {
16
+ throw new Error("Invalid action");
17
+ }
18
+ const { clientManifest } = options;
19
+ const contentType = req.headers.get("content-type");
20
+ let args;
21
+ if (contentType === null || contentType === void 0 ? void 0 : contentType.includes("multipart/form-data")) {
22
+ const formData = await req.formData();
23
+ args = await decodeReply(formData);
24
+ } else {
25
+ const text = await req.text();
26
+ args = await decodeReply(text);
27
+ }
28
+ const result = action.apply(null, args);
29
+ const stream = renderRsc({
30
+ element: result,
31
+ clientManifest
32
+ });
33
+ const response = new Response(stream, {
34
+ status: 200,
35
+ headers: {
36
+ "Content-Type": "text/html"
90
37
  }
91
38
  });
39
+ return response;
40
+ }
41
+ return new Response("Cannot find server reference", {
42
+ status: 404
92
43
  });
93
- return function handleAction2(req, options) {
94
- return _ref.apply(this, arguments);
95
- };
96
- }();
44
+ };
97
45
  export {
98
46
  createFromReadableStream,
99
47
  handleAction,
@@ -1,112 +1,46 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
3
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
1
  import { jsx as _jsx } from "react/jsx-runtime";
5
2
  import { renderToReadableStream } from "react-dom/server.edge";
6
- import { ServerElementsProvider } from "../../client";
3
+ import { ServerElementsProvider } from "../../client/index";
7
4
  function wrapStream(stream, originalStream) {
8
- var wrappedStream = Object.create(stream);
9
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
10
- try {
11
- for (var _iterator = Object.keys(originalStream)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
12
- var prop = _step.value;
13
- if (!(prop in wrappedStream)) {
14
- wrappedStream[prop] = originalStream[prop];
15
- }
16
- }
17
- } catch (err) {
18
- _didIteratorError = true;
19
- _iteratorError = err;
20
- } finally {
21
- try {
22
- if (!_iteratorNormalCompletion && _iterator.return != null) {
23
- _iterator.return();
24
- }
25
- } finally {
26
- if (_didIteratorError) {
27
- throw _iteratorError;
28
- }
5
+ const wrappedStream = Object.create(stream);
6
+ for (const prop of Object.keys(originalStream)) {
7
+ if (!(prop in wrappedStream)) {
8
+ wrappedStream[prop] = originalStream[prop];
29
9
  }
30
10
  }
31
11
  return wrappedStream;
32
12
  }
33
- var renderSSRStream = function() {
34
- var _ref = _async_to_generator(function(children, options) {
35
- var clientManifest, ssrManifest, rscRoot, _ref2, renderRsc, createFromReadableStream, injectRSCPayload, rscStream, _rscStream_tee, rscElementStream, rscPayloadStream, elements, htmlStream, error;
36
- return _ts_generator(this, function(_state) {
37
- switch (_state.label) {
38
- case 0:
39
- clientManifest = options.clientManifest, ssrManifest = options.ssrManifest, rscRoot = options.rscRoot;
40
- if (!clientManifest || !ssrManifest) {
41
- return [
42
- 2,
43
- renderToReadableStream(children, options)
44
- ];
45
- }
46
- _state.label = 1;
47
- case 1:
48
- _state.trys.push([
49
- 1,
50
- 5,
51
- ,
52
- 6
53
- ]);
54
- return [
55
- 4,
56
- Promise.all([
57
- import("../rsc"),
58
- import("react-server-dom-webpack/client.edge"),
59
- import("../../rsc-html-stream/server")
60
- ])
61
- ];
62
- case 2:
63
- _ref2 = _sliced_to_array.apply(void 0, [
64
- _state.sent(),
65
- 3
66
- ]), renderRsc = _ref2[0].renderRsc, createFromReadableStream = _ref2[1].createFromReadableStream, injectRSCPayload = _ref2[2].injectRSCPayload;
67
- return [
68
- 4,
69
- renderRsc({
70
- element: rscRoot || children,
71
- clientManifest
72
- })
73
- ];
74
- case 3:
75
- rscStream = _state.sent();
76
- _rscStream_tee = _sliced_to_array(rscStream.tee(), 2), rscElementStream = _rscStream_tee[0], rscPayloadStream = _rscStream_tee[1];
77
- elements = createFromReadableStream(rscElementStream, {
78
- serverConsumerManifest: ssrManifest
79
- });
80
- return [
81
- 4,
82
- renderToReadableStream(/* @__PURE__ */ _jsx(ServerElementsProvider, {
83
- elements,
84
- children
85
- }), options)
86
- ];
87
- case 4:
88
- htmlStream = _state.sent();
89
- return [
90
- 2,
91
- wrapStream(htmlStream.pipeThrough(injectRSCPayload(rscPayloadStream, {
92
- injectClosingTags: false
93
- })), htmlStream)
94
- ];
95
- case 5:
96
- error = _state.sent();
97
- console.error(error);
98
- throw error;
99
- case 6:
100
- return [
101
- 2
102
- ];
103
- }
13
+ const renderSSRStream = async (children, options) => {
14
+ const { clientManifest, ssrManifest, rscRoot } = options;
15
+ if (!clientManifest || !ssrManifest) {
16
+ return renderToReadableStream(children, options);
17
+ }
18
+ try {
19
+ const [{ renderRsc }, { createFromReadableStream }, { injectRSCPayload }] = await Promise.all([
20
+ import("../rsc/index"),
21
+ import("react-server-dom-webpack/client.edge"),
22
+ import("../../rsc-html-stream/server")
23
+ ]);
24
+ const rscStream = await renderRsc({
25
+ element: rscRoot || children,
26
+ clientManifest
104
27
  });
105
- });
106
- return function renderSSRStream2(children, options) {
107
- return _ref.apply(this, arguments);
108
- };
109
- }();
28
+ const [rscElementStream, rscPayloadStream] = rscStream.tee();
29
+ const elements = createFromReadableStream(rscElementStream, {
30
+ serverConsumerManifest: ssrManifest
31
+ });
32
+ const htmlStream = await renderToReadableStream(/* @__PURE__ */ _jsx(ServerElementsProvider, {
33
+ elements,
34
+ children
35
+ }), options);
36
+ return wrapStream(htmlStream.pipeThrough(injectRSCPayload(rscPayloadStream, {
37
+ injectClosingTags: false
38
+ })), htmlStream);
39
+ } catch (error) {
40
+ console.error(error);
41
+ throw error;
42
+ }
43
+ };
110
44
  export {
111
45
  renderSSRStream
112
46
  };
@@ -2,13 +2,17 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import React from "react";
3
3
  import { createContext, useState } from "react";
4
4
  import { createFromReadableStream, createServerReference } from "react-server-dom-webpack/client.browser";
5
- import { rscStream } from "../rsc-html-stream/client";
6
- import { callServer } from "./callServer";
5
+ import { rscStream } from "../rsc-html-stream/client.mjs";
6
+ import { callServer } from "./callServer.mjs";
7
7
  import { createFromFetch } from "react-server-dom-webpack/client.browser";
8
+ const ResetRootContext = /* @__PURE__ */ createContext(void 0);
8
9
  function RscClientRoot({ rscPayload }) {
9
10
  const elements = React.use(rscPayload);
10
11
  const [root, setRoot] = useState(elements);
11
- return /* @__PURE__ */ _jsx(_Fragment, {
12
+ return /* @__PURE__ */ _jsx(ResetRootContext.Provider, {
13
+ value: {
14
+ setRoot
15
+ },
12
16
  children: root
13
17
  });
14
18
  }
@@ -28,6 +32,7 @@ const RSCServerSlot = () => {
28
32
  export {
29
33
  ElementsContext,
30
34
  RSCServerSlot,
35
+ ResetRootContext,
31
36
  RscClientRoot,
32
37
  ServerElementsProvider,
33
38
  callServer,
@@ -0,0 +1,2 @@
1
+ export * from "./rsc.mjs";
2
+ export * from "./processRSCStream.mjs";
@@ -1,3 +1,6 @@
1
+ function escapeScript(script) {
2
+ return script.replace(/<!--/g, "<\\!--").replace(/<\/(script)/gi, "</\\$1");
3
+ }
1
4
  async function processRSCStream(rscStream, controller, encoder) {
2
5
  try {
3
6
  const reader = rscStream.getReader();
@@ -6,23 +9,25 @@ async function processRSCStream(rscStream, controller, encoder) {
6
9
  });
7
10
  while (true) {
8
11
  const { done, value } = await reader.read();
9
- if (done)
10
- break;
12
+ if (done) break;
11
13
  try {
12
14
  const chunk = JSON.stringify(decoder.decode(value, {
13
15
  stream: true
14
16
  }));
15
- const scriptTag = `<script>(self.__FLIGHT_DATA||=[]).push(${chunk})</script>`;
17
+ const scriptContent = `(self.__FLIGHT_DATA||=[]).push(${chunk})`;
18
+ const scriptTag = `<script>${escapeScript(scriptContent)}</script>`;
16
19
  controller.enqueue(encoder.encode(scriptTag));
17
20
  } catch (err) {
18
21
  const base64 = JSON.stringify(btoa(String.fromCodePoint(...value)));
19
- const scriptTag = `<script>(self.__FLIGHT_DATA||=[]).push(Uint8Array.from(atob(${base64}), m => m.codePointAt(0)))</script>`;
22
+ const scriptContent = `(self.__FLIGHT_DATA||=[]).push(Uint8Array.from(atob(${base64}), m => m.codePointAt(0)))`;
23
+ const scriptTag = `<script>${escapeScript(scriptContent)}</script>`;
20
24
  controller.enqueue(encoder.encode(scriptTag));
21
25
  }
22
26
  }
23
27
  const remaining = decoder.decode();
24
28
  if (remaining.length) {
25
- const scriptTag = `<script>(self.__FLIGHT_DATA||=[]).push(${JSON.stringify(remaining)})</script>`;
29
+ const scriptContent = `(self.__FLIGHT_DATA||=[]).push(${JSON.stringify(remaining)})`;
30
+ const scriptTag = `<script>${escapeScript(scriptContent)}</script>`;
26
31
  controller.enqueue(encoder.encode(scriptTag));
27
32
  }
28
33
  controller.close();
@@ -12,7 +12,7 @@ const handleAction = async (req, options) => {
12
12
  if (serverReference) {
13
13
  const [filepath, name] = serverReference.split("#");
14
14
  const action = __webpack_require__(filepath)[name || "default"];
15
- if (action.$$typeof !== Symbol.for("react.server.reference")) {
15
+ if (action.$$typeof !== /* @__PURE__ */ Symbol.for("react.server.reference")) {
16
16
  throw new Error("Invalid action");
17
17
  }
18
18
  const { clientManifest } = options;
@@ -0,0 +1 @@
1
+ export * from "./ssr.mjs";
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { renderToReadableStream } from "react-dom/server.edge";
3
- import { ServerElementsProvider } from "../../client";
3
+ import { ServerElementsProvider } from "../../client/index.mjs";
4
4
  function wrapStream(stream, originalStream) {
5
5
  const wrappedStream = Object.create(stream);
6
6
  for (const prop of Object.keys(originalStream)) {
@@ -17,9 +17,9 @@ const renderSSRStream = async (children, options) => {
17
17
  }
18
18
  try {
19
19
  const [{ renderRsc }, { createFromReadableStream }, { injectRSCPayload }] = await Promise.all([
20
- import("../rsc"),
20
+ import("../rsc/index.mjs"),
21
21
  import("react-server-dom-webpack/client.edge"),
22
- import("../../rsc-html-stream/server")
22
+ import("../../rsc-html-stream/server.mjs")
23
23
  ]);
24
24
  const rscStream = await renderRsc({
25
25
  element: rscRoot || children,
@@ -10,6 +10,9 @@ declare global {
10
10
  __MODERN_JS_ENTRY_NAME?: string;
11
11
  }
12
12
  }
13
+ export declare const ResetRootContext: React.Context<{
14
+ setRoot: (root: React.ReactNode) => void;
15
+ } | undefined>;
13
16
  export declare function RscClientRoot({ rscPayload, }: {
14
17
  rscPayload: Promise<React.ReactNode>;
15
18
  }): React.JSX.Element;
package/package.json CHANGED
@@ -15,27 +15,28 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.0.0-alpha.1",
18
+ "version": "3.0.0",
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/utils": "3.0.0-alpha.1",
26
- "@modern-js/types": "3.0.0-alpha.1"
25
+ "@modern-js/types": "3.0.0",
26
+ "@modern-js/utils": "3.0.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@rslib/core": "0.19.1",
30
- "@types/react": "^19.2.7",
29
+ "@rslib/core": "0.19.4",
30
+ "@types/react": "^19.2.10",
31
31
  "@types/react-dom": "^19.2.3",
32
- "react": "^19.2.3",
33
- "react-dom": "^19.2.3",
32
+ "react": "^19.2.4",
33
+ "react-dom": "^19.2.4",
34
34
  "react-server-dom-webpack": "^19.2.3",
35
35
  "typescript": "^5",
36
- "@modern-js/rslib": "2.68.10",
37
- "@modern-js/server-core": "3.0.0-alpha.1",
38
- "@scripts/rstest-config": "2.66.0"
36
+ "@modern-js/server-core": "3.0.0",
37
+ "@scripts/build": "2.66.0",
38
+ "@scripts/rstest-config": "2.66.0",
39
+ "@modern-js/rslib": "2.68.10"
39
40
  },
40
41
  "peerDependencies": {
41
42
  "react": ">=17.0.2",
@@ -45,17 +46,14 @@
45
46
  "exports": {
46
47
  "./ssr": {
47
48
  "types": "./dist/types/server/ssr/index.d.ts",
48
- "jsnext:source": "./src/server/ssr/index.ts",
49
49
  "default": "./dist/esm/server/ssr/index.js"
50
50
  },
51
51
  "./rsc": {
52
52
  "types": "./dist/types/server/rsc/index.d.ts",
53
- "jsnext:source": "./src/server/rsc/index.ts",
54
53
  "default": "./dist/esm/server/rsc/index.js"
55
54
  },
56
55
  "./client": {
57
56
  "types": "./dist/types/client/index.d.ts",
58
- "jsnext:source": "./src/client/index.tsx",
59
57
  "default": "./dist/esm/client/index.js"
60
58
  }
61
59
  },
@@ -1,2 +0,0 @@
1
- export * from "./rsc";
2
- export * from "./processRSCStream";
@@ -1 +0,0 @@
1
- export * from "./ssr";