NUglify JS Minifier settings
Inheritance: NUglifyCommonMinificationSettingsBase
Esempio n. 1
0
        /// <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, NUglifyJsMinificationSettings 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, NuEvalTreatment>(
                settings.EvalTreatment);
            originalSettings.IgnoreConditionalCompilation = settings.IgnoreConditionalCompilation;
            originalSettings.IgnorePreprocessorDefines    = settings.IgnorePreprocessorDefines;
            originalSettings.InlineSafeStrings            = settings.InlineSafeStrings;
            originalSettings.KnownGlobalNamesList         = settings.KnownGlobalNamesList;
            originalSettings.LocalRenaming = Utils.GetEnumFromOtherEnum <WmmLocalRenaming, NuLocalRenaming>(
                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;
        }
Esempio n. 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(NUglifyJsMinificationSettings settings,
                                                                     bool isInlineCode)
        {
            var originalSettings = new CodeSettings();

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

            return(originalSettings);
        }
Esempio n. 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(NUglifyJsMinificationSettings 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, NuEvalTreatment>(
                settings.EvalTreatment);
            originalSettings.IgnoreConditionalCompilation = settings.IgnoreConditionalCompilation;
            originalSettings.IgnorePreprocessorDefines    = settings.IgnorePreprocessorDefines;
            originalSettings.InlineSafeStrings            = settings.InlineSafeStrings;
            originalSettings.KnownGlobalNamesList         = settings.KnownGlobalNamesList;
            originalSettings.LocalRenaming = Utils.GetEnumFromOtherEnum <WmmLocalRenaming, NuLocalRenaming>(
                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);
        }
Esempio n. 4
0
 /// <summary>
 /// Constructs an instance of the NUglify JS Minifier
 /// </summary>
 /// <param name="settings">NUglify JS Minifier settings</param>
 public NUglifyJsMinifier(NUglifyJsMinificationSettings settings)
 {
     _settings = settings;
 }
Esempio n. 5
0
 /// <summary>
 /// Constructs an instance of the NUglify JS Minifier factory
 /// </summary>
 /// <param name="settings">Minification settings used to configure the NUglify JS Minifier</param>
 public NUglifyJsMinifierFactory(NUglifyJsMinificationSettings settings)
 {
     MinificationSettings = settings;
 }
Esempio n. 6
0
 /// <summary>
 /// Constructs instance of NUglify JS Minifier
 /// </summary>
 /// <param name="settings">NUglify JS Minifier settings</param>
 public NUglifyJsMinifier(NUglifyJsMinificationSettings settings)
 {
     _originalEmbeddedJsSettings = CreateOriginalJsMinifierSettings(settings, false);
     _originalInlineJsSettings = CreateOriginalJsMinifierSettings(settings, true);
 }
Esempio n. 7
0
        /// <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, NUglifyJsMinificationSettings 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, NuEvalTreatment>(
                settings.EvalTreatment);
            originalSettings.IgnoreConditionalCompilation = settings.IgnoreConditionalCompilation;
            originalSettings.IgnorePreprocessorDefines = settings.IgnorePreprocessorDefines;
            originalSettings.InlineSafeStrings = settings.InlineSafeStrings;
            originalSettings.KnownGlobalNamesList = settings.KnownGlobalNamesList;
            originalSettings.LocalRenaming = Utils.GetEnumFromOtherEnum<WmmLocalRenaming, NuLocalRenaming>(
                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;
        }
Esempio n. 8
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(NUglifyJsMinificationSettings settings,
			bool isInlineCode)
        {
            var originalSettings = new CodeSettings();
            MapJsSettings(originalSettings, settings);
            originalSettings.SourceMode = isInlineCode ?
                JavaScriptSourceMode.EventHandler : JavaScriptSourceMode.Program;

            return originalSettings;
        }
Esempio n. 9
0
 /// <summary>
 /// Constructs instance of NUglify JS Minifier
 /// </summary>
 /// <param name="settings">NUglify JS Minifier settings</param>
 public NUglifyJsMinifier(NUglifyJsMinificationSettings settings)
 {
     _originalEmbeddedJsSettings = CreateOriginalJsMinifierSettings(settings, false);
     _originalInlineJsSettings   = CreateOriginalJsMinifierSettings(settings, true);
 }
		/// <summary>
		/// Constructs an instance of the NUglify JS Minifier factory
		/// </summary>
		/// <param name="settings">Minification settings used to configure the NUglify JS Minifier</param>
		public NUglifyJsMinifierFactory(NUglifyJsMinificationSettings settings)
		{
			MinificationSettings = settings;
		}