@octanejs/jotai 0.1.32 → 0.1.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/jotai",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -46,7 +46,7 @@
46
46
  "jotai": "^2.20.2"
47
47
  },
48
48
  "peerDependencies": {
49
- "octane": "0.1.35"
49
+ "octane": "0.1.37"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@tsrx/react": "^0.2.56",
@@ -54,7 +54,7 @@
54
54
  "react": "^19.2.7",
55
55
  "react-dom": "^19.2.7",
56
56
  "vitest": "^4.1.10",
57
- "octane": "0.1.35"
57
+ "octane": "0.1.37"
58
58
  },
59
59
  "scripts": {
60
60
  "test": "vitest run"
@@ -3,17 +3,17 @@
3
3
  // otherwise); the port keeps that laziness but renders through a SINGLE JSX
4
4
  // path instead of upstream's two createElement returns — the children
5
5
  // descriptor shape must stay stable across renders for octane's reconciler.
6
- import { useRef } from 'octane';
6
+ import { useRef, type OctaneNode } from 'octane';
7
7
  import { createStore } from 'jotai/vanilla';
8
- import { StoreContext } from './store.ts';
8
+ import { StoreContext, type Store } from './store.ts';
9
9
 
10
- export function Provider(props) @{
10
+ export function Provider(props: { children?: OctaneNode; store?: Store }) @{
11
11
  const { children, store } = props;
12
12
 
13
- const storeRef = useRef(null);
13
+ const storeRef = useRef<Store | null>(null);
14
14
  if (!store && storeRef.current === null) {
15
15
  storeRef.current = createStore();
16
16
  }
17
17
 
18
- <StoreContext.Provider value={store || storeRef.current}>{children}</StoreContext.Provider>
18
+ <StoreContext.Provider value={store || storeRef.current!}>{children}</StoreContext.Provider>
19
19
  }
@@ -20,6 +20,12 @@ import type { Atom, ExtractAtomValue } from 'jotai/vanilla';
20
20
  import { useStore, type Store } from './store';
21
21
  import { splitSlot, subSlot } from '../internal';
22
22
 
23
+ // The consumer's bundler substitutes the whole `process.env.NODE_ENV` expression
24
+ // below, so it must stay written out literally. Declared module-locally — never
25
+ // `declare global`, which would ship in the tarball — so this file type-checks in
26
+ // a browser app that has no `@types/node`.
27
+ declare const process: { env: { NODE_ENV?: string } };
28
+
23
29
  const isPromiseLike = (x: unknown): x is PromiseLike<unknown> =>
24
30
  typeof (x as PromiseLike<unknown>)?.then === 'function';
25
31
 
@@ -6,6 +6,12 @@ import type { ExtractAtomArgs, ExtractAtomResult, WritableAtom } from 'jotai/van
6
6
  import { useStore, type Store } from './store';
7
7
  import { splitSlot, subSlot } from '../internal';
8
8
 
9
+ // The consumer's bundler substitutes the whole `process.env.NODE_ENV` expression
10
+ // below, so it must stay written out literally. Declared module-locally — never
11
+ // `declare global`, which would ship in the tarball — so this file type-checks in
12
+ // a browser app that has no `@types/node`.
13
+ declare const process: { env: { NODE_ENV?: string } };
14
+
9
15
  type SetAtom<Args extends unknown[], Result> = (...args: Args) => Result;
10
16
  type Options = Parameters<typeof useStore>[0];
11
17
 
@@ -11,6 +11,12 @@ import { useSetAtom } from './useSetAtom';
11
11
  import { useAtom } from './useAtom';
12
12
  import { splitSlot, subSlot } from '../internal';
13
13
 
14
+ // The consumer's bundler substitutes the whole `process.env.NODE_ENV` expression
15
+ // below, so it must stay written out literally. Declared module-locally — never
16
+ // `declare global`, which would ship in the tarball — so this file type-checks in
17
+ // a browser app that has no `@types/node`.
18
+ declare const process: { env: { NODE_ENV?: string } };
19
+
14
20
  type SetAtomOptions = Parameters<typeof useSetAtom>[1];
15
21
 
16
22
  // useResetAtom — port of react/utils/useResetAtom.ts.