Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@serwist/build

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serwist/build - npm Package Compare versions

Comparing version 8.0.3 to 8.0.4

dist/index.old.d.cts

105

dist/index.js

@@ -7,3 +7,2 @@ import assert from 'assert';

import fse from 'fs-extra';
import prettyBytes from 'pretty-bytes';
import { betterAjvErrors } from '@apideck/better-ajv-errors';

@@ -235,2 +234,106 @@ import Ajv from 'ajv';

const BYTE_UNITS = [
'B',
'kB',
'MB',
'GB',
'TB',
'PB',
'EB',
'ZB',
'YB'
];
const BIBYTE_UNITS = [
'B',
'KiB',
'MiB',
'GiB',
'TiB',
'PiB',
'EiB',
'ZiB',
'YiB'
];
const BIT_UNITS = [
'b',
'kbit',
'Mbit',
'Gbit',
'Tbit',
'Pbit',
'Ebit',
'Zbit',
'Ybit'
];
const BIBIT_UNITS = [
'b',
'kibit',
'Mibit',
'Gibit',
'Tibit',
'Pibit',
'Eibit',
'Zibit',
'Yibit'
];
/*
Formats the given number using `Number#toLocaleString`.
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
- If locale is true, the system default locale is used for translation.
- If no value for locale is specified, the number is returned unmodified.
*/ const toLocaleString = (number, locale, options)=>{
let result = number;
if (typeof locale === 'string' || Array.isArray(locale)) {
result = number.toLocaleString(locale, options);
} else if (locale === true || options !== undefined) {
result = number.toLocaleString(undefined, options);
}
return result;
};
function prettyBytes(number, options) {
if (!Number.isFinite(number)) {
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
}
options = {
bits: false,
binary: false,
space: true,
...options
};
const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
const separator = options.space ? ' ' : '';
if (options.signed && number === 0) {
return ` 0${separator}${UNITS[0]}`;
}
const isNegative = number < 0;
const prefix = isNegative ? '-' : options.signed ? '+' : '';
if (isNegative) {
number = -number;
}
let localeOptions;
if (options.minimumFractionDigits !== undefined) {
localeOptions = {
minimumFractionDigits: options.minimumFractionDigits
};
}
if (options.maximumFractionDigits !== undefined) {
localeOptions = {
maximumFractionDigits: options.maximumFractionDigits,
...localeOptions
};
}
if (number < 1) {
const numberString = toLocaleString(number, options.locale, localeOptions);
return prefix + numberString + separator + UNITS[0];
}
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
number /= (options.binary ? 1024 : 1000) ** exponent;
if (!localeOptions) {
number = number.toPrecision(3);
}
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
const unit = UNITS[exponent];
return prefix + numberString + separator + unit;
}
function maximumSizeTransform(maximumFileSizeToCacheInBytes) {

@@ -237,0 +340,0 @@ return (originalManifest)=>{

47

package.json
{
"name": "@serwist/build",
"version": "8.0.3",
"version": "8.0.4",
"type": "module",

@@ -32,5 +32,10 @@ "description": "A module that integrates into your build process, helping you generate a manifest of local files that should be precached.",

".": {
"import": "./dist/index.js",
"require": "./dist/index.old.cjs",
"types": "./dist/index.d.ts"
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.old.d.cts",
"default": "./dist/index.old.cjs"
}
},

@@ -44,5 +49,4 @@ "./package.json": "./package.json"

"fast-json-stable-stringify": "2.1.0",
"fs-extra": "11.1.1",
"fs-extra": "11.2.0",
"glob": "10.3.10",
"pretty-bytes": "6.1.1",
"rollup": "3.28.1",

@@ -53,19 +57,20 @@ "source-map": "0.8.0-beta.0",

"upath": "2.0.1",
"@serwist/background-sync": "8.0.3",
"@serwist/broadcast-update": "8.0.3",
"@serwist/cacheable-response": "8.0.3",
"@serwist/core": "8.0.3",
"@serwist/expiration": "8.0.3",
"@serwist/google-analytics": "8.0.3",
"@serwist/precaching": "8.0.3",
"@serwist/routing": "8.0.3"
"@serwist/background-sync": "8.0.4",
"@serwist/broadcast-update": "8.0.4",
"@serwist/cacheable-response": "8.0.4",
"@serwist/core": "8.0.4",
"@serwist/expiration": "8.0.4",
"@serwist/google-analytics": "8.0.4",
"@serwist/precaching": "8.0.4",
"@serwist/routing": "8.0.4"
},
"devDependencies": {
"@types/common-tags": "1.8.3",
"@types/fs-extra": "11.0.2",
"@types/node": "20.8.7",
"@types/stringify-object": "4.0.3",
"@types/strip-comments": "2.0.3",
"type-fest": "4.4.0",
"@serwist/constants": "8.0.3"
"@types/common-tags": "1.8.4",
"@types/fs-extra": "11.0.4",
"@types/node": "20.10.4",
"@types/stringify-object": "4.0.5",
"@types/strip-comments": "2.0.4",
"pretty-bytes": "6.1.1",
"type-fest": "4.8.3",
"@serwist/constants": "8.0.4"
},

@@ -72,0 +77,0 @@ "scripts": {

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