react-state-basis 0.4.2 → 0.5.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/README.md +73 -321
- package/dist/index.d.mts +31 -23
- package/dist/index.d.ts +31 -23
- package/dist/index.js +353 -327
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +355 -332
- package/dist/index.mjs.map +1 -1
- package/dist/plugin.js +48 -22
- package/dist/production.d.mts +15 -6
- package/dist/production.d.ts +15 -6
- package/dist/production.js +21 -6
- package/dist/production.js.map +1 -1
- package/dist/production.mjs +19 -6
- package/dist/production.mjs.map +1 -1
- package/package.json +1 -1
package/dist/production.mjs
CHANGED
|
@@ -4,24 +4,29 @@ var BasisProvider = ({ children }) => {
|
|
|
4
4
|
return React.createElement(React.Fragment, null, children);
|
|
5
5
|
};
|
|
6
6
|
var useState2 = (initialState, _label) => React.useState(initialState);
|
|
7
|
+
function useReducer2(reducer, initialArg, init, _label) {
|
|
8
|
+
return typeof init === "function" ? React.useReducer(reducer, initialArg, init) : React.useReducer(reducer, initialArg);
|
|
9
|
+
}
|
|
10
|
+
var createContext2 = (defaultValue, _label) => React.createContext(defaultValue);
|
|
11
|
+
var useContext2 = React.useContext;
|
|
7
12
|
var useEffect2 = (effect, deps, _label) => React.useEffect(effect, deps);
|
|
13
|
+
var useLayoutEffect2 = (effect, deps, _label) => React.useLayoutEffect(effect, deps);
|
|
14
|
+
var useInsertionEffect2 = React.useInsertionEffect;
|
|
8
15
|
var useMemo2 = (factory, deps, _label) => React.useMemo(factory, deps);
|
|
9
16
|
var useCallback2 = (callback, deps, _label) => React.useCallback(callback, deps);
|
|
10
|
-
var useReducer2 = (reducer, initArg, init, _label) => React.useReducer(reducer, initArg, init);
|
|
11
17
|
var useRef2 = (initialValue, _label) => React.useRef(initialValue);
|
|
12
|
-
var useLayoutEffect2 = (effect, deps, _label) => React.useLayoutEffect(effect, deps);
|
|
13
18
|
var useTransition2 = (_label) => React.useTransition();
|
|
14
19
|
var useDeferredValue2 = (value, _label) => React.useDeferredValue(value);
|
|
15
20
|
var useOptimistic2 = (passthrough, reducer, _label) => React.useOptimistic(passthrough, reducer);
|
|
16
|
-
var useActionState2 = (action, initialState, permalink, _label) =>
|
|
21
|
+
var useActionState2 = (action, initialState, permalink, _label) => {
|
|
22
|
+
const actualPermalink = typeof permalink === "string" && _label === void 0 ? void 0 : permalink;
|
|
23
|
+
return React.useActionState(action, initialState, actualPermalink);
|
|
24
|
+
};
|
|
17
25
|
var useId2 = (_label) => React.useId();
|
|
18
26
|
var useDebugValue2 = React.useDebugValue;
|
|
19
27
|
var useImperativeHandle2 = React.useImperativeHandle;
|
|
20
|
-
var useInsertionEffect2 = React.useInsertionEffect;
|
|
21
28
|
var useSyncExternalStore2 = React.useSyncExternalStore;
|
|
22
29
|
var use2 = React.use;
|
|
23
|
-
var createContext2 = React.createContext;
|
|
24
|
-
var useContext2 = React.useContext;
|
|
25
30
|
|
|
26
31
|
// src/production.ts
|
|
27
32
|
var registerVariable = () => {
|
|
@@ -37,12 +42,20 @@ var printBasisHealthReport = () => {
|
|
|
37
42
|
};
|
|
38
43
|
var configureBasis = () => {
|
|
39
44
|
};
|
|
45
|
+
var getBasisMetrics = () => ({
|
|
46
|
+
engine: "production",
|
|
47
|
+
hooks: 0,
|
|
48
|
+
analysis_ms: "0"
|
|
49
|
+
});
|
|
50
|
+
var config = { debug: false };
|
|
40
51
|
export {
|
|
41
52
|
BasisProvider,
|
|
42
53
|
beginEffectTracking,
|
|
54
|
+
config,
|
|
43
55
|
configureBasis,
|
|
44
56
|
createContext2 as createContext,
|
|
45
57
|
endEffectTracking,
|
|
58
|
+
getBasisMetrics,
|
|
46
59
|
printBasisHealthReport,
|
|
47
60
|
recordUpdate,
|
|
48
61
|
registerVariable,
|
package/dist/production.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/production-hooks.ts","../src/production.ts"],"sourcesContent":["// src/production-hooks.ts\n\nimport * as React from 'react';\nimport type { FC, ReactNode, DependencyList, EffectCallback } from 'react';\n\nexport const BasisProvider: FC<{
|
|
1
|
+
{"version":3,"sources":["../src/production-hooks.ts","../src/production.ts"],"sourcesContent":["// src/production-hooks.ts\n\nimport * as React from 'react';\nimport type { FC, ReactNode, DependencyList, EffectCallback } from 'react';\n\nexport const BasisProvider: FC<{\n children: ReactNode;\n debug?: boolean;\n showHUD?: boolean;\n}> = ({ children }) => {\n return React.createElement(React.Fragment, null, children);\n};\n\nexport const useState = <T>(initialState: T | (() => T), _label?: string) =>\n React.useState(initialState);\n\nexport function useReducer(reducer: any, initialArg: any, init?: any, _label?: string) {\n return typeof init === 'function'\n ? React.useReducer(reducer, initialArg, init)\n : React.useReducer(reducer, initialArg);\n}\n\nexport const createContext = <T>(defaultValue: T, _label?: string) =>\n React.createContext(defaultValue);\n\nexport const useContext = React.useContext;\n\nexport const useEffect = (effect: EffectCallback, deps?: DependencyList, _label?: string) =>\n React.useEffect(effect, deps as DependencyList);\n\nexport const useLayoutEffect = (effect: EffectCallback, deps?: DependencyList, _label?: string) =>\n React.useLayoutEffect(effect, deps as DependencyList);\n\nexport const useInsertionEffect = React.useInsertionEffect;\n\nexport const useMemo = <T>(factory: () => T, deps?: DependencyList, _label?: string) =>\n React.useMemo(factory, deps as DependencyList);\n\nexport const useCallback = <T extends (...args: any[]) => any>(callback: T, deps?: DependencyList, _label?: string) =>\n React.useCallback(callback, deps as DependencyList);\n\nexport const useRef = <T>(initialValue: T, _label?: string) =>\n React.useRef(initialValue);\n\nexport const useTransition = (_label?: string) => React.useTransition();\nexport const useDeferredValue = <T>(value: T, _label?: string) => React.useDeferredValue(value);\n\nexport const useOptimistic = <S, P>(passthrough: S, reducer?: (state: S, payload: P) => S, _label?: string) =>\n (React as any).useOptimistic(passthrough, reducer);\n\nexport const useActionState = <State, Payload>(\n action: (state: State, payload: Payload) => Promise<State> | State,\n initialState: State,\n permalink?: string,\n _label?: string\n) => {\n const actualPermalink = typeof permalink === 'string' && _label === undefined ? undefined : permalink;\n return (React as any).useActionState(action, initialState, actualPermalink);\n};\n\nexport const useId = (_label?: string) => React.useId();\nexport const useDebugValue = React.useDebugValue;\nexport const useImperativeHandle = React.useImperativeHandle;\nexport const useSyncExternalStore = React.useSyncExternalStore;\nexport const use = (React as any).use;","// src/production.ts\n\nexport * from './production-hooks';\n\n// No-op Kernel exports\nexport const registerVariable = () => { };\nexport const unregisterVariable = () => { };\nexport const recordUpdate = () => true;\nexport const beginEffectTracking = () => { };\nexport const endEffectTracking = () => { };\nexport const printBasisHealthReport = () => { };\nexport const configureBasis = () => { };\n\n// Static Mock for Metrics\nexport const getBasisMetrics = () => ({\n engine: 'production',\n hooks: 0,\n analysis_ms: '0'\n});\n\nexport const config = { debug: false };\n\nexport type { ReactNode, FC } from 'react';"],"mappings":";AAEA,YAAY,WAAW;AAGhB,IAAM,gBAIR,CAAC,EAAE,SAAS,MAAM;AACnB,SAAa,oBAAoB,gBAAU,MAAM,QAAQ;AAC7D;AAEO,IAAMA,YAAW,CAAI,cAA6B,WAC/C,eAAS,YAAY;AAExB,SAASC,YAAW,SAAc,YAAiB,MAAY,QAAiB;AACnF,SAAO,OAAO,SAAS,aACX,iBAAW,SAAS,YAAY,IAAI,IACpC,iBAAW,SAAS,UAAU;AAC9C;AAEO,IAAMC,iBAAgB,CAAI,cAAiB,WACxC,oBAAc,YAAY;AAE7B,IAAMC,cAAmB;AAEzB,IAAMC,aAAY,CAAC,QAAwB,MAAuB,WAC/D,gBAAU,QAAQ,IAAsB;AAE3C,IAAMC,mBAAkB,CAAC,QAAwB,MAAuB,WACrE,sBAAgB,QAAQ,IAAsB;AAEjD,IAAMC,sBAA2B;AAEjC,IAAMC,WAAU,CAAI,SAAkB,MAAuB,WAC1D,cAAQ,SAAS,IAAsB;AAE1C,IAAMC,eAAc,CAAoC,UAAa,MAAuB,WACzF,kBAAY,UAAU,IAAsB;AAE/C,IAAMC,UAAS,CAAI,cAAiB,WACjC,aAAO,YAAY;AAEtB,IAAMC,iBAAgB,CAAC,WAA0B,oBAAc;AAC/D,IAAMC,oBAAmB,CAAI,OAAU,WAA0B,uBAAiB,KAAK;AAEvF,IAAMC,iBAAgB,CAAO,aAAgB,SAAuC,WACxE,oBAAc,aAAa,OAAO;AAE9C,IAAMC,kBAAiB,CAC1B,QACA,cACA,WACA,WACC;AACD,QAAM,kBAAkB,OAAO,cAAc,YAAY,WAAW,SAAY,SAAY;AAC5F,SAAsB,qBAAe,QAAQ,cAAc,eAAe;AAC9E;AAEO,IAAMC,SAAQ,CAAC,WAA0B,YAAM;AAC/C,IAAMC,iBAAsB;AAC5B,IAAMC,uBAA4B;AAClC,IAAMC,wBAA6B;AACnC,IAAMC,OAAqB;;;AC3D3B,IAAM,mBAAmB,MAAM;AAAE;AACjC,IAAM,qBAAqB,MAAM;AAAE;AACnC,IAAM,eAAe,MAAM;AAC3B,IAAM,sBAAsB,MAAM;AAAE;AACpC,IAAM,oBAAoB,MAAM;AAAE;AAClC,IAAM,yBAAyB,MAAM;AAAE;AACvC,IAAM,iBAAiB,MAAM;AAAE;AAG/B,IAAM,kBAAkB,OAAO;AAAA,EAClC,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AACjB;AAEO,IAAM,SAAS,EAAE,OAAO,MAAM;","names":["useState","useReducer","createContext","useContext","useEffect","useLayoutEffect","useInsertionEffect","useMemo","useCallback","useRef","useTransition","useDeferredValue","useOptimistic","useActionState","useId","useDebugValue","useImperativeHandle","useSyncExternalStore","use"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-state-basis",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Runtime state profiler for React that detects redundant state, update chains, and infinite loops by tracking when state updates happen.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|