Skip to content

refactor: introduce shared log helpers in @arkenv/build and standardize warning/error prefixes - #1294

Merged
yamcodes merged 5 commits into
v1from
refactor/standardize-log-prefix
Jul 11, 2026
Merged

yamcodes merged 5 commits into
v1from
refactor/standardize-log-prefix

Conversation

@yamcodes

Copy link
Copy Markdown
Owner

Summary

Introduces a dedicated log.ts utility module in @arkenv/build and migrates all manually-prefixed log strings in the build-time and framework integration packages to use it.

Changes

@arkenv/build

  • New: packages/build/src/log.ts — defines BUILD_PREFIX, WATCHER_PREFIX, formatBuildError, logBuildWarning, logBuildError, logWatcherError
  • Re-exports ./log from index.ts
  • Replaces raw string literal in resolveLayout and all console.error calls in watchSchema/closeWatcher

@arkenv/nextjs

  • config.ts: uses logBuildWarning, logBuildError, formatBuildError for deprecation warning, schema path error, codegen error, and validation failure header
  • arkenv-internal.ts: uses logBuildWarning for legacy nested-layout deprecation

@arkenv/nuxt

  • module.ts: uses formatBuildError for the client-side server-only import error

Motivation

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

  • 73 test files, 743 tests — all passing ✅

@changeset-bot

changeset-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 29154c2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@arkenv/build Patch
@arkenv/nextjs Patch
@arkenv/nuxt Patch

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

@github-actions github-actions Bot added docs Adds or changes documentation, or acts as documentation in and of itself @arkenv/nextjs Issues or Pull Requests involving the Next.js integration for ArkEnv @arkenv/nuxt Issues or Pull Requests involving the Nuxt integration for ArkEnv labels Jul 11, 2026
@arkenv-bot

arkenv-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (Asia/Almaty)
arkenv Ready Ready Preview, Comment Jul 11 2026, 6:06 PM (Asia/Almaty)

@pkg-pr-new

pkg-pr-new Bot commented Jul 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

arkenv

npm i https://pkg.pr.new/arkenv@1294

@arkenv/build

npm i https://pkg.pr.new/@arkenv/build@1294

@arkenv/bun-plugin

npm i https://pkg.pr.new/@arkenv/bun-plugin@1294

@arkenv/core

npm i https://pkg.pr.new/@arkenv/core@1294

@arkenv/fumadocs-ui

npm i https://pkg.pr.new/@arkenv/fumadocs-ui@1294

@arkenv/nextjs

npm i https://pkg.pr.new/@arkenv/nextjs@1294

@arkenv/nuxt

npm i https://pkg.pr.new/@arkenv/nuxt@1294

@arkenv/standard

npm i https://pkg.pr.new/@arkenv/standard@1294

@arkenv/vite-plugin

npm i https://pkg.pr.new/@arkenv/vite-plugin@1294

commit: 29154c2

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ 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, and logWatcherError into packages/build/src/log.ts.
  • Re-exported helpers from packages/build/src/index.ts so @arkenv/nextjs and @arkenv/nuxt can import them.
  • Standardized previously mixed [arkenv]/[ArkEnv] prefixes to [ArkEnv] across warnings and errors.
  • Verified @arkenv/build builds cleanly; Next.js and Nuxt config/module tests pass.

Pullfrog  | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ 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 ./log export to @arkenv/build/package.json and registered src/log.ts as a separate tsdown entry so runtime consumers can pull in only the logging helpers.
  • Updated packages/nextjs/src/arkenv-internal.ts to import logBuildWarning from @arkenv/build/log rather 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.

Pullfrog  | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@yamcodes

Copy link
Copy Markdown
Owner Author

Addressed the Pullfrog note about duplicated log helpers across dist/index.js and dist/log.js.

Changes:

  • Extracted the build utilities into packages/build/src/core.ts so index.ts is now a thin barrel that re-exports from ./core and ./log.
  • Updated tsdown.config.ts to use named entry points for index and log.

Verification:

  • @arkenv/build typecheck passes.
  • Rebuilt output shows dist/index.js imports helpers from ./log.js (no inlined [ArkEnv] constants in index.js).
  • Log helpers are emitted only once in dist/log.js.

yamcodes and others added 2 commits July 11, 2026 15:01
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>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ 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.ts into a new packages/build/src/core.ts.
  • Simplified packages/build/src/index.ts to re-export ./core and ./log.
  • Switched packages/build/tsdown.config.ts from an array to named entry objects, letting rolldown code-split log into its own chunk and avoid inlined duplication in dist/index.js.
  • Verified that pnpm --filter @arkenv/build build produces separate dist/index.js and dist/log.js, with index.js importing the helpers from ./log.js rather than inlining them.

Pullfrog  | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@yamcodes
yamcodes merged commit 434cf61 into v1 Jul 11, 2026
20 checks passed
@yamcodes
yamcodes deleted the refactor/standardize-log-prefix branch July 11, 2026 13:21
@arkenv-bot arkenv-bot Bot mentioned this pull request Jul 11, 2026
yamcodes added a commit that referenced this pull request Jul 11, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/nextjs Issues or Pull Requests involving the Next.js integration for ArkEnv @arkenv/nuxt Issues or Pull Requests involving the Nuxt integration for ArkEnv docs Adds or changes documentation, or acts as documentation in and of itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant