@@ -196,70 +196,244 @@ exports[`"sourceMap" option true should generate source maps #2: warnings 1`] =
196
196
197
197
exports [` "sourceMap" option true should generate source maps and do not change "[contenthash]" on different platform: errors 1` ] = ` Array []` ;
198
198
199
- exports [` "sourceMap" option true should generate source maps and do not change "[contenthash]" on different platform: module 1` ] = `
200
- "// Imports
201
- import ___CSS_LOADER_API_IMPORT___ from \\ "../../../src/runtime/api.js\\ ";
202
- import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\ "-!../../../src/index.js??[ident]!./nested/nested.css\\ ";
199
+ exports [` "sourceMap" option true should generate source maps and do not change "[contenthash]" on different platform: js source map 1` ] = `
200
+ Object {
201
+ " file" : " main.6bf096b30a7d4c501d5b.bundle.js" ,
202
+ "mappings": ";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;AACyE;AACzE,8BAA8B,0DAA2B;AACzD;AACA,8BAA8B,QAAS,YAAY,gBAAgB,GAAG,SAAS,6FAA6F,UAAU,kCAAkC,gBAAgB,GAAG,KAAK;AAChP;AACe,sFAAuB,EAAC;;;;;;;;;;;;ACNvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,QAAQ,EAAE,EAAE,SAAS;AAC9C;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,qBAAqB,iBAAiB;AACtC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,oBAAoB;AACvC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT,uBAAuB,WAAW,OAAO,QAAQ;AACjD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,4BAA4B,EAAE,OAAO;AACxE;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,uDAAuD,cAAc,SAAS,OAAO;;AAErF,gBAAgB,KAAK;AACrB;;;;;;;;;;;;;AC9FA;AAAA;AAAA;AAAA;AAAA;AACsE;AACsC;AAC5G,8BAA8B,0DAA2B;AACzD,0BAA0B,qFAAiC;AAC3D;AACA,8BAA8B,QAAS,WAAW,eAAe,GAAG,SAAS,qFAAqF,UAAU,yDAAyD,YAAY,eAAe,GAAG,KAAK;AACxQ;AACe,sFAAuB,EAAC;;;;;;;;;;;;;ACRvC;AAAA;AAA8B;;AAE9B,aAAa,kDAAG;;AAED,iHAAG,EAAC",
203
+ " names" : Array [],
204
+ " sourceRoot" : " " ,
205
+ " sources" : Array [
206
+ " webpack:///webpack/bootstrap" ,
207
+ " webpack:///./source-map/nested/nested.css" ,
208
+ " webpack:////home/evilebottnawi/IdeaProjects/css-loader/src/runtime/api.js" ,
209
+ " webpack:///./source-map/basic.css" ,
210
+ " webpack:///./source-map/basic.js" ,
211
+ ],
212
+ " sourcesContent" : Array [
213
+ " // The module cache
214
+ var installedModules = {};
215
+
216
+ // The require function
217
+ function __webpack_require__(moduleId ) {
218
+
219
+ // Check if module is in cache
220
+ if (installedModules [moduleId ]) {
221
+ return installedModules [moduleId ].exports ;
222
+ }
223
+ // Create a new module (and put it into the cache)
224
+ var module = installedModules [moduleId ] = {
225
+ i: moduleId ,
226
+ l: false ,
227
+ exports: {}
228
+ };
229
+
230
+ // Execute the module function
231
+ modules [moduleId ].call (module .exports , module , module .exports , __webpack_require__ );
232
+
233
+ // Flag the module as loaded
234
+ module .l = true ;
235
+
236
+ // Return the exports of the module
237
+ return module .exports ;
238
+ }
239
+
240
+
241
+ // expose the modules object (__webpack_modules__)
242
+ __webpack_require__ .m = modules ;
243
+
244
+ // expose the module cache
245
+ __webpack_require__ .c = installedModules ;
246
+
247
+ // define getter function for harmony exports
248
+ __webpack_require__ .d = function (exports , name , getter ) {
249
+ if (! __webpack_require__ .o (exports , name )) {
250
+ Object .defineProperty (exports , name , { enumerable: true , get: getter });
251
+ }
252
+ };
253
+
254
+ // define __esModule on exports
255
+ __webpack_require__ .r = function (exports ) {
256
+ if (typeof Symbol !== ' undefined' && Symbol .toStringTag ) {
257
+ Object .defineProperty (exports , Symbol .toStringTag , { value: ' Module' });
258
+ }
259
+ Object .defineProperty (exports , ' __esModule' , { value: true });
260
+ };
261
+
262
+ // create a fake namespace object
263
+ // mode & 1: value is a module id, require it
264
+ // mode & 2: merge all properties of value into the ns
265
+ // mode & 4: return value when already ns object
266
+ // mode & 8|1: behave like require
267
+ __webpack_require__ .t = function (value , mode ) {
268
+ if (mode & 1 ) value = __webpack_require__ (value );
269
+ if (mode & 8 ) return value ;
270
+ if ((mode & 4 ) && typeof value === ' object' && value && value .__esModule ) return value ;
271
+ var ns = Object .create (null );
272
+ __webpack_require__ .r (ns );
273
+ Object .defineProperty (ns , ' default' , { enumerable: true , value: value });
274
+ if (mode & 2 && typeof value != ' string' ) for (var key in value ) __webpack_require__ .d (ns , key , function (key ) { return value [key ]; }.bind (null , key ));
275
+ return ns ;
276
+ };
277
+
278
+ // getDefaultExport function for compatibility with non-harmony modules
279
+ __webpack_require__ .n = function (module ) {
280
+ var getter = module && module .__esModule ?
281
+ function getDefault() { return module [' default' ]; } :
282
+ function getModuleExports() { return module ; };
283
+ __webpack_require__ .d (getter , ' a' , getter );
284
+ return getter ;
285
+ };
286
+
287
+ // Object.prototype.hasOwnProperty.call
288
+ __webpack_require__ .o = function (object , property ) { return Object .prototype .hasOwnProperty .call (object , property ); };
289
+
290
+ // __webpack_public_path__
291
+ __webpack_require__ .p = \\" /webpack/public/path/\\ " ;
292
+
293
+
294
+ // Load entry module and return exports
295
+ return __webpack_require__ (__webpack_require__ .s = \\" ./source-map/basic.js\\ " );
296
+ " ,
297
+ " // Imports
298
+ import ___CSS_LOADER_API_IMPORT___ from \\" ../../../../src/runtime/api.js\\ " ;
203
299
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___ (true );
204
- ___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
205
300
// Module
206
- ___CSS_LOADER_EXPORT___.push([module.id, \\ ".class { \\\\n color : red ;\\\\n } \\\\ n\\ ", \\ "\\ ",{ \\" version\\ " :3 ,\\" sources\\ " :[\\" webpack://source-map/basic .css\\ " ],\\" names\\ " :[],\\" mappings\\ " :\\" AAEA ;EACE,UAAU;AACZ \\ " ,\\" sourcesContent\\ " :[\\" @import \\\\\\ " . / nested / nested . css \\\\\\ " ; \\\\ n \\\\ n.class {\\\\ n color: red ;\\\\ n}\\\\ n\\ " ]} ]);
301
+ ___CSS_LOADER_EXPORT___ .push ([module .id , \\" .nested {\\\\ n color: blue ;\\\\ n}\\\\ n\\ " , \\" \\ " ,{\\" version\\ " :3 ,\\" sources\\ " :[\\" webpack://source-map/nested/nested .css\\ " ],\\" names\\ " :[],\\" mappings\\ " :\\" AAAA ;EACE,WAAW;AACb \\ " ,\\" sourcesContent\\ " :[\\" . nested {\\\\ n color: blue ;\\\\ n}\\\\ n\\ " ]}]);
207
302
// Exports
208
303
export default ___CSS_LOADER_EXPORT___ ;
209
- "
210
- ` ;
304
+ " ,
305
+ " /*
306
+ MIT License http :// www.opensource.org/licenses/mit-license.php
307
+ Author Tobias Koppers @sokra
308
+ */
309
+ // css base code, injected by the css-loader
310
+ // eslint-disable-next-line func-names
311
+ module .exports = function (useSourceMap ) {
312
+ const list = [];
313
+
314
+ // return the list of modules as css string
315
+ list .toString = function toString() {
316
+ return this .map ((item ) => {
317
+ const content = cssWithMappingToString (item , useSourceMap );
318
+
319
+ if (item [2 ]) {
320
+ return \` @media \$ { item [2 ]} { \$ {content }} \` ;
321
+ }
322
+
323
+ return content;
324
+ }).join('');
325
+ };
326
+
327
+ // import a list of modules into the list
328
+ // eslint-disable-next-line func-names
329
+ list.i = function (modules, mediaQuery, dedupe) {
330
+ if (typeof modules === ' string' ) {
331
+ // eslint-disable-next-line no-param-reassign
332
+ modules = [[null , modules , '']];
333
+ }
334
+
335
+ const alreadyImportedModules = {};
336
+
337
+ if (dedupe ) {
338
+ for (let i = 0 ; i < this .length ; i ++) {
339
+ // eslint-disable-next-line prefer-destructuring
340
+ const id = this [i ][0 ];
341
+
342
+ if (id != null ) {
343
+ alreadyImportedModules [id ] = true ;
344
+ }
345
+ }
346
+ }
347
+
348
+ for (let i = 0 ; i < modules .length ; i ++ ) {
349
+ const item = [].concat(modules [i ]);
350
+
351
+ if (dedupe && alreadyImportedModules [item [0]]) {
352
+ // eslint-disable-next-line no-continue
353
+ continue ;
354
+ }
355
+
356
+ if (mediaQuery ) {
357
+ if (! item [2 ]) {
358
+ item [2 ] = mediaQuery ;
359
+ } else {
360
+ item [2 ] = \` \$ { mediaQuery } and \$ { item [2 ]} \` ;
361
+ }
362
+ }
363
+
364
+ list.push(item);
365
+ }
366
+ };
367
+
368
+ return list;
369
+ };
370
+
371
+ function cssWithMappingToString(item, useSourceMap) {
372
+ const content = item [1 ] || ' ' ;
373
+ // eslint-disable-next-line prefer-destructuring
374
+ const cssMapping = item [3 ];
375
+
376
+ if (! cssMapping ) {
377
+ return content;
378
+ }
211
379
212
- exports [` "sourceMap" option true should generate source maps and do not change "[contenthash]" on different platform: result 1` ] = `
213
- Array [
214
- Array [
215
- "../../src/index.js?[ident]!./source-map/nested/nested.css",
216
- ".nested {
217
- color : blue ;
380
+ if (useSourceMap && typeof btoa === ' function' ) {
381
+ const sourceMapping = toComment(cssMapping );
382
+ const sourceURLs = cssMapping.sources.map(
383
+ (source ) => \`/* # sourceURL=\${cssMapping.sourceRoot || ''}\${source} */ \`
384
+ );
385
+
386
+ return [content].concat(sourceURLs ).concat([sourceMapping ]).join('\\\\n ');
387
+ }
388
+
389
+ return [content ].join (' \\\\ n' );
218
390
}
219
- ",
220
- "",
221
- Object {
222
- " mappings" : " AAAA;EACE,WAAW;AACb" ,
223
- " names" : Array [],
224
- " sources" : Array [
225
- " webpack://source-map/nested/nested.css" ,
226
- ],
227
- " sourcesContent" : Array [
228
- " .nested {
229
- color : blue ;
391
+
392
+ // Adapted from convert-source-map (MIT)
393
+ function toComment(sourceMap) {
394
+ // eslint-disable-next-line no-undef
395
+ const base64 = btoa (unescape (encodeURIComponent (JSON .stringify (sourceMap ))));
396
+ const data = \` sourceMappingURL=data:application/json;charset=utf-8;base64,\$ { base64 } \` ;
397
+
398
+ return \` /*# \$ { data } */\` ;
230
399
}
231
400
",
232
- ],
233
- " version " : 3 ,
234
- } ,
235
- ],
236
- Array [
237
- "./source-map/basic.css",
238
- ". class {
239
- color : red ;
240
- }
401
+ "// Imports
402
+ import ___CSS_LOADER_API_IMPORT___ from \\ "../../../src/runtime/api.js \\ ";
403
+ import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\ "-!../../../src/index.js??ref--4-rules-0!./nested/nested.css \\ ";
404
+ var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(true);
405
+ ___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
406
+ // Module
407
+ ___CSS_LOADER_EXPORT___.push([module.id, \\ ".class { \\\\ n color : red ;\\\\ n } \\\\ n \\ ", \\ " \\ ", { \\ " version \\ " : 3 ,\\ " sources \\ " :[\\ " webpack://source-map/basic.css \\ " ],\\ " names \\ " :[],\\ " mappings \\ " :\\ " AAEA;EACE,UAAU;AACZ \\ " ,\\ " sourcesContent \\ " :[\\ " @import \\\\\\ " . / nested / nested . css \\\\\\ " ; \\\\ n \\\\ n. class {\\\\ n color: red; \\\\ n} \\\\ n \\ " ] } ]);
408
+ // Exports
409
+ export default ___CSS_LOADER_EXPORT___;
241
410
",
242
- "",
243
- Object {
244
- " mappings" : " AAEA;EACE,UAAU;AACZ" ,
245
- " names" : Array [],
246
- " sources" : Array [
247
- " webpack://source-map/basic.css" ,
248
- ],
249
- " sourcesContent" : Array [
250
- " @import \\ " ./ nested / nested .css \\" ;
411
+ "import css from './basic.css';
251
412
252
- . class {
253
- color: red ;
254
- }
413
+ __export__ = css;
414
+
415
+ export default css;
255
416
",
256
- ],
257
- " version" : 3 ,
258
- } ,
259
417
],
260
- ]
418
+ "version": 3,
419
+ }
261
420
` ;
262
421
422
+ exports [` "sourceMap" option true should generate source maps and do not change "[contenthash]" on different platform: module 1` ] = `
423
+ "// Imports
424
+ import ___CSS_LOADER_API_IMPORT___ from \\ "../../../src/runtime/api.js\\ ";
425
+ import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\ "-!../../../src/index.js??[ident]!./nested/nested.css\\ ";
426
+ var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(true);
427
+ ___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
428
+ // Module
429
+ ___CSS_LOADER_EXPORT___.push([module.id, \\ ".class { \\\\n color : red ;\\\\n } \\\\ n\\ ", \\ "\\ ",{ \\" version\\ " :3 ,\\" sources\\ " :[\\" webpack://source-map/basic.css\\ " ],\\" names\\ " :[],\\" mappings\\ " :\\" AAEA;EACE,UAAU;AACZ\\ " ,\\" sourcesContent\\ " :[\\" @import \\\\\\ " ./ nested / nested .css \\\\\\" ;\\\\ n\\\\ n.class {\\\\ n color: red;\\\\ n}\\\\ n\\ " ]} ]);
430
+ // Exports
431
+ export default ___CSS_LOADER_EXPORT___;
432
+ "
433
+ ` ;
434
+
435
+ exports [` "sourceMap" option true should generate source maps and do not change "[contenthash]" on different platform: result 1` ] = ` Object { } ` ;
436
+
263
437
exports [` "sourceMap" option true should generate source maps and do not change "[contenthash]" on different platform: warnings 1` ] = ` Array []` ;
264
438
265
439
exports [` "sourceMap" option true should generate source maps when css was extracted and do not change "[contenthash]" on different platform: errors 1` ] = ` Array []` ;
0 commit comments