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 output: { |
| 28 path: OUTPUT_PATH, |
| 29 filename: BUNDLE_NAME |
| 30 }, |
| 31 resolve: { |
| 32 modules: RESOLVE_PATHS.split(" "), |
| 33 alias: { |
| 34 info$: INFO_PATH, |
| 35 // Prevent builtin Node.js modules from being used instead of our own when |
| 36 // the names clash. Once relative paths are used this won't be necessary. |
| 37 url$: "url.js", |
| 38 events$: "events.js", |
| 39 punycode$: "punycode.js" |
| 40 }, |
| 41 plugins: [ |
| 42 function() |
| 43 { |
| 44 // Our old module system in packagerChrome.py used to prefix |
| 45 // module names with the name of their parent directory and an |
| 46 // underscore - but only when that directory wasn't called |
| 47 // "lib". This plugin is for backwards compatability, but can |
| 48 // be removed once use of that deprecated syntax has been |
| 49 // replaced. |
| 50 this.plugin("described-resolve", (request, callback) => |
| 51 { |
| 52 let target = request.request; |
| 53 |
| 54 let prefix_index = target.indexOf("_"); |
| 55 if (prefix_index == -1) |
| 56 return callback(); |
| 57 |
| 58 let prefix = target.substring(0, prefix_index); |
| 59 if (prefix == "lib") |
| 60 return callback(); |
| 61 |
| 62 let fixed_target = path.join(prefix, |
| 63 target.substring(prefix_index + 1)); |
| 64 return this.doResolve( |
| 65 "resolve", Object.assign({}, request, {request: fixed_target}), |
| 66 "Changed prefixed path using legacy buildtools syntax from " + |
| 67 target + " to " + fixed_target, |
| 68 callback |
| 69 ); |
| 70 }); |
| 71 } |
| 72 ] |
| 73 }, |
| 74 stats: { |
| 75 assets: false, |
| 76 children: false, |
| 77 chunks: false, |
| 78 errorDetails: true, |
| 79 errors: true, |
| 80 hash: false, |
| 81 modules: false, |
| 82 publicPath: false, |
| 83 reasons: false, |
| 84 source: false, |
| 85 timings: false, |
| 86 version: false, |
| 87 warnings: true |
| 88 } |
| 89 }; |
OLD | NEW |