raiko.js 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/README.es.md +36 -4
- package/README.md +34 -2
- package/README.pt-BR.md +35 -3
- package/bin/raiko.mjs +23 -10
- package/bin/serve-entry.mjs +45 -0
- package/dist/admin/index.js +1 -1
- package/dist/app-router/index.js +9 -4
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-IJNNQKTG.js → chunk-BDDC5OJA.js} +1 -1
- package/dist/{chunk-H6BWMS4P.js → chunk-STFJTCVR.js} +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/index.js +12 -8
- package/dist/mail/index.js +1 -1
- package/dist/p2p/index.js +1 -1
- package/dist/plugins/index.js +2 -2
- package/dist/{serve-GGEVATIS.js → serve-ALQGRNNC.js} +1 -0
- package/dist/{static-4LGL4QSH.js → static-7FVGQ2UM.js} +2 -2
- package/package.json +2 -1
package/README.es.md
CHANGED
|
@@ -21,21 +21,53 @@
|
|
|
21
21
|
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
|
-
## Empieza con un
|
|
24
|
+
## Empieza con un comando
|
|
25
|
+
|
|
26
|
+
**1. Crea el proyecto.** El instalador pregunta lo que quieres (frontend, CSS, base de datos, login, email, deploy) y escribe una app que ya funciona.
|
|
25
27
|
|
|
26
28
|
```bash
|
|
27
29
|
npx create-raiko@latest my-app
|
|
28
|
-
#
|
|
30
|
+
# o
|
|
29
31
|
bun create raiko my-app
|
|
30
32
|
```
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
Usa las flechas para moverte, Enter para elegir, Espacio para marcar elementos de una lista y Esc para volver a la pregunta anterior.
|
|
35
|
+
|
|
36
|
+
**2. Arranca el servidor de desarrollo.**
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
39
|
cd my-app
|
|
36
|
-
npm run dev
|
|
40
|
+
npm run dev # o: bun run dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**3. Abre la dirección que muestra la terminal.**
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
raiko.js 1.0.3 dev
|
|
47
|
+
|
|
48
|
+
- Local: http://localhost:3000
|
|
49
|
+
- Network: http://192.168.0.10:3000
|
|
50
|
+
|
|
51
|
+
ready in 240 ms (save a file to reload)
|
|
37
52
|
```
|
|
38
53
|
|
|
54
|
+
| Elegiste | Abre | Qué corre ahí |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| Raiko Pages (por defecto) | http://localhost:3000 | páginas, API, sockets y admin en un solo servidor |
|
|
57
|
+
| React, Vue, Svelte, Solid, Preact o Angular | http://localhost:5173 | Vite, con el backend de Raiko dentro en el mismo puerto |
|
|
58
|
+
|
|
59
|
+
Verás la página inicial con los siguientes pasos. Edita el archivo que indica (`app/page.tsx`, o `web/src/App.tsx` en las plantillas con Vite), guarda y la página se recarga.
|
|
60
|
+
|
|
61
|
+
Direcciones útiles en una app nueva: `/api/hello` (una ruta de API), `/docs` (documentación de la API generada desde tus esquemas), `/health` y, si los elegiste, `/admin`, `/login` y `/_raiko/mail` (vista previa de emails).
|
|
62
|
+
|
|
63
|
+
**Abrir en el celular.** Usa la dirección Network con el celular en el mismo Wi-Fi.
|
|
64
|
+
|
|
65
|
+
**Usar otro puerto.** `PORT=4000 npm run dev` (Raiko Pages) o `npm run dev -- --port 4000` (plantillas con Vite).
|
|
66
|
+
|
|
67
|
+
**Puerto ocupado.** Verás `error[RK0706]: port 3000 is already in use`. Detén el otro servidor o usa otro puerto como arriba.
|
|
68
|
+
|
|
69
|
+
**Producción.** `npm run build` y luego `npm run start` sirven la misma app con `NODE_ENV=production`, en el puerto de `PORT` (3000 por defecto).
|
|
70
|
+
|
|
39
71
|
## El recorrido de 30 segundos
|
|
40
72
|
|
|
41
73
|
Una API con validación, tipos y documentación OpenAPI a partir de un solo esquema:
|
package/README.md
CHANGED
|
@@ -23,19 +23,51 @@
|
|
|
23
23
|
|
|
24
24
|
## Start in one command
|
|
25
25
|
|
|
26
|
+
**1. Create the project.** The installer asks what you want (frontend, CSS, database, sign in, email, deploy) and writes an app that already works.
|
|
27
|
+
|
|
26
28
|
```bash
|
|
27
29
|
npx create-raiko@latest my-app
|
|
28
30
|
# or
|
|
29
31
|
bun create raiko my-app
|
|
30
32
|
```
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
Use the arrow keys to move, Enter to choose, Space to mark items in a list, and Esc to go back to the previous question.
|
|
35
|
+
|
|
36
|
+
**2. Start the dev server.**
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
39
|
cd my-app
|
|
36
|
-
npm run dev
|
|
40
|
+
npm run dev # or: bun run dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**3. Open the address the terminal prints.**
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
raiko.js 1.0.3 dev
|
|
47
|
+
|
|
48
|
+
- Local: http://localhost:3000
|
|
49
|
+
- Network: http://192.168.0.10:3000
|
|
50
|
+
|
|
51
|
+
ready in 240 ms (save a file to reload)
|
|
37
52
|
```
|
|
38
53
|
|
|
54
|
+
| You picked | Open | What runs there |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| Raiko Pages (the default) | http://localhost:3000 | pages, API, sockets, admin, one server |
|
|
57
|
+
| React, Vue, Svelte, Solid, Preact or Angular | http://localhost:5173 | Vite, with the Raiko backend inside it on the same port |
|
|
58
|
+
|
|
59
|
+
You will see the starter page with the next steps. Edit the file it names (`app/page.tsx`, or `web/src/App.tsx` for Vite templates), save, and the page reloads.
|
|
60
|
+
|
|
61
|
+
Useful addresses in a new app: `/api/hello` (an API route), `/docs` (API docs generated from your schemas), `/health`, and, when you picked them, `/admin`, `/login` and `/_raiko/mail` (email previews).
|
|
62
|
+
|
|
63
|
+
**Open it on your phone.** Use the Network address while the phone is on the same Wi-Fi.
|
|
64
|
+
|
|
65
|
+
**Use another port.** `PORT=4000 npm run dev` (Raiko Pages) or `npm run dev -- --port 4000` (Vite templates).
|
|
66
|
+
|
|
67
|
+
**Port already in use.** You will see `error[RK0706]: port 3000 is already in use`. Stop the other server or pick another port as above.
|
|
68
|
+
|
|
69
|
+
**Production.** `npm run build` then `npm run start` serves the same app with `NODE_ENV=production`, on the port in `PORT` (3000 by default).
|
|
70
|
+
|
|
39
71
|
## The 30 second tour
|
|
40
72
|
|
|
41
73
|
An API with validation, types and OpenAPI docs from one schema:
|
package/README.pt-BR.md
CHANGED
|
@@ -23,19 +23,51 @@
|
|
|
23
23
|
|
|
24
24
|
## Comece com um comando
|
|
25
25
|
|
|
26
|
+
**1. Crie o projeto.** O instalador pergunta o que você quer (frontend, CSS, banco, login, e-mail, deploy) e escreve um app que já funciona.
|
|
27
|
+
|
|
26
28
|
```bash
|
|
27
29
|
npx create-raiko@latest my-app
|
|
28
|
-
#
|
|
30
|
+
# ou
|
|
29
31
|
bun create raiko my-app
|
|
30
32
|
```
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
Use as setas para mover, Enter para escolher, Espaço para marcar itens numa lista e Esc para voltar à pergunta anterior.
|
|
35
|
+
|
|
36
|
+
**2. Suba o servidor de desenvolvimento.**
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
39
|
cd my-app
|
|
36
|
-
npm run dev
|
|
40
|
+
npm run dev # ou: bun run dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**3. Abra o endereço que o terminal mostra.**
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
raiko.js 1.0.3 dev
|
|
47
|
+
|
|
48
|
+
- Local: http://localhost:3000
|
|
49
|
+
- Network: http://192.168.0.10:3000
|
|
50
|
+
|
|
51
|
+
ready in 240 ms (save a file to reload)
|
|
37
52
|
```
|
|
38
53
|
|
|
54
|
+
| Você escolheu | Abra | O que roda ali |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| Raiko Pages (o padrão) | http://localhost:3000 | páginas, API, sockets e admin num servidor só |
|
|
57
|
+
| React, Vue, Svelte, Solid, Preact ou Angular | http://localhost:5173 | o Vite, com o backend do Raiko dentro dele na mesma porta |
|
|
58
|
+
|
|
59
|
+
Você verá a página inicial com os próximos passos. Edite o arquivo que ela indica (`app/page.tsx`, ou `web/src/App.tsx` nos templates com Vite), salve e a página recarrega.
|
|
60
|
+
|
|
61
|
+
Endereços úteis num app novo: `/api/hello` (uma rota de API), `/docs` (documentação da API gerada pelos seus schemas), `/health` e, se você escolheu, `/admin`, `/login` e `/_raiko/mail` (prévia dos e-mails).
|
|
62
|
+
|
|
63
|
+
**Abrir no celular.** Use o endereço Network com o celular no mesmo Wi-Fi.
|
|
64
|
+
|
|
65
|
+
**Usar outra porta.** `PORT=4000 npm run dev` (Raiko Pages) ou `npm run dev -- --port 4000` (templates com Vite).
|
|
66
|
+
|
|
67
|
+
**Porta ocupada.** Aparece `error[RK0706]: port 3000 is already in use`. Pare o outro servidor ou use outra porta como acima.
|
|
68
|
+
|
|
69
|
+
**Produção.** `npm run build` e depois `npm run start` sobem o mesmo app com `NODE_ENV=production`, na porta de `PORT` (3000 por padrão).
|
|
70
|
+
|
|
39
71
|
## O tour de 30 segundos
|
|
40
72
|
|
|
41
73
|
Uma API com validação, tipos e documentação OpenAPI a partir de um único schema:
|
package/bin/raiko.mjs
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// raiko: dev, build, start, deploy, secret, routes, manifest
|
|
3
3
|
import { spawn, spawnSync } from 'node:child_process'
|
|
4
4
|
import { existsSync, mkdirSync, readdirSync, statSync, writeFileSync, watch, readFileSync } from 'node:fs'
|
|
5
|
-
import { join, relative, resolve } from 'node:path'
|
|
5
|
+
import { join, relative, resolve, dirname } from 'node:path'
|
|
6
|
+
import { fileURLToPath } from 'node:url'
|
|
6
7
|
import { randomBytes } from 'node:crypto'
|
|
7
8
|
|
|
8
9
|
const [cmd = 'help', ...args] = process.argv.slice(2)
|
|
@@ -48,6 +49,12 @@ function manifest() {
|
|
|
48
49
|
return files.length
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
/** Run a package binary: bunx when Bun is here (works without Node), npx otherwise. */
|
|
53
|
+
function x(pkgBin, a, env) {
|
|
54
|
+
return hasBun() ? run('bun', ['x', '--bun', pkgBin, ...a], env) : run('npx', [pkgBin, ...a], env)
|
|
55
|
+
}
|
|
56
|
+
const xSync = (pkgBin, a, opts) => (hasBun() ? spawnSync('bun', ['x', '--bun', pkgBin, ...a], opts) : spawnSync(process.platform === 'win32' ? 'npx.cmd' : 'npx', [pkgBin, ...a], opts))
|
|
57
|
+
|
|
51
58
|
function run(bin, a, env = {}) {
|
|
52
59
|
// no shell: arguments are never interpreted; on Windows the .cmd shims are called by name
|
|
53
60
|
const exe = process.platform === 'win32' && ['npx', 'npm', 'bunx'].includes(bin) ? `${bin}.cmd` : bin
|
|
@@ -64,7 +71,6 @@ switch (cmd) {
|
|
|
64
71
|
break
|
|
65
72
|
}
|
|
66
73
|
case 'dev': {
|
|
67
|
-
banner()
|
|
68
74
|
if (existsSync(join(cwd, 'app'))) {
|
|
69
75
|
manifest()
|
|
70
76
|
try {
|
|
@@ -72,9 +78,16 @@ switch (cmd) {
|
|
|
72
78
|
} catch {}
|
|
73
79
|
}
|
|
74
80
|
const vite = ['vite.config.ts', 'vite.config.js', 'vite.config.mts'].some((f) => existsSync(join(cwd, f)))
|
|
75
|
-
if (vite
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
if (!vite && !existsSync(join(cwd, entry()))) {
|
|
82
|
+
console.error(`${red('error[RK0704]')}: no server entry found\n = help: create server.ts, or run ${y('raiko dev path/to/server.ts')}`)
|
|
83
|
+
process.exit(1)
|
|
84
|
+
}
|
|
85
|
+
console.log(` ${dim('starting')} ${vite ? 'vite with the Raiko backend' : entry()} ${dim('...')}\n`)
|
|
86
|
+
const runner = join(dirname(fileURLToPath(import.meta.url)), 'serve-entry.mjs')
|
|
87
|
+
// everything except the entry file goes to Vite, values included (--port 5174)
|
|
88
|
+
if (vite) x('vite', args.filter((a) => !/\.(m|c)?(t|j)sx?$/.test(a)), { NODE_ENV: 'development' })
|
|
89
|
+
else if (hasBun()) run('bun', ['--watch', runner, entry(), 'dev'], { NODE_ENV: 'development' })
|
|
90
|
+
else x('tsx', ['watch', runner, entry(), 'dev'], { NODE_ENV: 'development' })
|
|
78
91
|
break
|
|
79
92
|
}
|
|
80
93
|
case 'build': {
|
|
@@ -83,7 +96,7 @@ switch (cmd) {
|
|
|
83
96
|
if (existsSync(join(cwd, 'app'))) console.log(`${green('ok')} routes manifest, ${manifest()} files`)
|
|
84
97
|
const vite = ['vite.config.ts', 'vite.config.js', 'vite.config.mts'].some((f) => existsSync(join(cwd, f)))
|
|
85
98
|
if (vite) {
|
|
86
|
-
const r =
|
|
99
|
+
const r = xSync('vite', ['build'], { stdio: 'inherit', env: { ...process.env, NODE_ENV: 'production' } })
|
|
87
100
|
if (r.status) process.exit(r.status)
|
|
88
101
|
console.log(`${green('ok')} frontend built, minified and mangled, no source maps`)
|
|
89
102
|
}
|
|
@@ -91,7 +104,7 @@ switch (cmd) {
|
|
|
91
104
|
const target = flag('target', hasBun() ? 'bun' : 'node')
|
|
92
105
|
const r = hasBun()
|
|
93
106
|
? spawnSync('bun', ['build', entry(), '--target', target === 'bun' ? 'bun' : 'node', '--outdir', out, '--minify', '--packages', 'external'], { stdio: 'inherit' })
|
|
94
|
-
:
|
|
107
|
+
: xSync('esbuild', [entry(), '--bundle', '--platform=node', '--format=esm', '--minify', '--packages=external', `--outdir=${out}`, '--jsx=automatic', '--jsx-import-source=raiko.js'], { stdio: 'inherit' })
|
|
95
108
|
if (r.status) process.exit(r.status)
|
|
96
109
|
console.log(`${green('ok')} server bundled to .raiko/out ${dim(`(${Date.now() - t0}ms)`)}\n\n start it with ${y('raiko start')}\n`)
|
|
97
110
|
break
|
|
@@ -102,7 +115,7 @@ switch (cmd) {
|
|
|
102
115
|
console.error(`${red('error[RK0701]')}: no build found\n = help: run ${y('raiko build')} first`)
|
|
103
116
|
process.exit(1)
|
|
104
117
|
}
|
|
105
|
-
run(hasBun() ? 'bun' : 'node', [file], { NODE_ENV: 'production' })
|
|
118
|
+
run(hasBun() ? 'bun' : 'node', [join(dirname(fileURLToPath(import.meta.url)), 'serve-entry.mjs'), file, 'production'], { NODE_ENV: 'production' })
|
|
106
119
|
break
|
|
107
120
|
}
|
|
108
121
|
case 'deploy': {
|
|
@@ -112,8 +125,8 @@ switch (cmd) {
|
|
|
112
125
|
process.exit(1)
|
|
113
126
|
}
|
|
114
127
|
console.log(`\n deploying to ${y(to)}\n`)
|
|
115
|
-
if (to === 'vercel')
|
|
116
|
-
else if (to === 'cloudflare')
|
|
128
|
+
if (to === 'vercel') x('vercel', ['--prod'])
|
|
129
|
+
else if (to === 'cloudflare') x('wrangler', ['deploy'])
|
|
117
130
|
else if (to === 'docker') run('docker', ['build', '-t', pkg.name ?? 'raiko-app', '.'])
|
|
118
131
|
else {
|
|
119
132
|
console.error(`${red('error[RK0703]')}: unknown target "${to}"`)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Started by `raiko dev` and `raiko start`: imports the app entry and makes sure it is listening,
|
|
2
|
+
// then prints where to open it. Works whether or not the entry calls listen() itself.
|
|
3
|
+
import { pathToFileURL } from 'node:url'
|
|
4
|
+
import { resolve } from 'node:path'
|
|
5
|
+
import { networkInterfaces } from 'node:os'
|
|
6
|
+
import { readFileSync } from 'node:fs'
|
|
7
|
+
|
|
8
|
+
const t0 = performance.now()
|
|
9
|
+
const [file, mode = 'dev'] = process.argv.slice(2)
|
|
10
|
+
const port = Number(process.env.PORT ?? 3000)
|
|
11
|
+
const tty = process.stdout.isTTY
|
|
12
|
+
const c = (n, s) => (tty ? `\x1b[${n}m${s}\x1b[0m` : s)
|
|
13
|
+
|
|
14
|
+
process.env.RAIKO_RUNNER = '1'
|
|
15
|
+
const mod = await import(pathToFileURL(resolve(file)).href)
|
|
16
|
+
const app = mod.default ?? mod.app
|
|
17
|
+
let url = globalThis.__raikoListening
|
|
18
|
+
if (!url) {
|
|
19
|
+
if (!app || typeof app.listen !== 'function') {
|
|
20
|
+
console.error(`\n ${c(31, 'error[RK0705]')}: ${file} does not export the app\n = help: end the file with \`export default app\`\n`)
|
|
21
|
+
process.exit(1)
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
url = (await app.listen(port)).url
|
|
25
|
+
} catch (e) {
|
|
26
|
+
if (e && (e.code === 'EADDRINUSE' || /in use|EADDRINUSE/i.test(String(e.message)))) {
|
|
27
|
+
console.error(`\n ${c(31, 'error[RK0706]')}: port ${port} is already in use\n = help: stop the other server, or run with PORT=${port + 1}\n`)
|
|
28
|
+
process.exit(1)
|
|
29
|
+
}
|
|
30
|
+
throw e
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
let version = ''
|
|
34
|
+
try {
|
|
35
|
+
version = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version
|
|
36
|
+
} catch {}
|
|
37
|
+
const lan = Object.values(networkInterfaces()).flat().find((i) => i && i.family === 'IPv4' && !i.internal)?.address
|
|
38
|
+
|
|
39
|
+
console.log(`
|
|
40
|
+
${c(33, 'raiko.js')} ${version} ${c(2, mode)}
|
|
41
|
+
|
|
42
|
+
- Local: ${c(36, url.replace('0.0.0.0', 'localhost'))}${lan ? `\n - Network: ${c(36, `http://${lan}:${new URL(url).port}`)}` : ''}
|
|
43
|
+
|
|
44
|
+
${c(32, 'ready')} in ${Math.round(performance.now() - t0)} ms${mode === 'dev' ? c(2, ' (save a file to reload)') : ''}
|
|
45
|
+
`)
|
package/dist/admin/index.js
CHANGED
package/dist/app-router/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PREFETCH_SCRIPT } from '../chunk-U626USOW.js';
|
|
2
2
|
import { als, RedirectSignal } from '../chunk-MGKXQINB.js';
|
|
3
|
-
import { Raiko } from '../chunk-
|
|
3
|
+
import { Raiko } from '../chunk-BDDC5OJA.js';
|
|
4
4
|
import '../chunk-4NOVAJBA.js';
|
|
5
5
|
import '../chunk-SNAWC6GY.js';
|
|
6
6
|
import { formToObject } from '../chunk-Y3YIWI5S.js';
|
|
@@ -233,9 +233,14 @@ async function appRouter(options = {}) {
|
|
|
233
233
|
app.onBeforeHandle((ctx) => matcher && !matcher.test(unprefixed(ctx.path)) ? void 0 : mw.default(ctx), "global");
|
|
234
234
|
break;
|
|
235
235
|
}
|
|
236
|
-
const publicDir =
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
const publicDir = resolve(options.publicDir ?? "public");
|
|
237
|
+
let hasPublic = false;
|
|
238
|
+
try {
|
|
239
|
+
hasPublic = existsSync(publicDir);
|
|
240
|
+
} catch {
|
|
241
|
+
}
|
|
242
|
+
if (hasPublic) {
|
|
243
|
+
const { staticFiles } = await import('../static-7FVGQ2UM.js');
|
|
239
244
|
app.use(staticFiles({ dir: publicDir, prefix: "/" }));
|
|
240
245
|
const { imageHandler } = await import('../image-FBZPWI2W.js');
|
|
241
246
|
app.get("/_raiko/image", imageHandler(publicDir));
|
package/dist/auth/index.js
CHANGED
|
@@ -551,7 +551,7 @@ var Raiko = class _Raiko {
|
|
|
551
551
|
* `cluster: true` runs one process per CPU core on the same port.
|
|
552
552
|
*/
|
|
553
553
|
async listen(port = 3e3, opts = {}) {
|
|
554
|
-
const { serve } = await import('./serve-
|
|
554
|
+
const { serve } = await import('./serve-ALQGRNNC.js');
|
|
555
555
|
for (const fn of this.startHooks) await fn(this);
|
|
556
556
|
return serve(this, Number(port), opts);
|
|
557
557
|
}
|
package/dist/i18n/index.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Raiko } from './chunk-
|
|
2
|
-
export { Raiko, Router, joinPath } from './chunk-
|
|
1
|
+
import { Raiko } from './chunk-BDDC5OJA.js';
|
|
2
|
+
export { Raiko, Router, joinPath } from './chunk-BDDC5OJA.js';
|
|
3
3
|
export { t, toJsonSchema, validate, validateSync } from './chunk-4NOVAJBA.js';
|
|
4
4
|
export { sse } from './chunk-SNAWC6GY.js';
|
|
5
5
|
import './chunk-Y3YIWI5S.js';
|
|
@@ -12,12 +12,16 @@ var raiko = (config) => new Raiko(config);
|
|
|
12
12
|
var src_default = Raiko;
|
|
13
13
|
function isMain(url) {
|
|
14
14
|
const g = globalThis;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
if (g.process?.env?.RAIKO_RUNNER === "1") return false;
|
|
16
|
+
const norm = (s) => {
|
|
17
|
+
const p = decodeURIComponent(s).replace(/\\/g, "/").replace(/^\/([A-Za-z]:)/, "$1").replace(/\.(m|c)?(t|j)sx?$/, "");
|
|
18
|
+
return /^[A-Za-z]:/.test(p) ? p.toLowerCase() : p;
|
|
19
|
+
};
|
|
20
|
+
const file = norm(new URL(url).pathname);
|
|
21
|
+
const main = g.Bun?.main ?? g.process?.argv?.[1];
|
|
22
|
+
if (!main) return false;
|
|
23
|
+
const m = norm(main);
|
|
24
|
+
return m === file || file.endsWith("/" + m.replace(/^\.?\//, ""));
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
export { src_default as default, isMain, raiko };
|
package/dist/mail/index.js
CHANGED
package/dist/p2p/index.js
CHANGED
package/dist/plugins/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { MIME, staticFiles } from '../chunk-
|
|
2
|
-
import { Raiko } from '../chunk-
|
|
1
|
+
export { MIME, staticFiles } from '../chunk-STFJTCVR.js';
|
|
2
|
+
import { Raiko } from '../chunk-BDDC5OJA.js';
|
|
3
3
|
import { isTSchema, toJsonSchema } from '../chunk-4NOVAJBA.js';
|
|
4
4
|
import '../chunk-SNAWC6GY.js';
|
|
5
5
|
import '../chunk-Y3YIWI5S.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { MIME, staticFiles } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { MIME, staticFiles } from './chunk-STFJTCVR.js';
|
|
2
|
+
import './chunk-BDDC5OJA.js';
|
|
3
3
|
import './chunk-4NOVAJBA.js';
|
|
4
4
|
import './chunk-SNAWC6GY.js';
|
|
5
5
|
import './chunk-Y3YIWI5S.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "raiko.js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "The full stack TypeScript framework: Next.js style app router, server components, typed API, WebSockets with encryption, auth, admin and email. Runs on Bun, Node, Deno, Cloudflare Workers and Vercel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -128,6 +128,7 @@
|
|
|
128
128
|
"LICENSE"
|
|
129
129
|
],
|
|
130
130
|
"scripts": {
|
|
131
|
+
"dev": "bun --watch examples/hello/server.ts",
|
|
131
132
|
"build": "tsup && tsc -p tsconfig.build.json",
|
|
132
133
|
"test": "bun test",
|
|
133
134
|
"test:node": "node test/node/smoke.mjs",
|