Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function renderStyle(filepath) {
const json = docgen.parse(
fs.readFileSync(filepath),
docgenHelpers.findExportedObject,
[docgen.handlers.propTypeHandler]
);
// Remove deprecated transform props from docs
if (filepath === '../Libraries/StyleSheet/TransformPropTypes.js') {
['rotation', 'scaleX', 'scaleY', 'translateX', 'translateY'].forEach(function(key) {
delete json.props[key];
});
}
return componentsToMarkdown('style', json, filepath, componentCount++);
}
const styleDocs = paths.reduce((docs, filepath) => {
const props = docgen.parse(
fs.readFileSync(path.resolve('node_modules/react-native', filepath)),
findExportedObject,
[docgen.handlers.propTypeHandler, docgen.handlers.propDocBlockHandler]
).props
// Remove deprecated transform props from docs
if (filepath === 'Libraries/StyleSheet/TransformPropTypes.js') {
;[
'rotation',
'scaleX',
'scaleY',
'translateX',
'translateY',
].forEach(function(key) {
delete props[key]
})
}
let newProps = {}
function renderStyle(filepath) {
const json = docgen.parse(
fs.readFileSync(filepath),
docgenHelpers.findExportedObject,
[
docgen.handlers.propTypeHandler,
docgen.handlers.propDocBlockHandler,
]
);
json.props = json.props || {};
if (json.props) {
// remove styles not yet supported
UNSUPPORTED_STYLES.forEach(function(key) {
delete json.props[key];
});
}
// Remove deprecated transform props from docs
if (filepath === '../Libraries/StyleSheet/TransformPropTypes.js') {
['rotation', 'scaleX', 'scaleY', 'translateX', 'translateY'].forEach(function(key) {
delete json.props[key];
const styleDocs = docsList.stylesForEmbed.reduce(function(docs, filepath) {
let json =
docgen.parse(
fs.readFileSync(filepath),
docgenHelpers.findExportedObject,
[
docgen.handlers.propTypeHandler,
docgen.handlers.propTypeCompositionHandler,
docgen.handlers.propDocBlockHandler,
]
);
json.props = json.props || {};
if (json.props) {
// remove styles not yet supported
UNSUPPORTED_STYLES.forEach(function(key) {
delete json.props[key];
});
}
docs[path.basename(filepath).replace(path.extname(filepath), '')] = json;
return docs;
function renderStyle(filepath) {
const json = docgen.parse(
fs.readFileSync(filepath),
docgenHelpers.findExportedObject,
[
docgen.handlers.propTypeHandler,
docgen.handlers.propDocBlockHandler,
]
);
// Remove deprecated transform props from docs
if (filepath === '../Libraries/StyleSheet/TransformPropTypes.js') {
['rotation', 'scaleX', 'scaleY', 'translateX', 'translateY'].forEach(function(key) {
delete json.props[key];
});
}
return componentsToMarkdown('style', json, filepath, componentCount++);
}
const path = require('path');
const reactDocGen = require('react-docgen');
const { createDisplayNameHandler } = require('react-docgen-displayname-handler');
const getSourceFileContent = require('./get-source-file-content');
const createResolver = require('./create-resolver');
const componentPropTypesJsDocHandler = require('./component-prop-types-js-doc-handler');
const documentation = {};
const defaultHandlers = [
reactDocGen.handlers.propTypeHandler,
reactDocGen.handlers.propTypeCompositionHandler,
reactDocGen.handlers.propDocBlockHandler,
reactDocGen.handlers.flowTypeHandler,
reactDocGen.handlers.flowTypeDocBlockHandler,
reactDocGen.handlers.defaultPropsHandler,
reactDocGen.handlers.componentDocblockHandler,
reactDocGen.handlers.displayNameHandler,
reactDocGen.handlers.componentMethodsHandler,
reactDocGen.handlers.componentMethodsJsDocHandler,
componentPropTypesJsDocHandler,
].filter(Boolean);
function getReactComponentInfo(filePath, parentPath) {
if (documentation[filePath]) {
return documentation[filePath];
}
const src = getSourceFileContent(filePath, parentPath);
const path = require('path');
const reactDocGen = require('react-docgen');
const { createDisplayNameHandler } = require('react-docgen-displayname-handler');
const getSourceFileContent = require('./get-source-file-content');
const createResolver = require('./create-resolver');
const componentPropTypesJsDocHandler = require('./component-prop-types-js-doc-handler');
const documentation = {};
const defaultHandlers = [
reactDocGen.handlers.propTypeHandler,
reactDocGen.handlers.propTypeCompositionHandler,
reactDocGen.handlers.propDocBlockHandler,
reactDocGen.handlers.flowTypeHandler,
reactDocGen.handlers.flowTypeDocBlockHandler,
reactDocGen.handlers.defaultPropsHandler,
reactDocGen.handlers.componentDocblockHandler,
reactDocGen.handlers.displayNameHandler,
reactDocGen.handlers.componentMethodsHandler,
reactDocGen.handlers.componentMethodsJsDocHandler,
componentPropTypesJsDocHandler,
].filter(Boolean);
function getReactComponentInfo(filePath, parentPath) {
if (documentation[filePath]) {
return documentation[filePath];
}
const styleDocs = docsList.stylesForEmbed.reduce(function(docs, filepath) {
docs[path.basename(filepath).replace(path.extname(filepath), '')] =
docgen.parse(
fs.readFileSync(filepath),
docgenHelpers.findExportedObject,
[
docgen.handlers.propTypeHandler,
docgen.handlers.propTypeCompositionHandler,
docgen.handlers.propDocBlockHandler,
]
);
return docs;
}, {});
const styleDocs = stylesForEmbed.reduce(function(docs, filepath) {
docs[path.basename(filepath).replace(path.extname(filepath), '')] =
docgen.parse(
fs.readFileSync(filepath),
docgenHelpers.findExportedObject,
[
docgen.handlers.propTypeHandler,
docgen.handlers.propTypeCompositionHandler,
docgen.handlers.propDocBlockHandler,
]
);
return docs;
}, {});