@stacksjs/repl 0.70.87 → 0.70.88
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 +2 -2
- package/dist/index.d.ts +0 -56
- package/dist/index.js +0 -14
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/repl",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.70.
|
|
5
|
+
"version": "0.70.88",
|
|
6
6
|
"description": "A Stacks optimized TypeScript REPL.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"better-dx": "^0.2.16",
|
|
57
|
-
"@stacksjs/tinker": "0.70.
|
|
57
|
+
"@stacksjs/tinker": "0.70.88"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { TinkerConfig } from '@stacksjs/tinker';
|
|
2
|
-
export type { TinkerConfig } from '@stacksjs/tinker';
|
|
3
|
-
/**
|
|
4
|
-
* Start a Stacks REPL session.
|
|
5
|
-
*
|
|
6
|
-
* This is the main entry point for `buddy tinker` and `buddy repl`.
|
|
7
|
-
* It launches Bun's official REPL (`bun repl`) with all Stacks framework
|
|
8
|
-
* modules preloaded as globals — `db`, `config`, every ORM model,
|
|
9
|
-
* `cache`, `queue`, etc. all available without imports.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* import { startRepl } from '@stacksjs/repl'
|
|
14
|
-
*
|
|
15
|
-
* // Interactive session
|
|
16
|
-
* await startRepl()
|
|
17
|
-
*
|
|
18
|
-
* // With custom preloaded modules
|
|
19
|
-
* await startRepl({
|
|
20
|
-
* preload: ['lodash', 'dayjs'],
|
|
21
|
-
* })
|
|
22
|
-
*
|
|
23
|
-
* // Evaluate and exit
|
|
24
|
-
* await startRepl({ print: 'await User.count()' })
|
|
25
|
-
*
|
|
26
|
-
* // Show registered routes when the session opens
|
|
27
|
-
* await startRepl({ showRoutes: true })
|
|
28
|
-
*
|
|
29
|
-
* // App-specific bootstrap — runs before the prompt
|
|
30
|
-
* await startRepl({
|
|
31
|
-
* bootstrap: `globalThis.me = await User.firstOrFail({ email: 'me@example.com' })`,
|
|
32
|
-
* })
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare function startRepl(config?: ReplConfig): Promise<{ exitCode: number }>;
|
|
36
|
-
/**
|
|
37
|
-
* Lower-level entry that bypasses the bootstrap / route printing
|
|
38
|
-
* conveniences and forwards straight to `bun repl`. Use this if you
|
|
39
|
-
* need the bare wrapper (e.g. when scripting your own REPL launcher).
|
|
40
|
-
*/
|
|
41
|
-
export declare function startBunRepl(config?: TinkerConfig): Promise<{ exitCode: number }>;
|
|
42
|
-
export declare interface ReplConfig extends TinkerConfig {
|
|
43
|
-
loadFile?: string
|
|
44
|
-
bootstrap?: string
|
|
45
|
-
showRoutes?: boolean
|
|
46
|
-
}
|
|
47
|
-
// Re-export everything from tinker
|
|
48
|
-
export {
|
|
49
|
-
startTinker,
|
|
50
|
-
tinkerEval,
|
|
51
|
-
tinkerPrint,
|
|
52
|
-
getHistoryPath,
|
|
53
|
-
readHistory,
|
|
54
|
-
appendHistory,
|
|
55
|
-
clearHistory,
|
|
56
|
-
} from '@stacksjs/tinker';
|
package/dist/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var z=import.meta.require;import{startTinker as M,tinkerEval as N,tinkerPrint as O,getHistoryPath as Q,readHistory as V,appendHistory as W,clearHistory as X}from"@stacksjs/tinker";async function H(m={}){let{startTinker:A}=await import("@stacksjs/tinker"),q="";if(m.loadFile){let{readFileSync:x}=await import("fs");try{q+=`${x(m.loadFile,"utf-8")}
|
|
3
|
-
`}catch(D){console.error(`Failed to load file: ${m.loadFile}`,D)}}if(m.bootstrap)q+=`${m.bootstrap}
|
|
4
|
-
`;if(m.showRoutes)q+=`try {
|
|
5
|
-
const { listRegisteredRoutes } = await import('@stacksjs/router')
|
|
6
|
-
const rows = listRegisteredRoutes()
|
|
7
|
-
if (rows.length === 0) {
|
|
8
|
-
console.log(' (no routes registered yet \u2014 call route.importRoutes() first)')
|
|
9
|
-
} else {
|
|
10
|
-
console.log(' Routes:')
|
|
11
|
-
for (const r of rows) console.log(' ' + r.method.padEnd(6) + ' ' + r.path + (r.name ? ' (' + r.name + ')' : ''))
|
|
12
|
-
}
|
|
13
|
-
} catch (e) { console.warn(' (route introspection unavailable: ' + e.message + ')') }
|
|
14
|
-
`;if(m.eval)q+=m.eval;let B={...m,eval:q||void 0};try{return await A(B)}finally{try{let{stdin:x}=await import("process");if(x.isTTY&&typeof x.setRawMode==="function")x.setRawMode(!1)}catch{}}}async function I(m={}){let{startTinker:A}=await import("@stacksjs/tinker");return A(m)}export{O as tinkerPrint,N as tinkerEval,M as startTinker,H as startRepl,I as startBunRepl,V as readHistory,Q as getHistoryPath,X as clearHistory,W as appendHistory};
|