Replace generic bundle names with arch names in bundle-visualizer (#10021)

This commit is contained in:
James Burgess
2018-06-23 00:46:34 +04:00
committed by Ben Newman
parent f42629ce5e
commit fbea42ca7c
2 changed files with 5 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
Package.describe({
version: '1.2.0',
version: '1.2.1',
summary: 'Meteor bundle analysis and visualization.',
documentation: 'README.md',
});

View File

@@ -52,17 +52,18 @@ function getStatBundles() {
Object.keys(staticFilesByArch).forEach(arch => {
const staticFiles = staticFilesByArch[arch];
Object.keys(staticFiles).forEach(path => {
files.push(staticFiles[path]);
files.push({ ...staticFiles[path], arch });
});
});
} else if (staticFiles) {
Object.keys(staticFiles).forEach(path => {
files.push(staticFiles[path]);
files.push({ ...staticFiles[path], arch: 'bundle' });
});
}
return files.filter(statFileFilter).map(file => ({
name: file.hash,
arch: file.arch,
stats: readOrNull(file.absolutePath),
}));
}
@@ -152,10 +153,7 @@ function statsMiddleware(request, response) {
sendJSON({
name: "main",
children: statBundles.map((statBundle, index, array) => ({
// TODO: If multiple bundles, could
// show abbr. bundle names with:
// `...${bundle.name.substr(-3)}`,
name: "bundle" + (array.length > 1 ? ` (${index + 1})` : ""),
name: statBundle.arch,
type: typeBundle,
children: d3TreeFromStats(statBundle.stats),
}))