css-loader 4.2.2 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/README.md +120 -86
- package/dist/CssSyntaxError.js +5 -3
- package/dist/Warning.js +2 -2
- package/dist/cjs.js +1 -1
- package/dist/index.js +25 -17
- package/dist/options.json +3 -4
- package/dist/plugins/postcss-icss-parser.js +101 -96
- package/dist/plugins/postcss-import-parser.js +189 -183
- package/dist/plugins/postcss-url-parser.js +199 -195
- package/dist/runtime/api.js +6 -34
- package/dist/runtime/cssWithMappingToString.js +32 -0
- package/dist/runtime/getUrl.js +2 -2
- package/dist/utils.js +126 -96
- package/package.json +37 -36
|
@@ -5,30 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _util = require("util");
|
|
9
|
-
|
|
10
|
-
var _postcss = _interopRequireDefault(require("postcss"));
|
|
11
|
-
|
|
12
8
|
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
|
13
9
|
|
|
14
10
|
var _utils = require("../utils");
|
|
15
11
|
|
|
16
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
13
|
|
|
18
|
-
const pluginName = 'postcss-url-parser';
|
|
19
14
|
const isUrlFunc = /url/i;
|
|
20
15
|
const isImageSetFunc = /^(?:-webkit-)?image-set$/i;
|
|
21
|
-
const
|
|
16
|
+
const needParseDeclaration = /(?:url|(?:-webkit-)?image-set)\(/i;
|
|
22
17
|
|
|
23
18
|
function getNodeFromUrlFunc(node) {
|
|
24
19
|
return node.nodes && node.nodes[0];
|
|
25
20
|
}
|
|
26
21
|
|
|
27
|
-
function shouldHandleRule(rule,
|
|
22
|
+
function shouldHandleRule(rule, node, result) {
|
|
28
23
|
// https://www.w3.org/TR/css-syntax-3/#typedef-url-token
|
|
29
|
-
if (rule.url.replace(/^[\s]+|[\s]+$/g,
|
|
30
|
-
result.warn(`Unable to find uri in '${
|
|
31
|
-
node
|
|
24
|
+
if (rule.url.replace(/^[\s]+|[\s]+$/g, "").length === 0) {
|
|
25
|
+
result.warn(`Unable to find uri in '${node.toString()}'`, {
|
|
26
|
+
node
|
|
32
27
|
});
|
|
33
28
|
return false;
|
|
34
29
|
}
|
|
@@ -40,218 +35,227 @@ function shouldHandleRule(rule, decl, result) {
|
|
|
40
35
|
return true;
|
|
41
36
|
}
|
|
42
37
|
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
function visitor(result, parsedResults, node, key) {
|
|
39
|
+
if (!needParseDeclaration.test(node[key])) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const parsed = (0, _postcssValueParser.default)(node[key]);
|
|
44
|
+
parsed.walk(valueNode => {
|
|
45
|
+
if (valueNode.type !== "function") {
|
|
47
46
|
return;
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
if (isUrlFunc.test(valueNode.value)) {
|
|
50
|
+
const {
|
|
51
|
+
nodes
|
|
52
|
+
} = valueNode;
|
|
53
|
+
const isStringValue = nodes.length !== 0 && nodes[0].type === "string";
|
|
54
|
+
const url = isStringValue ? nodes[0].value : _postcssValueParser.default.stringify(nodes);
|
|
55
|
+
const rule = {
|
|
56
|
+
node: getNodeFromUrlFunc(valueNode),
|
|
57
|
+
url,
|
|
58
|
+
needQuotes: false,
|
|
59
|
+
isStringValue
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
if (shouldHandleRule(rule, node, result)) {
|
|
63
|
+
parsedResults.push({
|
|
64
|
+
node,
|
|
65
|
+
rule,
|
|
66
|
+
parsed
|
|
67
|
+
});
|
|
68
|
+
} // Do not traverse inside `url`
|
|
69
|
+
// eslint-disable-next-line consistent-return
|
|
70
|
+
|
|
55
71
|
|
|
56
|
-
|
|
72
|
+
return false;
|
|
73
|
+
} else if (isImageSetFunc.test(valueNode.value)) {
|
|
74
|
+
for (const nNode of valueNode.nodes) {
|
|
57
75
|
const {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
node: getNodeFromUrlFunc(node),
|
|
64
|
-
url,
|
|
65
|
-
needQuotes: false,
|
|
66
|
-
isStringValue
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
if (shouldHandleRule(rule, decl, result)) {
|
|
70
|
-
accumulator.push({
|
|
71
|
-
decl,
|
|
72
|
-
rule,
|
|
73
|
-
parsed
|
|
74
|
-
});
|
|
75
|
-
} // Do not traverse inside `url`
|
|
76
|
-
// eslint-disable-next-line consistent-return
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return false;
|
|
80
|
-
} else if (isImageSetFunc.test(node.value)) {
|
|
81
|
-
for (const nNode of node.nodes) {
|
|
76
|
+
type,
|
|
77
|
+
value
|
|
78
|
+
} = nNode;
|
|
79
|
+
|
|
80
|
+
if (type === "function" && isUrlFunc.test(value)) {
|
|
82
81
|
const {
|
|
83
|
-
|
|
84
|
-
value
|
|
82
|
+
nodes
|
|
85
83
|
} = nNode;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
accumulator.push({
|
|
117
|
-
decl,
|
|
118
|
-
rule,
|
|
119
|
-
parsed
|
|
120
|
-
});
|
|
121
|
-
}
|
|
84
|
+
const isStringValue = nodes.length !== 0 && nodes[0].type === "string";
|
|
85
|
+
const url = isStringValue ? nodes[0].value : _postcssValueParser.default.stringify(nodes);
|
|
86
|
+
const rule = {
|
|
87
|
+
node: getNodeFromUrlFunc(nNode),
|
|
88
|
+
url,
|
|
89
|
+
needQuotes: false,
|
|
90
|
+
isStringValue
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
if (shouldHandleRule(rule, node, result)) {
|
|
94
|
+
parsedResults.push({
|
|
95
|
+
node,
|
|
96
|
+
rule,
|
|
97
|
+
parsed
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
} else if (type === "string") {
|
|
101
|
+
const rule = {
|
|
102
|
+
node: nNode,
|
|
103
|
+
url: value,
|
|
104
|
+
needQuotes: true,
|
|
105
|
+
isStringValue: true
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
if (shouldHandleRule(rule, node, result)) {
|
|
109
|
+
parsedResults.push({
|
|
110
|
+
node,
|
|
111
|
+
rule,
|
|
112
|
+
parsed
|
|
113
|
+
});
|
|
122
114
|
}
|
|
123
|
-
}
|
|
124
|
-
|
|
115
|
+
}
|
|
116
|
+
} // Do not traverse inside `image-set`
|
|
117
|
+
// eslint-disable-next-line consistent-return
|
|
125
118
|
|
|
126
119
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
});
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
130
122
|
});
|
|
131
|
-
callback(null, accumulator);
|
|
132
123
|
}
|
|
133
124
|
|
|
134
|
-
const
|
|
125
|
+
const plugin = (options = {}) => {
|
|
126
|
+
return {
|
|
127
|
+
postcssPlugin: "postcss-url-parser",
|
|
135
128
|
|
|
136
|
-
|
|
137
|
-
|
|
129
|
+
prepare(result) {
|
|
130
|
+
const parsedResults = [];
|
|
131
|
+
return {
|
|
132
|
+
Declaration(declaration) {
|
|
133
|
+
visitor(result, parsedResults, declaration, "value");
|
|
134
|
+
},
|
|
138
135
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
async OnceExit() {
|
|
137
|
+
if (parsedResults.length === 0) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
142
140
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
141
|
+
const tasks = [];
|
|
142
|
+
const imports = new Map();
|
|
143
|
+
const replacements = new Map();
|
|
144
|
+
let hasUrlImportHelper = false;
|
|
145
|
+
|
|
146
|
+
for (const parsedResult of parsedResults) {
|
|
147
|
+
const {
|
|
148
|
+
url,
|
|
149
|
+
isStringValue
|
|
150
|
+
} = parsedResult.rule;
|
|
151
|
+
let normalizedUrl = url;
|
|
152
|
+
let prefix = "";
|
|
153
|
+
const queryParts = normalizedUrl.split("!");
|
|
154
|
+
|
|
155
|
+
if (queryParts.length > 1) {
|
|
156
|
+
normalizedUrl = queryParts.pop();
|
|
157
|
+
prefix = queryParts.join("!");
|
|
158
|
+
}
|
|
161
159
|
|
|
162
|
-
|
|
160
|
+
normalizedUrl = (0, _utils.normalizeUrl)(normalizedUrl, isStringValue);
|
|
163
161
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
162
|
+
if (!options.filter(normalizedUrl)) {
|
|
163
|
+
// eslint-disable-next-line no-continue
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
168
166
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
167
|
+
if (!hasUrlImportHelper) {
|
|
168
|
+
options.imports.push({
|
|
169
|
+
importName: "___CSS_LOADER_GET_URL_IMPORT___",
|
|
170
|
+
url: options.urlHandler(require.resolve("../runtime/getUrl.js")),
|
|
171
|
+
index: -1
|
|
172
|
+
});
|
|
173
|
+
hasUrlImportHelper = true;
|
|
174
|
+
}
|
|
177
175
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
176
|
+
const splittedUrl = normalizedUrl.split(/(\?)?#/);
|
|
177
|
+
const [pathname, query, hashOrQuery] = splittedUrl;
|
|
178
|
+
let hash = query ? "?" : "";
|
|
179
|
+
hash += hashOrQuery ? `#${hashOrQuery}` : "";
|
|
180
|
+
const request = (0, _utils.requestify)(pathname, options.rootContext);
|
|
181
|
+
tasks.push((async () => {
|
|
182
|
+
const {
|
|
183
|
+
resolver,
|
|
184
|
+
context
|
|
185
|
+
} = options;
|
|
186
|
+
const resolvedUrl = await (0, _utils.resolveRequests)(resolver, context, [...new Set([request, normalizedUrl])]);
|
|
187
|
+
return {
|
|
188
|
+
url: resolvedUrl,
|
|
189
|
+
prefix,
|
|
190
|
+
hash,
|
|
191
|
+
parsedResult
|
|
192
|
+
};
|
|
193
|
+
})());
|
|
194
|
+
}
|
|
197
195
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
for (let index = 0; index <= results.length - 1; index++) {
|
|
201
|
-
const {
|
|
202
|
-
url,
|
|
203
|
-
prefix,
|
|
204
|
-
hash,
|
|
205
|
-
parsedResult: {
|
|
206
|
-
decl,
|
|
207
|
-
rule,
|
|
208
|
-
parsed
|
|
209
|
-
}
|
|
210
|
-
} = results[index];
|
|
211
|
-
const newUrl = prefix ? `${prefix}!${url}` : url;
|
|
212
|
-
const importKey = newUrl;
|
|
213
|
-
let importName = imports.get(importKey);
|
|
214
|
-
|
|
215
|
-
if (!importName) {
|
|
216
|
-
importName = `___CSS_LOADER_URL_IMPORT_${imports.size}___`;
|
|
217
|
-
imports.set(importKey, importName);
|
|
218
|
-
options.imports.push({
|
|
219
|
-
importName,
|
|
220
|
-
url: options.urlHandler(newUrl),
|
|
221
|
-
index
|
|
222
|
-
});
|
|
223
|
-
}
|
|
196
|
+
const results = await Promise.all(tasks);
|
|
224
197
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
198
|
+
for (let index = 0; index <= results.length - 1; index++) {
|
|
199
|
+
const {
|
|
200
|
+
url,
|
|
201
|
+
prefix,
|
|
202
|
+
hash,
|
|
203
|
+
parsedResult: {
|
|
204
|
+
node,
|
|
205
|
+
rule,
|
|
206
|
+
parsed
|
|
207
|
+
}
|
|
208
|
+
} = results[index];
|
|
209
|
+
const newUrl = prefix ? `${prefix}!${url}` : url;
|
|
210
|
+
const importKey = newUrl;
|
|
211
|
+
let importName = imports.get(importKey);
|
|
212
|
+
|
|
213
|
+
if (!importName) {
|
|
214
|
+
importName = `___CSS_LOADER_URL_IMPORT_${imports.size}___`;
|
|
215
|
+
imports.set(importKey, importName);
|
|
216
|
+
options.imports.push({
|
|
217
|
+
importName,
|
|
218
|
+
url: options.urlHandler(newUrl),
|
|
219
|
+
index
|
|
220
|
+
});
|
|
221
|
+
}
|
|
234
222
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
223
|
+
const {
|
|
224
|
+
needQuotes
|
|
225
|
+
} = rule;
|
|
226
|
+
const replacementKey = JSON.stringify({
|
|
227
|
+
newUrl,
|
|
228
|
+
hash,
|
|
229
|
+
needQuotes
|
|
230
|
+
});
|
|
231
|
+
let replacementName = replacements.get(replacementKey);
|
|
232
|
+
|
|
233
|
+
if (!replacementName) {
|
|
234
|
+
replacementName = `___CSS_LOADER_URL_REPLACEMENT_${replacements.size}___`;
|
|
235
|
+
replacements.set(replacementKey, replacementName);
|
|
236
|
+
options.replacements.push({
|
|
237
|
+
replacementName,
|
|
238
|
+
importName,
|
|
239
|
+
hash,
|
|
240
|
+
needQuotes
|
|
241
|
+
});
|
|
242
|
+
} // eslint-disable-next-line no-param-reassign
|
|
245
243
|
|
|
246
244
|
|
|
247
|
-
|
|
245
|
+
rule.node.type = "word"; // eslint-disable-next-line no-param-reassign
|
|
248
246
|
|
|
249
|
-
|
|
247
|
+
rule.node.value = replacementName; // eslint-disable-next-line no-param-reassign
|
|
250
248
|
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
node.value = parsed.toString();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
253
252
|
|
|
254
|
-
|
|
255
|
-
}
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
};
|
|
257
|
+
};
|
|
256
258
|
|
|
259
|
+
plugin.postcss = true;
|
|
260
|
+
var _default = plugin;
|
|
257
261
|
exports.default = _default;
|
package/dist/runtime/api.js
CHANGED
|
@@ -6,27 +6,27 @@
|
|
|
6
6
|
*/
|
|
7
7
|
// css base code, injected by the css-loader
|
|
8
8
|
// eslint-disable-next-line func-names
|
|
9
|
-
module.exports = function (
|
|
9
|
+
module.exports = function (cssWithMappingToString) {
|
|
10
10
|
var list = []; // return the list of modules as css string
|
|
11
11
|
|
|
12
12
|
list.toString = function toString() {
|
|
13
13
|
return this.map(function (item) {
|
|
14
|
-
var content = cssWithMappingToString(item
|
|
14
|
+
var content = cssWithMappingToString(item);
|
|
15
15
|
|
|
16
16
|
if (item[2]) {
|
|
17
17
|
return "@media ".concat(item[2], " {").concat(content, "}");
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
return content;
|
|
21
|
-
}).join(
|
|
21
|
+
}).join("");
|
|
22
22
|
}; // import a list of modules into the list
|
|
23
23
|
// eslint-disable-next-line func-names
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
list.i = function (modules, mediaQuery, dedupe) {
|
|
27
|
-
if (typeof modules ===
|
|
27
|
+
if (typeof modules === "string") {
|
|
28
28
|
// eslint-disable-next-line no-param-reassign
|
|
29
|
-
modules = [[null, modules,
|
|
29
|
+
modules = [[null, modules, ""]];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
var alreadyImportedModules = {};
|
|
@@ -63,32 +63,4 @@ module.exports = function (useSourceMap) {
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
return list;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
function cssWithMappingToString(item, useSourceMap) {
|
|
69
|
-
var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring
|
|
70
|
-
|
|
71
|
-
var cssMapping = item[3];
|
|
72
|
-
|
|
73
|
-
if (!cssMapping) {
|
|
74
|
-
return content;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (useSourceMap && typeof btoa === 'function') {
|
|
78
|
-
var sourceMapping = toComment(cssMapping);
|
|
79
|
-
var sourceURLs = cssMapping.sources.map(function (source) {
|
|
80
|
-
return "/*# sourceURL=".concat(cssMapping.sourceRoot || '').concat(source, " */");
|
|
81
|
-
});
|
|
82
|
-
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return [content].join('\n');
|
|
86
|
-
} // Adapted from convert-source-map (MIT)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
function toComment(sourceMap) {
|
|
90
|
-
// eslint-disable-next-line no-undef
|
|
91
|
-
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
|
|
92
|
-
var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
|
|
93
|
-
return "/*# ".concat(data, " */");
|
|
94
|
-
}
|
|
66
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
+
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
module.exports = function cssWithMappingToString(item) {
|
|
16
|
+
var _item = _slicedToArray(item, 4),
|
|
17
|
+
content = _item[1],
|
|
18
|
+
cssMapping = _item[3];
|
|
19
|
+
|
|
20
|
+
if (typeof btoa === "function") {
|
|
21
|
+
// eslint-disable-next-line no-undef
|
|
22
|
+
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));
|
|
23
|
+
var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
|
|
24
|
+
var sourceMapping = "/*# ".concat(data, " */");
|
|
25
|
+
var sourceURLs = cssMapping.sources.map(function (source) {
|
|
26
|
+
return "/*# sourceURL=".concat(cssMapping.sourceRoot || "").concat(source, " */");
|
|
27
|
+
});
|
|
28
|
+
return [content].concat(sourceURLs).concat([sourceMapping]).join("\n");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return [content].join("\n");
|
|
32
|
+
};
|
package/dist/runtime/getUrl.js
CHANGED
|
@@ -9,7 +9,7 @@ module.exports = function (url, options) {
|
|
|
9
9
|
|
|
10
10
|
url = url && url.__esModule ? url.default : url;
|
|
11
11
|
|
|
12
|
-
if (typeof url !==
|
|
12
|
+
if (typeof url !== "string") {
|
|
13
13
|
return url;
|
|
14
14
|
} // If url is already wrapped in quotes, remove them
|
|
15
15
|
|
|
@@ -27,7 +27,7 @@ module.exports = function (url, options) {
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
if (/["'() \t\n]/.test(url) || options.needQuotes) {
|
|
30
|
-
return "\"".concat(url.replace(/"/g, '\\"').replace(/\n/g,
|
|
30
|
+
return "\"".concat(url.replace(/"/g, '\\"').replace(/\n/g, "\\n"), "\"");
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
return url;
|