| 1 | 'use strict'; |
| 2 | |
| 3 | const RELEASE_CHANNEL = process.env.RELEASE_CHANNEL; |
| 4 | |
| 5 | const __EXPERIMENTAL__ = |
| 6 | typeof RELEASE_CHANNEL === 'string' |
| 7 | ? RELEASE_CHANNEL === 'experimental' |
| 8 | : true; |
| 9 | |
| 10 | const bundleTypes = { |
| 11 | NODE_ES2015: 'NODE_ES2015', |
| 12 | ESM_DEV: 'ESM_DEV', |
| 13 | ESM_PROD: 'ESM_PROD', |
| 14 | NODE_DEV: 'NODE_DEV', |
| 15 | NODE_PROD: 'NODE_PROD', |
| 16 | NODE_PROFILING: 'NODE_PROFILING', |
| 17 | BUN_DEV: 'BUN_DEV', |
| 18 | BUN_PROD: 'BUN_PROD', |
| 19 | FB_WWW_DEV: 'FB_WWW_DEV', |
| 20 | FB_WWW_PROD: 'FB_WWW_PROD', |
| 21 | FB_WWW_PROFILING: 'FB_WWW_PROFILING', |
| 22 | RN_OSS_DEV: 'RN_OSS_DEV', |
| 23 | RN_OSS_PROD: 'RN_OSS_PROD', |
| 24 | RN_OSS_PROFILING: 'RN_OSS_PROFILING', |
| 25 | RN_FB_DEV: 'RN_FB_DEV', |
| 26 | RN_FB_PROD: 'RN_FB_PROD', |
| 27 | RN_FB_PROFILING: 'RN_FB_PROFILING', |
| 28 | BROWSER_SCRIPT: 'BROWSER_SCRIPT', |
| 29 | CJS_DTS: 'CJS_DTS', |
| 30 | ESM_DTS: 'ESM_DTS', |
| 31 | }; |
| 32 | |
| 33 | const { |
| 34 | NODE_ES2015, |
| 35 | ESM_DEV, |
| 36 | ESM_PROD, |
| 37 | NODE_DEV, |
| 38 | NODE_PROD, |
| 39 | NODE_PROFILING, |
| 40 | BUN_DEV, |
| 41 | BUN_PROD, |
| 42 | FB_WWW_DEV, |
| 43 | FB_WWW_PROD, |
| 44 | FB_WWW_PROFILING, |
| 45 | RN_OSS_DEV, |
| 46 | RN_OSS_PROD, |
| 47 | RN_OSS_PROFILING, |
| 48 | RN_FB_DEV, |
| 49 | RN_FB_PROD, |
| 50 | RN_FB_PROFILING, |
| 51 | BROWSER_SCRIPT, |
| 52 | CJS_DTS, |
| 53 | ESM_DTS, |
| 54 | } = bundleTypes; |
| 55 | |
| 56 | const moduleTypes = { |
| 57 | // React |
| 58 | ISOMORPHIC: 'ISOMORPHIC', |
| 59 | // Individual renderers. They bundle the reconciler. (e.g. ReactDOM) |
| 60 | RENDERER: 'RENDERER', |
| 61 | // Helper packages that access specific renderer's internals. (e.g. TestUtils) |
| 62 | RENDERER_UTILS: 'RENDERER_UTILS', |
| 63 | // Standalone reconciler for third-party renderers. |
| 64 | RECONCILER: 'RECONCILER', |
| 65 | }; |
| 66 | |
| 67 | const {ISOMORPHIC, RENDERER, RENDERER_UTILS, RECONCILER} = moduleTypes; |
| 68 | |
| 69 | const bundles = [ |
| 70 | /******* Isomorphic *******/ |
| 71 | { |
| 72 | bundleTypes: [ |
| 73 | NODE_DEV, |
| 74 | NODE_PROD, |
| 75 | FB_WWW_DEV, |
| 76 | FB_WWW_PROD, |
| 77 | FB_WWW_PROFILING, |
| 78 | RN_FB_DEV, |
| 79 | RN_FB_PROD, |
| 80 | RN_FB_PROFILING, |
| 81 | ], |
| 82 | moduleType: ISOMORPHIC, |
| 83 | entry: 'react', |
| 84 | global: 'React', |
| 85 | minifyWithProdErrorCodes: false, |
| 86 | wrapWithModuleBoundaries: true, |
| 87 | externals: ['ReactNativeInternalFeatureFlags'], |
| 88 | }, |
| 89 | |
| 90 | /******* Isomorphic Shared Subset *******/ |
| 91 | { |
| 92 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 93 | moduleType: ISOMORPHIC, |
| 94 | entry: 'react/src/ReactServer.js', |
| 95 | name: 'react.react-server', |
| 96 | condition: 'react-server', |
| 97 | global: 'React', |
| 98 | minifyWithProdErrorCodes: true, |
| 99 | wrapWithModuleBoundaries: false, |
| 100 | externals: [], |
| 101 | }, |
| 102 | |
| 103 | /******* React JSX Runtime *******/ |
| 104 | { |
| 105 | bundleTypes: [ |
| 106 | NODE_DEV, |
| 107 | NODE_PROD, |
| 108 | NODE_PROFILING, |
| 109 | // TODO: use on WWW. |
| 110 | RN_FB_DEV, |
| 111 | RN_FB_PROD, |
| 112 | RN_FB_PROFILING, |
| 113 | ], |
| 114 | moduleType: ISOMORPHIC, |
| 115 | entry: 'react/jsx-runtime', |
| 116 | global: 'JSXRuntime', |
| 117 | minifyWithProdErrorCodes: true, |
| 118 | wrapWithModuleBoundaries: false, |
| 119 | externals: ['react', 'ReactNativeInternalFeatureFlags'], |
| 120 | }, |
| 121 | |
| 122 | /******* Compiler Runtime *******/ |
| 123 | { |
| 124 | bundleTypes: [NODE_DEV, NODE_PROD, NODE_PROFILING], |
| 125 | moduleType: ISOMORPHIC, |
| 126 | entry: 'react/compiler-runtime', |
| 127 | global: 'CompilerRuntime', |
| 128 | minifyWithProdErrorCodes: true, |
| 129 | wrapWithModuleBoundaries: false, |
| 130 | externals: ['react'], |
| 131 | }, |
| 132 | |
| 133 | /******* React JSX Runtime React Server *******/ |
| 134 | { |
| 135 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 136 | moduleType: ISOMORPHIC, |
| 137 | entry: 'react/src/jsx/ReactJSXServer.js', |
| 138 | name: 'react-jsx-runtime.react-server', |
| 139 | condition: 'react-server', |
| 140 | global: 'JSXRuntime', |
| 141 | minifyWithProdErrorCodes: false, |
| 142 | wrapWithModuleBoundaries: false, |
| 143 | externals: ['react', 'ReactNativeInternalFeatureFlags'], |
| 144 | }, |
| 145 | |
| 146 | /******* React JSX DEV Runtime *******/ |
| 147 | { |
| 148 | bundleTypes: [ |
| 149 | NODE_DEV, |
| 150 | NODE_PROD, |
| 151 | NODE_PROFILING, |
| 152 | FB_WWW_DEV, |
| 153 | FB_WWW_PROD, |
| 154 | FB_WWW_PROFILING, |
| 155 | RN_FB_DEV, |
| 156 | RN_FB_PROD, |
| 157 | RN_FB_PROFILING, |
| 158 | ], |
| 159 | moduleType: ISOMORPHIC, |
| 160 | entry: 'react/jsx-dev-runtime', |
| 161 | global: 'JSXDEVRuntime', |
| 162 | minifyWithProdErrorCodes: false, |
| 163 | wrapWithModuleBoundaries: false, |
| 164 | externals: ['react', 'ReactNativeInternalFeatureFlags'], |
| 165 | }, |
| 166 | |
| 167 | /******* React JSX DEV Runtime React Server *******/ |
| 168 | { |
| 169 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 170 | moduleType: ISOMORPHIC, |
| 171 | entry: 'react/src/jsx/ReactJSXServer.js', |
| 172 | name: 'react-jsx-dev-runtime.react-server', |
| 173 | condition: 'react-server', |
| 174 | global: 'JSXDEVRuntime', |
| 175 | minifyWithProdErrorCodes: false, |
| 176 | wrapWithModuleBoundaries: false, |
| 177 | externals: ['react', 'ReactNativeInternalFeatureFlags'], |
| 178 | }, |
| 179 | |
| 180 | /******* React DOM *******/ |
| 181 | { |
| 182 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 183 | moduleType: RENDERER, |
| 184 | entry: 'react-dom', |
| 185 | global: 'ReactDOM', |
| 186 | minifyWithProdErrorCodes: true, |
| 187 | wrapWithModuleBoundaries: true, |
| 188 | externals: ['react'], |
| 189 | }, |
| 190 | |
| 191 | /******* React DOM Client *******/ |
| 192 | { |
| 193 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 194 | moduleType: RENDERER, |
| 195 | entry: 'react-dom/client', |
| 196 | global: 'ReactDOM', |
| 197 | minifyWithProdErrorCodes: true, |
| 198 | wrapWithModuleBoundaries: true, |
| 199 | externals: ['react', 'react-dom'], |
| 200 | }, |
| 201 | |
| 202 | /******* React DOM Profiling (Client) *******/ |
| 203 | { |
| 204 | bundleTypes: [NODE_DEV, NODE_PROFILING], |
| 205 | moduleType: RENDERER, |
| 206 | entry: 'react-dom/profiling', |
| 207 | global: 'ReactDOM', |
| 208 | minifyWithProdErrorCodes: true, |
| 209 | wrapWithModuleBoundaries: true, |
| 210 | externals: ['react', 'react-dom'], |
| 211 | }, |
| 212 | |
| 213 | /******* React DOM (www) *******/ |
| 214 | { |
| 215 | bundleTypes: [FB_WWW_DEV, FB_WWW_PROD, FB_WWW_PROFILING], |
| 216 | moduleType: RENDERER, |
| 217 | entry: 'react-dom/src/ReactDOMFB.js', |
| 218 | global: 'ReactDOM', |
| 219 | minifyWithProdErrorCodes: true, |
| 220 | wrapWithModuleBoundaries: true, |
| 221 | externals: ['react'], |
| 222 | }, |
| 223 | |
| 224 | /******* React DOM (fbsource) *******/ |
| 225 | { |
| 226 | bundleTypes: [RN_FB_DEV, RN_FB_PROD, RN_FB_PROFILING], |
| 227 | moduleType: RENDERER, |
| 228 | entry: 'react-dom', |
| 229 | global: 'ReactDOM', |
| 230 | minifyWithProdErrorCodes: true, |
| 231 | wrapWithModuleBoundaries: false, |
| 232 | externals: ['react', 'ReactNativeInternalFeatureFlags'], |
| 233 | }, |
| 234 | |
| 235 | /******* React DOM Client (fbsource) *******/ |
| 236 | { |
| 237 | bundleTypes: [RN_FB_DEV, RN_FB_PROD, RN_FB_PROFILING], |
| 238 | moduleType: RENDERER, |
| 239 | entry: 'react-dom/client', |
| 240 | global: 'ReactDOMClient', |
| 241 | minifyWithProdErrorCodes: true, |
| 242 | wrapWithModuleBoundaries: false, |
| 243 | externals: ['react', 'react-dom', 'ReactNativeInternalFeatureFlags'], |
| 244 | }, |
| 245 | |
| 246 | /******* React DOM Profiling (fbsource) *******/ |
| 247 | { |
| 248 | bundleTypes: [RN_FB_DEV, RN_FB_PROD, RN_FB_PROFILING], |
| 249 | moduleType: RENDERER, |
| 250 | entry: 'react-dom/profiling', |
| 251 | global: 'ReactDOMProfiling', |
| 252 | minifyWithProdErrorCodes: true, |
| 253 | wrapWithModuleBoundaries: true, |
| 254 | externals: ['react', 'react-dom', 'ReactNativeInternalFeatureFlags'], |
| 255 | }, |
| 256 | |
| 257 | /******* React DOM Test Utils (fbsource) *******/ |
| 258 | { |
| 259 | moduleType: RENDERER_UTILS, |
| 260 | bundleTypes: [RN_FB_DEV, RN_FB_PROD, RN_FB_PROFILING], |
| 261 | entry: 'react-dom/test-utils', |
| 262 | global: 'ReactDOMTestUtils', |
| 263 | minifyWithProdErrorCodes: false, |
| 264 | wrapWithModuleBoundaries: false, |
| 265 | externals: ['react', 'react-dom', 'ReactNativeInternalFeatureFlags'], |
| 266 | }, |
| 267 | |
| 268 | /******* React DOM React Server *******/ |
| 269 | { |
| 270 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 271 | moduleType: RENDERER, |
| 272 | entry: 'react-dom/src/ReactDOMReactServer.js', |
| 273 | name: 'react-dom.react-server', |
| 274 | condition: 'react-server', |
| 275 | global: 'ReactDOM', |
| 276 | minifyWithProdErrorCodes: false, |
| 277 | wrapWithModuleBoundaries: false, |
| 278 | externals: ['react'], |
| 279 | }, |
| 280 | |
| 281 | /******* Test Utils *******/ |
| 282 | { |
| 283 | moduleType: RENDERER_UTILS, |
| 284 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 285 | entry: 'react-dom/test-utils', |
| 286 | global: 'ReactTestUtils', |
| 287 | minifyWithProdErrorCodes: false, |
| 288 | wrapWithModuleBoundaries: false, |
| 289 | externals: ['react', 'react-dom'], |
| 290 | }, |
| 291 | |
| 292 | /******* React DOM - Testing *******/ |
| 293 | { |
| 294 | moduleType: RENDERER, |
| 295 | bundleTypes: __EXPERIMENTAL__ ? [NODE_DEV, NODE_PROD] : [], |
| 296 | entry: 'react-dom/unstable_testing', |
| 297 | global: 'ReactDOMTesting', |
| 298 | minifyWithProdErrorCodes: true, |
| 299 | wrapWithModuleBoundaries: false, |
| 300 | externals: ['react', 'react-dom'], |
| 301 | }, |
| 302 | |
| 303 | /******* React DOM - www - Testing *******/ |
| 304 | { |
| 305 | moduleType: RENDERER, |
| 306 | bundleTypes: [FB_WWW_DEV, FB_WWW_PROD], |
| 307 | entry: 'react-dom/src/ReactDOMTestingFB.js', |
| 308 | global: 'ReactDOMTesting', |
| 309 | minifyWithProdErrorCodes: true, |
| 310 | wrapWithModuleBoundaries: false, |
| 311 | externals: ['react'], |
| 312 | }, |
| 313 | |
| 314 | /******* React DOM Server *******/ |
| 315 | { |
| 316 | bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV, FB_WWW_PROD], |
| 317 | moduleType: RENDERER, |
| 318 | entry: 'react-dom/src/server/ReactDOMLegacyServerBrowser.js', |
| 319 | name: 'react-dom-server-legacy.browser', |
| 320 | global: 'ReactDOMServer', |
| 321 | minifyWithProdErrorCodes: true, |
| 322 | wrapWithModuleBoundaries: false, |
| 323 | externals: ['react', 'react-dom'], |
| 324 | babel: opts => |
| 325 | Object.assign({}, opts, { |
| 326 | plugins: opts.plugins.concat([ |
| 327 | [require.resolve('@babel/plugin-transform-classes'), {loose: true}], |
| 328 | ]), |
| 329 | }), |
| 330 | }, |
| 331 | { |
| 332 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 333 | moduleType: RENDERER, |
| 334 | entry: 'react-dom/src/server/ReactDOMLegacyServerNode.js', |
| 335 | name: 'react-dom-server-legacy.node', |
| 336 | externals: ['react', 'stream', 'react-dom'], |
| 337 | minifyWithProdErrorCodes: false, |
| 338 | wrapWithModuleBoundaries: false, |
| 339 | babel: opts => |
| 340 | Object.assign({}, opts, { |
| 341 | plugins: opts.plugins.concat([ |
| 342 | [require.resolve('@babel/plugin-transform-classes'), {loose: true}], |
| 343 | ]), |
| 344 | }), |
| 345 | }, |
| 346 | |
| 347 | /******* React DOM Fizz Server *******/ |
| 348 | { |
| 349 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 350 | moduleType: RENDERER, |
| 351 | entry: 'react-dom/src/server/react-dom-server.browser.js', |
| 352 | name: 'react-dom-server.browser', |
| 353 | global: 'ReactDOMServer', |
| 354 | minifyWithProdErrorCodes: true, |
| 355 | wrapWithModuleBoundaries: false, |
| 356 | externals: ['react', 'react-dom'], |
| 357 | }, |
| 358 | { |
| 359 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 360 | moduleType: RENDERER, |
| 361 | entry: 'react-dom/src/server/react-dom-server.node.js', |
| 362 | name: 'react-dom-server.node', |
| 363 | global: 'ReactDOMServer', |
| 364 | minifyWithProdErrorCodes: false, |
| 365 | wrapWithModuleBoundaries: false, |
| 366 | externals: [ |
| 367 | 'react', |
| 368 | 'react-dom', |
| 369 | 'async_hooks', |
| 370 | 'crypto', |
| 371 | 'stream', |
| 372 | 'util', |
| 373 | ], |
| 374 | }, |
| 375 | { |
| 376 | bundleTypes: __EXPERIMENTAL__ ? [FB_WWW_DEV, FB_WWW_PROD] : [], |
| 377 | moduleType: RENDERER, |
| 378 | entry: 'react-server-dom-fb/src/ReactDOMServerFB.js', |
| 379 | global: 'ReactDOMServerStreaming', |
| 380 | minifyWithProdErrorCodes: false, |
| 381 | wrapWithModuleBoundaries: false, |
| 382 | externals: ['react', 'react-dom'], |
| 383 | }, |
| 384 | |
| 385 | /******* React DOM Fizz Server Edge *******/ |
| 386 | { |
| 387 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 388 | moduleType: RENDERER, |
| 389 | entry: 'react-dom/src/server/react-dom-server.edge.js', |
| 390 | name: 'react-dom-server.edge', // 'node_modules/react/*.js', |
| 391 | |
| 392 | global: 'ReactDOMServer', |
| 393 | minifyWithProdErrorCodes: false, |
| 394 | wrapWithModuleBoundaries: false, |
| 395 | externals: ['react', 'react-dom'], |
| 396 | }, |
| 397 | |
| 398 | /******* React DOM Fizz Server Bun *******/ |
| 399 | { |
| 400 | bundleTypes: [BUN_DEV, BUN_PROD], |
| 401 | moduleType: RENDERER, |
| 402 | entry: 'react-dom/src/server/react-dom-server.bun.js', |
| 403 | name: 'react-dom-server.bun', // 'node_modules/react/*.js', |
| 404 | |
| 405 | global: 'ReactDOMServer', |
| 406 | minifyWithProdErrorCodes: false, |
| 407 | wrapWithModuleBoundaries: false, |
| 408 | externals: ['react', 'react-dom', 'crypto', 'stream', 'util'], |
| 409 | }, |
| 410 | |
| 411 | /******* React DOM Fizz Server External Runtime *******/ |
| 412 | { |
| 413 | bundleTypes: __EXPERIMENTAL__ ? [BROWSER_SCRIPT] : [], |
| 414 | moduleType: RENDERER, |
| 415 | entry: 'react-dom/unstable_server-external-runtime', |
| 416 | outputPath: 'unstable_server-external-runtime.js', |
| 417 | global: 'ReactDOMServerExternalRuntime', |
| 418 | minifyWithProdErrorCodes: true, |
| 419 | wrapWithModuleBoundaries: false, |
| 420 | externals: [], |
| 421 | }, |
| 422 | |
| 423 | /******* React HTML RSC *******/ |
| 424 | { |
| 425 | bundleTypes: __EXPERIMENTAL__ ? [NODE_DEV, NODE_PROD] : [], |
| 426 | moduleType: RENDERER, |
| 427 | entry: 'react-markup/src/ReactMarkupServer.js', |
| 428 | name: 'react-markup.react-server', |
| 429 | condition: 'react-server', |
| 430 | global: 'ReactMarkup', |
| 431 | minifyWithProdErrorCodes: false, |
| 432 | wrapWithModuleBoundaries: false, |
| 433 | externals: ['react'], |
| 434 | }, |
| 435 | |
| 436 | /******* React HTML Client *******/ |
| 437 | { |
| 438 | bundleTypes: __EXPERIMENTAL__ ? [NODE_DEV, NODE_PROD] : [], |
| 439 | moduleType: RENDERER, |
| 440 | entry: 'react-markup/src/ReactMarkupClient.js', |
| 441 | name: 'react-markup', |
| 442 | global: 'ReactMarkup', |
| 443 | minifyWithProdErrorCodes: false, |
| 444 | wrapWithModuleBoundaries: false, |
| 445 | externals: ['react'], |
| 446 | }, |
| 447 | |
| 448 | /******* React Server DOM Webpack Server *******/ |
| 449 | { |
| 450 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 451 | moduleType: RENDERER, |
| 452 | entry: |
| 453 | 'react-server-dom-webpack/src/server/react-flight-dom-server.browser', |
| 454 | name: 'react-server-dom-webpack-server.browser', |
| 455 | condition: 'react-server', |
| 456 | global: 'ReactServerDOMServer', |
| 457 | minifyWithProdErrorCodes: true, |
| 458 | wrapWithModuleBoundaries: false, |
| 459 | externals: ['react', 'react-dom'], |
| 460 | }, |
| 461 | { |
| 462 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 463 | moduleType: RENDERER, |
| 464 | entry: 'react-server-dom-webpack/src/server/react-flight-dom-server.node', |
| 465 | name: 'react-server-dom-webpack-server.node', |
| 466 | condition: 'react-server', |
| 467 | global: 'ReactServerDOMServer', |
| 468 | minifyWithProdErrorCodes: false, |
| 469 | wrapWithModuleBoundaries: false, |
| 470 | externals: [ |
| 471 | 'react', |
| 472 | 'react-dom', |
| 473 | 'async_hooks', |
| 474 | 'crypto', |
| 475 | 'stream', |
| 476 | 'util', |
| 477 | ], |
| 478 | }, |
| 479 | { |
| 480 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 481 | moduleType: RENDERER, |
| 482 | entry: 'react-server-dom-webpack/src/server/react-flight-dom-server.edge', |
| 483 | name: 'react-server-dom-webpack-server.edge', |
| 484 | condition: 'react-server', |
| 485 | global: 'ReactServerDOMServer', |
| 486 | minifyWithProdErrorCodes: false, |
| 487 | wrapWithModuleBoundaries: false, |
| 488 | externals: ['react'], |
| 489 | }, |
| 490 | |
| 491 | /******* React Server DOM Webpack Client *******/ |
| 492 | { |
| 493 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 494 | moduleType: RENDERER, |
| 495 | entry: |
| 496 | 'react-server-dom-webpack/src/client/react-flight-dom-client.browser', |
| 497 | name: 'react-server-dom-webpack-client.browser', |
| 498 | global: 'ReactServerDOMClient', |
| 499 | minifyWithProdErrorCodes: true, |
| 500 | wrapWithModuleBoundaries: false, |
| 501 | externals: ['react', 'react-dom'], |
| 502 | }, |
| 503 | { |
| 504 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 505 | moduleType: RENDERER, |
| 506 | entry: 'react-server-dom-webpack/src/client/react-flight-dom-client.node', |
| 507 | name: 'react-server-dom-webpack-client.node', |
| 508 | global: 'ReactServerDOMClient', |
| 509 | minifyWithProdErrorCodes: false, |
| 510 | wrapWithModuleBoundaries: false, |
| 511 | externals: ['react', 'react-dom', 'util', 'crypto'], |
| 512 | }, |
| 513 | { |
| 514 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 515 | moduleType: RENDERER, |
| 516 | entry: 'react-server-dom-webpack/src/client/react-flight-dom-client.edge', |
| 517 | name: 'react-server-dom-webpack-client.edge', |
| 518 | global: 'ReactServerDOMClient', |
| 519 | minifyWithProdErrorCodes: false, |
| 520 | wrapWithModuleBoundaries: false, |
| 521 | externals: ['react', 'react-dom'], |
| 522 | }, |
| 523 | |
| 524 | /******* React Server DOM Webpack Plugin *******/ |
| 525 | { |
| 526 | bundleTypes: [NODE_ES2015], |
| 527 | moduleType: RENDERER_UTILS, |
| 528 | entry: 'react-server-dom-webpack/plugin', |
| 529 | global: 'ReactServerWebpackPlugin', |
| 530 | minifyWithProdErrorCodes: false, |
| 531 | wrapWithModuleBoundaries: false, |
| 532 | externals: ['fs', 'path', 'url', 'neo-async'], |
| 533 | }, |
| 534 | |
| 535 | /******* React Server DOM Webpack Node.js Loader *******/ |
| 536 | { |
| 537 | bundleTypes: [ESM_PROD], |
| 538 | moduleType: RENDERER_UTILS, |
| 539 | entry: 'react-server-dom-webpack/node-loader', |
| 540 | condition: 'react-server', |
| 541 | global: 'ReactServerWebpackNodeLoader', |
| 542 | minifyWithProdErrorCodes: false, |
| 543 | wrapWithModuleBoundaries: false, |
| 544 | externals: ['acorn'], |
| 545 | }, |
| 546 | |
| 547 | /******* React Server DOM Webpack Node.js CommonJS Loader *******/ |
| 548 | { |
| 549 | bundleTypes: [NODE_ES2015], |
| 550 | moduleType: RENDERER_UTILS, |
| 551 | entry: 'react-server-dom-webpack/src/ReactFlightWebpackNodeRegister', |
| 552 | name: 'react-server-dom-webpack-node-register', |
| 553 | condition: 'react-server', |
| 554 | global: 'ReactFlightWebpackNodeRegister', |
| 555 | minifyWithProdErrorCodes: false, |
| 556 | wrapWithModuleBoundaries: false, |
| 557 | externals: ['url', 'module', 'react-server-dom-webpack/server'], |
| 558 | }, |
| 559 | |
| 560 | /******* React Server DOM Turbopack Server *******/ |
| 561 | { |
| 562 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 563 | moduleType: RENDERER, |
| 564 | entry: |
| 565 | 'react-server-dom-turbopack/src/server/react-flight-dom-server.browser', |
| 566 | name: 'react-server-dom-turbopack-server.browser', |
| 567 | condition: 'react-server', |
| 568 | global: 'ReactServerDOMServer', |
| 569 | minifyWithProdErrorCodes: true, |
| 570 | wrapWithModuleBoundaries: false, |
| 571 | externals: ['react', 'react-dom'], |
| 572 | }, |
| 573 | { |
| 574 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 575 | moduleType: RENDERER, |
| 576 | entry: 'react-server-dom-turbopack/src/server/react-flight-dom-server.node', |
| 577 | name: 'react-server-dom-turbopack-server.node', |
| 578 | condition: 'react-server', |
| 579 | global: 'ReactServerDOMServer', |
| 580 | minifyWithProdErrorCodes: false, |
| 581 | wrapWithModuleBoundaries: false, |
| 582 | externals: [ |
| 583 | 'react', |
| 584 | 'react-dom', |
| 585 | 'async_hooks', |
| 586 | 'crypto', |
| 587 | 'stream', |
| 588 | 'util', |
| 589 | ], |
| 590 | }, |
| 591 | { |
| 592 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 593 | moduleType: RENDERER, |
| 594 | entry: 'react-server-dom-turbopack/src/server/react-flight-dom-server.edge', |
| 595 | name: 'react-server-dom-turbopack-server.edge', |
| 596 | condition: 'react-server', |
| 597 | global: 'ReactServerDOMServer', |
| 598 | minifyWithProdErrorCodes: false, |
| 599 | wrapWithModuleBoundaries: false, |
| 600 | externals: ['react'], |
| 601 | }, |
| 602 | |
| 603 | /******* React Server DOM Turbopack Client *******/ |
| 604 | { |
| 605 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 606 | moduleType: RENDERER, |
| 607 | entry: |
| 608 | 'react-server-dom-turbopack/src/client/react-flight-dom-client.browser', |
| 609 | name: 'react-server-dom-turbopack-client.browser', |
| 610 | global: 'ReactServerDOMClient', |
| 611 | minifyWithProdErrorCodes: true, |
| 612 | wrapWithModuleBoundaries: false, |
| 613 | externals: ['react', 'react-dom'], |
| 614 | }, |
| 615 | { |
| 616 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 617 | moduleType: RENDERER, |
| 618 | entry: 'react-server-dom-turbopack/src/client/react-flight-dom-client.node', |
| 619 | name: 'react-server-dom-turbopack-client.node', |
| 620 | global: 'ReactServerDOMClient', |
| 621 | minifyWithProdErrorCodes: false, |
| 622 | wrapWithModuleBoundaries: false, |
| 623 | externals: ['react', 'react-dom', 'util'], |
| 624 | }, |
| 625 | { |
| 626 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 627 | moduleType: RENDERER, |
| 628 | entry: 'react-server-dom-turbopack/src/client/react-flight-dom-client.edge', |
| 629 | name: 'react-server-dom-turbopack-client.edge', |
| 630 | global: 'ReactServerDOMClient', |
| 631 | minifyWithProdErrorCodes: false, |
| 632 | wrapWithModuleBoundaries: false, |
| 633 | externals: ['react', 'react-dom'], |
| 634 | }, |
| 635 | |
| 636 | /******* React Server DOM Parcel Server *******/ |
| 637 | { |
| 638 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 639 | moduleType: RENDERER, |
| 640 | entry: 'react-server-dom-parcel/src/server/react-flight-dom-server.browser', |
| 641 | name: 'react-server-dom-parcel-server.browser', |
| 642 | condition: 'react-server', |
| 643 | global: 'ReactServerDOMServer', |
| 644 | minifyWithProdErrorCodes: true, |
| 645 | wrapWithModuleBoundaries: false, |
| 646 | externals: ['react', 'react-dom'], |
| 647 | }, |
| 648 | { |
| 649 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 650 | moduleType: RENDERER, |
| 651 | entry: 'react-server-dom-parcel/src/server/react-flight-dom-server.node', |
| 652 | name: 'react-server-dom-parcel-server.node', |
| 653 | condition: 'react-server', |
| 654 | global: 'ReactServerDOMServer', |
| 655 | minifyWithProdErrorCodes: false, |
| 656 | wrapWithModuleBoundaries: false, |
| 657 | externals: [ |
| 658 | 'react', |
| 659 | 'react-dom', |
| 660 | 'async_hooks', |
| 661 | 'crypto', |
| 662 | 'stream', |
| 663 | 'util', |
| 664 | ], |
| 665 | }, |
| 666 | { |
| 667 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 668 | moduleType: RENDERER, |
| 669 | entry: 'react-server-dom-parcel/src/server/react-flight-dom-server.edge', |
| 670 | name: 'react-server-dom-parcel-server.edge', |
| 671 | condition: 'react-server', |
| 672 | global: 'ReactServerDOMServer', |
| 673 | minifyWithProdErrorCodes: false, |
| 674 | wrapWithModuleBoundaries: false, |
| 675 | externals: ['react', 'react-dom'], |
| 676 | }, |
| 677 | |
| 678 | /******* React Server DOM Parcel Client *******/ |
| 679 | { |
| 680 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 681 | moduleType: RENDERER, |
| 682 | entry: 'react-server-dom-parcel/src/client/react-flight-dom-client.browser', |
| 683 | name: 'react-server-dom-parcel-client.browser', |
| 684 | global: 'ReactServerDOMClient', |
| 685 | minifyWithProdErrorCodes: true, |
| 686 | wrapWithModuleBoundaries: false, |
| 687 | externals: ['react', 'react-dom'], |
| 688 | }, |
| 689 | { |
| 690 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 691 | moduleType: RENDERER, |
| 692 | entry: 'react-server-dom-parcel/src/client/react-flight-dom-client.node', |
| 693 | name: 'react-server-dom-parcel-client.node', |
| 694 | global: 'ReactServerDOMClient', |
| 695 | minifyWithProdErrorCodes: false, |
| 696 | wrapWithModuleBoundaries: false, |
| 697 | externals: ['react', 'react-dom', 'util'], |
| 698 | }, |
| 699 | { |
| 700 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 701 | moduleType: RENDERER, |
| 702 | entry: 'react-server-dom-parcel/src/client/react-flight-dom-client.edge', |
| 703 | name: 'react-server-dom-parcel-client.edge', |
| 704 | global: 'ReactServerDOMClient', |
| 705 | minifyWithProdErrorCodes: false, |
| 706 | wrapWithModuleBoundaries: false, |
| 707 | externals: ['react', 'react-dom'], |
| 708 | }, |
| 709 | |
| 710 | /******* React Server DOM ESM Server *******/ |
| 711 | { |
| 712 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 713 | moduleType: RENDERER, |
| 714 | entry: 'react-server-dom-esm/src/server/react-flight-dom-server.node', |
| 715 | name: 'react-server-dom-esm-server.node', |
| 716 | condition: 'react-server', |
| 717 | minifyWithProdErrorCodes: false, |
| 718 | wrapWithModuleBoundaries: false, |
| 719 | externals: [ |
| 720 | 'react', |
| 721 | 'react-dom', |
| 722 | 'async_hooks', |
| 723 | 'crypto', |
| 724 | 'stream', |
| 725 | 'util', |
| 726 | ], |
| 727 | }, |
| 728 | |
| 729 | /******* React Server DOM ESM Client *******/ |
| 730 | { |
| 731 | bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD], |
| 732 | moduleType: RENDERER, |
| 733 | entry: 'react-server-dom-esm/client.browser', |
| 734 | minifyWithProdErrorCodes: true, |
| 735 | wrapWithModuleBoundaries: false, |
| 736 | externals: ['react', 'react-dom'], |
| 737 | }, |
| 738 | { |
| 739 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 740 | moduleType: RENDERER, |
| 741 | entry: 'react-server-dom-esm/client.node', |
| 742 | minifyWithProdErrorCodes: false, |
| 743 | wrapWithModuleBoundaries: false, |
| 744 | externals: ['react', 'react-dom', 'util'], |
| 745 | }, |
| 746 | |
| 747 | /******* React Server DOM ESM Node.js Loader *******/ |
| 748 | { |
| 749 | bundleTypes: [ESM_PROD], |
| 750 | moduleType: RENDERER_UTILS, |
| 751 | entry: 'react-server-dom-esm/node-loader', |
| 752 | condition: 'react-server', |
| 753 | global: 'ReactServerESMNodeLoader', |
| 754 | minifyWithProdErrorCodes: false, |
| 755 | wrapWithModuleBoundaries: false, |
| 756 | externals: ['acorn'], |
| 757 | }, |
| 758 | |
| 759 | /******* React Flight Server FB Server *******/ |
| 760 | { |
| 761 | bundleTypes: [FB_WWW_DEV, FB_WWW_PROD], |
| 762 | moduleType: RENDERER, |
| 763 | entry: 'react-flight-server-fb/src/server/react-flight-dom-server.node', |
| 764 | global: 'ReactFlightServer', |
| 765 | condition: 'react-server', |
| 766 | minifyWithProdErrorCodes: false, |
| 767 | wrapWithModuleBoundaries: false, |
| 768 | externals: ['react', 'react-dom', 'stream'], |
| 769 | }, |
| 770 | |
| 771 | /******* React Flight Client FB *******/ |
| 772 | { |
| 773 | bundleTypes: [FB_WWW_DEV, FB_WWW_PROD], |
| 774 | moduleType: RENDERER, |
| 775 | entry: 'react-flight-server-fb/client.browser', |
| 776 | global: 'ReactFlightClient', |
| 777 | minifyWithProdErrorCodes: false, |
| 778 | wrapWithModuleBoundaries: false, |
| 779 | externals: ['react', 'react-dom'], |
| 780 | }, |
| 781 | |
| 782 | /******* React Server DOM Unbundled Server *******/ |
| 783 | { |
| 784 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 785 | moduleType: RENDERER, |
| 786 | entry: 'react-server-dom-unbundled/src/server/react-flight-dom-server.node', |
| 787 | name: 'react-server-dom-unbundled-server.node', |
| 788 | condition: 'react-server', |
| 789 | global: 'ReactServerDOMServer', |
| 790 | minifyWithProdErrorCodes: false, |
| 791 | wrapWithModuleBoundaries: false, |
| 792 | externals: [ |
| 793 | 'react', |
| 794 | 'react-dom', |
| 795 | 'async_hooks', |
| 796 | 'crypto', |
| 797 | 'stream', |
| 798 | 'util', |
| 799 | ], |
| 800 | }, |
| 801 | |
| 802 | /******* React Server DOM Unbundled Client *******/ |
| 803 | { |
| 804 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 805 | moduleType: RENDERER, |
| 806 | entry: 'react-server-dom-unbundled/src/client/react-flight-dom-client.node', |
| 807 | name: 'react-server-dom-unbundled-client.node', |
| 808 | global: 'ReactServerDOMClient', |
| 809 | minifyWithProdErrorCodes: false, |
| 810 | wrapWithModuleBoundaries: false, |
| 811 | externals: ['react', 'react-dom', 'util', 'crypto'], |
| 812 | }, |
| 813 | |
| 814 | /******* React Server DOM Unbundled Node.js Loader *******/ |
| 815 | { |
| 816 | bundleTypes: [ESM_PROD], |
| 817 | moduleType: RENDERER_UTILS, |
| 818 | entry: 'react-server-dom-unbundled/node-loader', |
| 819 | condition: 'react-server', |
| 820 | global: 'ReactServerUnbundledNodeLoader', |
| 821 | minifyWithProdErrorCodes: false, |
| 822 | wrapWithModuleBoundaries: false, |
| 823 | externals: ['acorn'], |
| 824 | }, |
| 825 | |
| 826 | /******* React Server DOM Unbundled Node.js CommonJS Loader *******/ |
| 827 | { |
| 828 | bundleTypes: [NODE_ES2015], |
| 829 | moduleType: RENDERER_UTILS, |
| 830 | entry: 'react-server-dom-unbundled/src/ReactFlightUnbundledNodeRegister', |
| 831 | name: 'react-server-dom-unbundled-node-register', |
| 832 | condition: 'react-server', |
| 833 | global: 'ReactFlightUnbundledNodeRegister', |
| 834 | minifyWithProdErrorCodes: false, |
| 835 | wrapWithModuleBoundaries: false, |
| 836 | externals: ['url', 'module', 'react-server-dom-unbundled/server'], |
| 837 | }, |
| 838 | |
| 839 | /******* React Suspense Test Utils *******/ |
| 840 | { |
| 841 | bundleTypes: [NODE_ES2015], |
| 842 | moduleType: RENDERER_UTILS, |
| 843 | entry: 'react-suspense-test-utils', |
| 844 | global: 'ReactSuspenseTestUtils', |
| 845 | minifyWithProdErrorCodes: false, |
| 846 | wrapWithModuleBoundaries: false, |
| 847 | externals: ['react'], |
| 848 | }, |
| 849 | |
| 850 | /******* React ART *******/ |
| 851 | { |
| 852 | bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV, FB_WWW_PROD], |
| 853 | moduleType: RENDERER, |
| 854 | entry: 'react-art', |
| 855 | global: 'ReactART', |
| 856 | externals: ['react'], |
| 857 | minifyWithProdErrorCodes: true, |
| 858 | wrapWithModuleBoundaries: true, |
| 859 | babel: opts => |
| 860 | Object.assign({}, opts, { |
| 861 | // Include JSX |
| 862 | presets: opts.presets.concat([ |
| 863 | require.resolve('@babel/preset-react'), |
| 864 | require.resolve('@babel/preset-flow'), |
| 865 | ]), |
| 866 | plugins: opts.plugins.concat([ |
| 867 | [require.resolve('@babel/plugin-transform-classes'), {loose: true}], |
| 868 | ]), |
| 869 | }), |
| 870 | }, |
| 871 | |
| 872 | /******* React Native Fabric *******/ |
| 873 | { |
| 874 | bundleTypes: __EXPERIMENTAL__ |
| 875 | ? [] |
| 876 | : [RN_FB_DEV, RN_FB_PROD, RN_FB_PROFILING], |
| 877 | moduleType: RENDERER, |
| 878 | entry: 'react-native-renderer/fabric', |
| 879 | global: 'ReactFabric', |
| 880 | externals: ['react-native', 'ReactNativeInternalFeatureFlags'], |
| 881 | minifyWithProdErrorCodes: false, |
| 882 | wrapWithModuleBoundaries: true, |
| 883 | babel: opts => |
| 884 | Object.assign({}, opts, { |
| 885 | plugins: opts.plugins.concat([ |
| 886 | [require.resolve('@babel/plugin-transform-classes'), {loose: true}], |
| 887 | ]), |
| 888 | }), |
| 889 | }, |
| 890 | { |
| 891 | bundleTypes: [RN_OSS_DEV, RN_OSS_PROD, RN_OSS_PROFILING], |
| 892 | moduleType: RENDERER, |
| 893 | entry: 'react-native-renderer/fabric', |
| 894 | global: 'ReactFabric', |
| 895 | // ReactNativeInternalFeatureFlags temporary until we land enableRemoveConsolePatches. |
| 896 | // Needs to be done before the next RN OSS release. |
| 897 | externals: ['react-native', 'ReactNativeInternalFeatureFlags'], |
| 898 | minifyWithProdErrorCodes: false, |
| 899 | wrapWithModuleBoundaries: true, |
| 900 | babel: opts => |
| 901 | Object.assign({}, opts, { |
| 902 | plugins: opts.plugins.concat([ |
| 903 | [require.resolve('@babel/plugin-transform-classes'), {loose: true}], |
| 904 | ]), |
| 905 | }), |
| 906 | }, |
| 907 | |
| 908 | /******* React Test Renderer *******/ |
| 909 | { |
| 910 | bundleTypes: [ |
| 911 | FB_WWW_DEV, |
| 912 | NODE_DEV, |
| 913 | NODE_PROD, |
| 914 | RN_FB_DEV, |
| 915 | RN_FB_PROD, |
| 916 | RN_FB_PROFILING, |
| 917 | ], |
| 918 | moduleType: RENDERER, |
| 919 | entry: 'react-test-renderer', |
| 920 | global: 'ReactTestRenderer', |
| 921 | externals: [ |
| 922 | 'react', |
| 923 | 'scheduler', |
| 924 | 'scheduler/unstable_mock', |
| 925 | 'ReactNativeInternalFeatureFlags', |
| 926 | ], |
| 927 | minifyWithProdErrorCodes: false, |
| 928 | wrapWithModuleBoundaries: false, |
| 929 | babel: opts => |
| 930 | Object.assign({}, opts, { |
| 931 | plugins: opts.plugins.concat([ |
| 932 | [require.resolve('@babel/plugin-transform-classes'), {loose: true}], |
| 933 | ]), |
| 934 | }), |
| 935 | }, |
| 936 | |
| 937 | /******* React Noop Renderer (used for tests) *******/ |
| 938 | { |
| 939 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 940 | moduleType: RENDERER, |
| 941 | entry: 'react-noop-renderer', |
| 942 | global: 'ReactNoopRenderer', |
| 943 | minifyWithProdErrorCodes: false, |
| 944 | wrapWithModuleBoundaries: false, |
| 945 | externals: ['react', 'scheduler', 'scheduler/unstable_mock', 'expect'], |
| 946 | }, |
| 947 | |
| 948 | /******* React Noop Persistent Renderer (used for tests) *******/ |
| 949 | { |
| 950 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 951 | moduleType: RENDERER, |
| 952 | entry: 'react-noop-renderer/persistent', |
| 953 | global: 'ReactNoopRendererPersistent', |
| 954 | minifyWithProdErrorCodes: false, |
| 955 | wrapWithModuleBoundaries: false, |
| 956 | externals: ['react', 'scheduler', 'expect'], |
| 957 | }, |
| 958 | |
| 959 | /******* React Noop Server Renderer (used for tests) *******/ |
| 960 | { |
| 961 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 962 | moduleType: RENDERER, |
| 963 | entry: 'react-noop-renderer/server', |
| 964 | global: 'ReactNoopRendererServer', |
| 965 | minifyWithProdErrorCodes: false, |
| 966 | wrapWithModuleBoundaries: false, |
| 967 | externals: ['react', 'scheduler', 'expect'], |
| 968 | }, |
| 969 | |
| 970 | /******* React Noop Flight Server (used for tests) *******/ |
| 971 | { |
| 972 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 973 | moduleType: RENDERER, |
| 974 | entry: 'react-noop-renderer/flight-server', |
| 975 | condition: 'react-server', |
| 976 | global: 'ReactNoopFlightServer', |
| 977 | minifyWithProdErrorCodes: false, |
| 978 | wrapWithModuleBoundaries: false, |
| 979 | externals: [ |
| 980 | 'react', |
| 981 | 'scheduler', |
| 982 | 'expect', |
| 983 | 'react-noop-renderer/flight-modules', |
| 984 | ], |
| 985 | }, |
| 986 | |
| 987 | /******* React Noop Flight Client (used for tests) *******/ |
| 988 | { |
| 989 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 990 | moduleType: RENDERER, |
| 991 | entry: 'react-noop-renderer/flight-client', |
| 992 | global: 'ReactNoopFlightClient', |
| 993 | minifyWithProdErrorCodes: false, |
| 994 | wrapWithModuleBoundaries: false, |
| 995 | externals: [ |
| 996 | 'react', |
| 997 | 'scheduler', |
| 998 | 'expect', |
| 999 | 'react-noop-renderer/flight-modules', |
| 1000 | ], |
| 1001 | }, |
| 1002 | |
| 1003 | /******* React Reconciler *******/ |
| 1004 | { |
| 1005 | bundleTypes: [NODE_DEV, NODE_PROD, NODE_PROFILING, FB_WWW_DEV, FB_WWW_PROD], |
| 1006 | moduleType: RECONCILER, |
| 1007 | entry: 'react-reconciler', |
| 1008 | global: 'ReactReconciler', |
| 1009 | minifyWithProdErrorCodes: true, |
| 1010 | wrapWithModuleBoundaries: false, |
| 1011 | externals: ['react'], |
| 1012 | }, |
| 1013 | |
| 1014 | /******* React Server *******/ |
| 1015 | { |
| 1016 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1017 | moduleType: RECONCILER, |
| 1018 | entry: 'react-server', |
| 1019 | global: 'ReactServer', |
| 1020 | minifyWithProdErrorCodes: false, |
| 1021 | wrapWithModuleBoundaries: false, |
| 1022 | externals: ['react'], |
| 1023 | }, |
| 1024 | |
| 1025 | /******* React Flight Server *******/ |
| 1026 | { |
| 1027 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1028 | moduleType: RECONCILER, |
| 1029 | entry: 'react-server/flight', |
| 1030 | condition: 'react-server', |
| 1031 | global: 'ReactFlightServer', |
| 1032 | minifyWithProdErrorCodes: false, |
| 1033 | wrapWithModuleBoundaries: false, |
| 1034 | externals: ['react'], |
| 1035 | }, |
| 1036 | |
| 1037 | /******* React Flight Client *******/ |
| 1038 | { |
| 1039 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1040 | moduleType: RECONCILER, |
| 1041 | entry: 'react-client/flight', |
| 1042 | global: 'ReactFlightClient', |
| 1043 | minifyWithProdErrorCodes: true, |
| 1044 | wrapWithModuleBoundaries: false, |
| 1045 | externals: ['react'], |
| 1046 | }, |
| 1047 | |
| 1048 | /******* Reconciler Reflection *******/ |
| 1049 | { |
| 1050 | moduleType: RENDERER_UTILS, |
| 1051 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1052 | entry: 'react-reconciler/reflection', |
| 1053 | global: 'ReactFiberTreeReflection', |
| 1054 | minifyWithProdErrorCodes: true, |
| 1055 | wrapWithModuleBoundaries: false, |
| 1056 | externals: [], |
| 1057 | }, |
| 1058 | |
| 1059 | /******* Reconciler Constants *******/ |
| 1060 | { |
| 1061 | moduleType: RENDERER_UTILS, |
| 1062 | bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV, FB_WWW_PROD], |
| 1063 | entry: 'react-reconciler/constants', |
| 1064 | global: 'ReactReconcilerConstants', |
| 1065 | minifyWithProdErrorCodes: true, |
| 1066 | wrapWithModuleBoundaries: false, |
| 1067 | externals: [], |
| 1068 | }, |
| 1069 | |
| 1070 | /******* React Is *******/ |
| 1071 | { |
| 1072 | bundleTypes: [ |
| 1073 | NODE_DEV, |
| 1074 | NODE_PROD, |
| 1075 | FB_WWW_DEV, |
| 1076 | FB_WWW_PROD, |
| 1077 | RN_FB_DEV, |
| 1078 | RN_FB_PROD, |
| 1079 | RN_FB_PROFILING, |
| 1080 | ], |
| 1081 | moduleType: ISOMORPHIC, |
| 1082 | entry: 'react-is', |
| 1083 | global: 'ReactIs', |
| 1084 | minifyWithProdErrorCodes: true, |
| 1085 | wrapWithModuleBoundaries: false, |
| 1086 | externals: ['ReactNativeInternalFeatureFlags'], |
| 1087 | }, |
| 1088 | |
| 1089 | /******* React Debug Tools *******/ |
| 1090 | { |
| 1091 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1092 | moduleType: ISOMORPHIC, |
| 1093 | entry: 'react-debug-tools', |
| 1094 | global: 'ReactDebugTools', |
| 1095 | minifyWithProdErrorCodes: false, |
| 1096 | wrapWithModuleBoundaries: false, |
| 1097 | externals: [], |
| 1098 | }, |
| 1099 | |
| 1100 | /******* React Cache (experimental, old) *******/ |
| 1101 | { |
| 1102 | bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV, FB_WWW_PROD], |
| 1103 | moduleType: ISOMORPHIC, |
| 1104 | entry: 'react-cache', |
| 1105 | global: 'ReactCacheOld', |
| 1106 | minifyWithProdErrorCodes: false, |
| 1107 | wrapWithModuleBoundaries: false, |
| 1108 | externals: ['react', 'scheduler'], |
| 1109 | }, |
| 1110 | |
| 1111 | /******* Hook for managing subscriptions safely *******/ |
| 1112 | { |
| 1113 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1114 | moduleType: ISOMORPHIC, |
| 1115 | entry: 'use-subscription', |
| 1116 | global: 'useSubscription', |
| 1117 | minifyWithProdErrorCodes: true, |
| 1118 | wrapWithModuleBoundaries: true, |
| 1119 | externals: ['react'], |
| 1120 | }, |
| 1121 | |
| 1122 | /******* useSyncExternalStore *******/ |
| 1123 | { |
| 1124 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1125 | moduleType: ISOMORPHIC, |
| 1126 | entry: 'use-sync-external-store', |
| 1127 | global: 'useSyncExternalStore', |
| 1128 | minifyWithProdErrorCodes: true, |
| 1129 | wrapWithModuleBoundaries: true, |
| 1130 | externals: ['react'], |
| 1131 | }, |
| 1132 | |
| 1133 | /******* useSyncExternalStore (shim) *******/ |
| 1134 | { |
| 1135 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1136 | moduleType: ISOMORPHIC, |
| 1137 | entry: 'use-sync-external-store/shim', |
| 1138 | global: 'useSyncExternalStore', |
| 1139 | minifyWithProdErrorCodes: false, |
| 1140 | wrapWithModuleBoundaries: true, |
| 1141 | externals: ['react'], |
| 1142 | }, |
| 1143 | |
| 1144 | /******* useSyncExternalStore (shim, native) *******/ |
| 1145 | { |
| 1146 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1147 | moduleType: ISOMORPHIC, |
| 1148 | entry: 'use-sync-external-store/shim/index.native', |
| 1149 | global: 'useSyncExternalStore', |
| 1150 | minifyWithProdErrorCodes: false, |
| 1151 | wrapWithModuleBoundaries: true, |
| 1152 | externals: ['react'], |
| 1153 | }, |
| 1154 | |
| 1155 | /******* useSyncExternalStoreWithSelector *******/ |
| 1156 | { |
| 1157 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1158 | moduleType: ISOMORPHIC, |
| 1159 | entry: 'use-sync-external-store/with-selector', |
| 1160 | global: 'useSyncExternalStoreWithSelector', |
| 1161 | minifyWithProdErrorCodes: false, |
| 1162 | wrapWithModuleBoundaries: true, |
| 1163 | externals: ['react'], |
| 1164 | }, |
| 1165 | |
| 1166 | /******* useSyncExternalStoreWithSelector (shim) *******/ |
| 1167 | { |
| 1168 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1169 | moduleType: ISOMORPHIC, |
| 1170 | entry: 'use-sync-external-store/shim/with-selector', |
| 1171 | global: 'useSyncExternalStoreWithSelector', |
| 1172 | minifyWithProdErrorCodes: false, |
| 1173 | wrapWithModuleBoundaries: true, |
| 1174 | externals: ['react', 'use-sync-external-store/shim'], |
| 1175 | }, |
| 1176 | |
| 1177 | /******* React Scheduler (experimental) *******/ |
| 1178 | { |
| 1179 | bundleTypes: [ |
| 1180 | NODE_DEV, |
| 1181 | NODE_PROD, |
| 1182 | FB_WWW_DEV, |
| 1183 | FB_WWW_PROD, |
| 1184 | FB_WWW_PROFILING, |
| 1185 | RN_FB_DEV, |
| 1186 | RN_FB_PROD, |
| 1187 | RN_FB_PROFILING, |
| 1188 | ], |
| 1189 | moduleType: ISOMORPHIC, |
| 1190 | entry: 'scheduler', |
| 1191 | global: 'Scheduler', |
| 1192 | minifyWithProdErrorCodes: true, |
| 1193 | wrapWithModuleBoundaries: true, |
| 1194 | externals: ['ReactNativeInternalFeatureFlags'], |
| 1195 | }, |
| 1196 | |
| 1197 | /******* React Scheduler Mock (experimental) *******/ |
| 1198 | { |
| 1199 | bundleTypes: [ |
| 1200 | NODE_DEV, |
| 1201 | NODE_PROD, |
| 1202 | FB_WWW_DEV, |
| 1203 | FB_WWW_PROD, |
| 1204 | RN_FB_DEV, |
| 1205 | RN_FB_PROD, |
| 1206 | ], |
| 1207 | moduleType: ISOMORPHIC, |
| 1208 | entry: 'scheduler/unstable_mock', |
| 1209 | global: 'SchedulerMock', |
| 1210 | minifyWithProdErrorCodes: false, |
| 1211 | wrapWithModuleBoundaries: false, |
| 1212 | externals: ['ReactNativeInternalFeatureFlags'], |
| 1213 | }, |
| 1214 | |
| 1215 | /******* React Scheduler Native *******/ |
| 1216 | { |
| 1217 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1218 | moduleType: ISOMORPHIC, |
| 1219 | entry: 'scheduler/index.native', |
| 1220 | global: 'SchedulerNative', |
| 1221 | minifyWithProdErrorCodes: false, |
| 1222 | wrapWithModuleBoundaries: false, |
| 1223 | externals: ['ReactNativeInternalFeatureFlags'], |
| 1224 | }, |
| 1225 | |
| 1226 | /******* React Scheduler Post Task (experimental) *******/ |
| 1227 | { |
| 1228 | bundleTypes: [ |
| 1229 | NODE_DEV, |
| 1230 | NODE_PROD, |
| 1231 | FB_WWW_DEV, |
| 1232 | FB_WWW_PROD, |
| 1233 | FB_WWW_PROFILING, |
| 1234 | ], |
| 1235 | moduleType: ISOMORPHIC, |
| 1236 | entry: 'scheduler/unstable_post_task', |
| 1237 | global: 'SchedulerPostTask', |
| 1238 | minifyWithProdErrorCodes: true, |
| 1239 | wrapWithModuleBoundaries: false, |
| 1240 | externals: [], |
| 1241 | }, |
| 1242 | |
| 1243 | /******* Jest React (experimental) *******/ |
| 1244 | { |
| 1245 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1246 | moduleType: ISOMORPHIC, |
| 1247 | entry: 'jest-react', |
| 1248 | global: 'JestReact', |
| 1249 | minifyWithProdErrorCodes: false, |
| 1250 | wrapWithModuleBoundaries: false, |
| 1251 | externals: ['react', 'scheduler', 'scheduler/unstable_mock'], |
| 1252 | }, |
| 1253 | |
| 1254 | /******* ESLint Plugin for Hooks *******/ |
| 1255 | { |
| 1256 | // TODO: we're building this from typescript source now, but there's really |
| 1257 | // no reason to have both dev and prod for this package. It's |
| 1258 | // currently required in order for the package to be copied over correctly. |
| 1259 | // So, it would be worth improving that flow. |
| 1260 | name: 'eslint-plugin-react-hooks', |
| 1261 | bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV, CJS_DTS], |
| 1262 | moduleType: ISOMORPHIC, |
| 1263 | entry: 'eslint-plugin-react-hooks/src/index.ts', |
| 1264 | global: 'ESLintPluginReactHooks', |
| 1265 | minifyWithProdErrorCodes: false, |
| 1266 | wrapWithModuleBoundaries: false, |
| 1267 | // This is a Node.js build tool (ESLint plugin), not a www runtime bundle. |
| 1268 | // Use process.env.NODE_ENV guard instead of __DEV__ for the dev wrapper. |
| 1269 | wrapWithNodeDevGuard: true, |
| 1270 | preferBuiltins: true, |
| 1271 | externals: [ |
| 1272 | '@babel/core', |
| 1273 | 'hermes-parser', |
| 1274 | 'zod', |
| 1275 | 'zod/v4', |
| 1276 | 'zod-validation-error', |
| 1277 | 'zod-validation-error/v4', |
| 1278 | 'crypto', |
| 1279 | 'util', |
| 1280 | ], |
| 1281 | tsconfig: './packages/eslint-plugin-react-hooks/tsconfig.json', |
| 1282 | prebuild: `mkdir -p ./compiler/packages/babel-plugin-react-compiler/dist && echo "module.exports = require('../src/index.ts');" > ./compiler/packages/babel-plugin-react-compiler/dist/index.js`, |
| 1283 | }, |
| 1284 | |
| 1285 | /******* React Fresh *******/ |
| 1286 | { |
| 1287 | bundleTypes: [NODE_DEV, NODE_PROD], |
| 1288 | moduleType: ISOMORPHIC, |
| 1289 | entry: 'react-refresh/babel', |
| 1290 | global: 'ReactFreshBabelPlugin', |
| 1291 | minifyWithProdErrorCodes: false, |
| 1292 | wrapWithModuleBoundaries: false, |
| 1293 | externals: [], |
| 1294 | }, |
| 1295 | { |
| 1296 | bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV], |
| 1297 | moduleType: ISOMORPHIC, |
| 1298 | entry: 'react-refresh/runtime', |
| 1299 | global: 'ReactFreshRuntime', |
| 1300 | minifyWithProdErrorCodes: false, |
| 1301 | wrapWithModuleBoundaries: false, |
| 1302 | externals: [], |
| 1303 | }, |
| 1304 | ]; |
| 1305 | |
| 1306 | // Based on deep-freeze by substack (public domain) |
| 1307 | function deepFreeze(o) { |
| 1308 | Object.freeze(o); |
| 1309 | Object.getOwnPropertyNames(o).forEach(function (prop) { |
| 1310 | if ( |
| 1311 | o[prop] !== null && |
| 1312 | (typeof o[prop] === 'object' || typeof o[prop] === 'function') && |
| 1313 | !Object.isFrozen(o[prop]) |
| 1314 | ) { |
| 1315 | deepFreeze(o[prop]); |
| 1316 | } |
| 1317 | }); |
| 1318 | return o; |
| 1319 | } |
| 1320 | |
| 1321 | // Don't accidentally mutate config as part of the build |
| 1322 | deepFreeze(bundles); |
| 1323 | deepFreeze(bundleTypes); |
| 1324 | deepFreeze(moduleTypes); |
| 1325 | |
| 1326 | function getFilename(bundle, bundleType) { |
| 1327 | let name = bundle.name || bundle.entry; |
| 1328 | const globalName = bundle.global; |
| 1329 | // we do this to replace / to -, for react-dom/server |
| 1330 | name = name.replace('/index.', '.').replace('/', '-'); |
| 1331 | switch (bundleType) { |
| 1332 | case NODE_ES2015: |
| 1333 | return `${name}.js`; |
| 1334 | case BUN_DEV: |
| 1335 | return `${name}.development.js`; |
| 1336 | case BUN_PROD: |
| 1337 | return `${name}.production.js`; |
| 1338 | case ESM_DEV: |
| 1339 | return `${name}.development.js`; |
| 1340 | case ESM_PROD: |
| 1341 | return `${name}.production.js`; |
| 1342 | case NODE_DEV: |
| 1343 | return `${name}.development.js`; |
| 1344 | case NODE_PROD: |
| 1345 | return `${name}.production.js`; |
| 1346 | case NODE_PROFILING: |
| 1347 | return `${name}.profiling.js`; |
| 1348 | case FB_WWW_DEV: |
| 1349 | case RN_OSS_DEV: |
| 1350 | case RN_FB_DEV: |
| 1351 | return `${globalName}-dev.js`; |
| 1352 | case FB_WWW_PROD: |
| 1353 | case RN_OSS_PROD: |
| 1354 | case RN_FB_PROD: |
| 1355 | return `${globalName}-prod.js`; |
| 1356 | case FB_WWW_PROFILING: |
| 1357 | case RN_FB_PROFILING: |
| 1358 | case RN_OSS_PROFILING: |
| 1359 | return `${globalName}-profiling.js`; |
| 1360 | case BROWSER_SCRIPT: |
| 1361 | return `${name}.js`; |
| 1362 | case CJS_DTS: |
| 1363 | case ESM_DTS: |
| 1364 | return `${name}.d.ts`; |
| 1365 | } |
| 1366 | } |
| 1367 | |
| 1368 | let activeBundles = bundles; |
| 1369 | if (process.env.BUNDLES_FILTER != null) { |
| 1370 | activeBundles = activeBundles.filter( |
| 1371 | bundle => bundle.name === process.env.BUNDLES_FILTER |
| 1372 | ); |
| 1373 | if (activeBundles.length === 0) { |
| 1374 | throw new Error( |
| 1375 | `No bundles matched for BUNDLES_FILTER=${process.env.BUNDLES_FILTER}` |
| 1376 | ); |
| 1377 | } |
| 1378 | } |
| 1379 | |
| 1380 | module.exports = { |
| 1381 | bundleTypes, |
| 1382 | moduleTypes, |
| 1383 | bundles: activeBundles, |
| 1384 | getFilename, |
| 1385 | }; |