pythonlib 1.0.2 → 2.0.1
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/README.md +123 -49
- package/dist/base64-C_am75Sv.d.ts +165 -0
- package/dist/base64.d.ts +1 -0
- package/dist/base64.js +37 -0
- package/dist/chunk-2QEMKE7U.js +252 -0
- package/dist/chunk-2YTO24B5.js +78 -0
- package/dist/chunk-3HQSBCEC.js +348 -0
- package/dist/{chunk-7BZB2TQF.js → chunk-3M3PB4RO.js} +4 -6
- package/dist/chunk-5OKGPZBQ.js +1106 -0
- package/dist/chunk-B5LQJODJ.js +37 -0
- package/dist/{chunk-CUP6EPDB.js → chunk-BCMGGBWG.js} +2 -5
- package/dist/chunk-BCVIH2BN.js +175 -0
- package/dist/chunk-CANUXHVB.js +349 -0
- package/dist/{chunk-QURVRHY2.js → chunk-D35YI363.js} +15 -12
- package/dist/{chunk-RSBRI27Z.js → chunk-ETBW6XNR.js} +3 -4
- package/dist/chunk-HSTC277I.js +255 -0
- package/dist/chunk-HTCQ4OO5.js +238 -0
- package/dist/chunk-IANXD4D4.js +250 -0
- package/dist/{chunk-G6PUQTVZ.js → chunk-JAUU3HMH.js} +1 -2
- package/dist/chunk-JVTQM7CI.js +195 -0
- package/dist/chunk-KKJHGY4C.js +551 -0
- package/dist/chunk-LHPQS75Z.js +192 -0
- package/dist/{chunk-OSX7QZAW.js → chunk-LK2L2TFG.js} +5 -6
- package/dist/{chunk-CEZSBJJV.js → chunk-LWYBTWBZ.js} +2 -3
- package/dist/chunk-MEEU4SH5.js +362 -0
- package/dist/{chunk-TAYRRHJ3.js → chunk-MFKIEN7N.js} +1 -2
- package/dist/{chunk-PZ5AY32C.js → chunk-MLKGABMK.js} +0 -1
- package/dist/chunk-OZRS5PC4.js +312 -0
- package/dist/chunk-PVK4F3ME.js +194 -0
- package/dist/{chunk-56DGFWIJ.js → chunk-QKJBQKPY.js} +1 -2
- package/dist/chunk-RB6BYCIQ.js +141 -0
- package/dist/chunk-RRSOZXZE.js +155 -0
- package/dist/chunk-THMJVAK6.js +282 -0
- package/dist/chunk-UGZ5OY5Z.js +165 -0
- package/dist/chunk-WTZSAITC.js +82 -0
- package/dist/chunk-YONWJHJU.js +265 -0
- package/dist/collections.js +2 -3
- package/dist/copy-6ZaZ__ge.d.ts +59 -0
- package/dist/copy.d.ts +1 -0
- package/dist/copy.js +9 -0
- package/dist/datetime.js +2 -3
- package/dist/functools.js +2 -3
- package/dist/glob.browser-B6d_YdV5.d.ts +50 -0
- package/dist/glob.browser.d.ts +1 -0
- package/dist/glob.browser.js +15 -0
- package/dist/glob.node-wn5ehtyM.d.ts +80 -0
- package/dist/glob.node.d.ts +1 -0
- package/dist/glob.node.js +15 -0
- package/dist/hashlib-vKP511NY.d.ts +205 -0
- package/dist/hashlib.d.ts +1 -0
- package/dist/hashlib.js +39 -0
- package/dist/index.browser.d.ts +172 -0
- package/dist/index.browser.js +305 -0
- package/dist/index.d.ts +36 -602
- package/dist/index.js +138 -1073
- package/dist/itertools.js +2 -3
- package/dist/json.js +2 -3
- package/dist/logging.browser-Dux4L5kz.d.ts +185 -0
- package/dist/logging.browser.d.ts +1 -0
- package/dist/logging.browser.js +63 -0
- package/dist/logging.node-CH75bVdE.d.ts +185 -0
- package/dist/logging.node.d.ts +1 -0
- package/dist/logging.node.js +61 -0
- package/dist/math.js +2 -3
- package/dist/{os-CqGKe872.d.ts → os.browser-krjSx5kF.d.ts} +32 -55
- package/dist/os.browser.d.ts +2 -0
- package/dist/{os.js → os.browser.js} +41 -16
- package/dist/os.node-CQjch8Ht.d.ts +124 -0
- package/dist/os.node.d.ts +2 -0
- package/dist/os.node.js +83 -0
- package/dist/os.shared-C3x70nhO.d.ts +59 -0
- package/dist/pathlib.browser-NC7kKQYe.d.ts +91 -0
- package/dist/pathlib.browser.d.ts +1 -0
- package/dist/pathlib.browser.js +17 -0
- package/dist/pathlib.node-CY3yUFdT.d.ts +331 -0
- package/dist/pathlib.node.d.ts +2 -0
- package/dist/pathlib.node.js +17 -0
- package/dist/random.js +2 -3
- package/dist/re.js +2 -3
- package/dist/set-JQbLAq8B.d.ts +592 -0
- package/dist/shutil.browser-Ck5oWhnP.d.ts +113 -0
- package/dist/shutil.browser.d.ts +1 -0
- package/dist/shutil.browser.js +33 -0
- package/dist/shutil.node-C9kwvhAf.d.ts +160 -0
- package/dist/shutil.node.d.ts +2 -0
- package/dist/shutil.node.js +33 -0
- package/dist/string.js +2 -3
- package/dist/subprocess-CZVYzQ3V.d.ts +214 -0
- package/dist/subprocess.d.ts +1 -0
- package/dist/subprocess.js +29 -0
- package/dist/sys-IL8LgI_W.d.ts +212 -0
- package/dist/sys.d.ts +1 -0
- package/dist/sys.js +51 -0
- package/dist/tempfile.browser-DciOKfNm.d.ts +78 -0
- package/dist/tempfile.browser.d.ts +1 -0
- package/dist/tempfile.browser.js +19 -0
- package/dist/tempfile.node-bVMY60Cu.d.ts +195 -0
- package/dist/tempfile.node.d.ts +2 -0
- package/dist/tempfile.node.js +23 -0
- package/dist/time-CcYhdiSu.d.ts +245 -0
- package/dist/time.d.ts +1 -0
- package/dist/time.js +49 -0
- package/dist/urllib-DJtkj-0f.d.ts +198 -0
- package/dist/urllib.d.ts +1 -0
- package/dist/urllib.js +37 -0
- package/dist/uuid-C0ypmn56.d.ts +160 -0
- package/dist/uuid.d.ts +1 -0
- package/dist/uuid.js +23 -0
- package/package.json +128 -5
- package/dist/chunk-56DGFWIJ.js.map +0 -1
- package/dist/chunk-5AOJFFYN.js +0 -313
- package/dist/chunk-5AOJFFYN.js.map +0 -1
- package/dist/chunk-7BZB2TQF.js.map +0 -1
- package/dist/chunk-CEZSBJJV.js.map +0 -1
- package/dist/chunk-CUP6EPDB.js.map +0 -1
- package/dist/chunk-G6PUQTVZ.js.map +0 -1
- package/dist/chunk-OSX7QZAW.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js.map +0 -1
- package/dist/chunk-QURVRHY2.js.map +0 -1
- package/dist/chunk-RSBRI27Z.js.map +0 -1
- package/dist/chunk-TAYRRHJ3.js.map +0 -1
- package/dist/collections.js.map +0 -1
- package/dist/datetime.js.map +0 -1
- package/dist/functools.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/itertools.js.map +0 -1
- package/dist/json.js.map +0 -1
- package/dist/math.js.map +0 -1
- package/dist/os.d.ts +0 -1
- package/dist/os.js.map +0 -1
- package/dist/random.js.map +0 -1
- package/dist/re.js.map +0 -1
- package/dist/string.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { c as copy, a as copy2, g as copyFile, h as copyFileObj, e as copyMode, f as copyStat, b as copytree, d as diskUsage, i as getTerminalSize, j as makeArchive, m as move, r as rmtree, u as unpackArchive, w as which } from './shutil.browser-Ck5oWhnP.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
copy,
|
|
3
|
+
copy2,
|
|
4
|
+
copyFile,
|
|
5
|
+
copyFileObj,
|
|
6
|
+
copyMode,
|
|
7
|
+
copyStat,
|
|
8
|
+
copytree,
|
|
9
|
+
diskUsage,
|
|
10
|
+
getTerminalSize,
|
|
11
|
+
makeArchive,
|
|
12
|
+
move,
|
|
13
|
+
rmtree,
|
|
14
|
+
unpackArchive,
|
|
15
|
+
which
|
|
16
|
+
} from "./chunk-WTZSAITC.js";
|
|
17
|
+
import "./chunk-MLKGABMK.js";
|
|
18
|
+
export {
|
|
19
|
+
copy,
|
|
20
|
+
copy2,
|
|
21
|
+
copyFile,
|
|
22
|
+
copyFileObj,
|
|
23
|
+
copyMode,
|
|
24
|
+
copyStat,
|
|
25
|
+
copytree,
|
|
26
|
+
diskUsage,
|
|
27
|
+
getTerminalSize,
|
|
28
|
+
makeArchive,
|
|
29
|
+
move,
|
|
30
|
+
rmtree,
|
|
31
|
+
unpackArchive,
|
|
32
|
+
which
|
|
33
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { ReadStream, WriteStream } from 'node:fs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Python shutil module for TypeScript
|
|
5
|
+
*
|
|
6
|
+
* Provides high-level file operations with async API.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://docs.python.org/3/library/shutil.html | Python shutil documentation}
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Copy the file src to the file or directory dst.
|
|
14
|
+
*
|
|
15
|
+
* @param src - Source file path
|
|
16
|
+
* @param dst - Destination file or directory path
|
|
17
|
+
* @returns The path to the newly created file
|
|
18
|
+
*/
|
|
19
|
+
declare function copy(src: string, dst: string): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Copy the file src to the file or directory dst, preserving metadata.
|
|
22
|
+
*
|
|
23
|
+
* @param src - Source file path
|
|
24
|
+
* @param dst - Destination file or directory path
|
|
25
|
+
* @returns The path to the newly created file
|
|
26
|
+
*/
|
|
27
|
+
declare function copy2(src: string, dst: string): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Recursively copy an entire directory tree.
|
|
30
|
+
*
|
|
31
|
+
* @param src - Source directory path
|
|
32
|
+
* @param dst - Destination directory path
|
|
33
|
+
* @param options - Options object
|
|
34
|
+
* @returns The destination directory path
|
|
35
|
+
*/
|
|
36
|
+
declare function copytree(src: string, dst: string, options?: {
|
|
37
|
+
symlinkss?: boolean;
|
|
38
|
+
ignore?: (dir: string, names: string[]) => string[];
|
|
39
|
+
copyFunction?: (src: string, dst: string) => Promise<void>;
|
|
40
|
+
dirsExistOk?: boolean;
|
|
41
|
+
}): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Recursively move a file or directory to another location.
|
|
44
|
+
*
|
|
45
|
+
* @param src - Source path
|
|
46
|
+
* @param dst - Destination path
|
|
47
|
+
* @returns The destination path
|
|
48
|
+
*/
|
|
49
|
+
declare function move(src: string, dst: string): Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Recursively delete a directory tree.
|
|
52
|
+
*
|
|
53
|
+
* @param path - Directory path to delete
|
|
54
|
+
* @param options - Options object
|
|
55
|
+
*/
|
|
56
|
+
declare function rmtree(path: string, options?: {
|
|
57
|
+
ignoreErrors?: boolean;
|
|
58
|
+
}): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Return the path to an executable which would be run if the given cmd was called.
|
|
61
|
+
*
|
|
62
|
+
* @param cmd - Command name to find
|
|
63
|
+
* @param path - Optional PATH string to search (defaults to process.env.PATH)
|
|
64
|
+
* @returns Path to the executable, or null if not found
|
|
65
|
+
*/
|
|
66
|
+
declare function which(cmd: string, path?: string): Promise<string | null>;
|
|
67
|
+
/**
|
|
68
|
+
* Disk usage statistics.
|
|
69
|
+
*/
|
|
70
|
+
interface DiskUsage {
|
|
71
|
+
total: number;
|
|
72
|
+
used: number;
|
|
73
|
+
free: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Return disk usage statistics for the given path.
|
|
77
|
+
*
|
|
78
|
+
* @param path - Path to check
|
|
79
|
+
* @returns Object with total, used, and free bytes
|
|
80
|
+
*/
|
|
81
|
+
declare function diskUsage(path: string): Promise<DiskUsage>;
|
|
82
|
+
/**
|
|
83
|
+
* Return the size of the terminal window.
|
|
84
|
+
*
|
|
85
|
+
* @returns Object with columns and lines
|
|
86
|
+
*/
|
|
87
|
+
declare function getTerminalSize(): {
|
|
88
|
+
columns: number;
|
|
89
|
+
lines: number;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Copy file mode bits from src to dst.
|
|
93
|
+
*
|
|
94
|
+
* @param src - Source path
|
|
95
|
+
* @param dst - Destination path
|
|
96
|
+
*/
|
|
97
|
+
declare function copymode(src: string, dst: string): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Copy all stat info (mode bits, atime, mtime, flags) from src to dst.
|
|
100
|
+
*
|
|
101
|
+
* @param src - Source path
|
|
102
|
+
* @param dst - Destination path
|
|
103
|
+
*/
|
|
104
|
+
declare function copystat(src: string, dst: string): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Copy a file's content (but not metadata) to another file.
|
|
107
|
+
*
|
|
108
|
+
* @param src - Source file path
|
|
109
|
+
* @param dst - Destination file path
|
|
110
|
+
*/
|
|
111
|
+
declare function copyfile(src: string, dst: string): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Copy data from a file-like object to another file-like object.
|
|
114
|
+
*
|
|
115
|
+
* @param fsrc - Source readable stream
|
|
116
|
+
* @param fdst - Destination writable stream
|
|
117
|
+
* @param length - Number of bytes to copy (optional, copies all if not specified)
|
|
118
|
+
*/
|
|
119
|
+
declare function copyfileobj(fsrc: ReadStream | NodeJS.ReadableStream, fdst: WriteStream | NodeJS.WritableStream, length?: number): void;
|
|
120
|
+
/**
|
|
121
|
+
* Create an archive file from a directory.
|
|
122
|
+
*
|
|
123
|
+
* Not implemented - requires external tools (tar, zip).
|
|
124
|
+
*
|
|
125
|
+
* @param baseName - Name of the archive file (without extension)
|
|
126
|
+
* @param format - Archive format ('zip', 'tar', 'gztar', 'bztar', 'xztar')
|
|
127
|
+
* @param rootDir - Directory to archive
|
|
128
|
+
* @returns Path to the created archive
|
|
129
|
+
*/
|
|
130
|
+
declare function makeArchive(_baseName: string, _format: string, _rootDir: string): string;
|
|
131
|
+
/**
|
|
132
|
+
* Unpack an archive file.
|
|
133
|
+
*
|
|
134
|
+
* Not implemented - requires external tools (tar, unzip).
|
|
135
|
+
*
|
|
136
|
+
* @param filename - Path to the archive
|
|
137
|
+
* @param extractDir - Directory to extract to (optional)
|
|
138
|
+
*/
|
|
139
|
+
declare function unpackArchive(_filename: string, _extractDir?: string): void;
|
|
140
|
+
|
|
141
|
+
type shutilModule_DiskUsage = DiskUsage;
|
|
142
|
+
declare const shutilModule_copy: typeof copy;
|
|
143
|
+
declare const shutilModule_copy2: typeof copy2;
|
|
144
|
+
declare const shutilModule_copyfile: typeof copyfile;
|
|
145
|
+
declare const shutilModule_copyfileobj: typeof copyfileobj;
|
|
146
|
+
declare const shutilModule_copymode: typeof copymode;
|
|
147
|
+
declare const shutilModule_copystat: typeof copystat;
|
|
148
|
+
declare const shutilModule_copytree: typeof copytree;
|
|
149
|
+
declare const shutilModule_diskUsage: typeof diskUsage;
|
|
150
|
+
declare const shutilModule_getTerminalSize: typeof getTerminalSize;
|
|
151
|
+
declare const shutilModule_makeArchive: typeof makeArchive;
|
|
152
|
+
declare const shutilModule_move: typeof move;
|
|
153
|
+
declare const shutilModule_rmtree: typeof rmtree;
|
|
154
|
+
declare const shutilModule_unpackArchive: typeof unpackArchive;
|
|
155
|
+
declare const shutilModule_which: typeof which;
|
|
156
|
+
declare namespace shutilModule {
|
|
157
|
+
export { type shutilModule_DiskUsage as DiskUsage, shutilModule_copy as copy, shutilModule_copy2 as copy2, shutilModule_copyfile as copyfile, shutilModule_copyfileobj as copyfileobj, shutilModule_copymode as copymode, shutilModule_copystat as copystat, shutilModule_copytree as copytree, shutilModule_diskUsage as diskUsage, shutilModule_getTerminalSize as getTerminalSize, shutilModule_makeArchive as makeArchive, shutilModule_move as move, shutilModule_rmtree as rmtree, shutilModule_unpackArchive as unpackArchive, shutilModule_which as which };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export { type DiskUsage as D, copy2 as a, copytree as b, copy as c, diskUsage as d, copymode as e, copystat as f, getTerminalSize as g, copyfile as h, copyfileobj as i, makeArchive as j, move as m, rmtree as r, shutilModule as s, unpackArchive as u, which as w };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import 'node:fs';
|
|
2
|
+
export { D as DiskUsage, c as copy, a as copy2, h as copyfile, i as copyfileobj, e as copymode, f as copystat, b as copytree, d as diskUsage, g as getTerminalSize, j as makeArchive, m as move, r as rmtree, u as unpackArchive, w as which } from './shutil.node-C9kwvhAf.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
copy,
|
|
3
|
+
copy2,
|
|
4
|
+
copyfile,
|
|
5
|
+
copyfileobj,
|
|
6
|
+
copymode,
|
|
7
|
+
copystat,
|
|
8
|
+
copytree,
|
|
9
|
+
diskUsage,
|
|
10
|
+
getTerminalSize,
|
|
11
|
+
makeArchive,
|
|
12
|
+
move,
|
|
13
|
+
rmtree,
|
|
14
|
+
unpackArchive,
|
|
15
|
+
which
|
|
16
|
+
} from "./chunk-JVTQM7CI.js";
|
|
17
|
+
import "./chunk-MLKGABMK.js";
|
|
18
|
+
export {
|
|
19
|
+
copy,
|
|
20
|
+
copy2,
|
|
21
|
+
copyfile,
|
|
22
|
+
copyfileobj,
|
|
23
|
+
copymode,
|
|
24
|
+
copystat,
|
|
25
|
+
copytree,
|
|
26
|
+
diskUsage,
|
|
27
|
+
getTerminalSize,
|
|
28
|
+
makeArchive,
|
|
29
|
+
move,
|
|
30
|
+
rmtree,
|
|
31
|
+
unpackArchive,
|
|
32
|
+
which
|
|
33
|
+
};
|
package/dist/string.js
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
punctuation,
|
|
12
12
|
string,
|
|
13
13
|
whitespace
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-LWYBTWBZ.js";
|
|
15
|
+
import "./chunk-MLKGABMK.js";
|
|
16
16
|
export {
|
|
17
17
|
Template,
|
|
18
18
|
asciiLetters,
|
|
@@ -27,4 +27,3 @@ export {
|
|
|
27
27
|
string,
|
|
28
28
|
whitespace
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python subprocess module for TypeScript
|
|
3
|
+
*
|
|
4
|
+
* Provides functions to spawn new processes and connect to their I/O.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link https://docs.python.org/3/library/subprocess.html | Python subprocess documentation}
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Special constant to indicate that a pipe should be created.
|
|
11
|
+
*/
|
|
12
|
+
declare const PIPE: "pipe";
|
|
13
|
+
/**
|
|
14
|
+
* Special constant to indicate that the subprocess's stderr should be redirected to stdout.
|
|
15
|
+
*/
|
|
16
|
+
declare const STDOUT: "stdout";
|
|
17
|
+
/**
|
|
18
|
+
* Special constant to indicate that output should be discarded.
|
|
19
|
+
*/
|
|
20
|
+
declare const DEVNULL: "devnull";
|
|
21
|
+
/**
|
|
22
|
+
* Result of a completed process.
|
|
23
|
+
*/
|
|
24
|
+
interface CompletedProcess {
|
|
25
|
+
/** The arguments used to launch the process */
|
|
26
|
+
args: string[];
|
|
27
|
+
/** Exit status of the process */
|
|
28
|
+
returncode: number;
|
|
29
|
+
/** Captured stdout (if PIPE was used) */
|
|
30
|
+
stdout: string | null;
|
|
31
|
+
/** Captured stderr (if PIPE was used) */
|
|
32
|
+
stderr: string | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Options for subprocess functions.
|
|
36
|
+
*/
|
|
37
|
+
interface SubprocessOptions {
|
|
38
|
+
/** Working directory for the command */
|
|
39
|
+
cwd?: string;
|
|
40
|
+
/** Environment variables */
|
|
41
|
+
env?: Record<string, string>;
|
|
42
|
+
/** Input to send to stdin */
|
|
43
|
+
input?: string | Uint8Array;
|
|
44
|
+
/** How to handle stdout */
|
|
45
|
+
stdout?: typeof PIPE | typeof DEVNULL | null;
|
|
46
|
+
/** How to handle stderr */
|
|
47
|
+
stderr?: typeof PIPE | typeof STDOUT | typeof DEVNULL | null;
|
|
48
|
+
/** Timeout in milliseconds */
|
|
49
|
+
timeout?: number;
|
|
50
|
+
/** Shell to use (if true, uses default shell) */
|
|
51
|
+
shell?: boolean | string;
|
|
52
|
+
/** Encoding for text mode (default: utf-8) */
|
|
53
|
+
encoding?: BufferEncoding;
|
|
54
|
+
/** Whether to capture output as text (default: true) */
|
|
55
|
+
text?: boolean;
|
|
56
|
+
/** Whether to raise CalledProcessError on non-zero exit */
|
|
57
|
+
check?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Error thrown when a subprocess returns a non-zero exit code.
|
|
61
|
+
*/
|
|
62
|
+
declare class CalledProcessError extends Error {
|
|
63
|
+
readonly returncode: number;
|
|
64
|
+
readonly cmd: string[];
|
|
65
|
+
readonly stdout: string | null;
|
|
66
|
+
readonly stderr: string | null;
|
|
67
|
+
constructor(returncode: number, cmd: string[], stdout?: string | null, stderr?: string | null);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Error thrown when a subprocess times out.
|
|
71
|
+
*/
|
|
72
|
+
declare class TimeoutExpired extends Error {
|
|
73
|
+
readonly cmd: string[];
|
|
74
|
+
readonly timeout: number;
|
|
75
|
+
readonly stdout: string | null;
|
|
76
|
+
readonly stderr: string | null;
|
|
77
|
+
constructor(cmd: string[], timeout: number, stdout?: string | null, stderr?: string | null);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Run a command and wait for it to complete.
|
|
81
|
+
*
|
|
82
|
+
* @param args - Command and arguments (or a single string if shell=true)
|
|
83
|
+
* @param options - Subprocess options
|
|
84
|
+
* @returns CompletedProcess with exit code and captured output
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* // Run a simple command
|
|
89
|
+
* const result = run(["ls", "-la"])
|
|
90
|
+
*
|
|
91
|
+
* // Run with shell
|
|
92
|
+
* const result = run("echo hello && echo world", { shell: true })
|
|
93
|
+
*
|
|
94
|
+
* // Capture output
|
|
95
|
+
* const result = run(["git", "status"], { stdout: PIPE })
|
|
96
|
+
* console.log(result.stdout)
|
|
97
|
+
*
|
|
98
|
+
* // Check for errors
|
|
99
|
+
* const result = run(["false"], { check: true }) // Throws CalledProcessError
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
declare function run(args: string[] | string, options?: SubprocessOptions): CompletedProcess;
|
|
103
|
+
/**
|
|
104
|
+
* Run a command and return its exit code.
|
|
105
|
+
*
|
|
106
|
+
* @param args - Command and arguments
|
|
107
|
+
* @param options - Subprocess options
|
|
108
|
+
* @returns Exit code
|
|
109
|
+
*/
|
|
110
|
+
declare function call(args: string[] | string, options?: SubprocessOptions): number;
|
|
111
|
+
/**
|
|
112
|
+
* Run a command and raise CalledProcessError if it returns non-zero.
|
|
113
|
+
*
|
|
114
|
+
* @param args - Command and arguments
|
|
115
|
+
* @param options - Subprocess options
|
|
116
|
+
* @returns Exit code (always 0 if no exception)
|
|
117
|
+
*/
|
|
118
|
+
declare function checkCall(args: string[] | string, options?: SubprocessOptions): number;
|
|
119
|
+
/**
|
|
120
|
+
* Run a command and return its output, raising CalledProcessError if it returns non-zero.
|
|
121
|
+
*
|
|
122
|
+
* @param args - Command and arguments
|
|
123
|
+
* @param options - Subprocess options
|
|
124
|
+
* @returns Captured stdout
|
|
125
|
+
*/
|
|
126
|
+
declare function checkOutput(args: string[] | string, options?: SubprocessOptions): string;
|
|
127
|
+
/**
|
|
128
|
+
* Get the output of a shell command (convenience function).
|
|
129
|
+
*
|
|
130
|
+
* @param cmd - Shell command to run
|
|
131
|
+
* @returns Command output as string
|
|
132
|
+
*/
|
|
133
|
+
declare function getoutput(cmd: string): string;
|
|
134
|
+
/**
|
|
135
|
+
* Get the exit status and output of a shell command.
|
|
136
|
+
*
|
|
137
|
+
* @param cmd - Shell command to run
|
|
138
|
+
* @returns Tuple of [exit_status, output]
|
|
139
|
+
*/
|
|
140
|
+
declare function getstatusoutput(cmd: string): [number, string];
|
|
141
|
+
/**
|
|
142
|
+
* A subprocess.Popen-like class for more control over process execution.
|
|
143
|
+
*/
|
|
144
|
+
declare class Popen {
|
|
145
|
+
readonly args: string[];
|
|
146
|
+
private readonly process;
|
|
147
|
+
private _returncode;
|
|
148
|
+
private _stdout;
|
|
149
|
+
private _stderr;
|
|
150
|
+
constructor(args: string[] | string, options?: SubprocessOptions);
|
|
151
|
+
/**
|
|
152
|
+
* Wait for the process to complete.
|
|
153
|
+
*/
|
|
154
|
+
wait(): Promise<number>;
|
|
155
|
+
/**
|
|
156
|
+
* Get the exit code (or null if still running).
|
|
157
|
+
*/
|
|
158
|
+
poll(): number | null;
|
|
159
|
+
/**
|
|
160
|
+
* Communicate with the process and return stdout/stderr.
|
|
161
|
+
*/
|
|
162
|
+
communicate(input?: string | Uint8Array): Promise<[string | null, string | null]>;
|
|
163
|
+
/**
|
|
164
|
+
* Send a signal to the process.
|
|
165
|
+
*/
|
|
166
|
+
send_signal(signal: number | NodeJS.Signals): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Terminate the process.
|
|
169
|
+
*/
|
|
170
|
+
terminate(): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Kill the process.
|
|
173
|
+
*/
|
|
174
|
+
kill(): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* The process ID.
|
|
177
|
+
*/
|
|
178
|
+
get pid(): number | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* The exit code (or null if still running).
|
|
181
|
+
*/
|
|
182
|
+
get returncode(): number | null;
|
|
183
|
+
/**
|
|
184
|
+
* The captured stdout.
|
|
185
|
+
*/
|
|
186
|
+
get stdout(): string | null;
|
|
187
|
+
/**
|
|
188
|
+
* The captured stderr.
|
|
189
|
+
*/
|
|
190
|
+
get stderr(): string | null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
type subprocessModule_CalledProcessError = CalledProcessError;
|
|
194
|
+
declare const subprocessModule_CalledProcessError: typeof CalledProcessError;
|
|
195
|
+
type subprocessModule_CompletedProcess = CompletedProcess;
|
|
196
|
+
declare const subprocessModule_DEVNULL: typeof DEVNULL;
|
|
197
|
+
declare const subprocessModule_PIPE: typeof PIPE;
|
|
198
|
+
type subprocessModule_Popen = Popen;
|
|
199
|
+
declare const subprocessModule_Popen: typeof Popen;
|
|
200
|
+
declare const subprocessModule_STDOUT: typeof STDOUT;
|
|
201
|
+
type subprocessModule_SubprocessOptions = SubprocessOptions;
|
|
202
|
+
type subprocessModule_TimeoutExpired = TimeoutExpired;
|
|
203
|
+
declare const subprocessModule_TimeoutExpired: typeof TimeoutExpired;
|
|
204
|
+
declare const subprocessModule_call: typeof call;
|
|
205
|
+
declare const subprocessModule_checkCall: typeof checkCall;
|
|
206
|
+
declare const subprocessModule_checkOutput: typeof checkOutput;
|
|
207
|
+
declare const subprocessModule_getoutput: typeof getoutput;
|
|
208
|
+
declare const subprocessModule_getstatusoutput: typeof getstatusoutput;
|
|
209
|
+
declare const subprocessModule_run: typeof run;
|
|
210
|
+
declare namespace subprocessModule {
|
|
211
|
+
export { subprocessModule_CalledProcessError as CalledProcessError, type subprocessModule_CompletedProcess as CompletedProcess, subprocessModule_DEVNULL as DEVNULL, subprocessModule_PIPE as PIPE, subprocessModule_Popen as Popen, subprocessModule_STDOUT as STDOUT, type subprocessModule_SubprocessOptions as SubprocessOptions, subprocessModule_TimeoutExpired as TimeoutExpired, subprocessModule_call as call, subprocessModule_checkCall as checkCall, subprocessModule_checkOutput as checkOutput, subprocessModule_getoutput as getoutput, subprocessModule_getstatusoutput as getstatusoutput, subprocessModule_run as run };
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export { type CompletedProcess as C, DEVNULL as D, PIPE as P, STDOUT as S, TimeoutExpired as T, type SubprocessOptions as a, CalledProcessError as b, call as c, checkCall as d, checkOutput as e, getstatusoutput as f, getoutput as g, Popen as h, run as r, subprocessModule as s };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { b as CalledProcessError, C as CompletedProcess, D as DEVNULL, P as PIPE, h as Popen, S as STDOUT, a as SubprocessOptions, T as TimeoutExpired, c as call, d as checkCall, e as checkOutput, g as getoutput, f as getstatusoutput, r as run } from './subprocess-CZVYzQ3V.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CalledProcessError,
|
|
3
|
+
DEVNULL,
|
|
4
|
+
PIPE,
|
|
5
|
+
Popen,
|
|
6
|
+
STDOUT,
|
|
7
|
+
TimeoutExpired,
|
|
8
|
+
call,
|
|
9
|
+
checkCall,
|
|
10
|
+
checkOutput,
|
|
11
|
+
getoutput,
|
|
12
|
+
getstatusoutput,
|
|
13
|
+
run
|
|
14
|
+
} from "./chunk-THMJVAK6.js";
|
|
15
|
+
import "./chunk-MLKGABMK.js";
|
|
16
|
+
export {
|
|
17
|
+
CalledProcessError,
|
|
18
|
+
DEVNULL,
|
|
19
|
+
PIPE,
|
|
20
|
+
Popen,
|
|
21
|
+
STDOUT,
|
|
22
|
+
TimeoutExpired,
|
|
23
|
+
call,
|
|
24
|
+
checkCall,
|
|
25
|
+
checkOutput,
|
|
26
|
+
getoutput,
|
|
27
|
+
getstatusoutput,
|
|
28
|
+
run
|
|
29
|
+
};
|