Add more autogenerated documentation to the whitelist

Summary:
I went through and checked what React Native exports that we don't have any autogen docs for, and added the missing stuff into the whitelist. The extra docs seem useful.

Still not reference-documented because docgen chokes:
AppStateIOS
ART
Keyboard
LinkingIOS
Platform
RecyclerViewBackedScrollView
Touchable
UIManager

I also fixed up a bit of alphabetical order
Closes https://github.com/facebook/react-native/pull/8791

Differential Revision: D3566466

Pulled By: lacker

fbshipit-source-id: 0d7c1f242c96bf9afe5f8b54ea7e0b6891effa4b
This commit is contained in:
Kevin Lacker 2016-07-14 18:51:51 -07:00 коммит произвёл Facebook Github Bot 6
Родитель 2b1b8418f0
Коммит 81bf5decb1
1 изменённых файлов: 57 добавлений и 32 удалений

Просмотреть файл

@ -257,19 +257,24 @@ function getTypedef(filepath, fileContent, json) {
}
function renderComponent(filepath) {
const fileContent = fs.readFileSync(filepath);
const json = docgen.parse(
fileContent,
docgenHelpers.findExportedOrFirst,
docgen.defaultHandlers.concat([
docgenHelpers.stylePropTypeHandler,
docgenHelpers.deprecatedPropTypeHandler,
docgenHelpers.jsDocFormatHandler,
])
);
json.typedef = getTypedef(filepath, fileContent);
try {
const fileContent = fs.readFileSync(filepath);
const json = docgen.parse(
fileContent,
docgenHelpers.findExportedOrFirst,
docgen.defaultHandlers.concat([
docgenHelpers.stylePropTypeHandler,
docgenHelpers.deprecatedPropTypeHandler,
docgenHelpers.jsDocFormatHandler,
])
);
json.typedef = getTypedef(filepath, fileContent);
return componentsToMarkdown('component', json, filepath, componentCount++, styleDocs);
return componentsToMarkdown('component', json, filepath, componentCount++, styleDocs);
} catch (e) {
console.log('error in renderComponent for', filepath);
throw e;
}
}
function isJsDocFormat(fileContent) {
@ -330,6 +335,9 @@ function parseAPIInferred(filepath, fileContent) {
let json;
try {
json = jsDocs(fileContent);
if (!json) {
throw new Error('jsDocs returned falsy');
}
} catch (e) {
console.error('Cannot parse file', filepath, e);
json = {};
@ -427,27 +435,32 @@ function getJsDocFormatType(entities) {
}
function renderAPI(filepath, type) {
const fileContent = fs.readFileSync(filepath).toString();
let json = parseAPIInferred(filepath, fileContent);
if (isJsDocFormat(fileContent)) {
let jsonJsDoc = parseAPIJsDocFormat(filepath, fileContent);
// Combine method info with jsdoc fomatted content
const methods = json.methods;
if (methods && methods.length) {
let modMethods = methods;
methods.map((method, methodIndex) => {
modMethods[methodIndex].params = getJsDocFormatType(method.params);
modMethods[methodIndex].returns =
try {
const fileContent = fs.readFileSync(filepath).toString();
let json = parseAPIInferred(filepath, fileContent);
if (isJsDocFormat(fileContent)) {
let jsonJsDoc = parseAPIJsDocFormat(filepath, fileContent);
// Combine method info with jsdoc formatted content
const methods = json.methods;
if (methods && methods.length) {
let modMethods = methods;
methods.map((method, methodIndex) => {
modMethods[methodIndex].params = getJsDocFormatType(method.params);
modMethods[methodIndex].returns =
getJsDocFormatType(method.returntypehint);
delete modMethods[methodIndex].returntypehint;
});
json.methods = modMethods;
// Use deep Object.assign so duplicate properties are overwritten.
deepAssign(jsonJsDoc.methods, json.methods);
delete modMethods[methodIndex].returntypehint;
});
json.methods = modMethods;
// Use deep Object.assign so duplicate properties are overwritten.
deepAssign(jsonJsDoc.methods, json.methods);
}
json = jsonJsDoc;
}
json = jsonJsDoc;
return componentsToMarkdown(type, json, filepath, componentCount++);
} catch (e) {
console.log('error in renderAPI for', filepath);
throw e;
}
return componentsToMarkdown(type, json, filepath, componentCount++);
}
function renderStyle(filepath) {
@ -472,6 +485,7 @@ function renderStyle(filepath) {
const components = [
'../Libraries/Components/ActivityIndicator/ActivityIndicator.js',
'../Libraries/Components/ActivityIndicator/ActivityIndicatorIOS.ios.js',
'../Libraries/Components/DatePicker/DatePickerIOS.ios.js',
'../Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js',
'../Libraries/Image/Image.ios.js',
@ -480,8 +494,8 @@ const components = [
'../Libraries/Modal/Modal.js',
'../Libraries/CustomComponents/Navigator/Navigator.js',
'../Libraries/Components/Navigation/NavigatorIOS.ios.js',
'../Libraries/Components/Picker/PickerIOS.ios.js',
'../Libraries/Components/Picker/Picker.js',
'../Libraries/Components/Picker/PickerIOS.ios.js',
'../Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js',
'../Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js',
'../Libraries/Components/RefreshControl/RefreshControl.js',
@ -490,7 +504,10 @@ const components = [
'../Libraries/Components/Slider/Slider.js',
'../Libraries/Components/SliderIOS/SliderIOS.ios.js',
'../Libraries/Components/StatusBar/StatusBar.js',
'../Libraries/RCTTest/SnapshotViewIOS.ios.js',
'../Libraries/Components/Switch/Switch.js',
'../Libraries/Components/SwitchAndroid/SwitchAndroid.android.js',
'../Libraries/Components/SwitchIOS/SwitchIOS.ios.js',
'../Libraries/Components/TabBarIOS/TabBarIOS.ios.js',
'../Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js',
'../Libraries/Text/Text.js',
@ -507,6 +524,7 @@ const components = [
const apis = [
'../Libraries/ActionSheetIOS/ActionSheetIOS.js',
'../Libraries/AdSupport/AdSupportIOS.js',
'../Libraries/Utilities/Alert.js',
'../Libraries/Utilities/AlertIOS.js',
'../Libraries/Animated/src/AnimatedImplementation.js',
@ -518,23 +536,30 @@ const apis = [
'../Libraries/Components/Clipboard/Clipboard.js',
'../Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js',
'../Libraries/Utilities/Dimensions.js',
'../Libraries/Animated/src/Easing.js',
'../Libraries/Geolocation/Geolocation.js',
'../Libraries/Image/ImageEditor.js',
'../Libraries/CameraRoll/ImagePickerIOS.js',
'../Libraries/Image/ImageStore.js',
'../Libraries/Components/Intent/IntentAndroid.android.js',
'../Libraries/Interaction/InteractionManager.js',
'../Libraries/LayoutAnimation/LayoutAnimation.js',
'../Libraries/Linking/Linking.js',
'../Libraries/CustomComponents/ListView/ListViewDataSource.js',
'../node_modules/react/lib/NativeMethodsMixin.js',
'../Libraries/BatchedBridge/BatchedBridgedModules/NativeModules.js',
'../Libraries/Network/NetInfo.js',
'../Libraries/Interaction/PanResponder.js',
'../Libraries/Utilities/PixelRatio.js',
'../Libraries/PushNotificationIOS/PushNotificationIOS.js',
'../Libraries/Settings/Settings.ios.js',
'../Libraries/Components/StatusBar/StatusBarIOS.ios.js',
'../Libraries/StyleSheet/StyleSheet.js',
'../Libraries/Utilities/Systrace.js',
'../Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js',
'../Libraries/Components/ToastAndroid/ToastAndroid.android.js',
'../Libraries/Vibration/VibrationIOS.ios.js',
'../Libraries/Vibration/Vibration.js',
'../Libraries/Vibration/VibrationIOS.ios.js',
];
const stylesWithPermalink = [