owebjs 1.0.2 → 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 +1 -1
- package/dist/chunk-2D3NDWTU.js +1 -0
- package/dist/chunk-2WXLF7QU.js +1 -0
- package/dist/chunk-7JAXN5IF.js +1 -0
- package/dist/chunk-ARAMBVQ3.js +1 -0
- package/dist/chunk-VLHAZXJ6.js +1 -0
- package/dist/chunk-Z23QA6PX.js +1 -0
- package/dist/index.d.ts +17 -10
- package/dist/index.js +1 -1
- package/dist/uwebsocket/request.js +1 -0
- package/dist/uwebsocket/response.js +1 -0
- package/dist/uwebsocket/responseSocket.js +1 -0
- package/dist/uwebsocket/server.js +1 -0
- package/dist/uwebsocket/utils/object.js +1 -0
- package/dist/uwebsocket/utils/string.js +1 -0
- package/dist/uws_darwin_arm64_108.node +0 -0
- package/dist/uws_darwin_arm64_83.node +0 -0
- package/dist/uws_darwin_arm64_93.node +0 -0
- package/dist/uws_darwin_x64_108.node +0 -0
- package/dist/uws_darwin_x64_83.node +0 -0
- package/dist/uws_darwin_x64_93.node +0 -0
- package/dist/uws_linux_arm64_108.node +0 -0
- package/dist/uws_linux_arm64_83.node +0 -0
- package/dist/uws_linux_arm64_93.node +0 -0
- package/dist/uws_linux_x64_108.node +0 -0
- package/dist/uws_linux_x64_83.node +0 -0
- package/dist/uws_linux_x64_93.node +0 -0
- package/dist/uws_win32_x64_108.node +0 -0
- package/dist/uws_win32_x64_83.node +0 -0
- package/dist/uws_win32_x64_93.node +0 -0
- package/package.json +32 -32
- package/scripts/copyBinaries.js +11 -0
package/README.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as n}from"./chunk-2HA4XQFN.js";var h=n((c,o)=>{let t=Object.keys(c);for(let e=0,s=t.length;e<s;e++)o(c[t[e]],t[e])},"forEach");export{h as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as h}from"./chunk-2D3NDWTU.js";import{a}from"./chunk-2HA4XQFN.js";import{Readable as d}from"stream";var r=class extends d{static{a(this,"HttpRequest")}req;res;url;method;statusCode;statusMessage;body;headers;socket;constructor(s){super();let t=s.getQuery();this.req=s,this.url=s.getUrl()+(t?"?"+t:""),this.method=s.getMethod().toUpperCase(),this.statusCode=null,this.statusMessage=null,this.body={},this.headers={},this.socket={},s.forEach((e,o)=>{this.headers[e]=o})}getRawHeaders(){let s=[];return h(this.headers,(t,e)=>{s.push(t,e)}),s}getRaw(){return this.req}_read(s){return this.slice(0,s)}};export{r as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s}from"./chunk-2HA4XQFN.js";var e=class{static{s(this,"HttpResponseSocket")}uResponse;constructor(r){this.uResponse=r}get remoteAddress(){return Buffer.from(this.uResponse.getRemoteAddressAsText()).toString()}destroy(){return this.uResponse.end()}};export{e as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-2HA4XQFN.js";var r=o(t=>t+"","toString"),e=o(t=>r(t).toLowerCase(),"toLowerCase");export{r as a,e as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-2WXLF7QU.js";import{a as p}from"./chunk-Z23QA6PX.js";import{a as u}from"./chunk-2HA4XQFN.js";import E from"uWebSockets.js";import{EventEmitter as k}from"node:events";var q="request";function v({cert_file_name:d,key_file_name:h}){let m="App";d&&h&&(m="SSLApp");let c=u((i,n)=>{n.statusCode=404,n.statusMessage="Not Found",n.end()},"handler"),g={cert_file_name:d,key_file_name:h},o=E[m](g).any("/*",(i,n)=>{i.finished=!1;let e=new a(n),t=new p(i,o);e.res=t,t.req=e,e.socket=t.socket,e.method!=="HEAD"?i.onData((r,f)=>{let S=Buffer.from(r);return f?(e.push(S),e.push(null),i.finished?void 0:c(e,t)):e.push(S)}):i.finished||c(e,t)}),y=class extends k{static{u(this,"uServerClass")}constructor(){super();let n=this.on.bind(this),e=this.once.bind(this);this.once=function(t,s){return e(t,s)},this.on=function(t,s){if(t===q){c=s;return}return n(t,s)}}close(n){if(E.us_listen_socket_close(o._socket),!!n)return n()}start(n,e,t){let s,r=u(function(f){o._socket=f,t&&t(f)},"callbackFunction");return n&&e&&t&&(s=[n,e,r]),!t&&(!e||typeof e=="function")&&(t=e,e=n,s=[e,r]),o.listen(...s)}listen(n,e,t){if(typeof n=="object"){let s=n;return e=s.port,t=s.cb,n=s.host,this.start(n,e,r=>{o._socket=r,t&&t(r)})}else return(!e||typeof e=="function")&&!t?(t=e,e=n,this.start(e,t)):this.start(n,e,t)}get uwsApp(){return o}},l=new y;return l[Symbol("IncomingMessage")]=a,l[Symbol("ServerResponse")]=p,l}u(v,"default");export{v as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-7JAXN5IF.js";import{b as r}from"./chunk-ARAMBVQ3.js";import{a as i}from"./chunk-2HA4XQFN.js";import{Writable as d}from"stream";var h=class extends d{static{i(this,"HttpResponse")}res;req;server;statusCode;statusMessage;__headers;headersSent;socket;finished;constructor(e,s){super(),this.res=e,this.server=s,this.statusCode=200,this.statusMessage="OK",this.__headers={},this.headersSent=!1,this.socket=new a(e),this.res.onAborted(()=>{this.finished=this.res.finished=!0})}setHeader(e,s){this.__headers[r(e)]=s}getHeaderNames(){return Object.keys(this.__headers)}getHeaders(){return Object.assign({},this.__headers)}getHeader(e){return this.__headers[r(e)]}hasHeader(e){return!!this.__headers[r(e)]}removeHeader(e){delete this.__headers[r(e)]}write(e){this.finished||this.res.write(e)}writeHead(e){if(this.finished)return;this.statusCode=e;let s;arguments.length===2?s=arguments[1]:arguments.length===3?(this.statusMessage=arguments[1],s=arguments[2]):s={},Object.keys(s).forEach(t=>{this.setHeader(t,s[t])})}end(e){if(this.finished)return;function s(t){t.res.writeStatus(`${t.statusCode} ${t.statusMessage}`),t.finished=!0,t.res.end(e)}return i(s,"doWrite"),e?s(this):(e="",s(this))}getRaw(){return this.res}};export{h as a};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FastifyServerOptions, FastifyListenOptions, FastifyInstance } from 'fastify';
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface OwebOptions extends FastifyServerOptions {
|
|
4
|
+
uWebSocketsEnabled?: boolean;
|
|
4
5
|
}
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
interface LoadRoutesOptions {
|
|
7
|
+
directory: string;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
interface _FastifyInstance extends FastifyInstance {
|
|
10
|
+
}
|
|
11
|
+
declare class _FastifyInstance {
|
|
12
|
+
}
|
|
13
|
+
declare class Oweb extends _FastifyInstance {
|
|
14
|
+
constructor(options?: OwebOptions);
|
|
15
|
+
loadRoutes({ directory }: LoadRoutesOptions): Promise<void>;
|
|
16
|
+
start(listenOptions?: FastifyListenOptions): Promise<{
|
|
17
|
+
err: Error;
|
|
18
|
+
address: string;
|
|
19
|
+
}>;
|
|
13
20
|
}
|
|
14
21
|
|
|
15
|
-
export { Oweb as default };
|
|
22
|
+
export { LoadRoutesOptions, OwebOptions, Oweb as default };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-2WXLF7QU.js";import"../chunk-2D3NDWTU.js";import"../chunk-2HA4XQFN.js";export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-Z23QA6PX.js";import"../chunk-7JAXN5IF.js";import"../chunk-ARAMBVQ3.js";import"../chunk-2HA4XQFN.js";export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-7JAXN5IF.js";import"../chunk-2HA4XQFN.js";export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../chunk-VLHAZXJ6.js";import"../chunk-2WXLF7QU.js";import"../chunk-2D3NDWTU.js";import"../chunk-Z23QA6PX.js";import"../chunk-7JAXN5IF.js";import"../chunk-ARAMBVQ3.js";import"../chunk-2HA4XQFN.js";export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-2D3NDWTU.js";import"../../chunk-2HA4XQFN.js";export{a as forEach};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"../../chunk-ARAMBVQ3.js";import"../../chunk-2HA4XQFN.js";export{b as toLowerCase,a as toString};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "owebjs",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"start": "node .",
|
|
9
|
-
"build": "tsup",
|
|
10
|
-
"dev": "tsup && node .",
|
|
11
|
-
"test": "tsup && node test/index.js",
|
|
12
|
-
"format": "prettier --write . --ignore-path .gitignore"
|
|
13
|
-
},
|
|
14
|
-
"keywords": [],
|
|
15
|
-
"author": "owebjs",
|
|
16
|
-
"license": "MIT",
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"fastify": "^4.23.2",
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"@
|
|
24
|
-
"@types/
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
},
|
|
31
|
-
"type": "module"
|
|
32
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "owebjs",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "node .",
|
|
9
|
+
"build": "tsup",
|
|
10
|
+
"dev": "tsup && node .",
|
|
11
|
+
"test": "tsup && node scripts/copyBinaries && node test/index.js",
|
|
12
|
+
"format": "prettier --write . --ignore-path .gitignore"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "owebjs",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"fastify": "^4.23.2",
|
|
19
|
+
"jsonwebtoken": "^9.0.2"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@swc/core": "^1.3.85",
|
|
23
|
+
"@types/jsonwebtoken": "^9.0.3",
|
|
24
|
+
"@types/node": "^20.6.2",
|
|
25
|
+
"prettier": "^3.0.3",
|
|
26
|
+
"tslib": "^2.6.2",
|
|
27
|
+
"tsup": "^7.2.0",
|
|
28
|
+
"typescript": "^5.2.2",
|
|
29
|
+
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.10.0"
|
|
30
|
+
},
|
|
31
|
+
"type": "module"
|
|
32
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
for (const file of fs.readdirSync('node_modules/uWebSockets.js')) {
|
|
5
|
+
if (file.endsWith('.node')) {
|
|
6
|
+
fs.copyFileSync(
|
|
7
|
+
path.resolve('node_modules/uWebSockets.js/' + file),
|
|
8
|
+
path.resolve('dist/' + file),
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
}
|