rajt 0.0.64 → 0.0.65

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rajt",
3
3
  "description": "A serverless bundler layer, fully typed for AWS Lambda (Node.js and LLRT) and Cloudflare Workers.",
4
- "version": "0.0.64",
4
+ "version": "0.0.65",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -212,7 +212,7 @@ function withPort(desiredPort: number, cb: (port: number) => void) {
212
212
  getAvailablePort(desiredPort)
213
213
  .then((port: number) => {
214
214
  if (port != desiredPort)
215
- logger.warn(`Port ${desiredPort} was in use, using ${port} as a fallback`)
215
+ logger.stepWarn(`Port ${desiredPort} was in use, using ${port} as a fallback`)
216
216
 
217
217
  cb(port)
218
218
  }).catch(e => logger.error('Error finding available port:', e))
package/src/request.ts CHANGED
@@ -24,10 +24,15 @@ export default class $Request {
24
24
  #cookie: ReturnType<typeof cookieWrapper>
25
25
  #u: Authnz<any> | null = null
26
26
 
27
+ #host: string
28
+
27
29
  constructor(c: Context) {
28
30
  this.#c = c
29
31
  this.#cookie = cookieWrapper(c)
30
32
  this.#u = Authnz.fromToken(Token.fromRequest(this))
33
+
34
+ const url = new URL(c.req.raw.url)
35
+ this.#host = url.protocol +'://'+ url.host
31
36
  }
32
37
 
33
38
  get user() {
@@ -81,14 +86,18 @@ export default class $Request {
81
86
  return this.#c.req.routePath
82
87
  }
83
88
 
84
- get path() {
85
- return this.#c.req.path
86
- }
87
-
88
89
  get url() {
89
90
  return this.#c.req.raw.url
90
91
  }
91
92
 
93
+ get host() {
94
+ return this.#host
95
+ }
96
+
97
+ get path() {
98
+ return this.#c.req.path
99
+ }
100
+
92
101
  get method() {
93
102
  return this.#c.req.raw.method
94
103
  }