-
Notifications
You must be signed in to change notification settings - Fork 47k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOM] Shrink ReactDOMSharedInternals source representation (#28771)
Stacked on #28751 ReactDOMSharedInternals uses properties of considerable length to model mutuable state. These properties are not mangled during minification and contribute a not insigificant amount to the uncompressed bundle size and to a lesser degree compressed bundle size. This change rewrites the DOMInternals in a way that shortens property names so we can have smaller builds. It also treats the entire object as a mutable container rather than having different mutable sub objects. The same treatment should be given to ReactSharedInternals
- Loading branch information
1 parent
ac06c69
commit e14ad04
Showing
15 changed files
with
357 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
import type {EventPriority} from 'react-reconciler/src/ReactEventPriorities'; | ||
import type {HostDispatcher} from './shared/ReactDOMTypes'; | ||
|
||
import {NoEventPriority} from 'react-reconciler/src/ReactEventPriorities'; | ||
|
||
type ReactDOMInternals = { | ||
Events: [any, any, any, any, any, any], | ||
d /* ReactDOMCurrentDispatcher */: HostDispatcher, | ||
p /* currentUpdatePriority */: EventPriority, | ||
findDOMNode: | ||
| null | ||
| (( | ||
componentOrElement: React$Component<any, any>, | ||
) => null | Element | Text), | ||
}; | ||
|
||
function noop() {} | ||
|
||
const DefaultDispatcher: HostDispatcher = { | ||
flushSyncWork: noop, | ||
prefetchDNS: noop, | ||
preconnect: noop, | ||
preload: noop, | ||
preloadModule: noop, | ||
preinitScript: noop, | ||
preinitStyle: noop, | ||
preinitModuleScript: noop, | ||
}; | ||
|
||
const Internals: ReactDOMInternals = { | ||
Events: (null: any), | ||
d /* ReactDOMCurrentDispatcher */: DefaultDispatcher, | ||
p /* currentUpdatePriority */: NoEventPriority, | ||
findDOMNode: null, | ||
}; | ||
|
||
export default Internals; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.