react-hooks-global-states 16.0.1 → 16.0.2

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.
Files changed (46) hide show
  1. package/GlobalStore.cjs +1 -0
  2. package/GlobalStore.d.ts +160 -0
  3. package/GlobalStore.debugProps.cjs +1 -0
  4. package/GlobalStore.debugProps.d.ts +5 -0
  5. package/GlobalStore.debugProps.js +1 -0
  6. package/GlobalStore.debugProps.mjs +1 -0
  7. package/GlobalStore.js +1 -0
  8. package/GlobalStore.mjs +1 -0
  9. package/actions.cjs +1 -0
  10. package/actions.d.ts +32 -0
  11. package/actions.js +1 -0
  12. package/actions.mjs +1 -0
  13. package/bundle.cjs +1 -0
  14. package/bundle.js +1 -0
  15. package/bundle.mjs +1 -0
  16. package/createContext.cjs +1 -0
  17. package/createContext.d.ts +15 -0
  18. package/createContext.js +1 -0
  19. package/createContext.mjs +1 -0
  20. package/createGlobalState.cjs +1 -0
  21. package/createGlobalState.d.ts +7 -0
  22. package/createGlobalState.js +1 -0
  23. package/createGlobalState.mjs +1 -0
  24. package/index.d.ts +9 -0
  25. package/isRecord.cjs +1 -0
  26. package/isRecord.d.ts +2 -0
  27. package/isRecord.js +1 -0
  28. package/isRecord.mjs +1 -0
  29. package/package.json +1 -51
  30. package/shallowCompare.cjs +1 -0
  31. package/shallowCompare.d.ts +52 -0
  32. package/shallowCompare.js +1 -0
  33. package/shallowCompare.mjs +1 -0
  34. package/throwWrongKeyOnActionCollectionConfig.cjs +12 -0
  35. package/throwWrongKeyOnActionCollectionConfig.d.ts +2 -0
  36. package/throwWrongKeyOnActionCollectionConfig.js +12 -0
  37. package/throwWrongKeyOnActionCollectionConfig.mjs +12 -0
  38. package/types.cjs +1 -0
  39. package/types.d.ts +1268 -0
  40. package/types.js +1 -0
  41. package/types.mjs +0 -0
  42. package/uniqueId.cjs +1 -0
  43. package/uniqueId.d.ts +7 -0
  44. package/uniqueId.js +1 -0
  45. package/uniqueId.mjs +1 -0
  46. package/jest.config.js +0 -50
