@absolutejs/absolute 0.19.0-beta.725 → 0.19.0-beta.726

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.
@@ -6,18 +6,15 @@ export type SveltePageRenderOptions = {
6
6
  bodyContent?: string;
7
7
  headContent?: string;
8
8
  } & StreamingSlotEnhancerOptions;
9
+ type HasNoSvelteProps<Props> = [Props] extends [never] ? true : keyof Props extends never ? true : false;
9
10
  export type SveltePageRequestInput<Component extends SvelteComponent<never> = SvelteComponent<Record<never, never>>> = SveltePageRenderOptions & {
10
11
  indexPath: string;
11
12
  pagePath: string;
12
- } & (keyof SveltePropsOf<Component> extends never ? {
13
+ } & (HasNoSvelteProps<SveltePropsOf<Component>> extends true ? {
13
14
  props?: NoInfer<SveltePropsOf<Component>>;
14
15
  } : {
15
16
  props: NoInfer<SveltePropsOf<Component>>;
16
17
  });
17
- export type HandleSveltePageRequest = {
18
- <Component extends SvelteComponent<never>>(input: SveltePageRequestInput<Component>): Promise<Response>;
19
- (PageComponent: SvelteComponent<Record<string, never>>, pagePath: string, indexPath: string): Promise<Response>;
20
- <P extends Record<string, unknown>>(PageComponent: SvelteComponent<P>, pagePath: string, indexPath: string, props: NoInfer<P>, options?: SveltePageRenderOptions): Promise<Response>;
21
- };
22
- export declare const handleSveltePageRequest: HandleSveltePageRequest;
18
+ export declare function handleSveltePageRequest<Component extends SvelteComponent<never>>(input: SveltePageRequestInput<Component>): Promise<Response>;
23
19
  export declare const invalidateSvelteSsrCache: () => void;
20
+ export {};
@@ -8,6 +8,7 @@ export type VuePageRequestInput<Component extends VueComponent> = VuePageRenderO
8
8
  headTag?: `<head>${string}</head>`;
9
9
  indexPath: string;
10
10
  pagePath: string;
11
+ Page?: Component;
11
12
  } & (keyof VuePropsOf<Component> extends never ? {
12
13
  props?: NoInfer<VuePropsOf<Component>>;
13
14
  } : {
@@ -15,16 +16,7 @@ export type VuePageRequestInput<Component extends VueComponent> = VuePageRenderO
15
16
  });
16
17
  export type HandleVuePageRequest = {
17
18
  <Component extends VueComponent>(input: VuePageRequestInput<Component>): Promise<Response>;
18
- <Component extends VueComponent>(PageComponent: Component, pagePath: string, indexPath: string, headTag: `<head>${string}</head>` | undefined, ...args: VuePageHandlerArgs<Component>): Promise<Response>;
19
19
  };
20
- type VuePageHandlerArgs<Component extends VueComponent> = keyof VuePropsOf<Component> extends never ? [
21
- props?: NoInfer<VuePropsOf<Component>>,
22
- options?: VuePageRenderOptions
23
- ] : [
24
- props: NoInfer<VuePropsOf<Component>>,
25
- options?: VuePageRenderOptions
26
- ];
27
20
  export declare function handleVuePageRequest<Component extends VueComponent>(input: VuePageRequestInput<Component>): Promise<Response>;
28
- export declare function handleVuePageRequest<Component extends VueComponent>(PageComponent: Component, pagePath: string, indexPath: string, headTag: `<head>${string}</head>` | undefined, ...args: VuePageHandlerArgs<Component>): Promise<Response>;
29
21
  export declare const invalidateVueSsrCache: () => void;
30
22
  export {};
@@ -3420,26 +3420,15 @@ var buildDirtyResponse = (indexPath, props) => {
3420
3420
  headers: { "Content-Type": "text/html" }
3421
3421
  });
3422
3422
  };
