@jsenv/file-size-impact 14.1.0 → 14.1.2
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/bin/filesize.mjs +6 -6
- package/package.json +6 -6
- package/readme.md +31 -31
- package/src/brotliTransformation.js +7 -7
- package/src/generateFileSizeReport.js +58 -58
- package/src/gzipTransformation.js +7 -7
- package/src/internal/applyTrackingConfig.js +29 -29
- package/src/internal/compareTwoFileSizeReports.js +56 -52
- package/src/internal/formatComment.js +64 -58
- package/src/internal/formatFileSizeReportForLog.js +20 -19
- package/src/internal/formatSize.js +7 -7
- package/src/internal/format_percentage.js +3 -3
- package/src/internal/helper.js +5 -5
- package/src/internal/jsenvCommentParameters.js +38 -38
- package/src/internal/manifest.js +18 -18
- package/src/internal/orderBySizeImpact.js +15 -15
- package/src/internal/renderImpactTable.js +63 -63
- package/src/internal/size_map.js +28 -28
- package/src/jsenvTrackingConfig.js +1 -1
- package/src/main.js +7 -7
- package/src/rawTransformation.js +2 -2
- package/src/report_file_size_impact_in_github_pr.js +18 -18
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { assertAndNormalizeDirectoryUrl } from "@jsenv/filesystem"
|
|
2
|
-
import { commentGitHubPullRequestImpact } from "@jsenv/github-pull-request-impact"
|
|
3
|
-
import { importOneExportFromFile } from "@jsenv/dynamic-import-worker"
|
|
1
|
+
import { assertAndNormalizeDirectoryUrl } from "@jsenv/filesystem";
|
|
2
|
+
import { commentGitHubPullRequestImpact } from "@jsenv/github-pull-request-impact";
|
|
3
|
+
import { importOneExportFromFile } from "@jsenv/dynamic-import-worker";
|
|
4
4
|
|
|
5
|
-
import { formatComment } from "./internal/formatComment.js"
|
|
6
|
-
import { jsenvCommentParameters } from "./internal/jsenvCommentParameters.js"
|
|
5
|
+
import { formatComment } from "./internal/formatComment.js";
|
|
6
|
+
import { jsenvCommentParameters } from "./internal/jsenvCommentParameters.js";
|
|
7
7
|
|
|
8
8
|
export const reportFileSizeImpactInGitHubPullRequest = async ({
|
|
9
9
|
logLevel,
|
|
@@ -36,14 +36,14 @@ export const reportFileSizeImpactInGitHubPullRequest = async ({
|
|
|
36
36
|
runLink,
|
|
37
37
|
commitInGeneratedByInfo,
|
|
38
38
|
}) => {
|
|
39
|
-
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl)
|
|
39
|
+
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
|
|
40
40
|
if (fileSizeReportUrl === "string") {
|
|
41
|
-
fileSizeReportUrl = new URL(fileSizeReportUrl, rootDirectoryUrl).href
|
|
41
|
+
fileSizeReportUrl = new URL(fileSizeReportUrl, rootDirectoryUrl).href;
|
|
42
42
|
} else if (fileSizeReportUrl instanceof URL) {
|
|
43
43
|
} else {
|
|
44
44
|
throw new TypeError(
|
|
45
45
|
`fileSizeReportUrl must be a string or an url but received ${fileSizeReportUrl}`,
|
|
46
|
-
)
|
|
46
|
+
);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
if (installCommand === null) {
|
|
@@ -51,7 +51,7 @@ export const reportFileSizeImpactInGitHubPullRequest = async ({
|
|
|
51
51
|
} else if (typeof installCommand !== "string") {
|
|
52
52
|
throw new TypeError(
|
|
53
53
|
`installCommand must be a string but received ${installCommand}`,
|
|
54
|
-
)
|
|
54
|
+
);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
if (buildCommand === null) {
|
|
@@ -59,7 +59,7 @@ export const reportFileSizeImpactInGitHubPullRequest = async ({
|
|
|
59
59
|
} else if (typeof buildCommand !== "string") {
|
|
60
60
|
throw new TypeError(
|
|
61
61
|
`buildCommand must be a string but received ${buildCommand}`,
|
|
62
|
-
)
|
|
62
|
+
);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return commentGitHubPullRequestImpact({
|
|
@@ -75,10 +75,10 @@ export const reportFileSizeImpactInGitHubPullRequest = async ({
|
|
|
75
75
|
pullRequestNumber,
|
|
76
76
|
|
|
77
77
|
collectInfo: async ({ execCommandInRootDirectory }) => {
|
|
78
|
-
if (installCommand) await execCommandInRootDirectory(installCommand)
|
|
79
|
-
if (buildCommand) await execCommandInRootDirectory(buildCommand)
|
|
80
|
-
const fileSizeReport = await importOneExportFromFile(fileSizeReportUrl)
|
|
81
|
-
return { version: 1, data: fileSizeReport }
|
|
78
|
+
if (installCommand) await execCommandInRootDirectory(installCommand);
|
|
79
|
+
if (buildCommand) await execCommandInRootDirectory(buildCommand);
|
|
80
|
+
const fileSizeReport = await importOneExportFromFile(fileSizeReportUrl);
|
|
81
|
+
return { version: 1, data: fileSizeReport };
|
|
82
82
|
},
|
|
83
83
|
commentIdentifier: `<!-- Generated by @jsenv/file-size-impact -->`,
|
|
84
84
|
createCommentForComparison: ({
|
|
@@ -103,14 +103,14 @@ export const reportFileSizeImpactInGitHubPullRequest = async ({
|
|
|
103
103
|
formatFileSizeImpactCell,
|
|
104
104
|
formatEmojiCell,
|
|
105
105
|
shouldOpenGroupByDefault,
|
|
106
|
-
})
|
|
106
|
+
});
|
|
107
107
|
},
|
|
108
108
|
generatedByLink: {
|
|
109
|
-
url: "https://github.com/jsenv/workflow/tree/main/packages/
|
|
109
|
+
url: "https://github.com/jsenv/workflow/tree/main/packages/file-size-impact",
|
|
110
110
|
text: "@jsenv/file-size-impact",
|
|
111
111
|
},
|
|
112
112
|
runLink,
|
|
113
113
|
commitInGeneratedByInfo,
|
|
114
114
|
catchError,
|
|
115
|
-
})
|
|
116
|
-
}
|
|
115
|
+
});
|
|
116
|
+
};
|