Skip to content

fix(plugins): warn when an optional setup step fails - #945

Merged
owjs3901 merged 1 commit into
mainfrom
fix/best-effort-warnings
Nov 15, 2026
Merged

owjs3901 merged 1 commit into
mainfrom
fix/best-effort-warnings

Conversation

@owjs3901

Copy link
Copy Markdown
Contributor

Summary

PLG-27 재검증 결과입니다. main에서 일부는 이미 고쳐져 있습니다.

  • 이미 고쳐진 것: Next webpack 프로덕션 빌드(productionPrewarmFiles가 있는 경우)는 webpack 플러그인의 graph·번호·warm-up 실패를 다시 던집니다.
  • 남아 있던 것 (빈 catch 또는 주석뿐):
    위치 실패하면
    Vite configResolved의 파일 번호 스캔 파일 번호가 transform 도착 순서를 따름
    webpack 파일 번호 스캔 (debug) 위와 같음
    webpack import graph (collapse + atomHoist) 단일 importer collapse가 꺼지고, atom 모드면 hoisting도 꺼짐
    webpack stylesheet warm-up (Next 프로덕션 외) 먼저 만들어진 stylesheet에 스타일이 빠질 수 있음
    Rsbuild atom prepass atom hoisting이 꺼짐
    Bun 런타임 파일 번호 스캔 (debug) 파일 번호가 로드 순서를 따름

변경

  • @devup-ui/plugin-utils에 setupWarning(step, error, impact)를 추가했습니다. fix(next-plugin): honor debug, restore session state whole and warn on setup fallbacks #918(Next Turbopack)과 같은 형식입니다: [devup-ui] <step> failed: <cause>. <impact>
  • 위 6곳 모두 catch에서 이 경고를 한 번 출력합니다. 빌드는 전처럼 계속됩니다.
  • src 디렉터리가 없는 프로젝트는 스캔할 것이 없어 잃는 것도 없으므로 경고하지 않습니다(isMissingDirectory: ENOENT이고 그 경로가 src 자신일 때만). 테스트를 돌려 보니 이 경우가 가장 흔해서, 빼지 않으면 src가 없는 프로젝트마다 매번 경고가 나왔습니다.
  • Rsbuild의 prewarm catch("The transform reports the error of the file it cannot extract")는 실제로 transform이 같은 오류를 보고하므로 그대로 두었습니다.

의도적으로 하지 않은 것

  • 수정 방향의 "requested atomHoist면 빌드 실패"는 택하지 않았습니다. 지금 atomHoist는 기본으로 켜져 있어(2), 지금까지 성공하던 빌드가 실패하게 됩니다. #918도 같은 이유로 경고를 택했습니다.
  • Next Turbopack 쪽 catch는 #918이 다룹니다.

새로 생기는 오류

없음. 새 경고:

  • [devup-ui] Vite file numbering failed: <cause>. Stylesheet file numbers follow the order Vite transforms files in, so they can differ between builds of the same source.
  • [devup-ui] webpack file numbering failed: <cause>. ...webpack compiles files in...
  • [devup-ui] webpack import graph failed: <cause>. Classes are not merged across files only one module imports[, and atom hoisting is off].
  • [devup-ui] webpack stylesheet warm-up failed: <cause>. A stylesheet webpack builds before every file it holds is extracted can miss their styles.
  • [devup-ui] Rsbuild import graph failed: <cause>. Atom hoisting is off, so atoms several routes share are not moved into the shared stylesheet.
  • [devup-ui] Bun file numbering failed: <cause>. ...Bun loads files in, so they can differ between runs of the same source.

겹치는 PR

Test plan

  • bun test packages/webpack-plugin (3565 pass), packages/rsbuild-plugin, packages/plugin-utils/src/__tests__/shared.test.ts
  • bun --config=./bunfig.vite.toml test packages/vite-plugin/src/__tests__/plugin.test.ts (620 pass)
  • bun test packages/bun-plugin: 실패 4개는 변경 전 main에서도 로컬에서 똑같이 실패(실제 빌드 root 비교, 로컬 빌드 문제)
  • 변경한 plugin.ts/shared.ts 줄 커버리지 100% (각 경고 문구, src 없음 분기, atom 모드 아닌 분기)
  • bunx tsc --noEmit (plugin-utils, webpack, rsbuild, bun, vite), prettier

