MCPcopy Create free account
hub / github.com/GoogleChromeLabs/ui-element-samples / buildDependencyTree

Function buildDependencyTree

code-splitting/build.js:93–111  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

91}
92
93async function buildDependencyTree(file) {
94 let code = await readFile(file);
95 code = code.toString('utf-8');
96
97 let dep = [];
98 const plugin = {
99 visitor: {
100 ImportDeclaration(decl) {
101 const importedFile = decl.node.source.value;
102 dep.push((async function() {
103 return await buildDependencyTree(`./app/${importedFile}`);
104 })());
105 dep.push(importedFile);
106 }
107 }
108 }
109 babel.transform(code, {plugins: [plugin]});
110 return flatten(await Promise.all(dep));
111}
112
113async function extractEntryPoints() {
114 let sitemapString = await readFile('./app/sitemap.xml');

Callers 2

buildFunction · 0.85
ImportDeclarationFunction · 0.85

Calls 2

flattenFunction · 0.85
transformMethod · 0.80

Tested by

no test coverage detected