rajt 0.0.62 → 0.0.63

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.
Files changed (3) hide show
  1. package/package.json +13 -13
  2. package/src/index.ts +1 -1
  3. package/src/routes.ts +13 -12
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.62",
4
+ "version": "0.0.63",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -52,13 +52,20 @@
52
52
  "start": "node ../../dist/index.js"
53
53
  },
54
54
  "dependencies": {
55
- "@hono/zod-validator": "^0.4.3",
56
55
  "cripta": "^0.1",
57
56
  "forj": "^0.0.4",
58
- "hono": "^4.7.6",
59
57
  "t0n": "^0.1",
58
+ "@hono/zod-validator": "^0.7.6",
59
+ "chokidar-cli": "^3.0.0",
60
+ "citty": "^0.1.6",
61
+ "dotenv": "^16.5.0",
62
+ "esbuild": "^0.25.2",
63
+ "hono": "^4.11.7",
64
+ "miniflare": "^4.20251217.0",
65
+ "picocolors": "^1.1.1",
60
66
  "tiny-glob": "^0.2",
61
- "ua-parser-js": "^2.0.4"
67
+ "tsx": "^4.19.3",
68
+ "ua-parser-js": "^2.0.8"
62
69
  },
63
70
  "devDependencies": {
64
71
  "@cloudflare/workers-types": "^4.20251230.0",
@@ -75,15 +82,8 @@
75
82
  "@miniflare/web-sockets": "^2.14.4",
76
83
  "@types/node": "^20.11.0",
77
84
  "bun-types": "^1.2.14",
78
- "chokidar-cli": "^3.0.0",
79
- "citty": "^0.1.6",
80
- "dotenv": "^16.5.0",
81
- "esbuild": "^0.25.2",
82
- "miniflare": "^4.20251217.0",
83
- "picocolors": "^1.1.1",
84
- "tsx": "^4.19.3",
85
- "typescript": "^5.8.3",
86
- "wrangler": "^4.56.0"
85
+ "typescript": "^5.9.3",
86
+ "wrangler": "^4.61.0"
87
87
  },
88
88
  "engines": {
89
89
  "node": ">=18.0.0"
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { default as Action } from './action'
1
+ export { default as Action, default as Route } from './action'
2
2
  export { default as Middleware } from './middleware'
3
3
  export { default as Response } from './response'
4
4
  export { default as Config } from './config'
package/src/routes.ts CHANGED
@@ -158,7 +158,8 @@ export async function getConfigs(
158
158
  if (!dirs?.length) return {}
159
159
  const configs: Record<string, any> = {}
160
160
 
161
- const files = await glob(join(__root, dirs?.length > 1 ? `{${dirs.join(',')}}` : dirs[0], '/**/*.{ts,js,json}'))
161
+ const files = (await glob(join(__root, dirs?.length > 1 ? `{${dirs.join(',')}}` : dirs[0], '/**/*.{ts,js,cjs,mjs,json}')))
162
+ .filter(file => !file.includes('.d.'))
162
163
 
163
164
  for (const file of files) {
164
165
  const mod = await IMPORT(join(__root, file))
@@ -178,14 +179,6 @@ export async function getConfigs(
178
179
  return configs
179
180
  }
180
181
 
181
- const env = Object.entries(
182
- config({ path: '../../.env.prod' })?.parsed || {}
183
- ).filter(([key, val]) => key?.toLowerCase().indexOf('aws') != 0) // prevent AWS credentials
184
-
185
- const version = versionSHA('../../.git') // @ts-ignore
186
- env.push(['VERSION_SHA', process.env['VERSION_SHA'] = version]) // @ts-ignore
187
- env.push(['VERSION_HASH', process.env['VERSION_HASH'] = version?.substring(0, 7)])
188
-
189
182
  const IDENTIFIER_RE = /^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u
190
183
  function stringifyToJS(value: unknown): string {
191
184
  if (value === null) return 'null'
@@ -212,6 +205,14 @@ function stringifyToJS(value: unknown): string {
212
205
  }
213
206
 
214
207
  export async function cacheRoutes() {
208
+ const env = Object.entries(
209
+ config({ path: '../../.env.prod' })?.parsed || {}
210
+ ).filter(([key, val]) => key?.toLowerCase().indexOf('aws') != 0) // prevent AWS credentials
211
+
212
+ const version = versionSHA('../../.git') // @ts-ignore
213
+ env.push(['VERSION_SHA', process.env['VERSION_SHA'] = version]) // @ts-ignore
214
+ env.push(['VERSION_HASH', process.env['VERSION_HASH'] = version?.substring(0, 7)])
215
+
215
216
  const rolePath = join(__root, 'configs/roles.ts')
216
217
  ensureDir(rolePath)
217
218
  if (!existsSync(rolePath))
@@ -229,8 +230,8 @@ ${configs?.length ? `import Config from '../node_modules/rajt/src/config'\nConfi
229
230
 
230
231
  import { registerHandler, registerMiddleware } from '../node_modules/rajt/src/register'
231
232
 
232
- ${routes.map(r => `import ${r.name} from '../${normalizePath(r.file)}'`).join('\n')}
233
- ${middlewares.map(r => `import ${r.name} from '../${normalizePath(r.file)}'`).join('\n')}
233
+ ${routes.map(r => `import ${r.name} from '../${normalizeImportPath(r.file)}'`).join('\n')}
234
+ ${middlewares.map(r => `import ${r.name} from '../${normalizeImportPath(r.file)}'`).join('\n')}
234
235
 
235
236
  try {
236
237
  const handlers = {${routes.map(r => r.name).join()}}
@@ -261,6 +262,6 @@ try {
261
262
  ])))
262
263
  }
263
264
 
264
- function normalizePath(file: string) {
265
+ function normalizeImportPath(file: string) {
265
266
  return file.replace(/\.tsx?$/i, '').replace(/(\/index)+$/i, '').replace(/\/+$/g, '')
266
267
  }