Skip to content

Commit b2f7194

Browse files
test: update
1 parent e05a289 commit b2f7194

File tree

3 files changed

+168
-167
lines changed

3 files changed

+168
-167
lines changed

src/utils.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,8 @@ function defaultGetLocalIdent(
317317
localName,
318318
options
319319
) {
320-
const { context } = options;
320+
const { context, hashSalt } = options;
321321
const { resourcePath } = loaderContext;
322-
323322
const relativeResourcePath = normalizePath(
324323
path.relative(context, resourcePath)
325324
);
@@ -350,6 +349,7 @@ function defaultGetLocalIdent(
350349
}
351350

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

361361
const tierSalt = Buffer.allocUnsafe(4);
362+
362363
tierSalt.writeUInt32LE(tier);
363-
hash.update(tierSalt);
364364

365+
hash.update(tierSalt);
365366
hash.update(options.content);
366367

367368
localIdentHash = (localIdentHash + hash.digest(hashDigest))

test/__snapshots__/loader.test.js.snap

+15-15
Original file line numberDiff line numberDiff line change
@@ -849,66 +849,66 @@ exports[`loader should work with inline module syntax: result 1`] = `
849849
Array [
850850
Array [
851851
"other.modules.css!=!../../src/index.js??ruleSet[1].rules[0].rules[0]!../../node_modules/sass-loader/dist/cjs.js!./index-loader-syntax.modules.css",
852-
".cvQZFnfbeskbGiTlpe_P {
852+
".L34UCpsDMDUf5cci5FTp {
853853
color: red;
854854
}
855855
856-
.IB7LbbTxdNwrVPxtK0wC {
856+
.cR0dzE36E911coHAsfAF {
857857
color: white;
858858
}",
859859
"",
860860
],
861861
Array [
862862
"button.modules.css!=!./index-loader-syntax-sass.css",
863-
".rZ5eCb_mQRy7Svv7Z30B {
863+
".Bm6FV6LbXUxAkIaBjl7y {
864864
width: 5px;
865865
}",
866866
"",
867867
],
868868
Array [
869869
"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",
870-
".jLbxv4bqH2U20AlFuk92 > .ob3rZ9N1zVzUcOOazzYy {
870+
".JkECLtXaeLgZptjLMVOV > .cg9Qb_Gz48g_sQh4Pjap {
871871
color: red;
872872
}",
873873
"",
874874
],
875875
Array [
876876
"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",
877-
".cvQZFnfbeskbGiTlpe_P {
877+
".L34UCpsDMDUf5cci5FTp {
878878
color: red;
879879
}
880880
881-
.IB7LbbTxdNwrVPxtK0wC {
881+
.cR0dzE36E911coHAsfAF {
882882
color: white;
883883
}
884884
885-
.x0ncp2H8kJ59binDkEa9 {
885+
.BBGEY4nuDapXZ5Z5Llcd {
886886
from: custom;
887887
}",
888888
"",
889889
],
890890
Array [
891891
"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",
892-
".cvQZFnfbeskbGiTlpe_P {
892+
".L34UCpsDMDUf5cci5FTp {
893893
color: red;
894894
}
895895
896-
.IB7LbbTxdNwrVPxtK0wC {
896+
.cR0dzE36E911coHAsfAF {
897897
color: white;
898898
}
899899
900-
.x0ncp2H8kJ59binDkEa9 {
900+
.BBGEY4nuDapXZ5Z5Llcd {
901901
from: custom;
902902
}",
903903
"",
904904
],
905905
Array [
906906
"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",
907-
".jLbxv4bqH2U20AlFuk92 > .ob3rZ9N1zVzUcOOazzYy {
907+
".JkECLtXaeLgZptjLMVOV > .cg9Qb_Gz48g_sQh4Pjap {
908908
color: red;
909909
}
910910
911-
.yx69bmS9wijyDV84NXI9 {
911+
.WJ9UGZwK6YvLQsxARKO1 {
912912
from: custom;
913913
}",
914914
"",
@@ -922,21 +922,21 @@ Array [
922922
],
923923
Array [
924924
"button.modules.css!=!./index-loader-syntax-sass.css",
925-
".rZ5eCb_mQRy7Svv7Z30B {
925+
".Bm6FV6LbXUxAkIaBjl7y {
926926
width: 5px;
927927
}",
928928
"",
929929
],
930930
Array [
931931
"button.module.scss!=!./base64-loader/index.js?LmZvbyB7IGNvbG9yOiByZWQ7IH0=!./simple.js?foo=bar",
932-
".y2EgZjTXV61h0Dgjp49t {
932+
".nQ7qpE_fxjuYDsViKqtM {
933933
color: red;
934934
}",
935935
"",
936936
],
937937
Array [
938938
"other.module.scss!=!./base64-loader/index.js?LmZvbyB7IGNvbG9yOiByZWQ7IH0=!./simple.js?foo=baz",
939-
".PTgI00lRDqe1Y8cb5zcw {
939+
".nQ7qpE_fxjuYDsViKqtM {
940940
color: red;
941941
}",
942942
"",

0 commit comments

Comments
 (0)