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/loader-utils
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a5602addda0c5e98e70d067b8dd050d5e4153f1d
Choose a base ref
...
head repository: webpack/loader-utils
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7162619fb982c394ed75098a0a0ed7e7f3177c70
Choose a head ref

Commits on Mar 16, 2017

  1. chore(CHANGELOG.md): Clean up

    jhnns committed Mar 16, 2017
    Copy the full SHA
    07aea65 View commit details

Commits on Mar 21, 2017

  1. Update README

    Replace clone-deep with clone since clone-deep does not copy properties from the prototype chain. This can be a problem with plugin instances, see webpack-contrib/less-loader#181 (comment)
    jhnns authored Mar 21, 2017
    Copy the full SHA
    52fbc35 View commit details

Commits on Mar 24, 2017

  1. fix: Empty urls are not rewritten to relative requests

    Prior to this commit, `urlToRequest` rewrote an empty URL `''` to `'./'` which is correct from a theoretical point of view since CSS files do not distinguish between relative paths starting with ./ or not (like CommonJS does). However, an empty URL is most likely an error which webpack should warn about. If we rewrite the empty string to ./, webpack won't warn against this anymore because requiring ./ is valid.
    
    Related discussion: #80
    darrenscerri authored and jhnns committed Mar 24, 2017
    Copy the full SHA
    0f6cb90 View commit details
  2. fix: Do not rewrite actual URLs that start with http://, https:// or …

    …just //
    
    Prior to this commit, an actual URL starting with a protocol like`https://` would have been rewritten to `./https://` which is clearly undesired. Although webpack can't resolve remote module requests anyway (those starting with http:// and such) and thus will throw an error, it is still correct to leave these kind of URLs untouched by the loader-utils.
    
    Related discussion: #79
    japgolly authored and jhnns committed Mar 24, 2017
    Copy the full SHA
    fface50 View commit details

Commits on Jun 27, 2017

  1. Have a violent reaction when out of emoji

    Failing explicitly is better than silently starting to return empty strings.
    asmundg committed Jun 27, 2017
    Copy the full SHA
    298ecfe View commit details

Commits on Jun 28, 2017

  1. Copy the full SHA
    4ac2bab View commit details

Commits on Jun 30, 2017

  1. Linter cleanup

    asmundg committed Jun 30, 2017
    Copy the full SHA
    22b6213 View commit details

Commits on Jul 10, 2017

  1. Copy the full SHA
    3027175 View commit details
  2. Copy the full SHA
    0ad430a View commit details
  3. Fixes nitpick formatting

    rsms committed Jul 10, 2017
    Copy the full SHA
    3cd3889 View commit details

Commits on Aug 30, 2017

  1. Fix demonstrated usage of Object.assign in README

    What the current README suggests would override provided options with the default options:
    
    ```js
    Object.assign({}, {option: "provided"}, {option: "someDefault"}) // => {option: "someDefault"}
    ```
    
    I imagine this is the opposite of what was intended.
    
    BTW, thanks for Webpack! I love it.
    zacharyvoase authored Aug 30, 2017
    Copy the full SHA
    c12aa6f View commit details

Commits on Sep 22, 2017

  1. Fix URLs for web extension protocols for edge and firefox wrongly det…

    …ected as requests
    Guillaume Flandre committed Sep 22, 2017
    Copy the full SHA
    d8a9bdc View commit details

Commits on Sep 28, 2017

  1. Copy the full SHA
    eb641cc View commit details

Commits on Oct 20, 2017

  1. Merge pull request #91 from asmundg/explode-when-out-of-emoji

    Have a violent reaction when out of emoji
    sokra authored Oct 20, 2017
    Copy the full SHA
    8b7834a View commit details
  2. Merge pull request #100 from embrace-io/master

    Parse string for emoji count before use.
    sokra authored Oct 20, 2017
    Copy the full SHA
    a18d1a4 View commit details
  3. Merge pull request #98 from gflandre/fix-web-extensions-protocols

    Fix URLs for web extension protocols for edge and firefox wrongly detected as requests
    sokra authored Oct 20, 2017
    Copy the full SHA
    5f11a9f View commit details
  4. Merge pull request #96 from zacharyvoase/patch-1

    Fix demonstrated usage of Object.assign in README
    sokra authored Oct 20, 2017
    Copy the full SHA
    5854d87 View commit details
  5. Merge pull request #94 from rsms/fix-hash-regex

    Fixes "[hash]" token regex in interpolateString to capture any hash algorithm name
    sokra authored Oct 20, 2017
    Copy the full SHA
    67499ff View commit details

