private MsieJsEngine SetupJsEngine()
        {
            var jsEngine = new MsieJsEngine();
            try
            {
                using (var sr = new StreamReader(
                    typeof(TypeScriptParserTests).Assembly.GetManifestResourceStream(
                        "Serenity.Test.CodeGeneration.TypeScriptParserTests.typescriptServices.js")))
                {
                    jsEngine.Evaluate(sr.ReadToEnd());
                }

                using (var sr = new StreamReader(
                    typeof(DtoGenerator).Assembly.GetManifestResourceStream(
                        "Serenity.Web.Scripts.tsservices.Serenity.CodeGeneration.js")))
                {
                    jsEngine.Evaluate(sr.ReadToEnd());
                }

                return jsEngine;
            }
            catch
            {
                jsEngine.Dispose();
                throw;
            }
        }
Example #2
0
		public override void SetUp()
		{
			_jsEngine = new MsieJsEngine(new JsEngineSettings
			{
				EngineMode = JsEngineMode.Auto,
				UseEcmaScript5Polyfill = true,
				UseJson2Library = true
			});
		}
Example #3
0
        public Markdownify(Options options, RenderMethods rendereMethods, MsieJsEngine engine)
        {
            this.engine = engine;
            var markedJsText = GetMarkedJsText();
            engine.Execute(markedJsText);

            var js = GetContructionJs(options, rendereMethods);
            engine.Execute(js);
        }
Example #4
0
		public override void SetUp()
		{
			_jsEngine = new MsieJsEngine(new JsEngineSettings
			{
				EngineMode = JsEngineMode.ChakraActiveScript,
				UseEcmaScript5Polyfill = false,
				UseJson2Library = false
			});
		}
		protected override MsieJsEngine CreateJsEngine()
		{
			var jsEngine = new MsieJsEngine(new JsEngineSettings
			{
				EngineMode = JsEngineMode.Classic,
				UseEcmaScript5Polyfill = true,
				UseJson2Library = true
			});

			return jsEngine;
		}
Example #6
0
        /// <summary>
        /// Initializes compiler
        /// </summary>
        private void Initialize()
        {
            if(!_initialized)
            {
                _jsEngine = new MsieJsEngine(true);
                _jsEngine.ExecuteResource(HOGAN_LIBRARY_RESOURCE_NAME, GetType());
                _jsEngine.Execute(string.Format("var {0} = function (template) {{return Hogan.compile(template, {{ asString: 1 }});}};", COMPILATION_FUNCTION_NAME));

                _initialized = true;
            }
        }
        protected override MsieJsEngine CreateJsEngine()
        {
            var jsEngine = new MsieJsEngine(new JsEngineSettings
            {
                EngineMode = JsEngineMode.ChakraEdgeJsRt,
                UseEcmaScript5Polyfill = false,
                UseJson2Library = false
            });

            return jsEngine;
        }
        /// <summary>
        /// Initializes compiler
        /// </summary>
        private void Initialize()
        {
            if (!_initialized)
            {
                _jsEngine = new MsieJsEngine(true);
                _jsEngine.ExecuteResource(COFFEESCRIPT_LIBRARY_RESOURCE_NAME, GetType());
                _jsEngine.Execute(string.Format(@"var {0} = function(code) {{ 	return CoffeeScript.compile(code, {{ bare: false }});}}", COMPILATION_FUNCTION_NAME));

                _initialized = true;
            }
        }
Example #9
0
 public override void SetUp()
 {
     _jsEngine = new MsieJsEngine(JsEngineMode.Auto, true, true);
 }
Example #10
0
 public override void SetUp()
 {
     _jsEngine = new MsieJsEngine(JsEngineMode.ChakraActiveScript, false, false);
 }
 public void SetUp()
 {
     _msieJsEngine = new MsieJsEngine(true, true);
 }
Example #12
0
        private static MsieJsEngine SetupJsEngine()
        {
            var jsEngine = new MsieJsEngine();
            try
            {
                using (var sr = new StreamReader(
                    typeof(ScriptBundleManager).Assembly.GetManifestResourceStream(
                        "Serenity.Web.Scripts.optimization.uglifyjs.min.js")))
                {
                    jsEngine.Evaluate(sr.ReadToEnd());
                }

                return jsEngine;
            }
            catch
            {
                jsEngine.Dispose();
                throw;
            }
        }
Example #13
0
        private static string MinimizeWithUglifyJS(ref MsieJsEngine jsEngine, string code)
        {
            jsEngine = jsEngine ?? SetupJsEngine();
            jsEngine.SetVariableValue("CodeToCompress", code);

            jsEngine.Evaluate(
                @"(function() {
                    var ast = UglifyJS.parse(CodeToCompress);
                    ast.figure_out_scope();
                    var compressor = UglifyJS.Compressor();
                    ast = ast.transform(compressor);
                    ast.figure_out_scope();
                    ast.compute_char_frequency();
                    ast.mangle_names();
                    CodeToCompress = ast.print_to_string();
                })();");

            return jsEngine.GetVariableValue<string>("CodeToCompress");
        }
Example #14
0
 public override void SetUp()
 {
     _jsEngine = new MsieJsEngine(JsEngineMode.Auto, false, false);
 }
 public void TearDown()
 {
     if (_msieJsEngine != null)
     {
         _msieJsEngine.Dispose();
         _msieJsEngine = null;
     }
 }
 public virtual void TearDown()
 {
     if (_jsEngine != null)
     {
         _jsEngine.Dispose();
         _jsEngine = null;
     }
 }
Example #17
0
 public override void SetUp()
 {
     _jsEngine = new MsieJsEngine(JsEngineMode.ChakraJsRt);
 }