Rename edge to module in DeltaBundler

Reviewed By: jeanlauliac

Differential Revision: D7652219

fbshipit-source-id: 88922711eaccd0a6bff1a0f3cc9bfaa770f4c275
This commit is contained in:
Rafael Oleza 2018-04-18 12:09:04 -07:00 committed by Facebook Github Bot
parent 2446fe2211
commit 47793c25a5
17 changed files with 152 additions and 151 deletions

View File

@ -18,10 +18,10 @@ const {
const {EventEmitter} = require('events');
import type DependencyGraph from '../node-haste/DependencyGraph';
import type {DependencyEdge, Graph, Options} from './traverseDependencies';
import type {Graph, Module, Options} from './traverseDependencies';
export type DeltaResult = {|
+modified: Map<string, DependencyEdge>,
+modified: Map<string, Module>,
+deleted: Set<string>,
+reset: boolean,
|};
@ -124,8 +124,8 @@ class DeltaCalculator extends EventEmitter {
modifiedFiles.forEach(file => this._modifiedFiles.add(file));
deletedFiles.forEach(file => this._deletedFiles.add(file));
// If after an error the number of edges has changed, we could be in
// a weird state. As a safe net we clean the dependency edges to force
// If after an error the number of modules has changed, we could be in
// a weird state. As a safe net we clean the dependency modules to force
// a clean traversal of the graph next time.
if (this._graph.dependencies.size !== numDependencies) {
this._graph.dependencies = new Map();
@ -151,7 +151,7 @@ class DeltaCalculator extends EventEmitter {
}
/**
* Returns the graph with all the dependency edges. Each edge contains the
* Returns the graph with all the dependencies. Each module contains the
* needed information to do the traversing (dependencies, inverseDependencies)
* plus some metadata.
*/
@ -208,10 +208,10 @@ class DeltaCalculator extends EventEmitter {
// If a file has been deleted, we want to invalidate any other file that
// depends on it, so we can process it and correctly return an error.
deletedFiles.forEach(filePath => {
const edge = this._graph.dependencies.get(filePath);
const module = this._graph.dependencies.get(filePath);
if (edge) {
edge.inverseDependencies.forEach(path => modifiedFiles.add(path));
if (module) {
module.inverseDependencies.forEach(path => modifiedFiles.add(path));
}
});

View File

@ -15,7 +15,7 @@ const getAppendScripts = require('../../lib/getAppendScripts');
const {wrapModule} = require('./helpers/js');
import type {Delta, Graph} from '../../DeltaBundler';
import type {DependencyEdge} from '../traverseDependencies';
import type {Module} from '../traverseDependencies';
type Options = {|
+createModuleId: string => number | string,
@ -28,7 +28,7 @@ type Options = {|
function deltaJSBundle(
entryPoint: string,
pre: $ReadOnlyArray<DependencyEdge>,
pre: $ReadOnlyArray<Module>,
delta: Delta,
sequenceId: string,
graph: Graph,

View File

@ -13,14 +13,14 @@
const {getAssetFiles} = require('../../Assets');
import type {Graph} from '../DeltaCalculator';
import type {DependencyEdge} from '../traverseDependencies';
import type {Module} from '../traverseDependencies';
type Options = {|
platform: ?string,
|};
async function getAllFiles(
pre: $ReadOnlyArray<DependencyEdge>,
pre: $ReadOnlyArray<Module>,
graph: Graph,
options: Options,
): Promise<$ReadOnlyArray<string>> {

View File

@ -21,7 +21,7 @@ const {wrapModule} = require('./helpers/js');
import type {GetTransformOptions} from '../../Bundler';
import type {ModuleTransportLike} from '../../shared/types.flow';
import type {Graph} from '../DeltaCalculator';
import type {DependencyEdge} from '../traverseDependencies';
import type {Module} from '../traverseDependencies';
type Options = {|
+createModuleId: string => number,
@ -44,7 +44,7 @@ export type RamBundleInfo = {|
async function getRamBundleInfo(
entryPoint: string,
pre: $ReadOnlyArray<DependencyEdge>,
pre: $ReadOnlyArray<Module>,
graph: Graph,
options: Options,
): Promise<RamBundleInfo> {

View File

@ -13,7 +13,7 @@
const addParamsToDefineCall = require('../../../lib/addParamsToDefineCall');
const path = require('path');
import type {DependencyEdge} from '../../traverseDependencies';
import type {Module} from '../../traverseDependencies';
export type Options = {
+createModuleId: string => number | string,
@ -25,7 +25,7 @@ export type Options = {
// Make sure to set PRINT_REQUIRE_PATHS = true too, and restart Metro
const PASS_MODULE_PATHS_TO_DEFINE = false;
function wrapModule(module: DependencyEdge, options: Options) {
function wrapModule(module: Module, options: Options) {
if (module.output.type === 'script') {
return module.output.code;
}

View File

@ -15,7 +15,7 @@ const addParamsToDefineCall = require('../../lib/addParamsToDefineCall');
const {wrapModule} = require('./helpers/js');
import type {Delta, Graph} from '../../DeltaBundler';
import type {DependencyEdge} from '../traverseDependencies';
import type {Module} from '../traverseDependencies';
type Options = {
createModuleId: string => number,
@ -48,7 +48,7 @@ function hmrJSBundle(delta: Delta, graph: Graph, options: Options): Result {
}
function _prepareModule(
module: DependencyEdge,
module: Module,
graph: Graph,
options: Options,
): {|+id: number, +code: string|} {

View File

@ -15,7 +15,7 @@ const getAppendScripts = require('../../lib/getAppendScripts');
const {wrapModule} = require('./helpers/js');
import type {Graph} from '../DeltaCalculator';
import type {DependencyEdge} from '../traverseDependencies';
import type {Module} from '../traverseDependencies';
type Options = {|
+createModuleId: string => number | string,
@ -28,7 +28,7 @@ type Options = {|
function plainJSBundle(
entryPoint: string,
pre: $ReadOnlyArray<DependencyEdge>,
pre: $ReadOnlyArray<Module>,
graph: Graph,
options: Options,
): string {

View File

@ -13,11 +13,11 @@
const {fromRawMappings} = require('metro-source-map');
import type {Graph} from '../DeltaCalculator';
import type {DependencyEdge} from '../traverseDependencies';
import type {Module} from '../traverseDependencies';
import type {BabelSourceMap} from '@babel/core';
function fullSourceMapObject(
pre: $ReadOnlyArray<DependencyEdge>,
pre: $ReadOnlyArray<Module>,
graph: Graph,
options: {|+excludeSource: boolean|},
): BabelSourceMap {

View File

@ -13,10 +13,10 @@
const {fromRawMappings} = require('metro-source-map');
import type {Graph} from '../DeltaCalculator';
import type {DependencyEdge} from '../traverseDependencies';
import type {Module} from '../traverseDependencies';
function fullSourceMap(
pre: $ReadOnlyArray<DependencyEdge>,
pre: $ReadOnlyArray<Module>,
graph: Graph,
options: {|+excludeSource: boolean|},
): string {

View File

@ -23,15 +23,10 @@ const {EventEmitter} = require('events');
const DeltaCalculator = require('../DeltaCalculator');
describe('DeltaCalculator', () => {
const entryModule = {path: '/bundle', name: 'bundle'};
const moduleFoo = {path: '/foo', name: 'foo'};
const moduleBar = {path: '/bar', name: 'bar'};
const moduleBaz = {path: '/baz', name: 'baz'};
let edgeModule;
let edgeFoo;
let edgeBar;
let edgeBaz;
let entryModule;
let fooModule;
let barModule;
let bazModule;
let deltaCalculator;
let fileWatcher;
@ -61,48 +56,61 @@ describe('DeltaCalculator', () => {
};
initialTraverseDependencies.mockImplementationOnce(async (graph, opt) => {
edgeModule = {
output: entryModule,
entryModule = {
dependencies: new Map([
['foo', '/foo'],
['bar', '/bar'],
['baz', '/baz'],
]),
inverseDependencies: [],
output: {
name: 'bundle',
},
path: '/bundle',
};
edgeFoo = {
output: moduleFoo,
fooModule = {
dependencies: new Map(),
inverseDependencies: ['/bundle'],
output: {
name: 'foo',
},
path: '/foo',
};
edgeBar = {
output: moduleBar,
barModule = {
dependencies: new Map(),
inverseDependencies: ['/bundle'],
output: {
name: 'bar',
},
path: '/bar',
};
edgeBaz = {
output: moduleBaz,
bazModule = {
dependencies: new Map(),
inverseDependencies: ['/bundle'],
output: {
name: 'baz',
},
path: '/baz',
};
graph.dependencies.set('/bundle', edgeModule);
graph.dependencies.set('/foo', edgeFoo);
graph.dependencies.set('/bar', edgeBar);
graph.dependencies.set('/baz', edgeBaz);
graph.dependencies.set('/bundle', entryModule);
graph.dependencies.set('/foo', fooModule);
graph.dependencies.set('/bar', barModule);
graph.dependencies.set('/baz', bazModule);
return {
added: new Map([
['/bundle', edgeModule],
['/foo', edgeFoo],
['/bar', edgeBar],
['/baz', edgeBaz],
['/bundle', entryModule],
['/foo', fooModule],
['/bar', barModule],
['/baz', bazModule],
]),
deleted: new Set(),
};
});
deltaCalculator = new DeltaCalculator(
[entryModule.path],
['/bundle'],
dependencyGraph,
options,
);
@ -130,10 +138,10 @@ describe('DeltaCalculator', () => {
expect(result).toEqual({
modified: new Map([
['/bundle', edgeModule],
['/foo', edgeFoo],
['/bar', edgeBar],
['/baz', edgeBaz],
['/bundle', entryModule],
['/foo', fooModule],
['/bar', barModule],
['/baz', bazModule],
]),
deleted: new Set(),
reset: true,
@ -161,10 +169,10 @@ describe('DeltaCalculator', () => {
expect(result).toEqual({
modified: new Map([
['/bundle', edgeModule],
['/foo', edgeFoo],
['/bar', edgeBar],
['/baz', edgeBaz],
['/bundle', entryModule],
['/foo', fooModule],
['/bar', barModule],
['/baz', bazModule],
]),
deleted: new Set(),
reset: true,
@ -178,7 +186,7 @@ describe('DeltaCalculator', () => {
traverseDependencies.mockReturnValue(
Promise.resolve({
added: new Map([['/foo', edgeFoo]]),
added: new Map([['/foo', fooModule]]),
deleted: new Set(),
}),
);
@ -186,7 +194,7 @@ describe('DeltaCalculator', () => {
const result = await deltaCalculator.getDelta({reset: false});
expect(result).toEqual({
modified: new Map([['/foo', edgeFoo]]),
modified: new Map([['/foo', fooModule]]),
deleted: new Set(),
reset: false,
});
@ -202,7 +210,7 @@ describe('DeltaCalculator', () => {
traverseDependencies.mockReturnValue(
Promise.resolve({
added: new Map([['/foo', edgeFoo]]),
added: new Map([['/foo', fooModule]]),
deleted: new Set(['/baz']),
}),
);
@ -210,7 +218,7 @@ describe('DeltaCalculator', () => {
const result = await deltaCalculator.getDelta({reset: false});
expect(result).toEqual({
modified: new Map([['/foo', edgeFoo]]),
modified: new Map([['/foo', fooModule]]),
deleted: new Set(['/baz']),
reset: false,
});
@ -224,23 +232,25 @@ describe('DeltaCalculator', () => {
fileWatcher.emit('change', {eventsQueue: [{filePath: '/foo'}]});
const edgeQux = {
output: {path: '/qux', name: 'qux'},
const quxModule = {
dependencies: new Map(),
inverseDependencies: [],
output: {name: 'qux'},
path: '/qux',
};
traverseDependencies.mockImplementation(async (path, graph, options) => {
graph.dependencies.set('/qux', edgeQux);
graph.dependencies.set('/qux', quxModule);
return {
added: new Map([['/foo', edgeFoo], ['/qux', edgeQux]]),
added: new Map([['/foo', fooModule], ['/qux', quxModule]]),
deleted: new Set(['/bar', '/baz']),
};
});
const result = await deltaCalculator.getDelta({reset: false});
expect(result).toEqual({
modified: new Map([['/foo', edgeFoo], ['/qux', edgeQux]]),
modified: new Map([['/foo', fooModule], ['/qux', quxModule]]),
deleted: new Set(['/bar', '/baz']),
reset: false,
});
@ -301,13 +311,13 @@ describe('DeltaCalculator', () => {
traverseDependencies.mockReturnValue(
Promise.resolve({
added: new Map([['/bundle', edgeModule]]),
added: new Map([['/bundle', entryModule]]),
deleted: new Set(['/foo']),
}),
);
expect(await deltaCalculator.getDelta({reset: false})).toEqual({
modified: new Map([['/bundle', edgeModule]]),
modified: new Map([['/bundle', entryModule]]),
deleted: new Set(['/foo']),
reset: false,
});
@ -329,7 +339,7 @@ describe('DeltaCalculator', () => {
traverseDependencies.mockReturnValue(
Promise.resolve({
added: new Map([['/foo', edgeModule]]),
added: new Map([['/foo', entryModule]]),
deleted: new Set(),
}),
);

View File

@ -90,7 +90,7 @@ describe('traverseDependencies', function() {
);
const dependencies = recursive
? [...added.values()].map(edge => edge.path)
? [...added.values()].map(module => module.path)
: graph.dependencies.get(entryPath).dependencies.values();
return await Promise.all(

View File

@ -88,7 +88,7 @@ function deferred(value) {
}
function getPaths({added, deleted}) {
const addedPaths = [...added.values()].map(edge => edge.path);
const addedPaths = [...added.values()].map(module => module.path);
return {
added: new Set(addedPaths),

View File

@ -14,7 +14,7 @@ import type {MetroSourceMapSegmentTuple} from 'metro-source-map';
export type DependencyType = 'module' | 'script' | 'asset';
export type DependencyEdge = {|
export type Module = {|
dependencies: Map<string, string>,
inverseDependencies: Set<string>,
path: string,
@ -26,14 +26,12 @@ export type DependencyEdge = {|
},
|};
export type DependencyEdges = Map<string, DependencyEdge>;
export type Graph = {|
dependencies: DependencyEdges,
dependencies: Map<string, Module>,
entryPoints: $ReadOnlyArray<string>,
|};
type Result = {added: Map<string, DependencyEdge>, deleted: Set<string>};
type Result = {added: Map<string, Module>, deleted: Set<string>};
/**
* Internal data structure that the traversal logic uses to know which of the
@ -42,8 +40,8 @@ type Result = {added: Map<string, DependencyEdge>, deleted: Set<string>};
* just has been modified).
**/
type Delta = {
added: Map<string, DependencyEdge>,
modified: Map<string, DependencyEdge>,
added: Map<string, Module>,
modified: Map<string, Module>,
deleted: Set<string>,
};
@ -69,10 +67,7 @@ export type Options = {|
* dependency graph.
* Instead of traversing the whole graph each time, it just calculates the
* difference between runs by only traversing the added/removed dependencies.
* To do so, it uses the passed `edges` paramater, which is a data structure
* that contains the whole status of the dependency graph. During the
* recalculation of the dependencies, it mutates the edges graph.
*
* To do so, it uses the passed passed graph dependencies and it mutates it.
* The paths parameter contains the absolute paths of the root files that the
* method should traverse. Normally, these paths should be the modified files
* since the last traversal.
@ -90,15 +85,15 @@ async function traverseDependencies(
await Promise.all(
paths.map(async path => {
const edge = graph.dependencies.get(path);
const module = graph.dependencies.get(path);
if (!edge) {
if (!module) {
return;
}
delta.modified.set(edge.path, edge);
delta.modified.set(module.path, module);
await traverseDependenciesForSingleFile(edge, graph, delta, options);
await traverseDependenciesForSingleFile(module, graph, delta, options);
}),
);
@ -106,13 +101,13 @@ async function traverseDependencies(
const deleted = new Set();
const modified = new Map();
for (const [path, edge] of delta.added) {
added.set(path, edge);
for (const [path, module] of delta.added) {
added.set(path, module);
}
for (const [path, edge] of delta.modified) {
added.set(path, edge);
modified.set(path, edge);
for (const [path, module] of delta.modified) {
added.set(path, module);
modified.set(path, module);
}
for (const path of delta.deleted) {
@ -139,7 +134,7 @@ async function initialTraverseDependencies(
graph: Graph,
options: Options,
): Promise<Result> {
graph.entryPoints.forEach(entryPoint => createEdge(entryPoint, graph));
graph.entryPoints.forEach(entryPoint => createModule(entryPoint, graph));
await traverseDependencies(graph.entryPoints, graph, options);
@ -152,7 +147,7 @@ async function initialTraverseDependencies(
}
async function traverseDependenciesForSingleFile(
edge: DependencyEdge,
module: Module,
graph: Graph,
delta: Delta,
options: Options,
@ -161,8 +156,8 @@ async function traverseDependenciesForSingleFile(
let total = 1;
options.onProgress && options.onProgress(numProcessed, total);
await processEdge(
edge,
await processModule(
module,
graph,
delta,
options,
@ -180,37 +175,37 @@ async function traverseDependenciesForSingleFile(
options.onProgress && options.onProgress(numProcessed, total);
}
async function processEdge(
edge: DependencyEdge,
async function processModule(
module: Module,
graph: Graph,
delta: Delta,
options: Options,
onDependencyAdd: () => mixed,
onDependencyAdded: () => mixed,
): Promise<void> {
const previousDependencies = edge.dependencies;
const previousDependencies = module.dependencies;
const result = await options.transform(edge.path);
const result = await options.transform(module.path);
// Get the absolute path of all sub-dependencies (some of them could have been
// moved but maintain the same relative path).
const currentDependencies = resolveDependencies(
edge.path,
module.path,
result.dependencies,
options,
);
// Update the edge information.
edge.output = result.output;
edge.dependencies = new Map();
// Update the module information.
module.output = result.output;
module.dependencies = new Map();
currentDependencies.forEach((absolutePath, relativePath) => {
edge.dependencies.set(relativePath, absolutePath);
module.dependencies.set(relativePath, absolutePath);
});
for (const [relativePath, absolutePath] of previousDependencies) {
if (!currentDependencies.has(relativePath)) {
removeDependency(edge, absolutePath, graph, delta);
removeDependency(module, absolutePath, graph, delta);
}
}
@ -225,7 +220,7 @@ async function processEdge(
}
await addDependency(
edge,
module,
absolutePath,
graph,
delta,
@ -239,7 +234,7 @@ async function processEdge(
}
async function addDependency(
parentEdge: DependencyEdge,
parentModule: Module,
path: string,
graph: Graph,
delta: Delta,
@ -247,24 +242,24 @@ async function addDependency(
onDependencyAdd: () => mixed,
onDependencyAdded: () => mixed,
): Promise<void> {
const existingEdge = graph.dependencies.get(path);
const existingModule = graph.dependencies.get(path);
// The new dependency was already in the graph, we don't need to do anything.
if (existingEdge) {
existingEdge.inverseDependencies.add(parentEdge.path);
if (existingModule) {
existingModule.inverseDependencies.add(parentModule.path);
return;
}
const edge = createEdge(path, graph);
const module = createModule(path, graph);
edge.inverseDependencies.add(parentEdge.path);
delta.added.set(edge.path, edge);
module.inverseDependencies.add(parentModule.path);
delta.added.set(module.path, module);
onDependencyAdd();
await processEdge(
edge,
await processModule(
module,
graph,
delta,
options,
@ -276,40 +271,40 @@ async function addDependency(
}
function removeDependency(
parentEdge: DependencyEdge,
parentModule: Module,
absolutePath: string,
graph: Graph,
delta: Delta,
): void {
const edge = graph.dependencies.get(absolutePath);
const module = graph.dependencies.get(absolutePath);
if (!edge) {
if (!module) {
return;
}
edge.inverseDependencies.delete(parentEdge.path);
module.inverseDependencies.delete(parentModule.path);
// This module is still used by another modules, so we cannot remove it from
// the bundle.
if (edge.inverseDependencies.size) {
if (module.inverseDependencies.size) {
return;
}
delta.deleted.add(edge.path);
delta.deleted.add(module.path);
// Now we need to iterate through the module dependencies in order to
// clean up everything (we cannot read the module because it may have
// been deleted).
for (const depAbsolutePath of edge.dependencies.values()) {
removeDependency(edge, depAbsolutePath, graph, delta);
for (const depAbsolutePath of module.dependencies.values()) {
removeDependency(module, depAbsolutePath, graph, delta);
}
// This module is not used anywhere else!! we can clear it from the bundle
destroyEdge(edge, graph);
graph.dependencies.delete(module.path);
}
function createEdge(filePath: string, graph: Graph): DependencyEdge {
const edge = {
function createModule(filePath: string, graph: Graph): Module {
const module = {
dependencies: new Map(),
inverseDependencies: new Set(),
path: filePath,
@ -320,13 +315,9 @@ function createEdge(filePath: string, graph: Graph): DependencyEdge {
type: 'module',
},
};
graph.dependencies.set(filePath, edge);
graph.dependencies.set(filePath, module);
return edge;
}
function destroyEdge(edge: DependencyEdge, graph: Graph) {
graph.dependencies.delete(edge.path);
return module;
}
function resolveDependencies(
@ -357,19 +348,19 @@ function reorderGraph(graph: Graph) {
}
function reorderDependencies(
edge: {|dependencies: Map<string, string>|} | DependencyEdge,
dependencies: Map<string, DependencyEdge>,
orderedDependencies?: Map<string, DependencyEdge> = new Map(),
): Map<string, DependencyEdge> {
if (edge.path) {
if (orderedDependencies.has(edge.path)) {
module: {|dependencies: Map<string, string>|} | Module,
dependencies: Map<string, Module>,
orderedDependencies?: Map<string, Module> = new Map(),
): Map<string, Module> {
if (module.path) {
if (orderedDependencies.has(module.path)) {
return orderedDependencies;
}
orderedDependencies.set(edge.path, edge);
orderedDependencies.set(module.path, module);
}
edge.dependencies.forEach(path => {
module.dependencies.forEach(path => {
const dep = dependencies.get(path);
if (dep) {
reorderDependencies(dep, dependencies, orderedDependencies);

View File

@ -43,7 +43,7 @@ const {getAsset} = require('./Assets');
const resolveSync: ResolveSync = require('resolve').sync;
import type {CustomError} from './lib/formatBundlingError';
import type {DependencyEdge} from './DeltaBundler/traverseDependencies';
import type {Module} from './DeltaBundler/traverseDependencies';
import type {IncomingMessage, ServerResponse} from 'http';
import type {Reporter} from './lib/reporting';
import type {RamBundleInfo} from './DeltaBundler/Serializers/getRamBundleInfo';
@ -73,7 +73,7 @@ type ResolveSync = (path: string, opts: ?{baseDir?: string}) => string;
type GraphInfo = {|
graph: Graph,
prepend: $ReadOnlyArray<DependencyEdge>,
prepend: $ReadOnlyArray<Module>,
lastModified: Date,
+sequenceId: string,
|};
@ -526,7 +526,7 @@ class Server {
return {...graphInfo, prepend, graph};
}
async _minifyModule(module: DependencyEdge): Promise<DependencyEdge> {
async _minifyModule(module: Module): Promise<Module> {
const {code, map} = await this._bundler.minifyModule(
module.path,
module.output.code,

View File

@ -11,7 +11,7 @@
'use strict';
import type {Graph} from '../DeltaBundler/DeltaCalculator';
import type {DependencyEdge} from '../DeltaBundler/traverseDependencies';
import type {Module} from '../DeltaBundler/traverseDependencies';
type Options<T: number | string> = {
+createModuleId: string => T,
@ -25,7 +25,7 @@ function getAppendScripts<T: number | string>(
entryPoint: string,
graph: Graph,
options: Options<T>,
): $ReadOnlyArray<DependencyEdge> {
): $ReadOnlyArray<Module> {
const output = [];
if (options.runModule) {

View File

@ -15,7 +15,7 @@ const getPreludeCode = require('./getPreludeCode');
const transformHelpers = require('./transformHelpers');
import type Bundler from '../Bundler';
import type {DependencyEdge} from '../DeltaBundler/traverseDependencies';
import type {Module} from '../DeltaBundler/traverseDependencies';
import type DeltaBundler from '../DeltaBundler';
import type {CustomTransformOptions} from '../JSTransformer/worker';
@ -37,7 +37,7 @@ async function getPrependedScripts(
bundleOptions: BundleOptions,
bundler: Bundler,
deltaBundler: DeltaBundler,
): Promise<Array<DependencyEdge>> {
): Promise<Array<Module>> {
// Get all the polyfills from the relevant option params (the
// `getPolyfills()` method and the `polyfillModuleNames` variable).
const polyfillModuleNames = options
@ -80,7 +80,7 @@ async function getPrependedScripts(
];
}
function _getPrelude({dev}: {dev: boolean}): DependencyEdge {
function _getPrelude({dev}: {dev: boolean}): Module {
const code = getPreludeCode({isDev: dev});
const name = '__prelude__';

View File

@ -10,7 +10,7 @@
'use strict';
import type {DependencyEdge} from '../DeltaBundler/traverseDependencies';
import type {Module} from '../DeltaBundler/traverseDependencies';
import type {Graph} from '../DeltaBundler';
/**
@ -19,7 +19,7 @@ import type {Graph} from '../DeltaBundler';
**/
async function mapGraph(
graph: Graph,
mappingFn: DependencyEdge => Promise<DependencyEdge>,
mappingFn: Module => Promise<Module>,
): Promise<Graph> {
const dependencies = new Map(
await Promise.all(