Skip to content

refactor(middleware): replace export * with explicit named and type exports#3151

Merged
dai-shi merged 3 commits intopmndrs:mainfrom
sukvvon:refactor/shallow-export-simplification
Jun 23, 2025
Merged

refactor(middleware): replace export * with explicit named and type exports#3151
dai-shi merged 3 commits intopmndrs:mainfrom
sukvvon:refactor/shallow-export-simplification

Conversation

@sukvvon
Copy link
Copy Markdown
Contributor

@sukvvon sukvvon commented Jun 11, 2025

Related Bug Reports or Discussions

Fixes #

Summary

Check List

  • pnpm run fix for formatting and linting code and docs

@vercel
Copy link
Copy Markdown

vercel bot commented Jun 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zustand-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2025 3:18am

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci bot commented Jun 11, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Jun 11, 2025

demostarter

npm i https://pkg.pr.new/zustand@3151

commit: b9d5194

@sukvvon sukvvon force-pushed the refactor/shallow-export-simplification branch from 084bb12 to d8e2046 Compare June 11, 2025 16:52
@sukvvon sukvvon changed the title refactor(shallow): simplify exports using export * syntax for shallow modules refactor(shallow): simplify exports using export * syntax Jun 11, 2025
@dai-shi
Copy link
Copy Markdown
Member

dai-shi commented Jun 12, 2025

This is somewhat intentional. I think we should have more explicit control on what to export from the package. I would like to change middleware.ts to follow shallow.ts style. I thought it would be a breaking change, but maybe not. Can you try it please?

@sukvvon sukvvon force-pushed the refactor/shallow-export-simplification branch from a6e8d92 to 398e477 Compare June 13, 2025 11:18
@sukvvon sukvvon changed the title refactor(shallow): simplify exports using export * syntax refactor(middleware): replace export * with explicit named and type exports Jun 13, 2025
Comment on lines +1 to +16
export { redux } from './middleware/redux.ts'
export {
devtools,
type DevtoolsOptions,
type NamedSet,
} from './middleware/devtools.ts'
export { subscribeWithSelector } from './middleware/subscribeWithSelector.ts'
export { combine } from './middleware/combine.ts'
export {
persist,
createJSONStorage,
type StateStorage,
type StorageValue,
type PersistStorage,
type PersistOptions,
} from './middleware/persist.ts'
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is somewhat intentional. I think we should have more explicit control on what to export from the package. I would like to change middleware.ts to follow shallow.ts style. I thought it would be a breaking change, but maybe not. Can you try it please?

@dai-shi

I reflected your opinion. How does it look like?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for the delay. Yeah, this looks good. This keeps everything as is, right?

Copy link
Copy Markdown
Contributor Author

@sukvvon sukvvon Jun 19, 2025

Choose a reason for hiding this comment

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

@dai-shi

image

Only the changes mentioned above have been made.

// shallow.d.ts
export { shallow } from 'zustand/vanilla/shallow';
export { useShallow } from 'zustand/react/shallow';

// esm/shallow.d.mts
export { shallow } from 'zustand/vanilla/shallow';
export { useShallow } from 'zustand/react/shallow';

It is the same as shallow.

Copy link
Copy Markdown
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

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

I'll merge this when preparing a new release.

Comment on lines +1 to +16
export { redux } from './middleware/redux.ts'
export {
devtools,
type DevtoolsOptions,
type NamedSet,
} from './middleware/devtools.ts'
export { subscribeWithSelector } from './middleware/subscribeWithSelector.ts'
export { combine } from './middleware/combine.ts'
export {
persist,
createJSONStorage,
type StateStorage,
type StorageValue,
type PersistStorage,
type PersistOptions,
} from './middleware/persist.ts'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for the delay. Yeah, this looks good. This keeps everything as is, right?

@dai-shi dai-shi added this to the v5.0.6 milestone Jun 19, 2025
@dai-shi dai-shi merged commit 5bc717b into pmndrs:main Jun 23, 2025
31 checks passed
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.

2 participants