mirror of
https://github.com/status-im/metro.git
synced 2025-02-23 08:18:16 +00:00
Remove Resolver module
Reviewed By: jeanlauliac Differential Revision: D6674419 fbshipit-source-id: 75cd9dbbc90725850ce23b62c9c8c50922145dd3
This commit is contained in:
parent
a5b0f236e4
commit
bdaddb2585
@ -22,12 +22,10 @@ jest
|
|||||||
.mock('progress')
|
.mock('progress')
|
||||||
.mock('../../node-haste/DependencyGraph')
|
.mock('../../node-haste/DependencyGraph')
|
||||||
.mock('../../JSTransformer')
|
.mock('../../JSTransformer')
|
||||||
.mock('../../Resolver')
|
|
||||||
.mock('metro-core')
|
.mock('metro-core')
|
||||||
.mock('/path/to/transformer.js', () => ({}), {virtual: true});
|
.mock('/path/to/transformer.js', () => ({}), {virtual: true});
|
||||||
|
|
||||||
var Bundler = require('../');
|
var Bundler = require('../');
|
||||||
var Resolver = require('../../Resolver');
|
|
||||||
var defaults = require('../../defaults');
|
var defaults = require('../../defaults');
|
||||||
var sizeOf = require('image-size');
|
var sizeOf = require('image-size');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
@ -62,10 +60,6 @@ describe('Bundler', function() {
|
|||||||
|
|
||||||
projectRoots = ['/root'];
|
projectRoots = ['/root'];
|
||||||
|
|
||||||
Resolver.load = jest
|
|
||||||
.fn()
|
|
||||||
.mockImplementation(opts => Promise.resolve(new Resolver(opts)));
|
|
||||||
|
|
||||||
fs.__setMockFilesystem({
|
fs.__setMockFilesystem({
|
||||||
path: {to: {'transformer.js': ''}},
|
path: {to: {'transformer.js': ''}},
|
||||||
});
|
});
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Resolver = require('../Resolver');
|
const DependencyGraph = require('../node-haste/DependencyGraph');
|
||||||
const Transformer = require('../JSTransformer');
|
const Transformer = require('../JSTransformer');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
@ -105,7 +105,7 @@ export type Options = {|
|
|||||||
class Bundler {
|
class Bundler {
|
||||||
_opts: Options;
|
_opts: Options;
|
||||||
_transformer: Transformer;
|
_transformer: Transformer;
|
||||||
_resolverPromise: Promise<Resolver>;
|
_depGraphPromise: Promise<DependencyGraph>;
|
||||||
_projectRoots: $ReadOnlyArray<string>;
|
_projectRoots: $ReadOnlyArray<string>;
|
||||||
_getTransformOptions: void | GetTransformOptions;
|
_getTransformOptions: void | GetTransformOptions;
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ class Bundler {
|
|||||||
opts.workerPath || undefined,
|
opts.workerPath || undefined,
|
||||||
);
|
);
|
||||||
|
|
||||||
this._resolverPromise = Resolver.load({
|
this._depGraphPromise = DependencyGraph.load({
|
||||||
assetExts: opts.assetExts,
|
assetExts: opts.assetExts,
|
||||||
assetRegistryPath: opts.assetRegistryPath,
|
assetRegistryPath: opts.assetRegistryPath,
|
||||||
blacklistRE: opts.blacklistRE,
|
blacklistRE: opts.blacklistRE,
|
||||||
@ -172,11 +172,8 @@ class Bundler {
|
|||||||
|
|
||||||
async end() {
|
async end() {
|
||||||
this._transformer.kill();
|
this._transformer.kill();
|
||||||
await this._resolverPromise.then(resolver =>
|
await this._depGraphPromise.then(dependencyGraph =>
|
||||||
resolver
|
dependencyGraph.getWatcher().end(),
|
||||||
.getDependencyGraph()
|
|
||||||
.getWatcher()
|
|
||||||
.end(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,8 +245,8 @@ class Bundler {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getResolver(): Promise<Resolver> {
|
getDependencyGraph(): Promise<DependencyGraph> {
|
||||||
return this._resolverPromise;
|
return this._depGraphPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
async minifyModule(
|
async minifyModule(
|
||||||
|
@ -25,8 +25,8 @@ const {EventEmitter} = require('events');
|
|||||||
|
|
||||||
import type Bundler from '../Bundler';
|
import type Bundler from '../Bundler';
|
||||||
import type {Options as JSTransformerOptions} from '../JSTransformer/worker';
|
import type {Options as JSTransformerOptions} from '../JSTransformer/worker';
|
||||||
import type Resolver from '../Resolver';
|
|
||||||
import type {CompactRawMappings} from '../lib/SourceMap';
|
import type {CompactRawMappings} from '../lib/SourceMap';
|
||||||
|
import type DependencyGraph from '../node-haste/DependencyGraph';
|
||||||
import type Module from '../node-haste/Module';
|
import type Module from '../node-haste/Module';
|
||||||
import type {Options as BundleOptions, MainOptions} from './';
|
import type {Options as BundleOptions, MainOptions} from './';
|
||||||
import type {DependencyEdges} from './traverseDependencies';
|
import type {DependencyEdges} from './traverseDependencies';
|
||||||
@ -78,7 +78,7 @@ const globalCreateModuleId = createModuleIdFactory();
|
|||||||
*/
|
*/
|
||||||
class DeltaTransformer extends EventEmitter {
|
class DeltaTransformer extends EventEmitter {
|
||||||
_bundler: Bundler;
|
_bundler: Bundler;
|
||||||
_resolver: Resolver;
|
_dependencyGraph: DependencyGraph;
|
||||||
_getPolyfills: ({platform: ?string}) => $ReadOnlyArray<string>;
|
_getPolyfills: ({platform: ?string}) => $ReadOnlyArray<string>;
|
||||||
_polyfillModuleNames: $ReadOnlyArray<string>;
|
_polyfillModuleNames: $ReadOnlyArray<string>;
|
||||||
_getModuleId: (path: string) => number;
|
_getModuleId: (path: string) => number;
|
||||||
@ -88,7 +88,7 @@ class DeltaTransformer extends EventEmitter {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
bundler: Bundler,
|
bundler: Bundler,
|
||||||
resolver: Resolver,
|
dependencyGraph: DependencyGraph,
|
||||||
deltaCalculator: DeltaCalculator,
|
deltaCalculator: DeltaCalculator,
|
||||||
options: MainOptions,
|
options: MainOptions,
|
||||||
bundleOptions: BundleOptions,
|
bundleOptions: BundleOptions,
|
||||||
@ -96,7 +96,7 @@ class DeltaTransformer extends EventEmitter {
|
|||||||
super();
|
super();
|
||||||
|
|
||||||
this._bundler = bundler;
|
this._bundler = bundler;
|
||||||
this._resolver = resolver;
|
this._dependencyGraph = dependencyGraph;
|
||||||
this._deltaCalculator = deltaCalculator;
|
this._deltaCalculator = deltaCalculator;
|
||||||
this._getPolyfills = options.getPolyfills;
|
this._getPolyfills = options.getPolyfills;
|
||||||
this._polyfillModuleNames = options.polyfillModuleNames;
|
this._polyfillModuleNames = options.polyfillModuleNames;
|
||||||
@ -121,17 +121,17 @@ class DeltaTransformer extends EventEmitter {
|
|||||||
options: MainOptions,
|
options: MainOptions,
|
||||||
bundleOptions: BundleOptions,
|
bundleOptions: BundleOptions,
|
||||||
): Promise<DeltaTransformer> {
|
): Promise<DeltaTransformer> {
|
||||||
const resolver = await bundler.getResolver();
|
const dependencyGraph = await bundler.getDependencyGraph();
|
||||||
|
|
||||||
const deltaCalculator = new DeltaCalculator(
|
const deltaCalculator = new DeltaCalculator(
|
||||||
bundler,
|
bundler,
|
||||||
resolver.getDependencyGraph(),
|
dependencyGraph,
|
||||||
bundleOptions,
|
bundleOptions,
|
||||||
);
|
);
|
||||||
|
|
||||||
return new DeltaTransformer(
|
return new DeltaTransformer(
|
||||||
bundler,
|
bundler,
|
||||||
resolver,
|
dependencyGraph,
|
||||||
deltaCalculator,
|
deltaCalculator,
|
||||||
options,
|
options,
|
||||||
bundleOptions,
|
bundleOptions,
|
||||||
@ -335,7 +335,7 @@ class DeltaTransformer extends EventEmitter {
|
|||||||
const modules = this._getModuleSystemDependencies()
|
const modules = this._getModuleSystemDependencies()
|
||||||
.concat(polyfillModuleNames)
|
.concat(polyfillModuleNames)
|
||||||
.map(polyfillModuleName =>
|
.map(polyfillModuleName =>
|
||||||
this._resolver.getDependencyGraph().createPolyfill({
|
this._dependencyGraph.createPolyfill({
|
||||||
file: polyfillModuleName,
|
file: polyfillModuleName,
|
||||||
id: polyfillModuleName,
|
id: polyfillModuleName,
|
||||||
dependencies: [],
|
dependencies: [],
|
||||||
@ -350,12 +350,10 @@ class DeltaTransformer extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _getAppend(dependencyEdges: DependencyEdges): Promise<DeltaEntries> {
|
async _getAppend(dependencyEdges: DependencyEdges): Promise<DeltaEntries> {
|
||||||
const dependencyGraph = this._resolver.getDependencyGraph();
|
|
||||||
|
|
||||||
// Get the absolute path of the entry file, in order to be able to get the
|
// Get the absolute path of the entry file, in order to be able to get the
|
||||||
// actual correspondant module (and its moduleId) to be able to add the
|
// actual correspondant module (and its moduleId) to be able to add the
|
||||||
// correct require(); call at the very end of the bundle.
|
// correct require(); call at the very end of the bundle.
|
||||||
const entryPointModulePath = dependencyGraph.getAbsolutePath(
|
const entryPointModulePath = this._dependencyGraph.getAbsolutePath(
|
||||||
this._bundleOptions.entryFile,
|
this._bundleOptions.entryFile,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
jest.mock('../../Bundler');
|
jest.mock('../../Bundler');
|
||||||
jest.mock('../../Resolver');
|
|
||||||
jest.mock('../traverseDependencies');
|
jest.mock('../traverseDependencies');
|
||||||
|
|
||||||
const Bundler = require('../../Bundler');
|
const Bundler = require('../../Bundler');
|
||||||
|
@ -16,6 +16,7 @@ jest
|
|||||||
.mock('assert')
|
.mock('assert')
|
||||||
.mock('progress')
|
.mock('progress')
|
||||||
.mock('../DeltaCalculator')
|
.mock('../DeltaCalculator')
|
||||||
|
.mock('../../node-haste/DependencyGraph')
|
||||||
.mock('../../JSTransformer')
|
.mock('../../JSTransformer')
|
||||||
.mock('/root/to/something.js', () => ({}), {virtual: true})
|
.mock('/root/to/something.js', () => ({}), {virtual: true})
|
||||||
.mock('/path/to/transformer.js', () => ({}), {virtual: true});
|
.mock('/path/to/transformer.js', () => ({}), {virtual: true});
|
||||||
@ -23,8 +24,8 @@ jest
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
const Bundler = require('../../Bundler');
|
const Bundler = require('../../Bundler');
|
||||||
const Resolver = require('../../Resolver');
|
|
||||||
const DeltaTransformer = require('../DeltaTransformer');
|
const DeltaTransformer = require('../DeltaTransformer');
|
||||||
|
const DependencyGraph = require('../../node-haste/DependencyGraph');
|
||||||
|
|
||||||
const defaults = require('../../defaults');
|
const defaults = require('../../defaults');
|
||||||
|
|
||||||
@ -48,9 +49,9 @@ const bundlerOptions = {
|
|||||||
describe('DeltaTransformer', () => {
|
describe('DeltaTransformer', () => {
|
||||||
let bundler;
|
let bundler;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
Resolver.load = jest
|
DependencyGraph.load = jest
|
||||||
.fn()
|
.fn()
|
||||||
.mockImplementation(opts => Promise.resolve(new Resolver(opts)));
|
.mockImplementation(opts => Promise.resolve(new DependencyGraph(opts)));
|
||||||
|
|
||||||
fs.__setMockFilesystem({
|
fs.__setMockFilesystem({
|
||||||
path: {to: {'transformer.js': ''}},
|
path: {to: {'transformer.js': ''}},
|
||||||
|
@ -103,12 +103,10 @@ describe('traverseDependencies', function() {
|
|||||||
emptyTransformOptions = {transformer: {transform: {}}};
|
emptyTransformOptions = {transformer: {transform: {}}};
|
||||||
defaults = {
|
defaults = {
|
||||||
assetExts: ['png', 'jpg'],
|
assetExts: ['png', 'jpg'],
|
||||||
forceNodeFilesystemAPI: true,
|
// This pattern is not expected to match anything.
|
||||||
|
blacklistRE: /.^/,
|
||||||
providesModuleNodeModules: ['haste-fbjs', 'react-haste', 'react-native'],
|
providesModuleNodeModules: ['haste-fbjs', 'react-haste', 'react-native'],
|
||||||
platforms: new Set(['ios', 'android']),
|
platforms: new Set(['ios', 'android']),
|
||||||
useWatchman: false,
|
|
||||||
// This pattern is not expected to match anything.
|
|
||||||
ignorePattern: /.^/,
|
|
||||||
maxWorkers: 1,
|
maxWorkers: 1,
|
||||||
resetCache: true,
|
resetCache: true,
|
||||||
transformCache: require('TransformCaching').mocked(),
|
transformCache: require('TransformCaching').mocked(),
|
||||||
@ -164,7 +162,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -219,7 +217,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -261,7 +259,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -305,7 +303,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -353,7 +351,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -397,7 +395,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -446,7 +444,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -509,7 +507,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -568,7 +566,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -613,7 +611,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -658,7 +656,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -711,7 +709,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -757,7 +755,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -798,7 +796,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -840,7 +838,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -879,7 +877,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -922,7 +920,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -959,7 +957,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -987,7 +985,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
|
|
||||||
// FIXME: This is broken, jest-haste-map does not fatal on modules with
|
// FIXME: This is broken, jest-haste-map does not fatal on modules with
|
||||||
// the same name, because not fataling was required for supporting some
|
// the same name, because not fataling was required for supporting some
|
||||||
@ -1022,7 +1020,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
try {
|
try {
|
||||||
await getOrderedDependenciesAsJSON(dgraph, '/root/index.js');
|
await getOrderedDependenciesAsJSON(dgraph, '/root/index.js');
|
||||||
@ -1060,7 +1058,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1113,7 +1111,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1202,7 +1200,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1263,7 +1261,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1322,7 +1320,11 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, assetExts: ['png', 'jpg'], roots: [root]};
|
const opts = {
|
||||||
|
...defaults,
|
||||||
|
assetExts: ['png', 'jpg'],
|
||||||
|
projectRoots: [root],
|
||||||
|
};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1379,7 +1381,11 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, assetExts: ['png', 'jpg'], roots: [root]};
|
const opts = {
|
||||||
|
...defaults,
|
||||||
|
assetExts: ['png', 'jpg'],
|
||||||
|
projectRoots: [root],
|
||||||
|
};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1439,7 +1445,11 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, assetExts: ['png', 'jpg'], roots: [root]};
|
const opts = {
|
||||||
|
...defaults,
|
||||||
|
assetExts: ['png', 'jpg'],
|
||||||
|
projectRoots: [root],
|
||||||
|
};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1513,7 +1523,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1608,7 +1618,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1682,7 +1692,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1763,7 +1773,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1834,7 +1844,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1901,7 +1911,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -1980,7 +1990,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -2028,7 +2038,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -2135,7 +2145,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -2204,7 +2214,7 @@ describe('traverseDependencies', function() {
|
|||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
...defaults,
|
...defaults,
|
||||||
roots: [root],
|
projectRoots: [root],
|
||||||
extraNodeModules: {
|
extraNodeModules: {
|
||||||
bar: root + '/provides-bar',
|
bar: root + '/provides-bar',
|
||||||
},
|
},
|
||||||
@ -2252,7 +2262,7 @@ describe('traverseDependencies', function() {
|
|||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
...defaults,
|
...defaults,
|
||||||
roots: [root],
|
projectRoots: [root],
|
||||||
extraNodeModules: {
|
extraNodeModules: {
|
||||||
bar: root + '/provides-bar',
|
bar: root + '/provides-bar',
|
||||||
},
|
},
|
||||||
@ -2295,7 +2305,7 @@ describe('traverseDependencies', function() {
|
|||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
...defaults,
|
...defaults,
|
||||||
roots: [root],
|
projectRoots: [root],
|
||||||
extraNodeModules: {
|
extraNodeModules: {
|
||||||
bar: root + '/provides-bar',
|
bar: root + '/provides-bar',
|
||||||
},
|
},
|
||||||
@ -2359,7 +2369,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -2406,7 +2416,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -2455,7 +2465,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -2549,7 +2559,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -2617,7 +2627,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -2690,7 +2700,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -2773,7 +2783,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -2845,7 +2855,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -2974,7 +2984,7 @@ describe('traverseDependencies', function() {
|
|||||||
};
|
};
|
||||||
setMockFileSystem(filesystem);
|
setMockFileSystem(filesystem);
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root, otherRoot]};
|
const opts = {...defaults, projectRoots: [root, otherRoot]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
try {
|
try {
|
||||||
await getOrderedDependenciesAsJSON(dgraph, '/root/index.js');
|
await getOrderedDependenciesAsJSON(dgraph, '/root/index.js');
|
||||||
@ -3070,7 +3080,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -3117,7 +3127,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -3170,7 +3180,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -3227,7 +3237,7 @@ describe('traverseDependencies', function() {
|
|||||||
const opts = {
|
const opts = {
|
||||||
...defaults,
|
...defaults,
|
||||||
platforms: new Set(['ios', 'android', 'web']),
|
platforms: new Set(['ios', 'android', 'web']),
|
||||||
roots: [root],
|
projectRoots: [root],
|
||||||
};
|
};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
@ -3269,7 +3279,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -3324,7 +3334,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -3377,7 +3387,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -3464,7 +3474,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -3532,7 +3542,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -3605,7 +3615,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -3688,7 +3698,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -3760,7 +3770,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -3889,7 +3899,7 @@ describe('traverseDependencies', function() {
|
|||||||
};
|
};
|
||||||
setMockFileSystem(filesystem);
|
setMockFileSystem(filesystem);
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root, otherRoot]};
|
const opts = {...defaults, projectRoots: [root, otherRoot]};
|
||||||
const entryPath = 'C:\\root\\index.js';
|
const entryPath = 'C:\\root\\index.js';
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
try {
|
try {
|
||||||
@ -3984,7 +3994,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -4031,7 +4041,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -4084,7 +4094,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -4138,7 +4148,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -4179,7 +4189,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -4234,7 +4244,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -4316,7 +4326,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
const entryPath = '/root/index.js';
|
const entryPath = '/root/index.js';
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
||||||
@ -4372,7 +4382,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
const entryPath = '/root/index.js';
|
const entryPath = '/root/index.js';
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
||||||
@ -4428,7 +4438,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
const entryPath = '/root/index.js';
|
const entryPath = '/root/index.js';
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
||||||
@ -4475,7 +4485,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
const entryPath = '/root/index.js';
|
const entryPath = '/root/index.js';
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
||||||
@ -4544,7 +4554,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, assetExts: ['png'], roots: [root]};
|
const opts = {...defaults, assetExts: ['png'], projectRoots: [root]};
|
||||||
const entryPath = '/root/index.js';
|
const entryPath = '/root/index.js';
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
try {
|
try {
|
||||||
@ -4603,7 +4613,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
const entryPath = '/root/index.js';
|
const entryPath = '/root/index.js';
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
||||||
@ -4660,7 +4670,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
const entryPath = '/root/index.js';
|
const entryPath = '/root/index.js';
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
||||||
@ -4732,7 +4742,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
const entryPath = '/root/index.js';
|
const entryPath = '/root/index.js';
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
const deps = await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
||||||
@ -4816,7 +4826,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
const entryPath = '/root/index.js';
|
const entryPath = '/root/index.js';
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
||||||
@ -4873,7 +4883,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
const entryPath = '/root/index.js';
|
const entryPath = '/root/index.js';
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
||||||
@ -4900,7 +4910,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
const entryPath = '/root/index.js';
|
const entryPath = '/root/index.js';
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
||||||
@ -4960,7 +4970,11 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root], sourceExts: ['jsx', 'coffee']};
|
const opts = {
|
||||||
|
...defaults,
|
||||||
|
projectRoots: [root],
|
||||||
|
sourceExts: ['jsx', 'coffee'],
|
||||||
|
};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const entryPath = '/root/index.jsx';
|
const entryPath = '/root/index.jsx';
|
||||||
const deps = await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
const deps = await getOrderedDependenciesAsJSON(dgraph, entryPath);
|
||||||
@ -4993,7 +5007,11 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root], sourceExts: ['jsx', 'coffee']};
|
const opts = {
|
||||||
|
...defaults,
|
||||||
|
projectRoots: [root],
|
||||||
|
sourceExts: ['jsx', 'coffee'],
|
||||||
|
};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const deps = await getOrderedDependenciesAsJSON(
|
const deps = await getOrderedDependenciesAsJSON(
|
||||||
dgraph,
|
dgraph,
|
||||||
@ -5028,7 +5046,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, roots: [root]};
|
const opts = {...defaults, projectRoots: [root]};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
try {
|
try {
|
||||||
await getOrderedDependenciesAsJSON(dgraph, '/root/index.jsx');
|
await getOrderedDependenciesAsJSON(dgraph, '/root/index.jsx');
|
||||||
@ -5082,10 +5100,13 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const DependencyGraph = require('../../node-haste/DependencyGraph');
|
const DependencyGraph = require('../../node-haste/DependencyGraph');
|
||||||
return DependencyGraph.load({
|
return DependencyGraph.load(
|
||||||
...defaults,
|
{
|
||||||
roots: ['/root'],
|
...defaults,
|
||||||
}).then(dg => {
|
projectRoots: ['/root'],
|
||||||
|
},
|
||||||
|
false /* since we're mocking the filesystem, we cannot use watchman */,
|
||||||
|
).then(dg => {
|
||||||
dependencyGraph = dg;
|
dependencyGraph = dg;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -5130,7 +5151,7 @@ describe('traverseDependencies', function() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const opts = {...defaults, assetDependencies, roots: ['/root']};
|
const opts = {...defaults, assetDependencies, projectRoots: ['/root']};
|
||||||
await processDgraph(opts, async dgraph => {
|
await processDgraph(opts, async dgraph => {
|
||||||
const {dependencies} = await dgraph.getDependencies({
|
const {dependencies} = await dgraph.getDependencies({
|
||||||
entryPath: '/root/index.js',
|
entryPath: '/root/index.js',
|
||||||
@ -5170,10 +5191,13 @@ describe('traverseDependencies', function() {
|
|||||||
'f.js': 'require("./c");', // circular dependency
|
'f.js': 'require("./c");', // circular dependency
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
dependencyGraph = DependencyGraph.load({
|
dependencyGraph = DependencyGraph.load(
|
||||||
...defaults,
|
{
|
||||||
roots: ['/root'],
|
...defaults,
|
||||||
});
|
projectRoots: ['/root'],
|
||||||
|
},
|
||||||
|
false /* since we're mocking the filesystem, we cannot use watchman */,
|
||||||
|
);
|
||||||
moduleReadDeferreds = {};
|
moduleReadDeferreds = {};
|
||||||
callDeferreds = [defer(), defer()]; // [a.js, b.js]
|
callDeferreds = [defer(), defer()]; // [a.js, b.js]
|
||||||
|
|
||||||
@ -5276,10 +5300,13 @@ describe('traverseDependencies', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
DependencyGraph = require('../../node-haste/DependencyGraph');
|
DependencyGraph = require('../../node-haste/DependencyGraph');
|
||||||
dependencyGraph = await DependencyGraph.load({
|
dependencyGraph = await DependencyGraph.load(
|
||||||
...defaults,
|
{
|
||||||
roots: ['/root'],
|
...defaults,
|
||||||
});
|
projectRoots: ['/root'],
|
||||||
|
},
|
||||||
|
false /* since we're mocking the filesystem, we cannot use watchman */,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -5305,7 +5332,10 @@ describe('traverseDependencies', function() {
|
|||||||
* (regardless if the test passes or fails).
|
* (regardless if the test passes or fails).
|
||||||
*/
|
*/
|
||||||
async function processDgraphFor(DependencyGraph, options, processor) {
|
async function processDgraphFor(DependencyGraph, options, processor) {
|
||||||
const dgraph = await DependencyGraph.load(options);
|
const dgraph = await DependencyGraph.load(
|
||||||
|
options,
|
||||||
|
false /* since we're mocking the filesystem, we cannot use watchman */,
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
await processor(dgraph);
|
await processor(dgraph);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2015-present, Facebook, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the BSD-style license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
|
||||||
*
|
|
||||||
* @flow
|
|
||||||
* @format
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const DependencyGraph = require('../node-haste/DependencyGraph');
|
|
||||||
|
|
||||||
import type {GlobalTransformCache} from '../lib/GlobalTransformCache';
|
|
||||||
import type {
|
|
||||||
TransformCache,
|
|
||||||
GetTransformCacheKey,
|
|
||||||
} from '../lib/TransformCaching';
|
|
||||||
import type {Reporter} from '../lib/reporting';
|
|
||||||
import type {HasteImpl, TransformCode} from '../node-haste/Module';
|
|
||||||
|
|
||||||
type Options = {|
|
|
||||||
+assetExts: Array<string>,
|
|
||||||
+assetRegistryPath: string,
|
|
||||||
+blacklistRE?: RegExp,
|
|
||||||
+extraNodeModules: ?{},
|
|
||||||
+getPolyfills: ({platform: ?string}) => $ReadOnlyArray<string>,
|
|
||||||
+getTransformCacheKey: GetTransformCacheKey,
|
|
||||||
+globalTransformCache: ?GlobalTransformCache,
|
|
||||||
+hasteImpl?: ?HasteImpl,
|
|
||||||
+maxWorkers: number,
|
|
||||||
+platforms: Set<string>,
|
|
||||||
+polyfillModuleNames?: Array<string>,
|
|
||||||
+projectRoots: $ReadOnlyArray<string>,
|
|
||||||
+providesModuleNodeModules: Array<string>,
|
|
||||||
+reporter: Reporter,
|
|
||||||
+resetCache: boolean,
|
|
||||||
+sourceExts: Array<string>,
|
|
||||||
+transformCache: TransformCache,
|
|
||||||
+transformCode: TransformCode,
|
|
||||||
+watch: boolean,
|
|
||||||
|};
|
|
||||||
|
|
||||||
class Resolver {
|
|
||||||
_depGraph: DependencyGraph;
|
|
||||||
|
|
||||||
constructor(opts: Options, depGraph: DependencyGraph) {
|
|
||||||
this._depGraph = depGraph;
|
|
||||||
}
|
|
||||||
|
|
||||||
static async load(opts: Options): Promise<Resolver> {
|
|
||||||
const depGraph = await DependencyGraph.load({
|
|
||||||
assetDependencies: [opts.assetRegistryPath],
|
|
||||||
assetExts: opts.assetExts,
|
|
||||||
extraNodeModules: opts.extraNodeModules,
|
|
||||||
forceNodeFilesystemAPI: false,
|
|
||||||
getTransformCacheKey: opts.getTransformCacheKey,
|
|
||||||
globalTransformCache: opts.globalTransformCache,
|
|
||||||
hasteImpl: opts.hasteImpl,
|
|
||||||
ignorePattern: opts.blacklistRE || / ^/ /* matches nothing */,
|
|
||||||
maxWorkers: opts.maxWorkers,
|
|
||||||
platforms: opts.platforms,
|
|
||||||
preferNativePlatform: true,
|
|
||||||
providesModuleNodeModules: opts.providesModuleNodeModules,
|
|
||||||
reporter: opts.reporter,
|
|
||||||
resetCache: opts.resetCache,
|
|
||||||
roots: opts.projectRoots,
|
|
||||||
sourceExts: opts.sourceExts,
|
|
||||||
transformCache: opts.transformCache,
|
|
||||||
transformCode: opts.transformCode,
|
|
||||||
useWatchman: true,
|
|
||||||
watch: opts.watch,
|
|
||||||
});
|
|
||||||
return new Resolver(opts, depGraph);
|
|
||||||
}
|
|
||||||
|
|
||||||
getDependencyGraph(): DependencyGraph {
|
|
||||||
return this._depGraph;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Resolver;
|
|
@ -109,12 +109,10 @@ describe('processRequest', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Bundler.prototype.invalidateFile = invalidatorFunc;
|
Bundler.prototype.invalidateFile = invalidatorFunc;
|
||||||
Bundler.prototype.getResolver = jest.fn().mockReturnValue(
|
Bundler.prototype.getDependencyGraph = jest.fn().mockReturnValue(
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
getDependencyGraph: jest.fn().mockReturnValue({
|
getHasteMap: jest.fn().mockReturnValue({on: jest.fn()}),
|
||||||
getHasteMap: jest.fn().mockReturnValue({on: jest.fn()}),
|
load: jest.fn(() => Promise.resolve()),
|
||||||
load: jest.fn(() => Promise.resolve()),
|
|
||||||
}),
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -169,9 +169,8 @@ class Server {
|
|||||||
this._bundler = new Bundler(bundlerOpts);
|
this._bundler = new Bundler(bundlerOpts);
|
||||||
|
|
||||||
// changes to the haste map can affect resolution of files in the bundle
|
// changes to the haste map can affect resolution of files in the bundle
|
||||||
this._bundler.getResolver().then(resolver => {
|
this._bundler.getDependencyGraph().then(dependencyGraph => {
|
||||||
resolver
|
dependencyGraph
|
||||||
.getDependencyGraph()
|
|
||||||
.getWatcher()
|
.getWatcher()
|
||||||
.on('change', ({eventsQueue}) =>
|
.on('change', ({eventsQueue}) =>
|
||||||
eventsQueue.forEach(processFileChange),
|
eventsQueue.forEach(processFileChange),
|
||||||
|
@ -45,26 +45,24 @@ import type Package from './Package';
|
|||||||
import type {HasteFS} from './types';
|
import type {HasteFS} from './types';
|
||||||
|
|
||||||
type Options = {|
|
type Options = {|
|
||||||
+assetDependencies: Array<string>,
|
|
||||||
+assetExts: Array<string>,
|
+assetExts: Array<string>,
|
||||||
|
+assetRegistryPath: string,
|
||||||
|
+blacklistRE?: RegExp,
|
||||||
+extraNodeModules: ?{},
|
+extraNodeModules: ?{},
|
||||||
+forceNodeFilesystemAPI: boolean,
|
+getPolyfills: ({platform: ?string}) => $ReadOnlyArray<string>,
|
||||||
+getTransformCacheKey: GetTransformCacheKey,
|
+getTransformCacheKey: GetTransformCacheKey,
|
||||||
+globalTransformCache: ?GlobalTransformCache,
|
+globalTransformCache: ?GlobalTransformCache,
|
||||||
+hasteImpl: ?HasteImpl,
|
+hasteImpl?: ?HasteImpl,
|
||||||
+ignorePattern: RegExp,
|
|
||||||
+maxWorkers: number,
|
+maxWorkers: number,
|
||||||
+platforms: Set<string>,
|
+platforms: Set<string>,
|
||||||
+preferNativePlatform: boolean,
|
+polyfillModuleNames?: Array<string>,
|
||||||
|
+projectRoots: $ReadOnlyArray<string>,
|
||||||
+providesModuleNodeModules: Array<string>,
|
+providesModuleNodeModules: Array<string>,
|
||||||
+reporter: Reporter,
|
+reporter: Reporter,
|
||||||
+resetCache: ?boolean,
|
|
||||||
+resetCache: boolean,
|
+resetCache: boolean,
|
||||||
+roots: $ReadOnlyArray<string>,
|
|
||||||
+sourceExts: Array<string>,
|
+sourceExts: Array<string>,
|
||||||
+transformCache: TransformCache,
|
+transformCache: TransformCache,
|
||||||
+transformCode: TransformCode,
|
+transformCode: TransformCode,
|
||||||
+useWatchman: boolean,
|
|
||||||
+watch: boolean,
|
+watch: boolean,
|
||||||
|};
|
|};
|
||||||
|
|
||||||
@ -106,11 +104,14 @@ class DependencyGraph extends EventEmitter {
|
|||||||
this._createModuleResolver();
|
this._createModuleResolver();
|
||||||
}
|
}
|
||||||
|
|
||||||
static _createHaste(opts: Options): JestHasteMap {
|
static _createHaste(
|
||||||
|
opts: Options,
|
||||||
|
useWatchman?: boolean = true,
|
||||||
|
): JestHasteMap {
|
||||||
return new JestHasteMap({
|
return new JestHasteMap({
|
||||||
extensions: opts.sourceExts.concat(opts.assetExts),
|
extensions: opts.sourceExts.concat(opts.assetExts),
|
||||||
forceNodeFilesystemAPI: opts.forceNodeFilesystemAPI,
|
forceNodeFilesystemAPI: !useWatchman,
|
||||||
ignorePattern: opts.ignorePattern,
|
ignorePattern: opts.blacklistRE || / ^/,
|
||||||
maxWorkers: opts.maxWorkers,
|
maxWorkers: opts.maxWorkers,
|
||||||
mocksPattern: '',
|
mocksPattern: '',
|
||||||
name: 'metro-' + JEST_HASTE_MAP_CACHE_BREAKER,
|
name: 'metro-' + JEST_HASTE_MAP_CACHE_BREAKER,
|
||||||
@ -118,19 +119,24 @@ class DependencyGraph extends EventEmitter {
|
|||||||
providesModuleNodeModules: opts.providesModuleNodeModules,
|
providesModuleNodeModules: opts.providesModuleNodeModules,
|
||||||
resetCache: opts.resetCache,
|
resetCache: opts.resetCache,
|
||||||
retainAllFiles: true,
|
retainAllFiles: true,
|
||||||
roots: opts.roots,
|
roots: opts.projectRoots,
|
||||||
useWatchman: opts.useWatchman,
|
useWatchman,
|
||||||
watch: opts.watch,
|
watch: opts.watch,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static async load(opts: Options): Promise<DependencyGraph> {
|
static _getJestHasteMapOptions(opts: Options) {}
|
||||||
|
|
||||||
|
static async load(
|
||||||
|
opts: Options,
|
||||||
|
useWatchman?: boolean = true,
|
||||||
|
): Promise<DependencyGraph> {
|
||||||
const initializingMetroLogEntry = log(
|
const initializingMetroLogEntry = log(
|
||||||
createActionStartEntry('Initializing Metro'),
|
createActionStartEntry('Initializing Metro'),
|
||||||
);
|
);
|
||||||
|
|
||||||
opts.reporter.update({type: 'dep_graph_loading'});
|
opts.reporter.update({type: 'dep_graph_loading'});
|
||||||
const haste = DependencyGraph._createHaste(opts);
|
const haste = DependencyGraph._createHaste(opts, useWatchman);
|
||||||
const {hasteFS, moduleMap} = await haste.build();
|
const {hasteFS, moduleMap} = await haste.build();
|
||||||
|
|
||||||
log(createActionEndEntry(initializingMetroLogEntry));
|
log(createActionEndEntry(initializingMetroLogEntry));
|
||||||
@ -183,7 +189,7 @@ class DependencyGraph extends EventEmitter {
|
|||||||
isAssetFile: filePath => this._helpers.isAssetFile(filePath),
|
isAssetFile: filePath => this._helpers.isAssetFile(filePath),
|
||||||
moduleCache: this._moduleCache,
|
moduleCache: this._moduleCache,
|
||||||
moduleMap: this._moduleMap,
|
moduleMap: this._moduleMap,
|
||||||
preferNativePlatform: this._opts.preferNativePlatform,
|
preferNativePlatform: true,
|
||||||
resolveAsset: (dirPath, assetName, platform) =>
|
resolveAsset: (dirPath, assetName, platform) =>
|
||||||
this._assetResolutionCache.resolve(dirPath, assetName, platform),
|
this._assetResolutionCache.resolve(dirPath, assetName, platform),
|
||||||
sourceExts: this._opts.sourceExts,
|
sourceExts: this._opts.sourceExts,
|
||||||
@ -194,7 +200,7 @@ class DependencyGraph extends EventEmitter {
|
|||||||
const {_opts} = this;
|
const {_opts} = this;
|
||||||
return new ModuleCache(
|
return new ModuleCache(
|
||||||
{
|
{
|
||||||
assetDependencies: _opts.assetDependencies,
|
assetDependencies: [_opts.assetRegistryPath],
|
||||||
depGraphHelpers: this._helpers,
|
depGraphHelpers: this._helpers,
|
||||||
getClosestPackage: this._getClosestPackage.bind(this),
|
getClosestPackage: this._getClosestPackage.bind(this),
|
||||||
getTransformCacheKey: _opts.getTransformCacheKey,
|
getTransformCacheKey: _opts.getTransformCacheKey,
|
||||||
@ -203,7 +209,7 @@ class DependencyGraph extends EventEmitter {
|
|||||||
resetCache: _opts.resetCache,
|
resetCache: _opts.resetCache,
|
||||||
transformCache: _opts.transformCache,
|
transformCache: _opts.transformCache,
|
||||||
reporter: _opts.reporter,
|
reporter: _opts.reporter,
|
||||||
roots: _opts.roots,
|
roots: _opts.projectRoots,
|
||||||
transformCode: _opts.transformCode,
|
transformCode: _opts.transformCode,
|
||||||
},
|
},
|
||||||
_opts.platforms,
|
_opts.platforms,
|
||||||
@ -274,8 +280,8 @@ class DependencyGraph extends EventEmitter {
|
|||||||
return path.resolve(filePath);
|
return path.resolve(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < this._opts.roots.length; i++) {
|
for (let i = 0; i < this._opts.projectRoots.length; i++) {
|
||||||
const root = this._opts.roots[i];
|
const root = this._opts.projectRoots[i];
|
||||||
const potentialAbsPath = path.join(root, filePath);
|
const potentialAbsPath = path.join(root, filePath);
|
||||||
if (this._hasteFS.exists(potentialAbsPath)) {
|
if (this._hasteFS.exists(potentialAbsPath)) {
|
||||||
return path.resolve(potentialAbsPath);
|
return path.resolve(potentialAbsPath);
|
||||||
@ -298,7 +304,7 @@ class DependencyGraph extends EventEmitter {
|
|||||||
throw new NotFoundError(
|
throw new NotFoundError(
|
||||||
'Cannot find entry file %s in any of the roots: %j',
|
'Cannot find entry file %s in any of the roots: %j',
|
||||||
filePath,
|
filePath,
|
||||||
this._opts.roots,
|
this._opts.projectRoots,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user