@razvan11/paladin 1.1.0 → 1.1.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.
@@ -20,6 +20,7 @@ export interface LayoutViewProps {
20
20
  head?: ReactNode;
21
21
  /** Inline data to pass to the client */
22
22
  clientData?: Record<string, unknown>;
23
+ favicon?: string;
23
24
  }
24
25
  export declare const LayoutView: FC<LayoutViewProps>;
25
26
  /**
package/dist/index.js CHANGED
@@ -19969,23 +19969,29 @@ class App {
19969
19969
  }
19970
19970
  async run() {
19971
19971
  const self2 = this;
19972
+ const honoFetch = this.app.fetch.bind(this.app);
19973
+ const wsPaths = new Set;
19972
19974
  this.wsHandlers.forEach((_3, path) => {
19973
- this.app.get(path, (c3) => {
19974
- const upgraded = self2.server?.upgrade(c3.req.raw, {
19975
- data: { path }
19976
- });
19977
- if (upgraded) {
19978
- return new Response(null, { status: 101 });
19979
- }
19980
- return c3.text("WebSocket upgrade failed", 400);
19981
- });
19975
+ wsPaths.add(path);
19982
19976
  });
19983
19977
  try {
19984
19978
  const server = Bun.serve({
19985
19979
  port: 3000,
19986
19980
  hostname: "localhost",
19987
19981
  development: false,
19988
- fetch: this.app.fetch,
19982
+ fetch(req, server2) {
19983
+ const url = new URL(req.url);
19984
+ if (wsPaths.has(url.pathname)) {
19985
+ const upgraded = server2.upgrade(req, {
19986
+ data: { path: url.pathname }
19987
+ });
19988
+ if (upgraded) {
19989
+ return;
19990
+ }
19991
+ return new Response("WebSocket upgrade failed", { status: 400 });
19992
+ }
19993
+ return honoFetch(req, server2);
19994
+ },
19989
19995
  websocket: {
19990
19996
  message(ws, message) {
19991
19997
  const wsPath = ws.data?.path;
@@ -21020,7 +21026,8 @@ var LayoutView = ({
21020
21026
  className = "",
21021
21027
  children,
21022
21028
  head,
21023
- clientData
21029
+ clientData,
21030
+ favicon
21024
21031
  }) => {
21025
21032
  return /* @__PURE__ */ jsxDEV2("html", {
21026
21033
  lang: "en",
@@ -21041,6 +21048,10 @@ var LayoutView = ({
21041
21048
  /* @__PURE__ */ jsxDEV2("title", {
21042
21049
  children: title
21043
21050
  }, undefined, false, undefined, this),
21051
+ favicon && /* @__PURE__ */ jsxDEV2("link", {
21052
+ rel: "image/svg+xml",
21053
+ href: favicon
21054
+ }, undefined, false, undefined, this),
21044
21055
  styles3.map((href) => /* @__PURE__ */ jsxDEV2("link", {
21045
21056
  rel: "stylesheet",
21046
21057
  href
package/package.json CHANGED
@@ -1,67 +1,68 @@
1
1
  {
2
- "name": "@razvan11/paladin",
3
- "version": "1.1.0",
4
- "description": "A Bun-based backend framework with decorators, dependency injection, and controller registration",
5
- "keywords": [
6
- "bun",
7
- "backend",
8
- "framework",
9
- "decorators",
10
- "hono",
11
- "inversify",
12
- "dependency-injection"
13
- ],
14
- "license": "MIT",
15
- "author": "Razvan",
16
- "repository": {
17
- "type": "git",
18
- "url": "https://github.com/razvan/backend_framework"
19
- },
20
- "type": "module",
21
- "main": "./dist/index.js",
22
- "module": "./dist/index.js",
23
- "types": "./dist/index.d.ts",
24
- "exports": {
25
- ".": {
26
- "types": "./dist/index.d.ts",
27
- "import": "./dist/index.js"
28
- }
29
- },
30
- "files": [
31
- "dist"
32
- ],
33
- "scripts": {
34
- "dev": "bun run ./example/index.ts",
35
- "build": "bun build ./framework/index.ts --outdir ./dist --target bun --external react --external react-dom && bun run build:types",
36
- "build:types": "tsc -p tsconfig.build.json",
37
- "prepublishOnly": "bun run build",
38
- "fmt": "bunx @biomejs/biome format --write",
39
- "lint": "bunx @biomejs/biome lint --write",
40
- "check": "bunx @biomejs/biome check"
41
- },
42
- "devDependencies": {
43
- "@biomejs/biome": "^2.3.10",
44
- "@types/bun": "latest",
45
- "@types/react": "^19.2.7",
46
- "@types/react-dom": "^19.2.3",
47
- "typeorm": "^0.3.28"
48
- },
49
- "peerDependencies": {
50
- "typescript": "^5",
51
- "react": "^19.0.0",
52
- "react-dom": "^19.0.0"
53
- },
54
- "dependencies": {
55
- "chalk": "^5.6.2",
56
- "class-validator": "^0.14.3",
57
- "hono": "^4.11.1",
58
- "inversify": "^7.10.8",
59
- "pretty-error": "^4.0.0",
60
- "react": "^19.2.3",
61
- "react-dom": "^19.2.3",
62
- "react-router": "^7.11.0",
63
- "react-router-dom": "^7.11.0",
64
- "reflect-metadata": "^0.2.2",
65
- "zod": "^4.2.1"
66
- }
2
+ "name": "@razvan11/paladin",
3
+ "version": "1.1.2",
4
+ "description": "A Bun-based backend framework with decorators, dependency injection, and controller registration",
5
+ "keywords": [
6
+ "bun",
7
+ "backend",
8
+ "framework",
9
+ "decorators",
10
+ "hono",
11
+ "inversify",
12
+ "dependency-injection"
13
+ ],
14
+ "license": "MIT",
15
+ "author": "Razvan",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/razvan/backend_framework"
19
+ },
20
+ "type": "module",
21
+ "main": "./dist/index.js",
22
+ "module": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ }
29
+ },
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "scripts": {
34
+ "dev": "bun run ./example/index.ts",
35
+ "build": "bun build ./framework/index.ts --outdir ./dist --target bun --external react --external react-dom && bun run build:types",
36
+ "build:types": "tsc -p tsconfig.build.json",
37
+ "prepublishOnly": "bun run build",
38
+ "fmt": "bunx @biomejs/biome format --write",
39
+ "lint": "bunx @biomejs/biome lint --write",
40
+ "check": "bunx @biomejs/biome check"
41
+ },
42
+ "devDependencies": {
43
+ "@biomejs/biome": "^2.3.10",
44
+ "@types/bun": "latest",
45
+ "@types/react": "^19.2.7",
46
+ "@types/react-dom": "^19.2.3",
47
+ "typeorm": "^0.3.28"
48
+ },
49
+ "peerDependencies": {
50
+ "typescript": "^5",
51
+ "react": "^19.0.0",
52
+ "react-dom": "^19.0.0"
53
+ },
54
+ "dependencies": {
55
+ "chalk": "^5.6.2",
56
+ "class-validator": "^0.14.3",
57
+ "hono": "^4.11.1",
58
+ "inversify": "^7.10.8",
59
+ "pretty-error": "^4.0.0",
60
+ "react": "^19.2.3",
61
+ "react-dom": "^19.2.3",
62
+ "react-router": "^7.11.0",
63
+ "react-router-dom": "^7.11.0",
64
+ "reflect-metadata": "^0.2.2",
65
+ "zod": "^4.2.1"
66
+ }
67
67
  }
68
+