🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

rollup-plugin-visualizer

Package Overview
Dependencies
Maintainers
1
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-visualizer - npm Package Compare versions

Comparing version

to
5.11.0

12

dist/bin/cli.js

@@ -9,2 +9,3 @@ #!/usr/bin/env node

const path_1 = __importDefault(require("path"));
const open_1 = __importDefault(require("open"));
const yargs_1 = __importDefault(require("yargs"));

@@ -38,6 +39,12 @@ const helpers_1 = require("yargs/helpers");

})
.option("open", {
describe: "Open generated tempate in default user agent",
type: "boolean",
default: false,
})
.strict()
.help()
.parseSync();
const listOfFiles = argv._;
const runForPluginJson = async ({ title, template, filename }, files) => {
const runForPluginJson = async ({ title, template, filename, open }, files) => {
if (files.length === 0) {

@@ -91,2 +98,5 @@ throw new Error("Empty file list");

await fs_1.promises.writeFile(filename, fileContent);
if (open) {
await (0, open_1.default)(filename);
}
};

@@ -93,0 +103,0 @@ runForPluginJson(argv, listOfFiles).catch((err) => {

20

dist/plugin/index.js

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

: defaultSizeGetter;
const ModuleLengths = async ({ id, renderedLength, code, }) => {
const getModuleLengths = async ({ id, renderedLength, code, }, useRenderedLength = false) => {
const isCodeEmpty = code == null || code == "";

@@ -64,3 +64,7 @@ const result = {

brotliLength: isCodeEmpty ? 0 : await brotliSizeGetter(code),
renderedLength: isCodeEmpty ? renderedLength : Buffer.byteLength(code, "utf-8"),
renderedLength: useRenderedLength
? renderedLength
: isCodeEmpty
? 0
: Buffer.byteLength(code, "utf-8"),
};

@@ -86,6 +90,4 @@ return result;

.filter(({ id }) => filter(bundleId, id))
.map(({ id, renderedLength }) => {
var _a;
const code = (_a = bundle.modules[id]) === null || _a === void 0 ? void 0 : _a.code;
return ModuleLengths({ id, renderedLength, code });
.map(({ id, renderedLength, code }) => {
return getModuleLengths({ id, renderedLength, code: code.join("") }, true);
}));

@@ -97,11 +99,11 @@ tree = (0, data_1.buildTree)(bundleId, moduleRenderInfo, mapper);

.filter(([id]) => filter(bundleId, id))
.map(([id, { renderedLength, code }]) => ModuleLengths({ id, renderedLength, code })));
.map(([id, { renderedLength, code }]) => getModuleLengths({ id, renderedLength, code }), false));
tree = (0, data_1.buildTree)(bundleId, modules, mapper);
}
if (tree.children.length === 0) {
const bundleSizes = await ModuleLengths({
const bundleSizes = await getModuleLengths({
id: bundleId,
renderedLength: bundle.code.length,
code: bundle.code,
});
}, false);
const facadeModuleId = (_h = bundle.facadeModuleId) !== null && _h !== void 0 ? _h : `${bundleId}-unknown`;

@@ -108,0 +110,0 @@ const bundleUid = mapper.setNodePart(bundleId, facadeModuleId, bundleSizes);

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

trimProjectRootId(moduleId) {
if (typeof this.projectRoot === 'string' && moduleId.startsWith(this.projectRoot)) {
if (typeof this.projectRoot === "string" && moduleId.startsWith(this.projectRoot)) {
return moduleId.slice(this.projectRoot.length);

@@ -19,0 +19,0 @@ }

@@ -5,4 +5,5 @@ import { OutputChunk } from "rollup";

renderedLength: number;
code: string[];
}
export declare const getSourcemapModules: (id: string, outputChunk: OutputChunk, dir: string) => Promise<Record<string, SourceMapModuleRenderInfo>>;
export {};

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

const id = path_1.default.resolve(path_1.default.dirname(path_1.default.join(dir, bundleId)), source);
modules[id] = modules[id] || { id, renderedLength: 0 };
modules[id].renderedLength += Buffer.byteLength(codeChars[i]);
const char = codeChars[i];
modules[id] = modules[id] || { id, renderedLength: 0, code: [] };
modules[id].renderedLength += Buffer.byteLength(char);
modules[id].code.push(char);
}

@@ -25,0 +27,0 @@ if (code[i] === "\n") {

{
"name": "rollup-plugin-visualizer",
"version": "5.10.0",
"version": "5.11.0",
"main": "./dist/plugin/index.js",

@@ -48,2 +48,3 @@ "author": "Denis Bardadym <bardadymchik@gmail.com>",

"@rollup/plugin-node-resolve": "^15.0.0",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.1",

@@ -50,0 +51,0 @@ "@types/bytes": "^3.1.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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet