Skip to content

feat(cli): use youch for loading errors #818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 31, 2025
Merged

feat(cli): use youch for loading errors #818

merged 10 commits into from
Mar 31, 2025

Conversation

huang-julien
Copy link
Member

@huang-julien huang-julien commented Mar 30, 2025

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR adds youch to show loading errors. This will allow to show loading errors before nitro get initialized and have more details when something's wrong

@huang-julien huang-julien requested a review from danielroe as a code owner March 30, 2025 18:12
@huang-julien huang-julien requested a review from pi0 March 30, 2025 18:12
Copy link
Contributor

github-actions bot commented Mar 30, 2025

Bundle Stats β€” nuxt-cli size comparison

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
30 82.72 kB β†’ 83.86 kB (+1.14 kB) +1.38%
Changeset
File Ξ” Size
home/runner/work/cli/cli/packages/nuxi/src/utils/error.ts πŸ†• +306 B 0 B β†’ 306 B
home/runner/work/cli/cli/packages/nuxi/src/commands/dev-child.ts πŸ“ˆ +254 B (+12.12%) 2.05 kB β†’ 2.29 kB
home/runner/work/cli/cli/packages/nuxi/src/commands/dev.ts πŸ“ˆ +434 B (+5.56%) 7.62 kB β†’ 8.05 kB
home/runner/work/cli/cli/packages/nuxi/src/utils/dev.ts πŸ“ˆ +174 B (+2.11%) 8.07 kB β†’ 8.24 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
chunks/dev2.mjs 8.07 kB β†’ 8.54 kB (+480 B) +5.81%
chunks/dev.mjs 7.62 kB β†’ 8.05 kB (+434 B) +5.56%
chunks/dev-child.mjs 2.05 kB β†’ 2.29 kB (+254 B) +12.12%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
index.mjs 224 B 0%
chunks/add.mjs 6.83 kB 0%
chunks/analyze.mjs 3.18 kB 0%
chunks/build.mjs 1.97 kB 0%
chunks/cleanup.mjs 471 B 0%
chunks/devtools.mjs 763 B 0%
chunks/generate.mjs 388 B 0%
chunks/info.mjs 4.39 kB 0%
chunks/init.mjs 7.54 kB 0%
chunks/index.mjs 274 B 0%
chunks/prepare.mjs 984 B 0%
chunks/preview.mjs 3.22 kB 0%
chunks/test.mjs 1.16 kB 0%
chunks/typecheck.mjs 1.74 kB 0%
chunks/upgrade.mjs 6.25 kB 0%
chunks/add2.mjs 10.48 kB 0%
chunks/search.mjs 2.94 kB 0%
shared/cli.D1TCjfF5.mjs 5.5 kB 0%
shared/cli.Ce1AsDQc.mjs 804 B 0%
shared/cli.Ds4VmcPx.mjs 294 B 0%
shared/cli.B5Iit5gT.mjs 1.23 kB 0%
shared/cli.BSm0_9Hr.mjs 107 B 0%
shared/cli.CYsm2poU.mjs 836 B 0%
shared/cli.DlcAx0De.mjs 1.04 kB 0%
shared/cli.DTpqls3z.mjs 1.72 kB 0%
shared/cli.C-TyoylH.mjs 78 B 0%
shared/cli.C935N1ss.mjs 687 B 0%

Copy link
Contributor

github-actions bot commented Mar 30, 2025

