|
1 | 1 | /** |
2 | | - * electron-wind-preload.ts - Wind preload installation script for Electron |
3 | | - * |
4 | | - * This script installs the Wind preload polyfill which provides VSCode-compatible |
5 | | - * globals (window.vscode, window.preloadGlobals) for the Electron workbench. |
| 2 | + * Wind preload installation for Electron workbench (A3). |
| 3 | + * Zero console.* output. Tracing via performance.mark(). |
6 | 4 | */ |
7 | 5 |
|
8 | 6 | import Install from "@codeeditorland/wind/Target/Function/Install"; |
9 | 7 |
|
10 | | -// Initialize LAND_DEV_LOG from localStorage (persistent) or URL param (?devlog=config,vfs) |
11 | | -// Can also be set at runtime: window.__LAND_DEV_LOG = "all" |
12 | | -{ |
13 | | - const Stored = localStorage.getItem("LAND_DEV_LOG"); |
14 | | - const UrlParam = new URLSearchParams(window.location.search).get("devlog"); |
15 | | - const Value = UrlParam ?? Stored ?? ""; |
16 | | - if (Value) { |
17 | | - (window as any).__LAND_DEV_LOG = Value; |
18 | | - console.log( |
19 | | - `[DevLog] Enabled tags: ${Value} (source: ${UrlParam ? "url" : "localStorage"})`, |
20 | | - ); |
21 | | - } |
22 | | -} |
23 | | - |
24 | | -console.log("[Electron] ===== Starting Wind preload installation ====="); |
25 | | - |
26 | | -console.log("[Electron] Workbench: Electron (A3)"); |
27 | | - |
28 | | -console.log( |
29 | | - "[Electron] Approach: Electron workbench + complete Electron API polyfills", |
30 | | -); |
31 | | - |
32 | | -// Install the Wind preload polyfill (window.vscode globals). |
33 | | -// Top-level await ensures Install() completes before Layout.astro |
34 | | -// proceeds to Polyfills.js — the .then() chain was fire-and-forget. |
35 | 8 | try { |
| 9 | + performance.mark("land:preload:start"); |
36 | 10 | await Install(); |
37 | | - |
38 | | - console.log("[Electron] Wind preload installed successfully"); |
39 | | - |
40 | | - if (window.preloadGlobals?.process) { |
41 | | - const Process = window.preloadGlobals.process; |
42 | | - |
43 | | - console.log( |
44 | | - "[Electron] preloadGlobals.process:", |
45 | | - Process.platform, |
46 | | - Process.arch, |
47 | | - Process.type, |
48 | | - ); |
49 | | - } else { |
50 | | - console.warn("[Electron] preloadGlobals.process not available"); |
51 | | - } |
52 | | - |
53 | | - if (window.vscode) { |
54 | | - console.log( |
55 | | - "[Electron] window.vscode: ipcRenderer=%s process=%s context=%s", |
56 | | - typeof window.vscode.ipcRenderer, |
57 | | - typeof window.vscode.process, |
58 | | - typeof window.vscode.context, |
59 | | - ); |
60 | | - } else { |
61 | | - console.error("[Electron] window.vscode not available"); |
62 | | - } |
63 | | - |
64 | | - if (!window.__WIND_PRELOAD_READY__) { |
65 | | - console.warn("[Electron] __WIND_PRELOAD_READY__ flag not set"); |
66 | | - } |
67 | | - |
68 | | - console.log("[Electron] ===== Wind preload installation complete ====="); |
69 | | -} catch (Error: unknown) { |
70 | | - console.error("[Electron] Wind preload install error:", Error); |
71 | | - |
72 | | - if (Error instanceof globalThis.Error && Error.stack) { |
73 | | - console.error(Error.stack); |
74 | | - } |
| 11 | + performance.mark("land:preload:done"); |
| 12 | + performance.measure("land:preload", "land:preload:start", "land:preload:done"); |
| 13 | +} catch { |
| 14 | + performance.mark("land:preload:error"); |
75 | 15 | } |
0 commit comments