mirror of https://github.com/status-im/metro.git
Fix indentation of polyfills/require.js
Summary: Fixes the messed-up indentation of `polyfills/require.js`. Over half of the lines were indented with an odd number of spaces. Reviewed By: arcanis, bestander Differential Revision: D4737435 fbshipit-source-id: a5b9baf0a27f236a4d3d6b6c1c5a92f52859f62c
This commit is contained in:
parent
bbd4669180
commit
80faeb9034
|
@ -10,30 +10,30 @@
|
|||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
declare var __DEV__: boolean;
|
||||
declare var __DEV__: boolean;
|
||||
|
||||
type DependencyMap = Array<ModuleID>;
|
||||
type Exports = any;
|
||||
type FactoryFn = (
|
||||
type DependencyMap = Array<ModuleID>;
|
||||
type Exports = any;
|
||||
type FactoryFn = (
|
||||
global: Object,
|
||||
require: RequireFn,
|
||||
moduleObject: {exports: {}},
|
||||
exports: {},
|
||||
dependencyMap: ?DependencyMap,
|
||||
) => void;
|
||||
type HotModuleReloadingAcceptFn = Function;
|
||||
type HotModuleReloadingData = {|
|
||||
type HotModuleReloadingAcceptFn = Function;
|
||||
type HotModuleReloadingData = {|
|
||||
acceptCallback: ?HotModuleReloadingAcceptFn,
|
||||
accept: (callback: HotModuleReloadingAcceptFn) => void,
|
||||
|};
|
||||
type Module = {
|
||||
type Module = {
|
||||
exports: Exports,
|
||||
hot?: HotModuleReloadingData,
|
||||
};
|
||||
type ModuleID = number;
|
||||
type ModuleDefinition = {|
|
||||
type ModuleID = number;
|
||||
type ModuleDefinition = {|
|
||||
dependencyMap: ?DependencyMap,
|
||||
exports: Exports,
|
||||
factory: FactoryFn,
|
||||
|
@ -42,20 +42,20 @@
|
|||
isInitialized: boolean,
|
||||
verboseName?: string,
|
||||
|};
|
||||
type ModuleMap =
|
||||
type ModuleMap =
|
||||
{[key: ModuleID]: (ModuleDefinition)};
|
||||
type RequireFn = (id: ModuleID | VerboseModuleNameForDev) => Exports;
|
||||
type VerboseModuleNameForDev = string;
|
||||
type RequireFn = (id: ModuleID | VerboseModuleNameForDev) => Exports;
|
||||
type VerboseModuleNameForDev = string;
|
||||
|
||||
global.require = require;
|
||||
global.__d = define;
|
||||
global.require = require;
|
||||
global.__d = define;
|
||||
|
||||
const modules: ModuleMap = Object.create(null);
|
||||
if (__DEV__) {
|
||||
const modules: ModuleMap = Object.create(null);
|
||||
if (__DEV__) {
|
||||
var verboseNamesToModuleIds: {[key: string]: number} = Object.create(null);
|
||||
}
|
||||
}
|
||||
|
||||
function define(
|
||||
function define(
|
||||
factory: FactoryFn,
|
||||
moduleId: number,
|
||||
dependencyMap?: DependencyMap,
|
||||
|
@ -85,9 +85,9 @@
|
|||
verboseNamesToModuleIds[verboseName] = moduleId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function require(moduleId: ModuleID | VerboseModuleNameForDev) {
|
||||
function require(moduleId: ModuleID | VerboseModuleNameForDev) {
|
||||
if (__DEV__ && typeof moduleId === 'string') {
|
||||
const verboseName = moduleId;
|
||||
moduleId = verboseNamesToModuleIds[moduleId];
|
||||
|
@ -107,10 +107,10 @@
|
|||
return module && module.isInitialized
|
||||
? module.exports
|
||||
: guardedLoadModule(moduleIdReallyIsNumber, module);
|
||||
}
|
||||
}
|
||||
|
||||
let inGuard = false;
|
||||
function guardedLoadModule(moduleId: ModuleID, module) {
|
||||
let inGuard = false;
|
||||
function guardedLoadModule(moduleId: ModuleID, module) {
|
||||
if (!inGuard && global.ErrorUtils) {
|
||||
inGuard = true;
|
||||
let returnValue;
|
||||
|
@ -124,9 +124,9 @@
|
|||
} else {
|
||||
return loadModuleImplementation(moduleId, module);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadModuleImplementation(moduleId, module) {
|
||||
function loadModuleImplementation(moduleId, module) {
|
||||
const nativeRequire = global.nativeRequire;
|
||||
if (!module && nativeRequire) {
|
||||
nativeRequire(moduleId);
|
||||
|
@ -189,9 +189,9 @@
|
|||
module.exports = undefined;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function unknownModuleError(id) {
|
||||
function unknownModuleError(id) {
|
||||
let message = 'Requiring unknown module "' + id + '".';
|
||||
if (__DEV__) {
|
||||
message +=
|
||||
|
@ -199,13 +199,13 @@
|
|||
'You may also want to run `npm install`, or `yarn` (depending on your environment).';
|
||||
}
|
||||
return Error(message);
|
||||
}
|
||||
}
|
||||
|
||||
function moduleThrewError(id) {
|
||||
function moduleThrewError(id) {
|
||||
return Error('Requiring module "' + id + '", which threw an exception.');
|
||||
}
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
if (__DEV__) {
|
||||
require.Systrace = {beginEvent: () => {}, endEvent: () => {}};
|
||||
|
||||
// HOT MODULE RELOADING
|
||||
|
@ -285,4 +285,4 @@
|
|||
};
|
||||
|
||||
global.__accept = accept;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue