Skip to content

Commit cb7efdd

Browse files
refactor(Worker): Simplify ESBuild target configuration structure
Refactor Configuration/ESBuild/Target.js to use direct variable assignment and named exports instead of arrow function wrapping. The target configuration was simplified for cleaner module output while maintaining identical build behavior. Configuration/ESBuild/Worker.js was removed as a redundant intermediate file since Source/Configuration/ESBuild/Worker.js serves as the canonical source. All target files were rebuilt to reflect the configuration changes.
1 parent 34f5d0f commit cb7efdd

7 files changed

Lines changed: 703 additions & 395 deletions

File tree

Configuration/ESBuild/Target.js

100755100644
Lines changed: 24 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Configuration/ESBuild/Worker.js

100755100644
Lines changed: 53 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,54 @@
1-
export const On =
2-
process.env["NODE_ENV"] === "development" ||
3-
process.env["TAURI_ENV_DEBUG"] === "true";
1+
export const On = process.env["NODE_ENV"] === "development" ||
2+
process.env["TAURI_ENV_DEBUG"] === "true";
43
export const Clean = process.env["Clean"] === "true";
54
/**
65
* @module ESBuild
76
*
87
*/
98
export default {
10-
color: true,
11-
format: "esm",
12-
logLevel: "debug",
13-
metafile: true,
14-
minify: !On,
15-
outdir: "Configuration",
16-
platform: "node",
17-
target: "esnext",
18-
tsconfig: "tsconfig.json",
19-
write: true,
20-
legalComments: On ? "inline" : "none",
21-
bundle: false,
22-
assetNames: "Asset/[name]-[hash]",
23-
sourcemap: On,
24-
drop: On ? [] : ["debugger"],
25-
ignoreAnnotations: !On,
26-
keepNames: On,
27-
plugins: [
28-
{
29-
name: "Target",
30-
// @ts-ignore
31-
setup({ onStart, initialOptions: { outdir } }) {
32-
switch (true) {
33-
case Clean === true:
34-
onStart(async () => {
35-
try {
36-
outdir
37-
? await (
38-
await import("node:fs/promises")
39-
).rm(outdir, {
40-
recursive: true,
41-
})
42-
: {};
43-
} catch (_Error) {
44-
console.log(_Error);
45-
}
46-
});
47-
break;
48-
default:
49-
break;
50-
}
51-
},
52-
},
53-
],
54-
outbase: "Source/Configuration",
9+
color: true,
10+
format: "esm",
11+
logLevel: "debug",
12+
metafile: true,
13+
minify: !On,
14+
outdir: "Configuration",
15+
platform: "node",
16+
target: "esnext",
17+
tsconfig: "tsconfig.json",
18+
write: true,
19+
legalComments: On ? "inline" : "none",
20+
bundle: false,
21+
assetNames: "Asset/[name]-[hash]",
22+
sourcemap: On,
23+
drop: On ? [] : ["debugger"],
24+
ignoreAnnotations: !On,
25+
keepNames: On,
26+
plugins: [
27+
{
28+
name: "Target",
29+
// @ts-ignore
30+
setup({ onStart, initialOptions: { outdir } }) {
31+
switch (true) {
32+
case Clean === true:
33+
onStart(async () => {
34+
try {
35+
outdir
36+
? await (await import("node:fs/promises")).rm(outdir, {
37+
recursive: true,
38+
})
39+
: {};
40+
}
41+
catch (_Error) {
42+
console.log(_Error);
43+
}
44+
});
45+
break;
46+
default:
47+
break;
48+
}
49+
},
50+
},
51+
],
52+
outbase: "Source/Configuration",
5553
};
5654
export const { sep, posix } = await import("node:path");

0 commit comments

Comments
 (0)