diff --git a/.editorconfig b/.editorconfig index eaf3fae3..a2962bd0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,13 +17,10 @@ indent_style = space indent_size = 2 insert_final_newline = true -[*.{xml,config,csproj,props,targets,nuspec}] +[*.{xml,config,slnx,csproj,props,targets,nuspec}] indent_style = space indent_size = 2 -[*.sln] -insert_final_newline = true - [*.{txt,md}] indent_style = space indent_size = unset diff --git a/.gitattributes b/.gitattributes index 4fce7533..9607807f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,7 +3,7 @@ # Custom for Visual Studio *.cs diff=csharp -*.sln merge=union +*.slnx merge=union *.csproj merge=union # Standard to msysgit diff --git a/.gitignore b/.gitignore index 8a5400f1..9dafd006 100644 --- a/.gitignore +++ b/.gitignore @@ -5,12 +5,10 @@ # Node.js tools bower_components/ node_modules/ +package-lock.json -# Client side components -**/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/lib/ -**/scripts/build/ -**/styles/build/ -**/wwwroot/lib/ +# BenchmarkDotNet artifacts +BenchmarkDotNet.Artifacts/ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. @@ -18,6 +16,7 @@ node_modules/ # User-specific files .vs/ .vscode/ +.idea/ *.sln.docstates *.suo *.user @@ -60,6 +59,7 @@ PublishProfiles/ # NuGet Packages packages/ *.nupkg +*.snupkg # Others .build/ @@ -77,4 +77,12 @@ packages/ _UpgradeReport_Files/ Backup*/ UpgradeLog.htm -UpgradeLog*.XML \ No newline at end of file +UpgradeLog*.XML + +# Current project-specific folders and files +nuget/ +**/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/lib/*.min.js +**/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/lib/ +**/scripts/build/ +**/styles/build/ +**/wwwroot/lib/ \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 82628b79..b9dd11f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,234 @@ Change log ========== +## v3.30.2 - July 15, 2025 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 4.4.0 + * In JavaScriptEngineSwitcher.Yantra added support for the YantraJS version 1.2.286 + +## v3.30.1 - July 1, 2025 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 4.3.0 + +## v3.30.0 - June 16, 2025 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 4.2.2 + * In JavaScriptEngineSwitcher.NiL: + * NiL.JS was updated to version 2.6.1700 + * No longer supports a .NET 5 and 7 + * Added support for .NET 9 + +## v3.29.1 - March 14, 2025 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 4.2.1 + * In JavaScriptEngineSwitcher.V8 performed a migration to a modern API for pre-compilation of scripts + +## v3.29.0 - March 8, 2025 + * In JavaScriptEngineSwitcher.Jurassic added support for the Jurassic version of February 4, 2025 + * In JavaScriptEngineSwitcher.V8: + * Microsoft ClearScript.V8 was updated to version 7.5 (support of the V8 version 13.3.415.23) + * No longer supports a .NET Framework 4.5 + * Added support for .NET Framework 4.6.2 + * In JavaScriptEngineSwitcher.Yantra added support for the YantraJS version 1.2.282 + +## v3.28.0 - January 29, 2025 + * In JavaScriptEngineSwitcher.Jint: + * Jint was updated to version 4.2.0 + * No longer supports a .NET 6 + +## v3.27.3 - December 18, 2024 + * In JavaScriptEngineSwitcher.ChakraCore added support for the ChakraCore version of August 1, 2024 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 4.1.0 + * In JavaScriptEngineSwitcher.Jurassic added support for the Jurassic version of November 22, 2024 + * In JavaScriptEngineSwitcher.Yantra added support for the YantraJS version 1.2.246 + +## v3.27.2 - September 1, 2024 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 4.0.2 + * In JavaScriptEngineSwitcher.Yantra added support for the YantraJS version 1.2.225 + +## v3.27.1 - August 20, 2024 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 4.0.1 + * In JavaScriptEngineSwitcher.Yantra added support for the YantraJS version 1.2.218 + +## v3.27.0 - July 24, 2024 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 4.0.0 + +## v3.26.1 - June 18, 2024 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 3.1.3 + * In JavaScriptEngineSwitcher.NiL: + * NiL.JS was updated to version 2.5.1684 + * Added support for .NET 8 + +## v3.26.0 - April 22, 2024 + * In JavaScriptEngineSwitcher.ChakraCore: + * ChakraCore was updated to version of April 21, 2024 + * In `JavaScriptEngineSwitcher.ChakraCore.Native.win-*` packages an additional deployment mechanism has been added to MSBuild scripts for the case when the target platform is focused on a specific processor architecture + +## v3.25.0 - April 10, 2024 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 3.1.0 + * In JavaScriptEngineSwitcher.Yantra added support for the YantraJS version 1.2.209 + +## v3.24.2 - March 25, 2024 + * In JavaScriptEngineSwitcher.V8: + * Microsoft ClearScript.V8 was updated to version 7.4.5 (support of the V8 version 12.3.219.12) + * In configuration settings of the V8 JS engine was added two new properties: `AddPerformanceObject` (default `false`) and `SetTimerResolution` (default `false`) + +## v3.24.1 - March 7, 2024 + * Minor improvements in metadata of NuGet packages + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 3.0.1 + * In JavaScriptEngineSwitcher.Msie added support for the MSIE JavaScript Engine version 3.2.5 + +## v3.24.0 - February 6, 2024 + * In the `JsEngineSwitcher` class was added the `AllowCurrentProperty` property (default `true`) + * In JavaScriptEngineSwitcher.Extensions.MsDependencyInjection: + * `AddJsEngineSwitcher(Action)` and `AddJsEngineSwitcher(IJsEngineSwitcher, Action)` extension methods are replaced by new methods accordingly: `AddJsEngineSwitcher(Action)` and `AddJsEngineSwitcher(IJsEngineSwitcher, Action)` + * `AllowCurrentProperty` property of `JsEngineSwitcherOptions` class allows to forbid usage of the `JsEngineSwitcher.Current` property. This feature can be used to fix a [error #115](https://github.com/Taritsyn/JavaScriptEngineSwitcher/issues/115) “Concurrency issue when initializing JS engine switcher in startup”. Special thanks to [Ville Häkli](https://github.com/VilleHakli) + +## v3.23.9 - January 20, 2024 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 3.0.0 + +## v3.23.8 - January 17, 2024 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 3.0.0 RC 1 + +## v3.23.7 - January 8, 2024 + * In JavaScriptEngineSwitcher.ChakraCore fixed a error that occurred in the `ReflectionHelpers.IsAllowedProperty` method when running on .NET Core 1.0 + * In JavaScriptEngineSwitcher.Msie added support for the MSIE JavaScript Engine version 3.2.4 + +## v3.23.6 - January 6, 2024 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 3.0.0 Beta 2059 + +## v3.23.5 - December 9, 2023 + * In JavaScriptEngineSwitcher.Jint: + * Jint was updated to version 3.0.0 Beta 2057 + * Added support for .NET 8 + * In JavaScriptEngineSwitcher.Msie added support for the MSIE JavaScript Engine version 3.2.3 + * In JavaScriptEngineSwitcher.NiL added support for the NiL.JS version 2.5.1677 + +## v3.23.4 - November 11, 2023 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 3.0.0 Beta 2055 + * In JavaScriptEngineSwitcher.Yantra added support for the YantraJS version 1.2.206 + +## v3.23.3 - November 6, 2023 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 3.0.0 Beta 2054 + * In JavaScriptEngineSwitcher.Jurassic added support for the Jurassic version of November 1, 2023 + * In JavaScriptEngineSwitcher.Yantra added support for the YantraJS version 1.2.204 + +## v3.23.2 - October 26, 2023 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 3.0.0 Beta 2053 + * In JavaScriptEngineSwitcher.NiL added support for the NiL.JS version 2.5.1674 + * In JavaScriptEngineSwitcher.V8 added support for the Microsoft ClearScript.V8 version 7.4.4 (support of the V8 version 11.8.172.15) + * In JavaScriptEngineSwitcher.Yantra added support for the YantraJS version 1.2.195 + +## v3.23.1 - September 19, 2023 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 3.0.0 Beta 2052 + * In JavaScriptEngineSwitcher.Node added support for the Jering.Javascript.NodeJS version 7.0.0 + * In JavaScriptEngineSwitcher.Yantra added support for the YantraJS version 1.2.188 + +## v3.23.0 - September 8, 2023 + * In JavaScriptEngineSwitcher.NiL: + * NiL.JS was updated to version 2.5.1673 + * Restored support for .NET Framework 4.6.1 + +## v3.22.0 - September 5, 2023 + * In JavaScriptEngineSwitcher.NiL: + * NiL.JS was updated to version 2.5.1672 + * No longer supports a .NET Framework 4.6.1 + +## v3.21.6 - August 30, 2023 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 3.0.0 Beta 2051 + +## v3.21.5 - August 21, 2023 + * In JavaScriptEngineSwitcher.V8 added support for the Microsoft ClearScript.V8 version 7.4.3 (support of the V8 version 11.6.189.18) + +## v3.21.4 - August 3, 2023 + * In JavaScriptEngineSwitcher.Jint added support for the Jint version 3.0.0 Beta 2050 + * In JavaScriptEngineSwitcher.NiL added support for the NiL.JS version 2.5.1665 + * In JavaScriptEngineSwitcher.Node added support for the Jering.Javascript.NodeJS version 7.0.0 Beta 5 + * In JavaScriptEngineSwitcher.Yantra added support for the YantraJS version 1.2.179 + +## v3.21.3 - June 1, 2023 + * In JavaScriptEngineSwitcher.V8 added support of Microsoft ClearScript.V8 version 7.4.2 (support of V8 version 11.4.183.17) + * In JavaScriptEngineSwitcher.Yantra added support of YantraJS version 1.2.163 + +## v3.21.2 - May 1, 2023 + * In JavaScriptEngineSwitcher.Jint: + * The package is no longer marked as a prerelease + * In configuration settings of the Jint JS engine was added one new property - `MaxJsonParseDepth` (default `64`) + * In JavaScriptEngineSwitcher.Node: + * Jering.Javascript.NodeJS was updated to version 7.0.0 Beta 4 + * Added support of .NET 7 + +## v3.21.1 - April 11, 2023 + * In JavaScriptEngineSwitcher.Jint: + * Jint was updated to version 3.0.0 Beta 2049 + * Added support of .NET 6 + * In JavaScriptEngineSwitcher.Msie added support of MSIE JavaScript Engine version 3.2.2 + * In JavaScriptEngineSwitcher.V8 added support of Microsoft ClearScript.V8 version 7.4.1 (support of V8 version 11.2.214.13) + * In JavaScriptEngineSwitcher.Yantra added support of YantraJS version 1.2.160 + +## v3.21.0 - April 1, 2023 + * Added a module based on the [YantraJS](https://yantrajs.com). Special thanks to [Akash Kava](https://github.com/ackava) + * In JavaScriptEngineSwitcher.ChakraCore: + * ChakraCore was updated to version of January 26, 2023 + * In configuration settings of the ChakraCore JS engine was added one new property - `AllowReflection` (default `false`) + * In JavaScriptEngineSwitcher.Jint: + * Jint was updated to version 3.0.0 Beta 2048 + * In configuration settings of the Jint JS engine was added two new properties: `AllowReflection` (default `false`) and `DisableEval` (default `false`) + * In JavaScriptEngineSwitcher.Jurassic improved a conversion of results to a host types + * In JavaScriptEngineSwitcher.Msie: + * MSIE JavaScript Engine was updated to version 3.2.1 + * In configuration settings of the MSIE JS engine was added one new property - `AllowReflection` (default `false`) + * In JavaScriptEngineSwitcher.NiL added support of NiL.JS version 2.5.1661 + * In JavaScriptEngineSwitcher.V8: + * Microsoft ClearScript.V8 was updated to version 7.4.0 (support of V8 version 11.1.277.14) + * In configuration settings of the V8 JS engine was added one new property - `AllowReflection` (default `false`) + +## v3.20.10 - January 23, 2023 + * In JavaScriptEngineSwitcher.V8 added support of Microsoft ClearScript.V8 version 7.3.7 (support of V8 version 10.9.194.10) + +## v3.20.9 - January 19, 2023 + * In JavaScriptEngineSwitcher.Jint added support of Jint version 3.0.0 Beta 2046 + * In JavaScriptEngineSwitcher.NiL: + * NiL.JS was updated to version 2.5.1623 + * Added support of .NET 7.0 + +## v3.20.8 - December 20, 2022 + * In JavaScriptEngineSwitcher.Jint added support of Jint version 3.0.0 Beta 2044 + * In JavaScriptEngineSwitcher.V8 added support of Microsoft ClearScript.V8 version 7.3.6 (support of V8 version 10.8.168.24) + +## v3.20.7 - November 13, 2022 + * In JavaScriptEngineSwitcher.V8 added support of Microsoft ClearScript.V8 version 7.3.5 (support of V8 version 10.7.193.22) + +## v3.20.6 - November 11, 2022 + * In JavaScriptEngineSwitcher.ChakraCore added support of ChakraCore version of November 9, 2022 + * In JavaScriptEngineSwitcher.Jint added support of Jint version 3.0.0 Beta 2043 + +## v3.20.5 - October 12, 2022 + * In JavaScriptEngineSwitcher.ChakraCore added support of ChakraCore version of October 7, 2022 + * In JavaScriptEngineSwitcher.Jurassic added support of Jurassic version of September 20, 2022 + +## v3.20.4 - September 30, 2022 + * In JavaScriptEngineSwitcher.V8 added support of Microsoft ClearScript.V8 version 7.3.4 (support of V8 version 10.6.194.14) + +## v3.20.3 - September 28, 2022 + * In JavaScriptEngineSwitcher.V8 added support of Microsoft ClearScript.V8 version 7.3.3 (support of V8 version 10.6.194.14) + +## v3.20.2 - September 16, 2022 + * In JavaScriptEngineSwitcher.Jint the implementation of script interruption has been refactored + * In JavaScriptEngineSwitcher.V8: + * Microsoft ClearScript.V8 was updated to version 7.3.2 (support of V8 version 10.5.218.8) + * In configuration settings of the V8 JS engine was added one new property - `DisableDynamicBinding` (default `false`) + +## v3.20.1 - September 11, 2022 + * In JavaScriptEngineSwitcher.Jint added support of Jint version 3.0.0 Beta 2041 + * In JavaScriptEngineSwitcher.NiL: + * NiL.JS was updated to version 2.5.1600 + * JS run-time exception now contains a script call stack + +## v3.20.0 - August 31, 2022 + * In JavaScriptEngineSwitcher.NiL: + * NiL.JS was updated to version 2.5.1591 + * No longer supports a .NET Standard + +## v3.19.1 - August 28, 2022 + * In JavaScriptEngineSwitcher.Jint added support of Jint version 3.0.0 Beta 2040 + ## v3.19.0 - July 21, 2022 * Fixed a [error #102](https://github.com/Taritsyn/JavaScriptEngineSwitcher/issues/102) “Resources should conform to correct ICU standard for naming”. Special thanks to [Tim Heuer](https://github.com/timheuer) * In JavaScriptEngineSwitcher.Jint: diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 00000000..bbbdb4f8 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Icons/JavaScriptEngineSwitcher_Yantra_Logo128x128.png b/Icons/JavaScriptEngineSwitcher_Yantra_Logo128x128.png new file mode 100644 index 00000000..578409d3 Binary files /dev/null and b/Icons/JavaScriptEngineSwitcher_Yantra_Logo128x128.png differ diff --git a/JavaScriptEngineSwitcher.NoSamples.sln b/JavaScriptEngineSwitcher.NoSamples.sln deleted file mode 100644 index f0274683..00000000 --- a/JavaScriptEngineSwitcher.NoSamples.sln +++ /dev/null @@ -1,219 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29613.14 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{19575E10-6B8E-4CF0-B7D2-898FFF47E157}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - CHANGELOG.md = CHANGELOG.md - global.json = global.json - LICENSE.txt = LICENSE.txt - README.md = README.md - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{3FE10516-C056-4337-9C9A-5FD592430F87}" - ProjectSection(SolutionItems) = preProject - build\common.props = build\common.props - build\initialize-standard-nuspec-properties.targets = build\initialize-standard-nuspec-properties.targets - build\Key.snk = build\Key.snk - build\net40-client-target.props = build\net40-client-target.props - build\nuget-common.props = build\nuget-common.props - build\nuget-for-dotnet-lib.props = build\nuget-for-dotnet-lib.props - build\nuget-for-native-lib.props = build\nuget-for-native-lib.props - build\strong-name-signing.props = build\strong-name-signing.props - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "licenses", "licenses", "{4AB5950E-3FA8-4A77-A067-F325BFD80537}" - ProjectSection(SolutionItems) = preProject - Licenses\advanced-string-builder-license.txt = Licenses\advanced-string-builder-license.txt - Licenses\chakra-core-license.txt = Licenses\chakra-core-license.txt - Licenses\chakra-samples-license.txt = Licenses\chakra-samples-license.txt - Licenses\clearscript-license.txt = Licenses\clearscript-license.txt - Licenses\jering-javascript-nodejs-license.txt = Licenses\jering-javascript-nodejs-license.txt - Licenses\jint-license.txt = Licenses\jint-license.txt - Licenses\jsrt-dotnet-license.txt = Licenses\jsrt-dotnet-license.txt - Licenses\jurassic-license.txt = Licenses\jurassic-license.txt - Licenses\microsoft-dotnet-arcade-sdk-license.txt = Licenses\microsoft-dotnet-arcade-sdk-license.txt - Licenses\msie-javascript-engine-license.txt = Licenses\msie-javascript-engine-license.txt - Licenses\nil-license.txt = Licenses\nil-license.txt - Licenses\nodejs-license.txt = Licenses\nodejs-license.txt - Licenses\polyfills-for-old-dot-net-license.txt = Licenses\polyfills-for-old-dot-net-license.txt - Licenses\v8-license.txt = Licenses\v8-license.txt - Licenses\vroomjs-core-license.txt = Licenses\vroomjs-core-license.txt - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0C281F46-F1D2-4A1C-8560-375EDA65D680}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{53B43213-2E66-42C2-8476-600A2FD2DA75}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Core", "src\JavaScriptEngineSwitcher.Core\JavaScriptEngineSwitcher.Core.csproj", "{13559975-F99D-4B93-BF46-227C0B6E0DFB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Extensions.MsDependencyInjection", "src\JavaScriptEngineSwitcher.Extensions.MsDependencyInjection\JavaScriptEngineSwitcher.Extensions.MsDependencyInjection.csproj", "{5B693A49-BEC2-4532-ADFE-80C4AA930E27}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Msie", "src\JavaScriptEngineSwitcher.Msie\JavaScriptEngineSwitcher.Msie.csproj", "{B3C4AA95-2227-47DD-B58C-22FA589CB28D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8", "src\JavaScriptEngineSwitcher.V8\JavaScriptEngineSwitcher.V8.csproj", "{C24E1F3C-5680-463A-8703-B9F40BCDAC77}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8.Native.win-x86", "src\JavaScriptEngineSwitcher.V8.Native.win-x86\JavaScriptEngineSwitcher.V8.Native.win-x86.csproj", "{1739A011-164B-4227-B540-01BAD61F17C5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8.Native.win-x64", "src\JavaScriptEngineSwitcher.V8.Native.win-x64\JavaScriptEngineSwitcher.V8.Native.win-x64.csproj", "{4FB64080-817F-468A-B92C-F63B46E6D85F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8.Native.linux-x64", "src\JavaScriptEngineSwitcher.V8.Native.linux-x64\JavaScriptEngineSwitcher.V8.Native.linux-x64.csproj", "{D4B2AB12-57DE-43AA-9A1E-E4A5DEB59889}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8.Native.osx-x64", "src\JavaScriptEngineSwitcher.V8.Native.osx-x64\JavaScriptEngineSwitcher.V8.Native.osx-x64.csproj", "{4B727E90-AE52-41DD-B704-28A00196052C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Jurassic", "src\JavaScriptEngineSwitcher.Jurassic\JavaScriptEngineSwitcher.Jurassic.csproj", "{D31B5A77-8018-4D76-B372-325564385B2D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Jint", "src\JavaScriptEngineSwitcher.Jint\JavaScriptEngineSwitcher.Jint.csproj", "{22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore", "src\JavaScriptEngineSwitcher.ChakraCore\JavaScriptEngineSwitcher.ChakraCore.csproj", "{2EFFFC6B-E642-477F-B537-4241EBD93410}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.win-x86", "src\JavaScriptEngineSwitcher.ChakraCore.Native.win-x86\JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.csproj", "{F676D869-5715-46B0-A118-A162D9C9DEC6}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.win-x64", "src\JavaScriptEngineSwitcher.ChakraCore.Native.win-x64\JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.csproj", "{D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.win-arm", "src\JavaScriptEngineSwitcher.ChakraCore.Native.win-arm\JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.csproj", "{BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64", "src\JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64\JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.csproj", "{304EEE7F-005D-4335-80AB-DB29025740B1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64", "src\JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64\JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64.csproj", "{FF77615B-4182-4BE7-AE2B-0F9F75198490}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64", "src\JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64\JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64.csproj", "{E14C4086-9877-4658-AE39-6313039A9076}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Vroom", "src\JavaScriptEngineSwitcher.Vroom\JavaScriptEngineSwitcher.Vroom.csproj", "{238D7E69-7052-4DFC-83EF-79D3D124C12B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.NiL", "src\JavaScriptEngineSwitcher.NiL\JavaScriptEngineSwitcher.NiL.csproj", "{F0BF7975-2E8A-4EC8-8DAA-760A4302F419}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Node", "src\JavaScriptEngineSwitcher.Node\JavaScriptEngineSwitcher.Node.csproj", "{89F9DDDD-5236-4D9A-99E4-3C1358B81149}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Benchmarks", "test\JavaScriptEngineSwitcher.Benchmarks\JavaScriptEngineSwitcher.Benchmarks.csproj", "{24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Tests", "test\JavaScriptEngineSwitcher.Tests\JavaScriptEngineSwitcher.Tests.csproj", "{E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {13559975-F99D-4B93-BF46-227C0B6E0DFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {13559975-F99D-4B93-BF46-227C0B6E0DFB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {13559975-F99D-4B93-BF46-227C0B6E0DFB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {13559975-F99D-4B93-BF46-227C0B6E0DFB}.Release|Any CPU.Build.0 = Release|Any CPU - {5B693A49-BEC2-4532-ADFE-80C4AA930E27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5B693A49-BEC2-4532-ADFE-80C4AA930E27}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5B693A49-BEC2-4532-ADFE-80C4AA930E27}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5B693A49-BEC2-4532-ADFE-80C4AA930E27}.Release|Any CPU.Build.0 = Release|Any CPU - {B3C4AA95-2227-47DD-B58C-22FA589CB28D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B3C4AA95-2227-47DD-B58C-22FA589CB28D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B3C4AA95-2227-47DD-B58C-22FA589CB28D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B3C4AA95-2227-47DD-B58C-22FA589CB28D}.Release|Any CPU.Build.0 = Release|Any CPU - {C24E1F3C-5680-463A-8703-B9F40BCDAC77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C24E1F3C-5680-463A-8703-B9F40BCDAC77}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C24E1F3C-5680-463A-8703-B9F40BCDAC77}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C24E1F3C-5680-463A-8703-B9F40BCDAC77}.Release|Any CPU.Build.0 = Release|Any CPU - {1739A011-164B-4227-B540-01BAD61F17C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1739A011-164B-4227-B540-01BAD61F17C5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1739A011-164B-4227-B540-01BAD61F17C5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1739A011-164B-4227-B540-01BAD61F17C5}.Release|Any CPU.Build.0 = Release|Any CPU - {4FB64080-817F-468A-B92C-F63B46E6D85F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4FB64080-817F-468A-B92C-F63B46E6D85F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4FB64080-817F-468A-B92C-F63B46E6D85F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4FB64080-817F-468A-B92C-F63B46E6D85F}.Release|Any CPU.Build.0 = Release|Any CPU - {D4B2AB12-57DE-43AA-9A1E-E4A5DEB59889}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D4B2AB12-57DE-43AA-9A1E-E4A5DEB59889}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D4B2AB12-57DE-43AA-9A1E-E4A5DEB59889}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D4B2AB12-57DE-43AA-9A1E-E4A5DEB59889}.Release|Any CPU.Build.0 = Release|Any CPU - {4B727E90-AE52-41DD-B704-28A00196052C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4B727E90-AE52-41DD-B704-28A00196052C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4B727E90-AE52-41DD-B704-28A00196052C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4B727E90-AE52-41DD-B704-28A00196052C}.Release|Any CPU.Build.0 = Release|Any CPU - {D31B5A77-8018-4D76-B372-325564385B2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D31B5A77-8018-4D76-B372-325564385B2D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D31B5A77-8018-4D76-B372-325564385B2D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D31B5A77-8018-4D76-B372-325564385B2D}.Release|Any CPU.Build.0 = Release|Any CPU - {22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}.Release|Any CPU.Build.0 = Release|Any CPU - {2EFFFC6B-E642-477F-B537-4241EBD93410}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2EFFFC6B-E642-477F-B537-4241EBD93410}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2EFFFC6B-E642-477F-B537-4241EBD93410}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2EFFFC6B-E642-477F-B537-4241EBD93410}.Release|Any CPU.Build.0 = Release|Any CPU - {F676D869-5715-46B0-A118-A162D9C9DEC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F676D869-5715-46B0-A118-A162D9C9DEC6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F676D869-5715-46B0-A118-A162D9C9DEC6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F676D869-5715-46B0-A118-A162D9C9DEC6}.Release|Any CPU.Build.0 = Release|Any CPU - {D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}.Release|Any CPU.Build.0 = Release|Any CPU - {BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}.Release|Any CPU.Build.0 = Release|Any CPU - {304EEE7F-005D-4335-80AB-DB29025740B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {304EEE7F-005D-4335-80AB-DB29025740B1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {304EEE7F-005D-4335-80AB-DB29025740B1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {304EEE7F-005D-4335-80AB-DB29025740B1}.Release|Any CPU.Build.0 = Release|Any CPU - {FF77615B-4182-4BE7-AE2B-0F9F75198490}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FF77615B-4182-4BE7-AE2B-0F9F75198490}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FF77615B-4182-4BE7-AE2B-0F9F75198490}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FF77615B-4182-4BE7-AE2B-0F9F75198490}.Release|Any CPU.Build.0 = Release|Any CPU - {E14C4086-9877-4658-AE39-6313039A9076}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E14C4086-9877-4658-AE39-6313039A9076}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E14C4086-9877-4658-AE39-6313039A9076}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E14C4086-9877-4658-AE39-6313039A9076}.Release|Any CPU.Build.0 = Release|Any CPU - {238D7E69-7052-4DFC-83EF-79D3D124C12B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {238D7E69-7052-4DFC-83EF-79D3D124C12B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {238D7E69-7052-4DFC-83EF-79D3D124C12B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {238D7E69-7052-4DFC-83EF-79D3D124C12B}.Release|Any CPU.Build.0 = Release|Any CPU - {F0BF7975-2E8A-4EC8-8DAA-760A4302F419}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F0BF7975-2E8A-4EC8-8DAA-760A4302F419}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F0BF7975-2E8A-4EC8-8DAA-760A4302F419}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F0BF7975-2E8A-4EC8-8DAA-760A4302F419}.Release|Any CPU.Build.0 = Release|Any CPU - {89F9DDDD-5236-4D9A-99E4-3C1358B81149}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {89F9DDDD-5236-4D9A-99E4-3C1358B81149}.Debug|Any CPU.Build.0 = Debug|Any CPU - {89F9DDDD-5236-4D9A-99E4-3C1358B81149}.Release|Any CPU.ActiveCfg = Release|Any CPU - {89F9DDDD-5236-4D9A-99E4-3C1358B81149}.Release|Any CPU.Build.0 = Release|Any CPU - {24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}.Release|Any CPU.Build.0 = Release|Any CPU - {E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {13559975-F99D-4B93-BF46-227C0B6E0DFB} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {5B693A49-BEC2-4532-ADFE-80C4AA930E27} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {B3C4AA95-2227-47DD-B58C-22FA589CB28D} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {C24E1F3C-5680-463A-8703-B9F40BCDAC77} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {1739A011-164B-4227-B540-01BAD61F17C5} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {4FB64080-817F-468A-B92C-F63B46E6D85F} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {D4B2AB12-57DE-43AA-9A1E-E4A5DEB59889} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {4B727E90-AE52-41DD-B704-28A00196052C} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {D31B5A77-8018-4D76-B372-325564385B2D} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {2EFFFC6B-E642-477F-B537-4241EBD93410} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {F676D869-5715-46B0-A118-A162D9C9DEC6} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {304EEE7F-005D-4335-80AB-DB29025740B1} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {FF77615B-4182-4BE7-AE2B-0F9F75198490} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {E14C4086-9877-4658-AE39-6313039A9076} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {238D7E69-7052-4DFC-83EF-79D3D124C12B} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {F0BF7975-2E8A-4EC8-8DAA-760A4302F419} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {89F9DDDD-5236-4D9A-99E4-3C1358B81149} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE} = {53B43213-2E66-42C2-8476-600A2FD2DA75} - {E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF} = {53B43213-2E66-42C2-8476-600A2FD2DA75} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {8184BE59-ACBC-4CD1-9419-D59A0FAC6131} - EndGlobalSection -EndGlobal diff --git a/JavaScriptEngineSwitcher.NoSamples.slnx b/JavaScriptEngineSwitcher.NoSamples.slnx new file mode 100644 index 00000000..68112f6b --- /dev/null +++ b/JavaScriptEngineSwitcher.NoSamples.slnx @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/JavaScriptEngineSwitcher.sln b/JavaScriptEngineSwitcher.sln deleted file mode 100644 index 56f14613..00000000 --- a/JavaScriptEngineSwitcher.sln +++ /dev/null @@ -1,291 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31912.275 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{19575E10-6B8E-4CF0-B7D2-898FFF47E157}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - CHANGELOG.md = CHANGELOG.md - global.json = global.json - LICENSE.txt = LICENSE.txt - README.md = README.md - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{3FE10516-C056-4337-9C9A-5FD592430F87}" - ProjectSection(SolutionItems) = preProject - build\common.props = build\common.props - build\initialize-standard-nuspec-properties.targets = build\initialize-standard-nuspec-properties.targets - build\Key.snk = build\Key.snk - build\net40-client-target.props = build\net40-client-target.props - build\nuget-common.props = build\nuget-common.props - build\nuget-for-dotnet-lib.props = build\nuget-for-dotnet-lib.props - build\nuget-for-native-lib.props = build\nuget-for-native-lib.props - build\strong-name-signing.props = build\strong-name-signing.props - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "licenses", "licenses", "{4AB5950E-3FA8-4A77-A067-F325BFD80537}" - ProjectSection(SolutionItems) = preProject - Licenses\advanced-string-builder-license.txt = Licenses\advanced-string-builder-license.txt - Licenses\chakra-core-license.txt = Licenses\chakra-core-license.txt - Licenses\chakra-samples-license.txt = Licenses\chakra-samples-license.txt - Licenses\clearscript-license.txt = Licenses\clearscript-license.txt - Licenses\jint-license.txt = Licenses\jint-license.txt - Licenses\jsrt-dotnet-license.txt = Licenses\jsrt-dotnet-license.txt - Licenses\jurassic-license.txt = Licenses\jurassic-license.txt - Licenses\msie-javascript-engine-license.txt = Licenses\msie-javascript-engine-license.txt - Licenses\nil-license.txt = Licenses\nil-license.txt - Licenses\polyfills-for-old-dot-net-license.txt = Licenses\polyfills-for-old-dot-net-license.txt - Licenses\v8-license.txt = Licenses\v8-license.txt - Licenses\vroomjs-core-license.txt = Licenses\vroomjs-core-license.txt - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0C281F46-F1D2-4A1C-8560-375EDA65D680}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{53B43213-2E66-42C2-8476-600A2FD2DA75}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{E5989CB5-AACE-4D35-A8EE-26942F140DA3}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SharedData", "SharedData", "{C5173D1C-5284-4FD5-9E0D-C7FD0DC8E029}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "text-content", "text-content", "{F8CC9C7C-656D-4A76-A912-D5708009DD7C}" - ProjectSection(SolutionItems) = preProject - samples\SharedData\text-content\contact.html = samples\SharedData\text-content\contact.html - samples\SharedData\text-content\index.html = samples\SharedData\text-content\index.html - EndProjectSection -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Core", "src\JavaScriptEngineSwitcher.Core\JavaScriptEngineSwitcher.Core.csproj", "{13559975-F99D-4B93-BF46-227C0B6E0DFB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Extensions.MsDependencyInjection", "src\JavaScriptEngineSwitcher.Extensions.MsDependencyInjection\JavaScriptEngineSwitcher.Extensions.MsDependencyInjection.csproj", "{5B693A49-BEC2-4532-ADFE-80C4AA930E27}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Msie", "src\JavaScriptEngineSwitcher.Msie\JavaScriptEngineSwitcher.Msie.csproj", "{B3C4AA95-2227-47DD-B58C-22FA589CB28D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8", "src\JavaScriptEngineSwitcher.V8\JavaScriptEngineSwitcher.V8.csproj", "{C24E1F3C-5680-463A-8703-B9F40BCDAC77}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8.Native.win-x86", "src\JavaScriptEngineSwitcher.V8.Native.win-x86\JavaScriptEngineSwitcher.V8.Native.win-x86.csproj", "{1739A011-164B-4227-B540-01BAD61F17C5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8.Native.win-x64", "src\JavaScriptEngineSwitcher.V8.Native.win-x64\JavaScriptEngineSwitcher.V8.Native.win-x64.csproj", "{4FB64080-817F-468A-B92C-F63B46E6D85F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8.Native.linux-x64", "src\JavaScriptEngineSwitcher.V8.Native.linux-x64\JavaScriptEngineSwitcher.V8.Native.linux-x64.csproj", "{D4B2AB12-57DE-43AA-9A1E-E4A5DEB59889}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8.Native.osx-x64", "src\JavaScriptEngineSwitcher.V8.Native.osx-x64\JavaScriptEngineSwitcher.V8.Native.osx-x64.csproj", "{4B727E90-AE52-41DD-B704-28A00196052C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Jurassic", "src\JavaScriptEngineSwitcher.Jurassic\JavaScriptEngineSwitcher.Jurassic.csproj", "{D31B5A77-8018-4D76-B372-325564385B2D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Jint", "src\JavaScriptEngineSwitcher.Jint\JavaScriptEngineSwitcher.Jint.csproj", "{22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore", "src\JavaScriptEngineSwitcher.ChakraCore\JavaScriptEngineSwitcher.ChakraCore.csproj", "{2EFFFC6B-E642-477F-B537-4241EBD93410}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.win-x86", "src\JavaScriptEngineSwitcher.ChakraCore.Native.win-x86\JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.csproj", "{F676D869-5715-46B0-A118-A162D9C9DEC6}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.win-x64", "src\JavaScriptEngineSwitcher.ChakraCore.Native.win-x64\JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.csproj", "{D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.win-arm", "src\JavaScriptEngineSwitcher.ChakraCore.Native.win-arm\JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.csproj", "{BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64", "src\JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64\JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.csproj", "{304EEE7F-005D-4335-80AB-DB29025740B1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64", "src\JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64\JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64.csproj", "{FF77615B-4182-4BE7-AE2B-0F9F75198490}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64", "src\JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64\JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64.csproj", "{E14C4086-9877-4658-AE39-6313039A9076}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Vroom", "src\JavaScriptEngineSwitcher.Vroom\JavaScriptEngineSwitcher.Vroom.csproj", "{238D7E69-7052-4DFC-83EF-79D3D124C12B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.NiL", "src\JavaScriptEngineSwitcher.NiL\JavaScriptEngineSwitcher.NiL.csproj", "{F0BF7975-2E8A-4EC8-8DAA-760A4302F419}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Node", "src\JavaScriptEngineSwitcher.Node\JavaScriptEngineSwitcher.Node.csproj", "{89F9DDDD-5236-4D9A-99E4-3C1358B81149}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Benchmarks", "test\JavaScriptEngineSwitcher.Benchmarks\JavaScriptEngineSwitcher.Benchmarks.csproj", "{24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Tests", "test\JavaScriptEngineSwitcher.Tests\JavaScriptEngineSwitcher.Tests.csproj", "{E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Sample.Resources", "samples\JavaScriptEngineSwitcher.Sample.Resources\JavaScriptEngineSwitcher.Sample.Resources.csproj", "{62F0C0AD-15BC-42CE-9BD2-49F506FEAA54}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Sample.Logic", "samples\JavaScriptEngineSwitcher.Sample.Logic\JavaScriptEngineSwitcher.Sample.Logic.csproj", "{C434E1B5-0463-4E58-8336-87F822D07B41}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4", "samples\JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4\JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4.csproj", "{8124DF18-4A0B-4648-8B90-4A6D3E4EF2F3}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1", "samples\JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1\JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1.csproj", "{C790AD7F-55C6-4106-8D8C-8F901B7FF245}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1", "samples\JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1\JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1.csproj", "{5CA92021-B75A-40AF-B5AA-500BAF76B4D6}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21", "samples\JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21\JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21.csproj", "{0342791E-6390-4F97-9163-5CE02E4CFF07}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31", "samples\JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31\JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31.csproj", "{D0127B5A-E66B-4DA2-8C57-A8BA2A0163F4}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5", "samples\JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5\JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5.csproj", "{189376C9-49DA-4A12-9C78-CE39E8EC7731}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6", "samples\JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6\JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6.csproj", "{58321699-3715-4CA7-8036-A9F26E4C93F3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {13559975-F99D-4B93-BF46-227C0B6E0DFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {13559975-F99D-4B93-BF46-227C0B6E0DFB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {13559975-F99D-4B93-BF46-227C0B6E0DFB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {13559975-F99D-4B93-BF46-227C0B6E0DFB}.Release|Any CPU.Build.0 = Release|Any CPU - {5B693A49-BEC2-4532-ADFE-80C4AA930E27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5B693A49-BEC2-4532-ADFE-80C4AA930E27}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5B693A49-BEC2-4532-ADFE-80C4AA930E27}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5B693A49-BEC2-4532-ADFE-80C4AA930E27}.Release|Any CPU.Build.0 = Release|Any CPU - {B3C4AA95-2227-47DD-B58C-22FA589CB28D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B3C4AA95-2227-47DD-B58C-22FA589CB28D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B3C4AA95-2227-47DD-B58C-22FA589CB28D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B3C4AA95-2227-47DD-B58C-22FA589CB28D}.Release|Any CPU.Build.0 = Release|Any CPU - {C24E1F3C-5680-463A-8703-B9F40BCDAC77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C24E1F3C-5680-463A-8703-B9F40BCDAC77}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C24E1F3C-5680-463A-8703-B9F40BCDAC77}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C24E1F3C-5680-463A-8703-B9F40BCDAC77}.Release|Any CPU.Build.0 = Release|Any CPU - {1739A011-164B-4227-B540-01BAD61F17C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1739A011-164B-4227-B540-01BAD61F17C5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1739A011-164B-4227-B540-01BAD61F17C5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1739A011-164B-4227-B540-01BAD61F17C5}.Release|Any CPU.Build.0 = Release|Any CPU - {4FB64080-817F-468A-B92C-F63B46E6D85F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4FB64080-817F-468A-B92C-F63B46E6D85F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4FB64080-817F-468A-B92C-F63B46E6D85F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4FB64080-817F-468A-B92C-F63B46E6D85F}.Release|Any CPU.Build.0 = Release|Any CPU - {D4B2AB12-57DE-43AA-9A1E-E4A5DEB59889}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D4B2AB12-57DE-43AA-9A1E-E4A5DEB59889}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D4B2AB12-57DE-43AA-9A1E-E4A5DEB59889}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D4B2AB12-57DE-43AA-9A1E-E4A5DEB59889}.Release|Any CPU.Build.0 = Release|Any CPU - {4B727E90-AE52-41DD-B704-28A00196052C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4B727E90-AE52-41DD-B704-28A00196052C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4B727E90-AE52-41DD-B704-28A00196052C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4B727E90-AE52-41DD-B704-28A00196052C}.Release|Any CPU.Build.0 = Release|Any CPU - {D31B5A77-8018-4D76-B372-325564385B2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D31B5A77-8018-4D76-B372-325564385B2D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D31B5A77-8018-4D76-B372-325564385B2D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D31B5A77-8018-4D76-B372-325564385B2D}.Release|Any CPU.Build.0 = Release|Any CPU - {22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}.Release|Any CPU.Build.0 = Release|Any CPU - {2EFFFC6B-E642-477F-B537-4241EBD93410}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2EFFFC6B-E642-477F-B537-4241EBD93410}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2EFFFC6B-E642-477F-B537-4241EBD93410}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2EFFFC6B-E642-477F-B537-4241EBD93410}.Release|Any CPU.Build.0 = Release|Any CPU - {F676D869-5715-46B0-A118-A162D9C9DEC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F676D869-5715-46B0-A118-A162D9C9DEC6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F676D869-5715-46B0-A118-A162D9C9DEC6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F676D869-5715-46B0-A118-A162D9C9DEC6}.Release|Any CPU.Build.0 = Release|Any CPU - {D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}.Release|Any CPU.Build.0 = Release|Any CPU - {BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}.Release|Any CPU.Build.0 = Release|Any CPU - {304EEE7F-005D-4335-80AB-DB29025740B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {304EEE7F-005D-4335-80AB-DB29025740B1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {304EEE7F-005D-4335-80AB-DB29025740B1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {304EEE7F-005D-4335-80AB-DB29025740B1}.Release|Any CPU.Build.0 = Release|Any CPU - {FF77615B-4182-4BE7-AE2B-0F9F75198490}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FF77615B-4182-4BE7-AE2B-0F9F75198490}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FF77615B-4182-4BE7-AE2B-0F9F75198490}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FF77615B-4182-4BE7-AE2B-0F9F75198490}.Release|Any CPU.Build.0 = Release|Any CPU - {E14C4086-9877-4658-AE39-6313039A9076}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E14C4086-9877-4658-AE39-6313039A9076}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E14C4086-9877-4658-AE39-6313039A9076}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E14C4086-9877-4658-AE39-6313039A9076}.Release|Any CPU.Build.0 = Release|Any CPU - {238D7E69-7052-4DFC-83EF-79D3D124C12B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {238D7E69-7052-4DFC-83EF-79D3D124C12B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {238D7E69-7052-4DFC-83EF-79D3D124C12B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {238D7E69-7052-4DFC-83EF-79D3D124C12B}.Release|Any CPU.Build.0 = Release|Any CPU - {F0BF7975-2E8A-4EC8-8DAA-760A4302F419}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F0BF7975-2E8A-4EC8-8DAA-760A4302F419}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F0BF7975-2E8A-4EC8-8DAA-760A4302F419}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F0BF7975-2E8A-4EC8-8DAA-760A4302F419}.Release|Any CPU.Build.0 = Release|Any CPU - {89F9DDDD-5236-4D9A-99E4-3C1358B81149}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {89F9DDDD-5236-4D9A-99E4-3C1358B81149}.Debug|Any CPU.Build.0 = Debug|Any CPU - {89F9DDDD-5236-4D9A-99E4-3C1358B81149}.Release|Any CPU.ActiveCfg = Release|Any CPU - {89F9DDDD-5236-4D9A-99E4-3C1358B81149}.Release|Any CPU.Build.0 = Release|Any CPU - {24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}.Release|Any CPU.Build.0 = Release|Any CPU - {E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}.Release|Any CPU.Build.0 = Release|Any CPU - {62F0C0AD-15BC-42CE-9BD2-49F506FEAA54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {62F0C0AD-15BC-42CE-9BD2-49F506FEAA54}.Debug|Any CPU.Build.0 = Debug|Any CPU - {62F0C0AD-15BC-42CE-9BD2-49F506FEAA54}.Release|Any CPU.ActiveCfg = Release|Any CPU - {62F0C0AD-15BC-42CE-9BD2-49F506FEAA54}.Release|Any CPU.Build.0 = Release|Any CPU - {C434E1B5-0463-4E58-8336-87F822D07B41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C434E1B5-0463-4E58-8336-87F822D07B41}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C434E1B5-0463-4E58-8336-87F822D07B41}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C434E1B5-0463-4E58-8336-87F822D07B41}.Release|Any CPU.Build.0 = Release|Any CPU - {8124DF18-4A0B-4648-8B90-4A6D3E4EF2F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8124DF18-4A0B-4648-8B90-4A6D3E4EF2F3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8124DF18-4A0B-4648-8B90-4A6D3E4EF2F3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8124DF18-4A0B-4648-8B90-4A6D3E4EF2F3}.Release|Any CPU.Build.0 = Release|Any CPU - {C790AD7F-55C6-4106-8D8C-8F901B7FF245}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C790AD7F-55C6-4106-8D8C-8F901B7FF245}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C790AD7F-55C6-4106-8D8C-8F901B7FF245}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C790AD7F-55C6-4106-8D8C-8F901B7FF245}.Release|Any CPU.Build.0 = Release|Any CPU - {5CA92021-B75A-40AF-B5AA-500BAF76B4D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5CA92021-B75A-40AF-B5AA-500BAF76B4D6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5CA92021-B75A-40AF-B5AA-500BAF76B4D6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5CA92021-B75A-40AF-B5AA-500BAF76B4D6}.Release|Any CPU.Build.0 = Release|Any CPU - {0342791E-6390-4F97-9163-5CE02E4CFF07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0342791E-6390-4F97-9163-5CE02E4CFF07}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0342791E-6390-4F97-9163-5CE02E4CFF07}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0342791E-6390-4F97-9163-5CE02E4CFF07}.Release|Any CPU.Build.0 = Release|Any CPU - {D0127B5A-E66B-4DA2-8C57-A8BA2A0163F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D0127B5A-E66B-4DA2-8C57-A8BA2A0163F4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D0127B5A-E66B-4DA2-8C57-A8BA2A0163F4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D0127B5A-E66B-4DA2-8C57-A8BA2A0163F4}.Release|Any CPU.Build.0 = Release|Any CPU - {189376C9-49DA-4A12-9C78-CE39E8EC7731}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {189376C9-49DA-4A12-9C78-CE39E8EC7731}.Debug|Any CPU.Build.0 = Debug|Any CPU - {189376C9-49DA-4A12-9C78-CE39E8EC7731}.Release|Any CPU.ActiveCfg = Release|Any CPU - {189376C9-49DA-4A12-9C78-CE39E8EC7731}.Release|Any CPU.Build.0 = Release|Any CPU - {58321699-3715-4CA7-8036-A9F26E4C93F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {58321699-3715-4CA7-8036-A9F26E4C93F3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {58321699-3715-4CA7-8036-A9F26E4C93F3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {58321699-3715-4CA7-8036-A9F26E4C93F3}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {C5173D1C-5284-4FD5-9E0D-C7FD0DC8E029} = {E5989CB5-AACE-4D35-A8EE-26942F140DA3} - {F8CC9C7C-656D-4A76-A912-D5708009DD7C} = {C5173D1C-5284-4FD5-9E0D-C7FD0DC8E029} - {13559975-F99D-4B93-BF46-227C0B6E0DFB} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {5B693A49-BEC2-4532-ADFE-80C4AA930E27} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {B3C4AA95-2227-47DD-B58C-22FA589CB28D} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {C24E1F3C-5680-463A-8703-B9F40BCDAC77} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {1739A011-164B-4227-B540-01BAD61F17C5} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {4FB64080-817F-468A-B92C-F63B46E6D85F} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {D4B2AB12-57DE-43AA-9A1E-E4A5DEB59889} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {4B727E90-AE52-41DD-B704-28A00196052C} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {D31B5A77-8018-4D76-B372-325564385B2D} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {2EFFFC6B-E642-477F-B537-4241EBD93410} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {F676D869-5715-46B0-A118-A162D9C9DEC6} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {304EEE7F-005D-4335-80AB-DB29025740B1} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {FF77615B-4182-4BE7-AE2B-0F9F75198490} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {E14C4086-9877-4658-AE39-6313039A9076} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {238D7E69-7052-4DFC-83EF-79D3D124C12B} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {F0BF7975-2E8A-4EC8-8DAA-760A4302F419} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {89F9DDDD-5236-4D9A-99E4-3C1358B81149} = {0C281F46-F1D2-4A1C-8560-375EDA65D680} - {24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE} = {53B43213-2E66-42C2-8476-600A2FD2DA75} - {E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF} = {53B43213-2E66-42C2-8476-600A2FD2DA75} - {62F0C0AD-15BC-42CE-9BD2-49F506FEAA54} = {E5989CB5-AACE-4D35-A8EE-26942F140DA3} - {C434E1B5-0463-4E58-8336-87F822D07B41} = {E5989CB5-AACE-4D35-A8EE-26942F140DA3} - {8124DF18-4A0B-4648-8B90-4A6D3E4EF2F3} = {E5989CB5-AACE-4D35-A8EE-26942F140DA3} - {C790AD7F-55C6-4106-8D8C-8F901B7FF245} = {E5989CB5-AACE-4D35-A8EE-26942F140DA3} - {5CA92021-B75A-40AF-B5AA-500BAF76B4D6} = {E5989CB5-AACE-4D35-A8EE-26942F140DA3} - {0342791E-6390-4F97-9163-5CE02E4CFF07} = {E5989CB5-AACE-4D35-A8EE-26942F140DA3} - {D0127B5A-E66B-4DA2-8C57-A8BA2A0163F4} = {E5989CB5-AACE-4D35-A8EE-26942F140DA3} - {189376C9-49DA-4A12-9C78-CE39E8EC7731} = {E5989CB5-AACE-4D35-A8EE-26942F140DA3} - {58321699-3715-4CA7-8036-A9F26E4C93F3} = {E5989CB5-AACE-4D35-A8EE-26942F140DA3} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {8184BE59-ACBC-4CD1-9419-D59A0FAC6131} - EndGlobalSection -EndGlobal diff --git a/JavaScriptEngineSwitcher.slnx b/JavaScriptEngineSwitcher.slnx new file mode 100644 index 00000000..839899a5 --- /dev/null +++ b/JavaScriptEngineSwitcher.slnx @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt index 92e6da0f..a66f2b1f 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2025 Andrey Taritsyn - http://www.taritsyn.ru Apache License Version 2.0, January 2004 diff --git a/Licenses/advanced-string-builder-license.txt b/Licenses/advanced-string-builder-license.txt index fab73c68..3598e8b2 100644 --- a/Licenses/advanced-string-builder-license.txt +++ b/Licenses/advanced-string-builder-license.txt @@ -1,3 +1,5 @@ + Copyright (c) 2018-2024 Andrey Taritsyn - http://www.taritsyn.ru + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -178,7 +180,7 @@ APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" + boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a @@ -186,7 +188,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright (c) 2018 Andrey Taritsyn - http://www.taritsyn.ru + Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -198,4 +200,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. \ No newline at end of file diff --git a/Licenses/chakra-core-license.txt b/Licenses/chakra-core-license.txt index 5d0e6dd0..f8ca6bbd 100644 --- a/Licenses/chakra-core-license.txt +++ b/Licenses/chakra-core-license.txt @@ -2,7 +2,7 @@ The MIT License (MIT) Copyright (c) Microsoft Corporation All rights reserved. -Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved. +Copyright (c) ChakraCore Project Contributors. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Licenses/jering-javascript-nodejs-license.txt b/Licenses/jering-javascript-nodejs-license.txt index 76915c3e..fe0eb86a 100644 --- a/Licenses/jering-javascript-nodejs-license.txt +++ b/Licenses/jering-javascript-nodejs-license.txt @@ -1,4 +1,4 @@ -Copyright © 2018-2019 Jering. All rights reserved. +Copyright © 2018-2023 Jering. All rights reserved. Apache License Version 2.0, January 2004 diff --git a/Licenses/msie-javascript-engine-license.txt b/Licenses/msie-javascript-engine-license.txt index 15d34514..6e8f77b1 100644 --- a/Licenses/msie-javascript-engine-license.txt +++ b/Licenses/msie-javascript-engine-license.txt @@ -1,4 +1,4 @@ - Copyright (c) 2012-2021 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2012-2024 Andrey Taritsyn - http://www.taritsyn.ru Apache License Version 2.0, January 2004 diff --git a/Licenses/nodejs-license.txt b/Licenses/nodejs-license.txt index 736ddf92..41adca92 100644 --- a/Licenses/nodejs-license.txt +++ b/Licenses/nodejs-license.txt @@ -53,7 +53,9 @@ The externally maintained libraries used by Node.js are: - Acorn, located at deps/acorn, is licensed as follows: """ - Copyright (C) 2012-2018 by various contributors (see AUTHORS) + MIT License + + Copyright (C) 2012-2022 by various contributors (see AUTHORS) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -74,83 +76,103 @@ The externally maintained libraries used by Node.js are: THE SOFTWARE. """ -- Acorn plugins, located at deps/acorn-plugins, is licensed as follows: +- c-ares, located at deps/cares, is licensed as follows: """ - Copyright (C) 2017-2018 by Adrian Heine + MIT License - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: + Copyright (c) 1998 Massachusetts Institute of Technology + Copyright (c) 2007 - 2023 Daniel Stenberg with many contributors, see AUTHORS + file. - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. """ -- c-ares, located at deps/cares, is licensed as follows: +- cjs-module-lexer, located at deps/cjs-module-lexer, is licensed as follows: """ - Copyright (c) 2007 - 2018, Daniel Stenberg with many contributors, see AUTHORS - file. + MIT License + ----------- + + Copyright (C) 2018-2020 Guy Bedford + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- ittapi, located at deps/v8/third_party/ittapi, is licensed as follows: + """ + Copyright (c) 2019 Intel Corporation. All rights reserved. - Copyright 1998 by the Massachusetts Institute of Technology. + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose and without fee is hereby granted, provided that - the above copyright notice appear in all copies and that both that copyright - notice and this permission notice appear in supporting documentation, and that - the name of M.I.T. not be used in advertising or publicity pertaining to - distribution of the software without specific, written prior permission. - M.I.T. makes no representations about the suitability of this software for any - purpose. It is provided "as is" without express or implied warranty. + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ - ICU, located at deps/icu-small, is licensed as follows: """ - COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later) + UNICODE LICENSE V3 - Copyright © 1991-2019 Unicode, Inc. All rights reserved. - Distributed under the Terms of Use in https://www.unicode.org/copyright.html. + COPYRIGHT AND PERMISSION NOTICE - Permission is hereby granted, free of charge, to any person obtaining - a copy of the Unicode data files and any associated documentation - (the "Data Files") or Unicode software and any associated documentation - (the "Software") to deal in the Data Files or Software - without restriction, including without limitation the rights to use, - copy, modify, merge, publish, distribute, and/or sell copies of - the Data Files or Software, and to permit persons to whom the Data Files - or Software are furnished to do so, provided that either - (a) this copyright and permission notice appear with all copies - of the Data Files or Software, or - (b) this copyright and permission notice appear in associated - Documentation. - - THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF - ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE - WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT OF THIRD PARTY RIGHTS. - IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS - NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL - DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THE DATA FILES OR SOFTWARE. + Copyright © 2016-2023 Unicode, Inc. - Except as contained in this notice, the name of a copyright holder - shall not be used in advertising or otherwise to promote the sale, - use or other dealings in these Data Files or Software without prior - written authorization of the copyright holder. + NOTICE TO USER: Carefully read the following legal agreement. BY + DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR + SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE + TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT + DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE. - --------------------- + Permission is hereby granted, free of charge, to any person obtaining a + copy of data files and any associated documentation (the "Data Files") or + software and any associated documentation (the "Software") to deal in the + Data Files or Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, and/or sell + copies of the Data Files or Software, and to permit persons to whom the + Data Files or Software are furnished to do so, provided that either (a) + this copyright and permission notice appear with all copies of the Data + Files or Software, or (b) this copyright and permission notice appear in + associated Documentation. + + THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY + KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + THIRD PARTY RIGHTS. + + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE + BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, + OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA + FILES OR SOFTWARE. + + Except as contained in this notice, the name of a copyright holder shall + not be used in advertising or otherwise to promote the sale, use or other + dealings in these Data Files or Software without prior written + authorization of the copyright holder. + + ---------------------------------------------------------------------- Third-Party Software Licenses @@ -158,7 +180,9 @@ The externally maintained libraries used by Node.js are: terms for licensed third-party software components included within ICU libraries. - 1. ICU License - ICU 1.8.1 to ICU 57.1 + ---------------------------------------------------------------------- + + ICU License - ICU 1.8.1 to ICU 57.1 COPYRIGHT AND PERMISSION NOTICE @@ -193,7 +217,9 @@ The externally maintained libraries used by Node.js are: All trademarks and registered trademarks mentioned herein are the property of their respective owners. - 2. Chinese/Japanese Word Break Dictionary Data (cjdict.txt) + ---------------------------------------------------------------------- + + Chinese/Japanese Word Break Dictionary Data (cjdict.txt) # The Google Chrome software developed by Google is licensed under # the BSD license. Other software included in this distribution is @@ -397,33 +423,33 @@ The externally maintained libraries used by Node.js are: # # ---------------COPYING.ipadic-----END---------------------------------- - 3. Lao Word Break Dictionary Data (laodict.txt) + ---------------------------------------------------------------------- - # Copyright (c) 2013 International Business Machines Corporation - # and others. All Rights Reserved. + Lao Word Break Dictionary Data (laodict.txt) + + # Copyright (C) 2016 and later: Unicode, Inc. and others. + # License & terms of use: http://www.unicode.org/copyright.html + # Copyright (c) 2015 International Business Machines Corporation + # and others. All Rights Reserved. # - # Project: http://code.google.com/p/lao-dictionary/ - # Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt - # License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt - # (copied below) + # Project: https://github.com/rober42539/lao-dictionary + # Dictionary: https://github.com/rober42539/lao-dictionary/laodict.txt + # License: https://github.com/rober42539/lao-dictionary/LICENSE.txt + # (copied below) # - # This file is derived from the above dictionary, with slight - # modifications. + # This file is derived from the above dictionary version of Nov 22, 2020 # ---------------------------------------------------------------------- # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell. # All rights reserved. # # Redistribution and use in source and binary forms, with or without - # modification, - # are permitted provided that the following conditions are met: - # - # - # Redistributions of source code must retain the above copyright notice, this - # list of conditions and the following disclaimer. Redistributions in - # binary form must reproduce the above copyright notice, this list of - # conditions and the following disclaimer in the documentation and/or - # other materials provided with the distribution. + # modification, are permitted provided that the following conditions are met: # + # Redistributions of source code must retain the above copyright notice, this + # list of conditions and the following disclaimer. Redistributions in binary + # form must reproduce the above copyright notice, this list of conditions and + # the following disclaimer in the documentation and/or other materials + # provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -439,7 +465,9 @@ The externally maintained libraries used by Node.js are: # OF THE POSSIBILITY OF SUCH DAMAGE. # -------------------------------------------------------------------------- - 4. Burmese Word Break Dictionary Data (burmesedict.txt) + ---------------------------------------------------------------------- + + Burmese Word Break Dictionary Data (burmesedict.txt) # Copyright (c) 2014 International Business Machines Corporation # and others. All Rights Reserved. @@ -479,7 +507,9 @@ The externally maintained libraries used by Node.js are: # SUCH DAMAGE. # -------------------------------------------------------------------------- - 5. Time Zone Database + ---------------------------------------------------------------------- + + Time Zone Database ICU uses the public domain data and code derived from Time Zone Database for its time zone support. The ownership of the TZ database @@ -502,7 +532,9 @@ The externally maintained libraries used by Node.js are: # making a contribution to the database or code waives all rights to # future claims in that contribution or in the TZ Database. - 6. Google double-conversion + ---------------------------------------------------------------------- + + Google double-conversion Copyright 2006-2011, the V8 project authors. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -530,13 +562,87 @@ The externally maintained libraries used by Node.js are: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ---------------------------------------------------------------------- + + File: aclocal.m4 (only for ICU4C) + Section: pkg.m4 - Macros to locate and utilise pkg-config. + + Copyright © 2004 Scott James Remnant . + Copyright © 2012-2015 Dan Nicholson + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + As a special exception to the GNU General Public License, if you + distribute this file as part of a program that contains a + configuration script generated by Autoconf, you may include it under + the same distribution terms that you use for the rest of that + program. + + (The condition for the exception is fulfilled because + ICU4C includes a configuration script generated by Autoconf, + namely the `configure` script.) + + ---------------------------------------------------------------------- + + File: config.guess (only for ICU4C) + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + As a special exception to the GNU General Public License, if you + distribute this file as part of a program that contains a + configuration script generated by Autoconf, you may include it under + the same distribution terms that you use for the rest of that + program. This Exception is an additional permission under section 7 + of the GNU General Public License, version 3 ("GPLv3"). + + (The condition for the exception is fulfilled because + ICU4C includes a configuration script generated by Autoconf, + namely the `configure` script.) + + ---------------------------------------------------------------------- + + File: install-sh (only for ICU4C) + + Copyright 1991 by the Massachusetts Institute of Technology + + Permission to use, copy, modify, distribute, and sell this software and its + documentation for any purpose is hereby granted without fee, provided that + the above copyright notice appear in all copies and that both that + copyright notice and this permission notice appear in supporting + documentation, and that the name of M.I.T. not be used in advertising or + publicity pertaining to distribution of the software without specific, + written prior permission. M.I.T. makes no representations about the + suitability of this software for any purpose. It is provided "as is" + without express or implied warranty. """ - libuv, located at deps/uv, is licensed as follows: """ - libuv is licensed for use as follows: - - ==== Copyright (c) 2015-present libuv project contributors. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -556,8 +662,6 @@ The externally maintained libraries used by Node.js are: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ==== - This license applies to parts of libuv originating from the https://github.com/joyent/libuv repository: @@ -594,16 +698,6 @@ The externally maintained libraries used by Node.js are: - inet_pton and inet_ntop implementations, contained in src/inet.c, are copyright the Internet Systems Consortium, Inc., and licensed under the ISC license. - - - stdint-msvc2008.h (from msinttypes), copyright Alexander Chemeris. Three - clause BSD license. - - - pthread-fixes.c, copyright Google Inc. and Sony Mobile Communications AB. - Three clause BSD license. - - - android-ifaddrs.h, android-ifaddrs.c, copyright Berkeley Software Design - Inc, Kenneth MacKay and Emergya (Cloud4all, FP7/2007-2013, grant agreement - n° 289016). Three clause BSD license. """ - llhttp, located at deps/llhttp, is licensed as follows: @@ -632,58 +726,460 @@ The externally maintained libraries used by Node.js are: USE OR OTHER DEALINGS IN THE SOFTWARE. """ -- OpenSSL, located at deps/openssl, is licensed as follows: +- corepack, located at deps/corepack, is licensed as follows: """ - Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved. + **Copyright © Corepack contributors** - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- undici, located at deps/undici, is licensed as follows: + """ + MIT License + + Copyright (c) Matteo Collina and Undici contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + """ + +- postject, located at test/fixtures/postject-copy, is licensed as follows: + """ + Postject is licensed for use as follows: + + """ + MIT License + + Copyright (c) 2022 Postman, Inc + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + """ + + The Postject license applies to all parts of Postject that are not externally + maintained libraries. + + The externally maintained libraries used by Postject are: + + - LIEF, located at vendor/LIEF, is licensed as follows: + """ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2017 - 2022 R. Thomas + Copyright 2017 - 2022 Quarkslab + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + """ + """ - 3. All advertising materials mentioning features or use of this - software must display the following acknowledgment: - "This product includes software developed by the OpenSSL Project - for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - - 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - endorse or promote products derived from this software without - prior written permission. For written permission, please contact - openssl-core@openssl.org. - - 5. Products derived from this software may not be called "OpenSSL" - nor may "OpenSSL" appear in their names without prior written - permission of the OpenSSL Project. - - 6. Redistributions of any form whatsoever must retain the following - acknowledgment: - "This product includes software developed by the OpenSSL Project - for use in the OpenSSL Toolkit (http://www.openssl.org/)" - - THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - OF THE POSSIBILITY OF SUCH DAMAGE. - ==================================================================== - - This product includes cryptographic software written by Eric Young - (eay@cryptsoft.com). This product includes software written by Tim - Hudson (tjh@cryptsoft.com). +- OpenSSL, located at deps/openssl, is licensed as follows: + """ + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS """ - Punycode.js, located at lib/punycode.js, is licensed as follows: @@ -729,8 +1225,7 @@ The externally maintained libraries used by Node.js are: - Strongtalk assembler, the basis of the files assembler-arm-inl.h, assembler-arm.cc, assembler-arm.h, assembler-ia32-inl.h, assembler-ia32.cc, assembler-ia32.h, assembler-x64-inl.h, - assembler-x64.cc, assembler-x64.h, assembler-mips-inl.h, - assembler-mips.cc, assembler-mips.h, assembler.cc and assembler.h. + assembler-x64.cc, assembler-x64.h, assembler.cc and assembler.h. This code is copyrighted by Sun Microsystems Inc. and released under a 3-clause BSD license. @@ -790,9 +1285,9 @@ The externally maintained libraries used by Node.js are: - zlib, located at deps/zlib, is licensed as follows: """ zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.11, January 15th, 2017 + version 1.3.0.1, August xxth, 2023 - Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -814,6 +1309,274 @@ The externally maintained libraries used by Node.js are: jloup@gzip.org madler@alumni.caltech.edu """ +- simdjson, located at deps/simdjson, is licensed as follows: + """ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018-2023 The simdjson authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + """ + +- simdutf, located at deps/simdutf, is licensed as follows: + """ + Copyright 2021 The simdutf authors + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- ada, located at deps/ada, is licensed as follows: + """ + Copyright 2023 Yagiz Nizipli and Daniel Lemire + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- minimatch, located at deps/minimatch, is licensed as follows: + """ + The ISC License + + Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + """ + - npm, located at deps/npm, is licensed as follows: """ The npm application @@ -1045,6 +1808,7 @@ The externally maintained libraries used by Node.js are: - GYP, located at tools/gyp, is licensed as follows: """ + Copyright (c) 2020 Node.js contributors. All rights reserved. Copyright (c) 2009 Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -1208,9 +1972,38 @@ The externally maintained libraries used by Node.js are: OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ +- gypi_to_gn.py, located at tools/gypi_to_gn.py, is licensed as follows: + """ + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google LLC nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + """ + - ESLint, located at tools/node_modules/eslint, is licensed as follows: """ - Copyright JS Foundation and other contributors, https://js.foundation + Copyright OpenJS Foundation and other contributors, Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -1231,33 +2024,7 @@ The externally maintained libraries used by Node.js are: THE SOFTWARE. """ -- babel-eslint, located at tools/node_modules/babel-eslint, is licensed as follows: - """ - Copyright (c) 2014-2016 Sebastian McKenzie - - MIT License - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - """ - -- gtest, located at test/cctest/gtest, is licensed as follows: +- gtest, located at deps/googletest, is licensed as follows: """ Copyright 2008, Google Inc. All rights reserved. @@ -1316,29 +2083,6 @@ The externally maintained libraries used by Node.js are: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -- node-inspect, located at deps/node-inspect, is licensed as follows: - """ - Copyright Node.js contributors. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - IN THE SOFTWARE. - """ - - large_pages, located at src/large_pages, is licensed as follows: """ Copyright (C) 2018 Intel Corporation @@ -1355,7 +2099,7 @@ The externally maintained libraries used by Node.js are: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE @@ -1448,6 +2192,39 @@ The externally maintained libraries used by Node.js are: THE POSSIBILITY OF SUCH DAMAGE. """ +- highlight.js, located at doc/api_assets/highlight.pack.js, is licensed as follows: + """ + BSD 3-Clause License + + Copyright (c) 2006, Ivan Sagalaev. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + """ + - node-heapdump, located at src/heap_utils.cc, is licensed as follows: """ ISC License @@ -1527,4 +2304,107 @@ The externally maintained libraries used by Node.js are: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- ngtcp2, located at deps/ngtcp2/ngtcp2/, is licensed as follows: + """ + The MIT License + + Copyright (c) 2016 ngtcp2 contributors + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- nghttp3, located at deps/ngtcp2/nghttp3/, is licensed as follows: + """ + The MIT License + + Copyright (c) 2019 nghttp3 contributors + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- node-fs-extra, located at lib/internal/fs/cp, is licensed as follows: + """ + (The MIT License) + + Copyright (c) 2011-2017 JP Richardson + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files + (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS + OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- base64, located at deps/base64/base64/, is licensed as follows: + """ + Copyright (c) 2005-2007, Nick Galbreath + Copyright (c) 2015-2018, Wojciech Muła + Copyright (c) 2016-2017, Matthieu Darbois + Copyright (c) 2013-2022, Alfred Klomp + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ \ No newline at end of file diff --git a/Licenses/polyfills-for-old-dot-net-license.txt b/Licenses/polyfills-for-old-dot-net-license.txt index fab73c68..3598e8b2 100644 --- a/Licenses/polyfills-for-old-dot-net-license.txt +++ b/Licenses/polyfills-for-old-dot-net-license.txt @@ -1,3 +1,5 @@ + Copyright (c) 2018-2024 Andrey Taritsyn - http://www.taritsyn.ru + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -178,7 +180,7 @@ APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" + boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a @@ -186,7 +188,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright (c) 2018 Andrey Taritsyn - http://www.taritsyn.ru + Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -198,4 +200,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. \ No newline at end of file diff --git a/Licenses/v8-license.txt b/Licenses/v8-license.txt index bf2314e3..24d1cd10 100644 --- a/Licenses/v8-license.txt +++ b/Licenses/v8-license.txt @@ -1,4 +1,4 @@ -Copyright 2006-2011, the V8 project authors. All rights reserved. +Copyright 2014, the V8 project authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/Licenses/yantra-license.txt b/Licenses/yantra-license.txt new file mode 100644 index 00000000..f49a4e16 --- /dev/null +++ b/Licenses/yantra-license.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md index 34121d93..f94e0e9b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ JavaScript Engine Switcher [![NuGet version](http://img.shields.io/nuget/v/JavaScriptEngineSwitcher.Core.svg)](https://www.nuget.org/packages/JavaScriptEngineSwitcher.Core/) [![Download count](https://img.shields.io/nuget/dt/JavaScriptEngineSwitcher.Core.svg)](https://www.nuget.org/packages/JavaScriptEngineSwitcher.Core/) ========================== -JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines ([ChakraCore](https://github.com/chakra-core/ChakraCore), [Jering.Javascript.NodeJS](https://github.com/JeringTech/Javascript.NodeJS), [Jint](https://github.com/sebastienros/jint), [Jurassic](https://github.com/paulbartrum/jurassic), [MSIE JavaScript Engine for .NET](https://github.com/Taritsyn/MsieJavaScriptEngine), [NiL.JS](https://github.com/nilproject/NiL.JS), [Microsoft ClearScript.V8](https://github.com/Microsoft/ClearScript) and [VroomJs](https://github.com/pauldotknopf/vroomjs-core)). +JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines ([ChakraCore](https://github.com/chakra-core/ChakraCore), [Jint](https://github.com/sebastienros/jint), [Jurassic](https://github.com/paulbartrum/jurassic), [MSIE JavaScript Engine for .NET](https://github.com/Taritsyn/MsieJavaScriptEngine), [NiL.JS](https://github.com/nilproject/NiL.JS), [Jering.Javascript.NodeJS](https://github.com/JeringTech/Javascript.NodeJS), [Microsoft ClearScript.V8](https://github.com/Microsoft/ClearScript), [VroomJs](https://github.com/pauldotknopf/vroomjs-core) and [YantraJS](https://github.com/yantrajs/yantra)). This library allows you to quickly and easily switch to using of another JavaScript engine. The supported .NET types are as follows: @@ -27,12 +27,12 @@ This library can be installed through NuGet: * [Windows (ARM64)](http://nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64) * [Linux (x64)](http://nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64) * [OS X (x64)](http://nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64) - * [JS Engine Switcher: Jint](http://nuget.org/packages/JavaScriptEngineSwitcher.Jint) (supports .NET Framework 4.6.2, .NET Standard 2.0 and .NET Standard 2.1) + * [JS Engine Switcher: Jint](http://nuget.org/packages/JavaScriptEngineSwitcher.Jint) (supports .NET Framework 4.6.2, .NET Standard 2.0, .NET Standard 2.1 and .NET 8) * [JS Engine Switcher: Jurassic](http://nuget.org/packages/JavaScriptEngineSwitcher.Jurassic) (supports .NET Framework 4.0 Client, .NET Framework 4.5 and .NET Standard 2.0) * [JS Engine Switcher: MSIE](http://nuget.org/packages/JavaScriptEngineSwitcher.Msie) (supports .NET Framework 4.0 Client, .NET Framework 4.5, .NET Standard 1.3 and .NET Standard 2.0) - * [JS Engine Switcher: NiL](http://nuget.org/packages/JavaScriptEngineSwitcher.NiL) (supports .NET Framework 4.6.1, .NET Framework 4.8, .NET Standard 1.3, .NET Standard 1.6, .NET Standard 2.0, .NET Core App 3.1, .NET 5.0 and .NET 6) - * [JS Engine Switcher: Node](http://nuget.org/packages/JavaScriptEngineSwitcher.Node) (supports .NET Framework 4.6.1, .NET Standard 2.0, .NET Core App 3.1, .NET 5.0 and .NET 6) - * [JS Engine Switcher: V8](http://nuget.org/packages/JavaScriptEngineSwitcher.V8) (supports .NET Framework 4.5, .NET Framework 4.7.1, .NET Standard 2.1, .NET Core App 3.1 and .NET 5.0) + * [JS Engine Switcher: NiL](http://nuget.org/packages/JavaScriptEngineSwitcher.NiL) (supports .NET Framework 4.6.1, .NET Framework 4.8, .NET Core App 3.1, .NET 6, .NET 8 and .NET 9) + * [JS Engine Switcher: Node](http://nuget.org/packages/JavaScriptEngineSwitcher.Node) (supports .NET Framework 4.6.1, .NET Standard 2.0, .NET Core App 3.1, .NET 5.0, .NET 6 and .NET 7) + * [JS Engine Switcher: V8](http://nuget.org/packages/JavaScriptEngineSwitcher.V8) (supports .NET Framework 4.6.2, .NET Framework 4.7.1, .NET Standard 2.1, .NET Core App 3.1 and .NET 5.0) * [Microsoft ClearScript.V8 for Windows (x86)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.win-x86) * [Microsoft ClearScript.V8 for Windows (x64)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.win-x64) * [Microsoft ClearScript.V8 for Windows (ARM64)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.win-arm64) @@ -42,6 +42,7 @@ This library can be installed through NuGet: * [Microsoft ClearScript.V8 for OS X (x64)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.osx-x64) * [Microsoft ClearScript.V8 for OS X (ARM64)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.osx-arm64) * [JS Engine Switcher: Vroom](http://nuget.org/packages/JavaScriptEngineSwitcher.Vroom) (supports .NET Framework 4.0 Client, .NET Framework 4.5, .NET Framework 4.7.1, .NET Standard 1.6 and .NET Standard 2.0) + * [JS Engine Switcher: Yantra](http://nuget.org/packages/JavaScriptEngineSwitcher.Yantra) (supports .NET Standard 2.0 and .NET Standard 2.1) If you have used the JavaScript Engine Switcher version 2.X, then I recommend to first read [“How to upgrade applications to version 3.X”](https://github.com/Taritsyn/JavaScriptEngineSwitcher/wiki/How-to-upgrade-applications-to-version-3.X) section of the documentation. @@ -61,14 +62,16 @@ If you use the JavaScript Engine Switcher in some project, please send me a mess * [Autoprefixer Host for .NET](https://github.com/Taritsyn/AutoprefixerHost) by Andrey Taritsyn * [Bundle Transformer](https://github.com/Taritsyn/BundleTransformer) by Andrey Taritsyn * [Cruncher](https://github.com/JimBobSquarePants/Cruncher) by James South + * [Dart Sass Host for .NET](https://github.com/Taritsyn/DartSassHost) by Andrey Taritsyn * [E.F.F.C JavaScriptEngineSwitcher Extention Lib](https://github.com/redwolf0817/EFFC.JavaScriptEngineSwitcher.Extention) by ItTrending * [GFMParserSample.Net](https://github.com/mad4-red/GFMParserSample.Net) * [JSPool](http://dan.cx/projects/jspool) by Daniel Lo Nigro - * [MediaGetCore](https://github.com/XuPeiYao/MediaGetCore) by Xu Pei-Yao * [ProteanCMS](https://github.com/Eonic/ProteanCMS) by Trevor Spink * [QSI](https://github.com/chequer-io/qsi) * [ReactJS.NET](http://reactjs.net/) by Daniel Lo Nigro + * [SSR.Net](https://github.com/knowit/SSR.Net) * [Statiq Framework](https://statiq.dev/framework) (formerly known as [Wyam](http://wyam.io/)) * [T1.Scripts](http://nuget.org/packages/T1.Scripts) * [VIEApps.Services.Base](https://github.com/vieapps/Services.Base) + * [YouTubeStreamsExtractor](https://github.com/tmk907/YouTubeStreamsExtractor) * [zxcvbn.net](https://github.com/darcythomas/zxcvbn.net) by Darcy Thomas \ No newline at end of file diff --git a/build/common.props b/build/common.props index 9a121f52..bd3a2ae5 100644 --- a/build/common.props +++ b/build/common.props @@ -1,6 +1,6 @@ - Copyright © 2013-2022 Andrey Taritsyn + Copyright © 2013-2025 Andrey Taritsyn false false diff --git a/build/initialize-standard-nuspec-properties.targets b/build/initialize-standard-nuspec-properties.targets index 3ea04ec2..5cc44de4 100644 --- a/build/initialize-standard-nuspec-properties.targets +++ b/build/initialize-standard-nuspec-properties.targets @@ -33,6 +33,16 @@ $(Title) + <_ReadmeElement/> + <_ReadmeElement Condition="'$(PackageReadmeFile)' != ''"> + $(PackageReadmeFile) + + + <_ReadmeFileElement/> + <_ReadmeFileElement Condition="'$(PackageReadmeFile)' != ''"> + + + <_LicenseElement/> <_LicenseElement Condition="'$(PackageLicenseExpression)' != ''"> $(PackageLicenseExpression) @@ -42,9 +52,12 @@ <_LicenseFileElement/> - <_LicenseFileElement Condition="'$(PackageLicenseFile)' != ''"> + <_LicenseFileElement Condition="'$(PackageLicenseFullPath)' != '' and '$(PackageLicenseFile)' != ''"> + <_LicenseFileElement Condition="'$(PackageLicenseFullPath)' != '' and '$(PackageLicenseFile)' == ''"> + + <_TagsElement/> <_TagsElement Condition="'$(PackageTags)' != ''"> @@ -52,7 +65,7 @@ <_IconUrlElement/> - <_IconUrlElement Condition="'$(PackageIcon)' == '' and '$(PackageIconUrl)' != ''"> + <_IconUrlElement Condition="'$(PackageIconUrl)' != ''"> $(PackageIconUrl) @@ -88,27 +101,30 @@ <_CommonMetadataElements> $(PackageId) - $(_TitleElement) - $(PackageDescription) $(PackageVersion) + $(_TitleElement) $(Authors) - $(PackageRequireLicenseAcceptance) - $(_TagsElement) $(_LicenseElement) + $(PackageRequireLicenseAcceptance) $(_IconElement) + $(_ReadmeElement) + $(PackageProjectUrl) $(_IconUrlElement) + $(PackageDescription) $(_ReleaseNotesElement) - $(PackageProjectUrl) $(Copyright) + $(_TagsElement) + $(_DevelopmentDependencyElement) $(_ServiceableElement) - $(_NeutralLanguageElement) <_CommonFileElements> + $(CommonFileElements) $(_IconFileElement) $(_LicenseFileElement) + $(_ReadmeFileElement) diff --git a/build/nuget-common.props b/build/nuget-common.props index 7119e5ac..e36818c8 100644 --- a/build/nuget-common.props +++ b/build/nuget-common.props @@ -2,9 +2,10 @@ $(Product) Andrey Taritsyn - false + PACKAGE-DESCRIPTION.md + $(PackageReadmeFile) JavaScriptEngineSwitcher;JavaScript;ECMAScript - LICENSE.txt + Apache-2.0 ../../LICENSE.txt icon.png https://github.com/Taritsyn/JavaScriptEngineSwitcher diff --git a/build/nuget-for-dotnet-lib.props b/build/nuget-for-dotnet-lib.props index fd1ac079..45e6e499 100644 --- a/build/nuget-for-dotnet-lib.props +++ b/build/nuget-for-dotnet-lib.props @@ -12,15 +12,10 @@ - - $(PackageLicenseFile) - true - false - - - $(PackageIcon) - true - false - + + + + + \ No newline at end of file diff --git a/build/nuget-for-native-lib.props b/build/nuget-for-native-lib.props index e2519fd6..396aa563 100644 --- a/build/nuget-for-native-lib.props +++ b/build/nuget-for-native-lib.props @@ -4,5 +4,8 @@ false $(MSBuildProjectName).nuspec + + + \ No newline at end of file diff --git a/global.json b/global.json index b1927b6a..512142d2 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,6 @@ { "sdk": { - "version": "6.0.302" + "version": "10.0.100", + "rollForward": "latestFeature" } } diff --git a/lib/ChakraCore/License.txt b/lib/ChakraCore/License.txt index 5d0e6dd0..f8ca6bbd 100644 --- a/lib/ChakraCore/License.txt +++ b/lib/ChakraCore/License.txt @@ -2,7 +2,7 @@ The MIT License (MIT) Copyright (c) Microsoft Corporation All rights reserved. -Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved. +Copyright (c) ChakraCore Project Contributors. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/ChakraCore/runtimes/linux-x64/native/libChakraCore.so b/lib/ChakraCore/runtimes/linux-x64/native/libChakraCore.so index 038fea70..8bb7f46b 100644 Binary files a/lib/ChakraCore/runtimes/linux-x64/native/libChakraCore.so and b/lib/ChakraCore/runtimes/linux-x64/native/libChakraCore.so differ diff --git a/lib/ChakraCore/runtimes/osx-x64/native/libChakraCore.dylib b/lib/ChakraCore/runtimes/osx-x64/native/libChakraCore.dylib index 8c812ea9..f0c98abf 100644 Binary files a/lib/ChakraCore/runtimes/osx-x64/native/libChakraCore.dylib and b/lib/ChakraCore/runtimes/osx-x64/native/libChakraCore.dylib differ diff --git a/lib/ChakraCore/runtimes/win-arm/native/ChakraCore.dll b/lib/ChakraCore/runtimes/win-arm/native/ChakraCore.dll index 4144929a..9a940729 100644 Binary files a/lib/ChakraCore/runtimes/win-arm/native/ChakraCore.dll and b/lib/ChakraCore/runtimes/win-arm/native/ChakraCore.dll differ diff --git a/lib/ChakraCore/runtimes/win-arm64/native/ChakraCore.dll b/lib/ChakraCore/runtimes/win-arm64/native/ChakraCore.dll index 7ee83517..4f16911b 100644 Binary files a/lib/ChakraCore/runtimes/win-arm64/native/ChakraCore.dll and b/lib/ChakraCore/runtimes/win-arm64/native/ChakraCore.dll differ diff --git a/lib/ChakraCore/runtimes/win-x64/native/ChakraCore.dll b/lib/ChakraCore/runtimes/win-x64/native/ChakraCore.dll index 8fe7bc06..8711905f 100644 Binary files a/lib/ChakraCore/runtimes/win-x64/native/ChakraCore.dll and b/lib/ChakraCore/runtimes/win-x64/native/ChakraCore.dll differ diff --git a/lib/ChakraCore/runtimes/win-x86/native/ChakraCore.dll b/lib/ChakraCore/runtimes/win-x86/native/ChakraCore.dll index 41bf0495..fa05c533 100644 Binary files a/lib/ChakraCore/runtimes/win-x86/native/ChakraCore.dll and b/lib/ChakraCore/runtimes/win-x86/native/ChakraCore.dll differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4.csproj index 8174a76e..32393355 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4.csproj +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4.csproj @@ -1,9 +1,9 @@  - - - - + + + + Debug @@ -182,17 +182,10 @@ - - - - - - - - - - - + + @@ -218,9 +211,9 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - + + + + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/Properties/AssemblyInfo.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/Properties/AssemblyInfo.cs index 867332b7..2b4ecedb 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/Properties/AssemblyInfo.cs +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/Properties/AssemblyInfo.cs @@ -6,12 +6,12 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("JS Engine Switcher: Sample ASP.NET MVC 4 Site")] -[assembly: AssemblyCopyright("Copyright © 2013-2022 Andrey Taritsyn")] +[assembly: AssemblyCopyright("Copyright © 2013-2025 Andrey Taritsyn")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("39487053-b459-4433-ae93-e00affc653c6")] -[assembly: AssemblyVersion("3.19.0.0")] -[assembly: AssemblyFileVersion("3.19.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("3.30.2.0")] +[assembly: AssemblyFileVersion("3.30.2.0")] \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/Views/Home/Contact.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/Views/Home/Contact.cshtml index cc33fd4d..2154ade2 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/Views/Home/Contact.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/Views/Home/Contact.cshtml @@ -5,19 +5,4 @@

@ViewBag.Title

@Html.Raw(ViewBag.Body) -
- -@section Scripts { - -} \ No newline at end of file + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/Views/Shared/_Layout.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/Views/Shared/_Layout.cshtml index 91328e8d..7a886756 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/Views/Shared/_Layout.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/Views/Shared/_Layout.cshtml @@ -54,9 +54,10 @@ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/build-frontend.cmd b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/build-frontend.cmd new file mode 100644 index 00000000..b36fa314 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/build-frontend.cmd @@ -0,0 +1,41 @@ +@echo off +setlocal + +::-------------------------------------------------------------------------------- +:: Build +::-------------------------------------------------------------------------------- + +echo Starting to build the frontend for ASP.NET MVC 4 sample ... +echo. + +echo Installing Node.js packages ... +echo. +call npm install +if errorlevel 1 goto error +echo. + +echo Installing Bower packages ... +echo. +call bower install +if errorlevel 1 goto error +echo. + +echo Building client-side assets ... +echo. +call gulp +if errorlevel 1 goto error +echo. + +::-------------------------------------------------------------------------------- +:: Exit +::-------------------------------------------------------------------------------- + +echo Succeeded! +goto exit + +:error +echo *** Error: The previous step failed! + +:exit +cd ../../ +endlocal \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/build-frontend.sh b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/build-frontend.sh new file mode 100644 index 00000000..112d2a8d --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/build-frontend.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +function handle_error() +{ + _RET=${PIPESTATUS[0]} + if [[ $_RET != 0 ]]; then + echo "*** Error: The previous step failed!" + + cd ../../ + exit $_RET + fi +} + +echo "Starting to build the frontend for ASP.NET MVC 4 sample ..." +echo "" + +echo "Installing Node.js packages ..." +echo "" +npm install +handle_error +echo "" + +echo "Installing Bower packages ..." +echo "" +bower install +handle_error +echo "" + +echo "Building client-side assets ..." +echo "" +gulp +handle_error +echo "" + +echo "Succeeded!" + +cd ../../ +exit $_RET \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/images/icons/32x32/social-media-icons-32.png b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/images/icons/32x32/social-media-icons-32.png index 49aa1fe3..30d1c781 100644 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/images/icons/32x32/social-media-icons-32.png and b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/images/icons/32x32/social-media-icons-32.png differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/package.json b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/package.json index 5ff87e15..98d601d7 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/package.json +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/package.json @@ -1,7 +1,7 @@ { "name": "jsengineswitcher.sample.aspnet4.mvc4", "private": true, - "version": "3.19.0", + "version": "3.30.2", "devDependencies": { "gulp": "4.0.2", "del": "5.1.0", diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/packages.config b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/packages.config index 1799b680..6b274db9 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/packages.config +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/packages.config @@ -1,9 +1,9 @@  - - - - + + + + diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/styles/icons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/styles/icons.less index 79b9d9e5..4a80f963 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/styles/icons.less +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNet4.Mvc4/styles/icons.less @@ -15,11 +15,11 @@ width: 32px; } -.icon-facebook { +.icon-mastodon { background-position: 0 0; } -.icon-twitter { +.icon-x { background-position: 0 -32px; } @@ -27,6 +27,10 @@ background-position: 0 -64px; } +.icon-bluesky { + background-position: 0 -96px; +} + .icon-rss { background-position: 0 -128px; } \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/.bowerrc b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/.bowerrc similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/.bowerrc rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/.bowerrc diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets.csproj new file mode 100644 index 00000000..ae4c7d82 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets.csproj @@ -0,0 +1,11 @@ + + + + JS Engine Switcher: Client-Side Assets for ASP.NET Core Samples + 3.30.2 + netstandard2.0 + Library + false + + + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/bower.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/bower.json similarity index 75% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/bower.json rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/bower.json index 0e307723..3a9323a2 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/bower.json +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/bower.json @@ -1,5 +1,5 @@ { - "name": "jsengineswitcher.sample.aspnetcore1full.mvc1", + "name": "javascriptengineswitcher.sample.aspnetcore.clientsideassets", "dependencies": { "modernizr": "2.8.3", "jquery-compat": "jquery#1.10.2", diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/build-frontend.cmd b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/build-frontend.cmd new file mode 100644 index 00000000..de3af278 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/build-frontend.cmd @@ -0,0 +1,41 @@ +@echo off +setlocal + +::-------------------------------------------------------------------------------- +:: Build +::-------------------------------------------------------------------------------- + +echo Starting to build the frontend for ASP.NET Core samples ... +echo. + +echo Installing Node.js packages ... +echo. +call npm install +if errorlevel 1 goto error +echo. + +echo Installing Bower packages ... +echo. +call bower install +if errorlevel 1 goto error +echo. + +echo Building client-side assets ... +echo. +call gulp +if errorlevel 1 goto error +echo. + +::-------------------------------------------------------------------------------- +:: Exit +::-------------------------------------------------------------------------------- + +echo Succeeded! +goto exit + +:error +echo *** Error: The previous step failed! + +:exit +cd ../../ +endlocal \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/build-frontend.sh b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/build-frontend.sh new file mode 100644 index 00000000..06a7afd9 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/build-frontend.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +function handle_error() +{ + _RET=${PIPESTATUS[0]} + if [[ $_RET != 0 ]]; then + echo "*** Error: The previous step failed!" + + cd ../../ + exit $_RET + fi +} + +echo "Starting to build the frontend for ASP.NET Core samples ..." +echo "" + +echo "Installing Node.js packages ..." +echo "" +npm install +handle_error +echo "" + +echo "Installing Bower packages ..." +echo "" +bower install +handle_error +echo "" + +echo "Building client-side assets ..." +echo "" +gulp +handle_error +echo "" + +echo "Succeeded!" + +cd ../../ +exit $_RET \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/ensure-client-side-assets-builded.targets b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/ensure-client-side-assets-builded.targets new file mode 100644 index 00000000..3f41ba35 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/ensure-client-side-assets-builded.targets @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/gulpfile.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/gulpfile.js similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/gulpfile.js rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/gulpfile.js diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/package.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/package.json similarity index 75% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/package.json rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/package.json index d89ef94d..725f9bac 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/package.json +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/package.json @@ -1,7 +1,7 @@ { - "name": "jsengineswitcher.sample.aspnetcore21.mvc21", + "name": "javascriptengineswitcher.sample.aspnetcore.clientsideassets", "private": true, - "version": "3.19.0", + "version": "3.30.2", "devDependencies": { "gulp": "4.0.2", "del": "5.1.0", diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/images/0.gif b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/images/0.gif similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/images/0.gif rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/images/0.gif diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/images/clear-text.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/images/clear-text.png similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/images/clear-text.png rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/images/clear-text.png diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/images/icons/32x32/social-media-icons-32.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/images/icons/32x32/social-media-icons-32.png new file mode 100644 index 00000000..30d1c781 Binary files /dev/null and b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/images/icons/32x32/social-media-icons-32.png differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/images/icons/48x48/error.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/images/icons/48x48/error.png similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/images/icons/48x48/error.png rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/images/icons/48x48/error.png diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/images/jsengineswitcher-logo.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/images/jsengineswitcher-logo.png similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/images/jsengineswitcher-logo.png rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/images/jsengineswitcher-logo.png diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/scripts/_references.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/scripts/_references.js similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/scripts/_references.js rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/scripts/_references.js diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/scripts/common.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/scripts/common.js similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/scripts/common.js rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/scripts/common.js diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/scripts/evaluation-form.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/scripts/evaluation-form.js similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/scripts/evaluation-form.js rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/scripts/evaluation-form.js diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/app.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/app.less similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/app.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/app.less diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/bootstrap-custom-variables.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/bootstrap-custom-variables.less similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/bootstrap-custom-variables.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/bootstrap-custom-variables.less diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/buttons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/buttons.less similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/buttons.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/buttons.less diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/code.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/code.less similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/code.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/code.less diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/evaluation-form.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/evaluation-form.less similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/evaluation-form.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/evaluation-form.less diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/forms.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/forms.less similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/forms.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/forms.less diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/icons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/icons.less similarity index 85% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/icons.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/icons.less index 79b9d9e5..4a80f963 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/icons.less +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/icons.less @@ -15,11 +15,11 @@ width: 32px; } -.icon-facebook { +.icon-mastodon { background-position: 0 0; } -.icon-twitter { +.icon-x { background-position: 0 -32px; } @@ -27,6 +27,10 @@ background-position: 0 -64px; } +.icon-bluesky { + background-position: 0 -96px; +} + .icon-rss { background-position: 0 -128px; } \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/layout.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/layout.less similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/layout.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/layout.less diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/mixins.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/mixins.less similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/mixins.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/mixins.less diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/navbar.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/navbar.less similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/navbar.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/navbar.less diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/page-socials.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/page-socials.less similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/page-socials.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/page-socials.less diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/type.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/type.less similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/type.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/type.less diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/variables.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/variables.less similarity index 100% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/variables.less rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot/styles/variables.less diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Infrastructure/Helpers/CommonExtensions.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure/Helpers/CommonExtensions.cs similarity index 82% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Infrastructure/Helpers/CommonExtensions.cs rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure/Helpers/CommonExtensions.cs index 7dc4cb4d..d58feadb 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Infrastructure/Helpers/CommonExtensions.cs +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure/Helpers/CommonExtensions.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.Rendering; -namespace JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5.Infrastructure.Helpers +namespace JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.Helpers { public static class CommonExtensions { diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.csproj new file mode 100644 index 00000000..8ad369ff --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.csproj @@ -0,0 +1,56 @@ + + + + JS Engine Switcher: Infrastructure for ASP.NET Core Samples + 3.30.2 + net451;netstandard1.6;netstandard2.0;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0 + 1.6.0 + Library + true + $(NoWarn);NETSDK1215;NU1902;NU1903;NU1904 + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs similarity index 95% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs index acc30895..22e7e9bb 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Razor.TagHelpers; -namespace JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6.Infrastructure.TagHelpers +namespace JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.TagHelpers { [HtmlTargetElement("conditional-comment")] public class ConditionalCommentTagHelper : TagHelper diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Infrastructure/TagHelpers/ConditionalCommentType.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure/TagHelpers/ConditionalCommentType.cs similarity index 57% rename from samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Infrastructure/TagHelpers/ConditionalCommentType.cs rename to samples/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure/TagHelpers/ConditionalCommentType.cs index 1cbebb21..485194ba 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Infrastructure/TagHelpers/ConditionalCommentType.cs +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure/TagHelpers/ConditionalCommentType.cs @@ -1,4 +1,4 @@ -namespace JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1.Infrastructure.TagHelpers +namespace JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.TagHelpers { public enum ConditionalCommentType { diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Infrastructure/Helpers/CommonExtensions.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Infrastructure/Helpers/CommonExtensions.cs deleted file mode 100644 index acaf4c8a..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Infrastructure/Helpers/CommonExtensions.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.RegularExpressions; - -using Microsoft.AspNetCore.Html; -using Microsoft.AspNetCore.Mvc.Rendering; - -namespace JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1.Infrastructure.Helpers -{ - public static class CommonExtensions - { - public static HtmlString EncodedReplace(this IHtmlHelper htmlHelper, string input, - string pattern, string replacement) - { - return new HtmlString(Regex.Replace(htmlHelper.Encode(input), pattern, replacement)); - } - } -} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs deleted file mode 100644 index d5b7d682..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; - -using Microsoft.AspNetCore.Razor.TagHelpers; - -namespace JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1.Infrastructure.TagHelpers -{ - [HtmlTargetElement("conditional-comment")] - public class ConditionalCommentTagHelper : TagHelper - { - [HtmlAttributeName("type")] - public ConditionalCommentType CommentType { get; set; } - - [HtmlAttributeName("expression")] - public string Expression { get; set; } - - - public override void Process(TagHelperContext context, TagHelperOutput output) - { - output.TagName = null; - - ConditionalCommentType type = CommentType; - - string ifCommentStartPart; - string ifCommentEndPart; - - switch (type) - { - case ConditionalCommentType.Hidden: - ifCommentStartPart = ""; - - break; - case ConditionalCommentType.RevealedValidatingSimplified: - ifCommentStartPart = ""; - - break; - case ConditionalCommentType.Revealed: - ifCommentStartPart = ""; - - break; - default: - throw new NotSupportedException(); - } - - TagHelperContent preContent = output.PreContent; - preContent.AppendHtml(ifCommentStartPart); - preContent.AppendHtml(Expression); - preContent.AppendHtml(ifCommentEndPart); - - string endIfComment; - - switch (type) - { - case ConditionalCommentType.Hidden: - endIfComment = ""; - break; - case ConditionalCommentType.RevealedValidating: - case ConditionalCommentType.RevealedValidatingSimplified: - endIfComment = ""; - break; - case ConditionalCommentType.Revealed: - endIfComment = ""; - break; - default: - throw new NotSupportedException(); - } - - output.PostContent.AppendHtml(endIfComment); - } - } -} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1.csproj index 7920db5a..08c70ce0 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1.csproj +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1.csproj @@ -2,41 +2,44 @@ JS Engine Switcher: Sample ASP.NET Core 1.0 MVC 1 Site - 3.19.0 + 3.30.2 netcoreapp1.0 1.0.16 Exe false + $(NoWarn);NU1903;NU1904 true + true false + false - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + @@ -47,22 +50,6 @@ - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Program.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Program.cs index a114871d..f2bd4508 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Program.cs +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Program.cs @@ -8,9 +8,14 @@ public class Program { public static void Main(string[] args) { + string currentDirectory = Directory.GetCurrentDirectory(); var host = new WebHostBuilder() .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) + .UseContentRoot(currentDirectory) + .UseWebRoot(Path.Combine( + currentDirectory, + "../JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot" + )) .UseIISIntegration() .UseStartup() .Build() diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Properties/launchSettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Properties/launchSettings.json index 899dc420..532b02b6 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Properties/launchSettings.json +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Properties/launchSettings.json @@ -8,13 +8,6 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1": { "commandName": "Project", "launchBrowser": true, @@ -22,6 +15,13 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "http://localhost:15465/" + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } } } } diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Startup.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Startup.cs index 07c6d9fd..4d8735af 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Startup.cs +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Startup.cs @@ -8,7 +8,6 @@ using JavaScriptEngineSwitcher.ChakraCore; using JavaScriptEngineSwitcher.Extensions.MsDependencyInjection; using JavaScriptEngineSwitcher.Msie; -using JavaScriptEngineSwitcher.NiL; using JavaScriptEngineSwitcher.Sample.Logic.Services; using JavaScriptEngineSwitcher.Vroom; @@ -51,14 +50,15 @@ public void ConfigureServices(IServiceCollection services) // Add JavaScriptEngineSwitcher services to the services container. services.AddJsEngineSwitcher(options => - options.DefaultEngineName = ChakraCoreJsEngine.EngineName - ) + { + options.AllowCurrentProperty = false; + options.DefaultEngineName = ChakraCoreJsEngine.EngineName; + }) .AddChakraCore() .AddMsie(options => { options.EngineMode = JsEngineMode.ChakraIeJsRt; }) - .AddNiL() .AddVroom() ; diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/Home/Contact.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/Home/Contact.cshtml index cd9663df..58785ebe 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/Home/Contact.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/Home/Contact.cshtml @@ -5,19 +5,4 @@

@ViewBag.Title

@ViewBag.Body -
- -@section Scripts { - -} \ No newline at end of file + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/Shared/_JsEvaluationErrorList.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/Shared/_JsEvaluationErrorList.cshtml index 84226921..9646764d 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/Shared/_JsEvaluationErrorList.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/Shared/_JsEvaluationErrorList.cshtml @@ -1,4 +1,4 @@ -@using JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1.Infrastructure.Helpers +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.Helpers @using JavaScriptEngineSwitcher.Sample.Logic.Models @model IList diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/Shared/_Layout.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/Shared/_Layout.cshtml index 1ce67a4d..b60019c1 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/Shared/_Layout.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/Shared/_Layout.cshtml @@ -1,4 +1,4 @@ -@using JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1.Infrastructure.TagHelpers +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.TagHelpers @@ -61,9 +61,10 @@ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/_ViewImports.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/_ViewImports.cshtml index f03d94e2..5364be02 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/_ViewImports.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/Views/_ViewImports.cshtml @@ -1,2 +1,2 @@ @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" -@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1" \ No newline at end of file +@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure" \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/bower.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/bower.json deleted file mode 100644 index ebc0d4d1..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/bower.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "jsengineswitcher.sample.aspnetcore1.mvc1", - "dependencies": { - "modernizr": "2.8.3", - "jquery-compat": "jquery#1.10.2", - "jquery": "jquery#2.0.3", - "jquery-validation": "1.13.1", - "jquery-validation-unobtrusive": "3.2.3", - "bootstrap": "3.3.0" - } -} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/package.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/package.json deleted file mode 100644 index ba4e930f..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "jsengineswitcher.sample.aspnetcore1.mvc1", - "private": true, - "version": "3.19.0", - "devDependencies": { - "gulp": "4.0.2", - "del": "5.1.0", - "gulp-sourcemaps": "2.6.5", - "gulp-rename": "2.0.0", - "gulp-concat": "2.6.1", - "gulp-less": "4.0.1", - "gulp-autoprefixer": "7.0.1", - "gulp-clean-css": "4.2.0", - "gulp-uglify": "3.0.2" - } -} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/images/icons/32x32/social-media-icons-32.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/images/icons/32x32/social-media-icons-32.png deleted file mode 100644 index 49aa1fe3..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/images/icons/32x32/social-media-icons-32.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/icons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/icons.less deleted file mode 100644 index 79b9d9e5..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1.Mvc1/wwwroot/styles/icons.less +++ /dev/null @@ -1,32 +0,0 @@ -// -// Icons -// -------------------------------------------------- - - -.icon { - background: transparent url(../images/icons/32x32/social-media-icons-32.png) no-repeat scroll; - display: inline-block; - line-height: 0; - vertical-align: bottom; -} - -.icon-32 { - height: 32px; - width: 32px; -} - -.icon-facebook { - background-position: 0 0; -} - -.icon-twitter { - background-position: 0 -32px; -} - -.icon-linkedin { - background-position: 0 -64px; -} - -.icon-rss { - background-position: 0 -128px; -} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Controllers/HomeController.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Controllers/HomeController.cs new file mode 100644 index 00000000..57f376ff --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Controllers/HomeController.cs @@ -0,0 +1,83 @@ +using System.Diagnostics; +using System.Threading.Tasks; + +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Html; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; + +using JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9.Models; +using JavaScriptEngineSwitcher.Sample.Logic.Models; +using JavaScriptEngineSwitcher.Sample.Logic.Services; + +namespace JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9.Controllers +{ + public class HomeController : Controller + { + private readonly FileContentService _fileContentService; + private readonly JsEvaluationService _jsEvaluationService; + + + public HomeController( + IConfigurationRoot configuration, + IWebHostEnvironment hostingEnvironment, + JsEvaluationService jsEvaluationService) + { + string textContentDirectoryPath = configuration + .GetSection("jsengineswitcher") + .GetSection("Samples")["TextContentDirectoryPath"] + ; + + _fileContentService = new FileContentService(textContentDirectoryPath, hostingEnvironment); + _jsEvaluationService = jsEvaluationService; + } + + + [ResponseCache(CacheProfileName = "CacheCompressedContent5Minutes")] + public IActionResult Index() + { + ViewBag.Body = new HtmlString(_fileContentService.GetFileContent("index.html")); + + return View(); + } + + [HttpGet] + [ResponseCache(CacheProfileName = "CacheCompressedContent5Minutes")] + public IActionResult Demo() + { + var model = _jsEvaluationService.GetInitializationData(); + + return View(model); + } + + [HttpPost] + public async Task Demo(JsEvaluationViewModel editedModel) + { + var model = _jsEvaluationService.GetInitializationData(); + await TryUpdateModelAsync(model, string.Empty, m => m.EngineName, m=> m.Expression); + + if (ModelState.IsValid) + { + model = _jsEvaluationService.Evaluate(model); + + ModelState.Clear(); + } + + return View(model); + } + + [ResponseCache(CacheProfileName = "CacheCompressedContent5Minutes")] + public IActionResult Contact() + { + ViewBag.Body = new HtmlString(_fileContentService.GetFileContent("contact.html")); + + return View(); + } + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10.csproj new file mode 100644 index 00000000..3d8c1ebc --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10.csproj @@ -0,0 +1,49 @@ + + + + JS Engine Switcher: Sample ASP.NET Core 10.0 MVC 10 Site + 3.30.2 + net10.0 + enable + Exe + true + true + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Models/ErrorViewModel.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Models/ErrorViewModel.cs new file mode 100644 index 00000000..20cc9827 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Models/ErrorViewModel.cs @@ -0,0 +1,9 @@ +namespace JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9.Models +{ + public class ErrorViewModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + } +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Program.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Program.cs new file mode 100644 index 00000000..457ccf63 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Program.cs @@ -0,0 +1,105 @@ +using Jering.Javascript.NodeJS; +using Microsoft.AspNetCore.Mvc; + +using JavaScriptEngineSwitcher.ChakraCore; +using JavaScriptEngineSwitcher.Extensions.MsDependencyInjection; +using JavaScriptEngineSwitcher.Jint; +using JavaScriptEngineSwitcher.Jurassic; +using JavaScriptEngineSwitcher.Msie; +using JavaScriptEngineSwitcher.NiL; +using JavaScriptEngineSwitcher.Node; +using JavaScriptEngineSwitcher.Sample.Logic.Services; +using JavaScriptEngineSwitcher.V8; +using JavaScriptEngineSwitcher.Vroom; +using JavaScriptEngineSwitcher.Yantra; + +var builder = WebApplication.CreateBuilder(new WebApplicationOptions() { + WebRootPath = Path.Combine( + Directory.GetCurrentDirectory(), + "../JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot" + ) +}); +var env = builder.Environment; +var configuration = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) + .AddEnvironmentVariables() + .Build() + ; + +#region Configure services + +IServiceCollection services = builder.Services; + +services.AddSingleton(configuration); + +// Add Jering Node.js service to the services container. +services.AddNodeJS(); + +// Add JavaScriptEngineSwitcher services to the services container. +services.AddJsEngineSwitcher(options => +{ + options.AllowCurrentProperty = false; + options.DefaultEngineName = ChakraCoreJsEngine.EngineName; +}) + .AddChakraCore() + .AddJint() + .AddJurassic() + .AddMsie(options => + { + options.EngineMode = JsEngineMode.ChakraIeJsRt; + }) + .AddNiL() + .AddNode(services) + .AddV8() + .AddVroom() + .AddYantra() + ; + +services.Configure(options => +{ + options.CacheProfiles.Add("CacheCompressedContent5Minutes", + new CacheProfile + { + NoStore = builder.Environment.IsDevelopment(), + Duration = 300, + Location = ResponseCacheLocation.Client, + VaryByHeader = "Accept-Encoding" + } + ); +}); + +// Add framework services. +services.AddControllersWithViews(); + +// Add JavaScriptEngineSwitcher sample services to the services container. +services.AddSingleton(); + +#endregion + +#region Configure the HTTP request pipeline + +var app = builder.Build(); + +if (app.Environment.IsDevelopment()) +{ + app.UseDeveloperExceptionPage(); +} +else +{ + app.UseExceptionHandler("/Home/Error"); +} + +app.UseRouting(); + +app.MapStaticAssets(); + +app.MapControllerRoute( + name: "default", + pattern: "{controller=Home}/{action=Index}/{id?}") + .WithStaticAssets(); + +#endregion + +app.Run(); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Properties/launchSettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Properties/launchSettings.json new file mode 100644 index 00000000..2c93180d --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61316/", + "sslPort": 44396 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5169" + }, + "https": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7103;http://localhost:5169" + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Home/Contact.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Home/Contact.cshtml new file mode 100644 index 00000000..58785ebe --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Home/Contact.cshtml @@ -0,0 +1,8 @@ +@{ + ViewBag.Title = "Contact"; +} + +
+

@ViewBag.Title

+ @ViewBag.Body +
\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Home/Demo.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Home/Demo.cshtml new file mode 100644 index 00000000..befb8f43 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Home/Demo.cshtml @@ -0,0 +1,67 @@ +@using JavaScriptEngineSwitcher.Sample.Logic.Models +@using JavaScriptEngineSwitcher.Sample.Resources + +@model JsEvaluationViewModel + +@{ + ViewBag.Title = "Demo"; +} + +

@ViewBag.Title

+ +
+
+
+
+
+ + +
+
+ +
+ +
+ +
+
+ +
+
+ + @if (Model.Result != null) + { +
+ @if (Model.Result.Errors.Count == 0) + { +
+ + +
+ } + else + { + await Html.RenderPartialAsync("_JsEvaluationErrorList", Model.Result.Errors); + } +
+ } +
+
+
+ +@section Scripts { + + + + + + + + + +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Home/Index.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Home/Index.cshtml new file mode 100644 index 00000000..a9c2cfb1 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Home/Index.cshtml @@ -0,0 +1,8 @@ +@{ + ViewBag.Title = string.Empty; +} + +
+

Project Description

+ @ViewBag.Body +
\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Shared/Error.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Shared/Error.cshtml new file mode 100644 index 00000000..b568b9f2 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Shared/Error.cshtml @@ -0,0 +1,28 @@ +@using JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9.Models + +@model ErrorViewModel + +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +@if (Model.ShowRequestId) +{ +

+ Request ID: @Model.RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Shared/_JsEvaluationErrorList.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Shared/_JsEvaluationErrorList.cshtml new file mode 100644 index 00000000..9e0601d6 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Shared/_JsEvaluationErrorList.cshtml @@ -0,0 +1,23 @@ +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.Helpers +@using JavaScriptEngineSwitcher.Sample.Logic.Models + +@model IList + +

Found @Model.Count error(s):

+
    + @foreach (var error in Model) + { +
  • + @error.EngineFullName
    + @if (error.LineNumber > 0) + { + Line @error.LineNumber, Column @error.ColumnNumber
    + } + @Html.EncodedReplace(@error.Message, "\n\r?", "
    ") + @if (!string.IsNullOrWhiteSpace(error.SourceFragment)) + { +
    @error.SourceFragment
    + } +
  • + } +
\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Shared/_Layout.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Shared/_Layout.cshtml new file mode 100644 index 00000000..62e3d72c --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/Shared/_Layout.cshtml @@ -0,0 +1,107 @@ +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.TagHelpers + + + + + + + + + @if (!string.IsNullOrEmpty(ViewBag.Title)) {<text>@ViewBag.Title | </text>}JavaScriptEngineSwitcher Sample ASP.NET Core 10.0 MVC 10 Site + + + + + + + + + + + + +
+ + + + + +
+
+ @RenderBody() +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @await RenderSectionAsync("scripts", required: false) + + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/_ViewImports.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/_ViewImports.cshtml new file mode 100644 index 00000000..dcad619c --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/_ViewStart.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/_ViewStart.cshtml new file mode 100644 index 00000000..817a9134 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/appsettings.Development.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/appsettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/appsettings.json new file mode 100644 index 00000000..ed44b7ae --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore10.Mvc10/appsettings.json @@ -0,0 +1,15 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + + "JsEngineSwitcher": { + "Samples": { + "TextContentDirectoryPath": "../SharedData/text-content" + } + } +} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/.bowerrc b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/.bowerrc deleted file mode 100644 index ea81a597..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/.bowerrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "registry": "https://registry.bower.io", - "directory": "wwwroot/lib" -} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Infrastructure/Helpers/CommonExtensions.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Infrastructure/Helpers/CommonExtensions.cs deleted file mode 100644 index d9c87a7c..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Infrastructure/Helpers/CommonExtensions.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.RegularExpressions; - -using Microsoft.AspNetCore.Html; -using Microsoft.AspNetCore.Mvc.Rendering; - -namespace JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1.Infrastructure.Helpers -{ - public static class CommonExtensions - { - public static HtmlString EncodedReplace(this IHtmlHelper htmlHelper, string input, - string pattern, string replacement) - { - return new HtmlString(Regex.Replace(htmlHelper.Encode(input), pattern, replacement)); - } - } -} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs deleted file mode 100644 index 22862601..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; - -using Microsoft.AspNetCore.Razor.TagHelpers; - -namespace JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1.Infrastructure.TagHelpers -{ - [HtmlTargetElement("conditional-comment")] - public class ConditionalCommentTagHelper : TagHelper - { - [HtmlAttributeName("type")] - public ConditionalCommentType CommentType { get; set; } - - [HtmlAttributeName("expression")] - public string Expression { get; set; } - - - public override void Process(TagHelperContext context, TagHelperOutput output) - { - output.TagName = null; - - ConditionalCommentType type = CommentType; - - string ifCommentStartPart; - string ifCommentEndPart; - - switch (type) - { - case ConditionalCommentType.Hidden: - ifCommentStartPart = ""; - - break; - case ConditionalCommentType.RevealedValidatingSimplified: - ifCommentStartPart = ""; - - break; - case ConditionalCommentType.Revealed: - ifCommentStartPart = ""; - - break; - default: - throw new NotSupportedException(); - } - - TagHelperContent preContent = output.PreContent; - preContent.AppendHtml(ifCommentStartPart); - preContent.AppendHtml(Expression); - preContent.AppendHtml(ifCommentEndPart); - - string endIfComment; - - switch (type) - { - case ConditionalCommentType.Hidden: - endIfComment = ""; - break; - case ConditionalCommentType.RevealedValidating: - case ConditionalCommentType.RevealedValidatingSimplified: - endIfComment = ""; - break; - case ConditionalCommentType.Revealed: - endIfComment = ""; - break; - default: - throw new NotSupportedException(); - } - - output.PostContent.AppendHtml(endIfComment); - } - } -} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Infrastructure/TagHelpers/ConditionalCommentType.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Infrastructure/TagHelpers/ConditionalCommentType.cs deleted file mode 100644 index afc6db8e..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Infrastructure/TagHelpers/ConditionalCommentType.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1.Infrastructure.TagHelpers -{ - public enum ConditionalCommentType - { - Hidden, - Revealed, - RevealedValidating, - RevealedValidatingSimplified - } -} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1.csproj index f6f12e0a..8d4e9283 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1.csproj +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1.csproj @@ -2,44 +2,43 @@ JS Engine Switcher: Sample ASP.NET Core 1.0 Full MVC 1 Site - 3.19.0 + 3.30.2 net451 Exe true + $(NoWarn);NU1903;NU1904 true + true false - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - @@ -50,22 +49,6 @@ - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Program.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Program.cs index 05e6c571..56e599bf 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Program.cs +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Program.cs @@ -8,9 +8,14 @@ public class Program { public static void Main(string[] args) { + string currentDirectory = Directory.GetCurrentDirectory(); var host = new WebHostBuilder() .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) + .UseContentRoot(currentDirectory) + .UseWebRoot(Path.Combine( + currentDirectory, + "../JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot" + )) .UseIISIntegration() .UseStartup() .Build() diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Properties/launchSettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Properties/launchSettings.json index b54f71d9..e823558d 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Properties/launchSettings.json +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Properties/launchSettings.json @@ -8,17 +8,17 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1": { + "commandName": "Project", "launchBrowser": true, + "launchUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, - "JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1": { - "commandName": "Project", + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, - "launchUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Startup.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Startup.cs index 46530360..970f4b07 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Startup.cs +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Startup.cs @@ -11,7 +11,6 @@ using JavaScriptEngineSwitcher.Jurassic; using JavaScriptEngineSwitcher.Msie; using JavaScriptEngineSwitcher.Sample.Logic.Services; -using JavaScriptEngineSwitcher.V8; using JavaScriptEngineSwitcher.Vroom; namespace JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1 @@ -53,15 +52,16 @@ public void ConfigureServices(IServiceCollection services) // Add JavaScriptEngineSwitcher services to the services container. services.AddJsEngineSwitcher(options => - options.DefaultEngineName = ChakraCoreJsEngine.EngineName - ) + { + options.AllowCurrentProperty = false; + options.DefaultEngineName = ChakraCoreJsEngine.EngineName; + }) .AddChakraCore() .AddJurassic() .AddMsie(options => { options.EngineMode = JsEngineMode.ChakraIeJsRt; }) - .AddV8() .AddVroom() ; diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/Home/Contact.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/Home/Contact.cshtml index cd9663df..58785ebe 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/Home/Contact.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/Home/Contact.cshtml @@ -5,19 +5,4 @@

@ViewBag.Title

@ViewBag.Body -
- -@section Scripts { - -} \ No newline at end of file + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/Shared/_JsEvaluationErrorList.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/Shared/_JsEvaluationErrorList.cshtml index eafda0bc..9646764d 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/Shared/_JsEvaluationErrorList.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/Shared/_JsEvaluationErrorList.cshtml @@ -1,4 +1,4 @@ -@using JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1.Infrastructure.Helpers +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.Helpers @using JavaScriptEngineSwitcher.Sample.Logic.Models @model IList diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/Shared/_Layout.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/Shared/_Layout.cshtml index 27da1ded..34baa99f 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/Shared/_Layout.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/Shared/_Layout.cshtml @@ -1,4 +1,4 @@ -@using JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1.Infrastructure.TagHelpers +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.TagHelpers @@ -61,9 +61,10 @@ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/_ViewImports.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/_ViewImports.cshtml index 9281a0f4..5364be02 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/_ViewImports.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/Views/_ViewImports.cshtml @@ -1,2 +1,2 @@ @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" -@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1" \ No newline at end of file +@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure" \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/gulpfile.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/gulpfile.js deleted file mode 100644 index 0f259437..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/gulpfile.js +++ /dev/null @@ -1,130 +0,0 @@ -/*global require, exports */ -/*jshint esversion: 6 */ -const WEB_ROOT_PATH = "wwwroot"; -const BOWER_DIR_PATH = WEB_ROOT_PATH + "/lib"; -const STYLE_DIR_PATH = WEB_ROOT_PATH + '/styles'; -const SCRIPT_DIR_PATH = WEB_ROOT_PATH + '/scripts'; - -// include plug-ins -let { src, dest, series, parallel, watch } = require('gulp'); -let del = require('del'); -let sourcemaps = require('gulp-sourcemaps'); -let rename = require('gulp-rename'); -let concat = require('gulp-concat'); -let less = require('gulp-less'); -let autoprefixer = require('gulp-autoprefixer'); -let cleanCss = require('gulp-clean-css'); -let uglify = require('gulp-uglify'); - -//#region Clean -//#region Clean builded assets -function cleanBuildedStyles() { - return del([STYLE_DIR_PATH + '/build/*']); -} - -function cleanBuildedScripts() { - return del([SCRIPT_DIR_PATH + '/build/*']); -} - -let cleanBuildedAssets = parallel(cleanBuildedStyles, cleanBuildedScripts); -//#endregion -//#endregion - -//#region Build assets -//#region Build styles -let autoprefixerOptions = { - overrideBrowserslist: ['> 1%', 'last 3 versions', 'Firefox ESR', 'Opera 12.1'], - cascade: true -}; -let cssCleanOptions = { specialComments: '*' }; -let cssRenameOptions = { extname: '.min.css' }; - -function buildCommonStyles() { - return src([STYLE_DIR_PATH + '/app.less']) - .pipe(sourcemaps.init()) - .pipe(less({ - relativeUrls: true, - rootpath: '/styles/' - })) - .pipe(autoprefixer(autoprefixerOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(STYLE_DIR_PATH + '/build')) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(concat('common-styles.css')) - .pipe(cleanCss(cssCleanOptions)) - .pipe(rename(cssRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(STYLE_DIR_PATH + '/build')) - ; -} - -let buildStyles = buildCommonStyles; -//#endregion - -//#region Build scripts -let jsConcatOptions = { newLine: ';' }; -let jsUglifyOptions = { - output: { comments: /^!/ } -}; -let jsRenameOptions = { extname: '.min.js' }; - -function buildModernizrScripts() { - return src([BOWER_DIR_PATH + '/modernizr/modernizr.js']) - .pipe(sourcemaps.init()) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -function buildCommonScripts() { - return src([SCRIPT_DIR_PATH + '/common.js']) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(rename({ basename: 'common-scripts' })) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -function buildEvaluationFormScripts() { - return src([BOWER_DIR_PATH + '/jquery-validation/dist/jquery.validate.js', - BOWER_DIR_PATH + '/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js', - BOWER_DIR_PATH + '/bootstrap/js/button.js', - SCRIPT_DIR_PATH + '/evaluation-form.js']) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(concat('evaluation-form-scripts.js', jsConcatOptions)) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -let buildScripts = parallel(buildModernizrScripts, buildCommonScripts, buildEvaluationFormScripts); -//#endregion - -let buildAssets = parallel(buildStyles, buildScripts); -//#endregion - -//#region Watch assets -function watchStyles() { - return watch([STYLE_DIR_PATH + '/**/*.{less,css}', '!' + STYLE_DIR_PATH + '/build/**/*.*'], - buildStyles); -} - -function watchScripts() { - return watch([SCRIPT_DIR_PATH + '/**/*.js', '!' + SCRIPT_DIR_PATH + '/build/**/*.*'], - buildScripts); -} - -let watchAssets = parallel(watchStyles, watchScripts); -//#endregion - -// Export tasks -exports.cleanBuildedAssets = cleanBuildedAssets; -exports.buildAssets = buildAssets; -exports.watchAssets = watchAssets; -exports.default = series(cleanBuildedAssets, buildAssets); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/package.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/package.json deleted file mode 100644 index 2f495674..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "jsengineswitcher.sample.aspnetcore1full.mvc1", - "private": true, - "version": "3.19.0", - "devDependencies": { - "gulp": "4.0.2", - "del": "5.1.0", - "gulp-sourcemaps": "2.6.5", - "gulp-rename": "2.0.0", - "gulp-concat": "2.6.1", - "gulp-less": "4.0.1", - "gulp-autoprefixer": "7.0.1", - "gulp-clean-css": "4.2.0", - "gulp-uglify": "3.0.2" - } -} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/0.gif b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/0.gif deleted file mode 100644 index 35d42e80..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/0.gif and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/clear-text.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/clear-text.png deleted file mode 100644 index 9d217b7f..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/clear-text.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/icons/32x32/social-media-icons-32.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/icons/32x32/social-media-icons-32.png deleted file mode 100644 index 49aa1fe3..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/icons/32x32/social-media-icons-32.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/icons/48x48/error.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/icons/48x48/error.png deleted file mode 100644 index 3d6185f7..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/icons/48x48/error.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/jsengineswitcher-logo.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/jsengineswitcher-logo.png deleted file mode 100644 index 12ed97e0..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/images/jsengineswitcher-logo.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/scripts/_references.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/scripts/_references.js deleted file mode 100644 index 2b54eea8..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/scripts/_references.js and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/scripts/common.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/scripts/common.js deleted file mode 100644 index c94bf102..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/scripts/common.js +++ /dev/null @@ -1,29 +0,0 @@ -var jsEngineSwitcher; - -(function (jsEngineSwitcher, undefined) { - "use strict"; - - jsEngineSwitcher.registerNamespace = function (namespaceString) { - var parts = namespaceString.split("."), - parent = jsEngineSwitcher, - i - ; - - if (parts[0] === "jsEngineSwitcher") { - parts = parts.slice(1); - } - - for (i = 0; i < parts.length; i += 1) { - if (typeof parent[parts[i]] === "undefined") { - parent[parts[i]] = {}; - } - parent = parent[parts[i]]; - } - - return parent; - }; - - jsEngineSwitcher.hasScrollbar = function(elem) { - return (elem.clientHeight < elem.scrollHeight); - }; -}(jsEngineSwitcher = jsEngineSwitcher || {})); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/scripts/evaluation-form.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/scripts/evaluation-form.js deleted file mode 100644 index da1f0199..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/scripts/evaluation-form.js +++ /dev/null @@ -1,83 +0,0 @@ -(function (jsEngineSwitcher, $, undefined) { - "use strict"; - - var $evaluationForm, - $evaluationInputField, - $evaluationInputClearButton, - $evaluateButton - ; - - $(function () { - $evaluationForm = $("form[data-form-type='evaluation-form']"); - $evaluationInputField = $(":input[data-control-type='evaluation-input-field']", $evaluationForm); - $evaluationInputClearButton = $("
"); - $evaluateButton = $(":input[data-control-type='evaluate-button']", $evaluationForm); - - $evaluationForm.on("submit", onEvaluationFormSubmitHandler); - - $evaluationInputClearButton.on("click", onEvaluationInputClearButtonClickHandler); - $evaluationInputField.parent().append($evaluationInputClearButton); - refreshEvaluationInputClearButton(); - $evaluationInputField - .on("input propertychange keydown keyup paste", onEvaluationInputFieldChangeHandler) - ; - - $evaluateButton.removeAttr("disabled"); - }); - - $(window).unload(function() { - $evaluationForm.off("submit", onEvaluationFormSubmitHandler); - - $evaluationInputClearButton - .off("click", onEvaluationInputClearButtonClickHandler) - .remove() - ; - - $evaluationInputField - .off("input propertychange keydown keyup paste", onEvaluationInputFieldChangeHandler) - ; - - $evaluationForm = null; - $evaluationInputField = null; - $evaluationInputClearButton = null; - $evaluateButton = null; - }); - - var refreshEvaluationInputClearButton = function() { - if ($.trim($evaluationInputField.val()).length > 0) { - $evaluationInputClearButton.show(); - } else { - $evaluationInputClearButton.hide(); - } - - if (jsEngineSwitcher.hasScrollbar($evaluationInputField.get(0))) { - $evaluationInputClearButton.addClass("with-scrollbar"); - } - else { - $evaluationInputClearButton.removeClass("with-scrollbar"); - } - }; - - var onEvaluationFormSubmitHandler = function () { - var $form = $(this); - if ($form.valid()) { - $evaluateButton.attr("disabled", "disabled"); - $("textarea[data-control-type='evaluation-output-field']", $form).val(''); - - return true; - } - - return false; - }; - - var onEvaluationInputFieldChangeHandler = function () { - refreshEvaluationInputClearButton(); - }; - - var onEvaluationInputClearButtonClickHandler = function() { - $evaluationInputField.val(""); - - var $button = $(this); - $button.hide(); - }; -}(jsEngineSwitcher, jQuery)); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/app.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/app.less deleted file mode 100644 index c41a9315..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/app.less +++ /dev/null @@ -1,71 +0,0 @@ -/*! - * Bootstrap v3.3.0 (http://getbootstrap.com) - * Copyright 2011-2014 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ - -// Core variables and mixins -@import "bootstrap-custom-variables.less"; -@import "../lib/bootstrap/less/mixins.less"; - -// Reset -@import "../lib/bootstrap/less/normalize.less"; -//@import "../lib/bootstrap/less/print.less"; -//@import "../lib/bootstrap/less/glyphicons.less"; - -// Core CSS -@import "../lib/bootstrap/less/scaffolding.less"; -@import "../lib/bootstrap/less/type.less"; -@import "../lib/bootstrap/less/code.less"; -//@import "../lib/bootstrap/less/grid.less"; -//@import "../lib/bootstrap/less/tables.less"; -@import "../lib/bootstrap/less/forms.less"; -//@import "../lib/bootstrap/less/buttons.less"; - -// Components -//@import "../lib/bootstrap/less/component-animations.less"; -//@import "../lib/bootstrap/less/dropdowns.less"; -//@import "../lib/bootstrap/less/button-groups.less"; -//@import "../lib/bootstrap/less/input-groups.less"; -@import "../lib/bootstrap/less/navs.less"; -@import "../lib/bootstrap/less/navbar.less"; -//@import "../lib/bootstrap/less/breadcrumbs.less"; -//@import "../lib/bootstrap/less/pagination.less"; -//@import "../lib/bootstrap/less/pager.less"; -//@import "../lib/bootstrap/less/labels.less"; -//@import "../lib/bootstrap/less/badges.less"; -//@import "../lib/bootstrap/less/jumbotron.less"; -//@import "../lib/bootstrap/less/thumbnails.less"; -//@import "../lib/bootstrap/less/alerts.less"; -//@import "../lib/bootstrap/less/progress-bars.less"; -//@import "../lib/bootstrap/less/media.less"; -//@import "../lib/bootstrap/less/list-group.less"; -//@import "../lib/bootstrap/less/panels.less"; -//@import "../lib/bootstrap/less/responsive-embed.less"; -//@import "../lib/bootstrap/less/wells.less"; -//@import "../lib/bootstrap/less/close.less"; - -// Components w/ JavaScript -//@import "../lib/bootstrap/less/modals.less"; -//@import "../lib/bootstrap/less/tooltip.less"; -//@import "../lib/bootstrap/less/popovers.less"; -//@import "../lib/bootstrap/less/carousel.less"; - -// Utility classes -@import "../lib/bootstrap/less/utilities.less"; -//@import "../lib/bootstrap/less/responsive-utilities.less"; - -// JavaScriptEngineSwitcher specs -@import "variables.less"; -@import "mixins.less"; - -@import "type.less"; -@import "code.less"; -@import "forms.less"; -@import "buttons.less"; -@import "icons.less"; -@import "navbar.less"; - -@import "layout.less"; -@import "evaluation-form.less"; -@import "page-socials.less"; \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/bootstrap-custom-variables.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/bootstrap-custom-variables.less deleted file mode 100644 index 0be2aa6f..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/bootstrap-custom-variables.less +++ /dev/null @@ -1,856 +0,0 @@ -// -// Variables -// -------------------------------------------------- - - -//== Colors -// -//## Gray and brand colors for use across Bootstrap. - -@gray-base: #323330; -@gray-darker: lighten(@gray-base, 13.5%); // #222 -@gray-dark: lighten(@gray-base, 20%); // #333 -@gray: lighten(@gray-base, 33.5%); // #555 -@gray-light: lighten(@gray-base, 46.7%); // #777 -@gray-lighter: #e3e3e3; - -@brand-primary: #428bca; -@brand-success: #5cb85c; -@brand-info: #5bc0de; -@brand-warning: #f0ad4e; -@brand-danger: #d9534f; - - -//== Scaffolding -// -//## Settings for some of the most global styles. - -//** Background color for ``. -@body-bg: #fff; -//** Global text color on ``. -@text-color: #1d0d0d; - -//** Global textual link color. -@link-color: @brand-primary; -//** Link hover color set via `darken()` function. -@link-hover-color: darken(@link-color, 15%); -//** Link hover decoration. -@link-hover-decoration: underline; - - -//== Typography -// -//## Font, line-height, and color for body text, headings, and more. - -@font-family-sans-serif: "Helvetica Neue", Arial, sans-serif; -@font-family-serif: Georgia, "Times New Roman", Times, serif; -//** Default monospace fonts for ``, ``, and `
`.
-@font-family-monospace:   Consolas, "Courier New", monospace;
-@font-family-base:        @font-family-sans-serif;
-
-@font-size-base:          14px;
-@font-size-large:         ceil((@font-size-base * 1.25)); // ~18px
-@font-size-small:         ceil((@font-size-base * 0.85)); // ~12px
-
-@font-size-h1:            floor(@font-size-base * 3);
-@font-size-h2:            @font-size-base * 2.5;
-@font-size-h3:            ceil(@font-size-base * 1.75);
-@font-size-h4:            ceil(@font-size-base * 1.25);
-@font-size-h5:            @font-size-base;
-@font-size-h6:            ceil(@font-size-base * 0.85);
-
-//** Unit-less `line-height` for use in components like buttons.
-@line-height-base:        1.428571429; // 20/14
-//** Computed "line-height" (`font-size` * `line-height`) for use with `margin`, `padding`, etc.
-@line-height-computed:    floor((@font-size-base * @line-height-base)); // ~20px
-
-//** By default, this inherits from the ``.
-@headings-font-family:    "Open Sans", sans-serif;
-@headings-font-weight:    normal;
-@headings-line-height:    1.1;
-@headings-color:          inherit;
-
-
-//== Iconography
-//
-//## Specify custom location and filename of the included Glyphicons icon font. Useful for those including Bootstrap via Bower.
-
-//** Load fonts from this directory.
-@icon-font-path:          "../fonts/";
-//** File name for all font files.
-@icon-font-name:          "glyphicons-halflings-regular";
-//** Element ID within SVG icon file.
-@icon-font-svg-id:        "glyphicons_halflingsregular";
-
-
-//== Components
-//
-//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start).
-
-@padding-base-vertical:     4px;
-@padding-base-horizontal:   6px;
-
-@padding-large-vertical:    10px;
-@padding-large-horizontal:  16px;
-
-@padding-small-vertical:    5px;
-@padding-small-horizontal:  10px;
-
-@padding-xs-vertical:       1px;
-@padding-xs-horizontal:     5px;
-
-@line-height-large:         1.33;
-@line-height-small:         1.5;
-
-@border-radius-base:        4px;
-@border-radius-large:       6px;
-@border-radius-small:       3px;
-
-//** Global color for active items (e.g., navs or dropdowns).
-@component-active-color:    #fff;
-//** Global background color for active items (e.g., navs or dropdowns).
-@component-active-bg:       @brand-primary;
-
-//** Width of the `border` for generating carets that indicator dropdowns.
-@caret-width-base:          4px;
-//** Carets increase slightly in size for larger components.
-@caret-width-large:         5px;
-
-
-//== Tables
-//
-//## Customizes the `.table` component with basic values, each used across all table variations.
-
-//** Padding for ``s and ``s.
-@table-cell-padding:            8px;
-//** Padding for cells in `.table-condensed`.
-@table-condensed-cell-padding:  5px;
-
-//** Default background color used for all tables.
-@table-bg:                      transparent;
-//** Background color used for `.table-striped`.
-@table-bg-accent:               #f9f9f9;
-//** Background color used for `.table-hover`.
-@table-bg-hover:                #f5f5f5;
-@table-bg-active:               @table-bg-hover;
-
-//** Border color for table and cell borders.
-@table-border-color:            #ddd;
-
-
-//== Buttons
-//
-//## For each of Bootstrap's buttons, define text, background and border color.
-
-@btn-font-weight:                normal;
-
-@btn-default-color:              #333;
-@btn-default-bg:                 @gray-lighter;
-@btn-default-border:             @gray-lighter;
-
-@btn-primary-color:              #fff;
-@btn-primary-bg:                 @brand-primary;
-@btn-primary-border:             darken(@btn-primary-bg, 5%);
-
-@btn-success-color:              #fff;
-@btn-success-bg:                 @brand-success;
-@btn-success-border:             darken(@btn-success-bg, 5%);
-
-@btn-info-color:                 #fff;
-@btn-info-bg:                    @brand-info;
-@btn-info-border:                darken(@btn-info-bg, 5%);
-
-@btn-warning-color:              #fff;
-@btn-warning-bg:                 @brand-warning;
-@btn-warning-border:             darken(@btn-warning-bg, 5%);
-
-@btn-danger-color:               #fff;
-@btn-danger-bg:                  @brand-danger;
-@btn-danger-border:              darken(@btn-danger-bg, 5%);
-
-@btn-link-disabled-color:        @gray-light;
-
-
-//== Forms
-//
-//##
-
-//** `` background color
-@input-bg:                       #fff;
-//** `` background color
-@input-bg-disabled:              @gray-lighter;
-
-//** Text color for ``s
-@input-color:                    @gray;
-//** `` border color
-@input-border:                   #b2b2b2;
-
-// TODO: Rename `@input-border-radius` to `@input-border-radius-base` in v4
-//** Default `.form-control` border radius
-@input-border-radius:            @border-radius-base;
-//** Large `.form-control` border radius
-@input-border-radius-large:      @border-radius-large;
-//** Small `.form-control` border radius
-@input-border-radius-small:      @border-radius-small;
-
-//** Border color for inputs on focus
-@input-border-focus:             #d4b33a;
-
-//** Placeholder text color
-@input-color-placeholder:        #999;
-
-//** Default `.form-control` height
-@input-height-base:              (@line-height-computed + (@padding-base-vertical * 2) + 2);
-//** Large `.form-control` height
-@input-height-large:             (ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 2);
-//** Small `.form-control` height
-@input-height-small:             (floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 2);
-
-@legend-color:                   @gray-dark;
-@legend-border-color:            #e5e5e5;
-
-//** Background color for textual input addons
-@input-group-addon-bg:           @gray-lighter;
-//** Border color for textual input addons
-@input-group-addon-border-color: @input-border;
-
-//** Disabled cursor for form controls and buttons.
-@cursor-disabled:                not-allowed;
-
-
-//== Dropdowns
-//
-//## Dropdown menu container and contents.
-
-//** Background for the dropdown menu.
-@dropdown-bg:                    #fff;
-//** Dropdown menu `border-color`.
-@dropdown-border:                rgba(0,0,0,.15);
-//** Dropdown menu `border-color` **for IE8**.
-@dropdown-fallback-border:       #ccc;
-//** Divider color for between dropdown items.
-@dropdown-divider-bg:            #e5e5e5;
-
-//** Dropdown link text color.
-@dropdown-link-color:            @gray-dark;
-//** Hover color for dropdown links.
-@dropdown-link-hover-color:      darken(@gray-dark, 5%);
-//** Hover background for dropdown links.
-@dropdown-link-hover-bg:         #f5f5f5;
-
-//** Active dropdown menu item text color.
-@dropdown-link-active-color:     @component-active-color;
-//** Active dropdown menu item background color.
-@dropdown-link-active-bg:        @component-active-bg;
-
-//** Disabled dropdown menu item background color.
-@dropdown-link-disabled-color:   @gray-light;
-
-//** Text color for headers within dropdown menus.
-@dropdown-header-color:          @gray-light;
-
-//** Deprecated `@dropdown-caret-color` as of v3.1.0
-@dropdown-caret-color:           #000;
-
-
-//-- Z-index master list
-//
-// Warning: Avoid customizing these values. They're used for a bird's eye view
-// of components dependent on the z-axis and are designed to all work together.
-//
-// Note: These variables are not generated into the Customizer.
-
-@zindex-navbar:            1000;
-@zindex-dropdown:          1000;
-@zindex-popover:           1060;
-@zindex-tooltip:           1070;
-@zindex-navbar-fixed:      1030;
-@zindex-modal:             1040;
-
-
-//== Media queries breakpoints
-//
-//## Define the breakpoints at which your layout will change, adapting to different screen sizes.
-
-// Extra small screen / phone
-//** Deprecated `@screen-xs` as of v3.0.1
-@screen-xs:                  480px;
-//** Deprecated `@screen-xs-min` as of v3.2.0
-@screen-xs-min:              @screen-xs;
-//** Deprecated `@screen-phone` as of v3.0.1
-@screen-phone:               @screen-xs-min;
-
-// Small screen / tablet
-//** Deprecated `@screen-sm` as of v3.0.1
-@screen-sm:                  768px;
-@screen-sm-min:              @screen-sm;
-//** Deprecated `@screen-tablet` as of v3.0.1
-@screen-tablet:              @screen-sm-min;
-
-// Medium screen / desktop
-//** Deprecated `@screen-md` as of v3.0.1
-@screen-md:                  992px;
-@screen-md-min:              @screen-md;
-//** Deprecated `@screen-desktop` as of v3.0.1
-@screen-desktop:             @screen-md-min;
-
-// Large screen / wide desktop
-//** Deprecated `@screen-lg` as of v3.0.1
-@screen-lg:                  1200px;
-@screen-lg-min:              @screen-lg;
-//** Deprecated `@screen-lg-desktop` as of v3.0.1
-@screen-lg-desktop:          @screen-lg-min;
-
-// So media queries don't overlap when required, provide a maximum
-@screen-xs-max:              (@screen-sm-min - 1);
-@screen-sm-max:              (@screen-md-min - 1);
-@screen-md-max:              (@screen-lg-min - 1);
-
-
-//== Grid system
-//
-//## Define your custom responsive grid.
-
-//** Number of columns in the grid.
-@grid-columns:              12;
-//** Padding between columns. Gets divided in half for the left and right.
-@grid-gutter-width:         30px;
-// Navbar collapse
-//** Point at which the navbar becomes uncollapsed.
-@grid-float-breakpoint:     @screen-sm-min;
-//** Point at which the navbar begins collapsing.
-@grid-float-breakpoint-max: (@grid-float-breakpoint - 1);
-
-
-//== Container sizes
-//
-//## Define the maximum width of `.container` for different screen sizes.
-
-// Small screen / tablet
-@container-tablet:             (720px + @grid-gutter-width);
-//** For `@screen-sm-min` and up.
-@container-sm:                 @container-tablet;
-
-// Medium screen / desktop
-@container-desktop:            (940px + @grid-gutter-width);
-//** For `@screen-md-min` and up.
-@container-md:                 @container-desktop;
-
-// Large screen / wide desktop
-@container-large-desktop:      (1140px + @grid-gutter-width);
-//** For `@screen-lg-min` and up.
-@container-lg:                 @container-large-desktop;
-
-
-//== Navbar
-//
-//##
-
-// Basics of a navbar
-@navbar-height:                    100px;
-@navbar-margin-bottom:             0;
-@navbar-border-radius:             @border-radius-base;
-@navbar-padding-horizontal:        0;
-@navbar-padding-vertical:          ((@navbar-height - @line-height-computed) / 2);
-@navbar-collapse-max-height:       340px;
-
-@navbar-default-color:             @gray-base;
-@navbar-default-bg:                #f0db4f;
-@navbar-default-border:            #f0db4f;
-
-// Navbar links
-@navbar-default-link-color:                @navbar-default-color;
-@navbar-default-link-hover-color:          @gray-dark;
-@navbar-default-link-hover-bg:             transparent;
-@navbar-default-link-active-color:         @navbar-default-color;
-@navbar-default-link-active-bg:            transparent;
-@navbar-default-link-disabled-color:       #ccc;
-@navbar-default-link-disabled-bg:          transparent;
-
-// Navbar brand label
-@navbar-default-brand-color:               @navbar-default-link-color;
-@navbar-default-brand-hover-color:         darken(@navbar-default-brand-color, 10%);
-@navbar-default-brand-hover-bg:            transparent;
-
-// Navbar toggle
-@navbar-default-toggle-hover-bg:           #ddd;
-@navbar-default-toggle-icon-bar-bg:        @gray-dark;
-@navbar-default-toggle-border-color:       #ddd;
-
-
-// Inverted navbar
-// Reset inverted navbar basics
-@navbar-inverse-color:                      lighten(@gray-light, 15%);
-@navbar-inverse-bg:                         #222;
-@navbar-inverse-border:                     darken(@navbar-inverse-bg, 10%);
-
-// Inverted navbar links
-@navbar-inverse-link-color:                 lighten(@gray-light, 15%);
-@navbar-inverse-link-hover-color:           #fff;
-@navbar-inverse-link-hover-bg:              transparent;
-@navbar-inverse-link-active-color:          @navbar-inverse-link-hover-color;
-@navbar-inverse-link-active-bg:             darken(@navbar-inverse-bg, 10%);
-@navbar-inverse-link-disabled-color:        #444;
-@navbar-inverse-link-disabled-bg:           transparent;
-
-// Inverted navbar brand label
-@navbar-inverse-brand-color:                @navbar-inverse-link-color;
-@navbar-inverse-brand-hover-color:          #fff;
-@navbar-inverse-brand-hover-bg:             transparent;
-
-// Inverted navbar toggle
-@navbar-inverse-toggle-hover-bg:            #333;
-@navbar-inverse-toggle-icon-bar-bg:         #fff;
-@navbar-inverse-toggle-border-color:        #333;
-
-
-//== Navs
-//
-//##
-
-//=== Shared nav styles
-@nav-link-padding:                          10px 15px;
-@nav-link-hover-bg:                         @gray-lighter;
-
-@nav-disabled-link-color:                   @gray-light;
-@nav-disabled-link-hover-color:             @gray-light;
-
-//== Tabs
-@nav-tabs-border-color:                     #ddd;
-
-@nav-tabs-link-hover-border-color:          @gray-lighter;
-
-@nav-tabs-active-link-hover-bg:             @body-bg;
-@nav-tabs-active-link-hover-color:          @gray;
-@nav-tabs-active-link-hover-border-color:   #ddd;
-
-@nav-tabs-justified-link-border-color:            #ddd;
-@nav-tabs-justified-active-link-border-color:     @body-bg;
-
-//== Pills
-@nav-pills-border-radius:                   @border-radius-base;
-@nav-pills-active-link-hover-bg:            @component-active-bg;
-@nav-pills-active-link-hover-color:         @component-active-color;
-
-
-//== Pagination
-//
-//##
-
-@pagination-color:                     @link-color;
-@pagination-bg:                        #fff;
-@pagination-border:                    #ddd;
-
-@pagination-hover-color:               @link-hover-color;
-@pagination-hover-bg:                  @gray-lighter;
-@pagination-hover-border:              #ddd;
-
-@pagination-active-color:              #fff;
-@pagination-active-bg:                 @brand-primary;
-@pagination-active-border:             @brand-primary;
-
-@pagination-disabled-color:            @gray-light;
-@pagination-disabled-bg:               #fff;
-@pagination-disabled-border:           #ddd;
-
-
-//== Pager
-//
-//##
-
-@pager-bg:                             @pagination-bg;
-@pager-border:                         @pagination-border;
-@pager-border-radius:                  15px;
-
-@pager-hover-bg:                       @pagination-hover-bg;
-
-@pager-active-bg:                      @pagination-active-bg;
-@pager-active-color:                   @pagination-active-color;
-
-@pager-disabled-color:                 @pagination-disabled-color;
-
-
-//== Jumbotron
-//
-//##
-
-@jumbotron-padding:              30px;
-@jumbotron-color:                inherit;
-@jumbotron-bg:                   @gray-lighter;
-@jumbotron-heading-color:        inherit;
-@jumbotron-font-size:            ceil((@font-size-base * 1.5));
-
-
-//== Form states and alerts
-//
-//## Define colors for form feedback states and, by default, alerts.
-
-@state-success-text:             #3c763d;
-@state-success-bg:               #dff0d8;
-@state-success-border:           darken(spin(@state-success-bg, -10), 5%);
-
-@state-info-text:                #31708f;
-@state-info-bg:                  #d9edf7;
-@state-info-border:              darken(spin(@state-info-bg, -10), 7%);
-
-@state-warning-text:             #8a6d3b;
-@state-warning-bg:               #fcf8e3;
-@state-warning-border:           darken(spin(@state-warning-bg, -10), 5%);
-
-@state-danger-text:              #a94442;
-@state-danger-bg:                #f2dede;
-@state-danger-border:            darken(spin(@state-danger-bg, -10), 5%);
-
-
-//== Tooltips
-//
-//##
-
-//** Tooltip max width
-@tooltip-max-width:           200px;
-//** Tooltip text color
-@tooltip-color:               #fff;
-//** Tooltip background color
-@tooltip-bg:                  #000;
-@tooltip-opacity:             .9;
-
-//** Tooltip arrow width
-@tooltip-arrow-width:         5px;
-//** Tooltip arrow color
-@tooltip-arrow-color:         @tooltip-bg;
-
-
-//== Popovers
-//
-//##
-
-//** Popover body background color
-@popover-bg:                          #fff;
-//** Popover maximum width
-@popover-max-width:                   276px;
-//** Popover border color
-@popover-border-color:                rgba(0,0,0,.2);
-//** Popover fallback border color
-@popover-fallback-border-color:       #ccc;
-
-//** Popover title background color
-@popover-title-bg:                    darken(@popover-bg, 3%);
-
-//** Popover arrow width
-@popover-arrow-width:                 10px;
-//** Popover arrow color
-@popover-arrow-color:                 @popover-bg;
-
-//** Popover outer arrow width
-@popover-arrow-outer-width:           (@popover-arrow-width + 1);
-//** Popover outer arrow color
-@popover-arrow-outer-color:           fadein(@popover-border-color, 5%);
-//** Popover outer arrow fallback color
-@popover-arrow-outer-fallback-color:  darken(@popover-fallback-border-color, 20%);
-
-
-//== Labels
-//
-//##
-
-//** Default label background color
-@label-default-bg:            @gray-light;
-//** Primary label background color
-@label-primary-bg:            @brand-primary;
-//** Success label background color
-@label-success-bg:            @brand-success;
-//** Info label background color
-@label-info-bg:               @brand-info;
-//** Warning label background color
-@label-warning-bg:            @brand-warning;
-//** Danger label background color
-@label-danger-bg:             @brand-danger;
-
-//** Default label text color
-@label-color:                 #fff;
-//** Default text color of a linked label
-@label-link-hover-color:      #fff;
-
-
-//== Modals
-//
-//##
-
-//** Padding applied to the modal body
-@modal-inner-padding:         15px;
-
-//** Padding applied to the modal title
-@modal-title-padding:         15px;
-//** Modal title line-height
-@modal-title-line-height:     @line-height-base;
-
-//** Background color of modal content area
-@modal-content-bg:                             #fff;
-//** Modal content border color
-@modal-content-border-color:                   rgba(0,0,0,.2);
-//** Modal content border color **for IE8**
-@modal-content-fallback-border-color:          #999;
-
-//** Modal backdrop background color
-@modal-backdrop-bg:           #000;
-//** Modal backdrop opacity
-@modal-backdrop-opacity:      .5;
-//** Modal header border color
-@modal-header-border-color:   #e5e5e5;
-//** Modal footer border color
-@modal-footer-border-color:   @modal-header-border-color;
-
-@modal-lg:                    900px;
-@modal-md:                    600px;
-@modal-sm:                    300px;
-
-
-//== Alerts
-//
-//## Define alert colors, border radius, and padding.
-
-@alert-padding:               15px;
-@alert-border-radius:         @border-radius-base;
-@alert-link-font-weight:      bold;
-
-@alert-success-bg:            @state-success-bg;
-@alert-success-text:          @state-success-text;
-@alert-success-border:        @state-success-border;
-
-@alert-info-bg:               @state-info-bg;
-@alert-info-text:             @state-info-text;
-@alert-info-border:           @state-info-border;
-
-@alert-warning-bg:            @state-warning-bg;
-@alert-warning-text:          @state-warning-text;
-@alert-warning-border:        @state-warning-border;
-
-@alert-danger-bg:             @state-danger-bg;
-@alert-danger-text:           @state-danger-text;
-@alert-danger-border:         @state-danger-border;
-
-
-//== Progress bars
-//
-//##
-
-//** Background color of the whole progress component
-@progress-bg:                 #f5f5f5;
-//** Progress bar text color
-@progress-bar-color:          #fff;
-//** Variable for setting rounded corners on progress bar.
-@progress-border-radius:      @border-radius-base;
-
-//** Default progress bar color
-@progress-bar-bg:             @brand-primary;
-//** Success progress bar color
-@progress-bar-success-bg:     @brand-success;
-//** Warning progress bar color
-@progress-bar-warning-bg:     @brand-warning;
-//** Danger progress bar color
-@progress-bar-danger-bg:      @brand-danger;
-//** Info progress bar color
-@progress-bar-info-bg:        @brand-info;
-
-
-//== List group
-//
-//##
-
-//** Background color on `.list-group-item`
-@list-group-bg:                 #fff;
-//** `.list-group-item` border color
-@list-group-border:             #ddd;
-//** List group border radius
-@list-group-border-radius:      @border-radius-base;
-
-//** Background color of single list items on hover
-@list-group-hover-bg:           #f5f5f5;
-//** Text color of active list items
-@list-group-active-color:       @component-active-color;
-//** Background color of active list items
-@list-group-active-bg:          @component-active-bg;
-//** Border color of active list elements
-@list-group-active-border:      @list-group-active-bg;
-//** Text color for content within active list items
-@list-group-active-text-color:  lighten(@list-group-active-bg, 40%);
-
-//** Text color of disabled list items
-@list-group-disabled-color:      @gray-light;
-//** Background color of disabled list items
-@list-group-disabled-bg:         @gray-lighter;
-//** Text color for content within disabled list items
-@list-group-disabled-text-color: @list-group-disabled-color;
-
-@list-group-link-color:         #555;
-@list-group-link-hover-color:   @list-group-link-color;
-@list-group-link-heading-color: #333;
-
-
-//== Panels
-//
-//##
-
-@panel-bg:                    #fff;
-@panel-body-padding:          15px;
-@panel-heading-padding:       10px 15px;
-@panel-footer-padding:        @panel-heading-padding;
-@panel-border-radius:         @border-radius-base;
-
-//** Border color for elements within panels
-@panel-inner-border:          #ddd;
-@panel-footer-bg:             #f5f5f5;
-
-@panel-default-text:          @gray-dark;
-@panel-default-border:        #ddd;
-@panel-default-heading-bg:    #f5f5f5;
-
-@panel-primary-text:          #fff;
-@panel-primary-border:        @brand-primary;
-@panel-primary-heading-bg:    @brand-primary;
-
-@panel-success-text:          @state-success-text;
-@panel-success-border:        @state-success-border;
-@panel-success-heading-bg:    @state-success-bg;
-
-@panel-info-text:             @state-info-text;
-@panel-info-border:           @state-info-border;
-@panel-info-heading-bg:       @state-info-bg;
-
-@panel-warning-text:          @state-warning-text;
-@panel-warning-border:        @state-warning-border;
-@panel-warning-heading-bg:    @state-warning-bg;
-
-@panel-danger-text:           @state-danger-text;
-@panel-danger-border:         @state-danger-border;
-@panel-danger-heading-bg:     @state-danger-bg;
-
-
-//== Thumbnails
-//
-//##
-
-//** Padding around the thumbnail image
-@thumbnail-padding:           4px;
-//** Thumbnail background color
-@thumbnail-bg:                @body-bg;
-//** Thumbnail border color
-@thumbnail-border:            #ddd;
-//** Thumbnail border radius
-@thumbnail-border-radius:     @border-radius-base;
-
-//** Custom text color for thumbnail captions
-@thumbnail-caption-color:     @text-color;
-//** Padding around the thumbnail caption
-@thumbnail-caption-padding:   9px;
-
-
-//== Wells
-//
-//##
-
-@well-bg:                     #f5f5f5;
-@well-border:                 darken(@well-bg, 7%);
-
-
-//== Badges
-//
-//##
-
-@badge-color:                 #fff;
-//** Linked badge text color on hover
-@badge-link-hover-color:      #fff;
-@badge-bg:                    @gray-light;
-
-//** Badge text color in active nav link
-@badge-active-color:          @link-color;
-//** Badge background color in active nav link
-@badge-active-bg:             #fff;
-
-@badge-font-weight:           bold;
-@badge-line-height:           1;
-@badge-border-radius:         10px;
-
-
-//== Breadcrumbs
-//
-//##
-
-@breadcrumb-padding-vertical:   8px;
-@breadcrumb-padding-horizontal: 15px;
-//** Breadcrumb background color
-@breadcrumb-bg:                 #f5f5f5;
-//** Breadcrumb text color
-@breadcrumb-color:              #ccc;
-//** Text color of current page in the breadcrumb
-@breadcrumb-active-color:       @gray-light;
-//** Textual separator for between breadcrumb elements
-@breadcrumb-separator:          "/";
-
-
-//== Carousel
-//
-//##
-
-@carousel-text-shadow:                        0 1px 2px rgba(0,0,0,.6);
-
-@carousel-control-color:                      #fff;
-@carousel-control-width:                      15%;
-@carousel-control-opacity:                    .5;
-@carousel-control-font-size:                  20px;
-
-@carousel-indicator-active-bg:                #fff;
-@carousel-indicator-border-color:             #fff;
-
-@carousel-caption-color:                      #fff;
-
-
-//== Close
-//
-//##
-
-@close-font-weight:           bold;
-@close-color:                 #000;
-@close-text-shadow:           0 1px 0 #fff;
-
-
-//== Code
-//
-//##
-
-@code-color:                  #c7254e;
-@code-bg:                     #f9f2f4;
-
-@kbd-color:                   #fff;
-@kbd-bg:                      #333;
-
-@pre-bg:                      #f5f5f5;
-@pre-color:                   @gray-dark;
-@pre-border-color:            #ccc;
-@pre-scrollable-max-height:   340px;
-
-
-//== Type
-//
-//##
-
-//** Horizontal offset for forms and lists.
-@component-offset-horizontal: 180px;
-//** Text muted color
-@text-muted:                  @gray-light;
-//** Abbreviations and acronyms border color
-@abbr-border-color:           @gray-light;
-//** Headings small color
-@headings-small-color:        @gray-light;
-//** Blockquote small color
-@blockquote-small-color:      @gray-light;
-//** Blockquote font size
-@blockquote-font-size:        (@font-size-base * 1.25);
-//** Blockquote border color
-@blockquote-border-color:     @gray-lighter;
-//** Page header border color
-@page-header-border-color:    @gray-lighter;
-//** Width of horizontal description list titles
-@dl-horizontal-offset:        @component-offset-horizontal;
-//** Horizontal line color.
-@hr-border:                   #b2b2b2;
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/buttons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/buttons.less
deleted file mode 100644
index bbb3c620..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/buttons.less
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Buttons
-// --------------------------------------------------
-
-
-// Base styles
-// --------------------------------------------------
-
-// Core styles
-.btn {
-  display: inline-block;
-  padding: 5px 6px 4px 8px;
-  margin-top: 0;
-  margin-bottom: 0; // For input.btn
-  font-family: "Open Sans Condensed", sans-serif;
-  font-size: @font-size-base * 1.3;
-  font-weight: 700;
-  text-transform: uppercase;
-  letter-spacing: 1px;
-  line-height: @line-height-computed;
-  text-align: center;
-  vertical-align: middle;
-  touch-action: manipulation;
-  cursor: pointer;
-  background-color: @gray-lighter;
-  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
-  border: none;
-  border-radius: 3px;
-  .box-shadow(1px 1px 0 rgba(0, 0, 0, 0.3));
-  outline: none !important;
-  white-space: nowrap;
-  .user-select(none);
-
-  &:focus,
-  &.focus {
-    .tab-focus();
-  }
-
-  &:hover,
-  &:focus,
-  &.focus {
-    background-color: lighten(@gray-lighter, 5%);
-    text-decoration: none;
-    .transition(background-color .1s linear);
-  }
-
-  &:active,
-  &.active {
-    outline: 0;
-    padding: 6px 5px 3px 9px;
-  }
-
-  &.disabled,
-  &[disabled],
-  fieldset[disabled] & {
-    cursor: @cursor-disabled;
-    pointer-events: none; // Future-proof disabling of clicks
-    .opacity(65);
-    .box-shadow(1px 1px 0 rgba(0, 0, 0, 0.15));
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/code.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/code.less
deleted file mode 100644
index 33af7555..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/code.less
+++ /dev/null
@@ -1,8 +0,0 @@
-code {
-  margin: 0 2px;
-  padding: 1px 5px;
-  border: 1px solid #E1E1E8;
-  background-color: #F7F7F9;
-  color: @gray-dark;
-  font-size: 85%;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/evaluation-form.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/evaluation-form.less
deleted file mode 100644
index 6d505d56..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/evaluation-form.less
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// Evaluation form
-// --------------------------------------------------
-
-
-.evaluation-form {
-  .clearfix();
-
-  textarea {
-    height: 200px;
-  }
-}
-
-.evaluation-input-output {
-  float: left;
-  width: 65%;
-}
-
-.evaluation-input-clear-button {
-  position: absolute;
-  top: 0;
-  right: 0;
-  width: 15px;
-  height: 15px;
-  margin: 6px;
-  display: inline-block;
-  background: transparent url("../images/clear-text.png") no-repeat scroll 0 0;
-  opacity: 0.75;
-  line-height: 0;
-  vertical-align: bottom;
-  cursor: pointer;
-
-  &:hover {
-   opacity: 1;
- }
-}
-
-.evaluation-input-clear-button.with-scrollbar {
-  margin-right: 29px;
-}
-
-.evaluation-output {
-  margin-top: 1.5em;
-}
-
-.evaluation-input-field,
-.evaluation-output-field {
-  margin-bottom: 0.5em;
-  .box-sizing(border-box);
-  overflow-x: hidden;
-  line-height: @line-height-computed;
-}
-
-.evaluation-output-field {
-  &[readonly] {
-    cursor: auto;
-    background-color: @input-bg;
-  }
-}
-
-.evaluation-error-header {
-  margin-bottom: @line-height-computed;
-  padding-left: 52px;
-  background: transparent url("../images/icons/48x48/error.png") no-repeat scroll 0 50%;
-  color: @black;
-  font-family: @font-family-sans-serif;
-  font-weight: bold;
-  line-height: 48px;
-  vertical-align: middle;
-}
-
-ul.evaluation-error-list,
-ul.evaluation-warning-list {
-  li {
-    margin-bottom: 1em;
-
-    pre {
-      margin-top: 0.5em;
-      white-space: pre;
-      overflow: auto;
-    }
-  }
-}
-
-ul.evaluation-error-list li pre {
-  background-color: @state-danger-bg;
-}
-
-ul.evaluation-warning-list li pre {
-  background-color: @state-warning-bg;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/forms.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/forms.less
deleted file mode 100644
index 2ceb0559..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/forms.less
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// Forms
-// --------------------------------------------------
-
-// GENERAL STYLES
-// --------------
-
-label {
-  font-weight: normal;
-}
-
-
-// Form controls
-// -------------------------
-
-// Common form controls
-.form-control {
-  line-height: @input-height-base;
-}
-
-.textarea-wrapper {
-  position: relative;
-}
-
-// Form groups
-.form-group {
-  margin-bottom: 0.5em;
-}
-
-// Info and errors
-// --------------------------
-.message-info {
-  border: 1px solid;
-  clear: both;
-  padding: 10px 20px;
-  color: @state-info-text;
-}
-
-.message-error {
-  clear: both;
-  color: @state-danger-text;
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 20px 0 10px 0;
-}
-
-.message-success {
-  color: @state-success-text;
-  font-size: 1.3em;
-  font-weight: bold;
-  margin: 20px 0 10px 0;
-}
-
-.error {
-  color: @state-danger-text;
-}
-
-// Styles for validation helpers
-// --------------------------
-.validators {
-  font-style: normal;
-  padding-bottom: 0.5em;
-}
-
-.field-validation-error {
-  display: block;
-  padding-bottom: 0.5em;
-  color: @state-danger-text;
-  font-weight: bold;
-}
-
-.field-validation-valid {
-  display: none;
-}
-
-input.input-validation-error,
-textarea.input-validation-error,
-select.input-validation-error
-{
-  border: 1px solid @state-danger-border;
-  background-color: @state-danger-bg;
-  .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
-
-  &:focus {
-    border-color: @state-danger-border;
-    @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@state-danger-text, 20%);
-    .box-shadow(@shadow);
-  }
-}
-
-.validation-summary-errors {
-  color: @state-danger-text;
-  font-weight: bold;
-  font-size: 1.1em;
-}
-
-.validation-summary-valid {
-  display: none;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/layout.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/layout.less
deleted file mode 100644
index 35a7f386..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/layout.less
+++ /dev/null
@@ -1,128 +0,0 @@
-html,
-body {
-  margin: 0;
-  height: 100%;
-  /* The html and body elements cannot have any padding or margin */
-}
-
-/* Wrapper for page content to push down footer */
-.l-wrapper {
-  min-height: 100%;
-  height: auto !important;
-  height: 100%;
-  /* Negative indent footer by it's height */
-  margin: 0 auto (-1 * @footer-height);
-}
-
-.l-constrained {
-  margin: 0 auto;
-  padding-left: 20px;
-  padding-right: 20px;
-  max-width: 1200px;
-  min-width: 800px;
-}
-
-.l-header {
-  border-top: solid 10px @black;
-  border-bottom: 1px solid #d4b33a;
-  background-color: #f0db4f;
-
-  .l-constrained {
-    padding-top: 20px;
-    padding-bottom: 20px;
-    .clearfix();
-  }
-}
-
-.l-content {
-  .clearfix();
-}
-
-.l-main-content {
-  float: left;
-  width: 70%;
-}
-
-.l-sidebar {
-  float: right;
-  width: 30%;
-}
-
-/* Set the fixed height of the footer here */
-.l-push,
-.l-footer {
-  height: @footer-height;
-}
-
-.l-footer {
-  width: 100%;
-  background-color: @black;
-  color: @gray-lighter;
-  font-size: @font-size-small;
-  line-height: 100%;
-
-  .l-constrained {
-    padding-top: (@footer-height - 32) / 2;
-    .clearfix();
-  }
-
-  a {
-    color: @gray-lighter;
-    text-decoration: none;
-
-    &:hover,
-    &:active {
-      text-decoration: underline;
-    }
-  }
-}
-
-
-// Header
-// -------------------------
-
-.logo {
-  margin: 0;
-
-  a {
-    display: block;
-    float: left;
-    width: 100px;
-    height: 100px;
-    background: transparent url("../images/jsengineswitcher-logo.png") no-repeat scroll 0 0;
-    text-indent: -9999em;
-  }
-}
-
-.primary-nav {
-  position: relative;
-  left: 40px;
-  float: left;
-}
-
-
-// Footer
-// -------------------------
-
-.l-copyright {
-  float: left;
-    p {
-      margin: 0;
-      padding: 0;
-  }
-}
-
-.l-social {
-  float: right;
-
-  li {
-    display: inline;
-    list-style: none outside none;
-    padding-left: 10px;
-
-    a {
-      text-indent: -9999px;
-      outline: none;
-    }
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/mixins.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/mixins.less
deleted file mode 100644
index d26eee79..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/mixins.less
+++ /dev/null
@@ -1,9 +0,0 @@
-//
-// Mixins
-// --------------------------------------------------
-
-// NO Drop shadows
-.no-box-shadow {
-  -webkit-box-shadow: none; // iOS <4.3 & Android <4.1
-          box-shadow: none;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/navbar.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/navbar.less
deleted file mode 100644
index 95edf3c2..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/navbar.less
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Navbars
-// --------------------------------------------------
-
-
-// Wrapper and base class
-//
-// Provide a static navbar from which we expand to create full-width, fixed, and
-// other navbar variations.
-
-.navbar {
-  border: none;
-  border-radius: 0;
-}
-
-// Navbar nav links
-//
-// Builds on top of the `.nav` components with it's own modifier class to make
-// the nav the full height of the horizontal nav (above 768px).
-
-.navbar-nav {
-  float: left;
-  margin: 0 auto;
-
-  > li {
-    > a {
-      float: none;
-      // Vertically center the text given @navbar-height
-      padding: ((@navbar-height - @line-height-computed) / 2) 15px ((@navbar-height - @line-height-computed) / 2);
-      border: 1px solid transparent;
-      font-family: "Open Sans", sans-serif;
-      font-size: 2.0em;
-      text-decoration: none;
-      text-transform: uppercase;
-      outline: none;
-    }
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/page-socials.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/page-socials.less
deleted file mode 100644
index ea12dc09..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/page-socials.less
+++ /dev/null
@@ -1,14 +0,0 @@
-.page-socials {
-  min-height: 60px;
-  margin-top: 20px;
-  padding-top: 15px;
-  border-top: 1px solid #b2b2b2;
-}
-
-.share-buttons {
-  li {
-    margin-right: 15px;
-    vertical-align: top;
-    line-height: normal;
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/type.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/type.less
deleted file mode 100644
index 02d69502..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/type.less
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Typography
-// --------------------------------------------------
-
-// Headings
-// -------------------------
-
-h1, h2, h3 {
-  margin-top: 10px;
-}
-
-h1, h2 {
-  line-height: 40px;
-}
-
-h2 {
-  color: @black;
-  font-weight: bold;
-}
-
-h3 {
-  color: @gray-dark;
-  line-height: @line-height-computed * 1.25;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/variables.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/variables.less
deleted file mode 100644
index 498c9796..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore1Full.Mvc1/wwwroot/styles/variables.less
+++ /dev/null
@@ -1,7 +0,0 @@
-// Colors
-// -------------------------
-@black:                 #1d0d0d;
-
-// Footer
-// -------------------------
-@footer-height:                    55px;
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/.bowerrc b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/.bowerrc
deleted file mode 100644
index ea81a597..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/.bowerrc
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "registry": "https://registry.bower.io",
-  "directory": "wwwroot/lib"
-}
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Infrastructure/Helpers/CommonExtensions.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Infrastructure/Helpers/CommonExtensions.cs
deleted file mode 100644
index 944ba51c..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Infrastructure/Helpers/CommonExtensions.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Text.RegularExpressions;
-
-using Microsoft.AspNetCore.Html;
-using Microsoft.AspNetCore.Mvc.Rendering;
-
-namespace JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21.Infrastructure.Helpers
-{
-	public static class CommonExtensions
-	{
-		public static HtmlString EncodedReplace(this IHtmlHelper htmlHelper, string input,
-			string pattern, string replacement)
-		{
-			return new HtmlString(Regex.Replace(htmlHelper.Encode(input), pattern, replacement));
-		}
-	}
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs
deleted file mode 100644
index acde832e..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using System;
-
-using Microsoft.AspNetCore.Razor.TagHelpers;
-
-namespace JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21.Infrastructure.TagHelpers
-{
-	[HtmlTargetElement("conditional-comment")]
-	public class ConditionalCommentTagHelper : TagHelper
-	{
-		[HtmlAttributeName("type")]
-		public ConditionalCommentType CommentType { get; set; }
-
-		[HtmlAttributeName("expression")]
-		public string Expression { get; set; }
-
-
-		public override void Process(TagHelperContext context, TagHelperOutput output)
-		{
-			output.TagName = null;
-
-			ConditionalCommentType type = CommentType;
-
-			string ifCommentStartPart;
-			string ifCommentEndPart;
-
-			switch (type)
-			{
-				case ConditionalCommentType.Hidden:
-					ifCommentStartPart = "";
-
-					break;
-				case ConditionalCommentType.RevealedValidatingSimplified:
-					ifCommentStartPart = "";
-
-					break;
-				case ConditionalCommentType.Revealed:
-					ifCommentStartPart = "";
-
-					break;
-				default:
-					throw new NotSupportedException();
-			}
-
-			TagHelperContent preContent = output.PreContent;
-			preContent.AppendHtml(ifCommentStartPart);
-			preContent.AppendHtml(Expression);
-			preContent.AppendHtml(ifCommentEndPart);
-
-			string endIfComment;
-
-			switch (type)
-			{
-				case ConditionalCommentType.Hidden:
-					endIfComment = "";
-					break;
-				case ConditionalCommentType.RevealedValidating:
-				case ConditionalCommentType.RevealedValidatingSimplified:
-					endIfComment = "";
-					break;
-				case ConditionalCommentType.Revealed:
-					endIfComment = "";
-					break;
-				default:
-					throw new NotSupportedException();
-			}
-
-			output.PostContent.AppendHtml(endIfComment);
-		}
-	}
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Infrastructure/TagHelpers/ConditionalCommentType.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Infrastructure/TagHelpers/ConditionalCommentType.cs
deleted file mode 100644
index fa53afea..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Infrastructure/TagHelpers/ConditionalCommentType.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21.Infrastructure.TagHelpers
-{
-	public enum ConditionalCommentType
-	{
-		Hidden,
-		Revealed,
-		RevealedValidating,
-		RevealedValidatingSimplified
-	}
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21.csproj
index 010a86b6..620e4ee2 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21.csproj
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21.csproj
@@ -2,50 +2,39 @@
 
   
     JS Engine Switcher: Sample ASP.NET Core 2.1 MVC 2.1 Site
-    3.19.0
+    3.30.2
     netcoreapp2.1
     Exe
     true
+    $(NoWarn);NU1902;NU1903;NU1904
+    true
     true
+    true
     false
+    false
   
 
   
 
   
     
-    
-    
-    
-    
-    
-    
+    
+    
+    
+    
+    
+    
 
     
     
     
     
     
-    
+    
     
     
   
 
-  
-    
-  
-  
-    
-  
-  
-    
-  
-  
-    
-  
-  
-    
-    
-    
-  
+  
+
 
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Program.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Program.cs
index 51f24982..3dcfa5fc 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Program.cs
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Program.cs
@@ -1,4 +1,6 @@
-using Microsoft.AspNetCore;
+using System.IO;
+
+using Microsoft.AspNetCore;
 using Microsoft.AspNetCore.Hosting;
 
 namespace JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21
@@ -12,6 +14,10 @@ public static void Main(string[] args)
 
 		public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
 			WebHost.CreateDefaultBuilder(args)
+				.UseWebRoot(Path.Combine(
+					Directory.GetCurrentDirectory(),
+					"../JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot"
+				))
 				.UseStartup()
 				;
 	}
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Properties/launchSettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Properties/launchSettings.json
index 2e5caf19..def3944c 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Properties/launchSettings.json
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Properties/launchSettings.json
@@ -8,13 +8,6 @@
     }
   },
   "profiles": {
-    "IIS Express": {
-      "commandName": "IISExpress",
-      "launchBrowser": true,
-      "environmentVariables": {
-        "ASPNETCORE_ENVIRONMENT": "Development"
-      }
-    },
     "JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21": {
       "commandName": "Project",
       "launchBrowser": true,
@@ -22,6 +15,13 @@
         "ASPNETCORE_ENVIRONMENT": "Development"
       },
       "applicationUrl": "http://localhost:1973/"
+    },
+    "IIS Express": {
+      "commandName": "IISExpress",
+      "launchBrowser": true,
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      }
     }
   }
 }
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Startup.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Startup.cs
index decf9c90..5a5b6be7 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Startup.cs
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Startup.cs
@@ -11,7 +11,6 @@
 using JavaScriptEngineSwitcher.Jint;
 using JavaScriptEngineSwitcher.Jurassic;
 using JavaScriptEngineSwitcher.Msie;
-using JavaScriptEngineSwitcher.NiL;
 using JavaScriptEngineSwitcher.Sample.Logic.Services;
 using JavaScriptEngineSwitcher.Vroom;
 
@@ -55,8 +54,10 @@ public void ConfigureServices(IServiceCollection services)
 
 			// Add JavaScriptEngineSwitcher services to the services container.
 			services.AddJsEngineSwitcher(options =>
-				options.DefaultEngineName = ChakraCoreJsEngine.EngineName
-			)
+			{
+				options.AllowCurrentProperty = false;
+				options.DefaultEngineName = ChakraCoreJsEngine.EngineName;
+			})
 				.AddChakraCore()
 				.AddJint()
 				.AddJurassic()
@@ -64,7 +65,6 @@ public void ConfigureServices(IServiceCollection services)
 				{
 					options.EngineMode = JsEngineMode.ChakraIeJsRt;
 				})
-				.AddNiL()
 				.AddVroom()
 				;
 
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/Home/Contact.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/Home/Contact.cshtml
index cd9663df..58785ebe 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/Home/Contact.cshtml
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/Home/Contact.cshtml
@@ -5,19 +5,4 @@
 

@ViewBag.Title

@ViewBag.Body -
- -@section Scripts { - -} \ No newline at end of file + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/Shared/_JsEvaluationErrorList.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/Shared/_JsEvaluationErrorList.cshtml index 4f3e0b6c..9e0601d6 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/Shared/_JsEvaluationErrorList.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/Shared/_JsEvaluationErrorList.cshtml @@ -1,4 +1,4 @@ -@using JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21.Infrastructure.Helpers +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.Helpers @using JavaScriptEngineSwitcher.Sample.Logic.Models @model IList diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/Shared/_Layout.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/Shared/_Layout.cshtml index 4de7a488..93808b86 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/Shared/_Layout.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/Shared/_Layout.cshtml @@ -1,4 +1,4 @@ -@using JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21.Infrastructure.TagHelpers +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.TagHelpers @@ -61,9 +61,10 @@ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/_ViewImports.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/_ViewImports.cshtml index 817835eb..8fe8384e 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/_ViewImports.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/Views/_ViewImports.cshtml @@ -1,2 +1,2 @@ @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" -@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21" \ No newline at end of file +@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure" \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/bower.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/bower.json deleted file mode 100644 index cc2b80bb..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/bower.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "jsengineswitcher.sample.aspnetcore21.mvc21", - "dependencies": { - "modernizr": "2.8.3", - "jquery-compat": "jquery#1.10.2", - "jquery": "jquery#2.0.3", - "jquery-validation": "1.13.1", - "jquery-validation-unobtrusive": "3.2.3", - "bootstrap": "3.3.0" - } -} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/gulpfile.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/gulpfile.js deleted file mode 100644 index 0f259437..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/gulpfile.js +++ /dev/null @@ -1,130 +0,0 @@ -/*global require, exports */ -/*jshint esversion: 6 */ -const WEB_ROOT_PATH = "wwwroot"; -const BOWER_DIR_PATH = WEB_ROOT_PATH + "/lib"; -const STYLE_DIR_PATH = WEB_ROOT_PATH + '/styles'; -const SCRIPT_DIR_PATH = WEB_ROOT_PATH + '/scripts'; - -// include plug-ins -let { src, dest, series, parallel, watch } = require('gulp'); -let del = require('del'); -let sourcemaps = require('gulp-sourcemaps'); -let rename = require('gulp-rename'); -let concat = require('gulp-concat'); -let less = require('gulp-less'); -let autoprefixer = require('gulp-autoprefixer'); -let cleanCss = require('gulp-clean-css'); -let uglify = require('gulp-uglify'); - -//#region Clean -//#region Clean builded assets -function cleanBuildedStyles() { - return del([STYLE_DIR_PATH + '/build/*']); -} - -function cleanBuildedScripts() { - return del([SCRIPT_DIR_PATH + '/build/*']); -} - -let cleanBuildedAssets = parallel(cleanBuildedStyles, cleanBuildedScripts); -//#endregion -//#endregion - -//#region Build assets -//#region Build styles -let autoprefixerOptions = { - overrideBrowserslist: ['> 1%', 'last 3 versions', 'Firefox ESR', 'Opera 12.1'], - cascade: true -}; -let cssCleanOptions = { specialComments: '*' }; -let cssRenameOptions = { extname: '.min.css' }; - -function buildCommonStyles() { - return src([STYLE_DIR_PATH + '/app.less']) - .pipe(sourcemaps.init()) - .pipe(less({ - relativeUrls: true, - rootpath: '/styles/' - })) - .pipe(autoprefixer(autoprefixerOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(STYLE_DIR_PATH + '/build')) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(concat('common-styles.css')) - .pipe(cleanCss(cssCleanOptions)) - .pipe(rename(cssRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(STYLE_DIR_PATH + '/build')) - ; -} - -let buildStyles = buildCommonStyles; -//#endregion - -//#region Build scripts -let jsConcatOptions = { newLine: ';' }; -let jsUglifyOptions = { - output: { comments: /^!/ } -}; -let jsRenameOptions = { extname: '.min.js' }; - -function buildModernizrScripts() { - return src([BOWER_DIR_PATH + '/modernizr/modernizr.js']) - .pipe(sourcemaps.init()) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -function buildCommonScripts() { - return src([SCRIPT_DIR_PATH + '/common.js']) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(rename({ basename: 'common-scripts' })) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -function buildEvaluationFormScripts() { - return src([BOWER_DIR_PATH + '/jquery-validation/dist/jquery.validate.js', - BOWER_DIR_PATH + '/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js', - BOWER_DIR_PATH + '/bootstrap/js/button.js', - SCRIPT_DIR_PATH + '/evaluation-form.js']) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(concat('evaluation-form-scripts.js', jsConcatOptions)) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -let buildScripts = parallel(buildModernizrScripts, buildCommonScripts, buildEvaluationFormScripts); -//#endregion - -let buildAssets = parallel(buildStyles, buildScripts); -//#endregion - -//#region Watch assets -function watchStyles() { - return watch([STYLE_DIR_PATH + '/**/*.{less,css}', '!' + STYLE_DIR_PATH + '/build/**/*.*'], - buildStyles); -} - -function watchScripts() { - return watch([SCRIPT_DIR_PATH + '/**/*.js', '!' + SCRIPT_DIR_PATH + '/build/**/*.*'], - buildScripts); -} - -let watchAssets = parallel(watchStyles, watchScripts); -//#endregion - -// Export tasks -exports.cleanBuildedAssets = cleanBuildedAssets; -exports.buildAssets = buildAssets; -exports.watchAssets = watchAssets; -exports.default = series(cleanBuildedAssets, buildAssets); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/0.gif b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/0.gif deleted file mode 100644 index 35d42e80..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/0.gif and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/clear-text.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/clear-text.png deleted file mode 100644 index 9d217b7f..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/clear-text.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/icons/32x32/social-media-icons-32.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/icons/32x32/social-media-icons-32.png deleted file mode 100644 index 49aa1fe3..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/icons/32x32/social-media-icons-32.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/icons/48x48/error.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/icons/48x48/error.png deleted file mode 100644 index 3d6185f7..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/icons/48x48/error.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/jsengineswitcher-logo.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/jsengineswitcher-logo.png deleted file mode 100644 index 12ed97e0..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/images/jsengineswitcher-logo.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/scripts/_references.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/scripts/_references.js deleted file mode 100644 index 2b54eea8..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/scripts/_references.js and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/scripts/common.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/scripts/common.js deleted file mode 100644 index c94bf102..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/scripts/common.js +++ /dev/null @@ -1,29 +0,0 @@ -var jsEngineSwitcher; - -(function (jsEngineSwitcher, undefined) { - "use strict"; - - jsEngineSwitcher.registerNamespace = function (namespaceString) { - var parts = namespaceString.split("."), - parent = jsEngineSwitcher, - i - ; - - if (parts[0] === "jsEngineSwitcher") { - parts = parts.slice(1); - } - - for (i = 0; i < parts.length; i += 1) { - if (typeof parent[parts[i]] === "undefined") { - parent[parts[i]] = {}; - } - parent = parent[parts[i]]; - } - - return parent; - }; - - jsEngineSwitcher.hasScrollbar = function(elem) { - return (elem.clientHeight < elem.scrollHeight); - }; -}(jsEngineSwitcher = jsEngineSwitcher || {})); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/scripts/evaluation-form.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/scripts/evaluation-form.js deleted file mode 100644 index da1f0199..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/scripts/evaluation-form.js +++ /dev/null @@ -1,83 +0,0 @@ -(function (jsEngineSwitcher, $, undefined) { - "use strict"; - - var $evaluationForm, - $evaluationInputField, - $evaluationInputClearButton, - $evaluateButton - ; - - $(function () { - $evaluationForm = $("form[data-form-type='evaluation-form']"); - $evaluationInputField = $(":input[data-control-type='evaluation-input-field']", $evaluationForm); - $evaluationInputClearButton = $("
"); - $evaluateButton = $(":input[data-control-type='evaluate-button']", $evaluationForm); - - $evaluationForm.on("submit", onEvaluationFormSubmitHandler); - - $evaluationInputClearButton.on("click", onEvaluationInputClearButtonClickHandler); - $evaluationInputField.parent().append($evaluationInputClearButton); - refreshEvaluationInputClearButton(); - $evaluationInputField - .on("input propertychange keydown keyup paste", onEvaluationInputFieldChangeHandler) - ; - - $evaluateButton.removeAttr("disabled"); - }); - - $(window).unload(function() { - $evaluationForm.off("submit", onEvaluationFormSubmitHandler); - - $evaluationInputClearButton - .off("click", onEvaluationInputClearButtonClickHandler) - .remove() - ; - - $evaluationInputField - .off("input propertychange keydown keyup paste", onEvaluationInputFieldChangeHandler) - ; - - $evaluationForm = null; - $evaluationInputField = null; - $evaluationInputClearButton = null; - $evaluateButton = null; - }); - - var refreshEvaluationInputClearButton = function() { - if ($.trim($evaluationInputField.val()).length > 0) { - $evaluationInputClearButton.show(); - } else { - $evaluationInputClearButton.hide(); - } - - if (jsEngineSwitcher.hasScrollbar($evaluationInputField.get(0))) { - $evaluationInputClearButton.addClass("with-scrollbar"); - } - else { - $evaluationInputClearButton.removeClass("with-scrollbar"); - } - }; - - var onEvaluationFormSubmitHandler = function () { - var $form = $(this); - if ($form.valid()) { - $evaluateButton.attr("disabled", "disabled"); - $("textarea[data-control-type='evaluation-output-field']", $form).val(''); - - return true; - } - - return false; - }; - - var onEvaluationInputFieldChangeHandler = function () { - refreshEvaluationInputClearButton(); - }; - - var onEvaluationInputClearButtonClickHandler = function() { - $evaluationInputField.val(""); - - var $button = $(this); - $button.hide(); - }; -}(jsEngineSwitcher, jQuery)); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/app.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/app.less deleted file mode 100644 index c41a9315..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/app.less +++ /dev/null @@ -1,71 +0,0 @@ -/*! - * Bootstrap v3.3.0 (http://getbootstrap.com) - * Copyright 2011-2014 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ - -// Core variables and mixins -@import "bootstrap-custom-variables.less"; -@import "../lib/bootstrap/less/mixins.less"; - -// Reset -@import "../lib/bootstrap/less/normalize.less"; -//@import "../lib/bootstrap/less/print.less"; -//@import "../lib/bootstrap/less/glyphicons.less"; - -// Core CSS -@import "../lib/bootstrap/less/scaffolding.less"; -@import "../lib/bootstrap/less/type.less"; -@import "../lib/bootstrap/less/code.less"; -//@import "../lib/bootstrap/less/grid.less"; -//@import "../lib/bootstrap/less/tables.less"; -@import "../lib/bootstrap/less/forms.less"; -//@import "../lib/bootstrap/less/buttons.less"; - -// Components -//@import "../lib/bootstrap/less/component-animations.less"; -//@import "../lib/bootstrap/less/dropdowns.less"; -//@import "../lib/bootstrap/less/button-groups.less"; -//@import "../lib/bootstrap/less/input-groups.less"; -@import "../lib/bootstrap/less/navs.less"; -@import "../lib/bootstrap/less/navbar.less"; -//@import "../lib/bootstrap/less/breadcrumbs.less"; -//@import "../lib/bootstrap/less/pagination.less"; -//@import "../lib/bootstrap/less/pager.less"; -//@import "../lib/bootstrap/less/labels.less"; -//@import "../lib/bootstrap/less/badges.less"; -//@import "../lib/bootstrap/less/jumbotron.less"; -//@import "../lib/bootstrap/less/thumbnails.less"; -//@import "../lib/bootstrap/less/alerts.less"; -//@import "../lib/bootstrap/less/progress-bars.less"; -//@import "../lib/bootstrap/less/media.less"; -//@import "../lib/bootstrap/less/list-group.less"; -//@import "../lib/bootstrap/less/panels.less"; -//@import "../lib/bootstrap/less/responsive-embed.less"; -//@import "../lib/bootstrap/less/wells.less"; -//@import "../lib/bootstrap/less/close.less"; - -// Components w/ JavaScript -//@import "../lib/bootstrap/less/modals.less"; -//@import "../lib/bootstrap/less/tooltip.less"; -//@import "../lib/bootstrap/less/popovers.less"; -//@import "../lib/bootstrap/less/carousel.less"; - -// Utility classes -@import "../lib/bootstrap/less/utilities.less"; -//@import "../lib/bootstrap/less/responsive-utilities.less"; - -// JavaScriptEngineSwitcher specs -@import "variables.less"; -@import "mixins.less"; - -@import "type.less"; -@import "code.less"; -@import "forms.less"; -@import "buttons.less"; -@import "icons.less"; -@import "navbar.less"; - -@import "layout.less"; -@import "evaluation-form.less"; -@import "page-socials.less"; \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/bootstrap-custom-variables.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/bootstrap-custom-variables.less deleted file mode 100644 index 0be2aa6f..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/bootstrap-custom-variables.less +++ /dev/null @@ -1,856 +0,0 @@ -// -// Variables -// -------------------------------------------------- - - -//== Colors -// -//## Gray and brand colors for use across Bootstrap. - -@gray-base: #323330; -@gray-darker: lighten(@gray-base, 13.5%); // #222 -@gray-dark: lighten(@gray-base, 20%); // #333 -@gray: lighten(@gray-base, 33.5%); // #555 -@gray-light: lighten(@gray-base, 46.7%); // #777 -@gray-lighter: #e3e3e3; - -@brand-primary: #428bca; -@brand-success: #5cb85c; -@brand-info: #5bc0de; -@brand-warning: #f0ad4e; -@brand-danger: #d9534f; - - -//== Scaffolding -// -//## Settings for some of the most global styles. - -//** Background color for ``. -@body-bg: #fff; -//** Global text color on ``. -@text-color: #1d0d0d; - -//** Global textual link color. -@link-color: @brand-primary; -//** Link hover color set via `darken()` function. -@link-hover-color: darken(@link-color, 15%); -//** Link hover decoration. -@link-hover-decoration: underline; - - -//== Typography -// -//## Font, line-height, and color for body text, headings, and more. - -@font-family-sans-serif: "Helvetica Neue", Arial, sans-serif; -@font-family-serif: Georgia, "Times New Roman", Times, serif; -//** Default monospace fonts for ``, ``, and `
`.
-@font-family-monospace:   Consolas, "Courier New", monospace;
-@font-family-base:        @font-family-sans-serif;
-
-@font-size-base:          14px;
-@font-size-large:         ceil((@font-size-base * 1.25)); // ~18px
-@font-size-small:         ceil((@font-size-base * 0.85)); // ~12px
-
-@font-size-h1:            floor(@font-size-base * 3);
-@font-size-h2:            @font-size-base * 2.5;
-@font-size-h3:            ceil(@font-size-base * 1.75);
-@font-size-h4:            ceil(@font-size-base * 1.25);
-@font-size-h5:            @font-size-base;
-@font-size-h6:            ceil(@font-size-base * 0.85);
-
-//** Unit-less `line-height` for use in components like buttons.
-@line-height-base:        1.428571429; // 20/14
-//** Computed "line-height" (`font-size` * `line-height`) for use with `margin`, `padding`, etc.
-@line-height-computed:    floor((@font-size-base * @line-height-base)); // ~20px
-
-//** By default, this inherits from the ``.
-@headings-font-family:    "Open Sans", sans-serif;
-@headings-font-weight:    normal;
-@headings-line-height:    1.1;
-@headings-color:          inherit;
-
-
-//== Iconography
-//
-//## Specify custom location and filename of the included Glyphicons icon font. Useful for those including Bootstrap via Bower.
-
-//** Load fonts from this directory.
-@icon-font-path:          "../fonts/";
-//** File name for all font files.
-@icon-font-name:          "glyphicons-halflings-regular";
-//** Element ID within SVG icon file.
-@icon-font-svg-id:        "glyphicons_halflingsregular";
-
-
-//== Components
-//
-//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start).
-
-@padding-base-vertical:     4px;
-@padding-base-horizontal:   6px;
-
-@padding-large-vertical:    10px;
-@padding-large-horizontal:  16px;
-
-@padding-small-vertical:    5px;
-@padding-small-horizontal:  10px;
-
-@padding-xs-vertical:       1px;
-@padding-xs-horizontal:     5px;
-
-@line-height-large:         1.33;
-@line-height-small:         1.5;
-
-@border-radius-base:        4px;
-@border-radius-large:       6px;
-@border-radius-small:       3px;
-
-//** Global color for active items (e.g., navs or dropdowns).
-@component-active-color:    #fff;
-//** Global background color for active items (e.g., navs or dropdowns).
-@component-active-bg:       @brand-primary;
-
-//** Width of the `border` for generating carets that indicator dropdowns.
-@caret-width-base:          4px;
-//** Carets increase slightly in size for larger components.
-@caret-width-large:         5px;
-
-
-//== Tables
-//
-//## Customizes the `.table` component with basic values, each used across all table variations.
-
-//** Padding for ``s and ``s.
-@table-cell-padding:            8px;
-//** Padding for cells in `.table-condensed`.
-@table-condensed-cell-padding:  5px;
-
-//** Default background color used for all tables.
-@table-bg:                      transparent;
-//** Background color used for `.table-striped`.
-@table-bg-accent:               #f9f9f9;
-//** Background color used for `.table-hover`.
-@table-bg-hover:                #f5f5f5;
-@table-bg-active:               @table-bg-hover;
-
-//** Border color for table and cell borders.
-@table-border-color:            #ddd;
-
-
-//== Buttons
-//
-//## For each of Bootstrap's buttons, define text, background and border color.
-
-@btn-font-weight:                normal;
-
-@btn-default-color:              #333;
-@btn-default-bg:                 @gray-lighter;
-@btn-default-border:             @gray-lighter;
-
-@btn-primary-color:              #fff;
-@btn-primary-bg:                 @brand-primary;
-@btn-primary-border:             darken(@btn-primary-bg, 5%);
-
-@btn-success-color:              #fff;
-@btn-success-bg:                 @brand-success;
-@btn-success-border:             darken(@btn-success-bg, 5%);
-
-@btn-info-color:                 #fff;
-@btn-info-bg:                    @brand-info;
-@btn-info-border:                darken(@btn-info-bg, 5%);
-
-@btn-warning-color:              #fff;
-@btn-warning-bg:                 @brand-warning;
-@btn-warning-border:             darken(@btn-warning-bg, 5%);
-
-@btn-danger-color:               #fff;
-@btn-danger-bg:                  @brand-danger;
-@btn-danger-border:              darken(@btn-danger-bg, 5%);
-
-@btn-link-disabled-color:        @gray-light;
-
-
-//== Forms
-//
-//##
-
-//** `` background color
-@input-bg:                       #fff;
-//** `` background color
-@input-bg-disabled:              @gray-lighter;
-
-//** Text color for ``s
-@input-color:                    @gray;
-//** `` border color
-@input-border:                   #b2b2b2;
-
-// TODO: Rename `@input-border-radius` to `@input-border-radius-base` in v4
-//** Default `.form-control` border radius
-@input-border-radius:            @border-radius-base;
-//** Large `.form-control` border radius
-@input-border-radius-large:      @border-radius-large;
-//** Small `.form-control` border radius
-@input-border-radius-small:      @border-radius-small;
-
-//** Border color for inputs on focus
-@input-border-focus:             #d4b33a;
-
-//** Placeholder text color
-@input-color-placeholder:        #999;
-
-//** Default `.form-control` height
-@input-height-base:              (@line-height-computed + (@padding-base-vertical * 2) + 2);
-//** Large `.form-control` height
-@input-height-large:             (ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 2);
-//** Small `.form-control` height
-@input-height-small:             (floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 2);
-
-@legend-color:                   @gray-dark;
-@legend-border-color:            #e5e5e5;
-
-//** Background color for textual input addons
-@input-group-addon-bg:           @gray-lighter;
-//** Border color for textual input addons
-@input-group-addon-border-color: @input-border;
-
-//** Disabled cursor for form controls and buttons.
-@cursor-disabled:                not-allowed;
-
-
-//== Dropdowns
-//
-//## Dropdown menu container and contents.
-
-//** Background for the dropdown menu.
-@dropdown-bg:                    #fff;
-//** Dropdown menu `border-color`.
-@dropdown-border:                rgba(0,0,0,.15);
-//** Dropdown menu `border-color` **for IE8**.
-@dropdown-fallback-border:       #ccc;
-//** Divider color for between dropdown items.
-@dropdown-divider-bg:            #e5e5e5;
-
-//** Dropdown link text color.
-@dropdown-link-color:            @gray-dark;
-//** Hover color for dropdown links.
-@dropdown-link-hover-color:      darken(@gray-dark, 5%);
-//** Hover background for dropdown links.
-@dropdown-link-hover-bg:         #f5f5f5;
-
-//** Active dropdown menu item text color.
-@dropdown-link-active-color:     @component-active-color;
-//** Active dropdown menu item background color.
-@dropdown-link-active-bg:        @component-active-bg;
-
-//** Disabled dropdown menu item background color.
-@dropdown-link-disabled-color:   @gray-light;
-
-//** Text color for headers within dropdown menus.
-@dropdown-header-color:          @gray-light;
-
-//** Deprecated `@dropdown-caret-color` as of v3.1.0
-@dropdown-caret-color:           #000;
-
-
-//-- Z-index master list
-//
-// Warning: Avoid customizing these values. They're used for a bird's eye view
-// of components dependent on the z-axis and are designed to all work together.
-//
-// Note: These variables are not generated into the Customizer.
-
-@zindex-navbar:            1000;
-@zindex-dropdown:          1000;
-@zindex-popover:           1060;
-@zindex-tooltip:           1070;
-@zindex-navbar-fixed:      1030;
-@zindex-modal:             1040;
-
-
-//== Media queries breakpoints
-//
-//## Define the breakpoints at which your layout will change, adapting to different screen sizes.
-
-// Extra small screen / phone
-//** Deprecated `@screen-xs` as of v3.0.1
-@screen-xs:                  480px;
-//** Deprecated `@screen-xs-min` as of v3.2.0
-@screen-xs-min:              @screen-xs;
-//** Deprecated `@screen-phone` as of v3.0.1
-@screen-phone:               @screen-xs-min;
-
-// Small screen / tablet
-//** Deprecated `@screen-sm` as of v3.0.1
-@screen-sm:                  768px;
-@screen-sm-min:              @screen-sm;
-//** Deprecated `@screen-tablet` as of v3.0.1
-@screen-tablet:              @screen-sm-min;
-
-// Medium screen / desktop
-//** Deprecated `@screen-md` as of v3.0.1
-@screen-md:                  992px;
-@screen-md-min:              @screen-md;
-//** Deprecated `@screen-desktop` as of v3.0.1
-@screen-desktop:             @screen-md-min;
-
-// Large screen / wide desktop
-//** Deprecated `@screen-lg` as of v3.0.1
-@screen-lg:                  1200px;
-@screen-lg-min:              @screen-lg;
-//** Deprecated `@screen-lg-desktop` as of v3.0.1
-@screen-lg-desktop:          @screen-lg-min;
-
-// So media queries don't overlap when required, provide a maximum
-@screen-xs-max:              (@screen-sm-min - 1);
-@screen-sm-max:              (@screen-md-min - 1);
-@screen-md-max:              (@screen-lg-min - 1);
-
-
-//== Grid system
-//
-//## Define your custom responsive grid.
-
-//** Number of columns in the grid.
-@grid-columns:              12;
-//** Padding between columns. Gets divided in half for the left and right.
-@grid-gutter-width:         30px;
-// Navbar collapse
-//** Point at which the navbar becomes uncollapsed.
-@grid-float-breakpoint:     @screen-sm-min;
-//** Point at which the navbar begins collapsing.
-@grid-float-breakpoint-max: (@grid-float-breakpoint - 1);
-
-
-//== Container sizes
-//
-//## Define the maximum width of `.container` for different screen sizes.
-
-// Small screen / tablet
-@container-tablet:             (720px + @grid-gutter-width);
-//** For `@screen-sm-min` and up.
-@container-sm:                 @container-tablet;
-
-// Medium screen / desktop
-@container-desktop:            (940px + @grid-gutter-width);
-//** For `@screen-md-min` and up.
-@container-md:                 @container-desktop;
-
-// Large screen / wide desktop
-@container-large-desktop:      (1140px + @grid-gutter-width);
-//** For `@screen-lg-min` and up.
-@container-lg:                 @container-large-desktop;
-
-
-//== Navbar
-//
-//##
-
-// Basics of a navbar
-@navbar-height:                    100px;
-@navbar-margin-bottom:             0;
-@navbar-border-radius:             @border-radius-base;
-@navbar-padding-horizontal:        0;
-@navbar-padding-vertical:          ((@navbar-height - @line-height-computed) / 2);
-@navbar-collapse-max-height:       340px;
-
-@navbar-default-color:             @gray-base;
-@navbar-default-bg:                #f0db4f;
-@navbar-default-border:            #f0db4f;
-
-// Navbar links
-@navbar-default-link-color:                @navbar-default-color;
-@navbar-default-link-hover-color:          @gray-dark;
-@navbar-default-link-hover-bg:             transparent;
-@navbar-default-link-active-color:         @navbar-default-color;
-@navbar-default-link-active-bg:            transparent;
-@navbar-default-link-disabled-color:       #ccc;
-@navbar-default-link-disabled-bg:          transparent;
-
-// Navbar brand label
-@navbar-default-brand-color:               @navbar-default-link-color;
-@navbar-default-brand-hover-color:         darken(@navbar-default-brand-color, 10%);
-@navbar-default-brand-hover-bg:            transparent;
-
-// Navbar toggle
-@navbar-default-toggle-hover-bg:           #ddd;
-@navbar-default-toggle-icon-bar-bg:        @gray-dark;
-@navbar-default-toggle-border-color:       #ddd;
-
-
-// Inverted navbar
-// Reset inverted navbar basics
-@navbar-inverse-color:                      lighten(@gray-light, 15%);
-@navbar-inverse-bg:                         #222;
-@navbar-inverse-border:                     darken(@navbar-inverse-bg, 10%);
-
-// Inverted navbar links
-@navbar-inverse-link-color:                 lighten(@gray-light, 15%);
-@navbar-inverse-link-hover-color:           #fff;
-@navbar-inverse-link-hover-bg:              transparent;
-@navbar-inverse-link-active-color:          @navbar-inverse-link-hover-color;
-@navbar-inverse-link-active-bg:             darken(@navbar-inverse-bg, 10%);
-@navbar-inverse-link-disabled-color:        #444;
-@navbar-inverse-link-disabled-bg:           transparent;
-
-// Inverted navbar brand label
-@navbar-inverse-brand-color:                @navbar-inverse-link-color;
-@navbar-inverse-brand-hover-color:          #fff;
-@navbar-inverse-brand-hover-bg:             transparent;
-
-// Inverted navbar toggle
-@navbar-inverse-toggle-hover-bg:            #333;
-@navbar-inverse-toggle-icon-bar-bg:         #fff;
-@navbar-inverse-toggle-border-color:        #333;
-
-
-//== Navs
-//
-//##
-
-//=== Shared nav styles
-@nav-link-padding:                          10px 15px;
-@nav-link-hover-bg:                         @gray-lighter;
-
-@nav-disabled-link-color:                   @gray-light;
-@nav-disabled-link-hover-color:             @gray-light;
-
-//== Tabs
-@nav-tabs-border-color:                     #ddd;
-
-@nav-tabs-link-hover-border-color:          @gray-lighter;
-
-@nav-tabs-active-link-hover-bg:             @body-bg;
-@nav-tabs-active-link-hover-color:          @gray;
-@nav-tabs-active-link-hover-border-color:   #ddd;
-
-@nav-tabs-justified-link-border-color:            #ddd;
-@nav-tabs-justified-active-link-border-color:     @body-bg;
-
-//== Pills
-@nav-pills-border-radius:                   @border-radius-base;
-@nav-pills-active-link-hover-bg:            @component-active-bg;
-@nav-pills-active-link-hover-color:         @component-active-color;
-
-
-//== Pagination
-//
-//##
-
-@pagination-color:                     @link-color;
-@pagination-bg:                        #fff;
-@pagination-border:                    #ddd;
-
-@pagination-hover-color:               @link-hover-color;
-@pagination-hover-bg:                  @gray-lighter;
-@pagination-hover-border:              #ddd;
-
-@pagination-active-color:              #fff;
-@pagination-active-bg:                 @brand-primary;
-@pagination-active-border:             @brand-primary;
-
-@pagination-disabled-color:            @gray-light;
-@pagination-disabled-bg:               #fff;
-@pagination-disabled-border:           #ddd;
-
-
-//== Pager
-//
-//##
-
-@pager-bg:                             @pagination-bg;
-@pager-border:                         @pagination-border;
-@pager-border-radius:                  15px;
-
-@pager-hover-bg:                       @pagination-hover-bg;
-
-@pager-active-bg:                      @pagination-active-bg;
-@pager-active-color:                   @pagination-active-color;
-
-@pager-disabled-color:                 @pagination-disabled-color;
-
-
-//== Jumbotron
-//
-//##
-
-@jumbotron-padding:              30px;
-@jumbotron-color:                inherit;
-@jumbotron-bg:                   @gray-lighter;
-@jumbotron-heading-color:        inherit;
-@jumbotron-font-size:            ceil((@font-size-base * 1.5));
-
-
-//== Form states and alerts
-//
-//## Define colors for form feedback states and, by default, alerts.
-
-@state-success-text:             #3c763d;
-@state-success-bg:               #dff0d8;
-@state-success-border:           darken(spin(@state-success-bg, -10), 5%);
-
-@state-info-text:                #31708f;
-@state-info-bg:                  #d9edf7;
-@state-info-border:              darken(spin(@state-info-bg, -10), 7%);
-
-@state-warning-text:             #8a6d3b;
-@state-warning-bg:               #fcf8e3;
-@state-warning-border:           darken(spin(@state-warning-bg, -10), 5%);
-
-@state-danger-text:              #a94442;
-@state-danger-bg:                #f2dede;
-@state-danger-border:            darken(spin(@state-danger-bg, -10), 5%);
-
-
-//== Tooltips
-//
-//##
-
-//** Tooltip max width
-@tooltip-max-width:           200px;
-//** Tooltip text color
-@tooltip-color:               #fff;
-//** Tooltip background color
-@tooltip-bg:                  #000;
-@tooltip-opacity:             .9;
-
-//** Tooltip arrow width
-@tooltip-arrow-width:         5px;
-//** Tooltip arrow color
-@tooltip-arrow-color:         @tooltip-bg;
-
-
-//== Popovers
-//
-//##
-
-//** Popover body background color
-@popover-bg:                          #fff;
-//** Popover maximum width
-@popover-max-width:                   276px;
-//** Popover border color
-@popover-border-color:                rgba(0,0,0,.2);
-//** Popover fallback border color
-@popover-fallback-border-color:       #ccc;
-
-//** Popover title background color
-@popover-title-bg:                    darken(@popover-bg, 3%);
-
-//** Popover arrow width
-@popover-arrow-width:                 10px;
-//** Popover arrow color
-@popover-arrow-color:                 @popover-bg;
-
-//** Popover outer arrow width
-@popover-arrow-outer-width:           (@popover-arrow-width + 1);
-//** Popover outer arrow color
-@popover-arrow-outer-color:           fadein(@popover-border-color, 5%);
-//** Popover outer arrow fallback color
-@popover-arrow-outer-fallback-color:  darken(@popover-fallback-border-color, 20%);
-
-
-//== Labels
-//
-//##
-
-//** Default label background color
-@label-default-bg:            @gray-light;
-//** Primary label background color
-@label-primary-bg:            @brand-primary;
-//** Success label background color
-@label-success-bg:            @brand-success;
-//** Info label background color
-@label-info-bg:               @brand-info;
-//** Warning label background color
-@label-warning-bg:            @brand-warning;
-//** Danger label background color
-@label-danger-bg:             @brand-danger;
-
-//** Default label text color
-@label-color:                 #fff;
-//** Default text color of a linked label
-@label-link-hover-color:      #fff;
-
-
-//== Modals
-//
-//##
-
-//** Padding applied to the modal body
-@modal-inner-padding:         15px;
-
-//** Padding applied to the modal title
-@modal-title-padding:         15px;
-//** Modal title line-height
-@modal-title-line-height:     @line-height-base;
-
-//** Background color of modal content area
-@modal-content-bg:                             #fff;
-//** Modal content border color
-@modal-content-border-color:                   rgba(0,0,0,.2);
-//** Modal content border color **for IE8**
-@modal-content-fallback-border-color:          #999;
-
-//** Modal backdrop background color
-@modal-backdrop-bg:           #000;
-//** Modal backdrop opacity
-@modal-backdrop-opacity:      .5;
-//** Modal header border color
-@modal-header-border-color:   #e5e5e5;
-//** Modal footer border color
-@modal-footer-border-color:   @modal-header-border-color;
-
-@modal-lg:                    900px;
-@modal-md:                    600px;
-@modal-sm:                    300px;
-
-
-//== Alerts
-//
-//## Define alert colors, border radius, and padding.
-
-@alert-padding:               15px;
-@alert-border-radius:         @border-radius-base;
-@alert-link-font-weight:      bold;
-
-@alert-success-bg:            @state-success-bg;
-@alert-success-text:          @state-success-text;
-@alert-success-border:        @state-success-border;
-
-@alert-info-bg:               @state-info-bg;
-@alert-info-text:             @state-info-text;
-@alert-info-border:           @state-info-border;
-
-@alert-warning-bg:            @state-warning-bg;
-@alert-warning-text:          @state-warning-text;
-@alert-warning-border:        @state-warning-border;
-
-@alert-danger-bg:             @state-danger-bg;
-@alert-danger-text:           @state-danger-text;
-@alert-danger-border:         @state-danger-border;
-
-
-//== Progress bars
-//
-//##
-
-//** Background color of the whole progress component
-@progress-bg:                 #f5f5f5;
-//** Progress bar text color
-@progress-bar-color:          #fff;
-//** Variable for setting rounded corners on progress bar.
-@progress-border-radius:      @border-radius-base;
-
-//** Default progress bar color
-@progress-bar-bg:             @brand-primary;
-//** Success progress bar color
-@progress-bar-success-bg:     @brand-success;
-//** Warning progress bar color
-@progress-bar-warning-bg:     @brand-warning;
-//** Danger progress bar color
-@progress-bar-danger-bg:      @brand-danger;
-//** Info progress bar color
-@progress-bar-info-bg:        @brand-info;
-
-
-//== List group
-//
-//##
-
-//** Background color on `.list-group-item`
-@list-group-bg:                 #fff;
-//** `.list-group-item` border color
-@list-group-border:             #ddd;
-//** List group border radius
-@list-group-border-radius:      @border-radius-base;
-
-//** Background color of single list items on hover
-@list-group-hover-bg:           #f5f5f5;
-//** Text color of active list items
-@list-group-active-color:       @component-active-color;
-//** Background color of active list items
-@list-group-active-bg:          @component-active-bg;
-//** Border color of active list elements
-@list-group-active-border:      @list-group-active-bg;
-//** Text color for content within active list items
-@list-group-active-text-color:  lighten(@list-group-active-bg, 40%);
-
-//** Text color of disabled list items
-@list-group-disabled-color:      @gray-light;
-//** Background color of disabled list items
-@list-group-disabled-bg:         @gray-lighter;
-//** Text color for content within disabled list items
-@list-group-disabled-text-color: @list-group-disabled-color;
-
-@list-group-link-color:         #555;
-@list-group-link-hover-color:   @list-group-link-color;
-@list-group-link-heading-color: #333;
-
-
-//== Panels
-//
-//##
-
-@panel-bg:                    #fff;
-@panel-body-padding:          15px;
-@panel-heading-padding:       10px 15px;
-@panel-footer-padding:        @panel-heading-padding;
-@panel-border-radius:         @border-radius-base;
-
-//** Border color for elements within panels
-@panel-inner-border:          #ddd;
-@panel-footer-bg:             #f5f5f5;
-
-@panel-default-text:          @gray-dark;
-@panel-default-border:        #ddd;
-@panel-default-heading-bg:    #f5f5f5;
-
-@panel-primary-text:          #fff;
-@panel-primary-border:        @brand-primary;
-@panel-primary-heading-bg:    @brand-primary;
-
-@panel-success-text:          @state-success-text;
-@panel-success-border:        @state-success-border;
-@panel-success-heading-bg:    @state-success-bg;
-
-@panel-info-text:             @state-info-text;
-@panel-info-border:           @state-info-border;
-@panel-info-heading-bg:       @state-info-bg;
-
-@panel-warning-text:          @state-warning-text;
-@panel-warning-border:        @state-warning-border;
-@panel-warning-heading-bg:    @state-warning-bg;
-
-@panel-danger-text:           @state-danger-text;
-@panel-danger-border:         @state-danger-border;
-@panel-danger-heading-bg:     @state-danger-bg;
-
-
-//== Thumbnails
-//
-//##
-
-//** Padding around the thumbnail image
-@thumbnail-padding:           4px;
-//** Thumbnail background color
-@thumbnail-bg:                @body-bg;
-//** Thumbnail border color
-@thumbnail-border:            #ddd;
-//** Thumbnail border radius
-@thumbnail-border-radius:     @border-radius-base;
-
-//** Custom text color for thumbnail captions
-@thumbnail-caption-color:     @text-color;
-//** Padding around the thumbnail caption
-@thumbnail-caption-padding:   9px;
-
-
-//== Wells
-//
-//##
-
-@well-bg:                     #f5f5f5;
-@well-border:                 darken(@well-bg, 7%);
-
-
-//== Badges
-//
-//##
-
-@badge-color:                 #fff;
-//** Linked badge text color on hover
-@badge-link-hover-color:      #fff;
-@badge-bg:                    @gray-light;
-
-//** Badge text color in active nav link
-@badge-active-color:          @link-color;
-//** Badge background color in active nav link
-@badge-active-bg:             #fff;
-
-@badge-font-weight:           bold;
-@badge-line-height:           1;
-@badge-border-radius:         10px;
-
-
-//== Breadcrumbs
-//
-//##
-
-@breadcrumb-padding-vertical:   8px;
-@breadcrumb-padding-horizontal: 15px;
-//** Breadcrumb background color
-@breadcrumb-bg:                 #f5f5f5;
-//** Breadcrumb text color
-@breadcrumb-color:              #ccc;
-//** Text color of current page in the breadcrumb
-@breadcrumb-active-color:       @gray-light;
-//** Textual separator for between breadcrumb elements
-@breadcrumb-separator:          "/";
-
-
-//== Carousel
-//
-//##
-
-@carousel-text-shadow:                        0 1px 2px rgba(0,0,0,.6);
-
-@carousel-control-color:                      #fff;
-@carousel-control-width:                      15%;
-@carousel-control-opacity:                    .5;
-@carousel-control-font-size:                  20px;
-
-@carousel-indicator-active-bg:                #fff;
-@carousel-indicator-border-color:             #fff;
-
-@carousel-caption-color:                      #fff;
-
-
-//== Close
-//
-//##
-
-@close-font-weight:           bold;
-@close-color:                 #000;
-@close-text-shadow:           0 1px 0 #fff;
-
-
-//== Code
-//
-//##
-
-@code-color:                  #c7254e;
-@code-bg:                     #f9f2f4;
-
-@kbd-color:                   #fff;
-@kbd-bg:                      #333;
-
-@pre-bg:                      #f5f5f5;
-@pre-color:                   @gray-dark;
-@pre-border-color:            #ccc;
-@pre-scrollable-max-height:   340px;
-
-
-//== Type
-//
-//##
-
-//** Horizontal offset for forms and lists.
-@component-offset-horizontal: 180px;
-//** Text muted color
-@text-muted:                  @gray-light;
-//** Abbreviations and acronyms border color
-@abbr-border-color:           @gray-light;
-//** Headings small color
-@headings-small-color:        @gray-light;
-//** Blockquote small color
-@blockquote-small-color:      @gray-light;
-//** Blockquote font size
-@blockquote-font-size:        (@font-size-base * 1.25);
-//** Blockquote border color
-@blockquote-border-color:     @gray-lighter;
-//** Page header border color
-@page-header-border-color:    @gray-lighter;
-//** Width of horizontal description list titles
-@dl-horizontal-offset:        @component-offset-horizontal;
-//** Horizontal line color.
-@hr-border:                   #b2b2b2;
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/buttons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/buttons.less
deleted file mode 100644
index bbb3c620..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/buttons.less
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Buttons
-// --------------------------------------------------
-
-
-// Base styles
-// --------------------------------------------------
-
-// Core styles
-.btn {
-  display: inline-block;
-  padding: 5px 6px 4px 8px;
-  margin-top: 0;
-  margin-bottom: 0; // For input.btn
-  font-family: "Open Sans Condensed", sans-serif;
-  font-size: @font-size-base * 1.3;
-  font-weight: 700;
-  text-transform: uppercase;
-  letter-spacing: 1px;
-  line-height: @line-height-computed;
-  text-align: center;
-  vertical-align: middle;
-  touch-action: manipulation;
-  cursor: pointer;
-  background-color: @gray-lighter;
-  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
-  border: none;
-  border-radius: 3px;
-  .box-shadow(1px 1px 0 rgba(0, 0, 0, 0.3));
-  outline: none !important;
-  white-space: nowrap;
-  .user-select(none);
-
-  &:focus,
-  &.focus {
-    .tab-focus();
-  }
-
-  &:hover,
-  &:focus,
-  &.focus {
-    background-color: lighten(@gray-lighter, 5%);
-    text-decoration: none;
-    .transition(background-color .1s linear);
-  }
-
-  &:active,
-  &.active {
-    outline: 0;
-    padding: 6px 5px 3px 9px;
-  }
-
-  &.disabled,
-  &[disabled],
-  fieldset[disabled] & {
-    cursor: @cursor-disabled;
-    pointer-events: none; // Future-proof disabling of clicks
-    .opacity(65);
-    .box-shadow(1px 1px 0 rgba(0, 0, 0, 0.15));
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/code.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/code.less
deleted file mode 100644
index 33af7555..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/code.less
+++ /dev/null
@@ -1,8 +0,0 @@
-code {
-  margin: 0 2px;
-  padding: 1px 5px;
-  border: 1px solid #E1E1E8;
-  background-color: #F7F7F9;
-  color: @gray-dark;
-  font-size: 85%;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/evaluation-form.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/evaluation-form.less
deleted file mode 100644
index 6d505d56..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/evaluation-form.less
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// Evaluation form
-// --------------------------------------------------
-
-
-.evaluation-form {
-  .clearfix();
-
-  textarea {
-    height: 200px;
-  }
-}
-
-.evaluation-input-output {
-  float: left;
-  width: 65%;
-}
-
-.evaluation-input-clear-button {
-  position: absolute;
-  top: 0;
-  right: 0;
-  width: 15px;
-  height: 15px;
-  margin: 6px;
-  display: inline-block;
-  background: transparent url("../images/clear-text.png") no-repeat scroll 0 0;
-  opacity: 0.75;
-  line-height: 0;
-  vertical-align: bottom;
-  cursor: pointer;
-
-  &:hover {
-   opacity: 1;
- }
-}
-
-.evaluation-input-clear-button.with-scrollbar {
-  margin-right: 29px;
-}
-
-.evaluation-output {
-  margin-top: 1.5em;
-}
-
-.evaluation-input-field,
-.evaluation-output-field {
-  margin-bottom: 0.5em;
-  .box-sizing(border-box);
-  overflow-x: hidden;
-  line-height: @line-height-computed;
-}
-
-.evaluation-output-field {
-  &[readonly] {
-    cursor: auto;
-    background-color: @input-bg;
-  }
-}
-
-.evaluation-error-header {
-  margin-bottom: @line-height-computed;
-  padding-left: 52px;
-  background: transparent url("../images/icons/48x48/error.png") no-repeat scroll 0 50%;
-  color: @black;
-  font-family: @font-family-sans-serif;
-  font-weight: bold;
-  line-height: 48px;
-  vertical-align: middle;
-}
-
-ul.evaluation-error-list,
-ul.evaluation-warning-list {
-  li {
-    margin-bottom: 1em;
-
-    pre {
-      margin-top: 0.5em;
-      white-space: pre;
-      overflow: auto;
-    }
-  }
-}
-
-ul.evaluation-error-list li pre {
-  background-color: @state-danger-bg;
-}
-
-ul.evaluation-warning-list li pre {
-  background-color: @state-warning-bg;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/forms.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/forms.less
deleted file mode 100644
index 2ceb0559..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/forms.less
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// Forms
-// --------------------------------------------------
-
-// GENERAL STYLES
-// --------------
-
-label {
-  font-weight: normal;
-}
-
-
-// Form controls
-// -------------------------
-
-// Common form controls
-.form-control {
-  line-height: @input-height-base;
-}
-
-.textarea-wrapper {
-  position: relative;
-}
-
-// Form groups
-.form-group {
-  margin-bottom: 0.5em;
-}
-
-// Info and errors
-// --------------------------
-.message-info {
-  border: 1px solid;
-  clear: both;
-  padding: 10px 20px;
-  color: @state-info-text;
-}
-
-.message-error {
-  clear: both;
-  color: @state-danger-text;
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 20px 0 10px 0;
-}
-
-.message-success {
-  color: @state-success-text;
-  font-size: 1.3em;
-  font-weight: bold;
-  margin: 20px 0 10px 0;
-}
-
-.error {
-  color: @state-danger-text;
-}
-
-// Styles for validation helpers
-// --------------------------
-.validators {
-  font-style: normal;
-  padding-bottom: 0.5em;
-}
-
-.field-validation-error {
-  display: block;
-  padding-bottom: 0.5em;
-  color: @state-danger-text;
-  font-weight: bold;
-}
-
-.field-validation-valid {
-  display: none;
-}
-
-input.input-validation-error,
-textarea.input-validation-error,
-select.input-validation-error
-{
-  border: 1px solid @state-danger-border;
-  background-color: @state-danger-bg;
-  .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
-
-  &:focus {
-    border-color: @state-danger-border;
-    @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@state-danger-text, 20%);
-    .box-shadow(@shadow);
-  }
-}
-
-.validation-summary-errors {
-  color: @state-danger-text;
-  font-weight: bold;
-  font-size: 1.1em;
-}
-
-.validation-summary-valid {
-  display: none;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/icons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/icons.less
deleted file mode 100644
index 79b9d9e5..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/icons.less
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Icons
-// --------------------------------------------------
-
-
-.icon {
-  background: transparent url(../images/icons/32x32/social-media-icons-32.png) no-repeat scroll;
-  display: inline-block;
-  line-height: 0;
-  vertical-align: bottom;
-}
-
-.icon-32 {
-  height: 32px;
-  width: 32px;
-}
-
-.icon-facebook {
-  background-position: 0 0;
-}
-
-.icon-twitter {
-  background-position: 0 -32px;
-}
-
-.icon-linkedin {
-  background-position: 0 -64px;
-}
-
-.icon-rss {
-  background-position: 0 -128px;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/layout.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/layout.less
deleted file mode 100644
index 35a7f386..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/layout.less
+++ /dev/null
@@ -1,128 +0,0 @@
-html,
-body {
-  margin: 0;
-  height: 100%;
-  /* The html and body elements cannot have any padding or margin */
-}
-
-/* Wrapper for page content to push down footer */
-.l-wrapper {
-  min-height: 100%;
-  height: auto !important;
-  height: 100%;
-  /* Negative indent footer by it's height */
-  margin: 0 auto (-1 * @footer-height);
-}
-
-.l-constrained {
-  margin: 0 auto;
-  padding-left: 20px;
-  padding-right: 20px;
-  max-width: 1200px;
-  min-width: 800px;
-}
-
-.l-header {
-  border-top: solid 10px @black;
-  border-bottom: 1px solid #d4b33a;
-  background-color: #f0db4f;
-
-  .l-constrained {
-    padding-top: 20px;
-    padding-bottom: 20px;
-    .clearfix();
-  }
-}
-
-.l-content {
-  .clearfix();
-}
-
-.l-main-content {
-  float: left;
-  width: 70%;
-}
-
-.l-sidebar {
-  float: right;
-  width: 30%;
-}
-
-/* Set the fixed height of the footer here */
-.l-push,
-.l-footer {
-  height: @footer-height;
-}
-
-.l-footer {
-  width: 100%;
-  background-color: @black;
-  color: @gray-lighter;
-  font-size: @font-size-small;
-  line-height: 100%;
-
-  .l-constrained {
-    padding-top: (@footer-height - 32) / 2;
-    .clearfix();
-  }
-
-  a {
-    color: @gray-lighter;
-    text-decoration: none;
-
-    &:hover,
-    &:active {
-      text-decoration: underline;
-    }
-  }
-}
-
-
-// Header
-// -------------------------
-
-.logo {
-  margin: 0;
-
-  a {
-    display: block;
-    float: left;
-    width: 100px;
-    height: 100px;
-    background: transparent url("../images/jsengineswitcher-logo.png") no-repeat scroll 0 0;
-    text-indent: -9999em;
-  }
-}
-
-.primary-nav {
-  position: relative;
-  left: 40px;
-  float: left;
-}
-
-
-// Footer
-// -------------------------
-
-.l-copyright {
-  float: left;
-    p {
-      margin: 0;
-      padding: 0;
-  }
-}
-
-.l-social {
-  float: right;
-
-  li {
-    display: inline;
-    list-style: none outside none;
-    padding-left: 10px;
-
-    a {
-      text-indent: -9999px;
-      outline: none;
-    }
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/mixins.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/mixins.less
deleted file mode 100644
index d26eee79..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/mixins.less
+++ /dev/null
@@ -1,9 +0,0 @@
-//
-// Mixins
-// --------------------------------------------------
-
-// NO Drop shadows
-.no-box-shadow {
-  -webkit-box-shadow: none; // iOS <4.3 & Android <4.1
-          box-shadow: none;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/navbar.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/navbar.less
deleted file mode 100644
index 95edf3c2..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/navbar.less
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Navbars
-// --------------------------------------------------
-
-
-// Wrapper and base class
-//
-// Provide a static navbar from which we expand to create full-width, fixed, and
-// other navbar variations.
-
-.navbar {
-  border: none;
-  border-radius: 0;
-}
-
-// Navbar nav links
-//
-// Builds on top of the `.nav` components with it's own modifier class to make
-// the nav the full height of the horizontal nav (above 768px).
-
-.navbar-nav {
-  float: left;
-  margin: 0 auto;
-
-  > li {
-    > a {
-      float: none;
-      // Vertically center the text given @navbar-height
-      padding: ((@navbar-height - @line-height-computed) / 2) 15px ((@navbar-height - @line-height-computed) / 2);
-      border: 1px solid transparent;
-      font-family: "Open Sans", sans-serif;
-      font-size: 2.0em;
-      text-decoration: none;
-      text-transform: uppercase;
-      outline: none;
-    }
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/page-socials.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/page-socials.less
deleted file mode 100644
index ea12dc09..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/page-socials.less
+++ /dev/null
@@ -1,14 +0,0 @@
-.page-socials {
-  min-height: 60px;
-  margin-top: 20px;
-  padding-top: 15px;
-  border-top: 1px solid #b2b2b2;
-}
-
-.share-buttons {
-  li {
-    margin-right: 15px;
-    vertical-align: top;
-    line-height: normal;
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/type.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/type.less
deleted file mode 100644
index 02d69502..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/type.less
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Typography
-// --------------------------------------------------
-
-// Headings
-// -------------------------
-
-h1, h2, h3 {
-  margin-top: 10px;
-}
-
-h1, h2 {
-  line-height: 40px;
-}
-
-h2 {
-  color: @black;
-  font-weight: bold;
-}
-
-h3 {
-  color: @gray-dark;
-  line-height: @line-height-computed * 1.25;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/variables.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/variables.less
deleted file mode 100644
index 498c9796..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore21.Mvc21/wwwroot/styles/variables.less
+++ /dev/null
@@ -1,7 +0,0 @@
-// Colors
-// -------------------------
-@black:                 #1d0d0d;
-
-// Footer
-// -------------------------
-@footer-height:                    55px;
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/.bowerrc b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/.bowerrc
deleted file mode 100644
index ea81a597..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/.bowerrc
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "registry": "https://registry.bower.io",
-  "directory": "wwwroot/lib"
-}
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Infrastructure/Helpers/CommonExtensions.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Infrastructure/Helpers/CommonExtensions.cs
deleted file mode 100644
index 90d88510..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Infrastructure/Helpers/CommonExtensions.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Text.RegularExpressions;
-
-using Microsoft.AspNetCore.Html;
-using Microsoft.AspNetCore.Mvc.Rendering;
-
-namespace JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31.Infrastructure.Helpers
-{
-	public static class CommonExtensions
-	{
-		public static HtmlString EncodedReplace(this IHtmlHelper htmlHelper, string input,
-			string pattern, string replacement)
-		{
-			return new HtmlString(Regex.Replace(htmlHelper.Encode(input), pattern, replacement));
-		}
-	}
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs
deleted file mode 100644
index d952325d..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using System;
-
-using Microsoft.AspNetCore.Razor.TagHelpers;
-
-namespace JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31.Infrastructure.TagHelpers
-{
-	[HtmlTargetElement("conditional-comment")]
-	public class ConditionalCommentTagHelper : TagHelper
-	{
-		[HtmlAttributeName("type")]
-		public ConditionalCommentType CommentType { get; set; }
-
-		[HtmlAttributeName("expression")]
-		public string Expression { get; set; }
-
-
-		public override void Process(TagHelperContext context, TagHelperOutput output)
-		{
-			output.TagName = null;
-
-			ConditionalCommentType type = CommentType;
-
-			string ifCommentStartPart;
-			string ifCommentEndPart;
-
-			switch (type)
-			{
-				case ConditionalCommentType.Hidden:
-					ifCommentStartPart = "";
-
-					break;
-				case ConditionalCommentType.RevealedValidatingSimplified:
-					ifCommentStartPart = "";
-
-					break;
-				case ConditionalCommentType.Revealed:
-					ifCommentStartPart = "";
-
-					break;
-				default:
-					throw new NotSupportedException();
-			}
-
-			TagHelperContent preContent = output.PreContent;
-			preContent.AppendHtml(ifCommentStartPart);
-			preContent.AppendHtml(Expression);
-			preContent.AppendHtml(ifCommentEndPart);
-
-			string endIfComment;
-
-			switch (type)
-			{
-				case ConditionalCommentType.Hidden:
-					endIfComment = "";
-					break;
-				case ConditionalCommentType.RevealedValidating:
-				case ConditionalCommentType.RevealedValidatingSimplified:
-					endIfComment = "";
-					break;
-				case ConditionalCommentType.Revealed:
-					endIfComment = "";
-					break;
-				default:
-					throw new NotSupportedException();
-			}
-
-			output.PostContent.AppendHtml(endIfComment);
-		}
-	}
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Infrastructure/TagHelpers/ConditionalCommentType.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Infrastructure/TagHelpers/ConditionalCommentType.cs
deleted file mode 100644
index f00b4d2a..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Infrastructure/TagHelpers/ConditionalCommentType.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31.Infrastructure.TagHelpers
-{
-	public enum ConditionalCommentType
-	{
-		Hidden,
-		Revealed,
-		RevealedValidating,
-		RevealedValidatingSimplified
-	}
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31.csproj
index 3c114c5e..807b01b2 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31.csproj
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31.csproj
@@ -2,31 +2,34 @@
 
   
     JS Engine Switcher: Sample ASP.NET Core 3.1 MVC 3.1 Site
-    3.19.0
+    3.30.2
     netcoreapp3.1
     Exe
     true
+    true
     true
+    true
     false
+    false
   
 
   
 
   
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
 
     
     
@@ -35,26 +38,13 @@
     
     
     
+    
     
     
     
+    
   
 
-  
-    
-  
-  
-    
-  
-  
-    
-  
-  
-    
-  
-  
-    
-    
-    
-  
+  
+
 
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Program.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Program.cs
index 88eae706..889d2a4b 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Program.cs
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Program.cs
@@ -1,4 +1,6 @@
-using Microsoft.AspNetCore.Hosting;
+using System.IO;
+
+using Microsoft.AspNetCore.Hosting;
 using Microsoft.Extensions.Hosting;
 using Microsoft.Extensions.Logging;
 
@@ -15,6 +17,10 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
 			Host.CreateDefaultBuilder(args)
 				.ConfigureWebHostDefaults(webBuilder =>
 				{
+					webBuilder.UseWebRoot(Path.Combine(
+						Directory.GetCurrentDirectory(),
+						"../JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot"
+					));
 					webBuilder.UseStartup();
 				})
 				.ConfigureLogging((hostingContext, logging) =>
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Properties/launchSettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Properties/launchSettings.json
index b6cb115c..1b7533c8 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Properties/launchSettings.json
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Properties/launchSettings.json
@@ -3,25 +3,26 @@
     "windowsAuthentication": false,
     "anonymousAuthentication": true,
     "iisExpress": {
-      "applicationUrl": "http://localhost:43491",
+      "applicationUrl": "http://localhost:55126",
       "sslPort": 0
     }
   },
   "profiles": {
-    "IIS Express": {
-      "commandName": "IISExpress",
+    "JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31": {
+      "commandName": "Project",
+      "dotnetRunMessages": "true",
       "launchBrowser": true,
+      "applicationUrl": "http://localhost:5138",
       "environmentVariables": {
         "ASPNETCORE_ENVIRONMENT": "Development"
       }
     },
-    "JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31": {
-      "commandName": "Project",
+    "IIS Express": {
+      "commandName": "IISExpress",
       "launchBrowser": true,
       "environmentVariables": {
         "ASPNETCORE_ENVIRONMENT": "Development"
-      },
-      "applicationUrl": "http://localhost:1973/"
+      }
     }
   }
 }
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Startup.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Startup.cs
index ace4bece..b90eb827 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Startup.cs
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Startup.cs
@@ -16,6 +16,7 @@
 using JavaScriptEngineSwitcher.Sample.Logic.Services;
 using JavaScriptEngineSwitcher.V8;
 using JavaScriptEngineSwitcher.Vroom;
+using JavaScriptEngineSwitcher.Yantra;
 
 namespace JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31
 {
@@ -60,8 +61,10 @@ public void ConfigureServices(IServiceCollection services)
 
 			// Add JavaScriptEngineSwitcher services to the services container.
 			services.AddJsEngineSwitcher(options =>
-				options.DefaultEngineName = ChakraCoreJsEngine.EngineName
-			)
+			{
+				options.AllowCurrentProperty = false;
+				options.DefaultEngineName = ChakraCoreJsEngine.EngineName;
+			})
 				.AddChakraCore()
 				.AddJint()
 				.AddJurassic()
@@ -73,6 +76,7 @@ public void ConfigureServices(IServiceCollection services)
 				.AddNode(services)
 				.AddV8()
 				.AddVroom()
+				.AddYantra()
 				;
 
 			services.Configure(options =>
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/Home/Contact.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/Home/Contact.cshtml
index cd9663df..58785ebe 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/Home/Contact.cshtml
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/Home/Contact.cshtml
@@ -5,19 +5,4 @@
 

@ViewBag.Title

@ViewBag.Body -
- -@section Scripts { - -} \ No newline at end of file + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/Shared/_JsEvaluationErrorList.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/Shared/_JsEvaluationErrorList.cshtml index 6d8aae59..9e0601d6 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/Shared/_JsEvaluationErrorList.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/Shared/_JsEvaluationErrorList.cshtml @@ -1,4 +1,4 @@ -@using JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31.Infrastructure.Helpers +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.Helpers @using JavaScriptEngineSwitcher.Sample.Logic.Models @model IList diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/Shared/_Layout.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/Shared/_Layout.cshtml index 1da2faf8..e9ffc46f 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/Shared/_Layout.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/Shared/_Layout.cshtml @@ -1,4 +1,4 @@ -@using JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31.Infrastructure.TagHelpers +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.TagHelpers @@ -61,9 +61,10 @@ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/_ViewImports.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/_ViewImports.cshtml index 5430be13..8fe8384e 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/_ViewImports.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/Views/_ViewImports.cshtml @@ -1,2 +1,2 @@ @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" -@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31" \ No newline at end of file +@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure" \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/bower.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/bower.json deleted file mode 100644 index d2010af1..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/bower.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "jsengineswitcher.sample.aspnetcore31.mvc31", - "dependencies": { - "modernizr": "2.8.3", - "jquery-compat": "jquery#1.10.2", - "jquery": "jquery#2.0.3", - "jquery-validation": "1.13.1", - "jquery-validation-unobtrusive": "3.2.3", - "bootstrap": "3.3.0" - } -} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/gulpfile.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/gulpfile.js deleted file mode 100644 index 0f259437..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/gulpfile.js +++ /dev/null @@ -1,130 +0,0 @@ -/*global require, exports */ -/*jshint esversion: 6 */ -const WEB_ROOT_PATH = "wwwroot"; -const BOWER_DIR_PATH = WEB_ROOT_PATH + "/lib"; -const STYLE_DIR_PATH = WEB_ROOT_PATH + '/styles'; -const SCRIPT_DIR_PATH = WEB_ROOT_PATH + '/scripts'; - -// include plug-ins -let { src, dest, series, parallel, watch } = require('gulp'); -let del = require('del'); -let sourcemaps = require('gulp-sourcemaps'); -let rename = require('gulp-rename'); -let concat = require('gulp-concat'); -let less = require('gulp-less'); -let autoprefixer = require('gulp-autoprefixer'); -let cleanCss = require('gulp-clean-css'); -let uglify = require('gulp-uglify'); - -//#region Clean -//#region Clean builded assets -function cleanBuildedStyles() { - return del([STYLE_DIR_PATH + '/build/*']); -} - -function cleanBuildedScripts() { - return del([SCRIPT_DIR_PATH + '/build/*']); -} - -let cleanBuildedAssets = parallel(cleanBuildedStyles, cleanBuildedScripts); -//#endregion -//#endregion - -//#region Build assets -//#region Build styles -let autoprefixerOptions = { - overrideBrowserslist: ['> 1%', 'last 3 versions', 'Firefox ESR', 'Opera 12.1'], - cascade: true -}; -let cssCleanOptions = { specialComments: '*' }; -let cssRenameOptions = { extname: '.min.css' }; - -function buildCommonStyles() { - return src([STYLE_DIR_PATH + '/app.less']) - .pipe(sourcemaps.init()) - .pipe(less({ - relativeUrls: true, - rootpath: '/styles/' - })) - .pipe(autoprefixer(autoprefixerOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(STYLE_DIR_PATH + '/build')) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(concat('common-styles.css')) - .pipe(cleanCss(cssCleanOptions)) - .pipe(rename(cssRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(STYLE_DIR_PATH + '/build')) - ; -} - -let buildStyles = buildCommonStyles; -//#endregion - -//#region Build scripts -let jsConcatOptions = { newLine: ';' }; -let jsUglifyOptions = { - output: { comments: /^!/ } -}; -let jsRenameOptions = { extname: '.min.js' }; - -function buildModernizrScripts() { - return src([BOWER_DIR_PATH + '/modernizr/modernizr.js']) - .pipe(sourcemaps.init()) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -function buildCommonScripts() { - return src([SCRIPT_DIR_PATH + '/common.js']) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(rename({ basename: 'common-scripts' })) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -function buildEvaluationFormScripts() { - return src([BOWER_DIR_PATH + '/jquery-validation/dist/jquery.validate.js', - BOWER_DIR_PATH + '/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js', - BOWER_DIR_PATH + '/bootstrap/js/button.js', - SCRIPT_DIR_PATH + '/evaluation-form.js']) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(concat('evaluation-form-scripts.js', jsConcatOptions)) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -let buildScripts = parallel(buildModernizrScripts, buildCommonScripts, buildEvaluationFormScripts); -//#endregion - -let buildAssets = parallel(buildStyles, buildScripts); -//#endregion - -//#region Watch assets -function watchStyles() { - return watch([STYLE_DIR_PATH + '/**/*.{less,css}', '!' + STYLE_DIR_PATH + '/build/**/*.*'], - buildStyles); -} - -function watchScripts() { - return watch([SCRIPT_DIR_PATH + '/**/*.js', '!' + SCRIPT_DIR_PATH + '/build/**/*.*'], - buildScripts); -} - -let watchAssets = parallel(watchStyles, watchScripts); -//#endregion - -// Export tasks -exports.cleanBuildedAssets = cleanBuildedAssets; -exports.buildAssets = buildAssets; -exports.watchAssets = watchAssets; -exports.default = series(cleanBuildedAssets, buildAssets); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/package.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/package.json deleted file mode 100644 index ae5ab4ab..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "jsengineswitcher.sample.aspnetcore31.mvc31", - "private": true, - "version": "3.19.0", - "devDependencies": { - "gulp": "4.0.2", - "del": "5.1.0", - "gulp-sourcemaps": "2.6.5", - "gulp-rename": "2.0.0", - "gulp-concat": "2.6.1", - "gulp-less": "4.0.1", - "gulp-autoprefixer": "7.0.1", - "gulp-clean-css": "4.2.0", - "gulp-uglify": "3.0.2" - } -} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/0.gif b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/0.gif deleted file mode 100644 index 35d42e80..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/0.gif and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/clear-text.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/clear-text.png deleted file mode 100644 index 9d217b7f..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/clear-text.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/icons/32x32/social-media-icons-32.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/icons/32x32/social-media-icons-32.png deleted file mode 100644 index 49aa1fe3..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/icons/32x32/social-media-icons-32.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/icons/48x48/error.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/icons/48x48/error.png deleted file mode 100644 index 3d6185f7..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/icons/48x48/error.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/jsengineswitcher-logo.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/jsengineswitcher-logo.png deleted file mode 100644 index 12ed97e0..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/images/jsengineswitcher-logo.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/scripts/_references.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/scripts/_references.js deleted file mode 100644 index 2b54eea8..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/scripts/_references.js and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/scripts/common.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/scripts/common.js deleted file mode 100644 index c94bf102..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/scripts/common.js +++ /dev/null @@ -1,29 +0,0 @@ -var jsEngineSwitcher; - -(function (jsEngineSwitcher, undefined) { - "use strict"; - - jsEngineSwitcher.registerNamespace = function (namespaceString) { - var parts = namespaceString.split("."), - parent = jsEngineSwitcher, - i - ; - - if (parts[0] === "jsEngineSwitcher") { - parts = parts.slice(1); - } - - for (i = 0; i < parts.length; i += 1) { - if (typeof parent[parts[i]] === "undefined") { - parent[parts[i]] = {}; - } - parent = parent[parts[i]]; - } - - return parent; - }; - - jsEngineSwitcher.hasScrollbar = function(elem) { - return (elem.clientHeight < elem.scrollHeight); - }; -}(jsEngineSwitcher = jsEngineSwitcher || {})); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/scripts/evaluation-form.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/scripts/evaluation-form.js deleted file mode 100644 index da1f0199..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/scripts/evaluation-form.js +++ /dev/null @@ -1,83 +0,0 @@ -(function (jsEngineSwitcher, $, undefined) { - "use strict"; - - var $evaluationForm, - $evaluationInputField, - $evaluationInputClearButton, - $evaluateButton - ; - - $(function () { - $evaluationForm = $("form[data-form-type='evaluation-form']"); - $evaluationInputField = $(":input[data-control-type='evaluation-input-field']", $evaluationForm); - $evaluationInputClearButton = $("
"); - $evaluateButton = $(":input[data-control-type='evaluate-button']", $evaluationForm); - - $evaluationForm.on("submit", onEvaluationFormSubmitHandler); - - $evaluationInputClearButton.on("click", onEvaluationInputClearButtonClickHandler); - $evaluationInputField.parent().append($evaluationInputClearButton); - refreshEvaluationInputClearButton(); - $evaluationInputField - .on("input propertychange keydown keyup paste", onEvaluationInputFieldChangeHandler) - ; - - $evaluateButton.removeAttr("disabled"); - }); - - $(window).unload(function() { - $evaluationForm.off("submit", onEvaluationFormSubmitHandler); - - $evaluationInputClearButton - .off("click", onEvaluationInputClearButtonClickHandler) - .remove() - ; - - $evaluationInputField - .off("input propertychange keydown keyup paste", onEvaluationInputFieldChangeHandler) - ; - - $evaluationForm = null; - $evaluationInputField = null; - $evaluationInputClearButton = null; - $evaluateButton = null; - }); - - var refreshEvaluationInputClearButton = function() { - if ($.trim($evaluationInputField.val()).length > 0) { - $evaluationInputClearButton.show(); - } else { - $evaluationInputClearButton.hide(); - } - - if (jsEngineSwitcher.hasScrollbar($evaluationInputField.get(0))) { - $evaluationInputClearButton.addClass("with-scrollbar"); - } - else { - $evaluationInputClearButton.removeClass("with-scrollbar"); - } - }; - - var onEvaluationFormSubmitHandler = function () { - var $form = $(this); - if ($form.valid()) { - $evaluateButton.attr("disabled", "disabled"); - $("textarea[data-control-type='evaluation-output-field']", $form).val(''); - - return true; - } - - return false; - }; - - var onEvaluationInputFieldChangeHandler = function () { - refreshEvaluationInputClearButton(); - }; - - var onEvaluationInputClearButtonClickHandler = function() { - $evaluationInputField.val(""); - - var $button = $(this); - $button.hide(); - }; -}(jsEngineSwitcher, jQuery)); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/app.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/app.less deleted file mode 100644 index c41a9315..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/app.less +++ /dev/null @@ -1,71 +0,0 @@ -/*! - * Bootstrap v3.3.0 (http://getbootstrap.com) - * Copyright 2011-2014 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ - -// Core variables and mixins -@import "bootstrap-custom-variables.less"; -@import "../lib/bootstrap/less/mixins.less"; - -// Reset -@import "../lib/bootstrap/less/normalize.less"; -//@import "../lib/bootstrap/less/print.less"; -//@import "../lib/bootstrap/less/glyphicons.less"; - -// Core CSS -@import "../lib/bootstrap/less/scaffolding.less"; -@import "../lib/bootstrap/less/type.less"; -@import "../lib/bootstrap/less/code.less"; -//@import "../lib/bootstrap/less/grid.less"; -//@import "../lib/bootstrap/less/tables.less"; -@import "../lib/bootstrap/less/forms.less"; -//@import "../lib/bootstrap/less/buttons.less"; - -// Components -//@import "../lib/bootstrap/less/component-animations.less"; -//@import "../lib/bootstrap/less/dropdowns.less"; -//@import "../lib/bootstrap/less/button-groups.less"; -//@import "../lib/bootstrap/less/input-groups.less"; -@import "../lib/bootstrap/less/navs.less"; -@import "../lib/bootstrap/less/navbar.less"; -//@import "../lib/bootstrap/less/breadcrumbs.less"; -//@import "../lib/bootstrap/less/pagination.less"; -//@import "../lib/bootstrap/less/pager.less"; -//@import "../lib/bootstrap/less/labels.less"; -//@import "../lib/bootstrap/less/badges.less"; -//@import "../lib/bootstrap/less/jumbotron.less"; -//@import "../lib/bootstrap/less/thumbnails.less"; -//@import "../lib/bootstrap/less/alerts.less"; -//@import "../lib/bootstrap/less/progress-bars.less"; -//@import "../lib/bootstrap/less/media.less"; -//@import "../lib/bootstrap/less/list-group.less"; -//@import "../lib/bootstrap/less/panels.less"; -//@import "../lib/bootstrap/less/responsive-embed.less"; -//@import "../lib/bootstrap/less/wells.less"; -//@import "../lib/bootstrap/less/close.less"; - -// Components w/ JavaScript -//@import "../lib/bootstrap/less/modals.less"; -//@import "../lib/bootstrap/less/tooltip.less"; -//@import "../lib/bootstrap/less/popovers.less"; -//@import "../lib/bootstrap/less/carousel.less"; - -// Utility classes -@import "../lib/bootstrap/less/utilities.less"; -//@import "../lib/bootstrap/less/responsive-utilities.less"; - -// JavaScriptEngineSwitcher specs -@import "variables.less"; -@import "mixins.less"; - -@import "type.less"; -@import "code.less"; -@import "forms.less"; -@import "buttons.less"; -@import "icons.less"; -@import "navbar.less"; - -@import "layout.less"; -@import "evaluation-form.less"; -@import "page-socials.less"; \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/bootstrap-custom-variables.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/bootstrap-custom-variables.less deleted file mode 100644 index 0be2aa6f..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/bootstrap-custom-variables.less +++ /dev/null @@ -1,856 +0,0 @@ -// -// Variables -// -------------------------------------------------- - - -//== Colors -// -//## Gray and brand colors for use across Bootstrap. - -@gray-base: #323330; -@gray-darker: lighten(@gray-base, 13.5%); // #222 -@gray-dark: lighten(@gray-base, 20%); // #333 -@gray: lighten(@gray-base, 33.5%); // #555 -@gray-light: lighten(@gray-base, 46.7%); // #777 -@gray-lighter: #e3e3e3; - -@brand-primary: #428bca; -@brand-success: #5cb85c; -@brand-info: #5bc0de; -@brand-warning: #f0ad4e; -@brand-danger: #d9534f; - - -//== Scaffolding -// -//## Settings for some of the most global styles. - -//** Background color for ``. -@body-bg: #fff; -//** Global text color on ``. -@text-color: #1d0d0d; - -//** Global textual link color. -@link-color: @brand-primary; -//** Link hover color set via `darken()` function. -@link-hover-color: darken(@link-color, 15%); -//** Link hover decoration. -@link-hover-decoration: underline; - - -//== Typography -// -//## Font, line-height, and color for body text, headings, and more. - -@font-family-sans-serif: "Helvetica Neue", Arial, sans-serif; -@font-family-serif: Georgia, "Times New Roman", Times, serif; -//** Default monospace fonts for ``, ``, and `
`.
-@font-family-monospace:   Consolas, "Courier New", monospace;
-@font-family-base:        @font-family-sans-serif;
-
-@font-size-base:          14px;
-@font-size-large:         ceil((@font-size-base * 1.25)); // ~18px
-@font-size-small:         ceil((@font-size-base * 0.85)); // ~12px
-
-@font-size-h1:            floor(@font-size-base * 3);
-@font-size-h2:            @font-size-base * 2.5;
-@font-size-h3:            ceil(@font-size-base * 1.75);
-@font-size-h4:            ceil(@font-size-base * 1.25);
-@font-size-h5:            @font-size-base;
-@font-size-h6:            ceil(@font-size-base * 0.85);
-
-//** Unit-less `line-height` for use in components like buttons.
-@line-height-base:        1.428571429; // 20/14
-//** Computed "line-height" (`font-size` * `line-height`) for use with `margin`, `padding`, etc.
-@line-height-computed:    floor((@font-size-base * @line-height-base)); // ~20px
-
-//** By default, this inherits from the ``.
-@headings-font-family:    "Open Sans", sans-serif;
-@headings-font-weight:    normal;
-@headings-line-height:    1.1;
-@headings-color:          inherit;
-
-
-//== Iconography
-//
-//## Specify custom location and filename of the included Glyphicons icon font. Useful for those including Bootstrap via Bower.
-
-//** Load fonts from this directory.
-@icon-font-path:          "../fonts/";
-//** File name for all font files.
-@icon-font-name:          "glyphicons-halflings-regular";
-//** Element ID within SVG icon file.
-@icon-font-svg-id:        "glyphicons_halflingsregular";
-
-
-//== Components
-//
-//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start).
-
-@padding-base-vertical:     4px;
-@padding-base-horizontal:   6px;
-
-@padding-large-vertical:    10px;
-@padding-large-horizontal:  16px;
-
-@padding-small-vertical:    5px;
-@padding-small-horizontal:  10px;
-
-@padding-xs-vertical:       1px;
-@padding-xs-horizontal:     5px;
-
-@line-height-large:         1.33;
-@line-height-small:         1.5;
-
-@border-radius-base:        4px;
-@border-radius-large:       6px;
-@border-radius-small:       3px;
-
-//** Global color for active items (e.g., navs or dropdowns).
-@component-active-color:    #fff;
-//** Global background color for active items (e.g., navs or dropdowns).
-@component-active-bg:       @brand-primary;
-
-//** Width of the `border` for generating carets that indicator dropdowns.
-@caret-width-base:          4px;
-//** Carets increase slightly in size for larger components.
-@caret-width-large:         5px;
-
-
-//== Tables
-//
-//## Customizes the `.table` component with basic values, each used across all table variations.
-
-//** Padding for ``s and ``s.
-@table-cell-padding:            8px;
-//** Padding for cells in `.table-condensed`.
-@table-condensed-cell-padding:  5px;
-
-//** Default background color used for all tables.
-@table-bg:                      transparent;
-//** Background color used for `.table-striped`.
-@table-bg-accent:               #f9f9f9;
-//** Background color used for `.table-hover`.
-@table-bg-hover:                #f5f5f5;
-@table-bg-active:               @table-bg-hover;
-
-//** Border color for table and cell borders.
-@table-border-color:            #ddd;
-
-
-//== Buttons
-//
-//## For each of Bootstrap's buttons, define text, background and border color.
-
-@btn-font-weight:                normal;
-
-@btn-default-color:              #333;
-@btn-default-bg:                 @gray-lighter;
-@btn-default-border:             @gray-lighter;
-
-@btn-primary-color:              #fff;
-@btn-primary-bg:                 @brand-primary;
-@btn-primary-border:             darken(@btn-primary-bg, 5%);
-
-@btn-success-color:              #fff;
-@btn-success-bg:                 @brand-success;
-@btn-success-border:             darken(@btn-success-bg, 5%);
-
-@btn-info-color:                 #fff;
-@btn-info-bg:                    @brand-info;
-@btn-info-border:                darken(@btn-info-bg, 5%);
-
-@btn-warning-color:              #fff;
-@btn-warning-bg:                 @brand-warning;
-@btn-warning-border:             darken(@btn-warning-bg, 5%);
-
-@btn-danger-color:               #fff;
-@btn-danger-bg:                  @brand-danger;
-@btn-danger-border:              darken(@btn-danger-bg, 5%);
-
-@btn-link-disabled-color:        @gray-light;
-
-
-//== Forms
-//
-//##
-
-//** `` background color
-@input-bg:                       #fff;
-//** `` background color
-@input-bg-disabled:              @gray-lighter;
-
-//** Text color for ``s
-@input-color:                    @gray;
-//** `` border color
-@input-border:                   #b2b2b2;
-
-// TODO: Rename `@input-border-radius` to `@input-border-radius-base` in v4
-//** Default `.form-control` border radius
-@input-border-radius:            @border-radius-base;
-//** Large `.form-control` border radius
-@input-border-radius-large:      @border-radius-large;
-//** Small `.form-control` border radius
-@input-border-radius-small:      @border-radius-small;
-
-//** Border color for inputs on focus
-@input-border-focus:             #d4b33a;
-
-//** Placeholder text color
-@input-color-placeholder:        #999;
-
-//** Default `.form-control` height
-@input-height-base:              (@line-height-computed + (@padding-base-vertical * 2) + 2);
-//** Large `.form-control` height
-@input-height-large:             (ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 2);
-//** Small `.form-control` height
-@input-height-small:             (floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 2);
-
-@legend-color:                   @gray-dark;
-@legend-border-color:            #e5e5e5;
-
-//** Background color for textual input addons
-@input-group-addon-bg:           @gray-lighter;
-//** Border color for textual input addons
-@input-group-addon-border-color: @input-border;
-
-//** Disabled cursor for form controls and buttons.
-@cursor-disabled:                not-allowed;
-
-
-//== Dropdowns
-//
-//## Dropdown menu container and contents.
-
-//** Background for the dropdown menu.
-@dropdown-bg:                    #fff;
-//** Dropdown menu `border-color`.
-@dropdown-border:                rgba(0,0,0,.15);
-//** Dropdown menu `border-color` **for IE8**.
-@dropdown-fallback-border:       #ccc;
-//** Divider color for between dropdown items.
-@dropdown-divider-bg:            #e5e5e5;
-
-//** Dropdown link text color.
-@dropdown-link-color:            @gray-dark;
-//** Hover color for dropdown links.
-@dropdown-link-hover-color:      darken(@gray-dark, 5%);
-//** Hover background for dropdown links.
-@dropdown-link-hover-bg:         #f5f5f5;
-
-//** Active dropdown menu item text color.
-@dropdown-link-active-color:     @component-active-color;
-//** Active dropdown menu item background color.
-@dropdown-link-active-bg:        @component-active-bg;
-
-//** Disabled dropdown menu item background color.
-@dropdown-link-disabled-color:   @gray-light;
-
-//** Text color for headers within dropdown menus.
-@dropdown-header-color:          @gray-light;
-
-//** Deprecated `@dropdown-caret-color` as of v3.1.0
-@dropdown-caret-color:           #000;
-
-
-//-- Z-index master list
-//
-// Warning: Avoid customizing these values. They're used for a bird's eye view
-// of components dependent on the z-axis and are designed to all work together.
-//
-// Note: These variables are not generated into the Customizer.
-
-@zindex-navbar:            1000;
-@zindex-dropdown:          1000;
-@zindex-popover:           1060;
-@zindex-tooltip:           1070;
-@zindex-navbar-fixed:      1030;
-@zindex-modal:             1040;
-
-
-//== Media queries breakpoints
-//
-//## Define the breakpoints at which your layout will change, adapting to different screen sizes.
-
-// Extra small screen / phone
-//** Deprecated `@screen-xs` as of v3.0.1
-@screen-xs:                  480px;
-//** Deprecated `@screen-xs-min` as of v3.2.0
-@screen-xs-min:              @screen-xs;
-//** Deprecated `@screen-phone` as of v3.0.1
-@screen-phone:               @screen-xs-min;
-
-// Small screen / tablet
-//** Deprecated `@screen-sm` as of v3.0.1
-@screen-sm:                  768px;
-@screen-sm-min:              @screen-sm;
-//** Deprecated `@screen-tablet` as of v3.0.1
-@screen-tablet:              @screen-sm-min;
-
-// Medium screen / desktop
-//** Deprecated `@screen-md` as of v3.0.1
-@screen-md:                  992px;
-@screen-md-min:              @screen-md;
-//** Deprecated `@screen-desktop` as of v3.0.1
-@screen-desktop:             @screen-md-min;
-
-// Large screen / wide desktop
-//** Deprecated `@screen-lg` as of v3.0.1
-@screen-lg:                  1200px;
-@screen-lg-min:              @screen-lg;
-//** Deprecated `@screen-lg-desktop` as of v3.0.1
-@screen-lg-desktop:          @screen-lg-min;
-
-// So media queries don't overlap when required, provide a maximum
-@screen-xs-max:              (@screen-sm-min - 1);
-@screen-sm-max:              (@screen-md-min - 1);
-@screen-md-max:              (@screen-lg-min - 1);
-
-
-//== Grid system
-//
-//## Define your custom responsive grid.
-
-//** Number of columns in the grid.
-@grid-columns:              12;
-//** Padding between columns. Gets divided in half for the left and right.
-@grid-gutter-width:         30px;
-// Navbar collapse
-//** Point at which the navbar becomes uncollapsed.
-@grid-float-breakpoint:     @screen-sm-min;
-//** Point at which the navbar begins collapsing.
-@grid-float-breakpoint-max: (@grid-float-breakpoint - 1);
-
-
-//== Container sizes
-//
-//## Define the maximum width of `.container` for different screen sizes.
-
-// Small screen / tablet
-@container-tablet:             (720px + @grid-gutter-width);
-//** For `@screen-sm-min` and up.
-@container-sm:                 @container-tablet;
-
-// Medium screen / desktop
-@container-desktop:            (940px + @grid-gutter-width);
-//** For `@screen-md-min` and up.
-@container-md:                 @container-desktop;
-
-// Large screen / wide desktop
-@container-large-desktop:      (1140px + @grid-gutter-width);
-//** For `@screen-lg-min` and up.
-@container-lg:                 @container-large-desktop;
-
-
-//== Navbar
-//
-//##
-
-// Basics of a navbar
-@navbar-height:                    100px;
-@navbar-margin-bottom:             0;
-@navbar-border-radius:             @border-radius-base;
-@navbar-padding-horizontal:        0;
-@navbar-padding-vertical:          ((@navbar-height - @line-height-computed) / 2);
-@navbar-collapse-max-height:       340px;
-
-@navbar-default-color:             @gray-base;
-@navbar-default-bg:                #f0db4f;
-@navbar-default-border:            #f0db4f;
-
-// Navbar links
-@navbar-default-link-color:                @navbar-default-color;
-@navbar-default-link-hover-color:          @gray-dark;
-@navbar-default-link-hover-bg:             transparent;
-@navbar-default-link-active-color:         @navbar-default-color;
-@navbar-default-link-active-bg:            transparent;
-@navbar-default-link-disabled-color:       #ccc;
-@navbar-default-link-disabled-bg:          transparent;
-
-// Navbar brand label
-@navbar-default-brand-color:               @navbar-default-link-color;
-@navbar-default-brand-hover-color:         darken(@navbar-default-brand-color, 10%);
-@navbar-default-brand-hover-bg:            transparent;
-
-// Navbar toggle
-@navbar-default-toggle-hover-bg:           #ddd;
-@navbar-default-toggle-icon-bar-bg:        @gray-dark;
-@navbar-default-toggle-border-color:       #ddd;
-
-
-// Inverted navbar
-// Reset inverted navbar basics
-@navbar-inverse-color:                      lighten(@gray-light, 15%);
-@navbar-inverse-bg:                         #222;
-@navbar-inverse-border:                     darken(@navbar-inverse-bg, 10%);
-
-// Inverted navbar links
-@navbar-inverse-link-color:                 lighten(@gray-light, 15%);
-@navbar-inverse-link-hover-color:           #fff;
-@navbar-inverse-link-hover-bg:              transparent;
-@navbar-inverse-link-active-color:          @navbar-inverse-link-hover-color;
-@navbar-inverse-link-active-bg:             darken(@navbar-inverse-bg, 10%);
-@navbar-inverse-link-disabled-color:        #444;
-@navbar-inverse-link-disabled-bg:           transparent;
-
-// Inverted navbar brand label
-@navbar-inverse-brand-color:                @navbar-inverse-link-color;
-@navbar-inverse-brand-hover-color:          #fff;
-@navbar-inverse-brand-hover-bg:             transparent;
-
-// Inverted navbar toggle
-@navbar-inverse-toggle-hover-bg:            #333;
-@navbar-inverse-toggle-icon-bar-bg:         #fff;
-@navbar-inverse-toggle-border-color:        #333;
-
-
-//== Navs
-//
-//##
-
-//=== Shared nav styles
-@nav-link-padding:                          10px 15px;
-@nav-link-hover-bg:                         @gray-lighter;
-
-@nav-disabled-link-color:                   @gray-light;
-@nav-disabled-link-hover-color:             @gray-light;
-
-//== Tabs
-@nav-tabs-border-color:                     #ddd;
-
-@nav-tabs-link-hover-border-color:          @gray-lighter;
-
-@nav-tabs-active-link-hover-bg:             @body-bg;
-@nav-tabs-active-link-hover-color:          @gray;
-@nav-tabs-active-link-hover-border-color:   #ddd;
-
-@nav-tabs-justified-link-border-color:            #ddd;
-@nav-tabs-justified-active-link-border-color:     @body-bg;
-
-//== Pills
-@nav-pills-border-radius:                   @border-radius-base;
-@nav-pills-active-link-hover-bg:            @component-active-bg;
-@nav-pills-active-link-hover-color:         @component-active-color;
-
-
-//== Pagination
-//
-//##
-
-@pagination-color:                     @link-color;
-@pagination-bg:                        #fff;
-@pagination-border:                    #ddd;
-
-@pagination-hover-color:               @link-hover-color;
-@pagination-hover-bg:                  @gray-lighter;
-@pagination-hover-border:              #ddd;
-
-@pagination-active-color:              #fff;
-@pagination-active-bg:                 @brand-primary;
-@pagination-active-border:             @brand-primary;
-
-@pagination-disabled-color:            @gray-light;
-@pagination-disabled-bg:               #fff;
-@pagination-disabled-border:           #ddd;
-
-
-//== Pager
-//
-//##
-
-@pager-bg:                             @pagination-bg;
-@pager-border:                         @pagination-border;
-@pager-border-radius:                  15px;
-
-@pager-hover-bg:                       @pagination-hover-bg;
-
-@pager-active-bg:                      @pagination-active-bg;
-@pager-active-color:                   @pagination-active-color;
-
-@pager-disabled-color:                 @pagination-disabled-color;
-
-
-//== Jumbotron
-//
-//##
-
-@jumbotron-padding:              30px;
-@jumbotron-color:                inherit;
-@jumbotron-bg:                   @gray-lighter;
-@jumbotron-heading-color:        inherit;
-@jumbotron-font-size:            ceil((@font-size-base * 1.5));
-
-
-//== Form states and alerts
-//
-//## Define colors for form feedback states and, by default, alerts.
-
-@state-success-text:             #3c763d;
-@state-success-bg:               #dff0d8;
-@state-success-border:           darken(spin(@state-success-bg, -10), 5%);
-
-@state-info-text:                #31708f;
-@state-info-bg:                  #d9edf7;
-@state-info-border:              darken(spin(@state-info-bg, -10), 7%);
-
-@state-warning-text:             #8a6d3b;
-@state-warning-bg:               #fcf8e3;
-@state-warning-border:           darken(spin(@state-warning-bg, -10), 5%);
-
-@state-danger-text:              #a94442;
-@state-danger-bg:                #f2dede;
-@state-danger-border:            darken(spin(@state-danger-bg, -10), 5%);
-
-
-//== Tooltips
-//
-//##
-
-//** Tooltip max width
-@tooltip-max-width:           200px;
-//** Tooltip text color
-@tooltip-color:               #fff;
-//** Tooltip background color
-@tooltip-bg:                  #000;
-@tooltip-opacity:             .9;
-
-//** Tooltip arrow width
-@tooltip-arrow-width:         5px;
-//** Tooltip arrow color
-@tooltip-arrow-color:         @tooltip-bg;
-
-
-//== Popovers
-//
-//##
-
-//** Popover body background color
-@popover-bg:                          #fff;
-//** Popover maximum width
-@popover-max-width:                   276px;
-//** Popover border color
-@popover-border-color:                rgba(0,0,0,.2);
-//** Popover fallback border color
-@popover-fallback-border-color:       #ccc;
-
-//** Popover title background color
-@popover-title-bg:                    darken(@popover-bg, 3%);
-
-//** Popover arrow width
-@popover-arrow-width:                 10px;
-//** Popover arrow color
-@popover-arrow-color:                 @popover-bg;
-
-//** Popover outer arrow width
-@popover-arrow-outer-width:           (@popover-arrow-width + 1);
-//** Popover outer arrow color
-@popover-arrow-outer-color:           fadein(@popover-border-color, 5%);
-//** Popover outer arrow fallback color
-@popover-arrow-outer-fallback-color:  darken(@popover-fallback-border-color, 20%);
-
-
-//== Labels
-//
-//##
-
-//** Default label background color
-@label-default-bg:            @gray-light;
-//** Primary label background color
-@label-primary-bg:            @brand-primary;
-//** Success label background color
-@label-success-bg:            @brand-success;
-//** Info label background color
-@label-info-bg:               @brand-info;
-//** Warning label background color
-@label-warning-bg:            @brand-warning;
-//** Danger label background color
-@label-danger-bg:             @brand-danger;
-
-//** Default label text color
-@label-color:                 #fff;
-//** Default text color of a linked label
-@label-link-hover-color:      #fff;
-
-
-//== Modals
-//
-//##
-
-//** Padding applied to the modal body
-@modal-inner-padding:         15px;
-
-//** Padding applied to the modal title
-@modal-title-padding:         15px;
-//** Modal title line-height
-@modal-title-line-height:     @line-height-base;
-
-//** Background color of modal content area
-@modal-content-bg:                             #fff;
-//** Modal content border color
-@modal-content-border-color:                   rgba(0,0,0,.2);
-//** Modal content border color **for IE8**
-@modal-content-fallback-border-color:          #999;
-
-//** Modal backdrop background color
-@modal-backdrop-bg:           #000;
-//** Modal backdrop opacity
-@modal-backdrop-opacity:      .5;
-//** Modal header border color
-@modal-header-border-color:   #e5e5e5;
-//** Modal footer border color
-@modal-footer-border-color:   @modal-header-border-color;
-
-@modal-lg:                    900px;
-@modal-md:                    600px;
-@modal-sm:                    300px;
-
-
-//== Alerts
-//
-//## Define alert colors, border radius, and padding.
-
-@alert-padding:               15px;
-@alert-border-radius:         @border-radius-base;
-@alert-link-font-weight:      bold;
-
-@alert-success-bg:            @state-success-bg;
-@alert-success-text:          @state-success-text;
-@alert-success-border:        @state-success-border;
-
-@alert-info-bg:               @state-info-bg;
-@alert-info-text:             @state-info-text;
-@alert-info-border:           @state-info-border;
-
-@alert-warning-bg:            @state-warning-bg;
-@alert-warning-text:          @state-warning-text;
-@alert-warning-border:        @state-warning-border;
-
-@alert-danger-bg:             @state-danger-bg;
-@alert-danger-text:           @state-danger-text;
-@alert-danger-border:         @state-danger-border;
-
-
-//== Progress bars
-//
-//##
-
-//** Background color of the whole progress component
-@progress-bg:                 #f5f5f5;
-//** Progress bar text color
-@progress-bar-color:          #fff;
-//** Variable for setting rounded corners on progress bar.
-@progress-border-radius:      @border-radius-base;
-
-//** Default progress bar color
-@progress-bar-bg:             @brand-primary;
-//** Success progress bar color
-@progress-bar-success-bg:     @brand-success;
-//** Warning progress bar color
-@progress-bar-warning-bg:     @brand-warning;
-//** Danger progress bar color
-@progress-bar-danger-bg:      @brand-danger;
-//** Info progress bar color
-@progress-bar-info-bg:        @brand-info;
-
-
-//== List group
-//
-//##
-
-//** Background color on `.list-group-item`
-@list-group-bg:                 #fff;
-//** `.list-group-item` border color
-@list-group-border:             #ddd;
-//** List group border radius
-@list-group-border-radius:      @border-radius-base;
-
-//** Background color of single list items on hover
-@list-group-hover-bg:           #f5f5f5;
-//** Text color of active list items
-@list-group-active-color:       @component-active-color;
-//** Background color of active list items
-@list-group-active-bg:          @component-active-bg;
-//** Border color of active list elements
-@list-group-active-border:      @list-group-active-bg;
-//** Text color for content within active list items
-@list-group-active-text-color:  lighten(@list-group-active-bg, 40%);
-
-//** Text color of disabled list items
-@list-group-disabled-color:      @gray-light;
-//** Background color of disabled list items
-@list-group-disabled-bg:         @gray-lighter;
-//** Text color for content within disabled list items
-@list-group-disabled-text-color: @list-group-disabled-color;
-
-@list-group-link-color:         #555;
-@list-group-link-hover-color:   @list-group-link-color;
-@list-group-link-heading-color: #333;
-
-
-//== Panels
-//
-//##
-
-@panel-bg:                    #fff;
-@panel-body-padding:          15px;
-@panel-heading-padding:       10px 15px;
-@panel-footer-padding:        @panel-heading-padding;
-@panel-border-radius:         @border-radius-base;
-
-//** Border color for elements within panels
-@panel-inner-border:          #ddd;
-@panel-footer-bg:             #f5f5f5;
-
-@panel-default-text:          @gray-dark;
-@panel-default-border:        #ddd;
-@panel-default-heading-bg:    #f5f5f5;
-
-@panel-primary-text:          #fff;
-@panel-primary-border:        @brand-primary;
-@panel-primary-heading-bg:    @brand-primary;
-
-@panel-success-text:          @state-success-text;
-@panel-success-border:        @state-success-border;
-@panel-success-heading-bg:    @state-success-bg;
-
-@panel-info-text:             @state-info-text;
-@panel-info-border:           @state-info-border;
-@panel-info-heading-bg:       @state-info-bg;
-
-@panel-warning-text:          @state-warning-text;
-@panel-warning-border:        @state-warning-border;
-@panel-warning-heading-bg:    @state-warning-bg;
-
-@panel-danger-text:           @state-danger-text;
-@panel-danger-border:         @state-danger-border;
-@panel-danger-heading-bg:     @state-danger-bg;
-
-
-//== Thumbnails
-//
-//##
-
-//** Padding around the thumbnail image
-@thumbnail-padding:           4px;
-//** Thumbnail background color
-@thumbnail-bg:                @body-bg;
-//** Thumbnail border color
-@thumbnail-border:            #ddd;
-//** Thumbnail border radius
-@thumbnail-border-radius:     @border-radius-base;
-
-//** Custom text color for thumbnail captions
-@thumbnail-caption-color:     @text-color;
-//** Padding around the thumbnail caption
-@thumbnail-caption-padding:   9px;
-
-
-//== Wells
-//
-//##
-
-@well-bg:                     #f5f5f5;
-@well-border:                 darken(@well-bg, 7%);
-
-
-//== Badges
-//
-//##
-
-@badge-color:                 #fff;
-//** Linked badge text color on hover
-@badge-link-hover-color:      #fff;
-@badge-bg:                    @gray-light;
-
-//** Badge text color in active nav link
-@badge-active-color:          @link-color;
-//** Badge background color in active nav link
-@badge-active-bg:             #fff;
-
-@badge-font-weight:           bold;
-@badge-line-height:           1;
-@badge-border-radius:         10px;
-
-
-//== Breadcrumbs
-//
-//##
-
-@breadcrumb-padding-vertical:   8px;
-@breadcrumb-padding-horizontal: 15px;
-//** Breadcrumb background color
-@breadcrumb-bg:                 #f5f5f5;
-//** Breadcrumb text color
-@breadcrumb-color:              #ccc;
-//** Text color of current page in the breadcrumb
-@breadcrumb-active-color:       @gray-light;
-//** Textual separator for between breadcrumb elements
-@breadcrumb-separator:          "/";
-
-
-//== Carousel
-//
-//##
-
-@carousel-text-shadow:                        0 1px 2px rgba(0,0,0,.6);
-
-@carousel-control-color:                      #fff;
-@carousel-control-width:                      15%;
-@carousel-control-opacity:                    .5;
-@carousel-control-font-size:                  20px;
-
-@carousel-indicator-active-bg:                #fff;
-@carousel-indicator-border-color:             #fff;
-
-@carousel-caption-color:                      #fff;
-
-
-//== Close
-//
-//##
-
-@close-font-weight:           bold;
-@close-color:                 #000;
-@close-text-shadow:           0 1px 0 #fff;
-
-
-//== Code
-//
-//##
-
-@code-color:                  #c7254e;
-@code-bg:                     #f9f2f4;
-
-@kbd-color:                   #fff;
-@kbd-bg:                      #333;
-
-@pre-bg:                      #f5f5f5;
-@pre-color:                   @gray-dark;
-@pre-border-color:            #ccc;
-@pre-scrollable-max-height:   340px;
-
-
-//== Type
-//
-//##
-
-//** Horizontal offset for forms and lists.
-@component-offset-horizontal: 180px;
-//** Text muted color
-@text-muted:                  @gray-light;
-//** Abbreviations and acronyms border color
-@abbr-border-color:           @gray-light;
-//** Headings small color
-@headings-small-color:        @gray-light;
-//** Blockquote small color
-@blockquote-small-color:      @gray-light;
-//** Blockquote font size
-@blockquote-font-size:        (@font-size-base * 1.25);
-//** Blockquote border color
-@blockquote-border-color:     @gray-lighter;
-//** Page header border color
-@page-header-border-color:    @gray-lighter;
-//** Width of horizontal description list titles
-@dl-horizontal-offset:        @component-offset-horizontal;
-//** Horizontal line color.
-@hr-border:                   #b2b2b2;
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/buttons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/buttons.less
deleted file mode 100644
index bbb3c620..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/buttons.less
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Buttons
-// --------------------------------------------------
-
-
-// Base styles
-// --------------------------------------------------
-
-// Core styles
-.btn {
-  display: inline-block;
-  padding: 5px 6px 4px 8px;
-  margin-top: 0;
-  margin-bottom: 0; // For input.btn
-  font-family: "Open Sans Condensed", sans-serif;
-  font-size: @font-size-base * 1.3;
-  font-weight: 700;
-  text-transform: uppercase;
-  letter-spacing: 1px;
-  line-height: @line-height-computed;
-  text-align: center;
-  vertical-align: middle;
-  touch-action: manipulation;
-  cursor: pointer;
-  background-color: @gray-lighter;
-  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
-  border: none;
-  border-radius: 3px;
-  .box-shadow(1px 1px 0 rgba(0, 0, 0, 0.3));
-  outline: none !important;
-  white-space: nowrap;
-  .user-select(none);
-
-  &:focus,
-  &.focus {
-    .tab-focus();
-  }
-
-  &:hover,
-  &:focus,
-  &.focus {
-    background-color: lighten(@gray-lighter, 5%);
-    text-decoration: none;
-    .transition(background-color .1s linear);
-  }
-
-  &:active,
-  &.active {
-    outline: 0;
-    padding: 6px 5px 3px 9px;
-  }
-
-  &.disabled,
-  &[disabled],
-  fieldset[disabled] & {
-    cursor: @cursor-disabled;
-    pointer-events: none; // Future-proof disabling of clicks
-    .opacity(65);
-    .box-shadow(1px 1px 0 rgba(0, 0, 0, 0.15));
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/code.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/code.less
deleted file mode 100644
index 33af7555..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/code.less
+++ /dev/null
@@ -1,8 +0,0 @@
-code {
-  margin: 0 2px;
-  padding: 1px 5px;
-  border: 1px solid #E1E1E8;
-  background-color: #F7F7F9;
-  color: @gray-dark;
-  font-size: 85%;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/evaluation-form.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/evaluation-form.less
deleted file mode 100644
index 6d505d56..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/evaluation-form.less
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// Evaluation form
-// --------------------------------------------------
-
-
-.evaluation-form {
-  .clearfix();
-
-  textarea {
-    height: 200px;
-  }
-}
-
-.evaluation-input-output {
-  float: left;
-  width: 65%;
-}
-
-.evaluation-input-clear-button {
-  position: absolute;
-  top: 0;
-  right: 0;
-  width: 15px;
-  height: 15px;
-  margin: 6px;
-  display: inline-block;
-  background: transparent url("../images/clear-text.png") no-repeat scroll 0 0;
-  opacity: 0.75;
-  line-height: 0;
-  vertical-align: bottom;
-  cursor: pointer;
-
-  &:hover {
-   opacity: 1;
- }
-}
-
-.evaluation-input-clear-button.with-scrollbar {
-  margin-right: 29px;
-}
-
-.evaluation-output {
-  margin-top: 1.5em;
-}
-
-.evaluation-input-field,
-.evaluation-output-field {
-  margin-bottom: 0.5em;
-  .box-sizing(border-box);
-  overflow-x: hidden;
-  line-height: @line-height-computed;
-}
-
-.evaluation-output-field {
-  &[readonly] {
-    cursor: auto;
-    background-color: @input-bg;
-  }
-}
-
-.evaluation-error-header {
-  margin-bottom: @line-height-computed;
-  padding-left: 52px;
-  background: transparent url("../images/icons/48x48/error.png") no-repeat scroll 0 50%;
-  color: @black;
-  font-family: @font-family-sans-serif;
-  font-weight: bold;
-  line-height: 48px;
-  vertical-align: middle;
-}
-
-ul.evaluation-error-list,
-ul.evaluation-warning-list {
-  li {
-    margin-bottom: 1em;
-
-    pre {
-      margin-top: 0.5em;
-      white-space: pre;
-      overflow: auto;
-    }
-  }
-}
-
-ul.evaluation-error-list li pre {
-  background-color: @state-danger-bg;
-}
-
-ul.evaluation-warning-list li pre {
-  background-color: @state-warning-bg;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/forms.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/forms.less
deleted file mode 100644
index 2ceb0559..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/forms.less
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// Forms
-// --------------------------------------------------
-
-// GENERAL STYLES
-// --------------
-
-label {
-  font-weight: normal;
-}
-
-
-// Form controls
-// -------------------------
-
-// Common form controls
-.form-control {
-  line-height: @input-height-base;
-}
-
-.textarea-wrapper {
-  position: relative;
-}
-
-// Form groups
-.form-group {
-  margin-bottom: 0.5em;
-}
-
-// Info and errors
-// --------------------------
-.message-info {
-  border: 1px solid;
-  clear: both;
-  padding: 10px 20px;
-  color: @state-info-text;
-}
-
-.message-error {
-  clear: both;
-  color: @state-danger-text;
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 20px 0 10px 0;
-}
-
-.message-success {
-  color: @state-success-text;
-  font-size: 1.3em;
-  font-weight: bold;
-  margin: 20px 0 10px 0;
-}
-
-.error {
-  color: @state-danger-text;
-}
-
-// Styles for validation helpers
-// --------------------------
-.validators {
-  font-style: normal;
-  padding-bottom: 0.5em;
-}
-
-.field-validation-error {
-  display: block;
-  padding-bottom: 0.5em;
-  color: @state-danger-text;
-  font-weight: bold;
-}
-
-.field-validation-valid {
-  display: none;
-}
-
-input.input-validation-error,
-textarea.input-validation-error,
-select.input-validation-error
-{
-  border: 1px solid @state-danger-border;
-  background-color: @state-danger-bg;
-  .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
-
-  &:focus {
-    border-color: @state-danger-border;
-    @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@state-danger-text, 20%);
-    .box-shadow(@shadow);
-  }
-}
-
-.validation-summary-errors {
-  color: @state-danger-text;
-  font-weight: bold;
-  font-size: 1.1em;
-}
-
-.validation-summary-valid {
-  display: none;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/icons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/icons.less
deleted file mode 100644
index 79b9d9e5..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/icons.less
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Icons
-// --------------------------------------------------
-
-
-.icon {
-  background: transparent url(../images/icons/32x32/social-media-icons-32.png) no-repeat scroll;
-  display: inline-block;
-  line-height: 0;
-  vertical-align: bottom;
-}
-
-.icon-32 {
-  height: 32px;
-  width: 32px;
-}
-
-.icon-facebook {
-  background-position: 0 0;
-}
-
-.icon-twitter {
-  background-position: 0 -32px;
-}
-
-.icon-linkedin {
-  background-position: 0 -64px;
-}
-
-.icon-rss {
-  background-position: 0 -128px;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/layout.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/layout.less
deleted file mode 100644
index 35a7f386..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/layout.less
+++ /dev/null
@@ -1,128 +0,0 @@
-html,
-body {
-  margin: 0;
-  height: 100%;
-  /* The html and body elements cannot have any padding or margin */
-}
-
-/* Wrapper for page content to push down footer */
-.l-wrapper {
-  min-height: 100%;
-  height: auto !important;
-  height: 100%;
-  /* Negative indent footer by it's height */
-  margin: 0 auto (-1 * @footer-height);
-}
-
-.l-constrained {
-  margin: 0 auto;
-  padding-left: 20px;
-  padding-right: 20px;
-  max-width: 1200px;
-  min-width: 800px;
-}
-
-.l-header {
-  border-top: solid 10px @black;
-  border-bottom: 1px solid #d4b33a;
-  background-color: #f0db4f;
-
-  .l-constrained {
-    padding-top: 20px;
-    padding-bottom: 20px;
-    .clearfix();
-  }
-}
-
-.l-content {
-  .clearfix();
-}
-
-.l-main-content {
-  float: left;
-  width: 70%;
-}
-
-.l-sidebar {
-  float: right;
-  width: 30%;
-}
-
-/* Set the fixed height of the footer here */
-.l-push,
-.l-footer {
-  height: @footer-height;
-}
-
-.l-footer {
-  width: 100%;
-  background-color: @black;
-  color: @gray-lighter;
-  font-size: @font-size-small;
-  line-height: 100%;
-
-  .l-constrained {
-    padding-top: (@footer-height - 32) / 2;
-    .clearfix();
-  }
-
-  a {
-    color: @gray-lighter;
-    text-decoration: none;
-
-    &:hover,
-    &:active {
-      text-decoration: underline;
-    }
-  }
-}
-
-
-// Header
-// -------------------------
-
-.logo {
-  margin: 0;
-
-  a {
-    display: block;
-    float: left;
-    width: 100px;
-    height: 100px;
-    background: transparent url("../images/jsengineswitcher-logo.png") no-repeat scroll 0 0;
-    text-indent: -9999em;
-  }
-}
-
-.primary-nav {
-  position: relative;
-  left: 40px;
-  float: left;
-}
-
-
-// Footer
-// -------------------------
-
-.l-copyright {
-  float: left;
-    p {
-      margin: 0;
-      padding: 0;
-  }
-}
-
-.l-social {
-  float: right;
-
-  li {
-    display: inline;
-    list-style: none outside none;
-    padding-left: 10px;
-
-    a {
-      text-indent: -9999px;
-      outline: none;
-    }
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/mixins.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/mixins.less
deleted file mode 100644
index d26eee79..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/mixins.less
+++ /dev/null
@@ -1,9 +0,0 @@
-//
-// Mixins
-// --------------------------------------------------
-
-// NO Drop shadows
-.no-box-shadow {
-  -webkit-box-shadow: none; // iOS <4.3 & Android <4.1
-          box-shadow: none;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/navbar.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/navbar.less
deleted file mode 100644
index 95edf3c2..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/navbar.less
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Navbars
-// --------------------------------------------------
-
-
-// Wrapper and base class
-//
-// Provide a static navbar from which we expand to create full-width, fixed, and
-// other navbar variations.
-
-.navbar {
-  border: none;
-  border-radius: 0;
-}
-
-// Navbar nav links
-//
-// Builds on top of the `.nav` components with it's own modifier class to make
-// the nav the full height of the horizontal nav (above 768px).
-
-.navbar-nav {
-  float: left;
-  margin: 0 auto;
-
-  > li {
-    > a {
-      float: none;
-      // Vertically center the text given @navbar-height
-      padding: ((@navbar-height - @line-height-computed) / 2) 15px ((@navbar-height - @line-height-computed) / 2);
-      border: 1px solid transparent;
-      font-family: "Open Sans", sans-serif;
-      font-size: 2.0em;
-      text-decoration: none;
-      text-transform: uppercase;
-      outline: none;
-    }
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/page-socials.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/page-socials.less
deleted file mode 100644
index ea12dc09..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/page-socials.less
+++ /dev/null
@@ -1,14 +0,0 @@
-.page-socials {
-  min-height: 60px;
-  margin-top: 20px;
-  padding-top: 15px;
-  border-top: 1px solid #b2b2b2;
-}
-
-.share-buttons {
-  li {
-    margin-right: 15px;
-    vertical-align: top;
-    line-height: normal;
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/type.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/type.less
deleted file mode 100644
index 02d69502..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/type.less
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Typography
-// --------------------------------------------------
-
-// Headings
-// -------------------------
-
-h1, h2, h3 {
-  margin-top: 10px;
-}
-
-h1, h2 {
-  line-height: 40px;
-}
-
-h2 {
-  color: @black;
-  font-weight: bold;
-}
-
-h3 {
-  color: @gray-dark;
-  line-height: @line-height-computed * 1.25;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/variables.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/variables.less
deleted file mode 100644
index 498c9796..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore31.Mvc31/wwwroot/styles/variables.less
+++ /dev/null
@@ -1,7 +0,0 @@
-// Colors
-// -------------------------
-@black:                 #1d0d0d;
-
-// Footer
-// -------------------------
-@footer-height:                    55px;
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/.bowerrc b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/.bowerrc
deleted file mode 100644
index ea81a597..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/.bowerrc
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "registry": "https://registry.bower.io",
-  "directory": "wwwroot/lib"
-}
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs
deleted file mode 100644
index 4a0ffa8d..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Infrastructure/TagHelpers/ConditionalCommentTagHelper.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using System;
-
-using Microsoft.AspNetCore.Razor.TagHelpers;
-
-namespace JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5.Infrastructure.TagHelpers
-{
-	[HtmlTargetElement("conditional-comment")]
-	public class ConditionalCommentTagHelper : TagHelper
-	{
-		[HtmlAttributeName("type")]
-		public ConditionalCommentType CommentType { get; set; }
-
-		[HtmlAttributeName("expression")]
-		public string Expression { get; set; }
-
-
-		public override void Process(TagHelperContext context, TagHelperOutput output)
-		{
-			output.TagName = null;
-
-			ConditionalCommentType type = CommentType;
-
-			string ifCommentStartPart;
-			string ifCommentEndPart;
-
-			switch (type)
-			{
-				case ConditionalCommentType.Hidden:
-					ifCommentStartPart = "";
-
-					break;
-				case ConditionalCommentType.RevealedValidatingSimplified:
-					ifCommentStartPart = "";
-
-					break;
-				case ConditionalCommentType.Revealed:
-					ifCommentStartPart = "";
-
-					break;
-				default:
-					throw new NotSupportedException();
-			}
-
-			TagHelperContent preContent = output.PreContent;
-			preContent.AppendHtml(ifCommentStartPart);
-			preContent.AppendHtml(Expression);
-			preContent.AppendHtml(ifCommentEndPart);
-
-			string endIfComment;
-
-			switch (type)
-			{
-				case ConditionalCommentType.Hidden:
-					endIfComment = "";
-					break;
-				case ConditionalCommentType.RevealedValidating:
-				case ConditionalCommentType.RevealedValidatingSimplified:
-					endIfComment = "";
-					break;
-				case ConditionalCommentType.Revealed:
-					endIfComment = "";
-					break;
-				default:
-					throw new NotSupportedException();
-			}
-
-			output.PostContent.AppendHtml(endIfComment);
-		}
-	}
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Infrastructure/TagHelpers/ConditionalCommentType.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Infrastructure/TagHelpers/ConditionalCommentType.cs
deleted file mode 100644
index 1db7d03d..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Infrastructure/TagHelpers/ConditionalCommentType.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5.Infrastructure.TagHelpers
-{
-	public enum ConditionalCommentType
-	{
-		Hidden,
-		Revealed,
-		RevealedValidating,
-		RevealedValidatingSimplified
-	}
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5.csproj
index bdaea04e..07820916 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5.csproj
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5.csproj
@@ -2,31 +2,34 @@
 
   
     JS Engine Switcher: Sample ASP.NET Core 5.0 MVC 5 Site
-    3.19.0
+    3.30.2
     net5.0
     Exe
     true
+    true
     true
+    true
     false
+    false
   
 
   
 
   
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
 
     
     
@@ -35,27 +38,13 @@
     
     
     
+    
     
     
     
+    
   
 
-  
-    
-  
-  
-    
-  
-  
-    
-  
-  
-    
-  
-  
-    
-    
-    
-  
+  
 
 
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Program.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Program.cs
index f51cce46..376442fc 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Program.cs
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Program.cs
@@ -1,4 +1,6 @@
-using Microsoft.AspNetCore.Hosting;
+using System.IO;
+
+using Microsoft.AspNetCore.Hosting;
 using Microsoft.Extensions.Hosting;
 using Microsoft.Extensions.Logging;
 
@@ -15,6 +17,10 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
 			Host.CreateDefaultBuilder(args)
 				.ConfigureWebHostDefaults(webBuilder =>
 				{
+					webBuilder.UseWebRoot(Path.Combine(
+						Directory.GetCurrentDirectory(),
+						"../JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot"
+					));
 					webBuilder.UseStartup();
 				})
 				.ConfigureLogging((hostingContext, logging) =>
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Properties/launchSettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Properties/launchSettings.json
index d6c667af..7b2ce114 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Properties/launchSettings.json
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Properties/launchSettings.json
@@ -3,23 +3,23 @@
     "windowsAuthentication": false,
     "anonymousAuthentication": true,
     "iisExpress": {
-      "applicationUrl": "http://localhost:52873",
+      "applicationUrl": "http://localhost:19282",
       "sslPort": 0
     }
   },
   "profiles": {
-    "IIS Express": {
-      "commandName": "IISExpress",
+    "JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5": {
+      "commandName": "Project",
+      "dotnetRunMessages": "true",
       "launchBrowser": true,
+      "applicationUrl": "http://localhost:5121",
       "environmentVariables": {
         "ASPNETCORE_ENVIRONMENT": "Development"
       }
     },
-    "JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5": {
-      "commandName": "Project",
-      "dotnetRunMessages": "true",
+    "IIS Express": {
+      "commandName": "IISExpress",
       "launchBrowser": true,
-      "applicationUrl": "http://localhost:5000",
       "environmentVariables": {
         "ASPNETCORE_ENVIRONMENT": "Development"
       }
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Startup.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Startup.cs
index b8325bce..2ef8be36 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Startup.cs
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Startup.cs
@@ -16,6 +16,7 @@
 using JavaScriptEngineSwitcher.Sample.Logic.Services;
 using JavaScriptEngineSwitcher.V8;
 using JavaScriptEngineSwitcher.Vroom;
+using JavaScriptEngineSwitcher.Yantra;
 
 namespace JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5
 {
@@ -60,8 +61,10 @@ public void ConfigureServices(IServiceCollection services)
 
 			// Add JavaScriptEngineSwitcher services to the services container.
 			services.AddJsEngineSwitcher(options =>
-				options.DefaultEngineName = ChakraCoreJsEngine.EngineName
-			)
+			{
+				options.AllowCurrentProperty = false;
+				options.DefaultEngineName = ChakraCoreJsEngine.EngineName;
+			})
 				.AddChakraCore()
 				.AddJint()
 				.AddJurassic()
@@ -73,6 +76,7 @@ public void ConfigureServices(IServiceCollection services)
 				.AddNode(services)
 				.AddV8()
 				.AddVroom()
+				.AddYantra()
 				;
 
 			services.Configure(options =>
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/Home/Contact.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/Home/Contact.cshtml
index cd9663df..58785ebe 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/Home/Contact.cshtml
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/Home/Contact.cshtml
@@ -5,19 +5,4 @@
 

@ViewBag.Title

@ViewBag.Body -
- -@section Scripts { - -} \ No newline at end of file + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/Shared/_JsEvaluationErrorList.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/Shared/_JsEvaluationErrorList.cshtml index b5968080..9e0601d6 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/Shared/_JsEvaluationErrorList.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/Shared/_JsEvaluationErrorList.cshtml @@ -1,4 +1,4 @@ -@using JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5.Infrastructure.Helpers +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.Helpers @using JavaScriptEngineSwitcher.Sample.Logic.Models @model IList diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/Shared/_Layout.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/Shared/_Layout.cshtml index 022f173b..5fe54776 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/Shared/_Layout.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/Shared/_Layout.cshtml @@ -1,4 +1,4 @@ -@using JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5.Infrastructure.TagHelpers +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.TagHelpers @@ -61,9 +61,10 @@ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/_ViewImports.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/_ViewImports.cshtml index 74dd760b..8fe8384e 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/_ViewImports.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/Views/_ViewImports.cshtml @@ -1,2 +1,2 @@ @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" -@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5" \ No newline at end of file +@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure" \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/bower.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/bower.json deleted file mode 100644 index be2b1906..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/bower.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "jsengineswitcher.sample.aspnetcore5.mvc5", - "dependencies": { - "modernizr": "2.8.3", - "jquery-compat": "jquery#1.10.2", - "jquery": "jquery#2.0.3", - "jquery-validation": "1.13.1", - "jquery-validation-unobtrusive": "3.2.3", - "bootstrap": "3.3.0" - } -} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/gulpfile.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/gulpfile.js deleted file mode 100644 index 0f259437..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/gulpfile.js +++ /dev/null @@ -1,130 +0,0 @@ -/*global require, exports */ -/*jshint esversion: 6 */ -const WEB_ROOT_PATH = "wwwroot"; -const BOWER_DIR_PATH = WEB_ROOT_PATH + "/lib"; -const STYLE_DIR_PATH = WEB_ROOT_PATH + '/styles'; -const SCRIPT_DIR_PATH = WEB_ROOT_PATH + '/scripts'; - -// include plug-ins -let { src, dest, series, parallel, watch } = require('gulp'); -let del = require('del'); -let sourcemaps = require('gulp-sourcemaps'); -let rename = require('gulp-rename'); -let concat = require('gulp-concat'); -let less = require('gulp-less'); -let autoprefixer = require('gulp-autoprefixer'); -let cleanCss = require('gulp-clean-css'); -let uglify = require('gulp-uglify'); - -//#region Clean -//#region Clean builded assets -function cleanBuildedStyles() { - return del([STYLE_DIR_PATH + '/build/*']); -} - -function cleanBuildedScripts() { - return del([SCRIPT_DIR_PATH + '/build/*']); -} - -let cleanBuildedAssets = parallel(cleanBuildedStyles, cleanBuildedScripts); -//#endregion -//#endregion - -//#region Build assets -//#region Build styles -let autoprefixerOptions = { - overrideBrowserslist: ['> 1%', 'last 3 versions', 'Firefox ESR', 'Opera 12.1'], - cascade: true -}; -let cssCleanOptions = { specialComments: '*' }; -let cssRenameOptions = { extname: '.min.css' }; - -function buildCommonStyles() { - return src([STYLE_DIR_PATH + '/app.less']) - .pipe(sourcemaps.init()) - .pipe(less({ - relativeUrls: true, - rootpath: '/styles/' - })) - .pipe(autoprefixer(autoprefixerOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(STYLE_DIR_PATH + '/build')) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(concat('common-styles.css')) - .pipe(cleanCss(cssCleanOptions)) - .pipe(rename(cssRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(STYLE_DIR_PATH + '/build')) - ; -} - -let buildStyles = buildCommonStyles; -//#endregion - -//#region Build scripts -let jsConcatOptions = { newLine: ';' }; -let jsUglifyOptions = { - output: { comments: /^!/ } -}; -let jsRenameOptions = { extname: '.min.js' }; - -function buildModernizrScripts() { - return src([BOWER_DIR_PATH + '/modernizr/modernizr.js']) - .pipe(sourcemaps.init()) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -function buildCommonScripts() { - return src([SCRIPT_DIR_PATH + '/common.js']) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(rename({ basename: 'common-scripts' })) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -function buildEvaluationFormScripts() { - return src([BOWER_DIR_PATH + '/jquery-validation/dist/jquery.validate.js', - BOWER_DIR_PATH + '/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js', - BOWER_DIR_PATH + '/bootstrap/js/button.js', - SCRIPT_DIR_PATH + '/evaluation-form.js']) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(concat('evaluation-form-scripts.js', jsConcatOptions)) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -let buildScripts = parallel(buildModernizrScripts, buildCommonScripts, buildEvaluationFormScripts); -//#endregion - -let buildAssets = parallel(buildStyles, buildScripts); -//#endregion - -//#region Watch assets -function watchStyles() { - return watch([STYLE_DIR_PATH + '/**/*.{less,css}', '!' + STYLE_DIR_PATH + '/build/**/*.*'], - buildStyles); -} - -function watchScripts() { - return watch([SCRIPT_DIR_PATH + '/**/*.js', '!' + SCRIPT_DIR_PATH + '/build/**/*.*'], - buildScripts); -} - -let watchAssets = parallel(watchStyles, watchScripts); -//#endregion - -// Export tasks -exports.cleanBuildedAssets = cleanBuildedAssets; -exports.buildAssets = buildAssets; -exports.watchAssets = watchAssets; -exports.default = series(cleanBuildedAssets, buildAssets); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/package.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/package.json deleted file mode 100644 index b4e12721..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "javascriptengineswitcher.sample.aspnetcore5.mvc5", - "private": true, - "version": "3.19.0", - "devDependencies": { - "gulp": "4.0.2", - "del": "5.1.0", - "gulp-sourcemaps": "2.6.5", - "gulp-rename": "2.0.0", - "gulp-concat": "2.6.1", - "gulp-less": "4.0.1", - "gulp-autoprefixer": "7.0.1", - "gulp-clean-css": "4.2.0", - "gulp-uglify": "3.0.2" - } -} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/0.gif b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/0.gif deleted file mode 100644 index 35d42e80..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/0.gif and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/clear-text.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/clear-text.png deleted file mode 100644 index 9d217b7f..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/clear-text.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/icons/32x32/social-media-icons-32.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/icons/32x32/social-media-icons-32.png deleted file mode 100644 index 49aa1fe3..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/icons/32x32/social-media-icons-32.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/icons/48x48/error.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/icons/48x48/error.png deleted file mode 100644 index 3d6185f7..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/icons/48x48/error.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/jsengineswitcher-logo.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/jsengineswitcher-logo.png deleted file mode 100644 index 12ed97e0..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/images/jsengineswitcher-logo.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/scripts/_references.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/scripts/_references.js deleted file mode 100644 index 2b54eea8..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/scripts/_references.js and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/scripts/common.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/scripts/common.js deleted file mode 100644 index c94bf102..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/scripts/common.js +++ /dev/null @@ -1,29 +0,0 @@ -var jsEngineSwitcher; - -(function (jsEngineSwitcher, undefined) { - "use strict"; - - jsEngineSwitcher.registerNamespace = function (namespaceString) { - var parts = namespaceString.split("."), - parent = jsEngineSwitcher, - i - ; - - if (parts[0] === "jsEngineSwitcher") { - parts = parts.slice(1); - } - - for (i = 0; i < parts.length; i += 1) { - if (typeof parent[parts[i]] === "undefined") { - parent[parts[i]] = {}; - } - parent = parent[parts[i]]; - } - - return parent; - }; - - jsEngineSwitcher.hasScrollbar = function(elem) { - return (elem.clientHeight < elem.scrollHeight); - }; -}(jsEngineSwitcher = jsEngineSwitcher || {})); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/scripts/evaluation-form.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/scripts/evaluation-form.js deleted file mode 100644 index da1f0199..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/scripts/evaluation-form.js +++ /dev/null @@ -1,83 +0,0 @@ -(function (jsEngineSwitcher, $, undefined) { - "use strict"; - - var $evaluationForm, - $evaluationInputField, - $evaluationInputClearButton, - $evaluateButton - ; - - $(function () { - $evaluationForm = $("form[data-form-type='evaluation-form']"); - $evaluationInputField = $(":input[data-control-type='evaluation-input-field']", $evaluationForm); - $evaluationInputClearButton = $("
"); - $evaluateButton = $(":input[data-control-type='evaluate-button']", $evaluationForm); - - $evaluationForm.on("submit", onEvaluationFormSubmitHandler); - - $evaluationInputClearButton.on("click", onEvaluationInputClearButtonClickHandler); - $evaluationInputField.parent().append($evaluationInputClearButton); - refreshEvaluationInputClearButton(); - $evaluationInputField - .on("input propertychange keydown keyup paste", onEvaluationInputFieldChangeHandler) - ; - - $evaluateButton.removeAttr("disabled"); - }); - - $(window).unload(function() { - $evaluationForm.off("submit", onEvaluationFormSubmitHandler); - - $evaluationInputClearButton - .off("click", onEvaluationInputClearButtonClickHandler) - .remove() - ; - - $evaluationInputField - .off("input propertychange keydown keyup paste", onEvaluationInputFieldChangeHandler) - ; - - $evaluationForm = null; - $evaluationInputField = null; - $evaluationInputClearButton = null; - $evaluateButton = null; - }); - - var refreshEvaluationInputClearButton = function() { - if ($.trim($evaluationInputField.val()).length > 0) { - $evaluationInputClearButton.show(); - } else { - $evaluationInputClearButton.hide(); - } - - if (jsEngineSwitcher.hasScrollbar($evaluationInputField.get(0))) { - $evaluationInputClearButton.addClass("with-scrollbar"); - } - else { - $evaluationInputClearButton.removeClass("with-scrollbar"); - } - }; - - var onEvaluationFormSubmitHandler = function () { - var $form = $(this); - if ($form.valid()) { - $evaluateButton.attr("disabled", "disabled"); - $("textarea[data-control-type='evaluation-output-field']", $form).val(''); - - return true; - } - - return false; - }; - - var onEvaluationInputFieldChangeHandler = function () { - refreshEvaluationInputClearButton(); - }; - - var onEvaluationInputClearButtonClickHandler = function() { - $evaluationInputField.val(""); - - var $button = $(this); - $button.hide(); - }; -}(jsEngineSwitcher, jQuery)); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/app.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/app.less deleted file mode 100644 index c41a9315..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/app.less +++ /dev/null @@ -1,71 +0,0 @@ -/*! - * Bootstrap v3.3.0 (http://getbootstrap.com) - * Copyright 2011-2014 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ - -// Core variables and mixins -@import "bootstrap-custom-variables.less"; -@import "../lib/bootstrap/less/mixins.less"; - -// Reset -@import "../lib/bootstrap/less/normalize.less"; -//@import "../lib/bootstrap/less/print.less"; -//@import "../lib/bootstrap/less/glyphicons.less"; - -// Core CSS -@import "../lib/bootstrap/less/scaffolding.less"; -@import "../lib/bootstrap/less/type.less"; -@import "../lib/bootstrap/less/code.less"; -//@import "../lib/bootstrap/less/grid.less"; -//@import "../lib/bootstrap/less/tables.less"; -@import "../lib/bootstrap/less/forms.less"; -//@import "../lib/bootstrap/less/buttons.less"; - -// Components -//@import "../lib/bootstrap/less/component-animations.less"; -//@import "../lib/bootstrap/less/dropdowns.less"; -//@import "../lib/bootstrap/less/button-groups.less"; -//@import "../lib/bootstrap/less/input-groups.less"; -@import "../lib/bootstrap/less/navs.less"; -@import "../lib/bootstrap/less/navbar.less"; -//@import "../lib/bootstrap/less/breadcrumbs.less"; -//@import "../lib/bootstrap/less/pagination.less"; -//@import "../lib/bootstrap/less/pager.less"; -//@import "../lib/bootstrap/less/labels.less"; -//@import "../lib/bootstrap/less/badges.less"; -//@import "../lib/bootstrap/less/jumbotron.less"; -//@import "../lib/bootstrap/less/thumbnails.less"; -//@import "../lib/bootstrap/less/alerts.less"; -//@import "../lib/bootstrap/less/progress-bars.less"; -//@import "../lib/bootstrap/less/media.less"; -//@import "../lib/bootstrap/less/list-group.less"; -//@import "../lib/bootstrap/less/panels.less"; -//@import "../lib/bootstrap/less/responsive-embed.less"; -//@import "../lib/bootstrap/less/wells.less"; -//@import "../lib/bootstrap/less/close.less"; - -// Components w/ JavaScript -//@import "../lib/bootstrap/less/modals.less"; -//@import "../lib/bootstrap/less/tooltip.less"; -//@import "../lib/bootstrap/less/popovers.less"; -//@import "../lib/bootstrap/less/carousel.less"; - -// Utility classes -@import "../lib/bootstrap/less/utilities.less"; -//@import "../lib/bootstrap/less/responsive-utilities.less"; - -// JavaScriptEngineSwitcher specs -@import "variables.less"; -@import "mixins.less"; - -@import "type.less"; -@import "code.less"; -@import "forms.less"; -@import "buttons.less"; -@import "icons.less"; -@import "navbar.less"; - -@import "layout.less"; -@import "evaluation-form.less"; -@import "page-socials.less"; \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/bootstrap-custom-variables.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/bootstrap-custom-variables.less deleted file mode 100644 index 0be2aa6f..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/bootstrap-custom-variables.less +++ /dev/null @@ -1,856 +0,0 @@ -// -// Variables -// -------------------------------------------------- - - -//== Colors -// -//## Gray and brand colors for use across Bootstrap. - -@gray-base: #323330; -@gray-darker: lighten(@gray-base, 13.5%); // #222 -@gray-dark: lighten(@gray-base, 20%); // #333 -@gray: lighten(@gray-base, 33.5%); // #555 -@gray-light: lighten(@gray-base, 46.7%); // #777 -@gray-lighter: #e3e3e3; - -@brand-primary: #428bca; -@brand-success: #5cb85c; -@brand-info: #5bc0de; -@brand-warning: #f0ad4e; -@brand-danger: #d9534f; - - -//== Scaffolding -// -//## Settings for some of the most global styles. - -//** Background color for ``. -@body-bg: #fff; -//** Global text color on ``. -@text-color: #1d0d0d; - -//** Global textual link color. -@link-color: @brand-primary; -//** Link hover color set via `darken()` function. -@link-hover-color: darken(@link-color, 15%); -//** Link hover decoration. -@link-hover-decoration: underline; - - -//== Typography -// -//## Font, line-height, and color for body text, headings, and more. - -@font-family-sans-serif: "Helvetica Neue", Arial, sans-serif; -@font-family-serif: Georgia, "Times New Roman", Times, serif; -//** Default monospace fonts for ``, ``, and `
`.
-@font-family-monospace:   Consolas, "Courier New", monospace;
-@font-family-base:        @font-family-sans-serif;
-
-@font-size-base:          14px;
-@font-size-large:         ceil((@font-size-base * 1.25)); // ~18px
-@font-size-small:         ceil((@font-size-base * 0.85)); // ~12px
-
-@font-size-h1:            floor(@font-size-base * 3);
-@font-size-h2:            @font-size-base * 2.5;
-@font-size-h3:            ceil(@font-size-base * 1.75);
-@font-size-h4:            ceil(@font-size-base * 1.25);
-@font-size-h5:            @font-size-base;
-@font-size-h6:            ceil(@font-size-base * 0.85);
-
-//** Unit-less `line-height` for use in components like buttons.
-@line-height-base:        1.428571429; // 20/14
-//** Computed "line-height" (`font-size` * `line-height`) for use with `margin`, `padding`, etc.
-@line-height-computed:    floor((@font-size-base * @line-height-base)); // ~20px
-
-//** By default, this inherits from the ``.
-@headings-font-family:    "Open Sans", sans-serif;
-@headings-font-weight:    normal;
-@headings-line-height:    1.1;
-@headings-color:          inherit;
-
-
-//== Iconography
-//
-//## Specify custom location and filename of the included Glyphicons icon font. Useful for those including Bootstrap via Bower.
-
-//** Load fonts from this directory.
-@icon-font-path:          "../fonts/";
-//** File name for all font files.
-@icon-font-name:          "glyphicons-halflings-regular";
-//** Element ID within SVG icon file.
-@icon-font-svg-id:        "glyphicons_halflingsregular";
-
-
-//== Components
-//
-//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start).
-
-@padding-base-vertical:     4px;
-@padding-base-horizontal:   6px;
-
-@padding-large-vertical:    10px;
-@padding-large-horizontal:  16px;
-
-@padding-small-vertical:    5px;
-@padding-small-horizontal:  10px;
-
-@padding-xs-vertical:       1px;
-@padding-xs-horizontal:     5px;
-
-@line-height-large:         1.33;
-@line-height-small:         1.5;
-
-@border-radius-base:        4px;
-@border-radius-large:       6px;
-@border-radius-small:       3px;
-
-//** Global color for active items (e.g., navs or dropdowns).
-@component-active-color:    #fff;
-//** Global background color for active items (e.g., navs or dropdowns).
-@component-active-bg:       @brand-primary;
-
-//** Width of the `border` for generating carets that indicator dropdowns.
-@caret-width-base:          4px;
-//** Carets increase slightly in size for larger components.
-@caret-width-large:         5px;
-
-
-//== Tables
-//
-//## Customizes the `.table` component with basic values, each used across all table variations.
-
-//** Padding for ``s and ``s.
-@table-cell-padding:            8px;
-//** Padding for cells in `.table-condensed`.
-@table-condensed-cell-padding:  5px;
-
-//** Default background color used for all tables.
-@table-bg:                      transparent;
-//** Background color used for `.table-striped`.
-@table-bg-accent:               #f9f9f9;
-//** Background color used for `.table-hover`.
-@table-bg-hover:                #f5f5f5;
-@table-bg-active:               @table-bg-hover;
-
-//** Border color for table and cell borders.
-@table-border-color:            #ddd;
-
-
-//== Buttons
-//
-//## For each of Bootstrap's buttons, define text, background and border color.
-
-@btn-font-weight:                normal;
-
-@btn-default-color:              #333;
-@btn-default-bg:                 @gray-lighter;
-@btn-default-border:             @gray-lighter;
-
-@btn-primary-color:              #fff;
-@btn-primary-bg:                 @brand-primary;
-@btn-primary-border:             darken(@btn-primary-bg, 5%);
-
-@btn-success-color:              #fff;
-@btn-success-bg:                 @brand-success;
-@btn-success-border:             darken(@btn-success-bg, 5%);
-
-@btn-info-color:                 #fff;
-@btn-info-bg:                    @brand-info;
-@btn-info-border:                darken(@btn-info-bg, 5%);
-
-@btn-warning-color:              #fff;
-@btn-warning-bg:                 @brand-warning;
-@btn-warning-border:             darken(@btn-warning-bg, 5%);
-
-@btn-danger-color:               #fff;
-@btn-danger-bg:                  @brand-danger;
-@btn-danger-border:              darken(@btn-danger-bg, 5%);
-
-@btn-link-disabled-color:        @gray-light;
-
-
-//== Forms
-//
-//##
-
-//** `` background color
-@input-bg:                       #fff;
-//** `` background color
-@input-bg-disabled:              @gray-lighter;
-
-//** Text color for ``s
-@input-color:                    @gray;
-//** `` border color
-@input-border:                   #b2b2b2;
-
-// TODO: Rename `@input-border-radius` to `@input-border-radius-base` in v4
-//** Default `.form-control` border radius
-@input-border-radius:            @border-radius-base;
-//** Large `.form-control` border radius
-@input-border-radius-large:      @border-radius-large;
-//** Small `.form-control` border radius
-@input-border-radius-small:      @border-radius-small;
-
-//** Border color for inputs on focus
-@input-border-focus:             #d4b33a;
-
-//** Placeholder text color
-@input-color-placeholder:        #999;
-
-//** Default `.form-control` height
-@input-height-base:              (@line-height-computed + (@padding-base-vertical * 2) + 2);
-//** Large `.form-control` height
-@input-height-large:             (ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 2);
-//** Small `.form-control` height
-@input-height-small:             (floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 2);
-
-@legend-color:                   @gray-dark;
-@legend-border-color:            #e5e5e5;
-
-//** Background color for textual input addons
-@input-group-addon-bg:           @gray-lighter;
-//** Border color for textual input addons
-@input-group-addon-border-color: @input-border;
-
-//** Disabled cursor for form controls and buttons.
-@cursor-disabled:                not-allowed;
-
-
-//== Dropdowns
-//
-//## Dropdown menu container and contents.
-
-//** Background for the dropdown menu.
-@dropdown-bg:                    #fff;
-//** Dropdown menu `border-color`.
-@dropdown-border:                rgba(0,0,0,.15);
-//** Dropdown menu `border-color` **for IE8**.
-@dropdown-fallback-border:       #ccc;
-//** Divider color for between dropdown items.
-@dropdown-divider-bg:            #e5e5e5;
-
-//** Dropdown link text color.
-@dropdown-link-color:            @gray-dark;
-//** Hover color for dropdown links.
-@dropdown-link-hover-color:      darken(@gray-dark, 5%);
-//** Hover background for dropdown links.
-@dropdown-link-hover-bg:         #f5f5f5;
-
-//** Active dropdown menu item text color.
-@dropdown-link-active-color:     @component-active-color;
-//** Active dropdown menu item background color.
-@dropdown-link-active-bg:        @component-active-bg;
-
-//** Disabled dropdown menu item background color.
-@dropdown-link-disabled-color:   @gray-light;
-
-//** Text color for headers within dropdown menus.
-@dropdown-header-color:          @gray-light;
-
-//** Deprecated `@dropdown-caret-color` as of v3.1.0
-@dropdown-caret-color:           #000;
-
-
-//-- Z-index master list
-//
-// Warning: Avoid customizing these values. They're used for a bird's eye view
-// of components dependent on the z-axis and are designed to all work together.
-//
-// Note: These variables are not generated into the Customizer.
-
-@zindex-navbar:            1000;
-@zindex-dropdown:          1000;
-@zindex-popover:           1060;
-@zindex-tooltip:           1070;
-@zindex-navbar-fixed:      1030;
-@zindex-modal:             1040;
-
-
-//== Media queries breakpoints
-//
-//## Define the breakpoints at which your layout will change, adapting to different screen sizes.
-
-// Extra small screen / phone
-//** Deprecated `@screen-xs` as of v3.0.1
-@screen-xs:                  480px;
-//** Deprecated `@screen-xs-min` as of v3.2.0
-@screen-xs-min:              @screen-xs;
-//** Deprecated `@screen-phone` as of v3.0.1
-@screen-phone:               @screen-xs-min;
-
-// Small screen / tablet
-//** Deprecated `@screen-sm` as of v3.0.1
-@screen-sm:                  768px;
-@screen-sm-min:              @screen-sm;
-//** Deprecated `@screen-tablet` as of v3.0.1
-@screen-tablet:              @screen-sm-min;
-
-// Medium screen / desktop
-//** Deprecated `@screen-md` as of v3.0.1
-@screen-md:                  992px;
-@screen-md-min:              @screen-md;
-//** Deprecated `@screen-desktop` as of v3.0.1
-@screen-desktop:             @screen-md-min;
-
-// Large screen / wide desktop
-//** Deprecated `@screen-lg` as of v3.0.1
-@screen-lg:                  1200px;
-@screen-lg-min:              @screen-lg;
-//** Deprecated `@screen-lg-desktop` as of v3.0.1
-@screen-lg-desktop:          @screen-lg-min;
-
-// So media queries don't overlap when required, provide a maximum
-@screen-xs-max:              (@screen-sm-min - 1);
-@screen-sm-max:              (@screen-md-min - 1);
-@screen-md-max:              (@screen-lg-min - 1);
-
-
-//== Grid system
-//
-//## Define your custom responsive grid.
-
-//** Number of columns in the grid.
-@grid-columns:              12;
-//** Padding between columns. Gets divided in half for the left and right.
-@grid-gutter-width:         30px;
-// Navbar collapse
-//** Point at which the navbar becomes uncollapsed.
-@grid-float-breakpoint:     @screen-sm-min;
-//** Point at which the navbar begins collapsing.
-@grid-float-breakpoint-max: (@grid-float-breakpoint - 1);
-
-
-//== Container sizes
-//
-//## Define the maximum width of `.container` for different screen sizes.
-
-// Small screen / tablet
-@container-tablet:             (720px + @grid-gutter-width);
-//** For `@screen-sm-min` and up.
-@container-sm:                 @container-tablet;
-
-// Medium screen / desktop
-@container-desktop:            (940px + @grid-gutter-width);
-//** For `@screen-md-min` and up.
-@container-md:                 @container-desktop;
-
-// Large screen / wide desktop
-@container-large-desktop:      (1140px + @grid-gutter-width);
-//** For `@screen-lg-min` and up.
-@container-lg:                 @container-large-desktop;
-
-
-//== Navbar
-//
-//##
-
-// Basics of a navbar
-@navbar-height:                    100px;
-@navbar-margin-bottom:             0;
-@navbar-border-radius:             @border-radius-base;
-@navbar-padding-horizontal:        0;
-@navbar-padding-vertical:          ((@navbar-height - @line-height-computed) / 2);
-@navbar-collapse-max-height:       340px;
-
-@navbar-default-color:             @gray-base;
-@navbar-default-bg:                #f0db4f;
-@navbar-default-border:            #f0db4f;
-
-// Navbar links
-@navbar-default-link-color:                @navbar-default-color;
-@navbar-default-link-hover-color:          @gray-dark;
-@navbar-default-link-hover-bg:             transparent;
-@navbar-default-link-active-color:         @navbar-default-color;
-@navbar-default-link-active-bg:            transparent;
-@navbar-default-link-disabled-color:       #ccc;
-@navbar-default-link-disabled-bg:          transparent;
-
-// Navbar brand label
-@navbar-default-brand-color:               @navbar-default-link-color;
-@navbar-default-brand-hover-color:         darken(@navbar-default-brand-color, 10%);
-@navbar-default-brand-hover-bg:            transparent;
-
-// Navbar toggle
-@navbar-default-toggle-hover-bg:           #ddd;
-@navbar-default-toggle-icon-bar-bg:        @gray-dark;
-@navbar-default-toggle-border-color:       #ddd;
-
-
-// Inverted navbar
-// Reset inverted navbar basics
-@navbar-inverse-color:                      lighten(@gray-light, 15%);
-@navbar-inverse-bg:                         #222;
-@navbar-inverse-border:                     darken(@navbar-inverse-bg, 10%);
-
-// Inverted navbar links
-@navbar-inverse-link-color:                 lighten(@gray-light, 15%);
-@navbar-inverse-link-hover-color:           #fff;
-@navbar-inverse-link-hover-bg:              transparent;
-@navbar-inverse-link-active-color:          @navbar-inverse-link-hover-color;
-@navbar-inverse-link-active-bg:             darken(@navbar-inverse-bg, 10%);
-@navbar-inverse-link-disabled-color:        #444;
-@navbar-inverse-link-disabled-bg:           transparent;
-
-// Inverted navbar brand label
-@navbar-inverse-brand-color:                @navbar-inverse-link-color;
-@navbar-inverse-brand-hover-color:          #fff;
-@navbar-inverse-brand-hover-bg:             transparent;
-
-// Inverted navbar toggle
-@navbar-inverse-toggle-hover-bg:            #333;
-@navbar-inverse-toggle-icon-bar-bg:         #fff;
-@navbar-inverse-toggle-border-color:        #333;
-
-
-//== Navs
-//
-//##
-
-//=== Shared nav styles
-@nav-link-padding:                          10px 15px;
-@nav-link-hover-bg:                         @gray-lighter;
-
-@nav-disabled-link-color:                   @gray-light;
-@nav-disabled-link-hover-color:             @gray-light;
-
-//== Tabs
-@nav-tabs-border-color:                     #ddd;
-
-@nav-tabs-link-hover-border-color:          @gray-lighter;
-
-@nav-tabs-active-link-hover-bg:             @body-bg;
-@nav-tabs-active-link-hover-color:          @gray;
-@nav-tabs-active-link-hover-border-color:   #ddd;
-
-@nav-tabs-justified-link-border-color:            #ddd;
-@nav-tabs-justified-active-link-border-color:     @body-bg;
-
-//== Pills
-@nav-pills-border-radius:                   @border-radius-base;
-@nav-pills-active-link-hover-bg:            @component-active-bg;
-@nav-pills-active-link-hover-color:         @component-active-color;
-
-
-//== Pagination
-//
-//##
-
-@pagination-color:                     @link-color;
-@pagination-bg:                        #fff;
-@pagination-border:                    #ddd;
-
-@pagination-hover-color:               @link-hover-color;
-@pagination-hover-bg:                  @gray-lighter;
-@pagination-hover-border:              #ddd;
-
-@pagination-active-color:              #fff;
-@pagination-active-bg:                 @brand-primary;
-@pagination-active-border:             @brand-primary;
-
-@pagination-disabled-color:            @gray-light;
-@pagination-disabled-bg:               #fff;
-@pagination-disabled-border:           #ddd;
-
-
-//== Pager
-//
-//##
-
-@pager-bg:                             @pagination-bg;
-@pager-border:                         @pagination-border;
-@pager-border-radius:                  15px;
-
-@pager-hover-bg:                       @pagination-hover-bg;
-
-@pager-active-bg:                      @pagination-active-bg;
-@pager-active-color:                   @pagination-active-color;
-
-@pager-disabled-color:                 @pagination-disabled-color;
-
-
-//== Jumbotron
-//
-//##
-
-@jumbotron-padding:              30px;
-@jumbotron-color:                inherit;
-@jumbotron-bg:                   @gray-lighter;
-@jumbotron-heading-color:        inherit;
-@jumbotron-font-size:            ceil((@font-size-base * 1.5));
-
-
-//== Form states and alerts
-//
-//## Define colors for form feedback states and, by default, alerts.
-
-@state-success-text:             #3c763d;
-@state-success-bg:               #dff0d8;
-@state-success-border:           darken(spin(@state-success-bg, -10), 5%);
-
-@state-info-text:                #31708f;
-@state-info-bg:                  #d9edf7;
-@state-info-border:              darken(spin(@state-info-bg, -10), 7%);
-
-@state-warning-text:             #8a6d3b;
-@state-warning-bg:               #fcf8e3;
-@state-warning-border:           darken(spin(@state-warning-bg, -10), 5%);
-
-@state-danger-text:              #a94442;
-@state-danger-bg:                #f2dede;
-@state-danger-border:            darken(spin(@state-danger-bg, -10), 5%);
-
-
-//== Tooltips
-//
-//##
-
-//** Tooltip max width
-@tooltip-max-width:           200px;
-//** Tooltip text color
-@tooltip-color:               #fff;
-//** Tooltip background color
-@tooltip-bg:                  #000;
-@tooltip-opacity:             .9;
-
-//** Tooltip arrow width
-@tooltip-arrow-width:         5px;
-//** Tooltip arrow color
-@tooltip-arrow-color:         @tooltip-bg;
-
-
-//== Popovers
-//
-//##
-
-//** Popover body background color
-@popover-bg:                          #fff;
-//** Popover maximum width
-@popover-max-width:                   276px;
-//** Popover border color
-@popover-border-color:                rgba(0,0,0,.2);
-//** Popover fallback border color
-@popover-fallback-border-color:       #ccc;
-
-//** Popover title background color
-@popover-title-bg:                    darken(@popover-bg, 3%);
-
-//** Popover arrow width
-@popover-arrow-width:                 10px;
-//** Popover arrow color
-@popover-arrow-color:                 @popover-bg;
-
-//** Popover outer arrow width
-@popover-arrow-outer-width:           (@popover-arrow-width + 1);
-//** Popover outer arrow color
-@popover-arrow-outer-color:           fadein(@popover-border-color, 5%);
-//** Popover outer arrow fallback color
-@popover-arrow-outer-fallback-color:  darken(@popover-fallback-border-color, 20%);
-
-
-//== Labels
-//
-//##
-
-//** Default label background color
-@label-default-bg:            @gray-light;
-//** Primary label background color
-@label-primary-bg:            @brand-primary;
-//** Success label background color
-@label-success-bg:            @brand-success;
-//** Info label background color
-@label-info-bg:               @brand-info;
-//** Warning label background color
-@label-warning-bg:            @brand-warning;
-//** Danger label background color
-@label-danger-bg:             @brand-danger;
-
-//** Default label text color
-@label-color:                 #fff;
-//** Default text color of a linked label
-@label-link-hover-color:      #fff;
-
-
-//== Modals
-//
-//##
-
-//** Padding applied to the modal body
-@modal-inner-padding:         15px;
-
-//** Padding applied to the modal title
-@modal-title-padding:         15px;
-//** Modal title line-height
-@modal-title-line-height:     @line-height-base;
-
-//** Background color of modal content area
-@modal-content-bg:                             #fff;
-//** Modal content border color
-@modal-content-border-color:                   rgba(0,0,0,.2);
-//** Modal content border color **for IE8**
-@modal-content-fallback-border-color:          #999;
-
-//** Modal backdrop background color
-@modal-backdrop-bg:           #000;
-//** Modal backdrop opacity
-@modal-backdrop-opacity:      .5;
-//** Modal header border color
-@modal-header-border-color:   #e5e5e5;
-//** Modal footer border color
-@modal-footer-border-color:   @modal-header-border-color;
-
-@modal-lg:                    900px;
-@modal-md:                    600px;
-@modal-sm:                    300px;
-
-
-//== Alerts
-//
-//## Define alert colors, border radius, and padding.
-
-@alert-padding:               15px;
-@alert-border-radius:         @border-radius-base;
-@alert-link-font-weight:      bold;
-
-@alert-success-bg:            @state-success-bg;
-@alert-success-text:          @state-success-text;
-@alert-success-border:        @state-success-border;
-
-@alert-info-bg:               @state-info-bg;
-@alert-info-text:             @state-info-text;
-@alert-info-border:           @state-info-border;
-
-@alert-warning-bg:            @state-warning-bg;
-@alert-warning-text:          @state-warning-text;
-@alert-warning-border:        @state-warning-border;
-
-@alert-danger-bg:             @state-danger-bg;
-@alert-danger-text:           @state-danger-text;
-@alert-danger-border:         @state-danger-border;
-
-
-//== Progress bars
-//
-//##
-
-//** Background color of the whole progress component
-@progress-bg:                 #f5f5f5;
-//** Progress bar text color
-@progress-bar-color:          #fff;
-//** Variable for setting rounded corners on progress bar.
-@progress-border-radius:      @border-radius-base;
-
-//** Default progress bar color
-@progress-bar-bg:             @brand-primary;
-//** Success progress bar color
-@progress-bar-success-bg:     @brand-success;
-//** Warning progress bar color
-@progress-bar-warning-bg:     @brand-warning;
-//** Danger progress bar color
-@progress-bar-danger-bg:      @brand-danger;
-//** Info progress bar color
-@progress-bar-info-bg:        @brand-info;
-
-
-//== List group
-//
-//##
-
-//** Background color on `.list-group-item`
-@list-group-bg:                 #fff;
-//** `.list-group-item` border color
-@list-group-border:             #ddd;
-//** List group border radius
-@list-group-border-radius:      @border-radius-base;
-
-//** Background color of single list items on hover
-@list-group-hover-bg:           #f5f5f5;
-//** Text color of active list items
-@list-group-active-color:       @component-active-color;
-//** Background color of active list items
-@list-group-active-bg:          @component-active-bg;
-//** Border color of active list elements
-@list-group-active-border:      @list-group-active-bg;
-//** Text color for content within active list items
-@list-group-active-text-color:  lighten(@list-group-active-bg, 40%);
-
-//** Text color of disabled list items
-@list-group-disabled-color:      @gray-light;
-//** Background color of disabled list items
-@list-group-disabled-bg:         @gray-lighter;
-//** Text color for content within disabled list items
-@list-group-disabled-text-color: @list-group-disabled-color;
-
-@list-group-link-color:         #555;
-@list-group-link-hover-color:   @list-group-link-color;
-@list-group-link-heading-color: #333;
-
-
-//== Panels
-//
-//##
-
-@panel-bg:                    #fff;
-@panel-body-padding:          15px;
-@panel-heading-padding:       10px 15px;
-@panel-footer-padding:        @panel-heading-padding;
-@panel-border-radius:         @border-radius-base;
-
-//** Border color for elements within panels
-@panel-inner-border:          #ddd;
-@panel-footer-bg:             #f5f5f5;
-
-@panel-default-text:          @gray-dark;
-@panel-default-border:        #ddd;
-@panel-default-heading-bg:    #f5f5f5;
-
-@panel-primary-text:          #fff;
-@panel-primary-border:        @brand-primary;
-@panel-primary-heading-bg:    @brand-primary;
-
-@panel-success-text:          @state-success-text;
-@panel-success-border:        @state-success-border;
-@panel-success-heading-bg:    @state-success-bg;
-
-@panel-info-text:             @state-info-text;
-@panel-info-border:           @state-info-border;
-@panel-info-heading-bg:       @state-info-bg;
-
-@panel-warning-text:          @state-warning-text;
-@panel-warning-border:        @state-warning-border;
-@panel-warning-heading-bg:    @state-warning-bg;
-
-@panel-danger-text:           @state-danger-text;
-@panel-danger-border:         @state-danger-border;
-@panel-danger-heading-bg:     @state-danger-bg;
-
-
-//== Thumbnails
-//
-//##
-
-//** Padding around the thumbnail image
-@thumbnail-padding:           4px;
-//** Thumbnail background color
-@thumbnail-bg:                @body-bg;
-//** Thumbnail border color
-@thumbnail-border:            #ddd;
-//** Thumbnail border radius
-@thumbnail-border-radius:     @border-radius-base;
-
-//** Custom text color for thumbnail captions
-@thumbnail-caption-color:     @text-color;
-//** Padding around the thumbnail caption
-@thumbnail-caption-padding:   9px;
-
-
-//== Wells
-//
-//##
-
-@well-bg:                     #f5f5f5;
-@well-border:                 darken(@well-bg, 7%);
-
-
-//== Badges
-//
-//##
-
-@badge-color:                 #fff;
-//** Linked badge text color on hover
-@badge-link-hover-color:      #fff;
-@badge-bg:                    @gray-light;
-
-//** Badge text color in active nav link
-@badge-active-color:          @link-color;
-//** Badge background color in active nav link
-@badge-active-bg:             #fff;
-
-@badge-font-weight:           bold;
-@badge-line-height:           1;
-@badge-border-radius:         10px;
-
-
-//== Breadcrumbs
-//
-//##
-
-@breadcrumb-padding-vertical:   8px;
-@breadcrumb-padding-horizontal: 15px;
-//** Breadcrumb background color
-@breadcrumb-bg:                 #f5f5f5;
-//** Breadcrumb text color
-@breadcrumb-color:              #ccc;
-//** Text color of current page in the breadcrumb
-@breadcrumb-active-color:       @gray-light;
-//** Textual separator for between breadcrumb elements
-@breadcrumb-separator:          "/";
-
-
-//== Carousel
-//
-//##
-
-@carousel-text-shadow:                        0 1px 2px rgba(0,0,0,.6);
-
-@carousel-control-color:                      #fff;
-@carousel-control-width:                      15%;
-@carousel-control-opacity:                    .5;
-@carousel-control-font-size:                  20px;
-
-@carousel-indicator-active-bg:                #fff;
-@carousel-indicator-border-color:             #fff;
-
-@carousel-caption-color:                      #fff;
-
-
-//== Close
-//
-//##
-
-@close-font-weight:           bold;
-@close-color:                 #000;
-@close-text-shadow:           0 1px 0 #fff;
-
-
-//== Code
-//
-//##
-
-@code-color:                  #c7254e;
-@code-bg:                     #f9f2f4;
-
-@kbd-color:                   #fff;
-@kbd-bg:                      #333;
-
-@pre-bg:                      #f5f5f5;
-@pre-color:                   @gray-dark;
-@pre-border-color:            #ccc;
-@pre-scrollable-max-height:   340px;
-
-
-//== Type
-//
-//##
-
-//** Horizontal offset for forms and lists.
-@component-offset-horizontal: 180px;
-//** Text muted color
-@text-muted:                  @gray-light;
-//** Abbreviations and acronyms border color
-@abbr-border-color:           @gray-light;
-//** Headings small color
-@headings-small-color:        @gray-light;
-//** Blockquote small color
-@blockquote-small-color:      @gray-light;
-//** Blockquote font size
-@blockquote-font-size:        (@font-size-base * 1.25);
-//** Blockquote border color
-@blockquote-border-color:     @gray-lighter;
-//** Page header border color
-@page-header-border-color:    @gray-lighter;
-//** Width of horizontal description list titles
-@dl-horizontal-offset:        @component-offset-horizontal;
-//** Horizontal line color.
-@hr-border:                   #b2b2b2;
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/buttons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/buttons.less
deleted file mode 100644
index bbb3c620..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/buttons.less
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Buttons
-// --------------------------------------------------
-
-
-// Base styles
-// --------------------------------------------------
-
-// Core styles
-.btn {
-  display: inline-block;
-  padding: 5px 6px 4px 8px;
-  margin-top: 0;
-  margin-bottom: 0; // For input.btn
-  font-family: "Open Sans Condensed", sans-serif;
-  font-size: @font-size-base * 1.3;
-  font-weight: 700;
-  text-transform: uppercase;
-  letter-spacing: 1px;
-  line-height: @line-height-computed;
-  text-align: center;
-  vertical-align: middle;
-  touch-action: manipulation;
-  cursor: pointer;
-  background-color: @gray-lighter;
-  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
-  border: none;
-  border-radius: 3px;
-  .box-shadow(1px 1px 0 rgba(0, 0, 0, 0.3));
-  outline: none !important;
-  white-space: nowrap;
-  .user-select(none);
-
-  &:focus,
-  &.focus {
-    .tab-focus();
-  }
-
-  &:hover,
-  &:focus,
-  &.focus {
-    background-color: lighten(@gray-lighter, 5%);
-    text-decoration: none;
-    .transition(background-color .1s linear);
-  }
-
-  &:active,
-  &.active {
-    outline: 0;
-    padding: 6px 5px 3px 9px;
-  }
-
-  &.disabled,
-  &[disabled],
-  fieldset[disabled] & {
-    cursor: @cursor-disabled;
-    pointer-events: none; // Future-proof disabling of clicks
-    .opacity(65);
-    .box-shadow(1px 1px 0 rgba(0, 0, 0, 0.15));
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/code.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/code.less
deleted file mode 100644
index 33af7555..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/code.less
+++ /dev/null
@@ -1,8 +0,0 @@
-code {
-  margin: 0 2px;
-  padding: 1px 5px;
-  border: 1px solid #E1E1E8;
-  background-color: #F7F7F9;
-  color: @gray-dark;
-  font-size: 85%;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/evaluation-form.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/evaluation-form.less
deleted file mode 100644
index 6d505d56..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/evaluation-form.less
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// Evaluation form
-// --------------------------------------------------
-
-
-.evaluation-form {
-  .clearfix();
-
-  textarea {
-    height: 200px;
-  }
-}
-
-.evaluation-input-output {
-  float: left;
-  width: 65%;
-}
-
-.evaluation-input-clear-button {
-  position: absolute;
-  top: 0;
-  right: 0;
-  width: 15px;
-  height: 15px;
-  margin: 6px;
-  display: inline-block;
-  background: transparent url("../images/clear-text.png") no-repeat scroll 0 0;
-  opacity: 0.75;
-  line-height: 0;
-  vertical-align: bottom;
-  cursor: pointer;
-
-  &:hover {
-   opacity: 1;
- }
-}
-
-.evaluation-input-clear-button.with-scrollbar {
-  margin-right: 29px;
-}
-
-.evaluation-output {
-  margin-top: 1.5em;
-}
-
-.evaluation-input-field,
-.evaluation-output-field {
-  margin-bottom: 0.5em;
-  .box-sizing(border-box);
-  overflow-x: hidden;
-  line-height: @line-height-computed;
-}
-
-.evaluation-output-field {
-  &[readonly] {
-    cursor: auto;
-    background-color: @input-bg;
-  }
-}
-
-.evaluation-error-header {
-  margin-bottom: @line-height-computed;
-  padding-left: 52px;
-  background: transparent url("../images/icons/48x48/error.png") no-repeat scroll 0 50%;
-  color: @black;
-  font-family: @font-family-sans-serif;
-  font-weight: bold;
-  line-height: 48px;
-  vertical-align: middle;
-}
-
-ul.evaluation-error-list,
-ul.evaluation-warning-list {
-  li {
-    margin-bottom: 1em;
-
-    pre {
-      margin-top: 0.5em;
-      white-space: pre;
-      overflow: auto;
-    }
-  }
-}
-
-ul.evaluation-error-list li pre {
-  background-color: @state-danger-bg;
-}
-
-ul.evaluation-warning-list li pre {
-  background-color: @state-warning-bg;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/forms.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/forms.less
deleted file mode 100644
index 2ceb0559..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/forms.less
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// Forms
-// --------------------------------------------------
-
-// GENERAL STYLES
-// --------------
-
-label {
-  font-weight: normal;
-}
-
-
-// Form controls
-// -------------------------
-
-// Common form controls
-.form-control {
-  line-height: @input-height-base;
-}
-
-.textarea-wrapper {
-  position: relative;
-}
-
-// Form groups
-.form-group {
-  margin-bottom: 0.5em;
-}
-
-// Info and errors
-// --------------------------
-.message-info {
-  border: 1px solid;
-  clear: both;
-  padding: 10px 20px;
-  color: @state-info-text;
-}
-
-.message-error {
-  clear: both;
-  color: @state-danger-text;
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 20px 0 10px 0;
-}
-
-.message-success {
-  color: @state-success-text;
-  font-size: 1.3em;
-  font-weight: bold;
-  margin: 20px 0 10px 0;
-}
-
-.error {
-  color: @state-danger-text;
-}
-
-// Styles for validation helpers
-// --------------------------
-.validators {
-  font-style: normal;
-  padding-bottom: 0.5em;
-}
-
-.field-validation-error {
-  display: block;
-  padding-bottom: 0.5em;
-  color: @state-danger-text;
-  font-weight: bold;
-}
-
-.field-validation-valid {
-  display: none;
-}
-
-input.input-validation-error,
-textarea.input-validation-error,
-select.input-validation-error
-{
-  border: 1px solid @state-danger-border;
-  background-color: @state-danger-bg;
-  .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
-
-  &:focus {
-    border-color: @state-danger-border;
-    @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@state-danger-text, 20%);
-    .box-shadow(@shadow);
-  }
-}
-
-.validation-summary-errors {
-  color: @state-danger-text;
-  font-weight: bold;
-  font-size: 1.1em;
-}
-
-.validation-summary-valid {
-  display: none;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/icons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/icons.less
deleted file mode 100644
index 79b9d9e5..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/icons.less
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Icons
-// --------------------------------------------------
-
-
-.icon {
-  background: transparent url(../images/icons/32x32/social-media-icons-32.png) no-repeat scroll;
-  display: inline-block;
-  line-height: 0;
-  vertical-align: bottom;
-}
-
-.icon-32 {
-  height: 32px;
-  width: 32px;
-}
-
-.icon-facebook {
-  background-position: 0 0;
-}
-
-.icon-twitter {
-  background-position: 0 -32px;
-}
-
-.icon-linkedin {
-  background-position: 0 -64px;
-}
-
-.icon-rss {
-  background-position: 0 -128px;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/layout.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/layout.less
deleted file mode 100644
index 35a7f386..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/layout.less
+++ /dev/null
@@ -1,128 +0,0 @@
-html,
-body {
-  margin: 0;
-  height: 100%;
-  /* The html and body elements cannot have any padding or margin */
-}
-
-/* Wrapper for page content to push down footer */
-.l-wrapper {
-  min-height: 100%;
-  height: auto !important;
-  height: 100%;
-  /* Negative indent footer by it's height */
-  margin: 0 auto (-1 * @footer-height);
-}
-
-.l-constrained {
-  margin: 0 auto;
-  padding-left: 20px;
-  padding-right: 20px;
-  max-width: 1200px;
-  min-width: 800px;
-}
-
-.l-header {
-  border-top: solid 10px @black;
-  border-bottom: 1px solid #d4b33a;
-  background-color: #f0db4f;
-
-  .l-constrained {
-    padding-top: 20px;
-    padding-bottom: 20px;
-    .clearfix();
-  }
-}
-
-.l-content {
-  .clearfix();
-}
-
-.l-main-content {
-  float: left;
-  width: 70%;
-}
-
-.l-sidebar {
-  float: right;
-  width: 30%;
-}
-
-/* Set the fixed height of the footer here */
-.l-push,
-.l-footer {
-  height: @footer-height;
-}
-
-.l-footer {
-  width: 100%;
-  background-color: @black;
-  color: @gray-lighter;
-  font-size: @font-size-small;
-  line-height: 100%;
-
-  .l-constrained {
-    padding-top: (@footer-height - 32) / 2;
-    .clearfix();
-  }
-
-  a {
-    color: @gray-lighter;
-    text-decoration: none;
-
-    &:hover,
-    &:active {
-      text-decoration: underline;
-    }
-  }
-}
-
-
-// Header
-// -------------------------
-
-.logo {
-  margin: 0;
-
-  a {
-    display: block;
-    float: left;
-    width: 100px;
-    height: 100px;
-    background: transparent url("../images/jsengineswitcher-logo.png") no-repeat scroll 0 0;
-    text-indent: -9999em;
-  }
-}
-
-.primary-nav {
-  position: relative;
-  left: 40px;
-  float: left;
-}
-
-
-// Footer
-// -------------------------
-
-.l-copyright {
-  float: left;
-    p {
-      margin: 0;
-      padding: 0;
-  }
-}
-
-.l-social {
-  float: right;
-
-  li {
-    display: inline;
-    list-style: none outside none;
-    padding-left: 10px;
-
-    a {
-      text-indent: -9999px;
-      outline: none;
-    }
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/mixins.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/mixins.less
deleted file mode 100644
index d26eee79..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/mixins.less
+++ /dev/null
@@ -1,9 +0,0 @@
-//
-// Mixins
-// --------------------------------------------------
-
-// NO Drop shadows
-.no-box-shadow {
-  -webkit-box-shadow: none; // iOS <4.3 & Android <4.1
-          box-shadow: none;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/navbar.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/navbar.less
deleted file mode 100644
index 95edf3c2..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/navbar.less
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Navbars
-// --------------------------------------------------
-
-
-// Wrapper and base class
-//
-// Provide a static navbar from which we expand to create full-width, fixed, and
-// other navbar variations.
-
-.navbar {
-  border: none;
-  border-radius: 0;
-}
-
-// Navbar nav links
-//
-// Builds on top of the `.nav` components with it's own modifier class to make
-// the nav the full height of the horizontal nav (above 768px).
-
-.navbar-nav {
-  float: left;
-  margin: 0 auto;
-
-  > li {
-    > a {
-      float: none;
-      // Vertically center the text given @navbar-height
-      padding: ((@navbar-height - @line-height-computed) / 2) 15px ((@navbar-height - @line-height-computed) / 2);
-      border: 1px solid transparent;
-      font-family: "Open Sans", sans-serif;
-      font-size: 2.0em;
-      text-decoration: none;
-      text-transform: uppercase;
-      outline: none;
-    }
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/page-socials.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/page-socials.less
deleted file mode 100644
index ea12dc09..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/page-socials.less
+++ /dev/null
@@ -1,14 +0,0 @@
-.page-socials {
-  min-height: 60px;
-  margin-top: 20px;
-  padding-top: 15px;
-  border-top: 1px solid #b2b2b2;
-}
-
-.share-buttons {
-  li {
-    margin-right: 15px;
-    vertical-align: top;
-    line-height: normal;
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/type.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/type.less
deleted file mode 100644
index 02d69502..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/type.less
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Typography
-// --------------------------------------------------
-
-// Headings
-// -------------------------
-
-h1, h2, h3 {
-  margin-top: 10px;
-}
-
-h1, h2 {
-  line-height: 40px;
-}
-
-h2 {
-  color: @black;
-  font-weight: bold;
-}
-
-h3 {
-  color: @gray-dark;
-  line-height: @line-height-computed * 1.25;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/variables.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/variables.less
deleted file mode 100644
index 498c9796..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore5.Mvc5/wwwroot/styles/variables.less
+++ /dev/null
@@ -1,7 +0,0 @@
-// Colors
-// -------------------------
-@black:                 #1d0d0d;
-
-// Footer
-// -------------------------
-@footer-height:                    55px;
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/.bowerrc b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/.bowerrc
deleted file mode 100644
index ea81a597..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/.bowerrc
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "registry": "https://registry.bower.io",
-  "directory": "wwwroot/lib"
-}
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Infrastructure/Helpers/CommonExtensions.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Infrastructure/Helpers/CommonExtensions.cs
deleted file mode 100644
index 6203fe87..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Infrastructure/Helpers/CommonExtensions.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.Text.RegularExpressions;
-
-using Microsoft.AspNetCore.Html;
-using Microsoft.AspNetCore.Mvc.Rendering;
-
-namespace JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6.Infrastructure.Helpers
-{
-	public static class CommonExtensions
-	{
-		public static HtmlString EncodedReplace(this IHtmlHelper htmlHelper, string input,
-			string pattern, string replacement)
-		{
-			return new HtmlString(Regex.Replace(htmlHelper.Encode(input), pattern, replacement));
-		}
-	}
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Infrastructure/TagHelpers/ConditionalCommentType.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Infrastructure/TagHelpers/ConditionalCommentType.cs
deleted file mode 100644
index aa2b8eca..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Infrastructure/TagHelpers/ConditionalCommentType.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6.Infrastructure.TagHelpers
-{
-	public enum ConditionalCommentType
-	{
-		Hidden,
-		Revealed,
-		RevealedValidating,
-		RevealedValidatingSimplified
-	}
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6.csproj
index 3d7f6737..726386ed 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6.csproj
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6.csproj
@@ -2,32 +2,35 @@
 
   
     JS Engine Switcher: Sample ASP.NET Core 6.0 MVC 6 Site
-    3.19.0
+    3.30.2
     net6.0
     enable
     Exe
     true
+    $(NoWarn);NETSDK1138
+    true
     true
+    true
     false
   
 
   
 
   
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
 
     
     
@@ -36,27 +39,13 @@
     
     
     
+    
     
     
     
+    
   
 
-  
-    
-  
-  
-    
-  
-  
-    
-  
-  
-    
-  
-  
-    
-    
-    
-  
+  
 
 
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Program.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Program.cs
index 337ca26e..2e472860 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Program.cs
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Program.cs
@@ -11,8 +11,15 @@
 using JavaScriptEngineSwitcher.Sample.Logic.Services;
 using JavaScriptEngineSwitcher.V8;
 using JavaScriptEngineSwitcher.Vroom;
+using JavaScriptEngineSwitcher.Yantra;
 
-var builder = WebApplication.CreateBuilder(args);
+var builder = WebApplication.CreateBuilder(new WebApplicationOptions()
+{
+	WebRootPath = Path.Combine(
+		Directory.GetCurrentDirectory(),
+		"../JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot"
+	)
+});
 var env = builder.Environment;
 var configuration = new ConfigurationBuilder()
 	.SetBasePath(env.ContentRootPath)
@@ -33,8 +40,10 @@
 
 // Add JavaScriptEngineSwitcher services to the services container.
 services.AddJsEngineSwitcher(options =>
-	options.DefaultEngineName = ChakraCoreJsEngine.EngineName
-)
+{
+	options.AllowCurrentProperty = false;
+	options.DefaultEngineName = ChakraCoreJsEngine.EngineName;
+})
 	.AddChakraCore()
 	.AddJint()
 	.AddJurassic()
@@ -46,6 +55,7 @@
 	.AddNode(services)
 	.AddV8()
 	.AddVroom()
+	.AddYantra()
 	;
 
 services.Configure(options =>
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/Home/Contact.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/Home/Contact.cshtml
index cd9663df..58785ebe 100644
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/Home/Contact.cshtml
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/Home/Contact.cshtml
@@ -5,19 +5,4 @@
 

@ViewBag.Title

@ViewBag.Body -
- -@section Scripts { - -} \ No newline at end of file + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/Shared/_JsEvaluationErrorList.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/Shared/_JsEvaluationErrorList.cshtml index a8f2a202..9e0601d6 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/Shared/_JsEvaluationErrorList.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/Shared/_JsEvaluationErrorList.cshtml @@ -1,4 +1,4 @@ -@using JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6.Infrastructure.Helpers +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.Helpers @using JavaScriptEngineSwitcher.Sample.Logic.Models @model IList diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/Shared/_Layout.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/Shared/_Layout.cshtml index 1edcbebc..b1f433fd 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/Shared/_Layout.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/Shared/_Layout.cshtml @@ -1,4 +1,4 @@ -@using JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6.Infrastructure.TagHelpers +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.TagHelpers @@ -61,9 +61,10 @@ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/_ViewImports.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/_ViewImports.cshtml index 6a3fbed1..8fe8384e 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/_ViewImports.cshtml +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/Views/_ViewImports.cshtml @@ -1,2 +1,2 @@ @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" -@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6" \ No newline at end of file +@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure" \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/bower.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/bower.json deleted file mode 100644 index 992994cf..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/bower.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "jsengineswitcher.sample.aspnetcore6.mvc6", - "dependencies": { - "modernizr": "2.8.3", - "jquery-compat": "jquery#1.10.2", - "jquery": "jquery#2.0.3", - "jquery-validation": "1.13.1", - "jquery-validation-unobtrusive": "3.2.3", - "bootstrap": "3.3.0" - } -} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/gulpfile.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/gulpfile.js deleted file mode 100644 index 0f259437..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/gulpfile.js +++ /dev/null @@ -1,130 +0,0 @@ -/*global require, exports */ -/*jshint esversion: 6 */ -const WEB_ROOT_PATH = "wwwroot"; -const BOWER_DIR_PATH = WEB_ROOT_PATH + "/lib"; -const STYLE_DIR_PATH = WEB_ROOT_PATH + '/styles'; -const SCRIPT_DIR_PATH = WEB_ROOT_PATH + '/scripts'; - -// include plug-ins -let { src, dest, series, parallel, watch } = require('gulp'); -let del = require('del'); -let sourcemaps = require('gulp-sourcemaps'); -let rename = require('gulp-rename'); -let concat = require('gulp-concat'); -let less = require('gulp-less'); -let autoprefixer = require('gulp-autoprefixer'); -let cleanCss = require('gulp-clean-css'); -let uglify = require('gulp-uglify'); - -//#region Clean -//#region Clean builded assets -function cleanBuildedStyles() { - return del([STYLE_DIR_PATH + '/build/*']); -} - -function cleanBuildedScripts() { - return del([SCRIPT_DIR_PATH + '/build/*']); -} - -let cleanBuildedAssets = parallel(cleanBuildedStyles, cleanBuildedScripts); -//#endregion -//#endregion - -//#region Build assets -//#region Build styles -let autoprefixerOptions = { - overrideBrowserslist: ['> 1%', 'last 3 versions', 'Firefox ESR', 'Opera 12.1'], - cascade: true -}; -let cssCleanOptions = { specialComments: '*' }; -let cssRenameOptions = { extname: '.min.css' }; - -function buildCommonStyles() { - return src([STYLE_DIR_PATH + '/app.less']) - .pipe(sourcemaps.init()) - .pipe(less({ - relativeUrls: true, - rootpath: '/styles/' - })) - .pipe(autoprefixer(autoprefixerOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(STYLE_DIR_PATH + '/build')) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(concat('common-styles.css')) - .pipe(cleanCss(cssCleanOptions)) - .pipe(rename(cssRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(STYLE_DIR_PATH + '/build')) - ; -} - -let buildStyles = buildCommonStyles; -//#endregion - -//#region Build scripts -let jsConcatOptions = { newLine: ';' }; -let jsUglifyOptions = { - output: { comments: /^!/ } -}; -let jsRenameOptions = { extname: '.min.js' }; - -function buildModernizrScripts() { - return src([BOWER_DIR_PATH + '/modernizr/modernizr.js']) - .pipe(sourcemaps.init()) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -function buildCommonScripts() { - return src([SCRIPT_DIR_PATH + '/common.js']) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(rename({ basename: 'common-scripts' })) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -function buildEvaluationFormScripts() { - return src([BOWER_DIR_PATH + '/jquery-validation/dist/jquery.validate.js', - BOWER_DIR_PATH + '/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js', - BOWER_DIR_PATH + '/bootstrap/js/button.js', - SCRIPT_DIR_PATH + '/evaluation-form.js']) - .pipe(sourcemaps.init({ loadMaps: true })) - .pipe(concat('evaluation-form-scripts.js', jsConcatOptions)) - .pipe(uglify(jsUglifyOptions)) - .pipe(rename(jsRenameOptions)) - .pipe(sourcemaps.write('./')) - .pipe(dest(SCRIPT_DIR_PATH + '/build')) - ; -} - -let buildScripts = parallel(buildModernizrScripts, buildCommonScripts, buildEvaluationFormScripts); -//#endregion - -let buildAssets = parallel(buildStyles, buildScripts); -//#endregion - -//#region Watch assets -function watchStyles() { - return watch([STYLE_DIR_PATH + '/**/*.{less,css}', '!' + STYLE_DIR_PATH + '/build/**/*.*'], - buildStyles); -} - -function watchScripts() { - return watch([SCRIPT_DIR_PATH + '/**/*.js', '!' + SCRIPT_DIR_PATH + '/build/**/*.*'], - buildScripts); -} - -let watchAssets = parallel(watchStyles, watchScripts); -//#endregion - -// Export tasks -exports.cleanBuildedAssets = cleanBuildedAssets; -exports.buildAssets = buildAssets; -exports.watchAssets = watchAssets; -exports.default = series(cleanBuildedAssets, buildAssets); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/package.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/package.json deleted file mode 100644 index 41a4abbf..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "javascriptengineswitcher.sample.aspnetcore6.mvc6", - "private": true, - "version": "3.19.0", - "devDependencies": { - "gulp": "4.0.2", - "del": "5.1.0", - "gulp-sourcemaps": "2.6.5", - "gulp-rename": "2.0.0", - "gulp-concat": "2.6.1", - "gulp-less": "4.0.1", - "gulp-autoprefixer": "7.0.1", - "gulp-clean-css": "4.2.0", - "gulp-uglify": "3.0.2" - } -} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/0.gif b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/0.gif deleted file mode 100644 index 35d42e80..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/0.gif and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/clear-text.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/clear-text.png deleted file mode 100644 index 9d217b7f..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/clear-text.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/icons/32x32/social-media-icons-32.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/icons/32x32/social-media-icons-32.png deleted file mode 100644 index 49aa1fe3..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/icons/32x32/social-media-icons-32.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/icons/48x48/error.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/icons/48x48/error.png deleted file mode 100644 index 3d6185f7..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/icons/48x48/error.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/jsengineswitcher-logo.png b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/jsengineswitcher-logo.png deleted file mode 100644 index 12ed97e0..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/images/jsengineswitcher-logo.png and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/scripts/_references.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/scripts/_references.js deleted file mode 100644 index 2b54eea8..00000000 Binary files a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/scripts/_references.js and /dev/null differ diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/scripts/common.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/scripts/common.js deleted file mode 100644 index c94bf102..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/scripts/common.js +++ /dev/null @@ -1,29 +0,0 @@ -var jsEngineSwitcher; - -(function (jsEngineSwitcher, undefined) { - "use strict"; - - jsEngineSwitcher.registerNamespace = function (namespaceString) { - var parts = namespaceString.split("."), - parent = jsEngineSwitcher, - i - ; - - if (parts[0] === "jsEngineSwitcher") { - parts = parts.slice(1); - } - - for (i = 0; i < parts.length; i += 1) { - if (typeof parent[parts[i]] === "undefined") { - parent[parts[i]] = {}; - } - parent = parent[parts[i]]; - } - - return parent; - }; - - jsEngineSwitcher.hasScrollbar = function(elem) { - return (elem.clientHeight < elem.scrollHeight); - }; -}(jsEngineSwitcher = jsEngineSwitcher || {})); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/scripts/evaluation-form.js b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/scripts/evaluation-form.js deleted file mode 100644 index da1f0199..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/scripts/evaluation-form.js +++ /dev/null @@ -1,83 +0,0 @@ -(function (jsEngineSwitcher, $, undefined) { - "use strict"; - - var $evaluationForm, - $evaluationInputField, - $evaluationInputClearButton, - $evaluateButton - ; - - $(function () { - $evaluationForm = $("form[data-form-type='evaluation-form']"); - $evaluationInputField = $(":input[data-control-type='evaluation-input-field']", $evaluationForm); - $evaluationInputClearButton = $("
"); - $evaluateButton = $(":input[data-control-type='evaluate-button']", $evaluationForm); - - $evaluationForm.on("submit", onEvaluationFormSubmitHandler); - - $evaluationInputClearButton.on("click", onEvaluationInputClearButtonClickHandler); - $evaluationInputField.parent().append($evaluationInputClearButton); - refreshEvaluationInputClearButton(); - $evaluationInputField - .on("input propertychange keydown keyup paste", onEvaluationInputFieldChangeHandler) - ; - - $evaluateButton.removeAttr("disabled"); - }); - - $(window).unload(function() { - $evaluationForm.off("submit", onEvaluationFormSubmitHandler); - - $evaluationInputClearButton - .off("click", onEvaluationInputClearButtonClickHandler) - .remove() - ; - - $evaluationInputField - .off("input propertychange keydown keyup paste", onEvaluationInputFieldChangeHandler) - ; - - $evaluationForm = null; - $evaluationInputField = null; - $evaluationInputClearButton = null; - $evaluateButton = null; - }); - - var refreshEvaluationInputClearButton = function() { - if ($.trim($evaluationInputField.val()).length > 0) { - $evaluationInputClearButton.show(); - } else { - $evaluationInputClearButton.hide(); - } - - if (jsEngineSwitcher.hasScrollbar($evaluationInputField.get(0))) { - $evaluationInputClearButton.addClass("with-scrollbar"); - } - else { - $evaluationInputClearButton.removeClass("with-scrollbar"); - } - }; - - var onEvaluationFormSubmitHandler = function () { - var $form = $(this); - if ($form.valid()) { - $evaluateButton.attr("disabled", "disabled"); - $("textarea[data-control-type='evaluation-output-field']", $form).val(''); - - return true; - } - - return false; - }; - - var onEvaluationInputFieldChangeHandler = function () { - refreshEvaluationInputClearButton(); - }; - - var onEvaluationInputClearButtonClickHandler = function() { - $evaluationInputField.val(""); - - var $button = $(this); - $button.hide(); - }; -}(jsEngineSwitcher, jQuery)); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/app.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/app.less deleted file mode 100644 index c41a9315..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/app.less +++ /dev/null @@ -1,71 +0,0 @@ -/*! - * Bootstrap v3.3.0 (http://getbootstrap.com) - * Copyright 2011-2014 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ - -// Core variables and mixins -@import "bootstrap-custom-variables.less"; -@import "../lib/bootstrap/less/mixins.less"; - -// Reset -@import "../lib/bootstrap/less/normalize.less"; -//@import "../lib/bootstrap/less/print.less"; -//@import "../lib/bootstrap/less/glyphicons.less"; - -// Core CSS -@import "../lib/bootstrap/less/scaffolding.less"; -@import "../lib/bootstrap/less/type.less"; -@import "../lib/bootstrap/less/code.less"; -//@import "../lib/bootstrap/less/grid.less"; -//@import "../lib/bootstrap/less/tables.less"; -@import "../lib/bootstrap/less/forms.less"; -//@import "../lib/bootstrap/less/buttons.less"; - -// Components -//@import "../lib/bootstrap/less/component-animations.less"; -//@import "../lib/bootstrap/less/dropdowns.less"; -//@import "../lib/bootstrap/less/button-groups.less"; -//@import "../lib/bootstrap/less/input-groups.less"; -@import "../lib/bootstrap/less/navs.less"; -@import "../lib/bootstrap/less/navbar.less"; -//@import "../lib/bootstrap/less/breadcrumbs.less"; -//@import "../lib/bootstrap/less/pagination.less"; -//@import "../lib/bootstrap/less/pager.less"; -//@import "../lib/bootstrap/less/labels.less"; -//@import "../lib/bootstrap/less/badges.less"; -//@import "../lib/bootstrap/less/jumbotron.less"; -//@import "../lib/bootstrap/less/thumbnails.less"; -//@import "../lib/bootstrap/less/alerts.less"; -//@import "../lib/bootstrap/less/progress-bars.less"; -//@import "../lib/bootstrap/less/media.less"; -//@import "../lib/bootstrap/less/list-group.less"; -//@import "../lib/bootstrap/less/panels.less"; -//@import "../lib/bootstrap/less/responsive-embed.less"; -//@import "../lib/bootstrap/less/wells.less"; -//@import "../lib/bootstrap/less/close.less"; - -// Components w/ JavaScript -//@import "../lib/bootstrap/less/modals.less"; -//@import "../lib/bootstrap/less/tooltip.less"; -//@import "../lib/bootstrap/less/popovers.less"; -//@import "../lib/bootstrap/less/carousel.less"; - -// Utility classes -@import "../lib/bootstrap/less/utilities.less"; -//@import "../lib/bootstrap/less/responsive-utilities.less"; - -// JavaScriptEngineSwitcher specs -@import "variables.less"; -@import "mixins.less"; - -@import "type.less"; -@import "code.less"; -@import "forms.less"; -@import "buttons.less"; -@import "icons.less"; -@import "navbar.less"; - -@import "layout.less"; -@import "evaluation-form.less"; -@import "page-socials.less"; \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/bootstrap-custom-variables.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/bootstrap-custom-variables.less deleted file mode 100644 index 0be2aa6f..00000000 --- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/bootstrap-custom-variables.less +++ /dev/null @@ -1,856 +0,0 @@ -// -// Variables -// -------------------------------------------------- - - -//== Colors -// -//## Gray and brand colors for use across Bootstrap. - -@gray-base: #323330; -@gray-darker: lighten(@gray-base, 13.5%); // #222 -@gray-dark: lighten(@gray-base, 20%); // #333 -@gray: lighten(@gray-base, 33.5%); // #555 -@gray-light: lighten(@gray-base, 46.7%); // #777 -@gray-lighter: #e3e3e3; - -@brand-primary: #428bca; -@brand-success: #5cb85c; -@brand-info: #5bc0de; -@brand-warning: #f0ad4e; -@brand-danger: #d9534f; - - -//== Scaffolding -// -//## Settings for some of the most global styles. - -//** Background color for ``. -@body-bg: #fff; -//** Global text color on ``. -@text-color: #1d0d0d; - -//** Global textual link color. -@link-color: @brand-primary; -//** Link hover color set via `darken()` function. -@link-hover-color: darken(@link-color, 15%); -//** Link hover decoration. -@link-hover-decoration: underline; - - -//== Typography -// -//## Font, line-height, and color for body text, headings, and more. - -@font-family-sans-serif: "Helvetica Neue", Arial, sans-serif; -@font-family-serif: Georgia, "Times New Roman", Times, serif; -//** Default monospace fonts for ``, ``, and `
`.
-@font-family-monospace:   Consolas, "Courier New", monospace;
-@font-family-base:        @font-family-sans-serif;
-
-@font-size-base:          14px;
-@font-size-large:         ceil((@font-size-base * 1.25)); // ~18px
-@font-size-small:         ceil((@font-size-base * 0.85)); // ~12px
-
-@font-size-h1:            floor(@font-size-base * 3);
-@font-size-h2:            @font-size-base * 2.5;
-@font-size-h3:            ceil(@font-size-base * 1.75);
-@font-size-h4:            ceil(@font-size-base * 1.25);
-@font-size-h5:            @font-size-base;
-@font-size-h6:            ceil(@font-size-base * 0.85);
-
-//** Unit-less `line-height` for use in components like buttons.
-@line-height-base:        1.428571429; // 20/14
-//** Computed "line-height" (`font-size` * `line-height`) for use with `margin`, `padding`, etc.
-@line-height-computed:    floor((@font-size-base * @line-height-base)); // ~20px
-
-//** By default, this inherits from the ``.
-@headings-font-family:    "Open Sans", sans-serif;
-@headings-font-weight:    normal;
-@headings-line-height:    1.1;
-@headings-color:          inherit;
-
-
-//== Iconography
-//
-//## Specify custom location and filename of the included Glyphicons icon font. Useful for those including Bootstrap via Bower.
-
-//** Load fonts from this directory.
-@icon-font-path:          "../fonts/";
-//** File name for all font files.
-@icon-font-name:          "glyphicons-halflings-regular";
-//** Element ID within SVG icon file.
-@icon-font-svg-id:        "glyphicons_halflingsregular";
-
-
-//== Components
-//
-//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start).
-
-@padding-base-vertical:     4px;
-@padding-base-horizontal:   6px;
-
-@padding-large-vertical:    10px;
-@padding-large-horizontal:  16px;
-
-@padding-small-vertical:    5px;
-@padding-small-horizontal:  10px;
-
-@padding-xs-vertical:       1px;
-@padding-xs-horizontal:     5px;
-
-@line-height-large:         1.33;
-@line-height-small:         1.5;
-
-@border-radius-base:        4px;
-@border-radius-large:       6px;
-@border-radius-small:       3px;
-
-//** Global color for active items (e.g., navs or dropdowns).
-@component-active-color:    #fff;
-//** Global background color for active items (e.g., navs or dropdowns).
-@component-active-bg:       @brand-primary;
-
-//** Width of the `border` for generating carets that indicator dropdowns.
-@caret-width-base:          4px;
-//** Carets increase slightly in size for larger components.
-@caret-width-large:         5px;
-
-
-//== Tables
-//
-//## Customizes the `.table` component with basic values, each used across all table variations.
-
-//** Padding for ``s and ``s.
-@table-cell-padding:            8px;
-//** Padding for cells in `.table-condensed`.
-@table-condensed-cell-padding:  5px;
-
-//** Default background color used for all tables.
-@table-bg:                      transparent;
-//** Background color used for `.table-striped`.
-@table-bg-accent:               #f9f9f9;
-//** Background color used for `.table-hover`.
-@table-bg-hover:                #f5f5f5;
-@table-bg-active:               @table-bg-hover;
-
-//** Border color for table and cell borders.
-@table-border-color:            #ddd;
-
-
-//== Buttons
-//
-//## For each of Bootstrap's buttons, define text, background and border color.
-
-@btn-font-weight:                normal;
-
-@btn-default-color:              #333;
-@btn-default-bg:                 @gray-lighter;
-@btn-default-border:             @gray-lighter;
-
-@btn-primary-color:              #fff;
-@btn-primary-bg:                 @brand-primary;
-@btn-primary-border:             darken(@btn-primary-bg, 5%);
-
-@btn-success-color:              #fff;
-@btn-success-bg:                 @brand-success;
-@btn-success-border:             darken(@btn-success-bg, 5%);
-
-@btn-info-color:                 #fff;
-@btn-info-bg:                    @brand-info;
-@btn-info-border:                darken(@btn-info-bg, 5%);
-
-@btn-warning-color:              #fff;
-@btn-warning-bg:                 @brand-warning;
-@btn-warning-border:             darken(@btn-warning-bg, 5%);
-
-@btn-danger-color:               #fff;
-@btn-danger-bg:                  @brand-danger;
-@btn-danger-border:              darken(@btn-danger-bg, 5%);
-
-@btn-link-disabled-color:        @gray-light;
-
-
-//== Forms
-//
-//##
-
-//** `` background color
-@input-bg:                       #fff;
-//** `` background color
-@input-bg-disabled:              @gray-lighter;
-
-//** Text color for ``s
-@input-color:                    @gray;
-//** `` border color
-@input-border:                   #b2b2b2;
-
-// TODO: Rename `@input-border-radius` to `@input-border-radius-base` in v4
-//** Default `.form-control` border radius
-@input-border-radius:            @border-radius-base;
-//** Large `.form-control` border radius
-@input-border-radius-large:      @border-radius-large;
-//** Small `.form-control` border radius
-@input-border-radius-small:      @border-radius-small;
-
-//** Border color for inputs on focus
-@input-border-focus:             #d4b33a;
-
-//** Placeholder text color
-@input-color-placeholder:        #999;
-
-//** Default `.form-control` height
-@input-height-base:              (@line-height-computed + (@padding-base-vertical * 2) + 2);
-//** Large `.form-control` height
-@input-height-large:             (ceil(@font-size-large * @line-height-large) + (@padding-large-vertical * 2) + 2);
-//** Small `.form-control` height
-@input-height-small:             (floor(@font-size-small * @line-height-small) + (@padding-small-vertical * 2) + 2);
-
-@legend-color:                   @gray-dark;
-@legend-border-color:            #e5e5e5;
-
-//** Background color for textual input addons
-@input-group-addon-bg:           @gray-lighter;
-//** Border color for textual input addons
-@input-group-addon-border-color: @input-border;
-
-//** Disabled cursor for form controls and buttons.
-@cursor-disabled:                not-allowed;
-
-
-//== Dropdowns
-//
-//## Dropdown menu container and contents.
-
-//** Background for the dropdown menu.
-@dropdown-bg:                    #fff;
-//** Dropdown menu `border-color`.
-@dropdown-border:                rgba(0,0,0,.15);
-//** Dropdown menu `border-color` **for IE8**.
-@dropdown-fallback-border:       #ccc;
-//** Divider color for between dropdown items.
-@dropdown-divider-bg:            #e5e5e5;
-
-//** Dropdown link text color.
-@dropdown-link-color:            @gray-dark;
-//** Hover color for dropdown links.
-@dropdown-link-hover-color:      darken(@gray-dark, 5%);
-//** Hover background for dropdown links.
-@dropdown-link-hover-bg:         #f5f5f5;
-
-//** Active dropdown menu item text color.
-@dropdown-link-active-color:     @component-active-color;
-//** Active dropdown menu item background color.
-@dropdown-link-active-bg:        @component-active-bg;
-
-//** Disabled dropdown menu item background color.
-@dropdown-link-disabled-color:   @gray-light;
-
-//** Text color for headers within dropdown menus.
-@dropdown-header-color:          @gray-light;
-
-//** Deprecated `@dropdown-caret-color` as of v3.1.0
-@dropdown-caret-color:           #000;
-
-
-//-- Z-index master list
-//
-// Warning: Avoid customizing these values. They're used for a bird's eye view
-// of components dependent on the z-axis and are designed to all work together.
-//
-// Note: These variables are not generated into the Customizer.
-
-@zindex-navbar:            1000;
-@zindex-dropdown:          1000;
-@zindex-popover:           1060;
-@zindex-tooltip:           1070;
-@zindex-navbar-fixed:      1030;
-@zindex-modal:             1040;
-
-
-//== Media queries breakpoints
-//
-//## Define the breakpoints at which your layout will change, adapting to different screen sizes.
-
-// Extra small screen / phone
-//** Deprecated `@screen-xs` as of v3.0.1
-@screen-xs:                  480px;
-//** Deprecated `@screen-xs-min` as of v3.2.0
-@screen-xs-min:              @screen-xs;
-//** Deprecated `@screen-phone` as of v3.0.1
-@screen-phone:               @screen-xs-min;
-
-// Small screen / tablet
-//** Deprecated `@screen-sm` as of v3.0.1
-@screen-sm:                  768px;
-@screen-sm-min:              @screen-sm;
-//** Deprecated `@screen-tablet` as of v3.0.1
-@screen-tablet:              @screen-sm-min;
-
-// Medium screen / desktop
-//** Deprecated `@screen-md` as of v3.0.1
-@screen-md:                  992px;
-@screen-md-min:              @screen-md;
-//** Deprecated `@screen-desktop` as of v3.0.1
-@screen-desktop:             @screen-md-min;
-
-// Large screen / wide desktop
-//** Deprecated `@screen-lg` as of v3.0.1
-@screen-lg:                  1200px;
-@screen-lg-min:              @screen-lg;
-//** Deprecated `@screen-lg-desktop` as of v3.0.1
-@screen-lg-desktop:          @screen-lg-min;
-
-// So media queries don't overlap when required, provide a maximum
-@screen-xs-max:              (@screen-sm-min - 1);
-@screen-sm-max:              (@screen-md-min - 1);
-@screen-md-max:              (@screen-lg-min - 1);
-
-
-//== Grid system
-//
-//## Define your custom responsive grid.
-
-//** Number of columns in the grid.
-@grid-columns:              12;
-//** Padding between columns. Gets divided in half for the left and right.
-@grid-gutter-width:         30px;
-// Navbar collapse
-//** Point at which the navbar becomes uncollapsed.
-@grid-float-breakpoint:     @screen-sm-min;
-//** Point at which the navbar begins collapsing.
-@grid-float-breakpoint-max: (@grid-float-breakpoint - 1);
-
-
-//== Container sizes
-//
-//## Define the maximum width of `.container` for different screen sizes.
-
-// Small screen / tablet
-@container-tablet:             (720px + @grid-gutter-width);
-//** For `@screen-sm-min` and up.
-@container-sm:                 @container-tablet;
-
-// Medium screen / desktop
-@container-desktop:            (940px + @grid-gutter-width);
-//** For `@screen-md-min` and up.
-@container-md:                 @container-desktop;
-
-// Large screen / wide desktop
-@container-large-desktop:      (1140px + @grid-gutter-width);
-//** For `@screen-lg-min` and up.
-@container-lg:                 @container-large-desktop;
-
-
-//== Navbar
-//
-//##
-
-// Basics of a navbar
-@navbar-height:                    100px;
-@navbar-margin-bottom:             0;
-@navbar-border-radius:             @border-radius-base;
-@navbar-padding-horizontal:        0;
-@navbar-padding-vertical:          ((@navbar-height - @line-height-computed) / 2);
-@navbar-collapse-max-height:       340px;
-
-@navbar-default-color:             @gray-base;
-@navbar-default-bg:                #f0db4f;
-@navbar-default-border:            #f0db4f;
-
-// Navbar links
-@navbar-default-link-color:                @navbar-default-color;
-@navbar-default-link-hover-color:          @gray-dark;
-@navbar-default-link-hover-bg:             transparent;
-@navbar-default-link-active-color:         @navbar-default-color;
-@navbar-default-link-active-bg:            transparent;
-@navbar-default-link-disabled-color:       #ccc;
-@navbar-default-link-disabled-bg:          transparent;
-
-// Navbar brand label
-@navbar-default-brand-color:               @navbar-default-link-color;
-@navbar-default-brand-hover-color:         darken(@navbar-default-brand-color, 10%);
-@navbar-default-brand-hover-bg:            transparent;
-
-// Navbar toggle
-@navbar-default-toggle-hover-bg:           #ddd;
-@navbar-default-toggle-icon-bar-bg:        @gray-dark;
-@navbar-default-toggle-border-color:       #ddd;
-
-
-// Inverted navbar
-// Reset inverted navbar basics
-@navbar-inverse-color:                      lighten(@gray-light, 15%);
-@navbar-inverse-bg:                         #222;
-@navbar-inverse-border:                     darken(@navbar-inverse-bg, 10%);
-
-// Inverted navbar links
-@navbar-inverse-link-color:                 lighten(@gray-light, 15%);
-@navbar-inverse-link-hover-color:           #fff;
-@navbar-inverse-link-hover-bg:              transparent;
-@navbar-inverse-link-active-color:          @navbar-inverse-link-hover-color;
-@navbar-inverse-link-active-bg:             darken(@navbar-inverse-bg, 10%);
-@navbar-inverse-link-disabled-color:        #444;
-@navbar-inverse-link-disabled-bg:           transparent;
-
-// Inverted navbar brand label
-@navbar-inverse-brand-color:                @navbar-inverse-link-color;
-@navbar-inverse-brand-hover-color:          #fff;
-@navbar-inverse-brand-hover-bg:             transparent;
-
-// Inverted navbar toggle
-@navbar-inverse-toggle-hover-bg:            #333;
-@navbar-inverse-toggle-icon-bar-bg:         #fff;
-@navbar-inverse-toggle-border-color:        #333;
-
-
-//== Navs
-//
-//##
-
-//=== Shared nav styles
-@nav-link-padding:                          10px 15px;
-@nav-link-hover-bg:                         @gray-lighter;
-
-@nav-disabled-link-color:                   @gray-light;
-@nav-disabled-link-hover-color:             @gray-light;
-
-//== Tabs
-@nav-tabs-border-color:                     #ddd;
-
-@nav-tabs-link-hover-border-color:          @gray-lighter;
-
-@nav-tabs-active-link-hover-bg:             @body-bg;
-@nav-tabs-active-link-hover-color:          @gray;
-@nav-tabs-active-link-hover-border-color:   #ddd;
-
-@nav-tabs-justified-link-border-color:            #ddd;
-@nav-tabs-justified-active-link-border-color:     @body-bg;
-
-//== Pills
-@nav-pills-border-radius:                   @border-radius-base;
-@nav-pills-active-link-hover-bg:            @component-active-bg;
-@nav-pills-active-link-hover-color:         @component-active-color;
-
-
-//== Pagination
-//
-//##
-
-@pagination-color:                     @link-color;
-@pagination-bg:                        #fff;
-@pagination-border:                    #ddd;
-
-@pagination-hover-color:               @link-hover-color;
-@pagination-hover-bg:                  @gray-lighter;
-@pagination-hover-border:              #ddd;
-
-@pagination-active-color:              #fff;
-@pagination-active-bg:                 @brand-primary;
-@pagination-active-border:             @brand-primary;
-
-@pagination-disabled-color:            @gray-light;
-@pagination-disabled-bg:               #fff;
-@pagination-disabled-border:           #ddd;
-
-
-//== Pager
-//
-//##
-
-@pager-bg:                             @pagination-bg;
-@pager-border:                         @pagination-border;
-@pager-border-radius:                  15px;
-
-@pager-hover-bg:                       @pagination-hover-bg;
-
-@pager-active-bg:                      @pagination-active-bg;
-@pager-active-color:                   @pagination-active-color;
-
-@pager-disabled-color:                 @pagination-disabled-color;
-
-
-//== Jumbotron
-//
-//##
-
-@jumbotron-padding:              30px;
-@jumbotron-color:                inherit;
-@jumbotron-bg:                   @gray-lighter;
-@jumbotron-heading-color:        inherit;
-@jumbotron-font-size:            ceil((@font-size-base * 1.5));
-
-
-//== Form states and alerts
-//
-//## Define colors for form feedback states and, by default, alerts.
-
-@state-success-text:             #3c763d;
-@state-success-bg:               #dff0d8;
-@state-success-border:           darken(spin(@state-success-bg, -10), 5%);
-
-@state-info-text:                #31708f;
-@state-info-bg:                  #d9edf7;
-@state-info-border:              darken(spin(@state-info-bg, -10), 7%);
-
-@state-warning-text:             #8a6d3b;
-@state-warning-bg:               #fcf8e3;
-@state-warning-border:           darken(spin(@state-warning-bg, -10), 5%);
-
-@state-danger-text:              #a94442;
-@state-danger-bg:                #f2dede;
-@state-danger-border:            darken(spin(@state-danger-bg, -10), 5%);
-
-
-//== Tooltips
-//
-//##
-
-//** Tooltip max width
-@tooltip-max-width:           200px;
-//** Tooltip text color
-@tooltip-color:               #fff;
-//** Tooltip background color
-@tooltip-bg:                  #000;
-@tooltip-opacity:             .9;
-
-//** Tooltip arrow width
-@tooltip-arrow-width:         5px;
-//** Tooltip arrow color
-@tooltip-arrow-color:         @tooltip-bg;
-
-
-//== Popovers
-//
-//##
-
-//** Popover body background color
-@popover-bg:                          #fff;
-//** Popover maximum width
-@popover-max-width:                   276px;
-//** Popover border color
-@popover-border-color:                rgba(0,0,0,.2);
-//** Popover fallback border color
-@popover-fallback-border-color:       #ccc;
-
-//** Popover title background color
-@popover-title-bg:                    darken(@popover-bg, 3%);
-
-//** Popover arrow width
-@popover-arrow-width:                 10px;
-//** Popover arrow color
-@popover-arrow-color:                 @popover-bg;
-
-//** Popover outer arrow width
-@popover-arrow-outer-width:           (@popover-arrow-width + 1);
-//** Popover outer arrow color
-@popover-arrow-outer-color:           fadein(@popover-border-color, 5%);
-//** Popover outer arrow fallback color
-@popover-arrow-outer-fallback-color:  darken(@popover-fallback-border-color, 20%);
-
-
-//== Labels
-//
-//##
-
-//** Default label background color
-@label-default-bg:            @gray-light;
-//** Primary label background color
-@label-primary-bg:            @brand-primary;
-//** Success label background color
-@label-success-bg:            @brand-success;
-//** Info label background color
-@label-info-bg:               @brand-info;
-//** Warning label background color
-@label-warning-bg:            @brand-warning;
-//** Danger label background color
-@label-danger-bg:             @brand-danger;
-
-//** Default label text color
-@label-color:                 #fff;
-//** Default text color of a linked label
-@label-link-hover-color:      #fff;
-
-
-//== Modals
-//
-//##
-
-//** Padding applied to the modal body
-@modal-inner-padding:         15px;
-
-//** Padding applied to the modal title
-@modal-title-padding:         15px;
-//** Modal title line-height
-@modal-title-line-height:     @line-height-base;
-
-//** Background color of modal content area
-@modal-content-bg:                             #fff;
-//** Modal content border color
-@modal-content-border-color:                   rgba(0,0,0,.2);
-//** Modal content border color **for IE8**
-@modal-content-fallback-border-color:          #999;
-
-//** Modal backdrop background color
-@modal-backdrop-bg:           #000;
-//** Modal backdrop opacity
-@modal-backdrop-opacity:      .5;
-//** Modal header border color
-@modal-header-border-color:   #e5e5e5;
-//** Modal footer border color
-@modal-footer-border-color:   @modal-header-border-color;
-
-@modal-lg:                    900px;
-@modal-md:                    600px;
-@modal-sm:                    300px;
-
-
-//== Alerts
-//
-//## Define alert colors, border radius, and padding.
-
-@alert-padding:               15px;
-@alert-border-radius:         @border-radius-base;
-@alert-link-font-weight:      bold;
-
-@alert-success-bg:            @state-success-bg;
-@alert-success-text:          @state-success-text;
-@alert-success-border:        @state-success-border;
-
-@alert-info-bg:               @state-info-bg;
-@alert-info-text:             @state-info-text;
-@alert-info-border:           @state-info-border;
-
-@alert-warning-bg:            @state-warning-bg;
-@alert-warning-text:          @state-warning-text;
-@alert-warning-border:        @state-warning-border;
-
-@alert-danger-bg:             @state-danger-bg;
-@alert-danger-text:           @state-danger-text;
-@alert-danger-border:         @state-danger-border;
-
-
-//== Progress bars
-//
-//##
-
-//** Background color of the whole progress component
-@progress-bg:                 #f5f5f5;
-//** Progress bar text color
-@progress-bar-color:          #fff;
-//** Variable for setting rounded corners on progress bar.
-@progress-border-radius:      @border-radius-base;
-
-//** Default progress bar color
-@progress-bar-bg:             @brand-primary;
-//** Success progress bar color
-@progress-bar-success-bg:     @brand-success;
-//** Warning progress bar color
-@progress-bar-warning-bg:     @brand-warning;
-//** Danger progress bar color
-@progress-bar-danger-bg:      @brand-danger;
-//** Info progress bar color
-@progress-bar-info-bg:        @brand-info;
-
-
-//== List group
-//
-//##
-
-//** Background color on `.list-group-item`
-@list-group-bg:                 #fff;
-//** `.list-group-item` border color
-@list-group-border:             #ddd;
-//** List group border radius
-@list-group-border-radius:      @border-radius-base;
-
-//** Background color of single list items on hover
-@list-group-hover-bg:           #f5f5f5;
-//** Text color of active list items
-@list-group-active-color:       @component-active-color;
-//** Background color of active list items
-@list-group-active-bg:          @component-active-bg;
-//** Border color of active list elements
-@list-group-active-border:      @list-group-active-bg;
-//** Text color for content within active list items
-@list-group-active-text-color:  lighten(@list-group-active-bg, 40%);
-
-//** Text color of disabled list items
-@list-group-disabled-color:      @gray-light;
-//** Background color of disabled list items
-@list-group-disabled-bg:         @gray-lighter;
-//** Text color for content within disabled list items
-@list-group-disabled-text-color: @list-group-disabled-color;
-
-@list-group-link-color:         #555;
-@list-group-link-hover-color:   @list-group-link-color;
-@list-group-link-heading-color: #333;
-
-
-//== Panels
-//
-//##
-
-@panel-bg:                    #fff;
-@panel-body-padding:          15px;
-@panel-heading-padding:       10px 15px;
-@panel-footer-padding:        @panel-heading-padding;
-@panel-border-radius:         @border-radius-base;
-
-//** Border color for elements within panels
-@panel-inner-border:          #ddd;
-@panel-footer-bg:             #f5f5f5;
-
-@panel-default-text:          @gray-dark;
-@panel-default-border:        #ddd;
-@panel-default-heading-bg:    #f5f5f5;
-
-@panel-primary-text:          #fff;
-@panel-primary-border:        @brand-primary;
-@panel-primary-heading-bg:    @brand-primary;
-
-@panel-success-text:          @state-success-text;
-@panel-success-border:        @state-success-border;
-@panel-success-heading-bg:    @state-success-bg;
-
-@panel-info-text:             @state-info-text;
-@panel-info-border:           @state-info-border;
-@panel-info-heading-bg:       @state-info-bg;
-
-@panel-warning-text:          @state-warning-text;
-@panel-warning-border:        @state-warning-border;
-@panel-warning-heading-bg:    @state-warning-bg;
-
-@panel-danger-text:           @state-danger-text;
-@panel-danger-border:         @state-danger-border;
-@panel-danger-heading-bg:     @state-danger-bg;
-
-
-//== Thumbnails
-//
-//##
-
-//** Padding around the thumbnail image
-@thumbnail-padding:           4px;
-//** Thumbnail background color
-@thumbnail-bg:                @body-bg;
-//** Thumbnail border color
-@thumbnail-border:            #ddd;
-//** Thumbnail border radius
-@thumbnail-border-radius:     @border-radius-base;
-
-//** Custom text color for thumbnail captions
-@thumbnail-caption-color:     @text-color;
-//** Padding around the thumbnail caption
-@thumbnail-caption-padding:   9px;
-
-
-//== Wells
-//
-//##
-
-@well-bg:                     #f5f5f5;
-@well-border:                 darken(@well-bg, 7%);
-
-
-//== Badges
-//
-//##
-
-@badge-color:                 #fff;
-//** Linked badge text color on hover
-@badge-link-hover-color:      #fff;
-@badge-bg:                    @gray-light;
-
-//** Badge text color in active nav link
-@badge-active-color:          @link-color;
-//** Badge background color in active nav link
-@badge-active-bg:             #fff;
-
-@badge-font-weight:           bold;
-@badge-line-height:           1;
-@badge-border-radius:         10px;
-
-
-//== Breadcrumbs
-//
-//##
-
-@breadcrumb-padding-vertical:   8px;
-@breadcrumb-padding-horizontal: 15px;
-//** Breadcrumb background color
-@breadcrumb-bg:                 #f5f5f5;
-//** Breadcrumb text color
-@breadcrumb-color:              #ccc;
-//** Text color of current page in the breadcrumb
-@breadcrumb-active-color:       @gray-light;
-//** Textual separator for between breadcrumb elements
-@breadcrumb-separator:          "/";
-
-
-//== Carousel
-//
-//##
-
-@carousel-text-shadow:                        0 1px 2px rgba(0,0,0,.6);
-
-@carousel-control-color:                      #fff;
-@carousel-control-width:                      15%;
-@carousel-control-opacity:                    .5;
-@carousel-control-font-size:                  20px;
-
-@carousel-indicator-active-bg:                #fff;
-@carousel-indicator-border-color:             #fff;
-
-@carousel-caption-color:                      #fff;
-
-
-//== Close
-//
-//##
-
-@close-font-weight:           bold;
-@close-color:                 #000;
-@close-text-shadow:           0 1px 0 #fff;
-
-
-//== Code
-//
-//##
-
-@code-color:                  #c7254e;
-@code-bg:                     #f9f2f4;
-
-@kbd-color:                   #fff;
-@kbd-bg:                      #333;
-
-@pre-bg:                      #f5f5f5;
-@pre-color:                   @gray-dark;
-@pre-border-color:            #ccc;
-@pre-scrollable-max-height:   340px;
-
-
-//== Type
-//
-//##
-
-//** Horizontal offset for forms and lists.
-@component-offset-horizontal: 180px;
-//** Text muted color
-@text-muted:                  @gray-light;
-//** Abbreviations and acronyms border color
-@abbr-border-color:           @gray-light;
-//** Headings small color
-@headings-small-color:        @gray-light;
-//** Blockquote small color
-@blockquote-small-color:      @gray-light;
-//** Blockquote font size
-@blockquote-font-size:        (@font-size-base * 1.25);
-//** Blockquote border color
-@blockquote-border-color:     @gray-lighter;
-//** Page header border color
-@page-header-border-color:    @gray-lighter;
-//** Width of horizontal description list titles
-@dl-horizontal-offset:        @component-offset-horizontal;
-//** Horizontal line color.
-@hr-border:                   #b2b2b2;
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/buttons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/buttons.less
deleted file mode 100644
index bbb3c620..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/buttons.less
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Buttons
-// --------------------------------------------------
-
-
-// Base styles
-// --------------------------------------------------
-
-// Core styles
-.btn {
-  display: inline-block;
-  padding: 5px 6px 4px 8px;
-  margin-top: 0;
-  margin-bottom: 0; // For input.btn
-  font-family: "Open Sans Condensed", sans-serif;
-  font-size: @font-size-base * 1.3;
-  font-weight: 700;
-  text-transform: uppercase;
-  letter-spacing: 1px;
-  line-height: @line-height-computed;
-  text-align: center;
-  vertical-align: middle;
-  touch-action: manipulation;
-  cursor: pointer;
-  background-color: @gray-lighter;
-  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
-  border: none;
-  border-radius: 3px;
-  .box-shadow(1px 1px 0 rgba(0, 0, 0, 0.3));
-  outline: none !important;
-  white-space: nowrap;
-  .user-select(none);
-
-  &:focus,
-  &.focus {
-    .tab-focus();
-  }
-
-  &:hover,
-  &:focus,
-  &.focus {
-    background-color: lighten(@gray-lighter, 5%);
-    text-decoration: none;
-    .transition(background-color .1s linear);
-  }
-
-  &:active,
-  &.active {
-    outline: 0;
-    padding: 6px 5px 3px 9px;
-  }
-
-  &.disabled,
-  &[disabled],
-  fieldset[disabled] & {
-    cursor: @cursor-disabled;
-    pointer-events: none; // Future-proof disabling of clicks
-    .opacity(65);
-    .box-shadow(1px 1px 0 rgba(0, 0, 0, 0.15));
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/code.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/code.less
deleted file mode 100644
index 33af7555..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/code.less
+++ /dev/null
@@ -1,8 +0,0 @@
-code {
-  margin: 0 2px;
-  padding: 1px 5px;
-  border: 1px solid #E1E1E8;
-  background-color: #F7F7F9;
-  color: @gray-dark;
-  font-size: 85%;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/evaluation-form.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/evaluation-form.less
deleted file mode 100644
index 6d505d56..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/evaluation-form.less
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// Evaluation form
-// --------------------------------------------------
-
-
-.evaluation-form {
-  .clearfix();
-
-  textarea {
-    height: 200px;
-  }
-}
-
-.evaluation-input-output {
-  float: left;
-  width: 65%;
-}
-
-.evaluation-input-clear-button {
-  position: absolute;
-  top: 0;
-  right: 0;
-  width: 15px;
-  height: 15px;
-  margin: 6px;
-  display: inline-block;
-  background: transparent url("../images/clear-text.png") no-repeat scroll 0 0;
-  opacity: 0.75;
-  line-height: 0;
-  vertical-align: bottom;
-  cursor: pointer;
-
-  &:hover {
-   opacity: 1;
- }
-}
-
-.evaluation-input-clear-button.with-scrollbar {
-  margin-right: 29px;
-}
-
-.evaluation-output {
-  margin-top: 1.5em;
-}
-
-.evaluation-input-field,
-.evaluation-output-field {
-  margin-bottom: 0.5em;
-  .box-sizing(border-box);
-  overflow-x: hidden;
-  line-height: @line-height-computed;
-}
-
-.evaluation-output-field {
-  &[readonly] {
-    cursor: auto;
-    background-color: @input-bg;
-  }
-}
-
-.evaluation-error-header {
-  margin-bottom: @line-height-computed;
-  padding-left: 52px;
-  background: transparent url("../images/icons/48x48/error.png") no-repeat scroll 0 50%;
-  color: @black;
-  font-family: @font-family-sans-serif;
-  font-weight: bold;
-  line-height: 48px;
-  vertical-align: middle;
-}
-
-ul.evaluation-error-list,
-ul.evaluation-warning-list {
-  li {
-    margin-bottom: 1em;
-
-    pre {
-      margin-top: 0.5em;
-      white-space: pre;
-      overflow: auto;
-    }
-  }
-}
-
-ul.evaluation-error-list li pre {
-  background-color: @state-danger-bg;
-}
-
-ul.evaluation-warning-list li pre {
-  background-color: @state-warning-bg;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/forms.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/forms.less
deleted file mode 100644
index 2ceb0559..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/forms.less
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// Forms
-// --------------------------------------------------
-
-// GENERAL STYLES
-// --------------
-
-label {
-  font-weight: normal;
-}
-
-
-// Form controls
-// -------------------------
-
-// Common form controls
-.form-control {
-  line-height: @input-height-base;
-}
-
-.textarea-wrapper {
-  position: relative;
-}
-
-// Form groups
-.form-group {
-  margin-bottom: 0.5em;
-}
-
-// Info and errors
-// --------------------------
-.message-info {
-  border: 1px solid;
-  clear: both;
-  padding: 10px 20px;
-  color: @state-info-text;
-}
-
-.message-error {
-  clear: both;
-  color: @state-danger-text;
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 20px 0 10px 0;
-}
-
-.message-success {
-  color: @state-success-text;
-  font-size: 1.3em;
-  font-weight: bold;
-  margin: 20px 0 10px 0;
-}
-
-.error {
-  color: @state-danger-text;
-}
-
-// Styles for validation helpers
-// --------------------------
-.validators {
-  font-style: normal;
-  padding-bottom: 0.5em;
-}
-
-.field-validation-error {
-  display: block;
-  padding-bottom: 0.5em;
-  color: @state-danger-text;
-  font-weight: bold;
-}
-
-.field-validation-valid {
-  display: none;
-}
-
-input.input-validation-error,
-textarea.input-validation-error,
-select.input-validation-error
-{
-  border: 1px solid @state-danger-border;
-  background-color: @state-danger-bg;
-  .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
-
-  &:focus {
-    border-color: @state-danger-border;
-    @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@state-danger-text, 20%);
-    .box-shadow(@shadow);
-  }
-}
-
-.validation-summary-errors {
-  color: @state-danger-text;
-  font-weight: bold;
-  font-size: 1.1em;
-}
-
-.validation-summary-valid {
-  display: none;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/icons.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/icons.less
deleted file mode 100644
index 79b9d9e5..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/icons.less
+++ /dev/null
@@ -1,32 +0,0 @@
-//
-// Icons
-// --------------------------------------------------
-
-
-.icon {
-  background: transparent url(../images/icons/32x32/social-media-icons-32.png) no-repeat scroll;
-  display: inline-block;
-  line-height: 0;
-  vertical-align: bottom;
-}
-
-.icon-32 {
-  height: 32px;
-  width: 32px;
-}
-
-.icon-facebook {
-  background-position: 0 0;
-}
-
-.icon-twitter {
-  background-position: 0 -32px;
-}
-
-.icon-linkedin {
-  background-position: 0 -64px;
-}
-
-.icon-rss {
-  background-position: 0 -128px;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/layout.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/layout.less
deleted file mode 100644
index 35a7f386..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/layout.less
+++ /dev/null
@@ -1,128 +0,0 @@
-html,
-body {
-  margin: 0;
-  height: 100%;
-  /* The html and body elements cannot have any padding or margin */
-}
-
-/* Wrapper for page content to push down footer */
-.l-wrapper {
-  min-height: 100%;
-  height: auto !important;
-  height: 100%;
-  /* Negative indent footer by it's height */
-  margin: 0 auto (-1 * @footer-height);
-}
-
-.l-constrained {
-  margin: 0 auto;
-  padding-left: 20px;
-  padding-right: 20px;
-  max-width: 1200px;
-  min-width: 800px;
-}
-
-.l-header {
-  border-top: solid 10px @black;
-  border-bottom: 1px solid #d4b33a;
-  background-color: #f0db4f;
-
-  .l-constrained {
-    padding-top: 20px;
-    padding-bottom: 20px;
-    .clearfix();
-  }
-}
-
-.l-content {
-  .clearfix();
-}
-
-.l-main-content {
-  float: left;
-  width: 70%;
-}
-
-.l-sidebar {
-  float: right;
-  width: 30%;
-}
-
-/* Set the fixed height of the footer here */
-.l-push,
-.l-footer {
-  height: @footer-height;
-}
-
-.l-footer {
-  width: 100%;
-  background-color: @black;
-  color: @gray-lighter;
-  font-size: @font-size-small;
-  line-height: 100%;
-
-  .l-constrained {
-    padding-top: (@footer-height - 32) / 2;
-    .clearfix();
-  }
-
-  a {
-    color: @gray-lighter;
-    text-decoration: none;
-
-    &:hover,
-    &:active {
-      text-decoration: underline;
-    }
-  }
-}
-
-
-// Header
-// -------------------------
-
-.logo {
-  margin: 0;
-
-  a {
-    display: block;
-    float: left;
-    width: 100px;
-    height: 100px;
-    background: transparent url("../images/jsengineswitcher-logo.png") no-repeat scroll 0 0;
-    text-indent: -9999em;
-  }
-}
-
-.primary-nav {
-  position: relative;
-  left: 40px;
-  float: left;
-}
-
-
-// Footer
-// -------------------------
-
-.l-copyright {
-  float: left;
-    p {
-      margin: 0;
-      padding: 0;
-  }
-}
-
-.l-social {
-  float: right;
-
-  li {
-    display: inline;
-    list-style: none outside none;
-    padding-left: 10px;
-
-    a {
-      text-indent: -9999px;
-      outline: none;
-    }
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/mixins.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/mixins.less
deleted file mode 100644
index d26eee79..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/mixins.less
+++ /dev/null
@@ -1,9 +0,0 @@
-//
-// Mixins
-// --------------------------------------------------
-
-// NO Drop shadows
-.no-box-shadow {
-  -webkit-box-shadow: none; // iOS <4.3 & Android <4.1
-          box-shadow: none;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/navbar.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/navbar.less
deleted file mode 100644
index 95edf3c2..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/navbar.less
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Navbars
-// --------------------------------------------------
-
-
-// Wrapper and base class
-//
-// Provide a static navbar from which we expand to create full-width, fixed, and
-// other navbar variations.
-
-.navbar {
-  border: none;
-  border-radius: 0;
-}
-
-// Navbar nav links
-//
-// Builds on top of the `.nav` components with it's own modifier class to make
-// the nav the full height of the horizontal nav (above 768px).
-
-.navbar-nav {
-  float: left;
-  margin: 0 auto;
-
-  > li {
-    > a {
-      float: none;
-      // Vertically center the text given @navbar-height
-      padding: ((@navbar-height - @line-height-computed) / 2) 15px ((@navbar-height - @line-height-computed) / 2);
-      border: 1px solid transparent;
-      font-family: "Open Sans", sans-serif;
-      font-size: 2.0em;
-      text-decoration: none;
-      text-transform: uppercase;
-      outline: none;
-    }
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/page-socials.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/page-socials.less
deleted file mode 100644
index ea12dc09..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/page-socials.less
+++ /dev/null
@@ -1,14 +0,0 @@
-.page-socials {
-  min-height: 60px;
-  margin-top: 20px;
-  padding-top: 15px;
-  border-top: 1px solid #b2b2b2;
-}
-
-.share-buttons {
-  li {
-    margin-right: 15px;
-    vertical-align: top;
-    line-height: normal;
-  }
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/type.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/type.less
deleted file mode 100644
index 02d69502..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/type.less
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// Typography
-// --------------------------------------------------
-
-// Headings
-// -------------------------
-
-h1, h2, h3 {
-  margin-top: 10px;
-}
-
-h1, h2 {
-  line-height: 40px;
-}
-
-h2 {
-  color: @black;
-  font-weight: bold;
-}
-
-h3 {
-  color: @gray-dark;
-  line-height: @line-height-computed * 1.25;
-}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/variables.less b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/variables.less
deleted file mode 100644
index 498c9796..00000000
--- a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore6.Mvc6/wwwroot/styles/variables.less
+++ /dev/null
@@ -1,7 +0,0 @@
-// Colors
-// -------------------------
-@black:                 #1d0d0d;
-
-// Footer
-// -------------------------
-@footer-height:                    55px;
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Controllers/HomeController.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Controllers/HomeController.cs
new file mode 100644
index 00000000..6f6ed28e
--- /dev/null
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Controllers/HomeController.cs
@@ -0,0 +1,83 @@
+using System.Diagnostics;
+using System.Threading.Tasks;
+
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Html;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+
+using JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7.Models;
+using JavaScriptEngineSwitcher.Sample.Logic.Models;
+using JavaScriptEngineSwitcher.Sample.Logic.Services;
+
+namespace JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7.Controllers
+{
+	public class HomeController : Controller
+	{
+		private readonly FileContentService _fileContentService;
+		private readonly JsEvaluationService _jsEvaluationService;
+
+
+		public HomeController(
+			IConfigurationRoot configuration,
+			IWebHostEnvironment hostingEnvironment,
+			JsEvaluationService jsEvaluationService)
+		{
+			string textContentDirectoryPath = configuration
+				.GetSection("jsengineswitcher")
+				.GetSection("Samples")["TextContentDirectoryPath"]
+				;
+
+			_fileContentService = new FileContentService(textContentDirectoryPath, hostingEnvironment);
+			_jsEvaluationService = jsEvaluationService;
+		}
+
+
+		[ResponseCache(CacheProfileName = "CacheCompressedContent5Minutes")]
+		public IActionResult Index()
+		{
+			ViewBag.Body = new HtmlString(_fileContentService.GetFileContent("index.html"));
+
+			return View();
+		}
+
+		[HttpGet]
+		[ResponseCache(CacheProfileName = "CacheCompressedContent5Minutes")]
+		public IActionResult Demo()
+		{
+			var model = _jsEvaluationService.GetInitializationData();
+
+			return View(model);
+		}
+
+		[HttpPost]
+		public async Task Demo(JsEvaluationViewModel editedModel)
+		{
+			var model = _jsEvaluationService.GetInitializationData();
+			await TryUpdateModelAsync(model, string.Empty, m => m.EngineName, m=> m.Expression);
+
+			if (ModelState.IsValid)
+			{
+				model = _jsEvaluationService.Evaluate(model);
+
+				ModelState.Clear();
+			}
+
+			return View(model);
+		}
+
+		[ResponseCache(CacheProfileName = "CacheCompressedContent5Minutes")]
+		public IActionResult Contact()
+		{
+			ViewBag.Body = new HtmlString(_fileContentService.GetFileContent("contact.html"));
+
+			return View();
+		}
+
+		[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
+		public IActionResult Error()
+		{
+			return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
+		}
+	}
+}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7.csproj
new file mode 100644
index 00000000..a2750c47
--- /dev/null
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7.csproj
@@ -0,0 +1,51 @@
+
+
+  
+    JS Engine Switcher: Sample ASP.NET Core 7.0 MVC 7 Site
+    3.30.2
+    net7.0
+    enable
+    Exe
+    true
+    true
+    true
+    true
+    false
+    false
+  
+
+  
+
+  
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  
+
+  
+
+
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Models/ErrorViewModel.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Models/ErrorViewModel.cs
new file mode 100644
index 00000000..cf622ba3
--- /dev/null
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Models/ErrorViewModel.cs
@@ -0,0 +1,9 @@
+namespace JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7.Models
+{
+	public class ErrorViewModel
+	{
+		public string RequestId { get; set; }
+
+		public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
+	}
+}
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Program.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Program.cs
new file mode 100644
index 00000000..2e472860
--- /dev/null
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Program.cs
@@ -0,0 +1,106 @@
+using Jering.Javascript.NodeJS;
+using Microsoft.AspNetCore.Mvc;
+
+using JavaScriptEngineSwitcher.ChakraCore;
+using JavaScriptEngineSwitcher.Extensions.MsDependencyInjection;
+using JavaScriptEngineSwitcher.Jint;
+using JavaScriptEngineSwitcher.Jurassic;
+using JavaScriptEngineSwitcher.Msie;
+using JavaScriptEngineSwitcher.NiL;
+using JavaScriptEngineSwitcher.Node;
+using JavaScriptEngineSwitcher.Sample.Logic.Services;
+using JavaScriptEngineSwitcher.V8;
+using JavaScriptEngineSwitcher.Vroom;
+using JavaScriptEngineSwitcher.Yantra;
+
+var builder = WebApplication.CreateBuilder(new WebApplicationOptions()
+{
+	WebRootPath = Path.Combine(
+		Directory.GetCurrentDirectory(),
+		"../JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot"
+	)
+});
+var env = builder.Environment;
+var configuration = new ConfigurationBuilder()
+	.SetBasePath(env.ContentRootPath)
+	.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
+	.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
+	.AddEnvironmentVariables()
+	.Build()
+	;
+
+#region Configure services
+
+IServiceCollection services = builder.Services;
+
+services.AddSingleton(configuration);
+
+// Add Jering Node.js service to the services container.
+services.AddNodeJS();
+
+// Add JavaScriptEngineSwitcher services to the services container.
+services.AddJsEngineSwitcher(options =>
+{
+	options.AllowCurrentProperty = false;
+	options.DefaultEngineName = ChakraCoreJsEngine.EngineName;
+})
+	.AddChakraCore()
+	.AddJint()
+	.AddJurassic()
+	.AddMsie(options =>
+	{
+		options.EngineMode = JsEngineMode.ChakraIeJsRt;
+	})
+	.AddNiL()
+	.AddNode(services)
+	.AddV8()
+	.AddVroom()
+	.AddYantra()
+	;
+
+services.Configure(options =>
+{
+	options.CacheProfiles.Add("CacheCompressedContent5Minutes",
+		new CacheProfile
+		{
+			NoStore = builder.Environment.IsDevelopment(),
+			Duration = 300,
+			Location = ResponseCacheLocation.Client,
+			VaryByHeader = "Accept-Encoding"
+		}
+	);
+});
+
+// Add framework services.
+services.AddControllersWithViews();
+
+// Add JavaScriptEngineSwitcher sample services to the services container.
+services.AddSingleton();
+
+#endregion
+
+#region Configure the HTTP request pipeline
+
+var app = builder.Build();
+
+if (app.Environment.IsDevelopment())
+{
+	app.UseDeveloperExceptionPage();
+}
+else
+{
+	app.UseExceptionHandler("/Home/Error");
+}
+
+app.UseStaticFiles();
+
+app.UseRouting();
+
+app.MapControllerRoute(
+	name: "default",
+	pattern: "{controller=Home}/{action=Index}/{id?}"
+);
+
+#endregion
+
+app.Run();
\ No newline at end of file
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Properties/launchSettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Properties/launchSettings.json
new file mode 100644
index 00000000..57ebee9a
--- /dev/null
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Properties/launchSettings.json
@@ -0,0 +1,28 @@
+{
+  "iisSettings": {
+    "windowsAuthentication": false,
+    "anonymousAuthentication": true,
+    "iisExpress": {
+      "applicationUrl": "http://localhost:32819",
+      "sslPort": 0
+    }
+  },
+  "profiles": {
+    "http": {
+      "commandName": "Project",
+      "dotnetRunMessages": true,
+      "launchBrowser": true,
+      "applicationUrl": "http://localhost:5107",
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      }
+    },
+    "IIS Express": {
+      "commandName": "IISExpress",
+      "launchBrowser": true,
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      }
+    }
+  }
+}
diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Home/Contact.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Home/Contact.cshtml
new file mode 100644
index 00000000..58785ebe
--- /dev/null
+++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Home/Contact.cshtml
@@ -0,0 +1,8 @@
+@{
+	ViewBag.Title = "Contact";
+}
+
+
+

@ViewBag.Title

+ @ViewBag.Body +
\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Home/Demo.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Home/Demo.cshtml new file mode 100644 index 00000000..befb8f43 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Home/Demo.cshtml @@ -0,0 +1,67 @@ +@using JavaScriptEngineSwitcher.Sample.Logic.Models +@using JavaScriptEngineSwitcher.Sample.Resources + +@model JsEvaluationViewModel + +@{ + ViewBag.Title = "Demo"; +} + +

@ViewBag.Title

+ +
+
+
+
+
+ + +
+
+ +
+ +
+ +
+
+ +
+
+ + @if (Model.Result != null) + { +
+ @if (Model.Result.Errors.Count == 0) + { +
+ + +
+ } + else + { + await Html.RenderPartialAsync("_JsEvaluationErrorList", Model.Result.Errors); + } +
+ } +
+
+
+ +@section Scripts { + + + + + + + + + +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Home/Index.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Home/Index.cshtml new file mode 100644 index 00000000..a9c2cfb1 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Home/Index.cshtml @@ -0,0 +1,8 @@ +@{ + ViewBag.Title = string.Empty; +} + +
+

Project Description

+ @ViewBag.Body +
\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Shared/Error.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Shared/Error.cshtml new file mode 100644 index 00000000..1278d006 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Shared/Error.cshtml @@ -0,0 +1,28 @@ +@using JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7.Models + +@model ErrorViewModel + +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +@if (Model.ShowRequestId) +{ +

+ Request ID: @Model.RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Shared/_JsEvaluationErrorList.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Shared/_JsEvaluationErrorList.cshtml new file mode 100644 index 00000000..9e0601d6 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Shared/_JsEvaluationErrorList.cshtml @@ -0,0 +1,23 @@ +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.Helpers +@using JavaScriptEngineSwitcher.Sample.Logic.Models + +@model IList + +

Found @Model.Count error(s):

+
    + @foreach (var error in Model) + { +
  • + @error.EngineFullName
    + @if (error.LineNumber > 0) + { + Line @error.LineNumber, Column @error.ColumnNumber
    + } + @Html.EncodedReplace(@error.Message, "\n\r?", "
    ") + @if (!string.IsNullOrWhiteSpace(error.SourceFragment)) + { +
    @error.SourceFragment
    + } +
  • + } +
\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Shared/_Layout.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Shared/_Layout.cshtml new file mode 100644 index 00000000..fe014242 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/Shared/_Layout.cshtml @@ -0,0 +1,107 @@ +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.TagHelpers + + + + + + + + + @if (!string.IsNullOrEmpty(ViewBag.Title)) {<text>@ViewBag.Title | </text>}JavaScriptEngineSwitcher Sample ASP.NET Core 7.0 MVC 7 Site + + + + + + + + + + + + +
+ + + + + +
+
+ @RenderBody() +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @await RenderSectionAsync("scripts", required: false) + + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/_ViewImports.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/_ViewImports.cshtml new file mode 100644 index 00000000..8fe8384e --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" +@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure" \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/_ViewStart.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/_ViewStart.cshtml new file mode 100644 index 00000000..817a9134 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/appsettings.Development.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/appsettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/appsettings.json new file mode 100644 index 00000000..ed44b7ae --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore7.Mvc7/appsettings.json @@ -0,0 +1,15 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + + "JsEngineSwitcher": { + "Samples": { + "TextContentDirectoryPath": "../SharedData/text-content" + } + } +} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Controllers/HomeController.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Controllers/HomeController.cs new file mode 100644 index 00000000..0128dc52 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Controllers/HomeController.cs @@ -0,0 +1,83 @@ +using System.Diagnostics; +using System.Threading.Tasks; + +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Html; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; + +using JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8.Models; +using JavaScriptEngineSwitcher.Sample.Logic.Models; +using JavaScriptEngineSwitcher.Sample.Logic.Services; + +namespace JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8.Controllers +{ + public class HomeController : Controller + { + private readonly FileContentService _fileContentService; + private readonly JsEvaluationService _jsEvaluationService; + + + public HomeController( + IConfigurationRoot configuration, + IWebHostEnvironment hostingEnvironment, + JsEvaluationService jsEvaluationService) + { + string textContentDirectoryPath = configuration + .GetSection("jsengineswitcher") + .GetSection("Samples")["TextContentDirectoryPath"] + ; + + _fileContentService = new FileContentService(textContentDirectoryPath, hostingEnvironment); + _jsEvaluationService = jsEvaluationService; + } + + + [ResponseCache(CacheProfileName = "CacheCompressedContent5Minutes")] + public IActionResult Index() + { + ViewBag.Body = new HtmlString(_fileContentService.GetFileContent("index.html")); + + return View(); + } + + [HttpGet] + [ResponseCache(CacheProfileName = "CacheCompressedContent5Minutes")] + public IActionResult Demo() + { + var model = _jsEvaluationService.GetInitializationData(); + + return View(model); + } + + [HttpPost] + public async Task Demo(JsEvaluationViewModel editedModel) + { + var model = _jsEvaluationService.GetInitializationData(); + await TryUpdateModelAsync(model, string.Empty, m => m.EngineName, m=> m.Expression); + + if (ModelState.IsValid) + { + model = _jsEvaluationService.Evaluate(model); + + ModelState.Clear(); + } + + return View(model); + } + + [ResponseCache(CacheProfileName = "CacheCompressedContent5Minutes")] + public IActionResult Contact() + { + ViewBag.Body = new HtmlString(_fileContentService.GetFileContent("contact.html")); + + return View(); + } + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8.csproj new file mode 100644 index 00000000..1845c729 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8.csproj @@ -0,0 +1,49 @@ + + + + JS Engine Switcher: Sample ASP.NET Core 8.0 MVC 8 Site + 3.30.2 + net8.0 + enable + Exe + true + true + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Models/ErrorViewModel.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Models/ErrorViewModel.cs new file mode 100644 index 00000000..8cf789c5 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Models/ErrorViewModel.cs @@ -0,0 +1,9 @@ +namespace JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8.Models +{ + public class ErrorViewModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + } +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Program.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Program.cs new file mode 100644 index 00000000..2e472860 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Program.cs @@ -0,0 +1,106 @@ +using Jering.Javascript.NodeJS; +using Microsoft.AspNetCore.Mvc; + +using JavaScriptEngineSwitcher.ChakraCore; +using JavaScriptEngineSwitcher.Extensions.MsDependencyInjection; +using JavaScriptEngineSwitcher.Jint; +using JavaScriptEngineSwitcher.Jurassic; +using JavaScriptEngineSwitcher.Msie; +using JavaScriptEngineSwitcher.NiL; +using JavaScriptEngineSwitcher.Node; +using JavaScriptEngineSwitcher.Sample.Logic.Services; +using JavaScriptEngineSwitcher.V8; +using JavaScriptEngineSwitcher.Vroom; +using JavaScriptEngineSwitcher.Yantra; + +var builder = WebApplication.CreateBuilder(new WebApplicationOptions() +{ + WebRootPath = Path.Combine( + Directory.GetCurrentDirectory(), + "../JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot" + ) +}); +var env = builder.Environment; +var configuration = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) + .AddEnvironmentVariables() + .Build() + ; + +#region Configure services + +IServiceCollection services = builder.Services; + +services.AddSingleton(configuration); + +// Add Jering Node.js service to the services container. +services.AddNodeJS(); + +// Add JavaScriptEngineSwitcher services to the services container. +services.AddJsEngineSwitcher(options => +{ + options.AllowCurrentProperty = false; + options.DefaultEngineName = ChakraCoreJsEngine.EngineName; +}) + .AddChakraCore() + .AddJint() + .AddJurassic() + .AddMsie(options => + { + options.EngineMode = JsEngineMode.ChakraIeJsRt; + }) + .AddNiL() + .AddNode(services) + .AddV8() + .AddVroom() + .AddYantra() + ; + +services.Configure(options => +{ + options.CacheProfiles.Add("CacheCompressedContent5Minutes", + new CacheProfile + { + NoStore = builder.Environment.IsDevelopment(), + Duration = 300, + Location = ResponseCacheLocation.Client, + VaryByHeader = "Accept-Encoding" + } + ); +}); + +// Add framework services. +services.AddControllersWithViews(); + +// Add JavaScriptEngineSwitcher sample services to the services container. +services.AddSingleton(); + +#endregion + +#region Configure the HTTP request pipeline + +var app = builder.Build(); + +if (app.Environment.IsDevelopment()) +{ + app.UseDeveloperExceptionPage(); +} +else +{ + app.UseExceptionHandler("/Home/Error"); +} + +app.UseStaticFiles(); + +app.UseRouting(); + +app.MapControllerRoute( + name: "default", + pattern: "{controller=Home}/{action=Index}/{id?}" +); + +#endregion + +app.Run(); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Properties/launchSettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Properties/launchSettings.json new file mode 100644 index 00000000..dda1c460 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Properties/launchSettings.json @@ -0,0 +1,29 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:29737", + "sslPort": 0 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5282", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Home/Contact.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Home/Contact.cshtml new file mode 100644 index 00000000..58785ebe --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Home/Contact.cshtml @@ -0,0 +1,8 @@ +@{ + ViewBag.Title = "Contact"; +} + +
+

@ViewBag.Title

+ @ViewBag.Body +
\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Home/Demo.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Home/Demo.cshtml new file mode 100644 index 00000000..befb8f43 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Home/Demo.cshtml @@ -0,0 +1,67 @@ +@using JavaScriptEngineSwitcher.Sample.Logic.Models +@using JavaScriptEngineSwitcher.Sample.Resources + +@model JsEvaluationViewModel + +@{ + ViewBag.Title = "Demo"; +} + +

@ViewBag.Title

+ +
+
+
+
+
+ + +
+
+ +
+ +
+ +
+
+ +
+
+ + @if (Model.Result != null) + { +
+ @if (Model.Result.Errors.Count == 0) + { +
+ + +
+ } + else + { + await Html.RenderPartialAsync("_JsEvaluationErrorList", Model.Result.Errors); + } +
+ } +
+
+
+ +@section Scripts { + + + + + + + + + +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Home/Index.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Home/Index.cshtml new file mode 100644 index 00000000..a9c2cfb1 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Home/Index.cshtml @@ -0,0 +1,8 @@ +@{ + ViewBag.Title = string.Empty; +} + +
+

Project Description

+ @ViewBag.Body +
\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Shared/Error.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Shared/Error.cshtml new file mode 100644 index 00000000..bfb58107 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Shared/Error.cshtml @@ -0,0 +1,28 @@ +@using JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8.Models + +@model ErrorViewModel + +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +@if (Model.ShowRequestId) +{ +

+ Request ID: @Model.RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Shared/_JsEvaluationErrorList.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Shared/_JsEvaluationErrorList.cshtml new file mode 100644 index 00000000..9e0601d6 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Shared/_JsEvaluationErrorList.cshtml @@ -0,0 +1,23 @@ +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.Helpers +@using JavaScriptEngineSwitcher.Sample.Logic.Models + +@model IList + +

Found @Model.Count error(s):

+
    + @foreach (var error in Model) + { +
  • + @error.EngineFullName
    + @if (error.LineNumber > 0) + { + Line @error.LineNumber, Column @error.ColumnNumber
    + } + @Html.EncodedReplace(@error.Message, "\n\r?", "
    ") + @if (!string.IsNullOrWhiteSpace(error.SourceFragment)) + { +
    @error.SourceFragment
    + } +
  • + } +
\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Shared/_Layout.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Shared/_Layout.cshtml new file mode 100644 index 00000000..ebe02bba --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/Shared/_Layout.cshtml @@ -0,0 +1,107 @@ +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.TagHelpers + + + + + + + + + @if (!string.IsNullOrEmpty(ViewBag.Title)) {<text>@ViewBag.Title | </text>}JavaScriptEngineSwitcher Sample ASP.NET Core 8.0 MVC 8 Site + + + + + + + + + + + + +
+ + + + + +
+
+ @RenderBody() +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @await RenderSectionAsync("scripts", required: false) + + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/_ViewImports.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/_ViewImports.cshtml new file mode 100644 index 00000000..8fe8384e --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" +@addTagHelper "*, JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure" \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/_ViewStart.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/_ViewStart.cshtml new file mode 100644 index 00000000..817a9134 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/appsettings.Development.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/appsettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/appsettings.json new file mode 100644 index 00000000..ed44b7ae --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore8.Mvc8/appsettings.json @@ -0,0 +1,15 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + + "JsEngineSwitcher": { + "Samples": { + "TextContentDirectoryPath": "../SharedData/text-content" + } + } +} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Controllers/HomeController.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Controllers/HomeController.cs new file mode 100644 index 00000000..57f376ff --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Controllers/HomeController.cs @@ -0,0 +1,83 @@ +using System.Diagnostics; +using System.Threading.Tasks; + +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Html; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; + +using JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9.Models; +using JavaScriptEngineSwitcher.Sample.Logic.Models; +using JavaScriptEngineSwitcher.Sample.Logic.Services; + +namespace JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9.Controllers +{ + public class HomeController : Controller + { + private readonly FileContentService _fileContentService; + private readonly JsEvaluationService _jsEvaluationService; + + + public HomeController( + IConfigurationRoot configuration, + IWebHostEnvironment hostingEnvironment, + JsEvaluationService jsEvaluationService) + { + string textContentDirectoryPath = configuration + .GetSection("jsengineswitcher") + .GetSection("Samples")["TextContentDirectoryPath"] + ; + + _fileContentService = new FileContentService(textContentDirectoryPath, hostingEnvironment); + _jsEvaluationService = jsEvaluationService; + } + + + [ResponseCache(CacheProfileName = "CacheCompressedContent5Minutes")] + public IActionResult Index() + { + ViewBag.Body = new HtmlString(_fileContentService.GetFileContent("index.html")); + + return View(); + } + + [HttpGet] + [ResponseCache(CacheProfileName = "CacheCompressedContent5Minutes")] + public IActionResult Demo() + { + var model = _jsEvaluationService.GetInitializationData(); + + return View(model); + } + + [HttpPost] + public async Task Demo(JsEvaluationViewModel editedModel) + { + var model = _jsEvaluationService.GetInitializationData(); + await TryUpdateModelAsync(model, string.Empty, m => m.EngineName, m=> m.Expression); + + if (ModelState.IsValid) + { + model = _jsEvaluationService.Evaluate(model); + + ModelState.Clear(); + } + + return View(model); + } + + [ResponseCache(CacheProfileName = "CacheCompressedContent5Minutes")] + public IActionResult Contact() + { + ViewBag.Body = new HtmlString(_fileContentService.GetFileContent("contact.html")); + + return View(); + } + + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + public IActionResult Error() + { + return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); + } + } +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9.csproj b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9.csproj new file mode 100644 index 00000000..8f79d123 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9.csproj @@ -0,0 +1,49 @@ + + + + JS Engine Switcher: Sample ASP.NET Core 9.0 MVC 9 Site + 3.30.2 + net9.0 + enable + Exe + true + true + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Models/ErrorViewModel.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Models/ErrorViewModel.cs new file mode 100644 index 00000000..20cc9827 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Models/ErrorViewModel.cs @@ -0,0 +1,9 @@ +namespace JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9.Models +{ + public class ErrorViewModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + } +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Program.cs b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Program.cs new file mode 100644 index 00000000..457ccf63 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Program.cs @@ -0,0 +1,105 @@ +using Jering.Javascript.NodeJS; +using Microsoft.AspNetCore.Mvc; + +using JavaScriptEngineSwitcher.ChakraCore; +using JavaScriptEngineSwitcher.Extensions.MsDependencyInjection; +using JavaScriptEngineSwitcher.Jint; +using JavaScriptEngineSwitcher.Jurassic; +using JavaScriptEngineSwitcher.Msie; +using JavaScriptEngineSwitcher.NiL; +using JavaScriptEngineSwitcher.Node; +using JavaScriptEngineSwitcher.Sample.Logic.Services; +using JavaScriptEngineSwitcher.V8; +using JavaScriptEngineSwitcher.Vroom; +using JavaScriptEngineSwitcher.Yantra; + +var builder = WebApplication.CreateBuilder(new WebApplicationOptions() { + WebRootPath = Path.Combine( + Directory.GetCurrentDirectory(), + "../JavaScriptEngineSwitcher.Sample.AspNetCore.ClientSideAssets/wwwroot" + ) +}); +var env = builder.Environment; +var configuration = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) + .AddEnvironmentVariables() + .Build() + ; + +#region Configure services + +IServiceCollection services = builder.Services; + +services.AddSingleton(configuration); + +// Add Jering Node.js service to the services container. +services.AddNodeJS(); + +// Add JavaScriptEngineSwitcher services to the services container. +services.AddJsEngineSwitcher(options => +{ + options.AllowCurrentProperty = false; + options.DefaultEngineName = ChakraCoreJsEngine.EngineName; +}) + .AddChakraCore() + .AddJint() + .AddJurassic() + .AddMsie(options => + { + options.EngineMode = JsEngineMode.ChakraIeJsRt; + }) + .AddNiL() + .AddNode(services) + .AddV8() + .AddVroom() + .AddYantra() + ; + +services.Configure(options => +{ + options.CacheProfiles.Add("CacheCompressedContent5Minutes", + new CacheProfile + { + NoStore = builder.Environment.IsDevelopment(), + Duration = 300, + Location = ResponseCacheLocation.Client, + VaryByHeader = "Accept-Encoding" + } + ); +}); + +// Add framework services. +services.AddControllersWithViews(); + +// Add JavaScriptEngineSwitcher sample services to the services container. +services.AddSingleton(); + +#endregion + +#region Configure the HTTP request pipeline + +var app = builder.Build(); + +if (app.Environment.IsDevelopment()) +{ + app.UseDeveloperExceptionPage(); +} +else +{ + app.UseExceptionHandler("/Home/Error"); +} + +app.UseRouting(); + +app.MapStaticAssets(); + +app.MapControllerRoute( + name: "default", + pattern: "{controller=Home}/{action=Index}/{id?}") + .WithStaticAssets(); + +#endregion + +app.Run(); \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Properties/launchSettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Properties/launchSettings.json new file mode 100644 index 00000000..a94e92ed --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:53687/", + "sslPort": 44308 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5220" + }, + "https": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7242;http://localhost:5220" + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Home/Contact.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Home/Contact.cshtml new file mode 100644 index 00000000..58785ebe --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Home/Contact.cshtml @@ -0,0 +1,8 @@ +@{ + ViewBag.Title = "Contact"; +} + +
+

@ViewBag.Title

+ @ViewBag.Body +
\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Home/Demo.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Home/Demo.cshtml new file mode 100644 index 00000000..befb8f43 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Home/Demo.cshtml @@ -0,0 +1,67 @@ +@using JavaScriptEngineSwitcher.Sample.Logic.Models +@using JavaScriptEngineSwitcher.Sample.Resources + +@model JsEvaluationViewModel + +@{ + ViewBag.Title = "Demo"; +} + +

@ViewBag.Title

+ +
+
+
+
+
+ + +
+
+ +
+ +
+ +
+
+ +
+
+ + @if (Model.Result != null) + { +
+ @if (Model.Result.Errors.Count == 0) + { +
+ + +
+ } + else + { + await Html.RenderPartialAsync("_JsEvaluationErrorList", Model.Result.Errors); + } +
+ } +
+
+
+ +@section Scripts { + + + + + + + + + +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Home/Index.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Home/Index.cshtml new file mode 100644 index 00000000..a9c2cfb1 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Home/Index.cshtml @@ -0,0 +1,8 @@ +@{ + ViewBag.Title = string.Empty; +} + +
+

Project Description

+ @ViewBag.Body +
\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Shared/Error.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Shared/Error.cshtml new file mode 100644 index 00000000..b568b9f2 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Shared/Error.cshtml @@ -0,0 +1,28 @@ +@using JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9.Models + +@model ErrorViewModel + +@{ + ViewData["Title"] = "Error"; +} + +

Error.

+

An error occurred while processing your request.

+ +@if (Model.ShowRequestId) +{ +

+ Request ID: @Model.RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Shared/_JsEvaluationErrorList.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Shared/_JsEvaluationErrorList.cshtml new file mode 100644 index 00000000..9e0601d6 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Shared/_JsEvaluationErrorList.cshtml @@ -0,0 +1,23 @@ +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.Helpers +@using JavaScriptEngineSwitcher.Sample.Logic.Models + +@model IList + +

Found @Model.Count error(s):

+
    + @foreach (var error in Model) + { +
  • + @error.EngineFullName
    + @if (error.LineNumber > 0) + { + Line @error.LineNumber, Column @error.ColumnNumber
    + } + @Html.EncodedReplace(@error.Message, "\n\r?", "
    ") + @if (!string.IsNullOrWhiteSpace(error.SourceFragment)) + { +
    @error.SourceFragment
    + } +
  • + } +
\ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Shared/_Layout.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Shared/_Layout.cshtml new file mode 100644 index 00000000..b595497f --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/Shared/_Layout.cshtml @@ -0,0 +1,107 @@ +@using JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure.TagHelpers + + + + + + + + + @if (!string.IsNullOrEmpty(ViewBag.Title)) {<text>@ViewBag.Title | </text>}JavaScriptEngineSwitcher Sample ASP.NET Core 9.0 MVC 9 Site + + + + + + + + + + + + +
+ + + + + +
+
+ @RenderBody() +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @await RenderSectionAsync("scripts", required: false) + + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/_ViewImports.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/_ViewImports.cshtml new file mode 100644 index 00000000..dcad619c --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, JavaScriptEngineSwitcher.Sample.AspNetCore.Infrastructure \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/_ViewStart.cshtml b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/_ViewStart.cshtml new file mode 100644 index 00000000..817a9134 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/appsettings.Development.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/appsettings.json b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/appsettings.json new file mode 100644 index 00000000..ed44b7ae --- /dev/null +++ b/samples/JavaScriptEngineSwitcher.Sample.AspNetCore9.Mvc9/appsettings.json @@ -0,0 +1,15 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + + "JsEngineSwitcher": { + "Samples": { + "TextContentDirectoryPath": "../SharedData/text-content" + } + } +} diff --git a/samples/JavaScriptEngineSwitcher.Sample.Logic/JavaScriptEngineSwitcher.Sample.Logic.csproj b/samples/JavaScriptEngineSwitcher.Sample.Logic/JavaScriptEngineSwitcher.Sample.Logic.csproj index 6f229613..9112f74a 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.Logic/JavaScriptEngineSwitcher.Sample.Logic.csproj +++ b/samples/JavaScriptEngineSwitcher.Sample.Logic/JavaScriptEngineSwitcher.Sample.Logic.csproj @@ -2,12 +2,15 @@ JS Engine Switcher: Logic for Samples - 3.19.0 - net40;net451;net471;netstandard1.6;netstandard2.0;netcoreapp3.1;net5.0;net6.0 + 3.30.2 + net40;net451;net471;netstandard1.6;netstandard2.0;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0 1.6.0 Library true + $(NoWarn);NETSDK1215;NU1902;NU1903;NU1904 + false false + false @@ -30,12 +33,12 @@ - + - + @@ -43,7 +46,23 @@ - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/JavaScriptEngineSwitcher.Sample.Resources/CommonStrings.Designer.cs b/samples/JavaScriptEngineSwitcher.Sample.Resources/CommonStrings.Designer.cs index 131d9cd3..3e6c3446 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.Resources/CommonStrings.Designer.cs +++ b/samples/JavaScriptEngineSwitcher.Sample.Resources/CommonStrings.Designer.cs @@ -21,7 +21,7 @@ public class CommonStrings private static Lazy _resourceManager = new Lazy(() => new ResourceManager( "JavaScriptEngineSwitcher.Sample.Resources.CommonStrings", -#if NET40 +#if NET20 || NET30 || NET35 || NET40 typeof(CommonStrings).Assembly #else typeof(CommonStrings).GetTypeInfo().Assembly diff --git a/samples/JavaScriptEngineSwitcher.Sample.Resources/EvaluationStrings.Designer.cs b/samples/JavaScriptEngineSwitcher.Sample.Resources/EvaluationStrings.Designer.cs index 7fc38392..14fa940f 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.Resources/EvaluationStrings.Designer.cs +++ b/samples/JavaScriptEngineSwitcher.Sample.Resources/EvaluationStrings.Designer.cs @@ -21,7 +21,7 @@ public class EvaluationStrings private static Lazy _resourceManager = new Lazy(() => new ResourceManager( "JavaScriptEngineSwitcher.Sample.Resources.EvaluationStrings", -#if NET40 +#if NET20 || NET30 || NET35 || NET40 typeof(EvaluationStrings).Assembly #else typeof(EvaluationStrings).GetTypeInfo().Assembly diff --git a/samples/JavaScriptEngineSwitcher.Sample.Resources/JavaScriptEngineSwitcher.Sample.Resources.csproj b/samples/JavaScriptEngineSwitcher.Sample.Resources/JavaScriptEngineSwitcher.Sample.Resources.csproj index afcacda1..21b8c5cb 100644 --- a/samples/JavaScriptEngineSwitcher.Sample.Resources/JavaScriptEngineSwitcher.Sample.Resources.csproj +++ b/samples/JavaScriptEngineSwitcher.Sample.Resources/JavaScriptEngineSwitcher.Sample.Resources.csproj @@ -2,11 +2,13 @@ JS Engine Switcher: Resources for Samples - 3.19.0 + 3.30.2 net40-client;net45;net471;netstandard1.3;netstandard2.0 1.6.0 Library true + $(NoWarn);NETSDK1215;NU1903 + false true false @@ -15,7 +17,7 @@ - + diff --git a/samples/SharedData/text-content/contact.html b/samples/SharedData/text-content/contact.html index 5fef06d5..7b72dd94 100644 --- a/samples/SharedData/text-content/contact.html +++ b/samples/SharedData/text-content/contact.html @@ -9,7 +9,5 @@

Email

Personal Site

www.taritsyn.ru

-

Twitter

-

- -

\ No newline at end of file +

Mastodon

+

@taritsyn@fosstodon.org

\ No newline at end of file diff --git a/samples/SharedData/text-content/index.html b/samples/SharedData/text-content/index.html index 9d591fb5..3f876a89 100644 --- a/samples/SharedData/text-content/index.html +++ b/samples/SharedData/text-content/index.html @@ -1,2 +1,2 @@ -

JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines (ChakraCore, Jering.Javascript.NodeJS, Jint, Jurassic, MSIE JavaScript Engine for .NET, NiL.JS, Microsoft ClearScript.V8 and VroomJs). This library allows you to quickly and easily switch to using of another JavaScript engine.

+

JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines (ChakraCore, Jint, Jurassic, MSIE JavaScript Engine for .NET, NiL.JS, Jering.Javascript.NodeJS, Microsoft ClearScript.V8, VroomJs and YantraJS). This library allows you to quickly and easily switch to using of another JavaScript engine.

JavaScript Engine Switcher was created and is maintained by Andrey Taritsyn.

\ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64.csproj b/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64.csproj index c0a6942e..40c96426 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64.csproj +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64.csproj @@ -2,7 +2,7 @@ JS Engine Switcher: ChakraCore for Linux (x64) - 3.18.2 + 3.27.3 netstandard2.0 @@ -11,12 +11,11 @@ - This package complements the JavaScriptEngineSwitcher.ChakraCore package and contains the native implementation of ChakraCore version of January 31, 2022 for Linux (x64). - -This package is only compatible with .NET Core. - $(PackageCommonTags);ChakraCore;Linux;x64 + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png - ChakraCore was updated to version of January 31, 2022. + This package complements the JavaScriptEngineSwitcher.ChakraCore package and contains the native implementation of ChakraCore for Linux (x64). + $(PackageCommonTags);ChakraCore;Linux;x64 + ChakraCore was updated to version of August 1, 2024. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64.nuspec b/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64.nuspec index 3a5890de..d5a1567f 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64.nuspec +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64.nuspec @@ -1,12 +1,11 @@  - + $CommonMetadataElements$ $CommonFileElements$ - - + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..202c0c2b --- /dev/null +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/PACKAGE-DESCRIPTION.md @@ -0,0 +1,3 @@ +This package complements the [JavaScriptEngineSwitcher.ChakraCore](https://www.nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore) package and contains the native implementation of [ChakraCore](https://github.com/chakra-core/ChakraCore) version of August 1, 2024 for Linux (x64). + +This package is only compatible with .NET Core. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/readme.txt b/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/readme.txt index 0d885c2f..fd2f8f3c 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/readme.txt +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64/readme.txt @@ -1,18 +1,18 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: ChakraCore for Linux x64 v3.18.2 + README file for JS Engine Switcher: ChakraCore for Linux x64 v3.27.3 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2024 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== This package complements the JavaScriptEngineSwitcher.ChakraCore package and - contains the native implementation of ChakraCore version of January 31, 2022 + contains the native implementation of ChakraCore version of August 1, 2024 for Linux (x64). This package is only compatible with .NET Core. @@ -20,7 +20,7 @@ ============= RELEASE NOTES ============= - ChakraCore was updated to version of January 31, 2022. + ChakraCore was updated to version of August 1, 2024. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64.csproj b/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64.csproj index 759e2687..16d5be07 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64.csproj +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64.csproj @@ -2,7 +2,7 @@ JS Engine Switcher: ChakraCore for OS X (x64) - 3.18.2 + 3.27.3 netstandard2.0 @@ -11,12 +11,11 @@ - This package complements the JavaScriptEngineSwitcher.ChakraCore package and contains the native implementation of ChakraCore version of January 31, 2022 for OS X (x64). - -This package is only compatible with .NET Core. - $(PackageCommonTags);ChakraCore;macOS;OSX;x64 + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png - ChakraCore was updated to version of January 31, 2022. + This package complements the JavaScriptEngineSwitcher.ChakraCore package and contains the native implementation of ChakraCore for OS X (x64). + $(PackageCommonTags);ChakraCore;macOS;OSX;x64 + ChakraCore was updated to version of August 1, 2024. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64.nuspec b/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64.nuspec index 1c927fed..a9105540 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64.nuspec +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64.nuspec @@ -1,12 +1,11 @@  - + $CommonMetadataElements$ $CommonFileElements$ - - + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..910cd8d8 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/PACKAGE-DESCRIPTION.md @@ -0,0 +1,3 @@ +This package complements the [JavaScriptEngineSwitcher.ChakraCore](https://www.nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore) package and contains the native implementation of [ChakraCore](https://github.com/chakra-core/ChakraCore) version of August 1, 2024 for OS X (x64). + +This package is only compatible with .NET Core. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/readme.txt b/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/readme.txt index d3d4c5ef..2b84ec5b 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/readme.txt +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64/readme.txt @@ -1,18 +1,18 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: ChakraCore for OS X x64 v3.18.2 + README file for JS Engine Switcher: ChakraCore for OS X x64 v3.27.3 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2024 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== This package complements the JavaScriptEngineSwitcher.ChakraCore package and - contains the native implementation of ChakraCore version of January 31, 2022 + contains the native implementation of ChakraCore version of August 1, 2024 for OS X (x64). This package is only compatible with .NET Core. @@ -20,7 +20,7 @@ ============= RELEASE NOTES ============= - ChakraCore was updated to version of January 31, 2022. + ChakraCore was updated to version of August 1, 2024. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.csproj b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.csproj index 7206d441..4c281d94 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.csproj +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.csproj @@ -2,7 +2,7 @@ JS Engine Switcher: ChakraCore for Windows (ARM) - 3.18.2 + 3.27.3 netstandard2.0 @@ -11,12 +11,11 @@ - This package complements the JavaScriptEngineSwitcher.ChakraCore package and contains the native implementation of ChakraCore version of January 31, 2022 for Windows (ARM). - -This package is only compatible with .NET Core and .NET Framework 4.5. - $(PackageCommonTags);ChakraCore;Windows;ARM + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png - ChakraCore was updated to version of January 31, 2022. + This package complements the JavaScriptEngineSwitcher.ChakraCore package and contains the native implementation of ChakraCore for Windows (ARM). + $(PackageCommonTags);ChakraCore;Windows;ARM + ChakraCore was updated to version of August 1, 2024. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.nuspec b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.nuspec index a947ac29..bd55ce3c 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.nuspec +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.nuspec @@ -1,5 +1,5 @@  - + $CommonMetadataElements$ @@ -9,7 +9,6 @@ - - + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..0e15d877 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/PACKAGE-DESCRIPTION.md @@ -0,0 +1,3 @@ +This package complements the [JavaScriptEngineSwitcher.ChakraCore](https://www.nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore) package and contains the native implementation of [ChakraCore](https://github.com/chakra-core/ChakraCore) version of August 1, 2024 for Windows (ARM). + +This package is only compatible with .NET Core and .NET Framework 4.5. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.props b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.props index 2e821127..bedb5851 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.props +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.props @@ -1,10 +1,16 @@  - + - + arm/%(Filename)%(Extension) PreserveNewest False + + + %(Filename)%(Extension) + PreserveNewest + False + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/readme.txt b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/readme.txt index 28321c50..5f8ec868 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/readme.txt +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm/readme.txt @@ -1,18 +1,18 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: ChakraCore for Windows ARM v3.18.2 + README file for JS Engine Switcher: ChakraCore for Windows ARM v3.27.3 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2024 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== This package complements the JavaScriptEngineSwitcher.ChakraCore package and - contains the native implementation of ChakraCore version of January 31, 2022 + contains the native implementation of ChakraCore version of August 1, 2024 for Windows (ARM). This package is only compatible with .NET Core and .NET Framework 4.5. @@ -20,7 +20,7 @@ ============= RELEASE NOTES ============= - ChakraCore was updated to version of January 31, 2022. + ChakraCore was updated to version of August 1, 2024. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.csproj b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.csproj index 0ebec242..8e1d3262 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.csproj +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.csproj @@ -2,7 +2,7 @@ JS Engine Switcher: ChakraCore for Windows (ARM64) - 3.18.2 + 3.27.3 netstandard2.0 @@ -11,12 +11,11 @@ - This package complements the JavaScriptEngineSwitcher.ChakraCore package and contains the native implementation of ChakraCore version of January 31, 2022 for Windows (ARM64). - -This package is only compatible with .NET Core and .NET Framework 4.5. - $(PackageCommonTags);ChakraCore;Windows;ARM64 + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png - ChakraCore was updated to version of January 31, 2022. + This package complements the JavaScriptEngineSwitcher.ChakraCore package and contains the native implementation of ChakraCore for Windows (ARM64). + $(PackageCommonTags);ChakraCore;Windows;ARM64 + ChakraCore was updated to version of August 1, 2024. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.nuspec b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.nuspec index 9a929187..be7a9192 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.nuspec +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.nuspec @@ -1,5 +1,5 @@  - + $CommonMetadataElements$ @@ -9,7 +9,6 @@ - - + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..70ef2878 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/PACKAGE-DESCRIPTION.md @@ -0,0 +1,3 @@ +This package complements the [JavaScriptEngineSwitcher.ChakraCore](https://www.nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore) package and contains the native implementation of [ChakraCore](https://github.com/chakra-core/ChakraCore) version of August 1, 2024 for Windows (ARM64). + +This package is only compatible with .NET Core and .NET Framework 4.5. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.props b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.props index 83a3b254..f783db92 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.props +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.props @@ -1,10 +1,16 @@  - + - + arm64/%(Filename)%(Extension) PreserveNewest False + + + %(Filename)%(Extension) + PreserveNewest + False + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/readme.txt b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/readme.txt index 76b014b9..d6809f35 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/readme.txt +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64/readme.txt @@ -1,18 +1,18 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: ChakraCore for Windows ARM64 v3.18.2 + README file for JS Engine Switcher: ChakraCore for Windows ARM64 v3.27.3 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2024 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== This package complements the JavaScriptEngineSwitcher.ChakraCore package and - contains the native implementation of ChakraCore version of January 31, 2022 + contains the native implementation of ChakraCore version of August 1, 2024 for Windows (ARM64). This package is only compatible with .NET Core and .NET Framework 4.5. @@ -20,7 +20,7 @@ ============= RELEASE NOTES ============= - ChakraCore was updated to version of January 31, 2022. + ChakraCore was updated to version of August 1, 2024. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.csproj b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.csproj index 081fd4d9..26562fe9 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.csproj +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.csproj @@ -2,7 +2,7 @@ JS Engine Switcher: ChakraCore for Windows (x64) - 3.18.2 + 3.27.3 netstandard2.0 @@ -11,10 +11,11 @@ - This package complements the JavaScriptEngineSwitcher.ChakraCore package and contains the native implementation of ChakraCore version of January 31, 2022 for Windows (x64). - $(PackageCommonTags);ChakraCore;Windows;x64 + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png - ChakraCore was updated to version of January 31, 2022. + This package complements the JavaScriptEngineSwitcher.ChakraCore package and contains the native implementation of ChakraCore for Windows (x64). + $(PackageCommonTags);ChakraCore;Windows;x64 + ChakraCore was updated to version of August 1, 2024. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.nuspec b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.nuspec index 59d49552..dd6618a8 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.nuspec +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.nuspec @@ -1,5 +1,5 @@  - + $CommonMetadataElements$ @@ -9,7 +9,6 @@ - - + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..0cd8c83c --- /dev/null +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/PACKAGE-DESCRIPTION.md @@ -0,0 +1 @@ +This package complements the [JavaScriptEngineSwitcher.ChakraCore](https://www.nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore) package and contains the native implementation of [ChakraCore](https://github.com/chakra-core/ChakraCore) version of August 1, 2024 for Windows (x64). \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.props b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.props index eb04ff0a..5a187768 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.props +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.props @@ -1,10 +1,16 @@  - + - + x64/%(Filename)%(Extension) PreserveNewest False + + + %(Filename)%(Extension) + PreserveNewest + False + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/readme.txt b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/readme.txt index a95fdc18..6ac75fb7 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/readme.txt +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64/readme.txt @@ -1,24 +1,24 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: ChakraCore for Windows x64 v3.18.2 + README file for JS Engine Switcher: ChakraCore for Windows x64 v3.27.3 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2024 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== This package complements the JavaScriptEngineSwitcher.ChakraCore package and - contains the native implementation of ChakraCore version of January 31, 2022 + contains the native implementation of ChakraCore version of August 1, 2024 for Windows (x64). ============= RELEASE NOTES ============= - ChakraCore was updated to version of January 31, 2022. + ChakraCore was updated to version of August 1, 2024. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.csproj b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.csproj index 92cfaff2..b90cd8f5 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.csproj +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.csproj @@ -2,7 +2,7 @@ JS Engine Switcher: ChakraCore for Windows (x86) - 3.18.2 + 3.27.3 netstandard2.0 @@ -11,10 +11,11 @@ - This package complements the JavaScriptEngineSwitcher.ChakraCore package and contains the native implementation of ChakraCore version of January 31, 2022 for Windows (x86). - $(PackageCommonTags);ChakraCore;Windows;x86 + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png - ChakraCore was updated to version of January 31, 2022. + This package complements the JavaScriptEngineSwitcher.ChakraCore package and contains the native implementation of ChakraCore for Windows (x86). + $(PackageCommonTags);ChakraCore;Windows;x86 + ChakraCore was updated to version of August 1, 2024. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.nuspec b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.nuspec index 7f3f7f23..8b0bc5e3 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.nuspec +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.nuspec @@ -1,5 +1,5 @@  - + $CommonMetadataElements$ @@ -9,7 +9,6 @@ - - + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..b6951ff8 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/PACKAGE-DESCRIPTION.md @@ -0,0 +1 @@ +This package complements the [JavaScriptEngineSwitcher.ChakraCore](https://www.nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore) package and contains the native implementation of [ChakraCore](https://github.com/chakra-core/ChakraCore) version of August 1, 2024 for Windows (x86). \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.props b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.props index 21d78888..be3fd380 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.props +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/build/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.props @@ -1,10 +1,16 @@  - + - + x86/%(Filename)%(Extension) PreserveNewest False + + + %(Filename)%(Extension) + PreserveNewest + False + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/readme.txt b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/readme.txt index c649abee..ff0c8d12 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/readme.txt +++ b/src/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86/readme.txt @@ -1,24 +1,24 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: ChakraCore for Windows x86 v3.18.2 + README file for JS Engine Switcher: ChakraCore for Windows x86 v3.27.3 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2024 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== This package complements the JavaScriptEngineSwitcher.ChakraCore package and - contains the native implementation of ChakraCore version of January 31, 2022 + contains the native implementation of ChakraCore version of August 1, 2024 for Windows (x86). ============= RELEASE NOTES ============= - ChakraCore was updated to version of January 31, 2022. + ChakraCore was updated to version of August 1, 2024. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngine.cs b/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngine.cs index 8981fd28..9a545b96 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngine.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngine.cs @@ -53,7 +53,7 @@ public sealed class ChakraCoreJsEngine : JsEngineBase /// /// Version of original JS engine /// - private const string EngineVersion = "Jan 31, 2022"; + private const string EngineVersion = "Aug 1, 2024"; /// /// Instance of JS runtime @@ -73,7 +73,7 @@ public sealed class ChakraCoreJsEngine : JsEngineBase /// /// Type mapper /// - private TypeMapper _typeMapper = new TypeMapper(); + private TypeMapper _typeMapper; /// /// Callback for continuation of promise @@ -148,6 +148,7 @@ public ChakraCoreJsEngine(ChakraCoreSettings settings) attributes |= JsRuntimeAttributes.EnableExperimentalFeatures; } + _typeMapper = new TypeMapper(chakraCoreSettings.AllowReflection); #if NETSTANDARD1_3 _dispatcher = new ScriptDispatcher(); #else @@ -263,7 +264,7 @@ private static void RemoveReferenceToValue(JsValue value) /// Checks whether the value can have references /// /// The value - /// Result of check (true - may have; false - may not have) + /// Result of check (true - may have; false - may not have) private static bool CanHaveReferences(JsValue value) { JsValueType valueType = value.ValueType; @@ -1048,41 +1049,26 @@ protected override void InnerCollectGarbage() #region IJsEngine implementation - /// - /// Gets a name of JS engine - /// public override string Name { get { return EngineName; } } - /// - /// Gets a version of original JS engine - /// public override string Version { get { return EngineVersion; } } - /// - /// Gets a value that indicates if the JS engine supports script pre-compilation - /// public override bool SupportsScriptPrecompilation { get { return true; } } - /// - /// Gets a value that indicates if the JS engine supports script interruption - /// public override bool SupportsScriptInterruption { get { return true; } } - /// - /// Gets a value that indicates if the JS engine supports garbage collection - /// public override bool SupportsGarbageCollection { get { return true; } diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngineFactory.cs b/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngineFactory.cs index a88d4909..c85357ef 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngineFactory.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngineFactory.cs @@ -32,9 +32,7 @@ public ChakraCoreJsEngineFactory(ChakraCoreSettings settings) #region IJsEngineFactory implementation - /// - /// Gets a name of JS engine - /// + /// public string EngineName { get { return ChakraCoreJsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCorePrecompiledScript.cs b/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCorePrecompiledScript.cs index 136d954e..f9bf6583 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCorePrecompiledScript.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCorePrecompiledScript.cs @@ -113,7 +113,7 @@ public ChakraCorePrecompiledScript(string code, JsParseScriptAttributes parseAtt /// by debuggable script contexts /// The script returned /// Attribute mask for parsing the script - /// true if the operation succeeded, false otherwise + /// true if the operation succeeded, false otherwise private bool LoadScriptSourceCode(JsSourceContext sourceContext, out JsValue value, out JsParseScriptAttributes parseAttributes) { @@ -149,9 +149,7 @@ private bool LoadScriptSourceCode(JsSourceContext sourceContext, out JsValue val #region IPrecompiledScript implementation - /// - /// Gets a name of JS engine for which the pre-compiled script was created - /// + /// public string EngineName { get { return ChakraCoreJsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreSettings.cs b/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreSettings.cs index 1d14e794..80b05170 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreSettings.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreSettings.cs @@ -28,6 +28,19 @@ public sealed class ChakraCoreSettings private int _maxStackSize; #endif + /// + /// Gets or sets a flag for whether to allow the usage of reflection API in the script code + /// + /// + /// This affects , Exception.GetType, + /// Exception.TargetSite and Delegate.Method. + /// + public bool AllowReflection + { + get; + set; + } + /// /// Gets or sets a flag for whether to disable any background work (such as garbage collection) /// on background threads @@ -39,7 +52,8 @@ public bool DisableBackgroundWork } /// - /// Gets or sets a flag for whether to disable calls of eval function + /// Gets or sets a flag for whether to disable calls of eval function with custom code + /// and Function constructors taking function code as string /// public bool DisableEval { @@ -67,7 +81,7 @@ public bool DisableExecutablePageAllocation } /// - /// Gets or sets a flag for whether to disable Failfast fatal error on OOM + /// Gets or sets a flag for whether to disable Failfast fatal error on OOM /// public bool DisableFatalOnOOM { @@ -98,9 +112,8 @@ public bool EnableExperimentalFeatures /// Gets or sets a maximum stack size in bytes /// /// - /// Set a 0 to use the default maximum stack size specified in the header + /// Set a 0 to use the default maximum stack size specified in the header /// for the executable. - /// /// public int MaxStackSize { @@ -137,6 +150,7 @@ public ChakraCoreSettings() { bool is64BitProcess = Utils.Is64BitProcess(); + AllowReflection = false; DisableBackgroundWork = false; DisableEval = false; DisableExecutablePageAllocation = false; diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/Helpers/NumericHelpers.cs b/src/JavaScriptEngineSwitcher.ChakraCore/Helpers/NumericHelpers.cs index 0a448090..4887e856 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/Helpers/NumericHelpers.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/Helpers/NumericHelpers.cs @@ -16,7 +16,7 @@ internal static class NumericHelpers /// Gets a value indicating whether the specified type is one of the numeric types /// /// The type - /// true if the specified type is one of the numeric types; otherwise, false + /// true if the specified type is one of the numeric types; otherwise, false public static bool IsNumericType(Type type) { TypeCode typeCode = type.GetTypeCode(); diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/Helpers/ReflectionHelpers.cs b/src/JavaScriptEngineSwitcher.ChakraCore/Helpers/ReflectionHelpers.cs index e0ec71f6..91099f72 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/Helpers/ReflectionHelpers.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/Helpers/ReflectionHelpers.cs @@ -12,6 +12,19 @@ namespace JavaScriptEngineSwitcher.ChakraCore.Helpers /// internal static class ReflectionHelpers { + private static readonly PropertyInfo[] _disallowedProperties = + { + typeof(Delegate).GetProperty("Method"), + typeof(Exception).GetProperty("TargetSite") + }; + + private static readonly MethodInfo[] _disallowedMethods = + { + typeof(object).GetMethod("GetType"), + typeof(Exception).GetMethod("GetType") + }; + + public static BindingFlags GetDefaultBindingFlags(bool instance) { BindingFlags bindingFlags = BindingFlags.Public; @@ -27,6 +40,20 @@ public static BindingFlags GetDefaultBindingFlags(bool instance) return bindingFlags; } + public static bool IsAllowedProperty(PropertyInfo property) + { + bool isAllowed = !_disallowedProperties.Contains(property, MemberComparer.Instance); + + return isAllowed; + } + + public static bool IsAllowedMethod(MethodInfo method) + { + bool isAllowed = !_disallowedMethods.Contains(method, MemberComparer.Instance); + + return isAllowed; + } + public static bool IsFullyFledgedMethod(MethodInfo method) { if (!method.Attributes.HasFlag(MethodAttributes.SpecialName)) @@ -221,6 +248,47 @@ private static bool CompareParameterTypes(object[] argValues, Type[] argTypes, T } + private sealed class MemberComparer : EqualityComparer + where T : MemberInfo + { + public static MemberComparer Instance { get; } = new MemberComparer(); + + + private MemberComparer() + { } + + + #region MemberComparer overrides + + public override bool Equals(T x, T y) + { + if (x == null && y == null) + { + return true; + } + else if (x == null || y == null) + { + return false; + } + + return x.Module == y.Module +#if !NETSTANDARD1_3 + && x.MetadataToken == y.MetadataToken +#else + && x.DeclaringType == y.DeclaringType + && x.Name == y.Name +#endif + ; + } + + public override int GetHashCode(T obj) + { + return obj != null ? obj.GetHashCode() : 0; + } + + #endregion + } + private sealed class MethodWithMetadata { public MethodBase Method @@ -235,7 +303,7 @@ public Type[] ParameterTypes set; } - /// TODO: In future will need to change type to double + /// TODO: In future will need to change type to double public ushort CompatibilityScore { get; diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JavaScriptEngineSwitcher.ChakraCore.csproj b/src/JavaScriptEngineSwitcher.ChakraCore/JavaScriptEngineSwitcher.ChakraCore.csproj index 1af6591f..6ec88163 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JavaScriptEngineSwitcher.ChakraCore.csproj +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JavaScriptEngineSwitcher.ChakraCore.csproj @@ -2,13 +2,14 @@ JS Engine Switcher: ChakraCore - 3.19.0 + 3.27.3 net40-client;net45;net471;netstandard1.3;netstandard2.0;netstandard2.1 1.6.0 Library true true - $(NoWarn);CS1591 + $(NoWarn);CS1591;NETSDK1215;NU1903 + false true true @@ -19,31 +20,22 @@ - JavaScriptEngineSwitcher.ChakraCore contains adapter `ChakraCoreJsEngine` (wrapper for the ChakraCore (https://github.com/chakra-core/ChakraCore)). Project was based on the code of Chakra-Samples (https://github.com/Microsoft/Chakra-Samples) and jsrt-dotnet (https://github.com/robpaveza/jsrt-dotnet). - -This package does not contain the native implementations of ChakraCore. Therefore, you need to choose and install the most appropriate package(s) for your platform. The following packages are available: - - * JavaScriptEngineSwitcher.ChakraCore.Native.win-x86 - * JavaScriptEngineSwitcher.ChakraCore.Native.win-x64 - * JavaScriptEngineSwitcher.ChakraCore.Native.win-arm - * JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64 - * JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64 - * JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64 - $(PackageCommonTags);ChakraCore + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png - Fixed a error #102 “Resources should conform to correct ICU standard for naming”. Special thanks to Tim Heuer. + JavaScriptEngineSwitcher.ChakraCore contains a `ChakraCoreJsEngine` adapter (wrapper for the ChakraCore). + $(PackageCommonTags);ChakraCore + ChakraCore was updated to version of August 1, 2024. - - + - - + + @@ -64,34 +56,12 @@ This package does not contain the native implementations of ChakraCore. Therefor - - advanced-string-builder-license.txt - true - false - - - chakra-samples-license.txt - true - false - - - jsrt-dotnet-license.txt - true - false - - - polyfills-for-old-dot-net-license.txt - true - false - - - - readme.txt - true - + + + - + diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsEngineFactoryCollectionExtensions.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsEngineFactoryCollectionExtensions.cs index 53bdeb70..ad6b2b02 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsEngineFactoryCollectionExtensions.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsEngineFactoryCollectionExtensions.cs @@ -11,10 +11,10 @@ public static class JsEngineFactoryCollectionExtensions { /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of - /// Instance of + /// Instance of + /// Instance of public static JsEngineFactoryCollection AddChakraCore(this JsEngineFactoryCollection source) { if (source == null) @@ -27,11 +27,11 @@ public static JsEngineFactoryCollection AddChakraCore(this JsEngineFactoryCollec /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// The delegate to configure the provided - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddChakraCore(this JsEngineFactoryCollection source, Action configure) { @@ -53,11 +53,11 @@ public static JsEngineFactoryCollection AddChakraCore(this JsEngineFactoryCollec /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// Settings of the ChakraCore JS engine - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddChakraCore(this JsEngineFactoryCollection source, ChakraCoreSettings settings) { if (source == null) diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/Embedding/EmbeddedItem.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/Embedding/EmbeddedItem.cs index 2a3158da..d9870598 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/Embedding/EmbeddedItem.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/Embedding/EmbeddedItem.cs @@ -33,7 +33,7 @@ internal abstract class EmbeddedItem : IDisposable /// /// Flag indicating whether this object is disposed /// - private readonly InterlockedStatedFlag _disposedFlag = new InterlockedStatedFlag(); + private InterlockedStatedFlag _disposedFlag = new InterlockedStatedFlag(); /// /// Gets a host type diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsContext.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsContext.cs index bdacee84..57df2c43 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsContext.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsContext.cs @@ -183,9 +183,13 @@ public static JsValue ParseScript(string script, JsSourceContext sourceContext, /// Parses a serialized script and returns a function representing the script /// /// - /// Requires an active script context. - /// The runtime will hold on to the buffer until all instances of any functions created from - /// the buffer are garbage collected. + /// + /// Requires an active script context. + /// + /// + /// The runtime will hold on to the buffer until all instances of any functions created from + /// the buffer are garbage collected. + /// /// /// The script to parse /// The serialized script @@ -262,9 +266,13 @@ public static JsValue RunScript(string script, JsSourceContext sourceContext, st /// Runs a serialized script /// /// - /// Requires an active script context. - /// The runtime will detach the data from the buffer and hold on to it until all - /// instances of any functions created from the buffer are garbage collected. + /// + /// Requires an active script context. + /// + /// + /// The runtime will detach the data from the buffer and hold on to it until all + /// instances of any functions created from the buffer are garbage collected. + /// /// /// The source code of the serialized script /// The serialized script @@ -436,7 +444,7 @@ public static void SetPromiseContinuationCallback(JsPromiseContinuationCallback /// Adds a reference to a script context /// /// - /// Calling AddRef ensures that the context will not be freed until Release is called. + /// Calling AddRef ensures that the context will not be freed until Release is called. /// /// The object's new reference count public uint AddRef() @@ -451,7 +459,7 @@ public uint AddRef() /// Releases a reference to a script context /// /// - /// Removes a reference to a context that was created by AddRef. + /// Removes a reference to a context that was created by AddRef. /// /// The object's new reference count public uint Release() diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsErrorCode.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsErrorCode.cs index 3e1239b7..ad9740f4 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsErrorCode.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsErrorCode.cs @@ -23,7 +23,7 @@ public enum JsErrorCode : uint InvalidArgument, /// - /// An argument to a hosting API was null in a context where null is not allowed + /// An argument to a hosting API was null in a context where null is not allowed /// NullArgument, @@ -125,19 +125,21 @@ public enum JsErrorCode : uint InObjectBeforeCollectCallback, /// - /// Object cannot be unwrapped to IInspectable pointer + /// Object cannot be unwrapped to IInspectable pointer /// ObjectNotInspectable, /// /// A hosting API that operates on symbol property ids but was called with a non-symbol property id. - /// The error code is returned by JsGetSymbolFromPropertyId if the function is called with non-symbol property id. + /// The error code is returned by JsGetSymbolFromPropertyId if the function is called with non-symbol + /// property id. /// PropertyNotSymbol, /// /// A hosting API that operates on string property ids but was called with a non-string property id. - /// The error code is returned by existing JsGetPropertyNamefromId if the function is called with non-string property id. + /// The error code is returned by existing JsGetPropertyNamefromId if the function is called with + /// non-string property id. /// PropertyNotString, @@ -147,17 +149,17 @@ public enum JsErrorCode : uint InvalidContext, /// - /// The Module HostInfoKind provided was invalid + /// The Module HostInfoKind provided was invalid /// InvalidModuleHostInfoKind, /// - /// Module was parsed already when JsParseModuleSource is called + /// Module was parsed already when JsParseModuleSource is called /// ModuleParsed, /// - /// Argument passed to JsCreateWeakReference is a primitive that is not managed by the GC. + /// Argument passed to JsCreateWeakReference is a primitive that is not managed by the GC. /// No weak reference is required, the value will never be collected. /// NoWeakRefRequired, @@ -216,7 +218,7 @@ public enum JsErrorCode : uint ScriptTerminated, /// - /// A script was terminated because it tried to use eval or function and eval + /// A script was terminated because it tried to use eval or Function and eval /// was disabled /// ScriptEvalDisabled, diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsErrorHelpers.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsErrorHelpers.cs index 3b1b628e..66ab83fd 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsErrorHelpers.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsErrorHelpers.cs @@ -163,7 +163,7 @@ public static void ThrowIfError(JsErrorCode errorCode) } /// - /// Creates a new JavaScript error object + /// Creates a new JavaScript Error object /// /// /// Requires an active script context. @@ -179,7 +179,7 @@ public static JsValue CreateError(string message) } /// - /// Creates a new JavaScript RangeError error object + /// Creates a new JavaScript RangeError error object /// /// /// Requires an active script context. @@ -195,7 +195,7 @@ public static JsValue CreateRangeError(string message) } /// - /// Creates a new JavaScript ReferenceError error object + /// Creates a new JavaScript ReferenceError error object /// /// /// Requires an active script context. @@ -211,7 +211,7 @@ public static JsValue CreateReferenceError(string message) } /// - /// Creates a new JavaScript SyntaxError error object + /// Creates a new JavaScript SyntaxError error object /// /// /// Requires an active script context. @@ -227,7 +227,7 @@ public static JsValue CreateSyntaxError(string message) } /// - /// Creates a new JavaScript TypeError error object + /// Creates a new JavaScript TypeError error object /// /// /// Requires an active script context. @@ -243,7 +243,7 @@ public static JsValue CreateTypeError(string message) } /// - /// Creates a new JavaScript URIError error object + /// Creates a new JavaScript URIError error object /// /// /// Requires an active script context. diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsMemoryAllocationCallback.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsMemoryAllocationCallback.cs index a17a14c0..c16505a3 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsMemoryAllocationCallback.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsMemoryAllocationCallback.cs @@ -5,11 +5,11 @@ namespace JavaScriptEngineSwitcher.ChakraCore.JsRt /// /// User implemented callback routine for memory allocation events /// - /// The state passed to SetRuntimeMemoryAllocationCallback + /// The state passed to SetRuntimeMemoryAllocationCallback /// The type of type allocation event /// The size of the allocation - /// For the Allocate event, returning true allows the runtime to continue with - /// allocation. Returning false indicates the allocation request is rejected. The return value + /// For the Allocate event, returning true allows the runtime to continue with + /// allocation. Returning false indicates the allocation request is rejected. The return value /// is ignored for other allocation events. internal delegate bool JsMemoryAllocationCallback(IntPtr callbackState, JsMemoryEventType allocationEvent, UIntPtr allocationSize); } \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsNativeFunction.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsNativeFunction.cs index 3c2c2dc5..5ef45d2d 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsNativeFunction.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsNativeFunction.cs @@ -7,7 +7,7 @@ namespace JavaScriptEngineSwitcher.ChakraCore.JsRt /// The function callback /// /// The Function object that represents the function being invoked - /// Indicates whether this is a regular call or a 'new' call + /// Indicates whether this is a regular call or a new call /// The arguments to the call /// The number of arguments /// Callback data, if any diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsPropertyId.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsPropertyId.cs index 4e4f811b..9382d237 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsPropertyId.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsPropertyId.cs @@ -40,9 +40,7 @@ public static JsPropertyId Invalid /// Gets a name associated with the property ID /// /// - /// /// Requires an active script context. - /// /// public string Name { diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsRuntime.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsRuntime.cs index e4f23390..367d4f9e 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsRuntime.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsRuntime.cs @@ -15,9 +15,9 @@ namespace JavaScriptEngineSwitcher.ChakraCore.JsRt /// time. /// /// - /// NOTE: A JavaScriptRuntime, unlike other objects in the Chakra hosting API, is not + /// NOTE: A JsRuntime, unlike other objects in the Chakra hosting API, is not /// garbage collected since it contains the garbage collected heap itself. A runtime will - /// continue to exist until Dispose is called. + /// continue to exist until Dispose is called. /// /// internal struct JsRuntime : IDisposable @@ -121,7 +121,7 @@ public static JsRuntime Create(JsRuntimeAttributes attributes) /// Creates a new runtime /// /// The attributes of the runtime to be created - /// The thread service for the runtime. Can be null + /// The thread service for the runtime. Can be null /// The runtime created public static JsRuntime Create(JsRuntimeAttributes attributes, JsThreadServiceCallback threadServiceCallback) { @@ -147,7 +147,7 @@ public void CollectGarbage() /// Registering a memory allocation callback will cause the runtime to call back to the host /// whenever it acquires memory from, or releases memory to, the OS. The callback routine is /// called before the runtime memory manager allocates a block of memory. The allocation will - /// be rejected if the callback returns false. The runtime memory manager will also invoke the + /// be rejected if the callback returns false. The runtime memory manager will also invoke the /// callback routine after freeing a block of memory, as well as after allocation failures. /// /// diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsRuntimeAttributes.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsRuntimeAttributes.cs index e7ffa694..92d616e4 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsRuntimeAttributes.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsRuntimeAttributes.cs @@ -27,7 +27,7 @@ internal enum JsRuntimeAttributes AllowScriptInterrupt = 0x00000002, /// - /// Host will call Idle, so enable idle processing. Otherwise, the runtime will manage + /// Host will call Idle, so enable idle processing. Otherwise, the runtime will manage /// memory slightly more aggressively. /// EnableIdleProcessing = 0x00000004, @@ -38,7 +38,7 @@ internal enum JsRuntimeAttributes DisableNativeCodeGeneration = 0x00000008, /// - /// Using Eval or Function constructor will throw an exception + /// Using eval or Function constructor will throw an exception /// [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "Eval is a valid function name.")] DisableEval = 0x00000010, diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsSerializedLoadScriptCallback.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsSerializedLoadScriptCallback.cs index ff460a3e..62ba351a 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsSerializedLoadScriptCallback.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsSerializedLoadScriptCallback.cs @@ -7,7 +7,7 @@ /// by debuggable script contexts /// The script returned /// Attribute mask for parsing the script - /// true if the operation succeeded, false otherwise + /// true if the operation succeeded, false otherwise internal delegate bool JsSerializedLoadScriptCallback(JsSourceContext sourceContext, out JsValue value, out JsParseScriptAttributes parseAttributes); } \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsSerializedScriptLoadSourceCallback.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsSerializedScriptLoadSourceCallback.cs index 0e9718a1..90975001 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsSerializedScriptLoadSourceCallback.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsSerializedScriptLoadSourceCallback.cs @@ -2,10 +2,10 @@ { /// /// Called by the runtime to load the source code of the serialized script. - /// The caller must keep the script buffer valid until the JsSerializedScriptUnloadCallback. + /// The caller must keep the script buffer valid until the JsSerializedScriptUnloadCallback. /// - /// The context passed to Js[Parse|Run]SerializedScriptWithCallback + /// The context passed to Js[Parse|Run]SerializedScriptWithCallback /// The script returned - /// true if the operation succeeded, false otherwise + /// true if the operation succeeded, false otherwise internal delegate bool JsSerializedScriptLoadSourceCallback(JsSourceContext sourceContext, out string scriptBuffer); } \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsSerializedScriptUnloadCallback.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsSerializedScriptUnloadCallback.cs index 0dbb10f9..f474f3ec 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsSerializedScriptUnloadCallback.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsSerializedScriptUnloadCallback.cs @@ -4,6 +4,6 @@ /// Called by the runtime when it is finished with all resources related to the script execution. /// The caller should free the source if loaded, the byte code, and the context at this time. /// - /// The context passed to Js[Parse|Run]SerializedScriptWithCallback + /// The context passed to Js[Parse|Run]SerializedScriptWithCallback internal delegate void JsSerializedScriptUnloadCallback(JsSourceContext sourceContext); } \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsThreadServiceCallback.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsThreadServiceCallback.cs index d54579b0..7d5e67ad 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsThreadServiceCallback.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsThreadServiceCallback.cs @@ -9,7 +9,7 @@ namespace JavaScriptEngineSwitcher.ChakraCore.JsRt /// The host can specify a background thread service when creating a runtime. If /// specified, then background work items will be passed to the host using this callback. The /// host is expected to either begin executing the background work item immediately and return - /// true or return false and the runtime will handle the work item in-thread. + /// true or return false and the runtime will handle the work item in-thread. /// /// The callback for the background work item /// The data argument to be passed to the callback diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsValue.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsValue.cs index 5ee02c15..dded5494 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsValue.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsValue.cs @@ -16,8 +16,8 @@ namespace JavaScriptEngineSwitcher.ChakraCore.JsRt /// The JavaScript value /// /// - /// The JavaScript value is one of the following types of values: Undefined, Null, Boolean, - /// String, Number, or Object. + /// The JavaScript value is one of the following types of values: undefined, null, Boolean, + /// String, Number, or Object. /// internal struct JsValue { @@ -382,8 +382,8 @@ public static JsValue CreateObject() /// /// Requires an active script context. /// - /// External data that the object will represent. May be null. - /// The callback for when the object is finalized. May be null. + /// External data that the object will represent. May be null. + /// The callback for when the object is finalized. May be null. /// The new Object public static JsValue CreateExternalObject(IntPtr data, JsFinalizeCallback finalizer) { @@ -470,7 +470,7 @@ public static JsValue CreateExternalArrayBuffer(byte[] buffer) } /// - /// Creates a new JavaScript error object + /// Creates a new JavaScript Error object /// /// /// Requires an active script context. @@ -486,7 +486,7 @@ public static JsValue CreateError(JsValue message) } /// - /// Creates a new JavaScript RangeError error object + /// Creates a new JavaScript RangeError error object /// /// /// Requires an active script context. @@ -502,7 +502,7 @@ public static JsValue CreateRangeError(JsValue message) } /// - /// Creates a new JavaScript ReferenceError error object + /// Creates a new JavaScript ReferenceError error object /// /// /// Requires an active script context. @@ -518,7 +518,7 @@ public static JsValue CreateReferenceError(JsValue message) } /// - /// Creates a new JavaScript SyntaxError error object + /// Creates a new JavaScript SyntaxError error object /// /// /// Requires an active script context. @@ -534,7 +534,7 @@ public static JsValue CreateSyntaxError(JsValue message) } /// - /// Creates a new JavaScript TypeError error object + /// Creates a new JavaScript TypeError error object /// /// /// Requires an active script context. @@ -550,7 +550,7 @@ public static JsValue CreateTypeError(JsValue message) } /// - /// Creates a new JavaScript URIError error object + /// Creates a new JavaScript URIError error object /// /// /// Requires an active script context. @@ -570,8 +570,8 @@ public static JsValue CreateUriError(JsValue message) /// /// /// This only needs to be called on objects that are not going to be stored somewhere on - /// the stack. Calling AddRef ensures that the JavaScript object the value refers to will not be freed - /// until Release is called + /// the stack. Calling AddRef ensures that the JavaScript object the value refers to will not be freed + /// until Release is called /// /// The object's new reference count public uint AddRef() @@ -586,7 +586,7 @@ public uint AddRef() /// Releases a reference to the object /// /// - /// Removes a reference that was created by AddRef. + /// Removes a reference that was created by AddRef. /// /// The object's new reference count public uint Release() @@ -617,7 +617,7 @@ public bool ToBoolean() /// /// /// - /// This function retrieves the value of a Number value. It will fail with + /// This function retrieves the value of a Number value. It will fail with /// InvalidArgument if the type of the value is not Number. /// /// @@ -638,7 +638,7 @@ public double ToDouble() /// /// /// - /// This function retrieves the value of a Number value. It will fail with + /// This function retrieves the value of a Number value. It will fail with /// InvalidArgument if the type of the value is not Number. /// /// @@ -990,7 +990,7 @@ public void DeleteIndexedProperty(JsValue index) /// /// /// - /// This function is equivalent to the "==" operator in JavaScript. + /// This function is equivalent to the == operator in JavaScript. /// /// /// Requires an active script context. @@ -1011,7 +1011,7 @@ public bool Equals(JsValue other) /// /// /// - /// This function is equivalent to the "===" operator in JavaScript. + /// This function is equivalent to the === operator in JavaScript. /// /// /// Requires an active script context. @@ -1034,7 +1034,7 @@ public bool StrictEquals(JsValue other) /// Requires an active script context. /// /// The arguments to the call - /// The Value returned from the function invocation, if any + /// The JavaScript value returned from the function invocation, if any public JsValue CallFunction(params JsValue[] arguments) { JsValue returnReference; @@ -1056,7 +1056,7 @@ public JsValue CallFunction(params JsValue[] arguments) /// Requires an active script context. /// /// The arguments to the call - /// The Value returned from the function invocation + /// The JavaScript value returned from the function invocation public JsValue ConstructObject(params JsValue[] arguments) { JsValue returnReference; diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsValueType.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsValueType.cs index 913016e7..f541875c 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsValueType.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsValueType.cs @@ -1,7 +1,7 @@ namespace JavaScriptEngineSwitcher.ChakraCore.JsRt { /// - /// The JavaScript type of a JavaScriptValue + /// The JavaScript type of a JavaScript value /// internal enum JsValueType { @@ -16,47 +16,47 @@ internal enum JsValueType Null = 1, /// - /// The value is a JavaScript number value + /// The value is a JavaScript Number value /// Number = 2, /// - /// The value is a JavaScript string value + /// The value is a JavaScript String value /// String = 3, /// - /// The value is a JavaScript Boolean value + /// The value is a JavaScript Boolean value /// Boolean = 4, /// - /// The value is a JavaScript object value + /// The value is a JavaScript Object value /// Object = 5, /// - /// The value is a JavaScript function object value + /// The value is a JavaScript Function object value /// Function = 6, /// - /// The value is a JavaScript error object value + /// The value is a JavaScript Error object value /// Error = 7, /// - /// The value is a JavaScript array object value + /// The value is a JavaScript Array object value /// Array = 8, /// - /// The value is a JavaScript array object value + /// The value is a JavaScript Symbol object value /// Symbol = 9, /// - /// The value is a JavaScript ArrayBuffer object value + /// The value is a JavaScript ArrayBuffer object value /// ArrayBuffer = 10, @@ -66,7 +66,7 @@ internal enum JsValueType TypedArray = 11, /// - /// The value is a JavaScript DataView object value + /// The value is a JavaScript DataView object value /// DataView = 12 } diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/TypeMapper.cs b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/TypeMapper.cs index f8541d9f..3fef5501 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/TypeMapper.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/JsRt/TypeMapper.cs @@ -31,6 +31,11 @@ internal sealed class TypeMapper : IDisposable /// private const string ExternalObjectPropertyName = "_JavaScriptEngineSwitcher_externalObject"; + /// + /// Flag for whether to allow the usage of reflection API in the script code + /// + private readonly bool _allowReflection; + /// /// Storage for lazy-initialized embedded objects /// @@ -74,14 +79,17 @@ internal sealed class TypeMapper : IDisposable /// /// Flag indicating whether this object is disposed /// - private readonly InterlockedStatedFlag _disposedFlag = new InterlockedStatedFlag(); + private InterlockedStatedFlag _disposedFlag = new InterlockedStatedFlag(); /// /// Constructs an instance of type mapper /// - public TypeMapper() - { } + /// Flag for whether to allow the usage of reflection API in the script code + public TypeMapper(bool allowReflection) + { + _allowReflection = allowReflection; + } /// @@ -604,6 +612,11 @@ private void ProjectProperties(EmbeddedItem externalItem) foreach (PropertyInfo property in properties) { + if (!IsAvailableProperty(property)) + { + continue; + } + string propertyName = property.Name; JsValue descriptorValue = JsValue.CreateObject(); @@ -732,14 +745,13 @@ private void ProjectMethods(EmbeddedItem externalItem) string typeName = type.FullName; BindingFlags defaultBindingFlags = ReflectionHelpers.GetDefaultBindingFlags(instance); - IEnumerable methods = type.GetMethods(defaultBindingFlags) - .Where(ReflectionHelpers.IsFullyFledgedMethod); - IEnumerable> methodGroups = methods.GroupBy(m => m.Name); + MethodInfo[] methods = type.GetMethods(defaultBindingFlags); + Dictionary> availableMethodGroups = GetAvailableMethodGroups(methods); - foreach (IGrouping methodGroup in methodGroups) + foreach (KeyValuePair> methodGroup in availableMethodGroups) { string methodName = methodGroup.Key; - MethodInfo[] methodCandidates = methodGroup.ToArray(); + MethodInfo[] methodCandidates = methodGroup.Value.ToArray(); JsNativeFunction nativeFunction = (callee, isConstructCall, args, argCount, callbackData) => { @@ -808,6 +820,55 @@ private void ProjectMethods(EmbeddedItem externalItem) } } + [MethodImpl((MethodImplOptions)256 /* AggressiveInlining */)] + private bool IsAvailableProperty(PropertyInfo property) + { + if (_allowReflection) + { + return true; + } + + bool isAvailable = ReflectionHelpers.IsAllowedProperty(property); + + return isAvailable; + } + + [MethodImpl((MethodImplOptions)256 /* AggressiveInlining */)] + private Dictionary> GetAvailableMethodGroups(MethodInfo[] methods) + { + int methodCount = methods.Length; + if (methodCount == 0) + { + return new Dictionary>(); + } + + var availableMethodGroups = new Dictionary>(methodCount); + + foreach (MethodInfo method in methods) + { + if (!ReflectionHelpers.IsFullyFledgedMethod(method) + || (!_allowReflection && !ReflectionHelpers.IsAllowedMethod(method))) + { + continue; + } + + string methodName = method.Name; + List methodGroup; + + if (availableMethodGroups.TryGetValue(methodName, out methodGroup)) + { + methodGroup.Add(method); + } + else + { + methodGroup = new List { method }; + availableMethodGroups.Add(methodName, methodGroup); + } + } + + return availableMethodGroups; + } + private object[] GetHostItemMemberArguments(JsValue[] args, int maxArgCount = -1) { if (args == null) diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.ChakraCore/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..7ba63673 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.ChakraCore/PACKAGE-DESCRIPTION.md @@ -0,0 +1,13 @@ +JavaScriptEngineSwitcher.ChakraCore contains a `ChakraCoreJsEngine` adapter (wrapper for the [ChakraCore](https://github.com/chakra-core/ChakraCore)). +Project was based on the code of [Chakra-Samples](https://github.com/Microsoft/Chakra-Samples) and [jsrt-dotnet](https://github.com/robpaveza/jsrt-dotnet). + +This package does not contain the native implementations of ChakraCore. +Therefore, you need to choose and install the most appropriate package(s) for your platform. +The following packages are available: + + * [JavaScriptEngineSwitcher.ChakraCore.Native.win-x86](https://www.nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore.Native.win-x86) + * [JavaScriptEngineSwitcher.ChakraCore.Native.win-x64](https://www.nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore.Native.win-x64) + * [JavaScriptEngineSwitcher.ChakraCore.Native.win-arm](https://www.nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm) + * [JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64](https://www.nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64) + * [JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64](https://www.nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64) + * [JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64](https://www.nuget.org/packages/JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64) \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/Resources/Strings.Designer.cs b/src/JavaScriptEngineSwitcher.ChakraCore/Resources/Strings.Designer.cs index eb30c061..7547d486 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/Resources/Strings.Designer.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/Resources/Strings.Designer.cs @@ -21,7 +21,7 @@ internal class Strings private static Lazy _resourceManager = new Lazy(() => new ResourceManager( "JavaScriptEngineSwitcher.ChakraCore.Resources.Strings", -#if NET40 +#if NET20 || NET30 || NET35 || NET40 typeof(Strings).Assembly #else typeof(Strings).GetTypeInfo().Assembly diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/ScriptDispatcher.cs b/src/JavaScriptEngineSwitcher.ChakraCore/ScriptDispatcher.cs index 02e99015..fc19a767 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/ScriptDispatcher.cs +++ b/src/JavaScriptEngineSwitcher.ChakraCore/ScriptDispatcher.cs @@ -56,7 +56,7 @@ public ScriptDispatcher() /// Constructs an instance of script dispatcher /// /// The maximum stack size, in bytes, to be used by the thread, - /// or 0 to use the default maximum stack size specified in the header for the executable. + /// or 0 to use the default maximum stack size specified in the header for the executable. public ScriptDispatcher(int maxStackSize) { _thread = new Thread(StartThread, maxStackSize) @@ -150,7 +150,7 @@ private void ExecuteTask(ScriptTask task) /// /// Runs a specified delegate on the thread with modified stack size, - /// and returns its result as an . + /// and returns its result as an . /// Blocks until the invocation of delegate is completed. /// /// The type of the return value of the method, @@ -257,7 +257,7 @@ private abstract class ScriptTask : IDisposable /// /// Gets a exception, that occurred during the invocation of delegate. - /// If no exception has occurred, this will be null. + /// If no exception has occurred, this will be null. /// public Exception Exception { diff --git a/src/JavaScriptEngineSwitcher.ChakraCore/readme.txt b/src/JavaScriptEngineSwitcher.ChakraCore/readme.txt index c30dc048..c7484b48 100644 --- a/src/JavaScriptEngineSwitcher.ChakraCore/readme.txt +++ b/src/JavaScriptEngineSwitcher.ChakraCore/readme.txt @@ -1,17 +1,17 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: ChakraCore v3.19.0 + README file for JS Engine Switcher: ChakraCore v3.27.3 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2024 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== - JavaScriptEngineSwitcher.ChakraCore contains adapter `ChakraCoreJsEngine` + JavaScriptEngineSwitcher.ChakraCore contains a `ChakraCoreJsEngine` adapter (wrapper for the ChakraCore (https://github.com/chakra-core/ChakraCore)). Project was based on the code of Chakra-Samples (https://github.com/Microsoft/Chakra-Samples) and jsrt-dotnet @@ -31,8 +31,7 @@ ============= RELEASE NOTES ============= - Fixed a error #102 “Resources should conform to correct ICU standard for - naming”. Special thanks to Tim Heuer. + ChakraCore was updated to version of August 1, 2024. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.Core/Extensions/StringExtensions.cs b/src/JavaScriptEngineSwitcher.Core/Extensions/StringExtensions.cs index 0cd36afa..747d67c5 100644 --- a/src/JavaScriptEngineSwitcher.Core/Extensions/StringExtensions.cs +++ b/src/JavaScriptEngineSwitcher.Core/Extensions/StringExtensions.cs @@ -12,7 +12,7 @@ public static class StringExtensions /// /// Instance of /// The string without quotes to seek - /// true if the quoted value occurs within this string; otherwise, false + /// true if the quoted value occurs within this string; otherwise, false public static bool ContainsQuotedValue(this string source, string value) { if (source == null) @@ -89,7 +89,7 @@ public static string[] SplitToLines(this string source) /// When this method returns, contains the character from the string, /// if the receiving succeeded, or null character if the receiving failed. /// The receiving fails if the index out of bounds. - /// true if the character was received successfully; otherwise, false + /// true if the character was received successfully; otherwise, false internal static bool TryGetChar(this string source, int index, out char result) { if (source == null) diff --git a/src/JavaScriptEngineSwitcher.Core/Helpers/JsErrorHelpers.cs b/src/JavaScriptEngineSwitcher.Core/Helpers/JsErrorHelpers.cs index b295c5f3..d7d7969a 100644 --- a/src/JavaScriptEngineSwitcher.Core/Helpers/JsErrorHelpers.cs +++ b/src/JavaScriptEngineSwitcher.Core/Helpers/JsErrorHelpers.cs @@ -39,11 +39,6 @@ public static class JsErrorHelpers @")" + @"(?: -> (?[^\n\r]+))?$"); - /// - /// Regular expression for working with a line break - /// - private static readonly Regex _lineBreakRegex = new Regex("\r\n|\n|\r"); - /// /// Parses a string representation of the script error location to produce an array of /// instances diff --git a/src/JavaScriptEngineSwitcher.Core/Helpers/ValidationHelpers.cs b/src/JavaScriptEngineSwitcher.Core/Helpers/ValidationHelpers.cs index e65d0c96..cadeb669 100644 --- a/src/JavaScriptEngineSwitcher.Core/Helpers/ValidationHelpers.cs +++ b/src/JavaScriptEngineSwitcher.Core/Helpers/ValidationHelpers.cs @@ -46,7 +46,7 @@ public static class ValidationHelpers /// Checks whether supports a .NET type /// /// .NET type - /// Result of check (true - is supported; false - is not supported) + /// Result of check (true - is supported; false - is not supported) public static bool IsSupportedType(Type type) { bool result = _supportedTypes.Contains(type); @@ -58,7 +58,7 @@ public static bool IsSupportedType(Type type) /// Checks whether .NET type is primitive /// /// .NET type - /// Result of check (true - is primitive; false - is not primitive) + /// Result of check (true - is primitive; false - is not primitive) public static bool IsPrimitiveType(Type type) { TypeCode typeCode = type.GetTypeCode(); @@ -71,7 +71,7 @@ public static bool IsPrimitiveType(Type type) /// Checks a format of the name /// /// The name - /// Result of check (true - correct format; false - wrong format) + /// Result of check (true - correct format; false - wrong format) public static bool CheckNameFormat(string name) { return _jsNameRegex.IsMatch(name); @@ -81,7 +81,7 @@ public static bool CheckNameFormat(string name) /// Checks a format of the document name /// /// The document name - /// Result of check (true - correct format; false - wrong format) + /// Result of check (true - correct format; false - wrong format) public static bool CheckDocumentNameFormat(string name) { return _documentNameRegex.IsMatch(name); diff --git a/src/JavaScriptEngineSwitcher.Core/IJsEngine.cs b/src/JavaScriptEngineSwitcher.Core/IJsEngine.cs index 2485836e..ba656df0 100644 --- a/src/JavaScriptEngineSwitcher.Core/IJsEngine.cs +++ b/src/JavaScriptEngineSwitcher.Core/IJsEngine.cs @@ -314,10 +314,10 @@ bool SupportsGarbageCollection T CallFunction(string functionName, params object[] args); /// - /// Сhecks for the existence of a variable + /// Checks for the existence of a variable /// /// Variable name - /// Result of check (true - exists; false - not exists + /// Result of check (true - exists; false - not exists /// /// /// @@ -376,9 +376,11 @@ bool SupportsGarbageCollection /// /// Embeds a host object to script code /// + /// + /// Allows to embed instances of simple classes (or structures) and delegates. + /// /// The name for the new global variable or function that will represent the object /// The object to expose - /// Allows to embed instances of simple classes (or structures) and delegates. /// /// /// @@ -388,12 +390,12 @@ bool SupportsGarbageCollection /// /// Embeds a host type to script code /// - /// The name for the new global variable that will represent the type - /// The type to expose /// /// Host types are exposed to script code in the form of objects whose properties and /// methods are bound to the type's static members. /// + /// The name for the new global variable that will represent the type + /// The type to expose /// /// /// diff --git a/src/JavaScriptEngineSwitcher.Core/JavaScriptEngineSwitcher.Core.csproj b/src/JavaScriptEngineSwitcher.Core/JavaScriptEngineSwitcher.Core.csproj index 24ece701..911456c6 100644 --- a/src/JavaScriptEngineSwitcher.Core/JavaScriptEngineSwitcher.Core.csproj +++ b/src/JavaScriptEngineSwitcher.Core/JavaScriptEngineSwitcher.Core.csproj @@ -2,12 +2,13 @@ JS Engine Switcher: Core - 3.19.0 + 3.24.1 net40-client;net45;netstandard1.3;netstandard2.0 1.6.0 Library true - $(NoWarn);CS1591 + $(NoWarn);CS1591;NETSDK1215;NU1903 + false true true @@ -18,15 +19,15 @@ - JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines (MSIE JavaScript Engine for .NET, Microsoft ClearScript.V8, Jurassic, Jint, ChakraCore, VroomJs and NiL.JS). This library allows you to quickly and easily switch to using of another JavaScript engine. - $(PackageCommonTags) + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_Core_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_Core_Logo128x128.png - Fixed a error #102 “Resources should conform to correct ICU standard for naming”. Special thanks to Tim Heuer. + JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines. This library allows you to quickly and easily switch to using of another JavaScript engine. + $(PackageCommonTags) - - + + @@ -34,19 +35,10 @@ - - advanced-string-builder-license.txt - true - false - - - - readme.txt - true - + - + diff --git a/src/JavaScriptEngineSwitcher.Core/JsEngineBase.cs b/src/JavaScriptEngineSwitcher.Core/JsEngineBase.cs index 3449fa1b..d2efe334 100644 --- a/src/JavaScriptEngineSwitcher.Core/JsEngineBase.cs +++ b/src/JavaScriptEngineSwitcher.Core/JsEngineBase.cs @@ -97,16 +97,19 @@ protected virtual void InnerCollectGarbage() #region IJsEngine implementation + /// public abstract string Name { get; } + /// public abstract string Version { get; } + /// public virtual bool SupportsScriptPrecompilation { get @@ -115,6 +118,7 @@ public virtual bool SupportsScriptPrecompilation } } + /// public virtual bool SupportsScriptInterruption { get @@ -123,6 +127,7 @@ public virtual bool SupportsScriptInterruption } } + /// public virtual bool SupportsGarbageCollection { get @@ -132,6 +137,7 @@ public virtual bool SupportsGarbageCollection } + /// public virtual IPrecompiledScript Precompile(string code) { VerifyNotDisposed(); @@ -155,6 +161,7 @@ public virtual IPrecompiledScript Precompile(string code) return InnerPrecompile(code); } + /// public virtual IPrecompiledScript Precompile(string code, string documentName) { VerifyNotDisposed(); @@ -187,6 +194,7 @@ public virtual IPrecompiledScript Precompile(string code, string documentName) return InnerPrecompile(code, documentName); } + /// public virtual IPrecompiledScript PrecompileFile(string path, Encoding encoding = null) { VerifyNotDisposed(); @@ -227,6 +235,7 @@ public virtual IPrecompiledScript PrecompileFile(string path, Encoding encoding return InnerPrecompile(code, path); } + /// public virtual IPrecompiledScript PrecompileResource(string resourceName, Type type) { VerifyNotDisposed(); @@ -283,6 +292,7 @@ public virtual IPrecompiledScript PrecompileResource(string resourceName, Type t return InnerPrecompile(code, resourceName); } + /// public virtual IPrecompiledScript PrecompileResource(string resourceName, Assembly assembly) { VerifyNotDisposed(); @@ -331,6 +341,7 @@ public virtual IPrecompiledScript PrecompileResource(string resourceName, Assemb return InnerPrecompile(code, resourceName); } + /// public virtual object Evaluate(string expression) { VerifyNotDisposed(); @@ -354,6 +365,7 @@ public virtual object Evaluate(string expression) return InnerEvaluate(expression); } + /// public virtual object Evaluate(string expression, string documentName) { VerifyNotDisposed(); @@ -386,6 +398,7 @@ public virtual object Evaluate(string expression, string documentName) return InnerEvaluate(expression, documentName); } + /// public virtual T Evaluate(string expression) { VerifyNotDisposed(); @@ -418,6 +431,7 @@ public virtual T Evaluate(string expression) return InnerEvaluate(expression); } + /// public virtual T Evaluate(string expression, string documentName) { VerifyNotDisposed(); @@ -459,6 +473,7 @@ public virtual T Evaluate(string expression, string documentName) return InnerEvaluate(expression, documentName); } + /// public virtual void Execute(string code) { VerifyNotDisposed(); @@ -482,6 +497,7 @@ public virtual void Execute(string code) InnerExecute(code); } + /// public virtual void Execute(string code, string documentName) { VerifyNotDisposed(); @@ -514,6 +530,7 @@ public virtual void Execute(string code, string documentName) InnerExecute(code, documentName); } + /// public virtual void Execute(IPrecompiledScript precompiledScript) { VerifyNotDisposed(); @@ -538,6 +555,7 @@ public virtual void Execute(IPrecompiledScript precompiledScript) InnerExecute(precompiledScript); } + /// public virtual void ExecuteFile(string path, Encoding encoding = null) { VerifyNotDisposed(); @@ -578,6 +596,7 @@ public virtual void ExecuteFile(string path, Encoding encoding = null) InnerExecute(code, path); } + /// public virtual void ExecuteResource(string resourceName, Type type) { VerifyNotDisposed(); @@ -634,6 +653,7 @@ public virtual void ExecuteResource(string resourceName, Type type) InnerExecute(code, resourceName); } + /// public virtual void ExecuteResource(string resourceName, Assembly assembly) { VerifyNotDisposed(); @@ -682,6 +702,7 @@ public virtual void ExecuteResource(string resourceName, Assembly assembly) InnerExecute(code, resourceName); } + /// public virtual object CallFunction(string functionName, params object[] args) { VerifyNotDisposed(); @@ -736,6 +757,7 @@ public virtual object CallFunction(string functionName, params object[] args) return InnerCallFunction(functionName, args); } + /// public virtual T CallFunction(string functionName, params object[] args) { VerifyNotDisposed(); @@ -799,6 +821,7 @@ public virtual T CallFunction(string functionName, params object[] args) return InnerCallFunction(functionName, args); } + /// public virtual bool HasVariable(string variableName) { VerifyNotDisposed(); @@ -830,6 +853,7 @@ public virtual bool HasVariable(string variableName) return InnerHasVariable(variableName); } + /// public virtual object GetVariableValue(string variableName) { VerifyNotDisposed(); @@ -861,6 +885,7 @@ public virtual object GetVariableValue(string variableName) return InnerGetVariableValue(variableName); } + /// public virtual T GetVariableValue(string variableName) { VerifyNotDisposed(); @@ -901,6 +926,7 @@ public virtual T GetVariableValue(string variableName) return InnerGetVariableValue(variableName); } + /// public virtual void SetVariableValue(string variableName, object value) { VerifyNotDisposed(); @@ -946,6 +972,7 @@ public virtual void SetVariableValue(string variableName, object value) InnerSetVariableValue(variableName, value); } + /// public virtual void RemoveVariable(string variableName) { VerifyNotDisposed(); @@ -977,6 +1004,7 @@ public virtual void RemoveVariable(string variableName) InnerRemoveVariable(variableName); } + /// public virtual void EmbedHostObject(string itemName, object value) { VerifyNotDisposed(); @@ -1028,6 +1056,7 @@ public virtual void EmbedHostObject(string itemName, object value) InnerEmbedHostObject(itemName, value); } + /// public virtual void EmbedHostType(string itemName, Type type) { VerifyNotDisposed(); @@ -1075,6 +1104,7 @@ public virtual void EmbedHostType(string itemName, Type type) InnerEmbedHostType(itemName, type); } + /// public virtual void Interrupt() { VerifyNotDisposed(); @@ -1082,6 +1112,7 @@ public virtual void Interrupt() InnerInterrupt(); } + /// public virtual void CollectGarbage() { VerifyNotDisposed(); diff --git a/src/JavaScriptEngineSwitcher.Core/JsEngineFactoryCollection.cs b/src/JavaScriptEngineSwitcher.Core/JsEngineFactoryCollection.cs index 6b4df06c..632edba2 100644 --- a/src/JavaScriptEngineSwitcher.Core/JsEngineFactoryCollection.cs +++ b/src/JavaScriptEngineSwitcher.Core/JsEngineFactoryCollection.cs @@ -38,7 +38,7 @@ public ReadOnlyCollection GetRegisteredFactories() /// Gets a factory by JS engine name /// /// Name of JS engine - /// Instance of corresponding JS engine factory or null if factory is not found + /// Instance of corresponding JS engine factory or null if factory is not found public IJsEngineFactory Get(string engineName) { if (_factories.ContainsKey(engineName)) diff --git a/src/JavaScriptEngineSwitcher.Core/JsEngineSwitcher.cs b/src/JavaScriptEngineSwitcher.Core/JsEngineSwitcher.cs index 920504dd..6ccf8d9f 100644 --- a/src/JavaScriptEngineSwitcher.Core/JsEngineSwitcher.cs +++ b/src/JavaScriptEngineSwitcher.Core/JsEngineSwitcher.cs @@ -9,6 +9,11 @@ namespace JavaScriptEngineSwitcher.Core /// public sealed class JsEngineSwitcher : IJsEngineSwitcher { + /// + /// Flag for whether to allow usage of the property + /// + private static bool _allowCurrentProperty = true; + /// /// Default instance of JS engine switcher /// @@ -20,6 +25,19 @@ private static readonly Lazy _default /// private static IJsEngineSwitcher _current; + /// + /// Gets or sets a flag for whether to allow usage of the property + /// + /// + /// Required to ensure the usage of an instance of the JS engine switcher that is registered by using + /// the IServiceCollection interface. + /// + public static bool AllowCurrentProperty + { + get { return _allowCurrentProperty; } + set { _allowCurrentProperty = value; } + } + /// /// Gets or sets a instance of JS engine switcher /// @@ -27,10 +45,22 @@ public static IJsEngineSwitcher Current { get { + if (!_allowCurrentProperty) + { + throw new InvalidOperationException( + Strings.Configuration_GettingFromJsEngineSwitcherCurrentPropertyForbidden); + } + return _current ?? _default.Value; } set { + if (!_allowCurrentProperty) + { + throw new InvalidOperationException( + Strings.Configuration_AssigningToJsEngineSwitcherCurrentPropertyForbidden); + } + _current = value; } } @@ -71,18 +101,14 @@ public JsEngineSwitcher(JsEngineFactoryCollection engineFactories, string defaul #region IJsEngineSwitcher implementation - /// - /// Gets or sets a name of default JS engine - /// + /// public string DefaultEngineName { get; set; } - /// - /// Gets a collection of JS engine factories - /// + /// public JsEngineFactoryCollection EngineFactories { get; @@ -90,11 +116,7 @@ public JsEngineFactoryCollection EngineFactories } - /// - /// Creates a instance of JS engine - /// - /// JS engine name - /// JS engine + /// public IJsEngine CreateEngine(string name) { IJsEngine engine; @@ -113,10 +135,7 @@ public IJsEngine CreateEngine(string name) return engine; } - /// - /// Creates a instance of default JS engine - /// - /// JS engine + /// public IJsEngine CreateDefaultEngine() { string defaultJsEngineName = DefaultEngineName; diff --git a/src/JavaScriptEngineSwitcher.Core/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.Core/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..663374d6 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Core/PACKAGE-DESCRIPTION.md @@ -0,0 +1,2 @@ +JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines ([ChakraCore](https://github.com/chakra-core/ChakraCore), [Jint](https://github.com/sebastienros/jint), [Jurassic](https://github.com/paulbartrum/jurassic), [MSIE JavaScript Engine for .NET](https://github.com/Taritsyn/MsieJavaScriptEngine), [NiL.JS](https://github.com/nilproject/NiL.JS), [Jering.Javascript.NodeJS](https://github.com/JeringTech/Javascript.NodeJS), [Microsoft ClearScript.V8](https://github.com/Microsoft/ClearScript), [VroomJs](https://github.com/pauldotknopf/vroomjs-core) and [YantraJS](https://yantrajs.com/)). +This library allows you to quickly and easily switch to using of another JavaScript engine. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Core/Resources/Strings.Designer.cs b/src/JavaScriptEngineSwitcher.Core/Resources/Strings.Designer.cs index 4abda526..8dc14700 100644 --- a/src/JavaScriptEngineSwitcher.Core/Resources/Strings.Designer.cs +++ b/src/JavaScriptEngineSwitcher.Core/Resources/Strings.Designer.cs @@ -21,7 +21,7 @@ public class Strings private static Lazy _resourceManager = new Lazy(() => new ResourceManager( "JavaScriptEngineSwitcher.Core.Resources.Strings", -#if NET40 +#if NET20 || NET30 || NET35 || NET40 typeof(Strings).Assembly #else typeof(Strings).GetTypeInfo().Assembly @@ -137,6 +137,14 @@ public static string Common_ValueTypeCannotBeNull get { return GetString("Common_ValueTypeCannotBeNull"); } } + /// + /// Looks up a localized string similar to "Assigning an instance of the JS engine switcher to the `Current` property of `JsEngineSwitcher`..." + /// + public static string Configuration_AssigningToJsEngineSwitcherCurrentPropertyForbidden + { + get { return GetString("Configuration_AssigningToJsEngineSwitcherCurrentPropertyForbidden"); } + } + /// /// Looks up a localized string similar to "Name of default JavaScript engine not specified." /// @@ -145,6 +153,14 @@ public static string Configuration_DefaultJsEngineNameNotSpecified get { return GetString("Configuration_DefaultJsEngineNameNotSpecified"); } } + /// + /// Looks up a localized string similar to "Getting an instance of the JS engine switcher from the `Current` property of `JsEngineSwitcher`..." + /// + public static string Configuration_GettingFromJsEngineSwitcherCurrentPropertyForbidden + { + get { return GetString("Configuration_GettingFromJsEngineSwitcherCurrentPropertyForbidden"); } + } + /// /// Looks up a localized string similar to "Could not find a factory, that creates an instance of the JavaScript engine with name `{0}`." /// @@ -338,7 +354,7 @@ public static string Usage_CannotConvertPrecompiledScriptToInternalType } /// - /// Looks up a localized string similar to "Сannot execute a '{0}' file, because it is empty." + /// Looks up a localized string similar to "Cannot execute a '{0}' file, because it is empty." /// public static string Usage_CannotExecuteEmptyFile { @@ -346,7 +362,7 @@ public static string Usage_CannotExecuteEmptyFile } /// - /// Looks up a localized string similar to "Сannot execute a '{0}' resource, because it is empty." + /// Looks up a localized string similar to "Cannot execute a '{0}' resource, because it is empty." /// public static string Usage_CannotExecuteEmptyResource { @@ -354,7 +370,7 @@ public static string Usage_CannotExecuteEmptyResource } /// - /// Looks up a localized string similar to "Сannot execute a pre-compiled script, because it was created for another JS engine with name `{0}`." + /// Looks up a localized string similar to "Cannot execute a pre-compiled script, because it was created for another JS engine with name `{0}`." /// public static string Usage_CannotExecutePrecompiledScriptForAnotherJsEngine { @@ -362,7 +378,7 @@ public static string Usage_CannotExecutePrecompiledScriptForAnotherJsEngine } /// - /// Looks up a localized string similar to "Сannot pre-compile a '{0}' file, because it is empty." + /// Looks up a localized string similar to "Cannot pre-compile a '{0}' file, because it is empty." /// public static string Usage_CannotPrecompileEmptyFile { @@ -370,7 +386,7 @@ public static string Usage_CannotPrecompileEmptyFile } /// - /// Looks up a localized string similar to "Сannot pre-compile a '{0}' resource, because it is empty." + /// Looks up a localized string similar to "Cannot pre-compile a '{0}' resource, because it is empty." /// public static string Usage_CannotPrecompileEmptyResource { diff --git a/src/JavaScriptEngineSwitcher.Core/Resources/Strings.resx b/src/JavaScriptEngineSwitcher.Core/Resources/Strings.resx index 85f6dd1b..d72925bf 100644 --- a/src/JavaScriptEngineSwitcher.Core/Resources/Strings.resx +++ b/src/JavaScriptEngineSwitcher.Core/Resources/Strings.resx @@ -147,9 +147,15 @@ Cannot convert null to a value type. + + Assigning an instance of the JS engine switcher to the `Current` property of `JsEngineSwitcher` class is forbidden. To register an instance of the JS engine switcher, use the `IServiceCollection` interface or set the `AllowCurrentProperty` property of `JsEngineSwitcher` class to `true`. + Name of default JavaScript engine not specified. + + Getting an instance of the JS engine switcher from the `Current` property of `JsEngineSwitcher` class is forbidden. To get an instance of the JS engine switcher, use the `IServiceCollection` interface or set the `AllowCurrentProperty` property of `JsEngineSwitcher` class to `true`. + Could not find a factory, that creates an instance of the JavaScript engine with name `{0}`. @@ -223,19 +229,19 @@ Cannot convert a pre-compiled script to internal type `{0}`. - Сannot execute a '{0}' file, because it is empty. + Cannot execute a '{0}' file, because it is empty. - Сannot execute a '{0}' resource, because it is empty. + Cannot execute a '{0}' resource, because it is empty. - Сannot execute a pre-compiled script, because it was created for another JS engine with name `{0}`. + Cannot execute a pre-compiled script, because it was created for another JS engine with name `{0}`. - Сannot pre-compile a '{0}' file, because it is empty. + Cannot pre-compile a '{0}' file, because it is empty. - Сannot pre-compile a '{0}' resource, because it is empty. + Cannot pre-compile a '{0}' resource, because it is empty. The embedded host object '{0}' has a type `{1}`, which is not supported. diff --git a/src/JavaScriptEngineSwitcher.Core/Resources/Strings.ru-RU.resx b/src/JavaScriptEngineSwitcher.Core/Resources/Strings.ru-RU.resx index 8f1a2f20..a51ccdf8 100644 --- a/src/JavaScriptEngineSwitcher.Core/Resources/Strings.ru-RU.resx +++ b/src/JavaScriptEngineSwitcher.Core/Resources/Strings.ru-RU.resx @@ -147,9 +147,15 @@ Невозможно преобразовать null в значимый тип! + + Присвоение экземпляра JS engine switcher свойству `Current` класса `JsEngineSwitcher` запрещено. Для регистрации экземпляра JS engine switcher используйте интерфейс `IServiceCollection` или присвойте свойству `AllowCurrentProperty` класса `JsEngineSwitcher` значение равное `true`. + Не указано имя JavaScript-движка, который должен использоваться по умолчанию! + + Присвоение экземпляра JS engine switcher свойству `Current` класса `JsEngineSwitcher` запрещено. Для регистрации экземпляра JS engine switcher используйте интерфейс `IServiceCollection` или присвойте свойству `AllowCurrentProperty` класса `JsEngineSwitcher` значение равное `true`. + Не удалось найти фабрику, создающую экземпляр JavaScript-движка с именем `{0}`! diff --git a/src/JavaScriptEngineSwitcher.Core/Undefined.cs b/src/JavaScriptEngineSwitcher.Core/Undefined.cs index d9fb7f96..0340b9e8 100644 --- a/src/JavaScriptEngineSwitcher.Core/Undefined.cs +++ b/src/JavaScriptEngineSwitcher.Core/Undefined.cs @@ -1,12 +1,12 @@ namespace JavaScriptEngineSwitcher.Core { /// - /// Represents an JS undefined type + /// Represents an JS undefined type /// public sealed class Undefined { /// - /// Gets a one and only undefined instance + /// Gets a one and only undefined instance /// public static readonly Undefined Value = new Undefined(); diff --git a/src/JavaScriptEngineSwitcher.Core/Utilities/TypeConverter.cs b/src/JavaScriptEngineSwitcher.Core/Utilities/TypeConverter.cs index 1752ce92..fcd47cd4 100644 --- a/src/JavaScriptEngineSwitcher.Core/Utilities/TypeConverter.cs +++ b/src/JavaScriptEngineSwitcher.Core/Utilities/TypeConverter.cs @@ -50,7 +50,7 @@ public static object ConvertToType(object value, Type targetType) /// The type to convert the value to /// The value to convert /// The value that has been converted to the target type - /// Result of conversion (true - success; false - failure) + /// Result of conversion (true - success; false - failure) public static bool TryConvertToType(object value, out T convertedValue) { object resultValue; @@ -68,7 +68,7 @@ public static bool TryConvertToType(object value, out T convertedValue) /// The value to convert /// The type to convert the value to /// The value that has been converted to the target type - /// Result of conversion (true - success; false - failure) + /// Result of conversion (true - success; false - failure) public static bool TryConvertToType(object value, Type targetType, out object convertedValue) { bool result = ConvertObjectToType(value, targetType, false, out convertedValue); diff --git a/src/JavaScriptEngineSwitcher.Core/Utilities/Utils.cs b/src/JavaScriptEngineSwitcher.Core/Utilities/Utils.cs index 60bd2028..f26cd11b 100644 --- a/src/JavaScriptEngineSwitcher.Core/Utilities/Utils.cs +++ b/src/JavaScriptEngineSwitcher.Core/Utilities/Utils.cs @@ -31,7 +31,7 @@ static Utils() /// /// Determines whether the current runtime is Mono /// - /// true if the runtime is Mono; otherwise, false + /// true if the runtime is Mono; otherwise, false public static bool IsMonoRuntime() { return _isMonoRuntime; @@ -40,7 +40,7 @@ public static bool IsMonoRuntime() /// /// Determines whether the current process is a 64-bit process /// - /// true if the process is 64-bit; otherwise, false + /// true if the process is 64-bit; otherwise, false [MethodImpl((MethodImplOptions)256 /* AggressiveInlining */)] public static bool Is64BitProcess() { @@ -59,7 +59,7 @@ public static bool Is64BitProcess() /// The case-sensitive resource name without the namespace of the specified type /// The type, that determines the assembly and whose namespace is used to scope /// the resource name - /// Сontent of the embedded resource as string + /// Content of the embedded resource as string public static string GetResourceAsString(string resourceName, Type type) { if (resourceName == null) @@ -102,7 +102,7 @@ public static string GetResourceAsString(string resourceName, Type type) /// /// The case-sensitive resource name /// The assembly, which contains the embedded resource - /// Сontent of the embedded resource as string + /// Content of the embedded resource as string public static string GetResourceAsString(string resourceName, Assembly assembly) { if (resourceName == null) diff --git a/src/JavaScriptEngineSwitcher.Core/readme.txt b/src/JavaScriptEngineSwitcher.Core/readme.txt index 081d2eb2..cf5e35d8 100644 --- a/src/JavaScriptEngineSwitcher.Core/readme.txt +++ b/src/JavaScriptEngineSwitcher.Core/readme.txt @@ -1,27 +1,21 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: Core v3.19.0 + README file for JS Engine Switcher: Core v3.24.1 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2024 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== JavaScript Engine Switcher determines unified interface for access to the basic - features of popular JavaScript engines (MSIE JavaScript Engine for .NET, - Microsoft ClearScript.V8, Jurassic, Jint, ChakraCore, VroomJs and NiL.JS). This - library allows you to quickly and easily switch to using of another JavaScript - engine. - - ============= - RELEASE NOTES - ============= - Fixed a error #102 “Resources should conform to correct ICU standard for - naming”. Special thanks to Tim Heuer. + features of popular JavaScript engines (ChakraCore, Jint, Jurassic, MSIE + JavaScript Engine for .NET, NiL.JS, Jering.Javascript.NodeJS, Microsoft + ClearScript.V8, VroomJs and YantraJS). This library allows you to quickly and + easily switch to using of another JavaScript engine. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection.csproj b/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection.csproj index 99de8b99..906de85a 100644 --- a/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection.csproj +++ b/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection.csproj @@ -2,12 +2,13 @@ JS Engine Switcher: MS Dependency Injection - 3.19.0 + 3.24.1 net45;netstandard1.3;netstandard2.0 1.6.0 Library true - $(NoWarn);CS1591 + $(NoWarn);CS1591;NETSDK1215;NU1903 + false true @@ -16,9 +17,10 @@ + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_Extensions_MsDependencyInjection_Logo128x128.png + ../../Icons/JavaScriptEngineSwitcher_Extensions_MsDependencyInjection_Logo128x128.png JavaScriptEngineSwitcher.Extensions.MsDependencyInjection contains extension methods for adding the JS engine switcher in an `IServiceCollection`. $(PackageCommonTags);DI - ../../Icons/JavaScriptEngineSwitcher_Extensions_MsDependencyInjection_Logo128x128.png @@ -33,11 +35,4 @@ - - - readme.txt - true - - - \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/JsEngineSwitcherOptions.cs b/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/JsEngineSwitcherOptions.cs new file mode 100644 index 00000000..f22887a3 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/JsEngineSwitcherOptions.cs @@ -0,0 +1,42 @@ +using JavaScriptEngineSwitcher.Core; + +namespace JavaScriptEngineSwitcher.Extensions.MsDependencyInjection +{ + /// + /// Options of the JS engine switcher + /// + public sealed class JsEngineSwitcherOptions + { + /// + /// Gets or sets a flag for whether to allow usage of the property + /// + /// + /// Required to ensure the usage of an instance of the JS engine switcher that is registered by using + /// the IServiceCollection interface. + /// + public bool AllowCurrentProperty + { + get; + set; + } + + /// + /// Gets or sets a name of default JS engine + /// + public string DefaultEngineName + { + get; + set; + } + + + /// + /// Constructs an instance of the JS engine switcher options + /// + public JsEngineSwitcherOptions() + { + AllowCurrentProperty = true; + DefaultEngineName = string.Empty; + } + } +} \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/JsEngineSwitcherServiceCollectionExtensions.cs b/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/JsEngineSwitcherServiceCollectionExtensions.cs index 38ec18ff..624b2f76 100644 --- a/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/JsEngineSwitcherServiceCollectionExtensions.cs +++ b/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/JsEngineSwitcherServiceCollectionExtensions.cs @@ -7,26 +7,37 @@ namespace JavaScriptEngineSwitcher.Extensions.MsDependencyInjection { /// - /// Extension methods for adding the JS engine switcher in an + /// Extension methods for adding the JS engine switcher in an /// public static class JsEngineSwitcherServiceCollectionExtensions { /// - /// Adds a default instance of JS engine switcher to + /// Adds a default instance of the JS engine switcher to the /// /// The services available in the application - /// Instance of + /// Instance of the public static JsEngineFactoryCollection AddJsEngineSwitcher(this IServiceCollection services) { - return AddJsEngineSwitcher(services, (IJsEngineSwitcher)null); + if (services == null) + { + throw new ArgumentNullException(nameof(services)); + } + + var options = new JsEngineSwitcherOptions(); + + IJsEngineSwitcher engineSwitcher = CreateJsEngineSwitcher(options); + ApplyOptionsToJsEngineSwitcher(engineSwitcher, options); + RegisterJsEngineSwitcher(services, engineSwitcher, options); + + return engineSwitcher.EngineFactories; } /// - /// Adds a specified instance of JS engine switcher to + /// Adds a specified instance of the JS engine switcher to the /// /// The services available in the application - /// Instance of JS engine switcher - /// Instance of + /// Instance of the JS engine switcher + /// Instance of the public static JsEngineFactoryCollection AddJsEngineSwitcher(this IServiceCollection services, IJsEngineSwitcher engineSwitcher) { @@ -35,61 +46,149 @@ public static JsEngineFactoryCollection AddJsEngineSwitcher(this IServiceCollect throw new ArgumentNullException(nameof(services)); } - // Set the current instance of JS engine switcher - JsEngineSwitcher.Current = engineSwitcher; + if (engineSwitcher == null) + { + throw new ArgumentNullException(nameof(engineSwitcher)); + } - // Get the current instance of JS engine switcher - IJsEngineSwitcher currentEngineSwitcher = JsEngineSwitcher.Current; + var options = new JsEngineSwitcherOptions(); - // Register the current instance of JS engine switcher as a service - services.AddSingleton(currentEngineSwitcher); + IJsEngineSwitcher currentEngineSwitcher = GetJsEngineSwitcher(engineSwitcher, options); + ApplyOptionsToJsEngineSwitcher(currentEngineSwitcher, options); + RegisterJsEngineSwitcher(services, currentEngineSwitcher, options); return currentEngineSwitcher.EngineFactories; } /// - /// Adds a default instance of JS engine switcher to + /// Adds a default instance of the JS engine switcher to the /// /// The services available in the application - /// The which need to be configured - /// Instance of + /// The which need to be configured + /// Instance of the public static JsEngineFactoryCollection AddJsEngineSwitcher(this IServiceCollection services, - Action configure) + Action configure) { - return AddJsEngineSwitcher(services, null, configure); + if (services == null) + { + throw new ArgumentNullException(nameof(services)); + } + + if (configure == null) + { + throw new ArgumentNullException(nameof(configure)); + } + + var options = new JsEngineSwitcherOptions(); + configure(options); + + IJsEngineSwitcher engineSwitcher = CreateJsEngineSwitcher(options); + ApplyOptionsToJsEngineSwitcher(engineSwitcher, options); + RegisterJsEngineSwitcher(services, engineSwitcher, options); + + return engineSwitcher.EngineFactories; } /// - /// Adds a specified instance of JS engine switcher to + /// Adds a specified instance of the JS engine switcher to /// /// The services available in the application - /// Instance of JS engine switcher - /// The which need to be configured - /// Instance of + /// Instance of the JS engine switcher + /// The which need to be configured + /// Instance of the public static JsEngineFactoryCollection AddJsEngineSwitcher(this IServiceCollection services, - IJsEngineSwitcher engineSwitcher, Action configure) + IJsEngineSwitcher engineSwitcher, Action configure) { if (services == null) { throw new ArgumentNullException(nameof(services)); } + if (engineSwitcher == null) + { + throw new ArgumentNullException(nameof(engineSwitcher)); + } + if (configure == null) { throw new ArgumentNullException(nameof(configure)); } - // Set the current instance of JS engine switcher - JsEngineSwitcher.Current = engineSwitcher; + var options = new JsEngineSwitcherOptions(); + configure(options); - // Get and configure the current instance of JS engine switcher - IJsEngineSwitcher currentEngineSwitcher = JsEngineSwitcher.Current; - configure(currentEngineSwitcher); + IJsEngineSwitcher currentEngineSwitcher = GetJsEngineSwitcher(engineSwitcher, options); + ApplyOptionsToJsEngineSwitcher(currentEngineSwitcher, options); + RegisterJsEngineSwitcher(services, currentEngineSwitcher, options); + return currentEngineSwitcher.EngineFactories; + } + + #region Helper methods + + /// + /// Creates an instance of the JS engine switcher + /// + /// Options of the JS engine switcher + /// Instance of the JS engine switcher + private static IJsEngineSwitcher CreateJsEngineSwitcher(JsEngineSwitcherOptions options) + { + IJsEngineSwitcher engineSwitcher = options.AllowCurrentProperty ? + JsEngineSwitcher.Current + : + new JsEngineSwitcher() + ; + + return engineSwitcher; + } + + /// + /// Gets a instance of the JS engine switcher + /// + /// Instance of the JS engine switcher + /// Options of the JS engine switcher + /// Current instance of the JS engine switcher + private static IJsEngineSwitcher GetJsEngineSwitcher(IJsEngineSwitcher engineSwitcher, JsEngineSwitcherOptions options) + { + IJsEngineSwitcher currentEngineSwitcher = options.AllowCurrentProperty ? + JsEngineSwitcher.Current + : + engineSwitcher + ; + + return currentEngineSwitcher; + } + + /// + /// Applies a options to the JS engine switcher + /// + /// Instance of the JS engine switcher + /// Options of the JS engine switcher + private static void ApplyOptionsToJsEngineSwitcher(IJsEngineSwitcher engineSwitcher, JsEngineSwitcherOptions options) + { + JsEngineSwitcher.AllowCurrentProperty = options.AllowCurrentProperty; + engineSwitcher.DefaultEngineName = options.DefaultEngineName; + } + + /// + /// Registers a instance of the JS engine switcher + /// + /// The services available in the application + /// Instance of the JS engine switcher + /// Options of the JS engine switcher + private static void RegisterJsEngineSwitcher(IServiceCollection services, IJsEngineSwitcher engineSwitcher, + JsEngineSwitcherOptions options) + { // Register the current instance of JS engine switcher as a service - services.AddSingleton(currentEngineSwitcher); + services.AddSingleton(engineSwitcher); - return currentEngineSwitcher.EngineFactories; + // Set the current instance of JS engine switcher + if (options.AllowCurrentProperty) + { + JsEngineSwitcher.Current = engineSwitcher; + } } + + #endregion } } \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..95b60008 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/PACKAGE-DESCRIPTION.md @@ -0,0 +1 @@ +JavaScriptEngineSwitcher.Extensions.MsDependencyInjection contains extension methods for adding the JS engine switcher in an `IServiceCollection`. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/readme.txt b/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/readme.txt index fa7a6768..a4b6267d 100644 --- a/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/readme.txt +++ b/src/JavaScriptEngineSwitcher.Extensions.MsDependencyInjection/readme.txt @@ -1,11 +1,11 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: MS Dependency Injection v3.19.0 + README file for JS Engine Switcher: MS Dependency Injection v3.24.1 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2024 Andrey Taritsyn - http://www.taritsyn.ru =========== diff --git a/src/JavaScriptEngineSwitcher.Jint/CustomTypeResolvers.cs b/src/JavaScriptEngineSwitcher.Jint/CustomTypeResolvers.cs new file mode 100644 index 00000000..4e1dfd8a --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Jint/CustomTypeResolvers.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; + +using OriginalTypeResolver = Jint.Runtime.Interop.TypeResolver; + +namespace JavaScriptEngineSwitcher.Jint +{ + /// + /// Interop strategies for different values of the configuration property + /// + internal static class CustomTypeResolvers + { + private static readonly PropertyInfo[] _disallowedProperties = + { + typeof(Delegate).GetProperty("Method"), + typeof(Exception).GetProperty("TargetSite") + }; + + private static readonly MethodInfo[] _disallowedMethods = + { + typeof(object).GetMethod("GetType"), + typeof(Exception).GetMethod("GetType") + }; + + private static readonly Lazy _allowingReflection = new Lazy( + () => new OriginalTypeResolver() { MemberFilter = _ => true }); + + private static readonly Lazy _disallowingReflection = new Lazy( + () => new OriginalTypeResolver() { MemberFilter = IsAllowedMember }); + + /// + /// Gets a interop strategy that allows the usage of reflection API in the script code + /// + public static OriginalTypeResolver AllowingReflection => _allowingReflection.Value; + + /// + /// Gets a interop strategy that disallows the usage of reflection API in the script code + /// + public static OriginalTypeResolver DisallowingReflection => _disallowingReflection.Value; + + + private static bool IsAllowedMember(MemberInfo member) + { + bool isAllowed = true; + + if (member is PropertyInfo) + { + isAllowed = IsAllowedProperty((PropertyInfo)member); + } + else if (member is MethodInfo) + { + isAllowed = IsAllowedMethod((MethodInfo)member); + } + + return isAllowed; + } + + [MethodImpl((MethodImplOptions)256 /* AggressiveInlining */)] + private static bool IsAllowedProperty(PropertyInfo property) + { + bool isAllowed = !_disallowedProperties.Contains(property, MemberComparer.Instance); + + return isAllowed; + } + + [MethodImpl((MethodImplOptions)256 /* AggressiveInlining */)] + private static bool IsAllowedMethod(MethodInfo method) + { + bool isAllowed = !_disallowedMethods.Contains(method, MemberComparer.Instance); + + return isAllowed; + } + + + private sealed class MemberComparer : EqualityComparer + where T : MemberInfo + { + public static MemberComparer Instance { get; } = new MemberComparer(); + + + private MemberComparer() + { } + + + #region MemberComparer overrides + + public override bool Equals(T x, T y) + { + if (x == null && y == null) + { + return true; + } + else if (x == null || y == null) + { + return false; + } + + return x.Module == y.Module && x.MetadataToken == y.MetadataToken; + } + + public override int GetHashCode(T obj) + { + return obj != null ? obj.GetHashCode() : 0; + } + + #endregion + } + } +} diff --git a/src/JavaScriptEngineSwitcher.Jint/Helpers/JintJsErrorHelpers.cs b/src/JavaScriptEngineSwitcher.Jint/Helpers/JintJsErrorHelpers.cs index 8e30d877..af37c9df 100644 --- a/src/JavaScriptEngineSwitcher.Jint/Helpers/JintJsErrorHelpers.cs +++ b/src/JavaScriptEngineSwitcher.Jint/Helpers/JintJsErrorHelpers.cs @@ -24,27 +24,45 @@ internal static class JintJsErrorHelpers private const string WrapperAnonymousFunctionName = "Anonymous function"; private const string DelegateFunctionName = "delegate"; + /// + /// Pattern for working with document names with coordinates + /// + private static readonly string DocumentNameWithCoordinatesPattern = + @"(?" + CommonRegExps.DocumentNamePattern + @"):" + + @"(?\d+)(?::(?\d+))?"; + /// /// Regular expression for working with line of the script error location /// private static readonly Regex _errorLocationLineRegex = - new Regex(@"^[ ]{3}at " + + new Regex(@"^[ ]{4}at " + @"(?:" + - @"(?:" + - @"(?" + - @"[\w][\w ]*" + - @"|" + - CommonRegExps.JsFullNamePattern + - @"|" + - Regex.Escape(OriginalAnonymousFunctionName) + - @") " + - @"\((?:" + CommonRegExps.JsFullNamePattern + @"(?:, " + CommonRegExps.JsFullNamePattern + @")*)?\)" + + @"(?" + + @"[\w][\w ]*" + + @"|" + + CommonRegExps.JsFullNamePattern + @"|" + - @"(?" + Regex.Escape(DelegateFunctionName) + @")" + + Regex.Escape(OriginalAnonymousFunctionName) + @") " + - @")?" + - @"(?" + CommonRegExps.DocumentNamePattern + @"):" + - @"(?\d+)(?::(?\d+))?$"); + @"\(" + DocumentNameWithCoordinatesPattern + @"\)" + + @"|" + + DocumentNameWithCoordinatesPattern + + @")" + + "$"); + + /// + /// Regular expression for working with the syntax error message + /// + private static readonly Regex _syntaxErrorMessageRegex = + new Regex(@"^(?[\s\S]+?) \(" + CommonRegExps.DocumentNamePattern + @":\d+:\d+\)$"); + + /// + /// Regular expression for working with the script preparation error message + /// + private static readonly Regex _scriptPreparationErrorMessageRegex = + new Regex(@"^Could not prepare script: (?[\s\S]+?) " + + @"\((?" + CommonRegExps.DocumentNamePattern + @"):" + + @"(?\d+):(?\d+)\)$"); /// @@ -152,6 +170,50 @@ public static string ConvertCallChainToStack(string callChain) return callStack; } + /// + /// Gets a description from the syntax error message + /// + /// Error message + /// Description of error + public static string GetDescriptionFromSyntaxErrorMessage(string message) + { + Match messageMatch = _syntaxErrorMessageRegex.Match(message); + string description = messageMatch.Success ? + messageMatch.Groups["description"].Value : message; + + return description; + } + + /// + /// Parses a script preparation error message + /// + /// Error message + /// Description of error + /// Script error location + public static void ParseScriptPreparationErrorMessage(string message, out string description, + out ErrorLocationItem errorLocation) + { + Match messageMatch = _scriptPreparationErrorMessageRegex.Match(message); + + if (messageMatch.Success) + { + GroupCollection messageGroups = messageMatch.Groups; + + description = messageGroups["description"].Value; + errorLocation = new ErrorLocationItem + { + DocumentName = messageGroups["documentName"].Value, + LineNumber = int.Parse(messageGroups["lineNumber"].Value), + ColumnNumber = int.Parse(messageGroups["columnNumber"].Value) + }; + } + else + { + description = message; + errorLocation = new ErrorLocationItem(); + } + } + #endregion } } \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Jint/JavaScriptEngineSwitcher.Jint.csproj b/src/JavaScriptEngineSwitcher.Jint/JavaScriptEngineSwitcher.Jint.csproj index 849fb4c0..600738b9 100644 --- a/src/JavaScriptEngineSwitcher.Jint/JavaScriptEngineSwitcher.Jint.csproj +++ b/src/JavaScriptEngineSwitcher.Jint/JavaScriptEngineSwitcher.Jint.csproj @@ -2,12 +2,12 @@ JS Engine Switcher: Jint - 3.19.0 - preview - net462;netstandard2.0;netstandard2.1 + 3.30.2 + net462;netstandard2.0;netstandard2.1;net8.0 Library true $(NoWarn);CS1591;NU5104 + false true true @@ -18,37 +18,21 @@ - JavaScriptEngineSwitcher.Jint contains adapter `JintJsEngine` (wrapper for the Jint JavaScript Engine (http://github.com/sebastienros/jint) version 3.0.0 Beta 2039). - $(PackageCommonTags);Jint + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_Jint_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_Jint_Logo128x128.png - 1. Jint was updated to version 3.0.0 Beta 2039; -2. No longer supports a .NET Framework 4.6.1; -3. Added support of .NET Framework 4.6.2. + JavaScriptEngineSwitcher.Jint contains a `JintJsEngine` adapter (wrapper for the Jint). + $(PackageCommonTags);Jint + Jint was updated to version 4.4.2. - - + - - advanced-string-builder-license.txt - true - false - - - jint-license.txt - true - false - - - - readme.txt - true - + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Jint/JintJsEngine.cs b/src/JavaScriptEngineSwitcher.Jint/JintJsEngine.cs index a2ed4c81..dd1f80ab 100644 --- a/src/JavaScriptEngineSwitcher.Jint/JintJsEngine.cs +++ b/src/JavaScriptEngineSwitcher.Jint/JintJsEngine.cs @@ -2,22 +2,20 @@ using System.Threading; using Jint; -using IOriginalPrimitiveInstance = Jint.Native.IPrimitiveInstance; +using IOriginalPrimitive = Jint.Native.IJsPrimitive; using OriginalCancellationConstraint = Jint.Constraints.CancellationConstraint; using OriginalDebuggerEventHandler = Jint.Runtime.Debugger.DebugHandler.DebugEventHandler; using OriginalDebuggerStatementHandlingMode = Jint.Runtime.Debugger.DebuggerStatementHandling; using OriginalEngine = Jint.Engine; -using OriginalErrorPosition = Esprima.Position; +using OriginalErrorPosition = Acornima.Position; using OriginalExecutionCanceledException = Jint.Runtime.ExecutionCanceledException; +using OriginalException = Jint.JintException; using OriginalJavaScriptException = Jint.Runtime.JavaScriptException; using OriginalMemoryLimitExceededException = Jint.Runtime.MemoryLimitExceededException; using OriginalObjectInstance = Jint.Native.Object.ObjectInstance; -using OriginalParsedScript = Esprima.Ast.Script; -using OriginalParser = Esprima.JavaScriptParser; -using OriginalParserException = Esprima.ParserException; -using OriginalParserOptions = Esprima.ParserOptions; +using OriginalParsedScript = Jint.Prepared; using OriginalRecursionDepthOverflowException = Jint.Runtime.RecursionDepthOverflowException; -using OriginalRuntimeException = Jint.Runtime.JintException; +using OriginalScriptPreparationException = Jint.ScriptPreparationException; using OriginalStatementsCountOverflowException = Jint.Runtime.StatementsCountOverflowException; using OriginalTypeReference = Jint.Runtime.Interop.TypeReference; using OriginalTypes = Jint.Runtime.Types; @@ -32,6 +30,7 @@ using WrapperCompilationException = JavaScriptEngineSwitcher.Core.JsCompilationException; using WrapperInterruptedException = JavaScriptEngineSwitcher.Core.JsInterruptedException; using WrapperRuntimeException = JavaScriptEngineSwitcher.Core.JsRuntimeException; +using WrapperScriptException = JavaScriptEngineSwitcher.Core.JsScriptException; using WrapperTimeoutException = JavaScriptEngineSwitcher.Core.JsTimeoutException; using WrapperUsageException = JavaScriptEngineSwitcher.Core.JsUsageException; @@ -52,7 +51,7 @@ public sealed class JintJsEngine : JsEngineBase /// /// Version of original JS engine /// - private const string EngineVersion = "3.0.0 Beta 2039"; + private const string EngineVersion = "4.4.2"; /// /// Jint JS engine @@ -80,7 +79,12 @@ public sealed class JintJsEngine : JsEngineBase private OriginalDebuggerEventHandler _debuggerStepCallback; /// - /// Synchronizer of code execution + /// Flag for whether to allow run the script in strict mode + /// + private bool _strictMode; + + /// + /// Synchronizer of script execution /// private readonly object _executionSynchronizer = new object(); @@ -105,7 +109,6 @@ public JintJsEngine() public JintJsEngine(JintSettings settings) { _cancellationTokenSource = new CancellationTokenSource(); - _cancellationConstraint = new OriginalCancellationConstraint(_cancellationTokenSource.Token); JintSettings jintSettings = settings ?? new JintSettings(); _debuggerBreakCallback = jintSettings.DebuggerBreakCallback; @@ -116,15 +119,19 @@ public JintJsEngine(JintSettings settings) try { _jsEngine = new OriginalEngine(options => { + options.Interop.AllowGetType = true; + options.Interop.AllowSystemReflection = true; + options - .WithoutConstraint(c => c is OriginalCancellationConstraint) - .Constraint(_cancellationConstraint) + .CancellationToken(_cancellationTokenSource.Token) .DebuggerStatementHandling(debuggerStatementHandlingMode) .DebugMode(jintSettings.EnableDebugging) + .DisableStringCompilation(jintSettings.DisableEval) .LimitMemory(jintSettings.MemoryLimit) .LimitRecursion(jintSettings.MaxRecursionDepth) .LocalTimeZone(jintSettings.LocalTimeZone ?? TimeZoneInfo.Local) .MaxArraySize(jintSettings.MaxArraySize) + .MaxJsonParseDepth(jintSettings.MaxJsonParseDepth) .MaxStatements(jintSettings.MaxStatements) .Strict(jintSettings.StrictMode) .TimeoutInterval(jintSettings.TimeoutInterval) @@ -136,15 +143,19 @@ public JintJsEngine(JintSettings settings) } options.AddObjectConverter(new UndefinedConverter()); + options.SetTypeResolver(jintSettings.AllowReflection ? + CustomTypeResolvers.AllowingReflection : CustomTypeResolvers.DisallowingReflection); }); + _cancellationConstraint = _jsEngine.Constraints.Find(); if (_debuggerBreakCallback != null) { - _jsEngine.DebugHandler.Break += _debuggerBreakCallback; + _jsEngine.Debugger.Break += _debuggerBreakCallback; } if (_debuggerStepCallback != null) { - _jsEngine.DebugHandler.Step += _debuggerStepCallback; + _jsEngine.Debugger.Step += _debuggerStepCallback; } + _strictMode = settings.StrictMode; } catch (Exception e) { @@ -153,22 +164,6 @@ public JintJsEngine(JintSettings settings) } - /// - /// Creates a Esprima .NET parser options with document name and special settings for the Jint - /// - /// Document name - /// Esprima .NET parser options with document name and special settings for the Jint - private static OriginalParserOptions CreateParserOptions(string documentName) - { - var parserOptions = new OriginalParserOptions(documentName) - { - AdaptRegexp = true, - Tolerant = true - }; - - return parserOptions; - } - #region Mapping /// @@ -194,7 +189,7 @@ private object MapToHostType(OriginalValue value) return Undefined.Value; case OriginalTypes.Object: - if (!(value is IOriginalPrimitiveInstance)) + if (!(value is IOriginalPrimitive)) { return value; } @@ -207,33 +202,10 @@ private object MapToHostType(OriginalValue value) return value.ToObject(); } - private static WrapperCompilationException WrapParserException(OriginalParserException originalParserException) + private WrapperScriptException WrapException(OriginalException originalException) { - string description = originalParserException.Description; - string type = JsErrorType.Syntax; - string documentName = originalParserException.SourceText; - int lineNumber = originalParserException.LineNumber; - int columnNumber = originalParserException.Column; - string message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, documentName, lineNumber, - columnNumber); - - var wrapperCompilationException = new WrapperCompilationException(message, EngineName, EngineVersion, - originalParserException) - { - Description = description, - Type = type, - DocumentName = documentName, - LineNumber = lineNumber, - ColumnNumber = columnNumber - }; - - return wrapperCompilationException; - } - - private WrapperRuntimeException WrapRuntimeException(OriginalRuntimeException originalRuntimeException) - { - WrapperRuntimeException wrapperRuntimeException; - string message = originalRuntimeException.Message; + WrapperScriptException wrapperScriptException; + string message = originalException.Message; if (string.IsNullOrWhiteSpace(message)) { message = "An unknown error occurred"; @@ -245,10 +217,10 @@ private WrapperRuntimeException WrapRuntimeException(OriginalRuntimeException or int columnNumber = 0; string callStack = string.Empty; - if (originalRuntimeException is OriginalJavaScriptException) + if (originalException is OriginalJavaScriptException) { - var originalJavaScriptException = (OriginalJavaScriptException)originalRuntimeException; - documentName = originalJavaScriptException.Location.Source; + var originalJavaScriptException = (OriginalJavaScriptException)originalException; + documentName = originalJavaScriptException.Location.SourceFile; OriginalErrorPosition errorPosition = originalJavaScriptException.Location.Start; lineNumber = errorPosition.Line; columnNumber = errorPosition.Column + 1; @@ -278,66 +250,97 @@ private WrapperRuntimeException WrapRuntimeException(OriginalRuntimeException or type = JsErrorType.Common; } - message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, callStack); - - wrapperRuntimeException = new WrapperRuntimeException(message, EngineName, EngineVersion, - originalJavaScriptException); + if (type == JsErrorType.Syntax) + { + description = JintJsErrorHelpers.GetDescriptionFromSyntaxErrorMessage(message); + message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, documentName, lineNumber, + columnNumber); + wrapperScriptException = new WrapperCompilationException(message, EngineName, EngineVersion, + originalJavaScriptException); + } + else + { + message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, callStack); + wrapperScriptException = new WrapperRuntimeException(message, EngineName, EngineVersion, + originalJavaScriptException) + { + CallStack = callStack + }; + } } - else if (originalRuntimeException is OriginalMemoryLimitExceededException) + else if (originalException is OriginalScriptPreparationException) + { + ErrorLocationItem errorLocation; + JintJsErrorHelpers.ParseScriptPreparationErrorMessage(message, out description, out errorLocation); + + type = JsErrorType.Syntax; + documentName = errorLocation.DocumentName; + lineNumber = errorLocation.LineNumber; + columnNumber = errorLocation.ColumnNumber; + message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, documentName, lineNumber, + columnNumber); + wrapperScriptException = new WrapperCompilationException(message, EngineName, EngineVersion, + originalException); + } + else if (originalException is OriginalMemoryLimitExceededException) { type = JsErrorType.Common; message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, string.Empty); - wrapperRuntimeException = new WrapperRuntimeException(message, EngineName, EngineVersion, - originalRuntimeException); + wrapperScriptException = new WrapperRuntimeException(message, EngineName, EngineVersion, + originalException); } - else if (originalRuntimeException is OriginalRecursionDepthOverflowException) + else if (originalException is OriginalRecursionDepthOverflowException) { - var originalRecursionException = (OriginalRecursionDepthOverflowException)originalRuntimeException; + var originalRecursionException = (OriginalRecursionDepthOverflowException)originalException; callStack = JintJsErrorHelpers.ConvertCallChainToStack(originalRecursionException.CallChain); type = JsErrorType.Range; message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, callStack); - wrapperRuntimeException = new WrapperRuntimeException(message, EngineName, EngineVersion, - originalRecursionException); + wrapperScriptException = new WrapperRuntimeException(message, EngineName, EngineVersion, + originalRecursionException) + { + CallStack = callStack + }; } - else if (originalRuntimeException is OriginalStatementsCountOverflowException) + else if (originalException is OriginalStatementsCountOverflowException) { type = JsErrorType.Range; message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, string.Empty); - wrapperRuntimeException = new WrapperRuntimeException(message, EngineName, EngineVersion, - originalRuntimeException); + wrapperScriptException = new WrapperRuntimeException(message, EngineName, EngineVersion, + originalException); } - else if (originalRuntimeException is OriginalExecutionCanceledException) + else if (originalException is OriginalExecutionCanceledException) { + _cancellationTokenSource.Dispose(); _cancellationTokenSource = new CancellationTokenSource(); + _cancellationConstraint.Reset(_cancellationTokenSource.Token); type = JsErrorType.Common; message = CoreStrings.Runtime_ScriptInterrupted; description = message; - wrapperRuntimeException = new WrapperInterruptedException(message, - EngineName, EngineVersion, originalRuntimeException); + wrapperScriptException = new WrapperInterruptedException(message, + EngineName, EngineVersion, originalException); } else { type = JsErrorType.Common; message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, string.Empty); - wrapperRuntimeException = new WrapperRuntimeException(message, EngineName, EngineVersion, - originalRuntimeException); + wrapperScriptException = new WrapperRuntimeException(message, EngineName, EngineVersion, + originalException); } - wrapperRuntimeException.Description = description; - wrapperRuntimeException.Type = type; - wrapperRuntimeException.DocumentName = documentName; - wrapperRuntimeException.LineNumber = lineNumber; - wrapperRuntimeException.ColumnNumber = columnNumber; - wrapperRuntimeException.CallStack = callStack; + wrapperScriptException.Description = description; + wrapperScriptException.Type = type; + wrapperScriptException.DocumentName = documentName; + wrapperScriptException.LineNumber = lineNumber; + wrapperScriptException.ColumnNumber = columnNumber; - return wrapperRuntimeException; + return wrapperScriptException; } private static WrapperTimeoutException WrapTimeoutException(TimeoutException originalTimeoutException) @@ -367,16 +370,14 @@ protected override IPrecompiledScript InnerPrecompile(string code, string docume { OriginalParsedScript parsedScript; string uniqueDocumentName = _documentNameManager.GetUniqueName(documentName); - OriginalParserOptions parserOptions = CreateParserOptions(uniqueDocumentName); try { - var parser = new OriginalParser(code, parserOptions); - parsedScript = parser.ParseScript(); + parsedScript = OriginalEngine.PrepareScript(code, uniqueDocumentName, _strictMode); } - catch (OriginalParserException e) + catch (OriginalException e) { - throw WrapParserException(e); + throw WrapException(e); } return new JintPrecompiledScript(parsedScript); @@ -391,7 +392,6 @@ protected override object InnerEvaluate(string expression, string documentName) { object result; string uniqueDocumentName = _documentNameManager.GetUniqueName(documentName); - OriginalParserOptions parserOptions = CreateParserOptions(uniqueDocumentName); lock (_executionSynchronizer) { @@ -399,15 +399,11 @@ protected override object InnerEvaluate(string expression, string documentName) try { - resultValue = _jsEngine.Evaluate(expression, parserOptions); - } - catch (OriginalParserException e) - { - throw WrapParserException(e); + resultValue = _jsEngine.Evaluate(expression, uniqueDocumentName); } - catch (OriginalRuntimeException e) + catch (OriginalException e) { - throw WrapRuntimeException(e); + throw WrapException(e); } catch (TimeoutException e) { @@ -440,21 +436,16 @@ protected override void InnerExecute(string code) protected override void InnerExecute(string code, string documentName) { string uniqueDocumentName = _documentNameManager.GetUniqueName(documentName); - OriginalParserOptions parserOptions = CreateParserOptions(uniqueDocumentName); lock (_executionSynchronizer) { try { - _jsEngine.Execute(code, parserOptions); - } - catch (OriginalParserException e) - { - throw WrapParserException(e); + _jsEngine.Execute(code, uniqueDocumentName); } - catch (OriginalRuntimeException e) + catch (OriginalException e) { - throw WrapRuntimeException(e); + throw WrapException(e); } catch (TimeoutException e) { @@ -481,9 +472,9 @@ protected override void InnerExecute(IPrecompiledScript precompiledScript) { _jsEngine.Execute(jintPrecompiledScript.ParsedScript); } - catch (OriginalRuntimeException e) + catch (OriginalException e) { - throw WrapRuntimeException(e); + throw WrapException(e); } catch (TimeoutException e) { @@ -504,9 +495,9 @@ protected override object InnerCallFunction(string functionName, params object[] { functionValue = _jsEngine.GetValue(functionName); } - catch (OriginalRuntimeException e) + catch (OriginalException e) { - throw WrapRuntimeException(e); + throw WrapException(e); } OriginalValue resultValue; @@ -515,9 +506,9 @@ protected override object InnerCallFunction(string functionName, params object[] { resultValue = _jsEngine.Invoke(functionValue, args); } - catch (OriginalRuntimeException e) + catch (OriginalException e) { - throw WrapRuntimeException(e); + throw WrapException(e); } catch (TimeoutException e) { @@ -574,9 +565,9 @@ protected override object InnerGetVariableValue(string variableName) { variableValue = _jsEngine.GetValue(variableName); } - catch (OriginalRuntimeException e) + catch (OriginalException e) { - throw WrapRuntimeException(e); + throw WrapException(e); } result = MapToHostType(variableValue); @@ -602,9 +593,9 @@ protected override void InnerSetVariableValue(string variableName, object value) { _jsEngine.SetValue(variableName, processedValue); } - catch (OriginalRuntimeException e) + catch (OriginalException e) { - throw WrapRuntimeException(e); + throw WrapException(e); } } } @@ -624,9 +615,9 @@ protected override void InnerEmbedHostObject(string itemName, object value) { _jsEngine.SetValue(itemName, processedValue); } - catch (OriginalRuntimeException e) + catch (OriginalException e) { - throw WrapRuntimeException(e); + throw WrapException(e); } } } @@ -641,9 +632,9 @@ protected override void InnerEmbedHostType(string itemName, Type type) { _jsEngine.SetValue(itemName, typeReference); } - catch (OriginalRuntimeException e) + catch (OriginalException e) { - throw WrapRuntimeException(e); + throw WrapException(e); } } } @@ -660,41 +651,26 @@ protected override void InnerCollectGarbage() #region IJsEngine implementation - /// - /// Gets a name of JS engine - /// public override string Name { get { return EngineName; } } - /// - /// Gets a version of original JS engine - /// public override string Version { get { return EngineVersion; } } - /// - /// Gets a value that indicates if the JS engine supports script pre-compilation - /// public override bool SupportsScriptPrecompilation { get { return true; } } - /// - /// Gets a value that indicates if the JS engine supports script interruption - /// public override bool SupportsScriptInterruption { get { return true; } } - /// - /// Gets a value that indicates if the JS engine supports garbage collection - /// public override bool SupportsGarbageCollection { get { return false; } @@ -714,12 +690,12 @@ public override void Dispose() { if (_debuggerStepCallback != null) { - _jsEngine.DebugHandler.Step -= _debuggerStepCallback; + _jsEngine.Debugger.Step -= _debuggerStepCallback; } if (_debuggerBreakCallback != null) { - _jsEngine.DebugHandler.Break -= _debuggerBreakCallback; + _jsEngine.Debugger.Break -= _debuggerBreakCallback; } _jsEngine.Dispose(); diff --git a/src/JavaScriptEngineSwitcher.Jint/JintJsEngineFactory.cs b/src/JavaScriptEngineSwitcher.Jint/JintJsEngineFactory.cs index 6633ee8b..5d272d8e 100644 --- a/src/JavaScriptEngineSwitcher.Jint/JintJsEngineFactory.cs +++ b/src/JavaScriptEngineSwitcher.Jint/JintJsEngineFactory.cs @@ -32,9 +32,7 @@ public JintJsEngineFactory(JintSettings settings) #region IJsEngineFactory implementation - /// - /// Gets a name of JS engine - /// + /// public string EngineName { get { return JintJsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.Jint/JintPrecompiledScript.cs b/src/JavaScriptEngineSwitcher.Jint/JintPrecompiledScript.cs index e8ecfa1a..0d36e5b9 100644 --- a/src/JavaScriptEngineSwitcher.Jint/JintPrecompiledScript.cs +++ b/src/JavaScriptEngineSwitcher.Jint/JintPrecompiledScript.cs @@ -1,4 +1,4 @@ -using OriginalParsedScript = Esprima.Ast.Script; +using OriginalParsedScript = Jint.Prepared; using JavaScriptEngineSwitcher.Core; @@ -31,9 +31,7 @@ public JintPrecompiledScript(OriginalParsedScript parsedScript) #region IPrecompiledScript implementation - /// - /// Gets a name of JS engine for which the pre-compiled script was created - /// + /// public string EngineName { get { return JintJsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.Jint/JintSettings.cs b/src/JavaScriptEngineSwitcher.Jint/JintSettings.cs index 1bb5b492..966360a1 100644 --- a/src/JavaScriptEngineSwitcher.Jint/JintSettings.cs +++ b/src/JavaScriptEngineSwitcher.Jint/JintSettings.cs @@ -10,7 +10,20 @@ namespace JavaScriptEngineSwitcher.Jint public sealed class JintSettings { /// - /// Gets or sets a flag for whether to allow the debugger statement + /// Gets or sets a flag for whether to allow the usage of reflection API in the script code + /// + /// + /// This affects , Exception.GetType, + /// Exception.TargetSite and Delegate.Method. + /// + public bool AllowReflection + { + get; + set; + } + + /// + /// Gets or sets a flag for whether to allow the debugger statement /// to be called in a script /// [Obsolete("Use a `DebuggerStatementHandlingMode` property")] @@ -30,7 +43,7 @@ public OriginalDebuggerEventHandler DebuggerBreakCallback } /// - /// Gets or sets a handling mode for script debugger statements + /// Gets or sets a handling mode for script debugger statements /// public JsDebuggerStatementHandlingMode DebuggerStatementHandlingMode { @@ -47,6 +60,16 @@ public OriginalDebuggerEventHandler DebuggerStepCallback set; } + /// + /// Gets or sets a flag for whether to disable calls of eval function with custom code + /// and Function constructors taking function code as string + /// + public bool DisableEval + { + get; + set; + } + /// /// Gets or sets a flag for whether to enable debug mode /// @@ -57,7 +80,7 @@ public bool EnableDebugging } /// - /// Gets or sets a local time zone for the Date objects in the script + /// Gets or sets a local time zone for the Date objects in the script /// public TimeZoneInfo LocalTimeZone { @@ -74,10 +97,19 @@ public uint MaxArraySize set; } + /// + /// Gets or sets a maximum depth allowed when parsing JSON data using the JSON.parse static method + /// + public int MaxJsonParseDepth + { + get; + set; + } + /// /// Gets or sets a maximum allowed depth of recursion: - /// -1 - recursion without limits; - /// N - one scope function can be called no more than N times. + /// -1 - recursion without limits; + /// N - one scope function can be called no more than N times. /// public int MaxRecursionDepth { @@ -104,10 +136,12 @@ public long MemoryLimit } /// - /// Gets or sets a timeout interval for regular expressions. - /// If the value of this property is null, then the value of regular expression - /// timeout interval are taken from the property. + /// Gets or sets a timeout interval for regular expressions /// + /// + /// If the value of this property is null, then the value of regular expression + /// timeout interval are taken from the property. + /// public TimeSpan? RegexTimeoutInterval { get; @@ -148,12 +182,15 @@ public TimeSpan TimeoutInterval /// public JintSettings() { + AllowReflection = false; DebuggerBreakCallback = null; DebuggerStatementHandlingMode = JsDebuggerStatementHandlingMode.Ignore; DebuggerStepCallback = null; + DisableEval = false; EnableDebugging = false; LocalTimeZone = TimeZoneInfo.Local; MaxArraySize = uint.MaxValue; + MaxJsonParseDepth = 64; MaxRecursionDepth = -1; MaxStatements = 0; MemoryLimit = 0; diff --git a/src/JavaScriptEngineSwitcher.Jint/JsDebuggerStatementHandlingMode.cs b/src/JavaScriptEngineSwitcher.Jint/JsDebuggerStatementHandlingMode.cs index a7b954ad..463b6fc2 100644 --- a/src/JavaScriptEngineSwitcher.Jint/JsDebuggerStatementHandlingMode.cs +++ b/src/JavaScriptEngineSwitcher.Jint/JsDebuggerStatementHandlingMode.cs @@ -1,24 +1,26 @@ namespace JavaScriptEngineSwitcher.Jint { /// - /// Handling mode for script debugger statements + /// Handling mode for script debugger statements /// public enum JsDebuggerStatementHandlingMode { /// - /// No action will be taken when encountering a debugger statement + /// No action will be taken when encountering a debugger statement /// Ignore, /// - /// debugger statements will trigger debugging through + /// debugger statements will trigger debugging through /// Clr, /// - /// debugger statements will trigger a break in Jint's DebugHandler. - /// See the configuration property. + /// debugger statements will trigger a break in Jint's DebugHandler /// + /// + /// See the configuration property. + /// Script } } \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Jint/JsEngineFactoryCollectionExtensions.cs b/src/JavaScriptEngineSwitcher.Jint/JsEngineFactoryCollectionExtensions.cs index f81fe12f..fd0f6e6a 100644 --- a/src/JavaScriptEngineSwitcher.Jint/JsEngineFactoryCollectionExtensions.cs +++ b/src/JavaScriptEngineSwitcher.Jint/JsEngineFactoryCollectionExtensions.cs @@ -11,10 +11,10 @@ public static class JsEngineFactoryCollectionExtensions { /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of - /// Instance of + /// Instance of + /// Instance of public static JsEngineFactoryCollection AddJint(this JsEngineFactoryCollection source) { if (source == null) @@ -27,11 +27,11 @@ public static JsEngineFactoryCollection AddJint(this JsEngineFactoryCollection s /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// The delegate to configure the provided - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddJint(this JsEngineFactoryCollection source, Action configure) { @@ -53,11 +53,11 @@ public static JsEngineFactoryCollection AddJint(this JsEngineFactoryCollection s /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// Settings of the Jint JS engine - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddJint(this JsEngineFactoryCollection source, JintSettings settings) { if (source == null) diff --git a/src/JavaScriptEngineSwitcher.Jint/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.Jint/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..9c58f953 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Jint/PACKAGE-DESCRIPTION.md @@ -0,0 +1 @@ +JavaScriptEngineSwitcher.Jint contains a `JintJsEngine` adapter (wrapper for the [Jint](http://github.com/sebastienros/jint) version 4.4.2). \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Jint/readme.txt b/src/JavaScriptEngineSwitcher.Jint/readme.txt index 6dd03689..02775102 100644 --- a/src/JavaScriptEngineSwitcher.Jint/readme.txt +++ b/src/JavaScriptEngineSwitcher.Jint/readme.txt @@ -1,26 +1,23 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: Jint v3.19.0 Preview + README file for JS Engine Switcher: Jint v3.30.2 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2025 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== - JavaScriptEngineSwitcher.Jint contains adapter `JintJsEngine` (wrapper for the - Jint JavaScript Engine (http://github.com/sebastienros/jint) version - 3.0.0 Beta 2039). + JavaScriptEngineSwitcher.Jint contains a `JintJsEngine` adapter (wrapper for the + Jint (http://github.com/sebastienros/jint) version 4.4.2). ============= RELEASE NOTES ============= - 1. Jint was updated to version 3.0.0 Beta 2039; - 2. No longer supports a .NET Framework 4.6.1; - 3. Added support of .NET Framework 4.6.2. + Jint was updated to version 4.4.2. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.Jurassic/JavaScriptEngineSwitcher.Jurassic.csproj b/src/JavaScriptEngineSwitcher.Jurassic/JavaScriptEngineSwitcher.Jurassic.csproj index 64afb837..d2bf3a2b 100644 --- a/src/JavaScriptEngineSwitcher.Jurassic/JavaScriptEngineSwitcher.Jurassic.csproj +++ b/src/JavaScriptEngineSwitcher.Jurassic/JavaScriptEngineSwitcher.Jurassic.csproj @@ -2,11 +2,12 @@ JS Engine Switcher: Jurassic - 3.19.0 + 3.29.0 net40-client;net45;netstandard2.0 Library true $(NoWarn);CS1591 + false true @@ -16,28 +17,21 @@ - JavaScriptEngineSwitcher.Jurassic contains adapter `JurassicJsEngine` (wrapper for the Jurassic JavaScript Engine (http://github.com/paulbartrum/jurassic) version of April 30, 2022). - $(PackageCommonTags);Jurassic + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_Jurassic_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_Jurassic_Logo128x128.png + JavaScriptEngineSwitcher.Jurassic contains a `JurassicJsEngine` adapter (wrapper for the Jurassic). + $(PackageCommonTags);Jurassic + Jurassic was updated to version of February 4, 2025. - + - - jurassic-license.txt - true - false - - - - readme.txt - true - + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Jurassic/JsEngineFactoryCollectionExtensions.cs b/src/JavaScriptEngineSwitcher.Jurassic/JsEngineFactoryCollectionExtensions.cs index 800a0c92..265afab0 100644 --- a/src/JavaScriptEngineSwitcher.Jurassic/JsEngineFactoryCollectionExtensions.cs +++ b/src/JavaScriptEngineSwitcher.Jurassic/JsEngineFactoryCollectionExtensions.cs @@ -11,10 +11,10 @@ public static class JsEngineFactoryCollectionExtensions { /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of - /// Instance of + /// Instance of + /// Instance of public static JsEngineFactoryCollection AddJurassic(this JsEngineFactoryCollection source) { if (source == null) @@ -27,11 +27,11 @@ public static JsEngineFactoryCollection AddJurassic(this JsEngineFactoryCollecti /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// The delegate to configure the provided - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddJurassic(this JsEngineFactoryCollection source, Action configure) { @@ -53,11 +53,11 @@ public static JsEngineFactoryCollection AddJurassic(this JsEngineFactoryCollecti /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// Settings of the Jurassic JS engine - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddJurassic(this JsEngineFactoryCollection source, JurassicSettings settings) { diff --git a/src/JavaScriptEngineSwitcher.Jurassic/JurassicJsEngine.cs b/src/JavaScriptEngineSwitcher.Jurassic/JurassicJsEngine.cs index 2b165f74..57d9976b 100644 --- a/src/JavaScriptEngineSwitcher.Jurassic/JurassicJsEngine.cs +++ b/src/JavaScriptEngineSwitcher.Jurassic/JurassicJsEngine.cs @@ -1,6 +1,8 @@ using System; using System.IO; +using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using System.Text; using OriginalCompatibilityMode = Jurassic.CompatibilityMode; @@ -43,7 +45,7 @@ public sealed class JurassicJsEngine : JsEngineBase /// /// Version of original JS engine /// - private const string EngineVersion = "Apr 30, 2022"; + private const string EngineVersion = "Feb 4, 2025"; /// /// Jurassic JS engine @@ -117,6 +119,16 @@ private static object MapToScriptType(object value) return value; } + /// + /// Makes a mapping of array items from the host type to a script type + /// + /// The source array + /// The mapped array + private static object[] MapToScriptType(object[] args) + { + return args.Select(MapToScriptType).ToArray(); + } + /// /// Makes a mapping of value from the script type to a host type /// @@ -124,22 +136,75 @@ private static object MapToScriptType(object value) /// The mapped value private static object MapToHostType(object value) { + if (value is OriginalNull) + { + return null; + } + + if (value is OriginalUndefined) + { + return Undefined.Value; + } + if (value is OriginalConcatenatedString) { return value.ToString(); } + return value; + } + + /// + /// Makes a mapping of value from the script type to a host type + /// + /// The type to convert the value to + /// Original JS engine + /// The source value + /// The mapped value + private static T MapToHostType(OriginalEngine engine, object value) + { if (value is OriginalNull) { - return null; + return TypeConverter.ConvertToType(null); } - if (value is OriginalUndefined) + Type targetType = typeof(T); + + if (targetType == typeof(Undefined)) { - return Undefined.Value; + if (value is OriginalUndefined) + { + return (T)(object)Undefined.Value; + } + else + { + throw new InvalidOperationException( + string.Format(CoreStrings.Common_CannotConvertObjectToType, value.GetType(), targetType) + ); + } } - return value; + T result; + + try + { + result = OriginalTypeConverter.ConvertTo(engine, value); + } + catch (OriginalJavaScriptException e) + { + throw new InvalidOperationException(e.ErrorMessage, e); + } + catch (ArgumentException e) + { + if (targetType == typeof(string) && value != null) + { + return (T)(object)value.ToString(); + } + + throw new InvalidOperationException(e.Message, e); + } + + return result; } private static WrapperCompilationException WrapSyntaxException( @@ -164,7 +229,7 @@ private static WrapperCompilationException WrapSyntaxException( return wrapperCompilationException; } - private WrapperException WrapJavaScriptException( + private static WrapperException WrapJavaScriptException(OriginalEngine engine, OriginalJavaScriptException originalJavaScriptException) { WrapperException wrapperException; @@ -176,7 +241,7 @@ private WrapperException WrapJavaScriptException( int lineNumber = originalJavaScriptException.LineNumber; string callStack = string.Empty; - object errorObject = originalJavaScriptException.GetErrorObject(_jsEngine); + object errorObject = originalJavaScriptException.GetErrorObject(engine); var errorValue = errorObject as OriginalErrorInstance; if (errorValue != null) { @@ -266,6 +331,80 @@ private static void FixCallStackItems(ErrorLocationItem[] callStackItems) #endregion + /// + /// Evaluates an expression without converting its result to a host type + /// + /// Original JS engine + /// JS expression + /// Unique document name + /// Result of the expression not converted to a host type + [MethodImpl((MethodImplOptions)256 /* AggressiveInlining */)] + private static object InnerEvaluateWithoutResultConversion(OriginalEngine engine, string expression, + string uniqueDocumentName) + { + object result; + + try + { + var source = new OriginalStringScriptSource(expression, uniqueDocumentName); + result = engine.Evaluate(source); + } + catch (OriginalJavaScriptException e) + { + throw WrapJavaScriptException(engine, e); + } + + return result; + } + + /// + /// Calls a function without converting its result to a host type + /// + /// Original JS engine + /// Function name + /// Function arguments converted to a script type + /// Result of the function execution not converted to a host type + [MethodImpl((MethodImplOptions)256 /* AggressiveInlining */)] + private static object InnerCallFunctionWithoutResultConversion(OriginalEngine engine, string functionName, + params object[] args) + { + object result; + + try + { + result = engine.CallGlobalFunction(functionName, args); + } + catch (OriginalJavaScriptException e) + { + throw WrapJavaScriptException(engine, e); + } + + return result; + } + + /// + /// Gets a value of variable without converting it to a host type + /// + /// Original JS engine + /// Variable name + /// Value of variable not converted to a host type + [MethodImpl((MethodImplOptions)256 /* AggressiveInlining */)] + private static object InnerGetVariableValueWithoutResultConversion(OriginalEngine engine, string variableName) + { + object result; + + try + { + result = engine.GetGlobalValue(variableName); + } + catch (OriginalJavaScriptException e) + { + throw WrapJavaScriptException(engine, e); + } + + return result; + } + #region JsEngineBase overrides protected override IPrecompiledScript InnerPrecompile(string code) @@ -301,23 +440,15 @@ protected override object InnerEvaluate(string expression) protected override object InnerEvaluate(string expression, string documentName) { - object result; + object resultValue; string uniqueDocumentName = _documentNameManager.GetUniqueName(documentName); lock (_executionSynchronizer) { - try - { - var source = new OriginalStringScriptSource(expression, uniqueDocumentName); - result = _jsEngine.Evaluate(source); - } - catch (OriginalJavaScriptException e) - { - throw WrapJavaScriptException(e); - } + resultValue = InnerEvaluateWithoutResultConversion(_jsEngine, expression, uniqueDocumentName); } - result = MapToHostType(result); + object result = MapToHostType(resultValue); return result; } @@ -329,9 +460,16 @@ protected override T InnerEvaluate(string expression) protected override T InnerEvaluate(string expression, string documentName) { - object result = InnerEvaluate(expression, documentName); + T result; + string uniqueDocumentName = _documentNameManager.GetUniqueName(documentName); + + lock (_executionSynchronizer) + { + object resultValue = InnerEvaluateWithoutResultConversion(_jsEngine, expression, uniqueDocumentName); + result = MapToHostType(_jsEngine, resultValue); + } - return OriginalTypeConverter.ConvertTo(_jsEngine, result); + return result; } protected override void InnerExecute(string code) @@ -352,7 +490,7 @@ protected override void InnerExecute(string code, string documentName) } catch (OriginalJavaScriptException e) { - throw WrapJavaScriptException(e); + throw WrapJavaScriptException(_jsEngine, e); } } } @@ -377,48 +515,38 @@ protected override void InnerExecute(IPrecompiledScript precompiledScript) } catch (OriginalJavaScriptException e) { - throw WrapJavaScriptException(e); + throw WrapJavaScriptException(_jsEngine, e); } } } protected override object InnerCallFunction(string functionName, params object[] args) { - int argumentCount = args.Length; - var processedArgs = new object[argumentCount]; - - if (argumentCount > 0) - { - for (int argumentIndex = 0; argumentIndex < argumentCount; argumentIndex++) - { - processedArgs[argumentIndex] = MapToScriptType(args[argumentIndex]); - } - } - - object result; + object resultValue; + object[] processedArgs = MapToScriptType(args); lock (_executionSynchronizer) { - try - { - result = _jsEngine.CallGlobalFunction(functionName, processedArgs); - } - catch (OriginalJavaScriptException e) - { - throw WrapJavaScriptException(e); - } + resultValue = InnerCallFunctionWithoutResultConversion(_jsEngine, functionName, processedArgs); } - result = MapToHostType(result); + object result = MapToHostType(resultValue); return result; } protected override T InnerCallFunction(string functionName, params object[] args) { - object result = InnerCallFunction(functionName, args); + T result; + object[] processedArgs = MapToScriptType(args); + + lock (_executionSynchronizer) + { + object resultValue = InnerCallFunctionWithoutResultConversion(_jsEngine, functionName, processedArgs); + result = MapToHostType(_jsEngine, resultValue); + } - return OriginalTypeConverter.ConvertTo(_jsEngine, result); + return result; } protected override bool InnerHasVariable(string variableName) @@ -440,30 +568,29 @@ protected override bool InnerHasVariable(string variableName) protected override object InnerGetVariableValue(string variableName) { - object result; + object resultValue; lock (_executionSynchronizer) { - try - { - result = _jsEngine.GetGlobalValue(variableName); - } - catch (OriginalJavaScriptException e) - { - throw WrapJavaScriptException(e); - } + resultValue = InnerGetVariableValueWithoutResultConversion(_jsEngine, variableName); } - result = MapToHostType(result); + object result = MapToHostType(resultValue); return result; } protected override T InnerGetVariableValue(string variableName) { - object result = InnerGetVariableValue(variableName); + T result; - return OriginalTypeConverter.ConvertTo(_jsEngine, result); + lock (_executionSynchronizer) + { + object resultValue = InnerGetVariableValueWithoutResultConversion(_jsEngine, variableName); + result = MapToHostType(_jsEngine, resultValue); + } + + return result; } protected override void InnerSetVariableValue(string variableName, object value) @@ -478,7 +605,7 @@ protected override void InnerSetVariableValue(string variableName, object value) } catch (OriginalJavaScriptException e) { - throw WrapJavaScriptException(e); + throw WrapJavaScriptException(_jsEngine, e); } } } @@ -508,7 +635,7 @@ protected override void InnerEmbedHostObject(string itemName, object value) } catch (OriginalJavaScriptException e) { - throw WrapJavaScriptException(e); + throw WrapJavaScriptException(_jsEngine, e); } } } @@ -523,7 +650,7 @@ protected override void InnerEmbedHostType(string itemName, Type type) } catch (OriginalJavaScriptException e) { - throw WrapJavaScriptException(e); + throw WrapJavaScriptException(_jsEngine, e); } } } @@ -540,41 +667,26 @@ protected override void InnerCollectGarbage() #region IJsEngine implementation - /// - /// Gets a name of JS engine - /// public override string Name { get { return EngineName; } } - /// - /// Gets a version of original JS engine - /// public override string Version { get { return EngineVersion; } } - /// - /// Gets a value that indicates if the JS engine supports script pre-compilation - /// public override bool SupportsScriptPrecompilation { get { return true; } } - /// - /// Gets a value that indicates if the JS engine supports script interruption - /// public override bool SupportsScriptInterruption { get { return false; } } - /// - /// Gets a value that indicates if the JS engine supports garbage collection - /// public override bool SupportsGarbageCollection { get { return false; } @@ -797,7 +909,7 @@ public override void ExecuteFile(string path, Encoding encoding = null) } catch (OriginalJavaScriptException e) { - throw WrapJavaScriptException(e); + throw WrapJavaScriptException(_jsEngine, e); } catch (FileNotFoundException) { @@ -860,7 +972,7 @@ public override void ExecuteResource(string resourceName, Type type) } catch (OriginalJavaScriptException e) { - throw WrapJavaScriptException(e); + throw WrapJavaScriptException(_jsEngine, e); } catch (NullReferenceException) { @@ -916,7 +1028,7 @@ public override void ExecuteResource(string resourceName, Assembly assembly) } catch (OriginalJavaScriptException e) { - throw WrapJavaScriptException(e); + throw WrapJavaScriptException(_jsEngine, e); } catch (NullReferenceException) { diff --git a/src/JavaScriptEngineSwitcher.Jurassic/JurassicJsEngineFactory.cs b/src/JavaScriptEngineSwitcher.Jurassic/JurassicJsEngineFactory.cs index 276eb6c8..dc4053c2 100644 --- a/src/JavaScriptEngineSwitcher.Jurassic/JurassicJsEngineFactory.cs +++ b/src/JavaScriptEngineSwitcher.Jurassic/JurassicJsEngineFactory.cs @@ -32,9 +32,7 @@ public JurassicJsEngineFactory(JurassicSettings settings) #region IJsEngineFactory implementation - /// - /// Gets a name of JS engine - /// + /// public string EngineName { get { return JurassicJsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.Jurassic/JurassicPrecompiledScript.cs b/src/JavaScriptEngineSwitcher.Jurassic/JurassicPrecompiledScript.cs index 82e431ac..0983ae64 100644 --- a/src/JavaScriptEngineSwitcher.Jurassic/JurassicPrecompiledScript.cs +++ b/src/JavaScriptEngineSwitcher.Jurassic/JurassicPrecompiledScript.cs @@ -31,9 +31,7 @@ public JurassicPrecompiledScript(OriginalCompiledScript compiledScript) #region IPrecompiledScript implementation - /// - /// Gets a name of JS engine for which the pre-compiled script was created - /// + /// public string EngineName { get { return JurassicJsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.Jurassic/JurassicSettings.cs b/src/JavaScriptEngineSwitcher.Jurassic/JurassicSettings.cs index 5c097912..a2964472 100644 --- a/src/JavaScriptEngineSwitcher.Jurassic/JurassicSettings.cs +++ b/src/JavaScriptEngineSwitcher.Jurassic/JurassicSettings.cs @@ -12,9 +12,9 @@ public sealed class JurassicSettings /// that are passed or returned to script code, to script arrays /// /// - /// This property does not allow the embedding of host collections by + /// This property does not allow the embedding of host collections by /// using a - /// method, it only affects the internal mechanisms of the Jurassic library. + /// method, it only affects the internal mechanisms of the Jurassic library. /// public bool EnableHostCollectionsEmbeddingByValue { diff --git a/src/JavaScriptEngineSwitcher.Jurassic/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.Jurassic/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..ad182c32 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Jurassic/PACKAGE-DESCRIPTION.md @@ -0,0 +1 @@ +JavaScriptEngineSwitcher.Jurassic contains a `JurassicJsEngine` adapter (wrapper for the [Jurassic](http://github.com/paulbartrum/jurassic) version of February 4, 2025). \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Jurassic/readme.txt b/src/JavaScriptEngineSwitcher.Jurassic/readme.txt index 3dc2bd68..88a9730b 100644 --- a/src/JavaScriptEngineSwitcher.Jurassic/readme.txt +++ b/src/JavaScriptEngineSwitcher.Jurassic/readme.txt @@ -1,19 +1,24 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: Jurassic v3.19.0 + README file for JS Engine Switcher: Jurassic v3.29.0 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2025 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== - JavaScriptEngineSwitcher.Jurassic contains adapter `JurassicJsEngine` (wrapper - for the Jurassic JavaScript Engine (http://github.com/paulbartrum/jurassic) - version of April 30, 2022). + JavaScriptEngineSwitcher.Jurassic contains a `JurassicJsEngine` adapter (wrapper + for the Jurassic (http://github.com/paulbartrum/jurassic) version of + February 4, 2025). + + ============= + RELEASE NOTES + ============= + Jurassic was updated to version of February 4, 2025. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.Msie/JavaScriptEngineSwitcher.Msie.csproj b/src/JavaScriptEngineSwitcher.Msie/JavaScriptEngineSwitcher.Msie.csproj index b9f94eb5..bfe69608 100644 --- a/src/JavaScriptEngineSwitcher.Msie/JavaScriptEngineSwitcher.Msie.csproj +++ b/src/JavaScriptEngineSwitcher.Msie/JavaScriptEngineSwitcher.Msie.csproj @@ -2,12 +2,13 @@ JS Engine Switcher: MSIE - 3.19.0 + 3.24.1 net40-client;net45;netstandard1.3;netstandard2.0 1.6.0 Library true - $(NoWarn);CS1591 + $(NoWarn);CS1591;NETSDK1215;NU1903 + false true true @@ -18,34 +19,25 @@ - JavaScriptEngineSwitcher.Msie contains adapter `MsieJsEngine` (wrapper for the MSIE JavaScript Engine for .NET (http://github.com/Taritsyn/MsieJavaScriptEngine)). For correct working of the MSIE JavaScript Engine it is recommended to install Internet Explorer 9+ or Microsoft Edge Legacy on the machine. - $(PackageCommonTags);MSIE;IE;Chakra + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_Msie_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_Msie_Logo128x128.png - 1. MSIE JavaScript Engine was updated to version 3.0.9; -2. Fixed a error #102 “Resources should conform to correct ICU standard for naming”. Special thanks to Tim Heuer. + JavaScriptEngineSwitcher.Msie contains a `MsieJsEngine` adapter (wrapper for the MSIE JavaScript Engine for .NET). + $(PackageCommonTags);MSIE;IE;Chakra + MSIE JavaScript Engine was updated to version 3.2.5. - - + + - - msie-javascript-engine-license.txt - true - false - - - - readme.txt - true - + - + diff --git a/src/JavaScriptEngineSwitcher.Msie/JsEngineFactoryCollectionExtensions.cs b/src/JavaScriptEngineSwitcher.Msie/JsEngineFactoryCollectionExtensions.cs index f27d2574..dd5d4910 100644 --- a/src/JavaScriptEngineSwitcher.Msie/JsEngineFactoryCollectionExtensions.cs +++ b/src/JavaScriptEngineSwitcher.Msie/JsEngineFactoryCollectionExtensions.cs @@ -11,10 +11,10 @@ public static class JsEngineFactoryCollectionExtensions { /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of - /// Instance of + /// Instance of + /// Instance of public static JsEngineFactoryCollection AddMsie(this JsEngineFactoryCollection source) { if (source == null) @@ -27,11 +27,11 @@ public static JsEngineFactoryCollection AddMsie(this JsEngineFactoryCollection s /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// The delegate to configure the provided - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddMsie(this JsEngineFactoryCollection source, Action configure) { @@ -53,11 +53,11 @@ public static JsEngineFactoryCollection AddMsie(this JsEngineFactoryCollection s /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// Settings of the MSIE JS engine - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddMsie(this JsEngineFactoryCollection source, MsieSettings settings) { diff --git a/src/JavaScriptEngineSwitcher.Msie/MsieJsEngine.cs b/src/JavaScriptEngineSwitcher.Msie/MsieJsEngine.cs index 5da9eb00..0e438370 100644 --- a/src/JavaScriptEngineSwitcher.Msie/MsieJsEngine.cs +++ b/src/JavaScriptEngineSwitcher.Msie/MsieJsEngine.cs @@ -76,6 +76,7 @@ public MsieJsEngine(MsieSettings settings) { _jsEngine = new OriginalEngine(new OriginalEngineSettings { + AllowReflection = msieSettings.AllowReflection, EnableDebugging = msieSettings.EnableDebugging, EngineMode = Utils.GetEnumFromOtherEnum( msieSettings.EngineMode), @@ -452,41 +453,26 @@ protected override void InnerCollectGarbage() #region IJsEngine implementation - /// - /// Gets a name of JS engine - /// public override string Name { get { return EngineName; } } - /// - /// Gets a version of original JS engine - /// public override string Version { get { return _engineVersion; } } - /// - /// Gets a value that indicates if the JS engine supports script pre-сompilation - /// public override bool SupportsScriptPrecompilation { get { return _jsEngine.SupportsScriptPrecompilation; } } - /// - /// Gets a value that indicates if the JS engine supports script interruption - /// public override bool SupportsScriptInterruption { get { return true; } } - /// - /// Gets a value that indicates if the JS engine supports garbage collection - /// public override bool SupportsGarbageCollection { get { return true; } diff --git a/src/JavaScriptEngineSwitcher.Msie/MsieJsEngineFactory.cs b/src/JavaScriptEngineSwitcher.Msie/MsieJsEngineFactory.cs index 78e535f2..15b32429 100644 --- a/src/JavaScriptEngineSwitcher.Msie/MsieJsEngineFactory.cs +++ b/src/JavaScriptEngineSwitcher.Msie/MsieJsEngineFactory.cs @@ -32,9 +32,7 @@ public MsieJsEngineFactory(MsieSettings settings) #region IJsEngineFactory implementation - /// - /// Gets a name of JS engine - /// + /// public string EngineName { get { return MsieJsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.Msie/MsiePrecompiledScript.cs b/src/JavaScriptEngineSwitcher.Msie/MsiePrecompiledScript.cs index 53f2e77d..5004f43e 100644 --- a/src/JavaScriptEngineSwitcher.Msie/MsiePrecompiledScript.cs +++ b/src/JavaScriptEngineSwitcher.Msie/MsiePrecompiledScript.cs @@ -31,9 +31,7 @@ public MsiePrecompiledScript(OriginalPrecompiledScript precompiledScript) #region IPrecompiledScript implementation - /// - /// Gets a name of JS engine for which the pre-compiled script was created - /// + /// public string EngineName { get { return MsieJsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.Msie/MsieSettings.cs b/src/JavaScriptEngineSwitcher.Msie/MsieSettings.cs index 66f8c7ce..a5e85290 100644 --- a/src/JavaScriptEngineSwitcher.Msie/MsieSettings.cs +++ b/src/JavaScriptEngineSwitcher.Msie/MsieSettings.cs @@ -28,6 +28,19 @@ public sealed class MsieSettings private int _maxStackSize; #endif + /// + /// Gets or sets a flag for whether to allow the usage of reflection API in the script code + /// + /// + /// This affects , Exception.GetType, + /// Exception.TargetSite and Delegate.Method. + /// + public bool AllowReflection + { + get; + set; + } + /// /// Gets or sets a flag for whether to enable script debugging features /// @@ -51,9 +64,8 @@ public JsEngineMode EngineMode /// Gets or sets a maximum stack size in bytes /// /// - /// Set a 0 to use the default maximum stack size specified in the header + /// Set a 0 to use the default maximum stack size specified in the header /// for the executable. - /// /// public int MaxStackSize { @@ -97,6 +109,7 @@ public bool UseJson2Library /// public MsieSettings() { + AllowReflection = false; EnableDebugging = false; EngineMode = JsEngineMode.Auto; #if !NETSTANDARD1_3 diff --git a/src/JavaScriptEngineSwitcher.Msie/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.Msie/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..c0017681 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Msie/PACKAGE-DESCRIPTION.md @@ -0,0 +1,3 @@ +JavaScriptEngineSwitcher.Msie contains a `MsieJsEngine` adapter (wrapper for the [MSIE JavaScript Engine for .NET](http://github.com/Taritsyn/MsieJavaScriptEngine)). + +For correct working of the MSIE JavaScript Engine it is recommended to install Internet Explorer 9+ or Microsoft Edge Legacy on the machine. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Msie/Resources/Strings.Designer.cs b/src/JavaScriptEngineSwitcher.Msie/Resources/Strings.Designer.cs index 9eca28b2..50649830 100644 --- a/src/JavaScriptEngineSwitcher.Msie/Resources/Strings.Designer.cs +++ b/src/JavaScriptEngineSwitcher.Msie/Resources/Strings.Designer.cs @@ -21,7 +21,7 @@ internal class Strings private static Lazy _resourceManager = new Lazy(() => new ResourceManager( "JavaScriptEngineSwitcher.Msie.Resources.Strings", -#if NET40 +#if NET20 || NET30 || NET35 || NET40 typeof(Strings).Assembly #else typeof(Strings).GetTypeInfo().Assembly diff --git a/src/JavaScriptEngineSwitcher.Msie/readme.txt b/src/JavaScriptEngineSwitcher.Msie/readme.txt index 32f6c6ff..2f82f48b 100644 --- a/src/JavaScriptEngineSwitcher.Msie/readme.txt +++ b/src/JavaScriptEngineSwitcher.Msie/readme.txt @@ -1,17 +1,17 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: MSIE v3.19.0 + README file for JS Engine Switcher: MSIE v3.24.1 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2024 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== - JavaScriptEngineSwitcher.Msie contains adapter `MsieJsEngine` (wrapper for the + JavaScriptEngineSwitcher.Msie contains a `MsieJsEngine` adapter (wrapper for the MSIE JavaScript Engine for .NET (http://github.com/Taritsyn/MsieJavaScriptEngine)). For correct working of the MSIE JavaScript Engine it is recommended to install Internet Explorer 9+ or Microsoft Edge Legacy on the machine. @@ -19,9 +19,7 @@ ============= RELEASE NOTES ============= - 1. MSIE JavaScript Engine was updated to version 3.0.9; - 2. Fixed a error #102 “Resources should conform to correct ICU standard for - naming”. Special thanks to Tim Heuer. + MSIE JavaScript Engine was updated to version 3.2.5. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.NiL/Helpers/NiLJsErrorHelpers.cs b/src/JavaScriptEngineSwitcher.NiL/Helpers/NiLJsErrorHelpers.cs new file mode 100644 index 00000000..91474ef0 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.NiL/Helpers/NiLJsErrorHelpers.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text.RegularExpressions; + +using JavaScriptEngineSwitcher.Core.Extensions; +using JavaScriptEngineSwitcher.Core.Helpers; + +using CoreStrings = JavaScriptEngineSwitcher.Core.Resources.Strings; + +namespace JavaScriptEngineSwitcher.NiL.Helpers +{ + /// + /// JS error helpers + /// + internal static class NiLJsErrorHelpers + { + #region Error location + + private const string AtLinePrefix = " at "; + private const string DotNetStackTraceLinePrefix = AtLinePrefix + "NiL.JS."; + + private const string OriginalGlobalCode = "anonymous"; + private const string OriginalAnonymousFunctionName = ""; + private const string WrapperGlobalCode = "Global code"; + private const string WrapperAnonymousFunctionName = "Anonymous function"; + + /// + /// Regular expression for working with line of the script error location + /// + private static readonly Regex _errorLocationLineRegex = + new Regex(@"^" + AtLinePrefix + + @"(?" + + @"[\w][\w ]*" + + @"|" + + CommonRegExps.JsFullNamePattern + + @"|" + + Regex.Escape(OriginalAnonymousFunctionName) + + @")" + + @"(?::line (?\d+):(?\d+))?$"); + + + /// + /// Parses a string representation of the script error location to produce an array of + /// instances + /// + /// String representation of the script error location + /// An array of instances + public static ErrorLocationItem[] ParseErrorLocation(string errorLocation) + { + if (string.IsNullOrWhiteSpace(errorLocation)) + { + return new ErrorLocationItem[0]; + } + + var errorLocationItems = new List(); + string[] lines = errorLocation.SplitToLines(); + int lineCount = lines.Length; + + for (int lineIndex = 0; lineIndex < lineCount; lineIndex++) + { + string line = lines[lineIndex]; + + if (line.Length == 0) + { + continue; + } + + // Completing parsing when a .NET stack trace is found + if (line.StartsWith(DotNetStackTraceLinePrefix, StringComparison.Ordinal)) + { + break; + } + + Match lineMatch = _errorLocationLineRegex.Match(line); + if (lineMatch.Success) + { + GroupCollection lineGroups = lineMatch.Groups; + Group lineNumberGroup = lineGroups["lineNumber"]; + Group columnNumberGroup = lineGroups["columnNumber"]; + + var errorLocationItem = new ErrorLocationItem + { + FunctionName = lineGroups["functionName"].Value, + LineNumber = lineNumberGroup.Success ? int.Parse(lineNumberGroup.Value) : 0, + ColumnNumber = columnNumberGroup.Success ? int.Parse(columnNumberGroup.Value) : 0, + }; + errorLocationItems.Add(errorLocationItem); + } + else + { + Debug.WriteLine(string.Format(CoreStrings.Runtime_InvalidErrorLocationLineFormat, line)); + return new ErrorLocationItem[0]; + } + } + + return errorLocationItems.ToArray(); + } + + /// + /// Fixes a error location items + /// + /// An array of instances + public static void FixErrorLocationItems(ErrorLocationItem[] errorLocationItems) + { + foreach (ErrorLocationItem errorLocationItem in errorLocationItems) + { + string functionName = errorLocationItem.FunctionName; + if (functionName.Length == 0 || functionName == OriginalGlobalCode) + { + errorLocationItem.FunctionName = WrapperGlobalCode; + } + else if (functionName == OriginalAnonymousFunctionName) + { + errorLocationItem.FunctionName = WrapperAnonymousFunctionName; + } + } + } + + #endregion + } +} \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.NiL/JavaScriptEngineSwitcher.NiL.csproj b/src/JavaScriptEngineSwitcher.NiL/JavaScriptEngineSwitcher.NiL.csproj index 637d40e6..6c41ccdd 100644 --- a/src/JavaScriptEngineSwitcher.NiL/JavaScriptEngineSwitcher.NiL.csproj +++ b/src/JavaScriptEngineSwitcher.NiL/JavaScriptEngineSwitcher.NiL.csproj @@ -2,12 +2,14 @@ JS Engine Switcher: NiL - 3.19.0 - net461;net48;netstandard1.3;netstandard1.6;netstandard2.0;netcoreapp3.1;net5.0;net6.0 + 3.30.0 + net461;net48;netcoreapp3.1;net6.0;net8.0;net9.0 Library true $(NoWarn);CS1591 + false true + false @@ -16,27 +18,20 @@ - JavaScriptEngineSwitcher.NiL contains adapter `NiLJsEngine` (wrapper for the NiL JavaScript Engine (https://github.com/nilproject/NiL.JS) version 2.5.1560). - $(PackageCommonTags);NiL + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_NiL_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_NiL_Logo128x128.png + JavaScriptEngineSwitcher.NiL contains a `NiLJsEngine` adapter (wrapper for the NiL.JS). + $(PackageCommonTags);NiL + NiL.JS was updated to version 2.6.1712. - + - - nil-license.txt - true - false - - - - readme.txt - true - + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.NiL/JsEngineFactoryCollectionExtensions.cs b/src/JavaScriptEngineSwitcher.NiL/JsEngineFactoryCollectionExtensions.cs index 9cb2b816..985d6ef5 100644 --- a/src/JavaScriptEngineSwitcher.NiL/JsEngineFactoryCollectionExtensions.cs +++ b/src/JavaScriptEngineSwitcher.NiL/JsEngineFactoryCollectionExtensions.cs @@ -11,10 +11,10 @@ public static class JsEngineFactoryCollectionExtensions { /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of - /// Instance of + /// Instance of + /// Instance of public static JsEngineFactoryCollection AddNiL(this JsEngineFactoryCollection source) { if (source == null) @@ -27,11 +27,11 @@ public static JsEngineFactoryCollection AddNiL(this JsEngineFactoryCollection so /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// The delegate to configure the provided - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddNiL(this JsEngineFactoryCollection source, Action configure) { @@ -53,11 +53,11 @@ public static JsEngineFactoryCollection AddNiL(this JsEngineFactoryCollection so /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// Settings of the NiL JS engine - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddNiL(this JsEngineFactoryCollection source, NiLSettings settings) { if (source == null) diff --git a/src/JavaScriptEngineSwitcher.NiL/NiLJsEngine.cs b/src/JavaScriptEngineSwitcher.NiL/NiLJsEngine.cs index 657db89c..90405344 100644 --- a/src/JavaScriptEngineSwitcher.NiL/NiLJsEngine.cs +++ b/src/JavaScriptEngineSwitcher.NiL/NiLJsEngine.cs @@ -24,6 +24,8 @@ using WrapperRuntimeException = JavaScriptEngineSwitcher.Core.JsRuntimeException; using WrapperScriptException = JavaScriptEngineSwitcher.Core.JsScriptException; +using JavaScriptEngineSwitcher.NiL.Helpers; + namespace JavaScriptEngineSwitcher.NiL { /// @@ -39,7 +41,7 @@ public sealed class NiLJsEngine : JsEngineBase /// /// Version of original JS engine /// - private const string EngineVersion = "2.5.1560"; + private const string EngineVersion = "2.6.1712"; /// /// Regular expression for working with the syntax error message @@ -114,7 +116,7 @@ private static OriginalValue MapToScriptType(object value) return OriginalValue.Undefined; } - return OriginalValue.Marshal(value); + return OriginalContext.CurrentGlobalContext.ProxyValue(value); } /// @@ -199,19 +201,42 @@ private static WrapperException WrapJsException(OriginalException originalExcept } else { - string sourceCode = originalException.Code; + string sourceCode = originalException.SourceCode; OriginalCodeCoordinates codeCoordinates = originalException.CodeCoordinates; if (codeCoordinates != null) { lineNumber = codeCoordinates.Line; columnNumber = codeCoordinates.Column; } + sourceFragment = TextHelpers.GetTextFragment(sourceCode, lineNumber, columnNumber); - message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, string.Empty, - lineNumber, columnNumber, sourceFragment); + string callStack = string.Empty; + ErrorLocationItem[] callStackItems = NiLJsErrorHelpers.ParseErrorLocation( + originalException.StackTrace); + if (callStackItems.Length > 0) + { + NiLJsErrorHelpers.FixErrorLocationItems(callStackItems); + + ErrorLocationItem firstCallStackItem = callStackItems[0]; + firstCallStackItem.SourceFragment = sourceFragment; - wrapperScriptException = new WrapperRuntimeException(message, EngineName, EngineVersion, + callStack = JsErrorHelpers.StringifyErrorLocationItems(callStackItems, true); + string callStackWithSourceFragment = JsErrorHelpers.StringifyErrorLocationItems( + callStackItems); + message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, + callStackWithSourceFragment); + } + else + { + message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, string.Empty, + lineNumber, columnNumber, sourceFragment); + } + + var wrapperRuntimeException = new WrapperRuntimeException(message, EngineName, EngineVersion, originalException); + wrapperRuntimeException.CallStack = callStack; + + wrapperScriptException = wrapperRuntimeException; } wrapperScriptException.Type = type; wrapperScriptException.LineNumber = lineNumber; @@ -453,7 +478,7 @@ protected override void InnerRemoveVariable(string variableName) protected override void InnerEmbedHostObject(string itemName, object value) { - OriginalValue processedValue = OriginalValue.Marshal(value); + OriginalValue processedValue = _jsContext.GlobalContext.ProxyValue(value); try { @@ -507,41 +532,26 @@ protected override void InnerCollectGarbage() #region IJsEngine implementation - /// - /// Gets a name of JS engine - /// public override string Name { get { return EngineName; } } - /// - /// Gets a version of original JS engine - /// public override string Version { get { return EngineVersion; } } - /// - /// Gets a value that indicates if the JS engine supports script pre-сompilation - /// public override bool SupportsScriptPrecompilation { get { return false; } } - /// - /// Gets a value that indicates if the JS engine supports script interruption - /// public override bool SupportsScriptInterruption { get { return false; } } - /// - /// Gets a value that indicates if the JS engine supports garbage collection - /// public override bool SupportsGarbageCollection { get { return false; } diff --git a/src/JavaScriptEngineSwitcher.NiL/NiLJsEngineFactory.cs b/src/JavaScriptEngineSwitcher.NiL/NiLJsEngineFactory.cs index 8b42e84f..d4c51f48 100644 --- a/src/JavaScriptEngineSwitcher.NiL/NiLJsEngineFactory.cs +++ b/src/JavaScriptEngineSwitcher.NiL/NiLJsEngineFactory.cs @@ -32,9 +32,7 @@ public NiLJsEngineFactory(NiLSettings settings) #region IJsEngineFactory implementation - /// - /// Gets a name of JS engine - /// + /// public string EngineName { get { return NiLJsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.NiL/NiLSettings.cs b/src/JavaScriptEngineSwitcher.NiL/NiLSettings.cs index 8a812f6b..9fdd7142 100644 --- a/src/JavaScriptEngineSwitcher.NiL/NiLSettings.cs +++ b/src/JavaScriptEngineSwitcher.NiL/NiLSettings.cs @@ -28,7 +28,7 @@ public bool EnableDebugging } /// - /// Gets or sets a local time zone for the Date objects in the script + /// Gets or sets a local time zone for the Date objects in the script /// public TimeZoneInfo LocalTimeZone { diff --git a/src/JavaScriptEngineSwitcher.NiL/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.NiL/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..23fa1c6d --- /dev/null +++ b/src/JavaScriptEngineSwitcher.NiL/PACKAGE-DESCRIPTION.md @@ -0,0 +1 @@ +JavaScriptEngineSwitcher.NiL contains a `NiLJsEngine` adapter (wrapper for the [NiL.JS](https://github.com/nilproject/NiL.JS) version 2.6.1712). \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.NiL/readme.txt b/src/JavaScriptEngineSwitcher.NiL/readme.txt index 324fac85..5e707cdc 100644 --- a/src/JavaScriptEngineSwitcher.NiL/readme.txt +++ b/src/JavaScriptEngineSwitcher.NiL/readme.txt @@ -1,18 +1,23 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: NiL v3.19.0 + README file for JS Engine Switcher: NiL v3.30.0 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2025 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== - JavaScriptEngineSwitcher.NiL contains adapter `NiLJsEngine` (wrapper for the - NiL JavaScript Engine (https://github.com/nilproject/NiL.JS) version 2.5.1560). + JavaScriptEngineSwitcher.NiL contains a `NiLJsEngine` adapter (wrapper for the + NiL.JS (https://github.com/nilproject/NiL.JS) version 2.6.1712). + + ============= + RELEASE NOTES + ============= + NiL.JS was updated to version 2.6.1712. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.Node/DefaultNodeJsService.cs b/src/JavaScriptEngineSwitcher.Node/DefaultNodeJsService.cs index ba0295b9..75efc139 100644 --- a/src/JavaScriptEngineSwitcher.Node/DefaultNodeJsService.cs +++ b/src/JavaScriptEngineSwitcher.Node/DefaultNodeJsService.cs @@ -98,7 +98,7 @@ public Task TryInvokeFromCacheAsync(string moduleCacheIdentifier, string e return StaticNodeJSService.TryInvokeFromCacheAsync(moduleCacheIdentifier, exportName, args, cancellationToken); } - public void MoveToNewProcess() + public ValueTask MoveToNewProcessAsync() { throw new NotSupportedException(); } diff --git a/src/JavaScriptEngineSwitcher.Node/Helpers/NodeJsErrorHelpers.cs b/src/JavaScriptEngineSwitcher.Node/Helpers/NodeJsErrorHelpers.cs index eefe63da..4322ad75 100644 --- a/src/JavaScriptEngineSwitcher.Node/Helpers/NodeJsErrorHelpers.cs +++ b/src/JavaScriptEngineSwitcher.Node/Helpers/NodeJsErrorHelpers.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Diagnostics; using System.Text.RegularExpressions; @@ -16,6 +17,11 @@ internal static class NodeJsErrorHelpers { #region Error location + /// + /// Name of file, which identifies the generated function call + /// + private const string GeneratedFunctionCallDocumentName = "JavaScriptEngineSwitcher.Node.Resources.generated-function-call.js"; + /// /// Pattern for working with document names with coordinates /// @@ -127,6 +133,48 @@ public static int GetColumnCountFromLine(string textLine) return columnCount; } + /// + /// Filters a error location items + /// + /// An array of instances + public static ErrorLocationItem[] FilterErrorLocationItems(ErrorLocationItem[] errorLocationItems) + { + int itemCount = errorLocationItems.Length; + if (itemCount == 0) + { + return errorLocationItems; + } + + int itemIndex = 0; + + while (itemIndex < itemCount) + { + ErrorLocationItem item = errorLocationItems[itemIndex]; + string documentName = item.DocumentName; + string functionName = item.FunctionName; + + if (documentName == "node:vm" + || documentName == "vm.js" + || documentName == GeneratedFunctionCallDocumentName + || (documentName == "anonymous" && functionName == "callFunction")) + { + break; + } + + itemIndex++; + } + + if (itemIndex == itemCount) + { + return errorLocationItems; + } + + var processedErrorLocationItems = new ErrorLocationItem[itemIndex]; + Array.Copy(errorLocationItems, processedErrorLocationItems, itemIndex); + + return processedErrorLocationItems; + } + #endregion } } \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Node/JavaScriptEngineSwitcher.Node.csproj b/src/JavaScriptEngineSwitcher.Node/JavaScriptEngineSwitcher.Node.csproj index a4fc4ce4..c8d22b0a 100644 --- a/src/JavaScriptEngineSwitcher.Node/JavaScriptEngineSwitcher.Node.csproj +++ b/src/JavaScriptEngineSwitcher.Node/JavaScriptEngineSwitcher.Node.csproj @@ -2,14 +2,17 @@ JS Engine Switcher: Node - 3.19.0 - net461;netstandard2.0;netcoreapp3.1;net5.0;net6.0 + 3.24.1 + net461;netstandard2.0;netcoreapp3.1;net5.0;net6.0;net7.0 Library true true - $(NoWarn);CS1591 + true + $(NoWarn);CS1591;NU1903 + false true true + false @@ -17,35 +20,21 @@ - JavaScriptEngineSwitcher.Node contains adapter `NodeJsEngine` (wrapper for the Jering.Javascript.NodeJS (https://github.com/JeringTech/Javascript.NodeJS) version 6.3.1). - -This package does not contain the `node.exe`. Therefore, you need to install the Node.js (https://nodejs.org) and add the `node.exe`'s directory to the `Path` environment variable (automatically done by the official installer). - $(PackageCommonTags);Node.js;Jering.Javascript.NodeJS + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_Node_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_Node_Logo128x128.png + JavaScriptEngineSwitcher.Node contains a `NodeJsEngine` adapter (wrapper for the Jering.Javascript.NodeJS). + $(PackageCommonTags);Node.js;Jering.Javascript.NodeJS - + - - jering-javascript-nodejs-license.txt - true - false - - - nodejs-license.txt - true - false - - - - readme.txt - true - + + diff --git a/src/JavaScriptEngineSwitcher.Node/JsEngineFactoryCollectionExtensions.cs b/src/JavaScriptEngineSwitcher.Node/JsEngineFactoryCollectionExtensions.cs index 7133ef88..81d1b4be 100644 --- a/src/JavaScriptEngineSwitcher.Node/JsEngineFactoryCollectionExtensions.cs +++ b/src/JavaScriptEngineSwitcher.Node/JsEngineFactoryCollectionExtensions.cs @@ -14,10 +14,10 @@ public static class JsEngineFactoryCollectionExtensions { /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of - /// Instance of + /// Instance of + /// Instance of public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection source) { if (source == null) @@ -32,11 +32,11 @@ public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection s /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// Node JS service - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection source, INodeJSService service) { @@ -57,11 +57,11 @@ public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection s /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// The services available in the application - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection source, IServiceCollection services) { @@ -82,11 +82,11 @@ public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection s /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// The delegate to configure the provided - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection source, Action configure) { @@ -110,11 +110,11 @@ public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection s /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// Settings of the Node JS engine - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection source, NodeSettings settings) { @@ -135,12 +135,12 @@ public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection s /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// Node JS service /// The delegate to configure the provided - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection source, INodeJSService service, Action configure) { @@ -169,12 +169,12 @@ public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection s /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// Node JS service /// Settings of the Node JS engine - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection source, INodeJSService service, NodeSettings settings) { @@ -200,12 +200,12 @@ public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection s /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// The services available in the application /// The delegate to configure the provided - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection source, IServiceCollection services, Action configure) { @@ -234,12 +234,12 @@ public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection s /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// The services available in the application /// Settings of the Node JS engine - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddNode(this JsEngineFactoryCollection source, IServiceCollection services, NodeSettings settings) { diff --git a/src/JavaScriptEngineSwitcher.Node/JsEngineIdGenerator.cs b/src/JavaScriptEngineSwitcher.Node/JsEngineIdGenerator.cs index ad15d62b..3cb37a31 100644 --- a/src/JavaScriptEngineSwitcher.Node/JsEngineIdGenerator.cs +++ b/src/JavaScriptEngineSwitcher.Node/JsEngineIdGenerator.cs @@ -8,9 +8,9 @@ internal static class JsEngineIdGenerator // Base32 encoding - in ascii sort order for easy text based sorting private static readonly char[] _encode32Chars = "0123456789ABCDEFGHIJKLMNOPQRSTUV".ToCharArray(); - // Seed the _lastId for this application instance with + // Seed the `_lastId` for this application instance with // the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001 - // for a roughly increasing _lastId over restarts + // for a roughly increasing `_lastId` over restarts private static long _lastId = DateTime.UtcNow.Ticks; @@ -37,7 +37,7 @@ private static unsafe string GenerateId(long id) buffer[1] = encode32Chars[(id >> 55) & 31]; buffer[0] = encode32Chars[(id >> 60) & 31]; - // string ctor overload that takes char* + // string `ctor` overload that takes `char*` return new string(buffer, 0, 13); } } diff --git a/src/JavaScriptEngineSwitcher.Node/NodeJsEngine.cs b/src/JavaScriptEngineSwitcher.Node/NodeJsEngine.cs index 6e3ac251..b3c0b8ea 100644 --- a/src/JavaScriptEngineSwitcher.Node/NodeJsEngine.cs +++ b/src/JavaScriptEngineSwitcher.Node/NodeJsEngine.cs @@ -34,11 +34,6 @@ public sealed class NodeJsEngine : JsEngineBase /// private const string ENGINE_HELPERS_RESOURCE_NAME = "JavaScriptEngineSwitcher.Node.Resources.engine-helpers.js"; - /// - /// Name of file, which identifies the generated function call - /// - private const string GENERATED_FUNCTION_CALL_FILE_NAME = "JavaScriptEngineSwitcher.Node.Resources.generated-function-call.js"; - /// /// Name of JS engine /// @@ -305,7 +300,7 @@ private WrapperException WrapInvocationException(InvocationException originalExc { string errorLocation = message.Substring(messageWithTypeLength); errorLocationItems = NodeJsErrorHelpers.ParseErrorLocation(errorLocation); - errorLocationItems = FilterErrorLocationItems(errorLocationItems); + errorLocationItems = NodeJsErrorHelpers.FilterErrorLocationItems(errorLocationItems); if (errorLocationItems.Length > 0) { @@ -350,41 +345,6 @@ private WrapperException WrapInvocationException(InvocationException originalExc return wrapperException; } - /// - /// Filters a error location items - /// - /// An array of instances - private static ErrorLocationItem[] FilterErrorLocationItems(ErrorLocationItem[] errorLocationItems) - { - if (errorLocationItems.Length == 0) - { - return errorLocationItems; - } - - int excessErrorLocationItemIndex = 0; - - foreach (ErrorLocationItem item in errorLocationItems) - { - string documentName = item.DocumentName; - string functionName = item.FunctionName; - - if (documentName == "node:vm" - || documentName == "vm.js" - || documentName == GENERATED_FUNCTION_CALL_FILE_NAME - || (documentName == "anonymous" && functionName == "callFunction")) - { - break; - } - - excessErrorLocationItemIndex++; - } - - var processedErrorLocationItems = new ErrorLocationItem[excessErrorLocationItemIndex]; - Array.Copy(errorLocationItems, processedErrorLocationItems, excessErrorLocationItemIndex); - - return processedErrorLocationItems; - } - #endregion #endregion @@ -555,41 +515,26 @@ protected override void InnerCollectGarbage() #region IJsEngine implementation - /// - /// Gets a name of JS engine - /// public override string Name { get { return EngineName; } } - /// - /// Gets a version of original JS engine - /// public override string Version { get { return _engineVersion; } } - /// - /// Gets a value that indicates if the JS engine supports script pre-compilation - /// public override bool SupportsScriptPrecompilation { get { return false; } } - /// - /// Gets a value that indicates if the JS engine supports script interruption - /// public override bool SupportsScriptInterruption { get { return false; } } - /// - /// Gets a value that indicates if the JS engine supports garbage collection - /// public override bool SupportsGarbageCollection { get { return false; } @@ -603,7 +548,7 @@ public override void Dispose() { if (_disposedFlag.Set()) { - InvokeEngineHelper("removeСontext", new[] { _engineId }); + InvokeEngineHelper("removeContext", new[] { _engineId }); _jsService = null; } } diff --git a/src/JavaScriptEngineSwitcher.Node/NodeJsEngineFactory.cs b/src/JavaScriptEngineSwitcher.Node/NodeJsEngineFactory.cs index d5cbcdfe..b805872a 100644 --- a/src/JavaScriptEngineSwitcher.Node/NodeJsEngineFactory.cs +++ b/src/JavaScriptEngineSwitcher.Node/NodeJsEngineFactory.cs @@ -88,9 +88,7 @@ public NodeJsEngineFactory(IServiceCollection services, NodeSettings settings) #region IJsEngineFactory implementation - /// - /// Gets a name of JS engine - /// + /// public string EngineName { get { return NodeJsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.Node/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.Node/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..76c940f9 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Node/PACKAGE-DESCRIPTION.md @@ -0,0 +1,4 @@ +JavaScriptEngineSwitcher.Node contains a `NodeJsEngine` adapter (wrapper for the [Jering.Javascript.NodeJS](https://github.com/JeringTech/Javascript.NodeJS) version 7.0.0). + +This package does not contain the `node.exe`. +Therefore, you need to install the [Node.js](https://nodejs.org) and add the `node.exe`'s directory to the `Path` environment variable (automatically done by the official installer). \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Node/Resources/engine-helpers.js b/src/JavaScriptEngineSwitcher.Node/Resources/engine-helpers.js index 3fe0d9de..d0c10831 100644 --- a/src/JavaScriptEngineSwitcher.Node/Resources/engine-helpers.js +++ b/src/JavaScriptEngineSwitcher.Node/Resources/engine-helpers.js @@ -17,7 +17,7 @@ function getContext(engineId) { if (!contexts.has(engineId)) { throw new UsageError("JavaScriptEngineSwitcher.Node module cannot work correctly " + "when the Node JS service is configured to work in the multi-process mode of " + - "Jering.Javascript.NodeJS library (https://github.com/JeringTech/Javascript.NodeJS#concurrency), " + + "Jering.Javascript.NodeJS library (https://github.com/JeringTech/Javascript.NodeJS#enabling-multi-process-concurrency), " + "because in this mode it is not possible to store a state of JS engine." ); } @@ -27,8 +27,16 @@ function getContext(engineId) { module.exports = { addContext: (callback, engineId, useBuiltinLibrary) => { - let sandboxPrototype = useBuiltinLibrary ? global : null; - let sandbox = Object.create(sandboxPrototype); + let sandbox; + if (useBuiltinLibrary) { + sandbox = Object.create(global); + if (typeof sandbox['require'] === 'undefined') { + sandbox['require'] = require; + } + } + else { + sandbox = Object.create(null); + } let context = vm.createContext(sandbox); contexts.set(engineId, context); @@ -36,7 +44,7 @@ module.exports = { callback(null); }, - removeСontext: (callback, engineId) => { + removeContext: (callback, engineId) => { contexts.delete(engineId); callback(null); }, diff --git a/src/JavaScriptEngineSwitcher.Node/readme.txt b/src/JavaScriptEngineSwitcher.Node/readme.txt index c61954ef..4f89b068 100644 --- a/src/JavaScriptEngineSwitcher.Node/readme.txt +++ b/src/JavaScriptEngineSwitcher.Node/readme.txt @@ -1,19 +1,19 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: Node v3.19.0 + README file for JS Engine Switcher: Node v3.24.1 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2024 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== - JavaScriptEngineSwitcher.Node contains adapter `NodeJsEngine` (wrapper for the + JavaScriptEngineSwitcher.Node contains a `NodeJsEngine` adapter (wrapper for the Jering.Javascript.NodeJS (https://github.com/JeringTech/Javascript.NodeJS) - version 6.3.1). + version 7.0.0). This package does not contain the `node.exe`. Therefore, you need to install the Node.js (https://nodejs.org) and add the `node.exe`'s directory to the `Path` diff --git a/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/JavaScriptEngineSwitcher.V8.Native.linux-x64.csproj b/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/JavaScriptEngineSwitcher.V8.Native.linux-x64.csproj index cc719ca7..e761c1b1 100644 --- a/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/JavaScriptEngineSwitcher.V8.Native.linux-x64.csproj +++ b/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/JavaScriptEngineSwitcher.V8.Native.linux-x64.csproj @@ -2,7 +2,7 @@ JS Engine Switcher: V8 for Linux (x64) - 3.18.4 + 3.29.0 netstandard2.0 @@ -11,10 +11,11 @@ - This package is deprecated. Instead, it is recommended to use a 'Microsoft.ClearScript.V8.Native.linux-x64' package. - $(PackageCommonTags);V8;ClearScript;Linux;x64 + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_V8_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_V8_Logo128x128.png - Microsoft ClearScript.V8 was updated to version 7.3.1 (support of V8 version 10.3.174.17). + This package is deprecated. Instead, it is recommended to use a Microsoft.ClearScript.V8.Native.linux-x64 package. + $(PackageCommonTags);V8;ClearScript;Linux;x64 + Microsoft ClearScript.V8 was updated to version 7.5 (support of the V8 version 13.3.415.23). \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/JavaScriptEngineSwitcher.V8.Native.linux-x64.nuspec b/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/JavaScriptEngineSwitcher.V8.Native.linux-x64.nuspec index 8b72ac5a..bf4bfdc0 100644 --- a/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/JavaScriptEngineSwitcher.V8.Native.linux-x64.nuspec +++ b/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/JavaScriptEngineSwitcher.V8.Native.linux-x64.nuspec @@ -1,15 +1,14 @@  - + $CommonMetadataElements$ - + $CommonFileElements$ - - - + + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..3bb23eb4 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/PACKAGE-DESCRIPTION.md @@ -0,0 +1,2 @@ +This package is deprecated. +Instead, it is recommended to use a [Microsoft.ClearScript.V8.Native.linux-x64](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.linux-x64) package. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/readme.txt b/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/readme.txt index e06f08b4..9859dd74 100644 --- a/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/readme.txt +++ b/src/JavaScriptEngineSwitcher.V8.Native.linux-x64/readme.txt @@ -1,24 +1,24 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: V8 for Linux x64 v3.18.4 + README file for JS Engine Switcher: V8 for Linux x64 v3.29.0 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2025 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== This package is deprecated. Instead, it is recommended to use a - 'Microsoft.ClearScript.V8.Native.linux-x64' package. + Microsoft.ClearScript.V8.Native.linux-x64 package. ============= RELEASE NOTES ============= - Microsoft ClearScript.V8 was updated to version 7.3.1 (support of V8 version - 10.3.174.17). + Microsoft ClearScript.V8 was updated to version 7.5 (support of the V8 + version 13.3.415.23). ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/JavaScriptEngineSwitcher.V8.Native.osx-x64.csproj b/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/JavaScriptEngineSwitcher.V8.Native.osx-x64.csproj index 0f807152..060da60d 100644 --- a/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/JavaScriptEngineSwitcher.V8.Native.osx-x64.csproj +++ b/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/JavaScriptEngineSwitcher.V8.Native.osx-x64.csproj @@ -2,7 +2,7 @@ JS Engine Switcher: V8 for OS X (x64) - 3.18.4 + 3.29.0 netstandard2.0 @@ -11,10 +11,11 @@ - This package is deprecated. Instead, it is recommended to use a 'Microsoft.ClearScript.V8.Native.osx-x64' package. - $(PackageCommonTags);V8;ClearScript;macOS;OSX;x64 + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_V8_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_V8_Logo128x128.png - Microsoft ClearScript.V8 was updated to version 7.3.1 (support of V8 version 10.3.174.17). + This package is deprecated. Instead, it is recommended to use a Microsoft.ClearScript.V8.Native.osx-x64 package. + $(PackageCommonTags);V8;ClearScript;macOS;OSX;x64 + Microsoft ClearScript.V8 was updated to version 7.5 (support of the V8 version 13.3.415.23). \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/JavaScriptEngineSwitcher.V8.Native.osx-x64.nuspec b/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/JavaScriptEngineSwitcher.V8.Native.osx-x64.nuspec index 66acafdb..10bede4f 100644 --- a/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/JavaScriptEngineSwitcher.V8.Native.osx-x64.nuspec +++ b/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/JavaScriptEngineSwitcher.V8.Native.osx-x64.nuspec @@ -1,15 +1,14 @@  - + $CommonMetadataElements$ - + $CommonFileElements$ - - - + + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..2455eca2 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/PACKAGE-DESCRIPTION.md @@ -0,0 +1,2 @@ +This package is deprecated. +Instead, it is recommended to use a [Microsoft.ClearScript.V8.Native.osx-x64](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.osx-x64) package. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/readme.txt b/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/readme.txt index 9d7053d0..da4e5d5a 100644 --- a/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/readme.txt +++ b/src/JavaScriptEngineSwitcher.V8.Native.osx-x64/readme.txt @@ -1,24 +1,24 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: V8 for OS X x64 v3.18.4 + README file for JS Engine Switcher: V8 for OS X x64 v3.29.0 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2025 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== This package is deprecated. Instead, it is recommended to use a - 'Microsoft.ClearScript.V8.Native.osx-x64' package. + Microsoft.ClearScript.V8.Native.osx-x64 package. ============= RELEASE NOTES ============= - Microsoft ClearScript.V8 was updated to version 7.3.1 (support of V8 version - 10.3.174.17). + Microsoft ClearScript.V8 was updated to version 7.5 (support of the V8 + version 13.3.415.23). ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.V8.Native.win-x64/JavaScriptEngineSwitcher.V8.Native.win-x64.csproj b/src/JavaScriptEngineSwitcher.V8.Native.win-x64/JavaScriptEngineSwitcher.V8.Native.win-x64.csproj index 4cba64d4..848e4af8 100644 --- a/src/JavaScriptEngineSwitcher.V8.Native.win-x64/JavaScriptEngineSwitcher.V8.Native.win-x64.csproj +++ b/src/JavaScriptEngineSwitcher.V8.Native.win-x64/JavaScriptEngineSwitcher.V8.Native.win-x64.csproj @@ -2,7 +2,7 @@ JS Engine Switcher: V8 for Windows (x64) - 3.18.4 + 3.29.0 netstandard2.0 @@ -11,10 +11,11 @@ - This package is deprecated. Instead, it is recommended to use a 'Microsoft.ClearScript.V8.Native.win-x64' package. - $(PackageCommonTags);V8;ClearScript;Windows;x64 + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_V8_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_V8_Logo128x128.png - Microsoft ClearScript.V8 was updated to version 7.3.1 (support of V8 version 10.3.174.17). + This package is deprecated. Instead, it is recommended to use a Microsoft.ClearScript.V8.Native.win-x64 package. + $(PackageCommonTags);V8;ClearScript;Windows;x64 + Microsoft ClearScript.V8 was updated to version 7.5 (support of the V8 version 13.3.415.23). \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8.Native.win-x64/JavaScriptEngineSwitcher.V8.Native.win-x64.nuspec b/src/JavaScriptEngineSwitcher.V8.Native.win-x64/JavaScriptEngineSwitcher.V8.Native.win-x64.nuspec index 1d010d67..7b52ae54 100644 --- a/src/JavaScriptEngineSwitcher.V8.Native.win-x64/JavaScriptEngineSwitcher.V8.Native.win-x64.nuspec +++ b/src/JavaScriptEngineSwitcher.V8.Native.win-x64/JavaScriptEngineSwitcher.V8.Native.win-x64.nuspec @@ -1,15 +1,14 @@  - + $CommonMetadataElements$ - + $CommonFileElements$ - - - + + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8.Native.win-x64/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.V8.Native.win-x64/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..2efc6700 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.V8.Native.win-x64/PACKAGE-DESCRIPTION.md @@ -0,0 +1,2 @@ +This package is deprecated. +Instead, it is recommended to use a [Microsoft.ClearScript.V8.Native.win-x64](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.win-x64) package. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8.Native.win-x64/readme.txt b/src/JavaScriptEngineSwitcher.V8.Native.win-x64/readme.txt index 37c12ddd..408c9a2c 100644 --- a/src/JavaScriptEngineSwitcher.V8.Native.win-x64/readme.txt +++ b/src/JavaScriptEngineSwitcher.V8.Native.win-x64/readme.txt @@ -1,24 +1,24 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: V8 for Windows x64 v3.18.4 + README file for JS Engine Switcher: V8 for Windows x64 v3.29.0 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2025 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== This package is deprecated. Instead, it is recommended to use a - 'Microsoft.ClearScript.V8.Native.win-x64' package. + Microsoft.ClearScript.V8.Native.win-x64 package. ============= RELEASE NOTES ============= - Microsoft ClearScript.V8 was updated to version 7.3.1 (support of V8 version - 10.3.174.17). + Microsoft ClearScript.V8 was updated to version 7.5 (support of the V8 + version 13.3.415.23). ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.V8.Native.win-x86/JavaScriptEngineSwitcher.V8.Native.win-x86.csproj b/src/JavaScriptEngineSwitcher.V8.Native.win-x86/JavaScriptEngineSwitcher.V8.Native.win-x86.csproj index f05ed195..d4261f95 100644 --- a/src/JavaScriptEngineSwitcher.V8.Native.win-x86/JavaScriptEngineSwitcher.V8.Native.win-x86.csproj +++ b/src/JavaScriptEngineSwitcher.V8.Native.win-x86/JavaScriptEngineSwitcher.V8.Native.win-x86.csproj @@ -2,7 +2,7 @@ JS Engine Switcher: V8 for Windows (x86) - 3.18.4 + 3.29.0 netstandard2.0 @@ -11,10 +11,11 @@ - This package is deprecated. Instead, it is recommended to use a 'Microsoft.ClearScript.V8.Native.win-x86' package. - $(PackageCommonTags);V8;ClearScript;Windows;x86 + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_V8_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_V8_Logo128x128.png - Microsoft ClearScript.V8 was updated to version 7.3.1 (support of V8 version 10.3.174.17). + This package is deprecated. Instead, it is recommended to use a Microsoft.ClearScript.V8.Native.win-x86 package. + $(PackageCommonTags);V8;ClearScript;Windows;x86 + Microsoft ClearScript.V8 was updated to version 7.5 (support of the V8 version 13.3.415.23). \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8.Native.win-x86/JavaScriptEngineSwitcher.V8.Native.win-x86.nuspec b/src/JavaScriptEngineSwitcher.V8.Native.win-x86/JavaScriptEngineSwitcher.V8.Native.win-x86.nuspec index 957f2871..4c5670eb 100644 --- a/src/JavaScriptEngineSwitcher.V8.Native.win-x86/JavaScriptEngineSwitcher.V8.Native.win-x86.nuspec +++ b/src/JavaScriptEngineSwitcher.V8.Native.win-x86/JavaScriptEngineSwitcher.V8.Native.win-x86.nuspec @@ -1,15 +1,14 @@  - + $CommonMetadataElements$ - + $CommonFileElements$ - - - + + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8.Native.win-x86/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.V8.Native.win-x86/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..44bc9064 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.V8.Native.win-x86/PACKAGE-DESCRIPTION.md @@ -0,0 +1,2 @@ +This package is deprecated. +Instead, it is recommended to use a [Microsoft.ClearScript.V8.Native.win-x86](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.win-x86) package. \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8.Native.win-x86/readme.txt b/src/JavaScriptEngineSwitcher.V8.Native.win-x86/readme.txt index 548a8a5d..d874dc4a 100644 --- a/src/JavaScriptEngineSwitcher.V8.Native.win-x86/readme.txt +++ b/src/JavaScriptEngineSwitcher.V8.Native.win-x86/readme.txt @@ -1,24 +1,24 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: V8 for Windows x86 v3.18.4 + README file for JS Engine Switcher: V8 for Windows x86 v3.29.0 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2025 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== This package is deprecated. Instead, it is recommended to use a - 'Microsoft.ClearScript.V8.Native.win-x86' package. + Microsoft.ClearScript.V8.Native.win-x86 package. ============= RELEASE NOTES ============= - Microsoft ClearScript.V8 was updated to version 7.3.1 (support of V8 version - 10.3.174.17). + Microsoft ClearScript.V8 was updated to version 7.5 (support of the V8 + version 13.3.415.23). ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.V8/JavaScriptEngineSwitcher.V8.csproj b/src/JavaScriptEngineSwitcher.V8/JavaScriptEngineSwitcher.V8.csproj index 67a79d95..3ccf3374 100644 --- a/src/JavaScriptEngineSwitcher.V8/JavaScriptEngineSwitcher.V8.csproj +++ b/src/JavaScriptEngineSwitcher.V8/JavaScriptEngineSwitcher.V8.csproj @@ -2,13 +2,15 @@ JS Engine Switcher: V8 - 3.19.0 - net45;net471;netstandard2.1;netcoreapp3.1;net5.0 + 3.29.1 + net462;net471;netstandard2.1;netcoreapp3.1;net5.0 Library true - $(NoWarn);CS1591 + $(NoWarn);CS1591;NU1903 + false true true + false @@ -16,57 +18,28 @@ - JavaScriptEngineSwitcher.V8 contains adapter `V8JsEngine` (wrapper for the Microsoft ClearScript.V8 (http://github.com/Microsoft/ClearScript) version 7.3.1). - -This package does not contain the native ClearScript.V8 assemblies. Therefore, you need to choose and install the most appropriate package(s) for your platform. The following packages are available: - - * Microsoft.ClearScript.V8.Native.win-x86 - * Microsoft.ClearScript.V8.Native.win-x64 - * Microsoft.ClearScript.V8.Native.win-arm64 - * Microsoft.ClearScript.V8.Native.linux-x64 - * Microsoft.ClearScript.V8.Native.linux-arm - * Microsoft.ClearScript.V8.Native.linux-arm64 - * Microsoft.ClearScript.V8.Native.osx-x64 - * Microsoft.ClearScript.V8.Native.osx-arm64 - $(PackageCommonTags);V8;ClearScript + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_V8_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_V8_Logo128x128.png - Fixed a error #102 “Resources should conform to correct ICU standard for naming”. Special thanks to Tim Heuer. + JavaScriptEngineSwitcher.V8 contains a `V8JsEngine` adapter (wrapper for the Microsoft ClearScript.V8). + $(PackageCommonTags);V8;ClearScript + Performed a migration to a modern API for pre-compilation of scripts. - + - - - + + - - advanced-string-builder-license.txt - true - false - - - clearscript-license.txt - true - false - - - v8-license.txt - true - false - - - - readme.txt - true - + + - + diff --git a/src/JavaScriptEngineSwitcher.V8/JsEngineFactoryCollectionExtensions.cs b/src/JavaScriptEngineSwitcher.V8/JsEngineFactoryCollectionExtensions.cs index a2c68ab2..0e2a95e3 100644 --- a/src/JavaScriptEngineSwitcher.V8/JsEngineFactoryCollectionExtensions.cs +++ b/src/JavaScriptEngineSwitcher.V8/JsEngineFactoryCollectionExtensions.cs @@ -11,10 +11,10 @@ public static class JsEngineFactoryCollectionExtensions { /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of - /// Instance of + /// Instance of + /// Instance of public static JsEngineFactoryCollection AddV8(this JsEngineFactoryCollection source) { if (source == null) @@ -27,11 +27,11 @@ public static JsEngineFactoryCollection AddV8(this JsEngineFactoryCollection sou /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// The delegate to configure the provided - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddV8(this JsEngineFactoryCollection source, Action configure) { @@ -53,11 +53,11 @@ public static JsEngineFactoryCollection AddV8(this JsEngineFactoryCollection sou /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// Settings of the V8 JS engine - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddV8(this JsEngineFactoryCollection source, V8Settings settings) { diff --git a/src/JavaScriptEngineSwitcher.V8/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.V8/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..5c20ea92 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.V8/PACKAGE-DESCRIPTION.md @@ -0,0 +1,14 @@ +JavaScriptEngineSwitcher.V8 contains a `V8JsEngine` adapter (wrapper for the [Microsoft ClearScript.V8](http://github.com/Microsoft/ClearScript) version 7.5). + +This package does not contain the native ClearScript.V8 assemblies. +Therefore, you need to choose and install the most appropriate package(s) for your platform. +The following packages are available: + + * [Microsoft.ClearScript.V8.Native.win-x86](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.win-x86) + * [Microsoft.ClearScript.V8.Native.win-x64](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.win-x64) + * [Microsoft.ClearScript.V8.Native.win-arm64](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.win-arm64) + * [Microsoft.ClearScript.V8.Native.linux-x64](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.linux-x64) + * [Microsoft.ClearScript.V8.Native.linux-arm](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.linux-arm) + * [Microsoft.ClearScript.V8.Native.linux-arm64](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.linux-arm64) + * [Microsoft.ClearScript.V8.Native.osx-x64](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.osx-x64) + * [Microsoft.ClearScript.V8.Native.osx-arm64](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.osx-arm64) \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8/Resources/Strings.Designer.cs b/src/JavaScriptEngineSwitcher.V8/Resources/Strings.Designer.cs index 4efb1f2f..f4759a72 100644 --- a/src/JavaScriptEngineSwitcher.V8/Resources/Strings.Designer.cs +++ b/src/JavaScriptEngineSwitcher.V8/Resources/Strings.Designer.cs @@ -21,7 +21,7 @@ internal class Strings private static Lazy _resourceManager = new Lazy(() => new ResourceManager( "JavaScriptEngineSwitcher.V8.Resources.Strings", -#if NET40 +#if NET20 || NET30 || NET35 || NET40 typeof(Strings).Assembly #else typeof(Strings).GetTypeInfo().Assembly diff --git a/src/JavaScriptEngineSwitcher.V8/V8JsEngine.cs b/src/JavaScriptEngineSwitcher.V8/V8JsEngine.cs index f5aeb0cc..6b5f74db 100644 --- a/src/JavaScriptEngineSwitcher.V8/V8JsEngine.cs +++ b/src/JavaScriptEngineSwitcher.V8/V8JsEngine.cs @@ -4,6 +4,9 @@ using System.Text.RegularExpressions; using OriginalCacheKind = Microsoft.ClearScript.V8.V8CacheKind; +using OriginalCacheResult = Microsoft.ClearScript.V8.V8CacheResult; +using OriginalDocumentFlags = Microsoft.ClearScript.DocumentFlags; +using OriginalDocumentInfo = Microsoft.ClearScript.DocumentInfo; using OriginalEngine = Microsoft.ClearScript.V8.V8ScriptEngine; using OriginalEngineFlags = Microsoft.ClearScript.V8.V8ScriptEngineFlags; using OriginalException = Microsoft.ClearScript.ScriptEngineException; @@ -47,7 +50,7 @@ public sealed class V8JsEngine : JsEngineBase /// /// Version of original JS engine /// - private const string EngineVersion = "10.3.174.17"; + private const string EngineVersion = "13.3.415.23"; /// /// V8 JS engine @@ -107,6 +110,10 @@ public V8JsEngine(V8Settings settings) }; OriginalEngineFlags flags = OriginalEngineFlags.None; + if (v8Settings.AddPerformanceObject) + { + flags |= OriginalEngineFlags.AddPerformanceObject; + } if (v8Settings.AwaitDebuggerAndPauseOnStart) { flags |= OriginalEngineFlags.AwaitDebuggerAndPauseOnStart; @@ -123,6 +130,10 @@ public V8JsEngine(V8Settings settings) { flags |= OriginalEngineFlags.DisableGlobalMembers; } + if (v8Settings.SetTimerResolution) + { + flags |= OriginalEngineFlags.SetTimerResolution; + } int debugPort = v8Settings.DebugPort; @@ -130,6 +141,8 @@ public V8JsEngine(V8Settings settings) { _jsEngine = new OriginalEngine(constraints, flags, debugPort) { + AllowReflection = v8Settings.AllowReflection, + DisableDynamicBinding = v8Settings.DisableDynamicBinding, MaxRuntimeHeapSize = v8Settings.MaxHeapSize, RuntimeHeapSizeSampleInterval = v8Settings.HeapSizeSampleInterval, MaxRuntimeStackUsage = v8Settings.MaxStackUsage @@ -354,12 +367,13 @@ protected override IPrecompiledScript InnerPrecompile(string code) protected override IPrecompiledScript InnerPrecompile(string code, string documentName) { + var documentInfo = new OriginalDocumentInfo(documentName); var cacheKind = OriginalCacheKind.Code; byte[] cachedBytes; try { - using (OriginalScript generalScript = _jsEngine.Compile(documentName, code, cacheKind, + using (OriginalScript generalScript = _jsEngine.Compile(documentInfo, code, cacheKind, out cachedBytes)) { } } @@ -368,7 +382,7 @@ protected override IPrecompiledScript InnerPrecompile(string code, string docume throw WrapScriptEngineException(e); } - return new V8PrecompiledScript(code, cacheKind, cachedBytes, documentName); + return new V8PrecompiledScript(code, cacheKind, cachedBytes, documentInfo); } protected override object InnerEvaluate(string expression) @@ -378,11 +392,15 @@ protected override object InnerEvaluate(string expression) protected override object InnerEvaluate(string expression, string documentName) { + var documentInfo = new OriginalDocumentInfo(documentName) + { + Flags = OriginalDocumentFlags.None + }; object result; try { - result = _jsEngine.Evaluate(documentName, false, expression); + result = _jsEngine.Evaluate(documentInfo, expression); } catch (OriginalException e) { @@ -417,9 +435,14 @@ protected override void InnerExecute(string code) protected override void InnerExecute(string code, string documentName) { + var documentInfo = new OriginalDocumentInfo(documentName) + { + Flags = OriginalDocumentFlags.None + }; + try { - _jsEngine.Execute(documentName, false, code); + _jsEngine.Execute(documentInfo, code); } catch (OriginalException e) { @@ -443,15 +466,15 @@ protected override void InnerExecute(IPrecompiledScript precompiledScript) ); } - bool cacheAccepted; + byte[] cachedBytes = v8PrecompiledScript.CachedBytes; try { - using (OriginalScript script = _jsEngine.Compile(v8PrecompiledScript.DocumentName, - v8PrecompiledScript.Code, v8PrecompiledScript.CacheKind, v8PrecompiledScript.CachedBytes, - out cacheAccepted)) + using (OriginalScript script = _jsEngine.Compile(v8PrecompiledScript.DocumentInfo, + v8PrecompiledScript.Code, v8PrecompiledScript.CacheKind, ref cachedBytes, + out var cacheResult)) { - if (!cacheAccepted) + if (cacheResult != OriginalCacheResult.Accepted && cacheResult != OriginalCacheResult.Verified) { throw new WrapperUsageException(Strings.Usage_PrecompiledScriptNotAccepted, Name, Version); } @@ -638,41 +661,26 @@ protected override void InnerCollectGarbage() #region IJsEngine implementation - /// - /// Gets a name of JS engine - /// public override string Name { get { return EngineName; } } - /// - /// Gets a version of original JS engine - /// public override string Version { get { return EngineVersion; } } - /// - /// Gets a value that indicates if the JS engine supports script pre-compilation - /// public override bool SupportsScriptPrecompilation { get { return true; } } - /// - /// Gets a value that indicates if the JS engine supports script interruption - /// public override bool SupportsScriptInterruption { get { return true; } } - /// - /// Gets a value that indicates if the JS engine supports garbage collection - /// public override bool SupportsGarbageCollection { get { return true; } diff --git a/src/JavaScriptEngineSwitcher.V8/V8JsEngineFactory.cs b/src/JavaScriptEngineSwitcher.V8/V8JsEngineFactory.cs index 5c96f33a..2bfdbe03 100644 --- a/src/JavaScriptEngineSwitcher.V8/V8JsEngineFactory.cs +++ b/src/JavaScriptEngineSwitcher.V8/V8JsEngineFactory.cs @@ -32,9 +32,7 @@ public V8JsEngineFactory(V8Settings settings) #region IJsEngineFactory implementation - /// - /// Gets a name of JS engine - /// + /// public string EngineName { get { return V8JsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.V8/V8PrecompiledScript.cs b/src/JavaScriptEngineSwitcher.V8/V8PrecompiledScript.cs index a3753083..16464dd5 100644 --- a/src/JavaScriptEngineSwitcher.V8/V8PrecompiledScript.cs +++ b/src/JavaScriptEngineSwitcher.V8/V8PrecompiledScript.cs @@ -1,4 +1,5 @@ using OriginalCacheKind = Microsoft.ClearScript.V8.V8CacheKind; +using OriginalDocumentInfo = Microsoft.ClearScript.DocumentInfo; using JavaScriptEngineSwitcher.Core; @@ -37,9 +38,9 @@ public byte[] CachedBytes } /// - /// Gets a document name + /// Gets a meta-information for the document /// - public string DocumentName + public OriginalDocumentInfo DocumentInfo { get; private set; @@ -52,22 +53,20 @@ public string DocumentName /// The source code of the script /// The kind of cache data to be generated /// Cached data for accelerated recompilation - /// Document name + /// Meta-information for the document public V8PrecompiledScript(string code, OriginalCacheKind cacheKind, byte[] cachedBytes, - string documentName) + OriginalDocumentInfo documentInfo) { Code = code; CacheKind = cacheKind; CachedBytes = cachedBytes; - DocumentName = documentName; + DocumentInfo = documentInfo; } #region IPrecompiledScript implementation - /// - /// Gets a name of JS engine for which the pre-compiled script was created - /// + /// public string EngineName { get { return V8JsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.V8/V8Settings.cs b/src/JavaScriptEngineSwitcher.V8/V8Settings.cs index 474d5d57..7d2810f1 100644 --- a/src/JavaScriptEngineSwitcher.V8/V8Settings.cs +++ b/src/JavaScriptEngineSwitcher.V8/V8Settings.cs @@ -8,32 +8,41 @@ namespace JavaScriptEngineSwitcher.V8 public sealed class V8Settings { /// - /// Gets or sets a flag for whether to the script engine is to wait for a debugger connection - /// and schedule a pause before executing the first line of application script code. - /// This property is ignored if value of the property is false. + /// Gets or sets a flag for whether to add the + /// Performance + /// object to the script engine's global namespace /// - public bool AwaitDebuggerAndPauseOnStart + /// + /// This object provides a set of low-level native facilities for performance-sensitive scripts. + /// + public bool AddPerformanceObject { get; set; } /// - /// Gets or sets a flag for whether to enable script debugging features - /// (allows a TCP-based debugging) + /// Gets or sets a flag for whether to allow the usage of reflection API in the script code /// - public bool EnableDebugging + /// + /// This affects , , + /// and . + /// By default, any attempt to access these members from the script code will throw an exception. + /// + public bool AllowReflection { get; set; } /// - /// Gets or sets a flag for whether to enable remote script debugging. - /// This property is ignored if value of the - /// property is false. + /// Gets or sets a flag for whether to the script engine is to wait for a debugger connection + /// and schedule a pause before executing the first line of application script code /// - public bool EnableRemoteDebugging + /// + /// This property is ignored if value of the property is false. + /// + public bool AwaitDebuggerAndPauseOnStart { get; set; @@ -48,6 +57,21 @@ public ushort DebugPort set; } + /// + /// Gets or sets a flag for whether to disable dynamic method binding + /// + /// + /// When this property is set to true, the script engine bypasses the default method + /// binding algorithm and uses reflection-based method binding instead. This approach + /// abandons support for generic type inference and other features, but it avoids engaging + /// the dynamic infrastructure. + /// + public bool DisableDynamicBinding + { + get; + set; + } + /// /// Gets or sets a flag for whether to disable global members /// @@ -57,19 +81,40 @@ public bool DisableGlobalMembers set; } + /// + /// Gets or sets a flag for whether to enable script debugging features + /// (allows a TCP-based debugging) + /// + public bool EnableDebugging + { + get; + set; + } + + /// + /// Gets or sets a flag for whether to enable remote script debugging + /// + /// + /// This property is ignored if value of the + /// property is false. + /// + public bool EnableRemoteDebugging + { + get; + set; + } + /// /// Gets or sets a heap expansion multiplier /// /// - /// - /// When set to a value greater than 1, this property enables on-demand heap expansion, + /// When set to a value greater than 1, this property enables on-demand heap expansion, /// which automatically increases the maximum heap size by the specified multiplier /// whenever the script engine is close to exceeding the current limit. Note that a buggy /// or malicious script can still cause an application to fail by exhausting its address /// space or total available memory. On-demand heap expansion is recommended for use in /// conjunction with heap size monitoring (see property to help /// contain runaway scripts). - /// /// public double HeapExpansionMultiplier { @@ -81,10 +126,8 @@ public double HeapExpansionMultiplier /// Gets or sets a minimum time interval between consecutive heap size samples /// /// - /// /// This property is effective only when heap size monitoring is enabled (see /// property) - /// /// public TimeSpan HeapSizeSampleInterval { @@ -93,12 +136,12 @@ public TimeSpan HeapSizeSampleInterval } /// - /// Gets or sets a maximum amount of ArrayBuffer memory the runtime may allocate + /// Gets or sets a maximum amount of ArrayBuffer memory the runtime may allocate /// /// - /// This property is specified in bytes. ArrayBuffer memory is allocated outside + /// This property is specified in bytes. ArrayBuffer memory is allocated outside /// the runtime's heap and released when its garbage collector reclaims the corresponding - /// JavaScript ArrayBuffer object. Leave this property at its default value to + /// JavaScript ArrayBuffer object. Leave this property at its default value to /// enforce no limit. /// public ulong MaxArrayBufferAllocation @@ -138,7 +181,7 @@ public int MaxExecutableSize /// an exception. /// /// - /// Note that ArrayBuffer memory is allocated outside the runtime's heap and is + /// Note that ArrayBuffer memory is allocated outside the runtime's heap and is /// therefore not tracked by heap size monitoring. See /// property for additional information. /// @@ -188,17 +231,36 @@ public UIntPtr MaxStackUsage set; } + /// + /// Gets or sets a flag for whether to set native timers to the highest available resolution + /// while the current script engine's instance is active + /// + /// + /// This property is ignored if value of the property + /// is false. It is only a hint and may be ignored on some systems. On platforms that + /// support it, this property can degrade overall system performance or power efficiency, so + /// caution is recommended. + /// + public bool SetTimerResolution + { + get; + set; + } + /// /// Constructs an instance of the V8 settings /// public V8Settings() { + AddPerformanceObject = false; + AllowReflection = false; AwaitDebuggerAndPauseOnStart = false; - EnableDebugging = false; - EnableRemoteDebugging = false; DebugPort = 9222; + DisableDynamicBinding = false; DisableGlobalMembers = false; + EnableDebugging = false; + EnableRemoteDebugging = false; HeapExpansionMultiplier = 0; HeapSizeSampleInterval = TimeSpan.Zero; MaxArrayBufferAllocation = ulong.MaxValue; @@ -206,6 +268,7 @@ public V8Settings() MaxNewSpaceSize = 0; MaxOldSpaceSize = 0; MaxStackUsage = UIntPtr.Zero; + SetTimerResolution = false; } } } \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.V8/readme.txt b/src/JavaScriptEngineSwitcher.V8/readme.txt index 7b113653..8e5be144 100644 --- a/src/JavaScriptEngineSwitcher.V8/readme.txt +++ b/src/JavaScriptEngineSwitcher.V8/readme.txt @@ -1,19 +1,19 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: V8 v3.19.0 + README file for JS Engine Switcher: V8 v3.29.1 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2025 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== - JavaScriptEngineSwitcher.V8 contains adapter `V8JsEngine` (wrapper for the + JavaScriptEngineSwitcher.V8 contains a `V8JsEngine` adapter (wrapper for the Microsoft ClearScript.V8 (http://github.com/Microsoft/ClearScript) version - 7.3.1). + 7.5). This package does not contain the native ClearScript.V8 assemblies. Therefore, you need to choose and install the most appropriate package(s) for @@ -31,8 +31,7 @@ ============= RELEASE NOTES ============= - Fixed a error #102 “Resources should conform to correct ICU standard for - naming”. Special thanks to Tim Heuer. + Performed a migration to a modern API for pre-compilation of scripts. ============= DOCUMENTATION diff --git a/src/JavaScriptEngineSwitcher.Vroom/JavaScriptEngineSwitcher.Vroom.csproj b/src/JavaScriptEngineSwitcher.Vroom/JavaScriptEngineSwitcher.Vroom.csproj index 266a070a..8f6a4403 100644 --- a/src/JavaScriptEngineSwitcher.Vroom/JavaScriptEngineSwitcher.Vroom.csproj +++ b/src/JavaScriptEngineSwitcher.Vroom/JavaScriptEngineSwitcher.Vroom.csproj @@ -2,12 +2,13 @@ JS Engine Switcher: Vroom - 3.19.0 + 3.24.1 net40-client;net45;net471;netstandard1.6;netstandard2.0 1.6.0 Library true - $(NoWarn);CS1591 + $(NoWarn);CS1591;NETSDK1215;NU1903 + false true true @@ -18,24 +19,21 @@ - JavaScriptEngineSwitcher.Vroom contains adapter `VroomJsEngine` (wrapper for the VroomJs (http://github.com/pauldotknopf/vroomjs-core) version 1.2.3 with support of V8 version 3.17.16.2). - -For correct working of the VroomJs on Windows require the Visual C++ Redistributable for Visual Studio 2012 and Microsoft Visual C++ 2015 Redistributable. - $(PackageCommonTags);VroomJs;V8 + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_Vroom_Logo128x128.png ../../Icons/JavaScriptEngineSwitcher_Vroom_Logo128x128.png - Fixed a error #102 “Resources should conform to correct ICU standard for naming”. Special thanks to Tim Heuer. + JavaScriptEngineSwitcher.Vroom contains a `VroomJsEngine` adapter (wrapper for the VroomJs). + $(PackageCommonTags);VroomJs;V8 - - + - + @@ -43,29 +41,11 @@ For correct working of the VroomJs on Windows require the Visual C++ Redistribut - - advanced-string-builder-license.txt - true - false - - - vroomjs-core-license.txt - true - false - - - v8-license.txt - true - false - - - - readme.txt - true - + + - + diff --git a/src/JavaScriptEngineSwitcher.Vroom/JsEngineFactoryCollectionExtensions.cs b/src/JavaScriptEngineSwitcher.Vroom/JsEngineFactoryCollectionExtensions.cs index 00572131..ac917976 100644 --- a/src/JavaScriptEngineSwitcher.Vroom/JsEngineFactoryCollectionExtensions.cs +++ b/src/JavaScriptEngineSwitcher.Vroom/JsEngineFactoryCollectionExtensions.cs @@ -11,10 +11,10 @@ public static class JsEngineFactoryCollectionExtensions { /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of - /// Instance of + /// Instance of + /// Instance of public static JsEngineFactoryCollection AddVroom(this JsEngineFactoryCollection source) { if (source == null) @@ -27,11 +27,11 @@ public static JsEngineFactoryCollection AddVroom(this JsEngineFactoryCollection /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// The delegate to configure the provided - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddVroom(this JsEngineFactoryCollection source, Action configure) { @@ -53,11 +53,11 @@ public static JsEngineFactoryCollection AddVroom(this JsEngineFactoryCollection /// /// Adds a instance of to - /// the specified + /// the specified /// - /// Instance of + /// Instance of /// Settings of the Vroom JS engine - /// Instance of + /// Instance of public static JsEngineFactoryCollection AddVroom(this JsEngineFactoryCollection source, VroomSettings settings) { diff --git a/src/JavaScriptEngineSwitcher.Vroom/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.Vroom/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..a27c35de --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Vroom/PACKAGE-DESCRIPTION.md @@ -0,0 +1,3 @@ +JavaScriptEngineSwitcher.Vroom contains a `VroomJsEngine` adapter (wrapper for the [VroomJs](http://github.com/pauldotknopf/vroomjs-core) version 1.2.3 with support of V8 version 3.17.16.2). + +For correct working of the VroomJs on Windows require the [Visual C++ Redistributable for Visual Studio 2012](https://www.microsoft.com/en-us/download/details.aspx?id=30679) and [Microsoft Visual C++ 2015 Redistributable](https://www.microsoft.com/en-us/download/details.aspx?id=53840). \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Vroom/Resources/Strings.Designer.cs b/src/JavaScriptEngineSwitcher.Vroom/Resources/Strings.Designer.cs index d180feea..59e44bb5 100644 --- a/src/JavaScriptEngineSwitcher.Vroom/Resources/Strings.Designer.cs +++ b/src/JavaScriptEngineSwitcher.Vroom/Resources/Strings.Designer.cs @@ -21,7 +21,7 @@ internal class Strings private static Lazy _resourceManager = new Lazy(() => new ResourceManager( "JavaScriptEngineSwitcher.Vroom.Resources.Strings", -#if NET40 +#if NET20 || NET30 || NET35 || NET40 typeof(Strings).Assembly #else typeof(Strings).GetTypeInfo().Assembly diff --git a/src/JavaScriptEngineSwitcher.Vroom/Utilities/SimplisticJsSerializer.cs b/src/JavaScriptEngineSwitcher.Vroom/Utilities/SimplisticJsSerializer.cs index 3ae525f8..4c29d4ce 100644 --- a/src/JavaScriptEngineSwitcher.Vroom/Utilities/SimplisticJsSerializer.cs +++ b/src/JavaScriptEngineSwitcher.Vroom/Utilities/SimplisticJsSerializer.cs @@ -15,10 +15,7 @@ namespace JavaScriptEngineSwitcher.Vroom.Utilities /// internal static class SimplisticJsSerializer { - private static bool JsEncodeAmpersand - { - get { return true; } - } + private const bool JsEncodeAmpersand = true; /// diff --git a/src/JavaScriptEngineSwitcher.Vroom/VroomJsEngine.cs b/src/JavaScriptEngineSwitcher.Vroom/VroomJsEngine.cs index 450fee51..270b9ccd 100644 --- a/src/JavaScriptEngineSwitcher.Vroom/VroomJsEngine.cs +++ b/src/JavaScriptEngineSwitcher.Vroom/VroomJsEngine.cs @@ -629,41 +629,26 @@ protected override void InnerCollectGarbage() #region IJsEngine implementation - /// - /// Gets a name of JS engine - /// public override string Name { get { return EngineName; } } - /// - /// Gets a version of original JS engine - /// public override string Version { get { return EngineVersion; } } - /// - /// Gets a value that indicates if the JS engine supports script pre-сompilation - /// public override bool SupportsScriptPrecompilation { get { return false; } } - /// - /// Gets a value that indicates if the JS engine supports script interruption - /// public override bool SupportsScriptInterruption { get { return true; } } - /// - /// Gets a value that indicates if the JS engine supports garbage collection - /// public override bool SupportsGarbageCollection { get { return false; } diff --git a/src/JavaScriptEngineSwitcher.Vroom/VroomJsEngineFactory.cs b/src/JavaScriptEngineSwitcher.Vroom/VroomJsEngineFactory.cs index 915ca229..f6f31e4b 100644 --- a/src/JavaScriptEngineSwitcher.Vroom/VroomJsEngineFactory.cs +++ b/src/JavaScriptEngineSwitcher.Vroom/VroomJsEngineFactory.cs @@ -32,9 +32,7 @@ public VroomJsEngineFactory(VroomSettings settings) #region IJsEngineFactory implementation - /// - /// Gets a name of JS engine - /// + /// public string EngineName { get { return VroomJsEngine.EngineName; } diff --git a/src/JavaScriptEngineSwitcher.Vroom/readme.txt b/src/JavaScriptEngineSwitcher.Vroom/readme.txt index b8741c90..b37c965c 100644 --- a/src/JavaScriptEngineSwitcher.Vroom/readme.txt +++ b/src/JavaScriptEngineSwitcher.Vroom/readme.txt @@ -1,17 +1,17 @@  -------------------------------------------------------------------------------- - README file for JS Engine Switcher: Vroom v3.19.0 + README file for JS Engine Switcher: Vroom v3.24.1 -------------------------------------------------------------------------------- - Copyright (c) 2013-2022 Andrey Taritsyn - http://www.taritsyn.ru + Copyright (c) 2013-2024 Andrey Taritsyn - http://www.taritsyn.ru =========== DESCRIPTION =========== - JavaScriptEngineSwitcher.Vroom contains adapter `VroomJsEngine` (wrapper for the + JavaScriptEngineSwitcher.Vroom contains a `VroomJsEngine` adapter (wrapper for the VroomJs (http://github.com/pauldotknopf/vroomjs-core) version 1.2.3 with support of V8 version 3.17.16.2). @@ -19,12 +19,6 @@ Redistributable for Visual Studio 2012 and the Microsoft Visual C++ 2015 Redistributable. - ============= - RELEASE NOTES - ============= - Fixed a error #102 “Resources should conform to correct ICU standard for - naming”. Special thanks to Tim Heuer. - ==================== POST-INSTALL ACTIONS ==================== diff --git a/src/JavaScriptEngineSwitcher.Yantra/Helpers/ReflectionHelpers.cs b/src/JavaScriptEngineSwitcher.Yantra/Helpers/ReflectionHelpers.cs new file mode 100644 index 00000000..58dcdffd --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Yantra/Helpers/ReflectionHelpers.cs @@ -0,0 +1,48 @@ +using System; +using System.Reflection; + +using JavaScriptEngineSwitcher.Core.Utilities; + +namespace JavaScriptEngineSwitcher.Yantra.Helpers +{ + /// + /// Reflection helpers + /// + internal static class ReflectionHelpers + { + public static void FixArgumentTypes(ref object[] argValues, ParameterInfo[] parameters) + { + int argCount = argValues.Length; + int parameterCount = parameters.Length; + + for (int argIndex = 0; argIndex < argCount; argIndex++) + { + if (argIndex >= parameterCount) + { + break; + } + + object argValue = argValues[argIndex]; + if (argValue == null) + { + continue; + } + + Type argType = argValue.GetType(); + + ParameterInfo parameter = parameters[argIndex]; + Type parameterType = parameter.ParameterType; + + if (argType != parameterType) + { + object convertedArgValue; + + if (TypeConverter.TryConvertToType(argValue, parameterType, out convertedArgValue)) + { + argValues[argIndex] = convertedArgValue; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Yantra/Helpers/YantraJsErrorHelpers.cs b/src/JavaScriptEngineSwitcher.Yantra/Helpers/YantraJsErrorHelpers.cs new file mode 100644 index 00000000..cabb5f50 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Yantra/Helpers/YantraJsErrorHelpers.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text.RegularExpressions; + +using JavaScriptEngineSwitcher.Core.Extensions; +using JavaScriptEngineSwitcher.Core.Helpers; + +using CoreStrings = JavaScriptEngineSwitcher.Core.Resources.Strings; + +namespace JavaScriptEngineSwitcher.Yantra.Helpers +{ + /// + /// JS error helpers + /// + internal static class YantraJsErrorHelpers + { + #region Error location + + private const string OriginalGlobalCode = "native"; + private const string OriginalAnonymousFunctionName = "inline"; + private const string WrapperGlobalCode = "Global code"; + private const string WrapperAnonymousFunctionName = "Anonymous function"; + + /// + /// Regular expression for working with line of the script error location + /// + private static readonly Regex _errorLocationLineRegex = + new Regex(@"^[ ]{4}at " + + @"(?" + + @"[\w][\w ]*" + + @"|" + + CommonRegExps.JsFullNamePattern + + @")" + + @":(?" + CommonRegExps.DocumentNamePattern + @")" + + @":(?\d+),(?\d+)$") + ; + + + /// + /// Parses a string representation of the script error location to produce an array of + /// instances + /// + /// String representation of the script error location + /// An array of instances + public static ErrorLocationItem[] ParseErrorLocation(string errorLocation) + { + if (string.IsNullOrWhiteSpace(errorLocation)) + { + return new ErrorLocationItem[0]; + } + + var errorLocationItems = new List(); + string[] lines = errorLocation.SplitToLines(); + int lineCount = lines.Length; + + for (int lineIndex = 0; lineIndex < lineCount; lineIndex++) + { + string line = lines[lineIndex]; + if (line.Length == 0) + { + continue; + } + + Match lineMatch = _errorLocationLineRegex.Match(line); + + if (lineMatch.Success) + { + GroupCollection lineGroups = lineMatch.Groups; + + var errorLocationItem = new ErrorLocationItem + { + FunctionName = lineGroups["functionName"].Value, + DocumentName = lineGroups["documentName"].Value, + LineNumber = int.Parse(lineGroups["lineNumber"].Value), + ColumnNumber = int.Parse(lineGroups["columnNumber"].Value) + }; + errorLocationItems.Add(errorLocationItem); + } + else + { + Debug.WriteLine(string.Format(CoreStrings.Runtime_InvalidErrorLocationLineFormat, line)); + return new ErrorLocationItem[0]; + } + } + + return errorLocationItems.ToArray(); + } + + /// + /// Filters a error location items + /// + /// An array of instances + public static ErrorLocationItem[] FilterErrorLocationItems(ErrorLocationItem[] errorLocationItems) + { + int itemCount = errorLocationItems.Length; + if (itemCount == 0) + { + return errorLocationItems; + } + + int itemIndex = 0; + + while (itemIndex < itemCount) + { + ErrorLocationItem item = errorLocationItems[itemIndex]; + string documentName = item.DocumentName; + + if (documentName.StartsWith("/home/runner/work/yantra/")) + { + break; + } + + itemIndex++; + } + + if (itemIndex == itemCount) + { + return errorLocationItems; + } + + int firstSuitableItemIndex = itemIndex + 1; + int suitableItemCount = itemCount - firstSuitableItemIndex; + + var processedErrorLocationItems = new ErrorLocationItem[suitableItemCount]; + Array.Copy(errorLocationItems, firstSuitableItemIndex, processedErrorLocationItems, 0, suitableItemCount); + + return processedErrorLocationItems; + } + + /// + /// Fixes a error location items + /// + /// An array of instances + public static void FixErrorLocationItems(ErrorLocationItem[] errorLocationItems) + { + foreach (ErrorLocationItem errorLocationItem in errorLocationItems) + { + string functionName = errorLocationItem.FunctionName; + if (functionName == OriginalGlobalCode) + { + errorLocationItem.FunctionName = WrapperGlobalCode; + } + else if (functionName == OriginalAnonymousFunctionName) + { + errorLocationItem.FunctionName = WrapperAnonymousFunctionName; + } + } + } + + #endregion + } +} \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Yantra/JavaScriptEngineSwitcher.Yantra.csproj b/src/JavaScriptEngineSwitcher.Yantra/JavaScriptEngineSwitcher.Yantra.csproj new file mode 100644 index 00000000..2453325e --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Yantra/JavaScriptEngineSwitcher.Yantra.csproj @@ -0,0 +1,35 @@ + + + + JS Engine Switcher: Yantra + 3.30.2 + netstandard2.0;netstandard2.1 + Library + true + $(NoWarn);CS1591 + false + true + + + + + + + https://raw.githubusercontent.com/Taritsyn/JavaScriptEngineSwitcher/master/Icons/JavaScriptEngineSwitcher_Yantra_Logo128x128.png + ../../Icons/JavaScriptEngineSwitcher_Yantra_Logo128x128.png + JavaScriptEngineSwitcher.Yantra contains a `YantraJsEngine` adapter (wrapper for the YantraJS). + $(PackageCommonTags);Yantra;YantraJS + YantraJS was updated to version 1.2.293. + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Yantra/JsEngineFactoryCollectionExtensions.cs b/src/JavaScriptEngineSwitcher.Yantra/JsEngineFactoryCollectionExtensions.cs new file mode 100644 index 00000000..8cb96eae --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Yantra/JsEngineFactoryCollectionExtensions.cs @@ -0,0 +1,78 @@ +using System; + +using JavaScriptEngineSwitcher.Core; + +namespace JavaScriptEngineSwitcher.Yantra +{ + /// + /// JS engine factory collection extensions + /// + public static class JsEngineFactoryCollectionExtensions + { + /// + /// Adds a instance of to + /// the specified + /// + /// Instance of + /// Instance of + public static JsEngineFactoryCollection AddYantra(this JsEngineFactoryCollection source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + return source.AddYantra(new YantraSettings()); + } + + /// + /// Adds a instance of to + /// the specified + /// + /// Instance of + /// The delegate to configure the provided + /// Instance of + public static JsEngineFactoryCollection AddYantra(this JsEngineFactoryCollection source, + Action configure) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + if (configure == null) + { + throw new ArgumentNullException(nameof(configure)); + } + + var settings = new YantraSettings(); + configure(settings); + + return source.AddYantra(settings); + } + + /// + /// Adds a instance of to + /// the specified + /// + /// Instance of + /// Settings of the Yantra JS engine + /// Instance of + public static JsEngineFactoryCollection AddYantra(this JsEngineFactoryCollection source, YantraSettings settings) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + if (settings == null) + { + throw new ArgumentNullException(nameof(settings)); + } + + source.Add(new YantraJsEngineFactory(settings)); + + return source; + } + } +} \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Yantra/PACKAGE-DESCRIPTION.md b/src/JavaScriptEngineSwitcher.Yantra/PACKAGE-DESCRIPTION.md new file mode 100644 index 00000000..74bb8b43 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Yantra/PACKAGE-DESCRIPTION.md @@ -0,0 +1 @@ +JavaScriptEngineSwitcher.Yantra contains a `YantraJsEngine` adapter (wrapper for the [YantraJS](https://github.com/yantrajs/yantra) version 1.2.293). \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Yantra/YantraEngineFactory.cs b/src/JavaScriptEngineSwitcher.Yantra/YantraEngineFactory.cs new file mode 100644 index 00000000..566a0dad --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Yantra/YantraEngineFactory.cs @@ -0,0 +1,53 @@ +using JavaScriptEngineSwitcher.Core; + +namespace JavaScriptEngineSwitcher.Yantra +{ + /// + /// Yantra JS engine factory + /// + public sealed class YantraJsEngineFactory : IJsEngineFactory + { + /// + /// Settings of the Yantra JS engine + /// + private readonly YantraSettings _settings; + + + /// + /// Constructs an instance of the Yantra JS engine factory + /// + public YantraJsEngineFactory() + : this(new YantraSettings()) + { } + + /// + /// Constructs an instance of the Yantra JS engine factory + /// + /// Settings of the Yantra JS engine + public YantraJsEngineFactory(YantraSettings settings) + { + _settings = settings; + } + + + #region IJsEngineFactory implementation + + /// + public string EngineName + { + get { return YantraJsEngine.EngineName; } + } + + + /// + /// Creates a instance of the Yantra JS engine + /// + /// Instance of the Yantra JS engine + public IJsEngine CreateEngine() + { + return new YantraJsEngine(_settings); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Yantra/YantraJsConsoleCallback.cs b/src/JavaScriptEngineSwitcher.Yantra/YantraJsConsoleCallback.cs new file mode 100644 index 00000000..9351153a --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Yantra/YantraJsConsoleCallback.cs @@ -0,0 +1,9 @@ +namespace JavaScriptEngineSwitcher.Yantra +{ + /// + /// The JS debugging console callback + /// + /// Type of message + /// A array of objects to output + public delegate void YantraJsConsoleCallback(string type, object[] args); +} \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Yantra/YantraJsEngine.cs b/src/JavaScriptEngineSwitcher.Yantra/YantraJsEngine.cs new file mode 100644 index 00000000..8b812b65 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Yantra/YantraJsEngine.cs @@ -0,0 +1,799 @@ +using System; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Text.RegularExpressions; + +using YantraJS.Core; + +using OriginalArguments = YantraJS.Core.Arguments; +using OriginalClrMemberNamingConvention = YantraJS.Core.Clr.ClrMemberNamingConvention; +using OriginalClrProxy = YantraJS.Core.Clr.ClrProxy; +using OriginalClrType = YantraJS.Core.Clr.ClrType; +using OriginalContext = YantraJS.Core.JSContext; +using OriginalDate = YantraJS.Core.JSDate; +using OriginalError = YantraJS.Core.JSError; +using OriginalException = YantraJS.Core.JSException; +using OriginalFunction = YantraJS.Core.JSFunction; +using OriginalJsonObject = YantraJS.Core.JSJSON; +using OriginalTypeConverter = YantraJS.Utils.TypeConverter; +using OriginalUndefined = YantraJS.Core.JSUndefined; +using OriginalValue = YantraJS.Core.JSValue; + +using JavaScriptEngineSwitcher.Core; +using JavaScriptEngineSwitcher.Core.Constants; +using JavaScriptEngineSwitcher.Core.Extensions; +using JavaScriptEngineSwitcher.Core.Helpers; +using JavaScriptEngineSwitcher.Core.Utilities; + +using CoreStrings = JavaScriptEngineSwitcher.Core.Resources.Strings; +using WrapperCompilationException = JavaScriptEngineSwitcher.Core.JsCompilationException; +using WrapperException = JavaScriptEngineSwitcher.Core.JsException; +using WrapperRuntimeException = JavaScriptEngineSwitcher.Core.JsRuntimeException; +using WrapperScriptException = JavaScriptEngineSwitcher.Core.JsScriptException; + +using JavaScriptEngineSwitcher.Yantra.Helpers; + +namespace JavaScriptEngineSwitcher.Yantra +{ + /// + /// Adapter for the Yantra JS engine + /// + public sealed class YantraJsEngine : JsEngineBase + { + /// + /// Name of JS engine + /// + public const string EngineName = "YantraJsEngine"; + + /// + /// Version of original JS engine + /// + private const string EngineVersion = "1.2.293"; + + /// + /// Regular expression for working with the error message + /// + private static readonly Regex _errorMessageRegex = + new Regex(@"^(?" + CommonRegExps.JsFullNamePattern + @"):\s+(?[\s\S]+?)" + + @"(?: at (?\d+), (?\d+))?$"); + + /// + /// Yantra JS context + /// + private OriginalContext _jsContext; + + /// + /// JS debugging console callback + /// + private YantraJsConsoleCallback _consoleCallback; + + /// + /// Synchronizer of code execution + /// + private readonly object _executionSynchronizer = new object(); + + /// + /// Unique document name manager + /// + private readonly UniqueDocumentNameManager _documentNameManager = + new UniqueDocumentNameManager(DefaultDocumentName); + + + /// + /// Constructs an instance of adapter for the Yantra JS engine + /// + public YantraJsEngine() + : this(new YantraSettings()) + { } + + /// + /// Constructs an instance of adapter for the Yantra JS engine + /// + /// Settings of the Yantra JS engine + public YantraJsEngine(YantraSettings settings) + { + YantraSettings yantraSettings = settings ?? new YantraSettings(); + _consoleCallback = yantraSettings.ConsoleCallback; + + try + { + _jsContext = new OriginalContext() + { + ClrMemberNamingConvention = OriginalClrMemberNamingConvention.Declared, + Debugger = yantraSettings.Debugger + }; + + if (_consoleCallback != null) + { + _jsContext.ConsoleEvent += OnConsoleWrite; + } + } + catch (Exception e) + { + throw JsErrorHelpers.WrapEngineLoadException(e, EngineName, EngineVersion, true); + } + } + + + #region Mapping + + /// + /// Makes a mapping of value from the host type to a script type + /// + /// The source value + /// The mapped value + private static OriginalValue MapToScriptType(object value) + { + if (value is Undefined) + { + return OriginalUndefined.Value; + } + + return OriginalTypeConverter.FromBasic(value); + } + + /// + /// Makes a mapping of array items from the host type to a script type + /// + /// The source array + /// The mapped array + private static OriginalValue[] MapToScriptType(object[] args) + { + return args.Select(MapToScriptType).ToArray(); + } + + /// + /// Makes a mapping of value from the script type to a host type + /// + /// The source value + /// The mapped value + private static object MapToHostType(OriginalValue value) + { + object result = value; + + if (value.IsNull) + { + result = null; + } + else if (value.IsUndefined) + { + result = Undefined.Value; + } + else if (value.IsBoolean) + { + result = value.BooleanValue; + } + else if (value.IsNumber) + { + result = value.DoubleValue; + } + else if (value.IsString) + { + result = value.ToString(); + } + else if (value.IsFunction && value is OriginalClrType) + { + result = value.ForceConvert(typeof(Type)); + } + else if (value.IsObject) + { + if (value is OriginalDate) + { + result = value.ForceConvert(typeof(DateTime)); + } + else if (value is OriginalClrProxy) + { + var clrProxy = (OriginalClrProxy)value; + result = clrProxy.Target; + } + } + + return result; + } + + /// + /// Makes a mapping of value from the script type to a host type + /// + /// The type to convert the value to + /// The source value + /// The mapped value + private static T MapToHostType(OriginalValue value) + { + if (value.IsNull) + { + return TypeConverter.ConvertToType(null); + } + + Type targetType = typeof(T); + + if (targetType == typeof(Undefined)) + { + if (value.IsUndefined) + { + return (T)(object)Undefined.Value; + } + else + { + throw new InvalidOperationException( + string.Format(CoreStrings.Common_CannotConvertObjectToType, value.GetType(), targetType) + ); + } + } + + T result; + + if (!value.ConvertTo(out result)) + { + if (targetType == typeof(string)) + { + result = (T)(object)value.ToString(); + } + else + { + throw new InvalidOperationException( + string.Format(CoreStrings.Common_CannotConvertObjectToType, value.GetType(), targetType) + ); + } + } + + return result; + } + + private static OriginalFunction CreateEmbeddedFunction(Delegate del) + { + var originalFunction = new OriginalFunction((in OriginalArguments args) => + { + MethodInfo method = del.GetMethodInfo(); + ParameterInfo[] parameters = method.GetParameters(); + object[] processedArgs = GetHostDelegateArguments(args, parameters.Length); + + ReflectionHelpers.FixArgumentTypes(ref processedArgs, parameters); + + object result; + + try + { + result = del.DynamicInvoke(processedArgs); + } + catch (Exception e) when ((e is TargetInvocationException || e is WrapperException) + && e.InnerException != null) + { + OriginalException originalException = OriginalException.From(e.InnerException); + throw originalException; + } + catch (Exception e) + { + OriginalException originalException = OriginalException.From(e); + throw originalException; + } + + OriginalValue resultValue = MapToScriptType(result); + + return resultValue; + }); + + return originalFunction; + } + + private static object[] GetHostDelegateArguments(in OriginalArguments args, int maxArgCount) + { + int argCount = args.Length; + if (argCount == 0) + { + return new object[0]; + } + + int processedArgCount = Math.Min(argCount, maxArgCount); + var processedArgs = new object[processedArgCount]; + + for (int argIndex = 0; argIndex < processedArgCount; argIndex++) + { + OriginalValue arg = args.GetAt(argIndex); + processedArgs[argIndex] = MapToHostType(arg); + } + + return processedArgs; + } + + private WrapperException WrapJsException(OriginalException originalException) + { + WrapperException wrapperException; + string message = originalException.Message; + string description = message; + string type = string.Empty; + string documentName = string.Empty; + int lineNumber = 0; + int columnNumber = 0; + ErrorLocationItem[] callStackItems = null; + + var errorValue = originalException.Error as OriginalError; + if (errorValue != null) + { + string messageWithType = errorValue.ToString(); + Match messageMatch = _errorMessageRegex.Match(messageWithType); + + if (messageMatch.Success) + { + GroupCollection messageGroups = messageMatch.Groups; + type = messageGroups["type"].Value; + description = messageGroups["description"].Value; + lineNumber = messageGroups["lineNumber"].Success ? + int.Parse(messageGroups["lineNumber"].Value) : 0; + columnNumber = messageGroups["columnNumber"].Success ? + int.Parse(messageGroups["columnNumber"].Value) : 0; + } + + string messageWithCallStack = type == JsErrorType.Syntax ? + originalException.JSStackTrace.AsStringOrDefault() + : + errorValue.Stack ?? errorValue["stack"].AsStringOrDefault() + ; + string rawCallStack = GetRawCallStack(message, messageWithType, messageWithCallStack); + + callStackItems = YantraJsErrorHelpers.ParseErrorLocation(rawCallStack); + callStackItems = YantraJsErrorHelpers.FilterErrorLocationItems(callStackItems); + YantraJsErrorHelpers.FixErrorLocationItems(callStackItems); + + if (callStackItems.Length > 0) + { + ErrorLocationItem firstCallStackItem = callStackItems[0]; + + documentName = firstCallStackItem.DocumentName; + if (lineNumber == 0 && columnNumber == 0) + { + lineNumber = firstCallStackItem.LineNumber; + columnNumber = firstCallStackItem.ColumnNumber; + } + } + } + + if (!string.IsNullOrWhiteSpace(type)) + { + WrapperScriptException wrapperScriptException; + if (type == JsErrorType.Syntax) + { + message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, documentName, + lineNumber, columnNumber); + + wrapperScriptException = new WrapperCompilationException(message, EngineName, EngineVersion, + originalException); + } + else + { + string callStack = callStackItems != null ? + JsErrorHelpers.StringifyErrorLocationItems(callStackItems) : string.Empty; + message = JsErrorHelpers.GenerateScriptErrorMessage(type, description, callStack); + + var wrapperRuntimeException = new WrapperRuntimeException(message, EngineName, EngineVersion, + originalException); + wrapperRuntimeException.CallStack = callStack; + + wrapperScriptException = wrapperRuntimeException; + } + wrapperScriptException.Type = type; + wrapperScriptException.DocumentName = documentName; + wrapperScriptException.LineNumber = lineNumber; + wrapperScriptException.ColumnNumber = columnNumber; + + wrapperException = wrapperScriptException; + } + else + { + wrapperException = new WrapperException(message, EngineName, EngineVersion, originalException); + } + + wrapperException.Description = description; + + return wrapperException; + } + + private static string GetRawCallStack(string message, string messageWithType, string messageWithCallStack) + { + string baseMessage = messageWithCallStack.StartsWith(messageWithType) ? messageWithType : message; + string rawCallStack = messageWithCallStack + .TrimStart(baseMessage) + .TrimStart(new char[] { '\n', '\r' }) + ; + + return rawCallStack; + } + + private void OnConsoleWrite(OriginalContext context, string type, in OriginalArguments args) + { + int argCount = args.Length; + var processedArgs = new object[argCount]; + + for (int argIndex = 0; argIndex < argCount; argIndex++) + { + OriginalValue arg = args.GetAt(argIndex); + object processedArg = MapToHostType(arg); + + if (processedArg is OriginalValue) + { + if (arg.IsSymbol) + { + processedArg = string.Format("Symbol({0})", arg.ToString()); + } + else if (arg.IsFunction) + { + var jsFunction = (OriginalFunction)arg; + processedArg = string.Format("[Function: {0}]", jsFunction.name); + } + else if (arg.IsObject) + { + processedArg = OriginalJsonObject.Stringify(arg); + } + else + { + processedArg = arg.ToString(); + } + } + + processedArgs[argIndex] = processedArg; + } + + _consoleCallback?.Invoke(type, processedArgs); + } + + #endregion + + /// + /// Evaluates an expression without converting its result to a host type + /// + /// JS expression + /// Document name + /// Result of the expression not converted to a host type + [MethodImpl((MethodImplOptions)256 /* AggressiveInlining */)] + private OriginalValue InnerEvaluateWithoutResultConversion(string expression, string documentName) + { + OriginalValue resultValue; + string uniqueDocumentName = _documentNameManager.GetUniqueName(documentName); + + try + { + lock (_executionSynchronizer) + { + resultValue = _jsContext.Eval(expression, uniqueDocumentName); + } + } + catch (OriginalException e) + { + throw WrapJsException(e); + } + catch (Exception e) when ((e is TargetInvocationException || e is WrapperException) + && e.InnerException != null) + { + OriginalException originalException = OriginalException.From(e.InnerException); + throw originalException; + } + + return resultValue; + } + + /// + /// Calls a function without converting its result to a host type + /// + /// Function name + /// Function arguments + /// Result of the function execution not converted to a host type + [MethodImpl((MethodImplOptions)256 /* AggressiveInlining */)] + private OriginalValue InnerCallFunctionWithoutResultConversion(string functionName, params object[] args) + { + OriginalValue resultValue; + OriginalValue[] processedArgs = MapToScriptType(args); + + try + { + lock (_executionSynchronizer) + { + resultValue = _jsContext.InvokeMethod(functionName, new OriginalArguments(_jsContext, processedArgs)); + } + } + catch (OriginalException e) + { + throw WrapJsException(e); + } + catch (Exception e) when ((e is TargetInvocationException || e is WrapperException) + && e.InnerException != null) + { + OriginalException originalException = OriginalException.From(e.InnerException); + throw originalException; + } + + return resultValue; + } + + /// + /// Gets a value of variable without converting it to a host type + /// + /// Variable name + /// Value of variable not converted to a host type + [MethodImpl((MethodImplOptions)256 /* AggressiveInlining */)] + private OriginalValue InnerGetVariableValueWithoutResultConversion(string variableName) + { + OriginalValue variableValue; + + try + { + lock (_executionSynchronizer) + { + variableValue = _jsContext[variableName]; + } + } + catch (OriginalException e) + { + throw WrapJsException(e); + } + + return variableValue; + } + + #region JsEngineBase overrides + + protected override IPrecompiledScript InnerPrecompile(string code) + { + throw new NotSupportedException(); + } + + protected override IPrecompiledScript InnerPrecompile(string code, string documentName) + { + throw new NotSupportedException(); + } + + protected override object InnerEvaluate(string expression) + { + return InnerEvaluate(expression, null); + } + + protected override object InnerEvaluate(string expression, string documentName) + { + OriginalValue resultValue = InnerEvaluateWithoutResultConversion(expression, documentName); + object result = MapToHostType(resultValue); + + return result; + } + + protected override T InnerEvaluate(string expression) + { + return InnerEvaluate(expression, null); + } + + protected override T InnerEvaluate(string expression, string documentName) + { + OriginalValue resultValue = InnerEvaluateWithoutResultConversion(expression, documentName); + T result = MapToHostType(resultValue); + + return result; + } + + protected override void InnerExecute(string code) + { + InnerExecute(code, null); + } + + protected override void InnerExecute(string code, string documentName) + { + string uniqueDocumentName = _documentNameManager.GetUniqueName(documentName); + + try + { + lock (_executionSynchronizer) + { + _jsContext.Execute(code, uniqueDocumentName); + } + } + catch (OriginalException e) + { + throw WrapJsException(e); + } + catch (Exception e) when ((e is TargetInvocationException || e is WrapperException) + && e.InnerException != null) + { + OriginalException originalException = OriginalException.From(e.InnerException); + throw originalException; + } + } + + protected override void InnerExecute(IPrecompiledScript precompiledScript) + { + throw new NotSupportedException(); + } + + protected override object InnerCallFunction(string functionName, params object[] args) + { + OriginalValue resultValue = InnerCallFunctionWithoutResultConversion(functionName, args); + object result = MapToHostType(resultValue); + + return result; + } + + protected override T InnerCallFunction(string functionName, params object[] args) + { + OriginalValue resultValue = InnerCallFunctionWithoutResultConversion(functionName, args); + T result = MapToHostType(resultValue); + + return result; + } + + protected override bool InnerHasVariable(string variableName) + { + bool result; + + try + { + OriginalValue variableValue; + + lock (_executionSynchronizer) + { + variableValue = _jsContext[variableName]; + } + + result = !variableValue.IsUndefined; + } + catch (OriginalException) + { + result = false; + } + + return result; + } + + protected override object InnerGetVariableValue(string variableName) + { + OriginalValue variableValue = InnerGetVariableValueWithoutResultConversion(variableName); + object result = MapToHostType(variableValue); + + return result; + } + + protected override T InnerGetVariableValue(string variableName) + { + OriginalValue variableValue = InnerGetVariableValueWithoutResultConversion(variableName); + T result = MapToHostType(variableValue); + + return result; + } + + protected override void InnerSetVariableValue(string variableName, object value) + { + OriginalValue processedValue = MapToScriptType(value); + + try + { + lock (_executionSynchronizer) + { + _jsContext[variableName] = processedValue; + } + } + catch (OriginalException e) + { + throw WrapJsException(e); + } + } + + protected override void InnerRemoveVariable(string variableName) + { + try + { + lock (_executionSynchronizer) + { + _jsContext.Delete(variableName); + } + } + catch (OriginalException e) + { + throw WrapJsException(e); + } + } + + protected override void InnerEmbedHostObject(string itemName, object value) + { + OriginalValue processedValue; + if (value is Delegate) + { + processedValue = CreateEmbeddedFunction((Delegate)value); + } + else + { + processedValue = OriginalClrProxy.From(value); + } + + try + { + lock (_executionSynchronizer) + { + _jsContext[itemName] = processedValue; + + } + } + catch (OriginalException e) + { + throw WrapJsException(e); + } + } + + protected override void InnerEmbedHostType(string itemName, Type type) + { + OriginalValue processedValue = OriginalClrType.From(type); + + try + { + lock (_executionSynchronizer) + { + _jsContext[itemName] = processedValue; + } + } + catch (OriginalException e) + { + throw WrapJsException(e); + } + } + + protected override void InnerInterrupt() + { + throw new NotSupportedException(); + } + + protected override void InnerCollectGarbage() + { + throw new NotSupportedException(); + } + + #region IJsEngine implementation + + public override string Name + { + get { return EngineName; } + } + + public override string Version + { + get { return EngineVersion; } + } + + public override bool SupportsScriptPrecompilation + { + get { return false; } + } + + public override bool SupportsScriptInterruption + { + get { return false; } + } + + public override bool SupportsGarbageCollection + { + get { return false; } + } + + #endregion + + #region IDisposable implementation + + public override void Dispose() + { + if (_disposedFlag.Set()) + { + lock (_executionSynchronizer) + { + if (_jsContext != null) + { + if (_consoleCallback != null) + { + _jsContext.ConsoleEvent -= OnConsoleWrite; + _consoleCallback = null; + } + + _jsContext.Dispose(); + _jsContext = null; + } + } + } + } + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Yantra/YantraSettings.cs b/src/JavaScriptEngineSwitcher.Yantra/YantraSettings.cs new file mode 100644 index 00000000..0383c1fe --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Yantra/YantraSettings.cs @@ -0,0 +1,39 @@ +using OriginalDebugger = YantraJS.Debugger.JSDebugger; +using OriginalV8Debugger = YantraJS.Core.Debugger.V8Debugger; + +namespace JavaScriptEngineSwitcher.Yantra +{ + /// + /// Settings of the Yantra JS engine + /// + public sealed class YantraSettings + { + /// + /// Gets or sets a JS debugging console callback + /// + public YantraJsConsoleCallback ConsoleCallback + { + get; + set; + } + + /// + /// Gets or sets an instance of JS debugger (for example, the ) + /// + public OriginalDebugger Debugger + { + get; + set; + } + + + /// + /// Constructs an instance of the Yantra settings + /// + public YantraSettings() + { + ConsoleCallback = null; + Debugger = null; + } + } +} \ No newline at end of file diff --git a/src/JavaScriptEngineSwitcher.Yantra/readme.txt b/src/JavaScriptEngineSwitcher.Yantra/readme.txt new file mode 100644 index 00000000..78ad2ea3 --- /dev/null +++ b/src/JavaScriptEngineSwitcher.Yantra/readme.txt @@ -0,0 +1,26 @@ + + + -------------------------------------------------------------------------------- + README file for JS Engine Switcher: Yantra v3.30.2 + + -------------------------------------------------------------------------------- + + Copyright (c) 2013-2025 Andrey Taritsyn - http://www.taritsyn.ru + + + =========== + DESCRIPTION + =========== + JavaScriptEngineSwitcher.Yantra contains a `YantraJsEngine` adapter (wrapper for the + YantraJS (https://github.com/yantrajs/yantra) version 1.2.293). + + ============= + RELEASE NOTES + ============= + YantraJS was updated to version 1.2.293. + + ============= + DOCUMENTATION + ============= + See documentation on GitHub - + http://github.com/Taritsyn/JavaScriptEngineSwitcher \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/content/contacts/target-output.html b/test/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/content/contacts/target-output.html index e215028a..0c69826e 100644 --- a/test/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/content/contacts/target-output.html +++ b/test/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/content/contacts/target-output.html @@ -7,5 +7,5 @@ Моб. тел.: +7 (999) 689-99-99
Email: pupkin@mail.ru
Сайт: http://pupkin.narod.ru
- ICQ: ICQ статус698426795 + ICQ: ICQ статус698426795 \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/content/contacts/template.handlebars b/test/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/content/contacts/template.handlebars index e0b9a71a..99acf502 100644 --- a/test/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/content/contacts/template.handlebars +++ b/test/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/content/contacts/template.handlebars @@ -9,5 +9,5 @@ Моб. тел.: {{mobilePhone}}
Email: {{email}}
Сайт: {{{link website website false}}}
- ICQ: ICQ статус{{icq}} + ICQ: ICQ статус{{icq}} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/lib/handlebars.js b/test/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/lib/handlebars.js index 86462e78..baad5d3d 100644 --- a/test/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/lib/handlebars.js +++ b/test/JavaScriptEngineSwitcher.Benchmarks/Files/template-rendering/lib/handlebars.js @@ -1,9 +1,9 @@ /**! @license - handlebars v4.4.5 + handlebars v4.7.7 -Copyright (C) 2011-2017 by Yehuda Katz +Copyright (C) 2011-2019 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -92,23 +92,23 @@ return /******/ (function(modules) { // webpackBootstrap // Compiler imports - var _handlebarsCompilerAst = __webpack_require__(35); + var _handlebarsCompilerAst = __webpack_require__(45); var _handlebarsCompilerAst2 = _interopRequireDefault(_handlebarsCompilerAst); - var _handlebarsCompilerBase = __webpack_require__(36); + var _handlebarsCompilerBase = __webpack_require__(46); - var _handlebarsCompilerCompiler = __webpack_require__(41); + var _handlebarsCompilerCompiler = __webpack_require__(51); - var _handlebarsCompilerJavascriptCompiler = __webpack_require__(42); + var _handlebarsCompilerJavascriptCompiler = __webpack_require__(52); var _handlebarsCompilerJavascriptCompiler2 = _interopRequireDefault(_handlebarsCompilerJavascriptCompiler); - var _handlebarsCompilerVisitor = __webpack_require__(39); + var _handlebarsCompilerVisitor = __webpack_require__(49); var _handlebarsCompilerVisitor2 = _interopRequireDefault(_handlebarsCompilerVisitor); - var _handlebarsNoConflict = __webpack_require__(34); + var _handlebarsNoConflict = __webpack_require__(44); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); @@ -128,6 +128,7 @@ return /******/ (function(modules) { // webpackBootstrap hb.JavaScriptCompiler = _handlebarsCompilerJavascriptCompiler2['default']; hb.Parser = _handlebarsCompilerBase.parser; hb.parse = _handlebarsCompilerBase.parse; + hb.parseWithoutProcessing = _handlebarsCompilerBase.parseWithoutProcessing; return hb; } @@ -177,7 +178,7 @@ return /******/ (function(modules) { // webpackBootstrap // Each of these augment the Handlebars object. No need to setup here. // (This is done to easily share code between commonjs and browse envs) - var _handlebarsSafeString = __webpack_require__(21); + var _handlebarsSafeString = __webpack_require__(37); var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); @@ -189,11 +190,11 @@ return /******/ (function(modules) { // webpackBootstrap var Utils = _interopRequireWildcard(_handlebarsUtils); - var _handlebarsRuntime = __webpack_require__(22); + var _handlebarsRuntime = __webpack_require__(38); var runtime = _interopRequireWildcard(_handlebarsRuntime); - var _handlebarsNoConflict = __webpack_require__(34); + var _handlebarsNoConflict = __webpack_require__(44); var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); @@ -269,13 +270,15 @@ return /******/ (function(modules) { // webpackBootstrap var _helpers = __webpack_require__(10); - var _decorators = __webpack_require__(18); + var _decorators = __webpack_require__(30); - var _logger = __webpack_require__(20); + var _logger = __webpack_require__(32); var _logger2 = _interopRequireDefault(_logger); - var VERSION = '4.4.5'; + var _internalProtoAccess = __webpack_require__(33); + + var VERSION = '4.7.7'; exports.VERSION = VERSION; var COMPILER_REVISION = 8; exports.COMPILER_REVISION = COMPILER_REVISION; @@ -351,6 +354,13 @@ return /******/ (function(modules) { // webpackBootstrap }, unregisterDecorator: function unregisterDecorator(name) { delete this.decorators[name]; + }, + /** + * Reset the memory of illegal property accesses that have already been logged. + * @deprecated should only be used in handlebars test-cases + */ + resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { + _internalProtoAccess.resetLoggedProperties(); } }; @@ -374,7 +384,6 @@ return /******/ (function(modules) { // webpackBootstrap exports.createFrame = createFrame; exports.blockParams = blockParams; exports.appendContextPath = appendContextPath; - var escape = { '&': '&', '<': '<', @@ -498,16 +507,20 @@ return /******/ (function(modules) { // webpackBootstrap var _Object$defineProperty = __webpack_require__(7)['default']; exports.__esModule = true; - - var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; function Exception(message, node) { var loc = node && node.loc, line = undefined, - column = undefined; + endLineNumber = undefined, + column = undefined, + endColumn = undefined; + if (loc) { line = loc.start.line; + endLineNumber = loc.end.line; column = loc.start.column; + endColumn = loc.end.column; message += ' - ' + line + ':' + column; } @@ -527,6 +540,7 @@ return /******/ (function(modules) { // webpackBootstrap try { if (loc) { this.lineNumber = line; + this.endLineNumber = endLineNumber; // Work around issue under safari where we can't directly set the column value /* istanbul ignore next */ @@ -535,8 +549,13 @@ return /******/ (function(modules) { // webpackBootstrap value: column, enumerable: true }); + Object.defineProperty(this, 'endColumn', { + value: endColumn, + enumerable: true + }); } else { this.column = column; + this.endColumn = endColumn; } } } catch (nop) { @@ -602,23 +621,23 @@ return /******/ (function(modules) { // webpackBootstrap var _helpersEach2 = _interopRequireDefault(_helpersEach); - var _helpersHelperMissing = __webpack_require__(13); + var _helpersHelperMissing = __webpack_require__(25); var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); - var _helpersIf = __webpack_require__(14); + var _helpersIf = __webpack_require__(26); var _helpersIf2 = _interopRequireDefault(_helpersIf); - var _helpersLog = __webpack_require__(15); + var _helpersLog = __webpack_require__(27); var _helpersLog2 = _interopRequireDefault(_helpersLog); - var _helpersLookup = __webpack_require__(16); + var _helpersLookup = __webpack_require__(28); var _helpersLookup2 = _interopRequireDefault(_helpersLookup); - var _helpersWith = __webpack_require__(17); + var _helpersWith = __webpack_require__(29); var _helpersWith2 = _interopRequireDefault(_helpersWith); @@ -690,6 +709,8 @@ return /******/ (function(modules) { // webpackBootstrap /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + var _Object$keys = __webpack_require__(13)['default']; + var _interopRequireDefault = __webpack_require__(1)['default']; exports.__esModule = true; @@ -761,10 +782,10 @@ return /******/ (function(modules) { // webpackBootstrap execIteration(i, i, i === context.length - 1); } } else { - var priorKey = undefined; + (function () { + var priorKey = undefined; - for (var key in context) { - if (context.hasOwnProperty(key)) { + _Object$keys(context).forEach(function (key) { // We're running the iterations one step out of sync so we can detect // the last iteration without have to scan the object twice and create // an itermediate keys array. @@ -773,11 +794,11 @@ return /******/ (function(modules) { // webpackBootstrap } priorKey = key; i++; + }); + if (priorKey !== undefined) { + execIteration(priorKey, i - 1, true); } - } - if (priorKey !== undefined) { - execIteration(priorKey, i - 1, true); - } + })(); } } @@ -794,6 +815,180 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }), /* 13 */ +/***/ (function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(14), __esModule: true }; + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(15); + module.exports = __webpack_require__(21).Object.keys; + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + + // 19.1.2.14 Object.keys(O) + var toObject = __webpack_require__(16); + + __webpack_require__(18)('keys', function($keys){ + return function keys(it){ + return $keys(toObject(it)); + }; + }); + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + + // 7.1.13 ToObject(argument) + var defined = __webpack_require__(17); + module.exports = function(it){ + return Object(defined(it)); + }; + +/***/ }), +/* 17 */ +/***/ (function(module, exports) { + + // 7.2.1 RequireObjectCoercible(argument) + module.exports = function(it){ + if(it == undefined)throw TypeError("Can't call method on " + it); + return it; + }; + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + + // most Object methods by ES6 should accept primitives + var $export = __webpack_require__(19) + , core = __webpack_require__(21) + , fails = __webpack_require__(24); + module.exports = function(KEY, exec){ + var fn = (core.Object || {})[KEY] || Object[KEY] + , exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); + }; + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + + var global = __webpack_require__(20) + , core = __webpack_require__(21) + , ctx = __webpack_require__(22) + , PROTOTYPE = 'prototype'; + + var $export = function(type, name, source){ + var IS_FORCED = type & $export.F + , IS_GLOBAL = type & $export.G + , IS_STATIC = type & $export.S + , IS_PROTO = type & $export.P + , IS_BIND = type & $export.B + , IS_WRAP = type & $export.W + , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) + , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] + , key, own, out; + if(IS_GLOBAL)source = name; + for(key in source){ + // contains in native + own = !IS_FORCED && target && key in target; + if(own && key in exports)continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global) + // wrap global constructors for prevent change them in library + : IS_WRAP && target[key] == out ? (function(C){ + var F = function(param){ + return this instanceof C ? new C(param) : C(param); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; + } + }; + // type bitmap + $export.F = 1; // forced + $export.G = 2; // global + $export.S = 4; // static + $export.P = 8; // proto + $export.B = 16; // bind + $export.W = 32; // wrap + module.exports = $export; + +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); + if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef + +/***/ }), +/* 21 */ +/***/ (function(module, exports) { + + var core = module.exports = {version: '1.2.6'}; + if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + + // optional / simple context binding + var aFunction = __webpack_require__(23); + module.exports = function(fn, that, length){ + aFunction(fn); + if(that === undefined)return fn; + switch(length){ + case 1: return function(a){ + return fn.call(that, a); + }; + case 2: return function(a, b){ + return fn.call(that, a, b); + }; + case 3: return function(a, b, c){ + return fn.call(that, a, b, c); + }; + } + return function(/* ...args */){ + return fn.apply(that, arguments); + }; + }; + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + + module.exports = function(it){ + if(typeof it != 'function')throw TypeError(it + ' is not a function!'); + return it; + }; + +/***/ }), +/* 24 */ +/***/ (function(module, exports) { + + module.exports = function(exec){ + try { + return !!exec(); + } catch(e){ + return true; + } + }; + +/***/ }), +/* 25 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -821,17 +1016,26 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 14 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; + var _interopRequireDefault = __webpack_require__(1)['default']; + exports.__esModule = true; var _utils = __webpack_require__(5); + var _exception = __webpack_require__(6); + + var _exception2 = _interopRequireDefault(_exception); + exports['default'] = function (instance) { instance.registerHelper('if', function (conditional, options) { + if (arguments.length != 2) { + throw new _exception2['default']('#if requires exactly one argument'); + } if (_utils.isFunction(conditional)) { conditional = conditional.call(this); } @@ -847,14 +1051,21 @@ return /******/ (function(modules) { // webpackBootstrap }); instance.registerHelper('unless', function (conditional, options) { - return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); + if (arguments.length != 2) { + throw new _exception2['default']('#unless requires exactly one argument'); + } + return instance.helpers['if'].call(this, conditional, { + fn: options.inverse, + inverse: options.fn, + hash: options.hash + }); }); }; module.exports = exports['default']; /***/ }), -/* 15 */ +/* 27 */ /***/ (function(module, exports) { 'use strict'; @@ -884,7 +1095,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 16 */ +/* 28 */ /***/ (function(module, exports) { 'use strict'; @@ -892,31 +1103,38 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; exports['default'] = function (instance) { - instance.registerHelper('lookup', function (obj, field) { + instance.registerHelper('lookup', function (obj, field, options) { if (!obj) { + // Note for 5.0: Change to "obj == null" in 5.0 return obj; } - if (field === 'constructor' && !obj.propertyIsEnumerable(field)) { - return undefined; - } - return obj[field]; + return options.lookupProperty(obj, field); }); }; module.exports = exports['default']; /***/ }), -/* 17 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; + var _interopRequireDefault = __webpack_require__(1)['default']; + exports.__esModule = true; var _utils = __webpack_require__(5); + var _exception = __webpack_require__(6); + + var _exception2 = _interopRequireDefault(_exception); + exports['default'] = function (instance) { instance.registerHelper('with', function (context, options) { + if (arguments.length != 2) { + throw new _exception2['default']('#with requires exactly one argument'); + } if (_utils.isFunction(context)) { context = context.call(this); } @@ -943,7 +1161,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 18 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -953,7 +1171,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; exports.registerDefaultDecorators = registerDefaultDecorators; - var _decoratorsInline = __webpack_require__(19); + var _decoratorsInline = __webpack_require__(31); var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); @@ -962,7 +1180,7 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 19 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -995,7 +1213,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 20 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1028,8 +1246,8 @@ return /******/ (function(modules) { // webpackBootstrap if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { var method = logger.methodMap[level]; + // eslint-disable-next-line no-console if (!console[method]) { - // eslint-disable-line no-console method = 'log'; } @@ -1046,7 +1264,130 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 21 */ +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _Object$create = __webpack_require__(34)['default']; + + var _Object$keys = __webpack_require__(13)['default']; + + var _interopRequireWildcard = __webpack_require__(3)['default']; + + exports.__esModule = true; + exports.createProtoAccessControl = createProtoAccessControl; + exports.resultIsAllowed = resultIsAllowed; + exports.resetLoggedProperties = resetLoggedProperties; + + var _createNewLookupObject = __webpack_require__(36); + + var _logger = __webpack_require__(32); + + var logger = _interopRequireWildcard(_logger); + + var loggedProperties = _Object$create(null); + + function createProtoAccessControl(runtimeOptions) { + var defaultMethodWhiteList = _Object$create(null); + defaultMethodWhiteList['constructor'] = false; + defaultMethodWhiteList['__defineGetter__'] = false; + defaultMethodWhiteList['__defineSetter__'] = false; + defaultMethodWhiteList['__lookupGetter__'] = false; + + var defaultPropertyWhiteList = _Object$create(null); + // eslint-disable-next-line no-proto + defaultPropertyWhiteList['__proto__'] = false; + + return { + properties: { + whitelist: _createNewLookupObject.createNewLookupObject(defaultPropertyWhiteList, runtimeOptions.allowedProtoProperties), + defaultValue: runtimeOptions.allowProtoPropertiesByDefault + }, + methods: { + whitelist: _createNewLookupObject.createNewLookupObject(defaultMethodWhiteList, runtimeOptions.allowedProtoMethods), + defaultValue: runtimeOptions.allowProtoMethodsByDefault + } + }; + } + + function resultIsAllowed(result, protoAccessControl, propertyName) { + if (typeof result === 'function') { + return checkWhiteList(protoAccessControl.methods, propertyName); + } else { + return checkWhiteList(protoAccessControl.properties, propertyName); + } + } + + function checkWhiteList(protoAccessControlForType, propertyName) { + if (protoAccessControlForType.whitelist[propertyName] !== undefined) { + return protoAccessControlForType.whitelist[propertyName] === true; + } + if (protoAccessControlForType.defaultValue !== undefined) { + return protoAccessControlForType.defaultValue; + } + logUnexpecedPropertyAccessOnce(propertyName); + return false; + } + + function logUnexpecedPropertyAccessOnce(propertyName) { + if (loggedProperties[propertyName] !== true) { + loggedProperties[propertyName] = true; + logger.log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'); + } + } + + function resetLoggedProperties() { + _Object$keys(loggedProperties).forEach(function (propertyName) { + delete loggedProperties[propertyName]; + }); + } + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(35), __esModule: true }; + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + + var $ = __webpack_require__(9); + module.exports = function create(P, D){ + return $.create(P, D); + }; + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var _Object$create = __webpack_require__(34)['default']; + + exports.__esModule = true; + exports.createNewLookupObject = createNewLookupObject; + + var _utils = __webpack_require__(5); + + /** + * Create a new object with "null"-prototype to avoid truthy results on prototype properties. + * The resulting object can be used with "object[property]" to check if a property exists + * @param {...object} sources a varargs parameter of source objects that will be merged + * @returns {object} + */ + + function createNewLookupObject() { + for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { + sources[_key] = arguments[_key]; + } + + return _utils.extend.apply(undefined, [_Object$create(null)].concat(sources)); + } + +/***/ }), +/* 37 */ /***/ (function(module, exports) { // Build out our basic SafeString type @@ -1065,12 +1406,14 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 22 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; - var _Object$seal = __webpack_require__(23)['default']; + var _Object$seal = __webpack_require__(39)['default']; + + var _Object$keys = __webpack_require__(13)['default']; var _interopRequireWildcard = __webpack_require__(3)['default']; @@ -1096,6 +1439,10 @@ return /******/ (function(modules) { // webpackBootstrap var _helpers = __webpack_require__(10); + var _internalWrapHelper = __webpack_require__(43); + + var _internalProtoAccess = __webpack_require__(33); + function checkRevision(compilerInfo) { var compilerRevision = compilerInfo && compilerInfo[0] || 1, currentRevision = _base.COMPILER_REVISION; @@ -1115,7 +1462,6 @@ return /******/ (function(modules) { // webpackBootstrap } function template(templateSpec, env) { - /* istanbul ignore next */ if (!env) { throw new _exception2['default']('No environment passed to template'); @@ -1142,13 +1488,16 @@ return /******/ (function(modules) { // webpackBootstrap } partial = env.VM.resolvePartial.call(this, partial, context, options); - var optionsWithHooks = Utils.extend({}, options, { hooks: this.hooks }); + var extendedOptions = Utils.extend({}, options, { + hooks: this.hooks, + protoAccessControl: this.protoAccessControl + }); - var result = env.VM.invokePartial.call(this, partial, context, optionsWithHooks); + var result = env.VM.invokePartial.call(this, partial, context, extendedOptions); if (result == null && env.compile) { options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, optionsWithHooks); + result = options.partials[options.name](context, extendedOptions); } if (result != null) { if (options.indent) { @@ -1170,16 +1519,33 @@ return /******/ (function(modules) { // webpackBootstrap // Just add water var container = { - strict: function strict(obj, name) { - if (!(name in obj)) { - throw new _exception2['default']('"' + name + '" not defined in ' + obj); + strict: function strict(obj, name, loc) { + if (!obj || !(name in obj)) { + throw new _exception2['default']('"' + name + '" not defined in ' + obj, { + loc: loc + }); + } + return container.lookupProperty(obj, name); + }, + lookupProperty: function lookupProperty(parent, propertyName) { + var result = parent[propertyName]; + if (result == null) { + return result; + } + if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { + return result; } - return obj[name]; + + if (_internalProtoAccess.resultIsAllowed(result, container.protoAccessControl, propertyName)) { + return result; + } + return undefined; }, lookup: function lookup(depths, name) { var len = depths.length; for (var i = 0; i < len; i++) { - if (depths[i] && depths[i][name] != null) { + var result = depths[i] && container.lookupProperty(depths[i], name); + if (result != null) { return depths[i][name]; } } @@ -1215,6 +1581,15 @@ return /******/ (function(modules) { // webpackBootstrap } return value; }, + mergeIfNeeded: function mergeIfNeeded(param, common) { + var obj = param || common; + + if (param && common && param !== common) { + obj = Utils.extend({}, common, param); + } + + return obj; + }, // An empty object to use as replacement for null-contexts nullContext: _Object$seal({}), @@ -1244,28 +1619,35 @@ return /******/ (function(modules) { // webpackBootstrap function main(context /*, options*/) { return '' + templateSpec.main(container, context, container.helpers, container.partials, data, blockParams, depths); } + main = executeDecorators(templateSpec.main, main, container, options.depths || [], data, blockParams); return main(context, options); } + ret.isTop = true; ret._setup = function (options) { if (!options.partial) { - container.helpers = Utils.extend({}, env.helpers, options.helpers); + var mergedHelpers = Utils.extend({}, env.helpers, options.helpers); + wrapHelpersToPassLookupProperty(mergedHelpers, container); + container.helpers = mergedHelpers; if (templateSpec.usePartial) { - container.partials = Utils.extend({}, env.partials, options.partials); + // Use mergeIfNeeded here to prevent compiling global partials multiple times + container.partials = container.mergeIfNeeded(options.partials, env.partials); } if (templateSpec.usePartial || templateSpec.useDecorators) { container.decorators = Utils.extend({}, env.decorators, options.decorators); } container.hooks = {}; + container.protoAccessControl = _internalProtoAccess.createProtoAccessControl(options); var keepHelperInHelpers = options.allowCallsToHelperMissing || templateWasPrecompiledWithCompilerV7; _helpers.moveHelperToHooks(container, 'helperMissing', keepHelperInHelpers); _helpers.moveHelperToHooks(container, 'blockHelperMissing', keepHelperInHelpers); } else { + container.protoAccessControl = options.protoAccessControl; // internal option container.helpers = options.helpers; container.partials = options.partials; container.decorators = options.decorators; @@ -1386,34 +1768,48 @@ return /******/ (function(modules) { // webpackBootstrap return prog; } + function wrapHelpersToPassLookupProperty(mergedHelpers, container) { + _Object$keys(mergedHelpers).forEach(function (helperName) { + var helper = mergedHelpers[helperName]; + mergedHelpers[helperName] = passLookupPropertyOption(helper, container); + }); + } + + function passLookupPropertyOption(helper, container) { + var lookupProperty = container.lookupProperty; + return _internalWrapHelper.wrapHelper(helper, function (options) { + return Utils.extend({ lookupProperty: lookupProperty }, options); + }); + } + /***/ }), -/* 23 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(24), __esModule: true }; + module.exports = { "default": __webpack_require__(40), __esModule: true }; /***/ }), -/* 24 */ +/* 40 */ /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(25); - module.exports = __webpack_require__(30).Object.seal; + __webpack_require__(41); + module.exports = __webpack_require__(21).Object.seal; /***/ }), -/* 25 */ +/* 41 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.17 Object.seal(O) - var isObject = __webpack_require__(26); + var isObject = __webpack_require__(42); - __webpack_require__(27)('seal', function($seal){ + __webpack_require__(18)('seal', function($seal){ return function seal(it){ return $seal && isObject(it) ? $seal(it) : it; }; }); /***/ }), -/* 26 */ +/* 42 */ /***/ (function(module, exports) { module.exports = function(it){ @@ -1421,139 +1817,33 @@ return /******/ (function(modules) { // webpackBootstrap }; /***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - - // most Object methods by ES6 should accept primitives - var $export = __webpack_require__(28) - , core = __webpack_require__(30) - , fails = __webpack_require__(33); - module.exports = function(KEY, exec){ - var fn = (core.Object || {})[KEY] || Object[KEY] - , exp = {}; - exp[KEY] = exec(fn); - $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); - }; - -/***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { - - var global = __webpack_require__(29) - , core = __webpack_require__(30) - , ctx = __webpack_require__(31) - , PROTOTYPE = 'prototype'; - - var $export = function(type, name, source){ - var IS_FORCED = type & $export.F - , IS_GLOBAL = type & $export.G - , IS_STATIC = type & $export.S - , IS_PROTO = type & $export.P - , IS_BIND = type & $export.B - , IS_WRAP = type & $export.W - , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) - , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] - , key, own, out; - if(IS_GLOBAL)source = name; - for(key in source){ - // contains in native - own = !IS_FORCED && target && key in target; - if(own && key in exports)continue; - // export native or passed - out = own ? target[key] : source[key]; - // prevent global pollution for namespaces - exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] - // bind timers to global for call from export context - : IS_BIND && own ? ctx(out, global) - // wrap global constructors for prevent change them in library - : IS_WRAP && target[key] == out ? (function(C){ - var F = function(param){ - return this instanceof C ? new C(param) : C(param); - }; - F[PROTOTYPE] = C[PROTOTYPE]; - return F; - // make static versions for prototype methods - })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; - } - }; - // type bitmap - $export.F = 1; // forced - $export.G = 2; // global - $export.S = 4; // static - $export.P = 8; // proto - $export.B = 16; // bind - $export.W = 32; // wrap - module.exports = $export; - -/***/ }), -/* 29 */ -/***/ (function(module, exports) { - - // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 - var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); - if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef - -/***/ }), -/* 30 */ +/* 43 */ /***/ (function(module, exports) { - var core = module.exports = {version: '1.2.6'}; - if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef + 'use strict'; -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { + exports.__esModule = true; + exports.wrapHelper = wrapHelper; - // optional / simple context binding - var aFunction = __webpack_require__(32); - module.exports = function(fn, that, length){ - aFunction(fn); - if(that === undefined)return fn; - switch(length){ - case 1: return function(a){ - return fn.call(that, a); - }; - case 2: return function(a, b){ - return fn.call(that, a, b); - }; - case 3: return function(a, b, c){ - return fn.call(that, a, b, c); - }; + function wrapHelper(helper, transformOptionsFn) { + if (typeof helper !== 'function') { + // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 + // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. + return helper; } - return function(/* ...args */){ - return fn.apply(that, arguments); + var wrapper = function wrapper() /* dynamic arguments */{ + var options = arguments[arguments.length - 1]; + arguments[arguments.length - 1] = transformOptionsFn(options); + return helper.apply(this, arguments); }; - }; - -/***/ }), -/* 32 */ -/***/ (function(module, exports) { - - module.exports = function(it){ - if(typeof it != 'function')throw TypeError(it + ' is not a function!'); - return it; - }; - -/***/ }), -/* 33 */ -/***/ (function(module, exports) { - - module.exports = function(exec){ - try { - return !!exec(); - } catch(e){ - return true; - } - }; + return wrapper; + } /***/ }), -/* 34 */ +/* 44 */ /***/ (function(module, exports) { - /* WEBPACK VAR INJECTION */(function(global) {/* global window */ - 'use strict'; + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; exports.__esModule = true; @@ -1574,7 +1864,7 @@ return /******/ (function(modules) { // webpackBootstrap /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), -/* 35 */ +/* 45 */ /***/ (function(module, exports) { 'use strict'; @@ -1609,7 +1899,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 36 */ +/* 46 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1619,17 +1909,18 @@ return /******/ (function(modules) { // webpackBootstrap var _interopRequireWildcard = __webpack_require__(3)['default']; exports.__esModule = true; + exports.parseWithoutProcessing = parseWithoutProcessing; exports.parse = parse; - var _parser = __webpack_require__(37); + var _parser = __webpack_require__(47); var _parser2 = _interopRequireDefault(_parser); - var _whitespaceControl = __webpack_require__(38); + var _whitespaceControl = __webpack_require__(48); var _whitespaceControl2 = _interopRequireDefault(_whitespaceControl); - var _helpers = __webpack_require__(40); + var _helpers = __webpack_require__(50); var Helpers = _interopRequireWildcard(_helpers); @@ -1640,7 +1931,7 @@ return /******/ (function(modules) { // webpackBootstrap var yy = {}; _utils.extend(yy, Helpers); - function parse(input, options) { + function parseWithoutProcessing(input, options) { // Just return if an already-compiled AST was passed in. if (input.type === 'Program') { return input; @@ -1653,12 +1944,20 @@ return /******/ (function(modules) { // webpackBootstrap return new yy.SourceLocation(options && options.srcName, locInfo); }; + var ast = _parser2['default'].parse(input); + + return ast; + } + + function parse(input, options) { + var ast = parseWithoutProcessing(input, options); var strip = new _whitespaceControl2['default'](options); - return strip.accept(_parser2['default'].parse(input)); + + return strip.accept(ast); } /***/ }), -/* 37 */ +/* 47 */ /***/ (function(module, exports) { // File ignored in coverage tests via setting in .istanbul.yml @@ -2399,7 +2698,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports["default"]; /***/ }), -/* 38 */ +/* 48 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -2408,7 +2707,7 @@ return /******/ (function(modules) { // webpackBootstrap exports.__esModule = true; - var _visitor = __webpack_require__(39); + var _visitor = __webpack_require__(49); var _visitor2 = _interopRequireDefault(_visitor); @@ -2623,7 +2922,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 39 */ +/* 49 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -2766,7 +3065,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 40 */ +/* 50 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -2997,13 +3296,15 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 41 */ +/* 51 */ /***/ (function(module, exports, __webpack_require__) { /* eslint-disable new-cap */ 'use strict'; + var _Object$create = __webpack_require__(34)['default']; + var _interopRequireDefault = __webpack_require__(1)['default']; exports.__esModule = true; @@ -3017,7 +3318,7 @@ return /******/ (function(modules) { // webpackBootstrap var _utils = __webpack_require__(5); - var _ast = __webpack_require__(35); + var _ast = __webpack_require__(45); var _ast2 = _interopRequireDefault(_ast); @@ -3071,26 +3372,16 @@ return /******/ (function(modules) { // webpackBootstrap options.blockParams = options.blockParams || []; - // These changes will propagate to the other compiler components - var knownHelpers = options.knownHelpers; - options.knownHelpers = { - 'helperMissing': true, - 'blockHelperMissing': true, - 'each': true, + options.knownHelpers = _utils.extend(_Object$create(null), { + helperMissing: true, + blockHelperMissing: true, + each: true, 'if': true, - 'unless': true, + unless: true, 'with': true, - 'log': true, - 'lookup': true - }; - if (knownHelpers) { - // the next line should use "Object.keys", but the code has been like this a long time and changing it, might - // cause backwards-compatibility issues... It's an old library... - // eslint-disable-next-line guard-for-in - for (var _name in knownHelpers) { - this.options.knownHelpers[_name] = knownHelpers[_name]; - } - } + log: true, + lookup: true + }, options.knownHelpers); return this.accept(program); }, @@ -3356,7 +3647,11 @@ return /******/ (function(modules) { // webpackBootstrap // HELPERS opcode: function opcode(name) { - this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc }); + this.opcodes.push({ + opcode: name, + args: slice.call(arguments, 1), + loc: this.sourceNode[0].loc + }); }, addDepth: function addDepth(depth) { @@ -3384,10 +3679,9 @@ return /******/ (function(modules) { // webpackBootstrap // if ambiguous, we can possibly resolve the ambiguity now // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. if (isEligible && !isHelper) { - var _name2 = sexpr.path.parts[0], + var _name = sexpr.path.parts[0], options = this.options; - - if (options.knownHelpers[_name2]) { + if (options.knownHelpers[_name]) { isHelper = true; } else if (options.knownHelpersOnly) { isEligible = false; @@ -3573,11 +3867,13 @@ return /******/ (function(modules) { // webpackBootstrap } /***/ }), -/* 42 */ +/* 52 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; + var _Object$keys = __webpack_require__(13)['default']; + var _interopRequireDefault = __webpack_require__(1)['default']; exports.__esModule = true; @@ -3590,7 +3886,7 @@ return /******/ (function(modules) { // webpackBootstrap var _utils = __webpack_require__(5); - var _codeGen = __webpack_require__(43); + var _codeGen = __webpack_require__(53); var _codeGen2 = _interopRequireDefault(_codeGen); @@ -3603,24 +3899,11 @@ return /******/ (function(modules) { // webpackBootstrap JavaScriptCompiler.prototype = { // PUBLIC API: You can override these methods in a subclass to provide // alternative compiled forms for name lookup and buffering semantics - nameLookup: function nameLookup(parent, name /* , type*/) { - var isEnumerable = [this.aliasable('container.propertyIsEnumerable'), '.call(', parent, ',"constructor")']; - - if (name === 'constructor') { - return ['(', isEnumerable, '?', _actualLookup(), ' : undefined)']; - } - return _actualLookup(); - - function _actualLookup() { - if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { - return [parent, '.', name]; - } else { - return [parent, '[', JSON.stringify(name), ']']; - } - } + nameLookup: function nameLookup(parent, name /*, type */) { + return this.internalNameLookup(parent, name); }, depthedLookup: function depthedLookup(name) { - return [this.aliasable('container.lookup'), '(depths, "', name, '")']; + return [this.aliasable('container.lookup'), '(depths, ', JSON.stringify(name), ')']; }, compilerInfo: function compilerInfo() { @@ -3653,6 +3936,12 @@ return /******/ (function(modules) { // webpackBootstrap return this.quotedString(''); }, // END PUBLIC API + internalNameLookup: function internalNameLookup(parent, name) { + this.lookupPropertyFunctionIsUsed = true; + return ['lookupProperty(', parent, ',', JSON.stringify(name), ')']; + }, + + lookupPropertyFunctionIsUsed: false, compile: function compile(environment, options, context, asObject) { this.environment = environment; @@ -3711,7 +4000,7 @@ return /******/ (function(modules) { // webpackBootstrap if (!this.decorators.isEmpty()) { this.useDecorators = true; - this.decorators.prepend('var decorators = container.decorators;\n'); + this.decorators.prepend(['var decorators = container.decorators, ', this.lookupPropertyFunctionVarDeclaration(), ';\n']); this.decorators.push('return fn;'); if (asObject) { @@ -3798,6 +4087,10 @@ return /******/ (function(modules) { // webpackBootstrap }, createFunctionContext: function createFunctionContext(asObject) { + // istanbul ignore next + + var _this = this; + var varDeclarations = ''; var locals = this.stackVars.concat(this.registers.list); @@ -3812,13 +4105,16 @@ return /******/ (function(modules) { // webpackBootstrap // aliases will not be used, but this case is already being run on the client and // we aren't concern about minimizing the template size. var aliasCount = 0; - for (var alias in this.aliases) { - // eslint-disable-line guard-for-in - var node = this.aliases[alias]; - if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { + _Object$keys(this.aliases).forEach(function (alias) { + var node = _this.aliases[alias]; + if (node.children && node.referenceCount > 1) { varDeclarations += ', alias' + ++aliasCount + '=' + alias; node.children[0] = 'alias' + aliasCount; } + }); + + if (this.lookupPropertyFunctionIsUsed) { + varDeclarations += ', ' + this.lookupPropertyFunctionVarDeclaration(); } var params = ['container', 'depth0', 'helpers', 'partials', 'data']; @@ -3899,6 +4195,10 @@ return /******/ (function(modules) { // webpackBootstrap return this.source.merge(); }, + lookupPropertyFunctionVarDeclaration: function lookupPropertyFunctionVarDeclaration() { + return '\n lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n }\n '.trim(); + }, + // [blockValue] // // On stack, before: hash, inverse, program, value @@ -4065,7 +4365,7 @@ return /******/ (function(modules) { // webpackBootstrap resolvePath: function resolvePath(type, parts, i, falsy, strict) { // istanbul ignore next - var _this = this; + var _this2 = this; if (this.options.strict || this.options.assumeObjects) { this.push(strictLookup(this.options.strict && strict, this, parts, type)); @@ -4076,7 +4376,7 @@ return /******/ (function(modules) { // webpackBootstrap for (; i < len; i++) { /* eslint-disable no-loop-func */ this.replaceStack(function (current) { - var lookup = _this.nameLookup(current, parts[i], type); + var lookup = _this2.nameLookup(current, parts[i], type); // We want to ensure that zero and false are handled properly if the context (falsy flag) // needs to have the special handling for these values. if (!falsy) { @@ -4138,7 +4438,7 @@ return /******/ (function(modules) { // webpackBootstrap if (this.hash) { this.hashes.push(this.hash); } - this.hash = { values: [], types: [], contexts: [], ids: [] }; + this.hash = { values: {}, types: [], contexts: [], ids: [] }; }, popHash: function popHash() { var hash = this.hash; @@ -4676,6 +4976,7 @@ return /******/ (function(modules) { // webpackBootstrap setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { var options = this.setupParams(helper, paramSize, params); + options.loc = JSON.stringify(this.source.currentLocation); options = this.objectLiteral(options); if (useRegister) { this.useRegister('options'); @@ -4700,6 +5001,9 @@ return /******/ (function(modules) { // webpackBootstrap } })(); + /** + * @deprecated May be removed in the next major version + */ JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); }; @@ -4717,7 +5021,7 @@ return /******/ (function(modules) { // webpackBootstrap } if (requireTerminal) { - return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')']; + return [compiler.aliasable('container.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ', ', JSON.stringify(compiler.source.currentLocation), ' )']; } else { return stack; } @@ -4727,12 +5031,14 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = exports['default']; /***/ }), -/* 43 */ +/* 53 */ /***/ (function(module, exports, __webpack_require__) { /* global define */ 'use strict'; + var _Object$keys = __webpack_require__(13)['default']; + exports.__esModule = true; var _utils = __webpack_require__(5); @@ -4853,16 +5159,18 @@ return /******/ (function(modules) { // webpackBootstrap }, objectLiteral: function objectLiteral(obj) { + // istanbul ignore next + + var _this = this; + var pairs = []; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - var value = castChunk(obj[key], this); - if (value !== 'undefined') { - pairs.push([this.quotedString(key), ':', value]); - } + _Object$keys(obj).forEach(function (key) { + var value = castChunk(obj[key], _this); + if (value !== 'undefined') { + pairs.push([_this.quotedString(key), ':', value]); } - } + }); var ret = this.generateList(pairs); ret.prepend('{'); diff --git a/test/JavaScriptEngineSwitcher.Benchmarks/HostObjectsEmbeddingBenchmark.cs b/test/JavaScriptEngineSwitcher.Benchmarks/HostObjectsEmbeddingBenchmark.cs index 5b24e9a9..bac0c053 100644 --- a/test/JavaScriptEngineSwitcher.Benchmarks/HostObjectsEmbeddingBenchmark.cs +++ b/test/JavaScriptEngineSwitcher.Benchmarks/HostObjectsEmbeddingBenchmark.cs @@ -11,9 +11,7 @@ using JavaScriptEngineSwitcher.Jurassic; using JavaScriptEngineSwitcher.Msie; using JavaScriptEngineSwitcher.NiL; -#if NET461 || NETCOREAPP3_1_OR_GREATER using JavaScriptEngineSwitcher.V8; -#endif using JavaScriptEngineSwitcher.Benchmarks.Interop.ObjectsEmbedding; @@ -120,7 +118,7 @@ public void Jurassic() Func createJsEngine = () => new JurassicJsEngine(); EmbedAndUseHostObjects(createJsEngine); } -#if NET461 +#if NET462 [Benchmark] public void MsieClassic() @@ -168,14 +166,16 @@ public void NiL() Func createJsEngine = () => new NiLJsEngine(); EmbedAndUseHostObjects(createJsEngine); } -#if NET461 || NETCOREAPP3_1_OR_GREATER [Benchmark] - public void V8() + [Arguments(false)] + [Arguments(true)] + public void V8(bool disableDynamicBinding) { - Func createJsEngine = () => new V8JsEngine(); + Func createJsEngine = () => new V8JsEngine( + new V8Settings { DisableDynamicBinding = disableDynamicBinding } + ); EmbedAndUseHostObjects(createJsEngine); } -#endif } } \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Benchmarks/HostTypesEmbeddingBenchmark.cs b/test/JavaScriptEngineSwitcher.Benchmarks/HostTypesEmbeddingBenchmark.cs index 0c36567d..1793ae43 100644 --- a/test/JavaScriptEngineSwitcher.Benchmarks/HostTypesEmbeddingBenchmark.cs +++ b/test/JavaScriptEngineSwitcher.Benchmarks/HostTypesEmbeddingBenchmark.cs @@ -11,9 +11,7 @@ using JavaScriptEngineSwitcher.Jurassic; using JavaScriptEngineSwitcher.Msie; using JavaScriptEngineSwitcher.NiL; -#if NET461 || NETCOREAPP3_1_OR_GREATER using JavaScriptEngineSwitcher.V8; -#endif using JavaScriptEngineSwitcher.Benchmarks.Interop.TypesEmbedding; @@ -100,7 +98,7 @@ public void Jurassic() Func createJsEngine = () => new JurassicJsEngine(); EmbedAndUseHostTypes(createJsEngine); } -#if NET461 +#if NET462 [Benchmark] public void MsieClassic() @@ -148,14 +146,16 @@ public void NiL() Func createJsEngine = () => new NiLJsEngine(); EmbedAndUseHostTypes(createJsEngine); } -#if NET461 || NETCOREAPP3_1_OR_GREATER [Benchmark] - public void V8() + [Arguments(false)] + [Arguments(true)] + public void V8(bool disableDynamicBinding) { - Func createJsEngine = () => new V8JsEngine(); + Func createJsEngine = () => new V8JsEngine( + new V8Settings { DisableDynamicBinding = disableDynamicBinding } + ); EmbedAndUseHostTypes(createJsEngine); } -#endif } } \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Benchmarks/JavaScriptEngineSwitcher.Benchmarks.csproj b/test/JavaScriptEngineSwitcher.Benchmarks/JavaScriptEngineSwitcher.Benchmarks.csproj index c36c8ac8..b78e72c9 100644 --- a/test/JavaScriptEngineSwitcher.Benchmarks/JavaScriptEngineSwitcher.Benchmarks.csproj +++ b/test/JavaScriptEngineSwitcher.Benchmarks/JavaScriptEngineSwitcher.Benchmarks.csproj @@ -2,22 +2,29 @@ JS Engine Switcher: Benchmarks - 3.19.0 - net461;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0 + 3.30.2 + net462;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0 Exe + AnyCPU true + true + true false + false - - - - - - + + + + + + + + + @@ -27,27 +34,18 @@ - - - - - - - - - - - - + - - - - - - + + + + + + + + diff --git a/test/JavaScriptEngineSwitcher.Benchmarks/JsExecutionHeavyBenchmark.cs b/test/JavaScriptEngineSwitcher.Benchmarks/JsExecutionHeavyBenchmark.cs index a370581c..a3225779 100644 --- a/test/JavaScriptEngineSwitcher.Benchmarks/JsExecutionHeavyBenchmark.cs +++ b/test/JavaScriptEngineSwitcher.Benchmarks/JsExecutionHeavyBenchmark.cs @@ -12,10 +12,9 @@ using JavaScriptEngineSwitcher.Msie; using JavaScriptEngineSwitcher.NiL; using JavaScriptEngineSwitcher.Node; -#if NET461 || NETCOREAPP3_1_OR_GREATER using JavaScriptEngineSwitcher.V8; -#endif using JavaScriptEngineSwitcher.Vroom; +using JavaScriptEngineSwitcher.Yantra; namespace JavaScriptEngineSwitcher.Benchmarks { @@ -83,7 +82,7 @@ public static void PopulateTestData() string librariesDirectoryPath = Path.Combine(filesDirectoryPath, "lib"); string contentDirectoryPath = Path.Combine(filesDirectoryPath, "content"); - _libraryCode = File.ReadAllText(Path.Combine(librariesDirectoryPath, "bundle.min.js")); + _libraryCode = File.ReadAllText(Path.Combine(librariesDirectoryPath, LibraryFileName)); foreach (ContentItem item in _contentItems) { @@ -177,7 +176,7 @@ public void Jurassic(bool withPrecompilation) Func createJsEngine = () => new JurassicJsEngine(); RenderTemplates(createJsEngine, withPrecompilation); } -#if NET461 +#if NET462 [Benchmark] public void MsieClassic() @@ -237,7 +236,6 @@ public void Node() Func createJsEngine = () => new NodeJsEngine(); RenderTemplates(createJsEngine, false); } -#if NET461 || NETCOREAPP3_1_OR_GREATER [Benchmark] [Arguments(false)] @@ -247,7 +245,6 @@ public void V8(bool withPrecompilation) Func createJsEngine = () => new V8JsEngine(); RenderTemplates(createJsEngine, withPrecompilation); } -#endif [Benchmark] public void Vroom() @@ -256,6 +253,13 @@ public void Vroom() RenderTemplates(createJsEngine, false); } + [Benchmark] + public void Yantra() + { + Func createJsEngine = () => new YantraJsEngine(); + RenderTemplates(createJsEngine, false); + } + #region Internal types private sealed class ContentItem diff --git a/test/JavaScriptEngineSwitcher.Benchmarks/JsExecutionLightBenchmark.cs b/test/JavaScriptEngineSwitcher.Benchmarks/JsExecutionLightBenchmark.cs index 4332e07d..d352072a 100644 --- a/test/JavaScriptEngineSwitcher.Benchmarks/JsExecutionLightBenchmark.cs +++ b/test/JavaScriptEngineSwitcher.Benchmarks/JsExecutionLightBenchmark.cs @@ -12,10 +12,9 @@ using JavaScriptEngineSwitcher.Msie; using JavaScriptEngineSwitcher.NiL; using JavaScriptEngineSwitcher.Node; -#if NET461 || NETCOREAPP3_1_OR_GREATER using JavaScriptEngineSwitcher.V8; -#endif using JavaScriptEngineSwitcher.Vroom; +using JavaScriptEngineSwitcher.Yantra; namespace JavaScriptEngineSwitcher.Benchmarks { @@ -212,7 +211,7 @@ public void Jurassic(bool withPrecompilation) Func createJsEngine = () => new JurassicJsEngine(); TransliterateStrings(createJsEngine, withPrecompilation); } -#if NET461 +#if NET462 [Benchmark] public void MsieClassic() @@ -271,7 +270,6 @@ public void Node() Func createJsEngine = () => new NodeJsEngine(); TransliterateStrings(createJsEngine, false); } -#if NET461 || NETCOREAPP3_1_OR_GREATER [Benchmark] [Arguments(false)] @@ -281,7 +279,6 @@ public void V8(bool withPrecompilation) Func createJsEngine = () => new V8JsEngine(); TransliterateStrings(createJsEngine, withPrecompilation); } -#endif [Benchmark] public void Vroom() @@ -289,5 +286,12 @@ public void Vroom() Func createJsEngine = () => new VroomJsEngine(); TransliterateStrings(createJsEngine, false); } + + [Benchmark] + public void Yantra() + { + Func createJsEngine = () => new YantraJsEngine(); + TransliterateStrings(createJsEngine, false); + } } } \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/ChakraCore/CommonTests.cs b/test/JavaScriptEngineSwitcher.Tests/ChakraCore/CommonTests.cs index 894a7d51..fd1ddb64 100644 --- a/test/JavaScriptEngineSwitcher.Tests/ChakraCore/CommonTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/ChakraCore/CommonTests.cs @@ -20,7 +20,7 @@ protected override string EngineName #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingCompilationErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -56,7 +56,7 @@ public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingRuntimeErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -93,7 +93,7 @@ public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() + public void MappingCompilationErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -135,7 +135,7 @@ public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -185,7 +185,7 @@ public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringOutOfMemoryIsCorrect() + public void MappingRuntimeErrorDuringOutOfMemory() { // Arrange const string input = @"var arr = []; @@ -194,40 +194,56 @@ public void MappingRuntimeErrorDuringOutOfMemoryIsCorrect() arr.push('Current date: ' + new Date()); }"; - JsRuntimeException exception = null; - // Act - using (IJsEngine jsEngine = new ChakraCoreJsEngine( - new ChakraCoreSettings - { - MemoryLimit = new UIntPtr(2 * 1024 * 1024) - } - )) + IJsEngine jsEngine = null; + JsException exception = null; + + try { - try - { - jsEngine.Execute(input); - } - catch (JsRuntimeException e) - { - exception = e; - } + jsEngine = new ChakraCoreJsEngine( + new ChakraCoreSettings + { + MemoryLimit = new UIntPtr(2 * 1024 * 1024) + } + ); + jsEngine.Execute(input); + } + catch (JsEngineException e) + { + exception = e; + } + catch (JsRuntimeException e) + { + exception = e; + } + finally + { + jsEngine?.Dispose(); } // Assert Assert.NotNull(exception); - Assert.Equal("Runtime error", exception.Category); - Assert.Equal("Out of memory", exception.Description); + if (exception is JsRuntimeException) + { + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Out of memory", exception.Description); + } + else if (exception is JsEngineException) + { + Assert.Equal("Engine load error", exception.Category); + Assert.Equal("Out of memory.", exception.Description); + } } [Fact] - public void MappingEngineLoadErrorDuringOutOfMemoryIsCorrect() + public void MappingEngineLoadErrorDuringOutOfMemory() { // Arrange + + // Act IJsEngine jsEngine = null; JsEngineLoadException exception = null; - // Act try { jsEngine = new ChakraCoreJsEngine( @@ -257,7 +273,7 @@ public void MappingEngineLoadErrorDuringOutOfMemoryIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"var arr = []; @@ -287,7 +303,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function foo(x, y) { diff --git a/test/JavaScriptEngineSwitcher.Tests/ChakraCore/EvalTests.cs b/test/JavaScriptEngineSwitcher.Tests/ChakraCore/EvalTests.cs new file mode 100644 index 00000000..2e4b9de4 --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/ChakraCore/EvalTests.cs @@ -0,0 +1,65 @@ +using Xunit; + +using JavaScriptEngineSwitcher.ChakraCore; +using JavaScriptEngineSwitcher.Core; + +namespace JavaScriptEngineSwitcher.Tests.ChakraCore +{ + public class EvalTests : EvalTestsBase + { + protected override string EngineName + { + get { return "ChakraCoreJsEngine"; } + } + + + private IJsEngine CreateJsEngine(bool disableEval) + { + var jsEngine = new ChakraCoreJsEngine(new ChakraCoreSettings + { + DisableEval = disableEval + }); + + return jsEngine; + } + + + public override void UsageOfEvalFunction() + { + // Arrange + int TestDisableEvalSetting(bool disableEval) + { + using (var jsEngine = CreateJsEngine(disableEval: disableEval)) + { + return jsEngine.Evaluate("eval('2*2');"); + } + } + + // Act and Assert + Assert.Equal(4, TestDisableEvalSetting(false)); + + JsRuntimeException exception = Assert.Throws(() => TestDisableEvalSetting(true)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Eval of strings is disabled in this runtime.", exception.Description); + } + + public override void UsageOfFunctionConstructor() + { + // Arrange + int TestDisableEvalSetting(bool disableEval) + { + using (var jsEngine = CreateJsEngine(disableEval: disableEval)) + { + return jsEngine.Evaluate("new Function('return 2*2;')();"); + } + } + + // Act and Assert + Assert.Equal(4, TestDisableEvalSetting(false)); + + JsRuntimeException exception = Assert.Throws(() => TestDisableEvalSetting(true)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Eval of strings is disabled in this runtime.", exception.Description); + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/ChakraCore/InteropTests.cs b/test/JavaScriptEngineSwitcher.Tests/ChakraCore/InteropTests.cs index 68477ef4..7aa231dc 100644 --- a/test/JavaScriptEngineSwitcher.Tests/ChakraCore/InteropTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/ChakraCore/InteropTests.cs @@ -1,9 +1,14 @@ using System; using System.IO; +using System.Reflection; using Xunit; using JavaScriptEngineSwitcher.Core; +using JavaScriptEngineSwitcher.ChakraCore; + +using JavaScriptEngineSwitcher.Tests.Interop; +using JavaScriptEngineSwitcher.Tests.Interop.Animals; namespace JavaScriptEngineSwitcher.Tests.ChakraCore { @@ -15,14 +20,120 @@ protected override string EngineName } + private IJsEngine CreateJsEngine(bool allowReflection) + { + var jsEngine = new ChakraCoreJsEngine(new ChakraCoreSettings + { + AllowReflection = allowReflection + }); + + return jsEngine; + } + #region Embedding of objects + #region Objects with methods + + [Fact] + public override void EmbeddingOfInstanceOfCustomValueTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + var date = new Date(); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("date", date); + return jsEngine.Evaluate("date.GetType();"); + } + } + + // Act and Assert + Assert.Equal(typeof(Date).FullName, TestAllowReflectionSetting(true)); + + var exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Object doesn't support property or method 'GetType'", exception.Description); + } + + [Fact] + public override void EmbeddingOfInstanceOfCustomReferenceTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + var cat = new Cat(); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("cat", cat); + return jsEngine.Evaluate("cat.GetType();"); + } + } + + // Act and Assert + Assert.Equal(typeof(Cat).FullName, TestAllowReflectionSetting(true)); + + JsRuntimeException exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Object doesn't support property or method 'GetType'", exception.Description); + } + + [Fact] + public override void EmbeddingOfInstanceOfAssemblyTypeAndCallingOfItsCreateInstanceMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + Assembly assembly = this.GetType().Assembly; + string personTypeName = typeof(Person).FullName; + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("assembly", assembly); + return jsEngine.Evaluate("assembly.CreateInstance(\"" + personTypeName + "\");"); + } + } + + // Act and Assert + Assert.Equal("{FirstName=,LastName=}", TestAllowReflectionSetting(true)); + Assert.Equal("{FirstName=,LastName=}", TestAllowReflectionSetting(false)); + } + + #endregion + + #region Delegates + + [Fact] + public override void EmbeddingOfInstanceOfDelegateAndGettingItsMethodProperty() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + var cat = new Cat(); + var cryFunc = new Func(cat.Cry); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("cry", cryFunc); + return jsEngine.Evaluate("cry.Method;"); + } + } + + // Act and Assert + Assert.Equal("undefined", TestAllowReflectionSetting(true)); + Assert.Equal("undefined", TestAllowReflectionSetting(false)); + } + + #endregion + #region Recursive calls #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringRecursiveEvaluationOfFilesIsCorrect() + public void MappingCompilationErrorDuringRecursiveEvaluationOfFiles() { // Arrange const string directoryPath = "Files/recursive-evaluation/compilation-error"; @@ -64,7 +175,7 @@ public void MappingCompilationErrorDuringRecursiveEvaluationOfFilesIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringRecursiveEvaluationOfFilesIsCorrect() + public void MappingRuntimeErrorDuringRecursiveEvaluationOfFiles() { // Arrange const string directoryPath = "Files/recursive-evaluation/runtime-error"; @@ -112,7 +223,7 @@ public void MappingRuntimeErrorDuringRecursiveEvaluationOfFilesIsCorrect() } [Fact] - public void MappingHostErrorDuringRecursiveEvaluationOfFilesIsCorrect() + public void MappingHostErrorDuringRecursiveEvaluationOfFiles() { // Arrange const string directoryPath = "Files/recursive-evaluation/host-error"; @@ -160,7 +271,7 @@ public void MappingHostErrorDuringRecursiveEvaluationOfFilesIsCorrect() } [Fact] - public void MappingCompilationErrorDuringRecursiveExecutionOfFilesIsCorrect() + public void MappingCompilationErrorDuringRecursiveExecutionOfFiles() { // Arrange const string directoryPath = "Files/recursive-execution/compilation-error"; @@ -199,7 +310,7 @@ public void MappingCompilationErrorDuringRecursiveExecutionOfFilesIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringRecursiveExecutionOfFilesIsCorrect() + public void MappingRuntimeErrorDuringRecursiveExecutionOfFiles() { // Arrange const string directoryPath = "Files/recursive-execution/runtime-error"; @@ -244,7 +355,7 @@ public void MappingRuntimeErrorDuringRecursiveExecutionOfFilesIsCorrect() } [Fact] - public void MappingHostErrorDuringRecursiveExecutionOfFilesIsCorrect() + public void MappingHostErrorDuringRecursiveExecutionOfFiles() { // Arrange const string directoryPath = "Files/recursive-execution/host-error"; @@ -298,5 +409,105 @@ public void MappingHostErrorDuringRecursiveExecutionOfFilesIsCorrect() #endregion #endregion + + + #region Embedding of types + + #region Creating of instances + + [Fact] + public override void CreatingAnInstanceOfEmbeddedBuiltinExceptionAndGettingItsTargetSiteProperty() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + Type invalidOperationExceptionType = typeof(InvalidOperationException); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("InvalidOperationError", invalidOperationExceptionType); + return jsEngine.Evaluate("new InvalidOperationError(\"A terrible thing happened!\").TargetSite;"); + } + } + + // Act and Assert + Assert.Null(TestAllowReflectionSetting(true)); + Assert.Equal("undefined", TestAllowReflectionSetting(false)); + } + + [Fact] + public override void CreatingAnInstanceOfEmbeddedCustomExceptionAndCallingOfItsGetTypeMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + Type loginFailedExceptionType = typeof(LoginFailedException); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("LoginFailedError", loginFailedExceptionType); + return jsEngine.Evaluate("new LoginFailedError(\"Wrong password entered!\").GetType();"); + } + } + + // Act and Assert + Assert.Equal(typeof(LoginFailedException).FullName, TestAllowReflectionSetting(true)); + + var exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Object doesn't support property or method 'GetType'", exception.Description); + } + + #endregion + + #region Types with methods + + [Fact] + public override void EmbeddingOfTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + string dateTimeTypeName = typeof(DateTime).FullName; + + string TestAllowReflectionSetting(bool allowReflection) + { + Type type = typeof(Type); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("Type", type); + return jsEngine.Evaluate("Type.GetType(\"" + dateTimeTypeName + "\");"); + } + } + + // Act and Assert + Assert.Equal(dateTimeTypeName, TestAllowReflectionSetting(true)); + Assert.Equal(dateTimeTypeName, TestAllowReflectionSetting(false)); + } + + [Fact] + public override void EmbeddingOfAssemblyTypeAndCallingOfItsLoadMethod() + { + // Arrange + const string reflectionEmitAssemblyName = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; + + string TestAllowReflectionSetting(bool allowReflection) + { + Type assemblyType = typeof(Assembly); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("Assembly", assemblyType); + return jsEngine.Evaluate("Assembly.Load(\"" + reflectionEmitAssemblyName + "\");"); + } + } + + // Act and Assert + Assert.Equal(reflectionEmitAssemblyName, TestAllowReflectionSetting(true)); + Assert.Equal(reflectionEmitAssemblyName, TestAllowReflectionSetting(false)); + } + + #endregion + + #endregion } } \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/ChakraCore/PrecompilationTests.cs b/test/JavaScriptEngineSwitcher.Tests/ChakraCore/PrecompilationTests.cs index 18a7c5ae..55a631d4 100644 --- a/test/JavaScriptEngineSwitcher.Tests/ChakraCore/PrecompilationTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/ChakraCore/PrecompilationTests.cs @@ -19,7 +19,7 @@ protected override string EngineName #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringPrecompilationOfCodeIsCorrect() + public void MappingCompilationErrorDuringPrecompilationOfCode() { // Arrange const string input = @"function guid() { @@ -64,7 +64,7 @@ function s4() { } [Fact] - public void MappingRuntimeErrorDuringExecutionOfPrecompiledCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfPrecompiledCode() { // Arrange const string input = @"function getItem(items, itemIndex) { @@ -119,7 +119,7 @@ public void MappingRuntimeErrorDuringExecutionOfPrecompiledCodeIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"function makeId(length) { @@ -160,7 +160,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function getFullName(firstName, lastName) { diff --git a/test/JavaScriptEngineSwitcher.Tests/CommonTestsBase.cs b/test/JavaScriptEngineSwitcher.Tests/CommonTestsBase.cs index 73898dfc..a3e6edbd 100644 --- a/test/JavaScriptEngineSwitcher.Tests/CommonTestsBase.cs +++ b/test/JavaScriptEngineSwitcher.Tests/CommonTestsBase.cs @@ -13,7 +13,7 @@ public abstract class CommonTestsBase : TestsBase #region Creation of engines [Fact] - public virtual void CreationOfEngineWithoutDisposingIsCorrect() + public virtual void CreationOfEngineWithoutDisposing() { IJsEngine jsEngine = CreateJsEngine(); jsEngine.Execute("var a = 1 + 1;"); @@ -24,7 +24,7 @@ public virtual void CreationOfEngineWithoutDisposingIsCorrect() #region Evaluation of scripts [Fact] - public virtual void EvaluationOfExpressionWithUndefinedResultIsCorrect() + public virtual void EvaluationOfExpressionWithUndefinedResult() { // Arrange const string input = "undefined"; @@ -43,7 +43,7 @@ public virtual void EvaluationOfExpressionWithUndefinedResultIsCorrect() } [Fact] - public virtual void EvaluationOfExpressionWithNullResultIsCorrect() + public virtual void EvaluationOfExpressionWithNullResult() { // Arrange const string input = "null"; @@ -62,7 +62,7 @@ public virtual void EvaluationOfExpressionWithNullResultIsCorrect() } [Fact] - public virtual void EvaluationOfExpressionWithBooleanResultIsCorrect() + public virtual void EvaluationOfExpressionWithBooleanResult() { // Arrange const string input1 = "7 > 5"; @@ -87,7 +87,7 @@ public virtual void EvaluationOfExpressionWithBooleanResultIsCorrect() } [Fact] - public virtual void EvaluationOfExpressionWithIntegerResultIsCorrect() + public virtual void EvaluationOfExpressionWithIntegerResult() { // Arrange const string input = "7 * 8 - 20"; @@ -106,7 +106,7 @@ public virtual void EvaluationOfExpressionWithIntegerResultIsCorrect() } [Fact] - public virtual void EvaluationOfExpressionWithDoubleResultIsCorrect() + public virtual void EvaluationOfExpressionWithDoubleResult() { // Arrange const string input = "Math.PI + 0.22"; @@ -125,7 +125,7 @@ public virtual void EvaluationOfExpressionWithDoubleResultIsCorrect() } [Fact] - public virtual void EvaluationOfExpressionWithStringResultIsCorrect() + public virtual void EvaluationOfExpressionWithStringResult() { // Arrange const string input = "'Hello, ' + \"Vasya\" + '?';"; @@ -144,7 +144,7 @@ public virtual void EvaluationOfExpressionWithStringResultIsCorrect() } [Fact] - public virtual void EvaluationOfExpressionWithUnicodeStringResultIsCorrect() + public virtual void EvaluationOfExpressionWithUnicodeStringResult() { // Arrange const string input = "'Привет, ' + \"Вася\" + '?';"; @@ -167,7 +167,7 @@ public virtual void EvaluationOfExpressionWithUnicodeStringResultIsCorrect() #region Execution of scripts [Fact] - public virtual void ExecutionOfCodeIsCorrect() + public virtual void ExecutionOfCode() { // Arrange const string functionCode = @"function add(num1, num2) { @@ -190,7 +190,7 @@ public virtual void ExecutionOfCodeIsCorrect() } [Fact] - public virtual void ExecutionOfFileIsCorrect() + public virtual void ExecutionOfFile() { // Arrange const string filePath = "Files/square.js"; @@ -211,7 +211,7 @@ public virtual void ExecutionOfFileIsCorrect() } [Fact] - public virtual void ExecutionOfResourceByNameAndTypeIsCorrect() + public virtual void ExecutionOfResourceByNameAndType() { // Arrange const string resourceName = "Resources.cube.js"; @@ -232,7 +232,7 @@ public virtual void ExecutionOfResourceByNameAndTypeIsCorrect() } [Fact] - public virtual void ExecutionOfResourceByNameAndAssemblyIsCorrect() + public virtual void ExecutionOfResourceByNameAndAssembly() { // Arrange const string resourceName = "JavaScriptEngineSwitcher.Tests.Resources.power.js"; @@ -257,7 +257,7 @@ public virtual void ExecutionOfResourceByNameAndAssemblyIsCorrect() #region Calling of functions [Fact] - public virtual void CallingOfFunctionWithoutParametersIsCorrect() + public virtual void CallingOfFunctionWithoutParameters() { // Arrange const string functionCode = @"function hooray() { @@ -279,7 +279,7 @@ public virtual void CallingOfFunctionWithoutParametersIsCorrect() } [Fact] - public virtual void CallingOfFunctionWithUndefinedResultIsCorrect() + public virtual void CallingOfFunctionWithUndefinedResult() { // Arrange const string functionCode = @"function testUndefined(value) { @@ -305,7 +305,7 @@ public virtual void CallingOfFunctionWithUndefinedResultIsCorrect() } [Fact] - public virtual void CallingOfFunctionWithNullResultIsCorrect() + public virtual void CallingOfFunctionWithNullResult() { // Arrange const string functionCode = @"function testNull(value) { @@ -331,7 +331,7 @@ public virtual void CallingOfFunctionWithNullResultIsCorrect() } [Fact] - public virtual void CallingOfFunctionWithBooleanResultIsCorrect() + public virtual void CallingOfFunctionWithBooleanResult() { // Arrange const string functionCode = @"function inverse(value) { @@ -354,7 +354,7 @@ public virtual void CallingOfFunctionWithBooleanResultIsCorrect() } [Fact] - public virtual void CallingOfFunctionWithIntegerResultIsCorrect() + public virtual void CallingOfFunctionWithIntegerResult() { // Arrange const string functionCode = @"function negate(value) { @@ -377,7 +377,7 @@ public virtual void CallingOfFunctionWithIntegerResultIsCorrect() } [Fact] - public virtual void CallingOfFunctionWithDoubleResultIsCorrect() + public virtual void CallingOfFunctionWithDoubleResult() { // Arrange const string functionCode = @"function triple(value) { @@ -400,7 +400,7 @@ public virtual void CallingOfFunctionWithDoubleResultIsCorrect() } [Fact] - public virtual void CallingOfFunctionWithStringResultIsCorrect() + public virtual void CallingOfFunctionWithStringResult() { // Arrange const string functionCode = @"function greeting(name) { @@ -423,7 +423,7 @@ public virtual void CallingOfFunctionWithStringResultIsCorrect() } [Fact] - public virtual void CallingOfFunctionWithUnicodeStringResultIsCorrect() + public virtual void CallingOfFunctionWithUnicodeStringResult() { // Arrange const string functionCode = @"function privet(name) { @@ -446,7 +446,7 @@ public virtual void CallingOfFunctionWithUnicodeStringResultIsCorrect() } [Fact] - public virtual void CallingOfFunctionWithManyParametersIsCorrect() + public virtual void CallingOfFunctionWithManyParameters() { // Arrange const string functionCode = @"function determineArgumentsTypes() { @@ -480,7 +480,7 @@ public virtual void CallingOfFunctionWithManyParametersIsCorrect() } [Fact] - public virtual void CallingOfFunctionWithManyParametersAndBooleanResultIsCorrect() + public virtual void CallingOfFunctionWithManyParametersAndBooleanResult() { // Arrange const string functionCode = @"function and() { @@ -518,7 +518,7 @@ public virtual void CallingOfFunctionWithManyParametersAndBooleanResultIsCorrect } [Fact] - public virtual void CallingOfFunctionWithManyParametersAndIntegerResultIsCorrect() + public virtual void CallingOfFunctionWithManyParametersAndIntegerResult() { // Arrange const string functionCode = @"function sum() { @@ -548,7 +548,7 @@ public virtual void CallingOfFunctionWithManyParametersAndIntegerResultIsCorrect } [Fact] - public virtual void CallingOfFunctionWithManyParametersAndDoubleResultIsCorrect() + public virtual void CallingOfFunctionWithManyParametersAndDoubleResult() { // Arrange const string functionCode = @"function sum() { @@ -578,7 +578,7 @@ public virtual void CallingOfFunctionWithManyParametersAndDoubleResultIsCorrect( } [Fact] - public virtual void CallingOfFunctionWithManyParametersAndStringResultIsCorrect() + public virtual void CallingOfFunctionWithManyParametersAndStringResult() { // Arrange const string functionCode = @"function concatenate() { @@ -608,7 +608,7 @@ public virtual void CallingOfFunctionWithManyParametersAndStringResultIsCorrect( } [Fact] - public virtual void CallingOfFunctionWithManyParametersAndUnicodeStringResultIsCorrect() + public virtual void CallingOfFunctionWithManyParametersAndUnicodeStringResult() { // Arrange const string functionCode = @"function obedinit() { @@ -638,7 +638,7 @@ public virtual void CallingOfFunctionWithManyParametersAndUnicodeStringResultIsC } [Fact] - public virtual void CallingOfFunctionWithNameContainingUnicodeCharactersIsCorrect() + public virtual void CallingOfFunctionWithNameContainingUnicodeCharacters() { // Arrange const string functionCode = @"function сумма(число1, число2) { @@ -665,7 +665,7 @@ public virtual void CallingOfFunctionWithNameContainingUnicodeCharactersIsCorrec #region Getting, setting and removing variables [Fact] - public virtual void SettingAndGettingVariableWithUndefinedValueIsCorrect() + public virtual void SettingAndGettingVariableWithUndefinedValue() { // Arrange const string variableName = "myVar1"; @@ -688,7 +688,7 @@ public virtual void SettingAndGettingVariableWithUndefinedValueIsCorrect() } [Fact] - public virtual void SettingAndGettingVariableWithNullValueIsCorrect() + public virtual void SettingAndGettingVariableWithNullValue() { // Arrange const string variableName = "myVar2"; @@ -711,7 +711,7 @@ public virtual void SettingAndGettingVariableWithNullValueIsCorrect() } [Fact] - public virtual void SettingAndGettingVariableWithBooleanValueIsCorrect() + public virtual void SettingAndGettingVariableWithBooleanValue() { // Arrange const string variableName = "isVisible"; @@ -745,7 +745,7 @@ public virtual void SettingAndGettingVariableWithBooleanValueIsCorrect() } [Fact] - public virtual void SettingAndGettingVariableWithIntegerValueIsCorrect() + public virtual void SettingAndGettingVariableWithIntegerValue() { // Arrange const string variableName = "amount"; @@ -779,7 +779,7 @@ public virtual void SettingAndGettingVariableWithIntegerValueIsCorrect() } [Fact] - public virtual void SettingAndGettingVariableWithDoubleValueIsCorrect() + public virtual void SettingAndGettingVariableWithDoubleValue() { // Arrange const string variableName = "price"; @@ -813,7 +813,7 @@ public virtual void SettingAndGettingVariableWithDoubleValueIsCorrect() } [Fact] - public virtual void SettingAndGettingVariableWithStringValueIsCorrect() + public virtual void SettingAndGettingVariableWithStringValue() { // Arrange const string variableName = "word"; @@ -847,7 +847,7 @@ public virtual void SettingAndGettingVariableWithStringValueIsCorrect() } [Fact] - public virtual void SettingAndGettingVariableWithUnicodeStringValueIsCorrect() + public virtual void SettingAndGettingVariableWithUnicodeStringValue() { // Arrange const string variableName = "slovo"; @@ -881,7 +881,7 @@ public virtual void SettingAndGettingVariableWithUnicodeStringValueIsCorrect() } [Fact] - public virtual void SettingAndGettingVariableWithNameContainingUnicodeCharactersIsCorrect() + public virtual void SettingAndGettingVariableWithNameContainingUnicodeCharacters() { // Arrange const string variableName = "слово"; @@ -915,7 +915,7 @@ public virtual void SettingAndGettingVariableWithNameContainingUnicodeCharacters } [Fact] - public virtual void RemovingVariableIsCorrect() + public virtual void RemovingVariable() { // Arrange const string variableName = "price"; @@ -939,7 +939,7 @@ public virtual void RemovingVariableIsCorrect() } [Fact] - public virtual void RemovingVariableWithNameContainingUnicodeCharactersIsCorrect() + public virtual void RemovingVariableWithNameContainingUnicodeCharacters() { // Arrange const string variableName = "цена"; @@ -967,10 +967,10 @@ public virtual void RemovingVariableWithNameContainingUnicodeCharactersIsCorrect #region Script interruption [Fact] - public virtual void ScriptInterruptionIsCorrect() + public virtual void ScriptInterruption() { // Arrange - const string sleepyСode = @"function sleep(millisecondsTimeout) { + const string sleepyCode = @"function sleep(millisecondsTimeout) { var totalMilliseconds = new Date().getTime() + millisecondsTimeout; while (new Date() < totalMilliseconds) @@ -1005,7 +1005,7 @@ public virtual void ScriptInterruptionIsCorrect() try { - jsEngine.Execute(sleepyСode); + jsEngine.Execute(sleepyCode); } catch (Exception e) { @@ -1030,7 +1030,7 @@ public virtual void ScriptInterruptionIsCorrect() #region Garbage collection [Fact] - public virtual void GarbageCollectionIsCorrect() + public virtual void GarbageCollection() { // Arrange const string input = @"arr = []; for (i = 0; i < 1000000; i++) { arr.push(arr); }"; diff --git a/test/JavaScriptEngineSwitcher.Tests/ErrorFormattingTests.cs b/test/JavaScriptEngineSwitcher.Tests/ErrorFormattingTests.cs index f6abed9f..bf4e242b 100644 --- a/test/JavaScriptEngineSwitcher.Tests/ErrorFormattingTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/ErrorFormattingTests.cs @@ -7,7 +7,7 @@ namespace JavaScriptEngineSwitcher.Tests public class ErrorFormattingTests { [Fact] - public void GettingSourceFragmentFromLineIsCorrect() + public void GettingSourceFragmentFromLine() { // Arrange const string input1 = ""; diff --git a/test/JavaScriptEngineSwitcher.Tests/Es2015TestsBase.cs b/test/JavaScriptEngineSwitcher.Tests/Es2015TestsBase.cs index 1875db9f..8bd3763e 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Es2015TestsBase.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Es2015TestsBase.cs @@ -7,7 +7,7 @@ public abstract class Es2015TestsBase : TestsBase #region Promises [Fact] - public virtual void ExecutionOfPromisesIsCorrect() + public virtual void SupportsPromises() { // Arrange const string input = @"var output = '', diff --git a/test/JavaScriptEngineSwitcher.Tests/Es5TestsBase.cs b/test/JavaScriptEngineSwitcher.Tests/Es5TestsBase.cs index d8f4ef94..bf1106be 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Es5TestsBase.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Es5TestsBase.cs @@ -11,7 +11,7 @@ public abstract class Es5TestsBase : TestsBase #region Array methods [Fact] - public virtual void ArrayEveryMethodIsSupported() + public virtual void SupportsArrayEveryMethod() { // Arrange const string initCode = "var engines = ['Chakra', 'V8', 'SpiderMonkey', 'Jurassic'];"; @@ -40,7 +40,7 @@ public virtual void ArrayEveryMethodIsSupported() } [Fact] - public virtual void ArrayFilterMethodIsSupported() + public virtual void SupportsArrayFilterMethod() { // Arrange const string initCode = "var engines = ['Chakra', 'V8', 'SpiderMonkey', 'Jurassic'];"; @@ -66,7 +66,7 @@ public virtual void ArrayFilterMethodIsSupported() } [Fact] - public virtual void ArrayForEachMethodIsSupported() + public virtual void SupportsArrayForEachMethod() { // Arrange const string resultVariableName = "enginesString"; @@ -96,7 +96,7 @@ public virtual void ArrayForEachMethodIsSupported() } [Fact] - public virtual void ArrayIndexOfMethodIsSupported() + public virtual void SupportsArrayIndexOfMethod() { // Arrange const string initCode = "var arr = [2, 5, 9, 2]"; @@ -155,7 +155,7 @@ public virtual void ArrayIndexOfMethodIsSupported() } [Fact] - public virtual void ArrayIsArrayMethodIsSupported() + public virtual void SupportsArrayIsArrayMethod() { // Arrange const string input1 = "Array.isArray({ length: 0 });"; @@ -180,7 +180,7 @@ public virtual void ArrayIsArrayMethodIsSupported() } [Fact] - public virtual void ArrayLastIndexOfMethodIsSupported() + public virtual void SupportsArrayLastIndexOfMethod() { // Arrange const string initCode = "var arr = [2, 5, 9, 2]"; @@ -239,7 +239,7 @@ public virtual void ArrayLastIndexOfMethodIsSupported() } [Fact] - public virtual void ArrayMapMethodIsSupported() + public virtual void SupportsArrayMapMethod() { // Arrange const string initCode = "var engines = ['Chakra', 'V8', 'SpiderMonkey', 'Jurassic'];"; @@ -265,7 +265,7 @@ public virtual void ArrayMapMethodIsSupported() } [Fact] - public virtual void ArrayReduceMethodIsSupported() + public virtual void SupportsArrayReduceMethod() { // Arrange const string input1 = @"[1, 2, 3, 4, 5].reduce(function (accum, value, index, array) { @@ -294,7 +294,7 @@ public virtual void ArrayReduceMethodIsSupported() } [Fact] - public virtual void ArrayReduceRightMethodIsSupported() + public virtual void SupportsArrayReduceRightMethod() { // Arrange const string input1 = @"[1, 2, 3, 4, 5].reduceRight(function (accum, value, index, array) { @@ -323,7 +323,7 @@ public virtual void ArrayReduceRightMethodIsSupported() } [Fact] - public virtual void ArraySomeMethodIsSupported() + public virtual void SupportsArraySomeMethod() { // Arrange const string initCode = "var engines = ['Chakra', 'V8', 'SpiderMonkey', 'Jurassic'];"; @@ -349,17 +349,18 @@ public virtual void ArraySomeMethodIsSupported() #region Date methods [Fact] - public virtual void DateNowMethodIsSupported() + public virtual void SupportsDateNowMethod() { // Arrange const string input = "Date.now();"; - DateTime targetOutput = DateTime.Now.ToUniversalTime(); + DateTime targetOutput; // Act DateTime output; using (var jsEngine = CreateJsEngine()) { + targetOutput = DateTime.Now.ToUniversalTime(); output = new DateTime(1970, 01, 01).AddMilliseconds(jsEngine.Evaluate(input)); } @@ -368,7 +369,7 @@ public virtual void DateNowMethodIsSupported() } [Fact] - public virtual void DateToIsoStringMethodIsSupported() + public virtual void SupportsDateToIsoStringMethod() { // Arrange const string input = @"(new Date(1386696984000)).toISOString();"; @@ -391,21 +392,28 @@ public virtual void DateToIsoStringMethodIsSupported() #region Function methods [Fact] - public virtual void FunctionBindIsSupported() + public virtual void SupportsFunctionBindMethod() { // Arrange - const string initCode = @"var a = 5, - module = { - a: 12, - getA: function() { return this.a; } - }, - getA = module.getA + const string initCode = @"var A = (function () { + function A(a) { + this.a = a; + } + + A.prototype.getA = function() { + return this.a; + }; + + return A; + })(), + a = new A(5), + otherContext = { a: 12 } ;"; - const string input1 = "getA();"; + const string input1 = "a.getA();"; const int targetOutput1 = 5; - const string input2 = "getA.bind(module)();"; + const string input2 = "a.getA.bind(otherContext)();"; const int targetOutput2 = 12; // Act @@ -430,7 +438,7 @@ public virtual void FunctionBindIsSupported() #region JSON methods [Fact] - public virtual void JsonParseMethodIsSupported() + public virtual void SupportsJsonParseMethod() { // Arrange const string initCode = "var obj = JSON.parse('{ \"foo\": \"bar\" }');"; @@ -451,7 +459,7 @@ public virtual void JsonParseMethodIsSupported() } [Fact] - public virtual void JsonStringifyMethodIsSupported() + public virtual void SupportsJsonStringifyMethod() { // Arrange const string initCode = @"var obj = new Object(); @@ -477,7 +485,7 @@ public virtual void JsonStringifyMethodIsSupported() #region Object methods [Fact] - public virtual void ObjectCreateMethodIsSupported() + public virtual void SupportsObjectCreateMethod() { // Arrange const string initCode1 = "var obj1 = Object.create(null);"; @@ -532,7 +540,7 @@ public virtual void ObjectCreateMethodIsSupported() } [Fact] - public virtual void ObjectKeysMethodIsSupported() + public virtual void SupportsObjectKeysMethod() { // Arrange const string input1 = "Object.keys(['a', 'b', 'c']).toString();"; @@ -579,7 +587,7 @@ public virtual void ObjectKeysMethodIsSupported() #region String methods [Fact] - public virtual void StringSplitMethodIsCorrect() + public virtual void SupportsStringSplitMethod() { // Arrange const string input1 = "'aaaa'.split(/a/).length;"; @@ -610,7 +618,7 @@ public virtual void StringSplitMethodIsCorrect() } [Fact] - public virtual void StringTrimMethodIsSupported() + public virtual void SupportsStringTrimMethod() { // Arrange const string input = "' foo '.trim();"; diff --git a/test/JavaScriptEngineSwitcher.Tests/EvalTestsBase.cs b/test/JavaScriptEngineSwitcher.Tests/EvalTestsBase.cs new file mode 100644 index 00000000..42f85428 --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/EvalTestsBase.cs @@ -0,0 +1,47 @@ +using Xunit; + +using JavaScriptEngineSwitcher.Core; + +namespace JavaScriptEngineSwitcher.Tests +{ + public abstract class EvalTestsBase : TestsBase + { + [Fact] + public virtual void UsageOfEvalFunction() + { + // Arrange + const string input = "eval('2*2');"; + const int targetOutput = 4; + + // Act + int output; + + using (var jsEngine = CreateJsEngine()) + { + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + + [Fact] + public virtual void UsageOfFunctionConstructor() + { + // Arrange + const string input = "new Function('return 2*2;')();"; + const int targetOutput = 4; + + // Act + int output; + + using (var jsEngine = CreateJsEngine()) + { + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Interop/BundleTable.cs b/test/JavaScriptEngineSwitcher.Tests/Interop/BundleTable.cs index 36673361..b9e477dd 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Interop/BundleTable.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Interop/BundleTable.cs @@ -4,6 +4,8 @@ public static class BundleTable { private static bool _enableOptimizations = true; + public static object SyncRoot = new object(); + public static bool EnableOptimizations { get diff --git a/test/JavaScriptEngineSwitcher.Tests/Interop/Logging/DefaultLogger.cs b/test/JavaScriptEngineSwitcher.Tests/Interop/Logging/DefaultLogger.cs index 18728c43..b4c8fdeb 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Interop/Logging/DefaultLogger.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Interop/Logging/DefaultLogger.cs @@ -2,6 +2,7 @@ { public class DefaultLogger { + public static object SyncRoot = new object(); public static ILogger Current = new NullLogger(); } } \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Interop/LoginFailedException.cs b/test/JavaScriptEngineSwitcher.Tests/Interop/LoginFailedException.cs new file mode 100644 index 00000000..a55ff7ba --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Interop/LoginFailedException.cs @@ -0,0 +1,56 @@ +using System; +using System.Runtime.Serialization; + +namespace JavaScriptEngineSwitcher.Tests.Interop +{ + [Serializable] + public class LoginFailedException : Exception + { + private string _userName; + + public string UserName + { + get { return _userName; } + set { _userName = value; } + } + + + public LoginFailedException() + { } + + public LoginFailedException(string message) + : base(message) + { } + + public LoginFailedException(string message, Exception innerException) + : base(message, innerException) + { } + +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif + protected LoginFailedException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + if (info != null) + { + _userName = info.GetString("UserName"); + } + } + + +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + if (info == null) + { + throw new ArgumentNullException(nameof(info)); + } + + base.GetObjectData(info, context); + info.AddValue("UserName", this._userName); + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/InteropTestsBase.cs b/test/JavaScriptEngineSwitcher.Tests/InteropTestsBase.cs index ada96ff0..978533a6 100644 --- a/test/JavaScriptEngineSwitcher.Tests/InteropTestsBase.cs +++ b/test/JavaScriptEngineSwitcher.Tests/InteropTestsBase.cs @@ -3,6 +3,7 @@ using System.Drawing; using System.IO; using System.Linq; +using System.Reflection; using System.Text; using Xunit; @@ -22,7 +23,7 @@ public abstract class InteropTestsBase : TestsBase #region Objects with fields [Fact] - public virtual void EmbeddingOfInstanceOfCustomValueTypeWithFieldsIsCorrect() + public virtual void EmbeddingOfInstanceOfCustomValueTypeWithFields() { // Arrange var date = new Date(2015, 12, 29); @@ -59,7 +60,7 @@ public virtual void EmbeddingOfInstanceOfCustomValueTypeWithFieldsIsCorrect() } [Fact] - public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithFieldsIsCorrect() + public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithFields() { // Arrange var product = new Product @@ -101,7 +102,7 @@ public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithFieldsIsCorrect( #region Objects with properties [Fact] - public virtual void EmbeddingOfInstanceOfBuiltinValueTypeWithPropertiesIsCorrect() + public virtual void EmbeddingOfInstanceOfBuiltinValueTypeWithProperties() { // Arrange var timeSpan = new TimeSpan(4840780000000); @@ -142,7 +143,7 @@ public virtual void EmbeddingOfInstanceOfBuiltinValueTypeWithPropertiesIsCorrect } [Fact] - public virtual void EmbeddingOfInstanceOfBuiltinReferenceTypeWithPropertiesIsCorrect() + public virtual void EmbeddingOfInstanceOfBuiltinReferenceTypeWithProperties() { // Arrange var uri = new Uri("https://github.com/Taritsyn/MsieJavaScriptEngine"); @@ -177,7 +178,7 @@ public virtual void EmbeddingOfInstanceOfBuiltinReferenceTypeWithPropertiesIsCor } [Fact] - public virtual void EmbeddingOfInstanceOfCustomValueTypeWithPropertiesIsCorrect() + public virtual void EmbeddingOfInstanceOfCustomValueTypeWithProperties() { // Arrange var temperature = new Temperature(-17.3, TemperatureUnits.Celsius); @@ -212,7 +213,7 @@ public virtual void EmbeddingOfInstanceOfCustomValueTypeWithPropertiesIsCorrect( } [Fact] - public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithPropertiesIsCorrect() + public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithProperties() { // Arrange var person = new Person("Vanya", "Ivanov"); @@ -244,7 +245,7 @@ public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithPropertiesIsCorr } [Fact] - public virtual void EmbeddingOfInstanceOfAnonymousTypeWithPropertiesIsCorrect() + public virtual void EmbeddingOfInstanceOfAnonymousTypeWithProperties() { // Arrange var person = new @@ -312,7 +313,7 @@ public virtual void EmbeddingOfInstanceOfAnonymousTypeWithPropertiesIsCorrect() #region Objects with methods [Fact] - public virtual void EmbeddingOfInstanceOfBuiltinValueTypeWithMethodsIsCorrect() + public virtual void EmbeddingOfInstanceOfBuiltinValueTypeWithMethods() { // Arrange var color = Color.FromArgb(84, 139, 212); @@ -347,7 +348,7 @@ public virtual void EmbeddingOfInstanceOfBuiltinValueTypeWithMethodsIsCorrect() } [Fact] - public virtual void EmbeddingOfInstanceOfBuiltinReferenceTypeWithMethodIsCorrect() + public virtual void EmbeddingOfInstanceOfBuiltinReferenceTypeWithMethod() { // Arrange var random = new Random(); @@ -369,7 +370,7 @@ public virtual void EmbeddingOfInstanceOfBuiltinReferenceTypeWithMethodIsCorrect } [Fact] - public virtual void EmbeddingOfInstanceOfCustomValueTypeWithMethodsIsCorrect() + public virtual void EmbeddingOfInstanceOfCustomValueTypeWithMethods() { // Arrange var programmerDayDate = new Date(2015, 9, 13); @@ -398,7 +399,7 @@ public virtual void EmbeddingOfInstanceOfCustomValueTypeWithMethodsIsCorrect() } [Fact] - public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithMethodIsCorrect() + public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithMethod() { // Arrange var fileManager = new FileManager(); @@ -421,7 +422,7 @@ public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithMethodIsCorrect( } [Fact] - public virtual void CallingOfMethodOfCustomReferenceTypeWithInterfaceParameterIsCorrect() + public virtual void EmbeddingOfInstancesOfCustomReferenceTypesAndCallingOfMethodOfWithInterfaceParameter() { // Arrange var animalTrainer = new AnimalTrainer(); @@ -452,12 +453,79 @@ public virtual void CallingOfMethodOfCustomReferenceTypeWithInterfaceParameterIs Assert.Equal(targetOutput2, output2); } + [Fact] + public virtual void EmbeddingOfInstanceOfCustomValueTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + var date = new Date(); + + const string input = "date.GetType();"; + string targetOutput = typeof(Date).FullName; + + // Act + string output; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostObject("date", date); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + + [Fact] + public virtual void EmbeddingOfInstanceOfCustomReferenceTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + var cat = new Cat(); + + const string input = "cat.GetType();"; + string targetOutput = typeof(Cat).FullName; + + // Act + string output; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostObject("cat", cat); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + + [Fact] + public virtual void EmbeddingOfInstanceOfAssemblyTypeAndCallingOfItsCreateInstanceMethod() + { + // Arrange + Assembly assembly = this.GetType().Assembly; + string personTypeName = typeof(Person).FullName; + + string input = string.Format("assembly.CreateInstance(\"{0}\");", personTypeName); + const string targetOutput = "{FirstName=,LastName=}"; + + // Act + string output; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostObject("assembly", assembly); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + #endregion #region Delegates [Fact] - public virtual void EmbeddingOfInstanceOfDelegateWithoutParametersIsCorrect() + public virtual void EmbeddingOfInstanceOfDelegateWithoutParameters() { // Arrange var generateRandomStringFunc = new Func(() => @@ -496,7 +564,7 @@ public virtual void EmbeddingOfInstanceOfDelegateWithoutParametersIsCorrect() } [Fact] - public virtual void EmbeddingOfInstanceOfDelegateWithOneParameterIsCorrect() + public virtual void EmbeddingOfInstanceOfDelegateWithOneParameter() { // Arrange var squareFunc = new Func(a => a * a); @@ -518,7 +586,7 @@ public virtual void EmbeddingOfInstanceOfDelegateWithOneParameterIsCorrect() } [Fact] - public virtual void EmbeddingOfInstanceOfDelegateWithTwoParametersIsCorrect() + public virtual void EmbeddingOfInstanceOfDelegateWithTwoParameters() { // Arrange var sumFunc = new Func((a, b) => a + b); @@ -540,7 +608,7 @@ public virtual void EmbeddingOfInstanceOfDelegateWithTwoParametersIsCorrect() } [Fact] - public virtual void EmbeddingOfInstanceOfDelegateWithoutResultIsCorrect() + public virtual void EmbeddingOfInstanceOfDelegateWithoutResult() { // Arrange var logBuilder = new StringBuilder(); @@ -586,7 +654,7 @@ public virtual void EmbeddingOfInstanceOfDelegateWithoutResultIsCorrect() } [Fact] - public virtual void EmbeddedInstanceOfDelegateHasFunctionPrototype() + public virtual void EmbeddingOfInstanceOfDelegateAndCheckingItsPrototype() { // Arrange var someFunc = new Func(() => 42); @@ -607,7 +675,7 @@ public virtual void EmbeddedInstanceOfDelegateHasFunctionPrototype() } [Fact] - public virtual void CallingOfEmbeddedDelegateWithMissingParameter() + public virtual void EmbeddingOfInstanceOfDelegateAndCallingItWithMissingParameter() { // Arrange var sumFunc = new Func((a, b) => a + b); @@ -635,7 +703,7 @@ public virtual void CallingOfEmbeddedDelegateWithMissingParameter() } [Fact] - public virtual void CallingOfEmbeddedDelegateWithExtraParameter() + public virtual void EmbeddingOfInstanceOfDelegateAndCallingItWithExtraParameter() { // Arrange var sumFunc = new Func((a, b) => a + b); @@ -656,12 +724,35 @@ public virtual void CallingOfEmbeddedDelegateWithExtraParameter() Assert.Equal(targetOutput, output); } + [Fact] + public virtual void EmbeddingOfInstanceOfDelegateAndGettingItsMethodProperty() + { + // Arrange + var cat = new Cat(); + var cryFunc = new Func(cat.Cry); + + const string input = "cry.Method;"; + string targetOutput = "undefined"; + + // Act + string output; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostObject("cry", cryFunc); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + #endregion #region Recursive calls [Fact] - public virtual void RecursiveEvaluationOfFilesIsCorrect() + public virtual void RecursiveEvaluationOfFiles() { // Arrange const string directoryPath = "Files/recursive-evaluation/no-error"; @@ -690,7 +781,7 @@ public virtual void RecursiveEvaluationOfFilesIsCorrect() } [Fact] - public virtual void RecursiveExecutionOfFilesIsCorrect() + public virtual void RecursiveExecutionOfFiles() { // Arrange const string directoryPath = "Files/recursive-execution/no-error"; @@ -720,7 +811,7 @@ public virtual void RecursiveExecutionOfFilesIsCorrect() #region Removal [Fact] - public virtual void RemovingOfEmbeddedInstanceOfCustomReferenceTypeIsCorrect() + public virtual void RemovingOfEmbeddedInstanceOfCustomReferenceType() { // Arrange var person = new Person("Vasya", "Pupkin"); @@ -756,7 +847,7 @@ public virtual void RemovingOfEmbeddedInstanceOfCustomReferenceTypeIsCorrect() #region Creating of instances [Fact] - public virtual void CreatingAnInstanceOfEmbeddedBuiltinValueTypeIsCorrect() + public virtual void CreatingAnInstanceOfEmbeddedBuiltinValueType() { // Arrange Type pointType = typeof(Point); @@ -778,7 +869,7 @@ public virtual void CreatingAnInstanceOfEmbeddedBuiltinValueTypeIsCorrect() } [Fact] - public virtual void CreatingAnInstanceOfEmbeddedBuiltinReferenceTypeIsCorrect() + public virtual void CreatingAnInstanceOfEmbeddedBuiltinReferenceType() { // Arrange Type uriType = typeof(Uri); @@ -804,7 +895,7 @@ public virtual void CreatingAnInstanceOfEmbeddedBuiltinReferenceTypeIsCorrect() } [Fact] - public virtual void CreatingAnInstanceOfEmbeddedCustomValueTypeIsCorrect() + public virtual void CreatingAnInstanceOfEmbeddedCustomValueType() { // Arrange Type point3DType = typeof(Point3D); @@ -826,7 +917,7 @@ public virtual void CreatingAnInstanceOfEmbeddedCustomValueTypeIsCorrect() } [Fact] - public virtual void CreatingAnInstanceOfEmbeddedCustomReferenceTypeIsCorrect() + public virtual void CreatingAnInstanceOfEmbeddedCustomReferenceType() { // Arrange Type personType = typeof(Person); @@ -847,12 +938,55 @@ public virtual void CreatingAnInstanceOfEmbeddedCustomReferenceTypeIsCorrect() Assert.Equal(targetOutput, output); } + [Fact] + public virtual void CreatingAnInstanceOfEmbeddedBuiltinExceptionAndGettingItsTargetSiteProperty() + { + // Arrange + Type invalidOperationExceptionType = typeof(InvalidOperationException); + + const string input = "new InvalidOperationError(\"A terrible thing happened!\").TargetSite;"; + + // Act + string output; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostType("InvalidOperationError", invalidOperationExceptionType); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Null(output); + } + + [Fact] + public virtual void CreatingAnInstanceOfEmbeddedCustomExceptionAndCallingOfItsGetTypeMethod() + { + // Arrange + Type loginFailedExceptionType = typeof(LoginFailedException); + + const string input = "new LoginFailedError(\"Wrong password entered!\").GetType();"; + string targetOutput = loginFailedExceptionType.FullName; + + // Act + string output; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostType("LoginFailedError", loginFailedExceptionType); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + #endregion #region Types with constants [Fact] - public virtual void EmbeddingOfBuiltinReferenceTypeWithConstantsIsCorrect() + public virtual void EmbeddingOfBuiltinReferenceTypeWithConstants() { // Arrange Type mathType = typeof(Math); @@ -881,7 +1015,7 @@ public virtual void EmbeddingOfBuiltinReferenceTypeWithConstantsIsCorrect() } [Fact] - public virtual void EmbeddingOfCustomValueTypeWithConstantsIsCorrect() + public virtual void EmbeddingOfCustomValueTypeWithConstants() { // Arrange Type predefinedStringsType = typeof(PredefinedStrings); @@ -916,7 +1050,7 @@ public virtual void EmbeddingOfCustomValueTypeWithConstantsIsCorrect() } [Fact] - public virtual void EmbeddingOfCustomReferenceTypeWithConstantIsCorrect() + public virtual void EmbeddingOfCustomReferenceTypeWithConstant() { // Arrange Type base64EncoderType = typeof(Base64Encoder); @@ -942,7 +1076,7 @@ public virtual void EmbeddingOfCustomReferenceTypeWithConstantIsCorrect() #region Types with fields [Fact] - public virtual void EmbeddingOfBuiltinValueTypeWithFieldIsCorrect() + public virtual void EmbeddingOfBuiltinValueTypeWithField() { // Arrange Type guidType = typeof(Guid); @@ -964,7 +1098,7 @@ public virtual void EmbeddingOfBuiltinValueTypeWithFieldIsCorrect() } [Fact] - public virtual void EmbeddingOfBuiltinReferenceTypeWithFieldIsCorrect() + public virtual void EmbeddingOfBuiltinReferenceTypeWithField() { // Arrange Type bitConverterType = typeof(BitConverter); @@ -986,7 +1120,7 @@ public virtual void EmbeddingOfBuiltinReferenceTypeWithFieldIsCorrect() } [Fact] - public virtual void EmbeddingOfCustomValueTypeWithFieldIsCorrect() + public virtual void EmbeddingOfCustomValueTypeWithField() { // Arrange Type point3DType = typeof(Point3D); @@ -1008,12 +1142,14 @@ public virtual void EmbeddingOfCustomValueTypeWithFieldIsCorrect() } [Fact] - public virtual void EmbeddingOfCustomReferenceTypeWithFieldIsCorrect() + public virtual void EmbeddingOfCustomReferenceTypeWithField() { // Arrange Type defaultLoggerType = typeof(DefaultLogger); Type throwExceptionLoggerType = typeof(ThrowExceptionLogger); - const string updateCode = "DefaultLogger.Current = new ThrowExceptionLogger();"; + const string updateCode = @"var oldLogger = DefaultLogger.Current; +DefaultLogger.Current = new ThrowExceptionLogger();"; + const string rollbackCode = "DefaultLogger.Current = oldLogger;"; const string input = "DefaultLogger.Current.ToString()"; const string targetOutput = "[throw exception logger]"; @@ -1025,9 +1161,13 @@ public virtual void EmbeddingOfCustomReferenceTypeWithFieldIsCorrect() { jsEngine.EmbedHostType("DefaultLogger", defaultLoggerType); jsEngine.EmbedHostType("ThrowExceptionLogger", throwExceptionLoggerType); - jsEngine.Execute(updateCode); - output = jsEngine.Evaluate(input); + lock (DefaultLogger.SyncRoot) + { + jsEngine.Execute(updateCode); + output = jsEngine.Evaluate(input); + jsEngine.Execute(rollbackCode); + } } // Assert @@ -1039,7 +1179,7 @@ public virtual void EmbeddingOfCustomReferenceTypeWithFieldIsCorrect() #region Types with properties [Fact] - public virtual void EmbeddingOfBuiltinValueTypeWithPropertyIsCorrect() + public virtual void EmbeddingOfBuiltinValueTypeWithProperty() { // Arrange Type colorType = typeof(Color); @@ -1061,7 +1201,7 @@ public virtual void EmbeddingOfBuiltinValueTypeWithPropertyIsCorrect() } [Fact] - public virtual void EmbeddingOfBuiltinReferenceTypeWithPropertyIsCorrect() + public virtual void EmbeddingOfBuiltinReferenceTypeWithProperty() { // Arrange Type environmentType = typeof(Environment); @@ -1083,7 +1223,7 @@ public virtual void EmbeddingOfBuiltinReferenceTypeWithPropertyIsCorrect() } [Fact] - public virtual void EmbeddingOfCustomValueTypeWithPropertyIsCorrect() + public virtual void EmbeddingOfCustomValueTypeWithProperty() { // Arrange Type dateType = typeof(Date); @@ -1116,11 +1256,13 @@ public virtual void EmbeddingOfCustomValueTypeWithPropertyIsCorrect() } [Fact] - public virtual void EmbeddingOfCustomReferenceTypeWithPropertyIsCorrect() + public virtual void EmbeddingOfCustomReferenceTypeWithProperty() { // Arrange Type bundleTableType = typeof(BundleTable); - const string updateCode = "BundleTable.EnableOptimizations = false;"; + const string updateCode = @"var oldEnableOptimizationsValue = BundleTable.EnableOptimizations; +BundleTable.EnableOptimizations = false;"; + const string rollbackCode = "BundleTable.EnableOptimizations = oldEnableOptimizationsValue;"; const string input = "BundleTable.EnableOptimizations"; const bool targetOutput = false; @@ -1131,9 +1273,13 @@ public virtual void EmbeddingOfCustomReferenceTypeWithPropertyIsCorrect() using (var jsEngine = CreateJsEngine()) { jsEngine.EmbedHostType("BundleTable", bundleTableType); - jsEngine.Execute(updateCode); - output = jsEngine.Evaluate(input); + lock (BundleTable.SyncRoot) + { + jsEngine.Execute(updateCode); + output = jsEngine.Evaluate(input); + jsEngine.Execute(rollbackCode); + } } // Assert @@ -1145,7 +1291,7 @@ public virtual void EmbeddingOfCustomReferenceTypeWithPropertyIsCorrect() #region Types with methods [Fact] - public virtual void EmbeddingOfBuiltinValueTypeWithMethodIsCorrect() + public virtual void EmbeddingOfBuiltinValueTypeWithMethod() { // Arrange Type dateTimeType = typeof(DateTime); @@ -1167,7 +1313,7 @@ public virtual void EmbeddingOfBuiltinValueTypeWithMethodIsCorrect() } [Fact] - public virtual void EmbeddingOfBuiltinReferenceTypeWithMethodsIsCorrect() + public virtual void EmbeddingOfBuiltinReferenceTypeWithMethods() { // Arrange Type mathType = typeof(Math); @@ -1195,7 +1341,7 @@ public virtual void EmbeddingOfBuiltinReferenceTypeWithMethodsIsCorrect() } [Fact] - public virtual void EmbeddingOfCustomValueTypeWithMethodIsCorrect() + public virtual void EmbeddingOfCustomValueTypeWithMethod() { // Arrange var dateType = typeof(Date); @@ -1217,7 +1363,7 @@ public virtual void EmbeddingOfCustomValueTypeWithMethodIsCorrect() } [Fact] - public virtual void EmbeddingOfCustomReferenceTypeWithMethodIsCorrect() + public virtual void EmbeddingOfCustomReferenceTypeWithMethod() { // Arrange Type base64EncoderType = typeof(Base64Encoder); @@ -1238,12 +1384,58 @@ public virtual void EmbeddingOfCustomReferenceTypeWithMethodIsCorrect() Assert.Equal(targetOutput, output); } + [Fact] + public virtual void EmbeddingOfTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + Type type = typeof(Type); + string dateTimeTypeName = typeof(DateTime).FullName; + + string input = string.Format("Type.GetType(\"{0}\");", dateTimeTypeName); + string targetOutput = dateTimeTypeName; + + // Act + string output; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostType("Type", type); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + + [Fact] + public virtual void EmbeddingOfAssemblyTypeAndCallingOfItsLoadMethod() + { + // Arrange + Type assemblyType = typeof(Assembly); + const string reflectionEmitAssemblyName = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; + + string input = string.Format("Assembly.Load(\"{0}\");", reflectionEmitAssemblyName); + const string targetOutput = reflectionEmitAssemblyName; + + // Act + string output; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostType("Assembly", assemblyType); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + #endregion #region Removal [Fact] - public virtual void RemovingOfEmbeddedCustomReferenceTypeIsCorrect() + public virtual void RemovingOfEmbeddedCustomReferenceType() { // Arrange Type personType = typeof(Person); diff --git a/test/JavaScriptEngineSwitcher.Tests/IntlTestsBase.cs b/test/JavaScriptEngineSwitcher.Tests/IntlTestsBase.cs index c9eefe68..6744fd43 100644 --- a/test/JavaScriptEngineSwitcher.Tests/IntlTestsBase.cs +++ b/test/JavaScriptEngineSwitcher.Tests/IntlTestsBase.cs @@ -5,7 +5,7 @@ namespace JavaScriptEngineSwitcher.Tests public abstract class IntlTestsBase : TestsBase { [Fact] - public virtual void DateTimeFormatConstructorIsSupported() + public virtual void SupportsDateTimeFormatConstructor() { // Arrange const string functionCode = @"function formatDate(value, locale) { diff --git a/test/JavaScriptEngineSwitcher.Tests/JavaScriptEngineSwitcher.Tests.csproj b/test/JavaScriptEngineSwitcher.Tests/JavaScriptEngineSwitcher.Tests.csproj index e4c501db..3cc5b571 100644 --- a/test/JavaScriptEngineSwitcher.Tests/JavaScriptEngineSwitcher.Tests.csproj +++ b/test/JavaScriptEngineSwitcher.Tests/JavaScriptEngineSwitcher.Tests.csproj @@ -2,78 +2,63 @@ JS Engine Switcher: Tests - 3.19.0 - net452;net471;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0 + 3.30.2 + net462;net471;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0 Library + latest true + true + true + false + true false - - - - - - - + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - + + - - - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + diff --git a/test/JavaScriptEngineSwitcher.Tests/Jint/CommonTests.cs b/test/JavaScriptEngineSwitcher.Tests/Jint/CommonTests.cs index c53387d3..b16e9260 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Jint/CommonTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Jint/CommonTests.cs @@ -1,5 +1,4 @@ -#if !NET452 -using System; +using System; using Xunit; @@ -21,7 +20,7 @@ protected override string EngineName #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingCompilationErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -48,7 +47,7 @@ public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() // Assert Assert.NotNull(exception); Assert.Equal("Compilation error", exception.Category); - Assert.Equal("Unexpected token @", exception.Description); + Assert.Equal("Invalid or unexpected token", exception.Description); Assert.Equal("SyntaxError", exception.Type); Assert.Equal("variables.js", exception.DocumentName); Assert.Equal(3, exception.LineNumber); @@ -57,7 +56,7 @@ public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingRuntimeErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -88,13 +87,13 @@ public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() Assert.Equal("ReferenceError", exception.Type); Assert.Equal("variables.js", exception.DocumentName); Assert.Equal(5, exception.LineNumber); - Assert.Equal(1, exception.ColumnNumber); + Assert.Equal(15, exception.ColumnNumber); Assert.Empty(exception.SourceFragment); Assert.Equal(" at Global code (variables.js:5:15)", exception.CallStack); } [Fact] - public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() + public void MappingCompilationErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -127,7 +126,7 @@ public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() // Assert Assert.NotNull(exception); Assert.Equal("Compilation error", exception.Category); - Assert.Equal("Unexpected token )", exception.Description); + Assert.Equal("Unexpected token ')'", exception.Description); Assert.Equal("SyntaxError", exception.Type); Assert.Equal("factorial.js", exception.DocumentName); Assert.Equal(10, exception.LineNumber); @@ -136,7 +135,7 @@ public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -183,7 +182,7 @@ public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringOutOfMemoryIsCorrect() + public void MappingRuntimeErrorDuringOutOfMemory() { // Arrange const string input = @"var arr = []; @@ -219,7 +218,7 @@ public void MappingRuntimeErrorDuringOutOfMemoryIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringArraySizeExceededIsCorrect() + public void MappingRuntimeErrorDuringArraySizeExceeded() { // Arrange const string input = @"var arr = new Array(1000000000);"; @@ -251,7 +250,59 @@ public void MappingRuntimeErrorDuringArraySizeExceededIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringRecursionDepthOverflowIsCorrect() + public void MappingCompilationErrorDuringMaxJsonParseDepthReached() + { + // Arrange + const string input = @"var data = '{\n' + + ' ""menu"": {\n' + + ' ""id"": ""file"",\n' + + ' ""value"": ""File"",\n' + + ' ""popup"": {\n' + + ' ""menuItem"": [\n' + + ' { ""value"": ""New"", ""onclick"": ""CreateNewDoc()"" },\n' + + ' { ""value"": ""Open"", ""onclick"": ""OpenDoc()"" },\n' + + ' { ""value"": ""Close"", ""onclick"": ""CloseDoc()"" }\n' + + ' ]\n' + + ' }\n' + + ' }\n' + + '}' + ; + +JSON.parse(data);"; + + JsCompilationException exception = null; + + // Act + using (var jsEngine = new JintJsEngine( + new JintSettings + { + MaxJsonParseDepth = 4 + } + )) + { + try + { + jsEngine.Execute(input, "menu.js"); + } + catch (JsCompilationException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Compilation error", exception.Category); + Assert.Equal("Max. depth level of JSON reached at position 82", exception.Description); + Assert.Equal("SyntaxError", exception.Type); + Assert.Equal("menu.js", exception.DocumentName); + Assert.Equal(16, exception.LineNumber); + Assert.Equal(1, exception.ColumnNumber); + Assert.Empty(exception.SourceFragment); + } + + [Fact] + public void MappingRuntimeErrorDuringRecursionDepthOverflow() { // Arrange const string input = @"function fibonacci(n) { @@ -314,7 +365,7 @@ public void MappingRuntimeErrorDuringRecursionDepthOverflowIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringStatementsCountOverflowIsCorrect() + public void MappingRuntimeErrorDuringStatementsCountOverflow() { // Arrange const string input = @"while (true);"; @@ -352,7 +403,7 @@ public void MappingRuntimeErrorDuringStatementsCountOverflowIsCorrect() } [Fact] - public void MappingTimeoutErrorDuringExecutionOfCodeIsCorrect() + public void MappingTimeoutErrorDuringExecutionOfCode() { // Arrange const string input = @"while (true);"; @@ -390,7 +441,7 @@ public void MappingTimeoutErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingTimeoutErrorDuringRegexHangingIsCorrect() + public void MappingTimeoutErrorDuringRegexHanging() { // Arrange const string input = @"var regexp = /^(\w+\s?)*$/, @@ -437,13 +488,13 @@ public void MappingTimeoutErrorDuringRegexHangingIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"var arr = []; var obj = {}; var foo = 'Browser's bar';"; - string targetOutput = "SyntaxError: Unexpected identifier" + Environment.NewLine + + string targetOutput = "SyntaxError: Unexpected identifier 's'" + Environment.NewLine + " at variables.js:3:20" ; @@ -467,7 +518,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function foo(x, y) { @@ -512,5 +563,4 @@ public void GenerationOfRuntimeErrorMessageIsCorrect() #endregion } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Jint/Es2015Tests.cs b/test/JavaScriptEngineSwitcher.Tests/Jint/Es2015Tests.cs index 34bb4612..89acb932 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Jint/Es2015Tests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Jint/Es2015Tests.cs @@ -1,5 +1,4 @@ -#if !NET452 -namespace JavaScriptEngineSwitcher.Tests.Jint +namespace JavaScriptEngineSwitcher.Tests.Jint { public class Es2015Tests : Es2015TestsBase { @@ -8,5 +7,4 @@ protected override string EngineName get { return "JintJsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Jint/Es5Tests.cs b/test/JavaScriptEngineSwitcher.Tests/Jint/Es5Tests.cs index c3b552bc..350699ff 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Jint/Es5Tests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Jint/Es5Tests.cs @@ -1,5 +1,4 @@ -#if !NET452 -using Xunit; +using Xunit; namespace JavaScriptEngineSwitcher.Tests.Jint { @@ -10,5 +9,4 @@ protected override string EngineName get { return "JintJsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Jint/EvalTests.cs b/test/JavaScriptEngineSwitcher.Tests/Jint/EvalTests.cs new file mode 100644 index 00000000..e8868575 --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Jint/EvalTests.cs @@ -0,0 +1,65 @@ +using Xunit; + +using JavaScriptEngineSwitcher.Core; +using JavaScriptEngineSwitcher.Jint; + +namespace JavaScriptEngineSwitcher.Tests.Jint +{ + public class EvalTests : EvalTestsBase + { + protected override string EngineName + { + get { return "JintJsEngine"; } + } + + + private IJsEngine CreateJsEngine(bool disableEval) + { + var jsEngine = new JintJsEngine(new JintSettings + { + DisableEval = disableEval + }); + + return jsEngine; + } + + + public override void UsageOfEvalFunction() + { + // Arrange + int TestDisableEvalSetting(bool disableEval) + { + using (var jsEngine = CreateJsEngine(disableEval: disableEval)) + { + return jsEngine.Evaluate("eval('2*2');"); + } + } + + // Act and Assert + Assert.Equal(4, TestDisableEvalSetting(false)); + + JsRuntimeException exception = Assert.Throws(() => TestDisableEvalSetting(true)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("String compilation has been disabled in engine options", exception.Description); + } + + public override void UsageOfFunctionConstructor() + { + // Arrange + int TestDisableEvalSetting(bool disableEval) + { + using (var jsEngine = CreateJsEngine(disableEval: disableEval)) + { + return jsEngine.Evaluate("new Function('return 2*2;')();"); + } + } + + // Act and Assert + Assert.Equal(4, TestDisableEvalSetting(false)); + + JsRuntimeException exception = Assert.Throws(() => TestDisableEvalSetting(true)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("String compilation has been disabled in engine options", exception.Description); + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Jint/InteropTests.cs b/test/JavaScriptEngineSwitcher.Tests/Jint/InteropTests.cs index 7832d873..3e39ebb2 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Jint/InteropTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Jint/InteropTests.cs @@ -1,12 +1,14 @@ -#if !NET452 -using System; +using System; using System.IO; +using System.Reflection; using Xunit; using JavaScriptEngineSwitcher.Core; +using JavaScriptEngineSwitcher.Jint; using JavaScriptEngineSwitcher.Tests.Interop; +using JavaScriptEngineSwitcher.Tests.Interop.Animals; namespace JavaScriptEngineSwitcher.Tests.Jint { @@ -18,45 +20,85 @@ protected override string EngineName } + private IJsEngine CreateJsEngine(bool allowReflection) + { + var jsEngine = new JintJsEngine(new JintSettings + { + AllowReflection = allowReflection + }); + + return jsEngine; + } + #region Embedding of objects - #region Objects with fields + #region Objects with methods [Fact] - public override void EmbeddingOfInstanceOfCustomReferenceTypeWithFieldsIsCorrect() + public override void EmbeddingOfInstanceOfCustomValueTypeAndCallingOfItsGetTypeMethod() { // Arrange - var product = new Product + string TestAllowReflectionSetting(bool allowReflection) { - Name = "Red T-shirt", - Description = string.Empty, - Price = 995.00 - }; + var date = new Date(); - const string updateCode = "product.Price *= 1.15;"; + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("date", date); + return jsEngine.Evaluate("date.GetType();"); + } + } - const string input1 = "product.Name"; - const string targetOutput1 = "Red T-shirt"; + // Act and Assert + Assert.Equal(typeof(Date).FullName, TestAllowReflectionSetting(true)); - const string input2 = "product.Price"; - const double targetOutput2 = 1144.25; + var exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Property 'GetType' of object is not a function", exception.Description); + } - // Act - string output1; - double output2; + [Fact] + public override void EmbeddingOfInstanceOfCustomReferenceTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + var cat = new Cat(); - using (var jsEngine = CreateJsEngine()) + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("cat", cat); + return jsEngine.Evaluate("cat.GetType();"); + } + } + + // Act and Assert + Assert.Equal(typeof(Cat).FullName, TestAllowReflectionSetting(true)); + + var exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Property 'GetType' of object is not a function", exception.Description); + } + + [Fact] + public override void EmbeddingOfInstanceOfAssemblyTypeAndCallingOfItsCreateInstanceMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) { - jsEngine.EmbedHostObject("product", product); - jsEngine.Execute(updateCode); + Assembly assembly = this.GetType().Assembly; + string personTypeName = typeof(Person).FullName; - output1 = jsEngine.Evaluate(input1); - output2 = jsEngine.Evaluate(input2); + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("assembly", assembly); + return jsEngine.Evaluate("assembly.CreateInstance(\"" + personTypeName + "\");"); + } } - // Assert - Assert.Equal(targetOutput1, output1); - Assert.Equal(targetOutput2, output2); + // Act and Assert + Assert.Equal("{FirstName=,LastName=}", TestAllowReflectionSetting(true)); + Assert.Equal("{FirstName=,LastName=}", TestAllowReflectionSetting(false)); } #endregion @@ -64,7 +106,7 @@ public override void EmbeddingOfInstanceOfCustomReferenceTypeWithFieldsIsCorrect #region Delegates [Fact] - public override void CallingOfEmbeddedDelegateWithMissingParameter() + public override void EmbeddingOfInstanceOfDelegateAndCallingItWithMissingParameter() { // Arrange var sumFunc = new Func((a, b) => a + b); @@ -85,6 +127,27 @@ public override void CallingOfEmbeddedDelegateWithMissingParameter() Assert.Equal(targetOutput, output); } + [Fact] + public override void EmbeddingOfInstanceOfDelegateAndGettingItsMethodProperty() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + var cat = new Cat(); + var cryFunc = new Func(cat.Cry); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("cry", cryFunc); + return jsEngine.Evaluate("cry.Method;"); + } + } + + // Act and Assert + Assert.Equal("undefined", TestAllowReflectionSetting(true)); + Assert.Equal("undefined", TestAllowReflectionSetting(false)); + } + #endregion #region Recursive calls @@ -92,7 +155,7 @@ public override void CallingOfEmbeddedDelegateWithMissingParameter() #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringRecursiveEvaluationOfFilesIsCorrect() + public void MappingCompilationErrorDuringRecursiveEvaluationOfFiles() { // Arrange const string directoryPath = "Files/recursive-evaluation/compilation-error"; @@ -125,7 +188,7 @@ public void MappingCompilationErrorDuringRecursiveEvaluationOfFilesIsCorrect() // Assert Assert.NotNull(exception); Assert.Equal("Compilation error", exception.Category); - Assert.Equal("Unexpected token ,", exception.Description); + Assert.Equal("Unexpected token ','", exception.Description); Assert.Equal("SyntaxError", exception.Type); Assert.Equal("math.js", exception.DocumentName); Assert.Equal(25, exception.LineNumber); @@ -134,7 +197,7 @@ public void MappingCompilationErrorDuringRecursiveEvaluationOfFilesIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringRecursiveEvaluationOfFilesIsCorrect() + public void MappingRuntimeErrorDuringRecursiveEvaluationOfFiles() { // Arrange const string directoryPath = "Files/recursive-evaluation/runtime-error"; @@ -171,7 +234,7 @@ public void MappingRuntimeErrorDuringRecursiveEvaluationOfFilesIsCorrect() Assert.Equal("ReferenceError", exception.Type); Assert.Equal("math.js", exception.DocumentName); Assert.Equal(10, exception.LineNumber); - Assert.Equal(4, exception.ColumnNumber); + Assert.Equal(14, exception.ColumnNumber); Assert.Empty(exception.SourceFragment); Assert.Equal( " at sum (math.js:10:14)" + Environment.NewLine + @@ -182,7 +245,7 @@ public void MappingRuntimeErrorDuringRecursiveEvaluationOfFilesIsCorrect() } [Fact] - public void MappingHostErrorDuringRecursiveEvaluationOfFilesIsCorrect() + public void MappingHostErrorDuringRecursiveEvaluationOfFiles() { // Arrange const string directoryPath = "Files/recursive-evaluation/host-error"; @@ -217,8 +280,8 @@ public void MappingHostErrorDuringRecursiveEvaluationOfFilesIsCorrect() Assert.StartsWith("Could not find file '", exception.Message); } - /*[Fact] - public void MappingCompilationErrorDuringRecursiveExecutionOfFilesIsCorrect() + [Fact] + public void MappingCompilationErrorDuringRecursiveExecutionOfFiles() { // Arrange const string directoryPath = "Files/recursive-execution/compilation-error"; @@ -248,7 +311,7 @@ public void MappingCompilationErrorDuringRecursiveExecutionOfFilesIsCorrect() // Assert Assert.NotNull(exception); Assert.Equal("Compilation error", exception.Category); - Assert.Equal("Unexpected token ILLEGAL", exception.Description); + Assert.Equal("Invalid or unexpected token", exception.Description); Assert.Equal("SyntaxError", exception.Type); Assert.Equal("second-file.js", exception.DocumentName); Assert.Equal(1, exception.LineNumber); @@ -257,7 +320,7 @@ public void MappingCompilationErrorDuringRecursiveExecutionOfFilesIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringRecursiveExecutionOfFilesIsCorrect() + public void MappingRuntimeErrorDuringRecursiveExecutionOfFiles() { // Arrange const string directoryPath = "Files/recursive-execution/runtime-error"; @@ -302,7 +365,7 @@ public void MappingRuntimeErrorDuringRecursiveExecutionOfFilesIsCorrect() } [Fact] - public void MappingHostErrorDuringRecursiveExecutionOfFilesIsCorrect() + public void MappingHostErrorDuringRecursiveExecutionOfFiles() { // Arrange const string directoryPath = "Files/recursive-execution/host-error"; @@ -332,7 +395,7 @@ public void MappingHostErrorDuringRecursiveExecutionOfFilesIsCorrect() // Assert Assert.NotNull(exception); Assert.Equal("File '" + directoryPath + "/second-file.jsx' not exist.", exception.Message); - }*/ + } #endregion @@ -343,41 +406,109 @@ public void MappingHostErrorDuringRecursiveExecutionOfFilesIsCorrect() #region Embedding of types + #region Creating of instances + + [Fact] + public override void CreatingAnInstanceOfEmbeddedBuiltinExceptionAndGettingItsTargetSiteProperty() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + Type invalidOperationExceptionType = typeof(InvalidOperationException); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("InvalidOperationError", invalidOperationExceptionType); + return jsEngine.Evaluate("new InvalidOperationError(\"A terrible thing happened!\").TargetSite;"); + } + } + + // Act and Assert + Assert.Null(TestAllowReflectionSetting(true)); +#if NETFRAMEWORK + Assert.Null(TestAllowReflectionSetting(false)); +#else + Assert.Equal("undefined", TestAllowReflectionSetting(false)); +#endif + } + + [Fact] + public override void CreatingAnInstanceOfEmbeddedCustomExceptionAndCallingOfItsGetTypeMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + Type loginFailedExceptionType = typeof(LoginFailedException); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("LoginFailedError", loginFailedExceptionType); + return jsEngine.Evaluate("new LoginFailedError(\"Wrong password entered!\").GetType();"); + } + } + + // Act and Assert + Assert.Equal(typeof(LoginFailedException).FullName, TestAllowReflectionSetting(true)); +#if NETFRAMEWORK + Assert.Equal(typeof(LoginFailedException).FullName, TestAllowReflectionSetting(false)); +#else + + var exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Property 'GetType' of object is not a function", exception.Description); +#endif + } + + #endregion + #region Types with methods - #if NET471 [Fact] - public override void EmbeddingOfBuiltinReferenceTypeWithMethodsIsCorrect() + public override void EmbeddingOfTypeAndCallingOfItsGetTypeMethod() { // Arrange - Type mathType = typeof(Math); + string dateTimeTypeName = typeof(DateTime).FullName; - const string input1 = "Math2.Max(5.37, 5.56)"; - const double targetOutput1 = 5.56; + string TestAllowReflectionSetting(bool allowReflection) + { + Type type = typeof(Type); - const string input2 = "Math2.Log10(23)"; - const double targetOutput2 = 1.36172783601759; + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("Type", type); + return jsEngine.Evaluate("Type.GetType(\"" + dateTimeTypeName + "\");"); + } + } - // Act - double output1; - double output2; + // Act and Assert + Assert.Equal(dateTimeTypeName, TestAllowReflectionSetting(true)); + Assert.Equal(dateTimeTypeName, TestAllowReflectionSetting(false)); + } - using (var jsEngine = CreateJsEngine()) + [Fact] + public override void EmbeddingOfAssemblyTypeAndCallingOfItsLoadMethod() + { + // Arrange + const string reflectionEmitAssemblyName = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; + + string TestAllowReflectionSetting(bool allowReflection) { - jsEngine.EmbedHostType("Math2", mathType); - output1 = Math.Round(jsEngine.Evaluate(input1), 2); - output2 = Math.Round(jsEngine.Evaluate(input2), 14); + Type assemblyType = typeof(Assembly); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("Assembly", assemblyType); + return jsEngine.Evaluate("Assembly.Load(\"" + reflectionEmitAssemblyName + "\");"); + } } - // Assert - Assert.Equal(targetOutput1, output1); - Assert.Equal(targetOutput2, output2); + // Act and Assert + Assert.Equal(reflectionEmitAssemblyName, TestAllowReflectionSetting(true)); + Assert.Equal(reflectionEmitAssemblyName, TestAllowReflectionSetting(false)); } - #endif #endregion #endregion } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Jint/MultithreadingTests.cs b/test/JavaScriptEngineSwitcher.Tests/Jint/MultithreadingTests.cs index a801ba7d..5c6fb452 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Jint/MultithreadingTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Jint/MultithreadingTests.cs @@ -1,5 +1,4 @@ -#if !NET452 -namespace JavaScriptEngineSwitcher.Tests.Jint +namespace JavaScriptEngineSwitcher.Tests.Jint { public class MultithreadingTests : MultithreadingTestsBase { @@ -8,5 +7,4 @@ protected override string EngineName get { return "JintJsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Jint/PrecompilationTests.cs b/test/JavaScriptEngineSwitcher.Tests/Jint/PrecompilationTests.cs index e1d3a2e0..0e5a512e 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Jint/PrecompilationTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Jint/PrecompilationTests.cs @@ -1,5 +1,4 @@ -#if !NET452 -using System; +using System; using Xunit; @@ -20,7 +19,7 @@ protected override string EngineName #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringPrecompilationOfCodeIsCorrect() + public void MappingCompilationErrorDuringPrecompilationOfCode() { // Arrange const string input = @"function guid() { @@ -56,16 +55,16 @@ function s4() { Assert.Null(precompiledScript); Assert.NotNull(exception); Assert.Equal("Compilation error", exception.Category); - Assert.Equal("Unexpected token }", exception.Description); + Assert.Equal("Unexpected token ';'", exception.Description); Assert.Equal("SyntaxError", exception.Type); Assert.Equal("guid.js", exception.DocumentName); - Assert.Equal(7, exception.LineNumber); - Assert.Equal(2, exception.ColumnNumber); + Assert.Equal(6, exception.LineNumber); + Assert.Equal(4, exception.ColumnNumber); Assert.Empty(exception.SourceFragment); } [Fact] - public void MappingRuntimeErrorDuringExecutionOfPrecompiledCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfPrecompiledCode() { // Arrange const string input = @"function getItem(items, itemIndex) { @@ -120,7 +119,7 @@ public void MappingRuntimeErrorDuringExecutionOfPrecompiledCodeIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"function makeId(length) { @@ -135,7 +134,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() return result; }"; - string targetOutput = "SyntaxError: Unexpected token }" + Environment.NewLine + + string targetOutput = "SyntaxError: Unexpected token '}'" + Environment.NewLine + " at make-id.js:12:1" ; @@ -161,7 +160,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function getFullName(firstName, lastName) { @@ -207,5 +206,4 @@ public void GenerationOfRuntimeErrorMessageIsCorrect() #endregion } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/JsEngineSwitcherInitializer.cs b/test/JavaScriptEngineSwitcher.Tests/JsEngineSwitcherInitializer.cs index 4b373d16..12a61590 100644 --- a/test/JavaScriptEngineSwitcher.Tests/JsEngineSwitcherInitializer.cs +++ b/test/JavaScriptEngineSwitcher.Tests/JsEngineSwitcherInitializer.cs @@ -5,19 +5,14 @@ using JavaScriptEngineSwitcher.ChakraCore; using JavaScriptEngineSwitcher.Core; using JavaScriptEngineSwitcher.Core.Utilities; -#if !NET452 using JavaScriptEngineSwitcher.Jint; -#endif using JavaScriptEngineSwitcher.Jurassic; using JavaScriptEngineSwitcher.Msie; -#if !NET452 using JavaScriptEngineSwitcher.NiL; using JavaScriptEngineSwitcher.Node; -#endif -#if NETFRAMEWORK || NETCOREAPP3_1_OR_GREATER using JavaScriptEngineSwitcher.V8; -#endif using JavaScriptEngineSwitcher.Vroom; +using JavaScriptEngineSwitcher.Yantra; namespace JavaScriptEngineSwitcher.Tests { @@ -36,22 +31,17 @@ public static void Initialize() #endif JsEngineSwitcher.Current.EngineFactories .AddChakraCore() -#if !NET452 .AddJint() -#endif .AddJurassic() .AddMsie(new MsieSettings { EngineMode = JsEngineMode.ChakraIeJsRt }) -#if !NET452 .AddNiL() .AddNode() -#endif -#if NETFRAMEWORK || NETCOREAPP3_1_OR_GREATER .AddV8() -#endif .AddVroom() + .AddYantra() ; } } diff --git a/test/JavaScriptEngineSwitcher.Tests/Jurassic/CommonTests.cs b/test/JavaScriptEngineSwitcher.Tests/Jurassic/CommonTests.cs index 6b03e643..dffebf29 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Jurassic/CommonTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Jurassic/CommonTests.cs @@ -18,7 +18,7 @@ protected override string EngineName #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingCompilationErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -54,7 +54,7 @@ public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingRuntimeErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -91,7 +91,7 @@ public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() + public void MappingCompilationErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -133,7 +133,7 @@ public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -184,7 +184,7 @@ public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"var arr = []; @@ -214,7 +214,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function foo(x, y) { diff --git a/test/JavaScriptEngineSwitcher.Tests/Jurassic/Es5Tests.cs b/test/JavaScriptEngineSwitcher.Tests/Jurassic/Es5Tests.cs index a87ea2a2..b84ac8bc 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Jurassic/Es5Tests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Jurassic/Es5Tests.cs @@ -12,7 +12,7 @@ protected override string EngineName #region Object methods [Fact] - public override void ObjectKeysMethodIsSupported() + public override void SupportsObjectKeysMethod() { // Arrange const string input1 = "Object.keys(['a', 'b', 'c']).toString();"; diff --git a/test/JavaScriptEngineSwitcher.Tests/Jurassic/EvalTests.cs b/test/JavaScriptEngineSwitcher.Tests/Jurassic/EvalTests.cs new file mode 100644 index 00000000..128121d8 --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Jurassic/EvalTests.cs @@ -0,0 +1,10 @@ +namespace JavaScriptEngineSwitcher.Tests.Jurassic +{ + public class EvalTests : EvalTestsBase + { + protected override string EngineName + { + get { return "JurassicJsEngine"; } + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Jurassic/InteropTests.cs b/test/JavaScriptEngineSwitcher.Tests/Jurassic/InteropTests.cs index 39b68564..0250db5d 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Jurassic/InteropTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Jurassic/InteropTests.cs @@ -15,14 +15,14 @@ protected override string EngineName #region Objects with properties - public override void EmbeddingOfInstanceOfAnonymousTypeWithPropertiesIsCorrect() + public override void EmbeddingOfInstanceOfAnonymousTypeWithProperties() { } #endregion #region Delegates - public override void CallingOfEmbeddedDelegateWithMissingParameter() + public override void EmbeddingOfInstanceOfDelegateAndCallingItWithMissingParameter() { // Arrange var sumFunc = new Func((a, b) => a + b); @@ -47,17 +47,18 @@ public override void CallingOfEmbeddedDelegateWithMissingParameter() #endregion + #region Embedding of types #region Types with constants - public override void EmbeddingOfBuiltinReferenceTypeWithConstantsIsCorrect() + public override void EmbeddingOfBuiltinReferenceTypeWithConstants() { } - public override void EmbeddingOfCustomValueTypeWithConstantsIsCorrect() + public override void EmbeddingOfCustomValueTypeWithConstants() { } - public override void EmbeddingOfCustomReferenceTypeWithConstantIsCorrect() + public override void EmbeddingOfCustomReferenceTypeWithConstant() { } #endregion diff --git a/test/JavaScriptEngineSwitcher.Tests/Jurassic/PrecompilationTests.cs b/test/JavaScriptEngineSwitcher.Tests/Jurassic/PrecompilationTests.cs index 9e8258a9..778d611e 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Jurassic/PrecompilationTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Jurassic/PrecompilationTests.cs @@ -19,7 +19,7 @@ protected override string EngineName #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringPrecompilationOfCodeIsCorrect() + public void MappingCompilationErrorDuringPrecompilationOfCode() { // Arrange const string input = @"function guid() { @@ -64,7 +64,7 @@ function s4() { } [Fact] - public void MappingRuntimeErrorDuringExecutionOfPrecompiledCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfPrecompiledCode() { // Arrange const string input = @"function getItem(items, itemIndex) { @@ -117,7 +117,7 @@ public void MappingRuntimeErrorDuringExecutionOfPrecompiledCodeIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"function makeId(length) { @@ -158,7 +158,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function getFullName(firstName, lastName) { diff --git a/test/JavaScriptEngineSwitcher.Tests/Msie/CommonTests.cs b/test/JavaScriptEngineSwitcher.Tests/Msie/CommonTests.cs index c2f07112..2a2021e0 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Msie/CommonTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Msie/CommonTests.cs @@ -19,7 +19,7 @@ protected override string EngineName #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingCompilationErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -55,7 +55,7 @@ public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingRuntimeErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -92,7 +92,7 @@ public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() + public void MappingCompilationErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -134,7 +134,7 @@ public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -185,7 +185,7 @@ public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"var arr = []; @@ -215,7 +215,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function foo(x, y) { diff --git a/test/JavaScriptEngineSwitcher.Tests/Msie/EvalTests.cs b/test/JavaScriptEngineSwitcher.Tests/Msie/EvalTests.cs new file mode 100644 index 00000000..ce0ec5fd --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Msie/EvalTests.cs @@ -0,0 +1,10 @@ +namespace JavaScriptEngineSwitcher.Tests.Msie +{ + public class EvalTests : EvalTestsBase + { + protected override string EngineName + { + get { return "MsieJsEngine"; } + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Msie/InteropTests.cs b/test/JavaScriptEngineSwitcher.Tests/Msie/InteropTests.cs index 5dd6bdd8..e2848349 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Msie/InteropTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Msie/InteropTests.cs @@ -1,9 +1,14 @@ using System; using System.IO; +using System.Reflection; using Xunit; using JavaScriptEngineSwitcher.Core; +using JavaScriptEngineSwitcher.Msie; + +using JavaScriptEngineSwitcher.Tests.Interop; +using JavaScriptEngineSwitcher.Tests.Interop.Animals; namespace JavaScriptEngineSwitcher.Tests.Msie { @@ -15,15 +20,112 @@ protected override string EngineName } + private IJsEngine CreateJsEngine(bool allowReflection) + { + var jsEngine = new MsieJsEngine(new MsieSettings + { + AllowReflection = allowReflection, + EngineMode = JsEngineMode.ChakraIeJsRt + }); + + return jsEngine; + } + #region Embedding of objects + #region Objects with methods + + [Fact] + public override void EmbeddingOfInstanceOfCustomValueTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + var date = new Date(); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("date", date); + return jsEngine.Evaluate("date.GetType();"); + } + } + + // Act and Assert + Assert.Equal(typeof(Date).FullName, TestAllowReflectionSetting(true)); + + var exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Object doesn't support property or method 'GetType'", exception.Description); + } + + [Fact] + public override void EmbeddingOfInstanceOfCustomReferenceTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + var cat = new Cat(); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("cat", cat); + return jsEngine.Evaluate("cat.GetType();"); + } + } + + // Act and Assert + Assert.Equal(typeof(Cat).FullName, TestAllowReflectionSetting(true)); + + JsRuntimeException exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Object doesn't support property or method 'GetType'", exception.Description); + } + + [Fact] + public override void EmbeddingOfInstanceOfAssemblyTypeAndCallingOfItsCreateInstanceMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + Assembly assembly = this.GetType().Assembly; + string personTypeName = typeof(Person).FullName; + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("assembly", assembly); + return jsEngine.Evaluate("assembly.CreateInstance(\"" + personTypeName + "\");"); + } + } + + // Act and Assert + Assert.Equal("{FirstName=,LastName=}", TestAllowReflectionSetting(true)); + Assert.Equal("{FirstName=,LastName=}", TestAllowReflectionSetting(false)); + } + + #endregion + #region Delegates -#if !NETCOREAPP [Fact] - public override void EmbeddedInstanceOfDelegateHasFunctionPrototype() - { } -#endif + public override void EmbeddingOfInstanceOfDelegateAndGettingItsMethodProperty() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + var cat = new Cat(); + var cryFunc = new Func(cat.Cry); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("cry", cryFunc); + return jsEngine.Evaluate("cry.Method;"); + } + } + + // Act and Assert + Assert.Equal("undefined", TestAllowReflectionSetting(true)); + Assert.Equal("undefined", TestAllowReflectionSetting(false)); + } #endregion @@ -32,7 +134,7 @@ public override void EmbeddedInstanceOfDelegateHasFunctionPrototype() #region Mapping of errors [Fact] - public void MappingRuntimeErrorDuringRecursiveEvaluationOfFilesIsCorrect() + public void MappingRuntimeErrorDuringRecursiveEvaluationOfFiles() { // Arrange const string directoryPath = "Files/recursive-evaluation/runtime-error"; @@ -84,5 +186,105 @@ public void MappingRuntimeErrorDuringRecursiveEvaluationOfFilesIsCorrect() #endregion #endregion + + + #region Embedding of types + + #region Creating of instances + + [Fact] + public override void CreatingAnInstanceOfEmbeddedBuiltinExceptionAndGettingItsTargetSiteProperty() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + Type invalidOperationExceptionType = typeof(InvalidOperationException); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("InvalidOperationError", invalidOperationExceptionType); + return jsEngine.Evaluate("new InvalidOperationError(\"A terrible thing happened!\").TargetSite;"); + } + } + + // Act and Assert + Assert.Null(TestAllowReflectionSetting(true)); + Assert.Equal("undefined", TestAllowReflectionSetting(false)); + } + + [Fact] + public override void CreatingAnInstanceOfEmbeddedCustomExceptionAndCallingOfItsGetTypeMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + Type loginFailedExceptionType = typeof(LoginFailedException); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("LoginFailedError", loginFailedExceptionType); + return jsEngine.Evaluate("new LoginFailedError(\"Wrong password entered!\").GetType();"); + } + } + + // Act and Assert + Assert.Equal(typeof(LoginFailedException).FullName, TestAllowReflectionSetting(true)); + + var exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Object doesn't support property or method 'GetType'", exception.Description); + } + + #endregion + + #region Types with methods + + [Fact] + public override void EmbeddingOfTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + string dateTimeTypeName = typeof(DateTime).FullName; + + string TestAllowReflectionSetting(bool allowReflection) + { + Type type = typeof(Type); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("Type", type); + return jsEngine.Evaluate("Type.GetType(\"" + dateTimeTypeName + "\");"); + } + } + + // Act and Assert + Assert.Equal(dateTimeTypeName, TestAllowReflectionSetting(true)); + Assert.Equal(dateTimeTypeName, TestAllowReflectionSetting(false)); + } + + [Fact] + public override void EmbeddingOfAssemblyTypeAndCallingOfItsLoadMethod() + { + // Arrange + const string reflectionEmitAssemblyName = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; + + string TestAllowReflectionSetting(bool allowReflection) + { + Type assemblyType = typeof(Assembly); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("Assembly", assemblyType); + return jsEngine.Evaluate("Assembly.Load(\"" + reflectionEmitAssemblyName + "\");"); + } + } + + // Act and Assert + Assert.Equal(reflectionEmitAssemblyName, TestAllowReflectionSetting(true)); + Assert.Equal(reflectionEmitAssemblyName, TestAllowReflectionSetting(false)); + } + + #endregion + + #endregion } } \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Msie/PrecompilationTests.cs b/test/JavaScriptEngineSwitcher.Tests/Msie/PrecompilationTests.cs index b10055ff..f810dc47 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Msie/PrecompilationTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Msie/PrecompilationTests.cs @@ -19,7 +19,7 @@ protected override string EngineName #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringPrecompilationOfCodeIsCorrect() + public void MappingCompilationErrorDuringPrecompilationOfCode() { // Arrange const string input = @"function guid() { @@ -64,7 +64,7 @@ function s4() { } [Fact] - public void MappingRuntimeErrorDuringExecutionOfPrecompiledCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfPrecompiledCode() { // Arrange const string input = @"function getItem(items, itemIndex) { @@ -119,7 +119,7 @@ public void MappingRuntimeErrorDuringExecutionOfPrecompiledCodeIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"function makeId(length) { @@ -160,7 +160,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function getFullName(firstName, lastName) { diff --git a/test/JavaScriptEngineSwitcher.Tests/MultithreadingTestsBase.cs b/test/JavaScriptEngineSwitcher.Tests/MultithreadingTestsBase.cs index b276fb98..e739acfb 100644 --- a/test/JavaScriptEngineSwitcher.Tests/MultithreadingTestsBase.cs +++ b/test/JavaScriptEngineSwitcher.Tests/MultithreadingTestsBase.cs @@ -7,7 +7,7 @@ namespace JavaScriptEngineSwitcher.Tests public abstract class MultithreadingTestsBase : TestsBase { [Fact] - public virtual void ExecutionOfCodeFromDifferentThreadsIsCorrect() + public virtual void ExecutionOfCodeFromDifferentThreads() { // Arrange const string variableName = "foo"; diff --git a/test/JavaScriptEngineSwitcher.Tests/NiL/CommonTests.cs b/test/JavaScriptEngineSwitcher.Tests/NiL/CommonTests.cs index 7fd07a44..58ddd8b2 100644 --- a/test/JavaScriptEngineSwitcher.Tests/NiL/CommonTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/NiL/CommonTests.cs @@ -1,5 +1,4 @@ -#if !NET452 -using System; +using System; using Xunit; @@ -19,7 +18,7 @@ protected override string EngineName #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingCompilationErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -55,7 +54,7 @@ public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingRuntimeErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -88,11 +87,11 @@ public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() Assert.Equal(5, exception.LineNumber); Assert.Equal(15, exception.ColumnNumber); Assert.Equal("$variable1 + -variable2 - variable3;", exception.SourceFragment); - Assert.Empty(exception.CallStack); + Assert.Equal(" at Global code (5:15)", exception.CallStack); } [Fact] - public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() + public void MappingCompilationErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -134,7 +133,7 @@ public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -170,10 +169,17 @@ public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() Assert.Equal("The value must be greater than or equal to zero.", exception.Description); Assert.Equal("Error", exception.Type); Assert.Empty(exception.DocumentName); - Assert.Equal(0, exception.LineNumber); - Assert.Equal(0, exception.ColumnNumber); - Assert.Empty(exception.SourceFragment); - Assert.Empty(exception.CallStack); + Assert.Equal(3, exception.LineNumber); + Assert.Equal(3, exception.ColumnNumber); + Assert.Equal( + " throw new Error(\"The value must be greater than or equal to zero.\");", + exception.SourceFragment + ); + Assert.Equal( + " at factorial (3:3)" + Environment.NewLine + + " at Global code (10:1)", + exception.CallStack + ); } #endregion @@ -181,7 +187,7 @@ public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"var arr = []; @@ -211,7 +217,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function foo(x, y) { @@ -228,7 +234,9 @@ public void GenerationOfRuntimeErrorMessageIsCorrect() foo(a, b); })(foo);"; string targetOutput = "ReferenceError: Variable \"bar\" is not defined" + Environment.NewLine + - " at 4:3 -> bar();" + " at foo (4:3) -> bar();" + Environment.NewLine + + " at Anonymous function (12:2)" + Environment.NewLine + + " at Global code (8:1)" ; JsRuntimeException exception = null; @@ -254,5 +262,4 @@ public void GenerationOfRuntimeErrorMessageIsCorrect() #endregion } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/NiL/Es5Tests.cs b/test/JavaScriptEngineSwitcher.Tests/NiL/Es5Tests.cs index 0015d8c2..d83a291b 100644 --- a/test/JavaScriptEngineSwitcher.Tests/NiL/Es5Tests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/NiL/Es5Tests.cs @@ -1,5 +1,4 @@ -#if !NET452 -namespace JavaScriptEngineSwitcher.Tests.NiL +namespace JavaScriptEngineSwitcher.Tests.NiL { public class Es5Tests : Es5TestsBase { @@ -8,5 +7,4 @@ protected override string EngineName get { return "NiLJsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/NiL/EvalTests.cs b/test/JavaScriptEngineSwitcher.Tests/NiL/EvalTests.cs new file mode 100644 index 00000000..1eab545c --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/NiL/EvalTests.cs @@ -0,0 +1,10 @@ +namespace JavaScriptEngineSwitcher.Tests.NiL +{ + public class EvalTests : EvalTestsBase + { + protected override string EngineName + { + get { return "NiLJsEngine"; } + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/NiL/InteropTests.cs b/test/JavaScriptEngineSwitcher.Tests/NiL/InteropTests.cs index 102f8b2a..304db66e 100644 --- a/test/JavaScriptEngineSwitcher.Tests/NiL/InteropTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/NiL/InteropTests.cs @@ -1,8 +1,12 @@ -#if !NET452 -using System; +using System; using Xunit; +using JavaScriptEngineSwitcher.Core; + +using JavaScriptEngineSwitcher.Tests.Interop; +using JavaScriptEngineSwitcher.Tests.Interop.Animals; + namespace JavaScriptEngineSwitcher.Tests.NiL { public class InteropTests : InteropTestsBase @@ -13,12 +17,133 @@ protected override string EngineName } + #region Embedding of objects + + #region Objects with methods + + [Fact] + public override void EmbeddingOfInstanceOfCustomValueTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + var date = new Date(); + + const string input = "date.GetType();"; + + // Act + JsRuntimeException exception = null; + + using (var jsEngine = CreateJsEngine()) + { + try + { + jsEngine.EmbedHostObject("date", date); + jsEngine.Evaluate(input); + } + catch (JsRuntimeException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("date.GetType is not a function", exception.Description); + } + + [Fact] + public override void EmbeddingOfInstanceOfCustomReferenceTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + var cat = new Cat(); + + const string input = @"cat.GetType();"; + + // Act + JsRuntimeException exception = null; + + using (var jsEngine = CreateJsEngine()) + { + try + { + jsEngine.EmbedHostObject("cat", cat); + jsEngine.Evaluate(input); + } + catch (JsRuntimeException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("cat.GetType is not a function", exception.Description); + } + + #endregion + + #region Delegates + + [Fact] + public override void EmbeddingOfInstanceOfDelegateAndCallingItWithMissingParameter() + { + // Arrange + var sumFunc = new Func((a, b) => a + b); + + const string input = "sum(678)"; + const int targetOutput = 678; + + // Act + int output; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostObject("sum", sumFunc); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + + #endregion + + #endregion + + #region Embedding of types + #region Creating of instances + + [Fact] + public override void CreatingAnInstanceOfEmbeddedBuiltinExceptionAndGettingItsTargetSiteProperty() + { + // Arrange + Type invalidOperationExceptionType = typeof(InvalidOperationException); + + const string input = "new InvalidOperationError(\"A terrible thing happened!\").TargetSite;"; + + // Act + string output; + const string targetOutput = "undefined"; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostType("InvalidOperationError", invalidOperationExceptionType); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + + #endregion + #region Types with methods [Fact] - public override void EmbeddingOfBuiltinReferenceTypeWithMethodsIsCorrect() + public override void EmbeddingOfBuiltinReferenceTypeWithMethods() { // Arrange Type mathType = typeof(Math); @@ -49,5 +174,4 @@ public override void EmbeddingOfBuiltinReferenceTypeWithMethodsIsCorrect() #endregion } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/NiL/MultithreadingTests.cs b/test/JavaScriptEngineSwitcher.Tests/NiL/MultithreadingTests.cs index 3c9b2d99..d926a2f2 100644 --- a/test/JavaScriptEngineSwitcher.Tests/NiL/MultithreadingTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/NiL/MultithreadingTests.cs @@ -1,5 +1,4 @@ -#if !NET452 -namespace JavaScriptEngineSwitcher.Tests.NiL +namespace JavaScriptEngineSwitcher.Tests.NiL { public class MultithreadingTests : MultithreadingTestsBase { @@ -8,5 +7,4 @@ protected override string EngineName get { return "NiLJsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/NiL/PrecompilationTests.cs b/test/JavaScriptEngineSwitcher.Tests/NiL/PrecompilationTests.cs index 4301a98a..72953641 100644 --- a/test/JavaScriptEngineSwitcher.Tests/NiL/PrecompilationTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/NiL/PrecompilationTests.cs @@ -1,5 +1,4 @@ -#if !NET452 -namespace JavaScriptEngineSwitcher.Tests.NiL +namespace JavaScriptEngineSwitcher.Tests.NiL { public class PrecompilationTests : PrecompilationTestsBase { @@ -8,5 +7,4 @@ protected override string EngineName get { return "NiLJsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Node/BuiltInLibraryTests.cs b/test/JavaScriptEngineSwitcher.Tests/Node/BuiltInLibraryTests.cs index 1abf4336..e1c86e18 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Node/BuiltInLibraryTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Node/BuiltInLibraryTests.cs @@ -1,5 +1,4 @@ -#if !NET452 -using Xunit; +using Xunit; using JavaScriptEngineSwitcher.Node; @@ -14,7 +13,7 @@ protected override string EngineName [Fact] - public void RequireFunctionIsAvailable() + public void AccessingToRequireFunction() { // Arrange var withoutBuiltinLibrary = new NodeSettings { UseBuiltinLibrary = false }; @@ -42,7 +41,7 @@ public void RequireFunctionIsAvailable() } [Fact] - public void FileReadingIsCorrect() + public void ReadingOfFile() { // Arrange const string input = @"let fs = require('fs'); @@ -61,5 +60,4 @@ public void FileReadingIsCorrect() Assert.Equal(targetOutput, output); } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Node/CommonTests.cs b/test/JavaScriptEngineSwitcher.Tests/Node/CommonTests.cs index f5fc651d..472234cf 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Node/CommonTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Node/CommonTests.cs @@ -1,5 +1,4 @@ -#if !NET452 -using System; +using System; using Xunit; @@ -19,11 +18,11 @@ protected override string EngineName #region Evaluation of scripts [Fact] - public override void EvaluationOfExpressionWithUndefinedResultIsCorrect() + public override void EvaluationOfExpressionWithUndefinedResult() { } [Fact] - public override void EvaluationOfExpressionWithNullResultIsCorrect() + public override void EvaluationOfExpressionWithNullResult() { // Arrange const string input = "null"; @@ -46,7 +45,7 @@ public override void EvaluationOfExpressionWithNullResultIsCorrect() #region Calling of functions [Fact] - public override void CallingOfFunctionWithoutParametersIsCorrect() + public override void CallingOfFunctionWithoutParameters() { // Arrange const string functionCode = @"function hooray() { @@ -68,11 +67,11 @@ public override void CallingOfFunctionWithoutParametersIsCorrect() } [Fact] - public override void CallingOfFunctionWithUndefinedResultIsCorrect() + public override void CallingOfFunctionWithUndefinedResult() { } [Fact] - public override void CallingOfFunctionWithNullResultIsCorrect() + public override void CallingOfFunctionWithNullResult() { // Arrange const string functionCode = @"function testNull(value) { @@ -99,7 +98,7 @@ public override void CallingOfFunctionWithNullResultIsCorrect() } [Fact] - public override void CallingOfFunctionWithManyParametersIsCorrect() + public override void CallingOfFunctionWithManyParameters() { } #endregion @@ -107,11 +106,11 @@ public override void CallingOfFunctionWithManyParametersIsCorrect() #region Getting, setting and removing variables [Fact] - public override void SettingAndGettingVariableWithUndefinedValueIsCorrect() + public override void SettingAndGettingVariableWithUndefinedValue() { } [Fact] - public override void SettingAndGettingVariableWithNullValueIsCorrect() + public override void SettingAndGettingVariableWithNullValue() { // Arrange const string variableName = "myVar2"; @@ -141,7 +140,7 @@ public override void SettingAndGettingVariableWithNullValueIsCorrect() #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingCompilationErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -177,7 +176,7 @@ public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingRuntimeErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -214,7 +213,7 @@ public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() + public void MappingCompilationErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -256,7 +255,7 @@ public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -306,7 +305,7 @@ public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingTimeoutErrorDuringExecutionOfCodeIsCorrect() + public void MappingTimeoutErrorDuringExecutionOfCode() { // Arrange const string input = @"while (true);"; @@ -348,13 +347,13 @@ public void MappingTimeoutErrorDuringExecutionOfCodeIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"var arr = []; var obj = {}; var foo = 'Browser's bar';"; - string targetOutput = "SyntaxError: Unexpected identifier" + Environment.NewLine + + string targetOutput = "SyntaxError: Unexpected identifier 's'" + Environment.NewLine + " at variables.js:3:20 -> var foo = 'Browser's bar';" ; @@ -378,7 +377,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function foo(x, y) { @@ -423,5 +422,4 @@ public void GenerationOfRuntimeErrorMessageIsCorrect() #endregion } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Node/Es2015Tests.cs b/test/JavaScriptEngineSwitcher.Tests/Node/Es2015Tests.cs index 9c6bf3c5..0e2a7d18 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Node/Es2015Tests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Node/Es2015Tests.cs @@ -1,5 +1,4 @@ -#if !NET452 -namespace JavaScriptEngineSwitcher.Tests.Node +namespace JavaScriptEngineSwitcher.Tests.Node { public class Es2015Tests : Es2015TestsBase { @@ -8,5 +7,4 @@ protected override string EngineName get { return "NodeJsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Node/Es5Tests.cs b/test/JavaScriptEngineSwitcher.Tests/Node/Es5Tests.cs index 76b28882..7e49ac74 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Node/Es5Tests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Node/Es5Tests.cs @@ -1,5 +1,4 @@ -#if !NET452 -namespace JavaScriptEngineSwitcher.Tests.Node +namespace JavaScriptEngineSwitcher.Tests.Node { public class Es5Tests : Es5TestsBase { @@ -11,10 +10,9 @@ protected override string EngineName #region Object methods - public override void ObjectCreateMethodIsSupported() + public override void SupportsObjectCreateMethod() { } #endregion } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Node/EvalTests.cs b/test/JavaScriptEngineSwitcher.Tests/Node/EvalTests.cs new file mode 100644 index 00000000..645e2662 --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Node/EvalTests.cs @@ -0,0 +1,10 @@ +namespace JavaScriptEngineSwitcher.Tests.Node +{ + public class EvalTests : EvalTestsBase + { + protected override string EngineName + { + get { return "NodeJsEngine"; } + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Node/MultithreadingTests.cs b/test/JavaScriptEngineSwitcher.Tests/Node/MultithreadingTests.cs index 69fd6516..5ed8c5ae 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Node/MultithreadingTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Node/MultithreadingTests.cs @@ -1,5 +1,4 @@ -#if !NET452 -namespace JavaScriptEngineSwitcher.Tests.Node +namespace JavaScriptEngineSwitcher.Tests.Node { public class MultithreadingTests : MultithreadingTestsBase { @@ -8,5 +7,4 @@ protected override string EngineName get { return "NodeJsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Node/PrecompilationTests.cs b/test/JavaScriptEngineSwitcher.Tests/Node/PrecompilationTests.cs index 0ad767ab..43f974d9 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Node/PrecompilationTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Node/PrecompilationTests.cs @@ -1,5 +1,4 @@ -#if !NET452 -namespace JavaScriptEngineSwitcher.Tests.Node +namespace JavaScriptEngineSwitcher.Tests.Node { public class PrecompilationTests : PrecompilationTestsBase { @@ -8,5 +7,4 @@ protected override string EngineName get { return "NodeJsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Node/SecurityTests.cs b/test/JavaScriptEngineSwitcher.Tests/Node/SecurityTests.cs index 08c20690..bdc3212e 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Node/SecurityTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Node/SecurityTests.cs @@ -1,5 +1,4 @@ -#if !NET452 -using Xunit; +using Xunit; namespace JavaScriptEngineSwitcher.Tests.Node { @@ -12,7 +11,7 @@ protected override string EngineName [Fact] - public void AccessToProcessIsRestricted() + public void AccessingToProcess() { // Arrange const string input1 = @"typeof process === 'undefined';"; @@ -38,5 +37,4 @@ public void AccessToProcessIsRestricted() Assert.True(output2); } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/PrecompilationTestsBase.cs b/test/JavaScriptEngineSwitcher.Tests/PrecompilationTestsBase.cs index 5645cccf..4ca5aac9 100644 --- a/test/JavaScriptEngineSwitcher.Tests/PrecompilationTestsBase.cs +++ b/test/JavaScriptEngineSwitcher.Tests/PrecompilationTestsBase.cs @@ -12,7 +12,7 @@ public abstract class PrecompilationTestsBase : TestsBase #region Execution of precompiled scripts [Fact] - public virtual void ExecutionOfPrecompiledCodeIsCorrect() + public virtual void ExecutionOfPrecompiledCode() { // Arrange const string libraryCode = @"function declensionOfNumerals(number, titles) { @@ -84,7 +84,7 @@ function declinationOfSeconds(number) { } [Fact] - public virtual void ExecutionOfPrecompiledFileIsCorrect() + public virtual void ExecutionOfPrecompiledFile() { // Arrange const string filePath = "Files/declination-of-minutes.js"; @@ -134,7 +134,7 @@ public virtual void ExecutionOfPrecompiledFileIsCorrect() } [Fact] - public virtual void ExecutionOfPrecompiledResourceByNameAndTypeIsCorrect() + public virtual void ExecutionOfPrecompiledResourceByNameAndType() { // Arrange const string resourceName = "Resources.declination-of-hours.js"; @@ -184,7 +184,7 @@ public virtual void ExecutionOfPrecompiledResourceByNameAndTypeIsCorrect() } [Fact] - public virtual void ExecutionOfPrecompiledResourceByNameAndAssemblyIsCorrect() + public virtual void ExecutionOfPrecompiledResourceByNameAndAssembly() { // Arrange const string resourceName = "JavaScriptEngineSwitcher.Tests.Resources.declination-of-days.js"; diff --git a/test/JavaScriptEngineSwitcher.Tests/V8/CommonTests.cs b/test/JavaScriptEngineSwitcher.Tests/V8/CommonTests.cs index d767cc6d..e1453c02 100644 --- a/test/JavaScriptEngineSwitcher.Tests/V8/CommonTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/V8/CommonTests.cs @@ -1,5 +1,4 @@ -#if NETFRAMEWORK || NETCOREAPP3_1_OR_GREATER -using System; +using System; using Xunit; @@ -21,7 +20,7 @@ protected override string EngineName #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingCompilationErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -57,7 +56,7 @@ public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingRuntimeErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -94,7 +93,7 @@ public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() + public void MappingCompilationErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -136,7 +135,7 @@ public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -183,7 +182,7 @@ public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringOutOfMemoryIsCorrect() + public void MappingRuntimeErrorDuringOutOfMemory() { // Arrange const string input = @"var arr = []; @@ -223,13 +222,13 @@ public void MappingRuntimeErrorDuringOutOfMemoryIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"var arr = []; var obj = {}; var foo = 'Browser's bar';"; - string targetOutput = "SyntaxError: Unexpected identifier" + Environment.NewLine + + string targetOutput = "SyntaxError: Unexpected identifier 's'" + Environment.NewLine + " at variables.js:3:20 -> var foo = 'Browser's bar';" ; @@ -253,7 +252,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function foo(x, y) { @@ -298,5 +297,4 @@ public void GenerationOfRuntimeErrorMessageIsCorrect() #endregion } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/V8/Es2015Tests.cs b/test/JavaScriptEngineSwitcher.Tests/V8/Es2015Tests.cs index 963502c5..60d188a4 100644 --- a/test/JavaScriptEngineSwitcher.Tests/V8/Es2015Tests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/V8/Es2015Tests.cs @@ -1,5 +1,4 @@ -#if NETFRAMEWORK || NETCOREAPP3_1_OR_GREATER -namespace JavaScriptEngineSwitcher.Tests.V8 +namespace JavaScriptEngineSwitcher.Tests.V8 { public class Es2015Tests : Es2015TestsBase { @@ -8,5 +7,4 @@ protected override string EngineName get { return "V8JsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/V8/Es5Tests.cs b/test/JavaScriptEngineSwitcher.Tests/V8/Es5Tests.cs index 2ee82555..81264d18 100644 --- a/test/JavaScriptEngineSwitcher.Tests/V8/Es5Tests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/V8/Es5Tests.cs @@ -1,5 +1,4 @@ -#if NETFRAMEWORK || NETCOREAPP3_1_OR_GREATER -namespace JavaScriptEngineSwitcher.Tests.V8 +namespace JavaScriptEngineSwitcher.Tests.V8 { public class Es5Tests : Es5TestsBase { @@ -8,5 +7,4 @@ protected override string EngineName get { return "V8JsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/V8/EvalTests.cs b/test/JavaScriptEngineSwitcher.Tests/V8/EvalTests.cs new file mode 100644 index 00000000..74e5de39 --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/V8/EvalTests.cs @@ -0,0 +1,10 @@ +namespace JavaScriptEngineSwitcher.Tests.V8 +{ + public class EvalTests : EvalTestsBase + { + protected override string EngineName + { + get { return "V8JsEngine"; } + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/V8/InteropTests.cs b/test/JavaScriptEngineSwitcher.Tests/V8/InteropTests.cs index ee607914..ded468d7 100644 --- a/test/JavaScriptEngineSwitcher.Tests/V8/InteropTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/V8/InteropTests.cs @@ -1,4 +1,14 @@ -#if NETFRAMEWORK || NETCOREAPP3_1_OR_GREATER +using System; +using System.Reflection; + +using Xunit; + +using JavaScriptEngineSwitcher.Core; +using JavaScriptEngineSwitcher.V8; + +using JavaScriptEngineSwitcher.Tests.Interop; +using JavaScriptEngineSwitcher.Tests.Interop.Animals; + namespace JavaScriptEngineSwitcher.Tests.V8 { public class InteropTests : InteropTestsBase @@ -9,16 +19,215 @@ protected override string EngineName } + private IJsEngine CreateJsEngine(bool allowReflection) + { + var jsEngine = new V8JsEngine(new V8Settings + { + AllowReflection = allowReflection + }); + + return jsEngine; + } + #region Embedding of objects + #region Objects with methods + + public override void EmbeddingOfInstanceOfCustomValueTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + var date = new Date(); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("date", date); + return jsEngine.Evaluate("date.GetType();"); + } + } + + // Act and Assert + Assert.Equal(typeof(Date).FullName, TestAllowReflectionSetting(true)); + + var exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Use of reflection is prohibited in this script engine", exception.Description); + } + + public override void EmbeddingOfInstanceOfCustomReferenceTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + var cat = new Cat(); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("cat", cat); + return jsEngine.Evaluate("cat.GetType();"); + } + } + + // Act and Assert + Assert.Equal(typeof(Cat).FullName, TestAllowReflectionSetting(true)); + + JsRuntimeException exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Use of reflection is prohibited in this script engine", exception.Description); + } + + public override void EmbeddingOfInstanceOfAssemblyTypeAndCallingOfItsCreateInstanceMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + Assembly assembly = this.GetType().Assembly; + string personTypeName = typeof(Person).FullName; + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("assembly", assembly); + return jsEngine.Evaluate("assembly.CreateInstance(\"" + personTypeName + "\");"); + } + } + + // Act and Assert + Assert.Equal("{FirstName=,LastName=}", TestAllowReflectionSetting(true)); + Assert.Equal("{FirstName=,LastName=}", TestAllowReflectionSetting(false)); + } + + #endregion + #region Delegates - public override void EmbeddedInstanceOfDelegateHasFunctionPrototype() + public override void EmbeddingOfInstanceOfDelegateAndCheckingItsPrototype() { } + public override void EmbeddingOfInstanceOfDelegateAndGettingItsMethodProperty() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + var cat = new Cat(); + var cryFunc = new Func(cat.Cry); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostObject("cry", cryFunc); + return jsEngine.Evaluate("cry.Method;"); + } + } + + // Act and Assert + Assert.Equal("System.String Cry()", TestAllowReflectionSetting(true)); + + var exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Use of reflection is prohibited in this script engine", exception.Description); + } + + #endregion + + #endregion + + + #region Embedding of types + + #region Creating of instances + + public override void CreatingAnInstanceOfEmbeddedBuiltinExceptionAndGettingItsTargetSiteProperty() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + Type invalidOperationExceptionType = typeof(InvalidOperationException); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("InvalidOperationError", invalidOperationExceptionType); + return jsEngine.Evaluate("new InvalidOperationError(\"A terrible thing happened!\").TargetSite;"); + } + } + + // Act and Assert + Assert.Null(TestAllowReflectionSetting(true)); + + var exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Use of reflection is prohibited in this script engine", exception.Description); + } + + public override void CreatingAnInstanceOfEmbeddedCustomExceptionAndCallingOfItsGetTypeMethod() + { + // Arrange + string TestAllowReflectionSetting(bool allowReflection) + { + Type loginFailedExceptionType = typeof(LoginFailedException); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("LoginFailedError", loginFailedExceptionType); + return jsEngine.Evaluate("new LoginFailedError(\"Wrong password entered!\").GetType();"); + } + } + + // Act and Assert + Assert.Equal(typeof(LoginFailedException).FullName, TestAllowReflectionSetting(true)); + + var exception = Assert.Throws(() => TestAllowReflectionSetting(false)); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Use of reflection is prohibited in this script engine", exception.Description); + } + + #endregion + + #region Types with methods + + public override void EmbeddingOfTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + string dateTimeTypeName = typeof(DateTime).FullName; + + string TestAllowReflectionSetting(bool allowReflection) + { + Type type = typeof(Type); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("Type", type); + return jsEngine.Evaluate("Type.GetType(\"" + dateTimeTypeName + "\");"); + } + } + + // Act and Assert + Assert.Equal(dateTimeTypeName, TestAllowReflectionSetting(true)); + Assert.Equal(dateTimeTypeName, TestAllowReflectionSetting(false)); + } + + public override void EmbeddingOfAssemblyTypeAndCallingOfItsLoadMethod() + { + // Arrange + const string reflectionEmitAssemblyName = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; + + string TestAllowReflectionSetting(bool allowReflection) + { + Type assemblyType = typeof(Assembly); + + using (var jsEngine = CreateJsEngine(allowReflection: allowReflection)) + { + jsEngine.EmbedHostType("Assembly", assemblyType); + return jsEngine.Evaluate("Assembly.Load(\"" + reflectionEmitAssemblyName + "\");"); + } + } + + // Act and Assert + Assert.Equal(reflectionEmitAssemblyName, TestAllowReflectionSetting(true)); + Assert.Equal(reflectionEmitAssemblyName, TestAllowReflectionSetting(false)); + } + #endregion #endregion } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/V8/IntlTests.cs b/test/JavaScriptEngineSwitcher.Tests/V8/IntlTests.cs index a533dde2..68812190 100644 --- a/test/JavaScriptEngineSwitcher.Tests/V8/IntlTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/V8/IntlTests.cs @@ -1,5 +1,4 @@ -#if NETFRAMEWORK || NETCOREAPP3_1_OR_GREATER -namespace JavaScriptEngineSwitcher.Tests.V8 +namespace JavaScriptEngineSwitcher.Tests.V8 { public class IntlTests : IntlTestsBase { @@ -8,5 +7,4 @@ protected override string EngineName get { return "V8JsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/V8/MultithreadingTests.cs b/test/JavaScriptEngineSwitcher.Tests/V8/MultithreadingTests.cs index 5af57790..9661c84b 100644 --- a/test/JavaScriptEngineSwitcher.Tests/V8/MultithreadingTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/V8/MultithreadingTests.cs @@ -1,5 +1,4 @@ -#if NETFRAMEWORK || NETCOREAPP3_1_OR_GREATER -namespace JavaScriptEngineSwitcher.Tests.V8 +namespace JavaScriptEngineSwitcher.Tests.V8 { public class MultithreadingTests : MultithreadingTestsBase { @@ -8,5 +7,4 @@ protected override string EngineName get { return "V8JsEngine"; } } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/V8/PrecompilationTests.cs b/test/JavaScriptEngineSwitcher.Tests/V8/PrecompilationTests.cs index a4137e81..fb3f7152 100644 --- a/test/JavaScriptEngineSwitcher.Tests/V8/PrecompilationTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/V8/PrecompilationTests.cs @@ -1,5 +1,4 @@ -#if NETFRAMEWORK || NETCOREAPP3_1_OR_GREATER -using System; +using System; using Xunit; @@ -20,7 +19,7 @@ protected override string EngineName #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringPrecompilationOfCodeIsCorrect() + public void MappingCompilationErrorDuringPrecompilationOfCode() { // Arrange const string input = @"function guid() { @@ -65,7 +64,7 @@ function s4() { } [Fact] - public void MappingRuntimeErrorDuringExecutionOfPrecompiledCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfPrecompiledCode() { // Arrange const string input = @"function getItem(items, itemIndex) { @@ -120,7 +119,7 @@ public void MappingRuntimeErrorDuringExecutionOfPrecompiledCodeIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"function makeId(length) { @@ -161,7 +160,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function getFullName(firstName, lastName) { @@ -208,5 +207,4 @@ public void GenerationOfRuntimeErrorMessageIsCorrect() #endregion } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/ValidationTests.cs b/test/JavaScriptEngineSwitcher.Tests/ValidationTests.cs index 55884ece..00d4aa58 100644 --- a/test/JavaScriptEngineSwitcher.Tests/ValidationTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/ValidationTests.cs @@ -7,7 +7,7 @@ namespace JavaScriptEngineSwitcher.Tests public class ValidationTests { [Fact] - public void NameFormatIsCorrect() + public void CheckingOfCorrectNameFormat() { // Arrange @@ -29,7 +29,7 @@ public void NameFormatIsCorrect() } [Fact] - public void NameFormatIsWrong() + public void CheckingOfWrongNameFormat() { // Arrange @@ -49,7 +49,7 @@ public void NameFormatIsWrong() } [Fact] - public void DocumentNameFormatIsCorrect() + public void CheckingOfCorrectDocumentNameFormat() { // Arrange @@ -73,7 +73,7 @@ public void DocumentNameFormatIsCorrect() } [Fact] - public void DocumentNameFormatIsWrong() + public void CheckingOfWrongDocumentNameFormat() { // Arrange diff --git a/test/JavaScriptEngineSwitcher.Tests/Vroom/CommonTests.cs b/test/JavaScriptEngineSwitcher.Tests/Vroom/CommonTests.cs index db0f5fe2..13c3d21d 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Vroom/CommonTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Vroom/CommonTests.cs @@ -17,7 +17,7 @@ protected override string EngineName #region Evaluation of code [Fact] - public override void EvaluationOfExpressionWithUndefinedResultIsCorrect() + public override void EvaluationOfExpressionWithUndefinedResult() { } #endregion @@ -25,7 +25,7 @@ public override void EvaluationOfExpressionWithUndefinedResultIsCorrect() #region Calling of functions [Fact] - public override void CallingOfFunctionWithUndefinedResultIsCorrect() + public override void CallingOfFunctionWithUndefinedResult() { } #endregion @@ -33,7 +33,7 @@ public override void CallingOfFunctionWithUndefinedResultIsCorrect() #region Getting, setting and removing variables [Fact] - public override void SettingAndGettingVariableWithUndefinedValueIsCorrect() + public override void SettingAndGettingVariableWithUndefinedValue() { } #endregion @@ -43,7 +43,7 @@ public override void SettingAndGettingVariableWithUndefinedValueIsCorrect() #region Mapping of errors [Fact] - public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingCompilationErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -79,7 +79,7 @@ public void MappingCompilationErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() + public void MappingRuntimeErrorDuringEvaluationOfExpression() { // Arrange const string input = @"var $variable1 = 611; @@ -116,7 +116,7 @@ public void MappingRuntimeErrorDuringEvaluationOfExpressionIsCorrect() } [Fact] - public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() + public void MappingCompilationErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -158,7 +158,7 @@ public void MappingCompilationErrorDuringExecutionOfCodeIsCorrect() } [Fact] - public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() + public void MappingRuntimeErrorDuringExecutionOfCode() { // Arrange const string input = @"function factorial(value) { @@ -205,7 +205,7 @@ public void MappingRuntimeErrorDuringExecutionOfCodeIsCorrect() #region Generation of error messages [Fact] - public void GenerationOfCompilationErrorMessageIsCorrect() + public void GenerationOfCompilationErrorMessage() { // Arrange const string input = @"var arr = []; @@ -235,7 +235,7 @@ public void GenerationOfCompilationErrorMessageIsCorrect() } [Fact] - public void GenerationOfRuntimeErrorMessageIsCorrect() + public void GenerationOfRuntimeErrorMessage() { // Arrange const string input = @"function foo(x, y) { diff --git a/test/JavaScriptEngineSwitcher.Tests/Vroom/Es5Tests.cs b/test/JavaScriptEngineSwitcher.Tests/Vroom/Es5Tests.cs index 4db8b382..6249d20c 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Vroom/Es5Tests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Vroom/Es5Tests.cs @@ -10,7 +10,7 @@ protected override string EngineName #region Object methods - public override void ObjectCreateMethodIsSupported() + public override void SupportsObjectCreateMethod() { } #endregion diff --git a/test/JavaScriptEngineSwitcher.Tests/Vroom/EvalTests.cs b/test/JavaScriptEngineSwitcher.Tests/Vroom/EvalTests.cs new file mode 100644 index 00000000..0e4d3cbe --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Vroom/EvalTests.cs @@ -0,0 +1,10 @@ +namespace JavaScriptEngineSwitcher.Tests.Vroom +{ + public class EvalTests : EvalTestsBase + { + protected override string EngineName + { + get { return "VroomJsEngine"; } + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Vroom/InteropTests.cs b/test/JavaScriptEngineSwitcher.Tests/Vroom/InteropTests.cs index 52338519..5cc43336 100644 --- a/test/JavaScriptEngineSwitcher.Tests/Vroom/InteropTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/Vroom/InteropTests.cs @@ -12,55 +12,61 @@ protected override string EngineName #region Objects with fields - public override void EmbeddingOfInstanceOfCustomValueTypeWithFieldsIsCorrect() + public override void EmbeddingOfInstanceOfCustomValueTypeWithFields() { } - public override void EmbeddingOfInstanceOfCustomReferenceTypeWithFieldsIsCorrect() + public override void EmbeddingOfInstanceOfCustomReferenceTypeWithFields() { } #endregion #region Objects with methods - public override void EmbeddingOfInstanceOfBuiltinReferenceTypeWithMethodIsCorrect() + public override void EmbeddingOfInstanceOfBuiltinReferenceTypeWithMethod() { } - public override void EmbeddingOfInstanceOfCustomReferenceTypeWithMethodIsCorrect() + public override void EmbeddingOfInstanceOfCustomReferenceTypeWithMethod() + { } + + public override void EmbeddingOfInstanceOfAssemblyTypeAndCallingOfItsCreateInstanceMethod() { } #endregion #region Delegates - public override void EmbeddingOfInstanceOfDelegateWithoutParametersIsCorrect() + public override void EmbeddingOfInstanceOfDelegateWithoutParameters() + { } + + public override void EmbeddingOfInstanceOfDelegateWithOneParameter() { } - public override void EmbeddingOfInstanceOfDelegateWithOneParameterIsCorrect() + public override void EmbeddingOfInstanceOfDelegateWithTwoParameters() { } - public override void EmbeddingOfInstanceOfDelegateWithTwoParametersIsCorrect() + public override void EmbeddingOfInstanceOfDelegateWithoutResult() { } - public override void EmbeddingOfInstanceOfDelegateWithoutResultIsCorrect() + public override void EmbeddingOfInstanceOfDelegateAndCheckingItsPrototype() { } - public override void EmbeddedInstanceOfDelegateHasFunctionPrototype() + public override void EmbeddingOfInstanceOfDelegateAndCallingItWithMissingParameter() { } - public override void CallingOfEmbeddedDelegateWithMissingParameter() + public override void EmbeddingOfInstanceOfDelegateAndCallingItWithExtraParameter() { } - public override void CallingOfEmbeddedDelegateWithExtraParameter() + public override void EmbeddingOfInstanceOfDelegateAndGettingItsMethodProperty() { } #endregion #region Recursive calls - public override void RecursiveExecutionOfFilesIsCorrect() + public override void RecursiveExecutionOfFiles() { } - public override void RecursiveEvaluationOfFilesIsCorrect() + public override void RecursiveEvaluationOfFiles() { } #endregion @@ -72,17 +78,23 @@ public override void RecursiveEvaluationOfFilesIsCorrect() #region Types with fields - public override void EmbeddingOfBuiltinValueTypeWithFieldIsCorrect() + public override void EmbeddingOfBuiltinValueTypeWithField() { } - public override void EmbeddingOfCustomReferenceTypeWithFieldIsCorrect() + public override void EmbeddingOfCustomReferenceTypeWithField() { } #endregion #region Types with methods - public override void EmbeddingOfBuiltinReferenceTypeWithMethodsIsCorrect() + public override void EmbeddingOfBuiltinReferenceTypeWithMethods() + { } + + public override void EmbeddingOfTypeAndCallingOfItsGetTypeMethod() + { } + + public override void EmbeddingOfAssemblyTypeAndCallingOfItsLoadMethod() { } #endregion diff --git a/test/JavaScriptEngineSwitcher.Tests/Yantra/CommonTests.cs b/test/JavaScriptEngineSwitcher.Tests/Yantra/CommonTests.cs new file mode 100644 index 00000000..077244f9 --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Yantra/CommonTests.cs @@ -0,0 +1,302 @@ +using System; + +using Xunit; + +using JavaScriptEngineSwitcher.Core; + +namespace JavaScriptEngineSwitcher.Tests.Yantra +{ + public class CommonTests : CommonTestsBase + { + protected override string EngineName + { + get { return "YantraJsEngine"; } + } + + + #region Error handling + + #region Mapping of errors + + [Fact] + public void MappingCompilationErrorDuringEvaluationOfExpression() + { + // Arrange + const string input = @"var $variable1 = 611; +var _variable2 = 711; +var @variable3 # 678; + +$variable1 + _variable2 - @variable3;"; + + JsCompilationException exception = null; + + // Act + using (var jsEngine = CreateJsEngine()) + { + try + { + int result = jsEngine.Evaluate(input, "variables.js"); + } + catch (JsCompilationException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Compilation error", exception.Category); + Assert.Equal("Unexpected token Hash: #", exception.Description); + Assert.Equal("SyntaxError", exception.Type); + Assert.Equal("variables.js", exception.DocumentName); + Assert.Equal(3, exception.LineNumber); + Assert.Equal(15, exception.ColumnNumber); + Assert.Empty(exception.SourceFragment); + } + + [Fact] + public void MappingRuntimeErrorDuringEvaluationOfExpression() + { + // Arrange + const string input = @"var $variable1 = 611; +var _variable2 = 711; +var variable3 = 678; + +$variable1 + _variable2() - variable3;"; + + JsRuntimeException exception = null; + + // Act + using (var jsEngine = CreateJsEngine()) + { + try + { + int result = jsEngine.Evaluate(input, "variables.js"); + } + catch (JsRuntimeException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("711 is not a function", exception.Description); + Assert.Equal("TypeError", exception.Type); + Assert.Equal("variables.js", exception.DocumentName); + Assert.Equal(5, exception.LineNumber); + Assert.Equal(0, exception.ColumnNumber); + Assert.Empty(exception.SourceFragment); + Assert.Equal(" at Global code (variables.js:5)", exception.CallStack); + } + + [Fact] + public void MappingCompilationErrorDuringExecutionOfCode() + { + // Arrange + const string input = @"function factorial(value) { + if (value <= 0) { + throw new Error(""The value must be greater than or equal to zero.""); + } + + return value !== 1 ? value * factorial(value - 1) : 1; +} + +factorial(5); +factorial(%2); +factorial(0);"; + + JsCompilationException exception = null; + + // Act + using (var jsEngine = CreateJsEngine()) + { + try + { + jsEngine.Execute(input, "factorial.js"); + } + catch (JsCompilationException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Compilation error", exception.Category); + Assert.Equal("Unexpected token Mod: %", exception.Description); + Assert.Equal("SyntaxError", exception.Type); + Assert.Equal("factorial.js", exception.DocumentName); + Assert.Equal(10, exception.LineNumber); + Assert.Equal(10, exception.ColumnNumber); + Assert.Empty(exception.SourceFragment); + } + + [Fact] + public void MappingRuntimeErrorDuringExecutionOfCode() + { + // Arrange + const string input = @"function factorial(value) { + if (value <= 0) { + throw new Error(""The value must be greater than or equal to zero.""); + } + + return value !== 1 ? value * factorial(value - 1) : 1; +} + +factorial(5); +factorial(-1); +factorial(0);"; + + JsRuntimeException exception = null; + + // Act + using (var jsEngine = CreateJsEngine()) + { + try + { + jsEngine.Execute(input, "factorial.js"); + } + catch (JsRuntimeException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("The value must be greater than or equal to zero.", exception.Description); + Assert.Equal("Error", exception.Type); + Assert.Equal("factorial.js", exception.DocumentName); + Assert.Equal(3, exception.LineNumber); + Assert.Equal(2, exception.ColumnNumber); + Assert.Empty(exception.SourceFragment); + Assert.Equal( + " at factorial (factorial.js:3:2)" + Environment.NewLine + + " at Global code (factorial.js:10)", + exception.CallStack + ); + } + + [Fact] + public void MappingRuntimeErrorDuringStackOverflow() + { + // Arrange + const string input = @"var i = 0; + +function recursive() { + i++; + recursive(); +} + +recursive();"; + + JsRuntimeException exception = null; + + // Act + using (var jsEngine = CreateJsEngine()) + { + try + { + jsEngine.Execute(input, "recursive.js"); + } + catch (JsRuntimeException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Maximum call stack size exceeded", exception.Description); + Assert.Equal("RangeError", exception.Type); + Assert.Equal("recursive.js", exception.DocumentName); + Assert.Equal(5, exception.LineNumber); + Assert.Equal(1, exception.ColumnNumber); + Assert.Empty(exception.SourceFragment); + } + + #endregion + + #region Generation of error messages + + [Fact] + public void GenerationOfCompilationErrorMessage() + { + // Arrange + const string input = @"var arr = []; +var obj = {}; +var foo = 'Browser's bar;"; + string targetOutput = "SyntaxError: Undefined binary operation Identifier" + Environment.NewLine + + " at variables.js:3:1" + ; + + JsCompilationException exception = null; + + // Act + using (var jsEngine = CreateJsEngine()) + { + try + { + jsEngine.Execute(input, "variables.js"); + } + catch (JsCompilationException e) + { + exception = e; + } + } + + Assert.NotNull(exception); + Assert.Equal(targetOutput, exception.Message); + } + + [Fact] + public void GenerationOfRuntimeErrorMessage() + { + // Arrange + const string input = @"function foo(x, y) { + var z = x + y; + if (z > 20) { + bar(); + } +} + +(function (foo) { + var a = 8; + var b = 15; + + foo(a, b); +})(foo);"; + string targetOutput = "TypeError: undefined is not a function" + Environment.NewLine + + " at foo (functions.js:4:2)" + Environment.NewLine + + " at Anonymous function (functions.js:12:1)" + Environment.NewLine + + " at Global code (functions.js:8)" + ; + + JsRuntimeException exception = null; + + // Act + using (var jsEngine = CreateJsEngine()) + { + try + { + jsEngine.Execute(input, "functions.js"); + } + catch (JsRuntimeException e) + { + exception = e; + } + } + + Assert.NotNull(exception); + Assert.Equal(targetOutput, exception.Message); + } + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Yantra/ConsoleTests.cs b/test/JavaScriptEngineSwitcher.Tests/Yantra/ConsoleTests.cs new file mode 100644 index 00000000..0a6ccdd7 --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Yantra/ConsoleTests.cs @@ -0,0 +1,237 @@ +using System; +using System.Globalization; +using System.Text; + +using Xunit; + +using JavaScriptEngineSwitcher.Core; +using JavaScriptEngineSwitcher.Yantra; + +namespace JavaScriptEngineSwitcher.Tests.Yantra +{ + public class ConsoleTests + { + private IJsEngine CreateJsEngine(YantraJsConsoleCallback consoleCallback) + { + var jsEngine = new YantraJsEngine(new YantraSettings + { + ConsoleCallback = consoleCallback + }); + + return jsEngine; + } + + [Fact] + public void SupportsConsoleLogMethod() + { + // Arrange + Type favoriteSchoolSubject = typeof(Math); + var wikipediaPageUrl = new Uri("https://ru.wikipedia.org/wiki/%D0%92%D0%B0%D1%81%D1%8F_" + + "%D0%9F%D1%83%D0%BF%D0%BA%D0%B8%D0%BD"); + var sb = new StringBuilder(); + var logger = new StringLogger(sb); + + const string input = @"var id = Symbol('id'), + name = 'Василий Пупкин', + address = { city: 'Тамбов', street: 'Магистральная', ""houseNumber"": '41к7', apartmentNumber: 115 }, + dateOfBirth = new Date(1990, 2, 15), + isSingle = true, + salary = 22000.82, + email = null, + website = undefined, + icq = 698426795, + pets = ['Мурзик', 'Шарик'] + ; + +console.log(website, email, address, pets, isSingle, icq, salary, name, id, dateOfBirth); + +function calculateIncomeTax(salary) { + var result = salary * 0.13; + + return result; +} + +console.log('Функция для расчета подоходного налога:', calculateIncomeTax); +console.log('Папа у Васи силен в', favoriteSchoolSubject); +console.log('Страница в Википедии:', wikipediaPageUrl);"; + string targetOutput = "undefined null {\"city\":\"Тамбов\",\"street\":\"Магистральная\"," + + "\"houseNumber\":\"41к7\",\"apartmentNumber\":115} [\"Мурзик\",\"Шарик\"] True 698426795 22000.82 " + + "Василий Пупкин Symbol(id) 1990-03-14T21:00:00.0000000Z" + Environment.NewLine + + "Функция для расчета подоходного налога: [Function: calculateIncomeTax]" + Environment.NewLine + + "Папа у Васи силен в System.Math" + Environment.NewLine + + "Страница в Википедии: https://ru.wikipedia.org/wiki/Вася_Пупкин" + Environment.NewLine + ; + + // Act + using (var jsEngine = CreateJsEngine(consoleCallback: logger.Log)) + { + jsEngine.EmbedHostType("favoriteSchoolSubject", favoriteSchoolSubject); + jsEngine.EmbedHostObject("wikipediaPageUrl", wikipediaPageUrl); + jsEngine.Execute(input); + } + + string output = sb.ToString(); + + logger.Dispose(); + sb.Clear(); + + // Assert + Assert.Equal(targetOutput, output); + } + + [Fact] + public void SupportsConsoleInfoMethod() + { + // Arrange + var sb = new StringBuilder(); + var logger = new StringLogger(sb); + + const string input = @"var driveLetter = 'C', availableDiskSpace = 237; + +console.info('There are', availableDiskSpace, 'megabytes available on', driveLetter, 'drive.'); +console.info('Everything is going according to plan.'); +console.info(driveLetter, 'drive has been formatted successfully!');"; + + // Act + IJsEngine jsEngine = null; + JsRuntimeException exception = null; + + try + { + jsEngine = CreateJsEngine(consoleCallback: logger.Log); + jsEngine.Execute(input); + } + catch (JsRuntimeException e) + { + exception = e; + } + finally + { + jsEngine?.Dispose(); + logger.Dispose(); + sb.Clear(); + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Method info not found in YantraJS.Core.Debug.JSConsole", exception.Description); + } + + [Fact] + public void SupportsConsoleWarnMethod() + { + // Arrange + var sb = new StringBuilder(); + var logger = new StringLogger(sb); + + const string input = @"console.warn('Watch out, the doors are closing!'); +console.warn('Watch yourself,', 'be careful!'); +console.warn('It is forbidden to watch!');"; + string targetOutput = "warn: Watch out, the doors are closing!" + Environment.NewLine + + "warn: Watch yourself, be careful!" + Environment.NewLine + + "warn: It is forbidden to watch!" + Environment.NewLine + ; + + // Act + using (var jsEngine = CreateJsEngine(consoleCallback: logger.Log)) + { + jsEngine.Execute(input); + } + + string output = sb.ToString(); + + logger.Dispose(); + sb.Clear(); + + // Assert + Assert.Equal(targetOutput, output); + } + + [Fact] + public void SupportsConsoleErrorMethod() + { + // Arrange + var sb = new StringBuilder(); + var logger = new StringLogger(sb); + + const string input = @"console.error('A terrible thing happened!');"; + string targetOutput = "error: A terrible thing happened!" + Environment.NewLine; + + // Act + using (var jsEngine = CreateJsEngine(consoleCallback: logger.Log)) + { + jsEngine.Execute(input); + } + + string output = sb.ToString(); + + logger.Dispose(); + sb.Clear(); + + // Assert + Assert.Equal(targetOutput, output); + } + + private sealed class StringLogger : IDisposable + { + private StringBuilder _buffer; + + + public StringLogger(StringBuilder buffer) + { + _buffer = buffer; + } + + + public void Log(string type, object[] args) + { + if (type != "log") + { + _buffer.AppendFormat("{0}: ", type); + } + + for (int argIndex = 0; argIndex < args.Length; argIndex++) + { + if (argIndex > 0) + { + _buffer.Append(" "); + } + + object arg = args[argIndex] ?? "null"; + var formattableArg = arg as IFormattable; + + if (formattableArg != null) + { + if (formattableArg is DateTime) + { + var dateTime = (DateTime)formattableArg; + DateTime universalDateTime = dateTime.ToUniversalTime(); + + _buffer.Append(universalDateTime.ToString("O", CultureInfo.InvariantCulture)); + } + else + { + _buffer.Append(formattableArg.ToString("G", CultureInfo.InvariantCulture)); + } + } + else + { + _buffer.Append(arg.ToString()); + } + } + + _buffer.AppendLine(); + } + + #region IDisposable implementation + + public void Dispose() + { + _buffer = null; + } + + #endregion + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Yantra/Es2015Tests.cs b/test/JavaScriptEngineSwitcher.Tests/Yantra/Es2015Tests.cs new file mode 100644 index 00000000..9b70b4da --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Yantra/Es2015Tests.cs @@ -0,0 +1,21 @@ +using Xunit; + +namespace JavaScriptEngineSwitcher.Tests.Yantra +{ + public class Es2015Tests : Es2015TestsBase + { + protected override string EngineName + { + get { return "YantraJsEngine"; } + } + + + #region Promises + + [Fact] + public override void SupportsPromises() + { } + + #endregion + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Yantra/Es5Tests.cs b/test/JavaScriptEngineSwitcher.Tests/Yantra/Es5Tests.cs new file mode 100644 index 00000000..da0fea34 --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Yantra/Es5Tests.cs @@ -0,0 +1,10 @@ +namespace JavaScriptEngineSwitcher.Tests.Yantra +{ + public class Es5Tests : Es5TestsBase + { + protected override string EngineName + { + get { return "YantraJsEngine"; } + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Yantra/EvalTests.cs b/test/JavaScriptEngineSwitcher.Tests/Yantra/EvalTests.cs new file mode 100644 index 00000000..3a34bbe0 --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Yantra/EvalTests.cs @@ -0,0 +1,10 @@ +namespace JavaScriptEngineSwitcher.Tests.Yantra +{ + public class EvalTests : EvalTestsBase + { + protected override string EngineName + { + get { return "YantraJsEngine"; } + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Yantra/InteropTests.cs b/test/JavaScriptEngineSwitcher.Tests/Yantra/InteropTests.cs new file mode 100644 index 00000000..7a2ad049 --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Yantra/InteropTests.cs @@ -0,0 +1,534 @@ +using System; +using System.IO; + +using Xunit; + +using JavaScriptEngineSwitcher.Core; + +using JavaScriptEngineSwitcher.Tests.Interop; +using JavaScriptEngineSwitcher.Tests.Interop.Animals; +using JavaScriptEngineSwitcher.Tests.Interop.Logging; + +namespace JavaScriptEngineSwitcher.Tests.Yantra +{ + public class InteropTests : InteropTestsBase + { + protected override string EngineName + { + get { return "YantraJsEngine"; } + } + + + #region Embedding of objects + + #region Objects with fields + + [Fact] + public override void EmbeddingOfInstanceOfCustomValueTypeWithFields() + { + // Arrange + var date = new Date(2015, 12, 29); + + const string input1 = "date.Year"; + const int targetOutput1 = 2015; + + const string input2 = "date.Month"; + const int targetOutput2 = 12; + + const string input3 = "date.Day"; + const int targetOutput3 = 29; + + // Act + int output1; + int output2; + int output3; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostObject("date", date); + + output1 = jsEngine.Evaluate(input1); + output2 = jsEngine.Evaluate(input2); + output3 = jsEngine.Evaluate(input3); + } + + // Assert + Assert.Equal(targetOutput1, output1); + Assert.Equal(targetOutput2, output2); + Assert.Equal(targetOutput3, output3); + } + + [Fact] + public override void EmbeddingOfInstanceOfCustomReferenceTypeWithFields() + { + // Arrange + var product = new Product + { + Name = "Red T-shirt", + Description = string.Empty, + Price = 995.00 + }; + + const string updateCode = @"product.Description = ''; +product.Price *= 1.15;"; + + const string input1 = "product.Name"; + const string targetOutput1 = "Red T-shirt"; + + const string input2 = "product.Price"; + const double targetOutput2 = 1144.25; + + // Act + string output1; + double output2; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostObject("product", product); + jsEngine.Execute(updateCode); + + output1 = jsEngine.Evaluate(input1); + output2 = jsEngine.Evaluate(input2); + } + + // Assert + Assert.Equal(targetOutput1, output1); + Assert.Equal(targetOutput2, output2); + } + + #endregion + + #region Objects with properties + + [Fact] + public override void EmbeddingOfInstanceOfBuiltinValueTypeWithProperties() + { } + + [Fact] + public override void EmbeddingOfInstanceOfCustomValueTypeWithProperties() + { } + + [Fact] + public override void EmbeddingOfInstanceOfCustomReferenceTypeWithProperties() + { + // Arrange + var person = new Person("Vanya", "Ivanov"); + const string updateCode = @"person.LastName = person.LastName.substr(0, 5) + 'ff'; +person.Patronymic = '';"; + + const string input1 = "person.FirstName"; + const string targetOutput1 = "Vanya"; + + const string input2 = "person.LastName"; + const string targetOutput2 = "Ivanoff"; + + // Act + string output1; + string output2; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostObject("person", person); + jsEngine.Execute(updateCode); + + output1 = jsEngine.Evaluate(input1); + output2 = jsEngine.Evaluate(input2); + } + + // Assert + Assert.Equal(targetOutput1, output1); + Assert.Equal(targetOutput2, output2); + } + + #endregion + + #region Objects with methods + + [Fact] + public override void EmbeddingOfInstanceOfCustomValueTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + var date = new Date(); + + const string input = "date.GetType();"; + + // Act + JsRuntimeException exception = null; + + using (var jsEngine = CreateJsEngine()) + { + try + { + jsEngine.EmbedHostObject("date", date); + jsEngine.Evaluate(input); + } + catch (JsRuntimeException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Method GetType not found in JavaScriptEngineSwitcher.Tests.Interop.Date", exception.Description); + } + + [Fact] + public override void EmbeddingOfInstanceOfCustomReferenceTypeAndCallingOfItsGetTypeMethod() + { + // Arrange + var cat = new Cat(); + + const string input = @"cat.GetType();"; + + // Act + JsRuntimeException exception = null; + + using (var jsEngine = CreateJsEngine()) + { + try + { + jsEngine.EmbedHostObject("cat", cat); + jsEngine.Evaluate(input); + } + catch (JsRuntimeException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Runtime error", exception.Category); + Assert.Equal("Method GetType not found in JavaScriptEngineSwitcher.Tests.Interop.Animals.Cat", exception.Description); + } + + #endregion + + #region Recursive calls + + #region Mapping of errors + + [Fact] + public void MappingCompilationErrorDuringRecursiveEvaluationOfFiles() + { + // Arrange + const string directoryPath = "Files/recursive-evaluation/compilation-error"; + const string input = "evaluateFile('index').calculateResult();"; + const double targetOutput = 132; + + // Act + double output; + + using (var jsEngine = CreateJsEngine()) + { + Func evaluateFile = path => { + string absolutePath = Path.Combine(directoryPath, $"{path}.js"); + string code = File.ReadAllText(absolutePath); + object result = jsEngine.Evaluate(code, absolutePath); + + return result; + }; + + jsEngine.EmbedHostObject("evaluateFile", evaluateFile); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + + [Fact] + public void MappingRuntimeErrorDuringRecursiveEvaluationOfFiles() + { + // Arrange + const string directoryPath = "Files/recursive-evaluation/runtime-error"; + const string input = "evaluateFile('index').calculateResult();"; + const double targetOutput = double.NaN; + + // Act + double output; + + using (var jsEngine = CreateJsEngine()) + { + Func evaluateFile = path => { + string absolutePath = Path.Combine(directoryPath, $"{path}.js"); + string code = File.ReadAllText(absolutePath); + object result = jsEngine.Evaluate(code, absolutePath); + + return result; + }; + + jsEngine.EmbedHostObject("evaluateFile", evaluateFile); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + + [Fact] + public void MappingHostErrorDuringRecursiveEvaluationOfFiles() + { + // Arrange + const string directoryPath = "Files/recursive-evaluation/host-error"; + const string input = "evaluateFile('index').calculateResult();"; + + // Act + JsRuntimeException exception = null; + + using (var jsEngine = CreateJsEngine()) + { + try + { + Func evaluateFile = path => { + string absolutePath = Path.Combine(directoryPath, $"{path}.js"); + string code = File.ReadAllText(absolutePath); + object result = jsEngine.Evaluate(code, absolutePath); + + return result; + }; + + jsEngine.EmbedHostObject("evaluateFile", evaluateFile); + double output = jsEngine.Evaluate(input); + } + catch (JsRuntimeException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Runtime error", exception.Category); + Assert.StartsWith("System.IO.FileNotFoundException: Could not find file ", exception.Description); + Assert.Equal("Error", exception.Type); + Assert.Equal("index.js", exception.DocumentName); + Assert.Equal(6, exception.LineNumber); + Assert.Equal(2, exception.ColumnNumber); + Assert.Empty(exception.SourceFragment); + Assert.Equal( + " at calculateResult (index.js:6:2)" + Environment.NewLine + + " at Global code (Script Document:1:1)", + exception.CallStack + ); + } + + [Fact] + public void MappingCompilationErrorDuringRecursiveExecutionOfFiles() + { + // Arrange + const string directoryPath = "Files/recursive-execution/compilation-error"; + const string variableName = "num"; + + // Act + JsCompilationException exception = null; + + using (var jsEngine = CreateJsEngine()) + { + try + { + Action executeFile = path => jsEngine.ExecuteFile(path); + + jsEngine.SetVariableValue("directoryPath", directoryPath); + jsEngine.EmbedHostObject("executeFile", executeFile); + jsEngine.ExecuteFile(Path.Combine(directoryPath, "main-file.js")); + + int output = jsEngine.GetVariableValue(variableName); + } + catch (JsCompilationException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Compilation error", exception.Category); + Assert.Equal("Unexpected token Hash: #", exception.Description); + Assert.Equal("SyntaxError", exception.Type); + Assert.Equal("second-file.js", exception.DocumentName); + Assert.Equal(1, exception.LineNumber); + Assert.Equal(6, exception.ColumnNumber); + Assert.Empty(exception.SourceFragment); + } + + [Fact] + public void MappingRuntimeErrorDuringRecursiveExecutionOfFiles() + { + // Arrange + const string directoryPath = "Files/recursive-execution/runtime-error"; + const string variableName = "num"; + const int targetOutput = 15; + + // Act + int output; + + using (var jsEngine = CreateJsEngine()) + { + Action executeFile = path => jsEngine.ExecuteFile(path); + + jsEngine.SetVariableValue("directoryPath", directoryPath); + jsEngine.EmbedHostObject("executeFile", executeFile); + jsEngine.ExecuteFile(Path.Combine(directoryPath, "main-file.js")); + + output = jsEngine.GetVariableValue(variableName); + } + + // Assert + Assert.Equal(targetOutput, output); + } + + [Fact] + public void MappingHostErrorDuringRecursiveExecutionOfFiles() + { + // Arrange + const string directoryPath = "Files/recursive-execution/host-error"; + const string variableName = "num"; + + // Act + JsRuntimeException exception = null; + + using (var jsEngine = CreateJsEngine()) + { + try + { + Action executeFile = path => jsEngine.ExecuteFile(path); + + jsEngine.SetVariableValue("directoryPath", directoryPath); + jsEngine.EmbedHostObject("executeFile", executeFile); + jsEngine.ExecuteFile(Path.Combine(directoryPath, "main-file.js")); + + int output = jsEngine.GetVariableValue(variableName); + } + catch (JsRuntimeException e) + { + exception = e; + } + } + + // Assert + Assert.NotNull(exception); + Assert.Equal("Runtime error", exception.Category); + Assert.StartsWith("System.IO.FileNotFoundException: File ", exception.Description); + Assert.Equal("Error", exception.Type); + Assert.Equal("first-file.js", exception.DocumentName); + Assert.Equal(2, exception.LineNumber); + Assert.Equal(0, exception.ColumnNumber); + Assert.Empty(exception.SourceFragment); + Assert.Equal( + " at Global code (first-file.js:2)" + Environment.NewLine + + " at Global code (main-file.js:2)", + exception.CallStack + ); + } + + #endregion + + #endregion + + #endregion + + + #region Embedding of types + + #region Creating of instances + + [Fact] + public override void CreatingAnInstanceOfEmbeddedBuiltinValueType() + { } + + [Fact] + public override void CreatingAnInstanceOfEmbeddedCustomExceptionAndCallingOfItsGetTypeMethod() + { + // Arrange + Type loginFailedExceptionType = typeof(LoginFailedException); + + const string input = "new LoginFailedError(\"Wrong password entered!\").GetType();"; + string targetOutput = "function LoginFailedException() { [clr-native] }"; + + // Act + string output; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostType("LoginFailedError", loginFailedExceptionType); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.Equal(targetOutput, output); + } + + #endregion + + #region Types with fields + + [Fact] + public override void EmbeddingOfCustomReferenceTypeWithField() + { + // Arrange + Type defaultLoggerType = typeof(DefaultLogger); + + const string input = "DefaultLogger.Current.ToString()"; + const string targetOutput = "[null logger]"; + + // Act + string output; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostType("DefaultLogger", defaultLoggerType); + + lock (DefaultLogger.SyncRoot) + { + output = jsEngine.Evaluate(input); + } + } + + // Assert + Assert.Equal(targetOutput, output); + } + + #endregion + + #region Types with methods + + [Fact] + public override void EmbeddingOfBuiltinReferenceTypeWithMethods() + { + // Arrange + Type mathType = typeof(Math); + + const string input1 = "Math2.Max(5.37, 5.56)"; + const double targetOutput1 = 5; + + const string input2 = "Math2.Log10(23)"; + const double targetOutput2 = 1.36172783601759; + + // Act + double output1; + double output2; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostType("Math2", mathType); + output1 = jsEngine.Evaluate(input1); + output2 = Math.Round(jsEngine.Evaluate(input2), 14); + } + + // Assert + Assert.Equal(targetOutput1, output1); + Assert.Equal(targetOutput2, output2); + } + + [Fact] + public override void EmbeddingOfTypeAndCallingOfItsGetTypeMethod() + { } + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Yantra/MultithreadingTests.cs b/test/JavaScriptEngineSwitcher.Tests/Yantra/MultithreadingTests.cs new file mode 100644 index 00000000..3cbf2a6b --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Yantra/MultithreadingTests.cs @@ -0,0 +1,10 @@ +namespace JavaScriptEngineSwitcher.Tests.Yantra +{ + public class MultithreadingTests : MultithreadingTestsBase + { + protected override string EngineName + { + get { return "YantraJsEngine"; } + } + } +} \ No newline at end of file diff --git a/test/JavaScriptEngineSwitcher.Tests/Yantra/PrecompilationTests.cs b/test/JavaScriptEngineSwitcher.Tests/Yantra/PrecompilationTests.cs new file mode 100644 index 00000000..86713d2e --- /dev/null +++ b/test/JavaScriptEngineSwitcher.Tests/Yantra/PrecompilationTests.cs @@ -0,0 +1,10 @@ +namespace JavaScriptEngineSwitcher.Tests.Yantra +{ + public class PrecompilationTests : PrecompilationTestsBase + { + protected override string EngineName + { + get { return "YantraJsEngine"; } + } + } +} \ No newline at end of file