Commits on Dec 21, 2018

  1. Copy the full SHA
    083187a View commit details
  2. Copy the full SHA
    822f518 View commit details
  3. Copy the full SHA
    dd9326b View commit details
  4. Copy the full SHA
    47e2e02 View commit details
  5. Copy the full SHA
    ac05880 View commit details
  6. Copy the full SHA
    ad3c359 View commit details
  7. ci: test on windows

    alexander-akait committed Dec 21, 2018
    Copy the full SHA
    7485ded View commit details
  8. ci: test on windows

    evilebottnawi authored Dec 21, 2018
    Copy the full SHA
    6fb379f View commit details

Commits on Dec 24, 2018

  1. Copy the full SHA
    6982934 View commit details
  2. Copy the full SHA
    3b6b8ff View commit details
  3. Copy the full SHA
    ad3a6b2 View commit details
  4. Copy the full SHA
    db92b11 View commit details
  5. chore(deps): update

    alexander-akait committed Dec 24, 2018
    Copy the full SHA
    914c09f View commit details
  6. chore(deps): update

    evilebottnawi authored Dec 24, 2018
    Copy the full SHA
    0f2b227 View commit details
  7. Copy the full SHA
    3a854ba View commit details
  8. Copy the full SHA
    c17d9cd View commit details
  9. test: more (#132)

    evilebottnawi authored Dec 24, 2018
    Copy the full SHA
    c5c7322 View commit details
  10. Copy the full SHA
    ba4f0d0 View commit details

Commits on Dec 25, 2018

  1. Copy the full SHA
    aca43da View commit details
  2. revert: PR #79 (#135)

    You need run `isUrlRequest` before run `urlToRequest`.
    evilebottnawi authored Dec 25, 2018
    Copy the full SHA
    73d350a View commit details
  3. chore(release): 1.2.1

    alexander-akait committed Dec 25, 2018
    Copy the full SHA
    489ef12 View commit details

Commits on Dec 27, 2018

  1. Copy the full SHA
    f8a71f4 View commit details
  2. Copy the full SHA
    d69c303 View commit details
  3. chore(release): 1.2.2

    alexander-akait committed Dec 27, 2018
    Copy the full SHA
    809b690 View commit details
  4. Copy the full SHA
    3528fd9 View commit details
  5. chore(release): 1.2.3

    alexander-akait committed Dec 27, 2018
    Copy the full SHA
    b91a76c View commit details

Commits on Mar 11, 2019

  1. docs: small grammar change (#144)

    craigdanj authored and evilebottnawi committed Mar 11, 2019
    Copy the full SHA
    7970c48 View commit details

Commits on Apr 24, 2019

  1. Set up CI with Azure Pipelines

    [skip ci]
    evilebottnawi committed Apr 24, 2019
    Copy the full SHA
    b5b74f0 View commit details

Commits on Feb 19, 2020

  1. Copy the full SHA
    909c99d View commit details
  2. Copy the full SHA
    469eeba View commit details
  3. chore(release): 1.3.0

    alexander-akait committed Feb 19, 2020
    Copy the full SHA
    06d36cf View commit details
  4. 1
    Copy the full SHA
    cd0e428 View commit details
15 changes: 4 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
root = true

[*]
indent_style = tab
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 233

[*.json]
indent_style = space
indent_size = 2

[*.yml]
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[test/cases/parsing/bom/bomfile.{css,js}]
charset = utf-8-bom

[*.md]
insert_final_newline = true
trim_trailing_whitespace = false
84 changes: 30 additions & 54 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,56 +1,32 @@
{
"root": true,
"plugins": ["node"],
"extends": ["eslint:recommended", "plugin:node/recommended"],
"env": {
"node": true
},
"rules": {
"quotes": ["error", "double"],
"no-undef": "error",
"no-extra-semi": "error",
"semi": "error",
"no-template-curly-in-string": "error",
"no-caller": "error",
"yoda": "error",
"eqeqeq": "error",
"global-require": "off",
"brace-style": "error",
"eol-last": "error",
"indent": ["error", "tab", { "SwitchCase": 1 }],
"no-extra-bind": "warn",
"no-empty": "off",
"no-multiple-empty-lines": "error",
"no-multi-spaces": "error",
"no-process-exit": "warn",
"space-in-parens": "error",
"no-trailing-spaces": "error",
"no-use-before-define": "off",
"no-unused-vars": ["error", {"args": "none"}],
"key-spacing": "error",
"space-infix-ops": "error",
"no-unsafe-negation": "error",
"no-loop-func": "warn",
"space-before-function-paren": ["error", "never"],
"space-before-blocks": "error",
"object-curly-spacing": ["error", "always"],
"keyword-spacing": ["error", {
"after": false,
"overrides": {
"try": {"after": true},
"else": {"after": true},
"throw": {"after": true},
"case": {"after": true},
"return": {"after": true},
"finally": {"after": true},
"do": {"after": true}
}
}],
"no-console": "off",
"valid-jsdoc": "error",
"no-var": "error",
"prefer-const": "error",
"prefer-arrow-callback": "error",
"object-shorthand": "error"
}
"root": true,
"plugins": ["node", "prettier"],
"extends": ["eslint:recommended", "plugin:node/recommended"],
"env": {
"node": true
},
"rules": {
"no-template-curly-in-string": "error",
"no-caller": "error",
"yoda": "error",
"eqeqeq": "error",
"no-extra-bind": "error",
"no-process-exit": "error",
"no-loop-func": "error",
"no-console": "off",
"valid-jsdoc": "error",
"no-var": "error",
"prefer-const": "error",
"prefer-arrow-callback": "error",
"object-shorthand": "error",

"prettier/prettier": [
"error",
{
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "always"
}
]
}
}
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
open_collective: webpack
82 changes: 82 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: loader-utils

on:
push:
branches:
- master
- next
pull_request:
branches:
- master
- next

jobs:
lint:
name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }}

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

