css-loader 6.0.0 → 6.4.0
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/README.md +302 -72
- package/dist/index.js +19 -27
- package/dist/options.json +58 -26
- package/dist/plugins/index.js +4 -4
- package/dist/plugins/postcss-icss-parser.js +14 -7
- package/dist/plugins/postcss-import-parser.js +70 -12
- package/dist/runtime/api.js +53 -17
- package/dist/runtime/getUrl.js +1 -5
- package/dist/runtime/noSourceMaps.js +5 -0
- package/dist/runtime/sourceMaps.js +22 -0
- package/dist/utils.js +246 -140
- package/package.json +7 -7
- package/dist/runtime/cssWithMappingToString.js +0 -36
package/dist/options.json
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
"additionalProperties": false,
|
|
4
4
|
"properties": {
|
|
5
5
|
"url": {
|
|
6
|
-
"description": "Allows to enables/disables `url()`/`image-set()` functions handling
|
|
6
|
+
"description": "Allows to enables/disables `url()`/`image-set()` functions handling.",
|
|
7
|
+
"link": "https://github.com/webpack-contrib/css-loader#url",
|
|
7
8
|
"anyOf": [
|
|
8
9
|
{
|
|
9
10
|
"type": "boolean"
|
|
@@ -20,7 +21,8 @@
|
|
|
20
21
|
]
|
|
21
22
|
},
|
|
22
23
|
"import": {
|
|
23
|
-
"description": "Allows to enables/disables `@import` at-rules handling
|
|
24
|
+
"description": "Allows to enables/disables `@import` at-rules handling.",
|
|
25
|
+
"link": "https://github.com/webpack-contrib/css-loader#import",
|
|
24
26
|
"anyOf": [
|
|
25
27
|
{
|
|
26
28
|
"type": "boolean"
|
|
@@ -37,7 +39,8 @@
|
|
|
37
39
|
]
|
|
38
40
|
},
|
|
39
41
|
"modules": {
|
|
40
|
-
"description": "Allows to enable/disable CSS Modules or ICSS and setup configuration
|
|
42
|
+
"description": "Allows to enable/disable CSS Modules or ICSS and setup configuration.",
|
|
43
|
+
"link": "https://github.com/webpack-contrib/css-loader#modules",
|
|
41
44
|
"anyOf": [
|
|
42
45
|
{
|
|
43
46
|
"type": "boolean"
|
|
@@ -50,7 +53,8 @@
|
|
|
50
53
|
"additionalProperties": false,
|
|
51
54
|
"properties": {
|
|
52
55
|
"auto": {
|
|
53
|
-
"description": "Allows auto enable CSS modules based on filename
|
|
56
|
+
"description": "Allows auto enable CSS modules based on filename.",
|
|
57
|
+
"link": "https://github.com/webpack-contrib/css-loader#auto",
|
|
54
58
|
"anyOf": [
|
|
55
59
|
{
|
|
56
60
|
"instanceof": "RegExp"
|
|
@@ -64,7 +68,8 @@
|
|
|
64
68
|
]
|
|
65
69
|
},
|
|
66
70
|
"mode": {
|
|
67
|
-
"description": "Setup `mode` option
|
|
71
|
+
"description": "Setup `mode` option.",
|
|
72
|
+
"link": "https://github.com/webpack-contrib/css-loader#mode",
|
|
68
73
|
"anyOf": [
|
|
69
74
|
{
|
|
70
75
|
"enum": ["local", "global", "pure", "icss"]
|
|
@@ -75,36 +80,43 @@
|
|
|
75
80
|
]
|
|
76
81
|
},
|
|
77
82
|
"localIdentName": {
|
|
78
|
-
"description": "Allows to configure the generated local ident name
|
|
83
|
+
"description": "Allows to configure the generated local ident name.",
|
|
84
|
+
"link": "https://github.com/webpack-contrib/css-loader#localidentname",
|
|
79
85
|
"type": "string",
|
|
80
86
|
"minLength": 1
|
|
81
87
|
},
|
|
82
88
|
"localIdentContext": {
|
|
83
|
-
"description": "Allows to redefine basic loader context for local ident name
|
|
89
|
+
"description": "Allows to redefine basic loader context for local ident name.",
|
|
90
|
+
"link": "https://github.com/webpack-contrib/css-loader#localidentcontext",
|
|
84
91
|
"type": "string",
|
|
85
92
|
"minLength": 1
|
|
86
93
|
},
|
|
87
94
|
"localIdentHashSalt": {
|
|
88
|
-
"description": "Allows to add custom hash to generate more unique classes
|
|
95
|
+
"description": "Allows to add custom hash to generate more unique classes.",
|
|
96
|
+
"link": "https://github.com/webpack-contrib/css-loader#localidenthashsalt",
|
|
89
97
|
"type": "string",
|
|
90
98
|
"minLength": 1
|
|
91
99
|
},
|
|
92
100
|
"localIdentHashFunction": {
|
|
93
|
-
"description": "Allows to specify hash function to generate classes
|
|
101
|
+
"description": "Allows to specify hash function to generate classes.",
|
|
102
|
+
"link": "https://github.com/webpack-contrib/css-loader#localidenthashfunction",
|
|
94
103
|
"type": "string",
|
|
95
104
|
"minLength": 1
|
|
96
105
|
},
|
|
97
106
|
"localIdentHashDigest": {
|
|
98
|
-
"description": "Allows to specify hash digest to generate classes
|
|
107
|
+
"description": "Allows to specify hash digest to generate classes.",
|
|
108
|
+
"link": "https://github.com/webpack-contrib/css-loader#localidenthashdigest",
|
|
99
109
|
"type": "string",
|
|
100
110
|
"minLength": 1
|
|
101
111
|
},
|
|
102
112
|
"localIdentHashDigestLength": {
|
|
103
|
-
"description": "Allows to specify hash digest length to generate classes
|
|
113
|
+
"description": "Allows to specify hash digest length to generate classes.",
|
|
114
|
+
"link": "https://github.com/webpack-contrib/css-loader#localidenthashdigestlength",
|
|
104
115
|
"type": "number"
|
|
105
116
|
},
|
|
106
117
|
"localIdentRegExp": {
|
|
107
|
-
"description": "Allows to specify custom RegExp for local ident name
|
|
118
|
+
"description": "Allows to specify custom RegExp for local ident name.",
|
|
119
|
+
"link": "https://github.com/webpack-contrib/css-loader#localidentregexp",
|
|
108
120
|
"anyOf": [
|
|
109
121
|
{
|
|
110
122
|
"type": "string",
|
|
@@ -116,29 +128,41 @@
|
|
|
116
128
|
]
|
|
117
129
|
},
|
|
118
130
|
"getLocalIdent": {
|
|
119
|
-
"description": "Allows to specify a function to generate the classname
|
|
131
|
+
"description": "Allows to specify a function to generate the classname.",
|
|
132
|
+
"link": "https://github.com/webpack-contrib/css-loader#getlocalident",
|
|
120
133
|
"instanceof": "Function"
|
|
121
134
|
},
|
|
122
135
|
"namedExport": {
|
|
123
|
-
"description": "Enables/disables ES modules named export for locals
|
|
136
|
+
"description": "Enables/disables ES modules named export for locals.",
|
|
137
|
+
"link": "https://github.com/webpack-contrib/css-loader#namedexport",
|
|
124
138
|
"type": "boolean"
|
|
125
139
|
},
|
|
126
140
|
"exportGlobals": {
|
|
127
|
-
"description": "Allows to export names from global class or id, so you can use that as local name
|
|
141
|
+
"description": "Allows to export names from global class or id, so you can use that as local name.",
|
|
142
|
+
"link": "https://github.com/webpack-contrib/css-loader#exportglobals",
|
|
128
143
|
"type": "boolean"
|
|
129
144
|
},
|
|
130
145
|
"exportLocalsConvention": {
|
|
131
|
-
"description": "Style of exported classnames
|
|
132
|
-
"
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
146
|
+
"description": "Style of exported classnames.",
|
|
147
|
+
"link": "https://github.com/webpack-contrib/css-loader#localsconvention",
|
|
148
|
+
"anyOf": [
|
|
149
|
+
{
|
|
150
|
+
"enum": [
|
|
151
|
+
"asIs",
|
|
152
|
+
"camelCase",
|
|
153
|
+
"camelCaseOnly",
|
|
154
|
+
"dashes",
|
|
155
|
+
"dashesOnly"
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"instanceof": "Function"
|
|
160
|
+
}
|
|
138
161
|
]
|
|
139
162
|
},
|
|
140
163
|
"exportOnlyLocals": {
|
|
141
|
-
"description": "Export only locals
|
|
164
|
+
"description": "Export only locals.",
|
|
165
|
+
"link": "https://github.com/webpack-contrib/css-loader#exportonlylocals",
|
|
142
166
|
"type": "boolean"
|
|
143
167
|
}
|
|
144
168
|
}
|
|
@@ -146,11 +170,13 @@
|
|
|
146
170
|
]
|
|
147
171
|
},
|
|
148
172
|
"sourceMap": {
|
|
149
|
-
"description": "Allows to enable/disable source maps
|
|
173
|
+
"description": "Allows to enable/disable source maps.",
|
|
174
|
+
"link": "https://github.com/webpack-contrib/css-loader#sourcemap",
|
|
150
175
|
"type": "boolean"
|
|
151
176
|
},
|
|
152
177
|
"importLoaders": {
|
|
153
|
-
"description": "Allows enables/disables or setups number of loaders applied before CSS loader for `@import`/CSS Modules and ICSS imports
|
|
178
|
+
"description": "Allows enables/disables or setups number of loaders applied before CSS loader for `@import`/CSS Modules and ICSS imports.",
|
|
179
|
+
"link": "https://github.com/webpack-contrib/css-loader#importloaders",
|
|
154
180
|
"anyOf": [
|
|
155
181
|
{
|
|
156
182
|
"type": "boolean"
|
|
@@ -164,8 +190,14 @@
|
|
|
164
190
|
]
|
|
165
191
|
},
|
|
166
192
|
"esModule": {
|
|
167
|
-
"description": "Use the ES modules syntax
|
|
193
|
+
"description": "Use the ES modules syntax.",
|
|
194
|
+
"link": "https://github.com/webpack-contrib/css-loader#esmodule",
|
|
168
195
|
"type": "boolean"
|
|
196
|
+
},
|
|
197
|
+
"exportType": {
|
|
198
|
+
"description": "Allows exporting styles as array with modules, string or constructable stylesheet (i.e. `CSSStyleSheet`).",
|
|
199
|
+
"link": "https://github.com/webpack-contrib/css-loader#exporttype",
|
|
200
|
+
"enum": ["array", "string", "css-style-sheet"]
|
|
169
201
|
}
|
|
170
202
|
},
|
|
171
203
|
"type": "object"
|
package/dist/plugins/index.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "icssParser", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _postcssIcssParser.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "importParser", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _postcssImportParser.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "urlParser", {
|
|
@@ -20,7 +20,18 @@ const plugin = (options = {}) => {
|
|
|
20
20
|
icssExports
|
|
21
21
|
} = (0, _icssUtils.extractICSS)(root);
|
|
22
22
|
const imports = new Map();
|
|
23
|
-
const tasks = [];
|
|
23
|
+
const tasks = [];
|
|
24
|
+
const {
|
|
25
|
+
loaderContext
|
|
26
|
+
} = options;
|
|
27
|
+
const resolver = loaderContext.getResolve({
|
|
28
|
+
dependencyType: "icss",
|
|
29
|
+
conditionNames: ["style"],
|
|
30
|
+
extensions: ["..."],
|
|
31
|
+
mainFields: ["css", "style", "main", "..."],
|
|
32
|
+
mainFiles: ["index", "..."],
|
|
33
|
+
preferRelative: true
|
|
34
|
+
}); // eslint-disable-next-line guard-for-in
|
|
24
35
|
|
|
25
36
|
for (const url in icssImports) {
|
|
26
37
|
const tokens = icssImports[url];
|
|
@@ -39,14 +50,10 @@ const plugin = (options = {}) => {
|
|
|
39
50
|
prefix = queryParts.join("!");
|
|
40
51
|
}
|
|
41
52
|
|
|
42
|
-
const request = (0, _utils.requestify)((0, _utils.normalizeUrl)(normalizedUrl, true),
|
|
53
|
+
const request = (0, _utils.requestify)((0, _utils.normalizeUrl)(normalizedUrl, true), loaderContext.rootContext);
|
|
43
54
|
|
|
44
55
|
const doResolve = async () => {
|
|
45
|
-
const
|
|
46
|
-
resolver,
|
|
47
|
-
context
|
|
48
|
-
} = options;
|
|
49
|
-
const resolvedUrl = await (0, _utils.resolveRequests)(resolver, context, [...new Set([normalizedUrl, request])]);
|
|
56
|
+
const resolvedUrl = await (0, _utils.resolveRequests)(resolver, loaderContext.context, [...new Set([normalizedUrl, request])]);
|
|
50
57
|
|
|
51
58
|
if (!resolvedUrl) {
|
|
52
59
|
return;
|
|
@@ -43,9 +43,10 @@ function parseNode(atRule, key) {
|
|
|
43
43
|
throw error;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
const rawParams = atRule.raws && atRule.raws[key] && typeof atRule.raws[key].raw !== "undefined" ? atRule.raws[key].raw : atRule[key];
|
|
46
47
|
const {
|
|
47
48
|
nodes: paramsNodes
|
|
48
|
-
} = (0, _postcssValueParser.default)(
|
|
49
|
+
} = (0, _postcssValueParser.default)(rawParams); // No nodes - `@import ;`
|
|
49
50
|
// Invalid type - `@import foo-bar;`
|
|
50
51
|
|
|
51
52
|
if (paramsNodes.length === 0 || paramsNodes[0].type !== "string" && paramsNodes[0].type !== "function") {
|
|
@@ -92,11 +93,42 @@ function parseNode(atRule, key) {
|
|
|
92
93
|
throw error;
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
const
|
|
96
|
+
const additionalNodes = paramsNodes.slice(1);
|
|
97
|
+
let supports;
|
|
98
|
+
let layer;
|
|
96
99
|
let media;
|
|
97
100
|
|
|
98
|
-
if (
|
|
99
|
-
|
|
101
|
+
if (additionalNodes.length > 0) {
|
|
102
|
+
let nodes = [];
|
|
103
|
+
|
|
104
|
+
for (const node of additionalNodes) {
|
|
105
|
+
nodes.push(node);
|
|
106
|
+
const isLayerFunction = node.type === "function" && node.value.toLowerCase() === "layer";
|
|
107
|
+
const isLayerWord = node.type === "word" && node.value.toLowerCase() === "layer";
|
|
108
|
+
|
|
109
|
+
if (isLayerFunction || isLayerWord) {
|
|
110
|
+
if (isLayerFunction) {
|
|
111
|
+
nodes.splice(nodes.length - 1, 1, ...node.nodes);
|
|
112
|
+
} else {
|
|
113
|
+
nodes.splice(nodes.length - 1, 1, {
|
|
114
|
+
type: "string",
|
|
115
|
+
value: "",
|
|
116
|
+
unclosed: false
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
layer = _postcssValueParser.default.stringify(nodes).trim().toLowerCase();
|
|
121
|
+
nodes = [];
|
|
122
|
+
} else if (node.type === "function" && node.value.toLowerCase() === "supports") {
|
|
123
|
+
nodes.splice(nodes.length - 1, 1, ...node.nodes);
|
|
124
|
+
supports = _postcssValueParser.default.stringify(nodes).trim().toLowerCase();
|
|
125
|
+
nodes = [];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (nodes.length > 0) {
|
|
130
|
+
media = _postcssValueParser.default.stringify(nodes).trim().toLowerCase();
|
|
131
|
+
}
|
|
100
132
|
} // eslint-disable-next-line consistent-return
|
|
101
133
|
|
|
102
134
|
|
|
@@ -104,6 +136,8 @@ function parseNode(atRule, key) {
|
|
|
104
136
|
atRule,
|
|
105
137
|
prefix,
|
|
106
138
|
url,
|
|
139
|
+
layer,
|
|
140
|
+
supports,
|
|
107
141
|
media,
|
|
108
142
|
isRequestable
|
|
109
143
|
};
|
|
@@ -118,6 +152,11 @@ const plugin = (options = {}) => {
|
|
|
118
152
|
return {
|
|
119
153
|
AtRule: {
|
|
120
154
|
import(atRule) {
|
|
155
|
+
if (options.isCSSStyleSheet) {
|
|
156
|
+
options.loaderContext.emitError(new Error(atRule.error("'@import' rules are not allowed here and will not be processed").message));
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
121
160
|
let parsedAtRule;
|
|
122
161
|
|
|
123
162
|
try {
|
|
@@ -142,17 +181,30 @@ const plugin = (options = {}) => {
|
|
|
142
181
|
return;
|
|
143
182
|
}
|
|
144
183
|
|
|
184
|
+
const {
|
|
185
|
+
loaderContext
|
|
186
|
+
} = options;
|
|
187
|
+
const resolver = loaderContext.getResolve({
|
|
188
|
+
dependencyType: "css",
|
|
189
|
+
conditionNames: ["style"],
|
|
190
|
+
mainFields: ["css", "style", "main", "..."],
|
|
191
|
+
mainFiles: ["index", "..."],
|
|
192
|
+
extensions: [".css", "..."],
|
|
193
|
+
preferRelative: true
|
|
194
|
+
});
|
|
145
195
|
const resolvedAtRules = await Promise.all(parsedAtRules.map(async parsedAtRule => {
|
|
146
196
|
const {
|
|
147
197
|
atRule,
|
|
148
198
|
isRequestable,
|
|
149
199
|
prefix,
|
|
150
200
|
url,
|
|
201
|
+
layer,
|
|
202
|
+
supports,
|
|
151
203
|
media
|
|
152
204
|
} = parsedAtRule;
|
|
153
205
|
|
|
154
206
|
if (options.filter) {
|
|
155
|
-
const needKeep = await options.filter(url, media);
|
|
207
|
+
const needKeep = await options.filter(url, media, loaderContext.resourcePath, supports, layer);
|
|
156
208
|
|
|
157
209
|
if (!needKeep) {
|
|
158
210
|
return;
|
|
@@ -160,18 +212,14 @@ const plugin = (options = {}) => {
|
|
|
160
212
|
}
|
|
161
213
|
|
|
162
214
|
if (isRequestable) {
|
|
163
|
-
const request = (0, _utils.requestify)(url,
|
|
164
|
-
const
|
|
165
|
-
resolver,
|
|
166
|
-
context
|
|
167
|
-
} = options;
|
|
168
|
-
const resolvedUrl = await (0, _utils.resolveRequests)(resolver, context, [...new Set([request, url])]);
|
|
215
|
+
const request = (0, _utils.requestify)(url, loaderContext.rootContext);
|
|
216
|
+
const resolvedUrl = await (0, _utils.resolveRequests)(resolver, loaderContext.context, [...new Set([request, url])]);
|
|
169
217
|
|
|
170
218
|
if (!resolvedUrl) {
|
|
171
219
|
return;
|
|
172
220
|
}
|
|
173
221
|
|
|
174
|
-
if (resolvedUrl ===
|
|
222
|
+
if (resolvedUrl === loaderContext.resourcePath) {
|
|
175
223
|
atRule.remove();
|
|
176
224
|
return;
|
|
177
225
|
}
|
|
@@ -180,6 +228,8 @@ const plugin = (options = {}) => {
|
|
|
180
228
|
|
|
181
229
|
return {
|
|
182
230
|
url: resolvedUrl,
|
|
231
|
+
layer,
|
|
232
|
+
supports,
|
|
183
233
|
media,
|
|
184
234
|
prefix,
|
|
185
235
|
isRequestable
|
|
@@ -190,6 +240,8 @@ const plugin = (options = {}) => {
|
|
|
190
240
|
|
|
191
241
|
return {
|
|
192
242
|
url,
|
|
243
|
+
layer,
|
|
244
|
+
supports,
|
|
193
245
|
media,
|
|
194
246
|
prefix,
|
|
195
247
|
isRequestable
|
|
@@ -208,12 +260,16 @@ const plugin = (options = {}) => {
|
|
|
208
260
|
const {
|
|
209
261
|
url,
|
|
210
262
|
isRequestable,
|
|
263
|
+
layer,
|
|
264
|
+
supports,
|
|
211
265
|
media
|
|
212
266
|
} = resolvedAtRule;
|
|
213
267
|
|
|
214
268
|
if (!isRequestable) {
|
|
215
269
|
options.api.push({
|
|
216
270
|
url,
|
|
271
|
+
layer,
|
|
272
|
+
supports,
|
|
217
273
|
media,
|
|
218
274
|
index
|
|
219
275
|
}); // eslint-disable-next-line no-continue
|
|
@@ -240,6 +296,8 @@ const plugin = (options = {}) => {
|
|
|
240
296
|
|
|
241
297
|
options.api.push({
|
|
242
298
|
importName,
|
|
299
|
+
layer,
|
|
300
|
+
supports,
|
|
243
301
|
media,
|
|
244
302
|
index
|
|
245
303
|
});
|
package/dist/runtime/api.js
CHANGED
|
@@ -4,37 +4,55 @@
|
|
|
4
4
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
5
5
|
Author Tobias Koppers @sokra
|
|
6
6
|
*/
|
|
7
|
-
// css base code, injected by the css-loader
|
|
8
|
-
// eslint-disable-next-line func-names
|
|
9
7
|
module.exports = function (cssWithMappingToString) {
|
|
10
8
|
var list = []; // return the list of modules as css string
|
|
11
9
|
|
|
12
10
|
list.toString = function toString() {
|
|
13
11
|
return this.map(function (item) {
|
|
14
|
-
var content =
|
|
12
|
+
var content = "";
|
|
13
|
+
var needLayer = typeof item[5] !== "undefined";
|
|
14
|
+
|
|
15
|
+
if (item[4]) {
|
|
16
|
+
content += "@supports (".concat(item[4], ") {");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (item[2]) {
|
|
20
|
+
content += "@media ".concat(item[2], " {");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (needLayer) {
|
|
24
|
+
content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
content += cssWithMappingToString(item);
|
|
28
|
+
|
|
29
|
+
if (needLayer) {
|
|
30
|
+
content += "}";
|
|
31
|
+
}
|
|
15
32
|
|
|
16
33
|
if (item[2]) {
|
|
17
|
-
|
|
34
|
+
content += "}";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (item[4]) {
|
|
38
|
+
content += "}";
|
|
18
39
|
}
|
|
19
40
|
|
|
20
41
|
return content;
|
|
21
42
|
}).join("");
|
|
22
43
|
}; // import a list of modules into the list
|
|
23
|
-
// eslint-disable-next-line func-names
|
|
24
44
|
|
|
25
45
|
|
|
26
|
-
list.i = function (modules,
|
|
46
|
+
list.i = function i(modules, media, dedupe, supports, layer) {
|
|
27
47
|
if (typeof modules === "string") {
|
|
28
|
-
|
|
29
|
-
modules = [[null, modules, ""]];
|
|
48
|
+
modules = [[null, modules, undefined]];
|
|
30
49
|
}
|
|
31
50
|
|
|
32
51
|
var alreadyImportedModules = {};
|
|
33
52
|
|
|
34
53
|
if (dedupe) {
|
|
35
|
-
for (var
|
|
36
|
-
|
|
37
|
-
var id = this[i][0];
|
|
54
|
+
for (var _i = 0; _i < this.length; _i++) {
|
|
55
|
+
var id = this[_i][0];
|
|
38
56
|
|
|
39
57
|
if (id != null) {
|
|
40
58
|
alreadyImportedModules[id] = true;
|
|
@@ -42,19 +60,37 @@ module.exports = function (cssWithMappingToString) {
|
|
|
42
60
|
}
|
|
43
61
|
}
|
|
44
62
|
|
|
45
|
-
for (var
|
|
46
|
-
var item = [].concat(modules[
|
|
63
|
+
for (var _i2 = 0; _i2 < modules.length; _i2++) {
|
|
64
|
+
var item = [].concat(modules[_i2]);
|
|
47
65
|
|
|
48
66
|
if (dedupe && alreadyImportedModules[item[0]]) {
|
|
49
|
-
// eslint-disable-next-line no-continue
|
|
50
67
|
continue;
|
|
51
68
|
}
|
|
52
69
|
|
|
53
|
-
if (
|
|
70
|
+
if (typeof layer !== "undefined") {
|
|
71
|
+
if (typeof item[5] === "undefined") {
|
|
72
|
+
item[5] = layer;
|
|
73
|
+
} else {
|
|
74
|
+
item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
|
|
75
|
+
item[5] = layer;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (media) {
|
|
54
80
|
if (!item[2]) {
|
|
55
|
-
item[2] =
|
|
81
|
+
item[2] = media;
|
|
82
|
+
} else {
|
|
83
|
+
item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
|
|
84
|
+
item[2] = media;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (supports) {
|
|
89
|
+
if (!item[4]) {
|
|
90
|
+
item[4] = "".concat(supports);
|
|
56
91
|
} else {
|
|
57
|
-
item[
|
|
92
|
+
item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
|
|
93
|
+
item[4] = supports;
|
|
58
94
|
}
|
|
59
95
|
}
|
|
60
96
|
|
package/dist/runtime/getUrl.js
CHANGED
|
@@ -2,24 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = function (url, options) {
|
|
4
4
|
if (!options) {
|
|
5
|
-
// eslint-disable-next-line no-param-reassign
|
|
6
5
|
options = {};
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
if (!url) {
|
|
10
9
|
return url;
|
|
11
|
-
}
|
|
12
|
-
|
|
10
|
+
}
|
|
13
11
|
|
|
14
12
|
url = String(url.__esModule ? url.default : url); // If url is already wrapped in quotes, remove them
|
|
15
13
|
|
|
16
14
|
if (/^['"].*['"]$/.test(url)) {
|
|
17
|
-
// eslint-disable-next-line no-param-reassign
|
|
18
15
|
url = url.slice(1, -1);
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
if (options.hash) {
|
|
22
|
-
// eslint-disable-next-line no-param-reassign
|
|
23
19
|
url += options.hash;
|
|
24
20
|
} // Should url be wrapped?
|
|
25
21
|
// See https://drafts.csswg.org/css-values-3/#urls
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = function (item) {
|
|
4
|
+
var content = item[1];
|
|
5
|
+
var cssMapping = item[3];
|
|
6
|
+
|
|
7
|
+
if (!cssMapping) {
|
|
8
|
+
return content;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (typeof btoa === "function") {
|
|
12
|
+
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));
|
|
13
|
+
var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
|
|
14
|
+
var sourceMapping = "/*# ".concat(data, " */");
|
|
15
|
+
var sourceURLs = cssMapping.sources.map(function (source) {
|
|
16
|
+
return "/*# sourceURL=".concat(cssMapping.sourceRoot || "").concat(source, " */");
|
|
17
|
+
});
|
|
18
|
+
return [content].concat(sourceURLs).concat([sourceMapping]).join("\n");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return [content].join("\n");
|
|
22
|
+
};
|