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.3.1

2

lib/diagnostic/diagnostic.js

@@ -142,3 +142,3 @@ "use strict";

logger.info(`Using the ${print.blue(name)} builder, version: ${print.blue(bundler.version)}`);
logger.info(`Start building... `);
logger.info(`Start building...`);
};

@@ -145,0 +145,0 @@ let err;

@@ -50,3 +50,4 @@ "use strict";

{
description: `Package Graph data ${chalk.bold.green('.graph-data.log')} in root directory, please check this in ${chalk.bold.green('https://diagnostic_playground.web.bytedance.net/graph')}`,
// 应该放在所有错误最后,前缀建议不要使用`[SPEEDY:DUPLICATE-PACKAGE]`以示和普通错误日志的区别
description: `Package Graph data ${chalk.bold.green('.graph-data.log')} in root, check in ${chalk.bold.green('https://diagnostic_playground.web.bytedance.net/graph')}`,
},

@@ -53,0 +54,0 @@ ],

@@ -37,6 +37,9 @@ "use strict";

const pkg = yield package_1.Package.get(item.file);
if (pkg && imported !== pkg) {
const dep = new dependency_1.Dependency(ref, pkg, imported);
this.addPackage(pkg);
this.addDependency(dep);
if (pkg) {
pkg.addModule(item);
if (imported !== pkg) {
const dep = new dependency_1.Dependency(ref, pkg, imported);
this.addPackage(pkg);
this.addDependency(dep);
}
}

@@ -43,0 +46,0 @@ if (this.cache.has(item.file)) {

@@ -0,1 +1,2 @@

import { Module } from '@speedy-js/speedy-types';
import type { Dependency } from './dependency';

@@ -13,2 +14,3 @@ interface PackageData {

dependencies: Dependency[];
modules: Map<string, Module>;
constructor(root: string, data: PackageData);

@@ -20,2 +22,4 @@ get name(): string;

toKey(): string;
getSize(): string;
addModule(module: Module): void;
addDependency(dep: Dependency): void;

@@ -22,0 +26,0 @@ addImported(pkg: Package): void;

@@ -20,2 +20,3 @@ "use strict";

const log_1 = require("../../../utils/log");
const utils_1 = require("./utils");
const packagesCache = [];

@@ -27,2 +28,3 @@ const packagesMap = new Map();

this.dependencies = [];
this.modules = new Map();
this.root = root;

@@ -97,2 +99,12 @@ this.data = data;

}
getSize() {
const modules = Array.from(this.modules.values());
const size = modules.reduce((ans, item) => { var _a; return ans + Buffer.from((_a = item.content) !== null && _a !== void 0 ? _a : '').byteLength; }, 0);
return (0, utils_1.toSizeString)(size);
}
addModule(module) {
if (!this.modules.has(module.id)) {
this.modules.set(module.id, module);
}
}
addDependency(dep) {

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

@@ -8,2 +8,3 @@ import type { Chalk } from 'chalk';

export declare function mergeDuplicatePackages(packages: Package[][][]): Package[][];
export declare function toSizeString(size: number): string;
//# sourceMappingURL=utils.d.ts.map

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeDuplicatePackages = exports.getGraphList = exports.getGraphData = exports.getErrorMsg = void 0;
exports.toSizeString = exports.mergeDuplicatePackages = exports.getGraphList = exports.getGraphData = exports.getErrorMsg = void 0;
const path_1 = __importDefault(require("path"));

@@ -14,3 +14,3 @@ const speedy_utils_1 = require("@speedy-js/speedy-utils");

for (const pkg of packages) {
message += ` ${chalk.bold.green(pkg.version)} ${chalk.bold(path_1.default.relative(root, pkg.root))}\n`;
message += ` ${chalk.bold.green(pkg.version)} ${chalk.cyan.bold(pkg.getSize())} ${chalk.bold(path_1.default.relative(root, pkg.root))}\n`;
}

@@ -89,2 +89,15 @@ return message.slice(0, -1);

exports.mergeDuplicatePackages = mergeDuplicatePackages;
function toSizeString(size) {
const rate = 1024;
const unit = ['B', 'kB', 'MB', 'GB'];
let rest = size;
let index = 0;
while (rest > rate) {
rest /= rate;
index++;
}
const num = Number.parseInt(rest.toFixed(2), 10);
return `${num}${unit[index]}`;
}
exports.toSizeString = toSizeString;
//# sourceMappingURL=utils.js.map
{
"name": "@speedy-js/code-helper-diagnostic",
"version": "1.3.0",
"version": "1.3.1",
"description": "",

@@ -17,6 +17,6 @@ "keywords": [],

"dependencies": {
"@babel/parser": "7.18.6",
"@babel/types": "7.18.6",
"@babel/traverse": "7.18.6",
"@speedy-js/speedy-utils": "0.13.2-alpha.17",
"@babel/parser": "7.18.13",
"@babel/types": "7.18.13",
"@babel/traverse": "7.18.13",
"@speedy-js/speedy-utils": "0.13.2-alpha.18",
"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.2.1",
"@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-alpha.18",
"@speedy-js/speedy-error": "0.13.2-alpha.18",
"@speedy-js/speedy-logger": "0.13.2-alpha.18",
"@speedy-js/speedy-types": "0.13.2-alpha.18",
"@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

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