Permalink
Browse files

packager: rename node-haste/index to DependencyGraph

Summary: I've been confused for a long time by this, and I think it's better late than never. I propose we rename that file to make it more explicit where that class lives, and so that it's consistent with the test file, name `DependencyGraph-test.js`

Reviewed By: davidaurelio

Differential Revision: D5020556

fbshipit-source-id: d54a501c3995f3fea16a5bfc6ca72993f73c4873
  • Loading branch information...
jeanlauliac authored and facebook-github-bot committed May 10, 2017
1 parent a324dfb commit c948ae81686e2345d155577b4ff9f43f50021e99
@@ -14,7 +14,7 @@
const querystring = require('querystring');
const url = require('url');
const {getInverseDependencies} = require('../../../packager/src//node-haste');
const {getInverseDependencies} = require('../../../packager/src//node-haste/DependencyGraph');
import type HMRBundle from '../../../packager/src/Bundler/HMRBundle';
import type Server from '../../../packager/src/Server';
@@ -21,7 +21,7 @@ const {objectContaining} = jasmine;
describe('AssetServer', () => {
beforeEach(() => {
const NodeHaste = require('../../node-haste');
const NodeHaste = require('../../node-haste/DependencyGraph');
NodeHaste.getAssetDataFromName =
require.requireActual('../../node-haste/lib/getAssetDataFromName');
});
@@ -14,7 +14,7 @@
const crypto = require('crypto');
const denodeify = require('denodeify');
const fs = require('fs');
const getAssetDataFromName = require('../node-haste').getAssetDataFromName;
const getAssetDataFromName = require('../node-haste/DependencyGraph').getAssetDataFromName;
const path = require('path');
import type {AssetData} from '../node-haste/lib/getAssetDataFromName';
@@ -19,7 +19,7 @@ jest
.mock('os')
.mock('assert')
.mock('progress')
.mock('../../node-haste')
.mock('../../node-haste/DependencyGraph')
.mock('../../JSTransformer')
.mock('../../lib/declareOpts')
.mock('../../Resolver')
@@ -16,7 +16,7 @@ jest.mock('path');
const {join: pathJoin} = require.requireActual('path');
const DependencyGraph = jest.fn();
jest.setMock('../../node-haste', DependencyGraph);
jest.setMock('../../node-haste/DependencyGraph', DependencyGraph);
let Module;
let Polyfill;
@@ -11,7 +11,7 @@
'use strict';
const DependencyGraph = require('../node-haste');
const DependencyGraph = require('../node-haste/DependencyGraph');
const defaults = require('../../defaults');
const pathJoin = require('path').join;
@@ -23,7 +23,7 @@ jest.mock('../../worker-farm', () => () => () => {})
.mock('../../Bundler')
.mock('../../AssetServer')
.mock('../../lib/declareOpts')
.mock('../../node-haste')
.mock('../../node-haste/DependencyGraph')
.mock('../../Logger')
.mock('../../lib/GlobalTransformCache');
@@ -12,7 +12,7 @@
'use strict';
const AssetServer = require('../AssetServer');
const getPlatformExtension = require('../node-haste').getPlatformExtension;
const getPlatformExtension = require('../node-haste/DependencyGraph').getPlatformExtension;
const Bundler = require('../Bundler');
const MultipartResponse = require('./MultipartResponse');
@@ -106,7 +106,7 @@ describe('DependencyGraph', function() {
const realPlatform = process.platform;
beforeEach(function() {
process.platform = 'linux';
DependencyGraph = require('../index');
DependencyGraph = require('../DependencyGraph');
});
afterEach(function() {
@@ -2368,7 +2368,7 @@ describe('DependencyGraph', function() {
// reload path module
jest.resetModules();
jest.mock('path', () => path.win32);
DependencyGraph = require('../index');
DependencyGraph = require('../DependencyGraph');
});
afterEach(function() {
@@ -2559,7 +2559,7 @@ describe('DependencyGraph', function() {
let DependencyGraph;
beforeEach(function() {
process.platform = 'linux';
DependencyGraph = require('../index');
DependencyGraph = require('../DependencyGraph');
});
afterEach(function() {
@@ -3539,7 +3539,7 @@ describe('DependencyGraph', function() {
// due to the drive letter expectation
if (realPlatform !== 'win32') { return; }
const DependencyGraph = require('../index');
const DependencyGraph = require('../DependencyGraph');
it('should work with nested node_modules', function() {
var root = '/root';
@@ -4503,7 +4503,7 @@ describe('DependencyGraph', function() {
beforeEach(function() {
process.platform = 'linux';
DependencyGraph = require('../index');
DependencyGraph = require('../DependencyGraph');
});
afterEach(function() {
@@ -5221,7 +5221,7 @@ describe('DependencyGraph', function() {
let DependencyGraph;
beforeEach(function() {
process.platform = 'linux';
DependencyGraph = require('../index');
DependencyGraph = require('../DependencyGraph');
});
afterEach(function() {
@@ -5393,7 +5393,7 @@ describe('DependencyGraph', function() {
'g.js': makeModule('g'),
},
});
const DependencyGraph = require('../');
const DependencyGraph = require('../DependencyGraph');
return DependencyGraph.load({
...defaults,
roots: ['/root'],
@@ -5424,7 +5424,7 @@ describe('DependencyGraph', function() {
describe('Asset module dependencies', () => {
let DependencyGraph;
beforeEach(() => {
DependencyGraph = require('../index');
DependencyGraph = require('../DependencyGraph');
});
it('allows setting dependencies for asset modules', () => {
@@ -5460,7 +5460,7 @@ describe('DependencyGraph', function() {
beforeEach(() => {
moduleRead = Module.prototype.read;
DependencyGraph = require('../index');
DependencyGraph = require('../DependencyGraph');
setMockFileSystem({
'root': {
'index.js': `

0 comments on commit c948ae8

Please sign in to comment.