alepha 0.7.1 → 0.7.2

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/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _alepha_core from '@alepha/core';
2
2
  import { TSchema as TSchema$1, KIND, OPTIONS, Static as Static$1, Async, Alepha, Service, TObject as TObject$1 } from '@alepha/core';
3
- import { ServerRoute, ApiLinksResponse, HttpClient, ClientScope, HttpVirtualClient, ServerRouterProvider, ServerTimingProvider, ServerHandler, ServerRequest } from '@alepha/server';
3
+ import { ServerRoute, ServerRequest, ApiLinksResponse, HttpClient, ClientScope, HttpVirtualClient, ServerRouterProvider, ServerTimingProvider, ServerHandler } from '@alepha/server';
4
4
  import * as React from 'react';
5
5
  import React__default, { PropsWithChildren, ReactNode, FC, ErrorInfo, AnchorHTMLAttributes } from 'react';
6
6
  import { Root } from 'react-dom/client';
@@ -227,6 +227,7 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
227
227
  * If true, the page will be rendered on the client-side.
228
228
  */
229
229
  client?: boolean | ClientOnlyProps;
230
+ afterHandler?: (request: ServerRequest) => any;
230
231
  }
231
232
  interface PageDescriptor<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
232
233
  [KIND]: typeof KEY;
@@ -296,11 +297,11 @@ interface PageRequestConfig<TConfig extends PageConfigSchema = PageConfigSchema>
296
297
  }
297
298
  type PageResolve<TConfig extends PageConfigSchema = PageConfigSchema, TPropsParent extends object = TPropsParentDefault> = PageRequestConfig<TConfig> & TPropsParent & PageReactContext;
298
299
 
