xjs-node 1.0.7 → 2.0.1-alpha.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/{dist → build}/func/u-file.d.ts +44 -45
- package/{dist → build}/func/u-file.js +171 -161
- package/{dist → build}/func/u.d.ts +3 -3
- package/{dist → build}/func/u.js +51 -42
- package/{dist → build}/index.d.ts +5 -5
- package/{dist → build}/index.js +23 -23
- package/{dist → build}/prcs/http/http-resolver-context.d.ts +59 -60
- package/{dist → build}/prcs/http/http-resolver-context.js +337 -327
- package/{dist → build}/prcs/http/http-resolver.d.ts +50 -51
- package/{dist → build}/prcs/http/http-resolver.js +53 -53
- package/{dist → build}/prcs/http/i-http-client.d.ts +88 -90
- package/{dist → build}/prcs/http/i-http-client.js +2 -2
- package/package.json +18 -11
|
@@ -1,45 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
function
|
|
24
|
-
function read(p: MaybeArray<string
|
|
25
|
-
function
|
|
26
|
-
function
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @param
|
|
33
|
-
* @
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @param
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
export {};
|
|
1
|
+
import { MaybeArray } from "xjs-common";
|
|
2
|
+
interface FileStatus {
|
|
3
|
+
isFile(): boolean;
|
|
4
|
+
isDirectory(): boolean;
|
|
5
|
+
isBlockDevice(): boolean;
|
|
6
|
+
isCharacterDevice(): boolean;
|
|
7
|
+
isSymbolicLink(): boolean;
|
|
8
|
+
isFIFO(): boolean;
|
|
9
|
+
isSocket(): boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare namespace UFile {
|
|
12
|
+
function mkdir(p: MaybeArray<string>): boolean;
|
|
13
|
+
function write(p: MaybeArray<string>, c: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* remove a file. no error if the file to be removed doesn't exist.
|
|
16
|
+
*/
|
|
17
|
+
function rm(p: MaybeArray<string>): void;
|
|
18
|
+
function exists(p: MaybeArray<string>): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* return a file status. if the file of the status doesn't exist, this returns `null`.
|
|
21
|
+
*/
|
|
22
|
+
function status(p: MaybeArray<string>): FileStatus;
|
|
23
|
+
function read(p: MaybeArray<string>): Buffer;
|
|
24
|
+
function read(p: MaybeArray<string>, encoding: BufferEncoding): string;
|
|
25
|
+
function cp(from: MaybeArray<string>, to: MaybeArray<string>): void;
|
|
26
|
+
function mv(from: MaybeArray<string>, to: MaybeArray<string>): void;
|
|
27
|
+
function ls(p: MaybeArray<string>): string[];
|
|
28
|
+
/**
|
|
29
|
+
* check availability to export a file with specified directory and file name.
|
|
30
|
+
* if it doesn't, retry to check after appending incremental number (e.g. `.1`) to the filename.
|
|
31
|
+
* @param dir destination directory path.
|
|
32
|
+
* @param fname file name wanna export to.
|
|
33
|
+
* @returns exportable file path.
|
|
34
|
+
*/
|
|
35
|
+
function reserveFilePath(dir: MaybeArray<string>, fname: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* decompress zip file. this depends on os enviroment due to using the os command.
|
|
38
|
+
* currently this supports only windows (installed `tar` or `unzip` in gnu compiler) and linux systems (installed `unzip`).
|
|
39
|
+
* @param zipPath zip file to be unzipped.
|
|
40
|
+
* @param destDir directory that the decompress files export to.
|
|
41
|
+
*/
|
|
42
|
+
function unzip(zipPath: MaybeArray<string>, destDir?: MaybeArray<string>): void;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -1,161 +1,171 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.UFile = void 0;
|
|
37
|
+
const child_process_1 = require("child_process");
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const xjs_common_1 = require("xjs-common");
|
|
40
|
+
const u_1 = require("./u");
|
|
41
|
+
const s_errCode = 1040;
|
|
42
|
+
var UFile;
|
|
43
|
+
(function (UFile) {
|
|
44
|
+
function mkdir(p) {
|
|
45
|
+
const dirPath = (0, u_1.joinPath)(p);
|
|
46
|
+
const e = fs.existsSync(dirPath);
|
|
47
|
+
if (!e)
|
|
48
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
49
|
+
else if (!fs.statSync(dirPath).isDirectory())
|
|
50
|
+
throw new xjs_common_1.XjsErr(s_errCode, "Already exists a file (not directory) on the path.");
|
|
51
|
+
return !e;
|
|
52
|
+
}
|
|
53
|
+
UFile.mkdir = mkdir;
|
|
54
|
+
function write(p, c) {
|
|
55
|
+
fs.writeFileSync((0, u_1.joinPath)(p), c);
|
|
56
|
+
}
|
|
57
|
+
UFile.write = write;
|
|
58
|
+
/**
|
|
59
|
+
* remove a file. no error if the file to be removed doesn't exist.
|
|
60
|
+
*/
|
|
61
|
+
function rm(p) {
|
|
62
|
+
const pt = (0, u_1.joinPath)(p);
|
|
63
|
+
if (fs.existsSync(pt))
|
|
64
|
+
fs.rmSync(pt, { recursive: true });
|
|
65
|
+
}
|
|
66
|
+
UFile.rm = rm;
|
|
67
|
+
function exists(p) {
|
|
68
|
+
return !!p && fs.existsSync((0, u_1.joinPath)(p));
|
|
69
|
+
}
|
|
70
|
+
UFile.exists = exists;
|
|
71
|
+
/**
|
|
72
|
+
* return a file status. if the file of the status doesn't exist, this returns `null`.
|
|
73
|
+
*/
|
|
74
|
+
function status(p) {
|
|
75
|
+
const pt = (0, u_1.joinPath)(p);
|
|
76
|
+
return fs.existsSync(pt) ? fs.statSync(pt) : null;
|
|
77
|
+
}
|
|
78
|
+
UFile.status = status;
|
|
79
|
+
function read(p, encoding) {
|
|
80
|
+
const f = (0, u_1.joinPath)(p);
|
|
81
|
+
if (!fs.existsSync(f))
|
|
82
|
+
throw new xjs_common_1.XjsErr(s_errCode, `No file found => ${f}`);
|
|
83
|
+
return fs.readFileSync(f, encoding);
|
|
84
|
+
}
|
|
85
|
+
UFile.read = read;
|
|
86
|
+
function cp(from, to) {
|
|
87
|
+
const f = (0, u_1.joinPath)(from), t = (0, u_1.joinPath)(to);
|
|
88
|
+
if (!fs.existsSync(f))
|
|
89
|
+
throw new xjs_common_1.XjsErr(s_errCode, `No file found => ${f}`);
|
|
90
|
+
fs.copyFileSync(f, t);
|
|
91
|
+
}
|
|
92
|
+
UFile.cp = cp;
|
|
93
|
+
function mv(from, to) {
|
|
94
|
+
const f = (0, u_1.joinPath)(from), t = (0, u_1.joinPath)(to);
|
|
95
|
+
if (!fs.existsSync(f))
|
|
96
|
+
throw new xjs_common_1.XjsErr(s_errCode, `No file found => ${f}`);
|
|
97
|
+
fs.renameSync(f, t);
|
|
98
|
+
}
|
|
99
|
+
UFile.mv = mv;
|
|
100
|
+
function ls(p) {
|
|
101
|
+
const pt = (0, u_1.joinPath)(p);
|
|
102
|
+
if (!pt || !fs.statSync(pt).isDirectory())
|
|
103
|
+
throw new xjs_common_1.XjsErr(s_errCode, "Specified path for ls is not directory.");
|
|
104
|
+
return fs.readdirSync(pt);
|
|
105
|
+
}
|
|
106
|
+
UFile.ls = ls;
|
|
107
|
+
/**
|
|
108
|
+
* check availability to export a file with specified directory and file name.
|
|
109
|
+
* if it doesn't, retry to check after appending incremental number (e.g. `.1`) to the filename.
|
|
110
|
+
* @param dir destination directory path.
|
|
111
|
+
* @param fname file name wanna export to.
|
|
112
|
+
* @returns exportable file path.
|
|
113
|
+
*/
|
|
114
|
+
function reserveFilePath(dir, fname) {
|
|
115
|
+
const pt = (0, u_1.joinPath)(dir);
|
|
116
|
+
if (!pt || !fs.statSync(pt).isDirectory())
|
|
117
|
+
throw new xjs_common_1.XjsErr(s_errCode, "Specified directory path is not directory.");
|
|
118
|
+
if (!fname || fname.match(/[\\/:*?"<>|]/))
|
|
119
|
+
throw new xjs_common_1.XjsErr(s_errCode, "Specified filename is invalid due to empty or including disallowed characters.");
|
|
120
|
+
let dest = (0, u_1.joinPath)(pt, fname), i = 1;
|
|
121
|
+
while (fs.existsSync(dest))
|
|
122
|
+
dest = (0, u_1.joinPath)(pt, `${fname}.${i++}`);
|
|
123
|
+
return dest;
|
|
124
|
+
}
|
|
125
|
+
UFile.reserveFilePath = reserveFilePath;
|
|
126
|
+
/**
|
|
127
|
+
* decompress zip file. this depends on os enviroment due to using the os command.
|
|
128
|
+
* currently this supports only windows (installed `tar` or `unzip` in gnu compiler) and linux systems (installed `unzip`).
|
|
129
|
+
* @param zipPath zip file to be unzipped.
|
|
130
|
+
* @param destDir directory that the decompress files export to.
|
|
131
|
+
*/
|
|
132
|
+
function unzip(zipPath, destDir) {
|
|
133
|
+
if (!exists(zipPath))
|
|
134
|
+
throw new xjs_common_1.XjsErr(s_errCode, "There is no file on the zip path.");
|
|
135
|
+
if (!!destDir && !exists(destDir))
|
|
136
|
+
throw new xjs_common_1.XjsErr(s_errCode, "The destination directory is not found.");
|
|
137
|
+
let cmd = "unzip", options = null, availableCmd = true;
|
|
138
|
+
if (destDir)
|
|
139
|
+
options = `-d "${destDir}"`;
|
|
140
|
+
const check = () => { try {
|
|
141
|
+
(0, child_process_1.execSync)(`${cmd} --help`, { stdio: "ignore" });
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
availableCmd = false;
|
|
145
|
+
} };
|
|
146
|
+
check();
|
|
147
|
+
if (process.platform === "win32") {
|
|
148
|
+
if (!availableCmd) {
|
|
149
|
+
cmd = "tar";
|
|
150
|
+
options = "-xf";
|
|
151
|
+
availableCmd = true;
|
|
152
|
+
if (destDir)
|
|
153
|
+
options = `-C "${destDir}" ${options}`;
|
|
154
|
+
check();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else if (process.platform === "linux") {
|
|
158
|
+
}
|
|
159
|
+
else
|
|
160
|
+
throw new xjs_common_1.XjsErr(s_errCode, "The os running on is not supported for xjs unzip.");
|
|
161
|
+
if (!availableCmd)
|
|
162
|
+
throw new xjs_common_1.XjsErr(s_errCode, `"${cmd}" command is not installed.`);
|
|
163
|
+
try {
|
|
164
|
+
(0, child_process_1.execSync)([cmd, options, `"${zipPath}"`].filter(e => e).join(" "), { stdio: "ignore" });
|
|
165
|
+
}
|
|
166
|
+
catch (e) {
|
|
167
|
+
throw new xjs_common_1.XjsErr(s_errCode, "Something went wrong at unzip.", e);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
UFile.unzip = unzip;
|
|
171
|
+
})(UFile || (exports.UFile = UFile = {}));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { MaybeArray } from "xjs-common";
|
|
2
|
-
export declare function checkPortAvailability(port: number): Promise<boolean>;
|
|
3
|
-
export declare function joinPath(...p: MaybeArray<string>[]): string;
|
|
1
|
+
import { MaybeArray } from "xjs-common";
|
|
2
|
+
export declare function checkPortAvailability(port: number): Promise<boolean>;
|
|
3
|
+
export declare function joinPath(...p: MaybeArray<string>[]): string;
|
package/{dist → build}/func/u.js
RENAMED
|
@@ -1,42 +1,51 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.checkPortAvailability = checkPortAvailability;
|
|
37
|
+
exports.joinPath = joinPath;
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const xjs_common_1 = require("xjs-common");
|
|
40
|
+
const s_errCode = 1010;
|
|
41
|
+
function checkPortAvailability(port) {
|
|
42
|
+
return new Promise(resolve => {
|
|
43
|
+
const server = require('net').createServer();
|
|
44
|
+
server.once('error', () => resolve(false))
|
|
45
|
+
.once('listening', () => { server.close(); resolve(true); })
|
|
46
|
+
.listen(port);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function joinPath(...p) {
|
|
50
|
+
return path.join(...p.flatMap(xjs_common_1.UType.takeAsArray));
|
|
51
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./func/u";
|
|
2
|
-
export * from "./func/u-file";
|
|
3
|
-
export { HttpResolver, ClientMode } from "./prcs/http/http-resolver";
|
|
4
|
-
export { s_clientMode } from "./prcs/http/http-resolver-context";
|
|
5
|
-
export { IHttpClient, HttpResponse } from "./prcs/http/i-http-client";
|
|
1
|
+
export * from "./func/u";
|
|
2
|
+
export * from "./func/u-file";
|
|
3
|
+
export { HttpResolver, ClientMode } from "./prcs/http/http-resolver";
|
|
4
|
+
export { s_clientMode } from "./prcs/http/http-resolver-context";
|
|
5
|
+
export { IHttpClient, HttpResponse } from "./prcs/http/i-http-client";
|
package/{dist → build}/index.js
RENAMED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.s_clientMode = exports.HttpResolver = void 0;
|
|
18
|
-
__exportStar(require("./func/u"), exports);
|
|
19
|
-
__exportStar(require("./func/u-file"), exports);
|
|
20
|
-
var http_resolver_1 = require("./prcs/http/http-resolver");
|
|
21
|
-
Object.defineProperty(exports, "HttpResolver", { enumerable: true, get: function () { return http_resolver_1.HttpResolver; } });
|
|
22
|
-
var http_resolver_context_1 = require("./prcs/http/http-resolver-context");
|
|
23
|
-
Object.defineProperty(exports, "s_clientMode", { enumerable: true, get: function () { return http_resolver_context_1.s_clientMode; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.s_clientMode = exports.HttpResolver = void 0;
|
|
18
|
+
__exportStar(require("./func/u"), exports);
|
|
19
|
+
__exportStar(require("./func/u-file"), exports);
|
|
20
|
+
var http_resolver_1 = require("./prcs/http/http-resolver");
|
|
21
|
+
Object.defineProperty(exports, "HttpResolver", { enumerable: true, get: function () { return http_resolver_1.HttpResolver; } });
|
|
22
|
+
var http_resolver_context_1 = require("./prcs/http/http-resolver-context");
|
|
23
|
+
Object.defineProperty(exports, "s_clientMode", { enumerable: true, get: function () { return http_resolver_context_1.s_clientMode; } });
|