Skip to content

feat(devframe): bundle deps into utils/* with stable minimal API#331

Merged
antfu merged 3 commits intomainfrom
antfu/utils-colors
May 11, 2026
Merged

feat(devframe): bundle deps into utils/* with stable minimal API#331
antfu merged 3 commits intomainfrom
antfu/utils-colors

Conversation

@antfu
Copy link
Copy Markdown
Member

@antfu antfu commented May 11, 2026

Description

Audit and consolidate the devframe/utils/* public surface so the underlying libraries can be swapped without user-land breakage:

  • New utils that bundle their dependencies and expose minimal wrappers: utils/open, utils/launch-editor (accepts an optional preferred-editor arg), utils/hash, utils/colors, and utils/structured-clone.
  • Existing utils audited: utils/human-id and utils/when now wrap their re-exports (no more bare passthrough); utils/shared-state stops leaking immer's Patch/Objectish types via a locally-defined SharedStatePatch and a T extends object constraint; the unused utils/state.ts duplicate is deleted.
  • open, launch-editor, ohash, immer, ansis, and structured-clone-es are now bundled inside devframe (inlinedDependencies + tsdown onlyBundle); the corresponding deps are dropped from packages/{core,kit,vite,rolldown} and all internal call sites migrate to the new devframe/utils/* paths.
  • Also folded in: removal of the now-unused utils/serve-static (replaced by sirv directly in the Vite adapter), Nuxt adapter simplification, and a turbo ^build dependency on @vitejs/devtools#build so devframe builds before core (config-load no longer races the dist).

Linked Issues

Additional context

The generated .d.mts for the new and audited utils contain no from "immer" / from "whenexpr" / from "ohash" / from "ansis" / from "structured-clone-es" references — the implementations are devframe-internal. All pnpm build, pnpm typecheck, pnpm test (458 / 49 files), and pnpm lint pass.

Bundle open, launch-editor, ohash, immer, ansis, and structured-clone-es
into devframe and expose them through stable utils/* subpaths with
minimal, swap-friendly wrappers. Audit the existing utils to wrap bare
re-exports (human-id, whenexpr) and stop leaking immer's Patch/Objectish
types from shared-state. Drop the now-unused utils/state.ts duplicate.
Migrate all internal call sites to the new util paths and drop the
now-transitive deps from packages/{core,kit,vite,rolldown}.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 11, 2026

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 0bc6680
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a0160a492c2d300087c711f
😎 Deploy Preview https://deploy-preview-331--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Add a dedicated Utilities page listing every `devframe/utils/*` export
(colors, open, launch-editor, hash, structured-clone, human-id, nanoid,
promise, events, shared-state, streaming-channel, when), wired into the
sidebar and the guide landing page. Drop install-separately language
from the standalone-cli recipe (the `launch-editor` peer-dep note) and
soften the immer references in shared-state.md, since both are now
internal implementation details. Add a Bundled utilities section to the
devframe agent skill so agents know which helpers ship in-box.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 11, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@vitejs/devtools@331
npm i https://pkg.pr.new/@vitejs/devtools-kit@331
npm i https://pkg.pr.new/@vitejs/devtools-rolldown@331
npm i https://pkg.pr.new/@vitejs/devtools-self-inspect@331

commit: 0bc6680

# Conflicts:
#	devframe/packages/devframe/package.json
#	devframe/packages/devframe/src/adapters/dev.ts
#	packages/vite/package.json
#	pnpm-lock.yaml
@antfu antfu changed the title refactor(devframe): bundle deps into utils/* with stable minimal API feat(devframe): bundle deps into utils/* with stable minimal API May 11, 2026
@antfu antfu merged commit 3e991b1 into main May 11, 2026
13 checks passed
@antfu antfu deleted the antfu/utils-colors branch May 11, 2026 05:03
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