owebjs 1.0.3 → 1.0.4

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Oweb
2
2
 
3
- Flexible route handler that built on top of Fastify
3
+ Flexible handler that built on top of Fastify
4
4
 
5
5
  ## Installation
6
6
 
package/dist/index.d.ts CHANGED
@@ -1,23 +1,22 @@
1
- import { FastifyInstance as FastifyInstance$1 } from 'fastify';
1
+ import { FastifyServerOptions, FastifyListenOptions, FastifyInstance } from 'fastify';
2
2
 
3
- interface ListenOptions {
4
- port: string | number;
5
- host?: string;
3
+ interface OwebOptions extends FastifyServerOptions {
4
+ uWebSocketsEnabled?: boolean;
6
5
  }
7
- interface OwebOptions {
8
- uWebSocketsEnabled: boolean;
6
+ interface LoadRoutesOptions {
7
+ directory: string;
9
8
  }
10
- interface FastifyInstance extends FastifyInstance$1 {
9
+ interface _FastifyInstance extends FastifyInstance {
11
10
  }
12
- declare class FastifyInstance {
13
- constructor();
11
+ declare class _FastifyInstance {
14
12
  }
15
- declare class Oweb extends FastifyInstance {
13
+ declare class Oweb extends _FastifyInstance {
16
14
  constructor(options?: OwebOptions);
17
- loadRoutes({ routeDir }: {
18
- routeDir: any;
19
- }): Promise<void>;
20
- start(listenOptions?: ListenOptions): Promise<unknown>;
15
+ loadRoutes({ directory }: LoadRoutesOptions): Promise<void>;
16
+ start(listenOptions?: FastifyListenOptions): Promise<{
17
+ err: Error;
18
+ address: string;
19
+ }>;
21
20
  }
22
21
 
23
- export { Oweb as default };
22
+ export { LoadRoutesOptions, OwebOptions, Oweb as default };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-VLHAZXJ6.js";import{b as n}from"./chunk-JSRKSHP6.js";import"./chunk-OR3GJT5E.js";import"./chunk-XR5MHIBF.js";import"./chunk-2WXLF7QU.js";import"./chunk-2D3NDWTU.js";import"./chunk-Z23QA6PX.js";import"./chunk-7JAXN5IF.js";import"./chunk-ARAMBVQ3.js";import{a as s}from"./chunk-2HA4XQFN.js";import i from"fastify";var c=a({}),u=s((r,t)=>(c.on("request",r),c),"serverFactory"),e=i(),l=class{static{s(this,"FastifyInstance")}constructor(){Object.assign(this,e)}},o=class extends l{static{s(this,"Oweb")}constructor(t={uWebSocketsEnabled:!1}){super(),t?.uWebSocketsEnabled&&(e=i({serverFactory:u}))}loadRoutes({routeDir:t}){return n(t,e)}start(t={port:3e3,host:"127.0.0.1"}){return new Promise(p=>{e.listen({port:+t.port},p)})}};export{o as default};
1
+ import{a as i}from"./chunk-VLHAZXJ6.js";import{b as n}from"./chunk-JSRKSHP6.js";import"./chunk-OR3GJT5E.js";import"./chunk-XR5MHIBF.js";import"./chunk-2WXLF7QU.js";import"./chunk-2D3NDWTU.js";import"./chunk-Z23QA6PX.js";import"./chunk-7JAXN5IF.js";import"./chunk-ARAMBVQ3.js";import{a as r}from"./chunk-2HA4XQFN.js";import u from"fastify";var a=i({}),f=r((e,t)=>(a.on("request",e),a),"serverFactory"),m=class{static{r(this,"_FastifyInstance")}},o=class extends m{static{r(this,"Oweb")}constructor(t={}){super();let s=t??{};s.uWebSocketsEnabled&&(s.serverFactory=f),Object.assign(this,u(s))}loadRoutes({directory:t}){return n(t,this)}start(t={port:3e3,host:"127.0.0.1"}){return new Promise(s=>{this.listen({port:+t.port},(c,p)=>s({err:c,address:p}))})}};export{o as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owebjs",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,13 +1,11 @@
1
- import fs from 'fs';
2
- import path from 'path';
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
3
 
4
- fs.readdirSync('node_modules/uWebSockets.js').forEach((file) => {
4
+ for (const file of fs.readdirSync('node_modules/uWebSockets.js')) {
5
5
  if (file.endsWith('.node')) {
6
- const source = path.resolve('node_modules/uWebSockets.js/' + file);
7
- const target = path.resolve('dist/' + file);
8
-
9
- fs.copyFile(source, target, (err) => {
10
- if (err) throw err;
11
- });
6
+ fs.copyFileSync(
7
+ path.resolve('node_modules/uWebSockets.js/' + file),
8
+ path.resolve('dist/' + file),
9
+ );
12
10
  }
13
- });
11
+ }