@@ -3,6 +3,7 @@ import { parseNextOutput } from "./src/parser";
33import { inlineAssets } from "./src/inliner" ;
44import { generateRouterShim } from "./src/router" ;
55import { bundleToSingleHtml } from "./src/bundler" ;
6+ import { sendTelemetry , getMemoryUsage } from "./src/telemetry" ;
67import { $ } from "bun" ;
78
89function parseArgs ( ) {
@@ -30,6 +31,8 @@ function parseArgs() {
3031
3132const { inputDir, outputFile } = parseArgs ( ) ;
3233
34+ const startTime = Date . now ( ) ;
35+
3336console . log ( `📖 Parsing Next.js output from: ${ inputDir } ` ) ;
3437const parsed = await parseNextOutput ( inputDir ) ;
3538
@@ -50,7 +53,16 @@ const html = bundleToSingleHtml(inlined, routerShim);
5053await $ `mkdir -p ${ outputFile . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) || "." } ` . quiet ( ) ;
5154await Bun . write ( outputFile , html ) ;
5255
56+ const endTime = Date . now ( ) ;
57+ const memoryUsed = getMemoryUsage ( ) ;
58+
5359console . log ( `✅ Done! Output: ${ outputFile } ` ) ;
5460console . log ( ` Size: ${ ( html . length / 1024 ) . toFixed ( 1 ) } KB` ) ;
61+ console . log ( ` Time: ${ ( endTime - startTime ) } ms` ) ;
62+ console . log ( ` Memory: ${ memoryUsed } MB` ) ;
5563console . log ( "Star us: https://github.com/simples-tools/next-single-file" ) ;
56- console . log ( "Report bugs: https://github.com/simples-tools/next-single-file/issues" ) ;
64+ console . log ( "Report bugs: https://github.com/simples-tools/next-single-file/issues" ) ;
65+
66+ if ( process . env . NEXT_SINGLE_FILE_NO_TELEMETRY !== "1" ) {
67+ await sendTelemetry ( endTime - startTime , memoryUsed ) ;
68+ }
0 commit comments