mirror of
https://github.com/github/codeql-action.git
synced 2026-05-17 08:40:16 +00:00
WIP: Reduce bundle duplication
This commit is contained in:
@@ -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: {
|
||||
|
||||
Generated
-129183
File diff suppressed because one or more lines are too long
Generated
-96038
File diff suppressed because one or more lines are too long
Generated
-88244
File diff suppressed because one or more lines are too long
+31398
-7014
File diff suppressed because it is too large
Load Diff
Generated
-93006
File diff suppressed because one or more lines are too long
Generated
+5
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
// src/init-entry.ts
|
||||
var import_entry_points = require("./entry-points");
|
||||
void (0, import_entry_points.runInitAction)();
|
||||
Generated
-87798
File diff suppressed because one or more lines are too long
Generated
-89620
File diff suppressed because one or more lines are too long
Generated
-127995
File diff suppressed because one or more lines are too long
Generated
-105058
File diff suppressed because one or more lines are too long
Generated
-128020
File diff suppressed because one or more lines are too long
Generated
-94427
File diff suppressed because one or more lines are too long
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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
@@ -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();
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import { runInitAction } from "./entry-points";
|
||||
|
||||
void runInitAction();
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user