@ox-content/vite-plugin-svelte 3.1.2-beta.0 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,7 @@
1
- import { PluginOption } from "vite";
2
- import { HeadInput, OxContentOptions, RenderIslandFn, RenderedHead, oxContent, renderHead } from "@ox-content/vite-plugin";
1
+ import { C as SvelteHtmlHostModuleIdResolver, S as SvelteHtmlHostInitIslands, _ as SvelteHtmlHostClientRuntimeLoader, a as createSvelteHtmlHostDomRenderer, b as SvelteHtmlHostDomRuntime, c as InitSvelteHtmlHostInput, d as SvelteHtmlHostClientDiagnosticCode, f as SvelteHtmlHostClientError, g as SvelteHtmlHostClientRenderer, h as SvelteHtmlHostClientModules, i as SvelteHtmlHostDomRenderer, l as SvelteHtmlHostClientComponentValue, m as SvelteHtmlHostClientModuleValue, n as initSvelteHtmlHost, o as loadSvelteHtmlHostDomRuntime, p as SvelteHtmlHostClientModuleLoader, r as readSvelteHtmlHostSlot, s as CreateSvelteHtmlHostLazyHydrateInput, t as createSvelteHtmlHostLazyHydrate, u as SvelteHtmlHostClientContext, v as SvelteHtmlHostDomMode, x as SvelteHtmlHostExportNameResolver, y as SvelteHtmlHostDomRendererInput } from "./html-host-client.cjs";
2
+ import { Plugin, PluginOption } from "vite";
3
+ import { CollectionEntry, DocumentImportDiagnostic, HeadInput, MdxImport, MdxImport as MdxImport$1, MdxImportSpecifier, MdxImportSpecifierKind, OxContentOptions, RenderIslandFn, RenderedHead, oxContent, renderHead } from "@ox-content/vite-plugin";
4
+ import { CompileOptions, Warning } from "svelte/compiler";
3
5
  //#region src/types.d.ts
4
6
  /**
5
7
  * Code annotation options for the Svelte integration.
@@ -31,6 +33,25 @@ type ComponentsMap = Record<string, string>;
31
33
  * `configResolved`.
32
34
  */
33
35
  type ComponentsOption = ComponentsMap | string | string[];
36
+ type SvelteCompilerWarning = Warning;
37
+ interface SvelteCompilerOptions extends Omit<CompileOptions, "filename" | "generate" | "runes"> {
38
+ filename: string;
39
+ generate: "client" | "server";
40
+ runes: boolean;
41
+ }
42
+ interface SvelteCompilerJsOutput {
43
+ code: string;
44
+ map?: unknown;
45
+ }
46
+ interface SvelteCompilerObjectResult {
47
+ js: SvelteCompilerJsOutput | string;
48
+ warnings?: readonly SvelteCompilerWarning[];
49
+ }
50
+ type SvelteCompilerResult = SvelteCompilerObjectResult | string;
51
+ type SvelteCompileFunction = (source: string, options: SvelteCompilerOptions) => SvelteCompilerResult | Promise<SvelteCompilerResult>;
52
+ type SvelteCompilerOption = SvelteCompileFunction | {
53
+ compile: SvelteCompileFunction;
54
+ };
34
55
  /**
35
56
  * Opt-in build-time props for MDX documents imported as Svelte components.
36
57
  *
@@ -90,6 +111,16 @@ interface SvelteIntegrationOptions extends OxContentOptions {
90
111
  * @default true
91
112
  */
92
113
  runes?: boolean;
