Skip to content

Commit

Permalink
test: update
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Oct 9, 2021
1 parent e05a289 commit b2f7194
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 167 deletions.
7 changes: 4 additions & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,8 @@ function defaultGetLocalIdent(
localName,
options
) {
const { context } = options;
const { context, hashSalt } = options;
const { resourcePath } = loaderContext;

const relativeResourcePath = normalizePath(
path.relative(context, resourcePath)
);
Expand Down Expand Up @@ -350,6 +349,7 @@ function defaultGetLocalIdent(
}

let localIdentHash = "";

for (let tier = 0; localIdentHash.length < hashDigestLength; tier++) {
// eslint-disable-next-line no-underscore-dangle
const hash = loaderContext._compiler.webpack.util.createHash(hashFunction);
Expand All @@ -359,9 +359,10 @@ function defaultGetLocalIdent(
}

const tierSalt = Buffer.allocUnsafe(4);

tierSalt.writeUInt32LE(tier);
hash.update(tierSalt);

hash.update(tierSalt);
hash.update(options.content);

localIdentHash = (localIdentHash + hash.digest(hashDigest))
Expand Down
30 changes: 15 additions & 15 deletions test/__snapshots__/loader.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -849,66 +849,66 @@ exports[`loader should work with inline module syntax: result 1`] = `
Array [
Array [
"other.modules.css!=!../../src/index.js??ruleSet[1].rules[0].rules[0]!../../node_modules/sass-loader/dist/cjs.js!./index-loader-syntax.modules.css",
".cvQZFnfbeskbGiTlpe_P {
".L34UCpsDMDUf5cci5FTp {
color: red;
}
.IB7LbbTxdNwrVPxtK0wC {
.cR0dzE36E911coHAsfAF {
color: white;
}",
"",
],
Array [
"button.modules.css!=!./index-loader-syntax-sass.css",
".rZ5eCb_mQRy7Svv7Z30B {
".Bm6FV6LbXUxAkIaBjl7y {
width: 5px;
}",
"",
],
Array [
"other.modules.scss!=!../../src/index.js??ruleSet[1].rules[0].rules[0]!../../node_modules/sass-loader/dist/cjs.js!./index-loader-syntax-sass.modules.css",
".jLbxv4bqH2U20AlFuk92 > .ob3rZ9N1zVzUcOOazzYy {
".JkECLtXaeLgZptjLMVOV > .cg9Qb_Gz48g_sQh4Pjap {
color: red;
}",
"",
],
Array [
"other.modules.css!=!../../src/index.js??ruleSet[1].rules[0].rules[0]!../../node_modules/sass-loader/dist/cjs.js!./my-inline-loader/index.js!./index-loader-syntax.modules.css",
".cvQZFnfbeskbGiTlpe_P {
".L34UCpsDMDUf5cci5FTp {
color: red;
}
.IB7LbbTxdNwrVPxtK0wC {
.cR0dzE36E911coHAsfAF {
color: white;
}
.x0ncp2H8kJ59binDkEa9 {
.BBGEY4nuDapXZ5Z5Llcd {
from: custom;
}",
"",
],
Array [
"other.modules.css!=!../../src/index.js??ruleSet[1].rules[0].rules[0]!../../node_modules/sass-loader/dist/cjs.js!./my-inline-loader/index.js!./index-loader-syntax.modules.css",
".cvQZFnfbeskbGiTlpe_P {
".L34UCpsDMDUf5cci5FTp {
color: red;
}
.IB7LbbTxdNwrVPxtK0wC {
.cR0dzE36E911coHAsfAF {
color: white;
}
.x0ncp2H8kJ59binDkEa9 {
.BBGEY4nuDapXZ5Z5Llcd {
from: custom;
}",
"",
],
Array [
"other.modules.scss!=!../../src/index.js??ruleSet[1].rules[0].rules[0]!../../node_modules/sass-loader/dist/cjs.js!./my-inline-loader/index.js!./index-loader-syntax-sass.modules.css",
".jLbxv4bqH2U20AlFuk92 > .ob3rZ9N1zVzUcOOazzYy {
".JkECLtXaeLgZptjLMVOV > .cg9Qb_Gz48g_sQh4Pjap {
color: red;
}
.yx69bmS9wijyDV84NXI9 {
.WJ9UGZwK6YvLQsxARKO1 {
from: custom;
}",
"",
Expand All @@ -922,21 +922,21 @@ Array [
],
Array [
"button.modules.css!=!./index-loader-syntax-sass.css",
".rZ5eCb_mQRy7Svv7Z30B {
".Bm6FV6LbXUxAkIaBjl7y {
width: 5px;
}",
"",
],
Array [
"button.module.scss!=!./base64-loader/index.js?LmZvbyB7IGNvbG9yOiByZWQ7IH0=!./simple.js?foo=bar",
".y2EgZjTXV61h0Dgjp49t {
".nQ7qpE_fxjuYDsViKqtM {
color: red;
}",
"",
],
Array [
"other.module.scss!=!./base64-loader/index.js?LmZvbyB7IGNvbG9yOiByZWQ7IH0=!./simple.js?foo=baz",
".PTgI00lRDqe1Y8cb5zcw {
".nQ7qpE_fxjuYDsViKqtM {
color: red;
}",
"",
Expand Down

0 comments on commit b2f7194

Please sign in to comment.