Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: webpack-contrib/sass-loader
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v15.0.0
Choose a base ref
...
head repository: webpack-contrib/sass-loader
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jul 23, 2024

  1. ci: node@22 (#1218)

    alexander-akait authored Jul 23, 2024
    Copy the full SHA
    3f0332f View commit details

Commits on Jul 25, 2024

  1. Copy the full SHA
    57eee6b View commit details

Commits on Jul 26, 2024

  1. Copy the full SHA
    c7ca4ee View commit details

Commits on Jul 29, 2024

  1. Copy the full SHA
    c1997de View commit details

Commits on Aug 13, 2024

  1. Copy the full SHA
    ef02dad View commit details

Commits on Aug 19, 2024

  1. Copy the full SHA
    f862f7a View commit details
  2. docs: fix version

    alexander-akait committed Aug 19, 2024
    Copy the full SHA
    93b8d83 View commit details
  3. Copy the full SHA
    ce1ffc7 View commit details

Commits on Sep 20, 2024

  1. Copy the full SHA
    c75c606 View commit details
  2. Copy the full SHA
    4bc3848 View commit details
  3. chore(deps): bump serve-static and express (#1234)

    Bumps [serve-static](https://github.com/expressjs/serve-static) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.
    
    Updates `serve-static` from 1.15.0 to 1.16.2
    - [Release notes](https://github.com/expressjs/serve-static/releases)
    - [Changelog](https://github.com/expressjs/serve-static/blob/v1.16.2/HISTORY.md)
    - [Commits](expressjs/serve-static@v1.15.0...v1.16.2)
    
    Updates `express` from 4.19.2 to 4.21.0
    - [Release notes](https://github.com/expressjs/express/releases)
    - [Changelog](https://github.com/expressjs/express/blob/4.21.0/History.md)
    - [Commits](expressjs/express@4.19.2...4.21.0)
    
    ---
    updated-dependencies:
    - dependency-name: serve-static
      dependency-type: indirect
    - dependency-name: express
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Sep 20, 2024
    Copy the full SHA
    86b7c20 View commit details
  4. chore(deps): bump body-parser and express (#1235)

    Bumps [body-parser](https://github.com/expressjs/body-parser) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.
    
    Updates `body-parser` from 1.20.2 to 1.20.3
    - [Release notes](https://github.com/expressjs/body-parser/releases)
    - [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md)
    - [Commits](expressjs/body-parser@1.20.2...1.20.3)
    
    Updates `express` from 4.19.2 to 4.21.0
    - [Release notes](https://github.com/expressjs/express/releases)
    - [Changelog](https://github.com/expressjs/express/blob/4.21.0/History.md)
    - [Commits](expressjs/express@4.19.2...4.21.0)
    
    ---
    updated-dependencies:
    - dependency-name: body-parser
      dependency-type: indirect
    - dependency-name: express
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Sep 20, 2024
    Copy the full SHA
    7560bdb View commit details

Commits on Oct 21, 2024

  1. chore(deps): bump cookie and express (#1239)

    Bumps [cookie](https://github.com/jshttp/cookie) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.
    
    Updates `cookie` from 0.6.0 to 0.7.1
    - [Release notes](https://github.com/jshttp/cookie/releases)
    - [Commits](jshttp/cookie@v0.6.0...v0.7.1)
    
    Updates `express` from 4.21.0 to 4.21.1
    - [Release notes](https://github.com/expressjs/express/releases)
    - [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md)
    - [Commits](expressjs/express@4.21.0...4.21.1)
    
    ---
    updated-dependencies:
    - dependency-name: cookie
      dependency-type: indirect
    - dependency-name: express
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 21, 2024
    Copy the full SHA
    a874a36 View commit details
  2. docs: update (#1242)

    alexander-akait authored Oct 21, 2024
    Copy the full SHA
    eda8505 View commit details

Commits on Oct 31, 2024

  1. Copy the full SHA
    262dc3d View commit details

Commits on Nov 1, 2024

  1. Copy the full SHA
    004ed38 View commit details
  2. Copy the full SHA
    8a9e060 View commit details

Commits on Nov 2, 2024

  1. Copy the full SHA
    38c79b5 View commit details

Commits on Dec 4, 2024

  1. Copy the full SHA
    70a10ff View commit details
  2. Copy the full SHA
    1c98038 View commit details

Commits on Jan 21, 2025

  1. Copy the full SHA
    115b9a0 View commit details

Commits on Feb 14, 2025

  1. Copy the full SHA
    3352e49 View commit details
  2. Copy the full SHA
    300ac87 View commit details
Showing with 1,258,385 additions and 3,907 deletions.
  1. +6 −3 .github/workflows/nodejs.yml
  2. +1 −1 .husky/commit-msg
  3. +1 −1 .husky/pre-commit
  4. +77 −0 CHANGELOG.md
  5. +15 −13 README.md
  6. +11 −0 jest.config.js
  7. +2,587 −2,460 package-lock.json
  8. +5 −5 package.json
  9. +11 −3 src/index.js
  10. +25 −20 src/utils.js
  11. +529 −0 test/__snapshots__/additionalData-option.test.js.no-node-sass.snap
  12. +115 −0 test/__snapshots__/implementation-option.test.js.no-node-sass.snap
  13. +8 −0 test/__snapshots__/implementation-option.test.js.snap
  14. +1,225,433 −0 test/__snapshots__/loader.test.js.no-node-sass.snap
  15. +4,640 −1,332 test/__snapshots__/loader.test.js.snap
  16. +6,977 −0 test/__snapshots__/sassOptions-option.test.js.no-node-sass.snap
  17. +144 −0 test/__snapshots__/sassOptions-option.test.js.snap
  18. +10,423 −0 test/__snapshots__/sourceMap-options.test.js.no-node-sass.snap
  19. +5,041 −59 test/__snapshots__/sourceMap-options.test.js.snap
  20. +145 −0 test/__snapshots__/validate-options.test.js.no-node-sass.snap
  21. +1,159 −0 test/__snapshots__/warnRuleAsWarning.test.js.no-node-sass.snap
  22. +613 −0 test/__snapshots__/webpackImporter-options.test.js.no-node-sass.snap
  23. +14 −1 test/helpers/getCodeFromSass.js
  24. +13 −6 test/helpers/getImplementationsAndAPI.js
  25. +2 −0 test/helpers/index.js
  26. +7 −0 test/helpers/is-node-sass-supported.js
  27. +18 −0 test/helpers/skip-node-sass-snapshot-resolver.js
  28. +112 −3 test/implementation-option.test.js
  29. +60 −0 test/sass/language-source-maps.sass
  30. +5 −0 test/sass/slash-div.sass
  31. +1 −0 test/sass/use-with-extension.sass
  32. +38 −0 test/sassOptions-option.test.js
  33. +49 −0 test/scss/language-source-maps.scss
  34. +7 −0 test/scss/slash-div.scss
  35. +1 −0 test/scss/use-with-extension.scss
  36. +92 −0 test/sourceMap-options.test.js
9 changes: 6 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -61,8 +61,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
# TODO add 21.x after node-sass gets support
node-version: [18.x, 20.x]
node-version: [18.x, 20.x, 22.x, 23.x]
webpack-version: [latest]

runs-on: ${{ matrix.os }}
@@ -89,6 +88,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install webpack ${{ matrix.webpack-version }}
if: matrix.node-version == '22.x' || matrix.node-version == '23.x'
run: npm uninstall node-sass

- name: Install dependencies
run: npm ci

@@ -100,6 +103,6 @@ jobs:
run: npm run test:coverage -- --ci

- name: Submit coverage data to codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npx --no-install commitlint --edit $1
commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npx --no-install lint-staged
lint-staged
77 changes: 77 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,83 @@

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.

### [16.0.5](https://github.com/webpack-contrib/sass-loader/compare/v16.0.4...v16.0.5) (2025-02-14)


### Bug Fixes

* allow to import CSS using `@use` with `css` extension ([#1254](https://github.com/webpack-contrib/sass-loader/issues/1254)) ([3352e49](https://github.com/webpack-contrib/sass-loader/commit/3352e49f45ac9c7b0e9f6b42752443652e893e21))

### [16.0.4](https://github.com/webpack-contrib/sass-loader/compare/v16.0.3...v16.0.4) (2024-12-04)


### Bug Fixes

* include sources map сontent for modern api by default ([#1250](https://github.com/webpack-contrib/sass-loader/issues/1250)) ([70a10ff](https://github.com/webpack-contrib/sass-loader/commit/70a10fffa4b7fc971bccb3bb0a95d3f1d74f765a))

### [16.0.3](https://github.com/webpack-contrib/sass-loader/compare/v16.0.2...v16.0.3) (2024-11-01)


### Bug Fixes

* **modern-compiler:** dispose redundant compilers ([#1245](https://github.com/webpack-contrib/sass-loader/issues/1245)) ([004ed38](https://github.com/webpack-contrib/sass-loader/commit/004ed385084b3fa1e47bfc061124049716386b1b))

### [16.0.2](https://github.com/webpack-contrib/sass-loader/compare/v16.0.1...v16.0.2) (2024-09-20)


### Bug Fixes

* error message from sass ([#1231](https://github.com/webpack-contrib/sass-loader/issues/1231)) ([c75c606](https://github.com/webpack-contrib/sass-loader/commit/c75c6061266a6df6a7c736de407fcbf05ef5b2be))

## [16.0.1](https://github.com/webpack-contrib/sass-loader/compare/v16.0.0...v16.0.1) (2024-08-19)

### Bug Fixes

* generate correct sourceMaps for `modern-compiler` api ([#1228](https://github.com/webpack-contrib/sass-loader/issues/1228)) ([f862f7a](https://github.com/webpack-contrib/sass-loader/commit/f862f7a8382fab11c9c2a897ab1e26d35167cd10))

## [16.0.0](https://github.com/webpack-contrib/sass-loader/compare/v15.0.0...v16.0.0) (2024-07-26)


### ⚠ BREAKING CHANGES

* use modern Sass JS API by default for `sass` and `sass-embedded`

> [!WARNING]
>
> The sass options are different for the `legacy` (before) and `modern` APIs. Please look at [docs](https://sass-lang.com/documentation/js-api) how to migrate to the modern options.
> Legacy options - https://sass-lang.com/documentation/js-api/interfaces/legacystringoptions/
> Modern options - https://sass-lang.com/documentation/js-api/interfaces/options/
To return to the previous logic use:

```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
api: "legacy",
// Your options
},
},
],
},
],
},
};
```

### Features

* use modern Sass JS API by default for `sass` and `sass-embedded` ([10be1ba](https://github.com/webpack-contrib/sass-loader/commit/10be1ba161557638fd3b80f4a5467159179ef9b1))


## [15.0.0](https://github.com/webpack-contrib/sass-loader/compare/v14.2.1...v15.0.0) (2024-07-23)


28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -98,11 +98,11 @@ module.exports = {

Finally run `webpack` via your preferred method.

### The `outputStyle` (old API) and `style` (new API) options in `production` mode
### The `style` (new API, by default since 16 version) and `outputStyle` (old 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`.
For `production` mode, the `style` (new API, by default since 16 version) and `outputStyle` (old API) options default to `compressed` unless otherwise specified in `sassOptions`.

### Resolving `import` at-rules
### Resolving `import` and `use` at-rules

Webpack provides an [advanced mechanism to resolve files](https://webpack.js.org/concepts/module-resolution/).

@@ -147,6 +147,7 @@ Thankfully there are two solutions to this problem:
- **[`additionalData`](#additionaldata)**
- **[`webpackImporter`](#webpackimporter)**
- **[`warnRuleAsWarning`](#warnruleaswarning)**
- **[`api`](#api)**

### `implementation`

@@ -296,13 +297,13 @@ Options for [Dart Sass](http://sass-lang.com/dart-sass) or [Node Sass](https://g
> [!NOTE]
>
> The `indentedSyntax` option is `true` for the `sass` extension.
> The `syntax` (new API, by default since 16 version)`and`indentedSyntax`(old API) option is`scss`for the`scss`extension,`indented`for the`sass`extension and`css`for the`css` extension.
> [!NOTE]
>
> Options such as `data` and `file` are unavailable and will be ignored.
> ℹ We strongly discourage changing the `outFile`, `sourceMapContents`, `sourceMapEmbed`, and `sourceMapRoot` options because `sass-loader` sets these automatically when the `sourceMap` option is `true`.
> ℹ We strongly discourage changing the `sourceMap` (new API, by default since 16 version), `outFile` (old API), `sourceMapContents` (old API), `sourceMapEmbed` (old API), and `sourceMapRoot` (old API) options because `sass-loader` sets these automatically when the `sourceMap` option is `true`.
> [!NOTE]
>
@@ -313,6 +314,7 @@ There is a slight difference between the options for `sass` (`dart-sass`) and `n
Please consult their respective documentation before using them:

- [Dart Sass documentation](https://sass-lang.com/documentation/js-api/interfaces/Options) for all available `sass` options.
- [Sass Embedded documentation](https://github.com/sass/embedded-host-node) for all available `sass` options.
- [Node Sass documentation](https://github.com/sass/node-sass/#options) for all available `node-sass` options.

#### `object`
@@ -334,8 +336,8 @@ module.exports = {
loader: "sass-loader",
options: {
sassOptions: {
indentWidth: 4,
includePaths: ["absolute/path/a", "absolute/path/b"],
style: `compressed`,
loadPaths: ["absolute/path/a", "absolute/path/b"],
},
},
},
@@ -362,19 +364,19 @@ module.exports = {
{
loader: "sass-loader",
options: {
sassOptions: (content, loaderContext) => {
sassOptions: (loaderContext) => {
// More information about available properties https://webpack.js.org/api/loaders/
const { resourcePath, rootContext } = loaderContext;
const relativePath = path.relative(rootContext, resourcePath);

if (relativePath === "styles/foo.scss") {
return {
includePaths: ["absolute/path/c", "absolute/path/d"],
loadPaths: ["absolute/path/c", "absolute/path/d"],
};
}

return {
includePaths: ["absolute/path/a", "absolute/path/b"],
loadPaths: ["absolute/path/a", "absolute/path/b"],
};
},
},
@@ -401,7 +403,7 @@ Enables/Disables generation of source maps.
By default generation of source maps depends on the [`devtool`](https://webpack.js.org/configuration/devtool/) option.
All values enable source map generation except `eval` and `false`.

> ℹ If `true`, the `sourceMap`, `sourceMapRoot`, `sourceMapEmbed`, `sourceMapContents` and `omitSourceMapUrl` options from `sassOptions` will be ignored.
> ℹ If `true`, the `sourceMap` (new API, by default since 16 version), `outFile` (old API), `sourceMapContents` (old API), `sourceMapEmbed` (old API), and `sourceMapRoot` (old API) from `sassOptions` will be ignored.
**webpack.config.js**

@@ -683,7 +685,7 @@ Type:
type api = "legacy" | "modern" | "modern-compiler";
```

Default: `"legacy"`
Default: `"modern"` for `sass` (`dart-sass`) and `sass-embedded`, or `"legacy"` for `node-sass`

Allows you to switch between the `legacy` and `modern` APIs. You can find more information [here](https://sass-lang.com/documentation/js-api). The `modern-compiler` option enables the modern API with support for [Shared Resources](https://github.com/sass/sass/blob/main/accepted/shared-resources.d.ts.md).

@@ -709,7 +711,7 @@ module.exports = {
{
loader: "sass-loader",
options: {
api: "modern",
api: "modern-compiler",
sassOptions: {
// Your sass options
},
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
const isNodeSassSupported = require("./test/helpers/is-node-sass-supported");

module.exports = {
testEnvironment: "jest-environment-node-single-context",
// eslint-disable-next-line no-undefined
snapshotResolver:
"<rootDir>/test/helpers/skip-node-sass-snapshot-resolver.js",
moduleNameMapper: isNodeSassSupported()
? {}
: {
// For Node.js@22, because `node-sass` doesn't support it
"^node-sass$": "sass",
},
};
Loading