@@ -213,6 +213,22 @@ function createOptionsStore<
213
213
return store as any
214
214
}
215
215
216
+ /**
217
+ * Create and register a Pinia store implemented with the setup API (core factory).
218
+ *
219
+ * Builds the reactive store instance, wires its state into the global Pinia state tree,
220
+ * wraps actions for $onAction tracking, attaches $patch/$reset/$subscribe/$dispose helpers,
221
+ * applies plugins and devtools metadata, and registers the store on the provided Pinia
222
+ * instance. Also prepares Hot Module Replacement (HMR) support and optional hydration logic.
223
+ *
224
+ * @param $id - Unique store id used as the key in pinia.state and for registration.
225
+ * @param setup - Store setup function that receives setup helpers and returns state, getters, and actions.
226
+ * @param options - Optional store definition/options; used for plugins, getters (options API compatibility), and hydration.
227
+ * @param pinia - The Pinia root instance where the store will be registered.
228
+ * @param hot - When true, build the store in hot-update mode (uses a temporary hotState and enables HMR-specific wiring).
229
+ * @param isOptionsStore - Set to true for stores created from the Options API so certain setup-store behaviors (like state wiring) are skipped.
230
+ * @returns The reactive Store instance exposing state, getters, actions and Pinia helpers.
231
+ */
216
232
function createSetupStore <
217
233
Id extends string ,
218
234
SS extends Record < any , unknown > ,
@@ -474,12 +490,18 @@ function createSetupStore<
474
490
{
475
491
_hmrPayload,
476
492
_customProperties : markRaw ( new Set < string > ( ) ) , // devtools custom properties
493
+ _options : optionsForPlugin , // store options for plugins
477
494
} ,
478
495
partialStore
479
496
// must be added later
480
497
// setupStore
481
498
)
482
- : partialStore
499
+ : assign (
500
+ {
501
+ _options : optionsForPlugin , // store options for plugins
502
+ } ,
503
+ partialStore
504
+ )
483
505
) as unknown as Store < Id , S , G , A >
484
506
485
507
// store the partial store now so the setup of stores can instantiate each other before they are finished without
0 commit comments