114
+ /**
115
+ * Compiler used for Markdown/MDX-generated Svelte modules.
116
+ *
117
+ * The default is `svelte/compiler`. Pass the same compiler used by an
118
+ * alternative Svelte Vite integration to keep ordinary `.svelte` files and
119
+ * Ox Content-generated document modules on the same compiler implementation.
120
+ *
121
+ * @default `svelte/compiler`
122
+ */
123
+ compiler?: SvelteCompilerOption;
93
124
  /**
94
125
  * Built-in static embeds rendered during Markdown transformation.
95
126
  *
@@ -206,6 +237,7 @@ interface ResolvedSvelteOptions {
206
237
  codeAnnotations: ResolvedCodeAnnotationsOptions;
207
238
  components: ComponentsMap;
208
239
  runes: boolean;
240
+ compiler?: SvelteCompilerOption;
209
241
  embeds: ResolvedBuiltinEmbedOptions;
210
242
  mdx?: boolean;
211
243
  root?: string;
@@ -215,7 +247,8 @@ interface ResolvedSvelteOptions {
215
247
  }
216
248
  interface SvelteTransformResult {
217
249
  code: string;
218
- map: null;
250
+ map: unknown;
251
+ warnings: SvelteCompilerWarning[];
219
252
  usedComponents: string[];
220
253
  frontmatter: Record<string, unknown>;
221
254
  }
@@ -227,6 +260,156 @@ interface ComponentIsland {
227
260
  content?: string;
228
261
  }
229
262
  //#endregion
263
+ //#region src/html-host.d.ts
264
+ interface SvelteHtmlHostModule {
265
+ name: string;
266
+ serverModuleId: string;
267
+ exportName: string;
268
+ source: "document" | "components";
269
+ clientModuleId?: string;
270
+ }
271
+ interface SvelteHtmlHostClientModule {
272
+ name: string;
273
+ moduleId: string;
274
+ exportName: string;
275
+ }
276
+ type SvelteHtmlHostDiagnosticCode = DocumentImportDiagnostic["code"] | "missing-component" | "module-load-failed" | "missing-export" | "ssr-failed";
277
+ interface SvelteHtmlHostDiagnostic {
278
+ code: SvelteHtmlHostDiagnosticCode;
279
+ message: string;
280
+ documentPath: string;
281
+ component?: string;
282
+ moduleId?: string;
283
+ }
284
+ type SvelteServerModuleLoader = (moduleId: string) => Promise<unknown>;
285
+ type SvelteHtmlComponentRenderer = (component: unknown, props: Record<string, unknown>, slotHtml: string | undefined, context: {
286
+ component: string;
287
+ moduleId: string;
288
+ documentPath: string;
289
+ }) => string | Promise<string>;
290
+ type SvelteClientModuleResolver = (module: SvelteHtmlHostModule, context: {
291
+ documentPath: string;
292
+ }) => string | undefined;
293
+ interface RenderSvelteHtmlHostInput {
294
+ html: string;
295
+ documentPath: string;
296
+ components?: ComponentsMap;
297
+ imports?: readonly MdxImport$1[];
298
+ root?: string;
299
+ srcDir?: string;
300
+ contentRoot?: string;
301
+ loadModule: SvelteServerModuleLoader;
302
+ renderComponent?: SvelteHtmlComponentRenderer;
303
+ resolveClientModule?: SvelteClientModuleResolver;
304
+ }
305
+ interface RenderSvelteHtmlHostResult {
306
+ html: string;
307
+ modules: SvelteHtmlHostModule[];
308
+ clientModules: SvelteHtmlHostClientModule[];
309
+ diagnostics: SvelteHtmlHostDiagnostic[];
310
+ }
311
+ type SvelteHostHydrateRenderer = (component: unknown, props: Record<string, unknown>, element: HTMLElement, slotHtml: string | undefined) => void | (() => void);
312
+ interface CreateSvelteHtmlHostHydrateInput {
313
+ components: Readonly<Record<string, unknown>> | ReadonlyMap<string, unknown>;
314
+ render: SvelteHostHydrateRenderer;
315
+ }
316
+ declare function renderSvelteHtmlHost(input: RenderSvelteHtmlHostInput): Promise<RenderSvelteHtmlHostResult>;
317
+ declare function createSvelteHtmlHostHydrate(input: CreateSvelteHtmlHostHydrateInput): (element: HTMLElement, props: Record<string, unknown>) => void | (() => void);
318
+ //#endregion
319
+ //#region src/html-host-renderer.d.ts
320
+ type SvelteHtmlHostRendererDiagnosticPolicy = "throw" | "collect";
321
+ interface CreateSvelteHtmlHostRendererInput {
322
+ root?: string;
323
+ srcDir?: string;
324
+ contentRoot?: string;
325
+ components?: ComponentsMap;
326
+ loadModule: SvelteServerModuleLoader;
327
+ renderComponent?: SvelteHtmlComponentRenderer;
328
+ resolveClientModule?: SvelteClientModuleResolver;
329
+ diagnostics?: SvelteHtmlHostRendererDiagnosticPolicy;
330
+ }
331
+ interface SvelteHtmlHostRendererContext {
332
+ documentPath: string;
333
+ imports?: readonly MdxImport$1[];
334
+ root?: string;
335
+ srcDir?: string;
336
+ contentRoot?: string;
337
+ components?: ComponentsMap;
338
+ renderComponent?: SvelteHtmlComponentRenderer;
339
+ resolveClientModule?: SvelteClientModuleResolver;
340
+ }
341
+ type SvelteHtmlHostRenderer = (html: string, context: SvelteHtmlHostRendererContext) => Promise<RenderSvelteHtmlHostResult>;
342
+ declare class SvelteHtmlHostRenderError extends Error {
343
+ readonly diagnostics: SvelteHtmlHostDiagnostic[];
344
+ constructor(diagnostics: readonly SvelteHtmlHostDiagnostic[]);
345
+ }
346
+ declare function createSvelteHtmlHostRenderer(input: CreateSvelteHtmlHostRendererInput): SvelteHtmlHostRenderer;
347
+ //#endregion
348
+ //#region src/html-host-collection-documents.d.ts
349
+ type MaybePromise$1<T> = T | Promise<T>;
350
+ interface SvelteHtmlHostCollectionDocument extends SvelteHtmlHostIslandDocument {
351
+ collection: string;
352
+ entry: CollectionEntry;
353
+ frontmatter: Record<string, unknown>;
354
+ path: string;
355
+ source: string;
356
+ }
357
+ interface SvelteHtmlHostCollectionDocumentsOptions {
358
+ oxContent?: OxContentOptions;
359
+ collections?: string | readonly string[];
360
+ select?: (document: SvelteHtmlHostCollectionDocument, context: SvelteHtmlHostIslandRegistryContext) => MaybePromise$1<boolean>;
361
+ }
362
+ declare function createSvelteHtmlHostCollectionDocuments(input?: SvelteHtmlHostCollectionDocumentsOptions): (context: SvelteHtmlHostIslandRegistryContext) => Promise<readonly SvelteHtmlHostCollectionDocument[]>;
363
+ declare function resolveSvelteHtmlHostCollectionDocuments(input: SvelteHtmlHostCollectionDocumentsOptions, context: SvelteHtmlHostIslandRegistryContext): Promise<readonly SvelteHtmlHostCollectionDocument[]>;
364
+ //#endregion
365
+ //#region src/html-host-registry-paths.d.ts
366
+ declare function toSvelteHtmlHostClientModuleId(moduleId: string, root?: string): string;
367
+ //#endregion
368
+ //#region src/html-host-registry.d.ts
369
+ declare const SVELTE_HTML_HOST_MODULES_VIRTUAL_ID = "virtual:ox-content-svelte/html-host/modules";
370
+ type MaybePromise<T> = T | Promise<T>;
371
+ interface SvelteHtmlHostIslandDocument {
372
+ documentPath: string;
373
+ source?: string;
374
+ html?: string;
375
+ imports?: readonly MdxImport$1[];
376
+ components?: ComponentsMap;
377
+ dependencies?: readonly string[];
378
+ }
379
+ interface SvelteHtmlHostIslandEntry {
380
+ moduleId: string;
381
+ name?: string;
382
+ exportName?: string;
383
+ documentPath?: string;
384
+ }
385
+ interface SvelteHtmlHostIslandRegistryContext {
386
+ root: string;
387
+ mode: string;
388
+ command: "build" | "serve";
389
+ }
390
+ interface CreateSvelteHtmlHostIslandRegistryInput {
391
+ documents?: readonly SvelteHtmlHostIslandDocument[] | ((context: SvelteHtmlHostIslandRegistryContext) => MaybePromise<readonly SvelteHtmlHostIslandDocument[]>);
392
+ collectionDocuments?: false | SvelteHtmlHostCollectionDocumentsOptions;
393
+ entries?: readonly SvelteHtmlHostIslandEntry[] | ((context: SvelteHtmlHostIslandRegistryContext) => MaybePromise<readonly SvelteHtmlHostIslandEntry[]>);
394
+ components?: ComponentsOption;
395
+ oxContent?: OxContentOptions;
396
+ root?: string;
397
+ watch?: readonly string[];
398
+ virtualModuleId?: string;
399
+ }
400
+ interface ResolvedSvelteHtmlHostIslandRegistry {
401
+ modules: SvelteHtmlHostClientModule[];
402
+ watchFiles: string[];
403
+ }
404
+ interface SvelteHtmlHostIslandRegistry {
405
+ plugin: Plugin;
406
+ virtualModuleId: string;
407
+ resolve(): Promise<ResolvedSvelteHtmlHostIslandRegistry>;
408
+ resolveClientModule(module: Pick<SvelteHtmlHostModule, "serverModuleId">): string;
409
+ }
410
+ declare function createSvelteHtmlHostIslandRegistry(input?: CreateSvelteHtmlHostIslandRegistryInput): SvelteHtmlHostIslandRegistry;
411
+ declare function resolveSvelteHtmlHostIslandRegistry(input: CreateSvelteHtmlHostIslandRegistryInput, context: SvelteHtmlHostIslandRegistryContext, resolvedComponents?: ComponentsMap): Promise<ResolvedSvelteHtmlHostIslandRegistry>;
412
+ //#endregion
230
413
  //#region src/index.d.ts
231
414
  /**
232
415
  * Creates the Ox Content Svelte integration plugin.
@@ -257,5 +440,5 @@ interface ComponentIsland {
257
440
  */