strategy:
matrix:
os: [ubuntu-latest]
node-version: [12.x]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn

- name: Lint
run: yarn lint

- name: Security audit
run: yarn audit

- name: Check commit message
uses: wagoid/commitlint-github-action@v4

test:
name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [8.x, 10.x, 12.x, 14.x, 16.x, 17.x]

runs-on: ${{ matrix.os }}

steps:
- name: Setup Git
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf input

- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn

- name: Run tests
run: yarn test

- name: Submit coverage data to codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
node_modules
coverage
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "always"
}
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

113 changes: 106 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,117 @@
# Change Log
# Changelog

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.

<a name="1.1.0"></a>
# [1.1.0](https://github.com/webpack/loader-utils/compare/v1.0.4...v1.1.0) (2017-03-16)
### [2.0.3](https://github.com/webpack/loader-utils/compare/v2.0.1...v2.0.3) (2022-10-20)


### Bug Fixes

* **security:** prototype pollution exploit ([#217](https://github.com/webpack/loader-utils/issues/217)) ([a93cf6f](https://github.com/webpack/loader-utils/commit/a93cf6f4702012030f6b5ee8340d5c95ec1c7d4c))

### [2.0.2](https://github.com/webpack/loader-utils/compare/v2.0.1...v2.0.2) (2021-11-04)


### Bug Fixes

* base64 generation and unicode characters ([#197](https://github.com/webpack/loader-utils/issues/197)) ([8c2d24e](https://github.com/webpack/loader-utils/commit/8c2d24ee400bc4567335e97ee6004c3baa6ef66f))

### [2.0.1](https://github.com/webpack/loader-utils/compare/v2.0.0...v2.0.1) (2021-10-29)


### Bug Fixes

* md4 support on Node.js v17 ([#193](https://github.com/webpack/loader-utils/issues/193)) ([1069f61](https://github.com/webpack/loader-utils/commit/1069f61284a571614ee4acdde6e6087174be118a))

## [2.0.0](https://github.com/webpack/loader-utils/compare/v1.4.0...v2.0.0) (2020-03-17)


### ⚠ BREAKING CHANGES

* minimum required `Node.js` version is `8.9.0` ([#166](https://github.com/webpack/loader-utils/issues/166)) ([c937e8c](https://github.com/webpack/loader-utils/commit/c937e8c77231b42018be616b784a6b45eac86f8a))
* the `getOptions` method returns empty object on empty query ([#167](https://github.com/webpack/loader-utils/issues/167)) ([b595cfb](https://github.com/webpack/loader-utils/commit/b595cfba022d3f04f3d310dd570b0253e461605b))
* Use `md4` by default

<a name="1.4.0"></a>
# [1.4.0](https://github.com/webpack/loader-utils/compare/v1.3.0...v1.4.0) (2020-02-19)


### Features

* **automatic-release:** Generation of automatic release ([7484d13](https://github.com/webpack/loader-utils/commit/7484d13))
* **parseQuery:** export parseQuery ([ddf64e4](https://github.com/webpack/loader-utils/commit/ddf64e4))
* the `resourceQuery` is passed to the `interpolateName` method ([#163](https://github.com/webpack/loader-utils/issues/163)) ([cd0e428](https://github.com/webpack/loader-utils/commit/cd0e428))



# Change Log
<a name="1.3.0"></a>
# [1.3.0](https://github.com/webpack/loader-utils/compare/v1.2.3...v1.3.0) (2020-02-19)

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.

### Features

* support the `[query]` template for the `interpolatedName` method ([#162](https://github.com/webpack/loader-utils/issues/162)) ([469eeba](https://github.com/webpack/loader-utils/commit/469eeba))



<a name="1.2.3"></a>
## [1.2.3](https://github.com/webpack/loader-utils/compare/v1.2.2...v1.2.3) (2018-12-27)


### Bug Fixes

* **interpolateName:** don't interpolated `hashType` without `hash` or `contenthash` ([#140](https://github.com/webpack/loader-utils/issues/140)) ([3528fd9](https://github.com/webpack/loader-utils/commit/3528fd9))



<a name="1.2.2"></a>
## [1.2.2](https://github.com/webpack/loader-utils/compare/v1.2.1...v1.2.2) (2018-12-27)


### Bug Fixes

* fixed a hash type extracting in interpolateName ([#137](https://github.com/webpack/loader-utils/issues/137)) ([f8a71f4](https://github.com/webpack/loader-utils/commit/f8a71f4))



<a name="1.2.1"></a>
## [1.2.1](https://github.com/webpack/loader-utils/compare/v1.2.0...v1.2.1) (2018-12-25)


### Bug Fixes

* **isUrlRequest:** better handle absolute urls and non standards ([#134](https://github.com/webpack/loader-utils/issues/134)) ([aca43da](https://github.com/webpack/loader-utils/commit/aca43da))


### Reverts

* PR [#79](https://github.com/webpack/loader-utils/issues/79) ([#135](https://github.com/webpack/loader-utils/issues/135)) ([73d350a](https://github.com/webpack/loader-utils/commit/73d350a))



<a name="1.2.0"></a>
# [1.2.0](https://github.com/webpack/loader-utils/compare/v1.1.0...v1.2.0) (2018-12-24)


### Features

* **interpolateName:** support `[contenthash]`

### Fixes

* **urlToRequest:** empty urls are not rewritten to relative requests
* **urlToRequest:** don't rewrite absolute urls
* **isUrlRequest:** ignore all url with `extension` (like `moz-extension:`, `ms-browser-extension:` and etc)
* **isUrlRequest:** ignore `about:blank`
* **interpolateName:** failing explicitly when ran out of emoji
* **interpolateName:** `[hash]` token regex in interpolate string to capture any hash algorithm name
* **interpolateName:** parse string for emoji count before use



<a name="1.1.0"></a>
# [1.1.0](https://github.com/webpack/loader-utils/compare/v1.0.4...v1.1.0) (2017-03-16)


### Features

* **automatic-release:** Generation of automatic release ([7484d13](https://github.com/webpack/loader-utils/commit/7484d13))
* **parseQuery:** export parseQuery ([ddf64e4](https://github.com/webpack/loader-utils/commit/ddf64e4))
Loading