package/types.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var d=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of i(t))!S.call(e,a)&&a!==r&&n(e,a,{get:()=>t[a],enumerable:!(o=s(t,a))||o.enumerable});return e};var l=e=>d(n({},"__esModule",{value:!0}),e);var c={};module.exports=l(c);
package/types.mjs ADDED
File without changes
package/uniqueId.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var c=(d,r)=>{for(var s in r)o(d,s,{get:r[s],enumerable:!0})},g=(d,r,s,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of B(r))!I.call(d,n)&&n!==s&&o(d,n,{get:()=>r[n],enumerable:!(e=i(r,n))||e.enumerable});return d};var T=d=>g(o({},"__esModule",{value:!0}),d);var y={};c(y,{default:()=>l,uniqueId:()=>u});module.exports=T(y);var u=(()=>{let d=0,r=()=>(d===Number.MAX_SAFE_INTEGER&&(d=0),d++),s=(n,a)=>{var t;return(t=globalThis.crypto)!=null&&t.randomUUID?(n!=null?n:"")+globalThis.crypto.randomUUID():(n!=null?n:"")+Date.now().toString(36)+a.toString(36)},e=n=>s(n,r());return e.for=n=>{let a=()=>s(n,r());return a.is=t=>typeof t=="string"&&t.startsWith(n),a.assert=function(t){if(!a.is(t))throw new Error(`The value "${String(t)}" does not match the expected prefix "${String(n)}"`)},a.strict=()=>a,a},e.of=()=>e.for(""),e.strict=()=>e,e})(),l=u;
package/uniqueId.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { UniqueId, BrandedId } from './types';
2
+ /**
3
+ * Generates a unique identifier string, optionally prefixed.
4
+ */
5
+ export declare const uniqueId: UniqueId;
6
+ export default uniqueId;
7
+ export type { UniqueId, BrandedId };
package/uniqueId.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var c=(d,r)=>{for(var s in r)o(d,s,{get:r[s],enumerable:!0})},g=(d,r,s,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of B(r))!I.call(d,n)&&n!==s&&o(d,n,{get:()=>r[n],enumerable:!(e=i(r,n))||e.enumerable});return d};var T=d=>g(o({},"__esModule",{value:!0}),d);var y={};c(y,{default:()=>l,uniqueId:()=>u});module.exports=T(y);var u=(()=>{let d=0,r=()=>(d===Number.MAX_SAFE_INTEGER&&(d=0),d++),s=(n,a)=>{var t;return(t=globalThis.crypto)!=null&&t.randomUUID?(n!=null?n:"")+globalThis.crypto.randomUUID():(n!=null?n:"")+Date.now().toString(36)+a.toString(36)},e=n=>s(n,r());return e.for=n=>{let a=()=>s(n,r());return a.is=t=>typeof t=="string"&&t.startsWith(n),a.assert=function(t){if(!a.is(t))throw new Error(`The value "${String(t)}" does not match the expected prefix "${String(n)}"`)},a.strict=()=>a,a},e.of=()=>e.for(""),e.strict=()=>e,e})(),l=u;
package/uniqueId.mjs ADDED
@@ -0,0 +1 @@
1
+ var o=(()=>{let t=0,a=()=>(t===Number.MAX_SAFE_INTEGER&&(t=0),t++),s=(n,d)=>{var r;return(r=globalThis.crypto)!=null&&r.randomUUID?(n!=null?n:"")+globalThis.crypto.randomUUID():(n!=null?n:"")+Date.now().toString(36)+d.toString(36)},e=n=>s(n,a());return e.for=n=>{let d=()=>s(n,a());return d.is=r=>typeof r=="string"&&r.startsWith(n),d.assert=function(r){if(!d.is(r))throw new Error(`The value "${String(r)}" does not match the expected prefix "${String(n)}"`)},d.strict=()=>d,d},e.of=()=>e.for(""),e.strict=()=>e,e})(),u=o;export{u as default,o as uniqueId};
package/jest.config.js DELETED
@@ -1,50 +0,0 @@
1
- // @ts-check
2
-
3
- /**
4
- * Tests run against the COMPILED output in `dist/` by default, so we exercise the
5
- * exact artifact that gets published (minification, dual ESM/CJS emit, `__esModule`
6
- * interop shape, etc.) instead of the raw TypeScript source.
7
- *
8
- * Toggle to the source with: TEST_TARGET=src yarn jest
9
- * (useful for quick iteration/coverage against `src`, and for debugging with
10
- * original identifiers).
11
- *
12
- * How it works: test files import from the `@react-hooks-global-states` alias (barrel)
13
- * or `@react-hooks-global-states/<name>` (subpath). At RUNTIME, `moduleNameMapper`
14
- * points that alias at `src` or `dist`. For type-checking, tsconfig `paths` always
15
- * points the alias at `src`, so we get source-level type safety while executing
16
- * whichever build we selected.
17
- */
18
- const target = process.env.TEST_TARGET === 'src' ? 'src' : 'dist';
19
-
20
- /** @type {import('jest').Config} */
21
- const config = {
22
- testEnvironment: 'jsdom',
23
- collectCoverageFrom: ['./src/*.ts', './__tests__/*.tsx', './__tests__/*.ts'],
24
- coverageDirectory: './coverage',
25
- coverageReporters: ['text', 'html'],
26
- setupFilesAfterEnv: ['./jestSetup.ts'],
27
- // Keep `dist/` out of test discovery and Jest's haste map (otherwise `dist/package.json`
28
- // collides with the root one). Modules under `dist/` are still reachable because
29
- // `moduleNameMapper` resolves the alias to explicit files, not via haste/discovery.
30
- testPathIgnorePatterns: ['/node_modules/', '<rootDir>/dist/'],
31
- modulePathIgnorePatterns: ['<rootDir>/dist/package.json'],
32
- haste: {
33
- // Don't index `dist/` for haste; avoids the duplicate-name warning.
34
- retainAllFiles: false,
35
- },
36
- transform: {
37
- // Use the test tsconfig so ts-jest resolves the `@react-hooks-global-states` alias
38
- // (`paths`) during type-checking, matching what the editor / `ts-check:tests` use.
39
- '^.+\\.tsx?$': ['ts-jest', { tsconfig: '<rootDir>/__test__/tsconfig.json' }],
40
- },
41
- moduleNameMapper: {
42
- // Order matters: match the subpath form before the bare barrel.
43
- // The barrel points at the package entry file directly (dist has no index.js).
44
- '^@react-hooks-global-states$':
45
- target === 'dist' ? '<rootDir>/dist/bundle.cjs' : '<rootDir>/src/index.ts',
46
- '^@react-hooks-global-states/(.*)$': `<rootDir>/${target}/$1`,
47
- },
48
- };
49
-
50
- module.exports = config;