@@ -7,6 +7,7 @@ import { build } from "esbuild";
77const __filename = fileURLToPath ( import . meta. url ) ;
88const __dirname = path . dirname ( __filename ) ;
99const packageRoot = path . resolve ( __dirname , ".." ) ;
10+ const rootImportPath = "@microsoft/fast-element" ;
1011
1112const namedExports = [
1213 "FASTElement" ,
@@ -24,34 +25,38 @@ const namedExports = [
2425] ;
2526
2627const subpathExports = [
27- { name : "css" , path : "@microsoft/fast-element/styles.js" , export : "css" } ,
28+ { name : "css" , importPath : "@microsoft/fast-element/styles.js" , export : "css" } ,
2829 {
2930 name : "enableHydration" ,
30- path : "@microsoft/fast-element/hydration.js" ,
31+ importPath : "@microsoft/fast-element/hydration.js" ,
3132 export : "enableHydration" ,
3233 } ,
3334 {
3435 name : "ArrayObserver" ,
35- path : "@microsoft/fast-element/arrays.js" ,
36+ importPath : "@microsoft/fast-element/arrays.js" ,
3637 export : "ArrayObserver" ,
3738 } ,
3839 {
3940 name : "declarativeTemplate" ,
40- path : "@microsoft/fast-element/declarative.js" ,
41+ importPath : "@microsoft/fast-element/declarative.js" ,
4142 export : "declarativeTemplate" ,
4243 } ,
4344 {
44- name : "observerMap (extensions/observer-map.js) " ,
45- path : "@microsoft/fast-element/extensions/observer-map.js" ,
45+ name : "observerMap" ,
46+ importPath : "@microsoft/fast-element/extensions/observer-map.js" ,
4647 export : "observerMap" ,
4748 } ,
4849 {
49- name : "attributeMap (extensions/attribute-map.js) " ,
50- path : "@microsoft/fast-element/extensions/attribute-map.js" ,
50+ name : "attributeMap" ,
51+ importPath : "@microsoft/fast-element/extensions/attribute-map.js" ,
5152 export : "attributeMap" ,
5253 } ,
5354] ;
5455
56+ function formatExportLabel ( name , importPath ) {
57+ return `${ name } (${ importPath } )` ;
58+ }
59+
5560function formatBytes ( bytes ) {
5661 if ( bytes < 1024 ) return `${ bytes } B` ;
5762 return `${ ( bytes / 1024 ) . toFixed ( 2 ) } KB` ;
@@ -67,7 +72,7 @@ function measureBuffer(buffer) {
6772 } ;
6873}
6974
70- async function measureExport ( exportName , importPath = "@microsoft/fast-element" ) {
75+ async function measureExport ( exportName , importPath = rootImportPath ) {
7176 const contents = `import { ${ exportName } } from "${ importPath } ";\nexport { ${ exportName } };\n` ;
7277
7378 const result = await build ( {
@@ -104,16 +109,16 @@ async function main() {
104109 const exportResults = await Promise . all (
105110 namedExports . map ( async name => {
106111 const sizes = await measureExport ( name ) ;
107- return { name, ...sizes } ;
112+ return { name : formatExportLabel ( name , rootImportPath ) , ...sizes } ;
108113 } ) ,
109114 ) ;
110115 results . push ( ...exportResults ) ;
111116
112117 // Measure subpath exports in parallel
113118 const subpathResults = await Promise . all (
114- subpathExports . map ( async ( { name, path : importPath , export : exportName } ) => {
119+ subpathExports . map ( async ( { name, importPath, export : exportName } ) => {
115120 const sizes = await measureExport ( exportName , importPath ) ;
116- return { name, ...sizes } ;
121+ return { name : formatExportLabel ( name , importPath ) , ...sizes } ;
117122 } ) ,
118123 ) ;
119124 results . push ( ...subpathResults ) ;
0 commit comments