diff --git a/capture/fixture/nuxt.config.ts b/capture/fixture/nuxt.config.ts index 282f9de59..4497cacba 100644 --- a/capture/fixture/nuxt.config.ts +++ b/capture/fixture/nuxt.config.ts @@ -5,4 +5,11 @@ export default defineNuxtConfig({ tasks: true, }, }, + vite: { + // Pre-bundled so Vite never discovers it while serving the first request: + // whether it does depends on timing, and its hint would flip the captures. + optimizeDeps: { + include: ['@vue/devtools-core'], + }, + }, }) diff --git a/capture/lib/frames.spec.ts b/capture/lib/frames.spec.ts index b90bcb565..93a2cf78f 100644 --- a/capture/lib/frames.spec.ts +++ b/capture/lib/frames.spec.ts @@ -110,6 +110,12 @@ describe('scrubbing a right-aligned tag', () => { expect(result.styles).toHaveLength(result.line.length) }) + it.each(['⠋ Setting up modules 1.2s · total 3.4s', '⠋ Setting up modules 1.2s · 3.4s', '⠋ Setting up modules 3.4s'])('should pin a phase line however the clocks differed: %s', (line) => { + const styles = Array.from({ length: line.length }).fill(undefined) as never + + expect(scrubLine(line, styles, resolveRules(['timings'])).line).toBe('⠋ Setting up modules 42 ms') + }) + it('should leave a line without padding alone', () => { expect(scrub('42 ms').trimEnd()).not.toBe('') const plain = '✔ Vite client built in 1085 ms' diff --git a/capture/lib/scrub.ts b/capture/lib/scrub.ts index 67196ab38..e24eec22b 100644 --- a/capture/lib/scrub.ts +++ b/capture/lib/scrub.ts @@ -50,7 +50,7 @@ const RULES: Record = { { pattern: /\b\d+(?:\.\d+)?\s?s(?![a-z])/g, replacement: () => '42 ms' }, // A phase clock is only printed beside the total once they differ, so // the pair is a function of machine speed and carries nothing once pinned. - { pattern: /42 ms \u00B7 42 ms/g, replacement: () => '42 ms' }, + { pattern: /42 ms \u00B7 (?:total )?42 ms/g, replacement: () => '42 ms' }, ], }, versions: { diff --git a/capture/output/nuxt-dev-install-module.svg b/capture/output/nuxt-dev-install-module.svg index 8f0f4bf8f..f2f6621b6 100644 --- a/capture/output/nuxt-dev-install-module.svg +++ b/capture/output/nuxt-dev-install-module.svg @@ -16,55 +16,47 @@ svg{--bg:#ffffff;--fg:#24292f;--chrome:#f6f8fa;--dot:#d0d7de} nuxt dev (module auto-install) -⣠⣦⣠⡀Nuxt4.6.1━━━━━━━━━━━━━━━━━━━━0% · 0.0ms STARTING preparing your apprrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/⠋━━━━━━━━━━━━━━━━━━━━0% · 0.0ms STARTING starting Nuxt...oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━17% · 153ms STARTING setting up modulesoopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━33% · 323ms STARTING preparing appoopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━33% · 509ms STARTING preparing appoopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━50% · 685ms STARTING generating typesoopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━50% · 748ms STARTING generating typesoopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━67% · 972ms STARTING bundling appoopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 1.13s STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 1.22s STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 1.34s STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 1.46s STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 1.58s STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 1.71s STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 1.83s STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 1.95s STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⚠ 1 warning READY watching for changesrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○No -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }})Learn more: https://vite.dev/guide/dep-pre-bundling.html -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠴ installing with npm · 0.0ms READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠦ installing with npm · 96ms READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠧ installing with npm · 217ms READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠇ installing with npm · 337ms READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠏ installing with npm · 458ms READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠋ installing with npm · 578ms READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠙ installing with npm · 698ms READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠹ installing with npm · 818ms READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠸ installing with npm · 938ms READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠼ installing with npm · 1.05s READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠴ installing with npm · 1.17s READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠦ installing with npm · 1.29s READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠧ installing with npm · 1.41s READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠇ installing with npm · 1.53s READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠏ installing with npm · 1.65s READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠋ installing with npm · 1.77s READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠙ installing with npm · 1.90s READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠹ installing with npm · 2.02s READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠸ installing with npm · 2.14s READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/⠼ installing @nuxt/scripts... · 2.30s READY ✔dependencies installed · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━17% · 52ms BUILDING ✔dependencies installed · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━50% · 130ms BUILDING ✔dependencies installed · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━67% · 241ms BUILDING ✔installed @nuxt/scripts · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 308ms BUILDING ✔installed @nuxt/scripts · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 422ms BUILDING ✔installed @nuxt/scripts · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 544ms BUILDING ✔installed @nuxt/scripts · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 686ms BUILDING ✔installed @nuxt/scripts · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 809ms BUILDING ✔installed @nuxt/scripts · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 932ms BUILDING ✔installed @nuxt/scripts · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/✔ 1 request 108ms median READY ✔installed @nuxt/scripts · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit -❯ Do you want to install @nuxt/scripts package?● Yes /○Noℹ Vite discovered new dependencies at runtime:@vue/devtools-core← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.jsPre-bundle them in your nuxt.config.ts to avoid page reloads:export default defineNuxtConfig({ vite: { optimizeDeps: { include: [ '@vue/devtools-core', ] } }✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.1ready in 2.48sLocalhttp://localhost:3000/✔ 1 request 108ms median READY watching for changes · GET /scripts · 200 · 108msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2━━━━━━━━━━━━━━━━━━━━0% · 0.0ms STARTING preparing your apprrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/⠋━━━━━━━━━━━━━━━━━━━━0% · 0.0ms STARTING starting Nuxt...oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━17% · 96ms STARTING setting up modulesoopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━33% · 193ms STARTING preparing appoopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━33% · 304ms STARTING preparing appoopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━50% · 435ms STARTING generating typesoopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━67% · 580ms STARTING bundling appoopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 701ms STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 821ms STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 942ms STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 1.07s STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 1.19s STARTING building serveroopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/⚠ 1 warning STARTING preparing your appoopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⚠ 1 warning READY watching for changesrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +❯ Do you want to install @nuxt/scripts package?● Yes /○No +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠋ installing with npm · 0.0ms READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠙ installing with npm · 104ms READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠹ installing with npm · 225ms READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠸ installing with npm · 346ms READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠼ installing with npm · 466ms READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠴ installing with npm · 587ms READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠦ installing with npm · 706ms READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠧ installing with npm · 827ms READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠇ installing with npm · 948ms READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠏ installing with npm · 1.06s READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠋ installing with npm · 1.19s READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠙ installing with npm · 1.31s READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠹ installing with npm · 1.43s READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠸ installing with npm · 1.55s READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠼ installing with npm · 1.67s READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠴ installing with npm · 1.79s READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠦ installing with npm · 1.91s READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠧ installing with npm · 2.03s READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/⠇ installing with npm · 2.15s READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━0% · 0.0ms BUILDING ✔dependencies installed · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━50% · 86ms BUILDING ✔dependencies installed · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 156ms BUILDING ✔installed @nuxt/scripts · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 208ms BUILDING ✔installed @nuxt/scripts · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 328ms BUILDING ✔installed @nuxt/scripts · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2Localhttp://localhost:3000/━━━━━━━━━━━━━━━━━━━━83% · 472ms BUILDING ✔installed @nuxt/scripts · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/✔ 1 request 70ms median READY ✔installed @nuxt/scripts · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit +✔ Do you want to install @nuxt/scripts package?Yes⣠⣦⣠⡀Nuxt4.6.2ready in 1.56sLocalhttp://localhost:3000/✔ 1 request 70ms median READY watching for changes · GET /scripts · 200 · 70msrrestart · oopen · iinfo · llogs · nnetwork · proutes · ?help · qquit diff --git a/capture/output/nuxt-dev-install-module.txt b/capture/output/nuxt-dev-install-module.txt index dae5d6b1d..b44662fcb 100644 --- a/capture/output/nuxt-dev-install-module.txt +++ b/capture/output/nuxt-dev-install-module.txt @@ -1,9 +1,4 @@ -styles: a057ea820f39fe11 - '@vue/devtools-core', - ] - include: [ - optimizeDeps: { - } +styles: c631b1f09ab5adaa Local http://localhost:3000/ Local http://localhost:3000/ ⠋ ━━━━━━━━━━━━━━━━━━━━ 0% · 42 ms @@ -18,7 +13,6 @@ styles: a057ea820f39fe11 ✔ 1 request 42 ms median ⚠ 2 warnings ⠋ installing @nuxt/scripts... · 42 ms ⠋ installing with npm · 42 ms - @vue/devtools-core ← ./virtual:nuxt:.nuxt%2Fruntime.vue-devtools-client.CN4wuBpFwm.js BUILDING ✔ dependencies installed · GET /scripts · 200 · 42 ms BUILDING ✔ installed @nuxt/scripts · GET /scripts · 200 · 42 ms READY watching for changes @@ -32,18 +26,11 @@ styles: a057ea820f39fe11 STARTING preparing your app STARTING setting up modules STARTING starting Nuxt... - vite: { - } o open · i info · l logs · n network · p routes · ? help · q quit r restart · o open · i info · l logs · n network · p routes · ? help · q quit ⣠⣦⣠⡀ Nuxt x.y.z ⣠⣦⣠⡀ Nuxt x.y.z ready in 42 ms -Learn more: https://vite.dev/guide/dep-pre-bundling.html -Pre-bundle them in your nuxt.config.ts to avoid page reloads: Yes -export default defineNuxtConfig({ -}) -ℹ Vite discovered new dependencies at runtime: ● Yes / ○ No ✔ Do you want to install @nuxt/scripts package? ❯ Do you want to install @nuxt/scripts package? diff --git a/capture/output/nuxt-dev-plain-restart.svg b/capture/output/nuxt-dev-plain-restart.svg index 6a74bb6a0..0457ec80c 100644 --- a/capture/output/nuxt-dev-plain-restart.svg +++ b/capture/output/nuxt-dev-plain-restart.svg @@ -16,28 +16,26 @@ svg{--bg:#ffffff;--fg:#24292f;--chrome:#f6f8fa;--dot:#d0d7de} nuxt dev (plain output, restart on config change) - -⠙ Starting Nuxt... 0.0ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose⠸ Setting up modules 0.0ms · 147ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠴ Preparing app 0.0ms · 297ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠦ Preparing app 181ms · 478ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠏ Generating types 7.0ms · 650ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠋ Generating types 98ms · 741ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠹ Bundling app 2.0ms · 908ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms⠴ Building server 12ms · 1.10s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms⠦ Building server 92ms · 1.18s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms⠧ Building server 173ms · 1.26s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms⠇ Building server 276ms · 1.36s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms⠋ Building server 437ms · 1.52s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms⠙ Building server 517ms · 1.60s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms⠹ Building server 601ms · 1.69s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms⠼ Building server 761ms · 1.85s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms✔ Nuxt Nitro server built in 1021ms nitro│◆ Ready in 2.21s →http://localhost:3000/│config 147ms · modules 150ms · app 346ms · types 263ms · bundle 185ms · server 1.12spressh + enterto see available shortcuts -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms✔ Nuxt Nitro server built in 1021ms nitro│◆ Ready in 2.21s →http://localhost:3000/│config 147ms · modules 150ms · app 346ms · types 263ms · bundle 185ms · server 1.12spressh + enterto see available shortcutsℹ nuxt.config.ts changed. Reloading Nuxt...devtools updated -➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms✔ Nuxt Nitro server built in 1021ms nitro│◆ Ready in 2.21s →http://localhost:3000/│config 147ms · modules 150ms · app 346ms · types 263ms · bundle 185ms · server 1.12spressh + enterto see available shortcutsℹ nuxt.config.ts changed. Reloading Nuxt...devtools updatedℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 21ms✔ Vite server built in 24ms -➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms✔ Nuxt Nitro server built in 1021ms nitro│◆ Ready in 2.21s →http://localhost:3000/│config 147ms · modules 150ms · app 346ms · types 263ms · bundle 185ms · server 1.12spressh + enterto see available shortcutsℹ nuxt.config.ts changed. Reloading Nuxt...devtools updatedℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 21ms✔ Vite server built in 24ms✔ Nuxt Nitro server built in 755ms nitro -⠸ Bundling app 117ms · 1.02s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 42ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 20ms✔ Nuxt Nitro server built in 1021ms nitro│◆ Ready in 2.21s →http://localhost:3000/│config 147ms · modules 150ms · app 346ms · types 263ms · bundle 185ms · server 1.12spressh + enterto see available shortcutsℹ nuxt.config.ts changed. Reloading Nuxt...devtools updatedℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 21ms✔ Vite server built in 24ms✔ Nuxt Nitro server built in 755ms nitroℹ nuxt.config.ts changed. Reloading Nuxt...devtools updated ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2) -│◆ Ready in 2.21s →http://localhost:3000/│config 147ms · modules 150ms · app 346ms · types 263ms · bundle 185ms · server 1.12spressh + enterto see available shortcutsℹ nuxt.config.ts changed. Reloading Nuxt...devtools updatedℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 21ms✔ Vite server built in 24ms✔ Nuxt Nitro server built in 755ms nitroℹ nuxt.config.ts changed. Reloading Nuxt...devtools updated ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2) WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 18ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 13ms -◆ Ready in 2.21s →http://localhost:3000/│config 147ms · modules 150ms · app 346ms · types 263ms · bundle 185ms · server 1.12spressh + enterto see available shortcutsℹ nuxt.config.ts changed. Reloading Nuxt...devtools updatedℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 21ms✔ Vite server built in 24ms✔ Nuxt Nitro server built in 755ms nitroℹ nuxt.config.ts changed. Reloading Nuxt...devtools updated ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2) WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 18ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 13ms✔ Nuxt Nitro server built in 665ms nitro + +⠙ Starting Nuxt... 0.0ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose⠸ Setting up modules 0.0ms · total 104ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠴ Preparing app 0.0ms · total 202ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠦ Preparing app 115ms · total 317ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠇ Generating types 0.0ms · total 432ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠏ Generating types 59ms · total 491ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 1.0ms · total 600ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 1.0ms · total 600ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 30ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 10ms⠸ Building server 0.0ms · total 714ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 1.0ms · total 600ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 30ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 10ms⠴ Building server 137ms · total 851ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 1.0ms · total 600ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 30ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 10ms⠦ Building server 217ms · total 931ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 1.0ms · total 600ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 30ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 10ms⠧ Building server 305ms · total 1.01s +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 1.0ms · total 600ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 30ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 10ms⠇ Building server 387ms · total 1.10s +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 1.0ms · total 600ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 30ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 10ms⠋ Building server 546ms · total 1.26s +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 1.0ms · total 600ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 30ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 10ms✔ Nuxt Nitro server built in 722ms nitro│◆ Ready in 1.49s →http://localhost:3000/│config 104ms · modules 98ms · app 230ms · types 167ms · bundle 115ms · server 783mspressh + enterto see available shortcuts +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 1.0ms · total 600ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 30ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 10ms✔ Nuxt Nitro server built in 722ms nitro│◆ Ready in 1.49s →http://localhost:3000/│config 104ms · modules 98ms · app 230ms · types 167ms · bundle 115ms · server 783mspressh + enterto see available shortcutsℹ nuxt.config.ts changed. Reloading Nuxt...devtools updated +➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 1.0ms · total 600ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 30ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 10ms✔ Nuxt Nitro server built in 722ms nitro│◆ Ready in 1.49s →http://localhost:3000/│config 104ms · modules 98ms · app 230ms · types 167ms · bundle 115ms · server 783mspressh + enterto see available shortcutsℹ nuxt.config.ts changed. Reloading Nuxt...devtools updatedℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 16ms✔ Vite server built in 20ms +➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 1.0ms · total 600ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 30ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 10ms✔ Nuxt Nitro server built in 722ms nitro│◆ Ready in 1.49s →http://localhost:3000/│config 104ms · modules 98ms · app 230ms · types 167ms · bundle 115ms · server 783mspressh + enterto see available shortcutsℹ nuxt.config.ts changed. Reloading Nuxt...devtools updatedℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 16ms✔ Vite server built in 20ms✔ Nuxt Nitro server built in 552ms nitro +✔ Nuxt Nitro server built in 722ms nitro│◆ Ready in 1.49s →http://localhost:3000/│config 104ms · modules 98ms · app 230ms · types 167ms · bundle 115ms · server 783mspressh + enterto see available shortcutsℹ nuxt.config.ts changed. Reloading Nuxt...devtools updatedℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 16ms✔ Vite server built in 20ms✔ Nuxt Nitro server built in 552ms nitroℹ nuxt.config.ts changed. Reloading Nuxt...devtools updated ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3) WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 14ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a +│◆ Ready in 1.49s →http://localhost:3000/│config 104ms · modules 98ms · app 230ms · types 167ms · bundle 115ms · server 783mspressh + enterto see available shortcutsℹ nuxt.config.ts changed. Reloading Nuxt...devtools updatedℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 16ms✔ Vite server built in 20ms✔ Nuxt Nitro server built in 552ms nitroℹ nuxt.config.ts changed. Reloading Nuxt...devtools updated ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3) WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 14ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 13ms +◆ Ready in 1.49s →http://localhost:3000/│config 104ms · modules 98ms · app 230ms · types 167ms · bundle 115ms · server 783mspressh + enterto see available shortcutsℹ nuxt.config.ts changed. Reloading Nuxt...devtools updatedℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 16ms✔ Vite server built in 20ms✔ Nuxt Nitro server built in 552ms nitroℹ nuxt.config.ts changed. Reloading Nuxt...devtools updated ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3) WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 14ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 13ms✔ Nuxt Nitro server built in 463ms nitro diff --git a/capture/output/nuxt-dev-plain-restart.txt b/capture/output/nuxt-dev-plain-restart.txt index bc491c37b..e43836e09 100644 --- a/capture/output/nuxt-dev-plain-restart.txt +++ b/capture/output/nuxt-dev-plain-restart.txt @@ -1,4 +1,4 @@ -styles: b9481c350ba0bd29 +styles: 97bdcfecdf5ad2e8 devtools updated press h + enter to see available shortcuts ➜ DevTools: press Shift + Alt + D in the browser (x.y.z) diff --git a/capture/output/nuxt-dev-plain-static.svg b/capture/output/nuxt-dev-plain-static.svg index 2a3a5a256..848edf116 100644 --- a/capture/output/nuxt-dev-plain-static.svg +++ b/capture/output/nuxt-dev-plain-static.svg @@ -16,6 +16,6 @@ svg{--bg:#ffffff;--fg:#24292f;--chrome:#f6f8fa;--dot:#d0d7de} nuxt dev (plain output, ready) -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 111ms · 1.04s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 44ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 13ms✔ Nuxt Nitro server built in 1075ms nitro│◆ Ready in 2.25s →http://localhost:3000/│config 155ms · modules 156ms · app 346ms · types 274ms · bundle 165ms · server 1.16spressh + enterto see available shortcuts +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 2.0ms · total 582ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite client built in 29ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 9ms✔ Nuxt Nitro server built in 776ms nitro│◆ Ready in 1.52s →http://localhost:3000/│config 97ms · modules 91ms · app 222ms · types 170ms · bundle 115ms · server 833mspressh + enterto see available shortcuts diff --git a/capture/output/nuxt-dev-plain-static.txt b/capture/output/nuxt-dev-plain-static.txt index 604022800..dad04bf45 100644 --- a/capture/output/nuxt-dev-plain-static.txt +++ b/capture/output/nuxt-dev-plain-static.txt @@ -1,4 +1,4 @@ -styles: 0b16b2e9f0d61733 +styles: 8bea158737c949fe press h + enter to see available shortcuts ➜ DevTools: press Shift + Alt + D in the browser (x.y.z) ➜ Local: http://localhost:3000/ diff --git a/capture/output/nuxt-dev-plain.svg b/capture/output/nuxt-dev-plain.svg index 1c08628c3..7f8b4735f 100644 --- a/capture/output/nuxt-dev-plain.svg +++ b/capture/output/nuxt-dev-plain.svg @@ -16,26 +16,22 @@ svg{--bg:#ffffff;--fg:#24292f;--chrome:#f6f8fa;--dot:#d0d7de} nuxt dev (plain output) - -⠙ Starting Nuxt... 0.0ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose⠸ Setting up modules 0.0ms · 156ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠴ Preparing app 0.0ms · 315ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠦ Preparing app 180ms · 495ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠏ Generating types 5.0ms · 667ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠋ Generating types 108ms · 770ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠹ Bundling app 2.0ms · 937ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms⠴ Building server 0.0ms · 1.19s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms⠦ Building server 30ms · 1.22s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms⠧ Building server 112ms · 1.30s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms⠇ Building server 197ms · 1.39s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms⠏ Building server 279ms · 1.47s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms⠋ Building server 371ms · 1.56s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms⠙ Building server 456ms · 1.65s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms⠹ Building server 536ms · 1.73s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms⠸ Building server 617ms · 1.81s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms⠼ Building server 700ms · 1.89s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms⠦ Building server 863ms · 2.06s -│●Nuxt 4.6.1 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.43)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.2)⠸ Bundling app 120ms · 1.05s WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 52ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 24ms✔ Nuxt Nitro server built in 1085ms nitro│◆ Ready in 2.43s →http://localhost:3000/│config 156ms · modules 159ms · app 347ms · types 273ms · bundle 262ms · server 1.24spressh + enterto see available shortcuts + +⠙ Starting Nuxt... 1.0ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose⠸ Setting up modules 98ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠴ Preparing app 0.0ms · total 192ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠦ Preparing app 113ms · total 305ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠇ Generating types 0.0ms · total 413ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠏ Generating types 60ms · total 473ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 2.0ms · total 583ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 2.0ms · total 583ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 37ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 17ms⠸ Building server 0.0ms · total 719ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 2.0ms · total 583ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 37ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 17ms⠼ Building server 26ms · total 745ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 2.0ms · total 583ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 37ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 17ms⠦ Building server 190ms · total 909ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 2.0ms · total 583ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 37ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 17ms⠧ Building server 270ms · total 989ms +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 2.0ms · total 583ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 37ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 17ms⠇ Building server 351ms · total 1.07s +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 2.0ms · total 583ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 37ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 17ms⠏ Building server 431ms · total 1.15s +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 2.0ms · total 583ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 37ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 17ms⠋ Building server 512ms · total 1.23s +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 2.0ms · total 583ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 37ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 17ms⠙ Building server 592ms · total 1.31s +│●Nuxt 4.6.2 (with Nitro 2.13.4, Vite 8.3.4 and Vue 3.5.44)➜Local: http://localhost:3000/➜Network: use --host to expose ➜ DevTools: press Shift + Alt + D in the browser (v3.4.3)⠙ Bundling app 2.0ms · total 583ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in aℹ Re-optimizing dependencies because vite config has changed✔ Vite client built in 37ms WARN Plugin "nuxt:devtools:config-retriever" defines Vite-specific hooks (configResolved) in a✔ Vite server built in 17ms✔ Nuxt Nitro server built in 732ms nitro│◆ Ready in 1.56s →http://localhost:3000/│config 98ms · modules 94ms · app 221ms · types 168ms · bundle 138ms · server 845mspressh + enterto see available shortcuts diff --git a/capture/output/nuxt-dev-plain.txt b/capture/output/nuxt-dev-plain.txt index 406c17709..648c46e23 100644 --- a/capture/output/nuxt-dev-plain.txt +++ b/capture/output/nuxt-dev-plain.txt @@ -1,4 +1,4 @@ -styles: d2449122d4dda2b2 +styles: c83e568e87381a2b press h + enter to see available shortcuts ➜ DevTools: press Shift + Alt + D in the browser (x.y.z) ➜ Local: http://localhost:3000/ diff --git a/packages/nuxt-cli/src/commands/build.ts b/packages/nuxt-cli/src/commands/build.ts index 55b95a2fc..c7c458c2f 100644 --- a/packages/nuxt-cli/src/commands/build.ts +++ b/packages/nuxt-cli/src/commands/build.ts @@ -7,6 +7,7 @@ import { relative } from 'pathe' import { resolveDotenvFileNames } from '../utils/args' import { showBanner } from '../utils/banner' import { BuildProgress } from '../utils/build-progress' +import { createBuildReport } from '../utils/build-report' import { overrideEnv } from '../utils/env' import { ActionableError } from '../utils/errors' @@ -16,9 +17,10 @@ import { loadKit } from '../utils/kit' import { acquireLock, acquireOutputLock, formatLockError } from '../utils/lockfile' import { intro, logger, outro } from '../utils/logger' import { resolveRootDir } from '../utils/paths' -import { createPhaseReporter, formatPhaseBreakdown } from '../utils/phase-reporter' +import { createPhaseReporter, formatPhaseBreakdown, formatPhaseTable } from '../utils/phase-reporter' import { startCpuProfile, stopCpuProfile } from '../utils/profile' import { resolveServerBuild } from '../utils/server-build' +import { MUTED } from '../utils/terminal-theme' import { dotEnvArgs, envNameArgs, extendsArgs, logLevelArgs, profileArgs, rootDirArgs, targetArgs } from './_shared' /** How often a phase repeats itself where there is no animated line. */ @@ -106,6 +108,10 @@ export default defineCommand({ }) progress.attachNuxt(nuxt) + const report = createBuildReport(nuxt, { + progress, + command: ctx.args.prerender ? 'generate' : 'build', + }) showBanner(nuxt) await nuxt.ready() @@ -143,23 +149,29 @@ export default defineCommand({ stopReporting() progress.finish() + const elapsed = Date.now() - start - const breakdown = formatPhaseBreakdown(progress.timings) - if (breakdown) { - logger.message(styleText('dim', breakdown)) + const verbose = nuxt.options.logLevel === 'verbose' + const summary = nuxt.options.logLevel === 'silent' ? undefined : await report.summary(verbose) + if (summary) { + logger.success(summary) } - if (ctx.args.prerender) { - if (!nuxt.options.ssr) { - logger.warn(`HTML content not prerendered because ${styleText('cyan', 'ssr: false')} was set.`) - logger.info(`You can read more in ${styleText('cyan', 'https://nuxt.com/docs/getting-started/deployment#static-hosting')}.`) - } - const dir = serverBuild.publicDir - const publicDir = dir ? relative(process.cwd(), dir) : '.output/public' - outro(`✨ You can now deploy ${styleText('cyan', publicDir)} to any static hosting! ${styleText('gray', `(${formatDuration(Date.now() - start)})`)}`) + if (ctx.args.prerender && !nuxt.options.ssr) { + logger.warn(`HTML content not prerendered because ${styleText('cyan', 'ssr: false')} was set.`) + logger.info(`You can read more in ${styleText('cyan', 'https://nuxt.com/docs/getting-started/deployment#static-hosting')}.`) + } + + const breakdown = verbose ? formatPhaseTable(progress.timings) : formatPhaseBreakdown(progress.phaseTimings) + const total = `Build complete in ${styleText('cyan', formatDuration(elapsed))}` + const complete = breakdown ? `${total}\n${verbose ? breakdown : styleText(MUTED, breakdown)}` : total + const next = ctx.args.prerender ? report.staticCommands(serverBuild) : report.commands(serverBuild) + if (next.length) { + logger.success(complete) + outro(next.join('\n')) } else { - outro(`✨ Build complete in ${styleText('cyan', formatDuration(Date.now() - start))}!`) + outro(complete) } } finally { diff --git a/packages/nuxt-cli/src/utils/build-progress.ts b/packages/nuxt-cli/src/utils/build-progress.ts index 09c9244bb..423d48e48 100644 --- a/packages/nuxt-cli/src/utils/build-progress.ts +++ b/packages/nuxt-cli/src/utils/build-progress.ts @@ -1,54 +1,47 @@ -import type { Phase, ProgressSnapshot } from './progress-snapshot' +import type { Phase, PhaseTiming, ProgressMeter, ProgressSnapshot } from './progress-snapshot' import { PhaseTimeline } from './progress-snapshot' /** - * Build phases, in the order they are reached. A phase is never re-entered, so - * the index only ever moves forward and the breakdown printed at the end lists - * each phase once. + * The phases that run one after the other before anything is bundled. The last + * one covers the rest of the build, in which bundles and prerendering are + * tracked as tasks of their own, since they can overlap. */ const BUILD_PHASES: readonly Phase[] = [ { id: 'config', message: 'Loading Nuxt config' }, { id: 'modules', message: 'Setting up modules' }, { id: 'app', message: 'Preparing app' }, { id: 'types', message: 'Generating types' }, - { id: 'client', message: 'Bundling client' }, - { id: 'server', message: 'Bundling server' }, - { id: 'nitro', message: 'Building Nitro server' }, + { id: 'build', message: 'Building' }, ] const HOOK_PHASES: Record = { 'modules:before': 'modules', 'builder:generateApp': 'app', 'prepare:types': 'types', - 'build:before': 'client', - 'nitro:build:before': 'nitro', + 'build:before': 'build', } -/** Nitro builds on its own hooks, which Nuxt's never see. */ -const NITRO_INIT_HOOK = 'nitro:init' - -/** - * Nitro's own hooks, relabelled. Without these the Nitro phase says nothing - * between the bundle starting and the output being written, which on a large - * project is the longest silence of the build. - */ -const NITRO_MESSAGES: Record = { - 'rollup:before': 'Bundling Nitro server', - 'prerender:routes': 'Prerendering routes', -} - -const PRERENDER_HOOK = 'prerender:generate' +const BUILD_PHASE = 'build' +const PRERENDER_TASK = 'prerender' interface HookableLike { beforeEach?: (fn: (event: { name: string, args?: unknown[] }) => void) => void } interface NuxtLike { - options?: { experimental?: { viteEnvironmentApi?: boolean } } hooks?: HookableLike } +interface Task { + start: number + end?: number +} + +function listLabels(labels: string[]): string { + return labels.length > 1 ? `${labels.slice(0, -1).join(', ')} and ${labels.at(-1)}` : labels[0]! +} + /** * Tracks how far a production build has got, so the same transient phase line * `nuxt dev` shows can report `nuxt build`, and the completion summary can list @@ -57,19 +50,19 @@ interface NuxtLike { export class BuildProgress extends PhaseTimeline { #message = BUILD_PHASES[0]!.message #finished = false - /** - * With the Vite environment API a single build covers both environments, so - * the client and server configs resolve up front and cannot mark the boundary - * between them. - */ - #splitBundles = true + #tasks = new Map() + #active: string[] = [] + #key = BUILD_PHASE + #prerender: ProgressMeter = { done: 0, total: 0 } + #phaseTimings: PhaseTiming[] = [] constructor() { super(BUILD_PHASES) } override get snapshot(): ProgressSnapshot { - return { ...super.snapshot, message: this.#message } + const snapshot = { ...super.snapshot, phase: this.#key, message: this.#message } + return this.#prerendering ? { ...snapshot, meter: { ...this.#prerender } } : snapshot } override onUpdate(listener: (snapshot: ProgressSnapshot) => void): () => void { @@ -78,19 +71,43 @@ export class BuildProgress extends PhaseTimeline { return off } - setPhase(id: string, message?: string): void { - if (this.#finished || this.enter(id) === undefined) { + setPhase(id: string): void { + if (this.#finished || !this.enter(id)) { return } - this.setMessage(message || BUILD_PHASES[this.index]!.message) + this.#key = id + this.#setMessage(BUILD_PHASES[this.index]!.message) } - setMessage(message: string): void { - if (this.#finished || message === this.#message) { + /** Start bundling `label`, such as `client`, alongside anything else in flight. */ + startBundle(label: string): void { + this.#startTask(label) + } + + endBundle(label: string): void { + this.#endTask(label) + } + + /** Start prerendering the `total` routes known up front. */ + startPrerender(total = 0): void { + this.#prerender = { done: 0, total } + this.#startTask(PRERENDER_TASK) + } + + /** Count a route as done, out of the `total` known so far. */ + prerenderRoute(route: string, total = 0): void { + if (this.#finished) { return } - this.#message = message - this.emit() + const done = this.#prerender.done + 1 + this.#prerender = { done, total: Math.max(total, this.#prerender.total, done), detail: route } + if (this.#prerendering) { + this.emit() + } + } + + endPrerender(): void { + this.#endTask(PRERENDER_TASK) } /** @@ -99,55 +116,96 @@ export class BuildProgress extends PhaseTimeline { * what is said about it finishing. */ finish(): void { - if (!this.#finished) { - this.closePhase() - this.#finished = true + if (this.#finished) { + return + } + const now = Date.now() + const building = BUILD_PHASES[this.index]!.id === BUILD_PHASE + this.closePhase() + this.#finished = true + this.#phaseTimings = [...this.timings] + if (!building || !this.#tasks.size) { + return } + // The build phase is only the span the tasks ran in; each task reports its own. + this.timings.pop() + const tasks: PhaseTiming[] = [...this.#tasks].map(([id, task]) => ({ + phase: id, + message: id, + start: task.start - this.startedAt, + duration: (task.end ?? now) - task.start, + })) + this.timings.push(...tasks.sort((a, b) => a.start! - b.start!)) + } + + /** + * The phases alone once the build has finished, with bundling and + * prerendering as the one `build` span they ran in. + */ + get phaseTimings(): PhaseTiming[] { + return this.#phaseTimings } /** - * Derive phases from the hooks Nuxt and Nitro call, so the timeline follows - * the project's own build rather than a schedule guessed by the CLI. + * Derive phases from the hooks Nuxt calls, so the timeline follows the + * project's own build rather than a schedule guessed by the CLI. */ attachNuxt(nuxt: NuxtLike): void { - this.#splitBundles = !nuxt.options?.experimental?.viteEnvironmentApi - nuxt.hooks?.beforeEach?.(({ name, args }) => { + nuxt.hooks?.beforeEach?.(({ name }) => { const phase = HOOK_PHASES[name] if (phase) { - this.setPhase(phase, phase === 'client' && !this.#splitBundles ? 'Bundling app' : undefined) - return - } - if (name === 'vite:configResolved' && this.#splitBundles) { - const ctx = args?.[1] as { isServer?: boolean } | undefined - this.setPhase(ctx?.isServer ? 'server' : 'client') - } - else if (name === 'webpack:compile') { - const ctx = args?.[0] as { name?: string } | undefined - this.setPhase(ctx?.name === 'server' ? 'server' : 'client') - } - else if (name === NITRO_INIT_HOOK) { - this.#attachNitro((args?.[0] as { hooks?: HookableLike } | undefined)?.hooks) + this.setPhase(phase) } }) } - #attachNitro(hooks: HookableLike | undefined): void { - hooks?.beforeEach?.(({ name, args }) => { - // Nitro's hooks also run while Nuxt is still bundling the app, and those - // are not what the build is waiting on. - if (BUILD_PHASES[this.index]!.id !== 'nitro') { - return - } - const message = NITRO_MESSAGES[name] - if (message) { - this.setMessage(message) - } - else if (name === PRERENDER_HOOK) { - const route = (args?.[0] as { route?: string } | undefined)?.route - if (route) { - this.setMessage(`Prerendering ${route}`) - } - } - }) + get #prerendering(): boolean { + return !this.#finished && this.#active.includes(PRERENDER_TASK) + } + + #startTask(id: string): void { + if (this.#finished) { + return + } + if (this.enter(BUILD_PHASE)) { + this.#key = BUILD_PHASE + } + this.#tasks.set(id, { start: Date.now() }) + this.#active = [...this.#active.filter(active => active !== id), id] + this.#update() + } + + #endTask(id: string): void { + const task = this.#tasks.get(id) + if (this.#finished || !task || task.end !== undefined) { + return + } + task.end = Date.now() + this.#active = this.#active.filter(active => active !== id) + this.#update() + } + + #update(): void { + if (this.#finished || !this.#active.length) { + // Between tasks the line keeps its phase, so a pipe is not handed a + // line for every gap between one bundle and the next. + this.#setMessage(BUILD_PHASES.at(-1)!.message) + return + } + if (this.#active.includes(PRERENDER_TASK)) { + this.#key = PRERENDER_TASK + this.#setMessage('Prerendering routes') + return + } + this.#key = `bundle:${this.#active.join('+')}` + this.#setMessage(`Bundling ${listLabels(this.#active)}`) + } + + #setMessage(message: string): void { + if (this.#finished || message === this.#message) { + return + } + this.#message = message + this.emit() } } diff --git a/packages/nuxt-cli/src/utils/build-report.ts b/packages/nuxt-cli/src/utils/build-report.ts new file mode 100644 index 000000000..0bf8f5f98 --- /dev/null +++ b/packages/nuxt-cli/src/utils/build-report.ts @@ -0,0 +1,341 @@ +import type { Nuxt } from '@nuxt/schema' +import type { BuildProgress } from './build-progress' +import type { ServerBuild } from './server-build' + +import { readFile } from 'node:fs/promises' +import process from 'node:process' +import { styleText } from 'node:util' +import { gzip } from 'node:zlib' + +import { join, relative } from 'pathe' +import { isCI } from 'std-env' + +import { formatBytes, formatDuration } from './formatting' +import { logger } from './logger' +import { MUTED } from './terminal-theme' + +/** A bundle Nuxt reports building, from any app or server builder. */ +interface BuildEnvironment { + /** Unique within a build, as the builder names it: `client`, `ssr`, `nitro`, ... */ + name: string + consumer: 'client' | 'server' + /** The tool that bundles it, such as `vite`, `webpack` or `rollup`. */ + builder: string +} + +interface BuildFile { + /** Relative to the bundle's `outDir`. */ + path: string + size: number +} + +interface BuildEnvironmentResult { + duration: number + outDir: string + files: BuildFile[] +} + +interface PrerenderedRoute { + route: string + duration: number + fileName?: string + skipped: boolean + error?: { status?: number, message: string } + /** How many routes are known so far, including those found by crawling. */ + total: number +} + +interface PrerenderResult { + duration: number + written: number + failed: Array<{ + route: string + status?: number + message: string + /** The pages that link to the route, where the prerenderer reports them. */ + linkedFrom?: string[] + }> +} + +/** The hooks Nuxt reports a production build through. */ +interface BuildReportHooks { + 'build:environment:start': (environment: BuildEnvironment) => void + 'build:environment:done': (environment: BuildEnvironment, result: BuildEnvironmentResult) => void + 'build:prerender:start': (info: { routes: number }) => void + 'build:prerender:route': (route: PrerenderedRoute) => void + 'build:prerender:done': (result: PrerenderResult) => void +} + +type HookFn = (name: Name, fn: BuildReportHooks[Name]) => void + +interface BuildReportOptions { + progress: BuildProgress + /** The command to suggest for the full route list, such as `build` or `generate`. */ + command: string +} + +interface Bundle { + environment: BuildEnvironment + result: BuildEnvironmentResult + /** Without source maps. */ + files: BuildFile[] + size: number + /** Gzip size of each of `files`, for bundles that are sent to the browser. */ + gzip: Promise +} + +interface Entry { + start: number + render: (verbose: boolean) => Promise +} + +export interface BuildReport { + /** One line per bundle and the prerender totals, in the order they ran; file tables when verbose. */ + summary: (verbose: boolean) => Promise + /** How to preview and deploy a build that has a server. */ + commands: (serverBuild: ServerBuild) => string[] + /** Where a prerendered build can go. */ + staticCommands: (serverBuild: ServerBuild) => string[] +} + +/** How many prerendered routes a local build lists before pointing at verbose output. */ +const PRERENDER_ROUTE_LIMIT = 20 + +/** How many linking pages a local build names for each failed route. */ +const LINKED_FROM_LIMIT = 3 + +/** Source maps, which some builders write as `*.map.json`. */ +const SOURCE_MAP_RE = /\.map(?:\.json)?$/ + +const GZIP_CONCURRENCY = 8 + +const LABELS: Record = { client: 'Client', server: 'Server', ssr: 'Server', nitro: 'Nitro' } + +/** What a bundle is called on the progress line and in the breakdown. */ +function bundleLabel(environment: BuildEnvironment): string { + return LABELS[environment.name]?.toLowerCase() ?? environment.name +} + +function displayLabel(environment: BuildEnvironment): string { + return LABELS[environment.name] ?? environment.name +} + +/** + * Follow a production build through the hooks Nuxt reports it with, driving the + * progress line and collecting what the summary prints once it is done. + */ +export function createBuildReport(nuxt: Nuxt, options: BuildReportOptions): BuildReport { + const hook = nuxt.hook as unknown as HookFn + const { progress } = options + const entries: Entry[] = [] + const bundles: Bundle[] = [] + const routes: PrerenderedRoute[] = [] + const gzipFile = createLimiter(GZIP_CONCURRENCY) + const starts = new Map() + let prerenderStart = 0 + + hook('build:environment:start', (environment) => { + starts.set(environment.name, Date.now()) + progress.startBundle(bundleLabel(environment)) + }) + + hook('build:environment:done', (environment, result) => { + progress.endBundle(bundleLabel(environment)) + const files = result.files.filter(file => !SOURCE_MAP_RE.test(file.path)) + const bundle: Bundle = { + environment, + result, + files, + size: files.reduce((sum, file) => sum + file.size, 0), + gzip: environment.consumer === 'client' + ? Promise.all(files.map(file => gzipFile(() => gzipSize(join(result.outDir, file.path))))).catch(() => undefined) + : Promise.resolve(undefined), + } + bundles.push(bundle) + entries.push({ + start: starts.get(environment.name) ?? Date.now() - result.duration, + render: verbose => formatBundle(bundle, verbose), + }) + }) + + hook('build:prerender:start', (info) => { + prerenderStart = Date.now() + routes.length = 0 + progress.startPrerender(info.routes) + }) + + hook('build:prerender:route', (route) => { + routes.push(route) + progress.prerenderRoute(route.route, route.total) + }) + + hook('build:prerender:done', (result) => { + progress.endPrerender() + if (result.failed.length) { + logger.error(`Failed to prerender ${result.failed.length} route${result.failed.length === 1 ? '' : 's'}:\n${ + result.failed.map(route => formatFailedRoute(route, isCI || nuxt.options.logLevel === 'verbose')).join('\n')}`) + } + if (!result.written) { + return + } + const command = nuxtCommand(nuxt, options.command) + const written = [...routes] + entries.push({ + start: prerenderStart || Date.now() - result.duration, + render: async verbose => [ + `Prerendered ${result.written} route${result.written === 1 ? '' : 's'} in ${formatDuration(result.duration)}`, + ...formatPrerenderedRoutes(written, command, verbose), + ].join('\n'), + }) + }) + + /** Whether a server bundle was written into the build output, and so something to run. */ + function hasServerOutput(serverBuild: ServerBuild): boolean { + return bundles.some(bundle => bundle.environment.consumer === 'server' && !relative(serverBuild.dir, bundle.result.outDir).startsWith('..')) + } + + return { + async summary(verbose) { + const sorted = [...entries].sort((a, b) => a.start - b.start) + const lines = await Promise.all(sorted.map(entry => entry.render(verbose))) + return lines.length ? lines.join('\n') : undefined + }, + commands(serverBuild) { + const commands: string[] = [] + if (hasServerOutput(serverBuild)) { + commands.push(`You can preview this build using ${styleText('cyan', nuxtCommand(nuxt, 'preview'))}`) + } + const deploy = deployCommand(nuxt, serverBuild) + if (deploy) { + commands.push(`You can deploy this build using ${styleText('cyan', deploy)}`) + } + return commands + }, + staticCommands(serverBuild) { + const target = serverBuild.target + const publicDir = relative(process.cwd(), serverBuild.publicDir) || '.' + // Only the generic target writes plain files that any static host serves. + if (!target || target === 'static') { + return [`You can now deploy ${styleText('cyan', publicDir)} to any static hosting`] + } + const deploy = deployCommand(nuxt, serverBuild) + if (deploy) { + return [`You can deploy this build using ${styleText('cyan', deploy)}`] + } + const dir = relative(process.cwd(), serverBuild.dir) || '.' + return [`You can now deploy ${styleText('cyan', dir)} to ${styleText('cyan', target)}`] + }, + } +} + +/** The deploy command, which runs from the project root, prefixed with a `cd` there when that is not the current directory. */ +function deployCommand(nuxt: Nuxt, serverBuild: ServerBuild): string | undefined { + const command = serverBuild.deployCommand + const dir = relative(process.cwd(), nuxt.options.rootDir || process.cwd()) + return command && dir ? `cd ${quote(dir)} && ${command}` : command +} + +function quote(path: string): string { + return /\s/.test(path) ? JSON.stringify(path) : path +} + +async function formatBundle(bundle: Bundle, verbose: boolean): Promise { + const { environment, result, files } = bundle + const gzip = await bundle.gzip + const total = gzip?.reduce((sum, size) => sum + size, 0) + const size = `${formatBytes(bundle.size)}${total === undefined ? '' : ` (${formatBytes(total)} gzip)`}` + const line = `${displayLabel(environment)} ${styleText(MUTED, `(${environment.builder})`)} built in ${formatDuration(result.duration)}${styleText(MUTED, ` \u00B7 ${size}`)}` + if (!verbose || !files.length) { + return line + } + const rows = files + .map((file, index) => ({ path: relative(process.cwd(), join(result.outDir, file.path)), size: formatBytes(file.size), gzip: gzip && formatBytes(gzip[index]!), bytes: file.size })) + .sort((a, b) => b.bytes - a.bytes) + const pathWidth = rows.reduce((max, row) => Math.max(max, row.path.length), 0) + const sizeWidth = rows.reduce((max, row) => Math.max(max, row.size.length), 0) + const gzipWidth = rows.reduce((max, row) => Math.max(max, row.gzip?.length ?? 0), 0) + return [line, ...rows.map(row => ` ${row.path.padEnd(pathWidth)} ${styleText(MUTED, `${row.size.padStart(sizeWidth)}${row.gzip ? ` ${row.gzip.padStart(gzipWidth)} gzip` : ''}`)}`)].join('\n') +} + +/** `npx nuxt `, naming the project when it is not the current directory. */ +function nuxtCommand(nuxt: Nuxt, command: string): string { + const dir = relative(process.cwd(), nuxt.options.rootDir || process.cwd()) + return `npx nuxt ${command}${dir ? ` ${quote(dir)}` : ''}` +} + +function routePath(route: string): string { + const query = route.indexOf('?') + return query === -1 ? route : route.slice(0, query) +} + +function isPayloadRoute(route: PrerenderedRoute): boolean { + return routePath(route.route).endsWith('/_payload.json') +} + +/** + * The routes a build wrote. CI logs are read after the fact to check what was + * deployed, so they list every route, skipped ones too, as does verbose output; + * a terminal lists a sample of the pages and says how to see the rest. + */ +function formatPrerenderedRoutes(routes: PrerenderedRoute[], command: string, verbose: boolean): string[] { + const all = isCI || verbose + const listed = routes.filter(route => !route.error && (all || !route.skipped)) + + if (all) { + const width = Math.min(listed.reduce((max, route) => Math.max(max, route.route.length), 0), 60) + const times = listed.map(route => route.skipped ? 'skipped' : formatRouteTime(route.duration)) + const timeWidth = times.reduce((max, time) => Math.max(max, time.length), 0) + return listed.map((route, index) => `${route.route.padEnd(width)} ${styleText(MUTED, times[index]!.padStart(timeWidth))}`.trimEnd()) + } + + const pages = listed.filter(route => !isPayloadRoute(route)) + const shown = pages.sort((a, b) => a.route.localeCompare(b.route, 'en', { numeric: true })).slice(0, PRERENDER_ROUTE_LIMIT) + const lines = shown.length ? [styleText(MUTED, 'Routes:'), ...shown.map(route => route.route)] : [] + const hidden = listed.length - shown.length + if (hidden) { + lines.push(styleText(MUTED, `\u2026 and ${hidden} more. Run ${styleText('cyan', `${command} --logLevel=verbose`)} to see all prerendered routes.`)) + } + return lines +} + +/** Whole milliseconds until a route takes seconds. */ +function formatRouteTime(ms: number): string { + return ms < 1000 ? `${Math.round(ms)}ms` : formatDuration(ms) +} + +function formatFailedRoute(route: PrerenderResult['failed'][number], all: boolean): string { + const detail = [route.status, route.message].filter(Boolean).join(' ') + const line = `${route.route}${detail ? styleText(MUTED, ` (${detail})`) : ''}` + const parents = route.linkedFrom ?? [] + if (!parents.length) { + return line + } + const shown = all ? parents : parents.slice(0, LINKED_FROM_LIMIT) + const hidden = parents.length - shown.length + return `${line}\n${styleText(MUTED, ` linked from ${shown.join(', ')}${hidden ? ` and ${hidden} more` : ''}`)}` +} + +async function gzipSize(path: string): Promise { + const content = await readFile(path) + return new Promise((resolve, reject) => gzip(content, (error, result) => error ? reject(error) : resolve(result.byteLength))) +} + +function createLimiter(concurrency: number) { + let running = 0 + const queue: Array<() => void> = [] + return (task: () => Promise): Promise => new Promise((resolve, reject) => { + const run = () => { + running++ + task().then(resolve, reject).finally(() => { + running-- + queue.shift()?.() + }) + } + if (running < concurrency) { + run() + } + else { + queue.push(run) + } + }) +} diff --git a/packages/nuxt-cli/src/utils/formatting.ts b/packages/nuxt-cli/src/utils/formatting.ts index a6a200fc8..c09ed0f07 100644 --- a/packages/nuxt-cli/src/utils/formatting.ts +++ b/packages/nuxt-cli/src/utils/formatting.ts @@ -132,6 +132,19 @@ export function formatDuration(ms: number): string { : `${minutes}m ${seconds}s` } +const BYTE_UNITS = ['B', 'kB', 'MB', 'GB'] + +/** Format a byte count in decimal units, as Vite and Nitro report sizes (`812 B`, `4.36 kB`, `2.45 MB`). */ +export function formatBytes(bytes: number): string { + let value = Math.max(0, bytes) + let unit = 0 + while (value >= 1000 && unit < BYTE_UNITS.length - 1) { + value /= 1000 + unit++ + } + return unit === 0 ? `${value} B` : `${value.toFixed(2)} ${BYTE_UNITS[unit]}` +} + const AT_MENTION_RE = /\b@([^, ]+)/g const BACKTICK_RE = /`([^`]*)`/g diff --git a/packages/nuxt-cli/src/utils/logger.ts b/packages/nuxt-cli/src/utils/logger.ts index c81cb21eb..52f1b8722 100644 --- a/packages/nuxt-cli/src/utils/logger.ts +++ b/packages/nuxt-cli/src/utils/logger.ts @@ -90,10 +90,14 @@ export function intro(message: string): void { /** {@link intro}, for the line a command finishes on. */ export function outro(message: string): void { if (!process.stdout.isTTY || isCI) { - writeDirect(`${styleText('green', S_SUCCESS)} ${message}\n`) + writeDirect(`${styleText('green', S_SUCCESS)} ${message.replace(/\n/g, '\n ')}\n`) return } - clackOutro(message) + // Clack leaves the lines after the first unindented; line them up with it. + message = message.replace(/\n/g, '\n ') + // Nuxt 4 calls `consola.wrapAll()` while building, which trims each chunk + // written to stdout and would drop the blank line clack ends the outro with. + clackOutro(message, { output: { write: writeDirect } as unknown as NodeJS.WriteStream }) } export const debug = createDebug('nuxi') diff --git a/packages/nuxt-cli/src/utils/phase-reporter.ts b/packages/nuxt-cli/src/utils/phase-reporter.ts index 59583fb7e..1056067a1 100644 --- a/packages/nuxt-cli/src/utils/phase-reporter.ts +++ b/packages/nuxt-cli/src/utils/phase-reporter.ts @@ -1,14 +1,16 @@ -import type { PhaseTiming, ProgressSnapshot } from './progress-snapshot' +import type { PhaseTiming, ProgressMeter, ProgressSnapshot } from './progress-snapshot' import process from 'node:process' import { styleText } from 'node:util' import { isCI } from 'std-env' -import { decapitalise, formatDuration, terminalLink } from './formatting' +import { supportsUnicode } from '../dev/tui/support' +import { decapitalise, formatDuration, terminalLink, visibleWidth } from './formatting' import { logger } from './logger' import { READY_MESSAGE } from './progress-snapshot' import { tapOutput } from './stdout' +import { MUTED } from './terminal-theme' const FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'] const FRAME_INTERVAL = 80 @@ -21,6 +23,11 @@ const COLUMN_ONE = '\r' */ const PHASE_ELAPSED_THRESHOLD = 100 +const METER_WIDTH = 20 + +/** The shortest a meter's detail is cut to before it is left out. */ +const METER_DETAIL_MIN = 8 + const HIDE_CURSOR = '\u001B[?25l' const SHOW_CURSOR = '\u001B[?25h' @@ -37,10 +44,34 @@ function formatElapsed(snapshot: ProgressSnapshot, drift: number): string { const total = snapshot.elapsed + drift const phase = snapshot.phaseElapsed + drift return total - phase >= PHASE_ELAPSED_THRESHOLD - ? `${formatDuration(phase)} \u00B7 ${formatDuration(total)}` + ? `${formatDuration(phase)} \u00B7 total ${formatDuration(total)}` : formatDuration(total) } +/** `42/180`, for output that has no room for a bar. */ +function formatCount(meter: ProgressMeter | undefined): string { + return meter ? ` ${meter.done}/${meter.total}` : '' +} + +/** `━━━━━━━━ 42/180`, drawn like the progress bar in the `nuxt dev` panel. */ +export function formatMeter(meter: ProgressMeter, width: number = METER_WIDTH): string { + const filled = meter.total ? Math.min(width, Math.floor(meter.done / meter.total * width)) : 0 + const glyph = supportsUnicode() ? '━' : '=' + return `${styleText('green', glyph.repeat(filled))}${styleText(MUTED, glyph.repeat(width - filled))} ${styleText(MUTED, `${meter.done}/${meter.total}`)}` +} + +/** Cut `text` to `width` columns, or drop it when too little of it would be left. */ +function fit(text: string, width: number): string { + if (text.length <= width) { + return text + } + return width >= METER_DETAIL_MIN ? `\u2026${text.slice(text.length - width + 1)}` : '' +} + +function bundlePhaseLabels(phase: string): string[] | undefined { + return phase.startsWith('bundle:') ? phase.slice('bundle:'.length).split('+') : undefined +} + export interface PhaseReporter { update: (snapshot: ProgressSnapshot) => void /** The URL to print alongside the summary, once one is known. */ @@ -72,6 +103,36 @@ export function formatPhaseBreakdown(timings: PhaseTiming[]): string { .join(' · ') } +const PHASE_BAR_WIDTH = 24 + +/** + * One phase per line with a bar placed where it ran within the command, so the + * slow step stands out and phases that overlapped are seen to. + */ +export function formatPhaseTable(timings: PhaseTiming[]): string { + let elapsed = 0 + const placed = timings.map((timing) => { + const start = timing.start ?? elapsed + elapsed = Math.max(elapsed, start + timing.duration) + return { ...timing, start } + }) + const shown = placed.filter(timing => timing.duration >= 10) + if (!shown.length) { + return '' + } + const from = Math.min(...shown.map(timing => timing.start)) + const span = Math.max(1, Math.max(...shown.map(timing => timing.start + timing.duration)) - from) + const nameWidth = Math.max(...shown.map(timing => timing.phase.length)) + const durations = shown.map(timing => formatDuration(timing.duration)) + const durationWidth = Math.max(...durations.map(duration => duration.length)) + return shown.map((timing, index) => { + const left = Math.min(PHASE_BAR_WIDTH - 1, Math.floor((timing.start - from) / span * PHASE_BAR_WIDTH)) + const right = Math.max(left + 1, Math.round((timing.start - from + timing.duration) / span * PHASE_BAR_WIDTH)) + const bar = `${' '.repeat(left)}${styleText('cyan', '█'.repeat(right - left))}${' '.repeat(PHASE_BAR_WIDTH - right)}` + return `${timing.phase.padEnd(nameWidth)} ${bar} ${styleText(MUTED, durations[index]!.padStart(durationWidth))}` + }).join('\n') +} + /** * The URL the summary points at, so the address is on screen at the moment the * user is being told they can click it rather than a screenful further up. @@ -159,9 +220,18 @@ export function createPhaseReporter(options: PhaseReporterOptions = {}): PhaseRe */ function describe(): string { const pending = summarised ? snapshot!.pending : undefined - return pending - ? `rendering ${pending.label} ${styleText('dim', formatDuration(Date.now() - pending.startedAt))}` - : `${snapshot!.message} ${styleText('dim', formatElapsed(snapshot!, Date.now() - receivedAt))}` + if (pending) { + return `rendering ${pending.label} ${styleText(MUTED, formatDuration(Date.now() - pending.startedAt))}` + } + const { meter } = snapshot! + const line = `${snapshot!.message}${meter ? ` ${formatMeter(meter)}` : ''} ${styleText(MUTED, formatElapsed(snapshot!, Date.now() - receivedAt))}` + if (!meter?.detail) { + return line + } + // A line that wraps cannot be cleared in place, so the detail gives way to the terminal width. + const room = (stream.columns || 80) - visibleWidth(line) - 4 + const detail = fit(meter.detail, room) + return detail ? `${line} ${styleText(MUTED, detail)}` : line } function render() { @@ -214,7 +284,7 @@ export function createPhaseReporter(options: PhaseReporterOptions = {}): PhaseRe log(announce(pending.label, Date.now() - pending.startedAt), `rendering ${pending.label}`) return } - log(`${snapshot.message} ${styleText('dim', `(${formatElapsed(snapshot, Date.now() - receivedAt)})`)}`, snapshot.message) + log(`${snapshot.message}${formatCount(snapshot.meter)} ${styleText('dim', `(${formatElapsed(snapshot, Date.now() - receivedAt)})`)}`, snapshot.message) }, options.heartbeat) pulse.unref?.() } @@ -268,14 +338,28 @@ export function createPhaseReporter(options: PhaseReporterOptions = {}): PhaseRe if (next.status !== 'ready') { if (animated) { - render() + // A meter can move hundreds of times a second; the next frame picks it up. + if (!next.meter || next.phase !== lastPhase) { + lastPhase = next.phase + render() + } return } if (next.phase !== lastPhase) { + const previous = lastPhase === undefined ? undefined : bundlePhaseLabels(lastPhase) + const current = bundlePhaseLabels(next.phase) + // A bundle finishing only shrinks the active set, which the line that + // announced the bundle starting has already covered. + const finishing = previous !== undefined + && current !== undefined + && current.length < previous.length + && current.every(label => previous.includes(label)) lastPhase = next.phase - log(next.message, next.message) - schedulePulse() + if (!finishing) { + log(next.message, next.message) + schedulePulse() + } return } diff --git a/packages/nuxt-cli/src/utils/progress-snapshot.ts b/packages/nuxt-cli/src/utils/progress-snapshot.ts index 55af2bec3..82e02950a 100644 --- a/packages/nuxt-cli/src/utils/progress-snapshot.ts +++ b/packages/nuxt-cli/src/utils/progress-snapshot.ts @@ -19,10 +19,21 @@ export interface PendingRender { startedAt: number } +/** How far a task that works through a list has got. */ +export interface ProgressMeter { + done: number + /** How many items are known so far. Can grow while the task runs. */ + total: number + /** The item last finished, such as a route. */ + detail?: string +} + export interface PhaseTiming { phase: string message: string duration: number + /** When the phase started, in milliseconds since the command did. */ + start?: number } export interface ProgressSnapshot { @@ -53,6 +64,8 @@ export interface ProgressSnapshot { * whole load. Never set by a command that only builds. */ pending?: PendingRender + /** Set while the phase in flight counts through a list, such as prerendered routes. */ + meter?: ProgressMeter timings: PhaseTiming[] error?: { name: string, message: string } } @@ -106,7 +119,7 @@ export class PhaseTimeline { protected closePhase(): void { const phase = this.phases[this.index]! - this.timings.push({ phase: phase.id, message: phase.message, duration: Date.now() - this.phaseStartedAt }) + this.timings.push({ phase: phase.id, message: phase.message, duration: Date.now() - this.phaseStartedAt, start: this.phaseStartedAt - this.startedAt }) this.phaseStartedAt = Date.now() } diff --git a/packages/nuxt-cli/src/utils/server-build.ts b/packages/nuxt-cli/src/utils/server-build.ts index 7d7795bd5..31d770ad3 100644 --- a/packages/nuxt-cli/src/utils/server-build.ts +++ b/packages/nuxt-cli/src/utils/server-build.ts @@ -25,6 +25,8 @@ export interface ServerBuild { readonly publicDir: string /** Command that runs this build locally, when it has a server to run. */ readonly previewCommand: string | undefined + /** Command that deploys this build to its target from the project root, when the target has one. */ + readonly deployCommand: string | undefined /** Directory to serve when this build is static only. */ readonly previewStaticDir: string | undefined } @@ -40,6 +42,9 @@ interface NuxtServerBuild { command?: () => string | undefined staticDir?: () => string } + deploy?: { + command?: () => string | undefined + } } /** @@ -165,6 +170,9 @@ export function resolveServerBuild(kit: MaybeModernKit, nuxt: Nuxt): ServerBuild get previewCommand() { return declared?.preview?.command?.() ?? getNitro()?.options.commands?.preview }, + get deployCommand() { + return declared?.deploy?.command?.() + }, get previewStaticDir() { const dir = declared?.preview?.staticDir?.() return dir ? resolve(dir) : undefined diff --git a/packages/nuxt-cli/test/unit/build-progress.spec.ts b/packages/nuxt-cli/test/unit/build-progress.spec.ts index 8aa216973..e1ebfb50a 100644 --- a/packages/nuxt-cli/test/unit/build-progress.spec.ts +++ b/packages/nuxt-cli/test/unit/build-progress.spec.ts @@ -1,93 +1,154 @@ import type { ProgressSnapshot } from '../../src/utils/progress-snapshot' -import { describe, expect, it } from 'vitest' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { BuildProgress } from '../../src/utils/build-progress' type HookHandler = (event: { name: string, args?: unknown[] }) => void -function nuxtStub(options: { viteEnvironmentApi?: boolean } = {}) { +function nuxtStub() { const handlers: HookHandler[] = [] - const nitroHandlers: HookHandler[] = [] return { - nuxt: { - options: { experimental: { viteEnvironmentApi: options.viteEnvironmentApi } }, - hooks: { beforeEach: (fn: HookHandler) => void handlers.push(fn) }, - }, - call(name: string, ...args: unknown[]) { + nuxt: { hooks: { beforeEach: (fn: HookHandler) => void handlers.push(fn) } }, + call(name: string) { for (const handler of handlers) { - handler({ name, args }) - } - }, - nitro: { hooks: { beforeEach: (fn: HookHandler) => void nitroHandlers.push(fn) } }, - callNitro(name: string, ...args: unknown[]) { - for (const handler of nitroHandlers) { - handler({ name, args }) + handler({ name }) } }, } } -function messages(progress: BuildProgress): string[] { - const seen: string[] = [] - progress.onUpdate((snapshot: ProgressSnapshot) => seen.push(snapshot.message)) +function track(progress: BuildProgress): ProgressSnapshot[] { + const seen: ProgressSnapshot[] = [] + progress.onUpdate(snapshot => seen.push(snapshot)) return seen } describe('build progress', () => { + beforeEach(() => { + vi.useFakeTimers({ now: 0 }) + }) + afterEach(() => { + vi.useRealTimers() + }) + it('should follow the phases of a production build', () => { const progress = new BuildProgress() const stub = nuxtStub() progress.attachNuxt(stub.nuxt) - const seen = messages(progress) + const seen = track(progress) stub.call('modules:before') stub.call('builder:generateApp') stub.call('prepare:types') stub.call('build:before') - stub.call('vite:configResolved', {}, { isClient: true, isServer: false }) - stub.call('vite:configResolved', {}, { isClient: false, isServer: true }) - stub.call('nitro:build:before', {}) + progress.startBundle('client') + progress.endBundle('client') + progress.startBundle('server') + progress.endBundle('server') + progress.startPrerender() + progress.endPrerender() + progress.startBundle('nitro') + progress.endBundle('nitro') progress.finish() - expect(seen).toEqual([ + expect(seen.map(snapshot => snapshot.message)).toEqual([ 'Loading Nuxt config', 'Setting up modules', 'Preparing app', 'Generating types', + 'Building', 'Bundling client', + 'Building', 'Bundling server', - 'Building Nitro server', + 'Building', + 'Prerendering routes', + 'Building', + 'Bundling nitro', + 'Building', ]) - expect(progress.timings.map(timing => timing.phase)).toEqual(['config', 'modules', 'app', 'types', 'client', 'server', 'nitro']) + expect(progress.timings.map(timing => timing.phase)).toEqual(['config', 'modules', 'app', 'types', 'client', 'server', 'prerender', 'nitro']) }) - it('should not split the bundle phase when a single build covers both environments', () => { + it('should report bundles that build at the same time', () => { const progress = new BuildProgress() - const stub = nuxtStub({ viteEnvironmentApi: true }) - progress.attachNuxt(stub.nuxt) - const seen = messages(progress) + const seen = track(progress) + + progress.startBundle('client') + vi.advanceTimersByTime(5) + progress.startBundle('server') + vi.advanceTimersByTime(200) + progress.endBundle('server') + vi.advanceTimersByTime(100) + progress.endBundle('client') + progress.finish() - stub.call('build:before') - stub.call('vite:configResolved', {}, { isClient: true, isServer: false }) - stub.call('vite:configResolved', {}, { isClient: false, isServer: true }) + expect(seen.map(snapshot => snapshot.message)).toEqual(['Loading Nuxt config', 'Bundling client', 'Bundling client and server', 'Bundling client', 'Building']) + expect(progress.timings.filter(timing => timing.phase !== 'config')).toEqual([ + { phase: 'client', message: 'client', start: 0, duration: 305 }, + { phase: 'server', message: 'server', start: 5, duration: 200 }, + ]) + expect(progress.phaseTimings.map(timing => [timing.phase, timing.duration])).toEqual([['config', 0], ['build', 305]]) + }) + + it('should keep the phase of the last task between tasks', () => { + const progress = new BuildProgress() + const seen = track(progress) + + progress.startBundle('client') + progress.endBundle('client') + + expect(seen.at(-1)).toMatchObject({ phase: 'bundle:client', message: 'Building' }) + }) + + it('should count prerendered routes against the routes found so far', () => { + const progress = new BuildProgress() + const seen = track(progress) + + progress.startPrerender(1) + progress.prerenderRoute('/', 4) + progress.prerenderRoute('/about', 4) + progress.prerenderRoute('/blog', 2) + + expect(seen.slice(1).map(snapshot => [snapshot.message, snapshot.meter])).toEqual([ + ['Prerendering routes', { done: 0, total: 1 }], + ['Prerendering routes', { done: 1, total: 4, detail: '/' }], + ['Prerendering routes', { done: 2, total: 4, detail: '/about' }], + ['Prerendering routes', { done: 3, total: 4, detail: '/blog' }], + ]) + }) + + it('should never count more routes done than known', () => { + const progress = new BuildProgress() + const seen = track(progress) + + progress.startPrerender() + progress.prerenderRoute('/') + progress.prerenderRoute('/about') - expect(seen).toEqual(['Loading Nuxt config', 'Bundling app']) + expect(seen.at(-1)!.meter).toEqual({ done: 2, total: 2, detail: '/about' }) }) - it('should name what the Nitro phase is doing', () => { + it('should only carry a meter while prerendering', () => { + const progress = new BuildProgress() + const seen = track(progress) + + progress.startBundle('client') + progress.startPrerender(3) + progress.endPrerender() + + expect(seen.map(snapshot => snapshot.meter)).toEqual([undefined, undefined, { done: 0, total: 3 }, undefined]) + }) + + it('should time the build as one phase when no bundles are reported', () => { const progress = new BuildProgress() const stub = nuxtStub() progress.attachNuxt(stub.nuxt) - stub.call('nitro:init', stub.nitro) - const seen = messages(progress) - stub.callNitro('rollup:before') - stub.call('nitro:build:before', {}) - stub.callNitro('rollup:before') - stub.callNitro('prerender:generate', { route: '/about' }) + stub.call('build:before') + progress.finish() - expect(seen).toEqual(['Loading Nuxt config', 'Building Nitro server', 'Bundling Nitro server', 'Prerendering /about']) + expect(progress.timings.map(timing => timing.phase)).toEqual(['config', 'build']) }) it('should keep phase durations after the build is finished', () => { @@ -98,7 +159,7 @@ describe('build progress', () => { stub.call('modules:before') progress.finish() progress.finish() - stub.call('nitro:build:before', {}) + progress.startBundle('client') expect(progress.timings.map(timing => timing.phase)).toEqual(['config', 'modules']) expect(progress.snapshot.phase).toBe('modules') diff --git a/packages/nuxt-cli/test/unit/commands/build.spec.ts b/packages/nuxt-cli/test/unit/commands/build.spec.ts index 0b5bf8ef0..27b7483df 100644 --- a/packages/nuxt-cli/test/unit/commands/build.spec.ts +++ b/packages/nuxt-cli/test/unit/commands/build.spec.ts @@ -37,7 +37,7 @@ vi.mock('../../../src/utils/lockfile', () => ({ formatLockError: mocks.formatLockError, })) vi.mock('../../../src/utils/logger', () => ({ - logger: { error: vi.fn(), info: vi.fn(), warn: vi.fn(), message: vi.fn() }, + logger: { error: vi.fn(), info: vi.fn(), warn: vi.fn(), message: vi.fn(), success: vi.fn() }, intro: vi.fn(), outro: vi.fn(), })) @@ -178,6 +178,28 @@ describe('build', () => { expect(logger.info).toHaveBeenCalledWith(expect.stringMatching(/^Deploy target: .*vercel/)) }) + it.each([ + ['info', 1], + ['silent', 0], + ])('prints the bundle summary at log level %s %i times', async (logLevel, times) => { + const hooks = new Map unknown>() + mocks.loadNuxt.mockImplementation(({ overrides }) => Promise.resolve({ + hook: (name: string, fn: (...args: any[]) => unknown) => hooks.set(name, fn), + ready: vi.fn(), + options: { buildDir, rootDir: cwd, ssr: true, logLevel: overrides.logLevel }, + })) + mocks.buildNuxt.mockImplementation(async () => { + await hooks.get('build:environment:done')!( + { name: 'client', consumer: 'client', builder: 'vite' }, + { duration: 10, outDir: `${outputDir}/public`, files: [] }, + ) + }) + + await run([`--logLevel=${logLevel}`]) + + expect(vi.mocked(logger.success).mock.calls.filter(([message]) => String(message).includes('Client (vite) built'))).toHaveLength(times) + }) + it('builds without a server, locking the default output directory', async () => { mocks.buildNuxt.mockResolvedValue(undefined) mocks.useNitro.mockImplementation(() => { diff --git a/packages/nuxt-cli/test/unit/phase-reporter.spec.ts b/packages/nuxt-cli/test/unit/phase-reporter.spec.ts index 6c28f3c5a..d90ec49cc 100644 --- a/packages/nuxt-cli/test/unit/phase-reporter.spec.ts +++ b/packages/nuxt-cli/test/unit/phase-reporter.spec.ts @@ -1,7 +1,9 @@ import type { PhaseReporter } from '../../src/utils/phase-reporter' import type { ProgressSnapshot } from '../../src/utils/progress-snapshot' -import { afterEach, describe, expect, it, vi } from 'vitest' +import { stripVTControlCharacters, styleText } from 'node:util' + +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { blankLineBefore, observeOutput, trackOutputSpacing } from '../../src/utils/stdout' import { render, screen } from '../utils/terminal' @@ -13,7 +15,17 @@ vi.mock('std-env', async importOriginal => ({ process.env.FORCE_COLOR = '3' -const { createPhaseReporter, formatSummary, isAnimationSupported } = await import('../../src/utils/phase-reporter') +const { createPhaseReporter, formatMeter, formatPhaseTable, formatSummary, isAnimationSupported } = await import('../../src/utils/phase-reporter') + +function stubUnicode(supported: boolean): void { + vi.stubEnv('LC_ALL', supported ? 'en_GB.UTF-8' : 'C') + for (const name of ['WT_SESSION', 'TERMINUS_SUBLIME', 'ConEmuTask', 'TERM_PROGRAM']) { + vi.stubEnv(name, '') + } + if (supported) { + vi.stubEnv('WT_SESSION', '1') + } +} function snapshot(overrides: Partial = {}): ProgressSnapshot { return { @@ -70,7 +82,84 @@ describe('phase reporter', () => { startup.update(snapshot({ phase: 'types', message: 'Generating types', index: 3, elapsed: 41_000, phaseElapsed: 33_000 })) }) - expect(screen(renderer)).toMatch(/^. Generating types 33\.0s \u00B7 41\.0s$/) + expect(screen(renderer)).toMatch(/^. Generating types 33\.0s \u00B7 total 41\.0s$/) + }) + + describe('with a meter', () => { + beforeEach(() => stubUnicode(true)) + afterEach(() => { + vi.unstubAllEnvs() + }) + + const prerendering = (meter: ProgressSnapshot['meter']) => snapshot({ phase: 'prerender', message: 'Prerendering routes', index: 4, meter }) + + function terminal(columns: number) { + const chunks: string[] = [] + const stream = { isTTY: true, columns, write: (chunk: string) => { + chunks.push(chunk) + return true + } } as unknown as NodeJS.WriteStream + const startup = createPhaseReporter({ animated: true, stream }) + reporters.push(startup) + const line = () => stripVTControlCharacters(chunks.join('').split('\r').at(-1)!).slice(2) + return { startup, chunks, line } + } + + it('should draw a bar with the count and the last item', () => { + freezeClock() + const { startup, line } = terminal(120) + startup.update(prerendering({ done: 5, total: 20, detail: '/blog/hello' })) + + expect(line()).toBe(`Prerendering routes ${'━'.repeat(20)} 5/20 0.0ms /blog/hello`) + }) + + it('should cut the last item to fit the terminal', () => { + freezeClock() + const { startup, line } = terminal(64) + startup.update(prerendering({ done: 1, total: 2, detail: '/a/very/long/route/that/does/not/fit' })) + + expect(line()).toMatch(/^Prerendering routes \S+ 1\/2 0\.0ms …\S+\/not\/fit$/) + expect(line().length + 2).toBeLessThan(64) + }) + + it('should leave the last item out when there is no room for it', () => { + freezeClock() + const { startup, line } = terminal(40) + startup.update(prerendering({ done: 1, total: 2, detail: '/about' })) + + expect(line()).toBe(`Prerendering routes ${'━'.repeat(20)} 1/2 0.0ms`) + }) + + it('should leave a moving meter to the next frame', () => { + vi.useFakeTimers() + freezeClock() + try { + const { startup, chunks, line } = terminal(120) + startup.update(prerendering({ done: 0, total: 2 })) + chunks.length = 0 + startup.update(prerendering({ done: 1, total: 2, detail: '/' })) + + expect(chunks).toEqual([]) + vi.advanceTimersByTime(80) + expect(line()).toContain('1/2 0.0ms /') + } + finally { + vi.useRealTimers() + } + }) + + it('should repeat the count when there is no animated line', async () => { + const renderer = await render(async ({ waitForOutput }) => { + const startup = createPhaseReporter({ animated: false, heartbeat: 20 }) + reporters.push(startup) + startup.update(prerendering({ done: 0, total: 3 })) + startup.update(prerendering({ done: 2, total: 3, detail: '/about' })) + await waitForOutput(/Prerendering routes 2\/3/) + }) + + expect(screen(renderer)).toMatch(/Prerendering routes 2\/3 \(/) + expect(screen(renderer)).not.toContain('━') + }) }) it('should redraw only the spinner while the rest of the line is unchanged', () => { @@ -138,6 +227,25 @@ describe('phase reporter', () => { `) }) + it('should only report a bundle when it starts, not when one finishes', async () => { + const renderer = await render(() => { + const startup = reporter(false) + startup.update(snapshot({ phase: 'build', message: 'Building' })) + startup.update(snapshot({ phase: 'bundle:client', message: 'Bundling client' })) + startup.update(snapshot({ phase: 'bundle:client+server', message: 'Bundling client and server' })) + startup.update(snapshot({ phase: 'bundle:server', message: 'Bundling server' })) + }) + + expect(screen(renderer)).toMatchInlineSnapshot(` + "│ + ● Building + │ + ● Bundling client + │ + ● Bundling client and server" + `) + }) + it('should repeat a long phase when there is no animated line', async () => { const renderer = await render(async ({ waitForOutput }) => { const startup = createPhaseReporter({ animated: false, heartbeat: 20 }) @@ -173,7 +281,7 @@ describe('phase reporter', () => { await waitForOutput('Generating server types') }) - expect(screen(renderer)).toContain('Generating server types (33.0s \u00B7 41.0s)') + expect(screen(renderer)).toContain('Generating server types (33.0s \u00B7 total 41.0s)') }) it('should leave foreign output intact', async () => { @@ -381,3 +489,53 @@ describe('phase reporter', () => { delete process.env.NO_COLOR }) }) + +describe('formatMeter', () => { + afterEach(() => { + vi.unstubAllEnvs() + }) + + it('should fill the bar in proportion to what is done', () => { + stubUnicode(true) + expect(formatMeter({ done: 3, total: 4 }, 8)).toBe(`${styleText('green', '━'.repeat(6))}${styleText('gray', '━'.repeat(2))} ${styleText('gray', '3/4')}`) + }) + + it('should draw an empty bar when nothing is known yet', () => { + stubUnicode(true) + expect(stripVTControlCharacters(formatMeter({ done: 0, total: 0 }, 4))).toBe('━━━━ 0/0') + }) + + it('should fall back to ascii where the terminal cannot draw the bar', () => { + stubUnicode(false) + expect(stripVTControlCharacters(formatMeter({ done: 1, total: 2 }, 4))).toBe('==== 1/2') + }) +}) + +describe('formatPhaseTable', () => { + it('places each phase where it ran', () => { + const table = formatPhaseTable([ + { phase: 'config', message: '', duration: 1000, start: 0 }, + { phase: 'types', message: '', duration: 5, start: 1000 }, + { phase: 'client', message: '', duration: 2000, start: 1005 }, + { phase: 'server', message: '', duration: 1000, start: 1005 }, + { phase: 'prerender', message: '', duration: 1000, start: 3005 }, + ]) + expect(stripVTControlCharacters(table).split('\n')).toEqual([ + `config ${'█'.repeat(6)}${' '.repeat(18)} 1.00s`, + `client ${' '.repeat(6)}${'█'.repeat(12)}${' '.repeat(6)} 2.00s`, + `server ${' '.repeat(6)}${'█'.repeat(6)}${' '.repeat(12)} 1.00s`, + `prerender ${' '.repeat(18)}${'█'.repeat(6)} 1.00s`, + ]) + }) + + it('lays out phases one after the other when they carry no start', () => { + const table = formatPhaseTable([ + { phase: 'config', message: '', duration: 1000 }, + { phase: 'build', message: '', duration: 3000 }, + ]) + expect(stripVTControlCharacters(table).split('\n')).toEqual([ + `config ${'█'.repeat(6)}${' '.repeat(18)} 1.00s`, + `build ${' '.repeat(6)}${'█'.repeat(18)} 3.00s`, + ]) + }) +}) diff --git a/packages/nuxt-cli/test/unit/utils/build-report.spec.ts b/packages/nuxt-cli/test/unit/utils/build-report.spec.ts new file mode 100644 index 000000000..226184be6 --- /dev/null +++ b/packages/nuxt-cli/test/unit/utils/build-report.spec.ts @@ -0,0 +1,255 @@ +import type { ServerBuild } from '../../../src/utils/server-build' + +import { Buffer } from 'node:buffer' +import { mkdir, mkdtemp, realpath, rm, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import process from 'node:process' + +import { join } from 'pathe' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' + +import { BuildProgress } from '../../../src/utils/build-progress' +import { createBuildReport } from '../../../src/utils/build-report' +import { stripAnsi } from '../../../src/utils/formatting' + +const mocks = vi.hoisted(() => ({ error: vi.fn(), isCI: false })) +vi.mock('../../../src/utils/logger', () => ({ logger: { error: mocks.error } })) +vi.mock('std-env', async importOriginal => ({ + ...await importOriginal(), + get isCI() { return mocks.isCI }, +})) + +type Handler = (...args: any[]) => unknown + +function createNuxt(rootDir: string) { + const handlers: Record = {} + return { + nuxt: { options: { rootDir }, hook: (name: string, fn: Handler) => void (handlers[name] ||= []).push(fn) }, + call: async (name: string, ...args: unknown[]) => { + for (const fn of handlers[name] || []) { + await fn(...args) + } + }, + } +} + +function serverBuild(dir: string, overrides: Partial = {}): ServerBuild { + return { label: 'Nitro', declared: true, hasDevServer: true, target: 'node-server', dir, publicDir: join(dir, 'public'), previewCommand: undefined, deployCommand: undefined, previewStaticDir: undefined, ...overrides } +} + +let root: string +let cwd: string +beforeEach(async () => { + root = await realpath(await mkdtemp(join(tmpdir(), 'nuxi-build-report-'))) + cwd = process.cwd() + process.chdir(root) +}) +afterEach(async () => { + process.chdir(cwd) + vi.clearAllMocks() + mocks.isCI = false + await rm(root, { recursive: true, force: true }) +}) + +async function setup(rootDir = root) { + const { nuxt, call } = createNuxt(rootDir) + const progress = new BuildProgress() + const report = createBuildReport(nuxt as any, { progress, command: 'build' }) + return { report, progress, call } +} + +async function writeFiles(dir: string, files: Record) { + await mkdir(dir, { recursive: true }) + for (const [path, content] of Object.entries(files)) { + await mkdir(join(dir, path, '..'), { recursive: true }) + await writeFile(join(dir, path), content) + } + return Object.entries(files).map(([path, content]) => ({ path, size: Buffer.byteLength(content) })) +} + +const client = { name: 'client', consumer: 'client', builder: 'vite' } +const ssr = { name: 'ssr', consumer: 'server', builder: 'vite' } +const nitro = { name: 'nitro', consumer: 'server', builder: 'rollup' } + +describe('createBuildReport', () => { + it('shows environments with other names verbatim rather than capitalising them', async () => { + const { report, call } = await setup() + await call('build:environment:start', { name: 'nuxt_vite_server_cloudflare', consumer: 'server', builder: 'vite' }) + await call('build:environment:done', { name: 'nuxt_vite_server_cloudflare', consumer: 'server', builder: 'vite' }, { duration: 384, outDir: root, files: [{ path: 'worker.js', size: 584_560 }] }) + + expect(stripAnsi((await report.summary(false))!)).toBe('nuxt_vite_server_cloudflare (vite) built in 384ms · 584.56 kB') + }) + + it('summarises each bundle in the order they started, with gzip sizes for the client', async () => { + const { report, call } = await setup() + const clientDir = join(root, '.output/public') + const serverDir = join(root, '.output/server') + const clientFiles = await writeFiles(clientDir, { '_nuxt/entry.js': 'a'.repeat(2000), '_nuxt/entry.js.map': 'm'.repeat(5000) }) + const serverFiles = await writeFiles(serverDir, { 'index.mjs': 'b'.repeat(3000) }) + + vi.useFakeTimers({ now: 0, toFake: ['Date'] }) + await call('build:environment:start', client) + vi.setSystemTime(5) + await call('build:environment:start', ssr) + await call('build:environment:done', ssr, { duration: 200, outDir: join(root, '.nuxt/dist/server'), files: [{ path: 'server.mjs', size: 1500 }] }) + await call('build:environment:done', client, { duration: 300, outDir: clientDir, files: clientFiles }) + await call('build:environment:start', nitro) + await call('build:environment:done', nitro, { duration: 100, outDir: serverDir, files: serverFiles }) + vi.useRealTimers() + + const summary = stripAnsi((await report.summary(false))!).split('\n') + expect(summary).toHaveLength(3) + expect(summary[0]).toMatch(/^Client \(vite\) built in 300ms · 2\.00 kB \(\d+ B gzip\)$/) + expect(summary[1]).toBe('Server (vite) built in 200ms · 1.50 kB') + expect(summary[2]).toBe('Nitro (rollup) built in 100ms · 3.00 kB') + }) + + it('lists the files of each bundle when verbose', async () => { + const { report, call } = await setup() + const serverDir = join(root, '.output/server') + await call('build:environment:start', nitro) + await call('build:environment:done', nitro, { duration: 100, outDir: serverDir, files: [{ path: 'index.mjs', size: 3000 }, { path: 'chunks/a.mjs', size: 12000 }] }) + + expect(stripAnsi((await report.summary(true))!).split('\n')).toEqual([ + 'Nitro (rollup) built in 100ms · 15.00 kB', + ' .output/server/chunks/a.mjs 12.00 kB', + ' .output/server/index.mjs 3.00 kB', + ]) + }) + + it('lists the gzip size of each client file when verbose', async () => { + const { report, call } = await setup() + const clientDir = join(root, '.output/public') + const files = await writeFiles(clientDir, { 'a.js': 'a'.repeat(4000), 'b.css': 'b'.repeat(1000) }) + await call('build:environment:start', client) + await call('build:environment:done', client, { duration: 10, outDir: clientDir, files }) + + const lines = stripAnsi((await report.summary(true))!).split('\n') + expect(lines[1]).toMatch(/^ {2}\.output\/public\/a\.js {3}4\.00 kB +\d+ B gzip$/) + expect(lines[2]).toMatch(/^ {2}\.output\/public\/b\.css {2}1\.00 kB +\d+ B gzip$/) + }) + + it('drives the progress line from the bundles and prerendering', async () => { + const { progress, call } = await setup() + const seen: string[] = [] + progress.onUpdate(snapshot => seen.push(`${snapshot.message}${snapshot.meter ? ` ${snapshot.meter.done}/${snapshot.meter.total}` : ''}`)) + + await call('build:environment:start', client) + await call('build:environment:start', ssr) + await call('build:environment:done', ssr, { duration: 1, outDir: root, files: [] }) + await call('build:environment:done', client, { duration: 1, outDir: root, files: [] }) + await call('build:prerender:start', { routes: 1 }) + await call('build:prerender:route', { route: '/', duration: 10, skipped: false, total: 2 }) + await call('build:prerender:route', { route: '/about', duration: 10, skipped: false, total: 2 }) + await call('build:prerender:done', { duration: 10, written: 2, failed: [] }) + + expect(seen).toEqual([ + 'Loading Nuxt config', + 'Bundling client', + 'Bundling client and server', + 'Bundling client', + 'Building', + 'Prerendering routes 0/1', + 'Prerendering routes 1/2', + 'Prerendering routes 2/2', + 'Building', + ]) + }) + + it('lists the first 20 pages in natural order in a terminal and says how to see the rest', async () => { + const { report, call } = await setup() + await call('build:prerender:start', { routes: 27 }) + await call('build:prerender:route', { route: '/page-0/_payload.json?123', duration: 1, skipped: false }) + for (let index = 24; index >= 0; index--) { + await call('build:prerender:route', { route: `/page-${index}`, duration: 5, skipped: false }) + } + await call('build:prerender:route', { route: '/skipped', duration: 1, skipped: true }) + await call('build:prerender:done', { duration: 900, written: 26, failed: [] }) + + const lines = stripAnsi((await report.summary(false))!).split('\n') + expect(lines[0]).toBe('Prerendered 26 routes in 900ms') + expect(lines[1]).toBe('Routes:') + expect(lines.slice(2, 22)).toEqual(Array.from({ length: 20 }, (_, index) => `/page-${index}`)) + expect(lines.at(-1)).toBe('… and 6 more. Run npx nuxt build --logLevel=verbose to see all prerendered routes.') + expect(lines).toHaveLength(23) + }) + + it('lists every route in CI, skipped ones too', async () => { + mocks.isCI = true + const { report, call } = await setup() + await call('build:prerender:start', { routes: 2 }) + await call('build:prerender:route', { route: '/', duration: 12, skipped: false }) + await call('build:prerender:route', { route: '/_payload.json?x', duration: 1, skipped: true }) + await call('build:prerender:done', { duration: 50, written: 1, failed: [] }) + + expect(stripAnsi((await report.summary(false))!).split('\n')).toEqual([ + 'Prerendered 1 route in 50ms', + '/ 12ms', + '/_payload.json?x skipped', + ]) + }) + + it('lists failed prerenders as soon as prerendering is done', async () => { + const { call } = await setup() + await call('build:prerender:start', { routes: 2 }) + await call('build:prerender:done', { duration: 50, written: 0, failed: [{ route: '/missing', status: 404, message: 'Page not found: /missing' }, { route: '/broken', message: 'Boom' }] }) + + expect(stripAnsi(mocks.error.mock.calls[0]![0])).toBe('Failed to prerender 2 routes:\n/missing (404 Page not found: /missing)\n/broken (Boom)') + }) + + it('names the pages that link to a failed route, the first few in a terminal', async () => { + const { call } = await setup() + const linkedFrom = ['/', '/about', '/blog', '/blog/a', '/blog/b'] + await call('build:prerender:start', { routes: 1 }) + await call('build:prerender:done', { duration: 50, written: 0, failed: [{ route: '/missing', status: 404, message: 'Page not found', linkedFrom }] }) + + expect(stripAnsi(mocks.error.mock.calls[0]![0])).toBe('Failed to prerender 1 route:\n/missing (404 Page not found)\n linked from /, /about, /blog and 2 more') + }) + + it('names every page that links to a failed route in CI', async () => { + mocks.isCI = true + const { call } = await setup() + await call('build:prerender:start', { routes: 1 }) + await call('build:prerender:done', { duration: 50, written: 0, failed: [{ route: '/missing', message: 'Boom', linkedFrom: ['/', '/about', '/blog', '/blog/a'] }] }) + + expect(stripAnsi(mocks.error.mock.calls[0]![0])).toBe('Failed to prerender 1 route:\n/missing (Boom)\n linked from /, /about, /blog, /blog/a') + }) + + it('offers a preview only when a server bundle was written into the output', async () => { + const { report, call } = await setup() + const output = join(root, '.output') + await call('build:environment:start', ssr) + await call('build:environment:done', ssr, { duration: 1, outDir: join(root, '.nuxt/dist/server'), files: [] }) + expect(report.commands(serverBuild(output))).toEqual([]) + + await call('build:environment:start', nitro) + await call('build:environment:done', nitro, { duration: 1, outDir: join(output, 'server'), files: [] }) + expect(report.commands(serverBuild(output, { deployCommand: 'npx wrangler --cwd .output deploy' })).map(stripAnsi)).toEqual([ + 'You can preview this build using npx nuxt preview', + 'You can deploy this build using npx wrangler --cwd .output deploy', + ]) + }) + + it('runs the deploy command from the project when it is not the current directory', async () => { + const project = join(root, 'my app') + const { report } = await setup(project) + + expect(report.staticCommands(serverBuild(join(project, '.output'), { target: 'vercel-static', deployCommand: 'npx vercel deploy --prebuilt' })).map(stripAnsi)).toEqual([ + 'You can deploy this build using cd "my app" && npx vercel deploy --prebuilt', + ]) + }) + + it('points a prerendered build at a static host, its deploy command or its target', async () => { + const { report } = await setup() + const output = join(root, '.output') + + expect(report.staticCommands(serverBuild(output, { target: 'static' })).map(stripAnsi)).toEqual(['You can now deploy .output/public to any static hosting']) + expect(report.staticCommands(serverBuild(output, { target: 'vercel-static', deployCommand: 'npx vercel deploy --prebuilt' })).map(stripAnsi)).toEqual(['You can deploy this build using npx vercel deploy --prebuilt']) + expect(report.staticCommands(serverBuild(output, { target: 'netlify-static' })).map(stripAnsi)).toEqual(['You can now deploy .output to netlify-static']) + }) + + it('prints nothing when Nuxt reports no bundles', async () => { + const { report } = await setup() + expect(await report.summary(false)).toBeUndefined() + }) +}) diff --git a/packages/nuxt-cli/test/unit/utils/formatting.spec.ts b/packages/nuxt-cli/test/unit/utils/formatting.spec.ts index 92d4a434f..313974a60 100644 --- a/packages/nuxt-cli/test/unit/utils/formatting.spec.ts +++ b/packages/nuxt-cli/test/unit/utils/formatting.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { formatDuration, stripControlChars, truncate, visibleWidth } from '../../../src/utils/formatting' +import { formatBytes, formatDuration, stripControlChars, truncate, visibleWidth } from '../../../src/utils/formatting' describe('stripControlChars', () => { it('should leave no escape sequence behind, nested or not', () => { @@ -44,6 +44,12 @@ describe('truncate', () => { }) }) +describe('formatBytes', () => { + it('uses decimal units', () => { + expect([formatBytes(999), formatBytes(1000), formatBytes(2_454_000)]).toEqual(['999 B', '1.00 kB', '2.45 MB']) + }) +}) + describe('formatDuration', () => { it('should render milliseconds below a second', () => { expect(formatDuration(-1)).toBe('0.0ms')