Remove old react-fetch, react-fs and react-pg libraries (#25577)
To avoid confusion. We are patching `fetch`, and only `fetch`, for a small fix scoped to react renders elsewhere, but this code is not it. This code was for the strategy used in the original [React Server Components demo](https://github.com/reactjs/server-components-demo). Which [we announced](https://reactjs.org/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022.html) that we're moving away from in favor of [First class support for promises and async/await](https://github.com/reactjs/rfcs/pull/229). We might explore using these package for other instrumentation in the future but not now and not like this.
Sebastian Markbåge committed
Oct 27, 2022 at 17:52 UTC
cf3932be5ca95bf5507a9566e4a9605bce0c5e21
34 files changed
+1
-1441
.eslintrc.js
-2
@@ -140,8 +140,6 @@ module.exports = {
140
'packages/react-dom/src/test-utils/**/*.js',
141
'packages/react-devtools-shared/**/*.js',
142
'packages/react-noop-renderer/**/*.js',
143
- 'packages/react-pg/**/*.js',
144
- 'packages/react-fs/**/*.js',
143
'packages/react-refresh/**/*.js',
144
'packages/react-server-dom-webpack/**/*.js',
145
'packages/react-test-renderer/**/*.js',
ReactVersions.js
+1
-1
@@ -43,7 +43,7 @@ const stablePackages = {
43
// These packages do not exist in the @next or @latest channel, only
44
// @experimental. We don't use semver, just the commit sha, so this is just a
45
// list of package names instead of a map.
46
-const experimentalPackages = ['react-fetch', 'react-fs', 'react-pg'];
46
+const experimentalPackages = [];
47
48
module.exports = {
49
ReactVersion,
packages/react-fetch/README.md
deleted
-12
@@ -1,12 +0,0 @@
1
-# react-fetch
2
-
3
-This package is meant to be used alongside yet-to-be-released, experimental React features. It's unlikely to be useful in any other context.
4
-
5
-**Do not use in a real application.** We're publishing this early for
6
-demonstration purposes.
7
-
8
-**Use it at your own risk.**
9
-
10
-# No, Really, It Is Unstable
11
-
12
-The API ~~may~~ will change wildly between versions.
packages/react-fetch/index.browser.js
deleted
-12
@@ -1,12 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-'use strict';
11
-
12
-export * from './src/ReactFetchBrowser';
packages/react-fetch/index.js
deleted
-12
@@ -1,12 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-'use strict';
11
-
12
-export * from './index.node';
packages/react-fetch/index.node.js
deleted
-12
@@ -1,12 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-'use strict';
11
-
12
-export * from './src/ReactFetchNode';
packages/react-fetch/npm/index.browser.js
deleted
-7
@@ -1,7 +0,0 @@
1
-'use strict';
2
-
3
-if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-fetch.browser.production.min.js');
5
-} else {
6
- module.exports = require('./cjs/react-fetch.browser.development.js');
7
-}
packages/react-fetch/npm/index.js
deleted
-3
@@ -1,3 +0,0 @@
1
-'use strict';
2
-
3
-module.exports = require('./index.node');
packages/react-fetch/npm/index.node.js
deleted
-7
@@ -1,7 +0,0 @@
1
-'use strict';
2
-
3
-if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-fetch.node.production.min.js');
5
-} else {
6
- module.exports = require('./cjs/react-fetch.node.development.js');
7
-}
packages/react-fetch/package.json
deleted
-24
@@ -1,24 +0,0 @@
1
-{
2
- "name": "react-fetch",
3
- "description": "Helpers for creating React data sources",
4
- "version": "0.0.0",
5
- "repository": {
6
- "type" : "git",
7
- "url" : "https://github.com/facebook/react.git",
8
- "directory": "packages/react-fetch"
9
- },
10
- "files": [
11
- "LICENSE",
12
- "README.md",
13
- "index.js",
14
- "index.node.js",
15
- "index.browser.js",
16
- "cjs/"
17
- ],
18
- "peerDependencies": {
19
- "react": "^17.0.0"
20
- },
21
- "browser": {
22
- "./index.js": "./index.browser.js"
23
- }
24
-}
packages/react-fetch/src/ReactFetchBrowser.js
deleted
-169
@@ -1,169 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-import type {Wakeable} from 'shared/ReactTypes';
11
-
12
-import {unstable_getCacheForType} from 'react';
13
-
14
-const Pending = 0;
15
-const Resolved = 1;
16
-const Rejected = 2;
17
-
18
-type PendingRecord = {
19
- status: 0,
20
- value: Wakeable,
21
-};
22
-
23
-type ResolvedRecord = {
24
- status: 1,
25
- value: mixed,
26
-};
27
-
28
-type RejectedRecord = {
29
- status: 2,
30
- value: mixed,
31
-};
32
-
33
-type Record = PendingRecord | ResolvedRecord | RejectedRecord;
34
-
35
-declare var globalThis: any;
36
-
37
-// TODO: this is a browser-only version. Add a separate Node entry point.
38
-const nativeFetch = (typeof globalThis !== 'undefined' ? globalThis : window)
39
- .fetch;
40
-
41
-function getRecordMap(): Map<string, Record> {
42
- return unstable_getCacheForType(createRecordMap);
43
-}
44
-
45
-function createRecordMap(): Map<string, Record> {
46
- return new Map();
47
-}
48
-
49
-function createRecordFromThenable(thenable): Record {
50
- const record: Record = {
51
- status: Pending,
52
- value: thenable,
53
- };
54
- thenable.then(
55
- value => {
56
- if (record.status === Pending) {
57
- const resolvedRecord = ((record: any): ResolvedRecord);
58
- resolvedRecord.status = Resolved;
59
- resolvedRecord.value = value;
60
- }
61
- },
62
- err => {
63
- if (record.status === Pending) {
64
- const rejectedRecord = ((record: any): RejectedRecord);
65
- rejectedRecord.status = Rejected;
66
- rejectedRecord.value = err;
67
- }
68
- },
69
- );
70
- return record;
71
-}
72
-
73
-function readRecordValue(record: Record) {
74
- if (record.status === Resolved) {
75
- return record.value;
76
- } else {
77
- throw record.value;
78
- }
79
-}
80
-
81
-function Response(nativeResponse) {
82
- this.headers = nativeResponse.headers;
83
- this.ok = nativeResponse.ok;
84
- this.redirected = nativeResponse.redirected;
85
- this.status = nativeResponse.status;
86
- this.statusText = nativeResponse.statusText;
87
- this.type = nativeResponse.type;
88
- this.url = nativeResponse.url;
89
-
90
- this._response = nativeResponse;
91
- this._arrayBuffer = null;
92
- this._blob = null;
93
- this._json = null;
94
- this._text = null;
95
-}
96
-
97
-Response.prototype = {
98
- constructor: Response,
99
- arrayBuffer() {
100
- return readRecordValue(
101
- // $FlowFixMe[object-this-reference] found when upgrading Flow
102
- this._arrayBuffer ||
103
- // $FlowFixMe[object-this-reference] found when upgrading Flow
104
- (this._arrayBuffer = createRecordFromThenable(
105
- // $FlowFixMe[object-this-reference] found when upgrading Flow
106
- this._response.arrayBuffer(),
107
- )),
108
- );
109
- },
110
- blob() {
111
- return readRecordValue(
112
- // $FlowFixMe[object-this-reference] found when upgrading Flow
113
- this._blob ||
114
- // $FlowFixMe[object-this-reference] found when upgrading Flow
115
- (this._blob = createRecordFromThenable(this._response.blob())),
116
- );
117
- },
118
- json() {
119
- return readRecordValue(
120
- // $FlowFixMe[object-this-reference] found when upgrading Flow
121
- this._json ||
122
- // $FlowFixMe[object-this-reference] found when upgrading Flow
123
- (this._json = createRecordFromThenable(this._response.json())),
124
- );
125
- },
126
- text() {
127
- return readRecordValue(
128
- // $FlowFixMe[object-this-reference] found when upgrading Flow
129
- this._text ||
130
- // $FlowFixMe[object-this-reference] found when upgrading Flow
131
- (this._text = createRecordFromThenable(this._response.text())),
132
- );
133
- },
134
-};
135
-
136
-function preloadRecord(url: string, options: mixed): Record {
137
- const map = getRecordMap();
138
- let record = map.get(url);
139
- if (!record) {
140
- if (options) {
141
- if (options.method || options.body || options.signal) {
142
- // TODO: wire up our own cancellation mechanism.
143
- // TODO: figure out what to do with POST.
144
- // eslint-disable-next-line react-internal/prod-error-codes
145
- throw Error('Unsupported option');
146
- }
147
- }
148
- const thenable = nativeFetch(url, options);
149
- record = createRecordFromThenable(thenable);
150
- map.set(url, record);
151
- }
152
- return record;
153
-}
154
-
155
-export function preload(url: string, options: mixed): void {
156
- preloadRecord(url, options);
157
- // Don't return anything.
158
-}
159
-
160
-export function fetch(url: string, options: mixed): Object {
161
- const record = preloadRecord(url, options);
162
- const nativeResponse = (readRecordValue(record): any);
163
- if (nativeResponse._reactResponse) {
164
- return nativeResponse._reactResponse;
165
- } else {
166
- // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
167
- return (nativeResponse._reactResponse = new Response(nativeResponse));
168
- }
169
-}
packages/react-fetch/src/ReactFetchNode.js
deleted
-246
@@ -1,246 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-import type {Wakeable} from 'shared/ReactTypes';
11
-
12
-import * as http from 'http';
13
-import * as https from 'https';
14
-import {unstable_getCacheForType} from 'react';
15
-
16
-type FetchResponse = {
17
- // Properties
18
- headers: any,
19
- ok: boolean,
20
- redirected: boolean,
21
- status: number,
22
- statusText: string,
23
- type: 'basic',
24
- url: string,
25
- // Methods
26
- arrayBuffer(): ArrayBuffer,
27
- blob(): any,
28
- json(): any,
29
- text(): string,
30
-};
31
-
32
-function nodeFetch(
33
- url: string,
34
- options: mixed,
35
- onResolve: any => void,
36
- onReject: any => void,
37
-): void {
38
- const {hostname, pathname, search, port, protocol} = new URL(url);
39
- const nodeOptions = {
40
- hostname,
41
- port,
42
- path: pathname + search,
43
- // TODO: cherry-pick supported user-passed options.
44
- };
45
- const nodeImpl = protocol === 'https:' ? https : http;
46
- // $FlowFixMe: node flow type has `port` as a number
47
- const request = nodeImpl.request(nodeOptions, response => {
48
- // TODO: support redirects.
49
- // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
50
- onResolve(new Response(response));
51
- });
52
- request.on('error', error => {
53
- onReject(error);
54
- });
55
- request.end();
56
-}
57
-
58
-const Pending = 0;
59
-const Resolved = 1;
60
-const Rejected = 2;
61
-
62
-type PendingRecord = {
63
- status: 0,
64
- value: Wakeable,
65
-};
66
-
67
-type ResolvedRecord<V> = {
68
- status: 1,
69
- value: V,
70
-};
71
-
72
-type RejectedRecord = {
73
- status: 2,
74
- value: mixed,
75
-};
76
-
77
-type Record<V> = PendingRecord | ResolvedRecord<V> | RejectedRecord;
78
-
79
-function getRecordMap(): Map<string, Record<FetchResponse>> {
80
- return unstable_getCacheForType(createRecordMap);
81
-}
82
-
83
-function createRecordMap(): Map<string, Record<FetchResponse>> {
84
- return new Map();
85
-}
86
-
87
-function readRecordValue<T>(record: Record<T>): T {
88
- if (record.status === Resolved) {
89
- return record.value;
90
- } else {
91
- throw record.value;
92
- }
93
-}
94
-
95
-function Response(nativeResponse) {
96
- this.headers = nativeResponse.headers;
97
- this.ok = nativeResponse.statusCode >= 200 && nativeResponse.statusCode < 300;
98
- this.redirected = false; // TODO
99
- this.status = nativeResponse.statusCode;
100
- this.statusText = nativeResponse.statusMessage;
101
- this.type = 'basic';
102
- this.url = nativeResponse.url;
103
-
104
- this._response = nativeResponse;
105
- this._json = null;
106
- this._text = null;
107
-
108
- const callbacks = [];
109
- function wake() {
110
- // This assumes they won't throw.
111
- while (callbacks.length > 0) {
112
- const cb = callbacks.pop();
113
- cb();
114
- }
115
- }
116
- const bufferRecord: PendingRecord = (this._bufferRecord = {
117
- status: Pending,
118
- value: {
119
- then(cb) {
120
- callbacks.push(cb);
121
- },
122
- },
123
- });
124
- const data = [];
125
- nativeResponse.on('data', chunk => data.push(chunk));
126
- nativeResponse.on('end', () => {
127
- if (bufferRecord.status === Pending) {
128
- const resolvedRecord = ((bufferRecord: any): ResolvedRecord<Buffer>);
129
- resolvedRecord.status = Resolved;
130
- resolvedRecord.value = Buffer.concat(data);
131
- wake();
132
- }
133
- });
134
- nativeResponse.on('error', err => {
135
- if (bufferRecord.status === Pending) {
136
- const rejectedRecord = ((bufferRecord: any): RejectedRecord);
137
- rejectedRecord.status = Rejected;
138
- rejectedRecord.value = err;
139
- wake();
140
- }
141
- });
142
-}
143
-
144
-Response.prototype = {
145
- constructor: Response,
146
- arrayBuffer() {
147
- // $FlowFixMe[object-this-reference] found when upgrading Flow
148
- const buffer = readRecordValue(this._bufferRecord);
149
- return buffer;
150
- },
151
- blob() {
152
- // TODO: Is this needed?
153
- throw new Error('Not implemented.');
154
- },
155
- json() {
156
- // $FlowFixMe[object-this-reference] found when upgrading Flow
157
- if (this._json !== null) {
158
- // $FlowFixMe[object-this-reference] found when upgrading Flow
159
- return this._json;
160
- }
161
- // $FlowFixMe[object-this-reference] found when upgrading Flow
162
- const buffer = readRecordValue(this._bufferRecord);
163
- const json = JSON.parse(buffer.toString());
164
- // $FlowFixMe[object-this-reference] found when upgrading Flow
165
- this._json = json;
166
- return json;
167
- },
168
- text() {
169
- // $FlowFixMe[object-this-reference] found when upgrading Flow
170
- if (this._text !== null) {
171
- // $FlowFixMe[object-this-reference] found when upgrading Flow
172
- return this._text;
173
- }
174
- // $FlowFixMe[object-this-reference] found when upgrading Flow
175
- const buffer = readRecordValue(this._bufferRecord);
176
- const text = buffer.toString();
177
- // $FlowFixMe[object-this-reference] found when upgrading Flow
178
- this._text = text;
179
- return text;
180
- },
181
-};
182
-
183
-function preloadRecord(url: string, options: mixed): Record<FetchResponse> {
184
- const map = getRecordMap();
185
- let record = map.get(url);
186
- if (!record) {
187
- if (options) {
188
- if (options.method || options.body || options.signal) {
189
- // TODO: wire up our own cancellation mechanism.
190
- // TODO: figure out what to do with POST.
191
- // eslint-disable-next-line react-internal/prod-error-codes
192
- throw Error('Unsupported option');
193
- }
194
- }
195
- const callbacks = [];
196
- const wakeable = {
197
- then(cb) {
198
- callbacks.push(cb);
199
- },
200
- };
201
- const wake = () => {
202
- // This assumes they won't throw.
203
- while (callbacks.length > 0) {
204
- const cb = callbacks.pop();
205
- cb();
206
- }
207
- };
208
- const newRecord: Record<FetchResponse> = (record = {
209
- status: Pending,
210
- value: wakeable,
211
- });
212
- nodeFetch(
213
- url,
214
- options,
215
- response => {
216
- if (newRecord.status === Pending) {
217
- const resolvedRecord = ((newRecord: any): ResolvedRecord<FetchResponse>);
218
- resolvedRecord.status = Resolved;
219
- resolvedRecord.value = response;
220
- wake();
221
- }
222
- },
223
- err => {
224
- if (newRecord.status === Pending) {
225
- const rejectedRecord = ((newRecord: any): RejectedRecord);
226
- rejectedRecord.status = Rejected;
227
- rejectedRecord.value = err;
228
- wake();
229
- }
230
- },
231
- );
232
- map.set(url, record);
233
- }
234
- return record;
235
-}
236
-
237
-export function preload(url: string, options: mixed): void {
238
- preloadRecord(url, options);
239
- // Don't return anything.
240
-}
241
-
242
-export function fetch(url: string, options: mixed): FetchResponse {
243
- const record = preloadRecord(url, options);
244
- const response = readRecordValue(record);
245
- return response;
246
-}
packages/react-fetch/src/__tests__/ReactFetchBrowser-test.js
deleted
-26
@@ -1,26 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @emails react-core
8
- */
9
-
10
-'use strict';
11
-
12
-describe('ReactFetchBrowser', () => {
13
- let ReactFetchBrowser;
14
-
15
- beforeEach(() => {
16
- if (__EXPERIMENTAL__) {
17
- ReactFetchBrowser = require('react-fetch');
18
- }
19
- });
20
-
21
- // TODO: test something useful.
22
- // @gate experimental
23
- it('exports something', () => {
24
- expect(ReactFetchBrowser.fetch).not.toBe(undefined);
25
- });
26
-});
packages/react-fetch/src/__tests__/ReactFetchNode-test.js
deleted
-121
@@ -1,121 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @emails react-core
8
- */
9
-
10
-'use strict';
11
-
12
-describe('ReactFetchNode', () => {
13
- let http;
14
- let fetch;
15
- let waitForSuspense;
16
- let server;
17
- let serverEndpoint;
18
- let serverImpl;
19
-
20
- beforeEach(done => {
21
- jest.resetModules();
22
-
23
- fetch = require('react-fetch').fetch;
24
- http = require('http');
25
- waitForSuspense = require('react-suspense-test-utils').waitForSuspense;
26
-
27
- server = http.createServer((req, res) => {
28
- serverImpl(req, res);
29
- });
30
- serverEndpoint = null;
31
- server.listen(() => {
32
- serverEndpoint = `http://localhost:${server.address().port}/`;
33
- done();
34
- });
35
- });
36
-
37
- afterEach(done => {
38
- server.close(done);
39
- server = null;
40
- });
41
-
42
- // @gate experimental || www
43
- it('can fetch text from a server component', async () => {
44
- serverImpl = (req, res) => {
45
- res.write('mango');
46
- res.end();
47
- };
48
- const text = await waitForSuspense(() => {
49
- return fetch(serverEndpoint).text();
50
- });
51
- expect(text).toEqual('mango');
52
- });
53
-
54
- // @gate experimental || www
55
- it('can fetch json from a server component', async () => {
56
- serverImpl = (req, res) => {
57
- res.write(JSON.stringify({name: 'Sema'}));
58
- res.end();
59
- };
60
- const json = await waitForSuspense(() => {
61
- return fetch(serverEndpoint).json();
62
- });
63
- expect(json).toEqual({name: 'Sema'});
64
- });
65
-
66
- // @gate experimental || www
67
- it('provides response status', async () => {
68
- serverImpl = (req, res) => {
69
- res.write(JSON.stringify({name: 'Sema'}));
70
- res.end();
71
- };
72
- const response = await waitForSuspense(() => {
73
- return fetch(serverEndpoint);
74
- });
75
- expect(response).toMatchObject({
76
- status: 200,
77
- statusText: 'OK',
78
- ok: true,
79
- });
80
- });
81
-
82
- // @gate experimental || www
83
- it('handles different paths', async () => {
84
- serverImpl = (req, res) => {
85
- switch (req.url) {
86
- case '/banana':
87
- res.write('banana');
88
- break;
89
- case '/mango':
90
- res.write('mango');
91
- break;
92
- case '/orange':
93
- res.write('orange');
94
- break;
95
- }
96
- res.end();
97
- };
98
- const outputs = await waitForSuspense(() => {
99
- return [
100
- fetch(serverEndpoint + 'banana').text(),
101
- fetch(serverEndpoint + 'mango').text(),
102
- fetch(serverEndpoint + 'orange').text(),
103
- ];
104
- });
105
- expect(outputs).toMatchObject(['banana', 'mango', 'orange']);
106
- });
107
-
108
- // @gate experimental || www
109
- it('can produce an error', async () => {
110
- serverImpl = (req, res) => {};
111
-
112
- expect.assertions(1);
113
- try {
114
- await waitForSuspense(() => {
115
- return fetch('BOOM');
116
- });
117
- } catch (err) {
118
- expect(err.message).toEqual('Invalid URL: BOOM');
119
- }
120
- });
121
-});
packages/react-fs/README.md
deleted
-12
@@ -1,12 +0,0 @@
1
-# react-fs
2
-
3
-This package is meant to be used alongside yet-to-be-released, experimental React features. It's unlikely to be useful in any other context.
4
-
5
-**Do not use in a real application.** We're publishing this early for
6
-demonstration purposes.
7
-
8
-**Use it at your own risk.**
9
-
10
-# No, Really, It Is Unstable
11
-
12
-The API ~~may~~ will change wildly between versions.
packages/react-fs/index.browser.server.js
deleted
-12
@@ -1,12 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-throw new Error(
11
- 'This entry point is not yet supported in the browser environment',
12
-);
packages/react-fs/index.js
deleted
-13
@@ -1,13 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-throw new Error(
11
- 'React FS cannot be used outside a react-server environment. ' +
12
- 'You must configure Node.js using the `--conditions react-server` flag.',
13
-);
packages/react-fs/index.node.server.js
deleted
-12
@@ -1,12 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-'use strict';
11
-
12
-export * from './src/ReactFilesystem';
packages/react-fs/npm/index.browser.server.js
deleted
-7
@@ -1,7 +0,0 @@
1
-'use strict';
2
-
3
-if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-fs.browser.production.min.server.js');
5
-} else {
6
- module.exports = require('./cjs/react-fs.browser.development.server.js');
7
-}
packages/react-fs/npm/index.js
deleted
-6
@@ -1,6 +0,0 @@
1
-'use strict';
2
-
3
-throw new Error(
4
- 'React FS cannot be used outside a react-server environment. ' +
5
- 'You must configure Node.js using the `--conditions react-server` flag.'
6
-);
packages/react-fs/npm/index.node.server.js
deleted
-7
@@ -1,7 +0,0 @@
1
-'use strict';
2
-
3
-if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-fs.node.production.min.server.js');
5
-} else {
6
- module.exports = require('./cjs/react-fs.node.development.server.js');
7
-}
packages/react-fs/package.json
deleted
-33
@@ -1,33 +0,0 @@
1
-{
2
- "name": "react-fs",
3
- "description": "React bindings for the filesystem",
4
- "version": "0.0.0",
5
- "repository": {
6
- "type" : "git",
7
- "url" : "https://github.com/facebook/react.git",
8
- "directory": "packages/react-fs"
9
- },
10
- "files": [
11
- "LICENSE",
12
- "README.md",
13
- "index.js",
14
- "index.node.server.js",
15
- "index.browser.server.js",
16
- "cjs/"
17
- ],
18
- "exports": {
19
- ".": {
20
- "react-server": {
21
- "node": "./index.node.server.js",
22
- "browser": "./index.browser.server.js"
23
- },
24
- "default": "./index.js"
25
- },
26
- "./index.node.server": "./index.node.server.js",
27
- "./index.browser.server": "./index.browser.server.js",
28
- "./package.json": "./package.json"
29
- },
30
- "peerDependencies": {
31
- "react": "^17.0.0"
32
- }
33
-}
packages/react-fs/src/ReactFilesystem.js
deleted
-391
@@ -1,391 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-import type {Wakeable, Thenable} from 'shared/ReactTypes';
11
-
12
-import {unstable_getCacheForType} from 'react';
13
-import * as fs from 'fs/promises';
14
-import {isAbsolute, normalize} from 'path';
15
-
16
-const Pending = 0;
17
-const Resolved = 1;
18
-const Rejected = 2;
19
-
20
-type PendingRecord = {
21
- status: 0,
22
- value: Wakeable,
23
- cache: null,
24
-};
25
-
26
-type ResolvedRecord<T> = {
27
- status: 1,
28
- value: T,
29
- cache: null | Array<mixed>,
30
-};
31
-
32
-type RejectedRecord = {
33
- status: 2,
34
- value: mixed,
35
- cache: null,
36
-};
37
-
38
-type Record<T> = PendingRecord | ResolvedRecord<T> | RejectedRecord;
39
-
40
-function createRecordFromThenable<T>(thenable: Thenable<T>): Record<T> {
41
- const record: Record<T> = {
42
- status: Pending,
43
- value: thenable,
44
- cache: null,
45
- };
46
- thenable.then(
47
- value => {
48
- if (record.status === Pending) {
49
- const resolvedRecord = ((record: any): ResolvedRecord<T>);
50
- resolvedRecord.status = Resolved;
51
- resolvedRecord.value = value;
52
- }
53
- },
54
- err => {
55
- if (record.status === Pending) {
56
- const rejectedRecord = ((record: any): RejectedRecord);
57
- rejectedRecord.status = Rejected;
58
- rejectedRecord.value = err;
59
- }
60
- },
61
- );
62
- return record;
63
-}
64
-
65
-function readRecord<T>(record: Record<T>): ResolvedRecord<T> {
66
- if (record.status === Resolved) {
67
- // This is just a type refinement.
68
- return record;
69
- } else {
70
- throw record.value;
71
- }
72
-}
73
-
74
-// We don't want to normalize every path ourselves in production.
75
-// However, relative or non-normalized paths will lead to cache misses.
76
-// So we encourage the developer to fix it in DEV and normalize on their end.
77
-function checkPathInDev(path: string) {
78
- if (__DEV__) {
79
- if (!isAbsolute(path)) {
80
- console.error(
81
- 'The provided path was not absolute: "%s". ' +
82
- 'Convert it to an absolute path first.',
83
- path,
84
- );
85
- } else if (path !== normalize(path)) {
86
- console.error(
87
- 'The provided path was not normalized: "%s". ' +
88
- 'Convert it to a normalized path first.',
89
- path,
90
- );
91
- }
92
- }
93
-}
94
-
95
-function createAccessMap(): Map<string, Array<number | Record<void>>> {
96
- return new Map();
97
-}
98
-
99
-export function access(path: string, mode?: number): void {
100
- checkPathInDev(path);
101
- if (mode == null) {
102
- mode = 0; // fs.constants.F_OK
103
- }
104
- const map = unstable_getCacheForType(createAccessMap);
105
- let accessCache = map.get(path);
106
- if (!accessCache) {
107
- accessCache = [];
108
- map.set(path, accessCache);
109
- }
110
- let record;
111
- for (let i = 0; i < accessCache.length; i += 2) {
112
- const cachedMode: number = (accessCache[i]: any);
113
- if (mode === cachedMode) {
114
- const cachedRecord: Record<void> = (accessCache[i + 1]: any);
115
- record = cachedRecord;
116
- break;
117
- }
118
- }
119
- if (!record) {
120
- const thenable = fs.access(path, mode);
121
- record = createRecordFromThenable(thenable);
122
- accessCache.push(mode, record);
123
- }
124
- readRecord(record); // No return value.
125
-}
126
-
127
-function createLstatMap(): Map<string, Array<boolean | Record<mixed>>> {
128
- return new Map();
129
-}
130
-
131
-export function lstat(path: string, options?: {bigint?: boolean}): mixed {
132
- checkPathInDev(path);
133
- let bigint = false;
134
- if (options && options.bigint) {
135
- bigint = true;
136
- }
137
- const map = unstable_getCacheForType(createLstatMap);
138
- let lstatCache = map.get(path);
139
- if (!lstatCache) {
140
- lstatCache = [];
141
- map.set(path, lstatCache);
142
- }
143
- let record;
144
- for (let i = 0; i < lstatCache.length; i += 2) {
145
- const cachedBigint: boolean = (lstatCache[i]: any);
146
- if (bigint === cachedBigint) {
147
- const cachedRecord: Record<void> = (lstatCache[i + 1]: any);
148
- record = cachedRecord;
149
- break;
150
- }
151
- }
152
- if (!record) {
153
- const thenable = fs.lstat(path, {bigint});
154
- record = createRecordFromThenable(thenable);
155
- // $FlowFixMe[incompatible-call] found when upgrading Flow
156
- lstatCache.push(bigint, record);
157
- }
158
- // $FlowFixMe[incompatible-call] found when upgrading Flow
159
- const stats = readRecord(record).value;
160
- return stats;
161
-}
162
-
163
-function createReaddirMap(): Map<
164
- string,
165
- Array<string | boolean | Record<mixed>>,
166
-> {
167
- return new Map();
168
-}
169
-
170
-export function readdir(
171
- path: string,
172
- options?: string | {encoding?: string, withFileTypes?: boolean},
173
-): mixed {
174
- checkPathInDev(path);
175
- let encoding = 'utf8';
176
- let withFileTypes = false;
177
- if (typeof options === 'string') {
178
- encoding = options;
179
- } else if (options != null) {
180
- if (options.encoding) {
181
- encoding = options.encoding;
182
- }
183
- if (options.withFileTypes) {
184
- withFileTypes = true;
185
- }
186
- }
187
- const map = unstable_getCacheForType(createReaddirMap);
188
- let readdirCache = map.get(path);
189
- if (!readdirCache) {
190
- readdirCache = [];
191
- map.set(path, readdirCache);
192
- }
193
- let record;
194
- for (let i = 0; i < readdirCache.length; i += 3) {
195
- const cachedEncoding: string = (readdirCache[i]: any);
196
- const cachedWithFileTypes: boolean = (readdirCache[i + 1]: any);
197
- if (encoding === cachedEncoding && withFileTypes === cachedWithFileTypes) {
198
- const cachedRecord: Record<void> = (readdirCache[i + 2]: any);
199
- record = cachedRecord;
200
- break;
201
- }
202
- }
203
- if (!record) {
204
- const thenable = fs.readdir(path, {encoding, withFileTypes});
205
- record = createRecordFromThenable(thenable);
206
- // $FlowFixMe[incompatible-call] found when upgrading Flow
207
- readdirCache.push(encoding, withFileTypes, record);
208
- }
209
- // $FlowFixMe[incompatible-call] found when upgrading Flow
210
- const files = readRecord(record).value;
211
- return files;
212
-}
213
-
214
-function createReadFileMap(): Map<string, Record<Buffer>> {
215
- return new Map();
216
-}
217
-
218
-export function readFile(
219
- path: string,
220
- options:
221
- | string
222
- | {
223
- encoding?: string | null,
224
- // Unsupported:
225
- flag?: string, // Doesn't make sense except "r"
226
- signal?: mixed, // We'll have our own signal
227
- },
228
-): string | Buffer {
229
- checkPathInDev(path);
230
- const map = unstable_getCacheForType(createReadFileMap);
231
- let record = map.get(path);
232
- if (!record) {
233
- const thenable = fs.readFile(path);
234
- record = createRecordFromThenable(thenable);
235
- map.set(path, record);
236
- }
237
- const resolvedRecord = readRecord(record);
238
- const buffer: Buffer = resolvedRecord.value;
239
- if (!options) {
240
- return buffer;
241
- }
242
- let encoding;
243
- if (typeof options === 'string') {
244
- encoding = options;
245
- } else {
246
- const flag = options.flag;
247
- if (flag != null && flag !== 'r') {
248
- throw Error(
249
- 'The flag option is not supported, and always defaults to "r".',
250
- );
251
- }
252
- if (options.signal) {
253
- throw Error('The signal option is not supported.');
254
- }
255
- encoding = options.encoding;
256
- }
257
- if (typeof encoding !== 'string') {
258
- return buffer;
259
- }
260
- const textCache = resolvedRecord.cache || (resolvedRecord.cache = []);
261
- for (let i = 0; i < textCache.length; i += 2) {
262
- if (textCache[i] === encoding) {
263
- return (textCache[i + 1]: any);
264
- }
265
- }
266
- const text = buffer.toString((encoding: any));
267
- textCache.push(encoding, text);
268
- return text;
269
-}
270
-
271
-function createReadlinkMap(): Map<string, Array<string | Record<mixed>>> {
272
- return new Map();
273
-}
274
-
275
-export function readlink(
276
- path: string,
277
- options?: string | {encoding?: string},
278
-): mixed {
279
- checkPathInDev(path);
280
- let encoding = 'utf8';
281
- if (typeof options === 'string') {
282
- encoding = options;
283
- } else if (options != null) {
284
- if (options.encoding) {
285
- encoding = options.encoding;
286
- }
287
- }
288
- const map = unstable_getCacheForType(createReadlinkMap);
289
- let readlinkCache = map.get(path);
290
- if (!readlinkCache) {
291
- readlinkCache = [];
292
- map.set(path, readlinkCache);
293
- }
294
- let record;
295
- for (let i = 0; i < readlinkCache.length; i += 2) {
296
- const cachedEncoding: string = (readlinkCache[i]: any);
297
- if (encoding === cachedEncoding) {
298
- const cachedRecord: Record<void> = (readlinkCache[i + 1]: any);
299
- record = cachedRecord;
300
- break;
301
- }
302
- }
303
- if (!record) {
304
- const thenable = fs.readlink(path, {encoding});
305
- record = createRecordFromThenable(thenable);
306
- // $FlowFixMe[incompatible-call] found when upgrading Flow
307
- readlinkCache.push(encoding, record);
308
- }
309
- // $FlowFixMe[incompatible-call] found when upgrading Flow
310
- const linkString = readRecord(record).value;
311
- return linkString;
312
-}
313
-
314
-function createRealpathMap(): Map<string, Array<string | Record<mixed>>> {
315
- return new Map();
316
-}
317
-
318
-export function realpath(
319
- path: string,
320
- options?: string | {encoding?: string},
321
-): mixed {
322
- checkPathInDev(path);
323
- let encoding = 'utf8';
324
- if (typeof options === 'string') {
325
- encoding = options;
326
- } else if (options != null) {
327
- if (options.encoding) {
328
- encoding = options.encoding;
329
- }
330
- }
331
- const map = unstable_getCacheForType(createRealpathMap);
332
- let realpathCache = map.get(path);
333
- if (!realpathCache) {
334
- realpathCache = [];
335
- map.set(path, realpathCache);
336
- }
337
- let record;
338
- for (let i = 0; i < realpathCache.length; i += 2) {
339
- const cachedEncoding: string = (realpathCache[i]: any);
340
- if (encoding === cachedEncoding) {
341
- const cachedRecord: Record<void> = (realpathCache[i + 1]: any);
342
- record = cachedRecord;
343
- break;
344
- }
345
- }
346
- if (!record) {
347
- const thenable = fs.realpath(path, {encoding});
348
- record = createRecordFromThenable(thenable);
349
- // $FlowFixMe[incompatible-call] found when upgrading Flow
350
- realpathCache.push(encoding, record);
351
- }
352
- // $FlowFixMe[incompatible-call] found when upgrading Flow
353
- const resolvedPath = readRecord(record).value;
354
- return resolvedPath;
355
-}
356
-
357
-function createStatMap(): Map<string, Array<boolean | Record<mixed>>> {
358
- return new Map();
359
-}
360
-
361
-export function stat(path: string, options?: {bigint?: boolean}): mixed {
362
- checkPathInDev(path);
363
- let bigint = false;
364
- if (options && options.bigint) {
365
- bigint = true;
366
- }
367
- const map = unstable_getCacheForType(createStatMap);
368
- let statCache = map.get(path);
369
- if (!statCache) {
370
- statCache = [];
371
- map.set(path, statCache);
372
- }
373
- let record;
374
- for (let i = 0; i < statCache.length; i += 2) {
375
- const cachedBigint: boolean = (statCache[i]: any);
376
- if (bigint === cachedBigint) {
377
- const cachedRecord: Record<void> = (statCache[i + 1]: any);
378
- record = cachedRecord;
379
- break;
380
- }
381
- }
382
- if (!record) {
383
- const thenable = fs.stat(path, {bigint});
384
- record = createRecordFromThenable(thenable);
385
- // $FlowFixMe[incompatible-call] found when upgrading Flow
386
- statCache.push(bigint, record);
387
- }
388
- // $FlowFixMe[incompatible-call] found when upgrading Flow
389
- const stats = readRecord(record).value;
390
- return stats;
391
-}
packages/react-pg/README.md
deleted
-12
@@ -1,12 +0,0 @@
1
-# react-pg
2
-
3
-This package is meant to be used alongside yet-to-be-released, experimental React features. It's unlikely to be useful in any other context.
4
-
5
-**Do not use in a real application.** We're publishing this early for
6
-demonstration purposes.
7
-
8
-**Use it at your own risk.**
9
-
10
-# No, Really, It Is Unstable
11
-
12
-The API ~~may~~ will change wildly between versions.
packages/react-pg/index.browser.server.js
deleted
-12
@@ -1,12 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-throw new Error(
11
- 'This entry point is not yet supported in the browser environment',
12
-);
packages/react-pg/index.js
deleted
-13
@@ -1,13 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-throw new Error(
11
- 'React PG cannot be used outside a react-server environment. ' +
12
- 'You must configure Node.js using the `--conditions react-server` flag.',
13
-);
packages/react-pg/index.node.server.js
deleted
-12
@@ -1,12 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-'use strict';
11
-
12
-export * from './src/ReactPostgres';
packages/react-pg/npm/index.browser.server.js
deleted
-7
@@ -1,7 +0,0 @@
1
-'use strict';
2
-
3
-if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-pg.browser.production.min.server.js');
5
-} else {
6
- module.exports = require('./cjs/react-pg.browser.development.server.js');
7
-}
packages/react-pg/npm/index.js
deleted
-6
@@ -1,6 +0,0 @@
1
-'use strict';
2
-
3
-throw new Error(
4
- 'React PG cannot be used outside a react-server environment. ' +
5
- 'You must configure Node.js using the `--conditions react-server` flag.'
6
-);
packages/react-pg/npm/index.node.server.js
deleted
-7
@@ -1,7 +0,0 @@
1
-'use strict';
2
-
3
-if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-pg.node.production.min.server.js');
5
-} else {
6
- module.exports = require('./cjs/react-pg.node.development.server.js');
7
-}
packages/react-pg/package.json
deleted
-34
@@ -1,34 +0,0 @@
1
-{
2
- "name": "react-pg",
3
- "description": "React bindings for PostgreSQL",
4
- "version": "0.0.0",
5
- "repository": {
6
- "type" : "git",
7
- "url" : "https://github.com/facebook/react.git",
8
- "directory": "packages/react-pg"
9
- },
10
- "files": [
11
- "LICENSE",
12
- "README.md",
13
- "index.js",
14
- "index.node.server.js",
15
- "index.browser.server.js",
16
- "cjs/"
17
- ],
18
- "exports": {
19
- ".": {
20
- "react-server": {
21
- "node": "./index.node.server.js",
22
- "browser": "./index.browser.server.js"
23
- },
24
- "default": "./index.js"
25
- },
26
- "./index.node.server": "./index.node.server.js",
27
- "./index.browser.server": "./index.browser.server.js",
28
- "./package.json": "./package.json"
29
- },
30
- "peerDependencies": {
31
- "react": "^17.0.0",
32
- "pg": "*"
33
- }
34
-}
packages/react-pg/src/ReactPostgres.js
deleted
-124
@@ -1,124 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-import type {Wakeable} from 'shared/ReactTypes';
11
-
12
-import {unstable_getCacheForType} from 'react';
13
-import {Pool as PostgresPool} from 'pg';
14
-import {prepareValue} from 'pg/lib/utils';
15
-
16
-const Pending = 0;
17
-const Resolved = 1;
18
-const Rejected = 2;
19
-
20
-type PendingRecord = {
21
- status: 0,
22
- value: Wakeable,
23
-};
24
-
25
-type ResolvedRecord = {
26
- status: 1,
27
- value: mixed,
28
-};
29
-
30
-type RejectedRecord = {
31
- status: 2,
32
- value: mixed,
33
-};
34
-
35
-type Record = PendingRecord | ResolvedRecord | RejectedRecord;
36
-
37
-function createRecordFromThenable(thenable): Record {
38
- const record: Record = {
39
- status: Pending,
40
- value: thenable,
41
- };
42
- thenable.then(
43
- value => {
44
- if (record.status === Pending) {
45
- const resolvedRecord = ((record: any): ResolvedRecord);
46
- resolvedRecord.status = Resolved;
47
- resolvedRecord.value = value;
48
- }
49
- },
50
- err => {
51
- if (record.status === Pending) {
52
- const rejectedRecord = ((record: any): RejectedRecord);
53
- rejectedRecord.status = Rejected;
54
- rejectedRecord.value = err;
55
- }
56
- },
57
- );
58
- return record;
59
-}
60
-
61
-function readRecordValue(record: Record) {
62
- if (record.status === Resolved) {
63
- return record.value;
64
- } else {
65
- throw record.value;
66
- }
67
-}
68
-
69
-export function Pool(options: mixed) {
70
- // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
71
- this.pool = new PostgresPool(options);
72
- // Unique function per instance because it's used for cache identity.
73
- this.createRecordMap = function() {
74
- return new Map();
75
- };
76
-}
77
-
78
-type NestedMap = Map<any, Record | NestedMap>;
79
-
80
-// $FlowFixMe[prop-missing] found when upgrading Flow
81
-Pool.prototype.query = function(query: string, values?: Array<mixed>) {
82
- const pool = this.pool;
83
- const outerMap = unstable_getCacheForType(this.createRecordMap);
84
-
85
- let innerMap: NestedMap = outerMap;
86
- let key: mixed = query;
87
- if (values != null) {
88
- // If we have parameters, each becomes as a nesting layer for Maps.
89
- // We want to find (or create as needed) the innermost Map, and return that.
90
- for (let i = 0; i < values.length; i++) {
91
- let nextMap = innerMap.get(key);
92
- if (nextMap === undefined) {
93
- nextMap = new Map();
94
- innerMap.set(key, nextMap);
95
- } else if (!(nextMap instanceof Map)) {
96
- throw new Error(
97
- 'This query has received more parameters than the last time ' +
98
- 'the same query was used. Always pass the exact number of ' +
99
- 'parameters that the query needs.',
100
- );
101
- }
102
- innerMap = nextMap;
103
- // Postgres bindings convert everything to strings:
104
- // https://node-postgres.com/features/queries#parameterized-query
105
- // We reuse their algorithm instead of reimplementing.
106
- key = prepareValue(values[i]);
107
- }
108
- }
109
-
110
- let record = innerMap.get(key);
111
- if (!record) {
112
- const thenable = pool.query(query, values);
113
- record = createRecordFromThenable(thenable);
114
- innerMap.set(key, record);
115
- } else if (record instanceof Map) {
116
- throw new Error(
117
- 'This query has received fewer parameters than the last time ' +
118
- 'the same query was used. Always pass the exact number of ' +
119
- 'parameters that the query needs.',
120
- );
121
- }
122
- const result = readRecordValue(record);
123
- return result;
124
-};
scripts/rollup/bundles.js
-66
@@ -138,72 +138,6 @@ const bundles = [
138
externals: ['react', 'ReactNativeInternalFeatureFlags'],
139
},
140
141
- /******* React Fetch Browser (experimental, new) *******/
142
- {
143
- bundleTypes: [NODE_DEV, NODE_PROD],
144
- moduleType: ISOMORPHIC,
145
- entry: 'react-fetch/index.browser',
146
- global: 'ReactFetch',
147
- minifyWithProdErrorCodes: false,
148
- wrapWithModuleBoundaries: false,
149
- externals: ['react'],
150
- },
151
-
152
- /******* React Fetch Node (experimental, new) *******/
153
- {
154
- bundleTypes: [NODE_DEV, NODE_PROD],
155
- moduleType: ISOMORPHIC,
156
- entry: 'react-fetch/index.node',
157
- global: 'ReactFetch',
158
- minifyWithProdErrorCodes: false,
159
- wrapWithModuleBoundaries: false,
160
- externals: ['react', 'http', 'https'],
161
- },
162
-
163
- /******* React FS Browser (experimental, new) *******/
164
- {
165
- bundleTypes: [NODE_DEV, NODE_PROD],
166
- moduleType: ISOMORPHIC,
167
- entry: 'react-fs/index.browser.server',
168
- global: 'ReactFilesystem',
169
- minifyWithProdErrorCodes: false,
170
- wrapWithModuleBoundaries: false,
171
- externals: [],
172
- },
173
-
174
- /******* React FS Node (experimental, new) *******/
175
- {
176
- bundleTypes: [NODE_DEV, NODE_PROD],
177
- moduleType: ISOMORPHIC,
178
- entry: 'react-fs/index.node.server',
179
- global: 'ReactFilesystem',
180
- minifyWithProdErrorCodes: false,
181
- wrapWithModuleBoundaries: false,
182
- externals: ['react', 'fs/promises', 'path'],
183
- },
184
-
185
- /******* React PG Browser (experimental, new) *******/
186
- {
187
- bundleTypes: [NODE_DEV, NODE_PROD],
188
- moduleType: ISOMORPHIC,
189
- entry: 'react-pg/index.browser.server',
190
- global: 'ReactPostgres',
191
- minifyWithProdErrorCodes: false,
192
- wrapWithModuleBoundaries: false,
193
- externals: [],
194
- },
195
-
196
- /******* React PG Node (experimental, new) *******/
197
- {
198
- bundleTypes: [NODE_DEV, NODE_PROD],
199
- moduleType: ISOMORPHIC,
200
- entry: 'react-pg/index.node.server',
201
- global: 'ReactPostgres',
202
- minifyWithProdErrorCodes: false,
203
- wrapWithModuleBoundaries: false,
204
- externals: ['react', 'pg'],
205
- },
206
-
141
/******* React DOM *******/
142
{
143
bundleTypes: [
scripts/rollup/modules.js
-1
@@ -19,7 +19,6 @@ const importSideEffects = Object.freeze({
19
react: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
20
'react-dom/server': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
21
'react/jsx-dev-runtime': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
22
- 'react-fetch/node': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
22
'react-dom': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
23
url: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
24
ReactNativeInternalFeatureFlags: HAS_NO_SIDE_EFFECTS_ON_IMPORT,