Socket
Socket
Sign inDemoInstall

loader-utils

Package Overview
Dependencies
Maintainers
5
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loader-utils - npm Package Compare versions

Comparing version 1.2.3 to 1.3.0

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # 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)
### 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>

@@ -7,0 +17,0 @@ ## [1.2.3](https://github.com/webpack/loader-utils/compare/v1.2.2...v1.2.3) (2018-12-27)

14

lib/interpolateName.js

@@ -55,2 +55,3 @@ 'use strict';

let folder = '';
let query = '';

@@ -87,2 +88,12 @@ if (loaderContext.resourcePath) {

if (loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1) {
query = loaderContext.resourceQuery;
const hashIdx = query.indexOf('#');
if (hashIdx >= 0) {
query = query.substr(0, hashIdx);
}
}
let url = filename;

@@ -109,3 +120,4 @@

.replace(/\[path\]/gi, () => directory)
.replace(/\[folder\]/gi, () => folder);
.replace(/\[folder\]/gi, () => folder)
.replace(/\[query\]/gi, () => query);

@@ -112,0 +124,0 @@ if (regExp && loaderContext.resourcePath) {

6

package.json
{
"name": "loader-utils",
"version": "1.2.3",
"version": "1.3.0",
"author": "Tobias Koppers @sokra",

@@ -8,3 +8,3 @@ "description": "utils for webpack loaders",

"big.js": "^5.2.2",
"emojis-list": "^2.0.0",
"emojis-list": "^3.0.0",
"json5": "^1.0.1"

@@ -33,3 +33,3 @@ },

"jest": "^21.2.1",
"prettier": "^1.15.3",
"prettier": "^1.19.1",
"standard-version": "^4.0.0"

@@ -36,0 +36,0 @@ },

@@ -179,3 +179,4 @@ # loader-utils

* `[path]` the path of the resource relative to the `context` query parameter or option.
* `[folder]` the folder of the resource is in.
* `[folder]` the folder the resource is in
* `[query]` the queryof the resource, i.e. `?foo=bar`
* `[emoji]` a random emoji representation of `options.content`

@@ -205,2 +206,7 @@ * `[emoji:<length>]` same as above, but with a customizable number of emojis

// loaderContext.resourcePath = "/app/js/javascript.js"
// loaderContext.resourceQuery = "?foo=bar"
loaderUtils.interpolateName(loaderContext, "js/[hash].script.[ext][query]", { content: ... });
// => js/9473fdd0d880a43c21b7778d34872157.script.js?foo=bar
// loaderContext.resourcePath = "/app/js/javascript.js"
loaderUtils.interpolateName(loaderContext, "js/[contenthash].script.[ext]", { content: ... });

@@ -207,0 +213,0 @@ // => js/9473fdd0d880a43c21b7778d34872157.script.js

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc