lib/entries.js
async function getEntryRuntimeDependencies(dir, content, {cache} = {}) {
	const deps = {
		runtime: new Map(),
		parents: new Map(),
		libs: new Set()
	};

	const
		runtime = new Set();

	await $C(getEntryImports(dir, content)).async.forEach(async (el) => {
		const
			name = path.basename(el, path.extname(el)),
			block = cache ? cache.get(name) : await Block.get(name);

		if (!blockName(name) || !block) {
			deps.runtime.set(el, el);
			return;
		}

		const
			blockDeps = await block.getRuntimeDependencies({cache});

		$C(blockDeps.runtime).forEach((obj, block) => {
			if (!blockDeps.parents.has(block)) {
				runtime.add(block);
			}
		});

		deps.runtime = new Map([...deps.runtime.entries(), ...blockDeps.runtime.entries()]);
		deps.parents = new Map(
			$C([...deps.parents.entries(), ...blockDeps.parents.entries()])
				.filter(([block]) => !runtime.has(block))
				.map()
		);

		deps.libs = new Set([...deps.libs, ...blockDeps.libs]);
	});

	return deps;
}
async function getEntryRuntimeDependencies(dir, content, {cache} = {}) {
	const deps = {
		runtime: new Map(),
		parents: new Map(),
		libs: new Set()
	};

	const
		runtime = new Set();

	await $C(getEntryImports(dir, content)).async.forEach(async (el) => {
		const
			name = path.basename(el, path.extname(el)),
			block = cache ? cache.get(name) : await Block.get(name);

		if (!blockName(name) || !block) {
			deps.runtime.set(el, el);
			return;
		}

		const
			blockDeps = await block.getRuntimeDependencies({cache});

		$C(blockDeps.runtime).forEach((obj, block) => {
			if (!blockDeps.parents.has(block)) {
				runtime.add(block);
			}
		});

		deps.runtime = new Map([...deps.runtime.entries(), ...blockDeps.runtime.entries()]);
		deps.parents = new Map(
			$C([...deps.parents.entries(), ...blockDeps.parents.entries()])
				.filter(([block]) => !runtime.has(block))
				.map()
		);

		deps.libs = new Set([...deps.libs, ...blockDeps.libs]);
	});

	return deps;
}
async function getEntryRuntimeDependencies ( dir , content , { cache } = { } ) { const deps = { runtime : new Map ( ) , parents : new Map ( ) , libs : new Set ( ) } ; const runtime = new Set ( ) ; await $C ( getEntryImports ( dir , content ) ) . async . forEach ( async ( el ) => { const name = path . basename ( el , path . extname ( el ) ) , block = cache ? cache . get ( name ) : await Block . get ( name ) ; if ( ! blockName ( name ) || ! block ) { deps . runtime . set ( el , el ) ; return ; } const blockDeps = await block . getRuntimeDependencies ( { cache } ) ; $C ( blockDeps . runtime ) . forEach ( ( obj , block ) => { if ( ! blockDeps . parents . has ( block ) ) { runtime . add ( block ) ; } } ) ; deps . runtime = new Map ( [ ... deps . runtime . entries ( ) , ... blockDeps . runtime . entries ( ) ] ) ; deps . parents = new Map ( $C ( [ ... deps . parents . entries ( ) , ... blockDeps . parents . entries ( ) ] ) . filter ( ( [ block ] ) => ! runtime . has ( block ) ) . map ( ) ) ; deps . libs = new Set ( [ ... deps . libs , ... blockDeps . libs ] ) ; } ) ; return deps ; }
Returns a graph with dependencies for an entry file

@param {string} dir - entry directory
@param {string} content - file content
@param {Map<string, !Block>=} [cache] - optional cache object with predefined blocks
@returns {!Promise<{runtime: !Map<string, !Block>, parents: !Map<string, !Block>, libs: !Set<string>}>}
Returns a graph with dependencies for an entry file