| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 /* | 
|  | 2  * This file is part of Adblock Plus <https://adblockplus.org/>, | 
|  | 3  * Copyright (C) 2006-present eyeo GmbH | 
|  | 4  * | 
|  | 5  * Adblock Plus is free software: you can redistribute it and/or modify | 
|  | 6  * it under the terms of the GNU General Public License version 3 as | 
|  | 7  * published by the Free Software Foundation. | 
|  | 8  * | 
|  | 9  * Adblock Plus is distributed in the hope that it will be useful, | 
|  | 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 12  * GNU General Public License for more details. | 
|  | 13  * | 
|  | 14  * You should have received a copy of the GNU General Public License | 
|  | 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
|  | 16  */ | 
|  | 17 | 
|  | 18 const path = require("path"); | 
|  | 19 | 
|  | 20 let {EXTENSION_PATH, ENTRY_POINTS, OUTPUT_PATH, BUNDLE_NAME, | 
|  | 21      RESOLVE_PATHS, INFO_PATH} = require("process").env; | 
|  | 22 | 
|  | 23 module.exports = { | 
|  | 24   context: EXTENSION_PATH, | 
|  | 25   devtool: "source-map", | 
|  | 26   entry: ENTRY_POINTS.split(" "), | 
|  | 27   externals: { | 
|  | 28     // Workaround for the fact that adblockplusui attempts to require | 
|  | 29     // "ext_background" (meaning adblockplusui/ext/background.js) if ext is | 
|  | 30     // falsey at bundle time. Once we've gotten rid of ext, or at least | 
|  | 31     // removed those requires from adblockplusui we can remove this. | 
|  | 32     ext_background: "ext" | 
|  | 33   }, | 
|  | 34   output: { | 
|  | 35     path: OUTPUT_PATH, | 
|  | 36     filename: BUNDLE_NAME | 
|  | 37   }, | 
|  | 38   resolve: { | 
|  | 39     modules: RESOLVE_PATHS.split(" "), | 
|  | 40     alias: { | 
|  | 41       info$: INFO_PATH, | 
|  | 42       // Prevent builtin Node.js modules from being used instead of our own when | 
|  | 43       // the names clash. Once relative paths are used this won't be necessary. | 
|  | 44       url$: "url.js", | 
|  | 45       events$: "events.js", | 
|  | 46       punycode$: "punycode.js" | 
|  | 47     }, | 
|  | 48     plugins: [ | 
|  | 49       function() | 
|  | 50       { | 
|  | 51         // Our old module system in packagerChrome.py used to prefix | 
|  | 52         // module names with the name of their parent directory and an | 
|  | 53         // underscore - but only when that directory wasn't called | 
|  | 54         // "lib". This plugin is for backwards compatability, but can | 
|  | 55         // be removed once use of that deprecated syntax has been | 
|  | 56         // replaced. | 
|  | 57         this.plugin("described-resolve", (request, callback) => | 
|  | 58         { | 
|  | 59           let target = request.request; | 
|  | 60 | 
|  | 61           let prefix_index = target.indexOf("_"); | 
|  | 62           if (prefix_index == -1) | 
|  | 63             return callback(); | 
|  | 64 | 
|  | 65           let prefix = target.substring(0, prefix_index); | 
|  | 66           if (prefix == "lib") | 
|  | 67             return callback(); | 
|  | 68 | 
|  | 69           let fixed_target = path.join(prefix, | 
|  | 70                                        target.substring(prefix_index + 1)); | 
|  | 71           return this.doResolve( | 
|  | 72             "resolve", Object.assign({}, request, {request: fixed_target}), | 
|  | 73             "Changed prefixed path using legacy buildtools syntax from " + | 
|  | 74             target + " to " + fixed_target, | 
|  | 75             callback | 
|  | 76           ); | 
|  | 77         }); | 
|  | 78       } | 
|  | 79     ] | 
|  | 80   } | 
|  | 81 }; | 
| OLD | NEW | 
|---|