Skip to content

Commit

Permalink
Migrate vendored code from Haste to path-based imports (#24807)
Browse files Browse the repository at this point in the history
Summary:
This is the next step in moving RN towards standard path-based requires. All the requires in `Libraries/vendor` have been rewritten to use relative requires. Talking to cpojer, the vendored code in RN can be modified directly.

This commit uses relative requires instead of `react-native/...` so that if Facebook were to stop syncing out certain folders and therefore remove code from the react-native package, internal code at Facebook would not need to change.

Closes #24769.

[General] [Changed] - Migrate vendored code from Haste to path-based imports
Pull Request resolved: #24807

Differential Revision: D15316831

Pulled By: cpojer

fbshipit-source-id: 19475823ce9f506600bd09b001156e306bff4db8
  • Loading branch information
ide authored and facebook-github-bot committed May 13, 2019
1 parent f0770b6 commit 346417c
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions Libraries/vendor/core/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

'use strict';

const _shouldPolyfillES6Collection = require('_shouldPolyfillES6Collection');
const guid = require('guid');
const toIterator = require('toIterator');
const _shouldPolyfillES6Collection = require('./_shouldPolyfillES6Collection');
const guid = require('./guid');
const toIterator = require('./toIterator');

module.exports = (function(global, undefined) {
// Since our implementation is spec-compliant for the most part we can safely
Expand Down
6 changes: 3 additions & 3 deletions Libraries/vendor/core/Set.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

'use strict';

const Map = require('Map');
const Map = require('./Map');

const _shouldPolyfillES6Collection = require('_shouldPolyfillES6Collection');
const toIterator = require('toIterator');
const _shouldPolyfillES6Collection = require('./_shouldPolyfillES6Collection');
const toIterator = require('./toIterator');

module.exports = (function(global) {
// Since our implementation is spec-compliant for the most part we can safely
Expand Down
2 changes: 1 addition & 1 deletion Libraries/vendor/core/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

"use strict";

const mergeInto = require('mergeInto');
const mergeInto = require('./mergeInto');

/**
* Shallow merges two structures into a return value, without mutating either.
Expand Down
2 changes: 1 addition & 1 deletion Libraries/vendor/core/mergeInto.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

"use strict";

var mergeHelpers = require('mergeHelpers');
var mergeHelpers = require('./mergeHelpers');

var checkMergeObjectArg = mergeHelpers.checkMergeObjectArg;
var checkMergeIntoObjectArg = mergeHelpers.checkMergeIntoObjectArg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

'use strict';

const mixInEventEmitter = require('mixInEventEmitter');
const mixInEventEmitter = require('../../emitter/mixInEventEmitter');

/**
* DocumentSelectionState is responsible for maintaining selection information
Expand Down
6 changes: 3 additions & 3 deletions Libraries/vendor/emitter/EmitterSubscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

'use strict';

const EventSubscription = require('EventSubscription');
const EventSubscription = require('./EventSubscription');

import type EventEmitter from 'EventEmitter';
import type EventSubscriptionVendor from 'EventSubscriptionVendor';
import type EventEmitter from './EventEmitter';
import type EventSubscriptionVendor from './EventSubscriptionVendor';

/**
* EmitterSubscription represents a subscription with listener and context data.
Expand Down
4 changes: 2 additions & 2 deletions Libraries/vendor/emitter/EventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

'use strict';

const EmitterSubscription = require('EmitterSubscription');
const EventSubscriptionVendor = require('EventSubscriptionVendor');
const EmitterSubscription = require('./EmitterSubscription');
const EventSubscriptionVendor = require('./EventSubscriptionVendor');

const invariant = require('invariant');

Expand Down
6 changes: 3 additions & 3 deletions Libraries/vendor/emitter/EventEmitterWithHolding.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

'use strict';

import type EmitterSubscription from 'EmitterSubscription';
import type EventEmitter from 'EventEmitter';
import type EventHolder from 'EventHolder';
import type EmitterSubscription from './EmitterSubscription';
import type EventEmitter from './EventEmitter';
import type EventHolder from './EventHolder';

/**
* @class EventEmitterWithHolding
Expand Down
2 changes: 1 addition & 1 deletion Libraries/vendor/emitter/EventSubscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

'use strict';

import type EventSubscriptionVendor from 'EventSubscriptionVendor';
import type EventSubscriptionVendor from './EventSubscriptionVendor';

/**
* EventSubscription represents a subscription to a particular event. It can
Expand Down
2 changes: 1 addition & 1 deletion Libraries/vendor/emitter/EventSubscriptionVendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

const invariant = require('invariant');

import type EventSubscription from 'EventSubscription';
import type EventSubscription from './EventSubscription';

/**
* EventSubscriptionVendor stores a set of EventSubscriptions that are
Expand Down
10 changes: 5 additions & 5 deletions Libraries/vendor/emitter/mixInEventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

'use strict';

const EventEmitter = require('EventEmitter');
const EventEmitterWithHolding = require('EventEmitterWithHolding');
const EventHolder = require('EventHolder');
const EventEmitter = require('./EventEmitter');
const EventEmitterWithHolding = require('./EventEmitterWithHolding');
const EventHolder = require('./EventHolder');

const invariant = require('invariant');
const keyOf = require('fbjs/lib/keyOf');

import type EmitterSubscription from 'EmitterSubscription';
import type EmitterSubscription from './EmitterSubscription';

const TYPES_KEY = keyOf({__types: true});

Expand Down Expand Up @@ -120,7 +120,7 @@ const EventEmitterMixin = {
if (!this.__eventEmitter) {
let emitter = new EventEmitter();
if (__DEV__) {
const EventValidator = require('EventValidator');
const EventValidator = require('./EventValidator');
emitter = EventValidator.addValidation(emitter, this.__types);
}

Expand Down

0 comments on commit 346417c

Please sign in to comment.