Skip to content

Commit 8a22169

Browse files
fix(Sky): Convert workbench.js import to dynamic to avoid hard build failures
Change Browser.astro to use dynamic import for @codeeditorland/output/vs/code/browser/workbench/workbench.js instead of static import. Static imports of unresolved package specifiers cause Rollup to hard-fail at build time, while dynamic imports only warn and allow the build to complete. Add corresponding external resolution logic in astro.config.ts to pre-resolve @codeeditorland/output/vs/** package specifiers before Rollup attempts resolution. This matches the import pattern already used in Mountain.astro, BrowserTest.astro, BrowserProxy/Workbench.ts, and Electron/Workbench.ts. Also apply minor formatting updates to Astro build artifacts in .astro/.
1 parent b7f8d1b commit 8a22169

5 files changed

Lines changed: 58 additions & 86 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"collections": [],
3-
"entries": {}
4-
}
2+
"collections": [],
3+
"entries": {}
4+
}

.astro/content.d.ts

Lines changed: 42 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
declare module "astro:content" {
1+
declare module 'astro:content' {
22
export interface RenderResult {
3-
Content: import("astro/runtime/server/index.js").AstroComponentFactory;
4-
headings: import("astro").MarkdownHeading[];
3+
Content: import('astro/runtime/server/index.js').AstroComponentFactory;
4+
headings: import('astro').MarkdownHeading[];
55
remarkPluginFrontmatter: Record<string, any>;
66
}
77
interface Render {
8-
".md": Promise<RenderResult>;
8+
'.md': Promise<RenderResult>;
99
}
1010

1111
export interface RenderedContent {
@@ -19,9 +19,7 @@ declare module "astro:content" {
1919
type Flatten<T> = T extends { [K: string]: infer U } ? U : never;
2020

2121
export type CollectionKey = keyof DataEntryMap;
22-
export type CollectionEntry<C extends CollectionKey> = Flatten<
23-
DataEntryMap[C]
24-
>;
22+
export type CollectionEntry<C extends CollectionKey> = Flatten<DataEntryMap[C]>;
2523

2624
type AllValuesOf<T> = T extends any ? T[keyof T] : never;
2725

@@ -33,17 +31,12 @@ declare module "astro:content" {
3331
id: E;
3432
};
3533

36-
export type ReferenceLiveEntry<
37-
C extends keyof LiveContentConfig["collections"],
38-
> = {
34+
export type ReferenceLiveEntry<C extends keyof LiveContentConfig['collections']> = {
3935
collection: C;
4036
id: string;
4137
};
4238

43-
export function getCollection<
44-
C extends keyof DataEntryMap,
45-
E extends CollectionEntry<C>,
46-
>(
39+
export function getCollection<C extends keyof DataEntryMap, E extends CollectionEntry<C>>(
4740
collection: C,
4841
filter?: (entry: CollectionEntry<C>) => entry is E,
4942
): Promise<E[]>;
@@ -52,16 +45,11 @@ declare module "astro:content" {
5245
filter?: (entry: CollectionEntry<C>) => unknown,
5346
): Promise<CollectionEntry<C>[]>;
5447

55-
export function getLiveCollection<
56-
C extends keyof LiveContentConfig["collections"],
57-
>(
48+
export function getLiveCollection<C extends keyof LiveContentConfig['collections']>(
5849
collection: C,
5950
filter?: LiveLoaderCollectionFilterType<C>,
6051
): Promise<
61-
import("astro").LiveDataCollectionResult<
62-
LiveLoaderDataType<C>,
63-
LiveLoaderErrorType<C>
64-
>
52+
import('astro').LiveDataCollectionResult<LiveLoaderDataType<C>, LiveLoaderErrorType<C>>
6553
>;
6654

6755
export function getEntry<
@@ -83,17 +71,10 @@ declare module "astro:content" {
8371
? Promise<DataEntryMap[C][E]> | undefined
8472
: Promise<DataEntryMap[C][E]>
8573
: Promise<CollectionEntry<C> | undefined>;
86-
export function getLiveEntry<
87-
C extends keyof LiveContentConfig["collections"],
88-
>(
74+
export function getLiveEntry<C extends keyof LiveContentConfig['collections']>(
8975
collection: C,
9076
filter: string | LiveLoaderEntryFilterType<C>,
91-
): Promise<
92-
import("astro").LiveDataEntryResult<
93-
LiveLoaderDataType<C>,
94-
LiveLoaderErrorType<C>
95-
>
96-
>;
77+
): Promise<import('astro').LiveDataEntryResult<LiveLoaderDataType<C>, LiveLoaderErrorType<C>>>;
9778

9879
/** Resolve an array of entry references from the same collection */
9980
export function getEntries<C extends keyof DataEntryMap>(
@@ -113,9 +94,9 @@ declare module "astro:content" {
11394
| (string & {}),
11495
>(
11596
collection: C,
116-
): import("astro/zod").ZodPipe<
117-
import("astro/zod").ZodString,
118-
import("astro/zod").ZodTransform<
97+
): import('astro/zod').ZodPipe<
98+
import('astro/zod').ZodString,
99+
import('astro/zod').ZodTransform<
119100
C extends keyof DataEntryMap
120101
? {
121102
collection: C;
@@ -126,67 +107,47 @@ declare module "astro:content" {
126107
>
127108
>;
128109

129-
type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R
130-
? R
131-
: T;
132-
type InferEntrySchema<C extends keyof DataEntryMap> =
133-
import("astro/zod").infer<
134-
ReturnTypeOrOriginal<
135-
Required<ContentConfig["collections"][C]>["schema"]
136-
>
137-
>;
110+
type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T;
111+
type InferEntrySchema<C extends keyof DataEntryMap> = import('astro/zod').infer<
112+
ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']>
113+
>;
138114
type ExtractLoaderConfig<T> = T extends { loader: infer L } ? L : never;
139115
type InferLoaderSchema<
140116
C extends keyof DataEntryMap,
141-
L = ExtractLoaderConfig<ContentConfig["collections"][C]>,
142-
> = L extends { schema: import("astro/zod").ZodSchema }
143-
? import("astro/zod").infer<L["schema"]>
117+
L = ExtractLoaderConfig<ContentConfig['collections'][C]>,
118+
> = L extends { schema: import('astro/zod').ZodSchema }
119+
? import('astro/zod').infer<L['schema']>
144120
: any;
145121

146-
type DataEntryMap = {};
122+
type DataEntryMap = {
123+
124+
};
147125

148-
type ExtractLoaderTypes<T> = T extends import("astro/loaders").LiveLoader<
126+
type ExtractLoaderTypes<T> = T extends import('astro/loaders').LiveLoader<
149127
infer TData,
150128
infer TEntryFilter,
151129
infer TCollectionFilter,
152130
infer TError
153131
>
154-
? {
155-
data: TData;
156-
entryFilter: TEntryFilter;
157-
collectionFilter: TCollectionFilter;
158-
error: TError;
159-
}
160-
: {
161-
data: never;
162-
entryFilter: never;
163-
collectionFilter: never;
164-
error: never;
165-
};
166-
type ExtractEntryFilterType<T> = ExtractLoaderTypes<T>["entryFilter"];
167-
type ExtractCollectionFilterType<T> =
168-
ExtractLoaderTypes<T>["collectionFilter"];
169-
type ExtractErrorType<T> = ExtractLoaderTypes<T>["error"];
170-
171-
type LiveLoaderDataType<C extends keyof LiveContentConfig["collections"]> =
172-
LiveContentConfig["collections"][C]["schema"] extends undefined
173-
? ExtractDataType<LiveContentConfig["collections"][C]["loader"]>
174-
: import("astro/zod").infer<
175-
Exclude<
176-
LiveContentConfig["collections"][C]["schema"],
177-
undefined
178-
>
132+
? { data: TData; entryFilter: TEntryFilter; collectionFilter: TCollectionFilter; error: TError }
133+
: { data: never; entryFilter: never; collectionFilter: never; error: never };
134+
type ExtractEntryFilterType<T> = ExtractLoaderTypes<T>['entryFilter'];
135+
type ExtractCollectionFilterType<T> = ExtractLoaderTypes<T>['collectionFilter'];
136+
type ExtractErrorType<T> = ExtractLoaderTypes<T>['error'];
137+
138+
type LiveLoaderDataType<C extends keyof LiveContentConfig['collections']> =
139+
LiveContentConfig['collections'][C]['schema'] extends undefined
140+
? ExtractDataType<LiveContentConfig['collections'][C]['loader']>
141+
: import('astro/zod').infer<
142+
Exclude<LiveContentConfig['collections'][C]['schema'], undefined>
179143
>;
180-
type LiveLoaderEntryFilterType<
181-
C extends keyof LiveContentConfig["collections"],
182-
> = ExtractEntryFilterType<LiveContentConfig["collections"][C]["loader"]>;
183-
type LiveLoaderCollectionFilterType<
184-
C extends keyof LiveContentConfig["collections"],
185-
> = ExtractCollectionFilterType<
186-
LiveContentConfig["collections"][C]["loader"]
144+
type LiveLoaderEntryFilterType<C extends keyof LiveContentConfig['collections']> =
145+
ExtractEntryFilterType<LiveContentConfig['collections'][C]['loader']>;
146+
type LiveLoaderCollectionFilterType<C extends keyof LiveContentConfig['collections']> =
147+
ExtractCollectionFilterType<LiveContentConfig['collections'][C]['loader']>;
148+
type LiveLoaderErrorType<C extends keyof LiveContentConfig['collections']> = ExtractErrorType<
149+
LiveContentConfig['collections'][C]['loader']
187150
>;
188-
type LiveLoaderErrorType<C extends keyof LiveContentConfig["collections"]> =
189-
ExtractErrorType<LiveContentConfig["collections"][C]["loader"]>;
190151

191152
export type ContentConfig = never;
192153
export type LiveContentConfig = never;

.astro/types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/// <reference types="astro/client" />
2-
/// <reference path="content.d.ts" />
2+
/// <reference path="content.d.ts" />

Source/Workbench/Browser.astro

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ import NLS from "./NLS.astro";
66
<NLS />
77

88
<!-- Browser Workbench Script -->
9+
<!-- Dynamic import matches the pattern used by Mountain.astro, BrowserTest.astro,
10+
BrowserProxy/Workbench.ts, and Electron/Workbench.ts. Static imports cause
11+
Rollup to hard-fail at build time (cannot resolve package specifiers).
12+
Dynamic imports only warn on resolution failure and allow the build to complete. -->
913
<script>
10-
import "@codeeditorland/output/vs/code/browser/workbench/workbench.js";
14+
await import(
15+
"@codeeditorland/output/vs/code/browser/workbench/workbench.js"
16+
);
1117
</script>
1218
</Fragment>

astro.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ export default defineConfig({
7272
external: [
7373
...External,
7474
(id: string) =>
75+
// Pre-resolved package specifier — catches @codeeditorland/output/vs/**
76+
// before Rollup attempts resolution. Static imports of unresolved
77+
// package specifiers are hard build errors; dynamic imports warn only.
78+
id.startsWith("@codeeditorland/output/vs/") ||
79+
// Resolved absolute path (after symlink + package.json exports map)
7580
id.includes(
7681
"/@codeeditorland/output/Target/Microsoft/VSCode/vs/",
7782
) ||

0 commit comments

Comments
 (0)