<commit_before>/***** BEGIN LICENSE BLOCK ***** {{{
Version: MPL 1.1/GPL 2.0/LGPL 2.1

The contents of this file are subject to the Mozilla Public License Version
1.1 (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.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.

(c) 2006-2008: Martin Stubenschrott <stubenschrott@gmx.net>

Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/

// Do NOT create instances of this class yourself, use the helper method
// vimperator.mappings.add() instead
vimperator.Map = function (modes, cmds, description, action, extraInfo) //{{{
{
    if (!modes || (!cmds || !cmds.length) || !action)
        return null;

    if (!extraInfo)
        extraInfo = {};

    this.modes = modes;
    // only store keysyms with uppercase modifier strings
    this.names = cmds.map(function (cmd) { return cmd.replace(/[casm]-/g, function (name) { return name.toUpperCase(); });});
    this.action = action;

    this.flags = extraInfo.flags || 0;
    this.description = extraInfo.description || "";
    this.rhs = extraInfo.rhs || null;
    this.noremap = extraInfo.noremap || false;
};

vimperator.Map.prototype = {

    hasName: function (name)
    {
        return this.names.some(function (e) { return e == name; });
    },

    execute: function (motion, count, argument)
    {
        var args = [];

        if (this.flags & vimperator.Mappings.flags.MOTION)
            args.push(motion);
        if (this.flags & vimperator.Mappings.flags.COUNT)
            args.push(count);
        if (this.flags & vimperator.Mappings.flags.ARGUMENT)
            args.push(argument);

        return this.action.apply(this, args);
    }

};
//}}}

vimperator.Mappings = function () //{{{
{
    ////////////////////////////////////////////////////////////////////////////////
    ////////////////////// PRIVATE SECTION /////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////{{{

    var main = []; // default mappings
    var user = []; // user created mappings

    for (var mode in vimperator.modes)
    {
        main[mode] = [];
        user[mode] = [];
    }

    function addMap(map, userMap)
    {
        var where = userMap ? user : main;
        map.modes.forEach(function (mode) { where[mode].push(map); });
    }

    function getMap(mode, cmd, stack)
    {
        var maps = stack[mode];

        for (var i = 0; i < maps.length; i++)
        {
            if (maps[i].hasName(cmd))
                return maps[i];
        }

        return null;
    }

    function removeMap(mode, cmd)
    {
        var maps = user[mode];
        var names;

        for (var i = 0; i < maps.length; i++)
        {
            names = maps[i].names;
            for (var j = 0; j < names.length; j++)
            {
                if (names[j] == cmd)
                {
                    names.splice(j, 1);

                    if (names.length == 0)
                        maps.splice(i, 1);

                    return;
                }
            }
        }
    }

    function mappingsIterator(modes, stack)
    {
        var output;
        var maps = stack[modes[0]];

        for (var i = 0; i < maps.length; i++)
        {
            output = true;
            for (var index = 1; index < modes.length; index++) // check other modes
            {
                output = false; // toggle false, only true whan also found in this mode
                for (var z = 0; z < user[modes[index]].length; z++) // maps
                {
                    // NOTE: when other than user maps, there might be more than only one names[x].
                    //       since only user mappings gets queried here, only names[0] gets checked for equality.
                    if (maps[i].rhs == user[modes[index]][z].rhs && maps[i].names[0] == user[modes[index]][z].names[0])
                    {
                        output = true;
                        break; // found on this mode - check next mode, if there is one, where it could still fail...
                    }
                }
                break; // not found in this mode -> map wont' match all modes...
            }
            if (output)
                yield maps[i];
        }
        throw StopIteration;
    }

    function addMapCommands(char, modes, modeDescription)
    {
        // 0 args -> list all maps
        // 1 arg  -> list the maps starting with args
        // 2 args -> map arg1 to arg*
        function map(args, mode, noremap)
        {
            if (!args)
            {
                vimperator.mappings.list(mode);
                return;
            }

            // ?:\s+ <- don't remember; (...)? optional = rhs
            var [, lhs, rhs] = args.match(/(\S+)(?:\s+(.+))?/);
            var leaderRegexp = /<Leader>/i;

            if (leaderRegexp.test(lhs))
                lhs = lhs.replace(leaderRegexp, vimperator.events.getMapLeader());

            if (!rhs) // list the mapping
            {
                vimperator.mappings.list(mode, lhs);
            }
            else
            {
                for (var index = 0; index < mode.length; index++)
                {
                    vimperator.mappings.addUserMap([mode[index]], [lhs],
                            "User defined mapping",
                            function (count) { vimperator.events.feedkeys((count > 1 ? count : "") + rhs, noremap); },
                            {
                                flags: vimperator.Mappings.flags.COUNT,
                                rhs: rhs,
                                noremap: noremap
                            });
                }
            }
        }

        var modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";

        vimperator.commands.add([char ? char + "m[ap]" : "map"],
            "Map a key sequence" + modeDescription,
            function (args) { map(args, modes, false); });

        vimperator.commands.add([char + "no[remap]"],
            "Map a key sequence without remapping keys" + modeDescription,
            function (args) { map(args, modes, true); });

        vimperator.commands.add([char + "mapc[lear]"],
            "Remove all mappings" + modeDescription,
            function (args)
            {
                if (args)
                {
                    vimperator.echoerr("E474: Invalid argument");
                    return;
                }

                for (let i = 0; i < modes.length; i++)
                    vimperator.mappings.removeAll(modes[i]);
            });

        vimperator.commands.add([char + "unm[ap]"],
            "Remove a mapping" + modeDescription,
            function (args)
            {
                if (!args)
                {
                    vimperator.echoerr("E474: Invalid argument");
                    return;
                }

                var flag = false;
                for (let i = 0; i < modes.length; i++)
                {
                    if (vimperator.mappings.hasMap(modes[i], args))
                    {
                        vimperator.mappings.remove(modes[i], args);
                        flag = true;
                    }
                }
                if (!flag)
                    vimperator.echoerr("E31: No such mapping");
            });
    }

    /////////////////////////////////////////////////////////////////////////////}}}
    ////////////////////// COMMANDS ////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////{{{

    addMapCommands("",  [vimperator.modes.NORMAL], "");
    addMapCommands("c", [vimperator.modes.COMMAND_LINE], "command line");
    addMapCommands("i", [vimperator.modes.INSERT, vimperator.modes.TEXTAREA], "insert");
    if (vimperator.has("mail"))
        addMapCommands("m", [vimperator.modes.MESSAGE], "message");

    /////////////////////////////////////////////////////////////////////////////}}}
    ////////////////////// PUBLIC SECTION //////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////{{{

    // FIXME:
    vimperator.Mappings.flags = {
        ALLOW_EVENT_ROUTING: 1 << 0, // if set, return true inside the map command to pass the event further to firefox
        MOTION:              1 << 1,
        COUNT:               1 << 2,
        ARGUMENT:            1 << 3
    };

    return {

        // NOTE: just normal mode for now
        __iterator__: function ()
        {
            return mappingsIterator([vimperator.modes.NORMAL], main);
        },

        // used by :mkvimperatorrc to save mappings
        getUserIterator: function (mode)
        {
            return mappingsIterator(mode, user);
        },

        add: function (modes, keys, description, action, extra)
        {
            addMap (new vimperator.Map(modes, keys, description, action, extra), false);
        },

        addUserMap: function (modes, keys, description, action, extra)
        {
            var map = new vimperator.Map(modes, keys, description || "User defined mapping", action, extra);

            // remove all old mappings to this key sequence
            for (var i = 0; i < map.names.length; i++)
            {
                for (var j = 0; j < map.modes.length; j++)
                    removeMap(map.modes[j], map.names[i]);
            }

            addMap (map, true);
        },

        get: function (mode, cmd)
        {
            return getMap(mode, cmd, user) || getMap(mode, cmd, main);
        },

        getDefault: function (mode, cmd)
        {
            return getMap(mode, cmd, main);
        },

        // returns an array of mappings with names which START with "cmd" (but are NOT "cmd")
        getCandidates: function (mode, cmd)
        {
            var mappings = user[mode].concat(main[mode]);
            var matches = [];

            for (var i = 0; i < mappings.length; i++)
            {
                var map = mappings[i];
                for (var j = 0; j < map.names.length; j++)
                {
                    if (map.names[j].indexOf(cmd) == 0 && map.names[j].length > cmd.length)
                    {
                        // for < only return a candidate if it doesn't look like a <c-x> mapping
                        if (cmd != "<" || !/^<.+>/.test(map.names[j]))
                            matches.push(map);
                    }
                }
            }

            return matches;
        },

        // returns whether the user added a custom user map
        hasMap: function (mode, cmd)
        {
            return user[mode].some(function (map) { return map.hasName(cmd); });
        },

        remove: function (mode, cmd)
        {
            removeMap(mode, cmd);
        },

        removeAll: function (mode)
        {
            user[mode] = [];
        },

        list: function (modes, filter)
        {
            // modes means, a map must exist in both modes in order to get listed
            var maps = user[modes[0]]; // duplicate (reference) (first mode where it must match)
            var output = [];

            if (!maps || maps.length == 0)
            {
                vimperator.echo("No mappings found");
                return;
            }

            for (var i = 0; i < maps.length; i++) // check on maps items (first mode)
            {
                output.push(true);
                if (filter && maps[i].names[0] != filter) // does it match the filter first of all?
                {
                    output[output.length - 1] = false;
                    continue;
                }
                for (var index = 1; index < modes.length; index++) // check if found in the other modes (1(2nd)-last)
                {
                    output[output.length - 1] = false; // toggle false, only true whan also found in this mode
                    for (var z = 0; z < user[modes[index]].length; z++) // maps on the other modes
                    {
                        // NOTE: when other than user maps, there might be more than only one names[x].
                        //       since only user mappings gets queried here, only names[0] gets checked for equality.
                        if (maps[i].rhs == user[modes[index]][z].rhs && maps[i].names[0] == user[modes[index]][z].names[0])
                        {
                            output[output.length - 1] = true;
                            break; // found on this mode - ok, check next mode...
                        }
                    }
                    break; // not found in this mode -> map wont' match all modes...
                }
            }

            // anything found?
            var flag = false;
            for (var i = 0; i < output.length; i++)
                if (output[i])
                    flag = true;

            if (!flag)
            {
                vimperator.echo("No mappings found");
                return;
            }

            var modeSign = "";
            for (var i = 0; i < modes.length; i++)
            {
                if (modes[i] == vimperator.modes.NORMAL)
                    modeSign += 'n';
                if ((modes[i] == vimperator.modes.INSERT || modes[i] == vimperator.modes.TEXTAREA) && modeSign.indexOf("i") == -1)
                    modeSign += 'i';
                if (modes[i] == vimperator.modes.COMMAND_LINE)
                    modeSign += 'c';
            }

            var list = "
";
            for (i = 0; i < maps.length; i++)
            {
                if (!output[i])
                    continue;
                for (var j = 0; j < maps[i].names.length; j++)
                {
                    list += "
";
                    list += " " + modeSign + "   " + vimperator.util.escapeHTML(maps[i].names[j]) + "	";
                    if (maps[i].rhs)
                        list += " "+ (maps[i].noremap ? "*" : " ") + "	"
                                        + "" + vimperator.util.escapeHTML(maps[i].rhs) + "	";
                    list += "
";
                }
            }
            list += "
";

            vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
        }

    };
}; //}}}

// vim: set fdm=marker sw=4 ts=4 et:
<commit_msg>test mozdev homepage with no branding<commit_after>/***** BEGIN LICENSE BLOCK ***** {{{
Version: MPL 1.1/GPL 2.0/LGPL 2.1

The contents of this file are subject to the Mozilla Public License Version
1.1 (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.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.

(c) 2006-2008: Martin Stubenschrott <stubenschrott@gmx.net>

Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/

// Do NOT create instances of this class yourself, use the helper method
// vimperator.mappings.add() instead
vimperator.Map = function (modes, cmds, description, action, extraInfo) //{{{
{
    if (!modes || (!cmds || !cmds.length) || !action)
        return null;

    if (!extraInfo)
        extraInfo = {};

    this.modes = modes;
    // only store keysyms with uppercase modifier strings
    this.names = cmds.map(function (cmd) { return cmd.replace(/[casm]-/g, function (name) { return name.toUpperCase(); });});
    this.action = action;

    this.flags = extraInfo.flags || 0;
    this.description = extraInfo.description || "";
    this.rhs = extraInfo.rhs || null;
    this.noremap = extraInfo.noremap || false;
};

vimperator.Map.prototype = {

    hasName: function (name)
    {
        return this.names.some(function (e) { return e == name; });
    },

    execute: function (motion, count, argument)
    {
        var args = [];

        if (this.flags & vimperator.Mappings.flags.MOTION)
            args.push(motion);
        if (this.flags & vimperator.Mappings.flags.COUNT)
            args.push(count);
        if (this.flags & vimperator.Mappings.flags.ARGUMENT)
            args.push(argument);

        return this.action.apply(this, args);
    }

};
//}}}

vimperator.Mappings = function () //{{{
{
    ////////////////////////////////////////////////////////////////////////////////
    ////////////////////// PRIVATE SECTION /////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////{{{

    var main = []; // default mappings
    var user = []; // user created mappings

    for (var mode in vimperator.modes)
    {
        main[mode] = [];
        user[mode] = [];
    }

    function addMap(map, userMap)
    {
        var where = userMap ? user : main;
        map.modes.forEach(function (mode) { where[mode].push(map); });
    }

    function getMap(mode, cmd, stack)
    {
        var maps = stack[mode];

        for (var i = 0; i < maps.length; i++)
        {
            if (maps[i].hasName(cmd))
                return maps[i];
        }

        return null;
    }

    function removeMap(mode, cmd)
    {
        var maps = user[mode];
        var names;

        for (var i = 0; i < maps.length; i++)
        {
            names = maps[i].names;
            for (var j = 0; j < names.length; j++)
            {
                if (names[j] == cmd)
                {
                    names.splice(j, 1);

                    if (names.length == 0)
                        maps.splice(i, 1);

                    return;
                }
            }
        }
    }

    function mappingsIterator(modes, stack)
    {
        var output;
        var maps = stack[modes[0]];

        for (var i = 0; i < maps.length; i++)
        {
            output = true;
            for (var index = 1; index < modes.length; index++) // check other modes
            {
                output = false; // toggle false, only true whan also found in this mode
                for (var z = 0; z < user[modes[index]].length; z++) // maps
                {
                    // NOTE: when other than user maps, there might be more than only one names[x].
                    //       since only user mappings gets queried here, only names[0] gets checked for equality.
                    if (maps[i].rhs == user[modes[index]][z].rhs && maps[i].names[0] == user[modes[index]][z].names[0])
                    {
                        output = true;
                        break; // found on this mode - check next mode, if there is one, where it could still fail...
                    }
                }
                break; // not found in this mode -> map wont' match all modes...
            }
            if (output)
                yield maps[i];
        }
        throw StopIteration;
    }

    function addMapCommands(char, modes, modeDescription)
    {
        // 0 args -> list all maps
        // 1 arg  -> list the maps starting with args
        // 2 args -> map arg1 to arg*
        function map(args, mode, noremap)
        {
            if (!args)
            {
                vimperator.mappings.list(mode);
                return;
            }

            // ?:\s+ <- don't remember; (...)? optional = rhs
            var [, lhs, rhs] = args.match(/(\S+)(?:\s+(.+))?/);
            var leaderRegexp = /<Leader>/i;

            if (leaderRegexp.test(lhs))
                lhs = lhs.replace(leaderRegexp, vimperator.events.getMapLeader());

            if (!rhs) // list the mapping
            {
                vimperator.mappings.list(mode, lhs);
            }
            else
            {
                for (var index = 0; index < mode.length; index++)
                {
                    vimperator.mappings.addUserMap([mode[index]], [lhs],
                            "User defined mapping",
                            function (count) { vimperator.events.feedkeys((count > 1 ? count : "") + rhs, noremap); },
                            {
                                flags: vimperator.Mappings.flags.COUNT,
                                rhs: rhs,
                                noremap: noremap
                            });
                }
            }
        }

        var modeDescription = modeDescription ? " in " + modeDescription + " mode" : "";

        vimperator.commands.add([char ? char + "m[ap]" : "map"],
            "Map a key sequence" + modeDescription,
            function (args) { map(args, modes, false); });

        vimperator.commands.add([char + "no[remap]"],
            "Map a key sequence without remapping keys" + modeDescription,
            function (args) { map(args, modes, true); });

        vimperator.commands.add([char + "mapc[lear]"],
            "Remove all mappings" + modeDescription,
            function (args)
            {
                if (args)
                {
                    vimperator.echoerr("E474: Invalid argument");
                    return;
                }

                for (let i = 0; i < modes.length; i++)
                    vimperator.mappings.removeAll(modes[i]);
            });

        vimperator.commands.add([char + "unm[ap]"],
            "Remove a mapping" + modeDescription,
            function (args)
            {
                if (!args)
                {
                    vimperator.echoerr("E474: Invalid argument");
                    return;
                }

                var flag = false;
                for (let i = 0; i < modes.length; i++)
                {
                    if (vimperator.mappings.hasMap(modes[i], args))
                    {
                        vimperator.mappings.remove(modes[i], args);
                        flag = true;
                    }
                }
                if (!flag)
                    vimperator.echoerr("E31: No such mapping");
            });
    }

    /////////////////////////////////////////////////////////////////////////////}}}
    ////////////////////// COMMANDS ////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////{{{

    addMapCommands("",  [vimperator.modes.NORMAL], "");
    addMapCommands("c", [vimperator.modes.COMMAND_LINE], "command line");
    addMapCommands("i", [vimperator.modes.INSERT, vimperator.modes.TEXTAREA], "insert");
    if (vimperator.has("mail"))
        addMapCommands("m", [vimperator.modes.MESSAGE], "message");

    /////////////////////////////////////////////////////////////////////////////}}}
    ////////////////////// PUBLIC SECTION //////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////{{{

    // FIXME:
    vimperator.Mappings.flags = {
        ALLOW_EVENT_ROUTING: 1 << 0, // if set, return true inside the map command to pass the event further to firefox
        MOTION:              1 << 1,
        COUNT:               1 << 2,
        ARGUMENT:            1 << 3
    };

    return {

        // NOTE: just normal mode for now
        __iterator__: function ()
        {
            return mappingsIterator([vimperator.modes.NORMAL], main);
        },

        // used by :mkvimperatorrc to save mappings
        getUserIterator: function (mode)
        {
            return mappingsIterator(mode, user);
        },

        add: function (modes, keys, description, action, extra)
        {
            addMap (new vimperator.Map(modes, keys, description, action, extra), false);
        },

        addUserMap: function (modes, keys, description, action, extra)
        {
            var map = new vimperator.Map(modes, keys, description || "User defined mapping", action, extra);

            // remove all old mappings to this key sequence
            for (var i = 0; i < map.names.length; i++)
            {
                for (var j = 0; j < map.modes.length; j++)
                    removeMap(map.modes[j], map.names[i]);
            }

            addMap (map, true);
        },

        get: function (mode, cmd)
        {
            return getMap(mode, cmd, user) || getMap(mode, cmd, main);
        },

        getDefault: function (mode, cmd)
        {
            return getMap(mode, cmd, main);
        },

        // returns an array of mappings with names which START with "cmd" (but are NOT "cmd")
        getCandidates: function (mode, cmd)
        {
            var mappings = user[mode].concat(main[mode]);
            var matches = [];

            for (var i = 0; i < mappings.length; i++)
            {
                var map = mappings[i];
                for (var j = 0; j < map.names.length; j++)
                {
                    if (map.names[j].indexOf(cmd) == 0 && map.names[j].length > cmd.length)
                    {
                        // for < only return a candidate if it doesn't look like a <c-x> mapping
                        if (cmd != "<" || !/^<.+>/.test(map.names[j]))
                            matches.push(map);
                    }
                }
            }

            return matches;
        },

        // returns whether the user added a custom user map
        hasMap: function (mode, cmd)
        {
            return user[mode].some(function (map) { return map.hasName(cmd); });
        },

        remove: function (mode, cmd)
        {
            removeMap(mode, cmd);
        },

        removeAll: function (mode)
        {
            user[mode] = [];
        },

        list: function (modes, filter)
        {
            // modes means, a map must exist in both modes in order to get listed
            var maps = user[modes[0]]; // duplicate (reference) (first mode where it must match)
            var output = [];

            if (!maps || maps.length == 0)
            {
                vimperator.echo("No mappings found");
                return;
            }

            for (var i = 0; i < maps.length; i++) // check on maps items (first mode)
            {
                output.push(true);
                if (filter && maps[i].names[0] != filter) // does it match the filter first of all?
                {
                    output[output.length - 1] = false;
                    continue;
                }
                for (var index = 1; index < modes.length; index++) // check if found in the other modes (1(2nd)-last)
                {
                    output[output.length - 1] = false; // toggle false, only true whan also found in this mode
                    for (var z = 0; z < user[modes[index]].length; z++) // maps on the other modes
                    {
                        // NOTE: when other than user maps, there might be more than only one names[x].
                        //       since only user mappings gets queried here, only names[0] gets checked for equality.
                        if (maps[i].rhs == user[modes[index]][z].rhs && maps[i].names[0] == user[modes[index]][z].names[0])
                        {
                            output[output.length - 1] = true;
                            break; // found on this mode - ok, check next mode...
                        }
                    }
                    break; // not found in this mode -> map wont' match all modes...
                }
            }

            // anything found?
            var flag = false;
            for (var i = 0; i < output.length; i++)
                if (output[i])
                    flag = true;

            if (!flag)
            {
                vimperator.echo("No mappings found");
                return;
            }

            var modeSign = "";
            for (var i = 0; i < modes.length; i++)
            {
                if (modes[i] == vimperator.modes.NORMAL)
                    modeSign += "n";
                if ((modes[i] == vimperator.modes.INSERT || modes[i] == vimperator.modes.TEXTAREA) && modeSign.indexOf("i") == -1)
                    modeSign += "i";
                if (modes[i] == vimperator.modes.COMMAND_LINE)
                    modeSign += "c";
                if (modes[i] == vimperator.modes.MESSAGRE)
                    modeSign += "m";
            }

            var list = "
";
            for (i = 0; i < maps.length; i++)
            {
                if (!output[i])
                    continue;
                for (var j = 0; j < maps[i].names.length; j++)
                {
                    list += "
";
                    list += " " + modeSign + "   " + vimperator.util.escapeHTML(maps[i].names[j]) + "	";
                    if (maps[i].rhs)
                        list += " "+ (maps[i].noremap ? "*" : " ") + "	"
                                        + "" + vimperator.util.escapeHTML(maps[i].rhs) + "	";
                    list += "
";
                }
            }
            list += "
";

            vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
        }

    };
}; //}}}

// vim: set fdm=marker sw=4 ts=4 et:
<|endoftext|>


<commit_before>module.exports = {
	entry: "./src/exports.js",
	output: {
		filename: 'bundle.js',
		library: 'ModelViewer',
		libraryTarget: 'var'
	},
	module: {
		rules: [
			{
				test: /\.js$/,
				exclude: /(node_modules)/,
				use: {
					loader: 'babel-loader',
					options: {
						presets: ['babel-preset-es2015-script'],
					}
				}
			},
		]
	}
}
<commit_msg>Convert webpack config to spaces.<commit_after>module.exports = {
    entry: "./src/exports.js",
    output: {
        filename: 'bundle.js',
        library: 'ModelViewer',
        libraryTarget: 'var'
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /(node_modules)/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['babel-preset-es2015-script'],
                    }
                }
            },
        ]
    }
}
<|endoftext|>


<commit_before>const path = require('path');

const APP_DIR = path.resolve(__dirname, 'src');
const BUILD_DIR = path.resolve(__dirname, 'build');

module.exports = {
  entry: APP_DIR + '/index.js',
  output: {
    path: BUILD_DIR,
    filename: 'bundle.js'
  },
  loaders: {
    test: /\.js$/,
    include: APP_DIR,
    loader: 'babel-loader',
    babelrc: true
  }
};
<commit_msg>Fixed webpack config structure<commit_after>const path = require('path');

const APP_DIR = path.resolve(__dirname, 'src');
const BUILD_DIR = path.resolve(__dirname, 'build');

module.exports = {
  entry: APP_DIR + '/index.js',
  output: {
    path: BUILD_DIR,
    filename: 'bundle.js'
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        include: APP_DIR,
        loader: 'babel-loader',
        babelrc: true
      }
    ]
  }
};
<|endoftext|>


<commit_before>var path = require("path"),
    webpack = require("webpack");

var staticPrefix = "src/sentry/static/sentry",
    distPath = staticPrefix + "/dist";

function file(name) {
  return path.join(__dirname, staticPrefix, name);
}

function vendorFile(name) {
  return path.join(__dirname, staticPrefix, "vendor", name);
}

module.exports = {
  entry: {
    "app": file("app/main.jsx"),
    "vendor": [
      "flot",
      "flot/jquery.flot.resize",
      "flot/jquery.flot.time",
      "jquery",
      "moment",

      "raven",
      "react/addons",
      "react-router",
      "react-bootstrap",
      "reflux"
    ]
  },
  module: {
    loaders: [
      {
        test: /\.jsx$/,
        loader: "jsx-loader?insertPragma=React.DOM&harmony"
      }
    ]
  },
  plugins: [
    new webpack.optimize.CommonsChunkPlugin({
      name: "vendor",
      filename: distPath + "/vendor.js",
    }),
    new webpack.optimize.UglifyJsPlugin(),
    new webpack.optimize.DedupePlugin(),
    new webpack.ProvidePlugin({
        $: 'jquery',
        jQuery: 'jquery',
    })
  ],
  resolve: {
    modulesDirectories: [distPath, "node_modules"],
    extensions: ["", ".jsx", ".js", ".json"]
  },
  output: {
    filename: distPath + "/[name].js",
    libraryTarget: "var",
    library: "exports"
  },
  devtool: 'source-map'
}
<commit_msg>Revert "Explicit options"<commit_after>var path = require("path"),
    webpack = require("webpack");

var staticPrefix = "src/sentry/static/sentry",
    distPath = staticPrefix + "/dist";

function file(name) {
  return path.join(__dirname, staticPrefix, name);
}

function vendorFile(name) {
  return path.join(__dirname, staticPrefix, "vendor", name);
}

module.exports = {
  entry: {
    "app": file("app/main.jsx"),
    "vendor": [
      "flot",
      "flot/jquery.flot.resize",
      "flot/jquery.flot.time",
      "jquery",
      "moment",

      "raven",
      "react/addons",
      "react-router",
      "react-bootstrap",
      "reflux"
    ]
  },
  module: {
    loaders: [
      {
        test: /\.jsx$/,
        loader: "jsx-loader?insertPragma=React.DOM&harmony"
      }
    ]
  },
  plugins: [
    new webpack.optimize.CommonsChunkPlugin("vendor", distPath + "/vendor.js"),
    new webpack.optimize.UglifyJsPlugin(),
    new webpack.optimize.DedupePlugin(),
    new webpack.ProvidePlugin({
        $: 'jquery',
        jQuery: 'jquery',
    })
  ],
  resolve: {
    modulesDirectories: [distPath, "node_modules"],
    extensions: ["", ".jsx", ".js", ".json"]
  },
  output: {
    filename: distPath + "/[name].js",
    libraryTarget: "var",
    library: "exports"
  },
  devtool: 'source-map'
}
<|endoftext|>


<commit_before>var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");

module.exports = function (env){
  let isProd = env && env.production;

  const extractSass = new ExtractTextPlugin({
    filename: "[name].[contenthash].css",
    disable: !isProd
});

  let entryDev = [
    'react-hot-loader/patch',
    // activate HMR for React

    'webpack-dev-server/client?http://localhost:3000',
    // bundle the client for webpack-dev-server
    // and connect to the provided endpoint

    'webpack/hot/only-dev-server',
    // bundle the client for hot reloading
    // only- means to only hot reload for successful updates

    './src/index.js',
    // the entry point of our app
  ];

  let entryProd = './src/index.js';

  let outputDev = {
    filename: 'static/bundle.js',
    path: path.resolve(__dirname, 'dist'),
    publicPath: '/'
    // necessary for HMR to know where to load the hot update chunks
  };

  let outputProd = {
    filename: 'static/bundle.js',
    path: path.resolve(__dirname, 'dist'),
    publicPath: './'
  };

  let plugins = [];
  if(isProd){
    plugins.push(new webpack.optimize.UglifyJsPlugin({
      sourceMap: true,
      comments: false
    }));
  }else{
    plugins.push(new webpack.HotModuleReplacementPlugin()); // enable HMR globally
    plugins.push(new webpack.NamedModulesPlugin()); // prints more readable module names in the browser console on HMR updates
    plugins.push(new webpack.NoEmitOnErrorsPlugin()); // do not emit compiled assets that include errors
  }

  plugins.push(new HtmlWebpackPlugin({
    template: './index.html',
    inject: true
  }));

  plugins.push(extractSass);

  return {
  entry: isProd ? entryProd : entryDev,

  output: isProd ? outputProd : outputDev,

  devtool: isProd ? 'source-map' : 'inline-source-map',

  module: {
    rules: [
      {
        test: /\.jsx?$/,
        use: {
          loader: 'babel-loader',
          options: {
            'babelrc': false, // prevent conflicts with .babelrc used by Jest tests
            'presets': [
              ['es2015', {'modules': false}],
              'stage-2',
              'react'
            ],
            'plugins': [
              'react-hot-loader/babel'
            ]
          }
        },
        exclude: /node_modules/
      },
      {
            test: /\.scss$/,
            use: extractSass.extract({
                use: [{
                    loader: "css-loader", options: {
                    sourceMap: true
                  }
                }, {
                    loader: "sass-loader", options: {
                    sourceMap: true
                  }
                }],
                // use style-loader in development
                fallback: "style-loader"
            })
      },
      { test: /\.(ttf.*|eot.*|woff.*|ogg|mp3)$/, loader: 'file-loader'},
      { test: /.(png|jpe?g|gif|svg.*)$/, loader: 'file-loader!img-loader?optimizationLevel=7&progressive=true'}
    ]
  },

  plugins: plugins,

  devServer: {
    contentBase: 'assets',
    host: 'localhost',
    port: 3000,

    historyApiFallback: true,
    // respond to 404s with index.html

    hot: true,
    // enable HMR on the server
  },
};
};
<commit_msg>Webpack style-loader modules are overriding components css<commit_after>var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");

module.exports = function (env){
  let isProd = env && env.production;

  const extractSass = new ExtractTextPlugin({
    filename: "[name].[contenthash].css",
    disable: !isProd
});

  let entryDev = [
    'react-hot-loader/patch',
    // activate HMR for React

    'webpack-dev-server/client?http://localhost:3000',
    // bundle the client for webpack-dev-server
    // and connect to the provided endpoint

    'webpack/hot/only-dev-server',
    // bundle the client for hot reloading
    // only- means to only hot reload for successful updates

    './src/index.js',
    // the entry point of our app
  ];

  let entryProd = './src/index.js';

  let outputDev = {
    filename: 'static/bundle.js',
    path: path.resolve(__dirname, 'dist'),
    publicPath: '/'
    // necessary for HMR to know where to load the hot update chunks
  };

  let outputProd = {
    filename: 'static/bundle.js',
    path: path.resolve(__dirname, 'dist'),
    publicPath: './'
  };

  let plugins = [];
  if(isProd){
    plugins.push(new webpack.optimize.UglifyJsPlugin({
      sourceMap: true,
      comments: false
    }));
  }else{
    plugins.push(new webpack.HotModuleReplacementPlugin()); // enable HMR globally
    plugins.push(new webpack.NamedModulesPlugin()); // prints more readable module names in the browser console on HMR updates
    plugins.push(new webpack.NoEmitOnErrorsPlugin()); // do not emit compiled assets that include errors
  }

  plugins.push(new HtmlWebpackPlugin({
    template: './index.html',
    inject: true
  }));

  plugins.push(extractSass);

  return {
  entry: isProd ? entryProd : entryDev,

  output: isProd ? outputProd : outputDev,

  devtool: isProd ? 'source-map' : 'inline-source-map',

  module: {
    rules: [
      {
        test: /\.jsx?$/,
        use: {
          loader: 'babel-loader',
          options: {
            'babelrc': false, // prevent conflicts with .babelrc used by Jest tests
            'presets': [
              ['es2015', {'modules': false}],
              'stage-2',
              'react'
            ],
            'plugins': [
              'react-hot-loader/babel'
            ]
          }
        },
        exclude: /node_modules/
      },
      {
        test: /\.css$/,
          use: ExtractTextPlugin.extract({
             fallback: 'style-loader',
             use: ['css-loader']
          })
      },
      {
            test: /\.scss$/,
            use: extractSass.extract({
                use: [{
                    loader: "css-loader", options: {
                    sourceMap: true
                  }
                }, {
                    loader: "sass-loader", options: {
                    sourceMap: true
                  }
                }],
                // use style-loader in development
                fallback: "style-loader"
            })
      },
      { test: /\.(ttf.*|eot.*|woff.*|ogg|mp3)$/, loader: 'file-loader'},
      { test: /.(png|jpe?g|gif|svg.*)$/, loader: 'file-loader!img-loader?optimizationLevel=7&progressive=true'}
    ]
  },

  plugins: plugins,

  devServer: {
    contentBase: 'assets',
    host: 'localhost',
    port: 3000,

    historyApiFallback: true,
    // respond to 404s with index.html

    hot: true,
    // enable HMR on the server
  },
};
};
<|endoftext|>


<commit_before>process.traceDeprecation = true;
const path = require("path");
const patternslib_config = require("@patternslib/patternslib/webpack/webpack.config.js");

module.exports = async (env, argv) => {
    const config = patternslib_config(env, argv);

    config.entry = {
        bundle: path.resolve(__dirname, "bundle-config.js"),
    };
    config.output.path = path.resolve(__dirname, "dist/");

    // Correct moment alias
    config.resolve.alias.moment = path.resolve(__dirname, "node_modules/moment"); // prettier-ignore
    config.resolve.alias.redactor = path.resolve(__dirname, "../redactor");

    if (argv.mode === "production") {
        // Also create minified bundles along with the non-minified ones.
        config.entry["bundle.min"] = path.resolve(__dirname, "bundle-config.js"); // prettier-ignore
        config.output.chunkFilename = "chunks/[name].[contenthash].min.js";
    }

    return config;
};
<commit_msg>maint(webpack): Simplify webpack.<commit_after>process.traceDeprecation = true;
const path = require("path");
const patternslib_config = require("@patternslib/patternslib/webpack/webpack.config.js");

module.exports = async (env, argv) => {
    const config = patternslib_config(env, argv);

    config.entry = {
        bundle: path.resolve(__dirname, "bundle-config.js"),
    };
    config.output.path = path.resolve(__dirname, "dist/");

    config.resolve.alias.redactor = path.resolve(__dirname, "../redactor");

    return config;
};
<|endoftext|>


<commit_before>var path = require('path');
var webpack = require('webpack');
const pxtorem = require('postcss-pxtorem');
//const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');

module.exports = {
  devtool: 'eval',
  entry: [
    'webpack-dev-server/client?http://localhost:3000',
    'webpack/hot/only-dev-server',
    './src/index'
  ],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: '/static/'
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin()
  ],
  resolve: {
//      root: __dirname,
      modulesDirectories: [
        'node_modules',
        path.join(__dirname, '../node_modules'),
        './src',
        './components',
        './data',
        './store',
        './firebase',
        './mobxs'
      ],
  extensions: ['', '.web.jsx', '.web.js', '.js', '.jsx', '.json']
  },
  module: {
    loaders: [{
      test: /\.jsx?$/,
      loaders: ['babel'],
      include: path.join(__dirname, 'src'),
    },
   {
      test: /\.css$/,
      loaders: [ 'style-loader', 'css-loader', 'sass-loader' ]
    },
    {
      test: /\.(svg)$/i,
      loader: 'svg-sprite-loader',
      include: [
        require.resolve('antd-mobile').replace(/warn\.js$/, ''),  // 1. svg files of antd-mobile
        // path.resolve(__dirname, 'src/my-project-svg-foler'),  // folder of svg files in your project
      ]
    },

  ],
    rules: [
      {
        exclude: [
          /\.less$/,
          /\.svg$/,
        ]
      },
      // Process JS with Babel.
      {
        test: /\.(js|jsx)$/,
        options: {
          plugins: [
            ['import', { libraryName: 'antd-mobile', style: true }],
          ],
          cacheDirectory: true,
        }
      },
      // It is generally necessary to use the Icon component, need to configure svg-sprite-loader
      {
        test: /\.(svg)$/i,
        loader: 'svg-sprite-loader',
        include: [
          require.resolve('antd-mobile').replace(/warn\.js$/, ''),  // 1. svg files of antd-mobile
          // path.resolve(__dirname, 'src/my-project-svg-foler'),  // folder of svg files in your project
        ]
      },
      {
        test: /\.less$/,
        use: [
          require.resolve('style-loader'),
          require.resolve('css-loader'),
        {
            loader: require.resolve('postcss-loader'),
            options: {
              ident: 'postcss', // https://webpack.js.org/guides/migrating/#complex-options
              plugins: () => [
                autoprefixer({
                  browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 8', 'iOS >= 8', 'Android >= 4'],
                }),
                pxtorem({ rootValue: 100, propWhiteList: [] })
              ],
            },
          },
          {
            loader: require.resolve('less-loader'),
            options: {
              modifyVars: { "@primary-color": "#1DA57A" },
            },
          },
        ],
      }
    ]
  },
  devServer: {
    historyApiFallback: true
  },
  devtool: 'cheap-module-eval-source-map'
};
<commit_msg>add rood __dir<commit_after>var path = require('path');
var webpack = require('webpack');
const pxtorem = require('postcss-pxtorem');
//const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');

module.exports = {
  devtool: 'eval',
  entry: [
    'webpack-dev-server/client?http://localhost:3000',
    'webpack/hot/only-dev-server',
    './src/index'
  ],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: '/static/'
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin()
  ],
  resolve: {
      root: __dirname,
      modulesDirectories: [
        'node_modules',
        path.join(__dirname, '../node_modules'),
        './src',
        './components',
        './data',
        './store',
        './firebase',
        './mobxs'
      ],
  extensions: ['', '.web.jsx', '.web.js', '.js', '.jsx', '.json']
  },
  module: {
    loaders: [{
      test: /\.jsx?$/,
      loaders: ['babel'],
      include: path.join(__dirname, 'src'),
    },
   {
      test: /\.css$/,
      loaders: [ 'style-loader', 'css-loader', 'sass-loader' ]
    },
    {
      test: /\.(svg)$/i,
      loader: 'svg-sprite-loader',
      include: [
        require.resolve('antd-mobile').replace(/warn\.js$/, ''),  // 1. svg files of antd-mobile
        // path.resolve(__dirname, 'src/my-project-svg-foler'),  // folder of svg files in your project
      ]
    },

  ],
    rules: [
      {
        exclude: [
          /\.less$/,
          /\.svg$/,
        ]
      },
      // Process JS with Babel.
      {
        test: /\.(js|jsx)$/,
        options: {
          plugins: [
            ['import', { libraryName: 'antd-mobile', style: true }],
          ],
          cacheDirectory: true,
        }
      },
      // It is generally necessary to use the Icon component, need to configure svg-sprite-loader
      {
        test: /\.(svg)$/i,
        loader: 'svg-sprite-loader',
        include: [
          require.resolve('antd-mobile').replace(/warn\.js$/, ''),  // 1. svg files of antd-mobile
          // path.resolve(__dirname, 'src/my-project-svg-foler'),  // folder of svg files in your project
        ]
      },
      {
        test: /\.less$/,
        use: [
          require.resolve('style-loader'),
          require.resolve('css-loader'),
        {
            loader: require.resolve('postcss-loader'),
            options: {
              ident: 'postcss', // https://webpack.js.org/guides/migrating/#complex-options
              plugins: () => [
                autoprefixer({
                  browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 8', 'iOS >= 8', 'Android >= 4'],
                }),
                pxtorem({ rootValue: 100, propWhiteList: [] })
              ],
            },
          },
          {
            loader: require.resolve('less-loader'),
            options: {
              modifyVars: { "@primary-color": "#1DA57A" },
            },
          },
        ],
      }
    ]
  },
  devServer: {
    historyApiFallback: true
  },
  devtool: 'cheap-module-eval-source-map'
};
<|endoftext|>


<commit_before>const path    = require('path');
const merge   = require('webpack-merge');
const webpack = require('webpack');

// Webpack plugins
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

// Read `package.json` file
const pkg = require('./package.json');

// Define some constants
const TARGET = process.env.npm_lifecycle_event;
const PATHS  = {
    app: path.join(__dirname, 'app'),
    build: path.join(__dirname, 'build')
};

// Used to configure Babel (see: `.babelrc` file)
process.env.BABEL_ENV = TARGET;

// Common config, shared by all "targets"
const common = {
    // Entry points are used to define "bundles"
    entry: {
        app: PATHS.app
    },
    // Extensions that should be used to resolve module
    //
    // - `''` is needed to allow imports without an extension
    // - note the `.` before extensions as it will fail to match without!
    resolve: {
        extensions: ['', '.js', '.jsx']
    },
    // Tells Webpack how to write the compiled files to disk
    // Note, that while there can be multiple entry points, only one output
    // configuration is specified
    output: {
        path: PATHS.build,
        // `[name]` is replaced by the name of the chunk
        filename: '[name].js'
    },
    module: {
        // see: https://github.com/isagalaev/highlight.js/issues/895 and
        // https://github.com/webpack/webpack/issues/1721
        noParse: [ /autoit\.js$/ ],
        // Loaders that run *before* others loaders
        preLoaders: [
            {
                test: /\.jsx?$/,
                loaders: ['eslint'],
                include: PATHS.app
            }
        ],
        // Loaders are transformations that are applied on a resource file of
        // an application
        loaders: [
            {
                test: /\.jsx?$/,
                // Enable caching for improved performance during development
                // It uses default OS directory by default. Future webpack
                // builds will attempt to read from the cache to avoid needing
                // to run the potentially expensive Babel recompilation process
                // on each run.
                loaders: ['babel?cacheDirectory'],
                // Parse only app files! Without this it will go through entire
                // project. In addition to being slow, that will most likely
                // result in an error.
                include: PATHS.app
            },
            // Copy fonts
            {
                test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
                loaders: ['file?name=[path][name].[ext]&context=./app'],
                include: PATHS.app
            }
        ]
    },
    // Plugins do not operate on individual source files: they influence the
    // build process as a whole
    plugins: [
        // Add any given string to the top of the generated bundle file
        new webpack.BannerPlugin('By the good folks at TailorDev SAS'),
        // Generate the final HTML5 file, nd include all your webpack bundles
        new HtmlWebpackPlugin({
            // Here, we use the `html-webpack-template` npm package
            template: 'node_modules/html-webpack-template/index.ejs',
            // The page's title is read from npm's `package.json` file
            title: pkg.name,
            // Main "div" `id`
            appMountId: 'app',
            // No need to inject assets in the given template as it is handled
            // by the template itself
            inject: false
        })
    ]
};

// Default configuration
if (TARGET === 'dev' || !TARGET) {
    module.exports = merge(common, {
        // Enable sourcemaps
        devtool: 'eval-source-map',
        // Development server + Hot Module Replacement
        devServer: {
            // Enable history API fallback so HTML5 History API based routing
            // works. This is a good default that will come in handy in more
            // complicated setups.
            historyApiFallback: true,
            // Enable hot code replacement
            hot: true,
            // Let Webpack generate the client portion used to connect the
            // generated bundle running in-memory to the development server
            inline: true,
            // Display some kind of progress bar
            progress: true,
            // Display only errors to reduce the amount of output.
            stats: 'errors-only',
            // Development server settings
            host: process.env.HOST || '127.0.0.1',
            port: process.env.PORT || 8080
        },
        module: {
            loaders: [
                {
                    test: /\.scss$/,
                    // Loaders are applied from right to left
                    loaders: ['style', 'css', 'sass'],
                    include: PATHS.app
                },
                {
                    test: /\.css$/,
                    loaders: ['style', 'css']
                }
            ]
        },
        plugins: [
            new webpack.HotModuleReplacementPlugin()
        ]
    });
}

// Build for production
if (TARGET === 'build') {
    module.exports = merge(common, {
        // Tell Webpack that we want a separate entry chunk for our project
        // `vendor` level dependencies
        entry: {
            // From npm's `package.json` file
            vendor: Object.keys(pkg.dependencies).filter(function(dep) {
                return dep !== 'express';
            })
        },
        output: {
            path: PATHS.build,
            // Set up caching by adding cache busting hashes to filenames
            // `[chunkhash]` returns a chunk specific hash
            filename: '[name].[chunkhash].js',
            // The filename of non-entry chunks
            chunkFilename: '[chunkhash].js'
        },
        module: {
            loaders: [
                // Extract CSS during build
                {
                    test: /\.(css|scss)$/,
                    loader: ExtractTextPlugin.extract('style', 'css!sass')
                }
            ]
        },
        plugins: [
            // `rm -rf`
            new CleanPlugin([ PATHS.build ]),
            // Setting DefinePlugin affects React library size!
            // DefinePlugin replaces content "as is" so we need some extra
            // quotes for the generated code to make sense
            new webpack.DefinePlugin({
                'process.env.NODE_ENV': '"production"'
            }),
            // Output extracted CSS to a file
            new ExtractTextPlugin('[name].[chunkhash].css'),
            // Allow to extract the code we need for the `vendor` bundle,
            // otherwise `app.js` will still contains `vendor` dependencies
            new webpack.optimize.CommonsChunkPlugin({
                // Extract vendor and manifest files, the latter being a file
                // that tells Webpack how to map each module to each file
                names: ['vendor', 'manifest']
            }),
            // Minification with Uglify
            new webpack.optimize.UglifyJsPlugin({
                compress: {
                    // Ignore warning messages are they are pretty useless
                    warnings: false
                }
            })
        ]
    });
}
<commit_msg>Fix undefined jQuery<commit_after>const path    = require('path');
const merge   = require('webpack-merge');
const webpack = require('webpack');

// Webpack plugins
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

// Read `package.json` file
const pkg = require('./package.json');

// Define some constants
const TARGET = process.env.npm_lifecycle_event;
const PATHS  = {
    app: path.join(__dirname, 'app'),
    build: path.join(__dirname, 'build')
};

// Used to configure Babel (see: `.babelrc` file)
process.env.BABEL_ENV = TARGET;

// Common config, shared by all "targets"
const common = {
    // Entry points are used to define "bundles"
    entry: {
        app: PATHS.app
    },
    // Extensions that should be used to resolve module
    //
    // - `''` is needed to allow imports without an extension
    // - note the `.` before extensions as it will fail to match without!
    resolve: {
        extensions: ['', '.js', '.jsx']
    },
    // Tells Webpack how to write the compiled files to disk
    // Note, that while there can be multiple entry points, only one output
    // configuration is specified
    output: {
        path: PATHS.build,
        // `[name]` is replaced by the name of the chunk
        filename: '[name].js'
    },
    module: {
        // see: https://github.com/isagalaev/highlight.js/issues/895 and
        // https://github.com/webpack/webpack/issues/1721
        noParse: [ /autoit\.js$/ ],
        // Loaders that run *before* others loaders
        preLoaders: [
            {
                test: /\.jsx?$/,
                loaders: ['eslint'],
                include: PATHS.app
            }
        ],
        // Loaders are transformations that are applied on a resource file of
        // an application
        loaders: [
            {
                test: /\.jsx?$/,
                // Enable caching for improved performance during development
                // It uses default OS directory by default. Future webpack
                // builds will attempt to read from the cache to avoid needing
                // to run the potentially expensive Babel recompilation process
                // on each run.
                loaders: ['babel?cacheDirectory'],
                // Parse only app files! Without this it will go through entire
                // project. In addition to being slow, that will most likely
                // result in an error.
                include: PATHS.app
            },
            // Copy fonts
            {
                test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
                loaders: ['file?name=[path][name].[ext]&context=./app'],
                include: PATHS.app
            }
        ]
    },
    // Plugins do not operate on individual source files: they influence the
    // build process as a whole
    plugins: [
        // Add any given string to the top of the generated bundle file
        new webpack.BannerPlugin('By the good folks at TailorDev SAS'),
        // Generate the final HTML5 file, nd include all your webpack bundles
        new HtmlWebpackPlugin({
            // Here, we use the `html-webpack-template` npm package
            template: 'node_modules/html-webpack-template/index.ejs',
            // The page's title is read from npm's `package.json` file
            title: pkg.name,
            // Main "div" `id`
            appMountId: 'app',
            // No need to inject assets in the given template as it is handled
            // by the template itself
            inject: false
        })
    ]
};

// Default configuration
if (TARGET === 'dev' || !TARGET) {
    module.exports = merge(common, {
        // Enable sourcemaps
        devtool: 'eval-source-map',
        // Development server + Hot Module Replacement
        devServer: {
            // Enable history API fallback so HTML5 History API based routing
            // works. This is a good default that will come in handy in more
            // complicated setups.
            historyApiFallback: true,
            // Enable hot code replacement
            hot: true,
            // Let Webpack generate the client portion used to connect the
            // generated bundle running in-memory to the development server
            inline: true,
            // Display some kind of progress bar
            progress: true,
            // Display only errors to reduce the amount of output.
            stats: 'errors-only',
            // Development server settings
            host: process.env.HOST || '127.0.0.1',
            port: process.env.PORT || 8080
        },
        module: {
            loaders: [
                {
                    test: /\.scss$/,
                    // Loaders are applied from right to left
                    loaders: ['style', 'css', 'sass'],
                    include: PATHS.app
                },
                {
                    test: /\.css$/,
                    loaders: ['style', 'css']
                }
            ]
        },
        plugins: [
            new webpack.HotModuleReplacementPlugin()
        ]
    });
}

// Build for production
if (TARGET === 'build') {
    module.exports = merge(common, {
        // Tell Webpack that we want a separate entry chunk for our project
        // `vendor` level dependencies
        entry: {
            // From npm's `package.json` file
            vendor: Object.keys(pkg.dependencies).filter(function(dep) {
                return dep !== 'express';
            })
        },
        output: {
            path: PATHS.build,
            // Set up caching by adding cache busting hashes to filenames
            // `[chunkhash]` returns a chunk specific hash
            filename: '[name].[chunkhash].js',
            // The filename of non-entry chunks
            chunkFilename: '[chunkhash].js'
        },
        module: {
            loaders: [
                // Extract CSS during build
                {
                    test: /\.(css|scss)$/,
                    loader: ExtractTextPlugin.extract('style', 'css!sass')
                }
            ]
        },
        plugins: [
            // `rm -rf`
            new CleanPlugin([ PATHS.build ]),
            // Setting DefinePlugin affects React library size!
            // DefinePlugin replaces content "as is" so we need some extra
            // quotes for the generated code to make sense
            new webpack.DefinePlugin({
                'process.env.NODE_ENV': '"production"'
            }),
            new webpack.ProvidePlugin({
              jQuery: "jquery",
              "window.jQuery": "jquery"
            }),
            // Output extracted CSS to a file
            new ExtractTextPlugin('[name].[chunkhash].css'),
            // Allow to extract the code we need for the `vendor` bundle,
            // otherwise `app.js` will still contains `vendor` dependencies
            new webpack.optimize.CommonsChunkPlugin({
                // Extract vendor and manifest files, the latter being a file
                // that tells Webpack how to map each module to each file
                names: ['vendor', 'manifest']
            }),
            // Minification with Uglify
            new webpack.optimize.UglifyJsPlugin({
                compress: {
                    // Ignore warning messages are they are pretty useless
                    warnings: false
                }
            })
        ]
    });
}
<|endoftext|>


<commit_before>const webpack = require('webpack')
const path = require('path')

module.exports = {
  target: 'web',
  module: {
    loaders: [{
      test: /\.js$/,
      loaders: ['babel-loader'],
      exclude: /node_modules/,
    }],
  },
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'test'),
    filename: 'nonogram.js',
    library: 'nonogram',
    libraryTarget: 'umd',
  },
  resolve: {
    extensions: ['', '.js'],
  },
}
<commit_msg>beautify webpack.config<commit_after>const path = require('path')

module.exports = {
  target: 'web',
  module: {
    loaders: [{
      test: /\.js$/,
      loader: 'babel-loader',
      exclude: /node_modules/,
    }],
  },
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'test'),
    filename: 'nonogram.js',
    library: 'nonogram',
    libraryTarget: 'umd',
  },
  resolve: {
    extensions: ['', '.js'],
  },
}
<|endoftext|>


<commit_before>var path = require('path');
var webpack = require('webpack');
var APP_DIR = path.resolve(__dirname, 'client/src');

// Add spec files to compile
module.exports = {
  devtool: 'eval',
  entry: [
    //entry for webpack to look for current code when change
    'webpack-hot-middleware/client',
    'webpack/hot/dev-server',
    //entry to create bundle for the first time entering app
    APP_DIR + '/index.jsx'
  ],
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'index.bundle.js',
    publicPath: 'http://localhost:8800/dist/'
  },
  // devServer: {
  //   hot: true,
  //   inline: true,
  //   port: 7700,
  //   historyApiFallback: true
  // },
  plugins: [
    // optimizes the order and efficiency of module usage
    // new webpack.optimize.OccurrenceOrderPlugin(),
    // allows changes to be replaced 'hot-modularly'. >> A middleware within your server
    new webpack.HotModuleReplacementPlugin(),
    // won't allow webpack to finish the build if it encounters an error
    // new webpack.NoErrorsPlugin()
  ],
  module: {
    loaders: [{
      test: /\.jsx?$/,
      // exclude: /node_modules/,
      loaders: ['react-hot', 'babel'],
      include: APP_DIR
      // query: {
      //   presets: ['react', 'es2015', 'react-hmre']
      // }
    }]
  }
};
<commit_msg>delete comments from webpack<commit_after>var path = require('path');
var webpack = require('webpack');
var APP_DIR = path.resolve(__dirname, 'client/src');

// Add spec files to compile
module.exports = {
  devtool: 'eval',
  entry: [
    //entry for webpack to look for current code when change
    'webpack-hot-middleware/client',
    'webpack/hot/dev-server',
    //entry to create bundle for the first time entering app
    APP_DIR + '/index.jsx'
  ],
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'index.bundle.js',
    publicPath: 'http://localhost:8800/dist/'
  },
  // devServer: {
  //   hot: true,
  //   inline: true,
  //   port: 7700,
  //   historyApiFallback: true
  // },
  plugins: [
    // optimizes the order and efficiency of module usage
    // new webpack.optimize.OccurrenceOrderPlugin(),
    // allows changes to be replaced 'hot-modularly'. >> A middleware within your server
    new webpack.HotModuleReplacementPlugin(),
  ],
  module: {
    loaders: [{
      test: /\.jsx?$/,
      // exclude: /node_modules/,
      loaders: ['react-hot', 'babel'],
      include: APP_DIR
    }]
  }
};
<|endoftext|>


<commit_before>const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

const SRC_DIR = `${__dirname}/src`;
const DIST_DIR = `${__dirname}/dist`;

module.exports = {
  context: SRC_DIR,
  resolve: {
    extensions: ['.js', '.scss'],
  },
  entry: {
    main: './index.js',
  },
  output: {
    path: `${DIST_DIR}/`,
    filename: 'react-power-select.js',
  },

  module: {
    rules: [
      {
        test: /\.js$/,
        use: [
          {
            loader: 'babel-loader',
            options: {
              cacheDirectory: true,
              presets: ['es2015', 'react', 'stage-0'],
            },
          },
        ],
      },
      {
        test: /\.scss$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            {
              loader: 'css-loader',
            },
            {
              loader: 'sass-loader',
            },
          ],
        }),
      },
    ],
  },

  plugins: [
    new webpack.ProvidePlugin({
      React: 'react',
    }),

    new ExtractTextPlugin({
      filename: 'react-power-select.css',
    }),
  ],
};
<commit_msg>Minify dist o/p<commit_after>const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

const SRC_DIR = `${__dirname}/src`;
const DIST_DIR = `${__dirname}/dist`;

module.exports = {
  context: SRC_DIR,
  resolve: {
    extensions: ['.js', '.scss'],
  },
  entry: {
    main: './index.js',
  },
  output: {
    path: `${DIST_DIR}/`,
    filename: 'react-power-select.js',
  },

  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'babel-loader',
            options: {
              cacheDirectory: true,
              presets: ['es2015', 'react', 'stage-0'],
            },
          },
        ],
      },
      {
        test: /\.scss$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            {
              loader: 'css-loader',
              options: {
                minimize: true,
              },
            },
            {
              loader: 'sass-loader',
            },
          ],
        }),
      },
    ],
  },

  plugins: [
    new webpack.ProvidePlugin({
      React: 'react',
    }),

    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false,
      },
      output: {
        comments: false,
      },
    }),

    new ExtractTextPlugin({
      filename: 'react-power-select.css',
    }),
  ],
};
<|endoftext|>


<commit_before>/*
 * Copyright (c) 2002-2011 "Neo Technology,"
 * Network Engine for Objects in Lund AB [http://neotechnology.com]
 *
 * This file is part of Neo4j.
 *
 * Neo4j is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
(function() {
  /*
  Copyright (c) 2002-2011 "Neo Technology,"
  Network Engine for Objects in Lund AB [http://neotechnology.com]

  This file is part of Neo4j.

  Neo4j is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero 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 Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with this program. If not, see <http://www.gnu.org/licenses/>.
  */  var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
  define(['lib/jquery', 'lib/jquery.hotkeys'], function() {
    var KeyboardShortcuts;
    return KeyboardShortcuts = (function() {
      KeyboardShortcuts.prototype.shortcuts = {
        "s": "search"
      };
      function KeyboardShortcuts(databrowserController) {
        this.search = __bind(this.search, this);;
        this.init = __bind(this.init, this);;        this.databrowserController = databrowserController;
      }
      KeyboardShortcuts.prototype.init = function() {
        var definition, method, _ref, _results;
        _ref = this.shortcuts;
        _results = [];
        for (definition in _ref) {
          method = _ref[definition];
          _results.push($(document).bind("keydown", definition, this[method]));
        }
        return _results;
      };
      KeyboardShortcuts.prototype.search = function(ev) {
        return alert("AA");
      };
      return KeyboardShortcuts;
    })();
  });
}).call(this);
<commit_msg>removing<commit_after><|endoftext|>


