15 Commits

Author SHA1 Message Date
Arjun Vegda
496a466c2c
chore(tests): migrate to vitest (#1753)
* test: migrate to vitest

* test: try #1 remove CI-MATRIX tags

* test: try 2 remove import/require replace

* chore: remove unused scripts/assignments

* chore(test-multiple-builds.yml): remove import/require replace script

* fix merging main

---------

Co-authored-by: daishi <daishi@axlight.com>
2023-05-04 13:25:24 +09:00
Daishi Kato
f37530fc3d
chore: add extentsion in imports (#1678)
* chore: add extentsion in imports

* fix github workflow

* revert for zustand/context

* do not patch :)

* fix workflow file

* update ts 5

* patch tsconfig

* use old typescript for react 16

* downlevel-dts to 3.8

* Revert "downlevel-dts to 3.8"

This reverts commit d03e5266e14146ed4a7c92e8a5cd2cb295727f69.

* patch workflow file

* patch for react 16

* remove ts3.4 in workflow

* skipLibChecks

* revert changes in test-multiple-versions.yml

* fix sed

* wip: add allowJs

* Revert "wip: add allowJs"

This reverts commit fca34d7d2decc1e469a733224f7680ab37792dc8.

* use ts 495

* useESM false

* Revert "useESM false"

This reverts commit 07a91d8acb14bc5839013aad47d0606dec312d62.

* no coverage

* no coverage 2

* no coverage 3

* wip

* disable transform

* revert a change

* revert changes

* test: try ignoring tests with dynamic imports

* test: skip tests that require/tests modules in isolation

* test: remove dynamic import

* run skipped tests on CI

* test: add new devtools imports to ci-only tests

* revert CI-ONLY-* hack

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* CI-MATRIX- for devtools CI hacks

* test: add env variable to test multiple builds workflow

* hack await import

* hack await import for another one

* wip: experimenting workflow file

* wip: experimenting workflow file

* wip: experimenting workflow file

* use different env name

* wip: experimenting workflow file

* do not use two envs

* revert to NODE_ENV

---------

Co-authored-by: Arjun <14841132+arjunvegda@users.noreply.github.com>
2023-05-02 06:28:46 +09:00
Daishi Kato
9062ca634f
chore: remove __DEV__ with ts-jest (#1598)
* wip: use ts-jest instead of swc/jest

* use esm in jest

* remove types/jest

* remove __DEV__

* fix rollup config

* fix github workflow

* hack jest.Mock

* wip: ts

* skipLibCheck for older ts 2

* wip: ts

* wip: workflow...

* wip: workflow...

* wip: workflow...

* experiment...

* experiment...2

* experiment...3

* experiment...4

* jest preset
2023-02-10 19:05:12 +09:00
Daishi Kato
0b55a3d74b
feat: deprecate default export (#1514) 2023-01-10 18:13:25 +09:00
Paul Pavlo Buidenkov
633c7dd7af
feat(middleware/devtools): Better redux devtools. One connection for all zustand stores (#1435)
* add example project for zustand devonly devtools with better rewind feature of redux devtools

* fix yarn install for demo

* remove lodash from demo

* adjust utils

* remove assets from demo project

* add codesandbox

* devtools for groups of stores

* remove command from .yml

* add tests

* cleanup

* Existing test cleanup

* Slight test cleanup; extract iife

* Slight cleanup

* Non-recursive S

* Remove initialState

Co-authored-by: Corin (CWStra) <cwstra@gmail.com>
2023-01-01 09:43:54 +09:00
Łukasz Rabiec
ed12c7edab
fix(types)(middleware/devtools): fix action type in devtools's setState (#1183)
* added payload to setState() in devtools middleware

* adjusted tests

* changed payload to any property name

* adjusted docs

* prettier readme.md

* adjusted for extends

* adjusted immer's setState

* Revert "adjusted immer's setState"

This reverts commit 50ce327bf0031a0ec61177b47733f397de036758.

* changed order of immer and devtools in tests

* added test for action with payload type in immer/devtools

* removed unnecessary test

* Update tests/middlewareTypes.test.tsx

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2022-08-19 07:10:50 +09:00
Daishi Kato
0ae0293e88
breaking(middleware/devtools): remove checking old string option (#933)
* breaking(middleware/devtools): remove checking old string option

* fix test

* fix test
2022-04-29 23:15:23 +09:00
M. Bagher Abiat
279bfb1e64
fix(middleware/devtools): add enabled option and show devtools warning only if enabled (#880)
* remove warning

* test

* rfc: enabled option

* debug

* update

* update

* [DEV-ONLY]

* [DEV-ONLY]

* let enable enabled

* let's enable enabled

* lint

* Update src/middleware/devtools.ts

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* add tests for different cases

* refactor test

* fix test

* tweak mock in test

* fix merge main

Co-authored-by: daishi <daishi@axlight.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2022-04-18 10:20:21 +09:00
Devansh Jethmalani
99cddcf76f
breaking(types): Add higher kinded mutator types (#725)
* imaginary code that uses uSES

* revert backward compatibility code as this is not going to be v4

* use use-sync-external-store

* revert to react 17

* handle error by our own

* v4.0.0-alpha.2

* fix&refactor a bit

* update uSES experimental package

* remove error propagation hack

* update size snapshot

* update uSES and add dts

* split react.ts and no export wild

* split useStore impl

* context to follow the new api, export wild again

* v4.0.0-alpha.3

* add missing await

* update uSES

* update uSES

* uses uSES extra!

* v4.0.0-alpha.3

* fix(types): Rename from UseStore to UseBoundStore

* breaking(types): drop deprecated UseStore type

* breaking(core): drop v2 hook compatibility

* breaking(middleware): drop deprecated persist options

* breaking(core): drop deprecated store.subscribe with selector

* update uSES

* fix update uSES

* v4.0.0-alpha.5

* combine subscribe type

* intentional undefined type

* add useDebugValue

* update uSES

* update uSES types

* breaking(middleware): make persist options.removeItem required

* update uSES

* v4.0.0-alpha.6

* fix(readme): remove memoization section which is no longer valid with uSES

* feat(readme): add new createStore/useStore usage

* update useSES

* update uSES and deps

* v4.0.0-alpha.7

* update uSES

* update uSES

* shave bytes

* vanilla: add higher kinded mutator types

* persist: add higher kinded mutator types

* persist: try to minimize diff

* use `PopArgument` in vanilla too

* update uSES

* use overloads instead of `createWithState`

* avoid symbols

* add new types to middlewares

* add new types react

* add new types to context

* fix persist types

* add immer

* migrate middleware type tests

* fix react type, export `UseBoundStore`

* migrate vanilla type tests

* rename `_createStore` to `createStoreImpl`

* Default to no mutations in `StateCreator`

* migrate context.test.tsx

* fix devtools.test.tsx type erros

* context: remove callsignature in useStoreApi

* context: remove `UseContextStore` type

* context: fix useBoundStore type

* context: keep `UseContextStore` for tooltip just don't export it

* react: remove duplicate overload in create

* export `WithPersist`

* devtools: preserve try/catch

* devtools: preserve window check

* add a test case for v3 style create

* devtools: preverse test fix from base branch

* remove StoreApiWithFoo types, don't export WithFoo types

* style

* devtools: preverse `originalIsRecording` change

* fix bug in devtools

* empty commit

* 4.0.0-beta.1

* fix lint

* style

* export immer fix tests

* style, minor fixes

* devtools: fix test

* Update tests/devtools.test.tsx

* breaking(middleware/devtools): use official devtools extension types

* type object.create

* avoid emitting @redux-devtools/extension

* fix type with any

* refactor

* fix yarn lock

* temporary fix #829

* v4.0.0-beta.2

* fix lint

* lock date-fns version

* test middleware subtyping

* fix errors in conflict resolution

* lock testing-library/react alpha version

* more correct (and strict) persist types

* migrate tests

* wip release notes

* fix devtools merge with base

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* add a test case for persist with partialize option

* update readme

* fix lint

* immer: mutate `store.setState`

* fix devtools merge with base

* immer: fix mutations order

* changes in readme

* move and rename v4 migration md

* add `combine` usage in readme

* typos

* create separate md for typescript, add common recipes

* minor fixes

* devtools: minor type fix
(probably I copy pasted from persist and forgot to remove `U`)

* add more migrations

* context: fix import

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* devtools: minor refactor
rearrange code for better diff

* fix lint: run prettier

* wip

* uSES rc.1

* getServerState for #886, no types yet

* uSES v1

* devtools: remove deprecations and warnings

* fix tests

* v4.0.0-beta.2

* wip

* migrate tests

* persist: keep diff minimal

* fix merge in package.json and yarn.lock

* fix merge for persist

* don't use `import type`

* docs(typescript): add slices pattern

* fix selector & equals types
for inference with useCallback, see issue #812

* add test for setState with replace

* remove undefined selector overload

* make immer more generic

* make devtools replace-friendly and more correctly typed

* migrate tests

* make setState bivariant to make the state covariant

* devtools: return the result of `setState`

* devtools: make the fallback branch in `StoreSetStateWithAction` bivariant too
(I forgot to make this bivaraint)

* remove strict replace

* fix lint

Co-authored-by: daishi <daishi@axlight.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2022-04-18 09:14:00 +09:00
Devansh Jethmalani
943af082ae
breaking(middleware/devtools): remove deprecations and warnings (#892)
* imaginary code that uses uSES

* revert backward compatibility code as this is not going to be v4

* use use-sync-external-store

* revert to react 17

* handle error by our own

* v4.0.0-alpha.2

* fix&refactor a bit

* update uSES experimental package

* remove error propagation hack

* update size snapshot

* update uSES and add dts

* split react.ts and no export wild

* split useStore impl

* context to follow the new api, export wild again

* v4.0.0-alpha.3

* add missing await

* update uSES

* update uSES

* uses uSES extra!

* v4.0.0-alpha.3

* fix(types): Rename from UseStore to UseBoundStore

* breaking(types): drop deprecated UseStore type

* breaking(core): drop v2 hook compatibility

* breaking(middleware): drop deprecated persist options

* breaking(core): drop deprecated store.subscribe with selector

* update uSES

* fix update uSES

* v4.0.0-alpha.5

* combine subscribe type

* intentional undefined type

* add useDebugValue

* update uSES

* update uSES types

* breaking(middleware): make persist options.removeItem required

* update uSES

* v4.0.0-alpha.6

* fix(readme): remove memoization section which is no longer valid with uSES

* feat(readme): add new createStore/useStore usage

* update useSES

* update uSES and deps

* v4.0.0-alpha.7

* update uSES

* update uSES

* shave bytes

* update uSES

* breaking(middleware/devtools): use official devtools extension types

* type object.create

* avoid emitting @redux-devtools/extension

* fix type with any

* refactor

* fix yarn lock

* temporary fix #829

* v4.0.0-beta.2

* fix lint

* lock date-fns version

* lock testing-library/react alpha version

* devtools: remove deprecations and warnings

* fix tests

* use `__DEV__`

* revert irrelevant v4 changes

* correct merge

* fix test

* fix `any`

* fix `any` again

Co-authored-by: daishi <daishi@axlight.com>
2022-04-09 02:27:28 +09:00
Daishi Kato
5b938fbbff
feat(build): use __DEV__ to control development mode (#789)
* feat(build): use __DEV__ to control development mode

* fix workflow

* missing env in systemjs build
2022-02-10 08:45:43 +09:00
Daishi Kato
5b3b963181
fix(middleware): revert devtools extension connector with try-catch (#724)
* fix(middleware): revert devtools extension connector with try-catch

* add a test case

Co-authored-by: Devansh Jethmalani <devanshj@users.noreply.github.com>
2021-12-24 16:09:46 +09:00
Devansh Jethmalani
cb99a36c59
devtools: minor fixes (#720) 2021-12-23 10:03:07 +09:00
Daishi Kato
c54d1df87b
fix(middleware): devtools work in non-browser (#693)
* fix(middleware): devtools work in non-browser

* early return

* add a test

Co-authored-by: Devansh Jethmalani <devanshj@users.noreply.github.com>
2021-12-07 16:06:41 +09:00
Devansh Jethmalani
58baf27476
rewrite devtools (#675)
* rewrite `devtools`

* style

* merge state instead of replace, fix lint

* fix lint, don't use `Array.prototype.at`

* fix typo

* more lint fixing

* feat: allow setting state from the devtools

* deference dispatch in the store to use latest `api.dispatch`
that gets replaced in devtools middleware
2021-12-03 22:12:31 +09:00