diff --git a/scripts/rollup/bundles.js b/scripts/rollup/bundles.js index 16bd645e7684b..ccd143ec410df 100644 --- a/scripts/rollup/bundles.js +++ b/scripts/rollup/bundles.js @@ -18,40 +18,44 @@ const bundleTypes = { RN_FB_PROFILING: 'RN_FB_PROFILING', }; -const UMD_DEV = bundleTypes.UMD_DEV; -const UMD_PROD = bundleTypes.UMD_PROD; -const UMD_PROFILING = bundleTypes.UMD_PROFILING; -const NODE_DEV = bundleTypes.NODE_DEV; -const NODE_PROD = bundleTypes.NODE_PROD; -const NODE_PROFILING = bundleTypes.NODE_PROFILING; -const FB_WWW_DEV = bundleTypes.FB_WWW_DEV; -const FB_WWW_PROD = bundleTypes.FB_WWW_PROD; -const FB_WWW_PROFILING = bundleTypes.FB_WWW_PROFILING; -const RN_OSS_DEV = bundleTypes.RN_OSS_DEV; -const RN_OSS_PROD = bundleTypes.RN_OSS_PROD; -const RN_OSS_PROFILING = bundleTypes.RN_OSS_PROFILING; -const RN_FB_DEV = bundleTypes.RN_FB_DEV; -const RN_FB_PROD = bundleTypes.RN_FB_PROD; -const RN_FB_PROFILING = bundleTypes.RN_FB_PROFILING; +const { + UMD_DEV, + UMD_PROD, + UMD_PROFILING, + NODE_DEV, + NODE_PROD, + NODE_PROFILING, + FB_WWW_DEV, + FB_WWW_PROD, + FB_WWW_PROFILING, + RN_OSS_DEV, + RN_OSS_PROD, + RN_OSS_PROFILING, + RN_FB_DEV, + RN_FB_PROD, + RN_FB_PROFILING, +} = bundleTypes; const moduleTypes = { + // React ISOMORPHIC: 'ISOMORPHIC', + // Individual renderers. They bundle the reconciler. (e.g. ReactDOM) RENDERER: 'RENDERER', + // Helper packages that access specific renderer's internals. (e.g. TestUtils) RENDERER_UTILS: 'RENDERER_UTILS', + // Standalone reconciler for third-party renderers. RECONCILER: 'RECONCILER', + // Non-Fiber implementations like SSR and Shallow renderers. NON_FIBER_RENDERER: 'NON_FIBER_RENDERER', }; -// React -const ISOMORPHIC = moduleTypes.ISOMORPHIC; -// Individual renderers. They bundle the reconciler. (e.g. ReactDOM) -const RENDERER = moduleTypes.RENDERER; -// Helper packages that access specific renderer's internals. (e.g. TestUtils) -const RENDERER_UTILS = moduleTypes.RENDERER_UTILS; -// Standalone reconciler for third-party renderers. -const RECONCILER = moduleTypes.RECONCILER; -// Non-Fiber implementations like SSR and Shallow renderers. -const NON_FIBER_RENDERER = moduleTypes.NON_FIBER_RENDERER; +const { + ISOMORPHIC, + RENDERER, + RENDERER_UTILS, + RECONCILER, + NON_FIBER_RENDERER, +} = moduleTypes; const bundles = [ /******* Isomorphic *******/ @@ -150,7 +154,6 @@ const bundles = [ global: 'ReactDOMServer', externals: ['react'], }, - { bundleTypes: [NODE_DEV, NODE_PROD], moduleType: NON_FIBER_RENDERER, @@ -214,7 +217,6 @@ const bundles = [ 'ReactNativeViewConfigRegistry', ], }, - { bundleTypes: [RN_OSS_DEV, RN_OSS_PROD, RN_OSS_PROFILING], moduleType: RENDERER, @@ -254,7 +256,6 @@ const bundles = [ 'ReactNativeViewConfigRegistry', ], }, - { bundleTypes: [RN_OSS_DEV, RN_OSS_PROD, RN_OSS_PROFILING], moduleType: RENDERER, @@ -283,7 +284,6 @@ const bundles = [ global: 'ReactTestRenderer', externals: ['react', 'scheduler', 'scheduler/unstable_mock'], }, - { bundleTypes: [FB_WWW_DEV, NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD], moduleType: NON_FIBER_RENDERER, @@ -434,19 +434,16 @@ const bundles = [ /******* ESLint Plugin for Hooks (proposal) *******/ { - // TODO: it's awkward to create a bundle for this - // but if we don't, the package won't get copied. - // We also can't create just DEV bundle because - // it contains a NODE_ENV check inside. - // We should probably tweak our build process - // to allow "raw" packages that don't get bundled. + // TODO: it's awkward to create a bundle for this but if we don't, the package + // won't get copied. We also can't create just DEV bundle because it contains a + // NODE_ENV check inside. We should probably tweak our build process to allow + // "raw" packages that don't get bundled. bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV], moduleType: ISOMORPHIC, entry: 'eslint-plugin-react-hooks', global: 'ESLintPluginReactHooks', externals: [], }, - { bundleTypes: [ FB_WWW_DEV, @@ -480,6 +477,8 @@ function deepFreeze(o) { // Don't accidentally mutate config as part of the build deepFreeze(bundles); +deepFreeze(bundleTypes); +deepFreeze(moduleTypes); module.exports = { bundleTypes,