@rsdoctor/utils 1.6.3 → 1.6.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/dist/build.cjs +8 -2
- package/dist/build.js +8 -2
- package/package.json +2 -2
package/dist/build.cjs
CHANGED
|
@@ -307,7 +307,12 @@ for(var __rspack_i in (()=>{
|
|
|
307
307
|
host
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
|
-
let createGetPortSyncFunctionString = (expectPort, host = defaultHost)
|
|
310
|
+
let createGetPortSyncFunctionString = (expectPort, host = defaultHost)=>{
|
|
311
|
+
let port = function(port) {
|
|
312
|
+
if ('number' != typeof port || !Number.isInteger(port) || port < 0 || port > 65535) throw RangeError(`Invalid port: ${String(port)}`);
|
|
313
|
+
return port;
|
|
314
|
+
}(expectPort);
|
|
315
|
+
return `
|
|
311
316
|
(() => {
|
|
312
317
|
const net = require('net');
|
|
313
318
|
|
|
@@ -337,9 +342,10 @@ async function getAvailablePort(expectPort) {
|
|
|
337
342
|
}
|
|
338
343
|
}
|
|
339
344
|
|
|
340
|
-
getAvailablePort(${
|
|
345
|
+
getAvailablePort(${port}).then(port => process.stdout.write(port.toString()));
|
|
341
346
|
})();
|
|
342
347
|
`.trim();
|
|
348
|
+
};
|
|
343
349
|
function getPortSync(expectPort, host = defaultHost) {
|
|
344
350
|
let statement = '\n' === external_os_default().EOL ? createGetPortSyncFunctionString(expectPort, host) : createGetPortSyncFunctionString(expectPort, host).replace(/\n/g, '');
|
|
345
351
|
return Number((0, external_child_process_namespaceObject.execFileSync)(process.execPath, [
|
package/dist/build.js
CHANGED
|
@@ -153,7 +153,12 @@ async function getPort(expectPort, host = defaultHost) {
|
|
|
153
153
|
host
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
|
-
let createGetPortSyncFunctionString = (expectPort, host = defaultHost)
|
|
156
|
+
let createGetPortSyncFunctionString = (expectPort, host = defaultHost)=>{
|
|
157
|
+
let port = function(port) {
|
|
158
|
+
if ('number' != typeof port || !Number.isInteger(port) || port < 0 || port > 65535) throw RangeError(`Invalid port: ${String(port)}`);
|
|
159
|
+
return port;
|
|
160
|
+
}(expectPort);
|
|
161
|
+
return `
|
|
157
162
|
(() => {
|
|
158
163
|
const net = require('net');
|
|
159
164
|
|
|
@@ -183,9 +188,10 @@ async function getAvailablePort(expectPort) {
|
|
|
183
188
|
}
|
|
184
189
|
}
|
|
185
190
|
|
|
186
|
-
getAvailablePort(${
|
|
191
|
+
getAvailablePort(${port}).then(port => process.stdout.write(port.toString()));
|
|
187
192
|
})();
|
|
188
193
|
`.trim();
|
|
194
|
+
};
|
|
189
195
|
function getPortSync(expectPort, host = defaultHost) {
|
|
190
196
|
let statement = '\n' === os.EOL ? createGetPortSyncFunctionString(expectPort, host) : createGetPortSyncFunctionString(expectPort, host).replace(/\n/g, '');
|
|
191
197
|
return Number(execFileSync(process.execPath, [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/utils",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"picocolors": "^1.1.1",
|
|
102
102
|
"rslog": "^2.1.2",
|
|
103
103
|
"strip-ansi": "^7.2.0",
|
|
104
|
-
"@rsdoctor/types": "1.6.
|
|
104
|
+
"@rsdoctor/types": "1.6.5"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@types/babel__code-frame": "7.27.0",
|