Bundle Stats β€” nuxi size comparison

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
55 5.31 MB β†’ 5.49 MB (+182.46 kB) +3.35%
Changeset
File Ξ” Size
node_modules/@poppinss/dumper/build/formatters/html/main.js πŸ†• +23.92 kB 0 B β†’ 23.92 kB
node_modules/@speed-highlight/core/dist/index.js πŸ†• +22.6 kB 0 B β†’ 22.6 kB
node_modules/@speed-highlight/core/dist/terminal.js πŸ†• +22.12 kB 0 B β†’ 22.12 kB
node_modules/@poppinss/dumper/build/chunk-MLPO7RBW.js πŸ†• +17.48 kB 0 B β†’ 17.48 kB
node_modules/@sindresorhus/is/distribution/index.js πŸ†• +16.84 kB 0 B β†’ 16.84 kB
node_modules/@poppinss/dumper/build/formatters/console/main.js πŸ†• +14.65 kB 0 B β†’ 14.65 kB
node_modules/youch/build/index.js πŸ†• +9.31 kB 0 B β†’ 9.31 kB
node_modules/youch-core/build/index.js πŸ†• +9.09 kB 0 B β†’ 9.09 kB
node_modules/cookie/dist/index.js πŸ†• +8.44 kB 0 B β†’ 8.44 kB
node_modules/youch/build/chunk-7VCTFUUT.js πŸ†• +6.8 kB 0 B β†’ 6.8 kB
node_modules/error-stack-parser-es/dist/lite.mjs πŸ†• +5.67 kB 0 B β†’ 5.67 kB
node_modules/supports-color/index.js πŸ†• +3.77 kB 0 B β†’ 3.77 kB
node_modules/@poppinss/colors/build/index.js πŸ†• +3.33 kB 0 B β†’ 3.33 kB
node_modules/kleur/index.mjs πŸ†• +2.7 kB 0 B β†’ 2.7 kB
node_modules/youch/build/chunk-DIGV5AT6.js πŸ†• +2.24 kB 0 B β†’ 2.24 kB
node_modules/youch/build/chunk-HGMNPD2T.js πŸ†• +2.18 kB 0 B β†’ 2.18 kB
node_modules/youch/build/chunk-P6WOEE7R.js πŸ†• +2.16 kB 0 B β†’ 2.16 kB
node_modules/youch/build/chunk-MZMCD52M.js πŸ†• +1.58 kB 0 B β†’ 1.58 kB
node_modules/youch/build/chunk-KMDKVT27.js πŸ†• +1.48 kB 0 B β†’ 1.48 kB
node_modules/youch/build/chunk-Z2DUAXSS.js πŸ†• +1.3 kB 0 B β†’ 1.3 kB
node_modules/youch/build/chunk-4L7RY2JA.js πŸ†• +1.2 kB 0 B β†’ 1.2 kB
node_modules/@poppinss/exception/build/index.js πŸ†• +1017 B 0 B β†’ 1017 B
node_modules/youch/build/chunk-I6EQ7DVM.js πŸ†• +849 B 0 B β†’ 849 B
node_modules/error-stack-parser-es/dist/index.mjs πŸ†• +461 B 0 B β†’ 461 B
src/utils/error.ts πŸ†• +306 B 0 B β†’ 306 B
node_modules/cookie/dist/index.js?commonjs-es-import πŸ†• +98 B 0 B β†’ 98 B
node_modules/youch/build/chunk-OSUFJZHZ.js πŸ†• +78 B 0 B β†’ 78 B
node_modules/cookie/dist/index.js?commonjs-exports πŸ†• +14 B 0 B β†’ 14 B
src/commands/dev-child.ts πŸ“ˆ +254 B (+12.15%) 2.04 kB β†’ 2.29 kB
src/commands/dev.ts πŸ“ˆ +434 B (+5.52%) 7.67 kB β†’ 8.1 kB
src/utils/dev.ts πŸ“ˆ +176 B (+2.13%) 8.08 kB β†’ 8.25 kB
node_modules/chokidar/esm/handler.js πŸ“ˆ +6 B (+0.02%) 23.83 kB β†’ 23.83 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
chunks/dev2.mjs 69.9 kB β†’ 251.69 kB (+181.79 kB) +260.07%
chunks/dev.mjs 7.67 kB β†’ 8.1 kB (+434 B) +5.52%
chunks/dev-child.mjs 2.04 kB β†’ 2.29 kB (+254 B) +12.15%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
index.mjs 210 B 0%
chunks/prompt.mjs 42.91 kB 0%
chunks/add.mjs 6.83 kB 0%
chunks/analyze.mjs 3.18 kB 0%
chunks/build.mjs 1.97 kB 0%
chunks/cleanup.mjs 471 B 0%
chunks/devtools.mjs 764 B 0%
chunks/generate.mjs 388 B 0%
chunks/info.mjs 4.39 kB 0%
chunks/init.mjs 663.66 kB 0%
chunks/index.mjs 274 B 0%
chunks/prepare.mjs 984 B 0%
chunks/preview.mjs 3.22 kB 0%
chunks/test.mjs 1.16 kB 0%
chunks/typecheck.mjs 1.74 kB 0%
chunks/upgrade.mjs 6.25 kB 0%
chunks/satisfies.mjs 116 B 0%
chunks/main.mjs 15.3 kB 0%
chunks/index2.mjs 915.2 kB 0%
chunks/index3.mjs 17.14 kB 0%
chunks/index4.mjs 71.98 kB 0%
chunks/multipart-parser.mjs 5.11 kB 0%
chunks/add2.mjs 12.4 kB 0%
chunks/search.mjs 45.83 kB 0%
chunks/xdg-open.mjs 25.32 kB 0%
chunks/node.mjs 140.67 kB 0%
chunks/index5.mjs 1.23 kB 0%
chunks/index6.mjs 5.85 kB 0%
chunks/multipart-parser2.mjs 4.58 kB 0%
chunks/index7.mjs 886.24 kB 0%
shared/nuxi.CeCBE07L.mjs 76.33 kB 0%
shared/nuxi.DqkIr2yV.mjs 18.95 kB 0%
shared/nuxi.DJZ_Y4zT.mjs 804 B 0%
shared/nuxi.Dxiug2DX.mjs 294 B 0%
shared/nuxi.BSV7E6ma.mjs 2.57 kB 0%
shared/nuxi.D2_bzAv0.mjs 1.54 kB 0%
shared/nuxi.DNluersV.mjs 4.07 kB 0%
shared/nuxi.BSm0_9Hr.mjs 107 B 0%
shared/nuxi.C3077BWe.mjs 836 B 0%
shared/nuxi.BxIDvNqq.mjs 1.34 kB 0%
shared/nuxi.TVP5AJsM.mjs 14.64 kB 0%
shared/nuxi.DigSKSZu.mjs 25.34 kB 0%
shared/nuxi.C4l48OVX.mjs 2.02 MB 0%
shared/nuxi.D5KtpA0t.mjs 984 B 0%
shared/nuxi.BjhZEm2-.mjs 1.75 kB 0%
shared/nuxi.DwEL8L-T.mjs 715 B 0%
shared/nuxi.Kph9bHCN.mjs 26.94 kB 0%
shared/nuxi.BPxiWRC2.mjs 123.73 kB 0%
shared/nuxi.D4vggcPe.mjs 5.7 kB 0%
shared/nuxi.wIrae1ai.mjs 54.97 kB 0%
shared/nuxi.Do0aYBCO.mjs 5.46 kB 0%
shared/nuxi.jjur9XJH.mjs 43.55 kB 0%

