source: trip-planner-front/node_modules/adjust-sourcemap-loader/lib/loader.js@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1'use strict';
2
3var path = require('path');
4
5var loaderUtils = require('loader-utils');
6
7var process = require('./process');
8
9/**
10 * Webpack loader that manipulates the source-map of a preceding loader.
11 * @this {object} The loader context
12 * @param {string} content The content
13 * @param {object} sourceMap The source-map
14 * @returns {string|String}
15 */
16function loader(content, sourceMap) {
17 /* jshint validthis:true */
18
19 // loader result is cacheable
20 this.cacheable();
21
22 // webpack 1: prefer loader query, else options object
23 // webpack 2: prefer loader options
24 // webpack 3: deprecate loader.options object
25 // webpack 4: loader.options no longer defined
26 var options = Object.assign(
27 {},
28 this.options && this.options.adjustSourcemapLoader,
29 loaderUtils.getOptions(this),
30 {sep: path.sep}
31 );
32
33 // process the source-map
34 var outputMap = process(this, options, sourceMap);
35
36 // need to use callback when there are multiple arguments
37 this.callback(null, content, outputMap);
38}
39
40module.exports = loader;
Note: See TracBrowser for help on using the repository browser.