sass-loader 8.0.1 → 9.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/dist/utils.js ADDED
@@ -0,0 +1,379 @@
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 ? [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
+ 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
+ return resolve(context, possibleRequests[0]).then(result => {
252
+ // Add the result as dependency.
253
+ // Although we're also using stats.includedFiles, this might come in handy when an error occurs.
254
+ // In this case, we don't get stats.includedFiles from node-sass/sass.
255
+ 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.
256
+
257
+ return {
258
+ file: result.replace(matchCss, '')
259
+ };
260
+ }).catch(() => {
261
+ const [, ...tailResult] = possibleRequests;
262
+
263
+ if (tailResult.length === 0) {
264
+ const [, ...tailResolutionMap] = resolutionMap;
265
+ return startResolving(tailResolutionMap);
266
+ } // eslint-disable-next-line no-param-reassign
267
+
268
+
269
+ resolutionMap[0].possibleRequests = tailResult;
270
+ return startResolving(resolutionMap);
271
+ });
272
+ }
273
+
274
+ const sassResolve = loaderContext.getResolve({
275
+ alias: [],
276
+ aliasFields: [],
277
+ conditionNames: [],
278
+ descriptionFiles: [],
279
+ extensions: ['.sass', '.scss', '.css'],
280
+ exportsFields: [],
281
+ mainFields: [],
282
+ mainFiles: ['_index', 'index'],
283
+ modules: [],
284
+ restrictions: [/\.((sa|sc|c)ss)$/i]
285
+ });
286
+ const webpackResolve = loaderContext.getResolve({
287
+ conditionNames: ['sass', 'style'],
288
+ mainFields: ['sass', 'style', 'main', '...'],
289
+ mainFiles: ['_index', 'index', '...'],
290
+ extensions: ['.sass', '.scss', '.css'],
291
+ restrictions: [/\.((sa|sc|c)ss)$/i]
292
+ });
293
+ return (originalUrl, prev, done) => {
294
+ let request = originalUrl;
295
+ const isFileScheme = originalUrl.slice(0, 5).toLowerCase() === 'file:';
296
+
297
+ if (isFileScheme) {
298
+ try {
299
+ // eslint-disable-next-line no-param-reassign
300
+ request = _url.default.fileURLToPath(originalUrl);
301
+ } catch (ignoreError) {
302
+ request = request.slice(7);
303
+ }
304
+ }
305
+
306
+ let resolutionMap = [];
307
+ const needEmulateSassResolver = // `sass` doesn't support module import
308
+ !isSpecialModuleImport.test(request) && // We need improve absolute paths handling.
309
+ // Absolute paths should be resolved:
310
+ // - Server-relative URLs - `<context>/path/to/file.ext` (where `<context>` is root context)
311
+ // - Absolute path - `/full/path/to/file.ext` or `C:\\full\path\to\file.ext`
312
+ !isFileScheme && !originalUrl.startsWith('/') && !isNativeWin32Path.test(originalUrl);
313
+
314
+ if (includePaths.length > 0 && needEmulateSassResolver) {
315
+ // The order of import precedence is as follows:
316
+ //
317
+ // 1. Filesystem imports relative to the base file.
318
+ // 2. Custom importer imports.
319
+ // 3. Filesystem imports relative to the working directory.
320
+ // 4. Filesystem imports relative to an `includePaths` path.
321
+ // 5. Filesystem imports relative to a `SASS_PATH` path.
322
+ //
323
+ // Because `sass`/`node-sass` run custom importers before `3`, `4` and `5` points, we need to emulate this behavior to avoid wrong resolution.
324
+ const sassPossibleRequests = getPossibleRequests(loaderContext, request);
325
+ 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
326
+
327
+ if (!isDartSass) {
328
+ resolutionMap = resolutionMap.concat({
329
+ resolve: sassResolve,
330
+ context: _path.default.dirname(prev),
331
+ possibleRequests: sassPossibleRequests
332
+ });
333
+ }
334
+
335
+ resolutionMap = resolutionMap.concat(includePaths.map(context => ({
336
+ resolve: sassResolve,
337
+ context,
338
+ possibleRequests: sassPossibleRequests
339
+ })));
340
+ }
341
+
342
+ const webpackPossibleRequests = getPossibleRequests(loaderContext, request, true);
343
+ resolutionMap = resolutionMap.concat({
344
+ resolve: webpackResolve,
345
+ context: _path.default.dirname(prev),
346
+ possibleRequests: webpackPossibleRequests
347
+ });
348
+ startResolving(resolutionMap) // Catch all resolving errors, return the original file and pass responsibility back to other custom importers
349
+ .catch(() => ({
350
+ file: originalUrl
351
+ })).then(done);
352
+ };
353
+ }
354
+
355
+ let nodeSassJobQueue = null;
356
+ /**
357
+ * Verifies that the implementation and version of Sass is supported by this loader.
358
+ *
359
+ * @param {Object} implementation
360
+ * @returns {Function}
361
+ */
362
+
363
+ function getRenderFunctionFromSassImplementation(implementation) {
364
+ const isDartSass = implementation.info.includes('dart-sass');
365
+
366
+ if (isDartSass) {
367
+ return implementation.render.bind(implementation);
368
+ } // There is an issue with node-sass when async custom importers are used
369
+ // See https://github.com/sass/node-sass/issues/857#issuecomment-93594360
370
+ // We need to use a job queue to make sure that one thread is always available to the UV lib
371
+
372
+
373
+ if (nodeSassJobQueue === null) {
374
+ const threadPoolSize = Number(process.env.UV_THREADPOOL_SIZE || 4);
375
+ nodeSassJobQueue = _neoAsync.default.queue(implementation.render.bind(implementation), threadPoolSize - 1);
376
+ }
377
+
378
+ return nodeSassJobQueue.push.bind(nodeSassJobQueue);
379
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sass-loader",
3
- "version": "8.0.1",
3
+ "version": "9.0.2",
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": ">= 8.9.0"
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 \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different",
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
- "clone-deep": "^4.0.1",
60
- "loader-utils": "^1.2.3",
59
+ "klona": "^1.1.1",
60
+ "loader-utils": "^2.0.0",
61
61
  "neo-async": "^2.6.1",
62
- "schema-utils": "^2.6.1",
63
- "semver": "^7.1.1"
62
+ "schema-utils": "^2.7.0",
63
+ "semver": "^7.3.2"
64
64
  },
