New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@perfsee/plugin-utils

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@perfsee/plugin-utils - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

5

dist/build-upload-client.d.ts

@@ -29,7 +29,2 @@ import { PerfseeReportStats } from '@perfsee/bundle-analyzer';

uploadBuild(stats: PerfseeReportStats): Promise<void>;
/**
* for some huge project, the stats json may be too big to be stringified(more than 500MB, which is the MAXMUM string size of v8),
* we choose msgpack instead of streaming json to dick so we can both save the disk size
* and reduce the network transfer time during uploading.
*/
private writeStats;

@@ -36,0 +31,0 @@ private pack;

62

dist/build-upload-client.js

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

const zlib_1 = require("zlib");
const msgpack_stream_1 = require("@eyhn/msgpack-stream");
const chalk_1 = tslib_1.__importDefault(require("chalk"));

@@ -31,5 +30,5 @@ const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));

const uuid_1 = require("uuid");
const jsonr_1 = tslib_1.__importDefault(require("@perfsee/jsonr"));
const utils_1 = require("@perfsee/utils");
const build_env_1 = require("./build-env");
const msgpackExtensionCodec = new msgpack_stream_1.ExtensionCodec();
const filteredFields = [

@@ -45,20 +44,4 @@ 'identifier',

];
msgpackExtensionCodec.register({
type: 0,
encode: (object) => {
if (object instanceof Object && !(object instanceof Array)) {
for (const field of filteredFields) {
delete object[field];
}
}
return null;
},
decode: () => null,
});
function encodeStatsJsonStream(stats) {
return (0, msgpack_stream_1.encodeStream)(stats, { extensionCodec: msgpackExtensionCodec });
}
function encodeStatsJson(stats) {
const encoded = (0, msgpack_stream_1.encode)(stats, { extensionCodec: msgpackExtensionCodec });
return Buffer.from(encoded, encoded.byteOffset, encoded.byteLength);
return jsonr_1.default.stringifyStream(stats, (key, v) => (filteredFields.includes(key) ? undefined : v));
}

@@ -81,3 +64,3 @@ class BuildUploadClient {

// firstly write stats json down to disk in output path.
const statsPath = await this.writeStats(stats, !!this.options.useExperimentalStreamEncoder);
const statsPath = await this.writeStats(stats);
// then pack the assets in output path

@@ -96,32 +79,13 @@ const packPath = await this.pack(statsPath, stats);

}
/**
* for some huge project, the stats json may be too big to be stringified(more than 500MB, which is the MAXMUM string size of v8),
* we choose msgpack instead of streaming json to dick so we can both save the disk size
* and reduce the network transfer time during uploading.
*/
async writeStats(stats, stream) {
const statsFile = (0, path_1.join)(this.outputPath, `webpack-stats-${(0, uuid_1.v4)()}.mp.gz`);
async writeStats(stats) {
const statsFile = (0, path_1.join)(this.outputPath, `webpack-stats-${(0, uuid_1.v4)()}.jsonr.gz`);
return new Promise((resolve, reject) => {
if (stream) {
(0, stream_1.pipeline)(encodeStatsJsonStream(stats), (0, zlib_1.createGzip)(), (0, fs_1.createWriteStream)(statsFile), (err) => {
if (err) {
reject(err);
}
else {
resolve(statsFile);
}
});
}
else {
const source$ = new stream_1.PassThrough();
(0, stream_1.pipeline)(source$, (0, zlib_1.createGzip)(), (0, fs_1.createWriteStream)(statsFile), (err) => {
if (err) {
reject(err);
}
else {
resolve(statsFile);
}
});
source$.end(encodeStatsJson(stats));
}
(0, stream_1.pipeline)(encodeStatsJson(stats), (0, zlib_1.createGzip)(), (0, fs_1.createWriteStream)(statsFile), (err) => {
if (err) {
reject(err);
}
else {
resolve(statsFile);
}
});
});

@@ -128,0 +92,0 @@ }

@@ -77,11 +77,4 @@ import { BundleResult, PerfseeReportStats } from '@perfsee/bundle-analyzer';

token?: string;
/**
* Use streaming to encode data, reducing memory usage.
*
* @default false
* @experimental
*/
useExperimentalStreamEncoder?: boolean;
}
export declare function getDefaultOptions(): Required<Pick<CommonPluginOptions, 'artifactName' | 'enableAudit' | 'token' | 'toolkit' | 'useExperimentalStreamEncoder'>>;
export declare function getDefaultOptions(): Required<Pick<CommonPluginOptions, 'artifactName' | 'enableAudit' | 'token' | 'toolkit'>>;
export declare function initOptions(userOptions: CommonPluginOptions): CommonPluginOptions;

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

toolkit: 'webpack',
useExperimentalStreamEncoder: false,
};

@@ -30,0 +29,0 @@ }

{
"name": "@perfsee/plugin-utils",
"version": "1.5.0",
"version": "1.6.0",
"description": "pertsuite plugin utilities",

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

"dependencies": {
"@eyhn/msgpack-stream": "^2.8.4",
"@perfsee/bundle-analyzer": "1.4.0",
"@perfsee/bundle-analyzer": "1.6.0",
"@perfsee/jsonr": "1.6.0",
"@perfsee/utils": "1.3.0",

@@ -48,3 +48,3 @@ "chalk": "^4.1.2",

},
"gitHead": "90f2555bd6bcf384278b7efbf6a0f719f0bed4db"
"gitHead": "25f311cef2d02f0621762f55195d52621ed98620"
}

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

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