<commit_before>'use strict';

var webpack = require('webpack');
var path = require('path');
var extractTextPlugin = require('extract-text-webpack-plugin');

var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common.js');
var noErrorsPlugin = new webpack.NoErrorsPlugin();
var extractCss = new extractTextPlugin('style.css');

module.exports = {
  entry: {
    querysearch: './src/components/querySearch/index.js',
    logo: './src/components/logo/index.js',
    autocomplete: './src/components/autocomplete/index.js'
  },
  output: {
    path: path.join(__dirname, 'public/js'),
    filename: '[name].js'
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        //exclude: /node_modules/,
        loader: 'babel-loader'
      },
      {
        test: /\.scss$/,
        loader: extractTextPlugin.extract(
          // activate source maps via loader query
          'css?sourceMap!' +
          'sass?sourceMap'
        )
      }
    ]
  },
  plugins: [
    commonsPlugin,
    extractCss,
    noErrorsPlugin
  ]
};
<commit_msg>in webpack.config: - re-enabled exclusion of node_modules (loaders)  - disabled inclusion querystring as it breaks compilation due to use of stylesheets<commit_after>'use strict';

var webpack = require('webpack');
var path = require('path');
var extractTextPlugin = require('extract-text-webpack-plugin');

var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common.js');
var noErrorsPlugin = new webpack.NoErrorsPlugin();
var extractCss = new extractTextPlugin('style.css');

