better-hosts 0.1.19 → 0.1.21
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/cli.cjs +26 -27
- package/package.json +3 -3
package/dist/cli.cjs
CHANGED
|
@@ -47246,7 +47246,7 @@ exports.waitForAllMacrotasksProcessed = waitForAllMacrotasksProcessed;
|
|
|
47246
47246
|
/***/ ((module) => {
|
|
47247
47247
|
|
|
47248
47248
|
"use strict";
|
|
47249
|
-
module.exports = JSON.parse('{"name":"better-hosts","version":"0.1.
|
|
47249
|
+
module.exports = JSON.parse('{"name":"better-hosts","version":"0.1.21","description":"","keywords":["dns"],"bin":"dist/cli.cjs","files":["dist"],"repository":"git@github.com:BlackGlory/better-hosts.git","author":"BlackGlory <woshenmedoubuzhidao@blackglory.me>","license":"MIT","scripts":{"deduplicate":"yarn-deduplicate","prepublishOnly":"run-s postinstall clean build bundle","postinstall":"patch-package","lint":"eslint --ext .js,.jsx,.ts,.tsx --quiet src","test":"jest --config jest.config.js","test:debug":"node --inspect-brk node_modules/.bin/jest --runInBand","test:coverage":"jest --coverage --config jest.config.js","clean":"rimraf lib dist","build":"run-s build:*","build:compile":"tsc --project tsconfig.build.json","build:patch":"tscpaths --project tsconfig.build.json --src ./src --out ./lib","bundle":"webpack --stats-error-details","smoke":"node dist/cli.cjs --help","release":"standard-version"},"husky":{"hooks":{"pre-commit":"run-s postinstall clean lint build test bundle smoke","commit-msg":"commitlint --env HUSKY_GIT_PARAMS"}},"devDependencies":{"@commitlint/cli":"^17.0.3","@commitlint/config-conventional":"^17.0.3","@types/jest":"^28.1.6","@types/node":"14","@typescript-eslint/eslint-plugin":"^5.32.0","@typescript-eslint/parser":"^5.32.0","eslint":"^8.21.0","husky":"4","jest":"^28.1.3","npm-run-all":"^4.1.5","rimraf":"^3.0.2","standard-version":"^9.5.0","ts-jest":"^28.0.7","tsconfig-paths":"^4.0.0","tscpaths":"^0.0.9","typescript":"^4.7.4","webpack":"^5.74.0","webpack-cli":"^4.10.0","webpack-shebang-plugin":"^1.1.8","yarn-deduplicate":"^5.0.0"},"dependencies":{"@blackglory/errors":"^2.2.2","@blackglory/go":"^1.1.2","@blackglory/prelude":"^0.1.3","@blackglory/types":"^1.2.1","chalk":"^4.1.2","commander":"^9.4.0","extra-filesystem":"^0.4.5","extra-logger":"^0.6.9","extra-promise":"^2.4.0","extra-watcher":"^0.2.0","iterable-operator":"^1.2.0","native-node-dns":"0.7.6","native-node-dns-packet":"0.1.5","patch-package":"^6.4.7","return-style":"^1.0.0"}}');
|
|
47250
47250
|
|
|
47251
47251
|
/***/ })
|
|
47252
47252
|
/******/ ]);
|
|
@@ -47322,44 +47322,43 @@ commander_1.program
|
|
|
47322
47322
|
.version(version)
|
|
47323
47323
|
.description(description)
|
|
47324
47324
|
.requiredOption('--fallback-server <server>')
|
|
47325
|
-
.option('--timeout
|
|
47326
|
-
.option('--port
|
|
47327
|
-
.option('--log
|
|
47325
|
+
.option('--timeout <seconds>', '', '30')
|
|
47326
|
+
.option('--port <port>', '', '53')
|
|
47327
|
+
.option('--log <level>', '', 'info')
|
|
47328
47328
|
.argument('<filename>')
|
|
47329
47329
|
.action(async (filename) => {
|
|
47330
|
-
const options =
|
|
47330
|
+
const options = commander_1.program.opts();
|
|
47331
|
+
const logLevel = getLogLevel(options);
|
|
47332
|
+
const timeout = getTimeout(options);
|
|
47333
|
+
const port = getPort(options);
|
|
47334
|
+
const fallbackServer = getFallbackServer(options);
|
|
47331
47335
|
const logger = new extra_logger_1.Logger({
|
|
47332
|
-
level:
|
|
47336
|
+
level: logLevel,
|
|
47333
47337
|
transport: new extra_logger_1.TerminalTransport({})
|
|
47334
47338
|
});
|
|
47335
|
-
const hosts = new hosts_1.Hosts({
|
|
47336
|
-
filename,
|
|
47337
|
-
logger
|
|
47338
|
-
});
|
|
47339
|
-
const fallbackServer = (0, parse_server_info_1.parseServerInfo)(options.fallbackServer);
|
|
47339
|
+
const hosts = new hosts_1.Hosts({ filename, logger });
|
|
47340
47340
|
(0, server_1.startServer)({
|
|
47341
47341
|
logger,
|
|
47342
47342
|
hosts,
|
|
47343
47343
|
fallbackServer,
|
|
47344
|
-
timeout
|
|
47345
|
-
port
|
|
47344
|
+
timeout,
|
|
47345
|
+
port
|
|
47346
47346
|
});
|
|
47347
47347
|
})
|
|
47348
47348
|
.parse();
|
|
47349
|
-
function
|
|
47350
|
-
|
|
47351
|
-
|
|
47352
|
-
|
|
47353
|
-
|
|
47354
|
-
|
|
47355
|
-
|
|
47356
|
-
|
|
47357
|
-
|
|
47358
|
-
|
|
47359
|
-
|
|
47360
|
-
|
|
47361
|
-
|
|
47362
|
-
};
|
|
47349
|
+
function getPort(options) {
|
|
47350
|
+
(0, errors_1.assert)(/^\d+$/.test(options.port), 'The parameter port must be integer');
|
|
47351
|
+
return Number.parseInt(options.port, 10);
|
|
47352
|
+
}
|
|
47353
|
+
function getTimeout(options) {
|
|
47354
|
+
(0, errors_1.assert)(/^\d+$/.test(options.timeout), 'The parameter timeout must be integer');
|
|
47355
|
+
return Number.parseInt(options.port, 10) * 1000;
|
|
47356
|
+
}
|
|
47357
|
+
function getFallbackServer(options) {
|
|
47358
|
+
return (0, parse_server_info_1.parseServerInfo)(options.fallbackServer);
|
|
47359
|
+
}
|
|
47360
|
+
function getLogLevel(options) {
|
|
47361
|
+
return (0, extra_logger_1.stringToLevel)(options.log, extra_logger_1.Level.Info);
|
|
47363
47362
|
}
|
|
47364
47363
|
//# sourceMappingURL=cli.js.map
|
|
47365
47364
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-hosts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dns"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"scripts": {
|
|
16
16
|
"deduplicate": "yarn-deduplicate",
|
|
17
|
-
"prepublishOnly": "run-s clean build bundle",
|
|
17
|
+
"prepublishOnly": "run-s postinstall clean build bundle",
|
|
18
18
|
"postinstall": "patch-package",
|
|
19
19
|
"lint": "eslint --ext .js,.jsx,.ts,.tsx --quiet src",
|
|
20
20
|
"test": "jest --config jest.config.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"husky": {
|
|
32
32
|
"hooks": {
|
|
33
|
-
"pre-commit": "run-s clean lint build test bundle smoke",
|
|
33
|
+
"pre-commit": "run-s postinstall clean lint build test bundle smoke",
|
|
34
34
|
"commit-msg": "commitlint --env HUSKY_GIT_PARAMS"
|
|
35
35
|
}
|
|
36
36
|
},
|