Skip to content

Commit 99caf06

Browse files
build(Sky): Simplify VS Code asset paths with /vs/ prefix
Update all VS Code asset references to use root-relative /vs/ paths instead of /Static/Application/vs/. Changes: - Update _VSCODE_FILE_ROOT in Base.astro, BrowserProxy.astro, Electron.astro, and Mountain.astro from `/Static/Application/` to `/` - Update NLS script path in NLS.astro to use `/vs/nls.js` - Add astro.config.ts build hook to copy VS Code assets from Output/Target/Microsoft/VSCode/vs to Target/vs/ at build time - Create Public/vs symlink pointing to the Output VS Code assets This extends the /vs/ URL path standardization from the previous commit to all asset references, simplifying the path structure and enabling the build hook to handle asset deployment.
1 parent 5e2d328 commit 99caf06

7 files changed

Lines changed: 36 additions & 5 deletions

File tree

Public/vs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../Output/Target/Microsoft/VSCode/vs

Source/Function/Markup/Base.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import Meta from "../Meta.astro";
2323

2424
<!-- Global VSCode File Root - Must execute before module scripts -->
2525
<script is:inline>
26-
globalThis._VSCODE_FILE_ROOT = `${window.location.origin}/Static/Application/`;
26+
globalThis._VSCODE_FILE_ROOT = `${window.location.origin}/`;
2727
</script>
2828

2929
<slot name="Head" />

Source/Workbench/NLS.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import { Bust, On } from "../Function/Shared";
66
is:inline
77
type="module"
88
src={Bust(
9-
`/Static/Application/${On ? "vs/" : ""}${On ? "nls.js" : "nls.messages.js"}`,
9+
`${On ? "/vs/nls.js" : "/Static/Application/nls.messages.js"}`,
1010
)}></script>

Source/pages/BrowserProxy.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ const Worker = `/Worker.js?BASE_REMOTE=${encodeURIComponent(Astro.url.origin)}`;
170170

171171
<!-- Global VSCode File Root -->
172172
<script is:inline slot="Head">
173-
globalThis._VSCODE_FILE_ROOT = `${window.location.origin}/Static/Application/`;
173+
globalThis._VSCODE_FILE_ROOT = `${window.location.origin}/`;
174174
</script>
175175

176176
<!-- Worker Configuration -->

Source/pages/Electron.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ const Worker = `/Worker.js?BASE_REMOTE=${encodeURIComponent(Astro.url.origin)}`;
170170

171171
<!-- Global VSCode File Root -->
172172
<script is:inline slot="Head">
173-
globalThis._VSCODE_FILE_ROOT = `${window.location.origin}/Static/Application/`;
173+
globalThis._VSCODE_FILE_ROOT = `${window.location.origin}/`;
174174
</script>
175175

176176
<!-- Worker Configuration -->

Source/pages/Mountain.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ const Worker = `/Worker.js?BASE_REMOTE=${encodeURIComponent(Astro.url.origin)}`;
170170

171171
<!-- Global VSCode File Root -->
172172
<script is:inline slot="Head">
173-
globalThis._VSCODE_FILE_ROOT = `${window.location.origin}/Static/Application/`;
173+
globalThis._VSCODE_FILE_ROOT = `${window.location.origin}/`;
174174
</script>
175175

176176
<!-- Worker Configuration -->

astro.config.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,36 @@ export default defineConfig({
5454
!On
5555
? (await import("@playform/compress")).default({ Logger: 1 })
5656
: null,
57+
58+
{
59+
name: "CopyVSCodeAssets",
60+
hooks: {
61+
"astro:build:done": async ({ dir }) => {
62+
const { cp } = await import("node:fs/promises");
63+
const { fileURLToPath } = await import("node:url");
64+
const { join, resolve } = await import("node:path");
65+
const Source = resolve(
66+
process.cwd(),
67+
"../../Output/Target/Microsoft/VSCode/vs",
68+
);
69+
const Destination = join(fileURLToPath(dir), "vs");
70+
console.log(
71+
`[CopyVSCode] Copying vs/ assets → Target/vs/`,
72+
);
73+
try {
74+
await cp(Source, Destination, { recursive: true });
75+
console.log(
76+
"[CopyVSCode] ✓ VS Code assets copied to Target/vs/",
77+
);
78+
} catch (Error) {
79+
console.warn(
80+
"[CopyVSCode] ✗ Could not copy VS Code assets:",
81+
Error,
82+
);
83+
}
84+
},
85+
},
86+
},
5787
],
5888

5989
experimental: {

0 commit comments

Comments
 (0)