299
- declare const envSchema$2: _alepha_core.TObject<{
300
+ declare const envSchema$1: _alepha_core.TObject<{
300
301
  REACT_STRICT_MODE: TBoolean;
301
302
  }>;
302
303
  declare module "alepha" {
303
- interface Env extends Partial<Static$1<typeof envSchema$2>> {
304
+ interface Env extends Partial<Static$1<typeof envSchema$1>> {
304
305
  }
305
306
  }
306
307
  declare class PageDescriptorProvider {
@@ -445,22 +446,12 @@ declare class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
445
446
  root(state: RouterState, context: PageReactContext): ReactNode;
446
447
  }
447
448
 
448
- declare const envSchema$1: _alepha_core.TObject<{
449
- REACT_ROOT_ID: TString;
450
- }>;
451
- declare module "alepha/core" {
452
- interface Env extends Partial<Static$1<typeof envSchema$1>> {
453
- }
454
- }
455
449
  declare class ReactBrowserProvider {
456
450
  protected readonly log: _alepha_core.Logger;
457
451
  protected readonly client: HttpClient;
458
452
  protected readonly alepha: Alepha;
459
453
  protected readonly router: BrowserRouterProvider;
460
454
  protected readonly headProvider: BrowserHeadProvider;
461
- protected readonly env: {
462
- REACT_ROOT_ID: string;
463
- };
464
455
  protected root: Root;
465
456
  transitioning?: {
466
457
  to: string;
@@ -470,11 +461,6 @@ declare class ReactBrowserProvider {
470
461
  get history(): History;
471
462
  get url(): string;
472
463
  invalidate(props?: Record<string, any>): Promise<void>;
473
- /**
474
- *
475
- * @param url
476
- * @param options
477
- */
478
464
  go(url: string, options?: RouterGoOptions): Promise<void>;
479
465
  protected render(options?: {
480
466
  url?: string;
@@ -482,19 +468,8 @@ declare class ReactBrowserProvider {
482
468
  }): Promise<RouterRenderResult>;
483
469
  /**
484
470
  * Get embedded layers from the server.
485
- *
486
- * @protected
487
471
  */
488
472
  protected getHydrationState(): ReactHydrationState | undefined;
489
- /**
490
- *
491
- * @protected
492
- */
493
- protected getRootElement(): HTMLElement;
494
- /**
495
- *
496
- * @protected
497
- */
498
473
  readonly ready: _alepha_core.HookDescriptor<"ready">;
499
474
  readonly onTransitionEnd: _alepha_core.HookDescriptor<"react:transition:end">;
500
475
  }
@@ -542,30 +517,11 @@ declare class RouterHookApi {
542
517
  constructor(pages: PageRoute[], state: RouterState, layer: {
543
518
  path: string;
544
519
  }, browser?: ReactBrowserProvider | undefined);
545
- /**
546
- *
547
- */
548
520
  get current(): RouterState;
549
- /**
550
- *
551
- */
552
521
  get pathname(): string;
553
- /**
554
- *
555
- */
556
522
  get query(): Record<string, string>;
557
- /**
558
- *
559
- */
560
523
  back(): Promise<void>;
561
- /**
562
- *
563
- */
564
524
  forward(): Promise<void>;
565
- /**
566
- *
567
- * @param props
568
- */
569
525
  invalidate(props?: Record<string, any>): Promise<void>;
570
526
  /**
571
527
  * Create a valid href for the given pathname.
@@ -716,7 +672,7 @@ declare const envSchema: TObject<{
716
672
  REACT_SSR_ENABLED: TOptional<TBoolean>;
717
673
  REACT_ROOT_ID: TString;
718
674
  }>;
719
- declare module "@alepha/core" {
675
+ declare module "alepha/core" {
720
676
  interface Env extends Partial<Static$1<typeof envSchema>> {
721
677
  }
722
678
  interface State {
@@ -734,9 +690,9 @@ declare class ReactServerProvider {
734
690
  protected readonly serverTimingProvider: ServerTimingProvider;
735
691
  protected readonly env: {
736
692
  REACT_SSR_ENABLED?: boolean | undefined;
737
- REACT_ROOT_ID: string;
738
693
  REACT_SERVER_DIST: string;
739
694
  REACT_SERVER_PREFIX: string;
695
+ REACT_ROOT_ID: string;
740
696
  };
741
697
  protected readonly ROOT_DIV_REGEX: RegExp;
742
698
  readonly onConfigure: _alepha_core.HookDescriptor<"configure">;
package/redis.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ import * as _redis_client from '@redis/client';
2
+ import { createClient, SetOptions } from '@redis/client';
1
3
  import * as _alepha_core from '@alepha/core';
2
4
  import { Static, Alepha } from '@alepha/core';
3
- import * as Redis from 'ioredis';
4
- import Redis__default, { RedisOptions } from 'ioredis';
5
5
 
6
6
  /** Symbol key applied to readonly types */
7
7
  declare const ReadonlyKind: unique symbol;
@@ -89,7 +89,9 @@ declare module "alepha" {
89
89
  interface Env extends Partial<Static<typeof envSchema>> {
90
90
  }
91
91
  }
92
- type RedisClient = Redis__default;
92
+ type RedisClient = ReturnType<typeof createClient>;
93
+ type RedisClientOptions = Parameters<typeof createClient>[0];
94
+ type RedisSetOptions = SetOptions;
93
95
  declare class RedisProvider {
94
96
  protected readonly log: _alepha_core.Logger;
95
97
  protected readonly alepha: Alepha;
@@ -98,7 +100,7 @@ declare class RedisProvider {
98
100
  REDIS_PORT: number;
99
101
  REDIS_HOST: string;
100
102
  };
101
- protected readonly client: Redis__default;
103
+ protected readonly client: _redis_client.RedisClientType<_redis_client.RedisModules, _redis_client.RedisFunctions, _redis_client.RedisScripts, _redis_client.RespVersions, _redis_client.TypeMapping>;
102
104
  get publisher(): RedisClient;
103
105
  protected readonly start: _alepha_core.HookDescriptor<"start">;
104
106
  protected readonly stop: _alepha_core.HookDescriptor<"stop">;
@@ -110,7 +112,7 @@ declare class RedisProvider {
110
112
  * Close the connection to the Redis server.
111
113
  */
112
114
  close(): Promise<void>;
113
- duplicate(options?: Partial<RedisOptions>): RedisClient;
115
+ duplicate(options?: Partial<RedisClientOptions>): RedisClient;
114
116
  /**
115
117
  * Redis subscriber client factory method.
116
118
  */
@@ -121,16 +123,16 @@ declare class RedisSubscriberProvider {
121
123
  protected readonly log: _alepha_core.Logger;
122
124
  protected readonly alepha: Alepha;
123
125
  protected readonly redisProvider: RedisProvider;
124
- protected readonly client: Redis.default;
126
+ protected readonly client: _redis_client.RedisClientType<_redis_client.RedisModules, _redis_client.RedisFunctions, _redis_client.RedisScripts, _redis_client.RespVersions, _redis_client.TypeMapping>;
125
127
  get subscriber(): RedisClient;
126
128
  protected readonly start: _alepha_core.HookDescriptor<"start">;
127
129
  protected readonly stop: _alepha_core.HookDescriptor<"stop">;
128
130
  connect(): Promise<void>;
129
- close(): void;
131
+ close(): Promise<void>;
130
132
  /**
131
133
  * Redis subscriber client factory method.
132
134
  */
133
135
  protected createClient(): RedisClient;
134
136
  }
135
137
 
136
- export { type RedisClient, RedisProvider, RedisSubscriberProvider };
138
+ export { type RedisClient, type RedisClientOptions, RedisProvider, type RedisSetOptions, RedisSubscriberProvider };
package/topic.d.ts CHANGED
@@ -184,38 +184,21 @@ declare class RedisTopicProvider implements TopicProvider {
184
184
  };
185
185
  protected readonly redisProvider: RedisProvider;
186
186
  protected readonly redisSubscriberProvider: RedisSubscriberProvider;
187
- protected readonly subscriptions: Record<string, SubscribeCallback[]>;
188
187
  protected readonly log: _alepha_core.Logger;
189
- protected readonly start: _alepha_core.HookDescriptor<"start">;
190
188
  protected readonly stop: _alepha_core.HookDescriptor<"stop">;
191
189
  prefix(queue: string): string;
192
190
  /**
193
191
  * Publish a message to a topic.
194
- *
195
- * @param topic
196
- * @param message
197
192
  */
198
193
  publish(topic: string, message: string): Promise<void>;
199
194
  /**
200
195
  * Subscribe to a topic.
201
- *
202
- * @param name
203
- * @param callback
204
196
  */
205
197
  subscribe(name: string, callback: SubscribeCallback): Promise<UnSubscribeFn>;
206
198
  /**
207
199
  * Unsubscribe from a topic.
208
- *
209
- * @param name
210
- * @param callback
211
200
  */
212
201
  unsubscribe(name: string, callback?: SubscribeCallback): Promise<void>;
213
- /**
214
- * Listen for messages.
215
- *
216
- * @protected
217
- */
218
- protected listen(): void;
219
202
  }
220
203
 
221
204
  declare class TopicDescriptorProvider {
package/vite.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Alepha } from '@alepha/core';
2
- import viteReactPlugin from '@vitejs/plugin-react';
3
2
  import { UserConfig, Plugin } from 'vite';
3
+ import { BrotliOptions, ZlibOptions } from 'node:zlib';
4
4
 
5
5
  interface ViteAlephaBuildOptions {
6
6
  /**
@@ -21,6 +21,7 @@ interface ViteAlephaBuildOptions {
21
21
  * Vite server options to override the default server configuration.
22
22
  */
23
23
  server?: false | UserConfig;
24
+ client?: false;
24
25
  /**
25
26
  * If true, all compatible pages will be pre-rendered.
26
27
  */
@@ -70,10 +71,39 @@ declare function viteAlephaBuildVercel(opts?: ViteAlephaBuildVercelOptions): {
70
71
  writeBundle(): void;
71
72
  };
72
73
 
73
- declare const viteReact: typeof viteReactPlugin;
74
+ interface ViteCompressOptions {
75
+ /**
76
+ * If true, the plugin will not compress the files.
77
+ *
78
+ * @default false
79
+ */
80
+ disabled?: boolean;
81
+ /**
82
+ * If true, the plugin will compress the files using brotli.
83
+ * Can also be an object with brotli options.
84
+ *
85
+ * @default true
86
+ */
87
+ brotli?: boolean | BrotliOptions;
88
+ /**
89
+ * If true, the plugin will compress the files using gzip.
90
+ * Can also be an object with gzip options.
91
+ *
92
+ * @default true
93
+ */
94
+ gzip?: boolean | ZlibOptions;
95
+ /**
96
+ * A filter to determine which files to compress.
97
+ * Can be a RegExp or a function that returns true for files to compress.
98
+ *
99
+ * @default /\.(js|mjs|cjs|css|wasm|svg)$/
100
+ */
101
+ filter?: RegExp | ((fileName: string) => boolean);
102
+ }
103
+ declare function viteCompress(options?: ViteCompressOptions): Plugin;
74
104
 
75
105
  declare global {
76
106
  var __alepha: Alepha;
77
107
  }
78
108
 
79
- export { type ViteAlephaBuildOptions, type ViteAlephaBuildVercelOptions, type ViteAlephaDevOptions, type ViteAlephaOptions, viteAlepha, viteAlephaBuild, viteAlephaBuildVercel, viteAlephaDev, viteReact };
109
+ export { type ViteAlephaBuildOptions, type ViteAlephaBuildVercelOptions, type ViteAlephaDevOptions, type ViteAlephaOptions, type ViteCompressOptions, viteAlepha, viteAlephaBuild, viteAlephaBuildVercel, viteAlephaDev, viteCompress };
package/server/proxy.cjs DELETED
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- var serverProxy = require('@alepha/server-proxy');
4
-
5
-
6
-
7
- Object.keys(serverProxy).forEach(function (k) {
8
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
- enumerable: true,
10
- get: function () { return serverProxy[k]; }
11
- });
12
- });
package/server/proxy.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from '@alepha/server-proxy';
package/server/proxy.js DELETED
@@ -1 +0,0 @@
1
- export * from '@alepha/server-proxy';
@@ -1 +0,0 @@
1
- export * from "@alepha/server-proxy";