Comparing version 5.9.0 to 5.10.0
# Changelog | ||
## v5.10.0 | ||
- Massive optimization to max_line_len (#1109) | ||
- Basic support for import assertions | ||
- Marked ES2022 Object.hasOwn as a pure function | ||
- Fix `delete optional?.property` | ||
- New CI/CD pipeline with github actions (#1057) | ||
- Fix reordering of switch branches (#1092), (#1084) | ||
- Fix error when creating a class property called `get` | ||
- Acorn dependency is now an optional peerDependency | ||
- Fix mangling collision with exported variables (#1072) | ||
- Fix an issue with `return someVariable = (async () => { ... })()` (#1073) | ||
## v5.9.0 | ||
@@ -4,0 +17,0 @@ |
@@ -892,3 +892,3 @@ /*********************************************************************** | ||
var AST_Import = DEFNODE("Import", "imported_name imported_names module_name", { | ||
var AST_Import = DEFNODE("Import", "imported_name imported_names module_name assert_clause", { | ||
$documentation: "An `import` statement", | ||
@@ -899,2 +899,3 @@ $propdoc: { | ||
module_name: "[AST_String] String literal describing where this module came from", | ||
assert_clause: "[AST_Object?] The import assertion" | ||
}, | ||
@@ -928,3 +929,3 @@ _walk: function(visitor) { | ||
var AST_Export = DEFNODE("Export", "exported_definition exported_value is_default exported_names module_name", { | ||
var AST_Export = DEFNODE("Export", "exported_definition exported_value is_default exported_names module_name assert_clause", { | ||
$documentation: "An `export` statement", | ||
@@ -936,3 +937,4 @@ $propdoc: { | ||
module_name: "[AST_String?] Name of the file to load exports from", | ||
is_default: "[Boolean] Whether this is the default exported value of this module" | ||
is_default: "[Boolean] Whether this is the default exported value of this module", | ||
assert_clause: "[AST_Object?] The import assertion" | ||
}, | ||
@@ -939,0 +941,0 @@ _walk: function (visitor) { |
@@ -157,2 +157,3 @@ /*********************************************************************** | ||
"isSealed", | ||
"hasOwn", | ||
"keys", | ||
@@ -159,0 +160,0 @@ ], |
@@ -161,2 +161,3 @@ /*********************************************************************** | ||
} from "./ast.js"; | ||
import { is_basic_identifier_string } from "./parse.js"; | ||
@@ -183,2 +184,20 @@ (function() { | ||
const assert_clause_from_moz = (assertions) => { | ||
if (assertions && assertions.length > 0) { | ||
return new AST_Object({ | ||
start: my_start_token(assertions), | ||
end: my_end_token(assertions), | ||
properties: assertions.map((assertion_kv) => | ||
new AST_ObjectKeyVal({ | ||
start: my_start_token(assertion_kv), | ||
end: my_end_token(assertion_kv), | ||
key: assertion_kv.key.name || assertion_kv.key.value, | ||
value: from_moz(assertion_kv.value) | ||
}) | ||
) | ||
}); | ||
} | ||
return null; | ||
}; | ||
var MOZ_TO_ME = { | ||
@@ -504,3 +523,4 @@ Program: function(M) { | ||
imported_names : imported_names, | ||
module_name : from_moz(M.source) | ||
module_name : from_moz(M.source), | ||
assert_clause: assert_clause_from_moz(M.assertions) | ||
}); | ||
@@ -518,3 +538,4 @@ }, | ||
], | ||
module_name: from_moz(M.source) | ||
module_name: from_moz(M.source), | ||
assert_clause: assert_clause_from_moz(M.assertions) | ||
}); | ||
@@ -533,3 +554,4 @@ }, | ||
}) : null, | ||
module_name: from_moz(M.source) | ||
module_name: from_moz(M.source), | ||
assert_clause: assert_clause_from_moz(M.assertions) | ||
}); | ||
@@ -826,2 +848,19 @@ }, | ||
const assert_clause_to_moz = assert_clause => { | ||
const assertions = []; | ||
if (assert_clause) { | ||
for (const { key, value } of assert_clause.properties) { | ||
const key_moz = is_basic_identifier_string(key) | ||
? { type: "Identifier", name: key } | ||
: { type: "Literal", value: key, raw: JSON.stringify(key) }; | ||
assertions.push({ | ||
type: "ImportAttribute", | ||
key: key_moz, | ||
value: to_moz(value) | ||
}); | ||
} | ||
} | ||
return assertions; | ||
}; | ||
def_to_moz(AST_Export, function To_Moz_ExportDeclaration(M) { | ||
@@ -832,3 +871,4 @@ if (M.exported_names) { | ||
type: "ExportAllDeclaration", | ||
source: to_moz(M.module_name) | ||
source: to_moz(M.module_name), | ||
assertions: assert_clause_to_moz(M.assert_clause) | ||
}; | ||
@@ -846,3 +886,4 @@ } | ||
declaration: to_moz(M.exported_definition), | ||
source: to_moz(M.module_name) | ||
source: to_moz(M.module_name), | ||
assertions: assert_clause_to_moz(M.assert_clause) | ||
}; | ||
@@ -881,3 +922,4 @@ } | ||
specifiers: specifiers, | ||
source: to_moz(M.module_name) | ||
source: to_moz(M.module_name), | ||
assertions: assert_clause_to_moz(M.assert_clause) | ||
}; | ||
@@ -884,0 +926,0 @@ }); |
@@ -784,2 +784,4 @@ /*********************************************************************** | ||
const mangled_names = this.mangled_names = new Set(); | ||
unmangleable_names = new Set(); | ||
if (options.cache) { | ||
@@ -837,3 +839,2 @@ this.globals.forEach(collect); | ||
if (options.keep_fnames || options.keep_classnames) { | ||
unmangleable_names = new Set(); | ||
// Collect a set of short names which are unmangleable, | ||
@@ -854,5 +855,5 @@ // for use in avoiding collisions in next_mangled. | ||
function collect(symbol) { | ||
const should_mangle = !options.reserved.has(symbol.name) | ||
&& !(symbol.export & MASK_EXPORT_DONT_MANGLE); | ||
if (should_mangle) { | ||
if (symbol.export & MASK_EXPORT_DONT_MANGLE) { | ||
unmangleable_names.add(symbol.name); | ||
} else if (!options.reserved.has(symbol.name)) { | ||
to_mangle.push(symbol); | ||
@@ -859,0 +860,0 @@ } |
@@ -7,3 +7,3 @@ { | ||
"license": "BSD-2-Clause", | ||
"version": "5.9.0", | ||
"version": "5.10.0", | ||
"engines": { | ||
@@ -53,3 +53,2 @@ "node": ">=10" | ||
"@ls-lint/ls-lint": "^1.10.0", | ||
"acorn": "^8.5.0", | ||
"astring": "^1.7.5", | ||
@@ -65,2 +64,10 @@ "eslint": "^7.32.0", | ||
}, | ||
"peerDependencies": { | ||
"acorn": "^8.5.0" | ||
}, | ||
"peerDependenciesMeta": { | ||
"acorn": { | ||
"optional": true | ||
} | ||
}, | ||
"scripts": { | ||
@@ -67,0 +74,0 @@ "test": "node test/compress.js && mocha test/mocha", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1926142
10
40
54554
4
2