(map, loaderContext)
| 924 | } |
| 925 | |
| 926 | function normalizeSourceMapForRuntime(map, loaderContext) { |
| 927 | const resultMap = map ? map.toJSON() : null; |
| 928 | |
| 929 | if (resultMap) { |
| 930 | delete resultMap.file; |
| 931 | |
| 932 | /* eslint-disable no-underscore-dangle */ |
| 933 | if ( |
| 934 | loaderContext._compilation && |
| 935 | loaderContext._compilation.options && |
| 936 | loaderContext._compilation.options.devtool && |
| 937 | loaderContext._compilation.options.devtool.includes("nosources") |
| 938 | ) { |
| 939 | /* eslint-enable no-underscore-dangle */ |
| 940 | |
| 941 | delete resultMap.sourcesContent; |
| 942 | } |
| 943 | |
| 944 | resultMap.sourceRoot = ""; |
| 945 | resultMap.sources = resultMap.sources.map((source) => { |
| 946 | // Non-standard syntax from `postcss` |
| 947 | if (source.indexOf("<") === 0) { |
| 948 | return source; |
| 949 | } |
| 950 | |
| 951 | const sourceType = getURLType(source); |
| 952 | |
| 953 | if (sourceType !== "path-relative") { |
| 954 | return source; |
| 955 | } |
| 956 | |
| 957 | const resourceDirname = path.dirname(loaderContext.resourcePath); |
| 958 | const absoluteSource = path.resolve(resourceDirname, source); |
| 959 | const contextifyPath = normalizePath( |
| 960 | path.relative(loaderContext.rootContext, absoluteSource), |
| 961 | ); |
| 962 | |
| 963 | return `webpack://./${contextifyPath}`; |
| 964 | }); |
| 965 | } |
| 966 | |
| 967 | return JSON.stringify(resultMap); |
| 968 | } |
| 969 | |
| 970 | function printParams(media, dedupe, supports, layer) { |
| 971 | let result = ""; |
no test coverage detected