sass-loader 8.0.2 → 9.0.3
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 +83 -57
- package/dist/SassError.js +2 -3
- package/dist/index.js +19 -50
- package/dist/options.json +2 -2
- package/dist/utils.js +383 -0
- package/package.json +35 -38
- package/dist/getDefaultSassImplementation.js +0 -28
- package/dist/getRenderFunctionFromSassImplementation.js +0 -39
- package/dist/getSassImplementation.js +0 -56
- package/dist/getSassOptions.js +0 -116
- package/dist/importsToResolve.js +0 -88
- package/dist/proxyCustomImporters.js +0 -31
- package/dist/webpackImporter.js +0 -75
package/dist/utils.js
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getPossibleRequests;
|
|
7
|
+
exports.getSassImplementation = getSassImplementation;
|
|
8
|
+
exports.getSassOptions = getSassOptions;
|
|
9
|
+
exports.getWebpackImporter = getWebpackImporter;
|
|
10
|
+
exports.getRenderFunctionFromSassImplementation = getRenderFunctionFromSassImplementation;
|
|
11
|
+
|
|
12
|
+
var _url = _interopRequireDefault(require("url"));
|
|
13
|
+
|
|
14
|
+
var _path = _interopRequireDefault(require("path"));
|
|
15
|
+
|
|
16
|
+
var _semver = _interopRequireDefault(require("semver"));
|
|
17
|
+
|
|
18
|
+
var _klona = _interopRequireDefault(require("klona"));
|
|
19
|
+
|
|
20
|
+
var _loaderUtils = require("loader-utils");
|
|
21
|
+
|
|
22
|
+
var _neoAsync = _interopRequireDefault(require("neo-async"));
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
function getDefaultSassImplementation() {
|
|
27
|
+
let sassImplPkg = 'sass';
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
require.resolve('sass');
|
|
31
|
+
} catch (error) {
|
|
32
|
+
try {
|
|
33
|
+
require.resolve('node-sass');
|
|
34
|
+
|
|
35
|
+
sassImplPkg = 'node-sass';
|
|
36
|
+
} catch (ignoreError) {
|
|
37
|
+
sassImplPkg = 'sass';
|
|
38
|
+
}
|
|
39
|
+
} // eslint-disable-next-line import/no-dynamic-require, global-require
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
return require(sassImplPkg);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function getSassImplementation(implementation) {
|
|
46
|
+
let resolvedImplementation = implementation;
|
|
47
|
+
|
|
48
|
+
if (!resolvedImplementation) {
|
|
49
|
+
// eslint-disable-next-line no-param-reassign
|
|
50
|
+
resolvedImplementation = getDefaultSassImplementation();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const {
|
|
54
|
+
info
|
|
55
|
+
} = resolvedImplementation;
|
|
56
|
+
|
|
57
|
+
if (!info) {
|
|
58
|
+
throw new Error('Unknown Sass implementation.');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const infoParts = info.split('\t');
|
|
62
|
+
|
|
63
|
+
if (infoParts.length < 2) {
|
|
64
|
+
throw new Error(`Unknown Sass implementation "${info}".`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const [implementationName, version] = infoParts;
|
|
68
|
+
|
|
69
|
+
if (implementationName === 'dart-sass') {
|
|
70
|
+
if (!_semver.default.satisfies(version, '^1.3.0')) {
|
|
71
|
+
throw new Error(`Dart Sass version ${version} is incompatible with ^1.3.0.`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return resolvedImplementation;
|
|
75
|
+
} else if (implementationName === 'node-sass') {
|
|
76
|
+
if (!_semver.default.satisfies(version, '^4.0.0')) {
|
|
77
|
+
throw new Error(`Node Sass version ${version} is incompatible with ^4.0.0.`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return resolvedImplementation;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
throw new Error(`Unknown Sass implementation "${implementationName}".`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function isProductionLikeMode(loaderContext) {
|
|
87
|
+
return loaderContext.mode === 'production' || !loaderContext.mode;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function proxyCustomImporters(importers, loaderContext) {
|
|
91
|
+
return [].concat(importers).map(importer => {
|
|
92
|
+
return function proxyImporter(...args) {
|
|
93
|
+
this.webpackLoaderContext = loaderContext;
|
|
94
|
+
return importer.apply(this, args);
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Derives the sass options from the loader context and normalizes its values with sane defaults.
|
|
100
|
+
*
|
|
101
|
+
* @param {object} loaderContext
|
|
102
|
+
* @param {object} loaderOptions
|
|
103
|
+
* @param {string} content
|
|
104
|
+
* @param {object} implementation
|
|
105
|
+
* @returns {Object}
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
function getSassOptions(loaderContext, loaderOptions, content, implementation) {
|
|
110
|
+
const options = (0, _klona.default)(loaderOptions.sassOptions ? typeof loaderOptions.sassOptions === 'function' ? loaderOptions.sassOptions(loaderContext) || {} : loaderOptions.sassOptions : {});
|
|
111
|
+
const isDartSass = implementation.info.includes('dart-sass');
|
|
112
|
+
|
|
113
|
+
if (isDartSass) {
|
|
114
|
+
const shouldTryToResolveFibers = !options.fiber && options.fiber !== false;
|
|
115
|
+
|
|
116
|
+
if (shouldTryToResolveFibers) {
|
|
117
|
+
let fibers;
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
fibers = require.resolve('fibers');
|
|
121
|
+
} catch (_error) {// Nothing
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (fibers) {
|
|
125
|
+
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
126
|
+
options.fiber = require(fibers);
|
|
127
|
+
}
|
|
128
|
+
} else if (options.fiber === false) {
|
|
129
|
+
// Don't pass the `fiber` option for `sass` (`Dart Sass`)
|
|
130
|
+
delete options.fiber;
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
// Don't pass the `fiber` option for `node-sass`
|
|
134
|
+
delete options.fiber;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
options.file = loaderContext.resourcePath;
|
|
138
|
+
options.data = loaderOptions.additionalData ? typeof loaderOptions.additionalData === 'function' ? loaderOptions.additionalData(content, loaderContext) : `${loaderOptions.additionalData}\n${content}` : content; // opt.outputStyle
|
|
139
|
+
|
|
140
|
+
if (!options.outputStyle && isProductionLikeMode(loaderContext)) {
|
|
141
|
+
options.outputStyle = 'compressed';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const useSourceMap = typeof loaderOptions.sourceMap === 'boolean' ? loaderOptions.sourceMap : loaderContext.sourceMap;
|
|
145
|
+
|
|
146
|
+
if (useSourceMap) {
|
|
147
|
+
// Deliberately overriding the sourceMap option here.
|
|
148
|
+
// node-sass won't produce source maps if the data option is used and options.sourceMap is not a string.
|
|
149
|
+
// In case it is a string, options.sourceMap should be a path where the source map is written.
|
|
150
|
+
// But since we're using the data option, the source map will not actually be written, but
|
|
151
|
+
// all paths in sourceMap.sources will be relative to that path.
|
|
152
|
+
// Pretty complicated... :(
|
|
153
|
+
options.sourceMap = _path.default.join(process.cwd(), '/sass.css.map');
|
|
154
|
+
options.sourceMapRoot = process.cwd();
|
|
155
|
+
options.sourceMapContents = true;
|
|
156
|
+
options.omitSourceMapUrl = true;
|
|
157
|
+
options.sourceMapEmbed = false;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const {
|
|
161
|
+
resourcePath
|
|
162
|
+
} = loaderContext;
|
|
163
|
+
|
|
164
|
+
const ext = _path.default.extname(resourcePath); // If we are compiling sass and indentedSyntax isn't set, automatically set it.
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
if (ext && ext.toLowerCase() === '.sass' && typeof options.indentedSyntax === 'undefined') {
|
|
168
|
+
options.indentedSyntax = true;
|
|
169
|
+
} else {
|
|
170
|
+
options.indentedSyntax = Boolean(options.indentedSyntax);
|
|
171
|
+
} // Allow passing custom importers to `sass`/`node-sass`. Accepts `Function` or an array of `Function`s.
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
options.importer = options.importer ? proxyCustomImporters(Array.isArray(options.importer) ? options.importer : [options.importer], loaderContext) : [];
|
|
175
|
+
options.includePaths = [].concat(process.cwd()).concat(options.includePaths || []).concat(process.env.SASS_PATH ? process.env.SASS_PATH.split(process.platform === 'win32' ? ';' : ':') : []);
|
|
176
|
+
return options;
|
|
177
|
+
} // Examples:
|
|
178
|
+
// - ~package
|
|
179
|
+
// - ~package/
|
|
180
|
+
// - ~@org
|
|
181
|
+
// - ~@org/
|
|
182
|
+
// - ~@org/package
|
|
183
|
+
// - ~@org/package/
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
const isModuleImport = /^~([^/]+|[^/]+\/|@[^/]+[/][^/]+|@[^/]+\/?|@[^/]+[/][^/]+\/)$/;
|
|
187
|
+
/**
|
|
188
|
+
* When `sass`/`node-sass` tries to resolve an import, it uses a special algorithm.
|
|
189
|
+
* Since the `sass-loader` uses webpack to resolve the modules, we need to simulate that algorithm.
|
|
190
|
+
* This function returns an array of import paths to try.
|
|
191
|
+
* The last entry in the array is always the original url to enable straight-forward webpack.config aliases.
|
|
192
|
+
*
|
|
193
|
+
* We don't need emulate `dart-sass` "It's not clear which file to import." errors (when "file.ext" and "_file.ext" files are present simultaneously in the same directory).
|
|
194
|
+
* This reduces performance and `dart-sass` always do it on own side.
|
|
195
|
+
*
|
|
196
|
+
* @param {string} url
|
|
197
|
+
* @param {boolean} forWebpackResolver
|
|
198
|
+
* @param {Object} loaderContext
|
|
199
|
+
* @returns {Array<string>}
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
function getPossibleRequests(loaderContext, // eslint-disable-next-line no-shadow
|
|
203
|
+
url, forWebpackResolver = false) {
|
|
204
|
+
const request = (0, _loaderUtils.urlToRequest)(url, // Maybe it is server-relative URLs
|
|
205
|
+
forWebpackResolver && url.charAt(0) === '/' ? loaderContext.rootContext : // eslint-disable-next-line no-undefined
|
|
206
|
+
undefined); // In case there is module request, send this to webpack resolver
|
|
207
|
+
|
|
208
|
+
if (forWebpackResolver && isModuleImport.test(url)) {
|
|
209
|
+
return [...new Set([request, url])];
|
|
210
|
+
} // Keep in mind: ext can also be something like '.datepicker' when the true extension is omitted and the filename contains a dot.
|
|
211
|
+
// @see https://github.com/webpack-contrib/sass-loader/issues/167
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
const ext = _path.default.extname(request).toLowerCase(); // Because @import is also defined in CSS, Sass needs a way of compiling plain CSS @imports without trying to import the files at compile time.
|
|
215
|
+
// To accomplish this, and to ensure SCSS is as much of a superset of CSS as possible, Sass will compile any @imports with the following characteristics to plain CSS imports:
|
|
216
|
+
// - imports where the URL ends with .css.
|
|
217
|
+
// - imports where the URL begins http:// or https://.
|
|
218
|
+
// - imports where the URL is written as a url().
|
|
219
|
+
// - imports that have media queries.
|
|
220
|
+
//
|
|
221
|
+
// The `node-sass` package sends `@import` ending on `.css` to importer, it is bug, so we skip resolve
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
if (ext === '.css') {
|
|
225
|
+
return [];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const dirname = _path.default.dirname(request);
|
|
229
|
+
|
|
230
|
+
const basename = _path.default.basename(request);
|
|
231
|
+
|
|
232
|
+
return [...new Set([`${dirname}/_${basename}`, request].concat(forWebpackResolver ? [`${_path.default.dirname(url)}/_${basename}`, url] : []))];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const matchCss = /\.css$/i;
|
|
236
|
+
const isSpecialModuleImport = /^~[^/]+$/; // `[drive_letter]:\` + `\\[server]\[sharename]\`
|
|
237
|
+
|
|
238
|
+
const isNativeWin32Path = /^[a-zA-Z]:[/\\]|^\\\\/i;
|
|
239
|
+
|
|
240
|
+
function getWebpackImporter(loaderContext, implementation, includePaths) {
|
|
241
|
+
async function startResolving(resolutionMap) {
|
|
242
|
+
if (resolutionMap.length === 0) {
|
|
243
|
+
return Promise.reject();
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const [{
|
|
247
|
+
resolve,
|
|
248
|
+
context,
|
|
249
|
+
possibleRequests
|
|
250
|
+
}] = resolutionMap;
|
|
251
|
+
let result;
|
|
252
|
+
|
|
253
|
+
try {
|
|
254
|
+
result = await resolve(context, possibleRequests[0]);
|
|
255
|
+
} catch (_ignoreError) {
|
|
256
|
+
const [, ...tailResult] = possibleRequests;
|
|
257
|
+
|
|
258
|
+
if (tailResult.length === 0) {
|
|
259
|
+
const [, ...tailResolutionMap] = resolutionMap;
|
|
260
|
+
return startResolving(tailResolutionMap);
|
|
261
|
+
} // eslint-disable-next-line no-param-reassign
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
resolutionMap[0].possibleRequests = tailResult;
|
|
265
|
+
return startResolving(resolutionMap);
|
|
266
|
+
} // Add the result as dependency.
|
|
267
|
+
// Although we're also using stats.includedFiles, this might come in handy when an error occurs.
|
|
268
|
+
// In this case, we don't get stats.includedFiles from node-sass/sass.
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
loaderContext.addDependency(_path.default.normalize(result)); // By removing the CSS file extension, we trigger node-sass to include the CSS file instead of just linking it.
|
|
272
|
+
|
|
273
|
+
return {
|
|
274
|
+
file: result.replace(matchCss, '')
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const sassResolve = loaderContext.getResolve({
|
|
279
|
+
alias: [],
|
|
280
|
+
aliasFields: [],
|
|
281
|
+
conditionNames: [],
|
|
282
|
+
descriptionFiles: [],
|
|
283
|
+
extensions: ['.sass', '.scss', '.css'],
|
|
284
|
+
exportsFields: [],
|
|
285
|
+
mainFields: [],
|
|
286
|
+
mainFiles: ['_index', 'index'],
|
|
287
|
+
modules: [],
|
|
288
|
+
restrictions: [/\.((sa|sc|c)ss)$/i]
|
|
289
|
+
});
|
|
290
|
+
const webpackResolve = loaderContext.getResolve({
|
|
291
|
+
conditionNames: ['sass', 'style'],
|
|
292
|
+
mainFields: ['sass', 'style', 'main', '...'],
|
|
293
|
+
mainFiles: ['_index', 'index', '...'],
|
|
294
|
+
extensions: ['.sass', '.scss', '.css'],
|
|
295
|
+
restrictions: [/\.((sa|sc|c)ss)$/i]
|
|
296
|
+
});
|
|
297
|
+
return (originalUrl, prev, done) => {
|
|
298
|
+
let request = originalUrl;
|
|
299
|
+
const isFileScheme = originalUrl.slice(0, 5).toLowerCase() === 'file:';
|
|
300
|
+
|
|
301
|
+
if (isFileScheme) {
|
|
302
|
+
try {
|
|
303
|
+
// eslint-disable-next-line no-param-reassign
|
|
304
|
+
request = _url.default.fileURLToPath(originalUrl);
|
|
305
|
+
} catch (ignoreError) {
|
|
306
|
+
request = request.slice(7);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
let resolutionMap = [];
|
|
311
|
+
const needEmulateSassResolver = // `sass` doesn't support module import
|
|
312
|
+
!isSpecialModuleImport.test(request) && // We need improve absolute paths handling.
|
|
313
|
+
// Absolute paths should be resolved:
|
|
314
|
+
// - Server-relative URLs - `<context>/path/to/file.ext` (where `<context>` is root context)
|
|
315
|
+
// - Absolute path - `/full/path/to/file.ext` or `C:\\full\path\to\file.ext`
|
|
316
|
+
!isFileScheme && !originalUrl.startsWith('/') && !isNativeWin32Path.test(originalUrl);
|
|
317
|
+
|
|
318
|
+
if (includePaths.length > 0 && needEmulateSassResolver) {
|
|
319
|
+
// The order of import precedence is as follows:
|
|
320
|
+
//
|
|
321
|
+
// 1. Filesystem imports relative to the base file.
|
|
322
|
+
// 2. Custom importer imports.
|
|
323
|
+
// 3. Filesystem imports relative to the working directory.
|
|
324
|
+
// 4. Filesystem imports relative to an `includePaths` path.
|
|
325
|
+
// 5. Filesystem imports relative to a `SASS_PATH` path.
|
|
326
|
+
//
|
|
327
|
+
// Because `sass`/`node-sass` run custom importers before `3`, `4` and `5` points, we need to emulate this behavior to avoid wrong resolution.
|
|
328
|
+
const sassPossibleRequests = getPossibleRequests(loaderContext, request);
|
|
329
|
+
const isDartSass = implementation.info.includes('dart-sass'); // `node-sass` calls our importer before `1. Filesystem imports relative to the base file.`, so we need emulate this too
|
|
330
|
+
|
|
331
|
+
if (!isDartSass) {
|
|
332
|
+
resolutionMap = resolutionMap.concat({
|
|
333
|
+
resolve: sassResolve,
|
|
334
|
+
context: _path.default.dirname(prev),
|
|
335
|
+
possibleRequests: sassPossibleRequests
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
resolutionMap = resolutionMap.concat(includePaths.map(context => ({
|
|
340
|
+
resolve: sassResolve,
|
|
341
|
+
context,
|
|
342
|
+
possibleRequests: sassPossibleRequests
|
|
343
|
+
})));
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const webpackPossibleRequests = getPossibleRequests(loaderContext, request, true);
|
|
347
|
+
resolutionMap = resolutionMap.concat({
|
|
348
|
+
resolve: webpackResolve,
|
|
349
|
+
context: _path.default.dirname(prev),
|
|
350
|
+
possibleRequests: webpackPossibleRequests
|
|
351
|
+
});
|
|
352
|
+
startResolving(resolutionMap) // Catch all resolving errors, return the original file and pass responsibility back to other custom importers
|
|
353
|
+
.catch(() => ({
|
|
354
|
+
file: originalUrl
|
|
355
|
+
})).then(result => done(result));
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
let nodeSassJobQueue = null;
|
|
360
|
+
/**
|
|
361
|
+
* Verifies that the implementation and version of Sass is supported by this loader.
|
|
362
|
+
*
|
|
363
|
+
* @param {Object} implementation
|
|
364
|
+
* @returns {Function}
|
|
365
|
+
*/
|
|
366
|
+
|
|
367
|
+
function getRenderFunctionFromSassImplementation(implementation) {
|
|
368
|
+
const isDartSass = implementation.info.includes('dart-sass');
|
|
369
|
+
|
|
370
|
+
if (isDartSass) {
|
|
371
|
+
return implementation.render.bind(implementation);
|
|
372
|
+
} // There is an issue with node-sass when async custom importers are used
|
|
373
|
+
// See https://github.com/sass/node-sass/issues/857#issuecomment-93594360
|
|
374
|
+
// We need to use a job queue to make sure that one thread is always available to the UV lib
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
if (nodeSassJobQueue === null) {
|
|
378
|
+
const threadPoolSize = Number(process.env.UV_THREADPOOL_SIZE || 4);
|
|
379
|
+
nodeSassJobQueue = _neoAsync.default.queue(implementation.render.bind(implementation), threadPoolSize - 1);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
return nodeSassJobQueue.push.bind(nodeSassJobQueue);
|
|
383
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sass-loader",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.3",
|
|
4
4
|
"description": "Sass loader for webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/sass-loader",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"main": "dist/cjs.js",
|
|
15
15
|
"engines": {
|
|
16
|
-
"node": ">=
|
|
16
|
+
"node": ">= 10.13.0"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"start": "npm run build -- -w",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"build": "cross-env NODE_ENV=production babel src -d dist --copy-files",
|
|
23
23
|
"commitlint": "commitlint --from=master",
|
|
24
24
|
"security": "npm audit",
|
|
25
|
-
"lint:prettier": "prettier
|
|
25
|
+
"lint:prettier": "prettier --list-different .",
|
|
26
26
|
"lint:js": "eslint --cache .",
|
|
27
27
|
"lint": "npm-run-all -l -p \"lint:**\"",
|
|
28
28
|
"test:only": "cross-env NODE_ENV=test jest",
|
|
@@ -56,48 +56,45 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"
|
|
60
|
-
"loader-utils": "^
|
|
61
|
-
"neo-async": "^2.6.
|
|
62
|
-
"schema-utils": "^2.
|
|
63
|
-
"semver": "^
|
|
59
|
+
"klona": "^1.1.2",
|
|
60
|
+
"loader-utils": "^2.0.0",
|
|
61
|
+
"neo-async": "^2.6.2",
|
|
62
|
+
"schema-utils": "^2.7.0",
|
|
63
|
+
"semver": "^7.3.2"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@babel/cli": "^7.
|
|
67
|
-
"@babel/core": "^7.
|
|
68
|
-
"@babel/preset-env": "^7.
|
|
69
|
-
"@commitlint/cli": "^
|
|
70
|
-
"@commitlint/config-conventional": "^
|
|
66
|
+
"@babel/cli": "^7.10.5",
|
|
67
|
+
"@babel/core": "^7.11.0",
|
|
68
|
+
"@babel/preset-env": "^7.11.0",
|
|
69
|
+
"@commitlint/cli": "^9.1.1",
|
|
70
|
+
"@commitlint/config-conventional": "^9.1.1",
|
|
71
71
|
"@webpack-contrib/defaults": "^6.3.0",
|
|
72
72
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
73
|
-
"babel-jest": "^
|
|
74
|
-
"bootstrap": "^4.
|
|
73
|
+
"babel-jest": "^26.2.2",
|
|
74
|
+
"bootstrap": "^4.5.1",
|
|
75
75
|
"bootstrap-sass": "^3.4.1",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"css-loader": "^3.4.2",
|
|
76
|
+
"cross-env": "^7.0.2",
|
|
77
|
+
"css-loader": "^4.2.0",
|
|
79
78
|
"del": "^5.1.0",
|
|
80
|
-
"del-cli": "^3.0.
|
|
81
|
-
"eslint": "^6.
|
|
82
|
-
"eslint-config-prettier": "^6.
|
|
83
|
-
"eslint-plugin-import": "^2.
|
|
84
|
-
"fibers": "^
|
|
85
|
-
"file-loader": "^
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"jest
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"memfs": "^3.0
|
|
92
|
-
"node-sass": "^4.
|
|
79
|
+
"del-cli": "^3.0.1",
|
|
80
|
+
"eslint": "^7.6.0",
|
|
81
|
+
"eslint-config-prettier": "^6.11.0",
|
|
82
|
+
"eslint-plugin-import": "^2.21.2",
|
|
83
|
+
"fibers": "^5.0.0",
|
|
84
|
+
"file-loader": "^6.0.0",
|
|
85
|
+
"foundation-sites": "^6.6.3",
|
|
86
|
+
"husky": "^4.2.5",
|
|
87
|
+
"jest": "^26.2.2",
|
|
88
|
+
"lint-staged": "^10.2.11",
|
|
89
|
+
"material-components-web": "^7.0.0",
|
|
90
|
+
"memfs": "^3.2.0",
|
|
91
|
+
"node-sass": "^4.14.1",
|
|
93
92
|
"npm-run-all": "^4.1.5",
|
|
94
|
-
"prettier": "^
|
|
95
|
-
"sass": "^1.
|
|
96
|
-
"standard-version": "^
|
|
97
|
-
"style-loader": "^1.1
|
|
98
|
-
"webpack": "^4.
|
|
99
|
-
"webpack-cli": "^3.3.10",
|
|
100
|
-
"webpack-dev-server": "^3.10.1"
|
|
93
|
+
"prettier": "^2.0.5",
|
|
94
|
+
"sass": "^1.26.10",
|
|
95
|
+
"standard-version": "^8.0.2",
|
|
96
|
+
"style-loader": "^1.2.1",
|
|
97
|
+
"webpack": "^4.44.1"
|
|
101
98
|
},
|
|
102
99
|
"keywords": [
|
|
103
100
|
"sass",
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
function getDefaultSassImplementation() {
|
|
9
|
-
let sassImplPkg = 'node-sass';
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
require.resolve('node-sass');
|
|
13
|
-
} catch (error) {
|
|
14
|
-
try {
|
|
15
|
-
require.resolve('sass');
|
|
16
|
-
|
|
17
|
-
sassImplPkg = 'sass';
|
|
18
|
-
} catch (ignoreError) {
|
|
19
|
-
sassImplPkg = 'node-sass';
|
|
20
|
-
}
|
|
21
|
-
} // eslint-disable-next-line import/no-dynamic-require, global-require
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return require(sassImplPkg);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var _default = getDefaultSassImplementation;
|
|
28
|
-
exports.default = _default;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _neoAsync = _interopRequireDefault(require("neo-async"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
let nodeSassJobQueue = null;
|
|
13
|
-
/**
|
|
14
|
-
* Verifies that the implementation and version of Sass is supported by this loader.
|
|
15
|
-
*
|
|
16
|
-
* @param {Object} implementation
|
|
17
|
-
* @returns {Function}
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
function getRenderFunctionFromSassImplementation(implementation) {
|
|
21
|
-
const isDartSass = implementation.info.includes('dart-sass');
|
|
22
|
-
|
|
23
|
-
if (isDartSass) {
|
|
24
|
-
return implementation.render.bind(implementation);
|
|
25
|
-
} // There is an issue with node-sass when async custom importers are used
|
|
26
|
-
// See https://github.com/sass/node-sass/issues/857#issuecomment-93594360
|
|
27
|
-
// We need to use a job queue to make sure that one thread is always available to the UV lib
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (nodeSassJobQueue === null) {
|
|
31
|
-
const threadPoolSize = Number(process.env.UV_THREADPOOL_SIZE || 4);
|
|
32
|
-
nodeSassJobQueue = _neoAsync.default.queue(implementation.render.bind(implementation), threadPoolSize - 1);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return nodeSassJobQueue.push.bind(nodeSassJobQueue);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var _default = getRenderFunctionFromSassImplementation;
|
|
39
|
-
exports.default = _default;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _semver = _interopRequireDefault(require("semver"));
|
|
9
|
-
|
|
10
|
-
var _getDefaultSassImplementation = _interopRequireDefault(require("./getDefaultSassImplementation"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function getSassImplementation(implementation) {
|
|
15
|
-
let resolvedImplementation = implementation;
|
|
16
|
-
|
|
17
|
-
if (!resolvedImplementation) {
|
|
18
|
-
// eslint-disable-next-line no-param-reassign
|
|
19
|
-
resolvedImplementation = (0, _getDefaultSassImplementation.default)();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const {
|
|
23
|
-
info
|
|
24
|
-
} = resolvedImplementation;
|
|
25
|
-
|
|
26
|
-
if (!info) {
|
|
27
|
-
throw new Error('Unknown Sass implementation.');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const infoParts = info.split('\t');
|
|
31
|
-
|
|
32
|
-
if (infoParts.length < 2) {
|
|
33
|
-
throw new Error(`Unknown Sass implementation "${info}".`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const [implementationName, version] = infoParts;
|
|
37
|
-
|
|
38
|
-
if (implementationName === 'dart-sass') {
|
|
39
|
-
if (!_semver.default.satisfies(version, '^1.3.0')) {
|
|
40
|
-
throw new Error(`Dart Sass version ${version} is incompatible with ^1.3.0.`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return resolvedImplementation;
|
|
44
|
-
} else if (implementationName === 'node-sass') {
|
|
45
|
-
if (!_semver.default.satisfies(version, '^4.0.0')) {
|
|
46
|
-
throw new Error(`Node Sass version ${version} is incompatible with ^4.0.0.`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return resolvedImplementation;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
throw new Error(`Unknown Sass implementation "${implementationName}".`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
var _default = getSassImplementation;
|
|
56
|
-
exports.default = _default;
|