Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@speedy-js/code-helper-diagnostic

Package Overview
Dependencies
Maintainers
9
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@speedy-js/code-helper-diagnostic - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

lib/diagnostic/types.d.ts

5

lib/linter/rules/duplicate-package/index.js

@@ -35,8 +35,7 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
const packages = yield Promise.all(compilers.map((compiler) => __awaiter(this, void 0, void 0, function* () {
const dupPackages = (yield Promise.all(compilers.map((compiler) => __awaiter(this, void 0, void 0, function* () {
const pkg = new map_1.PackageMap(moduleGraphMap.get(compiler));
yield pkg.createTree();
return pkg.getDuplicatePackages(config);
})));
const dupPackages = (0, utils_1.mergeDuplicatePackages)(packages);
})))).reduce((ans, item) => ans.concat(item), []);
const graphData = (0, utils_1.getGraphList)(dupPackages);

@@ -43,0 +42,0 @@ if (graphData.length) {

1

lib/linter/rules/duplicate-package/package.d.ts

@@ -18,3 +18,2 @@ import type { Dependency } from './dependency';

isSame(pkg: Package): boolean;
toKey(): string;
addDependency(dep: Dependency): void;

@@ -21,0 +20,0 @@ addImported(pkg: Package): void;

@@ -92,5 +92,2 @@ "use strict";

}
toKey() {
return `${this.name}@${this.version}::${this.root}`;
}
addDependency(dep) {

@@ -97,0 +94,0 @@ if (this.dependencies.every((item) => item.refFile !== dep.refFile || !item.dep.isSame(dep.dep))) {

@@ -5,5 +5,4 @@ import type { Chalk } from 'chalk';

export declare function getErrorMsg(packages: Package[], chalk: Chalk, root: string): string;
export declare function getGraphData(_package: Package, cache?: Set<string>): GraphData;
export declare function getGraphData(_package: Package): GraphData;
export declare function getGraphList(dupPackages: Package[][]): GraphDataList[];
export declare function mergeDuplicatePackages(packages: Package[][][]): Package[][];
//# sourceMappingURL=utils.d.ts.map

@@ -6,5 +6,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeDuplicatePackages = exports.getGraphList = exports.getGraphData = exports.getErrorMsg = void 0;
exports.getGraphList = exports.getGraphData = exports.getErrorMsg = void 0;
const path_1 = __importDefault(require("path"));
const speedy_utils_1 = require("@speedy-js/speedy-utils");
function getErrorMsg(packages, chalk, root) {

@@ -19,3 +18,3 @@ const pkgName = packages[0].name;

exports.getErrorMsg = getErrorMsg;
function getGraphData(_package, cache = new Set()) {
function getGraphData(_package) {
var _a;

@@ -33,16 +32,12 @@ const data = {

});
for (const pkg of (_a = _package === null || _package === void 0 ? void 0 : _package.imported) !== null && _a !== void 0 ? _a : []) {
const label = `${pkg.name}@${pkg.version}`;
data.edges.push({
source: `${_package.name}@${_package.version}`,
target: label,
if ((_a = _package === null || _package === void 0 ? void 0 : _package.imported) === null || _a === void 0 ? void 0 : _a.length) {
_package.imported.map((pkg) => {
data.edges.push({
source: `${_package.name}@${_package.version}`,
target: `${pkg.name}@${pkg.version}`,
});
const result = getGraphData(pkg);
data.nodes.push(...result.nodes);
data.edges.push(...result.edges);
});
// 访问过则跳过
if (cache.has(label)) {
continue;
}
cache.add(label);
const result = getGraphData(pkg, cache);
data.nodes.push(...result.nodes);
data.edges.push(...result.edges);
}

@@ -56,3 +51,3 @@ return data;

const list = [];
for (const _package of pkg) {
pkg.forEach((_package) => {
const data = {

@@ -66,3 +61,3 @@ name: `${_package.name}@${_package.version}`,

list.push(data);
}
});
result.push(list);

@@ -73,21 +68,2 @@ }

exports.getGraphList = getGraphList;
function mergeDuplicatePackages(packages) {
const data = [];
// 合并所有同名包
for (const pkg of packages.flat(3)) {
const index = data.findIndex((list) => list[0].name === pkg.name);
if (index >= 0) {
data[index].push(pkg);
}
else {
data.push([pkg]);
}
}
// 去除所有重复包
for (let i = 0; i < data.length; i++) {
data[i] = (0, speedy_utils_1.unique)(data[i], (pkg) => pkg.toKey());
}
return data;
}
exports.mergeDuplicatePackages = mergeDuplicatePackages;
//# sourceMappingURL=utils.js.map
{
"name": "@speedy-js/code-helper-diagnostic",
"version": "1.3.0",
"version": "1.4.0",
"description": "",

@@ -20,3 +20,3 @@ "keywords": [],

"@babel/traverse": "7.18.6",
"@speedy-js/speedy-utils": "0.13.2-alpha.17",
"@speedy-js/speedy-utils": "0.13.2-webpack.12",
"lines-and-columns": "2.0.3",

@@ -27,9 +27,9 @@ "look-it-up": "2.1.0"

"@speedy-js/config": "0.8.0-3",
"@speedy-js/code-helper-types": "1.2.0",
"@speedy-js/code-helper-types": "1.3.0",
"@speedy-js/esbuild": "0.14.28-speedy-5",
"@speedy-js/eslint-config": "0.0.1",
"@speedy-js/speedy-config-loader": "0.13.2-alpha.17",
"@speedy-js/speedy-error": "0.13.2-alpha.17",
"@speedy-js/speedy-logger": "0.13.2-alpha.17",
"@speedy-js/speedy-types": "0.13.2-alpha.17",
"@speedy-js/speedy-config-loader": "0.13.2-webpack.12",
"@speedy-js/speedy-error": "0.13.2-webpack.12",
"@speedy-js/speedy-logger": "0.13.2-webpack.12",
"@speedy-js/speedy-types": "0.13.2-webpack.12",
"@speedy-js/test-toolkit": "0.9.2-alpha.2",

@@ -36,0 +36,0 @@ "@types/babel__traverse": "7.17.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc