Skip to content

Commit 323e441

Browse files
feat(bootstrap): Integrate atomic bootstrap system for Sky frontend
This commit introduces a new atomic bootstrap system for the Sky application frontend, replacing the previous initialization approach with a more structured and debuggable process. The changes include: - Added comprehensive comments throughout the Application.astro file for better code documentation - Implemented environment-based debug mode configuration via globalThis.__BOOTSTRAP_DEBUG__ - Integrated the new @codeeditorland/wind/Bootstrap module with atomic staging capabilities - Enhanced logging and performance tracking during application initialization - Added pauseBetweenStages option for debugging purposes in development mode - Separated preload and bootstrap scripts for clearer initialization flow The atomic bootstrap system provides better visibility into the application startup process, with detailed logging, performance metrics, and the ability to track each initialization stage independently. This improves debugging capabilities and provides more control over the application loading sequence.
1 parent af1846b commit 323e441

1 file changed

Lines changed: 57 additions & 12 deletions

File tree

Source/pages/Application.astro

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
2-
// import type { IWorkbenchConstructionOptions } from "@codeeditorland/output/vs/workbench/browser/web.api.js";
2+
// Atomic Bootstrap Integration for Sky Frontend
3+
// This version uses the new highly atomic, debuggable bootstrap system
34
45
import Layout from "../Function/Markup/Base.astro";
56
import BrowserWorkbench from "../Workbench/Browser.astro";
67
import DefaultWorkbench from "../Workbench/Default.astro";
78
9+
// Environment detection
810
const On =
911
process.env["NODE_ENV"] === "development" ||
1012
process.env["TAURI_ENV_DEBUG"] === "true";
@@ -22,6 +24,7 @@ const Bust = (Base: string): string =>
2224
---
2325

2426
<Layout>
27+
<!-- Content Security Policy -->
2528
<meta
2629
http-equiv="Content-Security-Policy"
2730
content={((
@@ -133,13 +136,13 @@ const Bust = (Base: string): string =>
133136
"richScreenReaderContent",
134137
"collapsedCellPreview",
135138
],
136-
// Standalone directives are set to true
137139
"block-all-mixed-content": true,
138140
"upgrade-insecure-requests": false,
139141
})}
140142
slot="Meta"
141143
/>
142144

145+
<!-- VSCode Workbench Configuration -->
143146
<meta
144147
id="vscode-workbench-web-configuration"
145148
data-settings={JSON.stringify({
@@ -158,21 +161,23 @@ const Bust = (Base: string): string =>
158161
logLevel: On ? 2 : 0,
159162
enableSmokeTestDriver: On,
160163
},
161-
// } satisfies IWorkbenchConstructionOptions as unknown as IWorkbenchConstructionOptions)}
162164
})}
163165
slot="Meta"
164166
/>
165167

168+
<!-- VSCode Auth Session -->
166169
<meta
167170
id="vscode-workbench-auth-session"
168171
data-settings={JSON.stringify({})}
169172
slot="Meta"
170173
/>
171174

175+
<!-- Global VSCode File Root -->
172176
<script is:inline type="module" define:vars={{ Site }} slot="Head">
173177
globalThis._VSCODE_FILE_ROOT = `${window.location.origin}/Static/Application/`;
174178
</script>
175179

180+
<!-- Worker Configuration -->
176181
<script
177182
is:inline
178183
type="module"
@@ -183,6 +188,13 @@ const Bust = (Base: string): string =>
183188
window._WORKER = Worker;
184189
</script>
185190

191+
<!-- Bootstrap Configuration -->
192+
<script is:inline type="module" slot="Head">
193+
// Set debug mode based on environment
194+
globalThis.__BOOTSTRAP_DEBUG__ = ${On ? 'true' : 'false'};
195+
</script>
196+
197+
<!-- Worker Scripts -->
186198
{
187199
Bundle ? (
188200
<Fragment>
@@ -243,14 +255,47 @@ const Bust = (Base: string): string =>
243255
/>
244256
) : (
245257
<Fragment>
246-
<script
247-
is:inline
248-
type="module"
249-
defer
250-
>
251-
import { Install } from '@codeeditorland/wind';
252-
Install({ Configuration });
253-
</script>
258+
<!-- Wind Preload Script -->
259+
<script
260+
is:inline
261+
type="module"
262+
defer
263+
>
264+
import { Install } from '@codeeditorland/wind';
265+
Install({ Configuration });
266+
</script>
267+
268+
<!-- Wind Bootstrap Script (Atomic) -->
269+
<script
270+
is:inline
271+
type="module"
272+
defer
273+
>
274+
import { bootstrap } from '@codeeditorland/wind/Bootstrap';
275+
276+
console.log('[Sky] Starting atomic bootstrap...');
277+
278+
bootstrap({
279+
debugMode: ${On},
280+
verboseLogging: ${On},
281+
showStatusUI: true,
282+
pauseBetweenStages: ${On},
283+
enablePerformanceTracking: true
284+
}).then((result) => {
285+
console.log('[Sky] Bootstrap completed:', result.success);
286+
287+
if (result.success) {
288+
console.log('[Sky]  All stages completed successfully');
289+
console.log('[Sky] Total duration:', result.totalDuration.toFixed(0), 'ms');
290+
} else {
291+
console.error('[Sky]  Bootstrap failed');
292+
}
293+
}).catch((error) => {
294+
console.error('[Sky]  Fatal bootstrap error:', error);
295+
});
296+
</script>
297+
298+
<!-- VSCode Workbench Script -->
254299
<script
255300
is:inline
256301
type="module"
@@ -264,4 +309,4 @@ const Bust = (Base: string): string =>
264309
</Fragment>
265310
)
266311
}
267-
</Layout>
312+
</Layout>

0 commit comments

Comments
 (0)