分析脚本
// react 文件分析 var fs = require('fs'),path = require('path'); function log(){ console.log.apply(console,arguments); } var rootPath = '/to/you/path/react-0.14-stable/src'; function readFilePath(dir){ fs.readdir(dir,function(e,files){ var arrayPath = []; files.forEach(function(file){ var filePath = path.resolve(dir + '/' + file); arrayPath.push(filePath); }); arrayPath.forEach(function(file){ fs.stat(file,stats){ if(stats && stats.isDirectory()){ // 去除测试文件 if(file.indexOf('__tests__') === -1 && file.indexOf('test') === -1){ readFilePath(file); } }else if(stats && stats.isFile()){ var data = file.split(rootPath + '/')[1] + '\r'; fs.appendFile('files.txt',data,function (err) { log('write success'); }); } }); }); }); } readFilePath(rootPath);
分析结果
React.js
package.json
ReactVersion.js
isomorphic/ReactIsomorphic.js
addons/ReactComponentWithPureRenderMixin.js
addons/ReactFragment.js
addons/ReactWithAddons.js
addons/renderSubtreeIntoContainer.js
addons/shallowCompare.js
addons/update.js
isomorphic/children/ReactChildren.js
isomorphic/children/onlyChild.js
isomorphic/children/sliceChildren.js
isomorphic/deprecated/OrderedMap.js
isomorphic/deprecated/ReactPropTransferer.js
isomorphic/deprecated/cloneWithProps.js
addons/link/LinkedStateMixin.js
addons/link/ReactLink.js
addons/transitions/ReactCSSTransitionGroup.js
addons/transitions/ReactCSSTransitionGroupChild.js
addons/transitions/ReactTransitionChildMapping.js
addons/transitions/ReactTransitionEvents.js
addons/transitions/ReactTransitionGroup.js
renderers/dom/ReactDOM.js
renderers/dom/ReactDOMServer.js
shared/stubs/Object.assign.js
shared/utils/CallbackQueue.js
shared/utils/PooledClass.js
shared/utils/ReactErrorUtils.js
shared/utils/Transaction.js
shared/utils/accumulate.js
shared/utils/accumulateInto.js
shared/utils/adler32.js
shared/utils/canDefineProperty.js
shared/utils/deprecated.js
shared/utils/escapeTextContentForBrowser.js
shared/utils/flattenChildren.js
shared/utils/forEachAccumulated.js
shared/utils/getIteratorFn.js
shared/utils/isTextInputElement.js
shared/utils/quoteAttributeValueForBrowser.js
shared/utils/traverseAllChildren.js
isomorphic/classic/class/ReactClass.js
isomorphic/classic/element/ReactDOMFactories.js
isomorphic/classic/element/ReactCurrentOwner.js
isomorphic/classic/element/ReactElement.js
isomorphic/classic/element/ReactElementValidator.js
isomorphic/classic/types/ReactPropTypeLocationNames.js
isomorphic/classic/types/ReactPropTypes.js
isomorphic/classic/types/ReactPropTypeLocations.js
isomorphic/modern/class/ReactDOM.d.ts
isomorphic/modern/class/React.d.ts
isomorphic/modern/class/ReactComponent.js
isomorphic/modern/class/ReactNoopUpdateQueue.js
renderers/dom/client/ClientReactRootIndex.js
renderers/dom/client/ReactBrowserEventEmitter.js
renderers/dom/client/ReactDOMIDOperations.js
renderers/dom/client/ReactDOMSelection.js
renderers/dom/client/ReactEventListener.js
renderers/dom/client/ReactInputSelection.js
renderers/dom/client/ReactMount.js
renderers/dom/client/ReactReconcileTransaction.js
renderers/dom/client/findDOMNode.js
renderers/dom/client/validateDOMNesting.js
renderers/dom/server/ReactMarkupChecksum.js
renderers/dom/server/ReactServerBatchingStrategy.js
renderers/dom/server/ReactServerRendering.js
renderers/dom/server/ReactServerRenderingTransaction.js
renderers/dom/server/ServerReactRootIndex.js
renderers/dom/shared/CSSPropertyOperations.js
renderers/dom/shared/CSSProperty.js
renderers/dom/shared/DOMPropertyOperations.js
renderers/dom/shared/DOMProperty.js
renderers/dom/shared/Danger.js
renderers/dom/shared/HTMLDOMPropertyConfig.js
renderers/dom/shared/ReactBrowserComponentMixin.js
renderers/dom/shared/ReactComponentBrowserEnvironment.js
renderers/dom/shared/ReactDOMComponent.js
renderers/dom/shared/ReactDOMFeatureFlags.js
renderers/dom/shared/ReactDOMTextComponent.js
renderers/dom/shared/ReactDefaultInjection.js
renderers/dom/shared/ReactInjection.js
renderers/dom/shared/SVGDOMPropertyConfig.js
renderers/dom/shared/dangerousStyleValue.js
renderers/shared/event/EventConstants.js
renderers/shared/event/EventPluginRegistry.js
renderers/shared/event/EventPluginHub.js
renderers/shared/event/EventPluginUtils.js
renderers/shared/event/EventPropagators.js
renderers/shared/reconciler/ReactChildReconciler.js
renderers/shared/reconciler/ReactComponentEnvironment.js
renderers/shared/reconciler/ReactCompositeComponent.js
renderers/shared/reconciler/ReactDefaultBatchingStrategy.js
renderers/shared/reconciler/ReactEmptyComponent.js
renderers/shared/reconciler/ReactEmptyComponentRegistry.js
renderers/shared/reconciler/ReactInstanceHandles.js
renderers/shared/reconciler/ReactEventEmitterMixin.js
renderers/shared/reconciler/ReactInstanceMap.js
renderers/shared/reconciler/ReactMultiChild.js
renderers/shared/reconciler/ReactMultiChildUpdateTypes.js
renderers/shared/reconciler/ReactNativeComponent.js
renderers/shared/reconciler/ReactOwner.js
renderers/shared/reconciler/ReactReconciler.js
renderers/shared/reconciler/ReactRef.js
renderers/shared/reconciler/ReactStateSetters.js
renderers/shared/reconciler/ReactRootIndex.js
renderers/shared/reconciler/ReactUpdateQueue.js
renderers/shared/reconciler/ReactUpdates.js
renderers/shared/reconciler/instantiateReactComponent.js
renderers/shared/reconciler/shouldUpdateReactComponent.js
shared/vendor/third_party/webcomponents.js
renderers/dom/client/eventPlugins/BeforeInputEventPlugin.js
renderers/dom/client/eventPlugins/ChangeEventPlugin.js
renderers/dom/client/eventPlugins/DefaultEventPluginOrder.js
renderers/dom/client/eventPlugins/EnterLeaveEventPlugin.js
renderers/dom/client/eventPlugins/FallbackCompositionState.js
renderers/dom/client/eventPlugins/SelectEventPlugin.js
renderers/dom/client/eventPlugins/SimpleEventPlugin.js
renderers/dom/client/eventPlugins/TapEventPlugin.js
renderers/dom/client/syntheticEvents/SyntheticClipboardEvent.js
renderers/dom/client/syntheticEvents/SyntheticCompositionEvent.js
renderers/dom/client/syntheticEvents/SyntheticDragEvent.js
renderers/dom/client/syntheticEvents/SyntheticEvent.js
renderers/dom/client/syntheticEvents/SyntheticFocusEvent.js
renderers/dom/client/syntheticEvents/SyntheticInputEvent.js
renderers/dom/client/syntheticEvents/SyntheticKeyboardEvent.js
renderers/dom/client/syntheticEvents/SyntheticMouseEvent.js
renderers/dom/client/syntheticEvents/SyntheticTouchEvent.js
renderers/dom/client/syntheticEvents/SyntheticUIEvent.js
renderers/dom/client/syntheticEvents/SyntheticWheelEvent.js
renderers/dom/client/utils/DOMChildrenOperations.js
renderers/dom/client/utils/ViewportMetrics.js
renderers/dom/client/utils/getEventCharCode.js
renderers/dom/client/utils/getEventKey.js
renderers/dom/client/utils/getEventModifierState.js
renderers/dom/client/utils/getEventTarget.js
renderers/dom/client/utils/getNodeForCharacterOffset.js
renderers/dom/client/utils/isEventSupported.js
renderers/dom/client/utils/getTextContentAccessor.js
renderers/dom/client/utils/setInnerHTML.js
renderers/dom/client/utils/setTextContent.js
renderers/dom/client/wrappers/AutoFocusUtils.js
renderers/dom/client/wrappers/LinkedValueUtils.js
renderers/dom/client/wrappers/ReactDOMButton.js
renderers/dom/client/wrappers/ReactDOMInput.js
renderers/dom/client/wrappers/ReactDOMOption.js
renderers/dom/client/wrappers/ReactDOMSelect.js
renderers/dom/client/wrappers/ReactDOMTextarea.js
renderers/shared/event/eventPlugins/ResponderEventPlugin.js
renderers/shared/event/eventPlugins/ResponderSyntheticEvent.js
renderers/shared/event/eventPlugins/ResponderTouchHistoryStore.js