Skip to content

Commit

Permalink
fix double __unstable_uniqueWithLocations in fontfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart Veneman committed Dec 30, 2023
1 parent 9c23fd8 commit 43bf157
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 46 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@projectwallace/css-analyzer",
"version": "5.12.2",
"version": "5.13.0",
"author": "Bart Veneman",
"repository": {
"type": "git",
Expand Down
72 changes: 30 additions & 42 deletions src/atrules/atrules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,48 +301,36 @@ AtRules('finds @font-face', () => {
useUnstableLocations: true
}).atrules.fontface.__unstable_uniqueWithLocations
const expected = {
total: 5,
totalUnique: 5,
unique: {
5: 1,
100: 1,
463: 1,
590: 1,
850: 1,
},
__unstable__uniqueWithLocations: {
5: [{
line: 2,
column: 5,
offset: 5,
length: 89,
}],
100: [{
line: 7,
column: 5,
offset: 100,
length: 357,
}],
463: [{
line: 20,
column: 5,
offset: 463,
length: 121,
}],
590: [{
line: 25,
column: 5,
offset: 590,
length: 173,
}],
850: [{
line: 33,
column: 7,
offset: 850,
length: 127,
}],
},
uniquenessRatio: 1
5: [{
line: 2,
column: 5,
offset: 5,
length: 89,
}],
100: [{
line: 7,
column: 5,
offset: 100,
length: 357,
}],
463: [{
line: 20,
column: 5,
offset: 463,
length: 121,
}],
590: [{
line: 25,
column: 5,
offset: 590,
length: 173,
}],
850: [{
line: 33,
column: 7,
offset: 850,
length: 127,
}],
}

assert.equal(actual, expected)
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ export function analyze(css, options = {}) {
unique: fontfaces,
uniquenessRatio: fontFacesCount === 0 ? 0 : 1,
}, useLocations ? {
__unstable_uniqueWithLocations: fontfaces_with_loc.c(),
__unstable_uniqueWithLocations: fontfaces_with_loc.c().__unstable__uniqueWithLocations,
} : {}),
import: imports.c(),
media: assign(
Expand Down

0 comments on commit 43bf157

Please sign in to comment.