@@ -83,16 +83,16 @@ module.exports = function (useSourceMap) {
83
83
84
84
// import a list of modules into the list
85
85
list .i = function (modules , mediaQuery ) {
86
- if (typeof modules === \\ " string\\ " ) {
87
- modules = [[null , modules , \\ " \\ " ]];
86
+ if (typeof modules === ' string' ) {
87
+ modules = [[null , modules , ' ' ]];
88
88
}
89
89
90
90
const isImported = {};
91
91
92
92
for (let i = 0 ; i < this .length ; i ++ ) {
93
93
const id = this [i ][0 ];
94
94
95
- if (typeof id === \\ " number\\ " ) {
95
+ if (typeof id === ' number' ) {
96
96
isImported [id ] = true ;
97
97
}
98
98
}
@@ -104,11 +104,11 @@ module.exports = function (useSourceMap) {
104
104
// this implementation is not 100% perfect for weird media query combinations
105
105
// when a module is imported multiple times with different media queries.
106
106
// I hope this will never occur (Hey this way we have smaller bundles)
107
- if (typeof item [0 ] !== \\ " number\\ " || ! isImported [item [0 ]]) {
107
+ if (typeof item [0 ] !== ' number' || ! isImported [item [0 ]]) {
108
108
if (mediaQuery && ! item [2 ]) {
109
109
item [2 ] = mediaQuery ;
110
110
} else if (mediaQuery ) {
111
- item [2 ] = \\ " ( \\ " + item [2 ] + \\ " ) and (\\ " + mediaQuery + \\ " ) \\ " ;
111
+ item [2 ] = ' ( ' + item [2 ] + ' ) and (' + mediaQuery + ' ) ' ;
112
112
}
113
113
114
114
list .push (item );
@@ -120,32 +120,32 @@ module.exports = function (useSourceMap) {
120
120
} ;
121
121
122
122
function cssWithMappingToString(item, useSourceMap) {
123
- const content = item [1 ] || \\ " \\ " ;
123
+ const content = item [1 ] || ' ' ;
124
124
const sourceMap = item [3 ];
125
125
126
126
if (! sourceMap ) {
127
127
return content;
128
128
}
129
129
130
- if (useSourceMap && typeof btoa === \\ " function\\ " ) {
130
+ if (useSourceMap && typeof btoa === ' function' ) {
131
131
const sourceMapping = toComment(sourceMap );
132
132
const sourceURLs = sourceMap.sources.map(function (source ) {
133
- return \\ " /*# sourceURL=\\ " + sourceMap .sourceRoot + source + \\ " */\\ " ;
133
+ return ' /*# sourceURL=' + sourceMap .sourceRoot + source + ' */' ;
134
134
});
135
135
136
- return [content].concat(sourceURLs ).concat([sourceMapping ]).join(\\"/ n \\" );
136
+ return [content].concat(sourceURLs ).concat([sourceMapping ]).join('\\\\ n ' );
137
137
}
138
138
139
- return [content ].join (\\ " /n \\ " );
139
+ return [content ].join (' \\\\ n ' );
140
140
}
141
141
142
142
// Adapted from convert-source-map (MIT)
143
143
function toComment(sourceMap) {
144
144
// eslint-disable-next-line no-undef
145
145
const base64 = btoa (unescape (encodeURIComponent (JSON .stringify (sourceMap ))));
146
- const data = \\ " sourceMappingURL=data:application/json;charset=utf-8;base64,\\ " + base64 ;
146
+ const data = ' sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64 ;
147
147
148
- return \\ " /*# \\ " + data + \\ " */\\ " ;
148
+ return ' /*# ' + data + ' */' ;
149
149
} "
150
150
` ;
151
151
@@ -166,8 +166,8 @@ module.exports = function escape(url) {
166
166
167
167
// Should url be wrapped?
168
168
// See https://drafts.csswg.org/css-values-3/#urls
169
- if (/ [\\ "'() /t/ n] / .test (url )) {
170
- return '\\"' + url.replace(/\\"/g , '// \\ "').replace(// n/g, '// n') + '\\"';
169
+ if (/ [\\ "'() \\\\ t \\\\ n] / .test (url )) {
170
+ return '\\"' + url.replace(/\\"/g , '\\\\\\\\\\ "').replace(/\\\\ n /g , '\\\\\\\\ n ') + '\\"';
171
171
}
172
172
173
173
return url ;
@@ -202,7 +202,7 @@ exports[`loader error when no loader for url assets: warnings 1`] = `Array []`;
202
202
203
203
exports [` loader error when source code is invalid: errors 1` ] = `
204
204
Array [
205
- [ModuleBuildError: Module build failed (from < PROJECT_ROOT > /src/index.js):
205
+ [ModuleBuildError: Module build failed (from /home/evilebottnawi/IdeaProjects/css-loader /src/index.js):
206
206
Syntax Error: Unknown word (2:3)
207
207
208
208
1 | .some {
@@ -292,130 +292,3 @@ a:hover {
292
292
` ;
293
293
294
294
exports [` loader using together with "postcss-loader" (reuse ast): warnings 1` ] = ` Array []` ;
295
-
296
- exports[`loader validate options import - false (boolean): errors 1`] = `Array []`;
297
-
298
- exports[`loader validate options import - false (boolean): warnings 1`] = `Array []`;
299
-
300
- exports[`loader validate options import - true (boolean): errors 1`] = `Array []`;
301
-
302
- exports[`loader validate options import - true (boolean): warnings 1`] = `Array []`;
303
-
304
- exports[`loader validate options import - true (string): errors 1`] = `
305
- Array [
306
- [ModuleBuildError: Module build failed (from <PROJECT_ROOT >/src/index.js):
307
- CSS Loader
308
-
309
- [4mOptions Validation Error[24m
310
-
311
- [2moptions[22m.import [34mshould be boolean[39m
312
-
313
-
314
- [2moptions[22m.import [34mshould be boolean[39m
315
- at validate (<PROJECT_ROOT >/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:87:15)
316
- at validator (<PROJECT_ROOT >/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:118:10)
317
- at Object.loader (<PROJECT_ROOT >/src/index.js:29:3)],
318
- ]
319
- `;
320
-
321
- exports[`loader validate options import - true (string): warnings 1`] = `Array []`;
322
-
323
- exports[`loader validate options importLoaders - 0 (number): errors 1`] = `Array []`;
324
-
325
- exports[`loader validate options importLoaders - 0 (number): warnings 1`] = `Array []`;
326
-
327
- exports[`loader validate options importLoaders - 1 (number): errors 1`] = `Array []`;
328
-
329
- exports[`loader validate options importLoaders - 1 (number): warnings 1`] = `Array []`;
330
-
331
- exports[`loader validate options importLoaders - 1 (string): errors 1`] = `
332
- Array [
333
- [ModuleBuildError: Module build failed (from <PROJECT_ROOT >/src/index.js):
334
- CSS Loader
335
-
336
- [4mOptions Validation Error[24m
337
-
338
- [2moptions[22m.importLoaders [34mshould be number[39m
339
-
340
-
341
- [2moptions[22m.importLoaders [34mshould be number[39m
342
- at validate (<PROJECT_ROOT >/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:87:15)
343
- at validator (<PROJECT_ROOT >/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:118:10)
344
- at Object.loader (<PROJECT_ROOT >/src/index.js:29:3)],
345
- ]
346
- `;
347
-
348
- exports[`loader validate options importLoaders - 1 (string): warnings 1`] = `Array []`;
349
-
350
- exports[`loader validate options sourceMap - false (boolean): errors 1`] = `Array []`;
351
-
352
- exports[`loader validate options sourceMap - false (boolean): warnings 1`] = `Array []`;
353
-
354
- exports[`loader validate options sourceMap - true (boolean): errors 1`] = `Array []`;
355
-
356
- exports[`loader validate options sourceMap - true (boolean): warnings 1`] = `Array []`;
357
-
358
- exports[`loader validate options sourceMap - true (string): errors 1`] = `
359
- Array [
360
- [ModuleBuildError: Module build failed (from <PROJECT_ROOT >/src/index.js):
361
- CSS Loader
362
-
363
- [4mOptions Validation Error[24m
364
-
365
- [2moptions[22m.sourceMap [34mshould be boolean[39m
366
-
367
-
368
- [2moptions[22m.sourceMap [34mshould be boolean[39m
369
- at validate (<PROJECT_ROOT >/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:87:15)
370
- at validator (<PROJECT_ROOT >/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:118:10)
371
- at Object.loader (<PROJECT_ROOT >/src/index.js:29:3)],
372
- ]
373
- `;
374
-
375
- exports[`loader validate options sourceMap - true (string): warnings 1`] = `Array []`;
376
-
377
- exports[`loader validate options unknown option: errors 1`] = `
378
- Array [
379
- [ModuleBuildError: Module build failed (from <PROJECT_ROOT >/src/index.js):
380
- CSS Loader
381
-
382
- [4mOptions Validation Error[24m
383
-
384
- [2moptions[22m['unknow'] [34mis an invalid additional property[39m
385
-
386
-
387
- [2moptions[22m['unknow'] [34mis an invalid additional property[39m
388
- at validate (<PROJECT_ROOT >/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:87:15)
389
- at validator (<PROJECT_ROOT >/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:118:10)
390
- at Object.loader (<PROJECT_ROOT >/src/index.js:29:3)],
391
- ]
392
- `;
393
-
394
- exports[`loader validate options unknown option: warnings 1`] = `Array []`;
395
-
396
- exports[`loader validate options url - false (boolean): errors 1`] = `Array []`;
397
-
398
- exports[`loader validate options url - false (boolean): warnings 1`] = `Array []`;
399
-
400
- exports[`loader validate options url - true (boolean): errors 1`] = `Array []`;
401
-
402
- exports[`loader validate options url - true (boolean): warnings 1`] = `Array []`;
403
-
404
- exports[`loader validate options url - true (string): errors 1`] = `
405
- Array [
406
- [ModuleBuildError: Module build failed (from <PROJECT_ROOT >/src/index.js):
407
- CSS Loader
408
-
409
- [4mOptions Validation Error[24m
410
-
411
- [2moptions[22m.url [34mshould be boolean[39m
412
-
413
-
414
- [2moptions[22m.url [34mshould be boolean[39m
415
- at validate (<PROJECT_ROOT >/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:87:15)
416
- at validator (<PROJECT_ROOT >/node_modules/@webpack-contrib/schema-utils/dist/validate-options.js:118:10)
417
- at Object.loader (<PROJECT_ROOT >/src/index.js:29:3)],
418
- ]
419
- `;
420
-
421
- exports[`loader validate options url - true (string): warnings 1`] = `Array []`;
0 commit comments