Skip to content

Instantly share code, notes, and snippets.

@teabyii
Last active October 14, 2015 09:43
Show Gist options
  • Save teabyii/ca61839c9331f8bab511 to your computer and use it in GitHub Desktop.
Save teabyii/ca61839c9331f8bab511 to your computer and use it in GitHub Desktop.
react source code module-path mapping
{
"React": "src/React.js",
"ReactVersion": "src/ReactVersion.js",
"ReactComponentWithPureRenderMixin": "src/addons/ReactComponentWithPureRenderMixin.js",
"ReactFragment": "src/addons/ReactFragment.js",
"ReactWithAddons": "src/addons/ReactWithAddons.js",
"LinkedStateMixin": "src/addons/link/LinkedStateMixin.js",
"ReactLink": "src/addons/link/ReactLink.js",
"renderSubtreeIntoContainer": "src/addons/renderSubtreeIntoContainer.js",
"shallowCompare": "src/addons/shallowCompare.js",
"ReactCSSTransitionGroup": "src/addons/transitions/ReactCSSTransitionGroup.js",
"ReactCSSTransitionGroupChild": "src/addons/transitions/ReactCSSTransitionGroupChild.js",
"ReactTransitionChildMapping": "src/addons/transitions/ReactTransitionChildMapping.js",
"ReactTransitionEvents": "src/addons/transitions/ReactTransitionEvents.js",
"ReactTransitionGroup": "src/addons/transitions/ReactTransitionGroup.js",
"update": "src/addons/update.js",
"ReactIsomorphic": "src/isomorphic/ReactIsomorphic.js",
"ReactChildren": "src/isomorphic/children/ReactChildren.js",
"onlyChild": "src/isomorphic/children/onlyChild.js",
"sliceChildren": "src/isomorphic/children/sliceChildren.js",
"ReactClass": "src/isomorphic/classic/class/ReactClass.js",
"ReactCurrentOwner": "src/isomorphic/classic/element/ReactCurrentOwner.js",
"ReactDOMFactories": "src/isomorphic/classic/element/ReactDOMFactories.js",
"ReactElement": "src/isomorphic/classic/element/ReactElement.js",
"ReactElementValidator": "src/isomorphic/classic/element/ReactElementValidator.js",
"ReactPropTypeLocationNames": "src/isomorphic/classic/types/ReactPropTypeLocationNames.js",
"ReactPropTypeLocations": "src/isomorphic/classic/types/ReactPropTypeLocations.js",
"ReactPropTypes": "src/isomorphic/classic/types/ReactPropTypes.js",
"OrderedMap": "src/isomorphic/deprecated/OrderedMap.js",
"ReactPropTransferer": "src/isomorphic/deprecated/ReactPropTransferer.js",
"cloneWithProps": "src/isomorphic/deprecated/cloneWithProps.js",
"ReactComponent": "src/isomorphic/modern/class/ReactComponent.js",
"ReactNoopUpdateQueue": "src/isomorphic/modern/class/ReactNoopUpdateQueue.js",
"ReactDOM": "src/renderers/dom/ReactDOM.js",
"ReactDOMServer": "src/renderers/dom/ReactDOMServer.js",
"ClientReactRootIndex": "src/renderers/dom/client/ClientReactRootIndex.js",
"ReactBrowserEventEmitter": "src/renderers/dom/client/ReactBrowserEventEmitter.js",
"ReactDOMIDOperations": "src/renderers/dom/client/ReactDOMIDOperations.js",
"ReactDOMSelection": "src/renderers/dom/client/ReactDOMSelection.js",
"ReactEventListener": "src/renderers/dom/client/ReactEventListener.js",
"ReactInputSelection": "src/renderers/dom/client/ReactInputSelection.js",
"ReactMount": "src/renderers/dom/client/ReactMount.js",
"ReactReconcileTransaction": "src/renderers/dom/client/ReactReconcileTransaction.js",
"BeforeInputEventPlugin": "src/renderers/dom/client/eventPlugins/BeforeInputEventPlugin.js",
"ChangeEventPlugin": "src/renderers/dom/client/eventPlugins/ChangeEventPlugin.js",
"DefaultEventPluginOrder": "src/renderers/dom/client/eventPlugins/DefaultEventPluginOrder.js",
"EnterLeaveEventPlugin": "src/renderers/dom/client/eventPlugins/EnterLeaveEventPlugin.js",
"FallbackCompositionState": "src/renderers/dom/client/eventPlugins/FallbackCompositionState.js",
"SelectEventPlugin": "src/renderers/dom/client/eventPlugins/SelectEventPlugin.js",
"SimpleEventPlugin": "src/renderers/dom/client/eventPlugins/SimpleEventPlugin.js",
"TapEventPlugin": "src/renderers/dom/client/eventPlugins/TapEventPlugin.js",
"findDOMNode": "src/renderers/dom/client/findDOMNode.js",
"SyntheticClipboardEvent": "src/renderers/dom/client/syntheticEvents/SyntheticClipboardEvent.js",
"SyntheticCompositionEvent": "src/renderers/dom/client/syntheticEvents/SyntheticCompositionEvent.js",
"SyntheticDragEvent": "src/renderers/dom/client/syntheticEvents/SyntheticDragEvent.js",
"SyntheticEvent": "src/renderers/dom/client/syntheticEvents/SyntheticEvent.js",
"SyntheticFocusEvent": "src/renderers/dom/client/syntheticEvents/SyntheticFocusEvent.js",
"SyntheticInputEvent": "src/renderers/dom/client/syntheticEvents/SyntheticInputEvent.js",
"SyntheticKeyboardEvent": "src/renderers/dom/client/syntheticEvents/SyntheticKeyboardEvent.js",
"SyntheticMouseEvent": "src/renderers/dom/client/syntheticEvents/SyntheticMouseEvent.js",
"SyntheticTouchEvent": "src/renderers/dom/client/syntheticEvents/SyntheticTouchEvent.js",
"SyntheticUIEvent": "src/renderers/dom/client/syntheticEvents/SyntheticUIEvent.js",
"SyntheticWheelEvent": "src/renderers/dom/client/syntheticEvents/SyntheticWheelEvent.js",
"DOMChildrenOperations": "src/renderers/dom/client/utils/DOMChildrenOperations.js",
"ViewportMetrics": "src/renderers/dom/client/utils/ViewportMetrics.js",
"getEventCharCode": "src/renderers/dom/client/utils/getEventCharCode.js",
"getEventKey": "src/renderers/dom/client/utils/getEventKey.js",
"getEventModifierState": "src/renderers/dom/client/utils/getEventModifierState.js",
"getEventTarget": "src/renderers/dom/client/utils/getEventTarget.js",
"getNodeForCharacterOffset": "src/renderers/dom/client/utils/getNodeForCharacterOffset.js",
"getTextContentAccessor": "src/renderers/dom/client/utils/getTextContentAccessor.js",
"isEventSupported": "src/renderers/dom/client/utils/isEventSupported.js",
"setInnerHTML": "src/renderers/dom/client/utils/setInnerHTML.js",
"setTextContent": "src/renderers/dom/client/utils/setTextContent.js",
"validateDOMNesting": "src/renderers/dom/client/validateDOMNesting.js",
"AutoFocusUtils": "src/renderers/dom/client/wrappers/AutoFocusUtils.js",
"LinkedValueUtils": "src/renderers/dom/client/wrappers/LinkedValueUtils.js",
"ReactDOMButton": "src/renderers/dom/client/wrappers/ReactDOMButton.js",
"ReactDOMInput": "src/renderers/dom/client/wrappers/ReactDOMInput.js",
"ReactDOMOption": "src/renderers/dom/client/wrappers/ReactDOMOption.js",
"ReactDOMSelect": "src/renderers/dom/client/wrappers/ReactDOMSelect.js",
"ReactDOMTextarea": "src/renderers/dom/client/wrappers/ReactDOMTextarea.js",
"ReactMarkupChecksum": "src/renderers/dom/server/ReactMarkupChecksum.js",
"ReactServerBatchingStrategy": "src/renderers/dom/server/ReactServerBatchingStrategy.js",
"ReactServerRendering": "src/renderers/dom/server/ReactServerRendering.js",
"ReactServerRenderingTransaction": "src/renderers/dom/server/ReactServerRenderingTransaction.js",
"ServerReactRootIndex": "src/renderers/dom/server/ServerReactRootIndex.js",
"CSSProperty": "src/renderers/dom/shared/CSSProperty.js",
"CSSPropertyOperations": "src/renderers/dom/shared/CSSPropertyOperations.js",
"DOMNamespaces": "src/renderers/dom/shared/DOMNamespaces.js",
"DOMProperty": "src/renderers/dom/shared/DOMProperty.js",
"DOMPropertyOperations": "src/renderers/dom/shared/DOMPropertyOperations.js",
"Danger": "src/renderers/dom/shared/Danger.js",
"HTMLDOMPropertyConfig": "src/renderers/dom/shared/HTMLDOMPropertyConfig.js",
"ReactBrowserComponentMixin": "src/renderers/dom/shared/ReactBrowserComponentMixin.js",
"ReactComponentBrowserEnvironment": "src/renderers/dom/shared/ReactComponentBrowserEnvironment.js",
"ReactDOMComponent": "src/renderers/dom/shared/ReactDOMComponent.js",
"ReactDOMContainerInfo": "src/renderers/dom/shared/ReactDOMContainerInfo.js",
"ReactDOMFeatureFlags": "src/renderers/dom/shared/ReactDOMFeatureFlags.js",
"ReactDOMTextComponent": "src/renderers/dom/shared/ReactDOMTextComponent.js",
"ReactDefaultInjection": "src/renderers/dom/shared/ReactDefaultInjection.js",
"ReactInjection": "src/renderers/dom/shared/ReactInjection.js",
"SVGDOMPropertyConfig": "src/renderers/dom/shared/SVGDOMPropertyConfig.js",
"dangerousStyleValue": "src/renderers/dom/shared/dangerousStyleValue.js",
"escapeTextContentForBrowser": "src/renderers/dom/shared/escapeTextContentForBrowser.js",
"quoteAttributeValueForBrowser": "src/renderers/dom/shared/quoteAttributeValueForBrowser.js",
"EventConstants": "src/renderers/shared/event/EventConstants.js",
"EventPluginHub": "src/renderers/shared/event/EventPluginHub.js",
"EventPluginRegistry": "src/renderers/shared/event/EventPluginRegistry.js",
"EventPluginUtils": "src/renderers/shared/event/EventPluginUtils.js",
"EventPropagators": "src/renderers/shared/event/EventPropagators.js",
"ResponderEventPlugin": "src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js",
"ResponderSyntheticEvent": "src/renderers/shared/event/eventPlugins/ResponderSyntheticEvent.js",
"ResponderTouchHistoryStore": "src/renderers/shared/event/eventPlugins/ResponderTouchHistoryStore.js",
"ReactChildReconciler": "src/renderers/shared/reconciler/ReactChildReconciler.js",
"ReactComponentEnvironment": "src/renderers/shared/reconciler/ReactComponentEnvironment.js",
"ReactCompositeComponent": "src/renderers/shared/reconciler/ReactCompositeComponent.js",
"ReactDefaultBatchingStrategy": "src/renderers/shared/reconciler/ReactDefaultBatchingStrategy.js",
"ReactEmptyComponent": "src/renderers/shared/reconciler/ReactEmptyComponent.js",
"ReactEmptyComponentRegistry": "src/renderers/shared/reconciler/ReactEmptyComponentRegistry.js",
"ReactEventEmitterMixin": "src/renderers/shared/reconciler/ReactEventEmitterMixin.js",
"ReactInstanceHandles": "src/renderers/shared/reconciler/ReactInstanceHandles.js",
"ReactInstanceMap": "src/renderers/shared/reconciler/ReactInstanceMap.js",
"ReactMultiChild": "src/renderers/shared/reconciler/ReactMultiChild.js",
"ReactMultiChildUpdateTypes": "src/renderers/shared/reconciler/ReactMultiChildUpdateTypes.js",
"ReactNativeComponent": "src/renderers/shared/reconciler/ReactNativeComponent.js",
"ReactOwner": "src/renderers/shared/reconciler/ReactOwner.js",
"ReactReconciler": "src/renderers/shared/reconciler/ReactReconciler.js",
"ReactRef": "src/renderers/shared/reconciler/ReactRef.js",
"ReactStateSetters": "src/renderers/shared/reconciler/ReactStateSetters.js",
"ReactUpdateQueue": "src/renderers/shared/reconciler/ReactUpdateQueue.js",
"ReactUpdates": "src/renderers/shared/reconciler/ReactUpdates.js",
"instantiateReactComponent": "src/renderers/shared/reconciler/instantiateReactComponent.js",
"shouldUpdateReactComponent": "src/renderers/shared/reconciler/shouldUpdateReactComponent.js",
"CallbackQueue": "src/shared/utils/CallbackQueue.js",
"PooledClass": "src/shared/utils/PooledClass.js",
"ReactErrorUtils": "src/shared/utils/ReactErrorUtils.js",
"Transaction": "src/shared/utils/Transaction.js",
"accumulate": "src/shared/utils/accumulate.js",
"accumulateInto": "src/shared/utils/accumulateInto.js",
"adler32": "src/shared/utils/adler32.js",
"canDefineProperty": "src/shared/utils/canDefineProperty.js",
"deprecated": "src/shared/utils/deprecated.js",
"flattenChildren": "src/shared/utils/flattenChildren.js",
"forEachAccumulated": "src/shared/utils/forEachAccumulated.js",
"getIteratorFn": "src/shared/utils/getIteratorFn.js",
"isTextInputElement": "src/shared/utils/isTextInputElement.js",
"traverseAllChildren": "src/shared/utils/traverseAllChildren.js",
"WebComponents": "src/shared/vendor/third_party/webcomponents.js",
"MetaMatchers": "src/test/MetaMatchers.js",
"ReactDefaultPerf": "src/test/ReactDefaultPerf.js",
"ReactDefaultPerfAnalysis": "src/test/ReactDefaultPerfAnalysis.js",
"ReactPerf": "src/test/ReactPerf.js",
"ReactTestUtils": "src/test/ReactTestUtils.js",
"createHierarchyRenderer": "src/test/createHierarchyRenderer.js",
"getTestDocument": "src/test/getTestDocument.js",
"reactComponentExpect": "src/test/reactComponentExpect.js"
}
#!/usr/bin/env node
'use strict'
const fs = require('fs')
const resolve = require('path').resolve
const relative = require('path').relative
const src = process.argv[2]
const RE = /\* @providesModule\s*(\w+)\s*\*/
let map = {}
function readdir(path) {
const files = fs.readdirSync(path)
files.forEach(function(file) {
const fPath = resolve(path, file)
const stat = fs.statSync(fPath)
if (stat.isFile()) {
const content = fs.readFileSync(fPath, { encoding: 'UTF-8' })
const re = content.match(RE)
if (re) {
map[re[1]] = relative(process.cwd(), fPath)
}
} else {
readdir(fPath)
}
})
}
readdir(src)
fs.writeFile('./react-src-module-map.json', JSON.stringify(map))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment