Skip to content

Commit d2c5567

Browse files
feat(Sky): Add LAND_ENABLE_WIND to conditionally skip Wind bootstrap
Introduce the `LAND_ENABLE_WIND` environment variable (Atom N2) that allows the Electron workbench to bypass the Effect-TS service layer entirely. When set to "false" at build time, Vite inlines the comparison and the entire Wind import chain is tree-shaken from the production bundle. This enables "Mountain + bare workbench" integration tests and produces the smallest shippable surface where gRPC/Tauri IPC isn't desired. The flag is mirrored into Vite's `define` config with a default of "true" so Wind loads for all profiles that don't explicitly opt out.
1 parent 1b8e02b commit d2c5567

2 files changed

Lines changed: 61 additions & 29 deletions

File tree

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
/**
22
* Effect-TS bootstrap for Electron workbench (A3).
33
* Zero console.* output. Results captured via performance.mark().
4+
*
5+
* Atom N2: when `LAND_ENABLE_WIND` is false at build time, the Wind
6+
* bootstrap is replaced with a single performance-mark so the workbench
7+
* loads the native VS Code stack with no Effect-TS service layer on top.
8+
* Useful for "Mountain + bare workbench" integration tests and for the
9+
* smallest shippable surface where gRPC/Tauri IPC isn't desired.
10+
*
11+
* Vite inlines `import.meta.env.LAND_ENABLE_WIND` at build time — the
12+
* inline comparison drops the entire import chain when the flag is
13+
* `"false"`, so tree-shaking removes the Wind bundle from production.
414
*/
515

616
interface BootstrapStage {
@@ -16,30 +26,42 @@ interface BootstrapResult {
1626
error?: unknown;
1727
}
1828

19-
try {
20-
performance.mark("land:bootstrap:start");
29+
if (import.meta.env["LAND_ENABLE_WIND"] === "false") {
30+
performance.mark("land:bootstrap:skipped-wind-disabled");
31+
} else {
32+
try {
33+
performance.mark("land:bootstrap:start");
2134

22-
const { runBootstrap } =
23-
await import("@codeeditorland/wind/Target/Effect/Bootstrap");
24-
const { Effect } = await import("effect");
35+
const { runBootstrap } = await import(
36+
"@codeeditorland/wind/Target/Effect/Bootstrap"
37+
);
38+
const { Effect } = await import("effect");
2539

26-
const BootstrapResult: BootstrapResult = await Effect.runPromise(
27-
runBootstrap({
28-
skipHealthCheck: true,
29-
debugMode: true,
30-
}),
31-
);
40+
const BootstrapResult: BootstrapResult = await Effect.runPromise(
41+
runBootstrap({
42+
skipHealthCheck: true,
43+
debugMode: true,
44+
}),
45+
);
3246

33-
performance.mark("land:bootstrap:done", {
34-
detail: {
35-
success: BootstrapResult.success,
36-
duration: BootstrapResult.totalDuration,
37-
stages: BootstrapResult.stages.map((S: BootstrapStage) => `${S.stageName}:${S.success ? "ok" : "fail"}:${S.duration}ms`),
38-
},
39-
});
40-
performance.measure("land:bootstrap", "land:bootstrap:start", "land:bootstrap:done");
41-
} catch {
42-
performance.mark("land:bootstrap:error");
47+
performance.mark("land:bootstrap:done", {
48+
detail: {
49+
success: BootstrapResult.success,
50+
duration: BootstrapResult.totalDuration,
51+
stages: BootstrapResult.stages.map(
52+
(S: BootstrapStage) =>
53+
`${S.stageName}:${S.success ? "ok" : "fail"}:${S.duration}ms`,
54+
),
55+
},
56+
});
57+
performance.measure(
58+
"land:bootstrap",
59+
"land:bootstrap:start",
60+
"land:bootstrap:done",
61+
);
62+
} catch {
63+
performance.mark("land:bootstrap:error");
64+
}
4365
}
4466

4567
export default {};

astro.config.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,14 +1205,24 @@ export { ExtensionsScannerService, IExtensionsScannerService };
12051205
// sees the same values Cocoon does. Vite substitutes these at
12061206
// build time; missing values fall through to Utility/Tier.ts's
12071207
// PascalCase defaults.
1208-
define: Object.fromEntries(
1209-
Object.entries(process.env)
1210-
.filter(([Key]) => Key.startsWith("Tier"))
1211-
.map(([Key, Value]) => [
1212-
`import.meta.env.${Key}`,
1213-
JSON.stringify(Value),
1214-
]),
1215-
),
1208+
//
1209+
// Atom N2: additionally mirror `LAND_ENABLE_WIND` so Sky's
1210+
// Electron/BrowserProxy bootstrap can drop the Wind import chain
1211+
// entirely when the flag is false. Defaults to `"true"` so the
1212+
// Wind layer loads for every profile that doesn't opt out.
1213+
define: {
1214+
...Object.fromEntries(
1215+
Object.entries(process.env)
1216+
.filter(([Key]) => Key.startsWith("Tier"))
1217+
.map(([Key, Value]) => [
1218+
`import.meta.env.${Key}`,
1219+
JSON.stringify(Value),
1220+
]),
1221+
),
1222+
"import.meta.env.LAND_ENABLE_WIND": JSON.stringify(
1223+
process.env["LAND_ENABLE_WIND"] ?? "true",
1224+
),
1225+
},
12161226

12171227
build: {
12181228
rollupOptions: {

0 commit comments

Comments
 (0)