rajt 0.0.105 → 0.0.107

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 CHANGED
@@ -1,13 +1,12 @@
1
1
  <h1 align="left">λ Rajt<br/><a href="https://pr.new/attla/rajt"><img align="right" src="https://developer.stackblitz.com/img/start_pr_dark_small.svg" alt="Start new PR in StackBlitz Codeflow"></a><a href="https://npmjs.com/package/rajt"><img align="right" src="https://img.shields.io/npm/v/rajt.svg" alt="npm package"></a></h1>
2
2
 
3
- > *Runtime-Agnostic for Javascript and TypeScript*.
3
+ > ⚠️ Rajt is under ALFA development — expect updates, rough edges, and occasional breack changes.
4
+ <br/>
4
5
 
5
- > *From Hungarian **`[ˈrɒjt]`** (meaning "start") and Russian **`Райт`** (meaning "wright").*
6
+ > *Runtime-Agnostic for Javascript and TypeScript*. <br />*From Hungarian **`[ˈrɒjt]`** (meaning "start") and Russian **`Райт`** (meaning "wright").*
6
7
 
7
8
  <br/>
8
9
 
9
- > ⚠️ Rajt is under ALFA development — expect updates, rough edges, and occasional breack changes.
10
- <br/>
11
10
 
12
11
  This framework is fully geared towards the serverless world, specifically AWS Lambda (Node.js, Bun and LLRT runtime) / Cloudflare Workers.
13
12
 
@@ -23,7 +22,8 @@ This framework is fully geared towards the serverless world, specifically AWS La
23
22
  | -: | :- | :- |