Refs #686

🤖 Generated with Claude Code

File numbering, the import graph behind collapse and atom hoisting, and
the webpack stylesheet warm-up swallowed every error, so a resolver,
parser or I/O defect gave a successful build with arrival-order numbers
or no hoisting. Print one warning with the step, the cause and what the
build loses. A missing src directory is not a failure and stays quiet.
Builds that failed before still fail; nothing new fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
packages/bun-plugin/src/plugin.ts 100.00% <100.00%> (ø)
packages/plugin-utils/src/index.ts 100.00% <ø> (ø)
packages/plugin-utils/src/shared.ts 100.00% <100.00%> (ø)
packages/rsbuild-plugin/src/plugin.ts 100.00% <100.00%> (ø)
packages/vite-plugin/src/plugin.ts 100.00% <100.00%> (ø)
packages/webpack-plugin/src/plugin.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@owjs3901
owjs3901 merged commit d9420ac into main Nov 15, 2026
27 checks passed
@owjs3901
owjs3901 deleted the fix/best-effort-warnings branch November 15, 2026 22:44
owjs3901 added a commit that referenced this pull request Nov 15, 2026
Conflicts:
- bun-plugin/src/plugin.ts: main (#916) kept the empty-theme fallback
  with a console.error; kept this branch's writeDataFiles, which rethrows
  on the first load and only clears the theme on a Tailwind CSS reload.
- bun-plugin/src/__tests__/plugin.test.ts: replaced main's "registers an
  empty theme" expectation with this branch's rejection tests.
- rsbuild-plugin/src/plugin.ts: kept registering the theme after reading
  the Tailwind CSS files and returning { tailwindFiles, themeError }.
- webpack-plugin/src/plugin.ts: kept clearing themeError after a
  successful load; main's #945 warnings and #951 file removal merged
  cleanly around it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901 added a commit that referenced this pull request Nov 15, 2026
Conflicts:
- rsbuild-plugin/src/plugin.ts: imports keep both resolveDevupFile /
  resolveProjectPath (this branch) and setupWarning (#945).
- webpack-plugin/src/__tests__/plugin.test.ts: kept both the "project
  root" describe and main's deleted-source tests (#951).

Main's new paths now follow the project root, not the cwd:
- webpack: removeFiles (#951) names deleted files relative to this.root,
  and the import graph warning (#945) checks this.root/src for a missing
  directory. Added a test for removeFiles with a context other than cwd.
- Rsbuild: the import graph warning checks projectRoot/src.
- Bun: the file numbering warning checks <root>/src.
Vite's removeSource and Rsbuild's removeFiles use absolute ids already.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901 added a commit that referenced this pull request Nov 15, 2026
Conflicts:
- webpack, Rsbuild and Vite plugin.ts imports: kept main's setupWarning
  (#945) next to this branch's SOURCE_FILE_REGEX.
- Rsbuild transform: kept this branch's `environment` parameter, with
  main's hoisted excludeRegex (#914) in place of the per-call
  createNodeModulesExcludeRegex(include).
- Vite transform: kept this branch's SOURCE_FILE_REGEX check, with
  main's hoisted excludeRegex.
- Bun loadSourceFile: kept main's runtime sheet write, which writes only
  the sheet a module changed (#942), and this branch's
  withDependencyImports return.

Dropped from this branch in favor of main: the per-call exclude regex in
the Rsbuild and Vite transforms (#914) and the unconditional runtime
sheet write in Bun (#942).

Also updated the "Compiled Files" section that #949 added to the Bun
README: `.mts`/`.cts` are compiled, and `Bun.build` compiles the
project's own `.js`/`.cjs` outside node_modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901 added a commit that referenced this pull request Nov 16, 2026
Brings in main through #974 and #978. In the vite, rsbuild, webpack and
bun plugins, the setupWarning (#945) imports and main's
createNodeModulesExcludeRegex sit beside normalizeStylexOptions, and
styleResolution is still set next to registerShorthands wherever main
configures the engine.

The ABI now has 31 names: main's removeFile plus
setStylexStyleResolution. Updated the count in script.js, the consumer,
the native README and typings, and compiler-types (30 without Output).
Validation covers 47 positions in 20 functions (276 cases), and the
summary reports 20 functions. The e2e host lists both names and
counts 27 corpus scenarios.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant