🚀 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.12.0

3

dist/bin/cli.js

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

})
.strict()
.help()

@@ -87,3 +86,3 @@ .parseSync();

title,
data,
data: JSON.stringify(data),
});

@@ -90,0 +89,0 @@ await fs_1.promises.mkdir(path_1.default.dirname(filename), { recursive: true });

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

};
const stringData = (0, module_mapper_1.replaceHashPlaceholders)(data);
const fileContent = await (0, render_template_1.renderTemplate)(template, {
title,
data,
data: stringData,
});

@@ -141,0 +142,0 @@ if (opts.emitFile) {

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

import { ModuleMeta, ModuleLengths, ModuleUID } from "../shared/types";
import { ModuleMeta, ModuleLengths, ModuleUID, VisualizerData } from "../shared/types";
export declare const getDataHash: (json: string) => string;
export declare const replaceHashPlaceholders: (data: VisualizerData) => string;
export declare class ModuleMapper {

@@ -6,4 +8,6 @@ private projectRoot;

private nodeMetas;
private counter;
constructor(projectRoot: string | RegExp);
trimProjectRootId(moduleId: string): string;
uniqueId(): ModuleUID;
getModuleUid(moduleId: string): ModuleUID;

@@ -10,0 +14,0 @@ getBundleModuleUid(bundleId: string, moduleId: string): ModuleUID;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModuleMapper = void 0;
const uid_1 = require("./uid");
const nanoid = (0, uid_1.getUid)("1234567890abcdef", 4);
const UNIQUE_PREFIX = nanoid();
let COUNTER = 0;
const uniqueId = () => `${UNIQUE_PREFIX}-${COUNTER++}`;
exports.ModuleMapper = exports.replaceHashPlaceholders = exports.getDataHash = void 0;
const crypto = __importStar(require("crypto"));
const HASH_PLACEHOLDER = "!{ROLLUP_VISUALIZER_HASH_PLACEHOLDER}";
const HASH_PLACEHOLDER_REGEXP = new RegExp(`"${HASH_PLACEHOLDER}-(\\d+)"`, "g");
const getDataHash = (json) => {
const hash = crypto.createHash("sha1").update(json).digest("hex");
const hashSub = hash.substring(0, 8);
return hashSub;
};
exports.getDataHash = getDataHash;
const replaceHashPlaceholders = (data) => {
const json = JSON.stringify(data);
const hash = (0, exports.getDataHash)(json);
const jsonWithHash = json.replace(HASH_PLACEHOLDER_REGEXP, (_, num) => `"${hash}-${num}"`);
return jsonWithHash;
};
exports.replaceHashPlaceholders = replaceHashPlaceholders;
class ModuleMapper {

@@ -14,2 +48,3 @@ constructor(projectRoot) {

this.nodeMetas = {};
this.counter = 0;
}

@@ -22,6 +57,9 @@ trimProjectRootId(moduleId) {

}
uniqueId() {
return `${HASH_PLACEHOLDER}-${this.counter++}`;
}
getModuleUid(moduleId) {
if (!(moduleId in this.nodeMetas)) {
this.nodeMetas[moduleId] = {
uid: uniqueId(),
uid: this.uniqueId(),
meta: {

@@ -40,3 +78,3 @@ id: this.trimProjectRootId(moduleId),

this.nodeMetas[moduleId] = {
uid: uniqueId(),
uid: this.uniqueId(),
meta: {

@@ -51,3 +89,3 @@ id: this.trimProjectRootId(moduleId),

if (!(bundleId in this.nodeMetas[moduleId].meta.moduleParts)) {
this.nodeMetas[moduleId].meta.moduleParts[bundleId] = uniqueId();
this.nodeMetas[moduleId].meta.moduleParts[bundleId] = this.uniqueId();
}

@@ -54,0 +92,0 @@ return this.nodeMetas[moduleId].meta.moduleParts[bundleId];

@@ -1,7 +0,6 @@

import { VisualizerData } from "../shared/types";
import { TemplateType } from "./template-types";
export type RenderTemplateOptions = {
data: VisualizerData;
data: string;
title: string;
};
export declare const renderTemplate: (templateType: TemplateType, options: RenderTemplateOptions) => Promise<string>;

@@ -61,7 +61,11 @@ "use strict";

]);
return buildHtmlTemplate(title, script, JSON.stringify(data), style);
return buildHtmlTemplate(title, script, data, style);
};
const outputRawData = (data) => JSON.stringify(data, null, 2);
const outputPlainTextList = (data) => {
const outputRawData = (strData) => {
const data = JSON.parse(strData);
return JSON.stringify(data, null, 2);
};
const outputPlainTextList = (strData) => {
var _a;
const data = JSON.parse(strData);
const bundles = {};

@@ -68,0 +72,0 @@ for (const meta of Object.values(data.nodeMetas)) {

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

@@ -5,0 +5,0 @@ "author": "Denis Bardadym <bardadymchik@gmail.com>",

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

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

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

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