258
441
  declare function oxContentSvelte(options?: SvelteIntegrationOptions): PluginOption[];
259
442
  //#endregion
260
- export { type BuiltinEmbedOptions, type ComponentIsland, type ComponentsMap, type ComponentsOption, type GitHubEmbedOptions, type HeadInput, type MdxDocumentPropsOption, type OpenGraphEmbedOptions, type RenderedHead, type ResolvedBuiltinEmbedOptions, type ResolvedSvelteOptions, type SvelteIntegrationOptions, type SvelteTransformResult, oxContent, oxContentSvelte, renderHead };
443
+ export { type BuiltinEmbedOptions, type ComponentIsland, type ComponentsMap, type ComponentsOption, type CreateSvelteHtmlHostHydrateInput, type CreateSvelteHtmlHostIslandRegistryInput, type CreateSvelteHtmlHostLazyHydrateInput, type CreateSvelteHtmlHostRendererInput, type GitHubEmbedOptions, type HeadInput, type InitSvelteHtmlHostInput, type MdxDocumentPropsOption, type MdxImport, type MdxImportSpecifier, type MdxImportSpecifierKind, type OpenGraphEmbedOptions, type RenderSvelteHtmlHostInput, type RenderSvelteHtmlHostResult, type RenderedHead, type ResolvedBuiltinEmbedOptions, type ResolvedSvelteHtmlHostIslandRegistry, type ResolvedSvelteOptions, SVELTE_HTML_HOST_MODULES_VIRTUAL_ID, type SvelteClientModuleResolver, type SvelteCompileFunction, type SvelteCompilerOption, type SvelteCompilerOptions, type SvelteCompilerResult, type SvelteCompilerWarning, type SvelteHostHydrateRenderer, type SvelteHtmlComponentRenderer, type SvelteHtmlHostClientComponentValue, type SvelteHtmlHostClientContext, type SvelteHtmlHostClientDiagnosticCode, type SvelteHtmlHostClientError, type SvelteHtmlHostClientModule, type SvelteHtmlHostClientModuleLoader, type SvelteHtmlHostClientModuleValue, type SvelteHtmlHostClientModules, type SvelteHtmlHostClientRenderer, type SvelteHtmlHostClientRuntimeLoader, type SvelteHtmlHostCollectionDocument, type SvelteHtmlHostCollectionDocumentsOptions, type SvelteHtmlHostDiagnostic, type SvelteHtmlHostDiagnosticCode, type SvelteHtmlHostDomMode, type SvelteHtmlHostDomRenderer, type SvelteHtmlHostDomRendererInput, type SvelteHtmlHostDomRuntime, type SvelteHtmlHostExportNameResolver, type SvelteHtmlHostInitIslands, type SvelteHtmlHostIslandDocument, type SvelteHtmlHostIslandEntry, type SvelteHtmlHostIslandRegistry, type SvelteHtmlHostIslandRegistryContext, type SvelteHtmlHostModule, type SvelteHtmlHostModuleIdResolver, SvelteHtmlHostRenderError, type SvelteHtmlHostRenderer, type SvelteHtmlHostRendererContext, type SvelteHtmlHostRendererDiagnosticPolicy, type SvelteIntegrationOptions, type SvelteServerModuleLoader, type SvelteTransformResult, createSvelteHtmlHostCollectionDocuments, createSvelteHtmlHostDomRenderer, createSvelteHtmlHostHydrate, createSvelteHtmlHostIslandRegistry, createSvelteHtmlHostLazyHydrate, createSvelteHtmlHostRenderer, initSvelteHtmlHost, loadSvelteHtmlHostDomRuntime, oxContent, oxContentSvelte, readSvelteHtmlHostSlot, renderHead, renderSvelteHtmlHost, resolveSvelteHtmlHostCollectionDocuments, resolveSvelteHtmlHostIslandRegistry, toSvelteHtmlHostClientModuleId };
261
444
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;;;;;;UAQiB;;;;;;EAMf;;UAGe;EACf;EACA;;;;;KAMU,gBAAgB;;;;;;;;KAShB,mBAAmB;;;;;;;;KASnB;;;;;;;;UASK,iCAAiC;;;;;;;;EAQhD;;;;;;;;;;;;;;;;;;EAmBA,aAAa;;;;;;;;EASb,4BAA4B;;;;;;;;;EAU5B;;;;;;;;;EAUA,SAAS;;;;;;;EAQT,eAAe;;;;;;;;;;;;EAaf,mBAAmB;;;;;UAMJ;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf,mBAAmB;;;;;EAMnB,sBAAsB;;UAGP;EACf,QAAQ;EACR,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB,YAAY;EACZ;EACA,QAAQ;EACR;EACA;EACA,eAAe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA,aAAa;;UAGE;EACf;EACA,OAAO;EACP;EACA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBC3Jc,gBAAgB,UAAS,2BAAgC"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/html-host.ts","../src/html-host-renderer.ts","../src/html-host-collection-documents.ts","../src/html-host-registry-paths.ts","../src/html-host-registry.ts","../src/index.ts"],"mappings":";;;;;;;;;;;UASiB;;;;;;EAMf;;UAGe;EACf;EACA;;;;;KAMU,gBAAgB;;;;;;;;KAShB,mBAAmB;KAEnB,wBAAwB;UAE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
- import { HeadInput, OxContentOptions, RenderIslandFn, RenderedHead, oxContent, renderHead } from "@ox-content/vite-plugin";
2
- import { PluginOption } from "vite";
1
+ import { C as SvelteHtmlHostModuleIdResolver, S as SvelteHtmlHostInitIslands, _ as SvelteHtmlHostClientRuntimeLoader, a as createSvelteHtmlHostDomRenderer, b as SvelteHtmlHostDomRuntime, c as InitSvelteHtmlHostInput, d as SvelteHtmlHostClientDiagnosticCode, f as SvelteHtmlHostClientError, g as SvelteHtmlHostClientRenderer, h as SvelteHtmlHostClientModules, i as SvelteHtmlHostDomRenderer, l as SvelteHtmlHostClientComponentValue, m as SvelteHtmlHostClientModuleValue, n as initSvelteHtmlHost, o as loadSvelteHtmlHostDomRuntime, p as SvelteHtmlHostClientModuleLoader, r as readSvelteHtmlHostSlot, s as CreateSvelteHtmlHostLazyHydrateInput, t as createSvelteHtmlHostLazyHydrate, u as SvelteHtmlHostClientContext, v as SvelteHtmlHostDomMode, x as SvelteHtmlHostExportNameResolver, y as SvelteHtmlHostDomRendererInput } from "./html-host-client.mjs";
2
+ import { CollectionEntry, DocumentImportDiagnostic, HeadInput, MdxImport, MdxImport as MdxImport$1, MdxImportSpecifier, MdxImportSpecifierKind, OxContentOptions, RenderIslandFn, RenderedHead, oxContent, renderHead } from "@ox-content/vite-plugin";
3
+ import { CompileOptions, Warning } from "svelte/compiler";
4
+ import { Plugin, PluginOption } from "vite";
3
5
  //#region src/types.d.ts
