22 MIT License http://www.opensource.org/licenses/mit-license.php
33 Author Tobias Koppers @sokra
44*/
5- import path from ' path' ;
5+ import path from " path" ;
66
7- import { getOptions } from ' loader-utils' ;
8- import { validate } from ' schema-utils' ;
7+ import { getOptions } from " loader-utils" ;
8+ import { validate } from " schema-utils" ;
99
10- import schema from ' ./options.json' ;
11- import { getSourceMappingURL , fetchFromURL , flattenSourceMap } from ' ./utils' ;
10+ import schema from " ./options.json" ;
11+ import { getSourceMappingURL , fetchFromURL , flattenSourceMap } from " ./utils" ;
1212
1313export default async function loader ( input , inputMap ) {
1414 const options = getOptions ( this ) ;
1515
1616 validate ( schema , options , {
17- name : ' Source Map Loader' ,
18- baseDataPath : ' options' ,
17+ name : " Source Map Loader" ,
18+ baseDataPath : " options" ,
1919 } ) ;
2020
2121 const { sourceMappingURL, replacementString } = getSourceMappingURL ( input ) ;
@@ -32,9 +32,9 @@ export default async function loader(input, inputMap) {
3232
3333 try {
3434 behaviourSourceMappingUrl =
35- typeof options . filterSourceMappingUrl !== ' undefined'
35+ typeof options . filterSourceMappingUrl !== " undefined"
3636 ? options . filterSourceMappingUrl ( sourceMappingURL , this . resourcePath )
37- : ' consume' ;
37+ : " consume" ;
3838 } catch ( error ) {
3939 callback ( error ) ;
4040
@@ -43,12 +43,12 @@ export default async function loader(input, inputMap) {
4343
4444 // eslint-disable-next-line default-case
4545 switch ( behaviourSourceMappingUrl ) {
46- case ' skip' :
46+ case " skip" :
4747 callback ( null , input , inputMap ) ;
4848 return ;
4949 case false :
50- case ' remove' :
51- callback ( null , input . replace ( replacementString , '' ) , inputMap ) ;
50+ case " remove" :
51+ callback ( null , input . replace ( replacementString , "" ) , inputMap ) ;
5252 return ;
5353 }
5454
@@ -76,7 +76,7 @@ export default async function loader(input, inputMap) {
7676 let map ;
7777
7878 try {
79- map = JSON . parse ( sourceContent . replace ( / ^ \) \] \} ' / , '' ) ) ;
79+ map = JSON . parse ( sourceContent . replace ( / ^ \) \] \} ' / , "" ) ) ;
8080 } catch ( parseError ) {
8181 this . emitWarning (
8282 new Error (
@@ -104,11 +104,11 @@ export default async function loader(input, inputMap) {
104104 let sourceContent ;
105105
106106 const originalSourceContent =
107- map . sourcesContent && typeof map . sourcesContent [ i ] !== ' undefined'
107+ map . sourcesContent && typeof map . sourcesContent [ i ] !== " undefined"
108108 ? map . sourcesContent [ i ]
109109 : // eslint-disable-next-line no-undefined
110110 undefined ;
111- const skipReading = typeof originalSourceContent !== ' undefined' ;
111+ const skipReading = typeof originalSourceContent !== " undefined" ;
112112 let errored = false ;
113113
114114 // We do not skipReading here, because we need absolute paths in sources.
@@ -150,8 +150,8 @@ export default async function loader(input, inputMap) {
150150 // eslint-disable-next-line no-shadow
151151 const { sourceURL, sourceContent } = source ;
152152
153- newMap . sources . push ( sourceURL || '' ) ;
154- newMap . sourcesContent . push ( sourceContent || '' ) ;
153+ newMap . sources . push ( sourceURL || "" ) ;
154+ newMap . sourcesContent . push ( sourceContent || "" ) ;
155155 } ) ;
156156
157157 const sourcesContentIsEmpty =
@@ -161,5 +161,5 @@ export default async function loader(input, inputMap) {
161161 delete newMap . sourcesContent ;
162162 }
163163
164- callback ( null , input . replace ( replacementString , '' ) , newMap ) ;
164+ callback ( null , input . replace ( replacementString , "" ) , newMap ) ;
165165}
0 commit comments