owebjs 1.0.1 → 1.0.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/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-JSRKSHP6.js +1 -0
- package/dist/chunk-VLHAZXJ6.js +1 -0
- package/dist/chunk-Z23QA6PX.js +1 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +1 -1
- package/dist/utils/assignRoutes.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 +13 -0
- package/dist/chunk-HOV6IKC4.js +0 -1
- package/tsup.config.ts +0 -16
|
@@ -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 as h}from"./chunk-OR3GJT5E.js";import{d as u,e as m}from"./chunk-XR5MHIBF.js";import{a as i}from"./chunk-2HA4XQFN.js";import c from"node:path";import{dirname as p}from"node:path";import{fileURLToPath as d}from"node:url";var g=p(d(import.meta.url)),w=i(async r=>{let n=[];for(let t of r){let s=c.parse(t.rel),e=t.filePath.replaceAll("\\","/"),a=new URL(c.resolve(e),`file://${g}`).pathname.replaceAll("\\","/"),l=u(s),o=m(l),f=await import(a);n.push({url:o.url,method:o.method,fn:f?.default,fileInfo:t})}return n},"generateRoutes"),U=i(async(r,n)=>{let t=await h(r),s=await w(t);for(let e of s)n[e.method](e.url,function(a,l){if(e.fileInfo.hooks.length)for(let o=0;o<e.fileInfo.hooks.length;o++){let f=e.fileInfo.hooks[o];new f().handle(a,l,()=>{o+1==e.fileInfo.hooks.length&&new e.fn(...arguments).handle(...arguments)})}else new e.fn(...arguments).handle(...arguments)})},"assignRoutes");export{w as a,U 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,23 @@
|
|
|
1
1
|
import { FastifyInstance as FastifyInstance$1 } from 'fastify';
|
|
2
2
|
|
|
3
|
+
interface ListenOptions {
|
|
4
|
+
port: string | number;
|
|
5
|
+
host?: string;
|
|
6
|
+
}
|
|
7
|
+
interface OwebOptions {
|
|
8
|
+
uWebSocketsEnabled: boolean;
|
|
9
|
+
}
|
|
3
10
|
interface FastifyInstance extends FastifyInstance$1 {
|
|
4
11
|
}
|
|
5
12
|
declare class FastifyInstance {
|
|
6
13
|
constructor();
|
|
7
14
|
}
|
|
8
15
|
declare class Oweb extends FastifyInstance {
|
|
9
|
-
constructor();
|
|
16
|
+
constructor(options?: OwebOptions);
|
|
10
17
|
loadRoutes({ routeDir }: {
|
|
11
18
|
routeDir: any;
|
|
12
19
|
}): Promise<void>;
|
|
20
|
+
start(listenOptions?: ListenOptions): Promise<unknown>;
|
|
13
21
|
}
|
|
14
22
|
|
|
15
23
|
export { Oweb as default };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
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 +1 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b}from"../chunk-JSRKSHP6.js";import"../chunk-OR3GJT5E.js";import"../chunk-XR5MHIBF.js";import"../chunk-2HA4XQFN.js";export{b as assignRoutes,a as generateRoutes};
|
|
@@ -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.3",
|
|
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,13 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
fs.readdirSync('node_modules/uWebSockets.js').forEach((file) => {
|
|
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
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
package/dist/chunk-HOV6IKC4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as c}from"./chunk-OR3GJT5E.js";import{d as h,e as u}from"./chunk-XR5MHIBF.js";import{a as i}from"./chunk-2HA4XQFN.js";import m from"node:path";import{dirname as p}from"node:path";import{fileURLToPath as d}from"node:url";var g=p(d(import.meta.url)),w=i(async r=>{let n=[];for(let t of r){let l=m.parse(t.rel),o=t.filePath.replaceAll("\\","/"),s=new URL(m.resolve(o),`file://${g}`).pathname.replaceAll("\\","/"),a=h(l),e=u(a),f=await import(s);n.push({url:e.url,method:e.method,fn:f?.default,fileInfo:t})}return n},"generateRoutes"),U=i(async(r,n)=>{let t=await c(r),l=await w(t);for(let o of l)n[o.method](o.url,function(s,a){if(o.fileInfo.hooks.length)for(let e=0;e<o.fileInfo.hooks.length;e++){let f=o.fileInfo.hooks[e];new f().handle(s,a,()=>{e+1==o.fileInfo.hooks.length&&new o.fn().handle(...arguments)})}else new o.fn().handle(...arguments)})},"assignRoutes");export{w as a,U as b};
|
package/tsup.config.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'tsup';
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
target: "esnext",
|
|
5
|
-
dts: {
|
|
6
|
-
resolve: true,
|
|
7
|
-
entry: './src/index.ts',
|
|
8
|
-
},
|
|
9
|
-
keepNames: true,
|
|
10
|
-
entryPoints: ['./src/**/*.ts'],
|
|
11
|
-
clean: true,
|
|
12
|
-
format: 'esm',
|
|
13
|
-
splitting: true,
|
|
14
|
-
minify: true,
|
|
15
|
-
config: 'tsconfig.json',
|
|
16
|
-
});
|