4
6
  /**
5
7
  * Code annotation options for the Svelte integration.
@@ -31,6 +33,25 @@ type ComponentsMap = Record<string, string>;
31
33
  * `configResolved`.
32
34
  */
33
35
  type ComponentsOption = ComponentsMap | string | string[];
36
+ type SvelteCompilerWarning = Warning;
37
+ interface SvelteCompilerOptions extends Omit<CompileOptions, "filename" | "generate" | "runes"> {
38
+ filename: string;
39
+ generate: "client" | "server";
40
+ runes: boolean;
41
+ }
42
+ interface SvelteCompilerJsOutput {
43
+ code: string;
44
+ map?: unknown;
45
+ }
46
+ interface SvelteCompilerObjectResult {
47
+ js: SvelteCompilerJsOutput | string;
48
+ warnings?: readonly SvelteCompilerWarning[];
49
+ }
50
+ type SvelteCompilerResult = SvelteCompilerObjectResult | string;
51
+ type SvelteCompileFunction = (source: string, options: SvelteCompilerOptions) => SvelteCompilerResult | Promise<SvelteCompilerResult>;
52
+ type SvelteCompilerOption = SvelteCompileFunction | {
53
+ compile: SvelteCompileFunction;
54
+ };
34
55
  /**
35
56
  * Opt-in build-time props for MDX documents imported as Svelte components.
36
57
  *
@@ -90,6 +111,16 @@ interface SvelteIntegrationOptions extends OxContentOptions {
90
111
  * @default true
91
112
  */
