Socket
Socket
Sign inDemoInstall

@perfsee/webpack

Package Overview
Dependencies
Maintainers
5
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@perfsee/webpack - npm Package Compare versions

Comparing version 1.12.2 to 1.13.0

2

dist/index.d.ts

@@ -16,4 +16,6 @@ import { WebpackPluginInstance, Compiler } from 'webpack';

apply: (compiler: Compiler) => void;
private parseModuleSource;
private readonly collectModuleSources;
private readonly handleEmit;
private readonly afterEmit;
}

@@ -78,2 +78,11 @@ "use strict";

};
this.collectModuleSources = (compilation) => {
try {
const reasonsMap = bundle_analyzer_1.StatsParser.FromStats(this.stats, this.outputPath).parseReasons();
compilation.modules.forEach((module) => this.parseModuleSource(module, reasonsMap));
}
catch (e) {
console.error(chalk_1.default.red(`Collect module sources failed, due to: ${e.message}`));
}
};
this.handleEmit = (compilation) => {

@@ -85,2 +94,3 @@ if (!this.outputPath) {

this.setStats(compilation.getStats());
this.collectModuleSources(compilation);
}

@@ -125,2 +135,40 @@ catch (e) {

}
parseModuleSource(module, reasonsMap) {
var _a;
// @ts-expect-error
module.modules?.forEach((module) => this.parseModuleSource(module, reasonsMap));
const source = module.originalSource()?.source();
if (!source) {
return;
}
const id = (0, bundle_analyzer_1.hashCode)(module.identifier());
if (source instanceof Buffer || !source || !id) {
return;
}
const reasons = reasonsMap.get(id);
if (!reasons?.length) {
return;
}
const lines = reasons
.map((r) => r[1]?.split(':')[0])
.filter(Boolean)
.map((l) => Number(l) - 1);
const sourceFiltered = source
.split('\n')
.map((lineSource, lineNum) => {
if (lines.some((l) => Math.abs(l - lineNum) <= 1)) {
return lineSource || ' ';
}
return '';
})
.join('\n');
const path = module.nameForCondition();
(_a = this.stats).moduleReasons || (_a.moduleReasons = {
moduleSource: {},
});
this.stats.moduleReasons.moduleSource[id] = [
path ? (0, path_1.relative)(this.stats.buildPath, path) : 'unkown',
sourceFiltered,
];
}
}

@@ -127,0 +175,0 @@ exports.PerfseePlugin = PerfseePlugin;

10

package.json
{
"name": "@perfsee/webpack",
"version": "1.12.2",
"version": "1.13.0",
"description": "perfsee webpack plugin",

@@ -22,4 +22,4 @@ "repository": "https://github.com/perfsee/perfsee",

"dependencies": {
"@perfsee/bundle-analyzer": "1.10.0",
"@perfsee/plugin-utils": "1.12.2",
"@perfsee/bundle-analyzer": "1.13.0",
"@perfsee/plugin-utils": "1.13.0",
"chalk": "^4.1.2",

@@ -32,3 +32,3 @@ "tslib": "^2.4.0"

"devDependencies": {
"@perfsee/package": "1.12.2"
"@perfsee/package": "1.13.0"
},

@@ -38,3 +38,3 @@ "scripts": {

},
"gitHead": "555355c0878dea8cc5859fbe591052f438931f08"
"gitHead": "aeadc065a44054a87b72ae35f794046c27008433"
}

@@ -108,3 +108,26 @@ # `@perfsee/webpack`

}
/**
* Used to modify the webpack stats file prcessed by perfsee plugin before uploading.
*
* Return undefined means skipping uploading.
*/
processStats?: (stats: PerfseeReportStats) => undefined | PerfseeReportStats
/**
* Rules(audits) apply to this artifact
*
* Notice: Functions only works in local testing (when `enableAudit` is set to true).
*
* @default ['default']
*/
rules?: (string | Audit)[]
/**
* Whether to include auxiliary files to the bundle result.
*
* @default false
*/
includeAuxiliary?: boolean
}
```

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