server/devdocs/bin/generate-components-usage-stats.js
function getDependencies( code ) {
	var cache = Object.create( null );
	var deps = [];

	function addDependency( dep ) {
		if ( ! cache[ dep ] ) {
			cache[ dep ] = true;
			deps.push( dep );
		}
	}

	code
		.replace( replacePatterns.BLOCK_COMMENT_RE, '' )
		.replace( replacePatterns.LINE_COMMENT_RE, '' )
		.replace( replacePatterns.IMPORT_RE, function( match, pre, quot, dep ) {
			addDependency( dep );
			return match;
		} )
		.replace( replacePatterns.EXPORT_RE, function( match, pre, quot, dep ) {
			addDependency( dep );
			return match;
		} )
		.replace( replacePatterns.REQUIRE_RE, function( match, pre, quot, dep ) {
			addDependency( dep );
		} );

	return deps;
}
function getDependencies( code ) {
	var cache = Object.create( null );
	var deps = [];

	function addDependency( dep ) {
		if ( ! cache[ dep ] ) {
			cache[ dep ] = true;
			deps.push( dep );
		}
	}

	code
		.replace( replacePatterns.BLOCK_COMMENT_RE, '' )
		.replace( replacePatterns.LINE_COMMENT_RE, '' )
		.replace( replacePatterns.IMPORT_RE, function( match, pre, quot, dep ) {
			addDependency( dep );
			return match;
		} )
		.replace( replacePatterns.EXPORT_RE, function( match, pre, quot, dep ) {
			addDependency( dep );
			return match;
		} )
		.replace( replacePatterns.REQUIRE_RE, function( match, pre, quot, dep ) {
			addDependency( dep );
		} );

	return deps;
}
Extract all required modules from a `code` string.
Copyright (c) 2014-present, Facebook, Inc. See CREDITS.md#facebook/node-haste

@param {string} code The source code string to parse
@returns {array} An array of required modules, if any