92
113
  runes?: boolean;
114
+ /**
115
+ * Compiler used for Markdown/MDX-generated Svelte modules.
116
+ *
117
+ * The default is `svelte/compiler`. Pass the same compiler used by an
118
+ * alternative Svelte Vite integration to keep ordinary `.svelte` files and
119
+ * Ox Content-generated document modules on the same compiler implementation.
120
+ *
121
+ * @default `svelte/compiler`
122
+ */
123
+ compiler?: SvelteCompilerOption;
93
124
  /**
94
125
  * Built-in static embeds rendered during Markdown transformation.
95
126
  *
@@ -206,6 +237,7 @@ interface ResolvedSvelteOptions {
206
237
  codeAnnotations: ResolvedCodeAnnotationsOptions;
207
238
  components: ComponentsMap;
208
239
  runes: boolean;
240
+ compiler?: SvelteCompilerOption;
209
241
  embeds: ResolvedBuiltinEmbedOptions;
210
242
  mdx?: boolean;
211
243
  root?: string;
@@ -215,7 +247,8 @@ interface ResolvedSvelteOptions {
215
247
  }
216
248
  interface SvelteTransformResult {
217
249
  code: string;
218
- map: null;
250
+ map: unknown;
251
+ warnings: SvelteCompilerWarning[];
219
252
  usedComponents: string[];
220
253
  frontmatter: Record<string, unknown>;
221
254
  }
@@ -227,6 +260,156 @@ interface ComponentIsland {
227
260
  content?: string;
228
261
  }
229
262
  //#endregion
263
+ //#region src/html-host.d.ts
264
+ interface SvelteHtmlHostModule {
265
+ name: string;
266
+ serverModuleId: string;
267
+ exportName: string;
268
+ source: "document" | "components";
269
+ clientModuleId?: string;
270
+ }
271
+ interface SvelteHtmlHostClientModule {
272
+ name: string;
273
+ moduleId: string;
274
+ exportName: string;
275
+ }
276
+ type SvelteHtmlHostDiagnosticCode = DocumentImportDiagnostic["code"] | "missing-component" | "module-load-failed" | "missing-export" | "ssr-failed";
277
+ interface SvelteHtmlHostDiagnostic {
278
+ code: SvelteHtmlHostDiagnosticCode;
279
+ message: string;
280
+ documentPath: string;
281
+ component?: string;
282
+ moduleId?: string;
283
+ }
284
+ type SvelteServerModuleLoader = (moduleId: string) => Promise<unknown>;
285
+ type SvelteHtmlComponentRenderer = (component: unknown, props: Record<string, unknown>, slotHtml: string | undefined, context: {
286
+ component: string;
287
+ moduleId: string;
288
+ documentPath: string;
289
+ }) => string | Promise<string>;
290
+ type SvelteClientModuleResolver = (module: SvelteHtmlHostModule, context: {
291
+ documentPath: string;
292
+ }) => string | undefined;
293
+ interface RenderSvelteHtmlHostInput {
294
+ html: string;
295
+ documentPath: string;
296
+ components?: ComponentsMap;
297
+ imports?: readonly MdxImport$1[];
298
+ root?: string;
299
+ srcDir?: string;
300
+ contentRoot?: string;
301
+ loadModule: SvelteServerModuleLoader;
302
+ renderComponent?: SvelteHtmlComponentRenderer;
303
+ resolveClientModule?: SvelteClientModuleResolver;
304
+ }
305
+ interface RenderSvelteHtmlHostResult {
306
+ html: string;
307
+ modules: SvelteHtmlHostModule[];
308
+ clientModules: SvelteHtmlHostClientModule[];
309
+ diagnostics: SvelteHtmlHostDiagnostic[];
310
+ }
311
+ type SvelteHostHydrateRenderer = (component: unknown, props: Record<string, unknown>, element: HTMLElement, slotHtml: string | undefined) => void | (() => void);
312
+ interface CreateSvelteHtmlHostHydrateInput {
313
+ components: Readonly<Record<string, unknown>> | ReadonlyMap<string, unknown>;
314
+ render: SvelteHostHydrateRenderer;
315
+ }
316
+ declare function renderSvelteHtmlHost(input: RenderSvelteHtmlHostInput): Promise<RenderSvelteHtmlHostResult>;
317
+ declare function createSvelteHtmlHostHydrate(input: CreateSvelteHtmlHostHydrateInput): (element: HTMLElement, props: Record<string, unknown>) => void | (() => void);
318
+ //#endregion
319
+ //#region src/html-host-renderer.d.ts
320
+ type SvelteHtmlHostRendererDiagnosticPolicy = "throw" | "collect";
321
+ interface CreateSvelteHtmlHostRendererInput {
322
+ root?: string;
323
+ srcDir?: string;
324
+ contentRoot?: string;
325
+ components?: ComponentsMap;
326
+ loadModule: SvelteServerModuleLoader;
327
+ renderComponent?: SvelteHtmlComponentRenderer;
328
+ resolveClientModule?: SvelteClientModuleResolver;
329
+ diagnostics?: SvelteHtmlHostRendererDiagnosticPolicy;
330
+ }
331
+ interface SvelteHtmlHostRendererContext {
332
+ documentPath: string;
333
+ imports?: readonly MdxImport$1[];
334
+ root?: string;
335
+ srcDir?: string;
336
+ contentRoot?: string;
337
+ components?: ComponentsMap;
338
+ renderComponent?: SvelteHtmlComponentRenderer;
339
+ resolveClientModule?: SvelteClientModuleResolver;
340
+ }
341
+ type SvelteHtmlHostRenderer = (html: string, context: SvelteHtmlHostRendererContext) => Promise<RenderSvelteHtmlHostResult>;
342
+ declare class SvelteHtmlHostRenderError extends Error {
343
+ readonly diagnostics: SvelteHtmlHostDiagnostic[];
344
+ constructor(diagnostics: readonly SvelteHtmlHostDiagnostic[]);
345
+ }
346
+ declare function createSvelteHtmlHostRenderer(input: CreateSvelteHtmlHostRendererInput): SvelteHtmlHostRenderer;
347
+ //#endregion
348
+ //#region src/html-host-collection-documents.d.ts
349
+ type MaybePromise$1<T> = T | Promise<T>;
350
+ interface SvelteHtmlHostCollectionDocument extends SvelteHtmlHostIslandDocument {
351
+ collection: string;
352
+ entry: CollectionEntry;
353
+ frontmatter: Record<string, unknown>;
354
+ path: string;
355
+ source: string;
356
+ }
357
+ interface SvelteHtmlHostCollectionDocumentsOptions {
358
+ oxContent?: OxContentOptions;
359
+ collections?: string | readonly string[];
360
+ select?: (document: SvelteHtmlHostCollectionDocument, context: SvelteHtmlHostIslandRegistryContext) => MaybePromise$1<boolean>;
361
+ }
362
+ declare function createSvelteHtmlHostCollectionDocuments(input?: SvelteHtmlHostCollectionDocumentsOptions): (context: SvelteHtmlHostIslandRegistryContext) => Promise<readonly SvelteHtmlHostCollectionDocument[]>;
363
+ declare function resolveSvelteHtmlHostCollectionDocuments(input: SvelteHtmlHostCollectionDocumentsOptions, context: SvelteHtmlHostIslandRegistryContext): Promise<readonly SvelteHtmlHostCollectionDocument[]>;
364
+ //#endregion
365
+ //#region src/html-host-registry-paths.d.ts
366
+ declare function toSvelteHtmlHostClientModuleId(moduleId: string, root?: string): string;
367
+ //#endregion
368
+ //#region src/html-host-registry.d.ts
369
+ declare const SVELTE_HTML_HOST_MODULES_VIRTUAL_ID = "virtual:ox-content-svelte/html-host/modules";
370
+ type MaybePromise<T> = T | Promise<T>;
371
+ interface SvelteHtmlHostIslandDocument {
372
+ documentPath: string;
373
+ source?: string;
374
+ html?: string;
375
+ imports?: readonly MdxImport$1[];
376
+ components?: ComponentsMap;
377
+ dependencies?: readonly string[];
378
+ }
379
+ interface SvelteHtmlHostIslandEntry {
380
+ moduleId: string;
381
+ name?: string;
382
+ exportName?: string;
383
+ documentPath?: string;
384
+ }
385
+ interface SvelteHtmlHostIslandRegistryContext {
386
+ root: string;
387
+ mode: string;
388
+ command: "build" | "serve";
389
+ }
390
+ interface CreateSvelteHtmlHostIslandRegistryInput {
391
+ documents?: readonly SvelteHtmlHostIslandDocument[] | ((context: SvelteHtmlHostIslandRegistryContext) => MaybePromise<readonly SvelteHtmlHostIslandDocument[]>);
392
+ collectionDocuments?: false | SvelteHtmlHostCollectionDocumentsOptions;
393
+ entries?: readonly SvelteHtmlHostIslandEntry[] | ((context: SvelteHtmlHostIslandRegistryContext) => MaybePromise<readonly SvelteHtmlHostIslandEntry[]>);
394
+ components?: ComponentsOption;
395
+ oxContent?: OxContentOptions;
396
+ root?: string;
397
+ watch?: readonly string[];
398
+ virtualModuleId?: string;
399
+ }
400
+ interface ResolvedSvelteHtmlHostIslandRegistry {
401
+ modules: SvelteHtmlHostClientModule[];
402
+ watchFiles: string[];
403
+ }
404
+ interface SvelteHtmlHostIslandRegistry {
405
+ plugin: Plugin;
406
+ virtualModuleId: string;
407
+ resolve(): Promise<ResolvedSvelteHtmlHostIslandRegistry>;
408
+ resolveClientModule(module: Pick<SvelteHtmlHostModule, "serverModuleId">): string;
409
+ }
410
+ declare function createSvelteHtmlHostIslandRegistry(input?: CreateSvelteHtmlHostIslandRegistryInput): SvelteHtmlHostIslandRegistry;
411
+ declare function resolveSvelteHtmlHostIslandRegistry(input: CreateSvelteHtmlHostIslandRegistryInput, context: SvelteHtmlHostIslandRegistryContext, resolvedComponents?: ComponentsMap): Promise<ResolvedSvelteHtmlHostIslandRegistry>;
412
+ //#endregion
230
413
  //#region src/index.d.ts
231
414
  /**
232
415
  * Creates the Ox Content Svelte integration plugin.
@@ -257,5 +440,5 @@ interface ComponentIsland {
257
440
  */
