From: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Mon, 15 Sep 2025 05:44:15 +0000 (+0000) Subject: 📝 Add docstrings to `fix-issue-1247-expose-store-options-in-custom-properties` X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3044%2Fhead;p=thirdparty%2Fvuejs%2Fpinia.git 📝 Add docstrings to `fix-issue-1247-expose-store-options-in-custom-properties` Docstrings generation was requested by @doubledare704. * https://github.com/vuejs/pinia/pull/3042#issuecomment-3290571425 The following files were modified: * `packages/pinia/src/store.ts` --- diff --git a/packages/pinia/src/store.ts b/packages/pinia/src/store.ts index 7ec0e17a..816c6336 100644 --- a/packages/pinia/src/store.ts +++ b/packages/pinia/src/store.ts @@ -213,6 +213,22 @@ function createOptionsStore< return store as any } +/** + * Create and register a Pinia store implemented with the setup API (core factory). + * + * Builds the reactive store instance, wires its state into the global Pinia state tree, + * wraps actions for $onAction tracking, attaches $patch/$reset/$subscribe/$dispose helpers, + * applies plugins and devtools metadata, and registers the store on the provided Pinia + * instance. Also prepares Hot Module Replacement (HMR) support and optional hydration logic. + * + * @param $id - Unique store id used as the key in pinia.state and for registration. + * @param setup - Store setup function that receives setup helpers and returns state, getters, and actions. + * @param options - Optional store definition/options; used for plugins, getters (options API compatibility), and hydration. + * @param pinia - The Pinia root instance where the store will be registered. + * @param hot - When true, build the store in hot-update mode (uses a temporary hotState and enables HMR-specific wiring). + * @param isOptionsStore - Set to true for stores created from the Options API so certain setup-store behaviors (like state wiring) are skipped. + * @returns The reactive Store instance exposing state, getters, actions and Pinia helpers. + */ function createSetupStore< Id extends string, SS extends Record, @@ -474,12 +490,18 @@ function createSetupStore< { _hmrPayload, _customProperties: markRaw(new Set()), // devtools custom properties + _options: optionsForPlugin, // store options for plugins }, partialStore // must be added later // setupStore ) - : partialStore + : assign( + { + _options: optionsForPlugin, // store options for plugins + }, + partialStore + ) ) as unknown as Store // store the partial store now so the setup of stores can instantiate each other before they are finished without