OLD | NEW |
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.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: path.resolve(""), |
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 exists. | 66 // an alias to a file that exists. |
67 info$: path.join(__dirname, "info.js"), | 67 info$: path.join(__dirname, "info.js"), |
68 // 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 |
69 // 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 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 else if (stats.hasErrors()) | 131 else if (stats.hasErrors()) |
132 throw new Error(stats.toJson().errors.join("\n")); | 132 throw new Error(stats.toJson().errors.join("\n")); |
133 else | 133 else |
134 { | 134 { |
135 let output = {}; | 135 let output = {}; |
136 let files = output.files = {}; | 136 let files = output.files = {}; |
137 | 137 |
138 for (let config of options) | 138 for (let config of options) |
139 { | 139 { |
140 let filepath = path.join(config.output.path, config.output.filename); | 140 let filepath = path.join(config.output.path, config.output.filename); |
141 let relativeFilepath = path.relative("/", filepath); | 141 let relativeFilepath = path.relative("", config.output.filename); |
142 files[relativeFilepath] = memoryFS.readFileSync(filepath, "utf-8"); | 142 files[relativeFilepath] = memoryFS.readFileSync(filepath, "utf-8"); |
143 files[relativeFilepath + ".map"] = memoryFS.readFileSync( | 143 files[relativeFilepath + ".map"] = memoryFS.readFileSync( |
144 filepath + ".map", "utf-8" | 144 filepath + ".map", "utf-8" |
145 ); | 145 ); |
146 } | 146 } |
147 | 147 |
148 // We provide a list of all the bundled files, so the packager can avoid | 148 // We provide a list of all the bundled files, so the packager can avoid |
149 // including them again outside of a bundle. Otherwise we end up including | 149 // including them again outside of a bundle. Otherwise we end up including |
150 // duplicate copies in our builds. | 150 // duplicate copies in our builds. |
151 let included = new Set(); | 151 let included = new Set(); |
152 for (let bundle of stats.toJson().children) | 152 for (let bundle of stats.toJson().children) |
153 { | 153 { |
154 for (let chunk of bundle.chunks) | 154 for (let chunk of bundle.chunks) |
155 { | 155 { |
156 for (let module of chunk.modules) | 156 for (let module of chunk.modules) |
157 { | 157 { |
158 if (!module.name.startsWith("multi ")) | 158 if (!module.name.startsWith("multi ")) |
159 included.add(path.relative(extension_path, module.name)); | 159 included.add(path.relative(extension_path, module.name)); |
160 } | 160 } |
161 } | 161 } |
162 } | 162 } |
163 output.included = Array.from(included); | 163 output.included = Array.from(included); |
164 | 164 |
165 console.log(JSON.stringify(output)); | 165 console.log(JSON.stringify(output)); |
166 } | 166 } |
167 }); | 167 }); |
168 }); | 168 }); |
OLD | NEW |