Skip to content

Commit

Permalink
✨ add esbuild options
Browse files Browse the repository at this point in the history
  • Loading branch information
Gin-Quin committed Apr 22, 2023
1 parent e7d36d5 commit 0109a86
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.2.24
- Add `esuilbOptions` to the `esrun` function.

## 3.2.23
- Strip shebangs

Expand Down
8 changes: 6 additions & 2 deletions source/runners/Runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class Runner {
public nodeOptions: Options["nodeOptions"] = {};
public sendCodeMode: SendCodeMode;
public sudo: boolean;
public esbuildOptions: BuildOptions;

protected watched: boolean | string[];
protected inspect: boolean;
Expand Down Expand Up @@ -72,6 +73,8 @@ export default class Runner {
this.beforeRun = options?.beforeRun;
this.afterRun = options?.afterRun;
this.nodeOptions = options?.nodeOptions ?? {};
this.nodeOptions = options?.nodeOptions ?? {};
this.esbuildOptions = options?.esbuildOptions ?? {};
this.sendCodeMode =
options?.sendCodeMode ?? process.platform === "win32"
? "temporaryFile"
Expand All @@ -91,7 +94,7 @@ export default class Runner {
}
}

async build(buildOptions?: BuildOptions) {
async build(buildOptions: BuildOptions = {}) {
const plugins: Plugin[] = [];

if (this.fileConstants) {
Expand Down Expand Up @@ -122,7 +125,8 @@ export default class Runner {
"../../../../../../../../../../node_modules/*",
]
: [],
...(buildOptions ?? {}),
...this.esbuildOptions,
...buildOptions,
write: false,
metafile: true,
});
Expand Down
2 changes: 2 additions & 0 deletions source/types/Options.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { BuildOptions } from "esbuild";
import { Parameter } from "./Parameter.js";
import { SendCodeMode } from "./SendCodeMode.js";

Expand All @@ -16,4 +17,5 @@ export type Options = {
beforeRun?: () => unknown;
afterRun?: () => unknown;
nodeOptions?: Record<string, Parameter>;
esbuildOptions?: BuildOptions;
};

0 comments on commit 0109a86

Please sign in to comment.