From 3528fd961c6be08e587fd577e2d9996e27e436f4 Mon Sep 17 00:00:00 2001 From: Evilebot Tnawi Date: Thu, 27 Dec 2018 15:21:34 +0300 Subject: [PATCH 1/2] fix(interpolateName): don't interpolated `hashType` without `hash` or `contenthash` (#140) --- lib/interpolateName.js | 2 +- test/interpolateName.test.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/interpolateName.js b/lib/interpolateName.js index cfe2ec0..d1fa661 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 05b59f7..e57443a 100644 --- a/test/interpolateName.test.js +++ b/test/interpolateName.test.js @@ -124,6 +124,13 @@ describe('interpolateName()', () => { 'test content', 'modal.1n8osQznuT8jOAwdzg_n.css', ], + // Should not interpret without `hash` or `contenthash` + [ + '/lib/components/modal/modal.css', + '[name].[md5::base64:20].[ext]', + 'test content', + 'modal.[md5::base64:20].css', + ], ].forEach((test) => { it('should interpolate ' + test[0] + ' ' + test[1], () => { const interpolatedName = loaderUtils.interpolateName( From b91a76c0c98bf71df5a3a1c808ea86268c3716c1 Mon Sep 17 00:00:00 2001 From: evilebottnawi Date: Thu, 27 Dec 2018 15:22:06 +0300 Subject: [PATCH 2/2] chore(release): 1.2.3 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b6c762..500dd11 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.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)) + + + ## [1.2.2](https://github.com/webpack/loader-utils/compare/v1.2.1...v1.2.2) (2018-12-27) diff --git a/package.json b/package.json index 2a14883..30cc93c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loader-utils", - "version": "1.2.2", + "version": "1.2.3", "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