Skip to content

Commit b493bf2

Browse files
chore(build): reformat ESBuild worker configuration
- Adjusted code formatting and indentation in ESBuild configuration file for consistency - Split long conditional expression across multiple lines for improved readability - Added proper braces around dynamic import of 'node:fs/promises' module in cleanup plugin - Maintained existing functionality for development/production environment detection through NODE_ENV and TAURI_ENV_DEBUG - Preserved conditional output directory cleanup logic when 'Clean' flag is enabled These changes improve code maintainability in the Rest component (JS Bundler configuration) while ensuring reliable build artifact cleanup as part of Land's build process optimization goals. The consistent formatting supports future refactoring efforts in the Cocoon extension host shim's bundling pipeline.
1 parent 22a8af6 commit b493bf2

File tree

1 file changed

+48
-46
lines changed

1 file changed

+48
-46
lines changed
Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,56 @@
1-
export const On = process.env["NODE_ENV"] === "development" ||
2-
process.env["TAURI_ENV_DEBUG"] === "true";
1+
export const On =
2+
process.env["NODE_ENV"] === "development" ||
3+
process.env["TAURI_ENV_DEBUG"] === "true";
34
export const Clean = process.env["Clean"] === "true";
45
/**
56
* @module ESBuild
67
*
78
*/
89
export default {
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",
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",
5355
};
5456
export const { sep, posix } = await import("node:path");

0 commit comments

Comments
 (0)