From f8a71f4517926e1455ddb756a9166b2a87bfa968 Mon Sep 17 00:00:00 2001 From: Denys Kniazevych Date: Thu, 27 Dec 2018 11:07:41 +0100 Subject: [PATCH 1/3] fix: fixed a hash type extracting in interpolateName (#137) --- .gitignore | 1 + lib/interpolateName.js | 2 +- test/interpolateName.test.js | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ba2a97b..428a1df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +.idea node_modules coverage diff --git a/lib/interpolateName.js b/lib/interpolateName.js index 7aa69bc..cfe2ec0 100644 --- a/lib/interpolateName.js +++ b/lib/interpolateName.js @@ -91,7 +91,7 @@ function interpolateName(loaderContext, name, options) { // `hash` and `contenthash` are same in `loader-utils` context // let's keep `hash` for backward compatibility .replace( - /\[(?:([^:]+):)?(?:hash||contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi, + /\[(?:([^:\]]+):)?(?:hash||contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi, (all, hashType, digestType, maxLength) => getHashDigest(content, hashType, digestType, parseInt(maxLength, 10)) ) diff --git a/test/interpolateName.test.js b/test/interpolateName.test.js index 20df069..00c912d 100644 --- a/test/interpolateName.test.js +++ b/test/interpolateName.test.js @@ -100,6 +100,12 @@ describe('interpolateName()', () => { 'test content', 'js/filenameWithoutExt.bin', ], + [ + '/lib/components/modal/modal.css', + '[name]__modalTitle___[sha1:hash:hex:4]', + 'test content', + 'modal__modalTitle___1eeb', + ], ].forEach((test) => { it('should interpolate ' + test[0] + ' ' + test[1], () => { const interpolatedName = loaderUtils.interpolateName( From d69c3038370cbddd68a79a74aebdc50a79245626 Mon Sep 17 00:00:00 2001 From: Evilebot Tnawi Date: Thu, 27 Dec 2018 13:29:00 +0300 Subject: [PATCH 2/3] test: `interpolateName` util (#138) --- test/interpolateName.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/interpolateName.test.js b/test/interpolateName.test.js index 00c912d..05b59f7 100644 --- a/test/interpolateName.test.js +++ b/test/interpolateName.test.js @@ -106,6 +106,24 @@ describe('interpolateName()', () => { 'test content', 'modal__modalTitle___1eeb', ], + [ + '/lib/components/modal/modal.css', + '[name]__modalTitle___[sha1:contenthash:hex:4]', + 'test content', + 'modal__modalTitle___1eeb', + ], + [ + '/lib/components/modal/modal.css', + '[name].[md5:hash:base64:20].[ext]', + 'test content', + 'modal.1n8osQznuT8jOAwdzg_n.css', + ], + [ + '/lib/components/modal/modal.css', + '[name].[md5:contenthash:base64:20].[ext]', + 'test content', + 'modal.1n8osQznuT8jOAwdzg_n.css', + ], ].forEach((test) => { it('should interpolate ' + test[0] + ' ' + test[1], () => { const interpolatedName = loaderUtils.interpolateName( From 809b690c3b7fcb2e0947f014e86554d2ae1f3f03 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Thu, 27 Dec 2018 13:29:24 +0300 Subject: [PATCH 3/3] chore(release): 1.2.2 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fa1fd1..8b6c762 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ 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. + +## [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)) + + + ## [1.2.1](https://github.com/webpack/loader-utils/compare/v1.2.0...v1.2.1) (2018-12-25) diff --git a/package.json b/package.json index 98690a9..2a14883 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loader-utils", - "version": "1.2.1", + "version": "1.2.2", "author": "Tobias Koppers @sokra", "description": "utils for webpack loaders", "dependencies": { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy