From a4021acf40fe5de37495dc3b6c9e7bbc4b4f5747 Mon Sep 17 00:00:00 2001 From: Benjamin Fischer Date: Fri, 14 May 2021 15:43:12 +0200 Subject: [PATCH] fix: add time logging to bundle --- src/cli/bundle.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cli/bundle.ts b/src/cli/bundle.ts index 8fb450d..91fcd67 100644 --- a/src/cli/bundle.ts +++ b/src/cli/bundle.ts @@ -44,9 +44,13 @@ export async function preBundle( ): Promise { const scriptResult = await bundleFile(script, options); - const bundleContent = - `import "${new URL("./mod.ts", Deno.mainModule).href}";\n` + - `$.mainModule = import.meta.url;\n${scriptResult}`; + const bundleContent = `import "${new URL("./mod.ts", Deno.mainModule).href}"; +$.mainModule = import.meta.url; +${scriptResult} +if ($.verbose) { + const end = Date.now(); + console.log($.bold("time: %ss"), Math.round($.time) / 1000); +}`; const tmpDir = await Deno.makeTempDir(); const tmpFile = path.join(tmpDir, path.basename(script));