@spoosh/core 0.16.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +44 -43
- package/dist/index.d.ts +44 -43
- package/dist/index.js +16 -3
- package/dist/index.mjs +16 -3
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -51,10 +51,10 @@ type SpooshResponse<TData, TError, TRequestOptions = unknown, TQuery = never, TB
|
|
|
51
51
|
* trigger({ body: urlencoded({ key: "value" }) });
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
declare
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
declare const __spooshBodyBrand: unique symbol;
|
|
55
|
+
type SpooshBody<T = unknown> = {
|
|
56
|
+
readonly [__spooshBodyBrand]: T;
|
|
57
|
+
};
|
|
58
58
|
declare function isSpooshBody(value: unknown): value is SpooshBody;
|
|
59
59
|
declare function form<T>(value: T): SpooshBody<T>;
|
|
60
60
|
declare function json<T>(value: T): SpooshBody<T>;
|
|
@@ -252,6 +252,7 @@ type StateManager = {
|
|
|
252
252
|
declare function createStateManager(): StateManager;
|
|
253
253
|
|
|
254
254
|
declare function createInitialState<TData, TError>(): OperationState<TData, TError>;
|
|
255
|
+
declare function generateSelfTagFromKey(key: string): string | undefined;
|
|
255
256
|
|
|
256
257
|
/**
|
|
257
258
|
* Devtool-related types for tracing and debugging.
|
|
@@ -679,7 +680,7 @@ type PluginLifecycle = {
|
|
|
679
680
|
*
|
|
680
681
|
* // Plugin with instance-level API
|
|
681
682
|
* SpooshPlugin<{
|
|
682
|
-
*
|
|
683
|
+
* api: { prefetch: (selector: Selector) => Promise<void> };
|
|
683
684
|
* }>
|
|
684
685
|
* ```
|
|
685
686
|
*/
|
|
@@ -696,7 +697,7 @@ type PluginTypeConfig = {
|
|
|
696
697
|
writeResult?: object;
|
|
697
698
|
queueResult?: object;
|
|
698
699
|
subscribeResult?: object;
|
|
699
|
-
|
|
700
|
+
api?: object;
|
|
700
701
|
};
|
|
701
702
|
/**
|
|
702
703
|
* Base interface for Spoosh plugins.
|
|
@@ -705,7 +706,7 @@ type PluginTypeConfig = {
|
|
|
705
706
|
* - `middleware`: Wraps the fetch flow for full control (intercept, transform, modify)
|
|
706
707
|
* - `afterResponse`: Called after every response, regardless of early returns
|
|
707
708
|
* - `lifecycle`: Component lifecycle hooks (onMount, onUpdate, onUnmount)
|
|
708
|
-
* - `
|
|
709
|
+
* - `internal`: Functions/variables accessible to other plugins
|
|
709
710
|
*
|
|
710
711
|
* @typeParam T - Plugin type configuration object. Specify only the types your plugin needs.
|
|
711
712
|
*
|
|
@@ -748,11 +749,11 @@ interface SpooshPlugin<T extends PluginTypeConfig = PluginTypeConfig> {
|
|
|
748
749
|
/** Component lifecycle hooks (setup, cleanup, option changes) */
|
|
749
750
|
lifecycle?: PluginLifecycle;
|
|
750
751
|
/** Expose functions/variables for other plugins to access via `context.plugins.get(name)` */
|
|
751
|
-
|
|
752
|
+
internal?: (context: PluginContext) => object;
|
|
752
753
|
/**
|
|
753
754
|
* One-time initialization when the Spoosh instance is created.
|
|
754
755
|
* Use for setting up timers, event listeners, or other side effects.
|
|
755
|
-
* Runs before
|
|
756
|
+
* Runs before api is called.
|
|
756
757
|
*
|
|
757
758
|
* @example
|
|
758
759
|
* ```ts
|
|
@@ -777,19 +778,19 @@ interface SpooshPlugin<T extends PluginTypeConfig = PluginTypeConfig> {
|
|
|
777
778
|
setup?: (context: SetupContext) => void;
|
|
778
779
|
/**
|
|
779
780
|
* Expose functions/properties on the framework adapter return value (e.g., create).
|
|
780
|
-
* Unlike `
|
|
781
|
+
* Unlike `internal`, these are accessible directly from the adapter, not just within plugin context.
|
|
781
782
|
* Should be pure - use `setup` for side effects like timers or event listeners.
|
|
782
783
|
*
|
|
783
784
|
* @example
|
|
784
785
|
* ```ts
|
|
785
|
-
*
|
|
786
|
+
* api: ({ spopiosh, stateManager }) => ({
|
|
786
787
|
* prefetch: async (selector) => { ... },
|
|
787
788
|
* invalidateAll: () => { ... },
|
|
788
789
|
* })
|
|
789
790
|
* ```
|
|
790
791
|
*/
|
|
791
|
-
|
|
792
|
-
|
|
792
|
+
api?: (context: ApiContext) => T extends {
|
|
793
|
+
api: infer A;
|
|
793
794
|
} ? A : object;
|
|
794
795
|
/**
|
|
795
796
|
* Wrap a subscription adapter to add plugin behavior (e.g., caching, retry, logging).
|
|
@@ -939,7 +940,7 @@ interface PluginResolvers<TContext extends ResolverContext> {
|
|
|
939
940
|
interface PluginResultResolvers<TOptions> {
|
|
940
941
|
}
|
|
941
942
|
/**
|
|
942
|
-
* Registry for plugin
|
|
943
|
+
* Registry for plugin internal APIs. Extend via declaration merging for type-safe access.
|
|
943
944
|
*
|
|
944
945
|
* Plugins can expose functions and variables that other plugins can access
|
|
945
946
|
* via `context.plugins.get("plugin-name")`.
|
|
@@ -948,38 +949,38 @@ interface PluginResultResolvers<TOptions> {
|
|
|
948
949
|
* ```ts
|
|
949
950
|
* // In your plugin's types file:
|
|
950
951
|
* declare module '@spoosh/core' {
|
|
951
|
-
* interface
|
|
952
|
+
* interface PluginInternalRegistry {
|
|
952
953
|
* "my-plugin": { myMethod: () => void }
|
|
953
954
|
* }
|
|
954
955
|
* }
|
|
955
956
|
* ```
|
|
956
957
|
*/
|
|
957
|
-
interface
|
|
958
|
+
interface PluginInternalRegistry {
|
|
958
959
|
}
|
|
959
960
|
/**
|
|
960
|
-
* Registry for
|
|
961
|
+
* Registry for public API type resolution. Extend via declaration merging.
|
|
961
962
|
*
|
|
962
|
-
* Plugins that expose schema-aware
|
|
963
|
+
* Plugins that expose schema-aware public APIs should extend this interface
|
|
963
964
|
* to get proper type inference when the API is used.
|
|
964
965
|
*
|
|
965
966
|
* @example
|
|
966
967
|
* ```ts
|
|
967
968
|
* // In your plugin's types file:
|
|
968
969
|
* declare module '@spoosh/core' {
|
|
969
|
-
* interface
|
|
970
|
+
* interface ApiResolvers<TSchema> {
|
|
970
971
|
* myFunction: MyFn<TSchema>;
|
|
971
972
|
* }
|
|
972
973
|
* }
|
|
973
974
|
* ```
|
|
974
975
|
*/
|
|
975
|
-
interface
|
|
976
|
+
interface ApiResolvers<TSchema> {
|
|
976
977
|
}
|
|
977
978
|
/**
|
|
978
|
-
* Accessor for plugin
|
|
979
|
+
* Accessor for plugin internal APIs with type-safe lookup.
|
|
979
980
|
*/
|
|
980
981
|
type PluginAccessor = {
|
|
981
|
-
/** Get a plugin's
|
|
982
|
-
get<K extends keyof
|
|
982
|
+
/** Get a plugin's internal API by name. Returns undefined if plugin not found. */
|
|
983
|
+
get<K extends keyof PluginInternalRegistry>(name: K): PluginInternalRegistry[K] | undefined;
|
|
983
984
|
get(name: string): unknown;
|
|
984
985
|
};
|
|
985
986
|
type RefetchEventReason = "focus" | "reconnect" | "polling" | "invalidate";
|
|
@@ -992,10 +993,10 @@ type RefetchEvent = {
|
|
|
992
993
|
reason: RefetchEventReason | Omit<string, RefetchEventReason>;
|
|
993
994
|
};
|
|
994
995
|
/**
|
|
995
|
-
* Minimal PluginExecutor interface for
|
|
996
|
+
* Minimal PluginExecutor interface for ApiContext.
|
|
996
997
|
* Avoids circular dependency with executor.ts.
|
|
997
998
|
*/
|
|
998
|
-
type
|
|
999
|
+
type ApiPluginExecutor = {
|
|
999
1000
|
executeMiddleware: <TData, TError>(operationType: OperationType, context: PluginContext, coreFetch: () => Promise<SpooshResponse<any, any>>) => Promise<SpooshResponse<TData, TError>>;
|
|
1000
1001
|
createContext: (input: PluginContextInput) => PluginContext;
|
|
1001
1002
|
getPlugins: () => readonly SpooshPlugin[];
|
|
@@ -1006,14 +1007,14 @@ type InstancePluginExecutor = {
|
|
|
1006
1007
|
registerContextEnhancer: (enhancer: (context: PluginContext) => void) => void;
|
|
1007
1008
|
};
|
|
1008
1009
|
/**
|
|
1009
|
-
* Context provided to plugin's
|
|
1010
|
-
* Used for creating framework-agnostic APIs exposed on the
|
|
1010
|
+
* Context provided to plugin's api function.
|
|
1011
|
+
* Used for creating framework-agnostic APIs exposed on the adapter.
|
|
1011
1012
|
*/
|
|
1012
|
-
type
|
|
1013
|
-
|
|
1013
|
+
type ApiContext<TApi = unknown> = {
|
|
1014
|
+
spoosh: TApi;
|
|
1014
1015
|
stateManager: StateManager;
|
|
1015
1016
|
eventEmitter: EventEmitter;
|
|
1016
|
-
pluginExecutor:
|
|
1017
|
+
pluginExecutor: ApiPluginExecutor;
|
|
1017
1018
|
/**
|
|
1018
1019
|
* Creates an event tracer for standalone events.
|
|
1019
1020
|
* Only available when devtools plugin is active.
|
|
@@ -1027,7 +1028,7 @@ type InstanceApiContext<TApi = unknown> = {
|
|
|
1027
1028
|
type SetupContext = {
|
|
1028
1029
|
stateManager: StateManager;
|
|
1029
1030
|
eventEmitter: EventEmitter;
|
|
1030
|
-
pluginExecutor:
|
|
1031
|
+
pluginExecutor: ApiPluginExecutor;
|
|
1031
1032
|
/**
|
|
1032
1033
|
* Creates an event tracer for standalone events.
|
|
1033
1034
|
* Only available when devtools plugin is active.
|
|
@@ -1110,24 +1111,24 @@ type ResolveSchemaTypes<TOptions, TSchema> = ResolveTypes<TOptions, ResolverCont
|
|
|
1110
1111
|
*/
|
|
1111
1112
|
type ResolveResultTypes<TResults, TOptions> = TResults & PluginResultResolvers<TOptions>;
|
|
1112
1113
|
/**
|
|
1113
|
-
* Resolves
|
|
1114
|
-
* Maps each key in
|
|
1114
|
+
* Resolves public API types with schema awareness.
|
|
1115
|
+
* Maps each key in TApi to its resolved type from resolvers.
|
|
1115
1116
|
*
|
|
1116
|
-
* Plugins extend
|
|
1117
|
-
* resolved
|
|
1117
|
+
* Plugins extend ApiResolvers via declaration merging to add their own
|
|
1118
|
+
* resolved API types.
|
|
1118
1119
|
*
|
|
1119
1120
|
* @example
|
|
1120
1121
|
* ```ts
|
|
1121
1122
|
* // In your plugin's types.ts:
|
|
1122
1123
|
* declare module "@spoosh/core" {
|
|
1123
|
-
* interface
|
|
1124
|
+
* interface ApiResolvers<TSchema> {
|
|
1124
1125
|
* prefetch: PrefetchFn<TSchema>;
|
|
1125
1126
|
* }
|
|
1126
1127
|
* }
|
|
1127
1128
|
* ```
|
|
1128
1129
|
*/
|
|
1129
|
-
type
|
|
1130
|
-
[K in keyof
|
|
1130
|
+
type ResolveApi<TApi, TSchema, TReadOptions = object> = {
|
|
1131
|
+
[K in keyof TApi]: K extends keyof ApiResolvers<TSchema> ? ApiResolvers<TSchema>[K] : TApi[K];
|
|
1131
1132
|
};
|
|
1132
1133
|
|
|
1133
1134
|
type ExtractReadOptions<T> = T extends SpooshPlugin<infer Types> ? Types extends {
|
|
@@ -1160,8 +1161,8 @@ type ExtractReadResult<T> = T extends SpooshPlugin<infer Types> ? Types extends
|
|
|
1160
1161
|
type ExtractWriteResult<T> = T extends SpooshPlugin<infer Types> ? Types extends {
|
|
1161
1162
|
writeResult: infer W;
|
|
1162
1163
|
} ? W : object : object;
|
|
1163
|
-
type
|
|
1164
|
-
|
|
1164
|
+
type ExtractApi<T> = T extends SpooshPlugin<infer Types> ? Types extends {
|
|
1165
|
+
api: infer A;
|
|
1165
1166
|
} ? A : object : object;
|
|
1166
1167
|
type UnionToIntersection$1<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
1167
1168
|
type MergePluginOptions<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>[]> = {
|
|
@@ -1178,7 +1179,7 @@ type MergePluginResults<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>
|
|
|
1178
1179
|
queue: UnionToIntersection$1<ExtractQueueResult<TPlugins[number]>>;
|
|
1179
1180
|
subscribe: UnionToIntersection$1<ExtractSubscribeResult<TPlugins[number]>>;
|
|
1180
1181
|
};
|
|
1181
|
-
type
|
|
1182
|
+
type MergePluginApi<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>[], TSchema = unknown> = ResolveApi<UnionToIntersection$1<ExtractApi<TPlugins[number]>>, TSchema, MergePluginOptions<TPlugins>["read"]>;
|
|
1182
1183
|
type PluginRegistry<TPlugins extends SpooshPlugin<PluginTypeConfig>[]> = {
|
|
1183
1184
|
plugins: TPlugins;
|
|
1184
1185
|
_options: MergePluginOptions<TPlugins>;
|
|
@@ -2551,7 +2552,7 @@ interface QueueControllerContext {
|
|
|
2551
2552
|
api: unknown;
|
|
2552
2553
|
stateManager: StateManager;
|
|
2553
2554
|
eventEmitter: EventEmitter;
|
|
2554
|
-
pluginExecutor:
|
|
2555
|
+
pluginExecutor: ApiPluginExecutor;
|
|
2555
2556
|
}
|
|
2556
2557
|
declare function createQueueController<TData, TError, TMeta = Record<string, unknown>>(config: QueueControllerConfig, context: QueueControllerContext): QueueController<TData, TError, TMeta>;
|
|
2557
2558
|
|
|
@@ -2604,4 +2605,4 @@ interface CreateSubscriptionControllerOptions<TData, TError> {
|
|
|
2604
2605
|
}
|
|
2605
2606
|
declare function createSubscriptionController<TData, TError>(options: CreateSubscriptionControllerOptions<TData, TError>): SubscriptionController<TData, TError>;
|
|
2606
2607
|
|
|
2607
|
-
export { type AnyMethod, type AnyRequestOptions, type ApiSchema, type BaseSubscriptionResponse, type BuiltInEvents, type CacheEntry, type CacheEntryWithKey, type CapturedCall, type ComputeRequestOptions, type CoreRequestOptionsBase, type CreateInfiniteReadOptions, type CreateOperationOptions, type CreateSubscriptionControllerOptions, type DataAwareCallback, type DataAwareTransform, type DataChangeCallback, type DevtoolEvents, type EventEmitter, type EventListener, type EventOptions, type EventTracer, type ExecuteOptions, type ExtractBody$1 as ExtractBody, type ExtractData, type ExtractError, type ExtractMethodOptions, type ExtractParamNames, type ExtractQuery$1 as ExtractQuery, type ExtractTriggerBody, type ExtractTriggerParams, type ExtractTriggerQuery, type FetchDirection, type FetchExecutor, type FindMatchingKey, HTTP_METHODS, type HasParams, type HasReadMethod, type HasSubscriptionMethod, type HasWriteMethod, type HeadersInitOrGetter, type HttpMethod, type HttpMethodKey, type InfiniteNextContext, type InfinitePage, type InfinitePageStatus, type InfinitePrevContext, type InfiniteReadController, type InfiniteReadState, type InfiniteRequestOptions, type InfiniteTriggerOptions, type
|
|
2608
|
+
export { type AnyMethod, type AnyRequestOptions, type ApiContext, type ApiPluginExecutor, type ApiResolvers, type ApiSchema, type BaseSubscriptionResponse, type BuiltInEvents, type CacheEntry, type CacheEntryWithKey, type CapturedCall, type ComputeRequestOptions, type CoreRequestOptionsBase, type CreateInfiniteReadOptions, type CreateOperationOptions, type CreateSubscriptionControllerOptions, type DataAwareCallback, type DataAwareTransform, type DataChangeCallback, type DevtoolEvents, type EventEmitter, type EventListener, type EventOptions, type EventTracer, type ExecuteOptions, type ExtractBody$1 as ExtractBody, type ExtractData, type ExtractError, type ExtractMethodOptions, type ExtractParamNames, type ExtractQuery$1 as ExtractQuery, type ExtractTriggerBody, type ExtractTriggerParams, type ExtractTriggerQuery, type FetchDirection, type FetchExecutor, type FindMatchingKey, HTTP_METHODS, type HasParams, type HasReadMethod, type HasSubscriptionMethod, type HasWriteMethod, type HeadersInitOrGetter, type HttpMethod, type HttpMethodKey, type InfiniteNextContext, type InfinitePage, type InfinitePageStatus, type InfinitePrevContext, type InfiniteReadController, type InfiniteReadState, type InfiniteRequestOptions, type InfiniteTriggerOptions, type LifecyclePhase, type MergePluginApi, type MergePluginOptions, type MergePluginResults, type MethodOptionsMap, type OperationController, type OperationState, type OperationType, type PluginAccessor, type PluginArray, type PluginContext, type PluginContextBase, type PluginContextExtensions, type PluginContextInput, type PluginExecutor, type PluginFactory, type PluginHandler, type PluginInternalRegistry, type PluginLifecycle, type PluginMiddleware, type PluginRegistry, type PluginRequestOptions, type PluginResolvers, type PluginResponseHandler, type PluginResultResolvers, type PluginTypeConfig, type PluginUpdateHandler, type QueueController, type QueueControllerConfig, type QueueControllerContext, type QueueItem, type QueueItemStatus, type QueueSelectorClient, type QueueStats, type QueueTriggerInput, type ReadClient, type ReadPaths, type ReadSchemaHelper, type RefetchEvent, type RequestCompleteEvent, type RequestOptions$1 as RequestOptions, type RequestTracer, type ResolveApi, type ResolveResultTypes, type ResolveSchemaTypes, type ResolveTypes, type ResolverContext, type SchemaPaths, type SelectedEndpoint, type SelectorFunction, type SelectorResult, Semaphore, type SetupContext, type Simplify, Spoosh, type SpooshBody, type SpooshClient, type SpooshConfig, type SpooshInstance, type SpooshOptions, type SpooshOptionsInput, type SpooshPlugin, type SpooshResponse, type SpooshSchema, type SpooshSubscriptionMethodRegistry, type SpooshTransport, type SpooshTransportRegistry, type StandaloneEvent, type StateManager, type StripPrefix, type Subscriber, type SubscriptionAccumulateEvent, type SubscriptionAdapter, type SubscriptionClient, type SubscriptionConnectEvent, type SubscriptionConnectedEvent, type SubscriptionContext, type SubscriptionController, type SubscriptionDisconnectEvent, type SubscriptionErrorEvent, type SubscriptionHandle, type SubscriptionMessageEvent, type SubscriptionMethod, type SubscriptionPaths, type TagMode, type TagOptions, type Trace, type TraceColor, type TraceEvent, type TraceInfo, type TraceListener, type TraceOptions, type TraceStage, type Transport, type TransportName, type TransportOption, type TransportOptionsMap, type TransportResponse, type TypedPluginContext, type TypedPluginDefinition, type WriteClient, type WriteMethod, type WritePaths, type WriteSchemaHelper, type WriteSelectorClient, __DEV__, buildUrl, clone, composeAdapter, containsFile, createClient, createEventEmitter, createInfiniteReadController, createInitialState, createOperationController, createPluginExecutor, createPluginRegistry, createProxyHandler, createQueueController, createSelectorProxy, createSpooshPlugin, createStateManager, createSubscriptionController, createTracer, executeFetch, extractMethodFromSelector, extractPathFromSelector, fetchTransport, form, generateSelfTagFromKey, generateTags, getContentType, isAbortError, isJsonBody, isNetworkError, isSpooshBody, json, mergeHeaders, objectToFormData, objectToUrlEncoded, removeHeaderKeys, resolveHeadersToRecord, resolvePath, resolvePathString, resolveRequestBody, resolveTags, setHeaders, sortObjectKeys, urlencoded, xhrTransport };
|
package/dist/index.d.ts
CHANGED
|
@@ -51,10 +51,10 @@ type SpooshResponse<TData, TError, TRequestOptions = unknown, TQuery = never, TB
|
|
|
51
51
|
* trigger({ body: urlencoded({ key: "value" }) });
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
declare
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
declare const __spooshBodyBrand: unique symbol;
|
|
55
|
+
type SpooshBody<T = unknown> = {
|
|
56
|
+
readonly [__spooshBodyBrand]: T;
|
|
57
|
+
};
|
|
58
58
|
declare function isSpooshBody(value: unknown): value is SpooshBody;
|
|
59
59
|
declare function form<T>(value: T): SpooshBody<T>;
|
|
60
60
|
declare function json<T>(value: T): SpooshBody<T>;
|
|
@@ -252,6 +252,7 @@ type StateManager = {
|
|
|
252
252
|
declare function createStateManager(): StateManager;
|
|
253
253
|
|
|
254
254
|
declare function createInitialState<TData, TError>(): OperationState<TData, TError>;
|
|
255
|
+
declare function generateSelfTagFromKey(key: string): string | undefined;
|
|
255
256
|
|
|
256
257
|
/**
|
|
257
258
|
* Devtool-related types for tracing and debugging.
|
|
@@ -679,7 +680,7 @@ type PluginLifecycle = {
|
|
|
679
680
|
*
|
|
680
681
|
* // Plugin with instance-level API
|
|
681
682
|
* SpooshPlugin<{
|
|
682
|
-
*
|
|
683
|
+
* api: { prefetch: (selector: Selector) => Promise<void> };
|
|
683
684
|
* }>
|
|
684
685
|
* ```
|
|
685
686
|
*/
|
|
@@ -696,7 +697,7 @@ type PluginTypeConfig = {
|
|
|
696
697
|
writeResult?: object;
|
|
697
698
|
queueResult?: object;
|
|
698
699
|
subscribeResult?: object;
|
|
699
|
-
|
|
700
|
+
api?: object;
|
|
700
701
|
};
|
|
701
702
|
/**
|
|
702
703
|
* Base interface for Spoosh plugins.
|
|
@@ -705,7 +706,7 @@ type PluginTypeConfig = {
|
|
|
705
706
|
* - `middleware`: Wraps the fetch flow for full control (intercept, transform, modify)
|
|
706
707
|
* - `afterResponse`: Called after every response, regardless of early returns
|
|
707
708
|
* - `lifecycle`: Component lifecycle hooks (onMount, onUpdate, onUnmount)
|
|
708
|
-
* - `
|
|
709
|
+
* - `internal`: Functions/variables accessible to other plugins
|
|
709
710
|
*
|
|
710
711
|
* @typeParam T - Plugin type configuration object. Specify only the types your plugin needs.
|
|
711
712
|
*
|
|
@@ -748,11 +749,11 @@ interface SpooshPlugin<T extends PluginTypeConfig = PluginTypeConfig> {
|
|
|
748
749
|
/** Component lifecycle hooks (setup, cleanup, option changes) */
|
|
749
750
|
lifecycle?: PluginLifecycle;
|
|
750
751
|
/** Expose functions/variables for other plugins to access via `context.plugins.get(name)` */
|
|
751
|
-
|
|
752
|
+
internal?: (context: PluginContext) => object;
|
|
752
753
|
/**
|
|
753
754
|
* One-time initialization when the Spoosh instance is created.
|
|
754
755
|
* Use for setting up timers, event listeners, or other side effects.
|
|
755
|
-
* Runs before
|
|
756
|
+
* Runs before api is called.
|
|
756
757
|
*
|
|
757
758
|
* @example
|
|
758
759
|
* ```ts
|
|
@@ -777,19 +778,19 @@ interface SpooshPlugin<T extends PluginTypeConfig = PluginTypeConfig> {
|
|
|
777
778
|
setup?: (context: SetupContext) => void;
|
|
778
779
|
/**
|
|
779
780
|
* Expose functions/properties on the framework adapter return value (e.g., create).
|
|
780
|
-
* Unlike `
|
|
781
|
+
* Unlike `internal`, these are accessible directly from the adapter, not just within plugin context.
|
|
781
782
|
* Should be pure - use `setup` for side effects like timers or event listeners.
|
|
782
783
|
*
|
|
783
784
|
* @example
|
|
784
785
|
* ```ts
|
|
785
|
-
*
|
|
786
|
+
* api: ({ spopiosh, stateManager }) => ({
|
|
786
787
|
* prefetch: async (selector) => { ... },
|
|
787
788
|
* invalidateAll: () => { ... },
|
|
788
789
|
* })
|
|
789
790
|
* ```
|
|
790
791
|
*/
|
|
791
|
-
|
|
792
|
-
|
|
792
|
+
api?: (context: ApiContext) => T extends {
|
|
793
|
+
api: infer A;
|
|
793
794
|
} ? A : object;
|
|
794
795
|
/**
|
|
795
796
|
* Wrap a subscription adapter to add plugin behavior (e.g., caching, retry, logging).
|
|
@@ -939,7 +940,7 @@ interface PluginResolvers<TContext extends ResolverContext> {
|
|
|
939
940
|
interface PluginResultResolvers<TOptions> {
|
|
940
941
|
}
|
|
941
942
|
/**
|
|
942
|
-
* Registry for plugin
|
|
943
|
+
* Registry for plugin internal APIs. Extend via declaration merging for type-safe access.
|
|
943
944
|
*
|
|
944
945
|
* Plugins can expose functions and variables that other plugins can access
|
|
945
946
|
* via `context.plugins.get("plugin-name")`.
|
|
@@ -948,38 +949,38 @@ interface PluginResultResolvers<TOptions> {
|
|
|
948
949
|
* ```ts
|
|
949
950
|
* // In your plugin's types file:
|
|
950
951
|
* declare module '@spoosh/core' {
|
|
951
|
-
* interface
|
|
952
|
+
* interface PluginInternalRegistry {
|
|
952
953
|
* "my-plugin": { myMethod: () => void }
|
|
953
954
|
* }
|
|
954
955
|
* }
|
|
955
956
|
* ```
|
|
956
957
|
*/
|
|
957
|
-
interface
|
|
958
|
+
interface PluginInternalRegistry {
|
|
958
959
|
}
|
|
959
960
|
/**
|
|
960
|
-
* Registry for
|
|
961
|
+
* Registry for public API type resolution. Extend via declaration merging.
|
|
961
962
|
*
|
|
962
|
-
* Plugins that expose schema-aware
|
|
963
|
+
* Plugins that expose schema-aware public APIs should extend this interface
|
|
963
964
|
* to get proper type inference when the API is used.
|
|
964
965
|
*
|
|
965
966
|
* @example
|
|
966
967
|
* ```ts
|
|
967
968
|
* // In your plugin's types file:
|
|
968
969
|
* declare module '@spoosh/core' {
|
|
969
|
-
* interface
|
|
970
|
+
* interface ApiResolvers<TSchema> {
|
|
970
971
|
* myFunction: MyFn<TSchema>;
|
|
971
972
|
* }
|
|
972
973
|
* }
|
|
973
974
|
* ```
|
|
974
975
|
*/
|
|
975
|
-
interface
|
|
976
|
+
interface ApiResolvers<TSchema> {
|
|
976
977
|
}
|
|
977
978
|
/**
|
|
978
|
-
* Accessor for plugin
|
|
979
|
+
* Accessor for plugin internal APIs with type-safe lookup.
|
|
979
980
|
*/
|
|
980
981
|
type PluginAccessor = {
|
|
981
|
-
/** Get a plugin's
|
|
982
|
-
get<K extends keyof
|
|
982
|
+
/** Get a plugin's internal API by name. Returns undefined if plugin not found. */
|
|
983
|
+
get<K extends keyof PluginInternalRegistry>(name: K): PluginInternalRegistry[K] | undefined;
|
|
983
984
|
get(name: string): unknown;
|
|
984
985
|
};
|
|
985
986
|
type RefetchEventReason = "focus" | "reconnect" | "polling" | "invalidate";
|
|
@@ -992,10 +993,10 @@ type RefetchEvent = {
|
|
|
992
993
|
reason: RefetchEventReason | Omit<string, RefetchEventReason>;
|
|
993
994
|
};
|
|
994
995
|
/**
|
|
995
|
-
* Minimal PluginExecutor interface for
|
|
996
|
+
* Minimal PluginExecutor interface for ApiContext.
|
|
996
997
|
* Avoids circular dependency with executor.ts.
|
|
997
998
|
*/
|
|
998
|
-
type
|
|
999
|
+
type ApiPluginExecutor = {
|
|
999
1000
|
executeMiddleware: <TData, TError>(operationType: OperationType, context: PluginContext, coreFetch: () => Promise<SpooshResponse<any, any>>) => Promise<SpooshResponse<TData, TError>>;
|
|
1000
1001
|
createContext: (input: PluginContextInput) => PluginContext;
|
|
1001
1002
|
getPlugins: () => readonly SpooshPlugin[];
|
|
@@ -1006,14 +1007,14 @@ type InstancePluginExecutor = {
|
|
|
1006
1007
|
registerContextEnhancer: (enhancer: (context: PluginContext) => void) => void;
|
|
1007
1008
|
};
|
|
1008
1009
|
/**
|
|
1009
|
-
* Context provided to plugin's
|
|
1010
|
-
* Used for creating framework-agnostic APIs exposed on the
|
|
1010
|
+
* Context provided to plugin's api function.
|
|
1011
|
+
* Used for creating framework-agnostic APIs exposed on the adapter.
|
|
1011
1012
|
*/
|
|
1012
|
-
type
|
|
1013
|
-
|
|
1013
|
+
type ApiContext<TApi = unknown> = {
|
|
1014
|
+
spoosh: TApi;
|
|
1014
1015
|
stateManager: StateManager;
|
|
1015
1016
|
eventEmitter: EventEmitter;
|
|
1016
|
-
pluginExecutor:
|
|
1017
|
+
pluginExecutor: ApiPluginExecutor;
|
|
1017
1018
|
/**
|
|
1018
1019
|
* Creates an event tracer for standalone events.
|
|
1019
1020
|
* Only available when devtools plugin is active.
|
|
@@ -1027,7 +1028,7 @@ type InstanceApiContext<TApi = unknown> = {
|
|
|
1027
1028
|
type SetupContext = {
|
|
1028
1029
|
stateManager: StateManager;
|
|
1029
1030
|
eventEmitter: EventEmitter;
|
|
1030
|
-
pluginExecutor:
|
|
1031
|
+
pluginExecutor: ApiPluginExecutor;
|
|
1031
1032
|
/**
|
|
1032
1033
|
* Creates an event tracer for standalone events.
|
|
1033
1034
|
* Only available when devtools plugin is active.
|
|
@@ -1110,24 +1111,24 @@ type ResolveSchemaTypes<TOptions, TSchema> = ResolveTypes<TOptions, ResolverCont
|
|
|
1110
1111
|
*/
|
|
1111
1112
|
type ResolveResultTypes<TResults, TOptions> = TResults & PluginResultResolvers<TOptions>;
|
|
1112
1113
|
/**
|
|
1113
|
-
* Resolves
|
|
1114
|
-
* Maps each key in
|
|
1114
|
+
* Resolves public API types with schema awareness.
|
|
1115
|
+
* Maps each key in TApi to its resolved type from resolvers.
|
|
1115
1116
|
*
|
|
1116
|
-
* Plugins extend
|
|
1117
|
-
* resolved
|
|
1117
|
+
* Plugins extend ApiResolvers via declaration merging to add their own
|
|
1118
|
+
* resolved API types.
|
|
1118
1119
|
*
|
|
1119
1120
|
* @example
|
|
1120
1121
|
* ```ts
|
|
1121
1122
|
* // In your plugin's types.ts:
|
|
1122
1123
|
* declare module "@spoosh/core" {
|
|
1123
|
-
* interface
|
|
1124
|
+
* interface ApiResolvers<TSchema> {
|
|
1124
1125
|
* prefetch: PrefetchFn<TSchema>;
|
|
1125
1126
|
* }
|
|
1126
1127
|
* }
|
|
1127
1128
|
* ```
|
|
1128
1129
|
*/
|
|
1129
|
-
type
|
|
1130
|
-
[K in keyof
|
|
1130
|
+
type ResolveApi<TApi, TSchema, TReadOptions = object> = {
|
|
1131
|
+
[K in keyof TApi]: K extends keyof ApiResolvers<TSchema> ? ApiResolvers<TSchema>[K] : TApi[K];
|
|
1131
1132
|
};
|
|
1132
1133
|
|
|
1133
1134
|
type ExtractReadOptions<T> = T extends SpooshPlugin<infer Types> ? Types extends {
|
|
@@ -1160,8 +1161,8 @@ type ExtractReadResult<T> = T extends SpooshPlugin<infer Types> ? Types extends
|
|
|
1160
1161
|
type ExtractWriteResult<T> = T extends SpooshPlugin<infer Types> ? Types extends {
|
|
1161
1162
|
writeResult: infer W;
|
|
1162
1163
|
} ? W : object : object;
|
|
1163
|
-
type
|
|
1164
|
-
|
|
1164
|
+
type ExtractApi<T> = T extends SpooshPlugin<infer Types> ? Types extends {
|
|
1165
|
+
api: infer A;
|
|
1165
1166
|
} ? A : object : object;
|
|
1166
1167
|
type UnionToIntersection$1<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
1167
1168
|
type MergePluginOptions<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>[]> = {
|
|
@@ -1178,7 +1179,7 @@ type MergePluginResults<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>
|
|
|
1178
1179
|
queue: UnionToIntersection$1<ExtractQueueResult<TPlugins[number]>>;
|
|
1179
1180
|
subscribe: UnionToIntersection$1<ExtractSubscribeResult<TPlugins[number]>>;
|
|
1180
1181
|
};
|
|
1181
|
-
type
|
|
1182
|
+
type MergePluginApi<TPlugins extends readonly SpooshPlugin<PluginTypeConfig>[], TSchema = unknown> = ResolveApi<UnionToIntersection$1<ExtractApi<TPlugins[number]>>, TSchema, MergePluginOptions<TPlugins>["read"]>;
|
|
1182
1183
|
type PluginRegistry<TPlugins extends SpooshPlugin<PluginTypeConfig>[]> = {
|
|
1183
1184
|
plugins: TPlugins;
|
|
1184
1185
|
_options: MergePluginOptions<TPlugins>;
|
|
@@ -2551,7 +2552,7 @@ interface QueueControllerContext {
|
|
|
2551
2552
|
api: unknown;
|
|
2552
2553
|
stateManager: StateManager;
|
|
2553
2554
|
eventEmitter: EventEmitter;
|
|
2554
|
-
pluginExecutor:
|
|
2555
|
+
pluginExecutor: ApiPluginExecutor;
|
|
2555
2556
|
}
|
|
2556
2557
|
declare function createQueueController<TData, TError, TMeta = Record<string, unknown>>(config: QueueControllerConfig, context: QueueControllerContext): QueueController<TData, TError, TMeta>;
|
|
2557
2558
|
|
|
@@ -2604,4 +2605,4 @@ interface CreateSubscriptionControllerOptions<TData, TError> {
|
|
|
2604
2605
|
}
|
|
2605
2606
|
declare function createSubscriptionController<TData, TError>(options: CreateSubscriptionControllerOptions<TData, TError>): SubscriptionController<TData, TError>;
|
|
2606
2607
|
|
|
2607
|
-
export { type AnyMethod, type AnyRequestOptions, type ApiSchema, type BaseSubscriptionResponse, type BuiltInEvents, type CacheEntry, type CacheEntryWithKey, type CapturedCall, type ComputeRequestOptions, type CoreRequestOptionsBase, type CreateInfiniteReadOptions, type CreateOperationOptions, type CreateSubscriptionControllerOptions, type DataAwareCallback, type DataAwareTransform, type DataChangeCallback, type DevtoolEvents, type EventEmitter, type EventListener, type EventOptions, type EventTracer, type ExecuteOptions, type ExtractBody$1 as ExtractBody, type ExtractData, type ExtractError, type ExtractMethodOptions, type ExtractParamNames, type ExtractQuery$1 as ExtractQuery, type ExtractTriggerBody, type ExtractTriggerParams, type ExtractTriggerQuery, type FetchDirection, type FetchExecutor, type FindMatchingKey, HTTP_METHODS, type HasParams, type HasReadMethod, type HasSubscriptionMethod, type HasWriteMethod, type HeadersInitOrGetter, type HttpMethod, type HttpMethodKey, type InfiniteNextContext, type InfinitePage, type InfinitePageStatus, type InfinitePrevContext, type InfiniteReadController, type InfiniteReadState, type InfiniteRequestOptions, type InfiniteTriggerOptions, type
|
|
2608
|
+
export { type AnyMethod, type AnyRequestOptions, type ApiContext, type ApiPluginExecutor, type ApiResolvers, type ApiSchema, type BaseSubscriptionResponse, type BuiltInEvents, type CacheEntry, type CacheEntryWithKey, type CapturedCall, type ComputeRequestOptions, type CoreRequestOptionsBase, type CreateInfiniteReadOptions, type CreateOperationOptions, type CreateSubscriptionControllerOptions, type DataAwareCallback, type DataAwareTransform, type DataChangeCallback, type DevtoolEvents, type EventEmitter, type EventListener, type EventOptions, type EventTracer, type ExecuteOptions, type ExtractBody$1 as ExtractBody, type ExtractData, type ExtractError, type ExtractMethodOptions, type ExtractParamNames, type ExtractQuery$1 as ExtractQuery, type ExtractTriggerBody, type ExtractTriggerParams, type ExtractTriggerQuery, type FetchDirection, type FetchExecutor, type FindMatchingKey, HTTP_METHODS, type HasParams, type HasReadMethod, type HasSubscriptionMethod, type HasWriteMethod, type HeadersInitOrGetter, type HttpMethod, type HttpMethodKey, type InfiniteNextContext, type InfinitePage, type InfinitePageStatus, type InfinitePrevContext, type InfiniteReadController, type InfiniteReadState, type InfiniteRequestOptions, type InfiniteTriggerOptions, type LifecyclePhase, type MergePluginApi, type MergePluginOptions, type MergePluginResults, type MethodOptionsMap, type OperationController, type OperationState, type OperationType, type PluginAccessor, type PluginArray, type PluginContext, type PluginContextBase, type PluginContextExtensions, type PluginContextInput, type PluginExecutor, type PluginFactory, type PluginHandler, type PluginInternalRegistry, type PluginLifecycle, type PluginMiddleware, type PluginRegistry, type PluginRequestOptions, type PluginResolvers, type PluginResponseHandler, type PluginResultResolvers, type PluginTypeConfig, type PluginUpdateHandler, type QueueController, type QueueControllerConfig, type QueueControllerContext, type QueueItem, type QueueItemStatus, type QueueSelectorClient, type QueueStats, type QueueTriggerInput, type ReadClient, type ReadPaths, type ReadSchemaHelper, type RefetchEvent, type RequestCompleteEvent, type RequestOptions$1 as RequestOptions, type RequestTracer, type ResolveApi, type ResolveResultTypes, type ResolveSchemaTypes, type ResolveTypes, type ResolverContext, type SchemaPaths, type SelectedEndpoint, type SelectorFunction, type SelectorResult, Semaphore, type SetupContext, type Simplify, Spoosh, type SpooshBody, type SpooshClient, type SpooshConfig, type SpooshInstance, type SpooshOptions, type SpooshOptionsInput, type SpooshPlugin, type SpooshResponse, type SpooshSchema, type SpooshSubscriptionMethodRegistry, type SpooshTransport, type SpooshTransportRegistry, type StandaloneEvent, type StateManager, type StripPrefix, type Subscriber, type SubscriptionAccumulateEvent, type SubscriptionAdapter, type SubscriptionClient, type SubscriptionConnectEvent, type SubscriptionConnectedEvent, type SubscriptionContext, type SubscriptionController, type SubscriptionDisconnectEvent, type SubscriptionErrorEvent, type SubscriptionHandle, type SubscriptionMessageEvent, type SubscriptionMethod, type SubscriptionPaths, type TagMode, type TagOptions, type Trace, type TraceColor, type TraceEvent, type TraceInfo, type TraceListener, type TraceOptions, type TraceStage, type Transport, type TransportName, type TransportOption, type TransportOptionsMap, type TransportResponse, type TypedPluginContext, type TypedPluginDefinition, type WriteClient, type WriteMethod, type WritePaths, type WriteSchemaHelper, type WriteSelectorClient, __DEV__, buildUrl, clone, composeAdapter, containsFile, createClient, createEventEmitter, createInfiniteReadController, createInitialState, createOperationController, createPluginExecutor, createPluginRegistry, createProxyHandler, createQueueController, createSelectorProxy, createSpooshPlugin, createStateManager, createSubscriptionController, createTracer, executeFetch, extractMethodFromSelector, extractPathFromSelector, fetchTransport, form, generateSelfTagFromKey, generateTags, getContentType, isAbortError, isJsonBody, isNetworkError, isSpooshBody, json, mergeHeaders, objectToFormData, objectToUrlEncoded, removeHeaderKeys, resolveHeadersToRecord, resolvePath, resolvePathString, resolveRequestBody, resolveTags, setHeaders, sortObjectKeys, urlencoded, xhrTransport };
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,7 @@ __export(src_exports, {
|
|
|
47
47
|
extractPathFromSelector: () => extractPathFromSelector,
|
|
48
48
|
fetchTransport: () => fetchTransport,
|
|
49
49
|
form: () => form,
|
|
50
|
+
generateSelfTagFromKey: () => generateSelfTagFromKey,
|
|
50
51
|
generateTags: () => generateTags,
|
|
51
52
|
getContentType: () => getContentType,
|
|
52
53
|
isAbortError: () => isAbortError,
|
|
@@ -761,7 +762,19 @@ function createInitialState() {
|
|
|
761
762
|
function generateSelfTagFromKey(key) {
|
|
762
763
|
try {
|
|
763
764
|
const parsed = JSON.parse(key);
|
|
764
|
-
|
|
765
|
+
const rawPath = parsed.path;
|
|
766
|
+
if (!rawPath) return void 0;
|
|
767
|
+
const path = Array.isArray(rawPath) ? rawPath.join("/") : rawPath;
|
|
768
|
+
const params = parsed.options?.params ?? parsed.pageRequest?.params;
|
|
769
|
+
if (!params) return path;
|
|
770
|
+
return path.split("/").map((segment) => {
|
|
771
|
+
if (segment.startsWith(":")) {
|
|
772
|
+
const paramName = segment.slice(1);
|
|
773
|
+
const value = params[paramName];
|
|
774
|
+
return value !== void 0 ? String(value) : segment;
|
|
775
|
+
}
|
|
776
|
+
return segment;
|
|
777
|
+
}).join("/");
|
|
765
778
|
} catch {
|
|
766
779
|
return void 0;
|
|
767
780
|
}
|
|
@@ -998,7 +1011,7 @@ function createPluginExecutor(initialPlugins = []) {
|
|
|
998
1011
|
const createPluginAccessor = (context) => ({
|
|
999
1012
|
get(name) {
|
|
1000
1013
|
const plugin = plugins.find((p) => p.name === name);
|
|
1001
|
-
return plugin?.
|
|
1014
|
+
return plugin?.internal?.(context);
|
|
1002
1015
|
}
|
|
1003
1016
|
});
|
|
1004
1017
|
const executeLifecycleImpl = async (phase, operationType, context) => {
|
|
@@ -1969,7 +1982,7 @@ var Semaphore = class {
|
|
|
1969
1982
|
if (this.current > 0) {
|
|
1970
1983
|
this.current--;
|
|
1971
1984
|
}
|
|
1972
|
-
if (this.waiting.length > 0) {
|
|
1985
|
+
if (this.waiting.length > 0 && this.current < this.max) {
|
|
1973
1986
|
this.current++;
|
|
1974
1987
|
this.waiting.shift()(true);
|
|
1975
1988
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -689,7 +689,19 @@ function createInitialState() {
|
|
|
689
689
|
function generateSelfTagFromKey(key) {
|
|
690
690
|
try {
|
|
691
691
|
const parsed = JSON.parse(key);
|
|
692
|
-
|
|
692
|
+
const rawPath = parsed.path;
|
|
693
|
+
if (!rawPath) return void 0;
|
|
694
|
+
const path = Array.isArray(rawPath) ? rawPath.join("/") : rawPath;
|
|
695
|
+
const params = parsed.options?.params ?? parsed.pageRequest?.params;
|
|
696
|
+
if (!params) return path;
|
|
697
|
+
return path.split("/").map((segment) => {
|
|
698
|
+
if (segment.startsWith(":")) {
|
|
699
|
+
const paramName = segment.slice(1);
|
|
700
|
+
const value = params[paramName];
|
|
701
|
+
return value !== void 0 ? String(value) : segment;
|
|
702
|
+
}
|
|
703
|
+
return segment;
|
|
704
|
+
}).join("/");
|
|
693
705
|
} catch {
|
|
694
706
|
return void 0;
|
|
695
707
|
}
|
|
@@ -926,7 +938,7 @@ function createPluginExecutor(initialPlugins = []) {
|
|
|
926
938
|
const createPluginAccessor = (context) => ({
|
|
927
939
|
get(name) {
|
|
928
940
|
const plugin = plugins.find((p) => p.name === name);
|
|
929
|
-
return plugin?.
|
|
941
|
+
return plugin?.internal?.(context);
|
|
930
942
|
}
|
|
931
943
|
});
|
|
932
944
|
const executeLifecycleImpl = async (phase, operationType, context) => {
|
|
@@ -1897,7 +1909,7 @@ var Semaphore = class {
|
|
|
1897
1909
|
if (this.current > 0) {
|
|
1898
1910
|
this.current--;
|
|
1899
1911
|
}
|
|
1900
|
-
if (this.waiting.length > 0) {
|
|
1912
|
+
if (this.waiting.length > 0 && this.current < this.max) {
|
|
1901
1913
|
this.current++;
|
|
1902
1914
|
this.waiting.shift()(true);
|
|
1903
1915
|
}
|
|
@@ -2450,6 +2462,7 @@ export {
|
|
|
2450
2462
|
extractPathFromSelector,
|
|
2451
2463
|
fetchTransport,
|
|
2452
2464
|
form,
|
|
2465
|
+
generateSelfTagFromKey,
|
|
2453
2466
|
generateTags,
|
|
2454
2467
|
getContentType,
|
|
2455
2468
|
isAbortError,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Type-safe API toolkit with plugin middleware system",
|
|
6
6
|
"keywords": [
|
|
@@ -39,6 +39,6 @@
|
|
|
39
39
|
"build": "tsup",
|
|
40
40
|
"typecheck": "tsc --noEmit",
|
|
41
41
|
"lint": "eslint src --max-warnings 0",
|
|
42
|
-
"format": "prettier --write 'src/**/*.ts'"
|
|
42
|
+
"format": "prettier --write 'src/**/*.ts' '*.md'"
|
|
43
43
|
}
|
|
44
44
|
}
|