Repository navigation
fix(bun-plugin): compile the .js files of included packages - #925
Merged
Merged
Conversation
The source onLoad filter accepted .js only under @devup-ui/, and the plugin had no include option, so a library that ships Devup UI components as uncompiled .js reached the runtime stubs. DevupUI and register take include, and the filter also accepts .js of each listed package. A package is the directory right under the innermost node_modules, so pnpm and Bun stores match, and names are escaped and matched whole, the same rules as createNodeModulesExcludeRegex in #914: pkg is not pkg-extra or @scope/pkg, foo.bar is not fooXbar, and the dependencies in an included package's own node_modules stay out. Refs #686 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 6 files with indirect coverage changes 🚀 New features to boost your workflow:
|
3 tasks done
Conflicts: - bun-plugin/README.md: main (#949) added a "Compiled Files" section saying `.js` is compiled only inside `@devup-ui` packages. Kept it, extended that sentence with the packages listed in `include`, and kept this branch's "Libraries" section after it, noting that under the runtime an included package's `.js` is read as an ES module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 of 2 tasks
Resolve the conflict with #924 in the Bun plugin: keep this branch's `createSourceFilter` for `include` and take main's `writeDataFiles`, which rejects a theme error on the first load and reports it only on a reload. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
Resolve the onLoad filter against #925: createSourceFilter now loads .js and .cjs outside node_modules and of @devup-ui and the include packages, so an included CommonJS library goes through loadSourceFile and commonJsSource under the runtime and keeps its exports. Add a runtime test for an included CommonJS package and merge the README texts, dropping the ES-modules-only caveat for include packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
Build the Bun source filter with #925's createSourceFilter, whose base now takes .mts and .cts as this branch does, so included packages keep their .js files. Merge the README sections, and move #944's Turbopack Tailwind test to this branch's wider rule glob. 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
Fixes the Bun plugin not compiling the
.jsof libraries listed ininclude(follow-up to the #686 audit).Problem
onLoadfilter (/\.(?:tsx?|jsx|mjs)$|[\\/]@devup-ui[\\/].*\.js$/) accepted.jsonly under@devup-ui/.includeoption at all..jshit the runtime stub directly (Cannot run on the runtime).Changes
include?: readonly string[]option toDevupUI({ include })andregister({ include })..jsfrom the listed packages. The matching rules are the same as fix(plugin-utils): match include package names exactly #914'screateNodeModulesExcludeRegex.node_modules. So the pnpm store (node_modules/.pnpm/pkg@1/node_modules/pkg/...) and the Bun store (node_modules/.bun/...) match, and so do Windows paths.pkgdoes not matchpkg-extraor@scope/pkg,foo.bardoes not matchfooXbar, andfoo+barmatches itself.node_modulesare not included..jsunder@devup-ui/) is unchanged. With an emptyinclude, the filter is the same as before.Because #914 is not merged yet, the shared function is not reused. The Bun filter is an include pattern rather than a
node_modulesexclusion, so the same rules are implemented separately inside this plugin.New errors
None.
Test plan
bun test packages/bun-plugin: 77 pass,plugin.ts100%node_modules/my-lib/dist/index.jsis compiled through the realonLoadcallback@scope/ui,foo.bar,foo+barmy-lib-extra,@scope/my-lib, nestednode_modules, outsidenode_modules,.json,fooXbar,@scope/ui-kitinclude, package.jsis excluded while@devup-ui.jsand TSX are still acceptedbunx prettier --single-quote --no-semi --check,tsc --noEmitpass요약
Bun 플러그인이
include에 넣은 라이브러리의.js를 컴파일하지 않던 문제를 고칩니다 (#686 감사 후속).문제
onLoadfilter(/\.(?:tsx?|jsx|mjs)$|[\\/]@devup-ui[\\/].*\.js$/)는.js를@devup-ui/아래에서만 받았습니다.include옵션 자체가 없었습니다..js로 배포한 라이브러리는 런타임 stub에 그대로 닿았습니다 (Cannot run on the runtime).변경
DevupUI({ include })와register({ include })에include?: readonly string[]옵션을 추가했습니다..js도 받습니다. 매칭 규칙은 #914의createNodeModulesExcludeRegex와 같습니다.node_modules바로 아래 디렉터리로 봅니다. 그래서 pnpm store(node_modules/.pnpm/pkg@1/node_modules/pkg/...)와 Bun store(node_modules/.bun/...)도 맞고, Windows 경로도 맞습니다.pkg는pkg-extra나@scope/pkg와 맞지 않고,foo.bar는fooXbar와 맞지 않으며,foo+bar는 자기 자신과 맞습니다.node_modules안에 있는 의존성은 포함되지 않습니다.@devup-ui/아래.js)은 그대로입니다.include가 비어 있으면 filter도 예전과 같습니다.#914가 아직 머지되지 않아 공유 함수를 가져다 쓰지 않았습니다. Bun filter는
node_modules제외가 아니라 포함 패턴이라 같은 규칙을 이 플러그인 안에서 따로 구현했습니다.새 오류
없음.
테스트 계획
bun test packages/bun-plugin: 77 pass,plugin.ts100%onLoad콜백으로node_modules/my-lib/dist/index.js가 컴파일되는지@scope/ui,foo.bar,foo+barmy-lib-extra,@scope/my-lib, 중첩node_modules,node_modules밖,.json,fooXbar,@scope/ui-kitinclude가 없으면 패키지.js는 제외되고@devup-ui.js와 TSX는 그대로 받는지bunx prettier --single-quote --no-semi --check,tsc --noEmit통과Refs #686
🤖 Generated with Claude Code