@stacksjs/tinker 0.74.20 → 0.74.21
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 +2 -2
- package/dist/index.js +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,9 +41,9 @@ Stacks uses [Pantry](https://pantry.dev) to provision Bun, Git, SQLite, and the
|
|
|
41
41
|
- **Pantry** - install it with `curl -fsSL https://pantry.dev | bash`, then run `pantry bootstrap` once to configure your shell.
|
|
42
42
|
- **macOS, Linux, or WSL** - Windows-native support is on the roadmap. The current toolchain assumes a POSIX shell.
|
|
43
43
|
|
|
44
|
-
Pantry installs and pins Bun 1.
|
|
44
|
+
Pantry installs and pins Bun 1.4.1 for this Stacks workspace, then keeps the rest of the machine and project dependencies in sync. Features such as PostgreSQL, Redis, and cloud deployment add their requirements through the same Pantry manifest where possible, with feature-specific configuration documented alongside them.
|
|
45
45
|
|
|
46
|
-
Stacks pins Pantry [`v0.
|
|
46
|
+
Stacks pins Pantry [`v0.11.50`](https://github.com/pantry-pm/pantry/tree/v0.11.50)
|
|
47
47
|
as an external toolchain contract. Resolution sources, lockfile and integrity
|
|
48
48
|
rules, lifecycle trust, registry routes, authentication, storage, and failure
|
|
49
49
|
modes are documented in the source-linked whitepaper references for the
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
2
|
+
import{existsSync as d,readFileSync as y,writeFileSync as c,appendFileSync as f,chmodSync as p}from"fs";import{homedir as k}from"os";import{join as u}from"path";import n from"process";function g(t){let e=[];if(t.stacksPreload!==!1)e.push(`
|
|
3
3
|
// ---- Stacks Framework Preload ----
|
|
4
4
|
// ORM & Database
|
|
5
5
|
try {
|
|
@@ -127,12 +127,12 @@ try {
|
|
|
127
127
|
globalThis.dump = (...args) => { console.dir(args.length === 1 ? args[0] : args, { depth: 6, colors: true }) }
|
|
128
128
|
globalThis.dd = (...args) => { console.dir(args.length === 1 ? args[0] : args, { depth: 6, colors: true }); process.exit(0) }
|
|
129
129
|
`);if(t.preload?.length)for(let s of t.preload){let o=s.replace(/[@/\-\.]/g,"_").replace(/^_+/,"");e.push(`try { globalThis.${o} = await import('${s}') } catch {}`)}return e.join(`
|
|
130
|
-
`)}function h(t){return t?.historyFile??u(
|
|
131
|
-
`).filter(Boolean)}function
|
|
132
|
-
`),o)try{
|
|
130
|
+
`)}function h(t){return t?.historyFile??u(k(),".stacks_tinker_history")}function v(t){let e=h(t);if(!d(e))return[];return y(e,"utf-8").split(`
|
|
131
|
+
`).filter(Boolean)}function C(t,e){let s=h(e),o=!d(s);if(f(s,`${t}
|
|
132
|
+
`),o)try{p(s,384)}catch{}let i=e?.historySize??5000,r=v(e);if(r.length>i){let a=r.slice(r.length-i);c(s,a.join(`
|
|
133
133
|
`)+`
|
|
134
|
-
`);try{
|
|
135
|
-
`)}async function
|
|
134
|
+
`);try{p(s,384)}catch{}}}function q(t){let e=h(t);c(e,"")}function w(){return["",` \x1B[36mStacks Tinker\x1B[0m (Bun v${typeof Bun<"u"?Bun.version:"unknown"})`," Interactive REPL with Stacks framework preloaded.",""," \x1B[2mAvailable globals: db, config, path, storage, log, Str,"," cache, queue, events, router, auth, collect, env, request,"," validate, Jobs, routes, dump, dd"," + all ORM models (User, Post, etc.)\x1B[0m",""," \x1B[2mType .help for REPL commands. Press Ctrl+D to exit.\x1B[0m",""].join(`
|
|
135
|
+
`)}async function m(t={}){let e=t.cwd??n.cwd();if(t.eval||t.print)return T(t,e);if(t.banner!==!1)n.stdout.write(w());let s=g(t),o=u(e,".tinker-preload.ts");c(o,s);let i=["repl"],a=await Bun.spawn(["bun",...i],{cwd:e,stdin:"inherit",stdout:"inherit",stderr:"inherit",env:{...n.env,BUN_PRELOAD:o}}).exited;try{let{unlinkSync:l}=await import("fs");l(o)}catch{}return{exitCode:a}}async function T(t,e){let s=g(t),o=t.print??t.eval??"",i=`${s}
|
|
136
136
|
|
|
137
137
|
const __result__ = await (async () => { return ${o} })()
|
|
138
|
-
${t.print?"console.log(__result__)":""}`,r=u(e,".tinker-eval.ts");c(r,i);let l=await Bun.spawn(["bun","run",r],{cwd:e,stdin:"inherit",stdout:"inherit",stderr:"inherit",env:n.env}).exited;try{let{unlinkSync:
|
|
138
|
+
${t.print?"console.log(__result__)":""}`,r=u(e,".tinker-eval.ts");c(r,i);let l=await Bun.spawn(["bun","run",r],{cwd:e,stdin:"inherit",stdout:"inherit",stderr:"inherit",env:n.env}).exited;try{let{unlinkSync:b}=await import("fs");b(r)}catch{}return{exitCode:l}}async function R(t,e={}){return m({...e,eval:t})}async function _(t,e={}){return m({...e,print:t})}export{C as appendHistory,q as clearHistory,h as getHistoryPath,v as readHistory,m as startTinker,R as tinkerEval,_ as tinkerPrint};
|
package/package.json
CHANGED