diff --git a/src/actions/model.ts b/src/actions/model.ts index 693363f..c663dce 100644 --- a/src/actions/model.ts +++ b/src/actions/model.ts @@ -1,5 +1,5 @@ import type { Action, AnyAction } from 'redux'; -import { isFunction } from '../utils/isType'; +import { isFunction } from '../utils/is-type'; export interface PreModelAction extends Action { diff --git a/src/api/getLoading.ts b/src/api/get-loading.ts similarity index 91% rename from src/api/getLoading.ts rename to src/api/get-loading.ts index 225a143..ad73f69 100644 --- a/src/api/getLoading.ts +++ b/src/api/get-loading.ts @@ -1,7 +1,7 @@ import { LOADING_CATEGORY } from '../actions/loading'; -import { PromiseRoomEffect, PromiseEffect } from '../model/enhanceEffect'; -import { loadingStore, FindLoading } from '../store/loadingStore'; -import { isFunction } from '../utils/isType'; +import { PromiseRoomEffect, PromiseEffect } from '../model/enhance-effect'; +import { loadingStore, FindLoading } from '../store/loading-store'; +import { isFunction } from '../utils/is-type'; /** * 检测给定的effect方法中是否有正在执行的。支持多个方法同时传入。 diff --git a/src/api/use-computed.ts b/src/api/use-computed.ts index 5aaf89a..d3f679b 100644 --- a/src/api/use-computed.ts +++ b/src/api/use-computed.ts @@ -1,6 +1,6 @@ import { ComputedFlag } from '../model/types'; -import { useModelSelector } from '../redux/useSelector'; -import { toArgs } from '../utils/toArgs'; +import { useModelSelector } from '../redux/use-selector'; +import { toArgs } from '../utils/to-args'; export interface UseComputedFlag extends ComputedFlag { (...args: any[]): any; diff --git a/src/api/use-isolate.ts b/src/api/use-isolate.ts index 7cbf83e..2541466 100644 --- a/src/api/use-isolate.ts +++ b/src/api/use-isolate.ts @@ -1,8 +1,8 @@ import { useEffect, useMemo, useRef, useState } from 'react'; import { DestroyLoadingAction, DESTROY_LOADING } from '../actions/loading'; -import { loadingStore } from '../store/loadingStore'; -import { modelStore } from '../store/modelStore'; -import { cloneModel } from '../model/cloneModel'; +import { loadingStore } from '../store/loading-store'; +import { modelStore } from '../store/model-store'; +import { cloneModel } from '../model/clone-model'; import { Model } from '../model/types'; let globalCounter = 0; diff --git a/src/api/useLoading.ts b/src/api/use-loading.ts similarity index 86% rename from src/api/useLoading.ts rename to src/api/use-loading.ts index b319900..d2d8d85 100644 --- a/src/api/useLoading.ts +++ b/src/api/use-loading.ts @@ -1,7 +1,7 @@ -import { PromiseRoomEffect, PromiseEffect } from '../model/enhanceEffect'; -import { FindLoading } from '../store/loadingStore'; -import { useLoadingSelector } from '../redux/useSelector'; -import { getLoading } from './getLoading'; +import { PromiseRoomEffect, PromiseEffect } from '../model/enhance-effect'; +import { FindLoading } from '../store/loading-store'; +import { useLoadingSelector } from '../redux/use-selector'; +import { getLoading } from './get-loading'; /** * 检测给定的effect方法中是否有正在执行的。支持多个方法同时传入。 diff --git a/src/model/useModel.ts b/src/api/use-model.ts similarity index 96% rename from src/model/useModel.ts rename to src/api/use-model.ts index 0960117..50d5b02 100644 --- a/src/model/useModel.ts +++ b/src/api/use-model.ts @@ -1,9 +1,9 @@ import { shallowEqual } from 'react-redux'; -import { deepEqual } from '../utils/deepEqual'; -import type { Model } from './types'; -import { toArgs } from '../utils/toArgs'; -import { useModelSelector } from '../redux/useSelector'; -import { isFunction, isString } from '../utils/isType'; +import { deepEqual } from '../utils/deep-equal'; +import type { Model } from '../model/types'; +import { toArgs } from '../utils/to-args'; +import { useModelSelector } from '../redux/use-selector'; +import { isFunction, isString } from '../utils/is-type'; /** * hooks新旧数据的对比方式: diff --git a/src/engines/local.ts b/src/engines/local.ts index 774ae2e..1d58c83 100644 --- a/src/engines/local.ts +++ b/src/engines/local.ts @@ -1,4 +1,4 @@ -import type { StorageEngine } from './StorageEngine'; +import type { StorageEngine } from './storage-engine'; export const local: StorageEngine = { getItem(key) { diff --git a/src/engines/memory.ts b/src/engines/memory.ts index d443174..8fa6cf6 100644 --- a/src/engines/memory.ts +++ b/src/engines/memory.ts @@ -1,4 +1,4 @@ -import type { StorageEngine } from './StorageEngine'; +import type { StorageEngine } from './storage-engine'; let cache: Partial> = {}; diff --git a/src/engines/session.ts b/src/engines/session.ts index 26be475..11b057d 100644 --- a/src/engines/session.ts +++ b/src/engines/session.ts @@ -1,4 +1,4 @@ -import type { StorageEngine } from './StorageEngine'; +import type { StorageEngine } from './storage-engine'; export const session: StorageEngine = { getItem(key) { diff --git a/src/engines/StorageEngine.ts b/src/engines/storage-engine.ts similarity index 100% rename from src/engines/StorageEngine.ts rename to src/engines/storage-engine.ts diff --git a/src/index.ts b/src/index.ts index 4b5c600..87d8e79 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,19 +1,19 @@ // 模型中使用 -export { defineModel } from './model/defineModel'; -export { cloneModel } from './model/cloneModel'; +export { defineModel } from './model/define-model'; +export { cloneModel } from './model/clone-model'; // 组件中使用 -export { useModel } from './model/useModel'; -export { useLoading } from './api/useLoading'; -export { getLoading } from './api/getLoading'; +export { useModel } from './api/use-model'; +export { useLoading } from './api/use-loading'; +export { getLoading } from './api/get-loading'; export { useComputed } from './api/use-computed'; export { useIsolate } from './api/use-isolate'; export { connect } from './redux/connect'; // 入口使用 export { compose } from 'redux'; -export { modelStore as store } from './store/modelStore'; -export { FocaProvider } from './redux/FocaProvider'; +export { modelStore as store } from './store/model-store'; +export { FocaProvider } from './redux/foca-provider'; export { engines } from './engines'; export { memoryStorage } from './engines/memory'; @@ -29,4 +29,4 @@ export type { Unsubscribe, } from 'redux'; export type { Model } from './model/types'; -export type { StorageEngine } from './engines/StorageEngine'; +export type { StorageEngine } from './engines/storage-engine'; diff --git a/src/middleware/actionInActionInterceptor.ts b/src/middleware/action-in-action.interceptor.ts similarity index 100% rename from src/middleware/actionInActionInterceptor.ts rename to src/middleware/action-in-action.interceptor.ts diff --git a/src/middleware/destroyLoadingInterceptor.ts b/src/middleware/destroy-loading.interceptor.ts similarity index 100% rename from src/middleware/destroyLoadingInterceptor.ts rename to src/middleware/destroy-loading.interceptor.ts diff --git a/src/middleware/freezeStateMiddleware.ts b/src/middleware/freeze-state.middleware.ts similarity index 100% rename from src/middleware/freezeStateMiddleware.ts rename to src/middleware/freeze-state.middleware.ts diff --git a/src/middleware/loadingInterceptor.ts b/src/middleware/loading.interceptor.ts similarity index 98% rename from src/middleware/loadingInterceptor.ts rename to src/middleware/loading.interceptor.ts index 039f569..514f17e 100644 --- a/src/middleware/loadingInterceptor.ts +++ b/src/middleware/loading.interceptor.ts @@ -1,5 +1,5 @@ import type { AnyAction, Middleware } from 'redux'; -import type { LoadingStore, LoadingStoreState } from '../store/loadingStore'; +import type { LoadingStore, LoadingStoreState } from '../store/loading-store'; import { isLoadingAction } from '../actions/loading'; export const loadingInterceptor = ( diff --git a/src/middleware/modelInterceptor.ts b/src/middleware/model.interceptor.ts similarity index 94% rename from src/middleware/modelInterceptor.ts rename to src/middleware/model.interceptor.ts index 55aa0f9..8d6b703 100644 --- a/src/middleware/modelInterceptor.ts +++ b/src/middleware/model.interceptor.ts @@ -1,5 +1,5 @@ import type { AnyAction, Middleware } from 'redux'; -import { deepEqual } from '../utils/deepEqual'; +import { deepEqual } from '../utils/deep-equal'; import { isPreModelAction, PostModelAction } from '../actions/model'; import { immer } from '../utils/immer'; diff --git a/src/model/cloneModel.ts b/src/model/clone-model.ts similarity index 94% rename from src/model/cloneModel.ts rename to src/model/clone-model.ts index b4b9c89..2c0fa91 100644 --- a/src/model/cloneModel.ts +++ b/src/model/clone-model.ts @@ -1,5 +1,5 @@ -import { isFunction } from '../utils/isType'; -import { defineModel } from './defineModel'; +import { isFunction } from '../utils/is-type'; +import { defineModel } from './define-model'; import type { DefineModelOptions, InternalModel, Model } from './types'; const editableKeys = [ diff --git a/src/model/defineModel.ts b/src/model/define-model.ts similarity index 93% rename from src/model/defineModel.ts rename to src/model/define-model.ts index ac33384..8d1c521 100644 --- a/src/model/defineModel.ts +++ b/src/model/define-model.ts @@ -1,14 +1,14 @@ import { parseState, stringifyState } from '../utils/serialize'; -import { deepEqual } from '../utils/deepEqual'; -import { EnhancedAction, enhanceAction } from './enhanceAction'; -import { EnhancedEffect, enhanceEffect } from './enhanceEffect'; -import { modelStore } from '../store/modelStore'; -import { createReducer } from '../redux/createReducer'; +import { deepEqual } from '../utils/deep-equal'; +import { EnhancedAction, enhanceAction } from './enhance-action'; +import { EnhancedEffect, enhanceEffect } from './enhance-effect'; +import { modelStore } from '../store/model-store'; +import { createReducer } from '../redux/create-reducer'; import { composeGetter, defineGetter } from '../utils/getter'; -import { getMethodCategory } from '../utils/getMethodCategory'; +import { getMethodCategory } from '../utils/get-method-category'; import { guard } from './guard'; -import { depsCollector } from '../reactive/depsCollector'; -import { ObjectDeps } from '../reactive/ObjectDeps'; +import { depsCollector } from '../reactive/deps-collector'; +import { ObjectDeps } from '../reactive/object-deps'; import type { ActionCtx, EffectCtx, @@ -22,10 +22,10 @@ import type { SetStateCallback, ComputedFlag, } from './types'; -import { isFunction } from '../utils/isType'; +import { isFunction } from '../utils/is-type'; import { Unsubscribe } from 'redux'; import { freeze, original, isDraft } from 'immer'; -import { isPromise } from '../utils/isPromise'; +import { isPromise } from '../utils/is-promise'; import { enhanceComputed } from './enhance-computed'; export const defineModel = < diff --git a/src/model/enhanceAction.ts b/src/model/enhance-action.ts similarity index 91% rename from src/model/enhanceAction.ts rename to src/model/enhance-action.ts index ca95f48..f80608c 100644 --- a/src/model/enhanceAction.ts +++ b/src/model/enhance-action.ts @@ -1,6 +1,6 @@ import type { PreModelAction } from '../actions/model'; -import { modelStore } from '../store/modelStore'; -import { toArgs } from '../utils/toArgs'; +import { modelStore } from '../store/model-store'; +import { toArgs } from '../utils/to-args'; import type { ActionCtx } from './types'; export interface EnhancedAction { diff --git a/src/model/enhance-computed.ts b/src/model/enhance-computed.ts index 90e39b7..a6d86d6 100644 --- a/src/model/enhance-computed.ts +++ b/src/model/enhance-computed.ts @@ -1,6 +1,6 @@ -import { ComputedValue } from '../reactive/ComputedValue'; -import { modelStore } from '../store/modelStore'; -import { toArgs } from '../utils/toArgs'; +import { ComputedValue } from '../reactive/computed-value'; +import { modelStore } from '../store/model-store'; +import { toArgs } from '../utils/to-args'; import { ComputedCtx, ComputedFlag } from './types'; export const enhanceComputed = ( diff --git a/src/model/enhanceEffect.ts b/src/model/enhance-effect.ts similarity index 95% rename from src/model/enhanceEffect.ts rename to src/model/enhance-effect.ts index 83b7f5e..93dbba7 100644 --- a/src/model/enhanceEffect.ts +++ b/src/model/enhance-effect.ts @@ -4,9 +4,9 @@ import { TYPE_SET_LOADING, } from '../actions/loading'; import type { EffectCtx } from './types'; -import { isPromise } from '../utils/isPromise'; -import { toArgs } from '../utils/toArgs'; -import { loadingStore } from '../store/loadingStore'; +import { isPromise } from '../utils/is-promise'; +import { toArgs } from '../utils/to-args'; +import { loadingStore } from '../store/loading-store'; interface RoomFunc

> { (category: number | string): { diff --git a/src/model/types.ts b/src/model/types.ts index 24495ac..6f0b0e5 100644 --- a/src/model/types.ts +++ b/src/model/types.ts @@ -1,6 +1,6 @@ import type { AnyAction } from 'redux'; -import type { EnhancedEffect } from './enhanceEffect'; -import type { PersistMergeMode } from '../persist/PersistItem'; +import type { EnhancedEffect } from './enhance-effect'; +import type { PersistMergeMode } from '../persist/persist-item'; export interface ComputedFlag { readonly _computedFlag: never; diff --git a/src/persist/PersistGate.tsx b/src/persist/persist-gate.tsx similarity index 89% rename from src/persist/PersistGate.tsx rename to src/persist/persist-gate.tsx index 5b41dfe..9804da0 100644 --- a/src/persist/PersistGate.tsx +++ b/src/persist/persist-gate.tsx @@ -1,6 +1,6 @@ import { ReactNode, FC, useState, useEffect } from 'react'; -import { modelStore } from '../store/modelStore'; -import { isFunction } from '../utils/isType'; +import { modelStore } from '../store/model-store'; +import { isFunction } from '../utils/is-type'; export interface PersistGateProps { loading?: ReactNode; diff --git a/src/persist/PersistItem.ts b/src/persist/persist-item.ts similarity index 98% rename from src/persist/PersistItem.ts rename to src/persist/persist-item.ts index 887c7fd..c3ade2b 100644 --- a/src/persist/PersistItem.ts +++ b/src/persist/persist-item.ts @@ -1,11 +1,11 @@ -import type { StorageEngine } from '../engines/StorageEngine'; +import type { StorageEngine } from '../engines/storage-engine'; import type { GetInitialState, InternalModel, Model, ModelPersist, } from '../model/types'; -import { isObject, isPlainObject, isString } from '../utils/isType'; +import { isObject, isPlainObject, isString } from '../utils/is-type'; import { toPromise } from '../utils/to-promise'; import { parseState, stringifyState } from '../utils/serialize'; diff --git a/src/persist/PersistManager.ts b/src/persist/persist-manager.ts similarity index 96% rename from src/persist/PersistManager.ts rename to src/persist/persist-manager.ts index 207b19c..251c4a3 100644 --- a/src/persist/PersistManager.ts +++ b/src/persist/persist-manager.ts @@ -1,6 +1,6 @@ import type { Reducer, Store, Unsubscribe } from 'redux'; import { actionHydrate, isHydrateAction } from '../actions/persist'; -import { PersistItem, PersistOptions } from './PersistItem'; +import { PersistItem, PersistOptions } from './persist-item'; export class PersistManager { protected initialized: boolean = false; diff --git a/src/reactive/ComputedValue.ts b/src/reactive/computed-value.ts similarity index 90% rename from src/reactive/ComputedValue.ts rename to src/reactive/computed-value.ts index f13981f..4d56867 100644 --- a/src/reactive/ComputedValue.ts +++ b/src/reactive/computed-value.ts @@ -1,7 +1,7 @@ import type { Store } from 'redux'; -import { depsCollector } from './depsCollector'; -import { createComputedDeps } from './createComputedDeps'; -import type { Deps } from './ObjectDeps'; +import { depsCollector } from './deps-collector'; +import { createComputedDeps } from './create-computed-deps'; +import type { Deps } from './object-deps'; export class ComputedValue { public deps: Deps[] = []; diff --git a/src/reactive/createComputedDeps.ts b/src/reactive/create-computed-deps.ts similarity index 77% rename from src/reactive/createComputedDeps.ts rename to src/reactive/create-computed-deps.ts index 6cf0f72..bcccd87 100644 --- a/src/reactive/createComputedDeps.ts +++ b/src/reactive/create-computed-deps.ts @@ -1,6 +1,6 @@ import { shallowEqual } from 'react-redux'; -import type { ComputedValue } from './ComputedValue'; -import type { Deps } from './ObjectDeps'; +import type { ComputedValue } from './computed-value'; +import type { Deps } from './object-deps'; export const createComputedDeps = (body: ComputedValue): Deps => { let snapshot: any; diff --git a/src/reactive/depsCollector.ts b/src/reactive/deps-collector.ts similarity index 94% rename from src/reactive/depsCollector.ts rename to src/reactive/deps-collector.ts index b8e07ea..ade4759 100644 --- a/src/reactive/depsCollector.ts +++ b/src/reactive/deps-collector.ts @@ -1,4 +1,4 @@ -import type { Deps } from './ObjectDeps'; +import type { Deps } from './object-deps'; const deps: Deps[][] = []; let level = -1; diff --git a/src/reactive/ObjectDeps.ts b/src/reactive/object-deps.ts similarity index 96% rename from src/reactive/ObjectDeps.ts rename to src/reactive/object-deps.ts index ddadabd..b2fc447 100644 --- a/src/reactive/ObjectDeps.ts +++ b/src/reactive/object-deps.ts @@ -1,6 +1,6 @@ import type { Store } from 'redux'; -import { isObject } from '../utils/isType'; -import { depsCollector } from './depsCollector'; +import { isObject } from '../utils/is-type'; +import { depsCollector } from './deps-collector'; export interface Deps { id: string; diff --git a/src/redux/connect.ts b/src/redux/connect.ts index ae14a6b..612f3bf 100644 --- a/src/redux/connect.ts +++ b/src/redux/connect.ts @@ -1,6 +1,6 @@ import { Connect, connect as originalConnect } from 'react-redux'; import { ProxyContext } from './contexts'; -import { toArgs } from '../utils/toArgs'; +import { toArgs } from '../utils/to-args'; export const connect: Connect = function () { const args = toArgs>(arguments); diff --git a/src/redux/createReducer.ts b/src/redux/create-reducer.ts similarity index 100% rename from src/redux/createReducer.ts rename to src/redux/create-reducer.ts diff --git a/src/redux/FocaProvider.tsx b/src/redux/foca-provider.tsx similarity index 77% rename from src/redux/FocaProvider.tsx rename to src/redux/foca-provider.tsx index 7b0712b..0e4ea32 100644 --- a/src/redux/FocaProvider.tsx +++ b/src/redux/foca-provider.tsx @@ -1,11 +1,11 @@ import { FC } from 'react'; import { Provider } from 'react-redux'; import { ProxyContext, ModelContext, LoadingContext } from './contexts'; -import { modelStore } from '../store/modelStore'; -import { PersistGate, PersistGateProps } from '../persist/PersistGate'; -import { proxyStore } from '../store/proxyStore'; -import { loadingStore } from '../store/loadingStore'; -import { isFunction } from '../utils/isType'; +import { modelStore } from '../store/model-store'; +import { PersistGate, PersistGateProps } from '../persist/persist-gate'; +import { proxyStore } from '../store/proxy-store'; +import { loadingStore } from '../store/loading-store'; +import { isFunction } from '../utils/is-type'; interface OwnProps extends PersistGateProps {} diff --git a/src/redux/useSelector.ts b/src/redux/use-selector.ts similarity index 100% rename from src/redux/useSelector.ts rename to src/redux/use-selector.ts diff --git a/src/store/loadingStore.ts b/src/store/loading-store.ts similarity index 93% rename from src/store/loadingStore.ts rename to src/store/loading-store.ts index 00f6dcb..6eafcf9 100644 --- a/src/store/loadingStore.ts +++ b/src/store/loading-store.ts @@ -4,17 +4,17 @@ import { legacy_createStore as createStore, Middleware, } from 'redux'; -import type { PromiseRoomEffect, PromiseEffect } from '../model/enhanceEffect'; -import { loadingInterceptor } from '../middleware/loadingInterceptor'; +import type { PromiseRoomEffect, PromiseEffect } from '../model/enhance-effect'; +import { loadingInterceptor } from '../middleware/loading.interceptor'; import { isDestroyLoadingAction, isLoadingAction } from '../actions/loading'; import { actionRefresh, isRefreshAction } from '../actions/refresh'; -import { combine } from './proxyStore'; -import { destroyLoadingInterceptor } from '../middleware/destroyLoadingInterceptor'; +import { combine } from './proxy-store'; +import { destroyLoadingInterceptor } from '../middleware/destroy-loading.interceptor'; import { immer } from '../utils/immer'; -import { StoreBasic } from './StoreBasic'; -import { modelStore } from './modelStore'; +import { StoreBasic } from './store-basic'; +import { modelStore } from './model-store'; import { freeze } from 'immer'; -import { freezeStateMiddleware } from '../middleware/freezeStateMiddleware'; +import { freezeStateMiddleware } from '../middleware/freeze-state.middleware'; export interface FindLoading { find(category: number | string): boolean; diff --git a/src/store/modelStore.ts b/src/store/model-store.ts similarity index 91% rename from src/store/modelStore.ts rename to src/store/model-store.ts index 3cb7712..3b6ca2d 100644 --- a/src/store/modelStore.ts +++ b/src/store/model-store.ts @@ -10,14 +10,14 @@ import { } from 'redux'; import { Topic } from 'topic'; import { actionRefresh, RefreshAction } from '../actions/refresh'; -import { modelInterceptor } from '../middleware/modelInterceptor'; -import type { PersistOptions } from '../persist/PersistItem'; -import { PersistManager } from '../persist/PersistManager'; -import { combine } from './proxyStore'; -import { OBJECT } from '../utils/isType'; -import { StoreBasic } from './StoreBasic'; -import { actionInActionInterceptor } from '../middleware/actionInActionInterceptor'; -import { freezeStateMiddleware } from '../middleware/freezeStateMiddleware'; +import { modelInterceptor } from '../middleware/model.interceptor'; +import type { PersistOptions } from '../persist/persist-item'; +import { PersistManager } from '../persist/persist-manager'; +import { combine } from './proxy-store'; +import { OBJECT } from '../utils/is-type'; +import { StoreBasic } from './store-basic'; +import { actionInActionInterceptor } from '../middleware/action-in-action.interceptor'; +import { freezeStateMiddleware } from '../middleware/freeze-state.middleware'; type Compose = | typeof compose diff --git a/src/store/proxyStore.ts b/src/store/proxy-store.ts similarity index 100% rename from src/store/proxyStore.ts rename to src/store/proxy-store.ts diff --git a/src/store/StoreBasic.ts b/src/store/store-basic.ts similarity index 93% rename from src/store/StoreBasic.ts rename to src/store/store-basic.ts index 193cfd5..f37bfe5 100644 --- a/src/store/StoreBasic.ts +++ b/src/store/store-basic.ts @@ -1,5 +1,5 @@ import { Store } from 'redux'; -import { $$observable } from '../utils/symbolObservable'; +import { $$observable } from '../utils/symbol-observable'; export abstract class StoreBasic implements Store { protected origin: Store | null = null; diff --git a/src/utils/deepEqual.ts b/src/utils/deep-equal.ts similarity index 96% rename from src/utils/deepEqual.ts rename to src/utils/deep-equal.ts index 54827bc..293c0e6 100644 --- a/src/utils/deepEqual.ts +++ b/src/utils/deep-equal.ts @@ -1,4 +1,4 @@ -import { OBJECT } from './isType'; +import { OBJECT } from './is-type'; export const deepEqual = (a: any, b: any): boolean => { if (a === b) return true; diff --git a/src/utils/getMethodCategory.ts b/src/utils/get-method-category.ts similarity index 100% rename from src/utils/getMethodCategory.ts rename to src/utils/get-method-category.ts diff --git a/src/utils/getter.ts b/src/utils/getter.ts index 516d5f9..a1cc361 100644 --- a/src/utils/getter.ts +++ b/src/utils/getter.ts @@ -1,4 +1,4 @@ -import { toArgs } from './toArgs'; +import { toArgs } from './to-args'; export function composeGetter< T extends object, diff --git a/src/utils/isPromise.ts b/src/utils/is-promise.ts similarity index 80% rename from src/utils/isPromise.ts rename to src/utils/is-promise.ts index 7840dcb..c0daf27 100644 --- a/src/utils/isPromise.ts +++ b/src/utils/is-promise.ts @@ -1,4 +1,4 @@ -import { FUNCTION, isFunction, isObject } from './isType'; +import { FUNCTION, isFunction, isObject } from './is-type'; const hasPromise = typeof Promise === FUNCTION; diff --git a/src/utils/isType.ts b/src/utils/is-type.ts similarity index 100% rename from src/utils/isType.ts rename to src/utils/is-type.ts diff --git a/src/utils/serialize.ts b/src/utils/serialize.ts index 0f9d3ec..b26e783 100644 --- a/src/utils/serialize.ts +++ b/src/utils/serialize.ts @@ -1,4 +1,4 @@ -import { isObject } from './isType'; +import { isObject } from './is-type'; const JSON_UNDEFINED = '__JSON_UNDEFINED__'; diff --git a/src/utils/symbolObservable.ts b/src/utils/symbol-observable.ts similarity index 89% rename from src/utils/symbolObservable.ts rename to src/utils/symbol-observable.ts index b9e5629..51fdde6 100644 --- a/src/utils/symbolObservable.ts +++ b/src/utils/symbol-observable.ts @@ -1,4 +1,4 @@ -import { FUNCTION } from './isType'; +import { FUNCTION } from './is-type'; /** * Inlined version of the `symbol-observable` polyfill diff --git a/src/utils/toArgs.ts b/src/utils/to-args.ts similarity index 100% rename from src/utils/toArgs.ts rename to src/utils/to-args.ts diff --git a/test/actionInAction.test.tsx b/test/action-in-action.test.tsx similarity index 100% rename from test/actionInAction.test.tsx rename to test/action-in-action.test.tsx diff --git a/test/clone.test.ts b/test/clone.test.ts index 1f0c5e9..f265bff 100644 --- a/test/clone.test.ts +++ b/test/clone.test.ts @@ -1,6 +1,6 @@ import { defineModel, cloneModel, store } from '../src'; import type { InternalModel } from '../src/model/types'; -import { basicModel } from './models/basicModel'; +import { basicModel } from './models/basic.model'; let modelIndex = 0; diff --git a/test/computed.test.ts b/test/computed.test.ts index 23627e7..dac7dfb 100644 --- a/test/computed.test.ts +++ b/test/computed.test.ts @@ -1,8 +1,8 @@ import { defineModel, store } from '../src'; -import { ComputedValue } from '../src/reactive/ComputedValue'; -import { depsCollector } from '../src/reactive/depsCollector'; -import { ObjectDeps } from '../src/reactive/ObjectDeps'; -import { computedModel } from './models/computedModel'; +import { ComputedValue } from '../src/reactive/computed-value'; +import { depsCollector } from '../src/reactive/deps-collector'; +import { ObjectDeps } from '../src/reactive/object-deps'; +import { computedModel } from './models/computed.model'; beforeEach(() => { store.init(); diff --git a/test/connect.test.tsx b/test/connect.test.tsx index ba3295a..388909d 100644 --- a/test/connect.test.tsx +++ b/test/connect.test.tsx @@ -1,8 +1,8 @@ import { FC } from 'react'; import { act, render, screen } from '@testing-library/react'; import { store, connect, FocaProvider, getLoading } from '../src'; -import { basicModel } from './models/basicModel'; -import { complexModel } from './models/complexModel'; +import { basicModel } from './models/basic.model'; +import { complexModel } from './models/complex.model'; let App: FC> = ({ count, loading }) => { return ( diff --git a/test/deepEqual.test.ts b/test/deep-equal.test.ts similarity index 76% rename from test/deepEqual.test.ts rename to test/deep-equal.test.ts index 1cf7556..a0dbe6b 100644 --- a/test/deepEqual.test.ts +++ b/test/deep-equal.test.ts @@ -1,6 +1,6 @@ -import { deepEqual } from '../src/utils/deepEqual'; +import { deepEqual } from '../src/utils/deep-equal'; import { equals } from './fixtures/equals'; -import { notEquals } from './fixtures/notEquals'; +import { notEquals } from './fixtures/not-equals'; Object.entries(equals).map(([title, { a, b }]) => { test(`[equal] ${title}`, () => { diff --git a/test/fixtures/notEquals.ts b/test/fixtures/not-equals.ts similarity index 100% rename from test/fixtures/notEquals.ts rename to test/fixtures/not-equals.ts diff --git a/test/getLoading.test.ts b/test/get-loading.test.ts similarity index 97% rename from test/getLoading.test.ts rename to test/get-loading.test.ts index 56bd4f3..b4b1885 100644 --- a/test/getLoading.test.ts +++ b/test/get-loading.test.ts @@ -1,6 +1,6 @@ import sleep from 'sleep-promise'; import { defineModel, getLoading, store } from '../src'; -import { basicModel } from './models/basicModel'; +import { basicModel } from './models/basic.model'; beforeEach(() => { store.init(); diff --git a/test/helpers/renderHook.tsx b/test/helpers/render-hook.tsx similarity index 100% rename from test/helpers/renderHook.tsx rename to test/helpers/render-hook.tsx diff --git a/test/helpers/slowEngine.ts b/test/helpers/slow-engine.ts similarity index 100% rename from test/helpers/slowEngine.ts rename to test/helpers/slow-engine.ts diff --git a/test/lifecycle.test.ts b/test/lifecycle.test.ts index d21d013..8f2ae02 100644 --- a/test/lifecycle.test.ts +++ b/test/lifecycle.test.ts @@ -1,6 +1,6 @@ import sleep from 'sleep-promise'; import { cloneModel, defineModel, memoryStorage, store } from '../src'; -import { PersistSchema } from '../src/persist/PersistItem'; +import { PersistSchema } from '../src/persist/persist-item'; describe('onInit', () => { afterEach(() => { diff --git a/test/middleware.test.ts b/test/middleware.test.ts index 8ff51e4..bc218bb 100644 --- a/test/middleware.test.ts +++ b/test/middleware.test.ts @@ -1,8 +1,8 @@ import { defineModel, getLoading, store } from '../src'; import { DestroyLoadingAction, DESTROY_LOADING } from '../src/actions/loading'; -import { loadingStore } from '../src/store/loadingStore'; -import { basicModel } from './models/basicModel'; -import { complexModel } from './models/complexModel'; +import { loadingStore } from '../src/store/loading-store'; +import { basicModel } from './models/basic.model'; +import { complexModel } from './models/complex.model'; beforeEach(() => { store.init(); diff --git a/test/model.test.ts b/test/model.test.ts index b7eba66..ae627a5 100644 --- a/test/model.test.ts +++ b/test/model.test.ts @@ -1,5 +1,5 @@ import { defineModel, store } from '../src'; -import { basicModel } from './models/basicModel'; +import { basicModel } from './models/basic.model'; beforeEach(() => { store.init(); diff --git a/test/models/basicModel.ts b/test/models/basic.model.ts similarity index 100% rename from test/models/basicModel.ts rename to test/models/basic.model.ts diff --git a/test/models/complexModel.ts b/test/models/complex.model.ts similarity index 100% rename from test/models/complexModel.ts rename to test/models/complex.model.ts diff --git a/test/models/computedModel.ts b/test/models/computed.model.ts similarity index 100% rename from test/models/computedModel.ts rename to test/models/computed.model.ts diff --git a/test/models/persistModel.ts b/test/models/persist.model.ts similarity index 100% rename from test/models/persistModel.ts rename to test/models/persist.model.ts diff --git a/test/persist.gate.test.tsx b/test/persist.gate.test.tsx index 9ee9352..29850ae 100644 --- a/test/persist.gate.test.tsx +++ b/test/persist.gate.test.tsx @@ -1,9 +1,9 @@ import { FC } from 'react'; import { act, render, screen } from '@testing-library/react'; import { FocaProvider, store } from '../src'; -import { PersistGateProps } from '../src/persist/PersistGate'; -import { basicModel } from './models/basicModel'; -import { slowEngine } from './helpers/slowEngine'; +import { PersistGateProps } from '../src/persist/persist-gate'; +import { basicModel } from './models/basic.model'; +import { slowEngine } from './helpers/slow-engine'; const Loading: FC = () =>

Yes
; diff --git a/test/persist.test.ts b/test/persist.test.ts index 9238e0b..516c927 100644 --- a/test/persist.test.ts +++ b/test/persist.test.ts @@ -10,15 +10,15 @@ import { PersistItem, PersistMergeMode, PersistSchema, -} from '../src/persist/PersistItem'; +} from '../src/persist/persist-item'; import { stringifyState } from '../src/utils/serialize'; -import { basicModel } from './models/basicModel'; +import { basicModel } from './models/basic.model'; import { hasFilterPersistModel, hasVersionPersistModel, persistModel, -} from './models/persistModel'; -import { slowEngine } from './helpers/slowEngine'; +} from './models/persist.model'; +import { slowEngine } from './helpers/slow-engine'; const stringifyTwice = (model: Model) => { return JSON.stringify(JSON.stringify(model.state)); diff --git a/test/store.test.ts b/test/store.test.ts index d64cce8..fb0acde 100644 --- a/test/store.test.ts +++ b/test/store.test.ts @@ -3,15 +3,15 @@ import sleep from 'sleep-promise'; import { from, map } from 'rxjs'; import { composeWithDevTools } from '@redux-devtools/extension'; import { defineModel, memoryStorage, store } from '../src'; -import { PersistSchema } from '../src/persist/PersistItem'; -import { PersistManager } from '../src/persist/PersistManager'; -import { basicModel, basicSkipRefreshModel } from './models/basicModel'; -import { complexModel } from './models/complexModel'; +import { PersistSchema } from '../src/persist/persist-item'; +import { PersistManager } from '../src/persist/persist-manager'; +import { basicModel, basicSkipRefreshModel } from './models/basic.model'; +import { complexModel } from './models/complex.model'; import { hasFilterPersistModel, hasVersionPersistModel, persistModel, -} from './models/persistModel'; +} from './models/persist.model'; afterEach(() => { store.unmount(); diff --git a/test/typescript/defineModel.check.ts b/test/typescript/define-model.check.ts similarity index 100% rename from test/typescript/defineModel.check.ts rename to test/typescript/define-model.check.ts diff --git a/test/typescript/getLoading.check.ts b/test/typescript/get-loading.check.ts similarity index 90% rename from test/typescript/getLoading.check.ts rename to test/typescript/get-loading.check.ts index c71713f..fcea92e 100644 --- a/test/typescript/getLoading.check.ts +++ b/test/typescript/get-loading.check.ts @@ -1,6 +1,6 @@ import { expectType } from 'ts-expect'; import { getLoading } from '../../src'; -import { basicModel } from '../models/basicModel'; +import { basicModel } from '../models/basic.model'; expectType(getLoading(basicModel.foo)); expectType(getLoading(basicModel.foo.room).find('xx')); diff --git a/test/typescript/use-isolate.check.ts b/test/typescript/use-isolate.check.ts index 4d216fd..ff71b69 100644 --- a/test/typescript/use-isolate.check.ts +++ b/test/typescript/use-isolate.check.ts @@ -1,6 +1,6 @@ import { TypeEqual, expectType } from 'ts-expect'; import { defineModel, useIsolate, useLoading, useModel } from '../../src'; -import { basicModel } from '../models/basicModel'; +import { basicModel } from '../models/basic.model'; const isolatedModel = useIsolate(basicModel); diff --git a/test/typescript/useLoading.check.ts b/test/typescript/use-loading.check.ts similarity index 94% rename from test/typescript/useLoading.check.ts rename to test/typescript/use-loading.check.ts index 0724920..a82604b 100644 --- a/test/typescript/useLoading.check.ts +++ b/test/typescript/use-loading.check.ts @@ -1,6 +1,6 @@ import { expectType } from 'ts-expect'; import { useLoading } from '../../src'; -import { basicModel } from '../models/basicModel'; +import { basicModel } from '../models/basic.model'; expectType(useLoading(basicModel.bar)); expectType(useLoading(basicModel.foo, basicModel.bar)); diff --git a/test/typescript/useModel.check.ts b/test/typescript/use-model.check.ts similarity index 84% rename from test/typescript/useModel.check.ts rename to test/typescript/use-model.check.ts index cbda9ae..ef07def 100644 --- a/test/typescript/useModel.check.ts +++ b/test/typescript/use-model.check.ts @@ -1,7 +1,7 @@ import { expectType } from 'ts-expect'; import { useModel } from '../../src'; -import { basicModel } from '../models/basicModel'; -import { complexModel } from '../models/complexModel'; +import { basicModel } from '../models/basic.model'; +import { complexModel } from '../models/complex.model'; const basic = useModel(basicModel); diff --git a/test/useComputed.test.ts b/test/use-computed.test.ts similarity index 90% rename from test/useComputed.test.ts rename to test/use-computed.test.ts index ee8e728..fa9b7c2 100644 --- a/test/useComputed.test.ts +++ b/test/use-computed.test.ts @@ -1,7 +1,7 @@ import { act } from '@testing-library/react'; -import { renderHook } from './helpers/renderHook'; +import { renderHook } from './helpers/render-hook'; import { store, useComputed } from '../src'; -import { computedModel } from './models/computedModel'; +import { computedModel } from './models/computed.model'; beforeEach(() => { store.init(); diff --git a/test/use-isolate.test.tsx b/test/use-isolate.test.tsx index 34e835c..7107543 100644 --- a/test/use-isolate.test.tsx +++ b/test/use-isolate.test.tsx @@ -10,9 +10,9 @@ import { Model, useModel, } from '../src'; -import { loadingStore } from '../src/store/loadingStore'; -import { renderHook } from './helpers/renderHook'; -import { basicModel } from './models/basicModel'; +import { loadingStore } from '../src/store/loading-store'; +import { renderHook } from './helpers/render-hook'; +import { basicModel } from './models/basic.model'; (['development', 'production'] as const).forEach((env) => { describe(`[${env} mode]`, () => { diff --git a/test/useLoading.test.ts b/test/use-loading.test.ts similarity index 95% rename from test/useLoading.test.ts rename to test/use-loading.test.ts index 9964e72..53dd11e 100644 --- a/test/useLoading.test.ts +++ b/test/use-loading.test.ts @@ -1,7 +1,7 @@ import { act } from '@testing-library/react'; -import { renderHook } from './helpers/renderHook'; +import { renderHook } from './helpers/render-hook'; import { store, useLoading } from '../src'; -import { basicModel } from './models/basicModel'; +import { basicModel } from './models/basic.model'; beforeEach(() => { store.init(); diff --git a/test/useModel.test.ts b/test/use-model.test.ts similarity index 97% rename from test/useModel.test.ts rename to test/use-model.test.ts index c8a141c..757b43a 100644 --- a/test/useModel.test.ts +++ b/test/use-model.test.ts @@ -1,8 +1,8 @@ import { act } from '@testing-library/react'; -import { renderHook } from './helpers/renderHook'; +import { renderHook } from './helpers/render-hook'; import { store, useModel } from '../src'; -import { basicModel, basicSkipRefreshModel } from './models/basicModel'; -import { complexModel } from './models/complexModel'; +import { basicModel, basicSkipRefreshModel } from './models/basic.model'; +import { complexModel } from './models/complex.model'; beforeEach(() => { store.init();