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
@@ -10,6 +10,8 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const virtualModule = require('../module').virtual;
|
||||
|
||||
import type {IdForPathFn, Module} from '../types.flow';
|
||||
|
||||
// Transformed modules have the form
|
||||
@@ -77,17 +79,3 @@ exports.requireCallsTo = function* (
|
||||
yield virtualModule(`require(${idForPath(module.file)});`);
|
||||
}
|
||||
};
|
||||
|
||||
// creates a virtual module (i.e. not corresponding to a file on disk)
|
||||
// with the given source code.
|
||||
exports.virtualModule = virtualModule;
|
||||
function virtualModule(code: string) {
|
||||
return {
|
||||
dependencies: [],
|
||||
file: {
|
||||
code,
|
||||
path: '',
|
||||
type: 'script',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user