65
65
  "devDependencies": {
66
- "@babel/cli": "^7.7.7",
67
- "@babel/core": "^7.7.7",
68
- "@babel/preset-env": "^7.7.7",
69
- "@commitlint/cli": "^8.3.4",
70
- "@commitlint/config-conventional": "^8.3.4",
66
+ "@babel/cli": "^7.10.3",
67
+ "@babel/core": "^7.10.3",
68
+ "@babel/preset-env": "^7.10.3",
69
+ "@commitlint/cli": "^9.0.1",
70
+ "@commitlint/config-conventional": "^9.0.1",
71
71
  "@webpack-contrib/defaults": "^6.3.0",
72
72
  "@webpack-contrib/eslint-config-webpack": "^3.0.0",
73
- "babel-jest": "^24.9.0",
74
- "bootstrap": "^4.4.1",
73
+ "babel-jest": "^26.0.1",
74
+ "bootstrap": "^4.5.0",
75
75
  "bootstrap-sass": "^3.4.1",
76
- "commitlint-azure-pipelines-cli": "^1.0.3",
77
- "cross-env": "^6.0.3",
78
- "css-loader": "^3.4.1",
76
+ "cross-env": "^7.0.2",
77
+ "css-loader": "^3.6.0",
79
78
  "del": "^5.1.0",
80
- "del-cli": "^3.0.0",
81
- "eslint": "^6.8.0",
82
- "eslint-config-prettier": "^6.9.0",
83
- "eslint-plugin-import": "^2.19.1",
84
- "fibers": "^4.0.2",
85
- "file-loader": "^5.0.2",
86
- "husky": "^4.0.6",
87
- "jest": "^24.9.0",
88
- "jest-junit": "^10.0.0",
89
- "jquery": "^3.4.1",
90
- "lint-staged": "^9.5.0",
91
- "memfs": "^3.0.3",
92
- "node-sass": "^4.13.0",
79
+ "del-cli": "^3.0.1",
80
+ "eslint": "^7.3.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.0.1",
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": "^1.19.1",
95
- "sass": "^1.24.4",
96
- "standard-version": "^7.0.1",
97
- "style-loader": "^1.1.2",
98
- "webpack": "^4.41.5",
99
- "webpack-cli": "^3.3.10",
100
- "webpack-dev-server": "^3.10.1"
93
+ "prettier": "^2.0.5",
94
+ "sass": "^1.26.8",
95
+ "standard-version": "^8.0.0",
96
+ "style-loader": "^1.2.1",
97
+ "webpack": "^4.43.0"
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;