@legit-sdk/react 0.2.10 → 0.2.12
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/LegitProvider.d.ts +22 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +62 -62
- package/dist/useLegitFile.d.ts +16 -0
- package/package.json +3 -8
- package/dist/server.d.ts +0 -40
- package/dist/server.js +0 -12
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type OpenLegitFsWithMemoryFs = (typeof import('@legit-sdk/core'))['openLegitFsWithMemoryFs'];
|
|
3
|
+
export interface LegitContextValue {
|
|
4
|
+
legitFs: Awaited<ReturnType<OpenLegitFsWithMemoryFs>> | null;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
head: string | null;
|
|
7
|
+
rollback: (commitHash: string) => Promise<void>;
|
|
8
|
+
error?: Error;
|
|
9
|
+
}
|
|
10
|
+
export declare const useLegitContext: () => LegitContextValue;
|
|
11
|
+
export interface LegitProviderProps {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
config?: LegitConfig;
|
|
14
|
+
}
|
|
15
|
+
export type LegitConfig = {
|
|
16
|
+
gitRoot: string;
|
|
17
|
+
initialBranch?: string;
|
|
18
|
+
serverUrl?: string;
|
|
19
|
+
publicKey?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const LegitProvider: ({ children, config, }: LegitProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as _legit_sdk_core from '@legit-sdk/core';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
|
-
import { openLegitFsWithMemoryFs, HistoryItem, openLegitFs } from '@legit-sdk/core';
|
|
4
4
|
|
|
5
|
+
type OpenLegitFsWithMemoryFs = (typeof _legit_sdk_core)['openLegitFsWithMemoryFs'];
|
|
5
6
|
interface LegitContextValue {
|
|
6
|
-
legitFs: Awaited<ReturnType<
|
|
7
|
+
legitFs: Awaited<ReturnType<OpenLegitFsWithMemoryFs>> | null;
|
|
7
8
|
loading: boolean;
|
|
8
9
|
head: string | null;
|
|
9
10
|
rollback: (commitHash: string) => Promise<void>;
|
|
@@ -22,6 +23,8 @@ type LegitConfig = {
|
|
|
22
23
|
};
|
|
23
24
|
declare const LegitProvider: ({ children, config, }: LegitProviderProps) => react_jsx_runtime.JSX.Element;
|
|
24
25
|
|
|
26
|
+
type HistoryItem = _legit_sdk_core.HistoryItem;
|
|
27
|
+
type OpenLegitFs = (typeof _legit_sdk_core)['openLegitFs'];
|
|
25
28
|
interface UseLegitFileOptions {
|
|
26
29
|
initialData?: string;
|
|
27
30
|
}
|
|
@@ -32,7 +35,7 @@ type UseLegitFileReturn = {
|
|
|
32
35
|
getPastState: (commitHash: string) => Promise<string>;
|
|
33
36
|
loading: boolean;
|
|
34
37
|
error?: Error;
|
|
35
|
-
legitFs: Awaited<ReturnType<
|
|
38
|
+
legitFs: Awaited<ReturnType<OpenLegitFs>> | null;
|
|
36
39
|
};
|
|
37
40
|
declare function useLegitFile(path: string, options?: UseLegitFileOptions): UseLegitFileReturn;
|
|
38
41
|
|