1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = _default;
|
7 |
|
8 | var _lodash = require("lodash");
|
9 |
|
10 | function stripDotSlashPrefix(path) {
|
11 | return path.replace(/^\.\//, '');
|
12 | }
|
13 |
|
14 | function _default(entry, opts) {
|
15 | let clone = (0, _lodash.cloneDeep)(opts);
|
16 | const stripedEntry = stripDotSlashPrefix(entry);
|
17 |
|
18 | if (clone.overridesByEntry) {
|
19 | Object.keys(clone.overridesByEntry).forEach(key => {
|
20 | const stripedKey = stripDotSlashPrefix(key);
|
21 |
|
22 | if (stripedKey !== key) {
|
23 | clone.overridesByEntry[stripedKey] = clone.overridesByEntry[key];
|
24 | }
|
25 | });
|
26 |
|
27 | if (clone.overridesByEntry[stripedEntry]) {
|
28 | clone = (0, _lodash.merge)(clone, clone.overridesByEntry[stripedEntry]);
|
29 | }
|
30 |
|
31 | delete clone.overridesByEntry;
|
32 | }
|
33 |
|
34 | return clone;
|
35 | } |
\ | No newline at end of file |