@alchemy.run/node-utils 0.0.1 → 0.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.
- package/lib/ignore.d.ts +40 -0
- package/lib/ignore.d.ts.map +1 -0
- package/lib/ignore.js +591 -0
- package/lib/ignore.js.map +1 -0
- package/lib/index.d.ts +4 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -23
- package/lib/index.js.map +1 -1
- package/lib/lockfile-async.d.ts +9 -0
- package/lib/lockfile-async.d.ts.map +1 -0
- package/lib/lockfile-async.js +23 -0
- package/lib/lockfile-async.js.map +1 -0
- package/package.json +4 -1
- package/src/ignore.ts +815 -0
- package/src/index.ts +4 -46
- package/src/lockfile-async.ts +44 -0
package/src/index.ts
CHANGED
|
@@ -1,46 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
ReleaseFn,
|
|
6
|
-
UnlockOptions,
|
|
7
|
-
} from "./lockfile.ts";
|
|
8
|
-
import * as lockfile from "./lockfile.ts";
|
|
9
|
-
|
|
10
|
-
export type { CheckOptions, LockOptions, ReleaseFn, UnlockOptions };
|
|
11
|
-
|
|
12
|
-
export async function lock(
|
|
13
|
-
file: string,
|
|
14
|
-
options?: LockOptions,
|
|
15
|
-
): Promise<() => Promise<void>> {
|
|
16
|
-
const release = await toPromise<ReleaseFn>(lockfile.lock)(file, options);
|
|
17
|
-
|
|
18
|
-
return toPromise<void>(release);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function lockSync(file: string, options?: LockOptions): () => void {
|
|
22
|
-
const release = toSync<ReleaseFn>(lockfile.lock)(
|
|
23
|
-
file,
|
|
24
|
-
toSyncOptions(options),
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
return toSync<void>(release);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function unlock(file: string, options?: UnlockOptions): Promise<void> {
|
|
31
|
-
return toPromise<void>(lockfile.unlock)(file, options);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function unlockSync(file: string, options?: UnlockOptions): void {
|
|
35
|
-
return toSync<void>(lockfile.unlock)(file, toSyncOptions(options));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function check(file: string, options?: CheckOptions): Promise<boolean> {
|
|
39
|
-
return toPromise<boolean>(lockfile.check)(file, options);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function checkSync(file: string, options?: CheckOptions): boolean {
|
|
43
|
-
return toSync<boolean>(lockfile.check)(file, toSyncOptions(options));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default lock;
|
|
1
|
+
export * from "./exit-hook.ts";
|
|
2
|
+
export * from "./ignore.ts";
|
|
3
|
+
export * from "./lockfile-async.ts";
|
|
4
|
+
export * from "./retry.ts";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { toPromise, toSync, toSyncOptions } from "./adapter.ts";
|
|
2
|
+
import type {
|
|
3
|
+
CheckOptions,
|
|
4
|
+
LockOptions,
|
|
5
|
+
ReleaseFn,
|
|
6
|
+
UnlockOptions,
|
|
7
|
+
} from "./lockfile.ts";
|
|
8
|
+
import * as lockfile from "./lockfile.ts";
|
|
9
|
+
|
|
10
|
+
export type { CheckOptions, LockOptions, ReleaseFn, UnlockOptions };
|
|
11
|
+
|
|
12
|
+
export async function lock(
|
|
13
|
+
file: string,
|
|
14
|
+
options?: LockOptions,
|
|
15
|
+
): Promise<() => Promise<void>> {
|
|
16
|
+
const release = await toPromise<ReleaseFn>(lockfile.lock)(file, options);
|
|
17
|
+
|
|
18
|
+
return toPromise<void>(release);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function lockSync(file: string, options?: LockOptions): () => void {
|
|
22
|
+
const release = toSync<ReleaseFn>(lockfile.lock)(
|
|
23
|
+
file,
|
|
24
|
+
toSyncOptions(options),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return toSync<void>(release);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function unlock(file: string, options?: UnlockOptions): Promise<void> {
|
|
31
|
+
return toPromise<void>(lockfile.unlock)(file, options);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function unlockSync(file: string, options?: UnlockOptions): void {
|
|
35
|
+
return toSync<void>(lockfile.unlock)(file, toSyncOptions(options));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function check(file: string, options?: CheckOptions): Promise<boolean> {
|
|
39
|
+
return toPromise<boolean>(lockfile.check)(file, options);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function checkSync(file: string, options?: CheckOptions): boolean {
|
|
43
|
+
return toSync<boolean>(lockfile.check)(file, toSyncOptions(options));
|
|
44
|
+
}
|