@webpod/ps 0.0.0-beta.4 → 0.0.0-beta.5
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 +1 -1
- package/target/cjs/index.cjs +16 -13
- package/target/dts/index.d.ts +11 -3
- package/target/dts/ps.d.ts +8 -2
- package/target/esm/index.mjs +13 -12
package/package.json
CHANGED
package/target/cjs/index.cjs
CHANGED
|
@@ -53,7 +53,9 @@ __export(ts_exports, {
|
|
|
53
53
|
default: () => ts_default,
|
|
54
54
|
kill: () => kill,
|
|
55
55
|
lookup: () => lookup,
|
|
56
|
-
|
|
56
|
+
lookupSync: () => lookupSync,
|
|
57
|
+
tree: () => tree,
|
|
58
|
+
treeSync: () => treeSync
|
|
57
59
|
});
|
|
58
60
|
module.exports = __toCommonJS(ts_exports);
|
|
59
61
|
|
|
@@ -66,16 +68,15 @@ var import_spawn = require("zurk/spawn");
|
|
|
66
68
|
var EOL = /(\r\n)|(\n\r)|\n|\r/;
|
|
67
69
|
var IS_WIN = import_node_process.default.platform === "win32";
|
|
68
70
|
var isBin = (f) => {
|
|
69
|
-
if (f === "")
|
|
70
|
-
|
|
71
|
-
if (!
|
|
72
|
-
return true;
|
|
73
|
-
if (!import_node_fs.default.existsSync(f))
|
|
74
|
-
return false;
|
|
71
|
+
if (f === "") return false;
|
|
72
|
+
if (!f.includes("/")) return true;
|
|
73
|
+
if (!import_node_fs.default.existsSync(f)) return false;
|
|
75
74
|
const stat = import_node_fs.default.lstatSync(f);
|
|
76
75
|
return stat.isFile() || stat.isSymbolicLink();
|
|
77
76
|
};
|
|
78
77
|
var lookup = (query = {}, cb = noop) => _lookup({ query, cb, sync: false });
|
|
78
|
+
var lookupSync = (query = {}, cb = noop) => _lookup({ query, cb, sync: true });
|
|
79
|
+
lookup.sync = lookupSync;
|
|
79
80
|
var _lookup = ({
|
|
80
81
|
query = {},
|
|
81
82
|
cb = noop,
|
|
@@ -152,8 +153,7 @@ var _tree = ({
|
|
|
152
153
|
return _tree({ opts: { pid: opts }, cb, sync });
|
|
153
154
|
}
|
|
154
155
|
const handle = (all) => {
|
|
155
|
-
if (opts === void 0)
|
|
156
|
-
return all;
|
|
156
|
+
if (opts === void 0) return all;
|
|
157
157
|
const { pid, recursive = false } = opts;
|
|
158
158
|
const list = pickTree(all, pid, recursive);
|
|
159
159
|
cb(null, list);
|
|
@@ -170,6 +170,8 @@ var _tree = ({
|
|
|
170
170
|
var tree = (opts, cb) => __async(void 0, null, function* () {
|
|
171
171
|
return _tree({ opts, cb });
|
|
172
172
|
});
|
|
173
|
+
var treeSync = (opts, cb) => _tree({ opts, cb, sync: true });
|
|
174
|
+
tree.sync = treeSync;
|
|
173
175
|
var kill = (pid, opts, next) => {
|
|
174
176
|
if (typeof opts == "function") {
|
|
175
177
|
return kill(pid, void 0, opts);
|
|
@@ -193,8 +195,7 @@ var kill = (pid, opts, next) => {
|
|
|
193
195
|
let checkTimeoutTimer;
|
|
194
196
|
let checkIsTimeout = false;
|
|
195
197
|
const checkKilled = (finishCallback) => lookup({ pid }, (err, list = []) => {
|
|
196
|
-
if (checkIsTimeout)
|
|
197
|
-
return;
|
|
198
|
+
if (checkIsTimeout) return;
|
|
198
199
|
if (err) {
|
|
199
200
|
clearTimeout(checkTimeoutTimer);
|
|
200
201
|
reject(err);
|
|
@@ -266,10 +267,12 @@ var noop = () => {
|
|
|
266
267
|
var identity = (v) => v;
|
|
267
268
|
|
|
268
269
|
// src/main/ts/index.ts
|
|
269
|
-
var ts_default = { lookup,
|
|
270
|
+
var ts_default = { kill, lookup, lookupSync, tree, treeSync };
|
|
270
271
|
// Annotate the CommonJS export names for ESM import in node:
|
|
271
272
|
0 && (module.exports = {
|
|
272
273
|
kill,
|
|
273
274
|
lookup,
|
|
274
|
-
|
|
275
|
+
lookupSync,
|
|
276
|
+
tree,
|
|
277
|
+
treeSync
|
|
275
278
|
});
|
package/target/dts/index.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
export type * from './ps.js';
|
|
2
|
-
export { kill, lookup, tree } from './ps.js';
|
|
2
|
+
export { kill, lookup, lookupSync, tree, treeSync } from './ps.js';
|
|
3
3
|
declare const _default: {
|
|
4
|
-
lookup: (query?: import("./ps.js").TPsLookupQuery, cb?: import("./ps.js").TPsLookupCallback) => Promise<import("./ps.js").TPsLookupEntry[]>;
|
|
5
4
|
kill: (pid: string | number, opts?: string | number | import("./ps.js").TPsKillOptions | import("./ps.js").TPsNext | undefined, next?: import("./ps.js").TPsNext | undefined) => Promise<void>;
|
|
6
|
-
|
|
5
|
+
lookup: {
|
|
6
|
+
(query?: import("./ps.js").TPsLookupQuery, cb?: import("./ps.js").TPsLookupCallback): Promise<import("./ps.js").TPsLookupEntry[]>;
|
|
7
|
+
sync: (query?: import("./ps.js").TPsLookupQuery, cb?: import("./ps.js").TPsLookupCallback) => import("./ps.js").TPsLookupEntry[];
|
|
8
|
+
};
|
|
9
|
+
lookupSync: (query?: import("./ps.js").TPsLookupQuery, cb?: import("./ps.js").TPsLookupCallback) => import("./ps.js").TPsLookupEntry[];
|
|
10
|
+
tree: {
|
|
11
|
+
(opts?: string | number | import("./ps.js").TPsTreeOpts | undefined, cb?: import("./ps.js").TPsLookupCallback | undefined): Promise<import("./ps.js").TPsLookupEntry[]>;
|
|
12
|
+
sync: (opts?: string | number | import("./ps.js").TPsTreeOpts | undefined, cb?: import("./ps.js").TPsLookupCallback | undefined) => import("./ps.js").TPsLookupEntry[];
|
|
13
|
+
};
|
|
14
|
+
treeSync: (opts?: string | number | import("./ps.js").TPsTreeOpts | undefined, cb?: import("./ps.js").TPsLookupCallback | undefined) => import("./ps.js").TPsLookupEntry[];
|
|
7
15
|
};
|
|
8
16
|
export default _default;
|
package/target/dts/ps.d.ts
CHANGED
|
@@ -31,7 +31,10 @@ export type TPsNext = (err?: any, data?: any) => void;
|
|
|
31
31
|
* @param {TPsLookupEntry[]} cb.processList
|
|
32
32
|
* @return {Promise<TPsLookupEntry[]>}
|
|
33
33
|
*/
|
|
34
|
-
export declare const lookup:
|
|
34
|
+
export declare const lookup: {
|
|
35
|
+
(query?: TPsLookupQuery, cb?: TPsLookupCallback): Promise<TPsLookupEntry[]>;
|
|
36
|
+
sync: (query?: TPsLookupQuery, cb?: TPsLookupCallback) => TPsLookupEntry[];
|
|
37
|
+
};
|
|
35
38
|
/**
|
|
36
39
|
* Looks up the process list synchronously
|
|
37
40
|
* @param query
|
|
@@ -52,7 +55,10 @@ export type TPsTreeOpts = {
|
|
|
52
55
|
recursive?: boolean;
|
|
53
56
|
};
|
|
54
57
|
export declare const pickTree: (list: TPsLookupEntry[], pid: string | number, recursive?: boolean) => TPsLookupEntry[];
|
|
55
|
-
export declare const tree:
|
|
58
|
+
export declare const tree: {
|
|
59
|
+
(opts?: string | number | TPsTreeOpts | undefined, cb?: TPsLookupCallback): Promise<TPsLookupEntry[]>;
|
|
60
|
+
sync: (opts?: string | number | TPsTreeOpts | undefined, cb?: TPsLookupCallback) => TPsLookupEntry[];
|
|
61
|
+
};
|
|
56
62
|
export declare const treeSync: (opts?: string | number | TPsTreeOpts | undefined, cb?: TPsLookupCallback) => TPsLookupEntry[];
|
|
57
63
|
/**
|
|
58
64
|
* Kill process
|
package/target/esm/index.mjs
CHANGED
|
@@ -7,16 +7,15 @@ import { exec } from "zurk/spawn";
|
|
|
7
7
|
var EOL = /(\r\n)|(\n\r)|\n|\r/;
|
|
8
8
|
var IS_WIN = process.platform === "win32";
|
|
9
9
|
var isBin = (f) => {
|
|
10
|
-
if (f === "")
|
|
11
|
-
|
|
12
|
-
if (!
|
|
13
|
-
return true;
|
|
14
|
-
if (!fs.existsSync(f))
|
|
15
|
-
return false;
|
|
10
|
+
if (f === "") return false;
|
|
11
|
+
if (!f.includes("/")) return true;
|
|
12
|
+
if (!fs.existsSync(f)) return false;
|
|
16
13
|
const stat = fs.lstatSync(f);
|
|
17
14
|
return stat.isFile() || stat.isSymbolicLink();
|
|
18
15
|
};
|
|
19
16
|
var lookup = (query = {}, cb = noop) => _lookup({ query, cb, sync: false });
|
|
17
|
+
var lookupSync = (query = {}, cb = noop) => _lookup({ query, cb, sync: true });
|
|
18
|
+
lookup.sync = lookupSync;
|
|
20
19
|
var _lookup = ({
|
|
21
20
|
query = {},
|
|
22
21
|
cb = noop,
|
|
@@ -93,8 +92,7 @@ var _tree = ({
|
|
|
93
92
|
return _tree({ opts: { pid: opts }, cb, sync });
|
|
94
93
|
}
|
|
95
94
|
const handle = (all) => {
|
|
96
|
-
if (opts === void 0)
|
|
97
|
-
return all;
|
|
95
|
+
if (opts === void 0) return all;
|
|
98
96
|
const { pid, recursive = false } = opts;
|
|
99
97
|
const list = pickTree(all, pid, recursive);
|
|
100
98
|
cb(null, list);
|
|
@@ -109,6 +107,8 @@ var _tree = ({
|
|
|
109
107
|
}
|
|
110
108
|
};
|
|
111
109
|
var tree = async (opts, cb) => _tree({ opts, cb });
|
|
110
|
+
var treeSync = (opts, cb) => _tree({ opts, cb, sync: true });
|
|
111
|
+
tree.sync = treeSync;
|
|
112
112
|
var kill = (pid, opts, next) => {
|
|
113
113
|
if (typeof opts == "function") {
|
|
114
114
|
return kill(pid, void 0, opts);
|
|
@@ -132,8 +132,7 @@ var kill = (pid, opts, next) => {
|
|
|
132
132
|
let checkTimeoutTimer;
|
|
133
133
|
let checkIsTimeout = false;
|
|
134
134
|
const checkKilled = (finishCallback) => lookup({ pid }, (err, list = []) => {
|
|
135
|
-
if (checkIsTimeout)
|
|
136
|
-
return;
|
|
135
|
+
if (checkIsTimeout) return;
|
|
137
136
|
if (err) {
|
|
138
137
|
clearTimeout(checkTimeoutTimer);
|
|
139
138
|
reject(err);
|
|
@@ -204,10 +203,12 @@ var noop = () => {
|
|
|
204
203
|
var identity = (v) => v;
|
|
205
204
|
|
|
206
205
|
// src/main/ts/index.ts
|
|
207
|
-
var ts_default = { lookup,
|
|
206
|
+
var ts_default = { kill, lookup, lookupSync, tree, treeSync };
|
|
208
207
|
export {
|
|
209
208
|
ts_default as default,
|
|
210
209
|
kill,
|
|
211
210
|
lookup,
|
|
212
|
-
|
|
211
|
+
lookupSync,
|
|
212
|
+
tree,
|
|
213
|
+
treeSync
|
|
213
214
|
};
|