Microsoft Ajax JS Minifier settings
Inheritance: WebMarkupMin.MsAjax.MsAjaxCommonMinificationSettingsBase
        /// <summary>
        /// Maps a JS settings
        /// </summary>
        /// <param name="jsParserSettings">JS-code parser settings</param>
        /// <param name="jsMinifierSettings">Microsoft JS Minifier settings</param>
        private static void MapJsSettings(CodeSettings jsParserSettings, MsAjaxJsMinificationSettings jsMinifierSettings)
        {
            MapCommonSettings(jsParserSettings, jsMinifierSettings);

            jsParserSettings.AlwaysEscapeNonAscii   = jsMinifierSettings.AlwaysEscapeNonAscii;
            jsParserSettings.AmdSupport             = jsMinifierSettings.AmdSupport;
            jsParserSettings.CollapseToLiteral      = jsMinifierSettings.CollapseToLiteral;
            jsParserSettings.ConstStatementsMozilla = jsMinifierSettings.ConstStatementsMozilla;
            jsParserSettings.DebugLookupList        = jsMinifierSettings.DebugLookupList;
            jsParserSettings.ErrorIfNotInlineSafe   = jsMinifierSettings.ErrorIfNotInlineSafe;
            jsParserSettings.EvalLiteralExpressions = jsMinifierSettings.EvalLiteralExpressions;
            jsParserSettings.EvalTreatment          = Utils.GetEnumFromOtherEnum <WmmEvalTreatment, MsEvalTreatment>(
                jsMinifierSettings.EvalTreatment);
            jsParserSettings.IgnoreConditionalCompilation = jsMinifierSettings.IgnoreConditionalCompilation;
            jsParserSettings.IgnorePreprocessorDefines    = jsMinifierSettings.IgnorePreprocessorDefines;
            jsParserSettings.InlineSafeStrings            = jsMinifierSettings.InlineSafeStrings;
            jsParserSettings.KnownGlobalNamesList         = jsMinifierSettings.KnownGlobalNamesList;
            jsParserSettings.LocalRenaming = Utils.GetEnumFromOtherEnum <WmmLocalRenaming, MsLocalRenaming>(
                jsMinifierSettings.LocalRenaming);
            jsParserSettings.MacSafariQuirks               = jsMinifierSettings.MacSafariQuirks;
            jsParserSettings.ManualRenamesProperties       = jsMinifierSettings.ManualRenamesProperties;
            jsParserSettings.NoAutoRenameList              = jsMinifierSettings.NoAutoRenameList;
            jsParserSettings.PreserveFunctionNames         = jsMinifierSettings.PreserveFunctionNames;
            jsParserSettings.PreserveImportantComments     = jsMinifierSettings.PreserveImportantComments;
            jsParserSettings.QuoteObjectLiteralProperties  = jsMinifierSettings.QuoteObjectLiteralProperties;
            jsParserSettings.RemoveFunctionExpressionNames = jsMinifierSettings.RemoveFunctionExpressionNames;
            jsParserSettings.RemoveUnneededCode            = jsMinifierSettings.RemoveUnneededCode;
            jsParserSettings.RenamePairs = jsMinifierSettings.RenamePairs;
            jsParserSettings.ReorderScopeDeclarations = jsMinifierSettings.ReorderScopeDeclarations;
            jsParserSettings.StrictMode           = jsMinifierSettings.StrictMode;
            jsParserSettings.StripDebugStatements = jsMinifierSettings.StripDebugStatements;
        }
Exemple #2
0
        /// <summary>
        /// Creates a original JS minifier settings
        /// </summary>
        /// <param name="settings">JS minifier settings</param>
        /// <param name="isInlineCode">Flag for whether to create a settings for inline code</param>
        /// <returns>Original JS minifier settings</returns>
        private static CodeSettings CreateOriginalJsMinifierSettings(MsAjaxJsMinificationSettings settings,
                                                                     bool isInlineCode)
        {
            var originalSettings = new CodeSettings();

            MapJsSettings(originalSettings, settings);
            originalSettings.SourceMode = isInlineCode ?
                                          JavaScriptSourceMode.EventHandler : JavaScriptSourceMode.Program;

            return(originalSettings);
        }