3423
- var handleSveltePageRequest = async (PageComponentOrInput, pagePath, indexPath, props, options) => {
3424
- const {
3425
- PageComponent,
3426
- indexPath: resolvedIndexPath,
3427
- options: resolvedOptions,
3428
- pagePath: resolvedPagePath,
3429
- props: resolvedProps
3430
- } = typeof PageComponentOrInput === "object" && PageComponentOrInput !== null && "pagePath" in PageComponentOrInput && "indexPath" in PageComponentOrInput ? {
3431
- indexPath: PageComponentOrInput.indexPath,
3432
- options: PageComponentOrInput,
3433
- PageComponent: undefined,
3434
- pagePath: PageComponentOrInput.pagePath,
3435
- props: PageComponentOrInput.props
3436
- } : {
3437
- indexPath: indexPath ?? "",
3438
- options,
3439
- PageComponent: PageComponentOrInput,
3440
- pagePath: pagePath ?? "",
3441
- props
3442
- };
3423
+ var isSveltePageRequestInput = (value) => isRecord2(value) && typeof value.pagePath === "string" && typeof value.indexPath === "string";
3424
+ async function handleSveltePageRequest(input) {
3425
+ if (!isSveltePageRequestInput(input)) {
3426
+ throw new Error("Svelte page handler requires an object input with pagePath and indexPath.");
3427
+ }
3428
+ const resolvedIndexPath = input.indexPath;
3429
+ const resolvedOptions = input;
3430
+ const resolvedPagePath = input.pagePath;
3431
+ const resolvedProps = input.props;
3443
3432
  if (isSsrCacheDirty("svelte")) {
3444
3433
  return buildDirtyResponse(resolvedIndexPath, resolvedProps);
3445
3434
  }
@@ -3447,13 +3436,6 @@ var handleSveltePageRequest = async (PageComponentOrInput, pagePath, indexPath,
3447
3436
  const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
3448
3437
  const renderPageResponse = async () => {
3449
3438
  const resolvePageComponent = async () => {
3450
- const passedPageComponent = PageComponent;
3451
- if (isGenericSvelteComponent(passedPageComponent)) {
3452
- return {
3453
- component: passedPageComponent,
3454
- hasIslands: readHasIslands(passedPageComponent)
3455
- };
3456
- }
3457
3439
  const loadCompiledSourcePath = async (sourcePath) => {
3458
3440
  const compiledModulePath = await compileSvelteServerModule(sourcePath);
3459
3441
  const loadedModule = await import(compiledModulePath);
@@ -3466,9 +3448,6 @@ var handleSveltePageRequest = async (PageComponentOrInput, pagePath, indexPath,
3466
3448
  hasIslands: readHasIslands(loadedModule)
3467
3449
  };
3468
3450
  };
3469
- if (typeof passedPageComponent === "string" && passedPageComponent.endsWith(".svelte")) {
3470
- return loadCompiledSourcePath(passedPageComponent);
3471
- }
3472
3451
  const importedPageModule = await import(resolvedPagePath);
3473
3452
  const importedPageComponent = readDefaultExport(importedPageModule) ?? importedPageModule;
3474
3453
  if (typeof importedPageComponent === "string" && importedPageComponent.endsWith(".svelte")) {
@@ -3511,7 +3490,7 @@ var handleSveltePageRequest = async (PageComponentOrInput, pagePath, indexPath,
3511
3490
  status: 500
3512
3491
  });
3513
3492
  }
3514
- };
3493
+ }
3515
3494
  // src/svelte/createIsland.ts
3516
3495
  init_renderIslandMarkup();
3517
3496
  var createTypedIsland = (registry) => (props) => renderIslandMarkup(registry, props);
@@ -3653,5 +3632,5 @@ export {
3653
3632
  createTypedIsland
3654
3633
  };
3655
3634
 
3656
- //# debugId=8C08249E88F7242164756E2164756E21
3635
+ //# debugId=713C0D721CCC402864756E2164756E21
3657
3636
  //# sourceMappingURL=index.js.map