From a555b64608f282579bde6810535d769b5ca4c109 Mon Sep 17 00:00:00 2001 From: Pablo Martinez Date: Sat, 5 Aug 2023 19:15:00 -0600 Subject: [PATCH] Updated NUglify to the latest version Updated NUglify to the latest version, 1.20.6, also adding ignore errors flag. --- src/BundlerMinifier.Core/BundlerMinifier.Core.csproj | 2 +- src/BundlerMinifier.Core/Minify/JavaScriptOptions.cs | 2 ++ src/BundlerMinifier/BundlerMinifier.csproj | 2 +- src/BundlerMinifierTest/BundlerMinifierTest.csproj | 1 + src/BundlerMinifierTest/BundlerTest.cs | 9 +++++++++ src/BundlerMinifierTest/artifacts/file6.js | 3 +++ src/BundlerMinifierTest/artifacts/test10.json | 11 +++++++++++ src/BundlerMinifierTest/artifacts/test10.min.js | 1 + src/BundlerMinifierVsix/BundlerMinifierVsix.csproj | 4 ++-- src/BundlerMinifierVsix/packages.config | 2 +- 10 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 src/BundlerMinifierTest/artifacts/file6.js create mode 100644 src/BundlerMinifierTest/artifacts/test10.json create mode 100644 src/BundlerMinifierTest/artifacts/test10.min.js diff --git a/src/BundlerMinifier.Core/BundlerMinifier.Core.csproj b/src/BundlerMinifier.Core/BundlerMinifier.Core.csproj index 251ae7a5..5f06ed3c 100644 --- a/src/BundlerMinifier.Core/BundlerMinifier.Core.csproj +++ b/src/BundlerMinifier.Core/BundlerMinifier.Core.csproj @@ -29,7 +29,7 @@ - + diff --git a/src/BundlerMinifier.Core/Minify/JavaScriptOptions.cs b/src/BundlerMinifier.Core/Minify/JavaScriptOptions.cs index 36091804..c5a4e3cb 100644 --- a/src/BundlerMinifier.Core/Minify/JavaScriptOptions.cs +++ b/src/BundlerMinifier.Core/Minify/JavaScriptOptions.cs @@ -13,6 +13,8 @@ public static CodeSettings GetSettings(Bundle bundle) settings.PreserveImportantComments = GetValue(bundle, "preserveImportantComments", true) == "True"; settings.TermSemicolons = GetValue(bundle, "termSemicolons", true) == "True"; + settings.IgnoreAllErrors = GetValue(bundle, "ignoreAllErrors", false) == "True"; + if (GetValue(bundle, "renameLocals", true) == "False") settings.LocalRenaming = LocalRenaming.KeepAll; diff --git a/src/BundlerMinifier/BundlerMinifier.csproj b/src/BundlerMinifier/BundlerMinifier.csproj index d3719001..a7ad27b6 100644 --- a/src/BundlerMinifier/BundlerMinifier.csproj +++ b/src/BundlerMinifier/BundlerMinifier.csproj @@ -30,7 +30,7 @@ - + diff --git a/src/BundlerMinifierTest/BundlerMinifierTest.csproj b/src/BundlerMinifierTest/BundlerMinifierTest.csproj index dcdedf7c..5c13e133 100644 --- a/src/BundlerMinifierTest/BundlerMinifierTest.csproj +++ b/src/BundlerMinifierTest/BundlerMinifierTest.csproj @@ -24,6 +24,7 @@ + diff --git a/src/BundlerMinifierTest/BundlerTest.cs b/src/BundlerMinifierTest/BundlerTest.cs index 37f7e0c7..c25417de 100644 --- a/src/BundlerMinifierTest/BundlerTest.cs +++ b/src/BundlerMinifierTest/BundlerTest.cs @@ -221,5 +221,14 @@ public void SupportDoubleAsteriskOperator() Assert.AreEqual("function r(n,t){return n**t}let x=2**5.1,y=3**x,z=2**81,p=21;", jsResult); } + + + [TestMethod] + public void SupportIngoreError() + { + _processor.Process(TEST_BUNDLE.Replace("test1", "test10")); + string jsResult = File.ReadAllText("../../../artifacts/test10.min.js"); + Assert.AreEqual("function throw(n){throw new Error(n);}", jsResult); + } } } diff --git a/src/BundlerMinifierTest/artifacts/file6.js b/src/BundlerMinifierTest/artifacts/file6.js new file mode 100644 index 00000000..174bfa18 --- /dev/null +++ b/src/BundlerMinifierTest/artifacts/file6.js @@ -0,0 +1,3 @@ +function throw (str){ + throw new Error(str); +} \ No newline at end of file diff --git a/src/BundlerMinifierTest/artifacts/test10.json b/src/BundlerMinifierTest/artifacts/test10.json new file mode 100644 index 00000000..5e9254f3 --- /dev/null +++ b/src/BundlerMinifierTest/artifacts/test10.json @@ -0,0 +1,11 @@ +[ + { + "outputFileName": "test10.min.js", + "inputFiles": [ + "file6.js" + ], + "minify": { + "ignoreAllErrors": true + } + } +] \ No newline at end of file diff --git a/src/BundlerMinifierTest/artifacts/test10.min.js b/src/BundlerMinifierTest/artifacts/test10.min.js new file mode 100644 index 00000000..0606cb5b --- /dev/null +++ b/src/BundlerMinifierTest/artifacts/test10.min.js @@ -0,0 +1 @@ +function throw(n){throw new Error(n);} \ No newline at end of file diff --git a/src/BundlerMinifierVsix/BundlerMinifierVsix.csproj b/src/BundlerMinifierVsix/BundlerMinifierVsix.csproj index a1e64484..bf3c2b68 100644 --- a/src/BundlerMinifierVsix/BundlerMinifierVsix.csproj +++ b/src/BundlerMinifierVsix/BundlerMinifierVsix.csproj @@ -258,8 +258,8 @@ ..\..\packages\NuGet.VisualStudio.3.5.0\lib\net45\NuGet.VisualStudio.dll True - - ..\..\packages\NUglify.1.13.8\lib\net40\NUglify.dll + + ..\..\packages\NUglify.1.20.7\lib\net40\NUglify.dll diff --git a/src/BundlerMinifierVsix/packages.config b/src/BundlerMinifierVsix/packages.config index b318a1ec..3b6402d4 100644 --- a/src/BundlerMinifierVsix/packages.config +++ b/src/BundlerMinifierVsix/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file