Skip to content

Commit

Permalink
Merge branch 'v2' into feat/nuxt-skip-hydrate-in-payload
Browse files Browse the repository at this point in the history
  • Loading branch information
posva authored Oct 17, 2024
2 parents 4746ff2 + 3d238f7 commit 85223ea
Show file tree
Hide file tree
Showing 32 changed files with 2,468 additions and 1,716 deletions.
8 changes: 6 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributions are welcome and will be fully credited!

We accept contributions via Pull Requests on [Github](https://github.com/{{ githubAccount }}/{{ name }}).
We accept contributions via Pull Requests on [Github](https://github.com/vuejs/pinia).

## Pull Requests

Expand All @@ -19,7 +19,7 @@ Here are some guidelines to make the process smoother:

### Bug reports

Always try to provide as much information as possible. If you are reporting a bug, try to provide a repro on jsfiddle.net (or anything else) or a stacktrace at the very least. This will help us check the problem quicker.
Always try to provide as much information as possible. If you are reporting a bug, try to provide a repro on [this playground](https://play.pinia.vuejs.org) (or anything else) or a stacktrace at the very least. This will help us check the problem quicker.

### Feature requests

Expand Down Expand Up @@ -86,3 +86,7 @@ pnpm run docs:translation:compare <lang> upstream/v2
```

<!-- TODO: add an example once we have got one -->

### Translating Search text

The search box is powered by Algolia and you will need to translate the properties. Inspire yourself from `.vitepress/config/zh.ts` `zhSearch` variable.
7 changes: 2 additions & 5 deletions .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0

- run: corepack enable

- name: Set node
uses: actions/setup-node@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<br/>
<p align="center">
<a href="https://npmjs.com/package/pinia"><img src="https://badgen.net/npm/v/pinia" alt="npm package"></a>
<a href="https://github.com/vuejs/pinia/actions/workflows/test.yml?query=branch%3Av2"><img src="https://github.com/vuejs/pinia/workflows/test/badge.svg?branch=v2" alt="build status"></a>
<a href="https://github.com/vuejs/pinia/actions/workflows/ci.yml"><img src="https://github.com/vuejs/pinia/actions/workflows/ci.yml/badge.svg" alt="build status"></a>
<a href="https://codecov.io/gh/vuejs/pinia"><img src="https://codecov.io/gh/vuejs/pinia/graph/badge.svg?token=rU2xxQ6BGH"/></a>
</p>
<br/>
Expand Down
6 changes: 6 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coverage:
status:
patch: off
project:
default:
threshold: 2%
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,32 @@
"@rollup/plugin-terser": "^0.4.4",
"@types/lodash.kebabcase": "^4.1.9",
"@types/node": "^20.14.12",
"@vitest/coverage-v8": "^2.0.4",
"@vitest/ui": "^2.0.4",
"@vue/compiler-sfc": "~3.4.34",
"@vue/server-renderer": "~3.4.34",
"@vitest/coverage-v8": "^2.1.1",
"@vitest/ui": "^2.1.1",
"@vue/compiler-sfc": "~3.5.10",
"@vue/server-renderer": "~3.5.10",
"chalk": "^5.3.0",
"conventional-changelog-cli": "^2.2.2",
"enquirer": "^2.4.1",
"execa": "^9.3.0",
"globby": "^14.0.1",
"happy-dom": "^14.12.3",
"happy-dom": "^15.7.4",
"lint-staged": "^15.2.7",
"lodash.kebabcase": "^4.1.1",
"minimist": "^1.2.8",
"p-series": "^3.0.0",
"pascalcase": "^2.0.0",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"rollup": "^4.18.0",
"rollup": "^4.22.5",
"rollup-plugin-typescript2": "^0.36.0",
"semver": "^7.6.3",
"simple-git-hooks": "^2.11.1",
"typedoc": "^0.26.5",
"typedoc-plugin-markdown": "^4.2.3",
"typescript": "~5.5.4",
"vitest": "^2.0.4",
"vue": "~3.4.34"
"typedoc": "^0.26.7",
"typedoc-plugin-markdown": "^4.2.8",
"typescript": "~5.6.2",
"vitest": "^2.1.1",
"vue": "~3.5.10"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged",
Expand Down
6 changes: 3 additions & 3 deletions packages/docs/api/@pinia/nuxt/functions/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ editLink: false

# Function: default()

> **default**(`this`, `inlineOptions`, `nuxt`): `_ModuleSetupReturn`
> **default**(`this`, `resolvedOptions`, `nuxt`): `ModuleSetupReturn`
## Parameters

**this**: `void`

**inlineOptions**: [`ModuleOptions`](../interfaces/ModuleOptions.md)
**resolvedOptions**: [`ModuleOptions`](../interfaces/ModuleOptions.md)

**nuxt**: `Nuxt`

## Returns

`_ModuleSetupReturn`
`ModuleSetupReturn`
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ App used by Pinia

### state

> **state**: `Ref`\<`Record`\<`string`, [`StateTree`](../../../pinia/type-aliases/StateTree.md)\>\>
> **state**: `Ref`\<`Record`\<`string`, [`StateTree`](../../../pinia/type-aliases/StateTree.md)\>, `Record`\<`string`, [`StateTree`](../../../pinia/type-aliases/StateTree.md)\>\>
root state

Expand Down
28 changes: 14 additions & 14 deletions packages/docs/api/pinia/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ editLink: false

### Interfaces

- [\_StoreOnActionListenerContext](interfaces/StoreOnActionListenerContext.md)
- [\_StoreWithState](interfaces/StoreWithState.md)
- [\_SubscriptionCallbackMutationBase](interfaces/SubscriptionCallbackMutationBase.md)
- [DefineSetupStoreOptions](interfaces/DefineSetupStoreOptions.md)
- [DefineStoreOptions](interfaces/DefineStoreOptions.md)
- [DefineStoreOptionsBase](interfaces/DefineStoreOptionsBase.md)
Expand All @@ -34,23 +37,9 @@ editLink: false
- [SubscriptionCallbackMutationDirect](interfaces/SubscriptionCallbackMutationDirect.md)
- [SubscriptionCallbackMutationPatchFunction](interfaces/SubscriptionCallbackMutationPatchFunction.md)
- [SubscriptionCallbackMutationPatchObject](interfaces/SubscriptionCallbackMutationPatchObject.md)
- [\_StoreOnActionListenerContext](interfaces/StoreOnActionListenerContext.md)
- [\_StoreWithState](interfaces/StoreWithState.md)
- [\_SubscriptionCallbackMutationBase](interfaces/SubscriptionCallbackMutationBase.md)

### Type Aliases

- [PiniaStorePlugin](type-aliases/PiniaStorePlugin.md)
- [StateTree](type-aliases/StateTree.md)
- [Store](type-aliases/Store.md)
- [StoreActions](type-aliases/StoreActions.md)
- [StoreGeneric](type-aliases/StoreGeneric.md)
- [StoreGetters](type-aliases/StoreGetters.md)
- [StoreOnActionListener](type-aliases/StoreOnActionListener.md)
- [StoreOnActionListenerContext](type-aliases/StoreOnActionListenerContext.md)
- [StoreState](type-aliases/StoreState.md)
- [SubscriptionCallback](type-aliases/SubscriptionCallback.md)
- [SubscriptionCallbackMutation](type-aliases/SubscriptionCallbackMutation.md)
- [\_ActionsTree](type-aliases/ActionsTree.md)
- [\_Awaited](type-aliases/Awaited.md)
- [\_DeepPartial](type-aliases/DeepPartial.md)
Expand All @@ -73,6 +62,17 @@ editLink: false
- [\_StoreWithActions](type-aliases/StoreWithActions.md)
- [\_StoreWithGetters](type-aliases/StoreWithGetters.md)
- [\_UnwrapAll](type-aliases/UnwrapAll.md)
- [PiniaStorePlugin](type-aliases/PiniaStorePlugin.md)
- [StateTree](type-aliases/StateTree.md)
- [Store](type-aliases/Store.md)
- [StoreActions](type-aliases/StoreActions.md)
- [StoreGeneric](type-aliases/StoreGeneric.md)
- [StoreGetters](type-aliases/StoreGetters.md)
- [StoreOnActionListener](type-aliases/StoreOnActionListener.md)
- [StoreOnActionListenerContext](type-aliases/StoreOnActionListenerContext.md)
- [StoreState](type-aliases/StoreState.md)
- [SubscriptionCallback](type-aliases/SubscriptionCallback.md)
- [SubscriptionCallbackMutation](type-aliases/SubscriptionCallbackMutation.md)

### Variables

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/api/pinia/interfaces/Pinia.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Every application must own its own pinia to be able to create stores

### state

> **state**: `Ref`\<`Record`\<`string`, [`StateTree`](../type-aliases/StateTree.md)\>\>
> **state**: `Ref`\<`Record`\<`string`, [`StateTree`](../type-aliases/StateTree.md)\>, `Record`\<`string`, [`StateTree`](../type-aliases/StateTree.md)\>\>
root state

Expand Down
16 changes: 8 additions & 8 deletions packages/docs/api/pinia/interfaces/StoreProperties.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ Properties of a store.

## Properties

### $id

> **$id**: `Id`
Unique identifier of the store

***

### \_customProperties

> **\_customProperties**: `Set`\<`string`\>
Used by devtools plugin to retrieve properties added with plugins. Removed
in production. Can be used by the user to add property keys of the store
that should be displayed in devtools.

***

### $id

> **$id**: `Id`
Unique identifier of the store
28 changes: 14 additions & 14 deletions packages/docs/api/pinia/interfaces/StoreWithState.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ Base store with state and functions. Should not be used directly.

## Properties

### \_customProperties

> **\_customProperties**: `Set`\<`string`\>
Used by devtools plugin to retrieve properties added with plugins. Removed
in production. Can be used by the user to add property keys of the store
that should be displayed in devtools.

#### Inherited from

[`StoreProperties`](StoreProperties.md).[`_customProperties`](StoreProperties.md#_customProperties)

***

### $id

> **$id**: `Id`
Expand All @@ -46,20 +60,6 @@ Unique identifier of the store
State of the Store. Setting it will internally call `$patch()` to update the state.

***

### \_customProperties

> **\_customProperties**: `Set`\<`string`\>
Used by devtools plugin to retrieve properties added with plugins. Removed
in production. Can be used by the user to add property keys of the store
that should be displayed in devtools.

#### Inherited from

[`StoreProperties`](StoreProperties.md).[`_customProperties`](StoreProperties.md#_customProperties)

## Methods

### $dispose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ editLink: false

# Type Alias: \_ExtractStateFromSetupStore\<SS\>

> **\_ExtractStateFromSetupStore**\<`SS`\>: `SS` *extends* `undefined` \| `void` ? `object` : [`_ExtractStateFromSetupStore_Keys`](ExtractStateFromSetupStore_Keys.md)\<`SS`\> *extends* keyof `SS` ? [`_UnwrapAll`](UnwrapAll.md)\<`Pick`\<`SS`, [`_ExtractStateFromSetupStore_Keys`](ExtractStateFromSetupStore_Keys.md)\<`SS`\>\>\> : `never`
> **\_ExtractStateFromSetupStore**\<`SS`\>: `SS` *extends* `undefined` \| `void` ? `object` : `Pick`\<`SS`, [`_ExtractStateFromSetupStore_Keys`](ExtractStateFromSetupStore_Keys.md)\<`SS`\>\>
For internal use **only**

Expand Down
9 changes: 4 additions & 5 deletions packages/docs/cookbook/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ Actions are automatically spied but type-wise, they are still the regular action

```ts
import type { Mock } from 'vitest'
import type { UnwrapRef } from 'vue'
import type { Store, StoreDefinition } from 'pinia'

function mockedStore<TStoreDef extends () => unknown>(
Expand All @@ -187,15 +188,13 @@ function mockedStore<TStoreDef extends () => unknown>(
State,
Record<string, never>,
{
[K in keyof Actions]: Actions[K] extends (
...args: infer Args
) => infer ReturnT
[K in keyof Actions]: Actions[K] extends (...args: any[]) => any
? // 👇 depends on your testing framework
Mock<Args, ReturnT>
Mock<Actions[K]>
: Actions[K]
}
> & {
[K in keyof Getters]: Getters[K] extends ComputedRef<infer T> ? T : never
[K in keyof Getters]: UnwrapRef<Getters[K]>
}
: ReturnType<TStoreDef> {
return useStore() as any
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@chenfengyuan/vue-countdown": "^2.1.2",
"@vueuse/core": "^10.11.0",
"pinia": "workspace:*",
"vitepress": "1.3.1",
"vitepress": "1.3.4",
"vitepress-translation-helper": "^0.2.1",
"vue-use-spring": "^0.3.3"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/ssr/nuxt.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default {

By default `@pinia/nuxt` exposes a few auto imports:

- `usePinia()`, which is similar to `getActivePinia()` but works better with Nuxt. You can add auto imports to make your life easier:
- `usePinia()`, which is similar to `getActivePinia()` but works better with Nuxt.
- `defineStore()` to define stores
- `storeToRefs()` when you need to extract individual refs from a store
- `acceptHMRUpdate()` for [hot module replacement](../cookbook/hot-module-replacement.md)
Expand Down
4 changes: 4 additions & 0 deletions packages/nuxt/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.5.5](https://github.com/vuejs/pinia/compare/@pinia/[email protected]...@pinia/[email protected]) (2024-09-30)

No changes in this release

## [0.5.4](https://github.com/vuejs/pinia/compare/@pinia/[email protected]...@pinia/[email protected]) (2024-08-21)

### Bug Fixes
Expand Down
12 changes: 6 additions & 6 deletions packages/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinia/nuxt",
"version": "0.5.4",
"version": "0.5.5",
"description": "Nuxt Module for pinia",
"keywords": [
"pinia",
Expand Down Expand Up @@ -50,12 +50,12 @@
"pinia": "workspace:^"
},
"devDependencies": {
"@nuxt/module-builder": "^0.8.1",
"@nuxt/module-builder": "^0.8.4",
"@nuxt/schema": "^3.9.0",
"@nuxt/test-utils": "^3.13.1",
"nuxt": "^3.12.4",
"typescript": "^5.5.4",
"vue-tsc": "^2.0.29"
"@nuxt/test-utils": "^3.14.2",
"nuxt": "^3.13.2",
"typescript": "^5.6.2",
"vue-tsc": "^2.1.6"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 3 additions & 3 deletions packages/online-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"serve": "vite preview"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.1.0",
"@vitejs/plugin-vue": "^5.1.4",
"execa": "^9.3.0",
"vite": "^5.3.5"
"vite": "^5.4.8"
},
"dependencies": {
"@vue/repl": "^3.0.0",
"file-saver": "^2.0.5",
"jszip": "^3.10.1",
"pinia": "workspace:*",
"vue": "^3.4.34"
"vue": "^3.5.10"
}
}
14 changes: 14 additions & 0 deletions packages/pinia/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [2.2.4](https://github.com/vuejs/pinia/compare/[email protected]@2.2.4) (2024-10-01)

### Bug Fixes

- **types:** allow writable getters with storeToRefs ([b464a1f](https://github.com/vuejs/pinia/commit/b464a1f4ff499aff34087cc9cd77ad19cf8646a7)), closes [#2767](https://github.com/vuejs/pinia/issues/2767)

## [2.2.3](https://github.com/vuejs/pinia/compare/[email protected]@2.2.3) (2024-09-30)

### Bug Fixes

- **types:** allow writable getters ([94f5a63](https://github.com/vuejs/pinia/commit/94f5a63fdc86f17f1dd17ed16534fbdecb8c448f)), closes [#2767](https://github.com/vuejs/pinia/issues/2767)
- **types:** Don't double UnwrapRef in setup stores ([#2771](https://github.com/vuejs/pinia/issues/2771)) ([5ad1765](https://github.com/vuejs/pinia/commit/5ad17654de4153b6f26b45b20029ca9ac4885f8d)), closes [#2770](https://github.com/vuejs/pinia/issues/2770)
- **types:** storeToRefs with nested refs ([#2659](https://github.com/vuejs/pinia/issues/2659)) ([623e5a0](https://github.com/vuejs/pinia/commit/623e5a0fe3444a4aa9c4908668927ee66f6352ba))

## [2.2.2](https://github.com/vuejs/pinia/compare/[email protected]@2.2.2) (2024-08-15)

### Features
Expand Down
Loading

0 comments on commit 85223ea

Please sign in to comment.