Copy link
Contributor

github-actions bot commented Mar 30, 2025

Bundle Stats β€” create-nuxt size comparison

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
49 5.74 MB β†’ 5.92 MB (+182.46 kB) +3.11%
Changeset
File Ξ” Size
node_modules/@poppinss/dumper/build/formatters/html/main.js πŸ†• +23.92 kB 0 B β†’ 23.92 kB
node_modules/@speed-highlight/core/dist/index.js πŸ†• +22.6 kB 0 B β†’ 22.6 kB
node_modules/@speed-highlight/core/dist/terminal.js πŸ†• +22.12 kB 0 B β†’ 22.12 kB
node_modules/@poppinss/dumper/build/chunk-MLPO7RBW.js πŸ†• +17.48 kB 0 B β†’ 17.48 kB
node_modules/@sindresorhus/is/distribution/index.js πŸ†• +16.84 kB 0 B β†’ 16.84 kB
node_modules/@poppinss/dumper/build/formatters/console/main.js πŸ†• +14.65 kB 0 B β†’ 14.65 kB
node_modules/youch/build/index.js πŸ†• +9.31 kB 0 B β†’ 9.31 kB
node_modules/youch-core/build/index.js πŸ†• +9.09 kB 0 B β†’ 9.09 kB
node_modules/cookie/dist/index.js πŸ†• +8.44 kB 0 B β†’ 8.44 kB
node_modules/youch/build/chunk-7VCTFUUT.js πŸ†• +6.8 kB 0 B β†’ 6.8 kB
node_modules/error-stack-parser-es/dist/lite.mjs πŸ†• +5.67 kB 0 B β†’ 5.67 kB
node_modules/supports-color/index.js πŸ†• +3.77 kB 0 B β†’ 3.77 kB
node_modules/@poppinss/colors/build/index.js πŸ†• +3.33 kB 0 B β†’ 3.33 kB
node_modules/kleur/index.mjs πŸ†• +2.7 kB 0 B β†’ 2.7 kB
node_modules/youch/build/chunk-DIGV5AT6.js πŸ†• +2.24 kB 0 B β†’ 2.24 kB
node_modules/youch/build/chunk-HGMNPD2T.js πŸ†• +2.18 kB 0 B β†’ 2.18 kB
node_modules/youch/build/chunk-P6WOEE7R.js πŸ†• +2.16 kB 0 B β†’ 2.16 kB
node_modules/youch/build/chunk-MZMCD52M.js πŸ†• +1.58 kB 0 B β†’ 1.58 kB
node_modules/youch/build/chunk-KMDKVT27.js πŸ†• +1.48 kB 0 B β†’ 1.48 kB
node_modules/youch/build/chunk-Z2DUAXSS.js πŸ†• +1.3 kB 0 B β†’ 1.3 kB
node_modules/youch/build/chunk-4L7RY2JA.js πŸ†• +1.2 kB 0 B β†’ 1.2 kB
node_modules/@poppinss/exception/build/index.js πŸ†• +1017 B 0 B β†’ 1017 B
node_modules/youch/build/chunk-I6EQ7DVM.js πŸ†• +849 B 0 B β†’ 849 B
node_modules/error-stack-parser-es/dist/index.mjs πŸ†• +461 B 0 B β†’ 461 B
home/runner/work/cli/cli/packages/nuxi/src/utils/error.ts πŸ†• +306 B 0 B β†’ 306 B
node_modules/cookie/dist/index.js?commonjs-es-import πŸ†• +98 B 0 B β†’ 98 B
node_modules/youch/build/chunk-OSUFJZHZ.js πŸ†• +78 B 0 B β†’ 78 B
node_modules/cookie/dist/index.js?commonjs-exports πŸ†• +14 B 0 B β†’ 14 B
home/runner/work/cli/cli/packages/nuxi/src/commands/dev-child.ts πŸ“ˆ +254 B (+12.15%) 2.04 kB β†’ 2.29 kB
home/runner/work/cli/cli/packages/nuxi/src/commands/dev.ts πŸ“ˆ +434 B (+5.52%) 7.67 kB β†’ 8.1 kB
home/runner/work/cli/cli/packages/nuxi/src/utils/dev.ts πŸ“ˆ +176 B (+2.13%) 8.07 kB β†’ 8.25 kB
node_modules/chokidar/esm/handler.js πŸ“ˆ +6 B (+0.02%) 23.83 kB β†’ 23.83 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
chunks/dev2.mjs 69.9 kB β†’ 251.69 kB (+181.79 kB) +260.08%
chunks/dev.mjs 7.67 kB β†’ 8.1 kB (+434 B) +5.52%
chunks/dev-child.mjs 2.04 kB β†’ 2.29 kB (+254 B) +12.15%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
index.mjs 1.07 kB 0%
chunks/multipart-parser.mjs 5.11 kB 0%
chunks/multipart-parser2.mjs 4.58 kB 0%
chunks/add.mjs 6.83 kB 0%
chunks/analyze.mjs 3.18 kB 0%
chunks/build.mjs 1.97 kB 0%
chunks/cleanup.mjs 471 B 0%
chunks/devtools.mjs 764 B 0%
chunks/generate.mjs 388 B 0%
chunks/info.mjs 4.39 kB 0%
chunks/index.mjs 274 B 0%
chunks/prepare.mjs 984 B 0%
chunks/preview.mjs 3.22 kB 0%
chunks/test.mjs 1.16 kB 0%
chunks/typecheck.mjs 1.74 kB 0%
chunks/upgrade.mjs 6.25 kB 0%
chunks/prompt.mjs 42.91 kB 0%
chunks/satisfies.mjs 116 B 0%
chunks/kit.mjs 1.34 kB 0%
chunks/index2.mjs 1.17 MB 0%
chunks/index3.mjs 17.14 kB 0%
chunks/index4.mjs 71.98 kB 0%
chunks/add2.mjs 12.4 kB 0%
chunks/search.mjs 45.83 kB 0%
chunks/xdg-open.mjs 25.32 kB 0%
chunks/node.mjs 140.67 kB 0%
chunks/index5.mjs 1.23 kB 0%
chunks/index6.mjs 6.25 kB 0%
chunks/index7.mjs 50.51 kB 0%
chunks/index8.mjs 5.85 kB 0%
chunks/index9.mjs 886.24 kB 0%
shared/create-nuxt.B524lLOf.mjs 961.2 kB 0%
shared/create-nuxt.BDdIGyPj.mjs 18.95 kB 0%
shared/create-nuxt.BEGs8Mv1.mjs 804 B 0%
shared/create-nuxt.DediMVGi.mjs 294 B 0%
shared/create-nuxt.DT9a8Sdy.mjs 3.9 kB 0%
shared/create-nuxt.bOjkkzky.mjs 4.07 kB 0%
shared/create-nuxt.BSm0_9Hr.mjs 107 B 0%
shared/create-nuxt.Dh3Sp2v_.mjs 836 B 0%
shared/create-nuxt.XHs2QGZ7.mjs 108.13 kB 0%
shared/create-nuxt.jjur9XJH.mjs 43.55 kB 0%
shared/create-nuxt.DHoMbN2G.mjs 2.02 MB 0%
shared/create-nuxt.BjhZEm2-.mjs 1.75 kB 0%
shared/create-nuxt.DnK9Crop.mjs 26.94 kB 0%
shared/create-nuxt.u3AcroRg.mjs 14.64 kB 0%
shared/create-nuxt.CLoNtDP4.mjs 715 B 0%

Copy link

pkg-pr-new bot commented Mar 30, 2025

Open in Stackblitz

npm i https://pkg.pr.new/create-nuxt@818
npm i https://pkg.pr.new/nuxi@818
npm i https://pkg.pr.new/@nuxt/cli@818

commit: b895741

@huang-julien
Copy link
Member Author

example if a module throws
then:
image

this PR:
image

@huang-julien
Copy link
Member Author

@danielroe seems like youch is needed for tests (why ?) but knip isn't happy about it πŸ€”

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love it! ❀️

@danielroe danielroe merged commit 7971d14 into main Mar 31, 2025
11 checks passed
@danielroe danielroe deleted the feat/loading_errors branch March 31, 2025 10:57
@github-actions github-actions bot mentioned this pull request Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants