@jsenv/file-size-impact 12.1.0 → 12.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/file-size-impact",
3
- "version": "12.1.0",
3
+ "version": "12.1.1",
4
4
  "description": "Add files size impact into pull requests",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  import { comparePathnames } from "@jsenv/filesystem"
2
2
 
3
- import { manifestToMappings } from "./manifest.js"
3
+ import { manifestToMappings, manifestKeyFromRelativeUrl } from "./manifest.js"
4
4
 
5
5
  export const compareTwoFileSizeReports = ({
6
6
  afterMergeFileSizeReport,
@@ -148,12 +148,6 @@ const compareTwoGroups = (beforeMergeGroup, afterMergeGroup) => {
148
148
  }
149
149
  }
150
150
 
151
- const manifestKeyFromRelativeUrl = (relativeUrl, mappings) => {
152
- return Object.keys(mappings).find((keyCandidate) => {
153
- return mappings[keyCandidate] === relativeUrl
154
- })
155
- }
156
-
157
151
  const sortFileStructure = (fileStructure) => {
158
152
  const relativeUrlSortedArray = Object.keys(fileStructure).sort(comparePathnames)
159
153
  const fileStructureSorted = {}
@@ -1,5 +1,5 @@
1
1
  import { formatSize } from "./formatSize.js"
2
- import { manifestToMappings } from "./manifest.js"
2
+ import { manifestToMappings, manifestKeyFromRelativeUrl } from "./manifest.js"
3
3
 
4
4
  export const formatFileSizeReportForLog = (fileSizeReport) => {
5
5
  const { groups } = fileSizeReport
@@ -9,7 +9,7 @@ export const formatFileSizeReportForLog = (fileSizeReport) => {
9
9
 
10
10
  const mappings = manifestToMappings(manifestMap)
11
11
  const fileMessages = Object.keys(fileMap).map((fileRelativeUrl) => {
12
- const fileDisplayed = mappings[fileRelativeUrl] || fileRelativeUrl
12
+ const fileDisplayed = manifestKeyFromRelativeUrl(fileRelativeUrl, mappings) || fileRelativeUrl
13
13
  const file = fileMap[fileRelativeUrl]
14
14
  const { sizeMap } = file
15
15
  const sizeNames = Object.keys(sizeMap)
@@ -24,3 +24,9 @@ export const manifestToMappings = (manifestMap) => {
24
24
  }
25
25
 
26
26
  const ABSTRACT_DIRECTORY_URL = "file:///directory/"
27
+
28
+ export const manifestKeyFromRelativeUrl = (relativeUrl, mappings) => {
29
+ return Object.keys(mappings).find((keyCandidate) => {
30
+ return mappings[keyCandidate] === relativeUrl
31
+ })
32
+ }