module.exports = {
  entry: {
    //querysearch: './src/components/querySearch/index.js',
    logo: './src/components/logo/index.js',
    autocomplete: './src/components/autocomplete/index.js'
  },
  output: {
    path: path.join(__dirname, 'public/js'),
    filename: '[name].js'
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel-loader'
      },
      {
        test: /\.scss$/,
        loader: extractTextPlugin.extract(
          // activate source maps via loader query
          'css?sourceMap!' +
          'sass?sourceMap'
        )
      }
    ]
  },
  plugins: [
    commonsPlugin,
    extractCss,
    noErrorsPlugin
  ]
};
<|endoftext|>


<commit_before>let webpack = require('webpack');
let path = require('path');
module.exports = {
  entry: ['babel-polyfill', './source/client.js'],
  output: {
    filename: 'index.js',
    path: path.resolve(__dirname, 'public/')
  },
  plugins:[
    new webpack.DefinePlugin({
      'process.env':{
        'NODE_ENV': JSON.stringify('production')
      }
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress:{
        warnings: false,
        drop_console: true
      }
    })
  ],
  module: {
    loaders: [
    {
      test: /\.js$/,
      exclude: /(node_modules)/,
      loader: 'babel-loader',
      query: {
        presets: ['es2015', 'react']
      }
    }
   ]
 }
};
/*
  devServer: {
    inline: true,
    contentBase: './public',
    port: 3000,
    host: '0.0.0.0'
  },
*/<commit_msg>Remove webpack dev server definition<commit_after>let webpack = require('webpack');
let path = require('path');
module.exports = {
  entry: ['babel-polyfill', './source/client.js'],
  output: {
    filename: 'index.js',
    path: path.resolve(__dirname, 'public/')
  },
  plugins:[
    new webpack.DefinePlugin({
      'process.env':{
        'NODE_ENV': JSON.stringify('production')
      }
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress:{
        warnings: false,
        drop_console: true
      }
    })
  ],
  module: {
    loaders: [
    {
      test: /\.js$/,
      exclude: /(node_modules)/,
      loader: 'babel-loader',
      query: {
        presets: ['es2015', 'react']
      }
    }
   ]
 }
};<|endoftext|>