Exemple #3
0
        /// <summary>
        /// Creates a instance of original JS parser
        /// </summary>
        /// <param name="settings">JS minifier settings</param>
        /// <param name="isInlineCode">Flag for whether to create a JS parser for inline code</param>
        /// <returns>Instance of original JS parser</returns>
        private static JSParser CreateOriginalJsParserInstance(MsAjaxJsMinificationSettings settings,
                                                               bool isInlineCode)
        {
            var originalSettings = new CodeSettings();

            MapCommonSettings(originalSettings, settings);
            originalSettings.AlwaysEscapeNonAscii   = settings.AlwaysEscapeNonAscii;
            originalSettings.AmdSupport             = settings.AmdSupport;
            originalSettings.CollapseToLiteral      = settings.CollapseToLiteral;
            originalSettings.ConstStatementsMozilla = settings.ConstStatementsMozilla;
            originalSettings.DebugLookupList        = settings.DebugLookupList;
            originalSettings.ErrorIfNotInlineSafe   = settings.ErrorIfNotInlineSafe;
            originalSettings.EvalLiteralExpressions = settings.EvalLiteralExpressions;
            originalSettings.EvalTreatment          = Utils.GetEnumFromOtherEnum <WmmEvalTreatment, MsEvalTreatment>(
                settings.EvalTreatment);
            originalSettings.IgnoreConditionalCompilation = settings.IgnoreConditionalCompilation;
            originalSettings.IgnorePreprocessorDefines    = settings.IgnorePreprocessorDefines;
            originalSettings.InlineSafeStrings            = settings.InlineSafeStrings;
            originalSettings.KnownGlobalNamesList         = settings.KnownGlobalNamesList;
            originalSettings.LocalRenaming = Utils.GetEnumFromOtherEnum <WmmLocalRenaming, MsLocalRenaming>(
                settings.LocalRenaming);
            originalSettings.MacSafariQuirks               = settings.MacSafariQuirks;
            originalSettings.ManualRenamesProperties       = settings.ManualRenamesProperties;
            originalSettings.NoAutoRenameList              = settings.NoAutoRenameList;
            originalSettings.PreserveFunctionNames         = settings.PreserveFunctionNames;
            originalSettings.PreserveImportantComments     = settings.PreserveImportantComments;
            originalSettings.QuoteObjectLiteralProperties  = settings.QuoteObjectLiteralProperties;
            originalSettings.RemoveFunctionExpressionNames = settings.RemoveFunctionExpressionNames;
            originalSettings.RemoveUnneededCode            = settings.RemoveUnneededCode;
            originalSettings.RenamePairs = settings.RenamePairs;
            originalSettings.ReorderScopeDeclarations = settings.ReorderScopeDeclarations;
            originalSettings.SourceMode = isInlineCode ?
                                          JavaScriptSourceMode.EventHandler : JavaScriptSourceMode.Program;
            originalSettings.StrictMode           = settings.StrictMode;
            originalSettings.StripDebugStatements = settings.StripDebugStatements;

            var originalParser = new JSParser()
            {
                Settings = originalSettings
            };

            return(originalParser);
        }
		/// <summary>
		/// Constructs a instance of the Microsoft Ajax JS Minifier factory
		/// </summary>
		/// <param name="settings">Minification settings used to configure the Microsoft Ajax JS Minifier</param>
		public MsAjaxJsMinifierFactory(MsAjaxJsMinificationSettings settings)
		{
			MinificationSettings = settings;
		}
 /// <summary>
 /// Creates a instance of Microsoft Ajax JS Minifier factory
 /// </summary>
 /// <param name="settings">Minification settings used to configure the Microsoft Ajax JS Minifier</param>
 public MsAjaxJsMinifierFactory(MsAjaxJsMinificationSettings settings)
 {
     MinificationSettings = settings;
 }
 /// <summary>
 /// Constructs instance of Microsoft Ajax JS Minifier
 /// </summary>
 /// <param name="settings">Microsoft JS Minifier settings</param>
 public MsAjaxJsMinifier(MsAjaxJsMinificationSettings settings)
 {
     _settings = settings;
 }
 /// <summary>
 /// Constructs an instance of the Microsoft Ajax JS Minifier
 /// </summary>
 /// <param name="settings">Microsoft Ajax JS Minifier settings</param>
 public MsAjaxJsMinifier(MsAjaxJsMinificationSettings settings)
 {
     _originalEmbeddedJsSettings = CreateOriginalJsMinifierSettings(settings, false);
     _originalInlineJsSettings = CreateOriginalJsMinifierSettings(settings, true);
 }
        /// <summary>
        /// Maps a JS minifier settings
        /// </summary>
        /// <param name="originalSettings">Original JS minifier settings</param>
        /// <param name="settings">JS minifier settings</param>
        private static void MapJsSettings(CodeSettings originalSettings, MsAjaxJsMinificationSettings settings)
        {
            MapCommonSettings(originalSettings, settings);

            originalSettings.AlwaysEscapeNonAscii = settings.AlwaysEscapeNonAscii;
            originalSettings.AmdSupport = settings.AmdSupport;
            originalSettings.CollapseToLiteral = settings.CollapseToLiteral;
            originalSettings.ConstStatementsMozilla = settings.ConstStatementsMozilla;
            originalSettings.DebugLookupList = settings.DebugLookupList;
            originalSettings.ErrorIfNotInlineSafe = settings.ErrorIfNotInlineSafe;
            originalSettings.EvalLiteralExpressions = settings.EvalLiteralExpressions;
            originalSettings.EvalTreatment = Utils.GetEnumFromOtherEnum<WmmEvalTreatment, MsEvalTreatment>(
                settings.EvalTreatment);
            originalSettings.IgnoreConditionalCompilation = settings.IgnoreConditionalCompilation;
            originalSettings.IgnorePreprocessorDefines = settings.IgnorePreprocessorDefines;
            originalSettings.InlineSafeStrings = settings.InlineSafeStrings;
            originalSettings.KnownGlobalNamesList = settings.KnownGlobalNamesList;
            originalSettings.LocalRenaming = Utils.GetEnumFromOtherEnum<WmmLocalRenaming, MsLocalRenaming>(
                settings.LocalRenaming);
            originalSettings.MacSafariQuirks = settings.MacSafariQuirks;
            originalSettings.ManualRenamesProperties = settings.ManualRenamesProperties;
            originalSettings.NoAutoRenameList = settings.NoAutoRenameList;
            originalSettings.PreserveFunctionNames = settings.PreserveFunctionNames;
            originalSettings.PreserveImportantComments = settings.PreserveImportantComments;
            originalSettings.QuoteObjectLiteralProperties = settings.QuoteObjectLiteralProperties;
            originalSettings.RemoveFunctionExpressionNames = settings.RemoveFunctionExpressionNames;
            originalSettings.RemoveUnneededCode = settings.RemoveUnneededCode;
            originalSettings.RenamePairs = settings.RenamePairs;
            originalSettings.ReorderScopeDeclarations = settings.ReorderScopeDeclarations;
            originalSettings.StrictMode = settings.StrictMode;
            originalSettings.StripDebugStatements = settings.StripDebugStatements;
        }
        /// <summary>
        /// Creates a original JS minifier settings
        /// </summary>
        /// <param name="settings">JS minifier settings</param>
        /// <param name="isInlineCode">Flag for whether to create a settings for inline code</param>
        /// <returns>Original JS minifier settings</returns>
        private static CodeSettings CreateOriginalJsMinifierSettings(MsAjaxJsMinificationSettings settings,
			bool isInlineCode)
        {
            var originalSettings = new CodeSettings();
            MapJsSettings(originalSettings, settings);
            originalSettings.SourceMode = isInlineCode ?
                JavaScriptSourceMode.EventHandler : JavaScriptSourceMode.Program;

            return originalSettings;
        }
Exemple #10
0
 /// <summary>
 /// Constructs an instance of the Microsoft Ajax JS Minifier
 /// </summary>
 /// <param name="settings">Microsoft Ajax JS Minifier settings</param>
 public MsAjaxJsMinifier(MsAjaxJsMinificationSettings settings)
 {
     _originalEmbeddedJsSettings = CreateOriginalJsMinifierSettings(settings, false);
     _originalInlineJsSettings   = CreateOriginalJsMinifierSettings(settings, true);
 }
 /// <summary>
 /// Constructs instance of Microsoft Ajax JS Minifier
 /// </summary>
 /// <param name="settings">Microsoft JS Minifier settings</param>
 public MsAjaxJsMinifier(MsAjaxJsMinificationSettings settings)
 {
     _settings = settings;
 }