24
23
  | [rajt](https://github.com/attla/rajt) | [![rajt version](https://img.shields.io/npm/v/rajt.svg?label=%20)](https://npm.im/rajt) | 🧱 The core of Rajt serverless framework. |
25
24
  | [create-rajt](https://github.com/attla/create-rajt) | [![create-rajt version](https://img.shields.io/npm/v/create-rajt.svg?label=%20)](https://npm.im/create-rajt) | 📁 CLI tool for create new Rajt projects, from starter templates. |
26
- | [forj](https://github.com/attla/forj) | [![forj version](https://img.shields.io/npm/v/forj.svg?label=%20)](https://npm.im/forj) | 🗂️ Just another query builder in typescript |
25
+ | [forj](https://github.com/attla/forj) | [![forj version](https://img.shields.io/npm/v/forj.svg?label=%20)](https://npm.im/forj) | 🗂️ Just another query builder in typescript. |
26
+ | [duto](https://github.com/attla/duto) | [![duto version](https://img.shields.io/npm/v/duto.svg?label=%20)](https://npm.im/duto) | ⛳️ Static framework for web artisans. |
27
27
  | [t0n](https://github.com/attla/t0n) | [![t0n version](https://img.shields.io/npm/v/t0n.svg?label=%20)](https://npm.im/t0n) | 🧰 Collection of elegant typescript resources for web artisans. |
28
28
  | [cripta](https://github.com/attla/cripta) | [![cripta version](https://img.shields.io/npm/v/cripta.svg?label=%20)](https://npm.im/cripta) | 🧛 A layer of encryption a little too judicious. |
29
29
 
package/bin/rajt.js CHANGED
@@ -53,9 +53,9 @@ Consider using a Node.js version manager such as https://volta.sh or https://git
53
53
  function findTsx() {
54
54
  const exts = ['', '.exe', '.cmd'];
55
55
  const paths = [
56
- [_root, '../node_modules/tsx/dist/cli.mjs'],
56
+ [__dirname, '../node_modules/tsx/dist/cli.mjs'],
57
57
  [process.cwd(), 'node_modules/tsx/dist/cli.mjs'],
58
- [_root, '../node_modules/.bin/tsx'],
58
+ [__dirname, '../node_modules/.bin/tsx'],
59
59
  [process.cwd(), 'node_modules/.bin/tsx'],
60
60
  ];
61
61
 
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.105",
4
+ "version": "0.0.107",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
7
7
  "files": ["bin", "src"],
@@ -45,7 +45,7 @@
45
45
  "cripta": "^0.1.12",
46
46
  "dotenv": "^16.5.0",
47
47
  "esbuild": "^0.25.2",
48
- "forj": "^0.1.10",
48
+ "forj": "^0.1.11",
49
49
  "hono": "^4.12.8",
50
50
  "hono-openapi": "^1.3.0",
51
51
  "localflare-api": "^0.5.0",
@@ -53,7 +53,7 @@
53
53
  "miniflare": "^4.20260312.0",
54
54
  "pathe": "^2.0",
55
55
  "quansync": "^0.2.11",
56
- "t0n": "^0.1.13",
56
+ "t0n": "^0.1.17",
57
57
  "tiny-glob": "^0.2",
58
58
  "tsx": "^4.19.4",
59
59
  "wrangler": "^4.61.0",
package/src/routes.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { copyFileSync, existsSync, readdirSync, statSync, writeFileSync } from 'node:fs'
2
2
  import { join, resolve, relative } from 'pathe'
3
3
 
4
- import { IMPORT } from 't0n'
4
+ import { IMPORT, JSJSON } from 't0n'
5
5
  import glob from 'tiny-glob'
6
6
  import { config } from 'dotenv'
7
7
  import { describeRoute, resolver, validator } from 'hono-openapi'
@@ -290,31 +290,6 @@ export async function getConfigs(
290
290
  return configs
291
291
  }
292
292
 
293
- const IDENTIFIER_RE = /^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u
294
- function stringifyToJS(value: unknown): string {
295
- if (value === null) return 'null'
296
- if (value === undefined) return 'undefined'
297
-
298
- const type = typeof value
299
-
300
- if (type === 'string') return JSON.stringify(value)
301
- if (type === 'number' || type === 'boolean') return String(value)
302
- if (type === 'bigint') return `${value}n`
303
- if (type === 'function') return value.toString()
304
-
305
- if (Array.isArray(value))
306
- return `[${value.map(stringifyToJS).join(',')}]`
307
-
308
- if (type === 'object') {
309
- const entries = Object.entries(value as Record<string, unknown>)
310
- .map(([key, val]) => `${IDENTIFIER_RE.test(key) ? key : JSON.stringify(key)}:${stringifyToJS(val)}`)
311
-
312
- return `{${entries.join(',')}}`
313
- }
314
-
315
- return 'undefined'
316
- }
317
-
318
293
  export async function dependencyEntry(lib: string, root: string) {
319
294
  const path = await import.meta.resolve(lib)
320
295
  return relative(root, path.replace('file://', ''))
@@ -377,16 +352,16 @@ export async function cacheRoutes() {
377
352
 
378
353
  const _rajtDir = await dependencyPath('rajt')
379
354
 
380
- stringifyToJS(Object.fromEntries(routes.map(r => ([r.path + r.method, r.name]))))
355
+ JSJSON(Object.fromEntries(routes.map(r => ([r.path + r.method, r.name]))))
381
356
 
382
357
  writeFileSync(iPath, `// AUTO-GENERATED FILE - DO NOT EDIT
383
- ${env?.length ? `import { Envir } from '${await dependencyPath('t0n')}/src/envir'\nEnvir.add({${env.map(([key, val]) => key +':'+ stringifyToJS(val)).join(',')}})` : ''}
384
- ${Object.entries(configs)?.length ? `import Config from '${_rajtDir}/src/config'\nConfig.add(${stringifyToJS(configs)})` : ''}
358
+ ${env?.length ? `import { Envir } from '${await dependencyPath('t0n')}/src/envir'\nEnvir.add({${env.map(([key, val]) => key +':'+ JSJSON(val)).join(',')}})` : ''}
359
+ ${Object.entries(configs)?.length ? `import Config from '${_rajtDir}/src/config'\nConfig.add(${JSJSON})` : ''}
385
360
 
386
361
  import { registerHandler, registerMiddleware } from '${_rajtDir}/src/register'
387
362
  ${handlers.map(([file, name, _export]) => `\nimport ${_export ? `{ ${name} }` : name} from '${_rajtDir}/src/${file}'\nregisterHandler('${name}', ${name})`).join('\n')}
388
363
 
389
- ${Object.entries(openApi)?.length ? `registerHandler('RAJT_OPENAPI', ${stringifyToJS(openApi)})` : ''}
364
+ ${Object.entries(openApi)?.length ? `registerHandler('RAJT_OPENAPI', ${JSJSON(openApi)})` : ''}
390
365
 
391
366
  ${routes.map(r => `import ${r.name} from '../${normalizeImportPath(r.file)}'`).join('\n')}
392
367
  ${middlewares.map(r => `import ${r.name} from '../${normalizeImportPath(r.file)}'`).join('\n')}