mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Simplify File type: map is nullable, but not optional
Summary: Simplifies the `File` type by making `map` a non-optional, but nullable property. Also adds helper functions for empty/virtual modules Reviewed By: jeanlauliac Differential Revision: D5111580 fbshipit-source-id: 9cab6634a9bdb0522dc36aec2abccaef9cf35339
This commit is contained in:
committed by
Facebook Github Bot
parent
918bae282b
commit
6b2122be13
@@ -13,6 +13,7 @@
|
||||
const emptyFunction = require('fbjs/lib/emptyFunction');
|
||||
const invariant = require('fbjs/lib/invariant');
|
||||
const memoize = require('async/memoize');
|
||||
const emptyModule = require('./module').empty;
|
||||
const nullthrows = require('fbjs/lib/nullthrows');
|
||||
const queue = require('async/queue');
|
||||
const seq = require('async/seq');
|
||||
@@ -49,9 +50,6 @@ type Async$Queue<T, C> = {
|
||||
type LoadQueue =
|
||||
Async$Queue<{id: string, parent: ?string}, Callback<File, Array<string>>>;
|
||||
|
||||
const createParentModule =
|
||||
() => ({file: {code: '', type: 'script', path: ''}, dependencies: []});
|
||||
|
||||
const NO_OPTIONS = {};
|
||||
|
||||
exports.create = function create(resolve: ResolveFn, load: LoadFn): GraphFn {
|
||||
@@ -101,7 +99,7 @@ exports.create = function create(resolve: ResolveFn, load: LoadFn): GraphFn {
|
||||
};
|
||||
|
||||
function createGraphHelpers(loadQueue, skip) {
|
||||
const modules = new Map([[null, createParentModule()]]);
|
||||
const modules = new Map([[null, emptyModule()]]);
|
||||
|
||||
function collect(
|
||||
path = null,
|
||||
|
||||
Reference in New Issue
Block a user