258
441
  declare function oxContentSvelte(options?: SvelteIntegrationOptions): PluginOption[];
259
442
  //#endregion
260
- export { type BuiltinEmbedOptions, type ComponentIsland, type ComponentsMap, type ComponentsOption, type GitHubEmbedOptions, type HeadInput, type MdxDocumentPropsOption, type OpenGraphEmbedOptions, type RenderedHead, type ResolvedBuiltinEmbedOptions, type ResolvedSvelteOptions, type SvelteIntegrationOptions, type SvelteTransformResult, oxContent, oxContentSvelte, renderHead };
443
+ export { type BuiltinEmbedOptions, type ComponentIsland, type ComponentsMap, type ComponentsOption, type CreateSvelteHtmlHostHydrateInput, type CreateSvelteHtmlHostIslandRegistryInput, type CreateSvelteHtmlHostLazyHydrateInput, type CreateSvelteHtmlHostRendererInput, type GitHubEmbedOptions, type HeadInput, type InitSvelteHtmlHostInput, type MdxDocumentPropsOption, type MdxImport, type MdxImportSpecifier, type MdxImportSpecifierKind, type OpenGraphEmbedOptions, type RenderSvelteHtmlHostInput, type RenderSvelteHtmlHostResult, type RenderedHead, type ResolvedBuiltinEmbedOptions, type ResolvedSvelteHtmlHostIslandRegistry, type ResolvedSvelteOptions, SVELTE_HTML_HOST_MODULES_VIRTUAL_ID, type SvelteClientModuleResolver, type SvelteCompileFunction, type SvelteCompilerOption, type SvelteCompilerOptions, type SvelteCompilerResult, type SvelteCompilerWarning, type SvelteHostHydrateRenderer, type SvelteHtmlComponentRenderer, type SvelteHtmlHostClientComponentValue, type SvelteHtmlHostClientContext, type SvelteHtmlHostClientDiagnosticCode, type SvelteHtmlHostClientError, type SvelteHtmlHostClientModule, type SvelteHtmlHostClientModuleLoader, type SvelteHtmlHostClientModuleValue, type SvelteHtmlHostClientModules, type SvelteHtmlHostClientRenderer, type SvelteHtmlHostClientRuntimeLoader, type SvelteHtmlHostCollectionDocument, type SvelteHtmlHostCollectionDocumentsOptions, type SvelteHtmlHostDiagnostic, type SvelteHtmlHostDiagnosticCode, type SvelteHtmlHostDomMode, type SvelteHtmlHostDomRenderer, type SvelteHtmlHostDomRendererInput, type SvelteHtmlHostDomRuntime, type SvelteHtmlHostExportNameResolver, type SvelteHtmlHostInitIslands, type SvelteHtmlHostIslandDocument, type SvelteHtmlHostIslandEntry, type SvelteHtmlHostIslandRegistry, type SvelteHtmlHostIslandRegistryContext, type SvelteHtmlHostModule, type SvelteHtmlHostModuleIdResolver, SvelteHtmlHostRenderError, type SvelteHtmlHostRenderer, type SvelteHtmlHostRendererContext, type SvelteHtmlHostRendererDiagnosticPolicy, type SvelteIntegrationOptions, type SvelteServerModuleLoader, type SvelteTransformResult, createSvelteHtmlHostCollectionDocuments, createSvelteHtmlHostDomRenderer, createSvelteHtmlHostHydrate, createSvelteHtmlHostIslandRegistry, createSvelteHtmlHostLazyHydrate, createSvelteHtmlHostRenderer, initSvelteHtmlHost, loadSvelteHtmlHostDomRuntime, oxContent, oxContentSvelte, readSvelteHtmlHostSlot, renderHead, renderSvelteHtmlHost, resolveSvelteHtmlHostCollectionDocuments, resolveSvelteHtmlHostIslandRegistry, toSvelteHtmlHostClientModuleId };
261
444
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/index.ts"],"mappings":";;;;;;;;;UAQiB;;;;;;EAMf;;UAGe;EACf;EACA;;;;;KAMU,gBAAgB;;;;;;;;KAShB,mBAAmB;;;;;;;;KASnB;;;;;;;;UASK,iCAAiC;;;;;;;;EAQhD;;;;;;;;;;;;;;;;;;EAmBA,aAAa;;;;;;;;EASb,4BAA4B;;;;;;;;;EAU5B;;;;;;;;;EAUA,SAAS;;;;;;;EAQT,eAAe;;;;;;;;;;;;EAaf,mBAAmB;;;;;UAMJ;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;;;;EAKf,mBAAmB;;;;;EAMnB,sBAAsB;;UAGP;EACf,QAAQ;EACR,WAAW;;UAGI;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB;EACjB,YAAY;EACZ;EACA,QAAQ;EACR;EACA;EACA,eAAe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA,aAAa;;UAGE;EACf;EACA,OAAO;EACP;EACA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBC3Jc,gBAAgB,UAAS,2BAAgC"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/html-host.ts","../src/html-host-renderer.ts","../src/html-host-collection-documents.ts","../src/html-host-registry-paths.ts","../src/html-host-registry.ts","../src/index.ts"],"mappings":";;;;;;;;;;;UASiB;;;;;;EAMf;;UAGe;EACf;EACA;;;;;KAMU,gBAAgB;;;;;;;;KAShB,mBAAmB;KAEnB,wBAAwB;UAEnB,8BAA8B,KAC7C;EAGA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf,IAAI;EACJ,oBAAoB;;KAGV,uBAAuB;KAEvB,yBACV,gBACA,SAAS,0BACN,uBAAuB,QAAQ;KAExB,uBACR;EAEE,SA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