eslint-plugin-node-dependencies 0.13.1 → 1.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/dist/utils/meta.js +1 -3
- package/dist/utils/package-json/index.d.ts +1 -4
- package/dist/utils/package-json/index.js +5 -3
- package/dist/utils/package-json/worker.d.mts +1 -0
- package/dist/utils/package-json/worker.mjs +26 -0
- package/package.json +17 -17
- package/dist/utils/package-json/worker.d.ts +0 -1
- package/dist/utils/package-json/worker.js +0 -49
package/dist/utils/meta.js
CHANGED
|
@@ -192,9 +192,7 @@ function getMetaFromName(name, cachedFilePath) {
|
|
|
192
192
|
function getMetaFromNameWithoutCache(name, cachedFilePath) {
|
|
193
193
|
let meta = [];
|
|
194
194
|
try {
|
|
195
|
-
const allMeta = (0, package_json_1.syncPackageJson)(name
|
|
196
|
-
allVersions: true,
|
|
197
|
-
});
|
|
195
|
+
const allMeta = (0, package_json_1.syncPackageJson)(name);
|
|
198
196
|
meta = Object.values(allMeta.versions).map((vm) => {
|
|
199
197
|
return {
|
|
200
198
|
version: vm.version,
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
type SyncPackageJson = (packageName: string, options: Options) => AbbreviatedMetadata;
|
|
3
|
-
export declare const syncPackageJson: SyncPackageJson;
|
|
4
|
-
export {};
|
|
1
|
+
export declare const syncPackageJson: (name: string) => import("package-json").AbbreviatedMetadata;
|
|
@@ -3,13 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.syncPackageJson = void 0;
|
|
4
4
|
const synckit_1 = require("synckit");
|
|
5
5
|
const module_1 = require("module");
|
|
6
|
-
exports.syncPackageJson = (0, synckit_1.createSyncFn)(getWorkerPath()
|
|
6
|
+
exports.syncPackageJson = (0, synckit_1.createSyncFn)(getWorkerPath(), {
|
|
7
|
+
timeout: 10000,
|
|
8
|
+
});
|
|
7
9
|
function getWorkerPath() {
|
|
8
10
|
try {
|
|
9
|
-
return require.resolve("./worker");
|
|
11
|
+
return require.resolve("./worker.mjs");
|
|
10
12
|
}
|
|
11
13
|
catch (_a) {
|
|
12
14
|
}
|
|
13
15
|
const r = (0, module_1.createRequire)(__filename);
|
|
14
|
-
return r.resolve(
|
|
16
|
+
return r.resolve("./worker.mts");
|
|
15
17
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function setupProxy(): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import packageJson from "package-json";
|
|
2
|
+
import { runAsWorker } from "synckit";
|
|
3
|
+
import { ProxyAgent, setGlobalDispatcher } from "undici";
|
|
4
|
+
let proxySet = false;
|
|
5
|
+
const PROXY_ENV = [
|
|
6
|
+
"https_proxy",
|
|
7
|
+
"HTTPS_PROXY",
|
|
8
|
+
"http_proxy",
|
|
9
|
+
"HTTP_PROXY",
|
|
10
|
+
"npm_config_https_proxy",
|
|
11
|
+
"npm_config_http_proxy",
|
|
12
|
+
];
|
|
13
|
+
export function setupProxy() {
|
|
14
|
+
if (proxySet) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
proxySet = true;
|
|
18
|
+
const proxy = PROXY_ENV.map((k) => process.env[k]).find((v) => v);
|
|
19
|
+
if (proxy) {
|
|
20
|
+
setGlobalDispatcher(new ProxyAgent(proxy));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
runAsWorker((packageName) => {
|
|
24
|
+
setupProxy();
|
|
25
|
+
return packageJson(packageName, { allVersions: true });
|
|
26
|
+
});
|
package/package.json
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-node-dependencies",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "ESLint plugin to check Node.js dependencies.",
|
|
5
|
+
"repository": "git+https://github.com/ota-meshi/eslint-plugin-node-dependencies.git",
|
|
6
|
+
"homepage": "https://github.com/ota-meshi/eslint-plugin-node-dependencies#readme",
|
|
7
|
+
"author": "Yosuke Ota (https://github.com/ota-meshi)",
|
|
8
|
+
"maintainers": [
|
|
9
|
+
"JounQin <admin@1stg.me> (https://www.1stG.me)"
|
|
10
|
+
],
|
|
11
|
+
"funding": [
|
|
12
|
+
"https://github.com/sponsors/ota-meshi",
|
|
13
|
+
"https://github.com/sponsors/JounQin"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
5
16
|
"engines": {
|
|
6
|
-
"node": "
|
|
17
|
+
"node": "^18.17.0 || >=20.5.0"
|
|
7
18
|
},
|
|
8
19
|
"main": "dist/index.js",
|
|
9
20
|
"types": "dist/index.d.ts",
|
|
10
21
|
"files": [
|
|
11
22
|
"dist"
|
|
12
23
|
],
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/ota-meshi/eslint-plugin-node-dependencies.git"
|
|
16
|
-
},
|
|
17
24
|
"keywords": [
|
|
18
25
|
"eslint",
|
|
19
26
|
"eslintplugin",
|
|
@@ -22,23 +29,16 @@
|
|
|
22
29
|
"dependencies",
|
|
23
30
|
"json"
|
|
24
31
|
],
|
|
25
|
-
"author": "Yosuke Ota (https://github.com/ota-meshi)",
|
|
26
|
-
"funding": "https://github.com/sponsors/ota-meshi",
|
|
27
|
-
"license": "MIT",
|
|
28
|
-
"bugs": {
|
|
29
|
-
"url": "https://github.com/ota-meshi/eslint-plugin-node-dependencies/issues"
|
|
30
|
-
},
|
|
31
|
-
"homepage": "https://github.com/ota-meshi/eslint-plugin-node-dependencies#readme",
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"eslint": ">=6.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"jsonc-eslint-parser": "^2.0.2",
|
|
37
|
-
"npm-package-arg": "^
|
|
38
|
-
"package-json": "^
|
|
37
|
+
"npm-package-arg": "^12.0.2",
|
|
38
|
+
"package-json": "^10.0.1",
|
|
39
39
|
"semver": "^7.3.5",
|
|
40
|
-
"synckit": "^0.
|
|
41
|
-
"
|
|
40
|
+
"synckit": "^0.11.0",
|
|
41
|
+
"undici": "^6.21.2 || ^7.8.0"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const synckit_1 = require("synckit");
|
|
16
|
-
const tunnel_agent_1 = __importDefault(require("tunnel-agent"));
|
|
17
|
-
const dynamicImport = new Function("m", "return import(m)");
|
|
18
|
-
(0, synckit_1.runAsWorker)((packageName, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
-
const m = yield dynamicImport("package-json");
|
|
20
|
-
const packageJson = (m === null || m === void 0 ? void 0 : m.default) || m;
|
|
21
|
-
return packageJson(packageName, withAutoProxy(options));
|
|
22
|
-
}));
|
|
23
|
-
function withAutoProxy(options) {
|
|
24
|
-
const PROXY_ENV = [
|
|
25
|
-
"https_proxy",
|
|
26
|
-
"HTTPS_PROXY",
|
|
27
|
-
"http_proxy",
|
|
28
|
-
"HTTP_PROXY",
|
|
29
|
-
"npm_config_https_proxy",
|
|
30
|
-
"npm_config_http_proxy",
|
|
31
|
-
];
|
|
32
|
-
const proxyStr = PROXY_ENV.map((k) => process.env[k]).find((v) => v);
|
|
33
|
-
if (proxyStr) {
|
|
34
|
-
const proxyUrl = new URL(proxyStr);
|
|
35
|
-
const tunnelOption = {
|
|
36
|
-
proxy: {
|
|
37
|
-
host: proxyUrl.hostname,
|
|
38
|
-
port: Number(proxyUrl.port),
|
|
39
|
-
proxyAuth: proxyUrl.username || proxyUrl.password
|
|
40
|
-
? `${proxyUrl.username}:${proxyUrl.password}`
|
|
41
|
-
: undefined,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
const httpAgent = tunnel_agent_1.default[`httpOverHttp${proxyUrl.protocol === "https:" ? "s" : ""}`](tunnelOption);
|
|
45
|
-
const httpsAgent = tunnel_agent_1.default[`httpsOverHttp${proxyUrl.protocol === "https:" ? "s" : ""}`](tunnelOption);
|
|
46
|
-
return Object.assign({ agent: { http: httpAgent, https: httpsAgent } }, options);
|
|
47
|
-
}
|
|
48
|
-
return options;
|
|
49
|
-
}
|