<commit_before>var webpack = require('webpack')
var path = require('path')

module.exports = {
  entry: {
    bundle: ["!bootstrap-webpack!./assets/bootstrap.config.js",
              "font-awesome-webpack!./font-awesome.config.js",
              './assets/javascripts/entry.jsx']},
  output: {
    path: __dirname + "/static",
    publicPath: "",
    filename: "js/[name].js",
    chunkFilename: "js/[id].js"
  },
  resolve: {
    modulesDirectories: ['node_modules', 'assets'],
    fallback: ['./assets']
  },
  module: {
    loaders: [
      { test: /\.css/, loader: "style-loader!css-loader" },
      { test: /\.less$/, loader: "style-loader!css-loader!less-loader" },
      { test: /\.gif/, loader: "url-loader?limit=10000&minetype=image/gif" },
      { test: /\.jpg/, loader: "url-loader?limit=10000&minetype=image/jpg" },
      { test: /\.png/, loader: "url-loader?limit=10000&minetype=image/png" },

      { test: /\.jsx$/,  loader: 'jsx-loader?harmony' },
      { test: /\.woff(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&minetype=application/font-woff" },
      { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }
    ]
  },

  plugins: [
    new webpack.IgnorePlugin(/vertx/)
  ]
}
<commit_msg>support woff2 format<commit_after>var webpack = require('webpack')
var path = require('path')

module.exports = {
  entry: {
    bundle: ["!bootstrap-webpack!./assets/bootstrap.config.js",
              "font-awesome-webpack!./font-awesome.config.js",
              './assets/javascripts/entry.jsx']},
  output: {
    path: __dirname + "/static",
    publicPath: "",
    filename: "js/[name].js",
    chunkFilename: "js/[id].js"
  },
  resolve: {
    modulesDirectories: ['node_modules', 'assets'],
    fallback: ['./assets']
  },
  module: {
    loaders: [
      { test: /\.css/, loader: "style-loader!css-loader" },
      { test: /\.less$/, loader: "style-loader!css-loader!less-loader" },
      { test: /\.gif/, loader: "url-loader?limit=10000&minetype=image/gif" },
      { test: /\.jpg/, loader: "url-loader?limit=10000&minetype=image/jpg" },
      { test: /\.png/, loader: "url-loader?limit=10000&minetype=image/png" },

      { test: /\.jsx$/,  loader: 'jsx-loader?harmony' },
      { test: /\.woff(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&minetype=application/font-woff" },
      { test: /\.woff2(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff2" },
      { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }
    ]
  },

  plugins: [
    new webpack.IgnorePlugin(/vertx/)
  ]
}
<|endoftext|>


<commit_before>"use strict";

module.exports = {
  entry: './src/main.tsx',
  output: {
    filename: 'www/js/main.js'
  },
  resolve: {
    root: __dirname + 'src/',
    extensions: ["",".ts",".tsx",".js"]
  },
  module: {
    loaders: [
      {
        test:     /\.tsx?$/,
        exclude:  /node_modules/,
        loader:  'ts-loader'
      },
      {
        test: /\.css$/,
        loader: [
          'style-loader',
          'css-loader'
        ]
      },
      {
        test: /\.json$/,
        loader: 'json'
      }
    ]
  }
};<commit_msg>Format  webpack.config.js<commit_after>"use strict";

module.exports = {
  entry: './src/main.tsx',
  output: {
    filename: 'www/js/main.js'
  },
  resolve: {
    root: __dirname + 'src/',
    extensions: ["", ".ts", ".tsx", ".js"]
  },
  module: {
    loaders: [
      {
        test: /\.tsx?$/,
        exclude: /node_modules/,
        loader: 'ts-loader'
      },
      {
        test: /\.css$/,
        loader: [
          'style-loader',
          'css-loader'
        ]
      },
      {
        test: /\.json$/,
        loader: 'json'
      }
    ]
  }
};<|endoftext|>


<commit_before>require('node-jsx').install();

var index = require('./index-static.jsx');

module.exports = {
  entry: './index-static.jsx',
  output: {
    path: __dirname + '/dist',
    filename: index.JS_FILENAME
  },
  module: {
    loaders: [
      {test: /\.jsx$/, loader: "jsx-loader"}
    ]
  }
};
<commit_msg>use uglifyJS on bundle.js.<commit_after>var webpack = require('webpack');

require('node-jsx').install();

var index = require('./index-static.jsx');

module.exports = {
  entry: './index-static.jsx',
  output: {
    path: __dirname + '/dist',
    filename: index.JS_FILENAME
  },
  module: {
    loaders: [
      {test: /\.jsx$/, loader: "jsx-loader"}
    ]
  },
  plugins: [
    new webpack.optimize.UglifyJsPlugin()
  ]
};
<|endoftext|>


<commit_before>var webpack = require('webpack')

const DIST_DIRECTORY = './dist'

module.exports = {
  entry: {
    main: DIST_DIRECTORY
  },
  externals: [{
    'react': true,
    'react-dom': true,
    'react-dom/server': true
  }],
  output: {
    filename: 'react-native-web.js',
    library: 'ReactNativeWeb',
    libraryTarget: 'umd',
    path: DIST_DIRECTORY
  },
  plugins: [
    new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }),
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        dead_code: true,
        drop_console: true,
        screw_ie8: true,
        warnings: true
      }
    })
  ]
}
<commit_msg>Fix UMD bundle<commit_after>var webpack = require('webpack')

const DIST_DIRECTORY = './dist'

module.exports = {
  entry: {
    main: DIST_DIRECTORY
  },
  output: {
    filename: 'ReactNative.js',
    library: 'React',
    libraryTarget: 'umd',
    path: DIST_DIRECTORY
  },
  plugins: [
    new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }),
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        dead_code: true,
        drop_console: true,
        screw_ie8: true,
        warnings: true
      }
    })
  ]
}
<|endoftext|>