LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // larger than actually producing bundles we avoid paying it multiple times, | 43 // larger than actually producing bundles we avoid paying it multiple times, |
44 // instead producing all the bundles in one go. | 44 // instead producing all the bundles in one go. |
45 let options = []; | 45 let options = []; |
46 for (let {bundle_name, entry_points} of bundles) | 46 for (let {bundle_name, entry_points} of bundles) |
47 { | 47 { |
48 options.push({ | 48 options.push({ |
49 context: extension_path, | 49 context: extension_path, |
50 devtool: "source-map", | 50 devtool: "source-map", |
51 module: { | 51 module: { |
52 rules: [{ | 52 rules: [{ |
53 include: path.join(__dirname, "info-loader.js"), | 53 include: path.join(__dirname, "info.js"), |
54 use: ["info-loader"] | 54 use: ["info-loader"] |
55 }] | 55 }] |
56 }, | 56 }, |
57 entry: entry_points, | 57 entry: entry_points, |
58 output: { | 58 output: { |
59 path: "/", | 59 path: "/", |
60 filename: bundle_name | 60 filename: bundle_name |
61 }, | 61 }, |
62 resolve: { | 62 resolve: { |
63 modules: resolve_paths, | 63 modules: resolve_paths, |
64 alias: { | 64 alias: { |
65 // To use our custom loader for the info module we must first set up | 65 // To use our custom loader for the info module we must first set up |
66 // an alias to a file that actually exists. We use the loader's file | 66 // an alias to a file that exists. |
67 // itself so it's self contained, but any existing file path would | 67 info$: path.join(__dirname, "info.js"), |
68 // work. | |
69 info$: path.join(__dirname, "info-loader.js"), | |
70 // Prevent builtin Node.js modules from being used instead of our own | 68 // Prevent builtin Node.js modules from being used instead of our own |
71 // when the names clash. Once relative paths are used this won't be | 69 // when the names clash. Once relative paths are used this won't be |
72 // necessary. | 70 // necessary. |
73 url$: "url.js", | 71 url$: "url.js", |
74 events$: "events.js", | 72 events$: "events.js", |
75 punycode$: "punycode.js" | 73 punycode$: "punycode.js" |
76 }, | 74 }, |
77 plugins: [ | 75 plugins: [ |
78 function() | 76 function() |
79 { | 77 { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 else | 133 else |
136 { | 134 { |
137 let files = {}; | 135 let files = {}; |
138 | 136 |
139 for (let config of options) | 137 for (let config of options) |
140 { | 138 { |
141 let filepath = path.join(config.output.path, config.output.filename); | 139 let filepath = path.join(config.output.path, config.output.filename); |
142 let mappath = filepath + ".map"; | 140 let mappath = filepath + ".map"; |
143 files[filepath] = memoryFS.readFileSync(filepath, "utf-8"); | 141 files[filepath] = memoryFS.readFileSync(filepath, "utf-8"); |
144 files[mappath] = memoryFS.readFileSync(mappath, "utf-8"); | 142 files[mappath] = memoryFS.readFileSync(mappath, "utf-8"); |
145 memoryFS.unlinkSync(filepath); | |
146 memoryFS.unlinkSync(mappath); | |
147 } | 143 } |
148 | 144 |
149 console.log(JSON.stringify(files)); | 145 console.log(JSON.stringify(files)); |
150 } | 146 } |
151 }); | 147 }); |
152 }); | 148 }); |
LEFT | RIGHT |