FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use `tsc` output for `esbuild` by mbg · Pull Request #4253 · github/codeql-action · GitHub

Repository navigation

Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .js  (13) .json  (1) .mjs  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
13 changes: 7 additions & 6 deletions build.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const SRC_DIR = join(__dirname, "src");
const BUILD_DIR = join(__dirname, "build");
const OUT_DIR = join(__dirname, "lib");

/**
Expand Down Expand Up @@ -69,7 +70,7 @@ const SHARED_ENTRYPOINT = "entry-points";
const UPLOAD_LIB_EXPORT = "uploadLib";

/** The relative source path of the `upload-lib` module that we re-export from `entry-points`. */
const UPLOAD_LIB_SRC = "./src/upload-lib";
const UPLOAD_LIB_SRC = "./build/upload-lib.js";

/**
* This plugin finds all source files that contain Action entry points. It then generates the
Expand All @@ -95,7 +96,7 @@ const entryPointsPlugin = {

// Find the source files containing Action entry points.
build.onStart(() => {
const actionFiles = globSync("src/*-action{,-post}.ts");
const actionFiles = globSync(join(BUILD_DIR, "*-action{,-post}.js"));
for (const actionFile of actionFiles) {
const match = basename(actionFile).match(/(.*)-action(-post)?/);

Expand Down Expand Up @@ -137,7 +138,7 @@ const entryPointsPlugin = {
const imports = actionsSorted
.map(
(action) =>
`import * as ${action.pascalCaseName} from "./src/${basename(action.path)}";`,
`import * as ${action.pascalCaseName} from "./build/${basename(action.path)}";`,
)
.join("\n");
const wrappers = actionsSorted
Expand All @@ -153,14 +154,14 @@ const entryPointsPlugin = {
return {
contents: `"use strict";\n${imports}\n\n${uploadLibReExport}\n\n${wrappers}\n`,
resolveDir: ".",
loader: "ts",
loader: "js",
};
});

// Emit entry point stubs for each Action using the entry template.
build.onEnd(async () => {
const makeHeader = (templatePath, sourceFile) =>
`// Automatically generated from '${templatePath}' for 'src/${basename(sourceFile)}'.\n\n`;
`// Automatically generated from '${templatePath}' for 'build/${basename(sourceFile)}'.\n\n`;

// Read the entry point template.
const actionTemplatePath = "action-entry.js.tpl";
Expand Down Expand Up @@ -191,7 +192,7 @@ const entryPointsPlugin = {
);
await writeFile(
join(OUT_DIR, "upload-lib.js"),
makeHeader(uploadLibStubTemplatePath, `${UPLOAD_LIB_SRC}.ts`) +
makeHeader(uploadLibStubTemplatePath, `${UPLOAD_LIB_SRC}`) +
uploadLibStubTemplate.replaceAll(
"__UPLOAD_LIB_EXPORT__",
UPLOAD_LIB_EXPORT,
Expand Down
2 changes: 1 addition & 1 deletion lib/analyze-entry.js

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

2 changes: 1 addition & 1 deletion lib/analyze-post-entry.js

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

2 changes: 1 addition & 1 deletion lib/autobuild-entry.js

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

Loading
Loading

Back | FazBrowse Home | New Git URL