refactor: introduce shared log helpers in @arkenv/build and standardize warning/error prefixes - #1294
Conversation
…ze warning/error prefixes
🦋 Changeset detectedLatest commit: 29154c2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
arkenv
@arkenv/build
@arkenv/bun-plugin
@arkenv/core
@arkenv/fumadocs-ui
@arkenv/nextjs
@arkenv/nuxt
@arkenv/standard
@arkenv/vite-plugin
commit: |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — introduced a shared log.ts module in @arkenv/build and migrated build-time and framework-integration log prefixes strings across @arkenv/nextjs and @arkenv/nuxt to use the new helpers.
- Extracted
BUILD_PREFIX,WATCHER_PREFIX,formatBuildError,logBuildWarning,logBuildError, andlogWatcherErrorintopackages/build/src/log.ts. - Re-exported helpers from
packages/build/src/index.tsso@arkenv/nextjsand@arkenv/nuxtcan import them. - Standardized previously mixed
[arkenv]/[ArkEnv]prefixes to[ArkEnv]across warnings and errors. - Verified
@arkenv/buildbuilds cleanly; Next.js and Nuxt config/module tests pass.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
… exports and entry point
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the latest commit exposes @arkenv/build/log as a standalone subpath export and switches the Next.js runtime helper to import through that subpath.
- Added a
./logexport to@arkenv/build/package.jsonand registeredsrc/log.tsas a separatetsdownentry so runtime consumers can pull in only the logging helpers. - Updated
packages/nextjs/src/arkenv-internal.tsto importlogBuildWarningfrom@arkenv/build/lograther than@arkenv/build.
ℹ️ Log helpers are duplicated across the two build outputs
tsdown builds src/index.ts and src/log.ts as independent entries, so the helper code is inlined into both dist/index.js and dist/log.js. The duplicated code is only a few constants and formatting functions, so this is harmless, but worth tracking if bundle-size optimization becomes a goal later.
Technical details
# Log helpers are duplicated across the two build outputs
## Affected sites
- `packages/build/tsdown.config.ts:4` — both `src/index.ts` and `src/log.ts` are listed as separate entries.
- `packages/build/dist/index.js` and `packages/build/dist/log.js` after build — helper functions and constants appear in both bundles.
## Required outcome
- Either accept the small duplication when keeping both entries, or share the helpers between entries so they are emitted only once.
## Suggested approach (optional)
- If `tsdown`/`rolldown` supports shared chunks for multi-entry builds, enabling that would let `index.js` import the helpers from the same chunk used by `log.js` instead of inlining them.
- Alternatively, keep `src/log.ts` as the dedicated entry and have `index.ts` re-export from the `./log` subpath.
## Open questions for the human (optional)
- None.Kimi K2 (free via Pullfrog for OSS) | 𝕏
|
Addressed the Pullfrog note about duplicated log helpers across Changes:
Verification:
|
Split build utilities into core.ts so index.ts re-exports from the log subpath, ensuring tsdown emits log helpers only once in dist/log.js. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — since the prior review, the PR was reorganized so the shared log helpers are emitted only once in the @arkenv/build bundle.
- Extracted the non-log build helpers from
packages/build/src/index.tsinto a newpackages/build/src/core.ts. - Simplified
packages/build/src/index.tsto re-export./coreand./log. - Switched
packages/build/tsdown.config.tsfrom an array to named entry objects, letting rolldown code-splitloginto its own chunk and avoid inlined duplication indist/index.js. - Verified that
pnpm --filter @arkenv/build buildproduces separatedist/index.jsanddist/log.js, withindex.jsimporting the helpers from./log.jsrather than inlining them.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
Merge origin/v1 and relocate log helpers from @arkenv/build/log to @repo/utils on top of the core/log split and nuxt flat-layout changes. Co-authored-by: Cursor <cursoragent@cursor.com>

Summary
Introduces a dedicated
log.tsutility module in@arkenv/buildand migrates all manually-prefixed log strings in the build-time and framework integration packages to use it.Changes
@arkenv/buildpackages/build/src/log.ts— definesBUILD_PREFIX,WATCHER_PREFIX,formatBuildError,logBuildWarning,logBuildError,logWatcherError./logfromindex.tsresolveLayoutand allconsole.errorcalls inwatchSchema/closeWatcher@arkenv/nextjsconfig.ts: useslogBuildWarning,logBuildError,formatBuildErrorfor deprecation warning, schema path error, codegen error, and validation failure headerarkenv-internal.ts: useslogBuildWarningfor legacy nested-layout deprecation@arkenv/nuxtmodule.ts: usesformatBuildErrorfor the client-side server-only import errorMotivation
Follows up on #1157 — while that PR fixed casing inconsistencies, the prefix strings were still scattered as manual literals across 5+ call sites. This extracts them into a single, zero-dependency helper module inside
@arkenv/build(already a shared dep) so all integrations stay consistent automatically.Verification