WIP: Reduce bundle duplication

This commit is contained in:
Michael B. Gale
2026-05-14 12:47:34 +01:00
parent 3d6ea97f26
commit 237b03b3c3
26 changed files with 31476 additions and 1046438 deletions
+4 -2
View File
@@ -65,14 +65,16 @@ const onEndPlugin = {
const context = await esbuild.context({
// Include upload-lib.ts as an entry point for use in testing environments.
entryPoints: globSync([
`${SRC_DIR}/*-action.ts`,
`${SRC_DIR}/*-action-post.ts`,
`${SRC_DIR}/*-entry.ts`,
// `${SRC_DIR}/*-action-post.ts`,
"src/entry-points.ts",
"src/upload-lib.ts",
]),
bundle: true,
format: "cjs",
outdir: OUT_DIR,
platform: "node",
external: ["./entry-points"],
plugins: [cleanPlugin, copyDefaultsPlugin, onEndPlugin],
target: ["node20"],
define: {
-129183
View File
File diff suppressed because one or more lines are too long
-96038
View File
File diff suppressed because one or more lines are too long
-88244
View File
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
-93006
View File
File diff suppressed because one or more lines are too long
+5
View File
@@ -0,0 +1,5 @@
"use strict";
// src/init-entry.ts
var import_entry_points = require("./entry-points");
void (0, import_entry_points.runInitAction)();
-87798
View File
File diff suppressed because one or more lines are too long
-89620
View File
File diff suppressed because one or more lines are too long
-127995
View File
File diff suppressed because one or more lines are too long
-105058
View File
File diff suppressed because one or more lines are too long
-128020
View File
File diff suppressed because one or more lines are too long
-94427
View File
File diff suppressed because one or more lines are too long
+1 -3
View File
@@ -20,7 +20,7 @@ import { EnvVar } from "./environment";
import { getActionsLogger } from "./logging";
import { checkGitHubVersionInRange, getErrorMessage } from "./util";
async function runWrapper() {
export async function runWrapper() {
// To capture errors appropriately, keep as much code within the try-catch as
// possible, and only use safe functions outside.
@@ -72,5 +72,3 @@ async function runWrapper() {
);
}
}
void runWrapper();
+1 -3
View File
@@ -527,7 +527,7 @@ async function run(startedAt: Date) {
const startedAt = new Date();
export const runPromise = run(startedAt);
async function runWrapper() {
export async function runWrapper() {
const logger = getActionsLogger();
try {
await runPromise;
@@ -542,5 +542,3 @@ async function runWrapper() {
}
await util.checkForTimeout();
}
void runWrapper();
+1 -3
View File
@@ -142,7 +142,7 @@ async function run(startedAt: Date) {
await sendCompletedStatusReport(config, logger, startedAt, languages ?? []);
}
async function runWrapper() {
export async function runWrapper() {
const startedAt = new Date();
const logger = getActionsLogger();
try {
@@ -157,5 +157,3 @@ async function runWrapper() {
);
}
}
void runWrapper();
+55
View File
@@ -0,0 +1,55 @@
import * as analyzeAction from "./analyze-action";
import * as autobuildAction from "./autobuild-action";
import * as initAction from "./init-action";
import * as resolveEnvironmentAction from "./resolve-environment-action";
import * as setupCodeqlAction from "./setup-codeql-action";
import * as startProxyAction from "./start-proxy-action";
import * as uploadSarifAction from "./upload-sarif-action";
import * as analyzePostAction from "./analyze-action-post";
import * as initPostAction from "./init-action-post";
import * as startProxyPostAction from "./start-proxy-action-post";
import * as uploadSarifPostAction from "./upload-sarif-action-post";
export async function runAnalyzeAction() {
void analyzeAction.runWrapper();
}
export async function runAutobuildAction() {
void autobuildAction.runWrapper();
}
export async function runInitAction() {
void initAction.runWrapper();
}
export async function runResolveEnvironmentAction() {
void resolveEnvironmentAction.runWrapper();
}
export async function runSetupCodeqlAction() {
void setupCodeqlAction.runWrapper();
}
export async function runStartProxyAction() {
void startProxyAction.runWrapper();
}
export async function runUploadSarifAction() {
void uploadSarifAction.runWrapper();
}
export async function runAnalyzePostAction() {
void analyzePostAction.runWrapper();
}
export async function runInitPostAction() {
void initPostAction.runWrapper();
}
export async function runStartProxyPostAction() {
void startProxyPostAction.runWrapper();
}
export async function runUploadSarifPostAction() {
void uploadSarifPostAction.runWrapper();
}
+1 -3
View File
@@ -207,7 +207,7 @@ function getJobStatusFromEnvironment(): JobStatus | undefined {
return undefined;
}
async function runWrapper() {
export async function runWrapper() {
const startedAt = new Date();
const logger = getActionsLogger();
try {
@@ -222,5 +222,3 @@ async function runWrapper() {
);
}
}
void runWrapper();
+1 -3
View File
@@ -880,7 +880,7 @@ async function recordZstdAvailability(
);
}
async function runWrapper() {
export async function runWrapper() {
const startedAt = new Date();
const logger = getActionsLogger();
try {
@@ -896,5 +896,3 @@ async function runWrapper() {
}
await checkForTimeout();
}
void runWrapper();
+3
View File
@@ -0,0 +1,3 @@
import { runInitAction } from "./entry-points";
void runInitAction();
+1 -3
View File
@@ -117,7 +117,7 @@ async function run(startedAt: Date) {
}
}
async function runWrapper() {
export async function runWrapper() {
const startedAt = new Date();
const logger = getActionsLogger();
try {
@@ -137,5 +137,3 @@ async function runWrapper() {
}
await checkForTimeout();
}
void runWrapper();
+1 -3
View File
@@ -196,7 +196,7 @@ async function run(startedAt: Date): Promise<void> {
}
/** Run the action and catch any unhandled errors. */
async function runWrapper(): Promise<void> {
export async function runWrapper(): Promise<void> {
const startedAt = new Date();
const logger = getActionsLogger();
try {
@@ -212,5 +212,3 @@ async function runWrapper(): Promise<void> {
}
await checkForTimeout();
}
void runWrapper();
+1 -3
View File
@@ -12,7 +12,7 @@ import { uploadArtifacts } from "./debug-artifacts";
import { getActionsLogger } from "./logging";
import { checkGitHubVersionInRange, getErrorMessage } from "./util";
async function runWrapper() {
export async function runWrapper() {
// To capture errors appropriately, keep as much code within the try-catch as
// possible, and only use safe functions outside.
@@ -62,5 +62,3 @@ async function runWrapper() {
);
}
}
void runWrapper();
+1 -3
View File
@@ -128,7 +128,7 @@ async function run(startedAt: Date) {
}
}
async function runWrapper() {
export async function runWrapper() {
const startedAt = new Date();
const logger = getActionsLogger();
@@ -204,5 +204,3 @@ async function startProxy(
return { host, port, cert: config.ca.cert, registries: registry_urls };
}
void runWrapper();
+1 -3
View File
@@ -12,7 +12,7 @@ import { EnvVar } from "./environment";
import { getActionsLogger, withGroup } from "./logging";
import { checkGitHubVersionInRange, getErrorMessage } from "./util";
async function runWrapper() {
export async function runWrapper() {
// To capture errors appropriately, keep as much code within the try-catch as
// possible, and only use safe functions outside.
@@ -48,5 +48,3 @@ async function runWrapper() {
);
}
}
void runWrapper();
+1 -3
View File
@@ -165,7 +165,7 @@ async function run(startedAt: Date) {
}
}
async function runWrapper() {
export async function runWrapper() {
const startedAt = new Date();
const logger = getActionsLogger();
try {
@@ -182,5 +182,3 @@ async function runWrapper() {
);
}
}
void runWrapper();