| 214 | */ |
| 215 | const createResolveDependenciesFromContextMap = |
| 216 | (createContextMap) => (fs, options, callback) => { |
| 217 | createContextMap(fs, (err, map) => { |
| 218 | if (err) return callback(err); |
| 219 | const dependencies = Object.keys(map).map( |
| 220 | (key) => |
| 221 | new ContextElementDependency( |
| 222 | map[key] + options.resourceQuery + options.resourceFragment, |
| 223 | key, |
| 224 | options.typePrefix, |
| 225 | /** @type {string} */ |
| 226 | (options.category), |
| 227 | options.referencedExports |
| 228 | ) |
| 229 | ); |
| 230 | callback(null, dependencies); |
| 231 | }); |
| 232 | }; |
| 233 | |
| 234 | module.exports = ContextReplacementPlugin; |