Socket
Socket
Sign inDemoInstall

terser

Package Overview
Dependencies
Maintainers
1
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terser - npm Package Compare versions

Comparing version 5.26.0 to 5.27.0

3

CHANGELOG.md
# Changelog
## v5.27.0
- Created `minify_sync()` alternative to `minify()` since there's no async code left.
## v5.26.0

@@ -4,0 +7,0 @@ - Do not take the `/*#__PURE__*/` annotation into account when the `side_effects` compress option is off.

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

async function minify(files, options, _fs_module) {
function* minify_sync_or_async(files, options, _fs_module) {
if (

@@ -318,3 +318,3 @@ _fs_module

}
format_options.source_map = await SourceMap({
format_options.source_map = yield* SourceMap({
file: options.sourceMap.filename,

@@ -381,5 +381,35 @@ orig: options.sourceMap.content,

async function minify(files, options, _fs_module) {
const gen = minify_sync_or_async(files, options, _fs_module);
let yielded;
let val;
do {
val = gen.next(await yielded);
yielded = val.value;
} while (!val.done);
return val.value;
}
function minify_sync(files, options, _fs_module) {
const gen = minify_sync_or_async(files, options, _fs_module);
let yielded;
let val;
do {
if (yielded && typeof yielded.then === "function") {
throw new Error("minify_sync cannot be used with the legacy source-map module");
}
val = gen.next(yielded);
yielded = val.value;
} while (!val.done);
return val.value;
}
export {
minify,
minify_sync,
to_ascii,
};

4

lib/sourcemap.js

@@ -50,3 +50,3 @@ /***********************************************************************

// a small wrapper around source-map and @jridgewell/source-map
async function SourceMap(options) {
function* SourceMap(options) {
options = defaults(options, {

@@ -74,3 +74,3 @@ file : null,

// SourceMapConsumer).
orig_map = await new SourceMapConsumer(options.orig);
orig_map = yield new SourceMapConsumer(options.orig);
if (orig_map.sourcesContent) {

@@ -77,0 +77,0 @@ orig_map.sources.forEach(function(source, i) {

@@ -5,3 +5,3 @@ import "./lib/transform.js";

export { minify } from "./lib/minify.js";
export { minify, minify_sync } from "./lib/minify.js";
export { run_cli as _run_cli } from "./lib/cli.js";

@@ -8,0 +8,0 @@

@@ -7,3 +7,3 @@ {

"license": "BSD-2-Clause",
"version": "5.26.0",
"version": "5.27.0",
"engines": {

@@ -10,0 +10,0 @@ "node": ">=10"

@@ -427,3 +427,3 @@ <h1><img src="https://terser.org/img/terser-banner-logo.png" alt="Terser" width="400"></h1>

There is a single async high level function, **`async minify(code, options)`**,
There is an async high level function, **`async minify(code, options)`**,
which will perform all minification [phases](#minify-options) in a configurable

@@ -439,2 +439,4 @@ manner. By default `minify()` will enable [`compress`](#compress-options)

There is also a `minify_sync()` alternative version of it, which returns instantly.
You can `minify` more than one JavaScript file at a time by using an object

@@ -441,0 +443,0 @@ for the first argument where the keys are file names and the values are source

@@ -216,1 +216,2 @@ /// <reference lib="es2015" />

export function minify(files: string | string[] | { [file: string]: string }, options?: MinifyOptions): Promise<MinifyOutput>;
export function minify_sync(files: string | string[] | { [file: string]: string }, options?: MinifyOptions): MinifyOutput;

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