diff --git a/.github/ISSUE_TEMPLATE/BUG.md b/.github/ISSUE_TEMPLATE/BUG.md index 909226ad..c5547b6f 100644 --- a/.github/ISSUE_TEMPLATE/BUG.md +++ b/.github/ISSUE_TEMPLATE/BUG.md @@ -8,10 +8,9 @@ about: Something went awry and you'd like to tell us about it. ### Bug report - + - ### Actual Behavior diff --git a/.github/ISSUE_TEMPLATE/DOCS.md b/.github/ISSUE_TEMPLATE/DOCS.md index 0db304fa..a94c0c95 100644 --- a/.github/ISSUE_TEMPLATE/DOCS.md +++ b/.github/ISSUE_TEMPLATE/DOCS.md @@ -20,7 +20,6 @@ Documentation Is: - ### Your Proposal for Changes diff --git a/.github/ISSUE_TEMPLATE/FEATURE.md b/.github/ISSUE_TEMPLATE/FEATURE.md index f844ab92..1e5304e1 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE.md +++ b/.github/ISSUE_TEMPLATE/FEATURE.md @@ -8,10 +8,9 @@ about: Suggest an idea for this project ### Feature Proposal - + - ### Feature Use Case diff --git a/.github/ISSUE_TEMPLATE/MODIFICATION.md b/.github/ISSUE_TEMPLATE/MODIFICATION.md index 5f264c3b..c60a5017 100644 --- a/.github/ISSUE_TEMPLATE/MODIFICATION.md +++ b/.github/ISSUE_TEMPLATE/MODIFICATION.md @@ -8,10 +8,9 @@ about: Would you like something work differently? Have an alternative approach? ### Modification Proposal - + - ### Expected Behavior / Situation diff --git a/.github/ISSUE_TEMPLATE/SUPPORT.md b/.github/ISSUE_TEMPLATE/SUPPORT.md index 600bf0b2..1d8ac1c8 100644 --- a/.github/ISSUE_TEMPLATE/SUPPORT.md +++ b/.github/ISSUE_TEMPLATE/SUPPORT.md @@ -4,5 +4,4 @@ about: 👉🏽 Need support, help, or advice? Don't open an issue! Head to http --- Hey there! If you need support, help, or advice then this is not the place to ask. -Please visit [Discussions](https://github.com/webpack/webpack/discussions), [StackOverflow](https://stackoverflow.com/questions/tagged/webpack) -or [the Webpack Gitter](https://gitter.im/webpack/webpack) instead. +Please visit [GitHub Discussions](https://github.com/webpack/webpack/discussions) or [StackOverflow](https://stackoverflow.com/questions/tagged/webpack) instead. diff --git a/CHANGELOG.md b/CHANGELOG.md index 95fe9ed4..d8fa8c2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,21 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [13.3.2](https://github.com/webpack-contrib/sass-loader/compare/v13.3.1...v13.3.2) (2023-06-09) + + +### Bug Fixes + +* **perf:** avoid using `klona` for `sass` options ([#1145](https://github.com/webpack-contrib/sass-loader/issues/1145)) ([9e87b6b](https://github.com/webpack-contrib/sass-loader/commit/9e87b6b103c4f8a32f89235f97f006c3a1115355)) + +### [13.3.1](https://github.com/webpack-contrib/sass-loader/compare/v13.3.0...v13.3.1) (2023-05-28) + + +### Bug Fixes + +* error handling better ([#1141](https://github.com/webpack-contrib/sass-loader/issues/1141)) ([1f99474](https://github.com/webpack-contrib/sass-loader/commit/1f9947441ae95f7bd396886ec7a7d0ecbe939f8c)) +* warnings and errors serialization ([#1142](https://github.com/webpack-contrib/sass-loader/issues/1142)) ([ed6f313](https://github.com/webpack-contrib/sass-loader/commit/ed6f3136f067e4c863077cb0d6c89c7ea8638bf8)) + ## [13.3.0](https://github.com/webpack-contrib/sass-loader/compare/v13.2.2...v13.3.0) (2023-05-22) diff --git a/README.md b/README.md index 8155b4d0..f34f16e8 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,10 @@ module.exports = { Finally run `webpack` via your preferred method. +### The `outputStyle` (old API) and `style` (new API) options in `production` mode + +For `production` mode, the `outputStyle` (old API) and `style` (new API) options default to `compressed` unless otherwise specified in `sassOptions`. + ### Resolving `import` at-rules Webpack provides an [advanced mechanism to resolve files](https://webpack.js.org/concepts/module-resolution/). diff --git a/package-lock.json b/package-lock.json index b78b7f16..51ad904e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "sass-loader", - "version": "13.3.0", + "version": "13.3.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "sass-loader", - "version": "13.3.0", + "version": "13.3.2", "license": "MIT", "dependencies": { "klona": "^2.0.6", diff --git a/package.json b/package.json index 1df49fa4..a8f23052 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sass-loader", - "version": "13.3.0", + "version": "13.3.2", "description": "Sass loader for webpack", "license": "MIT", "repository": "webpack-contrib/sass-loader", @@ -63,7 +63,6 @@ } }, "dependencies": { - "klona": "^2.0.6", "neo-async": "^2.6.2" }, "devDependencies": { diff --git a/src/SassError.js b/src/SassError.js deleted file mode 100644 index d602aa9e..00000000 --- a/src/SassError.js +++ /dev/null @@ -1,36 +0,0 @@ -class SassError extends Error { - constructor(sassError) { - super(); - - this.name = "SassError"; - - // Instruct webpack to hide the JS stack from the console. - // Usually you're only interested in the SASS error in this case. - this.hideStack = true; - Error.captureStackTrace(this, this.constructor); - - if ( - typeof sassError.line !== "undefined" || - typeof sassError.column !== "undefined" - ) { - this.loc = { - line: sassError.line, - column: sassError.column, - }; - } - - // Keep original error if `sassError.formatted` is unavailable - this.message = `${this.name}: ${ - typeof sassError.message !== "undefined" ? sassError.message : sassError - }`; - - if (sassError.formatted) { - this.message = `${this.name}: ${sassError.formatted.replace( - /^Error: /, - "" - )}`; - } - } -} - -export default SassError; diff --git a/src/SassWarning.js b/src/SassWarning.js deleted file mode 100644 index bd84bf82..00000000 --- a/src/SassWarning.js +++ /dev/null @@ -1,17 +0,0 @@ -class SassWarning extends Error { - constructor(warning, options) { - super(warning); - - this.name = "SassWarning"; - this.hideStack = true; - - if (options.span) { - this.loc = { - line: options.span.start.line, - column: options.span.start.column, - }; - } - } -} - -export default SassWarning; diff --git a/src/index.js b/src/index.js index a10d90d5..1541518f 100644 --- a/src/index.js +++ b/src/index.js @@ -9,8 +9,8 @@ import { getModernWebpackImporter, getCompileFn, normalizeSourceMap, + errorFactory, } from "./utils"; -import SassError from "./SassError"; /** * The sass-loader makes node-sass and dart-sass available to webpack modules. @@ -21,10 +21,13 @@ import SassError from "./SassError"; async function loader(content) { const options = this.getOptions(schema); const callback = this.async(); - const implementation = getSassImplementation(this, options.implementation); - if (!implementation) { - callback(); + let implementation; + + try { + implementation = getSassImplementation(this, options.implementation); + } catch (error) { + callback(error); return; } @@ -59,7 +62,14 @@ async function loader(content) { } } - const compile = getCompileFn(implementation, options); + let compile; + + try { + compile = getCompileFn(implementation, options); + } catch (error) { + callback(error); + return; + } let result; @@ -77,7 +87,7 @@ async function loader(content) { this.addDependency(path.normalize(error.file)); } - callback(new SassError(error)); + callback(errorFactory(error)); return; } diff --git a/src/utils.js b/src/utils.js index aa7a8bb7..a356baea 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,11 +1,6 @@ import url from "url"; import path from "path"; -import { klona } from "klona/full"; -import async from "neo-async"; - -import SassWarning from "./SassWarning"; - function getDefaultSassImplementation() { let sassImplPkg = "sass"; @@ -36,43 +31,24 @@ function getSassImplementation(loaderContext, implementation) { let resolvedImplementation = implementation; if (!resolvedImplementation) { - try { - resolvedImplementation = getDefaultSassImplementation(); - } catch (error) { - loaderContext.emitError(error); - - return; - } + resolvedImplementation = getDefaultSassImplementation(); } if (typeof resolvedImplementation === "string") { - try { - // eslint-disable-next-line import/no-dynamic-require, global-require - resolvedImplementation = require(resolvedImplementation); - } catch (error) { - loaderContext.emitError(error); - - // eslint-disable-next-line consistent-return - return; - } + // eslint-disable-next-line import/no-dynamic-require, global-require + resolvedImplementation = require(resolvedImplementation); } const { info } = resolvedImplementation; if (!info) { - loaderContext.emitError(new Error("Unknown Sass implementation.")); - - return; + throw new Error("Unknown Sass implementation."); } const infoParts = info.split("\t"); if (infoParts.length < 2) { - loaderContext.emitError( - new Error(`Unknown Sass implementation "${info}".`) - ); - - return; + throw new Error(`Unknown Sass implementation "${info}".`); } const [implementationName] = infoParts; @@ -88,9 +64,7 @@ function getSassImplementation(loaderContext, implementation) { return resolvedImplementation; } - loaderContext.emitError( - new Error(`Unknown Sass implementation "${implementationName}".`) - ); + throw new Error(`Unknown Sass implementation "${implementationName}".`); } /** @@ -135,24 +109,21 @@ async function getSassOptions( implementation, useSourceMap ) { - const options = klona( - loaderOptions.sassOptions - ? typeof loaderOptions.sassOptions === "function" - ? loaderOptions.sassOptions(loaderContext) || {} - : loaderOptions.sassOptions - : {} - ); - - const isDartSass = implementation.info.includes("dart-sass"); - const isModernAPI = loaderOptions.api === "modern"; - - options.data = loaderOptions.additionalData - ? typeof loaderOptions.additionalData === "function" - ? await loaderOptions.additionalData(content, loaderContext) - : `${loaderOptions.additionalData}\n${content}` - : content; + const options = loaderOptions.sassOptions + ? typeof loaderOptions.sassOptions === "function" + ? loaderOptions.sassOptions(loaderContext) || {} + : loaderOptions.sassOptions + : {}; + const sassOptions = { + ...options, + data: loaderOptions.additionalData + ? typeof loaderOptions.additionalData === "function" + ? await loaderOptions.additionalData(content, loaderContext) + : `${loaderOptions.additionalData}\n${content}` + : content, + }; - if (!options.logger) { + if (!sassOptions.logger) { const needEmitWarning = loaderOptions.warnRuleAsWarning !== false; const logger = loaderContext.getLogger("sass-loader"); const formatSpan = (span) => @@ -160,7 +131,7 @@ async function getSassOptions( const formatDebugSpan = (span) => `[debug:${span.start.line}:${span.start.column}] `; - options.logger = { + sassOptions.logger = { debug(message, loggerOptions) { let builtMessage = ""; @@ -190,9 +161,12 @@ async function getSassOptions( } if (needEmitWarning) { - loaderContext.emitWarning( - new SassWarning(builtMessage, loggerOptions) - ); + const warning = new Error(builtMessage); + + warning.name = "SassWarning"; + warning.stack = null; + + loaderContext.emitWarning(warning); } else { logger.warn(builtMessage); } @@ -200,44 +174,47 @@ async function getSassOptions( }; } + const isModernAPI = loaderOptions.api === "modern"; const { resourcePath } = loaderContext; if (isModernAPI) { - options.url = url.pathToFileURL(resourcePath); + sassOptions.url = url.pathToFileURL(resourcePath); // opt.outputStyle - if (!options.style && isProductionLikeMode(loaderContext)) { - options.style = "compressed"; + if (!sassOptions.style && isProductionLikeMode(loaderContext)) { + sassOptions.style = "compressed"; } if (useSourceMap) { - options.sourceMap = true; + sassOptions.sourceMap = true; } // If we are compiling sass and indentedSyntax isn't set, automatically set it. - if (typeof options.syntax === "undefined") { + if (typeof sassOptions.syntax === "undefined") { const ext = path.extname(resourcePath); if (ext && ext.toLowerCase() === ".scss") { - options.syntax = "scss"; + sassOptions.syntax = "scss"; } else if (ext && ext.toLowerCase() === ".sass") { - options.syntax = "indented"; + sassOptions.syntax = "indented"; } else if (ext && ext.toLowerCase() === ".css") { - options.syntax = "css"; + sassOptions.syntax = "css"; } } - options.importers = options.importers - ? Array.isArray(options.importers) - ? options.importers - : [options.importers] + sassOptions.importers = sassOptions.importers + ? Array.isArray(sassOptions.importers) + ? sassOptions.importers.slice() + : [sassOptions.importers] : []; } else { - options.file = resourcePath; + sassOptions.file = resourcePath; + + const isDartSass = implementation.info.includes("dart-sass"); if (isDartSass && isSupportedFibers()) { const shouldTryToResolveFibers = - !options.fiber && options.fiber !== false; + !sassOptions.fiber && sassOptions.fiber !== false; if (shouldTryToResolveFibers) { let fibers; @@ -250,20 +227,20 @@ async function getSassOptions( if (fibers) { // eslint-disable-next-line global-require, import/no-dynamic-require - options.fiber = require(fibers); + sassOptions.fiber = require(fibers); } - } else if (options.fiber === false) { + } else if (sassOptions.fiber === false) { // Don't pass the `fiber` option for `sass` (`Dart Sass`) - delete options.fiber; + delete sassOptions.fiber; } } else { // Don't pass the `fiber` option for `node-sass` - delete options.fiber; + delete sassOptions.fiber; } // opt.outputStyle - if (!options.outputStyle && isProductionLikeMode(loaderContext)) { - options.outputStyle = "compressed"; + if (!sassOptions.outputStyle && isProductionLikeMode(loaderContext)) { + sassOptions.outputStyle = "compressed"; } if (useSourceMap) { @@ -273,11 +250,14 @@ async function getSassOptions( // But since we're using the data option, the source map will not actually be written, but // all paths in sourceMap.sources will be relative to that path. // Pretty complicated... :( - options.sourceMap = true; - options.outFile = path.join(loaderContext.rootContext, "style.css.map"); - options.sourceMapContents = true; - options.omitSourceMapUrl = true; - options.sourceMapEmbed = false; + sassOptions.sourceMap = true; + sassOptions.outFile = path.join( + loaderContext.rootContext, + "style.css.map" + ); + sassOptions.sourceMapContents = true; + sassOptions.omitSourceMapUrl = true; + sassOptions.sourceMapEmbed = false; } const ext = path.extname(resourcePath); @@ -286,31 +266,32 @@ async function getSassOptions( if ( ext && ext.toLowerCase() === ".sass" && - typeof options.indentedSyntax === "undefined" + typeof sassOptions.indentedSyntax === "undefined" ) { - options.indentedSyntax = true; + sassOptions.indentedSyntax = true; } else { - options.indentedSyntax = Boolean(options.indentedSyntax); + sassOptions.indentedSyntax = Boolean(sassOptions.indentedSyntax); } // Allow passing custom importers to `sass`/`node-sass`. Accepts `Function` or an array of `Function`s. - options.importer = options.importer + sassOptions.importer = sassOptions.importer ? proxyCustomImporters( - Array.isArray(options.importer) - ? options.importer - : [options.importer], + Array.isArray(sassOptions.importer) + ? sassOptions.importer.slice() + : [sassOptions.importer], loaderContext ) : []; - options.includePaths = [] + sassOptions.includePaths = [] .concat(process.cwd()) .concat( // We use `includePaths` in context for resolver, so it should be always absolute - (options.includePaths || []).map((includePath) => - path.isAbsolute(includePath) - ? includePath - : path.join(process.cwd(), includePath) + (sassOptions.includePaths ? sassOptions.includePaths.slice() : []).map( + (includePath) => + path.isAbsolute(includePath) + ? includePath + : path.join(process.cwd(), includePath) ) ) .concat( @@ -321,12 +302,12 @@ async function getSassOptions( : [] ); - if (typeof options.charset === "undefined") { - options.charset = true; + if (typeof sassOptions.charset === "undefined") { + sassOptions.charset = true; } } - return options; + return sassOptions; } const MODULE_REQUEST_REGEX = /^[^?]*~/; @@ -723,6 +704,9 @@ function getCompileFn(implementation, options) { // We need to use a job queue to make sure that one thread is always available to the UV lib if (nodeSassJobQueue === null) { const threadPoolSize = Number(process.env.UV_THREADPOOL_SIZE || 4); + // Only used for `node-sass`, so let's load it lazily + // eslint-disable-next-line global-require + const async = require("neo-async"); nodeSassJobQueue = async.queue( implementation.render.bind(implementation), @@ -802,6 +786,23 @@ function normalizeSourceMap(map, rootContext) { return newMap; } +function errorFactory(error) { + let message; + + if (error.formatted) { + message = error.formatted.replace(/^Error: /, ""); + } else { + // Keep original error if `sassError.formatted` is unavailable + ({ message } = error); + } + + const obj = new Error(message, { cause: error }); + + obj.stack = null; + + return obj; +} + export { getSassImplementation, getSassOptions, @@ -811,4 +812,5 @@ export { getCompileFn, normalizeSourceMap, isSupportedFibers, + errorFactory, }; diff --git a/test/__snapshots__/implementation-option.test.js.snap b/test/__snapshots__/implementation-option.test.js.snap index fa5717ee..7f3c6062 100644 --- a/test/__snapshots__/implementation-option.test.js.snap +++ b/test/__snapshots__/implementation-option.test.js.snap @@ -38,7 +38,7 @@ exports[`implementation option not specify: warnings 1`] = `[]`; exports[`implementation option should not swallow an error when trying to load a sass implementation: errors 1`] = ` [ - "ModuleError: Module Error (from ../src/cjs.js): + "ModuleBuildError: Module build failed (from ../src/cjs.js): Some error", ] `; @@ -47,8 +47,8 @@ exports[`implementation option should not swallow an error when trying to load a exports[`implementation option should throw an error on an unknown sass implementation: errors 1`] = ` [ - "ModuleError: Module Error (from ../src/cjs.js): -Unknown Sass implementation "strange-sass".", + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Error: Unknown Sass implementation "strange-sass".", ] `; @@ -56,8 +56,8 @@ exports[`implementation option should throw an error on an unknown sass implemen exports[`implementation option should throw an error when the "info" is unparseable: errors 1`] = ` [ - "ModuleError: Module Error (from ../src/cjs.js): -Unknown Sass implementation "asdfj".", + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Error: Unknown Sass implementation "asdfj".", ] `; @@ -65,8 +65,8 @@ exports[`implementation option should throw an error when the "info" is unparsea exports[`implementation option should throw error when the "info" does not exist: errors 1`] = ` [ - "ModuleError: Module Error (from ../src/cjs.js): -Unknown Sass implementation.", + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Error: Unknown Sass implementation.", ] `; @@ -74,8 +74,8 @@ exports[`implementation option should throw error when the "info" does not exist exports[`implementation option should throw error when unresolved package: errors 1`] = ` [ - "ModuleError: Module Error (from ../src/cjs.js): -Cannot find module 'unresolved' from 'src/utils.js'", + "ModuleBuildError: Module build failed (from ../src/cjs.js): +Error: Cannot find module 'unresolved' from 'src/utils.js'", ] `; @@ -83,7 +83,7 @@ exports[`implementation option should throw error when unresolved package: warni exports[`implementation option should try to load using valid order: errors 1`] = ` [ - "ModuleError: Module Error (from ../src/cjs.js): + "ModuleBuildError: Module build failed (from ../src/cjs.js): Some error sass", ] `; diff --git a/test/__snapshots__/loader.test.js.snap b/test/__snapshots__/loader.test.js.snap index b998c40c..b4cb5d04 100644 --- a/test/__snapshots__/loader.test.js.snap +++ b/test/__snapshots__/loader.test.js.snap @@ -467,7 +467,7 @@ exports[`loader should load only sass/scss files for the "mainFiles" ('sass-embe exports[`loader should not use .import.sass files ('dart-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -476,7 +476,7 @@ exports[`loader should not use .import.sass files ('dart-sass', 'legacy' API, 's exports[`loader should not use .import.sass files ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -485,7 +485,7 @@ exports[`loader should not use .import.sass files ('dart-sass', 'modern' API, 's exports[`loader should not use .import.sass files ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -494,7 +494,7 @@ exports[`loader should not use .import.sass files ('sass-embedded', 'legacy' API exports[`loader should not use .import.sass files ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Can't find stylesheet to import.", +Error: Can't find stylesheet to import.", ] `; @@ -503,7 +503,7 @@ exports[`loader should not use .import.sass files ('sass-embedded', 'modern' API exports[`loader should not use .import.scss files ('dart-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -512,7 +512,7 @@ exports[`loader should not use .import.scss files ('dart-sass', 'legacy' API, 's exports[`loader should not use .import.scss files ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -521,7 +521,7 @@ exports[`loader should not use .import.scss files ('dart-sass', 'modern' API, 's exports[`loader should not use .import.scss files ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -530,7 +530,7 @@ exports[`loader should not use .import.scss files ('sass-embedded', 'legacy' API exports[`loader should not use .import.scss files ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Can't find stylesheet to import.", +Error: Can't find stylesheet to import.", ] `; @@ -539,7 +539,7 @@ exports[`loader should not use .import.scss files ('sass-embedded', 'modern' API exports[`loader should output an understandable error ('dart-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Expected newline.", +Expected newline.", ] `; @@ -548,7 +548,7 @@ exports[`loader should output an understandable error ('dart-sass', 'legacy' API exports[`loader should output an understandable error ('dart-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: expected "{".", +expected "{".", ] `; @@ -557,7 +557,7 @@ exports[`loader should output an understandable error ('dart-sass', 'legacy' API exports[`loader should output an understandable error ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Expected newline.", +Expected newline.", ] `; @@ -566,7 +566,7 @@ exports[`loader should output an understandable error ('dart-sass', 'modern' API exports[`loader should output an understandable error ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: expected "{".", +expected "{".", ] `; @@ -575,7 +575,7 @@ exports[`loader should output an understandable error ('dart-sass', 'modern' API exports[`loader should output an understandable error ('node-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Invalid CSS after "a {": expected "}", was "{}"", +Invalid CSS after "a {": expected "}", was "{}"", ] `; @@ -584,7 +584,7 @@ exports[`loader should output an understandable error ('node-sass', 'legacy' API exports[`loader should output an understandable error ('node-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: property "some-value" must be followed by a ':'", +property "some-value" must be followed by a ':'", ] `; @@ -593,7 +593,7 @@ exports[`loader should output an understandable error ('node-sass', 'legacy' API exports[`loader should output an understandable error ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Expected newline.", +Expected newline.", ] `; @@ -602,7 +602,7 @@ exports[`loader should output an understandable error ('sass-embedded', 'legacy' exports[`loader should output an understandable error ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: expected "{".", +expected "{".", ] `; @@ -611,7 +611,7 @@ exports[`loader should output an understandable error ('sass-embedded', 'legacy' exports[`loader should output an understandable error ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Expected newline.", +Error: Expected newline.", ] `; @@ -620,7 +620,7 @@ exports[`loader should output an understandable error ('sass-embedded', 'modern' exports[`loader should output an understandable error ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: expected "{".", +Error: expected "{".", ] `; @@ -629,7 +629,7 @@ exports[`loader should output an understandable error ('sass-embedded', 'modern' exports[`loader should output an understandable error when a file could not be found ('dart-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -638,7 +638,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('dart-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -647,7 +647,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -656,7 +656,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -665,7 +665,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('node-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: File to import not found or unreadable: does-not-exist.", +File to import not found or unreadable: does-not-exist.", ] `; @@ -674,7 +674,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('node-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: File to import not found or unreadable: does-not-exist.", +File to import not found or unreadable: does-not-exist.", ] `; @@ -683,7 +683,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -692,7 +692,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -701,7 +701,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Can't find stylesheet to import.", +Error: Can't find stylesheet to import.", ] `; @@ -710,7 +710,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Can't find stylesheet to import.", +Error: Can't find stylesheet to import.", ] `; @@ -719,7 +719,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('dart-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -728,7 +728,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('dart-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -737,7 +737,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -746,7 +746,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -755,7 +755,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -764,7 +764,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -773,7 +773,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Can't find stylesheet to import.", +Error: Can't find stylesheet to import.", ] `; @@ -782,7 +782,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when a file could not be found using "@use" rule ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Can't find stylesheet to import.", +Error: Can't find stylesheet to import.", ] `; @@ -791,7 +791,7 @@ exports[`loader should output an understandable error when a file could not be f exports[`loader should output an understandable error when the problem in "@import" ('dart-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Expected newline.", +Expected newline.", ] `; @@ -800,7 +800,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('dart-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: expected "{".", +expected "{".", ] `; @@ -809,7 +809,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Expected newline.", +Expected newline.", ] `; @@ -818,7 +818,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: expected "{".", +expected "{".", ] `; @@ -827,7 +827,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('node-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Invalid CSS after "a {": expected "}", was "{}"", +Invalid CSS after "a {": expected "}", was "{}"", ] `; @@ -836,7 +836,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('node-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: property "some-value" must be followed by a ':'", +property "some-value" must be followed by a ':'", ] `; @@ -845,7 +845,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Expected newline.", +Expected newline.", ] `; @@ -854,7 +854,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: expected "{".", +expected "{".", ] `; @@ -863,7 +863,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Expected newline.", +Error: Expected newline.", ] `; @@ -872,7 +872,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error when the problem in "@import" ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: expected "{".", +Error: expected "{".", ] `; @@ -881,7 +881,7 @@ exports[`loader should output an understandable error when the problem in "@impo exports[`loader should output an understandable error with a problem in "@use" ('dart-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Expected newline.", +Expected newline.", ] `; @@ -890,7 +890,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('dart-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: expected "{".", +expected "{".", ] `; @@ -899,7 +899,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Expected newline.", +Expected newline.", ] `; @@ -908,7 +908,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: expected "{".", +expected "{".", ] `; @@ -917,7 +917,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Expected newline.", +Expected newline.", ] `; @@ -926,7 +926,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: expected "{".", +expected "{".", ] `; @@ -935,7 +935,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Expected newline.", +Error: Expected newline.", ] `; @@ -944,7 +944,7 @@ exports[`loader should output an understandable error with a problem in "@use" ( exports[`loader should output an understandable error with a problem in "@use" ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: expected "{".", +Error: expected "{".", ] `; @@ -2391,7 +2391,7 @@ exports[`loader should support resolving using the "file" schema ('sass-embedded exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('dart-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -2400,7 +2400,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('dart-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -2409,7 +2409,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -2418,7 +2418,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: It's not clear which file to import. Found:", +It's not clear which file to import. Found:", ] `; @@ -2435,7 +2435,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: It's not clear which file to import. Found:", +Error: It's not clear which file to import. Found:", ] `; @@ -2444,7 +2444,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: It's not clear which file to import. Found:", +Error: It's not clear which file to import. Found:", ] `; @@ -2453,7 +2453,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: It's not clear which file to import. Found:", +Error: It's not clear which file to import. Found:", ] `; @@ -2462,7 +2462,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on ambiguous import (only on "dart-sass") ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: It's not clear which file to import. Found:", +Error: It's not clear which file to import. Found:", ] `; @@ -2471,7 +2471,7 @@ exports[`loader should throw an error on ambiguous import (only on "dart-sass") exports[`loader should throw an error on circular import ('dart-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -2480,7 +2480,7 @@ exports[`loader should throw an error on circular import ('dart-sass', 'legacy' exports[`loader should throw an error on circular import ('dart-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -2489,7 +2489,7 @@ exports[`loader should throw an error on circular import ('dart-sass', 'legacy' exports[`loader should throw an error on circular import ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -2498,7 +2498,7 @@ exports[`loader should throw an error on circular import ('dart-sass', 'modern' exports[`loader should throw an error on circular import ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -2507,7 +2507,7 @@ exports[`loader should throw an error on circular import ('dart-sass', 'modern' exports[`loader should throw an error on circular import ('node-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: An @import loop has been found:", +An @import loop has been found:", ] `; @@ -2516,7 +2516,7 @@ exports[`loader should throw an error on circular import ('node-sass', 'legacy' exports[`loader should throw an error on circular import ('node-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: An @import loop has been found:", +An @import loop has been found:", ] `; @@ -2525,7 +2525,7 @@ exports[`loader should throw an error on circular import ('node-sass', 'legacy' exports[`loader should throw an error on circular import ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -2534,7 +2534,7 @@ exports[`loader should throw an error on circular import ('sass-embedded', 'lega exports[`loader should throw an error on circular import ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -2543,7 +2543,7 @@ exports[`loader should throw an error on circular import ('sass-embedded', 'lega exports[`loader should throw an error on circular import ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: This file is already being loaded.", +Error: This file is already being loaded.", ] `; @@ -2552,7 +2552,7 @@ exports[`loader should throw an error on circular import ('sass-embedded', 'mode exports[`loader should throw an error on circular import ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: This file is already being loaded.", +Error: This file is already being loaded.", ] `; @@ -2561,7 +2561,7 @@ exports[`loader should throw an error on circular import ('sass-embedded', 'mode exports[`loader should throw an error on circular use ('dart-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Module loop: this module is already being loaded.", +Module loop: this module is already being loaded.", ] `; @@ -2570,7 +2570,7 @@ exports[`loader should throw an error on circular use ('dart-sass', 'legacy' API exports[`loader should throw an error on circular use ('dart-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -2579,7 +2579,7 @@ exports[`loader should throw an error on circular use ('dart-sass', 'legacy' API exports[`loader should throw an error on circular use ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Module loop: this module is already being loaded.", +Module loop: this module is already being loaded.", ] `; @@ -2588,7 +2588,7 @@ exports[`loader should throw an error on circular use ('dart-sass', 'modern' API exports[`loader should throw an error on circular use ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -2597,7 +2597,7 @@ exports[`loader should throw an error on circular use ('dart-sass', 'modern' API exports[`loader should throw an error on circular use ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Module loop: this module is already being loaded.", +Module loop: this module is already being loaded.", ] `; @@ -2606,7 +2606,7 @@ exports[`loader should throw an error on circular use ('sass-embedded', 'legacy' exports[`loader should throw an error on circular use ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: This file is already being loaded.", +This file is already being loaded.", ] `; @@ -2615,7 +2615,7 @@ exports[`loader should throw an error on circular use ('sass-embedded', 'legacy' exports[`loader should throw an error on circular use ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Module loop: this module is already being loaded.", +Error: Module loop: this module is already being loaded.", ] `; @@ -2624,7 +2624,7 @@ exports[`loader should throw an error on circular use ('sass-embedded', 'modern' exports[`loader should throw an error on circular use ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: This file is already being loaded.", +Error: This file is already being loaded.", ] `; @@ -2633,7 +2633,7 @@ exports[`loader should throw an error on circular use ('sass-embedded', 'modern' exports[`loader should throw an error with a explicit file and a file does not exist ('dart-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -2642,7 +2642,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('dart-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -2651,7 +2651,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -2660,7 +2660,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -2669,7 +2669,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('node-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: File to import not found or unreadable: ./another/_module.scss.", +File to import not found or unreadable: ./another/_module.scss.", ] `; @@ -2678,7 +2678,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('node-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: File to import not found or unreadable: ./another/_module.scss.", +File to import not found or unreadable: ./another/_module.scss.", ] `; @@ -2687,7 +2687,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -2696,7 +2696,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -2705,7 +2705,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Can't find stylesheet to import.", +Error: Can't find stylesheet to import.", ] `; @@ -2714,7 +2714,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Can't find stylesheet to import.", +Error: Can't find stylesheet to import.", ] `; @@ -2723,7 +2723,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('dart-sass', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -2732,7 +2732,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('dart-sass', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -2741,7 +2741,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('dart-sass', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -2750,7 +2750,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('dart-sass', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -2759,7 +2759,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('sass-embedded', 'legacy' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -2768,7 +2768,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('sass-embedded', 'legacy' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Can't find stylesheet to import.", +Can't find stylesheet to import.", ] `; @@ -2777,7 +2777,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('sass-embedded', 'modern' API, 'sass' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Can't find stylesheet to import.", +Error: Can't find stylesheet to import.", ] `; @@ -2786,7 +2786,7 @@ exports[`loader should throw an error with a explicit file and a file does not e exports[`loader should throw an error with a explicit file and a file does not exist using "@use" rule ('sass-embedded', 'modern' API, 'scss' syntax): errors 1`] = ` [ "ModuleBuildError: Module build failed (from ../src/cjs.js): -SassError: Error: Can't find stylesheet to import.", +Error: Can't find stylesheet to import.", ] `; @@ -3127,6 +3127,66 @@ exports[`loader should work ('dart-sass', 'legacy' API, 'sass' syntax) add "@cha exports[`loader should work ('dart-sass', 'legacy' API, 'sass' syntax) add "@charset "UTF-8";" for non ascii characters: warnings 1`] = `[]`; +exports[`loader should work ('dart-sass', 'legacy' API, 'sass' syntax) and don't modify sass options: css 1`] = ` +"@charset "UTF-8"; +@import "./file.css"; +body { + font: 100% Helvetica, sans-serif; + color: #333; +} + +nav ul { + margin: 0; + padding: 0; + list-style: none; +} +nav li { + display: inline-block; +} +nav a { + display: block; + padding: 6px 12px; + text-decoration: none; +} + +.box { + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + border-radius: 10px; +} + +.message, .warning, .error, .success { + border: 1px solid #ccc; + padding: 10px; + color: #333; +} + +.success { + border-color: green; +} + +.error { + border-color: red; +} + +.warning { + border-color: yellow; +} + +.foo:before { + content: "\\e0c6"; +} + +.bar:before { + content: "∑"; +}" +`; + +exports[`loader should work ('dart-sass', 'legacy' API, 'sass' syntax) and don't modify sass options: errors 1`] = `[]`; + +exports[`loader should work ('dart-sass', 'legacy' API, 'sass' syntax) and don't modify sass options: warnings 1`] = `[]`; + exports[`loader should work ('dart-sass', 'legacy' API, 'sass' syntax) to disable "@charset "UTF-8";" generation: css 1`] = ` "p { content: "é"; @@ -3339,6 +3399,48 @@ exports[`loader should work ('dart-sass', 'legacy' API, 'scss' syntax) add "@cha exports[`loader should work ('dart-sass', 'legacy' API, 'scss' syntax) add "@charset "UTF-8";" for non ascii characters: warnings 1`] = `[]`; +exports[`loader should work ('dart-sass', 'legacy' API, 'scss' syntax) and don't modify sass options: css 1`] = ` +"@charset "UTF-8"; +@import "./file.css"; +body { + font: 100% Helvetica, sans-serif; + color: #333; +} + +nav ul { + margin: 0; + padding: 0; + list-style: none; +} +nav li { + display: inline-block; +} +nav a { + display: block; + padding: 6px 12px; + text-decoration: none; +} + +.box { + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + border-radius: 10px; +} + +.foo:before { + content: "\\e0c6"; +} + +.bar:before { + content: "∑"; +}" +`; + +exports[`loader should work ('dart-sass', 'legacy' API, 'scss' syntax) and don't modify sass options: errors 1`] = `[]`; + +exports[`loader should work ('dart-sass', 'legacy' API, 'scss' syntax) and don't modify sass options: warnings 1`] = `[]`; + exports[`loader should work ('dart-sass', 'legacy' API, 'scss' syntax) to disable "@charset "UTF-8";" generation: css 1`] = ` "p { content: "é"; @@ -3497,6 +3599,66 @@ exports[`loader should work ('dart-sass', 'modern' API, 'sass' syntax) add "@cha exports[`loader should work ('dart-sass', 'modern' API, 'sass' syntax) add "@charset "UTF-8";" for non ascii characters: warnings 1`] = `[]`; +exports[`loader should work ('dart-sass', 'modern' API, 'sass' syntax) and don't modify sass options: css 1`] = ` +"@charset "UTF-8"; +@import "./file.css"; +body { + font: 100% Helvetica, sans-serif; + color: #333; +} + +nav ul { + margin: 0; + padding: 0; + list-style: none; +} +nav li { + display: inline-block; +} +nav a { + display: block; + padding: 6px 12px; + text-decoration: none; +} + +.box { + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + border-radius: 10px; +} + +.message, .warning, .error, .success { + border: 1px solid #ccc; + padding: 10px; + color: #333; +} + +.success { + border-color: green; +} + +.error { + border-color: red; +} + +.warning { + border-color: yellow; +} + +.foo:before { + content: "\\e0c6"; +} + +.bar:before { + content: "∑"; +}" +`; + +exports[`loader should work ('dart-sass', 'modern' API, 'sass' syntax) and don't modify sass options: errors 1`] = `[]`; + +exports[`loader should work ('dart-sass', 'modern' API, 'sass' syntax) and don't modify sass options: warnings 1`] = `[]`; + exports[`loader should work ('dart-sass', 'modern' API, 'sass' syntax) to disable "@charset "UTF-8";" generation: css 1`] = ` "@charset "UTF-8"; p { @@ -3710,6 +3872,48 @@ exports[`loader should work ('dart-sass', 'modern' API, 'scss' syntax) add "@cha exports[`loader should work ('dart-sass', 'modern' API, 'scss' syntax) add "@charset "UTF-8";" for non ascii characters: warnings 1`] = `[]`; +exports[`loader should work ('dart-sass', 'modern' API, 'scss' syntax) and don't modify sass options: css 1`] = ` +"@charset "UTF-8"; +@import "./file.css"; +body { + font: 100% Helvetica, sans-serif; + color: #333; +} + +nav ul { + margin: 0; + padding: 0; + list-style: none; +} +nav li { + display: inline-block; +} +nav a { + display: block; + padding: 6px 12px; + text-decoration: none; +} + +.box { + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + border-radius: 10px; +} + +.foo:before { + content: "\\e0c6"; +} + +.bar:before { + content: "∑"; +}" +`; + +exports[`loader should work ('dart-sass', 'modern' API, 'scss' syntax) and don't modify sass options: errors 1`] = `[]`; + +exports[`loader should work ('dart-sass', 'modern' API, 'scss' syntax) and don't modify sass options: warnings 1`] = `[]`; + exports[`loader should work ('dart-sass', 'modern' API, 'scss' syntax) to disable "@charset "UTF-8";" generation: css 1`] = ` "@charset "UTF-8"; p { @@ -3858,6 +4062,58 @@ exports[`loader should work ('dart-sass', 'modern' API, 'scss' syntax): errors 1 exports[`loader should work ('dart-sass', 'modern' API, 'scss' syntax): warnings 1`] = `[]`; +exports[`loader should work ('node-sass', 'legacy' API, 'sass' syntax) and don't modify sass options: css 1`] = ` +"@charset "UTF-8"; +@import url(./file.css); +body { + font: 100% Helvetica, sans-serif; + color: #333; } + +nav ul { + margin: 0; + padding: 0; + list-style: none; } + +nav li { + display: inline-block; } + +nav a { + display: block; + padding: 6px 12px; + text-decoration: none; } + +.box { + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + border-radius: 10px; } + +.message, .success, .error, .warning { + border: 1px solid #ccc; + padding: 10px; + color: #333; } + +.success { + border-color: green; } + +.error { + border-color: red; } + +.warning { + border-color: yellow; } + +.foo:before { + content: ""; } + +.bar:before { + content: "∑"; } +" +`; + +exports[`loader should work ('node-sass', 'legacy' API, 'sass' syntax) and don't modify sass options: errors 1`] = `[]`; + +exports[`loader should work ('node-sass', 'legacy' API, 'sass' syntax) and don't modify sass options: warnings 1`] = `[]`; + exports[`loader should work ('node-sass', 'legacy' API, 'sass' syntax) with the "filesystem" cache: css 1`] = ` "@charset "UTF-8"; @import url(./file.css); @@ -4014,6 +4270,44 @@ exports[`loader should work ('node-sass', 'legacy' API, 'sass' syntax): errors 1 exports[`loader should work ('node-sass', 'legacy' API, 'sass' syntax): warnings 1`] = `[]`; +exports[`loader should work ('node-sass', 'legacy' API, 'scss' syntax) and don't modify sass options: css 1`] = ` +"@charset "UTF-8"; +@import url(./file.css); +body { + font: 100% Helvetica, sans-serif; + color: #333; } + +nav ul { + margin: 0; + padding: 0; + list-style: none; } + +nav li { + display: inline-block; } + +nav a { + display: block; + padding: 6px 12px; + text-decoration: none; } + +.box { + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + border-radius: 10px; } + +.foo:before { + content: ""; } + +.bar:before { + content: "∑"; } +" +`; + +exports[`loader should work ('node-sass', 'legacy' API, 'scss' syntax) and don't modify sass options: errors 1`] = `[]`; + +exports[`loader should work ('node-sass', 'legacy' API, 'scss' syntax) and don't modify sass options: warnings 1`] = `[]`; + exports[`loader should work ('node-sass', 'legacy' API, 'scss' syntax) with the "filesystem" cache: css 1`] = ` "@charset "UTF-8"; @import url(./file.css); @@ -4139,6 +4433,66 @@ exports[`loader should work ('sass-embedded', 'legacy' API, 'sass' syntax) add " exports[`loader should work ('sass-embedded', 'legacy' API, 'sass' syntax) add "@charset "UTF-8";" for non ascii characters: warnings 1`] = `[]`; +exports[`loader should work ('sass-embedded', 'legacy' API, 'sass' syntax) and don't modify sass options: css 1`] = ` +"@charset "UTF-8"; +@import "./file.css"; +body { + font: 100% Helvetica, sans-serif; + color: #333; +} + +nav ul { + margin: 0; + padding: 0; + list-style: none; +} +nav li { + display: inline-block; +} +nav a { + display: block; + padding: 6px 12px; + text-decoration: none; +} + +.box { + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + border-radius: 10px; +} + +.message, .warning, .error, .success { + border: 1px solid #ccc; + padding: 10px; + color: #333; +} + +.success { + border-color: green; +} + +.error { + border-color: red; +} + +.warning { + border-color: yellow; +} + +.foo:before { + content: "\\e0c6"; +} + +.bar:before { + content: "∑"; +}" +`; + +exports[`loader should work ('sass-embedded', 'legacy' API, 'sass' syntax) and don't modify sass options: errors 1`] = `[]`; + +exports[`loader should work ('sass-embedded', 'legacy' API, 'sass' syntax) and don't modify sass options: warnings 1`] = `[]`; + exports[`loader should work ('sass-embedded', 'legacy' API, 'sass' syntax) to disable "@charset "UTF-8";" generation: css 1`] = ` "p { content: "é"; @@ -4351,6 +4705,48 @@ exports[`loader should work ('sass-embedded', 'legacy' API, 'scss' syntax) add " exports[`loader should work ('sass-embedded', 'legacy' API, 'scss' syntax) add "@charset "UTF-8";" for non ascii characters: warnings 1`] = `[]`; +exports[`loader should work ('sass-embedded', 'legacy' API, 'scss' syntax) and don't modify sass options: css 1`] = ` +"@charset "UTF-8"; +@import "./file.css"; +body { + font: 100% Helvetica, sans-serif; + color: #333; +} + +nav ul { + margin: 0; + padding: 0; + list-style: none; +} +nav li { + display: inline-block; +} +nav a { + display: block; + padding: 6px 12px; + text-decoration: none; +} + +.box { + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + border-radius: 10px; +} + +.foo:before { + content: "\\e0c6"; +} + +.bar:before { + content: "∑"; +}" +`; + +exports[`loader should work ('sass-embedded', 'legacy' API, 'scss' syntax) and don't modify sass options: errors 1`] = `[]`; + +exports[`loader should work ('sass-embedded', 'legacy' API, 'scss' syntax) and don't modify sass options: warnings 1`] = `[]`; + exports[`loader should work ('sass-embedded', 'legacy' API, 'scss' syntax) to disable "@charset "UTF-8";" generation: css 1`] = ` "p { content: "é"; @@ -4509,6 +4905,66 @@ exports[`loader should work ('sass-embedded', 'modern' API, 'sass' syntax) add " exports[`loader should work ('sass-embedded', 'modern' API, 'sass' syntax) add "@charset "UTF-8";" for non ascii characters: warnings 1`] = `[]`; +exports[`loader should work ('sass-embedded', 'modern' API, 'sass' syntax) and don't modify sass options: css 1`] = ` +"@charset "UTF-8"; +@import "./file.css"; +body { + font: 100% Helvetica, sans-serif; + color: #333; +} + +nav ul { + margin: 0; + padding: 0; + list-style: none; +} +nav li { + display: inline-block; +} +nav a { + display: block; + padding: 6px 12px; + text-decoration: none; +} + +.box { + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + border-radius: 10px; +} + +.message, .warning, .error, .success { + border: 1px solid #ccc; + padding: 10px; + color: #333; +} + +.success { + border-color: green; +} + +.error { + border-color: red; +} + +.warning { + border-color: yellow; +} + +.foo:before { + content: "\\e0c6"; +} + +.bar:before { + content: "∑"; +}" +`; + +exports[`loader should work ('sass-embedded', 'modern' API, 'sass' syntax) and don't modify sass options: errors 1`] = `[]`; + +exports[`loader should work ('sass-embedded', 'modern' API, 'sass' syntax) and don't modify sass options: warnings 1`] = `[]`; + exports[`loader should work ('sass-embedded', 'modern' API, 'sass' syntax) to disable "@charset "UTF-8";" generation: css 1`] = ` "@charset "UTF-8"; p { @@ -4722,6 +5178,48 @@ exports[`loader should work ('sass-embedded', 'modern' API, 'scss' syntax) add " exports[`loader should work ('sass-embedded', 'modern' API, 'scss' syntax) add "@charset "UTF-8";" for non ascii characters: warnings 1`] = `[]`; +exports[`loader should work ('sass-embedded', 'modern' API, 'scss' syntax) and don't modify sass options: css 1`] = ` +"@charset "UTF-8"; +@import "./file.css"; +body { + font: 100% Helvetica, sans-serif; + color: #333; +} + +nav ul { + margin: 0; + padding: 0; + list-style: none; +} +nav li { + display: inline-block; +} +nav a { + display: block; + padding: 6px 12px; + text-decoration: none; +} + +.box { + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + border-radius: 10px; +} + +.foo:before { + content: "\\e0c6"; +} + +.bar:before { + content: "∑"; +}" +`; + +exports[`loader should work ('sass-embedded', 'modern' API, 'scss' syntax) and don't modify sass options: errors 1`] = `[]`; + +exports[`loader should work ('sass-embedded', 'modern' API, 'scss' syntax) and don't modify sass options: warnings 1`] = `[]`; + exports[`loader should work ('sass-embedded', 'modern' API, 'scss' syntax) to disable "@charset "UTF-8";" generation: css 1`] = ` "@charset "UTF-8"; p { diff --git a/test/helpers/getCodeFromSass.js b/test/helpers/getCodeFromSass.js index 665b30b5..2b4e4d4b 100644 --- a/test/helpers/getCodeFromSass.js +++ b/test/helpers/getCodeFromSass.js @@ -2,15 +2,12 @@ import url from "url"; import path from "path"; import fs from "fs"; -import { klona } from "klona/full"; - async function getCodeFromSass(testId, options, context = {}) { - const loaderOptions = klona(options); - let sassOptions = options.sassOptions || {}; - - if (typeof sassOptions === "function") { - sassOptions = sassOptions({ mock: true }) || {}; - } + const loaderOptions = { ...options }; + const sassOptions = + typeof loaderOptions.sassOptions === "function" + ? loaderOptions.sassOptions({ mock: true }) || {} + : { ...options.sassOptions } || {}; if (sassOptions.data) { delete sassOptions.data; diff --git a/test/loader.test.js b/test/loader.test.js index d147e2b1..249d42fa 100644 --- a/test/loader.test.js +++ b/test/loader.test.js @@ -62,6 +62,37 @@ describe("loader", () => { expect(getErrors(stats)).toMatchSnapshot("errors"); }); + it(`should work ('${implementationName}', '${api}' API, '${syntax}' syntax) and don't modify sass options`, async () => { + const testId = getTestId("language", syntax); + const sassOptions = isModernAPI + ? { loadPaths: ["node_modules/foundation-sites/scss"] } + : { includePaths: ["node_modules/foundation-sites/scss"] }; + const options = { + implementation, + api, + sassOptions, + }; + const compiler = getCompiler(testId, { loader: { options } }); + const stats = await compile(compiler); + const codeFromBundle = getCodeFromBundle(stats, compiler); + const codeFromSass = await getCodeFromSass(testId, options); + + if (isModernAPI) { + expect(sassOptions).toEqual({ + loadPaths: ["node_modules/foundation-sites/scss"], + }); + } else { + expect(sassOptions).toEqual({ + includePaths: ["node_modules/foundation-sites/scss"], + }); + } + + expect(codeFromBundle.css).toBe(codeFromSass.css); + expect(codeFromBundle.css).toMatchSnapshot("css"); + expect(getWarnings(stats)).toMatchSnapshot("warnings"); + expect(getErrors(stats)).toMatchSnapshot("errors"); + }); + it(`should work ('${implementationName}', '${api}' API, '${syntax}' syntax) with the "memory" cache`, async () => { const cache = path.resolve( __dirname,