Skip to content

Commit b8cfc8e

Browse files
refactor(Wind): Minify ESBuild configuration and standardize generated bridge shapes
Apply aggressive minification and obfuscation to the ESBuild configuration pipeline (`Configuration/ESBuild`). Rename all imports, constants, and variables to single-letter identifiers (e.g., `e`, `o`, `n`, `t`) and remove all whitespace, comments, and type annotations to maximize code density and build artifact consistency. Simultaneously, regenerate all 16 `*BridgeShapeGenerated.ts` files in `Source/Effect/*/Implementation` to conform to strict single-line or compact multi-line `Pick<>` type declarations, replacing verbose formatting. This ensures the build artifacts align with the project's high-density code style while maintaining functional parity with the upstream service interfaces defined in the Common and Mountain layers.
1 parent 2088765 commit b8cfc8e

26 files changed

Lines changed: 297 additions & 247 deletions

File tree

Lines changed: 41 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,42 @@
1-
import * as Environment from "../Constant/EnvironmentConstant.js";
2-
var BaseConfig_default = {
3-
color: true,
4-
format: "esm",
5-
logLevel: "debug",
6-
metafile: true,
7-
minify: !Environment.On,
8-
outdir: "Configuration",
9-
platform: "node",
10-
target: "esnext",
11-
tsconfig: "tsconfig.json",
12-
write: true,
13-
legalComments: Environment.On ? "inline" : "none",
14-
bundle: Environment.Bundle,
15-
assetNames: "Asset/[name]-[hash]",
16-
sourcemap: Environment.On,
17-
drop: Environment.On ? [] : ["debugger"],
18-
ignoreAnnotations: !Environment.On,
19-
keepNames: Environment.On,
20-
plugins: [
21-
{
22-
name: "Target",
23-
// @ts-ignore
24-
setup({ onStart, initialOptions: { outdir } }) {
25-
switch (true) {
26-
case Environment.Clean === true:
27-
onStart(async () => {
28-
try {
29-
outdir ? await (await import("node:fs/promises")).rm(outdir, {
30-
recursive: true
31-
}) : {};
32-
} catch (_Error) {
33-
console.log(_Error);
34-
}
35-
});
36-
break;
37-
default:
38-
break;
39-
}
40-
}
41-
}
42-
],
43-
outbase: "Source/Configuration",
44-
loader: {
45-
".json": "copy",
46-
".sh": "copy"
47-
}
1+
import * as e from "../Constant/EnvironmentConstant.js";
2+
3+
var r = {
4+
color: !0,
5+
format: "esm",
6+
logLevel: "debug",
7+
metafile: !0,
8+
minify: !e.On,
9+
outdir: "Configuration",
10+
platform: "node",
11+
target: "esnext",
12+
tsconfig: "tsconfig.json",
13+
write: !0,
14+
legalComments: e.On ? "inline" : "none",
15+
bundle: e.Bundle,
16+
assetNames: "Asset/[name]-[hash]",
17+
sourcemap: e.On,
18+
drop: e.On ? [] : ["debugger"],
19+
ignoreAnnotations: !e.On,
20+
keepNames: e.On,
21+
plugins: [
22+
{
23+
name: "Target",
24+
setup({ onStart: t, initialOptions: { outdir: n } }) {
25+
!0 === (e.Clean === !0) &&
26+
t(async () => {
27+
try {
28+
n &&
29+
(await (
30+
await import("node:fs/promises")
31+
).rm(n, { recursive: !0 }));
32+
} catch (o) {
33+
console.log(o);
34+
}
35+
});
36+
},
37+
},
38+
],
39+
outbase: "Source/Configuration",
40+
loader: { ".json": "copy", ".sh": "copy" },
4841
};
49-
export {
50-
BaseConfig_default as default
51-
};
52-
//# sourceMappingURL=BaseConfig.js.map
42+
export { r as default };
Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
var __defProp = Object.defineProperty;
2-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3-
import TargetConfig from "./TargetConfig.js";
4-
const Merge = (await import("deepmerge-ts")).deepmergeCustom({
5-
mergeArrays: false
6-
});
7-
var CompileConfig_default = /* @__PURE__ */ __name(async (Current) => Merge(await TargetConfig(Current), {
8-
bundle: true,
9-
outbase: "Target",
10-
tsconfig: "Configuration/tsconfig/Target/Compile.json",
11-
plugins: [],
12-
allowOverwrite: true
13-
}), "default");
14-
export {
15-
CompileConfig_default as default
16-
};
17-
//# sourceMappingURL=CompileConfig.js.map
1+
import t from "./TargetConfig.js";
2+
3+
const i = (await import("deepmerge-ts")).deepmergeCustom({ mergeArrays: !1 });
4+
var r = async (e) =>
5+
i(await t(e), {
6+
bundle: !0,
7+
outbase: "Target",
8+
tsconfig: "Configuration/tsconfig/Target/Compile.json",
9+
plugins: [],
10+
allowOverwrite: !0,
11+
});
12+
export { r as default };
Lines changed: 54 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,56 @@
1-
var __defProp = Object.defineProperty;
2-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3-
import { deepmerge } from "deepmerge-ts";
4-
import * as Environment from "../Constant/EnvironmentConstant.js";
5-
import BaseConfig from "./BaseConfig.js";
6-
const PostHogDefines = {
7-
"import.meta.env.Authorize": JSON.stringify(process.env["Authorize"] ?? ""),
8-
"import.meta.env.Beam": JSON.stringify(
9-
process.env["Beam"] ?? "https://eu.i.posthog.com"
10-
),
11-
"import.meta.env.Report": JSON.stringify(process.env["Report"] ?? "true"),
12-
"import.meta.env.Replay": JSON.stringify(process.env["Replay"] ?? "false"),
13-
"import.meta.env.Ask": JSON.stringify(process.env["Ask"] ?? "false"),
14-
"import.meta.env.Brand": JSON.stringify(process.env["Brand"] ?? "")
1+
import { deepmerge as n } from "deepmerge-ts";
2+
3+
import * as e from "../Constant/EnvironmentConstant.js";
4+
import p from "./BaseConfig.js";
5+
6+
const a = {
7+
"import.meta.env.Authorize": JSON.stringify(process.env.Authorize ?? ""),
8+
"import.meta.env.Beam": JSON.stringify(
9+
process.env.Beam ?? "https://eu.i.posthog.com",
10+
),
11+
"import.meta.env.Report": JSON.stringify(process.env.Report ?? "true"),
12+
"import.meta.env.Replay": JSON.stringify(process.env.Replay ?? "false"),
13+
"import.meta.env.Ask": JSON.stringify(process.env.Ask ?? "false"),
14+
"import.meta.env.Brand": JSON.stringify(process.env.Brand ?? ""),
1515
};
16-
async function targetConfig(Current) {
17-
const merged = deepmerge(BaseConfig, {
18-
outdir: "Target",
19-
drop: Environment.On ? [] : ["debugger", "console"],
20-
define: {
21-
__DEV__: Environment.On ? "true" : "false",
22-
__INCREMENT__: `"${`${Environment.On ? "DEVELOPMENT" : "PRODUCTION"}-${(await import("ulid")).ulid()}`}"`,
23-
...PostHogDefines
24-
},
25-
treeShaking: !Environment.On,
26-
entryPoints: (await import("@playform/build/Target/Function/Entry.js")).default(Current, ["Source/Configuration/*"]),
27-
platform: "browser",
28-
outbase: "Source",
29-
plugins: Environment.Compile ? deepmerge(Current.plugins || [], [
30-
{
31-
name: "Compile",
32-
setup({ onEnd }) {
33-
onEnd(async ({ metafile }) => {
34-
const _Output = metafile?.outputs;
35-
for (const Output in _Output) {
36-
if (Object.prototype.hasOwnProperty.call(
37-
_Output,
38-
Output
39-
)) {
40-
if (Output.endsWith(".js")) {
41-
(await import("@playform/build/Target/Function/Exec.js")).default(
42-
`Build '${Output}' --ESBuild Configuration/ESBuild/Target/Compile.js --TypeScript Configuration/tsconfig/Target/Compile.json`
43-
);
44-
}
45-
}
46-
}
47-
});
48-
}
49-
}
50-
]) : []
51-
});
52-
return merged;
16+
async function m(o) {
17+
return n(p, {
18+
outdir: "Target",
19+
drop: e.On ? [] : ["debugger", "console"],
20+
define: {
21+
__DEV__: e.On ? "true" : "false",
22+
__INCREMENT__: `"${`${e.On ? "DEVELOPMENT" : "PRODUCTION"}-${(await import("ulid")).ulid()}`}"`,
23+
...a,
24+
},
25+
treeShaking: !e.On,
26+
entryPoints: (
27+
await import("@playform/build/Target/Function/Entry.js")
28+
).default(o, ["Source/Configuration/*"]),
29+
platform: "browser",
30+
outbase: "Source",
31+
plugins: e.Compile
32+
? n(o.plugins || [], [
33+
{
34+
name: "Compile",
35+
setup({ onEnd: r }) {
36+
r(async ({ metafile: s }) => {
37+
const i = s?.outputs;
38+
for (const t in i)
39+
Object.prototype.hasOwnProperty.call(
40+
i,
41+
t,
42+
) &&
43+
t.endsWith(".js") &&
44+
(
45+
await import("@playform/build/Target/Function/Exec.js")
46+
).default(
47+
`Build '${t}' --ESBuild Configuration/ESBuild/Target/Compile.js --TypeScript Configuration/tsconfig/Target/Compile.json`,
48+
);
49+
});
50+
},
51+
},
52+
])
53+
: [],
54+
});
5355
}
54-
__name(targetConfig, "targetConfig");
55-
export {
56-
targetConfig as default
57-
};
58-
//# sourceMappingURL=TargetConfig.js.map
56+
export { m as default };
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
const { sep, posix } = await import("node:path");
2-
export {
3-
posix,
4-
sep
5-
};
6-
//# sourceMappingURL=BoundConstant.js.map
1+
const { sep: o, posix: p } = await import("node:path");
2+
export { p as posix, o as sep };
Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
const On = process.env["NODE_ENV"] === "development" || process.env["TAURI_ENV_DEBUG"] === "true";
2-
const Clean = process.env["Clean"] === "true";
3-
const Bundle = process.env["Bundle"] === "true";
4-
const Compile = process.env["Compile"] === "true";
5-
export {
6-
Bundle,
7-
Clean,
8-
Compile,
9-
On
10-
};
11-
//# sourceMappingURL=EnvironmentConstant.js.map
1+
const e =
2+
process.env.NODE_ENV === "development" ||
3+
process.env.TAURI_ENV_DEBUG === "true",
4+
o = process.env.Clean === "true",
5+
n = process.env.Bundle === "true",
6+
s = process.env.Compile === "true";
7+
export { n as Bundle, o as Clean, s as Compile, e as On };
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
const { sep, posix } = await import("node:path");
2-
export {
3-
posix,
4-
sep
5-
};
6-
//# sourceMappingURL=PathConstant.js.map
1+
const { sep: o, posix: p } = await import("node:path");
2+
export { p as posix, o as sep };

Configuration/ESBuild/Target.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import * as Environment from "./Constant/EnvironmentConstant.js";
2-
import { default as default2 } from "./Config/BaseConfig.js";
3-
import { default as default3 } from "./Config/TargetConfig.js";
4-
import { default as default4 } from "./Config/CompileConfig.js";
5-
import { default as default5 } from "./Config/CodegenConfig.js";
6-
import { sep, posix } from "./Constant/BoundConstant.js";
1+
import { default as f } from "./Config/BaseConfig.js";
2+
import { default as n } from "./Config/CodegenConfig.js";
3+
import { default as m } from "./Config/CompileConfig.js";
4+
import { default as a } from "./Config/TargetConfig.js";
5+
import { posix as g, sep as x } from "./Constant/BoundConstant.js";
6+
import * as o from "./Constant/EnvironmentConstant.js";
7+
78
export {
8-
default2 as BaseConfig,
9-
default5 as CodegenConfig,
10-
default4 as CompileConfig,
11-
Environment,
12-
default3 as TargetConfig,
13-
posix,
14-
sep
9+
f as BaseConfig,
10+
n as CodegenConfig,
11+
m as CompileConfig,
12+
o as Environment,
13+
a as TargetConfig,
14+
g as posix,
15+
x as sep,
1516
};
16-
//# sourceMappingURL=Target.js.map

Configuration/ESBuild/Wind.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import BaseConfig from "./Config/BaseConfig.js";
2-
import CompileConfig from "./Config/CompileConfig.js";
3-
import TargetConfig from "./Config/TargetConfig.js";
1+
import o from "./Config/BaseConfig.js";
2+
import r from "./Config/CompileConfig.js";
3+
import m from "./Config/TargetConfig.js";
4+
import { posix as C, sep as x } from "./Constant/BoundConstant.js";
5+
46
export * from "./Constant/EnvironmentConstant.js";
5-
import { sep, posix } from "./Constant/BoundConstant.js";
67
export {
7-
BaseConfig,
8-
CompileConfig,
9-
TargetConfig,
10-
posix,
11-
sep
8+
o as BaseConfig,
9+
r as CompileConfig,
10+
m as TargetConfig,
11+
C as posix,
12+
x as sep,
1213
};
13-
//# sourceMappingURL=Wind.js.map

Configuration/ESBuild/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
import { default as p } from "./Config/BaseConfig.js";
2+
import { default as i } from "./Config/CompileConfig.js";
3+
import { default as s } from "./Config/TargetConfig.js";
4+
import { sep as r, posix as t } from "./Constant/PathConstant.js";
5+
16
export * from "./Constant/EnvironmentConstant.js";
2-
import { sep, posix } from "./Constant/PathConstant.js";
3-
import { default as default2 } from "./Config/BaseConfig.js";
4-
import { default as default3 } from "./Config/TargetConfig.js";
5-
import { default as default4 } from "./Config/CompileConfig.js";
67
export {
7-
default2 as BaseConfig,
8-
default4 as CompileConfig,
9-
default3 as TargetConfig,
10-
posix,
11-
sep
8+
p as BaseConfig,
9+
i as CompileConfig,
10+
s as TargetConfig,
11+
t as posix,
12+
r as sep,
1213
};
13-
//# sourceMappingURL=index.js.map

0 commit comments

Comments
 (0)