react-state-basis 0.3.1 → 0.3.3
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/chunk-I5ZFRXQP.mjs +18 -0
- package/dist/chunk-I5ZFRXQP.mjs.map +1 -0
- package/dist/index.d.mts +13 -97
- package/dist/index.d.ts +13 -97
- package/dist/index.js +173 -276
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +179 -242
- package/dist/index.mjs.map +1 -1
- package/dist/plugin.js +51 -29
- package/dist/production.d.mts +19 -16
- package/dist/production.d.ts +19 -16
- package/dist/production.js +25 -12
- package/dist/production.js.map +1 -1
- package/dist/production.mjs +20 -12
- package/dist/production.mjs.map +1 -1
- package/dist/vite-plugin.js +5 -15
- package/dist/vite-plugin.js.map +1 -1
- package/dist/vite-plugin.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-GEHMQPV4.mjs +0 -28
- package/dist/chunk-GEHMQPV4.mjs.map +0 -1
package/dist/production.mjs
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
// src/production.ts
|
|
1
|
+
// src/production-hooks.ts
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
|
|
3
|
+
var BasisProvider = ({ children }) => {
|
|
4
|
+
return React.createElement(React.Fragment, null, children);
|
|
5
|
+
};
|
|
4
6
|
var useState2 = (initialState, _label) => React.useState(initialState);
|
|
5
7
|
var useEffect2 = (effect, deps, _label) => React.useEffect(effect, deps);
|
|
6
8
|
var useMemo2 = (factory, deps, _label) => React.useMemo(factory, deps);
|
|
7
9
|
var useCallback2 = (callback, deps, _label) => React.useCallback(callback, deps);
|
|
8
|
-
var useReducer2 = (reducer,
|
|
10
|
+
var useReducer2 = (reducer, initArg, init, _label) => React.useReducer(reducer, initArg, init);
|
|
9
11
|
var useRef2 = (initialValue, _label) => React.useRef(initialValue);
|
|
10
12
|
var useLayoutEffect2 = (effect, deps, _label) => React.useLayoutEffect(effect, deps);
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
13
|
+
var useTransition2 = (_label) => React.useTransition();
|
|
14
|
+
var useDeferredValue2 = (value, _label) => React.useDeferredValue(value);
|
|
15
|
+
var useOptimistic2 = (passthrough, reducer, _label) => React.useOptimistic(passthrough, reducer);
|
|
16
|
+
var useActionState2 = (action, initialState, permalink, _label) => React.useActionState(action, initialState, permalink);
|
|
17
|
+
var useId2 = (_label) => React.useId();
|
|
14
18
|
var useDebugValue2 = React.useDebugValue;
|
|
15
19
|
var useImperativeHandle2 = React.useImperativeHandle;
|
|
16
20
|
var useInsertionEffect2 = React.useInsertionEffect;
|
|
17
21
|
var useSyncExternalStore2 = React.useSyncExternalStore;
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
22
|
+
var use2 = React.use;
|
|
23
|
+
var createContext2 = React.createContext;
|
|
24
|
+
var useContext2 = React.useContext;
|
|
25
|
+
|
|
26
|
+
// src/production.ts
|
|
21
27
|
var registerVariable = () => {
|
|
22
28
|
};
|
|
23
29
|
var unregisterVariable = () => {
|
|
@@ -29,19 +35,20 @@ var endEffectTracking = () => {
|
|
|
29
35
|
};
|
|
30
36
|
var printBasisHealthReport = () => {
|
|
31
37
|
};
|
|
32
|
-
var
|
|
33
|
-
return React.createElement(React.Fragment, null, children);
|
|
38
|
+
var configureBasis = () => {
|
|
34
39
|
};
|
|
35
40
|
export {
|
|
36
41
|
BasisProvider,
|
|
37
42
|
beginEffectTracking,
|
|
43
|
+
configureBasis,
|
|
38
44
|
createContext2 as createContext,
|
|
39
45
|
endEffectTracking,
|
|
40
46
|
printBasisHealthReport,
|
|
41
47
|
recordUpdate,
|
|
42
48
|
registerVariable,
|
|
43
49
|
unregisterVariable,
|
|
44
|
-
|
|
50
|
+
use2 as use,
|
|
51
|
+
useActionState2 as useActionState,
|
|
45
52
|
useCallback2 as useCallback,
|
|
46
53
|
useContext2 as useContext,
|
|
47
54
|
useDebugValue2 as useDebugValue,
|
|
@@ -52,6 +59,7 @@ export {
|
|
|
52
59
|
useInsertionEffect2 as useInsertionEffect,
|
|
53
60
|
useLayoutEffect2 as useLayoutEffect,
|
|
54
61
|
useMemo2 as useMemo,
|
|
62
|
+
useOptimistic2 as useOptimistic,
|
|
55
63
|
useReducer2 as useReducer,
|
|
56
64
|
useRef2 as useRef,
|
|
57
65
|
useState2 as useState,
|
package/dist/production.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/production.ts"],"sourcesContent":["// src/production.ts\n\nimport * as React from 'react';\nimport type {
|
|
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<{ children: ReactNode; debug?: boolean }> = ({ children }) => {\n return React.createElement(React.Fragment, null, children);\n};\n\nexport const useState = <T>(initialState: T | (() => T), _label?: string) => React.useState(initialState);\nexport const useEffect = (effect: EffectCallback, deps?: DependencyList, _label?: string) => React.useEffect(effect, deps as DependencyList);\nexport const useMemo = <T>(factory: () => T, deps?: DependencyList, _label?: string) => React.useMemo(factory, deps as DependencyList);\nexport const useCallback = <T extends (...args: any[]) => any>(callback: T, deps?: DependencyList, _label?: string) => React.useCallback(callback, deps as DependencyList);\nexport const useReducer = (reducer: any, initArg: any, init?: any, _label?: string) => React.useReducer(reducer, initArg, init);\nexport const useRef = <T>(initialValue: T, _label?: string) => React.useRef(initialValue);\nexport const useLayoutEffect = (effect: EffectCallback, deps?: DependencyList, _label?: string) => React.useLayoutEffect(effect, deps as DependencyList);\nexport const useTransition = (_label?: string) => React.useTransition();\nexport const useDeferredValue = <T>(value: T, _label?: string) => React.useDeferredValue(value);\nexport const useOptimistic = <S, P>(passthrough: S, reducer?: (state: S, payload: P) => S, _label?: string) => (React as any).useOptimistic(passthrough, reducer);\nexport const useActionState = <State, Payload>(action: (state: State, payload: Payload) => Promise<State> | State, initialState: State, permalink?: string, _label?: string) => (React as any).useActionState(action, initialState, permalink);\n\nexport const useId = (_label?: string) => React.useId();\nexport const useDebugValue = React.useDebugValue;\nexport const useImperativeHandle = React.useImperativeHandle;\nexport const useInsertionEffect = React.useInsertionEffect;\nexport const useSyncExternalStore = React.useSyncExternalStore;\nexport const use = (React as any).use;\nexport const createContext = React.createContext;\nexport const useContext = React.useContext;","// src/production.ts\n\nexport * from './production-hooks';\n\nexport const registerVariable = () => { };\nexport const unregisterVariable = () => { };\nexport const recordUpdate = () => true;\nexport const beginEffectTracking = () => { };\nexport const endEffectTracking = () => { };\nexport const printBasisHealthReport = () => { };\nexport const configureBasis = () => { };\n\nexport type { ReactNode, FC } from 'react';"],"mappings":";AAEA,YAAY,WAAW;AAGhB,IAAM,gBAA8D,CAAC,EAAE,SAAS,MAAM;AACzF,SAAa,oBAAoB,gBAAU,MAAM,QAAQ;AAC7D;AAEO,IAAMA,YAAW,CAAI,cAA6B,WAA0B,eAAS,YAAY;AACjG,IAAMC,aAAY,CAAC,QAAwB,MAAuB,WAA0B,gBAAU,QAAQ,IAAsB;AACpI,IAAMC,WAAU,CAAI,SAAkB,MAAuB,WAA0B,cAAQ,SAAS,IAAsB;AAC9H,IAAMC,eAAc,CAAoC,UAAa,MAAuB,WAA0B,kBAAY,UAAU,IAAsB;AAClK,IAAMC,cAAa,CAAC,SAAc,SAAc,MAAY,WAA0B,iBAAW,SAAS,SAAS,IAAI;AACvH,IAAMC,UAAS,CAAI,cAAiB,WAA0B,aAAO,YAAY;AACjF,IAAMC,mBAAkB,CAAC,QAAwB,MAAuB,WAA0B,sBAAgB,QAAQ,IAAsB;AAChJ,IAAMC,iBAAgB,CAAC,WAA0B,oBAAc;AAC/D,IAAMC,oBAAmB,CAAI,OAAU,WAA0B,uBAAiB,KAAK;AACvF,IAAMC,iBAAgB,CAAO,aAAgB,SAAuC,WAAmC,oBAAc,aAAa,OAAO;AACzJ,IAAMC,kBAAiB,CAAiB,QAAoE,cAAqB,WAAoB,WAAmC,qBAAe,QAAQ,cAAc,SAAS;AAEtO,IAAMC,SAAQ,CAAC,WAA0B,YAAM;AAC/C,IAAMC,iBAAsB;AAC5B,IAAMC,uBAA4B;AAClC,IAAMC,sBAA2B;AACjC,IAAMC,wBAA6B;AACnC,IAAMC,OAAqB;AAC3B,IAAMC,iBAAsB;AAC5B,IAAMC,cAAmB;;;ACxBzB,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;","names":["useState","useEffect","useMemo","useCallback","useReducer","useRef","useLayoutEffect","useTransition","useDeferredValue","useOptimistic","useActionState","useId","useDebugValue","useImperativeHandle","useInsertionEffect","useSyncExternalStore","use","createContext","useContext"]}
|
package/dist/vite-plugin.js
CHANGED
|
@@ -26,22 +26,12 @@ module.exports = __toCommonJS(vite_plugin_exports);
|
|
|
26
26
|
function basis() {
|
|
27
27
|
return {
|
|
28
28
|
name: "vite-plugin-react-state-basis",
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const isYalc = importer && importer.includes(".yalc");
|
|
34
|
-
if (isLibraryCore || isYalc) {
|
|
35
|
-
return null;
|
|
29
|
+
config() {
|
|
30
|
+
return {
|
|
31
|
+
optimizeDeps: {
|
|
32
|
+
exclude: ["react-state-basis"]
|
|
36
33
|
}
|
|
37
|
-
|
|
38
|
-
"react": "react-state-basis",
|
|
39
|
-
"react-dom": "react-state-basis",
|
|
40
|
-
"react-dom/client": "react-state-basis/client"
|
|
41
|
-
};
|
|
42
|
-
return this.resolve(mapping[source], importer, { skipSelf: true });
|
|
43
|
-
}
|
|
44
|
-
return null;
|
|
34
|
+
};
|
|
45
35
|
}
|
|
46
36
|
};
|
|
47
37
|
}
|
package/dist/vite-plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/vite-plugin.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/vite-plugin.ts"],"sourcesContent":["import type { Plugin } from 'vite';\nexport function basis(): Plugin {\n return {\n name: 'vite-plugin-react-state-basis',\n config() {\n return {\n optimizeDeps: {\n exclude: ['react-state-basis']\n }\n };\n }\n };\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,SAAS,QAAgB;AAC9B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AACP,aAAO;AAAA,QACL,cAAc;AAAA,UACZ,SAAS,CAAC,mBAAmB;AAAA,QAC/B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
package/dist/vite-plugin.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-state-basis",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "A linear algebra-powered React architectural tool that detects redundant state and synchronization anti-patterns by modeling state transitions as vectors in a basis.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
package/dist/chunk-GEHMQPV4.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// src/vite-plugin.ts
|
|
2
|
-
function basis() {
|
|
3
|
-
return {
|
|
4
|
-
name: "vite-plugin-react-state-basis",
|
|
5
|
-
enforce: "pre",
|
|
6
|
-
resolveId(source, importer) {
|
|
7
|
-
if (source === "react" || source === "react-dom" || source === "react-dom/client") {
|
|
8
|
-
const isLibraryCore = importer && ((importer.includes("react-state-basis/src") || importer.includes("react-state-basis/dist")) && !importer.includes("react-state-basis/example"));
|
|
9
|
-
const isYalc = importer && importer.includes(".yalc");
|
|
10
|
-
if (isLibraryCore || isYalc) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
const mapping = {
|
|
14
|
-
"react": "react-state-basis",
|
|
15
|
-
"react-dom": "react-state-basis",
|
|
16
|
-
"react-dom/client": "react-state-basis/client"
|
|
17
|
-
};
|
|
18
|
-
return this.resolve(mapping[source], importer, { skipSelf: true });
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export {
|
|
26
|
-
basis
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=chunk-GEHMQPV4.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/vite-plugin.ts"],"sourcesContent":["// src/vite-plugin.ts\n\nimport type { Plugin } from 'vite';\n\nexport function basis(): Plugin {\n return {\n name: 'vite-plugin-react-state-basis',\n enforce: 'pre',\n\n resolveId(source, importer) {\n if (source === 'react' || source === 'react-dom' || source === 'react-dom/client') {\n \n const isLibraryCore = importer && (\n (importer.includes('react-state-basis/src') || importer.includes('react-state-basis/dist')) &&\n !importer.includes('react-state-basis/example')\n );\n\n const isYalc = importer && importer.includes('.yalc');\n\n if (isLibraryCore || isYalc) {\n return null;\n }\n\n const mapping: Record<string, string> = {\n 'react': 'react-state-basis',\n 'react-dom': 'react-state-basis',\n 'react-dom/client': 'react-state-basis/client'\n };\n\n return this.resolve(mapping[source], importer, { skipSelf: true });\n }\n return null;\n }\n };\n}"],"mappings":";AAIO,SAAS,QAAgB;AAC9B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IAET,UAAU,QAAQ,UAAU;AAC1B,UAAI,WAAW,WAAW,WAAW,eAAe,WAAW,oBAAoB;AAEjF,cAAM,gBAAgB,cACnB,SAAS,SAAS,uBAAuB,KAAK,SAAS,SAAS,wBAAwB,MACzF,CAAC,SAAS,SAAS,2BAA2B;AAGhD,cAAM,SAAS,YAAY,SAAS,SAAS,OAAO;AAEpD,YAAI,iBAAiB,QAAQ;AAC3B,iBAAO;AAAA,QACT;AAEA,cAAM,UAAkC;AAAA,UACtC,SAAS;AAAA,UACT,aAAa;AAAA,UACb,oBAAoB;AAAA,QACtB;AAEA,eAAO,KAAK,QAAQ,QAAQ,MAAM,GAAG,UAAU,EAAE,UAAU,KAAK,CAAC;AAAA,MACnE;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|