Socket
Socket
Sign inDemoInstall

terser

Package Overview
Dependencies
Maintainers
1
Versions
178
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.27.1 to 5.27.2

3

CHANGELOG.md
# Changelog
## v5.27.2
- Recognise `this` as a reference to the surrounding class in `drop_unused`. Closes #1472
## v5.27.1

@@ -4,0 +7,0 @@ - Fixed case where `collapse_vars` inlines `await` expressions into non-async functions.

19

lib/compress/drop-unused.js

@@ -73,2 +73,3 @@ /***********************************************************************

AST_SymbolVar,
AST_This,
AST_Toplevel,

@@ -130,2 +131,3 @@ AST_Unary,

};
var this_def = null;
var in_use_ids = new Map();

@@ -142,2 +144,3 @@ var fixed_ids = new Map();

var initializations = new Map();
// pass 1: find out which symbols are directly used in

@@ -155,7 +158,2 @@ // this scope (not in nested scopes).

if (node === self) return;
if (node instanceof AST_Class) {
if (node.has_side_effects(compressor)) {
node.visit_nondeferred_class_parts(tw);
}
}
if (node instanceof AST_Defun || node instanceof AST_DefClass) {

@@ -170,2 +168,9 @@ var node_def = node.name.definition();

if (node instanceof AST_DefClass && node.has_side_effects(compressor)) {
const save_this_def = this_def;
this_def = node_def;
node.visit_nondeferred_class_parts(tw);
this_def = save_this_def;
}
map_add(initializations, node_def.id, node);

@@ -176,2 +181,6 @@ return true; // don't go in nested scopes

const in_root_scope = scope === self;
if (node instanceof AST_This && this_def && in_root_scope) {
in_use_ids.set(this_def.id, this_def);
return true;
}
if (node instanceof AST_SymbolFunarg && in_root_scope) {

@@ -178,0 +187,0 @@ map_add(var_defs_by_id, node.definition().id, node);

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

"license": "BSD-2-Clause",
"version": "5.27.1",
"version": "5.27.2",
"engines": {

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

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