Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor code structure adjustments to the bundles.js file #15079

Merged
merged 5 commits into from
Apr 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 35 additions & 36 deletions scripts/rollup/bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 *******/
Expand Down Expand Up @@ -150,7 +154,6 @@ const bundles = [
global: 'ReactDOMServer',
externals: ['react'],
},

{
bundleTypes: [NODE_DEV, NODE_PROD],
moduleType: NON_FIBER_RENDERER,
Expand Down Expand Up @@ -214,7 +217,6 @@ const bundles = [
'ReactNativeViewConfigRegistry',
],
},

{
bundleTypes: [RN_OSS_DEV, RN_OSS_PROD, RN_OSS_PROFILING],
moduleType: RENDERER,
Expand Down Expand Up @@ -254,7 +256,6 @@ const bundles = [
'ReactNativeViewConfigRegistry',
],
},

{
bundleTypes: [RN_OSS_DEV, RN_OSS_PROD, RN_OSS_PROFILING],
moduleType: RENDERER,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -434,19 +434,16 @@ const bundles = [

/******* ESLint Plugin for Hooks (proposal) *******/
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason for this change? looks like it was intended to fit under the
/******* ESLint Plugin for Hooks (proposal) *******/ title

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not from me.
I executed yarn prettier as peer pull request guidance and prettier decided to do that.

// 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,
Expand Down Expand Up @@ -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,
Expand Down