Repository navigation
fix(plugin-utils): report a broken devup.json instead of an empty theme - #916
Merged
Merged
Conversation
`loadDevupConfig` turned a file that is not valid JSON into `{}`, so a typo
silently dropped the whole theme, and it followed `extends` cycles until the
stack overflowed. Both are now errors that name the file and how to fix it,
as is a config that is not a JSON object. An `extends` target that does not
exist yet stays an empty config: the dev servers watch it and load it once it
appears.
Vite, webpack and Rsbuild already log a config error and clear the theme; Bun
swallowed it and now logs it too.
`theme.d.ts` is written even when the theme has no tokens, so tokens removed
from devup.json leave no stale declarations behind (Vite, webpack, Rsbuild and
Next.js; Bun already did). Rsbuild creates the CSS directory before writing
into it, like Vite, so a cold start cannot lose the race with ENOENT.
Refs #686 (PLG-19, PLG-09, PLG-10)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
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: #916 already made writeDataFiles create cssDir before writing devup-ui.css (PLG-10), the same fix as this branch. Kept main's version; the branch no longer changes plugin.ts. - Dropped .changepacks/changepack_log_rsbuild_cold_css_dir.json: the fix it announces shipped in #916, whose changepack covers it, so this branch now only adds hooks.test.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#686의 PLG-19, PLG-09, PLG-10을 고칩니다.
loadDevupConfig/loadDevupConfigSync가 JSON이 아닌devup.json을{}로 읽어 테마 전체가 조용히 사라졌습니다. 서로를extends하는 파일은 stack overflow가 날 때까지 재귀했습니다. 이제 둘 다 파일 경로와 고치는 방법을 담은 오류입니다.null, 배열, 문자열)도 오류입니다.extends대상은 지금처럼 빈 설정입니다. Vite dev 서버가 이 파일을 감시하다가 생기면 읽기 때문입니다(config-input-provenance.test.ts).extends하는 경우(diamond)는 cycle이 아닙니다.theme.d.ts를 인터페이스 코드가 있을 때만 썼습니다. 그래서 토큰을 모두 지우면 예전 선언이 남았습니다. 이제 비어 있어도 항상 덮어씁니다(Bun은 이미 그랬습니다).mkdir(cssDir)와cssDir/devup-ui.css쓰기를 같은Promise.all에서 시작해,df/가 없는 첫 실행에서 ENOENT가 날 수 있었습니다. Vite처럼 디렉터리를 먼저 만든 뒤 씁니다.#755와 겹치는 부분
#755(fix/plugin-core, 병합되지 않음)의
load-config.ts도 파싱 오류와 cycle을 오류로 바꿉니다. 이 PR은 main에서 새로 만들었고, #755 브랜치는 건드리지 않았습니다.새로 생기는 오류
<file> is not valid JSON: <cause>. Fix its syntax; Devup UI does not load the theme until it parses.<file> must hold a JSON object such as { "theme": {} }, not <null | an array | a string ...>.devup.json `extends` form a cycle: a.json -> b.json -> a.json. Remove the `extends` entry that points back to an earlier file.Vite, webpack, Rsbuild, Bun에서는 로그로 남고 테마가 비워집니다. Next.js Turbopack에서는 설정 단계가 실패합니다.
남는 한계
catch에 같이 잡힙니다. 프로덕션 빌드를 실패시킬지는 따로 정해야 합니다.Test plan
load-config.test.ts: 잘못된 JSON(sync/async), 객체가 아닌 설정 3종, cycle(두 파일, 자기 자신), diamond.load-config.ts커버리지 100%theme.d.ts를 쓰고,mkdir가 끝난 뒤에devup-ui.css를 씀console.error로 남김theme.d.ts에 맞게 수정. rsbuild·bun·webpack·nextplugin.test.ts와 viteplugin.test.ts로컬 통과Refs #686
🤖 Generated with Claude Code