1- ' use strict' ;
1+ " use strict" ;
22
33Object . defineProperty ( exports , "__esModule" , {
44 value : true
55} ) ;
6+ exports . default = PostcssVariablesLoader ;
67
7- exports . default = function ( source ) {
8- var _this = this ;
8+ var _loaderUtils = _interopRequireDefault ( require ( "loader-utils" ) ) ;
99
10+ var utils = _interopRequireWildcard ( require ( "./utils" ) ) ;
11+
12+ function _getRequireWildcardCache ( ) { if ( typeof WeakMap !== "function" ) return null ; var cache = new WeakMap ( ) ; _getRequireWildcardCache = function _getRequireWildcardCache ( ) { return cache ; } ; return cache ; }
13+
14+ function _interopRequireWildcard ( obj ) { if ( obj && obj . __esModule ) { return obj ; } if ( obj === null || typeof obj !== "object" && typeof obj !== "function" ) { return { default : obj } ; } var cache = _getRequireWildcardCache ( ) ; if ( cache && cache . has ( obj ) ) { return cache . get ( obj ) ; } var newObj = { } ; var hasPropertyDescriptor = Object . defineProperty && Object . getOwnPropertyDescriptor ; for ( var key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) { var desc = hasPropertyDescriptor ? Object . getOwnPropertyDescriptor ( obj , key ) : null ; if ( desc && ( desc . get || desc . set ) ) { Object . defineProperty ( newObj , key , desc ) ; } else { newObj [ key ] = obj [ key ] ; } } } newObj . default = obj ; if ( cache ) { cache . set ( obj , newObj ) ; } return newObj ; }
15+
16+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
17+
18+ function PostcssVariablesLoader ( source ) {
1019 if ( this . cacheable ) {
1120 this . cacheable ( ) ;
1221 }
1322
14- var options = _loaderUtils2 . default . parseQuery ( this . query ) ;
23+ var options = _loaderUtils . default . getOptions ( this ) || { } ;
24+
1525 var _done = this . async ( ) ;
1626
1727 var transformToConfig = options . es5 ? utils . toES5Config : utils . toConfig ;
1828
19- var end = function end ( err , result , path , map ) {
29+ var end = ( err , result , path , map ) => {
2030 if ( err ) {
2131 _done ( err ) ;
2232 }
@@ -30,37 +40,21 @@ exports.default = function (source) {
3040 return _done ( null , obj , map ) ;
3141 } ;
3242
33- var emitWarnings = function emitWarnings ( result ) {
34- result . warnings ( ) . forEach ( function ( msg ) {
35- return _this . emitWarning ( new Error ( msg . toString ( ) ) ) ;
36- } ) ;
43+ var emitWarnings = result => {
44+ result . warnings ( ) . forEach ( msg => this . emitWarning ( new Error ( msg . toString ( ) ) ) ) ;
3745 return result ;
3846 } ;
3947
40- var onError = function onError ( error ) {
48+ var onError = error => {
4149 if ( error . name === 'CssSyntaxError' ) {
42- _this . emitError ( error . message + error . showSourceCode ( ) ) ;
50+ this . emitError ( error . message + error . showSourceCode ( ) ) ;
4351 end ( ) ;
4452 } else {
4553 end ( error ) ;
4654 }
4755 } ;
4856
49- utils . getPostcss ( true ) . process ( source , { from : this . resourcePath } ) . then ( function ( result ) {
50- return end ( null , result , _this . resourcePath , result . map ) ;
51- } ) . catch ( onError ) ;
52- } ;
53-
54- var _loaderUtils = require ( 'loader-utils' ) ;
55-
56- var _loaderUtils2 = _interopRequireDefault ( _loaderUtils ) ;
57-
58- var _utils = require ( './utils' ) ;
59-
60- var utils = _interopRequireWildcard ( _utils ) ;
61-
62- function _interopRequireWildcard ( obj ) { if ( obj && obj . __esModule ) { return obj ; } else { var newObj = { } ; if ( obj != null ) { for ( var key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) newObj [ key ] = obj [ key ] ; } } newObj . default = obj ; return newObj ; } }
63-
64- function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
65-
66- module . exports = exports [ 'default' ] ;
57+ utils . getPostcss ( true ) . process ( source , {
58+ from : this . resourcePath
59+ } ) . then ( result => end ( null , result , this . resourcePath , result . map ) ) . catch ( onError ) ;
60+ }
0 commit comments